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