@lumx/core 3.21.2-alpha.1 → 3.21.2-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/_internal/DPnPEC08.js +9 -0
  2. package/js/constants/_internal/design-tokens.d.ts +5421 -0
  3. package/js/constants/className/index.d.ts +4 -0
  4. package/js/constants/className/index.js +6 -0
  5. package/js/constants/index.d.ts +1 -0
  6. package/js/constants/index.js +1 -0
  7. package/js/types/Direction.d.ts +1 -0
  8. package/js/types/Spacing.d.ts +1 -0
  9. package/js/types/index.d.ts +3 -0
  10. package/js/utils/_internal/color/index.d.ts +1 -0
  11. package/js/utils/_internal/color/resolveColorWithVariants.d.ts +3 -0
  12. package/js/utils/classNames/bem/block.d.ts +18 -0
  13. package/js/utils/classNames/bem/block.js +20 -0
  14. package/js/utils/classNames/bem/element.d.ts +19 -0
  15. package/js/utils/classNames/bem/element.js +21 -0
  16. package/js/utils/classNames/bem/generateBEMClass.d.ts +27 -0
  17. package/js/utils/classNames/bem/generateBEMClass.js +48 -0
  18. package/js/utils/classNames/bem/index.d.ts +2 -0
  19. package/js/utils/classNames/bem/index.js +2 -0
  20. package/js/utils/classNames/color/index.d.ts +43 -0
  21. package/js/utils/classNames/color/index.js +50 -0
  22. package/js/utils/classNames/index.d.ts +6 -0
  23. package/js/utils/classNames/index.js +7 -0
  24. package/js/utils/classNames/spacing/index.d.ts +70 -0
  25. package/js/utils/classNames/spacing/index.js +74 -0
  26. package/js/utils/classNames/typography/index.d.ts +6 -0
  27. package/js/utils/classNames/typography/index.js +9 -0
  28. package/js/utils/classNames/visually-hidden/index.d.ts +5 -0
  29. package/js/utils/classNames/visually-hidden/index.js +10 -0
  30. package/js/utils/index.d.ts +1 -0
  31. package/js/utils/index.js +2 -0
  32. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Visually hidden a11y utility class name
3
+ */
4
+ export declare const VISUALLY_HIDDEN = "visually-hidden";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Visually hidden a11y utility class name
3
+ */
4
+ const VISUALLY_HIDDEN = 'visually-hidden';
5
+
6
+ export { VISUALLY_HIDDEN };
@@ -1,3 +1,4 @@
1
1
  export * from './keycodes';
2
2
  export * from './components';
3
3
  export * from './enums';
4
+ export * from './className';
@@ -1,3 +1,4 @@
1
1
  export { BACKSPACE_KEY_CODE, DOWN_KEY_CODE, ENTER_KEY_CODE, ESCAPE_KEY_CODE, LEFT_KEY_CODE, RIGHT_KEY_CODE, SPACE_KEY_CODE, TAB_KEY_CODE, UP_KEY_CODE } from './keycodes/index.js';
2
2
  export { DIALOG_TRANSITION_DURATION, EXPANSION_PANEL_TRANSITION_DURATION, NOTIFICATION_TRANSITION_DURATION, SLIDESHOW_TRANSITION_DURATION, TOOLTIP_HOVER_DELAY, TOOLTIP_LONG_PRESS_DELAY } from './components/index.js';
3
3
  export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace } from './enums/index.js';
4
+ export { VISUALLY_HIDDEN } from './className/index.js';
@@ -0,0 +1 @@
1
+ export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'vertical' | 'horizontal' | 'all';
@@ -0,0 +1 @@
1
+ export type Spacing = 'margin' | 'padding';
@@ -6,9 +6,12 @@ export type { HasCloseMode } from './HasCloseMode';
6
6
  export type { HasTheme } from './HasTheme';
7
7
  export type { GenericProps } from './GenericProps';
8
8
  export type { HeadingElement } from './HeadingElement';
9
+ export type { KebabCase } from './KebabCase';
9
10
  export type { Point } from './Point';
10
11
  export type { Predicate } from './Predicate';
11
12
  export type { RectSize } from './RectSize';
12
13
  export type { TextElement } from './TextElement';
13
14
  export type { ValueOf } from './ValueOf';
14
15
  export type { LumxClassName } from './LumxClassName';
