@brightlocal/ui-components 2.3.0 → 2.4.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/AI_USAGE.md +1 -1
- package/README.md +4 -3
- package/component-meta.json +479 -24
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.js +27 -27
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input.cjs +1 -1
- package/dist/input.d.ts.map +1 -1
- package/dist/input.js +6 -7
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +17 -3
- package/dist/split-layout.d.ts.map +1 -1
- package/dist/split-layout.js +86 -114
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +6 -6
- package/package.json +34 -10
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +1 -1
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input.tsx +2 -3
- package/src/components/split-layout.tsx +27 -65
- package/src/components/textarea.tsx +1 -1
package/dist/split-layout.js
CHANGED
|
@@ -1,139 +1,111 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { cn as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as m, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { cn as i } from "@brightlocal/ui-components/lib/utils";
|
|
4
|
+
const y = r.forwardRef(
|
|
5
5
|
({
|
|
6
|
-
className:
|
|
7
|
-
dataHook:
|
|
8
|
-
trackingEl:
|
|
9
|
-
trackingLabel:
|
|
10
|
-
left:
|
|
11
|
-
right:
|
|
6
|
+
className: t,
|
|
7
|
+
dataHook: a,
|
|
8
|
+
trackingEl: l,
|
|
9
|
+
trackingLabel: e,
|
|
10
|
+
left: o,
|
|
11
|
+
right: n,
|
|
12
12
|
children: d,
|
|
13
|
-
...
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"flex min-h-screen w-full flex-col lg:flex-row",
|
|
35
|
-
e
|
|
36
|
-
),
|
|
37
|
-
"data-hook": l,
|
|
38
|
-
"data-slot": "split-layout",
|
|
39
|
-
"data-tracking-el": a || "split-layout",
|
|
40
|
-
"data-tracking-label": o,
|
|
41
|
-
...f,
|
|
42
|
-
children: [
|
|
43
|
-
/* @__PURE__ */ n(
|
|
44
|
-
"div",
|
|
45
|
-
{
|
|
46
|
-
className: "bg-background flex flex-1 flex-col",
|
|
47
|
-
"data-slot": "split-layout-body",
|
|
48
|
-
children: /* @__PURE__ */ C(L.Provider, { value: R, children: [
|
|
49
|
-
p,
|
|
50
|
-
x ? s && /* @__PURE__ */ n(v, { children: s }) : y
|
|
51
|
-
] })
|
|
52
|
-
}
|
|
53
|
-
),
|
|
54
|
-
x ? i && /* @__PURE__ */ n(h, { children: i }) : m
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
}
|
|
13
|
+
...u
|
|
14
|
+
}, c) => /* @__PURE__ */ m(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
ref: c,
|
|
18
|
+
className: i(
|
|
19
|
+
"group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",
|
|
20
|
+
t
|
|
21
|
+
),
|
|
22
|
+
"data-hook": a,
|
|
23
|
+
"data-slot": "split-layout",
|
|
24
|
+
"data-tracking-el": l || "split-layout",
|
|
25
|
+
"data-tracking-label": e,
|
|
26
|
+
...u,
|
|
27
|
+
children: [
|
|
28
|
+
d,
|
|
29
|
+
o && /* @__PURE__ */ s(p, { children: o }),
|
|
30
|
+
n && /* @__PURE__ */ s(f, { children: n })
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
)
|
|
59
34
|
);
|
|
60
|
-
|
|
61
|
-
const
|
|
35
|
+
y.displayName = "SplitLayout";
|
|
36
|
+
const g = r.forwardRef(({ className: t, children: a, ...l }, e) => /* @__PURE__ */ s(
|
|
62
37
|
"div",
|
|
63
38
|
{
|
|
64
|
-
ref:
|
|
65
|
-
className:
|
|
66
|
-
"px-section-sm pt-section-sm flex w-full items-center justify-center lg:justify-start",
|
|
67
|
-
|
|
39
|
+
ref: e,
|
|
40
|
+
className: i(
|
|
41
|
+
"px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",
|
|
42
|
+
t
|
|
68
43
|
),
|
|
69
44
|
"data-slot": "split-layout-header",
|
|
70
|
-
...
|
|
71
|
-
children:
|
|
45
|
+
...l,
|
|
46
|
+
children: a
|
|
72
47
|
}
|
|
73
48
|
));
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const s = t.useContext(L);
|
|
77
|
-
return /* @__PURE__ */ n(
|
|
78
|
-
"div",
|
|
79
|
-
{
|
|
80
|
-
ref: o,
|
|
81
|
-
className: c(
|
|
82
|
-
"p-section-sm flex flex-1 items-center justify-center overflow-auto",
|
|
83
|
-
s && "pt-2",
|
|
84
|
-
e
|
|
85
|
-
),
|
|
86
|
-
"data-slot": "split-layout-left",
|
|
87
|
-
...a,
|
|
88
|
-
children: l
|
|
89
|
-
}
|
|
90
|
-
);
|
|
91
|
-
});
|
|
92
|
-
v.displayName = "SplitLayoutContentLeft";
|
|
93
|
-
const h = t.forwardRef(({ className: e, flush: l = !1, children: a, ...o }, s) => /* @__PURE__ */ n(
|
|
49
|
+
g.displayName = "SplitLayoutHeader";
|
|
50
|
+
const p = r.forwardRef(({ className: t, children: a, ...l }, e) => /* @__PURE__ */ s(
|
|
94
51
|
"div",
|
|
95
52
|
{
|
|
96
|
-
ref:
|
|
97
|
-
className:
|
|
98
|
-
"
|
|
99
|
-
|
|
100
|
-
|
|
53
|
+
ref: e,
|
|
54
|
+
className: i(
|
|
55
|
+
"p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto",
|
|
56
|
+
"group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",
|
|
57
|
+
t
|
|
101
58
|
),
|
|
102
|
-
"data-slot": "split-layout-
|
|
103
|
-
...
|
|
59
|
+
"data-slot": "split-layout-left",
|
|
60
|
+
...l,
|
|
104
61
|
children: a
|
|
105
62
|
}
|
|
106
63
|
));
|
|
107
|
-
|
|
108
|
-
const
|
|
64
|
+
p.displayName = "SplitLayoutContentLeft";
|
|
65
|
+
const f = r.forwardRef(({ className: t, flush: a = !1, children: l, ...e }, o) => /* @__PURE__ */ s(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
ref: o,
|
|
69
|
+
className: i(
|
|
70
|
+
"bg-card hidden lg:col-start-2 lg:row-span-full lg:row-start-1",
|
|
71
|
+
a ? "relative overflow-hidden lg:block" : "p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",
|
|
72
|
+
t
|
|
73
|
+
),
|
|
74
|
+
"data-slot": "split-layout-right",
|
|
75
|
+
...e,
|
|
76
|
+
children: l
|
|
77
|
+
}
|
|
78
|
+
));
|
|
79
|
+
f.displayName = "SplitLayoutContentRight";
|
|
80
|
+
const h = r.forwardRef(
|
|
109
81
|
({
|
|
110
|
-
className:
|
|
111
|
-
dataHook:
|
|
112
|
-
src:
|
|
113
|
-
alt:
|
|
114
|
-
objectFit:
|
|
115
|
-
objectPosition:
|
|
82
|
+
className: t,
|
|
83
|
+
dataHook: a,
|
|
84
|
+
src: l,
|
|
85
|
+
alt: e,
|
|
86
|
+
objectFit: o = "cover",
|
|
87
|
+
objectPosition: n = "center",
|
|
116
88
|
style: d,
|
|
117
|
-
...
|
|
118
|
-
},
|
|
89
|
+
...u
|
|
90
|
+
}, c) => /* @__PURE__ */ s(
|
|
119
91
|
"img",
|
|
120
92
|
{
|
|
121
|
-
ref:
|
|
122
|
-
alt:
|
|
123
|
-
className:
|
|
124
|
-
"data-hook":
|
|
93
|
+
ref: c,
|
|
94
|
+
alt: e,
|
|
95
|
+
className: i("absolute inset-0 h-full w-full", t),
|
|
96
|
+
"data-hook": a,
|
|
125
97
|
"data-slot": "split-layout-image",
|
|
126
|
-
src:
|
|
127
|
-
style: { objectFit:
|
|
128
|
-
...
|
|
98
|
+
src: l,
|
|
99
|
+
style: { objectFit: o, objectPosition: n, ...d },
|
|
100
|
+
...u
|
|
129
101
|
}
|
|
130
102
|
)
|
|
131
103
|
);
|
|
132
|
-
|
|
104
|
+
h.displayName = "SplitLayoutImage";
|
|
133
105
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
106
|
+
y as SplitLayout,
|
|
107
|
+
p as SplitLayoutContentLeft,
|
|
108
|
+
f as SplitLayoutContentRight,
|
|
109
|
+
g as SplitLayoutHeader,
|
|
110
|
+
h as SplitLayoutImage
|
|
139
111
|
};
|
package/dist/textarea.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),u=require("react"),l=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils");function f(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 g=f(u),v=l.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow]","text-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),u=require("react"),l=require("class-variance-authority"),b=require("@brightlocal/ui-components/lib/utils");function f(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 g=f(u),v=l.cva(["flex w-full","border border-input bg-background rounded-md","outline-none transition-[border-color,background-color,box-shadow]","text-base leading-normal font-sans","text-foreground","px-3 py-2","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground"]),n=g.forwardRef(({className:e,dataHook:r,error:t,trackingEl:a,trackingLabel:s,...o},c)=>{const i=t||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return d.jsx("textarea",{ref:c,"aria-invalid":i?"true":void 0,className:b.cn(v(),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":r,"data-slot":"textarea","data-tracking-el":a,"data-tracking-label":s,...o})});n.displayName="Textarea";exports.Textarea=n;
|
package/dist/textarea.js
CHANGED
|
@@ -9,7 +9,7 @@ const b = c([
|
|
|
9
9
|
"border border-input bg-background rounded-md",
|
|
10
10
|
"outline-none transition-[border-color,background-color,box-shadow]",
|
|
11
11
|
// Typography
|
|
12
|
-
"text-
|
|
12
|
+
"text-base leading-normal font-sans",
|
|
13
13
|
"text-foreground",
|
|
14
14
|
// Spacing
|
|
15
15
|
"px-3 py-2",
|
|
@@ -21,23 +21,23 @@ const b = c([
|
|
|
21
21
|
// Pseudo-elements
|
|
22
22
|
"placeholder:text-muted-foreground"
|
|
23
23
|
]), f = l.forwardRef(
|
|
24
|
-
({ className: a, dataHook: o, error: t, trackingEl: i, trackingLabel: d, ...
|
|
25
|
-
const
|
|
24
|
+
({ className: a, dataHook: o, error: t, trackingEl: i, trackingLabel: d, ...e }, s) => {
|
|
25
|
+
const r = t || e["aria-invalid"] === !0 || e["aria-invalid"] === "true";
|
|
26
26
|
return /* @__PURE__ */ n(
|
|
27
27
|
"textarea",
|
|
28
28
|
{
|
|
29
29
|
ref: s,
|
|
30
|
-
"aria-invalid":
|
|
30
|
+
"aria-invalid": r ? "true" : void 0,
|
|
31
31
|
className: u(
|
|
32
32
|
b(),
|
|
33
|
-
|
|
33
|
+
r && "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
|
|
34
34
|
a
|
|
35
35
|
),
|
|
36
36
|
"data-hook": o,
|
|
37
37
|
"data-slot": "textarea",
|
|
38
38
|
"data-tracking-el": i,
|
|
39
39
|
"data-tracking-label": d,
|
|
40
|
-
...
|
|
40
|
+
...e
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightlocal/ui-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "BrightLocal Design System UI Components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -42,14 +42,32 @@
|
|
|
42
42
|
"import": "./dist/lib/utils.js",
|
|
43
43
|
"require": "./dist/lib/utils.cjs"
|
|
44
44
|
},
|
|
45
|
-
"./
|
|
45
|
+
"./data-table": {
|
|
46
46
|
"source": {
|
|
47
|
-
"types": "./src/blocks
|
|
48
|
-
"import": "./src/blocks
|
|
47
|
+
"types": "./src/blocks/data-table.tsx",
|
|
48
|
+
"import": "./src/blocks/data-table.tsx"
|
|
49
49
|
},
|
|
50
|
-
"types": "./dist/blocks
|
|
51
|
-
"import": "./dist/blocks
|
|
52
|
-
"require": "./dist/blocks
|
|
50
|
+
"types": "./dist/blocks/data-table.d.ts",
|
|
51
|
+
"import": "./dist/blocks/data-table.js",
|
|
52
|
+
"require": "./dist/blocks/data-table.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./input-list": {
|
|
55
|
+
"source": {
|
|
56
|
+
"types": "./src/blocks/input-list.tsx",
|
|
57
|
+
"import": "./src/blocks/input-list.tsx"
|
|
58
|
+
},
|
|
59
|
+
"types": "./dist/blocks/input-list.d.ts",
|
|
60
|
+
"import": "./dist/blocks/input-list.js",
|
|
61
|
+
"require": "./dist/blocks/input-list.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./sidebar": {
|
|
64
|
+
"source": {
|
|
65
|
+
"types": "./src/blocks/sidebar.tsx",
|
|
66
|
+
"import": "./src/blocks/sidebar.tsx"
|
|
67
|
+
},
|
|
68
|
+
"types": "./dist/blocks/sidebar.d.ts",
|
|
69
|
+
"import": "./dist/blocks/sidebar.js",
|
|
70
|
+
"require": "./dist/blocks/sidebar.cjs"
|
|
53
71
|
},
|
|
54
72
|
"./tailwind.css": {
|
|
55
73
|
"default": "./tailwind.css"
|
|
@@ -81,8 +99,14 @@
|
|
|
81
99
|
"lib/*": [
|
|
82
100
|
"dist/lib/*"
|
|
83
101
|
],
|
|
84
|
-
"
|
|
85
|
-
"dist/blocks
|
|
102
|
+
"data-table": [
|
|
103
|
+
"dist/blocks/data-table"
|
|
104
|
+
],
|
|
105
|
+
"input-list": [
|
|
106
|
+
"dist/blocks/input-list"
|
|
107
|
+
],
|
|
108
|
+
"sidebar": [
|
|
109
|
+
"dist/blocks/sidebar"
|
|
86
110
|
],
|
|
87
111
|
"*": [
|
|
88
112
|
"dist/*"
|
|
@@ -162,7 +186,7 @@
|
|
|
162
186
|
"sonner": "^2.0.7",
|
|
163
187
|
"tailwind-merge": "^3.4.0",
|
|
164
188
|
"vaul": "^1.1.2",
|
|
165
|
-
"@brightlocal/icons": "2.1.
|
|
189
|
+
"@brightlocal/icons": "2.1.1"
|
|
166
190
|
},
|
|
167
191
|
"size-limit": [
|
|
168
192
|
{
|
|
@@ -322,7 +322,7 @@ const comboboxTriggerVariants = cva([
|
|
|
322
322
|
"dark:bg-white/5 dark:border-white/15",
|
|
323
323
|
|
|
324
324
|
// Typography
|
|
325
|
-
"text-
|
|
325
|
+
"text-base font-normal font-sans text-foreground",
|
|
326
326
|
|
|
327
327
|
// Placeholder state
|
|
328
328
|
"data-[placeholder=true]:text-muted-foreground",
|
|
@@ -460,7 +460,7 @@ function ComboboxValue({
|
|
|
460
460
|
return (
|
|
461
461
|
<span
|
|
462
462
|
className={cn(
|
|
463
|
-
"text-foreground overflow-hidden text-
|
|
463
|
+
"text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
|
|
464
464
|
className
|
|
465
465
|
)}
|
|
466
466
|
data-slot="combobox-value"
|
|
@@ -131,7 +131,7 @@ const CommandInput = React.forwardRef<
|
|
|
131
131
|
<CommandPrimitive.Input
|
|
132
132
|
ref={inputRef}
|
|
133
133
|
className={cn(
|
|
134
|
-
"placeholder:text-muted-foreground flex w-full bg-transparent text-
|
|
134
|
+
"placeholder:text-muted-foreground flex w-full bg-transparent text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
|
|
135
135
|
className
|
|
136
136
|
)}
|
|
137
137
|
data-slot="command-input"
|
|
@@ -137,7 +137,7 @@ function InputOTPSlot({ index, className, ...props }: InputOTPSlotProps) {
|
|
|
137
137
|
// Base styles
|
|
138
138
|
"relative flex h-9 w-9 items-center justify-center",
|
|
139
139
|
"border-input bg-background border-y border-r",
|
|
140
|
-
"text-foreground text-
|
|
140
|
+
"text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none",
|
|
141
141
|
"first:rounded-l-md first:border-l last:rounded-r-md",
|
|
142
142
|
// Focus state
|
|
143
143
|
"data-[active=true]:border-ring data-[active=true]:z-10",
|
package/src/components/input.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export const inputVariants = cva(
|
|
|
16
16
|
"border border-input bg-background rounded-sm",
|
|
17
17
|
"outline-none transition-[border-color,box-shadow,background-color]",
|
|
18
18
|
// Typography
|
|
19
|
-
"text-
|
|
19
|
+
"text-base font-sans",
|
|
20
20
|
"text-foreground",
|
|
21
21
|
"overflow-hidden text-ellipsis",
|
|
22
22
|
// States - Focus
|
|
@@ -27,8 +27,7 @@ export const inputVariants = cva(
|
|
|
27
27
|
// Pseudo-elements
|
|
28
28
|
"placeholder:text-muted-foreground",
|
|
29
29
|
"placeholder:overflow-hidden placeholder:text-ellipsis",
|
|
30
|
-
|
|
31
|
-
"items-center px-3 pb-[1px] leading-5",
|
|
30
|
+
"items-center px-3",
|
|
32
31
|
// Hide default browser icons for date/time inputs
|
|
33
32
|
"[&::-webkit-calendar-picker-indicator]:hidden",
|
|
34
33
|
],
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { cn } from "@brightlocal/ui-components/lib/utils";
|
|
3
3
|
|
|
4
|
-
/* -------------------------------------------------------------------------------------------------
|
|
5
|
-
* Internal context — lets SplitLayoutContentLeft know if a header is present
|
|
6
|
-
* -----------------------------------------------------------------------------------------------*/
|
|
7
|
-
|
|
8
|
-
const SplitLayoutContext = React.createContext(false);
|
|
9
|
-
|
|
10
4
|
/* -------------------------------------------------------------------------------------------------
|
|
11
5
|
* SplitLayout Root
|
|
12
6
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -37,8 +31,10 @@ interface SplitLayoutProps extends React.ComponentProps<"div"> {
|
|
|
37
31
|
* and shows only the left section on smaller screens (hiding the right/marketing section).
|
|
38
32
|
* This pattern is commonly used for authentication pages where the form is prioritized on mobile.
|
|
39
33
|
*
|
|
40
|
-
* Uses
|
|
41
|
-
*
|
|
34
|
+
* Uses CSS Grid for slot positioning — sub-components self-place into the correct
|
|
35
|
+
* grid area via their own classes, so SplitLayout renders {children} without
|
|
36
|
+
* inspecting them. This enables composition through any wrapping: Fragments,
|
|
37
|
+
* router Outlets, memoized components, or conditional renders.
|
|
42
38
|
*
|
|
43
39
|
* @example
|
|
44
40
|
* // Basic usage
|
|
@@ -65,6 +61,15 @@ interface SplitLayoutProps extends React.ComponentProps<"div"> {
|
|
|
65
61
|
* </SplitLayoutContentRight>
|
|
66
62
|
* </SplitLayout>
|
|
67
63
|
*
|
|
64
|
+
* @example
|
|
65
|
+
* // With router Outlet — slots project up through any wrapping
|
|
66
|
+
* <SplitLayout dataHook="auth-layout">
|
|
67
|
+
* <SplitLayoutHeader>
|
|
68
|
+
* <Header dataHook="my-header"><Logo dataHook="my-logo" /></Header>
|
|
69
|
+
* </SplitLayoutHeader>
|
|
70
|
+
* <Outlet />
|
|
71
|
+
* </SplitLayout>
|
|
72
|
+
*
|
|
68
73
|
* Layout specifications:
|
|
69
74
|
* - Mobile/Tablet: Stacked layout, only left section visible, content centered
|
|
70
75
|
* - Desktop (≥1024px): Side-by-side, content centered within each section
|
|
@@ -86,42 +91,11 @@ const SplitLayout = React.forwardRef<HTMLDivElement, SplitLayoutProps>(
|
|
|
86
91
|
},
|
|
87
92
|
ref
|
|
88
93
|
) => {
|
|
89
|
-
const headerChildren: React.ReactNode[] = [];
|
|
90
|
-
const leftChildren: React.ReactNode[] = [];
|
|
91
|
-
const rightChildren: React.ReactNode[] = [];
|
|
92
|
-
|
|
93
|
-
const collectChild = (child: React.ReactNode): void => {
|
|
94
|
-
if (!React.isValidElement(child)) return;
|
|
95
|
-
if (child.type === React.Fragment) {
|
|
96
|
-
React.Children.forEach(
|
|
97
|
-
(child.props as { children: React.ReactNode }).children,
|
|
98
|
-
collectChild
|
|
99
|
-
);
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (child.type === SplitLayoutHeader) {
|
|
103
|
-
headerChildren.push(child);
|
|
104
|
-
} else if (child.type === SplitLayoutContentRight) {
|
|
105
|
-
rightChildren.push(child);
|
|
106
|
-
} else {
|
|
107
|
-
leftChildren.push(child);
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
React.Children.forEach(children, collectChild);
|
|
111
|
-
|
|
112
|
-
// Support legacy left/right props as fallback
|
|
113
|
-
const hasLegacyProps = left != null || right != null;
|
|
114
|
-
const hasCompositionChildren =
|
|
115
|
-
leftChildren.length > 0 || rightChildren.length > 0;
|
|
116
|
-
const useLegacy = hasLegacyProps && !hasCompositionChildren;
|
|
117
|
-
|
|
118
|
-
const hasHeader = headerChildren.length > 0;
|
|
119
|
-
|
|
120
94
|
return (
|
|
121
95
|
<div
|
|
122
96
|
ref={ref}
|
|
123
97
|
className={cn(
|
|
124
|
-
"
|
|
98
|
+
"group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",
|
|
125
99
|
className
|
|
126
100
|
)}
|
|
127
101
|
data-hook={dataHook}
|
|
@@ -130,22 +104,9 @@ const SplitLayout = React.forwardRef<HTMLDivElement, SplitLayoutProps>(
|
|
|
130
104
|
data-tracking-label={trackingLabel}
|
|
131
105
|
{...props}
|
|
132
106
|
>
|
|
133
|
-
{
|
|
134
|
-
<
|
|
135
|
-
|
|
136
|
-
data-slot="split-layout-body"
|
|
137
|
-
>
|
|
138
|
-
<SplitLayoutContext.Provider value={hasHeader}>
|
|
139
|
-
{headerChildren}
|
|
140
|
-
{useLegacy
|
|
141
|
-
? left && <SplitLayoutContentLeft>{left}</SplitLayoutContentLeft>
|
|
142
|
-
: leftChildren}
|
|
143
|
-
</SplitLayoutContext.Provider>
|
|
144
|
-
</div>
|
|
145
|
-
{/* Right column: extends full height with bg-card */}
|
|
146
|
-
{useLegacy
|
|
147
|
-
? right && <SplitLayoutContentRight>{right}</SplitLayoutContentRight>
|
|
148
|
-
: rightChildren}
|
|
107
|
+
{children}
|
|
108
|
+
{left && <SplitLayoutContentLeft>{left}</SplitLayoutContentLeft>}
|
|
109
|
+
{right && <SplitLayoutContentRight>{right}</SplitLayoutContentRight>}
|
|
149
110
|
</div>
|
|
150
111
|
);
|
|
151
112
|
}
|
|
@@ -168,6 +129,7 @@ interface SplitLayoutHeaderProps extends React.ComponentProps<"div"> {
|
|
|
168
129
|
* SplitLayoutHeader component for rendering header content at the top of SplitLayout.
|
|
169
130
|
* Content is centered on mobile/tablet, left-aligned from lg breakpoint onwards.
|
|
170
131
|
* Uses section padding tokens for responsive horizontal and vertical padding (16px mobile, 24px desktop).
|
|
132
|
+
* Self-positions in the first column, first row of the grid.
|
|
171
133
|
*/
|
|
172
134
|
const SplitLayoutHeader = React.forwardRef<
|
|
173
135
|
HTMLDivElement,
|
|
@@ -177,7 +139,7 @@ const SplitLayoutHeader = React.forwardRef<
|
|
|
177
139
|
<div
|
|
178
140
|
ref={ref}
|
|
179
141
|
className={cn(
|
|
180
|
-
"px-section-sm pt-section-sm flex w-full items-center justify-center lg:justify-start",
|
|
142
|
+
"px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",
|
|
181
143
|
className
|
|
182
144
|
)}
|
|
183
145
|
data-slot="split-layout-header"
|
|
@@ -202,20 +164,19 @@ interface SplitLayoutContentLeftProps extends React.ComponentProps<"div"> {
|
|
|
202
164
|
* SplitLayoutContentLeft - Left/primary section within a SplitLayout.
|
|
203
165
|
*
|
|
204
166
|
* Always visible. When a SplitLayoutHeader is present, top padding is
|
|
205
|
-
* automatically reduced to avoid excessive spacing below the header.
|
|
167
|
+
* automatically reduced via CSS :has() to avoid excessive spacing below the header.
|
|
168
|
+
* Self-positions in the first column, second row of the grid.
|
|
206
169
|
*/
|
|
207
170
|
const SplitLayoutContentLeft = React.forwardRef<
|
|
208
171
|
HTMLDivElement,
|
|
209
172
|
SplitLayoutContentLeftProps
|
|
210
173
|
>(({ className, children, ...props }, ref) => {
|
|
211
|
-
const hasHeader = React.useContext(SplitLayoutContext);
|
|
212
|
-
|
|
213
174
|
return (
|
|
214
175
|
<div
|
|
215
176
|
ref={ref}
|
|
216
177
|
className={cn(
|
|
217
|
-
"p-section-sm flex
|
|
218
|
-
|
|
178
|
+
"p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto",
|
|
179
|
+
"group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",
|
|
219
180
|
className
|
|
220
181
|
)}
|
|
221
182
|
data-slot="split-layout-left"
|
|
@@ -247,6 +208,7 @@ interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
|
|
|
247
208
|
*
|
|
248
209
|
* Hidden on mobile/tablet (<1024px), visible on desktop (≥1024px).
|
|
249
210
|
* Uses bg-card background color.
|
|
211
|
+
* Self-positions in the second column, spanning all rows of the grid.
|
|
250
212
|
*
|
|
251
213
|
* Set `flush` to remove padding for full-bleed content (e.g. images).
|
|
252
214
|
*/
|
|
@@ -258,10 +220,10 @@ const SplitLayoutContentRight = React.forwardRef<
|
|
|
258
220
|
<div
|
|
259
221
|
ref={ref}
|
|
260
222
|
className={cn(
|
|
261
|
-
"bg-card hidden",
|
|
223
|
+
"bg-card hidden lg:col-start-2 lg:row-span-full lg:row-start-1",
|
|
262
224
|
flush
|
|
263
|
-
? "relative
|
|
264
|
-
: "p-section-sm
|
|
225
|
+
? "relative overflow-hidden lg:block"
|
|
226
|
+
: "p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",
|
|
265
227
|
className
|
|
266
228
|
)}
|
|
267
229
|
data-slot="split-layout-right"
|
|
@@ -10,7 +10,7 @@ const textareaVariants = cva([
|
|
|
10
10
|
"border border-input bg-background rounded-md",
|
|
11
11
|
"outline-none transition-[border-color,background-color,box-shadow]",
|
|
12
12
|
// Typography
|
|
13
|
-
"text-
|
|
13
|
+
"text-base leading-normal font-sans",
|
|
14
14
|
"text-foreground",
|
|
15
15
|
// Spacing
|
|
16
16
|
"px-3 py-2",
|