@box-kite/react 2.2.8 → 2.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/date-input.cjs CHANGED
@@ -1 +1 @@
1
- const e=require("./dates.cjs");var t=new Map;function n(n){let r=t.get(n);return r||(r=e.a(n,{year:`numeric`,month:`numeric`,day:`numeric`,timeZone:`UTC`}).formatToParts(Date.UTC(2026,10,23)).map(e=>e.type).filter(e=>e===`year`||e===`month`||e===`day`),t.set(n,r)),r}var r=/(\d{1,2})\s*[:h]\s*(\d{2})(?:\s*:\s*(\d{2})(?:[.,](\d{1,3}))?)?|(\d{1,2})(?=\s*(?:a\.?\s*m\.?|p\.?\s*m\.?)(?![\p{L}]))/iu;function i(e,t){return e.toLocaleLowerCase(t).normalize(`NFC`)}function a(e){let t=new Map([[`today`,0],[`now`,0],[`tomorrow`,1],[`yesterday`,-1]]);try{let n=new Intl.RelativeTimeFormat(e,{numeric:`auto`});for(let r of[-1,0,1])t.set(i(n.format(r,`day`),e),r)}catch{}return t}function o(e,t){let n=Number(e);if(e.length>2)return n;let r=Math.floor(t/100)*100+n;return r>t+50?r-100:r<t-50?r+100:r}function s(t,n){let a=r.exec(t);if(!a)return{rest:t};let o=t.slice(a.index+a[0].length),[s,c]=e.v(n).map(e=>i(e,n).replace(/\./g,``)),l=/^\s*([\p{L}.]+)/u.exec(o)?.[1].replace(/\./g,``)??``,u=l!==``&&(l===c||/^pm?$/.test(l)),d=l!==``&&(l===s||/^am?$/.test(l)),f=Number(a[1]??a[5]);u&&f<12&&(f+=12),d&&f===12&&(f=0);let p={...e.V,year:1970,month:1,day:1,hour:f,minute:Number(a[2]??0),second:Number(a[3]??0),millisecond:Number((a[4]??``).padEnd(3,`0`))||0},m=a[0].length+(u||d?/^\s*[\p{L}.]+/u.exec(o)?.[0].length??0:0);return{time:e.X(p)?p:void 0,rest:t.slice(0,a.index)+` `+t.slice(a.index+m)}}function c(t,r,s){let c=t.match(/\d+|[\p{L}]+/gu)??[];if(c.length===0)return;let l=a(r);for(let t of c){let n=l.get(t);if(n!==void 0)return{...e.U(s,n),...e.V}}let u=[...e.x(r,`long`),...e.x(r,`short`),...e.x(`en`,`long`)].map(e=>i(e,r).replace(/\.$/,``)),d,f=[];for(let e of c)if(/^\d+$/.test(e))f.push(e);else if(d===void 0&&e.length>=3){let t=u.findIndex(t=>t.startsWith(e)||e.startsWith(t));t>=0&&(d=t%12+1)}if(f.length===0&&d===void 0)return;let p=n(r);f[0]?.length>=3&&(p=[`year`,`month`,`day`]),d===void 0?f.length===2&&(p=p.filter(e=>e!==`year`)):p=p.filter(e=>e!==`month`);let m={month:d};p.forEach((e,t)=>{let n=f[t];n!==void 0&&(m[e]=e===`year`?o(n,s.year):Number(n))});let h={...e.V,year:m.year??s.year,month:m.month??NaN,day:m.day??(d===void 0?NaN:1)};return e.Y(h)?h:null}function l(t,n={}){let r=e.f(t,n.disambiguation),a=t=>{let r=t&&n.kind?e.l(t,n.kind,n):t;return r?e.E(r):null};if(r)return a(r);if(typeof t!=`string`)return null;let o=n.locale??e.I(),l=e.f(n.reference??Date.now()),u=l?e.m(l,n.zone??`local`):{year:1970,month:1,day:1,...e.V},{time:d,rest:f}=n.kind===`date`?{time:void 0,rest:t}:s(i(t,o),o),p=n.kind===`time`?void 0:c(n.kind===`date`?i(f,o):f,o,u);if(p===null||!p&&!d)return null;let m=p??void 0;return m&&d?a({kind:`datetime`,fields:{...m,hour:d.hour,minute:d.minute,second:d.second,millisecond:d.millisecond},offset:0}):m?a({kind:`date`,fields:m,offset:0}):d?a({kind:`time`,fields:d,offset:0}):null}var u=new Set([`year`,`month`,`day`,`hour`,`minute`,`second`,`dayPeriod`]);function d(t){let n=t.type===`time`?{}:{year:`numeric`,month:`2-digit`,day:`2-digit`},r=t.type===`date`?{}:{hour:`2-digit`,minute:`2-digit`,...t.granularity===`second`?{second:`2-digit`}:{},hourCycle:t.hourCycle===12?`h12`:`h23`},i=e.a(t.locale,{...n,...r,calendar:`gregory`,numberingSystem:`latn`,timeZone:`UTC`}).formatToParts(Date.UTC(2026,10,23,15,45,30)),a=[];for(let t of i)if(u.has(t.type))a.push({type:t.type,text:``});else if(t.type===`literal`){let n=a[a.length-1];n?.type===`literal`?n.text+=e.o(t.value):a.push({type:`literal`,text:e.o(t.value)})}for(;a[0]?.type===`literal`;)a.shift();for(;a[a.length-1]?.type===`literal`;)a.pop();return a}function f(e){return e.filter(e=>e.type!==`literal`).map(e=>e.type)}function p(t,n,r){switch(t){case`year`:return{min:1,max:9999};case`month`:return{min:1,max:12};case`day`:return{min:1,max:n.month?e.K(n.year??2e3,n.month):31};case`hour`:return r.hourCycle===12?{min:1,max:12}:{min:0,max:23};case`dayPeriod`:return{min:0,max:1};default:return{min:0,max:59}}}function m(e,t){return t[e]??0}function h(t,n,r,i,a){let o=t[n];if(o===void 0)return{...t,[n]:m(n,a)};let{min:s,max:c}=p(n,t,i);return{...t,[n]:s+e.Q(o-s+r,c-s+1)}}var g={year:5,month:2,day:7,hour:2,minute:15,second:15,dayPeriod:1};function _(e,t,n,r,i){let{min:a,max:o}=p(t,e,i),s=t===`year`?4:String(o).length,c=n+r;(Number(c)>o||c.length>s)&&(c=r);let l=Number(c),u=l>=a&&l<=o?l:void 0;return{draft:{...e,[t]:u},buffer:c,advance:c.length>=s||l*10>o}}function v(t,n,r){let i=n.toLocaleLowerCase(r),[a,o]=e.v(r).map(e=>e.toLocaleLowerCase(r));return i===`a`||a.startsWith(i)?{...t,dayPeriod:0}:i===`p`||o.startsWith(i)?{...t,dayPeriod:1}:null}var y={year:`yyyy`,month:`mm`,day:`dd`,hour:`hh`,minute:`mm`,second:`ss`};function b(t,n,r,i){let a=n[t];return t===`dayPeriod`?e.v(i)[a??0]:r&&(a===void 0||t===`year`)?r:a===void 0?y[t]:String(a).padStart(t===`year`?4:2,`0`)}function x(e,t){return f(t).every(t=>e[t]!==void 0)}function S(e,t){let n=e.hour??0;return t.hourCycle===12?n%12+(e.dayPeriod??0)*12:n}function C(t,n,r,i){if(!x(t,n))return null;let a=t.year??1970,o=t.month??1,s={year:a,month:o,day:Math.min(t.day??1,e.K(a,o)),hour:r.type===`date`?0:S(t,r),minute:t.minute??0,second:t.second??0,millisecond:0};if(r.type===`date`)return e.E({kind:`date`,fields:s,offset:0});if(r.type===`time`)return e.E({kind:`time`,fields:{...s,year:1970,month:1,day:1},offset:0});if(i.zone===null)return e.E({kind:`datetime`,fields:s,offset:0});let c=e.N(s,i.zone,i.disambiguation??`compatible`);return c===null?null:e.E(e.d(c,i.zone))}function w(t,n,r){let i=e.f(t);if(!i)return{};let a=n.type===`datetime`?`datetime`:n.type,o=e.l(i,a,{zone:r??void 0});if(!o)return{};let{year:s,month:c,day:l,hour:u,minute:d,second:f}=o.fields,p={};return n.type!==`time`&&Object.assign(p,{year:s,month:c,day:l}),n.type!==`date`&&(Object.assign(p,{minute:d,second:f}),n.hourCycle===12?Object.assign(p,{hour:u%12||12,dayPeriod:+(u>=12)}):p.hour=u),p}function T(e){let t=Math.max(1,Math.round(e)),n=[];for(let e=0;e<1440;e+=t)n.push(`${String(Math.floor(e/60)).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}:00`);return n}function E(e,t){let n=e&&/^(\d{2}):(\d{2})/.exec(e);if(!n)return null;let r=Math.max(1,Math.round(t)),i=Math.floor((Number(n[1])*60+Number(n[2]))/r)*r;return`${String(Math.floor(i/60)).padStart(2,`0`)}:${String(i%60).padStart(2,`0`)}:00`}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 v}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return _}});
1
+ const e=require("./dates.cjs");var t=new Map;function n(n){let r=t.get(n);return r||(r=e.a(n,{year:`numeric`,month:`numeric`,day:`numeric`,timeZone:`UTC`}).formatToParts(Date.UTC(2026,10,23)).map(e=>e.type).filter(e=>e===`year`||e===`month`||e===`day`),t.set(n,r)),r}var r=/(\d{1,2})\s*[:h]\s*(\d{2})(?:\s*:\s*(\d{2})(?:[.,](\d{1,3}))?)?|(\d{1,2})(?=\s*(?:a\.?\s*m\.?|p\.?\s*m\.?)(?![\p{L}]))/iu;function i(e,t){return e.toLocaleLowerCase(t).normalize(`NFC`)}function a(e){let t=new Map([[`today`,0],[`now`,0],[`tomorrow`,1],[`yesterday`,-1]]);try{let n=new Intl.RelativeTimeFormat(e,{numeric:`auto`});for(let r of[-1,0,1])t.set(i(n.format(r,`day`),e),r)}catch{}return t}function o(e,t){let n=Number(e);if(e.length>2)return n;let r=Math.floor(t/100)*100+n;return r>t+50?r-100:r<t-50?r+100:r}function s(t,n){let a=r.exec(t);if(!a)return{rest:t};let o=t.slice(a.index+a[0].length),[s,c]=e.v(n).map(e=>i(e,n).replace(/\./g,``)),l=/^\s*([\p{L}.]+)/u.exec(o)?.[1].replace(/\./g,``)??``,u=l!==``&&(l===c||/^pm?$/.test(l)),d=l!==``&&(l===s||/^am?$/.test(l)),f=Number(a[1]??a[5]);u&&f<12&&(f+=12),d&&f===12&&(f=0);let p={...e.V,year:1970,month:1,day:1,hour:f,minute:Number(a[2]??0),second:Number(a[3]??0),millisecond:Number((a[4]??``).padEnd(3,`0`))||0},m=a[0].length+(u||d?/^\s*[\p{L}.]+/u.exec(o)?.[0].length??0:0);return{time:e.X(p)?p:void 0,rest:t.slice(0,a.index)+` `+t.slice(a.index+m)}}function c(t,r,s){let c=t.match(/\d+|[\p{L}]+/gu)??[];if(c.length===0)return;let l=a(r);for(let t of c){let n=l.get(t);if(n!==void 0)return{...e.U(s,n),...e.V}}let u=[...e.x(r,`long`),...e.x(r,`short`),...e.x(`en`,`long`)].map(e=>i(e,r).replace(/\.$/,``)),d,f=[];for(let e of c)if(/^\d+$/.test(e))f.push(e);else if(d===void 0&&e.length>=3){let t=u.findIndex(t=>t.startsWith(e)||e.startsWith(t));t>=0&&(d=t%12+1)}if(f.length===0&&d===void 0)return;let p=n(r);f[0]?.length>=3&&(p=[`year`,`month`,`day`]),d===void 0?f.length===2&&(p=p.filter(e=>e!==`year`)):p=p.filter(e=>e!==`month`);let m={month:d};p.forEach((e,t)=>{let n=f[t];n!==void 0&&(m[e]=e===`year`?o(n,s.year):Number(n))});let h={...e.V,year:m.year??s.year,month:m.month??NaN,day:m.day??(d===void 0?NaN:1)};return e.Y(h)?h:null}function l(t,n={}){let r=e.f(t,n.disambiguation),a=t=>{let r=t&&n.kind?e.l(t,n.kind,n):t;return r?e.E(r):null};if(r)return a(r);if(typeof t!=`string`)return null;let o=n.locale??e.I(),l=e.f(n.reference??Date.now()),u=l?e.m(l,n.zone??`local`):{year:1970,month:1,day:1,...e.V},{time:d,rest:f}=n.kind===`date`?{time:void 0,rest:t}:s(i(t,o),o),p=n.kind===`time`?void 0:c(n.kind===`date`?i(f,o):f,o,u);if(p===null||!p&&!d)return null;let m=p??void 0;return m&&d?a({kind:`datetime`,fields:{...m,hour:d.hour,minute:d.minute,second:d.second,millisecond:d.millisecond},offset:0}):m?a({kind:`date`,fields:m,offset:0}):d?a({kind:`time`,fields:d,offset:0}):null}var u=new Set([`year`,`month`,`day`,`hour`,`minute`,`second`,`dayPeriod`]);function d(t){let n=t.type===`time`?{}:{year:`numeric`,month:`2-digit`,day:`2-digit`},r=t.type===`date`?{}:{hour:`2-digit`,minute:`2-digit`,...t.granularity===`second`?{second:`2-digit`}:{},hourCycle:t.hourCycle===12?`h12`:`h23`},i=e.a(t.locale,{...n,...r,calendar:`gregory`,numberingSystem:`latn`,timeZone:`UTC`}).formatToParts(Date.UTC(2026,10,23,15,45,30)),a=[];for(let t of i)if(u.has(t.type))a.push({type:t.type,text:``});else if(t.type===`literal`){let n=a[a.length-1];n?.type===`literal`?n.text+=e.o(t.value):a.push({type:`literal`,text:e.o(t.value)})}for(;a[0]?.type===`literal`;)a.shift();for(;a[a.length-1]?.type===`literal`;)a.pop();return a}function f(e){return e.filter(e=>e.type!==`literal`).map(e=>e.type)}function p(t,n,r){switch(t){case`year`:return{min:1,max:9999};case`month`:return{min:1,max:12};case`day`:return{min:1,max:n.month?e.K(n.year??2e3,n.month):31};case`hour`:return r.hourCycle===12?{min:1,max:12}:{min:0,max:23};case`dayPeriod`:return{min:0,max:1};default:return{min:0,max:59}}}function m(e,t){return t[e]??0}function h(t,n,r,i,a){let o=t[n];if(o===void 0)return{...t,[n]:m(n,a)};let{min:s,max:c}=p(n,t,i);return{...t,[n]:s+e.Q(o-s+r,c-s+1)}}var g={year:5,month:2,day:7,hour:2,minute:15,second:15,dayPeriod:1};function _(e,t,n,r,i){let{min:a,max:o}=p(t,e,i),s=t===`year`?4:String(o).length,c=n+r;(Number(c)>o||c.length>s)&&(c=r);let l=Number(c),u=l>=a&&l<=o?l:void 0;return{draft:{...e,[t]:u},buffer:c,advance:c.length>=s||l*10>o}}function v(t,n,r){let i=n.toLocaleLowerCase(r),[a,o]=e.v(r).map(e=>e.toLocaleLowerCase(r));return i===`a`||a.startsWith(i)?{...t,dayPeriod:0}:i===`p`||o.startsWith(i)?{...t,dayPeriod:1}:null}var y={year:`yyyy`,month:`mm`,day:`dd`,hour:`hh`,minute:`mm`,second:`ss`};function b(t,n,r,i){let a=n[t];return t===`dayPeriod`?e.v(i)[a??0]:r&&(a===void 0||t===`year`)?r:a===void 0?y[t]:String(a).padStart(t===`year`?4:2,`0`)}function x(e,t){return f(t).every(t=>e[t]!==void 0)}function S(e,t){let n=e.hour??0;return t.hourCycle===12?n%12+(e.dayPeriod??0)*12:n}function C(t,n,r,i){if(!x(t,n))return null;let a=t.year??1970,o=t.month??1,s={year:a,month:o,day:Math.min(t.day??1,e.K(a,o)),hour:r.type===`date`?0:S(t,r),minute:t.minute??0,second:t.second??0,millisecond:0};if(r.type===`date`)return e.E({kind:`date`,fields:s,offset:0});if(r.type===`time`)return e.E({kind:`time`,fields:{...s,year:1970,month:1,day:1},offset:0});if(i.zone===null)return e.E({kind:`datetime`,fields:s,offset:0});let c=e.N(s,i.zone,i.disambiguation??`compatible`);return c===null?null:e.E(e.d(c,i.zone))}function w(t,n,r){let i=e.f(t);if(!i)return{};let a=n.type===`datetime`?`datetime`:n.type,o=e.l(i,a,{zone:r??void 0});if(!o)return{};let{year:s,month:c,day:l,hour:u,minute:d,second:f}=o.fields,p={};return n.type!==`time`&&Object.assign(p,{year:s,month:c,day:l}),n.type!==`date`&&(Object.assign(p,{minute:d,second:f}),n.hourCycle===12?Object.assign(p,{hour:u%12||12,dayPeriod:+(u>=12)}):p.hour=u),p}function T(e,t={}){let n=Math.max(1,Math.round(e)),r=[];for(let e=0;e<1440;e+=n)r.push(`${String(Math.floor(e/60)).padStart(2,`0`)}:${String(e%60).padStart(2,`0`)}:00`);let{min:i,max:a}=t;return i||a?r.filter(e=>(!i||e>=i)&&(!a||e<=a)):r}function E(e,t){let n=e&&/^(\d{2}):(\d{2})/.exec(e);if(!n)return null;let r=Math.max(1,Math.round(t)),i=Math.floor((Number(n[1])*60+Number(n[2]))/r)*r;return`${String(Math.floor(i/60)).padStart(2,`0`)}:${String(i%60).padStart(2,`0`)}:00`}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 v}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return _}});
package/date-input.mjs CHANGED
@@ -331,10 +331,11 @@ function B(e, t, n) {
331
331
  dayPeriod: +(l >= 12)
332
332
  }) : m.hour = l), m;
