@addsign/moje-agenda-shared-lib 2.0.1 → 2.0.3

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 (76) hide show
  1. package/dist/Dialog-CLPZ1Y00.js +422 -0
  2. package/dist/Dialog-CLPZ1Y00.js.map +1 -0
  3. package/dist/assets/style.css +14 -0
  4. package/dist/components/datatable/DataTable.js +5 -1
  5. package/dist/components/datatable/DataTable.js.map +1 -1
  6. package/dist/components/datatable/DataTableServer.js +5 -1
  7. package/dist/components/datatable/DataTableServer.js.map +1 -1
  8. package/dist/components/form/AutocompleteSearchBar.js +5 -1
  9. package/dist/components/form/AutocompleteSearchBar.js.map +1 -1
  10. package/dist/components/form/AutocompleteSearchBarServer.js +5 -1
  11. package/dist/components/form/AutocompleteSearchBarServer.js.map +1 -1
  12. package/dist/components/form/FileInput.js +6 -2
  13. package/dist/components/form/FileInput.js.map +1 -1
  14. package/dist/components/form/FileInputMultiple.js +6 -2
  15. package/dist/components/form/FileInputMultiple.js.map +1 -1
  16. package/dist/components/form/FormField.js +5 -1
  17. package/dist/components/form/FormField.js.map +1 -1
  18. package/dist/components/form/PositionsSelectorSingle.js +5 -1
  19. package/dist/components/form/PositionsSelectorSingle.js.map +1 -1
  20. package/dist/components/form/SelectField.js +5 -1
  21. package/dist/components/form/SelectField.js.map +1 -1
  22. package/dist/components/profiles/ProfileOverview.js +5 -1
  23. package/dist/components/profiles/ProfileOverview.js.map +1 -1
  24. package/dist/components/ui/Combobox.js +2 -2
  25. package/dist/components/ui/Combobox.js.map +1 -1
  26. package/dist/components/ui/Dialog.js +1 -1
  27. package/dist/components/ui/ScrollArea.js +3 -3
  28. package/dist/components/ui/button.js +4 -4
  29. package/dist/components/ui/button.js.map +1 -1
  30. package/dist/components/ui/command.js +2 -2
  31. package/dist/components/ui/form.js +1 -1
  32. package/dist/components/ui/input.d.ts +5 -1
  33. package/dist/components/ui/input.js +92 -13
  34. package/dist/components/ui/input.js.map +1 -1
  35. package/dist/components/ui/label.js +1 -1
  36. package/dist/components/ui/popover.js +6 -5
  37. package/dist/components/ui/popover.js.map +1 -1
  38. package/dist/components/ui/radioGroup.js +4 -4
  39. package/dist/components/ui/select.d.ts +3 -1
  40. package/dist/components/ui/select.js +10 -35
  41. package/dist/components/ui/select.js.map +1 -1
  42. package/dist/components/ui/separator.d.ts +4 -0
  43. package/dist/components/ui/separator.js +48 -0
  44. package/dist/components/ui/separator.js.map +1 -0
  45. package/dist/components/ui/tooltip.d.ts +7 -0
  46. package/dist/components/ui/tooltip.js +509 -0
  47. package/dist/components/ui/tooltip.js.map +1 -0
  48. package/dist/index-B3cR4C4Z.js +2203 -0
  49. package/dist/index-B3cR4C4Z.js.map +1 -0
  50. package/dist/index-B761_inZ.js +28884 -0
  51. package/dist/index-B761_inZ.js.map +1 -0
  52. package/dist/index-BULFV6Qz.js +2266 -0
  53. package/dist/index-BULFV6Qz.js.map +1 -0
  54. package/dist/index-Bjw9JvWH.js +131 -0
  55. package/dist/index-Bjw9JvWH.js.map +1 -0
  56. package/dist/index-BzZGaGRV.js +230 -0
  57. package/dist/index-BzZGaGRV.js.map +1 -0
  58. package/dist/index-C59RTYp9.js +140 -0
  59. package/dist/index-C59RTYp9.js.map +1 -0
  60. package/dist/index-D8AkGh-j.js +1173 -0
  61. package/dist/index-D8AkGh-j.js.map +1 -0
  62. package/dist/index-D9mvqz1C.js +97 -0
  63. package/dist/index-D9mvqz1C.js.map +1 -0
  64. package/dist/index-cCT-Qkr7.js +36 -0
  65. package/dist/index-cCT-Qkr7.js.map +1 -0
  66. package/dist/main.d.ts +4 -0
  67. package/dist/main.js +22 -1
  68. package/dist/main.js.map +1 -1
  69. package/lib/components/ui/Combobox.tsx +12 -8
  70. package/lib/components/ui/button.tsx +3 -3
  71. package/lib/components/ui/input.tsx +96 -10
  72. package/lib/components/ui/select.tsx +9 -5
  73. package/lib/components/ui/separator.tsx +29 -0
  74. package/lib/components/ui/tooltip.tsx +28 -0
  75. package/lib/main.ts +4 -0
  76. package/package.json +3 -1
