@cakejp/design-system 0.20.0 → 0.21.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.
- package/CHANGELOG.md +179 -0
- package/CLAUDE.md +5 -3
- package/MIGRATION.md +3 -3
- package/README.md +31 -11
- package/contracts/components.json +424 -62
- package/contracts/composition.json +38 -4
- package/contracts/rules.json +27 -5
- package/contracts/screen-patterns.json +6 -4
- package/dist/components/ec/admin-shell.js +62 -60
- package/dist/components/ec/anniversary-card.js +13 -12
- package/dist/components/ec/coupon-card.js +11 -11
- package/dist/components/ec/delivery-calendar.js +51 -45
- package/dist/components/ec/mypage-shell.js +80 -69
- package/dist/components/ec/product-card.js +93 -76
- package/dist/components/ec/product-carousel.js +65 -60
- package/dist/components/ec/product-detail-bar.js +13 -11
- package/dist/components/ec/product-detail-sidebar.js +60 -58
- package/dist/components/ec/product-list-item.js +64 -63
- package/dist/components/ec/product-option.js +30 -26
- package/dist/components/ec/rating-stars.js +27 -27
- package/dist/components/ec/review-card.js +32 -32
- package/dist/components/ec/review-form.js +37 -37
- package/dist/components/ec/shop-card.js +21 -19
- package/dist/components/foundations/accordion.js +33 -31
- package/dist/components/foundations/alert-dialog.js +4 -5
- package/dist/components/foundations/badge.js +5 -5
- package/dist/components/foundations/breadcrumb.js +27 -26
- package/dist/components/foundations/button.js +144 -25
- package/dist/components/foundations/calendar.js +28 -26
- package/dist/components/foundations/checkbox-card.js +71 -47
- package/dist/components/foundations/checkbox-group.js +30 -27
- package/dist/components/foundations/checkbox.js +69 -52
- package/dist/components/foundations/chip-variants.js +13 -0
- package/dist/components/foundations/command.js +81 -79
- package/dist/components/foundations/confirm-dialog.js +136 -0
- package/dist/components/foundations/context-menu.js +43 -38
- package/dist/components/foundations/data-table.js +88 -84
- package/dist/components/foundations/dialog.js +45 -36
- package/dist/components/foundations/dropdown-menu.js +47 -42
- package/dist/components/foundations/file-input.js +97 -67
- package/dist/components/foundations/hover-card.js +21 -21
- package/dist/components/foundations/menubar.js +75 -69
- package/dist/components/foundations/navigation-menu.js +31 -26
- package/dist/components/foundations/pagination.js +54 -50
- package/dist/components/foundations/popover.js +7 -7
- package/dist/components/foundations/progress.js +10 -6
- package/dist/components/foundations/radio-group.js +6 -3
- package/dist/components/foundations/responsive-dialog.js +73 -55
- package/dist/components/foundations/scroll-area.js +18 -14
- package/dist/components/foundations/select.js +44 -39
- package/dist/components/foundations/sheet.js +45 -37
- package/dist/components/foundations/skeleton.js +6 -6
- package/dist/components/foundations/skip-link.js +10 -8
- package/dist/components/foundations/slider.js +73 -48
- package/dist/components/foundations/sonner.js +5 -4
- package/dist/components/foundations/spinner.js +7 -5
- package/dist/components/foundations/switch.js +11 -10
- package/dist/components/foundations/tabs.js +54 -39
- package/dist/components/foundations/toggle-group.js +29 -21
- package/dist/components/foundations/toggle.js +20 -16
- package/dist/components/primitives/admin-side-nav.js +65 -62
- package/dist/components/primitives/banner-carousel.js +32 -29
- package/dist/components/primitives/bottom-tab-bar.js +16 -15
- package/dist/components/primitives/category-scroll.js +39 -29
- package/dist/components/primitives/category-shortcuts.js +9 -9
- package/dist/components/primitives/chat-composer.js +77 -74
- package/dist/components/primitives/chip.js +84 -61
- package/dist/components/primitives/combobox.js +63 -47
- package/dist/components/primitives/container.js +9 -9
- package/dist/components/primitives/content-card.js +15 -17
- package/dist/components/primitives/content-carousel.js +79 -68
- package/dist/components/primitives/date-picker.js +137 -99
- package/dist/components/primitives/footer.js +36 -37
- package/dist/components/primitives/header.js +175 -168
- package/dist/components/primitives/image-carousel.js +107 -87
- package/dist/components/primitives/image-gallery.js +32 -27
- package/dist/components/primitives/image-uploader.js +43 -22
- package/dist/components/primitives/list-item.js +59 -51
- package/dist/components/primitives/menu-drawer.js +36 -38
- package/dist/components/primitives/multi-select.js +89 -58
- package/dist/components/primitives/notification-list.js +10 -9
- package/dist/components/primitives/number-input.js +116 -105
- package/dist/components/primitives/scroll-row.js +21 -0
- package/dist/components/primitives/search-bar.js +31 -28
- package/dist/components/primitives/section-header.js +54 -53
- package/dist/components/primitives/side-nav.js +57 -56
- package/dist/components/primitives/sub-nav.js +13 -14
- package/dist/components/primitives/tag.js +4 -2
- package/dist/index.css +1 -1
- package/dist/index.js +3076 -929
- package/dist/lib/field-labelling.js +31 -21
- package/dist/lib/focus-ring.js +22 -4
- package/dist/lib/high-contrast.js +4 -0
- package/dist/lib/image-index.js +8 -0
- package/dist/lib/use-prefers-reduced-motion.js +21 -0
- package/dist/types/components/ec/admin-shell.d.ts +11 -1
- package/dist/types/components/ec/anniversary-card.d.ts +9 -1
- package/dist/types/components/ec/mypage-shell.d.ts +12 -1
- package/dist/types/components/ec/product-card.d.ts +13 -1
- package/dist/types/components/ec/product-carousel.d.ts +13 -1
- package/dist/types/components/ec/product-detail-bar.d.ts +12 -1
- package/dist/types/components/ec/product-detail-sidebar.d.ts +11 -1
- package/dist/types/components/ec/product-list-item.d.ts +9 -1
- package/dist/types/components/ec/rating-stars.d.ts +2 -0
- package/dist/types/components/ec/review-card.d.ts +1 -1
- package/dist/types/components/ec/shop-card.d.ts +8 -1
- package/dist/types/components/foundations/badge.d.ts +1 -1
- package/dist/types/components/foundations/breadcrumb.d.ts +8 -1
- package/dist/types/components/foundations/button.d.ts +38 -3
- package/dist/types/components/foundations/checkbox-card.d.ts +7 -1
- package/dist/types/components/foundations/checkbox.d.ts +1 -1
- package/dist/types/components/foundations/chip-variants.d.ts +2 -2
- package/dist/types/components/foundations/confirm-dialog.d.ts +61 -0
- package/dist/types/components/foundations/data-table.d.ts +9 -2
- package/dist/types/components/foundations/dialog.d.ts +16 -1
- package/dist/types/components/foundations/pagination.d.ts +1 -1
- package/dist/types/components/foundations/responsive-dialog.d.ts +2 -1
- package/dist/types/components/foundations/sheet.d.ts +12 -1
- package/dist/types/components/foundations/skeleton.d.ts +6 -0
- package/dist/types/components/foundations/slider.d.ts +15 -1
- package/dist/types/components/foundations/tabs.d.ts +7 -0
- package/dist/types/components/primitives/admin-side-nav.d.ts +22 -2
- package/dist/types/components/primitives/banner-carousel.d.ts +9 -1
- package/dist/types/components/primitives/bottom-tab-bar.d.ts +13 -2
- package/dist/types/components/primitives/category-scroll.d.ts +10 -1
- package/dist/types/components/primitives/category-shortcuts.d.ts +11 -2
- package/dist/types/components/primitives/chip.d.ts +22 -3
- package/dist/types/components/primitives/combobox.d.ts +7 -2
- package/dist/types/components/primitives/container.d.ts +3 -0
- package/dist/types/components/primitives/content-card.d.ts +1 -1
- package/dist/types/components/primitives/content-carousel.d.ts +12 -4
- package/dist/types/components/primitives/date-picker.d.ts +10 -3
- package/dist/types/components/primitives/footer.d.ts +1 -1
- package/dist/types/components/primitives/header.d.ts +14 -2
- package/dist/types/components/primitives/image-carousel.d.ts +23 -5
- package/dist/types/components/primitives/list-item.d.ts +10 -1
- package/dist/types/components/primitives/menu-drawer.d.ts +1 -1
- package/dist/types/components/primitives/multi-select.d.ts +7 -2
- package/dist/types/components/primitives/notification-list.d.ts +10 -1
- package/dist/types/components/primitives/number-input.d.ts +18 -5
- package/dist/types/components/primitives/scroll-row.d.ts +43 -0
- package/dist/types/components/primitives/section-header.d.ts +9 -2
- package/dist/types/components/primitives/side-nav.d.ts +13 -1
- package/dist/types/components/primitives/sub-nav.d.ts +1 -1
- package/dist/types/components/primitives/tag.d.ts +1 -1
- package/dist/types/index.d.ts +7 -1
- package/dist/types/lib/field-labelling.d.ts +23 -8
- package/dist/types/lib/focus-ring.d.ts +70 -3
- package/dist/types/lib/high-contrast.d.ts +25 -0
- package/dist/types/lib/image-index.d.ts +2 -0
- package/dist/types/lib/link-component.d.ts +26 -21
- package/dist/types/lib/use-prefers-reduced-motion.d.ts +9 -0
- package/package.json +11 -3
- package/src/components/COMPONENT_LOOKUP.md +19 -17
- package/src/preset-standalone.css +42 -0
- package/src/preset.css +20 -1
- package/src/styles/semantic.css +57 -0
- package/templates/AGENTS.md +5 -1
- package/templates/CLAUDE.md +3 -1
- package/tokens.json +49 -0
- package/dist/lib/link-component.js +0 -6
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { CheckIcon as
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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-
|
|
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
|
|
72
|
+
function D({
|
|
71
73
|
className: e,
|
|
72
74
|
children: o,
|
|
73
75
|
checked: a,
|
|
74
76
|
...d
|
|
75
77
|
}) {
|
|
76
|
-
return /* @__PURE__ */
|
|
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-
|
|
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(
|
|
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
|
|
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
|
|
107
|
+
function N({
|
|
105
108
|
className: e,
|
|
106
109
|
children: o,
|
|
107
110
|
...a
|
|
108
111
|
}) {
|
|
109
|
-
return /* @__PURE__ */
|
|
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-
|
|
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(
|
|
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
|
|
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
|
|
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
|
|
181
|
+
function R({
|
|
178
182
|
className: e,
|
|
179
183
|
inset: o,
|
|
180
184
|
children: a,
|
|
181
185
|
...d
|
|
182
186
|
}) {
|
|
183
|
-
return /* @__PURE__ */
|
|
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-
|
|
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(
|
|
200
|
+
/* @__PURE__ */ t(l, { className: "ml-auto size-4" })
|
|
196
201
|
]
|
|
197
202
|
}
|
|
198
203
|
);
|
|
199
204
|
}
|
|
200
|
-
function
|
|
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
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
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
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
3
|
-
import * as
|
|
4
|
-
import { Paperclip as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { FOCUS_RING_WITHIN as
|
|
7
|
-
import { buttonVariants as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
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
|
|
12
|
-
if (i == null) return { accepted:
|
|
13
|
-
const
|
|
14
|
-
for (const
|
|
15
|
-
|
|
16
|
-
return { accepted:
|
|
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
|
|
19
|
-
|
|
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:
|
|
22
|
-
multiple:
|
|
23
|
-
maxSize:
|
|
24
|
-
disabled:
|
|
25
|
-
placeholder:
|
|
26
|
-
buttonLabel:
|
|
27
|
-
value:
|
|
28
|
-
onFilesChange:
|
|
29
|
-
onError:
|
|
30
|
-
className:
|
|
31
|
-
"aria-describedby":
|
|
32
|
-
"aria-invalid":
|
|
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
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
|
|
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:
|
|
77
|
+
className: b("flex min-w-0 items-center gap-2", I),
|
|
48
78
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ R(
|
|
50
80
|
"label",
|
|
51
81
|
{
|
|
52
|
-
className:
|
|
53
|
-
|
|
82
|
+
className: b(
|
|
83
|
+
A({ variant: "secondary", size: "default" }),
|
|
54
84
|
"relative cursor-pointer",
|
|
55
85
|
// フォーカス意匠は DS 共通(outline ではなく FOCUS_RING と同じリング)。
|
|
56
|
-
|
|
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
|
-
|
|
91
|
+
y && "pointer-events-none border-transparent bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]"
|
|
62
92
|
),
|
|
63
93
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ f(S, { className: "size-4", "aria-hidden": "true" }),
|
|
95
|
+
j,
|
|
96
|
+
/* @__PURE__ */ f(
|
|
67
97
|
"input",
|
|
68
98
|
{
|
|
69
|
-
ref:
|
|
70
|
-
id:
|
|
99
|
+
ref: e,
|
|
100
|
+
id: t,
|
|
71
101
|
name: i,
|
|
72
102
|
type: "file",
|
|
73
|
-
accept:
|
|
74
|
-
multiple:
|
|
75
|
-
disabled:
|
|
76
|
-
onChange:
|
|
77
|
-
"aria-describedby":
|
|
78
|
-
"aria-invalid":
|
|
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__ */
|
|
115
|
+
/* @__PURE__ */ f(
|
|
86
116
|
"span",
|
|
87
117
|
{
|
|
88
118
|
"data-slot": "file-input-filename",
|
|
89
|
-
className:
|
|
119
|
+
className: b(
|
|
90
120
|
"min-w-0 flex-1 truncate typo-body-md",
|
|
91
|
-
|
|
121
|
+
g ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]"
|
|
92
122
|
),
|
|
93
|
-
children:
|
|
123
|
+
children: g ? D : F
|
|
94
124
|
}
|
|
95
125
|
),
|
|
96
|
-
|
|
126
|
+
g && !y && /* @__PURE__ */ f(
|
|
97
127
|
"button",
|
|
98
128
|
{
|
|
99
129
|
type: "button",
|
|
100
130
|
"aria-label": "選択を解除",
|
|
101
|
-
onClick:
|
|
102
|
-
className:
|
|
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
|
-
|
|
134
|
+
U
|
|
105
135
|
),
|
|
106
|
-
children: /* @__PURE__ */
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
144
|
+
B as FileInput,
|
|
145
|
+
M as formatFileNames,
|
|
146
|
+
P as validateFileSize
|
|
117
147
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { jsx as
|
|
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
|
|
6
|
-
openDelay:
|
|
7
|
-
closeDelay:
|
|
8
|
-
...
|
|
5
|
+
function c({
|
|
6
|
+
openDelay: t = 200,
|
|
7
|
+
closeDelay: a = 100,
|
|
8
|
+
...e
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
10
|
+
return /* @__PURE__ */ o(r.Root, { "data-slot": "hover-card", openDelay: t, closeDelay: a, ...e });
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
...
|
|
12
|
+
function p({
|
|
13
|
+
...t
|
|
14
14
|
}) {
|
|
15
|
-
return /* @__PURE__ */
|
|
15
|
+
return /* @__PURE__ */ o(r.Trigger, { "data-slot": "hover-card-trigger", ...t });
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
className:
|
|
19
|
-
align:
|
|
20
|
-
sideOffset:
|
|
17
|
+
function v({
|
|
18
|
+
className: t,
|
|
19
|
+
align: a = "center",
|
|
20
|
+
sideOffset: e = 4,
|
|
21
21
|
...d
|
|
22
22
|
}) {
|
|
23
|
-
return /* @__PURE__ */
|
|
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:
|
|
28
|
-
sideOffset:
|
|
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
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
c as HoverCard,
|
|
39
|
+
v as HoverCardContent,
|
|
40
|
+
p as HoverCardTrigger
|
|
41
41
|
};
|