@box-kite/react 2.2.5 → 2.2.6
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 +3 -1
- package/.claude/skills/box-kite/SKILL.md +3 -1
- package/.claude/skills/box-kite/references/components.md +34 -0
- package/.cursor/rules/box-kite.mdc +3 -1
- package/AGENTS.md +3 -1
- package/BOX_AI_CONTEXT.md +95 -5
- package/BOX_KITE_AI_CONTEXT.md +95 -5
- package/box.cjs +1 -1
- package/box.mjs +7 -7
- package/catalog.cjs +1 -1
- package/catalog.mjs +521 -0
- package/client.cjs +1 -1
- package/client.mjs +94 -106
- package/components/calendar.cjs +1 -0
- package/components/calendar.d.ts +77 -0
- package/components/calendar.mjs +483 -0
- package/components/dataGrid/components/dataGridBooleanValue.d.ts +11 -0
- package/components/dataGrid/components/dataGridDateParts.d.ts +40 -0
- package/components/dataGrid/components/dataGridDateValue.d.ts +14 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +38 -11
- package/components/dataGrid/models/columnModel.d.ts +3 -1
- package/components/dataGrid/models/editModel.d.ts +3 -1
- package/components/dataGrid/models/localeText.d.ts +4 -0
- package/components/dataGrid/useDateParts.d.ts +17 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +797 -664
- package/components/dateField.cjs +1 -0
- package/components/dateField.d.ts +78 -0
- package/components/dateField.mjs +313 -0
- package/components/datePicker.cjs +1 -0
- package/components/datePicker.d.ts +120 -0
- package/components/datePicker.mjs +529 -0
- package/components/dateTime.cjs +1 -0
- package/components/dateTime.d.ts +23 -0
- package/components/dateTime.mjs +34 -0
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +87 -75
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +1 -1
- package/components/semantics.d.ts +29 -29
- package/components/timeZoneSelect.cjs +1 -0
- package/components/timeZoneSelect.d.ts +52 -0
- package/components/timeZoneSelect.mjs +74 -0
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +1 -1
- package/dataGridDateParts.cjs +1 -0
- package/dataGridDateParts.mjs +223 -0
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +328 -365
- package/dataGridListLayout.cjs +1 -0
- package/dataGridListLayout.mjs +49 -0
- package/date-environment.cjs +1 -0
- package/date-environment.mjs +29 -0
- package/date-input.cjs +1 -0
- package/date-input.mjs +346 -0
- package/date-math.cjs +1 -0
- package/date-math.mjs +317 -0
- package/date.cjs +1 -0
- package/date.d.ts +40 -0
- package/date.mjs +4 -0
- package/dates.cjs +1 -0
- package/dates.mjs +689 -0
- package/docs/components.md +6 -1
- package/package.json +118 -26
- package/react/boxComponent.d.ts +1 -1
- package/react/date/dateChange.d.ts +18 -0
- package/react/date/dateEnvironment.d.ts +34 -0
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/ssg.cjs +1 -1
- package/ssg.mjs +1 -1
- package/utils/date/calendar.d.ts +44 -0
- package/utils/date/calendarModel.d.ts +46 -0
- package/utils/date/dateTime.d.ts +144 -0
- package/utils/date/fieldModel.d.ts +74 -0
- package/utils/date/format.d.ts +39 -0
- package/utils/date/iso.d.ts +40 -0
- package/utils/date/locale.d.ts +17 -0
- package/utils/date/parse.d.ts +20 -0
- package/utils/date/settings.d.ts +26 -0
- package/utils/date/value.d.ts +43 -0
- package/utils/date/zoneOptions.d.ts +19 -0
- package/utils/date/zones.d.ts +32 -0
package/components/dialog.mjs
CHANGED
|
@@ -1,77 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { a as t, l as n,
|
|
4
|
-
import { n as
|
|
5
|
-
import
|
|
6
|
-
import { a as
|
|
7
|
-
import { t as
|
|
8
|
-
import { H2 as
|
|
9
|
-
import { createContext as
|
|
10
|
-
import { Fragment as
|
|
2
|
+
import { i as e } from "../client.mjs";
|
|
3
|
+
import { a as t, l as n, n as r, u as i } from "../platform.mjs";
|
|
4
|
+
import { n as a } from "../effects.mjs";
|
|
5
|
+
import o from "../box.mjs";
|
|
6
|
+
import { a as s, i as c, n as l, r as u } from "../behavior.mjs";
|
|
7
|
+
import { t as d } from "../identity.mjs";
|
|
8
|
+
import { H2 as f, P as p } from "./semantics.mjs";
|
|
9
|
+
import { createContext as m, useCallback as h, useContext as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
10
|
+
import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
11
|
+
//#region src/react/dialog/useScrollLock.ts
|
|
12
|
+
var C = 0;
|
|
13
|
+
function w(t) {
|
|
14
|
+
let { classNames: n, styleElements: i } = e({ overflow: "hidden" }, !1), o = n.slice(1).join(" ");
|
|
15
|
+
return a(() => {
|
|
16
|
+
let e = r();
|
|
17
|
+
if (!(!t || !e || !o)) return C += 1, e.classList.add(o), () => {
|
|
18
|
+
--C, C === 0 && e.classList.remove(o);
|
|
19
|
+
};
|
|
20
|
+
}, [t, o]), i;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
11
23
|
//#region src/components/dialog.tsx
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let t =
|
|
24
|
+
var T = m(null);
|
|
25
|
+
function E(e) {
|
|
26
|
+
let t = g(T);
|
|
15
27
|
if (!t) throw Error(`<${e}> must be rendered inside a <Dialog>.`);
|
|
16
28
|
return t;
|
|
17
29
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */
|
|
30
|
+
function D(e) {
|
|
31
|
+
return /* @__PURE__ */ x(k, {
|
|
20
32
|
role: "dialog",
|
|
21
33
|
...e
|
|
22
34
|
});
|
|
23
35
|
}
|
|
24
|
-
function
|
|
25
|
-
return /* @__PURE__ */
|
|
36
|
+
function O(e) {
|
|
37
|
+
return /* @__PURE__ */ x(k, {
|
|
26
38
|
role: "alertdialog",
|
|
27
39
|
...e,
|
|
28
40
|
modal: !0,
|
|
29
41
|
dismissible: !1
|
|
30
42
|
});
|
|
31
43
|
}
|
|
32
|
-
function
|
|
33
|
-
let { role:
|
|
34
|
-
value:
|
|
35
|
-
defaultValue:
|
|
36
|
-
onChange:
|
|
37
|
-
}), [I, L] =
|
|
44
|
+
function k(e) {
|
|
45
|
+
let { role: t, trigger: r, children: i, open: u, defaultOpen: f = !1, onOpenChange: p, label: m, labelledBy: g, describedBy: v, modal: C = !0, dismissible: E = !0, lockScroll: D = C, initialFocus: O, props: k, ...j } = e, M = d("dialog"), N = j.id ?? M, [P, F] = c({
|
|
46
|
+
value: u,
|
|
47
|
+
defaultValue: f,
|
|
48
|
+
onChange: p
|
|
49
|
+
}), [I, L] = y(null), [R, z] = y(null), [B, V] = y(!1), [H, U] = y({
|
|
38
50
|
title: 0,
|
|
39
51
|
description: 0
|
|
40
|
-
}), W =
|
|
41
|
-
|
|
52
|
+
}), W = w(P && D);
|
|
53
|
+
l({
|
|
42
54
|
enabled: P,
|
|
43
55
|
returnTo: R
|
|
44
56
|
});
|
|
45
|
-
let G =
|
|
57
|
+
let G = h((e) => (U((t) => ({
|
|
46
58
|
...t,
|
|
47
59
|
[e]: t[e] + 1
|
|
48
60
|
})), () => U((t) => ({
|
|
49
61
|
...t,
|
|
50
62
|
[e]: t[e] - 1
|
|
51
|
-
}))), []), K =
|
|
63
|
+
}))), []), K = _(() => ({
|
|
52
64
|
titleId: `${N}-title`,
|
|
53
65
|
descriptionId: `${N}-description`,
|
|
54
66
|
register: G
|
|
55
67
|
}), [N, G]);
|
|
56
|
-
|
|
68
|
+
A({
|
|
57
69
|
dialog: I,
|
|
58
70
|
isOpen: P,
|
|
59
71
|
domOpen: B,
|
|
60
72
|
setDomOpen: V,
|
|
61
73
|
setOpen: F,
|
|
62
|
-
modal:
|
|
74
|
+
modal: C,
|
|
63
75
|
dismissible: E,
|
|
64
76
|
triggerElement: R
|
|
65
|
-
}),
|
|
66
|
-
let e = n(
|
|
77
|
+
}), a(() => {
|
|
78
|
+
let e = n(O);
|
|
67
79
|
!P || !e || e.focus();
|
|
68
|
-
}, [P,
|
|
69
|
-
let q =
|
|
80
|
+
}, [P, O]);
|
|
81
|
+
let q = s((e) => {
|
|
70
82
|
F((e) => !e, {
|
|
71
83
|
reason: "trigger",
|
|
72
84
|
event: e
|
|
73
85
|
});
|
|
74
|
-
}), J =
|
|
86
|
+
}), J = _(() => ({
|
|
75
87
|
ref: z,
|
|
76
88
|
props: {
|
|
77
89
|
"aria-expanded": P,
|
|
@@ -84,40 +96,40 @@ function E(t) {
|
|
|
84
96
|
q,
|
|
85
97
|
P
|
|
86
98
|
]), Y = j;
|
|
87
|
-
return /* @__PURE__ */
|
|
99
|
+
return /* @__PURE__ */ S(b, { children: [
|
|
88
100
|
W,
|
|
89
|
-
|
|
90
|
-
/* @__PURE__ */
|
|
101
|
+
r?.(J),
|
|
102
|
+
/* @__PURE__ */ x(T.Provider, {
|
|
91
103
|
value: K,
|
|
92
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ x(o, {
|
|
93
105
|
ref: L,
|
|
94
106
|
tag: "dialog",
|
|
95
107
|
component: "dialog",
|
|
96
108
|
...Y,
|
|
97
109
|
id: N,
|
|
98
110
|
props: {
|
|
99
|
-
role:
|
|
100
|
-
"aria-label": H.title ||
|
|
101
|
-
"aria-labelledby":
|
|
102
|
-
"aria-describedby":
|
|
103
|
-
...
|
|
111
|
+
role: t,
|
|
112
|
+
"aria-label": H.title || g ? void 0 : m,
|
|
113
|
+
"aria-labelledby": g ?? (H.title ? K.titleId : void 0),
|
|
114
|
+
"aria-describedby": v ?? (H.description ? K.descriptionId : void 0),
|
|
115
|
+
...k
|
|
104
116
|
},
|
|
105
|
-
children:
|
|
117
|
+
children: i
|
|
106
118
|
})
|
|
107
119
|
})
|
|
108
120
|
] });
|
|
109
121
|
}
|
|
110
|
-
function
|
|
111
|
-
let { dialog: n, isOpen:
|
|
112
|
-
|
|
113
|
-
!n ||
|
|
122
|
+
function A(e) {
|
|
123
|
+
let { dialog: n, isOpen: r, domOpen: o, setDomOpen: s, setOpen: c, modal: l, dismissible: d, triggerElement: f } = e, p = v("imperative"), m = t(), h = d ? "any" : "closerequest";
|
|
124
|
+
a(() => {
|
|
125
|
+
!n || r === o || (s(r), r ? l ? n.showModal() : n.show() : n.close());
|
|
114
126
|
}, [
|
|
115
127
|
n,
|
|
116
|
-
|
|
128
|
+
r,
|
|
117
129
|
o,
|
|
118
|
-
|
|
130
|
+
l,
|
|
119
131
|
s
|
|
120
|
-
]),
|
|
132
|
+
]), a(() => {
|
|
121
133
|
if (!n) return;
|
|
122
134
|
let e = new AbortController();
|
|
123
135
|
return n.addEventListener("close", (e) => {
|
|
@@ -130,14 +142,14 @@ function D(e) {
|
|
|
130
142
|
n,
|
|
131
143
|
s,
|
|
132
144
|
c
|
|
133
|
-
]),
|
|
145
|
+
]), a(() => {
|
|
134
146
|
if (!(!n || !m)) return n.setAttribute("closedby", h), () => n.removeAttribute("closedby");
|
|
135
147
|
}, [
|
|
136
148
|
n,
|
|
137
149
|
m,
|
|
138
150
|
h
|
|
139
|
-
]),
|
|
140
|
-
if (!
|
|
151
|
+
]), a(() => {
|
|
152
|
+
if (!r || !n) return;
|
|
141
153
|
let e = new AbortController(), t = (t, n) => document.addEventListener(t, n, {
|
|
142
154
|
signal: e.signal,
|
|
143
155
|
capture: !0
|
|
@@ -145,14 +157,14 @@ function D(e) {
|
|
|
145
157
|
return t("keydown", (e) => {
|
|
146
158
|
e.key === "Escape" && (p.current = "escape");
|
|
147
159
|
}), t("pointerdown", (e) => {
|
|
148
|
-
|
|
160
|
+
i(e, [f]) ? p.current = "trigger" : !i(e, [n]) || j(n, e) ? p.current = "outside-pointer" : p.current = "imperative";
|
|
149
161
|
}), () => e.abort();
|
|
150
162
|
}, [
|
|
151
|
-
|
|
163
|
+
r,
|
|
152
164
|
n,
|
|
153
165
|
f
|
|
154
|
-
]),
|
|
155
|
-
enabled:
|
|
166
|
+
]), u({
|
|
167
|
+
enabled: r && !l && !m,
|
|
156
168
|
inside: [n],
|
|
157
169
|
escapeKey: !0,
|
|
158
170
|
outsidePointer: !1,
|
|
@@ -160,11 +172,11 @@ function D(e) {
|
|
|
160
172
|
reason: "escape",
|
|
161
173
|
event: t
|
|
162
174
|
})
|
|
163
|
-
}),
|
|
164
|
-
if (!n || !
|
|
175
|
+
}), a(() => {
|
|
176
|
+
if (!n || !r || !d || m) return;
|
|
165
177
|
let e = new AbortController();
|
|
166
178
|
return document.addEventListener("pointerdown", (e) => {
|
|
167
|
-
|
|
179
|
+
i(e, [f]) || i(e, [n]) && !j(n, e) || c(!1, {
|
|
168
180
|
reason: "outside-pointer",
|
|
169
181
|
event: e
|
|
170
182
|
});
|
|
@@ -174,38 +186,38 @@ function D(e) {
|
|
|
174
186
|
}), () => e.abort();
|
|
175
187
|
}, [
|
|
176
188
|
n,
|
|
177
|
-
|
|
189
|
+
r,
|
|
178
190
|
d,
|
|
179
191
|
m,
|
|
180
192
|
f,
|
|
181
193
|
c
|
|
182
194
|
]);
|
|
183
195
|
}
|
|
184
|
-
function
|
|
196
|
+
function j(e, t) {
|
|
185
197
|
let n = e.getBoundingClientRect();
|
|
186
198
|
return t.clientX < n.left || t.clientX > n.right || t.clientY < n.top || t.clientY > n.bottom;
|
|
187
199
|
}
|
|
188
|
-
function
|
|
189
|
-
let t =
|
|
190
|
-
return
|
|
200
|
+
function M(e) {
|
|
201
|
+
let t = E("Dialog.Title");
|
|
202
|
+
return a(() => t.register("title"), [t]), /* @__PURE__ */ x(f, {
|
|
191
203
|
id: t.titleId,
|
|
192
204
|
component: "dialog.title",
|
|
193
205
|
...e
|
|
194
206
|
});
|
|
195
207
|
}
|
|
196
|
-
function
|
|
197
|
-
let t =
|
|
198
|
-
return
|
|
208
|
+
function N(e) {
|
|
209
|
+
let t = E("Dialog.Description");
|
|
210
|
+
return a(() => t.register("description"), [t]), /* @__PURE__ */ x(p, {
|
|
199
211
|
id: t.descriptionId,
|
|
200
212
|
component: "dialog.description",
|
|
201
213
|
...e
|
|
202
214
|
});
|
|
203
215
|
}
|
|
204
|
-
|
|
205
|
-
var
|
|
206
|
-
Title:
|
|
207
|
-
Description:
|
|
208
|
-
},
|
|
209
|
-
|
|
216
|
+
M.displayName = "Dialog.Title", N.displayName = "Dialog.Description";
|
|
217
|
+
var P = {
|
|
218
|
+
Title: M,
|
|
219
|
+
Description: N
|
|
220
|
+
}, F = Object.assign(D, P), I = Object.assign(O, P);
|
|
221
|
+
D.displayName = "Dialog", O.displayName = "AlertDialog";
|
|
210
222
|
//#endregion
|
|
211
|
-
export {
|
|
223
|
+
export { I as AlertDialog, F 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("../client.cjs"),t=require("../platform.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=e.
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../client.cjs"),t=require("../platform.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=e.t(!T),O=i.t({side:d,align:f,offset:p,flip:m,matchWidth:v,anchor:g??b,trackSide:!!h});n.n(()=>{let e=E.current;!T||!t.o()||!e||!e.isConnected||e.matches(`:popover-open`)||e.showPopover()}),n.n(()=>{if(T)return;let e=t.l(g)??b;C(!!e&&t.d(e))},[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