@@ -0,0 +1,230 @@
1
+ import * as React from "react";
2
+ import { d as useCallbackRef, a as composeEventHandlers } from "./index-BpHbTxNe.js";
3
+ import { P as Primitive, d as dispatchDiscreteCustomEvent } from "./index-B761_inZ.js";
4
+ import { u as useComposedRefs } from "./index-D9mvqz1C.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
7
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
8
+ React.useEffect(() => {
9
+ const handleKeyDown = (event) => {
10
+ if (event.key === "Escape") {
11
+ onEscapeKeyDown(event);
12
+ }
13
+ };
14
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
15
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
16
+ }, [onEscapeKeyDown, ownerDocument]);
17
+ }
18
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
19
+ var CONTEXT_UPDATE = "dismissableLayer.update";
20
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
21
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
22
+ var originalBodyPointerEvents;
23
+ var DismissableLayerContext = React.createContext({
24
+ layers: /* @__PURE__ */ new Set(),
25
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
26
+ branches: /* @__PURE__ */ new Set()
27
+ });
28
+ var DismissableLayer = React.forwardRef(
29
+ (props, forwardedRef) => {
30
+ const {
31
+ disableOutsidePointerEvents = false,
32
+ onEscapeKeyDown,
33
+ onPointerDownOutside,
34
+ onFocusOutside,
35
+ onInteractOutside,
36
+ onDismiss,
37
+ ...layerProps
38
+ } = props;
39
+ const context = React.useContext(DismissableLayerContext);
40
+ const [node, setNode] = React.useState(null);
41
+ const ownerDocument = (node == null ? void 0 : node.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document);
42
+ const [, force] = React.useState({});
43
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
44
+ const layers = Array.from(context.layers);
45
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
46
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
47
+ const index = node ? layers.indexOf(node) : -1;
48
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
49
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
50
+ const pointerDownOutside = usePointerDownOutside((event) => {
51
+ const target = event.target;
52
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
53
+ if (!isPointerEventsEnabled || isPointerDownOnBranch)
54
+ return;
55
+ onPointerDownOutside == null ? void 0 : onPointerDownOutside(event);
56
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
57
+ if (!event.defaultPrevented)
58
+ onDismiss == null ? void 0 : onDismiss();
59
+ }, ownerDocument);
60
+ const focusOutside = useFocusOutside((event) => {
61
+ const target = event.target;
62
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
63
+ if (isFocusInBranch)
64
+ return;
65
+ onFocusOutside == null ? void 0 : onFocusOutside(event);
66
+ onInteractOutside == null ? void 0 : onInteractOutside(event);
67
+ if (!event.defaultPrevented)
68
+ onDismiss == null ? void 0 : onDismiss();
69
+ }, ownerDocument);
70
+ useEscapeKeydown((event) => {
71
+ const isHighestLayer = index === context.layers.size - 1;
72
+ if (!isHighestLayer)
73
+ return;
74
+ onEscapeKeyDown == null ? void 0 : onEscapeKeyDown(event);
75
+ if (!event.defaultPrevented && onDismiss) {
76
+ event.preventDefault();
77
+ onDismiss();
78
+ }
79
+ }, ownerDocument);
80
+ React.useEffect(() => {
81
+ if (!node)
82
+ return;
83
+ if (disableOutsidePointerEvents) {
84
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
85
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
86
+ ownerDocument.body.style.pointerEvents = "none";
87
+ }
88
+ context.layersWithOutsidePointerEventsDisabled.add(node);
89
+ }
90
+ context.layers.add(node);
91
+ dispatchUpdate();
92
+ return () => {
93
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
94
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
95
+ }
96
+ };
97
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
98
+ React.useEffect(() => {
99
+ return () => {
100
+ if (!node)
101
+ return;
102
+ context.layers.delete(node);
103
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
104
+ dispatchUpdate();
105
+ };
106
+ }, [node, context]);
107
+ React.useEffect(() => {
108
+ const handleUpdate = () => force({});
109
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
110
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
111
+ }, []);
112
+ return /* @__PURE__ */ jsx(
113
+ Primitive.div,
114
+ {
115
+ ...layerProps,
116
+ ref: composedRefs,
117
+ style: {
118
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
119
+ ...props.style
120
+ },
121
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
122
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
123
+ onPointerDownCapture: composeEventHandlers(
124
+ props.onPointerDownCapture,
125
+ pointerDownOutside.onPointerDownCapture
126
+ )
127
+ }
128
+ );
129
+ }
130
+ );
131
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
132
+ var BRANCH_NAME = "DismissableLayerBranch";
133
+ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
134
+ const context = React.useContext(DismissableLayerContext);
135
+ const ref = React.useRef(null);
136
+ const composedRefs = useComposedRefs(forwardedRef, ref);
137
+ React.useEffect(() => {
138
+ const node = ref.current;
139
+ if (node) {
140
+ context.branches.add(node);
141
+ return () => {
142
+ context.branches.delete(node);
143
+ };
144
+ }
145
+ }, [context.branches]);
146
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
147
+ });
148
+ DismissableLayerBranch.displayName = BRANCH_NAME;
149
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
150
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
151
+ const isPointerInsideReactTreeRef = React.useRef(false);
152
+ const handleClickRef = React.useRef(() => {
153
+ });
154
+ React.useEffect(() => {
155
+ const handlePointerDown = (event) => {
156
+ if (event.target && !isPointerInsideReactTreeRef.current) {
157
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
158
+ handleAndDispatchCustomEvent(
159
+ POINTER_DOWN_OUTSIDE,
160
+ handlePointerDownOutside,
161
+ eventDetail,
162
+ { discrete: true }
163
+ );
164
+ };
165
+ const eventDetail = { originalEvent: event };
166
+ if (event.pointerType === "touch") {
167
+ ownerDocument.removeEventListener("click", handleClickRef.current);
168
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
169
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
170
+ } else {
171
+ handleAndDispatchPointerDownOutsideEvent2();
172
+ }
173
+ } else {
174
+ ownerDocument.removeEventListener("click", handleClickRef.current);
175
+ }
176
+ isPointerInsideReactTreeRef.current = false;
177
+ };
178
+ const timerId = window.setTimeout(() => {
179
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
180
+ }, 0);
181
+ return () => {
182
+ window.clearTimeout(timerId);
183
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
184
+ ownerDocument.removeEventListener("click", handleClickRef.current);
185
+ };
186
+ }, [ownerDocument, handlePointerDownOutside]);
187
+ return {
188
+ // ensures we check React component tree (not just DOM tree)
189
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
190
+ };
191
+ }
192
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis == null ? void 0 : globalThis.document) {
193
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
194
+ const isFocusInsideReactTreeRef = React.useRef(false);
195
+ React.useEffect(() => {
196
+ const handleFocus = (event) => {
197
+ if (event.target && !isFocusInsideReactTreeRef.current) {
198
+ const eventDetail = { originalEvent: event };
199
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
200
+ discrete: false
201
+ });
202
+ }
203
+ };
204
+ ownerDocument.addEventListener("focusin", handleFocus);
205
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
206
+ }, [ownerDocument, handleFocusOutside]);
207
+ return {
208
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
209
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
210
+ };
211
+ }
212
+ function dispatchUpdate() {
213
+ const event = new CustomEvent(CONTEXT_UPDATE);
214
+ document.dispatchEvent(event);
215
+ }
216
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
217
+ const target = detail.originalEvent.target;
218
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
219
+ if (handler)
220
+ target.addEventListener(name, handler, { once: true });
221
+ if (discrete) {
222
+ dispatchDiscreteCustomEvent(target, event);
223
+ } else {
224
+ target.dispatchEvent(event);
225
+ }
226
+ }
227
+ export {
228
+ DismissableLayer as D
229
+ };
230
+ //# sourceMappingURL=index-BzZGaGRV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BzZGaGRV.js","sources":["../node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs","../node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs"],"sourcesContent":["// packages/react/use-escape-keydown/src/useEscapeKeydown.tsx\nimport * as React from \"react\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nfunction useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {\n const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);\n React.useEffect(() => {\n const handleKeyDown = (event) => {\n if (event.key === \"Escape\") {\n onEscapeKeyDown(event);\n }\n };\n ownerDocument.addEventListener(\"keydown\", handleKeyDown, { capture: true });\n return () => ownerDocument.removeEventListener(\"keydown\", handleKeyDown, { capture: true });\n }, [onEscapeKeyDown, ownerDocument]);\n}\nexport {\n useEscapeKeydown\n};\n//# sourceMappingURL=index.mjs.map\n","\"use client\";\n\n// packages/react/dismissable-layer/src/DismissableLayer.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { Primitive, dispatchDiscreteCustomEvent } from \"@radix-ui/react-primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { useEscapeKeydown } from \"@radix-ui/react-use-escape-keydown\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DISMISSABLE_LAYER_NAME = \"DismissableLayer\";\nvar CONTEXT_UPDATE = \"dismissableLayer.update\";\nvar POINTER_DOWN_OUTSIDE = \"dismissableLayer.pointerDownOutside\";\nvar FOCUS_OUTSIDE = \"dismissableLayer.focusOutside\";\nvar originalBodyPointerEvents;\nvar DismissableLayerContext = React.createContext({\n layers: /* @__PURE__ */ new Set(),\n layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),\n branches: /* @__PURE__ */ new Set()\n});\nvar DismissableLayer = React.forwardRef(\n (props, forwardedRef) => {\n const {\n disableOutsidePointerEvents = false,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n onDismiss,\n ...layerProps\n } = props;\n const context = React.useContext(DismissableLayerContext);\n const [node, setNode] = React.useState(null);\n const ownerDocument = node?.ownerDocument ?? globalThis?.document;\n const [, force] = React.useState({});\n const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));\n const layers = Array.from(context.layers);\n const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);\n const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);\n const index = node ? layers.indexOf(node) : -1;\n const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;\n const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;\n const pointerDownOutside = usePointerDownOutside((event) => {\n const target = event.target;\n const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));\n if (!isPointerEventsEnabled || isPointerDownOnBranch) return;\n onPointerDownOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n const focusOutside = useFocusOutside((event) => {\n const target = event.target;\n const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));\n if (isFocusInBranch) return;\n onFocusOutside?.(event);\n onInteractOutside?.(event);\n if (!event.defaultPrevented) onDismiss?.();\n }, ownerDocument);\n useEscapeKeydown((event) => {\n const isHighestLayer = index === context.layers.size - 1;\n if (!isHighestLayer) return;\n onEscapeKeyDown?.(event);\n if (!event.defaultPrevented && onDismiss) {\n event.preventDefault();\n onDismiss();\n }\n }, ownerDocument);\n React.useEffect(() => {\n if (!node) return;\n if (disableOutsidePointerEvents) {\n if (context.layersWithOutsidePointerEventsDisabled.size === 0) {\n originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;\n ownerDocument.body.style.pointerEvents = \"none\";\n }\n context.layersWithOutsidePointerEventsDisabled.add(node);\n }\n context.layers.add(node);\n dispatchUpdate();\n return () => {\n if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {\n ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;\n }\n };\n }, [node, ownerDocument, disableOutsidePointerEvents, context]);\n React.useEffect(() => {\n return () => {\n if (!node) return;\n context.layers.delete(node);\n context.layersWithOutsidePointerEventsDisabled.delete(node);\n dispatchUpdate();\n };\n }, [node, context]);\n React.useEffect(() => {\n const handleUpdate = () => force({});\n document.addEventListener(CONTEXT_UPDATE, handleUpdate);\n return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);\n }, []);\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n ...layerProps,\n ref: composedRefs,\n style: {\n pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? \"auto\" : \"none\" : void 0,\n ...props.style\n },\n onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),\n onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),\n onPointerDownCapture: composeEventHandlers(\n props.onPointerDownCapture,\n pointerDownOutside.onPointerDownCapture\n )\n }\n );\n }\n);\nDismissableLayer.displayName = DISMISSABLE_LAYER_NAME;\nvar BRANCH_NAME = \"DismissableLayerBranch\";\nvar DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {\n const context = React.useContext(DismissableLayerContext);\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n React.useEffect(() => {\n const node = ref.current;\n if (node) {\n context.branches.add(node);\n return () => {\n context.branches.delete(node);\n };\n }\n }, [context.branches]);\n return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });\n});\nDismissableLayerBranch.displayName = BRANCH_NAME;\nfunction usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {\n const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);\n const isPointerInsideReactTreeRef = React.useRef(false);\n const handleClickRef = React.useRef(() => {\n });\n React.useEffect(() => {\n const handlePointerDown = (event) => {\n if (event.target && !isPointerInsideReactTreeRef.current) {\n let handleAndDispatchPointerDownOutsideEvent2 = function() {\n handleAndDispatchCustomEvent(\n POINTER_DOWN_OUTSIDE,\n handlePointerDownOutside,\n eventDetail,\n { discrete: true }\n );\n };\n var handleAndDispatchPointerDownOutsideEvent = handleAndDispatchPointerDownOutsideEvent2;\n const eventDetail = { originalEvent: event };\n if (event.pointerType === \"touch\") {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;\n ownerDocument.addEventListener(\"click\", handleClickRef.current, { once: true });\n } else {\n handleAndDispatchPointerDownOutsideEvent2();\n }\n } else {\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n }\n isPointerInsideReactTreeRef.current = false;\n };\n const timerId = window.setTimeout(() => {\n ownerDocument.addEventListener(\"pointerdown\", handlePointerDown);\n }, 0);\n return () => {\n window.clearTimeout(timerId);\n ownerDocument.removeEventListener(\"pointerdown\", handlePointerDown);\n ownerDocument.removeEventListener(\"click\", handleClickRef.current);\n };\n }, [ownerDocument, handlePointerDownOutside]);\n return {\n // ensures we check React component tree (not just DOM tree)\n onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true\n };\n}\nfunction useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {\n const handleFocusOutside = useCallbackRef(onFocusOutside);\n const isFocusInsideReactTreeRef = React.useRef(false);\n React.useEffect(() => {\n const handleFocus = (event) => {\n if (event.target && !isFocusInsideReactTreeRef.current) {\n const eventDetail = { originalEvent: event };\n handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {\n discrete: false\n });\n }\n };\n ownerDocument.addEventListener(\"focusin\", handleFocus);\n return () => ownerDocument.removeEventListener(\"focusin\", handleFocus);\n }, [ownerDocument, handleFocusOutside]);\n return {\n onFocusCapture: () => isFocusInsideReactTreeRef.current = true,\n onBlurCapture: () => isFocusInsideReactTreeRef.current = false\n };\n}\nfunction dispatchUpdate() {\n const event = new CustomEvent(CONTEXT_UPDATE);\n document.dispatchEvent(event);\n}\nfunction handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {\n const target = detail.originalEvent.target;\n const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });\n if (handler) target.addEventListener(name, handler, { once: true });\n if (discrete) {\n dispatchDiscreteCustomEvent(target, event);\n } else {\n target.dispatchEvent(event);\n }\n}\nvar Root = DismissableLayer;\nvar Branch = DismissableLayerBranch;\nexport {\n Branch,\n DismissableLayer,\n DismissableLayerBranch,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;AAGA,SAAS,iBAAiB,qBAAqB,gBAAgB,yCAAY,UAAU;AACnF,QAAM,kBAAkB,eAAe,mBAAmB;AAC1D,QAAM,UAAU,MAAM;AACpB,UAAM,gBAAgB,CAAC,UAAU;AAC/B,UAAI,MAAM,QAAQ,UAAU;AAC1B,wBAAgB,KAAK;AAAA,MACtB;AAAA,IACP;AACI,kBAAc,iBAAiB,WAAW,eAAe,EAAE,SAAS,KAAI,CAAE;AAC1E,WAAO,MAAM,cAAc,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAI,CAAE;AAAA,EAC9F,GAAK,CAAC,iBAAiB,aAAa,CAAC;AACrC;ACJA,IAAI,yBAAyB;AAC7B,IAAI,iBAAiB;AACrB,IAAI,uBAAuB;AAC3B,IAAI,gBAAgB;AACpB,IAAI;AACJ,IAAI,0BAA0B,MAAM,cAAc;AAAA,EAChD,QAAwB,oBAAI,IAAK;AAAA,EACjC,wCAAwD,oBAAI,IAAK;AAAA,EACjE,UAA0B,oBAAI,IAAK;AACrC,CAAC;AACE,IAAC,mBAAmB,MAAM;AAAA,EAC3B,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ,8BAA8B;AAAA,MAC9B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG;AAAA,IACJ,IAAG;AACJ,UAAM,UAAU,MAAM,WAAW,uBAAuB;AACxD,UAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAS,IAAI;AAC3C,UAAM,iBAAgB,6BAAM,mBAAiB,yCAAY;AACzD,UAAM,CAAG,EAAA,KAAK,IAAI,MAAM,SAAS,CAAE,CAAA;AACnC,UAAM,eAAe,gBAAgB,cAAc,CAAC,UAAU,QAAQ,KAAK,CAAC;AAC5E,UAAM,SAAS,MAAM,KAAK,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AAC;AAC5C,SAAO;AAAA;AAAA,IAEL,sBAAsB,MAAM,4BAA4B,UAAU;AAAA,EACtE;AACA;AACA,SAAS,gBAAgB,gBAAgB,gBAAgB,yCAAY,UAAU;AAC7E,QAAM,qBAAqB,eAAe,cAAc;AACxD,QAAM,4BAA4B,MAAM,OAAO,KAAK;AACpD,QAAM,UAAU,MAAM;AACpB,UAAM,cAAc,CAAC,UAAU;AAC7B,UAAI,MAAM,UAAU,CAAC,0BAA0B,SAAS;AACtD,cAAM,cAAc,EAAE,eAAe;AACrC,qCAA6B,eAAe,oBAAoB,aAAa;AAAA,UAC3E,UAAU;AAAA,QACpB,CAAS;AAAA,MACF;AAAA,IACP;AACI,kBAAc,iBAAiB,WAAW,WAAW;AACrD,WAAO,MAAM,cAAc,oBAAoB,WAAW,WAAW;AAAA,EACzE,GAAK,CAAC,eAAe,kBAAkB,CAAC;AACtC,SAAO;AAAA,IACL,gBAAgB,MAAM,0BAA0B,UAAU;AAAA,IAC1D,eAAe,MAAM,0BAA0B,UAAU;AAAA,EAC7D;AACA;AACA,SAAS,iBAAiB;AACxB,QAAM,QAAQ,IAAI,YAAY,cAAc;AAC5C,WAAS,cAAc,KAAK;AAC9B;AACA,SAAS,6BAA6B,MAAM,SAAS,QAAQ,EAAE,SAAQ,GAAI;AACzE,QAAM,SAAS,OAAO,cAAc;AACpC,QAAM,QAAQ,IAAI,YAAY,MAAM,EAAE,SAAS,OAAO,YAAY,MAAM,OAAM,CAAE;AAChF,MAAI;AAAS,WAAO,iBAAiB,MAAM,SAAS,EAAE,MAAM,KAAI,CAAE;AAClE,MAAI,UAAU;AACZ,gCAA4B,QAAQ,KAAK;AAAA,EAC7C,OAAS;AACL,WAAO,cAAc,KAAK;AAAA,EAC3B;AACH;","x_google_ignoreList":[0,1]}
@@ -0,0 +1,140 @@
1
+ import * as React from "react";
2
+ import React__default from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { u as useComposedRefs, S as Slot } from "./index-D9mvqz1C.js";
5
+ function createContextScope(scopeName, createContextScopeDeps = []) {
6
+ let defaultContexts = [];
7
+ function createContext3(rootComponentName, defaultContext) {
8
+ const BaseContext = React.createContext(defaultContext);
9
+ const index = defaultContexts.length;
10
+ defaultContexts = [...defaultContexts, defaultContext];
11
+ function Provider(props) {
12
+ const { scope, children, ...context } = props;
13
+ const Context = (scope == null ? void 0 : scope[scopeName][index]) || BaseContext;
14
+ const value = React.useMemo(() => context, Object.values(context));
15
+ return /* @__PURE__ */ jsx(Context.Provider, { value, children });
16
+ }
17
+ function useContext2(consumerName, scope) {
18
+ const Context = (scope == null ? void 0 : scope[scopeName][index]) || BaseContext;
19
+ const context = React.useContext(Context);
20
+ if (context)
21
+ return context;
22
+ if (defaultContext !== void 0)
23
+ return defaultContext;
24
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
25
+ }
26
+ Provider.displayName = rootComponentName + "Provider";
27
+ return [Provider, useContext2];
28
+ }
29
+ const createScope = () => {
30
+ const scopeContexts = defaultContexts.map((defaultContext) => {
31
+ return React.createContext(defaultContext);
32
+ });
33
+ return function useScope(scope) {
34
+ const contexts = (scope == null ? void 0 : scope[scopeName]) || scopeContexts;
35
+ return React.useMemo(
36
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
37
+ [scope, contexts]
38
+ );
39
+ };
40
+ };
41
+ createScope.scopeName = scopeName;
42
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
43
+ }
44
+ function composeContextScopes(...scopes) {
45
+ const baseScope = scopes[0];
46
+ if (scopes.length === 1)
47
+ return baseScope;
48
+ const createScope = () => {
49
+ const scopeHooks = scopes.map((createScope2) => ({
50
+ useScope: createScope2(),
51
+ scopeName: createScope2.scopeName
52
+ }));
53
+ return function useComposedScopes(overrideScopes) {
54
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
55
+ const scopeProps = useScope(overrideScopes);
56
+ const currentScope = scopeProps[`__scope${scopeName}`];
57
+ return { ...nextScopes2, ...currentScope };
58
+ }, {});
59
+ return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
60
+ };
61
+ };
62
+ createScope.scopeName = baseScope.scopeName;
63
+ return createScope;
64
+ }
65
+ function createCollection(name) {
66
+ const PROVIDER_NAME = name + "CollectionProvider";
67
+ const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
68
+ const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
69
+ PROVIDER_NAME,
70
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
71
+ );
72
+ const CollectionProvider = (props) => {
73
+ const { scope, children } = props;
74
+ const ref = React__default.useRef(null);
75
+ const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
76
+ return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
77
+ };
78
+ CollectionProvider.displayName = PROVIDER_NAME;
79
+ const COLLECTION_SLOT_NAME = name + "CollectionSlot";
80
+ const CollectionSlot = React__default.forwardRef(
81
+ (props, forwardedRef) => {
82
+ const { scope, children } = props;
83
+ const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
84
+ const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
85
+ return /* @__PURE__ */ jsx(Slot, { ref: composedRefs, children });
86
+ }
87
+ );
88
+ CollectionSlot.displayName = COLLECTION_SLOT_NAME;
89
+ const ITEM_SLOT_NAME = name + "CollectionItemSlot";
90
+ const ITEM_DATA_ATTR = "data-radix-collection-item";
91
+ const CollectionItemSlot = React__default.forwardRef(
92
+ (props, forwardedRef) => {
93
+ const { scope, children, ...itemData } = props;
94
+ const ref = React__default.useRef(null);
95
+ const composedRefs = useComposedRefs(forwardedRef, ref);
96
+ const context = useCollectionContext(ITEM_SLOT_NAME, scope);
97
+ React__default.useEffect(() => {
98
+ context.itemMap.set(ref, { ref, ...itemData });
99
+ return () => void context.itemMap.delete(ref);
100
+ });
101
+ return /* @__PURE__ */ jsx(Slot, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
102
+ }
103
+ );
104
+ CollectionItemSlot.displayName = ITEM_SLOT_NAME;
105
+ function useCollection(scope) {
106
+ const context = useCollectionContext(name + "CollectionConsumer", scope);
107
+ const getItems = React__default.useCallback(() => {
108
+ const collectionNode = context.collectionRef.current;
109
+ if (!collectionNode)
110
+ return [];
111
+ const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
112
+ const items = Array.from(context.itemMap.values());
113
+ const orderedItems = items.sort(
114
+ (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
115
+ );
116
+ return orderedItems;
117
+ }, [context.collectionRef, context.itemMap]);
118
+ return getItems;
119
+ }
120
+ return [
121
+ { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
122
+ useCollection,
123
+ createCollectionScope
124
+ ];
125
+ }
126
+ function usePrevious(value) {
127
+ const ref = React.useRef({ value, previous: value });
128
+ return React.useMemo(() => {
129
+ if (ref.current.value !== value) {
130
+ ref.current.previous = ref.current.value;
131
+ ref.current.value = value;
132
+ }
133
+ return ref.current.previous;
134
+ }, [value]);
135
+ }
136
+ export {
137
+ createCollection as c,
138
+ usePrevious as u
139
+ };
140
+ //# sourceMappingURL=index-C59RTYp9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C59RTYp9.js","sources":["../node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context/dist/index.mjs","../node_modules/@radix-ui/react-collection/dist/index.mjs","../node_modules/@radix-ui/react-use-previous/dist/index.mjs"],"sourcesContent":["// packages/react/context/src/createContext.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createContext2(rootComponentName, defaultContext) {\n const Context = React.createContext(defaultContext);\n function 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 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 Provider.displayName = rootComponentName + \"Provider\";\n return [Provider, useContext2];\n}\nfunction createContextScope(scopeName, createContextScopeDeps = []) {\n let defaultContexts = [];\n function createContext3(rootComponentName, defaultContext) {\n const BaseContext = React.createContext(defaultContext);\n const index = defaultContexts.length;\n defaultContexts = [...defaultContexts, defaultContext];\n function 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 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 Provider.displayName = rootComponentName + \"Provider\";\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","\"use client\";\n\n// packages/react/collection/src/Collection.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Slot } 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 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(Slot, { 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 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(Slot, { ...{ [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}\nexport {\n createCollection\n};\n//# sourceMappingURL=index.mjs.map\n","// packages/react/use-previous/src/usePrevious.tsx\nimport * as React from \"react\";\nfunction usePrevious(value) {\n const ref = React.useRef({ value, previous: value });\n return React.useMemo(() => {\n if (ref.current.value !== value) {\n ref.current.previous = ref.current.value;\n ref.current.value = value;\n }\n return ref.current.previous;\n }, [value]);\n}\nexport {\n usePrevious\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["React"],"mappings":";;;;AAmBA,SAAS,mBAAmB,WAAW,yBAAyB,IAAI;AAClE,MAAI,kBAAkB,CAAA;AACtB,WAAS,eAAe,mBAAmB,gBAAgB;AACzD,UAAM,cAAc,MAAM,cAAc,cAAc;AACtD,UAAM,QAAQ,gBAAgB;AAC9B,sBAAkB,CAAC,GAAG,iBAAiB,cAAc;AACrD,aAAS,SAAS,OAAO;AACvB,YAAM,EAAE,OAAO,UAAU,GAAG,QAAO,IAAK;AACxC,YAAM,WAAU,+BAAQ,WAAW,WAAU;AAC7C,YAAM,QAAQ,MAAM,QAAQ,MAAM,SAAS,OAAO,OAAO,OAAO,CAAC;AACjE,aAAuB,o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