333
333
  }
334
- function V(e) {
335
- let t = Math.max(1, Math.round(e)), n = [];
336
- for (let e = 0; e < 1440; e += t) n.push(`${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}:00`);
337
- return n;
334
+ function V(e, t = {}) {
335
+ let n = Math.max(1, Math.round(e)), r = [];
336
+ for (let e = 0; e < 1440; e += n) r.push(`${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}:00`);
337
+ let { min: i, max: a } = t;
338
+ return i || a ? r.filter((e) => (!i || e >= i) && (!a || e <= a)) : r;
338
339
  }
339
340
  function H(e, t) {
340
341
  let n = e && /^(\d{2}):(\d{2})/.exec(e);
package/docs/props.md CHANGED
@@ -1474,10 +1474,10 @@ The scale CSS property lets you specify scale transforms individually and indepe
1474
1474
 
1475
1475
  ### `scrollbarColor`
1476
1476
 
1477
- The scrollbar-color CSS property sets the color of the scrollbar thumb and track. The value pair is [thumbColor, trackColor].
1477
+ The scrollbar-color CSS property sets the color of the scrollbar thumb and track. The value pair is [thumbColor, trackColor], each a palette token or a `Box.extend()` colour, and either may carry an opacity (`gray-400/50`).
1478
1478
 
1479
1479
  - Writes: `scrollbar-color`
1480
- - Values: `currentColor,transparent,green,red,blue,gray,black,white,vi,slate-50,slate-100,slate-200,slate-300,slate-400,slate-500,slate-600,slate-700,slate-800,slate-900,slate-950,gray-50,gray-100,gray-200,gray-300,gray-400,gray-500,gray-600,gray-700,gray-800,gray-900,gray-950,zinc-50,zinc-100,zinc-200,zinc-300,zinc-400,zinc-500,zinc-600,zinc-700,zinc-800,zinc-900,zinc-950,neutral-50,neutral-100,neutral-200,neutral-300,neutral-400,neutral-500,neutral-600,neutral-700,neutral-800,neutral-900,neutral-950,stone-50,stone-100,stone-200,stone-300,stone-400,stone-500,stone-600,stone-700,stone-800,stone-900,stone-950,mauve-50,mauve-100,mauve-200,mauve-300,mauve-400,mauve-500,mauve-600,mauve-700,mauve-800,mauve-900,mauve-950,mist-50,mist-100,mist-200,mist-300,mist-400,mist-500,mist-600,mist-700,mist-800,mist-900,mist-950,olive-50,olive-100,olive-200,olive-300,olive-400,olive-500,olive-600,olive-700,olive-800,olive-900,olive-950,taupe-50,taupe-100,taupe-200,taupe-300,taupe-400,taupe-500,taupe-600,taupe-700,taupe-800,taupe-900,taupe-950,red-50,red-100,red-200,red-300,red-400,red-500,red-600,red-700,red-800,red-900,red-950,orange-50,orange-100,orange-200,orange-300,orange-400,orange-500,orange-600,orange-700,orange-800,orange-900,orange-950,amber-50,amber-100,amber-200,amber-300,amber-400,amber-500,amber-600,amber-700,amber-800,amber-900,amber-950,yellow-50,yellow-100,yellow-200,yellow-300,yellow-400,yellow-500,yellow-600,yellow-700,yellow-800,yellow-900,yellow-950,lime-50,lime-100,lime-200,lime-300,lime-400,lime-500,lime-600,lime-700,lime-800,lime-900,lime-950,green-50,green-100,green-200,green-300,green-400,green-500,green-600,green-700,green-800,green-900,green-950,emerald-50,emerald-100,emerald-200,emerald-300,emerald-400,emerald-500,emerald-600,emerald-700,emerald-800,emerald-900,emerald-950,teal-50,teal-100,teal-200,teal-300,teal-400,teal-500,teal-600,teal-700,teal-800,teal-900,teal-950,cyan-50,cyan-100,cyan-200,cyan-300,cyan-400,cyan-500,cyan-600,cyan-700,cyan-800,cyan-900,cyan-950,sky-50,sky-100,sky-200,sky-300,sky-400,sky-500,sky-600,sky-700,sky-800,sky-900,sky-950,blue-50,blue-100,blue-200,blue-300,blue-400,blue-500,blue-600,blue-700,blue-800,blue-900,blue-950,indigo-50,indigo-100,indigo-200,indigo-300,indigo-400,indigo-500,indigo-600,indigo-700,indigo-800,indigo-900,indigo-950,violet-50,violet-100,violet-200,violet-300,violet-400,violet-500,violet-600,violet-700,violet-800,violet-900,violet-950,purple-50,purple-100,purple-200,purple-300,purple-400,purple-500,purple-600,purple-700,purple-800,purple-900,purple-950,fuchsia-50,fuchsia-100,fuchsia-200,fuchsia-300,fuchsia-400,fuchsia-500,fuchsia-600,fuchsia-700,fuchsia-800,fuchsia-900,fuchsia-950,pink-50,pink-100,pink-200,pink-300,pink-400,pink-500,pink-600,pink-700,pink-800,pink-900,pink-950,rose-50,rose-100,rose-200,rose-300,rose-400,rose-500,rose-600,rose-700,rose-800,rose-900,rose-950,accent-50,accent-100,accent-200,accent-300,accent-400,accent-500,accent-600,accent-700,accent-800,accent-900,accent-950,base-50,base-100,base-200,base-300,base-400,base-500,base-600,base-700,base-800,base-900,base-950,none`
1480
+ - Values: 318 named values, anything else the types allow
1481
1481
  - Example: `scrollbarColor={['gray-400', 'gray-100']}` → `scrollbar-color: var(--gray-400,oklch(70.7% .022 261.3)) var(--gray-100,oklch(96.7% .003 264.5))`
1482
1482
 
1483
1483
  ### `scrollbarGutter`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box-kite/react",
3
- "version": "2.2.8",
3
+ "version": "2.2.10",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "pages/**"
@@ -131,7 +131,7 @@
131
131
  "./interactionListening.mjs"
132
132
  ],
133
133
  "gzip": true,
134
- "limit": "40.90 kB"
134
+ "limit": "41.00 kB"
135
135
  },
