@brightlocal/ui-components 2.10.0 → 2.12.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 (163) hide show
  1. package/README.md +3 -1
  2. package/component-meta.json +200 -17
  3. package/dist/badge.cjs +1 -1
  4. package/dist/badge.d.ts.map +1 -1
  5. package/dist/badge.js +42 -25
  6. package/dist/blocks/data-table.cjs +1 -1
  7. package/dist/blocks/data-table.d.ts +16 -4
  8. package/dist/blocks/data-table.d.ts.map +1 -1
  9. package/dist/blocks/data-table.js +57 -53
  10. package/dist/blocks/input-list.cjs +2 -2
  11. package/dist/blocks/input-list.d.ts +7 -1
  12. package/dist/blocks/input-list.d.ts.map +1 -1
  13. package/dist/blocks/input-list.js +82 -81
  14. package/dist/blocks/sidebar.cjs +1 -1
  15. package/dist/blocks/sidebar.d.ts +19 -10
  16. package/dist/blocks/sidebar.d.ts.map +1 -1
  17. package/dist/blocks/sidebar.js +173 -169
  18. package/dist/breadcrumb.cjs +1 -1
  19. package/dist/breadcrumb.d.ts +14 -2
  20. package/dist/breadcrumb.d.ts.map +1 -1
  21. package/dist/breadcrumb.js +37 -37
  22. package/dist/button.cjs +1 -1
  23. package/dist/button.js +25 -25
  24. package/dist/callout.cjs +1 -1
  25. package/dist/callout.d.ts +3 -3
  26. package/dist/callout.d.ts.map +1 -1
  27. package/dist/callout.js +2 -1
  28. package/dist/card.cjs +1 -1
  29. package/dist/card.d.ts +10 -1
  30. package/dist/card.d.ts.map +1 -1
  31. package/dist/card.js +85 -82
  32. package/dist/carousel.cjs +1 -1
  33. package/dist/carousel.d.ts +37 -4
  34. package/dist/carousel.d.ts.map +1 -1
  35. package/dist/carousel.js +213 -163
  36. package/dist/chip.cjs +1 -1
  37. package/dist/chip.d.ts +11 -0
  38. package/dist/chip.d.ts.map +1 -1
  39. package/dist/chip.js +43 -38
  40. package/dist/combobox.cjs +3 -3
  41. package/dist/combobox.d.ts +12 -2
  42. package/dist/combobox.d.ts.map +1 -1
  43. package/dist/combobox.js +235 -230
  44. package/dist/command.cjs +1 -1
  45. package/dist/command.d.ts +106 -1
  46. package/dist/command.d.ts.map +1 -1
  47. package/dist/command.js +385 -120
  48. package/dist/date-picker.cjs +1 -1
  49. package/dist/date-picker.d.ts +10 -0
  50. package/dist/date-picker.d.ts.map +1 -1
  51. package/dist/date-picker.js +96 -96
  52. package/dist/dialog.cjs +1 -1
  53. package/dist/dialog.d.ts +7 -2
  54. package/dist/dialog.d.ts.map +1 -1
  55. package/dist/dialog.js +38 -30
  56. package/dist/drawer.d.ts +2 -2
  57. package/dist/global-layout.cjs +1 -1
  58. package/dist/global-layout.d.ts +5 -0
  59. package/dist/global-layout.d.ts.map +1 -1
  60. package/dist/global-layout.js +15 -7
  61. package/dist/hooks/use-breakpoint.cjs +1 -1
  62. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  63. package/dist/hooks/use-breakpoint.js +10 -10
  64. package/dist/index.cjs +1 -1
  65. package/dist/index.d.ts +1 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +406 -395
  68. package/dist/input-chip.cjs +1 -1
  69. package/dist/input-chip.d.ts +8 -5
  70. package/dist/input-chip.d.ts.map +1 -1
  71. package/dist/input-chip.js +164 -170
  72. package/dist/input-group.d.ts +1 -1
  73. package/dist/input-password.cjs +1 -1
  74. package/dist/input-password.d.ts +10 -0
  75. package/dist/input-password.d.ts.map +1 -1
  76. package/dist/input-password.js +108 -106
  77. package/dist/link.cjs +1 -1
  78. package/dist/link.d.ts +1 -1
  79. package/dist/link.d.ts.map +1 -1
  80. package/dist/link.js +36 -37
  81. package/dist/list.d.ts +1 -1
  82. package/dist/logo.cjs +1 -1
  83. package/dist/logo.d.ts +6 -1
  84. package/dist/logo.d.ts.map +1 -1
  85. package/dist/logo.js +25 -22
  86. package/dist/map.cjs +1 -0
  87. package/dist/map.d.ts +207 -0
  88. package/dist/map.d.ts.map +1 -0
  89. package/dist/map.js +256 -0
  90. package/dist/pagination.cjs +1 -1
  91. package/dist/pagination.d.ts +29 -3
  92. package/dist/pagination.d.ts.map +1 -1
  93. package/dist/pagination.js +26 -25
  94. package/dist/rating.cjs +1 -1
  95. package/dist/rating.d.ts +6 -0
  96. package/dist/rating.d.ts.map +1 -1
  97. package/dist/rating.js +27 -19
  98. package/dist/resizable.d.ts +1 -1
  99. package/dist/select.cjs +2 -2
  100. package/dist/select.d.ts +7 -1
  101. package/dist/select.d.ts.map +1 -1
  102. package/dist/select.js +52 -51
  103. package/dist/separator.cjs +1 -1
  104. package/dist/separator.d.ts +16 -4
  105. package/dist/separator.d.ts.map +1 -1
  106. package/dist/separator.js +38 -35
  107. package/dist/sheet.cjs +1 -1
  108. package/dist/sheet.d.ts +6 -1
  109. package/dist/sheet.d.ts.map +1 -1
  110. package/dist/sheet.js +42 -41
  111. package/dist/skeleton.cjs +1 -1
  112. package/dist/skeleton.d.ts +5 -0
  113. package/dist/skeleton.d.ts.map +1 -1
  114. package/dist/skeleton.js +13 -11
  115. package/dist/sonner.cjs +1 -1
  116. package/dist/sonner.d.ts.map +1 -1
  117. package/dist/sonner.js +32 -30
  118. package/dist/tabs.cjs +1 -1
  119. package/dist/tabs.d.ts +4 -0
  120. package/dist/tabs.d.ts.map +1 -1
  121. package/dist/tabs.js +101 -52
  122. package/dist/text-reveal-motion.cjs +1 -1
  123. package/dist/text-reveal-motion.d.ts +5 -0
  124. package/dist/text-reveal-motion.d.ts.map +1 -1
  125. package/dist/text-reveal-motion.js +111 -110
  126. package/dist/typography.cjs +1 -1
  127. package/dist/typography.d.ts +1 -2
  128. package/dist/typography.d.ts.map +1 -1
  129. package/dist/typography.js +49 -50
  130. package/package.json +4 -5
  131. package/src/blocks/data-table.tsx +26 -9
  132. package/src/blocks/input-list.tsx +12 -1
  133. package/src/blocks/sidebar.tsx +61 -44
  134. package/src/components/badge.tsx +22 -5
  135. package/src/components/breadcrumb.tsx +43 -26
  136. package/src/components/button.tsx +13 -13
  137. package/src/components/callout.tsx +5 -4
  138. package/src/components/card.tsx +35 -19
  139. package/src/components/carousel.tsx +134 -13
  140. package/src/components/chip.tsx +22 -2
  141. package/src/components/combobox.tsx +18 -3
  142. package/src/components/command.tsx +644 -17
  143. package/src/components/date-picker.tsx +17 -3
  144. package/src/components/dialog.tsx +17 -4
  145. package/src/components/drawer.tsx +2 -2
  146. package/src/components/global-layout.tsx +15 -2
  147. package/src/components/input-chip.tsx +114 -66
  148. package/src/components/input-password.tsx +73 -49
  149. package/src/components/link.tsx +29 -17
  150. package/src/components/logo.tsx +10 -2
  151. package/src/components/map.tsx +597 -0
  152. package/src/components/pagination.tsx +44 -11
  153. package/src/components/rating.tsx +20 -2
  154. package/src/components/select.tsx +9 -1
  155. package/src/components/separator.tsx +40 -25
  156. package/src/components/sheet.tsx +28 -20
  157. package/src/components/skeleton.tsx +13 -2
  158. package/src/components/sonner.tsx +9 -3
  159. package/src/components/tabs.tsx +118 -22
  160. package/src/components/text-reveal-motion.tsx +7 -1
  161. package/src/components/typography.tsx +6 -7
  162. package/src/hooks/use-breakpoint.ts +2 -3
  163. package/src/index.ts +1 -0
