@orcestr/ui 0.0.1 → 0.1.0
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 +4 -0
- package/README.ru.md +4 -0
- package/dist/components/Alert/Alert.d.ts +5 -4
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.d.ts +2 -0
- package/dist/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/components/AppShell/AppShell.js +9 -6
- package/dist/components/AppSidebar/AppSidebar.d.ts +36 -0
- package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -0
- package/dist/components/AppSidebar/AppSidebar.js +53 -0
- package/dist/components/Badge/Badge.d.ts +8 -6
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +4 -4
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts +22 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts.map +1 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.js +50 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +15 -2
- package/dist/components/Button/Button.d.ts +7 -3
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +23 -3
- package/dist/components/Card/Card.d.ts +26 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +25 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +13 -4
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +10 -9
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js +5 -2
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +9 -1
- package/dist/components/Dialog/Dialog.d.ts +69 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +48 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/EntityPicker/EntityPicker.d.ts +2 -1
- package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -1
- package/dist/components/EntityPicker/EntityPicker.js +2 -2
- package/dist/components/Flex/Flex.d.ts +5 -1
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +16 -3
- package/dist/components/Grid/Grid.d.ts +9 -2
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.js +22 -1
- package/dist/components/IconButton/IconButton.d.ts +19 -7
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js +40 -5
- package/dist/components/IconTextButton/IconTextButton.d.ts +20 -0
- package/dist/components/IconTextButton/IconTextButton.d.ts.map +1 -0
- package/dist/components/IconTextButton/IconTextButton.js +24 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts +63 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts.map +1 -0
- package/dist/components/InlineEdit/InlineEdit.js +98 -0
- package/dist/components/LinkButton/LinkButton.d.ts +25 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +12 -0
- package/dist/components/Modal/Modal.d.ts +29 -6
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +37 -13
- package/dist/components/Overlay/OverlayProvider.d.ts +1 -0
- package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -1
- package/dist/components/Overlay/OverlayProvider.js +18 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +2 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.js +3 -3
- package/dist/components/Popover/Popover.d.ts +37 -3
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +56 -9
- package/dist/components/ScrollArea/ScrollArea.d.ts +4 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +30 -4
- package/dist/components/Section/Section.d.ts +2 -0
- package/dist/components/Section/Section.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +28 -2
- package/dist/components/Select/Select.d.ts +36 -4
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +70 -3
- package/dist/components/Separator/Separator.d.ts +3 -1
- package/dist/components/Separator/Separator.d.ts.map +1 -1
- package/dist/components/Separator/Separator.js +4 -2
- package/dist/components/SpecialModal/SpecialModal.d.ts +43 -0
- package/dist/components/SpecialModal/SpecialModal.d.ts.map +1 -0
- package/dist/components/SpecialModal/SpecialModal.js +34 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/State/State.d.ts +8 -1
- package/dist/components/State/State.d.ts.map +1 -1
- package/dist/components/State/State.js +2 -2
- package/dist/components/Switch/Switch.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +2 -1
- package/dist/components/Table/Table.d.ts +64 -0
- package/dist/components/Table/Table.d.ts.map +1 -0
- package/dist/components/Table/Table.js +38 -0
- package/dist/components/Tabs/Tabs.d.ts +33 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +189 -4
- package/dist/components/Text/Text.d.ts +13 -3
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +16 -3
- package/dist/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +19 -8
- package/dist/components/Tooltip/Tooltip.d.ts +11 -3
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +58 -9
- package/dist/example/CodePreview.d.ts.map +1 -1
- package/dist/example/CodePreview.js +3 -3
- package/dist/example/ExampleActionsSection.d.ts.map +1 -1
- package/dist/example/ExampleActionsSection.js +3 -3
- package/dist/example/ExampleApplicationSection.d.ts +7 -0
- package/dist/example/ExampleApplicationSection.d.ts.map +1 -0
- package/dist/example/ExampleApplicationSection.js +68 -0
- package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
- package/dist/example/ExampleBasicsSections.js +5 -9
- package/dist/example/ExampleDataSection.d.ts.map +1 -1
- package/dist/example/ExampleDataSection.js +31 -30
- package/dist/example/ExampleFieldsSection.d.ts.map +1 -1
- package/dist/example/ExampleFieldsSection.js +51 -3
- package/dist/example/ExampleFoundationsSection.js +1 -1
- package/dist/example/ExampleOverlays.d.ts.map +1 -1
- package/dist/example/ExampleOverlays.js +7 -2
- package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
- package/dist/example/ExampleOverlaysSection.js +5 -2
- package/dist/example/ExampleSelectionSection.d.ts +3 -1
- package/dist/example/ExampleSelectionSection.d.ts.map +1 -1
- package/dist/example/ExampleSelectionSection.js +10 -3
- package/dist/example/ExampleStateSection.d.ts +3 -0
- package/dist/example/ExampleStateSection.d.ts.map +1 -1
- package/dist/example/ExampleStateSection.js +58 -3
- package/dist/example/ExampleThemePlayground.d.ts +101 -71
- package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
- package/dist/example/ExampleThemePlayground.js +137 -74
- package/dist/example/UiExamplePage.d.ts +7 -1
- package/dist/example/UiExamplePage.d.ts.map +1 -1
- package/dist/example/UiExamplePage.js +72 -27
- package/dist/example/codeSamples.d.ts +7 -0
- package/dist/example/codeSamples.d.ts.map +1 -1
- package/dist/example/codeSamples.js +429 -60
- package/dist/example/exampleData.d.ts.map +1 -1
- package/dist/example/exampleData.js +16 -2
- package/dist/example/styles.css +245 -74
- package/dist/hooks/useFloatingPosition.js +1 -1
- package/dist/hooks/usePresence.d.ts.map +1 -1
- package/dist/hooks/usePresence.js +9 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/styles/orcestr-ui.css +2545 -672
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +90 -36
- package/dist/theme/defaultTheme.d.ts.map +1 -1
- package/dist/theme/defaultTheme.js +322 -194
- package/dist/theme/systemProps.d.ts +48 -28
- package/dist/theme/systemProps.d.ts.map +1 -1
- package/dist/theme/systemProps.js +103 -1
- package/dist/theme/themeTypes.d.ts +21 -17
- package/dist/theme/themeTypes.d.ts.map +1 -1
- package/dist/utils/slot.d.ts +11 -0
- package/dist/utils/slot.d.ts.map +1 -0
- package/dist/utils/slot.js +18 -0
- package/package.json +2 -2
- package/dist/components/Workflow/Workflow.d.ts +0 -82
- package/dist/components/Workflow/Workflow.d.ts.map +0 -1
- package/dist/components/Workflow/Workflow.js +0 -73
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { LuBell, LuCheck, LuExternalLink, LuRefreshCw, LuTrash2, } from 'react-icons/lu';
|
|
5
|
-
import { AppShell, AppShellContent, AppShellHeader,
|
|
4
|
+
import { LuBell, LuBox, LuCalendar, LuCheck, LuClipboardList, LuExternalLink, LuFileText, LuLayoutDashboard, LuMousePointerClick, LuPanelTop, LuRefreshCw, LuSettings, LuTrash2, } from 'react-icons/lu';
|
|
5
|
+
import { AppShell, AppShellContent, AppShellHeader, AppSidebar, OrcestrUiProvider, ScrollArea, useOrcestrTheme, useToast, } from '..';
|
|
6
6
|
import { LayoutSection, TypographySection } from './ExampleBasicsSections';
|
|
7
7
|
import { ActionsSection } from './ExampleActionsSection';
|
|
8
|
+
import { ApplicationSection } from './ExampleApplicationSection';
|
|
8
9
|
import { FieldsSection } from './ExampleFieldsSection';
|
|
9
10
|
import { SelectionSection } from './ExampleSelectionSection';
|
|
10
11
|
import { DataSection } from './ExampleDataSection';
|
|
11
12
|
import { OverlaysSection } from './ExampleOverlaysSection';
|
|
12
13
|
import { FoundationsSection } from './ExampleFoundationsSection';
|
|
13
|
-
import { IconTextSection, StateCardSection } from './ExampleStateSection';
|
|
14
|
+
import { BadgeSection, IconTextSection, StateCardSection } from './ExampleStateSection';
|
|
14
15
|
import { ExampleThemePlayground, getThemePlaygroundPreset, themePlaygroundPresets, themePresetLabel, themePresetPreviewStyle, } from './ExampleThemePlayground';
|
|
15
16
|
import { CodePreviewModal } from './CodePreview';
|
|
16
17
|
import { ExampleOverlays } from './ExampleOverlays';
|
|
@@ -18,23 +19,34 @@ import {} from './codeSamples';
|
|
|
18
19
|
import { navGroups, navItems } from './exampleData';
|
|
19
20
|
const ORCESTR_LOGO_SRC = '/assets/orcestr/logo.png';
|
|
20
21
|
const UI_EXAMPLE_SCROLL_LEAD = 50;
|
|
21
|
-
|
|
22
|
+
const UI_EXAMPLE_ACTIVE_PROBE_OFFSET = UI_EXAMPLE_SCROLL_LEAD + 220;
|
|
23
|
+
const UI_EXAMPLE_CLICK_TARGET_TOP_TOLERANCE = 180;
|
|
24
|
+
const UI_EXAMPLE_SCROLL_LOCK_TIMEOUT_MS = 1600;
|
|
25
|
+
function scrollUiExampleSection(id, behavior = 'auto') {
|
|
22
26
|
const node = document.getElementById(id);
|
|
23
27
|
const scrollRoot = document.querySelector('.oui-app-shell-content-scroll .oui-scroll-area-viewport');
|
|
24
28
|
if (!node || !scrollRoot) {
|
|
25
|
-
node?.scrollIntoView({ block: 'start', behavior
|
|
29
|
+
node?.scrollIntoView({ block: 'start', behavior });
|
|
26
30
|
return;
|
|
27
31
|
}
|
|
28
32
|
scrollRoot.scrollTo({
|
|
29
33
|
top: uiExampleSectionScrollTop(node, scrollRoot),
|
|
30
|
-
behavior
|
|
34
|
+
behavior,
|
|
31
35
|
});
|
|
32
36
|
}
|
|
33
37
|
function uiExampleSectionScrollTop(node, scrollRoot) {
|
|
34
38
|
const maxTop = scrollRoot
|
|
35
39
|
? Math.max(0, scrollRoot.scrollHeight - scrollRoot.clientHeight)
|
|
36
40
|
: Number.POSITIVE_INFINITY;
|
|
37
|
-
|
|
41
|
+
const targetTop = scrollRoot
|
|
42
|
+
? uiExampleSectionAbsoluteTop(node, scrollRoot)
|
|
43
|
+
: node.offsetTop;
|
|
44
|
+
return Math.min(maxTop, Math.max(0, targetTop - UI_EXAMPLE_SCROLL_LEAD));
|
|
45
|
+
}
|
|
46
|
+
function uiExampleSectionAbsoluteTop(node, scrollRoot) {
|
|
47
|
+
const nodeTop = node.getBoundingClientRect().top;
|
|
48
|
+
const scrollRootTop = scrollRoot.getBoundingClientRect().top;
|
|
49
|
+
return scrollRoot.scrollTop + nodeTop - scrollRootTop;
|
|
38
50
|
}
|
|
39
51
|
function UiExampleContent({ activePresetId, onThemePresetChange, onThemeOverridesChange, locale, onLocaleChange, }) {
|
|
40
52
|
const { theme } = useOrcestrTheme();
|
|
@@ -45,6 +57,7 @@ function UiExampleContent({ activePresetId, onThemePresetChange, onThemeOverride
|
|
|
45
57
|
const [selectPlainValue, setSelectPlainValue] = useState('blocked');
|
|
46
58
|
const [comboValue, setComboValue] = useState('ready');
|
|
47
59
|
const [entityValue, setEntityValue] = useState(null);
|
|
60
|
+
const [paginatedValue, setPaginatedValue] = useState(null);
|
|
48
61
|
const [ownerValues, setOwnerValues] = useState(['anna', 'ops']);
|
|
49
62
|
const [radioValue, setRadioValue] = useState('manual');
|
|
50
63
|
const [tabValue, setTabValue] = useState('overview');
|
|
@@ -70,20 +83,14 @@ function UiExampleContent({ activePresetId, onThemePresetChange, onThemeOverride
|
|
|
70
83
|
document.documentElement.classList.add('oui-ui-document-lock');
|
|
71
84
|
document.body.classList.add('oui-ui-document-lock');
|
|
72
85
|
const hash = window.location.hash.replace('#', '');
|
|
73
|
-
let hashSettleTimer = null;
|
|
74
86
|
const hashFrame = hash
|
|
75
87
|
? window.requestAnimationFrame(() => {
|
|
76
88
|
scrollUiExampleSection(hash);
|
|
77
|
-
hashSettleTimer = window.setTimeout(() => {
|
|
78
|
-
scrollUiExampleSection(hash);
|
|
79
|
-
}, 450);
|
|
80
89
|
})
|
|
81
90
|
: null;
|
|
82
91
|
return () => {
|
|
83
92
|
if (hashFrame !== null)
|
|
84
93
|
window.cancelAnimationFrame(hashFrame);
|
|
85
|
-
if (hashSettleTimer !== null)
|
|
86
|
-
window.clearTimeout(hashSettleTimer);
|
|
87
94
|
document.documentElement.classList.remove('oui-ui-document-lock');
|
|
88
95
|
document.body.classList.remove('oui-ui-document-lock');
|
|
89
96
|
};
|
|
@@ -166,7 +173,7 @@ function UiExampleContent({ activePresetId, onThemePresetChange, onThemeOverride
|
|
|
166
173
|
},
|
|
167
174
|
];
|
|
168
175
|
}, [locale, toast]);
|
|
169
|
-
return (_jsxs(AppShell, { sidebarOpen: mobileNavOpen, onSidebarOpenChange: setMobileNavOpen, header: _jsx(AppShellHeader, { visibility: 'mobile', sidebarOpen: mobileNavOpen, onSidebarOpenChange: setMobileNavOpen, actions: _jsx(UiExampleHeaderActions, { compact: true, locale: locale, onLocaleChange: onLocaleChange }), children: _jsx(
|
|
176
|
+
return (_jsxs(AppShell, { sidebarOpen: mobileNavOpen, onSidebarOpenChange: setMobileNavOpen, header: _jsx(AppShellHeader, { visibility: 'mobile', sidebarOpen: mobileNavOpen, onSidebarOpenChange: setMobileNavOpen, actions: _jsx(UiExampleHeaderActions, { compact: true, locale: locale, onLocaleChange: onLocaleChange }), children: _jsx(UiExampleHeaderTitle, { locale: locale }) }), sidebar: _jsx(UiExampleSidebar, { onNavigate: () => setMobileNavOpen(false) }), children: [_jsxs("div", { className: 'oui-ui-workspace', children: [_jsx("div", { className: 'oui-ui-workspace-main', children: _jsxs(AppShellContent, { children: [_jsx(ExampleThemePlayground, { activePresetId: activePresetId, theme: theme, locale: locale, onPresetChange: onThemePresetChange, onThemeOverridesChange: onThemeOverridesChange }), _jsx(FoundationsSection, { onOpenCode: setCodeExample }), _jsx(TypographySection, { onOpenCode: setCodeExample }), _jsx(IconTextSection, { onOpenCode: setCodeExample }), _jsx(LayoutSection, { onOpenCode: setCodeExample }), _jsx(ActionsSection, { menuItems: menuItems, onOpenCode: setCodeExample, onOpenPalette: () => setPaletteOpen(true) }), _jsx(FieldsSection, { stepperValue: stepperValue, onStepperValueChange: setStepperValue, dateValue: dateValue, onDateValueChange: setDateValue, dateRange: dateRange, onDateRangeChange: setDateRange, onOpenCode: setCodeExample }), _jsx(SelectionSection, { locale: locale, segment: segment, onSegmentChange: setSegment, selectValue: selectValue, onSelectValueChange: setSelectValue, selectNoChevronValue: selectNoChevronValue, onSelectNoChevronValueChange: setSelectNoChevronValue, selectPlainValue: selectPlainValue, onSelectPlainValueChange: setSelectPlainValue, comboValue: comboValue, onComboValueChange: setComboValue, entityValue: entityValue, onEntityValueChange: setEntityValue, paginatedValue: paginatedValue, onPaginatedValueChange: setPaginatedValue, ownerValues: ownerValues, onOwnerValuesChange: setOwnerValues, radioValue: radioValue, onRadioValueChange: setRadioValue, tabValue: tabValue, onTabValueChange: setTabValue, onOpenCode: setCodeExample, onToast: toast.push }), _jsx(StateCardSection, { onOpenCode: setCodeExample }), _jsx(BadgeSection, { onOpenCode: setCodeExample }), _jsx(DataSection, { onOpenCode: setCodeExample }), _jsx(OverlaysSection, { setModalOpen: setModalOpen, setBlurModalOpen: setBlurModalOpen, setFastModalOpen: setFastModalOpen, setRiseModalOpen: setRiseModalOpen, setSlowModalOpen: setSlowModalOpen, setDangerModalOpen: setDangerModalOpen, onOpenCode: setCodeExample }), _jsx(ApplicationSection, { onOpenCode: setCodeExample })] }) }), _jsx(UiExampleThemeRail, { activePresetId: activePresetId, locale: locale, onThemePresetChange: onThemePresetChange })] }), _jsx(CodePreviewModal, { example: codeExample, onClose: () => setCodeExample(null) }), _jsx(ExampleOverlays, { locale: locale, modalOpen: modalOpen, setModalOpen: setModalOpen, nestedOpen: nestedOpen, setNestedOpen: setNestedOpen, blurModalOpen: blurModalOpen, setBlurModalOpen: setBlurModalOpen, blurNestedOpen: blurNestedOpen, setBlurNestedOpen: setBlurNestedOpen, blurFinalOpen: blurFinalOpen, setBlurFinalOpen: setBlurFinalOpen, fastModalOpen: fastModalOpen, setFastModalOpen: setFastModalOpen, slowModalOpen: slowModalOpen, setSlowModalOpen: setSlowModalOpen, riseModalOpen: riseModalOpen, setRiseModalOpen: setRiseModalOpen, dangerModalOpen: dangerModalOpen, setDangerModalOpen: setDangerModalOpen, paletteOpen: paletteOpen, setPaletteOpen: setPaletteOpen, onToast: toast.push })] }));
|
|
170
177
|
}
|
|
171
178
|
function UiExampleThemeRail({ activePresetId, locale, onThemePresetChange, }) {
|
|
172
179
|
const presets = useMemo(() => {
|
|
@@ -209,7 +216,7 @@ function UiExampleSidebar({ onNavigate }) {
|
|
|
209
216
|
scrollNavigationReleaseTimerRef.current = window.setTimeout(() => {
|
|
210
217
|
if (scrollNavigationTargetRef.current === id)
|
|
211
218
|
scrollNavigationTargetRef.current = null;
|
|
212
|
-
},
|
|
219
|
+
}, UI_EXAMPLE_SCROLL_LOCK_TIMEOUT_MS);
|
|
213
220
|
}, []);
|
|
214
221
|
useEffect(() => {
|
|
215
222
|
const hash = window.location.hash.replace('#', '');
|
|
@@ -233,7 +240,8 @@ function UiExampleSidebar({ onNavigate }) {
|
|
|
233
240
|
return;
|
|
234
241
|
}
|
|
235
242
|
const targetTop = uiExampleSectionScrollTop(targetNode, scrollRoot);
|
|
236
|
-
if (Math.abs(scrollRoot.scrollTop - targetTop) <=
|
|
243
|
+
if (Math.abs(scrollRoot.scrollTop - targetTop) <=
|
|
244
|
+
UI_EXAMPLE_CLICK_TARGET_TOP_TOLERANCE) {
|
|
237
245
|
scrollNavigationTargetRef.current = null;
|
|
238
246
|
setActiveSectionValue(lockedTarget);
|
|
239
247
|
}
|
|
@@ -242,10 +250,12 @@ function UiExampleSidebar({ onNavigate }) {
|
|
|
242
250
|
const bottomDistance = scrollRoot.scrollHeight
|
|
243
251
|
- scrollRoot.clientHeight
|
|
244
252
|
- scrollRoot.scrollTop;
|
|
245
|
-
const top = scrollRoot.scrollTop +
|
|
253
|
+
const top = scrollRoot.scrollTop + UI_EXAMPLE_ACTIVE_PROBE_OFFSET;
|
|
246
254
|
const next = bottomDistance <= 2
|
|
247
255
|
? nodes.at(-1)?.id
|
|
248
|
-
: nodes
|
|
256
|
+
: nodes
|
|
257
|
+
.filter((node) => uiExampleSectionAbsoluteTop(node, scrollRoot) <= top)
|
|
258
|
+
.at(-1)?.id ?? nodes[0]?.id;
|
|
249
259
|
if (next && next !== activeSectionRef.current)
|
|
250
260
|
setActiveSectionValue(next);
|
|
251
261
|
};
|
|
@@ -269,47 +279,82 @@ function UiExampleSidebar({ onNavigate }) {
|
|
|
269
279
|
setActiveSectionValue(id);
|
|
270
280
|
lockScrollNavigationTarget(id);
|
|
271
281
|
window.history.replaceState(null, '', `#${id}`);
|
|
272
|
-
scrollUiExampleSection(id);
|
|
282
|
+
scrollUiExampleSection(id, 'smooth');
|
|
273
283
|
onNavigate();
|
|
274
284
|
}, [lockScrollNavigationTarget, onNavigate, setActiveSectionValue]);
|
|
275
285
|
const sidebarNavGroups = useMemo(() => navGroups.map((group) => ({
|
|
276
|
-
|
|
286
|
+
key: group.key,
|
|
277
287
|
items: group.items.map((item) => ({
|
|
278
288
|
key: item.id,
|
|
279
289
|
label: item.label,
|
|
290
|
+
icon: uiExampleNavIcon(item.id),
|
|
280
291
|
active: activeSection === item.id,
|
|
281
292
|
onSelect: () => navigateToSection(item.id),
|
|
282
293
|
})),
|
|
283
294
|
})), [activeSection, navigateToSection]);
|
|
284
|
-
return (_jsx(
|
|
295
|
+
return (_jsx(AppSidebar, { className: 'oui-ui-main-sidebar', header: _jsx(UiExampleBrand, {}), itemH: 34, groups: sidebarNavGroups, footer: (_jsxs("button", { type: 'button', className: 'oui-ui-sidebar-footer-action', onClick: () => navigateToSection('app-shell-example'), children: [_jsx(LuSettings, { size: 15, "aria-hidden": true }), _jsx("span", { children: "Application components" })] })) }));
|
|
285
296
|
}
|
|
286
|
-
function
|
|
297
|
+
function UiExampleHeaderTitle({ locale }) {
|
|
287
298
|
const title = locale === 'ru'
|
|
288
299
|
? 'Единый язык компонентов для всех модулей.'
|
|
289
300
|
: 'One component language for every module.';
|
|
290
301
|
const subtitle = locale === 'ru'
|
|
291
302
|
? 'Одна тема, предсказуемый интерфейс.'
|
|
292
303
|
: 'One theme, predictable interface.';
|
|
293
|
-
return (_jsxs("
|
|
304
|
+
return (_jsxs("div", { className: 'oui-ui-header-title', children: [_jsx("strong", { children: title }), _jsx("span", { children: subtitle })] }));
|
|
305
|
+
}
|
|
306
|
+
function uiExampleNavIcon(id) {
|
|
307
|
+
const size = 16;
|
|
308
|
+
if (id === 'theme')
|
|
309
|
+
return _jsx(LuSettings, { size: size });
|
|
310
|
+
if (id === 'foundations')
|
|
311
|
+
return _jsx(LuLayoutDashboard, { size: size });
|
|
312
|
+
if (id === 'buttons-example')
|
|
313
|
+
return _jsx(LuMousePointerClick, { size: size });
|
|
314
|
+
if (id === 'text-fields-example')
|
|
315
|
+
return _jsx(LuFileText, { size: size });
|
|
316
|
+
if (id === 'selects-example')
|
|
317
|
+
return _jsx(LuCheck, { size: size });
|
|
318
|
+
if (id === 'data-table-example')
|
|
319
|
+
return _jsx(LuClipboardList, { size: size });
|
|
320
|
+
if (id === 'toast-example')
|
|
321
|
+
return _jsx(LuBell, { size: size });
|
|
322
|
+
if (id === 'app-shell-example')
|
|
323
|
+
return _jsx(LuPanelTop, { size: size });
|
|
324
|
+
if (id === 'app-sidebar-example')
|
|
325
|
+
return _jsx(LuLayoutDashboard, { size: size });
|
|
326
|
+
if (id === 'special-modal-example')
|
|
327
|
+
return _jsx(LuBox, { size: size });
|
|
328
|
+
if (id === 'date-range-example')
|
|
329
|
+
return _jsx(LuCalendar, { size: size });
|
|
330
|
+
return null;
|
|
294
331
|
}
|
|
295
332
|
function UiExampleBrand({ compact = false }) {
|
|
296
333
|
return (_jsxs("div", { className: 'oui-ui-brand', "data-compact": compact ? 'true' : undefined, children: [_jsx("span", { className: 'oui-ui-brand-mark', "aria-hidden": 'true', children: _jsx("img", { className: 'oui-ui-brand-logo', src: ORCESTR_LOGO_SRC, alt: '' }) }), _jsx("span", { className: 'oui-ui-brand-text', children: _jsx("strong", { children: "Orcestr UI" }) })] }));
|
|
297
334
|
}
|
|
298
335
|
function UiExampleHeaderActions({ compact = false, locale, onLocaleChange, }) {
|
|
299
|
-
return (_jsxs("div", { className: 'oui-ui-
|
|
336
|
+
return (_jsxs("div", { className: 'oui-ui-header-actions', "data-compact": compact ? 'true' : undefined, children: [_jsxs("span", { className: 'oui-ui-language-switch', "aria-label": 'UI example language', children: [_jsx("span", { className: 'oui-ui-language-label', children: locale === 'ru' ? 'Язык' : 'Language' }), ['ru', 'en'].map((item) => (_jsx("button", { type: 'button', className: 'oui-ui-language-option', "data-active": locale === item ? 'true' : undefined, "aria-pressed": locale === item, onClick: () => onLocaleChange(item), children: item.toUpperCase() }, item)))] }), _jsxs("a", { className: 'oui-ui-header-link', href: 'https://github.com/Artasov/orcestr', target: '_blank', rel: 'noreferrer', children: [_jsx(LuExternalLink, { size: 14, "aria-hidden": true }), _jsx("span", { children: "GitHub" })] })] }));
|
|
300
337
|
}
|
|
301
|
-
export function UiExamplePage() {
|
|
338
|
+
export function UiExamplePage({ locale: controlledLocale, defaultLocale = 'ru', onLocaleChange, } = {}) {
|
|
302
339
|
const firstPreset = getThemePlaygroundPreset('orcestr-dark');
|
|
303
340
|
const [activePresetId, setActivePresetId] = useState(firstPreset.id);
|
|
304
341
|
const [mode, setMode] = useState(firstPreset.mode);
|
|
305
342
|
const [surface, setSurface] = useState(firstPreset.surface);
|
|
306
|
-
const [
|
|
343
|
+
const [internalLocale, setInternalLocale] = useState(defaultLocale);
|
|
307
344
|
const [themeOverrides, setThemeOverrides] = useState(firstPreset.overrides ?? {});
|
|
345
|
+
const locale = controlledLocale ?? internalLocale;
|
|
308
346
|
const handleThemePresetChange = useCallback((preset) => {
|
|
309
347
|
setActivePresetId(preset.id);
|
|
310
348
|
setMode(preset.mode);
|
|
311
349
|
setSurface(preset.surface);
|
|
312
350
|
setThemeOverrides(preset.overrides ?? {});
|
|
313
351
|
}, []);
|
|
314
|
-
|
|
352
|
+
const handleLocaleChange = useCallback((nextLocale) => {
|
|
353
|
+
if (onLocaleChange) {
|
|
354
|
+
onLocaleChange(nextLocale);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
setInternalLocale(nextLocale);
|
|
358
|
+
}, [onLocaleChange]);
|
|
359
|
+
return (_jsx(OrcestrUiProvider, { mode: mode, surface: surface, onModeChange: setMode, onSurfaceChange: setSurface, themeOverrides: themeOverrides, locale: locale, children: _jsx(UiExampleContent, { activePresetId: activePresetId, onThemePresetChange: handleThemePresetChange, onThemeOverridesChange: setThemeOverrides, locale: locale, onLocaleChange: handleLocaleChange }) }));
|
|
315
360
|
}
|
|
@@ -13,9 +13,13 @@ export declare const codeSamples: {
|
|
|
13
13
|
highlights: string;
|
|
14
14
|
scrollArea: string;
|
|
15
15
|
systemRadius: string;
|
|
16
|
+
surfaces: string;
|
|
16
17
|
buttons: string;
|
|
17
18
|
iconButtons: string;
|
|
19
|
+
iconTextButton: string;
|
|
20
|
+
contextMenu: string;
|
|
18
21
|
textFields: string;
|
|
22
|
+
inlineEdit: string;
|
|
19
23
|
groupedFields: string;
|
|
20
24
|
numberAndDateFields: string;
|
|
21
25
|
dateRangeFields: string;
|
|
@@ -25,6 +29,9 @@ export declare const codeSamples: {
|
|
|
25
29
|
overlays: string;
|
|
26
30
|
toast: string;
|
|
27
31
|
overlaySettings: string;
|
|
32
|
+
tablePagination: string;
|
|
33
|
+
appSidebar: string;
|
|
34
|
+
specialModal: string;
|
|
28
35
|
data: string;
|
|
29
36
|
};
|
|
30
37
|
//# sourceMappingURL=codeSamples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeSamples.d.ts","sourceRoot":"","sources":["../../src/example/codeSamples.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"codeSamples.d.ts","sourceRoot":"","sources":["../../src/example/codeSamples.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+zCc,CAAC"}
|