@brightlocal/ui-components 2.26.0 → 3.0.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 (284) hide show
  1. package/README.md +9 -2
  2. package/component-meta.json +4010 -255
  3. package/deprecations.json +189 -2
  4. package/dist/accordion.cjs +1 -1
  5. package/dist/accordion.js +2 -2
  6. package/dist/alert-dialog.cjs +1 -1
  7. package/dist/alert-dialog.js +18 -18
  8. package/dist/alert.cjs +1 -1
  9. package/dist/alert.d.ts +11 -1
  10. package/dist/alert.d.ts.map +1 -1
  11. package/dist/alert.js +31 -28
  12. package/dist/avatar.cjs +1 -1
  13. package/dist/avatar.js +4 -4
  14. package/dist/badge.cjs +1 -1
  15. package/dist/badge.d.ts.map +1 -1
  16. package/dist/badge.js +15 -11
  17. package/dist/blocks/empty-state.cjs +1 -0
  18. package/dist/blocks/empty-state.d.ts +172 -0
  19. package/dist/blocks/empty-state.d.ts.map +1 -0
  20. package/dist/blocks/empty-state.js +155 -0
  21. package/dist/blocks/input-list.cjs +2 -2
  22. package/dist/blocks/input-list.d.ts.map +1 -1
  23. package/dist/blocks/input-list.js +124 -108
  24. package/dist/blocks/progress-state.cjs +1 -0
  25. package/dist/blocks/progress-state.d.ts +121 -0
  26. package/dist/blocks/progress-state.d.ts.map +1 -0
  27. package/dist/blocks/progress-state.js +368 -0
  28. package/dist/blocks/sidebar.cjs +1 -1
  29. package/dist/blocks/sidebar.d.ts.map +1 -1
  30. package/dist/blocks/sidebar.js +297 -296
  31. package/dist/brand-illustration-motif.d.ts +1 -1
  32. package/dist/breadcrumb.cjs +1 -1
  33. package/dist/breadcrumb.d.ts.map +1 -1
  34. package/dist/breadcrumb.js +44 -40
  35. package/dist/button.cjs +1 -1
  36. package/dist/button.d.ts.map +1 -1
  37. package/dist/button.js +23 -23
  38. package/dist/calendar.cjs +1 -1
  39. package/dist/calendar.d.ts.map +1 -1
  40. package/dist/calendar.js +37 -38
  41. package/dist/callout.cjs +1 -1
  42. package/dist/callout.d.ts +24 -2
  43. package/dist/callout.d.ts.map +1 -1
  44. package/dist/callout.js +57 -55
  45. package/dist/card.cjs +1 -1
  46. package/dist/card.d.ts +23 -2
  47. package/dist/card.d.ts.map +1 -1
  48. package/dist/card.js +94 -91
  49. package/dist/chart-empty.cjs +1 -0
  50. package/dist/chart-empty.d.ts +59 -0
  51. package/dist/chart-empty.d.ts.map +1 -0
  52. package/dist/chart-empty.js +29 -0
  53. package/dist/chart.cjs +6 -6
  54. package/dist/chart.d.ts +6 -1
  55. package/dist/chart.d.ts.map +1 -1
  56. package/dist/chart.js +183 -183
  57. package/dist/chip.cjs +1 -1
  58. package/dist/chip.d.ts +1 -1
  59. package/dist/chip.d.ts.map +1 -1
  60. package/dist/chip.js +47 -44
  61. package/dist/combobox.cjs +3 -3
  62. package/dist/combobox.d.ts +4 -2
  63. package/dist/combobox.d.ts.map +1 -1
  64. package/dist/combobox.js +143 -141
  65. package/dist/command.cjs +1 -1
  66. package/dist/command.d.ts.map +1 -1
  67. package/dist/command.js +74 -77
  68. package/dist/context-menu.cjs +1 -1
  69. package/dist/context-menu.d.ts.map +1 -1
  70. package/dist/context-menu.js +26 -29
  71. package/dist/data-table.cjs +1 -1
  72. package/dist/data-table.d.ts +182 -13
  73. package/dist/data-table.d.ts.map +1 -1
  74. package/dist/data-table.js +462 -314
  75. package/dist/description.cjs +1 -1
  76. package/dist/description.js +5 -5
  77. package/dist/dialog.cjs +1 -1
  78. package/dist/dialog.js +20 -20
  79. package/dist/drawer.cjs +1 -1
  80. package/dist/drawer.d.ts.map +1 -1
  81. package/dist/drawer.js +8 -11
  82. package/dist/dropdown-menu.cjs +1 -1
  83. package/dist/dropdown-menu.d.ts.map +1 -1
  84. package/dist/dropdown-menu.js +17 -20
  85. package/dist/field.cjs +1 -1
  86. package/dist/field.d.ts.map +1 -1
  87. package/dist/field.js +29 -25
  88. package/dist/global-layout.cjs +1 -1
  89. package/dist/global-layout.d.ts +58 -6
  90. package/dist/global-layout.d.ts.map +1 -1
  91. package/dist/global-layout.js +278 -194
  92. package/dist/grid.cjs +1 -0
  93. package/dist/grid.d.ts +56 -0
  94. package/dist/grid.d.ts.map +1 -0
  95. package/dist/grid.js +32 -0
  96. package/dist/header.d.ts +13 -0
  97. package/dist/header.d.ts.map +1 -1
  98. package/dist/hooks/use-delayed-pending.cjs +1 -0
  99. package/dist/hooks/use-delayed-pending.d.ts +34 -0
  100. package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
  101. package/dist/hooks/use-delayed-pending.js +17 -0
  102. package/dist/hover-card.cjs +1 -1
  103. package/dist/hover-card.js +13 -13
  104. package/dist/index.cjs +1 -1
  105. package/dist/index.d.ts +10 -0
  106. package/dist/index.d.ts.map +1 -1
  107. package/dist/index.js +523 -494
  108. package/dist/input-chip.cjs +1 -1
  109. package/dist/input-chip.js +25 -25
  110. package/dist/input-group.cjs +1 -1
  111. package/dist/input-group.js +9 -9
  112. package/dist/input-otp.cjs +1 -1
  113. package/dist/input-otp.js +9 -9
  114. package/dist/input-password.cjs +1 -1
  115. package/dist/input-password.js +51 -51
  116. package/dist/input.cjs +1 -1
  117. package/dist/input.js +9 -9
  118. package/dist/label.cjs +1 -1
  119. package/dist/label.d.ts.map +1 -1
  120. package/dist/label.js +25 -28
  121. package/dist/lib/block-illustration.cjs +1 -0
  122. package/dist/lib/block-illustration.d.ts +28 -0
  123. package/dist/lib/block-illustration.d.ts.map +1 -0
  124. package/dist/lib/block-illustration.js +21 -0
  125. package/dist/lib/empty-canvas.cjs +1 -0
  126. package/dist/lib/empty-canvas.d.ts +27 -0
  127. package/dist/lib/empty-canvas.d.ts.map +1 -0
  128. package/dist/lib/empty-canvas.js +62 -0
  129. package/dist/lib/motion.cjs +1 -1
  130. package/dist/lib/motion.js +10 -8
  131. package/dist/lib/optical-center.cjs +1 -0
  132. package/dist/lib/optical-center.d.ts +12 -0
  133. package/dist/lib/optical-center.d.ts.map +1 -0
  134. package/dist/lib/optical-center.js +11 -0
  135. package/dist/lib/utils.cjs +1 -1
  136. package/dist/lib/utils.d.ts.map +1 -1
  137. package/dist/lib/utils.js +28 -5
  138. package/dist/link.cjs +1 -1
  139. package/dist/link.d.ts +8 -6
  140. package/dist/link.d.ts.map +1 -1
  141. package/dist/link.js +52 -20
  142. package/dist/list.cjs +1 -1
  143. package/dist/list.d.ts.map +1 -1
  144. package/dist/list.js +87 -81
  145. package/dist/map.cjs +1 -1
  146. package/dist/map.d.ts +60 -2
  147. package/dist/map.d.ts.map +1 -1
  148. package/dist/map.js +187 -164
  149. package/dist/media-empty.cjs +1 -0
  150. package/dist/media-empty.d.ts +72 -0
  151. package/dist/media-empty.d.ts.map +1 -0
  152. package/dist/media-empty.js +45 -0
  153. package/dist/menubar.cjs +1 -1
  154. package/dist/menubar.d.ts.map +1 -1
  155. package/dist/menubar.js +17 -20
  156. package/dist/navigation-menu.cjs +1 -1
  157. package/dist/navigation-menu.js +7 -7
  158. package/dist/pagination.cjs +1 -1
  159. package/dist/pagination.d.ts +127 -1
  160. package/dist/pagination.d.ts.map +1 -1
  161. package/dist/pagination.js +189 -98
  162. package/dist/progress.cjs +1 -1
  163. package/dist/progress.d.ts +37 -3
  164. package/dist/progress.d.ts.map +1 -1
  165. package/dist/progress.js +102 -64
  166. package/dist/route-progress.cjs +1 -0
  167. package/dist/route-progress.d.ts +103 -0
  168. package/dist/route-progress.d.ts.map +1 -0
  169. package/dist/route-progress.js +106 -0
  170. package/dist/select.cjs +2 -2
  171. package/dist/select.d.ts.map +1 -1
  172. package/dist/select.js +19 -18
  173. package/dist/separator.cjs +1 -1
  174. package/dist/separator.js +8 -8
  175. package/dist/sheet.cjs +1 -1
  176. package/dist/sheet.d.ts +35 -2
  177. package/dist/sheet.d.ts.map +1 -1
  178. package/dist/sheet.js +103 -66
  179. package/dist/skeleton.cjs +1 -1
  180. package/dist/skeleton.d.ts +38 -3
  181. package/dist/skeleton.d.ts.map +1 -1
  182. package/dist/skeleton.js +43 -20
  183. package/dist/sonner.cjs +1 -1
  184. package/dist/sonner.d.ts.map +1 -1
  185. package/dist/sonner.js +32 -36
  186. package/dist/spinner.cjs +1 -0
  187. package/dist/spinner.d.ts +57 -0
  188. package/dist/spinner.d.ts.map +1 -0
  189. package/dist/spinner.js +35 -0
  190. package/dist/stepper.cjs +1 -1
  191. package/dist/stepper.d.ts.map +1 -1
  192. package/dist/stepper.js +23 -22
  193. package/dist/table.cjs +1 -1
  194. package/dist/table.d.ts +1 -1
  195. package/dist/table.d.ts.map +1 -1
  196. package/dist/table.js +36 -29
  197. package/dist/tabs.cjs +1 -1
  198. package/dist/tabs.js +1 -1
  199. package/dist/text-reveal-motion.d.ts +10 -0
  200. package/dist/text-reveal-motion.d.ts.map +1 -1
  201. package/dist/textarea.cjs +1 -1
  202. package/dist/textarea.js +11 -11
  203. package/dist/toggle.cjs +1 -1
  204. package/dist/toggle.js +8 -8
  205. package/dist/tooltip.cjs +1 -1
  206. package/dist/tooltip.js +8 -8
  207. package/dist/typography-heading.cjs +1 -0
  208. package/dist/typography-heading.d.ts +116 -0
  209. package/dist/typography-heading.d.ts.map +1 -0
  210. package/dist/typography-heading.js +84 -0
  211. package/dist/typography-text.cjs +1 -0
  212. package/dist/typography-text.d.ts +113 -0
  213. package/dist/typography-text.d.ts.map +1 -0
  214. package/dist/typography-text.js +81 -0
  215. package/dist/typography.d.ts +13 -0
  216. package/dist/typography.d.ts.map +1 -1
  217. package/package.json +42 -2
  218. package/src/blocks/empty-state.tsx +424 -0
  219. package/src/blocks/input-list.tsx +66 -36
  220. package/src/blocks/progress-state.tsx +542 -0
  221. package/src/blocks/sidebar.tsx +46 -40
  222. package/src/components/accordion.tsx +2 -2
  223. package/src/components/alert-dialog.tsx +2 -2
  224. package/src/components/alert.tsx +27 -13
  225. package/src/components/avatar.tsx +1 -1
  226. package/src/components/badge.tsx +8 -4
  227. package/src/components/breadcrumb.tsx +9 -4
  228. package/src/components/button.tsx +5 -8
  229. package/src/components/calendar.tsx +5 -6
  230. package/src/components/callout.tsx +48 -15
  231. package/src/components/card.tsx +52 -17
  232. package/src/components/chart-empty.tsx +116 -0
  233. package/src/components/chart.tsx +43 -17
  234. package/src/components/chip.tsx +9 -6
  235. package/src/components/combobox.tsx +21 -12
  236. package/src/components/command.tsx +9 -10
  237. package/src/components/context-menu.tsx +6 -9
  238. package/src/components/data-table.tsx +405 -31
  239. package/src/components/description.tsx +1 -1
  240. package/src/components/dialog.tsx +2 -2
  241. package/src/components/drawer.tsx +2 -5
  242. package/src/components/dropdown-menu.tsx +8 -11
  243. package/src/components/field.tsx +8 -4
  244. package/src/components/global-layout.tsx +264 -65
  245. package/src/components/grid.tsx +130 -0
  246. package/src/components/header.tsx +13 -0
  247. package/src/components/hover-card.tsx +1 -1
  248. package/src/components/input-chip.tsx +1 -1
  249. package/src/components/input-group.tsx +1 -1
  250. package/src/components/input-otp.tsx +1 -1
  251. package/src/components/input-password.tsx +1 -1
  252. package/src/components/input.tsx +1 -1
  253. package/src/components/label.tsx +10 -13
  254. package/src/components/link.tsx +39 -5
  255. package/src/components/list.tsx +18 -14
  256. package/src/components/map.tsx +101 -5
  257. package/src/components/media-empty.tsx +156 -0
  258. package/src/components/menubar.tsx +7 -10
  259. package/src/components/navigation-menu.tsx +1 -1
  260. package/src/components/pagination.tsx +279 -1
  261. package/src/components/progress.tsx +120 -11
  262. package/src/components/route-progress.tsx +354 -0
  263. package/src/components/select.tsx +5 -4
  264. package/src/components/separator.tsx +1 -1
  265. package/src/components/sheet.tsx +89 -7
  266. package/src/components/skeleton.tsx +78 -7
  267. package/src/components/sonner.tsx +5 -14
  268. package/src/components/spinner.tsx +94 -0
  269. package/src/components/stepper.tsx +6 -7
  270. package/src/components/table.tsx +11 -4
  271. package/src/components/tabs.tsx +1 -1
  272. package/src/components/text-reveal-motion.tsx +10 -0
  273. package/src/components/textarea.tsx +1 -1
  274. package/src/components/toggle.tsx +1 -1
  275. package/src/components/tooltip.tsx +1 -1
  276. package/src/components/typography-heading.tsx +229 -0
  277. package/src/components/typography-text.tsx +225 -0
  278. package/src/components/typography.tsx +13 -0
  279. package/src/hooks/use-delayed-pending.ts +60 -0
  280. package/src/index.ts +12 -0
  281. package/src/lib/block-illustration.tsx +88 -0
  282. package/src/lib/empty-canvas.tsx +128 -0
  283. package/src/lib/optical-center.tsx +45 -0
  284. package/src/lib/utils.ts +26 -0
