@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,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 Text = forwardRef(function Text({ as: Component = 'span', className, style, tone, testId, ...props }, ref) {
|
|
6
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
7
|
+
return (_jsx(Component, { ref: ref, className: cn('oui-text', tone && `oui-text-${tone}`, className), "data-testid": testId, style: { ...systemStyle, ...style }, ...restProps }));
|
|
8
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { type SystemProps, type UiSize } from '../../theme/systemProps';
|
|
3
|
+
export type TextAreaProps = TextareaHTMLAttributes<HTMLTextAreaElement> & SystemProps & {
|
|
4
|
+
size?: UiSize;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
autoResize?: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<TextareaHTMLAttributes<HTMLTextAreaElement> & SystemProps & {
|
|
10
|
+
size?: UiSize;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
autoResize?: boolean;
|
|
13
|
+
testId?: string;
|
|
14
|
+
} & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
15
|
+
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,sBAAsB,EAC9B,MAAM,OAAO,CAAC;AAIf,OAAO,EAEH,KAAK,WAAW,EAChB,KAAK,MAAM,EACd,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,GACnE,WAAW,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,QAAQ;WANN,MAAM;cACH,OAAO;iBACJ,OAAO;aACX,MAAM;uDAwCtB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useLayoutEffect, useRef, } from 'react';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { composeRefs } from '../../utils/composeRefs';
|
|
6
|
+
import { splitSystemProps, } from '../../theme/systemProps';
|
|
7
|
+
export const TextArea = forwardRef(function TextArea({ className, style, size = 2, invalid = false, autoResize = false, value, testId, ...props }, ref) {
|
|
8
|
+
const localRef = useRef(null);
|
|
9
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
10
|
+
useLayoutEffect(() => {
|
|
11
|
+
if (!autoResize || !localRef.current)
|
|
12
|
+
return;
|
|
13
|
+
localRef.current.style.height = 'auto';
|
|
14
|
+
localRef.current.style.height = `${localRef.current.scrollHeight}px`;
|
|
15
|
+
}, [autoResize, value]);
|
|
16
|
+
return (_jsx("textarea", { ref: composeRefs(ref, localRef), className: cn('oui-text-area', className), "data-size": size, "data-invalid": invalid ? 'true' : undefined, "data-testid": testId, "aria-invalid": invalid || undefined, value: value, style: { ...systemStyle, ...style }, ...restProps }));
|
|
17
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type InputHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type SystemProps, type UiSize } from '../../theme/systemProps';
|
|
3
|
+
export type TextFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> & SystemProps & {
|
|
4
|
+
size?: UiSize;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
fullWidth?: boolean;
|
|
7
|
+
leftSlot?: ReactNode;
|
|
8
|
+
rightSlot?: ReactNode;
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
clearLabel?: string;
|
|
12
|
+
testId?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & SystemProps & {
|
|
15
|
+
size?: UiSize;
|
|
16
|
+
invalid?: boolean;
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
leftSlot?: ReactNode;
|
|
19
|
+
rightSlot?: ReactNode;
|
|
20
|
+
clearable?: boolean;
|
|
21
|
+
onClear?: () => void;
|
|
22
|
+
clearLabel?: string;
|
|
23
|
+
testId?: string;
|
|
24
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
25
|
+
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAMf,OAAO,EAEH,KAAK,WAAW,EAChB,KAAK,MAAM,EACd,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,cAAc,GAAG,IAAI,CAC7B,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,CACT,GACG,WAAW,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,SAAS;WAXP,MAAM;cACH,OAAO;gBACL,OAAO;eACR,SAAS;gBACR,SAAS;gBACT,OAAO;cACT,MAAM,IAAI;iBACP,MAAM;aACV,MAAM;oDA4FtB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useId, useRef, useState, } from 'react';
|
|
4
|
+
import { LuX } from 'react-icons/lu';
|
|
5
|
+
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
import { composeRefs } from '../../utils/composeRefs';
|
|
8
|
+
import { splitSystemProps, } from '../../theme/systemProps';
|
|
9
|
+
export const TextField = forwardRef(function TextField({ className, style, size = 3, invalid = false, fullWidth = true, leftSlot, rightSlot, clearable = false, onClear, clearLabel, testId, value, defaultValue, onChange, disabled, id, ...props }, ref) {
|
|
10
|
+
const { copy } = useOrcestrUiLocale();
|
|
11
|
+
const generatedId = useId();
|
|
12
|
+
const inputId = id ?? generatedId;
|
|
13
|
+
const localRef = useRef(null);
|
|
14
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
15
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? '');
|
|
16
|
+
const actualValue = value ?? internalValue;
|
|
17
|
+
const canClear = clearable && !disabled && String(actualValue ?? '').length > 0;
|
|
18
|
+
const handleChange = (event) => {
|
|
19
|
+
if (value === undefined)
|
|
20
|
+
setInternalValue(event.target.value);
|
|
21
|
+
onChange?.(event);
|
|
22
|
+
};
|
|
23
|
+
return (_jsxs("span", { className: cn('oui-text-field', fullWidth && 'oui-text-field-full', className), "data-size": size, "data-invalid": invalid ? 'true' : undefined, "data-disabled": disabled ? 'true' : undefined, style: { ...systemStyle, ...style }, children: [leftSlot ? (_jsx("span", { className: 'oui-text-field-slot', children: leftSlot })) : null, _jsx("input", { ref: composeRefs(ref, localRef), id: inputId, className: 'oui-text-field-input', "data-testid": testId, value: actualValue, onChange: handleChange, disabled: disabled, "aria-invalid": invalid || undefined, ...restProps }), canClear ? (_jsx("button", { type: 'button', className: 'oui-text-field-clear', "aria-label": clearLabel ?? copy.common.clear, onClick: (event) => {
|
|
24
|
+
event.preventDefault();
|
|
25
|
+
event.stopPropagation();
|
|
26
|
+
if (value === undefined)
|
|
27
|
+
setInternalValue('');
|
|
28
|
+
localRef.current?.focus();
|
|
29
|
+
onClear?.();
|
|
30
|
+
}, children: _jsx(LuX, { size: 14 }) })) : null, rightSlot ? (_jsx("span", { className: 'oui-text-field-slot', children: rightSlot })) : null] }));
|
|
31
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export type ToastTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
|
+
export type ToastAction = {
|
|
5
|
+
label: string;
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
closeOnClick?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type ToastOptions = {
|
|
10
|
+
title: ReactNode;
|
|
11
|
+
message?: ReactNode;
|
|
12
|
+
tone?: ToastTone;
|
|
13
|
+
position?: ToastPosition;
|
|
14
|
+
background?: string;
|
|
15
|
+
blur?: number | string | false;
|
|
16
|
+
borderColor?: string;
|
|
17
|
+
shadow?: string;
|
|
18
|
+
progressColor?: string;
|
|
19
|
+
action?: ToastAction;
|
|
20
|
+
duration?: number | null;
|
|
21
|
+
dedupeKey?: string;
|
|
22
|
+
dismissible?: boolean;
|
|
23
|
+
closeButton?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type ToastInput = string | ToastOptions;
|
|
26
|
+
type ToastContextValue = {
|
|
27
|
+
push: (input: ToastInput, tone?: ToastTone) => number;
|
|
28
|
+
success: (input: ToastInput) => number;
|
|
29
|
+
error: (input: ToastInput) => number;
|
|
30
|
+
warning: (input: ToastInput) => number;
|
|
31
|
+
info: (input: ToastInput) => number;
|
|
32
|
+
dismiss: (id: number) => void;
|
|
33
|
+
clear: () => void;
|
|
34
|
+
};
|
|
35
|
+
export declare function ToastProvider({ children, defaultPosition, maxVisible, testId, }: {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
defaultPosition?: ToastPosition;
|
|
38
|
+
maxVisible?: number;
|
|
39
|
+
testId?: string;
|
|
40
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function useToast(): ToastContextValue;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EASH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AASf,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,aAAa,GACnB,UAAU,GACV,YAAY,GACZ,WAAW,GACX,aAAa,GACb,eAAe,GACf,cAAc,CAAC;AAErB,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC;AAU/C,KAAK,iBAAiB,GAAG;IACrB,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM,CAAC;IACtD,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;IACrC,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,KAAK,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAmCF,wBAAgB,aAAa,CAAC,EAC1B,QAAQ,EACR,eAAwC,EACxC,UAA+B,EAC/B,MAAM,GACT,EAAE;IACC,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAoJA;AAED,wBAAgB,QAAQ,sBAMvB"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
|
+
import { LuX } from 'react-icons/lu';
|
|
5
|
+
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
6
|
+
import { Button } from '../Button/Button';
|
|
7
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
8
|
+
import { useOverlayContext } from '../Overlay/OverlayProvider';
|
|
9
|
+
import { Portal } from '../Portal/Portal';
|
|
10
|
+
const ToastContext = createContext(null);
|
|
11
|
+
const DEFAULT_TOAST_DURATION = 4200;
|
|
12
|
+
const MAX_VISIBLE_TOASTS = 4;
|
|
13
|
+
const TOAST_EXIT_FALLBACK_MS = 5000;
|
|
14
|
+
const DEFAULT_TOAST_POSITION = 'bottom-right';
|
|
15
|
+
const toastPositions = [
|
|
16
|
+
'top-left',
|
|
17
|
+
'top-center',
|
|
18
|
+
'top-right',
|
|
19
|
+
'bottom-left',
|
|
20
|
+
'bottom-center',
|
|
21
|
+
'bottom-right',
|
|
22
|
+
];
|
|
23
|
+
function normalizeToast(input, tone, defaultPosition = DEFAULT_TOAST_POSITION) {
|
|
24
|
+
if (typeof input === 'string') {
|
|
25
|
+
return {
|
|
26
|
+
title: input,
|
|
27
|
+
tone: tone ?? 'info',
|
|
28
|
+
position: defaultPosition,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
...input,
|
|
33
|
+
tone: tone ?? input.tone ?? 'info',
|
|
34
|
+
position: input.position ?? defaultPosition,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export function ToastProvider({ children, defaultPosition = DEFAULT_TOAST_POSITION, maxVisible = MAX_VISIBLE_TOASTS, testId, }) {
|
|
38
|
+
const overlay = useOverlayContext();
|
|
39
|
+
const [items, setItems] = useState([]);
|
|
40
|
+
const itemsRef = useRef([]);
|
|
41
|
+
const nextId = useRef(1);
|
|
42
|
+
const timeoutIds = useRef(new Map());
|
|
43
|
+
const removalIds = useRef(new Map());
|
|
44
|
+
const setToastItems = useCallback((update) => {
|
|
45
|
+
setItems((current) => {
|
|
46
|
+
const next = update(current);
|
|
47
|
+
itemsRef.current = next;
|
|
48
|
+
return next;
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
const clearTimer = useCallback((id) => {
|
|
52
|
+
const timeoutId = timeoutIds.current.get(id);
|
|
53
|
+
if (timeoutId !== undefined) {
|
|
54
|
+
window.clearTimeout(timeoutId);
|
|
55
|
+
timeoutIds.current.delete(id);
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
const clearRemovalTimer = useCallback((id) => {
|
|
59
|
+
const timeoutId = removalIds.current.get(id);
|
|
60
|
+
if (timeoutId !== undefined) {
|
|
61
|
+
window.clearTimeout(timeoutId);
|
|
62
|
+
removalIds.current.delete(id);
|
|
63
|
+
}
|
|
64
|
+
}, []);
|
|
65
|
+
const removeToast = useCallback((id) => {
|
|
66
|
+
clearRemovalTimer(id);
|
|
67
|
+
setToastItems((current) => current.filter((item) => item.id !== id));
|
|
68
|
+
}, [clearRemovalTimer, setToastItems]);
|
|
69
|
+
const dismiss = useCallback((id) => {
|
|
70
|
+
clearTimer(id);
|
|
71
|
+
setToastItems((current) => current.map((item) => item.id === id ? { ...item, state: 'closing' } : item));
|
|
72
|
+
clearRemovalTimer(id);
|
|
73
|
+
const removalId = window.setTimeout(() => {
|
|
74
|
+
removeToast(id);
|
|
75
|
+
}, TOAST_EXIT_FALLBACK_MS);
|
|
76
|
+
removalIds.current.set(id, removalId);
|
|
77
|
+
}, [clearRemovalTimer, clearTimer, removeToast, setToastItems]);
|
|
78
|
+
const clear = useCallback(() => {
|
|
79
|
+
timeoutIds.current.forEach((timeoutId) => window.clearTimeout(timeoutId));
|
|
80
|
+
timeoutIds.current.clear();
|
|
81
|
+
removalIds.current.forEach((timeoutId) => window.clearTimeout(timeoutId));
|
|
82
|
+
removalIds.current.clear();
|
|
83
|
+
setToastItems(() => []);
|
|
84
|
+
}, [setToastItems]);
|
|
85
|
+
const scheduleDismiss = useCallback((item) => {
|
|
86
|
+
clearTimer(item.id);
|
|
87
|
+
if (item.duration === null)
|
|
88
|
+
return;
|
|
89
|
+
const duration = item.duration ?? DEFAULT_TOAST_DURATION;
|
|
90
|
+
if (duration <= 0)
|
|
91
|
+
return;
|
|
92
|
+
const timeoutId = window.setTimeout(() => dismiss(item.id), duration);
|
|
93
|
+
timeoutIds.current.set(item.id, timeoutId);
|
|
94
|
+
}, [clearTimer, dismiss]);
|
|
95
|
+
const push = useCallback((input, tone) => {
|
|
96
|
+
const normalized = normalizeToast(input, tone, defaultPosition);
|
|
97
|
+
const existingItem = normalized.dedupeKey
|
|
98
|
+
? itemsRef.current.find((item) => item.dedupeKey === normalized.dedupeKey)
|
|
99
|
+
: null;
|
|
100
|
+
if (existingItem)
|
|
101
|
+
clearRemovalTimer(existingItem.id);
|
|
102
|
+
const item = {
|
|
103
|
+
...normalized,
|
|
104
|
+
id: existingItem?.id ?? nextId.current++,
|
|
105
|
+
createdAt: Date.now(),
|
|
106
|
+
state: 'open',
|
|
107
|
+
};
|
|
108
|
+
setToastItems((current) => {
|
|
109
|
+
const nextItems = existingItem
|
|
110
|
+
? current.map((currentItem) => currentItem.id === existingItem.id ? item : currentItem)
|
|
111
|
+
: [...current, item];
|
|
112
|
+
return limitToastItems(nextItems, maxVisible);
|
|
113
|
+
});
|
|
114
|
+
scheduleDismiss(item);
|
|
115
|
+
return item.id;
|
|
116
|
+
}, [
|
|
117
|
+
clearRemovalTimer,
|
|
118
|
+
defaultPosition,
|
|
119
|
+
maxVisible,
|
|
120
|
+
scheduleDismiss,
|
|
121
|
+
setToastItems,
|
|
122
|
+
]);
|
|
123
|
+
const value = useMemo(() => ({
|
|
124
|
+
push,
|
|
125
|
+
success: (input) => push(input, 'success'),
|
|
126
|
+
error: (input) => push(input, 'danger'),
|
|
127
|
+
warning: (input) => push(input, 'warning'),
|
|
128
|
+
info: (input) => push(input, 'info'),
|
|
129
|
+
dismiss,
|
|
130
|
+
clear,
|
|
131
|
+
}), [clear, dismiss, push]);
|
|
132
|
+
useEffect(() => clear, [clear]);
|
|
133
|
+
return (_jsxs(ToastContext.Provider, { value: value, children: [children, _jsx(Portal, { children: toastPositions.map((position) => {
|
|
134
|
+
const positionItems = items.filter((item) => item.position === position);
|
|
135
|
+
if (positionItems.length === 0)
|
|
136
|
+
return null;
|
|
137
|
+
return (_jsx("div", { className: 'oui-toast-viewport', "data-position": position, "data-testid": testId ? `${testId}-${position}` : undefined, "aria-live": 'polite', "aria-relevant": 'additions text', style: { zIndex: overlay.zIndex.toast }, children: positionItems.map((item) => (_jsx(ToastCard, { item: item, onDismiss: dismiss, onExited: removeToast, testId: testId ? `${testId}-${item.id}` : undefined }, item.id))) }, position));
|
|
138
|
+
}) })] }));
|
|
139
|
+
}
|
|
140
|
+
export function useToast() {
|
|
141
|
+
const context = useContext(ToastContext);
|
|
142
|
+
if (!context) {
|
|
143
|
+
throw new Error('useToast must be used inside ToastProvider');
|
|
144
|
+
}
|
|
145
|
+
return context;
|
|
146
|
+
}
|
|
147
|
+
function ToastCard({ item, onDismiss, onExited, testId, }) {
|
|
148
|
+
const { copy } = useOrcestrUiLocale();
|
|
149
|
+
const duration = toastDuration(item);
|
|
150
|
+
const hasProgress = item.duration !== null && duration > 0;
|
|
151
|
+
const effectiveBlur = item.blur !== undefined ? cssLength(item.blur) : 'var(--oui-toast-blur, 14px)';
|
|
152
|
+
const style = {
|
|
153
|
+
...(item.background ? { '--oui-toast-bg': item.background } : null),
|
|
154
|
+
'--oui-toast-effective-blur': effectiveBlur,
|
|
155
|
+
...(item.borderColor ? { '--oui-toast-custom-border-color': item.borderColor } : null),
|
|
156
|
+
...(item.shadow ? { '--oui-toast-shadow': item.shadow } : null),
|
|
157
|
+
...(item.progressColor ? { '--oui-toast-progress-color': item.progressColor } : null),
|
|
158
|
+
};
|
|
159
|
+
const blurStyle = {
|
|
160
|
+
backdropFilter: `blur(${effectiveBlur})`,
|
|
161
|
+
WebkitBackdropFilter: `blur(${effectiveBlur})`,
|
|
162
|
+
};
|
|
163
|
+
return (_jsxs("div", { className: 'oui-toast-frame', "data-position": item.position, "data-state": item.state, style: style, onAnimationEnd: (event) => {
|
|
164
|
+
if (event.animationName === 'ouiToastOut') {
|
|
165
|
+
onExited(item.id);
|
|
166
|
+
}
|
|
167
|
+
}, children: [_jsx("span", { className: 'oui-toast-backdrop', "aria-hidden": 'true', style: blurStyle }), _jsxs("div", { className: 'oui-toast', "data-tone": item.tone, "data-state": item.state, "data-position": item.position, "data-clickable": item.dismissible === false ? undefined : 'true', "data-testid": testId, role: item.tone === 'danger' ? 'alert' : 'status', style: blurStyle, onClick: () => {
|
|
168
|
+
if (item.dismissible !== false)
|
|
169
|
+
onDismiss(item.id);
|
|
170
|
+
}, children: [_jsxs("div", { className: 'oui-toast-main', children: [_jsx("div", { className: 'oui-toast-title', children: item.title }), item.message ? (_jsx("div", { className: 'oui-toast-message', children: item.message })) : null, item.action ? (_jsx(Button, { className: 'oui-toast-action', size: 1, v: 'surface', tone: item.tone, onClick: (event) => {
|
|
171
|
+
event.stopPropagation();
|
|
172
|
+
item.action?.onClick();
|
|
173
|
+
if (item.action?.closeOnClick !== false) {
|
|
174
|
+
onDismiss(item.id);
|
|
175
|
+
}
|
|
176
|
+
}, children: item.action.label })) : null] }), item.closeButton ? (_jsx(IconButton, { className: 'oui-toast-close', size: 1, v: 'ghost', icon: _jsx(LuX, { size: 14 }), "aria-label": copy.common.dismissNotification, onClick: (event) => {
|
|
177
|
+
event.stopPropagation();
|
|
178
|
+
onDismiss(item.id);
|
|
179
|
+
} })) : null, hasProgress ? (_jsx("span", { className: 'oui-toast-progress', style: { '--oui-toast-duration': `${duration}ms` } }, item.createdAt)) : null] })] }));
|
|
180
|
+
}
|
|
181
|
+
function cssLength(value) {
|
|
182
|
+
if (value === false)
|
|
183
|
+
return '0px';
|
|
184
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
185
|
+
}
|
|
186
|
+
function toastDuration(item) {
|
|
187
|
+
return item.duration ?? DEFAULT_TOAST_DURATION;
|
|
188
|
+
}
|
|
189
|
+
function limitToastItems(items, maxVisible) {
|
|
190
|
+
if (maxVisible <= 0)
|
|
191
|
+
return items;
|
|
192
|
+
const buckets = new Map();
|
|
193
|
+
for (const item of items) {
|
|
194
|
+
const bucket = buckets.get(item.position) ?? [];
|
|
195
|
+
bucket.push(item);
|
|
196
|
+
buckets.set(item.position, bucket);
|
|
197
|
+
}
|
|
198
|
+
const visibleIds = new Set();
|
|
199
|
+
for (const bucket of buckets.values()) {
|
|
200
|
+
for (const item of bucket.slice(-maxVisible)) {
|
|
201
|
+
visibleIds.add(item.id);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return items.filter((item) => visibleIds.has(item.id));
|
|
205
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type FloatingSide } from '../../hooks/useFloatingPosition';
|
|
3
|
+
export declare function Tooltip({ content, children, side, className, testId, }: {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
side?: FloatingSide;
|
|
7
|
+
className?: string;
|
|
8
|
+
testId?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAW,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAC,KAAK,YAAY,EAAC,MAAM,iCAAiC,CAAC;AAMlE,wBAAgB,OAAO,CAAC,EACpB,OAAO,EACP,QAAQ,EACR,IAAY,EACZ,SAAS,EACT,MAAM,GACT,EAAE;IACC,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAmDA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import {} from '../../hooks/useFloatingPosition';
|
|
5
|
+
import { useFloatingLayer } from '../../hooks/useFloatingLayer';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
import { useOverlayContext, useOverlayLayerIndex } from '../Overlay/OverlayProvider';
|
|
8
|
+
import { Portal } from '../Portal/Portal';
|
|
9
|
+
export function Tooltip({ content, children, side = 'top', className, testId, }) {
|
|
10
|
+
const overlay = useOverlayContext();
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const { triggerRef, contentRef, present, state, style, } = useFloatingLayer({
|
|
13
|
+
open,
|
|
14
|
+
presenceDuration: 140,
|
|
15
|
+
side,
|
|
16
|
+
align: 'center',
|
|
17
|
+
sideOffset: 8,
|
|
18
|
+
});
|
|
19
|
+
const layerIndex = useOverlayLayerIndex(present);
|
|
20
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: triggerRef, className: 'oui-tooltip-trigger', "data-testid": testId, onMouseEnter: () => setOpen(true), onMouseLeave: () => setOpen(false), onFocus: () => setOpen(true), onBlur: () => setOpen(false), children: children }), present ? (_jsx(Portal, { children: _jsx("div", { ref: contentRef, role: 'tooltip', className: cn('oui-tooltip-content', className), "data-state": state, "data-layer": 'dropdown', "data-testid": testId ? `${testId}-content` : undefined, style: {
|
|
21
|
+
...style,
|
|
22
|
+
zIndex: overlay.zIndex.dropdown + layerIndex * 10,
|
|
23
|
+
}, children: content }) })) : null] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type VisuallyHiddenProps = ComponentPropsWithoutRef<'span'> & {
|
|
3
|
+
testId?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const VisuallyHidden: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
6
|
+
testId?: string;
|
|
7
|
+
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
8
|
+
//# sourceMappingURL=VisuallyHidden.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../../../src/components/VisuallyHidden/VisuallyHidden.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAIhE,MAAM,MAAM,mBAAmB,GAAG,wBAAwB,CAAC,MAAM,CAAC,GAAG;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,cAAc;aAHd,MAAM;mDAclB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { cn } from '../../utils/cn';
|
|
4
|
+
export const VisuallyHidden = forwardRef(function VisuallyHidden({ className, testId, ...props }, ref) {
|
|
5
|
+
return (_jsx("span", { ref: ref, className: cn('oui-visually-hidden', className), "data-testid": testId, ...props }));
|
|
6
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import type { Tone } from '../../theme/systemProps';
|
|
3
|
+
import type { OrcestrActionItem } from '../Action/ActionTypes';
|
|
4
|
+
export type StatusBadgeProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
tone?: Tone;
|
|
7
|
+
size?: 1 | 2 | 3 | 4;
|
|
8
|
+
testId?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function StatusBadge({ children, tone, size, testId }: StatusBadgeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export type TimelineItem = {
|
|
12
|
+
key: string;
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
meta?: ReactNode;
|
|
16
|
+
tone?: Tone;
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export declare function Timeline({ items, className, testId, ...props }: HTMLAttributes<HTMLOListElement> & {
|
|
20
|
+
items: ReadonlyArray<TimelineItem>;
|
|
21
|
+
testId?: string;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export type WorkflowStepStatus = 'active' | 'blocked' | 'done' | 'error' | 'pending' | 'processing';
|
|
24
|
+
export type PipelineStep = {
|
|
25
|
+
key: string;
|
|
26
|
+
label?: ReactNode;
|
|
27
|
+
title?: ReactNode;
|
|
28
|
+
detail?: ReactNode;
|
|
29
|
+
description?: ReactNode;
|
|
30
|
+
meta?: ReactNode;
|
|
31
|
+
tooltip?: ReactNode;
|
|
32
|
+
disabledReason?: ReactNode;
|
|
33
|
+
status?: WorkflowStepStatus;
|
|
34
|
+
tone?: Tone;
|
|
35
|
+
active?: boolean;
|
|
36
|
+
complete?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
loading?: boolean;
|
|
39
|
+
onSelect?: () => void;
|
|
40
|
+
};
|
|
41
|
+
export declare function Pipeline({ steps, loading, loadingSteps, disabled, className, testId, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
steps?: ReadonlyArray<PipelineStep>;
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
loadingSteps?: number;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
testId?: string;
|
|
47
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
export type WorkflowSummaryBadge = {
|
|
49
|
+
key: string;
|
|
50
|
+
label: ReactNode;
|
|
51
|
+
value?: ReactNode;
|
|
52
|
+
tone?: Tone;
|
|
53
|
+
};
|
|
54
|
+
export declare function WorkflowSummaryBar({ items, className, testId, }: {
|
|
55
|
+
items: ReadonlyArray<WorkflowSummaryBadge>;
|
|
56
|
+
className?: string;
|
|
57
|
+
testId?: string;
|
|
58
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
export type LifecycleBlockReason = {
|
|
60
|
+
key: string;
|
|
61
|
+
title?: ReactNode;
|
|
62
|
+
message: ReactNode;
|
|
63
|
+
tone?: Exclude<Tone, 'brand'>;
|
|
64
|
+
actionLabel?: ReactNode;
|
|
65
|
+
onAction?: () => void;
|
|
66
|
+
};
|
|
67
|
+
export declare function LifecycleBlockReasonCallout({ reason, }: {
|
|
68
|
+
reason: LifecycleBlockReason;
|
|
69
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
70
|
+
export type LifecycleAction = Omit<OrcestrActionItem, 'children' | 'onSelect'> & {
|
|
71
|
+
disabledReason?: ReactNode;
|
|
72
|
+
onSelect: () => void;
|
|
73
|
+
};
|
|
74
|
+
export declare function LifecycleActionPanel({ title, meta, reasons, actions, className, testId, }: {
|
|
75
|
+
title?: ReactNode;
|
|
76
|
+
meta?: ReactNode;
|
|
77
|
+
reasons?: ReadonlyArray<LifecycleBlockReason>;
|
|
78
|
+
actions: ReadonlyArray<LifecycleAction>;
|
|
79
|
+
className?: string;
|
|
80
|
+
testId?: string;
|
|
81
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
82
|
+
//# sourceMappingURL=Workflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Workflow.d.ts","sourceRoot":"","sources":["../../../src/components/Workflow/Workflow.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { LuArrowRight, LuCheck, LuCircleAlert, LuRefreshCw } from 'react-icons/lu';
|
|
4
|
+
import { cn } from '../../utils/cn';
|
|
5
|
+
import { Alert } from '../Alert/Alert';
|
|
6
|
+
import { Badge } from '../Badge/Badge';
|
|
7
|
+
import { Button } from '../Button/Button';
|
|
8
|
+
import { Skeleton } from '../Skeleton/Skeleton';
|
|
9
|
+
import { Tooltip } from '../Tooltip/Tooltip';
|
|
10
|
+
export function StatusBadge({ children, tone = 'neutral', size = 2, testId }) {
|
|
11
|
+
return (_jsx(Badge, { tone: tone, size: size, testId: testId, children: children }));
|
|
12
|
+
}
|
|
13
|
+
export function Timeline({ items, className, testId, ...props }) {
|
|
14
|
+
return (_jsx("ol", { className: cn('oui-timeline', className), "data-testid": testId, ...props, children: items.map((item) => (_jsxs("li", { className: 'oui-timeline-item', "data-tone": item.tone ?? 'neutral', children: [_jsx("span", { className: 'oui-timeline-marker', children: item.icon }), _jsxs("div", { className: 'oui-timeline-content', children: [_jsxs("div", { className: 'oui-timeline-title-row', children: [_jsx("strong", { children: item.title }), item.meta ? _jsx("span", { children: item.meta }) : null] }), item.description ? _jsx("p", { children: item.description }) : null] })] }, item.key))) }));
|
|
15
|
+
}
|
|
16
|
+
export function Pipeline({ steps, loading = false, loadingSteps = 5, disabled = false, className, testId, ...props }) {
|
|
17
|
+
if (loading) {
|
|
18
|
+
return (_jsx("div", { className: cn('oui-pipeline', className), "data-testid": testId, ...props, children: Array.from({ length: loadingSteps }).map((_, index) => (_jsxs("div", { className: 'oui-pipeline-step', "data-loading": 'true', children: [_jsx(Skeleton, { w: 16, h: 16, r: 7 }), _jsxs("span", { className: 'oui-pipeline-step-main', children: [_jsx(Skeleton, { w: '70%', h: 14 }), _jsx(Skeleton, { w: '46%', h: 12 })] })] }, index))) }));
|
|
19
|
+
}
|
|
20
|
+
return (_jsx("div", { className: cn('oui-pipeline', className), "data-testid": testId, ...props, children: (steps ?? []).map((step) => (_jsx(PipelineStepView, { step: step, disabled: disabled }, step.key))) }));
|
|
21
|
+
}
|
|
22
|
+
export function WorkflowSummaryBar({ items, className, testId, }) {
|
|
23
|
+
return (_jsx("div", { className: cn('oui-workflow-summary', className), "data-testid": testId, children: items.map((item) => (_jsxs(StatusBadge, { tone: item.tone ?? 'neutral', children: [item.label, item.value !== undefined ? _jsx("strong", { children: item.value }) : null] }, item.key))) }));
|
|
24
|
+
}
|
|
25
|
+
export function LifecycleBlockReasonCallout({ reason, }) {
|
|
26
|
+
return (_jsx(Alert, { tone: reason.tone ?? 'warning', title: reason.title, icon: _jsx(LuCircleAlert, {}), action: reason.onAction ? (_jsx(Button, { size: 1, v: 'surface', tone: reason.tone ?? 'warning', onClick: reason.onAction, children: reason.actionLabel })) : null, children: reason.message }));
|
|
27
|
+
}
|
|
28
|
+
export function LifecycleActionPanel({ title, meta, reasons = [], actions, className, testId, }) {
|
|
29
|
+
return (_jsxs("div", { className: cn('oui-lifecycle-panel', className), "data-testid": testId, children: [title || meta ? (_jsxs("div", { className: 'oui-lifecycle-panel-head', children: [title ? _jsx("strong", { children: title }) : null, meta ? _jsx("span", { children: meta }) : null] })) : null, reasons.length ? (_jsx("div", { className: 'oui-lifecycle-reasons', children: reasons.map((reason) => (_jsx(LifecycleBlockReasonCallout, { reason: reason }, reason.key))) })) : null, _jsx("div", { className: 'oui-lifecycle-panel-actions', children: actions.map((action) => (_jsx(LifecycleActionButton, { action: action }, action.key))) })] }));
|
|
30
|
+
}
|
|
31
|
+
function PipelineStepView({ step, disabled, }) {
|
|
32
|
+
const status = pipelineStepStatus(step);
|
|
33
|
+
const label = step.label ?? step.title;
|
|
34
|
+
const isDisabled = disabled || step.disabled || !step.onSelect || step.loading;
|
|
35
|
+
const content = (_jsxs("button", { type: 'button', className: 'oui-pipeline-step', "data-tone": step.tone ?? workflowStatusTone(status), "data-status": status, "data-active": status === 'active' ? 'true' : undefined, "data-complete": status === 'done' ? 'true' : undefined, "data-clickable": !isDisabled ? 'true' : undefined, disabled: isDisabled, onClick: step.onSelect, children: [_jsx("span", { className: 'oui-pipeline-dot', children: workflowStatusIcon(status) }), _jsxs("span", { className: 'oui-pipeline-step-main', children: [_jsx("span", { className: 'oui-pipeline-label', children: label }), step.detail ? _jsx("span", { className: 'oui-pipeline-detail', children: step.detail }) : null, step.description ? (_jsx("span", { className: 'oui-pipeline-description', children: step.description })) : null] }), step.meta ? _jsx("span", { className: 'oui-pipeline-meta', children: step.meta }) : null] }));
|
|
36
|
+
const tooltip = step.tooltip ?? step.disabledReason;
|
|
37
|
+
if (!tooltip)
|
|
38
|
+
return content;
|
|
39
|
+
return (_jsx(Tooltip, { content: tooltip, children: _jsx("span", { className: 'oui-pipeline-tooltip-wrap', children: content }) }));
|
|
40
|
+
}
|
|
41
|
+
function LifecycleActionButton({ action }) {
|
|
42
|
+
const button = (_jsx(Button, { size: 1, v: 'surface', tone: action.tone, disabled: action.disabled, loading: action.loading, leftIcon: action.icon, onClick: action.onSelect, children: action.label }));
|
|
43
|
+
if (!action.disabledReason)
|
|
44
|
+
return button;
|
|
45
|
+
return (_jsx(Tooltip, { content: action.disabledReason, children: _jsx("span", { className: 'oui-lifecycle-action-tooltip-wrap', children: button }) }));
|
|
46
|
+
}
|
|
47
|
+
function pipelineStepStatus(step) {
|
|
48
|
+
if (step.status)
|
|
49
|
+
return step.status;
|
|
50
|
+
if (step.complete)
|
|
51
|
+
return 'done';
|
|
52
|
+
if (step.active)
|
|
53
|
+
return 'active';
|
|
54
|
+
return 'pending';
|
|
55
|
+
}
|
|
56
|
+
function workflowStatusTone(status) {
|
|
57
|
+
if (status === 'done')
|
|
58
|
+
return 'success';
|
|
59
|
+
if (status === 'active' || status === 'processing')
|
|
60
|
+
return 'info';
|
|
61
|
+
if (status === 'blocked')
|
|
62
|
+
return 'warning';
|
|
63
|
+
if (status === 'error')
|
|
64
|
+
return 'danger';
|
|
65
|
+
return 'neutral';
|
|
66
|
+
}
|
|
67
|
+
function workflowStatusIcon(status) {
|
|
68
|
+
if (status === 'done')
|
|
69
|
+
return _jsx(LuCheck, { "aria-hidden": true });
|
|
70
|
+
if (status === 'active' || status === 'processing')
|
|
71
|
+
return _jsx(LuRefreshCw, { "aria-hidden": true });
|
|
72
|
+
return _jsx(LuArrowRight, { "aria-hidden": true });
|
|
73
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type CodeExample } from './codeSamples';
|
|
3
|
+
export declare function CodeInfoButton({ title, code, onOpen, }: CodeExample & {
|
|
4
|
+
onOpen: (example: CodeExample) => void;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function ExampleTileHeader({ title, code, onOpen, }: CodeExample & {
|
|
7
|
+
onOpen: (example: CodeExample) => void;
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function ExampleTile({ id, title, code, onOpen, className, children, }: CodeExample & {
|
|
10
|
+
id?: string;
|
|
11
|
+
onOpen: (example: CodeExample) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function InlineCodeBlock({ code }: {
|
|
16
|
+
code: string;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function CodeBlock({ code }: {
|
|
19
|
+
code: string;
|
|
20
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function CodePreviewModal({ example, onClose, }: {
|
|
22
|
+
example: CodeExample | null;
|
|
23
|
+
onClose: () => void;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=CodePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodePreview.d.ts","sourceRoot":"","sources":["../../src/example/CodePreview.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,SAAS,EAEjB,MAAM,OAAO,CAAC;AAKf,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AA+B/C,wBAAgB,cAAc,CAAC,EAC3B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAYA;AAED,wBAAgB,iBAAiB,CAAC,EAC9B,KAAK,EACL,IAAI,EACJ,MAAM,GACT,EAAE,WAAW,GAAG;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C,2CAMA;AAED,wBAAgB,WAAW,CAAC,EACxB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,MAAM,EACN,SAAS,EACT,QAAQ,GACX,EAAE,WAAW,GAAG;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACvB,2CAUA;AAED,wBAAgB,eAAe,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CA+DrD;AAQD,wBAAgB,SAAS,CAAC,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,2CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,OAAO,GACV,EAAE;IACC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,2CAcA"}
|