@galaxy-io/dls 1.6.1 → 2.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 +47 -50
- package/biome/index.json +74 -0
- package/biome/plugins/no-hex-literal.grit +20 -0
- package/biome/plugins/no-inline-style.grit +13 -0
- package/biome/plugins/no-margin.grit +9 -0
- package/biome/plugins/warn/no-hex-literal.grit +23 -0
- package/biome/plugins/warn/no-inline-style.grit +13 -0
- package/biome/plugins/warn/no-margin.grit +9 -0
- package/dist/a11y/FocusScope.d.ts +44 -0
- package/dist/a11y/FocusScope.js +229 -0
- package/dist/a11y/VisuallyHidden.d.ts +21 -0
- package/dist/a11y/VisuallyHidden.js +30 -0
- package/dist/avatar/Avatar.d.ts +56 -14
- package/dist/avatar/Avatar.js +250 -96
- package/dist/avatar/AvatarGroup.d.ts +43 -0
- package/dist/avatar/AvatarGroup.js +153 -0
- package/dist/backgrounds/GridBackground.d.ts +48 -0
- package/dist/backgrounds/GridBackground.js +146 -0
- package/dist/beacons/Beacon.d.ts +86 -22
- package/dist/beacons/Beacon.js +170 -47
- package/dist/brand/GalaxyFilamentWordmark.d.ts +30 -0
- package/dist/brand/GalaxyFilamentWordmark.js +39 -0
- package/dist/brand/GalaxyLogomark.d.ts +26 -0
- package/dist/brand/GalaxyLogomark.js +41 -0
- package/dist/brand/GalaxyLogomarkAnimation.d.ts +36 -0
- package/dist/brand/GalaxyLogomarkAnimation.js +107 -0
- package/dist/brand/GalaxyWordmark.d.ts +30 -0
- package/dist/brand/GalaxyWordmark.js +63 -0
- package/dist/brand/assets/galaxy-logomark-animation.js +136678 -0
- package/dist/brand/brandMark.d.ts +26 -0
- package/dist/brand/brandMark.js +35 -0
- package/dist/buttons/Button.d.ts +148 -59
- package/dist/buttons/Button.js +437 -227
- package/dist/buttons/ButtonGroup.d.ts +38 -0
- package/dist/buttons/ButtonGroup.js +68 -0
- package/dist/buttons/CopyButton.d.ts +77 -0
- package/dist/buttons/CopyButton.js +65 -0
- package/dist/charts/AreaChart.d.ts +49 -0
- package/dist/charts/AreaChart.js +31 -0
- package/dist/charts/BarChart.d.ts +54 -67
- package/dist/charts/BarChart.js +160 -124
- package/dist/charts/ChartAxis.d.ts +35 -40
- package/dist/charts/ChartAxis.js +114 -90
- package/dist/charts/ChartCategoryTargets.d.ts +12 -26
- package/dist/charts/ChartCategoryTargets.js +33 -20
- package/dist/charts/ChartFrame.d.ts +71 -116
- package/dist/charts/ChartFrame.js +306 -97
- package/dist/charts/ChartGroupProvider.d.ts +30 -41
- package/dist/charts/ChartGroupProvider.js +20 -7
- package/dist/charts/ChartLegend.d.ts +37 -48
- package/dist/charts/ChartLegend.js +243 -125
- package/dist/charts/ChartMarkTargets.d.ts +12 -28
- package/dist/charts/ChartMarkTargets.js +34 -20
- package/dist/charts/ChartPrimitives.d.ts +50 -305
- package/dist/charts/ChartPrimitives.js +65 -413
- package/dist/charts/ChartTooltip.d.ts +20 -26
- package/dist/charts/ChartTooltip.js +77 -40
- package/dist/charts/Heatmap.d.ts +35 -0
- package/dist/charts/Heatmap.js +307 -0
- package/dist/charts/LineChart.d.ts +54 -47
- package/dist/charts/LineChart.js +174 -121
- package/dist/charts/PieChart.d.ts +32 -53
- package/dist/charts/PieChart.js +159 -136
- package/dist/charts/Sparkline.d.ts +107 -0
- package/dist/charts/Sparkline.js +244 -0
- package/dist/charts/StatChart.d.ts +37 -13
- package/dist/charts/StatChart.js +82 -35
- package/dist/charts/barChartGeometry.d.ts +138 -86
- package/dist/charts/barChartGeometry.js +122 -101
- package/dist/charts/barChartLegend.d.ts +14 -18
- package/dist/charts/barChartLegend.js +18 -13
- package/dist/charts/chartFormat.d.ts +12 -18
- package/dist/charts/chartFormat.js +20 -52
- package/dist/charts/chartPalette.d.ts +33 -0
- package/dist/charts/chartPalette.js +68 -0
- package/dist/charts/chartScales.d.ts +41 -108
- package/dist/charts/chartScales.js +62 -128
- package/dist/charts/chartSelection.d.ts +15 -0
- package/dist/charts/chartSelection.js +22 -0
- package/dist/charts/constants.d.ts +100 -256
- package/dist/charts/constants.js +109 -275
- package/dist/charts/heatmapGeometry.d.ts +95 -0
- package/dist/charts/heatmapGeometry.js +155 -0
- package/dist/charts/lineChartGeometry.d.ts +108 -58
- package/dist/charts/lineChartGeometry.js +120 -78
- package/dist/charts/pieChartGeometry.d.ts +66 -40
- package/dist/charts/pieChartGeometry.js +68 -38
- package/dist/charts/types.d.ts +206 -466
- package/dist/charts/types.js +55 -144
- package/dist/charts/useCartesianChartLayout.d.ts +28 -59
- package/dist/charts/useCartesianChartLayout.js +47 -32
- package/dist/charts/useChartDimensions.d.ts +19 -40
- package/dist/charts/useChartDimensions.js +40 -56
- package/dist/charts/useChartFormatters.d.ts +6 -15
- package/dist/charts/useChartFormatters.js +4 -9
- package/dist/charts/useChartInteraction.d.ts +69 -116
- package/dist/charts/useChartInteraction.js +148 -78
- package/dist/charts/useChartTooltipPosition.d.ts +29 -39
- package/dist/charts/useChartTooltipPosition.js +14 -5
- package/dist/charts/useSeriesColorResolver.d.ts +11 -33
- package/dist/charts/useSeriesColorResolver.js +19 -12
- package/dist/chips/Chip.d.ts +155 -44
- package/dist/chips/Chip.js +329 -155
- package/dist/chips/ChipGroup.d.ts +53 -0
- package/dist/chips/ChipGroup.js +98 -0
- package/dist/drawer/Drawer.d.ts +83 -17
- package/dist/drawer/Drawer.js +399 -65
- package/dist/dropdown/Dropdown.d.ts +80 -63
- package/dist/dropdown/Dropdown.js +127 -129
- package/dist/editor/CodeEditor.d.ts +119 -40
- package/dist/editor/CodeEditor.js +490 -400
- package/dist/editor/CodeEditorReactWidget.d.ts +20 -17
- package/dist/editor/CodeEditorReactWidget.js +28 -21
- package/dist/feedback/Alert.d.ts +49 -0
- package/dist/feedback/Alert.js +172 -0
- package/dist/feedback/EmptyState.d.ts +39 -0
- package/dist/feedback/EmptyState.js +109 -0
- package/dist/feedback/ProgressBar.d.ts +125 -0
- package/dist/feedback/ProgressBar.js +183 -0
- package/dist/feedback/ProgressCircle.d.ts +99 -0
- package/dist/feedback/ProgressCircle.js +187 -0
- package/dist/feedback/Skeleton.d.ts +69 -0
- package/dist/feedback/Skeleton.js +130 -0
- package/dist/feedback/Spinner.d.ts +63 -0
- package/dist/feedback/Spinner.js +141 -0
- package/dist/fonts.css +70 -0
- package/dist/hooks/internal/useIsClient.d.ts +2 -0
- package/dist/hooks/internal/useIsClient.js +14 -0
- package/dist/hooks/useClipboard.d.ts +19 -0
- package/dist/hooks/useClipboard.js +45 -0
- package/dist/hooks/useControlledOpenState.d.ts +21 -0
- package/dist/hooks/useControlledOpenState.js +19 -0
- package/dist/hooks/useControlledState.d.ts +19 -0
- package/dist/hooks/useControlledState.js +22 -0
- package/dist/hooks/useDebouncedValue.d.ts +14 -0
- package/dist/hooks/useDebouncedValue.js +33 -0
- package/dist/hooks/useDisclosure.d.ts +26 -0
- package/dist/hooks/useDisclosure.js +36 -0
- package/dist/hooks/useDismiss.d.ts +23 -27
- package/dist/hooks/useDismiss.js +39 -27
- package/dist/hooks/useElementClientSize.d.ts +10 -10
- package/dist/hooks/useElementClientSize.js +8 -11
- package/dist/hooks/useElementWidth.d.ts +6 -13
- package/dist/hooks/useElementWidth.js +6 -14
- package/dist/hooks/useField.d.ts +47 -0
- package/dist/hooks/useField.js +40 -0
- package/dist/hooks/useHotkey.d.ts +77 -0
- package/dist/hooks/useHotkey.js +246 -0
- package/dist/hooks/useIsMac.d.ts +12 -0
- package/dist/hooks/useIsMac.js +27 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +17 -0
- package/dist/hooks/useIsomorphicLayoutEffect.js +20 -0
- package/dist/hooks/useLocalStorage.d.ts +28 -0
- package/dist/hooks/useLocalStorage.js +145 -0
- package/dist/hooks/useMediaQuery.d.ts +11 -0
- package/dist/hooks/useMediaQuery.js +23 -0
- package/dist/hooks/usePrefersReducedMotion.d.ts +12 -0
- package/dist/hooks/usePrefersReducedMotion.js +25 -0
- package/dist/hooks/useResize.d.ts +42 -62
- package/dist/hooks/useResize.js +43 -31
- package/dist/icons/Icon.d.ts +64 -37
- package/dist/icons/Icon.js +96 -37
- package/dist/icons/internal/IconSlot.d.ts +10 -0
- package/dist/icons/internal/IconSlot.js +32 -0
- package/dist/inputs/CheckboxGroup.d.ts +115 -0
- package/dist/inputs/CheckboxGroup.js +183 -0
- package/dist/inputs/CheckboxInput.d.ts +98 -28
- package/dist/inputs/CheckboxInput.js +218 -88
- package/dist/inputs/ColorInput.d.ts +115 -29
- package/dist/inputs/ColorInput.js +748 -326
- package/dist/inputs/CopyInput.d.ts +49 -20
- package/dist/inputs/CopyInput.js +57 -49
- package/dist/inputs/CronInput.d.ts +94 -0
- package/dist/inputs/CronInput.js +618 -0
- package/dist/inputs/DateInput.d.ts +175 -28
- package/dist/inputs/DateInput.js +1109 -451
- package/dist/inputs/DurationInput.d.ts +101 -0
- package/dist/inputs/DurationInput.js +441 -0
- package/dist/inputs/Field.d.ts +75 -0
- package/dist/inputs/Field.js +247 -0
- package/dist/inputs/Fieldset.d.ts +53 -0
- package/dist/inputs/Fieldset.js +149 -0
- package/dist/inputs/FileInput.d.ts +110 -0
- package/dist/inputs/FileInput.js +476 -0
- package/dist/inputs/Input.d.ts +148 -187
- package/dist/inputs/Input.js +339 -259
- package/dist/inputs/KeyValueInput.d.ts +120 -0
- package/dist/inputs/KeyValueInput.js +383 -0
- package/dist/inputs/MultiSelectInput.d.ts +165 -54
- package/dist/inputs/MultiSelectInput.js +175 -559
- package/dist/inputs/NumberInput.d.ts +65 -9
- package/dist/inputs/NumberInput.js +197 -40
- package/dist/inputs/PasswordInput.d.ts +17 -12
- package/dist/inputs/PasswordInput.js +33 -33
- package/dist/inputs/PinInput.d.ts +117 -0
- package/dist/inputs/PinInput.js +364 -0
- package/dist/inputs/RadioGroup.d.ts +115 -0
- package/dist/inputs/RadioGroup.js +179 -0
- package/dist/inputs/RadioInput.d.ts +87 -24
- package/dist/inputs/RadioInput.js +182 -95
- package/dist/inputs/SearchInput.d.ts +66 -0
- package/dist/inputs/SearchInput.js +156 -0
- package/dist/inputs/SelectInput.d.ts +195 -55
- package/dist/inputs/SelectInput.js +1308 -446
- package/dist/inputs/SliderInput.d.ts +150 -30
- package/dist/inputs/SliderInput.js +441 -186
- package/dist/inputs/SwitchInput.d.ts +109 -0
- package/dist/inputs/SwitchInput.js +248 -0
- package/dist/inputs/TagInput.d.ts +117 -0
- package/dist/inputs/TagInput.js +408 -0
- package/dist/inputs/TextAreaInput.d.ts +146 -44
- package/dist/inputs/TextAreaInput.js +298 -198
- package/dist/inputs/TextInput.d.ts +4 -13
- package/dist/inputs/TextInput.js +13 -48
- package/dist/inputs/ToggleInput.d.ts +120 -22
- package/dist/inputs/ToggleInput.js +262 -116
- package/dist/inputs/internal/bareField.d.ts +18 -0
- package/dist/inputs/internal/bareField.js +38 -0
- package/dist/inputs/internal/devWarn.d.ts +7 -0
- package/dist/inputs/internal/devWarn.js +30 -0
- package/dist/inputs/internal/fieldFrame.d.ts +34 -0
- package/dist/inputs/internal/fieldFrame.js +64 -0
- package/dist/inputs/internal/fieldWiring.d.ts +50 -0
- package/dist/inputs/internal/fieldWiring.js +38 -0
- package/dist/inputs/internal/innerButton.d.ts +2 -0
- package/dist/inputs/internal/innerButton.js +24 -0
- package/dist/inputs/internal/ownField.d.ts +45 -0
- package/dist/inputs/internal/ownField.js +58 -0
- package/dist/inputs/internal/predicates.d.ts +9 -0
- package/dist/inputs/internal/predicates.js +11 -0
- package/dist/inputs/internal/useComboboxPopover.d.ts +46 -0
- package/dist/inputs/internal/useComboboxPopover.js +92 -0
- package/dist/json/JsonViewer.d.ts +62 -0
- package/dist/json/JsonViewer.js +483 -0
- package/dist/layout/Box.d.ts +87 -0
- package/dist/layout/Box.js +109 -0
- package/dist/layout/Divider.d.ts +25 -0
- package/dist/layout/Divider.js +70 -0
- package/dist/layout/Flex.d.ts +139 -0
- package/dist/layout/Flex.js +165 -0
- package/dist/layout/FlexItem.d.ts +72 -0
- package/dist/layout/FlexItem.js +84 -0
- package/dist/layout/Grid.d.ts +140 -0
- package/dist/layout/Grid.js +178 -0
- package/dist/layout/Portal.d.ts +29 -0
- package/dist/layout/Portal.js +27 -0
- package/dist/layout/ResizablePanels.d.ts +88 -0
- package/dist/layout/ResizablePanels.js +198 -0
- package/dist/layout/ResizeHandle.d.ts +48 -0
- package/dist/layout/ResizeHandle.js +143 -0
- package/dist/layout/ScrollArea.d.ts +30 -0
- package/dist/layout/ScrollArea.js +138 -0
- package/dist/links/Link.d.ts +101 -1
- package/dist/links/Link.js +166 -4
- package/dist/lists/BulletedList.d.ts +25 -7
- package/dist/lists/BulletedList.js +72 -27
- package/dist/lists/DescriptionList.d.ts +91 -0
- package/dist/lists/DescriptionList.js +147 -0
- package/dist/menu/ContextMenu.d.ts +64 -0
- package/dist/menu/ContextMenu.js +34 -0
- package/dist/menu/Menu.d.ts +280 -0
- package/dist/menu/Menu.js +1003 -0
- package/dist/modal/ConfirmDialog.d.ts +55 -0
- package/dist/modal/ConfirmDialog.js +151 -0
- package/dist/modal/Modal.d.ts +64 -14
- package/dist/modal/Modal.js +189 -48
- package/dist/navigation/Breadcrumbs.d.ts +65 -0
- package/dist/navigation/Breadcrumbs.js +243 -0
- package/dist/navigation/CommandPalette.d.ts +83 -0
- package/dist/navigation/CommandPalette.js +509 -0
- package/dist/navigation/Pagination.d.ts +87 -0
- package/dist/navigation/Pagination.js +300 -0
- package/dist/navigation/SidebarNav.d.ts +107 -0
- package/dist/navigation/SidebarNav.js +341 -0
- package/dist/navigation/Stepper.d.ts +52 -0
- package/dist/navigation/Stepper.js +207 -0
- package/dist/navigation/Tabs.d.ts +113 -0
- package/dist/navigation/Tabs.js +543 -0
- package/dist/navigation/Topbar.d.ts +20 -0
- package/dist/navigation/Topbar.js +62 -0
- package/dist/overlay/OverlayProvider.d.ts +28 -32
- package/dist/overlay/OverlayProvider.js +42 -93
- package/dist/overlay/useOverlay.d.ts +88 -12
- package/dist/overlay/useOverlay.js +220 -43
- package/dist/overlays/Popover.d.ts +114 -0
- package/dist/overlays/Popover.js +389 -0
- package/dist/shapes/Circle.d.ts +84 -8
- package/dist/shapes/Circle.js +122 -20
- package/dist/shapes/Square.d.ts +84 -8
- package/dist/shapes/Square.js +123 -20
- package/dist/styles/mixins.d.ts +35 -0
- package/dist/styles/mixins.js +60 -0
- package/dist/styles.css +1 -202
- package/dist/table/InfiniteSpreadsheet.d.ts +140 -10
- package/dist/table/InfiniteSpreadsheet.js +762 -225
- package/dist/table/InfiniteTable.d.ts +116 -14
- package/dist/table/InfiniteTable.js +287 -429
- package/dist/table/SpreadsheetCellEditor.d.ts +54 -6
- package/dist/table/SpreadsheetCellEditor.js +163 -84
- package/dist/table/TableCore.d.ts +252 -0
- package/dist/table/TableCore.js +1082 -0
- package/dist/table/VirtualizedInfiniteTable.d.ts +104 -14
- package/dist/table/VirtualizedInfiniteTable.js +280 -219
- package/dist/table/types.d.ts +66 -244
- package/dist/table/types.js +0 -51
- package/dist/table/useInfiniteScrollSentinel.d.ts +25 -21
- package/dist/table/useInfiniteScrollSentinel.js +38 -30
- package/dist/table/useSpreadsheetCellNavigation.d.ts +44 -0
- package/dist/table/useSpreadsheetCellNavigation.js +141 -0
- package/dist/table/useTableColumnLayout.d.ts +90 -25
- package/dist/table/useTableColumnLayout.js +255 -50
- package/dist/table/useTableKeyboardNavigation.d.ts +32 -21
- package/dist/table/useTableKeyboardNavigation.js +95 -71
- package/dist/table/useTableRowSelection.d.ts +24 -25
- package/dist/table/useTableRowSelection.js +57 -84
- package/dist/table/useTableVirtualizer.d.ts +20 -0
- package/dist/table/useTableVirtualizer.js +48 -0
- package/dist/text/Bold.d.ts +5 -6
- package/dist/text/Bold.js +16 -15
- package/dist/text/Code.d.ts +5 -6
- package/dist/text/Code.js +16 -25
- package/dist/text/CodeBlock.d.ts +77 -0
- package/dist/text/CodeBlock.js +373 -0
- package/dist/text/EditableText.d.ts +55 -15
- package/dist/text/EditableText.js +153 -135
- package/dist/text/Ellipsis.d.ts +34 -8
- package/dist/text/Ellipsis.js +55 -23
- package/dist/text/Kbd.d.ts +72 -0
- package/dist/text/Kbd.js +284 -0
- package/dist/text/MarkdownText.d.ts +27 -10
- package/dist/text/MarkdownText.js +317 -300
- package/dist/text/RequiredMarker.d.ts +17 -5
- package/dist/text/RequiredMarker.js +34 -36
- package/dist/text/Selectable.d.ts +5 -6
- package/dist/text/Selectable.js +16 -13
- package/dist/text/Span.d.ts +82 -0
- package/dist/text/Span.js +115 -0
- package/dist/text/Text.d.ts +128 -41
- package/dist/text/Text.js +209 -76
- package/dist/theme/GalaxyProvider.d.ts +75 -0
- package/dist/theme/GalaxyProvider.js +223 -0
- package/dist/theme/ThemeSwitcher.d.ts +52 -0
- package/dist/theme/ThemeSwitcher.js +94 -0
- package/dist/theme/enums.d.ts +118 -0
- package/dist/theme/enums.js +144 -0
- package/dist/theme/tokens/dark.d.ts +2 -0
- package/dist/theme/tokens/dark.js +275 -0
- package/dist/theme/tokens/generate.d.ts +15 -0
- package/dist/theme/tokens/generate.js +47 -0
- package/dist/theme/tokens/light.d.ts +2 -0
- package/dist/theme/tokens/light.js +274 -0
- package/dist/theme/tokens/palette.d.ts +14 -0
- package/dist/theme/tokens/palette.js +153 -0
- package/dist/theme/tokens/scales.d.ts +26 -0
- package/dist/theme/tokens/scales.js +154 -0
- package/dist/theme/tokens/t.d.ts +3 -0
- package/dist/theme/tokens/t.js +25 -0
- package/dist/theme/tokens/types.d.ts +189 -0
- package/dist/theme/tokens/types.js +0 -0
- package/dist/theme/useGalaxyTheme.d.ts +46 -0
- package/dist/theme/useGalaxyTheme.js +36 -0
- package/dist/theme/useInverseScope.d.ts +18 -0
- package/dist/theme/useInverseScope.js +33 -0
- package/dist/three/GalaxyLogomark3D.d.ts +46 -0
- package/dist/three/GalaxyLogomark3D.js +134 -0
- package/dist/three/assets/galaxy-logomark.js +4 -0
- package/dist/three/galaxyLogomark3DScene.d.ts +27 -0
- package/dist/three/galaxyLogomark3DScene.js +165 -0
- package/dist/timeline/Timeline.d.ts +120 -0
- package/dist/timeline/Timeline.js +301 -0
- package/dist/toast/Toast.d.ts +43 -19
- package/dist/toast/Toast.js +130 -89
- package/dist/toast/ToastProvider.d.ts +23 -23
- package/dist/toast/ToastProvider.js +298 -101
- package/dist/toast/ToastViewport.d.ts +12 -0
- package/dist/toast/ToastViewport.js +210 -0
- package/dist/toast/useToast.d.ts +139 -5
- package/dist/toast/useToast.js +15 -13
- package/dist/tokens.css +654 -0
- package/dist/tooltip/Tooltip.d.ts +64 -44
- package/dist/tooltip/Tooltip.js +280 -73
- package/dist/tooltip/internal/LazyTooltip.d.ts +7 -0
- package/dist/tooltip/internal/LazyTooltip.js +53 -0
- package/dist/transform/Fade.d.ts +33 -11
- package/dist/transform/Fade.js +71 -19
- package/dist/transform/Flasher.d.ts +25 -0
- package/dist/transform/Flasher.js +39 -0
- package/dist/transform/Rotate.d.ts +24 -12
- package/dist/transform/Rotate.js +36 -22
- package/dist/transform/ScaleFade.d.ts +36 -11
- package/dist/transform/ScaleFade.js +86 -28
- package/dist/transform/internal/CollapseMotion.d.ts +10 -0
- package/dist/transform/internal/CollapseMotion.js +65 -0
- package/dist/tree/Tree.d.ts +85 -0
- package/dist/tree/Tree.js +387 -0
- package/dist/tree/treeRow.d.ts +39 -0
- package/dist/tree/treeRow.js +75 -0
- package/dist/utils/colors.d.ts +46 -13
- package/dist/utils/colors.js +92 -34
- package/dist/utils/css.d.ts +23 -0
- package/dist/utils/css.js +30 -0
- package/dist/utils/format.d.ts +58 -0
- package/dist/utils/format.js +220 -0
- package/dist/vite/index.d.ts +16 -0
- package/dist/vite/index.js +52 -0
- package/dist/widget/Widget.d.ts +164 -48
- package/dist/widget/Widget.js +335 -96
- package/dist/widget/WidgetGroup.d.ts +36 -0
- package/dist/widget/WidgetGroup.js +103 -0
- package/package.json +855 -157
- package/dist/accordion/Accordion.d.ts +0 -54
- package/dist/accordion/Accordion.js +0 -183
- package/dist/assets/components/GalaxyFilamentWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkDark.js +0 -14
- package/dist/assets/components/GalaxyFilamentWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyFilamentWordmarkLight.js +0 -14
- package/dist/assets/components/GalaxyLogomarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkDark.js +0 -11
- package/dist/assets/components/GalaxyLogomarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyLogomarkLight.js +0 -17
- package/dist/assets/components/GalaxyWordmarkDark.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkDark.js +0 -15
- package/dist/assets/components/GalaxyWordmarkLight.d.ts +0 -3
- package/dist/assets/components/GalaxyWordmarkLight.js +0 -28
- package/dist/assets/models/galaxy-animation.js +0 -136666
- package/dist/assets/models/galaxy-logomark.js +0 -4
- package/dist/avatar/AvatarShimmer.d.ts +0 -30
- package/dist/avatar/AvatarShimmer.js +0 -22
- package/dist/backgrounds/CellGridBackground.d.ts +0 -24
- package/dist/backgrounds/CellGridBackground.js +0 -44
- package/dist/backgrounds/CrossGridBackground.d.ts +0 -26
- package/dist/backgrounds/CrossGridBackground.js +0 -49
- package/dist/backgrounds/DotGridBackground.d.ts +0 -24
- package/dist/backgrounds/DotGridBackground.js +0 -47
- package/dist/badge/Badge.d.ts +0 -42
- package/dist/badge/Badge.js +0 -99
- package/dist/charts/ChartEmptyState.d.ts +0 -17
- package/dist/charts/ChartEmptyState.js +0 -29
- package/dist/charts/ProgressBar.d.ts +0 -29
- package/dist/charts/ProgressBar.js +0 -65
- package/dist/charts/chartTheme.d.ts +0 -18
- package/dist/charts/chartTheme.js +0 -26
- package/dist/containers/FlexItem.d.ts +0 -50
- package/dist/containers/FlexItem.js +0 -91
- package/dist/containers/FlexWrapper.d.ts +0 -96
- package/dist/containers/FlexWrapper.js +0 -143
- package/dist/containers/GridWrapper.d.ts +0 -79
- package/dist/containers/GridWrapper.js +0 -125
- package/dist/containers/Spacing.d.ts +0 -23
- package/dist/containers/Spacing.js +0 -59
- package/dist/containers/Wrapper.d.ts +0 -26
- package/dist/containers/Wrapper.js +0 -54
- package/dist/dividers/HorizontalDivider.d.ts +0 -7
- package/dist/dividers/HorizontalDivider.js +0 -39
- package/dist/dividers/VerticalDivider.d.ts +0 -6
- package/dist/dividers/VerticalDivider.js +0 -21
- package/dist/icons/GalaxyFilamentWordmark.d.ts +0 -11
- package/dist/icons/GalaxyFilamentWordmark.js +0 -25
- package/dist/icons/GalaxyLogomark.d.ts +0 -13
- package/dist/icons/GalaxyLogomark.js +0 -27
- package/dist/icons/GalaxyLogomark3D.d.ts +0 -56
- package/dist/icons/GalaxyLogomark3D.js +0 -319
- package/dist/icons/GalaxyLogomarkAnimation.d.ts +0 -18
- package/dist/icons/GalaxyLogomarkAnimation.js +0 -48
- package/dist/icons/GalaxyWordmark.d.ts +0 -11
- package/dist/icons/GalaxyWordmark.js +0 -25
- package/dist/inputs/MultiTextInput.d.ts +0 -32
- package/dist/inputs/MultiTextInput.js +0 -180
- package/dist/inputs/SwitcherInput.d.ts +0 -30
- package/dist/inputs/SwitcherInput.js +0 -81
- package/dist/inputs/hooks.d.ts +0 -10
- package/dist/inputs/hooks.js +0 -22
- package/dist/overlay/constants.d.ts +0 -28
- package/dist/overlay/constants.js +0 -37
- package/dist/resizable/HorizontalResizeHandle.d.ts +0 -17
- package/dist/resizable/HorizontalResizeHandle.js +0 -38
- package/dist/resizable/VerticalResizeHandle.d.ts +0 -18
- package/dist/resizable/VerticalResizeHandle.js +0 -39
- package/dist/table/SpreadsheetCell.d.ts +0 -21
- package/dist/table/SpreadsheetCell.js +0 -71
- package/dist/table/SpreadsheetHeaderCell.d.ts +0 -23
- package/dist/table/SpreadsheetHeaderCell.js +0 -91
- package/dist/table/SpreadsheetMenuItem.d.ts +0 -14
- package/dist/table/SpreadsheetMenuItem.js +0 -33
- package/dist/table/SpreadsheetPrimitives.d.ts +0 -172
- package/dist/table/SpreadsheetPrimitives.js +0 -105
- package/dist/table/SpreadsheetRow.d.ts +0 -33
- package/dist/table/SpreadsheetRow.js +0 -73
- package/dist/table/SpreadsheetRowActionCell.d.ts +0 -14
- package/dist/table/SpreadsheetRowActionCell.js +0 -51
- package/dist/table/TableExpandCell.d.ts +0 -11
- package/dist/table/TableExpandCell.js +0 -24
- package/dist/table/TableExpandedRow.d.ts +0 -16
- package/dist/table/TableExpandedRow.js +0 -77
- package/dist/table/TableHeaderCellContent.d.ts +0 -30
- package/dist/table/TableHeaderCellContent.js +0 -48
- package/dist/table/TablePrimitives.d.ts +0 -313
- package/dist/table/TablePrimitives.js +0 -302
- package/dist/table/TableSelectCell.d.ts +0 -18
- package/dist/table/TableSelectCell.js +0 -27
- package/dist/table/TableStatusRow.d.ts +0 -18
- package/dist/table/TableStatusRow.js +0 -50
- package/dist/table/useSpreadsheetEditing.d.ts +0 -13
- package/dist/table/useSpreadsheetEditing.js +0 -41
- package/dist/table/useTableColumnResize.d.ts +0 -38
- package/dist/table/useTableColumnResize.js +0 -155
- package/dist/table/useTableRowExpansion.d.ts +0 -24
- package/dist/table/useTableRowExpansion.js +0 -62
- package/dist/table/utils.d.ts +0 -50
- package/dist/table/utils.js +0 -78
- package/dist/text/HotKeys.d.ts +0 -30
- package/dist/text/HotKeys.js +0 -74
- package/dist/text/Paragraph.d.ts +0 -33
- package/dist/text/Paragraph.js +0 -83
- package/dist/text/TextShimmer.d.ts +0 -14
- package/dist/text/TextShimmer.js +0 -34
- package/dist/theme/GalaxyTheme.d.ts +0 -67
- package/dist/theme/GalaxyTheme.js +0 -119
- package/dist/theme/constants.d.ts +0 -8
- package/dist/theme/constants.js +0 -38
- package/dist/theme/index.d.ts +0 -6
- package/dist/theme/index.js +0 -7
- package/dist/theme/types.d.ts +0 -195
- package/dist/theme/types.js +0 -10
- package/dist/theme/typography.d.ts +0 -2
- package/dist/theme/typography.js +0 -73
- package/dist/theme/variants/dark.d.ts +0 -2
- package/dist/theme/variants/dark.js +0 -125
- package/dist/theme/variants/light.d.ts +0 -2
- package/dist/theme/variants/light.js +0 -125
- package/dist/toast/ToastContainer.d.ts +0 -10
- package/dist/toast/ToastContainer.js +0 -31
- package/dist/toast/ToastWrapper.d.ts +0 -6
- package/dist/toast/ToastWrapper.js +0 -27
- package/dist/transform/Flash.d.ts +0 -7
- package/dist/transform/Flash.js +0 -18
- package/dist/transform/Spin.d.ts +0 -14
- package/dist/transform/Spin.js +0 -25
- package/dist/utils/linaria.d.ts +0 -1
- package/dist/utils/linaria.js +0 -8
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { useControlledState } from "../hooks/useControlledState.js";
|
|
2
|
+
import Chip, { ChipSize } from "./Chip.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
import { styled } from "@linaria/react";
|
|
5
|
+
import { Children, forwardRef, useId } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { cx } from "@linaria/core";
|
|
8
|
+
//#region src/chips/ChipGroup.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Lays out a set of related chips (tags on a source, roles on a member, filters on a view) as one
|
|
11
|
+
* wrapping row with a fixed gap, and names them as a group. With `max`, only the first `max`
|
|
12
|
+
* chips show and a `+N` chip stands for the rest; pressing it shows every chip in place and turns
|
|
13
|
+
* it into "Show less" (the Article V disclosure trio `isOpen` / `defaultIsOpen` / `onOpenChange`).
|
|
14
|
+
*
|
|
15
|
+
* The children render as they are, with no wrapper, so each chip's root is a direct child of the
|
|
16
|
+
* group. The group holds no value or selection, pushes no props into its children, and does not
|
|
17
|
+
* measure: the cut-off is a count. Not a single choice (`ToggleInput`), not a tag input
|
|
18
|
+
* (`TagInput`).
|
|
19
|
+
*/
|
|
20
|
+
/** Canonical rungs; the member names the rung of the chips in the group. */
|
|
21
|
+
var ChipGroupSize = /* @__PURE__ */ function(ChipGroupSize) {
|
|
22
|
+
/** `ChipSize.X_SMALL` toggle (16px), 4px gap. */
|
|
23
|
+
ChipGroupSize["X_SMALL"] = "X_SMALL";
|
|
24
|
+
/** `ChipSize.SMALL` toggle (20px), 4px gap. */
|
|
25
|
+
ChipGroupSize["SMALL"] = "SMALL";
|
|
26
|
+
/** `ChipSize.MEDIUM` toggle (24px), 4px gap. The default. */
|
|
27
|
+
ChipGroupSize["MEDIUM"] = "MEDIUM";
|
|
28
|
+
/** `ChipSize.LARGE` toggle (28px), 8px gap. */
|
|
29
|
+
ChipGroupSize["LARGE"] = "LARGE";
|
|
30
|
+
/** `ChipSize.X_LARGE` toggle (32px), 8px gap. */
|
|
31
|
+
ChipGroupSize["X_LARGE"] = "X_LARGE";
|
|
32
|
+
return ChipGroupSize;
|
|
33
|
+
}({});
|
|
34
|
+
/** One wrapping row; the chips (and the toggle) are its direct children. */
|
|
35
|
+
var Root = /*#__PURE__*/ styled("div")({
|
|
36
|
+
name: "Root",
|
|
37
|
+
class: "gx-ChipGroup-r1r6i8cm",
|
|
38
|
+
propsAsIs: false
|
|
39
|
+
});
|
|
40
|
+
/** Row and column gap per rung: 4px (1.x `gap={4}` between chips), 8px for the two tallest. */
|
|
41
|
+
var CHIP_GROUP_SIZE_TO_CSS_MAP = {
|
|
42
|
+
["X_SMALL"]: "gx-ChipGroup-X_SMALL-x1p2tp2a",
|
|
43
|
+
["SMALL"]: "gx-ChipGroup-SMALL-s1mja2pr",
|
|
44
|
+
["MEDIUM"]: "gx-ChipGroup-MEDIUM-m1u9ku0",
|
|
45
|
+
["LARGE"]: "gx-ChipGroup-LARGE-l1lpfefp",
|
|
46
|
+
["X_LARGE"]: "gx-ChipGroup-X_LARGE-xffqurq"
|
|
47
|
+
};
|
|
48
|
+
/** Identity: the toggle chip's rung. */
|
|
49
|
+
var CHIP_GROUP_SIZE_TO_CHIP_SIZE_MAP = {
|
|
50
|
+
["X_SMALL"]: ChipSize.X_SMALL,
|
|
51
|
+
["SMALL"]: ChipSize.SMALL,
|
|
52
|
+
["MEDIUM"]: ChipSize.MEDIUM,
|
|
53
|
+
["LARGE"]: ChipSize.LARGE,
|
|
54
|
+
["X_LARGE"]: ChipSize.X_LARGE
|
|
55
|
+
};
|
|
56
|
+
/** Stable key of the toggle chip, so it stays mounted (and focused) when the hidden chips appear. */
|
|
57
|
+
var TOGGLE_KEY = "gx-chip-group-toggle";
|
|
58
|
+
/** A wrapping row of related chips, with an optional `+N` / "Show less" toggle past `max`. */
|
|
59
|
+
var ChipGroup = forwardRef(function ChipGroup({ children, max, size = "MEDIUM", isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, ariaLabel, id, className, style, ...rest }, ref) {
|
|
60
|
+
const generatedId = useId();
|
|
61
|
+
const rootId = id ?? generatedId;
|
|
62
|
+
const [isOpen, setIsOpen] = useControlledState({
|
|
63
|
+
value: isOpenProp,
|
|
64
|
+
defaultValue: defaultIsOpen,
|
|
65
|
+
onChange: onOpenChange
|
|
66
|
+
});
|
|
67
|
+
const items = Children.toArray(children);
|
|
68
|
+
const limit = max === void 0 ? Number.POSITIVE_INFINITY : Math.max(0, Math.floor(max));
|
|
69
|
+
const isOverflowing = items.length > limit;
|
|
70
|
+
const hiddenCount = isOverflowing ? items.length - limit : 0;
|
|
71
|
+
const visibleItems = isOverflowing && !isOpen ? items.slice(0, limit) : items;
|
|
72
|
+
return /* @__PURE__ */ jsxs(Root, {
|
|
73
|
+
...rest,
|
|
74
|
+
ref,
|
|
75
|
+
id: rootId,
|
|
76
|
+
role: "group",
|
|
77
|
+
"aria-label": ariaLabel ?? rest["aria-label"],
|
|
78
|
+
className: cx(CHIP_GROUP_SIZE_TO_CSS_MAP[size], className),
|
|
79
|
+
style,
|
|
80
|
+
children: [visibleItems, isOverflowing && (isOpen ? /* @__PURE__ */ jsx(Chip, {
|
|
81
|
+
size: CHIP_GROUP_SIZE_TO_CHIP_SIZE_MAP[size],
|
|
82
|
+
label: "Show less",
|
|
83
|
+
onClick: () => setIsOpen(false),
|
|
84
|
+
"aria-expanded": true,
|
|
85
|
+
"aria-controls": rootId
|
|
86
|
+
}, TOGGLE_KEY) : /* @__PURE__ */ jsx(Chip, {
|
|
87
|
+
size: CHIP_GROUP_SIZE_TO_CHIP_SIZE_MAP[size],
|
|
88
|
+
label: `+${hiddenCount}`,
|
|
89
|
+
ariaLabel: `+${hiddenCount} more`,
|
|
90
|
+
onClick: () => setIsOpen(true),
|
|
91
|
+
"aria-expanded": false,
|
|
92
|
+
"aria-controls": rootId
|
|
93
|
+
}, TOGGLE_KEY))]
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
ChipGroup.displayName = "ChipGroup";
|
|
97
|
+
//#endregion
|
|
98
|
+
export { ChipGroupSize, ChipGroup as default };
|
package/dist/drawer/Drawer.d.ts
CHANGED
|
@@ -1,20 +1,86 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
/** Controlled visibility. The drawer has no open state of its own. */
|
|
4
|
-
open: boolean;
|
|
5
|
-
/** Called on Escape, and on backdrop click when `closeOnClickOutside` is set. */
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
/** Panel width. A number is px. @default "60%" */
|
|
8
|
-
width?: number | string;
|
|
9
|
-
/** Close when the backdrop is clicked. @default false */
|
|
10
|
-
closeOnClickOutside?: boolean;
|
|
11
|
-
}
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type ReactNode } from "react";
|
|
2
|
+
import { Side } from "../theme/enums.js";
|
|
12
3
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Stacking and Escape handling come from `OverlayProvider`, so only the topmost
|
|
17
|
-
* overlay closes on Escape. Wrap your app in that provider.
|
|
4
|
+
* Panel width (`LEFT` / `RIGHT`) or height (`TOP` / `BOTTOM`). Canonical rung names
|
|
5
|
+
* (Constitution V); the values are lengths, not control heights.
|
|
18
6
|
*/
|
|
19
|
-
declare
|
|
7
|
+
export declare enum DrawerSize {
|
|
8
|
+
/** 400px wide / 240px tall. */
|
|
9
|
+
SMALL = "SMALL",
|
|
10
|
+
/** 560px wide / 360px tall. The default. */
|
|
11
|
+
MEDIUM = "MEDIUM",
|
|
12
|
+
/** 720px wide / 480px tall. */
|
|
13
|
+
LARGE = "LARGE",
|
|
14
|
+
/** 960px wide / 640px tall. */
|
|
15
|
+
X_LARGE = "X_LARGE"
|
|
16
|
+
}
|
|
17
|
+
/** Every Drawer prop except the name pair (`header` / `ariaLabel`). */
|
|
18
|
+
interface DrawerBaseProps extends AriaAttributes {
|
|
19
|
+
/** The body. It scrolls when it is taller than the panel. A string or number renders as `Text`. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The actions row, end-aligned with an 8px gap: what finishes the drawer's task (Cancel, then the `PRIMARY` Save). */
|
|
22
|
+
footer?: ReactNode;
|
|
23
|
+
/** Controls in the title row, before the close button, for the thing the drawer shows: one or two icon-only `TERTIARY` `SMALL` buttons and a ⋯ `Menu` for the rest. Not for Save or Cancel (those are `footer`). */
|
|
24
|
+
actions?: ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* The edge the drawer sits on and slides from.
|
|
27
|
+
* @default Side.RIGHT
|
|
28
|
+
*/
|
|
29
|
+
side?: Side;
|
|
30
|
+
/**
|
|
31
|
+
* Width for `LEFT` / `RIGHT` (400 / 560 / 720 / 960px), height for `TOP` / `BOTTOM` (240 / 360 / 480 / 640px). The starting size when `isResizable`.
|
|
32
|
+
* @default DrawerSize.MEDIUM
|
|
33
|
+
*/
|
|
34
|
+
size?: DrawerSize;
|
|
35
|
+
/**
|
|
36
|
+
* Show a `ResizeHandle` on the inner edge so the user can drag or key the size. The size is kept while the Drawer stays mounted.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
isResizable?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Modal: a portal over a dimmed, locked page, with a focus trap. `false`: an in-flow panel that pushes the content beside it aside, with no backdrop and no trap.
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
44
|
+
isModal?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Escape, a backdrop click and the close button close the drawer (with `isModal={false}`, only the close button). When `false` there is no close button, and only the app can close it.
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
isDismissable?: boolean;
|
|
50
|
+
/** Controlled open state. When set, Drawer calls `onOpenChange` and lets the caller decide. */
|
|
51
|
+
isOpen?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Initial open state while uncontrolled.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
defaultIsOpen?: boolean;
|
|
57
|
+
/** Called with `false` on Escape, a backdrop click and the close button. */
|
|
58
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
59
|
+
/** DOM id on the panel; the resize handle's `aria-controls` points at it. @default a `useId()` value */
|
|
60
|
+
id?: string;
|
|
61
|
+
/** Any `data-*` attribute, forwarded to the panel. */
|
|
62
|
+
[dataAttribute: `data-${string}`]: string | number | boolean | undefined;
|
|
63
|
+
/** Extra class on the panel. */
|
|
64
|
+
className?: string;
|
|
65
|
+
/** Inline style on the panel; only for setting CSS custom properties. */
|
|
66
|
+
style?: CSSProperties;
|
|
67
|
+
}
|
|
68
|
+
/** A title row names the drawer. */
|
|
69
|
+
interface DrawerTitledProps {
|
|
70
|
+
/** The title row. A string renders as an `h2` `Text` and names the drawer; a node renders as it is. Required unless `ariaLabel` is set. */
|
|
71
|
+
header: ReactNode;
|
|
72
|
+
/** Accessible name. Required by type when there is no `header`. */
|
|
73
|
+
ariaLabel?: string;
|
|
74
|
+
}
|
|
75
|
+
/** No title row: the accessible name is required. */
|
|
76
|
+
interface DrawerUntitledProps {
|
|
77
|
+
/** The title row. A string renders as an `h2` `Text` and names the drawer; a node renders as it is. Required unless `ariaLabel` is set. */
|
|
78
|
+
header?: undefined;
|
|
79
|
+
/** Accessible name. Required by type when there is no `header`. */
|
|
80
|
+
ariaLabel: string;
|
|
81
|
+
}
|
|
82
|
+
/** Drawer props. Without a `header`, `ariaLabel` is required by the type. */
|
|
83
|
+
export type DrawerProps = DrawerBaseProps & (DrawerTitledProps | DrawerUntitledProps);
|
|
84
|
+
/** A panel that slides in from an edge: title row, scrolling body, actions row. */
|
|
85
|
+
declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
86
|
export default Drawer;
|
package/dist/drawer/Drawer.js
CHANGED
|
@@ -1,77 +1,411 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import FocusScope, { FocusScopeAutoFocus } from "../a11y/FocusScope.js";
|
|
2
|
+
import { Orientation, Side } from "../theme/enums.js";
|
|
3
|
+
import Text, { TextSize, TextWeight } from "../text/Text.js";
|
|
4
|
+
import { DURATION, SPACE } from "../theme/tokens/scales.js";
|
|
5
|
+
import { useControlledOpenState } from "../hooks/useControlledOpenState.js";
|
|
6
|
+
import Portal from "../layout/Portal.js";
|
|
7
|
+
import { OverlayLayer, useOverlay } from "../overlay/useOverlay.js";
|
|
8
|
+
import { usePrefersReducedMotion } from "../hooks/usePrefersReducedMotion.js";
|
|
9
|
+
import { OverlayNode } from "../overlay/OverlayProvider.js";
|
|
10
|
+
import Button, { ButtonSize, ButtonVariant } from "../buttons/Button.js";
|
|
11
|
+
import { isDevelopment, useDevWarning } from "../inputs/internal/devWarn.js";
|
|
12
|
+
import ResizeHandle from "../layout/ResizeHandle.js";
|
|
13
|
+
import Fade from "../transform/Fade.js";
|
|
6
14
|
/* empty css */
|
|
7
15
|
import { styled } from "@linaria/react";
|
|
8
|
-
import {
|
|
9
|
-
import { jsx } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
16
|
+
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
17
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { cx } from "@linaria/core";
|
|
19
|
+
import { XIcon } from "@phosphor-icons/react";
|
|
20
|
+
import { AnimatePresence, motion } from "framer-motion";
|
|
11
21
|
//#region src/drawer/Drawer.tsx
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
/**
|
|
23
|
+
* The panel that slides in from an edge of the screen and keeps the page visible beside it (run
|
|
24
|
+
* details next to a list of runs, a source's settings, a log tail). It draws the panel and its
|
|
25
|
+
* three regions (a title row, a scrolling body and an actions row), sits on any `side`, takes a
|
|
26
|
+
* `size`, and with `isResizable` the user drags or keys its inner edge to resize it.
|
|
27
|
+
*
|
|
28
|
+
* Actions split by what they do. `actions` in the title row, before the close button, act on the
|
|
29
|
+
* thing the drawer shows: one or two icon-only `TERTIARY` `SMALL` buttons (open in full page, copy
|
|
30
|
+
* link) and a ⋯ `Menu` for the rest (rename, duplicate, delete). `footer` finishes the drawer's
|
|
31
|
+
* task (Cancel, then the `PRIMARY` Save); a read-only detail drawer usually has no footer.
|
|
32
|
+
*
|
|
33
|
+
* By default it is modal, like `Modal`: a portal over a dimmed, locked page with a focus trap,
|
|
34
|
+
* stacked through the overlay stack, closing on Escape or a backdrop click. With
|
|
35
|
+
* `isModal={false}` it is a docked panel: it renders in place in the layout and pushes the content
|
|
36
|
+
* beside it aside, with no backdrop, no trap and no Escape.
|
|
37
|
+
*
|
|
38
|
+
* SSR: a modal drawer renders nothing on the server; a push drawer renders nothing while closed
|
|
39
|
+
* and its panel at rest while open. The scroll lock is CSS keyed on the backdrop; `window` is
|
|
40
|
+
* read only in an effect while open.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* Panel width (`LEFT` / `RIGHT`) or height (`TOP` / `BOTTOM`). Canonical rung names
|
|
44
|
+
* (Constitution V); the values are lengths, not control heights.
|
|
45
|
+
*/
|
|
46
|
+
var DrawerSize = /* @__PURE__ */ function(DrawerSize) {
|
|
47
|
+
/** 400px wide / 240px tall. */
|
|
48
|
+
DrawerSize["SMALL"] = "SMALL";
|
|
49
|
+
/** 560px wide / 360px tall. The default. */
|
|
50
|
+
DrawerSize["MEDIUM"] = "MEDIUM";
|
|
51
|
+
/** 720px wide / 480px tall. */
|
|
52
|
+
DrawerSize["LARGE"] = "LARGE";
|
|
53
|
+
/** 960px wide / 640px tall. */
|
|
54
|
+
DrawerSize["X_LARGE"] = "X_LARGE";
|
|
55
|
+
return DrawerSize;
|
|
56
|
+
}({});
|
|
57
|
+
/** The close button's accessible name (fixed English, as Modal's). */
|
|
58
|
+
var CLOSE_LABEL = "Close";
|
|
59
|
+
/** The resize handle's accessible name. */
|
|
60
|
+
var RESIZE_LABEL = "Resize drawer";
|
|
61
|
+
/** Width per size for `LEFT` / `RIGHT` (a logic map: the resize handle needs the number). */
|
|
62
|
+
var DRAWER_SIZE_TO_WIDTH_PX_MAP = {
|
|
63
|
+
["SMALL"]: 400,
|
|
64
|
+
["MEDIUM"]: 560,
|
|
65
|
+
["LARGE"]: 720,
|
|
66
|
+
["X_LARGE"]: 960
|
|
67
|
+
};
|
|
68
|
+
/** Height per size for `TOP` / `BOTTOM`. */
|
|
69
|
+
var DRAWER_SIZE_TO_HEIGHT_PX_MAP = {
|
|
70
|
+
["SMALL"]: 240,
|
|
71
|
+
["MEDIUM"]: 360,
|
|
72
|
+
["LARGE"]: 480,
|
|
73
|
+
["X_LARGE"]: 640
|
|
74
|
+
};
|
|
75
|
+
/** Whether the side's length is a width (`LEFT` / `RIGHT`) rather than a height. */
|
|
76
|
+
var DRAWER_SIDE_TO_IS_HORIZONTAL_MAP = {
|
|
77
|
+
[Side.LEFT]: true,
|
|
78
|
+
[Side.RIGHT]: true,
|
|
79
|
+
[Side.TOP]: false,
|
|
80
|
+
[Side.BOTTOM]: false
|
|
81
|
+
};
|
|
82
|
+
/** The handle's axis: a vertical bar for side drawers, a horizontal one for top / bottom. */
|
|
83
|
+
var DRAWER_SIDE_TO_HANDLE_ORIENTATION_MAP = {
|
|
84
|
+
[Side.LEFT]: Orientation.VERTICAL,
|
|
85
|
+
[Side.RIGHT]: Orientation.VERTICAL,
|
|
86
|
+
[Side.TOP]: Orientation.HORIZONTAL,
|
|
87
|
+
[Side.BOTTOM]: Orientation.HORIZONTAL
|
|
88
|
+
};
|
|
89
|
+
/** On the right and bottom the panel is after its handle, so moving toward the start grows it. */
|
|
90
|
+
var DRAWER_SIDE_TO_IS_HANDLE_REVERSED_MAP = {
|
|
91
|
+
[Side.LEFT]: false,
|
|
92
|
+
[Side.RIGHT]: true,
|
|
93
|
+
[Side.TOP]: false,
|
|
94
|
+
[Side.BOTTOM]: true
|
|
95
|
+
};
|
|
96
|
+
/** Smallest size the handle allows. */
|
|
97
|
+
var DRAWER_MIN_SIZE_PX = 240;
|
|
98
|
+
/** The strip of page the drawer always leaves: `space[48]`, matching the CSS cap. */
|
|
99
|
+
var DRAWER_VIEWPORT_GAP_PX = Number.parseFloat(SPACE[48]);
|
|
100
|
+
/** How far the modal panel travels on enter and exit: `space[24]`. */
|
|
101
|
+
var DRAWER_OFFSET_PX = Number.parseFloat(SPACE[24]);
|
|
102
|
+
/** The enter / exit offset toward each side. */
|
|
103
|
+
var DRAWER_SIDE_TO_OFFSET_MAP = {
|
|
104
|
+
[Side.RIGHT]: { x: DRAWER_OFFSET_PX },
|
|
105
|
+
[Side.LEFT]: { x: -DRAWER_OFFSET_PX },
|
|
106
|
+
[Side.TOP]: { y: -DRAWER_OFFSET_PX },
|
|
107
|
+
[Side.BOTTOM]: { y: DRAWER_OFFSET_PX }
|
|
108
|
+
};
|
|
109
|
+
/** Push mode: the root's collapsed length on its axis (enter start, exit end). */
|
|
110
|
+
var DRAWER_SIDE_TO_PUSH_COLLAPSED_MAP = {
|
|
111
|
+
[Side.LEFT]: { width: 0 },
|
|
112
|
+
[Side.RIGHT]: { width: 0 },
|
|
113
|
+
[Side.TOP]: { height: 0 },
|
|
114
|
+
[Side.BOTTOM]: { height: 0 }
|
|
115
|
+
};
|
|
116
|
+
/** Push mode: the root's open length, measured by framer from the panel. */
|
|
117
|
+
var DRAWER_SIDE_TO_PUSH_OPEN_MAP = {
|
|
118
|
+
[Side.LEFT]: { width: "auto" },
|
|
119
|
+
[Side.RIGHT]: { width: "auto" },
|
|
120
|
+
[Side.TOP]: { height: "auto" },
|
|
121
|
+
[Side.BOTTOM]: { height: "auto" }
|
|
122
|
+
};
|
|
123
|
+
var DRAWER_TRANSITION = {
|
|
124
|
+
duration: Number.parseFloat(DURATION.base) / 1e3,
|
|
125
|
+
ease: "easeOut"
|
|
126
|
+
};
|
|
127
|
+
/** Under reduced motion the state snaps. */
|
|
128
|
+
var DRAWER_REDUCED_TRANSITION = { duration: 0 };
|
|
129
|
+
/** Open at rest: framer writes `transform: none` at x = y = 0. */
|
|
130
|
+
var DRAWER_OPEN = {
|
|
131
|
+
opacity: 1,
|
|
132
|
+
x: 0,
|
|
133
|
+
y: 0,
|
|
134
|
+
pointerEvents: "auto"
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Scroll lock: while any drawer backdrop is mounted (open or exiting) the page does not scroll.
|
|
138
|
+
* Keyed on Drawer's own backdrop, so a drawer and a modal open together keep the page locked
|
|
139
|
+
* until both are gone.
|
|
140
|
+
*/
|
|
141
|
+
var Backdrop = /*#__PURE__*/ styled("div")({
|
|
142
|
+
name: "Backdrop",
|
|
143
|
+
class: "gx-Drawer-Backdrop-bmaltnf",
|
|
144
|
+
propsAsIs: false
|
|
22
145
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
146
|
+
/** The backdrop's Fade root: positioned just under the panel. Sets no opacity or visibility. */
|
|
147
|
+
var BACKDROP_FRAME_CSS = "gx-Drawer-BACKDROP_FRAME_CSS-b19reibl";
|
|
148
|
+
/** The modal panel's `motion.div`: fixed at its side, sized by `--gx-drawer-size`. */
|
|
149
|
+
var FRAME_CSS = "gx-Drawer-FRAME_CSS-f410s14";
|
|
150
|
+
/** Modal mode: the 8px inset on the drawer's side, the length on its axis, capped. */
|
|
151
|
+
var DRAWER_SIDE_TO_CSS_MAP = {
|
|
152
|
+
[Side.RIGHT]: "gx-Drawer-Side_RIGHT-s1ucw1ej",
|
|
153
|
+
[Side.LEFT]: "gx-Drawer-Side_LEFT-s1gpgm7s",
|
|
154
|
+
[Side.TOP]: "gx-Drawer-Side_TOP-s78031y",
|
|
155
|
+
[Side.BOTTOM]: "gx-Drawer-Side_BOTTOM-sr5uo3u"
|
|
156
|
+
};
|
|
157
|
+
/** Push mode: the in-flow clipping root whose length animates. */
|
|
158
|
+
var PUSH_ROOT_CSS = "gx-Drawer-PUSH_ROOT_CSS-pxznmax";
|
|
159
|
+
var DRAWER_PUSH_SIDE_TO_CSS_MAP = {
|
|
160
|
+
[Side.LEFT]: "gx-Drawer-Side_LEFT-skwwkog",
|
|
161
|
+
[Side.RIGHT]: "gx-Drawer-Side_RIGHT-s1p1mte",
|
|
162
|
+
[Side.TOP]: "gx-Drawer-Side_TOP-s3til6b",
|
|
163
|
+
[Side.BOTTOM]: "gx-Drawer-Side_BOTTOM-s28htx1"
|
|
164
|
+
};
|
|
165
|
+
var FOCUS_SCOPE_CSS = "gx-Drawer-FOCUS_SCOPE_CSS-f7ohikf";
|
|
166
|
+
/** The panel (Modal's declarations); it fills its frame. */
|
|
167
|
+
var Panel = /*#__PURE__*/ styled("div")({
|
|
168
|
+
name: "Panel",
|
|
169
|
+
class: "gx-Drawer-Panel-p1putub7",
|
|
170
|
+
propsAsIs: false
|
|
171
|
+
});
|
|
172
|
+
/** Push mode: the panel keeps its full length inside the clipping root, capped like the frame. */
|
|
173
|
+
var DRAWER_PUSH_PANEL_SIDE_TO_CSS_MAP = {
|
|
174
|
+
[Side.LEFT]: "gx-Drawer-Side_LEFT-s127o7of",
|
|
175
|
+
[Side.RIGHT]: "gx-Drawer-Side_RIGHT-su7a1is",
|
|
176
|
+
[Side.TOP]: "gx-Drawer-Side_TOP-s1smajqi",
|
|
177
|
+
[Side.BOTTOM]: "gx-Drawer-Side_BOTTOM-s3tnyde"
|
|
178
|
+
};
|
|
179
|
+
var Header = /*#__PURE__*/ styled("div")({
|
|
180
|
+
name: "Header",
|
|
181
|
+
class: "gx-Drawer-Header-h45j7yl",
|
|
26
182
|
propsAsIs: false
|
|
27
183
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
184
|
+
/** While the close button shows: a long title never runs under it. */
|
|
185
|
+
var HAS_CLOSE_CSS = "gx-Drawer-HAS_CLOSE_CSS-hov58xm";
|
|
186
|
+
/** With `actions`, the close button joins them: the same 4px apart, one group at the row's end. */
|
|
187
|
+
var HAS_CLOSE_WITH_ACTIONS_CSS = "gx-Drawer-HAS_CLOSE_WITH_ACTIONS_CSS-hckczr5";
|
|
188
|
+
/** A node `header`: takes the row and may shrink. */
|
|
189
|
+
var HeaderNode = /*#__PURE__*/ styled("div")({
|
|
190
|
+
name: "HeaderNode",
|
|
191
|
+
class: "gx-Drawer-HeaderNode-h1v64nx4",
|
|
192
|
+
propsAsIs: false
|
|
193
|
+
});
|
|
194
|
+
/** A string `header` takes the row too, so `actions` sit at its end. */
|
|
195
|
+
var HEADER_TITLE_CSS = "gx-Drawer-HEADER_TITLE_CSS-ht6k1c3";
|
|
196
|
+
/** `actions`: at the end of the title row, 4px apart and 4px before the close button. */
|
|
197
|
+
var HeaderActions = /*#__PURE__*/ styled("div")({
|
|
198
|
+
name: "HeaderActions",
|
|
199
|
+
class: "gx-Drawer-HeaderActions-h15lcrsa",
|
|
200
|
+
propsAsIs: false
|
|
201
|
+
});
|
|
202
|
+
/** More header controls than this crowd the title: the rest belong in the ⋯ menu. */
|
|
203
|
+
var DRAWER_MAX_HEADER_ACTIONS = 3;
|
|
204
|
+
var Body = /*#__PURE__*/ styled("div")({
|
|
205
|
+
name: "Body",
|
|
206
|
+
class: "gx-Drawer-Body-b1ob4oh8",
|
|
207
|
+
propsAsIs: false
|
|
208
|
+
});
|
|
209
|
+
var Footer = /*#__PURE__*/ styled("div")({
|
|
210
|
+
name: "Footer",
|
|
211
|
+
class: "gx-Drawer-Footer-f14nwavk",
|
|
212
|
+
propsAsIs: false
|
|
213
|
+
});
|
|
214
|
+
var CloseSlot = /*#__PURE__*/ styled("span")({
|
|
215
|
+
name: "CloseSlot",
|
|
216
|
+
class: "gx-Drawer-CloseSlot-c1ifjfam",
|
|
31
217
|
propsAsIs: false
|
|
32
218
|
});
|
|
33
|
-
var _exp3 = () => ({ $width }) => getCssSizeValue($width, "60%");
|
|
34
|
-
var _exp4 = () => ({ theme }) => theme.color.background.base;
|
|
35
|
-
var _exp5 = () => ({ theme }) => theme.color.border.primary;
|
|
36
|
-
var DrawerWrapperContentBody = withTheme(/*#__PURE__*/ styled("div")({
|
|
37
|
-
name: "DrawerWrapperContentBody",
|
|
38
|
-
class: "d410s14",
|
|
39
|
-
propsAsIs: false,
|
|
40
|
-
vars: {
|
|
41
|
-
"d410s14-0": [_exp3()],
|
|
42
|
-
"d410s14-1": [_exp4()],
|
|
43
|
-
"d410s14-2": [_exp5()]
|
|
44
|
-
}
|
|
45
|
-
}));
|
|
46
219
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* Stacking and Escape handling come from `OverlayProvider`, so only the topmost
|
|
51
|
-
* overlay closes on Escape. Wrap your app in that provider.
|
|
220
|
+
* Places the resize handle over the panel's inner edge, inside the panel's box. The doubled class
|
|
221
|
+
* outranks ResizeHandle's own `position: relative` whatever order the two modules' rules land in
|
|
222
|
+
* the stylesheet.
|
|
52
223
|
*/
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const dismissRef = useDismiss({
|
|
59
|
-
onDismiss: onClose,
|
|
60
|
-
enabled: open && isTopmost,
|
|
61
|
-
enableClickOutside: closeOnClickOutside && isTopmost
|
|
62
|
-
});
|
|
63
|
-
return createPortal(open && /* @__PURE__ */ jsx(StyledDrawerWrapper, {
|
|
64
|
-
isOpen: open,
|
|
65
|
-
role: "dialog",
|
|
66
|
-
"aria-modal": "true",
|
|
67
|
-
style: { zIndex },
|
|
68
|
-
children: /* @__PURE__ */ jsx(DrawerWrapperContent, { children: /* @__PURE__ */ jsx(DrawerContentWrapper, { children: /* @__PURE__ */ jsx(DrawerWrapperContentBody, {
|
|
69
|
-
ref: dismissRef,
|
|
70
|
-
$width: width,
|
|
71
|
-
onClick: handleContentClick,
|
|
72
|
-
children
|
|
73
|
-
}) }) })
|
|
74
|
-
}), document.body);
|
|
224
|
+
var DRAWER_SIDE_TO_HANDLE_CSS_MAP = {
|
|
225
|
+
[Side.RIGHT]: "gx-Drawer-Side_RIGHT-sv6fh8e",
|
|
226
|
+
[Side.LEFT]: "gx-Drawer-Side_LEFT-s1c8bwjq",
|
|
227
|
+
[Side.TOP]: "gx-Drawer-Side_TOP-s1vq4aq7",
|
|
228
|
+
[Side.BOTTOM]: "gx-Drawer-Side_BOTTOM-svqv727"
|
|
75
229
|
};
|
|
230
|
+
/** The viewport length on the side's axis, less the 48px strip. */
|
|
231
|
+
function readMaxSize(side) {
|
|
232
|
+
return (DRAWER_SIDE_TO_IS_HORIZONTAL_MAP[side] ? window.innerWidth : window.innerHeight) - DRAWER_VIEWPORT_GAP_PX;
|
|
233
|
+
}
|
|
234
|
+
/** A panel that slides in from an edge: title row, scrolling body, actions row. */
|
|
235
|
+
var Drawer = forwardRef(function Drawer({ children, header, footer, actions, side = Side.RIGHT, size = "MEDIUM", isResizable = false, isModal = true, isDismissable = true, isOpen: isOpenProp, defaultIsOpen = false, onOpenChange, ariaLabel, id, className, style, ...rest }, ref) {
|
|
236
|
+
const generatedId = useId();
|
|
237
|
+
const titleId = useId();
|
|
238
|
+
const panelId = id ?? generatedId;
|
|
239
|
+
const transition = usePrefersReducedMotion() ? DRAWER_REDUCED_TRANSITION : DRAWER_TRANSITION;
|
|
240
|
+
const { isOpen, setOpen } = useControlledOpenState({
|
|
241
|
+
isOpen: isOpenProp,
|
|
242
|
+
defaultIsOpen,
|
|
243
|
+
onOpenChange
|
|
244
|
+
});
|
|
245
|
+
const close = () => setOpen(false);
|
|
246
|
+
const { zIndex, isTopmost, overlayId } = useOverlay({
|
|
247
|
+
isOpen: isOpen && isModal,
|
|
248
|
+
layer: OverlayLayer.DRAWER,
|
|
249
|
+
onEscape: isDismissable ? close : void 0
|
|
250
|
+
});
|
|
251
|
+
const [resizedSize, setResizedSize] = useState(null);
|
|
252
|
+
const sizeKey = `${size}:${side}`;
|
|
253
|
+
const [appliedSizeKey, setAppliedSizeKey] = useState(sizeKey);
|
|
254
|
+
if (appliedSizeKey !== sizeKey) {
|
|
255
|
+
setAppliedSizeKey(sizeKey);
|
|
256
|
+
setResizedSize(null);
|
|
257
|
+
}
|
|
258
|
+
const isHorizontal = DRAWER_SIDE_TO_IS_HORIZONTAL_MAP[side];
|
|
259
|
+
const currentSize = resizedSize ?? (isHorizontal ? DRAWER_SIZE_TO_WIDTH_PX_MAP[size] : DRAWER_SIZE_TO_HEIGHT_PX_MAP[size]);
|
|
260
|
+
const [maxSize, setMaxSize] = useState(Number.POSITIVE_INFINITY);
|
|
261
|
+
useEffect(() => {
|
|
262
|
+
if (!isOpen) return;
|
|
263
|
+
const update = () => setMaxSize(readMaxSize(side));
|
|
264
|
+
update();
|
|
265
|
+
window.addEventListener("resize", update);
|
|
266
|
+
return () => window.removeEventListener("resize", update);
|
|
267
|
+
}, [isOpen, side]);
|
|
268
|
+
const [hasOpened, setHasOpened] = useState(isOpen);
|
|
269
|
+
if (isOpen && !hasOpened) setHasOpened(true);
|
|
270
|
+
const [isOpenOnFirstRender] = useState(isOpen);
|
|
271
|
+
const shouldAnimateOnMount = !isOpenOnFirstRender;
|
|
272
|
+
/** Whether the current press started on the backdrop while this drawer was topmost. */
|
|
273
|
+
const isBackdropPressRef = useRef(false);
|
|
274
|
+
const handleBackdropPointerDown = (event) => {
|
|
275
|
+
isBackdropPressRef.current = event.target === event.currentTarget && isTopmost;
|
|
276
|
+
};
|
|
277
|
+
const handleBackdropClick = (_event) => {
|
|
278
|
+
const isBackdropPress = isBackdropPressRef.current;
|
|
279
|
+
isBackdropPressRef.current = false;
|
|
280
|
+
if (isBackdropPress && isDismissable) close();
|
|
281
|
+
};
|
|
282
|
+
const hasHeaderRow = header !== void 0 || isDismissable || actions !== void 0;
|
|
283
|
+
const actionsRef = useRef(null);
|
|
284
|
+
const [actionCount, setActionCount] = useState(0);
|
|
285
|
+
useEffect(() => {
|
|
286
|
+
if (!isOpen || actions === void 0 || !isDevelopment()) return;
|
|
287
|
+
setActionCount(actionsRef.current?.querySelectorAll("button, a[href]").length ?? 0);
|
|
288
|
+
}, [isOpen, actions]);
|
|
289
|
+
useDevWarning(actionCount > DRAWER_MAX_HEADER_ACTIONS, "[@galaxy-io/dls] Drawer has more than three header `actions`. Keep one or two icon buttons and a ⋯ Menu, and move the rest into the menu.");
|
|
290
|
+
const labelling = ariaLabel !== void 0 ? { "aria-label": ariaLabel } : rest["aria-labelledby"] !== void 0 || header === void 0 ? {} : { "aria-labelledby": titleId };
|
|
291
|
+
const sizeStyle = { "--gx-drawer-size": `${currentSize}px` };
|
|
292
|
+
const regions = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
293
|
+
hasHeaderRow && /* @__PURE__ */ jsxs(Header, {
|
|
294
|
+
className: cx(isDismissable && (actions === void 0 ? HAS_CLOSE_CSS : HAS_CLOSE_WITH_ACTIONS_CSS)),
|
|
295
|
+
children: [typeof header === "string" ? /* @__PURE__ */ jsx(Text, {
|
|
296
|
+
as: "h2",
|
|
297
|
+
size: TextSize.BODY_LG,
|
|
298
|
+
weight: TextWeight.MEDIUM,
|
|
299
|
+
id: titleId,
|
|
300
|
+
className: HEADER_TITLE_CSS,
|
|
301
|
+
children: header
|
|
302
|
+
}) : header !== void 0 ? /* @__PURE__ */ jsx(HeaderNode, {
|
|
303
|
+
id: titleId,
|
|
304
|
+
children: header
|
|
305
|
+
}) : /* @__PURE__ */ jsx(HeaderNode, {}), actions !== void 0 && /* @__PURE__ */ jsx(HeaderActions, {
|
|
306
|
+
ref: actionsRef,
|
|
307
|
+
children: actions
|
|
308
|
+
})]
|
|
309
|
+
}),
|
|
310
|
+
/* @__PURE__ */ jsx(Body, { children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ jsx(Text, { children }) : children }),
|
|
311
|
+
footer !== void 0 && /* @__PURE__ */ jsx(Footer, { children: footer }),
|
|
312
|
+
isResizable && /* @__PURE__ */ jsx(ResizeHandle, {
|
|
313
|
+
orientation: DRAWER_SIDE_TO_HANDLE_ORIENTATION_MAP[side],
|
|
314
|
+
isReversed: DRAWER_SIDE_TO_IS_HANDLE_REVERSED_MAP[side],
|
|
315
|
+
value: currentSize,
|
|
316
|
+
onChange: setResizedSize,
|
|
317
|
+
min: DRAWER_MIN_SIZE_PX,
|
|
318
|
+
max: maxSize,
|
|
319
|
+
ariaLabel: RESIZE_LABEL,
|
|
320
|
+
"aria-controls": panelId,
|
|
321
|
+
className: DRAWER_SIDE_TO_HANDLE_CSS_MAP[side]
|
|
322
|
+
}),
|
|
323
|
+
isDismissable && /* @__PURE__ */ jsx(CloseSlot, { children: /* @__PURE__ */ jsx(Button, {
|
|
324
|
+
variant: ButtonVariant.TERTIARY,
|
|
325
|
+
size: ButtonSize.SMALL,
|
|
326
|
+
icon: XIcon,
|
|
327
|
+
ariaLabel: CLOSE_LABEL,
|
|
328
|
+
onClick: close
|
|
329
|
+
}) })
|
|
330
|
+
] });
|
|
331
|
+
if (!isModal) return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
332
|
+
initial: false,
|
|
333
|
+
children: isOpen && /* @__PURE__ */ jsx(motion.div, {
|
|
334
|
+
initial: DRAWER_SIDE_TO_PUSH_COLLAPSED_MAP[side],
|
|
335
|
+
animate: DRAWER_SIDE_TO_PUSH_OPEN_MAP[side],
|
|
336
|
+
exit: DRAWER_SIDE_TO_PUSH_COLLAPSED_MAP[side],
|
|
337
|
+
transition,
|
|
338
|
+
className: cx(PUSH_ROOT_CSS, DRAWER_PUSH_SIDE_TO_CSS_MAP[side]),
|
|
339
|
+
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
340
|
+
isTrapped: false,
|
|
341
|
+
autoFocus: FocusScopeAutoFocus.NONE,
|
|
342
|
+
className: FOCUS_SCOPE_CSS,
|
|
343
|
+
children: /* @__PURE__ */ jsx(Panel, {
|
|
344
|
+
...rest,
|
|
345
|
+
...labelling,
|
|
346
|
+
ref,
|
|
347
|
+
id: panelId,
|
|
348
|
+
role: "region",
|
|
349
|
+
className: cx(DRAWER_PUSH_PANEL_SIDE_TO_CSS_MAP[side], className),
|
|
350
|
+
style: {
|
|
351
|
+
...sizeStyle,
|
|
352
|
+
...style
|
|
353
|
+
},
|
|
354
|
+
children: regions
|
|
355
|
+
})
|
|
356
|
+
})
|
|
357
|
+
}, "drawer-push")
|
|
358
|
+
});
|
|
359
|
+
if (!hasOpened) return null;
|
|
360
|
+
const closed = {
|
|
361
|
+
opacity: 0,
|
|
362
|
+
...DRAWER_SIDE_TO_OFFSET_MAP[side],
|
|
363
|
+
pointerEvents: "none"
|
|
364
|
+
};
|
|
365
|
+
const frameStyle = {
|
|
366
|
+
"--gx-drawer-z": zIndex,
|
|
367
|
+
"--gx-drawer-size": `${currentSize}px`
|
|
368
|
+
};
|
|
369
|
+
return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsxs(OverlayNode, {
|
|
370
|
+
overlayId,
|
|
371
|
+
children: [/* @__PURE__ */ jsx(Fade, {
|
|
372
|
+
isOpen,
|
|
373
|
+
shouldAnimateOnMount,
|
|
374
|
+
className: BACKDROP_FRAME_CSS,
|
|
375
|
+
style: { "--gx-drawer-z": zIndex },
|
|
376
|
+
children: /* @__PURE__ */ jsx(Backdrop, {
|
|
377
|
+
"aria-hidden": true,
|
|
378
|
+
onPointerDown: handleBackdropPointerDown,
|
|
379
|
+
onClick: handleBackdropClick
|
|
380
|
+
})
|
|
381
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, {
|
|
382
|
+
initial: shouldAnimateOnMount,
|
|
383
|
+
children: isOpen && /* @__PURE__ */ jsx(motion.div, {
|
|
384
|
+
initial: closed,
|
|
385
|
+
animate: DRAWER_OPEN,
|
|
386
|
+
exit: closed,
|
|
387
|
+
transition,
|
|
388
|
+
className: cx(FRAME_CSS, DRAWER_SIDE_TO_CSS_MAP[side]),
|
|
389
|
+
style: frameStyle,
|
|
390
|
+
children: /* @__PURE__ */ jsx(FocusScope, {
|
|
391
|
+
autoFocus: FocusScopeAutoFocus.FIRST,
|
|
392
|
+
className: FOCUS_SCOPE_CSS,
|
|
393
|
+
children: /* @__PURE__ */ jsx(Panel, {
|
|
394
|
+
...rest,
|
|
395
|
+
...labelling,
|
|
396
|
+
ref,
|
|
397
|
+
id: panelId,
|
|
398
|
+
role: "dialog",
|
|
399
|
+
"aria-modal": "true",
|
|
400
|
+
className,
|
|
401
|
+
style,
|
|
402
|
+
children: regions
|
|
403
|
+
})
|
|
404
|
+
})
|
|
405
|
+
}, "drawer-frame")
|
|
406
|
+
})]
|
|
407
|
+
}) });
|
|
408
|
+
});
|
|
409
|
+
Drawer.displayName = "Drawer";
|
|
76
410
|
//#endregion
|
|
77
|
-
export { Drawer as default };
|
|
411
|
+
export { DrawerSize, Drawer as default };
|