@@ -1,48 +1,49 @@
1
- import { jsx as s, jsxs as b } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { ArrowLeft as x } from "@brightlocal/icons";
4
- import { cn as c } from "@brightlocal/ui-components/lib/utils";
5
- import { Header as y } from "./header.js";
6
- import { Link as k } from "./link.js";
7
- import { ScrollArea as w } from "./scroll-area.js";
8
- import { TypographyMuted as g } from "./typography.js";
9
- const v = i.forwardRef(
1
+ import { jsx as n, jsxs as u, Fragment as G } from "react/jsx-runtime";
2
+ import * as r from "react";
3
+ import { ArrowLeft as C } from "@brightlocal/icons";
4
+ import { cn as m } from "@brightlocal/ui-components/lib/utils";
5
+ import { Breadcrumb as R } from "./breadcrumb.js";
6
+ import { Header as g } from "./header.js";
7
+ import { Link as H } from "./link.js";
8
+ import { ScrollArea as j } from "./scroll-area.js";
9
+ import { TypographyText as E } from "./typography-text.js";
10
+ const S = r.forwardRef(
10
11
  ({
11
- className: e,
12
- maxWidth: a = "var(--ds-breakpoint-xl)",
13
- dataHook: t,
14
- trackingEl: o,
15
- trackingLabel: l,
16
- children: n,
17
- ...r
18
- }, d) => {
19
- const u = typeof a == "number" ? `${a}px` : a;
20
- return /* @__PURE__ */ s(
21
- w,
12
+ className: t,
13
+ maxWidth: e = "none",
14
+ dataHook: a,
15
+ trackingEl: l,
16
+ trackingLabel: o,
17
+ children: s,
18
+ ...d
19
+ }, c) => {
20
+ const f = typeof e == "number" ? `${e}px` : e;
21
+ return /* @__PURE__ */ n(
22
+ j,
22
23
  {
23
- className: c(
24
- "h-dvh w-full [&>[data-radix-scroll-area-viewport]>div]:block! [&>[data-radix-scroll-area-viewport]>div]:min-w-0!",
25
- e
24
+ className: m(
25
+ "h-dvh w-full [&>[data-radix-scroll-area-viewport]]:p-0! [&>[data-radix-scroll-area-viewport]>div]:block! [&>[data-radix-scroll-area-viewport]>div]:min-w-0!",
26
+ t
26
27
  ),
27
- dataHook: `${t}-scroll`,
28
+ dataHook: `${a}-scroll`,
28
29
  scrollOrientation: "both",
29
- children: /* @__PURE__ */ s(
30
+ children: /* @__PURE__ */ n(
30
31
  "div",
31
32
  {
32
- ref: d,
33
- className: "p-section-sm flex min-h-dvh w-full flex-col",
34
- "data-hook": t,
33
+ ref: c,
34
+ className: "flex min-h-dvh w-full flex-col",
35
+ "data-hook": a,
35
36
  "data-slot": "global-layout",
36
- "data-tracking-el": o,
37
- "data-tracking-label": l,
38
- ...r,
39
- children: /* @__PURE__ */ s(
37
+ "data-tracking-el": l,
38
+ "data-tracking-label": o,
39
+ ...d,
40
+ children: /* @__PURE__ */ n(
40
41
  "div",
41
42
  {
42
43
  className: "mx-auto flex w-full flex-1",
43
44
  "data-slot": "global-container",
44
- style: { maxWidth: u },
45
- children: n
45
+ style: { maxWidth: f },
46
+ children: s
46
47
  }
47
48
  )
48
49
  }
@@ -51,217 +52,300 @@ const v = i.forwardRef(
51
52
  );
52
53
  }
53
54
  );
54
- v.displayName = "GlobalLayout";
55
- const L = "224px", N = i.forwardRef(({ className: e, width: a = L, dataHook: t, children: o, ...l }, n) => {
56
- const r = typeof a == "number" ? `${a}px` : a;
57
- return /* @__PURE__ */ s(
55
+ S.displayName = "GlobalLayout";
56
+ const B = "288px", _ = r.forwardRef(({ className: t, width: e = B, dataHook: a, children: l, ...o }, s) => {
57
+ const d = typeof e == "number" ? `${e}px` : e;
58
+ return /* @__PURE__ */ n(
58
59
  "aside",
59
60
  {
60
- ref: n,
61
- className: c(
61
+ ref: s,
62
+ className: m(
62
63
  "sticky hidden shrink-0 self-start outline-none lg:block",
63
- e
64
+ t
64
65
  ),
65
- "data-hook": t,
66
+ "data-hook": a,
66
67
  "data-slot": "sidebar-container",
67
- ...l,
68
+ ...o,
68
69
  style: {
69
- width: r,
70
- top: "var(--ds-section-padding-y-sm)",
71
- height: "calc(100dvh - 2 * var(--ds-section-padding-y-sm))",
72
- ...l.style
70
+ width: d,
71
+ top: 0,
72
+ height: "100dvh",
73
+ ...o.style
73
74
  },
74
- children: o
75
+ children: l
75
76
  }
76
77
  );
77
78
  });
78
- N.displayName = "GlobalLayoutSidebar";
79
- const G = i.forwardRef(
79
+ _.displayName = "GlobalLayoutSidebar";
80
+ const A = r.forwardRef(
80
81
  ({
81
- className: e,
82
- maxWidth: a = "var(--ds-breakpoint-lg)",
83
- dataHook: t,
84
- children: o,
85
- ...l
86
- }, n) => {
87
- const r = typeof a == "number" ? `${a}px` : a;
88
- return /* @__PURE__ */ s(
82
+ className: t,
83
+ maxWidth: e = "var(--ds-breakpoint-lg)",
84
+ dataHook: a,
85
+ children: l,
86
+ ...o
87
+ }, s) => {
88
+ const d = typeof e == "number" ? `${e}px` : e;
89
+ return /* @__PURE__ */ n(
89
90
  "div",
90
91
  {
91
- ref: n,
92
- className: c(
93
- "px-section-xs flex min-w-0 flex-1 flex-col gap-6",
94
- e
92
+ ref: s,
93
+ className: m(
94
+ "pb-section-sm lg:pt-section-sm flex min-w-0 flex-1 flex-col gap-6",
95
+ t
95
96
  ),
96
- "data-hook": t,
97
+ "data-hook": a,
97
98
  "data-slot": "content-wrapper",
98
- style: { "--content-max-width": r },
99
- ...l,
100
- children: o
99
+ style: { "--content-max-width": d },
100
+ ...o,
101
+ children: l
101
102
  }
102
103
  );
103
104
  }
104
105
  );
105
- G.displayName = "GlobalLayoutContent";
106
- const p = i.forwardRef(({ dataHook: e, ariaLabel: a, href: t, onClick: o, ...l }, n) => /* @__PURE__ */ s(
107
- k,
106
+ A.displayName = "GlobalLayoutContent";
107
+ const x = "px-4 md:px-6 lg:px-section-xs", w = r.forwardRef(({ dataHook: t, ariaLabel: e, href: a, onClick: l, ...o }, s) => /* @__PURE__ */ n(
108
+ H,
108
109
  {
109
- ref: n,
110
- "aria-label": a || "Go back",
110
+ ref: s,
111
+ "aria-label": e || "Go back",
111
112
  "data-slot": "content-header-back-link",
112
- dataHook: e ?? "content-header-back-link",
113
- href: t ?? "#",
113
+ dataHook: t ?? "content-header-back-link",
114
+ href: a ?? "#",
114
115
  variant: "icon",
115
- onClick: (d) => {
116
- t === void 0 && d.preventDefault(), o?.(d);
116
+ onClick: (c) => {
117
+ a === void 0 && c.preventDefault(), l?.(c);
117
118
  },
118
- ...l,
119
- children: /* @__PURE__ */ s(x, { "aria-hidden": "true" })
119
+ ...o,
120
+ children: /* @__PURE__ */ n(C, { "aria-hidden": "true" })
120
121
  }
121
122
  ));
122
- p.displayName = "GlobalLayoutBackLink";
123
- const h = i.forwardRef(({ dataHook: e, ...a }, t) => /* @__PURE__ */ s(
124
- g,
123
+ w.displayName = "GlobalLayoutBackLink";
124
+ const k = r.forwardRef(({ dataHook: t, asChild: e, ...a }, l) => /* @__PURE__ */ n(
125
+ E,
125
126
  {
126
- ref: t,
127
+ ref: l,
128
+ asChild: e,
129
+ color: "muted",
127
130
  "data-slot": "content-header-subtitle",
128
- dataHook: e ?? "content-header-subtitle",
131
+ dataHook: t ?? "content-header-subtitle",
132
+ variant: "body-sm",
129
133
  ...a
130
134
  }
131
135
  ));
132
- h.displayName = "GlobalLayoutSubtitle";
133
- const C = i.forwardRef(
134
- ({ className: e, dataHook: a, trackingEl: t, trackingLabel: o, children: l, ...n }, r) => {
135
- const d = [], u = [], m = [];
136
- return i.Children.forEach(l, (f) => {
137
- i.isValidElement(f) && f.type === p ? d.push(f) : i.isValidElement(f) && f.type === h ? u.push(f) : m.push(f);
138
- }), d.length === 0 && u.length === 0 ? /* @__PURE__ */ s(
139
- y,
136
+ k.displayName = "GlobalLayoutSubtitle";
137
+ const v = r.forwardRef(({ className: t, dataHook: e, children: a, ...l }, o) => /* @__PURE__ */ n(
138
+ "div",
139
+ {
140
+ ref: o,
141
+ className: m(
142
+ "aspect-[3/2] h-12 shrink-0 overflow-hidden rounded-md [&_img]:size-full [&_img]:object-cover",
143
+ t
144
+ ),
145
+ "data-hook": e ?? "content-header-image",
146
+ "data-slot": "content-header-image",
147
+ ...l,
148
+ children: a
149
+ }
150
+ ));
151
+ v.displayName = "GlobalLayoutImage";
152
+ const I = r.forwardRef(
153
+ ({ className: t, dataHook: e, trackingEl: a, trackingLabel: l, children: o, ...s }, d) => {
154
+ const c = [], f = [], y = [], p = [], b = [], h = [];
155
+ return r.Children.forEach(o, (i) => {
156
+ r.isValidElement(i) && i.type === w ? c.push(i) : r.isValidElement(i) && i.type === v ? f.push(i) : r.isValidElement(i) && i.type === R ? y.push(i) : r.isValidElement(i) && i.type === k ? p.push(i) : r.isValidElement(i) && i.type === L ? b.push(i) : h.push(i);
157
+ }), c.length === 0 && f.length === 0 && y.length === 0 && p.length === 0 && b.length === 0 ? /* @__PURE__ */ n(
158
+ "div",
140
159
  {
141
- ref: r,
142
- className: c(
143
- "mx-auto w-full flex-wrap justify-between gap-4",
144
- e
145
- ),
146
- "data-slot": "content-header",
147
- dataHook: a,
148
- style: { maxWidth: "var(--ds-breakpoint-lg)" },
149
- trackingEl: t,
150
- trackingLabel: o,
151
- ...n,
152
- children: l
160
+ className: m("w-full", x),
161
+ "data-slot": "content-header-region",
162
+ children: /* @__PURE__ */ n(
163
+ g,
164
+ {
165
+ ref: d,
166
+ className: m(
167
+ "mx-auto w-full flex-wrap justify-between gap-4 max-md:flex-col max-md:items-start",
168
+ t
169
+ ),
170
+ "data-slot": "content-header",
171
+ dataHook: e,
172
+ style: { maxWidth: "var(--ds-breakpoint-lg)" },
173
+ trackingEl: a,
174
+ trackingLabel: l,
175
+ ...s,
176
+ children: o
177
+ }
178
+ )
153
179
  }
154
- ) : /* @__PURE__ */ b(
155
- y,
180
+ ) : /* @__PURE__ */ n(
181
+ "div",
156
182
  {
157
- ref: r,
158
- className: c("mx-auto w-full items-start", e),
159
- "data-slot": "content-header",
160
- dataHook: a,
161
- style: { maxWidth: "var(--ds-breakpoint-lg)" },
162
- trackingEl: t,
163
- trackingLabel: o,
164
- ...n,
165
- children: [
166
- d,
167
- /* @__PURE__ */ b(
168
- "div",
169
- {
170
- className: "flex min-w-0 flex-1 flex-col gap-2",
171
- "data-slot": "content-header-body",
172
- children: [
173
- /* @__PURE__ */ s(
174
- "div",
175
- {
176
- className: "flex w-full flex-wrap items-center justify-between gap-4",
177
- "data-slot": "content-header-title",
178
- children: m
179
- }
180
- ),
181
- u
182
- ]
183
- }
184
- )
185
- ]
183
+ className: m("w-full", x),
184
+ "data-slot": "content-header-region",
185
+ children: /* @__PURE__ */ u(
186
+ g,
187
+ {
188
+ ref: d,
189
+ className: m("mx-auto w-full items-start gap-4", t),
190
+ "data-slot": "content-header",
191
+ dataHook: e,
192
+ style: { maxWidth: "var(--ds-breakpoint-lg)" },
193
+ trackingEl: a,
194
+ trackingLabel: l,
195
+ ...s,
196
+ children: [
197
+ c,
198
+ f,
199
+ /* @__PURE__ */ u(
200
+ "div",
201
+ {
202
+ className: "flex min-w-0 flex-1 flex-col gap-2",
203
+ "data-slot": "content-header-body",
204
+ children: [
205
+ y,
206
+ b.length > 0 ? (
207
+ // With a slotted GlobalLayoutContentActions the header follows
208
+ // the Figma Page Header structure: a text block (title +
209
+ // description) with the actions beside it — and below it on
210
+ // mobile, so the action lands under the description.
211
+ /* @__PURE__ */ u(
212
+ "div",
213
+ {
214
+ className: "flex w-full flex-wrap items-start justify-between gap-4 max-md:flex-col",
215
+ "data-slot": "content-header-title",
216
+ children: [
217
+ /* @__PURE__ */ u(
218
+ "div",
219
+ {
220
+ className: "flex min-w-0 flex-1 flex-col gap-2",
221
+ "data-slot": "content-header-text",
222
+ children: [
223
+ h,
224
+ p
225
+ ]
226
+ }
227
+ ),
228
+ /* @__PURE__ */ n(N.Provider, { value: !0, children: b })
229
+ ]
230
+ }
231
+ )
232
+ ) : /* @__PURE__ */ u(G, { children: [
233
+ /* @__PURE__ */ n(
234
+ "div",
235
+ {
236
+ className: "flex w-full flex-wrap items-center justify-between gap-4 max-md:flex-col max-md:items-start",
237
+ "data-slot": "content-header-title",
238
+ children: h
239
+ }
240
+ ),
241
+ p
242
+ ] })
243
+ ]
244
+ }
245
+ )
246
+ ]
247
+ }
248
+ )
186
249
  }
187
250
  );
188
251
  }
189
252
  );
190
- C.displayName = "GlobalLayoutContentHeader";
191
- const R = i.forwardRef(
192
- ({ className: e, dataHook: a, trackingEl: t, trackingLabel: o, children: l, ...n }, r) => /* @__PURE__ */ s(
193
- "div",
194
- {
195
- ref: r,
196
- className: c(
197
- "mx-auto hidden w-full items-center justify-end gap-2 lg:flex",
198
- e
199
- ),
200
- "data-hook": a,
201
- "data-slot": "content-actions",
202
- "data-tracking-el": t,
203
- "data-tracking-label": o,
204
- style: { maxWidth: "var(--ds-breakpoint-lg)" },
205
- ...n,
206
- children: l
207
- }
208
- )
253
+ I.displayName = "GlobalLayoutContentHeader";
254
+ const N = r.createContext(!1), L = r.forwardRef(
255
+ ({ className: t, dataHook: e, trackingEl: a, trackingLabel: l, children: o, ...s }, d) => {
256
+ const c = r.useContext(N), f = /* @__PURE__ */ n(
257
+ "div",
258
+ {
259
+ ref: d,
260
+ className: m(
261
+ c ? "flex shrink-0 items-center gap-2" : "mx-auto hidden w-full items-center justify-end gap-2 lg:flex",
262
+ t
263
+ ),
264
+ "data-hook": e,
265
+ "data-slot": "content-actions",
266
+ "data-tracking-el": a,
267
+ "data-tracking-label": l,
268
+ style: c ? void 0 : { maxWidth: "var(--ds-breakpoint-lg)" },
269
+ ...s,
270
+ children: o
271
+ }
272
+ );
273
+ return c ? f : /* @__PURE__ */ n(
274
+ "div",
275
+ {
276
+ className: m("w-full", x),
277
+ "data-slot": "content-actions-region",
278
+ children: f
279
+ }
280
+ );
281
+ }
209
282
  );
210
- R.displayName = "GlobalLayoutContentActions";
211
- const H = i.forwardRef(
212
- ({ className: e, dataHook: a, trackingEl: t, trackingLabel: o, children: l, ...n }, r) => /* @__PURE__ */ s(
283
+ L.displayName = "GlobalLayoutContentActions";
284
+ const M = r.forwardRef(
285
+ ({ className: t, dataHook: e, trackingEl: a, trackingLabel: l, children: o, ...s }, d) => /* @__PURE__ */ n(
213
286
  "div",
214
287
  {
215
- ref: r,
216
- className: c("mx-auto flex w-full flex-1 flex-col gap-6", e),
217
- "data-hook": a,
218
- "data-slot": "content-body",
219
- "data-tracking-el": t,
220
- "data-tracking-label": o,
221
- style: { maxWidth: "var(--content-max-width)" },
222
- ...n,
223
- children: l
288
+ className: m("flex w-full flex-1 flex-col", x),
289
+ "data-slot": "content-body-region",
290
+ children: /* @__PURE__ */ n(
291
+ "div",
292
+ {
293
+ ref: d,
294
+ className: m("mx-auto flex w-full flex-1 flex-col gap-6", t),
295
+ "data-hook": e,
296
+ "data-slot": "content-body",
297
+ "data-tracking-el": a,
298
+ "data-tracking-label": l,
299
+ style: { maxWidth: "var(--content-max-width)" },
300
+ ...s,
301
+ children: o
302
+ }
303
+ )
224
304
  }
225
305
  )
226
306
  );
227
- H.displayName = "GlobalLayoutContentBody";
228
- const S = i.forwardRef(
307
+ M.displayName = "GlobalLayoutContentBody";
308
+ const T = r.forwardRef(
229
309
  ({
230
- className: e,
231
- dataHook: a,
232
- ariaLabel: t,
233
- trackingEl: o,
234
- trackingLabel: l,
235
- children: n,
236
- ...r
237
- }, d) => /* @__PURE__ */ s(
310
+ className: t,
311
+ dataHook: e,
312
+ ariaLabel: a,
313
+ trackingEl: l,
314
+ trackingLabel: o,
315
+ children: s,
316
+ ...d
317
+ }, c) => /* @__PURE__ */ n(
238
318
  "div",
239
319
  {
240
- ref: d,
241
- "aria-label": t ?? "Mobile navigation",
242
- className: c(
243
- "flex w-full items-center justify-start gap-2.5 py-2 lg:hidden",
244
- e
320
+ ref: c,
321
+ "aria-label": a ?? "Mobile navigation",
322
+ className: m(
323
+ // The 2px negative margin pulls a slotted SidebarTrigger's box
324
+ // left by its icon inset so the burger glyph — not the invisible
325
+ // button box — sits on the content edge.
326
+ "flex w-full items-center justify-start gap-2 px-4 pt-6 pb-2 md:px-6 lg:hidden [&_[data-slot=sidebar-trigger]]:-ml-0.5",
327
+ t
245
328
  ),
246
- "data-hook": a,
329
+ "data-hook": e,
247
330
  "data-slot": "mobile-header",
248
- "data-tracking-el": o,
249
- "data-tracking-label": l,
331
+ "data-tracking-el": l,
332
+ "data-tracking-label": o,
250
333
  role: "toolbar",
251
- ...r,
252
- children: n
334
+ ...d,
335
+ children: s
253
336
  }
254
337
  )
255
338
  );
256
- S.displayName = "GlobalLayoutMobileHeader";
339
+ T.displayName = "GlobalLayoutMobileHeader";
257
340
  export {
258
- v as GlobalLayout,
259
- p as GlobalLayoutBackLink,
260
- G as GlobalLayoutContent,
261
- R as GlobalLayoutContentActions,
262
- H as GlobalLayoutContentBody,
263
- C as GlobalLayoutContentHeader,
264
- S as GlobalLayoutMobileHeader,
265
- N as GlobalLayoutSidebar,
266
- h as GlobalLayoutSubtitle
341
+ S as GlobalLayout,
342
+ w as GlobalLayoutBackLink,
343
+ A as GlobalLayoutContent,
344
+ L as GlobalLayoutContentActions,
345
+ M as GlobalLayoutContentBody,
346
+ I as GlobalLayoutContentHeader,
347
+ v as GlobalLayoutImage,
348
+ T as GlobalLayoutMobileHeader,
349
+ _ as GlobalLayoutSidebar,
350
+ k as GlobalLayoutSubtitle
267
351
  };
package/dist/grid.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),d=require("react"),u=require("@brightlocal/ui-components/lib/utils"),f=require("./lib/optical-center.cjs");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const p=g(d),c=p.forwardRef(({className:e,children:r,dataHook:t,variant:a,trackingEl:i,trackingLabel:l,...o},s)=>n.jsx("div",{ref:s,className:u.cn("flex w-full flex-1 flex-col items-center",e),"data-hook":t,"data-slot":"grid","data-tracking-el":i??"grid","data-tracking-label":l,"data-variant":a,...o,children:n.jsx(f.OpticalCenter,{children:r})}));c.displayName="Grid";exports.Grid=c;
package/dist/grid.d.ts ADDED
@@ -0,0 +1,56 @@
1
+ import * as React from "react";
2
+ /**
3
+ * The named layouts. Closed on purpose — a layout the vocabulary lacks is a
4
+ * signal to add a value here, not a className at the call site.
5
+ * (`stack`, `row`, `cards` are reserved for DS-970.)
6
+ */
7
+ type GridVariant = "centered";
8
+ interface GridBaseProps extends React.ComponentPropsWithoutRef<"div"> {
9
+ /**
10
+ * Required data-hook attribute for automated testing.
11
+ * @example "locations-empty-center"
12
+ */
13
+ dataHook: string;
14
+ /**
15
+ * Tracking element identifier for analytics.
16
+ */
17
+ trackingEl?: string;
18
+ /**
19
+ * Tracking label for analytics context.
20
+ */
21
+ trackingLabel?: string;
22
+ }
23
+ /**
24
+ * One message at the page body's optical centre (38/62). Give it a page body
25
+ * to fill — it stretches with `flex-1` — and one message to hold.
26
+ */
27
+ interface GridCenteredProps extends GridBaseProps {
28
+ variant: "centered";
29
+ }
30
+ /**
31
+ * Props for the Grid primitive. `variant` discriminates the shapes; each
32
+ * variant carries only the modifiers it actually has.
33
+ */
34
+ export type GridProps = GridCenteredProps;
35
+ /**
36
+ * The layout primitive: a closed vocabulary of named layouts instead of
37
+ * hand-rolled flex/grid classNames.
38
+ *
39
+ * @example
40
+ * ```tsx
41
+ * <GlobalLayoutContentBody dataHook="locations-body">
42
+ * <Grid dataHook="locations-empty-center" variant="centered">
43
+ * <EmptyState
44
+ * dataHook="locations-empty"
45
+ * illustration={<BusinessLocation aria-hidden />}
46
+ * size="lg"
47
+ * title={t("locations.empty.title")}
48
+ * />
49
+ * </Grid>
50
+ * </GlobalLayoutContentBody>
51
+ * ```
52
+ */
53
+ declare const Grid: React.ForwardRefExoticComponent<GridCenteredProps & React.RefAttributes<HTMLDivElement>>;
54
+ export { Grid };
55
+ export type { GridVariant };
56
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/components/grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAwC/B;;;;GAIG;AACH,KAAK,WAAW,GAAG,UAAU,CAAC;AAE9B,UAAU,aAAc,SAAQ,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC;IACnE;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,UAAU,iBAAkB,SAAQ,aAAa;IAC/C,OAAO,EAAE,UAAU,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,iBAAiB,CAAC;AAE1C;;;;;;;;;;;;;;;;;GAiBG;AACH,QAAA,MAAM,IAAI,0FA4BT,CAAC;AAIF,OAAO,EAAE,IAAI,EAAE,CAAC;AAEhB,YAAY,EAAE,WAAW,EAAE,CAAC"}
package/dist/grid.js ADDED
@@ -0,0 +1,32 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import * as c from "react";
3
+ import { cn as f } from "@brightlocal/ui-components/lib/utils";
4
+ import { OpticalCenter as n } from "./lib/optical-center.js";
5
+ const s = c.forwardRef(
6
+ ({
7
+ className: r,
8
+ children: t,
9
+ dataHook: e,
10
+ variant: i,
11
+ trackingEl: o,
12
+ trackingLabel: l,
13
+ ...d
14
+ }, m) => /* @__PURE__ */ a(
15
+ "div",
16
+ {
17
+ ref: m,
18
+ className: f("flex w-full flex-1 flex-col items-center", r),
19
+ "data-hook": e,
20
+ "data-slot": "grid",
21
+ "data-tracking-el": o ?? "grid",
22
+ "data-tracking-label": l,
23
+ "data-variant": i,
24
+ ...d,
25
+ children: /* @__PURE__ */ a(n, { children: t })
26
+ }
27
+ )
28
+ );
29
+ s.displayName = "Grid";
30
+ export {
31
+ s as Grid
32
+ };