@brightlocal/ui-components 2.11.0 → 2.13.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 (154) hide show
  1. package/component-meta.json +474 -27
  2. package/dist/blocks/data-table.cjs +1 -1
  3. package/dist/blocks/data-table.d.ts +16 -4
  4. package/dist/blocks/data-table.d.ts.map +1 -1
  5. package/dist/blocks/data-table.js +57 -53
  6. package/dist/blocks/input-list.cjs +2 -2
  7. package/dist/blocks/input-list.d.ts +7 -1
  8. package/dist/blocks/input-list.d.ts.map +1 -1
  9. package/dist/blocks/input-list.js +82 -81
  10. package/dist/blocks/sidebar.cjs +1 -1
  11. package/dist/blocks/sidebar.d.ts +221 -11
  12. package/dist/blocks/sidebar.d.ts.map +1 -1
  13. package/dist/blocks/sidebar.js +687 -406
  14. package/dist/breadcrumb.cjs +1 -1
  15. package/dist/breadcrumb.d.ts +14 -2
  16. package/dist/breadcrumb.d.ts.map +1 -1
  17. package/dist/breadcrumb.js +37 -37
  18. package/dist/callout.cjs +1 -1
  19. package/dist/callout.d.ts +3 -3
  20. package/dist/callout.d.ts.map +1 -1
  21. package/dist/callout.js +2 -1
  22. package/dist/carousel.cjs +1 -1
  23. package/dist/carousel.d.ts +24 -3
  24. package/dist/carousel.d.ts.map +1 -1
  25. package/dist/carousel.js +121 -117
  26. package/dist/chip.cjs +1 -1
  27. package/dist/chip.d.ts +11 -0
  28. package/dist/chip.d.ts.map +1 -1
  29. package/dist/chip.js +43 -38
  30. package/dist/combobox.cjs +3 -3
  31. package/dist/combobox.d.ts +20 -2
  32. package/dist/combobox.d.ts.map +1 -1
  33. package/dist/combobox.js +244 -238
  34. package/dist/command.cjs +1 -1
  35. package/dist/command.d.ts +5 -0
  36. package/dist/command.d.ts.map +1 -1
  37. package/dist/command.js +207 -206
  38. package/dist/date-picker.cjs +1 -1
  39. package/dist/date-picker.d.ts +10 -0
  40. package/dist/date-picker.d.ts.map +1 -1
  41. package/dist/date-picker.js +96 -96
  42. package/dist/dialog.cjs +1 -1
  43. package/dist/dialog.d.ts +7 -2
  44. package/dist/dialog.d.ts.map +1 -1
  45. package/dist/dialog.js +38 -30
  46. package/dist/drawer.d.ts +2 -2
  47. package/dist/dropdown-menu.cjs +1 -1
  48. package/dist/dropdown-menu.js +1 -1
  49. package/dist/global-layout.cjs +1 -1
  50. package/dist/global-layout.d.ts +5 -0
  51. package/dist/global-layout.d.ts.map +1 -1
  52. package/dist/global-layout.js +15 -7
  53. package/dist/index.cjs +1 -1
  54. package/dist/index.js +313 -305
  55. package/dist/input-chip.cjs +1 -1
  56. package/dist/input-chip.d.ts +7 -1
  57. package/dist/input-chip.d.ts.map +1 -1
  58. package/dist/input-chip.js +131 -130
  59. package/dist/input-group.d.ts +1 -1
  60. package/dist/input-password.cjs +1 -1
  61. package/dist/input-password.d.ts +10 -0
  62. package/dist/input-password.d.ts.map +1 -1
  63. package/dist/input-password.js +108 -106
  64. package/dist/link.cjs +1 -1
  65. package/dist/link.d.ts +1 -1
  66. package/dist/link.d.ts.map +1 -1
  67. package/dist/link.js +36 -37
  68. package/dist/list.cjs +1 -1
  69. package/dist/list.d.ts +25 -4
  70. package/dist/list.d.ts.map +1 -1
  71. package/dist/list.js +71 -53
  72. package/dist/logo.cjs +1 -1
  73. package/dist/logo.d.ts +6 -1
  74. package/dist/logo.d.ts.map +1 -1
  75. package/dist/logo.js +25 -22
  76. package/dist/map.cjs +1 -1
  77. package/dist/map.d.ts +17 -2
  78. package/dist/map.d.ts.map +1 -1
  79. package/dist/map.js +32 -26
  80. package/dist/pagination.cjs +1 -1
  81. package/dist/pagination.d.ts +29 -3
  82. package/dist/pagination.d.ts.map +1 -1
  83. package/dist/pagination.js +26 -25
  84. package/dist/popover.cjs +1 -1
  85. package/dist/popover.js +7 -7
  86. package/dist/rating.cjs +1 -1
  87. package/dist/rating.d.ts +6 -0
  88. package/dist/rating.d.ts.map +1 -1
  89. package/dist/rating.js +28 -20
  90. package/dist/resizable.d.ts +1 -1
  91. package/dist/select.cjs +2 -2
  92. package/dist/select.d.ts +17 -3
  93. package/dist/select.d.ts.map +1 -1
  94. package/dist/select.js +65 -58
  95. package/dist/separator.cjs +1 -1
  96. package/dist/separator.d.ts +16 -4
  97. package/dist/separator.d.ts.map +1 -1
  98. package/dist/separator.js +38 -35
  99. package/dist/sheet.cjs +1 -1
  100. package/dist/sheet.d.ts +6 -1
  101. package/dist/sheet.d.ts.map +1 -1
  102. package/dist/sheet.js +42 -41
  103. package/dist/skeleton.cjs +1 -1
  104. package/dist/skeleton.d.ts +5 -0
  105. package/dist/skeleton.d.ts.map +1 -1
  106. package/dist/skeleton.js +13 -11
  107. package/dist/table.cjs +1 -1
  108. package/dist/table.d.ts +14 -0
  109. package/dist/table.d.ts.map +1 -1
  110. package/dist/table.js +57 -39
  111. package/dist/tabs.cjs +1 -1
  112. package/dist/tabs.d.ts +25 -9
  113. package/dist/tabs.d.ts.map +1 -1
  114. package/dist/tabs.js +128 -113
  115. package/dist/text-reveal-motion.cjs +1 -1
  116. package/dist/text-reveal-motion.d.ts +5 -0
  117. package/dist/text-reveal-motion.d.ts.map +1 -1
  118. package/dist/text-reveal-motion.js +111 -110
  119. package/dist/typography.cjs +1 -1
  120. package/dist/typography.d.ts +1 -2
  121. package/dist/typography.d.ts.map +1 -1
  122. package/dist/typography.js +49 -50
  123. package/package.json +2 -3
  124. package/src/blocks/data-table.tsx +26 -9
  125. package/src/blocks/input-list.tsx +12 -1
  126. package/src/blocks/sidebar.tsx +638 -29
  127. package/src/components/breadcrumb.tsx +43 -26
  128. package/src/components/callout.tsx +5 -4
  129. package/src/components/carousel.tsx +33 -4
  130. package/src/components/chip.tsx +22 -2
  131. package/src/components/combobox.tsx +28 -3
  132. package/src/components/command.tsx +7 -1
  133. package/src/components/date-picker.tsx +17 -3
  134. package/src/components/dialog.tsx +17 -4
  135. package/src/components/drawer.tsx +2 -2
  136. package/src/components/dropdown-menu.tsx +1 -1
  137. package/src/components/global-layout.tsx +15 -2
  138. package/src/components/input-chip.tsx +12 -1
  139. package/src/components/input-password.tsx +73 -49
  140. package/src/components/link.tsx +29 -17
  141. package/src/components/list.tsx +45 -2
  142. package/src/components/logo.tsx +10 -2
  143. package/src/components/map.tsx +23 -0
  144. package/src/components/pagination.tsx +44 -11
  145. package/src/components/popover.tsx +1 -1
  146. package/src/components/rating.tsx +21 -3
  147. package/src/components/select.tsx +33 -3
  148. package/src/components/separator.tsx +40 -25
  149. package/src/components/sheet.tsx +28 -20
  150. package/src/components/skeleton.tsx +13 -2
  151. package/src/components/table.tsx +39 -2
  152. package/src/components/tabs.tsx +195 -146
  153. package/src/components/text-reveal-motion.tsx +7 -1
  154. package/src/components/typography.tsx +6 -7
