@box-kite/react 2.2.15 → 2.2.17
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.
- package/.claude/rules/box-kite-rules.md +1 -1
- package/.claude/skills/box-kite/SKILL.md +1 -1
- package/.claude/skills/box-kite/references/styling.md +1 -1
- package/.cursor/rules/box-kite.mdc +1 -1
- package/AGENTS.md +1 -1
- package/BOX_AI_CONTEXT.md +16 -0
- package/BOX_KITE_AI_CONTEXT.md +16 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +16 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +1 -1
- package/client.cjs +1 -1
- package/client.mjs +10 -10
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +95 -91
- package/components/calendar.cjs +1 -1
- package/components/calendar.mjs +212 -210
- package/components/chart.cjs +1 -1
- package/components/chart.d.ts +8 -3
- package/components/chart.mjs +70 -65
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +187 -186
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.d.ts +1 -44
- package/components/dashboard.mjs +202 -201
- package/components/dataGrid/components/dataGridListLayout.d.ts +1 -1
- package/components/dataGrid/contracts/dataGridContract.d.ts +1 -1
- package/components/dataGrid/models/gridModel.d.ts +1 -1
- package/components/dataGrid.cjs +2 -2
- package/components/dataGrid.mjs +10 -10
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +96 -96
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +286 -285
- package/components/dialog.cjs +1 -1
- package/components/dialog.d.ts +2 -64
- package/components/dialog.mjs +131 -126
- package/components/form.cjs +1 -1
- package/components/form.d.ts +4 -3
- package/components/form.mjs +25 -22
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -73
- package/components/menu.mjs +220 -215
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +44 -43
- package/components/popover.cjs +1 -1
- package/components/popover.d.ts +1 -41
- package/components/popover.mjs +56 -51
- package/components/presence.cjs +1 -1
- package/components/presence.mjs +1 -1
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +59 -55
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.d.ts +1 -55
- package/components/slider.mjs +92 -90
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +149 -148
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +100 -100
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +135 -132
- package/components/toaster.cjs +1 -1
- package/components/toaster.d.ts +1 -37
- package/components/toaster.mjs +130 -128
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.d.ts +1 -34
- package/components/tooltip.mjs +73 -69
- package/components/virtualList.cjs +1 -1
- package/components/virtualList.mjs +88 -87
- package/docs/props.md +2 -2
- package/interactionListening.cjs +1 -1
- package/interactionListening.mjs +3 -3
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/motion.cjs +1 -1
- package/motion.mjs +30 -20
- package/package.json +41 -40
- package/placement.cjs +1 -1
- package/placement.mjs +1 -1
- package/platform.cjs +1 -1
- package/platform.mjs +17 -14
- package/react/animation/useHeldContent.d.ts +6 -0
- package/react/animation/usePresence.d.ts +4 -0
- package/react/componentsContext.d.ts +1 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/utils/chart/chartUtils.d.ts +3 -2
- package/utils/dashboard/dashboardUtils.d.ts +1 -1
- package/utils/dom/domUtils.d.ts +6 -0
- package/create/src/agents.d.ts +0 -22
- package/create/src/agents.test.d.ts +0 -1
- package/create/src/index.d.ts +0 -1
- package/create/src/options.d.ts +0 -31
- package/create/src/options.test.d.ts +0 -1
- package/create/src/packageManager.d.ts +0 -5
- package/create/src/project.d.ts +0 -27
- package/create/src/project.test.d.ts +0 -1
- package/create/templates/ts/designs/azure.d.ts +0 -5
- package/create/templates/ts/designs/ember.d.ts +0 -5
- package/create/templates/ts/designs/mono.d.ts +0 -5
- package/create/templates/ts/src/App.d.ts +0 -2
- package/create/templates/ts/src/design.d.ts +0 -5
- package/create/templates/ts/src/main.d.ts +0 -0
- package/mcp/src/data.d.ts +0 -90
- package/mcp/src/data.test.d.ts +0 -1
- package/mcp/src/engine.d.ts +0 -23
- package/mcp/src/index.d.ts +0 -1
- package/mcp/src/search.d.ts +0 -38
- package/mcp/src/search.test.d.ts +0 -1
- package/mcp/src/server.d.ts +0 -18
- package/mcp/src/server.test.d.ts +0 -1
- package/mcp/src/styles.d.ts +0 -27
- package/mcp/src/styles.test.d.ts +0 -1
- package/mcp/src/tools.d.ts +0 -18
- package/mcp/src/vocabulary.d.ts +0 -41
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +0 -24
- package/registry/blocks/dashboard-shell/dashboard-stats.d.ts +0 -13
- package/registry/blocks/data-grid/invoice-rows.d.ts +0 -15
- package/registry/blocks/data-grid/invoices-grid.d.ts +0 -1
- package/registry/blocks/settings-form/settings-form.d.ts +0 -17
- package/registry/designs/store/address-form.d.ts +0 -11
- package/registry/designs/store/cart-items.d.ts +0 -10
- package/registry/designs/store/cart-page.d.ts +0 -4
- package/registry/designs/store/checkout-page.d.ts +0 -7
- package/registry/designs/store/credit-card-form.d.ts +0 -10
- package/registry/designs/store/form-field.d.ts +0 -19
- package/registry/designs/store/order-summary.d.ts +0 -18
- package/registry/designs/store/product-art.d.ts +0 -26
- package/registry/designs/store/product-card.d.ts +0 -11
- package/registry/designs/store/product-gallery.d.ts +0 -11
- package/registry/designs/store/product-grid.d.ts +0 -10
- package/registry/designs/store/product-page.d.ts +0 -5
- package/registry/designs/store/quantity-stepper.d.ts +0 -13
- package/registry/designs/store/shipping-method.d.ts +0 -14
- package/registry/designs/store/store-data.d.ts +0 -53
- package/registry/designs/store/store-design.d.ts +0 -63
- package/registry/designs/store/store-shell.d.ts +0 -12
- package/registry/designs/store/storefront-page.d.ts +0 -4
- package/registry/designs/store/variant-picker.d.ts +0 -15
- package/supabase/functions/collect/index.d.ts +0 -30
- package/supabase/functions/collect/index.test.d.ts +0 -1
package/components/menu.mjs
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { f as e
|
|
3
|
-
import { n } from "../
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
2
|
+
import { f as e } from "../react-shared.mjs";
|
|
3
|
+
import { l as t, m as n, p as r } from "../platform.mjs";
|
|
4
|
+
import { n as i } from "../effects.mjs";
|
|
5
|
+
import a from "../box.mjs";
|
|
6
|
+
import { a as o, i as s } from "../behavior.mjs";
|
|
7
|
+
import { t as c } from "../identity.mjs";
|
|
8
|
+
import { t as l } from "../keyboard.mjs";
|
|
9
|
+
import { t as u } from "../placement.mjs";
|
|
10
|
+
import { a as d, i as f } from "../reporting.mjs";
|
|
11
|
+
import { t as p } from "../layer.mjs";
|
|
12
|
+
import m from "./overlay.mjs";
|
|
13
|
+
import { t as h } from "../motion.mjs";
|
|
14
|
+
import { createContext as g, useCallback as _, useContext as v, useMemo as y, useRef as b, useState as x } from "react";
|
|
15
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
14
16
|
//#region src/utils/menu/menuUtils.ts
|
|
15
|
-
var
|
|
17
|
+
var T;
|
|
16
18
|
(function(e) {
|
|
17
19
|
let t = e.ITEM_SELECTOR = "[role=\"menuitem\"],[role=\"menuitemcheckbox\"],[role=\"menuitemradio\"]";
|
|
18
20
|
function n(e, t) {
|
|
@@ -35,23 +37,23 @@ var S;
|
|
|
35
37
|
if (e.length !== 0) return e[t < 0 ? n > 0 ? 0 : e.length - 1 : ((t + n) % e.length + e.length) % e.length];
|
|
36
38
|
}
|
|
37
39
|
e.step = o;
|
|
38
|
-
function
|
|
39
|
-
let r =
|
|
40
|
+
function s(e, t, n) {
|
|
41
|
+
let r = l.target(t, n, e.length, (t) => e[t].textContent ?? "");
|
|
40
42
|
return r < 0 ? void 0 : e[r];
|
|
41
43
|
}
|
|
42
|
-
e.typeaheadTarget =
|
|
43
|
-
})(
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
let t =
|
|
44
|
+
e.typeaheadTarget = s;
|
|
45
|
+
})(T ||= {});
|
|
46
|
+
var E = T, D = g(null);
|
|
47
|
+
function O(e) {
|
|
48
|
+
let t = v(D);
|
|
47
49
|
if (!t) throw Error(`<${e}> must be rendered inside a <Menu>.`);
|
|
48
50
|
return t;
|
|
49
51
|
}
|
|
50
|
-
function
|
|
51
|
-
let [t, n] =
|
|
52
|
+
function k(e) {
|
|
53
|
+
let [t, n] = x([]);
|
|
52
54
|
return {
|
|
53
55
|
panels: t,
|
|
54
|
-
registerLayer:
|
|
56
|
+
registerLayer: _((t) => {
|
|
55
57
|
n((e) => [...e, t]);
|
|
56
58
|
let r = e?.(t);
|
|
57
59
|
return () => {
|
|
@@ -60,241 +62,245 @@ function E(e) {
|
|
|
60
62
|
}, [e])
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
65
|
-
let { trigger:
|
|
66
|
-
let t =
|
|
67
|
-
|
|
68
|
-
}), { panels:
|
|
65
|
+
var A = g(null);
|
|
66
|
+
function j(e, t) {
|
|
67
|
+
let { trigger: n, children: r, open: i, defaultOpen: a = !1, onOpenChange: s, label: c, labelledBy: l, side: u = "bottom", align: d = "start", offset: f = 1, flip: m = !0, matchWidth: h = !1, props: g, ..._ } = e, v = b("first"), x = o((e) => {
|
|
68
|
+
let t = E.items(e), n = v.current === "last" ? t[t.length - 1] : t[0];
|
|
69
|
+
v.current = "first", (n ?? e).focus();
|
|
70
|
+
}), { panels: T, registerLayer: O } = k(), A = p({
|
|
69
71
|
haspopup: "menu",
|
|
70
72
|
idPrefix: "menu",
|
|
71
|
-
id:
|
|
72
|
-
open:
|
|
73
|
+
id: _.id,
|
|
74
|
+
open: i,
|
|
73
75
|
defaultOpen: a,
|
|
74
|
-
onOpenChange:
|
|
76
|
+
onOpenChange: s,
|
|
75
77
|
interaction: {
|
|
76
78
|
component: "menu",
|
|
77
79
|
type: "openChange"
|
|
78
80
|
},
|
|
79
|
-
onOpened:
|
|
80
|
-
inside:
|
|
81
|
-
}), j =
|
|
82
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(),
|
|
81
|
+
onOpened: x,
|
|
82
|
+
inside: T
|
|
83
|
+
}), j = o((e) => {
|
|
84
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), v.current = e.key === "ArrowUp" ? "last" : "first", A.isOpen && A.panelElement ? x(A.panelElement) : A.setOpen(!0, {
|
|
83
85
|
reason: "trigger",
|
|
84
86
|
event: e
|
|
85
87
|
}));
|
|
86
|
-
}),
|
|
88
|
+
}), N = y(() => ({
|
|
87
89
|
ref: A.trigger.ref,
|
|
88
90
|
props: {
|
|
89
91
|
...A.trigger.props,
|
|
90
92
|
onKeyDown: j
|
|
91
93
|
}
|
|
92
|
-
}), [j, A.trigger]),
|
|
94
|
+
}), [j, A.trigger]), P = o((e) => A.setOpen(!1, e)), F = y(() => ({
|
|
93
95
|
open: A.isOpen,
|
|
94
|
-
closeAll:
|
|
96
|
+
closeAll: P,
|
|
95
97
|
registerLayer: O
|
|
96
98
|
}), [
|
|
97
|
-
|
|
99
|
+
P,
|
|
98
100
|
A.isOpen,
|
|
99
101
|
O
|
|
100
102
|
]);
|
|
101
|
-
return /* @__PURE__ */
|
|
102
|
-
value:
|
|
103
|
-
children: /* @__PURE__ */
|
|
103
|
+
return /* @__PURE__ */ w(S, { children: [n(N), /* @__PURE__ */ C(D.Provider, {
|
|
104
|
+
value: F,
|
|
105
|
+
children: /* @__PURE__ */ C(M, {
|
|
104
106
|
layer: A,
|
|
105
|
-
side:
|
|
106
|
-
align:
|
|
107
|
+
side: u,
|
|
108
|
+
align: d,
|
|
107
109
|
offset: f,
|
|
108
|
-
flip:
|
|
109
|
-
matchWidth:
|
|
110
|
-
label:
|
|
111
|
-
labelledBy:
|
|
112
|
-
contentProps:
|
|
113
|
-
...
|
|
114
|
-
|
|
110
|
+
flip: m,
|
|
111
|
+
matchWidth: h,
|
|
112
|
+
label: c,
|
|
113
|
+
labelledBy: l ?? (c ? void 0 : A.triggerId),
|
|
114
|
+
contentProps: g,
|
|
115
|
+
..._,
|
|
116
|
+
elementRef: t,
|
|
117
|
+
children: r
|
|
115
118
|
})
|
|
116
119
|
})] });
|
|
117
120
|
}
|
|
118
|
-
function
|
|
119
|
-
let { layer:
|
|
121
|
+
function M(e) {
|
|
122
|
+
let { layer: r, side: i, align: s, offset: c, flip: d, matchWidth: f, label: p, labelledBy: g, contentProps: v, closeSelf: y, elementRef: x, children: S, ...w } = e, { platform: T, isOpen: D, id: k, triggerElement: A, setPanel: j } = r, M = _((e) => {
|
|
123
|
+
j(e), t(x, e);
|
|
124
|
+
}, [j, x]), N = O("Menu"), P = b({
|
|
120
125
|
query: "",
|
|
121
126
|
at: 0
|
|
122
|
-
}),
|
|
123
|
-
side:
|
|
124
|
-
align:
|
|
125
|
-
offset:
|
|
126
|
-
flip:
|
|
127
|
-
matchWidth:
|
|
128
|
-
anchor:
|
|
129
|
-
}),
|
|
127
|
+
}), F = u({
|
|
128
|
+
side: i,
|
|
129
|
+
align: s,
|
|
130
|
+
offset: c,
|
|
131
|
+
flip: d,
|
|
132
|
+
matchWidth: f,
|
|
133
|
+
anchor: A
|
|
134
|
+
}), I = h(S, D, r.panelElement), L = {
|
|
130
135
|
role: "menu",
|
|
131
136
|
"aria-label": p,
|
|
132
|
-
"aria-labelledby":
|
|
137
|
+
"aria-labelledby": g,
|
|
133
138
|
tabIndex: -1,
|
|
134
|
-
onKeyDown:
|
|
135
|
-
let
|
|
136
|
-
if (!
|
|
137
|
-
let r =
|
|
139
|
+
onKeyDown: o((e) => {
|
|
140
|
+
let t = e.currentTarget;
|
|
141
|
+
if (!E.owns(t, e.target)) return;
|
|
142
|
+
let r = E.items(t), i = r.indexOf(document.activeElement), a = (t) => {
|
|
138
143
|
t && (e.preventDefault(), t.focus());
|
|
139
|
-
}, o = t
|
|
144
|
+
}, o = n(t) ? "ArrowRight" : "ArrowLeft";
|
|
140
145
|
switch (e.key) {
|
|
141
|
-
case "ArrowDown": return a(
|
|
142
|
-
case "ArrowUp": return a(
|
|
146
|
+
case "ArrowDown": return a(E.step(r, i, 1));
|
|
147
|
+
case "ArrowUp": return a(E.step(r, i, -1));
|
|
143
148
|
case "Home": return a(r[0]);
|
|
144
149
|
case "End": return a(r[r.length - 1]);
|
|
145
|
-
case "Tab": return
|
|
150
|
+
case "Tab": return N.closeAll({
|
|
146
151
|
reason: "tab",
|
|
147
152
|
event: e
|
|
148
153
|
});
|
|
149
|
-
case o: return
|
|
154
|
+
case o: return y ? (e.preventDefault(), y({
|
|
150
155
|
reason: "trigger",
|
|
151
156
|
event: e
|
|
152
157
|
})) : void 0;
|
|
153
158
|
}
|
|
154
|
-
if (
|
|
155
|
-
let t =
|
|
156
|
-
a(
|
|
159
|
+
if (l.isPrintable(e)) {
|
|
160
|
+
let t = l.push(P.current, e.key, e.timeStamp);
|
|
161
|
+
a(E.typeaheadTarget(r, t, i));
|
|
157
162
|
}
|
|
158
163
|
}),
|
|
159
|
-
onPointerOver:
|
|
160
|
-
let t = e.currentTarget, n = e.target?.closest(
|
|
161
|
-
!n || !
|
|
164
|
+
onPointerOver: o((e) => {
|
|
165
|
+
let t = e.currentTarget, n = e.target?.closest(E.ITEM_SELECTOR);
|
|
166
|
+
!n || !E.owns(t, n) || n === document.activeElement || n.focus();
|
|
162
167
|
}),
|
|
163
|
-
...
|
|
168
|
+
...v
|
|
164
169
|
};
|
|
165
|
-
return
|
|
166
|
-
ref:
|
|
170
|
+
return T ? /* @__PURE__ */ C(a, {
|
|
171
|
+
ref: M,
|
|
167
172
|
component: "menu",
|
|
168
|
-
...
|
|
169
|
-
variant: [
|
|
170
|
-
...
|
|
171
|
-
id:
|
|
173
|
+
...w,
|
|
174
|
+
variant: [w.variant, { topLayer: !0 }],
|
|
175
|
+
...F.layerProps,
|
|
176
|
+
id: k,
|
|
172
177
|
props: {
|
|
173
178
|
popover: "auto",
|
|
174
|
-
...
|
|
179
|
+
...L
|
|
175
180
|
},
|
|
176
|
-
children:
|
|
177
|
-
}) :
|
|
178
|
-
contentRef:
|
|
179
|
-
anchor:
|
|
180
|
-
side:
|
|
181
|
-
align:
|
|
182
|
-
offset:
|
|
183
|
-
flip:
|
|
184
|
-
matchWidth:
|
|
181
|
+
children: I
|
|
182
|
+
}) : D ? /* @__PURE__ */ C(m, {
|
|
183
|
+
contentRef: M,
|
|
184
|
+
anchor: A,
|
|
185
|
+
side: i,
|
|
186
|
+
align: s,
|
|
187
|
+
offset: c,
|
|
188
|
+
flip: d,
|
|
189
|
+
matchWidth: f,
|
|
185
190
|
component: "menu",
|
|
186
|
-
...
|
|
187
|
-
id:
|
|
188
|
-
props:
|
|
189
|
-
children:
|
|
191
|
+
...w,
|
|
192
|
+
id: k,
|
|
193
|
+
props: L,
|
|
194
|
+
children: S
|
|
190
195
|
}) : null;
|
|
191
196
|
}
|
|
192
|
-
function
|
|
193
|
-
let { label: s, children:
|
|
194
|
-
(
|
|
195
|
-
}),
|
|
197
|
+
function N(e, t) {
|
|
198
|
+
let { label: s, children: l, disabled: u, side: d = "end", align: m = "start", offset: h = 0, flip: g = !0, itemProps: _, props: v, ...b } = e, x = O("Menu.Sub"), T = c("menu-sub"), A = o((e) => {
|
|
199
|
+
(E.items(e)[0] ?? e).focus();
|
|
200
|
+
}), j = o((e, t) => {
|
|
196
201
|
e && t?.focus();
|
|
197
|
-
}), { panels: N, registerLayer:
|
|
202
|
+
}), { panels: N, registerLayer: F } = k(x.registerLayer), I = f("menu.sub"), L = p({
|
|
198
203
|
haspopup: "menu",
|
|
199
204
|
idPrefix: "menu-sub",
|
|
200
|
-
id:
|
|
205
|
+
id: b.id,
|
|
201
206
|
onOpened: A,
|
|
202
|
-
onClosing:
|
|
207
|
+
onClosing: j,
|
|
203
208
|
inside: N
|
|
204
209
|
});
|
|
205
|
-
|
|
206
|
-
if (!(!
|
|
210
|
+
i(() => {
|
|
211
|
+
if (!(!L.isOpen || !L.panelElement)) return x.registerLayer(L.panelElement);
|
|
207
212
|
}, [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
]),
|
|
212
|
-
|
|
213
|
-
}, [
|
|
214
|
-
if (!
|
|
215
|
-
let
|
|
216
|
-
return document.addEventListener("focusin", (
|
|
217
|
-
e
|
|
213
|
+
L.isOpen,
|
|
214
|
+
L.panelElement,
|
|
215
|
+
x.registerLayer
|
|
216
|
+
]), i(() => {
|
|
217
|
+
x.open || L.setOpen(!1, { reason: "imperative" });
|
|
218
|
+
}, [x.open, L.setOpen]), i(() => {
|
|
219
|
+
if (!L.isOpen) return;
|
|
220
|
+
let e = new AbortController();
|
|
221
|
+
return document.addEventListener("focusin", (e) => {
|
|
222
|
+
r(e, [L.panelElement, L.triggerElement]) || L.setOpen(!1, {
|
|
218
223
|
reason: "imperative",
|
|
219
|
-
event:
|
|
224
|
+
event: e
|
|
220
225
|
});
|
|
221
|
-
}, { signal:
|
|
226
|
+
}, { signal: e.signal }), () => e.abort();
|
|
222
227
|
}, [
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
228
|
+
L.isOpen,
|
|
229
|
+
L.panelElement,
|
|
230
|
+
L.triggerElement,
|
|
231
|
+
L.setOpen
|
|
227
232
|
]);
|
|
228
|
-
let
|
|
229
|
-
let
|
|
230
|
-
|
|
233
|
+
let R = o((e) => {
|
|
234
|
+
let t = n(e.currentTarget) ? "ArrowLeft" : "ArrowRight";
|
|
235
|
+
u || e.key !== t || (e.preventDefault(), L.setOpen(!0, {
|
|
231
236
|
reason: "trigger",
|
|
232
237
|
event: e
|
|
233
|
-
}),
|
|
238
|
+
}), I("openChange", !0, {
|
|
234
239
|
reason: "keyboard",
|
|
235
240
|
event: e,
|
|
236
|
-
item:
|
|
241
|
+
item: P(s)
|
|
237
242
|
}));
|
|
238
|
-
}),
|
|
239
|
-
|
|
243
|
+
}), z = o((e) => {
|
|
244
|
+
u || L.setOpen(!0, {
|
|
240
245
|
reason: "trigger",
|
|
241
246
|
event: e
|
|
242
247
|
});
|
|
243
|
-
}),
|
|
244
|
-
open:
|
|
245
|
-
closeAll:
|
|
246
|
-
registerLayer:
|
|
248
|
+
}), B = y(() => ({
|
|
249
|
+
open: L.isOpen,
|
|
250
|
+
closeAll: x.closeAll,
|
|
251
|
+
registerLayer: F
|
|
247
252
|
}), [
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
L.isOpen,
|
|
254
|
+
x.closeAll,
|
|
255
|
+
F
|
|
251
256
|
]);
|
|
252
|
-
return /* @__PURE__ */
|
|
257
|
+
return /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ w(a, {
|
|
253
258
|
tag: "button",
|
|
254
|
-
ref:
|
|
259
|
+
ref: u ? void 0 : L.trigger.ref,
|
|
255
260
|
component: "menu.item",
|
|
256
261
|
variant: { sub: !0 },
|
|
257
|
-
id:
|
|
262
|
+
id: T,
|
|
258
263
|
props: {
|
|
259
264
|
type: "button",
|
|
260
265
|
role: "menuitem",
|
|
261
266
|
tabIndex: -1,
|
|
262
|
-
"aria-disabled":
|
|
263
|
-
...
|
|
267
|
+
"aria-disabled": u || void 0,
|
|
268
|
+
...L.trigger.props,
|
|
264
269
|
..._,
|
|
265
|
-
onKeyDown:
|
|
266
|
-
onPointerEnter:
|
|
270
|
+
onKeyDown: R,
|
|
271
|
+
onPointerEnter: z
|
|
267
272
|
},
|
|
268
|
-
children: [s, /* @__PURE__ */
|
|
269
|
-
}), !
|
|
270
|
-
value:
|
|
271
|
-
children: /* @__PURE__ */
|
|
272
|
-
layer:
|
|
273
|
-
side:
|
|
274
|
-
align:
|
|
275
|
-
offset:
|
|
276
|
-
flip:
|
|
273
|
+
children: [s, /* @__PURE__ */ C(a, { component: "menu.arrow" })]
|
|
274
|
+
}), !u && /* @__PURE__ */ C(D.Provider, {
|
|
275
|
+
value: B,
|
|
276
|
+
children: /* @__PURE__ */ C(M, {
|
|
277
|
+
layer: L,
|
|
278
|
+
side: d,
|
|
279
|
+
align: m,
|
|
280
|
+
offset: h,
|
|
281
|
+
flip: g,
|
|
277
282
|
matchWidth: !1,
|
|
278
|
-
labelledBy:
|
|
283
|
+
labelledBy: T,
|
|
279
284
|
contentProps: v,
|
|
280
|
-
closeSelf: (e) =>
|
|
281
|
-
...
|
|
282
|
-
|
|
285
|
+
closeSelf: (e) => L.setOpen(!1, e),
|
|
286
|
+
...b,
|
|
287
|
+
elementRef: t,
|
|
288
|
+
children: l
|
|
283
289
|
})
|
|
284
290
|
})] });
|
|
285
291
|
}
|
|
286
|
-
var
|
|
287
|
-
function
|
|
288
|
-
let { onSelect: t, disabled: n, closeOnSelect:
|
|
289
|
-
n || (t?.(e),
|
|
292
|
+
var P = (e, t) => t ?? (typeof e == "string" ? e : void 0);
|
|
293
|
+
function F(e) {
|
|
294
|
+
let { onSelect: t, disabled: n, closeOnSelect: r = !0, value: i, props: s, children: c, ...l } = e, u = O("Menu.Item"), d = f("menu.item"), p = o((e) => {
|
|
295
|
+
n || (t?.(e), d("select", P(c, i), {
|
|
290
296
|
reason: "select",
|
|
291
297
|
event: e
|
|
292
|
-
}),
|
|
298
|
+
}), r && u.closeAll({
|
|
293
299
|
reason: "select",
|
|
294
300
|
event: e
|
|
295
301
|
}));
|
|
296
302
|
});
|
|
297
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ C(a, {
|
|
298
304
|
tag: "button",
|
|
299
305
|
component: "menu.item",
|
|
300
306
|
...l,
|
|
@@ -309,25 +315,25 @@ function M(e) {
|
|
|
309
315
|
children: c
|
|
310
316
|
});
|
|
311
317
|
}
|
|
312
|
-
function
|
|
313
|
-
let { checked: t, defaultChecked: n = !1, onCheckedChange:
|
|
318
|
+
function I(e) {
|
|
319
|
+
let { checked: t, defaultChecked: n = !1, onCheckedChange: r, disabled: i, closeOnSelect: c = !1, value: l, props: u, children: d, ...p } = e, m = O("Menu.CheckboxItem"), [h, g] = s({
|
|
314
320
|
value: t,
|
|
315
321
|
defaultValue: n,
|
|
316
|
-
onChange:
|
|
317
|
-
}), _ =
|
|
318
|
-
|
|
322
|
+
onChange: r
|
|
323
|
+
}), _ = f("menu.checkboxItem"), v = o((e) => {
|
|
324
|
+
i || (g(!h, {
|
|
319
325
|
reason: "select",
|
|
320
326
|
event: e
|
|
321
327
|
}), _("checkedChange", !h, {
|
|
322
328
|
reason: "select",
|
|
323
329
|
event: e,
|
|
324
|
-
item:
|
|
330
|
+
item: P(d, l)
|
|
325
331
|
}), c && m.closeAll({
|
|
326
332
|
reason: "select",
|
|
327
333
|
event: e
|
|
328
334
|
}));
|
|
329
335
|
});
|
|
330
|
-
return /* @__PURE__ */
|
|
336
|
+
return /* @__PURE__ */ w(a, {
|
|
331
337
|
tag: "button",
|
|
332
338
|
component: "menu.item",
|
|
333
339
|
...p,
|
|
@@ -336,51 +342,51 @@ function N(e) {
|
|
|
336
342
|
role: "menuitemcheckbox",
|
|
337
343
|
tabIndex: -1,
|
|
338
344
|
"aria-checked": h,
|
|
339
|
-
"aria-disabled":
|
|
340
|
-
...
|
|
345
|
+
"aria-disabled": i || void 0,
|
|
346
|
+
...u,
|
|
341
347
|
onClick: v
|
|
342
348
|
},
|
|
343
|
-
children: [/* @__PURE__ */
|
|
349
|
+
children: [/* @__PURE__ */ C(a, {
|
|
344
350
|
component: "menu.indicator",
|
|
345
|
-
children: h && /* @__PURE__ */
|
|
346
|
-
}),
|
|
351
|
+
children: h && /* @__PURE__ */ C(a, { component: "menu.check" })
|
|
352
|
+
}), d]
|
|
347
353
|
});
|
|
348
354
|
}
|
|
349
|
-
function
|
|
350
|
-
let { label: t, value: n, defaultValue: r = "", onValueChange:
|
|
355
|
+
function L(e) {
|
|
356
|
+
let { label: t, value: n, defaultValue: r = "", onValueChange: i, children: a, ...s } = e, [c, l] = d({
|
|
351
357
|
value: n,
|
|
352
358
|
defaultValue: r,
|
|
353
|
-
onChange:
|
|
359
|
+
onChange: i,
|
|
354
360
|
interaction: {
|
|
355
361
|
component: "menu.radioGroup",
|
|
356
362
|
type: "valueChange"
|
|
357
363
|
}
|
|
358
|
-
}),
|
|
364
|
+
}), u = o((e, t) => l(e, {
|
|
359
365
|
reason: "select",
|
|
360
366
|
event: t
|
|
361
|
-
})), f =
|
|
367
|
+
})), f = y(() => ({
|
|
362
368
|
value: c,
|
|
363
|
-
select:
|
|
364
|
-
}), [c,
|
|
365
|
-
return /* @__PURE__ */
|
|
369
|
+
select: u
|
|
370
|
+
}), [c, u]);
|
|
371
|
+
return /* @__PURE__ */ C(A.Provider, {
|
|
366
372
|
value: f,
|
|
367
|
-
children: /* @__PURE__ */
|
|
373
|
+
children: /* @__PURE__ */ C(z, {
|
|
368
374
|
label: t,
|
|
369
375
|
...s,
|
|
370
|
-
children:
|
|
376
|
+
children: a
|
|
371
377
|
})
|
|
372
378
|
});
|
|
373
379
|
}
|
|
374
|
-
function
|
|
375
|
-
let { value: t, disabled: n, closeOnSelect:
|
|
380
|
+
function R(e) {
|
|
381
|
+
let { value: t, disabled: n, closeOnSelect: r = !1, props: i, children: s, ...c } = e, l = O("Menu.RadioItem"), u = v(A);
|
|
376
382
|
if (!u) throw Error("<Menu.RadioItem> must be rendered inside a <Menu.RadioGroup>.");
|
|
377
|
-
let d = u.value === t, f =
|
|
378
|
-
n || (u.select(t, e),
|
|
383
|
+
let d = u.value === t, f = o((e) => {
|
|
384
|
+
n || (u.select(t, e), r && l.closeAll({
|
|
379
385
|
reason: "select",
|
|
380
386
|
event: e
|
|
381
387
|
}));
|
|
382
388
|
});
|
|
383
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ w(a, {
|
|
384
390
|
tag: "button",
|
|
385
391
|
component: "menu.item",
|
|
386
392
|
...c,
|
|
@@ -390,36 +396,36 @@ function F(e) {
|
|
|
390
396
|
tabIndex: -1,
|
|
391
397
|
"aria-checked": d,
|
|
392
398
|
"aria-disabled": n || void 0,
|
|
393
|
-
...
|
|
399
|
+
...i,
|
|
394
400
|
onClick: f
|
|
395
401
|
},
|
|
396
|
-
children: [/* @__PURE__ */
|
|
402
|
+
children: [/* @__PURE__ */ C(a, {
|
|
397
403
|
component: "menu.indicator",
|
|
398
|
-
children: d && /* @__PURE__ */
|
|
404
|
+
children: d && /* @__PURE__ */ C(a, { component: "menu.dot" })
|
|
399
405
|
}), s]
|
|
400
406
|
});
|
|
401
407
|
}
|
|
402
|
-
function
|
|
403
|
-
let { label: t, props: n, children:
|
|
404
|
-
return /* @__PURE__ */
|
|
408
|
+
function z(e) {
|
|
409
|
+
let { label: t, props: n, children: r, ...i } = e, o = c("menu-group");
|
|
410
|
+
return /* @__PURE__ */ w(a, {
|
|
405
411
|
component: "menu.group",
|
|
406
|
-
...
|
|
412
|
+
...i,
|
|
407
413
|
props: {
|
|
408
414
|
role: "group",
|
|
409
|
-
"aria-labelledby": t ?
|
|
415
|
+
"aria-labelledby": t ? o : void 0,
|
|
410
416
|
...n
|
|
411
417
|
},
|
|
412
|
-
children: [t && /* @__PURE__ */
|
|
418
|
+
children: [t && /* @__PURE__ */ C(a, {
|
|
413
419
|
component: "menu.label",
|
|
414
|
-
id:
|
|
420
|
+
id: o,
|
|
415
421
|
props: { role: "presentation" },
|
|
416
422
|
children: t
|
|
417
|
-
}),
|
|
423
|
+
}), r]
|
|
418
424
|
});
|
|
419
425
|
}
|
|
420
|
-
function
|
|
426
|
+
function B(e) {
|
|
421
427
|
let { props: t, ...n } = e;
|
|
422
|
-
return /* @__PURE__ */
|
|
428
|
+
return /* @__PURE__ */ C(a, {
|
|
423
429
|
component: "menu.separator",
|
|
424
430
|
...n,
|
|
425
431
|
props: {
|
|
@@ -428,16 +434,15 @@ function L(e) {
|
|
|
428
434
|
}
|
|
429
435
|
});
|
|
430
436
|
}
|
|
431
|
-
|
|
432
|
-
var
|
|
433
|
-
Item:
|
|
434
|
-
CheckboxItem:
|
|
435
|
-
RadioGroup:
|
|
436
|
-
RadioItem:
|
|
437
|
-
Group:
|
|
438
|
-
Separator:
|
|
439
|
-
Sub:
|
|
437
|
+
F.displayName = "Menu.Item", I.displayName = "Menu.CheckboxItem", L.displayName = "Menu.RadioGroup", R.displayName = "Menu.RadioItem", z.displayName = "Menu.Group", B.displayName = "Menu.Separator";
|
|
438
|
+
var V = Object.assign(e(j, "Menu"), {
|
|
439
|
+
Item: F,
|
|
440
|
+
CheckboxItem: I,
|
|
441
|
+
RadioGroup: L,
|
|
442
|
+
RadioItem: R,
|
|
443
|
+
Group: z,
|
|
444
|
+
Separator: B,
|
|
445
|
+
Sub: e(N, "Menu.Sub")
|
|
440
446
|
});
|
|
441
|
-
O.displayName = "Menu";
|
|
442
447
|
//#endregion
|
|
443
|
-
export {
|
|
448
|
+
export { V as default };
|
package/components/overlay.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../platform.cjs"),t=require("../client.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../placement.cjs"),a=require("../layer.cjs");let o=require("react"),s=require("react/jsx-runtime"),c=require("react-dom");function l(l,u){let{side:d=`bottom`,align:f=`center`,offset:p=0,flip:m=!0,onSideChange:h,anchor:g,contentRef:_,matchWidth:v=!0,...y}=l,[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(!1),w=(0,o.useRef)(null),T=a.n(),E=(0,o.useRef)(null),D=t.t(!T),O=i.t({side:d,align:f,offset:p,flip:m,matchWidth:v,anchor:g??b,trackSide:!!h});n.n(()=>{let t=E.current;!T||!e.c()||!t||!t.isConnected||t.matches(`:popover-open`)||t.showPopover()}),n.n(()=>{if(T)return;let t=e.
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../platform.cjs"),t=require("../client.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../placement.cjs"),a=require("../layer.cjs");let o=require("react"),s=require("react/jsx-runtime"),c=require("react-dom");function l(l,u){let{side:d=`bottom`,align:f=`center`,offset:p=0,flip:m=!0,onSideChange:h,anchor:g,contentRef:_,matchWidth:v=!0,...y}=l,[b,x]=(0,o.useState)(null),[S,C]=(0,o.useState)(!1),w=(0,o.useRef)(null),T=a.n(),E=(0,o.useRef)(null),D=t.t(!T),O=i.t({side:d,align:f,offset:p,flip:m,matchWidth:v,anchor:g??b,trackSide:!!h});n.n(()=>{let t=E.current;!T||!e.c()||!t||!t.isConnected||t.matches(`:popover-open`)||t.showPopover()}),n.n(()=>{if(T)return;let t=e.f(g)??b;C(!!t&&e.m(t))},[g,b,T]),n.n(()=>{w.current!==O.side&&(w.current=O.side,h?.(O.side))});let k=O.layerProps.ref,A=(0,o.useCallback)(t=>{k?.(t),E.current=t,e.l(u,t)},[k,u]),j=(0,s.jsx)(r.default,{...O.layerProps,ref:A,transition:`none`,overflow:`visible`,props:T?{popover:`manual`}:{dir:S?`rtl`:`ltr`},children:(0,s.jsx)(r.default,{ref:_,...y})});return(0,s.jsxs)(s.Fragment,{children:[!g&&(0,s.jsx)(r.default,{ref:x}),T?j:D&&(0,c.createPortal)(j,D)]})}var u=(0,o.forwardRef)(l);u.displayName=`Overlay`,exports.default=u;
|