@cakejp/design-system 0.20.1 → 0.21.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 (161) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/CLAUDE.md +5 -3
  3. package/MIGRATION.md +3 -3
  4. package/README.md +31 -11
  5. package/contracts/components.json +420 -63
  6. package/contracts/composition.json +38 -4
  7. package/contracts/rules.json +27 -5
  8. package/contracts/screen-patterns.json +6 -4
  9. package/dist/components/ec/admin-shell.js +62 -60
  10. package/dist/components/ec/anniversary-card.js +13 -12
  11. package/dist/components/ec/coupon-card.js +11 -11
  12. package/dist/components/ec/delivery-calendar.js +51 -45
  13. package/dist/components/ec/mypage-shell.js +80 -69
  14. package/dist/components/ec/product-card.js +93 -76
  15. package/dist/components/ec/product-carousel.js +65 -60
  16. package/dist/components/ec/product-detail-bar.js +13 -11
  17. package/dist/components/ec/product-detail-sidebar.js +60 -58
  18. package/dist/components/ec/product-list-item.js +64 -63
  19. package/dist/components/ec/product-option.js +30 -26
  20. package/dist/components/ec/rating-stars.js +27 -27
  21. package/dist/components/ec/review-card.js +32 -32
  22. package/dist/components/ec/review-form.js +37 -37
  23. package/dist/components/ec/shop-card.js +21 -19
  24. package/dist/components/foundations/accordion.js +33 -31
  25. package/dist/components/foundations/alert-dialog.js +4 -5
  26. package/dist/components/foundations/badge.js +5 -5
  27. package/dist/components/foundations/breadcrumb.js +27 -26
  28. package/dist/components/foundations/button.js +144 -25
  29. package/dist/components/foundations/calendar.js +28 -26
  30. package/dist/components/foundations/checkbox-card.js +71 -47
  31. package/dist/components/foundations/checkbox-group.js +30 -27
  32. package/dist/components/foundations/checkbox.js +69 -52
  33. package/dist/components/foundations/chip-variants.js +13 -0
  34. package/dist/components/foundations/command.js +81 -79
  35. package/dist/components/foundations/confirm-dialog.js +136 -0
  36. package/dist/components/foundations/context-menu.js +43 -38
  37. package/dist/components/foundations/data-table.js +87 -84
  38. package/dist/components/foundations/dialog.js +45 -36
  39. package/dist/components/foundations/dropdown-menu.js +47 -42
  40. package/dist/components/foundations/file-input.js +97 -67
  41. package/dist/components/foundations/hover-card.js +21 -21
  42. package/dist/components/foundations/menubar.js +75 -69
  43. package/dist/components/foundations/navigation-menu.js +31 -26
  44. package/dist/components/foundations/pagination.js +54 -50
  45. package/dist/components/foundations/popover.js +7 -7
  46. package/dist/components/foundations/progress.js +10 -6
  47. package/dist/components/foundations/radio-group.js +6 -3
  48. package/dist/components/foundations/responsive-dialog.js +73 -55
  49. package/dist/components/foundations/scroll-area.js +18 -14
  50. package/dist/components/foundations/select.js +44 -39
  51. package/dist/components/foundations/sheet.js +45 -37
  52. package/dist/components/foundations/skeleton.js +6 -6
  53. package/dist/components/foundations/skip-link.js +10 -8
  54. package/dist/components/foundations/slider.js +73 -48
  55. package/dist/components/foundations/sonner.js +5 -4
  56. package/dist/components/foundations/spinner.js +7 -5
  57. package/dist/components/foundations/switch.js +11 -10
  58. package/dist/components/foundations/tabs.js +54 -39
  59. package/dist/components/foundations/toggle-group.js +29 -21
  60. package/dist/components/foundations/toggle.js +20 -16
  61. package/dist/components/primitives/admin-side-nav.js +65 -62
  62. package/dist/components/primitives/banner-carousel.js +32 -29
  63. package/dist/components/primitives/bottom-tab-bar.js +16 -15
  64. package/dist/components/primitives/category-scroll.js +39 -29
  65. package/dist/components/primitives/category-shortcuts.js +9 -9
  66. package/dist/components/primitives/chat-composer.js +77 -74
  67. package/dist/components/primitives/chip.js +84 -61
  68. package/dist/components/primitives/combobox.js +63 -47
  69. package/dist/components/primitives/container.js +9 -9
  70. package/dist/components/primitives/content-card.js +15 -17
  71. package/dist/components/primitives/content-carousel.js +103 -83
  72. package/dist/components/primitives/date-picker.js +137 -99
  73. package/dist/components/primitives/footer.js +36 -37
  74. package/dist/components/primitives/header.js +175 -168
  75. package/dist/components/primitives/image-carousel.js +107 -87
  76. package/dist/components/primitives/image-gallery.js +32 -27
  77. package/dist/components/primitives/image-uploader.js +6 -6
  78. package/dist/components/primitives/list-item.js +59 -51
  79. package/dist/components/primitives/menu-drawer.js +36 -38
  80. package/dist/components/primitives/multi-select.js +89 -58
  81. package/dist/components/primitives/notification-list.js +10 -9
  82. package/dist/components/primitives/number-input.js +116 -105
  83. package/dist/components/primitives/scroll-row.js +21 -0
  84. package/dist/components/primitives/search-bar.js +31 -28
  85. package/dist/components/primitives/section-header.js +54 -53
  86. package/dist/components/primitives/side-nav.js +57 -56
  87. package/dist/components/primitives/sub-nav.js +13 -14
  88. package/dist/components/primitives/tag.js +4 -2
  89. package/dist/index.css +1 -1
  90. package/dist/index.js +3070 -925
  91. package/dist/lib/field-labelling.js +31 -21
  92. package/dist/lib/focus-ring.js +22 -4
  93. package/dist/lib/high-contrast.js +4 -0
  94. package/dist/lib/image-index.js +8 -0
  95. package/dist/lib/use-prefers-reduced-motion.js +21 -0
  96. package/dist/types/components/ec/admin-shell.d.ts +11 -1
  97. package/dist/types/components/ec/anniversary-card.d.ts +9 -1
  98. package/dist/types/components/ec/mypage-shell.d.ts +12 -1
  99. package/dist/types/components/ec/product-card.d.ts +13 -1
  100. package/dist/types/components/ec/product-carousel.d.ts +13 -1
  101. package/dist/types/components/ec/product-detail-bar.d.ts +12 -1
  102. package/dist/types/components/ec/product-detail-sidebar.d.ts +11 -1
  103. package/dist/types/components/ec/product-list-item.d.ts +9 -1
  104. package/dist/types/components/ec/rating-stars.d.ts +2 -0
  105. package/dist/types/components/ec/review-card.d.ts +1 -1
  106. package/dist/types/components/ec/shop-card.d.ts +8 -1
  107. package/dist/types/components/foundations/badge.d.ts +1 -1
  108. package/dist/types/components/foundations/breadcrumb.d.ts +8 -1
  109. package/dist/types/components/foundations/button.d.ts +38 -3
  110. package/dist/types/components/foundations/checkbox-card.d.ts +7 -1
  111. package/dist/types/components/foundations/checkbox.d.ts +1 -1
  112. package/dist/types/components/foundations/chip-variants.d.ts +2 -2
  113. package/dist/types/components/foundations/confirm-dialog.d.ts +61 -0
  114. package/dist/types/components/foundations/data-table.d.ts +9 -2
  115. package/dist/types/components/foundations/dialog.d.ts +16 -1
  116. package/dist/types/components/foundations/pagination.d.ts +1 -1
  117. package/dist/types/components/foundations/responsive-dialog.d.ts +2 -1
  118. package/dist/types/components/foundations/sheet.d.ts +12 -1
  119. package/dist/types/components/foundations/skeleton.d.ts +6 -0
  120. package/dist/types/components/foundations/slider.d.ts +15 -1
  121. package/dist/types/components/foundations/tabs.d.ts +7 -0
  122. package/dist/types/components/primitives/admin-side-nav.d.ts +22 -2
  123. package/dist/types/components/primitives/banner-carousel.d.ts +9 -1
  124. package/dist/types/components/primitives/bottom-tab-bar.d.ts +13 -2
  125. package/dist/types/components/primitives/category-scroll.d.ts +10 -1
  126. package/dist/types/components/primitives/category-shortcuts.d.ts +11 -2
  127. package/dist/types/components/primitives/chip.d.ts +22 -3
  128. package/dist/types/components/primitives/combobox.d.ts +7 -2
  129. package/dist/types/components/primitives/container.d.ts +3 -0
  130. package/dist/types/components/primitives/content-card.d.ts +1 -1
  131. package/dist/types/components/primitives/content-carousel.d.ts +13 -4
  132. package/dist/types/components/primitives/date-picker.d.ts +10 -3
  133. package/dist/types/components/primitives/footer.d.ts +1 -1
  134. package/dist/types/components/primitives/header.d.ts +14 -2
  135. package/dist/types/components/primitives/image-carousel.d.ts +23 -5
  136. package/dist/types/components/primitives/list-item.d.ts +10 -1
  137. package/dist/types/components/primitives/menu-drawer.d.ts +1 -1
  138. package/dist/types/components/primitives/multi-select.d.ts +7 -2
  139. package/dist/types/components/primitives/notification-list.d.ts +10 -1
  140. package/dist/types/components/primitives/number-input.d.ts +18 -5
  141. package/dist/types/components/primitives/scroll-row.d.ts +43 -0
  142. package/dist/types/components/primitives/section-header.d.ts +9 -2
  143. package/dist/types/components/primitives/side-nav.d.ts +13 -1
  144. package/dist/types/components/primitives/sub-nav.d.ts +1 -1
  145. package/dist/types/components/primitives/tag.d.ts +1 -1
  146. package/dist/types/index.d.ts +7 -1
  147. package/dist/types/lib/field-labelling.d.ts +23 -8
  148. package/dist/types/lib/focus-ring.d.ts +70 -3
  149. package/dist/types/lib/high-contrast.d.ts +25 -0
  150. package/dist/types/lib/image-index.d.ts +2 -0
  151. package/dist/types/lib/link-component.d.ts +26 -21
  152. package/dist/types/lib/use-prefers-reduced-motion.d.ts +9 -0
  153. package/package.json +11 -3
  154. package/src/components/COMPONENT_LOOKUP.md +18 -16
  155. package/src/preset-standalone.css +42 -0
  156. package/src/preset.css +20 -1
  157. package/src/styles/semantic.css +57 -0
  158. package/templates/AGENTS.md +5 -1
  159. package/templates/CLAUDE.md +3 -1
  160. package/tokens.json +49 -0
  161. package/dist/lib/link-component.js +0 -6
