@lumx/core 4.14.0-next.0 → 4.14.0-next.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.
- package/js/components/AlertDialog/Stories.d.ts +115 -0
- package/js/components/AlertDialog/index.d.ts +91 -0
- package/js/components/Avatar/Stories.d.ts +52 -0
- package/js/components/Avatar/index.d.ts +50 -0
- package/js/components/Badge/BadgeWrapper.d.ts +13 -0
- package/js/components/Badge/BadgeWrapperStories.d.ts +29 -0
- package/js/components/Badge/Stories.d.ts +46 -0
- package/js/components/Badge/index.d.ts +37 -0
- package/js/components/Button/ButtonGroup.d.ts +36 -0
- package/js/components/Button/ButtonGroupStories.d.ts +33 -0
- package/js/components/Button/IconButtonStories.d.ts +210 -0
- package/js/components/Button/Stories.d.ts +302 -0
- package/js/components/Checkbox/Stories.d.ts +89 -0
- package/js/components/Chip/ChipGroupStories.d.ts +17 -0
- package/js/components/Chip/SelectionChipGroupStories.d.ts +54 -0
- package/js/components/Chip/Stories.d.ts +127 -0
- package/js/components/Combobox/ComboboxOptionTests.d.ts +24 -0
- package/js/components/Combobox/Stories.d.ts +167 -0
- package/js/components/Combobox/TestStories.d.ts +143 -0
- package/js/components/Combobox/Tests.d.ts +168 -0
- package/js/components/Dialog/Stories.d.ts +97 -0
- package/js/components/Dialog/index.d.ts +99 -0
- package/js/components/Divider/Stories.d.ts +21 -0
- package/js/components/DragHandle/Stories.d.ts +18 -0
- package/js/components/ExpansionPanel/Stories.d.ts +67 -0
- package/js/components/Flag/Stories.d.ts +120 -0
- package/js/components/FlexBox/Stories.d.ts +116 -0
- package/js/components/FlexBox/constants.d.ts +3 -3
- package/js/components/GenericBlock/Stories.d.ts +74 -0
- package/js/components/GenericBlock/constants.d.ts +1 -1
- package/js/components/GenericBlock/index.d.ts +85 -0
- package/js/components/GridColumn/GridColumnStories.d.ts +45 -0
- package/js/components/GridColumn/index.d.ts +2 -0
- package/js/components/Heading/Stories.d.ts +90 -0
- package/js/components/Icon/Stories.d.ts +156 -0
- package/js/components/ImageBlock/Stories.d.ts +187 -0
- package/js/components/InlineList/Stories.d.ts +64 -0
- package/js/components/InlineList/index.d.ts +53 -0
- package/js/components/InputHelper/Stories.d.ts +35 -0
- package/js/components/InputLabel/Stories.d.ts +34 -0
- package/js/components/Lightbox/Stories.d.ts +40 -0
- package/js/components/Lightbox/index.d.ts +68 -0
- package/js/components/Link/Stories.d.ts +282 -0
- package/js/components/Link/index.d.ts +47 -0
- package/js/components/LinkPreview/Stories.d.ts +61 -0
- package/js/components/LinkPreview/index.d.ts +53 -0
- package/js/components/List/ListDivider.d.ts +33 -0
- package/js/components/List/ListDividerStories.d.ts +17 -0
- package/js/components/List/ListItemStories.d.ts +53 -0
- package/js/components/List/ListSection.d.ts +45 -0
- package/js/components/List/ListSectionStories.d.ts +125 -0
- package/js/components/List/ListStories.d.ts +34 -0
- package/js/components/Message/Stories.d.ts +119 -0
- package/js/components/Mosaic/Stories.d.ts +102 -0
- package/js/components/Mosaic/index.d.ts +40 -0
- package/js/components/Popover/Stories.d.ts +139 -0
- package/js/components/Popover/index.d.ts +119 -0
- package/js/components/PopoverDialog/Stories.d.ts +44 -0
- package/js/components/PopoverDialog/index.d.ts +22 -0
- package/js/components/RadioButton/Stories.d.ts +78 -0
- package/js/components/RadioGroup/index.d.ts +34 -0
- package/js/components/SelectButton/Stories.d.ts +135 -0
- package/js/components/SelectButton/TestStories.d.ts +37 -0
- package/js/components/SelectButton/Tests.d.ts +34 -0
- package/js/components/SelectButton/index.d.ts +85 -0
- package/js/components/SelectTextField/Stories.d.ts +192 -0
- package/js/components/SelectTextField/TestStories.d.ts +39 -0
- package/js/components/SelectTextField/Tests.d.ts +38 -0
- package/js/components/SelectTextField/index.d.ts +87 -0
- package/js/components/Skeleton/SkeletonCircleStories.d.ts +43 -0
- package/js/components/Skeleton/SkeletonRectangleStories.d.ts +83 -0
- package/js/components/Skeleton/SkeletonTypographyStories.d.ts +53 -0
- package/js/components/Switch/Stories.d.ts +94 -0
- package/js/components/Table/Stories.d.ts +30 -0
- package/js/components/Table/TableBody.d.ts +25 -0
- package/js/components/Table/TableCellStories.d.ts +47 -0
- package/js/components/Table/TableHeader.d.ts +29 -0
- package/js/components/Table/TableRow.d.ts +35 -0
- package/js/components/Table/TableRowStories.d.ts +23 -0
- package/js/components/Table/index.d.ts +27 -0
- package/js/components/Tabs/Tab.d.ts +70 -0
- package/js/components/Tabs/TabPanel.d.ts +43 -0
- package/js/components/Text/Stories.d.ts +164 -0
- package/js/components/TextField/RawInputText.d.ts +22 -0
- package/js/components/TextField/RawInputTextStories.d.ts +16 -0
- package/js/components/TextField/RawInputTextareaStories.d.ts +21 -0
- package/js/components/TextField/Stories.d.ts +101 -0
- package/js/components/TextField/TextField.d.ts +84 -0
- package/js/components/Thumbnail/Stories.d.ts +178 -0
- package/js/components/Toolbar/Stories.d.ts +29 -0
- package/js/components/Toolbar/index.d.ts +33 -0
- package/js/components/Tooltip/Stories.d.ts +61 -0
- package/js/components/Tooltip/TestStories.d.ts +72 -0
- package/js/components/Tooltip/index.d.ts +65 -0
- package/js/components/Uploader/Stories.d.ts +116 -0
- package/js/components/Uploader/index.d.ts +79 -0
- package/js/components/UserBlock/Stories.d.ts +153 -0
- package/js/components/UserBlock/index.d.ts +145 -0
- package/js/utils/ClickAway/TestStories.d.ts +36 -0
- package/js/utils/InfiniteScroll/TestStories.d.ts +50 -0
- package/js/utils/InfiniteScroll/index.d.ts +21 -0
- package/js/utils/Portal/Stories.d.ts +29 -0
- package/js/utils/action-area/Stories.d.ts +38 -0
- package/js/utils/select/renderSelectOptions.d.ts +7 -0
- package/package.json +2 -2
- package/stories/utils/CombinationsTable.d.ts +26 -0
- package/stories/utils/ThemingVariablesTable.d.ts +29 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { JSXElement, HasTheme, HasClassName, HasCloseMode, CommonRef, LumxClassName } from '../../types';
|
|
2
|
+
import { Elevation, FitAnchorWidth, Offset, Placement } from './constants';
|
|
3
|
+
/**
|
|
4
|
+
* Shared popover props used by both React and Vue wrappers.
|
|
5
|
+
*
|
|
6
|
+
* Framework-specific props (ref types, children, callbacks) are added by each wrapper.
|
|
7
|
+
* The `anchorRef`, `boundaryRef`, `focusElement`, `parentElement`, `focusTrapZoneElement`
|
|
8
|
+
* are typed as `any` here because React uses `RefObject<HTMLElement>` while Vue uses
|
|
9
|
+
* raw `HTMLElement` — each framework narrows the type in its own props definition.
|
|
10
|
+
*/
|
|
11
|
+
export interface PopoverProps extends HasClassName, HasTheme, HasCloseMode {
|
|
12
|
+
/** Reference to the DOM element used to set the position of the popover. */
|
|
13
|
+
anchorRef?: CommonRef;
|
|
14
|
+
/** Customize the root element tag. */
|
|
15
|
+
as?: string;
|
|
16
|
+
/** Element which will act as boundary when opening the popover. */
|
|
17
|
+
boundaryRef?: CommonRef;
|
|
18
|
+
/** Whether a click anywhere out of the popover would close it. */
|
|
19
|
+
closeOnClickAway?: boolean;
|
|
20
|
+
/** Whether an escape key press would close the popover. */
|
|
21
|
+
closeOnEscape?: boolean;
|
|
22
|
+
/** Shadow elevation. */
|
|
23
|
+
elevation?: Elevation;
|
|
24
|
+
/**
|
|
25
|
+
* Manage popover width:
|
|
26
|
+
* - `maxWidth`: popover not bigger than anchor
|
|
27
|
+
* - `minWidth` or `true`: popover not smaller than anchor
|
|
28
|
+
* - `width`: popover equal to the anchor.
|
|
29
|
+
*/
|
|
30
|
+
fitToAnchorWidth?: FitAnchorWidth | boolean;
|
|
31
|
+
/** Shrink popover if even after flipping there is not enough space. */
|
|
32
|
+
fitWithinViewportHeight?: boolean;
|
|
33
|
+
/** Element to focus when opening the popover. */
|
|
34
|
+
focusElement?: CommonRef;
|
|
35
|
+
/** Whether the focus should go back on the anchor when popover closes and focus is within. */
|
|
36
|
+
focusAnchorOnClose?: boolean;
|
|
37
|
+
/** Whether we put an arrow or not. */
|
|
38
|
+
hasArrow?: boolean;
|
|
39
|
+
/** Whether the popover is open or not. */
|
|
40
|
+
isOpen: boolean;
|
|
41
|
+
/** Offset placement relative to anchor. */
|
|
42
|
+
offset?: Offset;
|
|
43
|
+
/** Reference to the parent element that triggered the popover. */
|
|
44
|
+
parentElement?: CommonRef;
|
|
45
|
+
/** Placement relative to anchor. */
|
|
46
|
+
placement?: Placement;
|
|
47
|
+
/** Whether the popover should be rendered into a portal. */
|
|
48
|
+
usePortal?: boolean;
|
|
49
|
+
/** The element in which the focus trap should be set. Default to popover. */
|
|
50
|
+
focusTrapZoneElement?: CommonRef;
|
|
51
|
+
/** Z-axis position. */
|
|
52
|
+
zIndex?: number;
|
|
53
|
+
/** Whether the popover should trap the focus within itself. */
|
|
54
|
+
withFocusTrap?: boolean;
|
|
55
|
+
/** On close callback (on click away or Escape pressed). Framework wrappers provide their own type. */
|
|
56
|
+
handleClose?(): void;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Internal UI rendering props for the core Popover component.
|
|
60
|
+
* These are passed by the framework wrappers after processing the behavioral PopoverProps.
|
|
61
|
+
*/
|
|
62
|
+
export interface PopoverUIProps extends HasClassName, HasTheme, HasCloseMode {
|
|
63
|
+
/** Customize the root element tag. */
|
|
64
|
+
as?: string;
|
|
65
|
+
/** Content. */
|
|
66
|
+
children: JSXElement;
|
|
67
|
+
/** Shadow elevation. */
|
|
68
|
+
elevation?: Elevation;
|
|
69
|
+
/** Whether we put an arrow or not. */
|
|
70
|
+
hasArrow?: boolean;
|
|
71
|
+
/** Whether the popover is open or not. */
|
|
72
|
+
isOpen: boolean;
|
|
73
|
+
/** Resolved position (from floating UI). */
|
|
74
|
+
position?: Placement;
|
|
75
|
+
/** Computed popover styles (from floating UI). */
|
|
76
|
+
popoverStyle?: any;
|
|
77
|
+
/** Computed arrow styles (from floating UI). */
|
|
78
|
+
arrowStyle?: any;
|
|
79
|
+
/** Ref for the popover root element. */
|
|
80
|
+
ref?: CommonRef;
|
|
81
|
+
/** Ref setter for the arrow element. */
|
|
82
|
+
arrowRef?: CommonRef;
|
|
83
|
+
/** Whether to render into a portal. */
|
|
84
|
+
usePortal?: boolean;
|
|
85
|
+
/** Click-away callback (when closeOnClickAway is true). */
|
|
86
|
+
clickAwayCallback?: any;
|
|
87
|
+
/** Refs for click-away detection. */
|
|
88
|
+
clickAwayRefs?: any;
|
|
89
|
+
/** Unmount sentinel (React-specific, optional). */
|
|
90
|
+
unmountSentinel?: JSXElement;
|
|
91
|
+
}
|
|
92
|
+
/** Injected framework-specific components. */
|
|
93
|
+
export interface PopoverComponents {
|
|
94
|
+
/** Portal component for rendering outside the parent hierarchy. */
|
|
95
|
+
Portal: any;
|
|
96
|
+
/** ClickAwayProvider component for click-away detection. */
|
|
97
|
+
ClickAwayProvider: any;
|
|
98
|
+
/** ThemeProvider component for theme context isolation. */
|
|
99
|
+
ThemeProvider: any;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Component display name.
|
|
103
|
+
*/
|
|
104
|
+
export declare const COMPONENT_NAME = "Popover";
|
|
105
|
+
/**
|
|
106
|
+
* Component default class name and class prefix.
|
|
107
|
+
*/
|
|
108
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
109
|
+
/**
|
|
110
|
+
* Component default props (used by framework wrappers).
|
|
111
|
+
*/
|
|
112
|
+
export declare const DEFAULT_PROPS: Partial<PopoverProps>;
|
|
113
|
+
/**
|
|
114
|
+
* Popover core UI component.
|
|
115
|
+
*
|
|
116
|
+
* Framework-specific components (Portal, ClickAwayProvider, ThemeProvider) are passed
|
|
117
|
+
* as a second argument by the React/Vue wrappers.
|
|
118
|
+
*/
|
|
119
|
+
export declare const Popover: (props: PopoverUIProps, { Portal, ClickAwayProvider, ThemeProvider }: PopoverComponents) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
/**
|
|
3
|
+
* Core stories for the PopoverDialog component.
|
|
4
|
+
*
|
|
5
|
+
* Stories are interactive (open/close state, focus trap, etc.) and require
|
|
6
|
+
* framework-specific rendering for anchor refs and state management.
|
|
7
|
+
* A `render` function is provided per framework to handle this.
|
|
8
|
+
*
|
|
9
|
+
* The render function receives all args, which can include:
|
|
10
|
+
* - `label`: Accessible label for the dialog (aria-label)
|
|
11
|
+
* - Any other PopoverDialog props
|
|
12
|
+
*/
|
|
13
|
+
export declare function setup({ component: PopoverDialog, render }: SetupStoriesOptions): {
|
|
14
|
+
meta: {
|
|
15
|
+
component: any;
|
|
16
|
+
render: any;
|
|
17
|
+
parameters: {
|
|
18
|
+
chromatic: {
|
|
19
|
+
disableSnapshot: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
tags: string[];
|
|
23
|
+
argTypes: {
|
|
24
|
+
closeMode: {
|
|
25
|
+
control: {
|
|
26
|
+
type: "select" | "inline-radio";
|
|
27
|
+
};
|
|
28
|
+
options: string[];
|
|
29
|
+
mapping: Record<string, string> | undefined;
|
|
30
|
+
};
|
|
31
|
+
anchorRef: {
|
|
32
|
+
control: boolean;
|
|
33
|
+
};
|
|
34
|
+
children: {
|
|
35
|
+
control: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
WithIconButtonTrigger: {
|
|
40
|
+
args: {
|
|
41
|
+
label: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HasAriaLabelOrLabelledBy, LumxClassName } from '../../types';
|
|
2
|
+
import type { PopoverProps } from '../Popover';
|
|
3
|
+
/**
|
|
4
|
+
* PopoverDialog props.
|
|
5
|
+
* The PopoverDialog has the same props as the Popover but requires an accessible label.
|
|
6
|
+
*/
|
|
7
|
+
export type PopoverDialogProps = PopoverProps & HasAriaLabelOrLabelledBy & {
|
|
8
|
+
/** Accessible label for the dialog (alternative to aria-label prop). */
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Component display name.
|
|
13
|
+
*/
|
|
14
|
+
export declare const COMPONENT_NAME = "PopoverDialog";
|
|
15
|
+
/**
|
|
16
|
+
* Component default class name and class prefix.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
19
|
+
/**
|
|
20
|
+
* Component default props.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PROPS: Partial<PopoverDialogProps>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
/**
|
|
3
|
+
* Setup RadioButton stories for a specific framework (React or Vue).
|
|
4
|
+
* This function creates all the stories with the appropriate decorators.
|
|
5
|
+
* Framework-specific render functions or args can be injected via `overrides`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setup({ component: RadioButton, decorators: { withCombinations, withValueOnChange }, }: SetupStoriesOptions<{
|
|
8
|
+
decorators: 'withCombinations' | 'withValueOnChange';
|
|
9
|
+
}>): {
|
|
10
|
+
meta: {
|
|
11
|
+
component: any;
|
|
12
|
+
render: (args: any) => import("react").JSX.Element;
|
|
13
|
+
decorators: ((story: any, context: any) => any)[];
|
|
14
|
+
argTypes: {
|
|
15
|
+
onChange: {
|
|
16
|
+
action: boolean;
|
|
17
|
+
};
|
|
18
|
+
name: {
|
|
19
|
+
control: boolean;
|
|
20
|
+
};
|
|
21
|
+
value: {
|
|
22
|
+
control: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
args: {
|
|
26
|
+
isChecked: boolean;
|
|
27
|
+
name: string;
|
|
28
|
+
value: string;
|
|
29
|
+
helper?: string | undefined;
|
|
30
|
+
id?: string | undefined;
|
|
31
|
+
label?: import("react").ReactNode;
|
|
32
|
+
inputProps?: Record<string, any> | undefined;
|
|
33
|
+
inputRef?: import("../../types").CommonRef;
|
|
34
|
+
inputId?: string | undefined;
|
|
35
|
+
handleChange?: ((value?: string, name?: string, event?: any) => void) | undefined;
|
|
36
|
+
ref?: import("../../types").CommonRef;
|
|
37
|
+
theme?: import("../../constants").Theme | undefined;
|
|
38
|
+
className?: string | undefined;
|
|
39
|
+
'aria-disabled'?: import("../../types/Booleanish").Booleanish | undefined;
|
|
40
|
+
isDisabled?: boolean | undefined;
|
|
41
|
+
disabled?: boolean | undefined;
|
|
42
|
+
checked?: boolean | undefined;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/** Default radio button */
|
|
46
|
+
Default: {};
|
|
47
|
+
/** With label and helper */
|
|
48
|
+
LabelAndHelper: {
|
|
49
|
+
argTypes: {
|
|
50
|
+
label: {
|
|
51
|
+
control: string;
|
|
52
|
+
};
|
|
53
|
+
helper: {
|
|
54
|
+
control: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
args: {
|
|
58
|
+
label: string;
|
|
59
|
+
helper: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/** Disabled */
|
|
63
|
+
Disabled: {
|
|
64
|
+
argTypes: {
|
|
65
|
+
isDisabled: {
|
|
66
|
+
control: boolean;
|
|
67
|
+
};
|
|
68
|
+
'aria-disabled': {
|
|
69
|
+
control: boolean;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
args: {
|
|
73
|
+
label: string;
|
|
74
|
+
helper: string;
|
|
75
|
+
};
|
|
76
|
+
decorators: ((story: any, context: any) => any)[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JSXElement, LumxClassName, HasClassName, CommonRef } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* Defines the props of the component.
|
|
4
|
+
*/
|
|
5
|
+
export interface RadioGroupProps extends HasClassName {
|
|
6
|
+
/** RadioButton elements */
|
|
7
|
+
children?: JSXElement;
|
|
8
|
+
/** reference to the root element */
|
|
9
|
+
ref?: CommonRef;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Component display name.
|
|
13
|
+
*/
|
|
14
|
+
export declare const COMPONENT_NAME = "RadioGroup";
|
|
15
|
+
/**
|
|
16
|
+
* Component default class name and class prefix.
|
|
17
|
+
*/
|
|
18
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
19
|
+
/**
|
|
20
|
+
* Component default props.
|
|
21
|
+
*/
|
|
22
|
+
export declare const DEFAULT_PROPS: Partial<RadioGroupProps>;
|
|
23
|
+
/**
|
|
24
|
+
* RadioGroup component.
|
|
25
|
+
*
|
|
26
|
+
* @param props Component props.
|
|
27
|
+
* @return JSX element.
|
|
28
|
+
*/
|
|
29
|
+
export declare const RadioGroup: {
|
|
30
|
+
(props: RadioGroupProps): import("react").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
className: "lumx-radio-group";
|
|
33
|
+
defaultProps: Partial<RadioGroupProps>;
|
|
34
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
export declare const FRUITS: {
|
|
3
|
+
category: string;
|
|
4
|
+
categoryIcon: string;
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
icon: string;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
export type Fruit = (typeof FRUITS)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Setup SelectButton stories for a specific framework (React or Vue).
|
|
13
|
+
*/
|
|
14
|
+
export declare function setup({ components: { SelectButton }, decorators: { withValueOnChange, withCombinations }, }: SetupStoriesOptions<{
|
|
15
|
+
components: {
|
|
16
|
+
SelectButton: any;
|
|
17
|
+
};
|
|
18
|
+
decorators: 'withValueOnChange' | 'withCombinations';
|
|
19
|
+
}>): {
|
|
20
|
+
meta: {
|
|
21
|
+
component: any;
|
|
22
|
+
play({ canvas }: any): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
Default: {
|
|
25
|
+
args: {
|
|
26
|
+
value: undefined;
|
|
27
|
+
};
|
|
28
|
+
decorators: ((story: any, context: any) => any)[];
|
|
29
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
WithSelectedValue: {
|
|
32
|
+
args: {
|
|
33
|
+
value: {
|
|
34
|
+
category: string;
|
|
35
|
+
categoryIcon: string;
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
icon: string;
|
|
39
|
+
description: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
decorators: ((story: any, context: any) => any)[];
|
|
43
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
WithSections: {
|
|
46
|
+
args: {
|
|
47
|
+
value: undefined;
|
|
48
|
+
};
|
|
49
|
+
decorators: ((story: any, context: any) => any)[];
|
|
50
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
51
|
+
};
|
|
52
|
+
WithDescriptions: {
|
|
53
|
+
args: {
|
|
54
|
+
value: undefined;
|
|
55
|
+
};
|
|
56
|
+
decorators: ((story: any, context: any) => any)[];
|
|
57
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
58
|
+
};
|
|
59
|
+
Disabled: {
|
|
60
|
+
args: {
|
|
61
|
+
value: {
|
|
62
|
+
category: string;
|
|
63
|
+
categoryIcon: string;
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
icon: string;
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
decorators: ((story: any, context: any) => any)[];
|
|
71
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
72
|
+
};
|
|
73
|
+
Loading: {
|
|
74
|
+
args: {
|
|
75
|
+
value: undefined;
|
|
76
|
+
};
|
|
77
|
+
decorators: ((story: any, context: any) => any)[];
|
|
78
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
79
|
+
};
|
|
80
|
+
LoadingMore: {
|
|
81
|
+
args: {
|
|
82
|
+
value: undefined;
|
|
83
|
+
};
|
|
84
|
+
decorators: ((story: any, context: any) => any)[];
|
|
85
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
86
|
+
};
|
|
87
|
+
ErrorState: {
|
|
88
|
+
args: {
|
|
89
|
+
value: undefined;
|
|
90
|
+
};
|
|
91
|
+
decorators: ((story: any, context: any) => any)[];
|
|
92
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
93
|
+
};
|
|
94
|
+
MultipleSelection: {
|
|
95
|
+
args: {
|
|
96
|
+
value: never[];
|
|
97
|
+
};
|
|
98
|
+
decorators: ((story: any, context: any) => any)[];
|
|
99
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
100
|
+
};
|
|
101
|
+
MultipleWithPreselected: {
|
|
102
|
+
args: {
|
|
103
|
+
value: {
|
|
104
|
+
category: string;
|
|
105
|
+
categoryIcon: string;
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
icon: string;
|
|
109
|
+
description: string;
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
112
|
+
decorators: ((story: any, context: any) => any)[];
|
|
113
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
114
|
+
};
|
|
115
|
+
WithNbOptionMessage: {
|
|
116
|
+
args: {
|
|
117
|
+
value: undefined;
|
|
118
|
+
};
|
|
119
|
+
decorators: ((story: any, context: any) => any)[];
|
|
120
|
+
render: ({ value, onChange }: any) => import("react").JSX.Element;
|
|
121
|
+
};
|
|
122
|
+
LabelDisplayModes: {
|
|
123
|
+
play: () => void;
|
|
124
|
+
argTypes: {
|
|
125
|
+
labelDisplayMode: {
|
|
126
|
+
control: boolean;
|
|
127
|
+
};
|
|
128
|
+
value: {
|
|
129
|
+
control: boolean;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
render: ({ value, labelDisplayMode }: any) => import("react").JSX.Element;
|
|
133
|
+
decorators: ((story: any, context: any) => any)[];
|
|
134
|
+
};
|
|
135
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { SetupStoriesOptions } from '@lumx/core/stories/types';
|
|
2
|
+
/**
|
|
3
|
+
* Setup SelectButton test stories
|
|
4
|
+
*/
|
|
5
|
+
export declare function setup({ components: { SelectButton }, renderWithState, }: SetupStoriesOptions<{
|
|
6
|
+
components: {
|
|
7
|
+
SelectButton: any;
|
|
8
|
+
};
|
|
9
|
+
decorators: 'withValueOnChange';
|
|
10
|
+
}> & {
|
|
11
|
+
renderWithState: (template: (props: any) => any) => any;
|
|
12
|
+
}): {
|
|
13
|
+
meta: {
|
|
14
|
+
component: any;
|
|
15
|
+
tags: string[];
|
|
16
|
+
parameters: {
|
|
17
|
+
chromatic: {
|
|
18
|
+
disable: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
ClickOutsideCloses: {
|
|
23
|
+
render: (args: any) => import("react").JSX.Element;
|
|
24
|
+
args: {
|
|
25
|
+
value: undefined;
|
|
26
|
+
onChange: () => void;
|
|
27
|
+
};
|
|
28
|
+
play: ({ canvasElement }: any) => Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
SelectionUpdates: {
|
|
31
|
+
render: () => any;
|
|
32
|
+
play: ({ canvasElement }: any) => Promise<void>;
|
|
33
|
+
};
|
|
34
|
+
WithInfiniteScroll: {
|
|
35
|
+
play({ canvasElement }: any): Promise<void>;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const TRANSLATIONS: {
|
|
2
|
+
loadingMessage: string;
|
|
3
|
+
emptyMessage: string;
|
|
4
|
+
errorMessage: string;
|
|
5
|
+
errorTryReloadMessage: string;
|
|
6
|
+
nbOptionMessage: (n: number) => string;
|
|
7
|
+
};
|
|
8
|
+
type RenderResult = {
|
|
9
|
+
unmount: () => void;
|
|
10
|
+
container: HTMLElement;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Options to set up the SelectButton test suite.
|
|
14
|
+
* Injected by the framework-specific test file (React or Vue).
|
|
15
|
+
*/
|
|
16
|
+
export interface SelectButtonTestSetup {
|
|
17
|
+
components: {
|
|
18
|
+
SelectButton: any;
|
|
19
|
+
Combobox: any;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Render a SelectButton template with controlled state management.
|
|
23
|
+
*
|
|
24
|
+
* @param template JSX render function receiving `{ value, onChange, ... }`.
|
|
25
|
+
* @param initialArgs Initial props (value, spies, etc.).
|
|
26
|
+
*/
|
|
27
|
+
renderWithState: (template: (props: any) => any, initialArgs?: Record<string, any>) => RenderResult;
|
|
28
|
+
}
|
|
29
|
+
export declare function createTemplates(SelectButton: any): {
|
|
30
|
+
defaultTemplate: (props: any) => import("react").JSX.Element;
|
|
31
|
+
multiTemplate: (props: any) => import("react").JSX.Element;
|
|
32
|
+
};
|
|
33
|
+
export default function selectButtonTests({ components, renderWithState }: SelectButtonTestSetup): void;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { LumxClassName } from '../../types';
|
|
2
|
+
import type { ComboboxButtonLabelDisplayMode } from '../Combobox/ComboboxButton';
|
|
3
|
+
import { BaseSelectComponents, BaseSelectProps, SelectButtonTranslations, SelectTextFieldStatus } from '../../utils/select/types';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the props for the core SelectButton template.
|
|
6
|
+
*/
|
|
7
|
+
export interface SelectButtonProps<O> extends BaseSelectProps<O> {
|
|
8
|
+
/**
|
|
9
|
+
* Selected value (single mode) or selected values (multi mode).
|
|
10
|
+
* The wrapper layer chooses the shape; the core just renders names.
|
|
11
|
+
*/
|
|
12
|
+
value?: O | O[];
|
|
13
|
+
/**
|
|
14
|
+
* When `true`, sets `aria-multiselectable="true"` on the listbox so
|
|
15
|
+
* the dropdown stays open after each selection (combobox setup detects this attribute).
|
|
16
|
+
*/
|
|
17
|
+
isMultiselectable?: boolean;
|
|
18
|
+
/** Button label (used for ARIA and when no selection). */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Controls how the label/value is displayed in the button. */
|
|
21
|
+
labelDisplayMode?: ComboboxButtonLabelDisplayMode;
|
|
22
|
+
/**
|
|
23
|
+
* Props forwarded to Combobox.Button (button appearance, emphasis, size, etc.).
|
|
24
|
+
* Pass `renderButton` here to provide a custom button renderer — see
|
|
25
|
+
* `ComboboxButtonProps.renderButton`. Framework wrappers are responsible for
|
|
26
|
+
* defaulting any visual affordance (e.g. the dropdown chevron `rightIcon`).
|
|
27
|
+
*/
|
|
28
|
+
buttonProps?: Record<string, any>;
|
|
29
|
+
/** Props forwarded to Combobox.Popover. */
|
|
30
|
+
popoverProps?: Record<string, any>;
|
|
31
|
+
/** Props forwarded to Combobox.List (e.g. ref). */
|
|
32
|
+
listProps?: Record<string, any>;
|
|
33
|
+
/** Callback on option selected (receives option id string). */
|
|
34
|
+
handleSelect?: (selectedOption: {
|
|
35
|
+
value: string;
|
|
36
|
+
}) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Status of the dropdown list.
|
|
39
|
+
* - `'idle'` — Default state, no loading indicators.
|
|
40
|
+
* - `'loading'` — Full loading: shows skeleton placeholders, hides real options.
|
|
41
|
+
* - `'loadingMore'` — Paginated loading: appends a skeleton after existing options.
|
|
42
|
+
* - `'error'` — Error state: shows an error message in the dropdown.
|
|
43
|
+
* @default 'idle'
|
|
44
|
+
*/
|
|
45
|
+
listStatus?: SelectTextFieldStatus;
|
|
46
|
+
/** Optional translations for screen-reader announcements (loading/empty/error/option count). */
|
|
47
|
+
translations?: SelectButtonTranslations;
|
|
48
|
+
/** Callback fired when the dropdown open state changes. */
|
|
49
|
+
onOpen?: (isOpen: boolean) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Callback fired to load more items (infinite scroll).
|
|
52
|
+
* When provided together with an injected `InfiniteScroll` component, an invisible
|
|
53
|
+
* sentinel element is rendered after the options to trigger loading via IntersectionObserver.
|
|
54
|
+
*/
|
|
55
|
+
onLoadMore?: () => void;
|
|
56
|
+
/** IntersectionObserver options forwarded to the InfiniteScroll sentinel. */
|
|
57
|
+
infiniteScrollOptions?: IntersectionObserverInit;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Injected framework-specific components for SelectButton rendering.
|
|
61
|
+
*/
|
|
62
|
+
export type SelectButtonComponents = BaseSelectComponents;
|
|
63
|
+
/**
|
|
64
|
+
* Component display name.
|
|
65
|
+
*/
|
|
66
|
+
export declare const COMPONENT_NAME = "SelectButton";
|
|
67
|
+
/**
|
|
68
|
+
* Component default class name.
|
|
69
|
+
*/
|
|
70
|
+
export declare const CLASSNAME: LumxClassName<typeof COMPONENT_NAME>;
|
|
71
|
+
/**
|
|
72
|
+
* SelectButton core template.
|
|
73
|
+
* Renders a Combobox with a button trigger and a dropdown list of options.
|
|
74
|
+
*
|
|
75
|
+
* Framework-specific components are passed as a second argument by the React/Vue wrappers.
|
|
76
|
+
*
|
|
77
|
+
* @param props Component props.
|
|
78
|
+
* @param components Injected framework-specific components.
|
|
79
|
+
* @return JSX element.
|
|
80
|
+
*/
|
|
81
|
+
export declare const SelectButton: {
|
|
82
|
+
<O>(props: SelectButtonProps<O>, { Combobox, InfiniteScroll }: SelectButtonComponents): import("react").JSX.Element;
|
|
83
|
+
displayName: string;
|
|
84
|
+
className: "lumx-select-button";
|
|
85
|
+
};
|