@cakejp/design-system 0.16.0 → 0.17.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 (181) hide show
  1. package/CHANGELOG.md +49 -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/ec/_mypage-menu-data.d.ts +3 -3
  142. package/dist/types/components/ec/admin-shell.d.ts +1 -1
  143. package/dist/types/components/ec/anniversary-card.d.ts +1 -1
  144. package/dist/types/components/ec/mypage-shell.d.ts +3 -3
  145. package/dist/types/components/ec/product-card.d.ts +1 -1
  146. package/dist/types/components/ec/product-carousel.d.ts +3 -3
  147. package/dist/types/components/ec/stat-card.d.ts +1 -1
  148. package/dist/types/components/foundations/accordion.d.ts +8 -1
  149. package/dist/types/components/foundations/alert-dialog.d.ts +1 -1
  150. package/dist/types/components/foundations/calendar.d.ts +1 -1
  151. package/dist/types/components/foundations/checkbox-group.d.ts +1 -1
  152. package/dist/types/components/foundations/command.d.ts +1 -1
  153. package/dist/types/components/foundations/data-table.d.ts +6 -1
  154. package/dist/types/components/foundations/field.d.ts +2 -2
  155. package/dist/types/components/foundations/file-input.d.ts +1 -1
  156. package/dist/types/components/foundations/pagination.d.ts +1 -1
  157. package/dist/types/components/foundations/responsive-dialog.d.ts +1 -1
  158. package/dist/types/components/foundations/skip-link.d.ts +1 -1
  159. package/dist/types/components/foundations/slider.d.ts +13 -1
  160. package/dist/types/components/primitives/admin-header.d.ts +11 -1
  161. package/dist/types/components/primitives/admin-side-nav.d.ts +19 -1
  162. package/dist/types/components/primitives/banner-carousel.d.ts +2 -2
  163. package/dist/types/components/primitives/category-scroll.d.ts +2 -2
  164. package/dist/types/components/primitives/category-shortcuts.d.ts +1 -1
  165. package/dist/types/components/primitives/chat-composer.d.ts +1 -1
  166. package/dist/types/components/primitives/chip.d.ts +1 -1
  167. package/dist/types/components/primitives/combobox.d.ts +9 -1
  168. package/dist/types/components/primitives/content-carousel.d.ts +1 -1
  169. package/dist/types/components/primitives/form-field.d.ts +1 -1
  170. package/dist/types/components/primitives/image-input.d.ts +1 -1
  171. package/dist/types/components/primitives/kebab-menu.d.ts +1 -1
  172. package/dist/types/components/primitives/menu-drawer.d.ts +0 -16
  173. package/dist/types/components/primitives/multi-select.d.ts +9 -1
  174. package/dist/types/components/primitives/notification-list.d.ts +1 -1
  175. package/dist/types/components/primitives/search-panel.d.ts +1 -1
  176. package/dist/types/components/primitives/section-nav.d.ts +1 -1
  177. package/dist/types/components/primitives/side-nav.d.ts +1 -1
  178. package/dist/types/components/primitives/social-login-button.d.ts +1 -1
  179. package/dist/types/lib/field-labelling.d.ts +66 -0
  180. package/package.json +2 -2
  181. package/scripts/codemod/README.md +9 -0
