@lumx/core 4.3.2-alpha.3 → 4.3.2-alpha.31
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.
- package/js/components/Badge/BadgeWrapper.d.ts +13 -0
- package/js/components/Badge/BadgeWrapperStories.d.ts +29 -0
- package/js/components/Badge/BadgeWrapperTests.d.ts +9 -0
- package/js/components/Badge/Stories.d.ts +52 -0
- package/js/components/Badge/Tests.d.ts +12 -0
- package/js/components/Badge/index.d.ts +37 -0
- package/js/components/Button/Button.d.ts +48 -0
- package/js/components/Button/ButtonGroup.d.ts +36 -0
- package/js/components/Button/ButtonGroupStories.d.ts +37 -0
- package/js/components/Button/ButtonRoot.d.ts +55 -0
- package/js/components/Button/ButtonRootTests.d.ts +12 -0
- package/js/components/Button/IconButton.d.ts +45 -0
- package/js/components/Button/IconButtonStories.d.ts +211 -0
- package/js/components/Button/IconButtonTests.d.ts +15 -0
- package/js/components/Button/Stories.d.ts +301 -0
- package/js/components/Button/Tests.d.ts +15 -0
- package/js/components/Checkbox/Stories.d.ts +88 -0
- package/js/components/Checkbox/Tests.d.ts +15 -0
- package/js/components/Checkbox/index.d.ts +49 -0
- package/js/components/Divider/Stories.d.ts +21 -0
- package/js/components/Divider/Tests.d.ts +12 -0
- package/js/components/Divider/index.d.ts +27 -0
- package/js/components/Flag/Stories.d.ts +120 -0
- package/js/components/Flag/Tests.d.ts +14 -0
- package/js/components/Flag/index.d.ts +34 -0
- package/js/components/FlexBox/Stories.d.ts +108 -0
- package/js/components/FlexBox/Tests.d.ts +13 -0
- package/js/components/FlexBox/constants.d.ts +4 -0
- package/js/components/FlexBox/index.d.ts +50 -0
- package/js/components/FlexBox/types.d.ts +7 -0
- package/js/components/GridColumn/GridColumn.d.ts +48 -0
- package/js/components/GridColumn/GridColumnStories.d.ts +47 -0
- package/js/components/GridColumn/GridColumnTests.d.ts +12 -0
- package/js/components/Heading/Stories.d.ts +89 -0
- package/js/components/Heading/Tests.d.ts +11 -0
- package/js/components/Heading/constants.d.ts +21 -0
- package/js/components/Heading/index.d.ts +44 -0
- package/js/components/Heading/utils.d.ts +8 -0
- package/js/components/Icon/Stories.d.ts +150 -0
- package/js/components/Icon/Tests.d.ts +14 -0
- package/js/components/Icon/constants.d.ts +1 -0
- package/js/components/Icon/index.d.ts +41 -0
- package/js/components/InputHelper/Stories.d.ts +43 -0
- package/js/components/InputHelper/Tests.d.ts +12 -0
- package/js/components/InputHelper/constants.d.ts +3 -0
- package/js/components/InputHelper/index.d.ts +26 -0
- package/js/components/InputLabel/Stories.d.ts +34 -0
- package/js/components/InputLabel/Tests.d.ts +12 -0
- package/js/components/InputLabel/index.d.ts +25 -0
- package/js/components/Link/Stories.d.ts +93 -0
- package/js/components/Link/Tests.d.ts +15 -0
- package/js/components/Link/index.d.ts +54 -0
- package/js/components/Message/Stories.d.ts +119 -0
- package/js/components/Message/Tests.d.ts +14 -0
- package/js/components/Message/index.d.ts +75 -0
- package/js/components/RadioButton/Stories.d.ts +77 -0
- package/js/components/RadioButton/Tests.d.ts +15 -0
- package/js/components/RadioButton/index.d.ts +45 -0
- package/js/components/RawClickable/Tests.d.ts +14 -0
- package/js/components/RawClickable/index.d.ts +13 -0
- package/js/components/Skeleton/SkeletonCircle.d.ts +32 -0
- package/js/components/Skeleton/SkeletonCircleStories.d.ts +45 -0
- package/js/components/Skeleton/SkeletonCircleTests.d.ts +12 -0
- package/js/components/Skeleton/SkeletonRectangle.d.ts +47 -0
- package/js/components/Skeleton/SkeletonRectangleStories.d.ts +87 -0
- package/js/components/Skeleton/SkeletonRectangleTests.d.ts +13 -0
- package/js/components/Skeleton/SkeletonTypography.d.ts +37 -0
- package/js/components/Skeleton/SkeletonTypographyStories.d.ts +40 -0
- package/js/components/Skeleton/SkeletonTypographyTests.d.ts +13 -0
- package/js/components/Skeleton/index.d.ts +3 -0
- package/js/components/Switch/Stories.d.ts +94 -0
- package/js/components/Switch/Tests.d.ts +15 -0
- package/js/components/Switch/index.d.ts +47 -0
- package/js/components/Table/Stories.d.ts +25 -0
- package/js/components/Table/TableCell.d.ts +55 -0
- package/js/components/Table/TableCellStories.d.ts +44 -0
- package/js/components/Table/TableCellTests.d.ts +11 -0
- package/js/components/Table/TableRowStories.d.ts +23 -0
- package/js/components/Table/Tests.d.ts +11 -0
- package/js/components/Table/constants.d.ts +9 -0
- package/js/components/Table/index.d.ts +27 -0
- package/js/components/Text/Stories.d.ts +167 -0
- package/js/components/Text/Tests.d.ts +10 -0
- package/js/components/Text/index.d.ts +935 -0
- package/js/components/Thumbnail/Stories.d.ts +178 -0
- package/js/components/Thumbnail/Tests.d.ts +11 -0
- package/js/components/Thumbnail/index.d.ts +84 -0
- package/js/components/Thumbnail/types.d.ts +45 -0
- package/js/components/Thumbnail/utils.d.ts +79 -0
- package/js/components/Toolbar/Stories.d.ts +46 -0
- package/js/components/Toolbar/Tests.d.ts +12 -0
- package/js/components/Toolbar/index.d.ts +33 -0
- package/js/constants/enums/index.d.ts +9 -0
- package/js/constants/enums/index.js +10 -1
- package/js/constants/index.js +1 -1
- package/js/types/AriaAttributes.d.ts +29 -2
- package/js/types/PartialBy.d.ts +12 -0
- package/js/types/index.d.ts +2 -0
- package/js/types/jsx/PropsToOverride.d.ts +2 -0
- package/js/utils/classNames/bem/block.d.ts +3 -2
- package/js/utils/classNames/bem/element.d.ts +3 -2
- package/js/utils/classNames/bem/index.d.ts +5 -4
- package/package.json +31 -2
- package/stories/controls/color.d.ts +15 -0
- package/stories/controls/element.d.ts +16 -0
- package/stories/controls/focusPoint.d.ts +8 -0
- package/stories/controls/icons.d.ts +66 -0
- package/stories/controls/image.d.ts +96 -0
- package/stories/controls/selectArgType.d.ts +7 -0
- package/stories/controls/theme.d.ts +7 -0
- package/stories/controls/typography.d.ts +8 -0
- package/stories/controls/withUndefined.d.ts +1 -0
- package/stories/types.d.ts +43 -0
- package/stories/utils/combinations.d.ts +100 -0
- package/stories/utils/concatPath.d.ts +10 -0
- package/stories/utils/disableArgTypes.d.ts +7 -0
- package/stories/utils/initDemoShadowDOMPortal.d.ts +5 -0
- package/stories/utils/lorem.d.ts +7 -0
- package/stories/utils/toFlattenProps.d.ts +12 -0
- package/stories/utils/withCategory.d.ts +4 -0
- package/testing/commonTestsSuiteTL.d.ts +87 -0
- package/testing/index.d.ts +1 -0
- package/testing/queries.d.ts +4 -0
- package/js/utils/events/index.js +0 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
|
|
2
|
+
export interface BadgeWrapperProps extends HasClassName {
|
|
3
|
+
/** Badge element to display */
|
|
4
|
+
badge?: JSXElement;
|
|
5
|
+
/** Content to wrap with badge */
|
|
6
|
+
children?: JSXElement;
|
|
7
|
+
/** Ref forwarding */
|
|
8
|
+
ref?: CommonRef;
|
|
9
|
+
}
|
|
10
|
+
export declare const COMPONENT_NAME = "BadgeWrapper";
|
|
11
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
12
|
+
export declare const DEFAULT_PROPS: Partial<BadgeWrapperProps>;
|
|
13
|
+
export declare const BadgeWrapper: (props: BadgeWrapperProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
export declare function setup({ component, render, overrides, }: SetupStoriesOptions<{
|
|
3
|
+
overrides: 'WithIcon' | 'WithButton';
|
|
4
|
+
decorators?: never;
|
|
5
|
+
}>): {
|
|
6
|
+
meta: {
|
|
7
|
+
component: any;
|
|
8
|
+
render: any;
|
|
9
|
+
argTypes: {
|
|
10
|
+
children: {
|
|
11
|
+
control: boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
args: {
|
|
15
|
+
badge?: import("react").ReactNode;
|
|
16
|
+
children?: import("react").ReactNode;
|
|
17
|
+
ref?: import("../../types").CommonRef;
|
|
18
|
+
className?: string | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/** Using badge wrapper with icon */
|
|
22
|
+
WithIcon: {
|
|
23
|
+
[x: string]: any;
|
|
24
|
+
};
|
|
25
|
+
/** Using badge wrapper with button */
|
|
26
|
+
WithButton: {
|
|
27
|
+
[x: string]: any;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SetupOptions } from '../../../testing';
|
|
2
|
+
export declare const setup: (propsOverride: any | undefined, { render, ...options }: SetupOptions<any>) => {
|
|
3
|
+
props: any;
|
|
4
|
+
badgeWrapper: HTMLElement;
|
|
5
|
+
div: HTMLElement;
|
|
6
|
+
wrapper: Partial<import("../../../testing").SetupResult>;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: (renderOptions: SetupOptions<any>) => void;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
import { ColorPalette } from '../../constants';
|
|
3
|
+
/**
|
|
4
|
+
* Setup Badge stories for a specific framework (React or Vue).
|
|
5
|
+
* This function creates all the stories with the appropriate decorators.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setup({ component, render, decorators: { withCombinations }, overrides, }: SetupStoriesOptions<{
|
|
8
|
+
overrides: 'WithIcon';
|
|
9
|
+
decorators: 'withCombinations';
|
|
10
|
+
}>): {
|
|
11
|
+
meta: {
|
|
12
|
+
component: any;
|
|
13
|
+
render: any;
|
|
14
|
+
argTypes: {
|
|
15
|
+
color: {
|
|
16
|
+
control: {
|
|
17
|
+
type: "select" | "inline-radio";
|
|
18
|
+
};
|
|
19
|
+
options: ("light" | "dark" | "primary" | "secondary" | "blue" | "green" | "yellow" | "red" | "grey" | undefined)[];
|
|
20
|
+
mapping: Record<string, "light" | "dark" | "primary" | "secondary" | "blue" | "green" | "yellow" | "red" | "grey" | undefined> | undefined;
|
|
21
|
+
};
|
|
22
|
+
children: {
|
|
23
|
+
control: boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
args: {
|
|
27
|
+
children?: import("react").ReactNode;
|
|
28
|
+
color?: ColorPalette | undefined;
|
|
29
|
+
ref?: import("../../types").CommonRef;
|
|
30
|
+
className?: string | undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Using badge with text children */
|
|
34
|
+
WithText: {
|
|
35
|
+
args: {
|
|
36
|
+
children: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/** Using badge with icon children - Icon component provided via overrides */
|
|
40
|
+
WithIcon: {
|
|
41
|
+
[x: string]: any;
|
|
42
|
+
};
|
|
43
|
+
/** All combinations of colors and children types */
|
|
44
|
+
AllColors: {
|
|
45
|
+
argTypes: {
|
|
46
|
+
color: {
|
|
47
|
+
control: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
decorators: ((story: any, context: any) => any)[];
|
|
51
|
+
};
|
|
52
|
+
};
|
|
@@ -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
|
+
badge: 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,37 @@
|
|
|
1
|
+
import { ColorPalette } from '../../constants';
|
|
2
|
+
import type { CommonRef, HasClassName, JSXElement, LumxClassName } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Defines the props of the component.
|
|
5
|
+
*/
|
|
6
|
+
export interface BadgeProps extends HasClassName {
|
|
7
|
+
/** Badge content. */
|
|
8
|
+
children?: JSXElement;
|
|
9
|
+
/** Color variant. */
|
|
10
|
+
color?: ColorPalette;
|
|
11
|
+
/** reference to the root element */
|
|
12
|
+
ref?: CommonRef;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Component display name.
|
|
16
|
+
*/
|
|
17
|
+
export declare const COMPONENT_NAME = "Badge";
|
|
18
|
+
/**
|
|
19
|
+
* Component default class name and class prefix.
|
|
20
|
+
*/
|
|
21
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
22
|
+
/**
|
|
23
|
+
* Component default props.
|
|
24
|
+
*/
|
|
25
|
+
export declare const DEFAULT_PROPS: Partial<BadgeProps>;
|
|
26
|
+
/**
|
|
27
|
+
* Badge component.
|
|
28
|
+
*
|
|
29
|
+
* @param props Component props.
|
|
30
|
+
* @return JSX element.
|
|
31
|
+
*/
|
|
32
|
+
export declare const Badge: {
|
|
33
|
+
(props: BadgeProps): import("react").JSX.Element;
|
|
34
|
+
displayName: string;
|
|
35
|
+
className: "lumx-badge";
|
|
36
|
+
defaultProps: Partial<BadgeProps>;
|
|
37
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { JSXElement, LumxClassName } from '../../types';
|
|
2
|
+
import { BaseButtonProps } from './ButtonRoot';
|
|
3
|
+
/**
|
|
4
|
+
* Button emphasis definition.
|
|
5
|
+
* @deprecated Use Emphasis instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ButtonEmphasis: {
|
|
8
|
+
readonly low: "low";
|
|
9
|
+
readonly medium: "medium";
|
|
10
|
+
readonly high: "high";
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Defines the props of the component.
|
|
14
|
+
*/
|
|
15
|
+
export interface ButtonProps extends BaseButtonProps {
|
|
16
|
+
/** Left icon (SVG path). */
|
|
17
|
+
leftIcon?: string;
|
|
18
|
+
/** Right icon (SVG path). */
|
|
19
|
+
rightIcon?: string;
|
|
20
|
+
/** When `true`, the button gets as large as possible. */
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
/** Children */
|
|
23
|
+
children?: JSXElement;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Component display name.
|
|
27
|
+
*/
|
|
28
|
+
export declare const COMPONENT_NAME = "Button";
|
|
29
|
+
/**
|
|
30
|
+
* Component default class name and class prefix.
|
|
31
|
+
*/
|
|
32
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
33
|
+
/**
|
|
34
|
+
* Component default props.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_PROPS: Partial<ButtonProps>;
|
|
37
|
+
/**
|
|
38
|
+
* Button component.
|
|
39
|
+
*
|
|
40
|
+
* @param props Component props.
|
|
41
|
+
* @return JSX element.
|
|
42
|
+
*/
|
|
43
|
+
export declare const Button: {
|
|
44
|
+
(props: ButtonProps): import("react").JSX.Element;
|
|
45
|
+
displayName: string;
|
|
46
|
+
className: "lumx-button";
|
|
47
|
+
defaultProps: Partial<ButtonProps>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { LumxClassName, HasClassName, JSXElement, CommonRef } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the props of the component
|
|
4
|
+
*/
|
|
5
|
+
export interface ButtonGroupProps extends HasClassName {
|
|
6
|
+
/**
|
|
7
|
+
* Children
|
|
8
|
+
*/
|
|
9
|
+
children?: JSXElement;
|
|
10
|
+
/** reference to the root element */
|
|
11
|
+
ref?: CommonRef;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Component display name.
|
|
15
|
+
*/
|
|
16
|
+
export declare const COMPONENT_NAME = "ButtonGroup";
|
|
17
|
+
/**
|
|
18
|
+
* Component default class name and class prefix.
|
|
19
|
+
*/
|
|
20
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
21
|
+
/**
|
|
22
|
+
* Component default props.
|
|
23
|
+
*/
|
|
24
|
+
export declare const DEFAULT_PROPS: Partial<ButtonGroupProps>;
|
|
25
|
+
/**
|
|
26
|
+
* ButtonGroup component.
|
|
27
|
+
*
|
|
28
|
+
* @param props Component props.
|
|
29
|
+
* @return JSX element.
|
|
30
|
+
*/
|
|
31
|
+
export declare const ButtonGroup: {
|
|
32
|
+
(props: ButtonGroupProps): import("react").JSX.Element;
|
|
33
|
+
displayName: string;
|
|
34
|
+
className: "lumx-button-group";
|
|
35
|
+
defaultProps: Partial<ButtonGroupProps>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
/** Names of all ButtonGroup stories */
|
|
3
|
+
export type ButtonGroupStoryName = 'Variants' | 'OneButton' | 'ManyButtons';
|
|
4
|
+
/** Options for setting up ButtonGroup stories */
|
|
5
|
+
export type SetupButtonGroupStoriesOptions = SetupStoriesOptions<{
|
|
6
|
+
overrides: ButtonGroupStoryName;
|
|
7
|
+
decorators: 'withCombinations';
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Setup ButtonGroup stories for a specific framework (React or Vue).
|
|
11
|
+
* This function creates all the stories with the appropriate decorators.
|
|
12
|
+
* Framework-specific render functions or args can be injected via `overrides`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setup({ component, render, decorators: { withCombinations }, overrides, }: SetupButtonGroupStoriesOptions): {
|
|
15
|
+
meta: {
|
|
16
|
+
component: any;
|
|
17
|
+
render: any;
|
|
18
|
+
argTypes: {
|
|
19
|
+
children: {
|
|
20
|
+
control: boolean;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
args: Partial<import("./ButtonGroup").ButtonGroupProps>;
|
|
24
|
+
};
|
|
25
|
+
/** Size & emphasis variants */
|
|
26
|
+
Variants: {
|
|
27
|
+
decorators: ((story: any, context: any) => any)[];
|
|
28
|
+
};
|
|
29
|
+
/** ButtonGroup with a single button */
|
|
30
|
+
OneButton: {
|
|
31
|
+
[x: string]: any;
|
|
32
|
+
};
|
|
33
|
+
/** ButtonGroup with many buttons */
|
|
34
|
+
ManyButtons: {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ColorPalette, Emphasis, Size } from '../../constants';
|
|
2
|
+
import { HasTheme, HasAriaDisabled, AriaAttributes, HasClassName } from '../../types';
|
|
3
|
+
import { BaseClickableProps } from '../RawClickable';
|
|
4
|
+
/**
|
|
5
|
+
* Button size definition.
|
|
6
|
+
*/
|
|
7
|
+
export type ButtonSize = Extract<Size, 's' | 'm'>;
|
|
8
|
+
export interface BaseButtonProps extends Pick<AriaAttributes, 'aria-expanded' | 'aria-haspopup' | 'aria-pressed' | 'aria-label'>, HasClassName, HasTheme, HasAriaDisabled, BaseClickableProps {
|
|
9
|
+
/** Color variant. */
|
|
10
|
+
color?: ColorPalette;
|
|
11
|
+
/** Emphasis variant. */
|
|
12
|
+
emphasis?: Emphasis;
|
|
13
|
+
/** Whether or not the button has a background color in low emphasis. */
|
|
14
|
+
hasBackground?: boolean;
|
|
15
|
+
/** Native anchor href property. It determines whether the Button will be a <button> or an <a>. */
|
|
16
|
+
href?: string;
|
|
17
|
+
/** Whether the component is disabled or not. */
|
|
18
|
+
isDisabled?: boolean;
|
|
19
|
+
/** Whether the component is selected or not (unsupported in `high` emphasis). */
|
|
20
|
+
isSelected?: boolean;
|
|
21
|
+
/** Native button name property. */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Size variant. */
|
|
24
|
+
size?: ButtonSize;
|
|
25
|
+
/** Native anchor target property. */
|
|
26
|
+
target?: '_self' | '_blank' | '_parent' | '_top';
|
|
27
|
+
/** Native button type. */
|
|
28
|
+
type?: 'submit' | 'reset' | 'button' | undefined;
|
|
29
|
+
/** Custom component for the link (can be used to inject router Link). */
|
|
30
|
+
linkAs?: 'a' | any;
|
|
31
|
+
/** whether the button is dispalyed in full width or not */
|
|
32
|
+
fullWidth?: boolean;
|
|
33
|
+
/** whether the button is currently active or not */
|
|
34
|
+
isActive?: boolean;
|
|
35
|
+
/** whether the button is currently focused or not */
|
|
36
|
+
isFocused?: boolean;
|
|
37
|
+
/** whether the button is currently focused or not */
|
|
38
|
+
isHovered?: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ButtonRootProps extends BaseButtonProps {
|
|
41
|
+
variant: 'button' | 'icon';
|
|
42
|
+
}
|
|
43
|
+
export declare const BUTTON_WRAPPER_CLASSNAME = "lumx-button-wrapper";
|
|
44
|
+
export declare const BUTTON_CLASSNAME = "lumx-button";
|
|
45
|
+
/**
|
|
46
|
+
* ButtonRoot component.
|
|
47
|
+
*
|
|
48
|
+
* @param props Component props.
|
|
49
|
+
* @return JSX Element.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ButtonRoot: {
|
|
52
|
+
(props: ButtonRootProps): import("react").JSX.Element;
|
|
53
|
+
displayName: string;
|
|
54
|
+
defaultProps: {};
|
|
55
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SetupOptions } from '@lumx/core/testing';
|
|
2
|
+
import { ButtonRootProps } from './ButtonRoot';
|
|
3
|
+
type SetupProps = Partial<ButtonRootProps>;
|
|
4
|
+
/**
|
|
5
|
+
* Mounts the component and returns common DOM elements / data needed in multiple tests further down.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setup: (propsOverride: SetupProps | undefined, { render, ...options }: SetupOptions<ButtonRootProps>) => {
|
|
8
|
+
props: any;
|
|
9
|
+
button: HTMLElement;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: (renderOptions: SetupOptions<ButtonRootProps>) => void;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BaseButtonProps } from './ButtonRoot';
|
|
2
|
+
import type { LumxClassName } from '../../types';
|
|
3
|
+
export interface IconButtonProps extends BaseButtonProps {
|
|
4
|
+
/**
|
|
5
|
+
* Icon (SVG path).
|
|
6
|
+
* If `image` is also set, `image` will be used instead.
|
|
7
|
+
*/
|
|
8
|
+
icon?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Image (image url).
|
|
11
|
+
* Has priority over `icon`.
|
|
12
|
+
*/
|
|
13
|
+
image?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Label text (required for a11y purpose).
|
|
16
|
+
* If you really don't want an aria-label, you can set an empty label (this is not recommended).
|
|
17
|
+
*/
|
|
18
|
+
label: string;
|
|
19
|
+
/** text to be displayed on hover */
|
|
20
|
+
title?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Component display name.
|
|
24
|
+
*/
|
|
25
|
+
export declare const COMPONENT_NAME = "IconButton";
|
|
26
|
+
/**
|
|
27
|
+
* Component default class name and class prefix.
|
|
28
|
+
*/
|
|
29
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
30
|
+
/**
|
|
31
|
+
* Component default props.
|
|
32
|
+
*/
|
|
33
|
+
export declare const DEFAULT_PROPS: Partial<IconButtonProps>;
|
|
34
|
+
/**
|
|
35
|
+
* IconButton component.
|
|
36
|
+
*
|
|
37
|
+
* @param props Component props.
|
|
38
|
+
* @return JSX element.
|
|
39
|
+
*/
|
|
40
|
+
export declare const IconButton: {
|
|
41
|
+
(props: IconButtonProps): import("react").JSX.Element;
|
|
42
|
+
displayName: string;
|
|
43
|
+
className: "lumx-icon-button";
|
|
44
|
+
defaultProps: Partial<IconButtonProps>;
|
|
45
|
+
};
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { Emphasis } from '@lumx/core/js/constants';
|
|
2
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
3
|
+
import { ButtonSize } from './ButtonRoot';
|
|
4
|
+
/**
|
|
5
|
+
* Setup IconButton stories for a specific framework (React or Vue).
|
|
6
|
+
* This function creates all the stories with the appropriate decorators.
|
|
7
|
+
* Framework-specific render functions or args can be injected via `overrides`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setup({ component, render, decorators: { withCombinations, withThemedBackground }, }: SetupStoriesOptions<{
|
|
10
|
+
decorators: 'withCombinations' | 'withThemedBackground';
|
|
11
|
+
}>): {
|
|
12
|
+
meta: {
|
|
13
|
+
component: any;
|
|
14
|
+
render: any;
|
|
15
|
+
argTypes: {
|
|
16
|
+
isSelected: {
|
|
17
|
+
control: string;
|
|
18
|
+
};
|
|
19
|
+
isDisabled: {
|
|
20
|
+
control: string;
|
|
21
|
+
};
|
|
22
|
+
hasBackground: {
|
|
23
|
+
control: string;
|
|
24
|
+
};
|
|
25
|
+
emphasis: {
|
|
26
|
+
control: {
|
|
27
|
+
type: "select" | "inline-radio";
|
|
28
|
+
};
|
|
29
|
+
options: ("medium" | "low" | "high")[];
|
|
30
|
+
mapping: Record<string, "medium" | "low" | "high"> | undefined;
|
|
31
|
+
};
|
|
32
|
+
size: {
|
|
33
|
+
control: {
|
|
34
|
+
type: "select" | "inline-radio";
|
|
35
|
+
};
|
|
36
|
+
options: ButtonSize[];
|
|
37
|
+
mapping: Record<string, ButtonSize> | undefined;
|
|
38
|
+
};
|
|
39
|
+
icon: {
|
|
40
|
+
control: {
|
|
41
|
+
type: string;
|
|
42
|
+
};
|
|
43
|
+
options: {
|
|
44
|
+
undefined: undefined;
|
|
45
|
+
mdiAbTesting: string;
|
|
46
|
+
mdiAbjadArabic: string;
|
|
47
|
+
mdiAccount: string;
|
|
48
|
+
mdiAccountBox: string;
|
|
49
|
+
mdiAlert: string;
|
|
50
|
+
mdiAlertCircle: string;
|
|
51
|
+
mdiArrowDown: string;
|
|
52
|
+
mdiArrowUp: string;
|
|
53
|
+
mdiAtom: string;
|
|
54
|
+
mdiBee: string;
|
|
55
|
+
mdiBell: string;
|
|
56
|
+
mdiBullhornOutline: string;
|
|
57
|
+
mdiCheck: string;
|
|
58
|
+
mdiCheckCircle: string;
|
|
59
|
+
mdiChevronDown: string;
|
|
60
|
+
mdiChevronLeft: string;
|
|
61
|
+
mdiChevronRight: string;
|
|
62
|
+
mdiChevronUp: string;
|
|
63
|
+
mdiClose: string;
|
|
64
|
+
mdiCloseCircle: string;
|
|
65
|
+
mdiDelete: string;
|
|
66
|
+
mdiDotsHorizontal: string;
|
|
67
|
+
mdiDragVertical: string;
|
|
68
|
+
mdiEarth: string;
|
|
69
|
+
mdiEmail: string;
|
|
70
|
+
mdiEye: string;
|
|
71
|
+
mdiFileEdit: string;
|
|
72
|
+
mdiFlag: string;
|
|
73
|
+
mdiFolder: string;
|
|
74
|
+
mdiFolderGoogleDrive: string;
|
|
75
|
+
mdiFoodApple: string;
|
|
76
|
+
mdiGoogleCirclesExtended: string;
|
|
77
|
+
mdiHeart: string;
|
|
78
|
+
mdiHome: string;
|
|
79
|
+
mdiImageBroken: string;
|
|
80
|
+
mdiInformation: string;
|
|
81
|
+
mdiLink: string;
|
|
82
|
+
mdiMagnifyMinusOutline: string;
|
|
83
|
+
mdiMagnifyPlusOutline: string;
|
|
84
|
+
mdiMenuDown: string;
|
|
85
|
+
mdiMessageTextOutline: string;
|
|
86
|
+
mdiMinus: string;
|
|
87
|
+
mdiOpenInNew: string;
|
|
88
|
+
mdiPauseCircleOutline: string;
|
|
89
|
+
mdiPencil: string;
|
|
90
|
+
mdiPlay: string;
|
|
91
|
+
mdiPlayCircleOutline: string;
|
|
92
|
+
mdiPlus: string;
|
|
93
|
+
mdiRadioboxBlank: string;
|
|
94
|
+
mdiRadioboxMarked: string;
|
|
95
|
+
mdiReply: string;
|
|
96
|
+
mdiSend: string;
|
|
97
|
+
mdiStar: string;
|
|
98
|
+
mdiTextBox: string;
|
|
99
|
+
mdiTextBoxPlus: string;
|
|
100
|
+
mdiTram: string;
|
|
101
|
+
mdiTranslate: string;
|
|
102
|
+
mdiViewList: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
color: {
|
|
106
|
+
control: {
|
|
107
|
+
type: "select" | "inline-radio";
|
|
108
|
+
};
|
|
109
|
+
options: ("light" | "dark" | "primary" | "secondary" | "blue" | "green" | "yellow" | "red" | "grey" | undefined)[];
|
|
110
|
+
mapping: Record<string, "light" | "dark" | "primary" | "secondary" | "blue" | "green" | "yellow" | "red" | "grey" | undefined> | undefined;
|
|
111
|
+
};
|
|
112
|
+
ref: {
|
|
113
|
+
table: {
|
|
114
|
+
disable: boolean;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
onClick: {
|
|
118
|
+
action: boolean;
|
|
119
|
+
table: {
|
|
120
|
+
disable: boolean;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
linkAs: {
|
|
124
|
+
table: {
|
|
125
|
+
disable: boolean;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
className: {
|
|
129
|
+
table: {
|
|
130
|
+
disable: boolean;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
target: {
|
|
134
|
+
if: {
|
|
135
|
+
arg: string;
|
|
136
|
+
exists: boolean;
|
|
137
|
+
};
|
|
138
|
+
control: {
|
|
139
|
+
type: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
type: {
|
|
143
|
+
if: {
|
|
144
|
+
arg: string;
|
|
145
|
+
exists: boolean;
|
|
146
|
+
};
|
|
147
|
+
control: {
|
|
148
|
+
type: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
args: {
|
|
153
|
+
label: string;
|
|
154
|
+
icon: string;
|
|
155
|
+
image?: string | undefined;
|
|
156
|
+
title?: string | undefined;
|
|
157
|
+
color?: import("@lumx/core/js/constants").ColorPalette | undefined;
|
|
158
|
+
emphasis?: Emphasis | undefined;
|
|
159
|
+
hasBackground?: boolean | undefined;
|
|
160
|
+
href?: string | undefined;
|
|
161
|
+
isDisabled?: boolean | undefined;
|
|
162
|
+
isSelected?: boolean | undefined;
|
|
163
|
+
name?: string | undefined;
|
|
164
|
+
size?: ButtonSize | undefined;
|
|
165
|
+
target?: "_self" | "_blank" | "_parent" | "_top" | undefined;
|
|
166
|
+
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
167
|
+
linkAs?: "a" | any;
|
|
168
|
+
fullWidth?: boolean | undefined;
|
|
169
|
+
isActive?: boolean | undefined;
|
|
170
|
+
isFocused?: boolean | undefined;
|
|
171
|
+
isHovered?: boolean | undefined;
|
|
172
|
+
'aria-expanded'?: boolean | "true" | "false" | undefined;
|
|
173
|
+
'aria-haspopup'?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined;
|
|
174
|
+
'aria-pressed'?: boolean | "false" | "mixed" | "true" | undefined;
|
|
175
|
+
'aria-label'?: string | undefined;
|
|
176
|
+
className?: string | undefined;
|
|
177
|
+
theme?: import("@lumx/core/js/constants").Theme | undefined;
|
|
178
|
+
'aria-disabled'?: import("../../types/Booleanish").Booleanish | undefined;
|
|
179
|
+
children?: import("react").ReactNode;
|
|
180
|
+
onClick?: ((event?: any) => void) | undefined;
|
|
181
|
+
ref?: import("../../types").CommonRef;
|
|
182
|
+
disabled?: boolean | undefined;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
Default: {};
|
|
186
|
+
/** IconButton using an image */
|
|
187
|
+
WithImage: {
|
|
188
|
+
argTypes: {
|
|
189
|
+
control: {
|
|
190
|
+
type: "select" | "inline-radio";
|
|
191
|
+
};
|
|
192
|
+
options: string[];
|
|
193
|
+
mapping: Record<string, string> | undefined;
|
|
194
|
+
};
|
|
195
|
+
args: {
|
|
196
|
+
image: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
/** Check icon button style variations (color, states, emphasis, etc.) */
|
|
200
|
+
IconStateVariations: {
|
|
201
|
+
args: {};
|
|
202
|
+
argTypes: {
|
|
203
|
+
[k: string]: {
|
|
204
|
+
table: {
|
|
205
|
+
disable: boolean;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
decorators: ((story: any, context: any) => any)[];
|
|
210
|
+
};
|
|
211
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SetupOptions } from '@lumx/core/testing';
|
|
2
|
+
import { IconButtonProps } from './IconButton';
|
|
3
|
+
type SetupProps = Partial<IconButtonProps>;
|
|
4
|
+
/**
|
|
5
|
+
* Mounts the component and returns common DOM elements / data needed in multiple tests further down.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setup: (propsOverride: SetupProps | undefined, { render, ...options }: SetupOptions<IconButtonProps>) => {
|
|
8
|
+
props: any;
|
|
9
|
+
iconButton: HTMLElement;
|
|
10
|
+
icon: HTMLElement | null;
|
|
11
|
+
img: HTMLElement | null;
|
|
12
|
+
wrapper: Partial<import("@lumx/core/testing").SetupResult>;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: (renderOptions: SetupOptions<IconButtonProps>) => void;
|
|
15
|
+
export default _default;
|