@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,3 @@
|
|
|
1
|
+
import type { OrcestrThemeProviderProps } from './themeTypes';
|
|
2
|
+
export declare function OrcestrThemeProvider({ children, mode: controlledMode, defaultMode, defaultSurface, surface, onModeChange, onSurfaceChange, themeOverrides, className, style, testId, }: OrcestrThemeProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=ThemeProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGR,yBAAyB,EAE5B,MAAM,cAAc,CAAC;AAEtB,wBAAgB,oBAAoB,CAAC,EACjC,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAoB,EACpB,cAA0B,EAC1B,OAAO,EACP,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,KAAK,EACL,MAAM,GACT,EAAE,yBAAyB,2CA2N3B"}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { themeByMode } from './defaultTheme';
|
|
5
|
+
import { OrcestrThemeContext } from './useTheme';
|
|
6
|
+
import { cn } from '../utils/cn';
|
|
7
|
+
export function OrcestrThemeProvider({ children, mode: controlledMode, defaultMode = 'dark', defaultSurface = 'orcestr', surface, onModeChange, onSurfaceChange, themeOverrides, className, style, testId, }) {
|
|
8
|
+
const [mode, setModeState] = useState(defaultMode);
|
|
9
|
+
const [surfaceState, setSurfaceState] = useState(defaultSurface);
|
|
10
|
+
const resolvedMode = controlledMode ?? mode;
|
|
11
|
+
const resolvedSurface = surface ?? surfaceState;
|
|
12
|
+
const theme = useMemo(() => themeByMode(resolvedMode, resolvedSurface, themeOverrides), [resolvedMode, resolvedSurface, themeOverrides]);
|
|
13
|
+
const setMode = useCallback((next) => {
|
|
14
|
+
if (controlledMode === undefined)
|
|
15
|
+
setModeState(next);
|
|
16
|
+
onModeChange?.(next);
|
|
17
|
+
}, [controlledMode, onModeChange]);
|
|
18
|
+
const setSurface = useCallback((next) => {
|
|
19
|
+
if (surface === undefined)
|
|
20
|
+
setSurfaceState(next);
|
|
21
|
+
onSurfaceChange?.(next);
|
|
22
|
+
}, [onSurfaceChange, surface]);
|
|
23
|
+
const toggleMode = useCallback(() => {
|
|
24
|
+
setMode(resolvedMode === 'dark' ? 'light' : 'dark');
|
|
25
|
+
}, [resolvedMode, setMode]);
|
|
26
|
+
const value = useMemo(() => ({
|
|
27
|
+
mode: resolvedMode,
|
|
28
|
+
surface: resolvedSurface,
|
|
29
|
+
theme,
|
|
30
|
+
setMode,
|
|
31
|
+
setSurface,
|
|
32
|
+
toggleMode,
|
|
33
|
+
}), [resolvedMode, resolvedSurface, theme, setMode, setSurface, toggleMode]);
|
|
34
|
+
const rootStyle = useMemo(() => ({
|
|
35
|
+
'--oui-bg': theme.colors.bg,
|
|
36
|
+
'--oui-panel': theme.colors.panel,
|
|
37
|
+
'--oui-panel-2': theme.colors.panelSoft,
|
|
38
|
+
'--oui-control-bg': theme.colors.control,
|
|
39
|
+
'--oui-control-hover-bg': theme.colors.controlHover,
|
|
40
|
+
'--oui-border': theme.colors.border,
|
|
41
|
+
'--oui-border-strong': theme.colors.borderStrong,
|
|
42
|
+
'--oui-text': theme.colors.text,
|
|
43
|
+
'--oui-muted': theme.colors.muted,
|
|
44
|
+
'--oui-soft': theme.colors.brandSoft,
|
|
45
|
+
'--oui-soft-hover': theme.colors.selected,
|
|
46
|
+
'--oui-brand': theme.colors.brand,
|
|
47
|
+
'--oui-brand-strong': theme.colors.brandStrong,
|
|
48
|
+
'--oui-brand-solid': theme.colors.brandSolid,
|
|
49
|
+
'--oui-brand-solid-hover': theme.colors.brandSolidHover,
|
|
50
|
+
'--oui-brand-soft': theme.colors.brandSoft,
|
|
51
|
+
'--oui-success': theme.colors.success,
|
|
52
|
+
'--oui-success-soft': theme.colors.successSoft,
|
|
53
|
+
'--oui-warning': theme.colors.warning,
|
|
54
|
+
'--oui-warning-soft': theme.colors.warningSoft,
|
|
55
|
+
'--oui-danger': theme.colors.danger,
|
|
56
|
+
'--oui-danger-soft': theme.colors.dangerSoft,
|
|
57
|
+
'--oui-info': theme.colors.info,
|
|
58
|
+
'--oui-info-soft': theme.colors.infoSoft,
|
|
59
|
+
'--oui-selected-bg': theme.colors.selected,
|
|
60
|
+
'--oui-disabled': theme.colors.disabled,
|
|
61
|
+
'--oui-overlay-bg': theme.colors.overlay,
|
|
62
|
+
'--oui-section-surface-bg': theme.colors.section,
|
|
63
|
+
'--oui-section-solid-bg': compositeColor(theme.colors.section, theme.colors.bg),
|
|
64
|
+
'--oui-section-nested-surface-bg': theme.colors.sectionNested,
|
|
65
|
+
'--oui-section-nested-solid-bg': compositeColor(theme.colors.sectionNested, compositeColor(theme.colors.section, theme.colors.bg)),
|
|
66
|
+
'--oui-surface-bg': theme.colors.section || theme.colors.bg,
|
|
67
|
+
'--oui-floating-bg': theme.colors.floating,
|
|
68
|
+
'--oui-pad-bg': theme.colors.pad,
|
|
69
|
+
'--oui-pad-hover-bg': theme.colors.padHover,
|
|
70
|
+
'--oui-skeleton-shimmer': theme.colors.skeletonShimmer,
|
|
71
|
+
'--oui-shadow-sm': theme.shadows.sm,
|
|
72
|
+
'--oui-shadow-md': theme.shadows.md,
|
|
73
|
+
'--oui-shadow-overlay': theme.shadows.overlay,
|
|
74
|
+
'--oui-section-shadow': theme.shadows.section,
|
|
75
|
+
'--oui-shadow-focus': theme.shadows.focus,
|
|
76
|
+
'--oui-ring': theme.colors.focusRing,
|
|
77
|
+
'--oui-radius': theme.radii.lg,
|
|
78
|
+
'--oui-radius-sm': theme.radii.md,
|
|
79
|
+
'--oui-radius-xl': theme.radii.xl,
|
|
80
|
+
'--oui-space-px': theme.spacing.px,
|
|
81
|
+
'--oui-space-xs': theme.spacing.xs,
|
|
82
|
+
'--oui-space-sm': theme.spacing.sm,
|
|
83
|
+
'--oui-space-md': theme.spacing.md,
|
|
84
|
+
'--oui-space-lg': theme.spacing.lg,
|
|
85
|
+
'--oui-space-xl': theme.spacing.xl,
|
|
86
|
+
'--oui-space-xxl': theme.spacing.xxl,
|
|
87
|
+
'--oui-space-section': theme.spacing.section,
|
|
88
|
+
'--oui-space-page': theme.spacing.page,
|
|
89
|
+
'--oui-breakpoint-compact': theme.breakpoints.compact,
|
|
90
|
+
'--oui-breakpoint-tablet': theme.breakpoints.tablet,
|
|
91
|
+
'--oui-breakpoint-desktop': theme.breakpoints.desktop,
|
|
92
|
+
'--oui-breakpoint-wide': theme.breakpoints.wide,
|
|
93
|
+
'--oui-font-family': theme.typography.fontFamily,
|
|
94
|
+
'--oui-font-family-mono': theme.typography.monoFontFamily,
|
|
95
|
+
'--oui-title-size': theme.typography.titleSize,
|
|
96
|
+
'--oui-heading-size': theme.typography.headingSize,
|
|
97
|
+
'--oui-body-size': theme.typography.bodySize,
|
|
98
|
+
'--oui-compact-size': theme.typography.compactSize,
|
|
99
|
+
'--oui-label-size': theme.typography.labelSize,
|
|
100
|
+
'--oui-line-height': theme.typography.lineHeight,
|
|
101
|
+
'--oui-heading-line-height': theme.typography.headingLineHeight,
|
|
102
|
+
'--oui-weight-regular': theme.typography.weightRegular,
|
|
103
|
+
'--oui-weight-medium': theme.typography.weightMedium,
|
|
104
|
+
'--oui-weight-bold': theme.typography.weightBold,
|
|
105
|
+
'--oui-letter-spacing': theme.typography.letterSpacing,
|
|
106
|
+
'--oui-status-neutral': theme.status.neutral.color,
|
|
107
|
+
'--oui-status-neutral-text': theme.status.neutral.text,
|
|
108
|
+
'--oui-status-neutral-soft': theme.status.neutral.soft,
|
|
109
|
+
'--oui-status-neutral-border': theme.status.neutral.border,
|
|
110
|
+
'--oui-status-brand': theme.status.brand.color,
|
|
111
|
+
'--oui-status-brand-text': theme.status.brand.text,
|
|
112
|
+
'--oui-status-brand-soft': theme.status.brand.soft,
|
|
113
|
+
'--oui-status-brand-border': theme.status.brand.border,
|
|
114
|
+
'--oui-status-success': theme.status.success.color,
|
|
115
|
+
'--oui-status-success-text': theme.status.success.text,
|
|
116
|
+
'--oui-status-success-soft': theme.status.success.soft,
|
|
117
|
+
'--oui-status-success-border': theme.status.success.border,
|
|
118
|
+
'--oui-status-warning': theme.status.warning.color,
|
|
119
|
+
'--oui-status-warning-text': theme.status.warning.text,
|
|
120
|
+
'--oui-status-warning-soft': theme.status.warning.soft,
|
|
121
|
+
'--oui-status-warning-border': theme.status.warning.border,
|
|
122
|
+
'--oui-status-danger': theme.status.danger.color,
|
|
123
|
+
'--oui-status-danger-text': theme.status.danger.text,
|
|
124
|
+
'--oui-status-danger-soft': theme.status.danger.soft,
|
|
125
|
+
'--oui-status-danger-border': theme.status.danger.border,
|
|
126
|
+
'--oui-status-info': theme.status.info.color,
|
|
127
|
+
'--oui-status-info-text': theme.status.info.text,
|
|
128
|
+
'--oui-status-info-soft': theme.status.info.soft,
|
|
129
|
+
'--oui-status-info-border': theme.status.info.border,
|
|
130
|
+
'--oui-motion-fast': theme.motion.fast,
|
|
131
|
+
'--oui-motion-duration': theme.motion.normal,
|
|
132
|
+
'--oui-motion-slow': theme.motion.slow,
|
|
133
|
+
'--oui-motion-ease': theme.motion.ease,
|
|
134
|
+
'--oui-z-sticky': theme.zIndex.sticky,
|
|
135
|
+
'--oui-z-dropdown': theme.zIndex.dropdown,
|
|
136
|
+
'--oui-z-overlay': theme.zIndex.overlay,
|
|
137
|
+
'--oui-z-modal': theme.zIndex.modal,
|
|
138
|
+
'--oui-z-toast': theme.zIndex.toast,
|
|
139
|
+
'--oui-toast-bg': theme.toast.background,
|
|
140
|
+
'--oui-toast-blur': cssBlur(theme.toast.blur),
|
|
141
|
+
'--oui-toast-border-color': theme.toast.borderColor,
|
|
142
|
+
'--oui-toast-shadow': theme.toast.shadow,
|
|
143
|
+
'--oui-toast-animation-duration': theme.toast.animationDuration,
|
|
144
|
+
'--oui-toast-exit-duration': theme.toast.exitDuration,
|
|
145
|
+
'--oui-toast-progress-height': theme.toast.progressHeight,
|
|
146
|
+
'--oui-state-hover-opacity': theme.states.hoverOpacity,
|
|
147
|
+
'--oui-state-active-opacity': theme.states.activeOpacity,
|
|
148
|
+
'--oui-state-disabled-opacity': theme.states.disabledOpacity,
|
|
149
|
+
'--oui-state-loading-opacity': theme.states.loadingOpacity,
|
|
150
|
+
'--oui-state-selected-opacity': theme.states.selectedOpacity,
|
|
151
|
+
'--oui-state-focus-ring-width': theme.states.focusRingWidth,
|
|
152
|
+
'--oui-density-compact-control': theme.density.compactControl,
|
|
153
|
+
'--oui-density-regular-control': theme.density.regularControl,
|
|
154
|
+
'--oui-density-spacious-control': theme.density.spaciousControl,
|
|
155
|
+
'--oui-page-padding': theme.density.pagePadding,
|
|
156
|
+
'--oui-section-gap': theme.density.sectionGap,
|
|
157
|
+
'--oui-button-radius': theme.components.buttonRadius,
|
|
158
|
+
'--oui-button-font-weight': theme.components.buttonFontWeight,
|
|
159
|
+
'--oui-table-cell-padding-y': theme.components.tableCellPaddingY,
|
|
160
|
+
'--oui-table-header-height': theme.components.tableHeaderHeight,
|
|
161
|
+
'--oui-field-gap': theme.components.fieldGap,
|
|
162
|
+
'--oui-modal-max-width': theme.components.modalMaxWidth,
|
|
163
|
+
'--oui-pipeline-step-min-width': theme.components.pipelineStepMinWidth,
|
|
164
|
+
}), [theme]);
|
|
165
|
+
const themeStyle = useMemo(() => ({ ...rootStyle, ...style }), [rootStyle, style]);
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
const root = document.documentElement;
|
|
168
|
+
const previousTheme = root.getAttribute('data-oui-theme');
|
|
169
|
+
const previousSurface = root.getAttribute('data-oui-surface');
|
|
170
|
+
const previousVariables = new Map();
|
|
171
|
+
for (const [name, value] of Object.entries(themeStyle)) {
|
|
172
|
+
if (!name.startsWith('--oui-') || value === undefined || value === null)
|
|
173
|
+
continue;
|
|
174
|
+
previousVariables.set(name, root.style.getPropertyValue(name));
|
|
175
|
+
root.style.setProperty(name, String(value));
|
|
176
|
+
}
|
|
177
|
+
root.setAttribute('data-oui-theme', resolvedMode);
|
|
178
|
+
root.setAttribute('data-oui-surface', resolvedSurface);
|
|
179
|
+
return () => {
|
|
180
|
+
for (const [name, value] of previousVariables) {
|
|
181
|
+
if (value)
|
|
182
|
+
root.style.setProperty(name, value);
|
|
183
|
+
else
|
|
184
|
+
root.style.removeProperty(name);
|
|
185
|
+
}
|
|
186
|
+
if (previousTheme)
|
|
187
|
+
root.setAttribute('data-oui-theme', previousTheme);
|
|
188
|
+
else
|
|
189
|
+
root.removeAttribute('data-oui-theme');
|
|
190
|
+
if (previousSurface)
|
|
191
|
+
root.setAttribute('data-oui-surface', previousSurface);
|
|
192
|
+
else
|
|
193
|
+
root.removeAttribute('data-oui-surface');
|
|
194
|
+
};
|
|
195
|
+
}, [resolvedMode, resolvedSurface, themeStyle]);
|
|
196
|
+
return (_jsx(OrcestrThemeContext.Provider, { value: value, children: _jsx("div", { className: cn('oui-root', className), "data-oui-theme": resolvedMode, "data-oui-surface": resolvedSurface, "data-testid": testId, style: themeStyle, children: children }) }));
|
|
197
|
+
}
|
|
198
|
+
function compositeColor(foreground, background) {
|
|
199
|
+
const fg = parseCssColor(foreground);
|
|
200
|
+
const bg = parseCssColor(background);
|
|
201
|
+
if (!fg || !bg)
|
|
202
|
+
return foreground;
|
|
203
|
+
if (fg.a <= 0)
|
|
204
|
+
return rgbColor(bg);
|
|
205
|
+
if (fg.a >= 1)
|
|
206
|
+
return rgbColor(fg);
|
|
207
|
+
return rgbColor({
|
|
208
|
+
r: Math.round(fg.r * fg.a + bg.r * (1 - fg.a)),
|
|
209
|
+
g: Math.round(fg.g * fg.a + bg.g * (1 - fg.a)),
|
|
210
|
+
b: Math.round(fg.b * fg.a + bg.b * (1 - fg.a)),
|
|
211
|
+
a: 1,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
function rgbColor(color) {
|
|
215
|
+
return `rgb(${color.r} ${color.g} ${color.b})`;
|
|
216
|
+
}
|
|
217
|
+
function parseCssColor(value) {
|
|
218
|
+
const color = value.trim().toLowerCase();
|
|
219
|
+
if (color === 'transparent')
|
|
220
|
+
return { r: 0, g: 0, b: 0, a: 0 };
|
|
221
|
+
const hex = parseHexColor(color);
|
|
222
|
+
if (hex)
|
|
223
|
+
return hex;
|
|
224
|
+
const rgb = color.match(/^rgba?\((.+)\)$/);
|
|
225
|
+
if (!rgb)
|
|
226
|
+
return null;
|
|
227
|
+
const normalized = rgb[1].replace(/\s*\/\s*/, ' / ').replace(/,/g, ' ');
|
|
228
|
+
const parts = normalized.split(/\s+/).filter(Boolean);
|
|
229
|
+
const slashIndex = parts.indexOf('/');
|
|
230
|
+
const channels = (slashIndex === -1 ? parts : parts.slice(0, slashIndex))
|
|
231
|
+
.slice(0, 3)
|
|
232
|
+
.map(Number);
|
|
233
|
+
if (channels.length !== 3 || channels.some((channel) => !Number.isFinite(channel))) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
const alphaPart = slashIndex === -1 ? parts[3] : parts[slashIndex + 1];
|
|
237
|
+
return {
|
|
238
|
+
r: clampChannel(channels[0]),
|
|
239
|
+
g: clampChannel(channels[1]),
|
|
240
|
+
b: clampChannel(channels[2]),
|
|
241
|
+
a: parseAlpha(alphaPart),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function parseHexColor(color) {
|
|
245
|
+
if (/^#[0-9a-f]{3}$/i.test(color)) {
|
|
246
|
+
return {
|
|
247
|
+
r: Number.parseInt(color[1] + color[1], 16),
|
|
248
|
+
g: Number.parseInt(color[2] + color[2], 16),
|
|
249
|
+
b: Number.parseInt(color[3] + color[3], 16),
|
|
250
|
+
a: 1,
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
if (/^#[0-9a-f]{6}$/i.test(color)) {
|
|
254
|
+
return {
|
|
255
|
+
r: Number.parseInt(color.slice(1, 3), 16),
|
|
256
|
+
g: Number.parseInt(color.slice(3, 5), 16),
|
|
257
|
+
b: Number.parseInt(color.slice(5, 7), 16),
|
|
258
|
+
a: 1,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
function parseAlpha(value) {
|
|
264
|
+
if (!value)
|
|
265
|
+
return 1;
|
|
266
|
+
const alpha = value.endsWith('%')
|
|
267
|
+
? Number.parseFloat(value) / 100
|
|
268
|
+
: Number.parseFloat(value);
|
|
269
|
+
if (!Number.isFinite(alpha))
|
|
270
|
+
return 1;
|
|
271
|
+
return Math.max(0, Math.min(1, alpha));
|
|
272
|
+
}
|
|
273
|
+
function clampChannel(value) {
|
|
274
|
+
return Math.max(0, Math.min(255, Math.round(value)));
|
|
275
|
+
}
|
|
276
|
+
function cssBlur(value) {
|
|
277
|
+
if (value === false)
|
|
278
|
+
return '0px';
|
|
279
|
+
return typeof value === 'number' ? `${value}px` : value;
|
|
280
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrcestrTheme, OrcestrThemeMode, OrcestrThemeOverrides, OrcestrThemeSurface } from './themeTypes';
|
|
2
|
+
export type OrcestrThemeSurfaceDefinition = {
|
|
3
|
+
value: OrcestrThemeSurface;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const orcestrThemeSurfaceRegistry: Record<OrcestrThemeSurface, OrcestrThemeSurfaceDefinition>;
|
|
8
|
+
export declare const orcestrThemeSurfaces: OrcestrThemeSurfaceDefinition[];
|
|
9
|
+
export declare function themeByMode(mode: OrcestrThemeMode, surface?: OrcestrThemeSurface, themeOverrides?: OrcestrThemeOverrides): OrcestrTheme;
|
|
10
|
+
export declare const darkTheme: OrcestrTheme;
|
|
11
|
+
export declare const lightTheme: OrcestrTheme;
|
|
12
|
+
//# sourceMappingURL=defaultTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,cAAc,CAAC;AAItB,MAAM,MAAM,6BAA6B,GAAG;IACxC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC5C,mBAAmB,EACnB,6BAA6B,CAsBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,6BAA6B,EAK/D,CAAC;AAgeF,wBAAgB,WAAW,CACvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,mBAA+B,EACxC,cAAc,CAAC,EAAE,qBAAqB,GACvC,YAAY,CASd;AAED,eAAO,MAAM,SAAS,EAAE,YAAkC,CAAC;AAC3D,eAAO,MAAM,UAAU,EAAE,YAAmC,CAAC"}
|