fluid-primitives 0.12.0 → 0.14.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.
- package/Resources/Public/JavaScript/dist/Accordion-CDhNab8V.js +1 -0
- package/Resources/Public/JavaScript/dist/{Checkbox-jsqrTs44.js → Checkbox-CpGwRTbn.js} +1 -1
- package/Resources/Public/JavaScript/dist/Client-C7pLb8Ab.js +1 -0
- package/Resources/Public/JavaScript/dist/{Clipboard-D22TL1oO.js → Clipboard-3xYQ-5z-.js} +1 -1
- package/Resources/Public/JavaScript/dist/Collapsible-CRkyzge9.js +1 -0
- package/Resources/Public/JavaScript/dist/{Dialog-BMSz7fxF.js → Dialog-B0rH38Du.js} +1 -1
- package/Resources/Public/JavaScript/dist/Field-BwzB3Eom.js +1 -0
- package/Resources/Public/JavaScript/dist/Form-DBNNU5PD.js +1 -0
- package/Resources/Public/JavaScript/dist/NumberInput-CApZObd4.js +1 -0
- package/Resources/Public/JavaScript/dist/{Popover-BKp5gU9k.js → Popover-uUcHrP8Z.js} +1 -1
- package/Resources/Public/JavaScript/dist/RadioGroup-RoniWWCD.js +1 -0
- package/Resources/Public/JavaScript/dist/{ScrollArea-SbIL1FyF.js → ScrollArea-XpAVw840.js} +1 -1
- package/Resources/Public/JavaScript/dist/{Select-COv2Nq5G.js → Select-DvsJPyz5.js} +1 -1
- package/Resources/Public/JavaScript/dist/{Tabs-BjhGHZLt.js → Tabs-BCk2WAmg.js} +1 -1
- package/Resources/Public/JavaScript/dist/{Tooltip-Bzjy9H15.js → Tooltip-C7vqPe3n.js} +1 -1
- package/Resources/Public/JavaScript/dist/accordion.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/accordion.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/accordion.js +1 -1
- package/Resources/Public/JavaScript/dist/checkbox.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/checkbox.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/checkbox.js +1 -1
- package/Resources/Public/JavaScript/dist/client.d.ts +1 -1
- package/Resources/Public/JavaScript/dist/client.js +1 -1
- package/Resources/Public/JavaScript/dist/clipboard.d.ts +1 -1
- package/Resources/Public/JavaScript/dist/clipboard.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/clipboard.js +1 -1
- package/Resources/Public/JavaScript/dist/collapsible.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/collapsible.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/collapsible.js +1 -1
- package/Resources/Public/JavaScript/dist/dialog.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/dialog.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/dialog.js +1 -1
- package/Resources/Public/JavaScript/dist/field.d.ts +7 -2
- package/Resources/Public/JavaScript/dist/field.dom-r8J9M7vj.js +1 -0
- package/Resources/Public/JavaScript/dist/field.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/field.js +1 -1
- package/Resources/Public/JavaScript/dist/form.d.ts +27 -10
- package/Resources/Public/JavaScript/dist/form.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/form.js +1 -1
- package/Resources/Public/JavaScript/dist/{form.registry-DNhIXwJO.d.ts → form.registry-Bk1J-OLU.d.ts} +1 -1
- package/Resources/Public/JavaScript/dist/{index-iJSgk-K3.d.ts → index-QGNV9SvR.d.ts} +4 -4
- package/Resources/Public/JavaScript/dist/number-input.d.ts +16 -0
- package/Resources/Public/JavaScript/dist/number-input.entry.d.ts +1 -0
- package/Resources/Public/JavaScript/dist/number-input.entry.js +1 -0
- package/Resources/Public/JavaScript/dist/number-input.js +1 -0
- package/Resources/Public/JavaScript/dist/popover.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/popover.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/popover.js +1 -1
- package/Resources/Public/JavaScript/dist/radio-group.d.ts +5 -4
- package/Resources/Public/JavaScript/dist/radio-group.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/radio-group.js +1 -1
- package/Resources/Public/JavaScript/dist/scroll-area.d.ts +1 -1
- package/Resources/Public/JavaScript/dist/scroll-area.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/scroll-area.js +1 -1
- package/Resources/Public/JavaScript/dist/select.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/select.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/select.js +1 -1
- package/Resources/Public/JavaScript/dist/tabs.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/tabs.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/tabs.js +1 -1
- package/Resources/Public/JavaScript/dist/tooltip.d.ts +3 -3
- package/Resources/Public/JavaScript/dist/tooltip.entry.js +1 -1
- package/Resources/Public/JavaScript/dist/tooltip.js +1 -1
- package/package.json +22 -20
- package/Resources/Public/JavaScript/dist/Accordion-D3ZwOmMs.js +0 -1
- package/Resources/Public/JavaScript/dist/Client-B1xGmpZs.js +0 -1
- package/Resources/Public/JavaScript/dist/Collapsible-Bz1onVf2.js +0 -1
- package/Resources/Public/JavaScript/dist/Field-ee7vWRwq.js +0 -1
- package/Resources/Public/JavaScript/dist/Form-47xEgFHH.js +0 -1
- package/Resources/Public/JavaScript/dist/RadioGroup-DSiC5Yzs.js +0 -1
- package/Resources/Public/JavaScript/dist/field.dom-BPeGctuk.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/accordion";var i=class extends e{static name=`accordion`;initMachine(e){return new t(r.machine,{collapsible:!0,...e})}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElements(`item`);t.forEach(e=>{this.spreadProps(e,this.api.getItemProps({value:e.getAttribute(`data-value`),disabled:e.hasAttribute(`data-disabled`)}))});let n=this.getElements(`item-trigger`);n.forEach(e=>{this.spreadProps(e,this.api.getItemTriggerProps({value:e.getAttribute(`data-value`),disabled:e.hasAttribute(`data-disabled`)}))});let r=this.getElements(`item-content`);r.forEach(e=>{this.spreadProps(e,this.api.getItemContentProps({value:e.getAttribute(`data-value`),disabled:e.hasAttribute(`data-disabled`)}))});let i=this.getElements(`item-indicator`);i.forEach(e=>{this.spreadProps(e,this.api.getItemIndicatorProps({value:e.getAttribute(`data-value`),disabled:e.hasAttribute(`data-disabled`)}))}),this.getElements(`item-header`)}};export{i as Accordion};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FieldAwareComponent as e,Machine as t,mergeProps as n,normalizeProps as r}from"./Client-
|
|
1
|
+
import{FieldAwareComponent as e,Machine as t,mergeProps as n,normalizeProps as r}from"./Client-C7pLb8Ab.js";import{getControlId as i,getLabelId as a}from"./field.dom-r8J9M7vj.js";import*as o from"@zag-js/checkbox";var s=class extends e{static name=`checkbox`;propsWithField(e,t){return{value:`1`,...e,disabled:e.disabled??t.ctx.get(`disabled`),readOnly:e.readOnly??t.ctx.get(`readOnly`),required:e.required??t.ctx.get(`required`),invalid:e.invalid??t.ctx.get(`invalid`),name:e.name??t.prop(`name`),ids:{...e.ids,label:a(t.scope),hiddenInput:i(t.scope)}}}initMachine(e){return e=this.withFieldProps(e),new t(o.machine,e)}initApi(){return o.connect(this.machine.service,r)}render(){this.subscribeToFieldService();let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let r=this.getElement(`control`);r&&this.spreadProps(r,this.api.getControlProps());let i=this.getElement(`indicator`);i&&this.spreadProps(i,this.api.getIndicatorProps());let a=this.getElement(`hidden-input`);if(a){let e=n(this.api.getHiddenInputProps(),{"aria-describedby":this.fieldMachine?.ctx.get(`describeIds`)||void 0});this.spreadProps(a,e)}}};export{s as Checkbox};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ListCollection as e}from"@zag-js/collection";import{INIT_STATE as t,MachineStatus as n,createScope as r,mergeProps as i}from"@zag-js/core";import{proxy as a,subscribe as o}from"@zag-js/store";import{compact as s,identity as c,isEqual as l,isFunction as u,isString as d,runIfFn as f,toArray as p,uuid as m,warn as h}from"@zag-js/utils";import{createNormalizer as g}from"@zag-js/types";var _=class{document;machine;api;hydrator=null;userProps;static name;get doc(){return this.document}constructor(e,t=document){this.document=t,this.userProps=this.transformProps(e),this.hydrator=this.initHydrator(e),this.machine=this.initMachine(e),this.api=this.initApi()}initHydrator(e){let t=e.id;if(!t)throw Error(`ComponentHydrator requires an id prop to initialize.`);return new E(this.getName(),t,e.ids,this.doc)}init(){this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start()}getName(){return this.constructor.name}transformProps(e){return e}updateProps(e){let t={...this.userProps,...e};this.userProps=this.transformProps(t),this.machine.updateProps(t)}destroy=()=>{this.machine.stop(),this.hydrator?.destroy()};spreadProps(e,t){H(e,t,this.machine.scope.id)}getElement(e,t){return this.hydrator?.getElement(e,t)||null}getElements(e,t){return this.hydrator?.getElements(e,t)||[]}portalElement(e,t=this.doc.body){e&&e.parentNode!==t&&(t.appendChild(e),e.setAttribute(`data-portalled`,`true`))}};const v=new WeakMap;function y(e,t){e&&(v.set(e,t),e.dispatchEvent(new CustomEvent(`fluid-primitives:field:registered`,{bubbles:!0})))}function b(e){if(e)return v.get(e)}const x=[`invalid`,`disabled`,`readOnly`,`required`],S={disabled:e=>e.context.get(`disabled`),readOnly:e=>e.context.get(`readOnly`),required:e=>e.context.get(`required`),invalid:e=>e.context.get(`invalid`)};var C=class extends _{subscribedToField=!1;fieldMachine;closestField=null;getClosestField(){return this.closestField||this.getElement(`root`)?.closest(`[data-scope="field"][data-part="root"]`)||null}withFieldProps(e){if(this.closestField=this.getClosestField(),!this.closestField)return e;if(this.fieldMachine=b(this.closestField),this.fieldMachine)return this.propsWithField(e,this.fieldMachine);{let e=()=>{this.fieldMachine=b(this.closestField),this.updateProps(this.propsWithField(this.userProps,this.fieldMachine)),this.closestField?.removeEventListener(`fluid-primitives:field:registered`,e)};this.closestField.addEventListener(`fluid-primitives:field:registered`,e)}return e}subscribeToFieldService(){if(!this.subscribedToField&&(this.closestField=this.getClosestField(),this.closestField))if(this.fieldMachine||=b(this.closestField),this.fieldMachine)this.fieldMachine.subscribe(e=>{queueMicrotask(()=>{let t={};for(let n of x){let r=!!S[n](e),i=!!this.machine.prop(n);r!==i&&(t[n]=r)}Object.keys(t).length>0?this.updateProps(t):this.machine.notify()})}),this.subscribedToField=!0;else{let e=()=>{this.subscribeToFieldService(),this.closestField.removeEventListener(`fluid-primitives:field:registered`,e)};this.closestField.addEventListener(`fluid-primitives:field:registered`,e)}}};function w(e,t){let n=window.FluidPrimitives?.hydrationData;return!n||typeof n!=`object`?null:e?n[e]?t?n[e][t]||null:n[e]:null:n}function T(e,t){let n=w(e);n&&Object.keys(n).forEach(r=>{if(n[r].controlled)return;let i=t({...n[r],createHydrator:()=>new E(e,r,n[r].props.ids)});i&&(window.FluidPrimitives.uncontrolledInstances[e]||(window.FluidPrimitives.uncontrolledInstances[e]={}),window.FluidPrimitives.uncontrolledInstances[e][r]=i)})}var E=class{componentName;doc;rootId;ids;elementRefs=new Map;constructor(e,t,n={},r=document){if(this.componentName=e,this.doc=r,!t)throw Error(`Root ID is required for component hydration: ${e}`);this.rootId=t,this.ids=n}getElement(e,t=this.doc){if(this.elementRefs.has(e))return this.elementRefs.get(e)||null;let n=null;return n=this.ids[e]?t.querySelector(`#${this.ids[e]}`):t.querySelector(`[data-hydrate-${this.componentName}="${this.rootId}"][data-part="${e}"][data-scope="${this.componentName}"]`),n&&(t===this.doc&&this.elementRefs.set(e,n),n.removeAttribute(`data-hydrate-${this.componentName}`),n.__rootId=this.rootId),n}getElements(e,t=this.doc){if(this.elementRefs.has(e))return this.elementRefs.get(e);let n=[];return n=this.ids[e]?Array.from(t.querySelectorAll(`#${this.ids[e]}`)):Array.from(t.querySelectorAll(`[data-hydrate-${this.componentName}="${this.rootId}"][data-part="${e}"][data-scope="${this.componentName}"]`)),t===this.doc&&this.elementRefs.set(e,n),n.forEach(e=>e.removeAttribute(`data-hydrate-${this.componentName}`)),n}generateRefAttributesString(e){let t=this.ids[e]||`${this.rootId}-${e}`;return`data-scope="${this.componentName}" data-part="${e}" data-hydrate-${this.componentName}="${t}"`}setRefAttributes(e,t){let n=this.generateRefAttributesString(t),r=n.split(` `).map(e=>e.trim());r.forEach(t=>{let[n,r]=t.split(`=`);e.setAttribute(n,r.replace(/"/g,``))})}destroy(){this.elementRefs.forEach(e=>{e instanceof Element?e.setAttribute(`data-hydrate-${this.componentName}`,this.rootId):e.forEach(e=>e.setAttribute(`data-hydrate-${this.componentName}`,this.rootId))}),this.elementRefs.clear()}};function D(t){if(t instanceof e)return t;let n=new e({items:t.items,itemToValue:t.itemToValueKey?e=>e?.[t.itemToValueKey]:void 0,itemToString:t.itemToStringKey?e=>e?.[t.itemToStringKey]:void 0,isItemDisabled:t.isItemDisabledKey?e=>e?.[t.isItemDisabledKey]:void 0,groupBy:t.groupByKey?e=>{let n=t.groupByKey;if(n)return n.includes(`.`)?n.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e?.[n]}:void 0});return n}function O(e){let t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=e().isEqual??Object.is,r=a({value:t}),i=()=>e().value!==void 0;return{initial:t,ref:r,get(){return i()?e().value:r.value},set(t){let a=r.value,o=u(t)?t(a):t;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:o,prev:a}),i()||(r.value=o),n(o,a)||e().onChange?.(o,a)},invoke(t,n){e().onChange?.(t,n)},hash(t){return e().hash?.(t)??String(t)}}}O.cleanup=e=>{},O.ref=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};function k(e){let t={current:e};return{get(e){return t.current[e]},set(e,n){t.current[e]=n}}}var A=class{scope;ctx;prop;state;refs;computed;event={type:``};previousEvent;effects=new Map;transition=null;cleanups=[];subscriptions=[];userPropsRef;getEvent=()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent});getState=()=>({...this.state,matches:(...e)=>e.includes(this.state.get()),hasTag:e=>!!this.machine.states[this.state.get()]?.tags?.includes(e)});debug=(...e)=>{this.machine.debug&&console.log(...e)};notify=()=>{this.publish()};constructor(e,n={}){this.machine=e,this.userPropsRef={current:n};let{id:i,ids:a,getRootNode:c}=f(n);this.scope=r({id:i,ids:a,getRootNode:c});let l=t=>{let n=f(this.userPropsRef.current),r=e.props?.({props:s(n),scope:this.scope})??n;return r[t]};this.prop=l;let u=e.context?.({prop:l,bindable:O,scope:this.scope,flush(e){queueMicrotask(e)},getContext(){return d},getComputed(){return p},getRefs(){return m},getEvent:this.getEvent.bind(this)});u&&Object.values(u).forEach(e=>{let t=o(e.ref,()=>this.notify());this.cleanups.push(t)});let d={get(e){return u?.[e].get()},set(e,t){u?.[e].set(t)},initial(e){return u?.[e].initial},hash(e){let t=u?.[e].get();return u?.[e].hash(t)}};this.ctx=d;let p=t=>e.computed?.[t]({context:d,event:this.getEvent(),prop:l,refs:this.refs,scope:this.scope,computed:p})??{};this.computed=p;let m=k(e.refs?.({prop:l,context:d})??{});this.refs=m;let h=O(()=>({defaultValue:e.initialState({prop:l}),onChange:(n,r)=>{if(r){let e=this.effects.get(r);e?.(),this.effects.delete(r)}r&&this.action(e.states[r]?.exit),this.action(this.transition?.actions);let i=this.effect(e.states[n]?.effects);if(i&&this.effects.set(n,i),r===t){this.action(e.entry);let n=this.effect(e.effects);n&&this.effects.set(t,n)}this.action(e.states[n]?.entry)}}));this.state=h,this.cleanups.push(o(this.state.ref,()=>this.notify()))}updateProps(e){this.userPropsRef.current=e,this.notify()}send=e=>{this.status===n.Started&&queueMicrotask(()=>{this.previousEvent=this.event,this.event=e,this.debug(`send`,e);let t=this.state.get(),n=this.machine.states[t].on?.[e.type]??this.machine.on?.[e.type],r=this.choose(n);if(!r)return;this.transition=r;let i=r.target??t;this.debug(`transition`,r);let a=i!==t;a?this.state.set(i):this.action(r.actions)})};action=e=>{let t=u(e)?e(this.getParams()):e;if(!t)return;let n=t.map(e=>{let t=this.machine.implementations?.actions?.[e];return t||h(`[zag-js] No implementation found for action "${JSON.stringify(e)}"`),t});for(let e of n)e?.(this.getParams())};guard=e=>u(e)?e(this.getParams()):this.machine.implementations?.guards?.[e](this.getParams());effect=e=>{let t=u(e)?e(this.getParams()):e;if(!t)return;let n=t.map(e=>{let t=this.machine.implementations?.effects?.[e];return t||h(`[zag-js] No implementation found for effect "${JSON.stringify(e)}"`),t}),r=[];for(let e of n){let t=e?.(this.getParams());t&&r.push(t)}return()=>r.forEach(e=>e?.())};choose=e=>p(e).find(e=>{let t=!e.guard;return d(e.guard)?t=!!this.guard(e.guard):u(e.guard)&&(t=e.guard(this.getParams())),t});start(){this.status=n.Started,this.debug(`initializing...`),this.state.invoke(this.state.initial,t),this.setupTrackers()}stop(){this.effects.forEach(e=>e?.()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.status=n.Stopped,this.debug(`unmounting...`)}subscribe=e=>{this.subscriptions.push(e)};status=n.NotStarted;get service(){return{state:this.getState(),send:this.send,context:this.ctx,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}publish=()=>{this.callTrackers(),this.subscriptions.forEach(e=>e(this.service))};trackers=[];setupTrackers=()=>{this.machine.watch?.(this.getParams())};callTrackers=()=>{this.trackers.forEach(({deps:e,fn:t})=>{let n=e.map(e=>e());l(t.prev,n)||(t(),t.prev=n)})};getParams=()=>({state:this.getState(),context:this.ctx,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(e,t)=>{t.prev=e.map(e=>e()),this.trackers.push({deps:e,fn:t})},refs:this.refs,computed:this.computed,flush:c,scope:this.scope,choose:this.choose})};const j={onFocus:`onFocusin`,onBlur:`onFocusout`,onChange:`onInput`,onDoubleClick:`onDblclick`,htmlFor:`for`,className:`class`,defaultValue:`value`,defaultChecked:`checked`},M=new Set([`viewBox`,`preserveAspectRatio`]),N=e=>{let t=``;for(let n in e){let r=e[n];if(r==null)continue;n.startsWith(`--`)||(n=n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)),t+=`${n}:${r};`}return t},P=g(e=>Object.entries(e).reduce((e,[t,n])=>{if(n===void 0)return e;if(t in j&&(t=j[t]),t===`style`&&typeof n==`object`)return e.style=N(n),e;let r=M.has(t)?t:t.toLowerCase();return e[r]=n,e},{}));function F(...e){let t=i(...e);return`style`in t&&(t.style=N(t.style)),t}function I(e=`f`){return`«`+e+m()+`»`}const L=new Map,R=new Set([`value`,`checked`,`htmlFor`]),z=new Set([`viewBox`,`preserveAspectRatio`]),B=e=>e.tagName===`svg`||e.namespaceURI===`http://www.w3.org/2000/svg`,V=(e,t)=>{let n=B(e)&&z.has(t);return n?t:t.toLowerCase()};function H(e,t,n){e.__spreadId||=`spread_${I()}`;let r=``;r=n?`${e.__spreadId}_${n}`:`${e.__spreadId}`;let i=L.get(r)||{},a=Object.keys(t),o=(t,n)=>{e.addEventListener(t.toLowerCase(),n)},s=(t,n)=>{e.removeEventListener(t.toLowerCase(),n)},c=e=>e.startsWith(`on`),l=e=>!e.startsWith(`on`),u=e=>o(e.substring(2),t[e]),d=e=>s(e.substring(2),t[e]),f=n=>{let r=t[n],a=i[n];if(r!==a){if(n===`children`){e.textContent=r;return}if(typeof r==`boolean`&&(n.includes(`aria-`)||(r||=void 0)),r!=null){R.has(n)?e[n]=r:e.setAttribute(V(e,n),r);return}e.removeAttribute(V(e,n))}};for(let n in i)t[n]??e.removeAttribute(V(e,n));let p=Object.keys(i).filter(c);return p.forEach(e=>{s(e.substring(2),i[e])}),a.filter(c).forEach(u),a.filter(l).forEach(f),L.set(r,t),function(){a.filter(c).forEach(d)}}export{_ as Component,E as ComponentHydrator,C as FieldAwareComponent,A as Machine,w as getHydrationData,D as getListCollectionFromHydrationData,F as mergeProps,T as mount,P as normalizeProps,y as registerFieldMachine,H as spreadProps,I as uid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/clipboard";var i=class extends e{static name=`clipboard`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let n=this.getElement(`control`);n&&this.spreadProps(n,this.api.getControlProps());let r=this.getElement(`input`);r&&this.spreadProps(r,this.api.getInputProps());let i=this.getElement(`indicator-copied`);i&&this.spreadProps(i,this.api.getIndicatorProps({copied:!0}));let a=this.getElement(`indicator-idle`);a&&this.spreadProps(a,this.api.getIndicatorProps({copied:!1}));let o=this.getElement(`trigger`);o&&this.spreadProps(o,this.api.getTriggerProps())}};export{i as Clipboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/collapsible";var i=class extends e{static name=`collapsible`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElements(`trigger`);t.forEach(e=>{this.spreadProps(e,this.api.getTriggerProps())});let n=this.getElements(`trigger-text`);n.forEach(e=>{e&&e.dataset.openText&&e.dataset.closeText&&(e.textContent=this.api.open?e.dataset.closeText:e.dataset.openText)});let r=this.getElement(`content`);r&&this.spreadProps(r,this.api.getContentProps())}};export{i as Collapsible};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/dialog";var i=class extends e{static name=`dialog`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElements(`trigger`);e.forEach(e=>{this.spreadProps(e,this.api.getTriggerProps())});let t=this.getElement(`backdrop`);t&&this.spreadProps(t,this.api.getBackdropProps());let n=this.getElement(`positioner`);n&&this.spreadProps(n,this.api.getPositionerProps());let r=this.getElement(`content`);r&&this.spreadProps(r,this.api.getContentProps());let i=this.getElement(`title`);i&&this.spreadProps(i,this.api.getTitleProps());let a=this.getElement(`description`);a&&this.spreadProps(a,this.api.getDescriptionProps());let o=this.getElements(`close-trigger`);o.forEach(e=>{this.spreadProps(e,this.api.getCloseTriggerProps())})}};export{i as Dialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n,registerFieldMachine as r}from"./Client-C7pLb8Ab.js";import{getControlId as i,getDescriptionEl as a,getDescriptionId as o,getErrorId as s,getLabelId as c,getRootEl as l,getRootId as u}from"./field.dom-r8J9M7vj.js";import{getFormMachineFor as d,registerFieldMachineForForm as f}from"./form.registry-ABqE-vzj.js";import{createMachine as p}from"@zag-js/core";import{createAnatomy as m}from"@zag-js/anatomy";const h=m(`field`).parts(`root`,`label`,`control`,`error`,`description`),g=h.build();function _(e,t){let{scope:n,prop:r,context:a,computed:l}=e,d=a.get(`invalid`),f=a.get(`disabled`),p=a.get(`required`),m=a.get(`readOnly`),h=l(`errors`);return{getFormMachine:()=>a.get(`formMachine`),invalid:d,disabled:f,required:p,readOnly:m,errors:h,name:r(`name`),getErrorText(){return h.length>0?h.join(` `):null},getRootProps(){return t.element({...g.root.attrs,id:u(n),"data-invalid":d?``:void 0,"data-disabled":f?``:void 0,"data-readonly":m?``:void 0,"data-required":p?``:void 0,"data-name":r(`name`)})},getLabelProps(){return t.label({...g.label.attrs,id:c(n),htmlFor:i(n),"data-invalid":d?``:void 0,"data-disabled":f?``:void 0,"data-required":p?``:void 0})},getControlProps(){return t.element({...g.control.attrs,id:i(n),name:r(`name`),disabled:f||void 0,readOnly:m||void 0,required:p||void 0,"aria-invalid":d?`true`:void 0,"aria-describedby":a.get(`describeIds`)||void 0,"aria-required":p?`true`:void 0,"data-invalid":d?``:void 0,"data-disabled":f?``:void 0,"data-readonly":m?``:void 0})},getErrorProps(){return t.element({...g.error.attrs,id:s(n),hidden:!d})},getDescriptionProps(){return t.element({...g.description.attrs,id:o(n)})}}}const v=p({initialState(){return`ready`},context({bindable:e,prop:t}){return{invalid:e(()=>({defaultValue:t(`invalid`)??!1})),required:e(()=>({defaultValue:t(`required`)??!1})),disabled:e(()=>({defaultValue:t(`disabled`)??!1})),readOnly:e(()=>({defaultValue:t(`readOnly`)??!1})),formMachine:e(()=>({defaultValue:null,hash:e=>JSON.stringify({state:e?.state,errors:e?.ctx.get(`errors`)})})),describeIds:e(()=>({defaultValue:void 0})),hasDescription:e(()=>({defaultValue:!1}))}},entry:[`getFormMachine`,`checkForDescription`,`determineDescribeIds`,`updateInvalid`],states:{ready:{}},computed:{errors({context:e,prop:t}){let n=e.get(`formMachine`)?.ctx;if(!n)return[];let r=n.get(`errors`)?.[t(`name`)];return r?.messages??[]}},watch({track:e,context:t,computed:n,action:r}){e([()=>t.hash(`formMachine`),()=>n(`errors`).join(`|`)],()=>{r([`updateInvalid`])}),e([()=>t.get(`invalid`),()=>t.get(`hasDescription`)],()=>{r([`determineDescribeIds`])})},implementations:{actions:{getFormMachine({context:e,scope:t}){if(e.get(`formMachine`))return;let n=l(t);if(!n)return;let r=d(n)??null;if(r)e.set(`formMachine`,r);else{let t=n.closest(`form`);if(!t)return;let r=()=>{let i=d(n)??null;e.set(`formMachine`,i),t.removeEventListener(`fluid-primitives:form:registered`,r)};t.addEventListener(`fluid-primitives:form:registered`,r)}},checkForDescription({context:e,scope:t}){let n=a(t);e.set(`hasDescription`,!!n)},determineDescribeIds({context:e,scope:t}){let n=[];e.get(`hasDescription`)&&n.push(o(t)),e.get(`invalid`)&&n.push(s(t));let r=n.join(` `)||void 0;e.set(`describeIds`,r)},updateInvalid({context:e,prop:t}){let n=e.get(`formMachine`)?.ctx;if(!n){e.set(`invalid`,t(`invalid`)??!1);return}let r=n.get(`errors`)?.[t(`name`)],i=r?.messages??[];e.set(`invalid`,i.length>0)}}}});var y=class extends e{static name=`field`;subscribedToForm=!1;initMachine(e){let n=new t(v,e);return r(this.getElement(`root`),n),f(this.getElement(`root`),n),n}initApi(){return _(this.machine.service,n)}subscribeToFormMachine(){if(this.subscribedToForm)return;let e=this.api.getFormMachine();e&&(this.subscribedToForm=!0,e.subscribe(()=>{this.machine.notify()}))}render(){this.subscribeToFormMachine();let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let n=this.getElement(`control`);n&&this.spreadProps(n,this.api.getControlProps());let r=this.getElement(`description`);r&&this.spreadProps(r,this.api.getDescriptionProps());let i=this.getElement(`error`);if(i){this.spreadProps(i,this.api.getErrorProps());let e=this.api.getErrorText();e&&(i.textContent=e)}}};export{y as Field};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import{getFieldMachinesFor as r,registerFormMachine as i}from"./form.registry-ABqE-vzj.js";import{createMachine as a}from"@zag-js/core";import{debounce as o}from"@zag-js/utils";import{createAnatomy as s}from"@zag-js/anatomy";const c=s(`form`).parts(`form`),l=c.build(),u=e=>e.ids?.form??`form:${e.id}:form`,d=e=>e.getById(u(e));function f(e,t){let{context:n,state:i,send:a,scope:s,prop:c}=e;function f(){return n.get(`values`)}function p(){return n.get(`errors`)}function m(){return n.get(`dirty`)}function h(){return n.get(`touched`)}function g(){return d(s)}let _=i.matches(`submitting`),v=Object.values(m()).length>0,y=Object.keys(p()).length>0,b=i.matches(`success`),x=i.matches(`error`),S=Object.values(h()).length>0,C=i.get(),w=c(`inputDebounceMs`)??100,T=w>0?o(e=>{a({type:`INPUT`,detail:{target:e}})},w):e=>{a({type:`INPUT`,detail:{target:e}})};return{isSubmitting:_,isDirty:v,isInvalid:y,isSuccessful:b,isError:x,getValues:f,getErrors:p,getDirty:m,getTouched:h,_userRenderFn:c(`render`),getFormEl:g,getAllFields(){return r(d(s))},getField(e){return this.getAllFields().get(e)},getAction(){let e=g();return e?.getAttribute(`action`)||``},reset(){a({type:`RESET`})},getFormProps(){return t.element({...l.form.attrs,noValidate:!0,id:u(s),"data-state":C,"data-submitting":_?``:void 0,"data-invalid":y?``:void 0,"data-dirty":v?``:void 0,"data-touched":S?``:void 0,onSubmit:async e=>{e.preventDefault();let t=e.currentTarget;n.set(`values`,new FormData(t)),a({type:`SUBMIT`,detail:{event:e,api:this}})},onReset:()=>{a({type:`RESET`,detail:{omitManualReset:!0}})},onInput:e=>{T(e.target)},onBlur:e=>{let t=e.target;!(t instanceof HTMLInputElement)&&!(t instanceof HTMLTextAreaElement)&&!(t instanceof HTMLSelectElement)&&!(t instanceof HTMLButtonElement&&t.getAttribute(`data-scope`)===`select`)||a({type:`BLUR`,detail:{target:t}})}})}}}const p=Object.freeze({status:`aborted`});function m(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}const h=Symbol(`zod_brand`);function g(e,t){return typeof t==`bigint`?t.toString():t}function _(e){let t=!1;return{get value(){if(!t){let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}const v=Symbol(`evaluating`),y=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{},b=_(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{let e=Function;return new e(``),!0}catch{return!1}}),x={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},S=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,g,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},C=m(`$ZodError`,S),w=m(`$ZodError`,S,{Parent:Error});function T(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}var E=class extends Error{constructor(e){super(`Server validation failed`),this.errors=e,this.name=`ValidationError`}};function D(e,t){if(!e)return{};let n=Object.fromEntries(t.entries()),r=e.safeParse(n);if(r.success)return{};let i=T(r.error).fieldErrors,a={};for(let e in i){if(!i[e])continue;a[e]={messages:i[e],value:A(t,e)}}return a}function O(e,t,n){let r={};for(let i in e){let a=i;t&&(a=a.replace(t+`.`,``)),r[a]={messages:e[i],value:A(n,a)}}return r}function k(e){let t=e;if(!(!t||!(`type`in t))){if(t.type===`checkbox`){let e=t;if(e.name){let t=e.form;if(t){let n=Array.from(t.querySelectorAll(`input[type="checkbox"][name="${CSS.escape(e.name)}"]`)),r=n.filter(e=>e.checked).map(e=>e.value||`on`);return n.length===1&&!n[0].value?n[0].checked:r}}return e.checked}if(t.type===`radio`){let e=t;if(e.form&&e.name){let t=e.form.querySelector(`input[type="radio"][name="${CSS.escape(e.name)}"]:checked`);return t?t.value:``}return e.checked?e.value:``}return t instanceof HTMLSelectElement&&t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value}}function A(e,t){return e.getAll(t).length>1?e.getAll(t):e.get(t)}function j(e,t,n){if(e===``)return``;let r=e.endsWith(`[]`);r&&(e=e.slice(0,-2)),n&&(e=`${n}[${e}]`);let i=e.split(`[`,2),a=`${t}[${i[0]}]`;return i.length>1&&(a+=`[${i[1]}`),r&&(a+=`[]`),a}const M=a({initialState(){return`ready`},context({bindable:e}){return{values:e(()=>({defaultValue:new FormData})),initialValues:e(()=>({defaultValue:new FormData})),errors:e(()=>({defaultValue:{}})),dirty:e(()=>({defaultValue:{}})),touched:e(()=>({defaultValue:{}}))}},states:{ready:{},invalid:{},submitting:{},success:{},error:{}},on:{SUBMIT:{target:`submitting`,actions:[`validateAll`]},VALIDATE:{actions:[`validateAll`]},VALIDATE_FIELD:{actions:[`validateField`]},INVALID:{target:`invalid`},INPUT:{actions:[`handleInput`]},BLUR:{actions:[`handleBlur`]},RESET:{target:`ready`,actions:[`resetForm`]},ERROR:{target:`error`},SUCCESS:{target:`success`}},entry:[`setupFormListeners`],implementations:{actions:{validateAll({context:e,send:t,prop:n,state:r,action:i,event:a,scope:o}){let s=r.matches(`submitting`),c=n(`schema`);if(c){let n=e.get(`values`),r=D(c,n);if(e.set(`errors`,r),Object.keys(r).length>0){t({type:`INVALID`}),s&&i([`focusFirstInvalid`]);return}}if(!s){r.set(`ready`);return}let l=n(`onSubmit`);if(!l){t({type:`SUCCESS`});return}(async()=>{try{let r=await l({formData:e.get(`values`),api:a.detail.api,event:a.detail.event,post:async(e,t)=>{let r=new FormData,i=n(`objectName`),a=d(o),s=a?.getAttribute(`data-field-name-prefix`)||``;for(let[e,n]of t.entries()){if(e.includes(s)){r.append(e,n);continue}r.append(j(e,s,i),n)}let c=await fetch(e,{method:`POST`,body:r});if(c.status===422){let e=await c.json(),n=O(e,i,t);throw new E(n)}return c}});t(r?{type:`SUCCESS`}:{type:`ERROR`})}catch(n){if(n instanceof E){e.set(`errors`,n.errors),t({type:`INVALID`}),i([`focusFirstInvalid`]);return}t({type:`ERROR`})}})()},validateField({context:e,prop:t,event:n}){let r=t(`schema`);if(!r)return;let i=n.detail?.fieldName;if(!i)return;let a=e.get(`values`),o=e.get(`errors`),s=o[i],c=A(a,i);if(s){let e=s.value;if(JSON.stringify(c)===JSON.stringify(e))return}let l=D(r,a),u={...o};l[i]?u[i]=l[i]:delete u[i],e.set(`errors`,u)},handleInput({context:e,event:t,send:n}){let r=t,i=r?.detail?.target??r?.target??r?.currentTarget,a=i?.name;if(!a)return;let o=r?.detail?.value??k(i),s=e.get(`values`);s.set(a,o),e.set(`values`,s);let c=e.get(`initialValues`).get(a),l={...e.get(`dirty`)};l[a]=JSON.stringify(s.get(a))!==JSON.stringify(c),e.set(`dirty`,l);let u=e.get(`errors`),d=e.get(`touched`),f=!!u[a],p=!!d[a];(f||p)&&n({type:`VALIDATE_FIELD`,detail:{fieldName:a}})},handleBlur({context:e,send:t,prop:n,event:r}){let i=r,a=i?.detail?.target,o=a?.name;if(o||=a?.closest(`[data-scope="field"]`)?.getAttribute(`name`)||void 0,!o)return;let s={...e.get(`touched`)};s[o]=!0,e.set(`touched`,s);let c=a.form;if(c){let t=new FormData(c);e.set(`values`,t)}let l=n(`schema`);l&&t({type:`VALIDATE_FIELD`,detail:{fieldName:o}})},resetForm({context:e,scope:t,event:n}){let r=d(t);r&&!n?.detail?.omitManualReset&&r.reset();let i=r?new FormData(r):e.get(`initialValues`);e.set(`values`,i),e.set(`initialValues`,i),e.set(`errors`,{}),e.set(`touched`,{}),e.set(`dirty`,{})},focusFirstInvalid({context:e,scope:t}){let n=e.get(`errors`),r=Object.keys(n)[0];if(!r)return;let i=d(t);if(!i)return;let a=i.querySelector(`[name="${CSS.escape(r)}"]`);a?.focus(),(a instanceof HTMLInputElement||a instanceof HTMLTextAreaElement)&&a.select()},setupFormListeners({scope:e,send:t}){let n=d(e);n&&n.addEventListener(`change`,e=>{t({type:`INPUT`,detail:{target:e.target}})},!0)}}}});var N=class extends e{static name=`form`;initMachine(e){let n=new t(M,e);return i(this.getElement(`form`),n),n}initApi(){return f(this.machine.service,n)}render(){let e=this.getElement(`form`);e&&(this.spreadProps(e,this.api.getFormProps()),this.api._userRenderFn?.(this))}};export{N as Form,E as ValidationError};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FieldAwareComponent as e,Machine as t,mergeProps as n,normalizeProps as r}from"./Client-C7pLb8Ab.js";import{getControlId as i,getLabelId as a}from"./field.dom-r8J9M7vj.js";import*as o from"@zag-js/number-input";var s=class extends e{static name=`number-input`;propsWithField(e,t){return{...e,disabled:e.disabled??t.ctx.get(`disabled`),readOnly:e.readOnly??t.ctx.get(`readOnly`),required:e.required??t.ctx.get(`required`),invalid:e.invalid??t.ctx.get(`invalid`),name:e.name??t.prop(`name`),ids:{...e.ids,label:a(t.scope),input:i(t.scope)}}}initMachine(e){return e=this.withFieldProps(e),new t(o.machine,e)}initApi(){return o.connect(this.machine.service,r)}render(){this.subscribeToFieldService();let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let r=this.getElement(`control`);r&&this.spreadProps(r,this.api.getControlProps());let i=this.getElement(`input`);if(i){let e=n(this.api.getInputProps(),{"aria-describedby":this.fieldMachine?.ctx.get(`describeIds`)||void 0});this.spreadProps(i,e)}let a=this.getElement(`increment-trigger`);a&&this.spreadProps(a,this.api.getIncrementTriggerProps());let o=this.getElement(`decrement-trigger`);o&&this.spreadProps(o,this.api.getDecrementTriggerProps());let s=this.getElement(`value-text`);s&&this.spreadProps(s,this.api.getValueTextProps());let c=this.getElement(`scrubber`);c&&this.spreadProps(c,this.api.getScrubberProps())}};export{s as NumberInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/popover";var i=class extends e{static name=`popover`;initMachine(e){return new t(r.machine,{...e,positioning:{gutter:6,...e.positioning}})}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`trigger`);e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.getElement(`positioner`);t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.getElement(`arrow`);n&&this.spreadProps(n,this.api.getArrowProps());let r=this.getElement(`arrow-tip`);r&&this.spreadProps(r,this.api.getArrowTipProps());let i=this.getElement(`content`);i&&this.spreadProps(i,this.api.getContentProps());let a=this.getElement(`title`);a&&this.spreadProps(a,this.api.getTitleProps());let o=this.getElement(`description`);o&&this.spreadProps(o,this.api.getDescriptionProps());let s=this.getElement(`close-trigger`);s&&this.spreadProps(s,this.api.getCloseTriggerProps());let c=this.getElement(`indicator`);c&&this.spreadProps(c,this.api.getIndicatorProps())}};export{i as Popover};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FieldAwareComponent as e,Machine as t,mergeProps as n,normalizeProps as r}from"./Client-C7pLb8Ab.js";import*as i from"@zag-js/radio-group";var a=class extends e{static name=`radio-group`;propsWithField(e,t){return{...e,disabled:e.disabled??t.ctx.get(`disabled`),readOnly:e.readOnly??t.ctx.get(`readOnly`),required:e.required??t.ctx.get(`required`),invalid:e.invalid??t.ctx.get(`invalid`),name:e.name??t.prop(`name`)}}initMachine(e){return e=this.withFieldProps(e),new t(i.machine,e)}initApi(){return i.connect(this.machine.service,r)}render(){this.subscribeToFieldService();let e=this.getElement(`root`);e&&this.spreadProps(e,n(this.api.getRootProps(),{"aria-invalid":this.fieldMachine?.ctx.get(`invalid`)||void 0,"aria-describedby":this.fieldMachine?.ctx.get(`describeIds`)||void 0}));let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let r=this.getElements(`item`);r.forEach(e=>{this.spreadProps(e,this.api.getItemProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let i=this.getElements(`item-text`);i.forEach(e=>{this.spreadProps(e,this.api.getItemTextProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let a=this.getElements(`item-control`);a.forEach(e=>{this.spreadProps(e,this.api.getItemControlProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let o=this.getElements(`item-hidden-input`);o.forEach(e=>{this.spreadProps(e,this.api.getItemHiddenInputProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let s=this.getElement(`indicator`);s&&this.spreadProps(s,this.api.getIndicatorProps())}};export{a as RadioGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/scroll-area";var i=class extends e{static name=`scroll-area`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`viewport`);t&&this.spreadProps(t,this.api.getViewportProps());let n=this.getElement(`content`);n&&this.spreadProps(n,this.api.getContentProps());let r=this.getElements(`scrollbar`);r.forEach(e=>{this.spreadProps(e,this.api.getScrollbarProps({orientation:e.getAttribute(`data-orientation`)}))});let i=this.getElement(`corner`);i&&this.spreadProps(i,this.api.getCornerProps());let a=this.getElements(`thumb`);a.forEach(e=>{this.spreadProps(e,this.api.getThumbProps({orientation:e.getAttribute(`data-orientation`)}))})}};export{i as ScrollArea};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FieldAwareComponent as e,Machine as t,getListCollectionFromHydrationData as n,mergeProps as r,normalizeProps as i}from"./Client-
|
|
1
|
+
import{FieldAwareComponent as e,Machine as t,getListCollectionFromHydrationData as n,mergeProps as r,normalizeProps as i}from"./Client-C7pLb8Ab.js";import{getControlId as a,getLabelId as o}from"./field.dom-r8J9M7vj.js";import*as s from"@zag-js/select";var c=class extends e{static name=`select`;propsWithField(e,t){return{...e,disabled:e.disabled??t.ctx.get(`disabled`),readOnly:e.readOnly??t.ctx.get(`readOnly`),required:e.required??t.ctx.get(`required`),invalid:e.invalid??t.ctx.get(`invalid`),name:e.name??t.prop(`name`),ids:{...e.ids,label:o(t.scope),hiddenSelect:a(t.scope)}}}transformProps(e){return{...e,get collection(){return n(e.collection)}}}initMachine(e){return e=this.withFieldProps(e),new t(s.machine,this.transformProps(e))}initApi(){return s.connect(this.machine.service,i)}render=()=>{this.subscribeToFieldService();let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`control`);t&&this.spreadProps(t,this.api.getControlProps());let n=this.getElement(`hidden-select`);if(n){let e=r(this.api.getHiddenSelectProps(),{"aria-describedby":this.fieldMachine?.ctx.get(`describeIds`)||void 0});this.spreadProps(n,e)}let i=this.getElement(`label`);i&&this.spreadProps(i,this.api.getLabelProps());let a=this.getElement(`trigger`);a&&this.spreadProps(a,this.api.getTriggerProps());let o=this.getElement(`positioner`);o&&this.spreadProps(o,this.api.getPositionerProps());let s=this.getElement(`content`);s&&this.spreadProps(s,this.api.getContentProps());let c=this.getElement(`value-text`);c&&this.spreadProps(c,r(this.api.getValueTextProps(),{children:this.api.valueAsString||c.dataset.placeholder}));let l=this.getElements(`item-group`);l.forEach(e=>{this.spreadProps(e,this.api.getItemGroupProps({id:e.dataset.id}));let t=this.getElement(`item-group-label`,e);t&&this.spreadProps(t,this.api.getItemGroupLabelProps({htmlFor:e.dataset.id}))});let u=this.getElements(`item`);u.forEach(e=>{let t=this.api.collection.find(e.dataset.value);t&&this.spreadProps(e,this.api.getItemProps({item:t}))});let d=this.getElements(`item-text`);d.forEach(e=>{let t=this.api.collection.find(e.dataset.value);t&&this.spreadProps(e,this.api.getItemTextProps({item:t}))});let f=this.getElements(`item-indicator`);f.forEach(e=>{let t=this.api.collection.find(e.dataset.value);t&&this.spreadProps(e,this.api.getItemIndicatorProps({item:t}))});let p=this.getElement(`clear-trigger`);p&&this.spreadProps(p,this.api.getClearTriggerProps());let m=this.getElement(`indicator`);m&&this.spreadProps(m,this.api.getIndicatorProps())}};export{c as Select};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/tabs";var i=class extends e{static name=`tabs`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render=()=>{let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`list`);t&&this.spreadProps(t,this.api.getListProps());let n=this.getElements(`trigger`);n.forEach(e=>{this.spreadProps(e,this.api.getTriggerProps({value:e.dataset.value,disabled:e.hasAttribute(`data-disabled`)}))});let r=this.getElements(`content`);r.forEach(e=>{this.spreadProps(e,this.api.getContentProps({value:e.dataset.value}))});let i=this.getElement(`indicator`);i&&this.spreadProps(i,this.api.getIndicatorProps())}};export{i as Tabs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-
|
|
1
|
+
import{Component as e,Machine as t,normalizeProps as n}from"./Client-C7pLb8Ab.js";import*as r from"@zag-js/tooltip";var i=class extends e{static name=`tooltip`;initMachine(e){return new t(r.machine,{interactive:!0,...e,positioning:{placement:`top`,gutter:6,...e.positioning}})}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`trigger`);e&&this.spreadProps(e,this.api.getTriggerProps());let t=this.getElement(`positioner`);t&&this.spreadProps(t,this.api.getPositionerProps());let n=this.getElement(`arrow`);n&&this.spreadProps(n,this.api.getArrowProps());let r=this.getElement(`arrow-tip`);r&&this.spreadProps(r,this.api.getArrowTipProps());let i=this.getElement(`content`);i&&this.spreadProps(i,this.api.getContentProps())}};export{i as Tooltip};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types7 from "@zag-js/types";
|
|
3
3
|
import * as accordion from "@zag-js/accordion";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Accordion/Accordion.d.ts
|
|
6
6
|
declare class Accordion extends Component<accordion.Props, accordion.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: accordion.Props): Machine<any>;
|
|
9
|
-
initApi(): accordion.Api<
|
|
9
|
+
initApi(): accordion.Api<_zag_js_types7.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Accordion as t}from"./Accordion-CDhNab8V.js";e(`accordion`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Accordion as e}from"./Accordion-CDhNab8V.js";export{e as Accordion};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types4 from "@zag-js/types";
|
|
3
3
|
import * as checkbox from "@zag-js/checkbox";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Checkbox/Checkbox.d.ts
|
|
@@ -7,7 +7,7 @@ declare class Checkbox extends FieldAwareComponent<checkbox.Props, checkbox.Api>
|
|
|
7
7
|
static name: string;
|
|
8
8
|
propsWithField(props: checkbox.Props, fieldMachine: FieldMachine): checkbox.Props;
|
|
9
9
|
initMachine(props: checkbox.Props): Machine<any>;
|
|
10
|
-
initApi(): checkbox.Api<
|
|
10
|
+
initApi(): checkbox.Api<_zag_js_types4.PropTypes<{
|
|
11
11
|
[x: string]: any;
|
|
12
12
|
}>>;
|
|
13
13
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{Checkbox as t}from"./Checkbox-CpGwRTbn.js";e(`checkbox`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{Checkbox as e}from"./Checkbox-CpGwRTbn.js";export{e as Checkbox};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Component$1 as Component, ComponentHydrationData, ComponentHydrator$1 as ComponentHydrator, ComponentInterface, FieldAwareComponent$1 as FieldAwareComponent, Machine$1 as Machine, getHydrationData$1 as getHydrationData, mergeProps$1 as mergeProps, mount$1 as mount, normalizeProps$1 as normalizeProps, spreadProps$1 as spreadProps, uid$1 as uid } from "./index-
|
|
1
|
+
import { Component$1 as Component, ComponentHydrationData, ComponentHydrator$1 as ComponentHydrator, ComponentInterface, FieldAwareComponent$1 as FieldAwareComponent, Machine$1 as Machine, getHydrationData$1 as getHydrationData, mergeProps$1 as mergeProps, mount$1 as mount, normalizeProps$1 as normalizeProps, spreadProps$1 as spreadProps, uid$1 as uid } from "./index-QGNV9SvR.js";
|
|
2
2
|
export { Component, ComponentHydrationData, ComponentHydrator, ComponentInterface, FieldAwareComponent, Machine, getHydrationData, mergeProps, mount, normalizeProps, spreadProps, uid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Component as e,ComponentHydrator as t,FieldAwareComponent as n,Machine as r,getHydrationData as i,mergeProps as a,mount as o,normalizeProps as s,spreadProps as c,uid as l}from"./Client-
|
|
1
|
+
import{Component as e,ComponentHydrator as t,FieldAwareComponent as n,Machine as r,getHydrationData as i,mergeProps as a,mount as o,normalizeProps as s,spreadProps as c,uid as l}from"./Client-C7pLb8Ab.js";export{e as Component,t as ComponentHydrator,n as FieldAwareComponent,r as Machine,i as getHydrationData,a as mergeProps,o as mount,s as normalizeProps,c as spreadProps,l as uid};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
2
|
import * as _zag_js_types6 from "@zag-js/types";
|
|
3
3
|
import * as clipboard from "@zag-js/clipboard";
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Clipboard as t}from"./Clipboard-3xYQ-5z-.js";e(`clipboard`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Clipboard as e}from"./Clipboard-3xYQ-5z-.js";export{e as Clipboard};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types1 from "@zag-js/types";
|
|
3
3
|
import * as collapsible from "@zag-js/collapsible";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Collapsible/Collapsible.d.ts
|
|
6
6
|
declare class Collapsible extends Component<collapsible.Props, collapsible.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: collapsible.Props): Machine<any>;
|
|
9
|
-
initApi(): collapsible.Api<
|
|
9
|
+
initApi(): collapsible.Api<_zag_js_types1.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Collapsible as t}from"./Collapsible-CRkyzge9.js";e(`collapsible`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Collapsible as e}from"./Collapsible-CRkyzge9.js";export{e as Collapsible};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types5 from "@zag-js/types";
|
|
3
3
|
import * as dialog from "@zag-js/dialog";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Dialog/Dialog.d.ts
|
|
6
6
|
declare class Dialog extends Component<dialog.Props, dialog.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: dialog.Props): Machine<any>;
|
|
9
|
-
initApi(): dialog.Api<
|
|
9
|
+
initApi(): dialog.Api<_zag_js_types5.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Dialog as t}from"./Dialog-B0rH38Du.js";e(`dialog`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Dialog as e}from"./Dialog-B0rH38Du.js";export{e as Dialog};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import { FormMachine } from "./form.registry-
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import { FormMachine } from "./form.registry-Bk1J-OLU.js";
|
|
3
3
|
import { EventObject } from "@zag-js/core";
|
|
4
4
|
import { PropTypes } from "@zag-js/types";
|
|
5
5
|
|
|
@@ -21,6 +21,7 @@ interface FieldSchema {
|
|
|
21
21
|
readOnly: boolean;
|
|
22
22
|
formMachine: FormMachine | null;
|
|
23
23
|
describeIds: string | undefined;
|
|
24
|
+
hasDescription: boolean;
|
|
24
25
|
};
|
|
25
26
|
computed: {
|
|
26
27
|
errors: string[];
|
|
@@ -35,10 +36,14 @@ interface FieldApi {
|
|
|
35
36
|
invalid: boolean;
|
|
36
37
|
errors: string[];
|
|
37
38
|
name: string;
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
required: boolean;
|
|
41
|
+
readOnly: boolean;
|
|
38
42
|
getRootProps(): PropTypes['element'];
|
|
39
43
|
getLabelProps(): PropTypes['label'];
|
|
40
44
|
getControlProps(): PropTypes['element'];
|
|
41
45
|
getErrorProps(): PropTypes['element'];
|
|
46
|
+
getDescriptionProps(): PropTypes['element'];
|
|
42
47
|
getErrorText(): string | null;
|
|
43
48
|
}
|
|
44
49
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=e=>e.ids?.root??`field:${e.id}:root`,t=e=>e.ids?.label??`field:${e.id}:label`,n=e=>e.ids?.control??`field:${e.id}:control`,r=e=>e.ids?.error??`field:${e.id}:error`,i=e=>e.ids?.description??`field:${e.id}:description`,a=t=>t.getById(e(t)),o=e=>e.getById(i(e));export{n as getControlId,o as getDescriptionEl,i as getDescriptionId,r as getErrorId,t as getLabelId,a as getRootEl,e as getRootId};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import"./form.registry-ABqE-vzj.js";import{Field as t}from"./Field-BwzB3Eom.js";e(`field`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import"./form.registry-ABqE-vzj.js";import{Field as e}from"./Field-BwzB3Eom.js";export{e as Field};
|
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import { FieldMachine$1 as FieldMachine } from "./form.registry-
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import { FieldMachine$1 as FieldMachine } from "./form.registry-Bk1J-OLU.js";
|
|
3
3
|
import { EventObject } from "@zag-js/core";
|
|
4
4
|
import { JSX, PropTypes } from "@zag-js/types";
|
|
5
|
-
import * as
|
|
5
|
+
import * as z from "zod";
|
|
6
6
|
|
|
7
7
|
//#region Resources/Private/Primitives/Form/src/form.types.d.ts
|
|
8
|
-
|
|
8
|
+
interface FieldError {
|
|
9
|
+
messages: string[];
|
|
10
|
+
value?: FormDataEntryValue | FormDataEntryValue[] | null;
|
|
11
|
+
}
|
|
12
|
+
type FormErrors = Record<string, FieldError>;
|
|
9
13
|
type FormDirty = Record<string, boolean>;
|
|
10
|
-
type
|
|
14
|
+
type FormTouched = Record<string, boolean>;
|
|
15
|
+
/**
|
|
16
|
+
* Error thrown by post() when server returns 422 validation errors.
|
|
17
|
+
* The machine catches this and transitions to 'invalid' state.
|
|
18
|
+
*/
|
|
19
|
+
declare class ValidationError extends Error {
|
|
20
|
+
errors: FormErrors;
|
|
21
|
+
constructor(errors: FormErrors);
|
|
22
|
+
}
|
|
23
|
+
type ZodFormSchema = z.ZodObject | undefined;
|
|
11
24
|
interface FormProps {
|
|
12
25
|
id: string;
|
|
13
|
-
schema?:
|
|
14
|
-
reactiveFields?: string[];
|
|
26
|
+
schema?: ZodFormSchema;
|
|
15
27
|
objectName?: string;
|
|
28
|
+
inputDebounceMs?: number;
|
|
16
29
|
onSubmit?: ({
|
|
17
30
|
formData,
|
|
18
31
|
api,
|
|
@@ -33,6 +46,7 @@ interface FormSchema {
|
|
|
33
46
|
initialValues: FormData;
|
|
34
47
|
errors: FormErrors;
|
|
35
48
|
dirty: FormDirty;
|
|
49
|
+
touched: FormTouched;
|
|
36
50
|
};
|
|
37
51
|
state: 'invalid' | 'ready' | 'submitting' | 'success' | 'error';
|
|
38
52
|
event: EventObject;
|
|
@@ -49,10 +63,13 @@ interface FormApi {
|
|
|
49
63
|
getValues(): FormData;
|
|
50
64
|
getErrors(): FormErrors;
|
|
51
65
|
getDirty(): FormDirty;
|
|
52
|
-
|
|
53
|
-
|
|
66
|
+
getTouched(): FormTouched;
|
|
67
|
+
_userRenderFn: FormProps['render'];
|
|
68
|
+
getAllFields(): Map<string, FieldMachine>;
|
|
69
|
+
getField(name: string): FieldMachine | undefined;
|
|
54
70
|
getFormEl(): HTMLFormElement | null;
|
|
55
71
|
getAction(): string;
|
|
72
|
+
reset(): void;
|
|
56
73
|
}
|
|
57
74
|
//#endregion
|
|
58
75
|
//#region Resources/Private/Primitives/Form/Form.d.ts
|
|
@@ -63,4 +80,4 @@ declare class Form extends Component<FormProps, FormApi> {
|
|
|
63
80
|
render(): void;
|
|
64
81
|
}
|
|
65
82
|
//#endregion
|
|
66
|
-
export { Form };
|
|
83
|
+
export { Form, ValidationError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import"./form.registry-ABqE-vzj.js";import{Form as t}from"./Form-DBNNU5PD.js";e(`form`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import"./form.registry-ABqE-vzj.js";import{Form as e,ValidationError as t}from"./Form-DBNNU5PD.js";export{e as Form,t as ValidationError};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ListCollection } from "@zag-js/collection";
|
|
2
2
|
import { Bindable, BindableContext, BindableRefs, ComputedFn, Machine, MachineSchema, Params, PropFn, Scope, Service } from "@zag-js/core";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _zag_js_types10 from "@zag-js/types";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Client/src/types.d.ts
|
|
6
6
|
declare global {
|
|
@@ -77,9 +77,9 @@ type FieldMachine = Machine$1<any>;
|
|
|
77
77
|
declare abstract class FieldAwareComponent<Props, Api> extends Component<Props, Api> {
|
|
78
78
|
protected subscribedToField: boolean;
|
|
79
79
|
protected fieldMachine: FieldMachine | undefined;
|
|
80
|
-
protected closestField:
|
|
80
|
+
protected closestField: HTMLElement | null;
|
|
81
81
|
protected abstract propsWithField(props: Partial<Props>, fieldMachine: FieldMachine): Props;
|
|
82
|
-
protected getClosestField():
|
|
82
|
+
protected getClosestField(): HTMLElement;
|
|
83
83
|
protected withFieldProps(props: Props): Props;
|
|
84
84
|
subscribeToFieldService(): void;
|
|
85
85
|
}
|
|
@@ -151,7 +151,7 @@ declare class Machine$1<T extends MachineSchema> {
|
|
|
151
151
|
declare function mergeProps$1(...args: Record<string | symbol, any>[]): Record<string | symbol, any>;
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region Resources/Private/Client/src/lib/normalize-props.d.ts
|
|
154
|
-
declare const normalizeProps:
|
|
154
|
+
declare const normalizeProps: _zag_js_types10.NormalizeProps<_zag_js_types10.PropTypes<{
|
|
155
155
|
[x: string]: any;
|
|
156
156
|
}>>;
|
|
157
157
|
//#endregion
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types8 from "@zag-js/types";
|
|
3
|
+
import * as numberInput from "@zag-js/number-input";
|
|
4
|
+
|
|
5
|
+
//#region Resources/Private/Primitives/NumberInput/NumberInput.d.ts
|
|
6
|
+
declare class NumberInput extends FieldAwareComponent<numberInput.Props, numberInput.Api> {
|
|
7
|
+
static name: string;
|
|
8
|
+
propsWithField(props: numberInput.Props, fieldMachine: FieldMachine): numberInput.Props;
|
|
9
|
+
initMachine(props: numberInput.Props): Machine<any>;
|
|
10
|
+
initApi(): numberInput.Api<_zag_js_types8.PropTypes<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
}>>;
|
|
13
|
+
render(): void;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { NumberInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{NumberInput as t}from"./NumberInput-CApZObd4.js";e(`number-input`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{NumberInput as e}from"./NumberInput-CApZObd4.js";export{e as NumberInput};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types0 from "@zag-js/types";
|
|
3
3
|
import * as popover from "@zag-js/popover";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Popover/Popover.d.ts
|
|
6
6
|
declare class Popover extends Component<popover.Props, popover.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: popover.Props): Machine<any>;
|
|
9
|
-
initApi(): popover.Api<
|
|
9
|
+
initApi(): popover.Api<_zag_js_types0.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Popover as t}from"./Popover-uUcHrP8Z.js";e(`popover`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Popover as e}from"./Popover-uUcHrP8Z.js";export{e as Popover};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as
|
|
1
|
+
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types9 from "@zag-js/types";
|
|
3
3
|
import * as radioGroup from "@zag-js/radio-group";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/RadioGroup/RadioGroup.d.ts
|
|
6
|
-
declare class RadioGroup extends
|
|
6
|
+
declare class RadioGroup extends FieldAwareComponent<radioGroup.Props, radioGroup.Api> {
|
|
7
7
|
static name: string;
|
|
8
|
+
propsWithField(props: radioGroup.Props, fieldMachine: FieldMachine): radioGroup.Props;
|
|
8
9
|
initMachine(props: radioGroup.Props): Machine<any>;
|
|
9
|
-
initApi(): radioGroup.Api<
|
|
10
|
+
initApi(): radioGroup.Api<_zag_js_types9.PropTypes<{
|
|
10
11
|
[x: string]: any;
|
|
11
12
|
}>>;
|
|
12
13
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{RadioGroup as t}from"./RadioGroup-RoniWWCD.js";e(`radio-group`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{RadioGroup as e}from"./RadioGroup-RoniWWCD.js";export{e as RadioGroup};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
2
|
import { PropTypes } from "@zag-js/types";
|
|
3
3
|
import * as scrollArea from "@zag-js/scroll-area";
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{ScrollArea as t}from"./ScrollArea-XpAVw840.js";e(`scroll-area`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{ScrollArea as e}from"./ScrollArea-XpAVw840.js";export{e as ScrollArea};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-
|
|
1
|
+
import { FieldAwareComponent$1 as FieldAwareComponent, FieldMachine, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
2
|
import * as _zag_js_collection0 from "@zag-js/collection";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _zag_js_types0 from "@zag-js/types";
|
|
4
4
|
import * as select from "@zag-js/select";
|
|
5
5
|
|
|
6
6
|
//#region Resources/Private/Primitives/Select/Select.d.ts
|
|
@@ -53,7 +53,7 @@ declare class Select extends FieldAwareComponent<select.Props, select.Api> {
|
|
|
53
53
|
onInteractOutside?: ((event: select.InteractOutsideEvent) => void) | undefined;
|
|
54
54
|
};
|
|
55
55
|
initMachine(props: select.Props): Machine<any>;
|
|
56
|
-
initApi(): select.Api<
|
|
56
|
+
initApi(): select.Api<_zag_js_types0.PropTypes<{
|
|
57
57
|
[x: string]: any;
|
|
58
58
|
}>, any>;
|
|
59
59
|
render: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{Select as t}from"./Select-DvsJPyz5.js";e(`select`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import"./field.dom-r8J9M7vj.js";import{Select as e}from"./Select-DvsJPyz5.js";export{e as Select};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types2 from "@zag-js/types";
|
|
3
3
|
import * as tabs from "@zag-js/tabs";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Tabs/Tabs.d.ts
|
|
6
6
|
declare class Tabs extends Component<tabs.Props, tabs.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: tabs.Props): Machine<any>;
|
|
9
|
-
initApi(): tabs.Api<
|
|
9
|
+
initApi(): tabs.Api<_zag_js_types2.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Tabs as t}from"./Tabs-BCk2WAmg.js";e(`tabs`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Tabs as e}from"./Tabs-BCk2WAmg.js";export{e as Tabs};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Component$1 as Component, Machine$1 as Machine } from "./index-
|
|
2
|
-
import * as
|
|
1
|
+
import { Component$1 as Component, Machine$1 as Machine } from "./index-QGNV9SvR.js";
|
|
2
|
+
import * as _zag_js_types3 from "@zag-js/types";
|
|
3
3
|
import * as tooltip from "@zag-js/tooltip";
|
|
4
4
|
|
|
5
5
|
//#region Resources/Private/Primitives/Tooltip/Tooltip.d.ts
|
|
6
6
|
declare class Tooltip extends Component<tooltip.Props, tooltip.Api> {
|
|
7
7
|
static name: string;
|
|
8
8
|
initMachine(props: tooltip.Props): Machine<any>;
|
|
9
|
-
initApi(): tooltip.Api<
|
|
9
|
+
initApi(): tooltip.Api<_zag_js_types3.PropTypes<{
|
|
10
10
|
[x: string]: any;
|
|
11
11
|
}>>;
|
|
12
12
|
render(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{mount as e}from"./Client-
|
|
1
|
+
import{mount as e}from"./Client-C7pLb8Ab.js";import{Tooltip as t}from"./Tooltip-C7vqPe3n.js";e(`tooltip`,({props:e})=>{let n=new t(e);return n.init(),n});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./Client-
|
|
1
|
+
import"./Client-C7pLb8Ab.js";import{Tooltip as e}from"./Tooltip-C7vqPe3n.js";export{e as Tooltip};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluid-primitives",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Client-side library for Fluid Primitives.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,26 +82,28 @@
|
|
|
82
82
|
"@types/node": "^22.15.17",
|
|
83
83
|
"tsdown": "^0.11.9",
|
|
84
84
|
"typescript": "^5.8.3",
|
|
85
|
-
"valibot": "^1.1.0"
|
|
85
|
+
"valibot": "^1.1.0",
|
|
86
|
+
"zod": "^4.3.6"
|
|
86
87
|
},
|
|
87
88
|
"dependencies": {
|
|
88
|
-
"@zag-js/accordion": "^1.
|
|
89
|
-
"@zag-js/anatomy": "^1.
|
|
90
|
-
"@zag-js/checkbox": "^1.
|
|
91
|
-
"@zag-js/clipboard": "^1.
|
|
92
|
-
"@zag-js/collapsible": "^1.
|
|
93
|
-
"@zag-js/collection": "^1.
|
|
94
|
-
"@zag-js/core": "^1.
|
|
95
|
-
"@zag-js/dialog": "^1.
|
|
96
|
-
"@zag-js/dom-query": "^1.
|
|
97
|
-
"@zag-js/
|
|
98
|
-
"@zag-js/
|
|
99
|
-
"@zag-js/
|
|
100
|
-
"@zag-js/
|
|
101
|
-
"@zag-js/
|
|
102
|
-
"@zag-js/
|
|
103
|
-
"@zag-js/
|
|
104
|
-
"@zag-js/
|
|
105
|
-
"@zag-js/
|
|
89
|
+
"@zag-js/accordion": "^1.32.0",
|
|
90
|
+
"@zag-js/anatomy": "^1.32.0",
|
|
91
|
+
"@zag-js/checkbox": "^1.32.0",
|
|
92
|
+
"@zag-js/clipboard": "^1.32.0",
|
|
93
|
+
"@zag-js/collapsible": "^1.32.0",
|
|
94
|
+
"@zag-js/collection": "^1.32.0",
|
|
95
|
+
"@zag-js/core": "^1.32.0",
|
|
96
|
+
"@zag-js/dialog": "^1.32.0",
|
|
97
|
+
"@zag-js/dom-query": "^1.32.0",
|
|
98
|
+
"@zag-js/number-input": "^1.32.0",
|
|
99
|
+
"@zag-js/popover": "^1.32.0",
|
|
100
|
+
"@zag-js/radio-group": "^1.32.0",
|
|
101
|
+
"@zag-js/scroll-area": "^1.32.0",
|
|
102
|
+
"@zag-js/select": "^1.32.0",
|
|
103
|
+
"@zag-js/store": "^1.32.0",
|
|
104
|
+
"@zag-js/tabs": "^1.32.0",
|
|
105
|
+
"@zag-js/tooltip": "^1.32.0",
|
|
106
|
+
"@zag-js/types": "^1.32.0",
|
|
107
|
+
"@zag-js/utils": "^1.32.0"
|
|
106
108
|
}
|
|
107
109
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-B1xGmpZs.js";import*as r from"@zag-js/accordion";var i=class extends e{static name=`accordion`;initMachine(e){return new t(r.machine,{collapsible:!0,...e})}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElements(`item`);t.forEach(e=>{this.spreadProps(e,this.api.getItemProps({value:e.getAttribute(`data-value`),disabled:e.getAttribute(`data-disabled`)===`true`}))});let n=this.getElements(`item-trigger`);n.forEach(e=>{this.spreadProps(e,this.api.getItemTriggerProps({value:e.getAttribute(`data-value`),disabled:e.getAttribute(`data-disabled`)===`true`}))});let r=this.getElements(`item-content`);r.forEach(e=>{this.spreadProps(e,this.api.getItemContentProps({value:e.getAttribute(`data-value`),disabled:e.getAttribute(`data-disabled`)===`true`}))});let i=this.getElements(`item-indicator`);i.forEach(e=>{this.spreadProps(e,this.api.getItemIndicatorProps({value:e.getAttribute(`data-value`),disabled:e.getAttribute(`data-disabled`)===`true`}))}),this.getElements(`item-header`)}};export{i as Accordion};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ListCollection as e}from"@zag-js/collection";import{INIT_STATE as t,MachineStatus as n,createScope as r,mergeProps as i}from"@zag-js/core";import{proxy as a,subscribe as o}from"@zag-js/store";import{compact as s,identity as c,isEqual as l,isFunction as u,isString as d,runIfFn as f,toArray as p,uuid as m,warn as h}from"@zag-js/utils";import{createNormalizer as g}from"@zag-js/types";var _=class{document;machine;api;hydrator=null;userProps;static name;get doc(){return this.document}constructor(e,t=document){this.document=t,this.userProps=this.transformProps(e),this.hydrator=this.initHydrator(e),this.machine=this.initMachine(e),this.api=this.initApi()}initHydrator(e){let t=e.id;if(!t)throw Error(`ComponentHydrator requires an id prop to initialize.`);return new E(this.getName(),t,e.ids,this.doc)}init(){this.render(),this.machine.subscribe(()=>{this.api=this.initApi(),this.render()}),this.machine.start()}getName(){return this.constructor.name}transformProps(e){return e}updateProps(e){let t={...this.userProps,...e};this.userProps=this.transformProps(t),this.machine.updateProps(t)}destroy=()=>{this.machine.stop(),this.hydrator?.destroy()};spreadProps(e,t){H(e,t,this.machine.scope.id)}getElement(e,t){return this.hydrator?.getElement(e,t)||null}getElements(e,t){return this.hydrator?.getElements(e,t)||[]}portalElement(e,t=this.doc.body){e&&e.parentNode!==t&&(t.appendChild(e),e.setAttribute(`data-portalled`,`true`))}};const v=new WeakMap;function y(e,t){e&&(v.set(e,t),e.dispatchEvent(new CustomEvent(`fluid-primitives:field:registered`,{bubbles:!0})))}function b(e){if(e)return v.get(e)}const x=[`invalid`,`disabled`,`readOnly`,`required`],S={disabled:e=>e.context.get(`disabled`),readOnly:e=>e.context.get(`readOnly`),required:e=>e.context.get(`required`),invalid:e=>e.context.get(`invalid`)};var C=class extends _{subscribedToField=!1;fieldMachine;closestField=null;getClosestField(){return this.closestField||this.getElement(`root`)?.closest(`[data-scope="field"][data-part="root"]`)||null}withFieldProps(e){if(this.closestField=this.getClosestField(),!this.closestField)return e;if(this.fieldMachine=b(this.closestField),this.fieldMachine)return this.propsWithField(e,this.fieldMachine);{let e=()=>{this.fieldMachine=b(this.closestField),this.updateProps(this.propsWithField(this.userProps,this.fieldMachine)),this.closestField?.removeEventListener(`fluid-primitives:field:registered`,e)};this.closestField.addEventListener(`fluid-primitives:field:registered`,e)}return e}subscribeToFieldService(){if(!this.subscribedToField&&(this.closestField=this.getClosestField(),this.closestField))if(this.fieldMachine)this.fieldMachine.subscribe(e=>{queueMicrotask(()=>{let t={};for(let n of x){let r=!!S[n](e),i=!!this.machine.prop(n);r!==i&&(t[n]=r)}Object.keys(t).length>0?this.updateProps(t):(this.api=this.initApi(),this.render())})}),this.subscribedToField=!0;else{let e=()=>{this.subscribeToFieldService(),this.closestField.removeEventListener(`fluid-primitives:field:registered`,e)};this.closestField.addEventListener(`fluid-primitives:field:registered`,e)}}};function w(e,t){let n=window.FluidPrimitives.hydrationData;return!n||typeof n!=`object`?null:e?n[e]?t?n[e][t]||null:n[e]:null:n}function T(e,t){let n=w(e);n&&Object.keys(n).forEach(r=>{if(n[r].controlled)return;let i=t({...n[r],createHydrator:()=>new E(e,r,n[r].props.ids)});i&&(window.FluidPrimitives.uncontrolledInstances[e]||(window.FluidPrimitives.uncontrolledInstances[e]={}),window.FluidPrimitives.uncontrolledInstances[e][r]=i)})}var E=class{componentName;doc;rootId;ids;elementRefs=new Map;constructor(e,t,n={},r=document){if(this.componentName=e,this.doc=r,!t)throw Error(`Root ID is required for component hydration: ${e}`);this.rootId=t,this.ids=n}getElement(e,t=this.doc){if(this.elementRefs.has(e))return this.elementRefs.get(e)||null;let n=null;return n=this.ids[e]?t.querySelector(`#${this.ids[e]}`):t.querySelector(`[data-hydrate-${this.componentName}="${this.rootId}"][data-part="${e}"][data-scope="${this.componentName}"]`),n&&(t===this.doc&&this.elementRefs.set(e,n),n.removeAttribute(`data-hydrate-${this.componentName}`),n.__rootId=this.rootId),n}getElements(e,t=this.doc){if(this.elementRefs.has(e))return this.elementRefs.get(e);let n=[];return n=this.ids[e]?Array.from(t.querySelectorAll(`#${this.ids[e]}`)):Array.from(t.querySelectorAll(`[data-hydrate-${this.componentName}="${this.rootId}"][data-part="${e}"][data-scope="${this.componentName}"]`)),t===this.doc&&this.elementRefs.set(e,n),n.forEach(e=>e.removeAttribute(`data-hydrate-${this.componentName}`)),n}generateRefAttributesString(e){let t=this.ids[e]||`${this.rootId}-${e}`;return`data-scope="${this.componentName}" data-part="${e}" data-hydrate-${this.componentName}="${t}"`}setRefAttributes(e,t){let n=this.generateRefAttributesString(t),r=n.split(` `).map(e=>e.trim());r.forEach(t=>{let[n,r]=t.split(`=`);e.setAttribute(n,r.replace(/"/g,``))})}destroy(){this.elementRefs.forEach(e=>{e instanceof Element?e.setAttribute(`data-hydrate-${this.componentName}`,this.rootId):e.forEach(e=>e.setAttribute(`data-hydrate-${this.componentName}`,this.rootId))}),this.elementRefs.clear()}};function D(t){if(t instanceof e)return t;let n=new e({items:t.items,itemToValue:t.itemToValueKey?e=>e?.[t.itemToValueKey]:void 0,itemToString:t.itemToStringKey?e=>e?.[t.itemToStringKey]:void 0,isItemDisabled:t.isItemDisabledKey?e=>e?.[t.isItemDisabledKey]:void 0,groupBy:t.groupByKey?e=>{let n=t.groupByKey;if(n)return n.includes(`.`)?n.split(`.`).reduce((e,t)=>e?e[t]:void 0,e):e?.[n]}:void 0});return n}function O(e){let t=e().value??e().defaultValue;e().debug&&console.log(`[bindable > ${e().debug}] initial`,t);let n=e().isEqual??Object.is,r=a({value:t}),i=()=>e().value!==void 0;return{initial:t,ref:r,get(){return i()?e().value:r.value},set(t){let a=r.value,o=u(t)?t(a):t;e().debug&&console.log(`[bindable > ${e().debug}] setValue`,{next:o,prev:a}),i()||(r.value=o),n(o,a)||e().onChange?.(o,a)},invoke(t,n){e().onChange?.(t,n)},hash(t){return e().hash?.(t)??String(t)}}}O.cleanup=e=>{},O.ref=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}};function k(e){let t={current:e};return{get(e){return t.current[e]},set(e,n){t.current[e]=n}}}var A=class{scope;ctx;prop;state;refs;computed;event={type:``};previousEvent;effects=new Map;transition=null;cleanups=[];subscriptions=[];userPropsRef;getEvent=()=>({...this.event,current:()=>this.event,previous:()=>this.previousEvent});getState=()=>({...this.state,matches:(...e)=>e.includes(this.state.get()),hasTag:e=>!!this.machine.states[this.state.get()]?.tags?.includes(e)});debug=(...e)=>{this.machine.debug&&console.log(...e)};notify=()=>{this.publish()};constructor(e,n={}){this.machine=e,this.userPropsRef={current:n};let{id:i,ids:a,getRootNode:c}=f(n);this.scope=r({id:i,ids:a,getRootNode:c});let l=t=>{let n=f(this.userPropsRef.current),r=e.props?.({props:s(n),scope:this.scope})??n;return r[t]};this.prop=l;let u=e.context?.({prop:l,bindable:O,scope:this.scope,flush(e){queueMicrotask(e)},getContext(){return d},getComputed(){return p},getRefs(){return m},getEvent:this.getEvent.bind(this)});u&&Object.values(u).forEach(e=>{let t=o(e.ref,()=>this.notify());this.cleanups.push(t)});let d={get(e){return u?.[e].get()},set(e,t){u?.[e].set(t)},initial(e){return u?.[e].initial},hash(e){let t=u?.[e].get();return u?.[e].hash(t)}};this.ctx=d;let p=t=>e.computed?.[t]({context:d,event:this.getEvent(),prop:l,refs:this.refs,scope:this.scope,computed:p})??{};this.computed=p;let m=k(e.refs?.({prop:l,context:d})??{});this.refs=m;let h=O(()=>({defaultValue:e.initialState({prop:l}),onChange:(n,r)=>{if(r){let e=this.effects.get(r);e?.(),this.effects.delete(r)}r&&this.action(e.states[r]?.exit),this.action(this.transition?.actions);let i=this.effect(e.states[n]?.effects);if(i&&this.effects.set(n,i),r===t){this.action(e.entry);let n=this.effect(e.effects);n&&this.effects.set(t,n)}this.action(e.states[n]?.entry)}}));this.state=h,this.cleanups.push(o(this.state.ref,()=>this.notify()))}updateProps(e){this.userPropsRef.current=e,this.notify()}send=e=>{this.status===n.Started&&queueMicrotask(()=>{this.previousEvent=this.event,this.event=e,this.debug(`send`,e);let t=this.state.get(),n=this.machine.states[t].on?.[e.type]??this.machine.on?.[e.type],r=this.choose(n);if(!r)return;this.transition=r;let i=r.target??t;this.debug(`transition`,r);let a=i!==t;a?this.state.set(i):this.action(r.actions)})};action=e=>{let t=u(e)?e(this.getParams()):e;if(!t)return;let n=t.map(e=>{let t=this.machine.implementations?.actions?.[e];return t||h(`[zag-js] No implementation found for action "${JSON.stringify(e)}"`),t});for(let e of n)e?.(this.getParams())};guard=e=>u(e)?e(this.getParams()):this.machine.implementations?.guards?.[e](this.getParams());effect=e=>{let t=u(e)?e(this.getParams()):e;if(!t)return;let n=t.map(e=>{let t=this.machine.implementations?.effects?.[e];return t||h(`[zag-js] No implementation found for effect "${JSON.stringify(e)}"`),t}),r=[];for(let e of n){let t=e?.(this.getParams());t&&r.push(t)}return()=>r.forEach(e=>e?.())};choose=e=>p(e).find(e=>{let t=!e.guard;return d(e.guard)?t=!!this.guard(e.guard):u(e.guard)&&(t=e.guard(this.getParams())),t});start(){this.status=n.Started,this.debug(`initializing...`),this.state.invoke(this.state.initial,t),this.setupTrackers()}stop(){this.effects.forEach(e=>e?.()),this.effects.clear(),this.transition=null,this.action(this.machine.exit),this.cleanups.forEach(e=>e()),this.cleanups=[],this.status=n.Stopped,this.debug(`unmounting...`)}subscribe=e=>{this.subscriptions.push(e)};status=n.NotStarted;get service(){return{state:this.getState(),send:this.send,context:this.ctx,prop:this.prop,scope:this.scope,refs:this.refs,computed:this.computed,event:this.getEvent(),getStatus:()=>this.status}}publish=()=>{this.callTrackers(),this.subscriptions.forEach(e=>e(this.service))};trackers=[];setupTrackers=()=>{this.machine.watch?.(this.getParams())};callTrackers=()=>{this.trackers.forEach(({deps:e,fn:t})=>{let n=e.map(e=>e());l(t.prev,n)||(t(),t.prev=n)})};getParams=()=>({state:this.getState(),context:this.ctx,event:this.getEvent(),prop:this.prop,send:this.send,action:this.action,guard:this.guard,track:(e,t)=>{t.prev=e.map(e=>e()),this.trackers.push({deps:e,fn:t})},refs:this.refs,computed:this.computed,flush:c,scope:this.scope,choose:this.choose})};const j={onFocus:`onFocusin`,onBlur:`onFocusout`,onChange:`onInput`,onDoubleClick:`onDblclick`,htmlFor:`for`,className:`class`,defaultValue:`value`,defaultChecked:`checked`,onChange_:`onChange`},M=new Set([`viewBox`,`preserveAspectRatio`]),N=e=>{let t=``;for(let n in e){let r=e[n];if(r==null)continue;n.startsWith(`--`)||(n=n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)),t+=`${n}:${r};`}return t},P=g(e=>Object.entries(e).reduce((e,[t,n])=>{if(n===void 0)return e;if(t in j&&(t=j[t]),t===`style`&&typeof n==`object`)return e.style=N(n),e;let r=M.has(t)?t:t.toLowerCase();return e[r]=n,e},{}));function F(...e){let t=i(...e);return`style`in t&&(t.style=N(t.style)),t}function I(e=`f`){return`«`+e+m()+`»`}const L=new Map,R=new Set([`value`,`checked`,`htmlFor`]),z=new Set([`viewBox`,`preserveAspectRatio`]),B=e=>e.tagName===`svg`||e.namespaceURI===`http://www.w3.org/2000/svg`,V=(e,t)=>{let n=B(e)&&z.has(t);return n?t:t.toLowerCase()};function H(e,t,n){e.__spreadId||=`spread_${I()}`;let r=``;r=n?`${e.__spreadId}_${n}`:`${e.__spreadId}`;let i=L.get(r)||{},a=Object.keys(t),o=(t,n)=>{e.addEventListener(t.toLowerCase(),n)},s=(t,n)=>{e.removeEventListener(t.toLowerCase(),n)},c=e=>e.startsWith(`on`),l=e=>!e.startsWith(`on`),u=e=>o(e.substring(2),t[e]),d=e=>s(e.substring(2),t[e]),f=n=>{let r=t[n],a=i[n];if(r!==a){if(n===`children`){e.textContent=r;return}if(typeof r==`boolean`&&(n.includes(`aria-`)||(r||=void 0)),r!=null){R.has(n)?e[n]=r:e.setAttribute(V(e,n),r);return}e.removeAttribute(V(e,n))}};for(let n in i)t[n]??e.removeAttribute(V(e,n));let p=Object.keys(i).filter(c);return p.forEach(e=>{s(e.substring(2),i[e])}),a.filter(c).forEach(u),a.filter(l).forEach(f),L.set(r,t),function(){a.filter(c).forEach(d)}}export{_ as Component,E as ComponentHydrator,C as FieldAwareComponent,A as Machine,w as getHydrationData,D as getListCollectionFromHydrationData,F as mergeProps,T as mount,P as normalizeProps,y as registerFieldMachine,H as spreadProps,I as uid};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-B1xGmpZs.js";import*as r from"@zag-js/collapsible";var i=class extends e{static name=`collapsible`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`trigger`);t&&this.spreadProps(t,this.api.getTriggerProps());let n=this.getElement(`trigger-text`);n&&n.dataset.openText&&n.dataset.closeText&&(n.textContent=this.api.open?n.dataset.closeText:n.dataset.openText);let r=this.getElement(`content`);r&&this.spreadProps(r,this.api.getContentProps())}};export{i as Collapsible};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n,registerFieldMachine as r}from"./Client-B1xGmpZs.js";import{getControlId as i,getErrorId as a,getLabelId as o,getRootEl as s,getRootId as c}from"./field.dom-BPeGctuk.js";import{getFormMachineFor as l,registerFieldMachineForForm as u}from"./form.registry-ABqE-vzj.js";import{createMachine as d}from"@zag-js/core";import{createAnatomy as f}from"@zag-js/anatomy";const p=f(`field`).parts(`root`,`label`,`control`,`error`),m=p.build();function h(e,t){let{scope:n,prop:r,context:s,computed:l}=e,u=s.get(`invalid`),d=l(`errors`);return{getFormMachine:()=>s.get(`formMachine`),invalid:u,errors:d,name:r(`name`),getErrorText(){return d.length?d[0]:null},getRootProps(){return t.element({...m.root.attrs,id:c(n),"data-invalid":u?``:void 0,"data-name":r(`name`)})},getLabelProps(){return t.label({...m.label.attrs,id:o(n),htmlFor:i(n)})},getControlProps(){return t.element({...m.control.attrs,id:i(n),name:r(`name`),"aria-invalid":u?`true`:`false`,"aria-describedby":s.get(`describeIds`),"data-invalid":u?``:void 0})},getErrorProps(){return t.element({...m.error.attrs,id:a(n),hidden:!u})}}}const g=d({initialState(){return`ready`},context({bindable:e,prop:t}){return{invalid:e(()=>({defaultValue:t(`invalid`)??!1})),required:e(()=>({defaultValue:t(`required`)??!1})),disabled:e(()=>({defaultValue:t(`disabled`)??!1})),readOnly:e(()=>({defaultValue:t(`readOnly`)??!1})),formMachine:e(()=>({defaultValue:null,hash:e=>JSON.stringify({state:e?.state,errors:e?.ctx.get(`errors`)})})),describeIds:e(()=>({defaultValue:void 0}))}},entry:[`getFormMachine`,`determineDescribeIds`,`updateInvalid`],states:{ready:{}},computed:{errors({context:e,prop:t}){let n=e.get(`formMachine`)?.ctx;if(!n)return[];let r=n.get(`errors`)?.[t(`name`)]??[];return r}},watch({track:e,context:t,computed:n,action:r}){e([()=>t.hash(`formMachine`),()=>n(`errors`).join(`|`)],()=>{r([`updateInvalid`])}),e([()=>t.get(`invalid`)],()=>{r([`determineDescribeIds`])})},implementations:{actions:{getFormMachine({context:e,scope:t}){if(e.get(`formMachine`))return;let n=s(t);if(!n)return;let r=l(n)??null;if(r)e.set(`formMachine`,r);else{let t=n.closest(`form`);if(!t)return;let r=()=>{let i=l(n)??null;e.set(`formMachine`,i),t.removeEventListener(`fluid-primitives:form:registered`,r)};t.addEventListener(`fluid-primitives:form:registered`,r)}},determineDescribeIds({context:e,scope:t}){let n=[];e.get(`invalid`)&&n.push(a(t));let r=n.join(` `)||void 0;e.set(`describeIds`,r)},updateInvalid({context:e,prop:t}){let n=e.get(`formMachine`)?.ctx;if(!n){e.set(`invalid`,t(`invalid`)??!1);return}let r=n.get(`errors`)?.[t(`name`)]??[];e.set(`invalid`,r.length>0)}}}});var _=class extends e{static name=`field`;subscribedToForm=!1;initMachine(e){let n=new t(g,e);return r(this.getElement(`root`),n),u(this.getElement(`root`),n),n}initApi(){return h(this.machine.service,n)}subscribeToFormMachine(){if(this.subscribedToForm)return;let e=this.api.getFormMachine();e&&(this.subscribedToForm=!0,e.subscribe(()=>{this.machine.notify()}))}render(){this.subscribeToFormMachine();let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let n=this.getElement(`control`);n&&this.spreadProps(n,this.api.getControlProps());let r=this.getElement(`error`);if(r){this.spreadProps(r,this.api.getErrorProps());let e=this.api.getErrorText();r.textContent!==void 0&&(r.textContent=e??``)}}};export{_ as Field};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-B1xGmpZs.js";import{getFieldMachinesFor as r,registerFormMachine as i}from"./form.registry-ABqE-vzj.js";import{createMachine as a}from"@zag-js/core";import{createAnatomy as o}from"@zag-js/anatomy";import{dataAttr as s}from"@zag-js/dom-query";const c=o(`form`).parts(`form`),l=c.build(),u=e=>e.ids?.form??`form:${e.id}:form`,d=e=>e.getById(u(e));function f(e,t){let{context:n,state:i,send:a,scope:o,prop:c}=e;function f(){return n.get(`values`)}function p(){return n.get(`errors`)}function m(){return n.get(`dirty`)}function h(){return d(o)}let g=i.matches(`submitting`),_=Object.values(m()).some(e=>e),v=Object.values(p()).some(e=>e),y=i.matches(`success`),b=i.matches(`error`),x=i.get();return{isSubmitting:g,isDirty:_,isInvalid:v,isSuccessful:y,isError:b,getValues:f,getErrors:p,getDirty:m,userRenderFn:c(`render`),getFormEl:h,getFields(){return r(d(o))},getAction(){let e=h();return e.getAttribute(`action`)||``},getFormProps(){return t.element({...l.form.attrs,noValidate:s(!0),id:u(o),"data-state":x,onSubmit:async e=>{e.preventDefault();let t=e.currentTarget;n.set(`values`,new FormData(t)),a({type:`SUBMIT`,detail:{event:e,api:this}})},onReset:e=>{let t=e.currentTarget;queueMicrotask(()=>{let e=new FormData(t);n.set(`initialValues`,e),n.set(`values`,e),n.set(`errors`,{});let r={};for(let t of Object.keys(e))r[t]=!1;n.set(`dirty`,r)}),a({type:`RESET`})},onInput:e=>{a({type:`INPUT`,detail:{target:e.target}})},onChange_:e=>{a({type:`INPUT`,detail:{target:e.target}})}})}}}var p;function m(e){return{lang:e?.lang??p?.lang,message:e?.message,abortEarly:e?.abortEarly??p?.abortEarly,abortPipeEarly:e?.abortPipeEarly??p?.abortPipeEarly}}function h(e,t,n){let r=e[`~run`]({value:t},m(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}function g(e){if(!e||e.length===0)return``;let t=e.map(e=>typeof e.key==`number`?String(e.key):typeof e.key==`string`?e.key:typeof e.index==`number`?String(e.index):``).filter(Boolean);return t.join(`.`)}function _(e,t){if(e.success)return{};let n={};for(let r of e.issues){let e=t||g(r.path)||(typeof r.input==`string`?r.input:``),i=r.message??`Invalid value`;n[e]||(n[e]=[]),n[e].push(i)}return n}function v(e,t){let n={};for(let r in e){let i=r;t&&(i=i.replace(t+`.`,``)),n[i]=e[r]}return n}function y(e){let t=e;if(!(!t||!(`type`in t))){if(t.type===`checkbox`){let e=t;if(e.name){let t=e.form;if(t){let n=Array.from(t.querySelectorAll(`input[type="checkbox"][name="${CSS.escape(e.name)}"]`)),r=n.filter(e=>e.checked).map(e=>e.value||`on`);return n.length===1&&!n[0].value?n[0].checked:r}}return e.checked}if(t.type===`radio`){let e=t;if(e.form&&e.name){let t=e.form.querySelector(`input[type="radio"][name="${CSS.escape(e.name)}"]:checked`);return t?t.value:``}return e.checked?e.value:``}return t instanceof HTMLSelectElement&&t.multiple?Array.from(t.selectedOptions).map(e=>e.value):t.value}}function b(e,t,n){if(e===``)return``;n&&(e=`${n}[${e}]`);let r=e.split(`[`,2),i=`${t}[${r[0]}]`;return r.length>1&&(i+=`[${r[1]}`),i}const x=a({initialState(){return`ready`},context({bindable:e}){return{values:e(()=>({defaultValue:new FormData})),initialValues:e(()=>({defaultValue:new FormData})),errors:e(()=>({defaultValue:{}})),dirty:e(()=>({defaultValue:{}}))}},states:{ready:{},invalid:{},submitting:{},success:{},error:{}},on:{SUBMIT:{target:`submitting`,actions:[`validateAll`]},VALIDATE:{actions:[`validateAll`]},INVALID:{target:`invalid`},INPUT:{actions:[`handleInput`]},RESET:{target:`ready`,actions:[`resetForm`]},ERROR:{target:`error`},SUCCESS:{target:`success`}},entry:[`handleFieldBlurs`],implementations:{actions:{validateAll({context:e,send:t,prop:n,state:r,action:i,event:a,scope:o}){let s=r.matches(`submitting`),c=n(`schema`);if(c){let n=h(c,Object.fromEntries(e.get(`values`).entries())),r=_(n);if(e.set(`errors`,r),Object.keys(r).length>0){t({type:`INVALID`}),s&&i([`focusFirstInvalid`]);return}}if(!s){r.set(`ready`);return}let l=n(`onSubmit`);if(!l){t({type:`SUCCESS`});return}let u;try{u=l({formData:e.get(`values`),api:a.detail.api,event:a.detail.event,post:async(r,i)=>{let a=new FormData,s=n(`objectName`),c=d(o).getAttribute(`data-field-name-prefix`)||``;for(let[e,t]of i.entries()){if(e.includes(c)){a.append(e,t);continue}a.append(b(e,c,s),t)}let l=await fetch(r,{method:`POST`,body:a});if(l.status===422){let n=await l.json();e.set(`errors`,v(n,s)),t({type:`INVALID`})}return l}})}catch{t({type:`ERROR`});return}u instanceof Promise?u.then(e=>{t(e?{type:`SUCCESS`}:{type:`ERROR`})}).catch(()=>{t({type:`ERROR`})}):t(u?{type:`SUCCESS`}:{type:`ERROR`})},handleInput({context:e,event:t,action:n,prop:r}){let i=t,a=i?.detail?.target??i?.target??i?.currentTarget,o=a?.name;if(!o)return;let s=r(`reactiveFields`)||[];if(s.length===0||!s.includes(o))return;let c=i?.detail?.value??y(a),l=e.get(`values`);l.set(o,c),e.set(`values`,l);let u=e.get(`initialValues`).get(o),d={...e.get(`dirty`)};d[o]=JSON.stringify(l.get(o))!==JSON.stringify(u),e.set(`dirty`,d),e.get(`errors`)[o]&&n([`validateAll`])},resetForm({context:e}){let t=e.get(`initialValues`);e.set(`values`,{...t}),e.set(`errors`,{});let n={};for(let e of Object.keys(t))n[e]=!1;e.set(`dirty`,n)},focusFirstInvalid({context:e,scope:t}){let n=e.get(`errors`),r=Object.keys(n)[0];if(!r)return;let i=d(t),a=i.querySelector(`[name="${CSS.escape(r)}"]`);a?.focus()},handleFieldBlurs({scope:e}){let t=d(e);if(!t)return;let n=e=>{let t=e.target,n=t?.name};t.addEventListener(`blur`,n,!0)}}}});var S=class extends e{static name=`form`;initMachine(e){let n=new t(x,e);return i(this.getElement(`form`),n),n}initApi(){return f(this.machine.service,n)}render(){let e=this.getElement(`form`);e&&(this.spreadProps(e,this.api.getFormProps()),this.api.userRenderFn?.(this))}};export{S as Form};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Component as e,Machine as t,normalizeProps as n}from"./Client-B1xGmpZs.js";import*as r from"@zag-js/radio-group";var i=class extends e{static name=`radio-group`;initMachine(e){return new t(r.machine,e)}initApi(){return r.connect(this.machine.service,n)}render(){let e=this.getElement(`root`);e&&this.spreadProps(e,this.api.getRootProps());let t=this.getElement(`label`);t&&this.spreadProps(t,this.api.getLabelProps());let n=this.getElements(`item`);n.forEach(e=>{this.spreadProps(e,this.api.getItemProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let r=this.getElements(`item-text`);r.forEach(e=>{this.spreadProps(e,this.api.getItemTextProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let i=this.getElements(`item-control`);i.forEach(e=>{this.spreadProps(e,this.api.getItemControlProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let a=this.getElements(`item-hidden-input`);a.forEach(e=>{this.spreadProps(e,this.api.getItemHiddenInputProps({value:e.dataset.value,disabled:e.getAttribute(`data-disabled`)===`true`,invalid:e.getAttribute(`data-invalid`)===`true`}))});let o=this.getElement(`indicator`);o&&this.spreadProps(o,this.api.getIndicatorProps())}};export{i as RadioGroup};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=e=>e.ids?.form??`field:${e.id}:root`,t=e=>e.ids?.label??`field:${e.id}:label`,n=e=>e.ids?.control??`field:${e.id}:control`,r=e=>e.ids?.error??`field:${e.id}:error`,i=t=>t.getById(e(t));export{n as getControlId,r as getErrorId,t as getLabelId,i as getRootEl,e as getRootId};
|