@vritti/quantum-ui 0.2.9 → 0.2.10

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 (180) hide show
  1. package/dist/Alert.js +7 -2
  2. package/dist/Alert.js.map +1 -1
  3. package/dist/Avatar.js +5 -5
  4. package/dist/Badge.js +2 -28
  5. package/dist/Badge.js.map +1 -1
  6. package/dist/Badge2.js +30 -0
  7. package/dist/Badge2.js.map +1 -0
  8. package/dist/Button.js +1 -1
  9. package/dist/Button2.js +35 -16
  10. package/dist/Button2.js.map +1 -1
  11. package/dist/Card.js +1 -1
  12. package/dist/Chart.js +1 -1
  13. package/dist/Checkbox.js +2 -289
  14. package/dist/Checkbox.js.map +1 -1
  15. package/dist/Checkbox2.js +292 -0
  16. package/dist/Checkbox2.js.map +1 -0
  17. package/dist/Combination.js +5 -5
  18. package/dist/DatePicker.js +3 -325
  19. package/dist/DatePicker.js.map +1 -1
  20. package/dist/DropdownMenu.js +77 -7
  21. package/dist/DropdownMenu.js.map +1 -1
  22. package/dist/Form.js +23 -6
  23. package/dist/Form.js.map +1 -1
  24. package/dist/Label.js +2 -2
  25. package/dist/OTPField.js +1 -1
  26. package/dist/PasswordField.js +1 -1
  27. package/dist/PhoneField.js +6 -6
  28. package/dist/PhoneField.js.map +1 -1
  29. package/dist/Progress.js +3 -3
  30. package/dist/Skeleton.js +1 -1
  31. package/dist/Sonner.js +4 -1
  32. package/dist/Sonner.js.map +1 -1
  33. package/dist/Spinner.js +1 -1
  34. package/dist/Switch.js +4 -4
  35. package/dist/TextArea.js +1 -1
  36. package/dist/TextField.js +4 -3
  37. package/dist/TextField.js.map +1 -1
  38. package/dist/ThemeContext.js +2 -8
  39. package/dist/ThemeContext.js.map +1 -1
  40. package/dist/Toggle.js +3 -3
  41. package/dist/Typography.js +1 -1
  42. package/dist/assets/quantum-ui.css +31 -31
  43. package/dist/{chevron-down.js → chevron-left.js} +4 -4
  44. package/dist/chevron-left.js.map +1 -0
  45. package/dist/components/Badge.js +2 -1
  46. package/dist/components/Badge.js.map +1 -1
  47. package/dist/components/DataTable.js +2 -0
  48. package/dist/components/DataTable.js.map +1 -0
  49. package/dist/components/Select.js +1379 -0
  50. package/dist/components/Select.js.map +1 -0
  51. package/dist/field.js +2 -2
  52. package/dist/hooks/index.js +1 -0
  53. package/dist/hooks/index.js.map +1 -1
  54. package/dist/index.js +9 -5
  55. package/dist/index.js.map +1 -1
  56. package/dist/index10.js +10 -99
  57. package/dist/index10.js.map +1 -1
  58. package/dist/index11.js +35 -73
  59. package/dist/index11.js.map +1 -1
  60. package/dist/index12.js +1 -1
  61. package/dist/index13.js +3 -3
  62. package/dist/index2.js +65 -58
  63. package/dist/index2.js.map +1 -1
  64. package/dist/index3.js +60 -8
  65. package/dist/index3.js.map +1 -1
  66. package/dist/index4.js +80 -106
  67. package/dist/index4.js.map +1 -1
  68. package/dist/index5.js +42 -37
  69. package/dist/index5.js.map +1 -1
  70. package/dist/index6.js +9 -4
  71. package/dist/index6.js.map +1 -1
  72. package/dist/index7.js +125 -10
  73. package/dist/index7.js.map +1 -1
  74. package/dist/index8.js +37 -42
  75. package/dist/index8.js.map +1 -1
  76. package/dist/index9.js +4 -37
  77. package/dist/index9.js.map +1 -1
  78. package/dist/lib/components/Alert/Alert.d.ts +2 -1
  79. package/dist/lib/components/Alert/Alert.d.ts.map +1 -1
  80. package/dist/lib/components/DataTable/DataTable.d.ts +15 -0
  81. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -0
  82. package/dist/lib/components/DataTable/components/DataTableColumnHeader.d.ts +12 -0
  83. package/dist/lib/components/DataTable/components/DataTableColumnHeader.d.ts.map +1 -0
  84. package/dist/lib/components/DataTable/components/DataTableEmpty.d.ts +13 -0
  85. package/dist/lib/components/DataTable/components/DataTableEmpty.d.ts.map +1 -0
  86. package/dist/lib/components/DataTable/components/DataTablePagination.d.ts +13 -0
  87. package/dist/lib/components/DataTable/components/DataTablePagination.d.ts.map +1 -0
  88. package/dist/lib/components/DataTable/components/DataTableToolbar.d.ts +15 -0
  89. package/dist/lib/components/DataTable/components/DataTableToolbar.d.ts.map +1 -0
  90. package/dist/lib/components/DataTable/components/DataTableViewOptions.d.ts +11 -0
  91. package/dist/lib/components/DataTable/components/DataTableViewOptions.d.ts.map +1 -0
  92. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts +3 -0
  93. package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -0
  94. package/dist/lib/components/DataTable/index.d.ts +10 -0
  95. package/dist/lib/components/DataTable/index.d.ts.map +1 -0
  96. package/dist/lib/components/DataTable/types.d.ts +67 -0
  97. package/dist/lib/components/DataTable/types.d.ts.map +1 -0
  98. package/dist/lib/components/DataTable/utils.d.ts +3 -0
  99. package/dist/lib/components/DataTable/utils.d.ts.map +1 -0
  100. package/dist/lib/components/Form/Form.d.ts +2 -1
  101. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  102. package/dist/lib/components/PhoneField/PhoneField.d.ts +1 -0
  103. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  104. package/dist/lib/components/Select/Select.d.ts +23 -0
  105. package/dist/lib/components/Select/Select.d.ts.map +1 -0
  106. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +25 -0
  107. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -0
  108. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +21 -0
  109. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -0
  110. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +25 -0
  111. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -0
  112. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +21 -0
  113. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -0
  114. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts +32 -0
  115. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts.map +1 -0
  116. package/dist/lib/components/Select/hooks/useSelect.d.ts +23 -0
  117. package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -0
  118. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts +30 -0
  119. package/dist/lib/components/Select/hooks/useSingleSelect.d.ts.map +1 -0
  120. package/dist/lib/components/Select/index.d.ts +38 -0
  121. package/dist/lib/components/Select/index.d.ts.map +1 -0
  122. package/dist/lib/components/Select/types.d.ts +31 -0
  123. package/dist/lib/components/Select/types.d.ts.map +1 -0
  124. package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
  125. package/dist/lib/components/index.d.ts +2 -1
  126. package/dist/lib/components/index.d.ts.map +1 -1
  127. package/dist/lib/context/ThemeContext.d.ts +1 -1
  128. package/dist/lib/context/ThemeContext.d.ts.map +1 -1
  129. package/dist/lib/context/index.d.ts +1 -1
  130. package/dist/lib/context/index.d.ts.map +1 -1
  131. package/dist/lib/hooks/index.d.ts +2 -1
  132. package/dist/lib/hooks/index.d.ts.map +1 -1
  133. package/dist/lib/hooks/useSSE.d.ts +21 -0
  134. package/dist/lib/hooks/useSSE.d.ts.map +1 -0
  135. package/dist/lib/index.d.ts +2 -2
  136. package/dist/lib/index.d.ts.map +1 -1
  137. package/dist/lib/utils/axios.d.ts.map +1 -1
  138. package/dist/popover.js +329 -0
  139. package/dist/popover.js.map +1 -0
  140. package/dist/separator2.js +2 -2
  141. package/dist/shadcn/shadcnAlert/alert.d.ts.map +1 -1
  142. package/dist/shadcn/shadcnAlert/index.d.ts +1 -1
  143. package/dist/shadcn/shadcnAlert/index.d.ts.map +1 -1
  144. package/dist/shadcn/shadcnBadge/Badge.d.ts +1 -1
  145. package/dist/shadcn/shadcnButton/Button.d.ts +2 -2
  146. package/dist/shadcn/shadcnButton/Button.d.ts.map +1 -1
  147. package/dist/shadcn/shadcnInputOTP/InputOTP.d.ts +2 -2
  148. package/dist/shadcn/shadcnMultiSelect/index.d.ts +3 -0
  149. package/dist/shadcn/shadcnMultiSelect/index.d.ts.map +1 -0
  150. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +61 -0
  151. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -0
  152. package/dist/shadcn/shadcnSingleSelect/index.d.ts +3 -0
  153. package/dist/shadcn/shadcnSingleSelect/index.d.ts.map +1 -0
  154. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts +60 -0
  155. package/dist/shadcn/shadcnSingleSelect/single-select.d.ts.map +1 -0
  156. package/dist/shadcn/shadcnSonner/sonner.d.ts +1 -1
  157. package/dist/shadcn/shadcnSonner/sonner.d.ts.map +1 -1
  158. package/dist/useSSE.js +82 -0
  159. package/dist/useSSE.js.map +1 -0
  160. package/dist/useTheme.js.map +1 -1
  161. package/dist/utils/axios.js +4167 -2
  162. package/dist/utils/axios.js.map +1 -1
  163. package/dist/utils.js +3748 -2970
  164. package/dist/utils.js.map +1 -1
  165. package/dist/utils2.js +3042 -0
  166. package/dist/utils2.js.map +1 -0
  167. package/dist/x.js +18 -0
  168. package/dist/x.js.map +1 -0
  169. package/package.json +11 -5
  170. package/dist/SelectField.js +0 -1351
  171. package/dist/SelectField.js.map +0 -1
  172. package/dist/axios.js +0 -4228
  173. package/dist/axios.js.map +0 -1
  174. package/dist/chevron-down.js.map +0 -1
  175. package/dist/components/SelectField.js +0 -2
  176. package/dist/components/SelectField.js.map +0 -1
  177. package/dist/lib/components/SelectField/SelectField.d.ts +0 -24
  178. package/dist/lib/components/SelectField/SelectField.d.ts.map +0 -1
  179. package/dist/lib/components/SelectField/index.d.ts +0 -3
  180. package/dist/lib/components/SelectField/index.d.ts.map +0 -1
