@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.
Files changed (167) hide show
  1. package/.claude/rules/box-kite-rules.md +11 -1
  2. package/.claude/skills/box-kite/SKILL.md +11 -1
  3. package/.claude/skills/box-kite/references/components.md +83 -3
  4. package/.cursor/rules/box-kite.mdc +11 -1
  5. package/AGENTS.md +11 -1
  6. package/BOX_AI_CONTEXT.md +371 -25
  7. package/BOX_KITE_AI_CONTEXT.md +371 -25
  8. package/behavior.cjs +1 -1
  9. package/behavior.mjs +57 -57
  10. package/box.cjs +1 -1
  11. package/box.d.ts +5 -0
  12. package/box.mjs +15 -15
  13. package/catalog.cjs +1 -1
  14. package/catalog.mjs +906 -0
  15. package/client.cjs +1 -1
  16. package/client.mjs +94 -80
  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/dashboard.cjs +1 -1
  21. package/components/dashboard.mjs +1 -1
  22. package/components/dataGrid/components/dataGridBooleanValue.d.ts +11 -0
  23. package/components/dataGrid/components/dataGridDateParts.d.ts +40 -0
  24. package/components/dataGrid/components/dataGridDateValue.d.ts +14 -0
  25. package/components/dataGrid/components/dataGridList.d.ts +12 -0
  26. package/components/dataGrid/components/dataGridListAggregate.d.ts +7 -0
  27. package/components/dataGrid/components/dataGridListFilter.d.ts +7 -0
  28. package/components/dataGrid/components/dataGridListFilterSheet.d.ts +11 -0
  29. package/components/dataGrid/components/dataGridListFooter.d.ts +13 -0
  30. package/components/dataGrid/components/dataGridListGroup.d.ts +13 -0
  31. package/components/dataGrid/components/dataGridListItem.d.ts +21 -0
  32. package/components/dataGrid/components/dataGridListLayout.d.ts +20 -0
  33. package/components/dataGrid/components/dataGridListRecord.d.ts +11 -0
  34. package/components/dataGrid/components/dataGridListSelectionBar.d.ts +11 -0
  35. package/components/dataGrid/components/dataGridListSheet.d.ts +30 -0
  36. package/components/dataGrid/components/dataGridListSortSheet.d.ts +10 -0
  37. package/components/dataGrid/components/dataGridListToolbar.d.ts +10 -0
  38. package/components/dataGrid/components/dataGridListValue.d.ts +12 -0
  39. package/components/dataGrid/contracts/dataGridContract.d.ts +70 -11
  40. package/components/dataGrid/models/columnModel.d.ts +3 -1
  41. package/components/dataGrid/models/editModel.d.ts +3 -1
  42. package/components/dataGrid/models/gridModel.d.ts +3 -0
  43. package/components/dataGrid/models/listModel.d.ts +129 -0
  44. package/components/dataGrid/models/localeText.d.ts +36 -0
  45. package/components/dataGrid/models/viewportModel.d.ts +0 -2
  46. package/components/dataGrid/useDateParts.d.ts +17 -0
  47. package/components/dataGrid/useListLayout.d.ts +13 -0
  48. package/components/dataGrid.cjs +3 -3
  49. package/components/dataGrid.mjs +1251 -854
  50. package/components/dateField.cjs +1 -0
  51. package/components/dateField.d.ts +78 -0
  52. package/components/dateField.mjs +313 -0
  53. package/components/datePicker.cjs +1 -0
  54. package/components/datePicker.d.ts +120 -0
  55. package/components/datePicker.mjs +529 -0
  56. package/components/dateTime.cjs +1 -0
  57. package/components/dateTime.d.ts +23 -0
  58. package/components/dateTime.mjs +34 -0
  59. package/components/dialog.cjs +1 -1
  60. package/components/dialog.mjs +29 -29
  61. package/components/list/listItemParts.d.ts +9 -0
  62. package/components/list.cjs +1 -0
  63. package/components/list.d.ts +118 -0
  64. package/components/list.mjs +391 -0
  65. package/components/menu.cjs +1 -1
  66. package/components/menu.mjs +25 -25
  67. package/components/overlay.cjs +1 -1
  68. package/components/overlay.mjs +12 -12
  69. package/components/semantics.d.ts +29 -29
  70. package/components/slider.cjs +1 -1
  71. package/components/slider.mjs +1 -1
  72. package/components/sortableList.cjs +1 -0
  73. package/components/sortableList.d.ts +49 -0
  74. package/components/sortableList.mjs +384 -0
  75. package/components/swipeItem.cjs +1 -0
  76. package/components/swipeItem.d.ts +52 -0
  77. package/components/swipeItem.mjs +321 -0
  78. package/components/tabs.cjs +1 -1
  79. package/components/tabs.mjs +1 -1
  80. package/components/timeZoneSelect.cjs +1 -0
  81. package/components/timeZoneSelect.d.ts +52 -0
  82. package/components/timeZoneSelect.mjs +74 -0
  83. package/components/toaster.cjs +1 -1
  84. package/components/toaster.mjs +24 -24
  85. package/components/virtualList.cjs +1 -0
  86. package/components/virtualList.d.ts +32 -0
  87. package/components/virtualList.mjs +188 -0
  88. package/dataGridDateParts.cjs +1 -0
  89. package/dataGridDateParts.mjs +223 -0
  90. package/dataGridList.cjs +1 -0
  91. package/dataGridList.mjs +1314 -0
  92. package/dataGridListLayout.cjs +1 -0
  93. package/dataGridListLayout.mjs +49 -0
  94. package/date-environment.cjs +1 -0
  95. package/date-environment.mjs +29 -0
  96. package/date-input.cjs +1 -0
  97. package/date-input.mjs +346 -0
  98. package/date-math.cjs +1 -0
  99. package/date-math.mjs +317 -0
  100. package/date.cjs +1 -0
  101. package/date.d.ts +40 -0
  102. package/date.mjs +4 -0
  103. package/dates.cjs +1 -0
  104. package/dates.mjs +689 -0
  105. package/docs/components.md +10 -1
  106. package/icons/closeIcon.d.ts +2 -0
  107. package/icons/filterIcon.d.ts +2 -0
  108. package/layer.cjs +1 -1
  109. package/layer.mjs +1 -1
  110. package/mcp/src/data.d.ts +2 -0
  111. package/package.json +178 -22
  112. package/placement.cjs +1 -1
  113. package/placement.mjs +10 -10
  114. package/platform.cjs +1 -1
  115. package/platform.mjs +4 -1
  116. package/react/a11y/useControllableState.d.ts +2 -1
  117. package/react/boxComponent.d.ts +1 -1
  118. package/react/componentsContext.d.ts +4 -0
  119. package/react/componentsProvider.d.ts +10 -0
  120. package/react/date/dateChange.d.ts +18 -0
  121. package/react/date/dateEnvironment.d.ts +34 -0
  122. package/react/resolveStyles.d.ts +2 -1
  123. package/react/theme/theme.d.ts +6 -1
  124. package/react-shared.cjs +1 -1
  125. package/react-shared.mjs +6 -6
  126. package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +3 -1
  127. package/registry/designs/store/address-form.d.ts +11 -0
  128. package/registry/designs/store/cart-items.d.ts +10 -0
  129. package/registry/designs/store/cart-page.d.ts +4 -0
  130. package/registry/designs/store/checkout-page.d.ts +7 -0
  131. package/registry/designs/store/credit-card-form.d.ts +10 -0
  132. package/registry/designs/store/form-field.d.ts +19 -0
  133. package/registry/designs/store/order-summary.d.ts +18 -0
  134. package/registry/designs/store/product-art.d.ts +26 -0
  135. package/registry/designs/store/product-card.d.ts +11 -0
  136. package/registry/designs/store/product-gallery.d.ts +11 -0
  137. package/registry/designs/store/product-grid.d.ts +10 -0
  138. package/registry/designs/store/product-page.d.ts +5 -0
  139. package/registry/designs/store/quantity-stepper.d.ts +13 -0
  140. package/registry/designs/store/shipping-method.d.ts +14 -0
  141. package/registry/designs/store/store-data.d.ts +53 -0
  142. package/registry/designs/store/store-design.d.ts +63 -0
  143. package/registry/designs/store/store-shell.d.ts +12 -0
  144. package/registry/designs/store/storefront-page.d.ts +4 -0
  145. package/registry/designs/store/variant-picker.d.ts +15 -0
  146. package/rsc.cjs +1 -1
  147. package/rsc.d.ts +2 -0
  148. package/rsc.mjs +1 -1
  149. package/scrolling.cjs +1 -0
  150. package/scrolling.mjs +22 -0
  151. package/utils/date/calendar.d.ts +44 -0
  152. package/utils/date/calendarModel.d.ts +46 -0
  153. package/utils/date/dateTime.d.ts +144 -0
  154. package/utils/date/fieldModel.d.ts +74 -0
  155. package/utils/date/format.d.ts +39 -0
  156. package/utils/date/iso.d.ts +40 -0
  157. package/utils/date/locale.d.ts +17 -0
  158. package/utils/date/parse.d.ts +20 -0
  159. package/utils/date/settings.d.ts +26 -0
  160. package/utils/date/value.d.ts +43 -0
  161. package/utils/date/zoneOptions.d.ts +19 -0
  162. package/utils/date/zones.d.ts +32 -0
  163. package/utils/scroll/scrollUtils.d.ts +6 -0
  164. package/utils/sortable/sortableUtils.d.ts +25 -0
  165. package/utils/swipe/swipeUtils.d.ts +53 -0
  166. package/utils/virtual/measuredWindow.d.ts +28 -0
  167. package/utils/virtual/rowSearch.d.ts +11 -0
package/client.cjs CHANGED
@@ -1 +1 @@
1
- const e=require("./rolldown-runtime.cjs"),t=require("./react-shared.cjs"),n=require("./platform.cjs"),r=require("./effects.cjs"),i=require("./box.cjs");let a=require("react");a=e.t(a,1);let o=require("@box-kite/core"),s=require("react-dom"),c=require("react/jsx-runtime");function l(e){let{node:t=null,event:r=`click`,hideOnScroll:i=!1,hideOnResize:o=!1,hideOnEscape:s=!0}=e??{},[c,l]=(0,a.useState)(!1),u=(0,a.useRef)(null);return(0,a.useEffect)(()=>{function e(e){let r=t??u.current;r&&!n.l(e,[r])&&l(!1)}function a(){l(!1)}function d(e){e.key===`Escape`&&l(!1)}let f=new AbortController;return c&&(window.addEventListener(r,e,f),s&&window.addEventListener(`keydown`,d,f),o&&window.addEventListener(`resize`,a,f),i&&window.addEventListener(`scroll`,e,{signal:f.signal,capture:!0})),()=>{f.abort()}},[t,c,r,s,o,i]),[c,l,u]}var u=r.t;function d(e,n){let{classNames:r,signature:i,styleElements:a}=t.l(e,n);return u(()=>{(0,o.getDefaultEngine)().flushSync()},[i??e]),{classNames:r,styleElements:a}}function f(e,n){let r=e?(0,o.getDefaultEngine)().addGlobalStyles(e,n):void 0;return u(()=>{(0,o.getDefaultEngine)().flushSync()},[e,n]),t.u(r)}var p;(function(e){function t(){(0,o.getDefaultEngine)().flushSync()}e.flushSync=t;function n(){(0,o.getDefaultEngine)().clear()}e.clear=n;function r(){return(0,o.getDefaultEngine)().getStyles()}e.getStyles=r;function i(){return(0,o.getDefaultEngine)().getStyleTag()}e.getStyleTag=i;function a(){return(0,o.getDefaultEngine)().styleElementId}e.styleElementId=a;function s(e){(0,o.getDefaultEngine)().configure(e)}e.configure=s})(p||={});var m=`[box-kite] The client build was loaded into a React Server Component graph, where React has no createContext. Import '@box-kite/react' by its package name — the react-server condition resolves it to a Box that renders on the server — and import the components that hold state (Dropdown, Tooltip, DataGrid, Checkbox, Select, Form) from a 'use client' module. See https://github.com/box-kite/box-kite#react-server-components-react-19`;function h(e){if(typeof e.createContext!=`function`)throw Error(m)}h(a.default);var g=a.default.createContext({theme:``,setTheme:()=>{}});function _(e){let{children:t,theme:n,use:l=`local`,storageKey:u,globalStyles:d,viewTransition:p}=e,m=f(l===`global`?d:void 0,`html`),[h,_]=(0,a.useState)(n??o.defaultThemeName),[v,y]=(0,a.useState)(n!==void 0),b=(0,a.useRef)(null),x=(0,a.useRef)(h),S=(0,a.useRef)(null),C=(0,a.useRef)(void 0),w=(0,a.useCallback)(e=>{let t=()=>{e===null?(u&&(0,o.clearStoredTheme)(u),y(!1)):(u&&(0,o.writeStoredTheme)(u,e),_(e),y(!0))};if(p){let e=(0,o.transitionTheme)(()=>(0,s.flushSync)(t),p===`reveal`?`reveal`:`fade`);C.current=e.finished,e.finished.then(()=>C.current=void 0,()=>C.current=void 0)}else t()},[u,p]),T=p===`reveal`;(0,a.useEffect)(()=>T?(0,o.prepareReveal)():void 0,[T]);let[E,D]=(0,a.useState)(n);return n!==E&&(D(n),n===void 0?y(!1):(_(n),y(!0))),(0,a.useLayoutEffect)(()=>{if(v)return;let e=u?(0,o.readStoredTheme)(u):null,t=e??(0,o.getSystemTheme)();if(t!==x.current&&(b.current=t),_(t),e){y(!0);return}return(0,o.watchSystemTheme)(_)},[v,u]),r.t(()=>{h!==x.current&&(S.current??=(0,o.pauseTransitions)())},[h]),(0,a.useLayoutEffect)(()=>{if(x.current=h,b.current!==null&&b.current!==h)return;b.current=null;let e=S.current;S.current=null;let t=l===`global`?(0,o.documentRoot)():null,n=t?(0,o.applyThemeToElement)(t,h):void 0;return e?.(C.current),n},[h,l]),l===`local`?(0,c.jsxs)(g.Provider,{value:{theme:h,setTheme:w},children:[m,(0,c.jsx)(i.default,{className:h,props:{"data-theme":h},children:t})]}):(0,c.jsxs)(g.Provider,{value:{theme:h,setTheme:w},children:[m,t]})}(function(e){function t(){let{theme:e,setTheme:t}=(0,a.useContext)(g);return[e,t]}e.useTheme=t})(_||={});var v=_,y=new WeakMap;function b(e){let t=y.get(e);return t||(t=new Map,y.set(e,t)),t}function x(e=!0){let[t]=v.useTheme(),r=(0,a.useMemo)(()=>{if(!e)return null;let t=n.t();if(!t)return null;let r=`box-kite-portal`,i=t.getElementById(r);return i||(i=document.createElement(`div`),i.id=r,document.body.appendChild(i)),i},[e]);return(0,a.useLayoutEffect)(()=>{if(!t||!r)return;let e=b(r),n=e.get(t)??0;return e.set(t,n+1),n===0&&r.classList.add(t),()=>{let n=(e.get(t)??1)-1;n<=0?(e.delete(t),r.classList.remove(t)):e.set(t,n)}},[r,t]),r}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return x}});
1
+ const e=require("./rolldown-runtime.cjs"),t=require("./react-shared.cjs"),n=require("./platform.cjs"),r=require("./effects.cjs"),i=require("./box.cjs");let a=require("react");a=e.t(a,1);let o=require("@box-kite/core"),s=require("react/jsx-runtime"),c=require("react-dom");var l=`[box-kite] The client build was loaded into a React Server Component graph, where React has no createContext. Import '@box-kite/react' by its package name — the react-server condition resolves it to a Box that renders on the server — and import the components that hold state (Dropdown, Tooltip, DataGrid, Checkbox, Select, Form) from a 'use client' module. See https://github.com/box-kite/box-kite#react-server-components-react-19`;function u(e){if(typeof e.createContext!=`function`)throw Error(l)}u(a.default);var d=a.default.createContext(void 0);function f({value:e,children:t}){return(0,s.jsx)(d.Provider,{value:e,children:t})}function p(e){let{node:t=null,event:r=`click`,hideOnScroll:i=!1,hideOnResize:o=!1,hideOnEscape:s=!0}=e??{},[c,l]=(0,a.useState)(!1),u=(0,a.useRef)(null);return(0,a.useEffect)(()=>{function e(e){let r=t??u.current;r&&!n.u(e,[r])&&l(!1)}function a(){l(!1)}function d(e){e.key===`Escape`&&l(!1)}let f=new AbortController;return c&&(window.addEventListener(r,e,f),s&&window.addEventListener(`keydown`,d,f),o&&window.addEventListener(`resize`,a,f),i&&window.addEventListener(`scroll`,e,{signal:f.signal,capture:!0})),()=>{f.abort()}},[t,c,r,s,o,i]),[c,l,u]}var m=r.t;function h(e,n){let{classNames:r,signature:i,styleElements:s}=t.l(e,n,(0,a.useContext)(d));return m(()=>{(0,o.getDefaultEngine)().flushSync()},[i??e]),{classNames:r,styleElements:s}}function g(e,n){let r=e?(0,o.getDefaultEngine)().addGlobalStyles(e,n):void 0;return m(()=>{(0,o.getDefaultEngine)().flushSync()},[e,n]),t.u(r)}var _;(function(e){function t(){(0,o.getDefaultEngine)().flushSync()}e.flushSync=t;function n(){(0,o.getDefaultEngine)().clear()}e.clear=n;function r(){return(0,o.getDefaultEngine)().getStyles()}e.getStyles=r;function i(){return(0,o.getDefaultEngine)().getStyleTag()}e.getStyleTag=i;function a(){return(0,o.getDefaultEngine)().styleElementId}e.styleElementId=a;function s(e){(0,o.getDefaultEngine)().configure(e)}e.configure=s})(_||={}),u(a.default);var v=a.default.createContext({theme:``,setTheme:()=>{}});function y(e){let{theme:t,use:n=`local`,storageKey:l,globalStyles:u,viewTransition:d,components:p}=e,m=p?(0,s.jsx)(f,{value:p,children:e.children}):e.children,h=g(n===`global`?u:void 0,`html`),[_,y]=(0,a.useState)(t??o.defaultThemeName),[b,x]=(0,a.useState)(t!==void 0),S=(0,a.useRef)(null),C=(0,a.useRef)(_),w=(0,a.useRef)(null),T=(0,a.useRef)(void 0),E=(0,a.useCallback)(e=>{let t=()=>{e===null?(l&&(0,o.clearStoredTheme)(l),x(!1)):(l&&(0,o.writeStoredTheme)(l,e),y(e),x(!0))};if(d){let e=(0,o.transitionTheme)(()=>(0,c.flushSync)(t),d===`reveal`?`reveal`:`fade`);T.current=e.finished,e.finished.then(()=>T.current=void 0,()=>T.current=void 0)}else t()},[l,d]),D=d===`reveal`;(0,a.useEffect)(()=>D?(0,o.prepareReveal)():void 0,[D]);let[O,k]=(0,a.useState)(t);return t!==O&&(k(t),t===void 0?x(!1):(y(t),x(!0))),(0,a.useLayoutEffect)(()=>{if(b)return;let e=l?(0,o.readStoredTheme)(l):null,t=e??(0,o.getSystemTheme)();if(t!==C.current&&(S.current=t),y(t),e){x(!0);return}return(0,o.watchSystemTheme)(y)},[b,l]),r.t(()=>{_!==C.current&&(w.current??=(0,o.pauseTransitions)())},[_]),(0,a.useLayoutEffect)(()=>{if(C.current=_,S.current!==null&&S.current!==_)return;S.current=null;let e=w.current;w.current=null;let t=n===`global`?(0,o.documentRoot)():null,r=t?(0,o.applyThemeToElement)(t,_):void 0;return e?.(T.current),r},[_,n]),n===`local`?(0,s.jsxs)(v.Provider,{value:{theme:_,setTheme:E},children:[h,(0,s.jsx)(i.default,{className:_,props:{"data-theme":_},children:m})]}):(0,s.jsxs)(v.Provider,{value:{theme:_,setTheme:E},children:[h,m]})}(function(e){function t(){let{theme:e,setTheme:t}=(0,a.useContext)(v);return[e,t]}e.useTheme=t})(y||={});var b=y,x=new WeakMap;function S(e){let t=x.get(e);return t||(t=new Map,x.set(e,t)),t}function C(e=!0){let[t]=b.useTheme(),r=(0,a.useMemo)(()=>{if(!e)return null;let t=n.t();if(!t)return null;let r=`box-kite-portal`,i=t.getElementById(r);return i||(i=document.createElement(`div`),i.id=r,document.body.appendChild(i)),i},[e]);return(0,a.useLayoutEffect)(()=>{if(!t||!r)return;let e=S(r),n=e.get(t)??0;return e.set(t,n+1),n===0&&r.classList.add(t),()=>{let n=(e.get(t)??1)-1;n<=0?(e.delete(t),r.classList.remove(t)):e.set(t,n)}},[r,t]),r}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return C}});
package/client.mjs CHANGED
@@ -1,18 +1,36 @@
1
1
  import { l as e, u as t } from "./react-shared.mjs";
