@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.
Files changed (51) hide show
  1. package/dist/alert.d.ts +2 -2
  2. package/dist/alert.js +3 -3
  3. package/dist/blocks/sidebar.cjs +1 -1
  4. package/dist/blocks/sidebar.d.ts +2 -2
  5. package/dist/blocks/sidebar.js +0 -1
  6. package/dist/breadcrumb.js +3 -3
  7. package/dist/button.d.ts +1 -1
  8. package/dist/carousel.js +3 -3
  9. package/dist/centred-layout.cjs +1 -1
  10. package/dist/centred-layout.d.ts +1 -1
  11. package/dist/centred-layout.js +6 -6
  12. package/dist/checkbox.cjs +1 -1
  13. package/dist/checkbox.js +1 -1
  14. package/dist/combobox.d.ts +6 -6
  15. package/dist/combobox.d.ts.map +1 -1
  16. package/dist/combobox.js +13 -13
  17. package/dist/date-picker.js +4 -4
  18. package/dist/field.cjs +1 -1
  19. package/dist/field.d.ts +103 -10
  20. package/dist/field.d.ts.map +1 -1
  21. package/dist/field.js +118 -58
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +351 -349
  24. package/dist/input-chip.cjs +1 -1
  25. package/dist/input-chip.js +1 -1
  26. package/dist/input-group.d.ts +1 -1
  27. package/dist/input-otp.js +3 -3
  28. package/dist/input-password.js +1 -1
  29. package/dist/label.cjs +1 -1
  30. package/dist/label.js +1 -1
  31. package/dist/link.cjs +1 -1
  32. package/dist/link.d.ts +5 -0
  33. package/dist/link.d.ts.map +1 -1
  34. package/dist/link.js +24 -23
  35. package/dist/pagination.d.ts +1 -1
  36. package/dist/pagination.js +3 -3
  37. package/dist/radio-group.d.ts +2 -2
  38. package/dist/resizable.d.ts +1 -1
  39. package/dist/select.cjs +1 -1
  40. package/dist/select.d.ts +19 -14
  41. package/dist/select.d.ts.map +1 -1
  42. package/dist/select.js +102 -133
  43. package/dist/sonner.js +1 -1
  44. package/dist/switch.d.ts +1 -1
  45. package/package.json +9 -9
  46. package/src/components/centred-layout.tsx +3 -3
  47. package/src/components/checkbox.tsx +1 -1
  48. package/src/components/field.tsx +187 -15
  49. package/src/components/label.tsx +1 -1
  50. package/src/components/link.tsx +7 -1
  51. package/src/components/select.tsx +22 -86
