@primecoderin/fast-ui-react 0.0.0-stage → 1.0.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/CHANGELOG.md +106 -0
- package/LICENSE +21 -0
- package/README.md +180 -3
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/charts.d.ts +7 -0
- package/dist/charts.js +7 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.js +92 -0
- package/dist/components/Button/Button.d.ts +44 -0
- package/dist/components/Button/Button.js +221 -0
- package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
- package/dist/components/Checkbox/CheckboxBox.js +148 -0
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
- package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
- package/dist/components/Collapsible/Collapsible.d.ts +20 -0
- package/dist/components/Collapsible/Collapsible.js +97 -0
- package/dist/components/Container/Container.d.ts +301 -0
- package/dist/components/Container/Container.js +20 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
- package/dist/components/Grid/Grid.d.ts +311 -0
- package/dist/components/Grid/Grid.js +30 -0
- package/dist/components/IconTile/IconTile.d.ts +12 -0
- package/dist/components/IconTile/IconTile.js +70 -0
- package/dist/components/InlineError/InlineError.d.ts +9 -0
- package/dist/components/InlineError/InlineError.js +62 -0
- package/dist/components/Kbd/Kbd.d.ts +11 -0
- package/dist/components/Kbd/Kbd.js +31 -0
- package/dist/components/Link/Link.d.ts +18 -0
- package/dist/components/Link/Link.js +68 -0
- package/dist/components/Menu/ContextMenu.d.ts +18 -0
- package/dist/components/Menu/ContextMenu.js +68 -0
- package/dist/components/Menu/Menu.d.ts +86 -0
- package/dist/components/Menu/Menu.js +394 -0
- package/dist/components/OtpInput/OtpInput.d.ts +32 -0
- package/dist/components/OtpInput/OtpInput.js +177 -0
- package/dist/components/Popover/HoverPopover.d.ts +22 -0
- package/dist/components/Popover/HoverPopover.js +74 -0
- package/dist/components/Popover/Popover.d.ts +21 -0
- package/dist/components/Popover/Popover.js +64 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
- package/dist/components/ProgressBar/ProgressBar.js +44 -0
- package/dist/components/Rating/Rating.d.ts +49 -0
- package/dist/components/Rating/Rating.js +241 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
- package/dist/components/ScrollArea/ScrollArea.js +90 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
- package/dist/components/Separator/Separator.d.ts +9 -0
- package/dist/components/Separator/Separator.js +34 -0
- package/dist/components/Skeleton/Skeleton.d.ts +31 -0
- package/dist/components/Skeleton/Skeleton.js +152 -0
- package/dist/components/Slider/Slider.d.ts +54 -0
- package/dist/components/Slider/Slider.js +178 -0
- package/dist/components/Spinner/Spinner.d.ts +17 -0
- package/dist/components/Spinner/Spinner.js +118 -0
- package/dist/components/Stack/Stack.d.ts +302 -0
- package/dist/components/Stack/Stack.js +14 -0
- package/dist/components/StateIcon/StateIcon.d.ts +11 -0
- package/dist/components/StateIcon/StateIcon.js +65 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
- package/dist/components/StatusBadge/StatusBadge.js +82 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.js +109 -0
- package/dist/components/Tag/Tag.d.ts +11 -0
- package/dist/components/Tag/Tag.js +66 -0
- package/dist/components/Toast/AppToaster.d.ts +8 -0
- package/dist/components/Toast/AppToaster.js +135 -0
- package/dist/components/Toast/toast-manager.d.ts +28 -0
- package/dist/components/Toast/toast-manager.js +47 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
- package/dist/components/ToggleButton/ToggleButton.js +106 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
- package/dist/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.js +58 -0
- package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
- package/dist/components/Tooltip/TooltipGroup.js +65 -0
- package/dist/components/Typography/Typography.d.ts +17 -0
- package/dist/components/Typography/Typography.js +100 -0
- package/dist/editor-forms.d.ts +1 -0
- package/dist/editor-forms.js +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +1 -0
- package/dist/fonts/LICENSE +93 -0
- package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts.css +69 -0
- package/dist/forms.d.ts +22 -0
- package/dist/forms.js +23 -0
- package/dist/foundation.css +23 -0
- package/dist/global.css +116 -0
- package/dist/hooks/useAppToast.d.ts +12 -0
- package/dist/hooks/useAppToast.js +29 -0
- package/dist/icons/icons.d.ts +43 -0
- package/dist/icons/icons.js +44 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +101 -0
- package/dist/patterns/Accordion/Accordion.d.ts +35 -0
- package/dist/patterns/Accordion/Accordion.js +139 -0
- package/dist/patterns/Alert/Alert.d.ts +38 -0
- package/dist/patterns/Alert/Alert.js +151 -0
- package/dist/patterns/AppShell/AppShell.d.ts +39 -0
- package/dist/patterns/AppShell/AppShell.js +218 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
- package/dist/patterns/Calendar/Calendar.d.ts +59 -0
- package/dist/patterns/Calendar/Calendar.js +283 -0
- package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
- package/dist/patterns/Calendar/DateRangePicker.js +266 -0
- package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
- package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
- package/dist/patterns/Card/Card.d.ts +26 -0
- package/dist/patterns/Card/Card.js +125 -0
- package/dist/patterns/Carousel/Carousel.d.ts +33 -0
- package/dist/patterns/Carousel/Carousel.js +127 -0
- package/dist/patterns/Cascader/Cascader.d.ts +53 -0
- package/dist/patterns/Cascader/Cascader.js +371 -0
- package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
- package/dist/patterns/Cascader/FormCascaderField.js +130 -0
- package/dist/patterns/Charts/AreaChart.d.ts +13 -0
- package/dist/patterns/Charts/AreaChart.js +220 -0
- package/dist/patterns/Charts/BarChart.d.ts +11 -0
- package/dist/patterns/Charts/BarChart.js +220 -0
- package/dist/patterns/Charts/DonutChart.d.ts +37 -0
- package/dist/patterns/Charts/DonutChart.js +215 -0
- package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
- package/dist/patterns/Charts/GaugeChart.js +210 -0
- package/dist/patterns/Charts/LineChart.d.ts +14 -0
- package/dist/patterns/Charts/LineChart.js +222 -0
- package/dist/patterns/Charts/Sparkline.d.ts +24 -0
- package/dist/patterns/Charts/Sparkline.js +81 -0
- package/dist/patterns/Charts/chart-parts.d.ts +139 -0
- package/dist/patterns/Charts/chart-parts.js +385 -0
- package/dist/patterns/Charts/gauge-math.d.ts +20 -0
- package/dist/patterns/Charts/gauge-math.js +21 -0
- package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
- package/dist/patterns/Charts/sparkline-path.js +24 -0
- package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
- package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
- package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
- package/dist/patterns/ColorPicker/FormColorField.js +130 -0
- package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
- package/dist/patterns/ColorPicker/color-value.js +72 -0
- package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
- package/dist/patterns/Combobox/Autocomplete.js +158 -0
- package/dist/patterns/Combobox/Combobox.d.ts +52 -0
- package/dist/patterns/Combobox/Combobox.js +195 -0
- package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
- package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
- package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
- package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
- package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
- package/dist/patterns/Combobox/FormComboboxField.js +119 -0
- package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
- package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
- package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
- package/dist/patterns/Combobox/MultiSelect.js +175 -0
- package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
- package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
- package/dist/patterns/DataTable/DataTable.d.ts +107 -0
- package/dist/patterns/DataTable/DataTable.js +364 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
- package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
- package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
- package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
- package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
- package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
- package/dist/patterns/DateTimePicker/picker-values.js +194 -0
- package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
- package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
- package/dist/patterns/Dialog/Dialog.d.ts +26 -0
- package/dist/patterns/Dialog/Dialog.js +212 -0
- package/dist/patterns/Drawer/Drawer.d.ts +33 -0
- package/dist/patterns/Drawer/Drawer.js +153 -0
- package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
- package/dist/patterns/EmptyState/EmptyState.js +44 -0
- package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
- package/dist/patterns/FileUpload/FileUpload.js +417 -0
- package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
- package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
- package/dist/patterns/FileUpload/add-files.d.ts +26 -0
- package/dist/patterns/FileUpload/add-files.js +35 -0
- package/dist/patterns/FileUpload/file-size.d.ts +14 -0
- package/dist/patterns/FileUpload/file-size.js +44 -0
- package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
- package/dist/patterns/FormField/CheckboxField.js +97 -0
- package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
- package/dist/patterns/FormField/FieldFrame.js +257 -0
- package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
- package/dist/patterns/FormField/FormCheckboxField.js +92 -0
- package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
- package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
- package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
- package/dist/patterns/FormField/FormRatingField.js +119 -0
- package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
- package/dist/patterns/FormField/FormSelectField.js +91 -0
- package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
- package/dist/patterns/FormField/FormSliderField.js +128 -0
- package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
- package/dist/patterns/FormField/FormSwitchField.js +88 -0
- package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
- package/dist/patterns/FormField/FormTextAreaField.js +91 -0
- package/dist/patterns/FormField/FormTextField.d.ts +23 -0
- package/dist/patterns/FormField/FormTextField.js +103 -0
- package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
- package/dist/patterns/FormField/RadioGroupField.js +201 -0
- package/dist/patterns/FormField/SelectField.d.ts +43 -0
- package/dist/patterns/FormField/SelectField.js +211 -0
- package/dist/patterns/FormField/SwitchField.d.ts +27 -0
- package/dist/patterns/FormField/SwitchField.js +105 -0
- package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
- package/dist/patterns/FormField/TextAreaField.js +134 -0
- package/dist/patterns/FormField/TextField.d.ts +51 -0
- package/dist/patterns/FormField/TextField.js +256 -0
- package/dist/patterns/FormField/error-message.d.ts +6 -0
- package/dist/patterns/FormField/error-message.js +8 -0
- package/dist/patterns/FormField/field-styles.d.ts +44 -0
- package/dist/patterns/FormField/field-styles.js +89 -0
- package/dist/patterns/FormField/field-types.d.ts +4 -0
- package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
- package/dist/patterns/FormField/use-field-ids.js +53 -0
- package/dist/patterns/List/List.d.ts +38 -0
- package/dist/patterns/List/List.js +174 -0
- package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
- package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
- package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
- package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
- package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
- package/dist/patterns/MentionsInput/mention-text.js +31 -0
- package/dist/patterns/Menubar/Menubar.d.ts +22 -0
- package/dist/patterns/Menubar/Menubar.js +79 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
- package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
- package/dist/patterns/NumberField/FormNumberField.js +119 -0
- package/dist/patterns/NumberField/NumberField.d.ts +57 -0
- package/dist/patterns/NumberField/NumberField.js +242 -0
- package/dist/patterns/Pagination/Pagination.d.ts +31 -0
- package/dist/patterns/Pagination/Pagination.js +275 -0
- package/dist/patterns/Pagination/page-items.d.ts +18 -0
- package/dist/patterns/Pagination/page-items.js +40 -0
- package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
- package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
- package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
- package/dist/patterns/PhoneField/PhoneField.js +448 -0
- package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
- package/dist/patterns/PhoneField/phone-value.js +38 -0
- package/dist/patterns/QRCode/QRCode.d.ts +37 -0
- package/dist/patterns/QRCode/QRCode.js +120 -0
- package/dist/patterns/QRCode/qr-path.d.ts +7 -0
- package/dist/patterns/QRCode/qr-path.js +25 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
- package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
- package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
- package/dist/patterns/SearchInput/SearchInput.js +98 -0
- package/dist/patterns/SideNav/SideNav.d.ts +50 -0
- package/dist/patterns/SideNav/SideNav.js +269 -0
- package/dist/patterns/Stat/Stat.d.ts +51 -0
- package/dist/patterns/Stat/Stat.js +292 -0
- package/dist/patterns/Stepper/Stepper.d.ts +35 -0
- package/dist/patterns/Stepper/Stepper.js +110 -0
- package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
- package/dist/patterns/TagGroup/TagGroup.js +151 -0
- package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
- package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
- package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
- package/dist/patterns/TagsInput/TagsInput.js +97 -0
- package/dist/patterns/Timeline/Timeline.d.ts +29 -0
- package/dist/patterns/Timeline/Timeline.js +85 -0
- package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
- package/dist/patterns/Toolbar/Toolbar.js +105 -0
- package/dist/patterns/Tour/Tour.d.ts +38 -0
- package/dist/patterns/Tour/Tour.js +333 -0
- package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
- package/dist/patterns/TransferList/FormTransferListField.js +117 -0
- package/dist/patterns/TransferList/TransferList.d.ts +53 -0
- package/dist/patterns/TransferList/TransferList.js +441 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
- package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
- package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
- package/dist/patterns/TreeView/TreeView.d.ts +40 -0
- package/dist/patterns/TreeView/TreeView.js +296 -0
- package/dist/provider/DesignSystemProvider.d.ts +54 -0
- package/dist/provider/DesignSystemProvider.js +270 -0
- package/dist/provider/nonce.d.ts +7 -0
- package/dist/provider/nonce.js +13 -0
- package/dist/styles.css +2 -0
- package/dist/theme/chart-palette.d.ts +51 -0
- package/dist/theme/chart-palette.js +112 -0
- package/dist/theme/create-theme.d.ts +52 -0
- package/dist/theme/create-theme.js +75 -0
- package/dist/theme/style-element.d.ts +28 -0
- package/dist/theme/style-element.js +79 -0
- package/dist/theme/tenant-branding.d.ts +48 -0
- package/dist/theme/tenant-branding.js +65 -0
- package/dist/theme/theme-switch.d.ts +25 -0
- package/dist/theme/theme-switch.js +90 -0
- package/dist/theme/token-names.d.ts +3 -0
- package/dist/theme/token-names.js +166 -0
- package/dist/theme.css +241 -0
- package/dist/tokens.css +383 -0
- package/dist/types/direction.d.ts +4 -0
- package/dist/types/tone.d.ts +7 -0
- package/dist/utils/cn.d.ts +7 -0
- package/dist/utils/cn.js +50 -0
- package/dist/utils/first-field.d.ts +8 -0
- package/dist/utils/first-field.js +10 -0
- package/dist/utils/layout.d.ts +33 -0
- package/dist/utils/layout.js +30 -0
- package/dist/utils/popup.d.ts +12 -0
- package/dist/utils/popup.js +27 -0
- package/docs/accessibility.md +61 -0
- package/docs/advanced-components.md +38 -0
- package/docs/ai-assistants.md +44 -0
- package/docs/architecture.md +65 -0
- package/docs/browser-support.md +30 -0
- package/docs/charts.md +56 -0
- package/docs/components.md +2928 -0
- package/docs/conventions.md +19 -0
- package/docs/customization.md +79 -0
- package/docs/dates-files-data.md +48 -0
- package/docs/design-principles.md +50 -0
- package/docs/faq.md +68 -0
- package/docs/forms.md +114 -0
- package/docs/getting-started.md +64 -0
- package/docs/icons.md +48 -0
- package/docs/internationalization.md +64 -0
- package/docs/layout-and-navigation.md +51 -0
- package/docs/nextjs.md +69 -0
- package/docs/releasing.md +40 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4573 -0
- package/llms.txt +52 -0
- package/package.json +193 -6
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/patterns/TreeView/TreeView.tsx
|
|
9
|
+
/** How long type-ahead waits for the next character before it starts a new search. */
|
|
10
|
+
var TYPE_AHEAD_MS = 500;
|
|
11
|
+
var ROW_CLASS = cn("flex min-h-8 cursor-pointer items-center gap-1.5 rounded-sm pe-2 text-body-sm text-fg-body outline-none", "hover:bg-subtle focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset", "data-selected:bg-primary-light data-selected:text-primary-text aria-disabled:cursor-not-allowed aria-disabled:opacity-48");
|
|
12
|
+
/**
|
|
13
|
+
* A tree of items that open and close: folders and files, a hierarchy of categories. A tree is one stop in the Tab
|
|
14
|
+
* order; the arrow keys do the rest: Up and Down move through what is showing, the key toward the end edge opens a
|
|
15
|
+
* branch (and, on an open one, goes to its first child), the key toward the start edge closes it (and, on a
|
|
16
|
+
* closed one, goes to its parent), Home and End go to the first and last, Enter or Space chooses, and typing the
|
|
17
|
+
* start of a label goes to the next item that has it. A click chooses an item and opens or closes a branch; a
|
|
18
|
+
* disabled item can be reached but not chosen, opened or closed. For picking one value from a list, see TreeSelect.
|
|
19
|
+
*/
|
|
20
|
+
var TreeView = (t0) => {
|
|
21
|
+
const $ = c(43);
|
|
22
|
+
const { items, selected: t1, onSelectedChange, expanded, defaultExpanded: t2, onExpandedChange, "aria-label": ariaLabel, className } = t0;
|
|
23
|
+
const selected = t1 === void 0 ? null : t1;
|
|
24
|
+
let t3;
|
|
25
|
+
if ($[0] !== t2) {
|
|
26
|
+
t3 = t2 === void 0 ? [] : t2;
|
|
27
|
+
$[0] = t2;
|
|
28
|
+
$[1] = t3;
|
|
29
|
+
} else t3 = $[1];
|
|
30
|
+
const defaultExpanded = t3;
|
|
31
|
+
const direction = useDirection();
|
|
32
|
+
const [ownExpanded, setOwnExpanded] = useState(defaultExpanded);
|
|
33
|
+
const open = expanded ?? ownExpanded;
|
|
34
|
+
const [focusId, setFocusId] = useState(null);
|
|
35
|
+
const root = useRef(null);
|
|
36
|
+
const shouldFocus = useRef(false);
|
|
37
|
+
let t4;
|
|
38
|
+
if ($[2] !== expanded || $[3] !== onExpandedChange) {
|
|
39
|
+
t4 = (next) => {
|
|
40
|
+
if (expanded === void 0) setOwnExpanded(next);
|
|
41
|
+
onExpandedChange?.(next);
|
|
42
|
+
};
|
|
43
|
+
$[2] = expanded;
|
|
44
|
+
$[3] = onExpandedChange;
|
|
45
|
+
$[4] = t4;
|
|
46
|
+
} else t4 = $[4];
|
|
47
|
+
const setOpen = t4;
|
|
48
|
+
let t5;
|
|
49
|
+
if ($[5] !== open || $[6] !== setOpen) {
|
|
50
|
+
t5 = (id, to) => {
|
|
51
|
+
setOpen(to ? [...open.filter((other) => other !== id), id] : open.filter((other_0) => other_0 !== id));
|
|
52
|
+
};
|
|
53
|
+
$[5] = open;
|
|
54
|
+
$[6] = setOpen;
|
|
55
|
+
$[7] = t5;
|
|
56
|
+
} else t5 = $[7];
|
|
57
|
+
const toggle = t5;
|
|
58
|
+
let rows;
|
|
59
|
+
if ($[8] !== items || $[9] !== open) {
|
|
60
|
+
rows = [];
|
|
61
|
+
const collect = (list, level, parent) => {
|
|
62
|
+
list.forEach((item, at) => {
|
|
63
|
+
rows.push({
|
|
64
|
+
item,
|
|
65
|
+
level,
|
|
66
|
+
position: at + 1,
|
|
67
|
+
size: list.length,
|
|
68
|
+
parent
|
|
69
|
+
});
|
|
70
|
+
if (item.children && open.includes(item.id)) collect(item.children, level + 1, item.id);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
collect(items, 1, null);
|
|
74
|
+
$[8] = items;
|
|
75
|
+
$[9] = open;
|
|
76
|
+
$[10] = rows;
|
|
77
|
+
} else rows = $[10];
|
|
78
|
+
let t6;
|
|
79
|
+
if ($[11] !== focusId || $[12] !== rows || $[13] !== selected) {
|
|
80
|
+
t6 = rows.find((row_0) => row_0.item.id === focusId)?.item.id ?? rows.find((row) => row.item.id === selected)?.item.id ?? rows[0]?.item.id;
|
|
81
|
+
$[11] = focusId;
|
|
82
|
+
$[12] = rows;
|
|
83
|
+
$[13] = selected;
|
|
84
|
+
$[14] = t6;
|
|
85
|
+
} else t6 = $[14];
|
|
86
|
+
const tabId = t6;
|
|
87
|
+
let t7;
|
|
88
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
89
|
+
t7 = () => {
|
|
90
|
+
if (!shouldFocus.current) return;
|
|
91
|
+
shouldFocus.current = false;
|
|
92
|
+
root.current?.querySelector("[data-tab-stop]")?.focus();
|
|
93
|
+
};
|
|
94
|
+
$[15] = t7;
|
|
95
|
+
} else t7 = $[15];
|
|
96
|
+
useEffect(t7);
|
|
97
|
+
let t8;
|
|
98
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
99
|
+
t8 = (id_0) => {
|
|
100
|
+
shouldFocus.current = true;
|
|
101
|
+
setFocusId(id_0);
|
|
102
|
+
};
|
|
103
|
+
$[16] = t8;
|
|
104
|
+
} else t8 = $[16];
|
|
105
|
+
const reach = t8;
|
|
106
|
+
let t9;
|
|
107
|
+
if ($[17] !== onSelectedChange) {
|
|
108
|
+
t9 = (row_1) => {
|
|
109
|
+
if (row_1.item.disabled) return;
|
|
110
|
+
setFocusId(row_1.item.id);
|
|
111
|
+
onSelectedChange?.(row_1.item.id);
|
|
112
|
+
};
|
|
113
|
+
$[17] = onSelectedChange;
|
|
114
|
+
$[18] = t9;
|
|
115
|
+
} else t9 = $[18];
|
|
116
|
+
const choose = t9;
|
|
117
|
+
let t10;
|
|
118
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t10 = {
|
|
120
|
+
text: "",
|
|
121
|
+
timer: void 0
|
|
122
|
+
};
|
|
123
|
+
$[19] = t10;
|
|
124
|
+
} else t10 = $[19];
|
|
125
|
+
const typed = useRef(t10);
|
|
126
|
+
let t11;
|
|
127
|
+
let t12;
|
|
128
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
129
|
+
t11 = () => () => {
|
|
130
|
+
clearTimeout(typed.current.timer);
|
|
131
|
+
};
|
|
132
|
+
t12 = [];
|
|
133
|
+
$[20] = t11;
|
|
134
|
+
$[21] = t12;
|
|
135
|
+
} else {
|
|
136
|
+
t11 = $[20];
|
|
137
|
+
t12 = $[21];
|
|
138
|
+
}
|
|
139
|
+
useEffect(t11, t12);
|
|
140
|
+
let t13;
|
|
141
|
+
if ($[22] !== rows) {
|
|
142
|
+
t13 = (key, at_0) => {
|
|
143
|
+
const buffer = typed.current;
|
|
144
|
+
clearTimeout(buffer.timer);
|
|
145
|
+
buffer.text = buffer.text + key.toLocaleLowerCase();
|
|
146
|
+
buffer.timer = setTimeout(() => {
|
|
147
|
+
buffer.text = "";
|
|
148
|
+
}, TYPE_AHEAD_MS);
|
|
149
|
+
const from = buffer.text.length === 1 ? at_0 + 1 : at_0;
|
|
150
|
+
const found = [...rows.slice(from), ...rows.slice(0, from)].find((candidate) => !candidate.item.disabled && candidate.item.label.toLocaleLowerCase().startsWith(buffer.text));
|
|
151
|
+
if (found) reach(found.item.id);
|
|
152
|
+
};
|
|
153
|
+
$[22] = rows;
|
|
154
|
+
$[23] = t13;
|
|
155
|
+
} else t13 = $[23];
|
|
156
|
+
const typeAhead = t13;
|
|
157
|
+
let t14;
|
|
158
|
+
if ($[24] !== choose || $[25] !== direction || $[26] !== open || $[27] !== rows || $[28] !== toggle || $[29] !== typeAhead) {
|
|
159
|
+
t14 = (event) => {
|
|
160
|
+
const id_1 = event.target.closest("[data-tree-id]")?.dataset.treeId;
|
|
161
|
+
const at_1 = rows.findIndex((row_2) => row_2.item.id === id_1);
|
|
162
|
+
const row_3 = rows[at_1];
|
|
163
|
+
if (!row_3) return;
|
|
164
|
+
const end = direction === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
165
|
+
const start = direction === "rtl" ? "ArrowRight" : "ArrowLeft";
|
|
166
|
+
const isBranch = row_3.item.children !== void 0;
|
|
167
|
+
const isOpen = open.includes(row_3.item.id);
|
|
168
|
+
const canToggle = isBranch && !row_3.item.disabled;
|
|
169
|
+
let next_0;
|
|
170
|
+
if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey && (event.key !== " " || typed.current.text !== "")) {
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
typeAhead(event.key, at_1);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (event.key === "ArrowDown") next_0 = rows[at_1 + 1]?.item.id;
|
|
176
|
+
else if (event.key === "ArrowUp") next_0 = rows[at_1 - 1]?.item.id;
|
|
177
|
+
else if (event.key === "Home") next_0 = rows[0]?.item.id;
|
|
178
|
+
else if (event.key === "End") next_0 = rows[rows.length - 1]?.item.id;
|
|
179
|
+
else if (event.key === end) {
|
|
180
|
+
if (!isBranch) return;
|
|
181
|
+
if (!isOpen) {
|
|
182
|
+
event.preventDefault();
|
|
183
|
+
if (canToggle) toggle(row_3.item.id, true);
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
next_0 = rows[at_1 + 1]?.item.id;
|
|
187
|
+
} else if (event.key === start) {
|
|
188
|
+
if (canToggle && isOpen) {
|
|
189
|
+
event.preventDefault();
|
|
190
|
+
toggle(row_3.item.id, false);
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
next_0 = row_3.parent ?? void 0;
|
|
194
|
+
} else if (event.key === "Enter" || event.key === " ") {
|
|
195
|
+
event.preventDefault();
|
|
196
|
+
if (row_3.item.disabled) return;
|
|
197
|
+
choose(row_3);
|
|
198
|
+
if (canToggle) toggle(row_3.item.id, !isOpen);
|
|
199
|
+
return;
|
|
200
|
+
} else return;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
if (next_0 !== void 0) reach(next_0);
|
|
203
|
+
};
|
|
204
|
+
$[24] = choose;
|
|
205
|
+
$[25] = direction;
|
|
206
|
+
$[26] = open;
|
|
207
|
+
$[27] = rows;
|
|
208
|
+
$[28] = toggle;
|
|
209
|
+
$[29] = typeAhead;
|
|
210
|
+
$[30] = t14;
|
|
211
|
+
} else t14 = $[30];
|
|
212
|
+
const onKeyDown = t14;
|
|
213
|
+
let t15;
|
|
214
|
+
if ($[31] !== ariaLabel || $[32] !== choose || $[33] !== className || $[34] !== items || $[35] !== onKeyDown || $[36] !== open || $[37] !== selected || $[38] !== tabId || $[39] !== toggle) {
|
|
215
|
+
const branch = (list_0, level_0) => list_0.map((item_0, at_2) => {
|
|
216
|
+
const isBranch_0 = item_0.children !== void 0;
|
|
217
|
+
const isOpen_0 = isBranch_0 && open.includes(item_0.id);
|
|
218
|
+
const row_4 = {
|
|
219
|
+
item: item_0,
|
|
220
|
+
level: level_0,
|
|
221
|
+
position: at_2 + 1,
|
|
222
|
+
size: list_0.length,
|
|
223
|
+
parent: null
|
|
224
|
+
};
|
|
225
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
226
|
+
role: "none",
|
|
227
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
228
|
+
role: "treeitem",
|
|
229
|
+
"data-tree-id": item_0.id,
|
|
230
|
+
"aria-level": level_0,
|
|
231
|
+
"aria-posinset": at_2 + 1,
|
|
232
|
+
"aria-setsize": list_0.length,
|
|
233
|
+
"aria-selected": selected === item_0.id,
|
|
234
|
+
"aria-disabled": item_0.disabled || void 0,
|
|
235
|
+
...isBranch_0 ? { "aria-expanded": isOpen_0 } : {},
|
|
236
|
+
tabIndex: item_0.id === tabId ? 0 : -1,
|
|
237
|
+
...item_0.id === tabId ? { "data-tab-stop": "" } : {},
|
|
238
|
+
...selected === item_0.id ? { "data-selected": "" } : {},
|
|
239
|
+
className: ROW_CLASS,
|
|
240
|
+
style: { paddingInlineStart: `${String(level_0 * 12 - 4)}px` },
|
|
241
|
+
onClick: () => {
|
|
242
|
+
choose(row_4);
|
|
243
|
+
if (isBranch_0 && !item_0.disabled) toggle(item_0.id, !isOpen_0);
|
|
244
|
+
},
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("span", {
|
|
247
|
+
className: "inline-flex size-4 shrink-0 items-center justify-center text-fg-secondary",
|
|
248
|
+
children: isBranch_0 ? /* @__PURE__ */ jsx(ChevronRight, {
|
|
249
|
+
"aria-hidden": "true",
|
|
250
|
+
className: cn("size-3.5 transition-transform duration-150 motion-reduce:transition-none rtl:rotate-180", isOpen_0 && "rotate-90 rtl:rotate-90")
|
|
251
|
+
}) : null
|
|
252
|
+
}),
|
|
253
|
+
item_0.icon ? /* @__PURE__ */ jsx("span", {
|
|
254
|
+
className: "inline-flex shrink-0 [&_svg]:size-4",
|
|
255
|
+
children: item_0.icon
|
|
256
|
+
}) : null,
|
|
257
|
+
/* @__PURE__ */ jsx("span", {
|
|
258
|
+
className: "min-w-0 truncate",
|
|
259
|
+
children: item_0.label
|
|
260
|
+
})
|
|
261
|
+
]
|
|
262
|
+
}), isBranch_0 && isOpen_0 ? /* @__PURE__ */ jsx("ul", {
|
|
263
|
+
role: "group",
|
|
264
|
+
className: "m-0 list-none p-0",
|
|
265
|
+
children: branch(item_0.children ?? [], level_0 + 1)
|
|
266
|
+
}) : null]
|
|
267
|
+
}, item_0.id);
|
|
268
|
+
});
|
|
269
|
+
let t16;
|
|
270
|
+
if ($[41] !== className) {
|
|
271
|
+
t16 = cn("m-0 list-none p-0", className);
|
|
272
|
+
$[41] = className;
|
|
273
|
+
$[42] = t16;
|
|
274
|
+
} else t16 = $[42];
|
|
275
|
+
t15 = /* @__PURE__ */ jsx("ul", {
|
|
276
|
+
ref: root,
|
|
277
|
+
role: "tree",
|
|
278
|
+
"aria-label": ariaLabel,
|
|
279
|
+
className: t16,
|
|
280
|
+
onKeyDown,
|
|
281
|
+
children: branch(items, 1)
|
|
282
|
+
});
|
|
283
|
+
$[31] = ariaLabel;
|
|
284
|
+
$[32] = choose;
|
|
285
|
+
$[33] = className;
|
|
286
|
+
$[34] = items;
|
|
287
|
+
$[35] = onKeyDown;
|
|
288
|
+
$[36] = open;
|
|
289
|
+
$[37] = selected;
|
|
290
|
+
$[38] = tabId;
|
|
291
|
+
$[39] = toggle;
|
|
292
|
+
$[40] = t15;
|
|
293
|
+
} else t15 = $[40];
|
|
294
|
+
return t15;
|
|
295
|
+
};
|
|
296
|
+
export { TreeView };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ToastIntent } from "../components/Toast/toast-manager.js";
|
|
3
|
+
import type { Theme } from "../theme/create-theme.js";
|
|
4
|
+
import { type TenantBranding } from "../theme/tenant-branding.js";
|
|
5
|
+
import type { TextDirection, ThemePreference } from "../types/direction.js";
|
|
6
|
+
/** The toasts' words: any of them, the rest in English. */
|
|
7
|
+
export interface ToastLabelsInput {
|
|
8
|
+
/** A toast's title by its intent (success, error ...), e.g. `{ error: "Erreur" }`. */
|
|
9
|
+
titles?: Partial<Record<ToastIntent, string>> | undefined;
|
|
10
|
+
/** The accessible name of a toast's dismiss button. */
|
|
11
|
+
dismiss?: string | undefined;
|
|
12
|
+
/** The accessible name of the region that holds the toasts. */
|
|
13
|
+
region?: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface DesignSystemProviderProps {
|
|
16
|
+
/** `"light"` or `"dark"`, or `"system"` to follow the operating system's setting, and change with it. */
|
|
17
|
+
themeMode: ThemePreference;
|
|
18
|
+
/** The text direction, `"ltr"` or `"rtl"`: the `dir` on <html>, and the way Base UI's keys and popups run. */
|
|
19
|
+
direction: TextDirection;
|
|
20
|
+
/** A tenant's own primary colour. Omit for the default teal. */
|
|
21
|
+
branding?: TenantBranding | null | undefined;
|
|
22
|
+
/** A theme made with `createTheme`: the primary colour and any other tokens. */
|
|
23
|
+
theme?: Theme | null | undefined;
|
|
24
|
+
/** The toasts' titles and dismiss label, in the user's language. Any left out are in English. */
|
|
25
|
+
toastLabels?: ToastLabelsInput | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The page's Content-Security-Policy nonce. It goes on every <style> and <script> tag the design system
|
|
28
|
+
* adds: Base UI's own (a ScrollArea's scrollbar style, a Select aligned with its trigger) and the provider's
|
|
29
|
+
* (the theme, the branding, the instant theme switch). Omit where no policy applies.
|
|
30
|
+
*/
|
|
31
|
+
nonce?: string | undefined;
|
|
32
|
+
/** The app. */
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Applies the theme, text direction and tenant branding, and hosts the app
|
|
37
|
+
* toaster and the shared tooltip delay.
|
|
38
|
+
*
|
|
39
|
+
* The theme is `data-theme` and the direction is `dir`, both on <html>: the CSS
|
|
40
|
+
* variables switch on the first, logical utilities and the font on the second.
|
|
41
|
+
* They go on the root, not a wrapper element, because Base UI portals (menus,
|
|
42
|
+
* dialogs, tooltips, toasts) render into <body> and would otherwise sit outside
|
|
43
|
+
* a wrapper's theme. DirectionProvider only tells Base UI's own behaviour (arrow
|
|
44
|
+
* keys, popup placement) which way the text runs; it does not touch the DOM.
|
|
45
|
+
* CSPProvider gives Base UI's own inline tags the page's nonce, and the provider puts it on
|
|
46
|
+
* the <style> elements it adds itself, so a strict policy allows them all.
|
|
47
|
+
*
|
|
48
|
+
* One provider per page: what it sets lives on <html>. A provider inside another only tells Base UI's
|
|
49
|
+
* behaviour its `direction` (put the same `dir` on that part of the page yourself); the outer one keeps the
|
|
50
|
+
* theme, the branding and the toaster, so the two cannot undo each other. When the provider unmounts, <html>
|
|
51
|
+
* gets back the `dir` and `data-theme` it had before (none, or the server's), and the theme's and branding's
|
|
52
|
+
* <style> elements go.
|
|
53
|
+
*/
|
|
54
|
+
export declare const DesignSystemProvider: ({ themeMode, direction, branding, theme, toastLabels, nonce, children, }: DesignSystemProviderProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { CSPProvider } from "@base-ui/react/csp-provider";
|
|
5
|
+
import { DirectionProvider } from "@base-ui/react/direction-provider";
|
|
6
|
+
import { Toast } from "@base-ui/react/toast";
|
|
7
|
+
import { Tooltip } from "@base-ui/react/tooltip";
|
|
8
|
+
import { AppToaster } from "../components/Toast/AppToaster.js";
|
|
9
|
+
import { ENGLISH_TOAST_LABELS, TOAST_TIMEOUT_MS, appToastManager, setToasterReady } from "../components/Toast/toast-manager.js";
|
|
10
|
+
import { BRANDING_STYLE_ID, THEME_STYLE_ID, setStyleElement } from "../theme/style-element.js";
|
|
11
|
+
import { NonceContext } from "./nonce.js";
|
|
12
|
+
import { brandingToCss } from "../theme/tenant-branding.js";
|
|
13
|
+
import { applyThemePreference, restoreThemeAttribute } from "../theme/theme-switch.js";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
// src/provider/DesignSystemProvider.tsx
|
|
16
|
+
/** True inside a DesignSystemProvider, so a nested one knows the page already has one. */
|
|
17
|
+
var InsideProvider = createContext(false);
|
|
18
|
+
var toastLabelsOf = (input) => ({
|
|
19
|
+
titles: {
|
|
20
|
+
...ENGLISH_TOAST_LABELS.titles,
|
|
21
|
+
...input?.titles
|
|
22
|
+
},
|
|
23
|
+
dismiss: input?.dismiss ?? ENGLISH_TOAST_LABELS.dismiss,
|
|
24
|
+
region: input?.region ?? ENGLISH_TOAST_LABELS.region
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Applies the theme, text direction and tenant branding, and hosts the app
|
|
28
|
+
* toaster and the shared tooltip delay.
|
|
29
|
+
*
|
|
30
|
+
* The theme is `data-theme` and the direction is `dir`, both on <html>: the CSS
|
|
31
|
+
* variables switch on the first, logical utilities and the font on the second.
|
|
32
|
+
* They go on the root, not a wrapper element, because Base UI portals (menus,
|
|
33
|
+
* dialogs, tooltips, toasts) render into <body> and would otherwise sit outside
|
|
34
|
+
* a wrapper's theme. DirectionProvider only tells Base UI's own behaviour (arrow
|
|
35
|
+
* keys, popup placement) which way the text runs; it does not touch the DOM.
|
|
36
|
+
* CSPProvider gives Base UI's own inline tags the page's nonce, and the provider puts it on
|
|
37
|
+
* the <style> elements it adds itself, so a strict policy allows them all.
|
|
38
|
+
*
|
|
39
|
+
* One provider per page: what it sets lives on <html>. A provider inside another only tells Base UI's
|
|
40
|
+
* behaviour its `direction` (put the same `dir` on that part of the page yourself); the outer one keeps the
|
|
41
|
+
* theme, the branding and the toaster, so the two cannot undo each other. When the provider unmounts, <html>
|
|
42
|
+
* gets back the `dir` and `data-theme` it had before (none, or the server's), and the theme's and branding's
|
|
43
|
+
* <style> elements go.
|
|
44
|
+
*/
|
|
45
|
+
var DesignSystemProvider = (t0) => {
|
|
46
|
+
const $ = c(48);
|
|
47
|
+
const { themeMode, direction, branding: t1, theme: t2, toastLabels, nonce, children } = t0;
|
|
48
|
+
const branding = t1 === void 0 ? null : t1;
|
|
49
|
+
const theme = t2 === void 0 ? null : t2;
|
|
50
|
+
const isNested = useContext(InsideProvider);
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[0] !== branding) {
|
|
53
|
+
t3 = branding ? brandingToCss(branding) : null;
|
|
54
|
+
$[0] = branding;
|
|
55
|
+
$[1] = t3;
|
|
56
|
+
} else t3 = $[1];
|
|
57
|
+
const brandingCss = t3;
|
|
58
|
+
const themeCss = theme && theme.css !== "" ? theme.css : null;
|
|
59
|
+
const latestNonce = useRef(nonce);
|
|
60
|
+
let t4;
|
|
61
|
+
let t5;
|
|
62
|
+
if ($[2] !== nonce) {
|
|
63
|
+
t4 = () => {
|
|
64
|
+
latestNonce.current = nonce;
|
|
65
|
+
};
|
|
66
|
+
t5 = [nonce];
|
|
67
|
+
$[2] = nonce;
|
|
68
|
+
$[3] = t4;
|
|
69
|
+
$[4] = t5;
|
|
70
|
+
} else {
|
|
71
|
+
t4 = $[3];
|
|
72
|
+
t5 = $[4];
|
|
73
|
+
}
|
|
74
|
+
useLayoutEffect(t4, t5);
|
|
75
|
+
let t6;
|
|
76
|
+
let t7;
|
|
77
|
+
if ($[5] !== isNested) {
|
|
78
|
+
t6 = () => {
|
|
79
|
+
if (isNested) return;
|
|
80
|
+
const root = document.documentElement;
|
|
81
|
+
const previousDir = root.getAttribute("dir");
|
|
82
|
+
const previousTheme = root.getAttribute("data-theme");
|
|
83
|
+
return () => {
|
|
84
|
+
if (previousDir === null) root.removeAttribute("dir");
|
|
85
|
+
else root.setAttribute("dir", previousDir);
|
|
86
|
+
restoreThemeAttribute(previousTheme, latestNonce.current);
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
t7 = [isNested];
|
|
90
|
+
$[5] = isNested;
|
|
91
|
+
$[6] = t6;
|
|
92
|
+
$[7] = t7;
|
|
93
|
+
} else {
|
|
94
|
+
t6 = $[6];
|
|
95
|
+
t7 = $[7];
|
|
96
|
+
}
|
|
97
|
+
useLayoutEffect(t6, t7);
|
|
98
|
+
let t8;
|
|
99
|
+
let t9;
|
|
100
|
+
if ($[8] !== isNested || $[9] !== nonce || $[10] !== themeMode) {
|
|
101
|
+
t8 = () => isNested ? void 0 : applyThemePreference(themeMode, nonce);
|
|
102
|
+
t9 = [
|
|
103
|
+
isNested,
|
|
104
|
+
themeMode,
|
|
105
|
+
nonce
|
|
106
|
+
];
|
|
107
|
+
$[8] = isNested;
|
|
108
|
+
$[9] = nonce;
|
|
109
|
+
$[10] = themeMode;
|
|
110
|
+
$[11] = t8;
|
|
111
|
+
$[12] = t9;
|
|
112
|
+
} else {
|
|
113
|
+
t8 = $[11];
|
|
114
|
+
t9 = $[12];
|
|
115
|
+
}
|
|
116
|
+
useLayoutEffect(t8, t9);
|
|
117
|
+
let t10;
|
|
118
|
+
let t11;
|
|
119
|
+
if ($[13] !== direction || $[14] !== isNested) {
|
|
120
|
+
t10 = () => {
|
|
121
|
+
if (!isNested) document.documentElement.dir = direction;
|
|
122
|
+
};
|
|
123
|
+
t11 = [isNested, direction];
|
|
124
|
+
$[13] = direction;
|
|
125
|
+
$[14] = isNested;
|
|
126
|
+
$[15] = t10;
|
|
127
|
+
$[16] = t11;
|
|
128
|
+
} else {
|
|
129
|
+
t10 = $[15];
|
|
130
|
+
t11 = $[16];
|
|
131
|
+
}
|
|
132
|
+
useLayoutEffect(t10, t11);
|
|
133
|
+
let t12;
|
|
134
|
+
let t13;
|
|
135
|
+
if ($[17] !== brandingCss || $[18] !== isNested || $[19] !== nonce || $[20] !== themeCss) {
|
|
136
|
+
t12 = () => {
|
|
137
|
+
if (isNested) return;
|
|
138
|
+
setStyleElement(document, BRANDING_STYLE_ID, brandingCss, nonce, THEME_STYLE_ID);
|
|
139
|
+
setStyleElement(document, THEME_STYLE_ID, themeCss, nonce);
|
|
140
|
+
};
|
|
141
|
+
t13 = [
|
|
142
|
+
isNested,
|
|
143
|
+
brandingCss,
|
|
144
|
+
themeCss,
|
|
145
|
+
nonce
|
|
146
|
+
];
|
|
147
|
+
$[17] = brandingCss;
|
|
148
|
+
$[18] = isNested;
|
|
149
|
+
$[19] = nonce;
|
|
150
|
+
$[20] = themeCss;
|
|
151
|
+
$[21] = t12;
|
|
152
|
+
$[22] = t13;
|
|
153
|
+
} else {
|
|
154
|
+
t12 = $[21];
|
|
155
|
+
t13 = $[22];
|
|
156
|
+
}
|
|
157
|
+
useLayoutEffect(t12, t13);
|
|
158
|
+
let t14;
|
|
159
|
+
let t15;
|
|
160
|
+
if ($[23] !== isNested) {
|
|
161
|
+
t14 = () => () => {
|
|
162
|
+
if (isNested) return;
|
|
163
|
+
setStyleElement(document, BRANDING_STYLE_ID, null);
|
|
164
|
+
setStyleElement(document, THEME_STYLE_ID, null);
|
|
165
|
+
};
|
|
166
|
+
t15 = [isNested];
|
|
167
|
+
$[23] = isNested;
|
|
168
|
+
$[24] = t14;
|
|
169
|
+
$[25] = t15;
|
|
170
|
+
} else {
|
|
171
|
+
t14 = $[24];
|
|
172
|
+
t15 = $[25];
|
|
173
|
+
}
|
|
174
|
+
useLayoutEffect(t14, t15);
|
|
175
|
+
let t16;
|
|
176
|
+
let t17;
|
|
177
|
+
if ($[26] !== isNested) {
|
|
178
|
+
t16 = () => {
|
|
179
|
+
if (isNested) return;
|
|
180
|
+
setToasterReady(true);
|
|
181
|
+
return _temp;
|
|
182
|
+
};
|
|
183
|
+
t17 = [isNested];
|
|
184
|
+
$[26] = isNested;
|
|
185
|
+
$[27] = t16;
|
|
186
|
+
$[28] = t17;
|
|
187
|
+
} else {
|
|
188
|
+
t16 = $[27];
|
|
189
|
+
t17 = $[28];
|
|
190
|
+
}
|
|
191
|
+
useEffect(t16, t17);
|
|
192
|
+
if (isNested) {
|
|
193
|
+
let t18;
|
|
194
|
+
if ($[29] !== children || $[30] !== direction) {
|
|
195
|
+
t18 = /* @__PURE__ */ jsx(DirectionProvider, {
|
|
196
|
+
direction,
|
|
197
|
+
children
|
|
198
|
+
});
|
|
199
|
+
$[29] = children;
|
|
200
|
+
$[30] = direction;
|
|
201
|
+
$[31] = t18;
|
|
202
|
+
} else t18 = $[31];
|
|
203
|
+
return t18;
|
|
204
|
+
}
|
|
205
|
+
let t18;
|
|
206
|
+
if ($[32] !== toastLabels) {
|
|
207
|
+
t18 = toastLabelsOf(toastLabels);
|
|
208
|
+
$[32] = toastLabels;
|
|
209
|
+
$[33] = t18;
|
|
210
|
+
} else t18 = $[33];
|
|
211
|
+
let t19;
|
|
212
|
+
if ($[34] !== t18) {
|
|
213
|
+
t19 = /* @__PURE__ */ jsx(AppToaster, { labels: t18 });
|
|
214
|
+
$[34] = t18;
|
|
215
|
+
$[35] = t19;
|
|
216
|
+
} else t19 = $[35];
|
|
217
|
+
let t20;
|
|
218
|
+
if ($[36] !== children || $[37] !== t19) {
|
|
219
|
+
t20 = /* @__PURE__ */ jsx(Tooltip.Provider, {
|
|
220
|
+
delay: 400,
|
|
221
|
+
children: /* @__PURE__ */ jsxs(Toast.Provider, {
|
|
222
|
+
toastManager: appToastManager,
|
|
223
|
+
timeout: TOAST_TIMEOUT_MS,
|
|
224
|
+
limit: 4,
|
|
225
|
+
children: [children, t19]
|
|
226
|
+
})
|
|
227
|
+
});
|
|
228
|
+
$[36] = children;
|
|
229
|
+
$[37] = t19;
|
|
230
|
+
$[38] = t20;
|
|
231
|
+
} else t20 = $[38];
|
|
232
|
+
let t21;
|
|
233
|
+
if ($[39] !== direction || $[40] !== t20) {
|
|
234
|
+
t21 = /* @__PURE__ */ jsx(DirectionProvider, {
|
|
235
|
+
direction,
|
|
236
|
+
children: t20
|
|
237
|
+
});
|
|
238
|
+
$[39] = direction;
|
|
239
|
+
$[40] = t20;
|
|
240
|
+
$[41] = t21;
|
|
241
|
+
} else t21 = $[41];
|
|
242
|
+
let t22;
|
|
243
|
+
if ($[42] !== nonce || $[43] !== t21) {
|
|
244
|
+
t22 = /* @__PURE__ */ jsx(CSPProvider, {
|
|
245
|
+
nonce,
|
|
246
|
+
children: t21
|
|
247
|
+
});
|
|
248
|
+
$[42] = nonce;
|
|
249
|
+
$[43] = t21;
|
|
250
|
+
$[44] = t22;
|
|
251
|
+
} else t22 = $[44];
|
|
252
|
+
let t23;
|
|
253
|
+
if ($[45] !== nonce || $[46] !== t22) {
|
|
254
|
+
t23 = /* @__PURE__ */ jsx(InsideProvider.Provider, {
|
|
255
|
+
value: true,
|
|
256
|
+
children: /* @__PURE__ */ jsx(NonceContext.Provider, {
|
|
257
|
+
value: nonce,
|
|
258
|
+
children: t22
|
|
259
|
+
})
|
|
260
|
+
});
|
|
261
|
+
$[45] = nonce;
|
|
262
|
+
$[46] = t22;
|
|
263
|
+
$[47] = t23;
|
|
264
|
+
} else t23 = $[47];
|
|
265
|
+
return t23;
|
|
266
|
+
};
|
|
267
|
+
function _temp() {
|
|
268
|
+
setToasterReady(false);
|
|
269
|
+
}
|
|
270
|
+
export { DesignSystemProvider };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page's Content-Security-Policy nonce, as given to DesignSystemProvider. A component that makes a <style> or
|
|
3
|
+
* <script> tag of its own (the rich text editor's base styles) reads it here, so a strict policy allows that tag too.
|
|
4
|
+
*/
|
|
5
|
+
export declare const NonceContext: import("react").Context<string | undefined>;
|
|
6
|
+
/** The nonce DesignSystemProvider was given, or undefined outside one or without one. */
|
|
7
|
+
export declare const useNonce: () => string | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
// src/provider/nonce.ts
|
|
4
|
+
/**
|
|
5
|
+
* The page's Content-Security-Policy nonce, as given to DesignSystemProvider. A component that makes a <style> or
|
|
6
|
+
* <script> tag of its own (the rich text editor's base styles) reads it here, so a strict policy allows that tag too.
|
|
7
|
+
*/
|
|
8
|
+
var NonceContext = createContext(void 0);
|
|
9
|
+
/** The nonce DesignSystemProvider was given, or undefined outside one or without one. */
|
|
10
|
+
var useNonce = () => {
|
|
11
|
+
return useContext(NonceContext);
|
|
12
|
+
};
|
|
13
|
+
export { NonceContext, useNonce };
|