@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.
- package/README.md +9 -2
- package/component-meta.json +4010 -255
- package/deprecations.json +189 -2
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.js +2 -2
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.js +18 -18
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts +11 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +31 -28
- package/dist/avatar.cjs +1 -1
- package/dist/avatar.js +4 -4
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +15 -11
- package/dist/blocks/empty-state.cjs +1 -0
- package/dist/blocks/empty-state.d.ts +172 -0
- package/dist/blocks/empty-state.d.ts.map +1 -0
- package/dist/blocks/empty-state.js +155 -0
- package/dist/blocks/input-list.cjs +2 -2
- package/dist/blocks/input-list.d.ts.map +1 -1
- package/dist/blocks/input-list.js +124 -108
- package/dist/blocks/progress-state.cjs +1 -0
- package/dist/blocks/progress-state.d.ts +121 -0
- package/dist/blocks/progress-state.d.ts.map +1 -0
- package/dist/blocks/progress-state.js +368 -0
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +297 -296
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +44 -40
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +23 -23
- package/dist/calendar.cjs +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +37 -38
- package/dist/callout.cjs +1 -1
- package/dist/callout.d.ts +24 -2
- package/dist/callout.d.ts.map +1 -1
- package/dist/callout.js +57 -55
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +23 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +94 -91
- package/dist/chart-empty.cjs +1 -0
- package/dist/chart-empty.d.ts +59 -0
- package/dist/chart-empty.d.ts.map +1 -0
- package/dist/chart-empty.js +29 -0
- package/dist/chart.cjs +6 -6
- package/dist/chart.d.ts +6 -1
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +183 -183
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +1 -1
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +47 -44
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +4 -2
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +143 -141
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +74 -77
- package/dist/context-menu.cjs +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +26 -29
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +182 -13
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +462 -314
- package/dist/description.cjs +1 -1
- package/dist/description.js +5 -5
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +20 -20
- package/dist/drawer.cjs +1 -1
- package/dist/drawer.d.ts.map +1 -1
- package/dist/drawer.js +8 -11
- package/dist/dropdown-menu.cjs +1 -1
- package/dist/dropdown-menu.d.ts.map +1 -1
- package/dist/dropdown-menu.js +17 -20
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +29 -25
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +58 -6
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +278 -194
- package/dist/grid.cjs +1 -0
- package/dist/grid.d.ts +56 -0
- package/dist/grid.d.ts.map +1 -0
- package/dist/grid.js +32 -0
- package/dist/header.d.ts +13 -0
- package/dist/header.d.ts.map +1 -1
- package/dist/hooks/use-delayed-pending.cjs +1 -0
- package/dist/hooks/use-delayed-pending.d.ts +34 -0
- package/dist/hooks/use-delayed-pending.d.ts.map +1 -0
- package/dist/hooks/use-delayed-pending.js +17 -0
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.js +13 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +523 -494
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +25 -25
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.js +9 -9
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.js +51 -51
- package/dist/input.cjs +1 -1
- package/dist/input.js +9 -9
- package/dist/label.cjs +1 -1
- package/dist/label.d.ts.map +1 -1
- package/dist/label.js +25 -28
- package/dist/lib/block-illustration.cjs +1 -0
- package/dist/lib/block-illustration.d.ts +28 -0
- package/dist/lib/block-illustration.d.ts.map +1 -0
- package/dist/lib/block-illustration.js +21 -0
- package/dist/lib/empty-canvas.cjs +1 -0
- package/dist/lib/empty-canvas.d.ts +27 -0
- package/dist/lib/empty-canvas.d.ts.map +1 -0
- package/dist/lib/empty-canvas.js +62 -0
- package/dist/lib/motion.cjs +1 -1
- package/dist/lib/motion.js +10 -8
- package/dist/lib/optical-center.cjs +1 -0
- package/dist/lib/optical-center.d.ts +12 -0
- package/dist/lib/optical-center.d.ts.map +1 -0
- package/dist/lib/optical-center.js +11 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +28 -5
- package/dist/link.cjs +1 -1
- package/dist/link.d.ts +8 -6
- package/dist/link.d.ts.map +1 -1
- package/dist/link.js +52 -20
- package/dist/list.cjs +1 -1
- package/dist/list.d.ts.map +1 -1
- package/dist/list.js +87 -81
- package/dist/map.cjs +1 -1
- package/dist/map.d.ts +60 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +187 -164
- package/dist/media-empty.cjs +1 -0
- package/dist/media-empty.d.ts +72 -0
- package/dist/media-empty.d.ts.map +1 -0
- package/dist/media-empty.js +45 -0
- package/dist/menubar.cjs +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +17 -20
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.js +7 -7
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +127 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +189 -98
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +37 -3
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +102 -64
- package/dist/route-progress.cjs +1 -0
- package/dist/route-progress.d.ts +103 -0
- package/dist/route-progress.d.ts.map +1 -0
- package/dist/route-progress.js +106 -0
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +19 -18
- package/dist/separator.cjs +1 -1
- package/dist/separator.js +8 -8
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +35 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +103 -66
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.d.ts +38 -3
- package/dist/skeleton.d.ts.map +1 -1
- package/dist/skeleton.js +43 -20
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +32 -36
- package/dist/spinner.cjs +1 -0
- package/dist/spinner.d.ts +57 -0
- package/dist/spinner.d.ts.map +1 -0
- package/dist/spinner.js +35 -0
- package/dist/stepper.cjs +1 -1
- package/dist/stepper.d.ts.map +1 -1
- package/dist/stepper.js +23 -22
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +1 -1
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +36 -29
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.js +1 -1
- package/dist/text-reveal-motion.d.ts +10 -0
- package/dist/text-reveal-motion.d.ts.map +1 -1
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +11 -11
- package/dist/toggle.cjs +1 -1
- package/dist/toggle.js +8 -8
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.js +8 -8
- package/dist/typography-heading.cjs +1 -0
- package/dist/typography-heading.d.ts +116 -0
- package/dist/typography-heading.d.ts.map +1 -0
- package/dist/typography-heading.js +84 -0
- package/dist/typography-text.cjs +1 -0
- package/dist/typography-text.d.ts +113 -0
- package/dist/typography-text.d.ts.map +1 -0
- package/dist/typography-text.js +81 -0
- package/dist/typography.d.ts +13 -0
- package/dist/typography.d.ts.map +1 -1
- package/package.json +42 -2
- package/src/blocks/empty-state.tsx +424 -0
- package/src/blocks/input-list.tsx +66 -36
- package/src/blocks/progress-state.tsx +542 -0
- package/src/blocks/sidebar.tsx +46 -40
- package/src/components/accordion.tsx +2 -2
- package/src/components/alert-dialog.tsx +2 -2
- package/src/components/alert.tsx +27 -13
- package/src/components/avatar.tsx +1 -1
- package/src/components/badge.tsx +8 -4
- package/src/components/breadcrumb.tsx +9 -4
- package/src/components/button.tsx +5 -8
- package/src/components/calendar.tsx +5 -6
- package/src/components/callout.tsx +48 -15
- package/src/components/card.tsx +52 -17
- package/src/components/chart-empty.tsx +116 -0
- package/src/components/chart.tsx +43 -17
- package/src/components/chip.tsx +9 -6
- package/src/components/combobox.tsx +21 -12
- package/src/components/command.tsx +9 -10
- package/src/components/context-menu.tsx +6 -9
- package/src/components/data-table.tsx +405 -31
- package/src/components/description.tsx +1 -1
- package/src/components/dialog.tsx +2 -2
- package/src/components/drawer.tsx +2 -5
- package/src/components/dropdown-menu.tsx +8 -11
- package/src/components/field.tsx +8 -4
- package/src/components/global-layout.tsx +264 -65
- package/src/components/grid.tsx +130 -0
- package/src/components/header.tsx +13 -0
- package/src/components/hover-card.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +1 -1
- package/src/components/input.tsx +1 -1
- package/src/components/label.tsx +10 -13
- package/src/components/link.tsx +39 -5
- package/src/components/list.tsx +18 -14
- package/src/components/map.tsx +101 -5
- package/src/components/media-empty.tsx +156 -0
- package/src/components/menubar.tsx +7 -10
- package/src/components/navigation-menu.tsx +1 -1
- package/src/components/pagination.tsx +279 -1
- package/src/components/progress.tsx +120 -11
- package/src/components/route-progress.tsx +354 -0
- package/src/components/select.tsx +5 -4
- package/src/components/separator.tsx +1 -1
- package/src/components/sheet.tsx +89 -7
- package/src/components/skeleton.tsx +78 -7
- package/src/components/sonner.tsx +5 -14
- package/src/components/spinner.tsx +94 -0
- package/src/components/stepper.tsx +6 -7
- package/src/components/table.tsx +11 -4
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-reveal-motion.tsx +10 -0
- package/src/components/textarea.tsx +1 -1
- package/src/components/toggle.tsx +1 -1
- package/src/components/tooltip.tsx +1 -1
- package/src/components/typography-heading.tsx +229 -0
- package/src/components/typography-text.tsx +225 -0
- package/src/components/typography.tsx +13 -0
- package/src/hooks/use-delayed-pending.ts +60 -0
- package/src/index.ts +12 -0
- package/src/lib/block-illustration.tsx +88 -0
- package/src/lib/empty-canvas.tsx +128 -0
- package/src/lib/optical-center.tsx +45 -0
- package/src/lib/utils.ts +26 -0
package/dist/field.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { cva as u } from "class-variance-authority";
|
|
3
3
|
import { AlertCircle as g } from "@brightlocal/icons";
|
|
4
|
-
import { cn as
|
|
4
|
+
import { cn as o } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
import { Description as p } from "./description.js";
|
|
6
6
|
import { Label as h } from "@brightlocal/ui-components/label";
|
|
7
|
-
function
|
|
7
|
+
function b({ className: t, ...a }) {
|
|
8
8
|
return /* @__PURE__ */ l(
|
|
9
9
|
"fieldset",
|
|
10
10
|
{
|
|
11
|
-
className:
|
|
11
|
+
className: o(
|
|
12
12
|
"flex flex-col gap-6",
|
|
13
13
|
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
14
14
|
// sr-only children (FieldLegend srOnly) are position:absolute — FieldSet
|
|
@@ -21,7 +21,7 @@ function m({ className: t, ...a }) {
|
|
|
21
21
|
}
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
b.displayName = "FieldSet";
|
|
25
25
|
const N = ["legend", "label"];
|
|
26
26
|
function F({
|
|
27
27
|
className: t,
|
|
@@ -32,10 +32,10 @@ function F({
|
|
|
32
32
|
return /* @__PURE__ */ l(
|
|
33
33
|
"legend",
|
|
34
34
|
{
|
|
35
|
-
className:
|
|
36
|
-
"mb-3
|
|
37
|
-
"data-[variant=legend]:text-
|
|
38
|
-
"data-[variant=label]:text-
|
|
35
|
+
className: o(
|
|
36
|
+
"mb-3",
|
|
37
|
+
"data-[variant=legend]:text-heading-subsection",
|
|
38
|
+
"data-[variant=label]:text-label",
|
|
39
39
|
e && "sr-only",
|
|
40
40
|
t
|
|
41
41
|
),
|
|
@@ -49,7 +49,7 @@ function V({ className: t, ...a }) {
|
|
|
49
49
|
return /* @__PURE__ */ l(
|
|
50
50
|
"div",
|
|
51
51
|
{
|
|
52
|
-
className:
|
|
52
|
+
className: o(
|
|
53
53
|
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
54
54
|
t
|
|
55
55
|
),
|
|
@@ -58,7 +58,7 @@ function V({ className: t, ...a }) {
|
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const m = u(
|
|
62
62
|
[
|
|
63
63
|
"group/field flex w-full gap-2",
|
|
64
64
|
// RadioGroup context: positioned ancestor for RadioGroupItem click overlay + pointer cursor
|
|
@@ -81,6 +81,9 @@ const b = u(
|
|
|
81
81
|
"grid grid-cols-[auto_1fr] items-center gap-x-2",
|
|
82
82
|
"[&>[data-slot=field-description]]:col-start-2 [&>[data-slot=field-error]]:col-start-2",
|
|
83
83
|
"has-[>[data-slot=field-content]]:items-start",
|
|
84
|
+
// Top-aligned rows: a 16px control centres on the label's first line
|
|
85
|
+
// (text-label is 20px), never on the content box's top edge.
|
|
86
|
+
"has-[>[data-slot=field-content]]:[&>[role=radio]]:mt-0.5",
|
|
84
87
|
// sr-only label leaves grid flow — collapse to a single column
|
|
85
88
|
"has-[>.sr-only[data-slot=field-label]]:grid-cols-[1fr]",
|
|
86
89
|
"[&:has(>.sr-only[data-slot=field-label])>[data-slot=field-description]]:col-start-1",
|
|
@@ -90,6 +93,7 @@ const b = u(
|
|
|
90
93
|
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:grid @md/field-group:grid-cols-[auto_1fr] @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
91
94
|
"@md/field-group:[&>[data-slot=field-description]]:col-start-2 @md/field-group:[&>[data-slot=field-error]]:col-start-2",
|
|
92
95
|
"@md/field-group:has-[>[data-slot=field-content]]:items-start",
|
|
96
|
+
"@md/field-group:has-[>[data-slot=field-content]]:[&>[role=radio]]:mt-0.5",
|
|
93
97
|
// sr-only label leaves grid flow — collapse to a single column
|
|
94
98
|
"@md/field-group:has-[>.sr-only[data-slot=field-label]]:grid-cols-[1fr]",
|
|
95
99
|
"@md/field-group:[&:has(>.sr-only[data-slot=field-label])>[data-slot=field-description]]:col-start-1",
|
|
@@ -132,13 +136,13 @@ function z({
|
|
|
132
136
|
variant: e = "default",
|
|
133
137
|
align: d = "start",
|
|
134
138
|
dataHook: i,
|
|
135
|
-
...
|
|
139
|
+
...r
|
|
136
140
|
}) {
|
|
137
141
|
return /* @__PURE__ */ l(
|
|
138
142
|
"div",
|
|
139
143
|
{
|
|
140
|
-
className:
|
|
141
|
-
|
|
144
|
+
className: o(
|
|
145
|
+
m({ orientation: a, variant: e }),
|
|
142
146
|
d === "end" && a === "horizontal" && "grid-cols-[1fr_auto]",
|
|
143
147
|
t
|
|
144
148
|
),
|
|
@@ -147,7 +151,7 @@ function z({
|
|
|
147
151
|
"data-slot": "field",
|
|
148
152
|
"data-variant": e,
|
|
149
153
|
role: "group",
|
|
150
|
-
...
|
|
154
|
+
...r
|
|
151
155
|
}
|
|
152
156
|
);
|
|
153
157
|
}
|
|
@@ -155,7 +159,7 @@ function L({ className: t, ...a }) {
|
|
|
155
159
|
return /* @__PURE__ */ l(
|
|
156
160
|
"div",
|
|
157
161
|
{
|
|
158
|
-
className:
|
|
162
|
+
className: o(
|
|
159
163
|
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
160
164
|
// Center text for boxIconVertical RadioGroup
|
|
161
165
|
"[[data-variant=boxIconVertical]_&]:items-center [[data-variant=boxIconVertical]_&]:text-center",
|
|
@@ -175,7 +179,7 @@ function I({
|
|
|
175
179
|
return /* @__PURE__ */ l(
|
|
176
180
|
h,
|
|
177
181
|
{
|
|
178
|
-
className:
|
|
182
|
+
className: o(
|
|
179
183
|
// Base label styles from primitives are inherited via Label component
|
|
180
184
|
// Reset to mb-0 when label wraps a field (card variant for radio/checkbox)
|
|
181
185
|
"group/field-label peer/field-label w-fit",
|
|
@@ -200,7 +204,7 @@ function S({
|
|
|
200
204
|
return /* @__PURE__ */ l(
|
|
201
205
|
p,
|
|
202
206
|
{
|
|
203
|
-
className:
|
|
207
|
+
className: o(
|
|
204
208
|
// Field-specific positioning and context styles
|
|
205
209
|
"mt-2",
|
|
206
210
|
"group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
@@ -222,7 +226,7 @@ function C({
|
|
|
222
226
|
t,
|
|
223
227
|
{
|
|
224
228
|
"aria-hidden": "true",
|
|
225
|
-
className:
|
|
229
|
+
className: o("inline-block shrink-0 align-text-bottom", a),
|
|
226
230
|
...e
|
|
227
231
|
}
|
|
228
232
|
);
|
|
@@ -234,18 +238,18 @@ function D({
|
|
|
234
238
|
errors: d,
|
|
235
239
|
...i
|
|
236
240
|
}) {
|
|
237
|
-
const
|
|
241
|
+
const r = d?.filter(
|
|
238
242
|
(s) => !!s?.message
|
|
239
243
|
);
|
|
240
|
-
if (!e && (!
|
|
244
|
+
if (!e && (!r || r.length === 0))
|
|
241
245
|
return null;
|
|
242
|
-
const n =
|
|
243
|
-
"text-
|
|
246
|
+
const n = o(
|
|
247
|
+
"text-body-sm text-destructive-foreground",
|
|
244
248
|
"mt-2",
|
|
245
249
|
"group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
246
250
|
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
247
251
|
t
|
|
248
|
-
), c =
|
|
252
|
+
), c = r && r.length > 1;
|
|
249
253
|
return /* @__PURE__ */ l(
|
|
250
254
|
"div",
|
|
251
255
|
{
|
|
@@ -254,7 +258,7 @@ function D({
|
|
|
254
258
|
"data-slot": "field-error",
|
|
255
259
|
role: "alert",
|
|
256
260
|
...i,
|
|
257
|
-
children: c ? /* @__PURE__ */ l("ul", { className: "list-disc space-y-1 pl-4", children:
|
|
261
|
+
children: c ? /* @__PURE__ */ l("ul", { className: "list-disc space-y-1 pl-4", children: r.map((s, f) => /* @__PURE__ */ l("li", { children: s.message }, f)) }) : /* @__PURE__ */ l("p", { className: "m-0", children: e || r?.[0]?.message })
|
|
258
262
|
}
|
|
259
263
|
);
|
|
260
264
|
}
|
|
@@ -267,6 +271,6 @@ export {
|
|
|
267
271
|
V as FieldGroup,
|
|
268
272
|
I as FieldLabel,
|
|
269
273
|
F as FieldLegend,
|
|
270
|
-
|
|
274
|
+
b as FieldSet,
|
|
271
275
|
N as fieldLegendVariants
|
|
272
276
|
};
|
package/dist/global-layout.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),H=require("react"),q=require("@brightlocal/icons"),u=require("@brightlocal/ui-components/lib/utils"),O=require("./breadcrumb.cjs"),v=require("./header.cjs"),_=require("./link.cjs"),B=require("./scroll-area.cjs"),E=require("./typography-text.cjs");function M(a){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const t in a)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>a[t]})}}return e.default=a,Object.freeze(e)}const s=M(H),j=s.forwardRef(({className:a,maxWidth:e="none",dataHook:t,trackingEl:o,trackingLabel:n,children:r,...i},c)=>{const f=typeof e=="number"?`${e}px`:e;return l.jsx(B.ScrollArea,{className:u.cn("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!",a),dataHook:`${t}-scroll`,scrollOrientation:"both",children:l.jsx("div",{ref:c,className:"flex min-h-dvh w-full flex-col","data-hook":t,"data-slot":"global-layout","data-tracking-el":o,"data-tracking-label":n,...i,children:l.jsx("div",{className:"mx-auto flex w-full flex-1","data-slot":"global-container",style:{maxWidth:f},children:r})})})});j.displayName="GlobalLayout";const T="288px",L=s.forwardRef(({className:a,width:e=T,dataHook:t,children:o,...n},r)=>{const i=typeof e=="number"?`${e}px`:e;return l.jsx("aside",{ref:r,className:u.cn("sticky hidden shrink-0 self-start outline-none lg:block",a),"data-hook":t,"data-slot":"sidebar-container",...n,style:{width:i,top:0,height:"100dvh",...n.style},children:o})});L.displayName="GlobalLayoutSidebar";const G=s.forwardRef(({className:a,maxWidth:e="var(--ds-breakpoint-lg)",dataHook:t,children:o,...n},r)=>{const i=typeof e=="number"?`${e}px`:e;return l.jsx("div",{ref:r,className:u.cn("pb-section-sm lg:pt-section-sm flex min-w-0 flex-1 flex-col gap-6",a),"data-hook":t,"data-slot":"content-wrapper",style:{"--content-max-width":i},...n,children:o})});G.displayName="GlobalLayoutContent";const x="px-4 md:px-6 lg:px-section-xs",h=s.forwardRef(({dataHook:a,ariaLabel:e,href:t,onClick:o,...n},r)=>{const i=c=>{t===void 0&&c.preventDefault(),o?.(c)};return l.jsx(_.Link,{ref:r,"aria-label":e||"Go back","data-slot":"content-header-back-link",dataHook:a??"content-header-back-link",href:t??"#",variant:"icon",onClick:i,...n,children:l.jsx(q.ArrowLeft,{"aria-hidden":"true"})})});h.displayName="GlobalLayoutBackLink";const g=s.forwardRef(({dataHook:a,asChild:e,...t},o)=>l.jsx(E.TypographyText,{ref:o,asChild:e,color:"muted","data-slot":"content-header-subtitle",dataHook:a??"content-header-subtitle",variant:"body-sm",...t}));g.displayName="GlobalLayoutSubtitle";const w=s.forwardRef(({className:a,dataHook:e,children:t,...o},n)=>l.jsx("div",{ref:n,className:u.cn("aspect-[3/2] h-12 shrink-0 overflow-hidden rounded-md [&_img]:size-full [&_img]:object-cover",a),"data-hook":e??"content-header-image","data-slot":"content-header-image",...o,children:t}));w.displayName="GlobalLayoutImage";const N=s.forwardRef(({className:a,dataHook:e,trackingEl:t,trackingLabel:o,children:n,...r},i)=>{const c=[],f=[],y=[],m=[],b=[],p=[];return s.Children.forEach(n,d=>{s.isValidElement(d)&&d.type===h?c.push(d):s.isValidElement(d)&&d.type===w?f.push(d):s.isValidElement(d)&&d.type===O.Breadcrumb?y.push(d):s.isValidElement(d)&&d.type===g?m.push(d):s.isValidElement(d)&&d.type===k?b.push(d):p.push(d)}),c.length===0&&f.length===0&&y.length===0&&m.length===0&&b.length===0?l.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-header-region",children:l.jsx(v.Header,{ref:i,className:u.cn("mx-auto w-full flex-wrap justify-between gap-4 max-md:flex-col max-md:items-start",a),"data-slot":"content-header",dataHook:e,style:{maxWidth:"var(--ds-breakpoint-lg)"},trackingEl:t,trackingLabel:o,...r,children:n})}):l.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-header-region",children:l.jsxs(v.Header,{ref:i,className:u.cn("mx-auto w-full items-start gap-4",a),"data-slot":"content-header",dataHook:e,style:{maxWidth:"var(--ds-breakpoint-lg)"},trackingEl:t,trackingLabel:o,...r,children:[c,f,l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2","data-slot":"content-header-body",children:[y,b.length>0?l.jsxs("div",{className:"flex w-full flex-wrap items-start justify-between gap-4 max-md:flex-col","data-slot":"content-header-title",children:[l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2","data-slot":"content-header-text",children:[p,m]}),l.jsx(C.Provider,{value:!0,children:b})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"flex w-full flex-wrap items-center justify-between gap-4 max-md:flex-col max-md:items-start","data-slot":"content-header-title",children:p}),m]})]})]})})});N.displayName="GlobalLayoutContentHeader";const C=s.createContext(!1),k=s.forwardRef(({className:a,dataHook:e,trackingEl:t,trackingLabel:o,children:n,...r},i)=>{const c=s.useContext(C),f=l.jsx("div",{ref:i,className:u.cn(c?"flex shrink-0 items-center gap-2":"mx-auto hidden w-full items-center justify-end gap-2 lg:flex",a),"data-hook":e,"data-slot":"content-actions","data-tracking-el":t,"data-tracking-label":o,style:c?void 0:{maxWidth:"var(--ds-breakpoint-lg)"},...r,children:n});return c?f:l.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-actions-region",children:f})});k.displayName="GlobalLayoutContentActions";const R=s.forwardRef(({className:a,dataHook:e,trackingEl:t,trackingLabel:o,children:n,...r},i)=>l.jsx("div",{className:u.cn("flex w-full flex-1 flex-col",x),"data-slot":"content-body-region",children:l.jsx("div",{ref:i,className:u.cn("mx-auto flex w-full flex-1 flex-col gap-6",a),"data-hook":e,"data-slot":"content-body","data-tracking-el":t,"data-tracking-label":o,style:{maxWidth:"var(--content-max-width)"},...r,children:n})}));R.displayName="GlobalLayoutContentBody";const S=s.forwardRef(({className:a,dataHook:e,ariaLabel:t,trackingEl:o,trackingLabel:n,children:r,...i},c)=>l.jsx("div",{ref:c,"aria-label":t??"Mobile navigation",className:u.cn("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",a),"data-hook":e,"data-slot":"mobile-header","data-tracking-el":o,"data-tracking-label":n,role:"toolbar",...i,children:r}));S.displayName="GlobalLayoutMobileHeader";exports.GlobalLayout=j;exports.GlobalLayoutBackLink=h;exports.GlobalLayoutContent=G;exports.GlobalLayoutContentActions=k;exports.GlobalLayoutContentBody=R;exports.GlobalLayoutContentHeader=N;exports.GlobalLayoutImage=w;exports.GlobalLayoutMobileHeader=S;exports.GlobalLayoutSidebar=L;exports.GlobalLayoutSubtitle=g;
|
package/dist/global-layout.d.ts
CHANGED
|
@@ -13,8 +13,11 @@ interface GlobalLayoutProps extends React.ComponentProps<"div"> {
|
|
|
13
13
|
*/
|
|
14
14
|
trackingLabel?: string;
|
|
15
15
|
/**
|
|
16
|
-
* Maximum width of the global container.
|
|
17
|
-
*
|
|
16
|
+
* Maximum width of the global container. Unconstrained by default so the
|
|
17
|
+
* sidebar pins to the viewport edge and content centres in the remaining
|
|
18
|
+
* space; pass a `breakpoint` token from `@brightlocal/tokens/breakpoints`
|
|
19
|
+
* to cap the whole shell.
|
|
20
|
+
* @default "none"
|
|
18
21
|
*/
|
|
19
22
|
maxWidth?: string | number;
|
|
20
23
|
}
|
|
@@ -25,7 +28,7 @@ interface GlobalLayoutSidebarProps extends React.ComponentProps<"aside"> {
|
|
|
25
28
|
*/
|
|
26
29
|
dataHook?: string;
|
|
27
30
|
/**
|
|
28
|
-
* Width of the sidebar (default:
|
|
31
|
+
* Width of the sidebar (default: 288px)
|
|
29
32
|
*/
|
|
30
33
|
width?: string | number;
|
|
31
34
|
}
|
|
@@ -60,18 +63,45 @@ interface GlobalLayoutBackLinkProps extends React.AnchorHTMLAttributes<HTMLAncho
|
|
|
60
63
|
* Pass `href` for URL navigation or `onClick` for SPA router navigation.
|
|
61
64
|
*/
|
|
62
65
|
declare const GlobalLayoutBackLink: React.ForwardRefExoticComponent<GlobalLayoutBackLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
63
|
-
interface GlobalLayoutSubtitleProps extends React.ComponentProps<"p"> {
|
|
66
|
+
interface GlobalLayoutSubtitleProps extends Omit<React.ComponentProps<"p">, "color"> {
|
|
64
67
|
/**
|
|
65
68
|
* Data hook for automated testing
|
|
66
69
|
* @default "content-header-subtitle"
|
|
67
70
|
*/
|
|
68
71
|
dataHook?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Render the subtitle as its own child element (Radix Slot) while keeping
|
|
74
|
+
* the muted description typography — use it for rich description rows
|
|
75
|
+
* (icons, rating, a status Badge) that need their own flex layout.
|
|
76
|
+
*/
|
|
77
|
+
asChild?: boolean;
|
|
69
78
|
}
|
|
70
79
|
/**
|
|
71
80
|
* Muted description text for the page header. Place it as a direct child of
|
|
72
81
|
* `GlobalLayoutContentHeader` — the header positions it below the title row.
|
|
82
|
+
* For rich descriptions, pass `asChild` with your own flex row as the child.
|
|
83
|
+
*
|
|
84
|
+
* Sits on the semantic type scale's `text-body-sm` (Inter · Figma 500 · 14/20,
|
|
85
|
+
* rendering one CSS weight lighter per the DS-305 offset) with the muted
|
|
86
|
+
* colour role — de-emphasis is colour-only, never a lighter weight.
|
|
73
87
|
*/
|
|
74
88
|
declare const GlobalLayoutSubtitle: React.ForwardRefExoticComponent<Omit<GlobalLayoutSubtitleProps, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
|
|
89
|
+
interface GlobalLayoutImageProps extends React.ComponentProps<"div"> {
|
|
90
|
+
/**
|
|
91
|
+
* Data hook for automated testing
|
|
92
|
+
* @default "content-header-image"
|
|
93
|
+
*/
|
|
94
|
+
dataHook?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Thumbnail frame for the page header (the Figma Page Header "Show Image"
|
|
98
|
+
* slot). Place it as a direct child of `GlobalLayoutContentHeader` — the
|
|
99
|
+
* header positions it before the breadcrumb + title column. Pass your own
|
|
100
|
+
* `img` (or `Avatar`) as the child; it is cropped to a rounded 3:2 frame,
|
|
101
|
+
* 48px tall by default (size via `className`, e.g. `h-21` for the 84px
|
|
102
|
+
* variant).
|
|
103
|
+
*/
|
|
104
|
+
declare const GlobalLayoutImage: React.ForwardRefExoticComponent<Omit<GlobalLayoutImageProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
75
105
|
interface GlobalLayoutContentHeaderProps extends React.ComponentProps<"header"> {
|
|
76
106
|
/**
|
|
77
107
|
* Data hook for automated testing (required)
|
|
@@ -86,6 +116,28 @@ interface GlobalLayoutContentHeaderProps extends React.ComponentProps<"header">
|
|
|
86
116
|
*/
|
|
87
117
|
trackingLabel?: string;
|
|
88
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Page header for the content area. Slots direct children (back link, image,
|
|
121
|
+
* breadcrumb, subtitle, actions) around the title row per the Figma Page
|
|
122
|
+
* Header design.
|
|
123
|
+
*
|
|
124
|
+
* The consumer-supplied page title must be `TypographyHeading level={1}
|
|
125
|
+
* variant="page"` so it sits on the semantic type scale's
|
|
126
|
+
* `text-heading-page` (DS-714) — never a hand-styled heading. Exactly one
|
|
127
|
+
* page title per screen: a second title is a section (`variant="section"`,
|
|
128
|
+
* `text-heading-section`).
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* <GlobalLayoutContentHeader dataHook="page-header">
|
|
132
|
+
* <TypographyHeading level={1} variant="page" dataHook="page-title">
|
|
133
|
+
* All Locations
|
|
134
|
+
* </TypographyHeading>
|
|
135
|
+
* <GlobalLayoutContentActions dataHook="header-actions">
|
|
136
|
+
* <Button dataHook="add-location">Add Location</Button>
|
|
137
|
+
* </GlobalLayoutContentActions>
|
|
138
|
+
* <GlobalLayoutSubtitle>Manage your business locations.</GlobalLayoutSubtitle>
|
|
139
|
+
* </GlobalLayoutContentHeader>
|
|
140
|
+
*/
|
|
89
141
|
declare const GlobalLayoutContentHeader: React.ForwardRefExoticComponent<Omit<GlobalLayoutContentHeaderProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
90
142
|
interface GlobalLayoutContentActionsProps extends React.ComponentProps<"div"> {
|
|
91
143
|
/**
|
|
@@ -137,6 +189,6 @@ interface GlobalLayoutMobileHeaderProps extends React.ComponentProps<"div"> {
|
|
|
137
189
|
trackingLabel?: string;
|
|
138
190
|
}
|
|
139
191
|
declare const GlobalLayoutMobileHeader: React.ForwardRefExoticComponent<Omit<GlobalLayoutMobileHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
140
|
-
export { GlobalLayout, GlobalLayoutSidebar, GlobalLayoutContent, GlobalLayoutContentActions, GlobalLayoutContentHeader, GlobalLayoutBackLink, GlobalLayoutSubtitle, GlobalLayoutContentBody, GlobalLayoutMobileHeader, };
|
|
141
|
-
export type { GlobalLayoutProps, GlobalLayoutSidebarProps, GlobalLayoutContentProps, GlobalLayoutContentActionsProps, GlobalLayoutContentHeaderProps, GlobalLayoutBackLinkProps, GlobalLayoutSubtitleProps, GlobalLayoutContentBodyProps, GlobalLayoutMobileHeaderProps, };
|
|
192
|
+
export { GlobalLayout, GlobalLayoutSidebar, GlobalLayoutContent, GlobalLayoutContentActions, GlobalLayoutContentHeader, GlobalLayoutBackLink, GlobalLayoutSubtitle, GlobalLayoutImage, GlobalLayoutContentBody, GlobalLayoutMobileHeader, };
|
|
193
|
+
export type { GlobalLayoutProps, GlobalLayoutSidebarProps, GlobalLayoutContentProps, GlobalLayoutContentActionsProps, GlobalLayoutContentHeaderProps, GlobalLayoutBackLinkProps, GlobalLayoutSubtitleProps, GlobalLayoutImageProps, GlobalLayoutContentBodyProps, GlobalLayoutMobileHeaderProps, };
|
|
142
194
|
//# sourceMappingURL=global-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-layout.d.ts","sourceRoot":"","sources":["../../src/components/global-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"global-layout.d.ts","sourceRoot":"","sources":["../../src/components/global-layout.ts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