@box-kite/react 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/.claude/rules/box-kite-rules.md +8 -2
  2. package/.claude/skills/box-kite/SKILL.md +11 -5
  3. package/.claude/skills/box-kite/references/patterns.md +1 -1
  4. package/.claude/skills/box-kite/references/styling.md +23 -0
  5. package/.cursor/rules/box-kite.mdc +9 -3
  6. package/AGENTS.md +9 -3
  7. package/BOX_AI_CONTEXT.md +171 -12
  8. package/BOX_KITE_AI_CONTEXT.md +171 -12
  9. package/README.md +2 -2
  10. package/box.cjs +1 -1
  11. package/box.d.ts +13 -2
  12. package/box.mjs +25 -18
  13. package/catalog.cjs +1 -1
  14. package/catalog.mjs +15 -1
  15. package/client.cjs +1 -1
  16. package/client.mjs +59 -51
  17. package/components/button.cjs +1 -1
  18. package/components/button.mjs +10 -14
  19. package/components/flex.cjs +1 -1
  20. package/components/flex.mjs +10 -13
  21. package/components/form.cjs +1 -1
  22. package/components/form.mjs +7 -7
  23. package/components/grid.cjs +1 -1
  24. package/components/grid.mjs +10 -13
  25. package/components/menu.cjs +1 -1
  26. package/components/menu.mjs +16 -16
  27. package/components/overlay.cjs +1 -1
  28. package/components/overlay.mjs +35 -34
  29. package/components/popover.cjs +1 -1
  30. package/components/popover.mjs +4 -4
  31. package/components/semantics.cjs +1 -1
  32. package/components/semantics.mjs +9 -13
  33. package/components/svg.cjs +1 -1
  34. package/components/svg.mjs +38 -44
  35. package/components/textarea.cjs +1 -1
  36. package/components/textarea.mjs +12 -16
  37. package/components/textbox.cjs +1 -1
  38. package/components/textbox.mjs +12 -16
  39. package/components/toaster.cjs +1 -1
  40. package/components/toaster.mjs +42 -43
  41. package/components/visuallyHidden.cjs +1 -1
  42. package/components/visuallyHidden.mjs +10 -13
  43. package/docs/mcp.md +6 -5
  44. package/docs/props.md +132 -20
  45. package/layer.cjs +1 -1
  46. package/layer.mjs +61 -59
  47. package/mcp/src/data.d.ts +1 -1
  48. package/mcp/src/styles.d.ts +2 -2
  49. package/mcp/src/vocabulary.d.ts +1 -1
  50. package/package.json +74 -48
  51. package/react/boxComponent.d.ts +10 -0
  52. package/react/popover/useTopLayer.d.ts +17 -0
  53. package/react/theme/theme.d.ts +10 -0
  54. package/react/useStyles.d.ts +2 -0
  55. package/react-shared.cjs +1 -1
  56. package/react-shared.mjs +44 -37
  57. package/rsc.cjs +1 -1
  58. package/rsc.d.ts +11 -1
  59. package/rsc.mjs +15 -12
  60. package/ssg.cjs +1 -1
  61. package/ssg.d.ts +8 -2
  62. package/ssg.mjs +13 -9
  63. package/utils/environment/environmentUtils.d.ts +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box-kite/react",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "pages/**"
@@ -96,7 +96,7 @@
96
96
  "check:conventions": "node scripts/check-component-conventions.mjs",
97
97
  "check:agents": "node scripts/check-agent-files.mjs",
98
98
  "docs:agents": "node scripts/check-agent-files.mjs --fix",
99
- "check:package": "publint dist && attw --pack dist --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error && publint dist-core && attw --pack dist-core --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error",
99
+ "check:package": "publint dist && attw --pack dist --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error && publint dist-core && attw --pack dist-core --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error && publint dist-mcp",
100
100
  "bench": "node bench/run.mjs",
101
101
  "compare": "node dev/compare/report.mjs",
102
102
  "compare:tailwind": "node dev/compare/report.mjs tailwind",
@@ -112,27 +112,30 @@
112
112
  "path": "dist/box.mjs",
113
113
  "ignore": [
114
114
  "react",
115
- "react-dom"
115
+ "react-dom",
116
+ "./diagnostics-*"
116
117
  ],
117
118
  "gzip": true,
118
- "limit": "32.63 KB"
119
+ "limit": "36.28 KB"
119
120
  },
120
121
  {
121
122
  "name": "Box in a Server Component (react-server entry)",
122
123
  "path": "dist/rsc.mjs",
123
124
  "ignore": [
124
125
  "react",
125
- "react-dom"
126
+ "react-dom",
127
+ "./diagnostics-*"
126
128
  ],
127
129
  "gzip": true,
128
- "limit": "31.17 KB"
130
+ "limit": "34.69 KB"
129
131
  },
130
132
  {
131
133
  "name": "Behavior primitives (a11y entry)",
132
134
  "path": "dist/a11y.mjs",
133
135
  "ignore": [
134
136
  "react",
135
- "react-dom"
137
+ "react-dom",
138
+ "./diagnostics-*"
136
139
  ],
137
140
  "gzip": true,
138
141
  "limit": "3.2 KB"
@@ -142,7 +145,8 @@
142
145
  "path": "dist/anchor.mjs",
143
146
  "ignore": [
144
147
  "react",
145
- "react-dom"
148
+ "react-dom",
149
+ "./diagnostics-*"
146
150
  ],
147
151
  "gzip": true,
148
152
  "limit": "2.25 KB"
@@ -152,17 +156,19 @@
152
156
  "path": "dist/catalog.mjs",
153
157
  "ignore": [
154
158
  "react",
155
- "react-dom"
159
+ "react-dom",
160
+ "./diagnostics-*"
156
161
  ],
157
162
  "gzip": true,
158
- "limit": "50.72 KB"
163
+ "limit": "54.73 KB"
159
164
  },
160
165
  {
161
166
  "name": "Spec renderer (spec entry)",
162
167
  "path": "dist/spec.mjs",
163
168
  "ignore": [
164
169
  "react",
165
- "react-dom"
170
+ "react-dom",
171
+ "./diagnostics-*"
166
172
  ],
167
173
  "gzip": true,
168
174
  "limit": "4.7 KB"
@@ -172,7 +178,8 @@
172
178
  "path": "dist/interop.mjs",
173
179
  "ignore": [
174
180
  "react",
175
- "react-dom"
181
+ "react-dom",
182
+ "./diagnostics-*"
176
183
  ],
177
184
  "gzip": true,
178
185
  "limit": "4 KB"
@@ -181,154 +188,172 @@
181
188
  "name": "Core engine (@box-kite/core, no React)",
182
189
  "path": "dist-core/core.mjs",
183
190
  "gzip": true,
184
- "limit": "31.96 KB"
191
+ "limit": "35.73 KB",
192
+ "ignore": [
193
+ "./diagnostics-*"
194
+ ]
185
195
  },
186
196
  {
187
197
  "name": "Dialog",
188
198
  "path": "dist/components/dialog.mjs",
189
199
  "ignore": [
190
200
  "react",
191
- "react-dom"
201
+ "react-dom",
202
+ "./diagnostics-*"
192
203
  ],
193
204
  "gzip": true,
194
- "limit": "34.76 KB"
205
+ "limit": "38.35 KB"
195
206
  },
196
207
  {
197
208
  "name": "Popover",
198
209
  "path": "dist/components/popover.mjs",
199
210
  "ignore": [
200
211
  "react",
201
- "react-dom"
212
+ "react-dom",
213
+ "./diagnostics-*"
202
214
  ],
203
215
  "gzip": true,
204
- "limit": "36.24 KB"
216
+ "limit": "39.88 KB"
205
217
  },
206
218
  {
207
219
  "name": "Menu",
208
220
  "path": "dist/components/menu.mjs",
209
221
  "ignore": [
210
222
  "react",
211
- "react-dom"
223
+ "react-dom",
224
+ "./diagnostics-*"
212
225
  ],
213
226
  "gzip": true,
214
- "limit": "38.5 KB"
227
+ "limit": "42.15 KB"
215
228
  },
216
229
  {
217
230
  "name": "Accordion",
218
231
  "path": "dist/components/accordion.mjs",
219
232
  "ignore": [
220
233
  "react",
221
- "react-dom"
234
+ "react-dom",
235
+ "./diagnostics-*"
222
236
  ],
223
237
  "gzip": true,
224
- "limit": "33.96 KB"
238
+ "limit": "37.60 KB"
225
239
  },
226
240
  {
227
241
  "name": "Agent",
228
242
  "path": "dist/components/agent.mjs",
229
243
  "ignore": [
230
244
  "react",
231
- "react-dom"
245
+ "react-dom",
246
+ "./diagnostics-*"
232
247
  ],
233
248
  "gzip": true,
234
- "limit": "34.69 KB"
249
+ "limit": "38.34 KB"
235
250
  },
236
251
  {
237
252
  "name": "Markdown",
238
253
  "path": "dist/components/markdown.mjs",
239
254
  "ignore": [
240
255
  "react",
241
- "react-dom"
256
+ "react-dom",
257
+ "./diagnostics-*"
242
258
  ],
243
259
  "gzip": true,
244
- "limit": "33.24 KB"
260
+ "limit": "36.84 KB"
245
261
  },
246
262
  {
247
263
  "name": "Skeleton",
248
264
  "path": "dist/components/skeleton.mjs",
249
265
  "ignore": [
250
266
  "react",
251
- "react-dom"
267
+ "react-dom",
268
+ "./diagnostics-*"
252
269
  ],
253
270
  "gzip": true,
254
- "limit": "32.55 KB"
271
+ "limit": "36.17 KB"
255
272
  },
256
273
  {
257
274
  "name": "Tabs",
258
275
  "path": "dist/components/tabs.mjs",
259
276
  "ignore": [
260
277
  "react",
261
- "react-dom"
278
+ "react-dom",
279
+ "./diagnostics-*"
262
280
  ],
263
281
  "gzip": true,
264
- "limit": "35.2 KB"
282
+ "limit": "38.80 KB"
265
283
  },
266
284
  {
267
285
  "name": "Slider",
268
286
  "path": "dist/components/slider.mjs",
269
287
  "ignore": [
270
288
  "react",
271
- "react-dom"
289
+ "react-dom",
290
+ "./diagnostics-*"
272
291
  ],
273
292
  "gzip": true,
274
- "limit": "34.34 KB"
293
+ "limit": "37.95 KB"
275
294
  },
276
295
  {
277
296
  "name": "Progress",
278
297
  "path": "dist/components/progress.mjs",
279
298
  "ignore": [
280
299
  "react",
281
- "react-dom"
300
+ "react-dom",
301
+ "./diagnostics-*"
282
302
  ],
283
303
  "gzip": true,
284
- "limit": "32.51 KB"
304
+ "limit": "36.15 KB"
285
305
  },
286
306
  {
287
307
  "name": "Toaster",
288
308
  "path": "dist/components/toaster.mjs",
289
309
  "ignore": [
290
310
  "react",
291
- "react-dom"
311
+ "react-dom",
312
+ "./diagnostics-*"
292
313
  ],
293
314
  "gzip": true,
294
- "limit": "36.0 KB"
315
+ "limit": "39.62 KB"
295
316
  },
296
317
  {
297
318
  "name": "Combobox",
298
319
  "path": "dist/components/combobox.mjs",
299
320
  "ignore": [
300
321
  "react",
301
- "react-dom"
322
+ "react-dom",
323
+ "./diagnostics-*"
302
324
  ],
303
325
  "gzip": true,
304
- "limit": "41.73 KB"
326
+ "limit": "45.41 KB"
305
327
  },
306
328
  {
307
329
  "name": "Dashboard",
308
330
  "path": "dist/components/dashboard.mjs",
309
331
  "ignore": [
310
332
  "react",
311
- "react-dom"
333
+ "react-dom",
334
+ "./diagnostics-*"
312
335
  ],
313
336
  "gzip": true,
314
- "limit": "38.2 KB"
337
+ "limit": "41.80 KB"
315
338
  },
316
339
  {
317
340
  "name": "DataGrid",
318
341
  "path": "dist/components/dataGrid.mjs",
319
342
  "ignore": [
320
343
  "react",
321
- "react-dom"
344
+ "react-dom",
345
+ "./diagnostics-*"
322
346
  ],
323
347
  "gzip": true,
324
- "limit": "79.67 KB"
348
+ "limit": "83.18 KB"
325
349
  },
326
350
  {
327
351
  "name": "DataGrid export, the chunk fetched on the first press",
328
352
  "path": "dist/gridExport.mjs",
329
353
  "ignore": [
330
354
  "react",
331
- "react-dom"
355
+ "react-dom",
356
+ "./diagnostics-*"
332
357
  ],
333
358
  "gzip": true,
334
359
  "limit": "3.8 KB"
@@ -338,10 +363,11 @@
338
363
  "path": "dev/size-full.mjs",
339
364
  "ignore": [
340
365
  "react",
341
- "react-dom"
366
+ "react-dom",
367
+ "./diagnostics-*"
342
368
  ],
343
369
  "gzip": true,
344
- "limit": "111.25 KB"
370
+ "limit": "114.74 KB"
345
371
  }
346
372
  ],
347
373
  "repository": {
@@ -369,13 +395,13 @@
369
395
  "url": "https://github.com/box-kite/box-kite/issues"
370
396
  },
371
397
  "homepage": "https://www.box-kite.dev",
372
- "description": "One React component with 221 typed CSS props that generates atomic CSS at runtime — no CSS files, no build step, renders in a Server Component.",
398
+ "description": "One React component with 235 typed CSS props that generates atomic CSS at runtime — no CSS files, no build step, renders in a Server Component.",
373
399
  "peerDependencies": {
374
400
  "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
375
401
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
376
402
  },
377
403
  "dependencies": {
378
- "@box-kite/core": "2.1.0",
404
+ "@box-kite/core": "2.2.0",
379
405
  "csstype": "^3.2.3",
380
406
  "use-sync-external-store": "^1.6.0"
381
407
  },
@@ -390,6 +416,7 @@
390
416
  "@iconify/react": "^6.0.2",
391
417
  "@json-render/core": "^0.20.0",
392
418
  "@json-render/react": "^0.20.0",
419
+ "@lezer/javascript": "^1.5.5",
393
420
  "@modelcontextprotocol/sdk": "^1.30.0",
394
421
  "@mui/material": "^9.4.0",
395
422
  "@mui/x-data-grid": "^9.14.0",
@@ -403,7 +430,6 @@
403
430
  "@testing-library/react": "^16.3.2",
404
431
  "@testing-library/user-event": "^14.6.6",
405
432
  "@types/node": "^26.1.2",
406
- "@types/prismjs": "^1.26.6",
407
433
  "@types/react": "^19.2.18",
408
434
  "@types/react-dom": "^19.2.4",
409
435
  "@types/use-sync-external-store": "^1.5.0",
@@ -424,13 +450,13 @@
424
450
  "lucide-react": "^1.28.0",
425
451
  "marked": "^18.0.11",
426
452
  "prettier": "^3.9.6",
427
- "prismjs": "^1.30.0",
428
453
  "publint": "^0.3.24",
429
454
  "react": "^19.2.8",
430
455
  "react-dom": "^19.2.8",
431
456
  "react-router-dom": "^7.18.2",
432
457
  "recharts": "^3.10.1",
433
458
  "size-limit": "^13.0.3",
459
+ "sucrase": "^3.35.1",
434
460
  "typescript": "^6.0.3",
435
461
  "typescript-eslint": "^8.66.0",
436
462
  "unplugin-icons": "^23.0.1",
@@ -0,0 +1,10 @@
1
+ import { default as React, Ref } from 'react';
2
+ type Render = (props: any, ref: any) => React.ReactNode;
3
+ /**
4
+ * A component that is a Box: memoized, which skips a leaf whose props are all primitives, and one fiber on
5
+ * React 19. React 18 needs a `forwardRef` under the `memo`, which makes it two.
6
+ */
7
+ export default function boxComponent(render: Render, displayName: string): React.MemoExoticComponent<((props: {
8
+ ref?: Ref<unknown>;
9
+ }) => React.ReactNode) | React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<unknown>>>;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Whether a floating layer goes in the top layer or in a portal — and, which is the point of reading it
3
+ * through a store, *when* that is decided. Asking the browser directly during a server render answers
4
+ * false (there is no `HTMLElement`), so the portal branch is taken and renders nothing, while the client
5
+ * renders the layer: one React #418 per load for any layer that is open in server-rendered HTML (bug
6
+ * #197). The server snapshot is therefore the top-layer shape.
7
+ *
8
+ * React reads that snapshot only while hydrating, so the two paths — which are different *positions* in
9
+ * the React tree, and so a remount — cost one correction on exactly one path: a browser with no Popover
10
+ * API adopting HTML that already holds the layer, where nothing can have been focused inside it yet. A
11
+ * layer a browser mounts (a dropdown opening) reads the real answer on its first render and never moves,
12
+ * which is what B2 stage 2 fixed and what a `useState(true)` corrected in an effect gives up.
13
+ *
14
+ * The consequence for a caller: while hydrating, this says `true` in a browser that has no `showPopover`
15
+ * to call, so an effect that calls one asks `supportsPopover()` rather than trusting this.
16
+ */
17
+ export default function useTopLayer(): boolean;
@@ -12,6 +12,16 @@ interface ThemeProps {
12
12
  * `globalStyles={{ scrollbarColor: ['violet-500', 'transparent'], theme: { dark: { scrollbarColor: [...] } } }}`.
13
13
  */
14
14
  globalStyles?: BoxStyleProps;
15
+ /**
16
+ * Cross-fade the page when the theme changes, where the browser has view transitions. Off by default,
17
+ * because a transition is a decision about the app rather than about theming.
18
+ *
19
+ * It exists as a prop rather than a recipe because the recipe has a trap in it: `startViewTransition`
20
+ * screenshots the page the moment its callback returns, and a `setState` has not rendered by then — so
21
+ * a hand-rolled version captures the old theme twice and nothing appears to change. This flushes the
22
+ * update inside the callback. Reduced motion skips the transition and keeps the theme change.
23
+ */
24
+ viewTransition?: boolean;
15
25
  }
