@cakejp/design-system 0.16.0 → 0.17.1

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 (151) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/CLAUDE.md +1 -0
  3. package/bin/init.js +29 -6
  4. package/contracts/components.json +42 -7
  5. package/contracts/composition.json +8 -2
  6. package/contracts/rules.json +5 -1
  7. package/contracts/screen-patterns.json +1 -1
  8. package/dist/components/ec/_mypage-menu-data.js +166 -0
  9. package/dist/components/ec/admin-shell.js +202 -0
  10. package/dist/components/ec/anniversary-card.js +63 -0
  11. package/dist/components/ec/cake-logo.js +38 -0
  12. package/dist/components/ec/chart-controls.js +91 -0
  13. package/dist/components/ec/countdown-timer.js +50 -0
  14. package/dist/components/ec/coupon-card.js +136 -0
  15. package/dist/components/ec/delivery-calendar.js +105 -0
  16. package/dist/components/ec/mypage-shell.js +98 -0
  17. package/dist/components/ec/order-section.js +53 -0
  18. package/dist/components/ec/order-summary.js +78 -0
  19. package/dist/components/ec/payment-method.js +81 -0
  20. package/dist/components/ec/product-card.js +235 -0
  21. package/dist/components/ec/product-carousel.js +106 -0
  22. package/dist/components/ec/product-cta.js +80 -0
  23. package/dist/components/ec/product-detail-bar.js +86 -0
  24. package/dist/components/ec/product-detail-sidebar.js +296 -0
  25. package/dist/components/ec/product-list-item.js +266 -0
  26. package/dist/components/ec/product-option.js +165 -0
  27. package/dist/components/ec/rating-stars.js +74 -0
  28. package/dist/components/ec/review-card.js +126 -0
  29. package/dist/components/ec/review-form.js +181 -0
  30. package/dist/components/ec/review-summary.js +95 -0
  31. package/dist/components/ec/shop-card.js +179 -0
  32. package/dist/components/ec/stat-card.js +50 -0
  33. package/dist/components/foundations/accordion.js +67 -0
  34. package/dist/components/foundations/alert-dialog.js +165 -0
  35. package/dist/components/foundations/alert.js +218 -0
  36. package/dist/components/foundations/aspect-ratio.js +10 -0
  37. package/dist/components/foundations/avatar.js +58 -0
  38. package/dist/components/foundations/badge.js +54 -0
  39. package/dist/components/foundations/breadcrumb.js +104 -0
  40. package/dist/components/foundations/button.js +99 -0
  41. package/dist/components/foundations/calendar.js +173 -0
  42. package/dist/components/foundations/card.js +109 -0
  43. package/dist/components/foundations/checkbox-card.js +111 -0
  44. package/dist/components/foundations/checkbox-group.js +92 -0
  45. package/dist/components/foundations/checkbox.js +90 -0
  46. package/dist/components/foundations/chip-variants.js +41 -0
  47. package/dist/components/foundations/collapsible.js +34 -0
  48. package/dist/components/foundations/command.js +171 -0
  49. package/dist/components/foundations/context-menu.js +225 -0
  50. package/dist/components/foundations/data-table.js +59 -0
  51. package/dist/components/foundations/dialog.js +148 -0
  52. package/dist/components/foundations/drawer.js +129 -0
  53. package/dist/components/foundations/dropdown-menu.js +232 -0
  54. package/dist/components/foundations/field.js +150 -0
  55. package/dist/components/foundations/file-input.js +116 -0
  56. package/dist/components/foundations/form.js +101 -0
  57. package/dist/components/foundations/hover-card.js +41 -0
  58. package/dist/components/foundations/icon-badge.js +41 -0
  59. package/dist/components/foundations/input.js +74 -0
  60. package/dist/components/foundations/label.js +29 -0
  61. package/dist/components/foundations/menubar.js +252 -0
  62. package/dist/components/foundations/navigation-menu.js +171 -0
  63. package/dist/components/foundations/pagination.js +120 -0
  64. package/dist/components/foundations/popover.js +45 -0
  65. package/dist/components/foundations/progress.js +34 -0
  66. package/dist/components/foundations/radio-group.js +134 -0
  67. package/dist/components/foundations/responsive-dialog.js +76 -0
  68. package/dist/components/foundations/scroll-area.js +62 -0
  69. package/dist/components/foundations/select.js +190 -0
  70. package/dist/components/foundations/separator.js +27 -0
  71. package/dist/components/foundations/sheet.js +130 -0
  72. package/dist/components/foundations/skeleton.js +15 -0
  73. package/dist/components/foundations/skip-link.js +27 -0
  74. package/dist/components/foundations/slider.js +81 -0
  75. package/dist/components/foundations/social-icon.js +36 -0
  76. package/dist/components/foundations/sonner.js +49 -0
  77. package/dist/components/foundations/spinner.js +28 -0
  78. package/dist/components/foundations/switch.js +54 -0
  79. package/dist/components/foundations/table.js +115 -0
  80. package/dist/components/foundations/tabs.js +102 -0
  81. package/dist/components/foundations/textarea.js +65 -0
  82. package/dist/components/foundations/toggle-group.js +107 -0
  83. package/dist/components/foundations/toggle.js +44 -0
  84. package/dist/components/foundations/tooltip.js +56 -0
  85. package/dist/components/primitives/admin-header.js +31 -0
  86. package/dist/components/primitives/admin-side-nav.js +135 -0
  87. package/dist/components/primitives/banner-carousel.js +97 -0
  88. package/dist/components/primitives/bottom-tab-bar.js +81 -0
  89. package/dist/components/primitives/bulk-action-bar.js +27 -0
  90. package/dist/components/primitives/category-scroll.js +110 -0
  91. package/dist/components/primitives/category-shortcuts.js +66 -0
  92. package/dist/components/primitives/chat-composer.js +141 -0
  93. package/dist/components/primitives/chip.js +123 -0
  94. package/dist/components/primitives/coach-mark.js +102 -0
  95. package/dist/components/primitives/combobox.js +88 -0
  96. package/dist/components/primitives/container.js +50 -0
  97. package/dist/components/primitives/content-carousel.js +144 -0
  98. package/dist/components/primitives/date-picker.js +175 -0
  99. package/dist/components/primitives/empty-state.js +32 -0
  100. package/dist/components/primitives/error-state.js +115 -0
  101. package/dist/components/primitives/filter-bar.js +144 -0
  102. package/dist/components/primitives/footer.js +247 -0
  103. package/dist/components/primitives/form-field.js +38 -0
  104. package/dist/components/primitives/funnel-shell.js +99 -0
  105. package/dist/components/primitives/header.js +257 -0
  106. package/dist/components/primitives/image-carousel.js +156 -0
  107. package/dist/components/primitives/image-gallery.js +177 -0
  108. package/dist/components/primitives/image-input.js +207 -0
  109. package/dist/components/primitives/image-uploader.js +69 -0
  110. package/dist/components/primitives/kebab-menu.js +40 -0
  111. package/dist/components/primitives/list-item.js +80 -0
  112. package/dist/components/primitives/menu-drawer.js +154 -0
  113. package/dist/components/primitives/multi-select.js +93 -0
  114. package/dist/components/primitives/notification-badge.js +61 -0
  115. package/dist/components/primitives/notification-list.js +72 -0
  116. package/dist/components/primitives/number-input.js +235 -0
  117. package/dist/components/primitives/price-display.js +101 -0
  118. package/dist/components/primitives/progress-steps.js +62 -0
  119. package/dist/components/primitives/search-bar.js +81 -0
  120. package/dist/components/primitives/search-panel.js +43 -0
  121. package/dist/components/primitives/section-header.js +148 -0
  122. package/dist/components/primitives/section-nav.js +85 -0
  123. package/dist/components/primitives/section.js +78 -0
  124. package/dist/components/primitives/share-buttons.js +102 -0
  125. package/dist/components/primitives/side-nav.js +98 -0
  126. package/dist/components/primitives/social-login-button.js +53 -0
  127. package/dist/components/primitives/standard-page-shell.js +34 -0
  128. package/dist/components/primitives/status-count-tabs.js +42 -0
  129. package/dist/components/primitives/sticky-action-bar.js +26 -0
  130. package/dist/components/primitives/sub-nav.js +67 -0
  131. package/dist/components/primitives/tag.js +57 -0
  132. package/dist/components/primitives/timeline.js +55 -0
  133. package/dist/components/primitives/workspace-shell.js +57 -0
  134. package/dist/index.css +1 -1
  135. package/dist/index.js +22961 -13130
  136. package/dist/lib/field-labelling.js +29 -0
  137. package/dist/lib/focus-ring.js +6 -0
  138. package/dist/lib/pagination-range.js +42 -0
  139. package/dist/lib/use-value-length.js +63 -0
  140. package/dist/lib/utils.js +33 -0
  141. package/dist/types/components/foundations/accordion.d.ts +8 -1
  142. package/dist/types/components/foundations/data-table.d.ts +6 -1
  143. package/dist/types/components/foundations/slider.d.ts +13 -1
  144. package/dist/types/components/primitives/admin-header.d.ts +10 -0
  145. package/dist/types/components/primitives/admin-side-nav.d.ts +18 -0
  146. package/dist/types/components/primitives/combobox.d.ts +9 -1
  147. package/dist/types/components/primitives/menu-drawer.d.ts +0 -16
  148. package/dist/types/components/primitives/multi-select.d.ts +9 -1
  149. package/dist/types/lib/field-labelling.d.ts +66 -0
  150. package/package.json +8 -4
  151. package/scripts/codemod/README.md +9 -0