package/dist/carousel.js CHANGED
@@ -1,254 +1,304 @@
1
- import { jsx as n, jsxs as S } from "react/jsx-runtime";
1
+ import { jsx as p, jsxs as D } from "react/jsx-runtime";
2
2
  import * as o from "react";
3
- import E from "embla-carousel-react";
4
- import { ArrowRight as A, ArrowLeft as K } from "@brightlocal/icons";
5
- import { cn as p } from "@brightlocal/ui-components/lib/utils";
6
- import { Button as N } from "@brightlocal/ui-components/button";
7
- const w = o.createContext(null);
8
- function C() {
9
- const t = o.useContext(w);
10
- if (!t)
3
+ import $ from "embla-carousel-react";
4
+ import { ArrowRight as q, ArrowLeft as F } from "@brightlocal/icons";
5
+ import { cn as C } from "@brightlocal/ui-components/lib/utils";
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
+ if (!r)
11
11
  throw new Error("useCarousel must be used within a <Carousel />");
12
- return t;
12
+ return r;
13
13
  }
14
- const L = o.forwardRef(
14
+ const H = o.forwardRef(
15
15
  ({
16
- orientation: t = "horizontal",
17
- opts: l,
18
- setApi: a,
19
- plugins: s,
20
- className: i,
21
- children: e,
22
- dataHook: f,
23
- trackingEl: d,
24
- trackingLabel: c,
25
- ...g
26
- }, b) => {
27
- const [u, r] = E(
16
+ orientation: r = "horizontal",
17
+ opts: s,
18
+ setApi: n,
19
+ plugins: d,
20
+ className: f,
21
+ children: c,
22
+ dataHook: u,
23
+ trackingEl: t,
24
+ trackingLabel: i,
25
+ lazyLoad: l = !1,
26
+ overscan: h = 1,
27
+ ...w
28
+ }, v) => {
29
+ const [m, e] = $(
28
30
  {
29
- ...l,
30
- axis: t === "horizontal" ? "x" : "y"
31
+ ...s,
32
+ axis: r === "horizontal" ? "x" : "y"
31
33
  },
32
- s
33
- ), [y, k] = o.useState(!1), [P, z] = o.useState(!1), h = o.useCallback((m) => {
34
- m && (k(m.canScrollPrev()), z(m.canScrollNext()));
35
- }, []), v = o.useCallback(() => {
36
- r?.scrollPrev();
37
- }, [r]), x = o.useCallback(() => {
38
- r?.scrollNext();
39
- }, [r]), I = o.useCallback(
40
- (m) => {
41
- const R = t === "horizontal" ? "ArrowLeft" : "ArrowUp", D = t === "horizontal" ? "ArrowRight" : "ArrowDown";
42
- m.key === R ? (m.preventDefault(), v()) : m.key === D && (m.preventDefault(), x());
34
+ d
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
+ return b;
41
+ }), g = o.useCallback((a) => {
42
+ a && (L(a.canScrollPrev()), A(a.canScrollNext()));
43
+ }, []), y = o.useCallback(() => {
44
+ e?.scrollPrev();
45
+ }, [e]), I = o.useCallback(() => {
46
+ e?.scrollNext();
47
+ }, [e]), T = o.useCallback(
48
+ (a) => {
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());
43
51
  },
44
- [t, v, x]
52
+ [r, y, I]
53
+ );
54
+ o.useEffect(() => {
55
+ !e || !n || n(e);
56
+ }, [e, n]), o.useEffect(() => {
57
+ if (e)
58
+ return g(e), e.on("reInit", g), e.on("select", g), () => {
59
+ e?.off("reInit", g), e?.off("select", g);
60
+ };
61
+ }, [e, g]);
62
+ const S = o.useCallback(
63
+ (a) => {
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
+ }
73
+ return z.size === P.size ? P : z;
74
+ });
75
+ },
76
+ [l, N]
45
77
  );