136
136
  {
137
137
  "name": "Box in a Server Component (react-server entry)",
@@ -144,7 +144,7 @@
144
144
  "./interactionListening.mjs"
145
145
  ],
146
146
  "gzip": true,
147
- "limit": "38.30 kB"
147
+ "limit": "38.38 kB"
148
148
  },
149
149
  {
150
150
  "name": "Behavior primitives (a11y entry)",
@@ -183,7 +183,7 @@
183
183
  "./interactionListening.mjs"
184
184
  ],
185
185
  "gzip": true,
186
- "limit": "61.84 kB"
186
+ "limit": "62.09 kB"
187
187
  },
188
188
  {
189
189
  "name": "Spec renderer (spec entry)",
@@ -196,7 +196,7 @@
196
196
  "./interactionListening.mjs"
197
197
  ],
198
198
  "gzip": true,
199
- "limit": "4.72 kB"
199
+ "limit": "4.75 kB"
200
200
  },
201
201
  {
202
202
  "name": "Ecosystem interop (interop entry)",
@@ -241,7 +241,7 @@
241
241
  "name": "Core engine (@box-kite/core, no React)",
242
242
  "path": "dist-core/core.mjs",
243
243
  "gzip": true,
244
- "limit": "39.43 kB",
244
+ "limit": "39.61 kB",
245
245
  "ignore": [
246
246
  "./diagnostics-*",
247
247
  "./themeReveal-*",
@@ -259,7 +259,7 @@
259
259
  "./interactionListening.mjs"
260
260
  ],
261
261
  "gzip": true,
262
- "limit": "43.16 kB"
262
+ "limit": "43.25 kB"
263
263
  },
