2.3.1 • Published 9 months ago

@gmwallet/app-common v2.3.1

Weekly downloads
15
License
ISC
Repository
-
Last release
9 months ago

Here's a README.md structure for your project:


Dynamic DOM Response Library

This library provides dynamic, responsive utilities for DOM elements. Available in both JavaScript (Beta) and TypeScript, it includes functions for responsive resizing, centering, input adaptation, and font scaling.

Features

The library includes the following functions:

  • fontSizer
  • getTextWidth
  • responsiveResize
  • responsiveCenter
  • responsiveInput

fontSizer

The fontSizer function adjusts the font size of text to fit within an element, such as an input field.

Parameters:

  • elemId: (string)Required. The id of the target element.
  • minimumFontSize: (number) – Default: element’s current font size. The standard font size to use.
  • lowerFontSize: (number) – Default: 0. The minimum allowed font size. Set to 0 for no limit.
  • interspace: (number) – Default: 25. Extra spacing for responsive adjustments.

Returns:

  • 0: Successful font adjustment
  • 1: Element not found
  • -1: Error

Example:

import { fontSizer } from "@gmwallet/app-common";

<label for="fname">First name:</label>
<input type="text" id="fname" name="fname" style="font-size: 24px" />
<br /><br />

const result = fontSizer("fname");
if (result === 0) {
  console.log("Font size adapted to input width.");
}

responsiveInput

The responsiveInput function ensures a responsive width for input elements by adjusting width based on the number of characters.

Parameters:

  • initialNumbers: Initial character count fully visible in the smallest width.
  • initialWidth: Initial input width before any changes.
  • currentNumbers: Updated character count after changes.
  • minWidth: Minimum width to display initial characters fully (use as CSS min-width).

Source Code: https://github.com/Aragorn1992gb/DDRL--app-common --- Powered by: Giacomo Brunetta ---

2.3.0

9 months ago

2.2.1

9 months ago

2.2.0

9 months ago

2.0.2

9 months ago

2.3.1

9 months ago

2.2.2

9 months ago

2.1.0

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.3.6

3 years ago

1.3.8

3 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.2.1

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago