@box-kite/react 2.2.5 → 2.2.7

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 (105) hide show
  1. package/.claude/rules/box-kite-rules.md +5 -1
  2. package/.claude/skills/box-kite/SKILL.md +5 -1
  3. package/.claude/skills/box-kite/references/components.md +34 -0
  4. package/.claude/skills/box-kite/references/extending.md +10 -0
  5. package/.claude/skills/box-kite/references/styling.md +3 -2
  6. package/.cursor/rules/box-kite.mdc +5 -1
  7. package/AGENTS.md +5 -1
  8. package/BOX_AI_CONTEXT.md +147 -7
  9. package/BOX_KITE_AI_CONTEXT.md +147 -7
  10. package/box.cjs +1 -1
  11. package/box.d.ts +5 -0
  12. package/box.mjs +7 -7
  13. package/catalog.cjs +1 -1
  14. package/catalog.mjs +521 -0
  15. package/client.cjs +1 -1
  16. package/client.mjs +136 -117
  17. package/components/calendar.cjs +1 -0
  18. package/components/calendar.d.ts +77 -0
  19. package/components/calendar.mjs +483 -0
  20. package/components/dataGrid/components/dataGridBooleanValue.d.ts +11 -0
  21. package/components/dataGrid/components/dataGridDateParts.d.ts +40 -0
  22. package/components/dataGrid/components/dataGridDateValue.d.ts +14 -0
  23. package/components/dataGrid/contracts/dataGridContract.d.ts +38 -11
  24. package/components/dataGrid/models/columnModel.d.ts +3 -1
  25. package/components/dataGrid/models/editModel.d.ts +3 -1
  26. package/components/dataGrid/models/headerCellModel.d.ts +1 -0
  27. package/components/dataGrid/models/localeText.d.ts +4 -0
  28. package/components/dataGrid/useDateParts.d.ts +17 -0
  29. package/components/dataGrid.cjs +3 -3
  30. package/components/dataGrid.mjs +824 -690
  31. package/components/dateField.cjs +1 -0
  32. package/components/dateField.d.ts +78 -0
  33. package/components/dateField.mjs +313 -0
  34. package/components/datePicker.cjs +1 -0
  35. package/components/datePicker.d.ts +120 -0
  36. package/components/datePicker.mjs +529 -0
  37. package/components/dateTime.cjs +1 -0
  38. package/components/dateTime.d.ts +23 -0
  39. package/components/dateTime.mjs +34 -0
  40. package/components/dialog.cjs +1 -1
  41. package/components/dialog.mjs +87 -75
  42. package/components/overlay.cjs +1 -1
  43. package/components/overlay.mjs +1 -1
  44. package/components/semantics.d.ts +29 -29
  45. package/components/timeZoneSelect.cjs +1 -0
  46. package/components/timeZoneSelect.d.ts +52 -0
  47. package/components/timeZoneSelect.mjs +74 -0
  48. package/components/toaster.cjs +1 -1
  49. package/components/toaster.mjs +1 -1
  50. package/create/src/index.d.ts +1 -0
  51. package/create/src/options.d.ts +27 -0
  52. package/create/src/options.test.d.ts +1 -0
  53. package/create/src/packageManager.d.ts +5 -0
  54. package/create/src/project.d.ts +25 -0
  55. package/create/src/project.test.d.ts +1 -0
  56. package/create/templates/ts/designs/azure.d.ts +5 -0
  57. package/create/templates/ts/designs/ember.d.ts +5 -0
  58. package/create/templates/ts/designs/mono.d.ts +5 -0
  59. package/create/templates/ts/src/App.d.ts +2 -0
  60. package/create/templates/ts/src/design.d.ts +5 -0
  61. package/create/templates/ts/src/main.d.ts +0 -0
  62. package/dataGridDateParts.cjs +1 -0
  63. package/dataGridDateParts.mjs +223 -0
  64. package/dataGridList.cjs +1 -1
  65. package/dataGridList.mjs +335 -372
  66. package/dataGridListLayout.cjs +1 -0
  67. package/dataGridListLayout.mjs +49 -0
  68. package/date-environment.cjs +1 -0
  69. package/date-environment.mjs +29 -0
  70. package/date-input.cjs +1 -0
  71. package/date-input.mjs +346 -0
  72. package/date-math.cjs +1 -0
  73. package/date-math.mjs +317 -0
  74. package/date.cjs +1 -0
  75. package/date.d.ts +40 -0
  76. package/date.mjs +4 -0
  77. package/dates.cjs +1 -0
  78. package/dates.mjs +689 -0
  79. package/docs/components.md +6 -1
  80. package/docs/props.md +19 -19
  81. package/package.json +124 -27
  82. package/react/boxComponent.d.ts +1 -1
  83. package/react/date/dateChange.d.ts +18 -0
  84. package/react/date/dateEnvironment.d.ts +34 -0
  85. package/react/theme/theme.d.ts +9 -0
  86. package/react/theme/themeContext.d.ts +2 -0
  87. package/react-shared.cjs +1 -1
  88. package/react-shared.mjs +1 -1
  89. package/rsc.cjs +1 -1
  90. package/rsc.d.ts +3 -0
  91. package/rsc.mjs +1 -1
  92. package/ssg.cjs +1 -1
  93. package/ssg.mjs +1 -1
  94. package/utils/date/calendar.d.ts +44 -0
  95. package/utils/date/calendarModel.d.ts +46 -0
  96. package/utils/date/dateTime.d.ts +144 -0
  97. package/utils/date/fieldModel.d.ts +74 -0
  98. package/utils/date/format.d.ts +39 -0
  99. package/utils/date/iso.d.ts +40 -0
  100. package/utils/date/locale.d.ts +17 -0
  101. package/utils/date/parse.d.ts +20 -0
  102. package/utils/date/settings.d.ts +26 -0
  103. package/utils/date/value.d.ts +43 -0
  104. package/utils/date/zoneOptions.d.ts +19 -0
  105. package/utils/date/zones.d.ts +32 -0
@@ -307,6 +307,19 @@ Any colour value takes a slash and a percentage:
307
307
  - A token the palette does not have, or a percentage outside 0–100, produces **no rule and no class
308
308
  name** — the same silence every unmatched value gets.
309
309
 
310
+ **Two more families, `accent` and `base`, are what every built-in component is drawn in.** They start as
311
+ copies of `indigo` and `gray`, so nothing changes until one is pointed somewhere. `Box.palette()` returns the
312
+ `vars` record that does it, for an element and its subtree — a family by name, or a ramp of your own:
313
+
314
+ ```tsx
315
+ <Box vars={Box.palette({ accent: 'orange', base: 'stone' })} /> // every Button inside is orange
316
+ <Box vars={Box.palette({ accent: { 500: 'oklch(68% .19 42)' } })} /> // a step left out keeps its default
317
+ <Box theme={{ dark: { vars: Box.palette({ accent: 'amber' }) } }} /> // nests like any vars
318
+ ```
319
+
320
+ Write `accent-*`/`base-*` in your own components when they should follow a design, and a named family when the
321
+ colour is the content (a status, a chart series). A class built from them reads `bgColor-accent-500`.
322
+
310
323
  ### Gradients, shadows and rings
311
324
 
312
325
  A gradient is a **value**, written as a record — so its stops are palette tokens, it takes the opacity
@@ -330,7 +343,10 @@ modifier, it is themed, and two elements asking for the same one share a class.
330
343
  - A stop is any colour value — a token, `blue-500/40`, a system colour, `var(--chart-1)` — or a
331
344
  `[colour, position]` pair. **Two stops minimum**, and the record is judged whole: one bad stop, one
332
345
  unknown key, two kinds at once, and the whole value emits no rule and no class name.
333
- - It writes `background-image`, so `bgGradient` and `bgImage` are the same property.
346
+ - It writes `background-image`, so `bgGradient` and `bgImage` are the same property. `bgGradient` is declared
347
+ later and wins, so a variant or a design takes a gradient off with `bgGradient: 'none'`, never `bgImage: 'none'`.
348
+ - `letterSpacing` is pixels as a number, and Tailwind's tracking names in `em` — `'tighter'` (-0.05em), `'tight'`,
349
+ `'normal'`, `'wide'`, `'wider'`, `'widest'` (0.1em) — which is what a display heading wants at every size.
334
350
 
335
351
  **Four shadows stack**, because each sets its own custom property and all four write one composed
336
352
  `box-shadow`. A ring and an elevation coexist instead of the last one winning:
@@ -1094,6 +1110,40 @@ const harbor = Box.createComponents({ button: { styles: { borderRadius: 0 } } },
1094
1110
  - **A Server Component cannot read the provider.** A client component under it can.
1095
1111
  - **Types for two designs that both name a component**: `interface ComponentsTypes extends MergeComponentsAndVariants<[typeof aurora, typeof harbor]> {}` (from `@box-kite/core/types`). Extending two `ExtractComponentsAndVariants` that disagree on `button` is an interface conflict.
1096
1112
 
1113
+ ### Box.components(styles, { design }) — A Design Chosen in CSS
1114
+
1115
+ A registry is chosen by React context, so a prerendered page can only switch to it after hydration — a flash, and a
1116
+ hydration mismatch if the client renders it first. A **named design** is chosen by an attribute instead: its styles are
1117
+ merged over the app's components and applied wherever an ancestor carries `data-design="<name>"`, so a stored choice
1118
+ written onto `<html>` before the first paint is the whole fix.
1119
+
1120
+ ```tsx
1121
+ Box.components({ button: { styles: { borderRadius: 2.5 } }, dialog: { styles: { borderRadius: 5, p: 7 } } }, { design: 'ember' });
1122
+
1123
+ <Box.Theme
1124
+ use="global"
1125
+ design="classic"
1126
+ designStorageKey="design"
1127
+ globalStyles={{ dataAttr: { 'design=ember': { vars: Box.palette({ accent: 'orange', base: 'stone' }) } } }}
1128
+ >
1129
+ <App />
1130
+ </Box.Theme>;
1131
+
1132
+ const [design, setDesign] = Box.useDesign(); // setDesign(null) goes back to the design prop
1133
+ ```
1134
+
1135
+ - **Both designs are in the CSS.** A Box whose component a design changes carries the design's whole class list beside its
1136
+ own, each rule one class more specific — so every state the app's design styles (a theme, a hover, a variant) is
1137
+ outranked by the same state of the design. A component the design leaves alone costs nothing.
1138
+ - **To take something back off, write its `none`** (`shadow: 'none'`, `bgGradient: 'none'`): a design merges, it cannot delete a key.
1139
+ - **A design nested in another stops the outer one** — a `data-design="classic"` preview inside an Ember page is Classic.
1140
+ The palette is `vars`, which inherit, so that wrapper declares its own `Box.palette()` too.
1141
+ - **Props still win**, and a Box under `<Box.Components value>` resolves against that registry and no named design.
1142
+ - `Box.Theme` writes `data-design` on `<html>` (`use="global"`) or on its wrapper, restores `designStorageKey` after
1143
+ hydration without writing the default over a value a pre-paint script set, and pauses transitions for the switch.
1144
+ `applyDesignToElement` is the framework-free half, in `@box-kite/core`.
1145
+ - **A part can `extends` too**: `trigger: { extends: 'button' }` or `'dialog.title'`. It used to be silently ignored.
1146
+
1097
1147
  ---
1098
1148
 
1099
1149
  ## Extension System
@@ -2189,6 +2239,94 @@ Box.components({
2189
2239
 
2190
2240
  ---
2191
2241
 
2242
+ ## Dates and times (`@box-kite/react/date` + the date components)
2243
+
2244
+ ```tsx
2245
+ import { format, toUtc, toLocal, toZone, toPlainDate, parse, add, today } from '@box-kite/react/date';
2246
+ import DateField from '@box-kite/react/components/dateField';
2247
+ import Calendar from '@box-kite/react/components/calendar';
2248
+ import DatePicker, { DateRangePicker } from '@box-kite/react/components/datePicker';
2249
+ import TimeZoneSelect from '@box-kite/react/components/timeZoneSelect';
2250
+ import DateTime, { DateProvider } from '@box-kite/react/components/dateTime';
2251
+
2252
+ toUtc('2026-10-19T14:30', { from: 'Europe/Chisinau' }); // '2026-10-19T11:30:00Z'
2253
+ toLocal('2026-10-19T11:30:00Z'); // the reader's wall clock, with its offset
2254
+ format('2026-10-19', { locale: 'ro-MD', dateStyle: 'long' }); // '19 octombrie 2026'
2255
+ parse('03/04/2026', { locale: 'en-GB' }); // '2026-04-03'
2256
+
2257
+ <DateField label="Due" name="due" />;
2258
+ <DatePicker type="datetime" zone="utc" label="Publish at" onValueChange={(value, { utc, local }) => schedule(utc)} />;
2259
+ <DateRangePicker label="Stay" startName="from" endName="to" />;
2260
+ <DateTime value={order.createdAt} />;
2261
+ ```
2262
+
2263
+ **Every value is an ISO string, and its shape is its kind** — never a `Date`, which is always a moment in
2264
+ the runtime's zone:
2265
+
2266
+ | Kind | Written as | Means |
2267
+ | ---------- | ------------------------------------------ | --------------------------------------------------------- |
2268
+ | `date` | `2026-10-19` | A day: no time, no zone, the same everywhere. |
2269
+ | `time` | `14:30:00` (`.sss` when there are any) | A time of day. |
2270
+ | `datetime` | `2026-10-19T14:30:00` | A wall clock with no zone — an alarm, a timetable. |
2271
+ | `instant` | `2026-10-19T14:30:00+03:00`, or `…Z` (UTC) | One moment, written as one zone sees it. Anything stored. |
2272
+
2273
+ A zone is `'local'` (the reader), `'utc'`, `'system'` (the runtime), an IANA name or a fixed offset.
2274
+ **`'local'` on a server** is `configureDates({ timeZone })` or the nearest `<DateProvider timeZone>`;
2275
+ `systemZone()` is always the server's own. The browser writes its zone into a cookie with
2276
+ `document.cookie = zoneCookie()`, and a server reads it back with `readZoneCookie(request.headers.get('cookie'))`.
2277
+
2278
+ | Function (`@box-kite/react/date`) | What it does |
2279
+ | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
2280
+ | `toUtc(v, { from })` / `toLocal(v)` / `toZone(v, zone)` | The moment in UTC / on the reader's clock / on another zone's, with offset. |
2281
+ | `toPlainDate` / `toPlainTime` / `toPlainDateTime` / `toInstant` | `(v, { zone })` — the day, time or wall clock a value shows in `zone`. |
2282
+ | `toDate` / `fromDate` / `toEpoch` | The bridge to an API that insists on a `Date`. |
2283
+ | `combine(date, time, { zone })` | A date and a time: a date-time, or with `zone` the instant. |
2284
+ | `today(zone)` / `now(zone)` / `currentTime(zone)` | In the reader's zone unless told. |
2285
+ | `format(v, { locale, zone, dateStyle, timeStyle, … })` | `Intl` options, never format tokens. `''` for a non-value. |
2286
+ | `formatRange` / `formatRelative` / `zoneName` | `Oct 19 – 23, 2026`, `3 minutes ago`, `EEST`. |
2287
+ | `parse(text, { locale, kind, zone })` | ISO, `Date`, epoch, HTTP date, or text in the locale's order. |
2288
+ | `add` / `subtract` / `startOf` / `endOf` / `difference` | Calendar units on the wall clock, clock units on the instant. |
2289
+ | `compare` / `isBefore` / `isAfter` / `isEqual` / `isSame` / `clamp` | Across kinds and zones. |
2290
+ | `details(v, { zone })` | Every reading at once: `utc`, `zoned`, `local`, `offset`, `date`, `epoch`. |
2291
+ | `weekInfo` / `hourCycleOf` / `monthNames` / `weekdayNames` | The locale, from `Intl`. |
2292
+ | `timeZones` / `offsetOf` / `isValidZone` / `normalizeZone` | The runtime's zones. |
2293
+ | `configureDates` / `localZone` / `systemZone` / `zoneCookie` / `readZoneCookie` | Who the reader is. |
2294
+
2295
+ **DST** follows Temporal: a wall-clock time a zone skips or repeats takes `disambiguation` —
2296
+ `'compatible'` (default: the later reading of a skipped time, the earlier of a repeated one), `'earlier'`,
2297
+ `'later'` or `'reject'` (`null`).
2298
+
2299
+ **The controls take and give the same string, and `onValueChange(value, details)` hands over the readings:**
2300
+ `details` is `{ reason, event, utc, local, zoned, date, epoch, zone, offset }`, all `null` while the value
2301
+ is. `reason` is `'keyboard'`, `'paste'`, `'select'`, `'preset'`, `'clear'` or `'reset'`.
2302
+
2303
+ | Component (`components/…`) | What it is |
2304
+ | -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2305
+ | `DateField` (`dateField`) | Segments (`role="spinbutton"`) in the locale's order. `type`, `zone`, `granularity`, `hourCycle`, `min`/`max`, `isDateUnavailable`, `name`, `required`, `label`. |
2306
+ | `Calendar` (`calendar`) | APG's grid keys. `mode="range"` → `{ start, end }`, `months`, `weekNumbers`, `min`/`max`, `isDateUnavailable`, `firstDayOfWeek`. |
2307
+ | `DatePicker` (`datePicker`) | A `DateField` with a calendar (`date`), a list of times every `step` minutes (`time`) or both (`datetime`) in the top layer; `presets`, `clearable`, `closeOnSelect`. |
2308
+ | `DateRangePicker` (`datePicker`) | Two fields over a range calendar; `startName`/`endName`, `months` (2), `presets` of `{ start, end }`. |
2309
+ | `TimeZoneSelect` | A `Combobox` over every zone, searchable by place, region or offset; the value is the IANA name. |
2310
+ | `DateTime` (`dateTime`) | `<time datetime>` in the reader's zone and language; `format`, `relative`, `zone`, `locale`. Also exports `DateProvider`. |
2311
+
2312
+ **A date-time's `zone`** is whose wall clock it is typed on: `'local'` (default), `'utc'`, an IANA name, or
2313
+ `'none'` (a wall clock with no zone, value `2026-10-19T14:30:00`). The value is the instant on that clock
2314
+ (`…+03:00`, or `…Z` for UTC), and a zone that is not the reader's is named after the time.
2315
+
2316
+ **Four things to know.** **Nothing typed is ever parsed**: `03/04/2026` is two days depending on who typed
2317
+ it, so each segment is a spin button and only a paste is read as text. **No hydration error, ever**: a
2318
+ server and a hydrating browser both render in the fallback (`UTC`/`en-US`, or a `DateProvider`'s), and the
2319
+ render after hydration switches to the reader — so pass the cookie's zone to a `DateProvider` for a first
2320
+ paint that is already right. **`name` posts the canonical string** (and `required` is a real input the
2321
+ browser validates), so a server reads `2026-10-19` whatever the reader's locale. And in a **DataGrid**, a
2322
+ column takes `editor: 'date' | 'time' | 'datetime'` (inferred from an ISO string or a `Date`),
2323
+ `dateFormat: 'date' | 'time' | 'datetime' | 'relative' | Intl options` and `filterable: { type: 'date' }`
2324
+ (`on`/`before`/`after`/`between`, each day a `DatePicker`); those parts are a chunk the grid fetches only when it shows a date.
2325
+ Styling: `dateField` (extends `textbox`; `segment`, `literal`, `zone`, `label`; `compact`, `invalid`,
2326
+ `disabled`), `calendar` (`nav`, `title`, `weekday`, `weekNumber`, `cell` with the range band, `day` with
2327
+ `today`/`selected`/`outside`/`blocked`/`unavailable`, `zoomItem`) and `datePicker` (`trigger`, `clear`,
2328
+ `presets`, `preset`, `times`, `time`, `part`); the panel is a `popover`.
2329
+
2192
2330
  ## Toaster (`toast()` + `<Toaster>`)
2193
2331
 
2194
2332
  ```tsx
@@ -2476,7 +2614,7 @@ function TrendCell({ cell }: { cell: CellModel<Row> }) {
2476
2614
  4. **fontSize divider is 16** (not 4). `fontSize={14}` → 14px
2477
2615
  5. **Spacing divider is 4**. `p={4}` → 16px (1rem)
2478
2616
  6. **Border width and lineHeight are direct px**. `b={1}` → 1px. **borderRadius uses divider 4**: `borderRadius={2}` → 8px
2479
- 7. **Colors are Tailwind's OKLCH palette**: `'gray-500'`, `'blue-600'` — 26 families × 11 steps, and an opacity modifier on any of them: `bgColor="blue-500/40"` (a `color-mix`, not `opacity`)
2617
+ 7. **Colors are Tailwind's OKLCH palette**: `'gray-500'`, `'blue-600'` — 26 families × 11 steps, and an opacity modifier on any of them: `bgColor="blue-500/40"` (a `color-mix`, not `opacity`). The built-in components are drawn in two more, `accent` and `base`, which `Box.palette()` repoints
2480
2618
  8. **Breakpoints are mobile-first**: base → sm → md → lg → xl → xxl
2481
2619
  9. **Theme styles nest**: `theme={{ dark: { hover: { ... } } }}`
2482
2620
  10. **HTML attributes go in `props` prop**: `<Link props={{ href: '/about' }}>` not `<Link href>`. `data-*` and `aria-*` go there too — a `data-state` written at the top level typechecks and is then dropped
@@ -2796,11 +2934,13 @@ the same function — and an answer to an edit the user has since abandoned is d
2796
2934
  ```
2797
2935
 
2798
2936
  - **Which editor a cell opens is read off the value in it** — a number gets `number`, a boolean
2799
- `checkbox`, everything else `text` — unless `column.editor` names one (`text`/`number`/`checkbox`/
2800
- `select`) or configures it (`{ type, options?, placeholder?, step?, min?, max? }`; `options` may be a
2801
- function of the row). `column.EditCell` is a control of your own, bound to `cell.draft` with
2802
- `cell.setDraft(v)`, `cell.commitEdit()` and `cell.cancelEdit()` — the same three calls the built-in four
2803
- make.
2937
+ `checkbox` (drawn as a check or a cross, read out as `localeText.booleanTrue`/`booleanFalse`), an ISO
2938
+ date, time or date-time a `DateField` (an edit keeps the shape the cell held: `…Z` stays UTC, a `Date`
2939
+ a `Date`), everything else `text` — unless `column.editor` names one of the seven
2940
+ (`text`/`number`/`checkbox`/`select`/`date`/`time`/`datetime`) or configures it
2941
+ (`{ type, options?, placeholder?, step?, min?, max?, zone? }`; `options` may be a function of the row).
2942
+ `column.EditCell` is a control of your own, bound to `cell.draft` with `cell.setDraft(v)`,
2943
+ `cell.commitEdit()` and `cell.cancelEdit()` — the same three calls the built-in seven make.
2804
2944
  - **Pointer:** a press makes a cell the current one — it takes the ring, whether the pointer or the
2805
2945
  keyboard put it there — and a **double press opens the editor** on an editable cell. A cell that cannot
2806
2946
  be edited takes both as focus and nothing else, and a double press landing on a widget inside a cell (a
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.a(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.s,s.keyframes=i.BoxExtends.keyframes,s.spring=i.Springs.spring,s.Theme=n.r,s.useTheme=n.r.useTheme,s.getVariableValue=e=>(0,i.getDefaultEngine)().getVariableValue(e),s.configure=n.i.configure,s.viewTransition=i.startViewTransition;function c(e,r){return t.p(n.a(e,r?.svg===!0),e.className)}exports.default=s,exports.useBoxElement=o,exports.useClassNames=c,exports.useVisibility=n.o;
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.palette=i.BoxExtends.palette,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.useDesign=n.n.useDesign,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
@@ -21,6 +21,8 @@ interface BoxType {
21
21
  <TTag extends keyof React.JSX.IntrinsicElements = 'div', TKey extends keyof ComponentsAndVariants = never>(props: BoxCoreProps<TTag, TKey> & RefAttributes<ExtractElementFromTag<TTag>>): React.ReactNode;
22
22
  extend: typeof BoxExtends.extend;
23
23
  components: typeof BoxExtends.components;
24
+ /** The `vars` record that points the components' `accent` and `base` families at others, for an element and its subtree. */
25
+ palette: typeof BoxExtends.palette;
24
26
  /** A design for one subtree, registered nowhere: hand it to `<Box.Components value>` or `<Box.Theme components>`. */
25
27
  createComponents: typeof BoxExtends.createComponents;
26
28
  /** Every Box below resolves its `component` against this registry instead of the app's `Box.components()`. */
@@ -30,6 +32,8 @@ interface BoxType {
30
32
  spring: typeof Springs.spring;
31
33
  Theme: typeof Theme;
32
34
  useTheme: typeof Theme.useTheme;
35
+ /** Read the design the nearest `<Box.Theme>` draws in, and set it — `data-design` on its root. */
36
+ useDesign: typeof Theme.useDesign;
33
37
  getVariableValue: (name: string) => string;
34
38
  /** Explicit engine configuration (class-name hashing, style sink). Call once, before the first render. */
35
39
  configure: typeof StylesContext.configure;
@@ -60,3 +64,4 @@ export declare function useClassNames<TKey extends keyof ComponentsAndVariants =
60
64
  }): BoxClassNames;
61
65
  export { useVisibility };
62
66
  export type { BoxClassNames, BoxClassNameProps };
67
+ export type { BoxComponentStyles, BoxStyleProps } from '@box-kite/core/types';
package/box.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { d as e, f as t, p as n } from "./react-shared.mjs";
2
- import { a as r, i, o as a, r as o, s } from "./client.mjs";
2
+ import { a as r, i, n as a, o, r as s } from "./client.mjs";
3
3
  import c, { useState as l } from "react";
4
4
  import { BoxExtends as u, Springs as d, getDefaultEngine as f, startViewTransition as p } from "@box-kite/core";
5
5
  //#region src/box.ts
@@ -12,19 +12,19 @@ function m({ tag: e, tagProps: t, render: n }) {
12
12
  }, n({ isHover: r }));
13
13
  }
14
14
  function h(t, n) {
15
- let { tag: i = "div", children: a } = t, { classNames: o, styleElements: s } = r(t, i === "svg"), l = e(t, o);
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
17
  let u = typeof a == "function" ? c.createElement(m, {
18
- tag: i,
18
+ tag: r,
19
19
  tagProps: l,
20
20
  render: a
21
- }) : c.createElement(i, l, a);
21
+ }) : c.createElement(r, l, a);
22
22
  return s ? c.createElement(c.Fragment, null, s, u) : u;
23
23
  }
24
24
  var g = t(h, "Box");
25
- g.extend = u.extend, g.components = u.components, g.createComponents = u.createComponents, g.Components = s, g.keyframes = u.keyframes, g.spring = d.spring, g.Theme = o, g.useTheme = o.useTheme, g.getVariableValue = (e) => f().getVariableValue(e), g.configure = i.configure, g.viewTransition = p;
25
+ g.extend = u.extend, g.components = u.components, g.palette = u.palette, g.createComponents = u.createComponents, g.Components = o, g.keyframes = u.keyframes, g.spring = d.spring, g.Theme = a, g.useTheme = a.useTheme, g.useDesign = a.useDesign, g.getVariableValue = (e) => f().getVariableValue(e), g.configure = s.configure, g.viewTransition = p;
26
26
  function _(e, t) {
27
- return n(r(e, t?.svg === !0), e.className);
27
+ return n(i(e, t?.svg === !0), e.className);
28
28
  }
29
29
  //#endregion
30
- export { g as default, h as useBoxElement, _ as useClassNames, a as useVisibility };
30
+ export { g as default, h as useBoxElement, _ as useClassNames, r as useVisibility };