@adamosuiteservices/ui 2.11.21 → 2.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{button-BzVY7053.js → button-CMWUcYpz.js} +54 -54
- package/dist/button-CmLeuaI0.cjs +75 -0
- package/dist/button-group.cjs +6 -6
- package/dist/button-group.js +20 -20
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/{calendar-IAVS_7up.cjs → calendar-DUvRetFW.cjs} +1 -1
- package/dist/{calendar-BIttOd3g.js → calendar-yJWQTCer.js} +1 -1
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.js +1 -1
- package/dist/{combobox-DI-WK3Ng.js → combobox-BvjehNR7.js} +89 -86
- package/dist/combobox-CDXlen0X.cjs +40 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/input-otp/index.d.ts +1 -0
- package/dist/components/ui/input-otp/input-otp.d.ts +11 -0
- package/dist/context-menu.cjs +38 -36
- package/dist/context-menu.js +54 -52
- package/dist/date-picker-selector.cjs +1 -1
- package/dist/date-picker-selector.js +4 -4
- package/dist/dropdown-menu.cjs +48 -52
- package/dist/dropdown-menu.js +164 -168
- package/dist/{input-DFvZLcgm.js → input-BCiOr4Fy.js} +7 -6
- package/dist/{input-CWDpI1Ua.cjs → input-Bz5k4w94.cjs} +7 -6
- package/dist/input-group.cjs +5 -5
- package/dist/input-group.js +10 -10
- package/dist/input-otp.cjs +68 -0
- package/dist/input-otp.js +384 -0
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/pagination.cjs +2 -2
- package/dist/pagination.js +4 -3
- package/dist/select.cjs +22 -20
- package/dist/select.js +112 -111
- package/dist/sidebar.cjs +1 -1
- package/dist/sidebar.js +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/ui/button-group.md +986 -984
- package/docs/components/ui/button.md +1156 -1137
- package/docs/components/ui/combobox.md +33 -2
- package/docs/components/ui/command.md +484 -454
- package/docs/components/ui/context-menu.md +574 -540
- package/docs/components/ui/dropdown-menu.md +743 -709
- package/docs/components/ui/input.md +362 -362
- package/docs/components/ui/select.md +357 -352
- package/package.json +8 -3
- package/dist/button-B_VHdPPV.cjs +0 -76
- package/dist/combobox-DplJzBX6.cjs +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adamosuiteservices/ui",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -130,6 +130,10 @@
|
|
|
130
130
|
"types": "./dist/components/ui/input-group/input-group.d.ts",
|
|
131
131
|
"import": "./dist/input-group.js"
|
|
132
132
|
},
|
|
133
|
+
"./input-otp": {
|
|
134
|
+
"types": "./dist/components/ui/input-otp/input-otp.d.ts",
|
|
135
|
+
"import": "./dist/input-otp.js"
|
|
136
|
+
},
|
|
133
137
|
"./kbd": {
|
|
134
138
|
"types": "./dist/components/ui/kbd/kbd.d.ts",
|
|
135
139
|
"import": "./dist/kbd.js"
|
|
@@ -217,7 +221,7 @@
|
|
|
217
221
|
],
|
|
218
222
|
"scripts": {
|
|
219
223
|
"dev": "cross-env vite",
|
|
220
|
-
"build": "cross-env
|
|
224
|
+
"build": "cross-env vite build && npm run build:types",
|
|
221
225
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
|
|
222
226
|
"lint": "eslint .",
|
|
223
227
|
"lint:fix": "eslint . --fix",
|
|
@@ -266,6 +270,7 @@
|
|
|
266
270
|
"@uidotdev/usehooks": "^2.4.1",
|
|
267
271
|
"class-variance-authority": "^0.7.1",
|
|
268
272
|
"clsx": "^2.1.1",
|
|
273
|
+
"input-otp": "^1.4.2",
|
|
269
274
|
"lucide-react": "^0.546.0",
|
|
270
275
|
"tailwind-merge": "^3.3.1",
|
|
271
276
|
"tailwindcss": "^4.1.15"
|
|
@@ -299,4 +304,4 @@
|
|
|
299
304
|
"vite": "^7.1.7",
|
|
300
305
|
"vite-plugin-dts": "^4.5.4"
|
|
301
306
|
}
|
|
302
|
-
}
|
|
307
|
+
}
|
package/dist/button-B_VHdPPV.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const n=require("./jsx-runtime-BB_1_6y_.cjs"),m=require("./index-CjyiloO7.cjs"),o=require("./index-DoxiiusW.cjs"),c=require("./index-BTzZJcis.cjs");require("react");const a=c.cva(`
|
|
2
|
-
adm:inline-flex adm:shrink-0 adm:items-center adm:justify-center adm:gap-2
|
|
3
|
-
adm:rounded-md adm:text-sm adm:font-semibold adm:whitespace-nowrap
|
|
4
|
-
adm:transition-all adm:outline-none
|
|
5
|
-
adm:focus-visible:border-ring adm:focus-visible:ring-[3px]
|
|
6
|
-
adm:focus-visible:ring-ring/50
|
|
7
|
-
adm:disabled:pointer-events-none adm:disabled:opacity-50
|
|
8
|
-
adm:aria-invalid:border-destructive adm:aria-invalid:ring-destructive/20
|
|
9
|
-
adm:dark:aria-invalid:ring-destructive/40
|
|
10
|
-
adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
|
|
11
|
-
adm:[&_svg:not([class*=size-])]:size-4
|
|
12
|
-
adm:[&>[data-slot=icon]]:pointer-events-none
|
|
13
|
-
adm:[&>[data-slot=icon]]:shrink-0 adm:[&>[data-slot=icon]]:text-lg
|
|
14
|
-
`,{variants:{variant:{default:`
|
|
15
|
-
adm:bg-primary adm:text-primary-foreground
|
|
16
|
-
adm:hover:bg-primary-700
|
|
17
|
-
`,success:`
|
|
18
|
-
adm:bg-success adm:text-white
|
|
19
|
-
adm:hover:bg-success-700
|
|
20
|
-
adm:focus-visible:ring-success/20
|
|
21
|
-
adm:dark:bg-success/60 adm:dark:focus-visible:ring-success/40
|
|
22
|
-
`,"success-medium":`
|
|
23
|
-
adm:bg-success-50 adm:text-success
|
|
24
|
-
adm:hover:bg-success/20
|
|
25
|
-
adm:focus-visible:ring-success/20
|
|
26
|
-
adm:dark:bg-success-50/60 adm:dark:focus-visible:ring-success/40
|
|
27
|
-
`,warning:`
|
|
28
|
-
adm:bg-warning adm:text-white
|
|
29
|
-
adm:hover:bg-warning-700
|
|
30
|
-
adm:focus-visible:ring-warning/20
|
|
31
|
-
adm:dark:bg-warning/60 adm:dark:focus-visible:ring-warning/40
|
|
32
|
-
`,"warning-medium":`
|
|
33
|
-
adm:bg-warning-50 adm:text-warning
|
|
34
|
-
adm:hover:bg-warning/20
|
|
35
|
-
adm:focus-visible:ring-warning/20
|
|
36
|
-
adm:dark:bg-warning-50/60 adm:dark:focus-visible:ring-warning/40
|
|
37
|
-
`,destructive:`
|
|
38
|
-
adm:bg-destructive adm:text-white
|
|
39
|
-
adm:hover:bg-destructive-700
|
|
40
|
-
adm:focus-visible:ring-destructive/20
|
|
41
|
-
adm:dark:bg-destructive/60
|
|
42
|
-
adm:dark:focus-visible:ring-destructive/40
|
|
43
|
-
`,"destructive-medium":`
|
|
44
|
-
adm:bg-destructive-50 adm:text-destructive
|
|
45
|
-
adm:hover:bg-destructive/20
|
|
46
|
-
adm:focus-visible:ring-destructive/20
|
|
47
|
-
adm:dark:bg-destructive-50/60
|
|
48
|
-
adm:dark:focus-visible:ring-destructive/40
|
|
49
|
-
`,outline:`
|
|
50
|
-
adm:border adm:bg-background adm:shadow-xs
|
|
51
|
-
adm:hover:bg-accent adm:hover:text-accent-foreground
|
|
52
|
-
adm:dark:border-input adm:dark:bg-input/30
|
|
53
|
-
adm:dark:hover:bg-input/50
|
|
54
|
-
`,secondary:`
|
|
55
|
-
adm:bg-secondary adm:text-secondary-foreground
|
|
56
|
-
adm:hover:bg-primary-200
|
|
57
|
-
`,ghost:`
|
|
58
|
-
adm:text-primary
|
|
59
|
-
adm:hover:bg-primary-50 adm:hover:text-primary
|
|
60
|
-
adm:dark:hover:bg-primary-50/20
|
|
61
|
-
`,"ghost-neutral":`
|
|
62
|
-
adm:hover:bg-accent adm:hover:text-accent-foreground
|
|
63
|
-
adm:dark:hover:bg-accent/50
|
|
64
|
-
`,link:"adm:text-primary adm:underline-offset-4"},size:{default:`
|
|
65
|
-
adm:h-9 adm:px-4 adm:py-2
|
|
66
|
-
adm:has-[>[data-slot=icon]]:px-3
|
|
67
|
-
adm:has-[>svg]:px-3
|
|
68
|
-
`,sm:`
|
|
69
|
-
adm:h-8 adm:gap-1.5 adm:rounded-md adm:px-3
|
|
70
|
-
adm:has-[>[data-slot=icon]]:px-2.5
|
|
71
|
-
adm:has-[>svg]:px-2.5
|
|
72
|
-
`,lg:`
|
|
73
|
-
adm:h-10 adm:rounded-md adm:px-6
|
|
74
|
-
adm:has-[>[data-slot=icon]]:px-4
|
|
75
|
-
adm:has-[>svg]:px-4
|
|
76
|
-
`,icon:"adm:size-9","icon-sm":"adm:size-8","icon-lg":"adm:size-10"}},defaultVariants:{variant:"default",size:"default"}});function u({className:d,variant:e,size:i,asChild:r=!1,...s}){const t=r?m.Slot:"button";return n.jsxRuntimeExports.jsx(t,{"data-slot":"button",className:o.cn(a({variant:e,size:i,className:d})),...s})}exports.Button=u;exports.buttonVariants=a;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use client";"use strict";const x=require("./jsx-runtime-BB_1_6y_.cjs"),Ce=require("./button-B_VHdPPV.cjs"),Ae=require("./checkbox-DHFt3l5c.cjs"),ee=require("./icon-DPMQJBkA.cjs"),q=require("./index-DoxiiusW.cjs"),ue=require("react"),oe=require("./index-Ca99LLZF.cjs"),L=require("./index-CocSS1YK.cjs"),B=require("./index-WIv2ndLu.cjs"),te=require("./index-_XxjJPRD.cjs"),ce=require("./popover-cGp_rNLg.cjs");function Pe(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const p=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,p.get?p:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=Pe(ue);var ve=1,Ne=.9,qe=.8,Me=.17,de=.1,me=.999,$e=.9999,De=.99,Le=/[\\\/_+.#"@\[\(\{&]/,Oe=/[\\\/_+.#"@\[\(\{&]/g,Fe=/[\s-]/,ye=/[\s-]/g;function pe(e,n,r,p,i,c,m){if(c===n.length)return i===e.length?ve:De;var d=`${i},${c}`;if(m[d]!==void 0)return m[d];for(var g=p.charAt(c),o=r.indexOf(g,i),v=0,s,I,R,C;o>=0;)s=pe(e,n,r,p,o+1,c+1,m),s>v&&(o===i?s*=ve:Le.test(e.charAt(o-1))?(s*=qe,R=e.slice(i,o-1).match(Oe),R&&i>0&&(s*=Math.pow(me,R.length))):Fe.test(e.charAt(o-1))?(s*=Ne,C=e.slice(i,o-1).match(ye),C&&i>0&&(s*=Math.pow(me,C.length))):(s*=Me,i>0&&(s*=Math.pow(me,o-i))),e.charAt(o)!==n.charAt(c)&&(s*=$e)),(s<de&&r.charAt(o-1)===p.charAt(c+1)||p.charAt(c+1)===p.charAt(c)&&r.charAt(o-1)!==p.charAt(c))&&(I=pe(e,n,r,p,o+1,c+2,m),I*de>s&&(s=I*de)),s>v&&(v=s),o=r.indexOf(g,o+1);return m[d]=v,v}function ge(e){return e.toLowerCase().replace(ye," ")}function Te(e,n,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,pe(e,n,ge(e),ge(n),0,0,{})}var Z='[cmdk-group=""]',fe='[cmdk-group-items=""]',Ve='[cmdk-group-heading=""]',je='[cmdk-item=""]',be=`${je}:not([aria-disabled="true"])`,xe="cmdk-item-select",z="data-value",Ke=(e,n,r)=>Te(e,n,r),Ee=a.createContext(void 0),re=()=>a.useContext(Ee),Re=a.createContext(void 0),he=()=>a.useContext(Re),ke=a.createContext(void 0),Ie=a.forwardRef((e,n)=>{let r=_(()=>{var t,u;return{search:"",value:(u=(t=e.value)!=null?t:e.defaultValue)!=null?u:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),p=_(()=>new Set),i=_(()=>new Map),c=_(()=>new Map),m=_(()=>new Set),d=we(e),{label:g,children:o,value:v,onValueChange:s,filter:I,shouldFilter:R,loop:C,disablePointerSelection:G=!1,vimBindings:M=!0,...y}=e,ne=B.useId(),A=B.useId(),V=B.useId(),P=a.useRef(null),j=Qe();T(()=>{if(v!==void 0){let t=v.trim();r.current.value=t,k.emit()}},[v]),T(()=>{j(6,X)},[]);let k=a.useMemo(()=>({subscribe:t=>(m.current.add(t),()=>m.current.delete(t)),snapshot:()=>r.current,setState:(t,u,h)=>{var l,b,E,S;if(!Object.is(r.current[t],u)){if(r.current[t]=u,t==="search")J(),K(),j(1,O);else if(t==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let w=document.getElementById(V);w?w.focus():(l=document.getElementById(ne))==null||l.focus()}if(j(7,()=>{var w;r.current.selectedItemId=(w=$())==null?void 0:w.id,k.emit()}),h||j(5,X),((b=d.current)==null?void 0:b.value)!==void 0){let w=u??"";(S=(E=d.current).onValueChange)==null||S.call(E,w);return}}k.emit()}},emit:()=>{m.current.forEach(t=>t())}}),[]),U=a.useMemo(()=>({value:(t,u,h)=>{var l;u!==((l=c.current.get(t))==null?void 0:l.value)&&(c.current.set(t,{value:u,keywords:h}),r.current.filtered.items.set(t,H(u,h)),j(2,()=>{K(),k.emit()}))},item:(t,u)=>(p.current.add(t),u&&(i.current.has(u)?i.current.get(u).add(t):i.current.set(u,new Set([t]))),j(3,()=>{J(),K(),r.current.value||O(),k.emit()}),()=>{c.current.delete(t),p.current.delete(t),r.current.filtered.items.delete(t);let h=$();j(4,()=>{J(),h?.getAttribute("id")===t&&O(),k.emit()})}),group:t=>(i.current.has(t)||i.current.set(t,new Set),()=>{c.current.delete(t),i.current.delete(t)}),filter:()=>d.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:ne,inputId:V,labelId:A,listInnerRef:P}),[]);function H(t,u){var h,l;let b=(l=(h=d.current)==null?void 0:h.filter)!=null?l:Ke;return t?b(t,r.current.search,u):0}function K(){if(!r.current.search||d.current.shouldFilter===!1)return;let t=r.current.filtered.items,u=[];r.current.filtered.groups.forEach(l=>{let b=i.current.get(l),E=0;b.forEach(S=>{let w=t.get(S);E=Math.max(w,E)}),u.push([l,E])});let h=P.current;F().sort((l,b)=>{var E,S;let w=l.getAttribute("id"),ie=b.getAttribute("id");return((E=t.get(ie))!=null?E:0)-((S=t.get(w))!=null?S:0)}).forEach(l=>{let b=l.closest(fe);b?b.appendChild(l.parentElement===b?l:l.closest(`${fe} > *`)):h.appendChild(l.parentElement===h?l:l.closest(`${fe} > *`))}),u.sort((l,b)=>b[1]-l[1]).forEach(l=>{var b;let E=(b=P.current)==null?void 0:b.querySelector(`${Z}[${z}="${encodeURIComponent(l[0])}"]`);E?.parentElement.appendChild(E)})}function O(){let t=F().find(h=>h.getAttribute("aria-disabled")!=="true"),u=t?.getAttribute(z);k.setState("value",u||void 0)}function J(){var t,u,h,l;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=p.current.size;return}r.current.filtered.groups=new Set;let b=0;for(let E of p.current){let S=(u=(t=c.current.get(E))==null?void 0:t.value)!=null?u:"",w=(l=(h=c.current.get(E))==null?void 0:h.keywords)!=null?l:[],ie=H(S,w);r.current.filtered.items.set(E,ie),ie>0&&b++}for(let[E,S]of i.current)for(let w of S)if(r.current.filtered.items.get(w)>0){r.current.filtered.groups.add(E);break}r.current.filtered.count=b}function X(){var t,u,h;let l=$();l&&(((t=l.parentElement)==null?void 0:t.firstChild)===l&&((h=(u=l.closest(Z))==null?void 0:u.querySelector(Ve))==null||h.scrollIntoView({block:"nearest"})),l.scrollIntoView({block:"nearest"}))}function $(){var t;return(t=P.current)==null?void 0:t.querySelector(`${je}[aria-selected="true"]`)}function F(){var t;return Array.from(((t=P.current)==null?void 0:t.querySelectorAll(be))||[])}function Y(t){let u=F()[t];u&&k.setState("value",u.getAttribute(z))}function Q(t){var u;let h=$(),l=F(),b=l.findIndex(S=>S===h),E=l[b+t];(u=d.current)!=null&&u.loop&&(E=b+t<0?l[l.length-1]:b+t===l.length?l[0]:l[b+t]),E&&k.setState("value",E.getAttribute(z))}function ae(t){let u=$(),h=u?.closest(Z),l;for(;h&&!l;)h=t>0?Xe(h,Z):Ye(h,Z),l=h?.querySelector(be);l?k.setState("value",l.getAttribute(z)):Q(t)}let le=()=>Y(F().length-1),f=t=>{t.preventDefault(),t.metaKey?le():t.altKey?ae(1):Q(1)},N=t=>{t.preventDefault(),t.metaKey?Y(0):t.altKey?ae(-1):Q(-1)};return a.createElement(L.Primitive.div,{ref:n,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:t=>{var u;(u=y.onKeyDown)==null||u.call(y,t);let h=t.nativeEvent.isComposing||t.keyCode===229;if(!(t.defaultPrevented||h))switch(t.key){case"n":case"j":{M&&t.ctrlKey&&f(t);break}case"ArrowDown":{f(t);break}case"p":case"k":{M&&t.ctrlKey&&N(t);break}case"ArrowUp":{N(t);break}case"Home":{t.preventDefault(),Y(0);break}case"End":{t.preventDefault(),le();break}case"Enter":{t.preventDefault();let l=$();if(l){let b=new Event(xe);l.dispatchEvent(b)}}}}},a.createElement("label",{"cmdk-label":"",htmlFor:U.inputId,id:U.labelId,style:et},g),se(e,t=>a.createElement(Re.Provider,{value:k},a.createElement(Ee.Provider,{value:U},t))))}),ze=a.forwardRef((e,n)=>{var r,p;let i=B.useId(),c=a.useRef(null),m=a.useContext(ke),d=re(),g=we(e),o=(p=(r=g.current)==null?void 0:r.forceMount)!=null?p:m?.forceMount;T(()=>{if(!o)return d.item(i,m?.id)},[o]);let v=Se(i,c,[e.value,e.children,c],e.keywords),s=he(),I=D(j=>j.value&&j.value===v.current),R=D(j=>o||d.filter()===!1?!0:j.search?j.filtered.items.get(i)>0:!0);a.useEffect(()=>{let j=c.current;if(!(!j||e.disabled))return j.addEventListener(xe,C),()=>j.removeEventListener(xe,C)},[R,e.onSelect,e.disabled]);function C(){var j,k;G(),(k=(j=g.current).onSelect)==null||k.call(j,v.current)}function G(){s.setState("value",v.current,!0)}if(!R)return null;let{disabled:M,value:y,onSelect:ne,forceMount:A,keywords:V,...P}=e;return a.createElement(L.Primitive.div,{ref:te.composeRefs(c,n),...P,id:i,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!I,"data-disabled":!!M,"data-selected":!!I,onPointerMove:M||d.getDisablePointerSelection()?void 0:G,onClick:M?void 0:C},e.children)}),_e=a.forwardRef((e,n)=>{let{heading:r,children:p,forceMount:i,...c}=e,m=B.useId(),d=a.useRef(null),g=a.useRef(null),o=B.useId(),v=re(),s=D(R=>i||v.filter()===!1?!0:R.search?R.filtered.groups.has(m):!0);T(()=>v.group(m),[]),Se(m,d,[e.value,e.heading,g]);let I=a.useMemo(()=>({id:m,forceMount:i}),[i]);return a.createElement(L.Primitive.div,{ref:te.composeRefs(d,n),...c,"cmdk-group":"",role:"presentation",hidden:s?void 0:!0},r&&a.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:o},r),se(e,R=>a.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?o:void 0},a.createElement(ke.Provider,{value:I},R))))}),Be=a.forwardRef((e,n)=>{let{alwaysRender:r,...p}=e,i=a.useRef(null),c=D(m=>!m.search);return!r&&!c?null:a.createElement(L.Primitive.div,{ref:te.composeRefs(i,n),...p,"cmdk-separator":"",role:"separator"})}),We=a.forwardRef((e,n)=>{let{onValueChange:r,...p}=e,i=e.value!=null,c=he(),m=D(o=>o.search),d=D(o=>o.selectedItemId),g=re();return a.useEffect(()=>{e.value!=null&&c.setState("search",e.value)},[e.value]),a.createElement(L.Primitive.input,{ref:n,...p,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":d,id:g.inputId,type:"text",value:i?e.value:m,onChange:o=>{i||c.setState("search",o.target.value),r?.(o.target.value)}})}),Ge=a.forwardRef((e,n)=>{let{children:r,label:p="Suggestions",...i}=e,c=a.useRef(null),m=a.useRef(null),d=D(o=>o.selectedItemId),g=re();return a.useEffect(()=>{if(m.current&&c.current){let o=m.current,v=c.current,s,I=new ResizeObserver(()=>{s=requestAnimationFrame(()=>{let R=o.offsetHeight;v.style.setProperty("--cmdk-list-height",R.toFixed(1)+"px")})});return I.observe(o),()=>{cancelAnimationFrame(s),I.unobserve(o)}}},[]),a.createElement(L.Primitive.div,{ref:te.composeRefs(c,n),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":p,id:g.listId},se(e,o=>a.createElement("div",{ref:te.composeRefs(m,g.listInnerRef),"cmdk-list-sizer":""},o)))}),Ue=a.forwardRef((e,n)=>{let{open:r,onOpenChange:p,overlayClassName:i,contentClassName:c,container:m,...d}=e;return a.createElement(oe.Root,{open:r,onOpenChange:p},a.createElement(oe.Portal,{container:m},a.createElement(oe.Overlay,{"cmdk-overlay":"",className:i}),a.createElement(oe.Content,{"aria-label":e.label,"cmdk-dialog":"",className:c},a.createElement(Ie,{ref:n,...d}))))}),He=a.forwardRef((e,n)=>D(r=>r.filtered.count===0)?a.createElement(L.Primitive.div,{ref:n,...e,"cmdk-empty":"",role:"presentation"}):null),Je=a.forwardRef((e,n)=>{let{progress:r,children:p,label:i="Loading...",...c}=e;return a.createElement(L.Primitive.div,{ref:n,...c,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},se(e,m=>a.createElement("div",{"aria-hidden":!0},m)))}),W=Object.assign(Ie,{List:Ge,Item:ze,Input:We,Group:_e,Separator:Be,Dialog:Ue,Empty:He,Loading:Je});function Xe(e,n){let r=e.nextElementSibling;for(;r;){if(r.matches(n))return r;r=r.nextElementSibling}}function Ye(e,n){let r=e.previousElementSibling;for(;r;){if(r.matches(n))return r;r=r.previousElementSibling}}function we(e){let n=a.useRef(e);return T(()=>{n.current=e}),n}var T=typeof window>"u"?a.useEffect:a.useLayoutEffect;function _(e){let n=a.useRef();return n.current===void 0&&(n.current=e()),n}function D(e){let n=he(),r=()=>e(n.snapshot());return a.useSyncExternalStore(n.subscribe,r,r)}function Se(e,n,r,p=[]){let i=a.useRef(),c=re();return T(()=>{var m;let d=(()=>{var o;for(let v of r){if(typeof v=="string")return v.trim();if(typeof v=="object"&&"current"in v)return v.current?(o=v.current.textContent)==null?void 0:o.trim():i.current}})(),g=p.map(o=>o.trim());c.value(e,d,g),(m=n.current)==null||m.setAttribute(z,d),i.current=d}),i}var Qe=()=>{let[e,n]=a.useState(),r=_(()=>new Map);return T(()=>{r.current.forEach(p=>p()),r.current=new Map},[e]),(p,i)=>{r.current.set(p,i),n({})}};function Ze(e){let n=e.type;return typeof n=="function"?n(e.props):"render"in n?n.render(e.props):e}function se({asChild:e,children:n},r){return e&&a.isValidElement(n)?a.cloneElement(Ze(n),{ref:n.ref},r(n.props.children)):r(n)}var et={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function tt({className:e,...n}){return x.jsxRuntimeExports.jsx(W,{"data-slot":"command",className:q.cn(`
|
|
2
|
-
adm:flex adm:h-full adm:w-full adm:flex-col adm:overflow-hidden
|
|
3
|
-
adm:rounded-md adm:bg-popover adm:text-popover-foreground
|
|
4
|
-
`,e),...n})}function rt({className:e,...n}){return x.jsxRuntimeExports.jsxs("div",{"data-slot":"command-input-wrapper",className:`
|
|
5
|
-
adm:flex adm:h-9 adm:items-center adm:gap-2 adm:border-b adm:px-3
|
|
6
|
-
adm:*:data-[slot=icon]:shrink-0 adm:*:data-[slot=icon]:text-lg
|
|
7
|
-
adm:*:data-[slot=icon]:opacity-50
|
|
8
|
-
`,children:[x.jsxRuntimeExports.jsx(ee.Icon,{symbol:"search"}),x.jsxRuntimeExports.jsx(W.Input,{"data-slot":"command-input",className:q.cn(`
|
|
9
|
-
adm:flex adm:h-10 adm:w-full adm:rounded-md adm:bg-transparent
|
|
10
|
-
adm:py-3 adm:text-sm adm:outline-hidden
|
|
11
|
-
adm:placeholder:text-muted-foreground
|
|
12
|
-
adm:disabled:cursor-not-allowed adm:disabled:opacity-50
|
|
13
|
-
`,e),...n})]})}function nt({className:e,...n}){return x.jsxRuntimeExports.jsx(W.List,{"data-slot":"command-list",className:q.cn(`
|
|
14
|
-
adm:max-h-[300px] adm:scroll-py-1 adm:overflow-x-hidden
|
|
15
|
-
adm:overflow-y-auto
|
|
16
|
-
`,e),...n})}function at({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Empty,{"data-slot":"command-empty",className:q.cn("adm:py-6 adm:text-center adm:text-sm",e),...n})}function lt({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Group,{"data-slot":"command-group",className:q.cn(`
|
|
17
|
-
adm:overflow-hidden adm:p-1 adm:text-foreground
|
|
18
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:px-2
|
|
19
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:py-1.5
|
|
20
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-xs
|
|
21
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:font-medium
|
|
22
|
-
adm:**:**:**:**:**:**:[&_[cmdk-group-heading]]:text-muted-foreground
|
|
23
|
-
`,e),...n})}function it({className:e,...n}){return x.jsxRuntimeExports.jsx(W.Item,{"data-slot":"command-item",className:q.cn(`
|
|
24
|
-
adm:relative adm:flex adm:cursor-default adm:items-center adm:gap-2
|
|
25
|
-
adm:rounded-sm adm:px-2 adm:py-1.5 adm:text-sm adm:outline-hidden
|
|
26
|
-
adm:select-none
|
|
27
|
-
adm:data-[disabled=true]:pointer-events-none
|
|
28
|
-
adm:data-[disabled=true]:opacity-50
|
|
29
|
-
adm:data-[selected=true]:bg-accent
|
|
30
|
-
adm:data-[selected=true]:text-accent-foreground
|
|
31
|
-
adm:[&_svg]:pointer-events-none adm:[&_svg]:shrink-0
|
|
32
|
-
adm:[&_svg:not([class*=size-])]:size-4
|
|
33
|
-
adm:[&_svg:not([class*=text-])]:text-muted-foreground
|
|
34
|
-
`,e),...n})}function ot({searchable:e,multiple:n,icon:r,value:p,onValueChange:i,labels:c,options:m,classNames:d,selectedFeedback:g="checkbox",alwaysShowPlaceholder:o=!1,valuePosition:v="right",renders:s}){const I=ue.useRef(null),[R,C]=ue.useState(!1),[G,M]=ue.useState(n?[]:""),y=p!==void 0?p:G,A={...{placeholder:"Select options...",searchPlaceholder:"Search options...",noItemsFound:"No options found.",multipleSelected:f=>`${f} options selected`},...c},V=f=>{i?i(f):M(f)},P=()=>n&&Array.isArray(y)?y.length===0?null:y.length===1?m.find(f=>f.value===y[0])?.label:A.multipleSelected?.(y.length)||`${y.length} options selected`:!n&&typeof y=="string"&&y?m.find(f=>f.value===y)?.label:null,j=()=>n&&Array.isArray(y)?y.length>0:typeof y=="string"&&y!=="",k=f=>n&&Array.isArray(y)?y.includes(f):y===f,U=f=>{if(n){const N=Array.isArray(y)?y:[],t=N.includes(f)?N.filter(u=>u!==f):[...N,f];V(t)}else V(f===y?"":f),C(!1)},H=f=>{const N=k(f),t=m.find(u=>u.value===f);return s?.selectedFeedback?s.selectedFeedback({option:t,isSelected:N,type:g}):g==="check"?x.jsxRuntimeExports.jsx("span",{className:q.cn(`
|
|
35
|
-
adm:absolute adm:right-2 adm:flex adm:size-3.5 adm:items-center
|
|
36
|
-
adm:justify-center
|
|
37
|
-
`,d?.check),children:N&&x.jsxRuntimeExports.jsx(ee.Icon,{symbol:"check"})}):x.jsxRuntimeExports.jsx(Ae.Checkbox,{checked:N,className:d?.checkbox})},K=()=>s?.placeholder?s.placeholder({text:A.placeholder||"",hasValue:j()}):x.jsxRuntimeExports.jsx("span",{className:"adm:opacity-70",children:A.placeholder}),O=()=>s?.displayValue?s.displayValue({text:P()??null,value:y}):x.jsxRuntimeExports.jsx("span",{children:P()}),J=()=>o?x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[r&&x.jsxRuntimeExports.jsx(ee.Icon,{symbol:r,className:"adm:opacity-50"}),K(),j()&&v==="left"&&O()]}):x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[r&&x.jsxRuntimeExports.jsx(ee.Icon,{symbol:r,className:"adm:opacity-50"}),j()?O():K()]}),X=()=>s?.triggerIcon?s.triggerIcon({open:R}):x.jsxRuntimeExports.jsx(ee.Icon,{symbol:"expand_more",className:"adm:opacity-50"}),$=()=>o&&j()&&v==="right"?x.jsxRuntimeExports.jsxs("span",{className:"adm:flex adm:items-center adm:gap-2",children:[O(),X()]}):x.jsxRuntimeExports.jsx("span",{className:"adm:flex adm:items-center adm:gap-2",children:X()}),F=()=>s?.trigger?s.trigger({open:R,value:y,displayText:P()||"",placeholder:A.placeholder||"",hasValue:j(),icon:r}):x.jsxRuntimeExports.jsxs(Ce.Button,{ref:I,variant:"outline",role:"combobox","aria-expanded":R,className:q.cn("adm:justify-between adm:font-normal",d?.trigger),children:[J(),$()]}),Y=()=>e?s?.searchInput?s.searchInput({placeholder:A.searchPlaceholder||""}):x.jsxRuntimeExports.jsx(rt,{placeholder:A.searchPlaceholder,className:d?.input}):null,Q=()=>s?.empty?s.empty({text:A.noItemsFound||""}):x.jsxRuntimeExports.jsx(x.jsxRuntimeExports.Fragment,{children:A.noItemsFound}),ae=f=>s?.optionLabel?s.optionLabel({option:f}):x.jsxRuntimeExports.jsx(x.jsxRuntimeExports.Fragment,{children:f.label}),le=f=>s?.option?x.jsxRuntimeExports.jsx("div",{children:s.option({option:f,isSelected:k(f.value),selectedFeedback:g})},f.value):x.jsxRuntimeExports.jsxs(it,{value:f.value,onSelect:U,disabled:f.disabled,className:q.cn(d?.item,g==="check"&&"adm:pr-8"),children:[g==="checkbox"&&H(f.value),ae(f),g==="check"&&H(f.value)]},f.value);return x.jsxRuntimeExports.jsxs(ce.Popover,{open:R,onOpenChange:C,children:[x.jsxRuntimeExports.jsx(ce.PopoverTrigger,{asChild:!0,children:F()}),x.jsxRuntimeExports.jsx(ce.PopoverContent,{align:"start",className:q.cn("adm:p-0",d?.popover),style:{minWidth:I.current?.offsetWidth},children:x.jsxRuntimeExports.jsxs(tt,{className:d?.command,children:[Y(),x.jsxRuntimeExports.jsxs(nt,{className:d?.list,children:[x.jsxRuntimeExports.jsx(at,{className:d?.empty,children:Q()}),x.jsxRuntimeExports.jsx(lt,{className:d?.group,children:m.map(f=>le(f))})]})]})})]})}exports.Combobox=ot;
|