@brightlocal/ui-components 1.2.0 → 1.2.2
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/component-meta.json +112 -474
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +20 -16
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +1 -1
- package/dist/centred-layout.js +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +2 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +177 -150
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +53 -47
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.js +9 -9
- package/package.json +1 -1
- package/src/components/card.tsx +8 -4
- package/src/components/centred-layout.tsx +2 -2
- package/src/components/combobox.tsx +97 -4
- package/src/components/sonner.tsx +36 -27
- package/src/components/split-layout.tsx +3 -3
package/dist/card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),w=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils");function R(t){const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),h=require("react"),w=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils");function R(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,o.get?o:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const a=R(h),c=a.createContext({flush:!1}),O=w.cva(["flex","flex-col","gap-8","rounded-xl","py-section-md","transition-colors","w-full"],{variants:{variant:{default:["bg-card","text-card-foreground","border","border-card-border"],transparent:["bg-transparent","text-foreground"],border:["bg-transparent","text-foreground","border","border-border"],"transparent-flush":["bg-transparent","text-foreground"]}},defaultVariants:{variant:"default"}}),i=a.forwardRef(({className:t,variant:e="default",dataHook:r,trackingEl:o,trackingLabel:x,maxWidth:n="400px",children:g,style:b,...y},j)=>{const v=e==="transparent-flush",N=n!==void 0?{maxWidth:typeof n=="number"?`${n}px`:n}:void 0;return s.jsx(c.Provider,{value:{flush:v},children:s.jsx("div",{ref:j,className:d.cn(O({variant:e}),t),"data-hook":r,"data-slot":"card","data-tracking-el":o||`card-${e}`,"data-tracking-label":x,style:{...N,...b},...y,children:g})})});i.displayName="Card";const l=a.forwardRef(({className:t,...e},r)=>{const{flush:o}=a.useContext(c);return s.jsx("div",{ref:r,className:d.cn("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",!o&&"px-section-md",t),"data-slot":"card-header",...e})});l.displayName="CardHeader";const u=a.forwardRef(({className:t,...e},r)=>s.jsx("div",{ref:r,className:d.cn("heading-sm",t),"data-slot":"card-title",...e}));u.displayName="CardTitle";const f=a.forwardRef(({className:t,...e},r)=>s.jsx("div",{ref:r,className:d.cn("text-muted-foreground text-sm leading-normal font-normal",t),"data-slot":"card-description",...e}));f.displayName="CardDescription";const p=a.forwardRef(({className:t,...e},r)=>s.jsx("div",{ref:r,className:d.cn("col-start-2 row-span-2 row-start-1 self-start justify-self-end",t),"data-slot":"card-action",...e}));p.displayName="CardAction";const m=a.forwardRef(({className:t,...e},r)=>{const{flush:o}=a.useContext(c);return s.jsx("div",{ref:r,className:d.cn(!o&&"px-section-md",t),"data-slot":"card-content",...e})});m.displayName="CardContent";const C=a.forwardRef(({className:t,...e},r)=>{const{flush:o}=a.useContext(c);return s.jsx("div",{ref:r,className:d.cn("flex items-center",!o&&"px-section-md",t),"data-slot":"card-footer",...e})});C.displayName="CardFooter";exports.Card=i;exports.CardAction=p;exports.CardContent=m;exports.CardDescription=f;exports.CardFooter=C;exports.CardHeader=l;exports.CardTitle=u;
|
package/dist/card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;GAEG;AACH,KAAK,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,GAAG,mBAAmB,CAAC;AA0C9E;;GAEG;AACH,KAAK,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7C;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAyCT,CAAC;AAIF;;GAEG;AACH,KAAK,qBAAqB,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IACzD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAgBf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,SAAS,2GASd,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,eAAe,2GAYpB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,2GAYf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,WAAW,2GAYhB,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../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/card.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import * as e from "react";
|
|
3
3
|
import { cva as x } from "class-variance-authority";
|
|
4
4
|
import { cn as s } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
const
|
|
5
|
+
const c = e.createContext({ flush: !1 }), g = x(
|
|
6
6
|
[
|
|
7
7
|
"flex",
|
|
8
8
|
"flex-col",
|
|
9
9
|
"gap-8",
|
|
10
10
|
"rounded-xl",
|
|
11
|
-
"py-
|
|
11
|
+
"py-section-md",
|
|
12
12
|
"transition-colors",
|
|
13
13
|
"w-full"
|
|
14
14
|
],
|
|
@@ -41,26 +41,26 @@ const l = e.createContext({ flush: !1 }), g = x(
|
|
|
41
41
|
variant: a = "default",
|
|
42
42
|
dataHook: t,
|
|
43
43
|
trackingEl: d,
|
|
44
|
-
trackingLabel:
|
|
44
|
+
trackingLabel: l,
|
|
45
45
|
maxWidth: n = "400px",
|
|
46
46
|
children: i,
|
|
47
47
|
style: f,
|
|
48
|
-
...
|
|
49
|
-
},
|
|
50
|
-
const
|
|
48
|
+
...m
|
|
49
|
+
}, u) => {
|
|
50
|
+
const p = a === "transparent-flush", C = n !== void 0 ? {
|
|
51
51
|
maxWidth: typeof n == "number" ? `${n}px` : n
|
|
52
52
|
} : void 0;
|
|
53
|
-
return /* @__PURE__ */ o(
|
|
53
|
+
return /* @__PURE__ */ o(c.Provider, { value: { flush: p }, children: /* @__PURE__ */ o(
|
|
54
54
|
"div",
|
|
55
55
|
{
|
|
56
|
-
ref:
|
|
56
|
+
ref: u,
|
|
57
57
|
className: s(g({ variant: a }), r),
|
|
58
58
|
"data-hook": t,
|
|
59
59
|
"data-slot": "card",
|
|
60
60
|
"data-tracking-el": d || `card-${a}`,
|
|
61
|
-
"data-tracking-label":
|
|
61
|
+
"data-tracking-label": l,
|
|
62
62
|
style: { ...C, ...f },
|
|
63
|
-
...
|
|
63
|
+
...m,
|
|
64
64
|
children: i
|
|
65
65
|
}
|
|
66
66
|
) });
|
|
@@ -69,14 +69,14 @@ const l = e.createContext({ flush: !1 }), g = x(
|
|
|
69
69
|
N.displayName = "Card";
|
|
70
70
|
const b = e.forwardRef(
|
|
71
71
|
({ className: r, ...a }, t) => {
|
|
72
|
-
const { flush: d } = e.useContext(
|
|
72
|
+
const { flush: d } = e.useContext(c);
|
|
73
73
|
return /* @__PURE__ */ o(
|
|
74
74
|
"div",
|
|
75
75
|
{
|
|
76
76
|
ref: t,
|
|
77
77
|
className: s(
|
|
78
78
|
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 has-data-[slot=card-action]:grid-cols-[1fr_auto]",
|
|
79
|
-
!d && "px-
|
|
79
|
+
!d && "px-section-md",
|
|
80
80
|
r
|
|
81
81
|
),
|
|
82
82
|
"data-slot": "card-header",
|
|
@@ -130,12 +130,12 @@ const w = e.forwardRef(
|
|
|
130
130
|
w.displayName = "CardAction";
|
|
131
131
|
const y = e.forwardRef(
|
|
132
132
|
({ className: r, ...a }, t) => {
|
|
133
|
-
const { flush: d } = e.useContext(
|
|
133
|
+
const { flush: d } = e.useContext(c);
|
|
134
134
|
return /* @__PURE__ */ o(
|
|
135
135
|
"div",
|
|
136
136
|
{
|
|
137
137
|
ref: t,
|
|
138
|
-
className: s(!d && "px-
|
|
138
|
+
className: s(!d && "px-section-md", r),
|
|
139
139
|
"data-slot": "card-content",
|
|
140
140
|
...a
|
|
141
141
|
}
|
|
@@ -145,12 +145,16 @@ const y = e.forwardRef(
|
|
|
145
145
|
y.displayName = "CardContent";
|
|
146
146
|
const R = e.forwardRef(
|
|
147
147
|
({ className: r, ...a }, t) => {
|
|
148
|
-
const { flush: d } = e.useContext(
|
|
148
|
+
const { flush: d } = e.useContext(c);
|
|
149
149
|
return /* @__PURE__ */ o(
|
|
150
150
|
"div",
|
|
151
151
|
{
|
|
152
152
|
ref: t,
|
|
153
|
-
className: s(
|
|
153
|
+
className: s(
|
|
154
|
+
"flex items-center",
|
|
155
|
+
!d && "px-section-md",
|
|
156
|
+
r
|
|
157
|
+
),
|
|
154
158
|
"data-slot": "card-footer",
|
|
155
159
|
...a
|
|
156
160
|
}
|
package/dist/centred-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("react"),o=require("@brightlocal/ui-components/lib/utils");function m(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const c=m(y),l=c.forwardRef(({className:e,children:a,dataHook:t,trackingEl:r,trackingLabel:d,...i},f)=>n.jsx("div",{ref:f,className:o.cn("bg-background p-section flex min-h-screen w-full flex-col items-center justify-center gap-4",e),"data-hook":t,"data-slot":"centred-layout","data-tracking-el":r,"data-tracking-label":d,...i,children:a}));l.displayName="CentredLayout";const s=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full items-center justify-center lg:justify-start",e),"data-slot":"centred-layout-header",...t,children:a}));s.displayName="CentredLayoutHeader";const u=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full flex-1 flex-col items-center justify-center",e),"data-slot":"centred-layout-content",...t,children:a}));u.displayName="CentredLayoutContent";exports.CentredLayout=l;exports.CentredLayoutContent=u;exports.CentredLayoutHeader=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),y=require("react"),o=require("@brightlocal/ui-components/lib/utils");function m(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const c=m(y),l=c.forwardRef(({className:e,children:a,dataHook:t,trackingEl:r,trackingLabel:d,...i},f)=>n.jsx("div",{ref:f,className:o.cn("bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4",e),"data-hook":t,"data-slot":"centred-layout","data-tracking-el":r,"data-tracking-label":d,...i,children:a}));l.displayName="CentredLayout";const s=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full items-center justify-center lg:justify-start",e),"data-slot":"centred-layout-header",...t,children:a}));s.displayName="CentredLayoutHeader";const u=c.forwardRef(({className:e,children:a,...t},r)=>n.jsx("div",{ref:r,className:o.cn("flex w-full flex-1 flex-col items-center justify-center",e),"data-slot":"centred-layout-content",...t,children:a}));u.displayName="CentredLayoutContent";exports.CentredLayout=l;exports.CentredLayoutContent=u;exports.CentredLayoutHeader=s;
|
package/dist/centred-layout.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
* CentredLayout provides a full-page centered container.
|
|
4
4
|
*
|
|
5
5
|
* Spacing tokens used:
|
|
6
|
-
* - Padding: section-
|
|
6
|
+
* - Padding: p-section-sm utility (16px mobile/tablet, 24px desktop)
|
|
7
7
|
* - Header to content gap: gap-4 (spacing.4 = 16px)
|
|
8
8
|
*
|
|
9
9
|
* The component takes full page width/height and centers content horizontally and vertically.
|
package/dist/centred-layout.js
CHANGED
|
@@ -8,7 +8,7 @@ const f = o.forwardRef(
|
|
|
8
8
|
ref: c,
|
|
9
9
|
className: l(
|
|
10
10
|
// Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
|
|
11
|
-
"bg-background p-section flex min-h-screen w-full flex-col items-center justify-center gap-4",
|
|
11
|
+
"bg-background p-section-sm flex min-h-screen w-full flex-col items-center justify-center gap-4",
|
|
12
12
|
e
|
|
13
13
|
),
|
|
14
14
|
"data-hook": a,
|
package/dist/combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),U=require("react"),E=require("@brightlocal/icons"),V=require("class-variance-authority"),$=require("cmdk"),k=require("@brightlocal/ui-components/lib/utils"),L=require("@brightlocal/ui-components/popover"),y=require("@brightlocal/ui-components/command");function z(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(o,a,r.get?r:{enumerable:!0,get:()=>e[a]})}}return o.default=e,Object.freeze(o)}const t=z(U),T=t.createContext(null);function R(){const e=t.useContext(T);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function H({value:e,onValueChange:o,open:a,onOpenChange:r,shouldFilter:i=!0,disabled:u=!1,itemToStringValue:c,children:b}){const[h,C]=t.useState(""),[f,w]=t.useState(!1),[v,s]=t.useState(()=>new Map),x=e!==void 0,p=a!==void 0,d=x?e:h,m=p?a:f,g=t.useCallback(l=>{p||w(l),r?.(l)},[p,r]),j=t.useCallback(l=>{x||C(l),o?.(l)},[x,o]),N=t.useCallback((l,O)=>{s(I=>{if(I.get(l)===O)return I;const q=new Map(I);return q.set(l,O),q})},[]),S=t.useMemo(()=>({open:m,setOpen:g,value:d,onValueChange:j,shouldFilter:i,disabled:u,itemLabels:v,registerItem:N,itemToStringValue:c}),[m,g,d,j,i,u,v,N,c]);return n.jsx(T.Provider,{value:S,children:n.jsx(L.Popover,{open:m,onOpenChange:g,children:b})})}const B=V.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-sm font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","disabled:hover:bg-neutral-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{variant:{default:[]}},defaultVariants:{variant:"default"}}),F=t.forwardRef(({className:e,variant:o,dataHook:a,error:r,trackingEl:i,trackingLabel:u,children:c,...b},h)=>{const{open:C,disabled:f,value:w}=R(),v=t.useId(),s=!w,x=r||b["aria-invalid"]===!0||b["aria-invalid"]==="true";return n.jsx(L.PopoverTrigger,{asChild:!0,children:n.jsxs("button",{ref:h,"aria-controls":C?v:void 0,"aria-expanded":C,"aria-haspopup":"listbox","aria-invalid":x?"true":void 0,className:k.cn(B({variant:o}),x&&"border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",e),"data-hook":a,"data-placeholder":s,"data-slot":"combobox-trigger","data-state":C?"open":"closed","data-tracking-el":i||"combobox-trigger","data-tracking-label":u,disabled:f||b.disabled,role:"combobox",type:"button",...b,children:[c,n.jsx(E.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});F.displayName="ComboboxTrigger";function J({placeholder:e,className:o}){const{value:a,itemLabels:r}=R(),i=a?r.get(a)||a:e;return n.jsx("span",{className:k.cn("text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",o),"data-slot":"combobox-value",children:i})}function K({dataHook:e,className:o,children:a,align:r="start",side:i="bottom",sideOffset:u,avoidCollisions:c,hideList:b=!1}){const{open:h,shouldFilter:C,itemToStringValue:f}=R(),[w,v]=t.useState(null),s=t.useRef(null),x=t.useCallback(d=>{if(s.current?.(),s.current=null,!d)return;let m=!1;const g=l=>{m||(l==="top"||l==="bottom")&&(m=!0,j.disconnect(),v(l))},j=new MutationObserver(()=>{g(d.getAttribute("data-side"))});j.observe(d,{attributes:!0,attributeFilter:["data-side"]});let N=0,S=0;N=requestAnimationFrame(()=>{S=requestAnimationFrame(()=>{g(d.getAttribute("data-side"))})}),s.current=()=>{m=!0,j.disconnect(),cancelAnimationFrame(N),cancelAnimationFrame(S)}},[]);t.useEffect(()=>{h||(s.current?.(),s.current=null,v(null))},[h]);const p=t.useMemo(()=>{if(f)return(d,m,g)=>$.defaultFilter(f(d),m,g)},[f]);return n.jsx(L.PopoverContent,{ref:x,align:r,"aria-label":"Options",avoidCollisions:c,className:k.cn("w-[var(--radix-popover-trigger-width)] p-0",o),"data-slot":"combobox-popover",side:w??i,sideOffset:u,children:n.jsx(y.Command,{className:k.cn("border-0 shadow-none",b&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:p,shouldFilter:C,children:a})})}const M=t.forwardRef((e,o)=>n.jsx(y.CommandInput,{ref:o,"data-slot":"combobox-input",...e}));M.displayName="ComboboxInput";const P=t.forwardRef((e,o)=>n.jsx(y.CommandList,{ref:o,"data-slot":"combobox-list",...e}));P.displayName="ComboboxList";const A=t.forwardRef((e,o)=>n.jsx(y.CommandEmpty,{ref:o,"data-slot":"combobox-empty",...e}));A.displayName="ComboboxEmpty";const _=t.forwardRef((e,o)=>n.jsx(y.CommandGroup,{ref:o,"data-slot":"combobox-group",...e}));_.displayName="ComboboxGroup";function Q(e,o,a){if(!o||!o.trim())return e;const r=new RegExp(`(${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),i=e.split(r);return n.jsx("span",{children:i.map((u,c)=>c%2===1?n.jsx("span",{className:a,children:u},c):n.jsx(t.Fragment,{children:u},c))})}const G=t.forwardRef(({value:e,label:o,dataHook:a,children:r,className:i,highlight:u,highlightClassName:c,keywords:b,...h},C)=>{const{value:f,onValueChange:w,setOpen:v,registerItem:s}=R(),x=f===e,p=t.useMemo(()=>o||(typeof r=="string"?r:typeof r=="number"?String(r):e),[o,r,e]),d=t.useRef(s);t.useEffect(()=>{d.current=s},[s]),t.useEffect(()=>{d.current(e,p)},[e,p]);const m=()=>{w(e===f?"":e),v(!1)},g=()=>u&&typeof r=="string"?Q(r,u,c||"text-sm leading-normal font-semibold"):r;return n.jsxs(y.CommandItem,{ref:C,className:k.cn("justify-between",i),"data-slot":"combobox-item",dataHook:a,keywords:b?[p,...b]:[p],value:e,onSelect:m,...h,children:[g(),x&&n.jsx(E.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});G.displayName="ComboboxItem";const D=t.forwardRef((e,o)=>n.jsx(y.CommandSeparator,{ref:o,"data-slot":"combobox-separator",...e}));D.displayName="ComboboxSeparator";function W({className:e,children:o}){return n.jsx("div",{"aria-disabled":"true","aria-selected":"false",className:k.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",e),"data-slot":"combobox-loading",role:"option",children:o||n.jsxs(n.Fragment,{children:[n.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"}),"Loading..."]})})}exports.Combobox=H;exports.ComboboxContent=K;exports.ComboboxEmpty=A;exports.ComboboxGroup=_;exports.ComboboxInput=M;exports.ComboboxItem=G;exports.ComboboxList=P;exports.ComboboxLoading=W;exports.ComboboxSeparator=D;exports.ComboboxTrigger=F;exports.ComboboxValue=J;
|
package/dist/combobox.d.ts
CHANGED
|
@@ -54,8 +54,8 @@ export interface ComboboxContentProps {
|
|
|
54
54
|
children: React.ReactNode;
|
|
55
55
|
/** Alignment of the popover relative to trigger */
|
|
56
56
|
align?: "start" | "center" | "end";
|
|
57
|
-
/** Which side of the trigger to render the popover. @default "bottom" */
|
|
58
|
-
side?: "top" | "
|
|
57
|
+
/** Which side of the trigger to render the popover. Only vertical positioning is supported — the dropdown spans the full trigger width. @default "bottom" */
|
|
58
|
+
side?: "top" | "bottom";
|
|
59
59
|
/** Distance in px between the trigger and the popover. @default 4 */
|
|
60
60
|
sideOffset?: number;
|
|
61
61
|
/**
|
package/dist/combobox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AASlE,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAkC5C,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kHAAkH;IAClH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,eAAe;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,iBAAS,QAAQ,CAAC,EAChB,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,uBAAuB,EACtC,IAAI,EAAE,cAAc,EACpB,YAAY,EAAE,sBAAsB,EACpC,YAAmB,EACnB,QAAgB,EAChB,iBAAiB,EACjB,QAAQ,GACT,EAAE,aAAa,2CA0Ef;AAMD,QAAA,MAAM,uBAAuB;;8EA4C5B,CAAC;AAEF,MAAM,WAAW,oBACf,SACE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,YAAY,CAAC,OAAO,uBA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