@brightlocal/ui-components 2.9.2 → 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 (67) 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/browser-entry.d.ts +17 -0
  11. package/dist/browser-entry.d.ts.map +1 -0
  12. package/dist/button.cjs +1 -1
  13. package/dist/button.js +25 -25
  14. package/dist/card.cjs +1 -1
  15. package/dist/card.d.ts +10 -1
  16. package/dist/card.d.ts.map +1 -1
  17. package/dist/card.js +85 -82
  18. package/dist/carousel.cjs +1 -1
  19. package/dist/carousel.d.ts +13 -1
  20. package/dist/carousel.d.ts.map +1 -1
  21. package/dist/carousel.js +196 -150
  22. package/dist/combobox.cjs +3 -3
  23. package/dist/combobox.d.ts +3 -3
  24. package/dist/combobox.d.ts.map +1 -1
  25. package/dist/combobox.js +480 -440
  26. package/dist/command.cjs +1 -1
  27. package/dist/command.d.ts +101 -1
  28. package/dist/command.d.ts.map +1 -1
  29. package/dist/command.js +383 -119
  30. package/dist/hooks/use-breakpoint.cjs +1 -1
  31. package/dist/hooks/use-breakpoint.d.ts.map +1 -1
  32. package/dist/hooks/use-breakpoint.js +10 -10
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +402 -391
  37. package/dist/input-chip.cjs +1 -1
  38. package/dist/input-chip.d.ts +1 -4
  39. package/dist/input-chip.d.ts.map +1 -1
  40. package/dist/input-chip.js +163 -170
  41. package/dist/map.cjs +1 -0
  42. package/dist/map.d.ts +192 -0
  43. package/dist/map.d.ts.map +1 -0
  44. package/dist/map.js +250 -0
  45. package/dist/sonner.cjs +1 -1
  46. package/dist/sonner.d.ts.map +1 -1
  47. package/dist/sonner.js +32 -30
  48. package/dist/tabs.cjs +1 -1
  49. package/dist/tabs.d.ts +4 -0
  50. package/dist/tabs.d.ts.map +1 -1
  51. package/dist/tabs.js +101 -52
  52. package/package.json +4 -1
  53. package/src/blocks/sidebar.tsx +21 -26
  54. package/src/browser-entry.ts +89 -0
  55. package/src/browser-tokens.css +1 -0
  56. package/src/components/badge.tsx +22 -5
  57. package/src/components/button.tsx +13 -13
  58. package/src/components/card.tsx +35 -19
  59. package/src/components/carousel.tsx +101 -9
  60. package/src/components/combobox.tsx +106 -28
  61. package/src/components/command.tsx +637 -16
  62. package/src/components/input-chip.tsx +102 -65
  63. package/src/components/map.tsx +574 -0
  64. package/src/components/sonner.tsx +9 -3
  65. package/src/components/tabs.tsx +118 -22
  66. package/src/hooks/use-breakpoint.ts +2 -3
  67. package/src/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../src/components/tabs.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAItD;;GAEG;AACH,UAAU,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,IAAI,CAAC;IACzE,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,QAAA,MAAM,IAAI,+FAaR,CAAC;AAIH;;GAEG;AACH,UAAU,aAAc,SAAQ,KAAK,CAAC,cAAc,CAClD,OAAO,aAAa,CAAC,IAAI,CAC1B;IACC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAg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GED
