@lumx/core 4.3.2-alpha.20 → 4.3.2-alpha.22

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.
@@ -19,11 +19,11 @@ export declare const COMPONENT_NAME = "Flag";
19
19
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
20
20
  export declare const DEFAULT_PROPS: Partial<FlagProps>;
21
21
  export declare const block: {
22
- (additionalClasses: string[]): string;
23
- (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
22
+ (additionalClasses: import("classnames/types").ClassValue[]): string;
23
+ (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
24
24
  }, element: {
25
- (elem: string, additionalClasses: string[]): string;
26
- (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
25
+ (elem: string, additionalClasses: import("classnames/types").ClassValue[]): string;
26
+ (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
27
27
  };
28
28
  /**
29
29
  * Flag component.
@@ -34,8 +34,8 @@ export declare const COMPONENT_NAME = "FlexBox";
34
34
  */
35
35
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
36
36
  export declare const block: {
37
- (additionalClasses: string[]): string;
38
- (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
37
+ (additionalClasses: import("classnames/types").ClassValue[]): string;
38
+ (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
39
39
  };
40
40
  /**
41
41
  * Get FlexBox component props (className computation).
@@ -0,0 +1,48 @@
1
+ import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
2
+ import { Size } from '../../constants';
3
+ export type GridColumnGapSize = Extract<Size, 'tiny' | 'regular' | 'big' | 'huge'>;
4
+ /**
5
+ * Defines the props of the component.
6
+ */
7
+ export interface GridColumnProps extends HasClassName {
8
+ /** Customize the root element. */
9
+ as?: any;
10
+ /** Children elements. */
11
+ children?: JSXElement;
12
+ /** Space between columns and rows. */
13
+ gap?: GridColumnGapSize;
14
+ /** Ideal number of columns. */
15
+ maxColumns?: number;
16
+ /** Minimum width for each item, reduce the number of column if there is not enough space. */
17
+ itemMinWidth?: number;
18
+ /** Custom styles. */
19
+ style?: any;
20
+ /** reference to the root element */
21
+ ref?: CommonRef;
22
+ }
23
+ /**
24
+ * Component display name.
25
+ */
26
+ export declare const COMPONENT_NAME = "GridColumn";
27
+ /**
28
+ * Component default class name and class prefix.
29
+ */
30
+ export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
31
+ /**
32
+ * Component default props.
33
+ */
34
+ export declare const DEFAULT_PROPS: Partial<GridColumnProps>;
35
+ /**
36
+ * The GridColumn is a layout component that can display children in a grid
37
+ * with custom display properties. It also comes with a responsive design,
38
+ * with a number of column that reduce when there is not enough space for each item.
39
+ *
40
+ * @param props Component props.
41
+ * @return JSX element.
42
+ */
43
+ export declare const GridColumn: {
44
+ (props: GridColumnProps): import("react").JSX.Element;
45
+ displayName: string;
46
+ className: "lumx-grid-column";
47
+ defaultProps: Partial<GridColumnProps>;
48
+ };
@@ -0,0 +1,47 @@
1
+ import type { SetupStoriesOptions } from '@lumx/core/stories/types';
2
+ export declare function setup({ component, render, }: SetupStoriesOptions<{
3
+ decorators?: never;
4
+ }>): {
5
+ meta: {
6
+ component: any;
7
+ render: any;
8
+ argTypes: {
9
+ nbItems: {
10
+ control: string;
11
+ };
12
+ gap: {
13
+ control: {
14
+ type: "select" | "inline-radio";
15
+ };
16
+ options: (import("./GridColumn").GridColumnGapSize | undefined)[];
17
+ mapping: Record<string, import("./GridColumn").GridColumnGapSize | undefined> | undefined;
18
+ };
19
+ itemMinWidth: {
20
+ control: string;
21
+ };
22
+ maxColumns: {
23
+ control: string;
24
+ };
25
+ };
26
+ args: {
27
+ nbItems: number;
28
+ as?: any;
29
+ children?: import("react").ReactNode;
30
+ gap?: import("./GridColumn").GridColumnGapSize | undefined;
31
+ maxColumns?: number | undefined;
32
+ itemMinWidth?: number | undefined;
33
+ style?: any;
34
+ ref?: import("../../types").CommonRef;
35
+ className?: string | undefined;
36
+ };
37
+ };
38
+ /** Default grid column displaying a single column */
39
+ Default: {};
40
+ /** Grid column with max 4 columns (responsive) */
41
+ Columns: {
42
+ args: {
43
+ maxColumns: number;
44
+ itemMinWidth: number;
45
+ };
46
+ };
47
+ };
@@ -0,0 +1,12 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ /**
3
+ * Mounts the component and returns common DOM elements / data needed in multiple tests further down.
4
+ */
5
+ export declare const setup: (propsOverride: any | undefined, { render, ...options }: SetupOptions<any>) => {
6
+ props: any;
7
+ gridColumn: HTMLElement;
8
+ div: HTMLElement;
9
+ wrapper: Partial<import("../../../testing").SetupResult>;
10
+ };
11
+ declare const _default: (renderOptions: SetupOptions<any>) => void;
12
+ export default _default;
@@ -35,11 +35,11 @@ export declare const COMPONENT_NAME = "Message";
35
35
  */
36
36
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
37
37
  export declare const block: {
38
- (additionalClasses: string[]): string;
39
- (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
38
+ (additionalClasses: import("classnames/types").ClassValue[]): string;
39
+ (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
40
40
  }, element: {
41
- (elem: string, additionalClasses: string[]): string;
42
- (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
41
+ (elem: string, additionalClasses: import("classnames/types").ClassValue[]): string;
42
+ (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
43
43
  };
44
44
  /**
45
45
  * Associative map from message kind to color and icon.
@@ -56,8 +56,8 @@ export declare const COMPONENT_NAME = "Text";
56
56
  */
57
57
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
58
58
  export declare const block: {
59
- (additionalClasses: string[]): string;
60
- (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
59
+ (additionalClasses: import("classnames/types").ClassValue[]): string;
60
+ (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
61
61
  };
62
62
  /**
63
63
  * Component default props.
@@ -63,11 +63,11 @@ export declare const COMPONENT_NAME = "Thumbnail";
63
63
  */
64
64
  export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
65
65
  export declare const block: {
66
- (additionalClasses: string[]): string;
67
- (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
66
+ (additionalClasses: import("classnames/types").ClassValue[]): string;
67
+ (modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
68
68
  }, element: {
69
- (elem: string, additionalClasses: string[]): string;
70
- (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: string[]): string;
69
+ (elem: string, additionalClasses: import("classnames/types").ClassValue[]): string;
70
+ (elem: string, modifiers?: import("../../utils/classNames/bem/modifier").Modifier, additionalClasses?: import("classnames/types").ClassValue[]): string;
71
71
  };
72
72
  /**
73
73
  * Component default props.
@@ -0,0 +1,46 @@
1
+ import type { SetupStoriesOptions } from '@lumx/core/stories/types';
2
+ export declare function setup({ component, render, overrides, }: SetupStoriesOptions<{
3
+ overrides: 'WithBefore' | 'WithAfter' | 'WithAll';
4
+ decorators?: never;
5
+ }>): {
6
+ meta: {
7
+ component: any;
8
+ render: any;
9
+ argTypes: {
10
+ label: {
11
+ control: string;
12
+ };
13
+ before: {
14
+ control: boolean;
15
+ };
16
+ after: {
17
+ control: boolean;
18
+ };
19
+ };
20
+ args: {
21
+ after?: import("react").ReactNode;
22
+ before?: import("react").ReactNode;
23
+ label?: import("react").ReactNode;
24
+ ref?: import("../../types").CommonRef;
25
+ className?: string | undefined;
26
+ };
27
+ };
28
+ /** Default toolbar with label */
29
+ Default: {
30
+ args: {
31
+ label: string;
32
+ };
33
+ };
34
+ /** Toolbar with before content */
35
+ WithBefore: {
36
+ [x: string]: any;
37
+ };
38
+ /** Toolbar with after content */
39
+ WithAfter: {
40
+ [x: string]: any;
41
+ };
42
+ /** Toolbar with all content areas */
43
+ WithAll: {
44
+ [x: string]: any;
45
+ };
46
+ };
@@ -0,0 +1,12 @@
1
+ import { SetupOptions } from '../../../testing';
2
+ /**
3
+ * Mounts the component and returns common DOM elements / data needed in multiple tests further down.
4
+ */
5
+ export declare const setup: (propsOverride: any | undefined, { render, ...options }: SetupOptions<any>) => {
6
+ props: any;
7
+ toolbar: HTMLElement;
8
+ div: HTMLElement;
9
+ wrapper: Partial<import("../../../testing").SetupResult>;
10
+ };
11
+ declare const _default: (renderOptions: SetupOptions<any>) => void;
12
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import type { JSXElement, LumxClassName, HasClassName, CommonRef } from '../../types';
2
+ /**
3
+ * Defines the props of the component.
4
+ */
5
+ export interface ToolbarProps extends HasClassName {
6
+ /** After content (placed after the label). */
7
+ after?: JSXElement;
8
+ /** Before content (placed before the label). */
9
+ before?: JSXElement;
10
+ /** Label content. */
11
+ label?: JSXElement;
12
+ /** Component ref. */
13
+ ref?: CommonRef;
14
+ }
15
+ /**
16
+ * Component display name.
17
+ */
18
+ export declare const TOOLBAR_NAME = "Toolbar";
19
+ /**
20
+ * Component default class name and class prefix.
21
+ */
22
+ export declare const CLASSNAME: LumxClassName<typeof TOOLBAR_NAME>;
23
+ /**
24
+ * Component default props.
25
+ */
26
+ export declare const DEFAULT_PROPS: Partial<ToolbarProps>;
27
+ /**
28
+ * Toolbar component.
29
+ *
30
+ * @param props Component props.
31
+ * @return JSX element.
32
+ */
33
+ export declare const Toolbar: (props: ToolbarProps) => import("react").JSX.Element;
@@ -198,3 +198,12 @@ export declare const ColorVariant: {
198
198
  export type ColorVariant = ValueOf<typeof ColorVariant>;
199
199
  /** ColorPalette with all possible color variant combination */
200
200
  export type ColorWithVariants = ColorPalette | Exclude<`${ColorPalette}-${ColorVariant}`, `light-D${number}` | `dark-D${number}`>;
201
+ export declare const REAL_SIZE_FOR_LUMX_SIZE: {
202
+ xxs: number;
203
+ xs: number;
204
+ s: number;
205
+ m: number;
206
+ l: number;
207
+ xl: number;
208
+ xxl: number;
209
+ };
@@ -151,5 +151,14 @@ const ColorVariant = {
151
151
  L6: 'L6',
152
152
  N: 'N',
153
153
  };
154
+ const REAL_SIZE_FOR_LUMX_SIZE = {
155
+ [Size.xxs]: 14,
156
+ [Size.xs]: 20,
157
+ [Size.s]: 24,
158
+ [Size.m]: 36,
159
+ [Size.l]: 64,
160
+ [Size.xl]: 128,
161
+ [Size.xxl]: 256,
162
+ };
154
163
 
155
- export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace };
164
+ export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, REAL_SIZE_FOR_LUMX_SIZE, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace };
@@ -1,4 +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
- export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace } from './enums/index.js';
3
+ export { Alignment, AspectRatio, ColorPalette, ColorVariant, Emphasis, Kind, Orientation, REAL_SIZE_FOR_LUMX_SIZE, Size, Theme, Typography, TypographyCustom, TypographyInterface, TypographyTitleCustom, WhiteSpace } from './enums/index.js';
4
4
  export { VISUALLY_HIDDEN } from './className/index.js';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Same as `Partial` but for one property only.
3
+ *
4
+ * @example PartialBy<Foo, 'bar'> => produces a type almost identical to `Foo` but with the `bar` property as optional.
5
+ */
6
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
+ /**
8
+ * Same as `Partial` but for all except some properties only.
9
+ *
10
+ * @example PartialExcept<Foo, 'bar'> => produces a type almost identical to `Foo` but with the `bar` property as it is on the original type.
11
+ */
12
+ export type PartialExcept<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
@@ -25,3 +25,4 @@ export type { HasChecked } from './HasChecked';
25
25
  export type { HasDisabled } from './HasDisabled';
26
26
  export type { AriaAttributes } from './AriaAttributes';
27
27
  export type { Selector } from './Selector';
28
+ export type { PartialBy, PartialExcept } from './PartialBy';
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import { type Modifier } from './modifier';
2
3
  /**
3
4
  * Generates a BEM block + modifier class name string.
@@ -11,5 +12,5 @@ import { type Modifier } from './modifier';
11
12
  * block('button'); // 'button'
12
13
  * block('button', { active: true, disabled: false }); // 'button button--active'
13
14
  */
14
- export declare function block(baseName: string, additionalClasses: string[]): string;
15
- export declare function block(baseName: string, modifiers?: Modifier, additionalClasses?: string[]): string;
15
+ export declare function block(baseName: string, additionalClasses: ClassValue[]): string;
16
+ export declare function block(baseName: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import type { Modifier } from './modifier';
2
3
  /**
3
4
  * Creates a BEM element class generator function for the given base class.
@@ -12,5 +13,5 @@ import type { Modifier } from './modifier';
12
13
  * element('my-button', 'icon'); // 'my-button__icon'
13
14
  * element('my-button', 'icon', { active: true }); // 'my-button__icon my-button__icon--active'
14
15
  */
15
- export declare function element(baseClass: string, elem: string, additionalClasses: string[]): string;
16
- export declare function element(baseClass: string, elem: string, modifiers?: Modifier, additionalClasses?: string[]): string;
16
+ export declare function element(baseClass: string, elem: string, additionalClasses: ClassValue[]): string;
17
+ export declare function element(baseClass: string, elem: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
@@ -1,3 +1,4 @@
1
+ import { ClassValue } from 'classnames/types';
1
2
  import { block } from './block';
2
3
  import { element } from './element';
3
4
  import { type Modifier } from './modifier';
@@ -6,12 +7,12 @@ import { type Modifier } from './modifier';
6
7
  */
7
8
  export declare function bem(baseName: string): {
8
9
  block: {
9
- (additionalClasses: string[]): string;
10
- (modifiers?: Modifier, additionalClasses?: string[]): string;
10
+ (additionalClasses: ClassValue[]): string;
11
+ (modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
11
12
  };
12
13
  element: {
13
- (elem: string, additionalClasses: string[]): string;
14
- (elem: string, modifiers?: Modifier, additionalClasses?: string[]): string;
14
+ (elem: string, additionalClasses: ClassValue[]): string;
15
+ (elem: string, modifiers?: Modifier, additionalClasses?: ClassValue[]): string;
15
16
  };
16
17
  modifier: (modifiers: Modifier) => string;
17
18
  };
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/lumapps/design-system/issues"
7
7
  },
8
8
  "dependencies": {
9
- "@lumx/icons": "^4.3.2-alpha.20",
9
+ "@lumx/icons": "^4.3.2-alpha.22",
10
10
  "classnames": "^2.3.2",
11
11
  "focus-visible": "^5.0.2",
12
12
  "lodash": "4.17.23",
@@ -24,29 +24,32 @@
24
24
  "name": "@lumx/core",
25
25
  "exports": {
26
26
  "./js/constants": {
27
- "default": "./js/constants/index.js",
28
- "types": "./js/constants/index.d.ts"
27
+ "types": "./js/constants/index.d.ts",
28
+ "default": "./js/constants/index.js"
29
29
  },
30
30
  "./js/types": {
31
- "default": "./js/types/index.js",
32
- "types": "./js/types/index.d.ts"
31
+ "types": "./js/types/index.d.ts",
32
+ "default": "./js/types/index.js"
33
33
  },
34
34
  "./js/utils/classNames": {
35
- "default": "./js/utils/classNames/index.js",
36
- "types": "./js/utils/classNames/index.d.ts"
35
+ "types": "./js/utils/classNames/index.d.ts",
36
+ "default": "./js/utils/classNames/index.js"
37
37
  },
38
38
  "./js/utils/disabledState": {
39
- "default": "./js/utils/disabledState/index.js",
40
- "types": "./js/utils/disabledState/index.d.ts"
39
+ "types": "./js/utils/disabledState/index.d.ts",
40
+ "default": "./js/utils/disabledState/index.js"
41
41
  },
42
42
  "./js/utils/selectors": {
43
- "default": "./js/utils/selectors/index.js",
44
- "types": "./js/utils/selectors/index.d.ts"
43
+ "types": "./js/utils/selectors/index.d.ts",
44
+ "default": "./js/utils/selectors/index.js"
45
45
  },
46
46
  "./js/utils": {
47
- "default": "./js/utils/index.js",
48
- "types": "./js/utils/index.d.ts"
49
- }
47
+ "types": "./js/utils/index.d.ts",
48
+ "default": "./js/utils/index.js"
49
+ },
50
+ "./lumx.css": "./lumx.css",
51
+ "./css/*": "./css/*",
52
+ "./scss/*": "./scss/*"
50
53
  },
51
54
  "publishConfig": {
52
55
  "directory": "dist"
@@ -63,7 +66,7 @@
63
66
  "update-version-changelog": "yarn version-changelog ../../CHANGELOG.md"
64
67
  },
65
68
  "sideEffects": false,
66
- "version": "4.3.2-alpha.20",
69
+ "version": "4.3.2-alpha.22",
67
70
  "devDependencies": {
68
71
  "@rollup/plugin-typescript": "^12.3.0",
69
72
  "@testing-library/dom": "^10.4.1",