@brightlocal/ui-components 3.1.0 → 3.2.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/README.md +6 -1
- package/component-meta.json +663 -38
- package/deprecations.json +1 -1
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +21 -20
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +86 -6
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +185 -96
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +231 -13
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +466 -306
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.js +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +169 -22
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +695 -561
- package/dist/grid.d.ts +24 -1
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +593 -561
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +28 -6
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +5 -5
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +11 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +97 -81
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-text.d.ts +1 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +8 -3
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/card.tsx +211 -24
- package/src/components/chart.tsx +523 -35
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +1 -1
- package/src/components/data-table.tsx +778 -195
- package/src/components/grid.tsx +32 -1
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +33 -11
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/select.tsx +35 -5
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-text.tsx +1 -2
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +5 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/utils.ts +1 -0
package/dist/input-password.d.ts
CHANGED
|
@@ -8,12 +8,34 @@ type DefaultPasswordStrength = "meter" | "weak" | "ok" | "good" | "great";
|
|
|
8
8
|
* Configuration for a single strength level
|
|
9
9
|
*/
|
|
10
10
|
interface StrengthLevelConfig {
|
|
11
|
+
/** Text shown beside the bar for this level, e.g. `"Weak"` */
|
|
11
12
|
label: string;
|
|
13
|
+
/** Bar fill as a percentage, 0–100 */
|
|
12
14
|
value: number;
|
|
15
|
+
/**
|
|
16
|
+
* Background utility for the bar fill. Use the Progress bar palette
|
|
17
|
+
* (`bg-green-400`, `bg-brand-red`, `bg-brand-orange`, `bg-brand-yellow`,
|
|
18
|
+
* `bg-muted`) so custom levels stay consistent with Progress (DS-773).
|
|
19
|
+
*/
|
|
13
20
|
color: string;
|
|
14
21
|
}
|
|
15
22
|
/**
|
|
16
23
|
* Default strength levels configuration
|
|
24
|
+
*
|
|
25
|
+
* DESIGN DECISION (DS-293, kept in DS-666): every level shares one fill. The
|
|
26
|
+
* bar's length and the label ("Weak" … "Great") carry the strength, so colour
|
|
27
|
+
* is never the only indicator of state. Per-level red/amber/green would also
|
|
28
|
+
* have to come from the alert-surface tokens (`success-background` is green-200
|
|
29
|
+
* in light, green-950 in dark) — tints tuned as a backdrop, which read as a
|
|
30
|
+
* washed-out or near-black 8px bar.
|
|
31
|
+
*
|
|
32
|
+
* The fill is `green-400` — the same fill the green Progress bar uses, a
|
|
33
|
+
* documented palette-step-by-choice with Figma parity (DS-773, see
|
|
34
|
+
* progress.tsx). The meter IS a Progress, so its green must match; the track
|
|
35
|
+
* beneath stays Progress's own `brand-primary-foreground/20`. The token-first
|
|
36
|
+
* alternative (`bg-brand-primary-foreground`) was tried in DS-666 and rejected
|
|
37
|
+
* in review: its dark value (#00851E) renders a dim bar that diverges from
|
|
38
|
+
* every other green Progress on the page.
|
|
17
39
|
*/
|
|
18
40
|
declare const DEFAULT_STRENGTH_LEVELS: Record<DefaultPasswordStrength, StrengthLevelConfig>;
|
|
19
41
|
/**
|
|
@@ -56,9 +78,9 @@ export interface InputPasswordProps<T extends string = DefaultPasswordStrength>
|
|
|
56
78
|
* @example
|
|
57
79
|
* strengthLevels={{
|
|
58
80
|
* empty: { label: "Enter password", value: 0, color: "bg-muted" },
|
|
59
|
-
* slow: { label: "Slow", value: 33, color: "bg-red
|
|
60
|
-
* medium: { label: "Medium", value: 66, color: "bg-yellow
|
|
61
|
-
* fast: { label: "Fast", value: 100, color: "bg-green-
|
|
81
|
+
* slow: { label: "Slow", value: 33, color: "bg-brand-red" },
|
|
82
|
+
* medium: { label: "Medium", value: 66, color: "bg-brand-yellow" },
|
|
83
|
+
* fast: { label: "Fast", value: 100, color: "bg-green-400" },
|
|
62
84
|
* }}
|
|
63
85
|
*/
|
|
64
86
|
strengthLevels?: Record<T, StrengthLevelConfig>;
|
|
@@ -99,9 +121,9 @@ export interface InputPasswordProps<T extends string = DefaultPasswordStrength>
|
|
|
99
121
|
* dataHook="password"
|
|
100
122
|
* strengthLevels={{
|
|
101
123
|
* empty: { label: "Enter password", value: 0, color: "bg-muted" },
|
|
102
|
-
* slow: { label: "Slow", value: 33, color: "bg-red
|
|
103
|
-
* medium: { label: "Medium", value: 66, color: "bg-yellow
|
|
104
|
-
* fast: { label: "Fast", value: 100, color: "bg-green-
|
|
124
|
+
* slow: { label: "Slow", value: 33, color: "bg-brand-red" },
|
|
125
|
+
* medium: { label: "Medium", value: 66, color: "bg-brand-yellow" },
|
|
126
|
+
* fast: { label: "Fast", value: 100, color: "bg-green-400" },
|
|
105
127
|
* }}
|
|
106
128
|
* calculateStrength={(password) => {
|
|
107
129
|
* if (!password) return "empty";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../src/components/input-password.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,eAAe,EAEf,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAMhD;;GAEG;AACH,KAAK,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED
|
|
1
|
+
{"version":3,"file":"input-password.d.ts","sourceRoot":"","sources":["../../src/components/input-password.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,eAAe,EAEf,gBAAgB,EACjB,MAAM,wCAAwC,CAAC;AAMhD;;GAEG;AACH,KAAK,uBAAuB,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1E;;GAEG;AACH,UAAU,mBAAmB;IAC3B,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AAE,0BAA0B,2CA+B5B;kBAlCQ,qBAAqB;;;AA0C9B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,yBAAyB,EACzB,uBAAuB,GACxB,CAAC;AAEF,YAAY,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/input-password.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Progress as j } from "@brightlocal/ui-components/progress";
|
|
|
5
5
|
import { cn as x } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
import { InputGroup as M, InputGroupInput as O, InputGroupAddon as Z, InputGroupButton as V } from "@brightlocal/ui-components/input-group";
|
|
7
7
|
const _ = {
|
|
8
|
-
meter: { label: "Meter", value: 0, color: "bg-green-
|
|
9
|
-
weak: { label: "Weak", value: 25, color: "bg-green-
|
|
10
|
-
ok: { label: "Ok", value: 50, color: "bg-green-
|
|
11
|
-
good: { label: "Good", value: 75, color: "bg-green-
|
|
12
|
-
great: { label: "Great", value: 100, color: "bg-green-
|
|
8
|
+
meter: { label: "Meter", value: 0, color: "bg-green-400" },
|
|
9
|
+
weak: { label: "Weak", value: 25, color: "bg-green-400" },
|
|
10
|
+
ok: { label: "Ok", value: 50, color: "bg-green-400" },
|
|
11
|
+
good: { label: "Good", value: 75, color: "bg-green-400" },
|
|
12
|
+
great: { label: "Great", value: 100, color: "bg-green-400" }
|
|
13
13
|
};
|
|
14
14
|
function B(e) {
|
|
15
15
|
if (!e || e.length === 0)
|
package/dist/input.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out","text-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out","text-field","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:c,trackingLabel:d,...o},u)=>{const i=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":i?"true":void 0,className:v.cn(n({hasIcon:r,hasSecondaryIcon:t}),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":c,"data-tracking-label":d,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=n;
|
package/dist/input.js
CHANGED
|
@@ -10,7 +10,7 @@ const p = f(
|
|
|
10
10
|
"border border-input bg-background rounded-sm",
|
|
11
11
|
"outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
12
12
|
// Typography
|
|
13
|
-
"text-
|
|
13
|
+
"text-field",
|
|
14
14
|
"text-foreground",
|
|
15
15
|
"overflow-hidden text-ellipsis",
|
|
16
16
|
// States - Focus
|
|
@@ -43,30 +43,30 @@ const p = f(
|
|
|
43
43
|
}
|
|
44
44
|
), v = u.forwardRef(
|
|
45
45
|
({
|
|
46
|
-
className:
|
|
46
|
+
className: o,
|
|
47
47
|
hasIcon: r = !1,
|
|
48
48
|
hasSecondaryIcon: t = !1,
|
|
49
49
|
dataHook: i,
|
|
50
50
|
error: d,
|
|
51
51
|
trackingEl: s,
|
|
52
|
-
trackingLabel:
|
|
52
|
+
trackingLabel: l,
|
|
53
53
|
...e
|
|
54
|
-
},
|
|
55
|
-
const
|
|
54
|
+
}, n) => {
|
|
55
|
+
const a = d || e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
|
|
56
56
|
return /* @__PURE__ */ c(
|
|
57
57
|
"input",
|
|
58
58
|
{
|
|
59
|
-
ref:
|
|
60
|
-
"aria-invalid":
|
|
59
|
+
ref: n,
|
|
60
|
+
"aria-invalid": a ? "true" : void 0,
|
|
61
61
|
className: b(
|
|
62
62
|
p({ hasIcon: r, hasSecondaryIcon: t }),
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
a && "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
|
|
64
|
+
o
|
|
65
65
|
),
|
|
66
66
|
"data-hook": i,
|
|
67
67
|
"data-slot": "input",
|
|
68
68
|
"data-tracking-el": s,
|
|
69
|
-
"data-tracking-label":
|
|
69
|
+
"data-tracking-label": l,
|
|
70
70
|
...e
|
|
71
71
|
}
|
|
72
72
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),c=require("react"),s=require("@brightlocal/illustrations");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const r=u(c),a=s.ILLUSTRATION_SIZES.md;function i({children:t,size:e,slot:n}){const o=r.isValidElement(t)&&typeof t.type=="function"?r.cloneElement(t,{size:e}):t;return l.jsx("div",{className:"flex shrink-0 items-center justify-center [&>*]:h-auto [&>*]:max-h-full [&>*]:max-w-full","data-slot":n,style:{width:e,height:e},children:o})}exports.BLOCK_ILLUSTRATION_SIZE=a;exports.BlockIllustration=i;
|
|
@@ -7,8 +7,11 @@ import * as React from "react";
|
|
|
7
7
|
* The artwork is the title's companion, not the subject of the screen: much
|
|
8
8
|
* larger and it outweighs the 24px heading under it, and the eye lands on the
|
|
9
9
|
* drawing instead of the words that say what to do next.
|
|
10
|
+
*
|
|
11
|
+
* This is the `md` step of the shared illustration scale, so a consumer who
|
|
12
|
+
* places the same artwork by hand with `size="md"` gets the identical size.
|
|
10
13
|
*/
|
|
11
|
-
declare const BLOCK_ILLUSTRATION_SIZE
|
|
14
|
+
declare const BLOCK_ILLUSTRATION_SIZE: 130;
|
|
12
15
|
/**
|
|
13
16
|
* Props for the internal BlockIllustration wrapper.
|
|
14
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block-illustration.d.ts","sourceRoot":"","sources":["../../src/lib/block-illustration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"block-illustration.d.ts","sourceRoot":"","sources":["../../src/lib/block-illustration.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAiC/B;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,uBAAuB,KAAwB,CAAC;AAEtD;;GAEG;AACH,UAAU,sBAAsB;IAC9B,mEAAmE;IACnE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,sBAAsB,2CA2B1E;AAED,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { ILLUSTRATION_SIZES as s } from "@brightlocal/illustrations";
|
|
4
|
+
const r = s.md;
|
|
5
|
+
function f({ children: t, size: o, slot: l }) {
|
|
6
|
+
const m = e.isValidElement(t) && typeof t.type == "function" ? e.cloneElement(t, {
|
|
7
|
+
size: o
|
|
7
8
|
}) : t;
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
+
return /* @__PURE__ */ n(
|
|
9
10
|
"div",
|
|
10
11
|
{
|
|
11
12
|
className: "flex shrink-0 items-center justify-center [&>*]:h-auto [&>*]:max-h-full [&>*]:max-w-full",
|
|
12
13
|
"data-slot": l,
|
|
13
|
-
style: { width:
|
|
14
|
-
children:
|
|
14
|
+
style: { width: o, height: o },
|
|
15
|
+
children: m
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
18
|
}
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
r as BLOCK_ILLUSTRATION_SIZE,
|
|
21
|
+
f as BlockIllustration
|
|
21
22
|
};
|
package/dist/lib/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("clsx"),a=require("tailwind-merge"),o=a.extendTailwindMerge({extend:{classGroups:{duration:[{duration:["fast","base","slow"]}],ease:[{ease:["emphasized","overshoot"]}],"font-weight":[{text:["emphasis"]}],"font-size":[{text:["display","heading-page","heading-section","heading-subsection","heading-compact","body","body-sm","body-xs","label","label-sm","metric","code","code-inline"]}]}}});function s(...e){return o(t.clsx(e))}const d="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";exports.FLOATING_CONTENT_ANIMATION=d;exports.cn=s;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("clsx"),a=require("tailwind-merge"),o=a.extendTailwindMerge({extend:{classGroups:{duration:[{duration:["fast","base","slow"]}],ease:[{ease:["emphasized","overshoot"]}],"font-weight":[{text:["emphasis"]}],"font-size":[{text:["display","heading-page","heading-section","heading-subsection","heading-compact","body","body-sm","body-xs","label","label-sm","field","metric","code","code-inline"]}]}}});function s(...e){return o(t.clsx(e))}const d="data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";exports.FLOATING_CONTENT_ANIMATION=d;exports.cn=s;
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AA0C7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,0BAA0B,0aACkY,CAAC"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { clsx as
|
|
1
|
+
import { clsx as t } from "clsx";
|
|
2
2
|
import { extendTailwindMerge as a } from "tailwind-merge";
|
|
3
3
|
const o = a({
|
|
4
4
|
extend: {
|
|
@@ -22,6 +22,7 @@ const o = a({
|
|
|
22
22
|
"body-xs",
|
|
23
23
|
"label",
|
|
24
24
|
"label-sm",
|
|
25
|
+
"field",
|
|
25
26
|
"metric",
|
|
26
27
|
"code",
|
|
27
28
|
"code-inline"
|
|
@@ -31,8 +32,8 @@ const o = a({
|
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
});
|
|
34
|
-
function i(...
|
|
35
|
-
return o(e
|
|
35
|
+
function i(...e) {
|
|
36
|
+
return o(t(e));
|
|
36
37
|
}
|
|
37
38
|
const n = "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";
|
|
38
39
|
export {
|
package/dist/list.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),k=require("react"),h=require("@radix-ui/react-slot"),R=require("class-variance-authority"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),k=require("react"),h=require("@radix-ui/react-slot"),R=require("class-variance-authority"),r=require("@brightlocal/ui-components/lib/utils"),v=require("@brightlocal/ui-components/skeleton");function w(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const i=w(k),d=R.cva(["flex","items-center","gap-4","rounded-lg","py-2","pr-2","pl-4","transition-colors","duration-fast","ease-out"],{variants:{variant:{default:[],filled:["bg-muted"],outline:["bg-background","border","border-border"],loading:["p-0"]}},defaultVariants:{variant:"filled"}}),c=i.forwardRef(({className:e,dataHook:a,trackingEl:t,trackingLabel:o,...n},l)=>s.jsx("ul",{ref:l,className:r.cn("flex flex-col gap-2",e),"data-hook":a,"data-slot":"list","data-tracking-el":t,"data-tracking-label":o,...n}));c.displayName="List";const m=i.forwardRef(({asChild:e=!1,className:a,variant:t,dataHook:o,trackingEl:n,trackingLabel:l,children:I,...y},N)=>{const j=e?h.Slot:"li";return s.jsx(j,{ref:N,className:r.cn(d({variant:t}),a),"data-hook":o,"data-slot":"item","data-tracking-el":n,"data-tracking-label":l,...y,children:t==="loading"?s.jsx(v.Skeleton,{className:"h-13 w-full rounded-lg"}):I})});m.displayName="Item";const f=i.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:r.cn("shrink-0",e),"data-slot":"item-media",...a}));f.displayName="ItemMedia";const u=i.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:r.cn("flex flex-1 flex-col gap-1",e),"data-slot":"item-content",...a}));u.displayName="ItemContent";const p=i.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:r.cn("text-foreground text-body",e),"data-slot":"item-title",...a}));p.displayName="ItemTitle";const g=i.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:r.cn("text-body-sm text-muted-foreground",e),"data-slot":"item-description",...a}));g.displayName="ItemDescription";const x=i.forwardRef(({className:e,...a},t)=>s.jsx("div",{ref:t,className:r.cn("text-muted-foreground flex size-9 shrink-0 items-center justify-center rounded-full",e),"data-slot":"item-actions",...a}));x.displayName="ItemActions";const b=i.forwardRef(({className:e,dataHook:a,...t},o)=>s.jsx("li",{ref:o,className:r.cn("text-muted-foreground text-label-sm flex items-center pt-4 pr-2 pb-1 pl-4 first:pt-2",e),"data-hook":a,"data-slot":"item-subheader",...t}));b.displayName="ItemSubheader";exports.Item=m;exports.ItemActions=x;exports.ItemContent=u;exports.ItemDescription=g;exports.ItemMedia=f;exports.ItemSubheader=b;exports.ItemTitle=p;exports.List=c;exports.itemVariants=d;
|
package/dist/list.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),we=require("react"),Se=require("class-variance-authority"),M=require("@brightlocal/icons"),ce=require("@brightlocal/ui-components/button"),Y=require("@brightlocal/ui-components/checkbox"),m=require("@brightlocal/ui-components/command"),u=require("@brightlocal/ui-components/drawer"),ye=require("@brightlocal/ui-components/hooks/use-breakpoint"),Ne=require("@brightlocal/ui-components/input"),ie=require("@brightlocal/ui-components/label"),T=require("@brightlocal/ui-components/lib/utils"),J=require("@brightlocal/ui-components/popover"),Oe=require("./lib/empty-chip.cjs");function $e(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const c in l)if(c!=="default"){const i=Object.getOwnPropertyDescriptor(l,c);Object.defineProperty(s,c,i.get?i:{enumerable:!0,get:()=>l[c]})}}return s.default=l,Object.freeze(s)}const o=$e(we),de=Se.cva(["relative inline-flex items-center justify-between gap-2 py-2","border border-input rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out","bg-background dark:bg-input/30","text-foreground","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0"],{variants:{size:{default:"h-9 px-3 text-field",sm:"h-8 px-2.5 text-label [&_svg:not([class*='size-'])]:size-4"}},defaultVariants:{size:"default"}});function _e({value:l,defaultValue:s,onValueChange:c,open:i,onOpenChange:z,options:v,collapseFullSelection:R}){const[A,V]=o.useState(s),S=l!==void 0,h=S?l:A,y=o.useMemo(()=>new Set(h),[h]),[d,x]=o.useState(!1),N=i!==void 0,f=N?i:d,[k,B]=o.useState(new Set),O=o.useRef(f);o.useEffect(()=>{f&&!O.current&&B(new Set(h)),O.current=f},[f,h]);const g=a=>{S||V(a),c?.(a)},P=a=>{if(y.has(a)){g(h.filter(p=>p!==a));return}const _=[...h,a];if(R){const p=v.filter(j=>!j.disabled&&j.count!==0),L=new Set(_);if(p.length>0&&p.every(j=>L.has(j.value))){g([]);return}}g(_)},w=a=>{N||x(a),z?.(a)},$=o.useMemo(()=>[...v.filter(a=>k.has(a.value)),...v.filter(a=>!k.has(a.value))],[v,k]);return{clear:()=>g([]),onOpenChange:w,open:f,orderedOptions:$,selectedSet:y,toggleOption:P,value:h}}function oe({checked:l}){return e.jsx("span",{"aria-hidden":"true",className:T.cn(Y.checkboxVariants(),"mt-0 flex items-center justify-center self-center"),"data-state":l?"checked":"unchecked",children:l?e.jsx(M.Check,{}):null})}function K({count:l}){return e.jsx("span",{className:"text-muted-foreground text-label-sm ml-auto tabular-nums",children:l})}const De="__all__",qe="__clear__",ue=o.forwardRef(({className:l,dataHook:s,label:c,options:i,value:z,defaultValue:v=[],onValueChange:R,open:A,onOpenChange:V,size:S="default",icon:h,maxVisibleLabels:y=1,allLabel:d,allIcon:x,allCount:N,searchThreshold:f=10,searchable:k,collapseFullSelection:B=!0,disabled:O=!1,clearLabel:g,summaryLabel:P,searchPlaceholder:w,emptyLabel:$,emptyDescription:a,clearSearchAriaLabel:_,presentation:p="menu",doneLabel:L,drawerDescription:j,trackingEl:he,trackingLabel:me,"aria-label":xe,...fe},ge)=>{const r=_e({collapseFullSelection:B,defaultValue:v,onOpenChange:V,onValueChange:R,open:A,options:i,value:z}),pe=ye.useIsBelowBreakpoint("md"),ve=p==="drawer"||p==="auto"&&pe,Z=o.useId(),[H,I]=o.useState(""),E=H.trim().toLowerCase(),b=E.length>0,U=b?r.orderedOptions.filter(t=>t.label.toLowerCase().includes(E)||t.value.toLowerCase().includes(E)):r.orderedOptions,ee=o.useRef(null),G=k??i.length>f,je=new Map(i.map(t=>[t.value,t.label])),D=r.value.flatMap(t=>{const n=je.get(t);return n===void 0?[]:[n]}),C=D.length,Q=r.value.length===0,q=N??(i.length>0&&i.every(t=>t.count!==void 0)?i.reduce((t,n)=>t+(n.count??0),0):void 0),W=Math.max(1,y);let F,te=!1;if(C===0)F=d??c,te=d===void 0;else if(C<=W)F=D.join(", ");else{const t={"{count}":String(C),"{labels}":D.slice(0,W).join(", "),"{rest}":String(C-W)};F=(P??"{labels} +{rest}").replace(/\{(count|labels|rest)\}/g,n=>t[n]??n)}const be=C>0?`${c}: ${D.join(", ")}`:d!==void 0?`${c}: ${d}`:c,Ce=r.value.map(t=>i.find(n=>n.value===t)).find(t=>t!==void 0),ne=h??(C>0?Ce?.icon:x)??void 0,se=t=>{t||I(""),r.onOpenChange(t)},re=e.jsxs("button",{ref:ge,"aria-label":xe??be,className:T.cn(de({size:S}),l),"data-hook":s,"data-slot":"multi-select-filter","data-tracking-el":he??"multi-select-filter","data-tracking-label":me,disabled:O,type:"button",...fe,children:[ne?e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center","data-hook":`${s}-icon`,children:ne}):null,e.jsx("span",{className:T.cn(te&&"text-muted-foreground"),"data-hook":`${s}-summary`,children:F}),e.jsx(M.ChevronDown,{"aria-hidden":"true",className:"text-muted-foreground"})]});if(ve){const t=`${Z}-all`;return e.jsxs(u.Drawer,{open:r.open,onOpenChange:se,children:[e.jsx(u.DrawerTrigger,{asChild:!0,children:re}),e.jsxs(u.DrawerContent,{dataHook:`${s}-drawer`,children:[e.jsxs(u.DrawerHeader,{children:[e.jsx(u.DrawerTitle,{children:c}),e.jsx(u.DrawerDescription,{className:"sr-only",children:j??"Picks apply as you make them."})]}),G?e.jsx(u.DrawerBody,{className:"shrink-0 pb-4",children:e.jsx(Ne.Input,{"aria-label":w??"Search options...",dataHook:`${s}-search`,placeholder:w??"Search options...",type:"search",value:H,onChange:n=>I(n.target.value)})}):null,e.jsxs(u.DrawerBody,{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pt-1 pb-2",children:[b&&U.length===0?e.jsxs("div",{className:"text-body-sm flex flex-col items-center gap-1 py-6 text-center","data-hook":`${s}-empty`,children:[e.jsx("span",{"aria-hidden":"true",className:T.cn(Oe.emptyChipStyles(),"mb-1"),children:e.jsx(M.SearchX,{})}),e.jsx("p",{children:$??"No options found."}),e.jsx("p",{className:"text-muted-foreground",children:a??"Try another search."})]}):e.jsxs(e.Fragment,{children:[d!==void 0&&!b?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y.Checkbox,{checked:Q,dataHook:`${s}-option-all`,id:t,onCheckedChange:r.clear}),e.jsxs(ie.Label,{className:"flex-1 gap-2",htmlFor:t,children:[x?e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center [&_svg]:size-4",children:x}):null,d]}),q!==void 0?e.jsx(K,{count:q}):null]}):null,e.jsx("div",{className:"grid grid-cols-2 gap-x-4 gap-y-3",children:U.map((n,X)=>{const ae=r.selectedSet.has(n.value),ke=n.disabled||n.count===0&&!ae,le=`${Z}-${X}`;return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y.Checkbox,{checked:ae,dataHook:`${s}-option-${n.value}`,disabled:ke,id:le,onCheckedChange:()=>r.toggleOption(n.value)}),e.jsxs(ie.Label,{className:"flex-1 gap-2",htmlFor:le,children:[n.icon?e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center [&_svg]:size-4","data-hook":`${s}-option-${n.value}-icon`,children:n.icon}):null,n.label]})]},n.value)})})]}),r.value.length>0&&!b?e.jsx(ce.Button,{dataHook:`${s}-clear`,variant:"ghost",onClick:r.clear,children:g??"Clear filters"}):null]}),e.jsx(u.DrawerFooter,{children:e.jsx(u.DrawerClose,{asChild:!0,children:e.jsx(ce.Button,{dataHook:`${s}-done`,children:L??"Done"})})})]})]})}return e.jsxs(J.Popover,{open:r.open,onOpenChange:se,children:[e.jsx(J.PopoverTrigger,{asChild:!0,children:re}),e.jsx(J.PopoverContent,{align:"start","aria-label":c,className:"w-max max-w-80 min-w-60 p-0",dataHook:`${s}-popover`,onOpenAutoFocus:t=>{G||(t.preventDefault(),ee.current?.focus())},children:e.jsxs(m.Command,{ref:ee,dataHook:`${s}-command`,shouldFilter:!1,children:[G?e.jsx(m.CommandInput,{autoFocus:!0,clearSearchAriaLabel:_??"Clear search",dataHook:`${s}-search`,placeholder:w??"Search options...",onValueChange:I}):null,e.jsxs(m.CommandList,{"aria-multiselectable":"true",children:[e.jsx(m.CommandEmpty,{description:a??"Try another search.",icon:e.jsx(M.SearchX,{}),children:$??"No options found."}),e.jsxs(m.CommandGroup,{children:[d!==void 0&&!b?e.jsxs(m.CommandItem,{"aria-checked":Q,dataHook:`${s}-option-all`,value:De,onSelect:r.clear,children:[e.jsx(oe,{checked:Q}),x?e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center [&_svg]:size-4",children:x}):null,d,q!==void 0?e.jsx(K,{count:q}):null]}):null,U.map(t=>{const n=r.selectedSet.has(t.value),X=t.disabled||t.count===0&&!n;return e.jsxs(m.CommandItem,{"aria-checked":n,dataHook:`${s}-option-${t.value}`,disabled:X,value:t.value,onSelect:()=>r.toggleOption(t.value),children:[e.jsx(oe,{checked:n}),t.icon?e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 items-center [&_svg]:size-4","data-hook":`${s}-option-${t.value}-icon`,children:t.icon}):null,t.label,t.count!==void 0?e.jsx(K,{count:t.count}):null]},t.value)})]}),r.value.length>0&&!b?e.jsx(m.CommandGroup,{className:"border-border border-t",children:e.jsx(m.CommandItem,{className:"justify-center",dataHook:`${s}-clear`,value:qe,onSelect:r.clear,children:g??"Clear filters"})}):null]})]})})]})});ue.displayName="MultiSelectFilter";exports.MultiSelectFilter=ue;exports.multiSelectFilterTriggerVariants=de;
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const multiSelectFilterTriggerVariants: (props?: ({
|
|
4
|
+
size?: "default" | "sm" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
/** One selectable option of a multi-select filter. */
|
|
7
|
+
interface MultiSelectFilterOption {
|
|
8
|
+
/** Unique value of the option. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Visible label of the option. */
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Result count for this option, shown beside the label in the menu (the
|
|
14
|
+
* drawer's two-column rows carry only the All total). A count of 0
|
|
15
|
+
* disables the option in both — disabled, never hidden, so the dimension
|
|
16
|
+
* keeps its full shape.
|
|
17
|
+
*/
|
|
18
|
+
count?: number;
|
|
19
|
+
/** Disables the option explicitly. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The option's own glyph (a search-engine logo, a rating star), 16px.
|
|
23
|
+
* Shown before the label in the menu and the drawer; the trigger shows the
|
|
24
|
+
* first pick's glyph when no `icon` is set.
|
|
25
|
+
*/
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
interface MultiSelectFilterProps extends Omit<React.ComponentPropsWithoutRef<"button">, "value" | "defaultValue" | "onChange" | "children">, VariantProps<typeof multiSelectFilterTriggerVariants> {
|
|
29
|
+
/**
|
|
30
|
+
* Data hook for automated testing (REQUIRED). Every part of the menu
|
|
31
|
+
* derives its own hook from it (`-popover`, `-search`, `-option-all`,
|
|
32
|
+
* `-option-<value>`, `-clear`, `-summary`, `-icon`).
|
|
33
|
+
* @example "locations-status-filter"
|
|
34
|
+
*/
|
|
35
|
+
dataHook: string;
|
|
36
|
+
/**
|
|
37
|
+
* The dimension's name — use the product's words ("Status", "Source"),
|
|
38
|
+
* never an internal field name. Always the start of the accessible name;
|
|
39
|
+
* also the trigger's muted placeholder at zero when there is no `allLabel`.
|
|
40
|
+
*/
|
|
41
|
+
label: string;
|
|
42
|
+
/** The selectable options, in the dimension's own order. */
|
|
43
|
+
options: readonly MultiSelectFilterOption[];
|
|
44
|
+
/** Controlled selected values. Values combine as OR. */
|
|
45
|
+
value?: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* Initial selection for uncontrolled mode.
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
defaultValue?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Callback on every pick (the per-filter commit model: reflect
|
|
53
|
+
* immediately on client data; defer expensive refetches to
|
|
54
|
+
* `onOpenChange(false)`).
|
|
55
|
+
* @param value - The full selection after the pick
|
|
56
|
+
*/
|
|
57
|
+
onValueChange?: (value: string[]) => void;
|
|
58
|
+
/** Controlled open state of the menu. */
|
|
59
|
+
open?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Callback when the menu opens or closes — `false` is the moment to run
|
|
62
|
+
* an expensive refetch for everything picked while it was open.
|
|
63
|
+
*/
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Fixed glyph leading the trigger — the dimension's own icon (a funnel, a
|
|
67
|
+
* calendar), 16px. Without it the trigger follows the selection: `allIcon`
|
|
68
|
+
* at zero, then the first pick's `option.icon`. Hidden from assistive
|
|
69
|
+
* tech; the accessible name comes from `label` and the picks.
|
|
70
|
+
*/
|
|
71
|
+
icon?: React.ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* How many picked labels to spell out before collapsing into
|
|
74
|
+
* `summaryLabel` ("Google +2" at 1, "London, Brighton +1" at 2). Values
|
|
75
|
+
* below 1 are treated as 1.
|
|
76
|
+
* @default 1
|
|
77
|
+
*/
|
|
78
|
+
maxVisibleLabels?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Label of the leading reset row, e.g. "All sources". Omit to hide the
|
|
81
|
+
* row. Checked when nothing is picked; picking it clears the selection.
|
|
82
|
+
* Also the trigger's text at zero.
|
|
83
|
+
*/
|
|
84
|
+
allLabel?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Glyph of the All row, and of the trigger while nothing is picked (when
|
|
87
|
+
* no `icon` is set) — the dimension's "everything" mark, e.g. a globe.
|
|
88
|
+
*/
|
|
89
|
+
allIcon?: React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Total beside the All row. Defaults to the sum of the options' counts
|
|
92
|
+
* when every option has one — per-option counts leave out their own
|
|
93
|
+
* filter, so together they are the unfiltered total.
|
|
94
|
+
*/
|
|
95
|
+
allCount?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Show a search input inside the menu once the option list grows past
|
|
98
|
+
* this many options. Scanning stops working past ~10–15.
|
|
99
|
+
* @default 10
|
|
100
|
+
*/
|
|
101
|
+
searchThreshold?: number;
|
|
102
|
+
/** Force the search input on or off, overriding `searchThreshold`. */
|
|
103
|
+
searchable?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* When a pick completes the set — every option that can be picked (not
|
|
106
|
+
* disabled, count not 0) is ticked — the selection collapses to `[]`,
|
|
107
|
+
* i.e. "All": the same records, read as no filter instead of "Google +3".
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
collapseFullSelection?: boolean;
|
|
111
|
+
/** Disables the trigger. */
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Label of the clear action inside the menu.
|
|
115
|
+
* @default "Clear filters"
|
|
116
|
+
*/
|
|
117
|
+
clearLabel?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Trigger summary once more values are picked than `maxVisibleLabels`.
|
|
120
|
+
* Placeholders: `{labels}` — the first `maxVisibleLabels` labels,
|
|
121
|
+
* `{rest}` — the picks beyond them, `{count}` — every pick.
|
|
122
|
+
* `"{count} selected"` reads "3 selected" instead.
|
|
123
|
+
* @default "{labels} +{rest}"
|
|
124
|
+
*/
|
|
125
|
+
summaryLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Placeholder of the search input inside the menu.
|
|
128
|
+
* @default "Search options..."
|
|
129
|
+
*/
|
|
130
|
+
searchPlaceholder?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Message when the search matches no options.
|
|
133
|
+
* @default "No options found."
|
|
134
|
+
*/
|
|
135
|
+
emptyLabel?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The quiet hint under the no-match message.
|
|
138
|
+
* @default "Try another search."
|
|
139
|
+
*/
|
|
140
|
+
emptyDescription?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Accessible label of the menu search input's clear button (the drawer's
|
|
143
|
+
* search field is a plain Input without one).
|
|
144
|
+
* @default "Clear search"
|
|
145
|
+
*/
|
|
146
|
+
clearSearchAriaLabel?: string;
|
|
147
|
+
/**
|
|
148
|
+
* How the options open: the Popover + Command `menu`, a bottom `drawer`
|
|
149
|
+
* (the phone form: Checkbox rows in two columns, Clear, Done), or `auto`
|
|
150
|
+
* — the menu from the `md` breakpoint up and the drawer below it.
|
|
151
|
+
* @default "menu"
|
|
152
|
+
*/
|
|
153
|
+
presentation?: "menu" | "drawer" | "auto";
|
|
154
|
+
/**
|
|
155
|
+
* Label of the drawer's Done button — it only closes; picks apply at once.
|
|
156
|
+
* @default "Done"
|
|
157
|
+
*/
|
|
158
|
+
doneLabel?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Screen-reader description of the drawer (the Drawer contract needs a
|
|
161
|
+
* title and a description; the title is `label`).
|
|
162
|
+
* @default "Picks apply as you make them."
|
|
163
|
+
*/
|
|
164
|
+
drawerDescription?: string;
|
|
165
|
+
/** Analytics element identifier. @default "multi-select-filter" */
|
|
166
|
+
trackingEl?: string;
|
|
167
|
+
/** Analytics label */
|
|
168
|
+
trackingLabel?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Multi-select filter for one dimension: a field-look trigger that reads its
|
|
172
|
+
* picks, over a Popover + Command menu that stays open across picks. Values
|
|
173
|
+
* combine as OR.
|
|
174
|
+
*/
|
|
175
|
+
declare const MultiSelectFilter: React.ForwardRefExoticComponent<MultiSelectFilterProps & React.RefAttributes<HTMLButtonElement>>;
|
|
176
|
+
export { MultiSelectFilter, multiSelectFilterTriggerVariants };
|
|
177
|
+
export type { MultiSelectFilterOption, MultiSelectFilterProps };
|
|
178
|
+
//# sourceMappingURL=multi-select-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select-filter.d.ts","sourceRoot":"","sources":["../../src/components/multi-select-filter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAkGlE,QAAA,MAAM,gCAAgC;;8EA2CrC,CAAC;AAMF,sDAAsD;AACtD,UAAU,uBAAuB;IAC/B,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,UAAU,sBACR,SACE,IAAI,CACF,KAAK,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EACxC,OAAO,GAAG,cA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