package/dist/carousel.js CHANGED
@@ -1,12 +1,12 @@
1
- import { jsx as p, jsxs as R } from "react/jsx-runtime";
1
+ import { jsx as p, jsxs as D } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
3
  import $ from "embla-carousel-react";
4
4
  import { ArrowRight as q, ArrowLeft as F } from "@brightlocal/icons";
5
5
  import { cn as C } from "@brightlocal/ui-components/lib/utils";
6
- import { Button as E } from "@brightlocal/ui-components/button";
7
- const D = o.createContext(null);
8
- function v() {
9
- const r = o.useContext(D);
6
+ import { Button as V } from "@brightlocal/ui-components/button";
7
+ const M = o.createContext(null);
8
+ function k() {
9
+ const r = o.useContext(M);
10
10
  if (!r)
11
11
  throw new Error("useCarousel must be used within a <Carousel />");
12
12
  return r;
@@ -14,101 +14,101 @@ function v() {
14
14
  const H = o.forwardRef(
15
15
  ({
16
16
  orientation: r = "horizontal",
17
- opts: l,
17
+ opts: s,
18
18
  setApi: n,
19
19
  plugins: d,
20
20
  className: f,
21
- children: t,
22
- dataHook: c,
23
- trackingEl: i,
24
- trackingLabel: s,
25
- lazyLoad: m = !1,
21
+ children: c,
22
+ dataHook: u,
23
+ trackingEl: t,
24
+ trackingLabel: i,
25
+ lazyLoad: l = !1,
26
26
  overscan: h = 1,
27
- ...u
28
- }, M) => {
29
- const [K, e] = $(
27
+ ...w
28
+ }, v) => {
29
+ const [m, e] = $(
30
30
  {
31
- ...l,
31
+ ...s,
32
32
  axis: r === "horizontal" ? "x" : "y"
33
33
  },
34
34
  d
35
- ), [L, j] = o.useState(!1), [O, A] = o.useState(!1), g = Math.max(0, Math.floor(h)), [B, G] = o.useState(() => {
36
- if (!m) return /* @__PURE__ */ new Set();
37
- const a = l?.startIndex ?? 0, b = /* @__PURE__ */ new Set();
38
- for (let S = Math.max(0, a - g); S <= a + g; S++)
39
- b.add(S);
35
+ ), [j, L] = o.useState(!1), [O, A] = o.useState(!1), N = Math.max(0, Math.floor(h)), [B, G] = o.useState(() => {
36
+ if (!l) return /* @__PURE__ */ new Set();
37
+ const a = s?.startIndex ?? 0, b = /* @__PURE__ */ new Set();
38
+ for (let x = Math.max(0, a - N); x <= a + N; x++)
39
+ b.add(x);
40
40
  return b;
41
- }), w = o.useCallback((a) => {
42
- a && (j(a.canScrollPrev()), A(a.canScrollNext()));
43
- }, []), N = o.useCallback(() => {
41
+ }), g = o.useCallback((a) => {
42
+ a && (L(a.canScrollPrev()), A(a.canScrollNext()));
43
+ }, []), y = o.useCallback(() => {
44
44
  e?.scrollPrev();
45
- }, [e]), k = o.useCallback(() => {
45
+ }, [e]), I = o.useCallback(() => {
46
46
  e?.scrollNext();
47
47
  }, [e]), T = o.useCallback(
48
48
  (a) => {
49
- const b = r === "horizontal" ? "ArrowLeft" : "ArrowUp", S = r === "horizontal" ? "ArrowRight" : "ArrowDown";
50
- a.key === b ? (a.preventDefault(), N()) : a.key === S && (a.preventDefault(), k());
49
+ const b = r === "horizontal" ? "ArrowLeft" : "ArrowUp", x = r === "horizontal" ? "ArrowRight" : "ArrowDown";
50
+ a.key === b ? (a.preventDefault(), y()) : a.key === x && (a.preventDefault(), I());
51
51
  },
52
- [r, N, k]
52
+ [r, y, I]
53
53
  );
54
54
  o.useEffect(() => {
55
55
  !e || !n || n(e);
56
56
  }, [e, n]), o.useEffect(() => {
57
57
  if (e)
58
- return w(e), e.on("reInit", w), e.on("select", w), () => {
59
- e?.off("reInit", w), e?.off("select", w);
58
+ return g(e), e.on("reInit", g), e.on("select", g), () => {
59
+ e?.off("reInit", g), e?.off("select", g);
60
60
  };
61
- }, [e, w]);
62
- const x = o.useCallback(
61
+ }, [e, g]);
62
+ const S = o.useCallback(
63
63
  (a) => {
64
- if (!a || !m) return;
65
- const b = a.slidesInView(), S = a.slideNodes().length;
66
- G((y) => {
67
- const I = new Set(y);
68
- for (const z of b) {
69
- const U = Math.max(0, z - g), _ = Math.min(S - 1, z + g);
70
- for (let P = U; P <= _; P++)
71
- I.add(P);
64
+ if (!a || !l) return;
65
+ const b = a.slidesInView(), x = a.slideNodes().length;
66
+ G((P) => {
67
+ const z = new Set(P);
68
+ for (const E of b) {
69
+ const U = Math.max(0, E - N), _ = Math.min(x - 1, E + N);
70
+ for (let R = U; R <= _; R++)
71
+ z.add(R);
72
72
  }
73
- return I.size === y.size ? y : I;
73
+ return z.size === P.size ? P : z;
74
74
  });
75
75
  },
76
- [m, g]
76
+ [l, N]
77
77
  );
78
78
  return o.useEffect(() => {
79
- if (!(!e || !m))
80
- return x(e), e.on("slidesInView", x), e.on("select", x), e.on("reInit", x), () => {
81
- e.off("slidesInView", x), e.off("select", x), e.off("reInit", x);
79
+ if (!(!e || !l))
80
+ return S(e), e.on("slidesInView", S), e.on("select", S), e.on("reInit", S), () => {
81
+ e.off("slidesInView", S), e.off("select", S), e.off("reInit", S);
82
82
  };
83
- }, [e, m, x]), /* @__PURE__ */ p(
84
- D.Provider,
83
+ }, [e, l, S]), /* @__PURE__ */ p(
84
+ M.Provider,
85
85
  {
86
86
  value: {
87
- carouselRef: K,
87
+ carouselRef: m,
88
88
  api: e,
89
- opts: l,
90
- orientation: r || (l?.axis === "y" ? "vertical" : "horizontal"),
91
- scrollPrev: N,
92
- scrollNext: k,
93
- canScrollPrev: L,
89
+ opts: s,
90
+ orientation: r || (s?.axis === "y" ? "vertical" : "horizontal"),
91
+ scrollPrev: y,
92
+ scrollNext: I,
93
+ canScrollPrev: j,
94
94
  canScrollNext: O,
95
- lazyLoad: m,
95
+ lazyLoad: l,
96
96
  loadedSlides: B
97
97
  },
98
98
  children: /* @__PURE__ */ p(
99
99
  "div",
100
100
  {
101
- ref: M,
101
+ ref: v,
102
102
  "aria-roledescription": "carousel",
103
103
  className: C("relative", f),
104
- "data-hook": c,
104
+ "data-hook": u,
105
105
  "data-slot": "carousel",
106
- "data-tracking-el": i,
107
- "data-tracking-label": s,
106
+ "data-tracking-el": t,
107
+ "data-tracking-label": i,
108
108
  role: "region",
109
109
  onKeyDownCapture: T,
110
- ...u,
111
- children: t
110
+ ...w,
111
+ children: c
112
112
  }
113
113
  )
114
114
  }
@@ -116,24 +116,24 @@ const H = o.forwardRef(
116
116
  }
117
117
  );
118
118
  H.displayName = "Carousel";
119
- const J = o.forwardRef(({ className: r, children: l, ...n }, d) => {
120
- const { carouselRef: f, orientation: t, lazyLoad: c } = v(), i = t === "vertical";
121
- let s = 0;
122
- const m = c ? o.Children.map(l, (h) => {
123
- if (o.isValidElement(h) && h.type === V) {
124
- const u = s++;
119
+ const J = o.forwardRef(({ className: r, children: s, ...n }, d) => {
120
+ const { carouselRef: f, orientation: c, lazyLoad: u } = k(), t = c === "vertical";
121
+ let i = 0;
122
+ const l = u ? o.Children.map(s, (h) => {
123
+ if (o.isValidElement(h) && h.type === K) {
124
+ const w = i++;
125
125
  return o.cloneElement(
126
126
  h,
127
- { _lazyIndex: u }
127
+ { _lazyIndex: w }
128
128
  );
129
129
  }
130
130
  return h;
131
- }) : l;
131
+ }) : s;
132
132
  return /* @__PURE__ */ p(
133
133
  "div",
134
134
  {
135
135
  ref: f,
136
- className: C("overflow-hidden", i && "w-full", r),
136
+ className: C("overflow-hidden", t && "w-full", r),
137
137
  "data-slot": "carousel-content",
138
138
  children: /* @__PURE__ */ p(
139
139
  "div",
@@ -141,18 +141,18 @@ const J = o.forwardRef(({ className: r, children: l, ...n }, d) => {
141
141
  ref: d,
142
142
  className: C(
143
143
  "flex",
144
- i ? "-mt-4 h-full w-full flex-col" : "-ml-4"
144
+ t ? "-mt-4 h-full w-full flex-col" : "-ml-4"
145
145
  ),
146
146
  ...n,
147
- children: m
147
+ children: l
148
148
  }
149
149
  )
150
150
  }
151
151
  );
152
152
  });
153
153
  J.displayName = "CarouselContent";
154
- const V = o.forwardRef(({ className: r, children: l, _lazyIndex: n, ...d }, f) => {
155
- const { orientation: t, lazyLoad: c, loadedSlides: i } = v(), s = !c || n === void 0 || i.has(n);
154
+ const K = o.forwardRef(({ className: r, children: s, _lazyIndex: n, ...d }, f) => {
155
+ const { orientation: c, lazyLoad: u, loadedSlides: t } = k(), i = !u || n === void 0 || t.has(n);
156
156
  return /* @__PURE__ */ p(
157
157
  "div",
158
158
  {
@@ -160,46 +160,47 @@ const V = o.forwardRef(({ className: r, children: l, _lazyIndex: n, ...d }, f) =
160
160
  "aria-roledescription": "slide",
161
161
  className: C(
162
162
  "min-w-0 shrink-0 grow-0 basis-full",
163
- t === "horizontal" ? "pl-4" : "w-full pt-4",
163
+ c === "horizontal" ? "pl-4" : "w-full pt-4",
164
164
  r
165
165
  ),
166
- "data-lazy-loaded": c ? String(s) : void 0,
166
+ "data-lazy-loaded": u ? String(i) : void 0,
167
167
  "data-slot": "carousel-item",
168
168
  role: "group",
169
169
  ...d,
170
- children: s ? l : null
170
+ children: i ? s : null
171
171
  }
172
172
  );
173
173
  });
174
- V.displayName = "CarouselItem";
174
+ K.displayName = "CarouselItem";
175
175
  function Q({
176
176
  className: r,
177
- variant: l = "outline",
177
+ variant: s = "outline",
178
178
  size: n = "default",
179
179
  dataHook: d = "carousel-previous",
180
180
  hideWhenDisabled: f = !1,
181
- ...t
181
+ ariaLabel: c = "Previous slide",
182
+ ...u
182
183
  }) {
183
- const { orientation: c, scrollPrev: i, canScrollPrev: s } = v();
184
- return f && !s ? null : /* @__PURE__ */ R(
185
- E,
184
+ const { orientation: t, scrollPrev: i, canScrollPrev: l } = k();
185
+ return f && !l ? null : /* @__PURE__ */ D(
186
+ V,
186
187
  {
187
188
  iconOnly: !0,
188
189
  className: C(
189
190
  "absolute",
190
- c === "horizontal" ? "top-1/2 left-1 -translate-y-1/2 sm:-left-12" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
191
+ t === "horizontal" ? "top-1/2 left-1 -translate-y-1/2 sm:-left-12" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
191
192
  r
192
193
  ),
193
194
  "data-slot": "carousel-previous",
194
195
  dataHook: d,
195
- disabled: !s,
196
+ disabled: !l,
196
197
  size: n,
197
- variant: l,
198
+ variant: s,
198
199
  onClick: i,
199
- ...t,
200
+ ...u,
200
201
  children: [
201
202
  /* @__PURE__ */ p(F, {}),
202
- /* @__PURE__ */ p("span", { className: "sr-only", children: "Previous slide" })
203
+ /* @__PURE__ */ p("span", { className: "sr-only", children: c })
203
204
  ]
204
205
  }
205
206
  );
@@ -207,32 +208,33 @@ function Q({
207
208
  Q.displayName = "CarouselPrevious";
208
209
  function W({
209
210
  className: r,
210
- variant: l = "outline",
211
+ variant: s = "outline",
211
212
  size: n = "default",
212
213
  dataHook: d = "carousel-next",
213
214
  hideWhenDisabled: f = !1,
214
- ...t
215
+ ariaLabel: c = "Next slide",
216
+ ...u
215
217
  }) {
216
- const { orientation: c, scrollNext: i, canScrollNext: s } = v();
217
- return f && !s ? null : /* @__PURE__ */ R(
218
- E,
218
+ const { orientation: t, scrollNext: i, canScrollNext: l } = k();
219
+ return f && !l ? null : /* @__PURE__ */ D(
220
+ V,
219
221
  {
220
222
  iconOnly: !0,
221
223
  className: C(
222
224
  "absolute",
223
- c === "horizontal" ? "top-1/2 right-1 -translate-y-1/2 sm:-right-12" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
225
+ t === "horizontal" ? "top-1/2 right-1 -translate-y-1/2 sm:-right-12" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
224
226
  r
225
227
  ),
226
228
  "data-slot": "carousel-next",
227
229
  dataHook: d,
228
- disabled: !s,
230
+ disabled: !l,
229
231
  size: n,
230
- variant: l,
232
+ variant: s,
231
233
  onClick: i,
232
- ...t,
234
+ ...u,
233
235
  children: [
234
236
  /* @__PURE__ */ p(q, {}),
235
- /* @__PURE__ */ p("span", { className: "sr-only", children: "Next slide" })
237
+ /* @__PURE__ */ p("span", { className: "sr-only", children: c })
236
238
  ]
237
239
  }
238
240
  );
@@ -240,51 +242,53 @@ function W({
240
242
  W.displayName = "CarouselNext";
241
243
  function X({
242
244
  className: r,
243
- dataHook: l = "carousel-dots",
245
+ dataHook: s = "carousel-dots",
244
246
  trackingEl: n,
245
247
  trackingLabel: d,
246
- ...f
248
+ ariaLabel: f = "Slide navigation",
249
+ slideAriaLabel: c,
250
+ ...u
247
251
  }) {
248
- const { api: t } = v(), [c, i] = o.useState(0), [s, m] = o.useState([]);
252
+ const { api: t } = k(), [i, l] = o.useState(0), [h, w] = o.useState([]);
249
253
  return o.useEffect(() => {
250
254
  if (!t) return;
251
- m(t.scrollSnapList()), i(t.selectedScrollSnap());
252
- const h = () => {
253
- i(t.selectedScrollSnap());
254
- }, u = () => {
255
- m(t.scrollSnapList()), i(t.selectedScrollSnap());
255
+ w(t.scrollSnapList()), l(t.selectedScrollSnap());
256
+ const v = () => {
257
+ l(t.selectedScrollSnap());
258
+ }, m = () => {
259
+ w(t.scrollSnapList()), l(t.selectedScrollSnap());
256
260
  };
257
- return t.on("select", h), t.on("reInit", u), () => {
258
- t.off("select", h), t.off("reInit", u);
261
+ return t.on("select", v), t.on("reInit", m), () => {
262
+ t.off("select", v), t.off("reInit", m);
259
263
  };
260
- }, [t]), s.length === 0 ? null : /* @__PURE__ */ p(
264
+ }, [t]), h.length === 0 ? null : /* @__PURE__ */ p(
261
265
  "div",
262
266
  {
263
- "aria-label": "Slide navigation",
267
+ "aria-label": f,
264
268
  className: C(
265
269
  "border-border dark:border-input dark:bg-input/30 inline-flex items-center justify-center gap-2 rounded-full border bg-white px-2.5 py-2",
266
270
  r
267
271
  ),
268
- "data-hook": l,
272
+ "data-hook": s,
269
273
  "data-slot": "carousel-dots",
270
274
  "data-tracking-el": n,
271
275
  "data-tracking-label": d,
272
276
  role: "group",
273
- ...f,
274
- children: s.map((h, u) => /* @__PURE__ */ p(
277
+ ...u,
278
+ children: h.map((v, m) => /* @__PURE__ */ p(
275
279
  "button",
276
280
  {
277
- "aria-current": u === c ? "step" : void 0,
278
- "aria-label": `Go to slide ${u + 1}`,
281
+ "aria-current": m === i ? "step" : void 0,
282
+ "aria-label": c ? c.replace("{slide}", String(m + 1)) : `Go to slide ${m + 1}`,
279
283
  className: C(
280
284
  "focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",
281
- u === c ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9" : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"
285
+ m === i ? "bg-muted-foreground/50 dark:bg-muted-foreground/70 w-9" : "bg-input hover:bg-muted-foreground/30 dark:bg-input/80 dark:hover:bg-muted-foreground/50"
282
286
  ),
283
287
  "data-slot": "carousel-dot",
284
288
  type: "button",
285
- onClick: () => t?.scrollTo(u)
289
+ onClick: () => t?.scrollTo(m)
286
290
  },
287
- u
291
+ m
288
292
  ))
289
293
  }
290
294
  );
@@ -294,7 +298,7 @@ export {
294
298
  H as Carousel,
295
299
  J as CarouselContent,
296
300
  X as CarouselDots,
297
- V as CarouselItem,
301
+ K as CarouselItem,
298
302
  W as CarouselNext,
299
303
  Q as CarouselPrevious
300
304
  };
package/dist/chip.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("react"),g=require("class-variance-authority"),h=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),o=require("@brightlocal/ui-components/tooltip");function R(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:()=>a[n]})}}return t.default=a,Object.freeze(t)}const r=R(O),x=g.cva(["inline-flex","items-center","justify-center","gap-0.5","rounded-full","font-medium","whitespace-nowrap","shrink-0","select-none","bg-secondary","text-foreground","transition-[color,background-color,box-shadow]","duration-150","ease-in-out","hover:bg-secondary/80","focus:outline-none","focus-visible:shadow-default","disabled:pointer-events-none","disabled:opacity-50","aria-disabled:pointer-events-none","aria-disabled:opacity-50"],{variants:{size:{md:["h-7","pl-2.5","pr-1","text-xs"],lg:["h-8","pl-4","pr-2","text-base"]}},defaultVariants:{size:"md"}}),m=g.cva(["inline-flex","items-center","justify-center","rounded-full","cursor-pointer","text-muted-foreground","hover:text-foreground","outline-none","focus-visible:text-foreground","disabled:pointer-events-none","disabled:opacity-50"],{variants:{size:{md:["size-6"],lg:["size-6"]}},defaultVariants:{size:"md"}}),v=r.forwardRef(({className:a,children:t,size:n="md",loading:i=!1,disabled:j=!1,onRemove:y,dataHook:u,trackingEl:l,trackingLabel:w,maxWidth:T=200,...z},C)=>{const p=j||i,f=16,s=r.useRef(null),[k,N]=r.useState(!1);r.useEffect(()=>{const c=()=>{s.current&&N(s.current.scrollWidth>s.current.clientWidth)};return c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)},[t]);const b=e.jsx("span",{ref:s,className:"truncate","data-slot":"chip-label",style:{maxWidth:T},children:t});return e.jsxs("div",{ref:C,"aria-disabled":p?"true":void 0,className:d.cn(x({size:n}),a),"data-hook":u,"data-slot":"chip","data-tracking-el":l,"data-tracking-label":w,...z,children:[k?e.jsx(o.TooltipProvider,{children:e.jsxs(o.Tooltip,{children:[e.jsx(o.TooltipTrigger,{asChild:!0,children:b}),e.jsx(o.TooltipContent,{dataHook:`${u}-tooltip`,sideOffset:8,children:t})]})}):b,i?e.jsx("span",{"aria-label":"Loading",className:d.cn(m({size:n})),"data-slot":"chip-loading",role:"status",children:e.jsx(h.LoaderCircle,{className:"animate-spin motion-reduce:animate-none",size:f})}):e.jsx("button",{"aria-label":`Remove ${typeof t=="string"?t:"chip"}`,className:d.cn(m({size:n})),"data-slot":"chip-delete","data-tracking-el":l?`${l}-delete`:void 0,disabled:p,tabIndex:-1,type:"button",onClick:y,children:e.jsx(h.X,{size:f})})]})});v.displayName="Chip";exports.Chip=v;exports.chipVariants=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),q=require("react"),x=require("class-variance-authority"),h=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),o=require("@brightlocal/ui-components/tooltip");function S(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:()=>a[n]})}}return e.default=a,Object.freeze(e)}const r=S(q),v=x.cva(["inline-flex","items-center","justify-center","gap-0.5","rounded-full","font-medium","whitespace-nowrap","shrink-0","select-none","bg-secondary","text-foreground","transition-[color,background-color,box-shadow]","duration-150","ease-in-out","hover:bg-secondary/80","focus:outline-none","focus-visible:shadow-default","disabled:pointer-events-none","disabled:opacity-50","aria-disabled:pointer-events-none","aria-disabled:opacity-50"],{variants:{size:{md:["h-7","pl-2.5","pr-1","text-xs"],lg:["h-8","pl-4","pr-2","text-base"]}},defaultVariants:{size:"md"}}),g=x.cva(["inline-flex","items-center","justify-center","rounded-full","cursor-pointer","text-muted-foreground","hover:text-foreground","outline-none","focus-visible:text-foreground","disabled:pointer-events-none","disabled:opacity-50"],{variants:{size:{md:["size-6"],lg:["size-6"]}},defaultVariants:{size:"md"}}),j=r.forwardRef(({className:a,children:e,size:n="md",loading:s=!1,disabled:y=!1,onRemove:w,dataHook:u,trackingEl:c,trackingLabel:T,maxWidth:z=200,loadingLabel:C,removeAriaLabel:p,...k},N)=>{const f=y||s,b=16,i=r.useRef(null),[O,R]=r.useState(!1);r.useEffect(()=>{const l=()=>{i.current&&R(i.current.scrollWidth>i.current.clientWidth)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[e]);const m=t.jsx("span",{ref:i,className:"truncate","data-slot":"chip-label",style:{maxWidth:z},children:e});return t.jsxs("div",{ref:N,"aria-disabled":f?"true":void 0,className:d.cn(v({size:n}),a),"data-hook":u,"data-slot":"chip","data-tracking-el":c,"data-tracking-label":T,...k,children:[O?t.jsx(o.TooltipProvider,{children:t.jsxs(o.Tooltip,{children:[t.jsx(o.TooltipTrigger,{asChild:!0,children:m}),t.jsx(o.TooltipContent,{dataHook:`${u}-tooltip`,sideOffset:8,children:e})]})}):m,s?t.jsx("span",{"aria-label":C??"Loading",className:d.cn(g({size:n})),"data-slot":"chip-loading",role:"status",children:t.jsx(h.LoaderCircle,{className:"animate-spin motion-reduce:animate-none",size:b})}):t.jsx("button",{"aria-label":p?p.replace("{name}",typeof e=="string"?e:"chip"):`Remove ${typeof e=="string"?e:"chip"}`,className:d.cn(g({size:n})),"data-slot":"chip-delete","data-tracking-el":c?`${c}-delete`:void 0,disabled:f,tabIndex:-1,type:"button",onClick:w,children:t.jsx(h.X,{size:b})})]})});j.displayName="Chip";exports.Chip=j;exports.chipVariants=v;
package/dist/chip.d.ts CHANGED
@@ -50,6 +50,17 @@ interface ChipProps extends Omit<React.ComponentProps<"div">, "children"> {
50
50
  * @default 200
51
51
  */
52
52
  maxWidth?: number;
53
+ /**
54
+ * Accessible label for the loading spinner.
55
+ * @default "Loading"
56
+ */
57
+ loadingLabel?: string;
58
+ /**
59
+ * Accessible label for the remove button.
60
+ * Supports `{name}` placeholder for interpolation.
61
+ * @default "Remove {name}"
62
+ */
63
+ removeAriaLabel?: string;
53
64
  }
54
65
  /**
55
66
  * Chip component for displaying removable tags or selections.
@@ -1 +1 @@
1
- {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B;;GAEG;AACH,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5B,QAAA,MAAM,YAAY;;8EAyCjB,CAAC;AAkCF;;GAEG;AACH,UAAU,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAChE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,+FAmGT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"chip.d.ts","sourceRoot":"","sources":["../../src/components/chip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAY/B;;GAEG;AACH,KAAK,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5B,QAAA,MAAM,YAAY;;8EAyCjB,CAAC;AAkCF;;GAEG;AACH,UAAU,SAAU,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACvE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAChE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,QAAA,MAAM,IAAI,+FA4GT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAC9B,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
package/dist/chip.js CHANGED
@@ -1,10 +1,10 @@
1
- import { jsxs as f, jsx as e } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import { cva as b } from "class-variance-authority";
4
- import { LoaderCircle as k, X as N } from "@brightlocal/icons";
3
+ import { cva as h } from "class-variance-authority";
4
+ import { LoaderCircle as R, X as j } from "@brightlocal/icons";
5
5
  import { cn as r } from "@brightlocal/ui-components/lib/utils";
6
- import { TooltipProvider as R, Tooltip as j, TooltipTrigger as L, TooltipContent as V } from "@brightlocal/ui-components/tooltip";
7
- const $ = b(
6
+ import { TooltipProvider as V, Tooltip as L, TooltipTrigger as $, TooltipContent as D } from "@brightlocal/ui-components/tooltip";
7
+ const I = h(
8
8
  [
9
9
  // Base styles
10
10
  "inline-flex",
@@ -45,7 +45,7 @@ const $ = b(
45
45
  size: "md"
46
46
  }
47
47
  }
48
- ), m = b(
48
+ ), b = h(
49
49
  [
50
50
  // Base styles
51
51
  "inline-flex",
@@ -75,64 +75,66 @@ const $ = b(
75
75
  size: "md"
76
76
  }
77
77
  }
78
- ), D = i.forwardRef(
78
+ ), S = i.forwardRef(
79
79
  ({
80
- className: h,
80
+ className: g,
81
81
  children: t,
82
82
  size: a = "md",
83
83
  loading: l = !1,
84
84
  disabled: v = !1,
85
- onRemove: g,
85
+ onRemove: x,
86
86
  dataHook: d,
87
87
  trackingEl: n,
88
- trackingLabel: x,
89
- maxWidth: y = 200,
90
- ...w
91
- }, z) => {
92
- const c = v || l, u = 16, o = i.useRef(null), [T, C] = i.useState(!1);
88
+ trackingLabel: y,
89
+ maxWidth: w = 200,
90
+ loadingLabel: z,
91
+ removeAriaLabel: c,
92
+ ...T
93
+ }, C) => {
94
+ const p = v || l, u = 16, o = i.useRef(null), [k, N] = i.useState(!1);
93
95
  i.useEffect(() => {
94
96
  const s = () => {
95
- o.current && C(
97
+ o.current && N(
96
98
  o.current.scrollWidth > o.current.clientWidth
97
99
  );
98
100
  };
99
101
  return s(), window.addEventListener("resize", s), () => window.removeEventListener("resize", s);
100
102
  }, [t]);
101
- const p = /* @__PURE__ */ e(
103
+ const f = /* @__PURE__ */ e(
102
104
  "span",
103
105
  {
104
106
  ref: o,
105
107
  className: "truncate",
106
108
  "data-slot": "chip-label",
107
- style: { maxWidth: y },
109
+ style: { maxWidth: w },
108
110
  children: t
109
111
  }
110
112
  );
111
- return /* @__PURE__ */ f(
113
+ return /* @__PURE__ */ m(
112
114
  "div",
113
115
  {
114
- ref: z,
115
- "aria-disabled": c ? "true" : void 0,
116
- className: r($({ size: a }), h),
116
+ ref: C,
117
+ "aria-disabled": p ? "true" : void 0,
118
+ className: r(I({ size: a }), g),
117
119
  "data-hook": d,
118
120
  "data-slot": "chip",
119
121
  "data-tracking-el": n,
120
- "data-tracking-label": x,
121
- ...w,
122
+ "data-tracking-label": y,
123
+ ...T,
122
124
  children: [
123
- T ? /* @__PURE__ */ e(R, { children: /* @__PURE__ */ f(j, { children: [
124
- /* @__PURE__ */ e(L, { asChild: !0, children: p }),
125
- /* @__PURE__ */ e(V, { dataHook: `${d}-tooltip`, sideOffset: 8, children: t })
126
- ] }) }) : p,
125
+ k ? /* @__PURE__ */ e(V, { children: /* @__PURE__ */ m(L, { children: [
126
+ /* @__PURE__ */ e($, { asChild: !0, children: f }),
127
+ /* @__PURE__ */ e(D, { dataHook: `${d}-tooltip`, sideOffset: 8, children: t })
128
+ ] }) }) : f,
127
129
  l ? /* @__PURE__ */ e(
128
130
  "span",
129
131
  {
130
- "aria-label": "Loading",
131
- className: r(m({ size: a })),
132
+ "aria-label": z ?? "Loading",
133
+ className: r(b({ size: a })),
132
134
  "data-slot": "chip-loading",
133
135
  role: "status",
134
136
  children: /* @__PURE__ */ e(
135
- k,
137
+ R,
136
138
  {
137
139
  className: "animate-spin motion-reduce:animate-none",
138
140
  size: u
@@ -142,15 +144,18 @@ const $ = b(
142
144
  ) : /* @__PURE__ */ e(
143
145
  "button",
144
146
  {
145
- "aria-label": `Remove ${typeof t == "string" ? t : "chip"}`,
146
- className: r(m({ size: a })),
147
+ "aria-label": c ? c.replace(
148
+ "{name}",
149
+ typeof t == "string" ? t : "chip"
150
+ ) : `Remove ${typeof t == "string" ? t : "chip"}`,
151
+ className: r(b({ size: a })),
147
152
  "data-slot": "chip-delete",
148
153
  "data-tracking-el": n ? `${n}-delete` : void 0,
149
- disabled: c,
154
+ disabled: p,
150
155
  tabIndex: -1,
151
156
  type: "button",
152
- onClick: g,
153
- children: /* @__PURE__ */ e(N, { size: u })
157
+ onClick: x,
158
+ children: /* @__PURE__ */ e(j, { size: u })
154
159
  }
155
160
  )
156
161
  ]
@@ -158,8 +163,8 @@ const $ = b(
158
163
  );
159
164
  }
160
165
  );
161
- D.displayName = "Chip";
166
+ S.displayName = "Chip";
162
167
  export {
163
- D as Chip,
164
- $ as chipVariants
168
+ S as Chip,
169
+ I as chipVariants
165
170
  };