@brightlocal/ui-components 2.10.0 → 2.11.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 (58) hide show
  1. package/README.md +3 -1
  2. package/component-meta.json +41 -9
  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/sidebar.cjs +1 -1
  7. package/dist/blocks/sidebar.d.ts +1 -3
  8. package/dist/blocks/sidebar.d.ts.map +1 -1
  9. package/dist/blocks/sidebar.js +46 -49
  10. package/dist/button.cjs +1 -1
  11. package/dist/button.js +25 -25
  12. package/dist/card.cjs +1 -1
  13. package/dist/card.d.ts +10 -1
  14. package/dist/card.d.ts.map +1 -1
  15. package/dist/card.js +85 -82
  16. package/dist/carousel.cjs +1 -1
  17. package/dist/carousel.d.ts +13 -1
  18. package/dist/carousel.d.ts.map +1 -1
  19. package/dist/carousel.js +196 -150
  20. package/dist/command.cjs +1 -1
  21. package/dist/command.d.ts +101 -1
  22. package/dist/command.d.ts.map +1 -1
  23. package/dist/command.js +383 -119
  24. package/dist/hooks/use-breakpoint.cjs +1 -1
  25. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  26. package/dist/hooks/use-breakpoint.js +10 -10
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +402 -391
  31. package/dist/input-chip.cjs +1 -1
  32. package/dist/input-chip.d.ts +1 -4
  33. package/dist/input-chip.d.ts.map +1 -1
  34. package/dist/input-chip.js +163 -170
  35. package/dist/map.cjs +1 -0
  36. package/dist/map.d.ts +192 -0
  37. package/dist/map.d.ts.map +1 -0
  38. package/dist/map.js +250 -0
  39. package/dist/sonner.cjs +1 -1
  40. package/dist/sonner.d.ts.map +1 -1
  41. package/dist/sonner.js +32 -30
  42. package/dist/tabs.cjs +1 -1
  43. package/dist/tabs.d.ts +4 -0
  44. package/dist/tabs.d.ts.map +1 -1
  45. package/dist/tabs.js +101 -52
  46. package/package.json +3 -3
  47. package/src/blocks/sidebar.tsx +21 -26
  48. package/src/components/badge.tsx +22 -5
  49. package/src/components/button.tsx +13 -13
  50. package/src/components/card.tsx +35 -19
  51. package/src/components/carousel.tsx +101 -9
  52. package/src/components/command.tsx +637 -16
  53. package/src/components/input-chip.tsx +102 -65
  54. package/src/components/map.tsx +574 -0
  55. package/src/components/sonner.tsx +9 -3
  56. package/src/components/tabs.tsx +118 -22
  57. package/src/hooks/use-breakpoint.ts +2 -3
  58. package/src/index.ts +1 -0
