@brightlocal/ui-components 0.5.0 → 1.0.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.
Files changed (52) hide show
  1. package/dist/alert.d.ts +2 -2
  2. package/dist/blocks/sidebar.d.ts +6 -6
  3. package/dist/button.d.ts +2 -2
  4. package/dist/carousel.d.ts +1 -1
  5. package/dist/combobox.cjs +1 -1
  6. package/dist/combobox.d.ts +11 -7
  7. package/dist/combobox.d.ts.map +1 -1
  8. package/dist/combobox.js +144 -133
  9. package/dist/date-picker.d.ts +2 -2
  10. package/dist/field.cjs +1 -1
  11. package/dist/field.d.ts +11 -4
  12. package/dist/field.d.ts.map +1 -1
  13. package/dist/field.js +113 -80
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.js +253 -255
  16. package/dist/input-group.d.ts +1 -1
  17. package/dist/input-otp.cjs +1 -1
  18. package/dist/input-otp.d.ts +3 -20
  19. package/dist/input-otp.d.ts.map +1 -1
  20. package/dist/input-otp.js +91 -132
  21. package/dist/input-password.d.ts +1 -1
  22. package/dist/label.d.ts +2 -3
  23. package/dist/label.d.ts.map +1 -1
  24. package/dist/radio-group.cjs +1 -1
  25. package/dist/radio-group.d.ts +3 -19
  26. package/dist/radio-group.d.ts.map +1 -1
  27. package/dist/radio-group.js +92 -120
  28. package/dist/resizable.d.ts +1 -1
  29. package/dist/select.cjs +1 -1
  30. package/dist/select.d.ts.map +1 -1
  31. package/dist/select.js +19 -19
  32. package/dist/switch.cjs +1 -1
  33. package/dist/switch.d.ts +1 -21
  34. package/dist/switch.d.ts.map +1 -1
  35. package/dist/switch.js +31 -100
  36. package/package.json +2 -2
  37. package/src/components/combobox.tsx +22 -2
  38. package/src/components/field.tsx +47 -7
  39. package/src/components/input-otp.tsx +9 -89
  40. package/src/components/label.tsx +2 -2
  41. package/src/components/radio-group.tsx +65 -129
  42. package/src/components/select.tsx +3 -2
  43. package/src/components/switch.tsx +29 -140
  44. package/dist/link.figma.d.ts +0 -2
  45. package/dist/link.figma.d.ts.map +0 -1
  46. package/dist/switch.figma.d.ts +0 -2
  47. package/dist/switch.figma.d.ts.map +0 -1
  48. package/dist/toggle.figma.d.ts +0 -2
  49. package/dist/toggle.figma.d.ts.map +0 -1
  50. package/src/components/link.figma.tsx +0 -71
  51. package/src/components/switch.figma.tsx +0 -111
  52. package/src/components/toggle.figma.tsx +0 -75
package/dist/alert.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
2
  import * as React from "react";
