@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
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "3.0.2",
4
+ "version": "3.6.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "./Sidebar": {
8
- "import": "./layout/Sidebar.jsx",
9
- "default": "./layout/Sidebar.jsx"
8
+ "import": "./components/layout/Sidebar.jsx",
9
+ "default": "./components/layout/Sidebar.jsx"
10
10
  },
11
11
  "./DynamicIcon": {
12
- "import": "./core/DynamicIcon.jsx",
13
- "default": "./core/DynamicIcon.jsx"
12
+ "import": "./components/core/DynamicIcon.jsx",
13
+ "default": "./components/core/DynamicIcon.jsx"
14
14
  },
15
15
  "./ErrorBoundary": {
16
16
  "import": "./components/ErrorBoundary.jsx",
17
17
  "default": "./components/ErrorBoundary.jsx"
18
18
  },
19
19
  "./Header": {
20
- "import": "./layout/Header.jsx",
21
- "default": "./layout/Header.jsx"
20
+ "import": "./components/layout/Header.jsx",
21
+ "default": "./components/layout/Header.jsx"
22
22
  },
23
23
  "./LandingView": {
24
- "import": "./views/LandingView.jsx",
25
- "default": "./views/LandingView.jsx"
24
+ "import": "./components/views/LandingView.jsx",
25
+ "default": "./components/views/LandingView.jsx"
26
26
  },
27
27
  "./Layout": {
28
- "import": "./layout/Layout.jsx",
29
- "default": "./layout/Layout.jsx"
28
+ "import": "./components/layout/Layout.jsx",
29
+ "default": "./components/layout/Layout.jsx"
30
30
  },
31
31
  "./NotFound": {
32
- "import": "./views/NotFound.jsx",
33
- "default": "./views/NotFound.jsx"
32
+ "import": "./components/views/NotFound.jsx",
33
+ "default": "./components/views/NotFound.jsx"
34
34
  },
35
35
  "./SettingsView": {
36
- "import": "./views/SettingsView.jsx",
37
- "default": "./views/SettingsView.jsx"
36
+ "import": "./components/views/SettingsView.jsx",
37
+ "default": "./components/views/SettingsView.jsx"
38
38
  },
39
39
  "./Sheet": {
40
40
  "import": "./components/Sheet.jsx",
41
41
  "default": "./components/Sheet.jsx"
42
42
  },
43
43
  "./SignInView": {
44
- "import": "./views/SignInView.jsx",
45
- "default": "./views/SignInView.jsx"
44
+ "import": "./components/views/SignInView.jsx",
45
+ "default": "./components/views/SignInView.jsx"
46
46
  },
47
47
  "./SignUpView": {
48
- "import": "./views/SignUpView.jsx",
49
- "default": "./views/SignUpView.jsx"
48
+ "import": "./components/views/SignUpView.jsx",
49
+ "default": "./components/views/SignUpView.jsx"
50
50
  },
51
51
  "./SignOutView": {
52
- "import": "./views/SignOutView.jsx",
53
- "default": "./views/SignOutView.jsx"
52
+ "import": "./components/views/SignOutView.jsx",
53
+ "default": "./components/views/SignOutView.jsx"
54
54
  },
55
55
  "./PaymentView": {
56
- "import": "./views/PaymentView.jsx",
57
- "default": "./views/PaymentView.jsx"
56
+ "import": "./components/views/PaymentView.jsx",
57
+ "default": "./components/views/PaymentView.jsx"
58
58
  },
59
59
  "./TabBar": {
60
- "import": "./layout/TabBar.jsx",
61
- "default": "./layout/TabBar.jsx"
60
+ "import": "./components/layout/TabBar.jsx",
61
+ "default": "./components/layout/TabBar.jsx"
62
62
  },
63
63
  "./TextView": {
64
- "import": "./views/TextView.jsx",
65
- "default": "./views/TextView.jsx"
64
+ "import": "./components/views/TextView.jsx",
65
+ "default": "./components/views/TextView.jsx"
66
66
  },
67
67
  "./ThemeToggle": {
68
68
  "import": "./components/ThemeToggle.jsx",
@@ -73,8 +73,8 @@
73
73
  "default": "./components/UpgradeSheet.jsx"
74
74
  },