16
26
  /**
17
27
  * The React binding for the theme system. Everything that actually touches the platform — reading
@@ -15,6 +15,8 @@ export declare namespace StylesContext {
15
15
  function clear(): void;
16
16
  /** The CSS emitted so far, as text. Flushes first — see `StyleEngine.getStyles`. */
17
17
  function getStyles(): string;
18
+ /** The CSS as a `<style>` element the browser can adopt — see `StyleEngine.getStyleTag`. */
19
+ function getStyleTag(): string;
18
20
  /** The id of the `<style>` element the default engine writes to. */
19
21
  function styleElementId(): string;
20
22
  /** Apply explicit engine configuration. Call before the first render — cached class names are dropped when the configuration changes. */
package/react-shared.cjs CHANGED
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime.cjs");let t=require("react");t=e.t(t,1);let n=require("@box-kite/core");function r({classNames:e,styleElements:t},r){return{className:(0,n.classNames)(e,r).join(` `),styles:t}}var i={selected:`aria-selected`},a;(function(e){function t(e,t,n){e!==void 0&&e!=null&&(n[i[t]??t]=Array.isArray(e)?e[0]:e)}e.assignBooleanProp=t})(a||={});var o=a;function s(e,t){let r=e,{props:i,className:a,disabled:s,required:c,checked:l,selected:u}=r,d={...i,className:(0,n.classNames)(t,a).join(` `)};return o.assignBooleanProp(s,`disabled`,d),o.assignBooleanProp(c,`required`,d),o.assignBooleanProp(l,`checked`,d),o.assignBooleanProp(u,`selected`,d),`style`in r&&(d.style=r.style),`id`in r&&(d.id=r.id),d}var c=parseInt(t.default.version,10)>=19,l=!1;function u(e){if(e?.length)return!c&&!l&&(l=!0,console.warn(`[box-kite] Box.configure({ sink: 'element' }) needs React 19 to hoist and dedupe its <style> elements; React ${t.default.version} will render them inline. Use the default sink instead.`)),e.map(({href:e,css:n,precedence:r})=>t.default.createElement(`style`,{key:e,href:e,precedence:r,dangerouslySetInnerHTML:{__html:n}}))}function d(e,t){let{classNames:r,signature:i,styleElements:a}=(0,n.getDefaultEngine)().resolveClassNames(e,t);return{classNames:r,signature:i,styleElements:u(a)}}var f=`__boxAttributesInProps`;function p(e){return e[f]=!0,e}function m(e){return typeof e==`function`||typeof e==`object`&&e?e[f]===!0:!1}var h=[`role`,`aria-label`,`aria-labelledby`,`aria-hidden`];function g(e,t){if(e!==void 0)return{role:`img`,"aria-label":e};if(!(t&&h.some(e=>e in t)))return{"aria-hidden":!0}}var _;(function(e){function t(e){return e.charAt(0).toUpperCase()+e.slice(1)}e.capitalize=t})(_||={});var v=_,y;(function(e){function t(e,t,n){let r={...e},i=r.props||{};return t.forEach(e=>{e in r&&(i[e]=r[e],delete r[e])}),n&&Object.entries(n).forEach(([e,t])=>{i[e]=t}),r.props=i,r}e.buildProps=t;function n(e){return!!e&&typeof e==`object`}e.isObject=n;function r(e,t){return e in t}e.isKeyOf=r})(y||={});var b=y,x=[`sky-500`,`emerald-500`,`amber-500`,`violet-500`,`rose-500`,`cyan-500`],S=[`sky-400`,`emerald-400`,`amber-400`,`violet-400`,`rose-400`,`cyan-400`];function C(e){return e.reduce((e,t,n)=>(e[`chart-${n+1}`]=t,e),{})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return u}});
1
+ const e=require("./rolldown-runtime.cjs");let t=require("react");t=e.t(t,1);let n=require("@box-kite/core");function r({classNames:e,styleElements:t},r){return{className:(0,n.classNames)(e,r).join(` `),styles:t}}var i=parseInt(t.default.version,10)>=19;function a(e,n){let r=i?t=>e(t,t.ref??null):(0,t.forwardRef)(e),a=(0,t.memo)(r);return r.displayName=n,a.displayName=n,a}var o={selected:`aria-selected`},s;(function(e){function t(e,t,n){e!==void 0&&e!=null&&(n[o[t]??t]=Array.isArray(e)?e[0]:e)}e.assignBooleanProp=t})(s||={});var c=s;function l(e,t){let r=e,{props:i,className:a,disabled:o,required:s,checked:l,selected:u}=r,d={...i,className:(0,n.classNames)(t,a).join(` `)};return c.assignBooleanProp(o,`disabled`,d),c.assignBooleanProp(s,`required`,d),c.assignBooleanProp(l,`checked`,d),c.assignBooleanProp(u,`selected`,d),`style`in r&&(d.style=r.style),`id`in r&&(d.id=r.id),d}var u=parseInt(t.default.version,10)>=19,d=!1;function f(e){if(e?.length)return!u&&!d&&(d=!0,console.warn(`[box-kite] Box.configure({ sink: 'element' }) needs React 19 to hoist and dedupe its <style> elements; React ${t.default.version} will render them inline. Use the default sink instead.`)),e.map(({href:e,css:n,precedence:r})=>t.default.createElement(`style`,{key:e,href:e,precedence:r,dangerouslySetInnerHTML:{__html:n}}))}function p(e,t){let{classNames:r,signature:i,styleElements:a}=(0,n.getDefaultEngine)().resolveClassNames(e,t);return{classNames:r,signature:i,styleElements:f(a)}}var m=`__boxAttributesInProps`;function h(e){return e[m]=!0,e}function g(e){return typeof e==`function`||typeof e==`object`&&e?e[m]===!0:!1}var _=[`role`,`aria-label`,`aria-labelledby`,`aria-hidden`];function v(e,t){if(e!==void 0)return{role:`img`,"aria-label":e};if(!(t&&_.some(e=>e in t)))return{"aria-hidden":!0}}var y;(function(e){function t(e){return e.charAt(0).toUpperCase()+e.slice(1)}e.capitalize=t})(y||={});var b=y,x;(function(e){function t(e,t,n){let r={...e},i=r.props||{};return t.forEach(e=>{e in r&&(i[e]=r[e],delete r[e])}),n&&Object.entries(n).forEach(([e,t])=>{i[e]=t}),r.props=i,r}e.buildProps=t;function n(e){return!!e&&typeof e==`object`}e.isObject=n;function r(e,t){return e in t}e.isKeyOf=r})(x||={});var S=x,C=[`sky-500`,`emerald-500`,`amber-500`,`violet-500`,`rose-500`,`cyan-500`],w=[`sky-400`,`emerald-400`,`amber-400`,`violet-400`,`rose-400`,`cyan-400`];function T(e){return e.reduce((e,t,n)=>(e[`chart-${n+1}`]=t,e),{})}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return f}});
package/react-shared.mjs CHANGED
@@ -1,36 +1,43 @@
1
- import e from "react";
2
- import { classNames as t, getDefaultEngine as n } from "@box-kite/core";
1
+ import e, { forwardRef as t, memo as n } from "react";
2
+ import { classNames as r, getDefaultEngine as i } from "@box-kite/core";
3
3
  //#region src/react/boxClassNames.ts
