@lumx/core 3.20.1-alpha.49 → 3.20.1-alpha.50

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,6 +1,5 @@
1
1
  import type { ClassValue } from 'classnames/types';
2
- import type { KebabCase } from '@lumx/core/js/types';
3
- import { type Modifier, type RawModifier } from './generateBEMClass';
2
+ import { type Modifier } from './generateBEMClass';
4
3
  /**
5
4
  * Creates a BEM block class generator function for the given base class.
6
5
  * Returns a function that generates BEM class names with optional modifiers.
@@ -16,4 +15,4 @@ import { type Modifier, type RawModifier } from './generateBEMClass';
16
15
  * button('primary'); // 'my-button my-button--primary'
17
16
  * button({ active: true }); // 'my-button my-button--active'
18
17
  */
19
- export declare const block: <B extends string>(baseClass: KebabCase<B>) => <M extends RawModifier>(modifier?: Modifier<M>, additionalClasses?: ClassValue | ClassValue[]) => string;
18
+ export declare const block: (baseClass: string) => (modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]) => string;
@@ -1,6 +1,5 @@
1
1
  import type { ClassValue } from 'classnames/types';
2
- import type { KebabCase } from '@lumx/core/js/types';
3
- import { type Modifier, type RawModifier } from './generateBEMClass';
2
+ import { type Modifier } from './generateBEMClass';
4
3
  /**
5
4
  * Creates a BEM element class generator function for the given base class.
6
5
  * Returns a function that generates BEM element class names with optional modifiers.
@@ -17,4 +16,4 @@ import { type Modifier, type RawModifier } from './generateBEMClass';
17
16
  * button('icon', 'large'); // 'my-button__icon my-button__icon--large'
18
17
  * button('icon', { active: true }); // 'my-button__icon my-button__icon--active'
19
18
  */
20
- export declare const element: <B extends string>(baseClass: KebabCase<B>) => <E extends string, M extends RawModifier>(elem: KebabCase<E>, modifier?: Modifier<M>, additionalClasses?: ClassValue | ClassValue[]) => string;
19
+ export declare const element: (baseClass: string) => (elem: string, modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]) => string;
@@ -1,15 +1,11 @@
1
1
  import type { ClassValue } from 'classnames/types';
2
- import type { KebabCase } from '@lumx/core/js/types';
3
- export type RawModifier = string | Record<string, boolean> | ClassValue[];
4
2
  /**
5
3
  * Modifier
6
4
  * @example 'is-disabled'
7
5
  * @example { 'is-disabled': true, 'is-selected': false }
8
6
  * @example ['another-class'] // => Added as-is, not as a BEM modifier suffix
9
7
  */
10
- export type Modifier<T extends RawModifier> = T extends string ? KebabCase<T> : T extends Record<string, boolean> ? {
11
- [K in keyof T as KebabCase<K>]?: boolean;
12
- } : T;
8
+ export type Modifier = string | Record<string, boolean | undefined | null> | ClassValue[];
13
9
  /**
14
10
  * Generates a BEM (Block Element Modifier) class name string.
15
11
  * Combines a base class with optional modifiers and additional classes.
@@ -28,4 +24,4 @@ export type Modifier<T extends RawModifier> = T extends string ? KebabCase<T> :
28
24
  * generateBEMClass('button', { active: true, disabled: false }); // 'button button--active'
29
25
  * generateBEMClass('button', 'primary', 'my-class'); // 'button button--primary my-class'
30
26
  */
31
- export declare function generateBEMClass<M extends RawModifier>(baseClass: string, modifier?: Modifier<M>, additionalClasses?: ClassValue | ClassValue[]): string;
27
+ export declare function generateBEMClass(baseClass: string, modifier?: Modifier, additionalClasses?: ClassValue | ClassValue[]): string;
@@ -14,7 +14,7 @@ import { ColorVariant, ColorWithVariants } from '@lumx/core/js/constants';
14
14
  * color('font', 'primary-L2'); // 'lumx-color-font-primary-L2'
15
15
  * color('font', undefined); // undefined
