@brightlocal/ui-components 0.3.1 → 0.4.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.d.ts +2 -2
- package/dist/alert.js +3 -3
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -2
- package/dist/blocks/sidebar.js +0 -1
- package/dist/breadcrumb.js +3 -3
- package/dist/button.d.ts +1 -1
- package/dist/carousel.js +3 -3
- package/dist/centred-layout.cjs +1 -1
- package/dist/centred-layout.d.ts +1 -1
- package/dist/centred-layout.js +6 -6
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/combobox.d.ts +6 -6
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +13 -13
- package/dist/date-picker.js +4 -4
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +103 -10
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +118 -58
- package/dist/index.cjs +1 -1
- package/dist/index.js +351 -349
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.d.ts +1 -1
- package/dist/input-otp.js +3 -3
- package/dist/input-password.js +1 -1
- package/dist/label.cjs +1 -1
- package/dist/label.js +1 -1
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +5 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +24 -23
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +3 -3
- package/dist/radio-group.d.ts +2 -2
- package/dist/resizable.d.ts +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.d.ts +19 -14
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +102 -133
- package/dist/sonner.js +1 -1
- package/dist/switch.d.ts +1 -1
- package/package.json +9 -9
- package/src/components/centred-layout.tsx +3 -3
- package/src/components/checkbox.tsx +1 -1
- package/src/components/field.tsx +187 -15
- package/src/components/label.tsx +1 -1
- package/src/components/link.tsx +7 -1
- package/src/components/select.tsx +22 -86
package/dist/select.js
CHANGED
|
@@ -1,52 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { cva as T } from "class-variance-authority";
|
|
1
|
+
import { jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "@radix-ui/react-select";
|
|
3
|
+
import { CheckIcon as v, ChevronDownIcon as u, ChevronUpIcon as h } from "@brightlocal/icons";
|
|
4
|
+
import { cva as x } from "class-variance-authority";
|
|
6
5
|
import { cn as o } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
label: t,
|
|
10
|
-
description: a,
|
|
11
|
-
optional: n,
|
|
12
|
-
placeholder: i,
|
|
13
|
-
children: d,
|
|
14
|
-
"aria-label": s,
|
|
15
|
-
...u
|
|
16
|
-
}) {
|
|
17
|
-
const c = m.useId(), f = `${c}-label`, g = `${c}-description`, b = a, w = t || b, v = {
|
|
18
|
-
placeholder: i,
|
|
19
|
-
"aria-required": n ? void 0 : !0,
|
|
20
|
-
"aria-label": s
|
|
21
|
-
}, I = {
|
|
22
|
-
...v,
|
|
23
|
-
id: c
|
|
24
|
-
}, h = (l, z) => m.isValidElement(l) && l.type === S ? m.cloneElement(
|
|
25
|
-
l,
|
|
26
|
-
z
|
|
27
|
-
) : l;
|
|
28
|
-
return w ? /* @__PURE__ */ p("div", { className: "flex flex-col gap-2", children: [
|
|
29
|
-
t && /* @__PURE__ */ e(_, { htmlFor: c, id: f, optional: n, children: t }),
|
|
30
|
-
/* @__PURE__ */ e(r.Root, { "data-slot": "select", ...u, children: m.Children.map(
|
|
31
|
-
d,
|
|
32
|
-
(l) => h(l, I)
|
|
33
|
-
) }),
|
|
34
|
-
b && /* @__PURE__ */ e("p", { className: "text-muted-foreground text-sm", id: g, children: b })
|
|
35
|
-
] }) : /* @__PURE__ */ e(r.Root, { "data-slot": "select", ...u, children: m.Children.map(
|
|
36
|
-
d,
|
|
37
|
-
(l) => h(l, v)
|
|
38
|
-
) });
|
|
6
|
+
function S({ children: e, ...r }) {
|
|
7
|
+
return /* @__PURE__ */ t(a.Root, { "data-slot": "select", ...r, children: e });
|
|
39
8
|
}
|
|
40
|
-
|
|
41
|
-
function
|
|
42
|
-
return /* @__PURE__ */
|
|
9
|
+
S.displayName = "Select";
|
|
10
|
+
function y(e) {
|
|
11
|
+
return /* @__PURE__ */ t(a.Group, { "data-slot": "select-group", ...e });
|
|
43
12
|
}
|
|
44
|
-
|
|
45
|
-
function
|
|
46
|
-
return /* @__PURE__ */
|
|
13
|
+
y.displayName = "SelectGroup";
|
|
14
|
+
function N(e) {
|
|
15
|
+
return /* @__PURE__ */ t(a.Value, { "data-slot": "select-value", ...e });
|
|
47
16
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
17
|
+
N.displayName = "SelectValue";
|
|
18
|
+
const w = x([
|
|
50
19
|
// Base layout
|
|
51
20
|
"relative flex w-full h-9 items-center justify-between gap-2",
|
|
52
21
|
"px-3 py-2",
|
|
@@ -72,40 +41,40 @@ const q = T([
|
|
|
72
41
|
"[&_svg:not([class*='size-'])]:size-4",
|
|
73
42
|
"[&_svg:not([class*='text-'])]:text-muted-foreground"
|
|
74
43
|
]);
|
|
75
|
-
function
|
|
76
|
-
className:
|
|
77
|
-
children:
|
|
44
|
+
function z({
|
|
45
|
+
className: e,
|
|
46
|
+
children: r,
|
|
78
47
|
placeholder: n,
|
|
79
|
-
dataHook:
|
|
80
|
-
error:
|
|
81
|
-
...
|
|
48
|
+
dataHook: s,
|
|
49
|
+
error: i,
|
|
50
|
+
...l
|
|
82
51
|
}) {
|
|
83
|
-
const
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
|
|
52
|
+
const c = i || l["aria-invalid"] === !0 || l["aria-invalid"] === "true", f = l["aria-required"] === !0 || l["aria-required"] === "true", g = l["aria-label"] || n || "Select an option", b = c ? "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive" : "";
|
|
53
|
+
return /* @__PURE__ */ d(
|
|
54
|
+
a.Trigger,
|
|
86
55
|
{
|
|
87
|
-
...
|
|
88
|
-
"aria-invalid":
|
|
89
|
-
"aria-label":
|
|
90
|
-
"aria-required":
|
|
91
|
-
className: o(
|
|
92
|
-
"data-hook":
|
|
56
|
+
...l,
|
|
57
|
+
"aria-invalid": c ? "true" : void 0,
|
|
58
|
+
"aria-label": g,
|
|
59
|
+
"aria-required": f ? "true" : void 0,
|
|
60
|
+
className: o(w(), b, e),
|
|
61
|
+
"data-hook": s,
|
|
93
62
|
"data-slot": "select-trigger",
|
|
94
63
|
children: [
|
|
95
|
-
|
|
96
|
-
/* @__PURE__ */
|
|
64
|
+
r,
|
|
65
|
+
/* @__PURE__ */ t(a.Icon, { asChild: !0, children: /* @__PURE__ */ t(u, { className: "text-muted-foreground size-4" }) })
|
|
97
66
|
]
|
|
98
67
|
}
|
|
99
68
|
);
|
|
100
69
|
}
|
|
101
|
-
|
|
102
|
-
function
|
|
103
|
-
className:
|
|
104
|
-
children:
|
|
70
|
+
z.displayName = "SelectTrigger";
|
|
71
|
+
function k({
|
|
72
|
+
className: e,
|
|
73
|
+
children: r,
|
|
105
74
|
position: n = "popper",
|
|
106
|
-
...
|
|
75
|
+
...s
|
|
107
76
|
}) {
|
|
108
|
-
const
|
|
77
|
+
const i = o(
|
|
109
78
|
// Base appearance
|
|
110
79
|
"relative z-50 overflow-hidden",
|
|
111
80
|
"min-w-[8rem]",
|
|
@@ -122,60 +91,60 @@ function L({
|
|
|
122
91
|
"data-[side=left]:slide-in-from-right-2",
|
|
123
92
|
"data-[side=right]:slide-in-from-left-2",
|
|
124
93
|
"data-[side=top]:slide-in-from-bottom-2"
|
|
125
|
-
),
|
|
94
|
+
), l = n === "popper" && o(
|
|
126
95
|
"data-[side=bottom]:translate-y-1",
|
|
127
96
|
"data-[side=left]:-translate-x-1",
|
|
128
97
|
"data-[side=right]:translate-x-1",
|
|
129
98
|
"data-[side=top]:-translate-y-1"
|
|
130
99
|
);
|
|
131
|
-
return /* @__PURE__ */
|
|
132
|
-
|
|
100
|
+
return /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ d(
|
|
101
|
+
a.Content,
|
|
133
102
|
{
|
|
134
|
-
className: o(
|
|
103
|
+
className: o(i, l, e),
|
|
135
104
|
"data-slot": "select-content",
|
|
136
105
|
position: n,
|
|
137
|
-
...
|
|
106
|
+
...s,
|
|
138
107
|
children: [
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
/* @__PURE__ */
|
|
141
|
-
|
|
108
|
+
/* @__PURE__ */ t(m, {}),
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
a.Viewport,
|
|
142
111
|
{
|
|
143
112
|
className: o(
|
|
144
113
|
"p-1",
|
|
145
114
|
n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
|
|
146
115
|
),
|
|
147
|
-
children:
|
|
116
|
+
children: r
|
|
148
117
|
}
|
|
149
118
|
),
|
|
150
|
-
/* @__PURE__ */
|
|
119
|
+
/* @__PURE__ */ t(p, {})
|
|
151
120
|
]
|
|
152
121
|
}
|
|
153
122
|
) });
|
|
154
123
|
}
|
|
155
|
-
|
|
156
|
-
function
|
|
157
|
-
className:
|
|
158
|
-
...
|
|
124
|
+
k.displayName = "SelectContent";
|
|
125
|
+
function I({
|
|
126
|
+
className: e,
|
|
127
|
+
...r
|
|
159
128
|
}) {
|
|
160
|
-
return /* @__PURE__ */
|
|
161
|
-
|
|
129
|
+
return /* @__PURE__ */ t(
|
|
130
|
+
a.Label,
|
|
162
131
|
{
|
|
163
132
|
className: o(
|
|
164
133
|
"text-muted-foreground px-2 py-1.5 text-xs font-medium",
|
|
165
|
-
|
|
134
|
+
e
|
|
166
135
|
),
|
|
167
136
|
"data-slot": "select-label",
|
|
168
|
-
...
|
|
137
|
+
...r
|
|
169
138
|
}
|
|
170
139
|
);
|
|
171
140
|
}
|
|
172
|
-
|
|
173
|
-
function
|
|
174
|
-
className:
|
|
175
|
-
children:
|
|
141
|
+
I.displayName = "SelectLabel";
|
|
142
|
+
function _({
|
|
143
|
+
className: e,
|
|
144
|
+
children: r,
|
|
176
145
|
...n
|
|
177
146
|
}) {
|
|
178
|
-
const
|
|
147
|
+
const s = o(
|
|
179
148
|
// Base layout
|
|
180
149
|
"relative flex w-full cursor-default select-none items-center gap-2",
|
|
181
150
|
"rounded py-1.5 pl-2 pr-8",
|
|
@@ -192,79 +161,79 @@ function P({
|
|
|
192
161
|
"[&_svg:not([class*='size-'])]:size-4",
|
|
193
162
|
"[&_svg:not([class*='text-'])]:text-foreground"
|
|
194
163
|
);
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
|
|
164
|
+
return /* @__PURE__ */ d(
|
|
165
|
+
a.Item,
|
|
197
166
|
{
|
|
198
|
-
className: o(
|
|
167
|
+
className: o(s, e),
|
|
199
168
|
"data-slot": "select-item",
|
|
200
169
|
...n,
|
|
201
170
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
/* @__PURE__ */
|
|
171
|
+
/* @__PURE__ */ t("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ t(a.ItemIndicator, { children: /* @__PURE__ */ t(v, { className: "size-4" }) }) }),
|
|
172
|
+
/* @__PURE__ */ t(a.ItemText, { children: r })
|
|
204
173
|
]
|
|
205
174
|
}
|
|
206
175
|
);
|
|
207
176
|
}
|
|
208
|
-
|
|
209
|
-
function
|
|
210
|
-
className:
|
|
211
|
-
...
|
|
177
|
+
_.displayName = "SelectItem";
|
|
178
|
+
function C({
|
|
179
|
+
className: e,
|
|
180
|
+
...r
|
|
212
181
|
}) {
|
|
213
|
-
return /* @__PURE__ */
|
|
214
|
-
|
|
182
|
+
return /* @__PURE__ */ t(
|
|
183
|
+
a.Separator,
|
|
215
184
|
{
|
|
216
|
-
className: o("bg-border pointer-events-none -mx-1 my-1 h-px",
|
|
185
|
+
className: o("bg-border pointer-events-none -mx-1 my-1 h-px", e),
|
|
217
186
|
"data-slot": "select-separator",
|
|
218
|
-
...
|
|
187
|
+
...r
|
|
219
188
|
}
|
|
220
189
|
);
|
|
221
190
|
}
|
|
222
|
-
|
|
223
|
-
function
|
|
224
|
-
className:
|
|
225
|
-
...
|
|
191
|
+
C.displayName = "SelectSeparator";
|
|
192
|
+
function m({
|
|
193
|
+
className: e,
|
|
194
|
+
...r
|
|
226
195
|
}) {
|
|
227
|
-
return /* @__PURE__ */
|
|
228
|
-
|
|
196
|
+
return /* @__PURE__ */ t(
|
|
197
|
+
a.ScrollUpButton,
|
|
229
198
|
{
|
|
230
199
|
className: o(
|
|
231
200
|
"flex cursor-default items-center justify-center py-1",
|
|
232
|
-
|
|
201
|
+
e
|
|
233
202
|
),
|
|
234
203
|
"data-slot": "select-scroll-up-button",
|
|
235
|
-
...
|
|
236
|
-
children: /* @__PURE__ */
|
|
204
|
+
...r,
|
|
205
|
+
children: /* @__PURE__ */ t(h, { className: "size-4" })
|
|
237
206
|
}
|
|
238
207
|
);
|
|
239
208
|
}
|
|
240
|
-
|
|
241
|
-
function
|
|
242
|
-
className:
|
|
243
|
-
...
|
|
209
|
+
m.displayName = "SelectScrollUpButton";
|
|
210
|
+
function p({
|
|
211
|
+
className: e,
|
|
212
|
+
...r
|
|
244
213
|
}) {
|
|
245
|
-
return /* @__PURE__ */
|
|
246
|
-
|
|
214
|
+
return /* @__PURE__ */ t(
|
|
215
|
+
a.ScrollDownButton,
|
|
247
216
|
{
|
|
248
217
|
className: o(
|
|
249
218
|
"flex cursor-default items-center justify-center py-1",
|
|
250
|
-
|
|
219
|
+
e
|
|
251
220
|
),
|
|
252
221
|
"data-slot": "select-scroll-down-button",
|
|
253
|
-
...
|
|
254
|
-
children: /* @__PURE__ */
|
|
222
|
+
...r,
|
|
223
|
+
children: /* @__PURE__ */ t(u, { className: "size-4" })
|
|
255
224
|
}
|
|
256
225
|
);
|
|
257
226
|
}
|
|
258
|
-
|
|
227
|
+
p.displayName = "SelectScrollDownButton";
|
|
259
228
|
export {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
229
|
+
S as Select,
|
|
230
|
+
k as SelectContent,
|
|
231
|
+
y as SelectGroup,
|
|
232
|
+
_ as SelectItem,
|
|
233
|
+
I as SelectLabel,
|
|
234
|
+
p as SelectScrollDownButton,
|
|
235
|
+
m as SelectScrollUpButton,
|
|
236
|
+
C as SelectSeparator,
|
|
237
|
+
z as SelectTrigger,
|
|
238
|
+
N as SelectValue
|
|
270
239
|
};
|
package/dist/sonner.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { Loader2 as S, XCircle as p, AlertTriangle as b, CheckCircle2 as g, Info as v } from "@brightlocal/icons";
|
|
3
3
|
import { cva as i } from "class-variance-authority";
|
|
4
|
-
import {
|
|
4
|
+
import { Toaster as N, toast as f } from "sonner";
|
|
5
5
|
import { Button as x } from "@brightlocal/ui-components/button";
|
|
6
6
|
import { cn as a } from "@brightlocal/ui-components/lib/utils";
|
|
7
7
|
const I = i(
|
package/dist/switch.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type SwitchVariant = "default" | "box";
|
|
|
10
10
|
*/
|
|
11
11
|
export type SwitchSide = "left" | "right";
|
|
12
12
|
declare const switchVariants: (props?: ({
|
|
13
|
-
variant?: "
|
|
13
|
+
variant?: "box" | "default" | null | undefined;
|
|
14
14
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
15
15
|
interface SwitchProps extends Omit<React.ComponentProps<typeof SwitchPrimitive.Root>, "asChild">, VariantProps<typeof switchVariants> {
|
|
16
16
|
/** Data hook for automated testing (REQUIRED) */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -88,15 +88,15 @@
|
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
90
|
"@size-limit/file": "^12.0.0",
|
|
91
|
-
"@types/node": "^
|
|
92
|
-
"@types/react": "^19.2.
|
|
91
|
+
"@types/node": "^25.0.10",
|
|
92
|
+
"@types/react": "^19.2.10",
|
|
93
93
|
"@types/react-dom": "^19.2.3",
|
|
94
|
-
"@vitejs/plugin-react": "^5.1.
|
|
94
|
+
"@vitejs/plugin-react": "^5.1.2",
|
|
95
95
|
"size-limit": "^12.0.0",
|
|
96
96
|
"typescript": "5.9.3",
|
|
97
|
-
"vite": "^
|
|
97
|
+
"vite": "^7.3.1",
|
|
98
98
|
"vite-bundle-visualizer": "^1.2.1",
|
|
99
|
-
"vite-plugin-dts": "^4.
|
|
99
|
+
"vite-plugin-dts": "^4.5.4",
|
|
100
100
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
101
101
|
"@workspace/eslint-config": "0.0.0",
|
|
102
102
|
"@workspace/typescript-config": "0.0.0"
|
|
@@ -143,12 +143,12 @@
|
|
|
143
143
|
"cmdk": "^1.1.1",
|
|
144
144
|
"date-fns": "^4.1.0",
|
|
145
145
|
"embla-carousel-react": "^8.6.0",
|
|
146
|
-
"framer-motion": "^12.
|
|
146
|
+
"framer-motion": "^12.29.2",
|
|
147
147
|
"input-otp": "^1.4.2",
|
|
148
148
|
"lucide-react": "^0.475.0",
|
|
149
|
-
"react-day-picker": "^9.
|
|
149
|
+
"react-day-picker": "^9.13.0",
|
|
150
150
|
"react-resizable-panels": "^3.0.6",
|
|
151
|
-
"recharts": "^3.
|
|
151
|
+
"recharts": "^3.7.0",
|
|
152
152
|
"sonner": "^2.0.7",
|
|
153
153
|
"tailwind-merge": "^3.4.0",
|
|
154
154
|
"vaul": "^1.1.2",
|
|
@@ -10,7 +10,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
|
10
10
|
* CentredLayout provides a responsive centered container with max-width constraint.
|
|
11
11
|
*
|
|
12
12
|
* Spacing tokens used:
|
|
13
|
-
* - Padding:
|
|
13
|
+
* - Padding: section-padding-x/y tokens (responsive: 16px mobile, 24px desktop)
|
|
14
14
|
* - Header to content gap: gap-4 (spacing.4 = 16px)
|
|
15
15
|
* - Max width: max-w-7xl (1280px) by default
|
|
16
16
|
*
|
|
@@ -83,8 +83,8 @@ const CentredLayout = React.forwardRef<HTMLDivElement, CentredLayoutProps>(
|
|
|
83
83
|
<div
|
|
84
84
|
ref={ref}
|
|
85
85
|
className={cn(
|
|
86
|
-
// Base styles with
|
|
87
|
-
"bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-
|
|
86
|
+
// Base styles with section-padding tokens (responsive: 16px mobile, 24px desktop) and gap-4 for header/content spacing
|
|
87
|
+
"bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-section",
|
|
88
88
|
!maxWidth && "max-w-7xl",
|
|
89
89
|
className
|
|
90
90
|
)}
|
|
@@ -8,7 +8,7 @@ import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
|
8
8
|
const checkboxVariants = cva(
|
|
9
9
|
[
|
|
10
10
|
// Layout & Size
|
|
11
|
-
"size-4 shrink-0 self-start",
|
|
11
|
+
"size-4 shrink-0 self-start mt-0.5",
|
|
12
12
|
// Appearance
|
|
13
13
|
"bg-background peer border border-ring dark:bg-input/30 rounded-xs transition-colors outline-none",
|
|
14
14
|
// Checked State
|