@@ -0,0 +1,207 @@
1
+ import { jsxs as g, jsx as i } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { cva as J } from "class-variance-authority";
4
+ import { Image as _, X as H } from "lucide-react";
5
+ import { cn as h } from "../../lib/utils.js";
6
+ import { Button as X } from "../foundations/button.js";
7
+ import { FieldError as D } from "../foundations/field.js";
8
+ import { FileInput as Q } from "../foundations/file-input.js";
9
+ const N = {
10
+ "image/png": "PNG",
11
+ "image/jpeg": "JPEG",
12
+ "image/jpg": "JPEG",
13
+ "image/gif": "GIF",
14
+ "image/webp": "WebP",
15
+ "image/svg+xml": "SVG",
16
+ "image/avif": "AVIF"
17
+ };
18
+ function B(e) {
19
+ return e.split(",").map((a) => a.trim()).filter(Boolean);
20
+ }
21
+ function Y(e, a) {
22
+ const n = B(a);
23
+ return n.length === 0 ? !0 : n.some((r) => r.endsWith("/*") ? e.type.startsWith(r.replace("/*", "")) : r.startsWith(".") ? e.name.toLowerCase().endsWith(r.toLowerCase()) : e.type === r);
24
+ }
25
+ function Z(e) {
26
+ const a = B(e);
27
+ if (a.length === 0) return "許可された形式";
28
+ const n = /* @__PURE__ */ new Set();
29
+ for (const r of a) {
30
+ if (r === "image/*") {
31
+ n.add("画像");
32
+ continue;
33
+ }
34
+ if (N[r]) {
35
+ n.add(N[r]);
36
+ continue;
37
+ }
38
+ const l = r.match(/^image\/(.+)$/);
39
+ n.add(l ? l[1].toUpperCase() : r.replace(/^\./, "").toUpperCase());
40
+ }
41
+ return Array.from(n).join("、");
42
+ }
43
+ function ee(e) {
44
+ return e >= 1 ? Number.isInteger(e) ? `${e}MB` : `${e.toFixed(1)}MB` : `${Math.round(e * 1024)}KB`;
45
+ }
46
+ const re = J(
47
+ "relative w-full overflow-hidden rounded-lg bg-[var(--Surface-Tertiary)]",
48
+ {
49
+ variants: {
50
+ aspect: {
51
+ square: "aspect-square",
52
+ landscape: "aspect-[1200/630]"
53
+ },
54
+ size: {
55
+ sm: "max-w-[156px]",
56
+ md: "max-w-[380px]",
57
+ lg: "max-w-[568px]"
58
+ }
59
+ },
60
+ defaultVariants: {
61
+ aspect: "square",
62
+ size: "md"
63
+ }
64
+ }
65
+ );
66
+ function ce({
67
+ value: e,
68
+ onChange: a,
69
+ onBlur: n,
70
+ id: r,
71
+ name: l,
72
+ accept: d = "image/png,image/jpeg",
73
+ maxSizeMb: v = 2,
74
+ aspect: F,
75
+ size: L,
76
+ objectFit: U = "cover",
77
+ disabled: u = !1,
78
+ clearable: A = !0,
79
+ error: C,
80
+ onValidationError: P,
81
+ alt: $ = "選択した画像",
82
+ placeholder: R = "画像が選択されていません",
83
+ buttonLabel: T,
84
+ className: G,
85
+ "aria-describedby": O
86
+ }) {
87
+ const V = s.useId(), b = r ?? V, w = `${b}-error`, [W, m] = s.useState(null), [k, x] = s.useState(null), [z, j] = s.useState(0), p = e != null && typeof e != "string" ? e : null;
88
+ s.useEffect(() => {
89
+ if (!p) {
90
+ x(null);
91
+ return;
92
+ }
93
+ const t = URL.createObjectURL(p);
94
+ return x(t), () => {
95
+ URL.revokeObjectURL(t);
96
+ };
97
+ }, [p]);
98
+ const I = typeof e == "string" && e !== "" ? e : k, f = C ?? W ?? null, c = I != null, y = (t, o, E) => {
99
+ j((K) => K + 1), m(E), P?.({ code: t, file: o, message: E });
100
+ }, M = (t) => {
101
+ const o = t[0];
102
+ if (o) {
103
+ if (!Y(o, d)) {
104
+ y(
105
+ "accept",
106
+ o,
107
+ `画像形式は${Z(d)}のみアップロードできます。`
108
+ );
109
+ return;
110
+ }
111
+ m(null), a(o);
112
+ }
113
+ }, S = () => {
114
+ j((t) => t + 1), m(null), a(null);
115
+ }, q = (t) => {
116
+ t.currentTarget.contains(t.relatedTarget) || n?.();
117
+ };
118
+ return /* @__PURE__ */ g(
119
+ "div",
120
+ {
121
+ "data-slot": "image-input",
122
+ "data-disabled": u || void 0,
123
+ className: h("flex min-w-0 flex-col gap-2", G),
124
+ onBlur: q,
125
+ children: [
126
+ /* @__PURE__ */ g(
127
+ "div",
128
+ {
129
+ "data-slot": "image-input-preview",
130
+ className: h(
131
+ re({ aspect: F, size: L }),
132
+ c ? "border border-[var(--Border-Low-Emphasis)]" : (
133
+ // 未選択の破線枠は地(Surface-Tertiary)とのコントラストを確保するため High-Emphasis。
134
+ // Medium-Emphasis はダークモードで地と同値になり枠が消える
135
+ "border-2 border-dashed border-[var(--Border-High-Emphasis)]"
136
+ )
137
+ ),
138
+ children: [
139
+ c ? /* @__PURE__ */ i(
140
+ "img",
141
+ {
142
+ src: I ?? void 0,
143
+ alt: $,
144
+ className: h(
145
+ "absolute inset-0 size-full",
146
+ U === "contain" ? "object-contain" : "object-cover"
147
+ )
148
+ }
149
+ ) : /* @__PURE__ */ g("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-1 px-4 text-center", children: [
150
+ /* @__PURE__ */ i(
151
+ _,
152
+ {
153
+ className: "size-6 text-[var(--Object-Medium-Emphasis)]",
154
+ "aria-hidden": "true"
155
+ }
156
+ ),
157
+ /* @__PURE__ */ i("span", { className: "typo-body-xs text-[var(--Text-Low-Emphasis)]", children: R })
158
+ ] }),
159
+ c && A && !u && /* @__PURE__ */ i(
160
+ X,
161
+ {
162
+ type: "button",
163
+ variant: "overlay",
164
+ size: "icon-sm",
165
+ className: "absolute right-2 top-2 rounded-full",
166
+ "aria-label": "画像を削除",
167
+ onClick: S,
168
+ children: /* @__PURE__ */ i(H, { className: "size-4", "aria-hidden": "true" })
169
+ }
170
+ )
171
+ ]
172
+ }
173
+ ),
174
+ /* @__PURE__ */ i(
175
+ Q,
176
+ {
177
+ id: b,
178
+ name: l,
179
+ accept: d,
180
+ maxSize: v * 1024 * 1024,
181
+ disabled: u,
182
+ buttonLabel: T ?? (c ? "画像を変更" : "画像を選択"),
183
+ placeholder: "",
184
+ value: [],
185
+ onFilesChange: M,
186
+ onError: (t) => y(
187
+ "max-size",
188
+ t.file,
189
+ `画像サイズは${ee(v)}以下にしてください。`
190
+ ),
191
+ "aria-invalid": f ? !0 : void 0,
192
+ "aria-describedby": [O, f ? w : null].filter(Boolean).join(" ") || void 0
193
+ },
194
+ z
195
+ ),
196
+ /* @__PURE__ */ i(D, { id: w, children: f })
197
+ ]
198
+ }
199
+ );
200
+ }
201
+ export {
202
+ ce as ImageInput,
203
+ Z as formatAcceptedFormats,
204
+ ee as formatMaxSize,
205
+ re as imageInputPreviewVariants,
206
+ Y as isAcceptedImageType
207
+ };
@@ -0,0 +1,69 @@
1
+ import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as m } from "../../lib/utils.js";
4
+ import p from "iconsax-reactjs/dist/esm/Add.js";
5
+ import u from "iconsax-reactjs/dist/esm/Trash.js";
6
+ function g({
7
+ images: i = [],
8
+ onAdd: s,
9
+ onRemove: l,
10
+ maxImages: o = 10,
11
+ columns: c = 4,
12
+ className: n
13
+ }) {
14
+ const d = i.length < o;
15
+ return /* @__PURE__ */ t(
16
+ "div",
17
+ {
18
+ className: m("grid gap-3", n),
19
+ style: {
20
+ gridTemplateColumns: `repeat(${Math.min(c, 4)}, minmax(0, 1fr))`
21
+ },
22
+ "data-slot": "image-uploader",
23
+ children: [
24
+ i.map((r, a) => /* @__PURE__ */ t(
25
+ "div",
26
+ {
27
+ className: "relative aspect-square rounded-xl bg-[var(--Surface-Tertiary)] border border-[var(--Border-Low-Emphasis)] overflow-hidden group",
28
+ children: [
29
+ /* @__PURE__ */ e(
30
+ "img",
31
+ {
32
+ src: r.src,
33
+ alt: r.alt,
34
+ className: "absolute inset-0 size-full object-cover"
35
+ }
36
+ ),
37
+ /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-[var(--Primitive-Black-alpha-1000)]/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center", children: /* @__PURE__ */ e(
38
+ "button",
39
+ {
40
+ className: "size-8 rounded-full bg-[var(--Primitive-White-alpha-1000)]/80 flex items-center justify-center",
41
+ "aria-label": `${r.alt}を削除`,
42
+ onClick: () => l?.(a),
43
+ children: /* @__PURE__ */ e(u, { size: 16, className: "text-[var(--Text-Caution)]" })
44
+ }
45
+ ) }),
46
+ /* @__PURE__ */ e("div", { className: "absolute top-1 left-1 size-5 rounded bg-[var(--Primitive-Black-alpha-1000)]/60 text-[var(--Primitive-White-alpha-1000)] flex items-center justify-center typo-label-xs", children: a + 1 })
47
+ ]
48
+ },
49
+ a
50
+ )),
51
+ d && /* @__PURE__ */ t(
52
+ "button",
53
+ {
54
+ className: "aspect-square rounded-xl border-2 border-dashed border-[var(--Border-Medium-Emphasis)] flex flex-col items-center justify-center gap-1 hover:border-[var(--Border-Accent-Primary)] hover:bg-[var(--Surface-Accent-Primary-Light)] transition-colors",
55
+ onClick: s,
56
+ "aria-label": "画像を追加",
57
+ children: [
58
+ /* @__PURE__ */ e(p, { size: 24, className: "text-[var(--Text-Low-Emphasis)]" }),
59
+ /* @__PURE__ */ e("span", { className: "typo-label-xs text-[var(--Text-Low-Emphasis)]", children: "追加" })
60
+ ]
61
+ }
62
+ )
63
+ ]
64
+ }
65
+ );
66
+ }
67
+ export {
68
+ g as ImageUploader
69
+ };
@@ -0,0 +1,40 @@
1
+ import { jsxs as n, jsx as r } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as o } from "../../lib/utils.js";
4
+ import { DropdownMenu as i, DropdownMenuTrigger as l, DropdownMenuContent as s, DropdownMenuItem as c } from "../foundations/dropdown-menu.js";
5
+ import d from "iconsax-reactjs/dist/esm/More.js";
6
+ function f({ items: a, className: t }) {
7
+ return /* @__PURE__ */ n(i, { children: [
8
+ /* @__PURE__ */ r(l, { asChild: !0, children: /* @__PURE__ */ r(
9
+ "button",
10
+ {
11
+ className: o(
12
+ // shrink-0 必須: 長いタイトルと同じ flex row に並ぶため、既定の flex-shrink:1 だと 32px が潰れる
13
+ "flex items-center justify-center size-8 shrink-0 rounded-md hover:bg-[var(--Surface-Secondary)] transition-colors",
14
+ t
15
+ ),
16
+ "aria-label": "メニュー",
17
+ "data-slot": "kebab-menu",
18
+ children: /* @__PURE__ */ r(d, { size: 16, className: "text-[var(--Text-Low-Emphasis)]" })
19
+ }
20
+ ) }),
21
+ /* @__PURE__ */ r(s, { align: "end", children: a.map((e) => /* @__PURE__ */ n(
22
+ c,
23
+ {
24
+ onClick: e.onClick,
25
+ className: o(
26
+ "gap-2",
27
+ e.destructive && "text-[var(--Text-Caution)]"
28
+ ),
29
+ children: [
30
+ e.icon,
31
+ e.label
32
+ ]
33
+ },
34
+ e.label
35
+ )) })
36
+ ] });
37
+ }
38
+ export {
39
+ f as KebabMenu
40
+ };
@@ -0,0 +1,80 @@
1
+ import { jsxs as x, Fragment as D, jsx as e } from "react/jsx-runtime";
2
+ import * as L from "react";
3
+ import K from "iconsax-reactjs/dist/esm/ArrowRight2.js";
4
+ import F from "iconsax-reactjs/dist/esm/ArrowDown2.js";
5
+ import { Switch as O } from "../foundations/switch.js";
6
+ import { cn as g } from "../../lib/utils.js";
7
+ function q({
8
+ title: p,
9
+ caption: o,
10
+ rightType: i = "arrow-right",
11
+ rightText: d,
12
+ badgeCount: m,
13
+ toggleChecked: y = !1,
14
+ onToggleChange: w,
15
+ leftIcon: l,
16
+ leftImageUrl: n,
17
+ size: N = "sm",
18
+ selected: k = !1,
19
+ showBorder: h = !0,
20
+ showBadgeDot: E = !1,
21
+ href: c,
22
+ className: S,
23
+ ...s
24
+ }) {
25
+ const u = L.useId(), t = o ? "md" : !!(l || n) ? "lg" : N, v = !!c, r = !v && typeof s.onClick == "function", j = v || r, C = r ? (a) => {
26
+ s.onKeyDown?.(a), !a.defaultPrevented && (a.key === "Enter" || a.key === " ") && (a.preventDefault(), a.currentTarget.click());
27
+ } : s.onKeyDown, z = t === "lg" ? "min-h-16 py-4" : t === "md" ? "min-h-14 py-2" : "min-h-11 py-2", H = t === "lg" ? "typo-body-lg text-[var(--Text-High-Emphasis)]" : "typo-body-md text-[var(--Text-High-Emphasis)]", f = g(
28
+ "relative flex w-full items-center gap-2 bg-[var(--Surface-Primary)] px-4 rounded-lg",
29
+ z,
30
+ k && "bg-[var(--Surface-Secondary)]",
31
+ j && "transition-colors hover:bg-[var(--Surface-Tertiary)]",
32
+ r && "cursor-pointer focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50",
33
+ S
34
+ ), b = /* @__PURE__ */ x(D, { children: [
35
+ n && /* @__PURE__ */ e("div", { className: "relative shrink-0 size-8 overflow-hidden rounded-[var(--radius-sm,4px)]", children: /* @__PURE__ */ e("img", { src: n, alt: "", className: "size-full object-cover" }) }),
36
+ l && !n && /* @__PURE__ */ e("div", { className: "shrink-0 size-5 flex items-center justify-center text-[var(--Object-High-Emphasis)]", children: l }),
37
+ /* @__PURE__ */ x("div", { className: "flex flex-1 min-w-0 flex-col gap-0", children: [
38
+ /* @__PURE__ */ e("span", { id: u, className: g("truncate", H), children: p }),
39
+ o && /* @__PURE__ */ e("span", { className: "truncate typo-body-sm text-[var(--Text-Medium-Emphasis)]", children: o })
40
+ ] }),
41
+ i === "arrow-right" && /* @__PURE__ */ e(K, { size: 20, className: "shrink-0 text-[var(--Object-Low-Emphasis)]" }),
42
+ i === "arrow-down" && /* @__PURE__ */ e(F, { size: 20, className: "shrink-0 text-[var(--Object-Low-Emphasis)]" }),
43
+ i === "text" && d && /* @__PURE__ */ e("span", { className: "shrink-0 typo-body-md text-[var(--Text-High-Emphasis)]", children: d }),
44
+ i === "badge" && m !== void 0 && /* @__PURE__ */ e("span", { className: "flex shrink-0 h-[13px] min-w-[13px] items-center justify-center rounded-full bg-[var(--Surface-Caution,#ec0000)] px-1 typo-label-xs text-white", children: m }),
45
+ i === "toggle" && /* @__PURE__ */ e(
46
+ O,
47
+ {
48
+ checked: y,
49
+ onCheckedChange: w,
50
+ "aria-labelledby": u,
51
+ className: "shrink-0"
52
+ }
53
+ ),
54
+ E && /* @__PURE__ */ e("span", { className: "absolute left-1 top-1/2 -translate-y-1/2 size-2 rounded-full bg-[var(--Surface-Caution,#ec0000)]", "aria-hidden": !0 }),
55
+ h && t !== "lg" && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-4 right-4 h-px bg-[var(--Surface-Secondary)]", "aria-hidden": !0 }),
56
+ h && t === "lg" && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-4 right-4 h-px bg-[var(--Border-Medium-Emphasis)]", "aria-hidden": !0 })
57
+ ] });
58
+ return c ? /* @__PURE__ */ e(
59
+ "a",
60
+ {
61
+ href: c,
62
+ ...s,
63
+ className: "block rounded-lg focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50",
64
+ children: /* @__PURE__ */ e("div", { className: f, children: b })
65
+ }
66
+ ) : /* @__PURE__ */ e(
67
+ "div",
68
+ {
69
+ className: f,
70
+ ...s,
71
+ role: r ? "button" : s.role,
72
+ tabIndex: r ? 0 : s.tabIndex,
73
+ onKeyDown: C,
74
+ children: b
75
+ }
76
+ );
77
+ }
78
+ export {
79
+ q as ListItem
80
+ };
@@ -0,0 +1,154 @@
1
+ import { jsxs as l, jsx as e, Fragment as t } from "react/jsx-runtime";
2
+ import * as w from "react";
3
+ import k from "iconsax-reactjs/dist/esm/ArrowDown2.js";
4
+ import E from "iconsax-reactjs/dist/esm/ArrowRight2.js";
5
+ import z from "iconsax-reactjs/dist/esm/ArrowUp2.js";
6
+ import j from "iconsax-reactjs/dist/esm/Add.js";
7
+ import { X as T } from "lucide-react";
8
+ import { cn as S } from "../../lib/utils.js";
9
+ import { Button as m } from "../foundations/button.js";
10
+ const f = "flex min-h-12 items-center gap-1 mx-2 rounded-lg px-2 py-3 typo-body-md text-[var(--Text-High-Emphasis)] transition-colors duration-[var(--Motion-Duration-Base)] ease-[var(--Motion-Easing-Standard)] hover:bg-[var(--Surface-Secondary)] active:bg-[var(--Surface-Tertiary)]";
11
+ function P({
12
+ userName: r,
13
+ isLoggedIn: n = !1,
14
+ hideLoginLink: x = !1,
15
+ sections: u,
16
+ banners: c,
17
+ onClose: d,
18
+ onLogin: o,
19
+ loginHref: v = "/security/login_link/",
20
+ className: N,
21
+ ...b
22
+ }) {
23
+ const [h, y] = w.useState(
24
+ /* @__PURE__ */ new Set()
25
+ ), g = (a) => {
26
+ y((i) => {
27
+ const s = new Set(i);
28
+ return s.has(a) ? s.delete(a) : s.add(a), s;
29
+ });
30
+ };
31
+ return /* @__PURE__ */ l(
32
+ "div",
33
+ {
34
+ "data-slot": "menu-drawer",
35
+ className: S(
36
+ "flex h-full w-80 flex-col bg-[var(--Surface-Primary)]",
37
+ N
38
+ ),
39
+ ...b,
40
+ children: [
41
+ (n || d) && /* @__PURE__ */ l("div", { className: "flex items-center justify-between px-4 py-3", children: [
42
+ n ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ l("p", { className: "typo-label-md text-[var(--Text-High-Emphasis)]", children: [
43
+ r ?? "ゲスト",
44
+ "さま"
45
+ ] }) }) : /* @__PURE__ */ e("div", {}),
46
+ d && /* @__PURE__ */ e(
47
+ m,
48
+ {
49
+ variant: "ghost",
50
+ size: "icon-sm",
51
+ onClick: d,
52
+ "aria-label": "メニューを閉じる",
53
+ children: /* @__PURE__ */ e(T, { className: "size-5" })
54
+ }
55
+ )
56
+ ] }),
57
+ !n && !x && /* @__PURE__ */ l(t, { children: [
58
+ /* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("ul", { children: /* @__PURE__ */ e("li", { children: /* @__PURE__ */ l(
59
+ "a",
60
+ {
61
+ href: v,
62
+ onClick: o ? (a) => {
63
+ a.preventDefault(), o();
64
+ } : void 0,
65
+ className: f,
66
+ children: [
67
+ /* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center text-[var(--Text-Medium-Emphasis)]", children: /* @__PURE__ */ e(j, { size: 16 }) }),
68
+ /* @__PURE__ */ e("span", { className: "flex-1", children: "ログイン・新規会員登録" })
69
+ ]
70
+ }
71
+ ) }) }) }),
72
+ /* @__PURE__ */ e("div", { className: "h-px w-full bg-[var(--Border-Low-Emphasis)]" })
73
+ ] }),
74
+ /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto", children: [
75
+ u.map((a, i) => /* @__PURE__ */ l("div", { children: [
76
+ a.border && /* @__PURE__ */ e("div", { className: "h-px w-full bg-[var(--Border-Low-Emphasis)]" }),
77
+ /* @__PURE__ */ l("div", { className: "py-2", children: [
78
+ a.title && /* @__PURE__ */ e("div", { className: "px-4 pb-1 pt-2", children: /* @__PURE__ */ l("p", { className: "flex items-center gap-1 typo-label-md font-bold text-[var(--Text-High-Emphasis)]", children: [
79
+ a.icon && /* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center", children: a.icon }),
80
+ /* @__PURE__ */ e("span", { children: a.title })
81
+ ] }) }),
82
+ /* @__PURE__ */ e("ul", { children: a.items.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(p, { item: s }) }, s.label)) }),
83
+ a.itemsExtra && a.itemsExtra.length > 0 && /* @__PURE__ */ l(t, { children: [
84
+ h.has(i) && /* @__PURE__ */ e("ul", { children: a.itemsExtra.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(p, { item: s }) }, s.label)) }),
85
+ /* @__PURE__ */ e(
86
+ m,
87
+ {
88
+ variant: "ghost",
89
+ className: "flex w-full items-center justify-center gap-1 rounded-none px-4 py-3 typo-label-md text-[var(--Text-Accent-Primary)]",
90
+ onClick: () => g(i),
91
+ children: h.has(i) ? /* @__PURE__ */ l(t, { children: [
92
+ /* @__PURE__ */ e("span", { children: "折りたたむ" }),
93
+ /* @__PURE__ */ e(z, { size: 16 })
94
+ ] }) : /* @__PURE__ */ l(t, { children: [
95
+ /* @__PURE__ */ e("span", { children: "すべて表示" }),
96
+ /* @__PURE__ */ e(k, { size: 16 })
97
+ ] })
98
+ }
99
+ )
100
+ ] })
101
+ ] })
102
+ ] }, i)),
103
+ c && c.length > 0 && /* @__PURE__ */ e("div", { className: "px-6 py-6", children: /* @__PURE__ */ e("ul", { className: "flex justify-center", children: c.map((a, i) => /* @__PURE__ */ e("li", { className: "w-1/2 max-w-28 px-2", children: /* @__PURE__ */ e(
104
+ "a",
105
+ {
106
+ href: a.href ?? "#",
107
+ className: "block overflow-hidden rounded",
108
+ children: /* @__PURE__ */ e(
109
+ "img",
110
+ {
111
+ loading: "lazy",
112
+ src: a.imageUrl,
113
+ alt: a.alt,
114
+ className: "h-auto w-full object-cover"
115
+ }
116
+ )
117
+ }
118
+ ) }, i)) }) })
119
+ ] })
120
+ ]
121
+ }
122
+ );
123
+ }
124
+ function p({ item: r }) {
125
+ return /* @__PURE__ */ l(
126
+ "a",
127
+ {
128
+ href: r.href ?? "#",
129
+ onClick: r.onClick,
130
+ className: f,
131
+ children: [
132
+ r.thumb && /* @__PURE__ */ e("picture", { className: "relative mr-1 block size-9 shrink-0 overflow-hidden rounded", children: /* @__PURE__ */ e(
133
+ "img",
134
+ {
135
+ loading: "lazy",
136
+ src: r.thumb,
137
+ alt: "",
138
+ className: "absolute inset-0 size-full object-cover"
139
+ }
140
+ ) }),
141
+ !r.thumb && r.icon && /* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center text-[var(--Text-Medium-Emphasis)]", children: r.icon }),
142
+ /* @__PURE__ */ l("span", { className: "flex flex-1 items-center gap-1", children: [
143
+ /* @__PURE__ */ e("span", { className: "flex-1", children: r.label }),
144
+ r.badge && /* @__PURE__ */ e("span", { className: "rounded-full bg-[var(--Brand-Cake-Orange)] px-2 py-0.5 typo-label-xs text-[var(--Text-on-Inverse)]", children: r.badge }),
145
+ r.subText && /* @__PURE__ */ e("span", { className: "typo-body-sm text-[var(--Text-Low-Emphasis)]", children: r.subText })
146
+ ] }),
147
+ r.hasChildren && /* @__PURE__ */ e(E, { size: 16, className: "shrink-0 text-[var(--Object-High-Emphasis)]" })
148
+ ]
149
+ }
150
+ );
151
+ }
152
+ export {
153
+ P as MenuDrawer
154
+ };
@@ -0,0 +1,93 @@
1
+ import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
+ import * as E from "react";
3
+ import { ChevronsUpDown as P, Check as S } from "lucide-react";
4
+ import { cn as b } from "../../lib/utils.js";
5
+ import { Button as k } from "../foundations/button.js";
6
+ import { Command as O, CommandInput as T, CommandList as A, CommandEmpty as F, CommandGroup as I, CommandItem as M } from "../foundations/command.js";
7
+ import { Popover as R, PopoverTrigger as B, PopoverContent as G } from "../foundations/popover.js";
8
+ import { useFieldLabelling as H, resolveFieldAria as U } from "../../lib/field-labelling.js";
9
+ import { Chip as $ } from "./chip.js";
10
+ function W({
11
+ options: d,
12
+ value: l = [],
13
+ onValueChange: f,
14
+ placeholder: n = "選択してください",
15
+ searchPlaceholder: v = "検索",
16
+ emptyLabel: g = "候補がありません",
17
+ disabled: m,
18
+ className: x,
19
+ id: o,
20
+ "aria-invalid": y,
21
+ "aria-describedby": c,
22
+ "aria-label": t,
23
+ "aria-labelledby": s
24
+ }) {
25
+ const [p, C] = E.useState(!1), i = d.filter((e) => l.includes(e.value)), h = H(), w = U(
26
+ {
27
+ id: o,
28
+ "aria-label": t,
29
+ "aria-labelledby": s,
30
+ "aria-describedby": c
31
+ },
32
+ h
33
+ ), N = !h && !t && !s ? n : void 0, u = (e) => f?.(l.includes(e) ? l.filter((j) => j !== e) : [...l, e]);
34
+ return /* @__PURE__ */ r("div", { "data-slot": "multi-select", className: b("flex flex-col gap-2", x), children: [
35
+ /* @__PURE__ */ r(R, { open: p, onOpenChange: C, children: [
36
+ /* @__PURE__ */ a(B, { asChild: !0, children: /* @__PURE__ */ r(
37
+ k,
38
+ {
39
+ type: "button",
40
+ variant: "tertiary",
41
+ role: "combobox",
42
+ id: o,
43
+ "aria-expanded": p,
44
+ "aria-haspopup": "listbox",
45
+ "aria-invalid": y,
46
+ "aria-describedby": c,
47
+ "aria-label": t ?? N,
48
+ "aria-labelledby": s,
49
+ ...w,
50
+ disabled: m,
51
+ className: "w-full justify-between bg-[var(--Surface-Primary)]",
52
+ children: [
53
+ /* @__PURE__ */ a("span", { className: i.length ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]", children: i.length ? `${i.length}件選択中` : n }),
54
+ /* @__PURE__ */ a(P, { "aria-hidden": "true", className: "text-[var(--Object-Medium-Emphasis)]" })
55
+ ]
56
+ }
57
+ ) }),
58
+ /* @__PURE__ */ a(G, { align: "start", className: "w-[var(--radix-popover-trigger-width)] p-0", children: /* @__PURE__ */ r(O, { children: [
59
+ /* @__PURE__ */ a(T, { placeholder: v }),
60
+ /* @__PURE__ */ r(A, { children: [
61
+ /* @__PURE__ */ a(F, { children: g }),
62
+ /* @__PURE__ */ a(I, { children: d.map((e) => /* @__PURE__ */ r(
63
+ M,
64
+ {
65
+ value: [e.label, ...e.keywords ?? []].join(" "),
66
+ disabled: e.disabled,
67
+ onSelect: () => u(e.value),
68
+ children: [
69
+ /* @__PURE__ */ a(S, { "aria-hidden": "true", className: b(l.includes(e.value) ? "opacity-100" : "opacity-0") }),
70
+ e.label,
71
+ l.includes(e.value) && /* @__PURE__ */ a("span", { className: "sr-only", children: "選択済み" })
72
+ ]
73
+ },
74
+ e.value
75
+ )) })
76
+ ] })
77
+ ] }) })
78
+ ] }),
79
+ i.length > 0 && /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-1.5", role: "group", "aria-label": "選択済み", children: i.map((e) => /* @__PURE__ */ a(
80
+ $,
81
+ {
82
+ removable: !0,
83
+ onRemove: () => u(e.value),
84
+ disabled: m,
85
+ children: e.label
86
+ },
87
+ e.value
88
+ )) })
89
+ ] });
90
+ }
91
+ export {
92
+ W as MultiSelect
93
+ };