4
- function r({ classNames: e, styleElements: n }, r) {
4
+ function a({ classNames: e, styleElements: t }, n) {
5
5
  return {
6
- className: t(e, r).join(" "),
7
- styles: n
6
+ className: r(e, n).join(" "),
7
+ styles: t
8
8
  };
9
9
  }
10
10
  //#endregion
11
+ //#region src/react/boxComponent.ts
12
+ var o = parseInt(e.version, 10) >= 19;
13
+ function s(e, r) {
14
+ let i = o ? (t) => e(t, t.ref ?? null) : t(e), a = n(i);
15
+ return i.displayName = r, a.displayName = r, a;
16
+ }
17
+ //#endregion
11
18
  //#region src/utils/box/boxUtils.ts
12
- var i = { selected: "aria-selected" }, a;
19
+ var c = { selected: "aria-selected" }, l;
13
20
  (function(e) {
14
21
  function t(e, t, n) {
15
- e !== void 0 && e != null && (n[i[t] ?? t] = Array.isArray(e) ? e[0] : e);
22
+ e !== void 0 && e != null && (n[c[t] ?? t] = Array.isArray(e) ? e[0] : e);
16
23
  }
17
24
  e.assignBooleanProp = t;
18
- })(a ||= {});
19
- var o = a;
25
+ })(l ||= {});
26
+ var u = l;
20
27
  //#endregion