16
16
  */
17
- export declare function color(type: 'font' | 'background', propColor: ColorWithVariants, propColorVariant?: ColorVariant): string | undefined;
17
+ export declare function color(type: 'font' | 'background', propColor: ColorWithVariants, propColorVariant?: ColorVariant): string;
18
18
  /**
19
19
  * Generates a Lumx background color class name for the given color and variant.
20
20
  *
@@ -26,7 +26,7 @@ export declare function color(type: 'font' | 'background', propColor: ColorWithV
26
26
  * background('dark', 'L2'); // 'lumx-color-background-dark-L2'
27
27
  * background('primary', 'N'); // 'lumx-color-background-primary-N'
28
28
  */
29
- export declare const background: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string | undefined;
29
+ export declare const background: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string;
30
30
  /**
31
31
  * Generates a Lumx font color class name for the given color and variant.
32
32
  *
@@ -40,4 +40,4 @@ export declare const background: (propColor: ColorWithVariants, propColorVariant
40
40
  * font('primary'); // 'lumx-color-font-primary-N'
41
41
  * font(undefined); // undefined
42
42
  */
43
- export declare const font: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string | undefined;
43
+ export declare const font: (propColor: ColorWithVariants, propColorVariant?: ColorVariant) => string;
@@ -17,8 +17,6 @@ import { resolveColorWithVariants } from '../../../../_internal/DPnPEC08.js';
17
17
  * color('font', undefined); // undefined
18
18
  */
19
19
  function color(type, propColor, propColorVariant) {
20
- if (!propColor)
21
- return undefined;
22
20
  const [cColor, cColorVariant = ColorVariant.N] = resolveColorWithVariants(propColor, propColorVariant);
23
21
  return `lumx-color-${type}-${cColor}-${cColorVariant}`;
24
22
  }
@@ -8,7 +8,7 @@ import type { Size } from '@lumx/core/js/constants';
8
8
  * @param size - Size
9
9
  * @returns string
10
10
  */
11
- export declare const spacing: (type: Spacing, direction?: Direction, size?: Size | null) => string;
11
+ export declare function spacing(type: Spacing, direction?: Direction, size?: Size | null): string;
12
12
  /**
13
13
  * Returns a list of lumx classnames for the given types, directions and sizes. For example, for
14
14
  * arguments [
@@ -8,7 +8,7 @@ import classnames from 'classnames';
8
8
  * @param size - Size
9
9
  * @returns string
10
10
  */
11
- const spacing = (type, direction, size) => {
11
+ function spacing(type, direction, size) {
12
12
  let baseClass = `lumx-spacing-${type}`;
13
13
  if (direction && direction !== 'all') {
14
14
  baseClass = `${baseClass}-${direction}`;
@@ -20,7 +20,7 @@ const spacing = (type, direction, size) => {
20
20
  baseClass = `${baseClass}-none`;
21
21
  }
22
22
  return baseClass;
23
- };
23
+ }
24
24
  /**
25
25
  * Returns a list of lumx classnames for the given types, directions and sizes. For example, for
26
26
  * arguments [
@@ -31,9 +31,7 @@ const spacing = (type, direction, size) => {
31
31
  * @param spacingConfigs - Array of spacing configurations with direction and size
32
32
  * @returns string
33
33
  */
34
- const spacings = (spacingConfigs) => {
35
- return classnames(spacingConfigs.map((spa) => spacing(spa.type, spa.direction, spa.size)));
36
- };
34
+ const spacings = (spacingConfigs) => classnames(spacingConfigs.map((spa) => spacing(spa.type, spa.direction, spa.size)));
37
35
  /**
38
36
  * Returns a lumx margin classname for the given direction and size. For example, for
39
37
  * arguments direction='right', size='regular' it returns lumx-spacing-margin-right-regular
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.20.1-alpha.49",
38
+ "version": "3.20.1-alpha.50",
39
39
  "devDependencies": {
40
40
  "@rollup/plugin-typescript": "^12.3.0",
41
41
  "@types/react": "^17.0.2",