neba 1.19.0 → 1.19.1

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.
@@ -1650,7 +1650,7 @@
1650
1650
  },
1651
1651
  "formatDate": {
1652
1652
  "type": "object",
1653
- "description": "Writes a date or a time through a pattern. The names of months and weekdays are English whatever the reader's language, so for a reader in another language write a pattern of numbers in the order that language uses.",
1653
+ "description": "Writes a date or a time through a pattern. The names of months and weekdays are written in the language the renderer was built for, and the pattern decides their order, so write one in the order the reader's language uses.",
1654
1654
  "properties": {
1655
1655
  "call": {
1656
1656
  "const": "formatDate"
@@ -23,16 +23,20 @@
23
23
  *
24
24
  * ## Versions
25
25
  *
26
- * The catalog is written against **A2UI v1.0** and `@a2ui/react` 0.11's newest
27
- * renderer is **v0.9**, so this registers with `@a2ui/react/v0_9`. The eighteen
28
- * components only use constructs the two versions share, which is what makes
29
- * the bridge a rename rather than a translation, and none of the three
30
- * differences that exist makes the renderer refuse a message: v1.0 moved
31
- * `accessibility` from the catalog entry to the envelope, which `schema.ts` puts
32
- * back; v1.0 lets a check leave out the `message` v0.9 requires, which
33
- * `schema.ts` accepts; and v1.0's `Action` gained a `userMessage` that the v0.9
34
- * renderer accepts and never passes on — the action a host receives is built
35
- * from the event's `name` and `context` alone.
26
+ * The catalog is written against **A2UI v1.0** and `@a2ui/react` 0.12's newest
27
+ * renderer is **v0.9**, so this registers with `@a2ui/react/v0_9`. The messages
28
+ * it draws are v0.9's unless `protocolVersion` asks for v1.0's: `web_core` reads
29
+ * either into the surface model `A2uiSurface` draws, and refuses a surface
30
+ * whose messages name another version than its catalog. The eighteen components only use constructs
31
+ * the two versions share, which is what makes the bridge a rename rather than a
32
+ * translation, and none of the three differences that exist makes the renderer
33
+ * refuse a message: v1.0 moved `accessibility` from the catalog entry to the
34
+ * envelope, which `schema.ts` puts back; v1.0 lets a check leave out the
35
+ * `message` v0.9 requires, which `schema.ts` accepts; and v1.0's `Action`
36
+ * gained a `userMessage` that v0.9's refuses, which `schema.ts` accepts and the
37
+ * host receives resolved. A v1.0 message may also carry `accessibility.live`,
38
+ * `accessibility.hidden` and a component's `metadata`; no component reads them,
39
+ * and the schemas drop them rather than refusing the component.
36
40
  *
37
41
  * There is no v1.0 React renderer to register with yet. When there is, what
38
42
  * changes is this file's import and nothing in `catalog.json`.
@@ -44,12 +48,21 @@ export { componentSchema, type CatalogSchema } from './schema.js';
44
48
  /** What `createNebaCatalog` takes. */
45
49
  export interface NebaCatalogOptions {
46
50
  /**
47
- * The language `formatNumber`, `formatCurrency` and `pluralize` write in.
48
- * Pass the one the components are in — a `NebaProvider`'s `locale` — or the
49
- * three follow the runtime's language while the components follow the
50
- * provider. Left out, they follow the runtime.
51
+ * The language `formatNumber`, `formatCurrency`, `formatDate` and `pluralize`
52
+ * write in. Pass the one the components are in — a `NebaProvider`'s `locale` —
53
+ * or the four write American English while the components follow the
54
+ * provider. Left out, they write `en-US`, on a server and in every browser.
51
55
  */
52
56
  locale?: string;
57
+ /**
58
+ * The protocol version of the messages the catalog draws, as their `version`
59
+ * spells it. `web_core` refuses a surface whose messages name another
60
+ * version than its catalog, so pass the one the agent writes. The components
61
+ * and the functions are the same for both.
62
+ *
63
+ * @default 'v0.9'
64
+ */
65
+ protocolVersion?: 'v0.9' | 'v1.0';
53
66
  }
54
67
  /**
55
68
  * The catalog, ready to hand to a `MessageProcessor`.
@@ -60,13 +73,21 @@ export interface NebaCatalogOptions {
60
73
  *
61
74
  * ```tsx
62
75
  * import { MessageProcessor } from '@a2ui/web_core/v0_9';
63
- * import { A2uiSurface } from '@a2ui/react/v0_9';
76
+ * import { A2uiSurface, type ReactComponentImplementation } from '@a2ui/react/v0_9';
64
77
  * import { createNebaCatalog } from 'neba/a2ui';
65
78
  *
66
79
  * const catalog = createNebaCatalog({ locale: 'ko' });
67
- * const processor = new MessageProcessor([catalog]);
80
+ * const processor = new MessageProcessor<ReactComponentImplementation>([catalog]);
68
81
  * ```
69
82
  *
83
+ * The type argument is what makes a surface the processor creates one
84
+ * `A2uiSurface` takes; `MessageProcessor` does not work it out from the
85
+ * catalog.
86
+ *
87
+ * A catalog draws one version, and so does a processor holding it, since a
88
+ * surface finds its catalog by id alone. A host whose agents write both keeps
89
+ * a processor for each and hands a message to the one its `version` names.
90
+ *
70
91
  * The `catalogId` is the one in `catalog.json`, which is also the URL the file
71
92
  * is served from — so the id a surface names and the schema an agent was given
72
93
  * are the same string without anybody having to keep them in step.
@@ -1 +1 @@
1
- import{Catalog as e,createBasicCatalogFunctions as o}from"@a2ui/web_core/v0_9";import t from"./adapter-catalog.json"with{type:"json"};import{nebaComponents as n}from"./components.js";export{nebaComponents}from"./components.js";export{componentSchema}from"./schema.js";function a(e){const n=o({locale:e}),a=new Set(Object.keys(t.functions)),r=n.filter(e=>a.has(e.name));if(r.length!==a.size){const e=[...a].filter(e=>!n.some(o=>o.name===e));throw new Error(`neba/a2ui: the catalog declares ${e.join(", ")}, which @a2ui/web_core does not implement`)}return r.map(e=>{return"openUrl"===e.name?(o=e,{...o,execute:(e,t,n)=>{if("undefined"==typeof navigator||!("userActivation"in navigator)||navigator.userActivation.isActive)return o.execute(e,t,n)}}):e;var o})}export function createNebaCatalog(o={}){return new e(t.catalogId,n,a(o.locale))}export const nebaCatalogId=t.catalogId;
1
+ import{Catalog as e,createBasicCatalogFunctions as t}from"@a2ui/web_core/v0_9";import o from"./adapter-catalog.json"with{type:"json"};import{nebaComponents as n}from"./components.js";import{functionSchema as r}from"./schema.js";export{nebaComponents}from"./components.js";export{componentSchema}from"./schema.js";function a(e){const n=t({locale:e}),a=new Set(Object.keys(o.functions)),i=n.filter(e=>a.has(e.name));if(i.length!==a.size){const e=[...a].filter(e=>!n.some(t=>t.name===e));throw new Error(`neba/a2ui: the catalog declares ${e.join(", ")}, which @a2ui/web_core does not implement`)}return i.map(e=>{const t={...e,schema:r(e.name,e.schema)};switch(e.name){case"openUrl":return o=t,{...o,execute:(e,t,n)=>{if("undefined"==typeof navigator||!("userActivation"in navigator)||navigator.userActivation.isActive)return o.execute(e,t,n)}};case"formatDate":return function(e){return{...e,execute:(t,o,n)=>e.execute("string"==typeof t.value&&c.test(t.value)?{...t,value:`${t.value}T00:00:00`}:t,o,n)}}(t);default:return t}var o})}const c=/^\d{4}-\d{2}-\d{2}$/;export function createNebaCatalog(t={}){const{locale:r,protocolVersion:c="v0.9"}=t;if("v0.9"!==c&&"v1.0"!==c)throw new Error(`neba/a2ui: protocolVersion is 'v0.9' or 'v1.0', not ${JSON.stringify(c)}`);return new e(o.catalogId,c.slice(1),n,a(r))}export const nebaCatalogId=o.catalogId;
@@ -47,6 +47,13 @@ export interface CatalogSchema {
47
47
  minimum?: number;
48
48
  additionalProperties?: boolean;
49
49
  }
50
+ /**
51
+ * A function's argument schema, as wide as the catalog declares it.
52
+ *
53
+ * `extend` for `componentSchema`'s reason: the schema is built by `web_core`'s
54
+ * copy of Zod, and only the arguments named above are this copy's.
55
+ */
56
+ export declare function functionSchema(name: string, schema: z.ZodTypeAny): z.ZodTypeAny;
50
57
  /**
51
58
  * One component's entry, as the schema a `ComponentApi` carries.
52
59
  *
@@ -1 +1 @@
1
- import{z as e}from"zod/v3";import{childList as t,CommonSchemas as r,componentId as i}from"@a2ui/web_core/v0_9";const n="https://a2ui.org/specification/v1_0/common_types.json#/$defs/",o=new Set(["$ref","type","enum","default","description","properties","required","items","minimum","additionalProperties"]),a=new Set(["type","description","properties","required","additionalProperties"]);function s(e,t,r){for(const i of Object.keys(e))if(!r.has(i))throw new Error(`a2ui: ${t} uses \`${i}\`, which this adapter does not know`)}const c={Action:()=>r.Action,Child:()=>i(),ChildList:()=>t(),DynamicBoolean:()=>r.DynamicBoolean,DynamicNumber:()=>r.DynamicNumber,DynamicString:()=>r.DynamicString};function u(t,r){if(s(t,r,o),t.$ref){const e=t.$ref.startsWith(n)?t.$ref.slice(61):"",i=c[e];if(!i)throw new Error(`a2ui: ${r} refers to ${t.$ref}, which this adapter does not know`);return i()}if(t.enum){const r=t.enum;if(r.every(e=>"string"==typeof e))return e.enum(r);const i=r.map(t=>e.literal(t));return 1===i.length?i[0]:e.union(i)}if(void 0!==t.minimum&&"number"!==t.type&&"integer"!==t.type)throw new Error(`a2ui: ${r} has a minimum but is not a number`);switch(t.type){case"string":return e.string();case"number":case"integer":{const r="integer"===t.type?e.number().int():e.number();return void 0===t.minimum?r:r.min(t.minimum)}case"boolean":return e.boolean();case"array":if(!t.items)throw new Error(`a2ui: ${r} is an array with no items`);return e.array(u(t.items,`${r}[]`));case"object":return m(t,r);default:throw new Error(`a2ui: ${r} has a type this adapter does not know`)}}function m(t,r){if(!0===t.additionalProperties)throw new Error(`a2ui: ${r} allows any property, which this adapter cannot check`);const i=new Set(t.required??[]),n={};for(const[e,o]of Object.entries(t.properties??{})){if("component"===e)continue;const t=u(o,`${r}.${e}`);n[e]=void 0===o.default?i.has(e)?t:t.optional():t.default(o.default).optional()}return e.object(n)}const p=(()=>{const t=r.Checkable,i=r.CheckRule.extend({message:e.string().optional()}),n=t.shape.checks;return t.extend({checks:e.array(i).optional().describe(n.description??"")})})();export function componentSchema(t,i){const o=i.allOf??[i];let c=e.object({accessibility:r.AccessibilityAttributes.optional()});for(const e of o)if(e.$ref!==`${n}Checkable`){if(e.$ref)throw new Error(`a2ui: ${t} is composed with ${e.$ref}, which this adapter cannot merge`);s(e,t,a),c=c.extend(m(e,t).shape)}else c=c.extend(p.shape);return c}
1
+ import{z as e}from"zod/v3";import{childList as t,CommonSchemas as n,componentId as r}from"@a2ui/web_core/v0_9";const i="https://a2ui.org/specification/v1_0/common_types.json#/$defs/",o=new Set(["$ref","type","enum","default","description","properties","required","items","minimum","additionalProperties"]),a=new Set(["type","description","properties","required","additionalProperties"]);function s(e,t,n){for(const r of Object.keys(e))if(!n.has(r))throw new Error(`a2ui: ${t} uses \`${r}\`, which this adapter does not know`)}const c={Action:()=>h,Child:()=>r(),ChildList:()=>t(),DynamicBoolean:()=>n.DynamicBoolean,DynamicNumber:()=>n.DynamicNumber,DynamicString:()=>n.DynamicString};function u(t,n){if(s(t,n,o),t.$ref){const e=t.$ref.startsWith(i)?t.$ref.slice(61):"",r=c[e];if(!r)throw new Error(`a2ui: ${n} refers to ${t.$ref}, which this adapter does not know`);return r()}if(t.enum){const n=t.enum;if(n.every(e=>"string"==typeof e))return e.enum(n);const r=n.map(t=>e.literal(t));return 1===r.length?r[0]:e.union(r)}if(void 0!==t.minimum&&"number"!==t.type&&"integer"!==t.type)throw new Error(`a2ui: ${n} has a minimum but is not a number`);switch(t.type){case"string":return e.string();case"number":case"integer":{const n="integer"===t.type?e.number().int():e.number();return void 0===t.minimum?n:n.min(t.minimum)}case"boolean":return e.boolean();case"array":if(!t.items)throw new Error(`a2ui: ${n} is an array with no items`);return e.array(u(t.items,`${n}[]`));case"object":return m(t,n);default:throw new Error(`a2ui: ${n} has a type this adapter does not know`)}}function m(t,n){if(!0===t.additionalProperties)throw new Error(`a2ui: ${n} allows any property, which this adapter cannot check`);const r=new Set(t.required??[]),i={};for(const[e,o]of Object.entries(t.properties??{})){if("component"===e)continue;const t=u(o,`${n}.${e}`);i[e]=void 0===o.default?r.has(e)?t:t.optional():t.default(o.default).optional()}return e.object(i)}const p=(()=>{const t=n.Checkable,r=n.CheckRule.extend({message:e.string().optional()}),i=t.shape.checks;return t.extend({checks:e.array(r).optional().describe(i.description??"")})})(),h=(()=>{const[t,r]=n.Action.options,i=t.shape.event;return e.union([t.extend({event:i.extend({userMessage:n.DynamicString.optional()})}),r]).describe(n.Action.description??"")})(),d={numeric:()=>({value:e.union([n.DynamicNumber,n.DynamicString])}),openUrl:()=>({url:n.DynamicString})};export function functionSchema(e,t){const n=d[e];return n?t.extend(n()):t}export function componentSchema(t,r){const o=r.allOf??[r];let c=e.object({accessibility:n.AccessibilityAttributes.optional()});for(const e of o)if(e.$ref!==`${i}Checkable`){if(e.$ref)throw new Error(`a2ui: ${t} is composed with ${e.$ref}, which this adapter cannot merge`);s(e,t,a),c=c.extend(m(e,t).shape)}else c=c.extend(p.shape);return c}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{IconButton as n}from"../icon-button/IconButton.js";import{childKey as a}from"../../internal/children.js";import{carouselMessages as l,fillMessage as o,useMessages as s}from"../../internal/i18n.js";import{ChevronIcon as i,PauseIcon as c,PlayIcon as u}from"../../internal/icons.js";import{usePrefersReducedMotion as d}from"../../internal/media.js";import{observeVisibility as m}from"../../internal/observe.js";import{cx as f,radiusClasses as p,srOnlyClasses as b,surfaceClasses as v,surfaceSlots as h,transitionClasses as g}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const w={solid:v+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:v+" border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)]",text:"text-(--neba-fg) bg-transparent"},y={xs:"start-1 end-1",sm:"start-1.5 end-1.5",md:"start-2 end-2",lg:"start-3 end-3",xl:"start-4 end-4"},N={xs:{rest:"h-1 w-1",current:"h-1 w-3",gap:"gap-1"},sm:{rest:"h-1 w-1",current:"h-1 w-3.5",gap:"gap-1"},md:{rest:"h-1.5 w-1.5",current:"h-1.5 w-4",gap:"gap-1.5"},lg:{rest:"h-1.5 w-1.5",current:"h-1.5 w-5",gap:"gap-2"},xl:{rest:"h-2 w-2",current:"h-2 w-6",gap:"gap-2"}},j={xs:"0.25rem",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.5rem"};export const Carousel=/*@__PURE__*/r.forwardRef(function Carousel(v,C){const{variant:S="outline",size:k="md",color:L="primary",density:M="default",elevation:T=0,value:_,defaultValue:z=0,onValueChange:E,loop:I=!0,autoPlay:P=!1,interval:R=5e3,arrows:W=!0,indicators:$=!0,locale:B,label:D,previousLabel:F,nextLabel:V,pauseLabel:A,playLabel:q,slideLabel:G,className:H,style:J,children:K,onPointerEnter:O,onPointerLeave:Q,onFocus:U,onBlur:X,...Y}=x(v,["size","density","variant","locale"]),Z=s(l,B),ee=G??((e,t)=>o(Z.slide,{index:String(e),total:String(t)})),te=r.Children.toArray(K),re=te.length,[ne,ae]=r.useState(z),le=Math.min(Math.max(_??ne,0),Math.max(re-1,0)),[oe]=r.useState(le),se=r.useRef(null),ie=r.useRef(!1),ce=r.useRef(!1),ue=r.useRef(!1),[de,me]=r.useState(!1),[fe,pe]=r.useState(!1),be=de||fe,[ve,he]=r.useState(!1),ge=r.useCallback((e,t=!1)=>{if(0===re)return;const r=I?(e%re+re)%re:Math.min(Math.max(e,0),re-1);ie.current=t,void 0===_&&ae(r),r!==le&&E?.(r)},[re,I,_,le,E]);r.useEffect(()=>{if(ie.current)return void(ie.current=!1);const e=!ce.current;if(ce.current=!0,e&&0===le)return;const t=se.current;if(t){const r="rtl"===getComputedStyle(t).direction?-1:1;t.scrollTo({left:r*le*t.clientWidth,...e?{behavior:"instant"}:null})}ue.current=!0;const r=window.setTimeout(()=>{ue.current=!1},700);return()=>window.clearTimeout(r)},[le]);const xe=d(),[we,ye]=r.useState(!1),Ne=P&&!ve&&!xe&&re>1;r.useEffect(()=>{const e=se.current;if(Ne&&e)return m(e,0,e=>ye(!e))??void 0},[Ne]),r.useEffect(()=>{if(!P||ve||be||xe||we||re<2)return;const e=window.setInterval(()=>{document.hidden||ge(le+1)},R);return()=>window.clearInterval(e)},[P,ve,be,xe,we,re,R,le,ge]);const je=le<=0,Ce=le>=re-1,Se=P&&!xe&&re>1,ke=$&&re>1;return t("div",{ref:C,role:"region","aria-roledescription":"carousel","aria-label":D??Z.label,className:f("flex flex-col",H??""),style:{...h(L,T),...J},onPointerEnter:e=>{me(!0),O?.(e)},onPointerLeave:e=>{me(!1),Q?.(e)},onFocus:e=>{pe(!0),U?.(e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||pe(!1),X?.(e)},...Y,children:[t("div",{className:"relative min-w-0 overflow-hidden "+p[k]+" "+w[S]+" "+g,children:[e("div",{ref:se,tabIndex:0,role:"group","aria-label":D??Z.label,className:"flex min-w-0 snap-x snap-mandatory overflow-x-auto scroll-smooth motion-reduce:scroll-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",onScroll:()=>{const e=se.current;if(ue.current||!e||0===e.clientWidth)return;const t=Math.round(Math.abs(e.scrollLeft)/e.clientWidth);t!==le&&t>=0&&t<re&&ge(t,!0)},children:te.map((t,r)=>e("div",{role:"group","aria-roledescription":"slide","aria-label":ee(r+1,re),className:"w-full shrink-0 grow-0 basis-full snap-start",style:r===oe&&oe>0?{scrollInitialTarget:"nearest"}:void 0,children:t},a(t,r)))}),W&&re>1?t("div",{className:`pointer-events-none absolute inset-y-0 flex items-center ${y[k]}`,children:[e(n,{variant:"solid",size:k,color:L,density:M,elevation:1,label:F??Z.previous,disabled:!I&&je,focusableWhenDisabled:!0,className:"pointer-events-auto",icon:e("span",{className:"flex items-center rotate-90 rtl:-rotate-90",children:e(i,{})}),onClick:()=>ge(le-1)}),e("span",{className:"flex-1"}),e(n,{variant:"solid",size:k,color:L,density:M,elevation:1,label:V??Z.next,disabled:!I&&Ce,focusableWhenDisabled:!0,className:"pointer-events-auto",icon:e("span",{className:"flex items-center -rotate-90 rtl:rotate-90",children:e(i,{})}),onClick:()=>ge(le+1)})]}):null]}),Se||ke?t("div",{className:"grid shrink-0 grid-cols-[1fr_auto_1fr] items-center pt-2",children:[e("span",{className:"flex justify-start",children:Se?e(n,{variant:"text",size:k,color:L,density:M,label:ve?q??Z.play:A??Z.pause,icon:e(ve?u:c,{}),onClick:()=>he(e=>!e)}):null}),e("span",{className:`flex items-center ${N[k].gap}`,style:{"--n-hit-gap":j[k]},children:ke?te.map((t,r)=>e("button",{type:"button","aria-label":ee(r+1,re),"aria-current":r===le?"true":void 0,className:"neba-hit-row relative cursor-pointer rounded-full [transition-property:width,background-color] [transition-duration:var(--neba-duration)] [transition-timing-function:var(--neba-ease)] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2 "+(r===le?`${N[k].current} bg-(--n-accent)`:`${N[k].rest} bg-(--n-line-hover) hover:bg-(--n-accent)`),onClick:()=>ge(r)},r)):null}),e("span",{})]}):null,e("span",{className:b,"aria-live":!Se||ve||be?"polite":"off",children:re>0?ee(le+1,re):""})]})});
1
+ "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import*as r from"react";import{IconButton as n}from"../icon-button/IconButton.js";import{childKey as a}from"../../internal/children.js";import{carouselMessages as l,fillMessage as o,useMessages as s}from"../../internal/i18n.js";import{ChevronIcon as i,PauseIcon as c,PlayIcon as u}from"../../internal/icons.js";import{usePrefersReducedMotion as d}from"../../internal/media.js";import{observeVisibility as m}from"../../internal/observe.js";import{cx as f,radiusClasses as p,srOnlyClasses as b,surfaceClasses as v,surfaceSlots as h,transitionClasses as g}from"../../internal/styles.js";import{useStyleDefaults as x}from"../../internal/defaults.js";const w={solid:v+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:v+" border text-(--neba-fg) bg-(--n-panel) [border-color:var(--n-line)] [box-shadow:var(--n-elev),var(--neba-plate-glass)]",text:"text-(--neba-fg) bg-transparent"},y={xs:"start-1 end-1",sm:"start-1.5 end-1.5",md:"start-2 end-2",lg:"start-3 end-3",xl:"start-4 end-4"},N={xs:{rest:"h-1 w-1",current:"h-1 w-3",gap:"gap-1"},sm:{rest:"h-1 w-1",current:"h-1 w-3.5",gap:"gap-1"},md:{rest:"h-1.5 w-1.5",current:"h-1.5 w-4",gap:"gap-1.5"},lg:{rest:"h-1.5 w-1.5",current:"h-1.5 w-5",gap:"gap-2"},xl:{rest:"h-2 w-2",current:"h-2 w-6",gap:"gap-2"}},j={xs:"0.25rem",sm:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.5rem"};export const Carousel=/*@__PURE__*/r.forwardRef(function Carousel(v,C){const{variant:S="outline",size:k="md",color:L="primary",density:M="default",elevation:T=0,value:_,defaultValue:z=0,onValueChange:E,loop:I=!0,autoPlay:P=!1,interval:R=5e3,arrows:W=!0,indicators:$=!0,locale:B,label:D,previousLabel:F,nextLabel:V,pauseLabel:A,playLabel:q,slideLabel:G,className:H,style:J,children:K,onPointerEnter:O,onPointerLeave:Q,onFocus:U,onBlur:X,...Y}=x(v,["size","density","variant","locale"]),Z=s(l,B),ee=G??((e,t)=>o(Z.slide,{index:String(e),total:String(t)})),te=r.Children.toArray(K),re=te.length,[ne,ae]=r.useState(z),le=Math.min(Math.max(_??ne,0),Math.max(re-1,0)),[oe]=r.useState(le),se=r.useRef(null),ie=r.useRef(!1),ce=r.useRef(!1),ue=r.useRef(!1),[de,me]=r.useState(!1),[fe,pe]=r.useState(!1),be=de||fe,[ve,he]=r.useState(!1),ge=r.useCallback((e,t=!1)=>{if(0===re)return;const r=I?(e%re+re)%re:Math.min(Math.max(e,0),re-1);ie.current=t,void 0===_&&ae(r),r!==le&&E?.(r)},[re,I,_,le,E]);r.useEffect(()=>{if(ie.current)return void(ie.current=!1);const e=!ce.current;if(ce.current=!0,e&&0===le)return;const t=se.current;if(t){const r="rtl"===getComputedStyle(t).direction?-1:1;t.scrollTo({left:r*le*t.clientWidth,...e?{behavior:"instant"}:null})}ue.current=!0;const r=window.setTimeout(()=>{ue.current=!1},700);return()=>window.clearTimeout(r)},[le]);const xe=d(),[we,ye]=r.useState(null),Ne=P&&!ve&&!xe&&re>1;r.useEffect(()=>{const e=se.current;if(!Ne||!e)return;const t=m(e,0,e=>ye(!e));return t||ye(!1),t??void 0},[Ne]),r.useEffect(()=>{if(!P||ve||be||xe||!1!==we||re<2)return;const e=window.setInterval(()=>{document.hidden||ge(le+1)},R);return()=>window.clearInterval(e)},[P,ve,be,xe,we,re,R,le,ge]);const je=le<=0,Ce=le>=re-1,Se=P&&!xe&&re>1,ke=$&&re>1;return t("div",{ref:C,role:"region","aria-roledescription":"carousel","aria-label":D??Z.label,className:f("flex flex-col",H??""),style:{...h(L,T),...J},onPointerEnter:e=>{me(!0),O?.(e)},onPointerLeave:e=>{me(!1),Q?.(e)},onFocus:e=>{pe(!0),U?.(e)},onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||pe(!1),X?.(e)},...Y,children:[t("div",{className:"relative min-w-0 overflow-hidden "+p[k]+" "+w[S]+" "+g,children:[e("div",{ref:se,tabIndex:0,role:"group","aria-label":D??Z.label,className:"flex min-w-0 snap-x snap-mandatory overflow-x-auto scroll-smooth motion-reduce:scroll-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]",onScroll:()=>{const e=se.current;if(ue.current||!e||0===e.clientWidth)return;const t=Math.round(Math.abs(e.scrollLeft)/e.clientWidth);t!==le&&t>=0&&t<re&&ge(t,!0)},children:te.map((t,r)=>e("div",{role:"group","aria-roledescription":"slide","aria-label":ee(r+1,re),className:"w-full shrink-0 grow-0 basis-full snap-start",style:r===oe&&oe>0?{scrollInitialTarget:"nearest"}:void 0,children:t},a(t,r)))}),W&&re>1?t("div",{className:`pointer-events-none absolute inset-y-0 flex items-center ${y[k]}`,children:[e(n,{variant:"solid",size:k,color:L,density:M,elevation:1,label:F??Z.previous,disabled:!I&&je,focusableWhenDisabled:!0,className:"pointer-events-auto",icon:e("span",{className:"flex items-center rotate-90 rtl:-rotate-90",children:e(i,{})}),onClick:()=>ge(le-1)}),e("span",{className:"flex-1"}),e(n,{variant:"solid",size:k,color:L,density:M,elevation:1,label:V??Z.next,disabled:!I&&Ce,focusableWhenDisabled:!0,className:"pointer-events-auto",icon:e("span",{className:"flex items-center -rotate-90 rtl:rotate-90",children:e(i,{})}),onClick:()=>ge(le+1)})]}):null]}),Se||ke?t("div",{className:"grid shrink-0 grid-cols-[1fr_auto_1fr] items-center pt-2",children:[e("span",{className:"flex justify-start",children:Se?e(n,{variant:"text",size:k,color:L,density:M,label:ve?q??Z.play:A??Z.pause,icon:e(ve?u:c,{}),onClick:()=>he(e=>!e)}):null}),e("span",{className:`flex items-center ${N[k].gap}`,style:{"--n-hit-gap":j[k]},children:ke?te.map((t,r)=>e("button",{type:"button","aria-label":ee(r+1,re),"aria-current":r===le?"true":void 0,className:"neba-hit-row relative cursor-pointer rounded-full [transition-property:width,background-color] [transition-duration:var(--neba-duration)] [transition-timing-function:var(--neba-ease)] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-2 "+(r===le?`${N[k].current} bg-(--n-accent)`:`${N[k].rest} bg-(--n-line-hover) hover:bg-(--n-accent)`),onClick:()=>ge(r)},r)):null}),e("span",{})]}):null,e("span",{className:b,"aria-live":!Se||ve||be?"polite":"off",children:re>0?ee(le+1,re):""})]})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neba",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "A comprehensive React UI component library — buttons, fields, menus, dialogs, tables and much more — accessible and themeable, sharing one prop vocabulary and a translucent acrylic design language. ESM only, types included, dark mode built in.",
5
5
  "type": "module",
6
6
  "types": "dist/index.d.ts",
@@ -157,26 +157,26 @@
157
157
  "form"
158
158
  ],
159
159
  "devDependencies": {
160
- "@a2ui/react": "^0.11.1",
161
- "@a2ui/web_core": "^0.11.0",
160
+ "@a2ui/react": "^0.12.0",
161
+ "@a2ui/web_core": "^0.12.0",
162
162
  "@eslint/js": "^9.39.1",
163
- "@mdn/browser-compat-data": "^8.1.3",
163
+ "@mdn/browser-compat-data": "^8.1.5",
164
164
  "@tailwindcss/postcss": "^4.3.3",
165
- "@types/node": "^26.6.3",
165
+ "@types/node": "^26.6.4",
166
166
  "@types/react": "^19.3.0",
167
167
  "@types/react-dom": "^19.3.0",
168
- "@typescript-eslint/parser": "^8.70.1",
169
- "@vitejs/plugin-react": "^6.1.1",
170
- "@vitest/browser": "^5.0.2",
171
- "@vitest/browser-playwright": "^5.0.2",
168
+ "@typescript-eslint/parser": "^8.71.1",
169
+ "@vitejs/plugin-react": "^6.1.2",
170
+ "@vitest/browser": "^5.0.3",
171
+ "@vitest/browser-playwright": "^5.0.3",
172
172
  "eslint": "^9.39.1",
173
173
  "eslint-config-prettier": "^10.1.8",
174
- "eslint-plugin-n": "^18.3.0",
174
+ "eslint-plugin-n": "^18.4.1",
175
175
  "eslint-plugin-react-hooks": "^7.1.1",
176
- "globals": "^17.12.0",
176
+ "globals": "^17.13.0",
177
177
  "jiti": "^2.7.0",
178
- "playwright": "^1.63.0",
179
- "postcss": "^8.5.28",
178
+ "playwright": "^1.64.0",
179
+ "postcss": "^8.5.29",
180
180
  "prettier": "^3.9.9",
181
181
  "prettier-plugin-tailwindcss": "^0.8.1",
182
182
  "react": "^19.3.0",
@@ -185,25 +185,25 @@
185
185
  "terser": "^5.51.2",
186
186
  "tsx": "^4.23.15",
187
187
  "typescript": "^6.0.3",
188
- "typescript-eslint": "^8.70.1",
189
- "vite": "^8.3.1",
188
+ "typescript-eslint": "^8.71.1",
189
+ "vite": "^8.3.4",
190
190
  "vitepress": "^1.6.4",
191
191
  "vitepress-i18n": "^1.4.0",
192
192
  "vitepress-sidebar": "^1.40.0",
193
- "vitest": "^5.0.2",
193
+ "vitest": "^5.0.3",
194
194
  "vitest-browser-react": "^2.3.0",
195
195
  "zod": "^3.25.76"
196
196
  },
197
197
  "dependencies": {
198
- "@base-ui/react": "^1.8.0",
198
+ "@base-ui/react": "^1.9.0",
199
199
  "highlight.js": "^11.12.0"
200
200
  },
201
201
  "peerDependencies": {
202
202
  "@types/react": "^18.0.0 || ^19.0.0",
203
203
  "react": "^18.0.0 || ^19.0.0",
204
204
  "react-dom": "^18.0.0 || ^19.0.0",
205
- "@a2ui/react": "^0.11.0",
206
- "@a2ui/web_core": "^0.11.0",
205
+ "@a2ui/react": "^0.12.0",
206
+ "@a2ui/web_core": "^0.12.0",
207
207
  "zod": "^3.25.76 || ^4.0.0"
208
208
  },
209
209
  "peerDependenciesMeta": {