@cakejp/design-system 0.15.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 (186) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/CLAUDE.md +1 -0
  3. package/bin/init.js +29 -6
  4. package/contracts/components.json +45 -8
  5. package/contracts/composition.json +8 -2
  6. package/contracts/rules.json +14 -2
  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 -13082
  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/index.d.ts +1 -0
  180. package/dist/types/lib/field-labelling.d.ts +66 -0
  181. package/dist/types/lib/focus-ring.d.ts +42 -0
  182. package/package.json +2 -2
  183. package/scripts/codemod/README.md +9 -0
  184. package/src/components/COMPONENT_LOOKUP.md +1 -1
  185. package/src/preset-standalone.css +15 -0
  186. package/src/preset.css +15 -1
@@ -0,0 +1,129 @@
1
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
2
+ import "react";
3
+ import { Drawer as e } from "vaul";
4
+ import { cn as d } from "../../lib/utils.js";
5
+ function m({
6
+ ...r
7
+ }) {
8
+ return /* @__PURE__ */ t(e.Root, { "data-slot": "drawer", ...r });
9
+ }
10
+ function v({
11
+ ...r
12
+ }) {
13
+ return /* @__PURE__ */ t(e.Trigger, { "data-slot": "drawer-trigger", ...r });
14
+ }
15
+ function n({
16
+ ...r
17
+ }) {
18
+ return /* @__PURE__ */ t(e.Portal, { "data-slot": "drawer-portal", ...r });
19
+ }
20
+ function p({
21
+ ...r
22
+ }) {
23
+ return /* @__PURE__ */ t(e.Close, { "data-slot": "drawer-close", ...r });
24
+ }
25
+ function l({
26
+ className: r,
27
+ ...a
28
+ }) {
29
+ return /* @__PURE__ */ t(
30
+ e.Overlay,
31
+ {
32
+ "data-slot": "drawer-overlay",
33
+ className: d(
34
+ "fixed inset-0 z-[var(--Z-Overlay)] bg-[var(--Overlay-Medium)] data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",
35
+ r
36
+ ),
37
+ ...a
38
+ }
39
+ );
40
+ }
41
+ function f({
42
+ className: r,
43
+ children: a,
44
+ ...i
45
+ }) {
46
+ return /* @__PURE__ */ o(n, { "data-slot": "drawer-portal", children: [
47
+ /* @__PURE__ */ t(l, {}),
48
+ /* @__PURE__ */ o(
49
+ e.Content,
50
+ {
51
+ "data-slot": "drawer-content",
52
+ className: d(
53
+ "group/drawer-content fixed z-[var(--Z-Modal)] flex h-auto flex-col border-[var(--Border-Medium-Emphasis)] bg-background",
54
+ "data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-lg data-[vaul-drawer-direction=top]:border-b",
55
+ "data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-lg data-[vaul-drawer-direction=bottom]:border-t",
56
+ "data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-l data-[vaul-drawer-direction=right]:sm:max-w-sm",
57
+ "data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-r data-[vaul-drawer-direction=left]:sm:max-w-sm",
58
+ r
59
+ ),
60
+ ...i,
61
+ children: [
62
+ /* @__PURE__ */ t("div", { className: "mx-auto mt-4 hidden h-2 w-[100px] shrink-0 rounded-full bg-[var(--Border-Medium-Emphasis)] group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }),
63
+ a
64
+ ]
65
+ }
66
+ )
67
+ ] });
68
+ }
69
+ function g({ className: r, ...a }) {
70
+ return /* @__PURE__ */ t(
71
+ "div",
72
+ {
73
+ "data-slot": "drawer-header",
74
+ className: d(
75
+ "flex flex-col gap-0.5 p-4 group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center group-data-[vaul-drawer-direction=top]/drawer-content:text-center md:gap-1.5 md:text-left",
76
+ r
77
+ ),
78
+ ...a
79
+ }
80
+ );
81
+ }
82
+ function x({ className: r, ...a }) {
83
+ return /* @__PURE__ */ t(
84
+ "div",
85
+ {
86
+ "data-slot": "drawer-footer",
87
+ className: d("mt-auto flex flex-col gap-2 p-4", r),
88
+ ...a
89
+ }
90
+ );
91
+ }
92
+ function b({
93
+ className: r,
94
+ ...a
95
+ }) {
96
+ return /* @__PURE__ */ t(
97
+ e.Title,
98
+ {
99
+ "data-slot": "drawer-title",
100
+ className: d("typo-heading-lg text-[var(--Text-High-Emphasis)]", r),
101
+ ...a
102
+ }
103
+ );
104
+ }
105
+ function h({
106
+ className: r,
107
+ ...a
108
+ }) {
109
+ return /* @__PURE__ */ t(
110
+ e.Description,
111
+ {
112
+ "data-slot": "drawer-description",
113
+ className: d("typo-body-sm text-[var(--Text-Medium-Emphasis)]", r),
114
+ ...a
115
+ }
116
+ );
117
+ }
118
+ export {
119
+ m as Drawer,
120
+ p as DrawerClose,
121
+ f as DrawerContent,
122
+ h as DrawerDescription,
123
+ x as DrawerFooter,
124
+ g as DrawerHeader,
125
+ l as DrawerOverlay,
126
+ n as DrawerPortal,
127
+ b as DrawerTitle,
128
+ v as DrawerTrigger
129
+ };
@@ -0,0 +1,232 @@
1
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
+ import "react";
3
+ import { CheckIcon as i, CircleIcon as u, ChevronRightIcon as c } from "lucide-react";
4
+ import { DropdownMenu as n } from "radix-ui";
5
+ import { cn as r } from "../../lib/utils.js";
6
+ function v({
7
+ ...e
8
+ }) {
9
+ return /* @__PURE__ */ t(n.Root, { "data-slot": "dropdown-menu", ...e });
10
+ }
11
+ function b({
12
+ ...e
13
+ }) {
14
+ return /* @__PURE__ */ t(n.Portal, { "data-slot": "dropdown-menu-portal", ...e });
15
+ }
16
+ function w({
17
+ ...e
18
+ }) {
19
+ return /* @__PURE__ */ t(
20
+ n.Trigger,
21
+ {
22
+ "data-slot": "dropdown-menu-trigger",
23
+ ...e
24
+ }
25
+ );
26
+ }
27
+ function h({
28
+ className: e,
29
+ sideOffset: o = 4,
30
+ ...a
31
+ }) {
32
+ return /* @__PURE__ */ t(n.Portal, { children: /* @__PURE__ */ t(
33
+ n.Content,
34
+ {
35
+ "data-slot": "dropdown-menu-content",
36
+ sideOffset: o,
37
+ 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
+ e
40
+ ),
41
+ ...a
42
+ }
43
+ ) });
44
+ }
45
+ function x({
46
+ ...e
47
+ }) {
48
+ return /* @__PURE__ */ t(n.Group, { "data-slot": "dropdown-menu-group", ...e });
49
+ }
50
+ function y({
51
+ className: e,
52
+ inset: o,
53
+ variant: a = "default",
54
+ ...d
55
+ }) {
56
+ return /* @__PURE__ */ t(
57
+ n.Item,
58
+ {
59
+ "data-slot": "dropdown-menu-item",
60
+ "data-inset": o,
61
+ "data-variant": a,
62
+ 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
+ e
65
+ ),
66
+ ...d
67
+ }
68
+ );
69
+ }
70
+ function z({
71
+ className: e,
72
+ children: o,
73
+ checked: a,
74
+ ...d
75
+ }) {
76
+ return /* @__PURE__ */ s(
77
+ n.CheckboxItem,
78
+ {
79
+ "data-slot": "dropdown-menu-checkbox-item",
80
+ 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",
82
+ e
83
+ ),
84
+ checked: a,
85
+ ...d,
86
+ 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" }) }) }),
88
+ o
89
+ ]
90
+ }
91
+ );
92
+ }
93
+ function M({
94
+ ...e
95
+ }) {
96
+ return /* @__PURE__ */ t(
97
+ n.RadioGroup,
98
+ {
99
+ "data-slot": "dropdown-menu-radio-group",
100
+ ...e
101
+ }
102
+ );
103
+ }
104
+ function D({
105
+ className: e,
106
+ children: o,
107
+ ...a
108
+ }) {
109
+ return /* @__PURE__ */ s(
110
+ n.RadioItem,
111
+ {
112
+ "data-slot": "dropdown-menu-radio-item",
113
+ 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",
115
+ e
116
+ ),
117
+ ...a,
118
+ 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" }) }) }),
120
+ o
121
+ ]
122
+ }
123
+ );
124
+ }
125
+ function N({
126
+ className: e,
127
+ inset: o,
128
+ ...a
129
+ }) {
130
+ return /* @__PURE__ */ t(
131
+ n.Label,
132
+ {
133
+ "data-slot": "dropdown-menu-label",
134
+ "data-inset": o,
135
+ className: r(
136
+ "px-2 py-1.5 typo-label-md data-[inset]:pl-8",
137
+ e
138
+ ),
139
+ ...a
140
+ }
141
+ );
142
+ }
143
+ function _({
144
+ className: e,
145
+ ...o
146
+ }) {
147
+ return /* @__PURE__ */ t(
148
+ n.Separator,
149
+ {
150
+ "data-slot": "dropdown-menu-separator",
151
+ className: r("-mx-1 my-1 h-px bg-border", e),
152
+ ...o
153
+ }
154
+ );
155
+ }
156
+ function I({
157
+ className: e,
158
+ ...o
159
+ }) {
160
+ return /* @__PURE__ */ t(
161
+ "span",
162
+ {
163
+ "data-slot": "dropdown-menu-shortcut",
164
+ className: r(
165
+ "ml-auto typo-body-xs text-muted-foreground",
166
+ e
167
+ ),
168
+ ...o
169
+ }
170
+ );
171
+ }
172
+ function k({
173
+ ...e
174
+ }) {
175
+ return /* @__PURE__ */ t(n.Sub, { "data-slot": "dropdown-menu-sub", ...e });
176
+ }
177
+ function C({
178
+ className: e,
179
+ inset: o,
180
+ children: a,
181
+ ...d
182
+ }) {
183
+ return /* @__PURE__ */ s(
184
+ n.SubTrigger,
185
+ {
186
+ "data-slot": "dropdown-menu-sub-trigger",
187
+ "data-inset": o,
188
+ 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",
190
+ e
191
+ ),
192
+ ...d,
193
+ children: [
194
+ a,
195
+ /* @__PURE__ */ t(c, { className: "ml-auto size-4" })
196
+ ]
197
+ }
198
+ );
199
+ }
200
+ function S({
201
+ className: e,
202
+ ...o
203
+ }) {
204
+ return /* @__PURE__ */ t(
205
+ n.SubContent,
206
+ {
207
+ "data-slot": "dropdown-menu-sub-content",
208
+ 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",
210
+ e
211
+ ),
212
+ ...o
213
+ }
214
+ );
215
+ }
216
+ 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,
228
+ k as DropdownMenuSub,
229
+ S as DropdownMenuSubContent,
230
+ C as DropdownMenuSubTrigger,
231
+ w as DropdownMenuTrigger
232
+ };
@@ -0,0 +1,150 @@
1
+ import { jsx as a, jsxs as i } from "react/jsx-runtime";
2
+ import "react";
3
+ import { cva as s } from "class-variance-authority";
4
+ import { cn as l } from "../../lib/utils.js";
5
+ import { Label as n } from "./label.js";
6
+ import { Separator as o } from "./separator.js";
7
+ const d = s("group/field flex", {
8
+ variants: {
9
+ orientation: {
10
+ /** 既定。ラベルの下に入力を積む */
11
+ vertical: "flex-col gap-1.5",
12
+ /** ラベルと入力を横並び(ラベル幅は内容依存) */
13
+ horizontal: "flex-row items-center gap-3",
14
+ /** 狭いときは縦、`@md/field-group` 以上で横に切り替える */
15
+ responsive: "flex-col gap-1.5 @md/field-group:flex-row @md/field-group:items-center @md/field-group:gap-3"
16
+ }
17
+ },
18
+ defaultVariants: { orientation: "vertical" }
19
+ });
20
+ function g({
21
+ className: t,
22
+ orientation: e,
23
+ ...r
24
+ }) {
25
+ return /* @__PURE__ */ a(
26
+ "div",
27
+ {
28
+ role: "group",
29
+ "data-slot": "field",
30
+ "data-orientation": e ?? "vertical",
31
+ className: l(d({ orientation: e }), t),
32
+ ...r
33
+ }
34
+ );
35
+ }
36
+ function v({
37
+ className: t,
38
+ ...e
39
+ }) {
40
+ return /* @__PURE__ */ a(
41
+ n,
42
+ {
43
+ "data-slot": "field-label",
44
+ className: l(
45
+ "text-[var(--Text-High-Emphasis)] group-data-[disabled=true]/field:text-[var(--Text-Disable)]",
46
+ t
47
+ ),
48
+ ...e
49
+ }
50
+ );
51
+ }
52
+ function N({ className: t, ...e }) {
53
+ return /* @__PURE__ */ a(
54
+ "fieldset",
55
+ {
56
+ "data-slot": "field-set",
57
+ className: l(
58
+ "flex min-w-0 flex-col gap-6 border-0 p-0",
59
+ t
60
+ ),
61
+ ...e
62
+ }
63
+ );
64
+ }
65
+ function b({ className: t, ...e }) {
66
+ return /* @__PURE__ */ a(
67
+ "legend",
68
+ {
69
+ "data-slot": "field-legend",
70
+ className: l(
71
+ "typo-label-lg text-[var(--Text-High-Emphasis)]",
72
+ t
73
+ ),
74
+ ...e
75
+ }
76
+ );
77
+ }
78
+ function y({ className: t, ...e }) {
79
+ return /* @__PURE__ */ a(
80
+ "div",
81
+ {
82
+ "data-slot": "field-group",
83
+ role: "group",
84
+ className: l("@container/field-group flex min-w-0 flex-col gap-4", t),
85
+ ...e
86
+ }
87
+ );
88
+ }
89
+ function F({ className: t, ...e }) {
90
+ return /* @__PURE__ */ a(
91
+ "p",
92
+ {
93
+ "data-slot": "field-description",
94
+ className: l(
95
+ "typo-body-xs text-[var(--Text-Low-Emphasis)]",
96
+ t
97
+ ),
98
+ ...e
99
+ }
100
+ );
101
+ }
102
+ function h({
103
+ className: t,
104
+ children: e,
105
+ ...r
106
+ }) {
107
+ return e ? /* @__PURE__ */ a(
108
+ "p",
109
+ {
110
+ "data-slot": "field-error",
111
+ role: "alert",
112
+ className: l(
113
+ "typo-body-xs text-[var(--Text-Caution)]",
114
+ t
115
+ ),
116
+ ...r,
117
+ children: e
118
+ }
119
+ ) : null;
120
+ }
121
+ function w({
122
+ className: t,
123
+ children: e,
124
+ ...r
125
+ }) {
126
+ return /* @__PURE__ */ i(
127
+ "div",
128
+ {
129
+ "data-slot": "field-separator",
130
+ className: l("relative flex items-center py-2", t),
131
+ ...r,
132
+ children: [
133
+ /* @__PURE__ */ a(o, { className: "flex-1" }),
134
+ e != null && /* @__PURE__ */ a("span", { className: "mx-3 shrink-0 typo-body-xs text-[var(--Text-Low-Emphasis)]", children: e }),
135
+ e != null && /* @__PURE__ */ a(o, { className: "flex-1" })
136
+ ]
137
+ }
138
+ );
139
+ }
140
+ export {
141
+ g as Field,
142
+ F as FieldDescription,
143
+ h as FieldError,
144
+ y as FieldGroup,
145
+ v as FieldLabel,
146
+ b as FieldLegend,
147
+ w as FieldSeparator,
148
+ N as FieldSet,
149
+ d as fieldVariants
150
+ };
@@ -0,0 +1,116 @@
1
+ import { jsxs as b, jsx as n } from "react/jsx-runtime";
2
+ import * as g from "react";
3
+ import { Paperclip as H, X as _ } from "lucide-react";
4
+ import { cn as o } from "../../lib/utils.js";
5
+ import { FOCUS_RING_WITHIN as k, FOCUS_RING as G } from "../../lib/focus-ring.js";
6
+ import { buttonVariants as L } from "./button.js";
7
+ function S(e) {
8
+ return e.length === 0 ? "" : e.length === 1 ? e[0].name : `${e.length}件選択`;
9
+ }
10
+ function U(e, i) {
11
+ if (i == null) return { accepted: e, rejected: [] };
12
+ const a = [], s = [];
13
+ for (const t of e)
14
+ t.size > i ? s.push(t) : a.push(t);
15
+ return { accepted: a, rejected: s };
16
+ }
17
+ function W({
18
+ id: e,
19
+ name: i,
20
+ accept: a,
21
+ multiple: s = !1,
22
+ maxSize: t,
23
+ disabled: l = !1,
24
+ placeholder: y = "ファイルが選択されていません",
25
+ buttonLabel: N = "ファイルを選択",
26
+ value: d,
27
+ onFilesChange: m,
28
+ onError: x,
29
+ className: F,
30
+ "aria-describedby": j,
31
+ "aria-invalid": I
32
+ }) {
33
+ const r = g.useRef(null), c = d !== void 0, [w, p] = g.useState([]), h = c ? d : w, C = (z) => {
34
+ const E = Array.from(z.target.files ?? []), { accepted: f, rejected: v } = U(E, t);
35
+ if (v.length > 0 && t != null)
36
+ for (const O of v)
37
+ x?.({ code: "max-size", file: O, maxSize: t });
38
+ c || p(f), m?.(f), f.length === 0 && r.current && (r.current.value = "");
39
+ }, R = () => {
40
+ r.current && (r.current.value = ""), c || p([]), m?.([]);
41
+ }, T = S(h), u = h.length > 0;
42
+ return /* @__PURE__ */ b(
43
+ "div",
44
+ {
45
+ "data-slot": "file-input",
46
+ className: o("flex min-w-0 items-center gap-2", F),
47
+ children: [
48
+ /* @__PURE__ */ b(
49
+ "label",
50
+ {
51
+ className: o(
52
+ L({ variant: "secondary", size: "default" }),
53
+ "relative cursor-pointer",
54
+ // フォーカス意匠は DS 共通(outline ではなく FOCUS_RING と同じリング)。
55
+ k,
56
+ // buttonVariants(secondary) の hover は border/outline をオレンジにするため、
57
+ // focus-within 中は打ち消す(focus-within は variant 順で hover より先=負ける)。
58
+ // :hover:focus-within は詳細度が :hover より高いので確実に上書きできる。
59
+ "[&:hover:focus-within]:border-[var(--Focus-High-Emphasis)] [&:hover:focus-within]:outline-transparent",
60
+ l && "pointer-events-none border-transparent bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]"
61
+ ),
62
+ children: [
63
+ /* @__PURE__ */ n(H, { className: "size-4", "aria-hidden": "true" }),
64
+ N,
65
+ /* @__PURE__ */ n(
66
+ "input",
67
+ {
68
+ ref: r,
69
+ id: e,
70
+ name: i,
71
+ type: "file",
72
+ accept: a,
73
+ multiple: s,
74
+ disabled: l,
75
+ onChange: C,
76
+ "aria-describedby": j,
77
+ "aria-invalid": I,
78
+ className: "sr-only"
79
+ }
80
+ )
81
+ ]
82
+ }
83
+ ),
84
+ /* @__PURE__ */ n(
85
+ "span",
86
+ {
87
+ "data-slot": "file-input-filename",
88
+ className: o(
89
+ "min-w-0 flex-1 truncate typo-body-md",
90
+ u ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]"
91
+ ),
92
+ children: u ? T : y
93
+ }
94
+ ),
95
+ u && !l && /* @__PURE__ */ n(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ "aria-label": "選択を解除",
100
+ onClick: R,
101
+ className: o(
102
+ "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",
103
+ G
104
+ ),
105
+ children: /* @__PURE__ */ n(_, { className: "size-3.5" })
106
+ }
107
+ )
108
+ ]
109
+ }
110
+ );
111
+ }
112
+ export {
113
+ W as FileInput,
114
+ S as formatFileNames,
115
+ U as validateFileSize
116
+ };