@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,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useLayoutEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { LuInfo } from 'react-icons/lu';
|
|
5
|
+
import { Flex, IconButton, Modal, ScrollArea } from '..';
|
|
6
|
+
import { cn } from '../utils/cn';
|
|
7
|
+
import {} from './codeSamples';
|
|
8
|
+
function highlightedCode(code) {
|
|
9
|
+
const tokenPattern = /(\/\/.*|'.*?'|".*?"|`.*?`|\b(?:import|from|const|let|function|return|true|false|null|undefined|type|satisfies)\b|<\/?[A-Z][A-Za-z0-9.]*)/g;
|
|
10
|
+
return code.split('\n').flatMap((line, lineIndex) => {
|
|
11
|
+
const parts = line.split(tokenPattern).filter(Boolean);
|
|
12
|
+
const rendered = parts.map((part, partIndex) => {
|
|
13
|
+
let className = 'oui-code-token';
|
|
14
|
+
if (/^\/\//.test(part))
|
|
15
|
+
className += ' oui-code-comment';
|
|
16
|
+
else if (/^['"`]/.test(part))
|
|
17
|
+
className += ' oui-code-string';
|
|
18
|
+
else if (/^(import|from|const|let|function|return|true|false|null|undefined|type|satisfies)$/.test(part)) {
|
|
19
|
+
className += ' oui-code-keyword';
|
|
20
|
+
}
|
|
21
|
+
else if (/^<\/?[A-Z]/.test(part))
|
|
22
|
+
className += ' oui-code-component';
|
|
23
|
+
return (_jsx("span", { className: className, children: part }, `${lineIndex}-${partIndex}`));
|
|
24
|
+
});
|
|
25
|
+
return [
|
|
26
|
+
_jsx("span", { className: 'oui-code-line', children: rendered.length > 0 ? rendered : ' ' }, `line-${lineIndex}`),
|
|
27
|
+
];
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
export function CodeInfoButton({ title, code, onOpen, }) {
|
|
31
|
+
return (_jsx(IconButton, { className: 'oui-code-info-button', size: 1, v: 'pad', tone: 'info', icon: _jsx(LuInfo, { size: 14 }), "aria-label": `Show ${title} code`, onClick: () => onOpen({ title, code }) }));
|
|
32
|
+
}
|
|
33
|
+
export function ExampleTileHeader({ title, code, onOpen, }) {
|
|
34
|
+
return (_jsx(Flex, { className: 'oui-ui-tile-head', a: 's', g: 1, wrap: true, children: _jsx(CodeInfoButton, { title: title, code: code, onOpen: onOpen }) }));
|
|
35
|
+
}
|
|
36
|
+
export function ExampleTile({ id, title, code, onOpen, className, children, }) {
|
|
37
|
+
return (_jsxs("div", { id: id, className: cn('oui-section oui-ui-tile', className), children: [_jsxs("div", { className: 'oui-ui-tile-body', children: [_jsx(ExampleTileHeader, { title: title, code: code, onOpen: onOpen }), children] }), _jsx(InlineCodeBlock, { code: code })] }));
|
|
38
|
+
}
|
|
39
|
+
export function InlineCodeBlock({ code }) {
|
|
40
|
+
const [expanded, setExpanded] = useState(false);
|
|
41
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
42
|
+
const contentRef = useRef(null);
|
|
43
|
+
const collapsedHeight = 180;
|
|
44
|
+
const collapsible = contentHeight > collapsedHeight;
|
|
45
|
+
const panelHeight = collapsible
|
|
46
|
+
? expanded ? contentHeight + 38 : collapsedHeight
|
|
47
|
+
: contentHeight;
|
|
48
|
+
const measure = useCallback(() => {
|
|
49
|
+
const element = contentRef.current;
|
|
50
|
+
if (!element)
|
|
51
|
+
return;
|
|
52
|
+
const nextHeight = element.scrollHeight;
|
|
53
|
+
setContentHeight((current) => current === nextHeight ? current : nextHeight);
|
|
54
|
+
}, []);
|
|
55
|
+
useLayoutEffect(() => {
|
|
56
|
+
measure();
|
|
57
|
+
}, [code, measure]);
|
|
58
|
+
useLayoutEffect(() => {
|
|
59
|
+
const element = contentRef.current;
|
|
60
|
+
if (!element || typeof ResizeObserver === 'undefined')
|
|
61
|
+
return;
|
|
62
|
+
const observer = new ResizeObserver(() => measure());
|
|
63
|
+
observer.observe(element);
|
|
64
|
+
return () => observer.disconnect();
|
|
65
|
+
}, [measure]);
|
|
66
|
+
const handleWheelCapture = useCallback((event) => {
|
|
67
|
+
if (event.ctrlKey || event.shiftKey || Math.abs(event.deltaY) <= Math.abs(event.deltaX))
|
|
68
|
+
return;
|
|
69
|
+
const scrollRoot = document.querySelector('.oui-app-shell-content-scroll .oui-scroll-area-viewport');
|
|
70
|
+
if (!scrollRoot)
|
|
71
|
+
return;
|
|
72
|
+
event.preventDefault();
|
|
73
|
+
event.stopPropagation();
|
|
74
|
+
scrollRoot.scrollTop += normalizedWheelDeltaY(event);
|
|
75
|
+
}, []);
|
|
76
|
+
return (_jsxs("div", { className: 'oui-code-inline-panel', "data-expanded": expanded ? 'true' : 'false', "data-collapsible": collapsible ? 'true' : 'false', style: { height: panelHeight || undefined }, onWheelCapture: handleWheelCapture, children: [_jsx("div", { ref: contentRef, className: 'oui-code-inline-content', children: _jsx(CodeBlock, { code: code }) }), collapsible && !expanded ? _jsx("div", { className: 'oui-code-inline-fade', "aria-hidden": true }) : null, collapsible ? (_jsx("button", { type: 'button', className: 'oui-code-inline-toggle', "aria-expanded": expanded, onClick: () => setExpanded((current) => !current), children: expanded ? 'Hide code' : 'Show code' })) : null] }));
|
|
77
|
+
}
|
|
78
|
+
function normalizedWheelDeltaY(event) {
|
|
79
|
+
if (event.deltaMode === 1)
|
|
80
|
+
return event.deltaY * 16;
|
|
81
|
+
if (event.deltaMode === 2)
|
|
82
|
+
return event.deltaY * window.innerHeight;
|
|
83
|
+
return event.deltaY;
|
|
84
|
+
}
|
|
85
|
+
export function CodeBlock({ code }) {
|
|
86
|
+
return (_jsx(ScrollArea, { className: 'oui-code-preview-scroll', children: _jsx("pre", { className: 'oui-code-preview', children: _jsx("code", { children: highlightedCode(code) }) }) }));
|
|
87
|
+
}
|
|
88
|
+
export function CodePreviewModal({ example, onClose, }) {
|
|
89
|
+
return (_jsx(Modal, { open: example !== null, onOpenChange: (open) => {
|
|
90
|
+
if (!open)
|
|
91
|
+
onClose();
|
|
92
|
+
}, title: example?.title ?? 'Component code', description: 'Import and usage example.', maxWidth: 760, children: example ? _jsx(CodeBlock, { code: example.code }) : null }));
|
|
93
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type MenuItem } from '..';
|
|
2
|
+
import { type CodeExample } from './codeSamples';
|
|
3
|
+
type ActionsSectionProps = {
|
|
4
|
+
menuItems: ReadonlyArray<MenuItem>;
|
|
5
|
+
onOpenCode: (example: CodeExample) => void;
|
|
6
|
+
onOpenPalette: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function ActionsSection({ menuItems, onOpenCode, onOpenPalette, }: ActionsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ExampleActionsSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleActionsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleActionsSection.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAmD,KAAK,QAAQ,EAAC,MAAM,IAAI,CAAC;AAEnF,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACvB,SAAS,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C,aAAa,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC3B,SAAS,EACT,UAAU,EACV,aAAa,GAChB,EAAE,mBAAmB,2CA6GrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { LuBell, LuCheck, LuCommand, LuEllipsis, LuInfo, LuTrash2, LuTriangleAlert, } from 'react-icons/lu';
|
|
4
|
+
import { Button, Flex, IconButton, Menu, Spinner, Tooltip } from '..';
|
|
5
|
+
import { ExampleTile } from './CodePreview';
|
|
6
|
+
import { codeSamples } from './codeSamples';
|
|
7
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
8
|
+
export function ActionsSection({ menuItems, onOpenCode, onOpenPalette, }) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'buttons-example', title: 'Buttons', description: 'Button variants, tones, sizes, loading states and press animation.', children: _jsxs(ExampleTile, { title: 'Buttons', code: codeSamples.buttons, onOpen: onOpenCode, children: [_jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, children: "Solid" }), _jsx(Button, { size: 3, v: 'soft', children: "Soft" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad" }), _jsx(Button, { size: 3, v: 'outline', children: "Outline" }), _jsx(Button, { size: 3, v: 'ghost', children: "Ghost" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 3, tone: 'success', leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Button, { size: 3, tone: 'warning', v: 'soft', leftIcon: _jsx(LuTriangleAlert, { size: 16 }), children: "Warning" }), _jsx(Button, { size: 3, tone: 'info', v: 'soft', leftIcon: _jsx(LuInfo, { size: 16 }), children: "Info" }), _jsx(Button, { size: 3, tone: 'danger', v: 'soft', leftIcon: _jsx(LuTrash2, { size: 16 }), children: "Delete" }), _jsx(Button, { size: 3, loading: true, children: "Loading" }), _jsx(Button, { size: 3, v: 'surface', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Save" }), _jsx(Button, { size: 3, tone: 'success', loading: true, leftIcon: _jsx(LuCheck, { size: 16 }), children: "Success" }), _jsx(Spinner, {})] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, v: 'surface', children: "Size 1" }), _jsx(Button, { size: 2, v: 'surface', children: "Size 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Size 3" }), _jsx(Button, { size: 4, v: 'surface', children: "Size 4" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { size: 1, children: "Solid 1" }), _jsx(Button, { size: 2, v: 'soft', children: "Soft 2" }), _jsx(Button, { size: 3, v: 'surface', children: "Surface 3" }), _jsx(Button, { size: 3, v: 'pad', children: "Pad 3" }), _jsx(Button, { size: 4, v: 'outline', children: "Outline 4" }), _jsx(Button, { size: 2, v: 'ghost', children: "Ghost 2" })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Button, { v: 'surface', pressAnimation: 'translate', children: "Press translate" }), _jsx(Button, { v: 'surface', pressAnimation: 'scale', children: "Press scale" }), _jsx(Button, { v: 'surface', pressAnimation: 'soft', children: "Press soft" }), _jsx(Button, { v: 'surface', pressAnimation: 'none', children: "Press none" })] })] }) }), _jsx(UiExampleSection, { id: 'icon-buttons-example', title: 'Icon buttons', description: 'Icon-only actions, loading state, menu trigger and command entry.', children: _jsxs(ExampleTile, { title: 'Icon buttons', code: codeSamples.iconButtons, onOpen: onOpenCode, children: [_jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { v: 'solid', icon: _jsx(LuCheck, { size: 17 }), "aria-label": 'Solid icon' }), _jsx(IconButton, { v: 'soft', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Soft icon' }), _jsx(IconButton, { v: 'surface', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Surface icon' }), _jsx(IconButton, { v: 'pad', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Pad icon' }), _jsx(IconButton, { v: 'outline', icon: _jsx(LuInfo, { size: 17 }), "aria-label": 'Outline icon' }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Ghost icon' })] }), _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { size: 1, v: 'surface', icon: _jsx(LuBell, { size: 13 }), "aria-label": 'Size 1 icon' }), _jsx(IconButton, { size: 2, v: 'surface', icon: _jsx(LuBell, { size: 15 }), "aria-label": 'Size 2 icon' }), _jsx(IconButton, { size: 3, v: 'surface', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Size 3 icon' }), _jsx(IconButton, { size: 4, v: 'surface', icon: _jsx(LuBell, { size: 19 }), "aria-label": 'Size 4 icon' }), _jsx(IconButton, { size: 3, v: 'pad', round: false, r: 3, icon: _jsx(LuCommand, { size: 17 }), "aria-label": 'Square pad icon' }), _jsx(IconButton, { size: 3, v: 'outline', loading: true, icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Loading icon' })] }), _jsxs(Flex, { g: 2, a: 'c', wrap: true, children: [_jsx(IconButton, { size: 1, v: 'ghost', icon: _jsx(LuEllipsis, { size: 13 }), "aria-label": 'Ghost size 1' }), _jsx(IconButton, { size: 2, v: 'ghost', icon: _jsx(LuEllipsis, { size: 15 }), "aria-label": 'Ghost size 2' }), _jsx(IconButton, { size: 3, v: 'ghost', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Ghost size 3' }), _jsx(IconButton, { size: 4, v: 'ghost', icon: _jsx(LuEllipsis, { size: 19 }), "aria-label": 'Ghost size 4' })] }), _jsxs("div", { className: 'oui-ui-row', children: [_jsx(Tooltip, { content: 'Notifications', children: _jsx(IconButton, { v: 'surface', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Notifications' }) }), _jsx(IconButton, { v: 'surface', loading: true, icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Loading action' }), _jsx(IconButton, { v: 'pad', icon: _jsx(LuBell, { size: 17 }), "aria-label": 'Pad action' }), _jsx(Menu, { trigger: _jsx(IconButton, { v: 'surface', icon: _jsx(LuEllipsis, { size: 17 }), "aria-label": 'Actions' }), items: menuItems }), _jsx(Button, { v: 'surface', leftIcon: _jsx(LuCommand, { size: 16 }), onClick: onOpenPalette, children: "Commands" })] })] }) })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type CodeExample } from './codeSamples';
|
|
2
|
+
type ExampleSectionProps = {
|
|
3
|
+
onOpenCode: (example: CodeExample) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function TypographySection({ onOpenCode }: ExampleSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function LayoutSection({ onOpenCode }: ExampleSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ExampleBasicsSections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleBasicsSections.d.ts","sourceRoot":"","sources":["../../src/example/ExampleBasicsSections.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,mBAAmB,GAAG;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAC,UAAU,EAAC,EAAE,mBAAmB,2CAwElE;AAED,wBAAgB,aAAa,CAAC,EAAC,UAAU,EAAC,EAAE,mBAAmB,2CA2U9D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { AppShellNav, Badge, Box, Button, Collapse, Flex, Grid, PageTitleBlock, ScrollArea, Skeleton, Stack, Text, TopHighlight, BottomHighlight, } from '..';
|
|
5
|
+
import { ExampleTile } from './CodePreview';
|
|
6
|
+
import { codeSamples } from './codeSamples';
|
|
7
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
8
|
+
export function TypographySection({ onOpenCode }) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'typography', title: 'Typography', description: 'Text and shared system props.', children: _jsx(ExampleTile, { title: 'Typography', code: codeSamples.typography, onOpen: onOpenCode, children: _jsxs(Stack, { g: 3, children: [_jsxs(Stack, { g: 1, children: [_jsx(Text, { as: 'h1', fs: '28px', fw: 780, lh: 1.1, children: "Workflow review" }), _jsx(Text, { as: 'h2', fs: '20px', fw: 720, lh: 1.2, children: "Review window and status" }), _jsx(Text, { tone: 'muted', fs: '13px', lh: 1.5, children: "Compact operational text with muted metadata and predictable line height." })] }), _jsxs(Stack, { g: 1, children: [_jsx(Text, { fs: '15px', fw: 700, children: "Body strong text" }), _jsx(Text, { fs: '14px', lh: 1.55, children: "Body regular text for dense forms and tables." }), _jsx(Text, { fs: '12px', tone: 'muted', lh: 1.4, children: "Caption text, helper text and quiet labels." })] }), _jsxs(Flex, { g: 2, wrap: true, children: [_jsx(Text, { tone: 'brand', fw: 700, children: "Brand" }), _jsx(Text, { tone: 'success', fw: 700, children: "Success" }), _jsx(Text, { tone: 'warning', fw: 700, children: "Warning" }), _jsx(Text, { tone: 'danger', fw: 700, children: "Danger" }), _jsx(Text, { tone: 'info', fw: 700, children: "Info" })] }), _jsx(Box, { w: '100%', p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { display: 'block', truncate: true, children: "This is a long single line value that truncates cleanly inside a constrained row." }) }), _jsxs(Flex, { g: 2, wrap: true, children: [_jsx(Badge, { children: "Neutral" }), _jsx(Badge, { tone: 'brand', children: "Brand" }), _jsx(Badge, { tone: 'success', children: "Success" }), _jsx(Badge, { tone: 'warning', children: "Warning" }), _jsx(Badge, { tone: 'danger', children: "Danger" }), _jsx(Badge, { tone: 'info', children: "Info" })] })] }) }) }), _jsx(UiExampleSection, { id: 'skeleton-example', title: 'Skeleton', description: 'Loading placeholder primitives.', children: _jsx(ExampleTile, { title: 'Skeleton', code: codeSamples.skeleton, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsx(Skeleton, { h: 16, w: '80%' }), _jsx(Skeleton, { h: 16, w: '64%' }), _jsx(Skeleton, { h: 36 })] }) }) })] }));
|
|
10
|
+
}
|
|
11
|
+
export function LayoutSection({ onOpenCode }) {
|
|
12
|
+
const [detailsOpen, setDetailsOpen] = useState(true);
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'app-shell-example', title: 'AppShell', description: 'Shared module frame primitives.', children: _jsx(ExampleTile, { title: 'AppShell primitives', code: codeSamples.appShell, onOpen: onOpenCode, children: _jsxs(Stack, { g: 3, children: [_jsx(PageTitleBlock, { title: 'Operations', caption: 'Shared module frame with themed navigation and page actions.', badge: 'shell', action: _jsx(Button, { size: 1, children: "Create" }) }), _jsx(AppShellNav, { items: [
|
|
14
|
+
{ key: 'queue', label: 'Queue', caption: 'Daily operations', active: true },
|
|
15
|
+
{ key: 'status', label: 'Status', caption: 'Inventory control', badge: 12 },
|
|
16
|
+
{ key: 'reports', label: 'Reports', caption: 'Exports and analytics' },
|
|
17
|
+
] })] }) }) }), _jsx(UiExampleSection, { id: 'flex-example', title: 'Flex', description: 'Row and column alignment primitive.', children: _jsx(ExampleTile, { title: 'Flex', code: codeSamples.layoutFlex, onOpen: onOpenCode, children: _jsxs(Flex, { col: true, g: 3, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', j: 'sb', wrap: true, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', wrap: true, children: [_jsx(Badge, { tone: 'brand', children: "status" }), _jsx(Text, { fw: 700, children: "Task TASK-2048" })] }), _jsxs(Flex, { row: true, g: 1, a: 'c', children: [_jsx(Button, { size: 1, v: 'surface', children: "Cancel" }), _jsx(Button, { size: 1, children: "Apply" })] })] }), _jsx(Flex, { row: true, g: 2, wrap: true, children: ['Intake', 'Review', 'Complete'].map((item, index) => (_jsxs(Flex, { col: true, g: 1, p: 2, r: 3, flex: '1 1 150px', style: { background: 'var(--oui-gray-a3)' }, children: [_jsxs(Text, { fs: '12px', tone: 'muted', children: ["Step ", index + 1] }), _jsx(Text, { fw: 700, children: item })] }, item))) })] }) }) }), _jsx(UiExampleSection, { id: 'stack-example', title: 'Stack', description: 'Vertical spacing primitive.', children: _jsx(ExampleTile, { title: 'Stack', code: codeSamples.layoutStack, onOpen: onOpenCode, children: _jsx(Stack, { g: 2, children: [
|
|
18
|
+
['Created', 'Draft created from intake'],
|
|
19
|
+
['Reserved', 'Capacity is reserved for review'],
|
|
20
|
+
['Scheduled', 'Review window is confirmed'],
|
|
21
|
+
].map(([title, description]) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 's', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Box, { size: 8, r: 7, mt: 1, style: { background: 'var(--oui-brand)' } }), _jsxs(Stack, { g: 0, children: [_jsx(Text, { fs: '13px', fw: 700, children: title }), _jsx(Text, { fs: '12px', tone: 'muted', lh: 1.45, children: description })] })] }, title))) }) }) }), _jsx(UiExampleSection, { id: 'collapse-example', title: 'Collapse', description: 'Expandable content primitive.', children: _jsx(ExampleTile, { title: 'Collapse', code: codeSamples.layoutCollapse, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsxs(Flex, { row: true, g: 2, a: 'c', j: 'sb', children: [_jsx(Text, { fw: 700, children: "Item details" }), _jsx(Button, { size: 1, v: 'surface', onClick: () => setDetailsOpen((open) => !open), children: detailsOpen ? 'Hide' : 'Show' })] }), _jsx(Collapse, { open: detailsOpen, children: _jsxs(Stack, { g: 2, p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: [_jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Owner" }), _jsx(Text, { fw: 700, children: "Core team" })] }), _jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Window" }), _jsx(Text, { fw: 700, children: "09:00 - 12:00" })] }), _jsxs(Flex, { row: true, g: 2, j: 'sb', children: [_jsx(Text, { tone: 'muted', children: "Priority" }), _jsx(Badge, { tone: 'warning', children: "High" })] })] }) })] }) }) }), _jsx(UiExampleSection, { id: 'grid-example', title: 'Grid', description: 'Grid layout primitive.', children: _jsx(ExampleTile, { title: 'Grid', code: codeSamples.layoutGrid, onOpen: onOpenCode, children: _jsx(Grid, { columns: 'repeat(3, minmax(0, 1fr))', g: 2, children: ['A', 'B', 'C', 'D', 'E', 'F'].map((item) => (_jsx(Box, { p: 2, r: 3, ta: 'center', style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { fs: '13px', fw: 700, children: item }) }, item))) }) }) }), _jsx(UiExampleSection, { id: 'highlight-primitives-example', title: 'Highlight primitives', description: 'Standalone edge mask primitives.', children: _jsx(ExampleTile, { title: 'Highlight primitives', code: codeSamples.highlights, onOpen: onOpenCode, children: _jsxs("div", { className: 'oui-highlight-demo-surface', style: { background: 'var(--oui-section-nested-solid-bg)' }, children: [_jsx(TopHighlight, { h: 32, color: 'var(--oui-section-nested-solid-bg)', position: 'absolute' }), _jsx(Text, { fs: '13px', fw: 700, children: "Top and bottom highlights" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "One surface shows both edge masks at the same time." }), _jsx(BottomHighlight, { h: 32, color: 'var(--oui-section-nested-solid-bg)', position: 'absolute' })] }) }) }), _jsx(UiExampleSection, { id: 'scroll-area-example', title: 'ScrollArea', description: 'Themed scroll container with optional edge highlights.', children: _jsx(ExampleTile, { title: 'ScrollArea', code: codeSamples.scrollArea, onOpen: onOpenCode, children: _jsxs(Stack, { g: 2, children: [_jsx(ScrollArea, { h: 116, pr: 1, children: _jsx(Stack, { g: 1, children: Array.from({ length: 10 }, (_, index) => (_jsx(Box, { p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsxs(Text, { fs: '13px', children: ["Scroll row ", index + 1] }) }, index))) }) }), _jsx(ScrollArea, { h: 112, pr: 1, highlights: true, highlightColor: 'var(--oui-section-nested-solid-bg)', highlightTop: { h: 28, mode: 'static', maxOpacity: 0.96 }, highlightBottom: { h: 28, mode: 'static', maxOpacity: 0.96 }, children: _jsx(Stack, { g: 1, children: Array.from({ length: 8 }, (_, index) => (_jsx(Box, { p: 2, r: 3, style: { background: 'var(--oui-gray-a3)' }, children: _jsxs(Text, { fs: '13px', children: ["Both edges row ", index + 1] }) }, index))) }) }), _jsx(ScrollArea, { h: 176, pr: 1, highlights: true, highlightColor: 'var(--oui-section-nested-solid-bg)', highlightTop: {
|
|
22
|
+
h: 42,
|
|
23
|
+
mode: 'scroll',
|
|
24
|
+
start: 50,
|
|
25
|
+
fadeDistance: 160,
|
|
26
|
+
maxOpacity: 0.94,
|
|
27
|
+
}, highlightBottom: {
|
|
28
|
+
h: 34,
|
|
29
|
+
mode: 'scroll',
|
|
30
|
+
start: 12,
|
|
31
|
+
fadeDistance: 96,
|
|
32
|
+
maxOpacity: 0.9,
|
|
33
|
+
}, children: _jsx(Stack, { g: 1, children: [
|
|
34
|
+
['Queued', 'No top shade at the initial position.'],
|
|
35
|
+
['Reserved', 'The top shade starts after 50px.'],
|
|
36
|
+
['Packed', 'Opacity reaches maximum over 160px.'],
|
|
37
|
+
['Labeled', 'Bottom shade fades near the end.'],
|
|
38
|
+
['Reviewed', 'Each edge has its own configuration.'],
|
|
39
|
+
['Delivered', 'The gradient uses the solid surface color.'],
|
|
40
|
+
['Checked', 'Content remains readable under the fade.'],
|
|
41
|
+
['Archived', 'The bottom edge disappears at the end.'],
|
|
42
|
+
].map(([title, description], index) => (_jsxs(Flex, { row: true, g: 2, p: 2, r: 3, a: 'c', style: { background: 'var(--oui-gray-a3)' }, children: [_jsx(Badge, { tone: index < 3 ? 'brand' : 'info', children: index + 1 }), _jsxs(Stack, { g: 0, children: [_jsx(Text, { fs: '13px', fw: 700, children: title }), _jsx(Text, { fs: '12px', tone: 'muted', children: description })] })] }, title))) }) })] }) }) }), _jsx(UiExampleSection, { id: 'system-radius-example', title: 'System radius', description: 'Radius system prop scale.', children: _jsxs(ExampleTile, { title: 'System radius', code: codeSamples.systemRadius, onOpen: onOpenCode, children: [_jsx(Flex, { g: 2, a: 'c', wrap: true, children: [0, 2, 4, 6, 7].map((radius) => (_jsx(Box, { size: 32, r: radius, display: 'flex', a: 'c', j: 'c', style: { background: 'var(--oui-gray-a3)' }, children: _jsx(Text, { fs: '12px', fw: 700, children: radius }) }, radius))) }), _jsx(Button, { mt: 2, v: 'pad', r: 7, children: "Button r=7" })] }) })] }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CodeExample } from './codeSamples';
|
|
2
|
+
type DataSectionProps = {
|
|
3
|
+
onOpenCode: (example: CodeExample) => void;
|
|
4
|
+
};
|
|
5
|
+
export declare function DataSection({ onOpenCode }: DataSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=ExampleDataSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleDataSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleDataSection.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,gBAAgB,GAAG;IACpB,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AA2DF,wBAAgB,WAAW,CAAC,EAAC,UAAU,EAAC,EAAE,gBAAgB,2CAuHzD"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { Badge, Button, DataTable, Text, TextField, } from '..';
|
|
5
|
+
import { ExampleTile } from './CodePreview';
|
|
6
|
+
import { codeSamples } from './codeSamples';
|
|
7
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
8
|
+
const rows = [
|
|
9
|
+
{ name: 'Review item', status: 'Done', owner: 'Team C', quantity: 128 },
|
|
10
|
+
{ name: 'Review task', status: 'Working', owner: 'Team B', quantity: 42 },
|
|
11
|
+
{ name: 'Complete', status: 'Blocked', owner: 'Team A', quantity: 12 },
|
|
12
|
+
{ name: 'Return', status: 'Working', owner: 'Team C', quantity: 7 },
|
|
13
|
+
{ name: 'Audit task', status: 'Done', owner: 'Team B', quantity: 64 },
|
|
14
|
+
{ name: 'Sync task', status: 'Blocked', owner: 'Team A', quantity: 18 },
|
|
15
|
+
];
|
|
16
|
+
const columns = [
|
|
17
|
+
{
|
|
18
|
+
key: 'name',
|
|
19
|
+
title: 'Name',
|
|
20
|
+
sortable: true,
|
|
21
|
+
resizable: true,
|
|
22
|
+
minWidth: 170,
|
|
23
|
+
render: (row) => row.name,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'status',
|
|
27
|
+
title: 'Status',
|
|
28
|
+
sortable: true,
|
|
29
|
+
resizable: true,
|
|
30
|
+
width: 150,
|
|
31
|
+
render: (row) => _jsx(Badge, { tone: statusTone(row.status), children: row.status }),
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
key: 'owner',
|
|
35
|
+
title: 'Owner',
|
|
36
|
+
sortable: true,
|
|
37
|
+
resizable: true,
|
|
38
|
+
width: 180,
|
|
39
|
+
render: (row) => row.owner,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'quantity',
|
|
43
|
+
title: 'Qty',
|
|
44
|
+
sortable: true,
|
|
45
|
+
align: 'right',
|
|
46
|
+
width: 90,
|
|
47
|
+
hideable: true,
|
|
48
|
+
render: (row) => row.quantity,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
const defaultVisibleColumnKeys = columns
|
|
52
|
+
.filter((column) => column.defaultVisible !== false)
|
|
53
|
+
.map((column) => column.key);
|
|
54
|
+
const defaultColumnOrder = columns.map((column) => column.key);
|
|
55
|
+
export function DataSection({ onOpenCode }) {
|
|
56
|
+
const [query, setQuery] = useState('');
|
|
57
|
+
const [sort, setSort] = useState({
|
|
58
|
+
key: 'name',
|
|
59
|
+
direction: 'asc',
|
|
60
|
+
});
|
|
61
|
+
const [selectedRowKeys, setSelectedRowKeys] = useState(['Review item']);
|
|
62
|
+
const [visibleColumnKeys, setVisibleColumnKeys] = useState(defaultVisibleColumnKeys);
|
|
63
|
+
const [columnOrder, setColumnOrder] = useState(defaultColumnOrder);
|
|
64
|
+
const [columnWidths, setColumnWidths] = useState({});
|
|
65
|
+
const filteredRows = useMemo(() => sortRows(rows.filter((row) => rowMatches(row, query)), sort), [query, sort]);
|
|
66
|
+
return (_jsx(UiExampleSection, { id: 'data-table-example', title: 'DataTable', description: 'Reusable DataTable without CRUD or page-level entity logic.', children: _jsx(ExampleTile, { className: 'oui-ui-table-tile', title: 'DataTable', code: codeSamples.data, onOpen: onOpenCode, children: _jsxs("div", { className: 'oui-ui-table-demo', children: [_jsx(DataTable, { toolbar: (_jsxs(_Fragment, { children: [_jsx(TextField, { value: query, placeholder: 'Filter rows', clearable: true, onChange: (event) => setQuery(event.target.value), onClear: () => setQuery('') }), _jsx(Button, { size: 3, v: 'surface', onClick: () => {
|
|
67
|
+
setVisibleColumnKeys(defaultVisibleColumnKeys);
|
|
68
|
+
setColumnOrder(defaultColumnOrder);
|
|
69
|
+
setColumnWidths({});
|
|
70
|
+
}, children: "Reset" })] })), rowKey: (row) => row.name, rows: filteredRows, columns: columns, sort: sort, onSortChange: (nextSort) => setSort(Array.isArray(nextSort) ? nextSort[0] ?? null : nextSort), selectable: true, selectedRowKeys: selectedRowKeys, onSelectedRowKeysChange: setSelectedRowKeys, total: rows.length, emptyText: 'No rows match the filter.', columnSettings: {
|
|
71
|
+
columns,
|
|
72
|
+
visibleColumnKeys,
|
|
73
|
+
onVisibleColumnKeysChange: setVisibleColumnKeys,
|
|
74
|
+
columnOrder,
|
|
75
|
+
onColumnOrderChange: setColumnOrder,
|
|
76
|
+
columnWidths,
|
|
77
|
+
onColumnWidthsChange: setColumnWidths,
|
|
78
|
+
onReset: () => {
|
|
79
|
+
setVisibleColumnKeys(defaultVisibleColumnKeys);
|
|
80
|
+
setColumnOrder(defaultColumnOrder);
|
|
81
|
+
setColumnWidths({});
|
|
82
|
+
},
|
|
83
|
+
}, rowContextMenuActions: (row) => [
|
|
84
|
+
{
|
|
85
|
+
key: 'open',
|
|
86
|
+
label: `Open ${row.name}`,
|
|
87
|
+
onSelect: () => undefined,
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
key: 'archive',
|
|
91
|
+
label: 'Archive',
|
|
92
|
+
tone: 'danger',
|
|
93
|
+
onSelect: () => undefined,
|
|
94
|
+
},
|
|
95
|
+
] }), _jsx("div", { className: 'oui-ui-table-variants', children: _jsxs("div", { className: 'oui-ui-table-variant', children: [_jsx(Text, { fs: '13px', fw: 760, children: "Plain table" }), _jsx(DataTable, { rowKey: (row) => row.name, rows: rows.slice(0, 4), columns: columns, sort: sort, onSortChange: (nextSort) => setSort(Array.isArray(nextSort)
|
|
96
|
+
? nextSort[0] ?? null
|
|
97
|
+
: nextSort), total: rows.length, emptyText: 'No rows.' })] }) })] }) }) }));
|
|
98
|
+
}
|
|
99
|
+
function sortRows(rows, sort) {
|
|
100
|
+
if (!sort)
|
|
101
|
+
return rows;
|
|
102
|
+
const sign = sort.direction === 'asc' ? 1 : -1;
|
|
103
|
+
return [...rows].sort((left, right) => {
|
|
104
|
+
const leftValue = left[sort.key];
|
|
105
|
+
const rightValue = right[sort.key];
|
|
106
|
+
if (typeof leftValue === 'number' && typeof rightValue === 'number') {
|
|
107
|
+
return (leftValue - rightValue) * sign;
|
|
108
|
+
}
|
|
109
|
+
return String(leftValue).localeCompare(String(rightValue)) * sign;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function rowMatches(row, query) {
|
|
113
|
+
const normalized = query.trim().toLowerCase();
|
|
114
|
+
if (!normalized)
|
|
115
|
+
return true;
|
|
116
|
+
return `${row.name} ${row.owner} ${row.status}`.toLowerCase().includes(normalized);
|
|
117
|
+
}
|
|
118
|
+
function statusTone(status) {
|
|
119
|
+
if (status === 'Done')
|
|
120
|
+
return 'success';
|
|
121
|
+
if (status === 'Blocked')
|
|
122
|
+
return 'danger';
|
|
123
|
+
return 'warning';
|
|
124
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CodeExample } from './codeSamples';
|
|
2
|
+
type DateRangeValue = {
|
|
3
|
+
from: string;
|
|
4
|
+
to: string;
|
|
5
|
+
};
|
|
6
|
+
type FieldsSectionProps = {
|
|
7
|
+
stepperValue: number;
|
|
8
|
+
onStepperValueChange: (value: number) => void;
|
|
9
|
+
dateValue: string;
|
|
10
|
+
onDateValueChange: (value: string) => void;
|
|
11
|
+
dateRange: DateRangeValue;
|
|
12
|
+
onDateRangeChange: (value: DateRangeValue) => void;
|
|
13
|
+
onOpenCode: (example: CodeExample) => void;
|
|
14
|
+
};
|
|
15
|
+
export declare function FieldsSection({ stepperValue, onStepperValueChange, dateValue, onDateValueChange, dateRange, onDateRangeChange, onOpenCode, }: FieldsSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ExampleFieldsSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleFieldsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleFieldsSection.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,SAAS,EAAE,cAAc,CAAC;IAC1B,iBAAiB,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC1B,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,iBAAiB,EACjB,UAAU,GACb,EAAE,kBAAkB,2CA2HpB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { LuSearch } from 'react-icons/lu';
|
|
4
|
+
import { Button, DatePicker, DateRangePicker, DateRangePresetPicker, Flex, Field, Grid, NumberField, Section, Stack, StepperInput, Text, TextArea, TextField, } from '..';
|
|
5
|
+
import { ExampleTile } from './CodePreview';
|
|
6
|
+
import { codeSamples } from './codeSamples';
|
|
7
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
8
|
+
export function FieldsSection({ stepperValue, onStepperValueChange, dateValue, onDateValueChange, dateRange, onDateRangeChange, onOpenCode, }) {
|
|
9
|
+
return (_jsxs(_Fragment, { children: [_jsx(UiExampleSection, { id: 'text-fields-example', title: 'Text fields', description: 'TextField and TextArea inside Field.', children: _jsxs(ExampleTile, { title: 'Text fields', code: codeSamples.textFields, onOpen: onOpenCode, children: [_jsx(Field, { label: 'Search', helperText: 'Clearable field with left slot.', children: _jsxs(Flex, { g: 2, a: 'c', children: [_jsx(TextField, { size: 2, placeholder: 'Search item', clearable: true, leftSlot: _jsx(LuSearch, { size: 16 }) }), _jsx(Button, { size: 2, v: 'surface', children: "Search" })] }) }), _jsx(Field, { label: 'Comment', children: _jsx(TextArea, { rows: 4, placeholder: 'Internal note' }) })] }) }), _jsx(UiExampleSection, { id: 'grouped-fields-example', title: 'Grouped fields', description: 'Layout primitives group fields without owning form state.', children: _jsx(ExampleTile, { title: 'Grouped fields', code: codeSamples.groupedFields, onOpen: onOpenCode, children: _jsxs(Section, { g: 3, children: [_jsxs(Stack, { g: 1, children: [_jsx(Text, { fw: 760, children: "Request details" }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Layout primitives group fields without owning state." })] }), _jsxs(Stack, { g: 3, children: [_jsxs(Grid, { columns: 'repeat(auto-fit, minmax(min(100%, 180px), 1fr))', g: 3, children: [_jsx(Field, { label: 'Source', required: true, error: 'Choose a source', children: _jsx(TextField, { placeholder: 'Search source', invalid: true }) }), _jsx(Field, { label: 'Contact', children: _jsx(TextField, { placeholder: 'Name or email' }) })] }), _jsx(Field, { label: 'Review note', helperText: 'Visible to operators.', children: _jsx(TextArea, { rows: 3, placeholder: 'Internal instructions' }) }), _jsxs(Flex, { g: 2, j: 'e', wrap: true, children: [_jsx(Button, { type: 'button', v: 'surface', children: "Cancel" }), _jsx(Button, { type: 'button', children: "Save request" })] })] })] }) }) }), _jsx(UiExampleSection, { id: 'number-date-fields-example', title: 'Number and date fields', description: 'StepperInput, NumberField and DatePicker.', children: _jsxs(ExampleTile, { title: 'Number and date fields', code: codeSamples.numberAndDateFields, onOpen: onOpenCode, children: [_jsx(Field, { label: 'Quantity', children: _jsx(StepperInput, { value: stepperValue, onChange: onStepperValueChange, min: 0, max: 200 }) }), _jsx(Field, { label: 'Price', children: _jsx(NumberField, { defaultValue: 1250, min: 0 }) }), _jsx(Field, { label: 'Date', children: _jsx(DatePicker, { value: dateValue, onValueChange: onDateValueChange }) })] }) }), _jsx(UiExampleSection, { id: 'date-range-example', title: 'Date range', description: 'DateRangePicker and preset helper.', children: _jsxs(ExampleTile, { title: 'Date range', code: codeSamples.dateRangeFields, onOpen: onOpenCode, children: [_jsx(Field, { label: 'Range', children: _jsx(DateRangePicker, { value: dateRange, onValueChange: onDateRangeChange }) }), _jsx(DateRangePresetPicker, { today: '2026-06-26', onValueChange: onDateRangeChange }), _jsx(Text, { fs: '12px', tone: 'muted', children: "Date inputs stay as controls. Form ownership belongs to the application." })] }) })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleFoundationsSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleFoundationsSection.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAe/C,wBAAgB,kBAAkB,CAAC,EAC/B,UAAU,GACb,EAAE;IACC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,2CAiCA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Stack, Text } from '..';
|
|
4
|
+
import { ExampleTile } from './CodePreview';
|
|
5
|
+
import {} from './codeSamples';
|
|
6
|
+
import { UiExampleSection } from './UiExampleSection';
|
|
7
|
+
const providerSample = {
|
|
8
|
+
title: 'OrcestrUiProvider',
|
|
9
|
+
code: `import {OrcestrUiProvider} from '@orcestr/ui';
|
|
10
|
+
|
|
11
|
+
<OrcestrUiProvider
|
|
12
|
+
surface='operations'
|
|
13
|
+
locale='ru'
|
|
14
|
+
>
|
|
15
|
+
<App />
|
|
16
|
+
</OrcestrUiProvider>`,
|
|
17
|
+
};
|
|
18
|
+
export function FoundationsSection({ onOpenCode, }) {
|
|
19
|
+
return (_jsx(UiExampleSection, { id: 'foundations', title: '\u041A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u044B \u0431\u0438\u0431\u043B\u0438\u043E\u0442\u0435\u043A\u0438', description: '\u0411\u0430\u0437\u043E\u0432\u044B\u0435 \u043F\u0440\u0430\u0432\u0438\u043B\u0430 \u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F Orcestr UI: provider, \u043F\u0443\u0431\u043B\u0438\u0447\u043D\u044B\u0439 API, \u0442\u043E\u043A\u0435\u043D\u044B \u0438 \u043F\u0440\u043E\u0432\u0435\u0440\u043A\u0438.', children: _jsx(Stack, { g: 3, children: _jsx(ExampleTile, { id: 'provider-contract-example', title: 'OrcestrUiProvider', code: providerSample.code, onOpen: onOpenCode, children: _jsx("div", { className: 'oui-ui-contract-grid', children: [
|
|
20
|
+
['Provider', 'theme, locale, portal, overlays, toast'],
|
|
21
|
+
['Публичный API', 'size, tone, v, disabled, loading, invalid, testId'],
|
|
22
|
+
['Стили', 'только oui-* классы внутри @orcestr/ui/styles.css'],
|
|
23
|
+
['Проверки', 'tsc, contract tests, diff check, /ui smoke'],
|
|
24
|
+
].map(([title, description]) => (_jsxs("div", { className: 'oui-ui-contract-item', children: [_jsx(Badge, { tone: 'brand', children: title }), _jsx(Text, { fs: '12px', tone: 'muted', children: description })] }, title))) }) }) }) }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type OrcestrUiLocale } from '..';
|
|
2
|
+
type ToastTone = 'info' | 'success' | 'danger';
|
|
3
|
+
type SetOpen = (open: boolean) => void;
|
|
4
|
+
type ExampleOverlaysProps = {
|
|
5
|
+
locale: OrcestrUiLocale;
|
|
6
|
+
modalOpen: boolean;
|
|
7
|
+
setModalOpen: SetOpen;
|
|
8
|
+
nestedOpen: boolean;
|
|
9
|
+
setNestedOpen: SetOpen;
|
|
10
|
+
blurModalOpen: boolean;
|
|
11
|
+
setBlurModalOpen: SetOpen;
|
|
12
|
+
blurNestedOpen: boolean;
|
|
13
|
+
setBlurNestedOpen: SetOpen;
|
|
14
|
+
blurFinalOpen: boolean;
|
|
15
|
+
setBlurFinalOpen: SetOpen;
|
|
16
|
+
fastModalOpen: boolean;
|
|
17
|
+
setFastModalOpen: SetOpen;
|
|
18
|
+
slowModalOpen: boolean;
|
|
19
|
+
setSlowModalOpen: SetOpen;
|
|
20
|
+
riseModalOpen: boolean;
|
|
21
|
+
setRiseModalOpen: SetOpen;
|
|
22
|
+
dangerModalOpen: boolean;
|
|
23
|
+
setDangerModalOpen: SetOpen;
|
|
24
|
+
paletteOpen: boolean;
|
|
25
|
+
setPaletteOpen: SetOpen;
|
|
26
|
+
onToast: (title: string, tone?: ToastTone) => void;
|
|
27
|
+
};
|
|
28
|
+
export declare function ExampleOverlays({ locale, modalOpen, setModalOpen, nestedOpen, setNestedOpen, blurModalOpen, setBlurModalOpen, blurNestedOpen, setBlurNestedOpen, blurFinalOpen, setBlurFinalOpen, fastModalOpen, setFastModalOpen, slowModalOpen, setSlowModalOpen, riseModalOpen, setRiseModalOpen, dangerModalOpen, setDangerModalOpen, paletteOpen, setPaletteOpen, onToast, }: ExampleOverlaysProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=ExampleOverlays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleOverlays.d.ts","sourceRoot":"","sources":["../../src/example/ExampleOverlays.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,eAAe,EAAC,MAAM,IAAI,CAAC;AAExC,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC/C,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAEvC,KAAK,oBAAoB,GAAG;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,EAAE,OAAO,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,OAAO,GACV,EAAE,oBAAoB,2CAgOtB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { Button, CommandPalette, Flex, Field, Modal, Stack, Text, TextField } from '..';
|
|
4
|
+
import { getCommandItems } from './exampleData';
|
|
5
|
+
import {} from '..';
|
|
6
|
+
export function ExampleOverlays({ locale, modalOpen, setModalOpen, nestedOpen, setNestedOpen, blurModalOpen, setBlurModalOpen, blurNestedOpen, setBlurNestedOpen, blurFinalOpen, setBlurFinalOpen, fastModalOpen, setFastModalOpen, slowModalOpen, setSlowModalOpen, riseModalOpen, setRiseModalOpen, dangerModalOpen, setDangerModalOpen, paletteOpen, setPaletteOpen, onToast, }) {
|
|
7
|
+
const commandItems = getCommandItems(locale);
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(Modal, { open: modalOpen, onOpenChange: setModalOpen, title: 'Custom modal', description: 'First modal layer with the default theme blur backdrop.', footer: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: () => setModalOpen(false), children: "Close" }), _jsx(Button, { onClick: () => setNestedOpen(true), children: "Open nested" })] }), children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "Nested modals stack above the previous layer and keep independent smooth open and close animations." }), _jsx(Field, { label: 'Modal field', children: _jsx(TextField, { placeholder: 'Focus stays inside modal' }) })] }) }), _jsx(Modal, { open: nestedOpen, onOpenChange: setNestedOpen, title: 'Nested modal', description: 'Second layer with the same default modal animation.', maxWidth: 440, children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This checks layer indexes, focus trap and escape handling." }), _jsx(Button, { onClick: () => onToast('Nested modal action completed', 'success'), children: "Show toast" })] }) }), _jsx(Modal, { open: blurModalOpen, onOpenChange: setBlurModalOpen, title: 'Blur modal', description: 'Default modal surface with pure backdrop blur and no overlay tint.', maxWidth: 560, overlayColor: 'transparent', overlayOpacity: 0, overlayBlur: 10, borderColor: 'color-mix(in srgb, var(--oui-brand) 34%, var(--oui-border))', radius: 10, shadow: '0 24px 90px rgb(0 0 0 / 44%)', footer: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: () => setBlurModalOpen(false), children: "Close" }), _jsx(Button, { onClick: () => setBlurNestedOpen(true), children: "Open nested blur" })] }), children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This variant checks a strong backdrop blur while the overlay tint stays fully transparent." }), _jsx(Field, { label: 'Reference', children: _jsx(TextField, { placeholder: 'ORD-2048' }) })] }) }), _jsx(Modal, { open: blurNestedOpen, onOpenChange: setBlurNestedOpen, title: 'Nested blur modal', description: 'Second blur layer without overlay tint.', maxWidth: 500, overlayColor: 'transparent', overlayOpacity: 0, overlayBlur: 8, borderColor: 'color-mix(in srgb, var(--oui-brand) 38%, var(--oui-border))', radius: 10, footer: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: () => setBlurNestedOpen(false), children: "Close" }), _jsx(Button, { onClick: () => setBlurFinalOpen(true), children: "Open final blur" })] }), children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This layer keeps the backdrop blur transparent while stacking above the first blur modal." }), _jsx(TextField, { placeholder: 'Nested value' })] }) }), _jsx(Modal, { open: blurFinalOpen, onOpenChange: setBlurFinalOpen, title: 'Final blur modal', description: 'Top blur layer. Toast must appear above this modal.', maxWidth: 440, overlayColor: 'transparent', overlayOpacity: 0, overlayBlur: 6, borderColor: 'color-mix(in srgb, var(--oui-brand) 42%, var(--oui-border))', radius: 10, children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "Use this modal to verify blur stacking and toast z-index." }), _jsx(Button, { onClick: () => onToast('Toast above nested blur modals', 'success'), children: "Show toast" })] }) }), _jsx(Modal, { open: fastModalOpen, onOpenChange: setFastModalOpen, title: 'Fast modal', description: 'Short animationDuration passed directly to the modal.', maxWidth: 460, overlayColor: '#0b1020', overlayOpacity: 0.28, overlayBlur: 4, animationDuration: '160ms', children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This variant opens and closes quickly while still animating the backdrop blur." }), _jsx(Button, { onClick: () => setFastModalOpen(false), children: "Close" })] }) }), _jsx(Modal, { open: slowModalOpen, onOpenChange: setSlowModalOpen, title: 'Very slow modal', description: 'Long animationDuration for checking smooth blur ramp.', maxWidth: 520, overlayColor: 'transparent', overlayOpacity: 0, overlayBlur: 14, animationDuration: '1200ms', borderColor: 'color-mix(in srgb, var(--oui-brand) 42%, var(--oui-border))', radius: 10, children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "The backdrop blur should build up and fade out gradually during the whole animation." }), _jsx(Button, { onClick: () => setSlowModalOpen(false), children: "Close" })] }) }), _jsx(Modal, { open: riseModalOpen, onOpenChange: setRiseModalOpen, title: 'Rise modal', description: 'Legacy rise animation kept as an explicit modal animation variant.', maxWidth: 480, overlayColor: '#0b1020', overlayOpacity: 0.28, overlayBlur: 4, animation: 'rise', children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This keeps the previous small scale and vertical movement without content blur." }), _jsx(Button, { onClick: () => setRiseModalOpen(false), children: "Close" })] }) }), _jsx(Modal, { open: dangerModalOpen, onOpenChange: setDangerModalOpen, title: 'Danger modal', description: 'Strong colored overlay, danger border and compact radius.', maxWidth: 500, overlayColor: '#3b0712', overlayOpacity: 0.48, overlayBlur: 3, borderColor: 'color-mix(in srgb, var(--oui-danger) 46%, var(--oui-border))', radius: 8, footer: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: () => setDangerModalOpen(false), children: "Cancel" }), _jsx(Button, { tone: 'danger', onClick: () => {
|
|
9
|
+
setDangerModalOpen(false);
|
|
10
|
+
onToast('Danger action confirmed', 'danger');
|
|
11
|
+
}, children: "Confirm" })] }), children: _jsxs(Stack, { g: 3, children: [_jsx(Text, { color: 'var(--oui-muted)', lh: 1.5, children: "This variant checks a colored backdrop without a hard flash on open or close." }), _jsx(TextField, { value: 'Archive selected record', readOnly: true })] }) }), _jsx(CommandPalette, { open: paletteOpen, onOpenChange: setPaletteOpen, items: commandItems, recentItems: commandItems.slice(1, 3), globalOpenEvents: ['orcestr:open-command-palette'], onSelect: (value) => onToast(`Command selected: ${value}`, 'info') })] }));
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CodeExample } from './codeSamples';
|
|
2
|
+
type SetOpen = (open: boolean) => void;
|
|
3
|
+
type OverlaysSectionProps = {
|
|
4
|
+
setModalOpen: SetOpen;
|
|
5
|
+
setBlurModalOpen: SetOpen;
|
|
6
|
+
setFastModalOpen: SetOpen;
|
|
7
|
+
setRiseModalOpen: SetOpen;
|
|
8
|
+
setSlowModalOpen: SetOpen;
|
|
9
|
+
setDangerModalOpen: SetOpen;
|
|
10
|
+
onOpenCode: (example: CodeExample) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function OverlaysSection({ setModalOpen, setBlurModalOpen, setFastModalOpen, setRiseModalOpen, setSlowModalOpen, setDangerModalOpen, onOpenCode, }: OverlaysSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=ExampleOverlaysSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExampleOverlaysSection.d.ts","sourceRoot":"","sources":["../../src/example/ExampleOverlaysSection.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAc,KAAK,WAAW,EAAC,MAAM,eAAe,CAAC;AAG5D,KAAK,OAAO,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;AAEvC,KAAK,oBAAoB,GAAG;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,CAAC;CAC9C,CAAC;AAgEF,wBAAgB,eAAe,CAAC,EAC5B,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,GACb,EAAE,oBAAoB,2CA+OtB"}
|