46
78
  return o.useEffect(() => {
47
- !r || !a || a(r);
48
- }, [r, a]), o.useEffect(() => {
49
- if (r)
50
- return h(r), r.on("reInit", h), r.on("select", h), () => {
51
- r?.off("reInit", h), r?.off("select", h);
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);
52
82
  };
53
- }, [r, h]), /* @__PURE__ */ n(
54
- w.Provider,
83
+ }, [e, l, S]), /* @__PURE__ */ p(
84
+ M.Provider,
55
85
  {
56
86
  value: {
57
- carouselRef: u,
58
- api: r,
59
- opts: l,
60
- orientation: t || (l?.axis === "y" ? "vertical" : "horizontal"),
61
- scrollPrev: v,
62
- scrollNext: x,
63
- canScrollPrev: y,
64
- canScrollNext: P
87
+ carouselRef: m,
88
+ api: e,
89
+ opts: s,
90
+ orientation: r || (s?.axis === "y" ? "vertical" : "horizontal"),
91
+ scrollPrev: y,
92
+ scrollNext: I,
93
+ canScrollPrev: j,
94
+ canScrollNext: O,
95
+ lazyLoad: l,
96
+ loadedSlides: B
65
97
  },
66
- children: /* @__PURE__ */ n(
98
+ children: /* @__PURE__ */ p(
67
99
  "div",
68
100
  {
69
- ref: b,
101
+ ref: v,
70
102
  "aria-roledescription": "carousel",
71
- className: p("relative", i),
72
- "data-hook": f,
103
+ className: C("relative", f),
104
+ "data-hook": u,
73
105
  "data-slot": "carousel",
74
- "data-tracking-el": d,
75
- "data-tracking-label": c,
106
+ "data-tracking-el": t,
107
+ "data-tracking-label": i,
76
108
  role: "region",
77
- onKeyDownCapture: I,
78
- ...g,
79
- children: e
109
+ onKeyDownCapture: T,
110
+ ...w,
111
+ children: c
80
112
  }
81
113
  )
82
114
  }
83
115
  );
84
116
  }
