@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,596 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { Badge, Button, Flex, ScrollArea, Stack, Text, } from '..';
|
|
5
|
+
export const themePlaygroundPresets = [
|
|
6
|
+
{
|
|
7
|
+
id: 'orcestr-dark',
|
|
8
|
+
label: {
|
|
9
|
+
ru: 'Orcestr темная',
|
|
10
|
+
en: 'Orcestr dark',
|
|
11
|
+
},
|
|
12
|
+
description: {
|
|
13
|
+
ru: 'Нейтральная темная база платформы.',
|
|
14
|
+
en: 'Neutral dark platform base.',
|
|
15
|
+
},
|
|
16
|
+
mode: 'dark',
|
|
17
|
+
surface: 'orcestr',
|
|
18
|
+
accent: '#6ea0ff',
|
|
19
|
+
previewBg: '#111318',
|
|
20
|
+
previewPanel: '#171a21',
|
|
21
|
+
previewText: '#f4f6f8',
|
|
22
|
+
group: 'dark',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 'operations-dark',
|
|
26
|
+
label: {
|
|
27
|
+
ru: 'Operations',
|
|
28
|
+
en: 'Operations',
|
|
29
|
+
},
|
|
30
|
+
description: {
|
|
31
|
+
ru: 'Плотная тема для повторяющейся операционной работы.',
|
|
32
|
+
en: 'Dense theme for repeated operational work.',
|
|
33
|
+
},
|
|
34
|
+
mode: 'dark',
|
|
35
|
+
surface: 'operations',
|
|
36
|
+
accent: '#34d399',
|
|
37
|
+
previewBg: '#07140f',
|
|
38
|
+
previewPanel: '#0d2119',
|
|
39
|
+
previewText: '#e8fff5',
|
|
40
|
+
group: 'dark',
|
|
41
|
+
overrides: {
|
|
42
|
+
colors: {
|
|
43
|
+
bg: '#07140f',
|
|
44
|
+
panel: '#0d2119',
|
|
45
|
+
panelSoft: '#133126',
|
|
46
|
+
floating: '#0d2119',
|
|
47
|
+
brand: '#34d399',
|
|
48
|
+
brandStrong: '#86efac',
|
|
49
|
+
brandSolid: '#059669',
|
|
50
|
+
brandSolidHover: '#10b981',
|
|
51
|
+
brandSoft: 'rgb(52 211 153 / 16%)',
|
|
52
|
+
selected: 'rgb(52 211 153 / 14%)',
|
|
53
|
+
info: '#7dd3fc',
|
|
54
|
+
infoSoft: '#0b3240',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
id: 'deep-black',
|
|
60
|
+
label: {
|
|
61
|
+
ru: 'Глубокий черный',
|
|
62
|
+
en: 'Deep black',
|
|
63
|
+
},
|
|
64
|
+
description: {
|
|
65
|
+
ru: 'Абсолютно черная база для OLED-интерфейсов.',
|
|
66
|
+
en: 'Absolute black base for OLED interfaces.',
|
|
67
|
+
},
|
|
68
|
+
mode: 'dark',
|
|
69
|
+
surface: 'orcestr',
|
|
70
|
+
accent: '#8ab4ff',
|
|
71
|
+
previewBg: '#000000',
|
|
72
|
+
previewPanel: '#050505',
|
|
73
|
+
previewText: '#f7f7f7',
|
|
74
|
+
group: 'dark',
|
|
75
|
+
overrides: {
|
|
76
|
+
colors: {
|
|
77
|
+
bg: '#000000',
|
|
78
|
+
panel: '#050505',
|
|
79
|
+
panelSoft: '#0a0a0a',
|
|
80
|
+
floating: '#050505',
|
|
81
|
+
section: 'rgb(255 255 255 / 1.5%)',
|
|
82
|
+
sectionNested: 'rgb(255 255 255 / 1%)',
|
|
83
|
+
pad: 'rgb(255 255 255 / 2.5%)',
|
|
84
|
+
padHover: 'rgb(255 255 255 / 5%)',
|
|
85
|
+
controlHover: 'rgb(255 255 255 / 6%)',
|
|
86
|
+
border: 'rgb(255 255 255 / 7%)',
|
|
87
|
+
borderStrong: 'rgb(255 255 255 / 12%)',
|
|
88
|
+
text: '#f7f7f7',
|
|
89
|
+
muted: '#9a9a9a',
|
|
90
|
+
brand: '#8ab4ff',
|
|
91
|
+
brandStrong: '#b7d1ff',
|
|
92
|
+
brandSolid: '#2759c7',
|
|
93
|
+
brandSolidHover: '#3369e6',
|
|
94
|
+
brandSoft: 'rgb(138 180 255 / 17%)',
|
|
95
|
+
selected: 'rgb(138 180 255 / 14%)',
|
|
96
|
+
focusRing: '0 0 0 3px rgb(138 180 255 / 20%)',
|
|
97
|
+
skeletonShimmer: 'rgb(255 255 255 / 7%)',
|
|
98
|
+
},
|
|
99
|
+
shadows: {
|
|
100
|
+
sm: 'none',
|
|
101
|
+
md: '0 18px 58px rgb(0 0 0 / 72%)',
|
|
102
|
+
overlay: '0 28px 90px rgb(0 0 0 / 82%)',
|
|
103
|
+
section: 'none',
|
|
104
|
+
},
|
|
105
|
+
components: {
|
|
106
|
+
buttonRadius: '5px',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'graphite',
|
|
112
|
+
label: {
|
|
113
|
+
ru: 'Графит',
|
|
114
|
+
en: 'Graphite',
|
|
115
|
+
},
|
|
116
|
+
description: {
|
|
117
|
+
ru: 'Сдержанная аналитика и административные экраны.',
|
|
118
|
+
en: 'Restrained analytics and admin screens.',
|
|
119
|
+
},
|
|
120
|
+
mode: 'dark',
|
|
121
|
+
surface: 'orcestr',
|
|
122
|
+
accent: '#c4d3e8',
|
|
123
|
+
previewBg: '#111111',
|
|
124
|
+
previewPanel: '#1a1a1a',
|
|
125
|
+
previewText: '#eeeeee',
|
|
126
|
+
group: 'dark',
|
|
127
|
+
overrides: {
|
|
128
|
+
colors: {
|
|
129
|
+
bg: '#111111',
|
|
130
|
+
panel: '#1a1a1a',
|
|
131
|
+
panelSoft: '#242424',
|
|
132
|
+
floating: '#1b1b1b',
|
|
133
|
+
brand: '#c4d3e8',
|
|
134
|
+
brandStrong: '#e4edf8',
|
|
135
|
+
brandSolid: '#5d6f87',
|
|
136
|
+
brandSolidHover: '#71839b',
|
|
137
|
+
brandSoft: 'rgb(196 211 232 / 14%)',
|
|
138
|
+
selected: 'rgb(196 211 232 / 12%)',
|
|
139
|
+
info: '#8ecae6',
|
|
140
|
+
infoSoft: '#122f3a',
|
|
141
|
+
},
|
|
142
|
+
radii: {
|
|
143
|
+
md: '5px',
|
|
144
|
+
lg: '7px',
|
|
145
|
+
xl: '10px',
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: 'media-dark',
|
|
151
|
+
label: {
|
|
152
|
+
ru: 'Media dark',
|
|
153
|
+
en: 'Media dark',
|
|
154
|
+
},
|
|
155
|
+
description: {
|
|
156
|
+
ru: 'Мягкая темная тема для контентных интерфейсов.',
|
|
157
|
+
en: 'Soft dark theme for content-heavy interfaces.',
|
|
158
|
+
},
|
|
159
|
+
mode: 'dark',
|
|
160
|
+
surface: 'media',
|
|
161
|
+
accent: '#fb7185',
|
|
162
|
+
previewBg: '#120d0e',
|
|
163
|
+
previewPanel: '#2a1222',
|
|
164
|
+
previewText: '#fff0f6',
|
|
165
|
+
group: 'dark',
|
|
166
|
+
overrides: {
|
|
167
|
+
colors: {
|
|
168
|
+
bg: '#120d0e',
|
|
169
|
+
panel: '#2a1222',
|
|
170
|
+
panelSoft: '#3a1830',
|
|
171
|
+
floating: '#2a1222',
|
|
172
|
+
brand: '#fb7185',
|
|
173
|
+
brandStrong: '#fda4af',
|
|
174
|
+
brandSolid: '#be123c',
|
|
175
|
+
brandSolidHover: '#e11d48',
|
|
176
|
+
brandSoft: 'rgb(251 113 133 / 18%)',
|
|
177
|
+
selected: 'rgb(251 113 133 / 15%)',
|
|
178
|
+
warning: '#fbbf24',
|
|
179
|
+
warningSoft: '#4a2f0b',
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: 'catalog-dark',
|
|
185
|
+
label: {
|
|
186
|
+
ru: 'Catalog dark',
|
|
187
|
+
en: 'Catalog dark',
|
|
188
|
+
},
|
|
189
|
+
description: {
|
|
190
|
+
ru: 'Точная темная тема для структурированных каталогов.',
|
|
191
|
+
en: 'Precise dark theme for structured index surfaces.',
|
|
192
|
+
},
|
|
193
|
+
mode: 'dark',
|
|
194
|
+
surface: 'catalog',
|
|
195
|
+
accent: '#e6c26a',
|
|
196
|
+
previewBg: '#11100d',
|
|
197
|
+
previewPanel: '#191712',
|
|
198
|
+
previewText: '#f8f1dd',
|
|
199
|
+
group: 'dark',
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
id: 'midnight',
|
|
203
|
+
label: {
|
|
204
|
+
ru: 'Полночь',
|
|
205
|
+
en: 'Midnight',
|
|
206
|
+
},
|
|
207
|
+
description: {
|
|
208
|
+
ru: 'Сине-черная диспетчерская тема.',
|
|
209
|
+
en: 'Blue-black dispatcher theme.',
|
|
210
|
+
},
|
|
211
|
+
mode: 'dark',
|
|
212
|
+
surface: 'orcestr',
|
|
213
|
+
accent: '#a78bfa',
|
|
214
|
+
previewBg: '#09091f',
|
|
215
|
+
previewPanel: '#121234',
|
|
216
|
+
previewText: '#edf5ff',
|
|
217
|
+
group: 'dark',
|
|
218
|
+
overrides: {
|
|
219
|
+
colors: {
|
|
220
|
+
bg: '#09091f',
|
|
221
|
+
panel: '#121234',
|
|
222
|
+
panelSoft: '#1b1b4a',
|
|
223
|
+
floating: '#121234',
|
|
224
|
+
brand: '#a78bfa',
|
|
225
|
+
brandStrong: '#c4b5fd',
|
|
226
|
+
brandSolid: '#7c3aed',
|
|
227
|
+
brandSolidHover: '#8b5cf6',
|
|
228
|
+
brandSoft: 'rgb(167 139 250 / 17%)',
|
|
229
|
+
selected: 'rgb(167 139 250 / 14%)',
|
|
230
|
+
info: '#22d3ee',
|
|
231
|
+
infoSoft: '#083344',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: 'orcestr-light',
|
|
237
|
+
label: {
|
|
238
|
+
ru: 'Orcestr светлая',
|
|
239
|
+
en: 'Orcestr light',
|
|
240
|
+
},
|
|
241
|
+
description: {
|
|
242
|
+
ru: 'Чистая светлая база продукта.',
|
|
243
|
+
en: 'Clean light product base.',
|
|
244
|
+
},
|
|
245
|
+
mode: 'light',
|
|
246
|
+
surface: 'orcestr',
|
|
247
|
+
accent: '#2563eb',
|
|
248
|
+
previewBg: '#f8fafc',
|
|
249
|
+
previewPanel: '#ffffff',
|
|
250
|
+
previewText: '#111827',
|
|
251
|
+
group: 'light',
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
id: 'operations-light',
|
|
255
|
+
label: {
|
|
256
|
+
ru: 'Operations light',
|
|
257
|
+
en: 'Operations light',
|
|
258
|
+
},
|
|
259
|
+
description: {
|
|
260
|
+
ru: 'Плотная светлая тема для повторяющейся операционной работы.',
|
|
261
|
+
en: 'Dense light theme for repeated operational work.',
|
|
262
|
+
},
|
|
263
|
+
mode: 'light',
|
|
264
|
+
surface: 'operations',
|
|
265
|
+
accent: '#047857',
|
|
266
|
+
previewBg: '#eefbf4',
|
|
267
|
+
previewPanel: '#ffffff',
|
|
268
|
+
previewText: '#092016',
|
|
269
|
+
group: 'light',
|
|
270
|
+
overrides: {
|
|
271
|
+
colors: {
|
|
272
|
+
bg: '#eefbf4',
|
|
273
|
+
panel: '#ffffff',
|
|
274
|
+
panelSoft: '#ddf4e8',
|
|
275
|
+
brand: '#047857',
|
|
276
|
+
brandStrong: '#065f46',
|
|
277
|
+
brandSolid: '#047857',
|
|
278
|
+
brandSolidHover: '#065f46',
|
|
279
|
+
brandSoft: 'rgb(4 120 87 / 12%)',
|
|
280
|
+
selected: 'rgb(4 120 87 / 10%)',
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
id: 'media-light',
|
|
286
|
+
label: {
|
|
287
|
+
ru: 'Media light',
|
|
288
|
+
en: 'Media light',
|
|
289
|
+
},
|
|
290
|
+
description: {
|
|
291
|
+
ru: 'Мягкая светлая тема для контентных интерфейсов.',
|
|
292
|
+
en: 'Soft light theme for content-heavy interfaces.',
|
|
293
|
+
},
|
|
294
|
+
mode: 'light',
|
|
295
|
+
surface: 'media',
|
|
296
|
+
accent: '#db2777',
|
|
297
|
+
previewBg: '#fff1f8',
|
|
298
|
+
previewPanel: '#ffffff',
|
|
299
|
+
previewText: '#181018',
|
|
300
|
+
group: 'light',
|
|
301
|
+
overrides: {
|
|
302
|
+
colors: {
|
|
303
|
+
bg: '#fff1f8',
|
|
304
|
+
panel: '#ffffff',
|
|
305
|
+
panelSoft: '#ffe4f2',
|
|
306
|
+
brand: '#db2777',
|
|
307
|
+
brandStrong: '#be185d',
|
|
308
|
+
brandSolid: '#db2777',
|
|
309
|
+
brandSolidHover: '#be185d',
|
|
310
|
+
brandSoft: 'rgb(219 39 119 / 12%)',
|
|
311
|
+
selected: 'rgb(219 39 119 / 10%)',
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
id: 'catalog-light',
|
|
317
|
+
label: {
|
|
318
|
+
ru: 'Catalog light',
|
|
319
|
+
en: 'Catalog light',
|
|
320
|
+
},
|
|
321
|
+
description: {
|
|
322
|
+
ru: 'Теплая светлая тема для структурированных каталогов.',
|
|
323
|
+
en: 'Warm light theme for structured index surfaces.',
|
|
324
|
+
},
|
|
325
|
+
mode: 'light',
|
|
326
|
+
surface: 'catalog',
|
|
327
|
+
accent: '#9b6f12',
|
|
328
|
+
previewBg: '#fbfaf6',
|
|
329
|
+
previewPanel: '#ffffff',
|
|
330
|
+
previewText: '#211a0f',
|
|
331
|
+
group: 'light',
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: 'porcelain',
|
|
335
|
+
label: {
|
|
336
|
+
ru: 'Фарфор',
|
|
337
|
+
en: 'Porcelain',
|
|
338
|
+
},
|
|
339
|
+
description: {
|
|
340
|
+
ru: 'Спокойная белая редакционная среда.',
|
|
341
|
+
en: 'Calm white editorial workspace.',
|
|
342
|
+
},
|
|
343
|
+
mode: 'light',
|
|
344
|
+
surface: 'orcestr',
|
|
345
|
+
accent: '#7c3aed',
|
|
346
|
+
previewBg: '#f8f5ff',
|
|
347
|
+
previewPanel: '#ffffff',
|
|
348
|
+
previewText: '#1d1435',
|
|
349
|
+
group: 'light',
|
|
350
|
+
overrides: {
|
|
351
|
+
colors: {
|
|
352
|
+
bg: '#f8f5ff',
|
|
353
|
+
panel: '#ffffff',
|
|
354
|
+
panelSoft: '#ede9fe',
|
|
355
|
+
brand: '#7c3aed',
|
|
356
|
+
brandStrong: '#5b21b6',
|
|
357
|
+
brandSolid: '#7c3aed',
|
|
358
|
+
brandSolidHover: '#6d28d9',
|
|
359
|
+
brandSoft: 'rgb(124 58 237 / 10%)',
|
|
360
|
+
selected: 'rgb(124 58 237 / 8%)',
|
|
361
|
+
section: 'rgb(124 58 237 / 3%)',
|
|
362
|
+
sectionNested: 'rgb(124 58 237 / 2%)',
|
|
363
|
+
},
|
|
364
|
+
shadows: {
|
|
365
|
+
section: 'none',
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: 'mint-light',
|
|
371
|
+
label: {
|
|
372
|
+
ru: 'Мята светлая',
|
|
373
|
+
en: 'Mint light',
|
|
374
|
+
},
|
|
375
|
+
description: {
|
|
376
|
+
ru: 'Свежая светлая тема для плотных рабочих экранов.',
|
|
377
|
+
en: 'Fresh light theme for dense work screens.',
|
|
378
|
+
},
|
|
379
|
+
mode: 'light',
|
|
380
|
+
surface: 'orcestr',
|
|
381
|
+
accent: '#0f9f6e',
|
|
382
|
+
previewBg: '#f4fbf8',
|
|
383
|
+
previewPanel: '#ffffff',
|
|
384
|
+
previewText: '#0f1f19',
|
|
385
|
+
group: 'light',
|
|
386
|
+
overrides: {
|
|
387
|
+
colors: {
|
|
388
|
+
bg: '#f4fbf8',
|
|
389
|
+
panel: '#ffffff',
|
|
390
|
+
panelSoft: '#eaf7f1',
|
|
391
|
+
brand: '#0f9f6e',
|
|
392
|
+
brandStrong: '#087a54',
|
|
393
|
+
brandSolid: '#0f9f6e',
|
|
394
|
+
brandSolidHover: '#0b8a5e',
|
|
395
|
+
brandSoft: 'rgb(15 159 110 / 11%)',
|
|
396
|
+
selected: 'rgb(15 159 110 / 9%)',
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
];
|
|
401
|
+
const themePresetGroups = [
|
|
402
|
+
{ key: 'dark', label: { ru: 'Темные', en: 'Dark' } },
|
|
403
|
+
{ key: 'light', label: { ru: 'Светлые', en: 'Light' } },
|
|
404
|
+
];
|
|
405
|
+
export function getThemePlaygroundPreset(id) {
|
|
406
|
+
return themePlaygroundPresets.find((preset) => preset.id === id) ?? themePlaygroundPresets[0];
|
|
407
|
+
}
|
|
408
|
+
export function themePresetLabel(preset, locale) {
|
|
409
|
+
return preset.label[locale];
|
|
410
|
+
}
|
|
411
|
+
export function themePresetDescription(preset, locale) {
|
|
412
|
+
return preset.description[locale];
|
|
413
|
+
}
|
|
414
|
+
const flatTokenSections = [
|
|
415
|
+
'colors',
|
|
416
|
+
'radii',
|
|
417
|
+
'spacing',
|
|
418
|
+
'breakpoints',
|
|
419
|
+
'shadows',
|
|
420
|
+
'typography',
|
|
421
|
+
'motion',
|
|
422
|
+
'toast',
|
|
423
|
+
'states',
|
|
424
|
+
'density',
|
|
425
|
+
'zIndex',
|
|
426
|
+
'components',
|
|
427
|
+
];
|
|
428
|
+
const statusKeys = ['neutral', 'brand', 'success', 'warning', 'danger', 'info'];
|
|
429
|
+
const COLOR_TOKEN_COMMIT_DELAY_MS = 180;
|
|
430
|
+
const themePlaygroundCopy = {
|
|
431
|
+
ru: {
|
|
432
|
+
title: 'Песочница тем',
|
|
433
|
+
description: 'Выберите базовую тему и редактируйте токены вживую. Вся страница примеров использует текущий набор токенов.',
|
|
434
|
+
tokenEditor: 'Редактор токенов',
|
|
435
|
+
resetPreset: 'Сбросить пресет',
|
|
436
|
+
primaryAction: 'Основное действие',
|
|
437
|
+
surface: 'Поверхность',
|
|
438
|
+
secondary: 'Вторичное',
|
|
439
|
+
ready: 'готово',
|
|
440
|
+
warning: 'внимание',
|
|
441
|
+
statuses: 'Статусы',
|
|
442
|
+
tokenSections: {
|
|
443
|
+
colors: 'Цвета',
|
|
444
|
+
radii: 'Радиусы',
|
|
445
|
+
spacing: 'Отступы',
|
|
446
|
+
breakpoints: 'Брейкпоинты',
|
|
447
|
+
shadows: 'Тени',
|
|
448
|
+
typography: 'Типографика',
|
|
449
|
+
motion: 'Движение',
|
|
450
|
+
toast: 'Toast',
|
|
451
|
+
states: 'Состояния',
|
|
452
|
+
density: 'Плотность',
|
|
453
|
+
zIndex: 'Z-index',
|
|
454
|
+
components: 'Компоненты',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
en: {
|
|
458
|
+
title: 'Theme playground',
|
|
459
|
+
description: 'Choose a base theme and edit tokens live. The whole example page uses the current token set.',
|
|
460
|
+
tokenEditor: 'Token editor',
|
|
461
|
+
resetPreset: 'Reset preset',
|
|
462
|
+
primaryAction: 'Primary action',
|
|
463
|
+
surface: 'Surface',
|
|
464
|
+
secondary: 'Secondary',
|
|
465
|
+
ready: 'ready',
|
|
466
|
+
warning: 'warning',
|
|
467
|
+
statuses: 'Statuses',
|
|
468
|
+
tokenSections: {
|
|
469
|
+
colors: 'Colors',
|
|
470
|
+
radii: 'Radii',
|
|
471
|
+
spacing: 'Spacing',
|
|
472
|
+
breakpoints: 'Breakpoints',
|
|
473
|
+
shadows: 'Shadows',
|
|
474
|
+
typography: 'Typography',
|
|
475
|
+
motion: 'Motion',
|
|
476
|
+
toast: 'Toast',
|
|
477
|
+
states: 'States',
|
|
478
|
+
density: 'Density',
|
|
479
|
+
zIndex: 'Z-index',
|
|
480
|
+
components: 'Components',
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
export function ExampleThemePlayground({ activePresetId, theme, locale, onPresetChange, onThemeOverridesChange, }) {
|
|
485
|
+
const activePreset = getThemePlaygroundPreset(activePresetId);
|
|
486
|
+
const copy = themePlaygroundCopy[locale];
|
|
487
|
+
return (_jsxs("section", { id: 'theme', className: 'oui-section oui-ui-section', children: [_jsx("div", { className: 'oui-ui-section-head', children: _jsxs("div", { children: [_jsx("h2", { className: 'oui-ui-section-title', children: copy.title }), _jsx("p", { className: 'oui-ui-description', children: copy.description })] }) }), _jsxs("div", { className: 'oui-theme-playground', children: [_jsx(Stack, { className: 'oui-theme-playground-presets', g: 2, children: _jsx(ThemePresetSelector, { activePresetId: activePreset.id, locale: locale, onPresetChange: onPresetChange }) }), _jsxs("div", { className: 'oui-section oui-theme-preview', children: [_jsxs("div", { className: 'oui-theme-preview-head', children: [_jsx(Text, { fw: 760, children: copy.tokenEditor }), _jsx(Button, { size: 1, v: 'surface', onClick: () => onPresetChange(activePreset), children: copy.resetPreset })] }), _jsxs(ScrollArea, { className: 'oui-theme-preview-scroll', highlights: true, highlightColor: 'var(--oui-section-nested-solid-bg)', highlightTop: {
|
|
488
|
+
start: 2,
|
|
489
|
+
fadeDistance: 28,
|
|
490
|
+
maxOpacity: 0.94,
|
|
491
|
+
}, highlightBottom: {
|
|
492
|
+
start: 2,
|
|
493
|
+
fadeDistance: 28,
|
|
494
|
+
maxOpacity: 0.94,
|
|
495
|
+
}, children: [_jsxs("div", { className: 'oui-theme-token-editor', children: [flatTokenSections.map((section) => (_jsx(TokenSection, { title: tokenSectionLabel(section, locale), section: section, values: theme[section], onTokenChange: (key, value) => updateFlatToken(onThemeOverridesChange, section, key, value) }, section))), statusKeys.map((statusKey) => (_jsx(TokenSection, { title: `${copy.statuses} / ${statusKey}`, section: 'status', statusKey: statusKey, values: theme.status[statusKey], onTokenChange: (key, value) => updateStatusToken(onThemeOverridesChange, statusKey, key, String(value)) }, `status-${statusKey}`)))] }), _jsxs(Flex, { g: 2, wrap: true, children: [_jsx(Button, { size: 1, children: copy.primaryAction }), _jsx(Button, { size: 1, v: 'surface', children: copy.surface }), _jsx(Button, { size: 1, v: 'ghost', children: copy.secondary }), _jsx(Badge, { tone: 'success', children: copy.ready }), _jsx(Badge, { tone: 'warning', children: copy.warning })] })] })] })] })] }));
|
|
496
|
+
}
|
|
497
|
+
export function ThemePresetSelector({ activePresetId, locale, onPresetChange, }) {
|
|
498
|
+
return (_jsx("div", { className: 'oui-theme-preset-grid', children: themePresetGroups.map((group) => (_jsxs("div", { className: 'oui-theme-preset-group', children: [_jsx("div", { className: 'oui-theme-preset-group-label', children: group.label[locale] }), _jsx(ScrollArea, { className: 'oui-theme-preset-scroll', highlights: true, highlightColor: 'var(--oui-section-solid-bg)', highlightTop: {
|
|
499
|
+
start: 1,
|
|
500
|
+
fadeDistance: 18,
|
|
501
|
+
maxOpacity: 0.94,
|
|
502
|
+
}, highlightBottom: {
|
|
503
|
+
start: 1,
|
|
504
|
+
fadeDistance: 18,
|
|
505
|
+
maxOpacity: 0.94,
|
|
506
|
+
}, children: _jsx("div", { className: 'oui-theme-preset-list', children: themePlaygroundPresets
|
|
507
|
+
.filter((preset) => preset.group === group.key)
|
|
508
|
+
.map((preset) => (_jsxs("button", { type: 'button', className: 'oui-theme-preset-card', "data-active": activePresetId === preset.id ? 'true' : undefined, style: themePresetPreviewStyle(preset), onClick: () => onPresetChange(preset), children: [_jsxs("span", { className: 'oui-theme-preset-preview', children: [_jsx("span", {}), _jsx("span", {}), _jsx("span", {})] }), _jsxs("span", { className: 'oui-theme-preset-body', children: [_jsx("strong", { children: themePresetLabel(preset, locale) }), _jsx("span", { children: themePresetDescription(preset, locale) })] })] }, preset.id))) }) })] }, group.key))) }));
|
|
509
|
+
}
|
|
510
|
+
export function themePresetPreviewStyle(preset) {
|
|
511
|
+
return {
|
|
512
|
+
'--oui-theme-preset-bg': preset.previewBg,
|
|
513
|
+
'--oui-theme-preset-panel': preset.previewPanel,
|
|
514
|
+
'--oui-theme-preset-text': preset.previewText,
|
|
515
|
+
'--oui-theme-preset-accent': preset.accent,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function TokenSection({ title, section, statusKey, values, onTokenChange, }) {
|
|
519
|
+
return (_jsxs("div", { className: 'oui-theme-token-section', children: [_jsx(Text, { fs: '12px', fw: 760, tone: 'muted', children: title }), _jsx("div", { className: 'oui-theme-token-grid', children: Object.entries(values).map(([key, value]) => (_jsx(ThemeTokenControl, { label: readableTokenName(key), path: statusKey ? `${statusKey}.${key}` : key, section: section, value: value, onChange: (next) => onTokenChange(key, next) }, `${title}-${key}`))) })] }));
|
|
520
|
+
}
|
|
521
|
+
function ThemeTokenControl({ label, path, section, value, onChange, }) {
|
|
522
|
+
const valueText = String(value);
|
|
523
|
+
const colorInputValue = colorInputHex(valueText);
|
|
524
|
+
const [colorDraft, setColorDraft] = useState(colorInputValue);
|
|
525
|
+
const selectOptions = selectOptionsForToken(path);
|
|
526
|
+
const visibleColorValue = colorDraft ?? colorInputValue;
|
|
527
|
+
useEffect(() => {
|
|
528
|
+
setColorDraft(colorInputValue);
|
|
529
|
+
}, [colorInputValue]);
|
|
530
|
+
useEffect(() => {
|
|
531
|
+
if (!colorDraft || colorDraft === colorInputValue)
|
|
532
|
+
return;
|
|
533
|
+
const timer = window.setTimeout(() => onChange(colorDraft), COLOR_TOKEN_COMMIT_DELAY_MS);
|
|
534
|
+
return () => window.clearTimeout(timer);
|
|
535
|
+
}, [colorDraft, colorInputValue, onChange]);
|
|
536
|
+
const commitColorDraft = () => {
|
|
537
|
+
if (!colorDraft || colorDraft === colorInputValue)
|
|
538
|
+
return;
|
|
539
|
+
onChange(colorDraft);
|
|
540
|
+
};
|
|
541
|
+
return (_jsxs("div", { className: 'oui-theme-token oui-theme-token-control', children: [_jsx("span", { className: 'oui-theme-token-swatch', style: {
|
|
542
|
+
background: visibleColorValue ?? (section === 'colors' || section === 'status'
|
|
543
|
+
? valueText
|
|
544
|
+
: 'var(--oui-brand-soft)'),
|
|
545
|
+
}, children: colorInputValue ? (_jsx("input", { className: 'oui-theme-token-swatch-input', type: 'color', value: visibleColorValue ?? colorInputValue, "aria-label": `${label} color`, onChange: (event) => setColorDraft(event.target.value), onBlur: commitColorDraft })) : null }), _jsxs("span", { className: 'oui-theme-token-text', children: [_jsx(Text, { fs: '12px', fw: 700, children: label }), _jsx(Text, { fs: '11px', tone: 'muted', children: path })] }), _jsx("span", { className: 'oui-theme-token-control-field', children: selectOptions ? (_jsx("select", { value: valueText, "aria-label": label, onChange: (event) => onChange(event.target.value), children: selectOptions.map((option) => (_jsx("option", { value: option, children: option }, option))) })) : (_jsx("input", { type: typeof value === 'number' ? 'number' : 'text', value: valueText, "aria-label": label, onChange: (event) => onChange(typeof value === 'number' ? Number(event.target.value) : event.target.value) })) })] }));
|
|
546
|
+
}
|
|
547
|
+
function updateFlatToken(updateOverrides, section, key, value) {
|
|
548
|
+
updateOverrides((current) => ({
|
|
549
|
+
...current,
|
|
550
|
+
[section]: {
|
|
551
|
+
...(current[section] ?? {}),
|
|
552
|
+
[key]: value,
|
|
553
|
+
},
|
|
554
|
+
}));
|
|
555
|
+
}
|
|
556
|
+
function updateStatusToken(updateOverrides, statusKey, key, value) {
|
|
557
|
+
updateOverrides((current) => ({
|
|
558
|
+
...current,
|
|
559
|
+
status: {
|
|
560
|
+
...current.status,
|
|
561
|
+
[statusKey]: {
|
|
562
|
+
...(current.status?.[statusKey] ?? {}),
|
|
563
|
+
[key]: value,
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
}));
|
|
567
|
+
}
|
|
568
|
+
function tokenSectionLabel(section, locale) {
|
|
569
|
+
return themePlaygroundCopy[locale].tokenSections[section];
|
|
570
|
+
}
|
|
571
|
+
function readableTokenName(value) {
|
|
572
|
+
return value.replace(/([A-Z])/g, ' $1').replace(/^./, (letter) => letter.toUpperCase());
|
|
573
|
+
}
|
|
574
|
+
function colorInputHex(value) {
|
|
575
|
+
const hex = value.trim();
|
|
576
|
+
if (/^#[0-9a-f]{6}$/i.test(hex))
|
|
577
|
+
return hex;
|
|
578
|
+
if (/^#[0-9a-f]{3}$/i.test(hex)) {
|
|
579
|
+
const [, r, g, b] = hex;
|
|
580
|
+
return `#${r}${r}${g}${g}${b}${b}`;
|
|
581
|
+
}
|
|
582
|
+
const rgb = hex.match(/^rgba?\((\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
|
|
583
|
+
if (!rgb)
|
|
584
|
+
return null;
|
|
585
|
+
return `#${toHex(Number(rgb[1]))}${toHex(Number(rgb[2]))}${toHex(Number(rgb[3]))}`;
|
|
586
|
+
}
|
|
587
|
+
function toHex(value) {
|
|
588
|
+
return Math.max(0, Math.min(255, value)).toString(16).padStart(2, '0');
|
|
589
|
+
}
|
|
590
|
+
function selectOptionsForToken(path) {
|
|
591
|
+
if (path === 'modalAnimation')
|
|
592
|
+
return ['zoom-blur', 'rise', 'fade'];
|
|
593
|
+
if (path === 'pressAnimation')
|
|
594
|
+
return ['translate', 'scale', 'soft', 'none'];
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UiExamplePage.d.ts","sourceRoot":"","sources":["../../src/example/UiExamplePage.tsx"],"names":[],"mappings":"AAwmBA,wBAAgB,aAAa,4CAmC5B"}
|