@orcestr/ui 0.0.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/README.md +151 -0
- package/README.ru.md +151 -0
- package/assets/orcestr-banner.webp +0 -0
- package/dist/components/Action/ActionConfirmModal.d.ts +8 -0
- package/dist/components/Action/ActionConfirmModal.d.ts.map +1 -0
- package/dist/components/Action/ActionConfirmModal.js +13 -0
- package/dist/components/Action/ActionTypes.d.ts +47 -0
- package/dist/components/Action/ActionTypes.d.ts.map +1 -0
- package/dist/components/Action/ActionTypes.js +49 -0
- package/dist/components/ActionMenu/ActionMenu.d.ts +3 -0
- package/dist/components/ActionMenu/ActionMenu.d.ts.map +1 -0
- package/dist/components/ActionMenu/ActionMenu.js +1 -0
- package/dist/components/Alert/Alert.d.ts +11 -0
- package/dist/components/Alert/Alert.d.ts.map +1 -0
- package/dist/components/Alert/Alert.js +7 -0
- package/dist/components/AppShell/AppShell.d.ts +102 -0
- package/dist/components/AppShell/AppShell.d.ts.map +1 -0
- package/dist/components/AppShell/AppShell.js +96 -0
- package/dist/components/Badge/Badge.d.ts +15 -0
- package/dist/components/Badge/Badge.d.ts.map +1 -0
- package/dist/components/Badge/Badge.js +8 -0
- package/dist/components/Box/Box.d.ts +11 -0
- package/dist/components/Box/Box.d.ts.map +1 -0
- package/dist/components/Box/Box.js +8 -0
- package/dist/components/Button/Button.d.ts +27 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +13 -0
- package/dist/components/Checkbox/Checkbox.d.ts +10 -0
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox/Checkbox.js +15 -0
- package/dist/components/Collapse/Collapse.d.ts +11 -0
- package/dist/components/Collapse/Collapse.d.ts.map +1 -0
- package/dist/components/Collapse/Collapse.js +33 -0
- package/dist/components/Combobox/Combobox.d.ts +17 -0
- package/dist/components/Combobox/Combobox.d.ts.map +1 -0
- package/dist/components/Combobox/Combobox.js +32 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts +21 -0
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette/CommandPalette.js +168 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +25 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -0
- package/dist/components/ConfirmDialog/ConfirmDialog.js +25 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +11 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.js +68 -0
- package/dist/components/DataTable/DataTable.d.ts +88 -0
- package/dist/components/DataTable/DataTable.d.ts.map +1 -0
- package/dist/components/DataTable/DataTable.js +415 -0
- package/dist/components/DataTable/DataTableStateAdapters.d.ts +41 -0
- package/dist/components/DataTable/DataTableStateAdapters.d.ts.map +1 -0
- package/dist/components/DataTable/DataTableStateAdapters.js +192 -0
- package/dist/components/DatePicker/DatePicker.d.ts +21 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.js +39 -0
- package/dist/components/DatePicker/DatePickerState.d.ts +30 -0
- package/dist/components/DatePicker/DatePickerState.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePickerState.js +106 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +19 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts.map +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +6 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPicker.d.ts +10 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPicker.d.ts.map +1 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPicker.js +26 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPickerState.d.ts +4 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPickerState.d.ts.map +1 -0
- package/dist/components/DateRangePresetPicker/DateRangePresetPickerState.js +20 -0
- package/dist/components/Dialog/Dialog.d.ts +2 -0
- package/dist/components/Dialog/Dialog.d.ts.map +1 -0
- package/dist/components/Dialog/Dialog.js +1 -0
- package/dist/components/Drawer/Drawer.d.ts +30 -0
- package/dist/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.js +83 -0
- package/dist/components/EntityPicker/EntityPicker.d.ts +41 -0
- package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -0
- package/dist/components/EntityPicker/EntityPicker.js +17 -0
- package/dist/components/Field/Field.d.ts +12 -0
- package/dist/components/Field/Field.d.ts.map +1 -0
- package/dist/components/Field/Field.js +8 -0
- package/dist/components/Flex/Flex.d.ts +9 -0
- package/dist/components/Flex/Flex.d.ts.map +1 -0
- package/dist/components/Flex/Flex.js +8 -0
- package/dist/components/Grid/Grid.d.ts +11 -0
- package/dist/components/Grid/Grid.d.ts.map +1 -0
- package/dist/components/Grid/Grid.js +12 -0
- package/dist/components/Highlight/Highlight.d.ts +27 -0
- package/dist/components/Highlight/Highlight.d.ts.map +1 -0
- package/dist/components/Highlight/Highlight.js +26 -0
- package/dist/components/IconButton/IconButton.d.ts +25 -0
- package/dist/components/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.js +13 -0
- package/dist/components/IconText/IconText.d.ts +12 -0
- package/dist/components/IconText/IconText.d.ts.map +1 -0
- package/dist/components/IconText/IconText.js +7 -0
- package/dist/components/Listbox/Listbox.d.ts +13 -0
- package/dist/components/Listbox/Listbox.d.ts.map +1 -0
- package/dist/components/Listbox/Listbox.js +74 -0
- package/dist/components/Menu/Menu.d.ts +14 -0
- package/dist/components/Menu/Menu.d.ts.map +1 -0
- package/dist/components/Menu/Menu.js +168 -0
- package/dist/components/Modal/Modal.d.ts +29 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +155 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts +21 -0
- package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -0
- package/dist/components/MultiSelect/MultiSelect.js +139 -0
- package/dist/components/NumberField/NumberField.d.ts +4 -0
- package/dist/components/NumberField/NumberField.d.ts.map +1 -0
- package/dist/components/NumberField/NumberField.js +6 -0
- package/dist/components/Overlay/OverlayProvider.d.ts +19 -0
- package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -0
- package/dist/components/Overlay/OverlayProvider.js +73 -0
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +48 -0
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -0
- package/dist/components/PaginatedCombobox/PaginatedCombobox.js +223 -0
- package/dist/components/PaginatedCombobox/PaginatedComboboxReactQueryAdapter.d.ts +13 -0
- package/dist/components/PaginatedCombobox/PaginatedComboboxReactQueryAdapter.d.ts.map +1 -0
- package/dist/components/PaginatedCombobox/PaginatedComboboxReactQueryAdapter.js +10 -0
- package/dist/components/Pagination/Pagination.d.ts +7 -0
- package/dist/components/Pagination/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination/Pagination.js +9 -0
- package/dist/components/Popover/Popover.d.ts +19 -0
- package/dist/components/Popover/Popover.d.ts.map +1 -0
- package/dist/components/Popover/Popover.js +83 -0
- package/dist/components/Portal/Portal.d.ts +6 -0
- package/dist/components/Portal/Portal.d.ts.map +1 -0
- package/dist/components/Portal/Portal.js +23 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +14 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.js +6 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +36 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.js +124 -0
- package/dist/components/Section/Section.d.ts +14 -0
- package/dist/components/Section/Section.d.ts.map +1 -0
- package/dist/components/Section/Section.js +20 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +13 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +6 -0
- package/dist/components/Select/Select.d.ts +27 -0
- package/dist/components/Select/Select.d.ts.map +1 -0
- package/dist/components/Select/Select.js +142 -0
- package/dist/components/Separator/Separator.d.ts +6 -0
- package/dist/components/Separator/Separator.d.ts.map +1 -0
- package/dist/components/Separator/Separator.js +5 -0
- package/dist/components/Skeleton/Skeleton.d.ts +9 -0
- package/dist/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/Skeleton/Skeleton.js +8 -0
- package/dist/components/Spinner/Spinner.d.ts +7 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +5 -0
- package/dist/components/Stack/Stack.d.ts +9 -0
- package/dist/components/Stack/Stack.d.ts.map +1 -0
- package/dist/components/Stack/Stack.js +7 -0
- package/dist/components/State/State.d.ts +23 -0
- package/dist/components/State/State.d.ts.map +1 -0
- package/dist/components/State/State.js +30 -0
- package/dist/components/State/stateIcon.d.ts +3 -0
- package/dist/components/State/stateIcon.d.ts.map +1 -0
- package/dist/components/State/stateIcon.js +11 -0
- package/dist/components/StepperInput/StepperInput.d.ts +13 -0
- package/dist/components/StepperInput/StepperInput.d.ts.map +1 -0
- package/dist/components/StepperInput/StepperInput.js +22 -0
- package/dist/components/Switch/Switch.d.ts +10 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -0
- package/dist/components/Switch/Switch.js +14 -0
- package/dist/components/Tabs/Tabs.d.ts +18 -0
- package/dist/components/Tabs/Tabs.d.ts.map +1 -0
- package/dist/components/Tabs/Tabs.js +104 -0
- package/dist/components/Text/Text.d.ts +13 -0
- package/dist/components/Text/Text.d.ts.map +1 -0
- package/dist/components/Text/Text.js +8 -0
- package/dist/components/TextArea/TextArea.d.ts +15 -0
- package/dist/components/TextArea/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea/TextArea.js +17 -0
- package/dist/components/TextField/TextField.d.ts +25 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -0
- package/dist/components/TextField/TextField.js +31 -0
- package/dist/components/Toast/Toast.d.ts +43 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.js +205 -0
- package/dist/components/Tooltip/Tooltip.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -0
- package/dist/components/Tooltip/Tooltip.js +24 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts +8 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -0
- package/dist/components/VisuallyHidden/VisuallyHidden.js +6 -0
- package/dist/components/Workflow/Workflow.d.ts +82 -0
- package/dist/components/Workflow/Workflow.d.ts.map +1 -0
- package/dist/components/Workflow/Workflow.js +73 -0
- package/dist/example/CodePreview.d.ts +25 -0
- package/dist/example/CodePreview.d.ts.map +1 -0
- package/dist/example/CodePreview.js +93 -0
- package/dist/example/ExampleActionsSection.d.ts +10 -0
- package/dist/example/ExampleActionsSection.d.ts.map +1 -0
- package/dist/example/ExampleActionsSection.js +10 -0
- package/dist/example/ExampleBasicsSections.d.ts +8 -0
- package/dist/example/ExampleBasicsSections.d.ts.map +1 -0
- package/dist/example/ExampleBasicsSections.js +43 -0
- package/dist/example/ExampleDataSection.d.ts +7 -0
- package/dist/example/ExampleDataSection.d.ts.map +1 -0
- package/dist/example/ExampleDataSection.js +124 -0
- package/dist/example/ExampleFieldsSection.d.ts +17 -0
- package/dist/example/ExampleFieldsSection.d.ts.map +1 -0
- package/dist/example/ExampleFieldsSection.js +10 -0
- package/dist/example/ExampleFoundationsSection.d.ts +5 -0
- package/dist/example/ExampleFoundationsSection.d.ts.map +1 -0
- package/dist/example/ExampleFoundationsSection.js +25 -0
- package/dist/example/ExampleOverlays.d.ts +30 -0
- package/dist/example/ExampleOverlays.d.ts.map +1 -0
- package/dist/example/ExampleOverlays.js +12 -0
- package/dist/example/ExampleOverlaysSection.d.ts +14 -0
- package/dist/example/ExampleOverlaysSection.d.ts.map +1 -0
- package/dist/example/ExampleOverlaysSection.js +126 -0
- package/dist/example/ExampleSelectionSection.d.ts +30 -0
- package/dist/example/ExampleSelectionSection.d.ts.map +1 -0
- package/dist/example/ExampleSelectionSection.js +66 -0
- package/dist/example/ExampleStateSection.d.ts +8 -0
- package/dist/example/ExampleStateSection.d.ts.map +1 -0
- package/dist/example/ExampleStateSection.js +76 -0
- package/dist/example/ExampleThemePlayground.d.ts +417 -0
- package/dist/example/ExampleThemePlayground.d.ts.map +1 -0
- package/dist/example/ExampleThemePlayground.js +596 -0
- package/dist/example/UiExamplePage.d.ts +2 -0
- package/dist/example/UiExamplePage.d.ts.map +1 -0
- package/dist/example/UiExamplePage.js +315 -0
- package/dist/example/UiExampleSection.d.ts +8 -0
- package/dist/example/UiExampleSection.d.ts.map +1 -0
- package/dist/example/UiExampleSection.js +5 -0
- package/dist/example/codeSamples.d.ts +30 -0
- package/dist/example/codeSamples.d.ts.map +1 -0
- package/dist/example/codeSamples.js +976 -0
- package/dist/example/exampleData.d.ts +33 -0
- package/dist/example/exampleData.d.ts.map +1 -0
- package/dist/example/exampleData.js +217 -0
- package/dist/example/styles.css +1106 -0
- package/dist/hooks/useControllableState.d.ts +6 -0
- package/dist/hooks/useControllableState.d.ts.map +1 -0
- package/dist/hooks/useControllableState.js +16 -0
- package/dist/hooks/useDisclosure.d.ts +12 -0
- package/dist/hooks/useDisclosure.d.ts.map +1 -0
- package/dist/hooks/useDisclosure.js +14 -0
- package/dist/hooks/useEscapeKey.d.ts +2 -0
- package/dist/hooks/useEscapeKey.d.ts.map +1 -0
- package/dist/hooks/useEscapeKey.js +15 -0
- package/dist/hooks/useFloatingLayer.d.ts +19 -0
- package/dist/hooks/useFloatingLayer.d.ts.map +1 -0
- package/dist/hooks/useFloatingLayer.js +26 -0
- package/dist/hooks/useFloatingPosition.d.ts +17 -0
- package/dist/hooks/useFloatingPosition.d.ts.map +1 -0
- package/dist/hooks/useFloatingPosition.js +132 -0
- package/dist/hooks/useFocusTrap.d.ts +3 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/hooks/useFocusTrap.js +54 -0
- package/dist/hooks/useListNavigation.d.ts +17 -0
- package/dist/hooks/useListNavigation.d.ts.map +1 -0
- package/dist/hooks/useListNavigation.js +44 -0
- package/dist/hooks/useOutsidePointerDown.d.ts +3 -0
- package/dist/hooks/useOutsidePointerDown.d.ts.map +1 -0
- package/dist/hooks/useOutsidePointerDown.js +20 -0
- package/dist/hooks/usePresence.d.ts +5 -0
- package/dist/hooks/usePresence.d.ts.map +1 -0
- package/dist/hooks/usePresence.js +35 -0
- package/dist/hooks/useTypeahead.d.ts +2 -0
- package/dist/hooks/useTypeahead.d.ts.map +1 -0
- package/dist/hooks/useTypeahead.js +23 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/locale/LocaleProvider.d.ts +89 -0
- package/dist/locale/LocaleProvider.d.ts.map +1 -0
- package/dist/locale/LocaleProvider.js +174 -0
- package/dist/provider/OrcestrUiProvider.d.ts +28 -0
- package/dist/provider/OrcestrUiProvider.d.ts.map +1 -0
- package/dist/provider/OrcestrUiProvider.js +9 -0
- package/dist/react-query.d.ts +2 -0
- package/dist/react-query.d.ts.map +1 -0
- package/dist/react-query.js +1 -0
- package/dist/styles/orcestr-ui.css +4676 -0
- package/dist/theme/ThemeProvider.d.ts +3 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -0
- package/dist/theme/ThemeProvider.js +280 -0
- package/dist/theme/defaultTheme.d.ts +12 -0
- package/dist/theme/defaultTheme.d.ts.map +1 -0
- package/dist/theme/defaultTheme.js +516 -0
- package/dist/theme/systemProps.d.ts +53 -0
- package/dist/theme/systemProps.d.ts.map +1 -0
- package/dist/theme/systemProps.js +240 -0
- package/dist/theme/themeTypes.d.ts +197 -0
- package/dist/theme/themeTypes.d.ts.map +1 -0
- package/dist/theme/themeTypes.js +1 -0
- package/dist/theme/useTheme.d.ts +4 -0
- package/dist/theme/useTheme.d.ts.map +1 -0
- package/dist/theme/useTheme.js +10 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +3 -0
- package/dist/utils/composeRefs.d.ts +3 -0
- package/dist/utils/composeRefs.d.ts.map +1 -0
- package/dist/utils/composeRefs.js +14 -0
- package/dist/utils/mergeProps.d.ts +4 -0
- package/dist/utils/mergeProps.d.ts.map +1 -0
- package/dist/utils/mergeProps.js +26 -0
- package/dist/utils/ownerDocument.d.ts +2 -0
- package/dist/utils/ownerDocument.d.ts.map +1 -0
- package/dist/utils/ownerDocument.js +3 -0
- package/dist/utils/polymorphic.d.ts +6 -0
- package/dist/utils/polymorphic.d.ts.map +1 -0
- package/dist/utils/polymorphic.js +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { UiSize } from '../../theme/systemProps';
|
|
3
|
+
import { type PaginatedResult } from '../PaginatedCombobox/PaginatedCombobox';
|
|
4
|
+
export type EntityPickerCreateAction = {
|
|
5
|
+
label?: string | ((search: string) => string);
|
|
6
|
+
onCreate: (search: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type EntityPickerOptionAction<T> = {
|
|
10
|
+
label: (item: T) => string;
|
|
11
|
+
icon: ReactNode;
|
|
12
|
+
onClick: (item: T, close?: () => void) => void;
|
|
13
|
+
disabled?: (item: T) => boolean;
|
|
14
|
+
};
|
|
15
|
+
export type EntityPickerProps<T> = {
|
|
16
|
+
loadPage: (page: number, search: string) => Promise<PaginatedResult<T>>;
|
|
17
|
+
getEntityId: (item: T) => string | number;
|
|
18
|
+
renderEntity: (item: T) => ReactNode;
|
|
19
|
+
value: T | null;
|
|
20
|
+
onValueChange: (item: T | null) => void;
|
|
21
|
+
renderValue?: (item: T) => ReactNode;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
emptyText?: ReactNode;
|
|
24
|
+
loadingText?: ReactNode;
|
|
25
|
+
errorText?: ReactNode;
|
|
26
|
+
retryLabel?: ReactNode;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
clearable?: boolean;
|
|
29
|
+
showChevron?: boolean;
|
|
30
|
+
size?: UiSize;
|
|
31
|
+
maxHeight?: number;
|
|
32
|
+
closeOnSelect?: boolean;
|
|
33
|
+
isEntitySelected?: (item: T) => boolean;
|
|
34
|
+
createAction?: EntityPickerCreateAction;
|
|
35
|
+
optionAction?: EntityPickerOptionAction<T>;
|
|
36
|
+
resetKey?: unknown;
|
|
37
|
+
debounceMs?: number;
|
|
38
|
+
testId?: string;
|
|
39
|
+
};
|
|
40
|
+
export declare function EntityPicker<T>({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled, clearable, showChevron, size, maxHeight, closeOnSelect, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }: EntityPickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
//# sourceMappingURL=EntityPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPicker.d.ts","sourceRoot":"","sources":["../../../src/components/EntityPicker/EntityPicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGH,KAAK,eAAe,EACvB,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACtC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IAC/B,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;IAC1C,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;IACrC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAChB,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,CAAC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IACxC,YAAY,CAAC,EAAE,wBAAwB,CAAC;IACxC,YAAY,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC5B,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,WAAW,EACX,KAAK,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAgB,EAChB,SAAgB,EAChB,WAAkB,EAClB,IAAQ,EACR,SAAe,EACf,aAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CA8CtB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
4
|
+
import { PaginatedCombobox, } from '../PaginatedCombobox/PaginatedCombobox';
|
|
5
|
+
export function EntityPicker({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled = false, clearable = true, showChevron = true, size = 3, maxHeight = 280, closeOnSelect = true, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }) {
|
|
6
|
+
const { copy } = useOrcestrUiLocale();
|
|
7
|
+
const searchAction = createAction
|
|
8
|
+
? {
|
|
9
|
+
label: typeof createAction.label === 'string'
|
|
10
|
+
? createAction.label
|
|
11
|
+
: createAction.label ?? copy.common.selectEntity,
|
|
12
|
+
disabled: createAction.disabled,
|
|
13
|
+
onClick: (search) => createAction.onCreate(search),
|
|
14
|
+
}
|
|
15
|
+
: undefined;
|
|
16
|
+
return (_jsx(PaginatedCombobox, { loadPage: loadPage, getItemId: getEntityId, renderOption: (item) => (_jsx("div", { className: 'oui-entity-picker-option', children: renderEntity(item) })), renderSelectedLabel: (item) => (_jsx("span", { className: 'oui-entity-picker-value', children: renderValue?.(item) ?? renderEntity(item) })), value: value, onChange: onValueChange, placeholder: placeholder ?? copy.common.selectEntity, emptyText: emptyText ?? copy.common.noOptions, loadingText: loadingText, errorText: errorText, retryLabel: retryLabel, disabled: disabled, clearable: clearable, showChevron: showChevron, size: size, maxHeight: maxHeight, closeOnSelect: closeOnSelect, isItemSelected: isEntitySelected, searchAction: searchAction, optionAction: optionAction, resetKey: resetKey, debounceMs: debounceMs, testId: testId }));
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare function Field({ label, helperText, error, required, htmlFor, children, className, testId, }: {
|
|
3
|
+
label?: ReactNode;
|
|
4
|
+
helperText?: ReactNode;
|
|
5
|
+
error?: ReactNode;
|
|
6
|
+
required?: boolean;
|
|
7
|
+
htmlFor?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
testId?: string;
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=Field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/components/Field/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAK5C,wBAAgB,KAAK,CAAC,EAClB,KAAK,EACL,UAAU,EACV,KAAK,EACL,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,MAAM,GACT,EAAE;IACC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAsBA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { Text } from '../Text/Text';
|
|
5
|
+
export function Field({ label, helperText, error, required, htmlFor, children, className, testId, }) {
|
|
6
|
+
const helperId = useId();
|
|
7
|
+
return (_jsxs("div", { className: cn('oui-field', className), "data-testid": testId, children: [label ? (_jsxs("label", { className: 'oui-field-label', htmlFor: htmlFor, children: [label, required ? _jsx("span", { className: 'oui-field-required', children: "*" }) : null] })) : null, children, error ? (_jsx(Text, { id: helperId, className: 'oui-field-error', fs: '12px', children: error })) : helperText ? (_jsx(Text, { id: helperId, className: 'oui-field-helper', fs: '12px', children: helperText })) : null] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
3
|
+
export type FlexProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
4
|
+
testId?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const Flex: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
7
|
+
testId?: string;
|
|
8
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=Flex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,SAAS,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACnD,WAAW,GAAG;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,IAAI;aAHA,MAAM;kDAiBrB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { splitSystemProps } from '../../theme/systemProps';
|
|
5
|
+
export const Flex = forwardRef(function Flex({ className, style, testId, ...props }, ref) {
|
|
6
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
7
|
+
return (_jsx("div", { ref: ref, className: cn('oui-flex', className), "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps }));
|
|
8
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
3
|
+
export type GridProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
4
|
+
columns?: string;
|
|
5
|
+
testId?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const Grid: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
8
|
+
columns?: string;
|
|
9
|
+
testId?: string;
|
|
10
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
//# sourceMappingURL=Grid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAGhE,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,SAAS,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACnD,WAAW,GAAG;IACV,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,IAAI;cAJC,MAAM;aACP,MAAM;kDAqBrB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { splitSystemProps } from '../../theme/systemProps';
|
|
5
|
+
export const Grid = forwardRef(function Grid({ className, style, columns, testId, ...props }, ref) {
|
|
6
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
7
|
+
return (_jsx("div", { ref: ref, className: cn('oui-grid', className), "data-testid": testId, style: {
|
|
8
|
+
gridTemplateColumns: columns,
|
|
9
|
+
...systemStyle,
|
|
10
|
+
...style,
|
|
11
|
+
}, ...restProps }));
|
|
12
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
3
|
+
export type HighlightProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
4
|
+
h?: number | string;
|
|
5
|
+
color?: string;
|
|
6
|
+
visible?: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const TopHighlight: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
10
|
+
h?: number | string;
|
|
11
|
+
color?: string;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
testId?: string;
|
|
14
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const BottomHighlight: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
16
|
+
h?: number | string;
|
|
17
|
+
color?: string;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
testId?: string;
|
|
20
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
21
|
+
export declare const DownHighlight: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
22
|
+
h?: number | string;
|
|
23
|
+
color?: string;
|
|
24
|
+
visible?: boolean;
|
|
25
|
+
testId?: string;
|
|
26
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
27
|
+
//# sourceMappingURL=Highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Highlight.d.ts","sourceRoot":"","sources":["../../../src/components/Highlight/Highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,wBAAwB,EAAqB,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAG3E,MAAM,MAAM,cAAc,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACxD,WAAW,GAAG;IACV,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAON,eAAO,MAAM,YAAY;QAXb,MAAM,GAAG,MAAM;YACX,MAAM;cACJ,OAAO;aACR,MAAM;kDAsBtB,CAAC;AAEF,eAAO,MAAM,eAAe;QA3BhB,MAAM,GAAG,MAAM;YACX,MAAM;cACJ,OAAO;aACR,MAAM;kDAsCtB,CAAC;AAEF,eAAO,MAAM,aAAa;QA3Cd,MAAM,GAAG,MAAM;YACX,MAAM;cACJ,OAAO;aACR,MAAM;kDAwCqB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { splitSystemProps } from '../../theme/systemProps';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
export const TopHighlight = forwardRef(function TopHighlight({ className, style, h = 32, color, visible, ...props }, ref) {
|
|
6
|
+
return (_jsx(Highlight, { ref: ref, className: cn('oui-highlight-top', className), h: h, color: color, visible: visible, style: style, ...props }));
|
|
7
|
+
});
|
|
8
|
+
export const BottomHighlight = forwardRef(function BottomHighlight({ className, style, h = 32, color, visible, ...props }, ref) {
|
|
9
|
+
return (_jsx(Highlight, { ref: ref, className: cn('oui-highlight-bottom', className), h: h, color: color, visible: visible, style: style, ...props }));
|
|
10
|
+
});
|
|
11
|
+
export const DownHighlight = BottomHighlight;
|
|
12
|
+
const Highlight = forwardRef(function Highlight({ className, style, h = 32, color, visible = true, testId, ...props }, ref) {
|
|
13
|
+
if (!visible)
|
|
14
|
+
return null;
|
|
15
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
16
|
+
const highlightStyle = {
|
|
17
|
+
...systemStyle,
|
|
18
|
+
...style,
|
|
19
|
+
'--oui-highlight-height': highlightHeight(h),
|
|
20
|
+
...(color ? { '--oui-highlight-color': color } : null),
|
|
21
|
+
};
|
|
22
|
+
return (_jsx("div", { ref: ref, "aria-hidden": 'true', className: cn('oui-highlight', className), "data-testid": testId, style: highlightStyle, ...restProps }));
|
|
23
|
+
});
|
|
24
|
+
function highlightHeight(value) {
|
|
25
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type SystemProps, type Tone, type UiSize } from '../../theme/systemProps';
|
|
3
|
+
import type { ButtonPressAnimation } from '../../theme/themeTypes';
|
|
4
|
+
import type { ButtonVariant } from '../Button/Button';
|
|
5
|
+
export type IconButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'children'> & SystemProps & {
|
|
6
|
+
size?: UiSize;
|
|
7
|
+
v?: ButtonVariant;
|
|
8
|
+
tone?: Tone;
|
|
9
|
+
icon: ReactNode;
|
|
10
|
+
loading?: boolean;
|
|
11
|
+
round?: boolean;
|
|
12
|
+
pressAnimation?: ButtonPressAnimation;
|
|
13
|
+
testId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & SystemProps & {
|
|
16
|
+
size?: UiSize;
|
|
17
|
+
v?: ButtonVariant;
|
|
18
|
+
tone?: Tone;
|
|
19
|
+
icon: ReactNode;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
round?: boolean;
|
|
22
|
+
pressAnimation?: ButtonPressAnimation;
|
|
23
|
+
testId?: string;
|
|
24
|
+
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
25
|
+
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,oBAAoB,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAGxF,OAAO,EAEH,KAAK,WAAW,EAChB,KAAK,IAAI,EACT,KAAK,MAAM,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAGpD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,GACnF,WAAW,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,aAAa,CAAC;IAClB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,UAAU;WAVR,MAAM;QACT,aAAa;WACV,IAAI;UACL,SAAS;cACL,OAAO;YACT,OAAO;qBACE,oBAAoB;aAC5B,MAAM;qDA+CtB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useContext } from 'react';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { splitSystemProps, } from '../../theme/systemProps';
|
|
6
|
+
import { OrcestrThemeContext } from '../../theme/useTheme';
|
|
7
|
+
import { Spinner } from '../Spinner/Spinner';
|
|
8
|
+
export const IconButton = forwardRef(function IconButton({ className, style, size = 3, v = 'soft', tone = 'neutral', loading = false, round = true, pressAnimation, testId, icon, disabled, type = 'button', ...props }, ref) {
|
|
9
|
+
const themeContext = useContext(OrcestrThemeContext);
|
|
10
|
+
const actualPressAnimation = pressAnimation ?? themeContext?.theme.motion.pressAnimation ?? 'soft';
|
|
11
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
12
|
+
return (_jsx("button", { ref: ref, type: type, className: cn('oui-icon-button', className), "data-size": size, "data-variant": v, "data-tone": tone, "data-round": round ? 'true' : undefined, "data-press-animation": actualPressAnimation, "data-loading": loading ? 'true' : undefined, "data-testid": testId, "aria-busy": loading ? 'true' : undefined, disabled: disabled || loading, style: { ...systemStyle, ...style }, ...restProps, children: loading ? _jsx(Spinner, { size: 1 }) : icon }));
|
|
13
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { Tone } from '../../theme/systemProps';
|
|
3
|
+
import { type TextProps } from '../Text/Text';
|
|
4
|
+
export type IconTextProps = TextProps & {
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
iconTone?: Tone | 'muted';
|
|
7
|
+
iconColor?: CSSProperties['color'];
|
|
8
|
+
iconClassName?: string;
|
|
9
|
+
iconSpin?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare function IconText({ icon, iconTone, iconColor, iconClassName, iconSpin, className, children, ...props }: IconTextProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=IconText.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconText.d.ts","sourceRoot":"","sources":["../../../src/components/IconText/IconText.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,aAAa,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,yBAAyB,CAAC;AAElD,OAAO,EAAO,KAAK,SAAS,EAAC,MAAM,cAAc,CAAC;AAElD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACpC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC;IAC1B,SAAS,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACX,EAAE,aAAa,2CAgBf"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
import { Text } from '../Text/Text';
|
|
5
|
+
export function IconText({ icon, iconTone, iconColor, iconClassName, iconSpin, className, children, ...props }) {
|
|
6
|
+
return (_jsxs(Text, { className: cn('oui-icon-text', className), ...props, children: [icon ? (_jsx("span", { className: cn('oui-icon-text-icon', iconClassName), "data-spin": iconSpin ? 'true' : undefined, "data-tone": iconTone, style: iconColor ? { '--oui-icon-text-icon-color': iconColor } : undefined, children: icon })) : null, children] }));
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ListboxItem = {
|
|
2
|
+
value: string;
|
|
3
|
+
label: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function Listbox({ items, value, onValueChange, className, testId, }: {
|
|
7
|
+
items: ReadonlyArray<ListboxItem>;
|
|
8
|
+
value?: string | null;
|
|
9
|
+
onValueChange: (value: string) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
testId?: string;
|
|
12
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=Listbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Listbox.d.ts","sourceRoot":"","sources":["../../../src/components/Listbox/Listbox.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,OAAO,CAAC,EACpB,KAAK,EACL,KAAK,EACL,aAAa,EACb,SAAS,EACT,MAAM,GACT,EAAE;IACC,KAAK,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CA2GA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
4
|
+
import { useListNavigation } from '../../hooks/useListNavigation';
|
|
5
|
+
import { useTypeahead } from '../../hooks/useTypeahead';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
export function Listbox({ items, value, onValueChange, className, testId, }) {
|
|
8
|
+
const listboxRef = useRef(null);
|
|
9
|
+
const navigationItems = useMemo(() => items.map((item) => ({
|
|
10
|
+
value: item.value,
|
|
11
|
+
disabled: item.disabled,
|
|
12
|
+
searchText: item.label,
|
|
13
|
+
})), [items]);
|
|
14
|
+
const navigation = useListNavigation(navigationItems, { value });
|
|
15
|
+
const highlighted = navigation.highlightedValue;
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (highlighted === null)
|
|
18
|
+
return;
|
|
19
|
+
const node = listboxRef.current?.querySelector(`[data-oui-listbox-value="${cssAttr(highlighted)}"]`);
|
|
20
|
+
node?.scrollIntoView({ block: 'nearest' });
|
|
21
|
+
}, [highlighted]);
|
|
22
|
+
const commit = useCallback((next) => {
|
|
23
|
+
if (next !== null)
|
|
24
|
+
onValueChange(next);
|
|
25
|
+
}, [onValueChange]);
|
|
26
|
+
const handleTypeahead = useTypeahead((query) => {
|
|
27
|
+
const match = navigation.enabledItems.find((item) => item.searchText?.toLowerCase().startsWith(query));
|
|
28
|
+
if (match)
|
|
29
|
+
navigation.setHighlightedValue(match.value);
|
|
30
|
+
});
|
|
31
|
+
const handleKeyDown = useCallback((event) => {
|
|
32
|
+
switch (event.key) {
|
|
33
|
+
case 'ArrowDown':
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
navigation.move(1);
|
|
36
|
+
break;
|
|
37
|
+
case 'ArrowUp':
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
navigation.move(-1);
|
|
40
|
+
break;
|
|
41
|
+
case 'Home':
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
navigation.first();
|
|
44
|
+
break;
|
|
45
|
+
case 'End':
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
navigation.last();
|
|
48
|
+
break;
|
|
49
|
+
case 'Enter':
|
|
50
|
+
case ' ':
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
commit(highlighted);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
if (event.key.length === 1 && !event.metaKey && !event.ctrlKey) {
|
|
56
|
+
handleTypeahead(event.key);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [commit, handleTypeahead, highlighted, navigation]);
|
|
60
|
+
return (_jsx("div", { ref: listboxRef, className: cn('oui-listbox', className), role: 'listbox', tabIndex: 0, "data-testid": testId, onKeyDown: handleKeyDown, children: items.map((item) => {
|
|
61
|
+
const isSelected = value === item.value;
|
|
62
|
+
const isHighlighted = highlighted === item.value;
|
|
63
|
+
return (_jsx("button", { type: 'button', role: 'option', "aria-selected": isSelected, className: 'oui-listbox-item', "data-oui-listbox-value": item.value, "data-selected": isSelected ? 'true' : undefined, "data-highlighted": isHighlighted ? 'true' : undefined, "data-testid": testId ? `${testId}-${item.value}` : undefined, disabled: item.disabled, tabIndex: -1, onMouseEnter: () => {
|
|
64
|
+
if (!item.disabled)
|
|
65
|
+
navigation.setHighlightedValue(item.value);
|
|
66
|
+
}, onClick: () => {
|
|
67
|
+
if (!item.disabled)
|
|
68
|
+
commit(item.value);
|
|
69
|
+
}, children: item.label }, item.value));
|
|
70
|
+
}) }));
|
|
71
|
+
}
|
|
72
|
+
function cssAttr(value) {
|
|
73
|
+
return value.replace(/"/g, '\\"');
|
|
74
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type OrcestrActionItem } from '../Action/ActionTypes';
|
|
3
|
+
import { type PopoverProps } from '../Popover/Popover';
|
|
4
|
+
export type MenuItem = OrcestrActionItem;
|
|
5
|
+
export declare function Menu({ trigger, items, className, align, side, sideOffset, testId, }: {
|
|
6
|
+
trigger: ReactNode;
|
|
7
|
+
items: ReadonlyArray<MenuItem>;
|
|
8
|
+
className?: string;
|
|
9
|
+
align?: PopoverProps['align'];
|
|
10
|
+
side?: PopoverProps['side'];
|
|
11
|
+
sideOffset?: number;
|
|
12
|
+
testId?: string;
|
|
13
|
+
}): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
14
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAOH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAQf,OAAO,EAGH,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAU,KAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAI9D,MAAM,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AAEzC,wBAAgB,IAAI,CAAC,EACjB,OAAO,EACP,KAAK,EACL,SAAS,EACT,KAAa,EACb,IAAe,EACf,UAAc,EACd,MAAM,GACT,EAAE;IACC,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2UA6CA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import { LuChevronRight, LuInfo } from 'react-icons/lu';
|
|
5
|
+
import { useListNavigation } from '../../hooks/useListNavigation';
|
|
6
|
+
import { usePresence } from '../../hooks/usePresence';
|
|
7
|
+
import { useTypeahead } from '../../hooks/useTypeahead';
|
|
8
|
+
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
9
|
+
import { cn } from '../../utils/cn';
|
|
10
|
+
import { actionItemText, isActionItemDisabled, } from '../Action/ActionTypes';
|
|
11
|
+
import { ActionConfirmModal } from '../Action/ActionConfirmModal';
|
|
12
|
+
import { Popover } from '../Popover/Popover';
|
|
13
|
+
import { Spinner } from '../Spinner/Spinner';
|
|
14
|
+
import { Tooltip } from '../Tooltip/Tooltip';
|
|
15
|
+
export function Menu({ trigger, items, className, align = 'end', side = 'bottom', sideOffset = 6, testId, }) {
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const [confirmItem, setConfirmItem] = useState(null);
|
|
18
|
+
const inlineState = useInlineSubmenus();
|
|
19
|
+
const reserveIconSpace = useMemo(() => menuHasIcons(items), [items]);
|
|
20
|
+
if (items.length === 0)
|
|
21
|
+
return trigger;
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(Popover, { open: open, onOpenChange: (next) => {
|
|
23
|
+
setOpen(next);
|
|
24
|
+
if (!next)
|
|
25
|
+
inlineState.reset();
|
|
26
|
+
}, trigger: trigger, className: cn('oui-menu oui-action-menu-content', className), align: align, side: side, sideOffset: sideOffset, collisionPadding: 12, testId: testId, children: _jsx(MenuList, { items: items, reserveIconSpace: reserveIconSpace, inlineState: inlineState, close: () => setOpen(false), requestConfirmation: setConfirmItem, autoFocus: true, testId: testId ? `${testId}-list` : undefined }) }), _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
|
|
27
|
+
confirmItem?.onSelect?.();
|
|
28
|
+
setConfirmItem(null);
|
|
29
|
+
} })] }));
|
|
30
|
+
}
|
|
31
|
+
function MenuList({ items, reserveIconSpace, inlineState, close, requestConfirmation, autoFocus = false, testId, }) {
|
|
32
|
+
const listRef = useRef(null);
|
|
33
|
+
const navigationItems = useMemo(() => items.map((item) => ({
|
|
34
|
+
value: item.key,
|
|
35
|
+
disabled: isActionItemDisabled(item),
|
|
36
|
+
searchText: menuItemText(item),
|
|
37
|
+
})), [items]);
|
|
38
|
+
const navigation = useListNavigation(navigationItems);
|
|
39
|
+
const highlightedKey = navigation.highlightedValue;
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (autoFocus)
|
|
42
|
+
listRef.current?.focus();
|
|
43
|
+
}, [autoFocus]);
|
|
44
|
+
const selectHighlighted = useCallback(() => {
|
|
45
|
+
if (highlightedKey === null)
|
|
46
|
+
return;
|
|
47
|
+
const item = items.find((candidate) => candidate.key === highlightedKey);
|
|
48
|
+
if (!item || isActionItemDisabled(item))
|
|
49
|
+
return;
|
|
50
|
+
if (item.children?.length) {
|
|
51
|
+
inlineState.toggle(item.key);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (item.confirm) {
|
|
55
|
+
close();
|
|
56
|
+
requestConfirmation(item);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
item.onSelect?.();
|
|
60
|
+
close();
|
|
61
|
+
}, [close, highlightedKey, inlineState, items, requestConfirmation]);
|
|
62
|
+
const handleTypeahead = useTypeahead((query) => {
|
|
63
|
+
const match = navigation.enabledItems.find((item) => item.searchText?.toLowerCase().startsWith(query));
|
|
64
|
+
if (match)
|
|
65
|
+
navigation.setHighlightedValue(match.value);
|
|
66
|
+
});
|
|
67
|
+
const handleKeyDown = useCallback((event) => {
|
|
68
|
+
switch (event.key) {
|
|
69
|
+
case 'ArrowDown':
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
navigation.move(1);
|
|
72
|
+
break;
|
|
73
|
+
case 'ArrowUp':
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
navigation.move(-1);
|
|
76
|
+
break;
|
|
77
|
+
case 'Home':
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
navigation.first();
|
|
80
|
+
break;
|
|
81
|
+
case 'End':
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
navigation.last();
|
|
84
|
+
break;
|
|
85
|
+
case 'Enter':
|
|
86
|
+
case ' ':
|
|
87
|
+
event.preventDefault();
|
|
88
|
+
selectHighlighted();
|
|
89
|
+
break;
|
|
90
|
+
case 'Escape':
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
close();
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
if (event.key.length === 1 && !event.metaKey && !event.ctrlKey) {
|
|
96
|
+
handleTypeahead(event.key);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [close, handleTypeahead, navigation, selectHighlighted]);
|
|
100
|
+
return (_jsx("div", { ref: listRef, className: 'oui-menu-list', role: 'menu', tabIndex: 0, "data-testid": testId, onKeyDown: handleKeyDown, children: items.map((item) => (_jsx(MenuRow, { item: item, reserveIconSpace: reserveIconSpace, inlineState: inlineState, close: close, requestConfirmation: requestConfirmation, highlighted: highlightedKey === item.key, setHighlighted: () => navigation.setHighlightedValue(item.key), testId: testId ? `${testId}-${item.key}` : undefined }, item.key))) }));
|
|
101
|
+
}
|
|
102
|
+
function MenuRow({ item, reserveIconSpace, inlineState, close, requestConfirmation, highlighted, setHighlighted, testId, }) {
|
|
103
|
+
const [hoverOpen, setHoverOpen] = useState(false);
|
|
104
|
+
const hasChildren = Boolean(item.children?.length);
|
|
105
|
+
const inlineOpen = inlineState.openSubmenus.has(item.key);
|
|
106
|
+
const submenuPresence = usePresence(hoverOpen, 180);
|
|
107
|
+
return (_jsxs("div", { className: 'oui-menu-row', onMouseEnter: () => {
|
|
108
|
+
setHighlighted();
|
|
109
|
+
setHoverOpen(true);
|
|
110
|
+
}, onMouseLeave: () => setHoverOpen(false), children: [item.separatorBefore ? _jsx("div", { className: 'oui-menu-separator' }) : null, _jsxs("button", { type: 'button', className: 'oui-menu-item oui-combobox-option', "data-tone": item.tone, "data-selected": 'false', "data-highlighted": highlighted ? 'true' : undefined, "data-submenu-state": inlineOpen || hoverOpen ? 'open' : 'closed', "data-loading": item.loading ? 'true' : undefined, "data-testid": testId, "aria-busy": item.loading ? 'true' : undefined, disabled: isActionItemDisabled(item), tabIndex: -1, onClick: (event) => {
|
|
111
|
+
event.stopPropagation();
|
|
112
|
+
if (isActionItemDisabled(item))
|
|
113
|
+
return;
|
|
114
|
+
if (hasChildren) {
|
|
115
|
+
inlineState.toggle(item.key);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (item.confirm) {
|
|
119
|
+
close();
|
|
120
|
+
requestConfirmation(item);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
item.onSelect?.();
|
|
124
|
+
close();
|
|
125
|
+
}, role: 'menuitem', children: [_jsx(MenuItemContent, { item: item, reserveIconSpace: reserveIconSpace }), hasChildren ? (_jsx(LuChevronRight, { className: 'oui-menu-sub-chevron', size: 15, "aria-hidden": true })) : null] }), hasChildren && item.children ? (inlineState.inlineSubmenus ? (_jsx("div", { className: 'oui-menu-inline-subitems', "data-state": inlineOpen ? 'open' : 'closed', children: inlineOpen ? (_jsx(MenuList, { items: item.children, reserveIconSpace: menuHasIcons(item.children), inlineState: inlineState, close: close, requestConfirmation: requestConfirmation, autoFocus: false, testId: testId ? `${testId}-subitems` : undefined })) : null })) : submenuPresence.present ? (_jsx("div", { className: 'oui-menu-subcontent oui-popover-content', "data-state": submenuPresence.state, "data-testid": testId ? `${testId}-subcontent` : undefined, children: _jsx(MenuList, { items: item.children, reserveIconSpace: menuHasIcons(item.children), inlineState: inlineState, close: close, requestConfirmation: requestConfirmation, autoFocus: false, testId: testId ? `${testId}-subitems` : undefined }) })) : null) : null] }));
|
|
126
|
+
}
|
|
127
|
+
function MenuItemContent({ item, reserveIconSpace, }) {
|
|
128
|
+
const { copy } = useOrcestrUiLocale();
|
|
129
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: 'oui-menu-item-main', children: [item.icon || item.loading || reserveIconSpace ? (_jsx("span", { className: 'oui-menu-icon', "aria-hidden": !item.icon && !item.loading, children: item.loading ? _jsx(Spinner, { size: 1 }) : item.icon })) : null, _jsx("span", { className: 'oui-menu-label', children: item.label }), item.description ? (_jsx("span", { className: 'oui-menu-description', children: item.description })) : null] }), item.shortcut ? (_jsx("span", { className: 'oui-menu-shortcut', children: item.shortcut })) : null, item.info ? (_jsx(Tooltip, { content: item.info, children: _jsx("span", { className: 'oui-menu-info', "aria-label": copy.common.details, onPointerDown: (event) => {
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
event.stopPropagation();
|
|
132
|
+
}, onClick: (event) => {
|
|
133
|
+
event.preventDefault();
|
|
134
|
+
event.stopPropagation();
|
|
135
|
+
}, children: _jsx(LuInfo, { size: 14 }) }) })) : null] }));
|
|
136
|
+
}
|
|
137
|
+
function useInlineSubmenus() {
|
|
138
|
+
const [inlineSubmenus, setInlineSubmenus] = useState(false);
|
|
139
|
+
const [openSubmenus, setOpenSubmenus] = useState(() => new Set());
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
const media = window.matchMedia('(max-width: 640px), (pointer: coarse)');
|
|
142
|
+
const update = () => setInlineSubmenus(media.matches);
|
|
143
|
+
update();
|
|
144
|
+
media.addEventListener('change', update);
|
|
145
|
+
return () => media.removeEventListener('change', update);
|
|
146
|
+
}, []);
|
|
147
|
+
return {
|
|
148
|
+
inlineSubmenus,
|
|
149
|
+
openSubmenus,
|
|
150
|
+
toggle: (key) => {
|
|
151
|
+
setOpenSubmenus((current) => {
|
|
152
|
+
const next = new Set(current);
|
|
153
|
+
if (next.has(key))
|
|
154
|
+
next.delete(key);
|
|
155
|
+
else
|
|
156
|
+
next.add(key);
|
|
157
|
+
return next;
|
|
158
|
+
});
|
|
159
|
+
},
|
|
160
|
+
reset: () => setOpenSubmenus(new Set()),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function menuHasIcons(items) {
|
|
164
|
+
return items.some((item) => item.icon || (item.children && menuHasIcons(item.children)));
|
|
165
|
+
}
|
|
166
|
+
function menuItemText(item) {
|
|
167
|
+
return actionItemText(item.label);
|
|
168
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import type { ModalAnimation } from '../../theme/themeTypes';
|
|
3
|
+
export type ModalProps = {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onOpenChange: (open: boolean) => void;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
description?: ReactNode;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
footer?: ReactNode;
|
|
10
|
+
maxWidth?: number | string;
|
|
11
|
+
minHeight?: number | string;
|
|
12
|
+
overlayColor?: string;
|
|
13
|
+
overlayOpacity?: number;
|
|
14
|
+
overlayBlur?: number | string;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
radius?: number | string;
|
|
17
|
+
shadow?: string;
|
|
18
|
+
animationDuration?: number | string;
|
|
19
|
+
animation?: ModalAnimation;
|
|
20
|
+
overlayClassName?: string;
|
|
21
|
+
overlayStyle?: CSSProperties;
|
|
22
|
+
className?: string;
|
|
23
|
+
contentClassName?: string;
|
|
24
|
+
bodyClassName?: string;
|
|
25
|
+
closeOnOverlayClick?: boolean;
|
|
26
|
+
testId?: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function Modal({ open, onOpenChange, title, description, children, footer, maxWidth, minHeight, overlayColor, overlayOpacity, overlayBlur, borderColor, radius, shadow, animationDuration, animation, overlayClassName, overlayStyle, className, contentClassName, bodyClassName, closeOnOverlayClick, testId, }: ModalProps): import("react/jsx-runtime").JSX.Element | null;
|
|
29
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/Modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAOf,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAU3D,MAAM,MAAM,UAAU,GAAG;IACrB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,KAAK,CAAC,EAClB,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,mBAA0B,EAC1B,MAAM,GACT,EAAE,UAAU,kDAiKZ"}
|