@vritti/quantum-ui 0.5.9 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/Avatar.js +1 -1
  2. package/dist/Checkbox2.js +1 -1
  3. package/dist/{CurrencyField.js → CurrencyFieldFilter.js} +150 -6
  4. package/dist/CurrencyFieldFilter.js.map +1 -0
  5. package/dist/CurrencySelector.js.map +1 -1
  6. package/dist/DatePicker.js +15 -0
  7. package/dist/DatePicker.js.map +1 -1
  8. package/dist/DateRangePicker.js +135 -9
  9. package/dist/DateRangePicker.js.map +1 -1
  10. package/dist/DateTimePicker.js +2 -2
  11. package/dist/DateTimePicker.js.map +1 -1
  12. package/dist/DetailSectionSkeleton.js +1 -1
  13. package/dist/ISOCountrySelect.js.map +1 -1
  14. package/dist/IconSelect.js +255 -269
  15. package/dist/IconSelect.js.map +1 -1
  16. package/dist/LocaleSelector.js.map +1 -1
  17. package/dist/PieChart.js +13 -9
  18. package/dist/PieChart.js.map +1 -1
  19. package/dist/Progress.js +1 -1
  20. package/dist/RadioGroup.js +1 -1
  21. package/dist/RelativeDayStrip.js +83 -0
  22. package/dist/RelativeDayStrip.js.map +1 -0
  23. package/dist/Select.js +25 -8
  24. package/dist/Select.js.map +1 -1
  25. package/dist/SelectFilter.js +27 -12
  26. package/dist/SelectFilter.js.map +1 -1
  27. package/dist/Switch.js +1 -1
  28. package/dist/TimezoneSelector.js.map +1 -1
  29. package/dist/assets/quantum-ui.css +8 -0
  30. package/dist/banknote.js +19 -0
  31. package/dist/banknote.js.map +1 -0
  32. package/dist/components/CurrencyField.js +1 -1
  33. package/dist/components/DateFilter.js +17 -74
  34. package/dist/components/DateFilter.js.map +1 -1
  35. package/dist/components/DateRangePicker.js +1 -1
  36. package/dist/components/FormattedDate.js +3 -3
  37. package/dist/components/FormattedDate.js.map +1 -1
  38. package/dist/dropdown-menu.js +3 -3
  39. package/dist/hooks/index.js +3 -2
  40. package/dist/hooks/index.js.map +1 -1
  41. package/dist/index.js +5 -4
  42. package/dist/index.js.map +1 -1
  43. package/dist/index13.js +2 -2
  44. package/dist/index14.js +281 -22
  45. package/dist/index14.js.map +1 -1
  46. package/dist/index15.js +22 -281
  47. package/dist/index15.js.map +1 -1
  48. package/dist/index16.js +3 -3
  49. package/dist/index17.js +1 -1
  50. package/dist/index26.js +229 -34
  51. package/dist/index26.js.map +1 -1
  52. package/dist/index27.js +1099 -206
  53. package/dist/index27.js.map +1 -1
  54. package/dist/index28.js +2481 -1035
  55. package/dist/index28.js.map +1 -1
  56. package/dist/index29.js +35 -2569
  57. package/dist/index29.js.map +1 -1
  58. package/dist/index30.js +2 -2
  59. package/dist/index35.js +4 -4
  60. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts +27 -0
  61. package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts.map +1 -0
  62. package/dist/lib/components/CurrencyField/index.d.ts +2 -0
  63. package/dist/lib/components/CurrencyField/index.d.ts.map +1 -1
  64. package/dist/lib/components/DateFilter/DateFilter.d.ts +14 -6
  65. package/dist/lib/components/DateFilter/DateFilter.d.ts.map +1 -1
  66. package/dist/lib/components/DateFilter/index.d.ts +2 -2
  67. package/dist/lib/components/DateFilter/index.d.ts.map +1 -1
  68. package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  69. package/dist/lib/components/DatePicker/RelativeDayStrip.d.ts +28 -0
  70. package/dist/lib/components/DatePicker/RelativeDayStrip.d.ts.map +1 -0
  71. package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts +28 -0
  72. package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts.map +1 -0
  73. package/dist/lib/components/DateRangePicker/index.d.ts +2 -0
  74. package/dist/lib/components/DateRangePicker/index.d.ts.map +1 -1
  75. package/dist/lib/components/PieChart/PieChart.d.ts +3 -1
  76. package/dist/lib/components/PieChart/PieChart.d.ts.map +1 -1
  77. package/dist/lib/components/Select/SelectFilter.d.ts +17 -4
  78. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
  79. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +2 -0
  80. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  81. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +4 -0
  82. package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
  83. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  84. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts +2 -1
  85. package/dist/lib/components/Select/hooks/useMultiSelect.d.ts.map +1 -1
  86. package/dist/lib/components/index.d.ts +1 -1
  87. package/dist/lib/components/index.d.ts.map +1 -1
  88. package/dist/lib/hooks/index.d.ts +4 -3
  89. package/dist/lib/hooks/index.d.ts.map +1 -1
  90. package/dist/lib/hooks/useCategoricalColors.d.ts +3 -0
  91. package/dist/lib/hooks/useCategoricalColors.d.ts.map +1 -0
  92. package/dist/lib/hooks/useFormatters.d.ts +4 -1
  93. package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
  94. package/dist/lib/hooks/useWorkspaceCurrency.d.ts +2 -0
  95. package/dist/lib/hooks/useWorkspaceCurrency.d.ts.map +1 -0
  96. package/dist/lib/hooks/useWorkspaceTimeZone.d.ts +2 -0
  97. package/dist/lib/hooks/useWorkspaceTimeZone.d.ts.map +1 -0
  98. package/dist/lib/selects/currency/CurrencyFilter.d.ts +3 -5
  99. package/dist/lib/selects/currency/CurrencyFilter.d.ts.map +1 -1
  100. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +3 -4
  101. package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -1
  102. package/dist/lib/selects/locale/LocaleFilter.d.ts +3 -4
  103. package/dist/lib/selects/locale/LocaleFilter.d.ts.map +1 -1
  104. package/dist/lib/selects/timezone/TimezoneFilter.d.ts +3 -4
  105. package/dist/lib/selects/timezone/TimezoneFilter.d.ts.map +1 -1
  106. package/dist/lib/types/table-filter.d.ts +8 -2
  107. package/dist/lib/types/table-filter.d.ts.map +1 -1
  108. package/dist/lib/types/utility.d.ts +2 -0
  109. package/dist/lib/types/utility.d.ts.map +1 -0
  110. package/dist/lib/utils/colors.d.ts +8 -0
  111. package/dist/lib/utils/colors.d.ts.map +1 -1
  112. package/dist/lib/utils/currency.d.ts +2 -2
  113. package/dist/lib/utils/currency.d.ts.map +1 -1
  114. package/dist/lib/utils/format.d.ts +2 -2
  115. package/dist/lib/utils/format.d.ts.map +1 -1
  116. package/dist/lib/utils/timezone.d.ts +2 -2
  117. package/dist/lib/utils/timezone.d.ts.map +1 -1
  118. package/dist/popover.js +1 -1
  119. package/dist/separator2.js +1 -1
  120. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +2 -2
  121. package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
  122. package/dist/types/table-filter.js.map +1 -1
  123. package/dist/types/utility.js +2 -0
  124. package/dist/types/utility.js.map +1 -0
  125. package/dist/useCategoricalColors.js +20 -0
  126. package/dist/useCategoricalColors.js.map +1 -0
  127. package/dist/useDataTable.js +2 -2
  128. package/dist/useDataTable.js.map +1 -1
  129. package/dist/useFormatters.js +13 -13
  130. package/dist/useFormatters.js.map +1 -1
  131. package/dist/useWorkspaceTimeZone.js +10 -0
  132. package/dist/useWorkspaceTimeZone.js.map +1 -0
  133. package/dist/utils/colors.js +187 -1
  134. package/dist/utils/colors.js.map +1 -1
  135. package/dist/utils/currency.js +12 -12
  136. package/dist/utils/currency.js.map +1 -1
  137. package/dist/utils/format.js +6 -6
  138. package/dist/utils/format.js.map +1 -1
  139. package/dist/utils/timezone.js +12 -12
  140. package/dist/utils/timezone.js.map +1 -1
  141. package/package.json +5 -1
  142. package/dist/CurrencyField.js.map +0 -1
  143. package/dist/lib/hooks/useBUCurrency.d.ts +0 -2
  144. package/dist/lib/hooks/useBUCurrency.d.ts.map +0 -1
  145. package/dist/lib/hooks/useBUTimezone.d.ts +0 -2
  146. package/dist/lib/hooks/useBUTimezone.d.ts.map +0 -1
  147. package/dist/useBUTimezone.js +0 -10
  148. package/dist/useBUTimezone.js.map +0 -1
