@dxos/react-ui-list 0.8.4-main.a4bbb77 → 0.8.4-main.abd8ff62ef
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/dist/lib/browser/index.mjs +1349 -718
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +1349 -718
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/Accordion/Accordion.d.ts +1 -1
- package/dist/types/src/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/Accordion.stories.d.ts +0 -3
- package/dist/types/src/components/Accordion/Accordion.stories.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionItem.d.ts.map +1 -1
- package/dist/types/src/components/Accordion/AccordionRoot.d.ts +1 -1
- package/dist/types/src/components/Accordion/AccordionRoot.d.ts.map +1 -1
- package/dist/types/src/components/Combobox/Combobox.d.ts +105 -0
- package/dist/types/src/components/Combobox/Combobox.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts +12 -0
- package/dist/types/src/components/Combobox/Combobox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Combobox/index.d.ts +2 -0
- package/dist/types/src/components/Combobox/index.d.ts.map +1 -0
- package/dist/types/src/components/List/List.d.ts +19 -8
- package/dist/types/src/components/List/List.d.ts.map +1 -1
- package/dist/types/src/components/List/List.stories.d.ts +2 -2
- package/dist/types/src/components/List/List.stories.d.ts.map +1 -1
- package/dist/types/src/components/List/ListItem.d.ts +10 -8
- package/dist/types/src/components/List/ListItem.d.ts.map +1 -1
- package/dist/types/src/components/List/ListRoot.d.ts +2 -2
- package/dist/types/src/components/List/ListRoot.d.ts.map +1 -1
- package/dist/types/src/components/List/testing.d.ts +1 -1
- package/dist/types/src/components/List/testing.d.ts.map +1 -1
- package/dist/types/src/components/Listbox/Listbox.d.ts +27 -0
- package/dist/types/src/components/Listbox/Listbox.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts +12 -0
- package/dist/types/src/components/Listbox/Listbox.stories.d.ts.map +1 -0
- package/dist/types/src/components/Listbox/index.d.ts +2 -0
- package/dist/types/src/components/Listbox/index.d.ts.map +1 -0
- package/dist/types/src/components/Picker/Picker.d.ts +49 -0
- package/dist/types/src/components/Picker/Picker.d.ts.map +1 -0
- package/dist/types/src/components/Picker/Picker.stories.d.ts +28 -0
- package/dist/types/src/components/Picker/Picker.stories.d.ts.map +1 -0
- package/dist/types/src/components/Picker/context.d.ts +29 -0
- package/dist/types/src/components/Picker/context.d.ts.map +1 -0
- package/dist/types/src/components/Picker/index.d.ts +3 -0
- package/dist/types/src/components/Picker/index.d.ts.map +1 -0
- package/dist/types/src/components/RowList/RowList.d.ts +61 -0
- package/dist/types/src/components/RowList/RowList.d.ts.map +1 -0
- package/dist/types/src/components/RowList/RowList.stories.d.ts +35 -0
- package/dist/types/src/components/RowList/RowList.stories.d.ts.map +1 -0
- package/dist/types/src/components/RowList/index.d.ts +3 -0
- package/dist/types/src/components/RowList/index.d.ts.map +1 -0
- package/dist/types/src/components/Tree/Tree.d.ts +10 -6
- package/dist/types/src/components/Tree/Tree.d.ts.map +1 -1
- package/dist/types/src/components/Tree/Tree.stories.d.ts +9 -28
- package/dist/types/src/components/Tree/Tree.stories.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeContext.d.ts +24 -10
- package/dist/types/src/components/Tree/TreeContext.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItem.d.ts +25 -4
- package/dist/types/src/components/Tree/TreeItem.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts +4 -3
- package/dist/types/src/components/Tree/TreeItemHeading.d.ts.map +1 -1
- package/dist/types/src/components/Tree/TreeItemToggle.d.ts +3 -3
- package/dist/types/src/components/Tree/TreeItemToggle.d.ts.map +1 -1
- package/dist/types/src/components/Tree/helpers.d.ts.map +1 -1
- package/dist/types/src/components/Tree/index.d.ts +2 -0
- package/dist/types/src/components/Tree/index.d.ts.map +1 -1
- package/dist/types/src/components/Tree/testing.d.ts +3 -3
- package/dist/types/src/components/Tree/testing.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +4 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/util/path.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -31
- package/src/components/Accordion/Accordion.stories.tsx +5 -8
- package/src/components/Accordion/AccordionItem.tsx +3 -4
- package/src/components/Accordion/AccordionRoot.tsx +1 -1
- package/src/components/Combobox/Combobox.stories.tsx +60 -0
- package/src/components/Combobox/Combobox.tsx +387 -0
- package/src/components/Combobox/index.ts +5 -0
- package/src/components/List/List.stories.tsx +34 -22
- package/src/components/List/List.tsx +14 -10
- package/src/components/List/ListItem.tsx +60 -40
- package/src/components/List/ListRoot.tsx +3 -3
- package/src/components/List/testing.ts +7 -7
- package/src/components/Listbox/Listbox.stories.tsx +48 -0
- package/src/components/Listbox/Listbox.tsx +201 -0
- package/src/components/Listbox/index.ts +5 -0
- package/src/components/Picker/Picker.stories.tsx +131 -0
- package/src/components/Picker/Picker.tsx +439 -0
- package/src/components/Picker/context.ts +43 -0
- package/src/components/Picker/index.ts +6 -0
- package/src/components/RowList/RowList.stories.tsx +163 -0
- package/src/components/RowList/RowList.tsx +353 -0
- package/src/components/RowList/index.ts +6 -0
- package/src/components/Tree/Tree.stories.tsx +153 -64
- package/src/components/Tree/Tree.tsx +43 -40
- package/src/components/Tree/TreeContext.tsx +21 -9
- package/src/components/Tree/TreeItem.tsx +214 -127
- package/src/components/Tree/TreeItemHeading.tsx +10 -8
- package/src/components/Tree/TreeItemToggle.tsx +29 -18
- package/src/components/Tree/index.ts +2 -0
- package/src/components/Tree/testing.ts +10 -9
- package/src/components/index.ts +4 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// `Listbox` — single-select listbox with optional check indicator.
|
|
6
|
+
//
|
|
7
|
+
// Internally composes `RowList` from this same package: `Listbox.Root`
|
|
8
|
+
// is `RowList.Root` + `RowList.Content`, and `Listbox.Option` is `Row`.
|
|
9
|
+
// The compound API (`Listbox.Root` / `.Option` / `.OptionLabel` /
|
|
10
|
+
// `.OptionIndicator`) is preserved so existing call sites keep working.
|
|
11
|
+
//
|
|
12
|
+
// Why this shape (when `RowList` is right there): `Listbox` historically
|
|
13
|
+
// rendered as a flat `<ul>` with no `ScrollArea` wrapper — it's used
|
|
14
|
+
// inside dialogs / popovers / panels that own their own scroll. Skipping
|
|
15
|
+
// `RowList.Viewport` keeps that behaviour. If a caller wants the styled
|
|
16
|
+
// scroll surface, they wrap the listbox in `RowList.Viewport` themselves.
|
|
17
|
+
|
|
18
|
+
import { type Scope, createContextScope } from '@radix-ui/react-context';
|
|
19
|
+
import React, { type ComponentPropsWithRef, type ReactNode, forwardRef } from 'react';
|
|
20
|
+
|
|
21
|
+
import { Icon, type IconProps, type ThemedClassName } from '@dxos/react-ui';
|
|
22
|
+
import { mx } from '@dxos/ui-theme';
|
|
23
|
+
|
|
24
|
+
import { Row, RowList, createRowListScope, useRowListSelection } from '../RowList';
|
|
25
|
+
|
|
26
|
+
const commandItem = 'flex items-center overflow-hidden';
|
|
27
|
+
|
|
28
|
+
const LISTBOX_NAME = 'Listbox';
|
|
29
|
+
const LISTBOX_OPTION_NAME = 'ListboxOption';
|
|
30
|
+
const LISTBOX_OPTION_LABEL_NAME = 'ListboxOptionLabel';
|
|
31
|
+
const LISTBOX_OPTION_INDICATOR_NAME = 'ListboxOptionIndicator';
|
|
32
|
+
|
|
33
|
+
//
|
|
34
|
+
// Context — only used to thread `value` through to `OptionIndicator` so
|
|
35
|
+
// it knows whether to show the checkmark. Selection state itself lives
|
|
36
|
+
// in `RowList`'s context (we delegate to it via composition).
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
type ListboxScopedProps<P> = P & { __listboxScope?: Scope };
|
|
40
|
+
type ListboxOptionScopedProps<P> = P & { __listboxOptionScope?: Scope };
|
|
41
|
+
|
|
42
|
+
const [createListboxContext, createListboxScope] = createContextScope(LISTBOX_NAME, [createRowListScope]);
|
|
43
|
+
const [createListboxOptionContext, createListboxOptionScope] = createContextScope(LISTBOX_OPTION_NAME, [
|
|
44
|
+
createListboxScope,
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
type ListboxOptionContextValue = {
|
|
48
|
+
value: string;
|
|
49
|
+
isSelected: boolean;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const [ListboxOptionProvider, useListboxOptionContext] =
|
|
53
|
+
createListboxOptionContext<ListboxOptionContextValue>(LISTBOX_OPTION_NAME);
|
|
54
|
+
|
|
55
|
+
//
|
|
56
|
+
// Root — composes `RowList.Root` + `RowList.Content`.
|
|
57
|
+
//
|
|
58
|
+
// Maps the public `value` / `onValueChange` API to RowList's
|
|
59
|
+
// `selectedId` / `onSelectChange` so existing consumers don't change.
|
|
60
|
+
//
|
|
61
|
+
|
|
62
|
+
type ListboxRootProps = ThemedClassName<ComponentPropsWithRef<'ul'>> & {
|
|
63
|
+
value?: string;
|
|
64
|
+
defaultValue?: string;
|
|
65
|
+
onValueChange?: (value: string) => void;
|
|
66
|
+
/** Reserved — autoFocus on mount. RowList's focus-on-entry covers the typical case. */
|
|
67
|
+
autoFocus?: boolean;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const ListboxRoot = forwardRef<HTMLUListElement, ListboxRootProps>(
|
|
71
|
+
(props: ListboxScopedProps<ListboxRootProps>, forwardedRef) => {
|
|
72
|
+
const {
|
|
73
|
+
__listboxScope: _scope,
|
|
74
|
+
children,
|
|
75
|
+
classNames,
|
|
76
|
+
value,
|
|
77
|
+
defaultValue,
|
|
78
|
+
onValueChange,
|
|
79
|
+
autoFocus: _autoFocus,
|
|
80
|
+
...rootProps
|
|
81
|
+
} = props;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<RowList.Root selectedId={value} defaultSelectedId={defaultValue} onSelectChange={onValueChange}>
|
|
85
|
+
<RowList.Content {...rootProps} classNames={mx('w-full', classNames)} ref={forwardedRef}>
|
|
86
|
+
{children}
|
|
87
|
+
</RowList.Content>
|
|
88
|
+
</RowList.Root>
|
|
89
|
+
);
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
ListboxRoot.displayName = LISTBOX_NAME;
|
|
94
|
+
|
|
95
|
+
//
|
|
96
|
+
// Option — composes `Row`. Adds the listbox-specific styling and
|
|
97
|
+
// publishes `{ value, isSelected }` so `OptionIndicator` can render a
|
|
98
|
+
// checkmark.
|
|
99
|
+
//
|
|
100
|
+
|
|
101
|
+
type ListboxOptionProps = ThemedClassName<ComponentPropsWithRef<'li'>> & {
|
|
102
|
+
value: string;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const ListboxOption = forwardRef<HTMLLIElement, ListboxOptionProps>(
|
|
106
|
+
(props: ListboxScopedProps<ListboxOptionProps>, forwardedRef) => {
|
|
107
|
+
const { __listboxScope, children, classNames, value, ...rootProps } = props;
|
|
108
|
+
|
|
109
|
+
// Selection state is read inside `ListboxOptionProviderHost` via
|
|
110
|
+
// the public `useRowListSelection` hook and republished on the
|
|
111
|
+
// listbox-option scope so `OptionIndicator` can render its
|
|
112
|
+
// checkmark synchronously.
|
|
113
|
+
return (
|
|
114
|
+
<Row
|
|
115
|
+
id={value}
|
|
116
|
+
{...rootProps}
|
|
117
|
+
classNames={mx('dx-focus-ring rounded-xs', commandItem, classNames)}
|
|
118
|
+
ref={forwardedRef}
|
|
119
|
+
>
|
|
120
|
+
<ListboxOptionProviderHost value={value}>{children}</ListboxOptionProviderHost>
|
|
121
|
+
</Row>
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
ListboxOption.displayName = LISTBOX_OPTION_NAME;
|
|
127
|
+
|
|
128
|
+
// Reads selection state from RowList's context (via `useRowListSelection`)
|
|
129
|
+
// and publishes it on the listbox-option scope so `OptionIndicator` can
|
|
130
|
+
// render its checkmark. Tiny adapter — keeps Listbox's public option API
|
|
131
|
+
// intact while delegating the actual state to RowList.
|
|
132
|
+
const ListboxOptionProviderHost = ({
|
|
133
|
+
value,
|
|
134
|
+
children,
|
|
135
|
+
}: ListboxScopedProps<{ value: string; children?: ReactNode }>) => {
|
|
136
|
+
const isSelected = useRowListSelection(value);
|
|
137
|
+
return (
|
|
138
|
+
<ListboxOptionProvider scope={undefined} value={value} isSelected={isSelected}>
|
|
139
|
+
{children}
|
|
140
|
+
</ListboxOptionProvider>
|
|
141
|
+
);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
//
|
|
145
|
+
// OptionLabel
|
|
146
|
+
//
|
|
147
|
+
|
|
148
|
+
const ListboxOptionLabel = forwardRef<HTMLDivElement, ThemedClassName<ComponentPropsWithRef<'div'>>>(
|
|
149
|
+
({ children, classNames, ...rootProps }, forwardedRef) => {
|
|
150
|
+
return (
|
|
151
|
+
<span {...rootProps} className={mx('grow truncate', classNames)} ref={forwardedRef}>
|
|
152
|
+
{children}
|
|
153
|
+
</span>
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
ListboxOptionLabel.displayName = LISTBOX_OPTION_LABEL_NAME;
|
|
159
|
+
|
|
160
|
+
//
|
|
161
|
+
// OptionIndicator — checkmark for the selected option.
|
|
162
|
+
//
|
|
163
|
+
// Reads `isSelected` from the option context. The visual indicator is
|
|
164
|
+
// also covered by `dx-selected` on the row, so the checkmark is purely
|
|
165
|
+
// confirmatory.
|
|
166
|
+
//
|
|
167
|
+
|
|
168
|
+
type ListboxOptionIndicatorProps = Omit<IconProps, 'icon'> & Partial<Pick<IconProps, 'icon'>>;
|
|
169
|
+
|
|
170
|
+
const ListboxOptionIndicator = forwardRef<SVGSVGElement, ListboxOptionIndicatorProps>(
|
|
171
|
+
(props: ListboxOptionScopedProps<ListboxOptionIndicatorProps>, forwardedRef) => {
|
|
172
|
+
const { __listboxOptionScope, classNames, ...rootProps } = props;
|
|
173
|
+
const { isSelected } = useListboxOptionContext(LISTBOX_OPTION_INDICATOR_NAME, __listboxOptionScope);
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<Icon
|
|
177
|
+
icon='ph--check--regular'
|
|
178
|
+
{...rootProps}
|
|
179
|
+
classNames={mx(!isSelected && 'invisible', classNames)}
|
|
180
|
+
ref={forwardedRef}
|
|
181
|
+
/>
|
|
182
|
+
);
|
|
183
|
+
},
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
ListboxOptionIndicator.displayName = LISTBOX_OPTION_INDICATOR_NAME;
|
|
187
|
+
|
|
188
|
+
//
|
|
189
|
+
// Listbox
|
|
190
|
+
//
|
|
191
|
+
|
|
192
|
+
export const Listbox = {
|
|
193
|
+
Root: ListboxRoot,
|
|
194
|
+
Option: ListboxOption,
|
|
195
|
+
OptionLabel: ListboxOptionLabel,
|
|
196
|
+
OptionIndicator: ListboxOptionIndicator,
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export { createListboxScope };
|
|
200
|
+
|
|
201
|
+
export type { ListboxRootProps, ListboxOptionProps, ListboxScopedProps };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// `Picker` stories — exercises the generic listbox-with-input compound
|
|
6
|
+
// in isolation. The compound is search-agnostic; the `Filtering` story
|
|
7
|
+
// shows how a caller wires in-memory filtering on top, and the
|
|
8
|
+
// `WithDisabled` story demonstrates the registry's skip-disabled
|
|
9
|
+
// behaviour during keyboard nav.
|
|
10
|
+
//
|
|
11
|
+
// For a search-themed wrapper with debounced query / auto-select-first /
|
|
12
|
+
// fuzzy filtering, see `SearchList` in `@dxos/react-ui-search`.
|
|
13
|
+
|
|
14
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
15
|
+
import React, { useMemo, useState } from 'react';
|
|
16
|
+
|
|
17
|
+
import { random } from '@dxos/random';
|
|
18
|
+
import { Column, ScrollArea } from '@dxos/react-ui';
|
|
19
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
|
|
21
|
+
import { Picker } from './Picker';
|
|
22
|
+
|
|
23
|
+
random.seed(1234);
|
|
24
|
+
|
|
25
|
+
type StoryItem = { value: string; label: string };
|
|
26
|
+
|
|
27
|
+
const allItems: StoryItem[] = Array.from({ length: 24 }, (_, i) => ({
|
|
28
|
+
value: `item-${i}`,
|
|
29
|
+
label: random.commerce.productName(),
|
|
30
|
+
})).sort((a, b) => a.label.localeCompare(b.label));
|
|
31
|
+
|
|
32
|
+
//
|
|
33
|
+
// Single configurable story. Each variant exported below sets a
|
|
34
|
+
// different combination of props — keeps the per-variant code to one
|
|
35
|
+
// line at the bottom of the file. See `AUDIT.md` §11 corrections for
|
|
36
|
+
// the convention.
|
|
37
|
+
//
|
|
38
|
+
|
|
39
|
+
type StoryArgs = {
|
|
40
|
+
/** Items to render. Defaults to the full 24-item catalog. */
|
|
41
|
+
items?: StoryItem[];
|
|
42
|
+
/** When true, the input is controlled and filters the rendered set. */
|
|
43
|
+
controlled?: boolean;
|
|
44
|
+
/** Indices into `items` that should render disabled. */
|
|
45
|
+
disabledIndices?: number[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const DefaultStory = ({ items = allItems, controlled = false, disabledIndices = [] }: StoryArgs = {}) => {
|
|
49
|
+
const [picked, setPicked] = useState<string | undefined>();
|
|
50
|
+
const [query, setQuery] = useState('');
|
|
51
|
+
|
|
52
|
+
const visible = useMemo(
|
|
53
|
+
() =>
|
|
54
|
+
controlled
|
|
55
|
+
? items
|
|
56
|
+
.map((item, originalIndex) => ({ item, originalIndex }))
|
|
57
|
+
.filter(({ item }) => item.label.toLowerCase().includes(query.toLowerCase()))
|
|
58
|
+
: items.map((item, originalIndex) => ({ item, originalIndex })),
|
|
59
|
+
[controlled, items, query],
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Column.Root gutter='sm' classNames='w-[24rem] border border-separator rounded-md py-form-gap'>
|
|
64
|
+
<Picker.Root>
|
|
65
|
+
<Column.Center>
|
|
66
|
+
<Picker.Input
|
|
67
|
+
autoFocus
|
|
68
|
+
placeholder={controlled ? 'Filter…' : '↑/↓ to navigate, Enter to pick'}
|
|
69
|
+
{...(controlled && { value: query, onValueChange: setQuery })}
|
|
70
|
+
/>
|
|
71
|
+
</Column.Center>
|
|
72
|
+
<ScrollArea.Root classNames='max-h-[20rem] py-form-gap' thin>
|
|
73
|
+
<ScrollArea.Viewport>
|
|
74
|
+
<ul role='listbox' className='flex flex-col'>
|
|
75
|
+
{visible.map(({ item, originalIndex }) => {
|
|
76
|
+
const disabled = disabledIndices.includes(originalIndex);
|
|
77
|
+
return (
|
|
78
|
+
<Picker.Item
|
|
79
|
+
key={item.value}
|
|
80
|
+
value={item.value}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
onSelect={() => setPicked(item.value)}
|
|
83
|
+
>
|
|
84
|
+
{item.label}
|
|
85
|
+
{disabled && ' (disabled)'}
|
|
86
|
+
</Picker.Item>
|
|
87
|
+
);
|
|
88
|
+
})}
|
|
89
|
+
{controlled && visible.length === 0 && (
|
|
90
|
+
<li role='status' className='px-2 py-1 text-description italic'>
|
|
91
|
+
No matches
|
|
92
|
+
</li>
|
|
93
|
+
)}
|
|
94
|
+
</ul>
|
|
95
|
+
</ScrollArea.Viewport>
|
|
96
|
+
</ScrollArea.Root>
|
|
97
|
+
</Picker.Root>
|
|
98
|
+
<Column.Center classNames='text-sm text-description'>
|
|
99
|
+
Picked: <span className='font-mono'>{picked ?? '—'}</span>
|
|
100
|
+
</Column.Center>
|
|
101
|
+
</Column.Root>
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const meta = {
|
|
106
|
+
title: 'ui/react-ui-list/Picker',
|
|
107
|
+
render: (args) => <DefaultStory {...args} />,
|
|
108
|
+
decorators: [withTheme()],
|
|
109
|
+
parameters: {
|
|
110
|
+
layout: 'centered',
|
|
111
|
+
},
|
|
112
|
+
} satisfies Meta<StoryArgs>;
|
|
113
|
+
|
|
114
|
+
export default meta;
|
|
115
|
+
|
|
116
|
+
type Story = StoryObj<StoryArgs>;
|
|
117
|
+
|
|
118
|
+
export const Default: Story = {};
|
|
119
|
+
|
|
120
|
+
export const Filtering: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
controlled: true,
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const WithDisabled: Story = {
|
|
127
|
+
args: {
|
|
128
|
+
items: allItems.slice(0, 8),
|
|
129
|
+
disabledIndices: [2, 5],
|
|
130
|
+
},
|
|
131
|
+
};
|