@box-kite/react 2.2.4 → 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 +11 -1
- package/.claude/skills/box-kite/SKILL.md +11 -1
- package/.claude/skills/box-kite/references/components.md +83 -3
- package/.cursor/rules/box-kite.mdc +11 -1
- package/AGENTS.md +11 -1
- package/BOX_AI_CONTEXT.md +371 -25
- package/BOX_KITE_AI_CONTEXT.md +371 -25
- package/behavior.cjs +1 -1
- package/behavior.mjs +57 -57
- package/box.cjs +1 -1
- package/box.d.ts +5 -0
- package/box.mjs +15 -15
- package/catalog.cjs +1 -1
- package/catalog.mjs +906 -0
- package/client.cjs +1 -1
- package/client.mjs +94 -80
- package/components/calendar.cjs +1 -0
- package/components/calendar.d.ts +77 -0
- package/components/calendar.mjs +483 -0
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- 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/components/dataGridList.d.ts +12 -0
- package/components/dataGrid/components/dataGridListAggregate.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilter.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilterSheet.d.ts +11 -0
- package/components/dataGrid/components/dataGridListFooter.d.ts +13 -0
- package/components/dataGrid/components/dataGridListGroup.d.ts +13 -0
- package/components/dataGrid/components/dataGridListItem.d.ts +21 -0
- package/components/dataGrid/components/dataGridListLayout.d.ts +20 -0
- package/components/dataGrid/components/dataGridListRecord.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSelectionBar.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSheet.d.ts +30 -0
- package/components/dataGrid/components/dataGridListSortSheet.d.ts +10 -0
- package/components/dataGrid/components/dataGridListToolbar.d.ts +10 -0
- package/components/dataGrid/components/dataGridListValue.d.ts +12 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +70 -11
- package/components/dataGrid/models/columnModel.d.ts +3 -1
- package/components/dataGrid/models/editModel.d.ts +3 -1
- package/components/dataGrid/models/gridModel.d.ts +3 -0
- package/components/dataGrid/models/listModel.d.ts +129 -0
- package/components/dataGrid/models/localeText.d.ts +36 -0
- package/components/dataGrid/models/viewportModel.d.ts +0 -2
- package/components/dataGrid/useDateParts.d.ts +17 -0
- package/components/dataGrid/useListLayout.d.ts +13 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1251 -854
- 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 +29 -29
- package/components/list/listItemParts.d.ts +9 -0
- package/components/list.cjs +1 -0
- package/components/list.d.ts +118 -0
- package/components/list.mjs +391 -0
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +25 -25
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +12 -12
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -0
- package/components/sortableList.d.ts +49 -0
- package/components/sortableList.mjs +384 -0
- package/components/swipeItem.cjs +1 -0
- package/components/swipeItem.d.ts +52 -0
- package/components/swipeItem.mjs +321 -0
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- 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 +24 -24
- package/components/virtualList.cjs +1 -0
- package/components/virtualList.d.ts +32 -0
- package/components/virtualList.mjs +188 -0
- package/dataGridDateParts.cjs +1 -0
- package/dataGridDateParts.mjs +223 -0
- package/dataGridList.cjs +1 -0
- package/dataGridList.mjs +1314 -0
- 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 +10 -1
- package/icons/closeIcon.d.ts +2 -0
- package/icons/filterIcon.d.ts +2 -0
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/mcp/src/data.d.ts +2 -0
- package/package.json +178 -22
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +4 -1
- package/react/a11y/useControllableState.d.ts +2 -1
- package/react/boxComponent.d.ts +1 -1
- package/react/componentsContext.d.ts +4 -0
- package/react/componentsProvider.d.ts +10 -0
- package/react/date/dateChange.d.ts +18 -0
- package/react/date/dateEnvironment.d.ts +34 -0
- package/react/resolveStyles.d.ts +2 -1
- package/react/theme/theme.d.ts +6 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +6 -6
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +3 -1
- package/registry/designs/store/address-form.d.ts +11 -0
- package/registry/designs/store/cart-items.d.ts +10 -0
- package/registry/designs/store/cart-page.d.ts +4 -0
- package/registry/designs/store/checkout-page.d.ts +7 -0
- package/registry/designs/store/credit-card-form.d.ts +10 -0
- package/registry/designs/store/form-field.d.ts +19 -0
- package/registry/designs/store/order-summary.d.ts +18 -0
- package/registry/designs/store/product-art.d.ts +26 -0
- package/registry/designs/store/product-card.d.ts +11 -0
- package/registry/designs/store/product-gallery.d.ts +11 -0
- package/registry/designs/store/product-grid.d.ts +10 -0
- package/registry/designs/store/product-page.d.ts +5 -0
- package/registry/designs/store/quantity-stepper.d.ts +13 -0
- package/registry/designs/store/shipping-method.d.ts +14 -0
- package/registry/designs/store/store-data.d.ts +53 -0
- package/registry/designs/store/store-design.d.ts +63 -0
- package/registry/designs/store/store-shell.d.ts +12 -0
- package/registry/designs/store/storefront-page.d.ts +4 -0
- package/registry/designs/store/variant-picker.d.ts +15 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +2 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -0
- package/scrolling.mjs +22 -0
- 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/utils/scroll/scrollUtils.d.ts +6 -0
- package/utils/sortable/sortableUtils.d.ts +25 -0
- package/utils/swipe/swipeUtils.d.ts +53 -0
- package/utils/virtual/measuredWindow.d.ts +28 -0
- package/utils/virtual/rowSearch.d.ts +11 -0
package/behavior.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as e,
|
|
1
|
+
import { c as e, d as t, l as n, t as r, u as i } from "./platform.mjs";
|
|
2
2
|
import { n as a } from "./effects.mjs";
|
|
3
3
|
import { t as o } from "./keyboard.mjs";
|
|
4
4
|
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
@@ -33,24 +33,24 @@ function g() {
|
|
|
33
33
|
let e = m.filter((e) => !m.some((t) => t !== e && h(e, t)));
|
|
34
34
|
return e[e.length - 1];
|
|
35
35
|
}
|
|
36
|
-
function _(
|
|
37
|
-
let { enabled:
|
|
36
|
+
function _(t) {
|
|
37
|
+
let { enabled: n = !0, onDismiss: r, inside: o, escapeKey: s = !0, outsidePointer: c = !0 } = t, l = d(o), u = f(r);
|
|
38
38
|
a(() => {
|
|
39
|
-
if (!
|
|
40
|
-
let
|
|
41
|
-
m.push(
|
|
42
|
-
let
|
|
43
|
-
return s && a("keydown", (
|
|
44
|
-
|
|
39
|
+
if (!n) return;
|
|
40
|
+
let t = { elements: () => (l.current ?? []).map((t) => e(t)).filter((e) => e !== null) };
|
|
41
|
+
m.push(t);
|
|
42
|
+
let r = new AbortController(), a = (e, t) => document.addEventListener(e, t, { signal: r.signal });
|
|
43
|
+
return s && a("keydown", (e) => {
|
|
44
|
+
e.key !== "Escape" || e.defaultPrevented || g() === t && u("escape", e);
|
|
45
45
|
}), c && a("pointerdown", (e) => {
|
|
46
|
-
|
|
46
|
+
i(e, l.current ?? []) || u("outside-pointer", e);
|
|
47
47
|
}), () => {
|
|
48
|
-
|
|
49
|
-
let
|
|
50
|
-
|
|
48
|
+
r.abort();
|
|
49
|
+
let e = m.indexOf(t);
|
|
50
|
+
e !== -1 && m.splice(e, 1);
|
|
51
51
|
};
|
|
52
52
|
}, [
|
|
53
|
-
|
|
53
|
+
n,
|
|
54
54
|
s,
|
|
55
55
|
c,
|
|
56
56
|
u,
|
|
@@ -63,18 +63,18 @@ function v() {
|
|
|
63
63
|
let e = r()?.activeElement;
|
|
64
64
|
return e && e !== document.body ? e : null;
|
|
65
65
|
}
|
|
66
|
-
function y(
|
|
67
|
-
let { enabled:
|
|
68
|
-
|
|
66
|
+
function y(e = {}) {
|
|
67
|
+
let { enabled: t = !0, returnTo: r, preventScroll: i } = e, [a, o] = u(null), [s, l] = u(!1);
|
|
68
|
+
t !== s && (l(t), t && o(v()));
|
|
69
69
|
let d = f(() => {
|
|
70
|
-
(
|
|
70
|
+
(n(r) ?? a)?.focus({ preventScroll: i });
|
|
71
71
|
});
|
|
72
72
|
return c(() => {
|
|
73
|
-
if (
|
|
73
|
+
if (t) return () => {
|
|
74
74
|
let e = document.activeElement;
|
|
75
75
|
(!e || e === document.body || !document.contains(e)) && d();
|
|
76
76
|
};
|
|
77
|
-
}, [
|
|
77
|
+
}, [t, d]), { returnFocus: d };
|
|
78
78
|
}
|
|
79
79
|
//#endregion
|
|
80
80
|
//#region src/react/a11y/useRovingFocus.ts
|
|
@@ -98,18 +98,18 @@ function C(e, t, n) {
|
|
|
98
98
|
return S(e === 1 ? -1 : t, e, t, !1, n);
|
|
99
99
|
}
|
|
100
100
|
function w(e) {
|
|
101
|
-
let { count:
|
|
101
|
+
let { count: n, columns: r, columnIndexOf: i, pageSize: a = b, defaultActiveColumn: c = 0, onActiveCellChange: f, orientation: m = "vertical", loop: h = !0, activeIndex: g, defaultActiveIndex: _ = 0, onActiveIndexChange: v, isDisabled: y, textOf: w, focusItems: T = !0, onSelect: E } = e, [D, O] = p({
|
|
102
102
|
value: g,
|
|
103
103
|
defaultValue: _,
|
|
104
104
|
onChange: v
|
|
105
|
-
}), k = Math.min(D,
|
|
105
|
+
}), k = Math.min(D, n - 1), A = r !== void 0, j = s((e) => typeof r == "function" ? r(e) : r ?? 0, [r]), M = s((e, t) => {
|
|
106
106
|
let n = j(e);
|
|
107
|
-
if (!
|
|
107
|
+
if (!i) return x(t, n - 1);
|
|
108
108
|
if (n <= 0) return -1;
|
|
109
|
-
let
|
|
110
|
-
for (;
|
|
111
|
-
return
|
|
112
|
-
}, [
|
|
109
|
+
let r = 0;
|
|
110
|
+
for (; r + 1 < n && i(e, r + 1) <= t;) r++;
|
|
111
|
+
return r;
|
|
112
|
+
}, [i, j]), [N, P] = u(c), F = A && k >= 0 ? M(k, N) : -1, I = l([]), L = l(/* @__PURE__ */ new Map()), R = l(/* @__PURE__ */ new Map()), z = l(/* @__PURE__ */ new Map()), B = l({
|
|
113
113
|
query: "",
|
|
114
114
|
at: 0
|
|
115
115
|
}), V = s((e) => {
|
|
@@ -123,8 +123,8 @@ function w(e) {
|
|
|
123
123
|
]), G = d({
|
|
124
124
|
row: k,
|
|
125
125
|
column: F
|
|
126
|
-
}), K = d(N), q = d(f), J = d(j), Y = d(M), X = d(
|
|
127
|
-
let i = x(e,
|
|
126
|
+
}), K = d(N), q = d(f), J = d(j), Y = d(M), X = d(i), Z = s((e, t, r) => {
|
|
127
|
+
let i = x(e, n - 1), a = Math.max(0, t), o = i < 0 ? -1 : Y.current(i, a), s = G.current;
|
|
128
128
|
return i === s.row && o === s.column ? s : (O(i, r), P(a), q.current?.({
|
|
129
129
|
row: i,
|
|
130
130
|
column: o
|
|
@@ -136,14 +136,14 @@ function w(e) {
|
|
|
136
136
|
G,
|
|
137
137
|
Y,
|
|
138
138
|
q,
|
|
139
|
-
|
|
139
|
+
n,
|
|
140
140
|
O
|
|
141
|
-
]), Q = s((e,
|
|
142
|
-
let i = x(e,
|
|
141
|
+
]), Q = s((e, t, r) => {
|
|
142
|
+
let i = x(e, n - 1), a = i < 0 ? -1 : x(Math.max(0, t), J.current(i) - 1);
|
|
143
143
|
return Z(i, a < 0 ? 0 : X.current?.(i, a) ?? a, r);
|
|
144
144
|
}, [
|
|
145
145
|
X,
|
|
146
|
-
|
|
146
|
+
n,
|
|
147
147
|
Z,
|
|
148
148
|
J
|
|
149
149
|
]), ee = s((e, t) => {
|
|
@@ -172,7 +172,7 @@ function w(e) {
|
|
|
172
172
|
T,
|
|
173
173
|
O
|
|
174
174
|
]), $ = s((e) => {
|
|
175
|
-
let { row:
|
|
175
|
+
let { row: r, column: i } = G.current, o = (t, n) => {
|
|
176
176
|
e.preventDefault();
|
|
177
177
|
let r = Q(t, n, {
|
|
178
178
|
reason: "keyboard",
|
|
@@ -186,20 +186,20 @@ function w(e) {
|
|
|
186
186
|
event: e
|
|
187
187
|
});
|
|
188
188
|
T && U(n.row, n.column);
|
|
189
|
-
}, c = 2 ** 53 - 1, l = () =>
|
|
189
|
+
}, c = 2 ** 53 - 1, l = () => t(e.currentTarget) ? -1 : 1;
|
|
190
190
|
switch (e.key) {
|
|
191
|
-
case "ArrowRight": return o(
|
|
192
|
-
case "ArrowLeft": return o(
|
|
193
|
-
case "ArrowDown": return s(
|
|
194
|
-
case "ArrowUp": return s(
|
|
195
|
-
case "Home": return e.ctrlKey || e.metaKey ? o(0, 0) : o(
|
|
196
|
-
case "End": return e.ctrlKey || e.metaKey ? o(
|
|
197
|
-
case "PageDown": return s(
|
|
198
|
-
case "PageUp": return s(
|
|
191
|
+
case "ArrowRight": return o(r, i + l());
|
|
192
|
+
case "ArrowLeft": return o(r, i - l());
|
|
193
|
+
case "ArrowDown": return s(r + 1);
|
|
194
|
+
case "ArrowUp": return s(r - 1);
|
|
195
|
+
case "Home": return e.ctrlKey || e.metaKey ? o(0, 0) : o(r, 0);
|
|
196
|
+
case "End": return e.ctrlKey || e.metaKey ? o(n - 1, c) : o(r, c);
|
|
197
|
+
case "PageDown": return s(r + a);
|
|
198
|
+
case "PageUp": return s(r - a);
|
|
199
199
|
}
|
|
200
200
|
}, [
|
|
201
201
|
G,
|
|
202
|
-
|
|
202
|
+
n,
|
|
203
203
|
K,
|
|
204
204
|
U,
|
|
205
205
|
T,
|
|
@@ -218,31 +218,31 @@ function w(e) {
|
|
|
218
218
|
$(e);
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
|
-
let
|
|
221
|
+
let r = m !== "horizontal", i = m !== "vertical", a = B.current, s = o.isOpen(a, e.timeStamp), c = (t, n) => {
|
|
222
222
|
t !== -1 && t !== k && (e.preventDefault(), O(t, {
|
|
223
223
|
reason: n,
|
|
224
224
|
event: e
|
|
225
225
|
}), T && V(t));
|
|
226
226
|
};
|
|
227
|
-
if (
|
|
228
|
-
let
|
|
229
|
-
c(S(k,
|
|
227
|
+
if (i && (e.key === "ArrowRight" || e.key === "ArrowLeft")) {
|
|
228
|
+
let r = e.key === "ArrowRight" !== t(e.currentTarget);
|
|
229
|
+
c(S(k, r ? 1 : -1, n, h, y), "keyboard");
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
|
-
if (e.key === "ArrowDown" &&
|
|
233
|
-
c(S(k, 1,
|
|
232
|
+
if (e.key === "ArrowDown" && r) {
|
|
233
|
+
c(S(k, 1, n, h, y), "keyboard");
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
|
-
if (e.key === "ArrowUp" &&
|
|
237
|
-
c(S(k, -1,
|
|
236
|
+
if (e.key === "ArrowUp" && r) {
|
|
237
|
+
c(S(k, -1, n, h, y), "keyboard");
|
|
238
238
|
return;
|
|
239
239
|
}
|
|
240
240
|
if (e.key === "Home") {
|
|
241
|
-
c(C(1,
|
|
241
|
+
c(C(1, n, y), "keyboard");
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
if (e.key === "End") {
|
|
245
|
-
c(C(-1,
|
|
245
|
+
c(C(-1, n, y), "keyboard");
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
if (e.key === "Enter" || e.key === " " && !(s && w)) {
|
|
@@ -251,12 +251,12 @@ function w(e) {
|
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
if (w && o.isPrintable(e)) {
|
|
254
|
-
let
|
|
255
|
-
c(o.target(
|
|
254
|
+
let t = o.push(a, e.key, e.timeStamp);
|
|
255
|
+
c(o.target(t, k, n, w, y), "typeahead");
|
|
256
256
|
}
|
|
257
257
|
}, [
|
|
258
258
|
k,
|
|
259
|
-
|
|
259
|
+
n,
|
|
260
260
|
V,
|
|
261
261
|
T,
|
|
262
262
|
y,
|
package/box.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime.cjs"),t=require("./react-shared.cjs"),n=require("./client.cjs");let r=require("react");r=e.t(r,1);let i=require("@box-kite/core");function a({tag:e,tagProps:t,render:n}){let[i,a]=(0,r.useState)(!1);return r.default.createElement(e,{...t,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},n({isHover:i}))}function o(e,i){let{tag:o=`div`,children:s}=e,{classNames:c,styleElements:l}=n.i(e,o===`svg`),u=t.d(e,c);i&&(u.ref=i);let d=typeof s==`function`?r.default.createElement(a,{tag:o,tagProps:u,render:s}):r.default.createElement(o,u,s);return l?r.default.createElement(r.default.Fragment,null,l,d):d}var s=t.f(o,`Box`);s.extend=i.BoxExtends.extend,s.components=i.BoxExtends.components,s.keyframes=i.BoxExtends.keyframes,s.spring=i.Springs.spring,s.Theme=n.n,s.useTheme=n.n.useTheme,s.getVariableValue=e=>(0,i.getDefaultEngine)().getVariableValue(e),s.configure=n.r.configure,s.viewTransition=i.startViewTransition;function c(e,r){return t.p(n.i(e,r?.svg===!0),e.className)}exports.default=s,exports.useBoxElement=o,exports.useClassNames=c,exports.useVisibility=n.a;
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime.cjs"),t=require("./react-shared.cjs"),n=require("./client.cjs");let r=require("react");r=e.t(r,1);let i=require("@box-kite/core");function a({tag:e,tagProps:t,render:n}){let[i,a]=(0,r.useState)(!1);return r.default.createElement(e,{...t,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1)},n({isHover:i}))}function o(e,i){let{tag:o=`div`,children:s}=e,{classNames:c,styleElements:l}=n.i(e,o===`svg`),u=t.d(e,c);i&&(u.ref=i);let d=typeof s==`function`?r.default.createElement(a,{tag:o,tagProps:u,render:s}):r.default.createElement(o,u,s);return l?r.default.createElement(r.default.Fragment,null,l,d):d}var s=t.f(o,`Box`);s.extend=i.BoxExtends.extend,s.components=i.BoxExtends.components,s.createComponents=i.BoxExtends.createComponents,s.Components=n.o,s.keyframes=i.BoxExtends.keyframes,s.spring=i.Springs.spring,s.Theme=n.n,s.useTheme=n.n.useTheme,s.getVariableValue=e=>(0,i.getDefaultEngine)().getVariableValue(e),s.configure=n.r.configure,s.viewTransition=i.startViewTransition;function c(e,r){return t.p(n.i(e,r?.svg===!0),e.className)}exports.default=s,exports.useBoxElement=o,exports.useClassNames=c,exports.useVisibility=n.a;
|
package/box.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { default as React, Ref, RefAttributes } from 'react';
|
|
|
2
2
|
import { BoxExtends, Springs, startViewTransition } from '@box-kite/core';
|
|
3
3
|
import { BoxClassNames } from './react/boxClassNames';
|
|
4
4
|
import { BoxClassNameProps, BoxCoreProps } from './react/boxProps';
|
|
5
|
+
import { default as Components } from './react/componentsProvider';
|
|
5
6
|
import { default as useVisibility } from './react/hooks/useVisibility';
|
|
6
7
|
import { ExtractElementFromTag } from './react/reactTypes';
|
|
7
8
|
import { default as Theme } from './react/theme/theme';
|
|
@@ -20,6 +21,10 @@ interface BoxType {
|
|
|
20
21
|
<TTag extends keyof React.JSX.IntrinsicElements = 'div', TKey extends keyof ComponentsAndVariants = never>(props: BoxCoreProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>): React.ReactNode;
|
|
21
22
|
extend: typeof BoxExtends.extend;
|
|
22
23
|
components: typeof BoxExtends.components;
|
|
24
|
+
/** A design for one subtree, registered nowhere: hand it to `<Box.Components value>` or `<Box.Theme components>`. */
|
|
25
|
+
createComponents: typeof BoxExtends.createComponents;
|
|
26
|
+
/** Every Box below resolves its `component` against this registry instead of the app's `Box.components()`. */
|
|
27
|
+
Components: typeof Components;
|
|
23
28
|
keyframes: typeof BoxExtends.keyframes;
|
|
24
29
|
/** A spring of your own, sampled into `{ easing, duration }` — the two halves the timing and duration props take. */
|
|
25
30
|
spring: typeof Springs.spring;
|
package/box.mjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { d as e, f as t, p as n } from "./react-shared.mjs";
|
|
2
|
-
import { a as r, i, n as a, r as
|
|
3
|
-
import
|
|
4
|
-
import { BoxExtends as
|
|
2
|
+
import { a as r, i, n as a, o, r as s } from "./client.mjs";
|
|
3
|
+
import c, { useState as l } from "react";
|
|
4
|
+
import { BoxExtends as u, Springs as d, getDefaultEngine as f, startViewTransition as p } from "@box-kite/core";
|
|
5
5
|
//#region src/box.ts
|
|
6
|
-
function
|
|
7
|
-
let [r, i] =
|
|
8
|
-
return
|
|
6
|
+
function m({ tag: e, tagProps: t, render: n }) {
|
|
7
|
+
let [r, i] = l(!1);
|
|
8
|
+
return c.createElement(e, {
|
|
9
9
|
...t,
|
|
10
10
|
onMouseEnter: () => i(!0),
|
|
11
11
|
onMouseLeave: () => i(!1)
|
|
12
12
|
}, n({ isHover: r }));
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
let { tag: r = "div", children: a } = t, { classNames: o, styleElements:
|
|
14
|
+
function h(t, n) {
|
|
15
|
+
let { tag: r = "div", children: a } = t, { classNames: o, styleElements: s } = i(t, r === "svg"), l = e(t, o);
|
|
16
16
|
n && (l.ref = n);
|
|
17
|
-
let u = typeof a == "function" ?
|
|
17
|
+
let u = typeof a == "function" ? c.createElement(m, {
|
|
18
18
|
tag: r,
|
|
19
19
|
tagProps: l,
|
|
20
20
|
render: a
|
|
21
|
-
}) :
|
|
22
|
-
return
|
|
21
|
+
}) : c.createElement(r, l, a);
|
|
22
|
+
return s ? c.createElement(c.Fragment, null, s, u) : u;
|
|
23
23
|
}
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
function
|
|
24
|
+
var g = t(h, "Box");
|
|
25
|
+
g.extend = u.extend, g.components = u.components, g.createComponents = u.createComponents, g.Components = o, g.keyframes = u.keyframes, g.spring = d.spring, g.Theme = a, g.useTheme = a.useTheme, g.getVariableValue = (e) => f().getVariableValue(e), g.configure = s.configure, g.viewTransition = p;
|
|
26
|
+
function _(e, t) {
|
|
27
27
|
return n(i(e, t?.svg === !0), e.className);
|
|
28
28
|
}
|
|
29
29
|
//#endregion
|
|
30
|
-
export {
|
|
30
|
+
export { g as default, h as useBoxElement, _ as useClassNames, r as useVisibility };
|