@@ -0,0 +1,97 @@
1
+ import { jsxs as r, jsx as a, Fragment as x } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as e } from "../../lib/utils.js";
4
+ import { SectionHeader as f } from "./section-header.js";
5
+ const c = {
6
+ sm: "w-[48vw] @md:w-[180px]",
7
+ md: "w-[70vw] @md:w-[260px]",
8
+ lg: "w-[85vw] @md:w-[320px]"
9
+ }, w = {
10
+ "16/9": "aspect-[16/9]",
11
+ "1/1": "aspect-[1/1]",
12
+ "4/3": "aspect-[4/3]",
13
+ "3/4": "aspect-[3/4]"
14
+ };
15
+ function j({
16
+ title: n,
17
+ subtitle: i,
18
+ moreHref: d,
19
+ moreLabel: p,
20
+ headerSize: m,
21
+ items: h,
22
+ aspectRatio: u = "16/9",
23
+ bannerSize: l = "md",
24
+ className: v
25
+ }) {
26
+ return /* @__PURE__ */ r(
27
+ "section",
28
+ {
29
+ "data-slot": "banner-carousel",
30
+ className: e("py-4", v),
31
+ children: [
32
+ /* @__PURE__ */ a(
33
+ f,
34
+ {
35
+ title: n,
36
+ subtitle: i,
37
+ moreHref: d,
38
+ moreLabel: p,
39
+ size: m,
40
+ className: "px-4"
41
+ }
42
+ ),
43
+ /* @__PURE__ */ r("div", { className: "flex gap-3 overflow-x-auto px-4 pb-2 scrollbar-hide mt-3", children: [
44
+ h.map((s, o) => {
45
+ const t = /* @__PURE__ */ r(x, { children: [
46
+ /* @__PURE__ */ a(
47
+ "div",
48
+ {
49
+ className: e(
50
+ "overflow-hidden rounded-lg",
51
+ w[u]
52
+ ),
53
+ children: /* @__PURE__ */ a(
54
+ "img",
55
+ {
56
+ src: s.imageUrl,
57
+ alt: s.alt,
58
+ className: "h-full w-full object-cover"
59
+ }
60
+ )
61
+ }
62
+ ),
63
+ s.label && /* @__PURE__ */ a("p", { className: "typo-label-sm text-[var(--Text-High-Emphasis)] mt-1.5", children: s.label }),
64
+ s.sublabel && /* @__PURE__ */ a("p", { className: "typo-body-xs text-[var(--Text-Medium-Emphasis)]", children: s.sublabel })
65
+ ] });
66
+ return s.href ? /* @__PURE__ */ a(
67
+ "a",
68
+ {
69
+ href: s.href,
70
+ className: e(
71
+ "group shrink-0",
72
+ c[l]
73
+ ),
74
+ children: /* @__PURE__ */ a("div", { className: "transition-opacity duration-[var(--Motion-Duration-Fast)] group-hover:opacity-80", children: t })
75
+ },
76
+ o
77
+ ) : /* @__PURE__ */ a(
78
+ "div",
79
+ {
80
+ className: e(
81
+ "shrink-0",
82
+ c[l]
83
+ ),
84
+ children: t
85
+ },
86
+ o
87
+ );
88
+ }),
89
+ /* @__PURE__ */ a("div", { className: "shrink-0 w-4", "aria-hidden": "true" })
90
+ ] })
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ export {
96
+ j as BannerCarousel
97
+ };
@@ -0,0 +1,81 @@
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as a } from "../../lib/utils.js";
4
+ import { NotificationBadge as d } from "./notification-badge.js";
5
+ function x({
6
+ className: n,
7
+ items: s,
8
+ banner: t,
9
+ ...i
10
+ }) {
11
+ return /* @__PURE__ */ o(
12
+ "nav",
13
+ {
14
+ "data-slot": "bottom-tab-bar",
15
+ "aria-label": "メインナビゲーション",
16
+ className: a(
17
+ "fixed inset-x-0 bottom-0 z-[var(--Z-Floating)] border-t border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Primary)] pb-[env(safe-area-inset-bottom)] @md:hidden",
18
+ n
19
+ ),
20
+ ...i,
21
+ children: [
22
+ t && /* @__PURE__ */ e(
23
+ "div",
24
+ {
25
+ "data-slot": "bottom-tab-bar-banner",
26
+ className: "border-b border-[var(--Border-Low-Emphasis)]",
27
+ children: t
28
+ }
29
+ ),
30
+ /* @__PURE__ */ e("div", { className: "flex h-[52px] items-center justify-around px-1 @sm:px-4", children: s.map((r) => {
31
+ const c = r.href ? "a" : "button", l = r.href ? { href: r.href } : { type: "button", onClick: r.onClick };
32
+ return /* @__PURE__ */ o(
33
+ c,
34
+ {
35
+ className: a(
36
+ "relative flex flex-1 flex-col items-center gap-0.5 pb-1 pt-0.5 transition-colors min-w-0",
37
+ r.isActive ? "text-[var(--Text-Accent-Primary)]" : "text-[var(--Text-High-Emphasis)]"
38
+ ),
39
+ "aria-current": r.isActive ? "page" : void 0,
40
+ ...l,
41
+ children: [
42
+ /* @__PURE__ */ e(
43
+ "span",
44
+ {
45
+ className: a(
46
+ "relative flex h-7 w-14 shrink-0 items-center justify-center rounded-full overflow-visible transition-colors",
47
+ r.isActive && "bg-[var(--Surface-Accent-Primary-Light)]"
48
+ ),
49
+ children: /* @__PURE__ */ e(
50
+ d,
51
+ {
52
+ count: r.badgeCount,
53
+ size: "md",
54
+ hidden: r.badgeCount == null || r.badgeCount <= 0,
55
+ children: r.isActive && r.activeIcon ? r.activeIcon : r.icon
56
+ }
57
+ )
58
+ }
59
+ ),
60
+ /* @__PURE__ */ e(
61
+ "span",
62
+ {
63
+ className: a(
64
+ "truncate max-w-full px-0.5 text-center",
65
+ r.isActive ? "typo-label-xs" : "typo-body-xs"
66
+ ),
67
+ children: r.label
68
+ }
69
+ )
70
+ ]
71
+ },
72
+ r.label
73
+ );
74
+ }) })
75
+ ]
76
+ }
77
+ );
78
+ }
79
+ export {
80
+ x as BottomTabBar
81
+ };
@@ -0,0 +1,27 @@
1
+ import { jsxs as a } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as e } from "../../lib/utils.js";
4
+ function c({ selectedCount: r, children: t, className: i }) {
5
+ return /* @__PURE__ */ a(
6
+ "div",
7
+ {
8
+ "data-slot": "bulk-action-bar",
9
+ className: e(
10
+ "flex items-center gap-3 rounded-lg bg-[var(--Surface-Accent-Primary-Light)] px-4 py-3",
11
+ i
12
+ ),
13
+ role: "toolbar",
14
+ "aria-label": `${r}件を選択中`,
15
+ children: [
16
+ /* @__PURE__ */ a("span", { className: "typo-label-md text-[var(--Text-High-Emphasis)] shrink-0", children: [
17
+ r,
18
+ "件を選択中"
19
+ ] }),
20
+ t
21
+ ]
22
+ }
23
+ );
24
+ }
25
+ export {
26
+ c as BulkActionBar
27
+ };
@@ -0,0 +1,110 @@
1
+ import { jsxs as l, jsx as a, Fragment as w } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as s } from "../../lib/utils.js";
4
+ import { SectionHeader as v } from "./section-header.js";
5
+ const N = {
6
+ sm: "size-[60px]",
7
+ md: "size-[100px]",
8
+ lg: "size-[120px]"
9
+ }, y = {
10
+ sm: "max-w-[60px]",
11
+ md: "max-w-[100px]",
12
+ lg: "max-w-[120px]"
13
+ }, C = {
14
+ sm: "calc((100vw - 32px) / 4.05)",
15
+ md: "calc((100vw - 32px) / 3.5)",
16
+ lg: "calc((100vw - 32px) / 3.0)"
17
+ };
18
+ function A({
19
+ title: m,
20
+ moreHref: d,
21
+ headerSize: x = "lg",
22
+ items: r,
23
+ thumbnailSize: c = "md",
24
+ thumbnailShape: n = "square",
25
+ layout: h = "scroll",
26
+ gridRows: g = 3,
27
+ pcGridCols: o,
28
+ className: u
29
+ }) {
30
+ const f = n === "circle" ? "rounded-full" : "rounded-lg", i = (e, t, p) => /* @__PURE__ */ l(
31
+ "a",
32
+ {
33
+ href: e.href,
34
+ className: "flex flex-col items-center gap-1.5 group shrink-0",
35
+ children: [
36
+ /* @__PURE__ */ a(
37
+ "div",
38
+ {
39
+ className: s(
40
+ "overflow-hidden shrink-0",
41
+ t ? "size-24" : p ? "w-full aspect-square" : N[c],
42
+ f
43
+ ),
44
+ children: /* @__PURE__ */ a(
45
+ "img",
46
+ {
47
+ src: e.imageUrl,
48
+ alt: "",
49
+ className: "size-full object-cover transition-opacity group-hover:opacity-80"
50
+ }
51
+ )
52
+ }
53
+ ),
54
+ /* @__PURE__ */ a(
55
+ "span",
56
+ {
57
+ className: s(
58
+ "typo-label-sm text-[var(--Text-High-Emphasis)] text-center",
59
+ t ? "max-w-[96px]" : p ? "w-full" : y[c]
60
+ ),
61
+ children: e.name
62
+ }
63
+ )
64
+ ]
65
+ },
66
+ e.href
67
+ );
68
+ return /* @__PURE__ */ l("section", { "data-slot": "category-scroll", className: s(
69
+ // w-full: CSS Grid 直下で mx-auto が justify-self: stretch を無効化し
70
+ // max-content 幅に縮むのを防ぐ(#207)。block 文脈の挙動は変わらない
71
+ "w-full py-4 @[960px]:max-w-[960px] @[960px]:mx-auto",
72
+ u
73
+ ), children: [
74
+ /* @__PURE__ */ a(v, { title: m, moreHref: d, size: x, className: "px-4" }),
75
+ h === "grid" ? /* @__PURE__ */ l(w, { children: [
76
+ /* @__PURE__ */ l("div", { className: s("mt-3 overflow-x-auto pl-4 pb-2 scrollbar-hide", o && "@[960px]:hidden"), children: [
77
+ /* @__PURE__ */ a(
78
+ "div",
79
+ {
80
+ className: "grid gap-2",
81
+ style: {
82
+ gridTemplateRows: `repeat(${g}, auto)`,
83
+ gridAutoFlow: "column",
84
+ gridAutoColumns: C[c]
85
+ },
86
+ children: r.map((e) => i(e, !1, !0))
87
+ }
88
+ ),
89
+ /* @__PURE__ */ a("div", { className: "shrink-0 w-4", "aria-hidden": "true" })
90
+ ] }),
91
+ o && /* @__PURE__ */ a(
92
+ "div",
93
+ {
94
+ className: "hidden @[960px]:grid @[960px]:gap-x-2 @[960px]:gap-y-4 @[960px]:px-6 @[960px]:mt-3",
95
+ style: { gridTemplateColumns: `repeat(${o}, 1fr)` },
96
+ children: r.map((e) => i(e, !0))
97
+ }
98
+ )
99
+ ] }) : (
100
+ /* デフォルト: 横スクロール1行 */
101
+ /* @__PURE__ */ l("div", { className: "mt-3 flex gap-3 overflow-x-auto pl-4 pb-2 scrollbar-hide", children: [
102
+ r.map((e) => i(e)),
103
+ /* @__PURE__ */ a("div", { className: "shrink-0 w-4", "aria-hidden": "true" })
104
+ ] })
105
+ )
106
+ ] });
107
+ }
108
+ export {
109
+ A as CategoryScroll
110
+ };
@@ -0,0 +1,66 @@
1
+ import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cn as a } from "../../lib/utils.js";
4
+ function f({ items: s, className: c }) {
5
+ return /* @__PURE__ */ o(
6
+ "div",
7
+ {
8
+ "data-slot": "category-shortcuts",
9
+ className: a(
10
+ "flex gap-3 overflow-x-auto px-4 py-2 scrollbar-hide",
11
+ c
12
+ ),
13
+ children: [
14
+ s.map((r, t) => {
15
+ const l = !!r.href || !!r.onClick, n = r.href ? "a" : "button", i = r.href ? { href: r.href } : { type: "button", onClick: r.onClick };
16
+ return /* @__PURE__ */ o(
17
+ n,
18
+ {
19
+ ...i,
20
+ className: a(
21
+ "flex shrink-0 flex-col items-center gap-1 rounded-lg p-1 transition-colors",
22
+ l && "hover:bg-[var(--Surface-Secondary)]",
23
+ r.isSelected && "bg-[var(--Surface-Accent-Primary-Light)]"
24
+ ),
25
+ children: [
26
+ /* @__PURE__ */ e(
27
+ "div",
28
+ {
29
+ className: a(
30
+ "size-10 overflow-hidden rounded-full border",
31
+ r.isSelected ? "border-[var(--Brand-Cake-Orange)]" : "border-[var(--Border-Low-Emphasis)]"
32
+ ),
33
+ children: /* @__PURE__ */ e(
34
+ "img",
35
+ {
36
+ src: r.imageUrl,
37
+ alt: r.imageAlt ?? "",
38
+ className: "size-full object-cover",
39
+ loading: "lazy"
40
+ }
41
+ )
42
+ }
43
+ ),
44
+ /* @__PURE__ */ e(
45
+ "span",
46
+ {
47
+ className: a(
48
+ "w-[56px] text-center typo-body-xs leading-tight line-clamp-2",
49
+ r.isSelected ? "text-[var(--Text-Accent-Primary)]" : "text-[var(--Text-High-Emphasis)]"
50
+ ),
51
+ children: r.name
52
+ }
53
+ )
54
+ ]
55
+ },
56
+ t
57
+ );
58
+ }),
59
+ /* @__PURE__ */ e("div", { className: "shrink-0 w-2", "aria-hidden": "true" })
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ export {
65
+ f as CategoryShortcuts
66
+ };
@@ -0,0 +1,141 @@
1
+ import { jsxs as w, jsx as o } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { SendHorizontal as q } from "lucide-react";
4
+ import { cn as G } from "../../lib/utils.js";
5
+ import { Button as J } from "../foundations/button.js";
6
+ import { FileInput as M } from "../foundations/file-input.js";
7
+ import { Textarea as O } from "../foundations/textarea.js";
8
+ import { Chip as Q } from "./chip.js";
9
+ function ee({
10
+ value: a,
11
+ onChange: C,
12
+ onSubmit: S,
13
+ submitKey: N = "enter",
14
+ attachments: d,
15
+ onAttachmentsChange: k,
16
+ accept: z,
17
+ maxFiles: l,
18
+ maxSizeMb: f,
19
+ onAttachmentError: u,
20
+ disabled: n = !1,
21
+ isSubmitting: h = !1,
22
+ placeholder: E = "メッセージを入力",
23
+ maxLength: p,
24
+ label: F = "メッセージを入力",
25
+ rows: K = 2,
26
+ id: I,
27
+ autoFocus: R,
28
+ className: H
29
+ }) {
30
+ const j = s.useId(), g = I ?? j, b = d !== void 0, [B, D] = s.useState([]), t = b ? d : B, [L, P] = s.useState(0), c = s.useRef(!1), m = n || h, x = !m && (a.trim().length > 0 || t.length > 0), y = (e) => {
31
+ b || D(e), k?.(e);
32
+ }, v = () => {
33
+ x && S(a, t);
34
+ }, $ = (e) => {
35
+ if (e.key !== "Enter" || c.current || e.nativeEvent.isComposing) return;
36
+ const r = e.metaKey || e.ctrlKey;
37
+ if (N === "mod-enter") {
38
+ if (!r) return;
39
+ } else if (e.shiftKey)
40
+ return;
41
+ e.preventDefault(), v();
42
+ }, T = (e) => {
43
+ if (P((i) => i + 1), e.length === 0) return;
44
+ let r = t;
45
+ for (const i of e) {
46
+ if (l != null && r.length >= l) {
47
+ u?.({ code: "max-files", file: i, limit: l });
48
+ continue;
49
+ }
50
+ r = [...r, i];
51
+ }
52
+ r !== t && y(r);
53
+ }, _ = (e) => {
54
+ y(t.filter((r, i) => i !== e));
55
+ };
56
+ return /* @__PURE__ */ w(
57
+ "div",
58
+ {
59
+ "data-slot": "chat-composer",
60
+ "data-disabled": n || void 0,
61
+ className: G(
62
+ "flex flex-col gap-2 rounded-xl border border-[var(--Border-High-Emphasis)] bg-[var(--Surface-Primary)] p-2 transition-[color,box-shadow,border-color]",
63
+ "focus-within:border-[var(--Focus-High-Emphasis)] focus-within:ring-[3px] focus-within:ring-[var(--Focus-High-Emphasis)]/50",
64
+ n && "border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Secondary)]",
65
+ H
66
+ ),
67
+ children: [
68
+ t.length > 0 && /* @__PURE__ */ o("ul", { "data-slot": "chat-composer-attachments", className: "flex flex-wrap gap-2", children: t.map((e, r) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o(
69
+ Q,
70
+ {
71
+ size: "sm",
72
+ removable: !0,
73
+ disabled: m,
74
+ onRemove: () => _(r),
75
+ children: e.name
76
+ }
77
+ ) }, `${e.name}-${r}`)) }),
78
+ /* @__PURE__ */ o("label", { htmlFor: g, className: "sr-only", children: F }),
79
+ /* @__PURE__ */ o(
80
+ O,
81
+ {
82
+ id: g,
83
+ rows: K,
84
+ value: a,
85
+ maxLength: p,
86
+ showCount: p != null,
87
+ placeholder: E,
88
+ disabled: n,
89
+ autoFocus: R,
90
+ onChange: (e) => C(e.target.value),
91
+ onKeyDown: $,
92
+ onCompositionStart: () => {
93
+ c.current = !0;
94
+ },
95
+ onCompositionEnd: () => {
96
+ c.current = !1;
97
+ },
98
+ className: "max-h-40 resize-none border-0 bg-transparent px-2 py-1.5 focus-visible:ring-0 disabled:bg-transparent"
99
+ }
100
+ ),
101
+ /* @__PURE__ */ w("div", { className: "flex items-center justify-between gap-2", children: [
102
+ /* @__PURE__ */ o(
103
+ M,
104
+ {
105
+ accept: z,
106
+ multiple: !0,
107
+ disabled: m,
108
+ maxSize: f != null ? f * 1024 * 1024 : void 0,
109
+ buttonLabel: "ファイルを添付",
110
+ placeholder: "",
111
+ value: [],
112
+ onFilesChange: T,
113
+ onError: (e) => u?.({
114
+ code: "max-size",
115
+ file: e.file,
116
+ limit: e.maxSize / 1024 / 1024
117
+ }),
118
+ className: "shrink-0"
119
+ },
120
+ L
121
+ ),
122
+ /* @__PURE__ */ o(
123
+ J,
124
+ {
125
+ type: "button",
126
+ size: "icon",
127
+ className: "shrink-0 rounded-full",
128
+ disabled: !x,
129
+ "aria-label": h ? "送信中" : "送信",
130
+ onClick: v,
131
+ children: /* @__PURE__ */ o(q, { className: "size-4", "aria-hidden": "true" })
132
+ }
133
+ )
134
+ ] })
135
+ ]
136
+ }
137
+ );
138
+ }
139
+ export {
140
+ ee as ChatComposer
141
+ };
@@ -0,0 +1,123 @@
1
+ import { jsx as t, jsxs as n, Fragment as S } from "react/jsx-runtime";
2
+ import "react";
3
+ import { X as T } from "lucide-react";
4
+ import { cn as s } from "../../lib/utils.js";
5
+ import { chipVariants as b } from "../foundations/chip-variants.js";
6
+ function E({
7
+ className: o,
8
+ variant: h = "filled",
9
+ size: l,
10
+ shape: c,
11
+ href: r,
12
+ selected: i = !1,
13
+ soldOut: x = !1,
14
+ removable: y = !1,
15
+ onRemove: N,
16
+ count: m,
17
+ children: d,
18
+ ...a
19
+ }) {
20
+ const v = i ? "accent" : h, e = x && !i, u = e ? "border border-[var(--Text-Disable)] bg-[var(--Surface-Secondary)] text-[var(--Text-Disable)]" : void 0, g = m !== void 0 && /* @__PURE__ */ t(
21
+ "span",
22
+ {
23
+ className: s(
24
+ "inline-flex items-center justify-center rounded-full px-1.5 min-w-[1.25rem] typo-label-xs transition-colors",
25
+ i ? "bg-[var(--Brand-Cake-Orange)] text-[var(--Text-on-Inverse)] group-hover:bg-[var(--Surface-Primary)] group-hover:text-[var(--Brand-Cake-Orange)]" : "bg-[var(--Surface-Tertiary)] text-[var(--Text-Medium-Emphasis)]"
26
+ ),
27
+ children: m
28
+ }
29
+ ), f = e && /* @__PURE__ */ t("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "h-[67px] w-px origin-center rotate-45 bg-[var(--Text-Disable)]" }) });
30
+ if (y)
31
+ return /* @__PURE__ */ n(
32
+ "span",
33
+ {
34
+ "data-slot": "chip",
35
+ "data-selected": i || void 0,
36
+ className: s(
37
+ "group",
38
+ b({ variant: v, size: l, shape: c }),
39
+ e ? u : void 0,
40
+ e && "relative",
41
+ "has-[[data-slot=chip-trigger]:focus-visible]:ring-2 has-[[data-slot=chip-trigger]:focus-visible]:ring-[var(--Focus-High-Emphasis)]",
42
+ o
43
+ ),
44
+ children: [
45
+ r ? /* @__PURE__ */ n(
46
+ "a",
47
+ {
48
+ href: r,
49
+ "data-slot": "chip-trigger",
50
+ className: "inline-flex items-center gap-1.5 focus-visible:outline-none",
51
+ children: [
52
+ d,
53
+ g
54
+ ]
55
+ }
56
+ ) : /* @__PURE__ */ n(
57
+ "button",
58
+ {
59
+ type: "button",
60
+ "data-slot": "chip-trigger",
61
+ disabled: e || a.disabled,
62
+ className: "inline-flex items-center gap-1.5 focus-visible:outline-none",
63
+ ...a,
64
+ children: [
65
+ d,
66
+ g
67
+ ]
68
+ }
69
+ ),
70
+ f,
71
+ /* @__PURE__ */ t(
72
+ "button",
73
+ {
74
+ type: "button",
75
+ "aria-label": "削除",
76
+ disabled: e || a.disabled,
77
+ onClick: (O) => {
78
+ O.stopPropagation(), N?.();
79
+ },
80
+ className: "-mr-1 ml-0.5 inline-flex size-6 shrink-0 items-center justify-center rounded-full hover:bg-[var(--Overlay-Light)] focus-visible:ring-2 focus-visible:ring-[var(--Focus-High-Emphasis)]",
81
+ children: /* @__PURE__ */ t(T, { className: "size-3.5" })
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ );
87
+ const p = /* @__PURE__ */ n(S, { children: [
88
+ d,
89
+ g,
90
+ f
91
+ ] });
92
+ return r ? /* @__PURE__ */ t(
93
+ "a",
94
+ {
95
+ href: r,
96
+ "data-slot": "chip",
97
+ "data-selected": i || void 0,
98
+ className: s("group", b({ variant: v, size: l, shape: c }), u, o),
99
+ children: p
100
+ }
101
+ ) : /* @__PURE__ */ t(
102
+ "button",
103
+ {
104
+ type: "button",
105
+ "data-slot": "chip",
106
+ "data-selected": i || void 0,
107
+ disabled: e || a.disabled,
108
+ className: s(
109
+ "group",
110
+ b({ variant: v, size: l, shape: c }),
111
+ e ? u : void 0,
112
+ e && "relative",
113
+ o
114
+ ),
115
+ ...a,
116
+ children: p
117
+ }
118
+ );
119
+ }
120
+ export {
121
+ E as Chip,
122
+ b as chipVariants
123
+ };