@simplybusiness/mobius 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/components/Combobox/Combobox.js +35 -22
- package/dist/cjs/components/Combobox/Combobox.js.map +1 -1
- package/dist/cjs/components/Combobox/Listbox.js +2 -4
- package/dist/cjs/components/Combobox/Listbox.js.map +1 -1
- package/dist/cjs/components/Combobox/fixtures.js +195 -4
- package/dist/cjs/components/Combobox/fixtures.js.map +1 -1
- package/dist/cjs/components/Combobox/useComboboxOptions.js +69 -0
- package/dist/cjs/components/Combobox/useComboboxOptions.js.map +1 -0
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js +2 -1
- package/dist/cjs/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useDebouncedValue/index.js +20 -0
- package/dist/cjs/hooks/useDebouncedValue/index.js.map +1 -0
- package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js +36 -0
- package/dist/cjs/hooks/useDebouncedValue/useDebouncedValue.js.map +1 -0
- package/dist/cjs/hooks/useOnUnmount/index.js +20 -0
- package/dist/cjs/hooks/useOnUnmount/index.js.map +1 -0
- package/dist/cjs/hooks/useOnUnmount/useOnUnmount.js +27 -0
- package/dist/cjs/hooks/useOnUnmount/useOnUnmount.js.map +1 -0
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/components/Combobox/Combobox.js +37 -24
- package/dist/esm/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/components/Combobox/Listbox.js +2 -4
- package/dist/esm/components/Combobox/Listbox.js.map +1 -1
- package/dist/esm/components/Combobox/fixtures.js +189 -1
- package/dist/esm/components/Combobox/fixtures.js.map +1 -1
- package/dist/esm/components/Combobox/types.js.map +1 -1
- package/dist/esm/components/Combobox/useComboboxOptions.js +59 -0
- package/dist/esm/components/Combobox/useComboboxOptions.js.map +1 -0
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +2 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useDebouncedValue/index.js +3 -0
- package/dist/esm/hooks/useDebouncedValue/index.js.map +1 -0
- package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js +26 -0
- package/dist/esm/hooks/useDebouncedValue/useDebouncedValue.js.map +1 -0
- package/dist/esm/hooks/useOnUnmount/index.js +3 -0
- package/dist/esm/hooks/useOnUnmount/index.js.map +1 -0
- package/dist/esm/hooks/useOnUnmount/useOnUnmount.js +17 -0
- package/dist/esm/hooks/useOnUnmount/useOnUnmount.js.map +1 -0
- package/dist/types/components/Combobox/Combobox.stories.d.ts +1 -0
- package/dist/types/components/Combobox/Listbox.d.ts +1 -2
- package/dist/types/components/Combobox/fixtures.d.ts +8 -1
- package/dist/types/components/Combobox/types.d.ts +1 -1
- package/dist/types/components/Combobox/useComboboxOptions.d.ts +10 -0
- package/dist/types/components/Combobox/useComboboxOptions.test.d.ts +1 -0
- package/dist/types/components/VisuallyHidden/VisuallyHidden.d.ts +3 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/useDebouncedValue/index.d.ts +1 -0
- package/dist/types/hooks/useDebouncedValue/useDebouncedValue.d.ts +1 -0
- package/dist/types/hooks/useDebouncedValue/useDebouncedValue.test.d.ts +1 -0
- package/dist/types/hooks/useOnUnmount/index.d.ts +1 -0
- package/dist/types/hooks/useOnUnmount/useOnUnmount.d.ts +1 -0
- package/dist/types/hooks/useOnUnmount/useOnUnmount.test.d.ts +1 -0
- package/package.json +2 -2
- package/src/components/Combobox/Combobox.css +1 -1
- package/src/components/Combobox/Combobox.stories.tsx +26 -2
- package/src/components/Combobox/Combobox.test.tsx +679 -732
- package/src/components/Combobox/Combobox.tsx +44 -22
- package/src/components/Combobox/Listbox.tsx +1 -5
- package/src/components/Combobox/fixtures.tsx +58 -1
- package/src/components/Combobox/loading-dots.svg +27 -0
- package/src/components/Combobox/types.tsx +1 -1
- package/src/components/Combobox/useComboboxOptions.test.ts +423 -0
- package/src/components/Combobox/useComboboxOptions.ts +67 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +10 -2
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/useDebouncedValue/index.tsx +1 -0
- package/src/hooks/useDebouncedValue/useDebouncedValue.test.tsx +62 -0
- package/src/hooks/useDebouncedValue/useDebouncedValue.tsx +25 -0
- package/src/hooks/useOnUnmount/index.tsx +1 -0
- package/src/hooks/useOnUnmount/useOnUnmount.test.tsx +37 -0
- package/src/hooks/useOnUnmount/useOnUnmount.tsx +19 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/index.tsx"],"sourcesContent":["export * from \"./useBodyScrollLock\";\nexport * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDeprecationWarning\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useOnClickOutside\";\nexport * from \"./usePrefersReducedMotion\";\nexport * from \"./useRenderCount\";\nexport * from \"./useTextField\";\nexport * from \"./useValidationClasses\";\nexport * from \"./useWindowEvent\";\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
1
|
+
{"version":3,"sources":["../../../src/hooks/index.tsx"],"sourcesContent":["export * from \"./useBodyScrollLock\";\nexport * from \"./useBreakpoint\";\nexport * from \"./useButton\";\nexport * from \"./useDebouncedValue\";\nexport * from \"./useDeprecationWarning\";\nexport * from \"./useDialog\";\nexport * from \"./useDialogPolyfill\";\nexport * from \"./useLabel\";\nexport * from \"./useOnClickOutside\";\nexport * from \"./useOnUnmount\";\nexport * from \"./usePrefersReducedMotion\";\nexport * from \"./useRenderCount\";\nexport * from \"./useTextField\";\nexport * from \"./useValidationClasses\";\nexport * from \"./useWindowEvent\";\n"],"names":[],"mappings":";;;;qBAAc;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA;qBACA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./useDebouncedValue"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hooks/useDebouncedValue/index.tsx"],"sourcesContent":["export * from \"./useDebouncedValue\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useDebouncedValue", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useDebouncedValue;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
function useDebouncedValue(value, delay = 0) {
|
|
13
|
+
const [debouncedValue, setDebouncedValue] = (0, _react.useState)(value);
|
|
14
|
+
(0, _react.useEffect)(()=>{
|
|
15
|
+
let timeout = null;
|
|
16
|
+
if (delay === 0) {
|
|
17
|
+
setDebouncedValue(value);
|
|
18
|
+
} else {
|
|
19
|
+
timeout = setTimeout(()=>{
|
|
20
|
+
setDebouncedValue(value);
|
|
21
|
+
}, delay);
|
|
22
|
+
}
|
|
23
|
+
return ()=>{
|
|
24
|
+
if (timeout) {
|
|
25
|
+
clearTimeout(timeout);
|
|
26
|
+
timeout = null;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}, [
|
|
30
|
+
value,
|
|
31
|
+
delay
|
|
32
|
+
]);
|
|
33
|
+
return debouncedValue;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=useDebouncedValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hooks/useDebouncedValue/useDebouncedValue.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\n\nexport function useDebouncedValue<T>(value: T, delay: number = 0): T {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n let timeout: NodeJS.Timeout | null = null;\n if (delay === 0) {\n setDebouncedValue(value);\n } else {\n timeout = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n }\n\n return () => {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n };\n }, [value, delay]);\n\n return debouncedValue;\n}\n"],"names":["useDebouncedValue","value","delay","debouncedValue","setDebouncedValue","useState","useEffect","timeout","setTimeout","clearTimeout"],"mappings":";;;;+BAEgBA;;;eAAAA;;;uBAFoB;AAE7B,SAASA,kBAAqBC,KAAQ,EAAEC,QAAgB,CAAC;IAC9D,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,IAAAA,eAAQ,EAACJ;IAErDK,IAAAA,gBAAS,EAAC;QACR,IAAIC,UAAiC;QACrC,IAAIL,UAAU,GAAG;YACfE,kBAAkBH;QACpB,OAAO;YACLM,UAAUC,WAAW;gBACnBJ,kBAAkBH;YACpB,GAAGC;QACL;QAEA,OAAO;YACL,IAAIK,SAAS;gBACXE,aAAaF;gBACbA,UAAU;YACZ;QACF;IACF,GAAG;QAACN;QAAOC;KAAM;IAEjB,OAAOC;AACT"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./useOnUnmount"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hooks/useOnUnmount/index.tsx"],"sourcesContent":["export * from \"./useOnUnmount\";\n"],"names":[],"mappings":";;;;qBAAc"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useOnUnmount", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useOnUnmount;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _react = require("react");
|
|
12
|
+
function useOnUnmount(callback) {
|
|
13
|
+
const callbackRef = (0, _react.useRef)(callback);
|
|
14
|
+
// Update the ref each render so it always has the latest callback.
|
|
15
|
+
// This allows the callback to change while the component is mounted
|
|
16
|
+
// without it being called repeatedly.
|
|
17
|
+
(0, _react.useEffect)(()=>{
|
|
18
|
+
callbackRef.current = callback;
|
|
19
|
+
}, [
|
|
20
|
+
callback
|
|
21
|
+
]);
|
|
22
|
+
(0, _react.useEffect)(()=>()=>{
|
|
23
|
+
callbackRef.current();
|
|
24
|
+
}, []);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=useOnUnmount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/hooks/useOnUnmount/useOnUnmount.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nexport function useOnUnmount(callback: () => void) {\n const callbackRef = useRef(callback);\n\n // Update the ref each render so it always has the latest callback.\n // This allows the callback to change while the component is mounted\n // without it being called repeatedly.\n useEffect(() => {\n callbackRef.current = callback;\n }, [callback]);\n\n useEffect(\n () => () => {\n callbackRef.current();\n },\n [],\n );\n}\n"],"names":["useOnUnmount","callback","callbackRef","useRef","useEffect","current"],"mappings":";;;;+BAEgBA;;;eAAAA;;;uBAFkB;AAE3B,SAASA,aAAaC,QAAoB;IAC/C,MAAMC,cAAcC,IAAAA,aAAM,EAACF;IAE3B,mEAAmE;IACnE,oEAAoE;IACpE,sCAAsC;IACtCG,IAAAA,gBAAS,EAAC;QACRF,YAAYG,OAAO,GAAGJ;IACxB,GAAG;QAACA;KAAS;IAEbG,IAAAA,gBAAS,EACP,IAAM;YACJF,YAAYG,OAAO;QACrB,GACA,EAAE;AAEN"}
|