85
117
  );
86
- L.displayName = "Carousel";
87
- const j = o.forwardRef(({ className: t, ...l }, a) => {
88
- const { carouselRef: s, orientation: i } = C(), e = i === "vertical";
89
- return /* @__PURE__ */ n(
118
+ H.displayName = "Carousel";
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
+ return o.cloneElement(
126
+ h,
127
+ { _lazyIndex: w }
128
+ );
129
+ }
130
+ return h;
131
+ }) : s;
132
+ return /* @__PURE__ */ p(
90
133
  "div",
91
134
  {
92
- ref: s,
93
- className: p("overflow-hidden", e && "w-full", t),
135
+ ref: f,
136
+ className: C("overflow-hidden", t && "w-full", r),
94
137
  "data-slot": "carousel-content",
95
- children: /* @__PURE__ */ n(
138
+ children: /* @__PURE__ */ p(
96
139
  "div",
97
140
  {
98
- ref: a,
99
- className: p(
141
+ ref: d,
142
+ className: C(
100
143
  "flex",
101
- e ? "-mt-4 h-full w-full flex-col" : "-ml-4"
144
+ t ? "-mt-4 h-full w-full flex-col" : "-ml-4"
102
145
  ),
103
- ...l
146
+ ...n,
147
+ children: l
104
148
  }
105
149
  )
106
150
  }
107
151
  );
108
152
  });