package/dist/index11.js CHANGED
@@ -1,79 +1,41 @@
1
1
  import * as React from 'react';
2
- import React__default from 'react';
3
- import { c as createContextScope } from './index12.js';
4
- import { u as useComposedRefs } from './index5.js';
5
- import { c as createSlot } from './index13.js';
2
+ import 'react-dom';
3
+ import { c as createSlot } from './index4.js';
6
4
  import { jsx } from 'react/jsx-runtime';
7
5
 
8
- function createCollection(name) {
9
- const PROVIDER_NAME = name + "CollectionProvider";
10
- const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
11
- const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
12
- PROVIDER_NAME,
13
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
14
- );
15
- const CollectionProvider = (props) => {
16
- const { scope, children } = props;
17
- const ref = React__default.useRef(null);
18
- const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
19
- return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
20
- };
21
- CollectionProvider.displayName = PROVIDER_NAME;
22
- const COLLECTION_SLOT_NAME = name + "CollectionSlot";
23
- const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
24
- const CollectionSlot = React__default.forwardRef(
25
- (props, forwardedRef) => {
26
- const { scope, children } = props;
27
- const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
28
- const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
29
- return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
6
+ // src/primitive.tsx
7
+ var NODES = [
8
+ "a",
9
+ "button",
10
+ "div",
11
+ "form",
12
+ "h2",
13
+ "h3",
14
+ "img",
15
+ "input",
16
+ "label",
17
+ "li",
18
+ "nav",
19
+ "ol",
20
+ "p",
21
+ "select",
22
+ "span",
23
+ "svg",
24
+ "ul"
25
+ ];
26
+ var Primitive = NODES.reduce((primitive, node) => {
27
+ const Slot = createSlot(`Primitive.${node}`);
28
+ const Node = React.forwardRef((props, forwardedRef) => {
29
+ const { asChild, ...primitiveProps } = props;
30
+ const Comp = asChild ? Slot : node;
31
+ if (typeof window !== "undefined") {
32
+ window[Symbol.for("radix-ui")] = true;
30
33
  }
31
- );
32
- CollectionSlot.displayName = COLLECTION_SLOT_NAME;
33
- const ITEM_SLOT_NAME = name + "CollectionItemSlot";
34
- const ITEM_DATA_ATTR = "data-radix-collection-item";
35
- const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
36
- const CollectionItemSlot = React__default.forwardRef(
37
- (props, forwardedRef) => {
38
- const { scope, children, ...itemData } = props;
39
- const ref = React__default.useRef(null);
40
- const composedRefs = useComposedRefs(forwardedRef, ref);
41
- const context = useCollectionContext(ITEM_SLOT_NAME, scope);
42
- React__default.useEffect(() => {
43
- context.itemMap.set(ref, { ref, ...itemData });
44
- return () => void context.itemMap.delete(ref);
45
- });
46
- return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
47
- }
48
- );
49
- CollectionItemSlot.displayName = ITEM_SLOT_NAME;
50
- function useCollection(scope) {
51
- const context = useCollectionContext(name + "CollectionConsumer", scope);
52
- const getItems = React__default.useCallback(() => {
53
- const collectionNode = context.collectionRef.current;
54
- if (!collectionNode) return [];
55
- const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
56
- const items = Array.from(context.itemMap.values());
57
- const orderedItems = items.sort(
58
- (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
59
- );
60
- return orderedItems;
61
- }, [context.collectionRef, context.itemMap]);
62
- return getItems;
63
- }
64
- return [
65
- { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
66
- useCollection,
67
- createCollectionScope
68
- ];
69
- }
70
-
71
- // packages/react/direction/src/direction.tsx
72
- var DirectionContext = React.createContext(void 0);
73
- function useDirection(localDir) {
74
- const globalDir = React.useContext(DirectionContext);
75
- return localDir || globalDir || "ltr";
76
- }
34
+ return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
35
+ });
36
+ Node.displayName = `Primitive.${node}`;
37
+ return { ...primitive, [node]: Node };
38
+ }, {});
77
39
 
78
- export { createCollection as c, useDirection as u };
40
+ export { Primitive as P };
79
41
  //# sourceMappingURL=index11.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index11.js","sources":["../node_modules/.pnpm/@radix-ui+react-collection@1.1.7_@types+react-dom@19.2.3_@types+react@19.2.9__@types+re_ae03b05a8cab938032db1ba1dbeec717/node_modules/@radix-ui/react-collection/dist/index.mjs","../node_modules/.pnpm/@radix-ui+react-direction@1.1.1_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-direction/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React"],"mappings":";;;;;;;AAQA,SAAS,gBAAgB,CAAC,IAAI,EAAE;AAChC,EAAE,MAAM,aAAa,GAAG,IAAI,GAAG,oBAAoB;AACnD,EAAE,MAAM,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,GAAG,kBAAkB,CAAC,aAAa,CAAC;AAC5F,EAAE,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,CAAC,GAAG,uBAAuB;AAChF,IAAI,aAAa;AACjB,IAAI,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,kBAAkB,IAAI,GAAG,EAAE;AAC1E,GAAG;AACH,EAAE,MA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,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI;AACrC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO;AAC1F,OAAO;AACP,MAAM,OAAO,YAAY;AACzB,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;AAChD,IAAI,OAAO,QAAQ;AACnB,EAAE;AACF,EAAE,OAAO;AACT,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE;AACxF,IAAI,aAAa;AACjB,IAAI;AACJ,GAAG;AACH;;ACrEA;AAGA,IAAI,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC;AAKlD,SAAS,YAAY,CAAC,QAAQ,EAAE;AAChC,EAAE,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC;AACtD,EAAE,OAAO,QAAQ,IAAI,SAAS,IAAI,KAAK;AACvC;;;;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index11.js","sources":["../node_modules/.pnpm/@radix-ui+react-primitive@2.1.4_@types+react-dom@19.2.3_@types+react@19.2.9__@types+rea_80b0e86615c8e72f2e6ad5b837a6e15c/node_modules/@radix-ui/react-primitive/dist/index.mjs"],"sourcesContent":["// src/primitive.tsx\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NODES = [\n \"a\",\n \"button\",\n \"div\",\n \"form\",\n \"h2\",\n \"h3\",\n \"img\",\n \"input\",\n \"label\",\n \"li\",\n \"nav\",\n \"ol\",\n \"p\",\n \"select\",\n \"span\",\n \"svg\",\n \"ul\"\n];\nvar Primitive = NODES.reduce((primitive, node) => {\n const Slot = createSlot(`Primitive.${node}`);\n const Node = React.forwardRef((props, forwardedRef) => {\n const { asChild, ...primitiveProps } = props;\n const Comp = asChild ? Slot : node;\n if (typeof window !== \"undefined\") {\n window[Symbol.for(\"radix-ui\")] = true;\n }\n return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });\n });\n Node.displayName = `Primitive.${node}`;\n return { ...primitive, [node]: Node };\n}, {});\nfunction dispatchDiscreteCustomEvent(target, event) {\n if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));\n}\nvar Root = Primitive;\nexport {\n Primitive,\n Root,\n dispatchDiscreteCustomEvent\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;AAAA;AAKA,IAAI,KAAK,GAAG;AACZ,EAAE,GAAG;AACL,EAAE,QAAQ;AACV,EAAE,KAAK;AACP,EAAE,MAAM;AACR,EAAE,IAAI;AACN,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAE,OAAO;AACT,EAAE,OAAO;AACT,EAAE,IAAI;AACN,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,GAAG;AACL,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAE,KAAK;AACP,EAAE;AACF,CAAC;AACE,IAAC,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,IAAI,KAAK;AAClD,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AAC9C,EAAE,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AACzD,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,GAAG,KAAK;AAChD,IAAI,MAAM,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI;AACtC,IAAI,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;AACvC,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,IAAI;AAC3C,IAAI;AACJ,IAAI,uBAAuB,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;AAC9E,EAAE,CAAC,CAAC;AACJ,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AACxC,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,CAAC,IAAI,GAAG,IAAI,EAAE;AACvC,CAAC,EAAE,EAAE;;;;","x_google_ignoreList":[0]}
package/dist/index12.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { u as useLayoutEffect2 } from './index6.js';
3
+ import { u as useLayoutEffect2 } from './index9.js';
4
4
 
5
5
  // packages/react/context/src/create-context.tsx
6
6
  function createContextScope(scopeName, createContextScopeDeps = []) {
package/dist/index13.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { u as useLayoutEffect2 } from './index6.js';
2
+ import { u as useLayoutEffect2 } from './index9.js';
3
3
  import * as ReactDOM from 'react-dom';
4
- import { c as composeRefs } from './index5.js';
4
+ import { c as composeRefs } from './index8.js';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
7
7
  // src/primitive.tsx
@@ -201,5 +201,5 @@ function dispatchDiscreteCustomEvent(target, event) {
201
201
  if (target) ReactDOM.flushSync(() => target.dispatchEvent(event));
202
202
  }
203
203
 
204
- export { Primitive as P, composeEventHandlers as a, createSlot as c, dispatchDiscreteCustomEvent as d, useControllableState as u };
204
+ export { Primitive as P, createSlot as a, composeEventHandlers as c, dispatchDiscreteCustomEvent as d, useControllableState as u };
205
205
  //# sourceMappingURL=index13.js.map
package/dist/index2.js CHANGED
@@ -1,65 +1,72 @@
1
- import * as React from 'react';
2
- import { jsx } from 'react/jsx-runtime';
3
-
4
- // src/create-context.tsx
5
- function createContextScope(scopeName, createContextScopeDeps = []) {
6
- let defaultContexts = [];
7
- function createContext3(rootComponentName, defaultContext) {
8
- const BaseContext = React.createContext(defaultContext);
9
- BaseContext.displayName = rootComponentName + "Context";
10
- const index = defaultContexts.length;
11
- defaultContexts = [...defaultContexts, defaultContext];
12
- const Provider = (props) => {
13
- const { scope, children, ...context } = props;
14
- const Context = scope?.[scopeName]?.[index] || BaseContext;
15
- const value = React.useMemo(() => context, Object.values(context));
16
- return /* @__PURE__ */ jsx(Context.Provider, { value, children });
17
- };
18
- Provider.displayName = rootComponentName + "Provider";
19
- function useContext2(consumerName, scope) {
20
- const Context = scope?.[scopeName]?.[index] || BaseContext;
21
- const context = React.useContext(Context);
22
- if (context) return context;
23
- if (defaultContext !== void 0) return defaultContext;
24
- throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
1
+ const defaultConfig = {
2
+ csrf: {
3
+ endpoint: "csrf/token",
4
+ enabled: true,
5
+ headerName: "x-csrf-token"
6
+ },
7
+ axios: {
8
+ baseURL: "/api",
9
+ timeout: 3e4,
10
+ withCredentials: true,
11
+ headers: {
12
+ "Content-Type": "application/json",
13
+ Accept: "application/json"
25
14
  }
26
- return [Provider, useContext2];
15
+ },
16
+ auth: {
17
+ tokenHeaderName: "Authorization",
18
+ tokenPrefix: "Bearer",
19
+ tokenEndpoint: "cloud-api/auth/token",
20
+ refreshEndpoint: "cloud-api/auth/refresh",
21
+ sessionRecoveryEnabled: true
27
22
  }
28
- const createScope = () => {
29
- const scopeContexts = defaultContexts.map((defaultContext) => {
30
- return React.createContext(defaultContext);
31
- });
32
- return function useScope(scope) {
33
- const contexts = scope?.[scopeName] || scopeContexts;
34
- return React.useMemo(
35
- () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
36
- [scope, contexts]
37
- );
38
- };
39
- };
40
- createScope.scopeName = scopeName;
41
- return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
23
+ };
24
+ const GLOBAL_CONFIG_KEY = "__QUANTUM_UI_CONFIG__";
25
+ function getGlobalConfig() {
26
+ if (typeof window !== "undefined") {
27
+ const globalWindow = window;
28
+ if (!globalWindow[GLOBAL_CONFIG_KEY]) {
29
+ globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };
30
+ }
31
+ return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };
32
+ }
33
+ return { ...defaultConfig };
34
+ }
35
+ function setGlobalConfig(config) {
36
+ if (typeof window !== "undefined") {
37
+ window[GLOBAL_CONFIG_KEY] = config;
38
+ }
39
+ }
40
+ function defineConfig(config) {
41
+ return config;
42
42
  }
43
- function composeContextScopes(...scopes) {
44
- const baseScope = scopes[0];
45
- if (scopes.length === 1) return baseScope;
46
- const createScope = () => {
47
- const scopeHooks = scopes.map((createScope2) => ({
48
- useScope: createScope2(),
49
- scopeName: createScope2.scopeName
50
- }));
51
- return function useComposedScopes(overrideScopes) {
52
- const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
53
- const scopeProps = useScope(overrideScopes);
54
- const currentScope = scopeProps[`__scope${scopeName}`];
55
- return { ...nextScopes2, ...currentScope };
56
- }, {});
57
- return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
58
- };
43
+ function configureQuantumUI(userConfig) {
44
+ const newConfig = {
45
+ csrf: {
46
+ ...defaultConfig.csrf,
47
+ ...userConfig.csrf || {}
48
+ },
49
+ axios: {
50
+ ...defaultConfig.axios,
51
+ ...userConfig.axios || {},
52
+ headers: {
53
+ ...defaultConfig.axios.headers,
54
+ ...userConfig.axios?.headers || {}
55
+ }
56
+ },
57
+ auth: {
58
+ ...defaultConfig.auth,
59
+ ...userConfig.auth || {}
60
+ }
59
61
  };
60
- createScope.scopeName = baseScope.scopeName;
61
- return createScope;
62
+ setGlobalConfig(newConfig);
63
+ }
64
+ function getConfig() {
65
+ return getGlobalConfig();
66
+ }
67
+ function resetConfig() {
68
+ setGlobalConfig({ ...defaultConfig });
62
69
  }
63
70
 
64
- export { createContextScope as c };
71
+ export { configureQuantumUI as c, defineConfig as d, getConfig as g, resetConfig as r };
65
72
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.3_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.mjs"],"sourcesContent":["// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;AAAA;AAoBA,SAAS,kBAAkB,CAAC,SAAS,EAAE,sBAAsB,GAAG,EAAE,EAAE;AACpE,EAAE,IAAI,eAAe,GAAG,EAAE;AAC1B,EAAE,SAAS,cAAc,CAAC,iBAAiB,EAAE,cAAc,EAAE;AAC7D,IAAI,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC;AAC3D,IAAI,WAAW,CAAC,WAAW,GAAG,iBAAiB,GAAG,SAAS;AAC3D,IAAI,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM;AACxC,IAAI,eAAe,GAAG,CAAC,GAAG,eAAe,EAAE,cAAc,CAAC;AAC1D,IAAI,MAAM,QAAQ,GAAG,CAAC,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AAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AACnG,IAAI,CAAC;AACL,EAAE,CAAC;AACH,EAAE,WAAW,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS;AAC7C,EAAE,OAAO,WAAW;AACpB;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index2.js","sources":["../lib/config/index.ts"],"sourcesContent":["/**\n * quantum-ui Configuration System\n *\n * This module provides a type-safe configuration system for quantum-ui,\n * similar to how Tailwind CSS uses tailwind.config.js\n *\n * @example\n * ```typescript\n * // In your project root: quantum-ui.config.ts\n * import { defineConfig } from '@vritti/quantum-ui'\n *\n * export default defineConfig({\n * csrf: {\n * endpoint: '/csrf/token',\n * enabled: true,\n * },\n * axios: {\n * baseURL: '/api',\n * timeout: 30000,\n * }\n * })\n * ```\n */\n\n/**\n * CSRF configuration options\n */\nexport interface CsrfConfig {\n /**\n * The endpoint to fetch CSRF tokens from\n * @default '/csrf/token'\n */\n endpoint: string;\n\n /**\n * Whether CSRF protection is enabled\n * @default true\n */\n enabled: boolean;\n\n /**\n * The header name to send the CSRF token in\n * @default 'x-csrf-token'\n */\n headerName: string;\n}\n\n/**\n * Axios configuration options\n */\nexport interface AxiosConfig {\n /**\n * Base URL for all API requests\n * @default '/api'\n */\n baseURL: string;\n\n /**\n * Request timeout in milliseconds\n * @default 30000\n */\n timeout: number;\n\n /**\n * Whether to send cookies with requests\n * @default true\n */\n withCredentials: boolean;\n\n /**\n * Default headers to include in all requests\n */\n headers?: Record<string, string>;\n}\n\n/**\n * Authentication configuration options\n */\nexport interface AuthConfig {\n /**\n * The header name for the authorization token\n * @default 'Authorization'\n */\n tokenHeaderName: string;\n\n /**\n * The prefix for the authorization token\n * @default 'Bearer'\n */\n tokenPrefix: string;\n\n /**\n * Endpoint for session recovery from httpOnly cookie\n * @default 'cloud-api/auth/token'\n */\n tokenEndpoint: string;\n\n /**\n * Endpoint for token refresh\n * @default 'cloud-api/auth/refresh'\n */\n refreshEndpoint: string;\n\n /**\n * Whether automatic session recovery is enabled\n * @default true\n */\n sessionRecoveryEnabled: boolean;\n}\n\n/**\n * Complete quantum-ui configuration interface\n */\nexport interface QuantumUIConfig {\n /**\n * CSRF token configuration\n */\n csrf?: Partial<CsrfConfig>;\n\n /**\n * Axios HTTP client configuration\n */\n axios?: Partial<AxiosConfig>;\n\n /**\n * Authentication configuration\n */\n auth?: Partial<AuthConfig>;\n}\n\n/**\n * Default configuration values\n */\nconst defaultConfig: Required<{\n csrf: CsrfConfig;\n axios: AxiosConfig;\n auth: AuthConfig;\n}> = {\n csrf: {\n endpoint: 'csrf/token',\n enabled: true,\n headerName: 'x-csrf-token',\n },\n axios: {\n baseURL: '/api',\n timeout: 30000,\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n },\n auth: {\n tokenHeaderName: 'Authorization',\n tokenPrefix: 'Bearer',\n tokenEndpoint: 'cloud-api/auth/token',\n refreshEndpoint: 'cloud-api/auth/refresh',\n sessionRecoveryEnabled: true,\n },\n};\n\n/**\n * Global key for storing config in window object\n * This ensures config is shared across Module Federation boundaries\n */\nconst GLOBAL_CONFIG_KEY = '__QUANTUM_UI_CONFIG__';\n\n// Type-safe global window access\ntype GlobalWindow = Window & typeof globalThis & { [GLOBAL_CONFIG_KEY]?: typeof defaultConfig };\n\n/**\n * Get the current config from global storage or initialize with defaults\n */\nfunction getGlobalConfig(): typeof defaultConfig {\n if (typeof window !== 'undefined') {\n const globalWindow = window as GlobalWindow;\n if (!globalWindow[GLOBAL_CONFIG_KEY]) {\n globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };\n }\n return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };\n }\n return { ...defaultConfig };\n}\n\n/**\n * Set the global config\n */\nfunction setGlobalConfig(config: typeof defaultConfig): void {\n if (typeof window !== 'undefined') {\n (window as GlobalWindow)[GLOBAL_CONFIG_KEY] = config;\n }\n}\n\n/**\n * Helper function to define configuration with type safety\n * Similar to Tailwind's defineConfig()\n *\n * @param config - User configuration object\n * @returns The same configuration object (for type inference)\n *\n * @example\n * ```typescript\n * export default defineConfig({\n * csrf: { endpoint: '/api/csrf' }\n * })\n * ```\n */\nexport function defineConfig(config: QuantumUIConfig): QuantumUIConfig {\n return config;\n}\n\n/**\n * Configure quantum-ui with user settings\n * This should be called once in your application's entry point\n *\n * @param userConfig - User configuration object\n *\n * @example\n * ```typescript\n * import config from './quantum-ui.config'\n * import { configureQuantumUI } from '@vritti/quantum-ui'\n *\n * configureQuantumUI(config)\n * ```\n */\nexport function configureQuantumUI(userConfig: QuantumUIConfig): void {\n const newConfig = {\n csrf: {\n ...defaultConfig.csrf,\n ...(userConfig.csrf || {}),\n },\n axios: {\n ...defaultConfig.axios,\n ...(userConfig.axios || {}),\n headers: {\n ...defaultConfig.axios.headers,\n ...(userConfig.axios?.headers || {}),\n },\n },\n auth: {\n ...defaultConfig.auth,\n ...(userConfig.auth || {}),\n },\n };\n setGlobalConfig(newConfig);\n}\n\n/**\n * Get the current configuration\n * @returns Current merged configuration\n */\nexport function getConfig(): typeof defaultConfig {\n return getGlobalConfig();\n}\n\n/**\n * Reset configuration to defaults\n * Mainly useful for testing\n */\nexport function resetConfig(): void {\n setGlobalConfig({ ...defaultConfig });\n}\n"],"names":[],"mappings":"AAqIA,MAAM,aAAA,GAID;AAAA,EACH,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,OAAA,EAAS,IAAA;AAAA,IACT,UAAA,EAAY;AAAA,GACd;AAAA,EACA,KAAA,EAAO;AAAA,IACL,OAAA,EAAS,MAAA;AAAA,IACT,OAAA,EAAS,GAAA;AAAA,IACT,eAAA,EAAiB,IAAA;AAAA,IACjB,OAAA,EAAS;AAAA,MACP,cAAA,EAAgB,kBAAA;AAAA,MAChB,MAAA,EAAQ;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;AAAC;AACpC,KACF;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,GAAG,aAAA,CAAc,IAAA;AAAA,MACjB,GAAI,UAAA,CAAW,IAAA,IAAQ;AAAC;AAC1B,GACF;AACA,EAAA,eAAA,CAAgB,SAAS,CAAA;AAC3B;AAMO,SAAS,SAAA,GAAkC;AAChD,EAAA,OAAO,eAAA,EAAgB;AACzB;AAMO,SAAS,WAAA,GAAoB;AAClC,EAAA,eAAA,CAAgB,EAAE,GAAG,aAAA,EAAe,CAAA;AACtC;;;;"}
package/dist/index3.js CHANGED
@@ -1,13 +1,65 @@
1
1
  import * as React from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
2
3
 
3
- // packages/react/use-callback-ref/src/use-callback-ref.tsx
4
- function useCallbackRef(callback) {
5
- const callbackRef = React.useRef(callback);
6
- React.useEffect(() => {
7
- callbackRef.current = callback;
8
- });
9
- return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);
4
+ // src/create-context.tsx
5
+ function createContextScope(scopeName, createContextScopeDeps = []) {
6
+ let defaultContexts = [];
7
+ function createContext3(rootComponentName, defaultContext) {
8
+ const BaseContext = React.createContext(defaultContext);
9
+ BaseContext.displayName = rootComponentName + "Context";
10
+ const index = defaultContexts.length;
11
+ defaultContexts = [...defaultContexts, defaultContext];
12
+ const Provider = (props) => {
13
+ const { scope, children, ...context } = props;
14
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
15
+ const value = React.useMemo(() => context, Object.values(context));
16
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
17
+ };
18
+ Provider.displayName = rootComponentName + "Provider";
19
+ function useContext2(consumerName, scope) {
20
+ const Context = scope?.[scopeName]?.[index] || BaseContext;
21
+ const context = React.useContext(Context);
22
+ if (context) return context;
23
+ if (defaultContext !== void 0) return defaultContext;
24
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
25
+ }
26
+ return [Provider, useContext2];
27
+ }
28
+ const createScope = () => {
29
+ const scopeContexts = defaultContexts.map((defaultContext) => {
30
+ return React.createContext(defaultContext);
31
+ });
32
+ return function useScope(scope) {
33
+ const contexts = scope?.[scopeName] || scopeContexts;
34
+ return React.useMemo(
35
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
36
+ [scope, contexts]
37
+ );
38
+ };
39
+ };
40
+ createScope.scopeName = scopeName;
41
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
42
+ }
43
+ function composeContextScopes(...scopes) {
44
+ const baseScope = scopes[0];
45
+ if (scopes.length === 1) return baseScope;
46
+ const createScope = () => {
47
+ const scopeHooks = scopes.map((createScope2) => ({
48
+ useScope: createScope2(),
49
+ scopeName: createScope2.scopeName
50
+ }));
51
+ return function useComposedScopes(overrideScopes) {
52
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
53
+ const scopeProps = useScope(overrideScopes);
54
+ const currentScope = scopeProps[`__scope${scopeName}`];
55
+ return { ...nextScopes2, ...currentScope };
56
+ }, {});
57
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
58
+ };
59
+ };
60
+ createScope.scopeName = baseScope.scopeName;
61
+ return createScope;
10
62
  }
11
63
 
12
- export { useCallbackRef as u };
64
+ export { createContextScope as c };
13
65
  //# sourceMappingURL=index3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index3.js","sources":["../node_modules/.pnpm/@radix-ui+react-use-callback-ref@1.1.1_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs"],"sourcesContent":["// packages/react/use-callback-ref/src/use-callback-ref.tsx\nimport * as React from \"react\";\nfunction useCallbackRef(callback) {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => (...args) => callbackRef.current?.(...args), []);\n}\nexport {\n useCallbackRef\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;AAAA;AAEA,SAAS,cAAc,CAAC,QAAQ,EAAE;AAClC,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC5C,EAAE,KAAK,CAAC,SAAS,CAAC,MAAM;AACxB,IAAI,WAAW,CAAC,OAAO,GAAG,QAAQ;AAClC,EAAE,CAAC,CAAC;AACJ,EAAE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,KAAK,WAAW,CAAC,OAAO,GAAG,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAC7E;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index3.js","sources":["../node_modules/.pnpm/@radix-ui+react-context@1.1.3_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-context/dist/index.mjs"],"sourcesContent":["// src/create-context.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n Context.displayName = rootComponentName + \"Context\";\n const Provider = (props) => {\n const { children, ...context } = props;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName) {\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n BaseContext.displayName = rootComponentName + \"Context\";\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n const Provider = (props) => {\n const { scope, children, ...context } = props;\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const value = React.useMemo(() => context, Object.values(context));\n return /* @__PURE__ */ jsx(Context.Provider, { value, children });\n };\n Provider.displayName = rootComponentName + \"Provider\";\n function useContext2(consumerName, scope) {\n const Context = scope?.[scopeName]?.[index] || BaseContext;\n const context = React.useContext(Context);\n if (context) return context;\n if (defaultContext !== void 0) return defaultContext;\n throw new Error(`\\`${consumerName}\\` must be used within \\`${rootComponentName}\\``);\n }\n return [Provider, useContext2];\n }\n const createScope = () => {\n const scopeContexts = defaultContexts.map((defaultContext) => {\n return React.createContext(defaultContext);\n });\n return function useScope(scope) {\n const contexts = scope?.[scopeName] || scopeContexts;\n return React.useMemo(\n () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),\n [scope, contexts]\n );\n };\n };\n createScope.scopeName = scopeName;\n return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];\n}\nfunction composeContextScopes(...scopes) {\n const baseScope = scopes[0];\n if (scopes.length === 1) return baseScope;\n const createScope = () => {\n const scopeHooks = scopes.map((createScope2) => ({\n useScope: createScope2(),\n scopeName: createScope2.scopeName\n }));\n return function useComposedScopes(overrideScopes) {\n const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {\n const scopeProps = useScope(overrideScopes);\n const currentScope = scopeProps[`__scope${scopeName}`];\n return { ...nextScopes2, ...currentScope };\n }, {});\n return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);\n };\n };\n createScope.scopeName = baseScope.scopeName;\n return createScope;\n}\nexport {\n createContext2 as createContext,\n createContextScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;AAAA;AAoBA,SAAS,kBAAkB,CAAC,SAAS,EAAE,sBAAsB,GAAG,EAAE,EAAE;AACpE,EAAE,IAAI,eAAe,GAAG,EAAE;AAC1B,EAAE,SAAS,cAAc,CAAC,iBAAiB,EAAE,cAAc,EAAE;AAC7D,IAAI,MAAM,WAAW,GAAG,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC;AAC3D,IAAI,WAAW,CAAC,WAAW,GAAG,iBAAiB,GAAG,SAAS;AAC3D,IAAI,MAAM,K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