264
264
  {
265
265
  "name": "Popover",
@@ -272,7 +272,7 @@
272
272
  "./interactionListening.mjs"
273
273
  ],
274
274
  "gzip": true,
275
- "limit": "44.70 kB"
275
+ "limit": "44.80 kB"
276
276
  },
277
277
  {
278
278
  "name": "Menu",
@@ -285,7 +285,7 @@
285
285
  "./interactionListening.mjs"
286
286
  ],
287
287
  "gzip": true,
288
- "limit": "47.07 kB"
288
+ "limit": "47.17 kB"
289
289
  },
290
290
  {
291
291
  "name": "Accordion",
@@ -298,7 +298,7 @@
298
298
  "./interactionListening.mjs"
299
299
  ],
300
300
  "gzip": true,
301
- "limit": "42.42 kB"
301
+ "limit": "42.52 kB"
302
302
  },
303
303
  {
304
304
  "name": "Agent",
@@ -311,7 +311,7 @@
311
311
  "./interactionListening.mjs"
312
312
  ],
313
313
  "gzip": true,
314
- "limit": "43.19 kB"
314
+ "limit": "43.31 kB"
315
315
  },
316
316
  {
317
317
  "name": "Markdown",
@@ -324,7 +324,7 @@
324
324
  "./interactionListening.mjs"
325
325
  ],
326
326
  "gzip": true,
327
- "limit": "41.47 kB"
327
+ "limit": "41.57 kB"
328
328
  },
329
329
  {
330
330
  "name": "List",
@@ -337,7 +337,7 @@
337
337
  "./interactionListening.mjs"
338
338
  ],
339
339
  "gzip": true,
340
- "limit": "42.84 kB"
340
+ "limit": "42.93 kB"
341
341
  },
342
342
  {
343
343
  "name": "SwipeItem",
@@ -350,7 +350,7 @@
350
350
  "./interactionListening.mjs"
351
351
  ],
352
352
  "gzip": true,
353
- "limit": "46.12 kB"
353
+ "limit": "46.22 kB"
354
354
  },
355
355
  {
356
356
  "name": "SortableList",
@@ -363,7 +363,7 @@
363
363
  "./interactionListening.mjs"
364
364
  ],
365
365
  "gzip": true,
366
- "limit": "46.44 kB"
366
+ "limit": "46.53 kB"
367
367
  },
368
368
  {
369
369
  "name": "VirtualList",
@@ -376,7 +376,7 @@
376
376
  "./interactionListening.mjs"
377
377
  ],
378
378
  "gzip": true,
379
- "limit": "45.00 kB"
379
+ "limit": "45.11 kB"
380
380
  },
381
381
  {
382
382
  "name": "Skeleton",
@@ -389,7 +389,7 @@
389
389
  "./interactionListening.mjs"
390
390
  ],
391
391
  "gzip": true,
392
- "limit": "40.82 kB"
392
+ "limit": "40.92 kB"
393
393
  },
394
394
  {
395
395
  "name": "Tabs",
@@ -402,7 +402,7 @@
402
402
  "./interactionListening.mjs"
403
403
  ],
404
404
  "gzip": true,
405
- "limit": "43.61 kB"
405
+ "limit": "43.73 kB"
406
406
  },
407
407
  {
408
408
  "name": "Slider",
@@ -415,7 +415,7 @@
415
415
  "./interactionListening.mjs"
416
416
  ],
417
417
  "gzip": true,
418
- "limit": "42.75 kB"
418
+ "limit": "42.85 kB"
419
419
  },
420
420
  {
421
421
  "name": "Progress",
@@ -428,7 +428,7 @@
428
428
  "./interactionListening.mjs"
429
429
  ],
430
430
  "gzip": true,
431
- "limit": "40.77 kB"
431
+ "limit": "40.87 kB"
432
432
  },
433
433
  {
434
434
  "name": "Toaster",
@@ -441,7 +441,7 @@
441
441
  "./interactionListening.mjs"
442
442
  ],
443
443
  "gzip": true,
444
- "limit": "44.41 kB"
444
+ "limit": "44.51 kB"
445
445
  },
446
446
  {
447
447
  "name": "DateField",
@@ -454,7 +454,7 @@
454
454
  "./interactionListening.mjs"
455
455
  ],
456
456
  "gzip": true,
457
- "limit": "49.64 kB"
457
+ "limit": "49.76 kB"
458
458
  },
459
459
  {
460
460
  "name": "Calendar",
@@ -467,7 +467,7 @@
467
467
  "./interactionListening.mjs"
468
468
  ],
469
469
  "gzip": true,
470
- "limit": "49.09 kB"
470
+ "limit": "49.18 kB"
471
471
  },
472
472
  {
473
473
  "name": "DatePicker",
@@ -480,7 +480,7 @@
480
480
  "./interactionListening.mjs"
481
481
  ],
482
482
  "gzip": true,
483
- "limit": "61.85 kB"
483
+ "limit": "62.92 kB"
484
484
  },
485
485
  {
486
486
  "name": "DateTime",
@@ -493,7 +493,7 @@
493
493
  "./interactionListening.mjs"
494
494
  ],
495
495
  "gzip": true,
496
- "limit": "44.35 kB"
496
+ "limit": "44.44 kB"
497
497
  },
498
498
  {
499
499
  "name": "TimeZoneSelect",
@@ -506,7 +506,7 @@
506
506
  "./interactionListening.mjs"
507
507
  ],
508
508
  "gzip": true,
509
- "limit": "52.22 kB"
509
+ "limit": "52.30 kB"
510
510
  },
511
511
  {
512
512
  "name": "Combobox",
@@ -519,7 +519,7 @@
519
519
  "./interactionListening.mjs"
520
520
  ],
521
521
  "gzip": true,
522
- "limit": "50.20 kB"
522
+ "limit": "50.29 kB"
523
523
  },
524
524
  {
525
525
  "name": "Dashboard",
@@ -532,7 +532,7 @@
532
532
  "./interactionListening.mjs"
533
533
  ],
534
534
  "gzip": true,
535
- "limit": "46.74 kB"
535
+ "limit": "46.84 kB"
536
536
  },
537
537
  {
538
538
  "name": "DataGrid",
@@ -547,7 +547,7 @@
547
547
  "../dataGridDateParts.mjs"
548
548
  ],
549
549
  "gzip": true,
550
- "limit": "97.40 kB"
550
+ "limit": "97.48 kB"
551
551
  },
552
552
  {
553
553
  "name": "Interaction delivery, the chunk the first Box.onInteraction fetches",
@@ -613,7 +613,7 @@
613
613
  "./interactionListening.mjs"
614
614
  ],
615
615
  "gzip": true,
616
- "limit": "165.71 kB"
616
+ "limit": "166.83 kB"
617
617
  }
618
618
  ],
619
619
  "repository": {
@@ -653,7 +653,7 @@
653
653
  "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
654
654
  },
655
655
  "dependencies": {
656
- "@box-kite/core": "2.2.8",
656
+ "@box-kite/core": "2.2.10",
657
657
  "csstype": "^3.2.3",
658
658
  "use-sync-external-store": "^1.6.0"
659
659
  },
package/spec.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./effects.cjs"),t=require("./specSchema.cjs"),n=require("./specData.cjs");let r=require("react"),i=require("react/jsx-runtime");var a;(function(e){let t=[`__proto__`,`constructor`,`prototype`],n=new Map;function r(e){if(!n.has(e))try{n.set(e,new RegExp(e))}catch{n.set(e,null)}return n.get(e)??null}function i(e){return!t.includes(e)}e.isSafeKey=i;function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isPlainObject=a;function o(e,t){if(!e.$ref)return e;let n=e.$ref.startsWith(`#/$defs/`)?e.$ref.slice(8):null,r=n?t.$defs?.[n]:void 0;return r?o(r,t):null}function s(e,t,n){return!a(t)||e.required?.some(e=>!(e in t))?!1:Object.keys(t).every(r=>{let a=e.properties?.[r];return a?i(r)&&c(a,t[r],n):e.additionalProperties!==!1&&i(r)})}function c(e,t,n=e){let i=o(e,n);if(!i)return!1;if(i.anyOf)return i.anyOf.some(e=>c(e,t,n));if(i.enum&&!i.enum.includes(t))return!1;switch(i.type){case`string`:return typeof t==`string`?!i.pattern||(r(i.pattern)?.test(t)??!1):!1;case`number`:return typeof t==`number`&&Number.isFinite(t);case`integer`:return typeof t==`number`&&Number.isInteger(t);case`boolean`:return typeof t==`boolean`;case`array`:return Array.isArray(t)&&(!i.items||t.every(e=>c(i.items,e,n)));case`object`:return s(i,t,n);default:return t!==void 0}}e.matches=c})(a||={});var o=a,s;(function(e){function t(e){let t=JSON.stringify(e)??`undefined`;return t.length>40?`${t.slice(0,39)}…`:t}function r(e,t){return typeof e==`string`?{action:e}:!o.isPlainObject(e)||typeof e.action!=`string`?null:{action:e.action,payload:n.t.deep(e.payload,t)}}function i(e,i,a,s){let c=typeof e.type==`string`?e.type:void 0,l=[],u={},d={},f=i.props,p=f?.properties;if(o.isPlainObject(e.props))for(let[r,i]of Object.entries(e.props)){let e=`${s}.props.${r}`;if(!o.isSafeKey(r)){l.push({code:`unknown-prop`,path:e,component:c,prop:r,message:`${r} is not a prop a spec can set.`});continue}let d=p?.[r];if(!d&&(!f||f.additionalProperties===!1)){l.push({code:`unknown-prop`,path:e,component:c,prop:r,message:`${c??`The component`} has no ${r} prop.`});continue}let m=null,h=n.t.deep(i,a,e=>{m??=e});if(m){l.push({code:`unresolved-data`,path:e,component:c,prop:r,message:`${m} resolved to nothing.`});continue}if(d&&!o.matches(d,h,f)){l.push({code:`invalid-prop`,path:e,component:c,prop:r,message:`${t(h)} is not a value ${r} takes.`});continue}u[r]=h}if(o.isPlainObject(e.on))for(let[t,n]of Object.entries(e.on)){let e=`${s}.on.${t}`,o=i.events.includes(t)?r(n,a):null;if(!o){l.push({code:`unknown-event`,path:e,component:c,prop:t,message:`${c??`The component`} has no ${t} event.`});continue}d[t]=o}return{props:u,actions:d,issues:l,missing:(f?.required??[]).filter(e=>!(e in u))}}e.resolve=i})(s||={});var c=s,l=class extends r.Component{state={message:null,resetKey:this.props.resetKey};static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{message:null,resetKey:e.resetKey}}static getDerivedStateFromError(e){return{message:e instanceof Error?e.message:String(e)}}componentDidCatch(e){this.props.onError?.(this.issue(e instanceof Error?e.message:String(e)))}issue(e){return{code:`render-error`,path:this.props.path,component:this.props.component,message:e}}render(){return this.state.message===null?this.props.children:this.props.fallback(this.issue(this.state.message))}},u=1e3,d=32;function f(e,t){e.issues.push(t)}function p(e,t,n){f(e,t);let i=e.fallback(t);return n===void 0||i==null?i??null:(0,r.createElement)(r.Fragment,{key:n},i)}function m(e,t,r,i,a){if(e==null||typeof e==`boolean`)return null;if(typeof e==`string`||typeof e==`number`)return e;if(Array.isArray(e))return e.map((e,n)=>m(e,t,r,`${i}.${n}`,a));if(n.t.isRef(e)){let a=n.t.resolve(e,r);return a.found?a.value===null||a.value===void 0||typeof a.value==`boolean`?null:typeof a.value==`string`||typeof a.value==`number`?a.value:(f(t,{code:`invalid-child`,path:i,message:`${n.t.pathOf(e)} is not text.`}),null):(f(t,{code:`unresolved-data`,path:i,message:`${n.t.pathOf(e)} resolved to nothing.`}),null)}return o.isPlainObject(e)?`type`in e?typeof e.type==`string`?e.type===``?null:g(e,t,r,i,a,e.type):(f(t,{code:`invalid-child`,path:i,message:"A node names its component in `type`."}),null):null:(f(t,{code:`invalid-child`,path:i,message:`A child is a node, text, or a reference to text.`}),null)}function h(e,t,r,i,a,o){let s=e.repeat;if(!n.t.isRef(s))return p(t,{code:`invalid-repeat`,path:`${i}.repeat`,component:o,message:`A repeat is a reference to an array.`});let c=n.t.resolve(s,r);if(!c.found)return f(t,{code:`unresolved-data`,path:`${i}.repeat`,component:o,message:`${n.t.pathOf(s)} resolved to nothing.`}),null;if(!Array.isArray(c.value))return p(t,{code:`invalid-repeat`,path:`${i}.repeat`,component:o,message:`${n.t.pathOf(s)} is not an array.`});let l=typeof e.key==`string`?e.key:i;return c.value.map((n,s)=>_(e,t,{data:r.data,item:n,index:s,repeating:!0},i,a,o,`${l}#${s}`))}function g(e,t,n,r,i,a){return i>t.maxDepth?p(t,{code:`too-deep`,path:r,component:a,message:`Nested deeper than the ${t.maxDepth} levels allowed.`}):e.repeat===void 0?_(e,t,n,r,i,a,typeof e.key==`string`?e.key:r):h(e,t,n,r,i,a)}function _(e,t,n,a,s,u,d){if(t.nodes+=1,t.nodes>t.maxNodes)return t.overflowed||(t.overflowed=!0,f(t,{code:`too-many-nodes`,path:a,component:u,message:`More than the ${t.maxNodes} nodes allowed.`})),null;let h=t.registry.get(u);if(!h)return p(t,{code:`unknown-component`,path:a,component:u,message:`${u} is not a component this app allows.`},d);let g=c.resolve(e,h,n,a),_={...g.props};t.issues.push(...g.issues);let v=t.memory?.get(`${a}:${u}`);if(g.missing.length){if(!(v&&g.missing.every(e=>e in v))){let e=g.missing.join(`, `);return p(t,{code:`missing-prop`,path:a,component:u,prop:g.missing[0],message:`${u} cannot render without ${e}.`},d)}for(let e of g.missing)_[e]=v[e]}if(t.memory){let e=h.props?.required??[];e.length&&t.memory.set(`${a}:${u}`,Object.fromEntries(e.map(e=>[e,_[e]])))}for(let[e,n]of Object.entries(g.actions))_[e]=(...r)=>t.onAction?.(n.action,{payload:n.payload,args:r,prop:e,component:u,path:a});if(e.children!==void 0&&(h.slots.includes(`default`)?_.children=m(e.children,t,n,`${a}.children`,s+1):f(t,{code:`unknown-slot`,path:`${a}.children`,component:u,message:`${u} takes no children.`})),o.isPlainObject(e.slots))for(let[r,i]of Object.entries(e.slots)){let e=`${a}.slots.${r}`;if(!o.isSafeKey(r)||!h.slots.includes(r)){f(t,{code:`unknown-slot`,path:e,component:u,message:`${u} has no ${r} slot.`});continue}_[r==="default"?`children`:r]=m(i,t,n,e,s+1)}return(0,i.jsx)(l,{path:a,component:u,resetKey:t.resetKey,fallback:t.fallback,onError:t.onError,children:(0,r.createElement)(h.component,_)},d)}function v(e,t){let n={registry:t.registry,data:t.data,onAction:t.onAction,onError:t.onError,fallback:t.fallback??(()=>null),maxNodes:t.maxNodes??u,maxDepth:t.maxDepth??d,resetKey:t.resetKey,memory:t.memory,issues:[],nodes:0,overflowed:!1};return{element:m(e,n,{data:t.data},`spec`,0),issues:n.issues}}function y(t){let n=(0,r.useRef)(t);return e.n(()=>{n.current=t}),n}function b({spec:e,onIssues:t,...n}){let[i]=(0,r.useState)(()=>new Map),{element:a,issues:o}=v(e,{...n,memory:i,resetKey:e,onError:e=>t?.([e])}),s=y(t),c=y(o),l=o.map(e=>`${e.code} ${e.path} ${e.message}`).join(`
1
+ "use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./effects.cjs"),t=require("./specSchema.cjs"),n=require("./specData.cjs");let r=require("react"),i=require("react/jsx-runtime");var a;(function(e){let t=[`__proto__`,`constructor`,`prototype`],n=new Map;function r(e){if(!n.has(e))try{n.set(e,new RegExp(e))}catch{n.set(e,null)}return n.get(e)??null}function i(e){return!t.includes(e)}e.isSafeKey=i;function a(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}e.isPlainObject=a;function o(e,t){if(!e.$ref)return e;let n=e.$ref.startsWith(`#/$defs/`)?e.$ref.slice(8):null,r=n?t.$defs?.[n]:void 0;return r?o(r,t):null}function s(e,t,n){return!a(t)||e.required?.some(e=>!(e in t))?!1:Object.keys(t).every(r=>{let a=e.properties?.[r];return a?i(r)&&c(a,t[r],n):e.additionalProperties!==!1&&i(r)})}function c(e,t,n=e){let i=o(e,n);if(!i)return!1;if(i.anyOf)return i.anyOf.some(e=>c(e,t,n));if(i.enum&&!i.enum.includes(t))return!1;switch(i.type){case`string`:return typeof t==`string`?!i.pattern||(r(i.pattern)?.test(t)??!1):!1;case`number`:return typeof t==`number`&&Number.isFinite(t);case`integer`:return typeof t==`number`&&Number.isInteger(t);case`boolean`:return typeof t==`boolean`;case`array`:return Array.isArray(t)&&t.length>=(i.minItems??0)&&t.length<=(i.maxItems??1/0)&&(!i.items||t.every(e=>c(i.items,e,n)));case`object`:return s(i,t,n);default:return t!==void 0}}e.matches=c})(a||={});var o=a,s;(function(e){function t(e){let t=JSON.stringify(e)??`undefined`;return t.length>40?`${t.slice(0,39)}…`:t}function r(e,t){return typeof e==`string`?{action:e}:!o.isPlainObject(e)||typeof e.action!=`string`?null:{action:e.action,payload:n.t.deep(e.payload,t)}}function i(e,i,a,s){let c=typeof e.type==`string`?e.type:void 0,l=[],u={},d={},f=i.props,p=f?.properties;if(o.isPlainObject(e.props))for(let[r,i]of Object.entries(e.props)){let e=`${s}.props.${r}`;if(!o.isSafeKey(r)){l.push({code:`unknown-prop`,path:e,component:c,prop:r,message:`${r} is not a prop a spec can set.`});continue}let d=p?.[r];if(!d&&(!f||f.additionalProperties===!1)){l.push({code:`unknown-prop`,path:e,component:c,prop:r,message:`${c??`The component`} has no ${r} prop.`});continue}let m=null,h=n.t.deep(i,a,e=>{m??=e});if(m){l.push({code:`unresolved-data`,path:e,component:c,prop:r,message:`${m} resolved to nothing.`});continue}if(d&&!o.matches(d,h,f)){l.push({code:`invalid-prop`,path:e,component:c,prop:r,message:`${t(h)} is not a value ${r} takes.`});continue}u[r]=h}if(o.isPlainObject(e.on))for(let[t,n]of Object.entries(e.on)){let e=`${s}.on.${t}`,o=i.events.includes(t)?r(n,a):null;if(!o){l.push({code:`unknown-event`,path:e,component:c,prop:t,message:`${c??`The component`} has no ${t} event.`});continue}d[t]=o}return{props:u,actions:d,issues:l,missing:(f?.required??[]).filter(e=>!(e in u))}}e.resolve=i})(s||={});var c=s,l=class extends r.Component{state={message:null,resetKey:this.props.resetKey};static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{message:null,resetKey:e.resetKey}}static getDerivedStateFromError(e){return{message:e instanceof Error?e.message:String(e)}}componentDidCatch(e){this.props.onError?.(this.issue(e instanceof Error?e.message:String(e)))}issue(e){return{code:`render-error`,path:this.props.path,component:this.props.component,message:e}}render(){return this.state.message===null?this.props.children:this.props.fallback(this.issue(this.state.message))}},u=1e3,d=32;function f(e,t){e.issues.push(t)}function p(e,t,n){f(e,t);let i=e.fallback(t);return n===void 0||i==null?i??null:(0,r.createElement)(r.Fragment,{key:n},i)}function m(e,t,r,i,a){if(e==null||typeof e==`boolean`)return null;if(typeof e==`string`||typeof e==`number`)return e;if(Array.isArray(e))return e.map((e,n)=>m(e,t,r,`${i}.${n}`,a));if(n.t.isRef(e)){let a=n.t.resolve(e,r);return a.found?a.value===null||a.value===void 0||typeof a.value==`boolean`?null:typeof a.value==`string`||typeof a.value==`number`?a.value:(f(t,{code:`invalid-child`,path:i,message:`${n.t.pathOf(e)} is not text.`}),null):(f(t,{code:`unresolved-data`,path:i,message:`${n.t.pathOf(e)} resolved to nothing.`}),null)}return o.isPlainObject(e)?`type`in e?typeof e.type==`string`?e.type===``?null:g(e,t,r,i,a,e.type):(f(t,{code:`invalid-child`,path:i,message:"A node names its component in `type`."}),null):null:(f(t,{code:`invalid-child`,path:i,message:`A child is a node, text, or a reference to text.`}),null)}function h(e,t,r,i,a,o){let s=e.repeat;if(!n.t.isRef(s))return p(t,{code:`invalid-repeat`,path:`${i}.repeat`,component:o,message:`A repeat is a reference to an array.`});let c=n.t.resolve(s,r);if(!c.found)return f(t,{code:`unresolved-data`,path:`${i}.repeat`,component:o,message:`${n.t.pathOf(s)} resolved to nothing.`}),null;if(!Array.isArray(c.value))return p(t,{code:`invalid-repeat`,path:`${i}.repeat`,component:o,message:`${n.t.pathOf(s)} is not an array.`});let l=typeof e.key==`string`?e.key:i;return c.value.map((n,s)=>_(e,t,{data:r.data,item:n,index:s,repeating:!0},i,a,o,`${l}#${s}`))}function g(e,t,n,r,i,a){return i>t.maxDepth?p(t,{code:`too-deep`,path:r,component:a,message:`Nested deeper than the ${t.maxDepth} levels allowed.`}):e.repeat===void 0?_(e,t,n,r,i,a,typeof e.key==`string`?e.key:r):h(e,t,n,r,i,a)}function _(e,t,n,a,s,u,d){if(t.nodes+=1,t.nodes>t.maxNodes)return t.overflowed||(t.overflowed=!0,f(t,{code:`too-many-nodes`,path:a,component:u,message:`More than the ${t.maxNodes} nodes allowed.`})),null;let h=t.registry.get(u);if(!h)return p(t,{code:`unknown-component`,path:a,component:u,message:`${u} is not a component this app allows.`},d);let g=c.resolve(e,h,n,a),_={...g.props};t.issues.push(...g.issues);let v=t.memory?.get(`${a}:${u}`);if(g.missing.length){if(!(v&&g.missing.every(e=>e in v))){let e=g.missing.join(`, `);return p(t,{code:`missing-prop`,path:a,component:u,prop:g.missing[0],message:`${u} cannot render without ${e}.`},d)}for(let e of g.missing)_[e]=v[e]}if(t.memory){let e=h.props?.required??[];e.length&&t.memory.set(`${a}:${u}`,Object.fromEntries(e.map(e=>[e,_[e]])))}for(let[e,n]of Object.entries(g.actions))_[e]=(...r)=>t.onAction?.(n.action,{payload:n.payload,args:r,prop:e,component:u,path:a});if(e.children!==void 0&&(h.slots.includes(`default`)?_.children=m(e.children,t,n,`${a}.children`,s+1):f(t,{code:`unknown-slot`,path:`${a}.children`,component:u,message:`${u} takes no children.`})),o.isPlainObject(e.slots))for(let[r,i]of Object.entries(e.slots)){let e=`${a}.slots.${r}`;if(!o.isSafeKey(r)||!h.slots.includes(r)){f(t,{code:`unknown-slot`,path:e,component:u,message:`${u} has no ${r} slot.`});continue}_[r==="default"?`children`:r]=m(i,t,n,e,s+1)}return(0,i.jsx)(l,{path:a,component:u,resetKey:t.resetKey,fallback:t.fallback,onError:t.onError,children:(0,r.createElement)(h.component,_)},d)}function v(e,t){let n={registry:t.registry,data:t.data,onAction:t.onAction,onError:t.onError,fallback:t.fallback??(()=>null),maxNodes:t.maxNodes??u,maxDepth:t.maxDepth??d,resetKey:t.resetKey,memory:t.memory,issues:[],nodes:0,overflowed:!1};return{element:m(e,n,{data:t.data},`spec`,0),issues:n.issues}}function y(t){let n=(0,r.useRef)(t);return e.n(()=>{n.current=t}),n}function b({spec:e,onIssues:t,...n}){let[i]=(0,r.useState)(()=>new Map),{element:a,issues:o}=v(e,{...n,memory:i,resetKey:e,onError:e=>t?.([e])}),s=y(t),c=y(o),l=o.map(e=>`${e.code} ${e.path} ${e.message}`).join(`
2
2
  `);return(0,r.useEffect)(()=>{s.current?.(c.current)},[l,c,s]),a}function x(e){return typeof e==`object`&&!!e&&`component`in e}function S(e,t,n){let r=x(t)?t:{component:t},i=n?.components[e];return{component:r.component,props:r.props??i?.props,slots:r.slots??i?.slots??[`default`],events:r.events??i?.events??[],description:r.description??i?.description}}function C(e){let t=Object.keys(e.components),n=new Map(t.map(t=>[t,S(t,e.components[t],e.catalog)]));return{names:t,components:Object.fromEntries([...n].map(([e,{component:t,...n}])=>[e,n])),get:e=>n.get(e)}}var w=o.matches;exports.SpecRenderer=b,exports.default=b,exports.createSpecRegistry=C,exports.matchesSchema=w,exports.renderSpec=v,exports.specSchema=t.t;
