@cdx-ui/utils 0.0.1-alpha.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.
Files changed (108) hide show
  1. package/README.md +11 -0
  2. package/lib/commonjs/common/accessibilityUtils.js +9 -0
  3. package/lib/commonjs/common/accessibilityUtils.js.map +1 -0
  4. package/lib/commonjs/common/cn.js +12 -0
  5. package/lib/commonjs/common/cn.js.map +1 -0
  6. package/lib/commonjs/common/composeEventHandlers.js +14 -0
  7. package/lib/commonjs/common/composeEventHandlers.js.map +1 -0
  8. package/lib/commonjs/common/getSpacedChild.js +27 -0
  9. package/lib/commonjs/common/getSpacedChild.js.map +1 -0
  10. package/lib/commonjs/common/index.js +48 -0
  11. package/lib/commonjs/common/index.js.map +1 -0
  12. package/lib/commonjs/common/mergeRefs.js +18 -0
  13. package/lib/commonjs/common/mergeRefs.js.map +1 -0
  14. package/lib/commonjs/common/useControllableState.js +65 -0
  15. package/lib/commonjs/common/useControllableState.js.map +1 -0
  16. package/lib/commonjs/context/createContext.js +31 -0
  17. package/lib/commonjs/context/createContext.js.map +1 -0
  18. package/lib/commonjs/context/index.js +13 -0
  19. package/lib/commonjs/context/index.js.map +1 -0
  20. package/lib/commonjs/form-control/index.js +25 -0
  21. package/lib/commonjs/form-control/index.js.map +1 -0
  22. package/lib/commonjs/form-control/useFormControl.js +51 -0
  23. package/lib/commonjs/form-control/useFormControl.js.map +1 -0
  24. package/lib/commonjs/index.js +50 -0
  25. package/lib/commonjs/index.js.map +1 -0
  26. package/lib/commonjs/package.json +1 -0
  27. package/lib/commonjs/style/context/index.js +18 -0
  28. package/lib/commonjs/style/context/index.js.map +1 -0
  29. package/lib/commonjs/style/index.js +28 -0
  30. package/lib/commonjs/style/index.js.map +1 -0
  31. package/lib/commonjs/style/withStyleContext/index.js +33 -0
  32. package/lib/commonjs/style/withStyleContext/index.js.map +1 -0
  33. package/lib/module/common/accessibilityUtils.js +4 -0
  34. package/lib/module/common/accessibilityUtils.js.map +1 -0
  35. package/lib/module/common/cn.js +8 -0
  36. package/lib/module/common/cn.js.map +1 -0
  37. package/lib/module/common/composeEventHandlers.js +10 -0
  38. package/lib/module/common/composeEventHandlers.js.map +1 -0
  39. package/lib/module/common/getSpacedChild.js +22 -0
  40. package/lib/module/common/getSpacedChild.js.map +1 -0
  41. package/lib/module/common/index.js +9 -0
  42. package/lib/module/common/index.js.map +1 -0
  43. package/lib/module/common/mergeRefs.js +14 -0
  44. package/lib/module/common/mergeRefs.js.map +1 -0
  45. package/lib/module/common/useControllableState.js +62 -0
  46. package/lib/module/common/useControllableState.js.map +1 -0
  47. package/lib/module/context/createContext.js +27 -0
  48. package/lib/module/context/createContext.js.map +1 -0
  49. package/lib/module/context/index.js +4 -0
  50. package/lib/module/context/index.js.map +1 -0
  51. package/lib/module/form-control/index.js +4 -0
  52. package/lib/module/form-control/index.js.map +1 -0
  53. package/lib/module/form-control/useFormControl.js +43 -0
  54. package/lib/module/form-control/useFormControl.js.map +1 -0
  55. package/lib/module/index.js +7 -0
  56. package/lib/module/index.js.map +1 -0
  57. package/lib/module/style/context/index.js +12 -0
  58. package/lib/module/style/context/index.js.map +1 -0
  59. package/lib/module/style/index.js +5 -0
  60. package/lib/module/style/index.js.map +1 -0
  61. package/lib/module/style/withStyleContext/index.js +28 -0
  62. package/lib/module/style/withStyleContext/index.js.map +1 -0
  63. package/lib/typescript/common/accessibilityUtils.d.ts +2 -0
  64. package/lib/typescript/common/accessibilityUtils.d.ts.map +1 -0
  65. package/lib/typescript/common/cn.d.ts +3 -0
  66. package/lib/typescript/common/cn.d.ts.map +1 -0
  67. package/lib/typescript/common/composeEventHandlers.d.ts +2 -0
  68. package/lib/typescript/common/composeEventHandlers.d.ts.map +1 -0
  69. package/lib/typescript/common/getSpacedChild.d.ts +5 -0
  70. package/lib/typescript/common/getSpacedChild.d.ts.map +1 -0
  71. package/lib/typescript/common/index.d.ts +7 -0
  72. package/lib/typescript/common/index.d.ts.map +1 -0
  73. package/lib/typescript/common/mergeRefs.d.ts +3 -0
  74. package/lib/typescript/common/mergeRefs.d.ts.map +1 -0
  75. package/lib/typescript/common/useControllableState.d.ts +8 -0
  76. package/lib/typescript/common/useControllableState.d.ts.map +1 -0
  77. package/lib/typescript/context/createContext.d.ts +6 -0
  78. package/lib/typescript/context/createContext.d.ts.map +1 -0
  79. package/lib/typescript/context/index.d.ts +2 -0
  80. package/lib/typescript/context/index.d.ts.map +1 -0
  81. package/lib/typescript/form-control/index.d.ts +2 -0
  82. package/lib/typescript/form-control/index.d.ts.map +1 -0
  83. package/lib/typescript/form-control/useFormControl.d.ts +38 -0
  84. package/lib/typescript/form-control/useFormControl.d.ts.map +1 -0
  85. package/lib/typescript/index.d.ts +5 -0
  86. package/lib/typescript/index.d.ts.map +1 -0
  87. package/lib/typescript/style/context/index.d.ts +5 -0
  88. package/lib/typescript/style/context/index.d.ts.map +1 -0
  89. package/lib/typescript/style/index.d.ts +3 -0
  90. package/lib/typescript/style/index.d.ts.map +1 -0
  91. package/lib/typescript/style/withStyleContext/index.d.ts +6 -0
  92. package/lib/typescript/style/withStyleContext/index.d.ts.map +1 -0
  93. package/package.json +65 -0
  94. package/src/common/accessibilityUtils.ts +1 -0
  95. package/src/common/cn.ts +6 -0
  96. package/src/common/composeEventHandlers.ts +7 -0
  97. package/src/common/getSpacedChild.tsx +32 -0
  98. package/src/common/index.ts +6 -0
  99. package/src/common/mergeRefs.ts +13 -0
  100. package/src/common/useControllableState.ts +75 -0
  101. package/src/context/createContext.tsx +27 -0
  102. package/src/context/index.ts +1 -0
  103. package/src/form-control/index.ts +8 -0
  104. package/src/form-control/useFormControl.tsx +63 -0
  105. package/src/index.ts +4 -0
  106. package/src/style/context/index.tsx +14 -0
  107. package/src/style/index.tsx +2 -0
  108. package/src/style/withStyleContext/index.tsx +36 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @cdx-ui/utils