3
3
  declare const alertVariants: (props?: ({
4
- variant?: "info" | "default" | "success" | "destructive" | "warning" | null | undefined;
4
+ variant?: "default" | "info" | "success" | "destructive" | "warning" | null | undefined;
5
5
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
6
6
  declare const Alert: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & VariantProps<(props?: ({
7
- variant?: "info" | "default" | "success" | "destructive" | "warning" | null | undefined;
7
+ variant?: "default" | "info" | "success" | "destructive" | "warning" | null | undefined;
8
8
  } & import('class-variance-authority/types').ClassProp) | undefined) => string> & React.RefAttributes<HTMLDivElement>>;
9
9
  declare const AlertTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
10
10
  declare const AlertDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -1,8 +1,8 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
- import { Button } from '../components/button';
3
- import { Input } from '../components/input';
4
- import { Separator } from '../components/separator';
5
- import { TooltipContent } from '../components/tooltip';
2
+ import { Button } from '../button';
3
+ import { Input } from '../input';
4
+ import { Separator } from '../separator';
5
+ import { TooltipContent } from '../tooltip';
6
6
  import * as React from "react";
7
7
  /**
8
8
  * Sidebar position variants
@@ -277,7 +277,7 @@ interface SidebarGroupProps extends React.ComponentProps<"div"> {
277
277
  declare const SidebarGroup: React.ForwardRefExoticComponent<Omit<SidebarGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
278
278
  declare const sidebarGroupLabelVariants: (props?: ({
279
279
  size?: "default" | "sm" | "xs" | null | undefined;
280
- variant?: "collapsible" | "default" | "action" | null | undefined;
280
+ variant?: "default" | "collapsible" | "action" | null | undefined;
281
281
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
282
282
  /**
283
283
  * Props for the SidebarGroupLabel component
@@ -426,7 +426,7 @@ interface SidebarMenuSkeletonProps extends React.ComponentProps<"div"> {
426
426
  }
427
427
  declare const SidebarMenuSkeleton: React.ForwardRefExoticComponent<Omit<SidebarMenuSkeletonProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
428
428
  declare const sidebarMenuSubVariants: (props?: ({
429
- variant?: "indent" | "default" | "border" | null | undefined;
429
+ variant?: "default" | "indent" | "border" | null | undefined;
430
430
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
431
431
  /**
432
432
  * Props for the SidebarMenuSub component
package/dist/button.d.ts CHANGED
@@ -15,9 +15,9 @@ type ButtonVariantProps = {
15
15
  size?: "default" | "sm" | "lg";
16
16
  };
17
17
  declare const ButtonVariants: (props?: ({
18
- variant?: "ghost" | "default" | "destructive" | "warning" | "outline" | "secondary" | null | undefined;
18
+ variant?: "default" | "ghost" | "destructive" | "warning" | "outline" | "secondary" | null | undefined;
19
19
  size?: "default" | "sm" | "lg" | null | undefined;
20
- state?: "disabled" | "default" | "loading" | null | undefined;
20
+ state?: "default" | "disabled" | "loading" | null | undefined;
21
21
  fullWidth?: boolean | null | undefined;
22
22
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
23
23
  /**
@@ -1,5 +1,5 @@
1
1
  import { default as useEmblaCarousel, UseEmblaCarouselType } from 'embla-carousel-react';
2
- import { ButtonProps } from '../button';
2
+ import { ButtonProps } from '@brightlocal/ui-components/button';
3
3
  import * as React from "react";
4
4
  type CarouselApi = UseEmblaCarouselType[1];
5
5
  type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
package/dist/combobox.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),V=require("react"),T=require("@brightlocal/icons"),$=require("class-variance-authority"),f=require("@brightlocal/ui-components/lib/utils"),S=require("@brightlocal/ui-components/popover"),l=require("@brightlocal/ui-components/command");function z(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const t=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(e,a,t.get?t:{enumerable:!0,get:()=>o[a]})}}return e.default=o,Object.freeze(e)}const r=z(V),E=r.createContext(null);function y(){const o=r.useContext(E);if(!o)throw new Error("Combobox components must be used within a <Combobox>");return o}function F({value:o,onValueChange:e,open:a,onOpenChange:t,shouldFilter:s=!0,disabled:c=!1,children:i}){const[g,d]=r.useState(""),[m,C]=r.useState(!1),[x,u]=r.useState(()=>new Map),v=o!==void 0,p=a!==void 0,h=v?o:g,w=p?a:m,j=r.useCallback(b=>{p||C(b),t?.(b)},[p,t]),N=r.useCallback(b=>{v||d(b),e?.(b)},[v,e]),I=r.useCallback((b,R)=>{u(k=>{if(k.get(b)===R)return k;const L=new Map(k);return L.set(b,R),L})},[]),U=r.useMemo(()=>({open:w,setOpen:j,value:h,onValueChange:N,shouldFilter:s,disabled:c,itemLabels:x,registerItem:I}),[w,j,h,N,s,c,x,I]);return n.jsx(E.Provider,{value:U,children:n.jsx(S.Popover,{open:w,onOpenChange:j,children:i})})}const A=$.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","hover:bg-accent","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"}}),O=r.forwardRef(({className:o,variant:e,dataHook:a,trackingEl:t,trackingLabel:s,children:c,...i},g)=>{const{open:d,disabled:m,value:C}=y(),x=r.useId(),u=!C;return n.jsx(S.PopoverTrigger,{asChild:!0,children:n.jsxs("button",{ref:g,"aria-controls":d?x:void 0,"aria-expanded":d,"aria-haspopup":"listbox",className:f.cn(A({variant:e}),o),"data-hook":a,"data-placeholder":u,"data-slot":"combobox-trigger","data-state":d?"open":"closed","data-tracking-el":t||"combobox-trigger","data-tracking-label":s,disabled:m||i.disabled,role:"combobox",type:"button",...i,children:[c,n.jsx(T.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});O.displayName="ComboboxTrigger";function H({placeholder:o,className:e}){const{value:a,itemLabels:t}=y(),s=a?t.get(a)||a:o;return n.jsx("span",{className:f.cn("text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",e),"data-slot":"combobox-value",children:s})}function B({dataHook:o,className:e,children:a,align:t="start",hideList:s=!1}){const{shouldFilter:c}=y();return n.jsx(S.PopoverContent,{align:t,className:f.cn("w-[var(--radix-popover-trigger-width)] p-0",e),"data-slot":"combobox-popover",side:"bottom",children:n.jsx(l.Command,{className:f.cn("border-0 shadow-none",s&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:o||"combobox-command",shouldFilter:c,children:a})})}const P=r.forwardRef((o,e)=>n.jsx(l.CommandInput,{ref:e,"data-slot":"combobox-input",...o}));P.displayName="ComboboxInput";const q=r.forwardRef((o,e)=>n.jsx(l.CommandList,{ref:e,"data-slot":"combobox-list",...o}));q.displayName="ComboboxList";const M=r.forwardRef((o,e)=>n.jsx(l.CommandEmpty,{ref:e,"data-slot":"combobox-empty",...o}));M.displayName="ComboboxEmpty";const _=r.forwardRef((o,e)=>n.jsx(l.CommandGroup,{ref:e,"data-slot":"combobox-group",...o}));_.displayName="ComboboxGroup";function J(o,e,a){if(!e||!e.trim())return o;const t=new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),s=o.split(t);return n.jsx("span",{children:s.map((c,i)=>i%2===1?n.jsx("span",{className:a,children:c},i):n.jsx(r.Fragment,{children:c},i))})}const G=r.forwardRef(({value:o,label:e,dataHook:a,children:t,className:s,highlight:c,highlightClassName:i,...g},d)=>{const{value:m,onValueChange:C,setOpen:x,registerItem:u}=y(),v=m===o,p=r.useMemo(()=>e||(typeof t=="string"?t:typeof t=="number"?String(t):o),[e,t,o]),h=r.useRef(u);r.useEffect(()=>{h.current=u},[u]),r.useEffect(()=>{h.current(o,p)},[o,p]);const w=()=>{C(o===m?"":o),x(!1)},j=()=>c&&typeof t=="string"?J(t,c,i||"text-sm leading-normal font-semibold"):t;return n.jsxs(l.CommandItem,{ref:d,className:f.cn("justify-between",s),"data-slot":"combobox-item",dataHook:a,value:o,onSelect:w,...g,children:[j(),v&&n.jsx(T.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});G.displayName="ComboboxItem";const D=r.forwardRef((o,e)=>n.jsx(l.CommandSeparator,{ref:e,"data-slot":"combobox-separator",...o}));D.displayName="ComboboxSeparator";function K({className:o,children:e}){return n.jsx("div",{className:f.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",o),"data-slot":"combobox-loading",children:e||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=F;exports.ComboboxContent=B;exports.ComboboxEmpty=M;exports.ComboboxGroup=_;exports.ComboboxInput=P;exports.ComboboxItem=G;exports.ComboboxList=q;exports.ComboboxLoading=K;exports.ComboboxSeparator=D;exports.ComboboxTrigger=O;exports.ComboboxValue=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),V=require("react"),O=require("@brightlocal/icons"),$=require("class-variance-authority"),z=require("cmdk"),g=require("@brightlocal/ui-components/lib/utils"),I=require("@brightlocal/ui-components/popover"),p=require("@brightlocal/ui-components/command");function A(o){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const a in o)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(o,a);Object.defineProperty(e,a,r.get?r:{enumerable:!0,get:()=>o[a]})}}return e.default=o,Object.freeze(e)}const t=A(V),q=t.createContext(null);function k(){const o=t.useContext(q);if(!o)throw new Error("Combobox components must be used within a <Combobox>");return o}function H({value:o,onValueChange:e,open:a,onOpenChange:r,shouldFilter:i=!0,disabled:c=!1,itemToStringValue:s,children:b}){const[d,x]=t.useState(""),[u,C]=t.useState(!1),[f,v]=t.useState(()=>new Map),h=o!==void 0,l=a!==void 0,w=h?o:d,j=l?a:u,y=t.useCallback(m=>{l||C(m),r?.(m)},[l,r]),N=t.useCallback(m=>{h||x(m),e?.(m)},[h,e]),R=t.useCallback((m,L)=>{v(S=>{if(S.get(m)===L)return S;const T=new Map(S);return T.set(m,L),T})},[]),U=t.useMemo(()=>({open:j,setOpen:y,value:w,onValueChange:N,shouldFilter:i,disabled:c,itemLabels:f,registerItem:R,itemToStringValue:s}),[j,y,w,N,i,c,f,R,s]);return n.jsx(q.Provider,{value:U,children:n.jsx(I.Popover,{open:j,onOpenChange:y,children:b})})}const B=$.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","hover:bg-accent","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"}}),E=t.forwardRef(({className:o,variant:e,dataHook:a,trackingEl:r,trackingLabel:i,children:c,...s},b)=>{const{open:d,disabled:x,value:u}=k(),C=t.useId(),f=!u;return n.jsx(I.PopoverTrigger,{asChild:!0,children:n.jsxs("button",{ref:b,"aria-controls":d?C:void 0,"aria-expanded":d,"aria-haspopup":"listbox",className:g.cn(B({variant:e}),o),"data-hook":a,"data-placeholder":f,"data-slot":"combobox-trigger","data-state":d?"open":"closed","data-tracking-el":r||"combobox-trigger","data-tracking-label":i,disabled:x||s.disabled,role:"combobox",type:"button",...s,children:[c,n.jsx(O.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});E.displayName="ComboboxTrigger";function J({placeholder:o,className:e}){const{value:a,itemLabels:r}=k(),i=a?r.get(a)||a:o;return n.jsx("span",{className:g.cn("text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",e),"data-slot":"combobox-value",children:i})}function K({dataHook:o,className:e,children:a,align:r="start",hideList:i=!1}){const{shouldFilter:c,itemToStringValue:s}=k(),b=t.useMemo(()=>{if(s)return(d,x,u)=>z.defaultFilter(s(d),x,u)},[s]);return n.jsx(I.PopoverContent,{align:r,"aria-label":"Options",className:g.cn("w-[var(--radix-popover-trigger-width)] p-0",e),"data-slot":"combobox-popover",side:"bottom",children:n.jsx(p.Command,{className:g.cn("border-0 shadow-none",i&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:o||"combobox-command",filter:b,shouldFilter:c,children:a})})}const P=t.forwardRef((o,e)=>n.jsx(p.CommandInput,{ref:e,"data-slot":"combobox-input",...o}));P.displayName="ComboboxInput";const M=t.forwardRef((o,e)=>n.jsx(p.CommandList,{ref:e,"data-slot":"combobox-list",...o}));M.displayName="ComboboxList";const _=t.forwardRef((o,e)=>n.jsx(p.CommandEmpty,{ref:e,"data-slot":"combobox-empty",...o}));_.displayName="ComboboxEmpty";const G=t.forwardRef((o,e)=>n.jsx(p.CommandGroup,{ref:e,"data-slot":"combobox-group",...o}));G.displayName="ComboboxGroup";function Q(o,e,a){if(!e||!e.trim())return o;const r=new RegExp(`(${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),i=o.split(r);return n.jsx("span",{children:i.map((c,s)=>s%2===1?n.jsx("span",{className:a,children:c},s):n.jsx(t.Fragment,{children:c},s))})}const D=t.forwardRef(({value:o,label:e,dataHook:a,children:r,className:i,highlight:c,highlightClassName:s,keywords:b,...d},x)=>{const{value:u,onValueChange:C,setOpen:f,registerItem:v}=k(),h=u===o,l=t.useMemo(()=>e||(typeof r=="string"?r:typeof r=="number"?String(r):o),[e,r,o]),w=t.useRef(v);t.useEffect(()=>{w.current=v},[v]),t.useEffect(()=>{w.current(o,l)},[o,l]);const j=()=>{C(o===u?"":o),f(!1)},y=()=>c&&typeof r=="string"?Q(r,c,s||"text-sm leading-normal font-semibold"):r;return n.jsxs(p.CommandItem,{ref:x,className:g.cn("justify-between",i),"data-slot":"combobox-item",dataHook:a,keywords:b?[l,...b]:[l],value:o,onSelect:j,...d,children:[y(),h&&n.jsx(O.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});D.displayName="ComboboxItem";const F=t.forwardRef((o,e)=>n.jsx(p.CommandSeparator,{ref:e,"data-slot":"combobox-separator",...o}));F.displayName="ComboboxSeparator";function W({className:o,children:e}){return n.jsx("div",{className:g.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",o),"data-slot":"combobox-loading",children:e||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=_;exports.ComboboxGroup=G;exports.ComboboxInput=P;exports.ComboboxItem=D;exports.ComboboxList=M;exports.ComboboxLoading=W;exports.ComboboxSeparator=F;exports.ComboboxTrigger=E;exports.ComboboxValue=J;
@@ -1,5 +1,5 @@
1
1
  import { VariantProps } from 'class-variance-authority';
2
- import { CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '../command';
2
+ import { CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '@brightlocal/ui-components/command';
3
3
  import * as React from "react";
4
4
  export interface ComboboxProps {
5
5
  /** Controlled selected value */
@@ -14,10 +14,12 @@ export interface ComboboxProps {
14
14
  shouldFilter?: boolean;
15
15
  /** Disabled state */
16
16
  disabled?: boolean;
17
+ /** Maps item value to a searchable string. When provided, filtering uses this string instead of the raw value. */
18
+ itemToStringValue?: (value: string) => string;
17
19
  /** Children */
18
20
  children: React.ReactNode;
19
21
  }
20
- declare function Combobox({ value: controlledValue, onValueChange: controlledOnValueChange, open: controlledOpen, onOpenChange: controlledOnOpenChange, shouldFilter, disabled, children, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
22
+ declare function Combobox({ value: controlledValue, onValueChange: controlledOnValueChange, open: controlledOpen, onOpenChange: controlledOnOpenChange, shouldFilter, disabled, itemToStringValue, children, }: ComboboxProps): import("react/jsx-runtime").JSX.Element;
21
23
  declare const comboboxTriggerVariants: (props?: ({
22
24
  variant?: "default" | null | undefined;
23
25
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -65,15 +67,15 @@ export interface ComboboxInputProps extends React.ComponentProps<typeof CommandI
65
67
  }
66
68
  declare const ComboboxInput: React.ForwardRefExoticComponent<Omit<ComboboxInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
67
69
  export type ComboboxListProps = React.ComponentProps<typeof CommandList>;
68
- declare const ComboboxList: React.ForwardRefExoticComponent<Omit<Omit<import('../command').CommandListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
70
+ declare const ComboboxList: React.ForwardRefExoticComponent<Omit<Omit<import('@brightlocal/ui-components/command').CommandListProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
69
71
  export type ComboboxEmptyProps = React.ComponentProps<typeof CommandEmpty>;
70
- declare const ComboboxEmpty: React.ForwardRefExoticComponent<Omit<Omit<import('../command').CommandEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
72
+ declare const ComboboxEmpty: React.ForwardRefExoticComponent<Omit<Omit<import('@brightlocal/ui-components/command').CommandEmptyProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
71
73
  export type ComboboxGroupProps = React.ComponentProps<typeof CommandGroup>;
72
- declare const ComboboxGroup: React.ForwardRefExoticComponent<Omit<Omit<import('../command').CommandGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
74
+ declare const ComboboxGroup: React.ForwardRefExoticComponent<Omit<Omit<import('@brightlocal/ui-components/command').CommandGroupProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
73
75
  export interface ComboboxItemProps extends Omit<React.ComponentProps<typeof CommandItem>, "onSelect"> {
74
76
  /** The value of the item (required) */
75
77
  value: string;
76
- /** Display label - if not provided, uses children text content */
78
+ /** Display label - if not provided, inferred from children text content. Required when children are React elements (not plain text) to enable label-based search and trigger display. */
77
79
  label?: string;
78
80
  /** Data hook for automated testing */
79
81
  dataHook?: string;
@@ -81,10 +83,12 @@ export interface ComboboxItemProps extends Omit<React.ComponentProps<typeof Comm
81
83
  highlight?: string;
82
84
  /** Class name for highlighted text */
83
85
  highlightClassName?: string;
86
+ /** Additional keywords to match against when filtering. The item label is always included automatically. */
87
+ keywords?: string[];
84
88
  }
85
89
  declare const ComboboxItem: React.ForwardRefExoticComponent<Omit<ComboboxItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
86
90
  export type ComboboxSeparatorProps = React.ComponentProps<typeof CommandSeparator>;
87
- declare const ComboboxSeparator: React.ForwardRefExoticComponent<Omit<Omit<import('../command').CommandSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
91
+ declare const ComboboxSeparator: React.ForwardRefExoticComponent<Omit<Omit<import('@brightlocal/ui-components/command').CommandSeparatorProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
88
92
  export interface ComboboxLoadingProps {
89
93
  /** Custom className */
90
94
  className?: string;
@@ -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;AAQlE,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AAgC5C,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,eAAe;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,iBAAS,QAAQ,CAAC,EAChB,KAAK,EAA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AwC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAoBrE;AAMD,OAAO,EACL,QAAQ,EACR,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,eAAe,GAChB,CAAC"}
package/dist/combobox.js CHANGED
@@ -1,69 +1,73 @@
1
- import { jsx as a, jsxs as I, Fragment as j } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as R, Fragment as M } from "react/jsx-runtime";
2
2
  import * as t from "react";
3
- import { Check as P, ChevronsUpDown as M } from "@brightlocal/icons";
3
+ import { Check as P, ChevronsUpDown as F } from "@brightlocal/icons";
4
4
  import { cva as G } from "class-variance-authority";
5
- import { cn as f } from "@brightlocal/ui-components/lib/utils";
5
+ import { defaultFilter as O } from "cmdk";
6
+ import { cn as x } from "@brightlocal/ui-components/lib/utils";
6
7
  import { Popover as U, PopoverContent as _, PopoverTrigger as $ } from "@brightlocal/ui-components/popover";
7
- import { Command as F, CommandEmpty as O, CommandGroup as z, CommandInput as D, CommandItem as H, CommandList as V, CommandSeparator as q } from "@brightlocal/ui-components/command";
8
- const E = t.createContext(null);
9
- function y() {
10
- const o = t.useContext(E);
8
+ import { Command as z, CommandEmpty as D, CommandGroup as H, CommandInput as V, CommandItem as q, CommandList as A, CommandSeparator as B } from "@brightlocal/ui-components/command";
9
+ const T = t.createContext(null);
10
+ function N() {
11
+ const o = t.useContext(T);
11
12
  if (!o)
12
13
  throw new Error("Combobox components must be used within a <Combobox>");
13
14
  return o;
14
15
  }
15
- function so({
16
+ function lo({
16
17
  value: o,
17
18
  onValueChange: e,
18
- open: n,
19
+ open: s,
19
20
  onOpenChange: r,
20
- shouldFilter: s = !0,
21
- disabled: d = !1,
22
- children: i
21
+ shouldFilter: d = !0,
22
+ disabled: i = !1,
23
+ itemToStringValue: n,
24
+ children: l
23
25
  }) {
24
- const [x, c] = t.useState(""), [l, g] = t.useState(!1), [u, b] = t.useState(
26
+ const [m, p] = t.useState(""), [c, g] = t.useState(!1), [f, C] = t.useState(
25
27
  () => /* @__PURE__ */ new Map()
26
- ), C = o !== void 0, p = n !== void 0, v = C ? o : x, h = p ? n : l, w = t.useCallback(
27
- (m) => {
28
- p || g(m), r?.(m);
28
+ ), v = o !== void 0, u = s !== void 0, h = v ? o : m, w = u ? s : c, y = t.useCallback(
29
+ (b) => {
30
+ u || g(b), r?.(b);
29
31
  },
30
- [p, r]
31
- ), N = t.useCallback(
32
- (m) => {
33
- C || c(m), e?.(m);
32
+ [u, r]
33
+ ), k = t.useCallback(
34
+ (b) => {
35
+ v || p(b), e?.(b);
34
36
  },
35
- [C, e]
36
- ), R = t.useCallback((m, S) => {
37
- b((k) => {
38
- if (k.get(m) === S) return k;
39
- const L = new Map(k);
40
- return L.set(m, S), L;
37
+ [v, e]
38
+ ), S = t.useCallback((b, L) => {
39
+ C((I) => {
40
+ if (I.get(b) === L) return I;
41
+ const E = new Map(I);
42
+ return E.set(b, L), E;
41
43
  });
42
- }, []), T = t.useMemo(
44
+ }, []), j = t.useMemo(
43
45
  () => ({
44
- open: h,
45
- setOpen: w,
46
- value: v,
47
- onValueChange: N,
48
- shouldFilter: s,
49
- disabled: d,
50
- itemLabels: u,
51
- registerItem: R
46
+ open: w,
47
+ setOpen: y,
48
+ value: h,
49
+ onValueChange: k,
50
+ shouldFilter: d,
51
+ disabled: i,
52
+ itemLabels: f,
53
+ registerItem: S,
54
+ itemToStringValue: n
52
55
  }),
53
56
  [
54
- h,
55
57
  w,
56
- v,
57
- N,
58
- s,
58
+ y,
59
+ h,
60
+ k,
59
61
  d,
60
- u,
61
- R
62
+ i,
63
+ f,
64
+ S,
65
+ n
62
66
  ]
63
67
  );
64
- return /* @__PURE__ */ a(E.Provider, { value: T, children: /* @__PURE__ */ a(U, { open: h, onOpenChange: w, children: i }) });
68
+ return /* @__PURE__ */ a(T.Provider, { value: j, children: /* @__PURE__ */ a(U, { open: w, onOpenChange: y, children: l }) });
65
69
  }
66
- const A = G(
70
+ const J = G(
67
71
  [
68
72
  // Base layout
69
73
  "relative flex w-full items-center justify-between gap-2",
@@ -101,39 +105,39 @@ const A = G(
101
105
  variant: "default"
102
106
  }
103
107
  }
104
- ), B = t.forwardRef(
108
+ ), K = t.forwardRef(
105
109
  ({
106
110
  className: o,
107
111
  variant: e,
108
- dataHook: n,
112
+ dataHook: s,
109
113
  trackingEl: r,
110
- trackingLabel: s,
111
- children: d,
112
- ...i
113
- }, x) => {
114
- const { open: c, disabled: l, value: g } = y(), u = t.useId(), b = !g;
115
- return /* @__PURE__ */ a($, { asChild: !0, children: /* @__PURE__ */ I(
114
+ trackingLabel: d,
115
+ children: i,
116
+ ...n
117
+ }, l) => {
118
+ const { open: m, disabled: p, value: c } = N(), g = t.useId(), f = !c;
119
+ return /* @__PURE__ */ a($, { asChild: !0, children: /* @__PURE__ */ R(
116
120
  "button",
117
121
  {
118
- ref: x,
119
- "aria-controls": c ? u : void 0,
120
- "aria-expanded": c,
122
+ ref: l,
123
+ "aria-controls": m ? g : void 0,
124
+ "aria-expanded": m,
121
125
  "aria-haspopup": "listbox",
122
- className: f(A({ variant: e }), o),
123
- "data-hook": n,
124
- "data-placeholder": b,
126
+ className: x(J({ variant: e }), o),
127
+ "data-hook": s,
128
+ "data-placeholder": f,
125
129
  "data-slot": "combobox-trigger",
126
- "data-state": c ? "open" : "closed",
130
+ "data-state": m ? "open" : "closed",
127
131
  "data-tracking-el": r || "combobox-trigger",
128
- "data-tracking-label": s,
129
- disabled: l || i.disabled,
132
+ "data-tracking-label": d,
133
+ disabled: p || n.disabled,
130
134
  role: "combobox",
131
135
  type: "button",
132
- ...i,
136
+ ...n,
133
137
  children: [
134
- d,
138
+ i,
135
139
  /* @__PURE__ */ a(
136
- M,
140
+ F,
137
141
  {
138
142
  "aria-hidden": "true",
139
143
  className: "text-muted-foreground ml-auto shrink-0"
@@ -144,108 +148,115 @@ const A = G(
144
148
  ) });
145
149
  }
146
150
  );
147
- B.displayName = "ComboboxTrigger";
148
- function io({ placeholder: o, className: e }) {
149
- const { value: n, itemLabels: r } = y(), s = n ? r.get(n) || n : o;
151
+ K.displayName = "ComboboxTrigger";
152
+ function co({ placeholder: o, className: e }) {
153
+ const { value: s, itemLabels: r } = N(), d = s ? r.get(s) || s : o;
150
154
  return /* @__PURE__ */ a(
151
155
  "span",
152
156
  {
153
- className: f(
157
+ className: x(
154
158
  "text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",
155
159
  e
156
160
  ),
157
161
  "data-slot": "combobox-value",
158
- children: s
162
+ children: d
159
163
  }
160
164
  );
161
165
  }
162
- function mo({
166
+ function uo({
163
167
  dataHook: o,
164
168
  className: e,
165
- children: n,
169
+ children: s,
166
170
  align: r = "start",
167
- hideList: s = !1
171
+ hideList: d = !1
168
172
  }) {
169
- const { shouldFilter: d } = y();
173
+ const { shouldFilter: i, itemToStringValue: n } = N(), l = t.useMemo(() => {
174
+ if (n)
175
+ return (m, p, c) => O(n(m), p, c);
176
+ }, [n]);
170
177
  return /* @__PURE__ */ a(
171
178
  _,
172
179
  {
173
180
  align: r,
174
- className: f("w-[var(--radix-popover-trigger-width)] p-0", e),
181
+ "aria-label": "Options",
182
+ className: x("w-[var(--radix-popover-trigger-width)] p-0", e),
175
183
  "data-slot": "combobox-popover",
176
184
  side: "bottom",
177
185
  children: /* @__PURE__ */ a(
178
- F,
186
+ z,
179
187
  {
180
- className: f(
188
+ className: x(
181
189
  "border-0 shadow-none",
182
- s && "[&_[data-slot='command-input-wrapper']]:border-b-0"
190
+ d && "[&_[data-slot='command-input-wrapper']]:border-b-0"
183
191
  ),
184
192
  "data-slot": "combobox-command",
185
193
  dataHook: o || "combobox-command",
186
- shouldFilter: d,
187
- children: n
194
+ filter: l,
195
+ shouldFilter: i,
196
+ children: s
188
197
  }
189
198
  )
190
199
  }
191
200
  );
192
201
  }
193
- const J = t.forwardRef((o, e) => /* @__PURE__ */ a(D, { ref: e, "data-slot": "combobox-input", ...o }));
194
- J.displayName = "ComboboxInput";
195
- const K = t.forwardRef((o, e) => /* @__PURE__ */ a(V, { ref: e, "data-slot": "combobox-list", ...o }));
196
- K.displayName = "ComboboxList";
197
- const Q = t.forwardRef((o, e) => /* @__PURE__ */ a(O, { ref: e, "data-slot": "combobox-empty", ...o }));
198
- Q.displayName = "ComboboxEmpty";
199
- const W = t.forwardRef((o, e) => /* @__PURE__ */ a(z, { ref: e, "data-slot": "combobox-group", ...o }));
200
- W.displayName = "ComboboxGroup";
201
- function X(o, e, n) {
202
+ const Q = t.forwardRef((o, e) => /* @__PURE__ */ a(V, { ref: e, "data-slot": "combobox-input", ...o }));
203
+ Q.displayName = "ComboboxInput";
204
+ const W = t.forwardRef((o, e) => /* @__PURE__ */ a(A, { ref: e, "data-slot": "combobox-list", ...o }));
205
+ W.displayName = "ComboboxList";
206
+ const X = t.forwardRef((o, e) => /* @__PURE__ */ a(D, { ref: e, "data-slot": "combobox-empty", ...o }));
207
+ X.displayName = "ComboboxEmpty";
208
+ const Y = t.forwardRef((o, e) => /* @__PURE__ */ a(H, { ref: e, "data-slot": "combobox-group", ...o }));
209
+ Y.displayName = "ComboboxGroup";
210
+ function Z(o, e, s) {
202
211
  if (!e || !e.trim())
203
212
  return o;
204
213
  const r = new RegExp(
205
214
  `(${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
206
215
  "gi"
207
- ), s = o.split(r);
208
- return /* @__PURE__ */ a("span", { children: s.map(
209
- (d, i) => i % 2 === 1 ? /* @__PURE__ */ a("span", { className: n, children: d }, i) : /* @__PURE__ */ a(t.Fragment, { children: d }, i)
216
+ ), d = o.split(r);
217
+ return /* @__PURE__ */ a("span", { children: d.map(
218
+ (i, n) => n % 2 === 1 ? /* @__PURE__ */ a("span", { className: s, children: i }, n) : /* @__PURE__ */ a(t.Fragment, { children: i }, n)
210
219
  ) });
211
220
  }
212
- const Y = t.forwardRef(
221
+ const oo = t.forwardRef(
213
222
  ({
214
223
  value: o,
215
224
  label: e,
216
- dataHook: n,
225
+ dataHook: s,
217
226
  children: r,
218
- className: s,
219
- highlight: d,
220
- highlightClassName: i,
221
- ...x
222
- }, c) => {
223
- const { value: l, onValueChange: g, setOpen: u, registerItem: b } = y(), C = l === o, p = t.useMemo(() => e || (typeof r == "string" ? r : typeof r == "number" ? String(r) : o), [e, r, o]), v = t.useRef(b);
227
+ className: d,
228
+ highlight: i,
229
+ highlightClassName: n,
230
+ keywords: l,
231
+ ...m
232
+ }, p) => {
233
+ const { value: c, onValueChange: g, setOpen: f, registerItem: C } = N(), v = c === o, u = t.useMemo(() => e || (typeof r == "string" ? r : typeof r == "number" ? String(r) : o), [e, r, o]), h = t.useRef(C);
224
234
  t.useEffect(() => {
225
- v.current = b;
226
- }, [b]), t.useEffect(() => {
227
- v.current(o, p);
228
- }, [o, p]);
229
- const h = () => {
230
- g(o === l ? "" : o), u(!1);
231
- }, w = () => d && typeof r == "string" ? X(
235
+ h.current = C;
236
+ }, [C]), t.useEffect(() => {
237
+ h.current(o, u);
238
+ }, [o, u]);
239
+ const w = () => {
240
+ g(o === c ? "" : o), f(!1);
241
+ }, y = () => i && typeof r == "string" ? Z(
232
242
  r,
233
- d,
234
- i || "text-sm leading-normal font-semibold"
243
+ i,
244
+ n || "text-sm leading-normal font-semibold"
235
245
  ) : r;
236
- return /* @__PURE__ */ I(
237
- H,
246
+ return /* @__PURE__ */ R(
247
+ q,
238
248
  {
239
- ref: c,
240
- className: f("justify-between", s),
249
+ ref: p,
250
+ className: x("justify-between", d),
241
251
  "data-slot": "combobox-item",
242
- dataHook: n,
252
+ dataHook: s,
253
+ keywords: l ? [u, ...l] : [u],
243
254
  value: o,
244
- onSelect: h,
245
- ...x,
255
+ onSelect: w,
256
+ ...m,
246
257
  children: [
247
- w(),
248
- C && /* @__PURE__ */ a(
258
+ y(),
259
+ v && /* @__PURE__ */ a(
249
260
  P,
250
261
  {
251
262
  "aria-hidden": "true",
@@ -257,19 +268,19 @@ const Y = t.forwardRef(
257
268
  );
258
269
  }
259
270
  );
260
- Y.displayName = "ComboboxItem";
261
- const Z = t.forwardRef((o, e) => /* @__PURE__ */ a(q, { ref: e, "data-slot": "combobox-separator", ...o }));
262
- Z.displayName = "ComboboxSeparator";
263
- function co({ className: o, children: e }) {
271
+ oo.displayName = "ComboboxItem";
272
+ const eo = t.forwardRef((o, e) => /* @__PURE__ */ a(B, { ref: e, "data-slot": "combobox-separator", ...o }));
273
+ eo.displayName = "ComboboxSeparator";
274
+ function bo({ className: o, children: e }) {
264
275
  return /* @__PURE__ */ a(
265
276
  "div",
266
277
  {
267
- className: f(
278
+ className: x(
268
279
  "text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
269
280
  o
270
281
  ),
271
282
  "data-slot": "combobox-loading",
272
- children: e || /* @__PURE__ */ I(j, { children: [
283
+ children: e || /* @__PURE__ */ R(M, { children: [
273
284
  /* @__PURE__ */ a(
274
285
  "div",
275
286
  {
@@ -283,15 +294,15 @@ function co({ className: o, children: e }) {
283
294
  );
284
295
  }
285
296
  export {
286
- so as Combobox,
287
- mo as ComboboxContent,
288
- Q as ComboboxEmpty,
289
- W as ComboboxGroup,
290
- J as ComboboxInput,
291
- Y as ComboboxItem,
292
- K as ComboboxList,
293
- co as ComboboxLoading,
294
- Z as ComboboxSeparator,
295
- B as ComboboxTrigger,
296
- io as ComboboxValue
297
+ lo as Combobox,
298
+ uo as ComboboxContent,
299
+ X as ComboboxEmpty,
300
+ Y as ComboboxGroup,
301
+ Q as ComboboxInput,
302
+ oo as ComboboxItem,
303
+ W as ComboboxList,
304
+ bo as ComboboxLoading,
305
+ eo as ComboboxSeparator,
306
+ K as ComboboxTrigger,
307
+ co as ComboboxValue
297
308
  };
@@ -1,6 +1,6 @@
1
1
  import { DateRange } from 'react-day-picker';
2
- import { CalendarProps } from '../calendar';
3
- import { PopoverContent } from '../popover';
2
+ import { CalendarProps } from '@brightlocal/ui-components/calendar';
3
+ import { PopoverContent } from '@brightlocal/ui-components/popover';
4
4
  import * as React from "react";
5
5
  /**
6
6
  * Preset configuration for DatePicker
package/dist/field.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),g=require("class-variance-authority"),p=require("@brightlocal/icons"),o=require("@brightlocal/ui-components/lib/utils"),m=require("./description.cjs"),h=require("@brightlocal/ui-components/label");function s({className:t,...e}){return l.jsx("fieldset",{className:o.cn("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",t),"data-slot":"field-set",...e})}s.displayName="FieldSet";const x=["legend","label"];function b({className:t,variant:e="legend",...a}){return l.jsx("legend",{className:o.cn("mb-3 font-medium","data-[variant=legend]:text-base","data-[variant=label]:text-sm",t),"data-slot":"field-legend","data-variant":e,...a})}function F({className:t,...e}){return l.jsx("div",{className:o.cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",t),"data-slot":"field-group",...e})}const v=g.cva(["group/field flex w-full gap-2","has-[>[role=checkbox]]:[&_[data-slot=field-label]]:leading-normal"],{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["grid grid-cols-[auto_1fr] items-center gap-x-2","[&>[data-slot=field-description]]:col-start-2 [&>[data-slot=field-error]]:col-start-2","has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:grid @md/field-group:grid-cols-[auto_1fr] @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-description]]:col-start-2 @md/field-group:[&>[data-slot=field-error]]:col-start-2","@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]}},defaultVariants:{orientation:"vertical"}});function j({className:t,orientation:e="vertical",...a}){return l.jsx("div",{className:o.cn(v({orientation:e}),t),"data-orientation":e,"data-slot":"field",role:"group",...a})}function k({className:t,...e}){return l.jsx("div",{className:o.cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug",t),"data-slot":"field-content",...e})}function N({className:t,htmlFor:e,dataHook:a,...i}){return l.jsx(h.Label,{className:o.cn("group/field-label peer/field-label w-fit","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",t),"data-hook":a,"data-slot":"field-label",htmlFor:e,...i})}function y({className:t,dataHook:e,...a}){return l.jsx(m.Description,{className:o.cn("mt-2","group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",t),"data-hook":e,"data-slot":"field-description",...a})}function w({icon:t=p.AlertCircle,className:e,...a}){return l.jsx(t,{"aria-hidden":"true",className:o.cn("inline-block shrink-0 align-text-bottom",e),...a})}function L({className:t,dataHook:e,children:a,errors:i,...n}){const r=i?.filter(d=>!!d?.message);if(!a&&(!r||r.length===0))return null;const c=o.cn("text-destructive-foreground text-sm font-normal leading-5","mt-2","group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",t),f=r&&r.length>1;return l.jsx("div",{className:c,"data-hook":e,"data-slot":"field-error",role:"alert",...n,children:f?l.jsx("ul",{className:"list-disc space-y-1 pl-4",children:r.map((d,u)=>l.jsx("li",{children:d.message},u))}):l.jsx("p",{className:"m-0",children:a||r?.[0]?.message})})}exports.Field=j;exports.FieldContent=k;exports.FieldDescription=y;exports.FieldError=L;exports.FieldErrorIcon=w;exports.FieldGroup=F;exports.FieldLabel=N;exports.FieldLegend=b;exports.FieldSet=s;exports.fieldLegendVariants=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),g=require("class-variance-authority"),p=require("@brightlocal/icons"),r=require("@brightlocal/ui-components/lib/utils"),h=require("./description.cjs"),m=require("@brightlocal/ui-components/label");function n({className:a,...e}){return l.jsx("fieldset",{className:r.cn("flex flex-col gap-6","has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",a),"data-slot":"field-set",...e})}n.displayName="FieldSet";const b=["legend","label"];function x({className:a,variant:e="legend",...t}){return l.jsx("legend",{className:r.cn("mb-3 font-medium","data-[variant=legend]:text-base","data-[variant=label]:text-sm",a),"data-slot":"field-legend","data-variant":e,...t})}function v({className:a,...e}){return l.jsx("div",{className:r.cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",a),"data-slot":"field-group",...e})}const F=g.cva(["group/field flex w-full gap-2","[[data-slot=radio-group]_&]:relative [[data-slot=radio-group]_&]:cursor-pointer [[data-slot=radio-group]_&]:gap-3 [[data-slot=radio-group]_&]:has-[[data-disabled]]:cursor-not-allowed","has-[>[role=checkbox]]:[&_[data-slot=field-label]]:leading-normal"],{variants:{orientation:{vertical:["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],horizontal:["grid grid-cols-[auto_1fr] items-center gap-x-2","[&>[data-slot=field-description]]:col-start-2 [&>[data-slot=field-error]]:col-start-2","has-[>[data-slot=field-content]]:items-start"],responsive:["flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:grid @md/field-group:grid-cols-[auto_1fr] @md/field-group:items-center @md/field-group:[&>*]:w-auto","@md/field-group:[&>[data-slot=field-description]]:col-start-2 @md/field-group:[&>[data-slot=field-error]]:col-start-2","@md/field-group:has-[>[data-slot=field-content]]:items-start"]},variant:{default:[],box:["relative cursor-pointer","rounded-lg border border-border bg-background p-3","transition-colors","[&_[data-slot=field-label]]:after:absolute [&_[data-slot=field-label]]:after:inset-0 [&_[data-slot=field-label]]:after:cursor-pointer","has-[:focus-visible]:shadow-default has-[:focus-visible]:border-ring","has-[[data-state=checked]:not([role=switch])]:border-primary has-[[data-state=checked]:not([role=switch])]:bg-primary/10","dark:has-[[data-state=checked]:not([role=switch])]:bg-alpha-10","[[aria-invalid=true]_&]:border-red-600/40 dark:[[aria-invalid=true]_&]:border-red-400/60","[[aria-invalid=true]_&]:has-[:focus-visible]:border-destructive [[aria-invalid=true]_&]:has-[:focus-visible]:shadow-destructive"]}},defaultVariants:{orientation:"vertical",variant:"default"}});function k({className:a,orientation:e="vertical",variant:t="default",align:i="start",...d}){return l.jsx("div",{className:r.cn(F({orientation:e,variant:t}),i==="end"&&e==="horizontal"&&"grid-cols-[1fr_auto]",a),"data-orientation":e,"data-slot":"field","data-variant":t,role:"group",...d})}function _({className:a,...e}){return l.jsx("div",{className:r.cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug","[[data-variant=boxIconVertical]_&]:items-center [[data-variant=boxIconVertical]_&]:text-center",a),"data-slot":"field-content",...e})}function w({className:a,htmlFor:e,dataHook:t,...i}){return l.jsx(m.Label,{className:r.cn("group/field-label peer/field-label w-fit","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4","has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",a),"data-hook":t,"data-slot":"field-label",htmlFor:e,...i})}function j({className:a,dataHook:e,...t}){return l.jsx(h.Description,{className:r.cn("mt-2","group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",a),"data-hook":e,"data-slot":"field-description",...t})}function y({icon:a=p.AlertCircle,className:e,...t}){return l.jsx(a,{"aria-hidden":"true",className:r.cn("inline-block shrink-0 align-text-bottom",e),...t})}function N({className:a,dataHook:e,children:t,errors:i,...d}){const o=i?.filter(s=>!!s?.message);if(!t&&(!o||o.length===0))return null;const c=r.cn("text-destructive-foreground text-sm font-normal leading-5","mt-2","group-has-[[data-orientation=horizontal]]/field:text-balance","last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",a),u=o&&o.length>1;return l.jsx("div",{className:c,"data-hook":e,"data-slot":"field-error",role:"alert",...d,children:u?l.jsx("ul",{className:"list-disc space-y-1 pl-4",children:o.map((s,f)=>l.jsx("li",{children:s.message},f))}):l.jsx("p",{className:"m-0",children:t||o?.[0]?.message})})}exports.Field=k;exports.FieldContent=_;exports.FieldDescription=j;exports.FieldError=N;exports.FieldErrorIcon=y;exports.FieldGroup=v;exports.FieldLabel=w;exports.FieldLegend=x;exports.FieldSet=n;exports.fieldLegendVariants=b;