21
28
  //#region src/react/boxTagProps.ts
22
- function s(e, n) {
23
- let r = e, { props: i, className: a, disabled: s, required: c, checked: l, selected: u } = r, d = {
29
+ function d(e, t) {
30
+ let n = e, { props: i, className: a, disabled: o, required: s, checked: c, selected: l } = n, d = {
24
31
  ...i,
25
- className: t(n, a).join(" ")
32
+ className: r(t, a).join(" ")
26
33
  };
27
- return o.assignBooleanProp(s, "disabled", d), o.assignBooleanProp(c, "required", d), o.assignBooleanProp(l, "checked", d), o.assignBooleanProp(u, "selected", d), "style" in r && (d.style = r.style), "id" in r && (d.id = r.id), d;
34
+ return u.assignBooleanProp(o, "disabled", d), u.assignBooleanProp(s, "required", d), u.assignBooleanProp(c, "checked", d), u.assignBooleanProp(l, "selected", d), "style" in n && (d.style = n.style), "id" in n && (d.id = n.id), d;
28
35
  }
29
36
  //#endregion
30
37
  //#region src/react/styleElements.ts
31
- var c = parseInt(e.version, 10) >= 19, l = !1;
32
- function u(t) {
33
- if (t?.length) return !c && !l && (l = !0, console.warn(`[box-kite] Box.configure({ sink: 'element' }) needs React 19 to hoist and dedupe its <style> elements; React ${e.version} will render them inline. Use the default sink instead.`)), t.map(({ href: t, css: n, precedence: r }) => e.createElement("style", {
38
+ var f = parseInt(e.version, 10) >= 19, p = !1;
39
+ function m(t) {
40
+ if (t?.length) return !f && !p && (p = !0, console.warn(`[box-kite] Box.configure({ sink: 'element' }) needs React 19 to hoist and dedupe its <style> elements; React ${e.version} will render them inline. Use the default sink instead.`)), t.map(({ href: t, css: n, precedence: r }) => e.createElement("style", {
34
41
  key: t,
35
42
  href: t,
36
43
  precedence: r,
@@ -39,48 +46,48 @@ function u(t) {
39
46
  }
40
47
  //#endregion
41
48
  //#region src/react/resolveStyles.ts
42
- function d(e, t) {
43
- let { classNames: r, signature: i, styleElements: a } = n().resolveClassNames(e, t);
49
+ function h(e, t) {
50
+ let { classNames: n, signature: r, styleElements: a } = i().resolveClassNames(e, t);
44
51
  return {
45
- classNames: r,
46
- signature: i,
47
- styleElements: u(a)
52
+ classNames: n,
53
+ signature: r,
54
+ styleElements: m(a)
48
55
  };
49
56
  }
50
57
  //#endregion
51
58
  //#region src/react/svg/attributesInProps.ts
52
- var f = "__boxAttributesInProps";
53
- function p(e) {
54
- return e[f] = !0, e;
59
+ var g = "__boxAttributesInProps";
60
+ function _(e) {
61
+ return e[g] = !0, e;
55
62
  }
56
- function m(e) {
57
- return typeof e == "function" || typeof e == "object" && e ? e[f] === !0 : !1;
63
+ function v(e) {
64
+ return typeof e == "function" || typeof e == "object" && e ? e[g] === !0 : !1;
58
65
  }
59
66
  //#endregion
60
67
  //#region src/react/svg/svgNaming.ts
61
- var h = [
68
+ var y = [
62
69
  "role",
63
70
  "aria-label",
64
71
  "aria-labelledby",
65
72
  "aria-hidden"
66
73
  ];
67
- function g(e, t) {
74
+ function b(e, t) {
68
75
  if (e !== void 0) return {
69
76
  role: "img",
70
77
  "aria-label": e
71
78
  };
72
- if (!(t && h.some((e) => e in t))) return { "aria-hidden": !0 };
79
+ if (!(t && y.some((e) => e in t))) return { "aria-hidden": !0 };
73
80
  }
74
81
  //#endregion
75
82
  //#region src/utils/string/stringUtils.ts
76
- var _;
83
+ var x;
77
84
  (function(e) {
78
85
  function t(e) {
79
86
  return e.charAt(0).toUpperCase() + e.slice(1);
80
87
  }
81
88
  e.capitalize = t;
82
- })(_ ||= {});
83
- var v = _, y;
89
+ })(x ||= {});
90
+ var S = x, C;
84
91
  (function(e) {
85
92
  function t(e, t, n) {
86
93
  let r = { ...e }, i = r.props || {};
@@ -99,15 +106,15 @@ var v = _, y;
99
106
  return e in t;
100
107
  }
101
108
  e.isKeyOf = r;
102
- })(y ||= {});
103
- var b = y, x = [
109
+ })(C ||= {});
110
+ var w = C, T = [
104
111
  "sky-500",
105
112
  "emerald-500",
106
113
  "amber-500",
107
114
  "violet-500",
108
115
  "rose-500",
109
116
  "cyan-500"
110
- ], S = [
117
+ ], E = [
111
118
  "sky-400",
112
119
  "emerald-400",
113
120
  "amber-400",
@@ -115,8 +122,8 @@ var b = y, x = [
115
122
  "rose-400",
116
123
  "cyan-400"
117
124
  ];
118
- function C(e) {
125
+ function D(e) {
119
126
  return e.reduce((e, t, n) => (e[`chart-${n + 1}`] = t, e), {});
120
127
  }
121
128
  //#endregion
122
- export { v as a, p as c, s as d, r as f, b as i, d as l, x as n, g as o, C as r, m as s, S as t, u };
129
+ export { S as a, _ as c, d, s as f, w as i, h as l, T as n, b as o, a as p, D as r, v as s, E as t, m as u };
package/rsc.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");let n=require("react");n=e.t(n,1);let r=require("@box-kite/core");(0,r.getDefaultEngine)().configure({sink:`element`});function i(e){let{tag:r=`div`,children:i}=e;if(typeof i==`function`)throw Error(`[box-kite] Box children as a function track hover state, which needs the client Box — render it from a 'use client' module.`);let{classNames:a,styleElements:o}=t.l(e,r===`svg`);return n.default.createElement(n.default.Fragment,null,o,n.default.createElement(r,t.d(e,a),i))}var a=i;a.extend=r.BoxExtends.extend,a.components=r.BoxExtends.components,a.keyframes=r.BoxExtends.keyframes,a.spring=r.Springs.spring,a.getVariableValue=e=>(0,r.getDefaultEngine)().getVariableValue(e),a.configure=e=>(0,r.getDefaultEngine)().configure(e);function o(e,n){return t.f(t.l(e,n?.svg===!0),e.className)}exports.default=a,exports.useClassNames=o;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime.cjs"),t=require("./react-shared.cjs");let n=require("react");n=e.t(n,1);let r=require("@box-kite/core");(0,r.getDefaultEngine)().configure({sink:`element`});function i(e,r){let{tag:i=`div`,children:a}=e;if(typeof a==`function`)throw Error(`[box-kite] Box children as a function track hover state, which needs the client Box — render it from a 'use client' module.`);let{classNames:o,styleElements:s}=t.l(e,i===`svg`);return n.default.createElement(n.default.Fragment,null,s,n.default.createElement(i,t.d(e,o),a))}function a(e){return i(e)}var o=a;o.extend=r.BoxExtends.extend,o.components=r.BoxExtends.components,o.keyframes=r.BoxExtends.keyframes,o.spring=r.Springs.spring,o.getVariableValue=e=>(0,r.getDefaultEngine)().getVariableValue(e),o.configure=e=>(0,r.getDefaultEngine)().configure(e),o.viewTransition=r.startViewTransition;function s(e,n){return t.p(t.l(e,n?.svg===!0),e.className)}exports.default=o,exports.useBoxElement=i,exports.useClassNames=s;
package/rsc.d.ts CHANGED
@@ -1,8 +1,13 @@
1
1
  import { default as React } from 'react';
2
- import { BoxExtends, Springs, StylesConfiguration } from '@box-kite/core';
2
+ import { BoxExtends, Springs, startViewTransition, StylesConfiguration } from '@box-kite/core';
3
3
  import { BoxClassNames } from './react/boxClassNames';
4
4
  import { BoxClassNameProps, BoxCoreProps } from './react/boxProps';
5
5
  import { ComponentsAndVariants } from '@box-kite/core/types';
6
+ /**
7
+ * The client entry's `useBoxElement` with no hook in it, so a component built on it renders on a server too —
8
+ * the export condition picks the half. The `use` prefix stays for the reason `useClassNames` keeps it.
9
+ */
10
+ export declare function useBoxElement<TTag extends keyof React.JSX.IntrinsicElements = 'div', TKey extends keyof ComponentsAndVariants = never>(props: BoxCoreProps<TTag, TKey>, _ref?: unknown): React.ReactNode;
6
11
  interface RscBoxType {
7
12
  <TTag extends keyof React.JSX.IntrinsicElements = 'div', TKey extends keyof ComponentsAndVariants = never>(props: BoxCoreProps<TTag, TKey>): React.ReactNode;
8
13
  extend: typeof BoxExtends.extend;
@@ -13,6 +18,11 @@ interface RscBoxType {
13
18
  getVariableValue: (name: string) => string;
14
19
  /** Explicit engine configuration. Element mode is already on; this is for the rest of it. */
15
20
  configure: (config: StylesConfiguration) => void;
21
+ /**
22
+ * Run a DOM change inside a view transition. Here for parity with the client entry — with no document
23
+ * there is no transition, so on a server it is the update and nothing else.
24
+ */
25
+ viewTransition: typeof startViewTransition;
16
26
  }
17
27
  declare const RscBox: RscBoxType;
18
28
  /**