@gmwallet/app-common v2.3.1
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 adjustment1
: 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 ---
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago