neba 1.19.1 → 1.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  * The renderer half of the A2UI support: `neba/a2ui`.
3
3
  *
4
4
  * `neba/a2ui/catalog.json` is what an agent is handed. This is what draws what
5
- * the agent writes back — a `Catalog` for `@a2ui/react`'s v0.9 surface, with
5
+ * the agent writes back — a `Catalog` for `@a2ui/react`'s `A2uiSurface`, with
6
6
  * the eighteen components implemented against this library and the protocol's
7
7
  * own fourteen functions.
8
8
  *
@@ -23,28 +23,32 @@
23
23
  *
24
24
  * ## Versions
25
25
  *
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.
26
+ * The catalog is written against **A2UI v1.0**, and the messages this draws
27
+ * are v1.0's unless `protocolVersion` asks for v0.9's. `web_core` reads either
28
+ * into the surface model `A2uiSurface` draws, and refuses a surface whose
29
+ * messages name another version than its catalog. `@a2ui/react` has no entry
30
+ * point per version past v0.9: its root is one renderer for both, and its
31
+ * `v0_9` entry, which this imports, re-exports that root.
40
32
  *
41
- * There is no v1.0 React renderer to register with yet. When there is, what
42
- * changes is this file's import and nothing in `catalog.json`.
33
+ * The two versions no longer write a binding the same way. v1.0 binds with
34
+ * `{ "@path": … }` and calls with `{ "@call": … }`, its messages carry
35
+ * `"version": "1.0"`, and its checks return a validation result; v0.9 binds
36
+ * with `{ "path": … }`, calls with `{ "call": … }` and carries
37
+ * `"version": "v0.9"`. So each version gets its own schemas, from `schema.ts`,
38
+ * and its own functions, below, while the views are the same. The catalog
39
+ * spells v1.0's, so a host that draws v0.9 messages has an agent that writes
40
+ * them from somewhere other than this file.
41
+ *
42
+ * A v1.0 message may also carry `accessibility.live`, `accessibility.hidden`
43
+ * and a component's `metadata`; no component reads them, and the component is
44
+ * drawn all the same.
43
45
  */
44
- import { Catalog, type FunctionImplementation } from '@a2ui/web_core/v0_9';
46
+ import { type FunctionImplementation } from '@a2ui/web_core/v0_9';
47
+ import { Catalog } from '@a2ui/web_core/v1_0';
45
48
  import { nebaComponents } from './components.js';
49
+ import { type ProtocolVersion } from './schema.js';
46
50
  export { nebaComponents } from './components.js';
47
- export { componentSchema, type CatalogSchema } from './schema.js';
51
+ export { componentSchema, type CatalogSchema, type ProtocolVersion } from './schema.js';
48
52
  /** What `createNebaCatalog` takes. */
49
53
  export interface NebaCatalogOptions {
50
54
  /**
@@ -55,14 +59,15 @@ export interface NebaCatalogOptions {
55
59
  */
56
60
  locale?: string;
57
61
  /**
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
+ * The protocol version of the messages the catalog draws. A v1.0 message
63
+ * carries `"version": "1.0"` and a v0.9 one `"version": "v0.9"`. `web_core`
64
+ * refuses a surface whose messages name another version than its catalog,
65
+ * so pass the one the agent writes. The components are the same for both;
66
+ * the schemas and the functions are each version's own.
62
67
  *
63
- * @default 'v0.9'
68
+ * @default 'v1.0'
64
69
  */
65
- protocolVersion?: 'v0.9' | 'v1.0';
70
+ protocolVersion?: ProtocolVersion;
66
71
  }
67
72
  /**
68
73
  * The catalog, ready to hand to a `MessageProcessor`.
@@ -72,7 +77,7 @@ export interface NebaCatalogOptions {
72
77
  * gives you: a `Catalog` is immutable and the `MessageProcessor` holds on to it.
73
78
  *
74
79
  * ```tsx
75
- * import { MessageProcessor } from '@a2ui/web_core/v0_9';
80
+ * import { MessageProcessor } from '@a2ui/web_core/v1_0';
76
81
  * import { A2uiSurface, type ReactComponentImplementation } from '@a2ui/react/v0_9';
77
82
  * import { createNebaCatalog } from 'neba/a2ui';
78
83
  *
@@ -1 +1 @@
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;
1
+ import{createBasicCatalogFunctions as e}from"@a2ui/web_core/v0_9";import{Catalog as t,createBasicCatalogFunctions as o}from"@a2ui/web_core/v1_0";import a from"./adapter-catalog.json"with{type:"json"};import{componentsFor as n}from"./components.js";import{functionSchema as r}from"./schema.js";export{nebaComponents}from"./components.js";export{componentSchema}from"./schema.js";function c(t,n){const c="v1.0"===n?o({locale:t}):e({locale:t}),s=new Set(Object.keys(a.functions)),m=c.filter(e=>s.has(e.name));if(m.length!==s.size){const e=[...s].filter(e=>!c.some(t=>t.name===e));throw new Error(`neba/a2ui: the catalog declares ${e.join(", ")}, which @a2ui/web_core does not implement`)}return m.map(e=>{const t={...e,schema:r(e.name,e.schema,n)};switch(e.name){case"openUrl":return o=t,{...o,execute:(e,t,a)=>{if("undefined"==typeof navigator||!("userActivation"in navigator)||navigator.userActivation.isActive)return o.execute(e,t,a)}};case"formatDate":return function(e){return{...e,execute:(t,o,a)=>e.execute("string"==typeof t.value&&i.test(t.value)?{...t,value:`${t.value}T00:00:00`}:t,o,a)}}(t);default:return t}var o})}const i=/^\d{4}-\d{2}-\d{2}$/;export function createNebaCatalog(e={}){const{locale:o,protocolVersion:r="v1.0"}=e;if("v0.9"!==r&&"v1.0"!==r)throw new Error(`neba/a2ui: protocolVersion is 'v0.9' or 'v1.0', not ${JSON.stringify(r)}`);return new t(a.catalogId,r.slice(1),n(r),c(o,r))}export const nebaCatalogId=a.catalogId;
@@ -21,6 +21,13 @@
21
21
  * schemas to work out which props are child references, so a `Card.child` built
22
22
  * from a bare string is a card that never resolves its child.
23
23
  *
24
+ * Every `$ref` resolves to the common type of the protocol version the schema
25
+ * is built for, because the two versions no longer write a binding the same
26
+ * way: v1.0 writes `{ "@path": … }` and `{ "@call": … }`, v0.9 `{ "path": … }`
27
+ * and `{ "call": … }`. The catalog is written against v1.0, so a v1.0 schema
28
+ * takes `web_core`'s v1.0 types as they are, and a v0.9 one takes v0.9's with
29
+ * the two bridges below that let it accept what the catalog allows.
30
+ *
24
31
  * The import is `zod/v3` rather than `zod` because `web_core` builds its
25
32
  * schemas with Zod 3, and the ones built here sit in the same objects as
26
33
  * those. Zod 3.25 and every Zod 4 serve the v3 API at that path, so the peer
@@ -32,6 +39,8 @@
32
39
  * never by class, so the renderer does not care which copy built it.
33
40
  */
34
41
  import { z } from 'zod/v3';
42
+ /** The protocol versions the adapter draws, as `createNebaCatalog` names them. */
43
+ export type ProtocolVersion = 'v0.9' | 'v1.0';
35
44
  /** As much of JSON Schema as the catalog is written in. */