2
- import { l as n, t as r } from "./platform.mjs";
2
+ import { t as n, u as r } from "./platform.mjs";
3
3
  import { t as i } from "./effects.mjs";
4
4
  import a from "./box.mjs";
5
5
  import o, { useCallback as s, useContext as c, useEffect as l, useLayoutEffect as u, useMemo as d, useRef as f, useState as p } from "react";
6
6
  import { applyThemeToElement as m, clearStoredTheme as h, defaultThemeName as g, documentRoot as _, getDefaultEngine as v, getSystemTheme as y, pauseTransitions as b, prepareReveal as x, readStoredTheme as S, transitionTheme as C, watchSystemTheme as w, writeStoredTheme as T } from "@box-kite/core";
7
- import { flushSync as E } from "react-dom";
8
- import { jsx as D, jsxs as O } from "react/jsx-runtime";
7
+ import { jsx as E, jsxs as D } from "react/jsx-runtime";
8
+ import { flushSync as O } from "react-dom";
9
+ //#region src/react/clientRuntime.ts
10
+ var k = "[box-kite] The client build was loaded into a React Server Component graph, where React has no createContext. Import '@box-kite/react' by its package name — the react-server condition resolves it to a Box that renders on the server — and import the components that hold state (Dropdown, Tooltip, DataGrid, Checkbox, Select, Form) from a 'use client' module. See https://github.com/box-kite/box-kite#react-server-components-react-19";
11
+ function A(e) {
12
+ if (typeof e.createContext != "function") throw Error(k);
13
+ }
14
+ //#endregion
15
+ //#region src/react/componentsContext.ts
16
+ A(o);
17
+ var j = o.createContext(void 0);
18
+ //#endregion
19
+ //#region src/react/componentsProvider.tsx
20
+ function M({ value: e, children: t }) {
21
+ return /* @__PURE__ */ E(j.Provider, {
22
+ value: e,
23
+ children: t
24
+ });
25
+ }
26
+ //#endregion
9
27
  //#region src/react/hooks/useVisibility.ts
