@brightlocal/ui-components 3.4.0 → 3.5.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/AI_USAGE.md +22 -3
- package/README.md +177 -109
- package/component-meta.json +1061 -102
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +13 -2
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +4 -3
- package/dist/banner.cjs +1 -1
- package/dist/banner.d.ts +47 -11
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +156 -79
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +40 -5
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +59 -52
- package/dist/blocks/input-list.d.ts +1 -0
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +12 -6
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +64 -63
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +47 -43
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +12 -0
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +115 -97
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -10
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +281 -296
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +430 -343
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -2
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +212 -207
- package/dist/count-indicator.cjs +1 -0
- package/dist/count-indicator.d.ts +85 -0
- package/dist/count-indicator.d.ts.map +1 -0
- package/dist/count-indicator.js +72 -0
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +101 -11
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +593 -523
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.d.ts +26 -3
- package/dist/dialog.d.ts.map +1 -1
- package/dist/dialog.js +62 -47
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts +8 -4
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +37 -38
- package/dist/file-upload.cjs +1 -0
- package/dist/file-upload.d.ts +546 -0
- package/dist/file-upload.d.ts.map +1 -0
- package/dist/file-upload.js +1103 -0
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +7 -2
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +52 -52
- package/dist/hooks/use-file-dropzone.cjs +1 -0
- package/dist/hooks/use-file-dropzone.d.ts +75 -0
- package/dist/hooks/use-file-dropzone.d.ts.map +1 -0
- package/dist/hooks/use-file-dropzone.js +133 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts +29 -16
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +153 -36
- 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 +676 -640
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.d.ts +30 -1
- package/dist/input-chip.d.ts.map +1 -1
- package/dist/input-chip.js +131 -115
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +37 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +131 -114
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +6 -6
- package/dist/lib/empty-canvas.cjs +1 -1
- package/dist/lib/empty-canvas.d.ts +27 -1
- package/dist/lib/empty-canvas.d.ts.map +1 -1
- package/dist/lib/empty-canvas.js +27 -23
- package/dist/lib/empty-chip.cjs +1 -1
- package/dist/lib/empty-chip.d.ts +19 -2
- package/dist/lib/empty-chip.d.ts.map +1 -1
- package/dist/lib/empty-chip.js +14 -9
- package/dist/lib/field-aria.cjs +1 -1
- package/dist/lib/field-aria.d.ts +4 -4
- package/dist/lib/field-aria.d.ts.map +1 -1
- package/dist/lib/field-aria.js +7 -5
- package/dist/lib/media-viewer-content.cjs +1 -1
- package/dist/lib/media-viewer-content.js +1 -1
- package/dist/lib/table-internal.cjs +1 -1
- package/dist/lib/table-internal.d.ts +19 -0
- package/dist/lib/table-internal.d.ts.map +1 -1
- package/dist/lib/table-internal.js +22 -7
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts +13 -0
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +103 -82
- package/dist/logo-mark.cjs +1 -1
- package/dist/logo-mark.d.ts +18 -2
- package/dist/logo-mark.d.ts.map +1 -1
- package/dist/logo-mark.js +159 -79
- package/dist/media-empty.cjs +1 -1
- package/dist/media-empty.d.ts +50 -7
- package/dist/media-empty.d.ts.map +1 -1
- package/dist/media-empty.js +14 -13
- package/dist/media-viewer.cjs +1 -1
- package/dist/media-viewer.js +6 -6
- package/dist/multi-select-filter.cjs +1 -1
- package/dist/multi-select-filter.d.ts.map +1 -1
- package/dist/multi-select-filter.js +92 -101
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +11 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +17 -17
- package/dist/relative-date.d.ts +6 -0
- package/dist/relative-date.d.ts.map +1 -1
- package/dist/resizable.d.ts +1 -1
- package/dist/result-count.cjs +1 -1
- package/dist/result-count.d.ts +13 -16
- package/dist/result-count.d.ts.map +1 -1
- package/dist/result-count.js +24 -33
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +22 -3
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +152 -125
- package/dist/single-select-filter.cjs +1 -1
- package/dist/single-select-filter.d.ts.map +1 -1
- package/dist/single-select-filter.js +67 -76
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +77 -76
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +39 -3
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +127 -76
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.d.ts +34 -0
- package/dist/textarea.d.ts.map +1 -1
- package/dist/textarea.js +115 -19
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +137 -131
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +6 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +14 -13
- package/package.json +3 -4
- package/src/blocks/empty-state.tsx +108 -48
- package/src/blocks/input-list.tsx +1 -0
- package/src/blocks/sidebar.tsx +39 -16
- package/src/components/alert-dialog.tsx +18 -2
- package/src/components/banner.tsx +247 -68
- package/src/components/button.tsx +27 -10
- package/src/components/card.tsx +89 -7
- package/src/components/chart.tsx +47 -67
- package/src/components/combobox.tsx +221 -12
- package/src/components/command.tsx +83 -37
- package/src/components/count-indicator.tsx +188 -0
- package/src/components/data-table.tsx +506 -159
- package/src/components/dialog.tsx +74 -5
- package/src/components/drawer.tsx +52 -32
- package/src/components/file-upload.tsx +2574 -0
- package/src/components/global-layout.tsx +18 -5
- package/src/components/hover-card.tsx +395 -65
- package/src/components/input-chip.tsx +67 -2
- package/src/components/input-group.tsx +89 -6
- package/src/components/list.tsx +40 -3
- package/src/components/logo-mark.tsx +109 -25
- package/src/components/media-empty.tsx +62 -7
- package/src/components/multi-select-filter.tsx +9 -16
- package/src/components/pagination.tsx +15 -2
- package/src/components/relative-date.tsx +6 -0
- package/src/components/result-count.tsx +27 -54
- package/src/components/sheet.tsx +86 -8
- package/src/components/single-select-filter.tsx +9 -16
- package/src/components/table.tsx +16 -1
- package/src/components/tabs.tsx +223 -41
- package/src/components/textarea.tsx +271 -4
- package/src/components/tooltip.tsx +29 -2
- package/src/components/typography-text.tsx +7 -2
- package/src/hooks/use-file-dropzone.ts +325 -0
- package/src/index.ts +3 -0
- package/src/lib/empty-canvas.tsx +47 -20
- package/src/lib/empty-chip.tsx +38 -3
- package/src/lib/field-aria.tsx +11 -6
- package/src/lib/table-internal.ts +38 -0
package/dist/input-group.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { CountIndicator as R } from "./count-indicator.js";
|
|
3
|
+
import { Input as N } from "./input.js";
|
|
4
|
+
import * as t from "react";
|
|
4
5
|
import { X as V } from "@brightlocal/icons";
|
|
5
|
-
import { cn as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { Slot as
|
|
8
|
-
import { cva as
|
|
9
|
-
var
|
|
6
|
+
import { cn as g } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
8
|
+
import { Slot as S } from "@radix-ui/react-slot";
|
|
9
|
+
import { cva as k } from "class-variance-authority";
|
|
10
|
+
var x = t.createContext(null), E = k("relative flex w-full items-center rounded-sm border border-input bg-background transition-[color,background-color,border-color,box-shadow] duration-fast ease-out has-[input:focus-visible]:border-ring has-[input:focus-visible]:shadow-default has-[:disabled]:opacity-50 has-[[data-slot=count-indicator][data-state=over]]:border-destructive-40 has-[[data-slot=count-indicator][data-state=over]]:has-[input:focus-visible]:border-destructive-40 has-[[data-slot=count-indicator][data-state=over]]:has-[input:focus-visible]:shadow-destructive", {
|
|
10
11
|
variants: {
|
|
11
12
|
size: {
|
|
12
13
|
default: "h-9",
|
|
@@ -22,112 +23,127 @@ var k = e.createContext(null), E = x("relative flex w-full items-center rounded-
|
|
|
22
23
|
size: "default",
|
|
23
24
|
error: !1
|
|
24
25
|
}
|
|
25
|
-
}),
|
|
26
|
-
const [
|
|
26
|
+
}), z = t.forwardRef(({ className: i, size: r, error: l, dataHook: a, trackingEl: u, trackingLabel: d, ...h }, b) => {
|
|
27
|
+
const [s, c] = t.useState({
|
|
27
28
|
hasValue: !1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
length: 0,
|
|
30
|
+
disabled: !1,
|
|
31
|
+
ready: !1
|
|
32
|
+
}), f = t.useRef(null), e = t.useCallback(() => {
|
|
33
|
+
const o = f.current, v = {
|
|
34
|
+
hasValue: !!o && o.value.length > 0,
|
|
35
|
+
length: o ? o.value.length : 0,
|
|
36
|
+
disabled: !!o && (o.disabled || o.readOnly),
|
|
37
|
+
ready: !0
|
|
33
38
|
};
|
|
34
|
-
|
|
35
|
-
}, []),
|
|
36
|
-
|
|
37
|
-
}, []),
|
|
38
|
-
|
|
39
|
-
}, []),
|
|
40
|
-
|
|
41
|
-
}, []),
|
|
42
|
-
inputState:
|
|
43
|
-
syncInputState:
|
|
44
|
-
registerInput:
|
|
45
|
-
registerClearHandler:
|
|
46
|
-
clearInput:
|
|
47
|
-
inputRef:
|
|
39
|
+
c((m) => m.hasValue === v.hasValue && m.length === v.length && m.disabled === v.disabled && m.ready === v.ready ? m : v);
|
|
40
|
+
}, []), n = t.useCallback((o) => {
|
|
41
|
+
f.current = o;
|
|
42
|
+
}, []), I = t.useRef(null), C = t.useCallback((o) => {
|
|
43
|
+
I.current = o;
|
|
44
|
+
}, []), y = t.useCallback((o) => {
|
|
45
|
+
I.current?.(o);
|
|
46
|
+
}, []), G = t.useMemo(() => ({
|
|
47
|
+
inputState: s,
|
|
48
|
+
syncInputState: e,
|
|
49
|
+
registerInput: n,
|
|
50
|
+
registerClearHandler: C,
|
|
51
|
+
clearInput: y,
|
|
52
|
+
inputRef: f
|
|
48
53
|
}), [
|
|
54
|
+
s,
|
|
55
|
+
e,
|
|
49
56
|
n,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
w,
|
|
53
|
-
C
|
|
57
|
+
C,
|
|
58
|
+
y
|
|
54
59
|
]);
|
|
55
|
-
return /* @__PURE__ */
|
|
56
|
-
value:
|
|
57
|
-
children: /* @__PURE__ */
|
|
58
|
-
ref:
|
|
59
|
-
className:
|
|
60
|
-
size:
|
|
60
|
+
return /* @__PURE__ */ p(x.Provider, {
|
|
61
|
+
value: G,
|
|
62
|
+
children: /* @__PURE__ */ p("div", {
|
|
63
|
+
ref: b,
|
|
64
|
+
className: g(E({
|
|
65
|
+
size: r,
|
|
61
66
|
error: l
|
|
62
|
-
}),
|
|
63
|
-
"data-hook":
|
|
67
|
+
}), i),
|
|
68
|
+
"data-hook": a,
|
|
64
69
|
"data-slot": "input-group",
|
|
65
|
-
"data-tracking-el":
|
|
66
|
-
"data-tracking-label":
|
|
67
|
-
...
|
|
70
|
+
"data-tracking-el": u,
|
|
71
|
+
"data-tracking-label": d,
|
|
72
|
+
...h
|
|
68
73
|
})
|
|
69
74
|
});
|
|
70
75
|
});
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
}, [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}),
|
|
79
|
-
const
|
|
80
|
-
if (!
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
}, [
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
89
|
-
|
|
90
|
-
const
|
|
76
|
+
z.displayName = "InputGroup";
|
|
77
|
+
var H = t.forwardRef(({ className: i, onChange: r, ...l }, a) => {
|
|
78
|
+
const u = t.useContext(x), d = t.useRef(null), h = u?.registerInput, b = t.useCallback((e) => {
|
|
79
|
+
d.current = e, h?.(e), typeof a == "function" ? a(e) : a && (a.current = e);
|
|
80
|
+
}, [h, a]), s = u?.syncInputState;
|
|
81
|
+
t.useEffect(() => {
|
|
82
|
+
s?.();
|
|
83
|
+
}), t.useEffect(() => {
|
|
84
|
+
const e = d.current?.form;
|
|
85
|
+
if (!e || !s) return;
|
|
86
|
+
const n = () => queueMicrotask(s);
|
|
87
|
+
return e.addEventListener("reset", n), () => e.removeEventListener("reset", n);
|
|
88
|
+
}, [s]);
|
|
89
|
+
const c = u?.registerClearHandler;
|
|
90
|
+
t.useEffect(() => {
|
|
91
|
+
c?.((e) => {
|
|
92
|
+
const n = d.current;
|
|
93
|
+
if (!n) return;
|
|
94
|
+
n.value = "";
|
|
95
|
+
const I = Object.create(e, {
|
|
91
96
|
target: {
|
|
92
|
-
value:
|
|
97
|
+
value: n,
|
|
93
98
|
enumerable: !0
|
|
94
99
|
},
|
|
95
100
|
currentTarget: {
|
|
96
|
-
value:
|
|
101
|
+
value: n,
|
|
97
102
|
enumerable: !0
|
|
98
103
|
}
|
|
99
104
|
});
|
|
100
|
-
|
|
105
|
+
r?.(I), s?.(), n.focus();
|
|
101
106
|
});
|
|
102
|
-
}),
|
|
103
|
-
const
|
|
104
|
-
|
|
107
|
+
}), t.useEffect(() => () => c?.(null), [c]);
|
|
108
|
+
const f = (e) => {
|
|
109
|
+
s?.(), r?.(e);
|
|
105
110
|
};
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
ref:
|
|
108
|
-
className:
|
|
111
|
+
return /* @__PURE__ */ p(N, {
|
|
112
|
+
ref: b,
|
|
113
|
+
className: g("border-0 focus-visible:border-0 focus-visible:shadow-[none]", "h-full", i),
|
|
109
114
|
dataHook: "input-group-input",
|
|
110
|
-
onChange:
|
|
115
|
+
onChange: f,
|
|
111
116
|
...l
|
|
112
117
|
});
|
|
113
118
|
});
|
|
114
|
-
|
|
115
|
-
var
|
|
119
|
+
H.displayName = "InputGroupInput";
|
|
120
|
+
var j = k("flex shrink-0 items-center text-muted-foreground", {
|
|
116
121
|
variants: { align: {
|
|
117
|
-
"inline-start": "",
|
|
118
|
-
"inline-end": "ml-auto",
|
|
122
|
+
"inline-start": ["pl-(--input-group-addon-inset) [--input-group-addon-inset:--spacing(3)]", "has-[>button,>[data-slot=input-group-button]]:[--input-group-addon-inset:--spacing(1)]"],
|
|
123
|
+
"inline-end": ["ml-auto pr-(--input-group-addon-inset) [--input-group-addon-inset:--spacing(3)]", "has-[>button,>[data-slot=input-group-button]]:[--input-group-addon-inset:--spacing(1)]"],
|
|
119
124
|
"block-start": "self-start",
|
|
120
125
|
"block-end": "self-end"
|
|
121
126
|
} },
|
|
122
127
|
defaultVariants: { align: "inline-start" }
|
|
123
|
-
}),
|
|
124
|
-
ref:
|
|
125
|
-
className:
|
|
128
|
+
}), A = t.forwardRef(({ className: i, align: r, ...l }, a) => /* @__PURE__ */ p("div", {
|
|
129
|
+
ref: a,
|
|
130
|
+
className: g(j({ align: r }), i),
|
|
126
131
|
"data-slot": "input-group-addon",
|
|
127
132
|
...l
|
|
128
133
|
}));
|
|
129
|
-
|
|
130
|
-
var
|
|
134
|
+
A.displayName = "InputGroupAddon";
|
|
135
|
+
var B = t.forwardRef(({ className: i, count: r, ...l }, a) => {
|
|
136
|
+
const u = t.useContext(x);
|
|
137
|
+
return /* @__PURE__ */ p(R, {
|
|
138
|
+
ref: a,
|
|
139
|
+
className: g("pr-3", i),
|
|
140
|
+
count: r ?? u?.inputState.length ?? 0,
|
|
141
|
+
ready: r !== void 0 || (u?.inputState.ready ?? !0),
|
|
142
|
+
...l
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
B.displayName = "InputGroupCount";
|
|
146
|
+
var L = k([
|
|
131
147
|
"inline-flex items-center justify-center gap-2",
|
|
132
148
|
"text-label transition-colors duration-fast ease-out",
|
|
133
149
|
"outline-none focus-visible:shadow-default rounded-sm",
|
|
@@ -154,47 +170,48 @@ var A = x([
|
|
|
154
170
|
variant: "default",
|
|
155
171
|
size: "default"
|
|
156
172
|
}
|
|
157
|
-
}),
|
|
158
|
-
ref:
|
|
159
|
-
className:
|
|
160
|
-
variant:
|
|
173
|
+
}), w = t.forwardRef(({ className: i, variant: r, size: l, asChild: a = !1, ...u }, d) => /* @__PURE__ */ p(a ? S : "button", {
|
|
174
|
+
ref: d,
|
|
175
|
+
className: g(L({
|
|
176
|
+
variant: r,
|
|
161
177
|
size: l,
|
|
162
|
-
className:
|
|
178
|
+
className: i
|
|
163
179
|
})),
|
|
164
180
|
"data-slot": "input-group-button",
|
|
165
|
-
type:
|
|
166
|
-
...
|
|
181
|
+
type: a ? void 0 : "button",
|
|
182
|
+
...u
|
|
167
183
|
}));
|
|
168
|
-
|
|
169
|
-
var
|
|
170
|
-
const
|
|
171
|
-
if (!
|
|
172
|
-
const { inputState:
|
|
173
|
-
if (!
|
|
174
|
-
const
|
|
175
|
-
|
|
184
|
+
w.displayName = "InputGroupButton";
|
|
185
|
+
var M = t.forwardRef(({ className: i, clearSearchAriaLabel: r, onClear: l, dataHook: a, trackingEl: u, trackingLabel: d, ...h }, b) => {
|
|
186
|
+
const s = t.useContext(x);
|
|
187
|
+
if (!s) throw new Error("InputGroupClear must be used within <InputGroup>");
|
|
188
|
+
const { inputState: c, clearInput: f } = s;
|
|
189
|
+
if (!c.hasValue || c.disabled) return null;
|
|
190
|
+
const e = (n) => {
|
|
191
|
+
f(n), l?.();
|
|
176
192
|
};
|
|
177
|
-
return /* @__PURE__ */
|
|
178
|
-
ref:
|
|
179
|
-
"aria-label":
|
|
180
|
-
className:
|
|
181
|
-
"data-hook":
|
|
193
|
+
return /* @__PURE__ */ p(w, {
|
|
194
|
+
ref: b,
|
|
195
|
+
"aria-label": r ?? "Clear search",
|
|
196
|
+
className: g("mr-1 ml-auto shrink-0 rounded-full", i),
|
|
197
|
+
"data-hook": a ?? "input-group-clear",
|
|
182
198
|
"data-slot": "input-group-clear",
|
|
183
|
-
"data-tracking-el":
|
|
184
|
-
"data-tracking-label":
|
|
199
|
+
"data-tracking-el": u,
|
|
200
|
+
"data-tracking-label": d,
|
|
185
201
|
size: "icon-xs",
|
|
186
|
-
onClick:
|
|
187
|
-
...
|
|
188
|
-
children: /* @__PURE__ */
|
|
202
|
+
onClick: e,
|
|
203
|
+
...h,
|
|
204
|
+
children: /* @__PURE__ */ p(V, { size: 14 })
|
|
189
205
|
});
|
|
190
206
|
});
|
|
191
|
-
|
|
207
|
+
M.displayName = "InputGroupClear";
|
|
192
208
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
209
|
+
z as InputGroup,
|
|
210
|
+
A as InputGroupAddon,
|
|
211
|
+
w as InputGroupButton,
|
|
212
|
+
M as InputGroupClear,
|
|
213
|
+
B as InputGroupCount,
|
|
214
|
+
H as InputGroupInput,
|
|
215
|
+
L as inputGroupButtonVariants,
|
|
199
216
|
E as inputGroupVariants
|
|
200
217
|
};
|
package/dist/input-password.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const M=require("./_virtual/_rolldown/runtime.cjs");let o=require("react");o=M.__toESM(o,1);let _=require("@brightlocal/icons"),k=require("@brightlocal/ui-components/lib/utils"),s=require("react/jsx-runtime"),
|
|
1
|
+
"use client";const M=require("./_virtual/_rolldown/runtime.cjs");let o=require("react");o=M.__toESM(o,1);let _=require("@brightlocal/icons"),k=require("@brightlocal/ui-components/lib/utils"),s=require("react/jsx-runtime"),O=require("@brightlocal/ui-components/progress"),h=require("@brightlocal/ui-components/input-group");var L={meter:{label:"Meter",value:0,color:"bg-score-strong"},weak:{label:"Weak",value:25,color:"bg-score-strong"},ok:{label:"Ok",value:50,color:"bg-score-strong"},good:{label:"Good",value:75,color:"bg-score-strong"},great:{label:"Great",value:100,color:"bg-score-strong"}};function H(e){if(!e||e.length===0)return"meter";if(e.length<12)return"weak";let t=0;return e.length>=16&&(t+=1),/[a-z]/.test(e)&&(t+=1),/[A-Z]/.test(e)&&(t+=1),/[0-9]/.test(e)&&(t+=1),/[^a-zA-Z0-9]/.test(e)&&(t+=1),t<=1?"ok":t<=3?"good":"great"}var R=o.createContext(null);function j(){const e=o.useContext(R);if(!e)throw new Error("InputPassword compound components must be used within InputPassword");return e}function E({children:e,dataHook:t,trackingEl:a,trackingLabel:u,disabled:l,value:r,onChange:n,onStrengthChange:i,strengthLevels:g,calculateStrength:p,error:c,id:w,className:f}){const[b,m]=o.useState(!1),[v,S]=o.useState(""),[I,P]=o.useState("meter"),$=o.useId(),y=w||$,x=r!==void 0?r:v,N=g??L,T=p??H,C=o.useCallback(d=>{r===void 0&&S(d),n?.(d)},[r,n]),G=o.useCallback(()=>{m(d=>!d)},[]);o.useEffect(()=>{const d=setTimeout(()=>{const q=T(x);P(q),i?.(q)},180);return()=>clearTimeout(d)},[x,T,i]);const z=o.useMemo(()=>({showPassword:b,setShowPassword:m,toggleVisibility:G,password:x,setPassword:C,strength:I,strengthLevels:N,disabled:l,dataHook:t,trackingEl:a,trackingLabel:u,inputId:y,error:c}),[b,G,x,C,I,N,l,t,a,u,y,c]);return(0,s.jsx)(R.Provider,{value:z,children:(0,s.jsx)("div",{className:(0,k.cn)("w-full",f),"data-hook":t,"data-slot":"input-password",children:e})})}E.displayName="InputPassword";var B=E,V=o.forwardRef(({className:e,groupClassName:t,onChange:a,showLabel:u,hideLabel:l,...r},n)=>{const{showPassword:i,toggleVisibility:g,password:p,setPassword:c,disabled:w,dataHook:f,trackingEl:b,trackingLabel:m,inputId:v,error:S}=j(),I=P=>{c(P.target.value),a?.(P)};return(0,s.jsxs)(h.InputGroup,{className:t,dataHook:f,error:S,children:[(0,s.jsx)(h.InputGroupInput,{ref:n,className:e,disabled:w,id:v,trackingEl:b,trackingLabel:m,type:i?"text":"password",value:p,onChange:I,...r}),(0,s.jsx)(h.InputGroupAddon,{align:"inline-end",children:(0,s.jsx)(h.InputGroupButton,{"aria-label":i?l??"Hide password":u??"Show password","data-hook":`${f}-toggle`,disabled:w,size:"icon-sm",variant:"ghost",onClick:g,children:i?(0,s.jsx)(_.EyeOff,{}):(0,s.jsx)(_.Eye,{})})})]})});V.displayName="InputPasswordField";var A=o.forwardRef(({className:e,showLabel:t,hideLabel:a,size:u="icon",variant:l="ghost",...r},n)=>{const{showPassword:i,toggleVisibility:g,disabled:p,dataHook:c}=j();return(0,s.jsx)(h.InputGroupButton,{ref:n,"aria-label":i?a??"Hide password":t??"Show password",className:e,"data-hook":`${c}-toggle`,disabled:p,size:u,variant:l,onClick:g,...r,children:i?(0,s.jsx)(_.EyeOff,{}):(0,s.jsx)(_.Eye,{})})});A.displayName="InputPasswordToggle";function F({className:e,showLabel:t=!0}){const{strength:a,strengthLevels:u,dataHook:l,disabled:r}=j(),n=u[a]??{label:a,value:0,color:"bg-muted"};return(0,s.jsx)("div",{className:(0,k.cn)("mt-1 space-y-2",e),children:(0,s.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2",r&&"opacity-50"),children:[(0,s.jsx)(O.Progress,{className:"h-2 flex-1",dataHook:`${l}-strength-progress`,indicatorClassName:n.color,value:n.value}),t&&(0,s.jsx)("span",{className:"text-foreground text-label w-10 shrink-0 text-right whitespace-nowrap","data-hook":`${l}-strength-label`,children:n.label})]})})}F.displayName="InputPasswordStrength";exports.DEFAULT_STRENGTH_LEVELS=L;exports.InputPassword=E;exports.InputPasswordField=V;exports.InputPasswordRoot=B;exports.InputPasswordStrength=F;exports.InputPasswordToggle=A;exports.calculatePasswordStrength=H;
|
package/dist/input-password.js
CHANGED
|
@@ -3,8 +3,8 @@ import * as s from "react";
|
|
|
3
3
|
import { Eye as H, EyeOff as L } from "@brightlocal/icons";
|
|
4
4
|
import { cn as x } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
import { jsx as o, jsxs as R } from "react/jsx-runtime";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Progress as j } from "@brightlocal/ui-components/progress";
|
|
7
|
+
import { InputGroup as M, InputGroupAddon as O, InputGroupButton as V, InputGroupInput as Z } from "@brightlocal/ui-components/input-group";
|
|
8
8
|
var _ = {
|
|
9
9
|
meter: {
|
|
10
10
|
label: "Meter",
|
|
@@ -102,11 +102,11 @@ function $({ children: t, dataHook: e, trackingEl: n, trackingLabel: d, disabled
|
|
|
102
102
|
$.displayName = "InputPassword";
|
|
103
103
|
var Y = $, D = s.forwardRef(({ className: t, groupClassName: e, onChange: n, showLabel: d, hideLabel: l, ...r }, a) => {
|
|
104
104
|
const { showPassword: i, toggleVisibility: g, password: p, setPassword: c, disabled: h, dataHook: w, trackingEl: m, trackingLabel: f, inputId: P, error: v } = S();
|
|
105
|
-
return /* @__PURE__ */ R(
|
|
105
|
+
return /* @__PURE__ */ R(M, {
|
|
106
106
|
className: e,
|
|
107
107
|
dataHook: w,
|
|
108
108
|
error: v,
|
|
109
|
-
children: [/* @__PURE__ */ o(
|
|
109
|
+
children: [/* @__PURE__ */ o(Z, {
|
|
110
110
|
ref: a,
|
|
111
111
|
className: t,
|
|
112
112
|
disabled: h,
|
|
@@ -119,7 +119,7 @@ var Y = $, D = s.forwardRef(({ className: t, groupClassName: e, onChange: n, sho
|
|
|
119
119
|
c(b.target.value), n?.(b);
|
|
120
120
|
},
|
|
121
121
|
...r
|
|
122
|
-
}), /* @__PURE__ */ o(
|
|
122
|
+
}), /* @__PURE__ */ o(O, {
|
|
123
123
|
align: "inline-end",
|
|
124
124
|
children: /* @__PURE__ */ o(V, {
|
|
125
125
|
"aria-label": i ? l ?? "Hide password" : d ?? "Show password",
|
|
@@ -160,7 +160,7 @@ function W({ className: t, showLabel: e = !0 }) {
|
|
|
160
160
|
className: x("mt-1 space-y-2", t),
|
|
161
161
|
children: /* @__PURE__ */ R("div", {
|
|
162
162
|
className: x("flex items-center gap-2", r && "opacity-50"),
|
|
163
|
-
children: [/* @__PURE__ */ o(
|
|
163
|
+
children: [/* @__PURE__ */ o(j, {
|
|
164
164
|
className: "h-2 flex-1",
|
|
165
165
|
dataHook: `${l}-strength-progress`,
|
|
166
166
|
indicatorClassName: a.color,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const p=require("../_virtual/_rolldown/runtime.cjs"),y=require("../typography-text.cjs");let e=require("react");e=p.__toESM(e,1);let i=require("@brightlocal/ui-components/lib/utils"),n=require("react/jsx-runtime");var x={md:32,sm:20},l=e.forwardRef(({className:d,dataHook:s,icon:t,message:m,size:a="md",slot:r,trackingEl:c,trackingLabel:o,...u},_)=>{const g=e.isValidElement(t)&&typeof t.type!="string"&&t.type!==e.Fragment?e.cloneElement(t,{size:x[a]}):t;return(0,n.jsxs)("div",{ref:_,className:(0,i.cn)("bg-muted flex flex-col items-center justify-center text-center",a==="md"&&"gap-2",d),"data-hook":s,"data-size":a,"data-slot":r,"data-tracking-el":c??r,"data-tracking-label":o,...u,children:[(0,n.jsx)("span",{"aria-hidden":"true",className:(0,i.cn)("text-muted-foreground flex items-center justify-center",a==="md"?"[&_svg:not([class*='size-'])]:size-8":"[&_svg:not([class*='size-'])]:size-5"),"data-hook":`${s}-icon`,"data-slot":`${r}-icon`,children:g}),a==="md"?(0,n.jsx)(y.TypographyText,{align:"center",color:"muted","data-slot":`${r}-message`,dataHook:`${s}-message`,variant:"body-sm",children:m}):null]})});l.displayName="EmptyCanvas";exports.EmptyCanvas=l;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The glyph is 32 in every real content box.
|
|
4
|
+
*
|
|
5
|
+
* It does not scale with the box. A canvas empty is one treatment, so it reads
|
|
6
|
+
* the same on a metric card's plot, a map well and a photo slot. A larger step
|
|
7
|
+
* existed briefly for a 1200px mockup-filler frame that no longer exists.
|
|
8
|
+
*
|
|
9
|
+
* The one smaller step is for a slot under 48px — a table thumbnail, a list
|
|
10
|
+
* avatar (DS-1257). A 32px glyph plus a line cannot centre in a 40px tile, so
|
|
11
|
+
* the compact canvas drops the line and draws the glyph at 20 (`size-5`, the
|
|
12
|
+
* bare LogoMark `sm` glyph). Only `MediaEmpty` exposes it: a chart plot or a
|
|
13
|
+
* map well is never that small.
|
|
14
|
+
*/
|
|
15
|
+
declare const CANVAS_ICON_SIZE: {
|
|
16
|
+
readonly md: 32;
|
|
17
|
+
readonly sm: 20;
|
|
18
|
+
};
|
|
19
|
+
/** The canvas sizes: `md` for a content box, `sm` for a slot under 48px. */
|
|
20
|
+
type EmptyCanvasSize = keyof typeof CANVAS_ICON_SIZE;
|
|
2
21
|
/**
|
|
3
22
|
* Props for the internal EmptyCanvas body.
|
|
4
23
|
*/
|
|
@@ -10,8 +29,14 @@ interface EmptyCanvasProps extends Omit<React.ComponentPropsWithoutRef<"div">, "
|
|
|
10
29
|
* carries is overridden — so no call site has a number to get wrong.
|
|
11
30
|
*/
|
|
12
31
|
icon: React.ReactNode;
|
|
13
|
-
/** The one line under the glyph. */
|
|
32
|
+
/** The one line under the glyph. Ignored at size `sm`, which has no line. */
|
|
14
33
|
message: string;
|
|
34
|
+
/**
|
|
35
|
+
* `md` draws the 32px glyph and the line; `sm` draws a 20px glyph alone,
|
|
36
|
+
* centred, for slots under 48px.
|
|
37
|
+
* @default "md"
|
|
38
|
+
*/
|
|
39
|
+
size?: EmptyCanvasSize;
|
|
15
40
|
/** The calling component's slot name, e.g. `"chart-empty"`. */
|
|
16
41
|
slot: string;
|
|
17
42
|
/** Tracking element identifier for analytics. */
|
|
@@ -24,4 +49,5 @@ interface EmptyCanvasProps extends Omit<React.ComponentPropsWithoutRef<"div">, "
|
|
|
24
49
|
*/
|
|
25
50
|
declare const EmptyCanvas: React.ForwardRefExoticComponent<EmptyCanvasProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
51
|
export { EmptyCanvas };
|
|
52
|
+
export type { EmptyCanvasSize };
|
|
27
53
|
//# sourceMappingURL=empty-canvas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-canvas.d.ts","sourceRoot":"","sources":["../../src/lib/empty-canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"empty-canvas.d.ts","sourceRoot":"","sources":["../../src/lib/empty-canvas.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwB/B;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,gBAAgB;;;CAA8B,CAAC;AAErD,4EAA4E;AAC5E,KAAK,eAAe,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAErD;;GAEG;AACH,UAAU,gBAAiB,SAAQ,IAAI,CACrC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EACrC,UAAU,GAAG,OAAO,CACrB;IACC,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,WAAW,yFAyEhB,CAAC;AAIF,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,YAAY,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/lib/empty-canvas.js
CHANGED
|
@@ -1,31 +1,35 @@
|
|
|
1
|
-
import { TypographyText as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"data-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { TypographyText as g } from "../typography-text.js";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cn as m } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
import { jsx as d, jsxs as y } from "react/jsx-runtime";
|
|
5
|
+
var u = {
|
|
6
|
+
md: 32,
|
|
7
|
+
sm: 20
|
|
8
|
+
}, x = r.forwardRef(({ className: n, dataHook: s, icon: e, message: i, size: t = "md", slot: a, trackingEl: l, trackingLabel: o, ...c }, p) => {
|
|
9
|
+
const f = r.isValidElement(e) && typeof e.type != "string" && e.type !== r.Fragment ? r.cloneElement(e, { size: u[t] }) : e;
|
|
10
|
+
return /* @__PURE__ */ y("div", {
|
|
11
|
+
ref: p,
|
|
12
|
+
className: m("bg-muted flex flex-col items-center justify-center text-center", t === "md" && "gap-2", n),
|
|
13
|
+
"data-hook": s,
|
|
14
|
+
"data-size": t,
|
|
15
|
+
"data-slot": a,
|
|
16
|
+
"data-tracking-el": l ?? a,
|
|
17
|
+
"data-tracking-label": o,
|
|
18
|
+
...c,
|
|
19
|
+
children: [/* @__PURE__ */ d("span", {
|
|
16
20
|
"aria-hidden": "true",
|
|
17
|
-
className: "text-muted-foreground flex items-center justify-center [&_svg:not([class*='size-'])]:size-8",
|
|
18
|
-
"data-hook": `${
|
|
19
|
-
"data-slot": `${
|
|
20
|
-
children:
|
|
21
|
-
}), /* @__PURE__ */
|
|
21
|
+
className: m("text-muted-foreground flex items-center justify-center", t === "md" ? "[&_svg:not([class*='size-'])]:size-8" : "[&_svg:not([class*='size-'])]:size-5"),
|
|
22
|
+
"data-hook": `${s}-icon`,
|
|
23
|
+
"data-slot": `${a}-icon`,
|
|
24
|
+
children: f
|
|
25
|
+
}), t === "md" ? /* @__PURE__ */ d(g, {
|
|
22
26
|
align: "center",
|
|
23
27
|
color: "muted",
|
|
24
|
-
"data-slot": `${
|
|
25
|
-
dataHook: `${
|
|
28
|
+
"data-slot": `${a}-message`,
|
|
29
|
+
dataHook: `${s}-message`,
|
|
26
30
|
variant: "body-sm",
|
|
27
31
|
children: i
|
|
28
|
-
})]
|
|
32
|
+
}) : null]
|
|
29
33
|
});
|
|
30
34
|
});
|
|
31
35
|
x.displayName = "EmptyCanvas";
|
package/dist/lib/empty-chip.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const l=require("../_virtual/_rolldown/runtime.cjs"),
|
|
1
|
+
const l=require("../_virtual/_rolldown/runtime.cjs"),u=require("../logo-mark.cjs");let r=require("react");r=l.__toESM(r,1);let s=require("@brightlocal/ui-components/lib/utils"),m=require("react/jsx-runtime");function c(t){return r.Children.toArray(t).flatMap(e=>r.isValidElement(e)&&e.type===r.Fragment?r.Children.toArray(e.props.children):[e]).length>0}function _({dataHook:t,icon:e,variant:i="filled",shape:n="circle",slot:o,className:a}){return(0,m.jsx)(u.LogoMark,{className:(0,s.cn)("text-muted-foreground",a),"data-slot":o,dataHook:t,name:e,shape:n,size:"lg",variant:i})}exports.EmptyChip=_;exports.hasEmptyActions=c;
|
package/dist/lib/empty-chip.d.ts
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
import { LogoMarkVariant } from '../components/logo-mark';
|
|
1
|
+
import { LogoMarkShape, LogoMarkVariant } from '../components/logo-mark';
|
|
2
2
|
import * as React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Whether an empty state's actions (`children`) render anything, so the
|
|
5
|
+
* actions row is never drawn around nothing. Used by EmptyState, and by
|
|
6
|
+
* CommandEmpty / ComboboxEmpty to decide whether `children` are actions.
|
|
7
|
+
*
|
|
8
|
+
* `children ? …` is not enough. Call sites write `{canAdd && <Button/>}`, and
|
|
9
|
+
* two conditionals make `children` the array `[false, false]`, which is truthy.
|
|
10
|
+
* `Children.toArray` drops null, undefined and booleans. It does NOT look inside
|
|
11
|
+
* a fragment, so a call site that wraps its conditionals in one (`<>{a}{b}</>`)
|
|
12
|
+
* would count as one child however empty it is. Unwrap one level first.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasEmptyActions(children: React.ReactNode): boolean;
|
|
3
15
|
interface EmptyChipProps {
|
|
4
16
|
dataHook: string;
|
|
5
17
|
/** The glyph. Decorative — the chip is aria-hidden. */
|
|
6
18
|
icon: React.ReactNode;
|
|
7
19
|
/** @default "filled" */
|
|
8
20
|
variant?: LogoMarkVariant;
|
|
21
|
+
/**
|
|
22
|
+
* Container shape passed to LogoMark.
|
|
23
|
+
* @default "circle"
|
|
24
|
+
*/
|
|
25
|
+
shape?: LogoMarkShape;
|
|
9
26
|
/** Overrides LogoMark's own `logo-mark` slot, so each host keeps its name. */
|
|
10
27
|
slot: string;
|
|
11
28
|
className?: string;
|
|
12
29
|
}
|
|
13
|
-
export declare function EmptyChip({ dataHook, icon, variant, slot, className, }: EmptyChipProps): React.JSX.Element;
|
|
30
|
+
export declare function EmptyChip({ dataHook, icon, variant, shape, slot, className, }: EmptyChipProps): React.JSX.Element;
|
|
14
31
|
export {};
|
|
15
32
|
//# sourceMappingURL=empty-chip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty-chip.d.ts","sourceRoot":"","sources":["../../src/lib/empty-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,
|
|
1
|
+
{"version":3,"file":"empty-chip.d.ts","sourceRoot":"","sources":["../../src/lib/empty-chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,eAAe,EACrB,MAAM,yBAAyB,CAAC;AAqBjC;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,OAAO,CAUlE;AAED,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,wBAAwB;IACxB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,IAAI,EACJ,OAAkB,EAClB,KAAgB,EAChB,IAAI,EACJ,SAAS,GACV,EAAE,cAAc,qBAYhB"}
|
package/dist/lib/empty-chip.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { LogoMark as i } from "../logo-mark.js";
|
|
2
|
-
import "react";
|
|
2
|
+
import * as t from "react";
|
|
3
3
|
import { cn as p } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
-
import { jsx as
|
|
5
|
-
function
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
5
|
+
function u(e) {
|
|
6
|
+
return t.Children.toArray(e).flatMap((r) => t.isValidElement(r) && r.type === t.Fragment ? t.Children.toArray(r.props.children) : [r]).length > 0;
|
|
7
|
+
}
|
|
8
|
+
function d({ dataHook: e, icon: r, variant: o = "filled", shape: n = "circle", slot: a, className: m }) {
|
|
9
|
+
return /* @__PURE__ */ l(i, {
|
|
10
|
+
className: p("text-muted-foreground", m),
|
|
11
|
+
"data-slot": a,
|
|
12
|
+
dataHook: e,
|
|
10
13
|
name: r,
|
|
14
|
+
shape: n,
|
|
11
15
|
size: "lg",
|
|
12
|
-
variant:
|
|
16
|
+
variant: o
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
19
|
export {
|
|
16
|
-
d as EmptyChip
|
|
20
|
+
d as EmptyChip,
|
|
21
|
+
u as hasEmptyActions
|
|
17
22
|
};
|
package/dist/lib/field-aria.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";const d=require("../_virtual/_rolldown/runtime.cjs");let i=require("react");i=d.__toESM(i,1);let f=require("react/jsx-runtime");var g={description:[],error:[]},c=i.createContext(null);function x({children:s}){const[e,n]=i.useState(g),t=i.useCallback((o,u)=>(n(r=>r[o].includes(u)?r:{...r,[o]:[...r[o],u]}),()=>{n(r=>r[o].includes(u)?{...r,[o]:r[o].filter(a=>a!==u)}:r)}),[]),l=i.useMemo(()=>({ids:e,register:t}),[e,t]);return(0,f.jsx)(c.Provider,{value:l,children:s})}function F(s,e,n){const t=i.useContext(c)?.register;i.useEffect(()=>{if(!(!t||!n))return t(s,e)},[t,s,e,n])}function _(s){const e=i.useContext(c);if(!e)return s;const n=s?.split(/\s+/).filter(Boolean)??[],t=[...new Set([...e.ids.error,...e.ids.description,...n])];return t.length>0?t.join(" "):void 0}exports.FieldAriaProvider=x;exports.useFieldAriaRegistration=F;exports.useFieldDescribedBy=_;
|
|
1
|
+
"use client";const d=require("../_virtual/_rolldown/runtime.cjs");let i=require("react");i=d.__toESM(i,1);let f=require("react/jsx-runtime");var g={description:[],error:[],count:[]},c=i.createContext(null);function x({children:s}){const[e,n]=i.useState(g),t=i.useCallback((o,u)=>(n(r=>r[o].includes(u)?r:{...r,[o]:[...r[o],u]}),()=>{n(r=>r[o].includes(u)?{...r,[o]:r[o].filter(a=>a!==u)}:r)}),[]),l=i.useMemo(()=>({ids:e,register:t}),[e,t]);return(0,f.jsx)(c.Provider,{value:l,children:s})}function F(s,e,n){const t=i.useContext(c)?.register;i.useEffect(()=>{if(!(!t||!n))return t(s,e)},[t,s,e,n])}function _(s){const e=i.useContext(c);if(!e)return s;const n=s?.split(/\s+/).filter(Boolean)??[],t=[...new Set([...e.ids.error,...e.ids.description,...e.ids.count,...n])];return t.length>0?t.join(" "):void 0}exports.FieldAriaProvider=x;exports.useFieldAriaRegistration=F;exports.useFieldDescribedBy=_;
|
package/dist/lib/field-aria.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* Wires a Field's hint and error message to the control inside it.
|
|
4
4
|
*
|
|
5
|
-
* `Field` provides the context. `FieldDescription
|
|
6
|
-
* the id they render while they are on screen. Text controls (`Input`,
|
|
5
|
+
* `Field` provides the context. `FieldDescription`, `FieldError` and
|
|
6
|
+
* `CountIndicator` register the id they render while they are on screen. Text controls (`Input`,
|
|
7
7
|
* `Textarea`) read the registered ids and point `aria-describedby` at them, so
|
|
8
8
|
* a screen reader hears the message together with the field. Outside a Field
|
|
9
9
|
* the hooks do nothing and a control behaves exactly as before.
|
|
@@ -14,7 +14,7 @@ import * as React from "react";
|
|
|
14
14
|
* `aria-describedby` until hydration; a consumer that needs it before that
|
|
15
15
|
* passes `id` on the message and `aria-describedby` on the control by hand.
|
|
16
16
|
*/
|
|
17
|
-
type FieldAriaKind = "description" | "error";
|
|
17
|
+
type FieldAriaKind = "description" | "error" | "count";
|
|
18
18
|
declare function FieldAriaProvider({ children }: {
|
|
19
19
|
children: React.ReactNode;
|
|
20
20
|
}): React.JSX.Element;
|
|
@@ -25,7 +25,7 @@ declare function FieldAriaProvider({ children }: {
|
|
|
25
25
|
declare function useFieldAriaRegistration(kind: FieldAriaKind, id: string, present: boolean): void;
|
|
26
26
|
/**
|
|
27
27
|
* Returns the `aria-describedby` value for a control: the Field's error, then
|
|
28
|
-
* its hint, then whatever the consumer passed. Ids are de-duplicated, so a
|
|
28
|
+
* its hint, then its count indicator, then whatever the consumer passed. Ids are de-duplicated, so a
|
|
29
29
|
* consumer that already wires the same id by hand is unaffected. Outside a
|
|
30
30
|
* Field it returns `describedBy` unchanged.
|
|
31
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-aria.d.ts","sourceRoot":"","sources":["../../src/lib/field-aria.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;;;;GAcG;AAEH,KAAK,aAAa,GAAG,aAAa,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"field-aria.d.ts","sourceRoot":"","sources":["../../src/lib/field-aria.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;;;;;;;;;;;;;GAcG;AAEH,KAAK,aAAa,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,CAAC;AAiBvD,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAuBrE;AAED;;;GAGG;AACH,iBAAS,wBAAwB,CAC/B,IAAI,EAAE,aAAa,EACnB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,QAQjB;AAED;;;;;GAKG;AACH,iBAAS,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcrE;AAED,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,CAAC"}
|