2
+
3
+ Shared utilities used across CDS packages.
4
+
5
+ Provides common helpers for styling, platform detection, and other cross-cutting concerns used by [`@cdx-ui/primitives`](../primitives/) and [`@cdx-ui/components`](../components/).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @cdx-ui/utils
11
+ ```
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ariaAttr = void 0;
7
+ const ariaAttr = condition => condition ? true : undefined;
8
+ exports.ariaAttr = ariaAttr;
9
+ //# sourceMappingURL=accessibilityUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ariaAttr","condition","undefined","exports"],"sourceRoot":"../../../src","sources":["common/accessibilityUtils.ts"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAIC,SAA8B,IAAMA,SAAS,GAAG,IAAI,GAAGC,SAAU;AAACC,OAAA,CAAAH,QAAA,GAAAA,QAAA","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cn = cn;
7
+ var _clsx = require("clsx");
8
+ var _tailwindMerge = require("tailwind-merge");
9
+ function cn(...inputs) {
10
+ return (0, _tailwindMerge.twMerge)((0, _clsx.clsx)(inputs));
11
+ }
12
+ //# sourceMappingURL=cn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_clsx","require","_tailwindMerge","cn","inputs","twMerge","clsx"],"sourceRoot":"../../../src","sources":["common/cn.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,SAASE,EAAEA,CAAC,GAAGC,MAAoB,EAAE;EAC1C,OAAO,IAAAC,sBAAO,EAAC,IAAAC,UAAI,EAACF,MAAM,CAAC,CAAC;AAC9B","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.composeEventHandlers = composeEventHandlers;
7
+ function composeEventHandlers(...args) {
8
+ return function handleEvent(event) {
9
+ for (let i = 0; i < args.length; i++) {
10
+ args[i]?.(event);
11
+ }
12
+ };
13
+ }
14
+ //# sourceMappingURL=composeEventHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["composeEventHandlers","args","handleEvent","event","i","length"],"sourceRoot":"../../../src","sources":["common/composeEventHandlers.ts"],"mappings":";;;;;;AAAO,SAASA,oBAAoBA,CAAI,GAAGC,IAAiD,EAAE;EAC5F,OAAO,SAASC,WAAWA,CAACC,KAAQ,EAAE;IACpC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;MACpCH,IAAI,CAACG,CAAC,CAAC,GAAGD,KAAK,CAAC;IAClB;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.flattenChildren = flattenChildren;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
+ // TODO: Rename file
10
+
11
+ function flattenChildren(children, keys = []) {
12
+ const childrenArray = _react.default.Children.toArray(children);
13
+ return childrenArray.reduce((flatChildren, child, index) => {
14
+ if (/*#__PURE__*/_react.default.isValidElement(child) && child.type === _react.default.Fragment) {
15
+ return flatChildren.concat(flattenChildren(child.props.children, keys.concat(child.key || index)));
16
+ }
17
+ if (/*#__PURE__*/_react.default.isValidElement(child)) {
18
+ flatChildren.push(/*#__PURE__*/_react.default.cloneElement(child, {
19
+ key: keys.concat(String(child.key || index)).join('.')
20
+ }));
21
+ } else {
22
+ flatChildren.push(child);
23
+ }
24
+ return flatChildren;
25
+ }, []);
26
+ }
27
+ //# sourceMappingURL=getSpacedChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","e","__esModule","default","flattenChildren","children","keys","childrenArray","React","Children","toArray","reduce","flatChildren","child","index","isValidElement","type","Fragment","concat","props","key","push","cloneElement","String","join"],"sourceRoot":"../../../src","sources":["common/getSpacedChild.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAI1B;;AAEO,SAASG,eAAeA,CAC7BC,QAAyB,EACzBC,IAAyB,GAAG,EAAE,EACb;EACjB,MAAMC,aAAa,GAAGC,cAAK,CAACC,QAAQ,CAACC,OAAO,CAACL,QAAQ,CAAC;EACtD,OAAOE,aAAa,CAACI,MAAM,CAAC,CAACC,YAA6B,EAAEC,KAAK,EAAEC,KAAa,KAAK;IACnF,IACE,aAAAN,cAAK,CAACO,cAAc,CAAiCF,KAAK,CAAC,IAC3DA,KAAK,CAACG,IAAI,KAAKR,cAAK,CAACS,QAAQ,EAC7B;MACA,OAAOL,YAAY,CAACM,MAAM,CACxBd,eAAe,CAACS,KAAK,CAACM,KAAK,CAACd,QAAQ,EAAEC,IAAI,CAACY,MAAM,CAACL,KAAK,CAACO,GAAG,IAAIN,KAAK,CAAC,CACvE,CAAC;IACH;IACA,iBAAIN,cAAK,CAACO,cAAc,CAACF,KAAK,CAAC,EAAE;MAC/BD,YAAY,CAACS,IAAI,cACfb,cAAK,CAACc,YAAY,CAACT,KAAK,EAAE;QACxBO,GAAG,EAAEd,IAAI,CAACY,MAAM,CAACK,MAAM,CAACV,KAAK,CAACO,GAAG,IAAIN,KAAK,CAAC,CAAC,CAACU,IAAI,CAAC,GAAG;MACvD,CAAC,CACH,CAAC;IACH,CAAC,MAAM;MACLZ,YAAY,CAACS,IAAI,CAACR,KAAK,CAAC;IAC1B;IACA,OAAOD,YAAY;EACrB,CAAC,EAAE,EAAE,CAAC;AACR","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ariaAttr", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _accessibilityUtils.ariaAttr;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "cn", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _cn.cn;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "composeEventHandlers", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _composeEventHandlers.composeEventHandlers;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "flattenChildren", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _getSpacedChild.flattenChildren;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "mergeRefs", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _mergeRefs.mergeRefs;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "useControllableState", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _useControllableState.useControllableState;
40
+ }
41
+ });
42
+ var _accessibilityUtils = require("./accessibilityUtils");
43
+ var _cn = require("./cn");
44
+ var _composeEventHandlers = require("./composeEventHandlers");
45
+ var _getSpacedChild = require("./getSpacedChild");
46
+ var _mergeRefs = require("./mergeRefs");
47
+ var _useControllableState = require("./useControllableState");
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_accessibilityUtils","require","_cn","_composeEventHandlers","_getSpacedChild","_mergeRefs","_useControllableState"],"sourceRoot":"../../../src","sources":["common/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,GAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,qBAAA,GAAAL,OAAA","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.mergeRefs = mergeRefs;
7
+ function mergeRefs(...refs) {
8
+ return value => {
9
+ for (const ref of refs) {
10
+ if (typeof ref === 'function') {
11
+ ref(value);
12
+ } else if (ref != null) {
13
+ ref.current = value;
14
+ }
15
+ }
16
+ };
17
+ }
18
+ //# sourceMappingURL=mergeRefs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mergeRefs","refs","value","ref","current"],"sourceRoot":"../../../src","sources":["common/mergeRefs.ts"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAI,GAAGC,IAA4B,EAAkB;EAC5E,OAAQC,KAAe,IAAK;IAC1B,KAAK,MAAMC,GAAG,IAAIF,IAAI,EAAE;MACtB,IAAI,OAAOE,GAAG,KAAK,UAAU,EAAE;QAC7BA,GAAG,CAACD,KAAK,CAAC;MACZ,CAAC,MAAM,IAAIC,GAAG,IAAI,IAAI,EAAE;QACtBA,GAAG,CAACC,OAAO,GAAGF,KAAK;MACrB;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useControllableState = useControllableState;
7
+ var _react = require("react");
8
+ // This project uses code from WorkOS/Radix Primitives.
9
+ // The code is licensed under the MIT License.
10
+ // https://github.com/radix-ui/primitives/tree/main
11
+
12
+ function useControllableState({
13
+ prop,
14
+ defaultProp,
15
+ onChange = () => {}
16
+ }) {
17
+ const [uncontrolledProp, setUncontrolledProp] = useUncontrolledState({
18
+ defaultProp,
19
+ onChange
20
+ });
21
+ const isControlled = prop !== undefined;
22
+ const value = isControlled ? prop : uncontrolledProp;
23
+ const handleChange = useCallbackRef(onChange);
24
+ const setValue = (0, _react.useCallback)(nextValue => {
25
+ if (isControlled) {
26
+ const setter = nextValue;
27
+ const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
28
+ if (value !== prop) handleChange(value);
29
+ } else {
30
+ setUncontrolledProp(nextValue);
31
+ }
32
+ }, [isControlled, prop, setUncontrolledProp, handleChange]);
33
+ return [value, setValue];
34
+ }
35
+ function useUncontrolledState({
36
+ defaultProp,
37
+ onChange
38
+ }) {
39
+ const uncontrolledState = (0, _react.useState)(defaultProp);
40
+ const [value] = uncontrolledState;
41
+ const prevValueRef = (0, _react.useRef)(value);
42
+ const handleChange = useCallbackRef(onChange);
43
+ (0, _react.useEffect)(() => {
44
+ if (prevValueRef.current !== value) {
45
+ handleChange(value);
46
+ prevValueRef.current = value;
47
+ }
48
+ }, [value, prevValueRef, handleChange]);
49
+ return uncontrolledState;
50
+ }
51
+
52
+ /**
53
+ * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
54
+ * prop or avoid re-executing effects when passed as a dependency
55
+ */
56
+ function useCallbackRef(callback) {
57
+ const callbackRef = (0, _react.useRef)(callback);
58
+ (0, _react.useEffect)(() => {
59
+ callbackRef.current = callback;
60
+ });
61
+
62
+ // https://github.com/facebook/react/issues/19240
63
+ return (0, _react.useMemo)(() => (...args) => callbackRef.current?.(...args), []);
64
+ }
65
+ //# sourceMappingURL=useControllableState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","useControllableState","prop","defaultProp","onChange","uncontrolledProp","setUncontrolledProp","useUncontrolledState","isControlled","undefined","value","handleChange","useCallbackRef","setValue","useCallback","nextValue","setter","uncontrolledState","useState","prevValueRef","useRef","useEffect","current","callback","callbackRef","useMemo","args"],"sourceRoot":"../../../src","sources":["common/useControllableState.ts"],"mappings":";;;;;;AAIA,IAAAA,MAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAYA,SAASC,oBAAoBA,CAAI;EAC/BC,IAAI;EACJC,WAAW;EACXC,QAAQ,GAAGA,CAAA,KAAM,CAAC;AACW,CAAC,EAAE;EAChC,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,oBAAoB,CAAC;IAAEJ,WAAW;IAAEC;EAAS,CAAC,CAAC;EAC/F,MAAMI,YAAY,GAAGN,IAAI,KAAKO,SAAS;EACvC,MAAMC,KAAK,GAAGF,YAAY,GAAGN,IAAI,GAAGG,gBAAgB;EACpD,MAAMM,YAAY,GAAGC,cAAc,CAACR,QAAQ,CAAC;EAE7C,MAAMS,QAA6D,GAAG,IAAAC,kBAAW,EAC9EC,SAAS,IAAK;IACb,IAAIP,YAAY,EAAE;MAChB,MAAMQ,MAAM,GAAGD,SAA0B;MACzC,MAAML,KAAK,GAAG,OAAOK,SAAS,KAAK,UAAU,GAAGC,MAAM,CAACd,IAAI,CAAC,GAAGa,SAAS;MACxE,IAAIL,KAAK,KAAKR,IAAI,EAAES,YAAY,CAACD,KAAU,CAAC;IAC9C,CAAC,MAAM;MACLJ,mBAAmB,CAACS,SAAS,CAAC;IAChC;EACF,CAAC,EACD,CAACP,YAAY,EAAEN,IAAI,EAAEI,mBAAmB,EAAEK,YAAY,CACxD,CAAC;EAED,OAAO,CAACD,KAAK,EAAEG,QAAQ,CAAC;AAC1B;AAEA,SAASN,oBAAoBA,CAAI;EAC/BJ,WAAW;EACXC;AAC2C,CAAC,EAAE;EAC9C,MAAMa,iBAAiB,GAAG,IAAAC,eAAQ,EAAgBf,WAAW,CAAC;EAC9D,MAAM,CAACO,KAAK,CAAC,GAAGO,iBAAiB;EACjC,MAAME,YAAY,GAAG,IAAAC,aAAM,EAACV,KAAK,CAAC;EAClC,MAAMC,YAAY,GAAGC,cAAc,CAACR,QAAQ,CAAC;EAE7C,IAAAiB,gBAAS,EAAC,MAAM;IACd,IAAIF,YAAY,CAACG,OAAO,KAAKZ,KAAK,EAAE;MAClCC,YAAY,CAACD,KAAU,CAAC;MACxBS,YAAY,CAACG,OAAO,GAAGZ,KAAK;IAC9B;EACF,CAAC,EAAE,CAACA,KAAK,EAAES,YAAY,EAAER,YAAY,CAAC,CAAC;EAEvC,OAAOM,iBAAiB;AAC1B;;AAEA;AACA;AACA;AACA;AACA,SAASL,cAAcA,CAAoCW,QAAuB,EAAK;EACrF,MAAMC,WAAW,GAAG,IAAAJ,aAAM,EAACG,QAAQ,CAAC;EAEpC,IAAAF,gBAAS,EAAC,MAAM;IACdG,WAAW,CAACF,OAAO,GAAGC,QAAQ;EAChC,CAAC,CAAC;;EAEF;EACA,OAAO,IAAAE,cAAO,EAAC,MAAO,CAAC,GAAGC,IAAI,KAAKF,WAAW,CAACF,OAAO,GAAG,GAAGI,IAAI,CAAO,EAAE,EAAE,CAAC;AAC9E","ignoreList":[]}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createContext = createContext;
7
+ var _react = require("react");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ function createContext(displayName) {
10
+ const Context = /*#__PURE__*/(0, _react.createContext)(undefined);
11
+ const Provider = props => {
12
+ const {
13
+ children,
14
+ value
15
+ } = props;
16
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(Context.Provider, {
17
+ value: value,
18
+ children: children
19
+ });
20
+ };
21
+ Provider.displayName = `${displayName}Provider`;
22
+ function useC() {
23
+ const context = (0, _react.useContext)(Context);
24
+ if (context === undefined) {
25
+ throw new Error(`use${displayName} must be used within a ${displayName}Provider`);
26
+ }
27
+ return context;
28
+ }
29
+ return [Provider, useC];
30
+ }
31
+ //# sourceMappingURL=createContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_jsxRuntime","createContext","displayName","Context","createReactContext","undefined","Provider","props","children","value","jsx","useC","context","useContext","Error"],"sourceRoot":"../../../src","sources":["context/createContext.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAKe,IAAAC,WAAA,GAAAD,OAAA;AAER,SAASE,aAAaA,CAAIC,WAAmB,EAAE;EACpD,MAAMC,OAAO,gBAAG,IAAAC,oBAAkB,EAAgBC,SAAS,CAAC;EAE5D,MAAMC,QAA0D,GAAIC,KAAK,IAAK;IAC5E,MAAM;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGF,KAAK;IACjC,oBAAO,IAAAP,WAAA,CAAAU,GAAA,EAACP,OAAO,CAACG,QAAQ;MAACG,KAAK,EAAEA,KAAM;MAAAD,QAAA,EAAEA;IAAQ,CAAmB,CAAC;EACtE,CAAC;EAEDF,QAAQ,CAACJ,WAAW,GAAG,GAAGA,WAAW,UAAU;EAE/C,SAASS,IAAIA,CAAA,EAAM;IACjB,MAAMC,OAAO,GAAG,IAAAC,iBAAU,EAACV,OAAO,CAAC;IACnC,IAAIS,OAAO,KAAKP,SAAS,EAAE;MACzB,MAAM,IAAIS,KAAK,CAAC,MAAMZ,WAAW,0BAA0BA,WAAW,UAAU,CAAC;IACnF;IACA,OAAOU,OAAO;EAChB;EAEA,OAAO,CAACN,QAAQ,EAAEK,IAAI,CAAC;AACzB","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createContext", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _createContext.createContext;
10
+ }
11
+ });
12
+ var _createContext = require("./createContext");
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_createContext","require"],"sourceRoot":"../../../src","sources":["context/index.ts"],"mappings":";;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "FormControlContext", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _useFormControl.FormControlContext;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "useFormControl", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _useFormControl.useFormControl;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "useFormControlContext", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _useFormControl.useFormControlContext;
22
+ }
23
+ });
24
+ var _useFormControl = require("./useFormControl");
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_useFormControl","require"],"sourceRoot":"../../../src","sources":["form-control/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA","ignoreList":[]}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.FormControlContext = void 0;
7
+ exports.useFormControl = useFormControl;
8
+ exports.useFormControlContext = void 0;
9
+ var _react = _interopRequireDefault(require("react"));
10
+ var _accessibilityUtils = require("../common/accessibilityUtils");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ const FormControlContext = exports.FormControlContext = /*#__PURE__*/_react.default.createContext({});
13
+ /**
14
+ * Hook that merges local field props with the nearest FormControl context
15
+ * and returns normalised HTML / ARIA attributes for input elements.
16
+ */
17
+ function useFormControl(props) {
18
+ const field = useFormControlContext();
19
+ const describedBy = [];
20
+ if (field?.hasFeedbackText && field.feedbackId) {
21
+ describedBy.push(field.feedbackId);
22
+ }
23
+ if (field?.hasHelpText && field.helpTextId) {
24
+ describedBy.push(field.helpTextId);
25
+ }
26
+ const ariaDescribedBy = describedBy.join(' ');
27
+ const {
28
+ isInvalid,
29
+ isDisabled,
30
+ isReadOnly,
31
+ isRequired,
32
+ ...cleanProps
33
+ } = props;
34
+ const id = props.id ?? (field?.id ? `${field.id}-input` : undefined);
35
+ return {
36
+ ...cleanProps,
37
+ id,
38
+ disabled: isDisabled || field?.isDisabled,
39
+ readOnly: isReadOnly || field?.isReadOnly,
40
+ required: isRequired || field?.isRequired,
41
+ 'aria-invalid': (0, _accessibilityUtils.ariaAttr)(isInvalid || field?.isInvalid),
42
+ 'aria-required': (0, _accessibilityUtils.ariaAttr)(isRequired || field?.isRequired),
43
+ 'aria-readonly': (0, _accessibilityUtils.ariaAttr)(isReadOnly || field?.isReadOnly),
44
+ 'aria-describedby': ariaDescribedBy || undefined
45
+ };
46
+ }
47
+ const useFormControlContext = () => {
48
+ return _react.default.useContext(FormControlContext);
49
+ };
50
+ exports.useFormControlContext = useFormControlContext;
51
+ //# sourceMappingURL=useFormControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_accessibilityUtils","e","__esModule","default","FormControlContext","exports","React","createContext","useFormControl","props","field","useFormControlContext","describedBy","hasFeedbackText","feedbackId","push","hasHelpText","helpTextId","ariaDescribedBy","join","isInvalid","isDisabled","isReadOnly","isRequired","cleanProps","id","undefined","disabled","readOnly","required","ariaAttr","useContext"],"sourceRoot":"../../../src","sources":["form-control/useFormControl.tsx"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAAwD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAqBjD,MAAMG,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,gBAAGE,cAAK,CAACC,aAAa,CAAmC,CAAC,CAAC,CAAC;AAM3F;AACA;AACA;AACA;AACO,SAASC,cAAcA,CAACC,KAA4B,EAAE;EAC3D,MAAMC,KAAK,GAAGC,qBAAqB,CAAC,CAAC;EACrC,MAAMC,WAAqB,GAAG,EAAE;EAEhC,IAAIF,KAAK,EAAEG,eAAe,IAAIH,KAAK,CAACI,UAAU,EAAE;IAC9CF,WAAW,CAACG,IAAI,CAACL,KAAK,CAACI,UAAU,CAAC;EACpC;EACA,IAAIJ,KAAK,EAAEM,WAAW,IAAIN,KAAK,CAACO,UAAU,EAAE;IAC1CL,WAAW,CAACG,IAAI,CAACL,KAAK,CAACO,UAAU,CAAC;EACpC;EACA,MAAMC,eAAe,GAAGN,WAAW,CAACO,IAAI,CAAC,GAAG,CAAC;EAE7C,MAAM;IAAEC,SAAS;IAAEC,UAAU;IAAEC,UAAU;IAAEC,UAAU;IAAE,GAAGC;EAAW,CAAC,GAAGf,KAAK;EAC9E,MAAMgB,EAAE,GAAGhB,KAAK,CAACgB,EAAE,KAAKf,KAAK,EAAEe,EAAE,GAAG,GAAGf,KAAK,CAACe,EAAE,QAAQ,GAAGC,SAAS,CAAC;EAEpE,OAAO;IACL,GAAGF,UAAU;IACbC,EAAE;IACFE,QAAQ,EAAEN,UAAU,IAAIX,KAAK,EAAEW,UAAU;IACzCO,QAAQ,EAAEN,UAAU,IAAIZ,KAAK,EAAEY,UAAU;IACzCO,QAAQ,EAAEN,UAAU,IAAIb,KAAK,EAAEa,UAAU;IACzC,cAAc,EAAE,IAAAO,4BAAQ,EAACV,SAAS,IAAIV,KAAK,EAAEU,SAAS,CAAC;IACvD,eAAe,EAAE,IAAAU,4BAAQ,EAACP,UAAU,IAAIb,KAAK,EAAEa,UAAU,CAAC;IAC1D,eAAe,EAAE,IAAAO,4BAAQ,EAACR,UAAU,IAAIZ,KAAK,EAAEY,UAAU,CAAC;IAC1D,kBAAkB,EAAEJ,eAAe,IAAIQ;EACzC,CAAC;AACH;AAEO,MAAMf,qBAAqB,GAAGA,CAAA,KAAM;EACzC,OAAOL,cAAK,CAACyB,UAAU,CAAC3B,kBAAkB,CAAC;AAC7C,CAAC;AAACC,OAAA,CAAAM,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _common = require("./common");
7
+ Object.keys(_common).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _common[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _common[key];
14
+ }
15
+ });
16
+ });
17
+ var _context = require("./context");
18
+ Object.keys(_context).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _context[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _context[key];
25
+ }
26
+ });
27
+ });
28
+ var _formControl = require("./form-control");
29
+ Object.keys(_formControl).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _formControl[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _formControl[key];
36
+ }
37
+ });
38
+ });
39
+ var _style = require("./style");
40
+ Object.keys(_style).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _style[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _style[key];
47
+ }
48
+ });
49
+ });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_common","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_context","_formControl","_style"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,YAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,YAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,YAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,YAAA,CAAAN,GAAA;IAAA;EAAA;AAAA;AACA,IAAAO,MAAA,GAAAX,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAS,MAAA,EAAAR,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAO,MAAA,CAAAP,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,MAAA,CAAAP,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useStyleContext = exports.useParentContext = exports.ParentContext = void 0;
7
+ var _react = require("react");
8
+ const ParentContext = exports.ParentContext = /*#__PURE__*/(0, _react.createContext)({});
9
+ const useParentContext = () => {
10
+ return (0, _react.useContext)(ParentContext);
11
+ };
12
+ exports.useParentContext = useParentContext;
13
+ const useStyleContext = (scope = 'Global') => {
14
+ const parentContextValues = useParentContext();
15
+ return parentContextValues[scope];
16
+ };
17
+ exports.useStyleContext = useStyleContext;
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","ParentContext","exports","createContext","useParentContext","useContext","useStyleContext","scope","parentContextValues"],"sourceRoot":"../../../../src","sources":["style/context/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAIO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,gBAAG,IAAAE,oBAAa,EAAkB,CAAC,CAAC,CAAC;AAExD,MAAMC,gBAAgB,GAAGA,CAAA,KAAuB;EACrD,OAAO,IAAAC,iBAAU,EAACJ,aAAa,CAAC;AAClC,CAAC;AAACC,OAAA,CAAAE,gBAAA,GAAAA,gBAAA;AAEK,MAAME,eAAe,GAAGA,CAACC,KAAK,GAAG,QAAQ,KAAK;EACnD,MAAMC,mBAAmB,GAAGJ,gBAAgB,CAAC,CAAC;EAC9C,OAAOI,mBAAmB,CAACD,KAAK,CAAC;AACnC,CAAC;AAACL,OAAA,CAAAI,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _context = require("./context");
7
+ Object.keys(_context).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _context[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _context[key];
14
+ }
15
+ });
16
+ });
17
+ var _withStyleContext = require("./withStyleContext");
18
+ Object.keys(_withStyleContext).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _withStyleContext[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _withStyleContext[key];
25
+ }
26
+ });
27
+ });
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_context","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_withStyleContext"],"sourceRoot":"../../../src","sources":["style/index.tsx"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,iBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,iBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,iBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,iBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withStyleContext = void 0;
7
+ var _react = require("react");
8
+ var _context = require("../context");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ const withStyleContext = (Component, scope = 'Global') => {
11
+ const Wrapped = /*#__PURE__*/(0, _react.forwardRef)(({
12
+ context,
13
+ ...props
14
+ }, ref) => {
15
+ const parentContextValues = (0, _context.useParentContext)();
16
+ const contextValues = (0, _react.useMemo)(() => {
17
+ return {
18
+ ...parentContextValues,
19
+ [scope]: context
20
+ };
21
+ }, [parentContextValues, context]);
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ParentContext.Provider, {
23
+ value: contextValues,
24
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
25
+ ...props,
26
+ ref: ref
27
+ })
28
+ });
29
+ });
30
+ return Wrapped;
31
+ };
32
+ exports.withStyleContext = withStyleContext;
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_context","_jsxRuntime","withStyleContext","Component","scope","Wrapped","forwardRef","context","props","ref","parentContextValues","useParentContext","contextValues","useMemo","jsx","ParentContext","Provider","value","children","exports"],"sourceRoot":"../../../../src","sources":["style/withStyleContext/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AASA,IAAAC,QAAA,GAAAD,OAAA;AAAmF,IAAAE,WAAA,GAAAF,OAAA;AAM5E,MAAMG,gBAAgB,GAAGA,CAAwBC,SAAY,EAAEC,KAAK,GAAG,QAAQ,KAAK;EAIzF,MAAMC,OAAO,gBAAG,IAAAC,iBAAU,EAAa,CAAC;IAAEC,OAAO;IAAE,GAAGC;EAAM,CAAC,EAAEC,GAAG,KAAK;IACrE,MAAMC,mBAAmB,GAAG,IAAAC,yBAAgB,EAAC,CAAC;IAE9C,MAAMC,aAA8B,GAAG,IAAAC,cAAO,EAAC,MAAM;MACnD,OAAO;QAAE,GAAGH,mBAAmB;QAAE,CAACN,KAAK,GAAGG;MAAQ,CAAC;IACrD,CAAC,EAAE,CAACG,mBAAmB,EAAEH,OAAO,CAAC,CAAC;IAElC,oBACE,IAAAN,WAAA,CAAAa,GAAA,EAACd,QAAA,CAAAe,aAAa,CAACC,QAAQ;MAACC,KAAK,EAAEL,aAAc;MAAAM,QAAA,eAE3C,IAAAjB,WAAA,CAAAa,GAAA,EAACX,SAAS;QAAA,GAAKK,KAAK;QAAEC,GAAG,EAAEA;MAAI,CAAE;IAAC,CACZ,CAAC;EAE7B,CAAC,CAAC;EAEF,OAAOJ,OAAO;AAChB,CAAC;AAACc,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export const ariaAttr = condition => condition ? true : undefined;
4
+ //# sourceMappingURL=accessibilityUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ariaAttr","condition","undefined"],"sourceRoot":"../../../src","sources":["common/accessibilityUtils.ts"],"mappings":";;AAAA,OAAO,MAAMA,QAAQ,GAAIC,SAA8B,IAAMA,SAAS,GAAG,IAAI,GAAGC,SAAU","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ export function cn(...inputs) {
6
+ return twMerge(clsx(inputs));
7
+ }
8
+ //# sourceMappingURL=cn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["clsx","twMerge","cn","inputs"],"sourceRoot":"../../../src","sources":["common/cn.ts"],"mappings":";;AAAA,SAA0BA,IAAI,QAAQ,MAAM;AAC5C,SAASC,OAAO,QAAQ,gBAAgB;AAExC,OAAO,SAASC,EAAEA,CAAC,GAAGC,MAAoB,EAAE;EAC1C,OAAOF,OAAO,CAACD,IAAI,CAACG,MAAM,CAAC,CAAC;AAC9B","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ export function composeEventHandlers(...args) {
4
+ return function handleEvent(event) {
5
+ for (let i = 0; i < args.length; i++) {
6
+ args[i]?.(event);
7
+ }
8
+ };
9
+ }
10
+ //# sourceMappingURL=composeEventHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["composeEventHandlers","args","handleEvent","event","i","length"],"sourceRoot":"../../../src","sources":["common/composeEventHandlers.ts"],"mappings":";;AAAA,OAAO,SAASA,oBAAoBA,CAAI,GAAGC,IAAiD,EAAE;EAC5F,OAAO,SAASC,WAAWA,CAACC,KAAQ,EAAE;IACpC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;MACpCH,IAAI,CAACG,CAAC,CAAC,GAAGD,KAAK,CAAC;IAClB;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import React from 'react';
4
+ // TODO: Rename file
5
+
6
+ export function flattenChildren(children, keys = []) {
7
+ const childrenArray = React.Children.toArray(children);
8
+ return childrenArray.reduce((flatChildren, child, index) => {
9
+ if (/*#__PURE__*/React.isValidElement(child) && child.type === React.Fragment) {
10
+ return flatChildren.concat(flattenChildren(child.props.children, keys.concat(child.key || index)));
11
+ }
12
+ if (/*#__PURE__*/React.isValidElement(child)) {
13
+ flatChildren.push(/*#__PURE__*/React.cloneElement(child, {
14
+ key: keys.concat(String(child.key || index)).join('.')
15
+ }));
16
+ } else {
17
+ flatChildren.push(child);
18
+ }
19
+ return flatChildren;
20
+ }, []);
21
+ }
22
+ //# sourceMappingURL=getSpacedChild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["React","flattenChildren","children","keys","childrenArray","Children","toArray","reduce","flatChildren","child","index","isValidElement","type","Fragment","concat","props","key","push","cloneElement","String","join"],"sourceRoot":"../../../src","sources":["common/getSpacedChild.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB;;AAEA,OAAO,SAASC,eAAeA,CAC7BC,QAAyB,EACzBC,IAAyB,GAAG,EAAE,EACb;EACjB,MAAMC,aAAa,GAAGJ,KAAK,CAACK,QAAQ,CAACC,OAAO,CAACJ,QAAQ,CAAC;EACtD,OAAOE,aAAa,CAACG,MAAM,CAAC,CAACC,YAA6B,EAAEC,KAAK,EAAEC,KAAa,KAAK;IACnF,IACE,aAAAV,KAAK,CAACW,cAAc,CAAiCF,KAAK,CAAC,IAC3DA,KAAK,CAACG,IAAI,KAAKZ,KAAK,CAACa,QAAQ,EAC7B;MACA,OAAOL,YAAY,CAACM,MAAM,CACxBb,eAAe,CAACQ,KAAK,CAACM,KAAK,CAACb,QAAQ,EAAEC,IAAI,CAACW,MAAM,CAACL,KAAK,CAACO,GAAG,IAAIN,KAAK,CAAC,CACvE,CAAC;IACH;IACA,iBAAIV,KAAK,CAACW,cAAc,CAACF,KAAK,CAAC,EAAE;MAC/BD,YAAY,CAACS,IAAI,cACfjB,KAAK,CAACkB,YAAY,CAACT,KAAK,EAAE;QACxBO,GAAG,EAAEb,IAAI,CAACW,MAAM,CAACK,MAAM,CAACV,KAAK,CAACO,GAAG,IAAIN,KAAK,CAAC,CAAC,CAACU,IAAI,CAAC,GAAG;MACvD,CAAC,CACH,CAAC;IACH,CAAC,MAAM;MACLZ,YAAY,CAACS,IAAI,CAACR,KAAK,CAAC;IAC1B;IACA,OAAOD,YAAY;EACrB,CAAC,EAAE,EAAE,CAAC;AACR","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ export { ariaAttr } from './accessibilityUtils';
4
+ export { cn } from './cn';
5
+ export { composeEventHandlers } from './composeEventHandlers';
6
+ export { flattenChildren } from './getSpacedChild';
7
+ export { mergeRefs } from './mergeRefs';
8
+ export { useControllableState } from './useControllableState';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ariaAttr","cn","composeEventHandlers","flattenChildren","mergeRefs","useControllableState"],"sourceRoot":"../../../src","sources":["common/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,sBAAsB;AAC/C,SAASC,EAAE,QAAQ,MAAM;AACzB,SAASC,oBAAoB,QAAQ,wBAAwB;AAC7D,SAASC,eAAe,QAAQ,kBAAkB;AAClD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAA0CC,oBAAoB,QAAQ,wBAAwB","ignoreList":[]}