@flipdish/ui-library 0.41.2 → 0.43.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/dist/components/atoms/Dot/Dot.styles.cjs +1 -0
- package/dist/components/atoms/Dot/Dot.styles.cjs.map +1 -1
- package/dist/components/atoms/Dot/Dot.styles.d.ts +4 -0
- package/dist/components/atoms/Dot/Dot.styles.d.ts.map +1 -1
- package/dist/components/atoms/Dot/Dot.styles.js +1 -0
- package/dist/components/atoms/Dot/Dot.styles.js.map +1 -1
- package/dist/components/atoms/LoadingIndicator/index.cjs +5 -0
- package/dist/components/atoms/LoadingIndicator/index.cjs.map +1 -1
- package/dist/components/atoms/LoadingIndicator/index.d.ts +1 -1
- package/dist/components/atoms/LoadingIndicator/index.d.ts.map +1 -1
- package/dist/components/atoms/LoadingIndicator/index.js +5 -0
- package/dist/components/atoms/LoadingIndicator/index.js.map +1 -1
- package/dist/components/atoms/SearchInput/index.cjs +28 -2
- package/dist/components/atoms/SearchInput/index.cjs.map +1 -1
- package/dist/components/atoms/SearchInput/index.d.ts +8 -1
- package/dist/components/atoms/SearchInput/index.d.ts.map +1 -1
- package/dist/components/atoms/SearchInput/index.js +28 -2
- package/dist/components/atoms/SearchInput/index.js.map +1 -1
- package/dist/components/atoms/SocialButton/index.cjs +11 -7
- package/dist/components/atoms/SocialButton/index.cjs.map +1 -1
- package/dist/components/atoms/SocialButton/index.d.ts.map +1 -1
- package/dist/components/atoms/SocialButton/index.js +11 -7
- package/dist/components/atoms/SocialButton/index.js.map +1 -1
- package/dist/components/atoms/Tooltip/index.cjs +8 -1
- package/dist/components/atoms/Tooltip/index.cjs.map +1 -1
- package/dist/components/atoms/Tooltip/index.d.ts.map +1 -1
- package/dist/components/atoms/Tooltip/index.js +8 -1
- package/dist/components/atoms/Tooltip/index.js.map +1 -1
- package/dist/components/atoms/UtilityButton/index.cjs.map +1 -1
- package/dist/components/atoms/UtilityButton/index.d.ts +2 -0
- package/dist/components/atoms/UtilityButton/index.d.ts.map +1 -1
- package/dist/components/atoms/UtilityButton/index.js.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/BreadcrumbItem.cjs +16 -4
- package/dist/components/molecules/Breadcrumbs/components/BreadcrumbItem.cjs.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/BreadcrumbItem.d.ts.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/BreadcrumbItem.js +17 -5
- package/dist/components/molecules/Breadcrumbs/components/BreadcrumbItem.js.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.cjs +8 -1
- package/dist/components/molecules/ButtonGroup/index.cjs.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.d.ts.map +1 -1
- package/dist/components/molecules/ButtonGroup/index.js +9 -2
- package/dist/components/molecules/ButtonGroup/index.js.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.cjs +8 -1
- package/dist/components/molecules/CodeSnippet/index.cjs.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.d.ts.map +1 -1
- package/dist/components/molecules/CodeSnippet/index.js +8 -1
- package/dist/components/molecules/CodeSnippet/index.js.map +1 -1
- package/dist/components/molecules/Dropdown/index.cjs +10 -7
- package/dist/components/molecules/Dropdown/index.cjs.map +1 -1
- package/dist/components/molecules/Dropdown/index.d.ts.map +1 -1
- package/dist/components/molecules/Dropdown/index.js +11 -8
- package/dist/components/molecules/Dropdown/index.js.map +1 -1
- package/dist/components/molecules/EmptyState/index.cjs +3 -2
- package/dist/components/molecules/EmptyState/index.cjs.map +1 -1
- package/dist/components/molecules/EmptyState/index.d.ts.map +1 -1
- package/dist/components/molecules/EmptyState/index.js +3 -2
- package/dist/components/molecules/EmptyState/index.js.map +1 -1
- package/dist/components/molecules/Select/components/Combobox.cjs +8 -1
- package/dist/components/molecules/Select/components/Combobox.cjs.map +1 -1
- package/dist/components/molecules/Select/components/Combobox.js +8 -1
- package/dist/components/molecules/Select/components/Combobox.js.map +1 -1
- package/dist/components/molecules/Select/components/SelectItem.cjs +10 -1
- package/dist/components/molecules/Select/components/SelectItem.cjs.map +1 -1
- package/dist/components/molecules/Select/components/SelectItem.d.ts.map +1 -1
- package/dist/components/molecules/Select/components/SelectItem.js +10 -1
- package/dist/components/molecules/Select/components/SelectItem.js.map +1 -1
- package/dist/components/molecules/Select/index.cjs +11 -1
- package/dist/components/molecules/Select/index.cjs.map +1 -1
- package/dist/components/molecules/Select/index.d.ts.map +1 -1
- package/dist/components/molecules/Select/index.js +11 -1
- package/dist/components/molecules/Select/index.js.map +1 -1
- package/dist/components/molecules/Select/multiSelect.utils.cjs +5 -1
- package/dist/components/molecules/Select/multiSelect.utils.cjs.map +1 -1
- package/dist/components/molecules/Select/multiSelect.utils.d.ts.map +1 -1
- package/dist/components/molecules/Select/multiSelect.utils.js +5 -1
- package/dist/components/molecules/Select/multiSelect.utils.js.map +1 -1
- package/dist/components/molecules/Tabs/index.cjs +14 -9
- package/dist/components/molecules/Tabs/index.cjs.map +1 -1
- package/dist/components/molecules/Tabs/index.d.ts +5 -3
- package/dist/components/molecules/Tabs/index.d.ts.map +1 -1
- package/dist/components/molecules/Tabs/index.js +15 -10
- package/dist/components/molecules/Tabs/index.js.map +1 -1
- package/dist/components/molecules/Tags/Tags.styles.cjs +66 -0
- package/dist/components/molecules/Tags/Tags.styles.cjs.map +1 -0
- package/dist/components/molecules/Tags/Tags.styles.d.ts +141 -0
- package/dist/components/molecules/Tags/Tags.styles.d.ts.map +1 -0
- package/dist/components/molecules/Tags/Tags.styles.js +64 -0
- package/dist/components/molecules/Tags/Tags.styles.js.map +1 -0
- package/dist/components/molecules/Tags/components/TagCheckbox.cjs +2 -1
- package/dist/components/molecules/Tags/components/TagCheckbox.cjs.map +1 -1
- package/dist/components/molecules/Tags/components/TagCheckbox.d.ts +2 -1
- package/dist/components/molecules/Tags/components/TagCheckbox.d.ts.map +1 -1
- package/dist/components/molecules/Tags/components/TagCheckbox.js +2 -1
- package/dist/components/molecules/Tags/components/TagCheckbox.js.map +1 -1
- package/dist/components/molecules/Tags/components/TagCloseX.cjs +2 -6
- package/dist/components/molecules/Tags/components/TagCloseX.cjs.map +1 -1
- package/dist/components/molecules/Tags/components/TagCloseX.d.ts +2 -1
- package/dist/components/molecules/Tags/components/TagCloseX.d.ts.map +1 -1
- package/dist/components/molecules/Tags/components/TagCloseX.js +2 -6
- package/dist/components/molecules/Tags/components/TagCloseX.js.map +1 -1
- package/dist/components/molecules/Tags/index.cjs +18 -48
- package/dist/components/molecules/Tags/index.cjs.map +1 -1
- package/dist/components/molecules/Tags/index.d.ts +12 -3
- package/dist/components/molecules/Tags/index.d.ts.map +1 -1
- package/dist/components/molecules/Tags/index.js +18 -48
- package/dist/components/molecules/Tags/index.js.map +1 -1
- package/dist/components/molecules/VerificationCodeInput/index.cjs +1 -1
- package/dist/components/molecules/VerificationCodeInput/index.cjs.map +1 -1
- package/dist/components/molecules/VerificationCodeInput/index.js +1 -1
- package/dist/components/molecules/VerificationCodeInput/index.js.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs +4 -1
- package/dist/components/organisms/ApplicationHeader/index.cjs.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.d.ts.map +1 -1
- package/dist/components/organisms/ApplicationHeader/index.js +4 -1
- package/dist/components/organisms/ApplicationHeader/index.js.map +1 -1
- package/dist/components/organisms/Calendar/calendar.utils.cjs +14 -0
- package/dist/components/organisms/Calendar/calendar.utils.cjs.map +1 -1
- package/dist/components/organisms/Calendar/calendar.utils.d.ts +7 -0
- package/dist/components/organisms/Calendar/calendar.utils.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/calendar.utils.js +14 -1
- package/dist/components/organisms/Calendar/calendar.utils.js.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarDayView.cjs +1 -1
- package/dist/components/organisms/Calendar/components/CalendarDayView.cjs.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarDayView.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarDayView.js +2 -2
- package/dist/components/organisms/Calendar/components/CalendarDayView.js.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarMonthView.cjs +12 -5
- package/dist/components/organisms/Calendar/components/CalendarMonthView.cjs.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarMonthView.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarMonthView.js +13 -6
- package/dist/components/organisms/Calendar/components/CalendarMonthView.js.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarWeekView.cjs +1 -1
- package/dist/components/organisms/Calendar/components/CalendarWeekView.cjs.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarWeekView.d.ts.map +1 -1
- package/dist/components/organisms/Calendar/components/CalendarWeekView.js +2 -2
- package/dist/components/organisms/Calendar/components/CalendarWeekView.js.map +1 -1
- package/dist/components/organisms/Charts/components/ChartsBase.cjs +28 -13
- package/dist/components/organisms/Charts/components/ChartsBase.cjs.map +1 -1
- package/dist/components/organisms/Charts/components/ChartsBase.d.ts.map +1 -1
- package/dist/components/organisms/Charts/components/ChartsBase.js +28 -13
- package/dist/components/organisms/Charts/components/ChartsBase.js.map +1 -1
- package/dist/components/organisms/Charts/components/Metrics.cjs +1 -1
- package/dist/components/organisms/Charts/components/Metrics.cjs.map +1 -1
- package/dist/components/organisms/Charts/components/Metrics.d.ts.map +1 -1
- package/dist/components/organisms/Charts/components/Metrics.js +1 -1
- package/dist/components/organisms/Charts/components/Metrics.js.map +1 -1
- package/dist/components/organisms/ColorPicker/index.cjs +8 -5
- package/dist/components/organisms/ColorPicker/index.cjs.map +1 -1
- package/dist/components/organisms/ColorPicker/index.d.ts.map +1 -1
- package/dist/components/organisms/ColorPicker/index.js +8 -5
- package/dist/components/organisms/ColorPicker/index.js.map +1 -1
- package/dist/components/organisms/Messaging/index.cjs +23 -5
- package/dist/components/organisms/Messaging/index.cjs.map +1 -1
- package/dist/components/organisms/Messaging/index.d.ts.map +1 -1
- package/dist/components/organisms/Messaging/index.js +24 -6
- package/dist/components/organisms/Messaging/index.js.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs +7 -2
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.cjs.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts +3 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.d.ts.map +1 -1
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js +8 -3
- package/dist/components/organisms/SidePanel/hooks/usePanelFocus.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs +121 -0
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts +30 -0
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js +119 -0
- package/dist/components/organisms/SlideoutMenu/components/SlideoutShell.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs +39 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts +23 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js +37 -0
- package/dist/components/organisms/SlideoutMenu/hooks/useSlideoutState.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/index.cjs +34 -37
- package/dist/components/organisms/SlideoutMenu/index.cjs.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.d.ts +52 -41
- package/dist/components/organisms/SlideoutMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/SlideoutMenu/index.js +35 -38
- package/dist/components/organisms/SlideoutMenu/index.js.map +1 -1
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.cjs +13 -0
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.d.ts +14 -0
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.js +11 -0
- package/dist/components/organisms/SlideoutMenu/providers/OverlayBounds.context.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.cjs +9 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.d.ts +13 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.js +7 -0
- package/dist/components/organisms/SlideoutMenu/providers/SlideoutMenu.context.js.map +1 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.cjs +52 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.cjs.map +1 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.d.ts +26 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.d.ts.map +1 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.js +47 -0
- package/dist/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.js.map +1 -0
- package/dist/components/organisms/Table/index.cjs +35 -5
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +8 -2
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +36 -6
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/components/organisms/Table/table.utils.cjs +37 -0
- package/dist/components/organisms/Table/table.utils.cjs.map +1 -0
- package/dist/components/organisms/Table/table.utils.d.ts +22 -0
- package/dist/components/organisms/Table/table.utils.d.ts.map +1 -0
- package/dist/components/organisms/Table/table.utils.js +33 -0
- package/dist/components/organisms/Table/table.utils.js.map +1 -0
- package/dist/components/organisms/TreeView/index.cjs +14 -7
- package/dist/components/organisms/TreeView/index.cjs.map +1 -1
- package/dist/components/organisms/TreeView/index.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/index.js +14 -7
- package/dist/components/organisms/TreeView/index.js.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.cjs +4 -1
- package/dist/components/organisms/TreeView/treeView.utils.cjs.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.d.ts.map +1 -1
- package/dist/components/organisms/TreeView/treeView.utils.js +4 -1
- package/dist/components/organisms/TreeView/treeView.utils.js.map +1 -1
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.cjs +43 -0
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.cjs.map +1 -0
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.d.ts +12 -0
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.d.ts.map +1 -0
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.js +41 -0
- package/dist/components/templates/AppShell/hooks/usePageAreaBounds.js.map +1 -0
- package/dist/components/templates/AppShell/index.cjs +10 -6
- package/dist/components/templates/AppShell/index.cjs.map +1 -1
- package/dist/components/templates/AppShell/index.d.ts +1 -1
- package/dist/components/templates/AppShell/index.d.ts.map +1 -1
- package/dist/components/templates/AppShell/index.js +11 -7
- package/dist/components/templates/AppShell/index.js.map +1 -1
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.cjs +56 -0
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.cjs.map +1 -0
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.d.ts +26 -0
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.d.ts.map +1 -0
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.js +54 -0
- package/dist/hooks/__internal__/useDebouncedSearch/useDebouncedSearch.js.map +1 -0
- package/dist/hooks/useDebouncedCallback/index.cjs +45 -0
- package/dist/hooks/useDebouncedCallback/index.cjs.map +1 -0
- package/dist/hooks/useDebouncedCallback/index.d.ts +18 -0
- package/dist/hooks/useDebouncedCallback/index.d.ts.map +1 -0
- package/dist/hooks/useDebouncedCallback/index.js +43 -0
- package/dist/hooks/useDebouncedCallback/index.js.map +1 -0
- package/dist/native/components/atoms/Checkbox/index.d.ts.map +1 -1
- package/dist/native/components/atoms/Checkbox/index.js +1 -1
- package/dist/native/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/native/components/atoms/Dot/Dot.styles.d.ts +4 -0
- package/dist/native/components/atoms/Dot/Dot.styles.d.ts.map +1 -1
- package/dist/native/components/atoms/Dot/Dot.styles.js +1 -0
- package/dist/native/components/atoms/Dot/Dot.styles.js.map +1 -1
- package/dist/native/components/molecules/Tags/Tags.styles.d.ts +141 -0
- package/dist/native/components/molecules/Tags/Tags.styles.d.ts.map +1 -0
- package/dist/native/components/molecules/Tags/Tags.styles.js +92 -0
- package/dist/native/components/molecules/Tags/Tags.styles.js.map +1 -0
- package/dist/native/components/molecules/Tags/index.d.ts +95 -8
- package/dist/native/components/molecules/Tags/index.d.ts.map +1 -0
- package/dist/native/components/molecules/Tags/index.js +105 -0
- package/dist/native/components/molecules/Tags/index.js.map +1 -0
- package/dist/native/hooks/useDebouncedCallback/index.d.ts +18 -0
- package/dist/native/hooks/useDebouncedCallback/index.d.ts.map +1 -0
- package/dist/native/hooks/useDebouncedCallback/index.js +43 -0
- package/dist/native/hooks/useDebouncedCallback/index.js.map +1 -0
- package/dist/native/utilities/searchParamsUtils/index.d.ts +12 -0
- package/dist/utilities/searchParamsUtils/index.cjs +71 -0
- package/dist/utilities/searchParamsUtils/index.cjs.map +1 -0
- package/dist/utilities/searchParamsUtils/index.d.ts +61 -0
- package/dist/utilities/searchParamsUtils/index.d.ts.map +1 -0
- package/dist/utilities/searchParamsUtils/index.js +64 -0
- package/dist/utilities/searchParamsUtils/index.js.map +1 -0
- package/package.json +4 -2
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// Read with `var()` on the panel's clip box, so a host sets them on `:root`, `body` or any ancestor of the element overlays
|
|
4
|
+
// portal into; with `UIProvider`'s `scopeId` that element is an anchor the library creates on `body`, which inherits them.
|
|
5
|
+
/** The CSS custom property naming the height of the host's chrome above the page. */
|
|
6
|
+
const APP_HEADER_HEIGHT_VAR = '--app-header-height';
|
|
7
|
+
/** The CSS custom property naming the width of the host's navigation beside the page. */
|
|
8
|
+
const APP_SIDEBAR_WIDTH_VAR = '--app-sidebar-width';
|
|
9
|
+
/** The CSS custom property naming the width of a panel the host docks beside the page. */
|
|
10
|
+
const APP_SIDE_PANEL_WIDTH_VAR = '--app-side-panel-width';
|
|
11
|
+
const HOST_BOUNDS = {
|
|
12
|
+
top: `var(${APP_HEADER_HEIGHT_VAR}, 0px)`,
|
|
13
|
+
right: `var(${APP_SIDE_PANEL_WIDTH_VAR}, 0px)`,
|
|
14
|
+
bottom: '0px',
|
|
15
|
+
left: `var(${APP_SIDEBAR_WIDTH_VAR}, 0px)`,
|
|
16
|
+
};
|
|
17
|
+
const toLength = (value, fallback) => {
|
|
18
|
+
if (typeof value === 'number')
|
|
19
|
+
return `${value}px`;
|
|
20
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
21
|
+
return value;
|
|
22
|
+
return fallback;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Resolves the box the panel may cover, as the style of a fixed element. The `bounds` prop wins and
|
|
26
|
+
* reads as insets, each key falling back to the host's variable; a page area measured by `AppShell`
|
|
27
|
+
* comes next, as a position and size so no viewport size is needed; else the host's variables alone.
|
|
28
|
+
*
|
|
29
|
+
* @param bounds The `bounds` prop, as passed.
|
|
30
|
+
* @param measured The page area `AppShell` measured, when the panel is rendered inside one.
|
|
31
|
+
* @returns Inline styles positioning the clip box over the resolved bounds.
|
|
32
|
+
*/
|
|
33
|
+
const resolveSlideoutBounds = (bounds, measured) => {
|
|
34
|
+
if (bounds) {
|
|
35
|
+
return {
|
|
36
|
+
top: toLength(bounds.top, HOST_BOUNDS.top),
|
|
37
|
+
right: toLength(bounds.right, HOST_BOUNDS.right),
|
|
38
|
+
bottom: toLength(bounds.bottom, HOST_BOUNDS.bottom),
|
|
39
|
+
left: toLength(bounds.left, HOST_BOUNDS.left),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (measured) {
|
|
43
|
+
return { top: `${measured.top}px`, left: `${measured.left}px`, width: `${measured.width}px`, height: `${measured.height}px` };
|
|
44
|
+
}
|
|
45
|
+
return { ...HOST_BOUNDS };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
exports.APP_HEADER_HEIGHT_VAR = APP_HEADER_HEIGHT_VAR;
|
|
49
|
+
exports.APP_SIDEBAR_WIDTH_VAR = APP_SIDEBAR_WIDTH_VAR;
|
|
50
|
+
exports.APP_SIDE_PANEL_WIDTH_VAR = APP_SIDE_PANEL_WIDTH_VAR;
|
|
51
|
+
exports.resolveSlideoutBounds = resolveSlideoutBounds;
|
|
52
|
+
//# sourceMappingURL=slideoutMenu.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slideoutMenu.utils.cjs","sources":["../../../../../src/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;AACA;AACA;AACO,MAAM,qBAAqB,GAAG;AACrC;AACO,MAAM,qBAAqB,GAAG;AACrC;AACO,MAAM,wBAAwB,GAAG;AAUxC,MAAM,WAAW,GAAyC;IACxD,GAAG,EAAE,CAAA,IAAA,EAAO,qBAAqB,CAAA,MAAA,CAAQ;IACzC,KAAK,EAAE,CAAA,IAAA,EAAO,wBAAwB,CAAA,MAAA,CAAQ;AAC9C,IAAA,MAAM,EAAE,KAAK;IACb,IAAI,EAAE,CAAA,IAAA,EAAO,qBAAqB,CAAA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
/** The CSS custom property naming the height of the host's chrome above the page. */
|
|
4
|
+
export declare const APP_HEADER_HEIGHT_VAR = "--app-header-height";
|
|
5
|
+
/** The CSS custom property naming the width of the host's navigation beside the page. */
|
|
6
|
+
export declare const APP_SIDEBAR_WIDTH_VAR = "--app-sidebar-width";
|
|
7
|
+
/** The CSS custom property naming the width of a panel the host docks beside the page. */
|
|
8
|
+
export declare const APP_SIDE_PANEL_WIDTH_VAR = "--app-side-panel-width";
|
|
9
|
+
/** Distances from the viewport edges to the box the panel may cover. A number is pixels, a string any CSS length. */
|
|
10
|
+
export interface SlideoutBounds {
|
|
11
|
+
top?: number | string;
|
|
12
|
+
right?: number | string;
|
|
13
|
+
bottom?: number | string;
|
|
14
|
+
left?: number | string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves the box the panel may cover, as the style of a fixed element. The `bounds` prop wins and
|
|
18
|
+
* reads as insets, each key falling back to the host's variable; a page area measured by `AppShell`
|
|
19
|
+
* comes next, as a position and size so no viewport size is needed; else the host's variables alone.
|
|
20
|
+
*
|
|
21
|
+
* @param bounds The `bounds` prop, as passed.
|
|
22
|
+
* @param measured The page area `AppShell` measured, when the panel is rendered inside one.
|
|
23
|
+
* @returns Inline styles positioning the clip box over the resolved bounds.
|
|
24
|
+
*/
|
|
25
|
+
export declare const resolveSlideoutBounds: (bounds: SlideoutBounds | undefined, measured: OverlayBounds | undefined) => CSSProperties;
|
|
26
|
+
//# sourceMappingURL=slideoutMenu.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slideoutMenu.utils.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAIxE,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D,yFAAyF;AACzF,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB,2BAA2B,CAAC;AAEjE,qHAAqH;AACrH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAeD;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,cAAc,GAAG,SAAS,EAAE,UAAU,aAAa,GAAG,SAAS,KAAG,aAa/G,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Read with `var()` on the panel's clip box, so a host sets them on `:root`, `body` or any ancestor of the element overlays
|
|
2
|
+
// portal into; with `UIProvider`'s `scopeId` that element is an anchor the library creates on `body`, which inherits them.
|
|
3
|
+
/** The CSS custom property naming the height of the host's chrome above the page. */
|
|
4
|
+
const APP_HEADER_HEIGHT_VAR = '--app-header-height';
|
|
5
|
+
/** The CSS custom property naming the width of the host's navigation beside the page. */
|
|
6
|
+
const APP_SIDEBAR_WIDTH_VAR = '--app-sidebar-width';
|
|
7
|
+
/** The CSS custom property naming the width of a panel the host docks beside the page. */
|
|
8
|
+
const APP_SIDE_PANEL_WIDTH_VAR = '--app-side-panel-width';
|
|
9
|
+
const HOST_BOUNDS = {
|
|
10
|
+
top: `var(${APP_HEADER_HEIGHT_VAR}, 0px)`,
|
|
11
|
+
right: `var(${APP_SIDE_PANEL_WIDTH_VAR}, 0px)`,
|
|
12
|
+
bottom: '0px',
|
|
13
|
+
left: `var(${APP_SIDEBAR_WIDTH_VAR}, 0px)`,
|
|
14
|
+
};
|
|
15
|
+
const toLength = (value, fallback) => {
|
|
16
|
+
if (typeof value === 'number')
|
|
17
|
+
return `${value}px`;
|
|
18
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
19
|
+
return value;
|
|
20
|
+
return fallback;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the box the panel may cover, as the style of a fixed element. The `bounds` prop wins and
|
|
24
|
+
* reads as insets, each key falling back to the host's variable; a page area measured by `AppShell`
|
|
25
|
+
* comes next, as a position and size so no viewport size is needed; else the host's variables alone.
|
|
26
|
+
*
|
|
27
|
+
* @param bounds The `bounds` prop, as passed.
|
|
28
|
+
* @param measured The page area `AppShell` measured, when the panel is rendered inside one.
|
|
29
|
+
* @returns Inline styles positioning the clip box over the resolved bounds.
|
|
30
|
+
*/
|
|
31
|
+
const resolveSlideoutBounds = (bounds, measured) => {
|
|
32
|
+
if (bounds) {
|
|
33
|
+
return {
|
|
34
|
+
top: toLength(bounds.top, HOST_BOUNDS.top),
|
|
35
|
+
right: toLength(bounds.right, HOST_BOUNDS.right),
|
|
36
|
+
bottom: toLength(bounds.bottom, HOST_BOUNDS.bottom),
|
|
37
|
+
left: toLength(bounds.left, HOST_BOUNDS.left),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (measured) {
|
|
41
|
+
return { top: `${measured.top}px`, left: `${measured.left}px`, width: `${measured.width}px`, height: `${measured.height}px` };
|
|
42
|
+
}
|
|
43
|
+
return { ...HOST_BOUNDS };
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export { APP_HEADER_HEIGHT_VAR, APP_SIDEBAR_WIDTH_VAR, APP_SIDE_PANEL_WIDTH_VAR, resolveSlideoutBounds };
|
|
47
|
+
//# sourceMappingURL=slideoutMenu.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slideoutMenu.utils.js","sources":["../../../../../src/components/organisms/SlideoutMenu/utilities/slideoutMenu.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;AACA;AACA;AACO,MAAM,qBAAqB,GAAG;AACrC;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,EAAG,QAAQ,CAAC,KAAK,CAAA,EAAA,CAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAA,EAAA,CAAI,EAAE;IAC/H;AACA,IAAA,OAAO,EAAE,GAAG,WAAW,EAAE;AAC3B;;"}
|
|
@@ -10,6 +10,7 @@ var cx = require('@flipdish/ui-library/utilities/cx');
|
|
|
10
10
|
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
11
11
|
var React = require('react');
|
|
12
12
|
var reactAriaComponents = require('react-aria-components');
|
|
13
|
+
var table_utils = require('./table.utils.cjs');
|
|
13
14
|
|
|
14
15
|
/** Row actions menu behind a dots button with fixed Edit, Copy link and Delete items, for use in a table's last column. */
|
|
15
16
|
const TableRowActionsDropdown = () => (jsxRuntime.jsxs(Dropdown.Dropdown.Root, { children: [jsxRuntime.jsx(Dropdown.Dropdown.DotsButton, { color: "tertiary" }), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { className: "w-min", children: jsxRuntime.jsxs(Dropdown.Dropdown.Menu, { children: [jsxRuntime.jsx(Dropdown.Dropdown.Item, { icon: uiIcons.Edit01, children: jsxRuntime.jsx("span", { className: "pr-4", children: "Edit" }) }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { icon: uiIcons.Copy01, children: jsxRuntime.jsx("span", { className: "pr-4", children: "Copy link" }) }), jsxRuntime.jsx(Dropdown.Dropdown.Item, { icon: uiIcons.Trash01, children: jsxRuntime.jsx("span", { className: "pr-4", children: "Delete" }) })] }) })] }));
|
|
@@ -21,14 +22,38 @@ const TableCardRoot = ({ children, className, size = 'md', ...props }) => {
|
|
|
21
22
|
/** Titled header for a table embedded in a dashboard or panel; page-level tables use `PageHeader` instead. */
|
|
22
23
|
const TableCardHeader = ({ title, badge, description, contentTrailing, className }) => {
|
|
23
24
|
const { size } = React.useContext(TableContext);
|
|
24
|
-
|
|
25
|
+
const renderBadge = () => {
|
|
26
|
+
if (!badge)
|
|
27
|
+
return null;
|
|
28
|
+
if (React.isValidElement(badge))
|
|
29
|
+
return badge;
|
|
30
|
+
return (jsxRuntime.jsx(Badge.Badge, { color: "gray", size: "sm", type: "modern", children: badge }));
|
|
31
|
+
};
|
|
32
|
+
return (jsxRuntime.jsxs("div", { className: cx.cx('relative flex flex-col items-start gap-4 border-b border-secondary bg-primary px-4 md:flex-row', size === 'sm' ? 'py-4 md:px-5' : 'py-5 md:px-6', className), children: [jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-0.5", children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("h2", { className: "text-md font-semibold text-primary", children: title }), renderBadge()] }), description && jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: description })] }), contentTrailing] }));
|
|
25
33
|
};
|
|
26
|
-
const TableRoot = ({ className, size: sizeProp, 'data-testid': dataTestId, ...props }) => {
|
|
34
|
+
const TableRoot = ({ className, size: sizeProp, selectedKey, onSelectedKeyChange, onSelectedKeysChange, 'data-testid': dataTestId, ...props }) => {
|
|
27
35
|
// Re-providing the context would otherwise reset a card-level `size` back to `md`.
|
|
28
36
|
const inherited = React.useContext(TableContext);
|
|
29
37
|
const size = sizeProp ?? inherited.size;
|
|
30
38
|
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'table', rootName: 'table' });
|
|
31
|
-
|
|
39
|
+
// react-aria reports "select all" as `'all'`; the rendered rows say which ids that covers, in mount order rather than display order.
|
|
40
|
+
const rowKeys = React.useRef(new Set());
|
|
41
|
+
const registerRow = React.useCallback((id) => {
|
|
42
|
+
rowKeys.current.add(id);
|
|
43
|
+
return () => {
|
|
44
|
+
rowKeys.current.delete(id);
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
const { onSelectionChange } = props;
|
|
48
|
+
const reportsSelection = onSelectionChange !== undefined || onSelectedKeyChange !== undefined || onSelectedKeysChange !== undefined;
|
|
49
|
+
const handleSelectionChange = (selection) => {
|
|
50
|
+
onSelectionChange?.(selection);
|
|
51
|
+
onSelectedKeyChange?.(table_utils.keyOfSelection(selection));
|
|
52
|
+
onSelectedKeysChange?.(table_utils.keysOfSelection(selection, rowKeys.current, props.disabledKeys));
|
|
53
|
+
};
|
|
54
|
+
return (
|
|
55
|
+
// A row cannot see the table-level `onRowAction`, so the context carries whether one exists.
|
|
56
|
+
jsxRuntime.jsx(TableContext.Provider, { value: { size, testIdPrefix: rootTestId, hasRowAction: props.onRowAction !== undefined, registerRow }, children: jsxRuntime.jsx("div", { className: "overflow-x-auto", children: jsxRuntime.jsx(reactAriaComponents.Table, { "data-testid": rootTestId, className: (state) => cx.cx('w-full overflow-x-hidden', typeof className === 'function' ? className(state) : className), ...props, selectedKeys: selectedKey !== undefined ? table_utils.selectionOfKey(selectedKey) : props.selectedKeys, onSelectionChange: reportsSelection ? handleSelectionChange : undefined }) }) }));
|
|
32
57
|
};
|
|
33
58
|
TableRoot.displayName = 'Table';
|
|
34
59
|
const TableHeader = ({ columns, children, bordered = true, className, size: sizeProp, ...props }) => {
|
|
@@ -51,11 +76,16 @@ const TableHead = ({ className, tooltip, label, children, 'data-testid': dataTes
|
|
|
51
76
|
TableHead.displayName = 'TableHead';
|
|
52
77
|
const TableRow = ({ columns, children, className, highlightSelectedRow = true, size: sizeProp, 'data-testid': dataTestId, ...props }) => {
|
|
53
78
|
const context = React.useContext(TableContext);
|
|
54
|
-
const { selectionBehavior } = reactAriaComponents.useTableOptions();
|
|
79
|
+
const { selectionBehavior, selectionMode } = reactAriaComponents.useTableOptions();
|
|
55
80
|
const size = sizeProp ?? context.size;
|
|
81
|
+
// A click does something on the row itself: its own action or link, the table's row action, or selection by row.
|
|
82
|
+
const isInteractive = props.onAction !== undefined || props.href !== undefined || context.hasRowAction === true || selectionMode !== 'none';
|
|
56
83
|
const rowTestId = dataTestId ??
|
|
57
84
|
(context.testIdPrefix && props.id !== undefined ? testIdUtils.joinTestId(context.testIdPrefix, `row-${testIdUtils.slugifyTestId(String(props.id))}`) : undefined);
|
|
58
|
-
|
|
85
|
+
const { registerRow } = context;
|
|
86
|
+
const { id, isDisabled } = props;
|
|
87
|
+
React.useEffect(() => (id === undefined || isDisabled ? undefined : registerRow?.(id)), [registerRow, id, isDisabled]);
|
|
88
|
+
return (jsxRuntime.jsxs(reactAriaComponents.Row, { ...props, "data-testid": rowTestId, className: (state) => cx.cx('relative outline-focus-ring transition-colors after:pointer-events-none hover:bg-secondary focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' ? 'h-14' : 'h-18', highlightSelectedRow && 'selected:bg-secondary', isInteractive && (state.isDisabled ? 'cursor-default' : 'cursor-pointer'),
|
|
59
89
|
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
60
90
|
'[&>td]:after:absolute [&>td]:after:inset-x-0 [&>td]:after:bottom-0 [&>td]:after:h-px [&>td]:after:w-full [&>td]:after:bg-border-secondary last:[&>td]:after:hidden [&>td]:focus-visible:after:opacity-0 focus-visible:[&>td]:after:opacity-0', typeof className === 'function' ? className(state) : className), children: [selectionBehavior === 'toggle' && (jsxRuntime.jsx(reactAriaComponents.Cell, { className: cx.cx('relative py-2 pr-0 pl-4', size === 'sm' ? 'md:pl-5' : 'md:pl-6'), children: jsxRuntime.jsx("div", { className: "flex items-end", children: jsxRuntime.jsx(Checkbox.Checkbox, { slot: "selection", size: "md", "data-testid": rowTestId ? testIdUtils.joinTestId(rowTestId, 'selection') : undefined }) }) })), jsxRuntime.jsx(reactAriaComponents.Collection, { items: columns, children: children })] }));
|
|
61
91
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","Dropdown","_jsx","Edit01","Copy01","Trash01","createContext","cx","useContext","isValidElement","Badge","useResolvedTestId","AriaTable","useTableOptions","AriaTableHeader","AriaColumn","Checkbox","AriaCollection","joinTestId","slugifyTestId","AriaGroup","Tooltip","TooltipTrigger","HelpCircle","ArrowDown","ChevronSelectorVertical","AriaRow","AriaCell","AriaTableBody"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","Dropdown","_jsx","Edit01","Copy01","Trash01","createContext","cx","useContext","isValidElement","Badge","useResolvedTestId","useRef","useCallback","keyOfSelection","keysOfSelection","AriaTable","selectionOfKey","useTableOptions","AriaTableHeader","AriaColumn","Checkbox","AriaCollection","joinTestId","slugifyTestId","AriaGroup","Tooltip","TooltipTrigger","HelpCircle","ArrowDown","ChevronSelectorVertical","useEffect","AriaRow","AriaCell","AriaTableBody"],"mappings":";;;;;;;;;;;;;;AAiCA;AACO,MAAM,uBAAuB,GAAG,OACrCA,eAAA,CAACC,iBAAQ,CAAC,IAAI,eACZC,cAAA,CAACD,iBAAQ,CAAC,UAAU,EAAA,EAAC,KAAK,EAAC,UAAU,EAAA,CAAG,EAExCC,eAACD,iBAAQ,CAAC,OAAO,EAAA,EAAC,SAAS,EAAC,OAAO,EAAA,QAAA,EACjCD,gBAACC,iBAAQ,CAAC,IAAI,EAAA,EAAA,QAAA,EAAA,CACZC,cAAA,CAACD,iBAAQ,CAAC,IAAI,IAAC,IAAI,EAAEE,cAAM,EAAA,QAAA,EACzBD,yBAAM,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,MAAA,EAAA,CAAY,EAAA,CACpB,EAChBA,cAAA,CAACD,iBAAQ,CAAC,IAAI,EAAA,EAAC,IAAI,EAAEG,cAAM,YACzBF,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,WAAA,EAAA,CAAiB,EAAA,CACzB,EAChBA,eAACD,iBAAQ,CAAC,IAAI,EAAA,EAAC,IAAI,EAAEI,eAAO,EAAA,QAAA,EAC1BH,yBAAM,SAAS,EAAC,MAAM,EAAA,QAAA,EAAA,QAAA,EAAA,CAAc,EAAA,CACtB,IACF,EAAA,CACC,CAAA,EAAA,CACL;AAW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B,EAAE,GAAGU,mCAAe,EAAE;AAE/C,IAAA,MAAM,IAAI,GAAG,QAAQ,IAAI,OAAO,CAAC,IAAI;IAErC,QACEhB,cAAA,CAAC+B,wBAAQ,EAAA,EAAA,GACH,KAAK,EACT,SAAS,EAAE,CAAC,KAAK,KACf1B,KAAE,CACA,6HAA6H,EAC7H,IAAI,KAAK,IAAI,IAAI,WAAW,EAC5B,IAAI,KAAK,IAAI,IAAI,WAAW,EAE5B,iBAAiB,KAAK,QAAQ,IAAI,YAAY,EAE9C,OAAO,SAAS,KAAK,UAAU,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,CAC/D,EAAA,QAAA,EAGF,QAAQ,EAAA,CACA;AAEf,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;AAEnC,MAAM,SAAS,GAAG;AAChB,IAAA,IAAI,EAAE,aAAa;AACnB,IAAA,MAAM,EAAE,eAAe;;AAGzB;;;;;;AAMG;AACH,MAAM,KAAK,GAAG;AAOd,KAAK,CAAC,IAAI,GAAG2B,6BAAa;AAC1B,KAAK,CAAC,IAAI,GAAG,SAAS;AACtB,KAAK,CAAC,IAAI,GAAG,SAAS;AACtB,KAAK,CAAC,MAAM,GAAG,WAAW;AAC1B,KAAK,CAAC,GAAG,GAAG,QAAQ;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, HTMLAttributes, ReactNode, Ref, TdHTMLAttributes, ThHTMLAttributes } from 'react';
|
|
2
|
-
import type { CellProps as AriaCellProps, ColumnProps as AriaColumnProps, RowProps as AriaRowProps, TableHeaderProps as AriaTableHeaderProps, TableProps as AriaTableProps } from 'react-aria-components';
|
|
2
|
+
import type { CellProps as AriaCellProps, ColumnProps as AriaColumnProps, RowProps as AriaRowProps, TableHeaderProps as AriaTableHeaderProps, TableProps as AriaTableProps, Key } from 'react-aria-components';
|
|
3
3
|
import { TableBody as AriaTableBody } from 'react-aria-components';
|
|
4
4
|
/** Row actions menu behind a dots button with fixed Edit, Copy link and Delete items, for use in a table's last column. */
|
|
5
5
|
export declare const TableRowActionsDropdown: () => import("react").JSX.Element;
|
|
@@ -18,6 +18,12 @@ interface TableCardHeaderProps {
|
|
|
18
18
|
interface TableRootProps extends AriaTableProps, Omit<ComponentPropsWithRef<'table'>, 'className' | 'slot' | 'style'> {
|
|
19
19
|
/** Row height and cell padding for every header, row and cell, unless one sets its own `size`. Inherits from `TableCard.Root`; `md` otherwise. */
|
|
20
20
|
size?: 'sm' | 'md';
|
|
21
|
+
/** With `selectionMode="single"`: the selected row's id, or `null` for none. Use instead of `selectedKeys`, not with it. */
|
|
22
|
+
selectedKey?: Key | null;
|
|
23
|
+
/** With `selectionMode="single"`: called with the selected row's id, or `null` when a second click clears it. */
|
|
24
|
+
onSelectedKeyChange?: (key: Key | null) => void;
|
|
25
|
+
/** With `selectionMode="multiple"`: called with the selected rows' ids; "select all" reports every selectable row, never `'all'`. */
|
|
26
|
+
onSelectedKeysChange?: (keys: Key[]) => void;
|
|
21
27
|
/**
|
|
22
28
|
* Overrides the root `data-testid`. Defaults to `fd-table`. Rows and columns derive
|
|
23
29
|
* structural testids from this prefix (e.g. `<root>--row-42`, `<root>--col-name`).
|
|
@@ -25,7 +31,7 @@ interface TableRootProps extends AriaTableProps, Omit<ComponentPropsWithRef<'tab
|
|
|
25
31
|
'data-testid'?: string;
|
|
26
32
|
}
|
|
27
33
|
declare const TableRoot: {
|
|
28
|
-
({ className, size: sizeProp, "data-testid": dataTestId, ...props }: TableRootProps): import("react").JSX.Element;
|
|
34
|
+
({ className, size: sizeProp, selectedKey, onSelectedKeyChange, onSelectedKeysChange, "data-testid": dataTestId, ...props }: TableRootProps): import("react").JSX.Element;
|
|
29
35
|
displayName: string;
|
|
30
36
|
};
|
|
31
37
|
interface TableHeaderProps<T extends object> extends AriaTableHeaderProps<T>, Omit<ComponentPropsWithRef<'thead'>, 'children' | 'className' | 'slot' | 'style'> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Table/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEvH,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACxB,gBAAgB,IAAI,oBAAoB,EACxC,UAAU,IAAI,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Table/index.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,SAAS,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEvH,OAAO,KAAK,EACV,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACxB,gBAAgB,IAAI,oBAAoB,EACxC,UAAU,IAAI,cAAc,EAC5B,GAAG,EAEJ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAOL,SAAS,IAAI,aAAa,EAG3B,MAAM,uBAAuB,CAAC;AAG/B,2HAA2H;AAC3H,eAAO,MAAM,uBAAuB,mCAkBnC,CAAC;AAuBF,UAAU,oBAAoB;IAC5B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gDAAgD;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoCD,UAAU,cAAe,SAAQ,cAAc,EAAE,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,W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
|
|
|
6
6
|
import { Dropdown } from '@flipdish/ui-library/components/molecules/Dropdown';
|
|
7
7
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
8
8
|
import { useResolvedTestId, joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
9
|
-
import { createContext, useContext, isValidElement } from 'react';
|
|
9
|
+
import { createContext, useContext, useRef, useCallback, isValidElement, useEffect } from 'react';
|
|
10
10
|
import { Table as Table$1, TableBody, useTableOptions, TableHeader as TableHeader$1, Column, Collection, Group, Row, Cell } from 'react-aria-components';
|
|
11
|
+
import { selectionOfKey, keyOfSelection, keysOfSelection } from './table.utils.js';
|
|
11
12
|
|
|
12
13
|
/** Row actions menu behind a dots button with fixed Edit, Copy link and Delete items, for use in a table's last column. */
|
|
13
14
|
const TableRowActionsDropdown = () => (jsxs(Dropdown.Root, { children: [jsx(Dropdown.DotsButton, { color: "tertiary" }), jsx(Dropdown.Popover, { className: "w-min", children: jsxs(Dropdown.Menu, { children: [jsx(Dropdown.Item, { icon: Edit01, children: jsx("span", { className: "pr-4", children: "Edit" }) }), jsx(Dropdown.Item, { icon: Copy01, children: jsx("span", { className: "pr-4", children: "Copy link" }) }), jsx(Dropdown.Item, { icon: Trash01, children: jsx("span", { className: "pr-4", children: "Delete" }) })] }) })] }));
|
|
@@ -19,14 +20,38 @@ const TableCardRoot = ({ children, className, size = 'md', ...props }) => {
|
|
|
19
20
|
/** Titled header for a table embedded in a dashboard or panel; page-level tables use `PageHeader` instead. */
|
|
20
21
|
const TableCardHeader = ({ title, badge, description, contentTrailing, className }) => {
|
|
21
22
|
const { size } = useContext(TableContext);
|
|
22
|
-
|
|
23
|
+
const renderBadge = () => {
|
|
24
|
+
if (!badge)
|
|
25
|
+
return null;
|
|
26
|
+
if (isValidElement(badge))
|
|
27
|
+
return badge;
|
|
28
|
+
return (jsx(Badge, { color: "gray", size: "sm", type: "modern", children: badge }));
|
|
29
|
+
};
|
|
30
|
+
return (jsxs("div", { className: cx('relative flex flex-col items-start gap-4 border-b border-secondary bg-primary px-4 md:flex-row', size === 'sm' ? 'py-4 md:px-5' : 'py-5 md:px-6', className), children: [jsxs("div", { className: "flex flex-1 flex-col gap-0.5", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("h2", { className: "text-md font-semibold text-primary", children: title }), renderBadge()] }), description && jsx("p", { className: "text-sm text-tertiary", children: description })] }), contentTrailing] }));
|
|
23
31
|
};
|
|
24
|
-
const TableRoot = ({ className, size: sizeProp, 'data-testid': dataTestId, ...props }) => {
|
|
32
|
+
const TableRoot = ({ className, size: sizeProp, selectedKey, onSelectedKeyChange, onSelectedKeysChange, 'data-testid': dataTestId, ...props }) => {
|
|
25
33
|
// Re-providing the context would otherwise reset a card-level `size` back to `md`.
|
|
26
34
|
const inherited = useContext(TableContext);
|
|
27
35
|
const size = sizeProp ?? inherited.size;
|
|
28
36
|
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'table', rootName: 'table' });
|
|
29
|
-
|
|
37
|
+
// react-aria reports "select all" as `'all'`; the rendered rows say which ids that covers, in mount order rather than display order.
|
|
38
|
+
const rowKeys = useRef(new Set());
|
|
39
|
+
const registerRow = useCallback((id) => {
|
|
40
|
+
rowKeys.current.add(id);
|
|
41
|
+
return () => {
|
|
42
|
+
rowKeys.current.delete(id);
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
const { onSelectionChange } = props;
|
|
46
|
+
const reportsSelection = onSelectionChange !== undefined || onSelectedKeyChange !== undefined || onSelectedKeysChange !== undefined;
|
|
47
|
+
const handleSelectionChange = (selection) => {
|
|
48
|
+
onSelectionChange?.(selection);
|
|
49
|
+
onSelectedKeyChange?.(keyOfSelection(selection));
|
|
50
|
+
onSelectedKeysChange?.(keysOfSelection(selection, rowKeys.current, props.disabledKeys));
|
|
51
|
+
};
|
|
52
|
+
return (
|
|
53
|
+
// A row cannot see the table-level `onRowAction`, so the context carries whether one exists.
|
|
54
|
+
jsx(TableContext.Provider, { value: { size, testIdPrefix: rootTestId, hasRowAction: props.onRowAction !== undefined, registerRow }, children: jsx("div", { className: "overflow-x-auto", children: jsx(Table$1, { "data-testid": rootTestId, className: (state) => cx('w-full overflow-x-hidden', typeof className === 'function' ? className(state) : className), ...props, selectedKeys: selectedKey !== undefined ? selectionOfKey(selectedKey) : props.selectedKeys, onSelectionChange: reportsSelection ? handleSelectionChange : undefined }) }) }));
|
|
30
55
|
};
|
|
31
56
|
TableRoot.displayName = 'Table';
|
|
32
57
|
const TableHeader = ({ columns, children, bordered = true, className, size: sizeProp, ...props }) => {
|
|
@@ -49,11 +74,16 @@ const TableHead = ({ className, tooltip, label, children, 'data-testid': dataTes
|
|
|
49
74
|
TableHead.displayName = 'TableHead';
|
|
50
75
|
const TableRow = ({ columns, children, className, highlightSelectedRow = true, size: sizeProp, 'data-testid': dataTestId, ...props }) => {
|
|
51
76
|
const context = useContext(TableContext);
|
|
52
|
-
const { selectionBehavior } = useTableOptions();
|
|
77
|
+
const { selectionBehavior, selectionMode } = useTableOptions();
|
|
53
78
|
const size = sizeProp ?? context.size;
|
|
79
|
+
// A click does something on the row itself: its own action or link, the table's row action, or selection by row.
|
|
80
|
+
const isInteractive = props.onAction !== undefined || props.href !== undefined || context.hasRowAction === true || selectionMode !== 'none';
|
|
54
81
|
const rowTestId = dataTestId ??
|
|
55
82
|
(context.testIdPrefix && props.id !== undefined ? joinTestId(context.testIdPrefix, `row-${slugifyTestId(String(props.id))}`) : undefined);
|
|
56
|
-
|
|
83
|
+
const { registerRow } = context;
|
|
84
|
+
const { id, isDisabled } = props;
|
|
85
|
+
useEffect(() => (id === undefined || isDisabled ? undefined : registerRow?.(id)), [registerRow, id, isDisabled]);
|
|
86
|
+
return (jsxs(Row, { ...props, "data-testid": rowTestId, className: (state) => cx('relative outline-focus-ring transition-colors after:pointer-events-none hover:bg-secondary focus-visible:outline-2 focus-visible:-outline-offset-2', size === 'sm' ? 'h-14' : 'h-18', highlightSelectedRow && 'selected:bg-secondary', isInteractive && (state.isDisabled ? 'cursor-default' : 'cursor-pointer'),
|
|
57
87
|
// Row border—using an "after" pseudo-element to avoid the border taking up space.
|
|
58
88
|
'[&>td]:after:absolute [&>td]:after:inset-x-0 [&>td]:after:bottom-0 [&>td]:after:h-px [&>td]:after:w-full [&>td]:after:bg-border-secondary last:[&>td]:after:hidden [&>td]:focus-visible:after:opacity-0 focus-visible:[&>td]:after:opacity-0', typeof className === 'function' ? className(state) : className), children: [selectionBehavior === 'toggle' && (jsx(Cell, { className: cx('relative py-2 pr-0 pl-4', size === 'sm' ? 'md:pl-5' : 'md:pl-6'), children: jsx("div", { className: "flex items-end", children: jsx(Checkbox, { slot: "selection", size: "md", "data-testid": rowTestId ? joinTestId(rowTestId, 'selection') : undefined }) }) })), jsx(Collection, { items: columns, children: children })] }));
|
|
59
89
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaTable","AriaTableHeader","AriaColumn","AriaCollection","AriaGroup","AriaRow","AriaCell","AriaTableBody"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/Table/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","AriaTable","AriaTableHeader","AriaColumn","AriaCollection","AriaGroup","AriaRow","AriaCell","AriaTableBody"],"mappings":";;;;;;;;;;;;AAiCA;AACO,MAAM,uBAAuB,GAAG,OACrCA,IAAA,CAAC,QAAQ,CAAC,IAAI,eACZC,GAAA,CAAC,QAAQ,CAAC,UAAU,EAAA,EAAC,KAAK,EAAC,UAAU,EAAA,CAAG,EAExCA,IAAC,QAAQ,CAAC,OAAO,EAAA,EAAC,SAAS,EAAC,OAAO,EAAA,QAAA,EACjCD,KAAC,QAAQ,CAAC,IAAI,EAAA,EAAA,QAAA,EAAA,CACZC,GAAA,CAAC,QAAQ,CAAC,IAAI,IAAC,IAAI,EAAE,MAAM,EA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.
|
|
5
|
+
* @param key - The selected row's id, or `null` for none.
|
|
6
|
+
* @returns A selection holding that one key, or an empty one.
|
|
7
|
+
*/
|
|
8
|
+
const selectionOfKey = (key) => new Set(key === null ? [] : [key]);
|
|
9
|
+
/**
|
|
10
|
+
* Reads the one selected key out of a selection, for a single-select table.
|
|
11
|
+
* @param selection - What react-aria reports; a single-select table never reports `'all'`.
|
|
12
|
+
* @returns The selected row's id, or `null` when nothing is selected, as after a second click on the selected row.
|
|
13
|
+
*/
|
|
14
|
+
const keyOfSelection = (selection) => {
|
|
15
|
+
if (selection === 'all')
|
|
16
|
+
return null;
|
|
17
|
+
const [first] = selection;
|
|
18
|
+
return first ?? null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Lists the selected keys of a multiple-select table, resolving "select all" into the rows it covers.
|
|
22
|
+
* @param selection - What react-aria reports, `'all'` after the header checkbox.
|
|
23
|
+
* @param rowKeys - Every rendered row's id, in the order the rows mounted, which is the display order until rows are reordered in place.
|
|
24
|
+
* @param disabledKeys - Rows that cannot be selected, which "select all" leaves out.
|
|
25
|
+
* @returns The selected rows' ids.
|
|
26
|
+
*/
|
|
27
|
+
const keysOfSelection = (selection, rowKeys, disabledKeys = []) => {
|
|
28
|
+
if (selection !== 'all')
|
|
29
|
+
return [...selection];
|
|
30
|
+
const disabled = new Set(disabledKeys);
|
|
31
|
+
return [...rowKeys].filter((key) => !disabled.has(key));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.keyOfSelection = keyOfSelection;
|
|
35
|
+
exports.keysOfSelection = keysOfSelection;
|
|
36
|
+
exports.selectionOfKey = selectionOfKey;
|
|
37
|
+
//# sourceMappingURL=table.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.utils.cjs","sources":["../../../../src/components/organisms/Table/table.utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAe,KAAgB,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;AAE/F;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,SAAoB,KAAgB;IACjE,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,IAAI;AACpC,IAAA,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;IACzB,OAAO,KAAK,IAAI,IAAI;AACtB;AAEA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAE,OAAsB,EAAE,YAAA,GAA8B,EAAE,KAAW;IACvH,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,CAAC,GAAG,SAAS,CAAC;AAC9C,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC;IACtC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Key, Selection } from 'react-aria-components';
|
|
2
|
+
/**
|
|
3
|
+
* Turns a single selected key into the selection react-aria expects.
|
|
4
|
+
* @param key - The selected row's id, or `null` for none.
|
|
5
|
+
* @returns A selection holding that one key, or an empty one.
|
|
6
|
+
*/
|
|
7
|
+
export declare const selectionOfKey: (key: Key | null) => Selection;
|
|
8
|
+
/**
|
|
9
|
+
* Reads the one selected key out of a selection, for a single-select table.
|
|
10
|
+
* @param selection - What react-aria reports; a single-select table never reports `'all'`.
|
|
11
|
+
* @returns The selected row's id, or `null` when nothing is selected, as after a second click on the selected row.
|
|
12
|
+
*/
|
|
13
|
+
export declare const keyOfSelection: (selection: Selection) => Key | null;
|
|
14
|
+
/**
|
|
15
|
+
* Lists the selected keys of a multiple-select table, resolving "select all" into the rows it covers.
|
|
16
|
+
* @param selection - What react-aria reports, `'all'` after the header checkbox.
|
|
17
|
+
* @param rowKeys - Every rendered row's id, in the order the rows mounted, which is the display order until rows are reordered in place.
|
|
18
|
+
* @param disabledKeys - Rows that cannot be selected, which "select all" leaves out.
|
|
19
|
+
* @returns The selected rows' ids.
|
|
20
|
+
*/
|
|
21
|
+
export declare const keysOfSelection: (selection: Selection, rowKeys: Iterable<Key>, disabledKeys?: Iterable<Key>) => Key[];
|
|
22
|
+
//# sourceMappingURL=table.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/Table/table.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,GAAG,GAAG,IAAI,KAAG,SAA+C,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,WAAW,SAAS,KAAG,GAAG,GAAG,IAI3D,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,WAAW,SAAS,EAAE,SAAS,QAAQ,CAAC,GAAG,CAAC,EAAE,eAAc,QAAQ,CAAC,GAAG,CAAM,KAAG,GAAG,EAInH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns a single selected key into the selection react-aria expects.
|
|
3
|
+
* @param key - The selected row's id, or `null` for none.
|
|
4
|
+
* @returns A selection holding that one key, or an empty one.
|
|
5
|
+
*/
|
|
6
|
+
const selectionOfKey = (key) => new Set(key === null ? [] : [key]);
|
|
7
|
+
/**
|
|
8
|
+
* Reads the one selected key out of a selection, for a single-select table.
|
|
9
|
+
* @param selection - What react-aria reports; a single-select table never reports `'all'`.
|
|
10
|
+
* @returns The selected row's id, or `null` when nothing is selected, as after a second click on the selected row.
|
|
11
|
+
*/
|
|
12
|
+
const keyOfSelection = (selection) => {
|
|
13
|
+
if (selection === 'all')
|
|
14
|
+
return null;
|
|
15
|
+
const [first] = selection;
|
|
16
|
+
return first ?? null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Lists the selected keys of a multiple-select table, resolving "select all" into the rows it covers.
|
|
20
|
+
* @param selection - What react-aria reports, `'all'` after the header checkbox.
|
|
21
|
+
* @param rowKeys - Every rendered row's id, in the order the rows mounted, which is the display order until rows are reordered in place.
|
|
22
|
+
* @param disabledKeys - Rows that cannot be selected, which "select all" leaves out.
|
|
23
|
+
* @returns The selected rows' ids.
|
|
24
|
+
*/
|
|
25
|
+
const keysOfSelection = (selection, rowKeys, disabledKeys = []) => {
|
|
26
|
+
if (selection !== 'all')
|
|
27
|
+
return [...selection];
|
|
28
|
+
const disabled = new Set(disabledKeys);
|
|
29
|
+
return [...rowKeys].filter((key) => !disabled.has(key));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export { keyOfSelection, keysOfSelection, selectionOfKey };
|
|
33
|
+
//# sourceMappingURL=table.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.utils.js","sources":["../../../../src/components/organisms/Table/table.utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,GAAe,KAAgB,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC;AAE/F;;;;AAIG;AACI,MAAM,cAAc,GAAG,CAAC,SAAoB,KAAgB;IACjE,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,IAAI;AACpC,IAAA,MAAM,CAAC,KAAK,CAAC,GAAG,SAAS;IACzB,OAAO,KAAK,IAAI,IAAI;AACtB;AAEA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,CAAC,SAAoB,EAAE,OAAsB,EAAE,YAAA,GAA8B,EAAE,KAAW;IACvH,IAAI,SAAS,KAAK,KAAK;AAAE,QAAA,OAAO,CAAC,GAAG,SAAS,CAAC;AAC9C,IAAA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC;IACtC,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACzD;;"}
|
|
@@ -26,11 +26,11 @@ const TreeViewRoot = ({ size = 'sm', showConnectors = false, draggable = false,
|
|
|
26
26
|
const treeRef = React.useRef(null);
|
|
27
27
|
const collectionRef = React.useRef(null);
|
|
28
28
|
/* Cascading selection state */
|
|
29
|
-
const [internalSelectedKeys, setInternalSelectedKeys] = React.useState(() =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = React.useState(() => {
|
|
30
|
+
if (defaultSelectedKeys === 'all')
|
|
31
|
+
return 'all';
|
|
32
|
+
return new Set(defaultSelectedKeys ?? []);
|
|
33
|
+
});
|
|
34
34
|
/*
|
|
35
35
|
* Tracks the previous selection so we can diff against it in handleSelectionChange.
|
|
36
36
|
* React Aria's onSelectionChange provides the full new selection set, not a diff.
|
|
@@ -121,6 +121,14 @@ const TreeViewItem = ({ className, ...props }) => {
|
|
|
121
121
|
const TreeViewItemContent = ({ icon: Icon, action, children, className }) => {
|
|
122
122
|
const { size, showConnectors, selectedKeys: ctxSelectedKeys, collectionRef } = React.useContext(TreeViewContext);
|
|
123
123
|
const prefix = testIdUtils.useTestIdPrefix();
|
|
124
|
+
// Only a component or an element renders; a falsy non-element such as a `0` from `count && <Icon />` renders nothing, not "0".
|
|
125
|
+
const renderIcon = () => {
|
|
126
|
+
if (componentGuard_utils.isReactComponent(Icon))
|
|
127
|
+
return jsxRuntime.jsx(Icon, { className: cx.cx('shrink-0 text-fg-quaternary', size === 'sm' ? 'size-4' : 'size-5') });
|
|
128
|
+
if (React.isValidElement(Icon))
|
|
129
|
+
return Icon;
|
|
130
|
+
return null;
|
|
131
|
+
};
|
|
124
132
|
return (jsxRuntime.jsx(reactAriaComponents.TreeItemContent, { children: (state) => {
|
|
125
133
|
const { id: itemKey, state: itemState, hasChildItems, isExpanded, isSelected, isDisabled, selectionMode, isFocusVisible, allowsDragging, isDropTarget, level, } = state;
|
|
126
134
|
const collection = itemState.collection;
|
|
@@ -150,8 +158,7 @@ const TreeViewItemContent = ({ icon: Icon, action, children, className }) => {
|
|
|
150
158
|
? treeView_utils.getTreeConnectors(itemKey, level, collection).map(({ depth, type }) => jsxRuntime.jsx(Connector, { size: size, type: type }, depth))
|
|
151
159
|
: [];
|
|
152
160
|
const paddingLeft = showConnectors && level > 1 ? BASE_PADDING : BASE_PADDING + (level - 1) * INDENT_SIZE;
|
|
153
|
-
return (jsxRuntime.jsxs("div", { className: cx.cx('flex w-full cursor-pointer items-center gap-2 rounded-sm -outline-offset-2 outline-focus-ring transition duration-100 ease-linear', size === 'sm' ? 'py-1.5 pr-2' : 'py-2 pr-2', isDropTarget && 'bg-secondary_hover outline-2', !isDropTarget && (isSelected || isIndeterminate) && 'bg-secondary hover:bg-secondary_hover', !isDropTarget && !isSelected && !isIndeterminate && 'hover:bg-primary_hover', isDisabled && 'cursor-not-allowed opacity-50', isFocusVisible && 'outline-2', className), style: { paddingLeft }, children: [connectors, hasChildItems && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "chevron", "data-testid": chevronTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: isExpanded ? jsxRuntime.jsx(uiIcons.ChevronDown, { className: "size-4 text-fg-quaternary" }) : jsxRuntime.jsx(uiIcons.ChevronRight, { className: "size-4 text-fg-quaternary" }) })), selectionMode !== 'none' && (jsxRuntime.jsx(reactAriaComponents.Checkbox, { slot: "selection", "data-testid": checkboxTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: ({ isSelected: checkSelected, isDisabled: checkDisabled, isFocusVisible: checkFocus }) => (jsxRuntime.jsx(Checkbox.CheckboxBase, { size: "sm", isSelected: checkSelected || isIndeterminate, isIndeterminate: isIndeterminate, isDisabled: checkDisabled, isFocusVisible: checkFocus })) })), jsxRuntime.jsxs("div", { className: cx.cx('flex min-w-0 flex-1 items-center', size === 'sm' ? 'gap-1.5' : 'gap-2'), children: [
|
|
154
|
-
(componentGuard_utils.isReactComponent(Icon) ? (jsxRuntime.jsx(Icon, { className: cx.cx('shrink-0 text-fg-quaternary', size === 'sm' ? 'size-4' : 'size-5') })) : React.isValidElement(Icon) ? (Icon) : null), jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-tertiary", children: children }), action && (jsxRuntime.jsx("span", { "data-testid": actionTestId, className: "contents", children: action })), allowsDragging && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "drag", "data-testid": dragTestId, className: cx.cx('shrink-0 cursor-grab outline-hidden', !isSelected && 'hidden'), children: jsxRuntime.jsx(uiIcons.DotsGrid, { className: "size-4 text-fg-quaternary" }) }))] })] }));
|
|
161
|
+
return (jsxRuntime.jsxs("div", { className: cx.cx('flex w-full cursor-pointer items-center gap-2 rounded-sm -outline-offset-2 outline-focus-ring transition duration-100 ease-linear', size === 'sm' ? 'py-1.5 pr-2' : 'py-2 pr-2', isDropTarget && 'bg-secondary_hover outline-2', !isDropTarget && (isSelected || isIndeterminate) && 'bg-secondary hover:bg-secondary_hover', !isDropTarget && !isSelected && !isIndeterminate && 'hover:bg-primary_hover', isDisabled && 'cursor-not-allowed opacity-50', isFocusVisible && 'outline-2', className), style: { paddingLeft }, children: [connectors, hasChildItems && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "chevron", "data-testid": chevronTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: isExpanded ? jsxRuntime.jsx(uiIcons.ChevronDown, { className: "size-4 text-fg-quaternary" }) : jsxRuntime.jsx(uiIcons.ChevronRight, { className: "size-4 text-fg-quaternary" }) })), selectionMode !== 'none' && (jsxRuntime.jsx(reactAriaComponents.Checkbox, { slot: "selection", "data-testid": checkboxTestId, className: "flex shrink-0 items-center justify-center outline-hidden", children: ({ isSelected: checkSelected, isDisabled: checkDisabled, isFocusVisible: checkFocus }) => (jsxRuntime.jsx(Checkbox.CheckboxBase, { size: "sm", isSelected: checkSelected || isIndeterminate, isIndeterminate: isIndeterminate, isDisabled: checkDisabled, isFocusVisible: checkFocus })) })), jsxRuntime.jsxs("div", { className: cx.cx('flex min-w-0 flex-1 items-center', size === 'sm' ? 'gap-1.5' : 'gap-2'), children: [renderIcon(), jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-semibold text-tertiary", children: children }), action && (jsxRuntime.jsx("span", { "data-testid": actionTestId, className: "contents", children: action })), allowsDragging && (jsxRuntime.jsx(reactAriaComponents.Button, { slot: "drag", "data-testid": dragTestId, className: cx.cx('shrink-0 cursor-grab outline-hidden', !isSelected && 'hidden'), children: jsxRuntime.jsx(uiIcons.DotsGrid, { className: "size-4 text-fg-quaternary" }) }))] })] }));
|
|
155
162
|
} }));
|
|
156
163
|
};
|
|
157
164
|
/**
|