@womp/kookie-ui 0.22.0 → 0.23.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/components.css +57 -2
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +4 -4
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +4 -4
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +4 -4
- package/dist/cjs/components/image.d.ts +23 -0
- package/dist/cjs/components/image.d.ts.map +1 -0
- package/dist/cjs/components/image.js +2 -0
- package/dist/cjs/components/image.js.map +7 -0
- package/dist/cjs/components/image.props.d.ts +19 -0
- package/dist/cjs/components/image.props.d.ts.map +1 -0
- package/dist/cjs/components/image.props.js +2 -0
- package/dist/cjs/components/image.props.js.map +7 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.d.ts.map +1 -1
- package/dist/cjs/components/index.js +3 -3
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/message-scroller.js +1 -1
- package/dist/cjs/components/message-scroller.js.map +4 -4
- package/dist/cjs/components/notice.js +1 -1
- package/dist/cjs/components/notice.js.map +4 -4
- package/dist/cjs/components/select.d.ts +1 -2
- package/dist/cjs/components/select.d.ts.map +1 -1
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +3 -3
- package/dist/cjs/components/slider.d.ts.map +1 -1
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slider.js.map +2 -2
- package/dist/cjs/components/spinner.d.ts.map +1 -1
- package/dist/cjs/components/spinner.js +1 -1
- package/dist/cjs/components/spinner.js.map +2 -2
- package/dist/cjs/components/toggle.js +2 -2
- package/dist/cjs/components/toggle.js.map +4 -4
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +4 -4
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/{chunk-PNAB6KCN.js → chunk-6DDOR73D.js} +2 -2
- package/dist/esm/{chunk-PNAB6KCN.js.map → chunk-6DDOR73D.js.map} +1 -1
- package/dist/esm/{chunk-LC5AK2ZD.js → chunk-BOL3VVSN.js} +2 -2
- package/dist/esm/chunk-EZYXYLR2.js +2 -0
- package/dist/esm/chunk-EZYXYLR2.js.map +7 -0
- package/dist/esm/{chunk-WKSXMFFF.js → chunk-FYT7TYGS.js} +2 -2
- package/dist/esm/chunk-GLV7VGBH.js +2 -0
- package/dist/esm/{chunk-KMDXIZAG.js.map → chunk-GLV7VGBH.js.map} +2 -2
- package/dist/esm/{chunk-NLXJZJNN.js → chunk-L2R62BOB.js} +2 -2
- package/dist/esm/chunk-M7I6ISPL.js +2 -0
- package/dist/esm/chunk-M7I6ISPL.js.map +7 -0
- package/dist/esm/chunk-MYYXOFU5.js +1 -0
- package/dist/esm/chunk-NQDMTOGB.js +2 -0
- package/dist/esm/chunk-NQDMTOGB.js.map +7 -0
- package/dist/esm/{chunk-YK3ZUMRQ.js → chunk-Q6MFPATL.js} +2 -2
- package/dist/esm/{chunk-T62PRLPN.js → chunk-QGCXTULQ.js} +2 -2
- package/dist/esm/chunk-UE3HATOA.js +2 -0
- package/dist/esm/chunk-UE3HATOA.js.map +7 -0
- package/dist/esm/chunk-XRCMPBAY.js +2 -0
- package/dist/esm/chunk-XRCMPBAY.js.map +7 -0
- package/dist/esm/{chunk-TJL47GIO.js → chunk-ZEX2DECM.js} +2 -2
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/image.d.ts +23 -0
- package/dist/esm/components/image.d.ts.map +1 -0
- package/dist/esm/components/image.js +2 -0
- package/dist/esm/components/image.js.map +7 -0
- package/dist/esm/components/image.props.d.ts +19 -0
- package/dist/esm/components/image.props.d.ts.map +1 -0
- package/dist/esm/components/image.props.js +2 -0
- package/dist/esm/components/image.props.js.map +7 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.d.ts.map +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/select.d.ts +1 -2
- package/dist/esm/components/select.d.ts.map +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/slider.d.ts.map +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/spinner.d.ts.map +1 -1
- package/dist/esm/components/spinner.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/index.js +1 -1
- package/package.json +1 -1
- package/src/components/_internal/base-button.css +6 -0
- package/src/components/_internal/base-button.tsx +5 -5
- package/src/components/accordion.css +0 -1
- package/src/components/combobox.css +13 -0
- package/src/components/image.css +33 -0
- package/src/components/image.props.ts +18 -0
- package/src/components/image.tsx +71 -0
- package/src/components/index.css +1 -0
- package/src/components/index.tsx +1 -0
- package/src/components/select.tsx +77 -29
- package/src/components/shell.css +12 -0
- package/src/components/slider.css +1 -0
- package/src/components/slider.tsx +3 -12
- package/src/components/spinner.css +19 -1
- package/src/components/spinner.tsx +11 -9
- package/src/styles/tokens/color.css +1 -22
- package/src/styles/tokens/radius.css +8 -8
- package/styles.css +65 -31
- package/tokens/base.css +8 -29
- package/tokens.css +8 -29
- package/dist/esm/chunk-3YWVE5GL.js +0 -2
- package/dist/esm/chunk-3YWVE5GL.js.map +0 -7
- package/dist/esm/chunk-A3YQIJDA.js +0 -2
- package/dist/esm/chunk-A3YQIJDA.js.map +0 -7
- package/dist/esm/chunk-D3U4MWDZ.js +0 -1
- package/dist/esm/chunk-IJRBX6EV.js +0 -2
- package/dist/esm/chunk-IJRBX6EV.js.map +0 -7
- package/dist/esm/chunk-KMDXIZAG.js +0 -2
- /package/dist/esm/{chunk-LC5AK2ZD.js.map → chunk-BOL3VVSN.js.map} +0 -0
- /package/dist/esm/{chunk-WKSXMFFF.js.map → chunk-FYT7TYGS.js.map} +0 -0
- /package/dist/esm/{chunk-NLXJZJNN.js.map → chunk-L2R62BOB.js.map} +0 -0
- /package/dist/esm/{chunk-D3U4MWDZ.js.map → chunk-MYYXOFU5.js.map} +0 -0
- /package/dist/esm/{chunk-YK3ZUMRQ.js.map → chunk-Q6MFPATL.js.map} +0 -0
- /package/dist/esm/{chunk-T62PRLPN.js.map → chunk-QGCXTULQ.js.map} +0 -0
- /package/dist/esm/{chunk-TJL47GIO.js.map → chunk-ZEX2DECM.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as te,b as re}from"./chunk-FDHWAC6W.js";import{a as B,b as oe,c as O}from"./chunk-25FNCKUM.js";import{
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as te,b as re}from"./chunk-FDHWAC6W.js";import{a as B,b as oe,c as O}from"./chunk-25FNCKUM.js";import{a as ee}from"./chunk-AGAQC4HH.js";import{b as Y,c as Z}from"./chunk-IX5HIHVI.js";import{a as X}from"./chunk-MJJ7XDIP.js";import{b as Q,c as U}from"./chunk-PPZY7PJA.js";import{c as _}from"./chunk-FWB47YCH.js";import{d as J}from"./chunk-3YLYGKFB.js";import{a as D}from"./chunk-ELAW7ZUG.js";import{a as Te}from"./chunk-OS3FCYZY.js";var Me={};Te(Me,{Content:()=>fe,Empty:()=>Pe,Group:()=>Re,Input:()=>xe,Item:()=>ye,Label:()=>he,List:()=>ge,Root:()=>pe,Separator:()=>ve,Trigger:()=>de,Value:()=>Ce});import*as e from"react";import p from"classnames";import{Popover as ne}from"radix-ui";import{useCallbackRef as A,useComposedRefs as ie,useControllableState as G,useLayoutEffect as W}from"radix-ui/internal";import{Command as T,useCommandState as ae}from"cmdk";var Ie={size:B.size},Ne={size:O.size},se=new Set;function Le(o){se.has(o)||(se.add(o),console.warn(o))}function we(o){let r=o,t=new Set;return{get:()=>r,set:n=>{Object.is(n,r)||(r=n,t.forEach(a=>a()))},subscribe:n=>(t.add(n),()=>{t.delete(n)})}}var le=e.createContext(null),M=o=>{let r=e.useContext(le);if(!r)throw new Error(`Combobox.${o} must be used within Combobox.Root`);return r},me=e.createContext(null),ce=e.createContext(null),be=e.createContext(null),ue=()=>e.useContext(be);function De(o){let r=o.getAttribute("aria-label")?.trim();if(r)return r;let t=o.getAttribute("aria-labelledby");if(t){let a=t.split(/\s+/).map(s=>o.ownerDocument.getElementById(s)?.textContent?.trim()).filter(Boolean).join(" ");if(a)return a}let n=o.labels;if(n&&n.length>0){let a=Array.from(n).map(s=>s.textContent?.trim()).filter(Boolean).join(" ");if(a)return a}}var pe=o=>{let{children:r,size:t,value:n,defaultValue:a=null,onValueChange:s,open:l,defaultOpen:d=!1,onOpenChange:i,placeholder:c="Select an option",searchPlaceholder:x="Search...",searchValue:g,defaultSearchValue:R="",onSearchValueChange:h,filter:C,shouldFilter:b=!0,loop:m=!0,disabled:v,resetSearchOnSelect:f=!0,resetSearchOnClose:S=!0,color:V,displayValue:y,...k}=o,u=J(t,B.size),[E,P]=G({prop:l,defaultProp:d,onChange:i}),[I,Se]=G({prop:n,defaultProp:a,onChange:s}),[j,N]=G({prop:g,defaultProp:R,onChange:h}),K=typeof y=="function"?y(I):y,[L]=e.useState(()=>we(I));W(()=>{L.set(I)},[L,I]);let F=A(w=>{P(w),!w&&S&&N("")}),q=A(w=>{Se(w),P(!1),f&&N("")}),z=e.useRef(null),$=e.useCallback(()=>z.current?De(z.current):void 0,[]),Ve=e.useMemo(()=>({value:I,displayValue:K,setOpen:F,size:u,placeholder:c,searchPlaceholder:x,disabled:v,color:V,loop:m,shouldFilter:b,filter:C,triggerRef:z,getTriggerLabel:$}),[I,K,F,u,c,x,v,V,m,b,C,$]),Ee=e.useMemo(()=>({value:j,setValue:N}),[j,N]),ke=e.useMemo(()=>({store:L,onSelect:q,disabled:v}),[L,q,v]);return e.createElement(le.Provider,{value:Ve},e.createElement(me.Provider,{value:Ee},e.createElement(ce.Provider,{value:ke},e.createElement(te,{open:E,onOpenChange:F,...k},r))))};pe.displayName="Combobox.Root";var de=e.forwardRef((o,r)=>{let t=M("Trigger"),{children:n,className:a,placeholder:s,disabled:l,readOnly:d,error:i,loading:c,color:x,radius:g,onClick:R,onKeyDown:h,type:C,...b}=D({size:t.size,...o},Ie,oe),m=l??t.disabled,v=x??t.color,f=!!(d||c),S=t.value==null&&t.displayValue==null,V=ie(r,t.triggerRef),{getTriggerLabel:y}=t;e.useEffect(()=>{},[y]);let k=P=>{R?.(P),f&&P.preventDefault()},u=P=>{h?.(P),!(P.defaultPrevented||f||m)&&P.key==="ArrowDown"&&(P.preventDefault(),t.setOpen(!0))},E=e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement("span",{className:"kui-ComboboxValue"},t.displayValue??t.value??s??t.placeholder)),c?e.createElement("div",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},e.createElement("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32",className:"kui-SelectLoadingIconCircle"}))):e.createElement(Z,{className:"kui-SelectIcon"}));return e.createElement(re,{disabled:m},e.createElement("button",{"data-accent-color":v,"data-radius":g,"data-error":i,"data-loading":c,"data-disabled":m||void 0,"data-read-only":d||void 0,"data-placeholder":S?"":void 0,...b,role:"combobox","aria-disabled":m||void 0,"aria-readonly":d||void 0,"aria-invalid":i||void 0,"aria-busy":c||void 0,type:C??"button",disabled:m,onClick:k,onKeyDown:u,ref:V,className:p("kui-reset","kui-SelectTrigger","kui-ComboboxTrigger",a)},n?X(n):E))});de.displayName="Combobox.Trigger";var Ce=e.forwardRef(({placeholder:o,children:r,className:t,...n},a)=>{let s=M("Value"),l=s.displayValue??s.value??void 0;return e.createElement("span",{...n,ref:a,className:p("kui-ComboboxValue",t)},l??r??o??s.placeholder)});Ce.displayName="Combobox.Value";function Oe(){let o=ae(a=>a.filtered.count),r=ae(a=>a.search),[t,n]=e.useState("");return e.useEffect(()=>{let a=r?o===0?"No results":`${o} result${o===1?"":"s"}`:"",s=window.setTimeout(()=>n(a),r?400:0);return()=>window.clearTimeout(s)},[o,r]),e.createElement(ee,{role:"status","aria-live":"polite","aria-atomic":"true"},t)}var fe=e.forwardRef((o,r)=>{let t=M("Content"),n=Q(),a=o.size??t.size??O.size.default,{className:s,children:l,color:d,forceMount:i,container:c,onOpenAutoFocus:x,"aria-label":g,"aria-labelledby":R,...h}=D({...o,size:a},O),C=d||t.color||n.accentColor,{getTriggerLabel:b}=t,[m,v]=e.useState(b);W(()=>{if(m!==void 0)return;let u=b();u!==void 0&&v(u)},[b,m]);let f=o["aria-label"]??m,S=e.useMemo(()=>({sizeClassName:D({size:a},Ne).className||void 0,color:C,label:f}),[a,C,f]),V=e.useRef(null),y=u=>{if(x?.(u),u.defaultPrevented)return;let E=V.current;if(!E||E.querySelector("[cmdk-input]"))return;u.preventDefault(),(E.querySelector("[cmdk-list]")??E).focus({preventScroll:!0})},k=t.value?.trim()||void 0;return e.createElement(ne.Portal,{container:c,forceMount:i?!0:void 0},e.createElement(U,{asChild:!0},e.createElement(ne.Content,{"data-accent-color":C,align:"start",sideOffset:4,collisionPadding:10,"aria-label":R?void 0:f,"aria-labelledby":R,...h,forceMount:i?!0:void 0,onOpenAutoFocus:y,ref:r,className:p("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-ComboboxContent",s)},e.createElement(be.Provider,{value:S},e.createElement(T,{ref:V,loop:t.loop,shouldFilter:t.shouldFilter,filter:t.filter,label:f,defaultValue:k,className:"kui-ComboboxCommand"},l,e.createElement(Oe,null))))))});fe.displayName="Combobox.Content";var xe=e.forwardRef(({className:o,startAdornment:r,endAdornment:t,placeholder:n,variant:a,value:s,onValueChange:l,...d},i)=>{let c=M("Input"),x=e.useContext(me),g=ue(),R=a??"soft",h=s??x?.value??"",C=l??x?.setValue,b=e.createElement("div",{className:p("kui-TextFieldRoot","kui-ComboboxInputRoot",g?.sizeClassName,`kui-variant-${R}`),"data-accent-color":g?.color},r?e.createElement("div",{className:"kui-TextFieldSlot"},r):null,e.createElement(T.Input,{...d,ref:i,value:h,onValueChange:C,placeholder:n??c.searchPlaceholder,className:p("kui-reset","kui-TextFieldInput",o)}),t?e.createElement("div",{className:"kui-TextFieldSlot","data-side":"right"},t):null);return g?e.createElement("div",{className:"kui-ComboboxSearch"},b):b});xe.displayName="Combobox.Input";var ge=e.forwardRef(({className:o,children:r,label:t,...n},a)=>{let s=ue();return e.createElement("div",{className:"kui-ComboboxScrollArea"},e.createElement("div",{className:p("kui-BaseMenuViewport","kui-ComboboxViewport")},e.createElement(T.List,{...n,label:t??s?.label,ref:a,className:p("kui-ComboboxList",o)},r)))});ge.displayName="Combobox.List";var Pe=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Empty,{...r,ref:t,className:p("kui-ComboboxEmpty",o)}));Pe.displayName="Combobox.Empty";var Re=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Group,{...r,ref:t,className:p("kui-BaseMenuGroup","kui-ComboboxGroup",o)}));Re.displayName="Combobox.Group";var he=e.forwardRef(({className:o,id:r,...t},n)=>{let a=e.useId(),s=r??a,l=e.useRef(null),d=ie(n,l);return W(()=>{let i=l.current?.closest("[cmdk-group-items]");if(!(!i||i.hasAttribute("aria-labelledby")))return i.setAttribute("aria-labelledby",s),()=>{i.getAttribute("aria-labelledby")===s&&i.removeAttribute("aria-labelledby")}},[s]),e.createElement("div",{...t,id:s,ref:d,className:p("kui-BaseMenuLabel","kui-ComboboxLabel",o)})});he.displayName="Combobox.Label";var ve=e.forwardRef(({className:o,...r},t)=>e.createElement(T.Separator,{...r,ref:t,className:p("kui-BaseMenuSeparator","kui-ComboboxSeparator",o)}));ve.displayName="Combobox.Separator";function H(o){return o==null||typeof o=="boolean"?"":typeof o=="string"||typeof o=="number"?String(o):Array.isArray(o)?o.map(H).join(""):e.isValidElement(o)?H(o.props.children):""}var ye=e.forwardRef(({className:o,children:r,label:t,value:n,disabled:a,onSelect:s,keywords:l,...d},i)=>{let c=e.useContext(ce);if(!c)throw new Error("Combobox.Item must be used within Combobox.Root");let{store:x,onSelect:g,disabled:R}=c,h=n??(typeof r=="string"?r.trim():void 0),C=()=>h!==void 0&&x.get()===h,b=e.useSyncExternalStore(x.subscribe,C,C),m=A(s),v=e.useCallback(k=>{let u=n??k;g(u),m(u)},[n,g,m]),f=(t??H(r)).replace(/\s+/g," ").trim(),S=f?l?[f,...l]:[f]:l,V=S?S.join("\0"):"",y=a??R??!1;return e.createElement(T.Item,{key:V,...d,value:n,keywords:S,"aria-checked":b,disabled:y||void 0,ref:i,onSelect:v,className:p("kui-reset","kui-BaseMenuItem","kui-ComboboxItem",o)},b?e.createElement("span",{className:p("kui-BaseMenuItemIndicator","kui-ComboboxItemIndicator")},e.createElement(Y,{className:p("kui-BaseMenuItemIndicatorIcon","kui-ComboboxItemIndicatorIcon")})):null,e.createElement(_,null,r))});ye.displayName="Combobox.Item";export{pe as a,de as b,Ce as c,fe as d,xe as e,ge as f,Pe as g,Re as h,he as i,ve as j,ye as k,Me as l};
|
|
2
|
+
//# sourceMappingURL=chunk-6DDOR73D.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/combobox.tsx"],
|
|
4
4
|
"sourcesContent": ["'use client';\n\n/**\n * Combobox: Radix Popover for positioning, dismissal and focus; cmdk for search,\n * filtering and keyboard navigation.\n *\n * Render path. State is split so an interaction re-renders only what reads it:\n * - `ComboboxContext` (Trigger, Value, Content): config and the selected value.\n * Open state is not in it, so opening and closing re-render no consumer.\n * - `ComboboxSearchContext` (Input only): the search text.\n * - `ComboboxItemContext` (Items): stable values only. Items read \"am I selected\"\n * from a store through `useSyncExternalStore`, so a selection re-renders the old\n * and the new selected item, not all N.\n *\n * Highlight. cmdk's `data-selected` is the single highlight source, driven by both\n * the pointer and the keyboard. There is no separate CSS `:hover` highlight, so two\n * items are never lit at once and Enter always picks the lit item.\n */\n\nimport { warnDeprecated } from '../helpers/warn-deprecated.js';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Popover as PopoverPrimitive } from 'radix-ui';\nimport { useCallbackRef, useComposedRefs, useControllableState, useLayoutEffect } from 'radix-ui/internal';\nimport { Command as CommandPrimitive, useCommandState } from 'cmdk';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../helpers/theme-size.js';\nimport { comboboxRootPropDefs, comboboxTriggerPropDefs, comboboxContentPropDefs } from './combobox.props.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport * as Popover from './popover.js';\nimport { Slottable } from './slot.js';\nimport { VisuallyHidden } from './visually-hidden.js';\n\nimport type { textFieldRootPropDefs } from './text-field.props.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextFieldVariant = (typeof textFieldRootPropDefs.variant.values)[number];\ntype ComboboxValue = string | null;\ntype CommandFilter = (value: string, search: string, keywords?: string[]) => number;\n\n// Hoisted so extractProps' compiled prop-def cache (keyed by object identity) hits.\nconst triggerSizingPropDefs = { size: comboboxRootPropDefs.size };\nconst contentSizePropDefs = { size: comboboxContentPropDefs.size };\n\nconst warned = new Set<string>();\nfunction warnOnce(message: string) {\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(message);\n}\n\n// ============================================================================\n// Selection store\n// ============================================================================\n\ninterface SelectionStore {\n get: () => ComboboxValue;\n set: (value: ComboboxValue) => void;\n subscribe: (listener: () => void) => () => void;\n}\n\nfunction createSelectionStore(initial: ComboboxValue): SelectionStore {\n let current = initial;\n const listeners = new Set<() => void>();\n return {\n get: () => current,\n set: (next) => {\n if (Object.is(next, current)) return;\n current = next;\n listeners.forEach((listener) => listener());\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\n// ============================================================================\n// Contexts\n// ============================================================================\n\ninterface ComboboxContextValue {\n value: ComboboxValue;\n displayValue?: string;\n setOpen: (open: boolean) => void;\n size?: ComboboxRootOwnProps['size'];\n placeholder?: string;\n searchPlaceholder?: string;\n disabled?: boolean;\n color?: string;\n loop: boolean;\n shouldFilter: boolean;\n filter?: CommandFilter;\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n /** Reads the trigger's accessible name from the DOM (aria-label, aria-labelledby or <label>). */\n getTriggerLabel: () => string | undefined;\n}\n\nconst ComboboxContext = React.createContext<ComboboxContextValue | null>(null);\n\nconst useComboboxContext = (componentName: string) => {\n const ctx = React.useContext(ComboboxContext);\n if (!ctx) {\n throw new Error(`Combobox.${componentName} must be used within Combobox.Root`);\n }\n return ctx;\n};\n\ninterface ComboboxSearchContextValue {\n value: string;\n setValue: (value: string) => void;\n}\n\nconst ComboboxSearchContext = React.createContext<ComboboxSearchContextValue | null>(null);\n\ninterface ComboboxItemContextValue {\n store: SelectionStore;\n onSelect: (value: string) => void;\n disabled?: boolean;\n}\n\nconst ComboboxItemContext = React.createContext<ComboboxItemContextValue | null>(null);\n\n/** Values resolved by Content and read by Input and List. */\ninterface ComboboxContentContextValue {\n sizeClassName?: string;\n color?: string;\n label?: string;\n}\n\nconst ComboboxContentContext = React.createContext<ComboboxContentContextValue | null>(null);\n\nconst useComboboxContentContext = () => React.useContext(ComboboxContentContext);\n\n// ============================================================================\n// Root\n// ============================================================================\n\ntype ComboboxRootOwnProps = GetPropDefTypes<typeof comboboxRootPropDefs> & {\n value?: ComboboxValue;\n defaultValue?: ComboboxValue;\n onValueChange?: (value: ComboboxValue) => void;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n placeholder?: string;\n searchPlaceholder?: string;\n searchValue?: string;\n defaultSearchValue?: string;\n onSearchValueChange?: (value: string) => void;\n filter?: CommandFilter;\n shouldFilter?: boolean;\n loop?: boolean;\n disabled?: boolean;\n /** Clear the search text when an option is selected. Defaults to true. */\n resetSearchOnSelect?: boolean;\n /** Clear the search text when the popup is dismissed without a selection. Defaults to true. */\n resetSearchOnClose?: boolean;\n color?: (typeof comboboxTriggerPropDefs.color.values)[number];\n /**\n * Text shown in the trigger for the selected value. Without it the raw value is shown.\n * Can be a string or a function that receives the current value. Pass a stable\n * function (module scope or `useCallback`): an inline function runs on every render.\n * @example displayValue={(v) => items.find(i => i.value === v)?.label}\n */\n displayValue?: string | ((value: ComboboxValue) => string | undefined);\n};\n\ntype PopoverRootProps = React.ComponentPropsWithoutRef<typeof Popover.Root>;\ninterface ComboboxRootProps extends PopoverRootProps, ComboboxRootOwnProps {}\n\nfunction readElementLabel(el: HTMLElement): string | undefined {\n const ariaLabel = el.getAttribute('aria-label')?.trim();\n if (ariaLabel) return ariaLabel;\n\n const labelledBy = el.getAttribute('aria-labelledby');\n if (labelledBy) {\n const text = labelledBy\n .split(/\\s+/)\n .map((id) => el.ownerDocument.getElementById(id)?.textContent?.trim())\n .filter(Boolean)\n .join(' ');\n if (text) return text;\n }\n\n const labels = (el as HTMLButtonElement).labels;\n if (labels && labels.length > 0) {\n const text = Array.from(labels)\n .map((label) => label.textContent?.trim())\n .filter(Boolean)\n .join(' ');\n if (text) return text;\n }\n\n return undefined;\n}\n\nconst ComboboxRoot: React.FC<ComboboxRootProps> = (props) => {\n const {\n children,\n size: sizeProp,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n placeholder = 'Select an option',\n searchPlaceholder = 'Search...',\n searchValue: searchValueProp,\n defaultSearchValue = '',\n onSearchValueChange,\n filter,\n shouldFilter = true,\n loop = true,\n disabled,\n resetSearchOnSelect = true,\n resetSearchOnClose = true,\n color,\n displayValue: displayValueProp,\n ...rootProps\n } = props;\n const size = useThemeSize(sizeProp, comboboxRootPropDefs.size);\n\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const [value, setValue] = useControllableState<ComboboxValue>({\n prop: valueProp,\n defaultProp: defaultValue,\n onChange: onValueChange,\n });\n\n const [searchValue, setSearchValue] = useControllableState<string>({\n prop: searchValueProp,\n defaultProp: defaultSearchValue,\n onChange: onSearchValueChange,\n });\n\n const resolvedDisplayValue = typeof displayValueProp === 'function' ? displayValueProp(value) : displayValueProp;\n\n // Items subscribe to this store instead of the context, so a selection\n // re-renders only the items whose selected state flips.\n const [store] = React.useState(() => createSelectionStore(value));\n useLayoutEffect(() => {\n store.set(value);\n }, [store, value]);\n\n // The radix setters change identity whenever their controlled prop changes.\n // Reading them through callback refs keeps these handlers stable, so the\n // contexts below do not change on every keystroke or selection.\n const handleOpenChange = useCallbackRef((nextOpen: boolean) => {\n setOpen(nextOpen);\n if (!nextOpen && resetSearchOnClose) setSearchValue('');\n });\n\n const onSelect = useCallbackRef((nextValue: string) => {\n setValue(nextValue);\n setOpen(false);\n if (resetSearchOnSelect) setSearchValue('');\n });\n\n const triggerRef = React.useRef<HTMLButtonElement | null>(null);\n const getTriggerLabel = React.useCallback(() => (triggerRef.current ? readElementLabel(triggerRef.current) : undefined), []);\n\n const contextValue = React.useMemo<ComboboxContextValue>(\n () => ({\n value,\n displayValue: resolvedDisplayValue,\n setOpen: handleOpenChange,\n size,\n placeholder,\n searchPlaceholder,\n disabled,\n color,\n loop,\n shouldFilter,\n filter,\n triggerRef,\n getTriggerLabel,\n }),\n [value, resolvedDisplayValue, handleOpenChange, size, placeholder, searchPlaceholder, disabled, color, loop, shouldFilter, filter, getTriggerLabel],\n );\n\n const searchContextValue = React.useMemo<ComboboxSearchContextValue>(() => ({ value: searchValue, setValue: setSearchValue }), [searchValue, setSearchValue]);\n\n const itemContextValue = React.useMemo<ComboboxItemContextValue>(() => ({ store, onSelect, disabled }), [store, onSelect, disabled]);\n\n return (\n <ComboboxContext.Provider value={contextValue}>\n <ComboboxSearchContext.Provider value={searchContextValue}>\n <ComboboxItemContext.Provider value={itemContextValue}>\n <Popover.Root open={open} onOpenChange={handleOpenChange} {...rootProps}>\n {children}\n </Popover.Root>\n </ComboboxItemContext.Provider>\n </ComboboxSearchContext.Provider>\n </ComboboxContext.Provider>\n );\n};\nComboboxRoot.displayName = 'Combobox.Root';\n\n// ============================================================================\n// Trigger\n// ============================================================================\n\ntype ComboboxTriggerElement = HTMLButtonElement;\ntype ComboboxTriggerOwnProps = GetPropDefTypes<typeof comboboxTriggerPropDefs>;\ntype NativeTriggerProps = Omit<React.ComponentPropsWithoutRef<'button'>, 'color'>;\ninterface ComboboxTriggerProps extends NativeTriggerProps, ComboboxTriggerOwnProps {}\n\nconst ComboboxTrigger = React.forwardRef<ComboboxTriggerElement, ComboboxTriggerProps>((props, forwardedRef) => {\n const ctx = useComboboxContext('Trigger');\n\n const {\n children,\n className,\n placeholder,\n disabled,\n readOnly,\n error,\n loading,\n color,\n radius,\n onClick,\n onKeyDown,\n type: buttonType,\n ...triggerProps\n } = extractProps({ size: ctx.size, ...props }, triggerSizingPropDefs, comboboxTriggerPropDefs);\n\n const isDisabled = disabled ?? ctx.disabled;\n const resolvedColor = color ?? ctx.color;\n // Read-only and loading triggers stay focusable but do not open.\n const isBlocked = Boolean(readOnly || loading);\n const isPlaceholder = ctx.value == null && ctx.displayValue == null;\n\n const composedRef = useComposedRefs(forwardedRef, ctx.triggerRef);\n\n const { getTriggerLabel } = ctx;\n React.useEffect(() => {\n if (process.env.NODE_ENV === 'production') return;\n if (!getTriggerLabel()) {\n warnOnce(\n 'Combobox.Trigger has no accessible name. The combobox role does not take its name from its content. Add `aria-label`, `aria-labelledby`, or a `<label htmlFor>` that points at the trigger.',\n );\n }\n }, [getTriggerLabel]);\n\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n // Radix skips its open toggle when the event is default-prevented.\n if (isBlocked) event.preventDefault();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLButtonElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || isBlocked || isDisabled) return;\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n ctx.setOpen(true);\n }\n };\n\n const defaultContent = (\n <>\n <span className=\"kui-SelectTriggerInner\">\n <span className=\"kui-ComboboxValue\">{ctx.displayValue ?? ctx.value ?? placeholder ?? ctx.placeholder}</span>\n </span>\n {loading ? (\n <div className=\"kui-SelectIcon kui-SelectLoadingIcon\" aria-hidden=\"true\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"7\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeDasharray=\"32\"\n strokeDashoffset=\"32\"\n className=\"kui-SelectLoadingIconCircle\"\n />\n </svg>\n </div>\n ) : (\n <ChevronDownIcon className=\"kui-SelectIcon\" />\n )}\n </>\n );\n\n // Radix Popover.Trigger supplies aria-expanded, aria-controls (the popup id) and\n // aria-haspopup=\"dialog\", which matches the Popover dialog this opens.\n return (\n <Popover.Trigger disabled={isDisabled}>\n <button\n data-accent-color={resolvedColor}\n data-radius={radius}\n data-error={error}\n data-loading={loading}\n data-disabled={isDisabled || undefined}\n data-read-only={readOnly || undefined}\n data-placeholder={isPlaceholder ? '' : undefined}\n {...triggerProps}\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props -- Popover.Trigger (Slot) adds aria-expanded and aria-controls\n role=\"combobox\"\n aria-disabled={isDisabled || undefined}\n aria-readonly={readOnly || undefined}\n aria-invalid={error || undefined}\n aria-busy={loading || undefined}\n type={buttonType ?? 'button'}\n disabled={isDisabled}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n ref={composedRef}\n className={classNames('kui-reset', 'kui-SelectTrigger', 'kui-ComboboxTrigger', className)}\n >\n {children ? requireReactElement(children) : defaultContent}\n </button>\n </Popover.Trigger>\n );\n});\nComboboxTrigger.displayName = 'Combobox.Trigger';\n\n// ============================================================================\n// Value (standalone, for custom trigger layouts)\n// ============================================================================\n\ntype ComboboxValueElement = HTMLSpanElement;\ninterface ComboboxValueProps extends React.ComponentPropsWithoutRef<'span'> {\n placeholder?: string;\n}\n\nconst ComboboxValue = React.forwardRef<ComboboxValueElement, ComboboxValueProps>(({ placeholder, children, className, ...valueProps }, forwardedRef) => {\n const ctx = useComboboxContext('Value');\n const display = ctx.displayValue ?? ctx.value ?? undefined;\n return (\n <span {...valueProps} ref={forwardedRef} className={classNames('kui-ComboboxValue', className)}>\n {display ?? children ?? placeholder ?? ctx.placeholder}\n </span>\n );\n});\nComboboxValue.displayName = 'Combobox.Value';\n\n// ============================================================================\n// Content\n// ============================================================================\n\ntype ComboboxContentElement = React.ElementRef<typeof PopoverPrimitive.Content>;\ntype ComboboxContentOwnProps = GetPropDefTypes<typeof comboboxContentPropDefs> & {\n container?: React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Portal>['container'];\n};\ninterface ComboboxContentProps extends Omit<ComponentPropsWithout<typeof PopoverPrimitive.Content, RemovedProps>, 'size'>, ComboboxContentOwnProps {}\n\n/** Announces the filtered result count to screen readers after typing settles. */\nfunction ComboboxAnnouncer() {\n const count = useCommandState((state) => state.filtered.count);\n const search = useCommandState((state) => state.search);\n const [message, setMessage] = React.useState('');\n\n React.useEffect(() => {\n const next = !search ? '' : count === 0 ? 'No results' : `${count} result${count === 1 ? '' : 's'}`;\n const timeout = window.setTimeout(() => setMessage(next), search ? 400 : 0);\n return () => window.clearTimeout(timeout);\n }, [count, search]);\n\n return (\n <VisuallyHidden role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n {message}\n </VisuallyHidden>\n );\n}\n\nconst ComboboxContent = React.forwardRef<ComboboxContentElement, ComboboxContentProps>((props, forwardedRef) => {\n const ctx = useComboboxContext('Content');\n const themeContext = useThemeContext();\n\n // The list takes the field's size.\n const size = props.size ?? ctx.size ?? comboboxContentPropDefs.size.default;\n\n const {\n className,\n children,\n color,\n forceMount,\n container,\n onOpenAutoFocus,\n 'aria-label': _ariaLabel,\n 'aria-labelledby': ariaLabelledByProp,\n ...contentProps\n } = extractProps({ ...props, size }, comboboxContentPropDefs);\n\n const resolvedColor = color || ctx.color || themeContext.accentColor;\n\n\n // The trigger's name labels the popup, the search field and the listbox.\n // Read once per mount (the content remounts on every open); fall back to a\n // layout effect when the trigger was not attached yet (defaultOpen, forceMount).\n const { getTriggerLabel } = ctx;\n const [triggerLabel, setTriggerLabel] = React.useState(getTriggerLabel);\n useLayoutEffect(() => {\n if (triggerLabel !== undefined) return;\n const label = getTriggerLabel();\n if (label !== undefined) setTriggerLabel(label);\n }, [getTriggerLabel, triggerLabel]);\n\n const label = props['aria-label'] ?? triggerLabel;\n\n const contentContextValue = React.useMemo<ComboboxContentContextValue>(\n () => ({\n // Responsive-aware size class for the search field (never String() a responsive object).\n sizeClassName: extractProps({ size }, contentSizePropDefs).className || undefined,\n color: resolvedColor,\n label,\n }),\n [size, resolvedColor, label],\n );\n\n const commandRef = React.useRef<HTMLDivElement>(null);\n\n // Without a search field, focus would land on the popup itself, outside cmdk's\n // keydown handler. Focus the listbox instead so arrow keys and Enter work.\n const handleOpenAutoFocus = (event: Event) => {\n onOpenAutoFocus?.(event);\n if (event.defaultPrevented) return;\n const command = commandRef.current;\n if (!command || command.querySelector('[cmdk-input]')) return;\n event.preventDefault();\n const list = command.querySelector<HTMLElement>('[cmdk-list]');\n (list ?? command).focus({ preventScroll: true });\n };\n\n // Start the highlight on the selected option (cmdk trims item values).\n const initialHighlight = ctx.value?.trim() || undefined;\n\n return (\n <PopoverPrimitive.Portal container={container} forceMount={forceMount ? true : undefined}>\n <Theme asChild>\n <PopoverPrimitive.Content\n data-accent-color={resolvedColor}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n aria-label={ariaLabelledByProp ? undefined : label}\n aria-labelledby={ariaLabelledByProp}\n {...contentProps}\n forceMount={forceMount ? true : undefined}\n onOpenAutoFocus={handleOpenAutoFocus}\n ref={forwardedRef}\n className={classNames('kui-PopperContent', 'kui-BaseMenuContent',\n 'kui-variant-soft', 'kui-ComboboxContent', className)}\n >\n <ComboboxContentContext.Provider value={contentContextValue}>\n <CommandPrimitive\n ref={commandRef}\n loop={ctx.loop}\n shouldFilter={ctx.shouldFilter}\n filter={ctx.filter}\n label={label}\n defaultValue={initialHighlight}\n className=\"kui-ComboboxCommand\"\n >\n {children}\n <ComboboxAnnouncer />\n </CommandPrimitive>\n </ComboboxContentContext.Provider>\n </PopoverPrimitive.Content>\n </Theme>\n </PopoverPrimitive.Portal>\n );\n});\nComboboxContent.displayName = 'Combobox.Content';\n\n// ============================================================================\n// Input\n// ============================================================================\n\ntype ComboboxInputElement = React.ElementRef<typeof CommandPrimitive.Input>;\ninterface ComboboxInputProps extends Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>, 'value' | 'onValueChange'> {\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n variant?: TextFieldVariant;\n value?: string;\n onValueChange?: (value: string) => void;\n}\n\nconst ComboboxInput = React.forwardRef<ComboboxInputElement, ComboboxInputProps>(\n ({ className, startAdornment, endAdornment, placeholder, variant: inputVariant, value, onValueChange, ...inputProps }, forwardedRef) => {\n const ctx = useComboboxContext('Input');\n const search = React.useContext(ComboboxSearchContext);\n const contentContext = useComboboxContentContext();\n\n const textFieldVariant = inputVariant ?? 'soft';\n\n // The search text lives in Root; only this component subscribes to it.\n const searchValue = value ?? search?.value ?? '';\n const handleSearchChange = onValueChange ?? search?.setValue;\n\n const inputField = (\n <div\n className={classNames('kui-TextFieldRoot', 'kui-ComboboxInputRoot', contentContext?.sizeClassName, `kui-variant-${textFieldVariant}`)}\n data-accent-color={contentContext?.color}\n >\n {startAdornment ? <div className=\"kui-TextFieldSlot\">{startAdornment}</div> : null}\n <CommandPrimitive.Input\n {...inputProps}\n ref={forwardedRef}\n value={searchValue}\n onValueChange={handleSearchChange}\n placeholder={placeholder ?? ctx.searchPlaceholder}\n className={classNames('kui-reset', 'kui-TextFieldInput', className)}\n />\n {endAdornment ? (\n <div className=\"kui-TextFieldSlot\" data-side=\"right\">\n {endAdornment}\n </div>\n ) : null}\n </div>\n );\n\n return contentContext ? <div className=\"kui-ComboboxSearch\">{inputField}</div> : inputField;\n },\n);\nComboboxInput.displayName = 'Combobox.Input';\n\n// ============================================================================\n// List\n// ============================================================================\n\ntype ComboboxListElement = React.ElementRef<typeof CommandPrimitive.List>;\ninterface ComboboxListProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> {}\n\n// cmdk's List owns its id (referenced by the input's aria-controls), role and\n// aria-label (set from `label`), so none of them are overridden here.\nconst ComboboxList = React.forwardRef<ComboboxListElement, ComboboxListProps>(({ className, children, label, ...listProps }, forwardedRef) => {\n const contentContext = useComboboxContentContext();\n return (\n <div className=\"kui-ComboboxScrollArea\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-ComboboxViewport')}>\n <CommandPrimitive.List {...listProps} label={label ?? contentContext?.label} ref={forwardedRef} className={classNames('kui-ComboboxList', className)}>\n {children}\n </CommandPrimitive.List>\n </div>\n </div>\n );\n});\nComboboxList.displayName = 'Combobox.List';\n\n// ============================================================================\n// Empty\n// ============================================================================\n\ntype ComboboxEmptyElement = React.ElementRef<typeof CommandPrimitive.Empty>;\ninterface ComboboxEmptyProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> {}\n\nconst ComboboxEmpty = React.forwardRef<ComboboxEmptyElement, ComboboxEmptyProps>(({ className, ...emptyProps }, forwardedRef) => (\n <CommandPrimitive.Empty {...emptyProps} ref={forwardedRef} className={classNames('kui-ComboboxEmpty', className)} />\n));\nComboboxEmpty.displayName = 'Combobox.Empty';\n\n// ============================================================================\n// Group\n// ============================================================================\n\ntype ComboboxGroupElement = React.ElementRef<typeof CommandPrimitive.Group>;\ninterface ComboboxGroupProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> {}\n\nconst ComboboxGroup = React.forwardRef<ComboboxGroupElement, ComboboxGroupProps>(({ className, ...groupProps }, forwardedRef) => (\n <CommandPrimitive.Group {...groupProps} ref={forwardedRef} className={classNames('kui-BaseMenuGroup', 'kui-ComboboxGroup', className)} />\n));\nComboboxGroup.displayName = 'Combobox.Group';\n\n// ============================================================================\n// Label\n// ============================================================================\n\ntype ComboboxLabelElement = React.ElementRef<'div'>;\ninterface ComboboxLabelProps extends React.ComponentPropsWithoutRef<'div'> {}\n\nconst ComboboxLabel = React.forwardRef<ComboboxLabelElement, ComboboxLabelProps>(({ className, id: idProp, ...labelProps }, forwardedRef) => {\n const generatedId = React.useId();\n const id = idProp ?? generatedId;\n const localRef = React.useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs(forwardedRef, localRef);\n\n // cmdk renders the group's role=\"group\" element itself and gives no way to\n // label it from a child, so name it after this label when inside a Group.\n useLayoutEffect(() => {\n const group = localRef.current?.closest('[cmdk-group-items]');\n if (!group || group.hasAttribute('aria-labelledby')) return;\n group.setAttribute('aria-labelledby', id);\n return () => {\n if (group.getAttribute('aria-labelledby') === id) group.removeAttribute('aria-labelledby');\n };\n }, [id]);\n\n return <div {...labelProps} id={id} ref={composedRef} className={classNames('kui-BaseMenuLabel', 'kui-ComboboxLabel', className)} />;\n});\nComboboxLabel.displayName = 'Combobox.Label';\n\n// ============================================================================\n// Separator\n// ============================================================================\n\ntype ComboboxSeparatorElement = React.ElementRef<typeof CommandPrimitive.Separator>;\ninterface ComboboxSeparatorProps extends React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> {}\n\nconst ComboboxSeparator = React.forwardRef<ComboboxSeparatorElement, ComboboxSeparatorProps>(({ className, ...separatorProps }, forwardedRef) => (\n <CommandPrimitive.Separator {...separatorProps} ref={forwardedRef} className={classNames('kui-BaseMenuSeparator', 'kui-ComboboxSeparator', className)} />\n));\nComboboxSeparator.displayName = 'Combobox.Separator';\n\n// ============================================================================\n// Item\n// ============================================================================\n\n/** Plain text of a React node tree, used as the item's search text. */\nfunction getNodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(getNodeText).join('');\n if (React.isValidElement<{ children?: React.ReactNode }>(node)) return getNodeText(node.props.children);\n return '';\n}\n\ntype ComboboxItemElement = React.ElementRef<typeof CommandPrimitive.Item>;\ninterface ComboboxItemProps extends Omit<React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>, 'keywords' | 'onSelect'> {\n /**\n * Text matched by search. Defaults to the text of `children`. Set it when the\n * children are components whose text is not in the JSX (it cannot be read).\n */\n label?: string;\n /** Additional keywords for search filtering. */\n keywords?: string[];\n /** Called when the item is selected. */\n onSelect?: (value: string) => void;\n}\n\nconst ComboboxItem = React.forwardRef<ComboboxItemElement, ComboboxItemProps>(\n ({ className, children, label, value, disabled, onSelect, keywords, ...itemProps }, forwardedRef) => {\n const itemContext = React.useContext(ComboboxItemContext);\n if (!itemContext) {\n throw new Error('Combobox.Item must be used within Combobox.Root');\n }\n const { store, onSelect: onSelectFromRoot, disabled: rootDisabled } = itemContext;\n\n // Without `value`, cmdk uses the trimmed text of string children.\n const itemValue = value ?? (typeof children === 'string' ? children.trim() : undefined);\n const getIsSelected = () => itemValue !== undefined && store.get() === itemValue;\n const isSelected = React.useSyncExternalStore(store.subscribe, getIsSelected, getIsSelected);\n\n const onSelectProp = useCallbackRef(onSelect);\n // cmdk passes its resolved value (the `value` prop, or the text when `value` is omitted).\n const handleSelect = React.useCallback(\n (resolvedValue: string) => {\n const nextValue = value ?? resolvedValue;\n onSelectFromRoot(nextValue);\n onSelectProp(nextValue);\n },\n [value, onSelectFromRoot, onSelectProp],\n );\n\n // cmdk matches only `value` and `keywords`, so add the visible text as a keyword.\n const text = (label ?? getNodeText(children)).replace(/\\s+/g, ' ').trim();\n const searchKeywords = text ? (keywords ? [text, ...keywords] : [text]) : keywords;\n // cmdk stores keywords only when `value` changes. Remount the cmdk item when\n // they change so a new label or keyword list is picked up.\n const keywordsKey = searchKeywords ? searchKeywords.join('\u0000') : '';\n\n const isDisabled = disabled ?? rootDisabled ?? false;\n\n return (\n <CommandPrimitive.Item\n key={keywordsKey}\n {...itemProps}\n value={value}\n keywords={searchKeywords}\n // cmdk owns aria-selected (the highlighted option); the chosen option is aria-checked.\n aria-checked={isSelected}\n disabled={isDisabled || undefined}\n ref={forwardedRef}\n onSelect={handleSelect}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-ComboboxItem', className)}\n >\n {isSelected ? (\n <span className={classNames('kui-BaseMenuItemIndicator', 'kui-ComboboxItemIndicator')}>\n <ThickCheckIcon className={classNames('kui-BaseMenuItemIndicatorIcon', 'kui-ComboboxItemIndicatorIcon')} />\n </span>\n ) : null}\n <Slottable>{children}</Slottable>\n </CommandPrimitive.Item>\n );\n },\n);\nComboboxItem.displayName = 'Combobox.Item';\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nexport {\n ComboboxRoot as Root,\n ComboboxTrigger as Trigger,\n ComboboxValue as Value,\n ComboboxContent as Content,\n ComboboxInput as Input,\n ComboboxList as List,\n ComboboxEmpty as Empty,\n ComboboxGroup as Group,\n ComboboxLabel as Label,\n ComboboxSeparator as Separator,\n ComboboxItem as Item,\n};\n\nexport type {\n ComboboxRootProps as RootProps,\n ComboboxTriggerProps as TriggerProps,\n ComboboxValueProps as ValueProps,\n ComboboxContentProps as ContentProps,\n ComboboxInputProps as InputProps,\n ComboboxListProps as ListProps,\n ComboboxEmptyProps as EmptyProps,\n ComboboxGroupProps as GroupProps,\n ComboboxLabelProps as LabelProps,\n ComboboxSeparatorProps as SeparatorProps,\n ComboboxItemProps as ItemProps,\n};\n"],
|
|
5
|
-
"mappings": "wbAAA,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,EACC,gBAAC,QAAK,UAAWjE,EAAW,4BAA6B,2BAA2B,GAClF,gBAACuE,EAAA,CAAe,UAAWvE,EAAW,gCAAiC,+BAA+B,EAAG,CAC3G,EACE,KACJ,gBAACwE,EAAA,KAAW9I,CAAS,CACvB,CAEJ,CACF,EACA+H,GAAa,YAAc",
|
|
6
6
|
"names": ["combobox_exports", "__export", "ComboboxContent", "ComboboxEmpty", "ComboboxGroup", "ComboboxInput", "ComboboxItem", "ComboboxLabel", "ComboboxList", "ComboboxRoot", "ComboboxSeparator", "ComboboxTrigger", "ComboboxValue", "React", "classNames", "PopoverPrimitive", "useCallbackRef", "useComposedRefs", "useControllableState", "useLayoutEffect", "CommandPrimitive", "useCommandState", "triggerSizingPropDefs", "comboboxRootPropDefs", "contentSizePropDefs", "comboboxContentPropDefs", "warned", "warnOnce", "message", "createSelectionStore", "initial", "current", "listeners", "next", "listener", "ComboboxContext", "useComboboxContext", "componentName", "ctx", "ComboboxSearchContext", "ComboboxItemContext", "ComboboxContentContext", "useComboboxContentContext", "readElementLabel", "el", "ariaLabel", "labelledBy", "text", "id", "labels", "label", "ComboboxRoot", "props", "children", "sizeProp", "valueProp", "defaultValue", "onValueChange", "openProp", "defaultOpen", "onOpenChange", "placeholder", "searchPlaceholder", "searchValueProp", "defaultSearchValue", "onSearchValueChange", "filter", "shouldFilter", "loop", "disabled", "resetSearchOnSelect", "resetSearchOnClose", "color", "displayValueProp", "rootProps", "size", "useThemeSize", "open", "setOpen", "useControllableState", "value", "setValue", "searchValue", "setSearchValue", "resolvedDisplayValue", "store", "useLayoutEffect", "handleOpenChange", "useCallbackRef", "nextOpen", "onSelect", "nextValue", "triggerRef", "getTriggerLabel", "contextValue", "searchContextValue", "itemContextValue", "PopoverRoot", "ComboboxTrigger", "forwardedRef", "className", "readOnly", "error", "loading", "radius", "onClick", "onKeyDown", "buttonType", "triggerProps", "extractProps", "comboboxTriggerPropDefs", "isDisabled", "resolvedColor", "isBlocked", "isPlaceholder", "composedRef", "useComposedRefs", "handleClick", "event", "handleKeyDown", "defaultContent", "ChevronDownIcon", "PopoverTrigger", "classNames", "requireReactElement", "ComboboxValue", "valueProps", "display", "ComboboxAnnouncer", "count", "useCommandState", "state", "search", "setMessage", "timeout", "VisuallyHidden", "ComboboxContent", "themeContext", "useThemeContext", "forceMount", "container", "onOpenAutoFocus", "_ariaLabel", "ariaLabelledByProp", "contentProps", "triggerLabel", "setTriggerLabel", "contentContextValue", "commandRef", "handleOpenAutoFocus", "command", "initialHighlight", "PopoverPrimitive", "Theme", "CommandPrimitive", "ComboboxInput", "startAdornment", "endAdornment", "inputVariant", "inputProps", "contentContext", "textFieldVariant", "handleSearchChange", "inputField", "ComboboxList", "listProps", "ComboboxEmpty", "emptyProps", "ComboboxGroup", "groupProps", "ComboboxLabel", "idProp", "labelProps", "generatedId", "localRef", "group", "ComboboxSeparator", "separatorProps", "getNodeText", "node", "ComboboxItem", "keywords", "itemProps", "itemContext", "onSelectFromRoot", "rootDisabled", "itemValue", "getIsSelected", "isSelected", "onSelectProp", "handleSelect", "resolvedValue", "searchKeywords", "keywordsKey", "ThickCheckIcon", "Slottable"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as g}from"./chunk-BE7LMBBC.js";import{a as l}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as g}from"./chunk-BE7LMBBC.js";import{a as l}from"./chunk-QGCXTULQ.js";import*as e from"react";import d from"classnames";import{Toggle as P}from"radix-ui";var T=e.forwardRef(({pressed:a,onPressedChange:i,defaultPressed:p,children:t,className:u,...s},m)=>{let{"aria-label":n,"aria-labelledby":o}=s,r=e.useRef(null);e.useEffect(()=>{r.current=null},[o]);let c=e.useCallback(()=>n||(o?(r.current===null&&(r.current=document.getElementById(o)?.textContent||"Toggle"),r.current):typeof t=="string"?t:e.isValidElement(t)&&typeof t.props?.children=="string"?t.props.children:"Toggle"),[n,o,t]),{handlePressedChange:f}=g({pressed:a,onPressedChange:i,getAccessibleName:c,componentName:"Toggle"});return e.createElement(P.Root,{pressed:a,onPressedChange:f,defaultPressed:p,asChild:!0},e.createElement(l,{...s,ref:m,className:d("kui-Toggle",u)},t))});T.displayName="Toggle";export{T as a};
|
|
2
|
+
//# sourceMappingURL=chunk-BOL3VVSN.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/image.props.ts"],
|
|
4
|
+
"sourcesContent": ["import { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst objectFitValues = ['cover', 'contain', 'fill', 'scale-down', 'none'] as const;\n\nconst imagePropDefs = {\n ...radiusPropDef,\n /**\n * How the picture fills its box, as CSS `object-fit`.\n * @link https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit\n */\n fit: { type: 'enum', className: 'kui-r-fit', values: objectFitValues, default: 'cover' },\n} satisfies {\n fit: PropDef<(typeof objectFitValues)[number]>;\n};\n\nexport { imagePropDefs };\n"],
|
|
5
|
+
"mappings": "wCAIA,IAAMA,EAAkB,CAAC,QAAS,UAAW,OAAQ,aAAc,MAAM,EAEnEC,EAAgB,CACpB,GAAGC,EAKH,IAAK,CAAE,KAAM,OAAQ,UAAW,YAAa,OAAQF,EAAiB,QAAS,OAAQ,CACzF",
|
|
6
|
+
"names": ["objectFitValues", "imagePropDefs", "radiusPropDef"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as at}from"./chunk-NLXJZJNN.js";import{g as et,j as tt}from"./chunk-IX5HIHVI.js";import{a as Be}from"./chunk-T62PRLPN.js";import{a as we}from"./chunk-4P6TKZCA.js";import{a as Ze}from"./chunk-R4XJNQX5.js";import{a as ze}from"./chunk-A3YQIJDA.js";import{a as Ie}from"./chunk-BJUCBOGU.js";import{a as De}from"./chunk-AGAQC4HH.js";import{b as U}from"./chunk-FWB47YCH.js";import{d as Qe}from"./chunk-3YLYGKFB.js";import{a as Ot}from"./chunk-OS3FCYZY.js";var Vt={};Ot(Vt,{AttachTrigger:()=>bt,Attachment:()=>$e,AttachmentsRow:()=>mt,InlineEnd:()=>dt,InlineStart:()=>ut,Item:()=>ft,Root:()=>ct,Row:()=>Rt,RowEnd:()=>gt,RowStart:()=>Ct,Send:()=>vt,Textarea:()=>lt});import*as e from"react";import S from"classnames";import{useComposedRefs as rt}from"radix-ui/internal";import{useDropzone as Ht}from"react-dropzone";var je=typeof window<"u"?e.useLayoutEffect:e.useEffect;function nt(t,r){let{placeholder:a}=t;if(!a){r();return}t.placeholder="";try{r()}finally{t.placeholder=a}}var Ft={values:["1","2","3"]},st=e.createContext(null),We=e.createContext(""),F=()=>{let t=e.useContext(st);if(!t)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return t},me=t=>Array.isArray(t)?t:typeof t=="string"?t.split(",").map(r=>r.trim()).filter(Boolean):[],It=(t,r)=>{if(r.length===0)return!0;let a=t.type.toLowerCase(),i=t.name.toLowerCase();for(let c of r){let l=c.toLowerCase();if(l.includes("/")){let[u,d]=l.split("/"),[h,f]=a.split("/");if(u==="*"||u===h&&(d==="*"||d===f))return!0}else if(l.startsWith(".")&&i.endsWith(l))return!0}return!1},zt=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,it=(t,r)=>(r||"").toLowerCase().startsWith("image/")||zt.test(t),Ve=t=>t.trim().length>0,ot=(t,r)=>`${t} ${r}${t===1?"":"s"}`,Dt=0,Bt=()=>`chatbar-attachment-${Date.now()}-${++Dt}`,ct=e.forwardRef((t,r)=>{let{className:a,style:i,children:c,value:l,defaultValue:u="",onValueChange:d,open:h,defaultOpen:f=!1,onOpenChange:g,expandOn:v="both",minLines:C=3,maxLines:w=6,sendMode:I="whenDirty",disabled:b,readOnly:k,onSubmit:D,size:M,variant:z,color:O,radius:H,width:Q,maxWidth:R,attachments:G,defaultAttachments:B,onAttachmentsChange:se,accept:P,multiple:T=!0,maxAttachments:Z,maxFileSize:_,paste:j=!0,pasteAccept:q,clearOnSubmit:V=!0,onAttachmentReject:L,dropzone:N=!0,apiRef:ke,onBlurCapture:pe,notices:he,context:fe,...Se}=t,W=Qe(M,Ft),be=l!=null,[o,y]=e.useState(u),A=be?l:o,ee=h!=null,[X,te]=e.useState(f),ie=ee?h:X,Y="attachments"in t,[ce,Re]=e.useState(()=>B??[]),le=e.useMemo(()=>Y?G??[]:ce,[Y,G,ce]),[Ke,yt]=e.useState({text:"",id:0}),ue=e.useCallback(n=>yt(s=>({text:n,id:s.id+1})),[]),Ue=e.useRef(null),xt=rt(r,Ue),Ee=e.useRef(null),Te=e.useRef(null),de=e.useRef(!1),Ce=e.useRef(!1),ge=e.useRef(void 0),Le=e.useRef(null),Ge=me(P).join(","),Ne=me(q).join(","),Me=e.useMemo(()=>me(Ge),[Ge]),Pt=e.useMemo(()=>Ne?me(Ne):Me,[Ne,Me]),_e={value:A,attachments:le,accepts:Me,pasteAccepts:Pt,multiple:T,maxAttachments:Z,maxFileSize:_,disabled:b,readOnly:k,expandOn:v,isValueControlled:be,isOpenControlled:ee,isAttachmentsControlled:Y,onValueChange:d,onOpenChange:g,onAttachmentsChange:se,onAttachmentReject:L,onSubmit:D},x=e.useRef(_e);x.current=_e;let Oe=e.useRef(null),$=e.useCallback(()=>Oe.current??x.current.attachments,[]),ae=e.useCallback(n=>{x.current.isOpenControlled||te(n),x.current.onOpenChange?.(n)},[]),ve=e.useCallback(n=>{x.current.isValueControlled||y(n),x.current.onValueChange?.(n)},[]),ne=e.useCallback(n=>{Oe.current=n,queueMicrotask(()=>{Oe.current=null}),x.current.isAttachmentsControlled||Re(n),x.current.onAttachmentsChange?.(n)},[]),ye=e.useRef(new Set),oe=e.useCallback((n,s,m=x.current.multiple)=>{let p=x.current;if(p.disabled||p.readOnly||n.length===0)return 0;let K=$(),J=[],re=[],Nt=typeof p.maxAttachments=="number"?Math.max(p.maxAttachments-K.length,0):1/0,Mt=m?1/0:1;for(let E of n){if(J.length>=Nt||J.length>=Mt){re.push({file:E,reason:"count"});continue}if(typeof p.maxFileSize=="number"&&E.size>p.maxFileSize){re.push({file:E,reason:"size"});continue}if(!It(E,s)){re.push({file:E,reason:"type"});continue}let Fe=it(E.name,E.type)?URL.createObjectURL(E):void 0;Fe&&ye.current.add(Fe),J.push({id:Bt(),name:E.name,size:E.size,type:E.type,file:E,url:Fe,status:"idle"})}let Ae=[];return J.length>0&&(ne(K.concat(J)),p.expandOn!=="none"&&ae(!0),Ae.push(`${ot(J.length,"file")} attached.`)),re.length>0&&(p.onAttachmentReject?.(re),Ae.push(`${ot(re.length,"file")} could not be attached.`)),Ae.length>0&&ue(Ae.join(" ")),J.length},[$,ne,ae,ue]),xe=e.useCallback(n=>oe(n,x.current.accepts),[oe]),qe=e.useCallback(n=>oe(n,x.current.pasteAccepts),[oe]),Xe=e.useCallback(n=>{let s=$(),m=s.find(p=>p.id===n);m&&(ne(s.filter(p=>p.id!==n)),ue(`Removed ${m.name}.`))},[$,ne,ue]),Ye=e.useCallback(n=>{let s=x.current;if(s.disabled||s.readOnly)return!1;let m=$();if(!Ve(s.value)&&m.length===0)return!1;let p={value:s.value,attachments:m};if(n&&s.onSubmit)for(let K of m)K.url&&ye.current.delete(K.url);return s.onSubmit?.(p),n&&(ve(""),ne([])),!0},[$,ve,ne]);e.useEffect(()=>{let n=ye.current;if(n.size===0)return;let s=new Set(le.map(m=>m.url));for(let m of Array.from(n))s.has(m)||(URL.revokeObjectURL(m),n.delete(m))},[le]),e.useEffect(()=>{let n=ye.current;return()=>{if(!x.current.isAttachmentsControlled){for(let s of Array.from(n))URL.revokeObjectURL(s);n.clear()}}},[]);let Pe=e.useCallback(n=>{let s=x.current,m=Te.current;if(clearTimeout(ge.current),Ce.current=!1,!m||s.disabled||s.readOnly)return;let p=n?.accept!=null?me(n.accept):s.accepts,K=n?.multiple??s.multiple;Le.current={patterns:p,multiple:K},m.accept=p.join(","),m.multiple=K,de.current=!0,m.click(),setTimeout(()=>{document.hasFocus()&&(de.current=!1)},1e3)},[]),Je=e.useCallback(()=>{Ce.current=!0,clearTimeout(ge.current),ge.current=setTimeout(()=>{Ce.current=!1},800)},[]);e.useEffect(()=>()=>clearTimeout(ge.current),[]),e.useEffect(()=>{let n=Te.current,s=()=>{de.current=!1};return window.addEventListener("focus",s),n?.addEventListener("cancel",s),()=>{window.removeEventListener("focus",s),n?.removeEventListener("cancel",s)}},[]);let At=e.useCallback(n=>{let s=n.currentTarget,m=Array.from(s.files??[]),p=Le.current;oe(m,p?.patterns??x.current.accepts,p?.multiple),de.current=!1,Le.current=null,s.value=""},[oe]),wt=e.useCallback(n=>{pe?.(n);let s=x.current,m=Ue.current;if(!m||s.expandOn==="none")return;let p=n.relatedTarget;p&&m.contains(p)||de.current||Ce.current||!Ve(s.value)&&$().length===0&&ae(!1)},[pe,ae,$]),kt=e.useCallback(n=>{xe(n)},[xe]),{getRootProps:St,isDragActive:Et}=Ht({onDrop:kt,onDragEnter:()=>ue(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!N||b||k}),He=N&&Et;e.useImperativeHandle(ke,()=>({focusTextarea:()=>Ee.current?.focus({preventScroll:!0}),openFilePicker:()=>Pe()}),[Pe]);let Tt=e.useCallback(n=>{if(b||n.pointerType==="mouse"&&n.button!==0)return;let s=n.target;s instanceof Element&&s.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(n.preventDefault(),Ee.current?.focus({preventScroll:!0}))},[b]),Lt=e.useMemo(()=>({open:ie,setOpen:ae,setValue:ve,size:W,expandOn:v,minLines:C,maxLines:w,sendMode:I,disabled:b,readOnly:k,paste:j,clearOnSubmit:V,multiple:T,textareaRef:Ee,attachments:le,removeAttachment:Xe,submit:Ye,appendFiles:xe,appendFilesFromPaste:qe,openFilePicker:Pe,beginFilePickerPress:Je}),[ie,ae,ve,W,v,C,w,I,b,k,j,V,T,le,Xe,Ye,xe,qe,Pe,Je]);return e.createElement(st.Provider,{value:Lt},e.createElement(We.Provider,{value:A},e.createElement(e.Fragment,null,e.createElement("div",{...Se,ref:xt,className:S("kui-ChatbarRoot",`kui-r-size-${W}`,a),style:{position:"relative",width:Q,maxWidth:R,...i},"data-state":ie?"open":"closed","data-disabled":b?"":void 0,"data-readonly":k?"":void 0,"data-drop-active":He?"":void 0,"data-accent-color":O,"data-radius":H,onBlurCapture:wt},e.createElement("input",{ref:Te,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:At}),he?e.createElement("div",{className:"kui-ChatbarNotices"},e.createElement(at.Provider,{value:W},he)):null,e.createElement("div",{...N?St():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Tt},e.createElement("div",{className:S("kui-ChatbarBox",`kui-variant-${z??"raised"}`),style:{position:"relative"},"data-accent-color":O,"data-radius":H},e.createElement("div",{className:"kui-ChatbarGrid"},c),He&&e.createElement("div",{className:"kui-ChatbarDropOverlay","aria-hidden":!0},e.createElement("div",{className:"kui-ChatbarDropContent"},e.createElement(we,{emphasis:"medium",size:W,weight:"medium"},"Drop files here to attach"))))),fe?e.createElement(we,{as:"div",size:W==="3"?"2":"1",emphasis:"medium",className:"kui-ChatbarContext"},fe):null,e.createElement(De,{role:"status","aria-live":"polite"},He?"Drop files here to attach.":e.createElement("span",{key:Ke.id},Ke.text))))))});ct.displayName="Chatbar.Root";var lt=e.forwardRef((t,r)=>{let{className:a,style:i,asChild:c,onFocus:l,onChange:u,onPaste:d,onKeyDown:h,onCompositionStart:f,onCompositionEnd:g,submitOnEnter:v=!1,...C}=t,w=F(),I=e.useContext(We),{open:b,minLines:k,maxLines:D,expandOn:M,disabled:z,readOnly:O,setOpen:H,setValue:Q,textareaRef:R,paste:G,appendFilesFromPaste:B,size:se,submit:P,clearOnSubmit:T}=w,Z=rt(r,R),_=e.useRef(0),j=e.useRef(0),q=e.useRef(!1),V=e.useRef({open:b,minLines:k,maxLines:D});je(()=>{V.current={open:b,minLines:k,maxLines:D}},[b,k,D]);let L=e.useCallback(()=>{let o=R.current;if(!o)return;let y=window.getComputedStyle(o);_.current=parseFloat(y.lineHeight)||20,j.current=(parseFloat(y.paddingTop)||0)+(parseFloat(y.paddingBottom)||0)},[R]),N=e.useCallback((o,y)=>{let{minLines:A,maxLines:ee}=V.current,X=_.current,te=j.current,ie=Math.ceil((y?A:1)*X)+te,Y=Math.ceil((y?ee:1)*X)+te,ce=Math.max(o.scrollHeight,ie);o.style.height=`${Math.min(ce,Y)}px`;let Re=ce>Y;o.style.overflowY=Re?"auto":"hidden",o.style.maxHeight=Re?`${Y}px`:"none"},[]);je(()=>{L()},[L,se]),je(()=>{let o=R.current;o&&(_.current===0&&L(),nt(o,()=>{o.style.height="auto";let y=b;if(!b&&(M==="overflow"||M==="both")){let A=Math.ceil(_.current)+j.current;o.scrollHeight>A+1&&(y=!0,H(!0))}N(o,y)}))},[I,b,M,k,D,se,H,R,L,N]),e.useEffect(()=>{let o=R.current;if(!o||typeof ResizeObserver>"u")return;let y=-1,A=new ResizeObserver(ee=>{let X=ee[0]?.contentRect.width??0;if(X===y)return;let te=y===-1;y=X,!te&&(L(),nt(o,()=>{o.style.height="auto",N(o,V.current.open)}))});return A.observe(o),()=>A.disconnect()},[R,L,N]),e.useEffect(()=>{},[]);let ke=e.useCallback(o=>{l?.(o),!(z||O)&&(M==="focus"||M==="both")&&!b&&H(!0)},[z,O,M,b,H,l]),pe=e.useCallback(o=>{Q(o.currentTarget.value),u?.(o)},[Q,u]),he=e.useCallback(o=>{if(d?.(o),o.defaultPrevented||!G||z||O)return;let y=Array.from(o.clipboardData?.items??[]).filter(A=>A.kind==="file").map(A=>A.getAsFile()).filter(A=>!!A);y.length!==0&&B(y)>0&&o.preventDefault()},[G,z,O,d,B]),fe=e.useCallback(o=>{q.current=!0,f?.(o)},[f]),Se=e.useCallback(o=>{q.current=!1,g?.(o)},[g]),W=e.useCallback(o=>{h?.(o),!(o.defaultPrevented||!v)&&(o.key!=="Enter"||o.shiftKey||o.altKey||o.ctrlKey||o.metaKey||q.current||o.nativeEvent.isComposing||o.nativeEvent.keyCode===229||(o.preventDefault(),P(T)))},[v,h,P,T]),be=c?U:"textarea";return e.createElement("div",{className:S("kui-ChatbarField","kui-ChatbarTextarea",a)},e.createElement(be,{...C,ref:Z,className:"kui-ChatbarInput",value:I,onChange:pe,onFocus:ke,onPaste:he,onKeyDown:W,onCompositionStart:fe,onCompositionEnd:Se,disabled:z,readOnly:O,rows:b?k:1,spellCheck:C.spellCheck??!0,autoCorrect:C.autoCorrect??"on",style:i}))});lt.displayName="Chatbar.Textarea";var ut=e.forwardRef((t,r)=>{let{children:a,asChild:i,className:c,...l}=t;return F().open?null:e.createElement(i?U:"div",{...l,ref:r,className:S("kui-ChatbarInlineStart",c)},a)});ut.displayName="Chatbar.InlineStart";var dt=e.forwardRef((t,r)=>{let{children:a,asChild:i,className:c,...l}=t;return F().open?null:e.createElement(i?U:"div",{...l,ref:r,className:S("kui-ChatbarInlineEnd",c)},a)});dt.displayName="Chatbar.InlineEnd";var mt=e.forwardRef((t,r)=>{let{asChild:a,forceMount:i,renderAttachment:c,className:l,children:u,...d}=t,h=F(),f=e.Children.toArray(u).length>0;return h.attachments.length===0&&!f&&!i?null:e.createElement("div",null,e.createElement(a?U:"div",{...d,ref:r,className:S("kui-ChatbarAttachmentsRow",l),role:"list","aria-label":d["aria-label"]??"Attachments"},e.createElement(Ze,{className:"kui-ChatbarScrollArea",scrollbars:"horizontal"},e.createElement(Ie,{align:"center",gap:"3",minWidth:"fit-content"},h.attachments.map(v=>e.createElement($e,{key:v.id,attachment:v,asChild:!!c},c?.(v))),u))))});mt.displayName="Chatbar.AttachmentsRow";function pt(t,r){let a=t.closest('[role="listitem"]'),i=a?.parentElement?Array.from(a.parentElement.children):[],c=a?i.indexOf(a):-1,u=(i[c+1]??i[c-1])?.querySelector(".kui-ChatbarItemRemove");u?u.focus():r.current?.focus({preventScroll:!0})}var ht=({lead:t,leadKind:r,label:a,detail:i,removeLabel:c,onRemove:l})=>{let u=F();return e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-ChatbarItemLead","data-kind":r,"aria-hidden":!0},t),e.createElement(we,{className:"kui-ChatbarItemLabel",size:u.size,truncate:!0},a,i?e.createElement(De,null,", ",i):null),l&&e.createElement(Be,{iconOnly:!0,className:"kui-ChatbarItemRemove","aria-label":c,size:"1",variant:"ghost",color:"gray",onClick:l},e.createElement(et,null)))},jt={uploading:"uploading",error:"failed to upload"},$e=e.forwardRef((t,r)=>{let{attachment:a,asChild:i,className:c,children:l,...u}=t,d=F(),h=i?U:"div",f=!!a.url&&it(a.name,a.type),g=`${Math.ceil(a.size/1024)} KB`,v=a.status?jt[a.status]:void 0,C=d.disabled||d.readOnly,w=b=>{pt(b.currentTarget,d.textareaRef),d.removeAttachment(a.id)},I=a.status==="uploading"?e.createElement(ze,null):f?e.createElement("img",{className:"kui-ChatbarAttachmentImage",src:a.url,alt:""}):e.createElement(tt,null);return e.createElement(h,{...u,ref:r,className:S(l?"kui-ChatbarAttachment":"kui-ChatbarAttachment kui-ChatbarItem",c),role:"listitem","data-kind":f?"image":"file","data-status":a.status,title:a.name},l??e.createElement(ht,{lead:I,leadKind:f&&a.status!=="uploading"?"image":"icon",label:a.name,detail:v?`${g}, ${v}`:g,removeLabel:`Remove ${a.name}`,onRemove:C?void 0:w}))});$e.displayName="Chatbar.Attachment";var ft=e.forwardRef((t,r)=>{let{children:a,icon:i,image:c,color:l,onRemove:u,removeLabel:d,className:h,...f}=t,g=F(),v=g.disabled||g.readOnly,C=u?w=>{pt(w.currentTarget,g.textareaRef),u()}:void 0;return e.createElement("div",{...f,ref:r,className:S("kui-ChatbarItem",h),role:"listitem","data-accent-color":c?void 0:l??"gray",title:a},e.createElement(ht,{lead:c?e.createElement("img",{className:"kui-ChatbarAttachmentImage",src:c,alt:""}):i,leadKind:c?"image":"icon",label:a,removeLabel:d??`Remove ${a}`,onRemove:v?void 0:C}))});ft.displayName="Chatbar.Item";var bt=e.forwardRef((t,r)=>{let{asChild:a,accept:i,multiple:c,disabled:l,onPointerDown:u,onClick:d,...h}=t,f=F(),g=l||f.disabled||f.readOnly;return e.createElement(a?U:"button",{...h,ref:r,className:S("kui-ChatbarAttachTrigger",h.className),type:h.type??"button","aria-label":h["aria-label"]??"Add attachments",disabled:g,onPointerDown:C=>{u?.(C),!g&&!C.defaultPrevented&&f.beginFilePickerPress()},onClick:C=>{d?.(C),!(g||C.defaultPrevented)&&f.openFilePicker({accept:i,multiple:c})}})});bt.displayName="Chatbar.AttachTrigger";var Rt=e.forwardRef((t,r)=>{let{asChild:a,children:i,className:c,...l}=t;return F().open?e.createElement("div",null,e.createElement(a?U:"div",{...l,ref:r,className:S("kui-ChatbarRow",c)},e.createElement(Ie,{align:"center",justify:"between",width:"100%"},i))):null});Rt.displayName="Chatbar.Row";var Ct=e.forwardRef((t,r)=>{let{className:a,...i}=t;return e.createElement("div",{...i,ref:r,className:S("kui-ChatbarRowStart",a)})});Ct.displayName="Chatbar.RowStart";var gt=e.forwardRef((t,r)=>{let{className:a,...i}=t;return e.createElement("div",{...i,ref:r,className:S("kui-ChatbarRowEnd",a)})});gt.displayName="Chatbar.RowEnd";var vt=e.forwardRef((t,r)=>{let{asChild:a,clearOnSend:i,disabled:c,children:l,style:u,className:d,size:h,variant:f,emphasis:g,tabIndex:v,onClick:C,status:w="ready",onStop:I,onRetry:b,stopLabel:k="Stop",retryLabel:D="Retry",stopIcon:M,retryIcon:z,"aria-label":O,"aria-labelledby":H,...Q}=t,R=F(),G=e.useContext(We),B=Ve(G)||R.attachments.length>0,P=B?"send":w==="submitted"||w==="streaming"?"stop":w==="error"?"retry":"send";if(R.sendMode==="never"&&P==="send")return null;let T=P!=="send"||R.sendMode==="always"||B,Z=P==="send"?c||R.disabled||R.readOnly||!B:c||R.disabled,j=P==="stop"?{"aria-label":k}:P==="retry"?{"aria-label":D}:H?{"aria-labelledby":H}:{"aria-label":O??"Send"},q=L=>{if(C?.(L),L.defaultPrevented||Z)return;if(P==="stop"){I?.();return}if(P==="retry"){b?.();return}let N=i??R.clearOnSubmit;R.submit(N)&&N&&R.textareaRef.current?.focus({preventScroll:!0})},V=P==="stop"?M??(w==="submitted"?e.createElement(ze,null):e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},e.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):P==="retry"?z??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),e.createElement("path",{d:"M3 3v5h5"})):l??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M5 12h14"}),e.createElement("path",{d:"m12 5 7 7-7 7"}));return e.createElement(Be,{iconOnly:!0,...Q,ref:r,size:h??R.size,...g?{emphasis:g}:{variant:f??(R.open||P!=="send"?"solid":"ghost")},disabled:Z,className:S("kui-ChatbarSend",d),style:{opacity:T?1:0,pointerEvents:T?void 0:"none",...u},"aria-hidden":T?void 0:!0,tabIndex:T?v:-1,asChild:a,onClick:q,"data-status":w,"data-mode":P,...j},V)});vt.displayName="Chatbar.Send";export{ct as a,lt as b,ut as c,dt as d,mt as e,$e as f,ft as g,bt as h,Rt as i,Ct as j,gt as k,vt as l,Vt as m};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as at}from"./chunk-L2R62BOB.js";import{a as Be}from"./chunk-AGAQC4HH.js";import{g as et,j as tt}from"./chunk-IX5HIHVI.js";import{a as De}from"./chunk-QGCXTULQ.js";import{a as we}from"./chunk-4P6TKZCA.js";import{a as Ze}from"./chunk-R4XJNQX5.js";import{a as ze}from"./chunk-UE3HATOA.js";import{a as Ie}from"./chunk-BJUCBOGU.js";import{b as U}from"./chunk-FWB47YCH.js";import{d as Qe}from"./chunk-3YLYGKFB.js";import{a as Ot}from"./chunk-OS3FCYZY.js";var Vt={};Ot(Vt,{AttachTrigger:()=>bt,Attachment:()=>$e,AttachmentsRow:()=>mt,InlineEnd:()=>dt,InlineStart:()=>ut,Item:()=>ft,Root:()=>ct,Row:()=>Rt,RowEnd:()=>gt,RowStart:()=>Ct,Send:()=>vt,Textarea:()=>lt});import*as e from"react";import S from"classnames";import{useComposedRefs as rt}from"radix-ui/internal";import{useDropzone as Ht}from"react-dropzone";var je=typeof window<"u"?e.useLayoutEffect:e.useEffect;function nt(t,r){let{placeholder:a}=t;if(!a){r();return}t.placeholder="";try{r()}finally{t.placeholder=a}}var Ft={values:["1","2","3"]},st=e.createContext(null),We=e.createContext(""),F=()=>{let t=e.useContext(st);if(!t)throw new Error("Chatbar context not found. Wrap parts in <Chatbar.Root>.");return t},me=t=>Array.isArray(t)?t:typeof t=="string"?t.split(",").map(r=>r.trim()).filter(Boolean):[],It=(t,r)=>{if(r.length===0)return!0;let a=t.type.toLowerCase(),i=t.name.toLowerCase();for(let c of r){let l=c.toLowerCase();if(l.includes("/")){let[u,d]=l.split("/"),[h,f]=a.split("/");if(u==="*"||u===h&&(d==="*"||d===f))return!0}else if(l.startsWith(".")&&i.endsWith(l))return!0}return!1},zt=/\.(png|jpe?g|gif|webp|bmp|svg|avif)$/i,it=(t,r)=>(r||"").toLowerCase().startsWith("image/")||zt.test(t),Ve=t=>t.trim().length>0,ot=(t,r)=>`${t} ${r}${t===1?"":"s"}`,Dt=0,Bt=()=>`chatbar-attachment-${Date.now()}-${++Dt}`,ct=e.forwardRef((t,r)=>{let{className:a,style:i,children:c,value:l,defaultValue:u="",onValueChange:d,open:h,defaultOpen:f=!1,onOpenChange:g,expandOn:v="both",minLines:C=3,maxLines:w=6,sendMode:I="whenDirty",disabled:b,readOnly:k,onSubmit:D,size:M,variant:z,color:O,radius:H,width:Q,maxWidth:R,attachments:G,defaultAttachments:B,onAttachmentsChange:se,accept:P,multiple:T=!0,maxAttachments:Z,maxFileSize:_,paste:j=!0,pasteAccept:q,clearOnSubmit:V=!0,onAttachmentReject:L,dropzone:N=!0,apiRef:ke,onBlurCapture:pe,notices:he,context:fe,...Se}=t,W=Qe(M,Ft),be=l!=null,[o,y]=e.useState(u),A=be?l:o,ee=h!=null,[X,te]=e.useState(f),ie=ee?h:X,Y="attachments"in t,[ce,Re]=e.useState(()=>B??[]),le=e.useMemo(()=>Y?G??[]:ce,[Y,G,ce]),[Ke,yt]=e.useState({text:"",id:0}),ue=e.useCallback(n=>yt(s=>({text:n,id:s.id+1})),[]),Ue=e.useRef(null),xt=rt(r,Ue),Ee=e.useRef(null),Te=e.useRef(null),de=e.useRef(!1),Ce=e.useRef(!1),ge=e.useRef(void 0),Le=e.useRef(null),Ge=me(P).join(","),Ne=me(q).join(","),Me=e.useMemo(()=>me(Ge),[Ge]),Pt=e.useMemo(()=>Ne?me(Ne):Me,[Ne,Me]),_e={value:A,attachments:le,accepts:Me,pasteAccepts:Pt,multiple:T,maxAttachments:Z,maxFileSize:_,disabled:b,readOnly:k,expandOn:v,isValueControlled:be,isOpenControlled:ee,isAttachmentsControlled:Y,onValueChange:d,onOpenChange:g,onAttachmentsChange:se,onAttachmentReject:L,onSubmit:D},x=e.useRef(_e);x.current=_e;let Oe=e.useRef(null),$=e.useCallback(()=>Oe.current??x.current.attachments,[]),ae=e.useCallback(n=>{x.current.isOpenControlled||te(n),x.current.onOpenChange?.(n)},[]),ve=e.useCallback(n=>{x.current.isValueControlled||y(n),x.current.onValueChange?.(n)},[]),ne=e.useCallback(n=>{Oe.current=n,queueMicrotask(()=>{Oe.current=null}),x.current.isAttachmentsControlled||Re(n),x.current.onAttachmentsChange?.(n)},[]),ye=e.useRef(new Set),oe=e.useCallback((n,s,m=x.current.multiple)=>{let p=x.current;if(p.disabled||p.readOnly||n.length===0)return 0;let K=$(),J=[],re=[],Nt=typeof p.maxAttachments=="number"?Math.max(p.maxAttachments-K.length,0):1/0,Mt=m?1/0:1;for(let E of n){if(J.length>=Nt||J.length>=Mt){re.push({file:E,reason:"count"});continue}if(typeof p.maxFileSize=="number"&&E.size>p.maxFileSize){re.push({file:E,reason:"size"});continue}if(!It(E,s)){re.push({file:E,reason:"type"});continue}let Fe=it(E.name,E.type)?URL.createObjectURL(E):void 0;Fe&&ye.current.add(Fe),J.push({id:Bt(),name:E.name,size:E.size,type:E.type,file:E,url:Fe,status:"idle"})}let Ae=[];return J.length>0&&(ne(K.concat(J)),p.expandOn!=="none"&&ae(!0),Ae.push(`${ot(J.length,"file")} attached.`)),re.length>0&&(p.onAttachmentReject?.(re),Ae.push(`${ot(re.length,"file")} could not be attached.`)),Ae.length>0&&ue(Ae.join(" ")),J.length},[$,ne,ae,ue]),xe=e.useCallback(n=>oe(n,x.current.accepts),[oe]),qe=e.useCallback(n=>oe(n,x.current.pasteAccepts),[oe]),Xe=e.useCallback(n=>{let s=$(),m=s.find(p=>p.id===n);m&&(ne(s.filter(p=>p.id!==n)),ue(`Removed ${m.name}.`))},[$,ne,ue]),Ye=e.useCallback(n=>{let s=x.current;if(s.disabled||s.readOnly)return!1;let m=$();if(!Ve(s.value)&&m.length===0)return!1;let p={value:s.value,attachments:m};if(n&&s.onSubmit)for(let K of m)K.url&&ye.current.delete(K.url);return s.onSubmit?.(p),n&&(ve(""),ne([])),!0},[$,ve,ne]);e.useEffect(()=>{let n=ye.current;if(n.size===0)return;let s=new Set(le.map(m=>m.url));for(let m of Array.from(n))s.has(m)||(URL.revokeObjectURL(m),n.delete(m))},[le]),e.useEffect(()=>{let n=ye.current;return()=>{if(!x.current.isAttachmentsControlled){for(let s of Array.from(n))URL.revokeObjectURL(s);n.clear()}}},[]);let Pe=e.useCallback(n=>{let s=x.current,m=Te.current;if(clearTimeout(ge.current),Ce.current=!1,!m||s.disabled||s.readOnly)return;let p=n?.accept!=null?me(n.accept):s.accepts,K=n?.multiple??s.multiple;Le.current={patterns:p,multiple:K},m.accept=p.join(","),m.multiple=K,de.current=!0,m.click(),setTimeout(()=>{document.hasFocus()&&(de.current=!1)},1e3)},[]),Je=e.useCallback(()=>{Ce.current=!0,clearTimeout(ge.current),ge.current=setTimeout(()=>{Ce.current=!1},800)},[]);e.useEffect(()=>()=>clearTimeout(ge.current),[]),e.useEffect(()=>{let n=Te.current,s=()=>{de.current=!1};return window.addEventListener("focus",s),n?.addEventListener("cancel",s),()=>{window.removeEventListener("focus",s),n?.removeEventListener("cancel",s)}},[]);let At=e.useCallback(n=>{let s=n.currentTarget,m=Array.from(s.files??[]),p=Le.current;oe(m,p?.patterns??x.current.accepts,p?.multiple),de.current=!1,Le.current=null,s.value=""},[oe]),wt=e.useCallback(n=>{pe?.(n);let s=x.current,m=Ue.current;if(!m||s.expandOn==="none")return;let p=n.relatedTarget;p&&m.contains(p)||de.current||Ce.current||!Ve(s.value)&&$().length===0&&ae(!1)},[pe,ae,$]),kt=e.useCallback(n=>{xe(n)},[xe]),{getRootProps:St,isDragActive:Et}=Ht({onDrop:kt,onDragEnter:()=>ue(""),noClick:!0,noKeyboard:!0,noPaste:!0,disabled:!N||b||k}),He=N&&Et;e.useImperativeHandle(ke,()=>({focusTextarea:()=>Ee.current?.focus({preventScroll:!0}),openFilePicker:()=>Pe()}),[Pe]);let Tt=e.useCallback(n=>{if(b||n.pointerType==="mouse"&&n.button!==0)return;let s=n.target;s instanceof Element&&s.closest('button, [role="button"], a[href], input, textarea, select, [contenteditable], [tabindex]:not([tabindex="-1"])')||(n.preventDefault(),Ee.current?.focus({preventScroll:!0}))},[b]),Lt=e.useMemo(()=>({open:ie,setOpen:ae,setValue:ve,size:W,expandOn:v,minLines:C,maxLines:w,sendMode:I,disabled:b,readOnly:k,paste:j,clearOnSubmit:V,multiple:T,textareaRef:Ee,attachments:le,removeAttachment:Xe,submit:Ye,appendFiles:xe,appendFilesFromPaste:qe,openFilePicker:Pe,beginFilePickerPress:Je}),[ie,ae,ve,W,v,C,w,I,b,k,j,V,T,le,Xe,Ye,xe,qe,Pe,Je]);return e.createElement(st.Provider,{value:Lt},e.createElement(We.Provider,{value:A},e.createElement(e.Fragment,null,e.createElement("div",{...Se,ref:xt,className:S("kui-ChatbarRoot",`kui-r-size-${W}`,a),style:{position:"relative",width:Q,maxWidth:R,...i},"data-state":ie?"open":"closed","data-disabled":b?"":void 0,"data-readonly":k?"":void 0,"data-drop-active":He?"":void 0,"data-accent-color":O,"data-radius":H,onBlurCapture:wt},e.createElement("input",{ref:Te,type:"file",tabIndex:-1,"aria-hidden":!0,style:{display:"none"},onChange:At}),he?e.createElement("div",{className:"kui-ChatbarNotices"},e.createElement(at.Provider,{value:W},he)):null,e.createElement("div",{...N?St():{},style:{width:"100%",flex:"1 1 auto",minHeight:0},onPointerDown:Tt},e.createElement("div",{className:S("kui-ChatbarBox",`kui-variant-${z??"raised"}`),style:{position:"relative"},"data-accent-color":O,"data-radius":H},e.createElement("div",{className:"kui-ChatbarGrid"},c),He&&e.createElement("div",{className:"kui-ChatbarDropOverlay","aria-hidden":!0},e.createElement("div",{className:"kui-ChatbarDropContent"},e.createElement(we,{emphasis:"medium",size:W,weight:"medium"},"Drop files here to attach"))))),fe?e.createElement(we,{as:"div",size:W==="3"?"2":"1",emphasis:"medium",className:"kui-ChatbarContext"},fe):null,e.createElement(Be,{role:"status","aria-live":"polite"},He?"Drop files here to attach.":e.createElement("span",{key:Ke.id},Ke.text))))))});ct.displayName="Chatbar.Root";var lt=e.forwardRef((t,r)=>{let{className:a,style:i,asChild:c,onFocus:l,onChange:u,onPaste:d,onKeyDown:h,onCompositionStart:f,onCompositionEnd:g,submitOnEnter:v=!1,...C}=t,w=F(),I=e.useContext(We),{open:b,minLines:k,maxLines:D,expandOn:M,disabled:z,readOnly:O,setOpen:H,setValue:Q,textareaRef:R,paste:G,appendFilesFromPaste:B,size:se,submit:P,clearOnSubmit:T}=w,Z=rt(r,R),_=e.useRef(0),j=e.useRef(0),q=e.useRef(!1),V=e.useRef({open:b,minLines:k,maxLines:D});je(()=>{V.current={open:b,minLines:k,maxLines:D}},[b,k,D]);let L=e.useCallback(()=>{let o=R.current;if(!o)return;let y=window.getComputedStyle(o);_.current=parseFloat(y.lineHeight)||20,j.current=(parseFloat(y.paddingTop)||0)+(parseFloat(y.paddingBottom)||0)},[R]),N=e.useCallback((o,y)=>{let{minLines:A,maxLines:ee}=V.current,X=_.current,te=j.current,ie=Math.ceil((y?A:1)*X)+te,Y=Math.ceil((y?ee:1)*X)+te,ce=Math.max(o.scrollHeight,ie);o.style.height=`${Math.min(ce,Y)}px`;let Re=ce>Y;o.style.overflowY=Re?"auto":"hidden",o.style.maxHeight=Re?`${Y}px`:"none"},[]);je(()=>{L()},[L,se]),je(()=>{let o=R.current;o&&(_.current===0&&L(),nt(o,()=>{o.style.height="auto";let y=b;if(!b&&(M==="overflow"||M==="both")){let A=Math.ceil(_.current)+j.current;o.scrollHeight>A+1&&(y=!0,H(!0))}N(o,y)}))},[I,b,M,k,D,se,H,R,L,N]),e.useEffect(()=>{let o=R.current;if(!o||typeof ResizeObserver>"u")return;let y=-1,A=new ResizeObserver(ee=>{let X=ee[0]?.contentRect.width??0;if(X===y)return;let te=y===-1;y=X,!te&&(L(),nt(o,()=>{o.style.height="auto",N(o,V.current.open)}))});return A.observe(o),()=>A.disconnect()},[R,L,N]),e.useEffect(()=>{},[]);let ke=e.useCallback(o=>{l?.(o),!(z||O)&&(M==="focus"||M==="both")&&!b&&H(!0)},[z,O,M,b,H,l]),pe=e.useCallback(o=>{Q(o.currentTarget.value),u?.(o)},[Q,u]),he=e.useCallback(o=>{if(d?.(o),o.defaultPrevented||!G||z||O)return;let y=Array.from(o.clipboardData?.items??[]).filter(A=>A.kind==="file").map(A=>A.getAsFile()).filter(A=>!!A);y.length!==0&&B(y)>0&&o.preventDefault()},[G,z,O,d,B]),fe=e.useCallback(o=>{q.current=!0,f?.(o)},[f]),Se=e.useCallback(o=>{q.current=!1,g?.(o)},[g]),W=e.useCallback(o=>{h?.(o),!(o.defaultPrevented||!v)&&(o.key!=="Enter"||o.shiftKey||o.altKey||o.ctrlKey||o.metaKey||q.current||o.nativeEvent.isComposing||o.nativeEvent.keyCode===229||(o.preventDefault(),P(T)))},[v,h,P,T]),be=c?U:"textarea";return e.createElement("div",{className:S("kui-ChatbarField","kui-ChatbarTextarea",a)},e.createElement(be,{...C,ref:Z,className:"kui-ChatbarInput",value:I,onChange:pe,onFocus:ke,onPaste:he,onKeyDown:W,onCompositionStart:fe,onCompositionEnd:Se,disabled:z,readOnly:O,rows:b?k:1,spellCheck:C.spellCheck??!0,autoCorrect:C.autoCorrect??"on",style:i}))});lt.displayName="Chatbar.Textarea";var ut=e.forwardRef((t,r)=>{let{children:a,asChild:i,className:c,...l}=t;return F().open?null:e.createElement(i?U:"div",{...l,ref:r,className:S("kui-ChatbarInlineStart",c)},a)});ut.displayName="Chatbar.InlineStart";var dt=e.forwardRef((t,r)=>{let{children:a,asChild:i,className:c,...l}=t;return F().open?null:e.createElement(i?U:"div",{...l,ref:r,className:S("kui-ChatbarInlineEnd",c)},a)});dt.displayName="Chatbar.InlineEnd";var mt=e.forwardRef((t,r)=>{let{asChild:a,forceMount:i,renderAttachment:c,className:l,children:u,...d}=t,h=F(),f=e.Children.toArray(u).length>0;return h.attachments.length===0&&!f&&!i?null:e.createElement("div",null,e.createElement(a?U:"div",{...d,ref:r,className:S("kui-ChatbarAttachmentsRow",l),role:"list","aria-label":d["aria-label"]??"Attachments"},e.createElement(Ze,{className:"kui-ChatbarScrollArea",scrollbars:"horizontal"},e.createElement(Ie,{align:"center",gap:"3",minWidth:"fit-content"},h.attachments.map(v=>e.createElement($e,{key:v.id,attachment:v,asChild:!!c},c?.(v))),u))))});mt.displayName="Chatbar.AttachmentsRow";function pt(t,r){let a=t.closest('[role="listitem"]'),i=a?.parentElement?Array.from(a.parentElement.children):[],c=a?i.indexOf(a):-1,u=(i[c+1]??i[c-1])?.querySelector(".kui-ChatbarItemRemove");u?u.focus():r.current?.focus({preventScroll:!0})}var ht=({lead:t,leadKind:r,label:a,detail:i,removeLabel:c,onRemove:l})=>{let u=F();return e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-ChatbarItemLead","data-kind":r,"aria-hidden":!0},t),e.createElement(we,{className:"kui-ChatbarItemLabel",size:u.size,truncate:!0},a,i?e.createElement(Be,null,", ",i):null),l&&e.createElement(De,{iconOnly:!0,className:"kui-ChatbarItemRemove","aria-label":c,size:"1",variant:"ghost",color:"gray",onClick:l},e.createElement(et,null)))},jt={uploading:"uploading",error:"failed to upload"},$e=e.forwardRef((t,r)=>{let{attachment:a,asChild:i,className:c,children:l,...u}=t,d=F(),h=i?U:"div",f=!!a.url&&it(a.name,a.type),g=`${Math.ceil(a.size/1024)} KB`,v=a.status?jt[a.status]:void 0,C=d.disabled||d.readOnly,w=b=>{pt(b.currentTarget,d.textareaRef),d.removeAttachment(a.id)},I=a.status==="uploading"?e.createElement(ze,null):f?e.createElement("img",{className:"kui-ChatbarAttachmentImage",src:a.url,alt:""}):e.createElement(tt,null);return e.createElement(h,{...u,ref:r,className:S(l?"kui-ChatbarAttachment":"kui-ChatbarAttachment kui-ChatbarItem",c),role:"listitem","data-kind":f?"image":"file","data-status":a.status,title:a.name},l??e.createElement(ht,{lead:I,leadKind:f&&a.status!=="uploading"?"image":"icon",label:a.name,detail:v?`${g}, ${v}`:g,removeLabel:`Remove ${a.name}`,onRemove:C?void 0:w}))});$e.displayName="Chatbar.Attachment";var ft=e.forwardRef((t,r)=>{let{children:a,icon:i,image:c,color:l,onRemove:u,removeLabel:d,className:h,...f}=t,g=F(),v=g.disabled||g.readOnly,C=u?w=>{pt(w.currentTarget,g.textareaRef),u()}:void 0;return e.createElement("div",{...f,ref:r,className:S("kui-ChatbarItem",h),role:"listitem","data-accent-color":c?void 0:l??"gray",title:a},e.createElement(ht,{lead:c?e.createElement("img",{className:"kui-ChatbarAttachmentImage",src:c,alt:""}):i,leadKind:c?"image":"icon",label:a,removeLabel:d??`Remove ${a}`,onRemove:v?void 0:C}))});ft.displayName="Chatbar.Item";var bt=e.forwardRef((t,r)=>{let{asChild:a,accept:i,multiple:c,disabled:l,onPointerDown:u,onClick:d,...h}=t,f=F(),g=l||f.disabled||f.readOnly;return e.createElement(a?U:"button",{...h,ref:r,className:S("kui-ChatbarAttachTrigger",h.className),type:h.type??"button","aria-label":h["aria-label"]??"Add attachments",disabled:g,onPointerDown:C=>{u?.(C),!g&&!C.defaultPrevented&&f.beginFilePickerPress()},onClick:C=>{d?.(C),!(g||C.defaultPrevented)&&f.openFilePicker({accept:i,multiple:c})}})});bt.displayName="Chatbar.AttachTrigger";var Rt=e.forwardRef((t,r)=>{let{asChild:a,children:i,className:c,...l}=t;return F().open?e.createElement("div",null,e.createElement(a?U:"div",{...l,ref:r,className:S("kui-ChatbarRow",c)},e.createElement(Ie,{align:"center",justify:"between",width:"100%"},i))):null});Rt.displayName="Chatbar.Row";var Ct=e.forwardRef((t,r)=>{let{className:a,...i}=t;return e.createElement("div",{...i,ref:r,className:S("kui-ChatbarRowStart",a)})});Ct.displayName="Chatbar.RowStart";var gt=e.forwardRef((t,r)=>{let{className:a,...i}=t;return e.createElement("div",{...i,ref:r,className:S("kui-ChatbarRowEnd",a)})});gt.displayName="Chatbar.RowEnd";var vt=e.forwardRef((t,r)=>{let{asChild:a,clearOnSend:i,disabled:c,children:l,style:u,className:d,size:h,variant:f,emphasis:g,tabIndex:v,onClick:C,status:w="ready",onStop:I,onRetry:b,stopLabel:k="Stop",retryLabel:D="Retry",stopIcon:M,retryIcon:z,"aria-label":O,"aria-labelledby":H,...Q}=t,R=F(),G=e.useContext(We),B=Ve(G)||R.attachments.length>0,P=B?"send":w==="submitted"||w==="streaming"?"stop":w==="error"?"retry":"send";if(R.sendMode==="never"&&P==="send")return null;let T=P!=="send"||R.sendMode==="always"||B,Z=P==="send"?c||R.disabled||R.readOnly||!B:c||R.disabled,j=P==="stop"?{"aria-label":k}:P==="retry"?{"aria-label":D}:H?{"aria-labelledby":H}:{"aria-label":O??"Send"},q=L=>{if(C?.(L),L.defaultPrevented||Z)return;if(P==="stop"){I?.();return}if(P==="retry"){b?.();return}let N=i??R.clearOnSubmit;R.submit(N)&&N&&R.textareaRef.current?.focus({preventScroll:!0})},V=P==="stop"?M??(w==="submitted"?e.createElement(ze,null):e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0},e.createElement("rect",{x:"7",y:"7",width:"10",height:"10",rx:"2"}))):P==="retry"?z??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M3 12a9 9 0 1 0 3-6.7L3 8"}),e.createElement("path",{d:"M3 3v5h5"})):l??e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e.createElement("path",{d:"M5 12h14"}),e.createElement("path",{d:"m12 5 7 7-7 7"}));return e.createElement(De,{iconOnly:!0,...Q,ref:r,size:h??R.size,...g?{emphasis:g}:{variant:f??(R.open||P!=="send"?"solid":"ghost")},disabled:Z,className:S("kui-ChatbarSend",d),style:{opacity:T?1:0,pointerEvents:T?void 0:"none",...u},"aria-hidden":T?void 0:!0,tabIndex:T?v:-1,asChild:a,onClick:q,"data-status":w,"data-mode":P,...j},V)});vt.displayName="Chatbar.Send";export{ct as a,lt as b,ut as c,dt as d,mt as e,$e as f,ft as g,bt as h,Rt as i,Ct as j,gt as k,vt as l,Vt as m};
|
|
2
|
+
//# sourceMappingURL=chunk-FYT7TYGS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as T}from"./chunk-PJR6GRZC.js";import{e as C}from"./chunk-3YLYGKFB.js";import{a as P}from"./chunk-ELAW7ZUG.js";import*as t from"react";import G from"classnames";import{Slider as b}from"radix-ui";var L=t.forwardRef((x,N)=>{let v=C(x,T.size),{className:A,color:V,radius:M,tabIndex:h,...n}=P(v,T),{ticks:s,showTickLabels:D,snapToTicks:p,unit:i}=v,u=n.min??0,o=n.max??100,c=n.value??n.defaultValue??[u],y=Array.isArray(c)&&c.length>1,E=n.step,l=t.useMemo(()=>s?[...s].sort((e,r)=>e.value-r.value):[],[s]),R=t.useCallback(e=>{if(!p||!l.length)return e;let r=0,a=l.length-1;if(e<=l[r].value)return l[r].value;if(e>=l[a].value)return l[a].value;for(;r<=a;){let f=Math.floor((r+a)/2);if(l[f].value===e)return e;l[f].value<e?r=f+1:a=f-1}let w=Math.abs(e-l[a].value),j=Math.abs(e-l[r].value);return w<=j?l[a].value:l[r].value},[p,l]),S=t.useCallback(e=>{let r=a=>i?`${a} ${i}`:a.toString();return e.length===1?`${r(e[0])} out of ${r(o)}`:e.length===2?`${r(e[0])} to ${r(e[1])} out of ${r(o)}`:`${e.map(r).join(", ")} out of ${r(o)}`},[i,o]),$=t.useMemo(()=>s?s.map((e,r)=>({...e,percentage:(e.value-u)/(o-u)*100,index:r})):null,[s,u,o]),m=t.useRef(null),d=t.useRef(null),{onValueChange:k}=n,g=t.useCallback(e=>{let r=p&&s?e.map(a=>R(a)):e;if(m.current){let a=S(r);m.current.textContent=a,d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{m.current&&(m.current.textContent="")},1e3)}k?.(r)},[p,s,R,S,k]);return t.useEffect(()=>()=>{d.current&&clearTimeout(d.current)},[]),t.createElement("div",{className:"kui-SliderContainer"},t.createElement("div",{ref:m,"aria-live":"polite","aria-atomic":"true",className:"kui-sr-only"}),t.createElement(b.Root,{"data-accent-color":V,"data-radius":M,ref:N,...n,step:E,onValueChange:g,asChild:!1,className:G("kui-SliderRoot",A),"aria-valuemin":u,"aria-valuemax":o,"aria-valuenow":Array.isArray(c)?c[0]:c,"aria-valuetext":S(c),"aria-label":v["aria-label"]||`${y?"Range":"Value"} slider`},t.createElement(b.Track,{className:"kui-SliderTrack"},t.createElement(b.Range,{className:"kui-SliderRange","data-inverted":n.inverted?"":void 0})),(n.value??n.defaultValue??[]).map((e,r)=>t.createElement(b.Thumb,{key:r,className:"kui-SliderThumb",...h!==void 0?{tabIndex:h}:void 0,"aria-label":y?`${r===0?"Minimum":r===1?"Maximum":`Thumb ${r+1}`} value: ${i?`${e} ${i}`:e}`:`Slider value: ${i?`${e} ${i}`:e}`,"aria-valuetext":i?`${e} ${i}`:e.toString()}))),$&&t.createElement("div",{className:"kui-SliderTicks",role:"group","aria-label":"Slider tick marks"},$.map(e=>t.createElement("button",{key:e.index,className:"kui-SliderTick",style:{left:`${e.percentage}%`},onClick:()=>{let r=n.value??n.defaultValue??[u],a=Array.isArray(r)?r.map(()=>e.value):[e.value];g(a)},"aria-label":`Set to ${e.label||(i?`${e.value} ${i}`:e.value)}`,"aria-describedby":e.label?void 0:`tick-${e.index}-value`,type:"button"},t.createElement("div",{className:"kui-SliderTickMark"}),e.label&&D!==!1&&t.createElement("div",{className:"kui-SliderTickLabel"},e.label),!e.label&&t.createElement("span",{id:`tick-${e.index}-value`,className:"sr-only"},i?`${e.value} ${i}`:e.value)))))});L.displayName="Slider";export{L as a};
|
|
2
|
+
//# sourceMappingURL=chunk-GLV7VGBH.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/slider.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slider as SliderPrimitive } from 'radix-ui';\n\nimport { sliderPropDefs } from './slider.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype SliderElement = React.ElementRef<typeof SliderPrimitive.Root>;\ntype SliderOwnProps = GetPropDefTypes<typeof sliderPropDefs>;\ninterface SliderProps\n extends ComponentPropsWithout<\n typeof SliderPrimitive.Root,\n 'asChild' | 'color' | 'children' | 'defaultChecked'\n >,\n SliderOwnProps {\n ticks?: Array<{ value: number; label?: string }>;\n unit?: string;\n}\nconst Slider = React.forwardRef<SliderElement, SliderProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, sliderPropDefs.size);\n const { className, color, radius, tabIndex, ...sliderProps } = extractProps(\n props,\n sliderPropDefs,\n );\n const { ticks, showTickLabels, snapToTicks, unit } = props;\n\n const min = sliderProps.min ?? 0;\n const max = sliderProps.max ?? 100;\n\n // Current value for accessibility\n const currentValue = sliderProps.value ?? sliderProps.defaultValue ?? [min];\n const isRange = Array.isArray(currentValue) && currentValue.length > 1;\n\n // For snapping to ticks, we need to handle this differently\n // Radix slider doesn't support arbitrary step values, so we'll handle snapping in the onValueChange\n const step = sliderProps.step;\n\n // Optimized snap-to-ticks with memoized sorted ticks\n const sortedTicks = React.useMemo(\n () => (ticks ? [...ticks].sort((a, b) => a.value - b.value) : []),\n [ticks],\n );\n\n // Function to snap value to nearest tick (optimized)\n const snapToNearestTick = React.useCallback(\n (value: number): number => {\n if (!snapToTicks || !sortedTicks.length) return value;\n\n // Binary search for closest tick\n let left = 0;\n let right = sortedTicks.length - 1;\n\n if (value <= sortedTicks[left].value) return sortedTicks[left].value;\n if (value >= sortedTicks[right].value) return sortedTicks[right].value;\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n if (sortedTicks[mid].value === value) return value;\n\n if (sortedTicks[mid].value < value) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n\n // Find closest between left and right\n const leftDistance = Math.abs(value - sortedTicks[right].value);\n const rightDistance = Math.abs(value - sortedTicks[left].value);\n\n return leftDistance <= rightDistance ? sortedTicks[right].value : sortedTicks[left].value;\n },\n [snapToTicks, sortedTicks],\n );\n\n // Format value text for accessibility\n const formatValueText = React.useCallback(\n (values: number[]): string => {\n const formatValue = (val: number) => (unit ? `${val} ${unit}` : val.toString());\n\n if (values.length === 1) {\n return `${formatValue(values[0])} out of ${formatValue(max)}`;\n } else if (values.length === 2) {\n return `${formatValue(values[0])} to ${formatValue(values[1])} out of ${formatValue(max)}`;\n } else {\n return `${values.map(formatValue).join(', ')} out of ${formatValue(max)}`;\n }\n },\n [unit, max],\n );\n\n // Memoize tick elements for performance\n const tickElements = React.useMemo(() => {\n if (!ticks) return null;\n\n return ticks.map((tick, index) => ({\n ...tick,\n percentage: ((tick.value - min) / (max - min)) * 100,\n index,\n }));\n }, [ticks, min, max]);\n\n // Live region ref for accessibility announcements (no state = no re-renders)\n const announceRef = React.useRef<HTMLDivElement>(null);\n const announceTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const { onValueChange } = sliderProps;\n // Handle value changes with snapping\n const handleValueChange = React.useCallback(\n (newValue: number[]) => {\n const finalValue =\n snapToTicks && ticks ? newValue.map((v) => snapToNearestTick(v)) : newValue;\n\n // Update live region for screen readers (direct DOM update, no React state)\n if (announceRef.current) {\n const valueText = formatValueText(finalValue);\n announceRef.current.textContent = valueText;\n\n // Clear after delay to prevent spam\n if (announceTimeoutRef.current) {\n clearTimeout(announceTimeoutRef.current);\n }\n announceTimeoutRef.current = setTimeout(() => {\n if (announceRef.current) {\n announceRef.current.textContent = '';\n }\n }, 1000);\n }\n\n onValueChange?.(finalValue);\n },\n [snapToTicks, ticks, snapToNearestTick, formatValueText, onValueChange],\n );\n\n // Cleanup timeout on unmount\n React.useEffect(() => {\n return () => {\n if (announceTimeoutRef.current) {\n clearTimeout(announceTimeoutRef.current);\n }\n };\n }, []);\n\n return (\n <div className=\"kui-SliderContainer\">\n {/* Live region for screen reader announcements */}\n <div\n ref={announceRef}\n aria-live=\"polite\"\n aria-atomic=\"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,EAEzCA,EAAmB,QAAU,WAAW,IAAM,CACxCD,EAAY,UACdA,EAAY,QAAQ,YAAc,GAEtC,EAAG,GAAI,CACT,CAEAE,IAAgBG,CAAU,CAC5B,EACA,CAAC7B,EAAaF,EAAOY,EAAmBO,EAAiBS,CAAa,CACxE,EAGA,OAAM,YAAU,IACP,IAAM,CACPD,EAAmB,SACrB,aAAaA,EAAmB,OAAO,CAE3C,EACC,CAAC,CAAC,EAGH,gBAAC,OAAI,UAAU,uBAEb,gBAAC,OACC,IAAKD,EACL,YAAU,SACV,cAAY,OACZ,UAAU,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { Slider as SliderPrimitive } from 'radix-ui';\n\nimport { sliderPropDefs } from './slider.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype SliderElement = React.ElementRef<typeof SliderPrimitive.Root>;\ntype SliderOwnProps = GetPropDefTypes<typeof sliderPropDefs>;\ninterface SliderProps\n extends ComponentPropsWithout<\n typeof SliderPrimitive.Root,\n 'asChild' | 'color' | 'children' | 'defaultChecked'\n >,\n SliderOwnProps {\n ticks?: Array<{ value: number; label?: string }>;\n unit?: string;\n}\nconst Slider = React.forwardRef<SliderElement, SliderProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, sliderPropDefs.size);\n const { className, color, radius, tabIndex, ...sliderProps } = extractProps(\n props,\n sliderPropDefs,\n );\n const { ticks, showTickLabels, snapToTicks, unit } = props;\n\n const min = sliderProps.min ?? 0;\n const max = sliderProps.max ?? 100;\n\n // Current value for accessibility\n const currentValue = sliderProps.value ?? sliderProps.defaultValue ?? [min];\n const isRange = Array.isArray(currentValue) && currentValue.length > 1;\n\n // For snapping to ticks, we need to handle this differently\n // Radix slider doesn't support arbitrary step values, so we'll handle snapping in the onValueChange\n const step = sliderProps.step;\n\n // Optimized snap-to-ticks with memoized sorted ticks\n const sortedTicks = React.useMemo(\n () => (ticks ? [...ticks].sort((a, b) => a.value - b.value) : []),\n [ticks],\n );\n\n // Function to snap value to nearest tick (optimized)\n const snapToNearestTick = React.useCallback(\n (value: number): number => {\n if (!snapToTicks || !sortedTicks.length) return value;\n\n // Binary search for closest tick\n let left = 0;\n let right = sortedTicks.length - 1;\n\n if (value <= sortedTicks[left].value) return sortedTicks[left].value;\n if (value >= sortedTicks[right].value) return sortedTicks[right].value;\n\n while (left <= right) {\n const mid = Math.floor((left + right) / 2);\n if (sortedTicks[mid].value === value) return value;\n\n if (sortedTicks[mid].value < value) {\n left = mid + 1;\n } else {\n right = mid - 1;\n }\n }\n\n // Find closest between left and right\n const leftDistance = Math.abs(value - sortedTicks[right].value);\n const rightDistance = Math.abs(value - sortedTicks[left].value);\n\n return leftDistance <= rightDistance ? sortedTicks[right].value : sortedTicks[left].value;\n },\n [snapToTicks, sortedTicks],\n );\n\n // Format value text for accessibility\n const formatValueText = React.useCallback(\n (values: number[]): string => {\n const formatValue = (val: number) => (unit ? `${val} ${unit}` : val.toString());\n\n if (values.length === 1) {\n return `${formatValue(values[0])} out of ${formatValue(max)}`;\n } else if (values.length === 2) {\n return `${formatValue(values[0])} to ${formatValue(values[1])} out of ${formatValue(max)}`;\n } else {\n return `${values.map(formatValue).join(', ')} out of ${formatValue(max)}`;\n }\n },\n [unit, max],\n );\n\n // Memoize tick elements for performance\n const tickElements = React.useMemo(() => {\n if (!ticks) return null;\n\n return ticks.map((tick, index) => ({\n ...tick,\n percentage: ((tick.value - min) / (max - min)) * 100,\n index,\n }));\n }, [ticks, min, max]);\n\n // Live region ref for accessibility announcements (no state = no re-renders)\n const announceRef = React.useRef<HTMLDivElement>(null);\n const announceTimeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const { onValueChange } = sliderProps;\n // Handle value changes with snapping\n const handleValueChange = React.useCallback(\n (newValue: number[]) => {\n const finalValue =\n snapToTicks && ticks ? newValue.map((v) => snapToNearestTick(v)) : newValue;\n\n // Update live region for screen readers (direct DOM update, no React state)\n if (announceRef.current) {\n const valueText = formatValueText(finalValue);\n announceRef.current.textContent = valueText;\n\n // Clear after delay to prevent spam\n if (announceTimeoutRef.current) {\n clearTimeout(announceTimeoutRef.current);\n }\n announceTimeoutRef.current = setTimeout(() => {\n if (announceRef.current) {\n announceRef.current.textContent = '';\n }\n }, 1000);\n }\n\n onValueChange?.(finalValue);\n },\n [snapToTicks, ticks, snapToNearestTick, formatValueText, onValueChange],\n );\n\n // Cleanup timeout on unmount\n React.useEffect(() => {\n return () => {\n if (announceTimeoutRef.current) {\n clearTimeout(announceTimeoutRef.current);\n }\n };\n }, []);\n\n return (\n <div className=\"kui-SliderContainer\">\n {/* Live region for screen reader announcements */}\n <div\n ref={announceRef}\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"kui-sr-only\"\n />\n\n <SliderPrimitive.Root\n data-accent-color={color}\n data-radius={radius}\n ref={forwardedRef}\n {...sliderProps}\n step={step}\n onValueChange={handleValueChange}\n asChild={false}\n className={classNames('kui-SliderRoot', className)}\n // Essential ARIA attributes for WCAG 2.2 AA compliance\n aria-valuemin={min}\n aria-valuemax={max}\n aria-valuenow={Array.isArray(currentValue) ? currentValue[0] : (currentValue as number)}\n aria-valuetext={formatValueText(currentValue as number[])}\n aria-label={props['aria-label'] || `${isRange ? 'Range' : 'Value'} slider`}\n >\n <SliderPrimitive.Track className=\"kui-SliderTrack\">\n <SliderPrimitive.Range\n className=\"kui-SliderRange\"\n data-inverted={sliderProps.inverted ? '' : undefined}\n />\n </SliderPrimitive.Track>\n {(sliderProps.value ?? sliderProps.defaultValue ?? []).map((value, index) => (\n <SliderPrimitive.Thumb\n key={index}\n className=\"kui-SliderThumb\"\n {...(tabIndex !== undefined ? { tabIndex } : undefined)}\n aria-label={\n isRange\n ? `${index === 0 ? 'Minimum' : index === 1 ? 'Maximum' : `Thumb ${index + 1}`} value: ${unit ? `${value} ${unit}` : value}`\n : `Slider value: ${unit ? `${value} ${unit}` : value}`\n }\n aria-valuetext={unit ? `${value} ${unit}` : value.toString()}\n />\n ))}\n </SliderPrimitive.Root>\n {tickElements && (\n <div className=\"kui-SliderTicks\" role=\"group\" aria-label=\"Slider tick marks\">\n {tickElements.map((tick) => {\n return (\n <button\n key={tick.index}\n className=\"kui-SliderTick\"\n // Only `left` varies per tick; the centring transform lives in `.kui-SliderTick`.\n style={{ left: `${tick.percentage}%` }}\n onClick={() => {\n const currentValues = sliderProps.value ?? sliderProps.defaultValue ?? [min];\n const newValue = Array.isArray(currentValues)\n ? currentValues.map(() => tick.value)\n : [tick.value];\n\n handleValueChange(newValue);\n }}\n aria-label={`Set to ${tick.label || (unit ? `${tick.value} ${unit}` : tick.value)}`}\n aria-describedby={tick.label ? undefined : `tick-${tick.index}-value`}\n type=\"button\"\n >\n <div className=\"kui-SliderTickMark\" />\n {tick.label && showTickLabels !== false && (\n <div className=\"kui-SliderTickLabel\">{tick.label}</div>\n )}\n {!tick.label && (\n <span id={`tick-${tick.index}-value`} className=\"sr-only\">\n {unit ? `${tick.value} ${unit}` : tick.value}\n </span>\n )}\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n});\nSlider.displayName = 'Slider';\n\nexport { Slider };\nexport type { SliderProps };\n"],
|
|
5
|
+
"mappings": "wHAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAoB1C,IAAMC,EAAe,aAAuC,CAACC,EAAUC,IAAiB,CACtF,IAAMC,EAAQC,EAAkBH,EAAUI,EAAe,IAAI,EACvD,CAAE,UAAAC,EAAW,MAAAC,EAAO,OAAAC,EAAQ,SAAAC,EAAU,GAAGC,CAAY,EAAIC,EAC7DR,EACAE,CACF,EACM,CAAE,MAAAO,EAAO,eAAAC,EAAgB,YAAAC,EAAa,KAAAC,CAAK,EAAIZ,EAE/Ca,EAAMN,EAAY,KAAO,EACzB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,CAC5B,EACA,aAAY,UAAUN,EAAK,QAAUrB,EAAO,GAAGqB,EAAK,KAAK,IAAIrB,CAAI,GAAKqB,EAAK,MAAM,GACjF,mBAAkBA,EAAK,MAAQ,OAAY,QAAQA,EAAK,KAAK,SAC7D,KAAK,UAEL,gBAAC,OAAI,UAAU,qBAAqB,EACnCA,EAAK,OAASvB,IAAmB,IAChC,gBAAC,OAAI,UAAU,uBAAuBuB,EAAK,KAAM,EAElD,CAACA,EAAK,OACL,gBAAC,QAAK,GAAI,QAAQA,EAAK,KAAK,SAAU,UAAU,WAC7CrB,EAAO,GAAGqB,EAAK,KAAK,IAAIrB,CAAI,GAAKqB,EAAK,KACzC,CAEJ,CAEH,CACH,CAEJ,CAEJ,CAAC,EACDpC,EAAO,YAAc",
|
|
6
6
|
"names": ["React", "classNames", "SliderPrimitive", "Slider", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "sliderPropDefs", "className", "color", "radius", "tabIndex", "sliderProps", "extractProps", "ticks", "showTickLabels", "snapToTicks", "unit", "min", "max", "currentValue", "isRange", "step", "sortedTicks", "a", "b", "snapToNearestTick", "value", "left", "right", "mid", "leftDistance", "rightDistance", "formatValueText", "values", "formatValue", "val", "tickElements", "tick", "index", "announceRef", "announceTimeoutRef", "onValueChange", "handleValueChange", "newValue", "finalValue", "v", "valueText", "SliderPrimitive", "classNames", "currentValues"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as d}from"./chunk-QGCXTULQ.js";import{a as u}from"./chunk-4P6TKZCA.js";import{d as m}from"./chunk-3YLYGKFB.js";import*as e from"react";import g from"classnames";var R=e.createContext(void 0),C={values:["1","2","3","4"]},f=e.forwardRef(({kind:r,size:o="2",color:t="gray",className:c,children:n,trailing:s,leading:i,...l},a)=>e.createElement("div",{role:"status","aria-live":"polite",...l,ref:a,className:g("kui-NoticeRoot",`kui-r-size-${o}`,c),"data-kind":r,"data-accent-color":t},i?e.createElement("span",{className:"kui-NoticeIcon","aria-hidden":!0},i):null,e.createElement(u,{as:"div",size:o,className:"kui-NoticeText"},n),s));f.displayName="Strip";var v=e.forwardRef(({icon:r,action:o,onDismiss:t,dismissLabel:c="Dismiss",size:n,...s},i)=>{let l=e.useContext(R),a=m(n??l,C);return e.createElement(f,{...s,size:a,ref:i,kind:"notice",leading:r,trailing:o||t?e.createElement("span",{className:"kui-NoticeActions"},o,t?e.createElement(d,{iconOnly:!0,size:a,variant:"ghost",color:"gray","aria-label":c,className:"kui-NoticeDismiss",onClick:t},e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0},e.createElement("path",{d:"M4 4l7 7M11 4l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))):null):null})});v.displayName="Notice";var z=e.forwardRef(({confirmLabel:r,cancelLabel:o="Not now",onConfirm:t,onCancel:c,busy:n=!1,size:s,color:i="gray",...l},a)=>{let N=e.useContext(R),p=m(s??N,C);return e.createElement(f,{...l,size:p,color:i,ref:a,kind:"confirmation",trailing:e.createElement("span",{className:"kui-NoticeActions"},e.createElement(d,{size:p,variant:"ghost",color:"gray",disabled:n,onClick:c},o),e.createElement(d,{size:p,variant:"solid",color:i,loading:n,onClick:t},r))})});z.displayName="Confirmation";export{R as a,v as b,z as c};
|
|
2
|
+
//# sourceMappingURL=chunk-L2R62BOB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as i}from"./chunk-EZYXYLR2.js";import{a as p}from"./chunk-NUVUXNHF.js";import{a as m}from"./chunk-EKTVL6SS.js";import{a}from"./chunk-ELAW7ZUG.js";import*as e from"react";import R from"classnames";import{useComposedRefs as E,useLayoutEffect as w}from"radix-ui/internal";var D=e.forwardRef((r,n)=>{let{className:d,alt:g,radius:f,loading:l="lazy",decoding:c="async",onLoad:P,onError:u,...h}=a(r,i,m,p),[y,t]=e.useState("loading"),s=e.useRef(null);w(()=>{let o=s.current;o?.complete?t(o.naturalWidth>0?"loaded":"error"):t("loading")},[r.src]);let I=E(s,n);return e.createElement("img",{...h,ref:I,alt:g,loading:l,decoding:c,"data-radius":f,"data-status":y,className:R("kui-Image",d),onLoad:o=>{t("loaded"),P?.(o)},onError:o=>{t("error"),u?.(o)}})});D.displayName="Image";export{D as a};
|
|
2
|
+
//# sourceMappingURL=chunk-M7I6ISPL.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/image.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';\n\nimport { imagePropDefs } from './image.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { widthPropDefs } from '../props/width.props.js';\nimport { heightPropDefs } from '../props/height.props.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { WidthProps } from '../props/width.props.js';\nimport type { HeightProps } from '../props/height.props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype ImageElement = React.ElementRef<'img'>;\ntype ImageOwnProps = GetPropDefTypes<typeof imagePropDefs>;\ntype ImageStatus = 'loading' | 'loaded' | 'error';\n\ninterface ImageProps extends ComponentPropsWithout<'img', RemovedProps | 'width' | 'height' | 'src' | 'alt'>, WidthProps, HeightProps, ImageOwnProps {\n src: string;\n /** Required. Pass `\"\"` for a decorative picture. */\n alt: string;\n}\n\n/**\n * A plain `<img>` that loads lazily, fills its box by `fit` and takes the theme's corner.\n * One element and no wrapper: `width`, `height`, `className` and `style` all land on the\n * `<img>` itself.\n *\n * Until it loads it rests on a quiet neutral fill, which is also what stays if it fails.\n */\nconst Image = React.forwardRef<ImageElement, ImageProps>((props, forwardedRef) => {\n const { className, alt, radius, loading = 'lazy', decoding = 'async', onLoad, onError, ...imageProps } = extractProps(props, imagePropDefs, widthPropDefs, heightPropDefs);\n\n const [status, setStatus] = React.useState<ImageStatus>('loading');\n const ref = React.useRef<HTMLImageElement>(null);\n\n // A cached image, or one that finished before hydration, never fires onLoad for us.\n useLayoutEffect(() => {\n const img = ref.current;\n if (img?.complete) setStatus(img.naturalWidth > 0 ? 'loaded' : 'error');\n else setStatus('loading');\n }, [props.src]);\n\n const setRefs = useComposedRefs(ref, forwardedRef);\n\n return (\n <img\n {...imageProps}\n ref={setRefs}\n alt={alt}\n loading={loading}\n decoding={decoding}\n data-radius={radius}\n data-status={status}\n className={classNames('kui-Image', className)}\n onLoad={(event) => {\n setStatus('loaded');\n onLoad?.(event);\n }}\n onError={(event) => {\n setStatus('error');\n onError?.(event);\n }}\n />\n );\n});\nImage.displayName = 'Image';\n\nexport { Image };\nexport type { ImageProps };\n"],
|
|
5
|
+
"mappings": "2JAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,mBAAAC,EAAiB,mBAAAC,MAAuB,oBA6BjD,IAAMC,EAAc,aAAqC,CAACC,EAAOC,IAAiB,CAChF,GAAM,CAAE,UAAAC,EAAW,IAAAC,EAAK,OAAAC,EAAQ,QAAAC,EAAU,OAAQ,SAAAC,EAAW,QAAS,OAAAC,EAAQ,QAAAC,EAAS,GAAGC,CAAW,EAAIC,EAAaV,EAAOW,EAAeC,EAAeC,CAAc,EAEnK,CAACC,EAAQC,CAAS,EAAU,WAAsB,SAAS,EAC3DC,EAAY,SAAyB,IAAI,EAG/CC,EAAgB,IAAM,CACpB,IAAMC,EAAMF,EAAI,QACZE,GAAK,SAAUH,EAAUG,EAAI,aAAe,EAAI,SAAW,OAAO,EACjEH,EAAU,SAAS,CAC1B,EAAG,CAACf,EAAM,GAAG,CAAC,EAEd,IAAMmB,EAAUC,EAAgBJ,EAAKf,CAAY,EAEjD,OACE,gBAAC,OACE,GAAGQ,EACJ,IAAKU,EACL,IAAKhB,EACL,QAASE,EACT,SAAUC,EACV,cAAaF,EACb,cAAaU,EACb,UAAWO,EAAW,YAAanB,CAAS,EAC5C,OAASoB,GAAU,CACjBP,EAAU,QAAQ,EAClBR,IAASe,CAAK,CAChB,EACA,QAAUA,GAAU,CAClBP,EAAU,OAAO,EACjBP,IAAUc,CAAK,CACjB,EACF,CAEJ,CAAC,EACDvB,EAAM,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "useComposedRefs", "useLayoutEffect", "Image", "props", "forwardedRef", "className", "alt", "radius", "loading", "decoding", "onLoad", "onError", "imageProps", "extractProps", "imagePropDefs", "widthPropDefs", "heightPropDefs", "status", "setStatus", "ref", "useLayoutEffect", "img", "setRefs", "useComposedRefs", "classNames", "event"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MYYXOFU5.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as v,b as L,c as D}from"./chunk-HCBR74BW.js";import{b as x,c as E}from"./chunk-IX5HIHVI.js";import{b as N,c as w}from"./chunk-PPZY7PJA.js";import{a as b}from"./chunk-IWCFJJBI.js";import{d as T}from"./chunk-3YLYGKFB.js";import{a as C}from"./chunk-ELAW7ZUG.js";import{a as F}from"./chunk-OS3FCYZY.js";var U={};F(U,{Content:()=>V,Group:()=>M,Item:()=>A,Label:()=>W,Root:()=>O,Separator:()=>B,Trigger:()=>z});import*as e from"react";import m from"classnames";import{Select as r,ScrollArea as R}from"radix-ui";var G={size:v.size},y=e.createContext({}),O=o=>{let{children:t,size:a,open:i,defaultOpen:l,onOpenChange:c,...S}=o,s=T(a,v.size),[P,n]=e.useState(l??!1),p=i??P,d=e.useCallback(u=>{n(u),c?.(u)},[c]);return e.createElement(r.Root,{...S,open:p,onOpenChange:d},e.createElement(y.Provider,{value:e.useMemo(()=>({size:s,open:p}),[s,p])},t))};O.displayName="Select.Root";var z=e.forwardRef((o,t)=>{let a=e.useContext(y),{children:i,className:l,color:c,radius:S,placeholder:s,error:P,loading:n,disabled:p,readOnly:d,...u}=C({size:a?.size,...o},G,L),{"aria-invalid":f,"aria-busy":g,"aria-disabled":h,"aria-readonly":I}=u,k=!!P||f===!0||f==="true",j=e.useMemo(()=>({"aria-invalid":k?!0:f,"aria-busy":n||g,"aria-disabled":p||h,"aria-readonly":d||I}),[k,f,n,g,p,h,d,I]);return e.createElement(r.Trigger,{asChild:!0,disabled:p},e.createElement("button",{"data-accent-color":c,"data-radius":S,"data-error":P,"data-loading":n,...u,...j,ref:t,className:m("kui-reset","kui-SelectTrigger",l)},e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement(r.Value,{placeholder:s},i)),e.createElement(r.Icon,{asChild:!0},n?e.createElement("div",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},e.createElement("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32",className:"kui-SelectLoadingIconCircle"}))):e.createElement(E,{className:"kui-SelectIcon"}))))});z.displayName="Select.Trigger";var V=e.forwardRef((o,t)=>{let a=e.useContext(y),{className:i,children:l,color:c,container:S,...s}=C({size:a?.size,...o},G,D),P=N();if(a.open===!1&&!s.forceMount)return e.createElement(r.Portal,{container:S},e.createElement(r.Content,{...s,asChild:!1,ref:t},l));let n=c||P.accentColor;return e.createElement(r.Portal,{container:S},e.createElement(w,{asChild:!0},e.createElement(r.Content,{"data-accent-color":n,sideOffset:4,...s,asChild:!1,ref:t,className:m("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-SelectContent",i)},e.createElement(H,null,l))))});V.displayName="Select.Content";function H({children:o}){let t=b();return e.createElement(R.Root,{type:"auto",className:"kui-ScrollAreaRoot"},e.createElement(r.Viewport,{asChild:!0,className:m("kui-BaseMenuViewport","kui-SelectViewport")},e.createElement(R.Viewport,{ref:t,className:"kui-ScrollAreaViewport",style:{overflowY:void 0}},o)),e.createElement(R.Scrollbar,{className:"kui-ScrollAreaScrollbar",orientation:"vertical"},e.createElement(R.Thumb,{className:"kui-ScrollAreaThumb"})))}var A=e.forwardRef((o,t)=>{let{className:a,children:i,...l}=o,c=typeof i!="string";return e.createElement(r.Item,{...l,asChild:!1,ref:t,className:m("kui-reset","kui-BaseMenuItem","kui-SelectItem",{"kui-SelectItemRich":c},a)},e.createElement(r.ItemIndicator,{className:"kui-SelectItemIndicator"},e.createElement(x,{className:"kui-SelectItemIndicatorIcon"})),e.createElement(r.ItemText,null,i))});A.displayName="Select.Item";var M=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Group,{...t,asChild:!1,ref:a,className:m("kui-SelectGroup",o)}));M.displayName="Select.Group";var W=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Label,{...t,asChild:!1,ref:a,className:m("kui-BaseMenuLabel","kui-SelectLabel",o)}));W.displayName="Select.Label";var B=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Separator,{...t,asChild:!1,ref:a,className:m("kui-BaseMenuSeparator","kui-SelectSeparator",o)}));B.displayName="Select.Separator";export{O as a,z as b,V as c,A as d,M as e,W as f,B as g,U as h};
|
|
2
|
+
//# sourceMappingURL=chunk-NQDMTOGB.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/select.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport { warnDeprecated } from '../helpers/warn-deprecated.js';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Select as SelectPrimitive, ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../helpers/theme-size.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport {\n selectRootPropDefs,\n selectTriggerPropDefs,\n selectContentPropDefs,\n} from './select.props.js';\nimport { useThemeContext, Theme } from './theme.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\n\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\ntype SelectRootOwnProps = GetPropDefTypes<typeof selectRootPropDefs>;\n\n// Trigger and Content pass the size prop def as its own record. It is hoisted because\n// extractProps caches its compiled prop defs on the identity of each record it is given:\n// a literal written at the call site would be a new object, and a recompile, every render.\nconst selectSizePropDefs = { size: selectRootPropDefs.size };\n\ninterface SelectContextValue extends SelectRootOwnProps {\n /** Whether the list is open. Undefined when Content is rendered outside a Kookie Select.Root. */\n open?: boolean;\n}\nconst SelectContext = React.createContext<SelectContextValue>({});\n\ninterface SelectRootProps extends SelectPrimitive.SelectProps, SelectRootOwnProps {}\nconst SelectRoot: React.FC<SelectRootProps> = (props) => {\n const {\n children,\n size: sizeProp,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...rootProps\n } = props;\n const size = useThemeSize(sizeProp, selectRootPropDefs.size);\n\n // Root owns the open state and hands Radix a controlled `open`, so Content learns of a\n // change in the same render Radix does. Radix's uncontrolled state reports changes from an\n // effect, a render late, which would mount the open list once without its wrappers.\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);\n const open = openProp ?? uncontrolledOpen;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n\n return (\n <SelectPrimitive.Root {...rootProps} open={open} onOpenChange={handleOpenChange}>\n <SelectContext.Provider value={React.useMemo(() => ({ size, open }), [size, open])}>\n {children}\n </SelectContext.Provider>\n </SelectPrimitive.Root>\n );\n};\nSelectRoot.displayName = 'Select.Root';\n\ntype SelectTriggerElement = React.ElementRef<typeof SelectPrimitive.Trigger>;\ntype SelectTriggerOwnProps = GetPropDefTypes<typeof selectTriggerPropDefs>;\ninterface SelectTriggerProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Trigger, RemovedProps>,\n SelectTriggerOwnProps {}\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const {\n children,\n className,\n color,\n radius,\n placeholder,\n error,\n loading,\n disabled,\n readOnly,\n ...triggerProps\n } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectTriggerPropDefs,\n );\n\n\n // The props win when set; otherwise a caller's own aria-* (a form library's aria-invalid)\n // stays, so both paths reach the accessibility tree and the CSS, as on TextField.\n const {\n 'aria-invalid': ariaInvalid,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadOnly,\n } = triggerProps;\n const isInvalid = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-busy': loading || ariaBusy,\n 'aria-disabled': disabled || ariaDisabled,\n 'aria-readonly': readOnly || ariaReadOnly,\n }),\n [isInvalid, ariaInvalid, loading, ariaBusy, disabled, ariaDisabled, readOnly, ariaReadOnly],\n );\n\n return (\n // `disabled` goes to Radix, which merges it with Root's and sets the native attribute.\n <SelectPrimitive.Trigger asChild disabled={disabled}>\n <button\n data-accent-color={color}\n data-radius={radius}\n data-error={error}\n data-loading={loading}\n {...triggerProps}\n {...ariaProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-SelectTrigger', className)}\n >\n <span className=\"kui-SelectTriggerInner\">\n <SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>\n </span>\n <SelectPrimitive.Icon asChild>\n {loading ? (\n <div className=\"kui-SelectIcon kui-SelectLoadingIcon\" aria-hidden=\"true\">\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <circle\n cx=\"8\"\n cy=\"8\"\n r=\"7\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeDasharray=\"32\"\n strokeDashoffset=\"32\"\n className=\"kui-SelectLoadingIconCircle\"\n />\n </svg>\n </div>\n ) : (\n <ChevronDownIcon className=\"kui-SelectIcon\" />\n )}\n </SelectPrimitive.Icon>\n </button>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = 'Select.Trigger';\n\ntype SelectContentElement = React.ElementRef<typeof SelectPrimitive.Content>;\ntype SelectContentOwnProps = GetPropDefTypes<typeof selectContentPropDefs>;\ninterface SelectContentProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Content, RemovedProps>,\n SelectContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Portal>['container'];\n}\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const { className, children, color, container, ...contentProps } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectContentPropDefs,\n );\n const themeContext = useThemeContext();\n\n // While closed, Radix still renders Content's children, into a detached fragment: the\n // items must exist for the trigger's value label, typeahead and the native form select.\n // Nothing in that fragment is ever shown, so the theme wrapper and the scroll area, with\n // its two resize observers, are left out until the list opens.\n if (context.open === false && !contentProps.forceMount) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content {...contentProps} asChild={false} ref={forwardedRef}>\n {children}\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n }\n\n const resolvedColor = color || themeContext.accentColor;\n return (\n <SelectPrimitive.Portal container={container}>\n <Theme asChild>\n <SelectPrimitive.Content\n data-accent-color={resolvedColor}\n sideOffset={4}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-SelectContent',\n className,\n )}\n >\n <SelectScrollArea>{children}</SelectScrollArea>\n </SelectPrimitive.Content>\n </Theme>\n </SelectPrimitive.Portal>\n );\n },\n);\nSelectContent.displayName = 'Select.Content';\n\n/** The open list's scroll area. Its own component so the thumb sync hook runs only while open. */\nfunction SelectScrollArea({ children }: { children: React.ReactNode }) {\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n return (\n <ScrollAreaPrimitive.Root type=\"auto\" className=\"kui-ScrollAreaRoot\">\n <SelectPrimitive.Viewport\n asChild\n className={classNames('kui-BaseMenuViewport', 'kui-SelectViewport')}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setThumbViewport}\n className=\"kui-ScrollAreaViewport\"\n style={{ overflowY: undefined }}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n </SelectPrimitive.Viewport>\n <ScrollAreaPrimitive.Scrollbar className=\"kui-ScrollAreaScrollbar\" orientation=\"vertical\">\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n </ScrollAreaPrimitive.Root>\n );\n}\n\ntype SelectItemElement = React.ElementRef<typeof SelectPrimitive.Item>;\ninterface SelectItemProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Item, RemovedProps> {}\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>((props, forwardedRef) => {\n const { className, children, ...itemProps } = props;\n\n // Detect if this is rich content (not just a string)\n const isRichContent = typeof children !== 'string';\n\n return (\n <SelectPrimitive.Item\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-SelectItem',\n { 'kui-SelectItemRich': isRichContent },\n className,\n )}\n >\n <SelectPrimitive.ItemIndicator className=\"kui-SelectItemIndicator\">\n <ThickCheckIcon className=\"kui-SelectItemIndicatorIcon\" />\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n});\nSelectItem.displayName = 'Select.Item';\n\ntype SelectGroupElement = React.ElementRef<typeof SelectPrimitive.Group>;\ninterface SelectGroupProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Group, RemovedProps> {}\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-SelectGroup', className)}\n />\n ),\n);\nSelectGroup.displayName = 'Select.Group';\n\ntype SelectLabelElement = React.ElementRef<typeof SelectPrimitive.Label>;\ninterface SelectLabelProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Label, RemovedProps> {}\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-SelectLabel', className)}\n />\n ),\n);\nSelectLabel.displayName = 'Select.Label';\n\ntype SelectSeparatorElement = React.ElementRef<typeof SelectPrimitive.Separator>;\ninterface SelectSeparatorProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Separator, RemovedProps> {}\nconst SelectSeparator = React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-SelectSeparator', className)}\n />\n ),\n);\nSelectSeparator.displayName = 'Select.Separator';\n\nexport {\n SelectRoot as Root,\n SelectTrigger as Trigger,\n SelectContent as Content,\n SelectItem as Item,\n SelectGroup as Group,\n SelectLabel as Label,\n SelectSeparator as Separator,\n};\n\nexport type {\n SelectRootProps as RootProps,\n SelectTriggerProps as TriggerProps,\n SelectContentProps as ContentProps,\n SelectItemProps as ItemProps,\n SelectGroupProps as GroupProps,\n SelectLabelProps as LabelProps,\n SelectSeparatorProps as SeparatorProps,\n};\n"],
|
|
5
|
+
"mappings": "oTAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EA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,2BACvC,gBAACsC,EAAA,CAAe,UAAU,8BAA8B,CAC1D,EACA,gBAACtC,EAAgB,SAAhB,KAA0Bb,CAAS,CACtC,CAEJ,CAAC,EACDgD,EAAW,YAAc,cAKzB,IAAMI,EAAoB,aACxB,CAAC,CAAE,UAAAnC,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWmB,EAAW,kBAAmBjB,CAAS,EACpD,CAEJ,EACAmC,EAAY,YAAc,eAK1B,IAAMC,EAAoB,aACxB,CAAC,CAAE,UAAApC,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWmB,EAAW,oBAAqB,kBAAmBjB,CAAS,EACzE,CAEJ,EACAoC,EAAY,YAAc,eAK1B,IAAMC,EAAwB,aAC5B,CAAC,CAAE,UAAArC,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,UAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWmB,EAAW,wBAAyB,sBAAuBjB,CAAS,EACjF,CAEJ,EACAqC,EAAgB,YAAc",
|
|
6
|
+
"names": ["select_exports", "__export", "SelectContent", "SelectGroup", "SelectItem", "SelectLabel", "SelectRoot", "SelectSeparator", "SelectTrigger", "React", "classNames", "SelectPrimitive", "ScrollAreaPrimitive", "selectSizePropDefs", "selectRootPropDefs", "SelectContext", "SelectRoot", "props", "children", "sizeProp", "openProp", "defaultOpen", "onOpenChange", "rootProps", "size", "useThemeSize", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChange", "next", "SelectPrimitive", "SelectTrigger", "forwardedRef", "context", "className", "color", "radius", "placeholder", "error", "loading", "disabled", "readOnly", "triggerProps", "extractProps", "selectTriggerPropDefs", "ariaInvalid", "ariaBusy", "ariaDisabled", "ariaReadOnly", "isInvalid", "ariaProps", "classNames", "ChevronDownIcon", "SelectContent", "container", "contentProps", "selectContentPropDefs", "themeContext", "useThemeContext", "resolvedColor", "Theme", "SelectScrollArea", "setThumbViewport", "useThumbSync", "ScrollAreaPrimitive", "SelectItem", "itemProps", "isRichContent", "ThickCheckIcon", "SelectGroup", "SelectLabel", "SelectSeparator"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as p}from"./chunk-KL73COYX.js";import{a as x}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as p}from"./chunk-KL73COYX.js";import{a as x}from"./chunk-QGCXTULQ.js";import{a as B}from"./chunk-4P6TKZCA.js";import{f as y}from"./chunk-AB3QCCUM.js";import{d as R}from"./chunk-3YLYGKFB.js";import{a as m}from"./chunk-ELAW7ZUG.js";import*as o from"react";import u from"classnames";import{Toolbar as f}from"radix-ui";var v=o.createContext(null),S=o.createContext(null);function b(t){let r=o.useContext(v);if(!r)throw new Error(`${t} must be rendered inside a Toolbar.`);return r}var P=o.forwardRef((t,r)=>{let e=y(),a=R(t.size??e??void 0,p.size),s=t.orientation??p.orientation.default,{className:n,orientation:l,backdrop:i=!1,children:T,...d}=m({...t,size:a},p),c=o.useMemo(()=>({size:a,orientation:s,backdrop:i}),[a,s,i]);return o.createElement(f.Root,{...d,ref:r,orientation:s,"data-backdrop":i||void 0,className:u("kui-Toolbar",n)},o.createElement(v.Provider,{value:c},T))});P.displayName="Toolbar";var C=o.forwardRef(({className:t,disabled:r=!1,children:e,...a},s)=>{let{orientation:n}=b("ToolbarGroup"),l=o.useMemo(()=>({disabled:r}),[r]);return o.createElement("div",{role:"group","data-orientation":n,"data-disabled":r||void 0,...a,ref:s,className:u("kui-ToolbarGroup",t)},o.createElement(S.Provider,{value:l},e))});C.displayName="Toolbar.Group";function D(t){return t===!0||t==="true"}var z=o.forwardRef((t,r)=>{let e=b("ToolbarButton"),a=o.useContext(S),{iconOnly:s,size:n,variant:l,emphasis:i,color:T,disabled:d,...c}=t,h=D(t["aria-pressed"]),k="data-state"in t||t["aria-pressed"]===void 0?{}:{"data-state":h?"on":"off"},O={size:n??e.size,...i!==void 0?{emphasis:i}:{variant:l??(a?"ghost":e.backdrop?"raised":"soft")},color:T??(l||i?void 0:"gray"),...k},g={...c,...s?{iconOnly:!0}:{},...O};return o.createElement(f.Button,{asChild:!0,ref:r,disabled:d||a?.disabled||void 0},o.createElement(x,{...g}))});z.displayName="Toolbar.Button";var G=o.forwardRef(({className:t,...r},e)=>(b("ToolbarSeparator"),o.createElement(f.Separator,{...r,ref:e,className:u("kui-ToolbarSeparator",t)})));G.displayName="Toolbar.Separator";var w={1:"2",2:"3",3:"4",4:"5"},N=o.forwardRef(({className:t,children:r,style:e,id:a},s)=>{let{size:n}=b("ToolbarTitle");return r==null||r===!1?null:o.createElement(B,{ref:s,as:"span",size:w[n],weight:"medium",truncate:!0,id:a,style:e,className:u("kui-ToolbarTitle",t)},r)});N.displayName="Toolbar.Title";var A=Object.assign(P,{Root:P,Group:C,Button:z,Separator:G,Title:N});export{P as a,C as b,z as c,G as d,N as e,A as f};
|
|
2
|
+
//# sourceMappingURL=chunk-Q6MFPATL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as c}from"./chunk-2N2AQNJH.js";import{a as p}from"./chunk-KT2CMUS5.js";import{a as u}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as c}from"./chunk-2N2AQNJH.js";import{a as p}from"./chunk-KT2CMUS5.js";import{a as u}from"./chunk-XRCMPBAY.js";import*as t from"react";import v from"classnames";var E={loud:"solid",medium:"raised",quiet:"ghost"};function g(e){if(e["aria-label"]||e["aria-labelledby"])return;console.error("Button: an `iconOnly` button must have an accessible name. Pass `aria-label`, or `aria-labelledby` referencing a label element.")}var w=t.forwardRef(({className:e,style:r,tooltip:a,tooltipSide:d="top",tooltipAlign:m="center",tooltipDelayDuration:B,tooltipDisableHoverableContent:f,iconOnly:s=!1,emphasis:o,variant:i,...n},y)=>{let{tooltipId:b,hasTooltip:P,accessibilityProps:R}=c(a);if(s&&(g(n),n.fullWidth=!1),o!==void 0&&i!==void 0)throw new Error("Button: pass `emphasis` or `variant`, not both. They set the same thing.");let h=o!==void 0?E[o]:i,l=t.createElement(u,{...n,variant:h,...R,ref:y,"data-icon-only":s||void 0,className:v("kui-Button",e),style:r});return P?t.createElement(p,{content:a,side:d,align:m,delayDuration:B,disableHoverableContent:f,id:b},l):l});w.displayName="Button";export{w as a};
|
|
2
|
+
//# sourceMappingURL=chunk-QGCXTULQ.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a}from"./chunk-HIEGLLY7.js";import{a as p}from"./chunk-BJUCBOGU.js";import{a as r}from"./chunk-ELAW7ZUG.js";import*as e from"react";import l from"classnames";var c=e.forwardRef((i,o)=>{let{className:t,children:n,loading:m,...f}=r(i,a);if(!m)return n;let s=e.createElement("span",{...f,ref:o,className:l("kui-Spinner",t)},e.createElement("span",{className:"kui-SpinnerWheel"},e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"}),e.createElement("span",{className:"kui-SpinnerLeaf"})));return n===void 0?s:e.createElement(p,{asChild:!0,position:"relative",align:"center",justify:"center"},e.createElement("span",null,e.createElement("span",{"aria-hidden":!0,className:"kui-SpinnerHiddenChildren",inert:void 0},n),e.createElement(p,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},e.createElement("span",null,s))))});c.displayName="Spinner";export{c as a};
|
|
2
|
+
//# sourceMappingURL=chunk-UE3HATOA.js.map
|