@brightlocal/ui-components 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +10 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +6 -2
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +6 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +89 -73
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +49 -25
- package/dist/centred-layout.d.ts.map +1 -1
- package/dist/centred-layout.js +57 -32
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/chip.cjs +1 -0
- package/dist/chip.d.ts +61 -0
- package/dist/chip.d.ts.map +1 -0
- package/dist/chip.js +165 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +5 -2
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +89 -52
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +228 -210
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/header.cjs +1 -0
- package/dist/header.d.ts +42 -0
- package/dist/header.d.ts.map +1 -0
- package/dist/header.js +22 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +426 -396
- package/dist/input-chip.cjs +1 -0
- package/dist/input-chip.d.ts +117 -0
- package/dist/input-chip.d.ts.map +1 -0
- package/dist/input-chip.js +284 -0
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.d.ts +43 -36
- package/dist/input-otp.d.ts.map +1 -1
- package/dist/input-otp.js +140 -119
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +147 -19
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +197 -92
- package/dist/input.cjs +1 -1
- package/dist/input.js +1 -1
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +10 -0
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +45 -36
- package/dist/select.d.ts.map +1 -1
- package/dist/slider.cjs +1 -1
- package/dist/slider.d.ts +31 -3
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +53 -43
- package/dist/textarea.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/alert.tsx +10 -1
- package/src/components/card.tsx +66 -38
- package/src/components/centred-layout.tsx +115 -38
- package/src/components/checkbox.tsx +2 -2
- package/src/components/chip.tsx +249 -0
- package/src/components/combobox.tsx +17 -13
- package/src/components/date-picker.tsx +410 -266
- package/src/components/dropdown-menu.tsx +6 -1
- package/src/components/header.tsx +69 -0
- package/src/components/input-chip.tsx +548 -0
- package/src/components/input-group.tsx +4 -1
- package/src/components/input-otp.tsx +159 -91
- package/src/components/input-password.tsx +469 -129
- package/src/components/input.tsx +1 -1
- package/src/components/progress.tsx +21 -2
- package/src/components/select.tsx +1 -3
- package/src/components/slider.tsx +85 -15
- package/src/components/textarea.tsx +4 -1
- package/src/index.ts +3 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B;;GAEG;AACH,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5B,QAAA,MAAM,YAAY;;8EAyCjB,CAAC;AAkCF;;GAEG;AACH,UAAU,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAChE;;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,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAmGT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
package/dist/chip.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { jsxs as f, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cva as b } from "class-variance-authority";
|
|
4
|
+
import { LoaderCircle as k, X as N } from "@brightlocal/icons";
|
|
5
|
+
import { cn as r } from "@brightlocal/ui-components/lib/utils";
|
|
6
|
+
import { TooltipProvider as R, Tooltip as j, TooltipTrigger as L, TooltipContent as V } from "@brightlocal/ui-components/tooltip";
|
|
7
|
+
const $ = b(
|
|
8
|
+
[
|
|
9
|
+
// Base styles
|
|
10
|
+
"inline-flex",
|
|
11
|
+
"items-center",
|
|
12
|
+
"justify-center",
|
|
13
|
+
"gap-0.5",
|
|
14
|
+
"rounded-full",
|
|
15
|
+
"font-medium",
|
|
16
|
+
"whitespace-nowrap",
|
|
17
|
+
"shrink-0",
|
|
18
|
+
"select-none",
|
|
19
|
+
// Background and text colors
|
|
20
|
+
"bg-secondary",
|
|
21
|
+
"text-foreground",
|
|
22
|
+
// Transitions
|
|
23
|
+
"transition-[color,background-color,box-shadow]",
|
|
24
|
+
"duration-150",
|
|
25
|
+
"ease-in-out",
|
|
26
|
+
// Hover state
|
|
27
|
+
"hover:bg-secondary/80",
|
|
28
|
+
// Focus state - direct focus on chip (for keyboard navigation)
|
|
29
|
+
"focus:outline-none",
|
|
30
|
+
"focus-visible:shadow-default",
|
|
31
|
+
// Disabled state
|
|
32
|
+
"disabled:pointer-events-none",
|
|
33
|
+
"disabled:opacity-50",
|
|
34
|
+
"aria-disabled:pointer-events-none",
|
|
35
|
+
"aria-disabled:opacity-50"
|
|
36
|
+
],
|
|
37
|
+
{
|
|
38
|
+
variants: {
|
|
39
|
+
size: {
|
|
40
|
+
md: ["h-7", "pl-2.5", "pr-1", "text-xs"],
|
|
41
|
+
lg: ["h-8", "pl-4", "pr-2", "text-base"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
size: "md"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
), m = b(
|
|
49
|
+
[
|
|
50
|
+
// Base styles
|
|
51
|
+
"inline-flex",
|
|
52
|
+
"items-center",
|
|
53
|
+
"justify-center",
|
|
54
|
+
"rounded-full",
|
|
55
|
+
"cursor-pointer",
|
|
56
|
+
// Colors
|
|
57
|
+
"text-muted-foreground",
|
|
58
|
+
// Hover
|
|
59
|
+
"hover:text-foreground",
|
|
60
|
+
// Focus
|
|
61
|
+
"outline-none",
|
|
62
|
+
"focus-visible:text-foreground",
|
|
63
|
+
// Disabled
|
|
64
|
+
"disabled:pointer-events-none",
|
|
65
|
+
"disabled:opacity-50"
|
|
66
|
+
],
|
|
67
|
+
{
|
|
68
|
+
variants: {
|
|
69
|
+
size: {
|
|
70
|
+
md: ["size-6"],
|
|
71
|
+
lg: ["size-6"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
defaultVariants: {
|
|
75
|
+
size: "md"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
), D = i.forwardRef(
|
|
79
|
+
({
|
|
80
|
+
className: h,
|
|
81
|
+
children: t,
|
|
82
|
+
size: a = "md",
|
|
83
|
+
loading: l = !1,
|
|
84
|
+
disabled: v = !1,
|
|
85
|
+
onRemove: g,
|
|
86
|
+
dataHook: d,
|
|
87
|
+
trackingEl: n,
|
|
88
|
+
trackingLabel: x,
|
|
89
|
+
maxWidth: y = 200,
|
|
90
|
+
...w
|
|
91
|
+
}, z) => {
|
|
92
|
+
const c = v || l, u = 16, o = i.useRef(null), [T, C] = i.useState(!1);
|
|
93
|
+
i.useEffect(() => {
|
|
94
|
+
const s = () => {
|
|
95
|
+
o.current && C(
|
|
96
|
+
o.current.scrollWidth > o.current.clientWidth
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
return s(), window.addEventListener("resize", s), () => window.removeEventListener("resize", s);
|
|
100
|
+
}, [t]);
|
|
101
|
+
const p = /* @__PURE__ */ e(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
ref: o,
|
|
105
|
+
className: "truncate",
|
|
106
|
+
"data-slot": "chip-label",
|
|
107
|
+
style: { maxWidth: y },
|
|
108
|
+
children: t
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
return /* @__PURE__ */ f(
|
|
112
|
+
"div",
|
|
113
|
+
{
|
|
114
|
+
ref: z,
|
|
115
|
+
"aria-disabled": c ? "true" : void 0,
|
|
116
|
+
className: r($({ size: a }), h),
|
|
117
|
+
"data-hook": d,
|
|
118
|
+
"data-slot": "chip",
|
|
119
|
+
"data-tracking-el": n,
|
|
120
|
+
"data-tracking-label": x,
|
|
121
|
+
...w,
|
|
122
|
+
children: [
|
|
123
|
+
T ? /* @__PURE__ */ e(R, { children: /* @__PURE__ */ f(j, { children: [
|
|
124
|
+
/* @__PURE__ */ e(L, { asChild: !0, children: p }),
|
|
125
|
+
/* @__PURE__ */ e(V, { dataHook: `${d}-tooltip`, sideOffset: 8, children: t })
|
|
126
|
+
] }) }) : p,
|
|
127
|
+
l ? /* @__PURE__ */ e(
|
|
128
|
+
"span",
|
|
129
|
+
{
|
|
130
|
+
"aria-label": "Loading",
|
|
131
|
+
className: r(m({ size: a })),
|
|
132
|
+
"data-slot": "chip-loading",
|
|
133
|
+
role: "status",
|
|
134
|
+
children: /* @__PURE__ */ e(
|
|
135
|
+
k,
|
|
136
|
+
{
|
|
137
|
+
className: "animate-spin motion-reduce:animate-none",
|
|
138
|
+
size: u
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
) : /* @__PURE__ */ e(
|
|
143
|
+
"button",
|
|
144
|
+
{
|
|
145
|
+
"aria-label": `Remove ${typeof t == "string" ? t : "chip"}`,
|
|
146
|
+
className: r(m({ size: a })),
|
|
147
|
+
"data-slot": "chip-delete",
|
|
148
|
+
"data-tracking-el": n ? `${n}-delete` : void 0,
|
|
149
|
+
disabled: c,
|
|
150
|
+
tabIndex: -1,
|
|
151
|
+
type: "button",
|
|
152
|
+
onClick: g,
|
|
153
|
+
children: /* @__PURE__ */ e(N, { size: u })
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
D.displayName = "Chip";
|
|
162
|
+
export {
|
|
163
|
+
D as Chip,
|
|
164
|
+
$ as chipVariants
|
|
165
|
+
};
|
package/dist/combobox.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),U=require("react"),I=require("@brightlocal/icons"),V=require("class-variance-authority"),w=require("@brightlocal/ui-components/lib/utils"),S=require("@brightlocal/ui-components/popover"),l=require("@brightlocal/ui-components/command");function $(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 n=$(U),E=n.createContext(null);function y(){const o=n.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[f,d]=n.useState(""),[m,g]=n.useState(!1),[x,u]=n.useState(()=>new Map),C=o!==void 0,p=a!==void 0,v=C?o:f,h=p?a:m,j=n.useCallback(b=>{p||g(b),t?.(b)},[p,t]),N=n.useCallback(b=>{C||d(b),e?.(b)},[C,e]),R=n.useCallback((b,L)=>{u(k=>{if(k.get(b)===L)return k;const T=new Map(k);return T.set(b,L),T})},[]),D=n.useMemo(()=>({open:h,setOpen:j,value:v,onValueChange:N,shouldFilter:s,disabled:c,itemLabels:x,registerItem:R}),[h,j,v,N,s,c,x,R]);return r.jsx(E.Provider,{value:D,children:r.jsx(S.Popover,{open:h,onOpenChange:j,children:i})})}const A=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","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","[&_svg:not([class*='size-'])]:size-4"],{variants:{variant:{default:[]}},defaultVariants:{variant:"default"}}),O=n.forwardRef(({className:o,variant:e,dataHook:a,trackingEl:t,trackingLabel:s,children:c,...i},f)=>{const{open:d,disabled:m,value:g}=y(),x=n.useId(),u=!g;return r.jsx(S.PopoverTrigger,{asChild:!0,children:r.jsxs("button",{ref:f,"aria-controls":d?x:void 0,"aria-expanded":d,"aria-haspopup":"listbox",className:w.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,r.jsx(I.ChevronsUpDownIcon,{"aria-hidden":"true",className:"text-muted-foreground ml-auto size-4 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 r.jsx("span",{className:w.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"}){const{shouldFilter:s}=y();return r.jsx(S.PopoverContent,{align:t,className:w.cn("w-[var(--radix-popover-trigger-width)] p-0",e),"data-slot":"combobox-popover",children:r.jsx(l.Command,{className:"border-0 shadow-none","data-slot":"combobox-command",dataHook:o||"combobox-command",shouldFilter:s,children:a})})}const P=n.forwardRef((o,e)=>r.jsx(l.CommandInput,{ref:e,"data-slot":"combobox-input",...o}));P.displayName="ComboboxInput";const q=n.forwardRef((o,e)=>r.jsx(l.CommandList,{ref:e,"data-slot":"combobox-list",...o}));q.displayName="ComboboxList";const z=n.forwardRef((o,e)=>r.jsx(l.CommandEmpty,{ref:e,"data-slot":"combobox-empty",...o}));z.displayName="ComboboxEmpty";const M=n.forwardRef((o,e)=>r.jsx(l.CommandGroup,{ref:e,"data-slot":"combobox-group",...o}));M.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 r.jsx("span",{children:s.map((c,i)=>i%2===1?r.jsx("span",{className:a,children:c},i):r.jsx(n.Fragment,{children:c},i))})}const _=n.forwardRef(({value:o,label:e,dataHook:a,children:t,className:s,highlight:c,highlightClassName:i,...f},d)=>{const{value:m,onValueChange:g,setOpen:x,registerItem:u}=y(),C=m===o,p=n.useMemo(()=>e||(typeof t=="string"?t:typeof t=="number"?String(t):o),[e,t,o]),v=n.useRef(u);n.useEffect(()=>{v.current=u},[u]),n.useEffect(()=>{v.current(o,p)},[o,p]);const h=()=>{g(o===m?"":o),x(!1)},j=()=>c&&typeof t=="string"?J(t,c,i||"text-sm leading-normal font-semibold"):t;return r.jsxs(l.CommandItem,{ref:d,className:w.cn("justify-between",s),"data-slot":"combobox-item",dataHook:a,value:o,onSelect:h,...f,children:[j(),C&&r.jsx(I.CheckIcon,{"aria-hidden":"true",className:"text-muted-foreground size-4 shrink-0"})]})});_.displayName="ComboboxItem";const G=n.forwardRef((o,e)=>r.jsx(l.CommandSeparator,{ref:e,"data-slot":"combobox-separator",...o}));G.displayName="ComboboxSeparator";function K({className:o,children:e}){return r.jsx("div",{className:w.cn("flex items-center justify-center gap-2 py-6 text-sm
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),U=require("react"),I=require("@brightlocal/icons"),V=require("class-variance-authority"),w=require("@brightlocal/ui-components/lib/utils"),S=require("@brightlocal/ui-components/popover"),l=require("@brightlocal/ui-components/command");function $(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 n=$(U),E=n.createContext(null);function y(){const o=n.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[f,d]=n.useState(""),[m,g]=n.useState(!1),[x,u]=n.useState(()=>new Map),C=o!==void 0,p=a!==void 0,v=C?o:f,h=p?a:m,j=n.useCallback(b=>{p||g(b),t?.(b)},[p,t]),N=n.useCallback(b=>{C||d(b),e?.(b)},[C,e]),R=n.useCallback((b,L)=>{u(k=>{if(k.get(b)===L)return k;const T=new Map(k);return T.set(b,L),T})},[]),D=n.useMemo(()=>({open:h,setOpen:j,value:v,onValueChange:N,shouldFilter:s,disabled:c,itemLabels:x,registerItem:R}),[h,j,v,N,s,c,x,R]);return r.jsx(E.Provider,{value:D,children:r.jsx(S.Popover,{open:h,onOpenChange:j,children:i})})}const A=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","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","[&_svg:not([class*='size-'])]:size-4"],{variants:{variant:{default:[]}},defaultVariants:{variant:"default"}}),O=n.forwardRef(({className:o,variant:e,dataHook:a,trackingEl:t,trackingLabel:s,children:c,...i},f)=>{const{open:d,disabled:m,value:g}=y(),x=n.useId(),u=!g;return r.jsx(S.PopoverTrigger,{asChild:!0,children:r.jsxs("button",{ref:f,"aria-controls":d?x:void 0,"aria-expanded":d,"aria-haspopup":"listbox",className:w.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,r.jsx(I.ChevronsUpDownIcon,{"aria-hidden":"true",className:"text-muted-foreground ml-auto size-4 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 r.jsx("span",{className:w.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"}){const{shouldFilter:s}=y();return r.jsx(S.PopoverContent,{align:t,className:w.cn("w-[var(--radix-popover-trigger-width)] p-0",e),"data-slot":"combobox-popover",children:r.jsx(l.Command,{className:"border-0 shadow-none","data-slot":"combobox-command",dataHook:o||"combobox-command",shouldFilter:s,children:a})})}const P=n.forwardRef((o,e)=>r.jsx(l.CommandInput,{ref:e,"data-slot":"combobox-input",...o}));P.displayName="ComboboxInput";const q=n.forwardRef((o,e)=>r.jsx(l.CommandList,{ref:e,"data-slot":"combobox-list",...o}));q.displayName="ComboboxList";const z=n.forwardRef((o,e)=>r.jsx(l.CommandEmpty,{ref:e,"data-slot":"combobox-empty",...o}));z.displayName="ComboboxEmpty";const M=n.forwardRef((o,e)=>r.jsx(l.CommandGroup,{ref:e,"data-slot":"combobox-group",...o}));M.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 r.jsx("span",{children:s.map((c,i)=>i%2===1?r.jsx("span",{className:a,children:c},i):r.jsx(n.Fragment,{children:c},i))})}const _=n.forwardRef(({value:o,label:e,dataHook:a,children:t,className:s,highlight:c,highlightClassName:i,...f},d)=>{const{value:m,onValueChange:g,setOpen:x,registerItem:u}=y(),C=m===o,p=n.useMemo(()=>e||(typeof t=="string"?t:typeof t=="number"?String(t):o),[e,t,o]),v=n.useRef(u);n.useEffect(()=>{v.current=u},[u]),n.useEffect(()=>{v.current(o,p)},[o,p]);const h=()=>{g(o===m?"":o),x(!1)},j=()=>c&&typeof t=="string"?J(t,c,i||"text-sm leading-normal font-semibold"):t;return r.jsxs(l.CommandItem,{ref:d,className:w.cn("justify-between",s),"data-slot":"combobox-item",dataHook:a,value:o,onSelect:h,...f,children:[j(),C&&r.jsx(I.CheckIcon,{"aria-hidden":"true",className:"text-muted-foreground size-4 shrink-0"})]})});_.displayName="ComboboxItem";const G=n.forwardRef((o,e)=>r.jsx(l.CommandSeparator,{ref:e,"data-slot":"combobox-separator",...o}));G.displayName="ComboboxSeparator";function K({className:o,children:e}){return r.jsx("div",{className:w.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",o),"data-slot":"combobox-loading",children:e||r.jsxs(r.Fragment,{children:[r.jsx(I.LoaderIcon,{"aria-hidden":"true",className:"size-4 animate-spin"}),"Loading..."]})})}exports.Combobox=F;exports.ComboboxContent=B;exports.ComboboxEmpty=z;exports.ComboboxGroup=M;exports.ComboboxInput=P;exports.ComboboxItem=_;exports.ComboboxList=q;exports.ComboboxLoading=K;exports.ComboboxSeparator=G;exports.ComboboxTrigger=O;exports.ComboboxValue=H;
|
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;
|
|
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,EAA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C;IACnB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAiBrE;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
|
@@ -197,7 +197,10 @@ X.displayName = "ComboboxGroup";
|
|
|
197
197
|
function Y(o, e, a) {
|
|
198
198
|
if (!e || !e.trim())
|
|
199
199
|
return o;
|
|
200
|
-
const r = new RegExp(
|
|
200
|
+
const r = new RegExp(
|
|
201
|
+
`(${e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")})`,
|
|
202
|
+
"gi"
|
|
203
|
+
), s = o.split(r);
|
|
201
204
|
return /* @__PURE__ */ n("span", { children: s.map(
|
|
202
205
|
(i, d) => d % 2 === 1 ? /* @__PURE__ */ n("span", { className: a, children: i }, d) : /* @__PURE__ */ n(t.Fragment, { children: i }, d)
|
|
203
206
|
) });
|
|
@@ -258,7 +261,7 @@ function lo({ className: o, children: e }) {
|
|
|
258
261
|
"div",
|
|
259
262
|
{
|
|
260
263
|
className: w(
|
|
261
|
-
"flex items-center justify-center gap-2 py-6 text-sm
|
|
264
|
+
"text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
|
|
262
265
|
o
|
|
263
266
|
),
|
|
264
267
|
"data-slot": "combobox-loading",
|
package/dist/date-picker.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 o=require("react/jsx-runtime"),H=require("react"),k=require("date-fns"),M=require("@brightlocal/icons"),g=require("@brightlocal/ui-components/lib/utils"),L=require("./input.cjs"),S=require("@brightlocal/ui-components/calendar"),j=require("@brightlocal/ui-components/popover"),p=require("@brightlocal/ui-components/select");function A(e){const n=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(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const D=A(H),v=D.createContext(null);function b(){const e=D.useContext(v);if(!e)throw new Error("DatePicker compound components must be used within DatePickerRoot");return e}function T({children:e,dataHook:n,trackingEl:t,trackingLabel:r,mode:s="single",date:d,onDateChange:u,dateRange:l,onDateRangeChange:c,placeholder:a,disabled:i,dateFormat:f,open:h,onOpenChange:P,defaultOpen:m=!1}){const[V,$]=D.useState(m),w=h!==void 0,x=w?h:V,y=D.useCallback(C=>{w||$(C),P?.(C)},[w,P]),_=D.useMemo(()=>({mode:s,open:x,setOpen:y,disabled:i,date:d,onDateChange:u,dateRange:l,onDateRangeChange:c,dateFormat:f??(s==="single"?"PPP":"PP"),placeholder:a??(s==="single"?"Pick a date":"Pick a date range"),dataHook:n,trackingEl:t,trackingLabel:r}),[s,x,y,i,d,u,l,c,f,a,n,t,r]);return o.jsx(v.Provider,{value:_,children:o.jsx(j.Popover,{open:x,onOpenChange:y,children:e})})}T.displayName="DatePickerRoot";const N=D.forwardRef(({className:e,children:n,id:t,...r},s)=>{const{mode:d,date:u,dateRange:l,dateFormat:c,placeholder:a,disabled:i,dataHook:f}=b(),P=d==="single"?u?k.format(u,c):null:l?.from?l.to?`${k.format(l.from,c)} - ${k.format(l.to,c)}`:k.format(l.from,c):null,m=P!==null;return o.jsx(j.PopoverTrigger,{asChild:!0,children:o.jsxs("button",{ref:s,"aria-label":r["aria-label"]??(d==="single"?"Select date":"Select date range"),className:g.cn(L.inputVariants({hasIcon:!0}),"relative cursor-pointer justify-start text-left",!m&&"text-muted-foreground",e),"data-hook":`${f}-trigger`,"data-slot":"date-picker-trigger",disabled:i,id:t,type:"button",...r,children:[o.jsx(M.Calendar,{className:g.cn("text-muted-foreground pointer-events-none absolute top-1/2 left-3 size-4 -translate-y-1/2",i&&"opacity-50"),"data-slot":"calendar-icon"}),n??(m?P:o.jsx("span",{children:a}))]})})});N.displayName="DatePickerTrigger";const R=D.forwardRef(({className:e,children:n,...t},r)=>{const{dataHook:s}=b();return o.jsx(j.PopoverContent,{ref:r,align:"start",className:g.cn("w-auto rounded-lg p-0",e),dataHook:`${s}-content`,...t,children:n})});R.displayName="DatePickerContent";function E({className:e,closeOnSelect:n=!0,...t}){const{mode:r,date:s,onDateChange:d,dateRange:u,onDateRangeChange:l,setOpen:c,disabled:a,dataHook:i}=b();return r==="single"?o.jsx(S.Calendar,{captionLayout:"dropdown",className:g.cn("border-0 shadow-none",e),dataHook:`${i}-calendar`,disabled:a,endMonth:new Date(2100,11,31),mode:"single",selected:s,startMonth:new Date(1900,0,1),onSelect:f=>{d?.(f),n&&c(!1)},...t}):o.jsx(S.Calendar,{captionLayout:"dropdown",className:g.cn("border-0 shadow-none",e),dataHook:`${i}-calendar`,disabled:a,endMonth:new Date(2100,11,31),mode:"range",selected:u,startMonth:new Date(1900,0,1),onSelect:l,...t})}E.displayName="DatePickerCalendar";const q=[{label:"Today",date:()=>new Date},{label:"Tomorrow",date:()=>{const e=new Date;return e.setDate(e.getDate()+1),e}},{label:"In 3 days",date:()=>{const e=new Date;return e.setDate(e.getDate()+3),e}},{label:"In a week",date:()=>{const e=new Date;return e.setDate(e.getDate()+7),e}}];function O({presets:e=q,placeholder:n="Select preset",className:t}){const{mode:r,date:s,onDateChange:d,disabled:u,dataHook:l}=b();if(r!=="single")return process.env.NODE_ENV!=="production"&&console.warn("DatePickerPresets only works with mode='single'"),null;const c=s?e.find(a=>a.date().toDateString()===s.toDateString())?.label:void 0;return o.jsxs(p.Select,{disabled:u,value:c,onValueChange:a=>{const i=e.find(f=>f.label===a);i&&d?.(i.date())},children:[o.jsx(p.SelectTrigger,{className:g.cn("w-full",t),dataHook:`${l}-preset-select`,children:o.jsx(p.SelectValue,{placeholder:n})}),o.jsx(p.SelectContent,{children:e.map(a=>o.jsx(p.SelectItem,{"data-hook":`${l}-preset-${a.label.toLowerCase().replace(/\s+/g,"-")}`,value:a.label,children:a.label},a.label))})]})}O.displayName="DatePickerPresets";exports.DEFAULT_DATE_PRESETS=q;exports.DatePickerCalendar=E;exports.DatePickerContent=R;exports.DatePickerPresets=O;exports.DatePickerRoot=T;exports.DatePickerTrigger=N;
|
package/dist/date-picker.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { DateRange } from 'react-day-picker';
|
|
2
|
+
import { CalendarProps } from '../calendar';
|
|
3
|
+
import { PopoverContent } from '../popover';
|
|
2
4
|
import * as React from "react";
|
|
3
5
|
/**
|
|
4
6
|
* Preset configuration for DatePicker
|
|
@@ -13,33 +15,44 @@ export interface DatePreset {
|
|
|
13
15
|
*/
|
|
14
16
|
date: () => Date;
|
|
15
17
|
}
|
|
16
|
-
|
|
18
|
+
type DatePickerMode = "single" | "range";
|
|
19
|
+
export interface DatePickerRootProps {
|
|
17
20
|
/**
|
|
18
21
|
* Data hook for automated testing (REQUIRED)
|
|
19
|
-
* Used to identify component in tests and E2E automation
|
|
20
22
|
*/
|
|
21
23
|
dataHook: string;
|
|
22
24
|
/**
|
|
23
25
|
* Tracking element identifier for analytics
|
|
24
|
-
* Defaults to "date-picker" if not provided
|
|
25
26
|
*/
|
|
26
27
|
trackingEl?: string;
|
|
27
28
|
/**
|
|
28
29
|
* Tracking label for analytics context
|
|
29
|
-
* Additional context for tracking events
|
|
30
30
|
*/
|
|
31
31
|
trackingLabel?: string;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* Selection mode: 'single' for single date, 'range' for date range
|
|
34
|
+
* @default "single"
|
|
35
|
+
*/
|
|
36
|
+
mode?: DatePickerMode;
|
|
37
|
+
/**
|
|
38
|
+
* Selected date value (single mode)
|
|
34
39
|
*/
|
|
35
40
|
date?: Date;
|
|
36
41
|
/**
|
|
37
|
-
* Callback fired when date selection changes
|
|
42
|
+
* Callback fired when date selection changes (single mode)
|
|
38
43
|
*/
|
|
39
44
|
onDateChange?: (date: Date | undefined) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Selected date range value (range mode)
|
|
47
|
+
*/
|
|
48
|
+
dateRange?: DateRange;
|
|
49
|
+
/**
|
|
50
|
+
* Callback fired when date range selection changes (range mode)
|
|
51
|
+
*/
|
|
52
|
+
onDateRangeChange?: (dateRange: DateRange | undefined) => void;
|
|
40
53
|
/**
|
|
41
54
|
* Placeholder text when no date is selected
|
|
42
|
-
* @default "Pick a date"
|
|
55
|
+
* @default "Pick a date" for single, "Pick a date range" for range
|
|
43
56
|
*/
|
|
44
57
|
placeholder?: string;
|
|
45
58
|
/**
|
|
@@ -49,72 +62,96 @@ export interface DatePickerProps extends Omit<React.ComponentProps<"div">, "onSe
|
|
|
49
62
|
/**
|
|
50
63
|
* Format string for displaying selected date
|
|
51
64
|
* Uses date-fns format tokens
|
|
52
|
-
* @default "PPP"
|
|
53
|
-
* @example "MM/dd/yyyy" → "12/31/2024"
|
|
54
|
-
* @example "PPP" → "December 31st, 2024"
|
|
65
|
+
* @default "PPP" for single, "PP" for range
|
|
55
66
|
*/
|
|
56
67
|
dateFormat?: string;
|
|
57
68
|
/**
|
|
58
|
-
*
|
|
59
|
-
* When provided, shows a Select dropdown above the calendar
|
|
69
|
+
* Controlled open state
|
|
60
70
|
*/
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
declare const DatePicker: React.ForwardRefExoticComponent<Omit<DatePickerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
64
|
-
export interface DatePickerPresetProps extends Omit<DatePickerProps, "presets"> {
|
|
71
|
+
open?: boolean;
|
|
65
72
|
/**
|
|
66
|
-
*
|
|
67
|
-
* @default Default presets: Today, Tomorrow, In 3 days, In a week
|
|
73
|
+
* Callback fired when open state changes
|
|
68
74
|
*/
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* DatePickerPreset - A DatePicker with built-in preset options.
|
|
73
|
-
* Comes with sensible defaults (Today, Tomorrow, In 3 days, In a week)
|
|
74
|
-
* that can be overridden with custom presets.
|
|
75
|
-
*/
|
|
76
|
-
declare const DatePickerPreset: React.ForwardRefExoticComponent<Omit<DatePickerPresetProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
77
|
-
export interface DatePickerRangeProps extends Omit<React.ComponentProps<"div">, "onSelect"> {
|
|
78
|
-
/**
|
|
79
|
-
* Data hook for automated testing (REQUIRED)
|
|
80
|
-
*/
|
|
81
|
-
dataHook: string;
|
|
75
|
+
onOpenChange?: (open: boolean) => void;
|
|
82
76
|
/**
|
|
83
|
-
*
|
|
77
|
+
* Default open state for uncontrolled usage
|
|
84
78
|
*/
|
|
85
|
-
|
|
79
|
+
defaultOpen?: boolean;
|
|
86
80
|
/**
|
|
87
|
-
*
|
|
81
|
+
* Children components
|
|
88
82
|
*/
|
|
89
|
-
|
|
83
|
+
children: React.ReactNode;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* DatePickerRoot - Root component that provides context for all DatePicker parts
|
|
87
|
+
*/
|
|
88
|
+
declare function DatePickerRoot({ children, dataHook, trackingEl, trackingLabel, mode, date, onDateChange, dateRange, onDateRangeChange, placeholder, disabled, dateFormat, open: controlledOpen, onOpenChange, defaultOpen, }: DatePickerRootProps): import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
declare namespace DatePickerRoot {
|
|
90
|
+
var displayName: string;
|
|
91
|
+
}
|
|
92
|
+
export interface DatePickerTriggerProps extends Omit<React.ComponentProps<"button">, "children"> {
|
|
90
93
|
/**
|
|
91
|
-
*
|
|
94
|
+
* Custom render function for trigger content
|
|
95
|
+
* If not provided, displays formatted date or placeholder
|
|
92
96
|
*/
|
|
93
|
-
|
|
97
|
+
children?: React.ReactNode;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* DatePickerTrigger - The button that opens the date picker popover
|
|
101
|
+
*/
|
|
102
|
+
declare const DatePickerTrigger: React.ForwardRefExoticComponent<Omit<DatePickerTriggerProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
103
|
+
export interface DatePickerContentProps extends Omit<React.ComponentProps<typeof PopoverContent>, "children"> {
|
|
94
104
|
/**
|
|
95
|
-
*
|
|
105
|
+
* Children to render inside the popover
|
|
96
106
|
*/
|
|
97
|
-
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* DatePickerContent - The popover content container
|
|
111
|
+
*/
|
|
112
|
+
declare const DatePickerContent: React.ForwardRefExoticComponent<Omit<DatePickerContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
113
|
+
export interface DatePickerCalendarProps extends Omit<CalendarProps, "mode" | "selected" | "onSelect" | "dataHook"> {
|
|
98
114
|
/**
|
|
99
|
-
*
|
|
100
|
-
* @default
|
|
115
|
+
* Whether to close the popover when a date is selected (single mode only)
|
|
116
|
+
* @default true
|
|
101
117
|
*/
|
|
102
|
-
|
|
118
|
+
closeOnSelect?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* DatePickerCalendar - The calendar component that connects to DatePicker context
|
|
122
|
+
*/
|
|
123
|
+
declare function DatePickerCalendar({ className, closeOnSelect, ...props }: DatePickerCalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
124
|
+
declare namespace DatePickerCalendar {
|
|
125
|
+
var displayName: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Default presets for convenience
|
|
129
|
+
*/
|
|
130
|
+
export declare const DEFAULT_DATE_PRESETS: DatePreset[];
|
|
131
|
+
export interface DatePickerPresetsProps {
|
|
103
132
|
/**
|
|
104
|
-
*
|
|
133
|
+
* Array of preset options
|
|
134
|
+
* @default DEFAULT_DATE_PRESETS
|
|
105
135
|
*/
|
|
106
|
-
|
|
136
|
+
presets?: DatePreset[];
|
|
107
137
|
/**
|
|
108
|
-
*
|
|
109
|
-
* @default "
|
|
138
|
+
* Placeholder text for the select
|
|
139
|
+
* @default "Select preset"
|
|
110
140
|
*/
|
|
111
|
-
|
|
141
|
+
placeholder?: string;
|
|
112
142
|
/**
|
|
113
|
-
*
|
|
114
|
-
* @default 2
|
|
143
|
+
* Additional class name
|
|
115
144
|
*/
|
|
116
|
-
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* DatePickerPresets - A select dropdown for quick date selection
|
|
149
|
+
* Only works in single mode
|
|
150
|
+
*/
|
|
151
|
+
declare function DatePickerPresets({ presets, placeholder, className, }: DatePickerPresetsProps): import("react/jsx-runtime").JSX.Element | null;
|
|
152
|
+
declare namespace DatePickerPresets {
|
|
153
|
+
var displayName: string;
|
|
117
154
|
}
|
|
118
|
-
|
|
119
|
-
export {
|
|
155
|
+
export { DatePickerRoot, DatePickerTrigger, DatePickerContent, DatePickerCalendar, DatePickerPresets, };
|
|
156
|
+
export type { DateRange };
|
|
120
157
|
//# sourceMappingURL=date-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAIlD,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAEL,cAAc,EAEf,MAAM,oCAAoC,CAAC;AAa5C;;GAEG;AACH,MA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