@stevederico/skateboard-ui 3.0.2 → 3.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 (175) hide show
  1. package/App.jsx +13 -13
  2. package/CHANGELOG.md +64 -0
  3. package/README.md +59 -65
  4. package/components/AuthOverlay.jsx +4 -4
  5. package/components/ProtectedRoute.jsx +1 -1
  6. package/components/ThemeToggle.jsx +1 -1
  7. package/components/UpgradeSheet.jsx +2 -2
  8. package/{core → components/core}/DynamicIcon.jsx +1 -1
  9. package/{layout → components/layout}/Header.jsx +4 -4
  10. package/{layout → components/layout}/Layout.jsx +1 -1
  11. package/{layout → components/layout}/Sidebar.jsx +2 -2
  12. package/{layout → components/layout}/TabBar.jsx +1 -1
  13. package/{views → components/views}/LandingView.jsx +5 -5
  14. package/{views → components/views}/NotFound.jsx +2 -2
  15. package/{views → components/views}/PaymentView.jsx +1 -1
  16. package/{views → components/views}/SettingsView.jsx +6 -6
  17. package/{views → components/views}/SignInView.jsx +6 -6
  18. package/{views → components/views}/SignOutView.jsx +1 -1
  19. package/{views → components/views}/SignUpView.jsx +6 -6
  20. package/{views → components/views}/TextView.jsx +3 -3
  21. package/hooks/useAuthGate.js +1 -1
  22. package/index.js +1 -1
  23. package/package.json +32 -50
  24. package/shadcn/lib/base-ui/LICENSE +21 -0
  25. package/shadcn/lib/base-ui/_chunk-01rqe37g.js +70 -0
  26. package/shadcn/lib/base-ui/_chunk-0h5sskyw.js +347 -0
  27. package/shadcn/lib/base-ui/_chunk-0xhx4g7r.js +57 -0
  28. package/shadcn/lib/base-ui/_chunk-1e6khrvm.js +218 -0
  29. package/shadcn/lib/base-ui/_chunk-1s41sngz.js +302 -0
  30. package/shadcn/lib/base-ui/_chunk-20rtfsz9.js +23 -0
  31. package/shadcn/lib/base-ui/_chunk-2tyt8f8r.js +6034 -0
  32. package/shadcn/lib/base-ui/_chunk-3f31ka8n.js +11 -0
  33. package/shadcn/lib/base-ui/_chunk-3h6zpchb.js +89 -0
  34. package/shadcn/lib/base-ui/_chunk-4s0k3h7t.js +114 -0
  35. package/shadcn/lib/base-ui/_chunk-502wngfc.js +598 -0
  36. package/shadcn/lib/base-ui/_chunk-536jvgeq.js +68 -0
  37. package/shadcn/lib/base-ui/_chunk-611pz5sm.js +10 -0
  38. package/shadcn/lib/base-ui/_chunk-65zw5gs2.js +15 -0
  39. package/shadcn/lib/base-ui/_chunk-6b17g8t7.js +34 -0
  40. package/shadcn/lib/base-ui/_chunk-6xevjepc.js +15 -0
  41. package/shadcn/lib/base-ui/_chunk-71zm6zgv.js +16 -0
  42. package/shadcn/lib/base-ui/_chunk-7fmjymvh.js +32 -0
  43. package/shadcn/lib/base-ui/_chunk-7jjzay8b.js +176 -0
  44. package/shadcn/lib/base-ui/_chunk-7v1t86x1.js +43 -0
  45. package/shadcn/lib/base-ui/_chunk-85vrgzwr.js +227 -0
  46. package/shadcn/lib/base-ui/_chunk-8jz3hb7q.js +9 -0
  47. package/shadcn/lib/base-ui/_chunk-8kh3xk78.js +35 -0
  48. package/shadcn/lib/base-ui/_chunk-97tas84n.js +67 -0
  49. package/shadcn/lib/base-ui/_chunk-9nyxkvte.js +13 -0
  50. package/shadcn/lib/base-ui/_chunk-a8fwg9d0.js +52 -0
  51. package/shadcn/lib/base-ui/_chunk-agc6ew3g.js +29 -0
  52. package/shadcn/lib/base-ui/_chunk-aqwsk46c.js +64 -0
  53. package/shadcn/lib/base-ui/_chunk-atd5kq5q.js +803 -0
  54. package/shadcn/lib/base-ui/_chunk-atnkefgd.js +104 -0
  55. package/shadcn/lib/base-ui/_chunk-b40erthe.js +7 -0
  56. package/shadcn/lib/base-ui/_chunk-b5jsqt97.js +50 -0
  57. package/shadcn/lib/base-ui/_chunk-bk7n9s9e.js +15 -0
  58. package/shadcn/lib/base-ui/_chunk-c3572b5x.js +19 -0
  59. package/shadcn/lib/base-ui/_chunk-cwr896nf.js +25 -0
  60. package/shadcn/lib/base-ui/_chunk-drfb9kp2.js +27 -0
  61. package/shadcn/lib/base-ui/_chunk-ds8fnpjj.js +0 -0
  62. package/shadcn/lib/base-ui/_chunk-ek863ta9.js +82 -0
  63. package/shadcn/lib/base-ui/_chunk-f09cp81f.js +12 -0
  64. package/shadcn/lib/base-ui/_chunk-f5d01bp9.js +0 -0
  65. package/shadcn/lib/base-ui/_chunk-f9tgee1q.js +21 -0
  66. package/shadcn/lib/base-ui/_chunk-fch5cba8.js +84 -0
  67. package/shadcn/lib/base-ui/_chunk-gfce3j3z.js +18 -0
  68. package/shadcn/lib/base-ui/_chunk-ha06w2pp.js +2391 -0
  69. package/shadcn/lib/base-ui/_chunk-hzgetm70.js +23 -0
  70. package/shadcn/lib/base-ui/_chunk-j0eqdjta.js +39 -0
  71. package/shadcn/lib/base-ui/_chunk-k1e5fvcj.js +48 -0
  72. package/shadcn/lib/base-ui/_chunk-k4mc2kan.js +81 -0
  73. package/shadcn/lib/base-ui/_chunk-kfz96xv1.js +128 -0
  74. package/shadcn/lib/base-ui/_chunk-m45547cc.js +15 -0
  75. package/shadcn/lib/base-ui/_chunk-mbn76q14.js +184 -0
  76. package/shadcn/lib/base-ui/_chunk-mvv30fkv.js +9 -0
  77. package/shadcn/lib/base-ui/_chunk-mznt6ktj.js +33 -0
  78. package/shadcn/lib/base-ui/_chunk-n7dnqnbw.js +7 -0
  79. package/shadcn/lib/base-ui/_chunk-nya71ccw.js +546 -0
  80. package/shadcn/lib/base-ui/_chunk-p6qynd6r.js +146 -0
  81. package/shadcn/lib/base-ui/_chunk-q3nee19r.js +323 -0
  82. package/shadcn/lib/base-ui/_chunk-q7yw9mz4.js +385 -0
  83. package/shadcn/lib/base-ui/_chunk-qce0xt57.js +107 -0
  84. package/shadcn/lib/base-ui/_chunk-qgzhcjsj.js +14 -0
  85. package/shadcn/lib/base-ui/_chunk-qt6r015s.js +38 -0
  86. package/shadcn/lib/base-ui/_chunk-r0vsdknk.js +4 -0
  87. package/shadcn/lib/base-ui/_chunk-sx6vkz01.js +150 -0
  88. package/shadcn/lib/base-ui/_chunk-szcr6mhk.js +6 -0
  89. package/shadcn/lib/base-ui/_chunk-t7j3rbpv.js +67 -0
  90. package/shadcn/lib/base-ui/_chunk-tmfmrzwe.js +39 -0
  91. package/shadcn/lib/base-ui/_chunk-v92ycsfj.js +9 -0
  92. package/shadcn/lib/base-ui/_chunk-vdc01ss3.js +6 -0
  93. package/shadcn/lib/base-ui/_chunk-vjbnhhg1.js +26 -0
  94. package/shadcn/lib/base-ui/_chunk-w68yxg9d.js +21 -0
  95. package/shadcn/lib/base-ui/_chunk-wana68v3.js +477 -0
  96. package/shadcn/lib/base-ui/_chunk-wtw745qd.js +12 -0
  97. package/shadcn/lib/base-ui/_chunk-xb7ph1ka.js +6 -0
  98. package/shadcn/lib/base-ui/_chunk-xfagb0fq.js +28 -0
  99. package/shadcn/lib/base-ui/_chunk-xxhqanfd.js +16 -0
  100. package/shadcn/lib/base-ui/_chunk-y887e46p.js +15 -0
  101. package/shadcn/lib/base-ui/_chunk-ymj1dpqg.js +14 -0
  102. package/shadcn/lib/base-ui/accordion.js +650 -0
  103. package/shadcn/lib/base-ui/alert-dialog.js +138 -0
  104. package/shadcn/lib/base-ui/avatar.js +235 -0
  105. package/shadcn/lib/base-ui/button.js +52 -0
  106. package/shadcn/lib/base-ui/checkbox.js +454 -0
  107. package/shadcn/lib/base-ui/collapsible.js +283 -0
  108. package/shadcn/lib/base-ui/context-menu.js +324 -0
  109. package/shadcn/lib/base-ui/dialog.js +71 -0
  110. package/shadcn/lib/base-ui/input.js +1028 -0
  111. package/shadcn/lib/base-ui/menu.js +61 -0
  112. package/shadcn/lib/base-ui/menubar.js +157 -0
  113. package/shadcn/lib/base-ui/merge-props.js +15 -0
  114. package/shadcn/lib/base-ui/navigation-menu.js +1854 -0
  115. package/shadcn/lib/base-ui/popover.js +1090 -0
  116. package/shadcn/lib/base-ui/preview-card.js +709 -0
  117. package/shadcn/lib/base-ui/progress.js +278 -0
  118. package/shadcn/lib/base-ui/radio-group.js +247 -0
  119. package/shadcn/lib/base-ui/radio.js +382 -0
  120. package/shadcn/lib/base-ui/scroll-area.js +1061 -0
  121. package/shadcn/lib/base-ui/select.js +2438 -0
  122. package/shadcn/lib/base-ui/separator.js +11 -0
  123. package/shadcn/lib/base-ui/slider.js +1595 -0
  124. package/shadcn/lib/base-ui/switch.js +333 -0
  125. package/shadcn/lib/base-ui/tabs.js +892 -0
  126. package/shadcn/lib/base-ui/toggle-group.js +152 -0
  127. package/shadcn/lib/base-ui/toggle.js +133 -0
  128. package/shadcn/lib/base-ui/tooltip.js +791 -0
  129. package/shadcn/lib/base-ui/use-render.js +15 -0
  130. package/shadcn/lib/tailwind-merge.js +3312 -0
  131. package/shadcn/lib/utils.js +1 -1
  132. package/shadcn/ui/accordion.jsx +1 -1
  133. package/shadcn/ui/alert-dialog.jsx +1 -1
  134. package/shadcn/ui/avatar.jsx +1 -1
  135. package/shadcn/ui/badge.jsx +2 -2
  136. package/shadcn/ui/breadcrumb.jsx +2 -2
  137. package/shadcn/ui/button-group.jsx +2 -2
  138. package/shadcn/ui/button.jsx +1 -1
  139. package/shadcn/ui/calendar.jsx +1 -1
  140. package/shadcn/ui/checkbox.jsx +1 -1
  141. package/shadcn/ui/collapsible.jsx +1 -1
  142. package/shadcn/ui/command.jsx +1 -1
  143. package/shadcn/ui/context-menu.jsx +1 -1
  144. package/shadcn/ui/dialog.jsx +1 -1
  145. package/shadcn/ui/drawer.jsx +176 -74
  146. package/shadcn/ui/dropdown-menu.jsx +1 -1
  147. package/shadcn/ui/hover-card.jsx +1 -1
  148. package/shadcn/ui/input.jsx +1 -1
  149. package/shadcn/ui/item.jsx +2 -2
  150. package/shadcn/ui/menubar.jsx +2 -2
  151. package/shadcn/ui/navigation-menu.jsx +1 -1
  152. package/shadcn/ui/popover.jsx +1 -1
  153. package/shadcn/ui/progress.jsx +1 -1
  154. package/shadcn/ui/radio-group.jsx +2 -2
  155. package/shadcn/ui/scroll-area.jsx +1 -1
  156. package/shadcn/ui/select.jsx +1 -1
  157. package/shadcn/ui/separator.jsx +1 -1
  158. package/shadcn/ui/sheet.jsx +1 -1
  159. package/shadcn/ui/sidebar.jsx +3 -3
  160. package/shadcn/ui/slider.jsx +1 -1
  161. package/shadcn/ui/switch.jsx +1 -1
  162. package/shadcn/ui/tabs.jsx +1 -1
  163. package/shadcn/ui/toggle-group.jsx +2 -2
  164. package/shadcn/ui/toggle.jsx +1 -1
  165. package/shadcn/ui/tooltip.jsx +1 -1
  166. package/styles.css +31 -0
  167. package/MIGRATION.md +0 -230
  168. package/shadcn/ui/carousel.jsx +0 -195
  169. package/shadcn/ui/chart.jsx +0 -312
  170. package/shadcn/ui/resizable.jsx +0 -47
  171. /package/{core → components/core}/Calendar.jsx +0 -0
  172. /package/{core → components/core}/Command.jsx +0 -0
  173. /package/{core → components/core}/Context.jsx +0 -0
  174. /package/{core → components/core}/ThemeProvider.jsx +0 -0
  175. /package/{core → components/core}/Utilities.js +0 -0
