@cakejp/design-system 0.19.0 → 0.20.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/CHANGELOG.md +35 -0
- package/CLAUDE.md +1 -0
- package/bin/init.js +191 -28
- package/contracts/components.json +38 -7
- package/contracts/composition.json +1 -1
- package/contracts/rules.json +1 -1
- package/contracts/screen-patterns.json +1 -1
- package/dist/components/ec/order-summary.js +16 -15
- package/dist/components/ec/product-card.js +1 -1
- package/dist/components/foundations/alert-dialog.js +7 -7
- package/dist/components/foundations/data-table.js +489 -16
- package/dist/components/foundations/dialog.js +13 -13
- package/dist/components/foundations/drawer.js +5 -5
- package/dist/components/foundations/sheet.js +7 -7
- package/dist/components/primitives/admin-header.js +1 -1
- package/dist/components/primitives/admin-side-nav.js +195 -86
- package/dist/components/primitives/bottom-tab-bar.js +20 -20
- package/dist/components/primitives/header.js +43 -37
- package/dist/components/primitives/sticky-action-bar.js +2 -1
- package/dist/index.css +1 -1
- package/dist/index.js +791 -470
- package/dist/types/components/primitives/admin-side-nav.d.ts +3 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/lib/link-component.d.ts +9 -0
- package/package.json +2 -2
- package/src/components/COMPONENT_LOOKUP.md +1 -1
- package/src/preset-standalone.css +2 -0
- package/src/preset.css +13 -3
- package/src/styles/semantic.css +10 -0
- package/templates/AGENTS.md +4 -2
- package/templates/AGENTS.stub.md +25 -0
- package/templates/CLAUDE.md +4 -2
- package/templates/CLAUDE.stub.md +25 -0
- package/tokens.json +9 -0
|
@@ -8,21 +8,21 @@ import { Button as k } from "../foundations/button.js";
|
|
|
8
8
|
import { DropdownMenu as F, DropdownMenuTrigger as G, DropdownMenuContent as Z, DropdownMenuItem as V } from "../foundations/dropdown-menu.js";
|
|
9
9
|
import { containerVariants as q } from "./container.js";
|
|
10
10
|
function E({
|
|
11
|
-
containerSize:
|
|
11
|
+
containerSize: r,
|
|
12
12
|
shellClass: c,
|
|
13
13
|
layoutClass: a,
|
|
14
14
|
containerQuery: u = !1,
|
|
15
15
|
children: p,
|
|
16
16
|
...d
|
|
17
17
|
}) {
|
|
18
|
-
return
|
|
18
|
+
return r ? /* @__PURE__ */ e("header", { "data-slot": "header", className: c, ...d, children: /* @__PURE__ */ e(
|
|
19
19
|
"div",
|
|
20
20
|
{
|
|
21
21
|
"data-slot": "header-container",
|
|
22
|
-
"data-container-size":
|
|
22
|
+
"data-container-size": r,
|
|
23
23
|
className: f(
|
|
24
24
|
u && "@container",
|
|
25
|
-
q({ size:
|
|
25
|
+
q({ size: r, gutter: "none" }),
|
|
26
26
|
a
|
|
27
27
|
),
|
|
28
28
|
children: p
|
|
@@ -37,33 +37,33 @@ function E({
|
|
|
37
37
|
}
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function R(
|
|
40
|
+
function R(r) {
|
|
41
41
|
return f(
|
|
42
42
|
"px-3 py-1.5 typo-body-md rounded-md transition-colors whitespace-nowrap",
|
|
43
|
-
|
|
43
|
+
r ? "text-[var(--Text-High-Emphasis)] font-bold" : "text-[var(--Text-Medium-Emphasis)] hover:text-[var(--Text-High-Emphasis)] hover:bg-[var(--Surface-Secondary)]"
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
46
|
const P = 2;
|
|
47
47
|
function J({
|
|
48
|
-
items:
|
|
48
|
+
items: r,
|
|
49
49
|
overflowLabel: c = "その他"
|
|
50
50
|
}) {
|
|
51
|
-
const a = y.useRef(null), u = y.useRef(null), [p, d] = y.useState(
|
|
51
|
+
const a = y.useRef(null), u = y.useRef(null), [p, d] = y.useState(r.length);
|
|
52
52
|
y.useEffect(() => {
|
|
53
|
-
const
|
|
54
|
-
if (!
|
|
53
|
+
const l = a.current, m = u.current;
|
|
54
|
+
if (!l || !m) return;
|
|
55
55
|
const i = () => {
|
|
56
|
-
const N = Array.from(m.children), v = N.slice(0,
|
|
56
|
+
const N = Array.from(m.children), v = N.slice(0, r.length).map((t) => t.getBoundingClientRect().width), z = N[r.length]?.getBoundingClientRect().width ?? 0, w = l.clientWidth;
|
|
57
57
|
if (w === 0 || v.some((t) => t === 0)) {
|
|
58
|
-
d(
|
|
58
|
+
d(r.length);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (v.reduce((t, h) => t + h, 0) + P * (
|
|
62
|
-
d(
|
|
61
|
+
if (v.reduce((t, h) => t + h, 0) + P * (r.length - 1) <= w) {
|
|
62
|
+
d(r.length);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
let g = z, A = 0;
|
|
66
|
-
for (let t = 0; t <
|
|
66
|
+
for (let t = 0; t < r.length; t++) {
|
|
67
67
|
const h = g + v[t] + P;
|
|
68
68
|
if (h > w) break;
|
|
69
69
|
g = h, A = t + 1;
|
|
@@ -72,11 +72,11 @@ function J({
|
|
|
72
72
|
};
|
|
73
73
|
i(), window.addEventListener("resize", i);
|
|
74
74
|
const b = typeof ResizeObserver < "u" ? new ResizeObserver(i) : null;
|
|
75
|
-
return b?.observe(
|
|
75
|
+
return b?.observe(l), b?.observe(m), () => {
|
|
76
76
|
window.removeEventListener("resize", i), b?.disconnect();
|
|
77
77
|
};
|
|
78
|
-
}, [
|
|
79
|
-
const x =
|
|
78
|
+
}, [r]);
|
|
79
|
+
const x = r.slice(0, p), o = r.slice(p);
|
|
80
80
|
return /* @__PURE__ */ s("div", { ref: a, className: "relative min-w-0 flex-1", children: [
|
|
81
81
|
/* @__PURE__ */ e(
|
|
82
82
|
"div",
|
|
@@ -89,7 +89,7 @@ function J({
|
|
|
89
89
|
ref: u,
|
|
90
90
|
className: "invisible flex w-max items-center gap-0.5",
|
|
91
91
|
children: [
|
|
92
|
-
|
|
92
|
+
r.map((l) => /* @__PURE__ */ e("span", { className: R(l.isActive), children: l.label }, l.label)),
|
|
93
93
|
/* @__PURE__ */ s("span", { className: f(R(!1), "inline-flex items-center gap-1"), children: [
|
|
94
94
|
c,
|
|
95
95
|
/* @__PURE__ */ e(M, { size: 16 })
|
|
@@ -100,16 +100,16 @@ function J({
|
|
|
100
100
|
}
|
|
101
101
|
),
|
|
102
102
|
/* @__PURE__ */ s("nav", { className: "flex items-center gap-0.5", children: [
|
|
103
|
-
x.map((
|
|
104
|
-
const m =
|
|
103
|
+
x.map((l) => {
|
|
104
|
+
const m = l.href ? "a" : "button", i = l.href ? { href: l.href } : { type: "button", onClick: l.onClick };
|
|
105
105
|
return /* @__PURE__ */ e(
|
|
106
106
|
m,
|
|
107
107
|
{
|
|
108
|
-
className: R(
|
|
108
|
+
className: R(l.isActive),
|
|
109
109
|
...i,
|
|
110
|
-
children:
|
|
110
|
+
children: l.label
|
|
111
111
|
},
|
|
112
|
-
|
|
112
|
+
l.label
|
|
113
113
|
);
|
|
114
114
|
}),
|
|
115
115
|
o.length > 0 && /* @__PURE__ */ s(F, { children: [
|
|
@@ -117,7 +117,7 @@ function J({
|
|
|
117
117
|
G,
|
|
118
118
|
{
|
|
119
119
|
className: f(
|
|
120
|
-
R(o.some((
|
|
120
|
+
R(o.some((l) => l.isActive)),
|
|
121
121
|
"inline-flex items-center gap-1"
|
|
122
122
|
),
|
|
123
123
|
children: [
|
|
@@ -127,21 +127,21 @@ function J({
|
|
|
127
127
|
}
|
|
128
128
|
),
|
|
129
129
|
/* @__PURE__ */ e(Z, { align: "end", children: o.map(
|
|
130
|
-
(
|
|
130
|
+
(l) => l.href ? /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
|
|
131
131
|
"a",
|
|
132
132
|
{
|
|
133
|
-
href:
|
|
134
|
-
onClick:
|
|
135
|
-
"aria-current":
|
|
136
|
-
children:
|
|
133
|
+
href: l.href,
|
|
134
|
+
onClick: l.onClick,
|
|
135
|
+
"aria-current": l.isActive ? "page" : void 0,
|
|
136
|
+
children: l.label
|
|
137
137
|
}
|
|
138
|
-
) },
|
|
138
|
+
) }, l.label) : /* @__PURE__ */ e(
|
|
139
139
|
V,
|
|
140
140
|
{
|
|
141
|
-
onSelect: () =>
|
|
142
|
-
children:
|
|
141
|
+
onSelect: () => l.onClick?.(),
|
|
142
|
+
children: l.label
|
|
143
143
|
},
|
|
144
|
-
|
|
144
|
+
l.label
|
|
145
145
|
)
|
|
146
146
|
) })
|
|
147
147
|
] })
|
|
@@ -149,7 +149,7 @@ function J({
|
|
|
149
149
|
] });
|
|
150
150
|
}
|
|
151
151
|
function S({
|
|
152
|
-
className:
|
|
152
|
+
className: r,
|
|
153
153
|
variant: c = "logo",
|
|
154
154
|
logo: a,
|
|
155
155
|
title: u,
|
|
@@ -157,7 +157,7 @@ function S({
|
|
|
157
157
|
backLabel: d = "戻る",
|
|
158
158
|
actions: x,
|
|
159
159
|
navItems: o,
|
|
160
|
-
navBreakpoint:
|
|
160
|
+
navBreakpoint: l = "md",
|
|
161
161
|
navOverflowLabel: m,
|
|
162
162
|
searchSlot: i,
|
|
163
163
|
searchBreakpoint: b,
|
|
@@ -168,7 +168,13 @@ function S({
|
|
|
168
168
|
containerSize: C,
|
|
169
169
|
...g
|
|
170
170
|
}) {
|
|
171
|
-
const h = f(
|
|
171
|
+
const h = f(
|
|
172
|
+
w ? "" : "sticky top-0 z-[var(--Z-Nav)]",
|
|
173
|
+
// 地は Surface-Elevated: sticky バーはスクロールするコンテンツの上に重なるため
|
|
174
|
+
// 不透明が必須(dark の Surface-Primary は 10% 透過で下の文字が透ける)。light は同値
|
|
175
|
+
"border-b border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Elevated)]",
|
|
176
|
+
r
|
|
177
|
+
), _ = l === "lg" ? "@[960px]:hidden" : "@[768px]:hidden", B = l === "lg" ? "hidden @[960px]:flex" : "hidden @[768px]:flex", O = b === "lg" ? "hidden @[960px]:block" : b === "md" ? "hidden @[768px]:block" : void 0;
|
|
172
178
|
if (c === "logo") {
|
|
173
179
|
const H = typeof a == "string" ? /* @__PURE__ */ e("span", { className: "typo-heading-lg text-[var(--Text-High-Emphasis)]", children: a }) : a ?? null, j = x && x.length > 0 && /* @__PURE__ */ e("div", { className: "flex shrink-0 items-center gap-1", children: x.map((n) => {
|
|
174
180
|
const L = n.showLabel ? {
|
|
@@ -12,7 +12,8 @@ function n({
|
|
|
12
12
|
{
|
|
13
13
|
"data-slot": "sticky-action-bar",
|
|
14
14
|
className: i(
|
|
15
|
-
|
|
15
|
+
// Surface-Elevated: スクロール内容の上に重なる固定バーは不透明が必須(dark で透けない)
|
|
16
|
+
"sticky bottom-0 z-[var(--Z-Nav)] bg-[var(--Surface-Elevated)] px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
|
|
16
17
|
t && "border-t border-[var(--Border-Low-Emphasis)]",
|
|
17
18
|
r
|
|
18
19
|
),
|