package/dist/select.js CHANGED
@@ -1,52 +1,21 @@
1
- import { jsx as e, jsxs as p } from "react/jsx-runtime";
2
- import * as m from "react";
3
- import * as r from "@radix-ui/react-select";
4
- import { CheckIcon as k, ChevronDownIcon as x, ChevronUpIcon as C } from "@brightlocal/icons";
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
- import { Label as _ } from "@brightlocal/ui-components/label";
8
- function j({
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
- j.displayName = "Select";
41
- function B(t) {
42
- return /* @__PURE__ */ e(r.Group, { "data-slot": "select-group", ...t });
9
+ S.displayName = "Select";
10
+ function y(e) {
11
+ return /* @__PURE__ */ t(a.Group, { "data-slot": "select-group", ...e });
43
12
  }
44
- B.displayName = "SelectGroup";
45
- function V(t) {
46
- return /* @__PURE__ */ e(r.Value, { "data-slot": "select-value", ...t });
13
+ y.displayName = "SelectGroup";
14
+ function N(e) {
15
+ return /* @__PURE__ */ t(a.Value, { "data-slot": "select-value", ...e });
47
16
  }
48
- V.displayName = "SelectValue";
49
- const q = T([
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 S({
76
- className: t,
77
- children: a,
44
+ function z({
45
+ className: e,
46
+ children: r,
78
47
  placeholder: n,
79
- dataHook: i,
80
- error: d,
81
- ...s
48
+ dataHook: s,
49
+ error: i,
50
+ ...l
82
51
  }) {
83
- const u = d || s["aria-invalid"] === !0 || s["aria-invalid"] === "true", c = s["aria-required"] === !0 || s["aria-required"] === "true", f = s["aria-label"] || n || "Select an option", g = u ? "border-destructive dark:border-destructive focus-visible:border-destructive focus-visible:shadow-destructive" : "";
84
- return /* @__PURE__ */ p(
85
- r.Trigger,
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
- ...s,
88
- "aria-invalid": u ? "true" : void 0,
89
- "aria-label": f,
90
- "aria-required": c ? "true" : void 0,
91
- className: o(q(), g, t),
92
- "data-hook": i,
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
- a,
96
- /* @__PURE__ */ e(r.Icon, { asChild: !0, children: /* @__PURE__ */ e(x, { className: "text-muted-foreground size-4" }) })
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
- S.displayName = "SelectTrigger";
102
- function L({
103
- className: t,
104
- children: a,
70
+ z.displayName = "SelectTrigger";
71
+ function k({
72
+ className: e,
73
+ children: r,
105
74
  position: n = "popper",
106
- ...i
75
+ ...s
107
76
  }) {
108
- const d = o(
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
- ), s = n === "popper" && o(
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__ */ e(r.Portal, { children: /* @__PURE__ */ p(
132
- r.Content,
100
+ return /* @__PURE__ */ t(a.Portal, { children: /* @__PURE__ */ d(
101
+ a.Content,
133
102
  {
134
- className: o(d, s, t),
103
+ className: o(i, l, e),
135
104
  "data-slot": "select-content",
136
105
  position: n,
137
- ...i,
106
+ ...s,
138
107
  children: [
139
- /* @__PURE__ */ e(y, {}),
140
- /* @__PURE__ */ e(
141
- r.Viewport,
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: a
116
+ children: r
148
117
  }
149
118
  ),
150
- /* @__PURE__ */ e(N, {})
119
+ /* @__PURE__ */ t(p, {})
151
120
  ]
152
121
  }
153
122
  ) });
154
123
  }
155
- L.displayName = "SelectContent";
156
- function D({
157
- className: t,
158
- ...a
124
+ k.displayName = "SelectContent";
125
+ function I({
126
+ className: e,
127
+ ...r
159
128
  }) {
160
- return /* @__PURE__ */ e(
161
- r.Label,
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
- t
134
+ e
166
135
  ),
167
136
  "data-slot": "select-label",
168
- ...a
137
+ ...r
169
138
  }
170
139
  );
171
140
  }
172
- D.displayName = "SelectLabel";
173
- function P({
174
- className: t,
175
- children: a,
141
+ I.displayName = "SelectLabel";
142
+ function _({
143
+ className: e,
144
+ children: r,
176
145
  ...n
177
146
  }) {
178
- const i = o(
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__ */ p(
196
- r.Item,
164
+ return /* @__PURE__ */ d(
165
+ a.Item,
197
166
  {
198
- className: o(i, t),
167
+ className: o(s, e),
199
168
  "data-slot": "select-item",
200
169
  ...n,
201
170
  children: [
202
- /* @__PURE__ */ e("span", { className: "absolute right-2 flex size-4 items-center justify-center", children: /* @__PURE__ */ e(r.ItemIndicator, { children: /* @__PURE__ */ e(k, { className: "size-4" }) }) }),
203
- /* @__PURE__ */ e(r.ItemText, { children: a })
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
- P.displayName = "SelectItem";
209
- function R({
210
- className: t,
211
- ...a
177
+ _.displayName = "SelectItem";
178
+ function C({
179
+ className: e,
180
+ ...r
212
181
  }) {
213
- return /* @__PURE__ */ e(
214
- r.Separator,
182
+ return /* @__PURE__ */ t(
183
+ a.Separator,
215
184
  {
216
- className: o("bg-border pointer-events-none -mx-1 my-1 h-px", t),
185
+ className: o("bg-border pointer-events-none -mx-1 my-1 h-px", e),
217
186
  "data-slot": "select-separator",
218
- ...a
187
+ ...r
219
188
  }
220
189
  );
221
190
  }
222
- R.displayName = "SelectSeparator";
223
- function y({
224
- className: t,
225
- ...a
191
+ C.displayName = "SelectSeparator";
192
+ function m({
193
+ className: e,
194
+ ...r
226
195
  }) {
227
- return /* @__PURE__ */ e(
228
- r.ScrollUpButton,
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
- t
201
+ e
233
202
  ),
234
203
  "data-slot": "select-scroll-up-button",
235
- ...a,
236
- children: /* @__PURE__ */ e(C, { className: "size-4" })
204
+ ...r,
205
+ children: /* @__PURE__ */ t(h, { className: "size-4" })
237
206
  }
238
207
  );
239
208
  }
240
- y.displayName = "SelectScrollUpButton";
241
- function N({
242
- className: t,
243
- ...a
209
+ m.displayName = "SelectScrollUpButton";
210
+ function p({
211
+ className: e,
212
+ ...r
244
213
  }) {
245
- return /* @__PURE__ */ e(
246
- r.ScrollDownButton,
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
- t
219
+ e
251
220
  ),
252
221
  "data-slot": "select-scroll-down-button",
253
- ...a,
254
- children: /* @__PURE__ */ e(x, { className: "size-4" })
222
+ ...r,
223
+ children: /* @__PURE__ */ t(u, { className: "size-4" })
255
224
  }
256
225
  );
257
226
  }
258
- N.displayName = "SelectScrollDownButton";
227
+ p.displayName = "SelectScrollDownButton";
259
228
  export {
260
- j as Select,
261
- L as SelectContent,
262
- B as SelectGroup,
263
- P as SelectItem,
264
- D as SelectLabel,
265
- N as SelectScrollDownButton,
266
- y as SelectScrollUpButton,
267
- R as SelectSeparator,
268
- S as SelectTrigger,
269
- V as SelectValue
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 { toast as f, Toaster as N } from "sonner";
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?: "default" | "box" | null | undefined;
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.1",
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": "^20",
92
- "@types/react": "^19.2.7",
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.1",
94
+ "@vitejs/plugin-react": "^5.1.2",
95
95
  "size-limit": "^12.0.0",
96
96
  "typescript": "5.9.3",
97
- "vite": "^6.4.1",
97
+ "vite": "^7.3.1",
98
98
  "vite-bundle-visualizer": "^1.2.1",
99
- "vite-plugin-dts": "^4.3.0",
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.23.24",
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.11.2",
149
+ "react-day-picker": "^9.13.0",
150
150
  "react-resizable-panels": "^3.0.6",
151
- "recharts": "^3.5.0",
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: p-6 (spacing.6 = 24px) all around
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 p-6 padding (container-padding-x token) and gap-4 for header/content spacing
87
- "bg-background flex min-h-screen flex-col items-center justify-center gap-4 p-6",
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