16
+ export type { Direction } from './Direction';
17
+ export type { Spacing } from './Spacing';
@@ -0,0 +1 @@
1
+ export { resolveColorWithVariants } from './resolveColorWithVariants';
@@ -0,0 +1,3 @@
1
+ import type { ColorPalette, ColorVariant, ColorWithVariants } from '@lumx/core/js/constants';
2
+ /** Resolve color & color variant from a `ColorWithVariants` and optionally a `ColorVariant`. */
3
+ export declare function resolveColorWithVariants(colorWithVariants?: ColorWithVariants, colorVariant?: ColorVariant): [color?: ColorPalette, colorVariant?: ColorVariant];
@@ -0,0 +1,18 @@
1
+ import type { ClassValue } from 'classnames/types';
2
+ import { type Modifier } from './generateBEMClass';
3
+ /**
4
+ * Creates a BEM block class generator function for the given base class.
5
+ * Returns a function that generates BEM class names with optional modifiers.
6
+ *
7
+ * @param baseClass - The base BEM block class name (e.g., 'button', 'card')
8
+ * @returns A function that accepts:
9
+ * - modifier - Optional BEM modifier (string, object, or array)
10
+ * - additionalClasses - Optional additional classes to include
11
+ *
12
+ * @example
13
+ * const button = block('my-button');
14
+ * button(); // 'my-button'
15
+ * button('primary'); // 'my-button my-button--primary'
16
+ * button({ active: true }); // 'my-button my-button--active'
17
+ */
18
+ export declare const block: (baseClass: string) => (modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]) => string;
@@ -0,0 +1,20 @@
1
+ import { generateBEMClass } from './generateBEMClass.js';
2
+
3
+ /**
4
+ * Creates a BEM block class generator function for the given base class.
5
+ * Returns a function that generates BEM class names with optional modifiers.
6
+ *
7
+ * @param baseClass - The base BEM block class name (e.g., 'button', 'card')
8
+ * @returns A function that accepts:
9
+ * - modifier - Optional BEM modifier (string, object, or array)
10
+ * - additionalClasses - Optional additional classes to include
11
+ *
12
+ * @example
13
+ * const button = block('my-button');
14
+ * button(); // 'my-button'
15
+ * button('primary'); // 'my-button my-button--primary'
16
+ * button({ active: true }); // 'my-button my-button--active'
17
+ */
18
+ const block = (baseClass) => (modifier, additionalClasses) => generateBEMClass(baseClass, modifier, additionalClasses);
19
+
20
+ export { block };
@@ -0,0 +1,19 @@
1
+ import type { ClassValue } from 'classnames/types';
2
+ import { type Modifier } from './generateBEMClass';
3
+ /**
4
+ * Creates a BEM element class generator function for the given base class.
5
+ * Returns a function that generates BEM element class names with optional modifiers.
6
+ *
7
+ * @param baseClass - The base BEM block class name (e.g., 'button', 'card')
8
+ * @returns A function that accepts:
9
+ * - elem - The BEM element name (e.g., 'icon', 'title')
10
+ * - modifier - Optional BEM modifier (string, object, or array)
11
+ * - additionalClasses - Optional additional classes to include
12
+ *
13
+ * @example
14
+ * const button = element('my-button');
15
+ * button('icon'); // 'my-button__icon'
16
+ * button('icon', 'large'); // 'my-button__icon my-button__icon--large'
17
+ * button('icon', { active: true }); // 'my-button__icon my-button__icon--active'
18
+ */
19
+ export declare const element: (baseClass: string) => (elem: string, modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]) => string;
@@ -0,0 +1,21 @@
1
+ import { generateBEMClass } from './generateBEMClass.js';
2
+
3
+ /**
4
+ * Creates a BEM element class generator function for the given base class.
5
+ * Returns a function that generates BEM element class names with optional modifiers.
6
+ *
7
+ * @param baseClass - The base BEM block class name (e.g., 'button', 'card')
8
+ * @returns A function that accepts:
9
+ * - elem - The BEM element name (e.g., 'icon', 'title')
10
+ * - modifier - Optional BEM modifier (string, object, or array)
11
+ * - additionalClasses - Optional additional classes to include
12
+ *
13
+ * @example
14
+ * const button = element('my-button');
15
+ * button('icon'); // 'my-button__icon'
16
+ * button('icon', 'large'); // 'my-button__icon my-button__icon--large'
17
+ * button('icon', { active: true }); // 'my-button__icon my-button__icon--active'
18
+ */
19
+ const element = (baseClass) => (elem, modifier, additionalClasses) => generateBEMClass(`${baseClass}__${elem}`, modifier, additionalClasses);
20
+
21
+ export { element };
@@ -0,0 +1,27 @@
1
+ import type { ClassValue } from 'classnames/types';
2
+ /**
3
+ * Modifier
4
+ * @example 'is-disabled'
5
+ * @example { 'is-disabled': true, 'is-selected': false }
6
+ * @example ['another-class'] // => Added as-is, not as a BEM modifier suffix
7
+ */
8
+ export type Modifier = string | Record<string, boolean | undefined | null> | ClassValue[];
9
+ /**
10
+ * Generates a BEM (Block Element Modifier) class name string.
11
+ * Combines a base class with optional modifiers and additional classes.
12
+ *
13
+ * @param baseClass - The base BEM class (block or element)
14
+ * @param modifier - Optional modifier as:
15
+ * - string: creates `baseClass--modifier`
16
+ * - object: creates `baseClass--key` for each truthy value
17
+ * - array: passes through as additional classes
18
+ * @param additionalClasses - Optional additional classes to include
19
+ * @returns Combined class name string
20
+ *
21
+ * @example
22
+ * generateBEMClass('button'); // 'button'
23
+ * generateBEMClass('button', 'primary'); // 'button button--primary'
24
+ * generateBEMClass('button', { active: true, disabled: false }); // 'button button--active'
25
+ * generateBEMClass('button', 'primary', 'my-class'); // 'button button--primary my-class'
26
+ */
27
+ export declare function generateBEMClass(baseClass: string, modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]): string;
@@ -0,0 +1,48 @@
1
+ import classnames from 'classnames';
2
+
3
+ function generateModifierClasses(baseClass, modifier) {
4
+ if (!modifier) {
5
+ return undefined;
6
+ }
7
+ if (Array.isArray(modifier)) {
8
+ return modifier;
9
+ }
10
+ if (typeof modifier === 'string') {
11
+ return `${baseClass}--${modifier}`;
12
+ }
13
+ const classes = [];
14
+ for (const [key, value] of Object.entries(modifier)) {
15
+ if (value)
16
+ classes.push(`${baseClass}--${key}`);
17
+ }
18
+ return classes;
19
+ }
20
+ /**
21
+ * Generates a BEM (Block Element Modifier) class name string.
22
+ * Combines a base class with optional modifiers and additional classes.
23
+ *
24
+ * @param baseClass - The base BEM class (block or element)
25
+ * @param modifier - Optional modifier as:
26
+ * - string: creates `baseClass--modifier`
27
+ * - object: creates `baseClass--key` for each truthy value
28
+ * - array: passes through as additional classes
29
+ * @param additionalClasses - Optional additional classes to include
30
+ * @returns Combined class name string
31
+ *
32
+ * @example
33
+ * generateBEMClass('button'); // 'button'
34
+ * generateBEMClass('button', 'primary'); // 'button button--primary'
35
+ * generateBEMClass('button', { active: true, disabled: false }); // 'button button--active'
36
+ * generateBEMClass('button', 'primary', 'my-class'); // 'button button--primary my-class'
37
+ */
38
+ function generateBEMClass(baseClass, modifier, additionalClasses) {
39
+ return classnames(
40
+ // Base class
41
+ baseClass,
42
+ // Modifier(s)
43
+ generateModifierClasses(baseClass, modifier),
44
+ // Additional classes
45
+ additionalClasses);
46
+ }
47
+
48
+ export { generateBEMClass };
@@ -0,0 +1,2 @@
1
+ export { block } from './block';
2
+ export { element } from './element';
@@ -0,0 +1,2 @@
1
+ export { block } from './block.js';
2
+ export { element } from './element.js';
@@ -0,0 +1,43 @@
1
+ import { ColorVariant, ColorWithVariants } from '@lumx/core/js/constants';
2
+ /**
3
+ * Generates a Lumx color class name for the given type, color and variant.
4
+ * This is the base function used by font() and background() utilities.
5
+ *
6
+ * @param type - The color class type ('font' or 'background')
7
+ * @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
8
+ * @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
9
+ * @returns The Lumx color class name or undefined if no color is provided
10
+ *
11
+ * @example
12
+ * color('font', 'dark', 'L2'); // 'lumx-color-font-dark-L2'
13
+ * color('background', 'primary'); // 'lumx-color-background-primary-N'
14
+ * color('font', 'primary-L2'); // 'lumx-color-font-primary-L2'
15
+ * color('font', undefined); // undefined
16
+ */
17
+ export declare function color(type: 'font' | 'background', propColor: ColorWithVariants, propColorVariant?: ColorVariant): string;
18
+ /**
19
+ * Generates a Lumx background color class name for the given color and variant.
20
+ *
21
+ * @param propColor - The color palette name (e.g., 'primary', 'dark', 'light')
22
+ * @param propColorVariant - The color variant (e.g., 'L1', 'L2', 'D1', 'N')
23
+ * @returns The Lumx background color class name
24
+ *
25
+ * @example
26
+ * background('dark', 'L2'); // 'lumx-color-background-dark-L2'
27
+ * background('primary', 'N'); // 'lumx-color-background-primary-N'
28
+ */
29
+ export declare const background: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string;
30
+ /**
31
+ * Generates a Lumx font color class name for the given color and variant.
32
+ *
33
+ * @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
34
+ * @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
35
+ * @returns The Lumx font color class name or undefined if no color is provided
36
+ *
37
+ * @example
38
+ * font('dark', 'L2'); // 'lumx-color-font-dark-L2'
39
+ * font('primary-L2'); // 'lumx-color-font-primary-L2'
40
+ * font('primary'); // 'lumx-color-font-primary-N'
41
+ * font(undefined); // undefined
42
+ */
43
+ export declare const font: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string;
@@ -0,0 +1,50 @@
1
+ import { ColorVariant } from '../../../constants/enums/index.js';
2
+ import { resolveColorWithVariants } from '../../../../_internal/DPnPEC08.js';
3
+
4
+ /**
5
+ * Generates a Lumx color class name for the given type, color and variant.
6
+ * This is the base function used by font() and background() utilities.
7
+ *
8
+ * @param type - The color class type ('font' or 'background')
9
+ * @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
10
+ * @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
11
+ * @returns The Lumx color class name or undefined if no color is provided
12
+ *
13
+ * @example
14
+ * color('font', 'dark', 'L2'); // 'lumx-color-font-dark-L2'
15
+ * color('background', 'primary'); // 'lumx-color-background-primary-N'
16
+ * color('font', 'primary-L2'); // 'lumx-color-font-primary-L2'
17
+ * color('font', undefined); // undefined
18
+ */
19
+ function color(type, propColor, propColorVariant) {
20
+ const [cColor, cColorVariant = ColorVariant.N] = resolveColorWithVariants(propColor, propColorVariant);
21
+ return `lumx-color-${type}-${cColor}-${cColorVariant}`;
22
+ }
23
+ /**
24
+ * Generates a Lumx background color class name for the given color and variant.
25
+ *
26
+ * @param propColor - The color palette name (e.g., 'primary', 'dark', 'light')
27
+ * @param propColorVariant - The color variant (e.g., 'L1', 'L2', 'D1', 'N')
28
+ * @returns The Lumx background color class name
29
+ *
30
+ * @example
31
+ * background('dark', 'L2'); // 'lumx-color-background-dark-L2'
32
+ * background('primary', 'N'); // 'lumx-color-background-primary-N'
33
+ */
34
+ const background = (propColor, propColorVariant) => color('background', propColor, propColorVariant);
35
+ /**
36
+ * Generates a Lumx font color class name for the given color and variant.
37
+ *
38
+ * @param propColor - The color palette name (e.g., 'primary', 'dark') with optional variant suffix (e.g., 'primary-L2')
39
+ * @param propColorVariant - Optional color variant override (e.g., 'L1', 'L2', 'D1', 'N')
40
+ * @returns The Lumx font color class name or undefined if no color is provided
41
+ *
42
+ * @example
43
+ * font('dark', 'L2'); // 'lumx-color-font-dark-L2'
44
+ * font('primary-L2'); // 'lumx-color-font-primary-L2'
45
+ * font('primary'); // 'lumx-color-font-primary-N'
46
+ * font(undefined); // undefined
47
+ */
48
+ const font = (propColor, propColorVariant) => color('font', propColor, propColorVariant);
49
+
50
+ export { background, color, font };
@@ -0,0 +1,6 @@
1
+ export { default as join } from 'classnames';
2
+ export * from './color';
3
+ export * from './typography';
4
+ export * from './spacing';
5
+ export * from './visually-hidden';
6
+ export * as bem from './bem';
@@ -0,0 +1,7 @@
1
+ export { default as join } from 'classnames';
2
+ export { background, color, font } from './color/index.js';
3
+ export { typography } from './typography/index.js';
4
+ export { margin, margins, padding, paddings, spacing, spacings } from './spacing/index.js';
5
+ export { visuallyHidden } from './visually-hidden/index.js';
6
+ import * as index from './bem/index.js';
7
+ export { index as bem };
@@ -0,0 +1,70 @@
1
+ import type { Direction, Spacing } from '@lumx/core/js/types';
2
+ import type { Size } from '@lumx/core/js/constants';
3
+ /**
4
+ * Returns a lumx classname for the given type, direction and size. For example, for
5
+ * arguments type='padding', direction='right', size='regular' it returns lumx-spacing-padding-right-regular
6
+ * @param type - margin or padding
7
+ * @param direction - Direction
8
+ * @param size - Size
9
+ * @returns string
10
+ */
11
+ export declare function spacing(type: Spacing, direction?: Direction, size?: Size | null): string;
12
+ /**
13
+ * Returns a list of lumx classnames for the given types, directions and sizes. For example, for
14
+ * arguments [
15
+ * { type: 'padding', direction: 'right', size: 'regular'},
16
+ * { type: 'margin', direction: 'left', size: 'big'},
17
+ * ]
18
+ * it returns lumx-spacing-padding-right-regular lumx-spacing-margin-left-big
19
+ * @param spacingConfigs - Array of spacing configurations with direction and size
20
+ * @returns string
21
+ */
22
+ export declare const spacings: (spacingConfigs: {
23
+ type: Spacing;
24
+ direction?: Direction;
25
+ size?: Size | null;
26
+ }[]) => string;
27
+ /**
28
+ * Returns a lumx margin classname for the given direction and size. For example, for
29
+ * arguments direction='right', size='regular' it returns lumx-spacing-margin-right-regular
30
+ * @param direction - Direction
31
+ * @param size - Size
32
+ * @returns string
33
+ */
34
+ export declare const margin: (direction?: Direction, size?: Size | null) => string;
35
+ /**
36
+ * Returns a list of lumx margin classnames for the given directions and sizes. For example, for
37
+ * arguments [
38
+ * { direction: 'right', size: 'regular'},
39
+ * { direction: 'left', size: 'big'},
40
+ * ]
41
+ * it returns lumx-spacing-margin-right-regular lumx-spacing-margin-left-big
42
+ * @param marginConfigs - Array of padding configurations with direction and size
43
+ * @returns string
44
+ */
45
+ export declare const margins: (marginConfigs: {
46
+ direction?: Direction;
47
+ size?: Size | null;
48
+ }[]) => string;
49
+ /**
50
+ * Returns a lumx padding classname for the given direction and size. For example, for
51
+ * arguments direction='right', size='regular' it returns lumx-spacing-padding-right-regular
52
+ * @param direction - Direction
53
+ * @param size - Size
54
+ * @returns string
55
+ */
56
+ export declare const padding: (direction?: Direction, size?: Size | null) => string;
57
+ /**
58
+ * Returns a list of lumx padding classnames for the given directions and sizes. For example, for
59
+ * arguments [
60
+ * { direction: 'right', size: 'regular'},
61
+ * { direction: 'left', size: 'big'},
62
+ * ]
63
+ * it returns lumx-spacing-padding-right-regular lumx-spacing-padding-left-big
64
+ * @param paddingConfigs - Array of padding configurations with direction and size
65
+ * @returns Combined padding classnames as a string
66
+ */
67
+ export declare const paddings: (paddingConfigs: {
68
+ direction?: Direction;
69
+ size?: Size | null;
70
+ }[]) => string;
@@ -0,0 +1,74 @@
1
+ import classnames from 'classnames';
2
+
3
+ /**
4
+ * Returns a lumx classname for the given type, direction and size. For example, for
5
+ * arguments type='padding', direction='right', size='regular' it returns lumx-spacing-padding-right-regular
6
+ * @param type - margin or padding
7
+ * @param direction - Direction
8
+ * @param size - Size
9
+ * @returns string
10
+ */
11
+ function spacing(type, direction, size) {
12
+ let baseClass = `lumx-spacing-${type}`;
13
+ if (direction && direction !== 'all') {
14
+ baseClass = `${baseClass}-${direction}`;
15
+ }
16
+ if (size) {
17
+ baseClass = `${baseClass}-${size}`;
18
+ }
19
+ else if (size === null) {
20
+ baseClass = `${baseClass}-none`;
21
+ }
22
+ return baseClass;
23
+ }
24
+ /**
25
+ * Returns a list of lumx classnames for the given types, directions and sizes. For example, for
26
+ * arguments [
27
+ * { type: 'padding', direction: 'right', size: 'regular'},
28
+ * { type: 'margin', direction: 'left', size: 'big'},
29
+ * ]
30
+ * it returns lumx-spacing-padding-right-regular lumx-spacing-margin-left-big
31
+ * @param spacingConfigs - Array of spacing configurations with direction and size
32
+ * @returns string
33
+ */
34
+ const spacings = (spacingConfigs) => classnames(spacingConfigs.map((spa) => spacing(spa.type, spa.direction, spa.size)));
35
+ /**
36
+ * Returns a lumx margin classname for the given direction and size. For example, for
37
+ * arguments direction='right', size='regular' it returns lumx-spacing-margin-right-regular
38
+ * @param direction - Direction
39
+ * @param size - Size
40
+ * @returns string
41
+ */
42
+ const margin = (direction, size) => spacing('margin', direction, size);
43
+ /**
44
+ * Returns a list of lumx margin classnames for the given directions and sizes. For example, for
45
+ * arguments [
46
+ * { direction: 'right', size: 'regular'},
47
+ * { direction: 'left', size: 'big'},
48
+ * ]
49
+ * it returns lumx-spacing-margin-right-regular lumx-spacing-margin-left-big
50
+ * @param marginConfigs - Array of padding configurations with direction and size
51
+ * @returns string
52
+ */
53
+ const margins = (marginConfigs) => spacings(marginConfigs.map(({ direction, size }) => ({ type: 'margin', direction, size })));
54
+ /**
55
+ * Returns a lumx padding classname for the given direction and size. For example, for
56
+ * arguments direction='right', size='regular' it returns lumx-spacing-padding-right-regular
57
+ * @param direction - Direction
58
+ * @param size - Size
59
+ * @returns string
60
+ */
61
+ const padding = (direction, size) => spacing('padding', direction, size);
62
+ /**
63
+ * Returns a list of lumx padding classnames for the given directions and sizes. For example, for
64
+ * arguments [
65
+ * { direction: 'right', size: 'regular'},
66
+ * { direction: 'left', size: 'big'},
67
+ * ]
68
+ * it returns lumx-spacing-padding-right-regular lumx-spacing-padding-left-big
69
+ * @param paddingConfigs - Array of padding configurations with direction and size
70
+ * @returns Combined padding classnames as a string
71
+ */
72
+ const paddings = (paddingConfigs) => spacings(paddingConfigs.map(({ direction, size }) => ({ type: 'padding', direction, size })));
73
+
74
+ export { margin, margins, padding, paddings, spacing, spacings };
@@ -0,0 +1,6 @@
1
+ import type { Typography } from '@lumx/core/js/constants';
2
+ /**
3
+ * Returns the classname associated to the given typography. For example, for Typography.title it returns
4
+ * lumx-typography-title
5
+ */
6
+ export declare function typography(typo: Typography): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Returns the classname associated to the given typography. For example, for Typography.title it returns
3
+ * lumx-typography-title
4
+ */
5
+ function typography(typo) {
6
+ return `lumx-typography-${typo}`;
7
+ }
8
+
9
+ export { typography };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Visually hidden class name.
3
+ * Used to hide elements from view but keep them readable from screen readers
4
+ */
5
+ export declare const visuallyHidden: () => string;
@@ -0,0 +1,10 @@
1
+ import '../../../constants/enums/index.js';
2
+ import { VISUALLY_HIDDEN } from '../../../constants/className/index.js';
3
+
4
+ /**
5
+ * Visually hidden class name.
6
+ * Used to hide elements from view but keep them readable from screen readers
7
+ */
8
+ const visuallyHidden = () => VISUALLY_HIDDEN;
9
+
10
+ export { visuallyHidden };
@@ -1 +1,2 @@
1
+ export * as classNames from './classNames';
1
2
  export * from './events';
package/js/utils/index.js CHANGED
@@ -1,2 +1,4 @@
1
+ import * as index from './classNames/index.js';
2
+ export { index as classNames };
1
3
  export { onButtonPressed, onEnterPressed, onEscapePressed } from './events/keyboard.js';
2
4
  export { detectHorizontalSwipe } from './events/swipe.js';
package/package.json CHANGED
@@ -35,7 +35,7 @@
35
35
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
36
36
  },
37
37
  "sideEffects": false,
38
- "version": "3.21.2-alpha.1",
38
+ "version": "3.21.2-alpha.3",
39
39
  "devDependencies": {
40
40
  "@rollup/plugin-typescript": "^12.3.0",
41
41
  "@types/react": "^17.0.2",