75
75
  "./Utilities": {
76
- "import": "./core/Utilities.js",
77
- "default": "./core/Utilities.js"
76
+ "import": "./components/core/Utilities.js",
77
+ "default": "./components/core/Utilities.js"
78
78
  },
79
79
  "./ProtectedRoute": {
80
80
  "import": "./components/ProtectedRoute.jsx",
@@ -85,8 +85,8 @@
85
85
  "default": "./styles.css"
86
86
  },
87
87
  "./Context": {
88
- "import": "./core/Context.jsx",
89
- "default": "./core/Context.jsx"
88
+ "import": "./components/core/Context.jsx",
89
+ "default": "./components/core/Context.jsx"
90
90
  },
91
91
  "./App": {
92
92
  "import": "./App.jsx",
@@ -124,11 +124,7 @@
124
124
  "styles.css",
125
125
  "CHANGELOG.md",
126
126
  "README.md",
127
- "MIGRATION.md",
128
- "core",
129
127
  "components",
130
- "layout",
131
- "views",
132
128
  "shadcn",
133
129
  "hooks",
134
130
  "fonts"
@@ -141,23 +137,9 @@
141
137
  "type": "git",
142
138
  "url": "git+https://github.com/stevederico/skateboard-ui.git"
143
139
  },
144
- "dependencies": {
145
- "@base-ui/react": "^1.4.1",
146
- "use-sync-external-store": "^1.6.0",
147
- "tailwind-merge": "^3.5.0",
148
- "vaul": "^1.1.2"
149
- },
150
140
  "peerDependencies": {
151
141
  "react": "^19.1.0",
152
142
  "react-dom": "^19.1.0",
153
- "react-router-dom": "^7.0.0",
154
- "embla-carousel-react": "^8.6.0",
155
- "react-resizable-panels": "^4.10.0",
156
- "recharts": "^3.8.1"
157
- },
158
- "peerDependenciesMeta": {
159
- "embla-carousel-react": { "optional": true },
160
- "react-resizable-panels": { "optional": true },
161
- "recharts": { "optional": true }
143
+ "react-router-dom": "^7.0.0"
162
144
  }
