@brightlocal/ui-components 3.0.0 → 3.1.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 +2 -1
- package/component-meta.json +90 -19
- package/deprecations.json +113 -3
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +41 -49
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +20 -2
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +83 -75
- package/dist/chart.cjs +2 -2
- package/dist/chart.d.ts +40 -12
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +86 -71
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +95 -81
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +250 -224
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +32 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +340 -330
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +79 -52
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +105 -13
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -129
- package/dist/grid.d.ts +2 -2
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +547 -538
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +17 -9
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +26 -25
- package/dist/lib/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +57 -57
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +13 -2
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +87 -83
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.d.ts +13 -0
- package/dist/typography-heading.d.ts.map +1 -1
- package/dist/typography-heading.js +32 -21
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +14 -0
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +35 -24
- package/package.json +1 -1
- package/src/blocks/empty-state.tsx +9 -21
- package/src/components/accordion.tsx +82 -27
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +38 -3
- package/src/components/chart.tsx +63 -18
- package/src/components/chip.tsx +83 -10
- package/src/components/command.tsx +55 -3
- package/src/components/data-table.tsx +67 -7
- package/src/components/date-picker.tsx +18 -7
- package/src/components/field.tsx +81 -12
- package/src/components/global-layout.tsx +176 -38
- package/src/components/grid.tsx +2 -2
- package/src/components/input-password.tsx +23 -11
- package/src/components/pagination.tsx +10 -3
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +30 -6
- package/src/components/typography-heading.tsx +24 -0
- package/src/components/typography-text.tsx +26 -1
- package/src/index.ts +1 -0
- package/src/lib/empty-chip.ts +24 -0
package/dist/field.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cva as _ } from "class-variance-authority";
|
|
4
|
+
import { AlertCircle as w } from "@brightlocal/icons";
|
|
4
5
|
import { cn as o } from "@brightlocal/ui-components/lib/utils";
|
|
5
|
-
import { Description as
|
|
6
|
-
import { Label as
|
|
7
|
-
function
|
|
6
|
+
import { Description as y } from "./description.js";
|
|
7
|
+
import { Label as k } from "@brightlocal/ui-components/label";
|
|
8
|
+
function N({ className: t, ...a }) {
|
|
8
9
|
return /* @__PURE__ */ l(
|
|
9
10
|
"fieldset",
|
|
10
11
|
{
|
|
@@ -21,13 +22,13 @@ function b({ className: t, ...a }) {
|
|
|
21
22
|
}
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
function
|
|
25
|
+
N.displayName = "FieldSet";
|
|
26
|
+
const B = ["legend", "label"];
|
|
27
|
+
function D({
|
|
27
28
|
className: t,
|
|
28
29
|
variant: a = "legend",
|
|
29
30
|
srOnly: e = !1,
|
|
30
|
-
...
|
|
31
|
+
...r
|
|
31
32
|
}) {
|
|
32
33
|
return /* @__PURE__ */ l(
|
|
33
34
|
"legend",
|
|
@@ -41,11 +42,11 @@ function F({
|
|
|
41
42
|
),
|
|
42
43
|
"data-slot": "field-legend",
|
|
43
44
|
"data-variant": a,
|
|
44
|
-
...
|
|
45
|
+
...r
|
|
45
46
|
}
|
|
46
47
|
);
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
+
function R({ className: t, ...a }) {
|
|
49
50
|
return /* @__PURE__ */ l(
|
|
50
51
|
"div",
|
|
51
52
|
{
|
|
@@ -58,13 +59,17 @@ function V({ className: t, ...a }) {
|
|
|
58
59
|
}
|
|
59
60
|
);
|
|
60
61
|
}
|
|
61
|
-
const
|
|
62
|
+
const F = _(
|
|
62
63
|
[
|
|
63
64
|
"group/field flex w-full gap-2",
|
|
64
65
|
// RadioGroup context: positioned ancestor for RadioGroupItem click overlay + pointer cursor
|
|
65
66
|
"[[data-slot=radio-group]_&]:relative [[data-slot=radio-group]_&]:cursor-pointer [[data-slot=radio-group]_&]:gap-3 [[data-slot=radio-group]_&]:has-[[data-disabled]]:cursor-not-allowed",
|
|
66
67
|
// RadioGroup context: label overlay spans the full Field for clickable row
|
|
67
68
|
"[[data-slot=radio-group]_&_[data-slot=field-label]]:after:absolute [[data-slot=radio-group]_&_[data-slot=field-label]]:after:inset-0 [[data-slot=radio-group]_&_[data-slot=field-label]]:after:cursor-pointer [[data-slot=radio-group]_&:has([data-disabled])_[data-slot=field-label]]:after:cursor-not-allowed",
|
|
69
|
+
// DS-772: lift the control above the label overlay so a direct click on the
|
|
70
|
+
// control passes pointer hit-testing (Playwright check()/click() without
|
|
71
|
+
// force). Row/label clicks still delegate via the label's htmlFor.
|
|
72
|
+
"[[data-slot=radio-group]_&_[data-slot=radio-group-item]]:z-10",
|
|
68
73
|
// Checkbox context: match RadioGroup gap-3 spacing
|
|
69
74
|
"has-[>[role=checkbox]]:gap-3",
|
|
70
75
|
// Label leading overrides: use leading-normal for wrap-capable labels (checkbox)
|
|
@@ -107,6 +112,13 @@ const m = u(
|
|
|
107
112
|
"rounded-lg border border-border bg-background p-3",
|
|
108
113
|
"transition-colors duration-fast ease-out",
|
|
109
114
|
"[&_[data-slot=field-label]]:after:absolute [&_[data-slot=field-label]]:after:inset-0 [&_[data-slot=field-label]]:after:cursor-pointer",
|
|
115
|
+
// DS-772: lift controls above the label's full-card overlay so a
|
|
116
|
+
// direct click on the control passes pointer hit-testing (Playwright
|
|
117
|
+
// check()/click() without force). Card clicks still delegate via the
|
|
118
|
+
// label's htmlFor.
|
|
119
|
+
"[&_[data-slot=checkbox]]:relative [&_[data-slot=checkbox]]:z-10",
|
|
120
|
+
"[&_[data-slot=radio-group-item]]:z-10",
|
|
121
|
+
"[&_[data-slot=switch]]:relative [&_[data-slot=switch]]:z-10",
|
|
110
122
|
// Focus ring when a child control receives focus
|
|
111
123
|
"has-[:focus-visible]:shadow-default has-[:focus-visible]:border-ring",
|
|
112
124
|
// Checked-state for radio/checkbox (not switch)
|
|
@@ -130,32 +142,32 @@ const m = u(
|
|
|
130
142
|
}
|
|
131
143
|
}
|
|
132
144
|
);
|
|
133
|
-
function
|
|
145
|
+
function A({
|
|
134
146
|
className: t,
|
|
135
147
|
orientation: a = "vertical",
|
|
136
148
|
variant: e = "default",
|
|
137
|
-
align:
|
|
138
|
-
dataHook:
|
|
139
|
-
...
|
|
149
|
+
align: r = "start",
|
|
150
|
+
dataHook: n,
|
|
151
|
+
...d
|
|
140
152
|
}) {
|
|
141
153
|
return /* @__PURE__ */ l(
|
|
142
154
|
"div",
|
|
143
155
|
{
|
|
144
156
|
className: o(
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
F({ orientation: a, variant: e }),
|
|
158
|
+
r === "end" && a === "horizontal" && "grid-cols-[1fr_auto]",
|
|
147
159
|
t
|
|
148
160
|
),
|
|
149
|
-
"data-hook":
|
|
161
|
+
"data-hook": n,
|
|
150
162
|
"data-orientation": a,
|
|
151
163
|
"data-slot": "field",
|
|
152
164
|
"data-variant": e,
|
|
153
165
|
role: "group",
|
|
154
|
-
...
|
|
166
|
+
...d
|
|
155
167
|
}
|
|
156
168
|
);
|
|
157
169
|
}
|
|
158
|
-
function
|
|
170
|
+
function j({ className: t, ...a }) {
|
|
159
171
|
return /* @__PURE__ */ l(
|
|
160
172
|
"div",
|
|
161
173
|
{
|
|
@@ -170,14 +182,14 @@ function L({ className: t, ...a }) {
|
|
|
170
182
|
}
|
|
171
183
|
);
|
|
172
184
|
}
|
|
173
|
-
function
|
|
185
|
+
function G({
|
|
174
186
|
className: t,
|
|
175
187
|
htmlFor: a,
|
|
176
188
|
dataHook: e,
|
|
177
|
-
...
|
|
189
|
+
...r
|
|
178
190
|
}) {
|
|
179
191
|
return /* @__PURE__ */ l(
|
|
180
|
-
|
|
192
|
+
k,
|
|
181
193
|
{
|
|
182
194
|
className: o(
|
|
183
195
|
// Base label styles from primitives are inherited via Label component
|
|
@@ -192,17 +204,17 @@ function I({
|
|
|
192
204
|
"data-hook": e,
|
|
193
205
|
"data-slot": "field-label",
|
|
194
206
|
htmlFor: a,
|
|
195
|
-
...
|
|
207
|
+
...r
|
|
196
208
|
}
|
|
197
209
|
);
|
|
198
210
|
}
|
|
199
|
-
function
|
|
211
|
+
function q({
|
|
200
212
|
className: t,
|
|
201
213
|
dataHook: a,
|
|
202
214
|
...e
|
|
203
215
|
}) {
|
|
204
216
|
return /* @__PURE__ */ l(
|
|
205
|
-
|
|
217
|
+
y,
|
|
206
218
|
{
|
|
207
219
|
className: o(
|
|
208
220
|
// Field-specific positioning and context styles
|
|
@@ -217,8 +229,17 @@ function S({
|
|
|
217
229
|
}
|
|
218
230
|
);
|
|
219
231
|
}
|
|
220
|
-
|
|
221
|
-
|
|
232
|
+
const z = () => () => {
|
|
233
|
+
};
|
|
234
|
+
function S() {
|
|
235
|
+
return i.useSyncExternalStore(
|
|
236
|
+
z,
|
|
237
|
+
() => !0,
|
|
238
|
+
() => !1
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
function H({
|
|
242
|
+
icon: t = w,
|
|
222
243
|
className: a,
|
|
223
244
|
...e
|
|
224
245
|
}) {
|
|
@@ -231,46 +252,52 @@ function C({
|
|
|
231
252
|
}
|
|
232
253
|
);
|
|
233
254
|
}
|
|
234
|
-
function
|
|
255
|
+
function J({
|
|
235
256
|
className: t,
|
|
236
257
|
dataHook: a,
|
|
237
258
|
children: e,
|
|
238
|
-
errors:
|
|
239
|
-
...
|
|
259
|
+
errors: r,
|
|
260
|
+
...n
|
|
240
261
|
}) {
|
|
241
|
-
const
|
|
242
|
-
(
|
|
243
|
-
);
|
|
244
|
-
|
|
262
|
+
const d = r?.filter(
|
|
263
|
+
(f) => !!f?.message
|
|
264
|
+
), s = !!e || !!d?.length, g = S(), [c, p] = i.useState(g), [h, u] = i.useState(!1);
|
|
265
|
+
i.useEffect(() => {
|
|
266
|
+
s ? c && u(!0) : (p(!0), u(!1));
|
|
267
|
+
}, [c, s]);
|
|
268
|
+
const b = s && (!c || h);
|
|
269
|
+
if (!s)
|
|
245
270
|
return null;
|
|
246
|
-
const
|
|
271
|
+
const m = o(
|
|
247
272
|
"text-body-sm text-destructive-foreground",
|
|
248
273
|
"mt-2",
|
|
249
274
|
"group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
250
275
|
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
251
276
|
t
|
|
252
|
-
),
|
|
277
|
+
), v = d && d.length > 1;
|
|
253
278
|
return /* @__PURE__ */ l(
|
|
254
279
|
"div",
|
|
255
280
|
{
|
|
256
|
-
|
|
281
|
+
"aria-atomic": "true",
|
|
282
|
+
"aria-live": "polite",
|
|
283
|
+
className: m,
|
|
257
284
|
"data-hook": a,
|
|
258
285
|
"data-slot": "field-error",
|
|
259
|
-
role: "
|
|
260
|
-
...
|
|
261
|
-
children:
|
|
286
|
+
role: "status",
|
|
287
|
+
...n,
|
|
288
|
+
children: b && (v ? /* @__PURE__ */ l("ul", { className: "list-disc space-y-1 pl-4", children: d.map((f, x) => /* @__PURE__ */ l("li", { children: f.message }, x)) }) : /* @__PURE__ */ l("p", { className: "m-0", children: e || d?.[0]?.message }))
|
|
262
289
|
}
|
|
263
290
|
);
|
|
264
291
|
}
|
|
265
292
|
export {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
293
|
+
A as Field,
|
|
294
|
+
j as FieldContent,
|
|
295
|
+
q as FieldDescription,
|
|
296
|
+
J as FieldError,
|
|
297
|
+
H as FieldErrorIcon,
|
|
298
|
+
R as FieldGroup,
|
|
299
|
+
G as FieldLabel,
|
|
300
|
+
D as FieldLegend,
|
|
301
|
+
N as FieldSet,
|
|
302
|
+
B as fieldLegendVariants
|
|
276
303
|
};
|
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 t=require("react/jsx-runtime"),B=require("react"),v=require("@brightlocal/icons"),u=require("@brightlocal/ui-components/lib/utils"),q=require("./breadcrumb.cjs"),A=require("./button.cjs"),j=require("./header.cjs"),O=require("./link.cjs"),_=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 o in a)if(o!=="default"){const l=Object.getOwnPropertyDescriptor(a,o);Object.defineProperty(e,o,l.get?l:{enumerable:!0,get:()=>a[o]})}}return e.default=a,Object.freeze(e)}const s=M(B),G=s.forwardRef(({className:a,maxWidth:e="none",dataHook:o,trackingEl:l,trackingLabel:n,children:r,...i},c)=>{const b=typeof e=="number"?`${e}px`:e;return t.jsx(_.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:`${o}-scroll`,scrollOrientation:"both",children:t.jsx("div",{ref:c,className:"flex min-h-dvh w-full flex-col","data-hook":o,"data-slot":"global-layout","data-tracking-el":l,"data-tracking-label":n,...i,children:t.jsx("div",{className:"mx-auto flex w-full flex-1","data-slot":"global-container",style:{maxWidth:b},children:r})})})});G.displayName="GlobalLayout";const T="288px",N=s.forwardRef(({className:a,width:e=T,dataHook:o,children:l,...n},r)=>{const i=typeof e=="number"?`${e}px`:e;return t.jsx("aside",{ref:r,className:u.cn("sticky hidden shrink-0 self-start outline-none lg:block",a),"data-hook":o,"data-slot":"sidebar-container",...n,style:{width:i,top:0,height:"100dvh",...n.style},children:l})});N.displayName="GlobalLayoutSidebar";const C=s.forwardRef(({className:a,maxWidth:e="var(--ds-breakpoint-lg)",dataHook:o,children:l,...n},r)=>{const i=typeof e=="number"?`${e}px`:e;return t.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":o,"data-slot":"content-wrapper",style:{"--content-max-width":i},...n,children:l})});C.displayName="GlobalLayoutContent";const x="px-4 md:px-6 lg:px-section-xs",g=s.forwardRef((a,e)=>{if(a.href===void 0){const{dataHook:r,ariaLabel:i,...c}=a;return t.jsx(A.Button,{ref:e,ariaLabel:i||"Go back","data-slot":"content-header-back-link",dataHook:r??"content-header-back-link",variant:"ghost",...c,children:t.jsx(v.ArrowLeft,{"aria-hidden":"true"})})}const{dataHook:o,ariaLabel:l,...n}=a;return t.jsx(O.Link,{ref:e,"aria-label":l||"Go back","data-slot":"content-header-back-link",dataHook:o??"content-header-back-link",variant:"icon",...n,children:t.jsx(v.ArrowLeft,{"aria-hidden":"true"})})});g.displayName="GlobalLayoutBackLink";const k=s.forwardRef(({dataHook:a,asChild:e,...o},l)=>t.jsx(E.TypographyText,{ref:l,asChild:e,color:"muted","data-slot":"content-header-subtitle",dataHook:a??"content-header-subtitle",variant:"body-sm",...o}));k.displayName="GlobalLayoutSubtitle";const w=s.forwardRef(({className:a,dataHook:e,children:o,...l},n)=>t.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",...l,children:o}));w.displayName="GlobalLayoutImage";const H=s.forwardRef(({className:a,dataHook:e,trackingEl:o,trackingLabel:l,children:n,...r},i)=>{const c=[],b=[],p=[],f=[],m=[],h=[];return s.Children.forEach(n,d=>{s.isValidElement(d)&&d.type===g?c.push(d):s.isValidElement(d)&&d.type===w?b.push(d):s.isValidElement(d)&&d.type===q.Breadcrumb?p.push(d):s.isValidElement(d)&&d.type===k?f.push(d):s.isValidElement(d)&&d.type===y?m.push(d):h.push(d)}),c.length===0&&b.length===0&&p.length===0&&f.length===0&&m.length===0?t.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-header-region",children:t.jsx(j.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:o,trackingLabel:l,...r,children:n})}):t.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-header-region",children:t.jsxs(j.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:o,trackingLabel:l,...r,children:[c,b,t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2","data-slot":"content-header-body",children:[p,m.length>0?t.jsxs("div",{className:"flex w-full flex-wrap items-start justify-between gap-4 max-md:flex-col","data-slot":"content-header-title",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2","data-slot":"content-header-text",children:[h,f]}),t.jsx(R.Provider,{value:!0,children:m})]}):t.jsxs(t.Fragment,{children:[t.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:h}),f]})]})]})})});H.displayName="GlobalLayoutContentHeader";const R=s.createContext(!1),y=s.forwardRef(({className:a,dataHook:e,trackingEl:o,trackingLabel:l,children:n,...r},i)=>{const c=s.useContext(R),b=t.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":o,"data-tracking-label":l,style:c?void 0:{maxWidth:"var(--ds-breakpoint-lg)"},...r,children:n});return c?b:t.jsx("div",{className:u.cn("w-full",x),"data-slot":"content-actions-region",children:b})});y.displayName="GlobalLayoutActions";const P=y,L=s.forwardRef(({className:a,dataHook:e,trackingEl:o,trackingLabel:l,children:n,...r},i)=>t.jsx("div",{className:u.cn("flex w-full flex-1 flex-col",x),"data-slot":"content-body-region",children:t.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":o,"data-tracking-label":l,style:{maxWidth:"var(--content-max-width)"},...r,children:n})}));L.displayName="GlobalLayoutBody";const I=L,S=s.forwardRef(({className:a,dataHook:e,ariaLabel:o,trackingEl:l,trackingLabel:n,children:r,...i},c)=>t.jsx("div",{ref:c,"aria-label":o??"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":l,"data-tracking-label":n,role:"toolbar",...i,children:r}));S.displayName="GlobalLayoutMobileHeader";exports.GlobalLayout=G;exports.GlobalLayoutActions=y;exports.GlobalLayoutBackLink=g;exports.GlobalLayoutBody=L;exports.GlobalLayoutContent=C;exports.GlobalLayoutContentActions=P;exports.GlobalLayoutContentBody=I;exports.GlobalLayoutContentHeader=H;exports.GlobalLayoutImage=w;exports.GlobalLayoutMobileHeader=S;exports.GlobalLayoutSidebar=N;exports.GlobalLayoutSubtitle=k;
|
package/dist/global-layout.d.ts
CHANGED
|
@@ -45,24 +45,83 @@ interface GlobalLayoutContentProps extends React.ComponentProps<"div"> {
|
|
|
45
45
|
maxWidth?: string | number;
|
|
46
46
|
}
|
|
47
47
|
declare const GlobalLayoutContent: React.ForwardRefExoticComponent<Omit<GlobalLayoutContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
48
|
-
interface
|
|
48
|
+
interface GlobalLayoutBackLinkCommonProps {
|
|
49
49
|
/**
|
|
50
50
|
* Data hook for automated testing
|
|
51
51
|
* @default "content-header-back-link"
|
|
52
52
|
*/
|
|
53
53
|
dataHook?: string;
|
|
54
54
|
/**
|
|
55
|
-
* Accessible label for the icon-only back
|
|
55
|
+
* Accessible label for the icon-only back control.
|
|
56
56
|
* @default "Go back"
|
|
57
57
|
*/
|
|
58
58
|
ariaLabel?: string;
|
|
59
59
|
}
|
|
60
|
+
type AnchorOnlyAttributes = Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof React.ButtonHTMLAttributes<HTMLButtonElement>>;
|
|
61
|
+
type ButtonOnlyAttributes = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof React.AnchorHTMLAttributes<HTMLAnchorElement>>;
|
|
62
|
+
type ForbiddenAttributes<T> = {
|
|
63
|
+
[K in keyof T]?: never;
|
|
64
|
+
};
|
|
60
65
|
/**
|
|
61
|
-
*
|
|
66
|
+
* Anchor mode: a real destination, rendered as `Link variant="icon"`.
|
|
67
|
+
*/
|
|
68
|
+
interface GlobalLayoutBackLinkAnchorProps extends GlobalLayoutBackLinkCommonProps, React.AnchorHTMLAttributes<HTMLAnchorElement>, ForbiddenAttributes<ButtonOnlyAttributes> {
|
|
69
|
+
/** Destination URL — renders a real link (`<a>`). */
|
|
70
|
+
href: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Button mode: no destination, rendered as an icon `<button>` for SPA
|
|
74
|
+
* router navigation via `onClick`.
|
|
75
|
+
*/
|
|
76
|
+
interface GlobalLayoutBackLinkButtonProps extends GlobalLayoutBackLinkCommonProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "type">, ForbiddenAttributes<AnchorOnlyAttributes> {
|
|
77
|
+
/** Omit `href` to render a `<button>` for SPA router navigation. */
|
|
78
|
+
href?: undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Button type attribute (button mode only).
|
|
81
|
+
* @default "button"
|
|
82
|
+
*/
|
|
83
|
+
type?: "button" | "submit";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Discriminated on `href` so the impossible combinations don't compile:
|
|
87
|
+
* anchor-only attributes (target, rel, download, …) require an `href`, and
|
|
88
|
+
* button-only attributes (disabled, form*, …) apply only without one. DS-847
|
|
89
|
+
* removed the old `href="#"` + preventDefault fallback — an action that
|
|
90
|
+
* doesn't navigate now has real button semantics.
|
|
91
|
+
*
|
|
92
|
+
* The leading inline block restates the shared props (plus `href`, the
|
|
93
|
+
* discriminant) so the registry's props extractor, which reads the first
|
|
94
|
+
* braced block after this declaration, documents them; the mode interfaces
|
|
95
|
+
* remain the source of the per-mode constraints.
|
|
96
|
+
*/
|
|
97
|
+
type GlobalLayoutBackLinkProps = {
|
|
98
|
+
/**
|
|
99
|
+
* Data hook for automated testing
|
|
100
|
+
* @default "content-header-back-link"
|
|
101
|
+
*/
|
|
102
|
+
dataHook?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Accessible label for the icon-only back control.
|
|
105
|
+
* @default "Go back"
|
|
106
|
+
*/
|
|
107
|
+
ariaLabel?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Destination URL. Set, the control renders a real link
|
|
110
|
+
* (`Link variant="icon"`); omitted, it renders an identically styled
|
|
111
|
+
* `<button>` for SPA router navigation via `onClick` — there is no
|
|
112
|
+
* `href="#"` fallback.
|
|
113
|
+
*/
|
|
114
|
+
href?: string;
|
|
115
|
+
} & (GlobalLayoutBackLinkAnchorProps | GlobalLayoutBackLinkButtonProps);
|
|
116
|
+
/**
|
|
117
|
+
* Icon-only back control for the page header. Place it as a direct child of
|
|
62
118
|
* `GlobalLayoutContentHeader` — the header positions it before the title.
|
|
63
|
-
* Pass `href` for URL navigation
|
|
119
|
+
* Pass `href` for URL navigation (renders a `Link variant="icon"` anchor);
|
|
120
|
+
* omit it and pass `onClick` for SPA router navigation (renders an
|
|
121
|
+
* identically styled icon `<button>`). Both modes are keyboard-focusable and
|
|
122
|
+
* carry the "Go back" accessible name by default.
|
|
64
123
|
*/
|
|
65
|
-
declare const GlobalLayoutBackLink: React.ForwardRefExoticComponent<GlobalLayoutBackLinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
124
|
+
declare const GlobalLayoutBackLink: React.ForwardRefExoticComponent<GlobalLayoutBackLinkProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
66
125
|
interface GlobalLayoutSubtitleProps extends Omit<React.ComponentProps<"p">, "color"> {
|
|
67
126
|
/**
|
|
68
127
|
* Data hook for automated testing
|
|
@@ -132,14 +191,14 @@ interface GlobalLayoutContentHeaderProps extends React.ComponentProps<"header">
|
|
|
132
191
|
* <TypographyHeading level={1} variant="page" dataHook="page-title">
|
|
133
192
|
* All Locations
|
|
134
193
|
* </TypographyHeading>
|
|
135
|
-
* <
|
|
194
|
+
* <GlobalLayoutActions dataHook="header-actions">
|
|
136
195
|
* <Button dataHook="add-location">Add Location</Button>
|
|
137
|
-
* </
|
|
196
|
+
* </GlobalLayoutActions>
|
|
138
197
|
* <GlobalLayoutSubtitle>Manage your business locations.</GlobalLayoutSubtitle>
|
|
139
198
|
* </GlobalLayoutContentHeader>
|
|
140
199
|
*/
|
|
141
200
|
declare const GlobalLayoutContentHeader: React.ForwardRefExoticComponent<Omit<GlobalLayoutContentHeaderProps, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
142
|
-
interface
|
|
201
|
+
interface GlobalLayoutActionsProps extends React.ComponentProps<"div"> {
|
|
143
202
|
/**
|
|
144
203
|
* Data hook for automated testing (required)
|
|
145
204
|
*/
|
|
@@ -153,8 +212,21 @@ interface GlobalLayoutContentActionsProps extends React.ComponentProps<"div"> {
|
|
|
153
212
|
*/
|
|
154
213
|
trackingLabel?: string;
|
|
155
214
|
}
|
|
156
|
-
|
|
157
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Action row for the page header. Place it as a direct child of
|
|
217
|
+
* `GlobalLayoutContentHeader` — the header positions it beside the title row
|
|
218
|
+
* (below it on mobile). Standalone it keeps the legacy desktop-only
|
|
219
|
+
* full-width row.
|
|
220
|
+
*/
|
|
221
|
+
declare const GlobalLayoutActions: React.ForwardRefExoticComponent<Omit<GlobalLayoutActionsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
222
|
+
/**
|
|
223
|
+
* @deprecated Renamed `GlobalLayoutActions` (DS-855) — the `Content`
|
|
224
|
+
* discriminator was unearned: no sibling actions row exists to discriminate
|
|
225
|
+
* against (DS-809: discriminate siblings only). This alias will be removed in
|
|
226
|
+
* the next major.
|
|
227
|
+
*/
|
|
228
|
+
declare const GlobalLayoutContentActions: React.ForwardRefExoticComponent<Omit<GlobalLayoutActionsProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
229
|
+
interface GlobalLayoutBodyProps extends React.ComponentProps<"div"> {
|
|
158
230
|
/**
|
|
159
231
|
* Data hook for automated testing
|
|
160
232
|
*/
|
|
@@ -168,7 +240,19 @@ interface GlobalLayoutContentBodyProps extends React.ComponentProps<"div"> {
|
|
|
168
240
|
*/
|
|
169
241
|
trackingLabel?: string;
|
|
170
242
|
}
|
|
171
|
-
|
|
243
|
+
/**
|
|
244
|
+
* Main content region below the page header. Carries the content max-width
|
|
245
|
+
* set by `GlobalLayoutContent` and the shared region padding, so full-width
|
|
246
|
+
* treatments on sibling regions (header border, sticky header) stay possible.
|
|
247
|
+
*/
|
|
248
|
+
declare const GlobalLayoutBody: React.ForwardRefExoticComponent<Omit<GlobalLayoutBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
249
|
+
/**
|
|
250
|
+
* @deprecated Renamed `GlobalLayoutBody` (DS-855) — the `Content`
|
|
251
|
+
* discriminator was unearned: no sibling body region exists to discriminate
|
|
252
|
+
* against (DS-809: discriminate siblings only). This alias will be removed in
|
|
253
|
+
* the next major.
|
|
254
|
+
*/
|
|
255
|
+
declare const GlobalLayoutContentBody: React.ForwardRefExoticComponent<Omit<GlobalLayoutBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
172
256
|
interface GlobalLayoutMobileHeaderProps extends React.ComponentProps<"div"> {
|
|
173
257
|
/**
|
|
174
258
|
* Data hook for automated testing (required)
|
|
@@ -189,6 +273,14 @@ interface GlobalLayoutMobileHeaderProps extends React.ComponentProps<"div"> {
|
|
|
189
273
|
trackingLabel?: string;
|
|
190
274
|
}
|
|
191
275
|
declare const GlobalLayoutMobileHeader: React.ForwardRefExoticComponent<Omit<GlobalLayoutMobileHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
192
|
-
export { GlobalLayout, GlobalLayoutSidebar, GlobalLayoutContent,
|
|
193
|
-
export type { GlobalLayoutProps, GlobalLayoutSidebarProps, GlobalLayoutContentProps,
|
|
276
|
+
export { GlobalLayout, GlobalLayoutSidebar, GlobalLayoutContent, GlobalLayoutActions, GlobalLayoutContentHeader, GlobalLayoutBackLink, GlobalLayoutSubtitle, GlobalLayoutImage, GlobalLayoutBody, GlobalLayoutMobileHeader, GlobalLayoutContentActions, GlobalLayoutContentBody, };
|
|
277
|
+
export type { GlobalLayoutProps, GlobalLayoutSidebarProps, GlobalLayoutContentProps, GlobalLayoutActionsProps, GlobalLayoutContentHeaderProps, GlobalLayoutBackLinkProps, GlobalLayoutSubtitleProps, GlobalLayoutImageProps, GlobalLayoutBodyProps, GlobalLayoutMobileHeaderProps, GlobalLayoutContentActionsProps, GlobalLayoutContentBodyProps, };
|
|
278
|
+
/**
|
|
279
|
+
* @deprecated Renamed `GlobalLayoutActionsProps` (DS-855).
|
|
280
|
+
*/
|
|
281
|
+
type GlobalLayoutContentActionsProps = GlobalLayoutActionsProps;
|
|
282
|
+
/**
|
|
283
|
+
* @deprecated Renamed `GlobalLayoutBodyProps` (DS-855).
|
|
284
|
+
*/
|
|
285
|
+
type GlobalLayoutContentBodyProps = GlobalLayoutBodyProps;
|
|
194
286
|
//# 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.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,UAAU,iBAAkB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC7D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,QAAA,MAAM,YAAY,uGAgDjB,CAAC;AAQF,UAAU,wBAAyB,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC;IACtE;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,QAAA,MAAM,mBAAmB,2GA0BvB,CAAC;AAIH,UAAU,wBAAyB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACpE;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B;AAED,QAAA,MAAM,mBAAmB,8GAyCxB,CAAC;AAYF,UAAU,+BAA+B;IACvC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,KAAK,oBAAoB,GAAG,IAAI,CAC9B,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,MAAM,KAAK,CAAC,oBAAoB,CAAC,i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