package/dist/index15.js CHANGED
@@ -1,290 +1,31 @@
1
1
  import * as React from 'react';
2
- import { u as useControllableState, P as Primitive, c as composeEventHandlers, a as createSlot } from './index20.js';
3
- import { u as useComposedRefs } from './index12.js';
4
- import { u as useId, P as Presence, c as createContextScope } from './index21.js';
5
- import { P as Portal$1, D as DismissableLayer } from './index27.js';
6
- import { h as hideOthers, R as ReactRemoveScroll, u as useFocusGuards, F as FocusScope } from './index28.js';
7
- import { R as Root2$1, A as Anchor, c as createPopperScope, C as Content, a as Arrow } from './index29.js';
2
+ import { P as Primitive } from './index29.js';
8
3
  import { jsx } from 'react/jsx-runtime';
9
4
 
10
- var POPOVER_NAME = "Popover";
11
- var [createPopoverContext] = createContextScope(POPOVER_NAME, [
12
- createPopperScope
13
- ]);
14
- var usePopperScope = createPopperScope();
15
- var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
16
- var Popover = (props) => {
17
- const {
18
- __scopePopover,
19
- children,
20
- open: openProp,
21
- defaultOpen,
22
- onOpenChange,
23
- modal = false
24
- } = props;
25
- const popperScope = usePopperScope(__scopePopover);
26
- const triggerRef = React.useRef(null);
27
- const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
28
- const [open, setOpen] = useControllableState({
29
- prop: openProp,
30
- defaultProp: defaultOpen ?? false,
31
- onChange: onOpenChange,
32
- caller: POPOVER_NAME
33
- });
34
- return /* @__PURE__ */ jsx(Root2$1, { ...popperScope, children: /* @__PURE__ */ jsx(
35
- PopoverProvider,
5
+ // src/separator.tsx
6
+ var NAME = "Separator";
7
+ var DEFAULT_ORIENTATION = "horizontal";
8
+ var ORIENTATIONS = ["horizontal", "vertical"];
9
+ var Separator = React.forwardRef((props, forwardedRef) => {
10
+ const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
11
+ const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
12
+ const ariaOrientation = orientation === "vertical" ? orientation : void 0;
13
+ const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
14
+ return /* @__PURE__ */ jsx(
15
+ Primitive.div,
36
16
  {
37
- scope: __scopePopover,
38
- contentId: useId(),
39
- triggerRef,
40
- open,
41
- onOpenChange: setOpen,
42
- onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
43
- hasCustomAnchor,
44
- onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
45
- onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
46
- modal,
47
- children
17
+ "data-orientation": orientation,
18
+ ...semanticProps,
19
+ ...domProps,
20
+ ref: forwardedRef
48
21
  }
49
- ) });
50
- };
51
- Popover.displayName = POPOVER_NAME;
52
- var ANCHOR_NAME = "PopoverAnchor";
53
- var PopoverAnchor = React.forwardRef(
54
- (props, forwardedRef) => {
55
- const { __scopePopover, ...anchorProps } = props;
56
- const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
57
- const popperScope = usePopperScope(__scopePopover);
58
- const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
59
- React.useEffect(() => {
60
- onCustomAnchorAdd();
61
- return () => onCustomAnchorRemove();
62
- }, [onCustomAnchorAdd, onCustomAnchorRemove]);
63
- return /* @__PURE__ */ jsx(Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
64
- }
65
- );
66
- PopoverAnchor.displayName = ANCHOR_NAME;
67
- var TRIGGER_NAME = "PopoverTrigger";
68
- var PopoverTrigger = React.forwardRef(
69
- (props, forwardedRef) => {
70
- const { __scopePopover, ...triggerProps } = props;
71
- const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
72
- const popperScope = usePopperScope(__scopePopover);
73
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
74
- const trigger = /* @__PURE__ */ jsx(
75
- Primitive.button,
76
- {
77
- type: "button",
78
- "aria-haspopup": "dialog",
79
- "aria-expanded": context.open,
80
- "aria-controls": context.contentId,
81
- "data-state": getState(context.open),
82
- ...triggerProps,
83
- ref: composedTriggerRef,
84
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
85
- }
86
- );
87
- return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(Anchor, { asChild: true, ...popperScope, children: trigger });
88
- }
89
- );
90
- PopoverTrigger.displayName = TRIGGER_NAME;
91
- var PORTAL_NAME = "PopoverPortal";
92
- var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
93
- forceMount: void 0
22
+ );
94
23
  });
95
- var PopoverPortal = (props) => {
96
- const { __scopePopover, forceMount, children, container } = props;
97
- const context = usePopoverContext(PORTAL_NAME, __scopePopover);
98
- return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(Portal$1, { asChild: true, container, children }) }) });
99
- };
100
- PopoverPortal.displayName = PORTAL_NAME;
101
- var CONTENT_NAME = "PopoverContent";
102
- var PopoverContent = React.forwardRef(
103
- (props, forwardedRef) => {
104
- const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
105
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
106
- const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
107
- return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
108
- }
109
- );
110
- PopoverContent.displayName = CONTENT_NAME;
111
- var Slot = createSlot("PopoverContent.RemoveScroll");
112
- var PopoverContentModal = React.forwardRef(
113
- (props, forwardedRef) => {
114
- const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
115
- const contentRef = React.useRef(null);
116
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
117
- const isRightClickOutsideRef = React.useRef(false);
118
- React.useEffect(() => {
119
- const content = contentRef.current;
120
- if (content) return hideOthers(content);
121
- }, []);
122
- return /* @__PURE__ */ jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
123
- PopoverContentImpl,
124
- {
125
- ...props,
126
- ref: composedRefs,
127
- trapFocus: context.open,
128
- disableOutsidePointerEvents: true,
129
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
130
- event.preventDefault();
131
- if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
132
- }),
133
- onPointerDownOutside: composeEventHandlers(
134
- props.onPointerDownOutside,
135
- (event) => {
136
- const originalEvent = event.detail.originalEvent;
137
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
138
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
139
- isRightClickOutsideRef.current = isRightClick;
140
- },
141
- { checkForDefaultPrevented: false }
142
- ),
143
- onFocusOutside: composeEventHandlers(
144
- props.onFocusOutside,
145
- (event) => event.preventDefault(),
146
- { checkForDefaultPrevented: false }
147
- )
148
- }
149
- ) });
150
- }
151
- );
152
- var PopoverContentNonModal = React.forwardRef(
153
- (props, forwardedRef) => {
154
- const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
155
- const hasInteractedOutsideRef = React.useRef(false);
156
- const hasPointerDownOutsideRef = React.useRef(false);
157
- return /* @__PURE__ */ jsx(
158
- PopoverContentImpl,
159
- {
160
- ...props,
161
- ref: forwardedRef,
162
- trapFocus: false,
163
- disableOutsidePointerEvents: false,
164
- onCloseAutoFocus: (event) => {
165
- props.onCloseAutoFocus?.(event);
166
- if (!event.defaultPrevented) {
167
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
168
- event.preventDefault();
169
- }
170
- hasInteractedOutsideRef.current = false;
171
- hasPointerDownOutsideRef.current = false;
172
- },
173
- onInteractOutside: (event) => {
174
- props.onInteractOutside?.(event);
175
- if (!event.defaultPrevented) {
176
- hasInteractedOutsideRef.current = true;
177
- if (event.detail.originalEvent.type === "pointerdown") {
178
- hasPointerDownOutsideRef.current = true;
179
- }
180
- }
181
- const target = event.target;
182
- const targetIsTrigger = context.triggerRef.current?.contains(target);
183
- if (targetIsTrigger) event.preventDefault();
184
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
185
- event.preventDefault();
186
- }
187
- }
188
- }
189
- );
190
- }
191
- );
192
- var PopoverContentImpl = React.forwardRef(
193
- (props, forwardedRef) => {
194
- const {
195
- __scopePopover,
196
- trapFocus,
197
- onOpenAutoFocus,
198
- onCloseAutoFocus,
199
- disableOutsidePointerEvents,
200
- onEscapeKeyDown,
201
- onPointerDownOutside,
202
- onFocusOutside,
203
- onInteractOutside,
204
- ...contentProps
205
- } = props;
206
- const context = usePopoverContext(CONTENT_NAME, __scopePopover);
207
- const popperScope = usePopperScope(__scopePopover);
208
- useFocusGuards();
209
- return /* @__PURE__ */ jsx(
210
- FocusScope,
211
- {
212
- asChild: true,
213
- loop: true,
214
- trapped: trapFocus,
215
- onMountAutoFocus: onOpenAutoFocus,
216
- onUnmountAutoFocus: onCloseAutoFocus,
217
- children: /* @__PURE__ */ jsx(
218
- DismissableLayer,
219
- {
220
- asChild: true,
221
- disableOutsidePointerEvents,
222
- onInteractOutside,
223
- onEscapeKeyDown,
224
- onPointerDownOutside,
225
- onFocusOutside,
226
- onDismiss: () => context.onOpenChange(false),
227
- children: /* @__PURE__ */ jsx(
228
- Content,
229
- {
230
- "data-state": getState(context.open),
231
- role: "dialog",
232
- id: context.contentId,
233
- ...popperScope,
234
- ...contentProps,
235
- ref: forwardedRef,
236
- style: {
237
- ...contentProps.style,
238
- // re-namespace exposed content custom properties
239
- ...{
240
- "--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
241
- "--radix-popover-content-available-width": "var(--radix-popper-available-width)",
242
- "--radix-popover-content-available-height": "var(--radix-popper-available-height)",
243
- "--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
244
- "--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
245
- }
246
- }
247
- }
248
- )
249
- }
250
- )
251
- }
252
- );
253
- }
254
- );
255
- var CLOSE_NAME = "PopoverClose";
256
- var PopoverClose = React.forwardRef(
257
- (props, forwardedRef) => {
258
- const { __scopePopover, ...closeProps } = props;
259
- const context = usePopoverContext(CLOSE_NAME, __scopePopover);
260
- return /* @__PURE__ */ jsx(
261
- Primitive.button,
262
- {
263
- type: "button",
264
- ...closeProps,
265
- ref: forwardedRef,
266
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
267
- }
268
- );
269
- }
270
- );
271
- PopoverClose.displayName = CLOSE_NAME;
272
- var ARROW_NAME = "PopoverArrow";
273
- var PopoverArrow = React.forwardRef(
274
- (props, forwardedRef) => {
275
- const { __scopePopover, ...arrowProps } = props;
276
- const popperScope = usePopperScope(__scopePopover);
277
- return /* @__PURE__ */ jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
278
- }
279
- );
280
- PopoverArrow.displayName = ARROW_NAME;
281
- function getState(open) {
282
- return open ? "open" : "closed";
24
+ Separator.displayName = NAME;
25
+ function isValidOrientation(orientation) {
26
+ return ORIENTATIONS.includes(orientation);
283
27
  }
284
- var Root2 = Popover;
285
- var Trigger = PopoverTrigger;
286
- var Portal = PopoverPortal;
287
- var Content2 = PopoverContent;
28
+ var Root = Separator;
288
29
 
289
- export { Content2 as C, Portal as P, Root2 as R, Trigger as T, PopoverPortal as a };
30
+ export { Root as R };
290
31
  //# sourceMappingURL=index15.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index15.js","sources":["../node_modules/.pnpm/@radix-ui+react-popover@1.1.15_@types+react-dom@19.2.3_@types+react@19.2.14__@types+rea_e0b27b407ae4f4f39109212793ce9f4c/node_modules/@radix-ui/react-popover/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/popover.tsx\nimport * as React from \"react\";\nimport { composeEventHandlers } from \"@radix-ui/primitive\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { DismissableLayer } from \"@radix-ui/react-dismissable-layer\";\nimport { useFocusGuards } from \"@radix-ui/react-focus-guards\";\nimport { FocusScope } from \"@radix-ui/react-focus-scope\";\nimport { useId } from \"@radix-ui/react-id\";\nimport * as PopperPrimitive from \"@radix-ui/react-popper\";\nimport { createPopperScope } from \"@radix-ui/react-popper\";\nimport { Portal as PortalPrimitive } from \"@radix-ui/react-portal\";\nimport { Presence } from \"@radix-ui/react-presence\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { useControllableState } from \"@radix-ui/react-use-controllable-state\";\nimport { hideOthers } from \"aria-hidden\";\nimport { RemoveScroll } from \"react-remove-scroll\";\nimport { jsx } from \"react/jsx-runtime\";\nvar POPOVER_NAME = \"Popover\";\nvar [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [\n createPopperScope\n]);\nvar usePopperScope = createPopperScope();\nvar [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);\nvar Popover = (props) => {\n const {\n __scopePopover,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n modal = false\n } = props;\n const popperScope = usePopperScope(__scopePopover);\n const triggerRef = React.useRef(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen ?? false,\n onChange: onOpenChange,\n caller: POPOVER_NAME\n });\n return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(\n PopoverProvider,\n {\n scope: __scopePopover,\n contentId: useId(),\n triggerRef,\n open,\n onOpenChange: setOpen,\n onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),\n hasCustomAnchor,\n onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),\n onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),\n modal,\n children\n }\n ) });\n};\nPopover.displayName = POPOVER_NAME;\nvar ANCHOR_NAME = \"PopoverAnchor\";\nvar PopoverAnchor = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...anchorProps } = props;\n const context = usePopoverContext(ANCHOR_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const { onCustomAnchorAdd, onCustomAnchorRemove } = context;\n React.useEffect(() => {\n onCustomAnchorAdd();\n return () => onCustomAnchorRemove();\n }, [onCustomAnchorAdd, onCustomAnchorRemove]);\n return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });\n }\n);\nPopoverAnchor.displayName = ANCHOR_NAME;\nvar TRIGGER_NAME = \"PopoverTrigger\";\nvar PopoverTrigger = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...triggerProps } = props;\n const context = usePopoverContext(TRIGGER_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);\n const trigger = /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": context.open,\n \"aria-controls\": context.contentId,\n \"data-state\": getState(context.open),\n ...triggerProps,\n ref: composedTriggerRef,\n onClick: composeEventHandlers(props.onClick, context.onOpenToggle)\n }\n );\n return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: trigger });\n }\n);\nPopoverTrigger.displayName = TRIGGER_NAME;\nvar PORTAL_NAME = \"PopoverPortal\";\nvar [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {\n forceMount: void 0\n});\nvar PopoverPortal = (props) => {\n const { __scopePopover, forceMount, children, container } = props;\n const context = usePopoverContext(PORTAL_NAME, __scopePopover);\n return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) });\n};\nPopoverPortal.displayName = PORTAL_NAME;\nvar CONTENT_NAME = \"PopoverContent\";\nvar PopoverContent = React.forwardRef(\n (props, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });\n }\n);\nPopoverContent.displayName = CONTENT_NAME;\nvar Slot = createSlot(\"PopoverContent.RemoveScroll\");\nvar PopoverContentModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const contentRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, contentRef);\n const isRightClickOutsideRef = React.useRef(false);\n React.useEffect(() => {\n const content = contentRef.current;\n if (content) return hideOthers(content);\n }, []);\n return /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(\n PopoverContentImpl,\n {\n ...props,\n ref: composedRefs,\n trapFocus: context.open,\n disableOutsidePointerEvents: true,\n onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {\n event.preventDefault();\n if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n }),\n onPointerDownOutside: composeEventHandlers(\n props.onPointerDownOutside,\n (event) => {\n const originalEvent = event.detail.originalEvent;\n const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n const isRightClick = originalEvent.button === 2 || ctrlLeftClick;\n isRightClickOutsideRef.current = isRightClick;\n },\n { checkForDefaultPrevented: false }\n ),\n onFocusOutside: composeEventHandlers(\n props.onFocusOutside,\n (event) => event.preventDefault(),\n { checkForDefaultPrevented: false }\n )\n }\n ) });\n }\n);\nvar PopoverContentNonModal = React.forwardRef(\n (props, forwardedRef) => {\n const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);\n const hasInteractedOutsideRef = React.useRef(false);\n const hasPointerDownOutsideRef = React.useRef(false);\n return /* @__PURE__ */ jsx(\n PopoverContentImpl,\n {\n ...props,\n ref: forwardedRef,\n trapFocus: false,\n disableOutsidePointerEvents: false,\n onCloseAutoFocus: (event) => {\n props.onCloseAutoFocus?.(event);\n if (!event.defaultPrevented) {\n if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();\n event.preventDefault();\n }\n hasInteractedOutsideRef.current = false;\n hasPointerDownOutsideRef.current = false;\n },\n onInteractOutside: (event) => {\n props.onInteractOutside?.(event);\n if (!event.defaultPrevented) {\n hasInteractedOutsideRef.current = true;\n if (event.detail.originalEvent.type === \"pointerdown\") {\n hasPointerDownOutsideRef.current = true;\n }\n }\n const target = event.target;\n const targetIsTrigger = context.triggerRef.current?.contains(target);\n if (targetIsTrigger) event.preventDefault();\n if (event.detail.originalEvent.type === \"focusin\" && hasPointerDownOutsideRef.current) {\n event.preventDefault();\n }\n }\n }\n );\n }\n);\nvar PopoverContentImpl = React.forwardRef(\n (props, forwardedRef) => {\n const {\n __scopePopover,\n trapFocus,\n onOpenAutoFocus,\n onCloseAutoFocus,\n disableOutsidePointerEvents,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = usePopoverContext(CONTENT_NAME, __scopePopover);\n const popperScope = usePopperScope(__scopePopover);\n useFocusGuards();\n return /* @__PURE__ */ jsx(\n FocusScope,\n {\n asChild: true,\n loop: true,\n trapped: trapFocus,\n onMountAutoFocus: onOpenAutoFocus,\n onUnmountAutoFocus: onCloseAutoFocus,\n children: /* @__PURE__ */ jsx(\n DismissableLayer,\n {\n asChild: true,\n disableOutsidePointerEvents,\n onInteractOutside,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onDismiss: () => context.onOpenChange(false),\n children: /* @__PURE__ */ jsx(\n PopperPrimitive.Content,\n {\n \"data-state\": getState(context.open),\n role: \"dialog\",\n id: context.contentId,\n ...popperScope,\n ...contentProps,\n ref: forwardedRef,\n style: {\n ...contentProps.style,\n // re-namespace exposed content custom properties\n ...{\n \"--radix-popover-content-transform-origin\": \"var(--radix-popper-transform-origin)\",\n \"--radix-popover-content-available-width\": \"var(--radix-popper-available-width)\",\n \"--radix-popover-content-available-height\": \"var(--radix-popper-available-height)\",\n \"--radix-popover-trigger-width\": \"var(--radix-popper-anchor-width)\",\n \"--radix-popover-trigger-height\": \"var(--radix-popper-anchor-height)\"\n }\n }\n }\n )\n }\n )\n }\n );\n }\n);\nvar CLOSE_NAME = \"PopoverClose\";\nvar PopoverClose = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...closeProps } = props;\n const context = usePopoverContext(CLOSE_NAME, __scopePopover);\n return /* @__PURE__ */ jsx(\n Primitive.button,\n {\n type: \"button\",\n ...closeProps,\n ref: forwardedRef,\n onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))\n }\n );\n }\n);\nPopoverClose.displayName = CLOSE_NAME;\nvar ARROW_NAME = \"PopoverArrow\";\nvar PopoverArrow = React.forwardRef(\n (props, forwardedRef) => {\n const { __scopePopover, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopePopover);\n return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });\n }\n);\nPopoverArrow.displayName = ARROW_NAME;\nfunction getState(open) {\n return open ? \"open\" : \"closed\";\n}\nvar Root2 = Popover;\nvar Anchor2 = PopoverAnchor;\nvar Trigger = PopoverTrigger;\nvar Portal = PopoverPortal;\nvar Content2 = PopoverContent;\nvar Close = PopoverClose;\nvar Arrow2 = PopoverArrow;\nexport {\n Anchor2 as Anchor,\n Arrow2 as Arrow,\n Close,\n Content2 as Content,\n Popover,\n PopoverAnchor,\n PopoverArrow,\n PopoverClose,\n PopoverContent,\n PopoverPortal,\n PopoverTrigger,\n Portal,\n Root2 as Root,\n Trigger,\n createPopoverScope\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["PopperPrimitive.Root","PopperPrimitive.Anchor","PortalPrimitive","RemoveScroll","PopperPrimitive.Content","PopperPrimitive.Arrow"],"mappings":";;;;;;;;;AAqBA,IAAI,YAAY,GAAG,SAAS;AAC5B,IAAI,CAAC,oBAAwC,CAAC,GAAG,kBAAkB,CAAC,YAAY,EAAE;AAClF,EAAE;AACF,CAAC,CAAC;AACF,IAAI,cAAc,GAAG,iBAAiB,EAAE;AACxC,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC,GAAG,oBAAoB,CAAC,YAAY,CAAC;AAC7E,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK;AACzB,EAAE,MAAM;AACR,IAAI,cAAc;AAClB,IAAI,QAAQ;AACZ,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW;AACf,IAAI,YAAY;AAChB,IAAI,KAAK,GAAG;AACZ,GAAG,GAAG,KAAK;AACX,EAAE,MAAM,WAAW,GAAG,cAAc,CAAC,cAAc,CAAC;AACpD,EAAE,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC;AACvC,EAAE,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;AACrE,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,oBAAoB,CAAC;AAC/C,IAAI,IAAI,EAAE,QAAQ;AAClB,IAAI,WAAW,EAAE,WAAW,IAAI,KAAK;AACrC,IAAI,QAAQ,EAAE,YAAY;AAC1B,IAAI,MAAM,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,EAAE,GAAG,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,CAAC;AAC3G,EAAE;AACF,CAAC;AACD,YAAY,CAAC,WAAW,GAAG,UAAU;AACrC,SAAS,QAAQ,CAAC,IAAI,EAAE;AACxB,EAAE,OAAO,IAAI,GAAG,MAAM,GAAG,QAAQ;AACjC;AACG,IAAC,KAAK,GAAG;AAET,IAAC,OAAO,GAAG;AACX,IAAC,MAAM,GAAG;AACV,IAAC,QAAQ,GAAG;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index15.js","sources":["../node_modules/.pnpm/@radix-ui+react-separator@1.1.8_@types+react-dom@19.2.3_@types+react@19.2.14__@types+re_0b44e305f405e6da2b3118d3445bd4c2/node_modules/@radix-ui/react-separator/dist/index.mjs"],"sourcesContent":["// src/separator.tsx\nimport * as React from \"react\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { jsx } from \"react/jsx-runtime\";\nvar NAME = \"Separator\";\nvar DEFAULT_ORIENTATION = \"horizontal\";\nvar ORIENTATIONS = [\"horizontal\", \"vertical\"];\nvar Separator = React.forwardRef((props, forwardedRef) => {\n const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;\n const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;\n const ariaOrientation = orientation === \"vertical\" ? orientation : void 0;\n const semanticProps = decorative ? { role: \"none\" } : { \"aria-orientation\": ariaOrientation, role: \"separator\" };\n return /* @__PURE__ */ jsx(\n Primitive.div,\n {\n \"data-orientation\": orientation,\n ...semanticProps,\n ...domProps,\n ref: forwardedRef\n }\n );\n});\nSeparator.displayName = NAME;\nfunction isValidOrientation(orientation) {\n return ORIENTATIONS.includes(orientation);\n}\nvar Root = Separator;\nexport {\n Root,\n Separator\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;AAAA;AAIA,IAAI,IAAI,GAAG,WAAW;AACtB,IAAI,mBAAmB,GAAG,YAAY;AACtC,IAAI,YAAY,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC;AAC7C,IAAI,SAAS,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,YAAY,KAAK;AAC1D,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,GAAG,mBAAmB,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK;AAC/F,EAAE,MAAM,WAAW,GAAG,kBAAkB,CAAC,eAAe,CAAC,GAAG,eAAe,GAAG,mBAAmB;AACjG,EAAE,MAAM,eAAe,GAAG,WAAW,KAAK,UAAU,GAAG,WAAW,GAAG,MAAM;AAC3E,EAAE,MAAM,aAAa,GAAG,UAAU,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,kBAAkB,EAAE,eAAe,EAAE,IAAI,EAAE,WAAW,EAAE;AAClH,EAAE,uBAAuB,GAAG;AAC5B,IAAI,SAAS,CAAC,GAAG;AACjB,IAAI;AACJ,MAAM,kBAAkB,EAAE,WAAW;AACrC,MAAM,GAAG,aAAa;AACtB,MAAM,GAAG,QAAQ;AACjB,MAAM,GAAG,EAAE;AACX;AACA,GAAG;AACH,CAAC,CAAC;AACF,SAAS,CAAC,WAAW,GAAG,IAAI;AAC5B,SAAS,kBAAkB,CAAC,WAAW,EAAE;AACzC,EAAE,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC;AAC3C;AACG,IAAC,IAAI,GAAG;;;;","x_google_ignoreList":[0]}
package/dist/index16.js CHANGED
@@ -4,9 +4,9 @@ import { u as useControllableState, P as Primitive, c as composeEventHandlers, a
4
4
  import { u as useDirection, c as createCollection } from './index23.js';
5
5
  import { u as useComposedRefs } from './index12.js';
6
6
  import { u as useId, c as createContextScope } from './index21.js';
7
- import { P as Portal$1, D as DismissableLayer } from './index27.js';
8
- import { h as hideOthers, u as useFocusGuards, R as ReactRemoveScroll, F as FocusScope } from './index28.js';
9
- import { R as Root2$1, A as Anchor, c as createPopperScope, C as Content, a as Arrow } from './index29.js';
7
+ import { P as Portal$1, D as DismissableLayer } from './index26.js';
8
+ import { h as hideOthers, u as useFocusGuards, R as ReactRemoveScroll, F as FocusScope } from './index27.js';
9
+ import { R as Root2$1, A as Anchor, c as createPopperScope, C as Content, a as Arrow } from './index28.js';
10
10
  import { u as useCallbackRef } from './index31.js';
11
11
  import { u as useLayoutEffect2 } from './index25.js';
12
12
  import { u as usePrevious } from './index34.js';
package/dist/index17.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { P as Primitive } from './index26.js';
2
+ import { P as Primitive } from './index29.js';
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
 
5
5
  var NAME = "Label";
package/dist/index26.js CHANGED
@@ -1,41 +1,236 @@
1
1
  import * as React from 'react';
2
- import 'react-dom';
3
- import { c as createSlot } from './index10.js';
2
+ import { P as Primitive, c as composeEventHandlers, d as dispatchDiscreteCustomEvent } from './index20.js';
3
+ import { u as useComposedRefs } from './index12.js';
4
+ import { u as useCallbackRef } from './index31.js';
4
5
  import { jsx } from 'react/jsx-runtime';
6
+ import ReactDOM__default from 'react-dom';
7
+ import { u as useLayoutEffect2 } from './index25.js';
5
8
 
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;
9
+ // packages/react/use-escape-keydown/src/use-escape-keydown.tsx
10
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
11
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
12
+ React.useEffect(() => {
13
+ const handleKeyDown = (event) => {
14
+ if (event.key === "Escape") {
15
+ onEscapeKeyDown(event);
16
+ }
17
+ };
18
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
19
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
20
+ }, [onEscapeKeyDown, ownerDocument]);
21
+ }
22
+
23
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
24
+ var CONTEXT_UPDATE = "dismissableLayer.update";
25
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
26
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
27
+ var originalBodyPointerEvents;
28
+ var DismissableLayerContext = React.createContext({
29
+ layers: /* @__PURE__ */ new Set(),
30
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
31
+ branches: /* @__PURE__ */ new Set()
32
+ });
33
+ var DismissableLayer = React.forwardRef(
34
+ (props, forwardedRef) => {
35
+ const {
36
+ disableOutsidePointerEvents = false,
37
+ onEscapeKeyDown,
38
+ onPointerDownOutside,
39
+ onFocusOutside,
40
+ onInteractOutside,
41
+ onDismiss,
42
+ ...layerProps
43
+ } = props;
44
+ const context = React.useContext(DismissableLayerContext);
45
+ const [node, setNode] = React.useState(null);
46
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
47
+ const [, force] = React.useState({});
48
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
49
+ const layers = Array.from(context.layers);
50
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
51
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
52
+ const index = node ? layers.indexOf(node) : -1;
53
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
54
+ const isPointerEventsEnabled = index >= highestLayerWithOutsidePointerEventsDisabledIndex;
55
+ const pointerDownOutside = usePointerDownOutside((event) => {
56
+ const target = event.target;
57
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
58
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
59
+ onPointerDownOutside?.(event);
60
+ onInteractOutside?.(event);
61
+ if (!event.defaultPrevented) onDismiss?.();
62
+ }, ownerDocument);
63
+ const focusOutside = useFocusOutside((event) => {
64
+ const target = event.target;
65
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
66
+ if (isFocusInBranch) return;
67
+ onFocusOutside?.(event);
68
+ onInteractOutside?.(event);
69
+ if (!event.defaultPrevented) onDismiss?.();
70
+ }, ownerDocument);
71
+ useEscapeKeydown((event) => {
72
+ const isHighestLayer = index === context.layers.size - 1;
73
+ if (!isHighestLayer) return;
74
+ onEscapeKeyDown?.(event);
75
+ if (!event.defaultPrevented && onDismiss) {
76
+ event.preventDefault();
77
+ onDismiss();
78
+ }
79
+ }, ownerDocument);
80
+ React.useEffect(() => {
81
+ if (!node) return;
82
+ if (disableOutsidePointerEvents) {
83
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
84
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
85
+ ownerDocument.body.style.pointerEvents = "none";
86
+ }
87
+ context.layersWithOutsidePointerEventsDisabled.add(node);
88
+ }
89
+ context.layers.add(node);
90
+ dispatchUpdate();
91
+ return () => {
92
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
93
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
94
+ }
95
+ };
96
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
97
+ React.useEffect(() => {
98
+ return () => {
99
+ if (!node) return;
100
+ context.layers.delete(node);
101
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
102
+ dispatchUpdate();
103
+ };
104
+ }, [node, context]);
105
+ React.useEffect(() => {
106
+ const handleUpdate = () => force({});
107
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
108
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
109
+ }, []);
110
+ return /* @__PURE__ */ jsx(
111
+ Primitive.div,
112
+ {
113
+ ...layerProps,
114
+ ref: composedRefs,
115
+ style: {
116
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
117
+ ...props.style
118
+ },
119
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
120
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
121
+ onPointerDownCapture: composeEventHandlers(
122
+ props.onPointerDownCapture,
123
+ pointerDownOutside.onPointerDownCapture
124
+ )
125
+ }
126
+ );
127
+ }
128
+ );
129
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
130
+ var BRANCH_NAME = "DismissableLayerBranch";
131
+ var DismissableLayerBranch = React.forwardRef((props, forwardedRef) => {
132
+ const context = React.useContext(DismissableLayerContext);
133
+ const ref = React.useRef(null);
134
+ const composedRefs = useComposedRefs(forwardedRef, ref);
135
+ React.useEffect(() => {
136
+ const node = ref.current;
137
+ if (node) {
138
+ context.branches.add(node);
139
+ return () => {
140
+ context.branches.delete(node);
141
+ };
33
142
  }
34
- return /* @__PURE__ */ jsx(Comp, { ...primitiveProps, ref: forwardedRef });
143
+ }, [context.branches]);
144
+ return /* @__PURE__ */ jsx(Primitive.div, { ...props, ref: composedRefs });
145
+ });
146
+ DismissableLayerBranch.displayName = BRANCH_NAME;
147
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
148
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
149
+ const isPointerInsideReactTreeRef = React.useRef(false);
150
+ const handleClickRef = React.useRef(() => {
35
151
  });
36
- Node.displayName = `Primitive.${node}`;
37
- return { ...primitive, [node]: Node };
38
- }, {});
152
+ React.useEffect(() => {
153
+ const handlePointerDown = (event) => {
154
+ if (event.target && !isPointerInsideReactTreeRef.current) {
155
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
156
+ handleAndDispatchCustomEvent(
157
+ POINTER_DOWN_OUTSIDE,
158
+ handlePointerDownOutside,
159
+ eventDetail,
160
+ { discrete: true }
161
+ );
162
+ };
163
+ const eventDetail = { originalEvent: event };
164
+ if (event.pointerType === "touch") {
165
+ ownerDocument.removeEventListener("click", handleClickRef.current);
166
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
167
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
168
+ } else {
169
+ handleAndDispatchPointerDownOutsideEvent2();
170
+ }
171
+ } else {
172
+ ownerDocument.removeEventListener("click", handleClickRef.current);
173
+ }
174
+ isPointerInsideReactTreeRef.current = false;
175
+ };
176
+ const timerId = window.setTimeout(() => {
177
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
178
+ }, 0);
179
+ return () => {
180
+ window.clearTimeout(timerId);
181
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
182
+ ownerDocument.removeEventListener("click", handleClickRef.current);
183
+ };
184
+ }, [ownerDocument, handlePointerDownOutside]);
185
+ return {
186
+ // ensures we check React component tree (not just DOM tree)
187
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
188
+ };
189
+ }
190
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
191
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
192
+ const isFocusInsideReactTreeRef = React.useRef(false);
193
+ React.useEffect(() => {
194
+ const handleFocus = (event) => {
195
+ if (event.target && !isFocusInsideReactTreeRef.current) {
196
+ const eventDetail = { originalEvent: event };
197
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
198
+ discrete: false
199
+ });
200
+ }
201
+ };
202
+ ownerDocument.addEventListener("focusin", handleFocus);
203
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
204
+ }, [ownerDocument, handleFocusOutside]);
205
+ return {
206
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
207
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
208
+ };
209
+ }
210
+ function dispatchUpdate() {
211
+ const event = new CustomEvent(CONTEXT_UPDATE);
212
+ document.dispatchEvent(event);
213
+ }
214
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
215
+ const target = detail.originalEvent.target;
216
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
217
+ if (handler) target.addEventListener(name, handler, { once: true });
218
+ if (discrete) {
219
+ dispatchDiscreteCustomEvent(target, event);
220
+ } else {
221
+ target.dispatchEvent(event);
222
+ }
223
+ }
224
+
225
+ var PORTAL_NAME = "Portal";
226
+ var Portal = React.forwardRef((props, forwardedRef) => {
227
+ const { container: containerProp, ...portalProps } = props;
228
+ const [mounted, setMounted] = React.useState(false);
229
+ useLayoutEffect2(() => setMounted(true), []);
230
+ const container = containerProp || mounted && globalThis?.document?.body;
231
+ return container ? ReactDOM__default.createPortal(/* @__PURE__ */ jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
232
+ });
233
+ Portal.displayName = PORTAL_NAME;
39
234
 
40
- export { Primitive as P };
235
+ export { DismissableLayer as D, Portal as P };
41
236
  //# sourceMappingURL=index26.js.map