@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.
Files changed (34) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/CLAUDE.md +1 -0
  3. package/bin/init.js +191 -28
  4. package/contracts/components.json +38 -7
  5. package/contracts/composition.json +1 -1
  6. package/contracts/rules.json +1 -1
  7. package/contracts/screen-patterns.json +1 -1
  8. package/dist/components/ec/order-summary.js +16 -15
  9. package/dist/components/ec/product-card.js +1 -1
  10. package/dist/components/foundations/alert-dialog.js +7 -7
  11. package/dist/components/foundations/data-table.js +489 -16
  12. package/dist/components/foundations/dialog.js +13 -13
  13. package/dist/components/foundations/drawer.js +5 -5
  14. package/dist/components/foundations/sheet.js +7 -7
  15. package/dist/components/primitives/admin-header.js +1 -1
  16. package/dist/components/primitives/admin-side-nav.js +195 -86
  17. package/dist/components/primitives/bottom-tab-bar.js +20 -20
  18. package/dist/components/primitives/header.js +43 -37
  19. package/dist/components/primitives/sticky-action-bar.js +2 -1
  20. package/dist/index.css +1 -1
  21. package/dist/index.js +791 -470
  22. package/dist/types/components/primitives/admin-side-nav.d.ts +3 -0
  23. package/dist/types/index.d.ts +3 -2
  24. package/dist/types/lib/link-component.d.ts +9 -0
  25. package/package.json +2 -2
  26. package/src/components/COMPONENT_LOOKUP.md +1 -1
  27. package/src/preset-standalone.css +2 -0
  28. package/src/preset.css +13 -3
  29. package/src/styles/semantic.css +10 -0
  30. package/templates/AGENTS.md +4 -2
  31. package/templates/AGENTS.stub.md +25 -0
  32. package/templates/CLAUDE.md +4 -2
  33. package/templates/CLAUDE.stub.md +25 -0
  34. 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: l,
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 l ? /* @__PURE__ */ e("header", { "data-slot": "header", className: c, ...d, children: /* @__PURE__ */ e(
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": l,
22
+ "data-container-size": r,
23
23
  className: f(
24
24
  u && "@container",
25
- q({ size: l, gutter: "none" }),
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(l) {
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
- l ? "text-[var(--Text-High-Emphasis)] font-bold" : "text-[var(--Text-Medium-Emphasis)] hover:text-[var(--Text-High-Emphasis)] hover:bg-[var(--Surface-Secondary)]"
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: l,
48
+ items: r,
49
49
  overflowLabel: c = "その他"
50
50
  }) {
51
- const a = y.useRef(null), u = y.useRef(null), [p, d] = y.useState(l.length);
51
+ const a = y.useRef(null), u = y.useRef(null), [p, d] = y.useState(r.length);
52
52
  y.useEffect(() => {
53
- const r = a.current, m = u.current;
54
- if (!r || !m) return;
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, l.length).map((t) => t.getBoundingClientRect().width), z = N[l.length]?.getBoundingClientRect().width ?? 0, w = r.clientWidth;
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(l.length);
58
+ d(r.length);
59
59
  return;
60
60
  }
61
- if (v.reduce((t, h) => t + h, 0) + P * (l.length - 1) <= w) {
62
- d(l.length);
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 < l.length; 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(r), b?.observe(m), () => {
75
+ return b?.observe(l), b?.observe(m), () => {
76
76
  window.removeEventListener("resize", i), b?.disconnect();
77
77
  };
78
- }, [l]);
79
- const x = l.slice(0, p), o = l.slice(p);
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
- l.map((r) => /* @__PURE__ */ e("span", { className: R(r.isActive), children: r.label }, r.label)),
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((r) => {
104
- const m = r.href ? "a" : "button", i = r.href ? { href: r.href } : { type: "button", onClick: r.onClick };
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(r.isActive),
108
+ className: R(l.isActive),
109
109
  ...i,
110
- children: r.label
110
+ children: l.label
111
111
  },
112
- r.label
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((r) => r.isActive)),
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
- (r) => r.href ? /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
130
+ (l) => l.href ? /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(
131
131
  "a",
132
132
  {
133
- href: r.href,
134
- onClick: r.onClick,
135
- "aria-current": r.isActive ? "page" : void 0,
136
- children: r.label
133
+ href: l.href,
134
+ onClick: l.onClick,
135
+ "aria-current": l.isActive ? "page" : void 0,
136
+ children: l.label
137
137
  }
138
- ) }, r.label) : /* @__PURE__ */ e(
138
+ ) }, l.label) : /* @__PURE__ */ e(
139
139
  V,
140
140
  {
141
- onSelect: () => r.onClick?.(),
142
- children: r.label
141
+ onSelect: () => l.onClick?.(),
142
+ children: l.label
143
143
  },
144
- r.label
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: l,
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: r = "md",
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(w ? "" : "sticky top-0 z-[var(--Z-Nav)]", "border-b border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Primary)]", l), _ = r === "lg" ? "@[960px]:hidden" : "@[768px]:hidden", B = r === "lg" ? "hidden @[960px]:flex" : "hidden @[768px]:flex", O = b === "lg" ? "hidden @[960px]:block" : b === "md" ? "hidden @[768px]:block" : void 0;
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
- "sticky bottom-0 z-[var(--Z-Nav)] bg-[var(--Surface-Primary)] px-4 py-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",
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
  ),