@flipdish/ui-library 0.42.0 → 0.43.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/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/index.cjs +8 -1
- package/dist/components/molecules/Tags/index.cjs.map +1 -1
- package/dist/components/molecules/Tags/index.d.ts.map +1 -1
- package/dist/components/molecules/Tags/index.js +8 -1
- 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/SidebarNavigation/hooks/useDualTierKeyboard.cjs +5 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierKeyboard.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierKeyboard.d.ts +7 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierKeyboard.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierKeyboard.js +5 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierKeyboard.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.cjs +5 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.d.ts +5 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.js +5 -3
- package/dist/components/organisms/SidebarNavigation/hooks/useDualTierReveal.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs +11 -3
- package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.js +12 -4
- package/dist/components/organisms/SidebarNavigation/index.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/molecules/Tags/index.d.ts.map +1 -1
- package/dist/native/components/molecules/Tags/index.js +8 -1
- package/dist/native/components/molecules/Tags/index.js.map +1 -1
- 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/providers/UIProvider/hooks/usePortalAnchor.cjs +10 -9
- package/dist/providers/UIProvider/hooks/usePortalAnchor.cjs.map +1 -1
- package/dist/providers/UIProvider/hooks/usePortalAnchor.d.ts +5 -4
- package/dist/providers/UIProvider/hooks/usePortalAnchor.d.ts.map +1 -1
- package/dist/providers/UIProvider/hooks/usePortalAnchor.js +10 -9
- package/dist/providers/UIProvider/hooks/usePortalAnchor.js.map +1 -1
- 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 +3 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Delays a callback until calls stop for `delay` milliseconds, so only the last of a burst runs, such as a search request
|
|
7
|
+
* after typing pauses. The returned function keeps its identity across renders and always calls the latest `callback`.
|
|
8
|
+
*
|
|
9
|
+
* @param callback - What to run with the last call's arguments once the calls stop.
|
|
10
|
+
* @param delay - How long the calls must stop for, in milliseconds.
|
|
11
|
+
* @returns The debounced function, with `flush` to run the pending call at once and `cancel` to drop it. A pending call is
|
|
12
|
+
* dropped on unmount.
|
|
13
|
+
*/
|
|
14
|
+
const useDebouncedCallback = (callback, delay = 300) => {
|
|
15
|
+
const callbackRef = React.useRef(callback);
|
|
16
|
+
callbackRef.current = callback;
|
|
17
|
+
const delayRef = React.useRef(delay);
|
|
18
|
+
delayRef.current = delay;
|
|
19
|
+
const timer = React.useRef(undefined);
|
|
20
|
+
const pending = React.useRef(undefined);
|
|
21
|
+
const debounced = React.useMemo(() => {
|
|
22
|
+
const cancel = () => {
|
|
23
|
+
clearTimeout(timer.current);
|
|
24
|
+
timer.current = undefined;
|
|
25
|
+
pending.current = undefined;
|
|
26
|
+
};
|
|
27
|
+
const flush = () => {
|
|
28
|
+
const args = pending.current;
|
|
29
|
+
cancel();
|
|
30
|
+
if (args)
|
|
31
|
+
callbackRef.current(...args);
|
|
32
|
+
};
|
|
33
|
+
const call = (...args) => {
|
|
34
|
+
pending.current = args;
|
|
35
|
+
clearTimeout(timer.current);
|
|
36
|
+
timer.current = setTimeout(flush, delayRef.current);
|
|
37
|
+
};
|
|
38
|
+
return Object.assign(call, { flush, cancel });
|
|
39
|
+
}, []);
|
|
40
|
+
React.useEffect(() => debounced.cancel, [debounced]);
|
|
41
|
+
return debounced;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.useDebouncedCallback = useDebouncedCallback;
|
|
45
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useDebouncedCallback/index.ts"],"sourcesContent":[null],"names":["useRef","useMemo","useEffect"],"mappings":";;;;AAUA;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAyB,QAAiC,EAAE,KAAK,GAAG,GAAG,KAA6B;A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@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The debounced function, plus controls for the call it is holding back. */
|
|
2
|
+
export type DebouncedCallback<Args extends unknown[]> = ((...args: Args) => void) & {
|
|
3
|
+
/** Runs the pending call now, if there is one. */
|
|
4
|
+
flush: () => void;
|
|
5
|
+
/** Drops the pending call. */
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Delays a callback until calls stop for `delay` milliseconds, so only the last of a burst runs, such as a search request
|
|
10
|
+
* after typing pauses. The returned function keeps its identity across renders and always calls the latest `callback`.
|
|
11
|
+
*
|
|
12
|
+
* @param callback - What to run with the last call's arguments once the calls stop.
|
|
13
|
+
* @param delay - How long the calls must stop for, in milliseconds.
|
|
14
|
+
* @returns The debounced function, with `flush` to run the pending call at once and `cancel` to drop it. A pending call is
|
|
15
|
+
* dropped on unmount.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useDebouncedCallback: <Args extends unknown[]>(callback: (...args: Args) => void, delay?: number) => DebouncedCallback<Args>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDebouncedCallback/index.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,GAAG;IAClF,kDAAkD;IAClD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,OAAO,EAAE,EAAE,UAAU,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EAAE,cAAW,KAAG,iBAAiB,CAAC,IAAI,CA8BnI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delays a callback until calls stop for `delay` milliseconds, so only the last of a burst runs, such as a search request
|
|
5
|
+
* after typing pauses. The returned function keeps its identity across renders and always calls the latest `callback`.
|
|
6
|
+
*
|
|
7
|
+
* @param callback - What to run with the last call's arguments once the calls stop.
|
|
8
|
+
* @param delay - How long the calls must stop for, in milliseconds.
|
|
9
|
+
* @returns The debounced function, with `flush` to run the pending call at once and `cancel` to drop it. A pending call is
|
|
10
|
+
* dropped on unmount.
|
|
11
|
+
*/
|
|
12
|
+
const useDebouncedCallback = (callback, delay = 300) => {
|
|
13
|
+
const callbackRef = useRef(callback);
|
|
14
|
+
callbackRef.current = callback;
|
|
15
|
+
const delayRef = useRef(delay);
|
|
16
|
+
delayRef.current = delay;
|
|
17
|
+
const timer = useRef(undefined);
|
|
18
|
+
const pending = useRef(undefined);
|
|
19
|
+
const debounced = useMemo(() => {
|
|
20
|
+
const cancel = () => {
|
|
21
|
+
clearTimeout(timer.current);
|
|
22
|
+
timer.current = undefined;
|
|
23
|
+
pending.current = undefined;
|
|
24
|
+
};
|
|
25
|
+
const flush = () => {
|
|
26
|
+
const args = pending.current;
|
|
27
|
+
cancel();
|
|
28
|
+
if (args)
|
|
29
|
+
callbackRef.current(...args);
|
|
30
|
+
};
|
|
31
|
+
const call = (...args) => {
|
|
32
|
+
pending.current = args;
|
|
33
|
+
clearTimeout(timer.current);
|
|
34
|
+
timer.current = setTimeout(flush, delayRef.current);
|
|
35
|
+
};
|
|
36
|
+
return Object.assign(call, { flush, cancel });
|
|
37
|
+
}, []);
|
|
38
|
+
useEffect(() => debounced.cancel, [debounced]);
|
|
39
|
+
return debounced;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { useDebouncedCallback };
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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MAAM,EAAE,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,SAAS,CAAC,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;AAE9C,IAAA,OAAO,SAAS;AAClB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Checkbox/index.native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uFAAuF;IACvF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2GAA2G;IAC3G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,2KAYtB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/atoms/Checkbox/index.native.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAMjD,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,mEAAmE;IACnE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oEAAoE;IACpE,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oDAAoD;IACpD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uFAAuF;IACvF,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2GAA2G;IAC3G,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,2KAYtB,aAAa,gCAyCf,CAAC"}
|
|
@@ -32,7 +32,7 @@ const Checkbox = ({ label, hint, size = 'sm', className, isSelected: isSelectedP
|
|
|
32
32
|
setUncontrolledSelected(next);
|
|
33
33
|
onChange?.(next);
|
|
34
34
|
};
|
|
35
|
-
return (jsxs(Pressable, { testID: checkboxTestId, disabled: isDisabled, onPress: handlePress, accessibilityRole: "checkbox", hitSlop: SELECTION_CONTROL_HIT_SLOP, accessibilityLabel: getAccessibleName(ariaLabel, label), accessibilityHint: getAccessibleHint(hint), accessibilityState: { checked: isIndeterminate ? 'mixed' : isSelected, disabled: Boolean(isDisabled) }, className: cx('relative flex flex-row items-start self-start', selectionControlSizes[size].root, className), children: [
|
|
35
|
+
return (jsxs(Pressable, { testID: checkboxTestId, disabled: isDisabled, onPress: handlePress, accessibilityRole: "checkbox", hitSlop: SELECTION_CONTROL_HIT_SLOP, accessibilityLabel: getAccessibleName(ariaLabel, label), accessibilityHint: getAccessibleHint(hint), accessibilityState: { checked: isIndeterminate ? 'mixed' : isSelected, disabled: Boolean(isDisabled) }, className: cx('relative flex flex-row items-start self-start', selectionControlSizes[size].root, className), children: [jsxs(View, { className: cx('size-4 shrink-0 items-center justify-center rounded border border-primary bg-primary', size === 'md' && 'size-5 rounded-md', isFilled && 'border-brand-solid bg-brand-solid', isDisabled && 'opacity-50', isDisabled && !isFilled && 'bg-tertiary', (label || hint) && 'mt-0.5'), children: [isIndeterminate && jsx(Minus, { size: DASH_SIZE[size], color: GLYPH_COLOR, strokeWidth: GLYPH_STROKE }), !isIndeterminate && isSelected && jsx(Check, { size: CHECK_SIZE[size], color: GLYPH_COLOR, strokeWidth: GLYPH_STROKE })] }), jsx(SelectionControlText, { size: size, label: label, hint: hint })] }));
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export { Checkbox };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/components/atoms/Checkbox/index.native.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAkCA;AACA,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC;AAC3B,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW;AAC9C,MAAM,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW;AAC7C;AACA,MAAM,WAAW,GAAG,SAAS;AAE7B;;;;;;AAMG;AACI,MAAM,QAAQ,GAAG,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,SAAS,EACT,UAAU,EAAE,cAAc,EAC1B,eAAe,GAAG,KAAK,EACvB,eAAe,EACf,UAAU,EACV,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,UAAU,GACX,KAAI;AAClB,IAAA,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC3G,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAC,eAAe,CAAC;AACjF,IAAA,MAAM,UAAU,GAAG,cAAc,IAAI,oBAAoB;AACzD,IAAA,MAAM,QAAQ,GAAG,UAAU,IAAI,eAAe;IAE9C,MAAM,WAAW,GAAG,MAAK;AACvB,QAAA,MAAM,IAAI,GAAG,CAAC,UAAU;QACxB,IAAI,cAAc,KAAK,SAAS;YAAE,uBAAuB,CAAC,IAAI,CAAC;AAC/D,QAAA,QAAQ,GAAG,IAAI,CAAC;AAClB,IAAA,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/components/atoms/Checkbox/index.native.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AAkCA;AACA,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC;AAC3B,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW;AAC9C,MAAM,SAAS,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAW;AAC7C;AACA,MAAM,WAAW,GAAG,SAAS;AAE7B;;;;;;AAMG;AACI,MAAM,QAAQ,GAAG,CAAC,EACvB,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,SAAS,EACT,UAAU,EAAE,cAAc,EAC1B,eAAe,GAAG,KAAK,EACvB,eAAe,EACf,UAAU,EACV,QAAQ,EACR,YAAY,EAAE,SAAS,EACvB,aAAa,EAAE,UAAU,GACX,KAAI;AAClB,IAAA,MAAM,cAAc,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAC3G,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAA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C3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,GAAI,qIAYjB,QAAQ,gCA8GV,CAAC"}
|
|
@@ -82,7 +82,14 @@ const Tag = ({ id, avatarSrc, avatarContrastBorder = true, dot, dotColor = 'fg-s
|
|
|
82
82
|
const inSelectionGroup = context.selectionMode !== 'none';
|
|
83
83
|
const sizeStyles = styles.sizes[context.size];
|
|
84
84
|
const [closePressed, setClosePressed] = useState(false);
|
|
85
|
-
const
|
|
85
|
+
const renderLeadingContent = () => {
|
|
86
|
+
if (avatarSrc)
|
|
87
|
+
return jsx(TagAvatar, { src: avatarSrc, alt: "Avatar", contrastBorder: avatarContrastBorder });
|
|
88
|
+
if (dot)
|
|
89
|
+
return jsx(Dot, { color: dotColor, size: "sm" });
|
|
90
|
+
return null;
|
|
91
|
+
};
|
|
92
|
+
const leadingContent = renderLeadingContent();
|
|
86
93
|
const labelNode = typeof children === 'string' || typeof children === 'number' ? (jsx(Text, { style: { color: styles.native.labelColor, fontWeight: '500', ...styles.native.labelText[context.size] }, children: children })) : (children);
|
|
87
94
|
const body = (jsxs(Fragment, { children: [jsxs(View, { className: cx('flex flex-row items-center gap-1', sizeStyles.content), children: [context.selectionMode !== 'none' && (jsx(View, { className: cx('items-center justify-center rounded border border-primary bg-primary', styles.checkbox[context.size].root, isSelected && 'border-brand-solid bg-brand-solid', isDisabled && 'opacity-50', isDisabled && !isSelected && 'bg-tertiary'), children: isSelected ? (jsx(Check, { size: styles.native.checkIconSize[context.size], color: styles.native.checkColor, strokeWidth: CHECK_STROKE })) : null })), leadingContent, labelNode, typeof count === 'number' && (jsx(View, { className: cx(styles.count, sizeStyles.count), children: jsx(Text, { style: { color: styles.native.labelColor, fontWeight: '500', ...styles.native.countText[context.size] }, children: count }) }))] }), onClose && (jsx(Pressable, { testID: closeTestId, accessibilityRole: "button", accessibilityLabel: "Remove this tag", disabled: isDisabled, hitSlop: CLOSE_HIT_SLOP, onPress: () => onClose(String(id)), onPressIn: () => setClosePressed(true), onPressOut: () => setClosePressed(false), className: cx('items-center justify-center rounded-[3px]', styles.close[context.size].root, closePressed && 'bg-primary_hover'), children: jsx(X, { size: styles.native.closeIconSize[context.size], color: closePressed ? styles.native.closeIconColorPressed : styles.native.closeIconColor, strokeWidth: styles.native.closeIconStroke[context.size] }) }))] }));
|
|
88
95
|
const rootClassName = cx(styles.rootNative, sizeStyles.root.base, avatarSrc && sizeStyles.root.withAvatar, onClose && sizeStyles.root.withClose, dot && sizeStyles.root.withDot, typeof count === 'number' && sizeStyles.root.withCount, inSelectionGroup && sizeStyles.root.withCheckbox, className);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/components/molecules/Tags/index.native.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment","XClose"],"mappings":";;;;;;;;;AAQA;AACA,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;AA4BtD,MAAM,eAAe,GAAG,aAAa,CAAuB;AAC1D,IAAA,aAAa,EAAE,MAAM;AACrB,IAAA,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,IAAI,GAAG,EAAE;AACvB,IAAA,MAAM,EAAE,MAAM,SAAS;AACxB,CAAA,CAAC;AAaF;;;;;AAKG;AACI,MAAM,SAAS,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,cAAc,GAAG,IAAI,EAAE,SAAS,EAAkB,KAAI;IAC1F,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AAC/C,IAAA,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU;IAErC,QACEA,GAAA,CAAC,IAAI,EAAA,EACH,SAAS,EAAE,EAAE,CAAC,MAAM,C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AS,CAAC,EAAA,QAAA,EAAG,QAAQ,EAAA;AAgB5I;AACA,MAAM,YAAY,GAAG,EAAE,GAAG,CAAC;AAE3B;;;;;;AAMG;AACI,MAAM,GAAG,GAAG,CAAC,EAClB,EAAE,EACF,SAAS,EACT,oBAAoB,GAAG,IAAI,EAC3B,GAAG,EACH,QAAQ,GAAG,sBAAsB,EACjC,UAAU,EACV,KAAK,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,aAAa,EAAE,UAAU,GAChB,KAAI;AACb,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,CAAC;AAC3C,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,SAAS,GAAG,UAAU,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,CAAA,IAAA,EAAO,MAAM,CAAA,CAAE,CAAC,GAAG,SAAS,CAAC;AAC1F,IAAA,MAAM,WAAW,GAAG,SAAS,GAAG,CAAA,EAAG,SAAS,CAAA,MAAA,CAAQ,GAAG,SAAS;IAEhE,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/C,IAAA,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,KAAK,MAAM;IACzD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;IAC7C,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEvD,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/components/molecules/Tags/index.native.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","_Fragment","XClose"],"mappings":";;;;;;;;;AAQA;AACA,MAAM,cAAc,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,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AAI,EAAA,EAAC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,aAAa,EAAA,QAAA,EACrG,IAAI,EAAA,CACA;AAEX;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The debounced function, plus controls for the call it is holding back. */
|
|
2
|
+
export type DebouncedCallback<Args extends unknown[]> = ((...args: Args) => void) & {
|
|
3
|
+
/** Runs the pending call now, if there is one. */
|
|
4
|
+
flush: () => void;
|
|
5
|
+
/** Drops the pending call. */
|
|
6
|
+
cancel: () => void;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Delays a callback until calls stop for `delay` milliseconds, so only the last of a burst runs, such as a search request
|
|
10
|
+
* after typing pauses. The returned function keeps its identity across renders and always calls the latest `callback`.
|
|
11
|
+
*
|
|
12
|
+
* @param callback - What to run with the last call's arguments once the calls stop.
|
|
13
|
+
* @param delay - How long the calls must stop for, in milliseconds.
|
|
14
|
+
* @returns The debounced function, with `flush` to run the pending call at once and `cancel` to drop it. A pending call is
|
|
15
|
+
* dropped on unmount.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useDebouncedCallback: <Args extends unknown[]>(callback: (...args: Args) => void, delay?: number) => DebouncedCallback<Args>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useDebouncedCallback/index.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,CAAC,IAAI,SAAS,OAAO,EAAE,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC,GAAG;IAClF,kDAAkD;IAClD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,OAAO,EAAE,EAAE,UAAU,CAAC,GAAG,IAAI,EAAE,IAAI,KAAK,IAAI,EAAE,cAAW,KAAG,iBAAiB,CAAC,IAAI,CA8BnI,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useRef, useMemo, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Delays a callback until calls stop for `delay` milliseconds, so only the last of a burst runs, such as a search request
|
|
5
|
+
* after typing pauses. The returned function keeps its identity across renders and always calls the latest `callback`.
|
|
6
|
+
*
|
|
7
|
+
* @param callback - What to run with the last call's arguments once the calls stop.
|
|
8
|
+
* @param delay - How long the calls must stop for, in milliseconds.
|
|
9
|
+
* @returns The debounced function, with `flush` to run the pending call at once and `cancel` to drop it. A pending call is
|
|
10
|
+
* dropped on unmount.
|
|
11
|
+
*/
|
|
12
|
+
const useDebouncedCallback = (callback, delay = 300) => {
|
|
13
|
+
const callbackRef = useRef(callback);
|
|
14
|
+
callbackRef.current = callback;
|
|
15
|
+
const delayRef = useRef(delay);
|
|
16
|
+
delayRef.current = delay;
|
|
17
|
+
const timer = useRef(undefined);
|
|
18
|
+
const pending = useRef(undefined);
|
|
19
|
+
const debounced = useMemo(() => {
|
|
20
|
+
const cancel = () => {
|
|
21
|
+
clearTimeout(timer.current);
|
|
22
|
+
timer.current = undefined;
|
|
23
|
+
pending.current = undefined;
|
|
24
|
+
};
|
|
25
|
+
const flush = () => {
|
|
26
|
+
const args = pending.current;
|
|
27
|
+
cancel();
|
|
28
|
+
if (args)
|
|
29
|
+
callbackRef.current(...args);
|
|
30
|
+
};
|
|
31
|
+
const call = (...args) => {
|
|
32
|
+
pending.current = args;
|
|
33
|
+
clearTimeout(timer.current);
|
|
34
|
+
timer.current = setTimeout(flush, delayRef.current);
|
|
35
|
+
};
|
|
36
|
+
return Object.assign(call, { flush, cancel });
|
|
37
|
+
}, []);
|
|
38
|
+
useEffect(() => debounced.cancel, [debounced]);
|
|
39
|
+
return debounced;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { useDebouncedCallback };
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/hooks/useDebouncedCallback/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAUA;;;;;;;;AAQG;AACI,MAAM,oBAAoB,GAAG,CAAyB,QAAiC,EAAE,KAAK,GAAG,GAAG,KAA6B;AACtI,IAAA,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC;AACpC,IAAA,WAAW,CAAC,OAAO,GAAG,QAAQ;AAC9B,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9B,IAAA,QAAQ,CAAC,OAAO,GAAG,KAAK;AACxB,IAAA,MAAM,KAAK,GAAG,MAAM,CAA4C,SAAS,CAAC;AAC1E,IAAA,MAAM,OAAO,GAAG,MAAM,CAAmB,SAAS,CAAC;AAEnD,IAAA,MAAM,SAAS,GAAG,OAAO,CAAC,MAAK;QAC7B,MAAM,MAAM,GAAG,MAAK;AAClB,YAAA,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;AAC3B,YAAA,KAAK,CAAC,OAAO,GAAG,SAAS;AACzB,YAAA,OAAO,CAAC,OAAO,GAAG,SAAS;AAC7B,QAAA,CAAC;QACD,MAAM,KAAK,GAAG,MAAK;AACjB,YAAA,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO;AAC5B,YAAA,MAAM,EAAE;AACR,YAAA,IAAI,IAAI;AAAE,gBAAA,WAAW,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AACxC,QAAA,CAAC;AACD,QAAA,MAAM,IAAI,GAAG,CAAC,GAAG,IAAU,KAAI;AAC7B,YAAA,OAAO,CAAC,OAAO,GAAG,IAAI;AACtB,YAAA,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;YAC3B,KAAK,CAAC,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC;AACrD,QAAA,CAAC;AACD,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC/C,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,SAAS,CAAC,MAAM,SAAS,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC;AAE9C,IAAA,OAAO,SAAS;AAClB;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `searchParamsUtils` has no React Native implementation.
|
|
3
|
+
*
|
|
4
|
+
* This is a generated types-only stub (scripts/emit-native-stubs.mjs). It exists so
|
|
5
|
+
* that importing `@flipdish/ui-library/utilities/searchParamsUtils` from React Native fails at
|
|
6
|
+
* compile time rather than resolving to the web build's types. There is no
|
|
7
|
+
* matching `index.js`, so Metro cannot bundle this module either.
|
|
8
|
+
*
|
|
9
|
+
* To make `searchParamsUtils` available on React Native, add an `index.native.tsx` beside
|
|
10
|
+
* its `index.tsx` — the build picks it up automatically and this stub disappears.
|
|
11
|
+
*/
|
|
12
|
+
export declare const __NO_REACT_NATIVE_IMPLEMENTATION__: never;
|
|
@@ -27,10 +27,11 @@ const portalToBody = () => document.body;
|
|
|
27
27
|
*/
|
|
28
28
|
const resolvePortalContainer = (portalContainer, scopeId) => portalContainer === undefined && scopeId ? portalToBody : (portalContainer ?? null);
|
|
29
29
|
/**
|
|
30
|
-
* Builds the anchor overlays portal into. On `body` it is a zero-
|
|
31
|
-
* footprint
|
|
32
|
-
*
|
|
33
|
-
*
|
|
30
|
+
* Builds the anchor overlays portal into. On `body` it is a zero-size block fixed at the viewport origin: no
|
|
31
|
+
* layout footprint, a stacking context the host's `z-index` layers cannot beat, and the containing block React
|
|
32
|
+
* Aria positions popovers from, so a popover lands beside its trigger. Anywhere else it is `display: contents`,
|
|
33
|
+
* so it cannot disturb a flex or grid host. It carries `data-theme` and, with a scope, `data-mfe-scope`, which
|
|
34
|
+
* is what lets the app's scoped CSS reach an overlay rendered outside its tree.
|
|
34
35
|
*
|
|
35
36
|
* @param container The element the anchor is appended to.
|
|
36
37
|
* @param options The scope to stamp, if any, the resolved theme mode, and the stacking tier for a `body` anchor.
|
|
@@ -39,13 +40,13 @@ const resolvePortalContainer = (portalContainer, scopeId) => portalContainer ===
|
|
|
39
40
|
const createPortalAnchor = (container, { scopeId, resolvedMode, zIndex = OVERLAY_ROOT_Z_INDEX_FALLBACK }) => {
|
|
40
41
|
const anchor = document.createElement('div');
|
|
41
42
|
if (container === document.body) {
|
|
42
|
-
anchor
|
|
43
|
+
// An in-flow anchor after the app sits at the document's end, and React Aria clamps popovers to it, so menus opened below the viewport.
|
|
44
|
+
anchor.style.position = 'fixed';
|
|
45
|
+
anchor.style.top = '0';
|
|
46
|
+
anchor.style.left = '0';
|
|
47
|
+
anchor.style.width = '0';
|
|
43
48
|
anchor.style.height = '0';
|
|
44
49
|
anchor.style.zIndex = String(zIndex);
|
|
45
|
-
// A flex or grid body must not stretch the block or give it a share of the space; a `gap` still applies.
|
|
46
|
-
anchor.style.flex = '0 0 auto';
|
|
47
|
-
anchor.style.alignSelf = 'flex-start';
|
|
48
|
-
anchor.style.margin = '0';
|
|
49
50
|
}
|
|
50
51
|
else {
|
|
51
52
|
anchor.style.display = 'contents';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePortalAnchor.cjs","sources":["../../../../src/providers/UIProvider/hooks/usePortalAnchor.ts"],"sourcesContent":[null],"names":["useMemo","useState","useRef","useLayoutEffect","useCallback"],"mappings":";;;;AAOA;AACO,MAAM,6BAA6B,GAAG;AAE7C;;;;;;;AAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,SAA6B,KAAY;AACzE,IAAA,MAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG;AAClI,IAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,6BAA6B;AACvE;AAEA,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI;AAExC;;;;;;;AAOG;AACI,MAAM,sBAAsB,GAAG,CAAC,eAAoC,EAAE,OAA2B,KACtG,eAAe,KAAK,SAAS,IAAI,OAAO,GAAG,YAAY,IAAI,eAAe,IAAI,IAAI;AAEpF
|
|
1
|
+
{"version":3,"file":"usePortalAnchor.cjs","sources":["../../../../src/providers/UIProvider/hooks/usePortalAnchor.ts"],"sourcesContent":[null],"names":["useMemo","useState","useRef","useLayoutEffect","useCallback"],"mappings":";;;;AAOA;AACO,MAAM,6BAA6B,GAAG;AAE7C;;;;;;;AAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,SAA6B,KAAY;AACzE,IAAA,MAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG;AAClI,IAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,6BAA6B;AACvE;AAEA,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI;AAExC;;;;;;;AAOG;AACI,MAAM,sBAAsB,GAAG,CAAC,eAAoC,EAAE,OAA2B,KACtG,eAAe,KAAK,SAAS,IAAI,OAAO,GAAG,YAAY,IAAI,eAAe,IAAI,IAAI;AAEpF;;;;;;;;;;AAUG;AACI,MAAM,kBAAkB,GAAG,CAChC,SAAsB,EACtB,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,6BAA6B,EAAyE,KACzH;IACf,MAAM,MAAM,GAAG,QAAQ,C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,YAAY,IAAI,YAAY,CAAC,aAAa,KAAK,QAAQ,CAAC,IAAI;YAAE;AACnE,QAAA,YAAY,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AAClE,IAAA,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;;;IAI7B,OAAOC,iBAAW,CAAC,MAAK;AACtB,QAAA,MAAM,QAAQ,GAAG,gBAAgB,IAAI,IAAI,IAAI;QAC7C,IAAI,QAAQ,EAAE;AACZ,YAAA,OAAO,QAAQ,KAAK,qBAAqB,CAAC,OAAO,GAAG,YAAY,GAAG,IAAI;QACzE;QACA,IAAI,gBAAgB,EAAE;AACpB,YAAA,OAAO,IAAI;QACb;AACA,QAAA,OAAO,SAAS;IAClB,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACjD;;;;;;"}
|
|
@@ -21,10 +21,11 @@ export declare const readOverlayZIndex: (themeRoot: HTMLElement | null) => numbe
|
|
|
21
21
|
*/
|
|
22
22
|
export declare const resolvePortalContainer: (portalContainer: PortalContainerProp, scopeId: string | undefined) => (() => HTMLElement | null) | null;
|
|
23
23
|
/**
|
|
24
|
-
* Builds the anchor overlays portal into. On `body` it is a zero-
|
|
25
|
-
* footprint
|
|
26
|
-
*
|
|
27
|
-
*
|
|
24
|
+
* Builds the anchor overlays portal into. On `body` it is a zero-size block fixed at the viewport origin: no
|
|
25
|
+
* layout footprint, a stacking context the host's `z-index` layers cannot beat, and the containing block React
|
|
26
|
+
* Aria positions popovers from, so a popover lands beside its trigger. Anywhere else it is `display: contents`,
|
|
27
|
+
* so it cannot disturb a flex or grid host. It carries `data-theme` and, with a scope, `data-mfe-scope`, which
|
|
28
|
+
* is what lets the app's scoped CSS reach an overlay rendered outside its tree.
|
|
28
29
|
*
|
|
29
30
|
* @param container The element the anchor is appended to.
|
|
30
31
|
* @param options The scope to stamp, if any, the resolved theme mode, and the stacking tier for a `body` anchor.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePortalAnchor.d.ts","sourceRoot":"","sources":["../../../../src/providers/UIProvider/hooks/usePortalAnchor.ts"],"names":[],"mappings":"AAIA,0GAA0G;AAC1G,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhF,+GAA+G;AAC/G,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,WAAW,GAAG,IAAI,KAAG,MAGjE,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,iBAAiB,mBAAmB,EAAE,SAAS,MAAM,GAAG,SAAS,KAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IACnD,CAAC;AAEtF
|
|
1
|
+
{"version":3,"file":"usePortalAnchor.d.ts","sourceRoot":"","sources":["../../../../src/providers/UIProvider/hooks/usePortalAnchor.ts"],"names":[],"mappings":"AAIA,0GAA0G;AAC1G,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;AAEhF,+GAA+G;AAC/G,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,WAAW,WAAW,GAAG,IAAI,KAAG,MAGjE,CAAC;AAIF;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GAAI,iBAAiB,mBAAmB,EAAE,SAAS,MAAM,GAAG,SAAS,KAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,IACnD,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAC7B,WAAW,WAAW,EACtB,mCAAmE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,KACvI,WAiBF,CAAC;AAEF,UAAU,sBAAsB;IAC9B,wDAAwD;IACxD,eAAe,EAAE,mBAAmB,CAAC;IACrC,gDAAgD;IAChD,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,6DAA6D;IAC7D,SAAS,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,2EAA2E;IAC3E,YAAY,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAAI,uDAAuD,sBAAsB,KAAG,CAAC,MAAM,WAAW,GAAG,IAAI,CAqExI,CAAC"}
|
|
@@ -25,10 +25,11 @@ const portalToBody = () => document.body;
|
|
|
25
25
|
*/
|
|
26
26
|
const resolvePortalContainer = (portalContainer, scopeId) => portalContainer === undefined && scopeId ? portalToBody : (portalContainer ?? null);
|
|
27
27
|
/**
|
|
28
|
-
* Builds the anchor overlays portal into. On `body` it is a zero-
|
|
29
|
-
* footprint
|
|
30
|
-
*
|
|
31
|
-
*
|
|
28
|
+
* Builds the anchor overlays portal into. On `body` it is a zero-size block fixed at the viewport origin: no
|
|
29
|
+
* layout footprint, a stacking context the host's `z-index` layers cannot beat, and the containing block React
|
|
30
|
+
* Aria positions popovers from, so a popover lands beside its trigger. Anywhere else it is `display: contents`,
|
|
31
|
+
* so it cannot disturb a flex or grid host. It carries `data-theme` and, with a scope, `data-mfe-scope`, which
|
|
32
|
+
* is what lets the app's scoped CSS reach an overlay rendered outside its tree.
|
|
32
33
|
*
|
|
33
34
|
* @param container The element the anchor is appended to.
|
|
34
35
|
* @param options The scope to stamp, if any, the resolved theme mode, and the stacking tier for a `body` anchor.
|
|
@@ -37,13 +38,13 @@ const resolvePortalContainer = (portalContainer, scopeId) => portalContainer ===
|
|
|
37
38
|
const createPortalAnchor = (container, { scopeId, resolvedMode, zIndex = OVERLAY_ROOT_Z_INDEX_FALLBACK }) => {
|
|
38
39
|
const anchor = document.createElement('div');
|
|
39
40
|
if (container === document.body) {
|
|
40
|
-
anchor
|
|
41
|
+
// An in-flow anchor after the app sits at the document's end, and React Aria clamps popovers to it, so menus opened below the viewport.
|
|
42
|
+
anchor.style.position = 'fixed';
|
|
43
|
+
anchor.style.top = '0';
|
|
44
|
+
anchor.style.left = '0';
|
|
45
|
+
anchor.style.width = '0';
|
|
41
46
|
anchor.style.height = '0';
|
|
42
47
|
anchor.style.zIndex = String(zIndex);
|
|
43
|
-
// A flex or grid body must not stretch the block or give it a share of the space; a `gap` still applies.
|
|
44
|
-
anchor.style.flex = '0 0 auto';
|
|
45
|
-
anchor.style.alignSelf = 'flex-start';
|
|
46
|
-
anchor.style.margin = '0';
|
|
47
48
|
}
|
|
48
49
|
else {
|
|
49
50
|
anchor.style.display = 'contents';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePortalAnchor.js","sources":["../../../../src/providers/UIProvider/hooks/usePortalAnchor.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAOA;AACO,MAAM,6BAA6B,GAAG;AAE7C;;;;;;;AAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,SAA6B,KAAY;AACzE,IAAA,MAAM,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,GAAG;AAClI,IAAA,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,6BAA6B;AACvE;AAEA,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,IAAI;AAExC;;;;;;;AAOG;AACI,MAAM,sBAAsB,GAAG,CAAC,eAAoC,EAAE,OAA2B,KACtG,eAAe,KAAK,SAAS,IAAI,OAAO,GAAG,YAAY,IAAI,eAAe,IAAI,IAAI;AAEpF
|
|
1
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E;AACpB,YAAA,OAAO,IAAI;QACb;AACA,QAAA,OAAO,SAAS;IAClB,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AACjD;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The search param names every list page uses for its view tab, search, table sort, page and page size, so links and
|
|
5
|
+
* analytics read the same across apps. A page adds its own params, such as a filter or the open record, beside them.
|
|
6
|
+
*/
|
|
7
|
+
const LIST_PARAMS = {
|
|
8
|
+
view: 'view',
|
|
9
|
+
search: 'q',
|
|
10
|
+
sort: 'sort',
|
|
11
|
+
page: 'page',
|
|
12
|
+
pageSize: 'pageSize',
|
|
13
|
+
};
|
|
14
|
+
function parseEnumParam(value, allowed, fallback) {
|
|
15
|
+
return value !== null && allowed.includes(value) ? value : fallback;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reads a page number out of a search param.
|
|
19
|
+
* @param value - The param's value, `null` when it is absent.
|
|
20
|
+
* @returns A whole number of at least 1; anything absent, fractional, negative or not a number is page 1.
|
|
21
|
+
*/
|
|
22
|
+
const parsePageParam = (value) => {
|
|
23
|
+
const page = Number(value);
|
|
24
|
+
return Number.isInteger(page) && page > 1 ? page : 1;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Reads a page size out of a search param, accepting only the sizes the page offers.
|
|
28
|
+
* @param value - The param's value, `null` when it is absent.
|
|
29
|
+
* @param allowed - The page sizes the pager's selector offers.
|
|
30
|
+
* @param fallback - The size to use when the value is absent or not one of `allowed`.
|
|
31
|
+
* @returns The page size.
|
|
32
|
+
*/
|
|
33
|
+
const parsePageSizeParam = (value, allowed, fallback) => {
|
|
34
|
+
const size = Number(value);
|
|
35
|
+
return value !== null && allowed.includes(size) ? size : fallback;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Reads a table sort out of a search param written by `sortToParam`: the column id, with a leading `-` for descending.
|
|
39
|
+
* @param value - The param's value, `null` when it is absent.
|
|
40
|
+
* @param columns - The columns that can be sorted.
|
|
41
|
+
* @param fallback - The sort to use when the value is absent or names a column that cannot be sorted.
|
|
42
|
+
* @returns The sort the value describes, or `fallback`.
|
|
43
|
+
*/
|
|
44
|
+
const parseSortParam = (value, columns, fallback) => {
|
|
45
|
+
if (!value)
|
|
46
|
+
return fallback;
|
|
47
|
+
const descending = value.startsWith('-');
|
|
48
|
+
const column = parseEnumParam(descending ? value.slice(1) : value, columns, null);
|
|
49
|
+
return column === null ? fallback : { column, direction: descending ? 'descending' : 'ascending' };
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Writes a table sort as a search param value: the column id, with a leading `-` for descending, e.g. `-name`.
|
|
53
|
+
* @param sort - The table's sort; any `{ column, direction }`, such as react-aria's `SortDescriptor`.
|
|
54
|
+
* @param fallback - The page's default sort, which stays out of the URL.
|
|
55
|
+
* @returns The param value, or `null` when the sort is the default and the param should be left out.
|
|
56
|
+
*/
|
|
57
|
+
const sortToParam = (sort, fallback) => {
|
|
58
|
+
if (sort.column === undefined)
|
|
59
|
+
return null;
|
|
60
|
+
if (fallback && sort.column === fallback.column && sort.direction === fallback.direction)
|
|
61
|
+
return null;
|
|
62
|
+
return `${sort.direction === 'descending' ? '-' : ''}${String(sort.column)}`;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
exports.LIST_PARAMS = LIST_PARAMS;
|
|
66
|
+
exports.parseEnumParam = parseEnumParam;
|
|
67
|
+
exports.parsePageParam = parsePageParam;
|
|
68
|
+
exports.parsePageSizeParam = parsePageSizeParam;
|
|
69
|
+
exports.parseSortParam = parseSortParam;
|
|
70
|
+
exports.sortToParam = sortToParam;
|
|
71
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/utilities/searchParamsUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":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AM,EAAE,SAAS,EAAE,UAAU,GAAG,YAAY,GAAG,WAAW,EAAE;AACpG;AAEA;;;;;AAKG;MACU,WAAW,GAAG,CAAC,IAA8C,EAAE,QAAiD,KAAmB;AAC9I,IAAA,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;AAAE,QAAA,OAAO,IAAI;AAC1C,IAAA,IAAI,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,SAAS,KAAK,QAAQ,CAAC,SAAS;AAAE,QAAA,OAAO,IAAI;IACrG,OAAO,CAAA,EAAG,IAAI,CAAC,SAAS,KAAK,YAAY,GAAG,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,CAAE;AAC9E;;;;;;;"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search param names every list page uses for its view tab, search, table sort, page and page size, so links and
|
|
3
|
+
* analytics read the same across apps. A page adds its own params, such as a filter or the open record, beside them.
|
|
4
|
+
*/
|
|
5
|
+
export declare const LIST_PARAMS: {
|
|
6
|
+
readonly view: "view";
|
|
7
|
+
readonly search: "q";
|
|
8
|
+
readonly sort: "sort";
|
|
9
|
+
readonly page: "page";
|
|
10
|
+
readonly pageSize: "pageSize";
|
|
11
|
+
};
|
|
12
|
+
/** A table sort, the same shape as react-aria's `SortDescriptor`, so a parsed value can go straight to `Table` `sortDescriptor`. */
|
|
13
|
+
export interface SortParam<Column extends string> {
|
|
14
|
+
column: Column;
|
|
15
|
+
direction: 'ascending' | 'descending';
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Reads one of a fixed set of values, such as a view tab or a role, out of a search param.
|
|
19
|
+
* @param value - The param's value, `null` when it is absent.
|
|
20
|
+
* @param allowed - Every value the page understands.
|
|
21
|
+
* @param fallback - What to use when the value is absent or not one of `allowed`.
|
|
22
|
+
* @returns The value when it is allowed, else `fallback`. A URL is user input, so nothing else gets through.
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseEnumParam<T extends string>(value: string | null, allowed: readonly T[], fallback: T): T;
|
|
25
|
+
export declare function parseEnumParam<T extends string>(value: string | null, allowed: readonly T[], fallback: null): T | null;
|
|
26
|
+
/**
|
|
27
|
+
* Reads a page number out of a search param.
|
|
28
|
+
* @param value - The param's value, `null` when it is absent.
|
|
29
|
+
* @returns A whole number of at least 1; anything absent, fractional, negative or not a number is page 1.
|
|
30
|
+
*/
|
|
31
|
+
export declare const parsePageParam: (value: string | null) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Reads a page size out of a search param, accepting only the sizes the page offers.
|
|
34
|
+
* @param value - The param's value, `null` when it is absent.
|
|
35
|
+
* @param allowed - The page sizes the pager's selector offers.
|
|
36
|
+
* @param fallback - The size to use when the value is absent or not one of `allowed`.
|
|
37
|
+
* @returns The page size.
|
|
38
|
+
*/
|
|
39
|
+
export declare const parsePageSizeParam: (value: string | null, allowed: readonly number[], fallback: number) => number;
|
|
40
|
+
/**
|
|
41
|
+
* Reads a table sort out of a search param written by `sortToParam`: the column id, with a leading `-` for descending.
|
|
42
|
+
* @param value - The param's value, `null` when it is absent.
|
|
43
|
+
* @param columns - The columns that can be sorted.
|
|
44
|
+
* @param fallback - The sort to use when the value is absent or names a column that cannot be sorted.
|
|
45
|
+
* @returns The sort the value describes, or `fallback`.
|
|
46
|
+
*/
|
|
47
|
+
export declare const parseSortParam: <Column extends string>(value: string | null, columns: readonly Column[], fallback: SortParam<Column>) => SortParam<Column>;
|
|
48
|
+
/**
|
|
49
|
+
* Writes a table sort as a search param value: the column id, with a leading `-` for descending, e.g. `-name`.
|
|
50
|
+
* @param sort - The table's sort; any `{ column, direction }`, such as react-aria's `SortDescriptor`.
|
|
51
|
+
* @param fallback - The page's default sort, which stays out of the URL.
|
|
52
|
+
* @returns The param value, or `null` when the sort is the default and the param should be left out.
|
|
53
|
+
*/
|
|
54
|
+
export declare const sortToParam: (sort: {
|
|
55
|
+
column?: unknown;
|
|
56
|
+
direction?: string;
|
|
57
|
+
}, fallback?: {
|
|
58
|
+
column: unknown;
|
|
59
|
+
direction: string;
|
|
60
|
+
}) => string | null;
|
|
61
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utilities/searchParamsUtils/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,oIAAoI;AACpI,MAAM,WAAW,SAAS,CAAC,MAAM,SAAS,MAAM;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,GAAG,YAAY,CAAC;CACvC;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;AAC9G,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC;AAKxH;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,MAAM,GAAG,IAAI,KAAG,MAGrD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,MAAM,GAAG,IAAI,EAAE,SAAS,SAAS,MAAM,EAAE,EAAE,UAAU,MAAM,KAAG,MAGvG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,MAAM,EAClD,OAAO,MAAM,GAAG,IAAI,EACpB,SAAS,SAAS,MAAM,EAAE,EAC1B,UAAU,SAAS,CAAC,MAAM,CAAC,KAC1B,SAAS,CAAC,MAAM,CAK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