@@ -1,19 +1,20 @@
1
- import { jsx as t, jsxs as s } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
2
  import "react";
3
- import { CheckIcon as i, CircleIcon as u, ChevronRightIcon as c } from "lucide-react";
3
+ import { CheckIcon as u, CircleIcon as c, ChevronRightIcon as l } from "lucide-react";
4
4
  import { DropdownMenu as n } from "radix-ui";
5
5
  import { cn as r } from "../../lib/utils.js";
6
- function v({
6
+ import { FORCED_COLORS_MENU_ITEM as s } from "../../lib/focus-ring.js";
7
+ function w({
7
8
  ...e
8
9
  }) {
9
10
  return /* @__PURE__ */ t(n.Root, { "data-slot": "dropdown-menu", ...e });
10
11
  }
11
- function b({
12
+ function x({
12
13
  ...e
13
14
  }) {
14
15
  return /* @__PURE__ */ t(n.Portal, { "data-slot": "dropdown-menu-portal", ...e });
15
16
  }
16
- function w({
17
+ function h({
17
18
  ...e
18
19
  }) {
19
20
  return /* @__PURE__ */ t(
@@ -24,7 +25,7 @@ function w({
24
25
  }
25
26
  );
26
27
  }
27
- function h({
28
+ function y({
28
29
  className: e,
29
30
  sideOffset: o = 4,
30
31
  ...a
@@ -35,19 +36,19 @@ function h({
35
36
  "data-slot": "dropdown-menu-content",
36
37
  sideOffset: o,
37
38
  className: r(
38
- "z-[var(--Z-Popover)] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-1 typo-body-md text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
39
+ "z-[var(--Z-Popover)] max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-1 typo-body-md text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
39
40
  e
40
41
  ),
41
42
  ...a
42
43
  }
43
44
  ) });
44
45
  }
45
- function x({
46
+ function M({
46
47
  ...e
47
48
  }) {
48
49
  return /* @__PURE__ */ t(n.Group, { "data-slot": "dropdown-menu-group", ...e });
49
50
  }
50
- function y({
51
+ function z({
51
52
  className: e,
52
53
  inset: o,
53
54
  variant: a = "default",
@@ -60,37 +61,39 @@ function y({
60
61
  "data-inset": o,
61
62
  "data-variant": a,
62
63
  className: r(
63
- "relative flex cursor-default items-center gap-2 rounded-md px-3 py-2.5 typo-body-md outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
64
+ "relative flex cursor-default items-center gap-2 rounded-md px-3 py-2.5 typo-body-md outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!",
65
+ s,
64
66
  e
65
67
  ),
66
68
  ...d
67
69
  }
68
70
  );
69
71
  }
70
- function z({
72
+ function D({
71
73
  className: e,
72
74
  children: o,
73
75
  checked: a,
74
76
  ...d
75
77
  }) {
76
- return /* @__PURE__ */ s(
78
+ return /* @__PURE__ */ i(
77
79
  n.CheckboxItem,
78
80
  {
79
81
  "data-slot": "dropdown-menu-checkbox-item",
80
82
  className: r(
81
- "relative flex cursor-default items-center gap-2 rounded-md py-2.5 pr-3 pl-8 typo-body-md outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
83
+ "relative flex cursor-default items-center gap-2 rounded-md py-2.5 pr-3 pl-8 typo-body-md outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
84
+ s,
82
85
  e
83
86
  ),
84
87
  checked: a,
85
88
  ...d,
86
89
  children: [
87
- /* @__PURE__ */ t("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(n.ItemIndicator, { children: /* @__PURE__ */ t(i, { className: "size-4" }) }) }),
90
+ /* @__PURE__ */ t("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(n.ItemIndicator, { children: /* @__PURE__ */ t(u, { className: "size-4" }) }) }),
88
91
  o
89
92
  ]
90
93
  }
91
94
  );
92
95
  }
93
- function M({
96
+ function _({
94
97
  ...e
95
98
  }) {
96
99
  return /* @__PURE__ */ t(
@@ -101,28 +104,29 @@ function M({
101
104
  }
102
105
  );
103
106
  }
104
- function D({
107
+ function N({
105
108
  className: e,
106
109
  children: o,
107
110
  ...a
108
111
  }) {
109
- return /* @__PURE__ */ s(
112
+ return /* @__PURE__ */ i(
110
113
  n.RadioItem,
111
114
  {
112
115
  "data-slot": "dropdown-menu-radio-item",
113
116
  className: r(
114
- "relative flex cursor-default items-center gap-2 rounded-md py-2.5 pr-3 pl-8 typo-body-md outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
117
+ "relative flex cursor-default items-center gap-2 rounded-md py-2.5 pr-3 pl-8 typo-body-md outline-none select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
118
+ s,
115
119
  e
116
120
  ),
117
121
  ...a,
118
122
  children: [
119
- /* @__PURE__ */ t("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(n.ItemIndicator, { children: /* @__PURE__ */ t(u, { className: "size-2 fill-current" }) }) }),
123
+ /* @__PURE__ */ t("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ t(n.ItemIndicator, { children: /* @__PURE__ */ t(c, { className: "size-2 fill-current" }) }) }),
120
124
  o
121
125
  ]
122
126
  }
123
127
  );
124
128
  }
125
- function N({
129
+ function I({
126
130
  className: e,
127
131
  inset: o,
128
132
  ...a
@@ -140,7 +144,7 @@ function N({
140
144
  }
141
145
  );
142
146
  }
143
- function _({
147
+ function C({
144
148
  className: e,
145
149
  ...o
146
150
  }) {
@@ -153,7 +157,7 @@ function _({
153
157
  }
154
158
  );
155
159
  }
156
- function I({
160
+ function S({
157
161
  className: e,
158
162
  ...o
159
163
  }) {
@@ -174,30 +178,31 @@ function k({
174
178
  }) {
175
179
  return /* @__PURE__ */ t(n.Sub, { "data-slot": "dropdown-menu-sub", ...e });
176
180
  }
177
- function C({
181
+ function R({
178
182
  className: e,
179
183
  inset: o,
180
184
  children: a,
181
185
  ...d
182
186
  }) {
183
- return /* @__PURE__ */ s(
187
+ return /* @__PURE__ */ i(
184
188
  n.SubTrigger,
185
189
  {
186
190
  "data-slot": "dropdown-menu-sub-trigger",
187
191
  "data-inset": o,
188
192
  className: r(
189
- "flex cursor-default items-center gap-2 rounded-md px-3 py-2.5 typo-body-md outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
193
+ "flex cursor-default items-center gap-2 rounded-md px-3 py-2.5 typo-body-md outline-none select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
194
+ s,
190
195
  e
191
196
  ),
192
197
  ...d,
193
198
  children: [
194
199
  a,
195
- /* @__PURE__ */ t(c, { className: "ml-auto size-4" })
200
+ /* @__PURE__ */ t(l, { className: "ml-auto size-4" })
196
201
  ]
197
202
  }
198
203
  );
199
204
  }
200
- function S({
205
+ function E({
201
206
  className: e,
202
207
  ...o
203
208
  }) {
@@ -206,7 +211,7 @@ function S({
206
211
  {
207
212
  "data-slot": "dropdown-menu-sub-content",
208
213
  className: r(
209
- "z-[var(--Z-Popover)] min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
214
+ "z-[var(--Z-Popover)] min-w-[8rem] max-w-(--radix-dropdown-menu-content-available-width) origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
210
215
  e
211
216
  ),
212
217
  ...o
@@ -214,19 +219,19 @@ function S({
214
219
  );
215
220
  }
216
221
  export {
217
- v as DropdownMenu,
218
- z as DropdownMenuCheckboxItem,
219
- h as DropdownMenuContent,
220
- x as DropdownMenuGroup,
221
- y as DropdownMenuItem,
222
- N as DropdownMenuLabel,
223
- b as DropdownMenuPortal,
224
- M as DropdownMenuRadioGroup,
225
- D as DropdownMenuRadioItem,
226
- _ as DropdownMenuSeparator,
227
- I as DropdownMenuShortcut,
222
+ w as DropdownMenu,
223
+ D as DropdownMenuCheckboxItem,
224
+ y as DropdownMenuContent,
225
+ M as DropdownMenuGroup,
226
+ z as DropdownMenuItem,
227
+ I as DropdownMenuLabel,
228
+ x as DropdownMenuPortal,
229
+ _ as DropdownMenuRadioGroup,
230
+ N as DropdownMenuRadioItem,
231
+ C as DropdownMenuSeparator,
232
+ S as DropdownMenuShortcut,
228
233
  k as DropdownMenuSub,
229
- S as DropdownMenuSubContent,
230
- C as DropdownMenuSubTrigger,
231
- w as DropdownMenuTrigger
234
+ E as DropdownMenuSubContent,
235
+ R as DropdownMenuSubTrigger,
236
+ h as DropdownMenuTrigger
232
237
  };
@@ -1,109 +1,139 @@
1
1
  "use client";
2
- import { jsxs as b, jsx as n } from "react/jsx-runtime";
3
- import * as g from "react";
4
- import { Paperclip as H, X as _ } from "lucide-react";
5
- import { cn as o } from "../../lib/utils.js";
6
- import { FOCUS_RING_WITHIN as k, FOCUS_RING as G } from "../../lib/focus-ring.js";
7
- import { buttonVariants as L } from "./button.js";
8
- function S(e) {
9
- return e.length === 0 ? "" : e.length === 1 ? e[0].name : `${e.length}件選択`;
2
+ import { jsxs as R, jsx as f } from "react/jsx-runtime";
3
+ import * as r from "react";
4
+ import { Paperclip as S, X as _ } from "lucide-react";
5
+ import { cn as b } from "../../lib/utils.js";
6
+ import { FOCUS_RING_WITHIN as G, FOCUS_RING as U } from "../../lib/focus-ring.js";
7
+ import { buttonVariants as A } from "./button.js";
8
+ function M(t) {
9
+ return t.length === 0 ? "" : t.length === 1 ? t[0].name : `${t.length}件選択`;
10
10
  }
11
- function U(e, i) {
12
- if (i == null) return { accepted: e, rejected: [] };
13
- const a = [], s = [];
14
- for (const t of e)
15
- t.size > i ? s.push(t) : a.push(t);
16
- return { accepted: a, rejected: s };
11
+ function P(t, i) {
12
+ if (i == null) return { accepted: t, rejected: [] };
13
+ const s = [], o = [];
14
+ for (const a of t)
15
+ a.size > i ? o.push(a) : s.push(a);
16
+ return { accepted: s, rejected: o };
17
17
  }
18
- function W({
19
- id: e,
18
+ function m(t, i) {
19
+ if (i.length === 0) {
20
+ t.value = "";
21
+ return;
22
+ }
23
+ if (typeof DataTransfer > "u") return;
24
+ const s = new DataTransfer();
25
+ i.forEach((o) => s.items.add(o)), t.files = s.files;
26
+ }
27
+ function B({
28
+ id: t,
20
29
  name: i,
21
- accept: a,
22
- multiple: s = !1,
23
- maxSize: t,
24
- disabled: l = !1,
25
- placeholder: y = "ファイルが選択されていません",
26
- buttonLabel: N = "ファイルを選択",
27
- value: d,
28
- onFilesChange: m,
29
- onError: x,
30
- className: F,
31
- "aria-describedby": j,
32
- "aria-invalid": I
30
+ accept: s,
31
+ multiple: o = !1,
32
+ maxSize: a,
33
+ disabled: y = !1,
34
+ placeholder: F = "ファイルが選択されていません",
35
+ buttonLabel: j = "ファイルを選択",
36
+ value: x,
37
+ onFilesChange: d,
38
+ onError: w,
39
+ className: I,
40
+ "aria-describedby": z,
41
+ "aria-invalid": C
33
42
  }) {
34
- const r = g.useRef(null), c = d !== void 0, [w, p] = g.useState([]), h = c ? d : w, C = (z) => {
35
- const E = Array.from(z.target.files ?? []), { accepted: f, rejected: v } = U(E, t);
36
- if (v.length > 0 && t != null)
37
- for (const O of v)
38
- x?.({ code: "max-size", file: O, maxSize: t });
39
- c || p(f), m?.(f), f.length === 0 && r.current && (r.current.value = "");
40
- }, R = () => {
41
- r.current && (r.current.value = ""), c || p([]), m?.([]);
42
- }, T = S(h), u = h.length > 0;
43
- return /* @__PURE__ */ b(
43
+ const e = r.useRef(null), n = x !== void 0, [L, N] = r.useState([]), c = n ? x : L, E = r.useRef(c), l = r.useRef(null);
44
+ r.useEffect(() => {
45
+ E.current = c;
46
+ }, [c]);
47
+ const p = r.useCallback(() => {
48
+ l.current !== null && clearTimeout(l.current), l.current = setTimeout(() => {
49
+ l.current = null, e.current && m(e.current, E.current);
50
+ }, 0);
51
+ }, []);
52
+ r.useEffect(() => () => {
53
+ l.current !== null && clearTimeout(l.current);
54
+ }, []), r.useEffect(() => {
55
+ e.current && m(e.current, c);
56
+ }, [c]), r.useEffect(() => {
57
+ const u = e.current?.form;
58
+ if (!u) return;
59
+ const h = () => {
60
+ e.current && (m(e.current, []), n || N([]), d?.([]), p());
61
+ };
62
+ return u.addEventListener("reset", h), () => u.removeEventListener("reset", h);
63
+ }, [n, d, p]);
64
+ const O = (u) => {
65
+ const h = Array.from(u.target.files ?? []), { accepted: v, rejected: T } = P(h, a);
66
+ if (T.length > 0 && a != null)
67
+ for (const H of T)
68
+ w?.({ code: "max-size", file: H, maxSize: a });
69
+ n || N(v), e.current && m(e.current, v), d?.(v), n && p(), !n && v.length === 0 && e.current && (e.current.value = "");
70
+ }, k = () => {
71
+ e.current && m(e.current, []), n || N([]), d?.([]), n && p();
72
+ }, D = M(c), g = c.length > 0;
73
+ return /* @__PURE__ */ R(
44
74
  "div",
45
75
  {
46
76
  "data-slot": "file-input",
47
- className: o("flex min-w-0 items-center gap-2", F),
77
+ className: b("flex min-w-0 items-center gap-2", I),
48
78
  children: [
49
- /* @__PURE__ */ b(
79
+ /* @__PURE__ */ R(
50
80
  "label",
51
81
  {
52
- className: o(
53
- L({ variant: "secondary", size: "default" }),
82
+ className: b(
83
+ A({ variant: "secondary", size: "default" }),
54
84
  "relative cursor-pointer",
55
85
  // フォーカス意匠は DS 共通(outline ではなく FOCUS_RING と同じリング)。
56
- k,
86
+ G,
57
87
  // buttonVariants(secondary) の hover は border/outline をオレンジにするため、
58
88
  // focus-within 中は打ち消す(focus-within は variant 順で hover より先=負ける)。
59
89
  // :hover:focus-within は詳細度が :hover より高いので確実に上書きできる。
60
90
  "[&:hover:focus-within]:border-[var(--Focus-High-Emphasis)] [&:hover:focus-within]:outline-transparent",
61
- l && "pointer-events-none border-transparent bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]"
91
+ y && "pointer-events-none border-transparent bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]"
62
92
  ),
63
93
  children: [
64
- /* @__PURE__ */ n(H, { className: "size-4", "aria-hidden": "true" }),
65
- N,
66
- /* @__PURE__ */ n(
94
+ /* @__PURE__ */ f(S, { className: "size-4", "aria-hidden": "true" }),
95
+ j,
96
+ /* @__PURE__ */ f(
67
97
  "input",
68
98
  {
69
- ref: r,
70
- id: e,
99
+ ref: e,
100
+ id: t,
71
101
  name: i,
72
102
  type: "file",
73
- accept: a,
74
- multiple: s,
75
- disabled: l,
76
- onChange: C,
77
- "aria-describedby": j,
78
- "aria-invalid": I,
103
+ accept: s,
104
+ multiple: o,
105
+ disabled: y,
106
+ onChange: O,
107
+ "aria-describedby": z,
108
+ "aria-invalid": C,
79
109
  className: "sr-only"
80
110
  }
81
111
  )
82
112
  ]
83
113
  }
84
114
  ),
85
- /* @__PURE__ */ n(
115
+ /* @__PURE__ */ f(
86
116
  "span",
87
117
  {
88
118
  "data-slot": "file-input-filename",
89
- className: o(
119
+ className: b(
90
120
  "min-w-0 flex-1 truncate typo-body-md",
91
- u ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]"
121
+ g ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]"
92
122
  ),
93
- children: u ? T : y
123
+ children: g ? D : F
94
124
  }
95
125
  ),
96
- u && !l && /* @__PURE__ */ n(
126
+ g && !y && /* @__PURE__ */ f(
97
127
  "button",
98
128
  {
99
129
  type: "button",
100
130
  "aria-label": "選択を解除",
101
- onClick: R,
102
- className: o(
131
+ onClick: k,
132
+ className: b(
103
133
  "inline-flex size-6 shrink-0 items-center justify-center rounded-full text-[var(--Object-Medium-Emphasis)] transition-colors hover:bg-[var(--Overlay-Light)] focus-visible:outline-none",
104
- G
134
+ U
105
135
  ),
106
- children: /* @__PURE__ */ n(_, { className: "size-3.5" })
136
+ children: /* @__PURE__ */ f(_, { className: "size-3.5" })
107
137
  }
108
138
  )
109
139
  ]
@@ -111,7 +141,7 @@ function W({
111
141
  );
112
142
  }
113
143
  export {
114
- W as FileInput,
115
- S as formatFileNames,
116
- U as validateFileSize
144
+ B as FileInput,
145
+ M as formatFileNames,
146
+ P as validateFileSize
117
147
  };
@@ -1,41 +1,41 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { HoverCard as r } from "radix-ui";
4
4
  import { cn as i } from "../../lib/utils.js";
5
- function p({
6
- openDelay: o = 200,
7
- closeDelay: e = 100,
8
- ...a
5
+ function c({
6
+ openDelay: t = 200,
7
+ closeDelay: a = 100,
8
+ ...e
9
9
  }) {
10
- return /* @__PURE__ */ t(r.Root, { "data-slot": "hover-card", openDelay: o, closeDelay: e, ...a });
10
+ return /* @__PURE__ */ o(r.Root, { "data-slot": "hover-card", openDelay: t, closeDelay: a, ...e });
11
11
  }
12
- function c({
13
- ...o
12
+ function p({
13
+ ...t
14
14
  }) {
15
- return /* @__PURE__ */ t(r.Trigger, { "data-slot": "hover-card-trigger", ...o });
15
+ return /* @__PURE__ */ o(r.Trigger, { "data-slot": "hover-card-trigger", ...t });
16
16
  }
17
- function f({
18
- className: o,
19
- align: e = "center",
20
- sideOffset: a = 4,
17
+ function v({
18
+ className: t,
19
+ align: a = "center",
20
+ sideOffset: e = 4,
21
21
  ...d
22
22
  }) {
23
- return /* @__PURE__ */ t(r.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ t(
23
+ return /* @__PURE__ */ o(r.Portal, { "data-slot": "hover-card-portal", children: /* @__PURE__ */ o(
24
24
  r.Content,
25
25
  {
26
26
  "data-slot": "hover-card-content",
27
- align: e,
28
- sideOffset: a,
27
+ align: a,
28
+ sideOffset: e,
29
29
  className: i(
30
- "z-[var(--Z-Popover)] w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
31
- o
30
+ "z-[var(--Z-Popover)] w-64 max-w-(--radix-hover-card-content-available-width) origin-(--radix-hover-card-content-transform-origin) rounded-md border border-[var(--Border-Medium-Emphasis)] bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
31
+ t
32
32
  ),
33
33
  ...d
34
34
  }
35
35
  ) });
36
36
  }
37
37
  export {
38
- p as HoverCard,
39
- f as HoverCardContent,
40
- c as HoverCardTrigger
38
+ c as HoverCard,
39
+ v as HoverCardContent,
40
+ p as HoverCardTrigger
41
41
  };