@cakejp/design-system 0.20.1 → 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 +172 -0
- package/CLAUDE.md +5 -3
- package/MIGRATION.md +3 -3
- package/README.md +31 -11
- package/contracts/components.json +420 -63
- 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 +87 -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 +6 -6
- 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 +3051 -924
- 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 +18 -16
- 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,93 +1,104 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { cn as
|
|
2
|
+
import { jsxs as V, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import * as l from "react";
|
|
4
|
+
import J from "iconsax-reactjs/dist/esm/Add.js";
|
|
5
|
+
import Q from "iconsax-reactjs/dist/esm/Minus.js";
|
|
6
|
+
import q from "iconsax-reactjs/dist/esm/Trash.js";
|
|
7
|
+
import { cn as n } from "../../lib/utils.js";
|
|
8
8
|
import { FOCUS_RING as c } from "../../lib/focus-ring.js";
|
|
9
|
-
|
|
9
|
+
import { HIGH_CONTRAST_OUTLINE as le } from "../../lib/high-contrast.js";
|
|
10
|
+
import { useFieldLabelling as ce, mergeIdRefs as ue } from "../../lib/field-labelling.js";
|
|
11
|
+
function de({
|
|
10
12
|
className: D,
|
|
11
|
-
value:
|
|
12
|
-
defaultValue:
|
|
13
|
-
min:
|
|
14
|
-
max:
|
|
15
|
-
step:
|
|
16
|
-
onChange:
|
|
13
|
+
value: M,
|
|
14
|
+
defaultValue: W,
|
|
15
|
+
min: u = 1,
|
|
16
|
+
max: S = 99,
|
|
17
|
+
step: O = 1,
|
|
18
|
+
onChange: X,
|
|
17
19
|
disabled: a = !1,
|
|
18
|
-
error:
|
|
19
|
-
size:
|
|
20
|
+
error: Y,
|
|
21
|
+
size: Z = "md",
|
|
20
22
|
editable: h = !0,
|
|
21
|
-
showTrash:
|
|
22
|
-
onDelete:
|
|
23
|
-
formatOptions:
|
|
24
|
-
locale:
|
|
25
|
-
inputId:
|
|
26
|
-
label:
|
|
27
|
-
...
|
|
23
|
+
showTrash: ee = !1,
|
|
24
|
+
onDelete: re,
|
|
25
|
+
formatOptions: I,
|
|
26
|
+
locale: te = "ja-JP",
|
|
27
|
+
inputId: ae,
|
|
28
|
+
label: H,
|
|
29
|
+
...z
|
|
28
30
|
}) {
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
const p = H ?? "数量", o = ce(), ne = l.useId(), s = H === void 0 ? o?.labelId : void 0, f = Y ?? !!o?.errorId, $ = s ? { "aria-labelledby": s } : { "aria-label": p }, L = ae ?? o?.controlId, A = {
|
|
32
|
+
...s ? { "aria-labelledby": s } : { "aria-label": `${p}を入力` },
|
|
33
|
+
"aria-describedby": o ? ue(o.descriptionId, o.errorId) : void 0,
|
|
34
|
+
"aria-invalid": f || void 0
|
|
35
|
+
}, B = (e, i, se) => {
|
|
36
|
+
if (!s) return { "aria-label": se };
|
|
37
|
+
const G = `${ne}-${e}`;
|
|
38
|
+
return { id: G, "aria-label": i, "aria-labelledby": `${s} ${G}` };
|
|
39
|
+
}, F = M !== void 0, P = l.useCallback(
|
|
40
|
+
(e) => Math.min(S, Math.max(u, e)),
|
|
41
|
+
[u, S]
|
|
42
|
+
), [ie, oe] = l.useState(() => P(W ?? u)), t = F ? M : ie, [E, N] = l.useState(!1), [T, d] = l.useState(String(t)), m = ee && t <= u, v = t > u && !a, b = t < S && !a, g = m && !a, R = m ? B("decrement", "削除", "削除") : B("decrement", "減らす", `${p}を減らす`), K = B("increment", "増やす", `${p}を増やす`), y = (e) => a ? { disabled: !0 } : { "aria-disabled": e ? void 0 : !0 };
|
|
43
|
+
l.useEffect(() => {
|
|
44
|
+
E || d(String(t));
|
|
45
|
+
}, [t, E]);
|
|
36
46
|
const k = (e) => {
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
if (
|
|
41
|
-
|
|
47
|
+
const i = P(e);
|
|
48
|
+
F || oe(i), d(String(i)), X?.(i);
|
|
49
|
+
}, j = () => {
|
|
50
|
+
if (m) {
|
|
51
|
+
re?.();
|
|
42
52
|
return;
|
|
43
53
|
}
|
|
44
|
-
|
|
45
|
-
}, j = () => {
|
|
46
|
-
d && k(t + B);
|
|
47
|
-
}, H = (e) => {
|
|
48
|
-
const o = e.target.value;
|
|
49
|
-
(o === "" || /^-?\d*$/.test(o)) && u(o);
|
|
54
|
+
v && k(t - O);
|
|
50
55
|
}, w = () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
b && k(t + O);
|
|
57
|
+
}, U = (e) => {
|
|
58
|
+
const i = e.target.value;
|
|
59
|
+
(i === "" || /^-?\d*$/.test(i)) && d(i);
|
|
60
|
+
}, C = () => {
|
|
61
|
+
const e = parseInt(T, 10);
|
|
62
|
+
k(Number.isNaN(e) ? t : e), N(!1);
|
|
63
|
+
}, _ = (e) => {
|
|
54
64
|
if (e.key === "Enter") {
|
|
55
|
-
|
|
65
|
+
C();
|
|
56
66
|
return;
|
|
57
67
|
}
|
|
58
|
-
e.key === "ArrowUp" && (e.preventDefault(),
|
|
59
|
-
},
|
|
60
|
-
return
|
|
68
|
+
e.key === "ArrowUp" && (e.preventDefault(), w()), e.key === "ArrowDown" && (e.preventDefault(), j());
|
|
69
|
+
}, x = E ? T : I ? new Intl.NumberFormat(te, I).format(t).replace(/¥/g, "¥") : T;
|
|
70
|
+
return Z === "sm" ? /* @__PURE__ */ V(
|
|
61
71
|
"div",
|
|
62
72
|
{
|
|
63
73
|
"data-slot": "number-input",
|
|
64
74
|
"data-editable": h || void 0,
|
|
65
|
-
className:
|
|
75
|
+
className: n(
|
|
66
76
|
// px-1(4px)は上下の余白((36-28)/2 = 4px)と揃える値。
|
|
67
77
|
// ホバー時の円が外枠に対して上下左右とも同じ内側余白で収まる
|
|
68
78
|
// shrink-0 必須: カート行など flex row の子として置かれるため、既定の flex-shrink:1 だと 108px が潰れる
|
|
69
79
|
"inline-flex h-9 w-[108px] shrink-0 items-center justify-between rounded-full bg-[var(--Surface-Tertiary)] px-1",
|
|
70
|
-
|
|
80
|
+
le,
|
|
81
|
+
f && "ring-2 ring-[var(--Surface-Caution)]",
|
|
71
82
|
a && "cursor-not-allowed",
|
|
72
83
|
D
|
|
73
84
|
),
|
|
74
85
|
role: "group",
|
|
75
|
-
|
|
76
|
-
...
|
|
86
|
+
...$,
|
|
87
|
+
...z,
|
|
77
88
|
children: [
|
|
78
89
|
/* @__PURE__ */ r(
|
|
79
90
|
"button",
|
|
80
91
|
{
|
|
81
92
|
type: "button",
|
|
82
|
-
className:
|
|
93
|
+
className: n(
|
|
83
94
|
"flex size-7 shrink-0 items-center justify-center rounded-full transition-colors outline-none",
|
|
84
95
|
c,
|
|
85
|
-
|
|
96
|
+
v || g ? "text-[var(--Object-High-Emphasis)] hover:bg-[var(--Overlay-Light)] active:bg-[var(--Overlay-Medium)]" : "text-[var(--Object-Disable)]"
|
|
86
97
|
),
|
|
87
|
-
onClick:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
children:
|
|
98
|
+
onClick: j,
|
|
99
|
+
...y(v || g),
|
|
100
|
+
...R,
|
|
101
|
+
children: m ? /* @__PURE__ */ r(q, { size: 14 }) : /* @__PURE__ */ r(Q, { size: 14 })
|
|
91
102
|
}
|
|
92
103
|
),
|
|
93
104
|
h ? /* @__PURE__ */ r(
|
|
@@ -96,76 +107,76 @@ function _({
|
|
|
96
107
|
type: "text",
|
|
97
108
|
inputMode: "numeric",
|
|
98
109
|
pattern: "[0-9]*",
|
|
99
|
-
id:
|
|
100
|
-
value:
|
|
110
|
+
id: L,
|
|
111
|
+
value: x,
|
|
101
112
|
onFocus: () => {
|
|
102
|
-
|
|
113
|
+
N(!0), d(String(t));
|
|
103
114
|
},
|
|
104
|
-
onChange:
|
|
105
|
-
onBlur:
|
|
106
|
-
onKeyDown:
|
|
115
|
+
onChange: U,
|
|
116
|
+
onBlur: C,
|
|
117
|
+
onKeyDown: _,
|
|
107
118
|
disabled: a,
|
|
108
|
-
className:
|
|
119
|
+
className: n(
|
|
109
120
|
"w-7 shrink-0 rounded bg-transparent text-center typo-label-md outline-none transition-colors",
|
|
110
121
|
"hover:bg-[var(--Overlay-Light)] focus-visible:bg-[var(--Surface-Primary)]",
|
|
111
122
|
c,
|
|
112
123
|
a ? "text-[var(--Text-Disable)]" : "text-[var(--Text-High-Emphasis)]"
|
|
113
124
|
),
|
|
114
|
-
|
|
125
|
+
...A,
|
|
115
126
|
"aria-live": "polite"
|
|
116
127
|
}
|
|
117
128
|
) : /* @__PURE__ */ r(
|
|
118
129
|
"span",
|
|
119
130
|
{
|
|
120
|
-
className:
|
|
131
|
+
className: n(
|
|
121
132
|
"w-7 shrink-0 select-none text-center typo-label-md",
|
|
122
133
|
a ? "text-[var(--Text-Disable)]" : "text-[var(--Text-High-Emphasis)]"
|
|
123
134
|
),
|
|
124
135
|
"aria-live": "polite",
|
|
125
136
|
"aria-atomic": "true",
|
|
126
|
-
children:
|
|
137
|
+
children: x
|
|
127
138
|
}
|
|
128
139
|
),
|
|
129
140
|
/* @__PURE__ */ r(
|
|
130
141
|
"button",
|
|
131
142
|
{
|
|
132
143
|
type: "button",
|
|
133
|
-
className:
|
|
144
|
+
className: n(
|
|
134
145
|
"flex size-7 shrink-0 items-center justify-center rounded-full transition-colors outline-none",
|
|
135
146
|
c,
|
|
136
|
-
|
|
147
|
+
b ? "text-[var(--Object-High-Emphasis)] hover:bg-[var(--Overlay-Light)] active:bg-[var(--Overlay-Medium)]" : "text-[var(--Object-Disable)]"
|
|
137
148
|
),
|
|
138
|
-
onClick:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
children: /* @__PURE__ */ r(
|
|
149
|
+
onClick: w,
|
|
150
|
+
...y(b),
|
|
151
|
+
...K,
|
|
152
|
+
children: /* @__PURE__ */ r(J, { size: 14 })
|
|
142
153
|
}
|
|
143
154
|
)
|
|
144
155
|
]
|
|
145
156
|
}
|
|
146
|
-
) : /* @__PURE__ */
|
|
157
|
+
) : /* @__PURE__ */ V(
|
|
147
158
|
"div",
|
|
148
159
|
{
|
|
149
160
|
"data-slot": "number-input",
|
|
150
161
|
"data-editable": h || void 0,
|
|
151
|
-
className:
|
|
162
|
+
className: n("inline-flex shrink-0 items-center gap-3", D),
|
|
152
163
|
role: "group",
|
|
153
|
-
|
|
154
|
-
...
|
|
164
|
+
...$,
|
|
165
|
+
...z,
|
|
155
166
|
children: [
|
|
156
167
|
/* @__PURE__ */ r(
|
|
157
168
|
"button",
|
|
158
169
|
{
|
|
159
170
|
type: "button",
|
|
160
|
-
className:
|
|
171
|
+
className: n(
|
|
161
172
|
"flex size-10 shrink-0 items-center justify-center rounded-full border transition-colors outline-none",
|
|
162
173
|
c,
|
|
163
|
-
|
|
174
|
+
v || g ? "border-[var(--Border-Control,var(--Border-Medium-Emphasis))] bg-[var(--Surface-Primary)] text-[var(--Object-High-Emphasis)] hover:border-[var(--Border-High-Emphasis)] hover:bg-[var(--Surface-Tertiary)] active:bg-[var(--Surface-Tertiary)]" : "border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Primary)] text-[var(--Object-Disable)]"
|
|
164
175
|
),
|
|
165
|
-
onClick:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
children:
|
|
176
|
+
onClick: j,
|
|
177
|
+
...y(v || g),
|
|
178
|
+
...R,
|
|
179
|
+
children: m ? /* @__PURE__ */ r(q, { size: 18 }) : /* @__PURE__ */ r(Q, { size: 18 })
|
|
169
180
|
}
|
|
170
181
|
),
|
|
171
182
|
h ? /* @__PURE__ */ r(
|
|
@@ -174,63 +185,63 @@ function _({
|
|
|
174
185
|
type: "text",
|
|
175
186
|
inputMode: "numeric",
|
|
176
187
|
pattern: "[0-9]*",
|
|
177
|
-
id:
|
|
178
|
-
value:
|
|
188
|
+
id: L,
|
|
189
|
+
value: x,
|
|
179
190
|
onFocus: () => {
|
|
180
|
-
|
|
191
|
+
N(!0), d(String(t));
|
|
181
192
|
},
|
|
182
|
-
onChange:
|
|
183
|
-
onBlur:
|
|
184
|
-
onKeyDown:
|
|
193
|
+
onChange: U,
|
|
194
|
+
onBlur: C,
|
|
195
|
+
onKeyDown: _,
|
|
185
196
|
disabled: a,
|
|
186
|
-
className:
|
|
197
|
+
className: n(
|
|
187
198
|
// formatOptions で桁が増えるため、内容に応じて広がるよう min-w にしている
|
|
188
199
|
"h-10 shrink-0 rounded-lg border text-center typo-label-lg outline-none transition-colors",
|
|
189
200
|
// 既定は Figma 準拠の固定幅。桁区切り・通貨表示のときだけ内容に追従させる
|
|
190
201
|
// (input は size 属性由来の既定幅を持つため、w-12 を外すと 200px 超に広がる)
|
|
191
|
-
|
|
192
|
-
|
|
202
|
+
I ? "field-sizing-content min-w-12 max-w-40 px-2" : "w-12",
|
|
203
|
+
f ? "border-[var(--Border-Caution)]" : "border-[var(--Border-Control,var(--Border-Medium-Emphasis))] hover:border-[var(--Border-High-Emphasis)]",
|
|
193
204
|
c,
|
|
194
205
|
a ? "bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]" : "bg-[var(--Surface-Secondary)] text-[var(--Text-High-Emphasis)]"
|
|
195
206
|
),
|
|
196
|
-
|
|
207
|
+
...A,
|
|
197
208
|
"aria-live": "polite"
|
|
198
209
|
}
|
|
199
210
|
) : /* @__PURE__ */ r(
|
|
200
211
|
"span",
|
|
201
212
|
{
|
|
202
|
-
className:
|
|
213
|
+
className: n(
|
|
203
214
|
// span は内容幅なので min-w-12 で Figma の 48px を下限にする
|
|
204
215
|
"flex h-10 min-w-12 shrink-0 items-center justify-center rounded-lg border px-2 text-center typo-label-lg",
|
|
205
|
-
|
|
216
|
+
f ? "border-[var(--Border-Caution)]" : "border-[var(--Border-Control,var(--Border-Medium-Emphasis))]",
|
|
206
217
|
a ? "bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]" : "bg-[var(--Surface-Secondary)] text-[var(--Text-High-Emphasis)]"
|
|
207
218
|
),
|
|
208
219
|
"aria-live": "polite",
|
|
209
220
|
"aria-atomic": "true",
|
|
210
|
-
children:
|
|
221
|
+
children: x
|
|
211
222
|
}
|
|
212
223
|
),
|
|
213
224
|
/* @__PURE__ */ r(
|
|
214
225
|
"button",
|
|
215
226
|
{
|
|
216
227
|
type: "button",
|
|
217
|
-
className:
|
|
228
|
+
className: n(
|
|
218
229
|
"flex size-10 shrink-0 items-center justify-center rounded-full border transition-colors outline-none",
|
|
219
230
|
c,
|
|
220
|
-
|
|
231
|
+
b ? "border-[var(--Border-Control,var(--Border-Medium-Emphasis))] bg-[var(--Surface-Primary)] text-[var(--Object-High-Emphasis)] hover:border-[var(--Border-High-Emphasis)] hover:bg-[var(--Surface-Tertiary)] active:bg-[var(--Surface-Tertiary)]" : "border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Primary)] text-[var(--Object-Disable)]"
|
|
221
232
|
),
|
|
222
|
-
onClick:
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
children: /* @__PURE__ */ r(
|
|
233
|
+
onClick: w,
|
|
234
|
+
...y(b),
|
|
235
|
+
...K,
|
|
236
|
+
children: /* @__PURE__ */ r(J, { size: 18 })
|
|
226
237
|
}
|
|
227
238
|
)
|
|
228
239
|
]
|
|
229
240
|
}
|
|
230
241
|
);
|
|
231
242
|
}
|
|
232
|
-
const
|
|
243
|
+
const xe = de;
|
|
233
244
|
export {
|
|
234
|
-
|
|
235
|
-
|
|
245
|
+
de as NumberInput,
|
|
246
|
+
xe as QuantitySelector
|
|
236
247
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as e } from "../../lib/utils.js";
|
|
4
|
+
function i({ bleed: r = !0, snap: o = !1, className: t, ...a }) {
|
|
5
|
+
return /* @__PURE__ */ n(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
"data-slot": "scroll-row",
|
|
9
|
+
className: e(
|
|
10
|
+
"-my-1 flex gap-3 overflow-x-auto py-1 [-webkit-overflow-scrolling:touch] *:shrink-0",
|
|
11
|
+
r && "-mx-[var(--Container-Gutter,0px)] px-[var(--Container-Gutter,0px)] scroll-px-[var(--Container-Gutter,0px)]",
|
|
12
|
+
o && "snap-x snap-mandatory *:snap-start",
|
|
13
|
+
t
|
|
14
|
+
),
|
|
15
|
+
...a
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
i as ScrollRow
|
|
21
|
+
};
|
|
@@ -3,44 +3,44 @@ import { jsxs as N, Fragment as S, jsx as o } from "react/jsx-runtime";
|
|
|
3
3
|
import * as s from "react";
|
|
4
4
|
import E from "iconsax-reactjs/dist/esm/SearchNormal1.js";
|
|
5
5
|
import { cn as i } from "../../lib/utils.js";
|
|
6
|
-
import { FOCUS_RING_INSET as
|
|
7
|
-
const
|
|
6
|
+
import { FOCUS_RING_INSET as C, FOCUS_RING_WITHIN as R } from "../../lib/focus-ring.js";
|
|
7
|
+
const B = s.forwardRef(
|
|
8
8
|
({
|
|
9
9
|
className: v,
|
|
10
10
|
placeholder: y = "キーワードを入力してください",
|
|
11
|
-
onSearch:
|
|
11
|
+
onSearch: l,
|
|
12
12
|
size: a = "md",
|
|
13
|
-
searchHref:
|
|
14
|
-
action:
|
|
13
|
+
searchHref: c,
|
|
14
|
+
action: m,
|
|
15
15
|
name: u,
|
|
16
16
|
...d
|
|
17
|
-
},
|
|
18
|
-
const t = !!
|
|
19
|
-
(
|
|
20
|
-
n.current =
|
|
17
|
+
}, e) => {
|
|
18
|
+
const t = !!m, n = s.useRef(null), x = s.useCallback(
|
|
19
|
+
(r) => {
|
|
20
|
+
n.current = r, typeof e == "function" ? e(r) : e && (e.current = r);
|
|
21
21
|
},
|
|
22
|
-
[
|
|
22
|
+
[e]
|
|
23
23
|
), h = () => {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const r = n.current?.value ?? "";
|
|
25
|
+
r.trim() && (l?.(r), c && (window.location.href = c.replace(
|
|
26
26
|
"{query}",
|
|
27
|
-
encodeURIComponent(
|
|
27
|
+
encodeURIComponent(r)
|
|
28
28
|
)));
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
},
|
|
29
|
+
}, w = (r) => {
|
|
30
|
+
r.key === "Enter" && !t && h(), d.onKeyDown?.(r);
|
|
31
|
+
}, g = (r) => {
|
|
32
32
|
const b = n.current?.value ?? "";
|
|
33
33
|
if (!b.trim()) {
|
|
34
|
-
|
|
34
|
+
r.preventDefault();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
l?.(b);
|
|
38
38
|
}, f = i(
|
|
39
|
-
"group flex items-center overflow-hidden rounded-lg border border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Secondary)] transition-colors",
|
|
39
|
+
"group flex items-center overflow-hidden rounded-lg border border-[var(--Border-Control,var(--Border-Medium-Emphasis))] bg-[var(--Surface-Secondary)] transition-colors",
|
|
40
40
|
// Tailwind の variant 順では focus-within が hover より先に出力される
|
|
41
41
|
// = hover が後勝ちしてフォーカス枠を潰すため、hover 側を明示的に抑制する。
|
|
42
42
|
"hover:not-focus-within:border-[var(--Border-High-Emphasis)]",
|
|
43
|
-
|
|
43
|
+
R,
|
|
44
44
|
a === "sm" ? "h-9" : "h-11",
|
|
45
45
|
v
|
|
46
46
|
), p = /* @__PURE__ */ N(S, { children: [
|
|
@@ -56,7 +56,7 @@ const C = s.forwardRef(
|
|
|
56
56
|
"min-w-0 flex-1 bg-transparent px-3 text-[var(--Text-High-Emphasis)] outline-none placeholder:text-[var(--Text-Low-Emphasis)]",
|
|
57
57
|
a === "sm" ? "typo-body-sm" : "typo-body-md"
|
|
58
58
|
),
|
|
59
|
-
onKeyDown:
|
|
59
|
+
onKeyDown: w,
|
|
60
60
|
...d
|
|
61
61
|
}
|
|
62
62
|
),
|
|
@@ -65,10 +65,13 @@ const C = s.forwardRef(
|
|
|
65
65
|
{
|
|
66
66
|
type: t ? "submit" : "button",
|
|
67
67
|
className: i(
|
|
68
|
-
"flex shrink-0 items-center justify-center border-l border-[var(--Border-Medium-Emphasis)] text-[var(--Text-Low-Emphasis)] transition-colors outline-none hover:bg-[var(--Surface-Tertiary)] hover:text-[var(--Text-High-Emphasis)]",
|
|
68
|
+
"flex shrink-0 items-center justify-center border-l border-[var(--Border-Control,var(--Border-Medium-Emphasis))] text-[var(--Text-Low-Emphasis)] transition-colors outline-none hover:bg-[var(--Surface-Tertiary)] hover:text-[var(--Text-High-Emphasis)]",
|
|
69
69
|
// 親が overflow-hidden なので外向きリングは切れる。内側に描く。
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
C,
|
|
71
|
+
// 高さは親の枠(border 1px)の内側いっぱい(h-full)。以前は親と同じ高さ(h-9 / h-11)で、
|
|
72
|
+
// 上下 1px が親の overflow-hidden に切り取られ、内側のリング・輪郭線も 1px 切れていた。
|
|
73
|
+
// 切られていた 1px は元から見えないので、静止時の見た目は変わらない
|
|
74
|
+
a === "sm" ? "h-full w-9" : "h-full w-11"
|
|
72
75
|
),
|
|
73
76
|
onClick: t ? void 0 : h,
|
|
74
77
|
"aria-label": "検索",
|
|
@@ -80,17 +83,17 @@ const C = s.forwardRef(
|
|
|
80
83
|
"form",
|
|
81
84
|
{
|
|
82
85
|
"data-slot": "search-bar",
|
|
83
|
-
action:
|
|
86
|
+
action: m,
|
|
84
87
|
method: "get",
|
|
85
88
|
role: "search",
|
|
86
|
-
onSubmit:
|
|
89
|
+
onSubmit: g,
|
|
87
90
|
className: f,
|
|
88
91
|
children: p
|
|
89
92
|
}
|
|
90
93
|
) : /* @__PURE__ */ o("div", { "data-slot": "search-bar", className: f, children: p });
|
|
91
94
|
}
|
|
92
95
|
);
|
|
93
|
-
|
|
96
|
+
B.displayName = "SearchBar";
|
|
94
97
|
export {
|
|
95
|
-
|
|
98
|
+
B as SearchBar
|
|
96
99
|
};
|