@@ -1,46 +1,89 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import * as d from "react";
3
- import * as n from "@radix-ui/react-tabs";
4
- import { cn as l } from "@brightlocal/ui-components/lib/utils";
5
- const c = d.forwardRef(({ className: a, dataHook: t, trackingEl: e, trackingLabel: s, ...o }, i) => /* @__PURE__ */ r(
6
- n.Root,
7
- {
8
- ref: i,
9
- className: l("flex flex-col gap-2", a),
10
- "data-hook": t,
11
- "data-slot": "tabs",
12
- "data-tracking-el": e,
13
- "data-tracking-label": s,
14
- ...o
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import * as g from "@radix-ui/react-tabs";
4
+ import { cn as m } from "@brightlocal/ui-components/lib/utils";
5
+ const x = a.createContext({
6
+ lazyMount: !1,
7
+ unmountOnExit: !1,
8
+ activeValue: void 0,
9
+ visitedTabs: /* @__PURE__ */ new Set()
10
+ }), S = a.forwardRef(
11
+ ({
12
+ className: s,
13
+ dataHook: i,
14
+ trackingEl: n,
15
+ trackingLabel: o,
16
+ lazyMount: t = !1,
17
+ unmountOnExit: e = !1,
18
+ value: b,
19
+ defaultValue: f,
20
+ onValueChange: r,
21
+ ...v
22
+ }, T) => {
23
+ const d = t || e, [w, N] = a.useState(f), l = b ?? w, [p, C] = a.useState(
24
+ () => new Set(l != null ? [l] : [])
25
+ ), y = a.useCallback(
26
+ (u) => {
27
+ N(u), t && C((k) => {
28
+ if (k.has(u)) return k;
29
+ const h = new Set(k);
30
+ return h.add(u), h;
31
+ }), r?.(u);
32
+ },
33
+ [t, r]
34
+ ), R = a.useMemo(
35
+ () => ({
36
+ lazyMount: t,
37
+ unmountOnExit: e,
38
+ activeValue: l,
39
+ visitedTabs: p
40
+ }),
41
+ [t, e, l, p]
42
+ );
43
+ return /* @__PURE__ */ c(x.Provider, { value: R, children: /* @__PURE__ */ c(
44
+ g.Root,
45
+ {
46
+ ref: T,
47
+ className: m("flex flex-col gap-2", s),
48
+ "data-hook": i,
49
+ "data-slot": "tabs",
50
+ "data-tracking-el": n,
51
+ "data-tracking-label": o,
52
+ defaultValue: d ? void 0 : f,
53
+ value: d ? l : b,
54
+ onValueChange: d ? y : r,
55
+ ...v
56
+ }
57
+ ) });
15
58
  }
16
- ));
17
- c.displayName = "Tabs";
18
- const b = d.forwardRef(({ className: a, dataHook: t, trackingEl: e, trackingLabel: s, ...o }, i) => /* @__PURE__ */ r(
19
- n.List,
59
+ );
60
+ S.displayName = "Tabs";
61
+ const j = a.forwardRef(({ className: s, dataHook: i, trackingEl: n, trackingLabel: o, ...t }, e) => /* @__PURE__ */ c(
62
+ g.List,
20
63
  {
21
- ref: i,
22
- className: l(
64
+ ref: e,
65
+ className: m(
23
66
  // Layout
24
67
  "inline-flex h-9 w-fit items-center justify-center",
25
68
  // Background and border radius
26
69
  "bg-muted rounded-lg",
27
70
  // Padding for container
28
71
  "p-1",
29
- a
72
+ s
30
73
  ),
31
- "data-hook": t,
74
+ "data-hook": i,
32
75
  "data-slot": "tabs-list",
33
- "data-tracking-el": e,
34
- "data-tracking-label": s,
35
- ...o
76
+ "data-tracking-el": n,
77
+ "data-tracking-label": o,
78
+ ...t
36
79
  }
37
80
  ));
38
- b.displayName = "TabsList";
39
- const f = d.forwardRef(({ className: a, dataHook: t, trackingEl: e, trackingLabel: s, ...o }, i) => /* @__PURE__ */ r(
40
- n.Trigger,
81
+ j.displayName = "TabsList";
82
+ const L = a.forwardRef(({ className: s, dataHook: i, trackingEl: n, trackingLabel: o, ...t }, e) => /* @__PURE__ */ c(
83
+ g.Trigger,
41
84
  {
42
- ref: i,
43
- className: l(
85
+ ref: e,
86
+ className: m(
44
87
  // Layout
45
88
  "inline-flex items-center justify-center gap-2 px-2 py-1",
46
89
  // Typography
@@ -63,32 +106,38 @@ const f = d.forwardRef(({ className: a, dataHook: t, trackingEl: e, trackingLabe
63
106
  "dark:data-[state=active]:border-white/15 dark:data-[state=active]:bg-white/5",
64
107
  // Disabled state
65
108
  "disabled:pointer-events-none disabled:opacity-50",
66
- a
109
+ s
67
110
  ),
68
- "data-hook": t,
111
+ "data-hook": i,
69
112
  "data-slot": "tabs-trigger",
70
- "data-tracking-el": e,
71
- "data-tracking-label": s,
72
- ...o
113
+ "data-tracking-el": n,
114
+ "data-tracking-label": o,
115
+ ...t
73
116
  }
74
117
  ));
75
- f.displayName = "TabsTrigger";
76
- const g = d.forwardRef(({ className: a, dataHook: t, trackingEl: e, trackingLabel: s, ...o }, i) => /* @__PURE__ */ r(
77
- n.Content,
78
- {
79
- ref: i,
80
- className: l("flex-1 outline-none", a),
81
- "data-hook": t,
82
- "data-slot": "tabs-content",
83
- "data-tracking-el": e,
84
- "data-tracking-label": s,
85
- ...o
118
+ L.displayName = "TabsTrigger";
119
+ const V = a.forwardRef(
120
+ ({ className: s, dataHook: i, trackingEl: n, trackingLabel: o, value: t, ...e }, b) => {
121
+ const { lazyMount: f, unmountOnExit: r, activeValue: v, visitedTabs: T } = a.useContext(x), d = t === v;
122
+ return f && !T.has(t) || r && !d ? null : /* @__PURE__ */ c(
123
+ g.Content,
124
+ {
125
+ ref: b,
126
+ className: m("flex-1 outline-none", s),
127
+ "data-hook": i,
128
+ "data-slot": "tabs-content",
129
+ "data-tracking-el": n,
130
+ "data-tracking-label": o,
131
+ value: t,
132
+ ...e
133
+ }
134
+ );
86
135
  }
87
- ));
88
- g.displayName = "TabsContent";
136
+ );
137
+ V.displayName = "TabsContent";
89
138
  export {
90
- c as Tabs,
91
- g as TabsContent,
92
- b as TabsList,
93
- f as TabsTrigger
139
+ S as Tabs,
140
+ V as TabsContent,
141
+ j as TabsList,
142
+ L as TabsTrigger
94
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightlocal/ui-components",
3
- "version": "2.9.2",
3
+ "version": "2.11.0",
4
4
  "description": "BrightLocal Design System UI Components",
5
5
  "type": "module",
6
6
  "private": false,
@@ -211,10 +211,13 @@
211
211
  "typecheck": "tsc --noEmit",
212
212
  "clean": "rm -rf dist",
213
213
  "build": "pnpm run clean && vite build",
214
+ "build:browser": "vite build --config vite.config.browser.ts && node scripts/audit-browser-demos.mjs",
214
215
  "size": "size-limit",
215
216
  "analyze": "vite-bundle-visualizer",
216
217
  "sync-meta": "node scripts/sync-component-meta.mjs",
217
218
  "sync-meta:check": "node scripts/sync-component-meta.mjs --check",
219
+ "audit-demos": "node scripts/audit-browser-demos.mjs",
220
+ "audit-demos:check": "node scripts/audit-browser-demos.mjs --check",
218
221
  "build:changelog": "node scripts/generate-changelog.js",
219
222
  "rel:patch": "node scripts/changeset-create.mjs patch",
220
223
  "rel:minor": "node scripts/changeset-create.mjs minor",
@@ -102,8 +102,6 @@ export enum SidebarMenuButtonVariant {
102
102
  COLLAPSIBLE = "collapsible",
103
103
  /** Has action menu (dots) on hover */
104
104
  DROPDOWN = "dropdown",
105
- /** Has a chevron for tree navigation */
106
- TREE = "tree",
107
105
  /** Has a number badge on the right */
108
106
  BADGE = "badge",
109
107
  /** Larger icon with title and subtitle */
@@ -408,7 +406,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
408
406
  <div
409
407
  ref={ref}
410
408
  className={cn(
411
- "text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",
409
+ "text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
412
410
  className
413
411
  )}
414
412
  data-hook={dataHook}
@@ -426,7 +424,7 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
426
424
  return (
427
425
  <Sheet open={openMobile} onOpenChange={setOpenMobile}>
428
426
  <SheetContent
429
- className="bg-sidebar-background text-sidebar-foreground w-[var(--sidebar-width)] p-6"
427
+ className="bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6"
430
428
  data-hook={`${dataHook}-mobile-content`}
431
429
  data-mobile="true"
432
430
  data-sidebar="sidebar"
@@ -452,10 +450,10 @@ const Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(
452
450
  ref={ref}
453
451
  className={cn(
454
452
  "group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",
455
- state === "expanded" && "w-[var(--sidebar-width)]",
453
+ state === "expanded" && "w-(--sidebar-width)",
456
454
  collapsible === SidebarCollapsible.ICON &&
457
455
  state === "collapsed" &&
458
- "w-[var(--sidebar-width-icon)]",
456
+ "w-(--sidebar-width-icon)",
459
457
  collapsible === SidebarCollapsible.OFFCANVAS &&
460
458
  state === "collapsed" &&
461
459
  "w-0",
@@ -493,7 +491,7 @@ interface SidebarTriggerProps extends Omit<
493
491
  }
494
492
 
495
493
  const SidebarTrigger = React.forwardRef<
496
- React.ElementRef<typeof Button>,
494
+ React.ComponentRef<typeof Button>,
497
495
  SidebarTriggerProps
498
496
  >(
499
497
  (
@@ -540,11 +538,11 @@ const SidebarRail = React.forwardRef<HTMLButtonElement, SidebarRailProps>(
540
538
  ref={ref}
541
539
  aria-label="Toggle Sidebar"
542
540
  className={cn(
543
- "hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
541
+ "hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-0.5 sm:flex",
544
542
  "cursor-w-resize",
545
- "[[data-state=collapsed]_&]:cursor-e-resize",
543
+ "in-data-[state=collapsed]:cursor-e-resize",
546
544
  "group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
547
- "[[data-collapsible=offcanvas]_&]:-right-2",
545
+ "in-data-[collapsible=offcanvas]:-right-2",
548
546
  className
549
547
  )}
550
548
  data-slot="sidebar-rail"
@@ -604,7 +602,7 @@ SidebarInset.displayName = "SidebarInset";
604
602
  type SidebarInputProps = Omit<React.ComponentProps<typeof Input>, "dataHook">;
605
603
 
606
604
  const SidebarInput = React.forwardRef<
607
- React.ElementRef<typeof Input>,
605
+ React.ComponentRef<typeof Input>,
608
606
  SidebarInputProps
609
607
  >(({ className, ...props }, ref) => {
610
608
  return (
@@ -677,14 +675,14 @@ SidebarFooter.displayName = "SidebarFooter";
677
675
  type SidebarSeparatorProps = React.ComponentProps<typeof Separator>;
678
676
 
679
677
  const SidebarSeparator = React.forwardRef<
680
- React.ElementRef<typeof Separator>,
678
+ React.ComponentRef<typeof Separator>,
681
679
  SidebarSeparatorProps
682
680
  >(({ className, ...props }, ref) => {
683
681
  return (
684
682
  <Separator
685
683
  ref={ref}
686
684
  className={cn(
687
- "bg-sidebar-border mx-2 my-2 w-auto group-data-[collapsible=icon]:mx-0",
685
+ "bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",
688
686
  className
689
687
  )}
690
688
  data-slot="sidebar-separator"
@@ -713,7 +711,7 @@ const SidebarContent = React.forwardRef<HTMLDivElement, SidebarContentProps>(
713
711
  <ScrollArea
714
712
  ref={ref}
715
713
  className={cn(
716
- "min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&>[data-slot=scroll-area-viewport]]:p-0",
714
+ "min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden *:data-[slot=scroll-area-viewport]:p-0 [&_[data-slot=scroll-area-viewport]>div]:block!",
717
715
  className
718
716
  )}
719
717
  dataHook={dataHook ?? "sidebar-content-scroll"}
@@ -1049,7 +1047,7 @@ const SidebarCollapseIcon = React.forwardRef<
1049
1047
  SidebarCollapseIcon.displayName = "SidebarCollapseIcon";
1050
1048
 
1051
1049
  const sidebarMenuButtonVariants = cva(
1052
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
1050
+ "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-of-type]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",
1053
1051
  {
1054
1052
  variants: {
1055
1053
  variant: {
@@ -1060,8 +1058,6 @@ const sidebarMenuButtonVariants = cva(
1060
1058
  "[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",
1061
1059
  // Dropdown - has action menu (dots) on hover
1062
1060
  dropdown: "group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",
1063
- // Tree - has a chevron for tree navigation
1064
- tree: "[&>[data-tree-icon]]:size-4 [&>[data-tree-icon]]:shrink-0 [&>[data-tree-icon]]:opacity-70 [&>[data-tree-icon]]:transition-transform data-[state=open]:[&>[data-tree-icon]]:rotate-90 group-data-[collapsible=icon]:[&>[data-tree-icon]]:hidden",
1065
1061
  // Badge - has a number badge on the right (handled via SidebarMenuBadge)
1066
1062
  badge: "group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",
1067
1063
  // Big Icon - larger icon with title and subtitle
@@ -1069,7 +1065,7 @@ const sidebarMenuButtonVariants = cva(
1069
1065
  "h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",
1070
1066
  // Checkbox - has a checkbox indicator
1071
1067
  checkbox:
1072
- "[&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground",
1068
+ "px-3 [&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground",
1073
1069
  },
1074
1070
  size: {
1075
1071
  default: "h-12 text-sm/4",
@@ -1213,7 +1209,6 @@ const SidebarMenuAction = React.forwardRef<
1213
1209
  "peer-data-[size=default]/menu-button:top-1.5",
1214
1210
  "peer-data-[size=lg]/menu-button:top-2.5",
1215
1211
  "peer-data-[size=bigIcon]/menu-button:top-2.5",
1216
- "peer-data-[size=tree]/menu-button:top-1.5",
1217
1212
  "group-data-[collapsible=icon]:hidden",
1218
1213
  showOnHover &&
1219
1214
  "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
@@ -1303,13 +1298,13 @@ const SidebarMenuSkeleton = React.forwardRef<
1303
1298
  SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
1304
1299
 
1305
1300
  const sidebarMenuSubVariants = cva(
1306
- "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
1301
+ "flex min-w-0 flex-col items-start gap-1 px-10 py-0.5 group-data-[collapsible=icon]:hidden",
1307
1302
  {
1308
1303
  variants: {
1309
1304
  variant: {
1310
1305
  default: "",
1311
- border: "border-l border-sidebar-border",
1312
- indent: "ml-0 border-l-0",
1306
+ border: "[&>li]:border-l [&>li]:border-sidebar-border",
1307
+ indent: "border-l-0",
1313
1308
  },
1314
1309
  },
1315
1310
  defaultVariants: {
@@ -1413,7 +1408,7 @@ const SidebarMenuSubButton = React.forwardRef<
1413
1408
  <Comp
1414
1409
  ref={ref}
1415
1410
  className={cn(
1416
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0",
1411
+ "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-foreground flex h-7 min-w-0 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-of-type]:truncate [&>svg]:shrink-0",
1417
1412
  "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
1418
1413
  size === SidebarMenuSubButtonSize.SM && "text-xs",
1419
1414
  size === SidebarMenuSubButtonSize.MD && "text-sm",
@@ -1507,16 +1502,16 @@ const SidebarMenuCollapsibleTrigger = React.forwardRef<
1507
1502
  <AccordionPrimitive.Trigger asChild>
1508
1503
  <SidebarMenuButton
1509
1504
  ref={ref}
1510
- className={cn("relative", className)}
1505
+ className={className}
1511
1506
  variant={SidebarMenuButtonVariant.COLLAPSIBLE}
1512
1507
  {...props}
1513
1508
  >
1509
+ {children}
1514
1510
  <ChevronRight
1515
1511
  data-collapse-icon
1516
- className="absolute left-2.5 !opacity-100 transition-transform duration-200 ease-out group-data-[state=open]/collapsible:rotate-90"
1512
+ className="opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden"
1517
1513
  size={12}
1518
1514
  />
1519
- {children}
1520
1515
  </SidebarMenuButton>
1521
1516
  </AccordionPrimitive.Trigger>
1522
1517
  ));
@@ -0,0 +1,89 @@
1
+ import "./browser-tokens.css";
2
+
3
+ import * as React from "react";
4
+ import * as ReactDOM from "react-dom";
5
+ import { createRoot, type Root } from "react-dom/client";
6
+ import * as allExports from "./index";
7
+
8
+ // Re-export everything from the barrel
9
+ export * from "./index";
10
+
11
+ export { React, ReactDOM };
12
+
13
+ export const h = React.createElement;
14
+ export const useState = React.useState;
15
+ export const useEffect = React.useEffect;
16
+ export const useMemo = React.useMemo;
17
+ export const useCallback = React.useCallback;
18
+ export const useRef = React.useRef;
19
+ export const useContext = React.useContext;
20
+ export const useReducer = React.useReducer;
21
+ export const useLayoutEffect = React.useLayoutEffect;
22
+ export const Fragment = React.Fragment;
23
+
24
+ // --- Mount API for IIFE consumers ---
25
+
26
+ const roots = new WeakMap<HTMLElement, Root>();
27
+
28
+ const PASCAL_CASE = /^[A-Z][a-zA-Z0-9]+$/;
29
+
30
+ function isComponent(
31
+ key: string,
32
+ value: unknown
33
+ ): value is React.ComponentType<Record<string, unknown>> {
34
+ if (!PASCAL_CASE.test(key)) return false;
35
+ if (typeof value === "function") return true;
36
+ if (typeof value === "object" && value !== null && "$$typeof" in value)
37
+ return true;
38
+ return false;
39
+ }
40
+
41
+ export function mount(
42
+ name: string,
43
+ container: HTMLElement,
44
+ props: Record<string, unknown> = {}
45
+ ): () => void {
46
+ const Component = (allExports as Record<string, unknown>)[name] as
47
+ | React.ComponentType<Record<string, unknown>>
48
+ | undefined;
49
+
50
+ if (!Component || !isComponent(name, Component)) {
51
+ const available = Object.keys(allExports)
52
+ .filter((k) => isComponent(k, (allExports as Record<string, unknown>)[k]))
53
+ .join(", ");
54
+ throw new Error(
55
+ `BrightLocalDS: Unknown component "${name}". Available: ${available}`
56
+ );
57
+ }
58
+
59
+ let root = roots.get(container);
60
+ if (!root) {
61
+ root = createRoot(container);
62
+ roots.set(container, root);
63
+ }
64
+
65
+ root.render(React.createElement(Component, props));
66
+
67
+ return () => {
68
+ root!.unmount();
69
+ roots.delete(container);
70
+ };
71
+ }
72
+
73
+ export function render(
74
+ element: React.ReactNode,
75
+ container: HTMLElement
76
+ ): () => void {
77
+ let root = roots.get(container);
78
+ if (!root) {
79
+ root = createRoot(container);
80
+ roots.set(container, root);
81
+ }
82
+
83
+ root.render(element);
84
+
85
+ return () => {
86
+ root!.unmount();
87
+ roots.delete(container);
88
+ };
89
+ }
@@ -0,0 +1 @@
1
+ @import "../../../packages/tokens/src/styles/tailwind-preset.css";
@@ -5,18 +5,35 @@ import { cva, type VariantProps } from "class-variance-authority";
5
5
  import { cn } from "@brightlocal/ui-components/lib/utils";
6
6
 
7
7
  const badgeVariants = cva(
8
- "inline-flex items-center justify-center rounded-full border px-2 py-1 text-xs font-semibold w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,background-color,border-color,box-shadow] overflow-hidden leading-none data-[number=true]:size-5 data-[number=true]:p-0 data-[number=true]:aspect-square",
8
+ [
9
+ // Layout
10
+ "inline-flex items-center justify-center gap-1 w-fit shrink-0 overflow-hidden",
11
+ // Spacing & shape
12
+ "rounded-full border px-2 py-1",
13
+ // Typography
14
+ "text-xs font-semibold whitespace-nowrap leading-none",
15
+ // Icons
16
+ "[&>svg]:size-3 [&>svg]:pointer-events-none",
17
+ // Transition
18
+ "transition-[color,background-color,border-color,box-shadow] duration-150 ease-in-out",
19
+ // Focus
20
+ "focus-visible:outline-none",
21
+ "focus-visible:shadow-[0_0_0_1px_white,0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(0,0,0,0.1)]",
22
+ "dark:focus-visible:shadow-[0_0_0_1px_var(--background),0_0_0_2px_var(--color-ring),0_0_0_4px_rgba(255,255,255,0.1)]",
23
+ // Number badge (single digit)
24
+ "data-[number=true]:size-5 data-[number=true]:p-0 data-[number=true]:aspect-square",
25
+ ],
9
26
  {
10
27
  variants: {
11
28
  variant: {
12
29
  primary:
13
- "border-transparent bg-primary text-primary-foreground dark:bg-primary dark:text-primary-foreground",
30
+ "border-transparent bg-success-background text-success-foreground",
14
31
  secondary:
15
- "border-transparent bg-secondary text-secondary-foreground dark:bg-secondary dark:text-secondary-foreground",
32
+ "border-transparent bg-secondary text-secondary-foreground focus-visible:border-ring",
16
33
  destructive:
17
- "border-transparent bg-destructive text-destructive-foreground dark:bg-destructive dark:text-destructive-foreground",
34
+ "border-transparent bg-destructive text-destructive-foreground",
18
35
  outline:
19
- "bg-background border-border text-foreground dark:bg-background dark:border-border dark:text-foreground",
36
+ "bg-background border-border text-foreground focus-visible:border-ring",
20
37
  },
21
38
  },
22
39
  defaultVariants: {
@@ -69,10 +69,22 @@ const ButtonVariants = cva(
69
69
  "hover:bg-primary/90",
70
70
  "focus-visible:shadow-default",
71
71
  ],
72
+ secondary: [
73
+ "bg-secondary",
74
+ "text-secondary-foreground",
75
+ "hover:bg-secondary/80",
76
+ "focus-visible:shadow-default",
77
+ ],
78
+ warning: [
79
+ "bg-warning-background",
80
+ "hover:bg-warning-background/80",
81
+ "text-warning-foreground",
82
+ "focus-visible:shadow-default",
83
+ ],
72
84
  destructive: [
73
85
  "bg-destructive",
74
86
  "dark:bg-red-400/90",
75
- "hover:bg-destructive/90",
87
+ "hover:bg-destructive/80",
76
88
  "dark:hover:bg-red-400/90",
77
89
  "text-destructive-foreground",
78
90
  "dark:text-red-950",
@@ -92,12 +104,6 @@ const ButtonVariants = cva(
92
104
  "focus-visible:shadow-default",
93
105
  "focus-visible:border-ring",
94
106
  ],
95
- secondary: [
96
- "bg-secondary",
97
- "text-secondary-foreground",
98
- "hover:bg-secondary/80",
99
- "focus-visible:shadow-default",
100
- ],
101
107
  ghost: [
102
108
  "bg-transparent",
103
109
  "text-foreground",
@@ -105,12 +111,6 @@ const ButtonVariants = cva(
105
111
  "data-[state=open]:bg-accent",
106
112
  "focus-visible:shadow-default",
107
113
  ],
108
- warning: [
109
- "bg-warning-light",
110
- "text-warning-foreground",
111
- "hover:bg-warning-light/90",
112
- "focus-visible:shadow-default",
113
- ],
114
114
  },
115
115
  size: {
116
116
  default: "px-4 py-2 h-9 text-sm",