10
- function k(e) {
11
- let { node: t = null, event: r = "click", hideOnScroll: i = !1, hideOnResize: a = !1, hideOnEscape: o = !0 } = e ?? {}, [s, c] = p(!1), u = f(null);
28
+ function N(e) {
29
+ let { node: t = null, event: n = "click", hideOnScroll: i = !1, hideOnResize: a = !1, hideOnEscape: o = !0 } = e ?? {}, [s, c] = p(!1), u = f(null);
12
30
  return l(() => {
13
31
  function e(e) {
14
- let r = t ?? u.current;
15
- r && !n(e, [r]) && c(!1);
32
+ let n = t ?? u.current;
33
+ n && !r(e, [n]) && c(!1);
16
34
  }
17
35
  function l() {
18
36
  c(!1);
@@ -21,7 +39,7 @@ function k(e) {
21
39
  e.key === "Escape" && c(!1);
22
40
  }
23
41
  let f = new AbortController();
24
- return s && (window.addEventListener(r, e, f), o && window.addEventListener("keydown", d, f), a && window.addEventListener("resize", l, f), i && window.addEventListener("scroll", e, {
42
+ return s && (window.addEventListener(n, e, f), o && window.addEventListener("keydown", d, f), a && window.addEventListener("resize", l, f), i && window.addEventListener("scroll", e, {
25
43
  signal: f.signal,
26
44
  capture: !0
27
45
  })), () => {
@@ -30,7 +48,7 @@ function k(e) {
30
48
  }, [
31
49
  t,
32
50
  s,
33
- r,
51
+ n,
34
52
  o,
35
53
  a,
36
54
  i
@@ -42,23 +60,25 @@ function k(e) {
42
60
  }
43
61
  //#endregion
44
62
  //#region src/react/useStyles.ts
45
- var A = i;
46
- function j(t, n) {
47
- let { classNames: r, signature: i, styleElements: a } = e(t, n);
48
- return A(() => {
63
+ var P = i;
64
+ function F(t, n) {
65
+ let { classNames: r, signature: i, styleElements: a } = e(t, n, c(j));
66
+ return P(() => {
49
67
  v().flushSync();
50
68
  }, [i ?? t]), {
51
69
  classNames: r,
52
70
  styleElements: a
53
71
  };
54
72
  }
55
- function M(e, n) {
73
+ function I(e, n) {
56
74
  let r = e ? v().addGlobalStyles(e, n) : void 0;
57
- return A(() => {
75
+ return P(() => {
58
76
  v().flushSync();
59
77
  }, [e, n]), t(r);
60
78
  }
61
- var N;
79
+ var L;
80
+ //#endregion
81
+ //#region src/react/theme/themeContext.ts
62
82
  (function(e) {
63
83
  function t() {
64
84
  v().flushSync();
@@ -84,97 +104,91 @@ var N;
84
104
  v().configure(e);
85
105
  }
86
106
  e.configure = o;
87
- })(N ||= {});
88
- //#endregion
89
- //#region src/react/clientRuntime.ts
90
- var P = "[box-kite] The client build was loaded into a React Server Component graph, where React has no createContext. Import '@box-kite/react' by its package name — the react-server condition resolves it to a Box that renders on the server — and import the components that hold state (Dropdown, Tooltip, DataGrid, Checkbox, Select, Form) from a 'use client' module. See https://github.com/box-kite/box-kite#react-server-components-react-19";
91
- function F(e) {
92
- if (typeof e.createContext != "function") throw Error(P);
93
- }
94
- //#endregion
95
- //#region src/react/theme/themeContext.ts
96
- F(o);
97
- var I = o.createContext({
107
+ })(L ||= {}), A(o);
108
+ var R = o.createContext({
98
109
  theme: "",
99
110
  setTheme: () => {}
100
111
  });
101
112
  //#endregion
102
113
  //#region src/react/theme/theme.tsx
103
- function L(e) {
104
- let { children: t, theme: n, use: r = "local", storageKey: o, globalStyles: c, viewTransition: d } = e, v = M(r === "global" ? c : void 0, "html"), [k, A] = p(n ?? g), [j, N] = p(n !== void 0), P = f(null), F = f(k), L = f(null), R = f(void 0), z = s((e) => {
114
+ function z(e) {
115
+ let { theme: t, use: n = "local", storageKey: r, globalStyles: o, viewTransition: c, components: d } = e, v = d ? /* @__PURE__ */ E(M, {
116
+ value: d,
117
+ children: e.children
118
+ }) : e.children, k = I(n === "global" ? o : void 0, "html"), [A, j] = p(t ?? g), [N, P] = p(t !== void 0), F = f(null), L = f(A), z = f(null), B = f(void 0), V = s((e) => {
105
119
  let t = () => {
106
- e === null ? (o && h(o), N(!1)) : (o && T(o, e), A(e), N(!0));
120
+ e === null ? (r && h(r), P(!1)) : (r && T(r, e), j(e), P(!0));
107
121
  };
108
- if (d) {
109
- let e = C(() => E(t), d === "reveal" ? "reveal" : "fade");
110
- R.current = e.finished, e.finished.then(() => R.current = void 0, () => R.current = void 0);
122
+ if (c) {
123
+ let e = C(() => O(t), c === "reveal" ? "reveal" : "fade");
124
+ B.current = e.finished, e.finished.then(() => B.current = void 0, () => B.current = void 0);
111
125
  } else t();
112
- }, [o, d]), B = d === "reveal";
113
- l(() => B ? x() : void 0, [B]);
114
- let [V, H] = p(n);
115
- return n !== V && (H(n), n === void 0 ? N(!1) : (A(n), N(!0))), u(() => {
116
- if (j) return;
117
- let e = o ? S(o) : null, t = e ?? y();
118
- if (t !== F.current && (P.current = t), A(t), e) {
119
- N(!0);
126
+ }, [r, c]), H = c === "reveal";
127
+ l(() => H ? x() : void 0, [H]);
128
+ let [U, W] = p(t);
129
+ return t !== U && (W(t), t === void 0 ? P(!1) : (j(t), P(!0))), u(() => {
130
+ if (N) return;
131
+ let e = r ? S(r) : null, t = e ?? y();
132
+ if (t !== L.current && (F.current = t), j(t), e) {
133
+ P(!0);
120
134
  return;
121
135
  }
122
- return w(A);
123
- }, [j, o]), i(() => {
124
- k !== F.current && (L.current ??= b());
125
- }, [k]), u(() => {
126
- if (F.current = k, P.current !== null && P.current !== k) return;
127
- P.current = null;
128
- let e = L.current;
129
- L.current = null;
130
- let t = r === "global" ? _() : null, n = t ? m(t, k) : void 0;
131
- return e?.(R.current), n;
132
- }, [k, r]), r === "local" ? /* @__PURE__ */ O(I.Provider, {
136
+ return w(j);
137
+ }, [N, r]), i(() => {
138
+ A !== L.current && (z.current ??= b());
139
+ }, [A]), u(() => {
140
+ if (L.current = A, F.current !== null && F.current !== A) return;
141
+ F.current = null;
142
+ let e = z.current;
143
+ z.current = null;
144
+ let t = n === "global" ? _() : null, r = t ? m(t, A) : void 0;
145
+ return e?.(B.current), r;
146
+ }, [A, n]), n === "local" ? /* @__PURE__ */ D(R.Provider, {
133
147
  value: {
134
- theme: k,
135
- setTheme: z
148
+ theme: A,
149
+ setTheme: V
136
150
  },
137
- children: [v, /* @__PURE__ */ D(a, {
138
- className: k,
139
- props: { "data-theme": k },
140
- children: t
151
+ children: [k, /* @__PURE__ */ E(a, {
152
+ className: A,
153
+ props: { "data-theme": A },
154
+ children: v
141
155
  })]
142
- }) : /* @__PURE__ */ O(I.Provider, {
156
+ }) : /* @__PURE__ */ D(R.Provider, {
143
157
  value: {
144
- theme: k,
145
- setTheme: z
158
+ theme: A,
159
+ setTheme: V
146
160
  },
147
- children: [v, t]
161
+ children: [k, v]
148
162
  });
149
163
  }
150
164
  (function(e) {
151
165
  function t() {
152
- let { theme: e, setTheme: t } = c(I);
166
+ let { theme: e, setTheme: t } = c(R);
153
167
  return [e, t];
154
168
  }
155
169
  e.useTheme = t;
156
- })(L ||= {});
157
- var R = L, z = /* @__PURE__ */ new WeakMap();
158
- function B(e) {
159
- let t = z.get(e);
160
- return t || (t = /* @__PURE__ */ new Map(), z.set(e, t)), t;
170
+ })(z ||= {});
171
+ var B = z, V = /* @__PURE__ */ new WeakMap();
172
+ function H(e) {
173
+ let t = V.get(e);
174
+ return t || (t = /* @__PURE__ */ new Map(), V.set(e, t)), t;
161
175
  }
162
- function V(e = !0) {
163
- let [t] = R.useTheme(), n = d(() => {
176
+ function U(e = !0) {
177
+ let [t] = B.useTheme(), r = d(() => {
164
178
  if (!e) return null;
165
- let t = r();
179
+ let t = n();
166
180
  if (!t) return null;
167
- let n = "box-kite-portal", i = t.getElementById(n);
168
- return i || (i = document.createElement("div"), i.id = n, document.body.appendChild(i)), i;
181
+ let r = "box-kite-portal", i = t.getElementById(r);
182
+ return i || (i = document.createElement("div"), i.id = r, document.body.appendChild(i)), i;
169
183
  }, [e]);
170
184
  return u(() => {
171
- if (!t || !n) return;
172
- let e = B(n), r = e.get(t) ?? 0;
173
- return e.set(t, r + 1), r === 0 && n.classList.add(t), () => {
174
- let r = (e.get(t) ?? 1) - 1;
175
- r <= 0 ? (e.delete(t), n.classList.remove(t)) : e.set(t, r);
185
+ if (!t || !r) return;
186
+ let e = H(r), n = e.get(t) ?? 0;
187
+ return e.set(t, n + 1), n === 0 && r.classList.add(t), () => {
188
+ let n = (e.get(t) ?? 1) - 1;
189
+ n <= 0 ? (e.delete(t), r.classList.remove(t)) : e.set(t, n);
176
190
  };
177
- }, [n, t]), n;
191
+ }, [r, t]), r;
178
192
  }
179
193
  //#endregion
180
- export { k as a, j as i, R as n, N as r, V as t };
194
+ export { N as a, F as i, B as n, M as o, L as r, U as t };
@@ -0,0 +1 @@
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../platform.cjs"),t=require("../box.cjs"),n=require("../behavior.cjs"),r=require("../identity.cjs"),i=require("../dates.cjs"),a=require("../date-math.cjs"),o=require("./svg.cjs"),s=require("../date-environment.cjs"),c=require("./visuallyHidden.cjs");let l=require("react"),u=require("react/jsx-runtime");function d(e){let t=i.f(e);return t&&t.kind===`date`?t.fields:null}function f(e){return i.w({...e,...i.V})}function ee(e,t,n){let r={year:e,month:t,day:1},a=i.U(r,-i.Q(i.G(r)-n,7));return Array.from({length:6},(e,r)=>{let o=Array.from({length:7},(e,n)=>{let o=i.U(a,r*7+n);return{date:f(o),day:o.day,outside:o.month!==t}}),s=i.U(a,r*7+i.Q(4-n,7));return{week:i.Z(s).week,days:o}})}function te(e,t,n,r){let a=r.rtl?`ArrowLeft`:`ArrowRight`,o=r.rtl?`ArrowRight`:`ArrowLeft`;switch(t){case a:return i.U(e,1);case o:return i.U(e,-1);case`ArrowDown`:return i.U(e,7);case`ArrowUp`:return i.U(e,-7);case`Home`:return i.U(e,-i.Q(i.G(e)-r.firstDay,7));case`End`:return i.U(e,6-i.Q(i.G(e)-r.firstDay,7));case`PageUp`:return i.W(e,n?-12:-1);case`PageDown`:return i.W(e,n?12:1);default:return null}}function ne(e,t){return t.min!=null&&i.q(e)<i.q(t.min)||t.max!=null&&i.q(e)>i.q(t.max)}function p(e,t){return t.min&&i.q(e)<i.q(t.min)?t.min:t.max&&i.q(e)>i.q(t.max)?t.max:e}function m(e,t){return i.q(e)<=i.q(t)?[e,t]:[t,e]}function re(e,t,n){if(!t||!n)return t&&i.q(e)===i.q(t)?`start`:null;let[r,a]=m(t,n),o=i.q(e);return o===i.q(r)?`start`:o===i.q(a)?`end`:o>i.q(r)&&o<i.q(a)?`middle`:null}function ie(e,t,n){let[r,a]=m(e,t);for(let e=i.q(r);e<=i.q(a);e++)if(n(f(i.U({year:1970,month:1,day:1},e))))return!0;return!1}var ae=`data-date`,h=12;function g(e,t){return e!==null&&t!==null&&i.q(e)===i.q(t)}function _(o){let{mode:_=`single`,value:y,defaultValue:S=null,onValueChange:se,min:ce,max:C,isDateUnavailable:w,locale:le,zone:ue,firstDayOfWeek:de,months:T=1,weekNumbers:E=!1,showOutsideDays:fe=!0,focusedDate:pe,defaultFocusedDate:me,onFocusedDateChange:he,disabled:D=!1,readOnly:ge=!1,autoFocus:_e=!1,label:ve,previousLabel:ye=`Previous`,nextLabel:be=`Next`,props:xe,...Se}=o,O=s.n({locale:le,zone:ue}),{locale:k}=O,A=d(a.N(O.zone)),j=de??i.S(k).firstDay,M=e=>oe(k).format(e),N=_===`range`,P=(0,l.useMemo)(()=>({min:d(ce),max:d(C)}),[ce,C]),[F,Ce]=n.i({value:y,defaultValue:S,onChange:(e,t)=>{se?.(e,N?t:{...t,...a.x(e,O.zone)})}}),I=N?null:d(F),L=N&&F?F:null,[R,z]=(0,l.useState)(null),[we,B]=(0,l.useState)(null),Te=f(p(d(me)??I??d(L?.start)??A,P)),[V,H]=n.i({value:pe,defaultValue:Te,onChange:he}),U=d(V)??A,[W,G]=(0,l.useState)(`day`),[K,q]=(0,l.useState)(()=>v(U)),J=K;(v(U)<K||v(U)>K+T-1)&&(J=v(U)<K?v(U):v(U)-T+1,q(J));let Ee=(0,l.useRef)(null),Y=(0,l.useRef)(_e),De=r.t(`calendar`);(0,l.useEffect)(()=>{Y.current&&(Y.current=!1,Ee.current?.querySelector(`[${ae}="${V}"]`)?.focus())});let Oe=e=>ne(e,P),ke=e=>w?.(f(e))??!1,X=(e,t,n)=>{Y.current=n,H(f(p(e,P)),{reason:t})},Ae=(e,t)=>{if(D||ge||Oe(e)||ke(e))return;if(X(e,`keyboard`,!1),!N){Ce(f(e),{reason:`select`,event:t});return}if(!R){z(e),B(e);return}let[n,r]=m(R,e);z(null),B(null),!(w&&ie(n,r,w))&&Ce({start:f(n),end:f(r)},{reason:`select`,event:t})},je=n.a(t=>{if(D)return;if(t.key===`Enter`||t.key===` `){t.preventDefault(),Ae(U,t);return}if(t.key===`Escape`&&R){t.preventDefault(),t.stopPropagation(),z(null),B(null);return}let n=te(U,t.key,t.shiftKey,{rtl:e.d(t.currentTarget),firstDay:j});n&&(t.preventDefault(),X(n,`keyboard`,!0),R&&B(p(n,P)))}),Me=e=>{W===`day`?(q(J+e*T),X(i.W(U,e*T),`navigate`,!1)):X(i.W(U,e*(W===`month`?12:144)),`navigate`,!1)},Z=Array.from({length:T},(e,t)=>({year:Math.floor((J+t)/12),month:(J+t)%12+1,day:1})),Q=`${De}-title`,Ne=W===`day`&&T>1,Pe=W===`day`?Z.map(e=>i.t(f(e),{locale:k,month:`long`,year:`numeric`})).join(` – `):W===`month`?M(U.year):`${M(b(U.year))} – ${M(b(U.year)+h-1)}`,Fe=i.C(k,`short`),Ie=Fe.some(e=>e.length>4)?i.C(k,`narrow`):Fe,Le=i.C(k,`long`),Re=Array.from({length:7},(e,t)=>(j+t)%7),ze=R?we??R:null,Be=R??d(L?.start),$=R?ze:d(L?.end),Ve=e=>{let n=d(e.date),r=Oe(n),a=ke(n),o=N?re(n,Be,$):null,s=N?o!==null:g(n,I),c=g(n,A),l=g(n,U);return e.outside&&(!fe||T>1)?(0,u.jsx)(t.default,{tag:`td`,component:`calendar.cell`,display:`table-cell`,props:{role:`gridcell`}},e.date):(0,u.jsx)(t.default,{tag:`td`,component:`calendar.cell`,display:`table-cell`,p:0,py:.5,variant:{rangeStart:o===`start`&&$!==null&&!g(Be,$),rangeEnd:o===`end`,rangeMiddle:o===`middle`},props:{role:`gridcell`,"aria-selected":s||void 0,"aria-disabled":r||D||void 0,"aria-current":c?`date`:void 0},children:(0,u.jsx)(t.default,{component:`calendar.day`,display:`flex`,ai:`center`,jc:`center`,width:9,height:9,mx:`auto`,borderRadius:999,fontSize:14,css:{fontVariantNumeric:`tabular-nums`},variant:{today:c,selected:s&&o!==`middle`,outside:e.outside,blocked:r||D,unavailable:a},props:{[ae]:e.date,tabIndex:l&&!r&&!D?0:-1,"aria-label":i.t(e.date,{locale:k,dateStyle:`full`}),onClick:e=>Ae(n,e),onPointerEnter:()=>R&&B(n)},children:M(e.day)})},e.date)},He=(t,n,r,i,a,o)=>{let s=e.d(t.currentTarget),c={ArrowUp:-r,ArrowDown:r,[s?`ArrowRight`:`ArrowLeft`]:-1,[s?`ArrowLeft`:`ArrowRight`]:1};t.key===`Enter`||t.key===` `?(t.preventDefault(),i(o)):t.key in c&&(t.preventDefault(),a(Math.max(0,Math.min(n-1,o+c[t.key])),t.currentTarget.parentElement))},Ue=()=>{let e=i.x(k,`short`),n=b(U.year),r=W===`month`?e.map((e,t)=>({label:e,active:t+1===U.month,current:A.year===U.year&&A.month===t+1})):Array.from({length:h},(e,t)=>({label:M(n+t),active:n+t===U.year,current:A.year===n+t})),a=e=>W===`month`?{...U,month:e+1,day:1}:{...U,year:n+e,day:1},o=e=>{let t=a(e);Y.current=!0,H(f(p({...t,day:Math.min(U.day,28)},P)),{reason:`navigate`}),G(W===`year`?`month`:`day`)},s=(e,t)=>{let n=a(e);H(f({...n,day:Math.min(U.day,28)}),{reason:`keyboard`}),t?.querySelector(`[data-zoom="${e}"]`)?.focus()};return(0,u.jsx)(t.default,{display:`grid`,gridTemplateColumns:3,gap:1,props:{role:`group`,"aria-labelledby":Q},children:r.map((e,n)=>(0,u.jsx)(t.default,{tag:`button`,component:`calendar.zoomItem`,variant:{selected:e.active,today:e.current},py:2,borderRadius:2,disabled:D,props:{type:`button`,"data-zoom":n,tabIndex:e.active?0:-1,"aria-pressed":e.active,onClick:()=>o(n),onKeyDown:e=>He(e,r.length,3,o,s,n)},children:e.label},e.label))})},We=(e,n)=>{let r=ee(e.year,e.month,j),a=i.t(f(e),{locale:k,month:`long`,year:`numeric`});return(0,u.jsxs)(t.default,{tag:`table`,css:{borderCollapse:`collapse`,tableLayout:`fixed`},props:{role:`grid`,"aria-label":T>1?a:void 0,"aria-labelledby":T>1?void 0:Q,"aria-readonly":ge||void 0,onKeyDown:je},children:[(0,u.jsx)(t.default,{tag:`thead`,display:`table-header-group`,children:(0,u.jsxs)(t.default,{tag:`tr`,display:`table-row`,children:[E&&(0,u.jsx)(t.default,{tag:`th`,display:`table-cell`,component:`calendar.weekday`,props:{"aria-hidden":!0}}),Re.map(e=>(0,u.jsx)(t.default,{tag:`th`,display:`table-cell`,component:`calendar.weekday`,pb:1,fontSize:12,props:{scope:`col`,abbr:Le[e]},children:Ie[e]},e))]})}),(0,u.jsx)(t.default,{tag:`tbody`,display:`table-row-group`,children:r.map(e=>(0,u.jsxs)(t.default,{tag:`tr`,display:`table-row`,children:[E&&(0,u.jsx)(t.default,{tag:`td`,display:`table-cell`,component:`calendar.weekNumber`,fontSize:11,textAlign:`center`,props:{role:`rowheader`},children:M(e.week)}),e.days.map(Ve)]},e.days[0].date))})]},n)};return(0,u.jsxs)(t.default,{ref:Ee,component:`calendar`,display:`inline-block`,...Se,variant:[Se.variant,{disabled:D}],props:{role:ve?`group`:void 0,"aria-label":ve,...xe,onPointerLeave:()=>R&&B(R)},children:[(0,u.jsxs)(t.default,{position:`relative`,minHeight:8,mb:2,children:[(0,u.jsx)(t.default,{tag:`button`,component:`calendar.nav`,position:`absolute`,top:0,insetStart:0,display:`inline-flex`,ai:`center`,jc:`center`,width:8,height:8,borderRadius:2,disabled:D,props:{type:`button`,"aria-label":ye,onClick:()=>Me(-1)},children:(0,u.jsx)(x,{direction:-1})}),Ne?(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(t.default,{display:`flex`,gap:4,children:Z.map(e=>(0,u.jsx)(t.default,{flex1:!0,textAlign:`center`,py:1.5,fontSize:14,fontWeight:600,props:{"aria-hidden":!0},children:i.t(f(e),{locale:k,month:`long`,year:`numeric`})},f(e)))}),(0,u.jsx)(c.default,{id:Q,props:{"aria-live":`polite`},children:Pe})]}):(0,u.jsx)(t.default,{display:`flex`,jc:`center`,px:9,children:(0,u.jsx)(t.default,{tag:`button`,component:`calendar.title`,py:1.5,px:3,borderRadius:2,fontSize:14,id:Q,disabled:D||W===`year`,props:{type:`button`,"aria-live":`polite`,onClick:()=>G(W===`day`?`month`:`year`)},children:Pe})}),(0,u.jsx)(t.default,{tag:`button`,component:`calendar.nav`,position:`absolute`,top:0,insetEnd:0,display:`inline-flex`,ai:`center`,jc:`center`,width:8,height:8,borderRadius:2,disabled:D,props:{type:`button`,"aria-label":be,onClick:()=>Me(1)},children:(0,u.jsx)(x,{direction:1})})]}),W===`day`?(0,u.jsx)(t.default,{display:`flex`,gap:4,ai:`start`,children:Z.map(We)}):Ue()]})}function v(e){return e.year*12+e.month-1}var y=new Map;function oe(e){let t=y.get(e);return t||(t=new Intl.NumberFormat(e,{useGrouping:!1}),y.set(e,t)),t}function b(e){return e-(e%h+h)%h}function x({direction:e}){return(0,u.jsx)(o.Svg,{viewBox:`0 0 16 16`,width:`1rem`,height:`1rem`,rtl:{flip:`xAxis`},props:{fill:`none`},children:(0,u.jsx)(o.Path,{d:e===1?`M6 3l5 5-5 5`:`M10 3L5 8l5 5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`})})}var S=_;S.displayName=`Calendar`,exports.default=S;
@@ -0,0 +1,77 @@
1
+ import { BoxProps } from '../box';
2
+ import { ChangeHandler } from '../react/a11y/useControllableState';
3
+ import { DateChangeDetails, DateChangeReason } from '../react/date/dateChange';
4
+ import { ComponentsAndVariants } from '@box-kite/core/types';
5
+ import { ZoneInput } from '../utils/date/zones';
6
+ /** A span of days, both ends included, `start` never after `end`. */
7
+ export interface DateRange {
8
+ start: string;
9
+ end: string;
10
+ }
11
+ /** Which grid is on show: days, the months of a year, or a run of years. */
12
+ export type CalendarView = 'day' | 'month' | 'year';
13
+ type CalendarBoxProps<TKey extends keyof ComponentsAndVariants> = Omit<BoxProps<'div', TKey>, 'onChange' | 'disabled' | 'defaultValue' | 'readOnly'>;
14
+ interface BaseProps<TKey extends keyof ComponentsAndVariants> extends CalendarBoxProps<TKey> {
15
+ /** The earliest day that can be chosen, `YYYY-MM-DD`. The arrows stop there too. */
16
+ min?: string | null;
17
+ /** The latest day that can be chosen. */
18
+ max?: string | null;
19
+ /** Days that can be reached but not chosen — a weekend, a holiday. A range is refused across one. */
20
+ isDateUnavailable?: (date: string) => boolean;
21
+ /** The language of the month and weekday names, and whose week it is. Default the reader's. */
22
+ locale?: string;
23
+ /** Whose "today" is marked. Default the reader's zone. */
24
+ zone?: ZoneInput;
25
+ /** The day the week starts on, 0 for Sunday. Default the locale's. */
26
+ firstDayOfWeek?: number;
27
+ /** How many months side by side. Default 1. */
28
+ months?: 1 | 2 | 3;
29
+ /** A leading column of ISO week numbers. */
30
+ weekNumbers?: boolean;
31
+ /** Whether the days that complete the first and last weeks are drawn. Default `true`. */
32
+ showOutsideDays?: boolean;
33
+ /** The day the keyboard is on, which decides the month on show. Controlled. */
34
+ focusedDate?: string;
35
+ /** Where the keyboard starts when the calendar owns it. Default the value, or today. */
36
+ defaultFocusedDate?: string;
37
+ /** Fires when the keyboard or the paging buttons move to another day. */
38
+ onFocusedDateChange?: ChangeHandler<string, 'keyboard' | 'navigate'>;
39
+ /** Nothing can be chosen and nothing is focusable. */
40
+ disabled?: boolean;
41
+ /** Can be read and navigated, but not chosen in. */
42
+ readOnly?: boolean;
43
+ /** Focus the day the keyboard is on, on mount — what a picker's panel wants. */
44
+ autoFocus?: boolean;
45
+ /** The calendar's accessible name, which a screen reader hears before the month. */
46
+ label?: string;
47
+ /** What the paging buttons are called. Default `'Previous'` and `'Next'`. */
48
+ /** The previous-page button's name. Default `'Previous'`. */
49
+ previousLabel?: string;
50
+ /** The next-page button's name. Default `'Next'`. */
51
+ nextLabel?: string;
52
+ }
53
+ /** One day at a time, which is the default: the value is a `YYYY-MM-DD` string or `null`. */
54
+ interface SingleProps {
55
+ /** One day (default), or `'range'` for a start and an end. */
56
+ mode?: 'single';
57
+ /** The chosen day, `YYYY-MM-DD`, or `null`. Controlled. */
58
+ value?: string | null;
59
+ /** The day it starts with when the calendar owns its value. */
60
+ defaultValue?: string | null;
61
+ /** Fires with the day and its readings. */
62
+ onValueChange?: ChangeHandler<string | null, DateChangeReason, DateChangeDetails>;
63
+ }
64
+ /** A start and an end: the first press anchors the range and the second ends it, whichever way round. */
65
+ interface RangeProps {
66
+ /** `'range'` is what turns the value into `{ start, end }`. */
67
+ mode: 'range';
68
+ /** The chosen span, or `null`. Controlled. */
69
+ value?: DateRange | null;
70
+ /** The span it starts with when the calendar owns its value. */
71
+ defaultValue?: DateRange | null;
72
+ /** Fires once both ends are chosen, start first whichever was picked first. */
73
+ onValueChange?: ChangeHandler<DateRange | null, DateChangeReason>;
74
+ }
75
+ export type CalendarProps<TKey extends keyof ComponentsAndVariants = 'calendar'> = BaseProps<TKey> & (SingleProps | RangeProps);
76
+ declare const _default: <TKey extends keyof ComponentsAndVariants = "calendar">(props: CalendarProps<TKey>) => React.ReactNode;
77
+ export default _default;