109
- j.displayName = "CarouselContent";
110
- const O = o.forwardRef(({ className: t, ...l }, a) => {
111
- const { orientation: s } = C();
112
- return /* @__PURE__ */ n(
153
+ J.displayName = "CarouselContent";
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
+ return /* @__PURE__ */ p(
113
157
  "div",
114
158
  {
115
- ref: a,
159
+ ref: f,
116
160
  "aria-roledescription": "slide",
117
- className: p(
161
+ className: C(
118
162
  "min-w-0 shrink-0 grow-0 basis-full",
119
- s === "horizontal" ? "pl-4" : "w-full pt-4",
120
- t
163
+ c === "horizontal" ? "pl-4" : "w-full pt-4",
164
+ r
121
165
  ),
166
+ "data-lazy-loaded": u ? String(i) : void 0,
122
167
  "data-slot": "carousel-item",
123
168
  role: "group",
124
- ...l
169
+ ...d,
170
+ children: i ? s : null
125
171
  }
126
172
  );
127
173
  });
128
- O.displayName = "CarouselItem";
129
- function B({
130
- className: t,
131
- variant: l = "outline",
132
- size: a = "default",
133
- dataHook: s = "carousel-previous",
134
- hideWhenDisabled: i = !1,
135
- ...e
174
+ K.displayName = "CarouselItem";
175
+ function Q({
176
+ className: r,
177
+ variant: s = "outline",
178
+ size: n = "default",
179
+ dataHook: d = "carousel-previous",
180
+ hideWhenDisabled: f = !1,
181
+ ariaLabel: c = "Previous slide",
182
+ ...u
136
183
  }) {
137
- const { orientation: f, scrollPrev: d, canScrollPrev: c } = C();
138
- return i && !c ? null : /* @__PURE__ */ S(
139
- N,
184
+ const { orientation: t, scrollPrev: i, canScrollPrev: l } = k();
185
+ return f && !l ? null : /* @__PURE__ */ D(
186
+ V,
140
187
  {
141
188
  iconOnly: !0,
142
- className: p(
189
+ className: C(
143
190
  "absolute",
144
- f === "horizontal" ? "top-1/2 left-1 -translate-y-1/2 sm:-left-12" : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
145
- t
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",
192
+ r
146
193
  ),
147
194
  "data-slot": "carousel-previous",
148
- dataHook: s,
149
- disabled: !c,
150
- size: a,
151
- variant: l,
152
- onClick: d,
153
- ...e,
195
+ dataHook: d,
196
+ disabled: !l,
197
+ size: n,
198
+ variant: s,
199
+ onClick: i,
200
+ ...u,
154
201
  children: [
155
- /* @__PURE__ */ n(K, {}),
156
- /* @__PURE__ */ n("span", { className: "sr-only", children: "Previous slide" })
202
+ /* @__PURE__ */ p(F, {}),
203
+ /* @__PURE__ */ p("span", { className: "sr-only", children: c })
157
204
  ]
158
205
  }
159
206
  );
160
207
  }
161
- B.displayName = "CarouselPrevious";
162
- function G({
163
- className: t,
164
- variant: l = "outline",
165
- size: a = "default",
166
- dataHook: s = "carousel-next",
167
- hideWhenDisabled: i = !1,
168
- ...e
208
+ Q.displayName = "CarouselPrevious";
209
+ function W({
210
+ className: r,
211
+ variant: s = "outline",
212
+ size: n = "default",
213
+ dataHook: d = "carousel-next",
214
+ hideWhenDisabled: f = !1,
215
+ ariaLabel: c = "Next slide",
216
+ ...u
169
217
  }) {
170
- const { orientation: f, scrollNext: d, canScrollNext: c } = C();
171
- return i && !c ? null : /* @__PURE__ */ S(
172
- N,
218
+ const { orientation: t, scrollNext: i, canScrollNext: l } = k();
219
+ return f && !l ? null : /* @__PURE__ */ D(
220
+ V,
173
221
  {
174
222
  iconOnly: !0,
175
- className: p(
223
+ className: C(
176
224
  "absolute",
177
- f === "horizontal" ? "top-1/2 right-1 -translate-y-1/2 sm:-right-12" : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
178
- t
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",
226
+ r
179
227
  ),
180
228
  "data-slot": "carousel-next",
181
- dataHook: s,
182
- disabled: !c,
183
- size: a,
184
- variant: l,
185
- onClick: d,
186
- ...e,
229
+ dataHook: d,
230
+ disabled: !l,
231
+ size: n,
232
+ variant: s,
233
+ onClick: i,
234
+ ...u,
187
235
  children: [
188
- /* @__PURE__ */ n(A, {}),
189
- /* @__PURE__ */ n("span", { className: "sr-only", children: "Next slide" })
236
+ /* @__PURE__ */ p(q, {}),
237
+ /* @__PURE__ */ p("span", { className: "sr-only", children: c })
190
238
  ]
191
239
  }
192
240
  );
193
241
  }
194
- G.displayName = "CarouselNext";
195
- function T({
196
- className: t,
197
- dataHook: l = "carousel-dots",
198
- trackingEl: a,
199
- trackingLabel: s,
200
- ...i
242
+ W.displayName = "CarouselNext";
243
+ function X({
244
+ className: r,
245
+ dataHook: s = "carousel-dots",
246
+ trackingEl: n,
247
+ trackingLabel: d,
248
+ ariaLabel: f = "Slide navigation",
249
+ slideAriaLabel: c,
250
+ ...u
201
251
  }) {
202
- const { api: e } = C(), [f, d] = o.useState(0), [c, g] = o.useState([]);
252
+ const { api: t } = k(), [i, l] = o.useState(0), [h, w] = o.useState([]);
203
253
  return o.useEffect(() => {
204
- if (!e) return;
205
- g(e.scrollSnapList()), d(e.selectedScrollSnap());
206
- const b = () => {
207
- d(e.selectedScrollSnap());
208
- }, u = () => {
209
- g(e.scrollSnapList()), d(e.selectedScrollSnap());
254
+ if (!t) return;
255
+ w(t.scrollSnapList()), l(t.selectedScrollSnap());
256
+ const v = () => {
257
+ l(t.selectedScrollSnap());
258
+ }, m = () => {
259
+ w(t.scrollSnapList()), l(t.selectedScrollSnap());
210
260
  };
211
- return e.on("select", b), e.on("reInit", u), () => {
212
- e.off("select", b), e.off("reInit", u);
261
+ return t.on("select", v), t.on("reInit", m), () => {
262
+ t.off("select", v), t.off("reInit", m);
213
263
  };
214
- }, [e]), c.length === 0 ? null : /* @__PURE__ */ n(
264
+ }, [t]), h.length === 0 ? null : /* @__PURE__ */ p(
215
265
  "div",
216
266
  {
217
- "aria-label": "Slide navigation",
218
- className: p(
267
+ "aria-label": f,
268
+ className: C(
219
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",
220
- t
270
+ r
221
271
  ),
222
- "data-hook": l,
272
+ "data-hook": s,
223
273
  "data-slot": "carousel-dots",
224
- "data-tracking-el": a,
225
- "data-tracking-label": s,
274
+ "data-tracking-el": n,
275
+ "data-tracking-label": d,
226
276
  role: "group",
227
- ...i,
228
- children: c.map((b, u) => /* @__PURE__ */ n(
277
+ ...u,
278
+ children: h.map((v, m) => /* @__PURE__ */ p(
229
279
  "button",
230
280
  {
231
- "aria-current": u === f ? "step" : void 0,
232
- "aria-label": `Go to slide ${u + 1}`,
233
- className: p(
281
+ "aria-current": m === i ? "step" : void 0,
282
+ "aria-label": c ? c.replace("{slide}", String(m + 1)) : `Go to slide ${m + 1}`,
283
+ className: C(
234
284
  "focus-visible:shadow-default size-3 rounded-full transition-[width,background-color] duration-200 ease-out outline-none",
235
- u === f ? "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"
236
286
  ),
237
287
  "data-slot": "carousel-dot",
238
288
  type: "button",
239
- onClick: () => e?.scrollTo(u)
289
+ onClick: () => t?.scrollTo(m)
240
290
  },
241
- u
291
+ m
242
292
  ))
243
293
  }
244
294
  );
245
295
  }
246
- T.displayName = "CarouselDots";
296
+ X.displayName = "CarouselDots";
247
297
  export {
248
- L as Carousel,
249
- j as CarouselContent,
250
- T as CarouselDots,
251
- O as CarouselItem,
252
- G as CarouselNext,
253
- B as CarouselPrevious
298
+ H as Carousel,
299
+ J as CarouselContent,
300
+ X as CarouselDots,
301
+ K as CarouselItem,
302
+ W as CarouselNext,
303
+ Q as CarouselPrevious
254
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"}