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

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.
@@ -1,4 +0,0 @@
1
- /**
2
- * Visually hidden a11y utility class name
3
- */
4
- export declare const VISUALLY_HIDDEN = "visually-hidden";
@@ -1,6 +0,0 @@
1
- /**
2
- * Visually hidden a11y utility class name
3
- */
4
- const VISUALLY_HIDDEN = 'visually-hidden';
5
-
6
- export { VISUALLY_HIDDEN };
@@ -1 +0,0 @@
1
- export type Direction = 'top' | 'right' | 'bottom' | 'left' | 'vertical' | 'horizontal' | 'all';
@@ -1 +0,0 @@
1
- export type Spacing = 'margin' | 'padding';
@@ -1,13 +0,0 @@
1
- /**
2
- * Get the basic CSS class for the given type.
3
- *
4
- * @param prefix The class name prefix for the generated CSS class.
5
- * @param type The type of CSS class we want to generate (e.g.: 'color', 'variant', ...).
6
- * @param value The value of the type of the CSS class (e.g.: 'primary', 'button', ...).
7
- * @return The basic CSS class.
8
- */
9
- export declare function getBasicClass({ prefix, type, value, }: {
10
- prefix: string;
11
- type: string;
12
- value: string | number | boolean | undefined;
13
- }): string;
@@ -1,15 +0,0 @@
1
- /**
2
- * Return all basic LumX CSS classes which are available for every components.
3
- *
4
- * @see {@link /src/components/index.d.ts} for the possible values of each parameter.
5
- *
6
- * @param prefix The class name prefix for the generated CSS class.
7
- * @param props All the other props you want to generate a class.
8
- * The rule of thumb: the key is the name of the prop in the class, the value a string that will
9
- * be used in the classname to represent the value of the given prop.
10
- * @return All LumX basic CSS classes.
11
- */
12
- export declare function handleBasicClasses({ prefix, ...props }: {
13
- prefix: string;
14
- [prop: string]: any;
15
- }): string;
@@ -1,2 +0,0 @@
1
- export { handleBasicClasses } from './handleBasicClasses';
2
- export { getBasicClass } from './getBasicClass';
@@ -1 +0,0 @@
1
- export { resolveColorWithVariants } from './resolveColorWithVariants';
@@ -1,3 +0,0 @@
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];
@@ -1,43 +0,0 @@
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;
@@ -1,50 +0,0 @@
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 };
@@ -1,5 +0,0 @@
1
- export { default as join } from 'classnames';
2
- export * from './color';
3
- export * from './typography';
4
- export * from './spacing';
5
- export * from './visually-hidden';
@@ -1,5 +0,0 @@
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';
@@ -1,70 +0,0 @@
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;
@@ -1,74 +0,0 @@
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 };
@@ -1,6 +0,0 @@
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;
@@ -1,9 +0,0 @@
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 };
@@ -1,5 +0,0 @@
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;
@@ -1,10 +0,0 @@
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 };