163
145
  }
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Material-UI SAS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,70 @@
1
+ import {
2
+ error
3
+ } from "./_chunk-71zm6zgv.js";
4
+
5
+ // node_modules/.deno/@base-ui+utils@0.2.8/node_modules/@base-ui/utils/esm/useControlled.js
6
+ import * as React from "react";
7
+ "use client";
8
+ function useControlled({
9
+ controlled,
10
+ default: defaultProp,
11
+ name,
12
+ state = "value"
13
+ }) {
14
+ const {
15
+ current: isControlled
16
+ } = React.useRef(controlled !== undefined);
17
+ const [valueState, setValue] = React.useState(defaultProp);
18
+ const value = isControlled ? controlled : valueState;
19
+ if (true) {
20
+ React.useEffect(() => {
21
+ if (isControlled !== (controlled !== undefined)) {
22
+ error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} ` + "element for the lifetime of the component.", "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
23
+ `));
24
+ }
25
+ }, [state, name, controlled]);
26
+ const {
27
+ current: defaultValue
28
+ } = React.useRef(defaultProp);
29
+ React.useEffect(() => {
30
+ if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) {
31
+ error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. ` + `To suppress this warning opt to use a controlled ${name}.`].join(`
32
+ `));
33
+ }
34
+ }, [defaultProp]);
35
+ }
36
+ const setValueIfUncontrolled = React.useCallback((newValue) => {
37
+ if (!isControlled) {
38
+ setValue(newValue);
39
+ }
40
+ }, []);
41
+ return [value, setValueIfUncontrolled];
42
+ }
43
+ function serializeToDevModeString(input) {
44
+ let nextId = 0;
45
+ const seen = new WeakMap;
46
+ try {
47
+ const result = JSON.stringify(input, function replacer(key, value) {
48
+ if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) {
49
+ return;
50
+ }
51
+ if (typeof value === "bigint") {
52
+ return `__bigint__:${value}`;
53
+ }
54
+ if (value !== null && typeof value === "object") {
55
+ const id = seen.get(value);
56
+ if (id !== undefined) {
57
+ return `__object__:${id}`;
58
+ }
59
+ seen.set(value, nextId);
60
+ nextId += 1;
61
+ }
62
+ return value;
63
+ });
64
+ return result ?? `__top__:${typeof input}`;
65
+ } catch {
66
+ return "__unserializable__";
67
+ }
68
+ }
69
+
70
+ export { useControlled };
@@ -0,0 +1,347 @@
1
+ import {
2
+ ACTIVE_COMPOSITE_ITEM
3
+ } from "./_chunk-r0vsdknk.js";
4
+ import {
5
+ isElementDisabled
6
+ } from "./_chunk-vdc01ss3.js";
7
+ import {
8
+ CompositeList
9
+ } from "./_chunk-p6qynd6r.js";
10
+ import {
11
+ useDirection
12
+ } from "./_chunk-wtw745qd.js";
13
+ import {
14
+ getTarget
15
+ } from "./_chunk-atnkefgd.js";
16
+ import {
17
+ ALL_KEYS,
18
+ ARROW_DOWN,
19
+ ARROW_KEYS,
20
+ ARROW_LEFT,
21
+ ARROW_RIGHT,
22
+ ARROW_UP,
23
+ END,
24
+ HOME,
25
+ HORIZONTAL_KEYS,
26
+ HORIZONTAL_KEYS_WITH_EXTRA_KEYS,
27
+ MODIFIER_KEYS,
28
+ VERTICAL_KEYS,
29
+ VERTICAL_KEYS_WITH_EXTRA_KEYS,
30
+ isNativeInput,
31
+ scrollIntoViewIfNeeded
32
+ } from "./_chunk-qce0xt57.js";
33
+ import {
34
+ createGridCellMap,
35
+ findNonDisabledListIndex,
36
+ getGridCellIndexOfCorner,
37
+ getGridCellIndices,
38
+ getGridNavigatedIndex,
39
+ getMaxListIndex,
40
+ getMinListIndex,
41
+ isIndexOutOfListBounds,
42
+ isListIndexDisabled
43
+ } from "./_chunk-nya71ccw.js";
44
+ import {
45
+ CompositeRootContext
46
+ } from "./_chunk-6xevjepc.js";
47
+ import {
48
+ useStableCallback
49
+ } from "./_chunk-mznt6ktj.js";
50
+ import {
51
+ EMPTY_ARRAY,
52
+ EMPTY_OBJECT,
53
+ useMergedRefs,
54
+ useRenderElement
55
+ } from "./_chunk-1s41sngz.js";
56
+
57
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/composite/root/CompositeRoot.js
58
+ import * as React2 from "react";
59
+
60
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/composite/root/useCompositeRoot.js
61
+ import * as React from "react";
62
+ "use client";
63
+ var EMPTY_ARRAY2 = [];
64
+ function useCompositeRoot(params) {
65
+ const {
66
+ itemSizes,
67
+ cols = 1,
68
+ loopFocus = true,
69
+ onLoop,
70
+ dense = false,
71
+ orientation = "both",
72
+ direction,
73
+ highlightedIndex: externalHighlightedIndex,
74
+ onHighlightedIndexChange: externalSetHighlightedIndex,
75
+ rootRef: externalRef,
76
+ enableHomeAndEndKeys = false,
77
+ stopEventPropagation = false,
78
+ disabledIndices,
79
+ modifierKeys = EMPTY_ARRAY2
80
+ } = params;
81
+ const [internalHighlightedIndex, internalSetHighlightedIndex] = React.useState(0);
82
+ const isGrid = cols > 1;
83
+ const rootRef = React.useRef(null);
84
+ const mergedRef = useMergedRefs(rootRef, externalRef);
85
+ const elementsRef = React.useRef([]);
86
+ const hasSetDefaultIndexRef = React.useRef(false);
87
+ const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
88
+ const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false) => {
89
+ (externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);
90
+ if (shouldScrollIntoView) {
91
+ const newActiveItem = elementsRef.current[index];
92
+ scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);
93
+ }
94
+ });
95
+ const onMapChange = useStableCallback((map) => {
96
+ if (map.size === 0 || hasSetDefaultIndexRef.current) {
97
+ return;
98
+ }
99
+ hasSetDefaultIndexRef.current = true;
100
+ const sortedElements = Array.from(map.keys());
101
+ const activeItem = sortedElements.find((compositeElement) => compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;
102
+ const activeIndex = activeItem ? sortedElements.indexOf(activeItem) : -1;
103
+ if (activeIndex !== -1) {
104
+ onHighlightedIndexChange(activeIndex);
105
+ }
106
+ scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);
107
+ });
108
+ const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex) => {
109
+ if (!onLoop) {
110
+ return nextIndex;
111
+ }
112
+ return onLoop?.(event, prevIndex, nextIndex, elementsRef);
113
+ });
114
+ const props = React.useMemo(() => ({
115
+ "aria-orientation": orientation === "both" ? undefined : orientation,
116
+ ref: mergedRef,
117
+ onFocus(event) {
118
+ const element = rootRef.current;
119
+ const target = getTarget(event.nativeEvent);
120
+ if (!element || target == null || !isNativeInput(target)) {
121
+ return;
122
+ }
123
+ target.setSelectionRange(0, target.value.length ?? 0);
124
+ },
125
+ onKeyDown(event) {
126
+ const RELEVANT_KEYS = enableHomeAndEndKeys ? ALL_KEYS : ARROW_KEYS;
127
+ if (!RELEVANT_KEYS.has(event.key)) {
128
+ return;
129
+ }
130
+ if (isModifierKeySet(event, modifierKeys)) {
131
+ return;
132
+ }
133
+ const element = rootRef.current;
134
+ if (!element) {
135
+ return;
136
+ }
137
+ const isRtl = direction === "rtl";
138
+ const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;
139
+ const forwardKey = {
140
+ horizontal: horizontalForwardKey,
141
+ vertical: ARROW_DOWN,
142
+ both: horizontalForwardKey
143
+ }[orientation];
144
+ const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;
145
+ const backwardKey = {
146
+ horizontal: horizontalBackwardKey,
147
+ vertical: ARROW_UP,
148
+ both: horizontalBackwardKey
149
+ }[orientation];
150
+ const target = getTarget(event.nativeEvent);
151
+ if (target != null && isNativeInput(target) && !isElementDisabled(target)) {
152
+ const selectionStart = target.selectionStart;
153
+ const selectionEnd = target.selectionEnd;
154
+ const textContent = target.value ?? "";
155
+ if (selectionStart == null || event.shiftKey || selectionStart !== selectionEnd) {
156
+ return;
157
+ }
158
+ if (event.key !== backwardKey && selectionStart < textContent.length) {
159
+ return;
160
+ }
161
+ if (event.key !== forwardKey && selectionStart > 0) {
162
+ return;
163
+ }
164
+ }
165
+ let nextIndex = highlightedIndex;
166
+ const minIndex = getMinListIndex(elementsRef, disabledIndices);
167
+ const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
168
+ if (isGrid) {
169
+ const sizes = itemSizes || Array.from({
170
+ length: elementsRef.current.length
171
+ }, () => ({
172
+ width: 1,
173
+ height: 1
174
+ }));
175
+ const cellMap = createGridCellMap(sizes, cols, dense);
176
+ const minGridIndex = cellMap.findIndex((index) => index != null && !isListIndexDisabled(elementsRef.current, index, disabledIndices));
177
+ const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex) => index != null && !isListIndexDisabled(elementsRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1);
178
+ nextIndex = cellMap[getGridNavigatedIndex(cellMap.map((itemIndex) => itemIndex != null ? elementsRef.current[itemIndex] : null), {
179
+ event,
180
+ orientation,
181
+ loopFocus,
182
+ onLoop: wrappedOnLoop,
183
+ cols,
184
+ disabledIndices: getGridCellIndices([...disabledIndices || elementsRef.current.map((_, index) => isListIndexDisabled(elementsRef.current, index) ? index : undefined), undefined], cellMap),
185
+ minIndex: minGridIndex,
186
+ maxIndex: maxGridIndex,
187
+ prevIndex: getGridCellIndexOfCorner(highlightedIndex > maxIndex ? minIndex : highlightedIndex, sizes, cellMap, cols, event.key === ARROW_DOWN ? "bl" : event.key === ARROW_RIGHT ? "tr" : "tl"),
188
+ rtl: isRtl
189
+ })];
190
+ }
191
+ const forwardKeys = {
192
+ horizontal: [horizontalForwardKey],
193
+ vertical: [ARROW_DOWN],
194
+ both: [horizontalForwardKey, ARROW_DOWN]
195
+ }[orientation];
196
+ const backwardKeys = {
197
+ horizontal: [horizontalBackwardKey],
198
+ vertical: [ARROW_UP],
199
+ both: [horizontalBackwardKey, ARROW_UP]
200
+ }[orientation];
201
+ const preventedKeys = isGrid ? RELEVANT_KEYS : {
202
+ horizontal: enableHomeAndEndKeys ? HORIZONTAL_KEYS_WITH_EXTRA_KEYS : HORIZONTAL_KEYS,
203
+ vertical: enableHomeAndEndKeys ? VERTICAL_KEYS_WITH_EXTRA_KEYS : VERTICAL_KEYS,
204
+ both: RELEVANT_KEYS
205
+ }[orientation];
206
+ if (enableHomeAndEndKeys) {
207
+ if (event.key === HOME) {
208
+ nextIndex = minIndex;
209
+ } else if (event.key === END) {
210
+ nextIndex = maxIndex;
211
+ }
212
+ }
213
+ if (nextIndex === highlightedIndex && (forwardKeys.includes(event.key) || backwardKeys.includes(event.key))) {
214
+ if (loopFocus && nextIndex === maxIndex && forwardKeys.includes(event.key)) {
215
+ nextIndex = minIndex;
216
+ if (onLoop) {
217
+ nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
218
+ }
219
+ } else if (loopFocus && nextIndex === minIndex && backwardKeys.includes(event.key)) {
220
+ nextIndex = maxIndex;
221
+ if (onLoop) {
222
+ nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
223
+ }
224
+ } else {
225
+ nextIndex = findNonDisabledListIndex(elementsRef.current, {
226
+ startingIndex: nextIndex,
227
+ decrement: backwardKeys.includes(event.key),
228
+ disabledIndices
229
+ });
230
+ }
231
+ }
232
+ if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {
233
+ if (stopEventPropagation) {
234
+ event.stopPropagation();
235
+ }
236
+ if (preventedKeys.has(event.key)) {
237
+ event.preventDefault();
238
+ }
239
+ onHighlightedIndexChange(nextIndex, true);
240
+ queueMicrotask(() => {
241
+ elementsRef.current[nextIndex]?.focus();
242
+ });
243
+ }
244
+ }
245
+ }), [cols, dense, direction, disabledIndices, elementsRef, enableHomeAndEndKeys, highlightedIndex, isGrid, itemSizes, loopFocus, onLoop, wrappedOnLoop, mergedRef, modifierKeys, onHighlightedIndexChange, orientation, stopEventPropagation]);
246
+ return React.useMemo(() => ({
247
+ props,
248
+ highlightedIndex,
249
+ onHighlightedIndexChange,
250
+ elementsRef,
251
+ disabledIndices,
252
+ onMapChange,
253
+ relayKeyboardEvent: props.onKeyDown
254
+ }), [props, highlightedIndex, onHighlightedIndexChange, elementsRef, disabledIndices, onMapChange]);
255
+ }
256
+ function isModifierKeySet(event, ignoredModifierKeys) {
257
+ for (const key of MODIFIER_KEYS.values()) {
258
+ if (ignoredModifierKeys.includes(key)) {
259
+ continue;
260
+ }
261
+ if (event.getModifierState(key)) {
262
+ return true;
263
+ }
264
+ }
265
+ return false;
266
+ }
267
+
268
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/internals/composite/root/CompositeRoot.js
269
+ import { jsx as _jsx } from "react/jsx-runtime";
270
+ "use client";
271
+ function CompositeRoot(componentProps) {
272
+ const {
273
+ render,
274
+ className,
275
+ style,
276
+ refs = EMPTY_ARRAY,
277
+ props = EMPTY_ARRAY,
278
+ state = EMPTY_OBJECT,
279
+ stateAttributesMapping,
280
+ highlightedIndex: highlightedIndexProp,
281
+ onHighlightedIndexChange: onHighlightedIndexChangeProp,
282
+ orientation,
283
+ dense,
284
+ itemSizes,
285
+ loopFocus,
286
+ onLoop,
287
+ cols,
288
+ enableHomeAndEndKeys,
289
+ onMapChange: onMapChangeProp,
290
+ stopEventPropagation = true,
291
+ rootRef,
292
+ disabledIndices,
293
+ modifierKeys,
294
+ highlightItemOnHover = false,
295
+ tag = "div",
296
+ ...elementProps
297
+ } = componentProps;
298
+ const direction = useDirection();
299
+ const {
300
+ props: defaultProps,
301
+ highlightedIndex,
302
+ onHighlightedIndexChange,
303
+ elementsRef,
304
+ onMapChange: onMapChangeUnwrapped,
305
+ relayKeyboardEvent
306
+ } = useCompositeRoot({
307
+ itemSizes,
308
+ cols,
309
+ loopFocus,
310
+ onLoop,
311
+ dense,
312
+ orientation,
313
+ highlightedIndex: highlightedIndexProp,
314
+ onHighlightedIndexChange: onHighlightedIndexChangeProp,
315
+ rootRef,
316
+ stopEventPropagation,
317
+ enableHomeAndEndKeys,
318
+ direction,
319
+ disabledIndices,
320
+ modifierKeys
321
+ });
322
+ const element = useRenderElement(tag, componentProps, {
323
+ state,
324
+ ref: refs,
325
+ props: [defaultProps, ...props, elementProps],
326
+ stateAttributesMapping
327
+ });
328
+ const contextValue = React2.useMemo(() => ({
329
+ highlightedIndex,
330
+ onHighlightedIndexChange,
331
+ highlightItemOnHover,
332
+ relayKeyboardEvent
333
+ }), [highlightedIndex, onHighlightedIndexChange, highlightItemOnHover, relayKeyboardEvent]);
334
+ return /* @__PURE__ */ _jsx(CompositeRootContext.Provider, {
335
+ value: contextValue,
336
+ children: /* @__PURE__ */ _jsx(CompositeList, {
337
+ elementsRef,
338
+ onMapChange: (newMap) => {
339
+ onMapChangeProp?.(newMap);
340
+ onMapChangeUnwrapped(newMap);
341
+ },
342
+ children: element
343
+ })
344
+ });
345
+ }
346
+
347
+ export { CompositeRoot };
@@ -0,0 +1,57 @@
1
+ import {
2
+ getNextTabbable,
3
+ getTabbableAfterElement,
4
+ getTabbableBeforeElement,
5
+ isOutsideEvent
6
+ } from "./_chunk-2tyt8f8r.js";
7
+ import {
8
+ contains
9
+ } from "./_chunk-atnkefgd.js";
10
+ import {
11
+ createChangeEventDetails,
12
+ exports_reason_parts
13
+ } from "./_chunk-4s0k3h7t.js";
14
+ import {
15
+ useStableCallback
16
+ } from "./_chunk-mznt6ktj.js";
17
+
18
+ // node_modules/.deno/@base-ui+react@1.4.1/node_modules/@base-ui/react/esm/utils/popups/useTriggerFocusGuards.js
19
+ import * as React from "react";
20
+ import * as ReactDOM from "react-dom";
21
+ "use client";
22
+ function useTriggerFocusGuards(store, triggerElementRef) {
23
+ const preFocusGuardRef = React.useRef(null);
24
+ const handlePreFocusGuardFocus = useStableCallback((event) => {
25
+ ReactDOM.flushSync(() => {
26
+ store.setOpen(false, createChangeEventDetails(exports_reason_parts.focusOut, event.nativeEvent, event.currentTarget));
27
+ });
28
+ const previousTabbable = getTabbableBeforeElement(preFocusGuardRef.current);
29
+ previousTabbable?.focus();
30
+ });
31
+ const handleFocusTargetFocus = useStableCallback((event) => {
32
+ const positionerElement = store.select("positionerElement");
33
+ if (positionerElement && isOutsideEvent(event, positionerElement)) {
34
+ store.context.beforeContentFocusGuardRef.current?.focus();
35
+ } else {
36
+ ReactDOM.flushSync(() => {
37
+ store.setOpen(false, createChangeEventDetails(exports_reason_parts.focusOut, event.nativeEvent, event.currentTarget));
38
+ });
39
+ let nextTabbable = getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current);
40
+ while (nextTabbable !== null && contains(positionerElement, nextTabbable)) {
41
+ const prevTabbable = nextTabbable;
42
+ nextTabbable = getNextTabbable(nextTabbable);
43
+ if (nextTabbable === prevTabbable) {
44
+ break;
45
+ }
46
+ }
47
+ nextTabbable?.focus();
48
+ }
49
+ });
50
+ return {
51
+ preFocusGuardRef,
52
+ handlePreFocusGuardFocus,
53
+ handleFocusTargetFocus
54
+ };
55
+ }
56
+
57
+ export { useTriggerFocusGuards };