@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.
- package/dist/alert.d.ts +2 -2
- package/dist/blocks/sidebar.d.ts +6 -6
- package/dist/button.d.ts +2 -2
- package/dist/carousel.d.ts +1 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts +11 -7
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +144 -133
- package/dist/date-picker.d.ts +2 -2
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +11 -4
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +113 -80
- package/dist/index.cjs +1 -1
- package/dist/index.js +253 -255
- package/dist/input-group.d.ts +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +3 -20
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +91 -132
- package/dist/input-password.d.ts +1 -1
- package/dist/label.d.ts +2 -3
- package/dist/label.d.ts.map +1 -1
- package/dist/radio-group.cjs +1 -1
- package/dist/radio-group.d.ts +3 -19
- package/dist/radio-group.d.ts.map +1 -1
- package/dist/radio-group.js +92 -120
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -19
- package/dist/switch.cjs +1 -1
- package/dist/switch.d.ts +1 -21
- package/dist/switch.d.ts.map +1 -1
- package/dist/switch.js +31 -100
- package/package.json +2 -2
- package/src/components/combobox.tsx +22 -2
- package/src/components/field.tsx +47 -7
- package/src/components/input-otp.tsx +9 -89
- package/src/components/label.tsx +2 -2
- package/src/components/radio-group.tsx +65 -129
- package/src/components/select.tsx +3 -2
- package/src/components/switch.tsx +29 -140
- package/dist/link.figma.d.ts +0 -2
- package/dist/link.figma.d.ts.map +0 -1
- package/dist/switch.figma.d.ts +0 -2
- package/dist/switch.figma.d.ts.map +0 -1
- package/dist/toggle.figma.d.ts +0 -2
- package/dist/toggle.figma.d.ts.map +0 -1
- package/src/components/link.figma.tsx +0 -71
- package/src/components/switch.figma.tsx +0 -111
- 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?: "
|
|
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?: "
|
|
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>>;
|
package/dist/blocks/sidebar.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { Button } from '../
|
|
3
|
-
import { Input } from '../
|
|
4
|
-
import { Separator } from '../
|
|
5
|
-
import { TooltipContent } from '../
|
|
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?: "
|
|
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?: "
|
|
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?: "
|
|
18
|
+
variant?: "default" | "ghost" | "destructive" | "warning" | "outline" | "secondary" | null | undefined;
|
|
19
19
|
size?: "default" | "sm" | "lg" | null | undefined;
|
|
20
|
-
state?: "
|
|
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
|
/**
|
package/dist/carousel.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as useEmblaCarousel, UseEmblaCarouselType } from 'embla-carousel-react';
|
|
2
|
-
import { ButtonProps } from '
|
|
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"),
|
|
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;
|
package/dist/combobox.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
|
-
import { CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator } from '
|
|
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('
|
|
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('
|
|
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('
|
|
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,
|
|
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('
|
|
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;
|
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;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"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"}
|
package/dist/combobox.js
CHANGED
|
@@ -1,69 +1,73 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
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
|
|
3
|
+
import { Check as P, ChevronsUpDown as F } from "@brightlocal/icons";
|
|
4
4
|
import { cva as G } from "class-variance-authority";
|
|
5
|
-
import {
|
|
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
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const o = t.useContext(
|
|
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
|
|
16
|
+
function lo({
|
|
16
17
|
value: o,
|
|
17
18
|
onValueChange: e,
|
|
18
|
-
open:
|
|
19
|
+
open: s,
|
|
19
20
|
onOpenChange: r,
|
|
20
|
-
shouldFilter:
|
|
21
|
-
disabled:
|
|
22
|
-
|
|
21
|
+
shouldFilter: d = !0,
|
|
22
|
+
disabled: i = !1,
|
|
23
|
+
itemToStringValue: n,
|
|
24
|
+
children: l
|
|
23
25
|
}) {
|
|
24
|
-
const [
|
|
26
|
+
const [m, p] = t.useState(""), [c, g] = t.useState(!1), [f, C] = t.useState(
|
|
25
27
|
() => /* @__PURE__ */ new Map()
|
|
26
|
-
),
|
|
27
|
-
(
|
|
28
|
-
|
|
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
|
-
[
|
|
31
|
-
),
|
|
32
|
-
(
|
|
33
|
-
|
|
32
|
+
[u, r]
|
|
33
|
+
), k = t.useCallback(
|
|
34
|
+
(b) => {
|
|
35
|
+
v || p(b), e?.(b);
|
|
34
36
|
},
|
|
35
|
-
[
|
|
36
|
-
),
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
return
|
|
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
|
-
}, []),
|
|
44
|
+
}, []), j = t.useMemo(
|
|
43
45
|
() => ({
|
|
44
|
-
open:
|
|
45
|
-
setOpen:
|
|
46
|
-
value:
|
|
47
|
-
onValueChange:
|
|
48
|
-
shouldFilter:
|
|
49
|
-
disabled:
|
|
50
|
-
itemLabels:
|
|
51
|
-
registerItem:
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
58
|
+
y,
|
|
59
|
+
h,
|
|
60
|
+
k,
|
|
59
61
|
d,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
i,
|
|
63
|
+
f,
|
|
64
|
+
S,
|
|
65
|
+
n
|
|
62
66
|
]
|
|
63
67
|
);
|
|
64
|
-
return /* @__PURE__ */ a(
|
|
68
|
+
return /* @__PURE__ */ a(T.Provider, { value: j, children: /* @__PURE__ */ a(U, { open: w, onOpenChange: y, children: l }) });
|
|
65
69
|
}
|
|
66
|
-
const
|
|
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
|
-
),
|
|
108
|
+
), K = t.forwardRef(
|
|
105
109
|
({
|
|
106
110
|
className: o,
|
|
107
111
|
variant: e,
|
|
108
|
-
dataHook:
|
|
112
|
+
dataHook: s,
|
|
109
113
|
trackingEl: r,
|
|
110
|
-
trackingLabel:
|
|
111
|
-
children:
|
|
112
|
-
...
|
|
113
|
-
},
|
|
114
|
-
const { open:
|
|
115
|
-
return /* @__PURE__ */ a($, { asChild: !0, children: /* @__PURE__ */
|
|
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:
|
|
119
|
-
"aria-controls":
|
|
120
|
-
"aria-expanded":
|
|
122
|
+
ref: l,
|
|
123
|
+
"aria-controls": m ? g : void 0,
|
|
124
|
+
"aria-expanded": m,
|
|
121
125
|
"aria-haspopup": "listbox",
|
|
122
|
-
className:
|
|
123
|
-
"data-hook":
|
|
124
|
-
"data-placeholder":
|
|
126
|
+
className: x(J({ variant: e }), o),
|
|
127
|
+
"data-hook": s,
|
|
128
|
+
"data-placeholder": f,
|
|
125
129
|
"data-slot": "combobox-trigger",
|
|
126
|
-
"data-state":
|
|
130
|
+
"data-state": m ? "open" : "closed",
|
|
127
131
|
"data-tracking-el": r || "combobox-trigger",
|
|
128
|
-
"data-tracking-label":
|
|
129
|
-
disabled:
|
|
132
|
+
"data-tracking-label": d,
|
|
133
|
+
disabled: p || n.disabled,
|
|
130
134
|
role: "combobox",
|
|
131
135
|
type: "button",
|
|
132
|
-
...
|
|
136
|
+
...n,
|
|
133
137
|
children: [
|
|
134
|
-
|
|
138
|
+
i,
|
|
135
139
|
/* @__PURE__ */ a(
|
|
136
|
-
|
|
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
|
-
|
|
148
|
-
function
|
|
149
|
-
const { value:
|
|
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:
|
|
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:
|
|
162
|
+
children: d
|
|
159
163
|
}
|
|
160
164
|
);
|
|
161
165
|
}
|
|
162
|
-
function
|
|
166
|
+
function uo({
|
|
163
167
|
dataHook: o,
|
|
164
168
|
className: e,
|
|
165
|
-
children:
|
|
169
|
+
children: s,
|
|
166
170
|
align: r = "start",
|
|
167
|
-
hideList:
|
|
171
|
+
hideList: d = !1
|
|
168
172
|
}) {
|
|
169
|
-
const { shouldFilter:
|
|
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
|
-
|
|
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
|
-
|
|
186
|
+
z,
|
|
179
187
|
{
|
|
180
|
-
className:
|
|
188
|
+
className: x(
|
|
181
189
|
"border-0 shadow-none",
|
|
182
|
-
|
|
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
|
-
|
|
187
|
-
|
|
194
|
+
filter: l,
|
|
195
|
+
shouldFilter: i,
|
|
196
|
+
children: s
|
|
188
197
|
}
|
|
189
198
|
)
|
|
190
199
|
}
|
|
191
200
|
);
|
|
192
201
|
}
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
function
|
|
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
|
-
),
|
|
208
|
-
return /* @__PURE__ */ a("span", { children:
|
|
209
|
-
(
|
|
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
|
|
221
|
+
const oo = t.forwardRef(
|
|
213
222
|
({
|
|
214
223
|
value: o,
|
|
215
224
|
label: e,
|
|
216
|
-
dataHook:
|
|
225
|
+
dataHook: s,
|
|
217
226
|
children: r,
|
|
218
|
-
className:
|
|
219
|
-
highlight:
|
|
220
|
-
highlightClassName:
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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
|
-
|
|
226
|
-
}, [
|
|
227
|
-
|
|
228
|
-
}, [o,
|
|
229
|
-
const
|
|
230
|
-
g(o ===
|
|
231
|
-
},
|
|
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
|
-
|
|
234
|
-
|
|
243
|
+
i,
|
|
244
|
+
n || "text-sm leading-normal font-semibold"
|
|
235
245
|
) : r;
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
|
|
246
|
+
return /* @__PURE__ */ R(
|
|
247
|
+
q,
|
|
238
248
|
{
|
|
239
|
-
ref:
|
|
240
|
-
className:
|
|
249
|
+
ref: p,
|
|
250
|
+
className: x("justify-between", d),
|
|
241
251
|
"data-slot": "combobox-item",
|
|
242
|
-
dataHook:
|
|
252
|
+
dataHook: s,
|
|
253
|
+
keywords: l ? [u, ...l] : [u],
|
|
243
254
|
value: o,
|
|
244
|
-
onSelect:
|
|
245
|
-
...
|
|
255
|
+
onSelect: w,
|
|
256
|
+
...m,
|
|
246
257
|
children: [
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
function
|
|
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:
|
|
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__ */
|
|
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
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
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
|
};
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DateRange } from 'react-day-picker';
|
|
2
|
-
import { CalendarProps } from '
|
|
3
|
-
import { PopoverContent } from '
|
|
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"),
|
|
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;
|