@12-apps/ui 1.5.0 → 1.5.2
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/package.json +17 -9
- package/src/button/index.ts +1 -0
- package/src/social-login-button/index.ts +1 -0
- package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
- package/src/user-avatar/index.ts +1 -0
- package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
- package/eslint.config.js +0 -89
- package/src/__tests__/data-grid.test.tsx +0 -125
- package/src/__tests__/package-wiring.test.ts +0 -41
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/social-login-button.test.tsx +0 -186
- package/src/__tests__/user-avatar.test.tsx +0 -195
- package/src/__tests__/viewport.test.ts +0 -50
- package/src/components/command/__tests__/command.test.tsx +0 -112
- package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
- package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
- package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
- package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
- package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
- package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
- package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
- package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
- package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
- package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
- package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
- package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
- package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
- package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
- package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
- package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
- package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
- package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
- package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
- package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
- package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
- package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
- package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
- package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
- package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
- package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
- package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
- package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
- package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
- package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
- package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
- package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
- package/src/components/data-display/Table/Table.stories.tsx +0 -803
- package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
- package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
- package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
- package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
- package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
- package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
- package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
- package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
- package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
- package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
- package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
- package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
- package/src/components/form/Button/Button.stories.tsx +0 -365
- package/src/components/form/Button/Button.test.stories.tsx +0 -607
- package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
- package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
- package/src/components/form/CepField/CepField.stories.tsx +0 -138
- package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
- package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
- package/src/components/form/Command/Command.stories.tsx +0 -580
- package/src/components/form/Command/Command.test.stories.tsx +0 -215
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
- package/src/components/form/Form/Form.stories.tsx +0 -687
- package/src/components/form/Form/Form.test.stories.tsx +0 -601
- package/src/components/form/Input/Input.stories.tsx +0 -260
- package/src/components/form/Input/Input.test.stories.tsx +0 -1191
- package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
- package/src/components/form/Label/Label.stories.tsx +0 -473
- package/src/components/form/Label/Label.test.stories.tsx +0 -915
- package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
- package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
- package/src/components/form/Select/Select.stories.tsx +0 -364
- package/src/components/form/Select/Select.test.stories.tsx +0 -985
- package/src/components/form/Slider/Slider.stories.tsx +0 -418
- package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
- package/src/components/form/Switch/Switch.stories.tsx +0 -697
- package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
- package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
- package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
- package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
- package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
- package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
- package/src/components/form/total-form/total-form.test.tsx +0 -214
- package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
- package/src/components/layout/Card/Card.stories.tsx +0 -591
- package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
- package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
- package/src/components/layout/Container/Container.stories.tsx +0 -557
- package/src/components/layout/Container/Container.test.stories.tsx +0 -745
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
- package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
- package/src/components/layout/Separator/Separator.stories.tsx +0 -563
- package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
- package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
- package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
- package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
- package/src/components/typography/Code/Code.stories.tsx +0 -686
- package/src/components/typography/Code/Code.test.stories.tsx +0 -703
- package/src/components/typography/Heading/Heading.stories.tsx +0 -451
- package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
- package/src/components/typography/Text/Text.stories.tsx +0 -359
- package/src/components/typography/Text/Text.test.stories.tsx +0 -759
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
- package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
- package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
- package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
- package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
- package/src/components/utility/Portal/Portal.stories.tsx +0 -340
- package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
- package/src/components/utility/Transition/Transition.stories.tsx +0 -493
- package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
- /package/src/{button.tsx → button/button.tsx} +0 -0
|
@@ -1,715 +0,0 @@
|
|
|
1
|
-
import { CssBaseline } from '@mui/material';
|
|
2
|
-
import { createTheme,ThemeProvider } from '@mui/material/styles';
|
|
3
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
4
|
-
import { useState } from 'react';
|
|
5
|
-
|
|
6
|
-
import { Autocomplete } from './Autocomplete';
|
|
7
|
-
import type { AutocompleteProps } from './Autocomplete.types';
|
|
8
|
-
|
|
9
|
-
interface Person {
|
|
10
|
-
id: string;
|
|
11
|
-
name: string;
|
|
12
|
-
email: string;
|
|
13
|
-
department?: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const samplePeople: Person[] = [
|
|
17
|
-
{ id: '1', name: 'John Doe', email: 'john@example.com', department: 'Engineering' },
|
|
18
|
-
{ id: '2', name: 'Jane Smith', email: 'jane@example.com', department: 'Design' },
|
|
19
|
-
{ id: '3', name: 'Bob Johnson', email: 'bob@example.com', department: 'Marketing' },
|
|
20
|
-
{ id: '4', name: 'Alice Brown', email: 'alice@example.com', department: 'Engineering' },
|
|
21
|
-
{ id: '5', name: 'Charlie Wilson', email: 'charlie@example.com', department: 'Sales' },
|
|
22
|
-
{ id: '6', name: 'Diana Davis', email: 'diana@example.com', department: 'HR' },
|
|
23
|
-
{ id: '7', name: 'Edward Miller', email: 'edward@example.com', department: 'Finance' },
|
|
24
|
-
{ id: '8', name: 'Fiona Garcia', email: 'fiona@example.com', department: 'Legal' },
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const fruits = [
|
|
28
|
-
'Apple',
|
|
29
|
-
'Banana',
|
|
30
|
-
'Cherry',
|
|
31
|
-
'Date',
|
|
32
|
-
'Elderberry',
|
|
33
|
-
'Fig',
|
|
34
|
-
'Grape',
|
|
35
|
-
'Honeydew',
|
|
36
|
-
'Kiwi',
|
|
37
|
-
'Lemon',
|
|
38
|
-
];
|
|
39
|
-
const countries = [
|
|
40
|
-
'United States',
|
|
41
|
-
'United Kingdom',
|
|
42
|
-
'Canada',
|
|
43
|
-
'Australia',
|
|
44
|
-
'Germany',
|
|
45
|
-
'France',
|
|
46
|
-
'Japan',
|
|
47
|
-
'Brazil',
|
|
48
|
-
'India',
|
|
49
|
-
'Mexico',
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const meta: Meta<typeof Autocomplete> = {
|
|
53
|
-
title: 'Form/Autocomplete',
|
|
54
|
-
component: Autocomplete,
|
|
55
|
-
tags: ['autodocs', 'component:Autocomplete'],
|
|
56
|
-
parameters: {
|
|
57
|
-
docs: {
|
|
58
|
-
description: {
|
|
59
|
-
component:
|
|
60
|
-
'A comprehensive autocomplete component with ARIA support, keyboard navigation, and multiple selection modes.',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
decorators: [
|
|
65
|
-
(Story) => (
|
|
66
|
-
<ThemeProvider theme={createTheme()}>
|
|
67
|
-
<CssBaseline />
|
|
68
|
-
<div style={{ padding: '20px', minHeight: '400px', backgroundColor: '#f5f5f5' }}>
|
|
69
|
-
<Story />
|
|
70
|
-
</div>
|
|
71
|
-
</ThemeProvider>
|
|
72
|
-
),
|
|
73
|
-
],
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default meta;
|
|
77
|
-
type Story = StoryObj<typeof Autocomplete>;
|
|
78
|
-
|
|
79
|
-
// Required story exports for validation
|
|
80
|
-
export const Default: Story = {
|
|
81
|
-
render: () => <ControlledAutocomplete suggestions={fruits} placeholder="Select a fruit..." />,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Controlled Component Wrapper
|
|
85
|
-
const ControlledAutocomplete = <T = string | Person,>(props: Partial<AutocompleteProps<T>>) => {
|
|
86
|
-
const [value, setValue] = useState(props.value || '');
|
|
87
|
-
const [selectedItems, setSelectedItems] = useState<T[]>((props.selectedItems || []) as T[]);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Autocomplete
|
|
91
|
-
{...props}
|
|
92
|
-
value={value}
|
|
93
|
-
onChange={setValue}
|
|
94
|
-
selectedItems={selectedItems}
|
|
95
|
-
onSelectedItemsChange={setSelectedItems}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
// Basic Stories
|
|
101
|
-
export const BasicUsage: Story = {
|
|
102
|
-
render: () => <ControlledAutocomplete suggestions={fruits} placeholder="Select a fruit..." />,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const WithInitialValue: Story = {
|
|
106
|
-
render: () => (
|
|
107
|
-
<ControlledAutocomplete value="Apple" suggestions={fruits} placeholder="Select a fruit..." />
|
|
108
|
-
),
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
export const ObjectData: Story = {
|
|
112
|
-
render: () => (
|
|
113
|
-
<ControlledAutocomplete
|
|
114
|
-
suggestions={samplePeople}
|
|
115
|
-
getKey={(person: Person) => person.id}
|
|
116
|
-
getLabel={(person: Person) => person.name}
|
|
117
|
-
getDescription={(person: Person) => `${person.email} - ${person.department}`}
|
|
118
|
-
placeholder="Search for a person..."
|
|
119
|
-
/>
|
|
120
|
-
),
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// Visual States
|
|
124
|
-
export const Disabled: Story = {
|
|
125
|
-
render: () => (
|
|
126
|
-
<ControlledAutocomplete
|
|
127
|
-
suggestions={fruits}
|
|
128
|
-
disabled={true}
|
|
129
|
-
value="Cannot edit"
|
|
130
|
-
placeholder="Disabled autocomplete..."
|
|
131
|
-
/>
|
|
132
|
-
),
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
export const Loading: Story = {
|
|
136
|
-
render: () => (
|
|
137
|
-
<ControlledAutocomplete
|
|
138
|
-
suggestions={[]}
|
|
139
|
-
async={true}
|
|
140
|
-
isLoading={true}
|
|
141
|
-
placeholder="Loading suggestions..."
|
|
142
|
-
/>
|
|
143
|
-
),
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
export const EmptyState: Story = {
|
|
147
|
-
render: () => (
|
|
148
|
-
<ControlledAutocomplete suggestions={[]} value="xyz" placeholder="No matching results..." />
|
|
149
|
-
),
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// Feature Demonstrations
|
|
153
|
-
export const WithGhostText: Story = {
|
|
154
|
-
render: () => (
|
|
155
|
-
<ControlledAutocomplete
|
|
156
|
-
suggestions={countries}
|
|
157
|
-
showGhostText={true}
|
|
158
|
-
placeholder="Type 'Uni' to see ghost text..."
|
|
159
|
-
/>
|
|
160
|
-
),
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const MultipleSelectionMode: Story = {
|
|
164
|
-
render: () => (
|
|
165
|
-
<ControlledAutocomplete
|
|
166
|
-
suggestions={fruits}
|
|
167
|
-
multiple={true}
|
|
168
|
-
selectedItems={['Apple', 'Banana']}
|
|
169
|
-
placeholder="Select multiple fruits..."
|
|
170
|
-
/>
|
|
171
|
-
),
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const AsyncModeComponent = () => {
|
|
175
|
-
const [loading, setLoading] = useState(false);
|
|
176
|
-
const [suggestions, setSuggestions] = useState<string[]>([]);
|
|
177
|
-
const [value, setValue] = useState('');
|
|
178
|
-
|
|
179
|
-
const handleChange = (newValue: string) => {
|
|
180
|
-
setValue(newValue);
|
|
181
|
-
if (newValue) {
|
|
182
|
-
setLoading(true);
|
|
183
|
-
// Simulate API call
|
|
184
|
-
window.setTimeout(() => {
|
|
185
|
-
setSuggestions(fruits.filter((f) => f.toLowerCase().includes(newValue.toLowerCase())));
|
|
186
|
-
setLoading(false);
|
|
187
|
-
}, 500);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
return (
|
|
192
|
-
<Autocomplete
|
|
193
|
-
value={value}
|
|
194
|
-
onChange={handleChange}
|
|
195
|
-
suggestions={suggestions}
|
|
196
|
-
async={true}
|
|
197
|
-
isLoading={loading}
|
|
198
|
-
placeholder="Type to search (async)..."
|
|
199
|
-
/>
|
|
200
|
-
);
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
export const AsyncMode: Story = {
|
|
204
|
-
render: () => <AsyncModeComponent />,
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
export const CustomRenderer: Story = {
|
|
208
|
-
render: () => (
|
|
209
|
-
<ControlledAutocomplete
|
|
210
|
-
suggestions={samplePeople}
|
|
211
|
-
getKey={(person: Person) => person.id}
|
|
212
|
-
getLabel={(person: Person) => person.name}
|
|
213
|
-
renderSuggestion={(person: Person, state) => (
|
|
214
|
-
<div
|
|
215
|
-
style={{
|
|
216
|
-
padding: '8px',
|
|
217
|
-
backgroundColor: state.active ? '#e3f2fd' : 'transparent',
|
|
218
|
-
borderRadius: '4px',
|
|
219
|
-
}}
|
|
220
|
-
>
|
|
221
|
-
<div style={{ fontWeight: 'bold', color: '#1976d2' }}>{person.name}</div>
|
|
222
|
-
<div style={{ fontSize: '0.875rem', color: '#666' }}>{person.email}</div>
|
|
223
|
-
<div style={{ fontSize: '0.75rem', color: '#999' }}>{person.department}</div>
|
|
224
|
-
</div>
|
|
225
|
-
)}
|
|
226
|
-
placeholder="Custom rendered items..."
|
|
227
|
-
/>
|
|
228
|
-
),
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
// Typed suggestions: search fills the input, link opens a URL (Google-style)
|
|
232
|
-
interface QuickSearchItem {
|
|
233
|
-
id: string;
|
|
234
|
-
text: string;
|
|
235
|
-
type: 'search' | 'link';
|
|
236
|
-
url?: string;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const quickSearchItems: QuickSearchItem[] = [
|
|
240
|
-
{ id: '1', text: 'Produtos', type: 'search' },
|
|
241
|
-
{ id: '2', text: 'Pedidos', type: 'search' },
|
|
242
|
-
{ id: '3', text: 'Estoque', type: 'search' },
|
|
243
|
-
{ id: '4', text: 'Abrir Storybook', type: 'link', url: 'https://storybook.js.org' },
|
|
244
|
-
{ id: '5', text: 'Documentação do Next.js', type: 'link', url: 'https://nextjs.org/docs' },
|
|
245
|
-
];
|
|
246
|
-
|
|
247
|
-
const SearchAndLinkComponent = () => {
|
|
248
|
-
const [value, setValue] = useState('');
|
|
249
|
-
return (
|
|
250
|
-
<Autocomplete<QuickSearchItem>
|
|
251
|
-
value={value}
|
|
252
|
-
onChange={setValue}
|
|
253
|
-
suggestions={quickSearchItems}
|
|
254
|
-
getKey={(item) => item.id}
|
|
255
|
-
getLabel={(item) => item.text}
|
|
256
|
-
getSuggestionType={(item) => item.type}
|
|
257
|
-
getUrl={(item) => item.url}
|
|
258
|
-
placeholder="Search pages, or open a link..."
|
|
259
|
-
/>
|
|
260
|
-
);
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
export const SearchAndLinkSuggestions: Story = {
|
|
264
|
-
render: () => <SearchAndLinkComponent />,
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
// Match Modes
|
|
268
|
-
export const StartsWithMatching: Story = {
|
|
269
|
-
render: () => (
|
|
270
|
-
<ControlledAutocomplete
|
|
271
|
-
suggestions={countries}
|
|
272
|
-
matchMode="startsWith"
|
|
273
|
-
placeholder="Type 'U' to match countries starting with U..."
|
|
274
|
-
/>
|
|
275
|
-
),
|
|
276
|
-
};
|
|
277
|
-
|
|
278
|
-
export const ContainsMatching: Story = {
|
|
279
|
-
render: () => (
|
|
280
|
-
<ControlledAutocomplete
|
|
281
|
-
suggestions={countries}
|
|
282
|
-
matchMode="contains"
|
|
283
|
-
placeholder="Type 'land' to match countries containing 'land'..."
|
|
284
|
-
/>
|
|
285
|
-
),
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
export const FuzzyMatching: Story = {
|
|
289
|
-
render: () => (
|
|
290
|
-
<ControlledAutocomplete
|
|
291
|
-
suggestions={['JavaScript', 'TypeScript', 'CoffeeScript', 'ActionScript', 'PureScript']}
|
|
292
|
-
matchMode="fuzzy"
|
|
293
|
-
placeholder="Type 'jst' for fuzzy match..."
|
|
294
|
-
/>
|
|
295
|
-
),
|
|
296
|
-
};
|
|
297
|
-
|
|
298
|
-
// Configuration Examples
|
|
299
|
-
export const NoFreeText: Story = {
|
|
300
|
-
render: () => (
|
|
301
|
-
<ControlledAutocomplete
|
|
302
|
-
suggestions={fruits}
|
|
303
|
-
allowFreeText={false}
|
|
304
|
-
placeholder="Must select from list..."
|
|
305
|
-
/>
|
|
306
|
-
),
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
export const CustomDebounce: Story = {
|
|
310
|
-
render: () => (
|
|
311
|
-
<ControlledAutocomplete
|
|
312
|
-
suggestions={fruits}
|
|
313
|
-
debounceMs={500}
|
|
314
|
-
placeholder="500ms debounce delay..."
|
|
315
|
-
/>
|
|
316
|
-
),
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
export const LimitedVisibleItems: Story = {
|
|
320
|
-
render: () => (
|
|
321
|
-
<ControlledAutocomplete
|
|
322
|
-
suggestions={Array.from({ length: 100 }, (_, i) => `Item ${i + 1}`)}
|
|
323
|
-
maxVisibleItems={5}
|
|
324
|
-
placeholder="Only shows 5 items at a time..."
|
|
325
|
-
/>
|
|
326
|
-
),
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
// Theme Variations
|
|
330
|
-
export const DarkTheme: Story = {
|
|
331
|
-
decorators: [
|
|
332
|
-
(Story) => (
|
|
333
|
-
<ThemeProvider theme={createTheme({ palette: { mode: 'dark' } })}>
|
|
334
|
-
<CssBaseline />
|
|
335
|
-
<div style={{ padding: '20px', minHeight: '400px', backgroundColor: '#121212' }}>
|
|
336
|
-
<Story />
|
|
337
|
-
</div>
|
|
338
|
-
</ThemeProvider>
|
|
339
|
-
),
|
|
340
|
-
],
|
|
341
|
-
render: () => (
|
|
342
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="Dark theme autocomplete..." />
|
|
343
|
-
),
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
// Responsive Behavior
|
|
347
|
-
export const ResponsiveWidth: Story = {
|
|
348
|
-
render: () => (
|
|
349
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
350
|
-
<div style={{ width: '100%' }}>
|
|
351
|
-
<h4>Full Width</h4>
|
|
352
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="100% width..." />
|
|
353
|
-
</div>
|
|
354
|
-
<div style={{ width: '300px' }}>
|
|
355
|
-
<h4>Fixed 300px</h4>
|
|
356
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="300px width..." />
|
|
357
|
-
</div>
|
|
358
|
-
<div style={{ width: '150px' }}>
|
|
359
|
-
<h4>Narrow 150px</h4>
|
|
360
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="150px..." />
|
|
361
|
-
</div>
|
|
362
|
-
</div>
|
|
363
|
-
),
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
// Complex Use Cases
|
|
367
|
-
const FormIntegrationComponent = () => {
|
|
368
|
-
const [formData, setFormData] = useState({
|
|
369
|
-
name: '',
|
|
370
|
-
country: '',
|
|
371
|
-
fruits: [] as string[],
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
return (
|
|
375
|
-
<form style={{ display: 'flex', flexDirection: 'column', gap: '16px', maxWidth: '400px' }}>
|
|
376
|
-
<div>
|
|
377
|
-
<label htmlFor="name-input">Name:</label>
|
|
378
|
-
<input
|
|
379
|
-
id="name-input"
|
|
380
|
-
type="text"
|
|
381
|
-
value={formData.name}
|
|
382
|
-
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
|
|
383
|
-
style={{ width: '100%', padding: '8px', marginTop: '4px' }}
|
|
384
|
-
/>
|
|
385
|
-
</div>
|
|
386
|
-
|
|
387
|
-
<div>
|
|
388
|
-
<label htmlFor="country-autocomplete">Country:</label>
|
|
389
|
-
<div style={{ marginTop: '4px' }}>
|
|
390
|
-
<ControlledAutocomplete
|
|
391
|
-
id="country-autocomplete"
|
|
392
|
-
suggestions={countries}
|
|
393
|
-
value={formData.country}
|
|
394
|
-
onChange={(value) => setFormData({ ...formData, country: value })}
|
|
395
|
-
placeholder="Select your country..."
|
|
396
|
-
/>
|
|
397
|
-
</div>
|
|
398
|
-
</div>
|
|
399
|
-
|
|
400
|
-
<div>
|
|
401
|
-
<label htmlFor="fruits-autocomplete">Favorite Fruits:</label>
|
|
402
|
-
<div style={{ marginTop: '4px' }}>
|
|
403
|
-
<ControlledAutocomplete
|
|
404
|
-
id="fruits-autocomplete"
|
|
405
|
-
suggestions={fruits}
|
|
406
|
-
multiple={true}
|
|
407
|
-
selectedItems={formData.fruits}
|
|
408
|
-
onSelectedItemsChange={(items) => setFormData({ ...formData, fruits: items })}
|
|
409
|
-
placeholder="Select multiple fruits..."
|
|
410
|
-
/>
|
|
411
|
-
</div>
|
|
412
|
-
</div>
|
|
413
|
-
|
|
414
|
-
<button type="submit" style={{ padding: '8px 16px' }}>
|
|
415
|
-
Submit
|
|
416
|
-
</button>
|
|
417
|
-
|
|
418
|
-
<pre style={{ backgroundColor: '#f5f5f5', padding: '8px', borderRadius: '4px' }}>
|
|
419
|
-
{JSON.stringify(formData, null, 2)}
|
|
420
|
-
</pre>
|
|
421
|
-
</form>
|
|
422
|
-
);
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
export const FormIntegration: Story = {
|
|
426
|
-
render: () => <FormIntegrationComponent />,
|
|
427
|
-
};
|
|
428
|
-
|
|
429
|
-
// Performance Demo
|
|
430
|
-
interface LargeDataItem {
|
|
431
|
-
id: string;
|
|
432
|
-
label: string;
|
|
433
|
-
description: string;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
export const LargeDatasetPerformance: Story = {
|
|
437
|
-
render: () => {
|
|
438
|
-
const largeDataset: LargeDataItem[] = Array.from({ length: 10000 }, (_, i) => ({
|
|
439
|
-
id: `item-${i}`,
|
|
440
|
-
label: `Item ${i + 1}`,
|
|
441
|
-
description: `Description for item ${i + 1}`,
|
|
442
|
-
}));
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<ControlledAutocomplete<LargeDataItem>
|
|
446
|
-
suggestions={largeDataset}
|
|
447
|
-
getKey={(item) => item.id}
|
|
448
|
-
getLabel={(item) => item.label}
|
|
449
|
-
getDescription={(item) => item.description}
|
|
450
|
-
maxVisibleItems={20}
|
|
451
|
-
debounceMs={300}
|
|
452
|
-
placeholder="Search 10,000 items..."
|
|
453
|
-
/>
|
|
454
|
-
);
|
|
455
|
-
},
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
// Required story exports for validation
|
|
459
|
-
export const AllVariants: Story = {
|
|
460
|
-
render: () => (
|
|
461
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '24px' }}>
|
|
462
|
-
<div>
|
|
463
|
-
<h4>Default</h4>
|
|
464
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="Default autocomplete..." />
|
|
465
|
-
</div>
|
|
466
|
-
<div>
|
|
467
|
-
<h4>With Ghost Text</h4>
|
|
468
|
-
<ControlledAutocomplete
|
|
469
|
-
suggestions={countries}
|
|
470
|
-
showGhostText={true}
|
|
471
|
-
placeholder="Type to see ghost text..."
|
|
472
|
-
/>
|
|
473
|
-
</div>
|
|
474
|
-
<div>
|
|
475
|
-
<h4>Multiple Selection</h4>
|
|
476
|
-
<ControlledAutocomplete
|
|
477
|
-
suggestions={fruits}
|
|
478
|
-
multiple={true}
|
|
479
|
-
placeholder="Select multiple items..."
|
|
480
|
-
/>
|
|
481
|
-
</div>
|
|
482
|
-
<div>
|
|
483
|
-
<h4>Custom Renderer</h4>
|
|
484
|
-
<ControlledAutocomplete
|
|
485
|
-
suggestions={samplePeople}
|
|
486
|
-
getKey={(person: Person) => person.id}
|
|
487
|
-
getLabel={(person: Person) => person.name}
|
|
488
|
-
renderSuggestion={(person: Person, state) => (
|
|
489
|
-
<div
|
|
490
|
-
style={{
|
|
491
|
-
padding: '8px',
|
|
492
|
-
backgroundColor: state.active ? '#e3f2fd' : 'transparent',
|
|
493
|
-
}}
|
|
494
|
-
>
|
|
495
|
-
<div style={{ fontWeight: 'bold' }}>{person.name}</div>
|
|
496
|
-
<div style={{ fontSize: '0.875rem' }}>{person.email}</div>
|
|
497
|
-
</div>
|
|
498
|
-
)}
|
|
499
|
-
placeholder="Custom rendered items..."
|
|
500
|
-
/>
|
|
501
|
-
</div>
|
|
502
|
-
<div>
|
|
503
|
-
<h4>Async Mode</h4>
|
|
504
|
-
<AsyncModeComponent />
|
|
505
|
-
</div>
|
|
506
|
-
</div>
|
|
507
|
-
),
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
export const AllSizes: Story = {
|
|
511
|
-
render: () => (
|
|
512
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
513
|
-
<div>
|
|
514
|
-
<h4>Small (Default MUI Input Size)</h4>
|
|
515
|
-
<ControlledAutocomplete
|
|
516
|
-
suggestions={fruits}
|
|
517
|
-
placeholder="Small size..."
|
|
518
|
-
/>
|
|
519
|
-
</div>
|
|
520
|
-
<div>
|
|
521
|
-
<h4>Medium (Default)</h4>
|
|
522
|
-
<ControlledAutocomplete
|
|
523
|
-
suggestions={fruits}
|
|
524
|
-
placeholder="Medium size..."
|
|
525
|
-
/>
|
|
526
|
-
</div>
|
|
527
|
-
<div>
|
|
528
|
-
<h4>Large (Custom styling)</h4>
|
|
529
|
-
<div style={{ fontSize: '1.25rem' }}>
|
|
530
|
-
<ControlledAutocomplete
|
|
531
|
-
suggestions={fruits}
|
|
532
|
-
placeholder="Large size..."
|
|
533
|
-
/>
|
|
534
|
-
</div>
|
|
535
|
-
</div>
|
|
536
|
-
</div>
|
|
537
|
-
),
|
|
538
|
-
};
|
|
539
|
-
|
|
540
|
-
export const AllStates: Story = {
|
|
541
|
-
render: () => (
|
|
542
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
543
|
-
<div>
|
|
544
|
-
<h4>Default</h4>
|
|
545
|
-
<ControlledAutocomplete suggestions={fruits} placeholder="Default state..." />
|
|
546
|
-
</div>
|
|
547
|
-
<div>
|
|
548
|
-
<h4>With Value</h4>
|
|
549
|
-
<ControlledAutocomplete
|
|
550
|
-
value="Apple"
|
|
551
|
-
suggestions={fruits}
|
|
552
|
-
placeholder="Has value..."
|
|
553
|
-
/>
|
|
554
|
-
</div>
|
|
555
|
-
<div>
|
|
556
|
-
<h4>Disabled</h4>
|
|
557
|
-
<ControlledAutocomplete
|
|
558
|
-
suggestions={fruits}
|
|
559
|
-
disabled={true}
|
|
560
|
-
value="Disabled"
|
|
561
|
-
placeholder="Disabled state..."
|
|
562
|
-
/>
|
|
563
|
-
</div>
|
|
564
|
-
<div>
|
|
565
|
-
<h4>Loading</h4>
|
|
566
|
-
<ControlledAutocomplete
|
|
567
|
-
suggestions={[]}
|
|
568
|
-
async={true}
|
|
569
|
-
isLoading={true}
|
|
570
|
-
placeholder="Loading state..."
|
|
571
|
-
/>
|
|
572
|
-
</div>
|
|
573
|
-
<div>
|
|
574
|
-
<h4>Empty Results</h4>
|
|
575
|
-
<ControlledAutocomplete
|
|
576
|
-
suggestions={[]}
|
|
577
|
-
value="xyz"
|
|
578
|
-
placeholder="No results..."
|
|
579
|
-
/>
|
|
580
|
-
</div>
|
|
581
|
-
<div>
|
|
582
|
-
<h4>Multiple Selected</h4>
|
|
583
|
-
<ControlledAutocomplete
|
|
584
|
-
suggestions={fruits}
|
|
585
|
-
multiple={true}
|
|
586
|
-
selectedItems={['Apple', 'Banana', 'Cherry']}
|
|
587
|
-
placeholder="Multiple selected..."
|
|
588
|
-
/>
|
|
589
|
-
</div>
|
|
590
|
-
</div>
|
|
591
|
-
),
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
const InteractiveStatesComponent = () => {
|
|
595
|
-
const [hoverValue, setHoverValue] = useState('');
|
|
596
|
-
const [focusValue, setFocusValue] = useState('');
|
|
597
|
-
const [activeValue, setActiveValue] = useState('');
|
|
598
|
-
|
|
599
|
-
return (
|
|
600
|
-
<div style={{ display: 'flex', flexDirection: 'column', gap: '20px' }}>
|
|
601
|
-
<div>
|
|
602
|
-
<h4>Hover State</h4>
|
|
603
|
-
<div
|
|
604
|
-
onMouseEnter={() => setHoverValue('Hovered')}
|
|
605
|
-
onMouseLeave={() => setHoverValue('')}
|
|
606
|
-
style={{
|
|
607
|
-
border: hoverValue ? '2px solid #1976d2' : 'none',
|
|
608
|
-
padding: '2px',
|
|
609
|
-
borderRadius: '4px'
|
|
610
|
-
}}
|
|
611
|
-
>
|
|
612
|
-
<ControlledAutocomplete
|
|
613
|
-
suggestions={fruits}
|
|
614
|
-
placeholder="Hover over me..."
|
|
615
|
-
value={hoverValue}
|
|
616
|
-
/>
|
|
617
|
-
</div>
|
|
618
|
-
</div>
|
|
619
|
-
<div>
|
|
620
|
-
<h4>Focus State</h4>
|
|
621
|
-
<ControlledAutocomplete
|
|
622
|
-
suggestions={fruits}
|
|
623
|
-
placeholder="Click to focus..."
|
|
624
|
-
value={focusValue}
|
|
625
|
-
onChange={(value) => setFocusValue(value)}
|
|
626
|
-
onFocus={() => setFocusValue('Focused')}
|
|
627
|
-
onBlur={() => setFocusValue('')}
|
|
628
|
-
/>
|
|
629
|
-
</div>
|
|
630
|
-
<div>
|
|
631
|
-
<h4>Active/Typing State</h4>
|
|
632
|
-
<ControlledAutocomplete
|
|
633
|
-
suggestions={fruits}
|
|
634
|
-
placeholder="Start typing..."
|
|
635
|
-
value={activeValue}
|
|
636
|
-
onChange={(value) => setActiveValue(value)}
|
|
637
|
-
/>
|
|
638
|
-
</div>
|
|
639
|
-
<div>
|
|
640
|
-
<h4>Dropdown Open State</h4>
|
|
641
|
-
<ControlledAutocomplete
|
|
642
|
-
suggestions={fruits}
|
|
643
|
-
placeholder="Click to open dropdown..."
|
|
644
|
-
defaultOpen={true}
|
|
645
|
-
/>
|
|
646
|
-
</div>
|
|
647
|
-
</div>
|
|
648
|
-
);
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
export const InteractiveStates: Story = {
|
|
652
|
-
render: () => <InteractiveStatesComponent />,
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
export const Responsive: Story = {
|
|
656
|
-
parameters: {
|
|
657
|
-
viewport: {
|
|
658
|
-
viewports: {
|
|
659
|
-
mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
|
|
660
|
-
tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
|
|
661
|
-
desktop: { name: 'Desktop', styles: { width: '1440px', height: '900px' } },
|
|
662
|
-
},
|
|
663
|
-
},
|
|
664
|
-
},
|
|
665
|
-
render: () => (
|
|
666
|
-
<div style={{ padding: '20px' }}>
|
|
667
|
-
<h3>Responsive Autocomplete</h3>
|
|
668
|
-
<p>Resize the viewport to see responsive behavior</p>
|
|
669
|
-
<div style={{ marginTop: '20px' }}>
|
|
670
|
-
<ControlledAutocomplete
|
|
671
|
-
suggestions={countries}
|
|
672
|
-
placeholder="Responsive autocomplete..."
|
|
673
|
-
/>
|
|
674
|
-
</div>
|
|
675
|
-
<div style={{ marginTop: '20px' }}>
|
|
676
|
-
<h4>In a flex container</h4>
|
|
677
|
-
<div style={{ display: 'flex', gap: '10px', flexWrap: 'wrap' }}>
|
|
678
|
-
<div style={{ flex: '1 1 300px' }}>
|
|
679
|
-
<ControlledAutocomplete
|
|
680
|
-
suggestions={fruits}
|
|
681
|
-
placeholder="Flex item 1..."
|
|
682
|
-
/>
|
|
683
|
-
</div>
|
|
684
|
-
<div style={{ flex: '1 1 300px' }}>
|
|
685
|
-
<ControlledAutocomplete
|
|
686
|
-
suggestions={countries}
|
|
687
|
-
placeholder="Flex item 2..."
|
|
688
|
-
/>
|
|
689
|
-
</div>
|
|
690
|
-
</div>
|
|
691
|
-
</div>
|
|
692
|
-
<div style={{ marginTop: '20px' }}>
|
|
693
|
-
<h4>In a grid container</h4>
|
|
694
|
-
<div style={{
|
|
695
|
-
display: 'grid',
|
|
696
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
|
|
697
|
-
gap: '15px'
|
|
698
|
-
}}>
|
|
699
|
-
<ControlledAutocomplete
|
|
700
|
-
suggestions={fruits}
|
|
701
|
-
placeholder="Grid item 1..."
|
|
702
|
-
/>
|
|
703
|
-
<ControlledAutocomplete
|
|
704
|
-
suggestions={countries}
|
|
705
|
-
placeholder="Grid item 2..."
|
|
706
|
-
/>
|
|
707
|
-
<ControlledAutocomplete
|
|
708
|
-
suggestions={fruits}
|
|
709
|
-
placeholder="Grid item 3..."
|
|
710
|
-
/>
|
|
711
|
-
</div>
|
|
712
|
-
</div>
|
|
713
|
-
</div>
|
|
714
|
-
),
|
|
715
|
-
};
|