@flipdish/ui-library 0.31.4 → 0.31.5
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/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.map +1 -1
- package/dist/components/molecules/Pagination/index.cjs.map +1 -1
- package/dist/components/molecules/Pagination/index.d.ts.map +1 -1
- package/dist/components/molecules/Pagination/index.js.map +1 -1
- package/dist/components/organisms/Charts/index.d.ts +0 -2
- package/dist/components/organisms/Charts/index.d.ts.map +1 -1
- package/dist/components/templates/AppShell/index.cjs +5 -7
- package/dist/components/templates/AppShell/index.cjs.map +1 -1
- package/dist/components/templates/AppShell/index.d.ts +5 -7
- package/dist/components/templates/AppShell/index.d.ts.map +1 -1
- package/dist/components/templates/AppShell/index.js +5 -7
- package/dist/components/templates/AppShell/index.js.map +1 -1
- package/dist/components/templates/NotFoundPage/index.cjs +3 -9
- package/dist/components/templates/NotFoundPage/index.cjs.map +1 -1
- package/dist/components/templates/NotFoundPage/index.d.ts +3 -9
- package/dist/components/templates/NotFoundPage/index.d.ts.map +1 -1
- package/dist/components/templates/NotFoundPage/index.js +3 -9
- package/dist/components/templates/NotFoundPage/index.js.map +1 -1
- package/dist/components/templates/PageLayout/index.cjs +5 -12
- package/dist/components/templates/PageLayout/index.cjs.map +1 -1
- package/dist/components/templates/PageLayout/index.d.ts +5 -12
- package/dist/components/templates/PageLayout/index.d.ts.map +1 -1
- package/dist/components/templates/PageLayout/index.js +5 -12
- package/dist/components/templates/PageLayout/index.js.map +1 -1
- package/dist/hooks/useBreakpoints/index.cjs +5 -5
- package/dist/hooks/useBreakpoints/index.d.ts +5 -5
- package/dist/hooks/useBreakpoints/index.js +5 -5
- package/dist/hooks/useClipboard/index.cjs +5 -2
- package/dist/hooks/useClipboard/index.cjs.map +1 -1
- package/dist/hooks/useClipboard/index.d.ts +5 -2
- package/dist/hooks/useClipboard/index.d.ts.map +1 -1
- package/dist/hooks/useClipboard/index.js +5 -2
- package/dist/hooks/useClipboard/index.js.map +1 -1
- package/dist/hooks/usePlatform/index.cjs +4 -5
- package/dist/hooks/usePlatform/index.cjs.map +1 -1
- package/dist/hooks/usePlatform/index.d.ts +4 -5
- package/dist/hooks/usePlatform/index.d.ts.map +1 -1
- package/dist/hooks/usePlatform/index.js +4 -5
- package/dist/hooks/usePlatform/index.js.map +1 -1
- package/dist/hooks/useResizeObserver/index.cjs +7 -2
- package/dist/hooks/useResizeObserver/index.cjs.map +1 -1
- package/dist/hooks/useResizeObserver/index.d.ts +7 -2
- package/dist/hooks/useResizeObserver/index.d.ts.map +1 -1
- package/dist/hooks/useResizeObserver/index.js +7 -2
- package/dist/hooks/useResizeObserver/index.js.map +1 -1
- package/dist/hooks/useSidePanel/index.cjs +7 -5
- package/dist/hooks/useSidePanel/index.cjs.map +1 -1
- package/dist/hooks/useSidePanel/index.d.ts +7 -5
- package/dist/hooks/useSidePanel/index.d.ts.map +1 -1
- package/dist/hooks/useSidePanel/index.js +7 -5
- package/dist/hooks/useSidePanel/index.js.map +1 -1
- package/dist/native/utilities/cx/index.d.ts +9 -9
- package/dist/native/utilities/cx/index.d.ts.map +1 -1
- package/dist/native/utilities/cx/index.js +9 -9
- package/dist/native/utilities/cx/index.js.map +1 -1
- package/dist/native/utilities/testIdUtils/index.d.ts +44 -10
- package/dist/native/utilities/testIdUtils/index.d.ts.map +1 -1
- package/dist/native/utilities/testIdUtils/index.js +44 -10
- package/dist/native/utilities/testIdUtils/index.js.map +1 -1
- package/dist/providers/ErrorBoundary/index.cjs +5 -7
- package/dist/providers/ErrorBoundary/index.cjs.map +1 -1
- package/dist/providers/ErrorBoundary/index.d.ts +4 -7
- package/dist/providers/ErrorBoundary/index.d.ts.map +1 -1
- package/dist/providers/ErrorBoundary/index.js +5 -7
- package/dist/providers/ErrorBoundary/index.js.map +1 -1
- package/dist/providers/RouteProvider/index.cjs +5 -1
- package/dist/providers/RouteProvider/index.cjs.map +1 -1
- package/dist/providers/RouteProvider/index.d.ts +5 -1
- package/dist/providers/RouteProvider/index.d.ts.map +1 -1
- package/dist/providers/RouteProvider/index.js +5 -1
- package/dist/providers/RouteProvider/index.js.map +1 -1
- package/dist/providers/ThemeProvider/index.cjs +11 -1
- package/dist/providers/ThemeProvider/index.cjs.map +1 -1
- package/dist/providers/ThemeProvider/index.d.ts +11 -1
- package/dist/providers/ThemeProvider/index.d.ts.map +1 -1
- package/dist/providers/ThemeProvider/index.js +11 -1
- package/dist/providers/ThemeProvider/index.js.map +1 -1
- package/dist/providers/UIProvider/index.cjs +5 -1
- package/dist/providers/UIProvider/index.cjs.map +1 -1
- package/dist/providers/UIProvider/index.d.ts +5 -1
- package/dist/providers/UIProvider/index.d.ts.map +1 -1
- package/dist/providers/UIProvider/index.js +5 -1
- package/dist/providers/UIProvider/index.js.map +1 -1
- package/dist/utilities/cssScopeUtils/index.cjs +6 -5
- package/dist/utilities/cssScopeUtils/index.cjs.map +1 -1
- package/dist/utilities/cssScopeUtils/index.d.ts +6 -5
- package/dist/utilities/cssScopeUtils/index.d.ts.map +1 -1
- package/dist/utilities/cssScopeUtils/index.js +6 -5
- package/dist/utilities/cssScopeUtils/index.js.map +1 -1
- package/dist/utilities/cx/index.cjs +9 -9
- package/dist/utilities/cx/index.cjs.map +1 -1
- package/dist/utilities/cx/index.d.ts +9 -9
- package/dist/utilities/cx/index.d.ts.map +1 -1
- package/dist/utilities/cx/index.js +9 -9
- package/dist/utilities/cx/index.js.map +1 -1
- package/dist/utilities/hrefUtils/index.cjs +10 -11
- package/dist/utilities/hrefUtils/index.cjs.map +1 -1
- package/dist/utilities/hrefUtils/index.d.ts +10 -11
- package/dist/utilities/hrefUtils/index.d.ts.map +1 -1
- package/dist/utilities/hrefUtils/index.js +10 -11
- package/dist/utilities/hrefUtils/index.js.map +1 -1
- package/dist/utilities/localStorageUtils/index.cjs +8 -5
- package/dist/utilities/localStorageUtils/index.cjs.map +1 -1
- package/dist/utilities/localStorageUtils/index.d.ts +8 -5
- package/dist/utilities/localStorageUtils/index.d.ts.map +1 -1
- package/dist/utilities/localStorageUtils/index.js +8 -5
- package/dist/utilities/localStorageUtils/index.js.map +1 -1
- package/dist/utilities/renderUtils/index.cjs +31 -30
- package/dist/utilities/renderUtils/index.cjs.map +1 -1
- package/dist/utilities/renderUtils/index.d.ts +31 -30
- package/dist/utilities/renderUtils/index.d.ts.map +1 -1
- package/dist/utilities/renderUtils/index.js +31 -30
- package/dist/utilities/renderUtils/index.js.map +1 -1
- package/dist/utilities/sessionStorageUtils/index.cjs +8 -5
- package/dist/utilities/sessionStorageUtils/index.cjs.map +1 -1
- package/dist/utilities/sessionStorageUtils/index.d.ts +8 -5
- package/dist/utilities/sessionStorageUtils/index.d.ts.map +1 -1
- package/dist/utilities/sessionStorageUtils/index.js +8 -5
- package/dist/utilities/sessionStorageUtils/index.js.map +1 -1
- package/dist/utilities/testIdUtils/index.cjs +44 -10
- package/dist/utilities/testIdUtils/index.cjs.map +1 -1
- package/dist/utilities/testIdUtils/index.d.ts +44 -10
- package/dist/utilities/testIdUtils/index.d.ts.map +1 -1
- package/dist/utilities/testIdUtils/index.js +44 -10
- package/dist/utilities/testIdUtils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":["useState","useRef","useEffect","useCallback"],"mappings":";;;;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B;;;;;;;AAOG;AACI,MAAM,YAAY,GAAG,MAA6B;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG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OAAO,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,CAAC,4BAA4B,CAAC,EAAE;QACzG;QAAE,OAAO,GAAG,EAAE;YACZ,OAAO;AACL,gBAAA,OAAO,EAAE,KAAK;AACd,gBAAA,KAAK,EAAE,GAAG,YAAY,KAAK,GAAG,GAAG,GAAG,IAAI,KAAK,CAAC,sBAAsB,CAAC;aACtE;QACH;gBAAU;;YAER,QAAQ,CAAC,MAAM,EAAE;QACnB;AACF,IAAA,CAAC;;IAGD,MAAM,IAAI,GAAGC,iBAAW,CAAC,OAAO,IAAY,EAAE,EAAW,KAAI;QAC3D,IAAI,SAAS,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,EAAE;AACjD,YAAA,IAAI;gBACF,MAAM,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC;AAEzC,gBAAA,IAAI,YAAY,CAAC,OAAO,EAAE;AACxB,oBAAA,SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;AACrB,oBAAA,aAAa,EAAE;gBACjB;AAEA,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;YAC1B;YAAE,OAAO,IAAI,EAAE;;AAEb,gBAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3B;QACF;AACA,QAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;;"}
|
|
@@ -20,9 +20,12 @@ type UseClipboardReturnType = {
|
|
|
20
20
|
}>;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Copies text to the clipboard and tracks a short-lived copied state (about 2s) for flipping a
|
|
24
|
+
* button label or icon. Uses the async Clipboard API with a hidden textarea fallback for older
|
|
25
|
+
* browsers.
|
|
24
26
|
*
|
|
25
|
-
* @returns
|
|
27
|
+
* @returns `copy(text)` plus `copied`, the text just copied (or `true`), resetting to `false`
|
|
28
|
+
* after the timeout.
|
|
26
29
|
*/
|
|
27
30
|
export declare const useClipboard: () => UseClipboardReturnType;
|
|
28
31
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClipboard/index.ts"],"names":[],"mappings":"AAMA,KAAK,sBAAsB,GAAG;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACnF,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useClipboard/index.ts"],"names":[],"mappings":"AAMA,KAAK,sBAAsB,GAAG;IAC5B;;;OAGG;IACH,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB;;;;;;;;;OASG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CACnF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,QAAO,sBAyE/B,CAAC"}
|
|
@@ -2,9 +2,12 @@ import { useState, useRef, useEffect, useCallback } from 'react';
|
|
|
2
2
|
|
|
3
3
|
const DEFAULT_TIMEOUT = 2000;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Copies text to the clipboard and tracks a short-lived copied state (about 2s) for flipping a
|
|
6
|
+
* button label or icon. Uses the async Clipboard API with a hidden textarea fallback for older
|
|
7
|
+
* browsers.
|
|
6
8
|
*
|
|
7
|
-
* @returns
|
|
9
|
+
* @returns `copy(text)` plus `copied`, the text just copied (or `true`), resetting to `false`
|
|
10
|
+
* after the timeout.
|
|
8
11
|
*/
|
|
9
12
|
const useClipboard = () => {
|
|
10
13
|
const [copied, setCopied] = useState(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useClipboard/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA,MAAM,eAAe,GAAG,IAAI;AAqB5B;;;;;;;AAOG;AACI,MAAM,YAAY,GAAG,MAA6B;IACvD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAmB,KAAK,CAAC;AAC7D,IAAA,MAAM,aAAa,GAAG,MAAM,CAAuC,IAAI,CAAC;;;AAGxE,IAAA,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC;IAEjC,MAAM,aAAa,GAAG,MAAK;QACzB,IAAI,aAAa,CAAC,OAAO;AAAE,YAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9D,QAAA,aAAa,CAAC,OAAO,GAAG,UAAU,CAAC,MAAM,SAAS,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC;AAC7E,IAAA,CAAC;IAED,SAAS,CAAC,MAAK;AACb,QAAA,YAAY,CAAC,OAAO,GAAG,IAAI;AAC3B,QAAA,OAAO,MAAK;AACV,YAAA,YAAY,CAAC,OAAO,GAAG,KAAK;YAC5B,IAAI,aAAa,CAAC,OAAO;AAAE,gBAAA,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;AAChE,QAAA,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;;AAG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SAAS,CAAC,EAAE,IAAI,IAAI,CAAC;AACrB,oBAAA,aAAa,EAAE;gBACjB;AAEA,gBAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;YAC1B;YAAE,OAAO,IAAI,EAAE;;AAEb,gBAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;YAC3B;QACF;AACA,QAAA,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;IAC3B,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE;AACzB;;"}
|
|
@@ -6,12 +6,11 @@ var platform_utils = require('../../utilities/__internal__/platformUtils/platfor
|
|
|
6
6
|
const subscribeToNothing = () => () => { };
|
|
7
7
|
const getServerOs = () => 'unknown';
|
|
8
8
|
/**
|
|
9
|
-
* Reports the operating system of the user's device, for wording
|
|
10
|
-
*
|
|
11
|
-
* guess
|
|
12
|
-
* that. Every flag is `false` on the server and during hydration, then settles on the real device.
|
|
9
|
+
* Reports the operating system of the user's device, for wording such as a shortcut label or
|
|
10
|
+
* download link. Every flag is `false` on the server and during hydration; treat the result as
|
|
11
|
+
* a best guess, never a reason to change behaviour.
|
|
13
12
|
*
|
|
14
|
-
* @
|
|
13
|
+
* @returns The detected `os` plus `isMac`, `isApple` and `isWindows` flags.
|
|
15
14
|
*/
|
|
16
15
|
const usePlatform = () => {
|
|
17
16
|
const os = React.useSyncExternalStore(subscribeToNothing, platform_utils.getPlatformOs, getServerOs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":["useSyncExternalStore","getPlatformOs","useMemo"],"mappings":";;;;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":["useSyncExternalStore","getPlatformOs","useMemo"],"mappings":";;;;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C;;;;;;AAMG;AACI,MAAM,WAAW,GAAG,MAAmB;IAC5C,MAAM,EAAE,GAAGA,0BAAoB,CAAC,kBAAkB,EAAEC,4BAAa,EAAE,WAAW,CAAC;AAE/E,IAAA,OAAOC,aAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACnI;;"}
|
|
@@ -11,12 +11,11 @@ export interface PlatformInfo {
|
|
|
11
11
|
isWindows: boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Reports the operating system of the user's device, for wording
|
|
15
|
-
*
|
|
16
|
-
* guess
|
|
17
|
-
* that. Every flag is `false` on the server and during hydration, then settles on the real device.
|
|
14
|
+
* Reports the operating system of the user's device, for wording such as a shortcut label or
|
|
15
|
+
* download link. Every flag is `false` on the server and during hydration; treat the result as
|
|
16
|
+
* a best guess, never a reason to change behaviour.
|
|
18
17
|
*
|
|
19
|
-
* @
|
|
18
|
+
* @returns The detected `os` plus `isMac`, `isApple` and `isWindows` flags.
|
|
20
19
|
*/
|
|
21
20
|
export declare const usePlatform: () => PlatformInfo;
|
|
22
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePlatform/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AAE5F,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,qGAAqG;IACrG,EAAE,EAAE,UAAU,CAAC;IACf,kIAAkI;IAClI,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;CACpB;AAKD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePlatform/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2DAA2D,CAAC;AAE5F,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B,MAAM,WAAW,YAAY;IAC3B,qGAAqG;IACrG,EAAE,EAAE,UAAU,CAAC;IACf,kIAAkI;IAClI,KAAK,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,mEAAmE;IACnE,SAAS,EAAE,OAAO,CAAC;CACpB;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,QAAO,YAI9B,CAAC"}
|
|
@@ -4,12 +4,11 @@ import { getPlatformOs } from '../../utilities/__internal__/platformUtils/platfo
|
|
|
4
4
|
const subscribeToNothing = () => () => { };
|
|
5
5
|
const getServerOs = () => 'unknown';
|
|
6
6
|
/**
|
|
7
|
-
* Reports the operating system of the user's device, for wording
|
|
8
|
-
*
|
|
9
|
-
* guess
|
|
10
|
-
* that. Every flag is `false` on the server and during hydration, then settles on the real device.
|
|
7
|
+
* Reports the operating system of the user's device, for wording such as a shortcut label or
|
|
8
|
+
* download link. Every flag is `false` on the server and during hydration; treat the result as
|
|
9
|
+
* a best guess, never a reason to change behaviour.
|
|
11
10
|
*
|
|
12
|
-
* @
|
|
11
|
+
* @returns The detected `os` plus `isMac`, `isApple` and `isWindows` flags.
|
|
13
12
|
*/
|
|
14
13
|
const usePlatform = () => {
|
|
15
14
|
const os = useSyncExternalStore(subscribeToNothing, getPlatformOs, getServerOs);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/usePlatform/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAmBA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AACzC,MAAM,WAAW,GAAG,MAAkB,SAAS;AAE/C;;;;;;AAMG;AACI,MAAM,WAAW,GAAG,MAAmB;IAC5C,MAAM,EAAE,GAAG,oBAAoB,CAAC,kBAAkB,EAAE,aAAa,EAAE,WAAW,CAAC;AAE/E,IAAA,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACnI;;"}
|
|
@@ -10,8 +10,13 @@ function hasResizeObserver() {
|
|
|
10
10
|
return typeof window.ResizeObserver !== 'undefined';
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Runs a callback whenever an observed element changes size, via `ResizeObserver` with a
|
|
14
|
+
* window `resize` fallback. Use it for layout that reacts to an element's own size, such as
|
|
15
|
+
* truncation or chart dimensions.
|
|
16
|
+
*
|
|
17
|
+
* @param options The `ref` to observe, the `onResize` callback, and an optional `box` model to
|
|
18
|
+
* measure.
|
|
19
|
+
* @returns Nothing; the observer is attached and torn down with the component.
|
|
15
20
|
*/
|
|
16
21
|
function useResizeObserver(options) {
|
|
17
22
|
const { ref, box, onResize } = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useResizeObserver/index.ts"],"sourcesContent":[null],"names":["useEffect"],"mappings":";;;;AAIA;;;AAGG;AACH,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW;AACrD;AAoBA
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useResizeObserver/index.ts"],"sourcesContent":[null],"names":["useEffect"],"mappings":";;;;AAIA;;;AAGG;AACH,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW;AACrD;AAoBA;;;;;;;;AAQG;AACG,SAAU,iBAAiB,CAAoB,OAAwC,EAAA;IAC3F,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO;IAEtCA,eAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAG,GAAG,EAAE,OAAO;QAC5B,IAAI,CAAC,OAAO,EAAE;YACZ;QACF;AAEA,QAAA,IAAI,CAAC,iBAAiB,EAAE,EAAE;YACxB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AAElD,YAAA,OAAO,MAAK;gBACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AACvD,YAAA,CAAC;QACH;aAAO;YACL,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,KAAI;AACnE,gBAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;oBACnB;gBACF;AAEA,gBAAA,QAAQ,EAAE;AACZ,YAAA,CAAC,CAAC;YAEF,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC;AAEhD,YAAA,OAAO,MAAK;gBACV,IAAI,OAAO,EAAE;AACX,oBAAA,sBAAsB,CAAC,SAAS,CAAC,OAAO,CAAC;gBAC3C;AACF,YAAA,CAAC;QACH;IACF,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1B;;"}
|
|
@@ -17,8 +17,13 @@ type useResizeObserverOptionsType<T> = {
|
|
|
17
17
|
onResize: () => void;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* Runs a callback whenever an observed element changes size, via `ResizeObserver` with a
|
|
21
|
+
* window `resize` fallback. Use it for layout that reacts to an element's own size, such as
|
|
22
|
+
* truncation or chart dimensions.
|
|
23
|
+
*
|
|
24
|
+
* @param options The `ref` to observe, the `onResize` callback, and an optional `box` model to
|
|
25
|
+
* measure.
|
|
26
|
+
* @returns Nothing; the observer is attached and torn down with the component.
|
|
22
27
|
*/
|
|
23
28
|
export declare function useResizeObserver<T extends Element>(options: useResizeObserverOptionsType<T>): void;
|
|
24
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizeObserver/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAUlD;;GAEG;AACH,KAAK,4BAA4B,CAAC,CAAC,IAAI;IACrC;;OAEG;IACH,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACjD;;OAEG;IACH,GAAG,CAAC,EAAE,wBAAwB,CAAC;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizeObserver/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,OAAO,CAAC;AAUlD;;GAEG;AACH,KAAK,4BAA4B,CAAC,CAAC,IAAI;IACrC;;OAEG;IACH,GAAG,EAAE,SAAS,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACjD;;OAEG;IACH,GAAG,CAAC,EAAE,wBAAwB,CAAC;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,EAAE,4BAA4B,CAAC,CAAC,CAAC,QAiC5F"}
|
|
@@ -8,8 +8,13 @@ function hasResizeObserver() {
|
|
|
8
8
|
return typeof window.ResizeObserver !== 'undefined';
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Runs a callback whenever an observed element changes size, via `ResizeObserver` with a
|
|
12
|
+
* window `resize` fallback. Use it for layout that reacts to an element's own size, such as
|
|
13
|
+
* truncation or chart dimensions.
|
|
14
|
+
*
|
|
15
|
+
* @param options The `ref` to observe, the `onResize` callback, and an optional `box` model to
|
|
16
|
+
* measure.
|
|
17
|
+
* @returns Nothing; the observer is attached and torn down with the component.
|
|
13
18
|
*/
|
|
14
19
|
function useResizeObserver(options) {
|
|
15
20
|
const { ref, box, onResize } = options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useResizeObserver/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;AAGG;AACH,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW;AACrD;AAoBA
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useResizeObserver/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;AAGG;AACH,SAAS,iBAAiB,GAAA;AACxB,IAAA,OAAO,OAAO,MAAM,CAAC,cAAc,KAAK,WAAW;AACrD;AAoBA;;;;;;;;AAQG;AACG,SAAU,iBAAiB,CAAoB,OAAwC,EAAA;IAC3F,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO;IAEtC,SAAS,CAAC,MAAK;AACb,QAAA,MAAM,OAAO,GAAG,GAAG,EAAE,OAAO;QAC5B,IAAI,CAAC,OAAO,EAAE;YACZ;QACF;AAEA,QAAA,IAAI,CAAC,iBAAiB,EAAE,EAAE;YACxB,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AAElD,YAAA,OAAO,MAAK;gBACV,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC;AACvD,YAAA,CAAC;QACH;aAAO;YACL,MAAM,sBAAsB,GAAG,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,KAAI;AACnE,gBAAA,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;oBACnB;gBACF;AAEA,gBAAA,QAAQ,EAAE;AACZ,YAAA,CAAC,CAAC;YAEF,sBAAsB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC;AAEhD,YAAA,OAAO,MAAK;gBACV,IAAI,OAAO,EAAE;AACX,oBAAA,sBAAsB,CAAC,SAAS,CAAC,OAAO,CAAC;gBAC3C;AACF,YAAA,CAAC;QACH;IACF,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAC1B;;"}
|
|
@@ -7,12 +7,14 @@ var React = require('react');
|
|
|
7
7
|
const subscribeToNothing = () => () => { };
|
|
8
8
|
const isPersisted = (persist, panel) => persist?.some((id) => id === panel) ?? false;
|
|
9
9
|
/**
|
|
10
|
-
* State for one `SidePanel` slot shared by several panels,
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `SidePanel` `isOpen` and `onOpenChange`.
|
|
10
|
+
* State for one `SidePanel` slot shared by several panels, so only one is open at a time, with
|
|
11
|
+
* optional persistence so chosen panels reopen on the next visit. Pass each header button
|
|
12
|
+
* `active === id` and `toggle(id)`, and pass `SidePanel` `isOpen` and `onOpenChange`.
|
|
14
13
|
*
|
|
15
|
-
* @
|
|
14
|
+
* @param options `persist` lists the panel ids to remember in `localStorage`; omit it for
|
|
15
|
+
* session-only state.
|
|
16
|
+
* @returns The `active` panel, `isOpen`, and the `open`, `toggle`, `close` and `onOpenChange`
|
|
17
|
+
* handlers.
|
|
16
18
|
*/
|
|
17
19
|
const useSidePanel = ({ persist } = {}) => {
|
|
18
20
|
// undefined until the user opens or closes a panel; until then the remembered panel shows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useSidePanel/index.ts"],"sourcesContent":[null],"names":["useState","useBreakpoints","useSyncExternalStore","useRef","sidePanelStorage","useEffect","useMemo"],"mappings":";;;;;;AA6BA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AAEzC,MAAM,WAAW,GAAG,CAAmB,OAAiC,EAAE,KAAa,KAAiB,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,IAAI,KAAK;AAEpJ
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/hooks/useSidePanel/index.ts"],"sourcesContent":[null],"names":["useState","useBreakpoints","useSyncExternalStore","useRef","sidePanelStorage","useEffect","useMemo"],"mappings":";;;;;;AA6BA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AAEzC,MAAM,WAAW,GAAG,CAAmB,OAAiC,EAAE,KAAa,KAAiB,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,IAAI,KAAK;AAEpJ;;;;;;;;;AASG;AACI,MAAM,YAAY,GAAG,CAAmB,EAAE,OAAO,EAAA,GAA6B,EAAE,KAAuB;;IAE5G,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAGA,cAAQ,CAAuB,SAAS,CAAC;AACrE,IAAA,MAAM,SAAS,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EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC;YAC5B,MAAM,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AACvE,YAAA,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC;AACvB,YAAA,YAAY,EAAE,CAAC,MAAM,KAAI;AACvB,gBAAA,IAAI,CAAC,MAAM;oBAAE,IAAI,CAAC,IAAI,CAAC;YACzB,CAAC;SACF;IACH,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,OAAO,EAAE;AACxD;;"}
|
|
@@ -20,12 +20,14 @@ export interface SidePanelState<T extends string> {
|
|
|
20
20
|
onOpenChange: (isOpen: boolean) => void;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* State for one `SidePanel` slot shared by several panels,
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* `SidePanel` `isOpen` and `onOpenChange`.
|
|
23
|
+
* State for one `SidePanel` slot shared by several panels, so only one is open at a time, with
|
|
24
|
+
* optional persistence so chosen panels reopen on the next visit. Pass each header button
|
|
25
|
+
* `active === id` and `toggle(id)`, and pass `SidePanel` `isOpen` and `onOpenChange`.
|
|
27
26
|
*
|
|
28
|
-
* @
|
|
27
|
+
* @param options `persist` lists the panel ids to remember in `localStorage`; omit it for
|
|
28
|
+
* session-only state.
|
|
29
|
+
* @returns The `active` panel, `isOpen`, and the `open`, `toggle`, `close` and `onOpenChange`
|
|
30
|
+
* handlers.
|
|
29
31
|
*/
|
|
30
32
|
export declare const useSidePanel: <T extends string>({ persist }?: UseSidePanelOptions<T>) => SidePanelState<T>;
|
|
31
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSidePanel/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACnD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM;IAC9C,mDAAmD;IACnD,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB,+FAA+F;IAC/F,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,sCAAsC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0FAA0F;IAC1F,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAMD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useSidePanel/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM;IACnD;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM;IAC9C,mDAAmD;IACnD,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC;IACjB,oEAAoE;IACpE,MAAM,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IACzB,+FAA+F;IAC/F,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,sCAAsC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,0FAA0F;IAC1F,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAMD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,MAAM,EAAE,cAAa,mBAAmB,CAAC,CAAC,CAAM,KAAG,cAAc,CAAC,CAAC,CA+CzG,CAAC"}
|
|
@@ -5,12 +5,14 @@ import { useState, useSyncExternalStore, useRef, useEffect, useMemo } from 'reac
|
|
|
5
5
|
const subscribeToNothing = () => () => { };
|
|
6
6
|
const isPersisted = (persist, panel) => persist?.some((id) => id === panel) ?? false;
|
|
7
7
|
/**
|
|
8
|
-
* State for one `SidePanel` slot shared by several panels,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `SidePanel` `isOpen` and `onOpenChange`.
|
|
8
|
+
* State for one `SidePanel` slot shared by several panels, so only one is open at a time, with
|
|
9
|
+
* optional persistence so chosen panels reopen on the next visit. Pass each header button
|
|
10
|
+
* `active === id` and `toggle(id)`, and pass `SidePanel` `isOpen` and `onOpenChange`.
|
|
12
11
|
*
|
|
13
|
-
* @
|
|
12
|
+
* @param options `persist` lists the panel ids to remember in `localStorage`; omit it for
|
|
13
|
+
* session-only state.
|
|
14
|
+
* @returns The `active` panel, `isOpen`, and the `open`, `toggle`, `close` and `onOpenChange`
|
|
15
|
+
* handlers.
|
|
14
16
|
*/
|
|
15
17
|
const useSidePanel = ({ persist } = {}) => {
|
|
16
18
|
// undefined until the user opens or closes a panel; until then the remembered panel shows.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/hooks/useSidePanel/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AA6BA,MAAM,kBAAkB,GAAG,MAAM,MAAK,EAAE,CAAC;AAEzC,MAAM,WAAW,GAAG,CAAmB,OAAiC,EAAE,KAAa,KAAiB,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,CAAC,IAAI,KAAK;AAEpJ
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/hooks/useSidePanel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Ae,KAAI;AAC/B,YAAA,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK;YAC7B,SAAS,CAAC,KAAK,CAAC;YAChB,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC,OAAO;YAC7C,IAAI,CAAC,SAAS,EAAE,MAAM;gBAAE;YACxB,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC;AAAE,gBAAA,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC;;gBAC3E,gBAAgB,CAAC,KAAK,EAAE;AAC/B,QAAA,CAAC;QAED,OAAO;YACL,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC;YAC5B,MAAM,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;AACvE,YAAA,KAAK,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC;AACvB,YAAA,YAAY,EAAE,CAAC,MAAM,KAAI;AACvB,gBAAA,IAAI,CAAC,MAAM;oBAAE,IAAI,CAAC,IAAI,CAAC;YACzB,CAAC;SACF;IACH,CAAC,EAAE,EAAE,CAAC;AAEN,IAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,EAAE,GAAG,OAAO,EAAE;AACxD;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* conditionals — so it composes cleanly:
|
|
2
|
+
* Merges Tailwind class strings so the last conflicting value wins; accepts strings, arrays
|
|
3
|
+
* and falsy values like tailwind-merge, and is pure JS so it works on web and React Native.
|
|
5
4
|
*
|
|
6
5
|
* cx('px-2', isActive && 'bg-primary', ['text-sm', null]);
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* `@flipdish/ui-library/utilities/cx`.
|
|
7
|
+
* @param inputs Class strings, arrays of them, or falsy values for conditionals.
|
|
8
|
+
* @returns One class string with conflicts resolved and falsy inputs dropped.
|
|
11
9
|
*/
|
|
12
10
|
export declare const cx: (...classLists: import("tailwind-merge").ClassNameValue[]) => string;
|
|
13
11
|
type ClassValue = string | number;
|
|
14
12
|
type ClassDefinition = Record<string, ClassValue | Record<string, ClassValue | Record<string, ClassValue>>>;
|
|
15
13
|
/**
|
|
16
|
-
* Identity helper
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* Identity helper so Tailwind IntelliSense recognises and sorts the class strings inside
|
|
15
|
+
* `*.styles.ts` maps.
|
|
16
|
+
*
|
|
17
|
+
* @param classes A style map of literal Tailwind class strings.
|
|
18
|
+
* @returns The same object, unchanged.
|
|
19
19
|
*/
|
|
20
20
|
export declare const sortCx: <T extends ClassDefinition>(classes: T) => T;
|
|
21
21
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/cx/index.ts"],"names":[],"mappings":"AAkBA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/cx/index.ts"],"names":[],"mappings":"AAkBA;;;;;;;;GAQG;AACH,eAAO,MAAM,EAAE,sEAAU,CAAC;AAE1B,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAClC,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,SAAS,eAAe,EAAE,SAAS,CAAC,KAAG,CAAY,CAAC"}
|
|
@@ -16,21 +16,21 @@ const twMerge = extendTailwindMerge({
|
|
|
16
16
|
},
|
|
17
17
|
});
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* conditionals — so it composes cleanly:
|
|
19
|
+
* Merges Tailwind class strings so the last conflicting value wins; accepts strings, arrays
|
|
20
|
+
* and falsy values like tailwind-merge, and is pure JS so it works on web and React Native.
|
|
22
21
|
*
|
|
23
22
|
* cx('px-2', isActive && 'bg-primary', ['text-sm', null]);
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `@flipdish/ui-library/utilities/cx`.
|
|
24
|
+
* @param inputs Class strings, arrays of them, or falsy values for conditionals.
|
|
25
|
+
* @returns One class string with conflicts resolved and falsy inputs dropped.
|
|
28
26
|
*/
|
|
29
27
|
const cx = twMerge;
|
|
30
28
|
/**
|
|
31
|
-
* Identity helper
|
|
32
|
-
*
|
|
33
|
-
*
|
|
29
|
+
* Identity helper so Tailwind IntelliSense recognises and sorts the class strings inside
|
|
30
|
+
* `*.styles.ts` maps.
|
|
31
|
+
*
|
|
32
|
+
* @param classes A style map of literal Tailwind class strings.
|
|
33
|
+
* @returns The same object, unchanged.
|
|
34
34
|
*/
|
|
35
35
|
const sortCx = (classes) => classes;
|
|
36
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/utilities/cx/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAClC,IAAA,MAAM,EAAE;AACN,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC;AAC5F,SAAA;AACF,KAAA;AACF,CAAA,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/utilities/cx/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;;;AAOG;AACH,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAClC,IAAA,MAAM,EAAE;AACN,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC;AAC5F,SAAA;AACF,KAAA;AACF,CAAA,CAAC;AAEF;;;;;;;;AAQG;AACI,MAAM,EAAE,GAAG;AAKlB;;;;;;AAMG;AACI,MAAM,MAAM,GAAG,CAA4B,OAAU,KAAQ;;"}
|
|
@@ -18,19 +18,45 @@
|
|
|
18
18
|
export declare const TEST_ID_PREFIX = "fd";
|
|
19
19
|
/** Separator placed between hierarchy levels (within a segment, use single `-`). */
|
|
20
20
|
export declare const TEST_ID_SEPARATOR = "--";
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Converts an arbitrary string into a kebab-case, testid-safe segment.
|
|
23
|
+
*
|
|
24
|
+
* @param value A label or id, in any case or punctuation.
|
|
25
|
+
* @returns Lower-case text with runs of non-alphanumerics collapsed to single hyphens.
|
|
26
|
+
*/
|
|
22
27
|
export declare const slugifyTestId: (value: string) => string;
|
|
23
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Builds a root-level testid, e.g. `rootTestId('sidebar-navigation')` ->
|
|
30
|
+
* `fd-sidebar-navigation`.
|
|
31
|
+
*
|
|
32
|
+
* @param kebabName The component's kebab-case name.
|
|
33
|
+
* @returns The name prefixed with `fd-`.
|
|
34
|
+
*/
|
|
24
35
|
export declare const rootTestId: (kebabName: string) => string;
|
|
25
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Appends a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` ->
|
|
38
|
+
* `fd-x--nav-item-orders`.
|
|
39
|
+
*
|
|
40
|
+
* @param prefix The ancestor's resolved testid.
|
|
41
|
+
* @param segment The child's own segment, already slugified.
|
|
42
|
+
* @returns The two joined with `--`.
|
|
43
|
+
*/
|
|
26
44
|
export declare const joinTestId: (prefix: string, segment: string) => string;
|
|
27
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Returns the override when provided, otherwise the fallback (explicit-child case).
|
|
47
|
+
*
|
|
48
|
+
* @param override A consumer-provided `data-testid`, if any.
|
|
49
|
+
* @param fallback The derived default to use without one.
|
|
50
|
+
* @returns Whichever applies.
|
|
51
|
+
*/
|
|
28
52
|
export declare const resolveTestId: (override: string | undefined, fallback: string) => string;
|
|
29
53
|
/**
|
|
30
|
-
* Spread helper for
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
54
|
+
* Spread helper for a resolved test id: `{ 'data-testid': value }` when present, else an empty
|
|
55
|
+
* object. Centralising it keeps the attribute name in one place so a React Native sibling can
|
|
56
|
+
* map it to `testID`.
|
|
57
|
+
*
|
|
58
|
+
* @param testId The resolved id, or `undefined` to emit nothing.
|
|
59
|
+
* @returns Props to spread onto the rendered element.
|
|
34
60
|
*/
|
|
35
61
|
export declare const testIdProps: (testId: string | undefined) => {
|
|
36
62
|
"data-testid"?: string;
|
|
@@ -39,7 +65,11 @@ export declare const testIdProps: (testId: string | undefined) => {
|
|
|
39
65
|
export declare const TestIdContext: import("react").Context<string | undefined>;
|
|
40
66
|
/** Provides a resolved testid as the prefix for descendant library components. */
|
|
41
67
|
export declare const TestIdProvider: import("react").Provider<string | undefined>;
|
|
42
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* Reads the testid prefix contributed by an ancestor component.
|
|
70
|
+
*
|
|
71
|
+
* @returns The ancestor's resolved testid, or `undefined` at the root.
|
|
72
|
+
*/
|
|
43
73
|
export declare const useTestIdPrefix: () => string | undefined;
|
|
44
74
|
export interface UseResolvedTestIdOptions {
|
|
45
75
|
/** Consumer-provided override; wins over any derived value. */
|
|
@@ -50,8 +80,12 @@ export interface UseResolvedTestIdOptions {
|
|
|
50
80
|
rootName: string;
|
|
51
81
|
}
|
|
52
82
|
/**
|
|
53
|
-
*
|
|
83
|
+
* Resolves a component's testid: an explicit override wins; otherwise derive
|
|
54
84
|
* `<ancestorPrefix>--<segment>` when nested, or `fd-<rootName>` at the root.
|
|
85
|
+
*
|
|
86
|
+
* @param options The consumer `testId` override, the component's `segment`, and its
|
|
87
|
+
* `rootName`.
|
|
88
|
+
* @returns The id to render as `data-testid`.
|
|
55
89
|
*/
|
|
56
90
|
export declare const useResolvedTestId: ({ testId, segment, rootName }: UseResolvedTestIdOptions) => string;
|
|
57
91
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/testIdUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,sDAAsD;AACtD,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utilities/testIdUtils/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,sDAAsD;AACtD,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAKlB,CAAC;AAE7B;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,KAAG,MAA0C,CAAC;AAE1F;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,MAAM,EAAE,SAAS,MAAM,KAAG,MAAmD,CAAC;AAEjH;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,MAAM,GAAG,SAAS,EAAE,UAAU,MAAM,KAAG,MAA8B,CAAC;AAE9G;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG;IAAE,aAAa,CAAC,EAAE,MAAM,CAAA;CAA+C,CAAC;AAEjI,kGAAkG;AAClG,eAAO,MAAM,aAAa,6CAA+C,CAAC;AAE1E,kFAAkF;AAClF,eAAO,MAAM,cAAc,8CAAyB,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,SAAsC,CAAC;AAEnF,MAAM,WAAW,wBAAwB;IACvC,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,+BAA+B,wBAAwB,KAAG,MAG3F,CAAC"}
|
|
@@ -20,34 +20,68 @@ import { createContext, useContext } from 'react';
|
|
|
20
20
|
const TEST_ID_PREFIX = 'fd';
|
|
21
21
|
/** Separator placed between hierarchy levels (within a segment, use single `-`). */
|
|
22
22
|
const TEST_ID_SEPARATOR = '--';
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Converts an arbitrary string into a kebab-case, testid-safe segment.
|
|
25
|
+
*
|
|
26
|
+
* @param value A label or id, in any case or punctuation.
|
|
27
|
+
* @returns Lower-case text with runs of non-alphanumerics collapsed to single hyphens.
|
|
28
|
+
*/
|
|
24
29
|
const slugifyTestId = (value) => value
|
|
25
30
|
.toLowerCase()
|
|
26
31
|
.trim()
|
|
27
32
|
.replace(/[^a-z0-9]+/g, '-')
|
|
28
33
|
.replace(/^-+|-+$/g, '');
|
|
29
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Builds a root-level testid, e.g. `rootTestId('sidebar-navigation')` ->
|
|
36
|
+
* `fd-sidebar-navigation`.
|
|
37
|
+
*
|
|
38
|
+
* @param kebabName The component's kebab-case name.
|
|
39
|
+
* @returns The name prefixed with `fd-`.
|
|
40
|
+
*/
|
|
30
41
|
const rootTestId = (kebabName) => `${TEST_ID_PREFIX}-${kebabName}`;
|
|
31
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Appends a child segment to a parent testid, e.g. `joinTestId('fd-x', 'nav-item-orders')` ->
|
|
44
|
+
* `fd-x--nav-item-orders`.
|
|
45
|
+
*
|
|
46
|
+
* @param prefix The ancestor's resolved testid.
|
|
47
|
+
* @param segment The child's own segment, already slugified.
|
|
48
|
+
* @returns The two joined with `--`.
|
|
49
|
+
*/
|
|
32
50
|
const joinTestId = (prefix, segment) => `${prefix}${TEST_ID_SEPARATOR}${segment}`;
|
|
33
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Returns the override when provided, otherwise the fallback (explicit-child case).
|
|
53
|
+
*
|
|
54
|
+
* @param override A consumer-provided `data-testid`, if any.
|
|
55
|
+
* @param fallback The derived default to use without one.
|
|
56
|
+
* @returns Whichever applies.
|
|
57
|
+
*/
|
|
34
58
|
const resolveTestId = (override, fallback) => override ?? fallback;
|
|
35
59
|
/**
|
|
36
|
-
* Spread helper for
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
60
|
+
* Spread helper for a resolved test id: `{ 'data-testid': value }` when present, else an empty
|
|
61
|
+
* object. Centralising it keeps the attribute name in one place so a React Native sibling can
|
|
62
|
+
* map it to `testID`.
|
|
63
|
+
*
|
|
64
|
+
* @param testId The resolved id, or `undefined` to emit nothing.
|
|
65
|
+
* @returns Props to spread onto the rendered element.
|
|
40
66
|
*/
|
|
41
67
|
const testIdProps = (testId) => (testId ? { 'data-testid': testId } : {});
|
|
42
68
|
/** Context carrying the current resolved testid, used as the prefix for descendant components. */
|
|
43
69
|
const TestIdContext = createContext(undefined);
|
|
44
70
|
/** Provides a resolved testid as the prefix for descendant library components. */
|
|
45
71
|
const TestIdProvider = TestIdContext.Provider;
|
|
46
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Reads the testid prefix contributed by an ancestor component.
|
|
74
|
+
*
|
|
75
|
+
* @returns The ancestor's resolved testid, or `undefined` at the root.
|
|
76
|
+
*/
|
|
47
77
|
const useTestIdPrefix = () => useContext(TestIdContext);
|
|
48
78
|
/**
|
|
49
|
-
*
|
|
79
|
+
* Resolves a component's testid: an explicit override wins; otherwise derive
|
|
50
80
|
* `<ancestorPrefix>--<segment>` when nested, or `fd-<rootName>` at the root.
|
|
81
|
+
*
|
|
82
|
+
* @param options The consumer `testId` override, the component's `segment`, and its
|
|
83
|
+
* `rootName`.
|
|
84
|
+
* @returns The id to render as `data-testid`.
|
|
51
85
|
*/
|
|
52
86
|
const useResolvedTestId = ({ testId, segment, rootName }) => {
|
|
53
87
|
const prefix = useTestIdPrefix();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/utilities/testIdUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,iBAAiB,GAAG;AAEjC;
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/utilities/testIdUtils/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;;;;;;;;;;;;;AAeG;AAEH;AACO,MAAM,cAAc,GAAG;AAE9B;AACO,MAAM,iBAAiB,GAAG;AAEjC;;;;;AAKG;MACU,aAAa,GAAG,CAAC,KAAa,KACzC;AACG,KAAA,WAAW;AACX,KAAA,IAAI;AACJ,KAAA,OAAO,CAAC,aAAa,EAAE,GAAG;AAC1B,KAAA,OAAO,CAAC,UAAU,EAAE,EAAE;AAE3B;;;;;;AAMG;AACI,MAAM,UAAU,GAAG,CAAC,SAAiB,KAAa,CAAA,EAAG,cAAc,CAAA,CAAA,EAAI,SAAS;AAEvF;;;;;;;AAOG;AACI,MAAM,UAAU,GAAG,CAAC,MAAc,EAAE,OAAe,KAAa,GAAG,MAAM,CAAA,EAAG,iBAAiB,CAAA,EAAG,OAAO;AAE9G;;;;;;AAMG;AACI,MAAM,aAAa,GAAG,CAAC,QAA4B,EAAE,QAAgB,KAAa,QAAQ,IAAI;AAErG;;;;;;;AAOG;AACI,MAAM,WAAW,GAAG,CAAC,MAA0B,MAAkC,MAAM,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,EAAE;AAE/H;MACa,aAAa,GAAG,aAAa,CAAqB,SAAS;AAExE;AACO,MAAM,cAAc,GAAG,aAAa,CAAC;AAE5C;;;;AAIG;AACI,MAAM,eAAe,GAAG,MAA0B,UAAU,CAAC,aAAa;AAWjF;;;;;;;AAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAA4B,KAAY;AACnG,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;IAChC,OAAO,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;AAChF;;"}
|
|
@@ -5,15 +5,13 @@ var cx = require('@flipdish/ui-library/utilities/cx');
|
|
|
5
5
|
var reactErrorBoundary = require('react-error-boundary');
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* (reporting is injected via `onError` to keep the library cross-platform).
|
|
8
|
+
* Catches render errors in its subtree and shows a fallback instead of crashing the app, as a
|
|
9
|
+
* thin wrapper around `react-error-boundary` so apps depend on one ui-library seam. Reporting
|
|
10
|
+
* is injected through `onError`, which keeps the boundary cross-platform.
|
|
12
11
|
*
|
|
13
|
-
*
|
|
14
|
-
* behavioural wrapper, not a UI primitive. The boundary logic is RN-safe; the default
|
|
15
|
-
* fallback renders a `<div>`, so an `index.native.tsx` sibling is needed before RN use.
|
|
12
|
+
* @summary render error boundary with a fallback and onError reporting
|
|
16
13
|
*/
|
|
14
|
+
// The default fallback renders a <div>, so an index.native.tsx sibling is needed before React Native use.
|
|
17
15
|
const ErrorBoundary = ({ identifier, children, fallback, renderFallback, somethingWentWrongText = 'Something went wrong', onError, className, }) => {
|
|
18
16
|
return (jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary, { fallbackRender: ({ error }) => {
|
|
19
17
|
// Use `undefined` (not nullish) checks so an explicit `null` from
|