36
45
  export interface CatalogSchema {
37
46
  $ref?: string;
@@ -50,17 +59,29 @@ export interface CatalogSchema {
50
59
  /**
51
60
  * A function's argument schema, as wide as the catalog declares it.
52
61
  *
62
+ * `web_core` parses a call's arguments twice: as the agent wrote them, when a
63
+ * component arrives, and resolved, before the function runs. Its schemas are
64
+ * narrower than this catalog in places, and each refused a call the catalog
65
+ * allows. `numeric`'s `value` is a number there and a string here in both
66
+ * versions, because what a check reads is the text a `TextField` holds, so a
67
+ * field holding "42" failed the check it passes. v0.9's `openUrl` takes its
68
+ * `url` as a literal, while the catalog lets it be bound, so a button that
69
+ * opened an address from the data model was refused with the rest of its
70
+ * component; v1.0's takes a binding already. Both functions take what the
71
+ * catalog declares — `numeric` reads a string as a number, and text that is not
72
+ * one fails the check — so the only change is to stop refusing it.
73
+ *
53
74
  * `extend` for `componentSchema`'s reason: the schema is built by `web_core`'s
54
75
  * copy of Zod, and only the arguments named above are this copy's.
55
76
  */
56
- export declare function functionSchema(name: string, schema: z.ZodTypeAny): z.ZodTypeAny;
77
+ export declare function functionSchema(name: string, schema: z.ZodTypeAny, version?: ProtocolVersion): z.ZodTypeAny;
57
78
  /**
58
- * One component's entry, as the schema a `ComponentApi` carries.
79
+ * One component's entry, as the schema a `ComponentApi` carries, for the
80
+ * protocol version its messages are written in.
59
81
  *
60
82
  * `accessibility` is added rather than read, because v1.0 moved it out of the
61
- * catalog and into the envelope while the renderer this adapter registers with
62
- * still expects a component to declare it. That and a check's optional
63
- * `message`, above, are the two places the versions are bridged rather than
64
- * mapped.
83
+ * catalog and into the envelope while the renderer still resolves it as one of
84
+ * the component's props. Under v0.9 that and a check's optional `message`,
85
+ * above, are the places the versions are bridged rather than mapped.
65
86
  */
66
- export declare function componentSchema(name: string, definition: CatalogSchema): z.ZodTypeAny;
87
+ export declare function componentSchema(name: string, definition: CatalogSchema, version?: ProtocolVersion): z.ZodTypeAny;
@@ -1 +1 @@
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
+ import{z as e}from"zod/v3";import{childList as n,CommonSchemas as i,componentId as t}from"@a2ui/web_core/v0_9";import{childList as r,CommonSchemas as o,componentId as c}from"@a2ui/web_core/v1_0";const a="https://a2ui.org/specification/v1_0/common_types.json#/$defs/",s=new Set(["$ref","type","enum","default","description","properties","required","items","minimum","additionalProperties"]),m=new Set(["type","description","properties","required","additionalProperties"]);function u(e,n,i){for(const t of Object.keys(e))if(!i.has(t))throw new Error(`a2ui: ${n} uses \`${t}\`, which this adapter does not know`)}function d(){const r=function(){const[n,t]=i.Action.options,r=n.shape.event;return e.union([n.extend({event:r.extend({userMessage:i.DynamicString.optional()})}),t]).describe(i.Action.description??"")}();return{refs:{Action:()=>r,Child:()=>t(),ChildList:()=>n(),DynamicBoolean:()=>i.DynamicBoolean,DynamicNumber:()=>i.DynamicNumber,DynamicString:()=>i.DynamicString},checkable:y(),accessibility:i.AccessibilityAttributes,widened:{numeric:()=>({value:e.union([i.DynamicNumber,i.DynamicString])}),openUrl:()=>({url:i.DynamicString})}}}const h={};function p(n){return h[n]??="v1.0"===n?{refs:{Action:()=>o.Action,Child:()=>c(),ChildList:()=>r(),DynamicBoolean:()=>o.DynamicBoolean,DynamicNumber:()=>o.DynamicNumber,DynamicString:()=>o.DynamicString},checkable:o.Checkable,accessibility:o.AccessibilityAttributes,widened:{numeric:()=>({value:e.union([o.DynamicNumber,o.DynamicString])})}}:d()}function l(n,i,t){if(u(n,i,s),n.$ref){const e=n.$ref.startsWith(a)?n.$ref.slice(61):"",r=t.refs[e];if(!r)throw new Error(`a2ui: ${i} refers to ${n.$ref}, which this adapter does not know`);return r()}if(n.enum){const i=n.enum;if(i.every(e=>"string"==typeof e))return e.enum(i);const t=i.map(n=>e.literal(n));return 1===t.length?t[0]:e.union(t)}if(void 0!==n.minimum&&"number"!==n.type&&"integer"!==n.type)throw new Error(`a2ui: ${i} has a minimum but is not a number`);switch(n.type){case"string":return e.string();case"number":case"integer":{const i="integer"===n.type?e.number().int():e.number();return void 0===n.minimum?i:i.min(n.minimum)}case"boolean":return e.boolean();case"array":if(!n.items)throw new Error(`a2ui: ${i} is an array with no items`);return e.array(l(n.items,`${i}[]`,t));case"object":return f(n,i,t);default:throw new Error(`a2ui: ${i} has a type this adapter does not know`)}}function f(n,i,t){if(!0===n.additionalProperties)throw new Error(`a2ui: ${i} allows any property, which this adapter cannot check`);const r=new Set(n.required??[]),o={};for(const[e,c]of Object.entries(n.properties??{})){if("component"===e)continue;const n=l(c,`${i}.${e}`,t);o[e]=void 0===c.default?r.has(e)?n:n.optional():n.default(c.default).optional()}return e.object(o)}function y(){const n=i.Checkable,t=i.CheckRule.extend({message:e.string().optional()}),r=n.shape.checks;return n.extend({checks:e.array(t).optional().describe(r.description??"")})}export function functionSchema(e,n,i="v1.0"){const t=p(i).widened[e];return t?n.extend(t()):n}export function componentSchema(n,i,t="v1.0"){const r=p(t),o=i.allOf??[i];let c=e.object({accessibility:r.accessibility.optional()});for(const e of o)if(e.$ref!==`${a}Checkable`){if(e.$ref)throw new Error(`a2ui: ${n} is composed with ${e.$ref}, which this adapter cannot merge`);u(e,n,m),c=c.extend(f(e,n,r).shape)}else c=c.extend(r.checkable.shape);return c}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as a,boxPaddingYClasses as s}from"../box/Box.js";import{ChevronIcon as i}from"../../internal/icons.js";import{collapsiblePanelClasses as r,gapClasses as o,hasContent as d,iconClasses as c,metaTextClasses as f,radiusClasses as m,sheetBodyClasses as p,sheetHeaderGapClasses as b,sheetTitleClasses as u,surfaceClasses as x,surfaceSlots as h,transitionClasses as g,clampClasses as v,clampSlot as N,disclosureChevronClasses as j,disclosureTriggerClasses as w}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const $={solid:x+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:x+" 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"};export const Collapsible=/*@__PURE__*/l.forwardRef(function Collapsible(l,x){const{variant:C="outline",size:k="md",color:O="primary",density:B="default",elevation:z=0,open:F,defaultOpen:M=!1,onOpenChange:R,title:T,subtitle:U,lines:_,startIcon:I,action:P,trigger:q,indicator:A=!0,disabled:D=!1,padded:E=!0,hiddenUntilFound:G=!0,keepMounted:H=!1,className:J,style:K,children:L,...Q}=y(l,["size","density","variant"]),S=_?v(_):"",V=N(_),W=a[B][k],X=s[B][k];return n(t.Root,{ref:x,open:F,defaultOpen:M,onOpenChange:e=>R?.(e),disabled:D,className:["flex flex-col overflow-hidden",m[k],$[C],g,J??""].filter(Boolean).join(" "),style:{...h(O,z),...K},...Q,children:[q?e(t.Trigger,{render:q}):n("div",{className:"flex w-full items-center",children:[n(t.Trigger,{className:"flex min-w-0 flex-1 items-center text-start "+w+" "+W+" "+X+" "+o[k]+" "+g+" "+c+" focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px] "+(D?"cursor-not-allowed bg-transparent text-(--neba-disabled-fg)":"cursor-pointer hover:bg-(--n-soft) data-[panel-open]:text-(--n-on-tint)"),children:[d(I)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:I}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${b[k]}`,children:[d(T)?e("span",{className:`${S} font-semibold ${u[k]}`,style:V,children:T}):null,d(U)?e("span",{className:`${S} text-(--neba-muted-fg) ${f[k]}`,style:V,children:U}):null]}),A?e("span",{className:`${j} text-(--neba-muted-fg)`,children:e(i,{})}):null]}),d(P)?e("span",{className:`flex shrink-0 items-center ${W}`,children:P}):null]}),e(t.Panel,{hiddenUntilFound:G,keepMounted:G?void 0:H,className:r,children:e("div",{className:["min-w-0 text-(--neba-muted-fg)",p[k],E?W:"",E?q?X:"compact"===B?"pb-2":"pb-4":""].filter(Boolean).join(" "),children:L})})]})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as l from"react";import{Collapsible as t}from"@base-ui/react/collapsible";import{boxPaddingXClasses as a,boxPaddingYClasses as s}from"../box/Box.js";import{ChevronIcon as i}from"../../internal/icons.js";import{collapsiblePanelClasses as r,gapClasses as o,hasContent as d,iconClasses as c,metaTextClasses as f,radiusClasses as m,sheetBodyClasses as p,sheetHeaderGapClasses as b,sheetTitleClasses as u,surfaceClasses as x,surfaceSlots as h,transitionClasses as g,clampClasses as v,clampSlot as N,disclosureChevronClasses as j,disclosureTriggerClasses as w}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const $={solid:x+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:x+" 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"};export const Collapsible=/*@__PURE__*/l.forwardRef(function Collapsible(l,x){const{variant:C="outline",size:k="md",color:O="primary",density:B="default",elevation:z=0,open:F,defaultOpen:M=!1,onOpenChange:R,title:T,subtitle:U,lines:_,startIcon:I,action:P,trigger:q,indicator:A=!0,disabled:D=!1,padded:E=!0,hiddenUntilFound:G=!0,keepMounted:H=!1,className:J,style:K,children:L,...Q}=y(l,["size","density","variant"]),S=_?v(_):"",V=N(_),W=a[B][k],X=s[B][k];return n(t.Root,{ref:x,open:F,defaultOpen:M,onOpenChange:e=>R?.(e),disabled:D,className:[q?"flex flex-col":"flex flex-col overflow-hidden",m[k],$[C],g,J??""].filter(Boolean).join(" "),style:{...h(O,z),...K},...Q,children:[q?e(t.Trigger,{render:q}):n("div",{className:"flex w-full items-center",children:[n(t.Trigger,{className:"flex min-w-0 flex-1 items-center text-start "+w+" "+W+" "+X+" "+o[k]+" "+g+" "+c+" focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px] "+(D?"cursor-not-allowed bg-transparent text-(--neba-disabled-fg)":"cursor-pointer hover:bg-(--n-soft) data-[panel-open]:text-(--n-on-tint)"),children:[d(I)?e("span",{className:"flex h-[1lh] shrink-0 items-center text-(--neba-muted-fg)",children:I}):null,n("span",{className:`flex min-w-0 flex-1 flex-col ${b[k]}`,children:[d(T)?e("span",{className:`${S} font-semibold ${u[k]}`,style:V,children:T}):null,d(U)?e("span",{className:`${S} text-(--neba-muted-fg) ${f[k]}`,style:V,children:U}):null]}),A?e("span",{className:`${j} text-(--neba-muted-fg)`,children:e(i,{})}):null]}),d(P)?e("span",{className:`flex shrink-0 items-center ${W}`,children:P}):null]}),e(t.Panel,{hiddenUntilFound:G,keepMounted:G?void 0:H,className:q?`${r} rounded-b-[inherit]`:r,children:e("div",{className:["min-w-0 text-(--neba-muted-fg)",p[k],E?W:"",E?q?X:"compact"===B?"pb-2":"pb-4":""].filter(Boolean).join(" "),children:L})})]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import{useLayoutEffectOnClient as a}from"../../internal/layout-effect.js";import{Box as o}from"../box/Box.js";import{Button as l}from"../button/Button.js";import{Checkbox as i}from"../checkbox/Checkbox.js";import{Pagination as s}from"../pagination/Pagination.js";import{TextField as c}from"../text-field/TextField.js";import{RowsPerPage as u}from"./RowsPerPage.js";import{compareValues as d,dataHeaderHeights as p,dataRowHeights as g,dataTickWidths as f,defaultColumnWidth as m,isEmptyValue as h,keysBetween as b,minColumnWidth as y,nextSort as v,pageBounds as k,sortRows as w,virtualWindow as x}from"../../internal/data-table.js";import{beginPointerDrag as S,drawnScale as C}from"../../internal/drag.js";import{memoise as M}from"../../internal/cache.js";import{dateFormatter as R}from"../../internal/format.js";import{emptyMessages as N,fillMessage as _,tableMessages as D,useMessages as T}from"../../internal/i18n.js";import{searchHaystack as I,searchText as K}from"../../internal/search.js";import{ChevronIcon as A}from"../../internal/icons.js";import{observeResize as $}from"../../internal/observe.js";import{downloadText as z,toCsv as j}from"../../internal/csv.js";import{controlTextLeadingClasses as P,cx as E,hasContent as H,insetRingClasses as B,metaTextClasses as O,paddingXValues as F,srOnlyClasses as L,toLength as W,transitionClasses as V}from"../../internal/styles.js";import{useStyleDefaults as X}from"../../internal/defaults.js";import{whenIdle as q}from"../../internal/idle.js";import{useIntlLocale as G}from"../../internal/media.js";const U={"--n-stripe":"color-mix(in oklab, var(--neba-fg) 4%, transparent)"},Y="Alt+ArrowLeft Alt+ArrowRight";function J(e){const t=e.currentTarget;t.scrollWidth>t.clientWidth?t.title=t.textContent??"":t.removeAttribute("title")}const Q='button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="switch"], [role="radio"]',Z={start:"shadow-[inset_2px_0_0_var(--n-accent)] rtl:shadow-[inset_-2px_0_0_var(--n-accent)]",end:"shadow-[inset_-2px_0_0_var(--n-accent)] rtl:shadow-[inset_2px_0_0_var(--n-accent)]"},ee='[data-neba-tick] [role="checkbox"], [data-neba-editor]';const te=new Map;function SearchIcon(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("circle",{cx:"7.25",cy:"7.25",r:"4.75",stroke:"currentColor",strokeWidth:"1.5"}),e("path",{d:"m10.75 10.75 2.75 2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function ne(e,t,n){return{position:"sticky",insetInlineStart:"start"===e?`${t}px`:void 0,insetInlineEnd:"end"===e?`${t}px`:void 0,zIndex:n?21:1,backgroundColor:"var(--n-panel-press)",backgroundImage:n?void 0:"linear-gradient(var(--n-row), var(--n-row))"}}function re(e,t,n){if(!e.pinned)return{};const r="start"===e.pinned?t.start.get(e.key):t.end.get(e.key);return ne(e.pinned,r??0,n)}function ae(e,t){return e.value?e.value(t):t[e.key]}function oe(e,t,n){return n&&("function"==typeof e.editable?e.editable(t):Boolean(e.editable))}function le(t){return e("span",{className:"flex items-center justify-center",children:t})}function DataTableRow({entry:n,index:r,position:a,selected:o,active:l,editing:s,look:c,actions:u}){const{columns:d,reactId:p,cellStyle:g}=c,f=`${p}-first-${n.origin}`;return t("tr",{id:`${p}-${n.key}`,"aria-selected":c.selects?o:void 0,"aria-rowindex":c.virtualized?r+c.headRows+1:void 0,"data-neba-row":n.key,className:E("[--n-row:transparent] [transition:background-color_var(--neba-duration)_var(--neba-ease)]",o?"[--n-row:var(--n-soft-press)]":null!==c.stripe&&r%2===c.stripe?"[--n-row:var(--n-stripe)]":"",!o&&c.hoverable?"hover:[--n-row:var(--n-soft)]":"",l&&c.navigable?"[box-shadow:inset_0_0_0_1px_var(--n-ring)]":"",c.pressable?"cursor-default":""),style:{height:`${c.rowHeight}px`,backgroundColor:"var(--n-row)"},onPointerDown:e=>u.current?.pointerDown(n,e),onClick:e=>u.current?.click(n,a,e),onDoubleClick:e=>u.current?.doubleClick(n,a,e),children:[c.showTicks?e("td",{"data-neba-tick":"",role:c.selects?"gridcell":void 0,style:{...g,padding:0,overflow:"visible",...c.pinsStart?ne("start",0,!1):{}},children:le(e(i,{size:c.size,color:c.color,checked:o,tabIndex:-1,"aria-labelledby":d.length>0?`${c.tickNameId} ${f}`:void 0,"aria-label":d.length>0?void 0:c.selectRowLabel,onCheckedChange:()=>u.current?.tick(n.key)}))}):null,d.map((t,r)=>{const o=oe(t,n.row,c.edits),l=s===t.key,i=l?ae(t,n.row):void 0;return e("td",{id:c.showTicks&&0===r?f:void 0,role:c.navigable?"gridcell":void 0,style:{...g,...re(t,c.pinOffsets,!1),textAlign:t.align??"start",cursor:o&&!l?"cell":void 0},onPointerEnter:t.render||l?void 0:J,onDoubleClick:o?e=>{e.stopPropagation(),u.current?.openEditor(n.key,t.key)}:void 0,children:l?e("input",{autoFocus:!0,"data-neba-editor":"",type:"number"===t.editType?"number":"text",defaultValue:null==i?"":String(i),"aria-label":"string"==typeof t.label?t.label:t.key,className:"neba-input w-full bg-transparent [font:inherit] text-inherit [outline:none]",style:{textAlign:t.align??"start"},onPointerDown:e=>e.stopPropagation(),onBlur:e=>u.current?.editorBlur(n,t,e.currentTarget.value),onKeyDown:e=>u.current?.editorKeyDown(n,t,e)}):t.render?t.render(n.row,a):(d=n.row[t.key],p=c.dateLocale,"boolean"==typeof d?String(d):d instanceof Date?Number.isNaN(d.getTime())?"":R(p,{dateStyle:"medium"}).format(d):d)},t.key);var d,p}),c.filler?e("td",{"aria-hidden":"true",style:{...g,padding:0}}):null]})}const ie=/*@__PURE__*/r.memo(DataTableRow);function DataTableBody({paged:t,pageIndex:n,instead:o,virtualized:l,rowHeight:i,overscan:s,viewportHeight:c,scrollSinkRef:u,tableRef:d,columnCount:p,editingKey:g,activeKey:f,reactId:m,row:h}){const[b,y]=r.useState(0);a(()=>{const e=e=>{const t=Math.floor(e/i)*i;y(e=>e===t?e:t)};return u.current=e,()=>{u.current===e&&(u.current=null)}},[i,u]);const v=l?x(b,c,i,t.length,s):{start:0,end:t.length,before:0,after:0},k=null===f?-1:n.get(f)??-1,w=-1!==k&&(null!==o||k>=v.start&&k<v.end)?`${m}-${f}`:null;if(a(()=>{const e=d.current;e&&e.getAttribute("aria-activedescendant")!==w&&(null===w?e.removeAttribute("aria-activedescendant"):e.setAttribute("aria-activedescendant",w))}),null!==o)return o;const S=(t,n)=>n>0?e("tr",{"aria-hidden":"true",style:{height:`${n}px`},children:e("td",{colSpan:p,style:{padding:0,border:0}})},t):null,C=null===g?-1:n.get(g)??-1,M=-1!==C&&C<v.start,R=-1!==C&&C>=v.end;return[...M?[S("before",C*i),h(t[C],C),S("before-rest",v.before-(C+1)*i)]:[S("before",v.before)],...t.slice(v.start,v.end).map((e,t)=>h(e,v.start+t)),...R?[S("after-rest",(C-v.end)*i),h(t[C],C),S("after",v.after-(C-v.end+1)*i)]:[S("after",v.after)]]}export function DataTable(x){const{headers:R,items:J,getRowKey:se,variant:ce="outline",size:ue="sm",color:de="primary",density:pe="compact",elevation:ge=0,height:fe,maxHeight:me,rowHeight:he,striped:be=!1,hoverable:ye=!0,stickyHeader:ve=!0,caption:ke,label:we,empty:xe,virtual:Se=!0,overscan:Ce=8,sortable:Me=!1,sortMode:Re="single",sort:Ne,defaultSort:_e,onSortChange:De,resizable:Te=!1,columnWidths:Ie,columnOrder:Ke,defaultColumnOrder:Ae,onColumnOrderChange:$e,reorderable:ze=!1,defaultColumnWidths:je,onColumnWidthsChange:Pe,selectionMode:Ee="none",selected:He,defaultSelected:Be,onSelectedChange:Oe,checkboxes:Fe=!1,onRowClick:Le,onRowActivate:We,paging:Ve="scroll",page:Xe,defaultPage:qe=1,onPageChange:Ge,getPageHref:Ue,pageSize:Ye,defaultPageSize:Je=25,onPageSizeChange:Qe,pageSizeOptions:Ze=[10,25,50,100],footer:et,search:tt,defaultSearch:nt,onSearchChange:rt,searchable:at=!1,searchPlaceholder:ot,filter:lt,toolbar:it,exportable:st=!1,exportFileName:ct="table.csv",onExport:ut,exportEscapeFormulas:dt=!0,onCellEdit:pt,groupBy:gt,collapsibleGroups:ft=!0,defaultCollapsedGroups:mt,manual:ht=!1,rowCount:bt,locale:yt,className:vt,style:kt,...wt}=X(x,["size","density","variant","locale"]),xt=T(D,yt),St=T(N,yt),Ct=function(e){return M(te,e??"",()=>({collator:new Intl.Collator(e).resolvedOptions().locale,number:new Intl.NumberFormat(e).resolvedOptions().locale,date:new Intl.DateTimeFormat(e).resolvedOptions().locale}))}(G(yt)),Mt=r.useId(),Rt=he??g[pe][ue],Nt=p[pe][ue],_t=F[pe][ue],Dt=r.useMemo(()=>new Set(!0===ht?["sort","filter","pages"]:ht||[]),[ht]),[Tt,It]=r.useState(()=>Ae??[]),Kt=Ke??Tt,At=e=>{void 0===Ke&&It(e),$e?.(e)},$t=r.useMemo(()=>{const e=R.filter(e=>!e.hidden),t=Kt.map(t=>e.find(e=>e.key===t)).filter(e=>void 0!==e),n=e.filter(e=>!Kt.includes(e.key)),r=0===Kt.length?e:[...t,...n],a=e=>"start"===e.pinned?0:"end"===e.pinned?2:1;return r.map((e,t)=>({column:e,index:t})).sort((e,t)=>a(e.column)-a(t.column)||e.index-t.index).map(e=>e.column)},[R,Kt]),zt=$t.some(e=>void 0!==e.group),jt=zt?2:1,Pt="none"!==Ee,Et="multiple"===Ee,Ht=Pt&&Fe,Bt=void 0!==pt&&$t.some(e=>void 0!==e.editable),Ot=Pt||void 0!==We||Bt,Ft=r.useMemo(()=>J.map((e,t)=>{const n=se?se(e,t):t;return{row:e,identity:n,key:String(n),origin:t}}),[J,se]),[Lt,Wt]=r.useState(nt??""),Vt=r.useDeferredValue((tt??Lt).trim()),Xt=r.useMemo(()=>$t.filter(e=>!1!==e.searchable),[$t]),qt=r.useMemo(()=>{const e=[],t=t=>{const n=Math.min(Ft.length,e.length+t);for(let t=e.length;t<n;t+=1){const n=Ft[t].row;e.push(I(Xt.map(e=>e.value?e.value(n):n[e.key])))}return e.length<Ft.length};return{fold:t,all:()=>(t(1/0),e)}},[Ft,Xt]),Gt=Dt.has("filter");r.useEffect(()=>{if(!at||Gt||0===Xt.length)return;let e=()=>{};const t=n=>{const r=performance.now()+8;let a=qt.fold(200);for(;a&&performance.now()<r&&(void 0===n||n.timeRemaining()>1);)a=qt.fold(200);a&&(e=q(t,1e3))};return e=q(t,1e3),()=>e()},[at,Gt,Xt.length,qt]);const Ut=r.useMemo(()=>new Intl.Collator(Ct.collator,{numeric:!0,sensitivity:"base"}),[Ct.collator]),[Yt,Jt]=r.useState(_e??[]),Qt=Ne??Yt,Zt=r.useMemo(()=>Dt.has("sort")?Ft:w(Ft,Qt,e=>{const t=$t.find(t=>t.key===e);if(!t)return null;if(t.compare)return(e,n)=>t.compare(e.row,n.row);const n=t.value?t.value:e=>e[t.key];return{compare:(e,t)=>d(n(e.row),n(t.row),Ut),isEmpty:e=>h(n(e.row))}}),[Ft,Qt,$t,Ut,Dt]),en=r.useMemo(()=>{if(Gt)return Zt;const e=K(Vt);let t=Zt;if(""!==e&&Xt.length>0){const n=qt.all();t=Zt.filter(t=>n[t.origin].includes(e))}return lt?t.filter(e=>lt(e.row,e.origin)):t},[Zt,Vt,lt,Gt,Xt,qt]),[tn,nn]=r.useState(qe),[rn,an]=r.useState(Je),on=Ye??rn,[ln,sn]=r.useState(()=>new Set(mt??[])),cn=r.useMemo(()=>{if(!gt)return null;const e=[],t=new Map;for(const n of en){const r=gt(n.row)??"";t.has(r)||(t.set(r,[]),e.push(r)),t.get(r).push(n)}return{order:[...e].sort((e,t)=>""===e?-1:""===t?1:0),byLabel:t}},[en,gt]),un=r.useMemo(()=>cn?cn.order.flatMap(e=>ln.has(e)?[]:cn.byLabel.get(e)??[]):en,[cn,ln,en]),dn=Dt.has("pages")?bt??un.length:un.length,pn=k(dn,Xe??tn,on),gn=r.useMemo(()=>"pages"!==Ve||Dt.has("pages")?un:un.slice(pn.start,pn.end),[un,Ve,Dt,pn.start,pn.end]),fn="pages"===Ve?pn.start:0,mn=r.useMemo(()=>gn.map(e=>e.key),[gn]),hn=r.useMemo(()=>new Map(mn.map((e,t)=>[e,t])),[mn]),bn=r.useMemo(()=>new Map(Ft.map(e=>[e.key,e])),[Ft]),[yn,vn]=r.useState(Be??[]),kn=He??yn,wn=r.useMemo(()=>new Set(kn.map(String)),[kn]),[xn,Sn]=r.useState(null),Cn=r.useRef(null),Mn=r.useRef({paged:gn,pagedKeys:mn,pageIndex:hn,byKey:bn,selectedKeys:wn,selectedValues:kn,multiple:Et});Mn.current={paged:gn,pagedKeys:mn,pageIndex:hn,byKey:bn,selectedKeys:wn,selectedValues:kn,multiple:Et};const Rn=r.useCallback(e=>{const t=[],n=[],r=Dt.has("pages")?new Map(Mn.current.selectedValues.map(e=>[String(e),e])):null;for(const a of e){const e=Mn.current.byKey.get(a);e?(t.push(e.identity),n.push(e.row)):r?.has(a)&&t.push(r.get(a))}void 0===He&&vn(t),Oe?.(t,n)},[He,Oe,Dt]),Nn=r.useCallback(e=>{Cn.current=e,Rn([e])},[Rn]),_n=r.useCallback(e=>{const t=Mn.current.selectedKeys,n=new Set(t);n.has(e)?n.delete(e):n.add(e),Cn.current=e,Rn([...n])},[Rn]),Dn=r.useCallback((e,t)=>{const{pagedKeys:n,pageIndex:r}=Mn.current,a=Cn.current??n[0];if(void 0===a)return;const o=b(n,a,e,r);0!==o.length?Rn(t?[...new Set([...Mn.current.selectedKeys,...o])]:o):r.has(e)&&(Cn.current=e,Rn(t?[...new Set([...Mn.current.selectedKeys,e])]:[e]))},[Rn]),Tn=r.useRef(null),In=r.useRef(null),Kn=r.useRef(null),An=r.useRef(null),$n=void 0!==fe||void 0!==me,zn=void 0!==gt,jn=Se&&$n&&gn.length>0&&!gt,Pn=Se&&!jn&&gn.length>500?gn.length:0,En=r.useRef(!1);r.useEffect(()=>{"production"===process.env.NODE_ENV||0===Pn||En.current||(En.current=!0,console.warn(`Neba: a DataTable is drawing ${Pn} rows at once, because ${zn?"a grouped table is never virtual":"nothing bounds its height"}. ${zn?'Page it with paging="pages", or leave groupBy off and give it a height or a maxHeight':'Give it a height or a maxHeight to draw only the rows on screen, or page it with paging="pages"'}. Pass virtual={false} if every row is meant to be drawn.`))},[Pn,zn]);const[Hn,Bn]=r.useState(0);a(()=>{const e=Tn.current;if(e&&jn)return Bn(e.clientHeight),$(e,e=>Bn(e.contentRect.height))},[jn]);const On=r.useRef(null),Fn=r.useCallback(e=>{jn&&On.current?.(e.currentTarget.scrollTop)},[jn]),[Ln,Wn]=r.useState(je??{}),Vn=Ie??Ln,Xn=r.useCallback(e=>{void 0===Ie&&Wn(e),Pe?.(e)},[Ie,Pe]),qn=r.useRef(new Map),Gn=r.useRef(null),Un=r.useRef(null),[Yn,Jn]=r.useState(null),[Qn,Zn]=r.useState(null),er=r.useRef(null),tr=r.useRef(null);r.useEffect(()=>()=>{Gn.current?.(),Un.current?.()},[]);const nr=()=>{const e={...Vn};for(const t of $t){const n=qn.current.get(t.key);n&&void 0===e[t.key]&&(e[t.key]=n.offsetWidth)}return e},rr=e=>$t.find(t=>t.key===e)?.minWidth??y,ar=r.useRef(null);a(()=>{const e=ar.current;if(null===e)return;ar.current=null;const t=qn.current.get(e),n=t?.querySelector("button")??t;n&&n!==document.activeElement&&n.focus()});const or=r.useCallback((e,t)=>{const n=Tn.current,r=In.current;if(!n||!r)return;const a=function(e,t){for(let n=0;n<e.rows.length;n+=1)if(e.rows[n].dataset.nebaRow===t)return e.rows[n];return null}(r,e);if(!$n)return void a?.scrollIntoView({block:"nearest",inline:"nearest"});const o=n.getBoundingClientRect().top+n.clientTop-n.scrollTop,l=(a??r).getBoundingClientRect(),i=l.top-o+(a?0:t*Rt),s=i+(a?l.height:Rt),c=ve?Kn.current?.tHead?.getBoundingClientRect().height??0:0;i<n.scrollTop+c?n.scrollTop=Math.max(0,Math.floor(i-c)):s>n.scrollTop+n.clientHeight&&(n.scrollTop=Math.ceil(s-n.clientHeight))},[$n,ve,Rt]),lr=(e,t,n=!0)=>{const r=Mn.current.paged,a=Math.min(Math.max(e,0),r.length-1),o=r[a];o&&(t.preventDefault(),Sn(o.key),or(o.key,a),Pt&&(t.shiftKey&&Mn.current.multiple?Dn(o.key,!1):!n||t.ctrlKey||t.metaKey||Nn(o.key)))},ir=(e,t,n)=>{const r=Tn.current;if(!r||!$n)return;n.preventDefault();const a=Math.max(0,r.scrollHeight-r.clientHeight),o="start"===e?0:"end"===e?a:r.scrollTop+e;r.scrollTop=Math.min(Math.max(o,0),a),lr(t,n,!1)};const sr=r.useCallback(e=>{const t=In.current,n=Mn.current.paged;if(!t||0===n.length)return null;if(zn){const r=t.querySelectorAll("tr[data-neba-row]");let a=0,o=r.length-1,l=0;for(;a<=o;){const t=a+o>>1;r[t].getBoundingClientRect().top<=e?(l=t,a=t+1):o=t-1}return Math.min(l,n.length-1)}const r=t.getBoundingClientRect().top,a=Math.floor((e-r)/Rt);return Math.min(Math.max(a,0),n.length-1)},[Rt,zn]),cr=r.useRef(null),ur=r.useCallback(e=>{const t=sr(e),n=null===t?void 0:Mn.current.paged[t],r=cr.current;!n||r&&r.key===n.key||(r&&(r.key=n.key),Sn(n.key),Dn(n.key,!1))},[sr,Dn]),dr=r.useRef(ur);dr.current=ur;r.useEffect(()=>()=>cr.current?.stop(),[]);const pr=r.useMemo(()=>mn.reduce((e,t)=>wn.has(t)?e+1:e,0),[mn,wn]),gr=mn.length>0&&pr===mn.length,fr=f[ue],mr=e=>Vn[e.key]??e.width,hr=(Ht?fr:0)+$t.reduce((e,t)=>e+(mr(t)??y),0),br=$t.length>0&&$t.every(e=>void 0!==mr(e)),yr=$t.length+(Ht?1:0)+(br?1:0),vr=r.useMemo(()=>{const e=[];return $t.forEach((t,n)=>{const r=e[e.length-1];r&&void 0!==r.label&&r.label===t.group?r.span+=1:e.push({label:t.group,span:1,from:n})}),e},[$t]),kr=$t.filter(e=>e.pinned).map(e=>mr(e)??"").join(","),wr=r.useMemo(()=>{const e=new Map,t=new Map;let n=Ht?fr:0;for(const t of $t)"start"===t.pinned&&(e.set(t.key,n),n+=mr(t)??m);let r=0;for(let e=$t.length-1;e>=0;e-=1){const n=$t[e];"end"===n.pinned&&(t.set(n.key,r),r+=mr(n)??m)}return{start:e,end:t}},[$t,kr,Ht,fr]),xr=(e,t)=>re(e,wr,t),Sr=$t.some(e=>"start"===e.pinned),Cr=e=>Sr?ne("start",0,e):{},Mr=r.useMemo(()=>({padding:`0 ${_t}`,borderBottom:"1px solid var(--n-line)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[_t]),Rr={...Mr,height:`${Nt}px`,backgroundColor:"var(--n-panel-press)",color:"var(--n-cell-ink, var(--neba-muted-fg))"},Nr=r.useMemo(()=>new Intl.NumberFormat(Ct.number),[Ct.number]),_r=et??"pages"===Ve,Dr=_(xt.range,{start:Nr.format(0===dn?0:("pages"===Ve?pn.start:0)+1),end:Nr.format("pages"===Ve?pn.end:dn),total:Nr.format(dn)}),Tr=Pt&&wn.size>0?_(xt.selected,{count:Nr.format(wn.size)}):"",Ir=e=>{void 0===Xe&&nn(e),Ge?.(e)},Kr=`${Mt}-tick`,Ar=Pt||void 0!==Le,$r=void 0!==pt,zr=r.useMemo(()=>({columns:$t,reactId:Mt,selects:Pt,navigable:Ot,showTicks:Ht,pressable:Ar,virtualized:jn,headRows:jt,stripe:!1===be?null:"odd"===be?0:1,hoverable:ye,rowHeight:Rt,cellStyle:Mr,pinOffsets:wr,pinsStart:Sr,filler:br,edits:$r,size:ue,color:de,dateLocale:Ct.date,tickNameId:Kr,selectRowLabel:xt.selectRow}),[$t,Mt,Pt,Ot,Ht,Ar,jn,jt,be,ye,Rt,Mr,wr,Sr,br,$r,ue,de,Ct.date,Kr,xt.selectRow]),jr=r.useRef(null),Pr=(t,n)=>e(ie,{entry:t,index:n,position:fn+n,selected:wn.has(t.key),active:xn===t.key,editing:Or?.key===t.key?Or.column:null,look:zr,actions:jr,redraw:x},t.key),Er=e=>{const t=$t.map(e=>e.key);return null!==Yn&&t.indexOf(Yn)<t.indexOf(e)?"end":"start"},Hr=(r,a,o)=>{const l=r.sortable??Me,i=r.resizable??Te,s=ze&&!r.pinned,c=(u=r.key,Qt.find(e=>e.key===u));var u;const d=c?Qt.findIndex(e=>e.key===r.key)+1:0,p=r.headerAlign??r.align??"start",g=i&&a<$t.length-1,f=g||d>1?`${Mt}-head-${a}`:void 0;return t("th",{"aria-labelledby":f,ref:e=>{e?qn.current.set(r.key,e):qn.current.delete(r.key)},scope:"col",rowSpan:o,"aria-sort":c&&1===d?"asc"===c.direction?"ascending":"descending":void 0,"data-column":r.key,"data-dragging":Yn===r.key||void 0,className:E("relative font-semibold select-none",ve?"sticky z-20 [backdrop-filter:var(--neba-blur)]":"",s?Yn===r.key?"cursor-grabbing":"cursor-grab":"",s&&!l?B:"",Qn===r.key?Z[Er(r.key)]:""),style:{...Rr,...xr(r,!0),backgroundImage:Yn===r.key?"linear-gradient(var(--n-soft), var(--n-soft))":void 0,top:ve?2!==o&&zt?Nt:0:void 0,textAlign:p,color:c?"var(--n-cell-ink, var(--n-accent))":Rr.color},tabIndex:s&&!l?0:void 0,"aria-keyshortcuts":s&&!l?Y:void 0,onPointerDown:s?e=>((e,t)=>{if(0!==t.button)return;const n=t.currentTarget,r=t.clientX;let a=!1;Un.current=S({target:n,pointerId:t.pointerId,capture:!1,onMove:t=>{if(!a){if(Math.abs(t.clientX-r)<6)return;a=!0,er.current=e,Jn(e)}const n=$t.find(e=>{if(e.pinned)return!1;const n=qn.current.get(e.key);if(!n)return!1;const r=n.getBoundingClientRect();return t.clientX>=r.left&&t.clientX<=r.right});tr.current=n&&n.key!==e?n.key:null,Zn(tr.current)},onEnd:()=>{const e=er.current,t=tr.current;if(Un.current=null,er.current=null,tr.current=null,Jn(null),Zn(null),e&&t&&e!==t){const n=$t.map(e=>e.key),r=n.indexOf(e),a=n.indexOf(t);n.splice(a,0,...n.splice(r,1)),At(n)}}})})(r.key,e):void 0,onKeyDown:s?e=>((e,t)=>{if(!t.altKey||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault();const n="rtl"===getComputedStyle(t.currentTarget).direction,r="ArrowRight"===t.key!==n?1:-1,a=$t.map(e=>e.key),o=a.indexOf(e),l=$t[o+r];l&&!l.pinned&&(a.splice(o+r,0,...a.splice(o,1)),ar.current=e,At(a))})(r.key,e):void 0,children:[l?t("button",{type:"button","aria-keyshortcuts":s?Y:void 0,className:E("group/sort flex w-full min-w-0 cursor-pointer items-center gap-1 text-inherit [outline:none] [transition:color_var(--neba-duration)_var(--neba-ease)] hover:text-(--n-accent) focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1 [&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0","end"===p?"justify-end":"center"===p?"justify-center":"justify-start"),onClick:e=>((e,t)=>{const n=v(Qt,e,t&&"multiple"===Re);void 0===Ne&&Jt(n),De?.(n)})(r.key,e.shiftKey),children:[e("span",{id:f,className:"min-w-0 truncate",children:r.label??r.key}),e("span",{"aria-hidden":"true",className:E("flex items-center","desc"===c?.direction?"rotate-0":"rotate-180",c?"":"text-transparent group-hover/sort:text-inherit group-focus-visible/sort:text-inherit"),children:e(A,{})}),d>1?t(n,{children:[e("span",{"aria-hidden":"true",className:"text-[0.85em] tabular-nums",children:d}),t("span",{className:L,children:[" ",_("desc"===c?.direction?xt.sortDescending:xt.sortAscending,{order:Nr.format(d)})]})]}):null]}):e("span",{id:f,className:"block truncate",children:r.label??r.key}),g?e("span",{role:"separator","aria-orientation":"vertical","aria-label":_(xt.resizeColumn,{column:"string"==typeof r.label?r.label:r.key}),"aria-valuenow":Vn[r.key]??r.width,"aria-valuemin":rr(r.key),tabIndex:0,className:"absolute inset-y-0 z-10 w-2 cursor-col-resize select-none end-0 translate-x-1/2 rtl:-translate-x-1/2 after:absolute after:inset-y-1 after:start-1/2 after:w-px after:[background:transparent] after:[transition:background_var(--neba-duration)_var(--neba-ease)] hover:after:[background:var(--n-accent)] data-[dragging]:after:[background:var(--n-accent)] focus-visible:after:[background:var(--n-accent)] [outline:0_solid_transparent] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0",onFocus:e=>{const t=qn.current.get(r.key);t&&!e.currentTarget.hasAttribute("aria-valuenow")&&e.currentTarget.setAttribute("aria-valuenow",String(t.offsetWidth))},onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r=nr(),a=qn.current.get(e),o=a?C(a).x:1,l="rtl"===getComputedStyle(n).direction,i=t.clientX,s=r[e]??m,c=rr(e);Gn.current=S({target:n,pointerId:t.pointerId,onMove:t=>{const n=(t.clientX-i)/o*(l?-1:1);Xn({...r,[e]:Math.max(c,Math.round(s+n))})},onEnd:()=>{Gn.current=null}})})(r.key,e),onDoubleClick:()=>(e=>{const t={...Vn};delete t[e],Xn(t)})(r.key),onKeyDown:e=>((e,t)=>{if("ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault(),t.stopPropagation();const n="rtl"===getComputedStyle(t.currentTarget).direction,r="ArrowRight"===t.key!==n,a=nr(),o=a[e]??m;Xn({...a,[e]:Math.max(rr(e),o+(r?16:-16))})})(r.key,e)}):null]},r.key)},Br=(n,r)=>{const a=ln.has(n),o=ft,l=r.map(e=>e.row),i=()=>sn(e=>{const t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),s=t("span",{className:"flex min-w-0 items-center gap-1.5",children:[o?e("span",{"aria-hidden":"true",className:E("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",a?"-rotate-90 rtl:rotate-90":""),children:e(A,{})}):null,e("span",{className:"truncate font-semibold",children:""===n?xt.noGroup:n}),e("span",{className:"shrink-0 text-(--neba-muted-fg) tabular-nums",children:Nr.format(r.length)})]});return t("tr",{"data-neba-group":n,style:{height:`${Rt}px`,backgroundColor:"var(--n-soft)"},children:[Ht?e("td",{style:{...Mr,padding:0,...Cr(!1)}}):null,$t.map((t,n)=>e("td",{colSpan:1,style:{...Mr,...xr(t,!1),textAlign:0===n?"start":t.align??"start"},children:0===n?o?e("button",{type:"button","aria-expanded":!a,className:`flex w-full min-w-0 items-center text-start ${V} focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]`,onClick:i,children:s}):s:t.aggregate?e("span",{className:"tabular-nums",children:t.aggregate(l)}):null},t.key)),br?e("td",{"aria-hidden":"true",style:{...Mr,padding:0}}):null]})},[Or,Fr]=r.useState(null),Lr=r.useRef(!1);function Wr(e,t){Lr.current=!1,Fr({key:e,column:t})}const Vr=(e,t)=>oe(e,t,void 0!==pt),Xr=(e,t,n)=>{Fr(null);const r=ae(t,e.row),a="number"===t.editType?Number(n):n;("number"!==t.editType||""!==n.trim()&&!Number.isNaN(a))&&String(a)!==String(r??"")&&pt?.(e.row,t,a)};jr.current={pointerDown:function(e,t){if(An.current=null,Pt){if(!t.target.closest(Q))if("touch"!==t.pointerType)if(Kn.current?.focus({preventScroll:!0}),Sn(e.key),2!==t.button){if(0===t.button)return t.shiftKey&&Et?(t.preventDefault(),void Dn(e.key,t.ctrlKey||t.metaKey)):void((t.ctrlKey||t.metaKey)&&Et?_n(e.key):(Nn(e.key),Et&&((e,t)=>{const n=Kn.current;if(cr.current||!n)return;const r=e.clientY,a=()=>{const e=cr.current,t=Tn.current;if(!e||!t||0===e.speed)return void(e&&(e.frame=null));const n=t.scrollTop;t.scrollTop=n+e.speed;const r=t.scrollTop!==n;dr.current(e.y),e.frame=r?requestAnimationFrame(a):null};let o=()=>{};const l=()=>{const e=cr.current;null!=e?.frame&&cancelAnimationFrame(e.frame),cr.current=null,o()};cr.current={y:r,speed:0,frame:null,stop:l,key:t},o=S({target:n,pointerId:e.pointerId,onMove:e=>{const t=cr.current,n=Tn.current;if(t){if(t.y=e.clientY,n&&$n){const e=n.getBoundingClientRect(),r=e.top+Rt-t.y,a=t.y-(e.bottom-Rt);t.speed=r>0?-Math.min(r,40):a>0?Math.min(a,40):0}null!==t.frame&&0!==t.speed||(dr.current(t.y),0!==t.speed&&null===t.frame&&(t.frame=requestAnimationFrame(a)))}},onEnd:l,capture:!1,mark:!1})})(t,e.key)))}else Mn.current.selectedKeys.has(e.key)||Nn(e.key);else An.current=e.key}else Ot&&!t.target.closest(Q)&&Sn(e.key)},click:(e,t,n)=>{n.target.closest(ee)||(An.current===e.key&&(An.current=null,Kn.current?.focus({preventScroll:!0}),Sn(e.key),Nn(e.key)),Le?.(e.row,t,n))},doubleClick:(e,t,n)=>{n.target.closest(ee)||We?.(e.row,t)},tick:e=>{Et?_n(e):Nn(e)},openEditor:Wr,editorBlur:(e,t,n)=>{Lr.current||Xr(e,t,n)},editorKeyDown:(e,t,n)=>{"Enter"!==n.key&&"Escape"!==n.key||(n.stopPropagation(),Lr.current=!0,"Enter"===n.key?(n.preventDefault(),Xr(e,t,n.currentTarget.value)):Fr(null),Kn.current?.focus({preventScroll:!0}))}};const qr=Et?le(e(i,{size:ue,color:de,checked:gr,indeterminate:pr>0&&!gr,"aria-label":xt.selectAll,onCheckedChange:()=>{if(gr){const e=new Set(mn);Rn([...wn].filter(t=>!e.has(t)))}else Rn([...new Set([...wn,...mn])])}})):null,Gr=br?e("th",{"aria-hidden":"true",className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0}}):null;return t(o,{variant:ce,size:ue,color:de,density:pe,elevation:ge,padded:!1,className:E("flex flex-col overflow-hidden",Ot?"has-[table:focus-visible,[data-neba-editor]:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[table:focus-visible,[data-neba-editor]:focus-visible]:outline-offset-2":"",vt),style:{...U,...kt},...wt,children:[at||st||H(it)?t("div",{className:"flex items-center gap-2",style:{padding:`${_t} ${_t}`,borderBottom:"1px solid var(--n-line)"},children:[at?e(c,{size:ue,color:de,density:pe,variant:"outline",type:"search",className:"w-full max-w-64",startIcon:e(SearchIcon,{}),placeholder:ot??xt.search,"aria-label":ot??xt.search,value:tt??Lt,onChange:e=>{const t=e.target.value;void 0===tt&&Wt(t),Ir(1),rt?.(t)}}):null,st||H(it)?t("div",{className:"ms-auto flex items-center gap-2",children:[it,st?e(l,{size:ue,color:de,density:pe,variant:"outline",onClick:()=>{const e=$t.filter(e=>!1!==e.exportable),t=e.map(e=>"string"==typeof e.label?e.label:e.key),n=en.map(t=>e.map(e=>e.exportValue?e.exportValue(t.row):e.value?e.value(t.row):t.row[e.key])),r=j([t,...n],{escapeFormulas:dt});ut?ut(r):z(r,ct,"text/csv;charset=utf-8")},children:xt.exportCsv}):null]}):null]}):null,e("div",{ref:Tn,className:"min-h-0 flex-auto overflow-auto overscroll-contain",style:{height:W(fe),maxHeight:W(me)},onScroll:Fn,children:t("table",{ref:Kn,role:Ot?"grid":void 0,"aria-label":we,"aria-multiselectable":Et||void 0,"aria-rowcount":jn?gn.length+jt:void 0,tabIndex:Ot?0:void 0,className:E("w-full text-start [outline:none]",P[ue],"text-(--neba-fg)",Pt?"select-none":""),style:{tableLayout:"fixed",borderCollapse:"separate",borderSpacing:0,minWidth:`${hr}px`},onKeyDown:function(e){if(!Ot||e.target!==e.currentTarget)return;const t=Mn.current.paged;if(0===t.length)return;const n=null===xn?-1:Mn.current.pageIndex.get(xn)??-1,r=Tn.current,a=ve?Kn.current?.tHead?.getBoundingClientRect().height??0:0,o=r?r.clientHeight-a:0,l=Math.max(1,Math.floor((o>0?o:10*Rt)/Rt)-1);switch(e.key){case"ArrowDown":lr(n+1,e);break;case"ArrowUp":lr(-1===n?0:n-1,e);break;case"Home":ir("start",0,e);break;case"End":ir("end",t.length-1,e);break;case"PageDown":ir(l*Rt,Math.max(n,0)+l,e);break;case"PageUp":ir(-l*Rt,Math.max(n,0)-l,e);break;case" ":Pt&&-1!==n&&(e.preventDefault(),(e.ctrlKey||e.metaKey)&&Et?_n(t[n].key):Nn(t[n].key));break;case"a":case"A":Pt&&(e.ctrlKey||e.metaKey)&&Et&&(e.preventDefault(),Rn(Mn.current.pagedKeys));break;case"Escape":Pt&&(e.preventDefault(),Rn([]));break;case"Enter":-1!==n&&We&&(e.preventDefault(),We(t[n].row,fn+n));break;case"F2":{const r=t[n],a=r?$t.find(e=>Vr(e,r.row)):void 0;r&&a&&(e.preventDefault(),Wr(r.key,a.key));break}}},children:[ke?e("caption",{className:E(O[ue],"text-(--neba-muted-fg)"),style:{padding:`0.5rem ${_t}`,textAlign:"start"},children:ke}):null,t("colgroup",{children:[Ht?e("col",{style:{width:`${fr}px`}}):null,$t.map(t=>{const n=mr(t);return e("col",{style:void 0===n?void 0:{width:`${n}px`}},t.key)}),br?e("col",{}):null]}),t("thead",{children:[zt?t("tr",{"aria-rowindex":jn?1:void 0,style:{height:`${Nt}px`},children:[Ht?e("th",{scope:"col",rowSpan:2,className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0,overflow:"visible",...Cr(!0)},children:qr}):null,vr.map(t=>void 0===t.label?Hr($t[t.from],t.from,2):e("th",{scope:"colgroup",colSpan:t.span,className:E("font-semibold select-none",ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,textAlign:"center"},children:t.label},`group-${t.from}`)),br?r.cloneElement(Gr,{rowSpan:2}):null]}):null,t("tr",{"aria-rowindex":jn?jt:void 0,style:{height:`${Nt}px`},children:[Ht&&!zt?e("th",{scope:"col",className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0,overflow:"visible",...Cr(!0)},children:qr}):null,$t.map((e,t)=>zt&&void 0===e.group?null:Hr(e,t)),br&&!zt?Gr:null]})]}),e("tbody",{ref:In,children:e(DataTableBody,{paged:gn,pageIndex:hn,instead:0===gn.length?e("tr",{children:e("td",{colSpan:yr,style:{padding:`2rem ${_t}`,textAlign:"center",color:"var(--n-cell-ink, var(--neba-muted-fg))"},children:xe??St.title})}):cn?cn.order.map(e=>{const n=cn.byLabel.get(e)??[],a=n.filter(e=>hn.has(e.key));return 0!==a.length||ln.has(e)?t(r.Fragment,{children:[Br(e,n),a.map(e=>Pr(e,hn.get(e.key)??0))]},e||"\0"):null}):null,virtualized:jn,rowHeight:Rt,overscan:Ce,viewportHeight:Hn,scrollSinkRef:On,tableRef:Kn,columnCount:yr,editingKey:Or?.key??null,activeKey:Ot?xn:null,reactId:Mt,row:Pr})})]})}),_r?t("div",{className:E("flex flex-wrap items-center gap-3",O[ue]),style:{padding:`0.375rem ${_t}`,borderTop:"1px solid var(--n-line)"},children:[t("span",{role:"status",className:"flex flex-wrap items-center gap-3",children:[e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:Dr}),Tr?e("span",{className:"text-(--n-accent) tabular-nums",children:Tr}):null]}),t("div",{className:"ms-auto flex items-center gap-2",children:["pages"===Ve&&Ze.length>0?e(u,{size:ue,color:de,density:pe,label:xt.rowsPerPage,options:Ze,value:on,onChange:e=>{void 0===Ye&&an(e),Ir(Math.floor(pn.start/e)+1),Qe?.(e)}}):null,"pages"===Ve?e(s,{size:ue,color:de,locale:yt,count:pn.pages,page:pn.page,siblingCount:0,getPageHref:Ue,onPageChange:Ir}):null]})]}):null,_r?null:t("span",{role:"status",className:L,children:[Dr,Tr?` ${Tr}`:null]}),Ht?e("span",{id:Kr,hidden:!0,children:xt.selectRow}):null]})}
1
+ "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as r from"react";import{useLayoutEffectOnClient as a}from"../../internal/layout-effect.js";import{Box as o}from"../box/Box.js";import{Button as l}from"../button/Button.js";import{Checkbox as i}from"../checkbox/Checkbox.js";import{Pagination as s}from"../pagination/Pagination.js";import{TextField as c}from"../text-field/TextField.js";import{RowsPerPage as u}from"./RowsPerPage.js";import{compareValues as d,dataHeaderHeights as p,dataRowHeights as g,dataTickWidths as f,defaultColumnWidth as m,isEmptyValue as h,keysBetween as b,minColumnWidth as y,nextSort as v,pageBounds as k,sortRows as w,virtualWindow as x}from"../../internal/data-table.js";import{beginPointerDrag as S,drawnScale as C}from"../../internal/drag.js";import{memoise as M}from"../../internal/cache.js";import{dateFormatter as R}from"../../internal/format.js";import{emptyMessages as N,fillMessage as _,tableMessages as D,useMessages as T}from"../../internal/i18n.js";import{searchHaystack as I,searchText as K}from"../../internal/search.js";import{ChevronIcon as A}from"../../internal/icons.js";import{observeResize as $}from"../../internal/observe.js";import{downloadText as z,toCsv as j}from"../../internal/csv.js";import{controlTextLeadingClasses as P,cx as E,hasContent as H,insetRingClasses as B,metaTextClasses as O,paddingXValues as F,srOnlyClasses as L,toLength as W,transitionClasses as V}from"../../internal/styles.js";import{useStyleDefaults as X}from"../../internal/defaults.js";import{whenIdle as q}from"../../internal/idle.js";import{useIntlLocale as G}from"../../internal/media.js";const U={"--n-stripe":"color-mix(in oklab, var(--neba-fg) 4%, transparent)"},Y="Alt+ArrowLeft Alt+ArrowRight";function J(e){const t=e.currentTarget;t.scrollWidth>t.clientWidth?t.title=t.textContent??"":t.removeAttribute("title")}const Q='button, a, input, select, textarea, label, [role="button"], [role="checkbox"], [role="switch"], [role="radio"]',Z={start:"shadow-[inset_2px_0_0_var(--n-accent)] rtl:shadow-[inset_-2px_0_0_var(--n-accent)]",end:"shadow-[inset_-2px_0_0_var(--n-accent)] rtl:shadow-[inset_2px_0_0_var(--n-accent)]"},ee='[data-neba-tick] [role="checkbox"], [data-neba-editor]';const te=new Map;function SearchIcon(){return t("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[e("circle",{cx:"7.25",cy:"7.25",r:"4.75",stroke:"currentColor",strokeWidth:"1.5"}),e("path",{d:"m10.75 10.75 2.75 2.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function ne(e,t,n){return{position:"sticky",insetInlineStart:"start"===e?`${t}px`:void 0,insetInlineEnd:"end"===e?`${t}px`:void 0,zIndex:n?21:1,backgroundColor:"var(--n-panel-press)",backgroundImage:n?void 0:"linear-gradient(var(--n-row), var(--n-row))"}}function re(e,t,n){if(!e.pinned)return{};const r="start"===e.pinned?t.start.get(e.key):t.end.get(e.key);return ne(e.pinned,r??0,n)}function ae(e,t){return e.value?e.value(t):t[e.key]}function oe(e,t,n){return n&&("function"==typeof e.editable?e.editable(t):Boolean(e.editable))}function le(t){return e("span",{className:"flex items-center justify-center",children:t})}function DataTableRow({entry:n,index:r,position:a,selected:o,active:l,editing:s,look:c,actions:u}){const{columns:d,reactId:p,cellStyle:g}=c,f=`${p}-first-${n.origin}`;return t("tr",{id:`${p}-${n.key}`,"aria-selected":c.selects?o:void 0,"aria-rowindex":c.virtualized?r+c.headRows+1:void 0,"data-neba-row":n.key,className:E("[--n-row:transparent] [transition:background-color_var(--neba-duration)_var(--neba-ease)]",o?"[--n-row:var(--n-soft-press)]":null!==c.stripe&&r%2===c.stripe?"[--n-row:var(--n-stripe)]":"",!o&&c.hoverable?"hover:[--n-row:var(--n-soft)]":"",l&&c.navigable?"[box-shadow:inset_0_0_0_1px_var(--n-ring)]":"",c.pressable?"cursor-default":""),style:{height:`${c.rowHeight}px`,backgroundColor:"var(--n-row)"},onPointerDown:e=>u.current?.pointerDown(n,e),onClick:e=>u.current?.click(n,a,e),onDoubleClick:e=>u.current?.doubleClick(n,a,e),children:[c.showTicks?e("td",{"data-neba-tick":"",role:c.selects?"gridcell":void 0,style:{...g,padding:0,overflow:"visible",...c.pinsStart?ne("start",0,!1):{}},children:le(e(i,{size:c.size,color:c.color,checked:o,tabIndex:-1,"aria-labelledby":d.length>0?`${c.tickNameId} ${f}`:void 0,"aria-label":d.length>0?void 0:c.selectRowLabel,onCheckedChange:()=>u.current?.tick(n.key)}))}):null,d.map((t,r)=>{const o=oe(t,n.row,c.edits),l=s===t.key,i=l?ae(t,n.row):void 0;return e("td",{id:c.showTicks&&0===r?f:void 0,role:c.navigable?"gridcell":void 0,style:{...g,...re(t,c.pinOffsets,!1),textAlign:t.align??"start",cursor:o&&!l?"cell":void 0},onPointerEnter:t.render||l?void 0:J,onDoubleClick:o?e=>{e.stopPropagation(),u.current?.openEditor(n.key,t.key)}:void 0,children:l?e("input",{autoFocus:!0,"data-neba-editor":"",type:"number"===t.editType?"number":"text",defaultValue:null==i?"":String(i),"aria-label":"string"==typeof t.label?t.label:t.key,className:"neba-input w-full bg-transparent [font:inherit] text-inherit [outline:none]",style:{textAlign:t.align??"start"},onPointerDown:e=>e.stopPropagation(),onBlur:e=>u.current?.editorBlur(n,t,e.currentTarget.value),onKeyDown:e=>u.current?.editorKeyDown(n,t,e)}):t.render?t.render(n.row,a):(d=n.row[t.key],p=c.dateLocale,"boolean"==typeof d?String(d):d instanceof Date?Number.isNaN(d.getTime())?"":R(p,{dateStyle:"medium"}).format(d):d)},t.key);var d,p}),c.filler?e("td",{"aria-hidden":"true",style:{...g,padding:0}}):null]})}const ie=/*@__PURE__*/r.memo(DataTableRow);function DataTableBody({paged:t,pageIndex:n,instead:o,virtualized:l,rowHeight:i,overscan:s,viewportHeight:c,scrollSinkRef:u,tableRef:d,columnCount:p,editingKey:g,activeKey:f,reactId:m,row:h}){const[b,y]=r.useState(0);a(()=>{const e=e=>{const t=Math.floor(e/i)*i;y(e=>e===t?e:t)};return u.current=e,()=>{u.current===e&&(u.current=null)}},[i,u]);const v=l?x(b,c,i,t.length,s):{start:0,end:t.length,before:0,after:0},k=null===f?-1:n.get(f)??-1,w=-1!==k&&(null!==o||k>=v.start&&k<v.end)?`${m}-${f}`:null;if(a(()=>{const e=d.current;e&&e.getAttribute("aria-activedescendant")!==w&&(null===w?e.removeAttribute("aria-activedescendant"):e.setAttribute("aria-activedescendant",w))}),null!==o)return o;const S=(t,n)=>n>0?e("tr",{"aria-hidden":"true",style:{height:`${n}px`},children:e("td",{colSpan:p,style:{padding:0,border:0}})},t):null,C=null===g?-1:n.get(g)??-1,M=-1!==C&&C<v.start,R=-1!==C&&C>=v.end;return[...M?[S("before",C*i),h(t[C],C),S("before-rest",v.before-(C+1)*i)]:[S("before",v.before)],...t.slice(v.start,v.end).map((e,t)=>h(e,v.start+t)),...R?[S("after-rest",(C-v.end)*i),h(t[C],C),S("after",v.after-(C-v.end+1)*i)]:[S("after",v.after)]]}export function DataTable(x){const{headers:R,items:J,getRowKey:se,variant:ce="outline",size:ue="sm",color:de="primary",density:pe="compact",elevation:ge=0,height:fe,maxHeight:me,rowHeight:he,striped:be=!1,hoverable:ye=!0,stickyHeader:ve=!0,caption:ke,label:we,empty:xe,virtual:Se=!0,overscan:Ce=8,sortable:Me=!1,sortMode:Re="single",sort:Ne,defaultSort:_e,onSortChange:De,resizable:Te=!1,columnWidths:Ie,columnOrder:Ke,defaultColumnOrder:Ae,onColumnOrderChange:$e,reorderable:ze=!1,defaultColumnWidths:je,onColumnWidthsChange:Pe,selectionMode:Ee="none",selected:He,defaultSelected:Be,onSelectedChange:Oe,checkboxes:Fe=!1,onRowClick:Le,onRowActivate:We,paging:Ve="scroll",page:Xe,defaultPage:qe=1,onPageChange:Ge,getPageHref:Ue,pageSize:Ye,defaultPageSize:Je=25,onPageSizeChange:Qe,pageSizeOptions:Ze=[10,25,50,100],footer:et,search:tt,defaultSearch:nt,onSearchChange:rt,searchable:at=!1,searchPlaceholder:ot,filter:lt,toolbar:it,exportable:st=!1,exportFileName:ct="table.csv",onExport:ut,exportEscapeFormulas:dt=!0,onCellEdit:pt,groupBy:gt,collapsibleGroups:ft=!0,defaultCollapsedGroups:mt,manual:ht=!1,rowCount:bt,locale:yt,className:vt,style:kt,...wt}=X(x,["size","density","variant","locale"]),xt=T(D,yt),St=T(N,yt),Ct=function(e){return M(te,e??"",()=>({collator:new Intl.Collator(e).resolvedOptions().locale,number:new Intl.NumberFormat(e).resolvedOptions().locale,date:new Intl.DateTimeFormat(e).resolvedOptions().locale}))}(G(yt)),Mt=r.useId(),Rt=he??g[pe][ue],Nt=p[pe][ue],_t=F[pe][ue],Dt=r.useMemo(()=>new Set(!0===ht?["sort","filter","pages"]:ht||[]),[ht]),[Tt,It]=r.useState(()=>Ae??[]),Kt=Ke??Tt,At=e=>{void 0===Ke&&It(e),$e?.(e)},$t=r.useMemo(()=>{const e=R.filter(e=>!e.hidden),t=Kt.map(t=>e.find(e=>e.key===t)).filter(e=>void 0!==e),n=e.filter(e=>!Kt.includes(e.key)),r=0===Kt.length?e:[...t,...n],a=e=>"start"===e.pinned?0:"end"===e.pinned?2:1;return r.map((e,t)=>({column:e,index:t})).sort((e,t)=>a(e.column)-a(t.column)||e.index-t.index).map(e=>e.column)},[R,Kt]),zt=$t.some(e=>void 0!==e.group),jt=zt?2:1,Pt="none"!==Ee,Et="multiple"===Ee,Ht=Pt&&Fe,Bt=void 0!==pt&&$t.some(e=>void 0!==e.editable),Ot=Pt||void 0!==We||Bt,Ft=r.useMemo(()=>J.map((e,t)=>{const n=se?se(e,t):t;return{row:e,identity:n,key:String(n),origin:t}}),[J,se]),[Lt,Wt]=r.useState(nt??""),Vt=r.useDeferredValue((tt??Lt).trim()),Xt=r.useMemo(()=>$t.filter(e=>!1!==e.searchable),[$t]),qt=r.useMemo(()=>{const e=[],t=t=>{const n=Math.min(Ft.length,e.length+t);for(let t=e.length;t<n;t+=1){const n=Ft[t].row;e.push(I(Xt.map(e=>e.value?e.value(n):n[e.key])))}return e.length<Ft.length};return{fold:t,all:()=>(t(1/0),e)}},[Ft,Xt]),Gt=Dt.has("filter");r.useEffect(()=>{if(!at||Gt||0===Xt.length)return;let e=()=>{};const t=n=>{const r=performance.now()+8;let a=qt.fold(200);for(;a&&performance.now()<r&&(void 0===n||n.timeRemaining()>1);)a=qt.fold(200);a&&(e=q(t,1e3))};return e=q(t,1e3),()=>e()},[at,Gt,Xt.length,qt]);const Ut=r.useMemo(()=>new Intl.Collator(Ct.collator,{numeric:!0,sensitivity:"base"}),[Ct.collator]),[Yt,Jt]=r.useState(_e??[]),Qt=Ne??Yt,Zt=r.useMemo(()=>Dt.has("sort")?Ft:w(Ft,Qt,e=>{const t=$t.find(t=>t.key===e);if(!t)return null;if(t.compare)return(e,n)=>t.compare(e.row,n.row);const n=t.value?t.value:e=>e[t.key];return{compare:(e,t)=>d(n(e.row),n(t.row),Ut),isEmpty:e=>h(n(e.row))}}),[Ft,Qt,$t,Ut,Dt]),en=r.useMemo(()=>{if(Gt)return Zt;const e=K(Vt);let t=Zt;if(""!==e&&Xt.length>0){const n=qt.all();t=Zt.filter(t=>n[t.origin].includes(e))}return lt?t.filter(e=>lt(e.row,e.origin)):t},[Zt,Vt,lt,Gt,Xt,qt]),[tn,nn]=r.useState(qe),[rn,an]=r.useState(Je),on=Ye??rn,[ln,sn]=r.useState(()=>new Set(mt??[])),cn=r.useMemo(()=>{if(!gt)return null;const e=[],t=new Map;for(const n of en){const r=gt(n.row)??"";t.has(r)||(t.set(r,[]),e.push(r)),t.get(r).push(n)}return{order:[...e].sort((e,t)=>""===e?-1:""===t?1:0),byLabel:t}},[en,gt]),un=r.useMemo(()=>cn?cn.order.flatMap(e=>ln.has(e)?[]:cn.byLabel.get(e)??[]):en,[cn,ln,en]),dn=Dt.has("pages")?bt??un.length:un.length,pn=k(dn,Xe??tn,on),gn=r.useMemo(()=>"pages"!==Ve||Dt.has("pages")?un:un.slice(pn.start,pn.end),[un,Ve,Dt,pn.start,pn.end]),fn="pages"===Ve?pn.start:0,mn=r.useMemo(()=>gn.map(e=>e.key),[gn]),hn=r.useMemo(()=>new Map(mn.map((e,t)=>[e,t])),[mn]),bn=r.useMemo(()=>new Map(Ft.map(e=>[e.key,e])),[Ft]),[yn,vn]=r.useState(Be??[]),kn=He??yn,wn=r.useMemo(()=>new Set(kn.map(String)),[kn]),[xn,Sn]=r.useState(null),Cn=r.useRef(null),Mn=r.useRef({paged:gn,pagedKeys:mn,pageIndex:hn,byKey:bn,selectedKeys:wn,selectedValues:kn,multiple:Et});Mn.current={paged:gn,pagedKeys:mn,pageIndex:hn,byKey:bn,selectedKeys:wn,selectedValues:kn,multiple:Et};const Rn=r.useCallback(e=>{const t=[],n=[],r=Dt.has("pages")?new Map(Mn.current.selectedValues.map(e=>[String(e),e])):null;for(const a of e){const e=Mn.current.byKey.get(a);e?(t.push(e.identity),n.push(e.row)):r?.has(a)&&t.push(r.get(a))}void 0===He&&vn(t),Oe?.(t,n)},[He,Oe,Dt]),Nn=r.useCallback(e=>{Cn.current=e,Rn([e])},[Rn]),_n=r.useCallback(e=>{const t=Mn.current.selectedKeys,n=new Set(t);n.has(e)?n.delete(e):n.add(e),Cn.current=e,Rn([...n])},[Rn]),Dn=r.useCallback((e,t)=>{const{pagedKeys:n,pageIndex:r}=Mn.current,a=Cn.current??n[0];if(void 0===a)return;const o=b(n,a,e,r);0!==o.length?Rn(t?[...new Set([...Mn.current.selectedKeys,...o])]:o):r.has(e)&&(Cn.current=e,Rn(t?[...new Set([...Mn.current.selectedKeys,e])]:[e]))},[Rn]),Tn=r.useRef(null),In=r.useRef(null),Kn=r.useRef(null),An=r.useRef(null),$n=void 0!==fe||void 0!==me,zn=void 0!==gt,jn=Se&&$n&&gn.length>0&&!gt,Pn=Se&&!jn&&gn.length>500?gn.length:0,En=r.useRef(!1);r.useEffect(()=>{"production"===process.env.NODE_ENV||0===Pn||En.current||(En.current=!0,console.warn(`Neba: a DataTable is drawing ${Pn} rows at once, because ${zn?"a grouped table is never virtual":"nothing bounds its height"}. ${zn?'Page it with paging="pages", or leave groupBy off and give it a height or a maxHeight':'Give it a height or a maxHeight to draw only the rows on screen, or page it with paging="pages"'}. Pass virtual={false} if every row is meant to be drawn.`))},[Pn,zn]);const[Hn,Bn]=r.useState(0);a(()=>{const e=Tn.current;if(e&&jn)return Bn(e.clientHeight),$(e,e=>Bn(e.contentRect.height))},[jn]);const On=r.useRef(null),Fn=r.useCallback(e=>{jn&&On.current?.(e.currentTarget.scrollTop)},[jn]),[Ln,Wn]=r.useState(je??{}),Vn=Ie??Ln,Xn=r.useCallback(e=>{void 0===Ie&&Wn(e),Pe?.(e)},[Ie,Pe]),qn=r.useRef(new Map),Gn=r.useRef(null),Un=r.useRef(null),[Yn,Jn]=r.useState(null),[Qn,Zn]=r.useState(null),er=r.useRef(null),tr=r.useRef(null);r.useEffect(()=>()=>{Gn.current?.(),Un.current?.()},[]);const nr=()=>{const e={...Vn};for(const t of $t){const n=qn.current.get(t.key);n&&void 0===e[t.key]&&(e[t.key]=n.offsetWidth)}return e},rr=e=>$t.find(t=>t.key===e)?.minWidth??y,ar=r.useRef(null);a(()=>{const e=ar.current;if(null===e)return;ar.current=null;const t=qn.current.get(e),n=t?.querySelector("button")??t;n&&n!==document.activeElement&&n.focus()});const or=r.useCallback((e,t)=>{const n=Tn.current,r=In.current;if(!n||!r)return;const a=function(e,t){for(let n=0;n<e.rows.length;n+=1)if(e.rows[n].dataset.nebaRow===t)return e.rows[n];return null}(r,e);if(!$n)return void a?.scrollIntoView({block:"nearest",inline:"nearest"});const o=n.getBoundingClientRect().top+n.clientTop-n.scrollTop,l=(a??r).getBoundingClientRect(),i=l.top-o+(a?0:t*Rt),s=i+(a?l.height:Rt),c=ve?Kn.current?.tHead?.getBoundingClientRect().height??0:0;i<n.scrollTop+c?n.scrollTop=Math.max(0,Math.floor(i-c)):s>n.scrollTop+n.clientHeight&&(n.scrollTop=Math.ceil(s-n.clientHeight))},[$n,ve,Rt]),lr=(e,t,n=!0)=>{const r=Mn.current.paged,a=Math.min(Math.max(e,0),r.length-1),o=r[a];o&&(t.preventDefault(),Sn(o.key),or(o.key,a),Pt&&(t.shiftKey&&Mn.current.multiple?Dn(o.key,!1):!n||t.ctrlKey||t.metaKey||Nn(o.key)))},ir=(e,t,n)=>{const r=Tn.current;if(!r||!$n)return;n.preventDefault();const a=Math.max(0,r.scrollHeight-r.clientHeight),o="start"===e?0:"end"===e?a:r.scrollTop+e;r.scrollTop=Math.min(Math.max(o,0),a),lr(t,n,!1)};const sr=r.useCallback(e=>{const t=In.current,n=Mn.current.paged;if(!t||0===n.length)return null;if(zn){const r=t.querySelectorAll("tr[data-neba-row]");let a=0,o=r.length-1,l=0;for(;a<=o;){const t=a+o>>1;r[t].getBoundingClientRect().top<=e?(l=t,a=t+1):o=t-1}return Math.min(l,n.length-1)}const r=t.getBoundingClientRect().top,a=Math.floor((e-r)/Rt);return Math.min(Math.max(a,0),n.length-1)},[Rt,zn]),cr=r.useRef(null),ur=r.useCallback(e=>{const t=sr(e),n=null===t?void 0:Mn.current.paged[t],r=cr.current;!n||r&&r.key===n.key||(r&&(r.key=n.key),Sn(n.key),Dn(n.key,!1))},[sr,Dn]),dr=r.useRef(ur);dr.current=ur;r.useEffect(()=>()=>cr.current?.stop(),[]);const pr=r.useMemo(()=>mn.reduce((e,t)=>wn.has(t)?e+1:e,0),[mn,wn]),gr=mn.length>0&&pr===mn.length,fr=f[ue],mr=e=>Vn[e.key]??e.width,hr=(Ht?fr:0)+$t.reduce((e,t)=>e+(mr(t)??y),0),br=$t.length>0&&$t.every(e=>void 0!==mr(e)),yr=$t.length+(Ht?1:0)+(br?1:0),vr=r.useMemo(()=>{const e=[];return $t.forEach((t,n)=>{const r=e[e.length-1];r&&void 0!==r.label&&r.label===t.group?r.span+=1:e.push({label:t.group,span:1,from:n})}),e},[$t]),kr=$t.filter(e=>e.pinned).map(e=>mr(e)??"").join(","),wr=r.useMemo(()=>{const e=new Map,t=new Map;let n=Ht?fr:0;for(const t of $t)"start"===t.pinned&&(e.set(t.key,n),n+=mr(t)??m);let r=0;for(let e=$t.length-1;e>=0;e-=1){const n=$t[e];"end"===n.pinned&&(t.set(n.key,r),r+=mr(n)??m)}return{start:e,end:t}},[$t,kr,Ht,fr]),xr=(e,t)=>re(e,wr,t),Sr=$t.some(e=>"start"===e.pinned),Cr=e=>Sr?ne("start",0,e):{},Mr=r.useMemo(()=>({padding:`0 ${_t}`,borderBottom:"1px solid var(--n-line)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),[_t]),Rr={...Mr,height:`${Nt}px`,backgroundColor:"var(--n-panel-press)",color:"var(--n-cell-ink, var(--neba-muted-fg))"},Nr=r.useMemo(()=>new Intl.NumberFormat(Ct.number),[Ct.number]),_r=et??"pages"===Ve,Dr=_(xt.range,{start:Nr.format(0===dn?0:("pages"===Ve?pn.start:0)+1),end:Nr.format("pages"===Ve?pn.end:dn),total:Nr.format(dn)}),Tr=Pt&&wn.size>0?_(xt.selected,{count:Nr.format(wn.size)}):"",Ir=e=>{void 0===Xe&&nn(e),Ge?.(e)},Kr=`${Mt}-tick`,Ar=Pt||void 0!==Le,$r=void 0!==pt,zr=r.useMemo(()=>({columns:$t,reactId:Mt,selects:Pt,navigable:Ot,showTicks:Ht,pressable:Ar,virtualized:jn,headRows:jt,stripe:!1===be?null:"odd"===be?0:1,hoverable:ye,rowHeight:Rt,cellStyle:Mr,pinOffsets:wr,pinsStart:Sr,filler:br,edits:$r,size:ue,color:de,dateLocale:Ct.date,tickNameId:Kr,selectRowLabel:xt.selectRow}),[$t,Mt,Pt,Ot,Ht,Ar,jn,jt,be,ye,Rt,Mr,wr,Sr,br,$r,ue,de,Ct.date,Kr,xt.selectRow]),jr=r.useRef(null),Pr=(t,n)=>e(ie,{entry:t,index:n,position:fn+n,selected:wn.has(t.key),active:xn===t.key,editing:Or?.key===t.key?Or.column:null,look:zr,actions:jr,redraw:x},t.key),Er=e=>{const t=$t.map(e=>e.key);return null!==Yn&&t.indexOf(Yn)<t.indexOf(e)?"end":"start"},Hr=(r,a,o)=>{const l=r.sortable??Me,i=r.resizable??Te,s=ze&&!r.pinned,c=(u=r.key,Qt.find(e=>e.key===u));var u;const d=c?Qt.findIndex(e=>e.key===r.key)+1:0,p=r.headerAlign??r.align??"start",g=i&&a<$t.length-1,f=g||d>1?`${Mt}-head-${a}`:void 0;return t("th",{"aria-labelledby":f,ref:e=>{e?qn.current.set(r.key,e):qn.current.delete(r.key)},scope:"col",rowSpan:o,"aria-sort":c&&1===d?"asc"===c.direction?"ascending":"descending":void 0,"data-column":r.key,"data-dragging":Yn===r.key||void 0,className:E("relative font-semibold select-none",ve?"sticky z-20 [backdrop-filter:var(--neba-blur)]":"",s?Yn===r.key?"cursor-grabbing":"cursor-grab":"",s&&!l?B:"",Qn===r.key?Z[Er(r.key)]:""),style:{...Rr,...xr(r,!0),backgroundImage:Yn===r.key?"linear-gradient(var(--n-soft), var(--n-soft))":void 0,top:ve?2!==o&&zt?Nt:0:void 0,textAlign:p,color:c?"var(--n-cell-ink, var(--n-accent))":Rr.color},tabIndex:s&&!l?0:void 0,"aria-keyshortcuts":s&&!l?Y:void 0,onPointerDown:s?e=>((e,t)=>{if(0!==t.button)return;const n=t.currentTarget,r=t.clientX;let a=!1;Un.current=S({target:n,pointerId:t.pointerId,capture:!1,onMove:t=>{if(!a){if(Math.abs(t.clientX-r)<6)return;a=!0,er.current=e,Jn(e)}const n=$t.find(e=>{if(e.pinned)return!1;const n=qn.current.get(e.key);if(!n)return!1;const r=n.getBoundingClientRect();return t.clientX>=r.left&&t.clientX<=r.right});tr.current=n&&n.key!==e?n.key:null,Zn(tr.current)},onEnd:()=>{const e=er.current,t=tr.current;if(Un.current=null,er.current=null,tr.current=null,Jn(null),Zn(null),e&&t&&e!==t){const n=$t.map(e=>e.key),r=n.indexOf(e),a=n.indexOf(t);n.splice(a,0,...n.splice(r,1)),At(n)}}})})(r.key,e):void 0,onKeyDown:s?e=>((e,t)=>{if(!t.altKey||"ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault();const n="rtl"===getComputedStyle(t.currentTarget).direction,r="ArrowRight"===t.key!==n?1:-1,a=$t.map(e=>e.key),o=a.indexOf(e),l=$t[o+r];l&&!l.pinned&&(a.splice(o+r,0,...a.splice(o,1)),ar.current=e,At(a))})(r.key,e):void 0,children:[l?t("button",{type:"button","aria-keyshortcuts":s?Y:void 0,className:E("group/sort flex w-full min-w-0 cursor-pointer items-center gap-1 text-inherit [outline:none] [transition:color_var(--neba-duration)_var(--neba-ease)] hover:text-(--n-accent) focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-1 [&_svg]:pointer-events-none [&_svg]:size-[1.15em] [&_svg]:shrink-0","end"===p?"justify-end":"center"===p?"justify-center":"justify-start"),onClick:e=>((e,t)=>{const n=v(Qt,e,t&&"multiple"===Re);void 0===Ne&&Jt(n),De?.(n)})(r.key,e.shiftKey),children:[e("span",{id:f,className:"min-w-0 truncate",children:r.label??r.key}),e("span",{"aria-hidden":"true",className:E("flex items-center","desc"===c?.direction?"rotate-0":"rotate-180",c?"":"text-transparent group-hover/sort:text-inherit group-focus-visible/sort:text-inherit"),children:e(A,{})}),d>1?t(n,{children:[e("span",{"aria-hidden":"true",className:"text-[0.85em] tabular-nums",children:d}),t("span",{className:L,children:[" ",_("desc"===c?.direction?xt.sortDescending:xt.sortAscending,{order:Nr.format(d)})]})]}):null]}):e("span",{id:f,className:"block truncate",children:r.label??r.key}),g?e("span",{role:"separator","aria-orientation":"vertical","aria-label":_(xt.resizeColumn,{column:"string"==typeof r.label?r.label:r.key}),"aria-valuenow":Vn[r.key]??r.width,"aria-valuemin":rr(r.key),tabIndex:0,className:"absolute inset-y-0 z-10 w-2 cursor-col-resize select-none end-0 translate-x-1/2 rtl:-translate-x-1/2 after:absolute after:inset-y-1 after:start-1/2 after:w-px after:[background:transparent] after:[transition:background_var(--neba-duration)_var(--neba-ease)] hover:after:[background:var(--n-accent)] data-[dragging]:after:[background:var(--n-accent)] focus-visible:after:[background:var(--n-accent)] [outline:0_solid_transparent] focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-[-2px]",onFocus:e=>{const t=qn.current.get(r.key);t&&!e.currentTarget.hasAttribute("aria-valuenow")&&e.currentTarget.setAttribute("aria-valuenow",String(t.offsetWidth))},onPointerDown:e=>((e,t)=>{t.preventDefault(),t.stopPropagation();const n=t.currentTarget,r=nr(),a=qn.current.get(e),o=a?C(a).x:1,l="rtl"===getComputedStyle(n).direction,i=t.clientX,s=r[e]??m,c=rr(e);Gn.current=S({target:n,pointerId:t.pointerId,onMove:t=>{const n=(t.clientX-i)/o*(l?-1:1);Xn({...r,[e]:Math.max(c,Math.round(s+n))})},onEnd:()=>{Gn.current=null}})})(r.key,e),onDoubleClick:()=>(e=>{const t={...Vn};delete t[e],Xn(t)})(r.key),onKeyDown:e=>((e,t)=>{if("ArrowLeft"!==t.key&&"ArrowRight"!==t.key)return;t.preventDefault(),t.stopPropagation();const n="rtl"===getComputedStyle(t.currentTarget).direction,r="ArrowRight"===t.key!==n,a=nr(),o=a[e]??m;Xn({...a,[e]:Math.max(rr(e),o+(r?16:-16))})})(r.key,e)}):null]},r.key)},Br=(n,r)=>{const a=ln.has(n),o=ft,l=r.map(e=>e.row),i=()=>sn(e=>{const t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}),s=t("span",{className:"flex min-w-0 items-center gap-1.5",children:[o?e("span",{"aria-hidden":"true",className:E("flex items-center text-(--neba-muted-fg)","[transition:rotate_var(--neba-duration)_var(--neba-ease)]",a?"-rotate-90 rtl:rotate-90":""),children:e(A,{})}):null,e("span",{className:"truncate font-semibold",children:""===n?xt.noGroup:n}),e("span",{className:"shrink-0 text-(--neba-muted-fg) tabular-nums",children:Nr.format(r.length)})]});return t("tr",{"data-neba-group":n,style:{height:`${Rt}px`,backgroundColor:"var(--n-soft)"},children:[Ht?e("td",{style:{...Mr,padding:0,...Cr(!1)}}):null,$t.map((t,n)=>e("td",{colSpan:1,style:{...Mr,...xr(t,!1),textAlign:0===n?"start":t.align??"start"},children:0===n?o?e("button",{type:"button","aria-expanded":!a,className:`flex w-full min-w-0 items-center text-start ${V} focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:[outline-offset:-2px]`,onClick:i,children:s}):s:t.aggregate?e("span",{className:"tabular-nums",children:t.aggregate(l)}):null},t.key)),br?e("td",{"aria-hidden":"true",style:{...Mr,padding:0}}):null]})},[Or,Fr]=r.useState(null),Lr=r.useRef(!1);function Wr(e,t){Lr.current=!1,Fr({key:e,column:t})}const Vr=(e,t)=>oe(e,t,void 0!==pt),Xr=(e,t,n)=>{Fr(null);const r=ae(t,e.row),a="number"===t.editType?Number(n):n;("number"!==t.editType||""!==n.trim()&&!Number.isNaN(a))&&String(a)!==String(r??"")&&pt?.(e.row,t,a)};jr.current={pointerDown:function(e,t){if(An.current=null,Pt){if(!t.target.closest(Q))if("touch"!==t.pointerType)if(Kn.current?.focus({preventScroll:!0}),Sn(e.key),2!==t.button){if(0===t.button)return t.shiftKey&&Et?(t.preventDefault(),void Dn(e.key,t.ctrlKey||t.metaKey)):void((t.ctrlKey||t.metaKey)&&Et?_n(e.key):(Nn(e.key),Et&&((e,t)=>{const n=Kn.current;if(cr.current||!n)return;const r=e.clientY,a=()=>{const e=cr.current,t=Tn.current;if(!e||!t||0===e.speed)return void(e&&(e.frame=null));const n=t.scrollTop;t.scrollTop=n+e.speed;const r=t.scrollTop!==n;dr.current(e.y),e.frame=r?requestAnimationFrame(a):null};let o=()=>{};const l=()=>{const e=cr.current;null!=e?.frame&&cancelAnimationFrame(e.frame),cr.current=null,o()};cr.current={y:r,speed:0,frame:null,stop:l,key:t},o=S({target:n,pointerId:e.pointerId,onMove:e=>{const t=cr.current,n=Tn.current;if(t){if(t.y=e.clientY,n&&$n){const e=n.getBoundingClientRect(),r=e.top+Rt-t.y,a=t.y-(e.bottom-Rt);t.speed=r>0?-Math.min(r,40):a>0?Math.min(a,40):0}null!==t.frame&&0!==t.speed||(dr.current(t.y),0!==t.speed&&null===t.frame&&(t.frame=requestAnimationFrame(a)))}},onEnd:l,capture:!1,mark:!1})})(t,e.key)))}else Mn.current.selectedKeys.has(e.key)||Nn(e.key);else An.current=e.key}else Ot&&!t.target.closest(Q)&&Sn(e.key)},click:(e,t,n)=>{n.target.closest(ee)||(An.current===e.key&&(An.current=null,Kn.current?.focus({preventScroll:!0}),Sn(e.key),Nn(e.key)),Le?.(e.row,t,n))},doubleClick:(e,t,n)=>{n.target.closest(ee)||We?.(e.row,t)},tick:e=>{Et?_n(e):Nn(e)},openEditor:Wr,editorBlur:(e,t,n)=>{Lr.current||Xr(e,t,n)},editorKeyDown:(e,t,n)=>{"Enter"!==n.key&&"Escape"!==n.key||(n.stopPropagation(),Lr.current=!0,"Enter"===n.key?(n.preventDefault(),Xr(e,t,n.currentTarget.value)):Fr(null),Kn.current?.focus({preventScroll:!0}))}};const qr=Et?le(e(i,{size:ue,color:de,checked:gr,indeterminate:pr>0&&!gr,"aria-label":xt.selectAll,onCheckedChange:()=>{if(gr){const e=new Set(mn);Rn([...wn].filter(t=>!e.has(t)))}else Rn([...new Set([...wn,...mn])])}})):null,Gr=br?e("th",{"aria-hidden":"true",className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0}}):null;return t(o,{variant:ce,size:ue,color:de,density:pe,elevation:ge,padded:!1,className:E("flex flex-col overflow-hidden",Ot?"has-[table:focus-visible,[data-neba-editor]:focus-visible]:[outline:2px_solid_var(--n-ring)] has-[table:focus-visible,[data-neba-editor]:focus-visible]:outline-offset-2":"",vt),style:{...U,...kt},...wt,children:[at||st||H(it)?t("div",{className:"flex items-center gap-2",style:{padding:`${_t} ${_t}`,borderBottom:"1px solid var(--n-line)"},children:[at?e(c,{size:ue,color:de,density:pe,variant:"outline",type:"search",className:"w-full max-w-64",startIcon:e(SearchIcon,{}),placeholder:ot??xt.search,"aria-label":ot??xt.search,value:tt??Lt,onChange:e=>{const t=e.target.value;void 0===tt&&Wt(t),Ir(1),rt?.(t)}}):null,st||H(it)?t("div",{className:"ms-auto flex items-center gap-2",children:[it,st?e(l,{size:ue,color:de,density:pe,variant:"outline",onClick:()=>{const e=$t.filter(e=>!1!==e.exportable),t=e.map(e=>"string"==typeof e.label?e.label:e.key),n=en.map(t=>e.map(e=>e.exportValue?e.exportValue(t.row):e.value?e.value(t.row):t.row[e.key])),r=j([t,...n],{escapeFormulas:dt});ut?ut(r):z(r,ct,"text/csv;charset=utf-8")},children:xt.exportCsv}):null]}):null]}):null,e("div",{ref:Tn,className:"min-h-0 flex-auto overflow-auto overscroll-contain",style:{height:W(fe),maxHeight:W(me)},onScroll:Fn,children:t("table",{ref:Kn,role:Ot?"grid":void 0,"aria-label":we,"aria-multiselectable":Et||void 0,"aria-rowcount":jn?gn.length+jt:void 0,tabIndex:Ot?0:void 0,className:E("w-full text-start [outline:none]",P[ue],"text-(--neba-fg)",Pt?"select-none":""),style:{tableLayout:"fixed",borderCollapse:"separate",borderSpacing:0,minWidth:`${hr}px`},onKeyDown:function(e){if(!Ot||e.target!==e.currentTarget)return;const t=Mn.current.paged;if(0===t.length)return;const n=null===xn?-1:Mn.current.pageIndex.get(xn)??-1,r=Tn.current,a=ve?Kn.current?.tHead?.getBoundingClientRect().height??0:0,o=r?r.clientHeight-a:0,l=Math.max(1,Math.floor((o>0?o:10*Rt)/Rt)-1);switch(e.key){case"ArrowDown":lr(n+1,e);break;case"ArrowUp":lr(-1===n?0:n-1,e);break;case"Home":ir("start",0,e);break;case"End":ir("end",t.length-1,e);break;case"PageDown":ir(l*Rt,Math.max(n,0)+l,e);break;case"PageUp":ir(-l*Rt,Math.max(n,0)-l,e);break;case" ":Pt&&-1!==n&&(e.preventDefault(),(e.ctrlKey||e.metaKey)&&Et?_n(t[n].key):Nn(t[n].key));break;case"a":case"A":Pt&&(e.ctrlKey||e.metaKey)&&Et&&(e.preventDefault(),Rn(Mn.current.pagedKeys));break;case"Escape":Pt&&(e.preventDefault(),Rn([]));break;case"Enter":-1!==n&&We&&(e.preventDefault(),We(t[n].row,fn+n));break;case"F2":{const r=t[n],a=r?$t.find(e=>Vr(e,r.row)):void 0;r&&a&&(e.preventDefault(),Wr(r.key,a.key));break}}},children:[ke?e("caption",{className:E(O[ue],"text-(--neba-muted-fg)"),style:{padding:`0.5rem ${_t}`,textAlign:"start"},children:ke}):null,t("colgroup",{children:[Ht?e("col",{style:{width:`${fr}px`}}):null,$t.map(t=>{const n=mr(t);return e("col",{style:void 0===n?void 0:{width:`${n}px`}},t.key)}),br?e("col",{}):null]}),t("thead",{children:[zt?t("tr",{"aria-rowindex":jn?1:void 0,style:{height:`${Nt}px`},children:[Ht?e("th",{scope:"col",rowSpan:2,className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0,overflow:"visible",...Cr(!0)},children:qr}):null,vr.map(t=>void 0===t.label?Hr($t[t.from],t.from,2):e("th",{scope:"colgroup",colSpan:t.span,className:E("font-semibold select-none",ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,textAlign:"center"},children:t.label},`group-${t.from}`)),br?r.cloneElement(Gr,{rowSpan:2}):null]}):null,t("tr",{"aria-rowindex":jn?jt:void 0,style:{height:`${Nt}px`},children:[Ht&&!zt?e("th",{scope:"col",className:E(ve?"sticky top-0 z-20 [backdrop-filter:var(--neba-blur)]":""),style:{...Rr,padding:0,overflow:"visible",...Cr(!0)},children:qr}):null,$t.map((e,t)=>zt&&void 0===e.group?null:Hr(e,t)),br&&!zt?Gr:null]})]}),e("tbody",{ref:In,children:e(DataTableBody,{paged:gn,pageIndex:hn,instead:0===gn.length?e("tr",{children:e("td",{colSpan:yr,style:{padding:`2rem ${_t}`,textAlign:"center",color:"var(--n-cell-ink, var(--neba-muted-fg))"},children:xe??St.title})}):cn?cn.order.map(e=>{const n=cn.byLabel.get(e)??[],a=n.filter(e=>hn.has(e.key));return 0!==a.length||ln.has(e)?t(r.Fragment,{children:[Br(e,n),a.map(e=>Pr(e,hn.get(e.key)??0))]},e||"\0"):null}):null,virtualized:jn,rowHeight:Rt,overscan:Ce,viewportHeight:Hn,scrollSinkRef:On,tableRef:Kn,columnCount:yr,editingKey:Or?.key??null,activeKey:Ot?xn:null,reactId:Mt,row:Pr})})]})}),_r?t("div",{className:E("flex flex-wrap items-center gap-3",O[ue]),style:{padding:`0.375rem ${_t}`,borderTop:"1px solid var(--n-line)"},children:[t("span",{role:"status",className:"flex flex-wrap items-center gap-3",children:[e("span",{className:"text-(--neba-muted-fg) tabular-nums",children:Dr}),Tr?e("span",{className:"text-(--n-accent) tabular-nums",children:Tr}):null]}),t("div",{className:"ms-auto flex items-center gap-2",children:["pages"===Ve&&Ze.length>0?e(u,{size:ue,color:de,density:pe,label:xt.rowsPerPage,options:Ze,value:on,onChange:e=>{void 0===Ye&&an(e),Ir(Math.floor(pn.start/e)+1),Qe?.(e)}}):null,"pages"===Ve?e(s,{size:ue,color:de,locale:yt,count:pn.pages,page:pn.page,siblingCount:0,getPageHref:Ue,onPageChange:Ir}):null]})]}):null,_r?null:t("span",{role:"status",className:L,children:[Dr,Tr?` ${Tr}`:null]}),Ht?e("span",{id:Kr,hidden:!0,children:xt.selectRow}):null]})}
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Dialog as n}from"@base-ui/react/dialog";import{boxPaddingXClasses as o,boxPaddingYClasses as a}from"../box/Box.js";import{actionMessages as s,useMessages as r}from"../../internal/i18n.js";import{CloseIcon as i}from"../../internal/icons.js";import{cx as t,hasContent as c,metaTextClasses as d,popupFadeClasses as m,radiusClasses as p,sheetBodyClasses as f,sheetCloseClasses as x,sheetHeaderGapClasses as u,sheetSectionGapClasses as b,sheetTitleClasses as h,surfaceClasses as g,surfaceSlots as v}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const y={xs:"max-w-80",sm:"max-w-96",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"},N=g+" relative flex w-full flex-col overflow-hidden border text-(--neba-fg) bg-(--n-panel-press) [border-color:var(--n-line)] [box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)] [outline:none] "+m,j="fixed inset-0 z-(--neba-z-portal) bg-(--neba-scrim) [backdrop-filter:blur(2px)] "+m,$="border-t [border-color:var(--n-line)]";export const DialogClose=n.Close;export function Dialog(m){const{size:g="md",color:k="primary",density:z="default",open:C,defaultOpen:D,onOpenChange:O,trigger:P,title:B,description:T,actions:W,dividers:L=!1,showClose:R=!0,locale:S,closeLabel:V,width:q,fullWidth:A=!0,fullScreen:E=!1,modal:F=!0,dismissible:G=!0,className:H,classNames:I,style:J,children:K,...M}=w(m,["size","density","locale"]),Q=r(s,S),U=o[z][g],X=a[z][g],Y=L?`${U} ${X}`:U,Z=c(B)||c(T),_=c(W);return l(n.Root,{open:C,defaultOpen:D,modal:F,disablePointerDismissal:!G,onOpenChange:(e,l)=>{G||e||"escape-key"!==l.reason?O?.(e):l.cancel()},children:[P?e(n.Trigger,{render:P}):null,l(n.Portal,{children:[e(n.Backdrop,{className:t("neba-portal",j,!0===F?"":"pointer-events-none",I?.backdrop)}),e(n.Viewport,{className:t("neba-portal fixed inset-0 z-(--neba-z-portal) flex justify-center",E?"items-stretch":"items-center p-4",!0===F?"":"pointer-events-none",I?.viewport),children:l(n.Popup,{className:t(N,!0===F?"":"pointer-events-auto",f[g],E?"h-full max-w-none rounded-none":`max-h-full ${p[g]} ${void 0===q?y[g]:""}`,E||A?"":"w-auto",L?"":`${X} ${b[g]}`,H??""),style:{...v(k,3),...void 0===q?null:{maxWidth:"number"==typeof q?`${q}px`:q},...J},...M,children:[Z||R?l("div",{className:`flex shrink-0 items-start gap-3 ${Y}`,children:[l("div",{className:`flex min-w-0 flex-1 flex-col ${u[g]}`,children:[c(B)?e(n.Title,{className:t("font-semibold",h[g],"m-0",I?.title),children:B}):null,c(T)?e(n.Description,{className:t("m-0 text-(--neba-muted-fg)",d[g],I?.description),children:T}):null]}),R?e(n.Close,{"aria-label":V??Q.close,className:t(x,I?.close),children:e(i,{})}):null]}):null,c(K)?e("div",{className:t("min-h-0 flex-1 overflow-y-auto overscroll-contain",Y,L&&(Z||R)?$:"",L?"":"py-1 -my-1",I?.body),children:K}):null,_?e("div",{className:t("flex shrink-0 flex-wrap items-center justify-end gap-2",Y,L?$:"",I?.actions),children:W}):null]})})]})]})}
1
+ "use client";import{jsx as e,jsxs as l}from"react/jsx-runtime";import{Dialog as n}from"@base-ui/react/dialog";import{boxPaddingXClasses as o,boxPaddingYClasses as a}from"../box/Box.js";import{actionMessages as s,useMessages as r}from"../../internal/i18n.js";import{CloseIcon as i}from"../../internal/icons.js";import{cx as t,hasContent as c,metaTextClasses as d,popupFadeClasses as m,radiusClasses as p,sheetBodyClasses as f,sheetCloseClasses as x,sheetHeaderGapClasses as u,sheetScrollRoomClasses as b,sheetSectionGapClasses as h,sheetTitleClasses as g,surfaceClasses as v,surfaceSlots as w}from"../../internal/styles.js";import{useStyleDefaults as y}from"../../internal/defaults.js";const N={xs:"max-w-80",sm:"max-w-96",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"},j=v+" relative flex w-full flex-col overflow-hidden border text-(--neba-fg) bg-(--n-panel-press) [border-color:var(--n-line)] [box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)] [outline:none] "+m,$="fixed inset-0 z-(--neba-z-portal) bg-(--neba-scrim) [backdrop-filter:blur(2px)] "+m,k="border-t [border-color:var(--n-line)]";export const DialogClose=n.Close;export function Dialog(m){const{size:v="md",color:z="primary",density:C="default",open:D,defaultOpen:O,onOpenChange:P,trigger:B,title:T,description:W,actions:L,dividers:R=!1,showClose:S=!0,locale:V,closeLabel:q,width:A,fullWidth:E=!0,fullScreen:F=!1,modal:G=!0,dismissible:H=!0,className:I,classNames:J,style:K,children:M,...Q}=y(m,["size","density","locale"]),U=r(s,V),X=o[C][v],Y=a[C][v],Z=R?`${X} ${Y}`:X,_=c(T)||c(W),ee=c(L);return l(n.Root,{open:D,defaultOpen:O,modal:G,disablePointerDismissal:!H,onOpenChange:(e,l)=>{H||e||"escape-key"!==l.reason?P?.(e):l.cancel()},children:[B?e(n.Trigger,{render:B}):null,l(n.Portal,{children:[e(n.Backdrop,{className:t("neba-portal",$,!0===G?"":"pointer-events-none",J?.backdrop)}),e(n.Viewport,{className:t("neba-portal fixed inset-0 z-(--neba-z-portal) flex justify-center",F?"items-stretch":"items-center p-4",!0===G?"":"pointer-events-none",J?.viewport),children:l(n.Popup,{className:t(j,!0===G?"":"pointer-events-auto",f[v],F?"h-full max-w-none rounded-none":`max-h-full ${p[v]} ${void 0===A?N[v]:""}`,F||E?"":"w-auto",R?"":`${Y} ${h[v]}`,I??""),style:{...w(z,3),...void 0===A?null:{maxWidth:"number"==typeof A?`${A}px`:A},...K},...Q,children:[_||S?l("div",{className:`flex shrink-0 items-start gap-3 ${Z}`,children:[l("div",{className:`flex min-w-0 flex-1 flex-col ${u[v]}`,children:[c(T)?e(n.Title,{className:t("font-semibold",g[v],"m-0",J?.title),children:T}):null,c(W)?e(n.Description,{className:t("m-0 text-(--neba-muted-fg)",d[v],J?.description),children:W}):null]}),S?e(n.Close,{"aria-label":q??U.close,className:t(x,J?.close),children:e(i,{})}):null]}):null,c(M)?e("div",{className:t("min-h-0 flex-1 overflow-y-auto overscroll-contain",Z,R&&(_||S)?k:"",R?"":b[v],J?.body),children:M}):null,ee?e("div",{className:t("flex shrink-0 flex-wrap items-center justify-end gap-2",Z,R?k:"",J?.actions),children:L}):null]})})]})]})}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Dialog as BaseUIDialog } from '@base-ui/react/dialog';
3
- import type { NebaSide, NebaStyleProps } from '../../types.js';
3
+ import type { NebaSide, NebaSlots, NebaStyleProps } from '../../types.js';
4
4
  /**
5
5
  * How the panel relates to the page.
6
6
  *
@@ -15,6 +15,14 @@ import type { NebaSide, NebaStyleProps } from '../../types.js';
15
15
  * across the whole library and would be a second spelling of nothing.
16
16
  */
17
17
  export type NebaDrawerMode = 'overlay' | 'inline';
18
+ /**
19
+ * The parts a Drawer draws around its panel. `className` is the panel.
20
+ *
21
+ * The same names as Dialog's, because they are the same parts. `backdrop` and
22
+ * `viewport` exist only in `overlay` mode, where both render at the end of
23
+ * `<body>`, outside the panel; an `inline` drawer draws neither.
24
+ */
25
+ export type DrawerSlot = 'backdrop' | 'viewport' | 'title' | 'description' | 'close' | 'body' | 'actions';
18
26
  /**
19
27
  * A drawer takes `size`, `color` and `density` and stops there.
20
28
  *
@@ -143,6 +151,11 @@ export interface DrawerProps extends Pick<NebaStyleProps, 'size' | 'color' | 'de
143
151
  * @default false
144
152
  */
145
153
  keepMounted?: boolean;
154
+ /**
155
+ * Class names for the parts around the panel. `className` is the panel, so
156
+ * the scrim behind it is `classNames.backdrop`.
157
+ */
158
+ classNames?: NebaSlots<DrawerSlot>;
146
159
  /** The body. */
147
160
  children?: React.ReactNode;
148
161
  }
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{Dialog as n}from"@base-ui/react/dialog";import{boxPaddingXClasses as l,boxPaddingYClasses as s}from"../box/Box.js";import{actionMessages as d,useMessages as o}from"../../internal/i18n.js";import{CloseIcon as i}from"../../internal/icons.js";import{cx as b,hasContent as m,headingTitleClasses as u,metaTextClasses as c,popupFadeClasses as f,sheetBodyClasses as p,sheetCloseClasses as h,sheetHeaderGapClasses as x,sheetSectionGapClasses as g,surfaceClasses as v,surfaceSlots as y}from"../../internal/styles.js";import{useStyleDefaults as w}from"../../internal/defaults.js";const N={xs:"w-56",sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[28rem]"},j={left:{xs:"rounded-r-(--neba-radius-xs)",sm:"rounded-r-(--neba-radius-sm)",md:"rounded-r-(--neba-radius-md)",lg:"rounded-r-(--neba-radius-lg)",xl:"rounded-r-(--neba-radius-xl)"},right:{xs:"rounded-l-(--neba-radius-xs)",sm:"rounded-l-(--neba-radius-sm)",md:"rounded-l-(--neba-radius-md)",lg:"rounded-l-(--neba-radius-lg)",xl:"rounded-l-(--neba-radius-xl)"},top:{xs:"rounded-b-(--neba-radius-xs)",sm:"rounded-b-(--neba-radius-sm)",md:"rounded-b-(--neba-radius-md)",lg:"rounded-b-(--neba-radius-lg)",xl:"rounded-b-(--neba-radius-xl)"},bottom:{xs:"rounded-t-(--neba-radius-xs)",sm:"rounded-t-(--neba-radius-sm)",md:"rounded-t-(--neba-radius-md)",lg:"rounded-t-(--neba-radius-lg)",xl:"rounded-t-(--neba-radius-xl)"}},$={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},_={left:"data-[starting-style]:[translate:-100%_0] data-[ending-style]:[translate:-100%_0]",right:"data-[starting-style]:[translate:100%_0] data-[ending-style]:[translate:100%_0]",top:"data-[starting-style]:[translate:0_-100%] data-[ending-style]:[translate:0_-100%]",bottom:"data-[starting-style]:[translate:0_100%] data-[ending-style]:[translate:0_100%]"},k={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},C=v+" relative flex flex-col overflow-hidden [&[hidden]]:hidden text-(--neba-fg) bg-(--n-panel-press) [border-color:var(--n-line)] [outline:none]",z="fixed inset-0 z-(--neba-z-portal) bg-(--neba-scrim) [backdrop-filter:blur(2px)] "+f,D="env(safe-area-inset-top) solid transparent",B="env(safe-area-inset-bottom) solid transparent",L="env(safe-area-inset-left) solid transparent",R="env(safe-area-inset-right) solid transparent",T={top:{borderTop:D,borderLeft:L,borderRight:R},bottom:{borderBottom:B,borderLeft:L,borderRight:R},left:{borderTop:D,borderBottom:B,borderLeft:L},right:{borderTop:D,borderBottom:B,borderRight:R}},O="border-t [border-color:var(--n-line)]";export const DrawerClose=n.Close;export const Drawer=/*@__PURE__*/t.forwardRef(function Drawer(f,v){const{side:D="left",mode:B="overlay",size:L="md",color:R="primary",density:P="default",open:E,defaultOpen:M,onOpenChange:A,trigger:F,title:S,headingLevel:V=2,description:q,actions:G,dividers:H=!1,showClose:I,locale:J,closeLabel:K,extent:Q,rounded:U=!0,modal:W=!0,dismissible:X=!0,safeArea:Y=!0,keepMounted:Z=!1,className:ee,style:re,children:ae,...te}=w(f,["size","density","locale"]),ne=o(d,J),le="overlay"===B,se="left"===D||"right"===D,de=I??le,[oe,ie]=t.useState(M??!0),be=l[P][L],me=s[P][L],ue=H?`${be} ${me}`:be,ce=m(S)||m(q),fe=m(G),pe=void 0===Q?null:{[se?"width":"height"]:"number"==typeof Q?`${Q}px`:Q},he=b(C,p[L],$[D],U?j[D][L]:"",le?"[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]":"[box-shadow:var(--neba-plate-glass)]",le?`[transition:translate_var(--neba-duration)_var(--neba-ease)] ${_[D]}`:"",se?`h-full max-w-full ${void 0===Q?N[L]:""}`:"w-full "+(void 0===Q?"max-h-[85%]":""),H?"":`${me} ${g[L]}`,ee??""),xe=`h${V}`,ge=le?n.Description:"p",ve=b("neba-heading","[&.neba-heading]:m-0 [&.neba-heading]:font-semibold [&.neba-heading]:text-inherit",u[L]),ye=r(a,{children:[ce||de?r("div",{className:`flex shrink-0 items-start gap-3 ${ue}`,children:[r("div",{className:`flex min-w-0 flex-1 flex-col ${x[L]}`,children:[m(S)?le?e(n.Title,{render:t.createElement(xe),className:ve,children:S}):t.createElement(xe,{className:ve},S):null,m(q)?e(ge,{className:`m-0 text-(--neba-muted-fg) ${c[L]}`,children:q}):null]}),de?le?e(n.Close,{"aria-label":K??ne.close,className:h,children:e(i,{})}):e("button",{type:"button","aria-label":K??ne.close,className:h,onClick:()=>{void 0===E&&ie(!1),A?.(!1)},children:e(i,{})}):null]}):null,m(ae)?e("div",{className:b("min-h-0 flex-1 overflow-y-auto overscroll-contain",ue,H&&(ce||de)?O:"",H?"":"py-1 -my-1"),children:ae}):null,fe?e("div",{className:b("flex shrink-0 flex-wrap items-center justify-end gap-2",ue,H?O:""),children:G}):null]});if(!le){const r=E??oe;return r||Z?e("div",{ref:v,hidden:!r||void 0,className:he,style:{...y(R,0),...pe,...re},...te,children:ye}):null}return r(n.Root,{open:E,defaultOpen:M,modal:W,disablePointerDismissal:!X,onOpenChange:(e,r)=>{X||e||"escape-key"!==r.reason?A?.(e):r.cancel()},children:[F?e(n.Trigger,{render:F}):null,r(n.Portal,{keepMounted:Z,children:[e(n.Backdrop,{className:b("neba-portal",z,!0===W?"":"pointer-events-none")}),e(n.Viewport,{className:b("neba-portal fixed inset-0 z-(--neba-z-portal) flex [&[hidden]]:hidden",k[D],!0===W?"":"pointer-events-none"),children:e(n.Popup,{ref:v,className:b(he,!0===W?"":"pointer-events-auto"),style:{...y(R,3),...pe,...Y?T[D]:null,...re},...te,children:ye})})]})]})});
1
+ "use client";import{jsx as e,jsxs as r,Fragment as a}from"react/jsx-runtime";import*as t from"react";import{Dialog as n}from"@base-ui/react/dialog";import{boxPaddingXClasses as l,boxPaddingYClasses as s}from"../box/Box.js";import{actionMessages as o,useMessages as d}from"../../internal/i18n.js";import{CloseIcon as i}from"../../internal/icons.js";import{COLOR as b,FONT_SIZE as m,FONT_WEIGHT as u,LINE_HEIGHT as c,MARGIN_BOTTOM as f,MARGIN_TOP as p,overriddenBy as h}from"../../internal/overrides.js";import{cx as x,hasContent as g,headingTitleClasses as v,headingTitleFloorClasses as w,metaTextClasses as y,popupFadeClasses as N,sheetBodyClasses as j,sheetCloseClasses as $,sheetHeaderGapClasses as _,sheetScrollRoomClasses as k,sheetSectionGapClasses as C,surfaceClasses as z,surfaceSlots as D}from"../../internal/styles.js";import{useStyleDefaults as B}from"../../internal/defaults.js";const L={xs:"w-56",sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[28rem]"},R={left:{xs:"rounded-r-(--neba-radius-xs)",sm:"rounded-r-(--neba-radius-sm)",md:"rounded-r-(--neba-radius-md)",lg:"rounded-r-(--neba-radius-lg)",xl:"rounded-r-(--neba-radius-xl)"},right:{xs:"rounded-l-(--neba-radius-xs)",sm:"rounded-l-(--neba-radius-sm)",md:"rounded-l-(--neba-radius-md)",lg:"rounded-l-(--neba-radius-lg)",xl:"rounded-l-(--neba-radius-xl)"},top:{xs:"rounded-b-(--neba-radius-xs)",sm:"rounded-b-(--neba-radius-sm)",md:"rounded-b-(--neba-radius-md)",lg:"rounded-b-(--neba-radius-lg)",xl:"rounded-b-(--neba-radius-xl)"},bottom:{xs:"rounded-t-(--neba-radius-xs)",sm:"rounded-t-(--neba-radius-sm)",md:"rounded-t-(--neba-radius-md)",lg:"rounded-t-(--neba-radius-lg)",xl:"rounded-t-(--neba-radius-xl)"}},T={left:"border-r",right:"border-l",top:"border-b",bottom:"border-t"},O={left:"data-[starting-style]:[translate:-100%_0] data-[ending-style]:[translate:-100%_0]",right:"data-[starting-style]:[translate:100%_0] data-[ending-style]:[translate:100%_0]",top:"data-[starting-style]:[translate:0_-100%] data-[ending-style]:[translate:0_-100%]",bottom:"data-[starting-style]:[translate:0_100%] data-[ending-style]:[translate:0_100%]"},M={left:"flex-row justify-start",right:"flex-row justify-end",top:"flex-col justify-start",bottom:"flex-col justify-end"},P=z+" relative flex flex-col overflow-hidden [&[hidden]]:hidden text-(--neba-fg) bg-(--n-panel-press) [border-color:var(--n-line)] [outline:none]",E="fixed inset-0 z-(--neba-z-portal) bg-(--neba-scrim) [backdrop-filter:blur(2px)] "+N,A="env(safe-area-inset-top) solid transparent",F="env(safe-area-inset-bottom) solid transparent",S="env(safe-area-inset-left) solid transparent",V="env(safe-area-inset-right) solid transparent",q={top:{borderTop:A,borderLeft:S,borderRight:V},bottom:{borderBottom:F,borderLeft:S,borderRight:V},left:{borderTop:A,borderBottom:F,borderLeft:S},right:{borderTop:A,borderBottom:F,borderRight:V}},G="border-t [border-color:var(--n-line)]";export const DrawerClose=n.Close;export const Drawer=/*@__PURE__*/t.forwardRef(function Drawer(N,z){const{side:A="left",mode:F="overlay",size:S="md",color:V="primary",density:H="default",open:I,defaultOpen:J,onOpenChange:K,trigger:Q,title:U,headingLevel:W=2,description:X,actions:Y,dividers:Z=!1,showClose:ee,locale:re,closeLabel:ae,extent:te,rounded:ne=!0,modal:le=!0,dismissible:se=!0,safeArea:oe=!0,keepMounted:de=!1,className:ie,classNames:be,style:me,children:ue,...ce}=B(N,["size","density","locale"]),fe=d(o,re),pe="overlay"===F,he="left"===A||"right"===A,xe=ee??pe,[ge,ve]=t.useState(J??!0),we=l[H][S],ye=s[H][S],Ne=Z?`${we} ${ye}`:we,je=g(U)||g(X),$e=g(Y),_e=void 0===te?null:{[he?"width":"height"]:"number"==typeof te?`${te}px`:te},ke=x(P,j[S],T[A],ne?R[A][S]:"",pe?"[box-shadow:var(--neba-shadow-3),var(--neba-plate-glass)]":"[box-shadow:var(--neba-plate-glass)]",pe?`[transition:translate_var(--neba-duration)_var(--neba-ease)] ${O[A]}`:"",he?`h-full max-w-full ${void 0===te?L[S]:""}`:"w-full "+(void 0===te?"max-h-[85%]":""),Z?"":`${ye} ${C[S]}`,ie??""),Ce=`h${W}`,ze=pe?n.Description:"p",De=t.useMemo(()=>h(be?.title),[be?.title]),Be=x("neba-heading",De&(p|f)?"[:where(&)]:m-0":"[&.neba-heading]:m-0",De&u?"[:where(&)]:font-semibold":"[&.neba-heading]:font-semibold",De&b?"[:where(&)]:text-inherit":"[&.neba-heading]:text-inherit",De&(m|c)?w[S]:v[S],be?.title),Le=r(a,{children:[je||xe?r("div",{className:`flex shrink-0 items-start gap-3 ${Ne}`,children:[r("div",{className:`flex min-w-0 flex-1 flex-col ${_[S]}`,children:[g(U)?pe?e(n.Title,{render:t.createElement(Ce),className:Be,children:U}):t.createElement(Ce,{className:Be},U):null,g(X)?e(ze,{className:x("m-0 text-(--neba-muted-fg)",y[S],be?.description),children:X}):null]}),xe?pe?e(n.Close,{"aria-label":ae??fe.close,className:x($,be?.close),children:e(i,{})}):e("button",{type:"button","aria-label":ae??fe.close,className:x($,be?.close),onClick:()=>{void 0===I&&ve(!1),K?.(!1)},children:e(i,{})}):null]}):null,g(ue)?e("div",{className:x("min-h-0 flex-1 overflow-y-auto overscroll-contain",Ne,Z&&(je||xe)?G:"",Z?"":k[S],be?.body),children:ue}):null,$e?e("div",{className:x("flex shrink-0 flex-wrap items-center justify-end gap-2",Ne,Z?G:"",be?.actions),children:Y}):null]});if(!pe){const r=I??ge;return r||de?e("div",{ref:z,hidden:!r||void 0,className:ke,style:{...D(V,0),..._e,...me},...ce,children:Le}):null}return r(n.Root,{open:I,defaultOpen:J,modal:le,disablePointerDismissal:!se,onOpenChange:(e,r)=>{se||e||"escape-key"!==r.reason?K?.(e):r.cancel()},children:[Q?e(n.Trigger,{render:Q}):null,r(n.Portal,{keepMounted:de,children:[e(n.Backdrop,{className:x("neba-portal",E,!0===le?"":"pointer-events-none",be?.backdrop)}),e(n.Viewport,{className:x("neba-portal fixed inset-0 z-(--neba-z-portal) flex [&[hidden]]:hidden",M[A],!0===le?"":"pointer-events-none",be?.viewport),children:e(n.Popup,{ref:z,className:x(ke,!0===le?"":"pointer-events-auto"),style:{...D(V,3),..._e,...oe?q[A]:null,...me},...ce,children:Le})})]})]})});
@@ -1,2 +1,2 @@
1
1
  export { Drawer, DrawerClose } from './Drawer.js';
2
- export type { DrawerCloseProps, DrawerProps, NebaDrawerMode } from './Drawer.js';
2
+ export type { DrawerCloseProps, DrawerProps, DrawerSlot, NebaDrawerMode } from './Drawer.js';
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{Button as l}from"../button/Button.js";import{boxPaddingClasses as r}from"../box/Box.js";import{CheckIcon as i,ChevronIcon as o,RestartIcon as s,SuccessIcon as c}from"../../internal/icons.js";import{fillMessage as m,stepsMessages as d,useMessages as p}from"../../internal/i18n.js";import{transitionProps as u}from"../../internal/animate.js";import{cx as f,hasContent as g,headingTitleClasses as h,iconClasses as x,insetRingClasses as b,metaTextClasses as v,radiusClasses as w,sheetBodyClasses as N,sheetSectionGapClasses as y,sheetTitleClasses as k,srOnlyClasses as S,surfaceClasses as j,surfaceSlots as C,toLength as z,transitionClasses as H}from"../../internal/styles.js";import{inertValue as L}from"../../internal/inert.js";import{useStyleDefaults as R}from"../../internal/defaults.js";const I={xs:{box:"1.25rem",text:"text-[0.625rem]"},sm:{box:"1.5rem",text:"text-[0.6875rem]"},md:{box:"1.75rem",text:"text-[0.75rem]"},lg:{box:"2rem",text:"text-[0.8125rem]"},xl:{box:"2.25rem",text:"text-[0.875rem]"}},M={default:{xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"},compact:{xs:"gap-0",sm:"gap-0",md:"gap-0.5",lg:"gap-0.5",xl:"gap-1"}},T={solid:j+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:j+" 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"};function B(e){return"string"==typeof e?e:""}function StepHeading({level:e,...t}){return a.createElement(`h${Math.min(6,Math.max(1,e))}`,t)}export const HowToSteps=/*@__PURE__*/a.forwardRef(function HowToSteps(j,E){const{steps:W,title:$,headingLevel:D=3,step:_,defaultStep:A=0,onStepChange:F,completed:q,defaultCompleted:G=!1,onCompletedChange:J,orientation:K="vertical",maxHeight:O,railWidth:P="15rem",navigation:Q=!0,divider:U=!0,transition:V="fade",completion:X=!0,completedContent:Y,variant:Z="outline",size:ee="md",color:te="primary",density:ne="default",elevation:ae=0,locale:le,previousLabel:re,nextLabel:ie,doneLabel:oe,restartLabel:se,className:ce,style:me,...de}=R(j,["size","density","variant","locale"]),pe=p(d,le),ue=a.useId(),fe=g($),[ge,he]=a.useState(A),[xe,be]=a.useState(G),ve=void 0!==_,we=void 0!==q,Ne=W.length,ye=Math.min(Math.max(ve?_:ge,0),Math.max(Ne-1,0)),ke=X&&(we?q:xe),[Se,je]=a.useState(!1),[Ce]=a.useState({active:ye,completed:ke});Se||ye===Ce.active&&ke===Ce.completed||je(!0);const ze=void 0!==O,He="vertical"===K,Le=a.useRef(null),Re=a.useRef(null);a.useEffect(()=>{const e=Le.current,t=Re.current;if(!e||!t)return;const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();He?a.top<n.top?e.scrollTop-=n.top-a.top:a.bottom>n.bottom&&(e.scrollTop+=a.bottom-n.bottom):a.left<n.left?e.scrollLeft-=n.left-a.left:a.right>n.right&&(e.scrollLeft+=a.right-n.right)},[ye,He]);const Ie=a.useRef(null),Me=a.useRef(null),Te=a.useRef(null);if(a.useEffect(()=>{null!==Te.current&&Te.current===ke&&(Te.current=null,(ke?Ie:Me).current?.focus())},[ke]),0===Ne)return null;const Be=(e,t=!1)=>{we||be(t),ke!==t&&J?.(t),t||(ve||he(e),e!==ye&&F?.(e))},Ee=0===ye,We=ye===Ne-1,$e=(e,t)=>{Te.current=e.currentTarget===document.activeElement?t:null},De="none"!==V&&Se?u(V):null,_e=t=>{const n=ke||t<ye,a=!ke&&t===ye;return e("span",{"aria-hidden":"true",className:f("z-1 flex shrink-0 items-center justify-center rounded-full border font-medium","size-(--n-step-mark) [&_svg]:size-[1.15em]",I[ee].text,H,n?"bg-(--n-fill) text-(--n-on-solid) [border-color:transparent]":a?"bg-(--neba-surface) text-(--n-accent) [border-color:var(--n-accent)]":"bg-(--neba-surface) text-(--neba-muted-fg) [border-color:var(--n-line)]"),children:n?e(i,{}):t+1})},Ae=e("ol",{ref:Le,role:"list","aria-label":pe.steps,className:f("m-0 flex list-none p-0",He?"flex-col":"flex-row",M[ne][ee],ze&&He?"min-h-0 overflow-y-auto overscroll-contain":"",He?"":"overflow-x-auto overscroll-contain"),children:W.map((n,a)=>{const l=ke||a<ye,r=!ke&&a===ye,i=B(n.title);return t("li",{ref:r?Re:void 0,className:f("relative",He?"":"min-w-0 flex-1"),children:[a<Ne-1?e("span",{"aria-hidden":"true",className:f("absolute",H,l?"bg-(--n-fill)":"bg-(--n-line)",He?"w-px [inset-inline-start:calc(0.25rem+var(--n-step-mark)/2)] [top:calc(0.25rem+var(--n-step-mark))] [height:calc(100%-var(--n-step-mark))]":"h-px [inset-inline-start:calc(50%+var(--n-step-mark)/2)] [top:calc(0.25rem+var(--n-step-mark)/2)] [width:calc(100%-var(--n-step-mark))]")}):null,t("button",{type:"button",onClick:()=>Be(a),"aria-current":r?"step":void 0,"aria-label":i?m(pe.step,{index:String(a+1),title:i}):void 0,className:f("flex w-full cursor-pointer items-center p-1 text-start",He?"gap-3":"flex-col gap-1.5 text-center",w.sm,"hover:bg-(--n-soft)",H,b),children:[_e(a),e("span",{className:f("min-w-0",He?"truncate":"",v[ee],r?"font-medium text-(--neba-fg)":"text-(--neba-muted-fg)"),children:n.title})]})]},a)})}),Fe=t("div",{className:f("grid flex-1 grid-cols-1",ze?"min-h-0":""),children:[W.map((n,a)=>{const l=ke||a!==ye;return t("div",{"aria-hidden":l,inert:L(l),className:f("col-start-1 row-start-1 min-w-0",ze?"overflow-y-auto overscroll-contain":"",l?"invisible":De?.className??""),style:l?void 0:De?.style,children:[t("div",{className:"mb-3 flex items-baseline gap-3",children:[g(n.icon)?e("span",{"aria-hidden":"true",className:f("flex h-[1lh] shrink-0 items-center text-(--n-accent)",k[ee],x),children:n.icon}):null,e(StepHeading,{level:fe?D+1:D,className:f("neba-heading min-w-0 flex-1","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",h[ee]),children:n.title}),e("span",{className:f("shrink-0 text-(--neba-muted-fg) tabular-nums",v[ee]),children:m(pe.position,{index:String(a+1),total:String(Ne)})})]}),n.image?e("img",{alt:n.imageAlt??B(n.title),width:n.imageWidth,height:n.imageHeight,className:f("mb-3 h-auto max-h-72 w-full object-contain",w[ee]),loading:n.imageLoading??"lazy",decoding:"async",src:n.image}):null,g(n.content)?e("div",{className:f("min-w-0",N[ee]),children:n.content}):null]},a)}),X?t("div",{"aria-hidden":!ke,inert:L(!ke),className:f("col-start-1 row-start-1 flex min-w-0 flex-col items-center justify-center gap-2 py-4 text-center",ke?De?.className??"":"invisible"),style:ke?De?.style:void 0,children:[e("span",{"aria-hidden":"true",className:"text-(--n-accent) [&_svg]:size-9",children:e(c,{})}),e("p",{className:f("m-0 font-medium",N[ee]),children:Y??pe.completed})]}):null]});return t("div",{ref:E,role:fe?"group":void 0,"aria-labelledby":fe?ue:void 0,className:f("flex min-w-0 flex-col",w[ee],r[ne][ee],y[ee],T[Z],H,ce),style:{...C(te,ae),"--n-fill":`var(--neba-${te}-fill)`,"--n-on-solid":`var(--neba-${te}-on-solid)`,"--n-step-mark":I[ee].box,"--n-step-rail":z(P),...ze?{maxHeight:z(O)}:null,...me},...de,children:[fe?e(StepHeading,{level:D,id:ue,className:f("neba-heading shrink-0","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",h[ee]),children:$}):null,e("span",{className:S,"aria-live":"polite",children:ke?"":"string"==typeof W[ye]?.title?m(pe.step,{index:String(ye+1),title:W[ye].title}):m(pe.position,{index:String(ye+1),total:String(Ne)})}),t("div",{className:f("flex min-w-0 flex-1 flex-col",ze?"min-h-0":"",He?"gap-4 sm:flex-row sm:gap-5":"gap-4"),children:[e("div",{className:f("flex min-w-0 flex-col",ze?"min-h-0":"",He?"sm:w-(--n-step-rail) sm:shrink-0":"",U?He?"border-b pb-4 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-5":"border-b pb-4":"",U?"[border-color:var(--n-line)]":""),children:Ae}),t("div",{className:f("flex min-w-0 flex-1 flex-col",ze?"min-h-0":"",y[ee]),children:[Fe,Q?e("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:ke?e(l,{ref:Ie,size:ee,variant:"outline",color:te,startIcon:e(s,{}),onClick:e=>{$e(e,!1),Be(0)},children:se??pe.restart}):t(n,{children:[e(l,{size:ee,variant:"outline",color:te,disabled:Ee,focusableWhenDisabled:!0,startIcon:e("span",{className:"rotate-90 rtl:-rotate-90",children:e(o,{})}),onClick:()=>Be(ye-1),children:re??pe.previous}),e(l,We&&X?{ref:Me,size:ee,variant:"solid",color:te,startIcon:e(i,{}),onClick:e=>{$e(e,!0),Be(ye,!0)},children:oe??pe.done}:{ref:Me,size:ee,variant:"solid",color:te,disabled:We,focusableWhenDisabled:!0,endIcon:e("span",{className:"-rotate-90 rtl:rotate-90",children:e(o,{})}),onClick:()=>Be(ye+1),children:ie??pe.next})]})}):null]})]})]})});
1
+ "use client";import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import*as a from"react";import{Button as l}from"../button/Button.js";import{boxPaddingClasses as r}from"../box/Box.js";import{CheckIcon as i,ChevronIcon as o,RestartIcon as s,SuccessIcon as c}from"../../internal/icons.js";import{fillMessage as m,stepsMessages as d,useMessages as p}from"../../internal/i18n.js";import{transitionProps as u}from"../../internal/animate.js";import{cx as f,hasContent as g,headingTitleClasses as h,iconClasses as x,insetRingClasses as b,metaTextClasses as v,radiusClasses as w,sheetBodyClasses as N,sheetSectionGapClasses as y,sheetTitleClasses as k,srOnlyClasses as S,surfaceClasses as j,surfaceSlots as C,toLength as z,transitionClasses as H}from"../../internal/styles.js";import{inertValue as L}from"../../internal/inert.js";import{useStyleDefaults as R}from"../../internal/defaults.js";const I={xs:{box:"1.25rem",text:"text-[0.625rem]"},sm:{box:"1.5rem",text:"text-[0.6875rem]"},md:{box:"1.75rem",text:"text-[0.75rem]"},lg:{box:"2rem",text:"text-[0.8125rem]"},xl:{box:"2.25rem",text:"text-[0.875rem]"}},M={default:{xs:"gap-0.5",sm:"gap-1",md:"gap-1",lg:"gap-1.5",xl:"gap-2"},compact:{xs:"gap-0",sm:"gap-0",md:"gap-0.5",lg:"gap-0.5",xl:"gap-1"}},T={solid:j+" text-(--neba-fg) bg-(--n-panel-hover) [box-shadow:var(--n-elev),var(--neba-plate-solid)]",outline:j+" 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"};function B(e){return"string"==typeof e?e:""}function StepHeading({level:e,...t}){return a.createElement(`h${Math.min(6,Math.max(1,e))}`,t)}export const HowToSteps=/*@__PURE__*/a.forwardRef(function HowToSteps(j,E){const{steps:W,title:$,headingLevel:D=3,step:_,defaultStep:A=0,onStepChange:F,completed:q,defaultCompleted:G=!1,onCompletedChange:J,orientation:K="vertical",maxHeight:O,railWidth:P="15rem",navigation:Q=!0,divider:U=!0,transition:V="fade",completion:X=!0,completedContent:Y,variant:Z="outline",size:ee="md",color:te="primary",density:ne="default",elevation:ae=0,locale:le,previousLabel:re,nextLabel:ie,doneLabel:oe,restartLabel:se,className:ce,style:me,...de}=R(j,["size","density","variant","locale"]),pe=p(d,le),ue=a.useId(),fe=g($),[ge,he]=a.useState(A),[xe,be]=a.useState(G),ve=void 0!==_,we=void 0!==q,Ne=W.length,ye=Math.min(Math.max(ve?_:ge,0),Math.max(Ne-1,0)),ke=X&&(we?q:xe),[Se,je]=a.useState(!1),[Ce]=a.useState({active:ye,completed:ke});Se||ye===Ce.active&&ke===Ce.completed||je(!0);const ze=void 0!==O,He="vertical"===K,Le=a.useRef(null),Re=a.useRef(null);a.useEffect(()=>{const e=Le.current,t=Re.current;if(!e||!t)return;const n=e.getBoundingClientRect(),a=t.getBoundingClientRect();He?a.top<n.top?e.scrollTop-=n.top-a.top:a.bottom>n.bottom&&(e.scrollTop+=a.bottom-n.bottom):a.left<n.left?e.scrollLeft-=n.left-a.left:a.right>n.right&&(e.scrollLeft+=a.right-n.right)},[ye,He]);const Ie=a.useRef(null),Me=a.useRef(null),Te=a.useRef(null);if(a.useEffect(()=>{null!==Te.current&&Te.current===ke&&(Te.current=null,(ke?Ie:Me).current?.focus())},[ke]),0===Ne)return null;const Be=(e,t=!1)=>{we||be(t),ke!==t&&J?.(t),t||(ve||he(e),e!==ye&&F?.(e))},Ee=0===ye,We=ye===Ne-1,$e=(e,t)=>{Te.current=e.currentTarget===document.activeElement?t:null},De="none"!==V&&Se?u(V):null,_e=t=>{const n=ke||t<ye,a=!ke&&t===ye;return e("span",{"aria-hidden":"true",className:f("z-1 flex shrink-0 items-center justify-center rounded-full border font-medium","size-(--n-step-mark) [&_svg]:size-[1.15em]",I[ee].text,H,n?"bg-(--n-fill) text-(--n-on-solid) [border-color:transparent]":a?"bg-(--neba-surface) text-(--n-accent) [border-color:var(--n-accent)]":"bg-(--neba-surface) text-(--neba-muted-fg) [border-color:var(--n-line)]"),children:n?e(i,{}):t+1})},Ae=e("ol",{ref:Le,role:"list","aria-label":pe.steps,className:f("m-0 flex list-none p-0",He?"flex-col":"flex-row",M[ne][ee],ze&&He?"min-h-0 overflow-y-auto overscroll-contain":"",He?"":"overflow-x-auto overscroll-contain"),children:W.map((n,a)=>{const l=ke||a<ye,r=!ke&&a===ye,i=B(n.title);return t("li",{ref:r?Re:void 0,className:f("relative",He?"":"min-w-0 flex-1"),children:[a<Ne-1?e("span",{"aria-hidden":"true",className:f("absolute",H,l?"bg-(--n-fill)":"bg-(--n-line)",He?"w-px [inset-inline-start:calc(0.25rem+var(--n-step-mark)/2)] [top:calc(0.25rem+var(--n-step-mark))] [height:calc(100%-var(--n-step-mark))]":"h-px [inset-inline-start:calc(50%+var(--n-step-mark)/2)] [top:calc(0.25rem+var(--n-step-mark)/2)] [width:calc(100%-var(--n-step-mark))]")}):null,t("button",{type:"button",onClick:()=>Be(a),"aria-current":r?"step":void 0,"aria-label":i?m(pe.step,{index:String(a+1),title:i}):void 0,className:f("flex w-full cursor-pointer items-center p-1 text-start",He?"gap-3":"flex-col gap-1.5 text-center",w.sm,"hover:bg-(--n-soft)",H,b),children:[_e(a),e("span",{className:f("min-w-0",He?"truncate":"",v[ee],r?"font-medium text-(--neba-fg)":"text-(--neba-muted-fg)"),children:n.title})]})]},a)})}),Fe=t("div",{className:f("grid flex-1 grid-cols-1",ze?"min-h-0":""),children:[W.map((n,a)=>{const l=ke||a!==ye;return t("div",{"aria-hidden":l,inert:L(l),className:f("col-start-1 row-start-1 min-w-0",ze?"overflow-y-auto overscroll-contain px-1 -mx-1 pb-1 -mb-1":"",l?"invisible":De?.className??""),style:l?void 0:De?.style,children:[t("div",{className:"mb-3 flex items-baseline gap-3",children:[g(n.icon)?e("span",{"aria-hidden":"true",className:f("flex h-[1lh] shrink-0 items-center text-(--n-accent)",k[ee],x),children:n.icon}):null,e(StepHeading,{level:fe?D+1:D,className:f("neba-heading min-w-0 flex-1","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",h[ee]),children:n.title}),e("span",{className:f("shrink-0 text-(--neba-muted-fg) tabular-nums",v[ee]),children:m(pe.position,{index:String(a+1),total:String(Ne)})})]}),n.image?e("img",{alt:n.imageAlt??B(n.title),width:n.imageWidth,height:n.imageHeight,className:f("mb-3 h-auto max-h-72 w-full object-contain",w[ee]),loading:n.imageLoading??"lazy",decoding:"async",src:n.image}):null,g(n.content)?e("div",{className:f("min-w-0",N[ee]),children:n.content}):null]},a)}),X?t("div",{"aria-hidden":!ke,inert:L(!ke),className:f("col-start-1 row-start-1 flex min-w-0 flex-col items-center justify-center gap-2 py-4 text-center",ke?De?.className??"":"invisible"),style:ke?De?.style:void 0,children:[e("span",{"aria-hidden":"true",className:"text-(--n-accent) [&_svg]:size-9",children:e(c,{})}),e("p",{className:f("m-0 font-medium",N[ee]),children:Y??pe.completed})]}):null]});return t("div",{ref:E,role:fe?"group":void 0,"aria-labelledby":fe?ue:void 0,className:f("flex min-w-0 flex-col",w[ee],r[ne][ee],y[ee],T[Z],H,ce),style:{...C(te,ae),"--n-fill":`var(--neba-${te}-fill)`,"--n-on-solid":`var(--neba-${te}-on-solid)`,"--n-step-mark":I[ee].box,"--n-step-rail":z(P),...ze?{maxHeight:z(O)}:null,...me},...de,children:[fe?e(StepHeading,{level:D,id:ue,className:f("neba-heading shrink-0","[&.neba-heading]:m-0 [&.neba-heading]:font-medium [&.neba-heading]:text-inherit",h[ee]),children:$}):null,e("span",{className:S,"aria-live":"polite",children:ke?"":"string"==typeof W[ye]?.title?m(pe.step,{index:String(ye+1),title:W[ye].title}):m(pe.position,{index:String(ye+1),total:String(Ne)})}),t("div",{className:f("flex min-w-0 flex-1 flex-col",ze?"min-h-0":"",He?"gap-4 sm:flex-row sm:gap-5":"gap-4"),children:[e("div",{className:f("flex min-w-0 flex-col",ze?"min-h-0":"",He?"sm:w-(--n-step-rail) sm:shrink-0":"",U?He?"border-b pb-4 sm:border-b-0 sm:border-e sm:pb-0 sm:pe-5":"border-b pb-4":"",U?"[border-color:var(--n-line)]":""),children:Ae}),t("div",{className:f("flex min-w-0 flex-1 flex-col",ze?"min-h-0":"",y[ee]),children:[Fe,Q?e("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2",children:ke?e(l,{ref:Ie,size:ee,variant:"outline",color:te,startIcon:e(s,{}),onClick:e=>{$e(e,!1),Be(0)},children:se??pe.restart}):t(n,{children:[e(l,{size:ee,variant:"outline",color:te,disabled:Ee,focusableWhenDisabled:!0,startIcon:e("span",{className:"rotate-90 rtl:-rotate-90",children:e(o,{})}),onClick:()=>Be(ye-1),children:re??pe.previous}),e(l,We&&X?{ref:Me,size:ee,variant:"solid",color:te,startIcon:e(i,{}),onClick:e=>{$e(e,!0),Be(ye,!0)},children:oe??pe.done}:{ref:Me,size:ee,variant:"solid",color:te,disabled:We,focusableWhenDisabled:!0,endIcon:e("span",{className:"-rotate-90 rtl:rotate-90",children:e(o,{})}),onClick:()=>Be(ye+1),children:ie??pe.next})]})}):null]})]})]})});
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{useMergedRef as r}from"../../internal/refs.js";import{beginPointerDrag as o,drawnScale as i}from"../../internal/drag.js";import{useLayoutEffectOnClient as a}from"../../internal/layout-effect.js";import{observeResize as l}from"../../internal/observe.js";import{cx as s,lengthUnit as c,toPixels as u,transitionClasses as f}from"../../internal/styles.js";import{useStyleDefaults as m}from"../../internal/defaults.js";import{panesMessages as d,useMessages as p}from"../../internal/i18n.js";const h="1 1 0%",g=/*@__PURE__*/t.createContext({flex:h}),x={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},v={xs:4,sm:6,md:8,lg:10,xl:12};function b(e,n,t){if(null!=e)return"number"==typeof e?n*e/100:u(e,{percentOf:n,relativeTo:t})}function z(e,n,t){const r=e.map(e=>b(e.defaultSize,n,t)),o=r.reduce((e,n)=>e+(n??0),0),i=r.filter(e=>void 0===e).length,a=i>0?Math.max(0,n-o)/i:0,l=r.map(e=>Math.max(0,e??a)),s=l.reduce((e,n)=>e+n,0);return s<=0?l.map(()=>1/Math.max(1,l.length)):l.map(e=>e/s)}function y(e,n){return`calc((100% - ${n}px) * ${e.toFixed(6)})`}function w(e){if("string"!=typeof e)return!1;const n=c(e);return void 0!==n&&"%"!==n}function S(e,n){if(w(e))return`0 1 ${e}`;const t="number"==typeof e?e/100:"string"==typeof e?u(e,{percentOf:1}):void 0;return void 0===t?h:`0 1 ${y(Math.max(0,t),n)}`}export const Panes=/*@__PURE__*/t.forwardRef(function Panes(c,u){const{orientation:h="horizontal",resizable:$=!0,color:j="primary",size:M="md",onResize:R,onResizeEnd:A,handleLabel:E,locale:N,className:P,style:k,children:C,...D}=m(c,["size","locale"]),I=t.Children.toArray(C).filter(t.isValidElement),L=I.length,T=p(d,N),F=t.useId(),H=e=>I[e]?.props.id??`${F}-pane-${e}`,O=t.useRef(null),W=r(O,u),X=I.map(e=>e.props),Y=t.useRef([]);Y.current=X;const _="horizontal"===h,K=v[M]*Math.max(0,L-1),[U,V]=t.useState(null),q=(U&&U.length===L?U:null)??(X.some(e=>w(e.defaultSize))?null:z(X,100,null)),B=t.useRef(null);function G(e){const n=O.current,t=B.current;if(!$||!n||!t||void 0===t[e+1])return null;const r=(_?n.offsetWidth:n.offsetHeight)-K;if(r<=0)return null;const o=Y.current[e],i=Y.current[e+1],a=t[e]*r,l=a+t[e+1]*r,s=Math.max(b(o?.minSize,r,n)??0,l-(b(i?.maxSize,r,n)??l)),c=Math.min(b(o?.maxSize,r,n)??l,l-(b(i?.minSize,r,n)??0));return c<s?null:{root:n,current:t,extent:r,start:a,pair:l,resize(n){const o=Math.min(c,Math.max(s,a+n)),i=[...t];return i[e]=o/r,i[e+1]=(l-o)/r,V(i),R?.(i.map(e=>100*e)),i}}}t.useEffect(()=>{B.current=q}),a(()=>{const e=O.current;if(!e)return;const n=()=>{const n=(_?e.offsetWidth:e.offsetHeight)-K;n<=0||V(t=>t&&t.length===L?t:z(Y.current,n,e))};return n(),l(e,n)},[L,_,K]);const J=t.useRef(null);t.useEffect(()=>()=>J.current?.(),[]);const Q=s("group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",x[M],f,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-0",$?s(_?"cursor-col-resize":"cursor-row-resize","neba-hit","touch-none","hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)"):"");return e("div",{ref:W,className:s("flex h-full w-full",_?"flex-row":"flex-col","min-h-0 min-w-0",P),style:{"--n-accent":`var(--neba-${j}-accent)`,"--n-soft":`var(--neba-${j}-soft)`,"--n-ring":`var(--neba-${j}-ring)`,...k},...D,children:I.map((r,a)=>n(t.Fragment,{children:[a>0?e("div",{role:"separator","aria-label":"function"==typeof E?E(a-1):E??T.handle,"aria-controls":`${H(a-1)} ${H(a)}`,"aria-orientation":_?"vertical":"horizontal","aria-valuenow":q?Math.round(100*q[a-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!$||void 0,tabIndex:$?0:-1,className:Q,onPointerDown:e=>{0===e.button&&function(e,n){const t=G(e);if(!t)return;const r=n.currentTarget,a=_?n.clientX:n.clientY,l=_&&"rtl"===getComputedStyle(t.root).direction?-1:1,s=i(t.root)[_?"x":"y"];let c=t.current;J.current=o({target:r,pointerId:n.pointerId,onMove:e=>{const n=_?e.clientX:e.clientY;c=t.resize((n-a)/s*l)},onEnd:()=>{J.current=null,A?.(c.map(e=>100*e))}})}(a-1,e)},onKeyDown:e=>{const n=_&&"rtl"===getComputedStyle(e.currentTarget).direction,t=_?n?"ArrowRight":"ArrowLeft":"ArrowUp",r=_?n?"ArrowLeft":"ArrowRight":"ArrowDown";e.key!==t&&e.key!==r||(e.preventDefault(),function(e,n){const t=G(e);if(!t)return;const r=t.resize(n);A?.(r.map(e=>100*e))}(a-1,e.key===r?16:-16))},children:e("span",{"aria-hidden":"true",className:s("pointer-events-none bg-(--neba-border)",f,_?"h-full w-px":"h-px w-full",$?"group-hover/handle:bg-(--n-accent) group-focus-visible/handle:bg-(--n-accent) group-data-[dragging]/handle:bg-(--n-accent)":"")})}):null,e(g.Provider,{value:{flex:q?`0 0 ${y(q[a],K)}`:S(r.props.defaultSize,K)},children:void 0===r.props.id?t.cloneElement(r,{id:H(a)}):r})]},r.key??a))})});export const Pane=/*@__PURE__*/t.forwardRef(function Pane({defaultSize:n,minSize:r,maxSize:o,className:i,style:a,children:l,...c},u){const{flex:f}=t.useContext(g);return e("div",{ref:u,className:s("relative min-h-0 min-w-0 overflow-auto",i),style:{flex:f,...a},...c,children:l})});
1
+ "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import*as t from"react";import{useMergedRef as r}from"../../internal/refs.js";import{beginPointerDrag as o,drawnScale as i}from"../../internal/drag.js";import{useLayoutEffectOnClient as a}from"../../internal/layout-effect.js";import{observeResize as l}from"../../internal/observe.js";import{cx as s,lengthUnit as c,toPixels as u,transitionClasses as f}from"../../internal/styles.js";import{useStyleDefaults as m}from"../../internal/defaults.js";import{panesMessages as d,useMessages as p}from"../../internal/i18n.js";const h="1 1 0%",g=/*@__PURE__*/t.createContext({flex:h}),x={xs:"basis-1",sm:"basis-1.5",md:"basis-2",lg:"basis-2.5",xl:"basis-3"},v={xs:4,sm:6,md:8,lg:10,xl:12};function b(e,n,t){if(null!=e)return"number"==typeof e?n*e/100:u(e,{percentOf:n,relativeTo:t})}function z(e,n,t){const r=e.map(e=>b(e.defaultSize,n,t)),o=r.reduce((e,n)=>e+(n??0),0),i=r.filter(e=>void 0===e).length,a=i>0?Math.max(0,n-o)/i:0,l=r.map(e=>Math.max(0,e??a)),s=l.reduce((e,n)=>e+n,0);return s<=0?l.map(()=>1/Math.max(1,l.length)):l.map(e=>e/s)}function y(e,n){return`calc((100% - ${n}px) * ${e.toFixed(6)})`}function w(e){if("string"!=typeof e)return!1;const n=c(e);return void 0!==n&&"%"!==n}function S(e,n){if(w(e))return`0 1 ${e}`;const t="number"==typeof e?e/100:"string"==typeof e?u(e,{percentOf:1}):void 0;return void 0===t?h:`0 1 ${y(Math.max(0,t),n)}`}export const Panes=/*@__PURE__*/t.forwardRef(function Panes(c,u){const{orientation:h="horizontal",resizable:$=!0,color:j="primary",size:M="md",onResize:R,onResizeEnd:A,handleLabel:E,locale:N,className:P,style:k,children:C,...D}=m(c,["size","locale"]),I=t.Children.toArray(C).filter(t.isValidElement),L=I.length,T=p(d,N),F=t.useId(),H=e=>I[e]?.props.id??`${F}-pane-${e}`,O=t.useRef(null),W=r(O,u),X=I.map(e=>e.props),Y=t.useRef([]);Y.current=X;const _="horizontal"===h,K=v[M]*Math.max(0,L-1),[U,V]=t.useState(null),q=(U&&U.length===L?U:null)??(X.some(e=>w(e.defaultSize))?null:z(X,100,null)),B=t.useRef(null);function G(e){const n=O.current,t=B.current;if(!$||!n||!t||void 0===t[e+1])return null;const r=(_?n.offsetWidth:n.offsetHeight)-K;if(r<=0)return null;const o=Y.current[e],i=Y.current[e+1],a=t[e]*r,l=a+t[e+1]*r,s=Math.max(b(o?.minSize,r,n)??0,l-(b(i?.maxSize,r,n)??l)),c=Math.min(b(o?.maxSize,r,n)??l,l-(b(i?.minSize,r,n)??0));return c<s?null:{root:n,current:t,extent:r,start:a,pair:l,resize(n){const o=Math.min(c,Math.max(s,a+n)),i=[...t];return i[e]=o/r,i[e+1]=(l-o)/r,V(i),R?.(i.map(e=>100*e)),i}}}t.useEffect(()=>{B.current=q}),a(()=>{const e=O.current;if(!e)return;const n=()=>{const n=(_?e.offsetWidth:e.offsetHeight)-K;n<=0||V(t=>t&&t.length===L?t:z(Y.current,n,e))};return n(),l(e,n)},[L,_,K]);const J=t.useRef(null);t.useEffect(()=>()=>J.current?.(),[]);const Q=s("group/handle relative z-1 flex shrink-0 grow-0 items-center justify-center",x[M],f,"focus-visible:[outline:2px_solid_var(--n-ring)] focus-visible:outline-offset-[-2px]",$?s(_?"cursor-col-resize":"cursor-row-resize","neba-hit","touch-none","hover:bg-(--n-soft) data-[dragging]:bg-(--n-soft)"):"");return e("div",{ref:W,className:s("flex h-full w-full",_?"flex-row":"flex-col","min-h-0 min-w-0",P),style:{"--n-accent":`var(--neba-${j}-accent)`,"--n-soft":`var(--neba-${j}-soft)`,"--n-ring":`var(--neba-${j}-ring)`,...k},...D,children:I.map((r,a)=>n(t.Fragment,{children:[a>0?e("div",{role:"separator","aria-label":"function"==typeof E?E(a-1):E??T.handle,"aria-controls":`${H(a-1)} ${H(a)}`,"aria-orientation":_?"vertical":"horizontal","aria-valuenow":q?Math.round(100*q[a-1]):void 0,"aria-valuemin":0,"aria-valuemax":100,"aria-disabled":!$||void 0,tabIndex:$?0:-1,className:Q,onPointerDown:e=>{0===e.button&&function(e,n){const t=G(e);if(!t)return;const r=n.currentTarget,a=_?n.clientX:n.clientY,l=_&&"rtl"===getComputedStyle(t.root).direction?-1:1,s=i(t.root)[_?"x":"y"];let c=t.current;J.current=o({target:r,pointerId:n.pointerId,onMove:e=>{const n=_?e.clientX:e.clientY;c=t.resize((n-a)/s*l)},onEnd:()=>{J.current=null,A?.(c.map(e=>100*e))}})}(a-1,e)},onKeyDown:e=>{const n=_&&"rtl"===getComputedStyle(e.currentTarget).direction,t=_?n?"ArrowRight":"ArrowLeft":"ArrowUp",r=_?n?"ArrowLeft":"ArrowRight":"ArrowDown";e.key!==t&&e.key!==r||(e.preventDefault(),function(e,n){const t=G(e);if(!t)return;const r=t.resize(n);A?.(r.map(e=>100*e))}(a-1,e.key===r?16:-16))},children:e("span",{"aria-hidden":"true",className:s("pointer-events-none bg-(--neba-border)",f,_?"h-full w-px":"h-px w-full",$?"group-hover/handle:bg-(--n-accent) group-focus-visible/handle:bg-(--n-accent) group-data-[dragging]/handle:bg-(--n-accent)":"")})}):null,e(g.Provider,{value:{flex:q?`0 0 ${y(q[a],K)}`:S(r.props.defaultSize,K)},children:void 0===r.props.id?t.cloneElement(r,{id:H(a)}):r})]},r.key??a))})});export const Pane=/*@__PURE__*/t.forwardRef(function Pane({defaultSize:n,minSize:r,maxSize:o,className:i,style:a,children:l,...c},u){const{flex:f}=t.useContext(g);return e("div",{ref:u,className:s("relative min-h-0 min-w-0 overflow-auto",i),style:{flex:f,...a},...c,children:l})});