package/dist/map.d.ts ADDED
@@ -0,0 +1,192 @@
1
+ import { Popover, PopoverProps, PopoverAnchorProps, PopoverContentProps } from './popover';
2
+ import * as React from "react";
3
+ type MapGridPinVariant = "primary" | "secondary" | "destructive" | "outline" | "warning";
4
+ /**
5
+ * Props for the MapGridPin component.
6
+ */
7
+ interface MapGridPinProps extends Omit<React.ComponentProps<"button">, "children" | "type"> {
8
+ /** Value displayed inside the pin (number or short label) */
9
+ value: number | string;
10
+ /** Button variant — consumer controls this based on value thresholds */
11
+ variant?: MapGridPinVariant;
12
+ /** Enable infinite pulse animation radiating from the pin */
13
+ pulse?: boolean;
14
+ /** Required test hook identifier */
15
+ dataHook: string;
16
+ /** Analytics element identifier */
17
+ trackingEl?: string;
18
+ /** Analytics label */
19
+ trackingLabel?: string;
20
+ }
21
+ /**
22
+ * A circular map pin button that displays a numeric value with a colored background.
23
+ * Uses the Button component internally. Color is determined by the `variant` prop —
24
+ * the consumer controls which variant to apply based on the value.
25
+ * Supports an optional `pulse` animation for emphasis.
26
+ */
27
+ declare const MapGridPin: React.ForwardRefExoticComponent<Omit<MapGridPinProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
28
+ /**
29
+ * Props for the MapLocationPin component.
30
+ */
31
+ interface MapLocationPinProps extends Omit<MapGridPinProps, "value"> {
32
+ /** Numeric value displayed inside the pin */
33
+ value?: number;
34
+ }
35
+ /**
36
+ * A map location pin marker.
37
+ * Thin wrapper around MapGridPin with a default value of 1.
38
+ * Designed to be placed inside any map marker component (e.g. AdvancedMarker).
39
+ */
40
+ declare const MapLocationPin: React.ForwardRefExoticComponent<Omit<MapLocationPinProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
41
+ /**
42
+ * Props for the MapControlButton component.
43
+ */
44
+ interface MapControlButtonProps extends Omit<React.ComponentProps<"button">, "type"> {
45
+ /** Required test hook identifier */
46
+ dataHook: string;
47
+ /** Analytics element identifier */
48
+ trackingEl?: string;
49
+ /** Analytics label */
50
+ trackingLabel?: string;
51
+ /** Button type attribute */
52
+ type?: "button" | "submit";
53
+ }
54
+ /**
55
+ * A floating control button for map UIs.
56
+ * Renders a square, shadowed button designed to overlay a map surface.
57
+ * Use for zoom, locate, layer toggles, and other map controls.
58
+ */
59
+ declare const MapControlButton: React.ForwardRefExoticComponent<Omit<MapControlButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
60
+ /**
61
+ * Props for the MapLoadingState component.
62
+ */
63
+ interface MapLoadingStateProps extends React.ComponentProps<"div"> {
64
+ /** Optional loading message */
65
+ message?: string;
66
+ /** Required test hook identifier */
67
+ dataHook: string;
68
+ /** Analytics element identifier */
69
+ trackingEl?: string;
70
+ /** Analytics label */
71
+ trackingLabel?: string;
72
+ }
73
+ /**
74
+ * A loading placeholder for map containers.
75
+ * Uses the same spinner pattern as ComboboxLoading.
76
+ * Use as a fallback while the map provider is loading.
77
+ */
78
+ declare const MapLoadingState: React.ForwardRefExoticComponent<Omit<MapLoadingStateProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
79
+ /**
80
+ * Props for the MapErrorState component.
81
+ */
82
+ interface MapErrorStateProps extends React.ComponentProps<"div"> {
83
+ /** Error title */
84
+ title?: string;
85
+ /** Error description */
86
+ message?: string;
87
+ /** Retry callback — renders a "Try again" button when provided */
88
+ onRetry?: () => void;
89
+ /** Required test hook identifier */
90
+ dataHook: string;
91
+ /** Analytics element identifier */
92
+ trackingEl?: string;
93
+ /** Analytics label */
94
+ trackingLabel?: string;
95
+ }
96
+ /**
97
+ * An error state for map containers.
98
+ * Displays an alert icon, title, message, and an optional retry button.
99
+ * Use when the map provider fails to initialise or a network error occurs.
100
+ */
101
+ declare const MapErrorState: React.ForwardRefExoticComponent<Omit<MapErrorStateProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
102
+ /**
103
+ * Props for the MapLegend component.
104
+ */
105
+ interface MapLegendProps extends React.ComponentProps<"div"> {
106
+ /** Required test hook identifier */
107
+ dataHook: string;
108
+ /** Analytics element identifier */
109
+ trackingEl?: string;
110
+ /** Analytics label */
111
+ trackingLabel?: string;
112
+ }
113
+ /**
114
+ * A flexible legend container for map UIs.
115
+ * Renders a horizontal pill-shaped bar — consumers define items via children.
116
+ */
117
+ declare const MapLegend: React.ForwardRefExoticComponent<Omit<MapLegendProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
118
+ /**
119
+ * Return type of {@link useMapPopoverHover}.
120
+ */
121
+ interface UseMapPopoverHoverReturn<T> {
122
+ /** The item currently being hovered, or `null` when idle. Use for `open` prop. */
123
+ activeItem: T | null;
124
+ /** Last non-null item — holds position stable during the close animation. Use for anchor positioning. */
125
+ anchorItem: T | null;
126
+ /** Set a new active item and cancel any pending close timer. */
127
+ showItem: (item: T) => void;
128
+ /** Start a delayed close (default 150 ms). Moving to another pin or the popover content cancels it. */
129
+ scheduleClose: () => void;
130
+ /** Cancel a pending close — call from `MapPopoverContent.onMouseEnter`. */
131
+ cancelClose: () => void;
132
+ }
133
+ /**
134
+ * Manages hover state for a single repositioning Popover on dense map grids.
135
+ *
136
+ * Wire the returned callbacks to `MapGridPin` mouse events and
137
+ * `MapPopoverContent` mouse events. The 150 ms grace period prevents
138
+ * flicker when the pointer travels between a pin and the popover content.
139
+ *
140
+ * @param delay - Close timer in ms.
141
+ * @default 150
142
+ */
143
+ declare function useMapPopoverHover<T>(delay?: number): UseMapPopoverHoverReturn<T>;
144
+ /**
145
+ * Controlled popover root for map UIs.
146
+ * Re-exports `Popover` so consumers import everything from the map module.
147
+ *
148
+ * @example
149
+ * ```tsx
150
+ * <MapPopover open={!!activeItem}>
151
+ * <MapPopoverAnchor />
152
+ * <MapPopoverContent dataHook="popover">…</MapPopoverContent>
153
+ * </MapPopover>
154
+ * ```
155
+ */
156
+ declare const MapPopover: typeof Popover;
157
+ /**
158
+ * Props for the MapPopover component.
159
+ */
160
+ type MapPopoverProps = PopoverProps;
161
+ /**
162
+ * Virtual anchor that positions the popover without rendering a trigger.
163
+ * Re-exports `PopoverAnchor` so consumers import everything from the map module.
164
+ */
165
+ declare const MapPopoverAnchor: React.ForwardRefExoticComponent<Omit<PopoverAnchorProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
166
+ /**
167
+ * Props for the MapPopoverAnchor component.
168
+ */
169
+ type MapPopoverAnchorProps = PopoverAnchorProps;
170
+ /**
171
+ * Props for the MapPopoverContent component.
172
+ */
173
+ interface MapPopoverContentProps extends PopoverContentProps {
174
+ /** Test hook identifier */
175
+ dataHook: string;
176
+ /** Analytics element identifier */
177
+ trackingEl?: string;
178
+ /** Analytics label */
179
+ trackingLabel?: string;
180
+ }
181
+ /**
182
+ * Popover content panel with map-specific defaults.
183
+ * Compact sizing (`w-auto p-3`), top placement, and focus-prevention
184
+ * for hover-activated popovers.
185
+ *
186
+ * Use inside a controlled `<MapPopover open={!!activeItem}>` together
187
+ * with `MapPopoverAnchor` and {@link useMapPopoverHover}.
188
+ */
189
+ declare const MapPopoverContent: React.ForwardRefExoticComponent<Omit<MapPopoverContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
190
+ export { MapLocationPin, MapGridPin, MapControlButton, MapLoadingState, MapErrorState, MapLegend, MapPopover, MapPopoverAnchor, MapPopoverContent, useMapPopoverHover, };
191
+ export type { MapLocationPinProps, MapGridPinProps, MapGridPinVariant, MapControlButtonProps, MapLoadingStateProps, MapErrorStateProps, MapLegendProps, MapPopoverProps, MapPopoverAnchorProps, MapPopoverContentProps, UseMapPopoverHoverReturn, };
192
+ //# sourceMappingURL=map.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/components/map.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EACL,OAAO,EAGP,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,oCAAoC,CAAC;AAM5C,KAAK,iBAAiB,GAClB,SAAS,GACT,WAAW,GACX,aAAa,GACb,SAAS,GACT,SAAS,CAAC;AAUd;;GAEG;AACH,UAAU,eAAgB,SAAQ,IAAI,CACpC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAC9B,UAAU,GAAG,MAAM,CACpB;IACC,6DAA6D;IAC7D,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,wEAAwE;IACxE,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,6DAA6D;IAC7D,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;GAKG;AACH,QAAA,MAAM,UAAU,wGAyCf,CAAC;AAQF;;GAEG;AACH,UAAU,mBAAoB,SAAQ,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC;IAClE,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,QAAA,MAAM,cAAc,4GAMnB,CAAC;AAQF;;GAEG;AACH,UAAU,qBAAsB,SAAQ,IAAI,CAC1C,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAC9B,MAAM,CACP;IACC,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,mCA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AAe,EACf,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,GACzB,CAAC"}
package/dist/map.js ADDED
@@ -0,0 +1,250 @@
1
+ import { jsx as l, jsxs as p } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { AlertCircle as v } from "@brightlocal/icons";
4
+ import { Button as u } from "@brightlocal/ui-components/button";
5
+ import { Card as h, CardContent as x } from "@brightlocal/ui-components/card";
6
+ import { cn as m } from "@brightlocal/ui-components/lib/utils";
7
+ import { Popover as y, PopoverAnchor as N, PopoverContent as w } from "@brightlocal/ui-components/popover";
8
+ const M = {
9
+ primary: "var(--primary)",
10
+ secondary: "var(--secondary)",
11
+ destructive: "var(--destructive)",
12
+ outline: "var(--muted)",
13
+ warning: "var(--warning-background)"
14
+ }, g = s.forwardRef(
15
+ ({
16
+ value: t,
17
+ variant: r = "primary",
18
+ pulse: a = !1,
19
+ dataHook: o,
20
+ className: n,
21
+ trackingEl: e,
22
+ trackingLabel: i,
23
+ ...d
24
+ }, c) => /* @__PURE__ */ l(
25
+ u,
26
+ {
27
+ ref: c,
28
+ className: m(
29
+ "size-8 p-0",
30
+ a && "animate-grid-pin-pulse transition-none motion-reduce:animate-none",
31
+ n
32
+ ),
33
+ dataHook: o,
34
+ size: "sm",
35
+ style: a ? {
36
+ "--grid-pin-pulse-color": M[r]
37
+ } : void 0,
38
+ trackingEl: e || "map-grid-pin",
39
+ trackingLabel: i,
40
+ variant: r,
41
+ ...d,
42
+ children: String(t)
43
+ }
44
+ )
45
+ );
46
+ g.displayName = "MapGridPin";
47
+ const k = s.forwardRef(
48
+ ({ value: t = 1, dataHook: r, ...a }, o) => /* @__PURE__ */ l(g, { ref: o, dataHook: r, value: t, ...a })
49
+ );
50
+ k.displayName = "MapLocationPin";
51
+ const P = s.forwardRef(
52
+ ({ className: t, dataHook: r, trackingEl: a, trackingLabel: o, children: n, ...e }, i) => /* @__PURE__ */ l(
53
+ u,
54
+ {
55
+ ref: i,
56
+ className: m("rounded-lg shadow-sm", t),
57
+ "data-slot": "map-control-button",
58
+ dataHook: r,
59
+ trackingEl: a || "map-control-button",
60
+ trackingLabel: o,
61
+ variant: "outline",
62
+ ...e,
63
+ children: n
64
+ }
65
+ )
66
+ );
67
+ P.displayName = "MapControlButton";
68
+ const b = s.forwardRef(
69
+ ({
70
+ className: t,
71
+ message: r = "Loading map…",
72
+ dataHook: a,
73
+ trackingEl: o,
74
+ trackingLabel: n,
75
+ ...e
76
+ }, i) => /* @__PURE__ */ p(
77
+ "div",
78
+ {
79
+ ref: i,
80
+ "aria-live": "polite",
81
+ className: m(
82
+ "text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",
83
+ t
84
+ ),
85
+ "data-hook": a,
86
+ "data-slot": "map-loading-state",
87
+ "data-tracking-el": o || "map-loading-state",
88
+ "data-tracking-label": n,
89
+ role: "status",
90
+ ...e,
91
+ children: [
92
+ /* @__PURE__ */ l(
93
+ "div",
94
+ {
95
+ "aria-hidden": "true",
96
+ className: "size-4 animate-spin rounded-full border-2 border-current border-t-transparent"
97
+ }
98
+ ),
99
+ r
100
+ ]
101
+ }
102
+ )
103
+ );
104
+ b.displayName = "MapLoadingState";
105
+ const C = s.forwardRef(
106
+ ({
107
+ className: t,
108
+ title: r = "Unable to load map",
109
+ message: a = "Something went wrong while loading the map. Please try again.",
110
+ onRetry: o,
111
+ dataHook: n,
112
+ trackingEl: e,
113
+ trackingLabel: i,
114
+ ...d
115
+ }, c) => /* @__PURE__ */ p(
116
+ "div",
117
+ {
118
+ ref: c,
119
+ className: m(
120
+ "bg-muted/50 flex flex-col items-center justify-center gap-3 rounded-xl p-8 text-center",
121
+ t
122
+ ),
123
+ "data-hook": n,
124
+ "data-slot": "map-error-state",
125
+ "data-tracking-el": e || "map-error-state",
126
+ "data-tracking-label": i,
127
+ role: "alert",
128
+ ...d,
129
+ children: [
130
+ /* @__PURE__ */ l(
131
+ v,
132
+ {
133
+ "aria-hidden": "true",
134
+ className: "text-muted-foreground/60",
135
+ size: 40,
136
+ strokeWidth: 1.5
137
+ }
138
+ ),
139
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-1", children: [
140
+ /* @__PURE__ */ l(
141
+ "h3",
142
+ {
143
+ className: "text-foreground text-sm font-semibold",
144
+ "data-slot": "map-error-title",
145
+ children: r
146
+ }
147
+ ),
148
+ a && /* @__PURE__ */ l(
149
+ "p",
150
+ {
151
+ className: "text-muted-foreground max-w-xs text-xs",
152
+ "data-slot": "map-error-message",
153
+ children: a
154
+ }
155
+ )
156
+ ] }),
157
+ o && /* @__PURE__ */ l(
158
+ u,
159
+ {
160
+ className: "mt-1",
161
+ dataHook: `${n}-retry`,
162
+ size: "sm",
163
+ variant: "primary",
164
+ onClick: o,
165
+ children: "Try again"
166
+ }
167
+ )
168
+ ]
169
+ }
170
+ )
171
+ );
172
+ C.displayName = "MapErrorState";
173
+ const R = s.forwardRef(
174
+ ({ className: t, dataHook: r, trackingEl: a, trackingLabel: o, children: n, ...e }, i) => /* @__PURE__ */ l(
175
+ h,
176
+ {
177
+ ref: i,
178
+ className: m("inline-flex w-auto flex-row items-center", t),
179
+ "data-slot": "map-legend",
180
+ dataHook: r,
181
+ density: "condensed",
182
+ maxWidth: "none",
183
+ trackingEl: a || "map-legend",
184
+ trackingLabel: o,
185
+ variant: "filled",
186
+ ...e,
187
+ children: /* @__PURE__ */ l(x, { className: "flex items-center gap-3", children: n })
188
+ }
189
+ )
190
+ );
191
+ R.displayName = "MapLegend";
192
+ function B(t = 150) {
193
+ const [r, a] = s.useState(null), [o, n] = s.useState(null), e = s.useRef(null), i = s.useCallback((f) => {
194
+ e.current && clearTimeout(e.current), n(f), a(f);
195
+ }, []), d = s.useCallback(() => {
196
+ e.current && clearTimeout(e.current), e.current = setTimeout(() => a(null), t);
197
+ }, [t]), c = s.useCallback(() => {
198
+ e.current && clearTimeout(e.current);
199
+ }, []);
200
+ return {
201
+ activeItem: r,
202
+ anchorItem: o,
203
+ showItem: i,
204
+ scheduleClose: d,
205
+ cancelClose: c
206
+ };
207
+ }
208
+ const G = y, S = N;
209
+ S.displayName = "MapPopoverAnchor";
210
+ const A = s.forwardRef(
211
+ ({
212
+ className: t,
213
+ side: r = "top",
214
+ sideOffset: a = 4,
215
+ dataHook: o,
216
+ trackingEl: n,
217
+ trackingLabel: e,
218
+ ...i
219
+ }, d) => /* @__PURE__ */ l(
220
+ w,
221
+ {
222
+ ref: d,
223
+ className: m(
224
+ "w-auto p-3 data-[state=closed]:animate-none data-[state=closed]:opacity-0",
225
+ t
226
+ ),
227
+ "data-slot": "map-popover-content",
228
+ "data-tracking-el": n || "map-popover",
229
+ "data-tracking-label": e,
230
+ dataHook: o,
231
+ side: r,
232
+ sideOffset: a,
233
+ onOpenAutoFocus: (c) => c.preventDefault(),
234
+ ...i
235
+ }
236
+ )
237
+ );
238
+ A.displayName = "MapPopoverContent";
239
+ export {
240
+ P as MapControlButton,
241
+ C as MapErrorState,
242
+ g as MapGridPin,
243
+ R as MapLegend,
244
+ b as MapLoadingState,
245
+ k as MapLocationPin,
246
+ G as MapPopover,
247
+ S as MapPopoverAnchor,
248
+ A as MapPopoverContent,
249
+ B as useMapPopoverHover
250
+ };
package/dist/sonner.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),i=require("@brightlocal/icons"),m=require("class-variance-authority"),d=require("sonner"),b=require("@brightlocal/ui-components/button"),o=require("@brightlocal/ui-components/lib/utils"),g=4e3,v=m.cva(["flex","items-center","justify-between","w-full","md:w-auto","md:min-w-[364px]","rounded-md","border","border-border","p-4","gap-2","shadow-lg"].join(" "),{variants:{colorSchema:{default:"bg-white dark:bg-popover",success:"bg-green-200 dark:bg-popover"}},defaultVariants:{colorSchema:"default"}}),p=m.cva("text-sm leading-normal font-medium",{variants:{colorSchema:{default:"text-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),N=m.cva("text-sm leading-normal",{variants:{colorSchema:{default:"text-muted-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),l=m.cva("",{variants:{colorSchema:{default:"text-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}});function j(s,e){switch(s){case"info":return t.jsx(i.Info,{className:o.cn(l({colorSchema:e}))});case"success":return t.jsx(i.CheckCircle2,{className:o.cn(l({colorSchema:e}))});case"warning":return t.jsx(i.AlertTriangle,{className:o.cn(l({colorSchema:e}))});case"error":return t.jsx(i.XCircle,{className:o.cn(l({colorSchema:e}))});case"loading":return t.jsx(i.Loader2,{className:o.cn(l({colorSchema:e}),"animate-spin")});default:return null}}const x=function(e,r){const{id:c,...n}=e,u={...r,duration:r?.duration??g,...c!=null&&{id:r?.id??c}},h=u.duration===1/0;d.toast.custom(a=>{const f=n.button&&n.button.label?{label:n.button.label,variant:n.button.variant,onClick:()=>{n.button?.onClick&&n.button.onClick(),d.toast.dismiss(a)}}:void 0;return t.jsx(T,{button:f,colorSchema:n.colorSchema,description:n.description,icon:n.icon??void 0,id:a,title:n.title})},{...u,...h&&{dismissible:!1}})};x.dismiss=s=>{d.toast.dismiss(s)};function T(s){const{button:e,description:r,icon:c,title:n,colorSchema:u}=s,a=(f=>f==="success"?"success":"default")(u);return t.jsxs("div",{"aria-atomic":"true","aria-live":"polite",className:o.cn(v({colorSchema:a})),role:"status",children:[t.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[c!=null&&j(c,a),t.jsxs("div",{className:"w-full",children:[t.jsx("p",{className:o.cn(p({colorSchema:a})),children:n}),r&&t.jsx("p",{className:o.cn(N({colorSchema:a})),children:r})]})]}),e?.label&&t.jsx(b.Button,{"aria-label":e.label,className:"min-h-6 px-2 py-0 text-xs leading-normal font-medium",dataHook:"toast-action",size:"default",variant:e.variant,onClick:e.onClick,children:e.label})]})}function S(){return t.jsx(d.Toaster,{position:"top-right"})}S.displayName="Sonner";exports.Sonner=S;exports.sonner=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("@brightlocal/icons"),f=require("class-variance-authority"),m=require("sonner"),b=require("@brightlocal/ui-components/button"),s=require("@brightlocal/ui-components/lib/utils"),g=4e3,v=f.cva(["flex","items-center","justify-between","w-full","md:w-auto","md:min-w-[364px]","rounded-md","border","border-border","p-4","gap-2","shadow-lg"].join(" "),{variants:{colorSchema:{default:"bg-white dark:bg-popover",success:"bg-green-200 dark:bg-popover"}},defaultVariants:{colorSchema:"default"}}),N=f.cva("text-sm leading-normal font-medium",{variants:{colorSchema:{default:"text-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),p=f.cva("text-sm leading-normal",{variants:{colorSchema:{default:"text-muted-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}}),u=f.cva("",{variants:{colorSchema:{default:"text-foreground",success:"text-green-900 dark:text-green-100"}},defaultVariants:{colorSchema:"default"}});function j(r,t){switch(r){case"info":return e.jsx(l.Info,{className:s.cn(u({colorSchema:t}))});case"success":return e.jsx(l.CheckCircle2,{className:s.cn(u({colorSchema:t}))});case"warning":return e.jsx(l.AlertTriangle,{className:s.cn(u({colorSchema:t}))});case"error":return e.jsx(l.XCircle,{className:s.cn(u({colorSchema:t}))});case"loading":return e.jsx(l.Loader2,{className:s.cn(u({colorSchema:t}),"animate-spin")});default:return null}}const S=function(t,a){const{id:c,...n}=t,d={...a,duration:a?.duration??g,...c!=null&&{id:a?.id??c}},h=d.duration===1/0;m.toast.custom(o=>{const i=n.button&&n.button.label?{label:n.button.label,variant:n.button.variant,onClick:()=>{n.button?.onClick&&n.button.onClick(),m.toast.dismiss(o)}}:void 0;return e.jsx(T,{button:i,colorSchema:n.colorSchema,description:n.description,icon:n.icon??void 0,id:o,title:n.title})},{...d,...h&&{dismissible:!1}})};S.dismiss=r=>{m.toast.dismiss(r)};function T(r){const{button:t,description:a,icon:c,title:n,colorSchema:d}=r,o=(i=>i==="success"?"success":"default")(d);return e.jsxs("div",{"aria-atomic":"true","aria-live":"polite",className:s.cn(v({colorSchema:o})),role:"status",children:[e.jsxs("div",{className:"flex flex-1 items-start gap-2",children:[c!=null&&(()=>{const i=j(c,o);return i?e.jsx("span",{className:"mt-0.5 shrink-0",children:i}):null})(),e.jsxs("div",{className:"w-full",children:[e.jsx("p",{className:s.cn(N({colorSchema:o})),children:n}),a&&e.jsx("p",{className:s.cn(p({colorSchema:o})),children:a})]})]}),t?.label&&e.jsx(b.Button,{"aria-label":t.label,dataHook:"toast-action",size:"sm",variant:t.variant,onClick:t.onClick,children:t.label})]})}function x(){return e.jsx(m.Toaster,{position:"top-right"})}x.displayName="Sonner";exports.Sonner=x;exports.sonner=S;
@@ -1 +1 @@
1
- {"version":3,"file":"sonner.d.ts","sourceRoot":"","sources":["../../src/components/sonner.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAU,KAAK,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAG/E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEhD;;;;GAIG;AACH,KAAK,UAAU,GAAG;IAChB,2CAA2C;IAC3C,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2CAA2C;IAC3C,MAAM,CAAC,EAAE;QACP,wBAAwB;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,mCAAmC;QACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;QACrB,mCAAmC;QACnC,OAAO,CAAC,EAAE,mBAAmB,CAAC;KAC/B,CAAC;IACF,gCAAgC;IAChC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,mCAAmC;IACnC,IAAI,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MA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CACxC;AAED,QAAA,MAAM,MAAM,EAAE,QA+Cb,CAAC;AA+DF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,iBAAS,MAAM,4CAEd;kBAFQ,MAAM;;;AAKf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
package/dist/sonner.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx as o, jsxs as u } 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
- import { cva as d } from "class-variance-authority";
4
- import { Toaster as x, toast as f } from "sonner";
5
- import { Button as N } from "@brightlocal/ui-components/button";
6
- import { cn as a } from "@brightlocal/ui-components/lib/utils";
7
- const I = 4e3, T = d(
3
+ import { cva as m } from "class-variance-authority";
4
+ import { Toaster as N, toast as f } from "sonner";
5
+ import { Button as x } from "@brightlocal/ui-components/button";
6
+ import { cn as r } from "@brightlocal/ui-components/lib/utils";
7
+ const I = 4e3, T = m(
8
8
  [
9
9
  "flex",
10
10
  "items-center",
@@ -30,7 +30,7 @@ const I = 4e3, T = d(
30
30
  colorSchema: "default"
31
31
  }
32
32
  }
33
- ), k = d("text-sm leading-normal font-medium", {
33
+ ), k = m("text-sm leading-normal font-medium", {
34
34
  variants: {
35
35
  colorSchema: {
36
36
  default: "text-foreground",
@@ -40,7 +40,7 @@ const I = 4e3, T = d(
40
40
  defaultVariants: {
41
41
  colorSchema: "default"
42
42
  }
43
- }), A = d("text-sm leading-normal", {
43
+ }), A = m("text-sm leading-normal", {
44
44
  variants: {
45
45
  colorSchema: {
46
46
  default: "text-muted-foreground",
@@ -50,7 +50,7 @@ const I = 4e3, T = d(
50
50
  defaultVariants: {
51
51
  colorSchema: "default"
52
52
  }
53
- }), i = d("", {
53
+ }), i = m("", {
54
54
  variants: {
55
55
  colorSchema: {
56
56
  default: "text-foreground",
@@ -64,18 +64,18 @@ const I = 4e3, T = d(
64
64
  function C(n, e) {
65
65
  switch (n) {
66
66
  case "info":
67
- return /* @__PURE__ */ o(v, { className: a(i({ colorSchema: e })) });
67
+ return /* @__PURE__ */ o(v, { className: r(i({ colorSchema: e })) });
68
68
  case "success":
69
- return /* @__PURE__ */ o(g, { className: a(i({ colorSchema: e })) });
69
+ return /* @__PURE__ */ o(g, { className: r(i({ colorSchema: e })) });
70
70
  case "warning":
71
- return /* @__PURE__ */ o(b, { className: a(i({ colorSchema: e })) });
71
+ return /* @__PURE__ */ o(b, { className: r(i({ colorSchema: e })) });
72
72
  case "error":
73
- return /* @__PURE__ */ o(p, { className: a(i({ colorSchema: e })) });
73
+ return /* @__PURE__ */ o(p, { className: r(i({ colorSchema: e })) });
74
74
  case "loading":
75
75
  return /* @__PURE__ */ o(
76
76
  S,
77
77
  {
78
- className: a(i({ colorSchema: e }), "animate-spin")
78
+ className: r(i({ colorSchema: e }), "animate-spin")
79
79
  }
80
80
  );
81
81
  default:
@@ -83,34 +83,34 @@ function C(n, e) {
83
83
  }
84
84
  }
85
85
  const w = function(e, s) {
86
- const { id: c, ...t } = e, l = {
86
+ const { id: c, ...t } = e, d = {
87
87
  ...s,
88
88
  duration: s?.duration ?? I,
89
89
  ...c != null && { id: s?.id ?? c }
90
- }, h = l.duration === 1 / 0;
90
+ }, h = d.duration === 1 / 0;
91
91
  f.custom(
92
- (r) => {
93
- const m = t.button && t.button.label ? {
92
+ (a) => {
93
+ const l = t.button && t.button.label ? {
94
94
  label: t.button.label,
95
95
  variant: t.button.variant,
96
96
  onClick: () => {
97
- t.button?.onClick && t.button.onClick(), f.dismiss(r);
97
+ t.button?.onClick && t.button.onClick(), f.dismiss(a);
98
98
  }
99
99
  } : void 0;
100
100
  return /* @__PURE__ */ o(
101
101
  V,
102
102
  {
103
- button: m,
103
+ button: l,
104
104
  colorSchema: t.colorSchema,
105
105
  description: t.description,
106
106
  icon: t.icon ?? void 0,
107
- id: r,
107
+ id: a,
108
108
  title: t.title
109
109
  }
110
110
  );
111
111
  },
112
112
  {
113
- ...l,
113
+ ...d,
114
114
  ...h && { dismissible: !1 }
115
115
  }
116
116
  );
@@ -119,29 +119,31 @@ w.dismiss = (n) => {
119
119
  f.dismiss(n);
120
120
  };
121
121
  function V(n) {
122
- const { button: e, description: s, icon: c, title: t, colorSchema: l } = n, r = ((m) => m === "success" ? "success" : "default")(l);
122
+ const { button: e, description: s, icon: c, title: t, colorSchema: d } = n, a = ((l) => l === "success" ? "success" : "default")(d);
123
123
  return /* @__PURE__ */ u(
124
124
  "div",
125
125
  {
126
126
  "aria-atomic": "true",
127
127
  "aria-live": "polite",
128
- className: a(T({ colorSchema: r })),
128
+ className: r(T({ colorSchema: a })),
129
129
  role: "status",
130
130
  children: [
131
131
  /* @__PURE__ */ u("div", { className: "flex flex-1 items-start gap-2", children: [
132
- c != null && C(c, r),
132
+ c != null && (() => {
133
+ const l = C(c, a);
134
+ return l ? /* @__PURE__ */ o("span", { className: "mt-0.5 shrink-0", children: l }) : null;
135
+ })(),
133
136
  /* @__PURE__ */ u("div", { className: "w-full", children: [
134
- /* @__PURE__ */ o("p", { className: a(k({ colorSchema: r })), children: t }),
135
- s && /* @__PURE__ */ o("p", { className: a(A({ colorSchema: r })), children: s })
137
+ /* @__PURE__ */ o("p", { className: r(k({ colorSchema: a })), children: t }),
138
+ s && /* @__PURE__ */ o("p", { className: r(A({ colorSchema: a })), children: s })
136
139
  ] })
137
140
  ] }),
138
141
  e?.label && /* @__PURE__ */ o(
139
- N,
142
+ x,
140
143
  {
141
144
  "aria-label": e.label,
142
- className: "min-h-6 px-2 py-0 text-xs leading-normal font-medium",
143
145
  dataHook: "toast-action",
144
- size: "default",
146
+ size: "sm",
145
147
  variant: e.variant,
146
148
  onClick: e.onClick,
147
149
  children: e.label
@@ -152,7 +154,7 @@ function V(n) {
152
154
  );
153
155
  }
154
156
  function R() {
155
- return /* @__PURE__ */ o(x, { position: "top-right" });
157
+ return /* @__PURE__ */ o(N, { position: "top-right" });
156
158
  }
157
159
  R.displayName = "Sonner";
158
160
  export {
package/dist/tabs.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),m=require("react"),p=require("@radix-ui/react-tabs"),r=require("@brightlocal/ui-components/lib/utils");function l(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,s.get?s:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const c=l(m),d=l(p),b=c.forwardRef(({className:t,dataHook:e,trackingEl:a,trackingLabel:s,...i},n)=>o.jsx(d.Root,{ref:n,className:r.cn("flex flex-col gap-2",t),"data-hook":e,"data-slot":"tabs","data-tracking-el":a,"data-tracking-label":s,...i}));b.displayName="Tabs";const u=c.forwardRef(({className:t,dataHook:e,trackingEl:a,trackingLabel:s,...i},n)=>o.jsx(d.List,{ref:n,className:r.cn("inline-flex h-9 w-fit items-center justify-center","bg-muted rounded-lg","p-1",t),"data-hook":e,"data-slot":"tabs-list","data-tracking-el":a,"data-tracking-label":s,...i}));u.displayName="TabsList";const f=c.forwardRef(({className:t,dataHook:e,trackingEl:a,trackingLabel:s,...i},n)=>o.jsx(d.Trigger,{ref:n,className:r.cn("inline-flex items-center justify-center gap-2 px-2 py-1","text-sm font-medium whitespace-nowrap","rounded-md","border border-transparent","text-foreground","transition-[color,box-shadow] duration-150 ease-in-out","data-[state=active]:bg-background data-[state=active]:shadow-sm","focus-visible:border-ring focus-visible:outline-none","data-[state=inactive]:focus-visible:shadow-default","data-[state=active]:focus-visible:shadow-default","dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5","disabled:pointer-events-none disabled:opacity-50",t),"data-hook":e,"data-slot":"tabs-trigger","data-tracking-el":a,"data-tracking-label":s,...i}));f.displayName="TabsTrigger";const g=c.forwardRef(({className:t,dataHook:e,trackingEl:a,trackingLabel:s,...i},n)=>o.jsx(d.Content,{ref:n,className:r.cn("flex-1 outline-none",t),"data-hook":e,"data-slot":"tabs-content","data-tracking-el":a,"data-tracking-label":s,...i}));g.displayName="TabsContent";exports.Tabs=b;exports.TabsContent=g;exports.TabsList=u;exports.TabsTrigger=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),q=require("react"),L=require("@radix-ui/react-tabs"),g=require("@brightlocal/ui-components/lib/utils");function h(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,n.get?n:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const i=h(q),m=h(L),w=i.createContext({lazyMount:!1,unmountOnExit:!1,activeValue:void 0,visitedTabs:new Set}),j=i.forwardRef(({className:t,dataHook:s,trackingEl:a,trackingLabel:n,lazyMount:e=!1,unmountOnExit:r=!1,value:u,defaultValue:b,onValueChange:o,...T},v)=>{const c=e||r,[C,R]=i.useState(b),d=u??C,[x,O]=i.useState(()=>new Set(d!=null?[d]:[])),P=i.useCallback(f=>{R(f),e&&O(p=>{if(p.has(f))return p;const k=new Set(p);return k.add(f),k}),o?.(f)},[e,o]),_=i.useMemo(()=>({lazyMount:e,unmountOnExit:r,activeValue:d,visitedTabs:x}),[e,r,d,x]);return l.jsx(w.Provider,{value:_,children:l.jsx(m.Root,{ref:v,className:g.cn("flex flex-col gap-2",t),"data-hook":s,"data-slot":"tabs","data-tracking-el":a,"data-tracking-label":n,defaultValue:c?void 0:b,value:c?d:u,onValueChange:c?P:o,...T})})});j.displayName="Tabs";const y=i.forwardRef(({className:t,dataHook:s,trackingEl:a,trackingLabel:n,...e},r)=>l.jsx(m.List,{ref:r,className:g.cn("inline-flex h-9 w-fit items-center justify-center","bg-muted rounded-lg","p-1",t),"data-hook":s,"data-slot":"tabs-list","data-tracking-el":a,"data-tracking-label":n,...e}));y.displayName="TabsList";const N=i.forwardRef(({className:t,dataHook:s,trackingEl:a,trackingLabel:n,...e},r)=>l.jsx(m.Trigger,{ref:r,className:g.cn("inline-flex items-center justify-center gap-2 px-2 py-1","text-sm font-medium whitespace-nowrap","rounded-md","border border-transparent","text-foreground","transition-[color,box-shadow] duration-150 ease-in-out","data-[state=active]:bg-background data-[state=active]:shadow-sm","focus-visible:border-ring focus-visible:outline-none","data-[state=inactive]:focus-visible:shadow-default","data-[state=active]:focus-visible:shadow-default","dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5","disabled:pointer-events-none disabled:opacity-50",t),"data-hook":s,"data-slot":"tabs-trigger","data-tracking-el":a,"data-tracking-label":n,...e}));N.displayName="TabsTrigger";const S=i.forwardRef(({className:t,dataHook:s,trackingEl:a,trackingLabel:n,value:e,...r},u)=>{const{lazyMount:b,unmountOnExit:o,activeValue:T,visitedTabs:v}=i.useContext(w),c=e===T;return b&&!v.has(e)||o&&!c?null:l.jsx(m.Content,{ref:u,className:g.cn("flex-1 outline-none",t),"data-hook":s,"data-slot":"tabs-content","data-tracking-el":a,"data-tracking-label":n,value:e,...r})});S.displayName="TabsContent";exports.Tabs=j;exports.TabsContent=S;exports.TabsList=y;exports.TabsTrigger=N;
package/dist/tabs.d.ts CHANGED
@@ -10,6 +10,10 @@ interface TabsProps extends React.ComponentProps<typeof TabsPrimitive.Root> {
10
10
  trackingEl?: string;
11
11
  /** Tracking label for analytics context */
12
12
  trackingLabel?: string;
13
+ /** Only mount tab panel content when the tab is first activated (opt-in) */
14
+ lazyMount?: boolean;
15
+ /** Unmount tab panel content when the tab becomes inactive */
16
+ unmountOnExit?: boolean;
13
17
  }
14
18
  declare const Tabs: React.ForwardRefExoticComponent<Omit<TabsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
15
19
  /**