package/spec.mjs CHANGED
@@ -49,7 +49,7 @@ var u;
49
49
  case "number": return typeof t == "number" && Number.isFinite(t);
50
50
  case "integer": return typeof t == "number" && Number.isInteger(t);
51
51
  case "boolean": return typeof t == "boolean";
52
- case "array": return Array.isArray(t) && (!i.items || t.every((e) => c(i.items, e, n)));
52
+ case "array": return Array.isArray(t) && t.length >= (i.minItems ?? 0) && t.length <= (i.maxItems ?? Infinity) && (!i.items || t.every((e) => c(i.items, e, n)));
53
53
  case "object": return s(i, t, n);
54
54
  default: return t !== void 0;
55
55
  }
@@ -68,7 +68,13 @@ export declare function valueOf(draft: Draft, segments: readonly Segment[], conf
68
68
  export declare function draftOf(value: string | null | undefined, config: FieldConfig, zone: string | null): Draft;
69
69
  /** The segments a draft keeps when the config changes shape — a 12-hour clock turned to 24 keeps the time. */
70
70
  export declare function reshape(draft: Draft, from: FieldConfig, to: FieldConfig): Draft;
71
- /** The times of a day every `step` minutes from midnight — what a time list offers. */
72
- export declare function timeSlots(step: number): string[];
71
+ /**
72
+ * The times of a day every `step` minutes from midnight — what a time list offers — kept to `min`/`max`, both
73
+ * inclusive `HH:mm:ss`. Compared as strings, so a bound off the grid is not snapped: 18:20 on a 15 starts at 18:30.
74
+ */
75
+ export declare function timeSlots(step: number, bounds?: {
76
+ min?: string | null;
77
+ max?: string | null;
78
+ }): string[];
73
79
  /** The slot a time falls in, so a list highlights 14:30 for 14:37 on a half-hour step. */
74
80
  export declare function slotOf(time: string | null, step: number): string | null;