@@ -0,0 +1,546 @@
1
+ import {
2
+ ARROW_DOWN,
3
+ ARROW_LEFT,
4
+ ARROW_RIGHT,
5
+ ARROW_UP,
6
+ isAndroid,
7
+ isJSDOM
8
+ } from "./_chunk-t7j3rbpv.js";
9
+ import {
10
+ getComputedStyle
11
+ } from "./_chunk-sx6vkz01.js";
12
+
13
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js
14
+ function stopEvent(event) {
15
+ event.preventDefault();
16
+ event.stopPropagation();
17
+ }
18
+ function isReactEvent(event) {
19
+ return "nativeEvent" in event;
20
+ }
21
+ function isVirtualClick(event) {
22
+ if (event.pointerType === "" && event.isTrusted) {
23
+ return true;
24
+ }
25
+ if (isAndroid && event.pointerType) {
26
+ return event.type === "click" && event.buttons === 1;
27
+ }
28
+ return event.detail === 0 && !event.pointerType;
29
+ }
30
+ function isVirtualPointerEvent(event) {
31
+ if (isJSDOM) {
32
+ return false;
33
+ }
34
+ return !isAndroid && event.width === 0 && event.height === 0 || isAndroid && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch";
35
+ }
36
+ function isMouseLikePointerType(pointerType, strict) {
37
+ const values = ["mouse", "pen"];
38
+ if (!strict) {
39
+ values.push("", undefined);
40
+ }
41
+ return values.includes(pointerType);
42
+ }
43
+ function isClickLikeEvent(event) {
44
+ const type = event.type;
45
+ return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup";
46
+ }
47
+
48
+ // node_modules/.deno/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
49
+ var sides = ["top", "right", "bottom", "left"];
50
+ var min = Math.min;
51
+ var max = Math.max;
52
+ var round = Math.round;
53
+ var floor = Math.floor;
54
+ var createCoords = (v) => ({
55
+ x: v,
56
+ y: v
57
+ });
58
+ var oppositeSideMap = {
59
+ left: "right",
60
+ right: "left",
61
+ bottom: "top",
62
+ top: "bottom"
63
+ };
64
+ function clamp(start, value, end) {
65
+ return max(start, min(value, end));
66
+ }
67
+ function evaluate(value, param) {
68
+ return typeof value === "function" ? value(param) : value;
69
+ }
70
+ function getSide(placement) {
71
+ return placement.split("-")[0];
72
+ }
73
+ function getAlignment(placement) {
74
+ return placement.split("-")[1];
75
+ }
76
+ function getOppositeAxis(axis) {
77
+ return axis === "x" ? "y" : "x";
78
+ }
79
+ function getAxisLength(axis) {
80
+ return axis === "y" ? "height" : "width";
81
+ }
82
+ function getSideAxis(placement) {
83
+ const firstChar = placement[0];
84
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
85
+ }
86
+ function getAlignmentAxis(placement) {
87
+ return getOppositeAxis(getSideAxis(placement));
88
+ }
89
+ function getAlignmentSides(placement, rects, rtl) {
90
+ if (rtl === undefined) {
91
+ rtl = false;
92
+ }
93
+ const alignment = getAlignment(placement);
94
+ const alignmentAxis = getAlignmentAxis(placement);
95
+ const length = getAxisLength(alignmentAxis);
96
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
97
+ if (rects.reference[length] > rects.floating[length]) {
98
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
99
+ }
100
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
101
+ }
102
+ function getExpandedPlacements(placement) {
103
+ const oppositePlacement = getOppositePlacement(placement);
104
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
105
+ }
106
+ function getOppositeAlignmentPlacement(placement) {
107
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
108
+ }
109
+ var lrPlacement = ["left", "right"];
110
+ var rlPlacement = ["right", "left"];
111
+ var tbPlacement = ["top", "bottom"];
112
+ var btPlacement = ["bottom", "top"];
113
+ function getSideList(side, isStart, rtl) {
114
+ switch (side) {
115
+ case "top":
116
+ case "bottom":
117
+ if (rtl)
118
+ return isStart ? rlPlacement : lrPlacement;
119
+ return isStart ? lrPlacement : rlPlacement;
120
+ case "left":
121
+ case "right":
122
+ return isStart ? tbPlacement : btPlacement;
123
+ default:
124
+ return [];
125
+ }
126
+ }
127
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
128
+ const alignment = getAlignment(placement);
129
+ let list = getSideList(getSide(placement), direction === "start", rtl);
130
+ if (alignment) {
131
+ list = list.map((side) => side + "-" + alignment);
132
+ if (flipAlignment) {
133
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
134
+ }
135
+ }
136
+ return list;
137
+ }
138
+ function getOppositePlacement(placement) {
139
+ const side = getSide(placement);
140
+ return oppositeSideMap[side] + placement.slice(side.length);
141
+ }
142
+ function expandPaddingObject(padding) {
143
+ return {
144
+ top: 0,
145
+ right: 0,
146
+ bottom: 0,
147
+ left: 0,
148
+ ...padding
149
+ };
150
+ }
151
+ function getPaddingObject(padding) {
152
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
153
+ top: padding,
154
+ right: padding,
155
+ bottom: padding,
156
+ left: padding
157
+ };
158
+ }
159
+ function rectToClientRect(rect) {
160
+ const {
161
+ x,
162
+ y,
163
+ width,
164
+ height
165
+ } = rect;
166
+ return {
167
+ width,
168
+ height,
169
+ top: y,
170
+ left: x,
171
+ right: x + width,
172
+ bottom: y + height,
173
+ x,
174
+ y
175
+ };
176
+ }
177
+
178
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js
179
+ function isDifferentGridRow(index, cols, prevRow) {
180
+ return Math.floor(index / cols) !== prevRow;
181
+ }
182
+ function isIndexOutOfListBounds(list, index) {
183
+ return index < 0 || index >= list.length;
184
+ }
185
+ function getMinListIndex(listRef, disabledIndices) {
186
+ return findNonDisabledListIndex(listRef.current, {
187
+ disabledIndices
188
+ });
189
+ }
190
+ function getMaxListIndex(listRef, disabledIndices) {
191
+ return findNonDisabledListIndex(listRef.current, {
192
+ decrement: true,
193
+ startingIndex: listRef.current.length,
194
+ disabledIndices
195
+ });
196
+ }
197
+ function findNonDisabledListIndex(list, {
198
+ startingIndex = -1,
199
+ decrement = false,
200
+ disabledIndices,
201
+ amount = 1
202
+ } = {}) {
203
+ let index = startingIndex;
204
+ do {
205
+ index += decrement ? -amount : amount;
206
+ } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));
207
+ return index;
208
+ }
209
+ function getGridNavigatedIndex(list, {
210
+ event,
211
+ orientation,
212
+ loopFocus,
213
+ onLoop,
214
+ rtl,
215
+ cols,
216
+ disabledIndices,
217
+ minIndex,
218
+ maxIndex,
219
+ prevIndex,
220
+ stopEvent: stop = false
221
+ }) {
222
+ let nextIndex = prevIndex;
223
+ let verticalDirection;
224
+ if (event.key === ARROW_UP) {
225
+ verticalDirection = "up";
226
+ } else if (event.key === ARROW_DOWN) {
227
+ verticalDirection = "down";
228
+ }
229
+ if (verticalDirection) {
230
+ const rows = [];
231
+ const rowIndexMap = [];
232
+ let hasRoleRow = false;
233
+ let visibleItemCount = 0;
234
+ {
235
+ let currentRowEl = null;
236
+ let currentRowIndex = -1;
237
+ list.forEach((el, idx) => {
238
+ if (el == null) {
239
+ return;
240
+ }
241
+ visibleItemCount += 1;
242
+ const rowEl = el.closest('[role="row"]');
243
+ if (rowEl) {
244
+ hasRoleRow = true;
245
+ }
246
+ if (rowEl !== currentRowEl || currentRowIndex === -1) {
247
+ currentRowEl = rowEl;
248
+ currentRowIndex += 1;
249
+ rows[currentRowIndex] = [];
250
+ }
251
+ rows[currentRowIndex].push(idx);
252
+ rowIndexMap[idx] = currentRowIndex;
253
+ });
254
+ }
255
+ let hasDomRows = false;
256
+ let inferredDomCols = 0;
257
+ if (hasRoleRow) {
258
+ for (const row of rows) {
259
+ const rowLength = row.length;
260
+ if (rowLength > inferredDomCols) {
261
+ inferredDomCols = rowLength;
262
+ }
263
+ if (rowLength !== cols) {
264
+ hasDomRows = true;
265
+ }
266
+ }
267
+ }
268
+ const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;
269
+ const verticalCols = inferredDomCols || cols;
270
+ const navigateVertically = (direction) => {
271
+ if (!hasDomRows || prevIndex === -1) {
272
+ return;
273
+ }
274
+ const currentRow = rowIndexMap[prevIndex];
275
+ if (currentRow == null) {
276
+ return;
277
+ }
278
+ const colInRow = rows[currentRow].indexOf(prevIndex);
279
+ const step = direction === "up" ? -1 : 1;
280
+ for (let nextRow = currentRow + step, i = 0;i < rows.length; i += 1, nextRow += step) {
281
+ if (nextRow < 0 || nextRow >= rows.length) {
282
+ if (!loopFocus || hasVirtualizedGaps) {
283
+ return;
284
+ }
285
+ nextRow = nextRow < 0 ? rows.length - 1 : 0;
286
+ if (onLoop) {
287
+ const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);
288
+ const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];
289
+ const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);
290
+ nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;
291
+ }
292
+ }
293
+ const targetRow = rows[nextRow];
294
+ for (let col = Math.min(colInRow, targetRow.length - 1);col >= 0; col -= 1) {
295
+ const candidate = targetRow[col];
296
+ if (!isListIndexDisabled(list, candidate, disabledIndices)) {
297
+ return candidate;
298
+ }
299
+ }
300
+ }
301
+ return;
302
+ };
303
+ const navigateVerticallyWithInferredRows = (direction) => {
304
+ if (!hasVirtualizedGaps || prevIndex === -1) {
305
+ return;
306
+ }
307
+ const colInRow = prevIndex % verticalCols;
308
+ const rowStep = direction === "up" ? -verticalCols : verticalCols;
309
+ const lastRowStart = maxIndex - maxIndex % verticalCols;
310
+ const rowCount = floor(maxIndex / verticalCols) + 1;
311
+ for (let rowStart = prevIndex - colInRow + rowStep, i = 0;i < rowCount; i += 1, rowStart += rowStep) {
312
+ if (rowStart < 0 || rowStart > maxIndex) {
313
+ if (!loopFocus) {
314
+ return;
315
+ }
316
+ rowStart = rowStart < 0 ? lastRowStart : 0;
317
+ }
318
+ const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);
319
+ for (let candidate = Math.min(rowStart + colInRow, rowEnd);candidate >= rowStart; candidate -= 1) {
320
+ if (!isListIndexDisabled(list, candidate, disabledIndices)) {
321
+ return candidate;
322
+ }
323
+ }
324
+ }
325
+ return;
326
+ };
327
+ if (stop) {
328
+ stopEvent(event);
329
+ }
330
+ const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);
331
+ if (verticalCandidate !== undefined) {
332
+ nextIndex = verticalCandidate;
333
+ } else if (prevIndex === -1) {
334
+ nextIndex = verticalDirection === "up" ? maxIndex : minIndex;
335
+ } else {
336
+ nextIndex = findNonDisabledListIndex(list, {
337
+ startingIndex: prevIndex,
338
+ amount: verticalCols,
339
+ decrement: verticalDirection === "up",
340
+ disabledIndices
341
+ });
342
+ if (loopFocus) {
343
+ if (verticalDirection === "up" && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {
344
+ const col = prevIndex % verticalCols;
345
+ const maxCol = maxIndex % verticalCols;
346
+ const offset = maxIndex - (maxCol - col);
347
+ if (maxCol === col) {
348
+ nextIndex = maxIndex;
349
+ } else {
350
+ nextIndex = maxCol > col ? offset : offset - verticalCols;
351
+ }
352
+ if (onLoop) {
353
+ nextIndex = onLoop(event, prevIndex, nextIndex);
354
+ }
355
+ }
356
+ if (verticalDirection === "down" && prevIndex + verticalCols > maxIndex) {
357
+ nextIndex = findNonDisabledListIndex(list, {
358
+ startingIndex: prevIndex % verticalCols - verticalCols,
359
+ amount: verticalCols,
360
+ disabledIndices
361
+ });
362
+ if (onLoop) {
363
+ nextIndex = onLoop(event, prevIndex, nextIndex);
364
+ }
365
+ }
366
+ }
367
+ }
368
+ if (isIndexOutOfListBounds(list, nextIndex)) {
369
+ nextIndex = prevIndex;
370
+ }
371
+ }
372
+ if (orientation === "both") {
373
+ const prevRow = floor(prevIndex / cols);
374
+ if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {
375
+ if (stop) {
376
+ stopEvent(event);
377
+ }
378
+ if (prevIndex % cols !== cols - 1) {
379
+ nextIndex = findNonDisabledListIndex(list, {
380
+ startingIndex: prevIndex,
381
+ disabledIndices
382
+ });
383
+ if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
384
+ nextIndex = findNonDisabledListIndex(list, {
385
+ startingIndex: prevIndex - prevIndex % cols - 1,
386
+ disabledIndices
387
+ });
388
+ if (onLoop) {
389
+ nextIndex = onLoop(event, prevIndex, nextIndex);
390
+ }
391
+ }
392
+ } else if (loopFocus) {
393
+ nextIndex = findNonDisabledListIndex(list, {
394
+ startingIndex: prevIndex - prevIndex % cols - 1,
395
+ disabledIndices
396
+ });
397
+ if (onLoop) {
398
+ nextIndex = onLoop(event, prevIndex, nextIndex);
399
+ }
400
+ }
401
+ if (isDifferentGridRow(nextIndex, cols, prevRow)) {
402
+ nextIndex = prevIndex;
403
+ }
404
+ }
405
+ if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {
406
+ if (stop) {
407
+ stopEvent(event);
408
+ }
409
+ if (prevIndex % cols !== 0) {
410
+ nextIndex = findNonDisabledListIndex(list, {
411
+ startingIndex: prevIndex,
412
+ decrement: true,
413
+ disabledIndices
414
+ });
415
+ if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {
416
+ nextIndex = findNonDisabledListIndex(list, {
417
+ startingIndex: prevIndex + (cols - prevIndex % cols),
418
+ decrement: true,
419
+ disabledIndices
420
+ });
421
+ if (onLoop) {
422
+ nextIndex = onLoop(event, prevIndex, nextIndex);
423
+ }
424
+ }
425
+ } else if (loopFocus) {
426
+ nextIndex = findNonDisabledListIndex(list, {
427
+ startingIndex: prevIndex + (cols - prevIndex % cols),
428
+ decrement: true,
429
+ disabledIndices
430
+ });
431
+ if (onLoop) {
432
+ nextIndex = onLoop(event, prevIndex, nextIndex);
433
+ }
434
+ }
435
+ if (isDifferentGridRow(nextIndex, cols, prevRow)) {
436
+ nextIndex = prevIndex;
437
+ }
438
+ }
439
+ const lastRow = floor(maxIndex / cols) === prevRow;
440
+ if (isIndexOutOfListBounds(list, nextIndex)) {
441
+ if (loopFocus && lastRow) {
442
+ nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {
443
+ startingIndex: prevIndex - prevIndex % cols - 1,
444
+ disabledIndices
445
+ });
446
+ if (onLoop) {
447
+ nextIndex = onLoop(event, prevIndex, nextIndex);
448
+ }
449
+ } else {
450
+ nextIndex = prevIndex;
451
+ }
452
+ }
453
+ }
454
+ return nextIndex;
455
+ }
456
+ function createGridCellMap(sizes, cols, dense) {
457
+ const cellMap = [];
458
+ let startIndex = 0;
459
+ sizes.forEach(({
460
+ width,
461
+ height
462
+ }, index) => {
463
+ if (width > cols) {
464
+ if (true) {
465
+ throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);
466
+ }
467
+ }
468
+ let itemPlaced = false;
469
+ if (dense) {
470
+ startIndex = 0;
471
+ }
472
+ while (!itemPlaced) {
473
+ const targetCells = [];
474
+ for (let i = 0;i < width; i += 1) {
475
+ for (let j = 0;j < height; j += 1) {
476
+ targetCells.push(startIndex + i + j * cols);
477
+ }
478
+ }
479
+ if (startIndex % cols + width <= cols && targetCells.every((cell) => cellMap[cell] == null)) {
480
+ targetCells.forEach((cell) => {
481
+ cellMap[cell] = index;
482
+ });
483
+ itemPlaced = true;
484
+ } else {
485
+ startIndex += 1;
486
+ }
487
+ }
488
+ });
489
+ return [...cellMap];
490
+ }
491
+ function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {
492
+ if (index === -1) {
493
+ return -1;
494
+ }
495
+ const firstCellIndex = cellMap.indexOf(index);
496
+ const sizeItem = sizes[index];
497
+ switch (corner) {
498
+ case "tl":
499
+ return firstCellIndex;
500
+ case "tr":
501
+ if (!sizeItem) {
502
+ return firstCellIndex;
503
+ }
504
+ return firstCellIndex + sizeItem.width - 1;
505
+ case "bl":
506
+ if (!sizeItem) {
507
+ return firstCellIndex;
508
+ }
509
+ return firstCellIndex + (sizeItem.height - 1) * cols;
510
+ case "br":
511
+ return cellMap.lastIndexOf(index);
512
+ default:
513
+ return -1;
514
+ }
515
+ }
516
+ function getGridCellIndices(indices, cellMap) {
517
+ return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);
518
+ }
519
+ function isListIndexDisabled(list, index, disabledIndices) {
520
+ const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;
521
+ if (isExplicitlyDisabled) {
522
+ return true;
523
+ }
524
+ const element = list[index];
525
+ if (!element) {
526
+ return false;
527
+ }
528
+ if (!isElementVisible(element)) {
529
+ return true;
530
+ }
531
+ return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true");
532
+ }
533
+ function isHiddenByStyles(styles) {
534
+ return styles.visibility === "hidden" || styles.visibility === "collapse";
535
+ }
536
+ function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {
537
+ if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {
538
+ return false;
539
+ }
540
+ if (typeof element.checkVisibility === "function") {
541
+ return element.checkVisibility();
542
+ }
543
+ return styles.display !== "none" && styles.display !== "contents";
544
+ }
545
+
546
+ export { stopEvent, isReactEvent, isVirtualClick, isVirtualPointerEvent, isMouseLikePointerType, isClickLikeEvent, sides, min, max, round, floor, createCoords, clamp, evaluate, getSide, getAlignment, getOppositeAxis, getAxisLength, getSideAxis, getAlignmentAxis, getAlignmentSides, getExpandedPlacements, getOppositeAxisPlacements, getOppositePlacement, getPaddingObject, rectToClientRect, isIndexOutOfListBounds, getMinListIndex, getMaxListIndex, findNonDisabledListIndex, getGridNavigatedIndex, createGridCellMap, getGridCellIndexOfCorner, getGridCellIndices, isListIndexDisabled, isElementVisible };
@@ -0,0 +1,146 @@
1
+ import {
2
+ CompositeListContext
3
+ } from "./_chunk-20rtfsz9.js";
4
+ import {
5
+ useStableCallback
6
+ } from "./_chunk-mznt6ktj.js";
7
+ import {
8
+ useIsoLayoutEffect
9
+ } from "./_chunk-b40erthe.js";
10
+ import {
11
+ useRefWithInit
12
+ } from "./_chunk-1s41sngz.js";
13
+
14
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/composite/list/CompositeList.js
15
+ import * as React from "react";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ "use client";
18
+ function CompositeList(props) {
19
+ const {
20
+ children,
21
+ elementsRef,
22
+ labelsRef,
23
+ onMapChange: onMapChangeProp
24
+ } = props;
25
+ const onMapChange = useStableCallback(onMapChangeProp);
26
+ const nextIndexRef = React.useRef(0);
27
+ const listeners = useRefWithInit(createListeners).current;
28
+ const map = useRefWithInit(createMap).current;
29
+ const [mapTick, setMapTick] = React.useState(0);
30
+ const lastTickRef = React.useRef(mapTick);
31
+ const register = useStableCallback((node, metadata) => {
32
+ map.set(node, metadata ?? null);
33
+ lastTickRef.current += 1;
34
+ setMapTick(lastTickRef.current);
35
+ });
36
+ const unregister = useStableCallback((node) => {
37
+ map.delete(node);
38
+ lastTickRef.current += 1;
39
+ setMapTick(lastTickRef.current);
40
+ });
41
+ const sortedMap = React.useMemo(() => {
42
+ disableEslintWarning(mapTick);
43
+ const newMap = new Map;
44
+ const sortedNodes = Array.from(map.keys()).filter((node) => node.isConnected).sort(sortByDocumentPosition);
45
+ sortedNodes.forEach((node, index) => {
46
+ const metadata = map.get(node) ?? {};
47
+ newMap.set(node, {
48
+ ...metadata,
49
+ index
50
+ });
51
+ });
52
+ return newMap;
53
+ }, [map, mapTick]);
54
+ useIsoLayoutEffect(() => {
55
+ if (typeof MutationObserver !== "function" || sortedMap.size === 0) {
56
+ return;
57
+ }
58
+ const mutationObserver = new MutationObserver((entries) => {
59
+ const diff = new Set;
60
+ const updateDiff = (node) => diff.has(node) ? diff.delete(node) : diff.add(node);
61
+ entries.forEach((entry) => {
62
+ entry.removedNodes.forEach(updateDiff);
63
+ entry.addedNodes.forEach(updateDiff);
64
+ });
65
+ if (diff.size === 0) {
66
+ lastTickRef.current += 1;
67
+ setMapTick(lastTickRef.current);
68
+ }
69
+ });
70
+ sortedMap.forEach((_, node) => {
71
+ if (node.parentElement) {
72
+ mutationObserver.observe(node.parentElement, {
73
+ childList: true
74
+ });
75
+ }
76
+ });
77
+ return () => {
78
+ mutationObserver.disconnect();
79
+ };
80
+ }, [sortedMap]);
81
+ useIsoLayoutEffect(() => {
82
+ const shouldUpdateLengths = lastTickRef.current === mapTick;
83
+ if (shouldUpdateLengths) {
84
+ if (elementsRef.current.length !== sortedMap.size) {
85
+ elementsRef.current.length = sortedMap.size;
86
+ }
87
+ if (labelsRef && labelsRef.current.length !== sortedMap.size) {
88
+ labelsRef.current.length = sortedMap.size;
89
+ }
90
+ nextIndexRef.current = sortedMap.size;
91
+ }
92
+ onMapChange(sortedMap);
93
+ }, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]);
94
+ useIsoLayoutEffect(() => {
95
+ return () => {
96
+ elementsRef.current = [];
97
+ };
98
+ }, [elementsRef]);
99
+ useIsoLayoutEffect(() => {
100
+ return () => {
101
+ if (labelsRef) {
102
+ labelsRef.current = [];
103
+ }
104
+ };
105
+ }, [labelsRef]);
106
+ const subscribeMapChange = useStableCallback((fn) => {
107
+ listeners.add(fn);
108
+ return () => {
109
+ listeners.delete(fn);
110
+ };
111
+ });
112
+ useIsoLayoutEffect(() => {
113
+ listeners.forEach((l) => l(sortedMap));
114
+ }, [listeners, sortedMap]);
115
+ const contextValue = React.useMemo(() => ({
116
+ register,
117
+ unregister,
118
+ subscribeMapChange,
119
+ elementsRef,
120
+ labelsRef,
121
+ nextIndexRef
122
+ }), [register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef]);
123
+ return /* @__PURE__ */ _jsx(CompositeListContext.Provider, {
124
+ value: contextValue,
125
+ children
126
+ });
127
+ }
128
+ function createMap() {
129
+ return new Map;
130
+ }
131
+ function createListeners() {
132
+ return new Set;
133
+ }
134
+ function sortByDocumentPosition(a, b) {
135
+ const position = a.compareDocumentPosition(b);
136
+ if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
137
+ return -1;
138
+ }
139
+ if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) {
140
+ return 1;
141
+ }
142
+ return 0;
143
+ }
144
+ function disableEslintWarning(_) {}
145
+
146
+ export { CompositeList };