@cakejp/design-system 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/CLAUDE.md +1 -0
- package/bin/init.js +29 -6
- package/contracts/components.json +42 -7
- package/contracts/composition.json +8 -2
- package/contracts/rules.json +5 -1
- package/contracts/screen-patterns.json +1 -1
- package/dist/components/ec/_mypage-menu-data.js +166 -0
- package/dist/components/ec/admin-shell.js +202 -0
- package/dist/components/ec/anniversary-card.js +63 -0
- package/dist/components/ec/cake-logo.js +38 -0
- package/dist/components/ec/chart-controls.js +91 -0
- package/dist/components/ec/countdown-timer.js +50 -0
- package/dist/components/ec/coupon-card.js +136 -0
- package/dist/components/ec/delivery-calendar.js +105 -0
- package/dist/components/ec/mypage-shell.js +98 -0
- package/dist/components/ec/order-section.js +53 -0
- package/dist/components/ec/order-summary.js +78 -0
- package/dist/components/ec/payment-method.js +81 -0
- package/dist/components/ec/product-card.js +235 -0
- package/dist/components/ec/product-carousel.js +106 -0
- package/dist/components/ec/product-cta.js +80 -0
- package/dist/components/ec/product-detail-bar.js +86 -0
- package/dist/components/ec/product-detail-sidebar.js +296 -0
- package/dist/components/ec/product-list-item.js +266 -0
- package/dist/components/ec/product-option.js +165 -0
- package/dist/components/ec/rating-stars.js +74 -0
- package/dist/components/ec/review-card.js +126 -0
- package/dist/components/ec/review-form.js +181 -0
- package/dist/components/ec/review-summary.js +95 -0
- package/dist/components/ec/shop-card.js +179 -0
- package/dist/components/ec/stat-card.js +50 -0
- package/dist/components/foundations/accordion.js +67 -0
- package/dist/components/foundations/alert-dialog.js +165 -0
- package/dist/components/foundations/alert.js +218 -0
- package/dist/components/foundations/aspect-ratio.js +10 -0
- package/dist/components/foundations/avatar.js +58 -0
- package/dist/components/foundations/badge.js +54 -0
- package/dist/components/foundations/breadcrumb.js +104 -0
- package/dist/components/foundations/button.js +99 -0
- package/dist/components/foundations/calendar.js +173 -0
- package/dist/components/foundations/card.js +109 -0
- package/dist/components/foundations/checkbox-card.js +111 -0
- package/dist/components/foundations/checkbox-group.js +92 -0
- package/dist/components/foundations/checkbox.js +90 -0
- package/dist/components/foundations/chip-variants.js +41 -0
- package/dist/components/foundations/collapsible.js +34 -0
- package/dist/components/foundations/command.js +171 -0
- package/dist/components/foundations/context-menu.js +225 -0
- package/dist/components/foundations/data-table.js +59 -0
- package/dist/components/foundations/dialog.js +148 -0
- package/dist/components/foundations/drawer.js +129 -0
- package/dist/components/foundations/dropdown-menu.js +232 -0
- package/dist/components/foundations/field.js +150 -0
- package/dist/components/foundations/file-input.js +116 -0
- package/dist/components/foundations/form.js +101 -0
- package/dist/components/foundations/hover-card.js +41 -0
- package/dist/components/foundations/icon-badge.js +41 -0
- package/dist/components/foundations/input.js +74 -0
- package/dist/components/foundations/label.js +29 -0
- package/dist/components/foundations/menubar.js +252 -0
- package/dist/components/foundations/navigation-menu.js +171 -0
- package/dist/components/foundations/pagination.js +120 -0
- package/dist/components/foundations/popover.js +45 -0
- package/dist/components/foundations/progress.js +34 -0
- package/dist/components/foundations/radio-group.js +134 -0
- package/dist/components/foundations/responsive-dialog.js +76 -0
- package/dist/components/foundations/scroll-area.js +62 -0
- package/dist/components/foundations/select.js +190 -0
- package/dist/components/foundations/separator.js +27 -0
- package/dist/components/foundations/sheet.js +130 -0
- package/dist/components/foundations/skeleton.js +15 -0
- package/dist/components/foundations/skip-link.js +27 -0
- package/dist/components/foundations/slider.js +81 -0
- package/dist/components/foundations/social-icon.js +36 -0
- package/dist/components/foundations/sonner.js +49 -0
- package/dist/components/foundations/spinner.js +28 -0
- package/dist/components/foundations/switch.js +54 -0
- package/dist/components/foundations/table.js +115 -0
- package/dist/components/foundations/tabs.js +102 -0
- package/dist/components/foundations/textarea.js +65 -0
- package/dist/components/foundations/toggle-group.js +107 -0
- package/dist/components/foundations/toggle.js +44 -0
- package/dist/components/foundations/tooltip.js +56 -0
- package/dist/components/primitives/admin-header.js +31 -0
- package/dist/components/primitives/admin-side-nav.js +135 -0
- package/dist/components/primitives/banner-carousel.js +97 -0
- package/dist/components/primitives/bottom-tab-bar.js +81 -0
- package/dist/components/primitives/bulk-action-bar.js +27 -0
- package/dist/components/primitives/category-scroll.js +110 -0
- package/dist/components/primitives/category-shortcuts.js +66 -0
- package/dist/components/primitives/chat-composer.js +141 -0
- package/dist/components/primitives/chip.js +123 -0
- package/dist/components/primitives/coach-mark.js +102 -0
- package/dist/components/primitives/combobox.js +88 -0
- package/dist/components/primitives/container.js +50 -0
- package/dist/components/primitives/content-carousel.js +144 -0
- package/dist/components/primitives/date-picker.js +175 -0
- package/dist/components/primitives/empty-state.js +32 -0
- package/dist/components/primitives/error-state.js +115 -0
- package/dist/components/primitives/filter-bar.js +144 -0
- package/dist/components/primitives/footer.js +247 -0
- package/dist/components/primitives/form-field.js +38 -0
- package/dist/components/primitives/funnel-shell.js +99 -0
- package/dist/components/primitives/header.js +257 -0
- package/dist/components/primitives/image-carousel.js +156 -0
- package/dist/components/primitives/image-gallery.js +177 -0
- package/dist/components/primitives/image-input.js +207 -0
- package/dist/components/primitives/image-uploader.js +69 -0
- package/dist/components/primitives/kebab-menu.js +40 -0
- package/dist/components/primitives/list-item.js +80 -0
- package/dist/components/primitives/menu-drawer.js +154 -0
- package/dist/components/primitives/multi-select.js +93 -0
- package/dist/components/primitives/notification-badge.js +61 -0
- package/dist/components/primitives/notification-list.js +72 -0
- package/dist/components/primitives/number-input.js +235 -0
- package/dist/components/primitives/price-display.js +101 -0
- package/dist/components/primitives/progress-steps.js +62 -0
- package/dist/components/primitives/search-bar.js +81 -0
- package/dist/components/primitives/search-panel.js +43 -0
- package/dist/components/primitives/section-header.js +148 -0
- package/dist/components/primitives/section-nav.js +85 -0
- package/dist/components/primitives/section.js +78 -0
- package/dist/components/primitives/share-buttons.js +102 -0
- package/dist/components/primitives/side-nav.js +98 -0
- package/dist/components/primitives/social-login-button.js +53 -0
- package/dist/components/primitives/standard-page-shell.js +34 -0
- package/dist/components/primitives/status-count-tabs.js +42 -0
- package/dist/components/primitives/sticky-action-bar.js +26 -0
- package/dist/components/primitives/sub-nav.js +67 -0
- package/dist/components/primitives/tag.js +57 -0
- package/dist/components/primitives/timeline.js +55 -0
- package/dist/components/primitives/workspace-shell.js +57 -0
- package/dist/index.css +1 -1
- package/dist/index.js +22961 -13130
- package/dist/lib/field-labelling.js +29 -0
- package/dist/lib/focus-ring.js +6 -0
- package/dist/lib/pagination-range.js +42 -0
- package/dist/lib/use-value-length.js +63 -0
- package/dist/lib/utils.js +33 -0
- package/dist/types/components/ec/_mypage-menu-data.d.ts +3 -3
- package/dist/types/components/ec/admin-shell.d.ts +1 -1
- package/dist/types/components/ec/anniversary-card.d.ts +1 -1
- package/dist/types/components/ec/mypage-shell.d.ts +3 -3
- package/dist/types/components/ec/product-card.d.ts +1 -1
- package/dist/types/components/ec/product-carousel.d.ts +3 -3
- package/dist/types/components/ec/stat-card.d.ts +1 -1
- package/dist/types/components/foundations/accordion.d.ts +8 -1
- package/dist/types/components/foundations/alert-dialog.d.ts +1 -1
- package/dist/types/components/foundations/calendar.d.ts +1 -1
- package/dist/types/components/foundations/checkbox-group.d.ts +1 -1
- package/dist/types/components/foundations/command.d.ts +1 -1
- package/dist/types/components/foundations/data-table.d.ts +6 -1
- package/dist/types/components/foundations/field.d.ts +2 -2
- package/dist/types/components/foundations/file-input.d.ts +1 -1
- package/dist/types/components/foundations/pagination.d.ts +1 -1
- package/dist/types/components/foundations/responsive-dialog.d.ts +1 -1
- package/dist/types/components/foundations/skip-link.d.ts +1 -1
- package/dist/types/components/foundations/slider.d.ts +13 -1
- package/dist/types/components/primitives/admin-header.d.ts +11 -1
- package/dist/types/components/primitives/admin-side-nav.d.ts +19 -1
- package/dist/types/components/primitives/banner-carousel.d.ts +2 -2
- package/dist/types/components/primitives/category-scroll.d.ts +2 -2
- package/dist/types/components/primitives/category-shortcuts.d.ts +1 -1
- package/dist/types/components/primitives/chat-composer.d.ts +1 -1
- package/dist/types/components/primitives/chip.d.ts +1 -1
- package/dist/types/components/primitives/combobox.d.ts +9 -1
- package/dist/types/components/primitives/content-carousel.d.ts +1 -1
- package/dist/types/components/primitives/form-field.d.ts +1 -1
- package/dist/types/components/primitives/image-input.d.ts +1 -1
- package/dist/types/components/primitives/kebab-menu.d.ts +1 -1
- package/dist/types/components/primitives/menu-drawer.d.ts +0 -16
- package/dist/types/components/primitives/multi-select.d.ts +9 -1
- package/dist/types/components/primitives/notification-list.d.ts +1 -1
- package/dist/types/components/primitives/search-panel.d.ts +1 -1
- package/dist/types/components/primitives/section-nav.d.ts +1 -1
- package/dist/types/components/primitives/side-nav.d.ts +1 -1
- package/dist/types/components/primitives/social-login-button.d.ts +1 -1
- package/dist/types/lib/field-labelling.d.ts +66 -0
- package/package.json +2 -2
- package/scripts/codemod/README.md +9 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as o, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva as h } from "class-variance-authority";
|
|
4
|
+
import { cn as v } from "../../lib/utils.js";
|
|
5
|
+
const b = h(
|
|
6
|
+
"absolute flex items-center justify-center rounded-full typo-label-xs",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
color: {
|
|
10
|
+
red: "bg-[var(--Surface-Caution)] text-[var(--Text-on-Inverse)]",
|
|
11
|
+
green: "bg-[var(--Surface-Success)] text-[var(--Text-on-Inverse)]"
|
|
12
|
+
},
|
|
13
|
+
size: {
|
|
14
|
+
sm: "",
|
|
15
|
+
md: ""
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
color: "red",
|
|
20
|
+
size: "sm"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
function j({
|
|
25
|
+
className: c,
|
|
26
|
+
children: i,
|
|
27
|
+
count: e,
|
|
28
|
+
max: n = 99,
|
|
29
|
+
dot: r = !1,
|
|
30
|
+
hidden: m = !1,
|
|
31
|
+
color: f,
|
|
32
|
+
size: t = "sm",
|
|
33
|
+
...p
|
|
34
|
+
}) {
|
|
35
|
+
if (m || e != null && e <= 0 && !r)
|
|
36
|
+
return /* @__PURE__ */ o("span", { className: "relative inline-flex", children: i });
|
|
37
|
+
const a = r || e == null, s = e != null ? e > n ? `${n}+` : String(e) : void 0, l = s != null && s.length > 1, u = t === "sm" ? "h-2 w-2" : "h-2.5 w-2.5", d = t === "sm" ? l ? "h-3.5 min-w-3.5 px-1" : "h-3.5 w-3.5" : l ? "h-4 min-w-4 px-1" : "h-4 w-4", x = a ? "-right-0.5 -top-0.5" : "-right-1.5 -top-1";
|
|
38
|
+
return /* @__PURE__ */ g("span", { className: "relative inline-flex", children: [
|
|
39
|
+
i,
|
|
40
|
+
/* @__PURE__ */ o(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "notification-badge",
|
|
44
|
+
className: v(
|
|
45
|
+
b({ color: f, size: t }),
|
|
46
|
+
x,
|
|
47
|
+
a ? u : d,
|
|
48
|
+
c
|
|
49
|
+
),
|
|
50
|
+
role: "status",
|
|
51
|
+
"aria-label": s ? `${s}件の通知` : "通知あり",
|
|
52
|
+
...p,
|
|
53
|
+
children: !a && s
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
j as NotificationBadge,
|
|
60
|
+
b as notificationBadgeVariants
|
|
61
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import d from "iconsax-reactjs/dist/esm/Notification.js";
|
|
4
|
+
import h from "iconsax-reactjs/dist/esm/ArrowRight2.js";
|
|
5
|
+
import { Badge as m } from "../foundations/badge.js";
|
|
6
|
+
import { cn as l } from "../../lib/utils.js";
|
|
7
|
+
function g({
|
|
8
|
+
notifications: r,
|
|
9
|
+
variant: n = "vertical",
|
|
10
|
+
emptyMessage: c = "新着のお知らせはありません",
|
|
11
|
+
className: i,
|
|
12
|
+
...t
|
|
13
|
+
}) {
|
|
14
|
+
return r.length === 0 ? /* @__PURE__ */ s(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
"data-slot": "notification-list",
|
|
18
|
+
className: l(
|
|
19
|
+
"flex flex-col items-center justify-center gap-3 py-12",
|
|
20
|
+
i
|
|
21
|
+
),
|
|
22
|
+
...t,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ a(d, { size: 48, className: "text-[var(--Text-Low-Emphasis)]" }),
|
|
25
|
+
/* @__PURE__ */ a("p", { className: "typo-body-sm text-[var(--Text-Low-Emphasis)]", children: c })
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
) : /* @__PURE__ */ a(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
"data-slot": "notification-list",
|
|
32
|
+
className: l("w-full divide-y divide-[var(--Border-Low-Emphasis)]", i),
|
|
33
|
+
...t,
|
|
34
|
+
children: r.map((e) => {
|
|
35
|
+
const o = e.href ? "a" : "div";
|
|
36
|
+
return n === "horizontal" ? /* @__PURE__ */ s(
|
|
37
|
+
o,
|
|
38
|
+
{
|
|
39
|
+
...e.href ? { href: e.href } : {},
|
|
40
|
+
className: "flex items-center gap-3 px-4 py-3 transition-colors hover:bg-[var(--Surface-Secondary)]",
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ a("span", { className: "typo-body-sm text-[var(--Text-Low-Emphasis)] shrink-0 w-[88px]", children: e.date }),
|
|
43
|
+
/* @__PURE__ */ s("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
44
|
+
e.isUnread && /* @__PURE__ */ a(m, { variant: "destructive", className: "shrink-0 w-fit", children: "NEW" }),
|
|
45
|
+
/* @__PURE__ */ a("span", { className: "typo-body-md text-[var(--Text-High-Emphasis)] truncate", children: e.message })
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ a(h, { size: 16, className: "text-[var(--Text-Low-Emphasis)] shrink-0 ml-auto" })
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
e.id
|
|
51
|
+
) : /* @__PURE__ */ s(
|
|
52
|
+
o,
|
|
53
|
+
{
|
|
54
|
+
...e.href ? { href: e.href } : {},
|
|
55
|
+
className: "flex items-start gap-3 px-4 py-3.5 transition-colors hover:bg-[var(--Surface-Secondary)]",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ a("div", { className: "flex shrink-0 items-center pt-1.5", children: e.isUnread ? /* @__PURE__ */ a("span", { className: "size-2 rounded-full bg-[var(--Brand-Cake-Orange)]" }) : /* @__PURE__ */ a("span", { className: "size-2" }) }),
|
|
58
|
+
/* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
|
|
59
|
+
/* @__PURE__ */ a("p", { className: "typo-body-md text-[var(--Text-High-Emphasis)]", children: e.message }),
|
|
60
|
+
/* @__PURE__ */ a("p", { className: "mt-0.5 typo-body-sm text-[var(--Text-Low-Emphasis)]", children: e.date })
|
|
61
|
+
] })
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
e.id
|
|
65
|
+
);
|
|
66
|
+
})
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
g as NotificationList
|
|
72
|
+
};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { jsxs as $, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as v from "react";
|
|
3
|
+
import P from "iconsax-reactjs/dist/esm/Add.js";
|
|
4
|
+
import F from "iconsax-reactjs/dist/esm/Minus.js";
|
|
5
|
+
import A from "iconsax-reactjs/dist/esm/Trash.js";
|
|
6
|
+
import { cn as i } from "../../lib/utils.js";
|
|
7
|
+
import { FOCUS_RING as c } from "../../lib/focus-ring.js";
|
|
8
|
+
function _({
|
|
9
|
+
className: D,
|
|
10
|
+
value: N,
|
|
11
|
+
defaultValue: K,
|
|
12
|
+
min: l = 1,
|
|
13
|
+
max: f = 99,
|
|
14
|
+
step: B = 1,
|
|
15
|
+
onChange: L,
|
|
16
|
+
disabled: a = !1,
|
|
17
|
+
error: g = !1,
|
|
18
|
+
size: R = "md",
|
|
19
|
+
editable: h = !0,
|
|
20
|
+
showTrash: U = !1,
|
|
21
|
+
onDelete: V,
|
|
22
|
+
formatOptions: x,
|
|
23
|
+
locale: G = "ja-JP",
|
|
24
|
+
inputId: M,
|
|
25
|
+
label: n = "数量",
|
|
26
|
+
...C
|
|
27
|
+
}) {
|
|
28
|
+
const O = N !== void 0, z = v.useCallback(
|
|
29
|
+
(e) => Math.min(f, Math.max(l, e)),
|
|
30
|
+
[l, f]
|
|
31
|
+
), [J, Q] = v.useState(() => z(K ?? l)), t = O ? N : J, [y, S] = v.useState(!1), [E, u] = v.useState(String(t)), s = U && t <= l, m = t > l && !a, d = t < f && !a, b = s && !a;
|
|
32
|
+
v.useEffect(() => {
|
|
33
|
+
y || u(String(t));
|
|
34
|
+
}, [t, y]);
|
|
35
|
+
const k = (e) => {
|
|
36
|
+
const o = z(e);
|
|
37
|
+
O || Q(o), u(String(o)), L?.(o);
|
|
38
|
+
}, T = () => {
|
|
39
|
+
if (s) {
|
|
40
|
+
V?.();
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
m && k(t - B);
|
|
44
|
+
}, j = () => {
|
|
45
|
+
d && k(t + B);
|
|
46
|
+
}, H = (e) => {
|
|
47
|
+
const o = e.target.value;
|
|
48
|
+
(o === "" || /^-?\d*$/.test(o)) && u(o);
|
|
49
|
+
}, w = () => {
|
|
50
|
+
const e = parseInt(E, 10);
|
|
51
|
+
k(Number.isNaN(e) ? t : e), S(!1);
|
|
52
|
+
}, I = (e) => {
|
|
53
|
+
if (e.key === "Enter") {
|
|
54
|
+
w();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
e.key === "ArrowUp" && (e.preventDefault(), j()), e.key === "ArrowDown" && (e.preventDefault(), T());
|
|
58
|
+
}, p = y ? E : x ? new Intl.NumberFormat(G, x).format(t).replace(/¥/g, "¥") : E;
|
|
59
|
+
return R === "sm" ? /* @__PURE__ */ $(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
"data-slot": "number-input",
|
|
63
|
+
"data-editable": h || void 0,
|
|
64
|
+
className: i(
|
|
65
|
+
// px-1(4px)は上下の余白((36-28)/2 = 4px)と揃える値。
|
|
66
|
+
// ホバー時の円が外枠に対して上下左右とも同じ内側余白で収まる
|
|
67
|
+
// shrink-0 必須: カート行など flex row の子として置かれるため、既定の flex-shrink:1 だと 108px が潰れる
|
|
68
|
+
"inline-flex h-9 w-[108px] shrink-0 items-center justify-between rounded-full bg-[var(--Surface-Tertiary)] px-1",
|
|
69
|
+
g && "ring-2 ring-[var(--Surface-Caution)]",
|
|
70
|
+
a && "cursor-not-allowed",
|
|
71
|
+
D
|
|
72
|
+
),
|
|
73
|
+
role: "group",
|
|
74
|
+
"aria-label": n,
|
|
75
|
+
...C,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ r(
|
|
78
|
+
"button",
|
|
79
|
+
{
|
|
80
|
+
type: "button",
|
|
81
|
+
className: i(
|
|
82
|
+
"flex size-7 shrink-0 items-center justify-center rounded-full transition-colors outline-none",
|
|
83
|
+
c,
|
|
84
|
+
m || b ? "text-[var(--Object-High-Emphasis)] hover:bg-[var(--Overlay-Light)] active:bg-[var(--Overlay-Medium)]" : "text-[var(--Object-Disable)]"
|
|
85
|
+
),
|
|
86
|
+
onClick: T,
|
|
87
|
+
disabled: !(m || b),
|
|
88
|
+
"aria-label": s ? "削除" : `${n}を減らす`,
|
|
89
|
+
children: s ? /* @__PURE__ */ r(A, { size: 14 }) : /* @__PURE__ */ r(F, { size: 14 })
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
h ? /* @__PURE__ */ r(
|
|
93
|
+
"input",
|
|
94
|
+
{
|
|
95
|
+
type: "text",
|
|
96
|
+
inputMode: "numeric",
|
|
97
|
+
pattern: "[0-9]*",
|
|
98
|
+
id: M,
|
|
99
|
+
value: p,
|
|
100
|
+
onFocus: () => {
|
|
101
|
+
S(!0), u(String(t));
|
|
102
|
+
},
|
|
103
|
+
onChange: H,
|
|
104
|
+
onBlur: w,
|
|
105
|
+
onKeyDown: I,
|
|
106
|
+
disabled: a,
|
|
107
|
+
className: i(
|
|
108
|
+
"w-7 shrink-0 rounded bg-transparent text-center typo-label-md outline-none transition-colors",
|
|
109
|
+
"hover:bg-[var(--Overlay-Light)] focus-visible:bg-[var(--Surface-Primary)]",
|
|
110
|
+
c,
|
|
111
|
+
a ? "text-[var(--Text-Disable)]" : "text-[var(--Text-High-Emphasis)]"
|
|
112
|
+
),
|
|
113
|
+
"aria-label": `${n}を入力`,
|
|
114
|
+
"aria-live": "polite"
|
|
115
|
+
}
|
|
116
|
+
) : /* @__PURE__ */ r(
|
|
117
|
+
"span",
|
|
118
|
+
{
|
|
119
|
+
className: i(
|
|
120
|
+
"w-7 shrink-0 select-none text-center typo-label-md",
|
|
121
|
+
a ? "text-[var(--Text-Disable)]" : "text-[var(--Text-High-Emphasis)]"
|
|
122
|
+
),
|
|
123
|
+
"aria-live": "polite",
|
|
124
|
+
"aria-atomic": "true",
|
|
125
|
+
children: p
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
/* @__PURE__ */ r(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
type: "button",
|
|
132
|
+
className: i(
|
|
133
|
+
"flex size-7 shrink-0 items-center justify-center rounded-full transition-colors outline-none",
|
|
134
|
+
c,
|
|
135
|
+
d ? "text-[var(--Object-High-Emphasis)] hover:bg-[var(--Overlay-Light)] active:bg-[var(--Overlay-Medium)]" : "text-[var(--Object-Disable)]"
|
|
136
|
+
),
|
|
137
|
+
onClick: j,
|
|
138
|
+
disabled: !d,
|
|
139
|
+
"aria-label": `${n}を増やす`,
|
|
140
|
+
children: /* @__PURE__ */ r(P, { size: 14 })
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
) : /* @__PURE__ */ $(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
"data-slot": "number-input",
|
|
149
|
+
"data-editable": h || void 0,
|
|
150
|
+
className: i("inline-flex shrink-0 items-center gap-3", D),
|
|
151
|
+
role: "group",
|
|
152
|
+
"aria-label": n,
|
|
153
|
+
...C,
|
|
154
|
+
children: [
|
|
155
|
+
/* @__PURE__ */ r(
|
|
156
|
+
"button",
|
|
157
|
+
{
|
|
158
|
+
type: "button",
|
|
159
|
+
className: i(
|
|
160
|
+
"flex size-10 shrink-0 items-center justify-center rounded-full border transition-colors outline-none",
|
|
161
|
+
c,
|
|
162
|
+
m || b ? "border-[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)]"
|
|
163
|
+
),
|
|
164
|
+
onClick: T,
|
|
165
|
+
disabled: !(m || b),
|
|
166
|
+
"aria-label": s ? "削除" : `${n}を減らす`,
|
|
167
|
+
children: s ? /* @__PURE__ */ r(A, { size: 18 }) : /* @__PURE__ */ r(F, { size: 18 })
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
h ? /* @__PURE__ */ r(
|
|
171
|
+
"input",
|
|
172
|
+
{
|
|
173
|
+
type: "text",
|
|
174
|
+
inputMode: "numeric",
|
|
175
|
+
pattern: "[0-9]*",
|
|
176
|
+
id: M,
|
|
177
|
+
value: p,
|
|
178
|
+
onFocus: () => {
|
|
179
|
+
S(!0), u(String(t));
|
|
180
|
+
},
|
|
181
|
+
onChange: H,
|
|
182
|
+
onBlur: w,
|
|
183
|
+
onKeyDown: I,
|
|
184
|
+
disabled: a,
|
|
185
|
+
className: i(
|
|
186
|
+
// formatOptions で桁が増えるため、内容に応じて広がるよう min-w にしている
|
|
187
|
+
"h-10 shrink-0 rounded-lg border text-center typo-label-lg outline-none transition-colors",
|
|
188
|
+
// 既定は Figma 準拠の固定幅。桁区切り・通貨表示のときだけ内容に追従させる
|
|
189
|
+
// (input は size 属性由来の既定幅を持つため、w-12 を外すと 200px 超に広がる)
|
|
190
|
+
x ? "field-sizing-content min-w-12 max-w-40 px-2" : "w-12",
|
|
191
|
+
g ? "border-[var(--Border-Caution)]" : "border-[var(--Border-Medium-Emphasis)] hover:border-[var(--Border-High-Emphasis)]",
|
|
192
|
+
c,
|
|
193
|
+
a ? "bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]" : "bg-[var(--Surface-Secondary)] text-[var(--Text-High-Emphasis)]"
|
|
194
|
+
),
|
|
195
|
+
"aria-label": `${n}を入力`,
|
|
196
|
+
"aria-live": "polite"
|
|
197
|
+
}
|
|
198
|
+
) : /* @__PURE__ */ r(
|
|
199
|
+
"span",
|
|
200
|
+
{
|
|
201
|
+
className: i(
|
|
202
|
+
// span は内容幅なので min-w-12 で Figma の 48px を下限にする
|
|
203
|
+
"flex h-10 min-w-12 shrink-0 items-center justify-center rounded-lg border px-2 text-center typo-label-lg",
|
|
204
|
+
g ? "border-[var(--Border-Caution)]" : "border-[var(--Border-Medium-Emphasis)]",
|
|
205
|
+
a ? "bg-[var(--Surface-Tertiary)] text-[var(--Text-Disable)]" : "bg-[var(--Surface-Secondary)] text-[var(--Text-High-Emphasis)]"
|
|
206
|
+
),
|
|
207
|
+
"aria-live": "polite",
|
|
208
|
+
"aria-atomic": "true",
|
|
209
|
+
children: p
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
/* @__PURE__ */ r(
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
type: "button",
|
|
216
|
+
className: i(
|
|
217
|
+
"flex size-10 shrink-0 items-center justify-center rounded-full border transition-colors outline-none",
|
|
218
|
+
c,
|
|
219
|
+
d ? "border-[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)]"
|
|
220
|
+
),
|
|
221
|
+
onClick: j,
|
|
222
|
+
disabled: !d,
|
|
223
|
+
"aria-label": `${n}を増やす`,
|
|
224
|
+
children: /* @__PURE__ */ r(P, { size: 18 })
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
]
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
const re = _;
|
|
232
|
+
export {
|
|
233
|
+
_ as NumberInput,
|
|
234
|
+
re as QuantitySelector
|
|
235
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsxs as o, Fragment as g, jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cva as $ } from "class-variance-authority";
|
|
4
|
+
import { cn as s } from "../../lib/utils.js";
|
|
5
|
+
const v = $("inline-flex items-baseline gap-0.5 text-[var(--Text-High-Emphasis)]", {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: "typo-label-md",
|
|
9
|
+
md: "typo-label-lg",
|
|
10
|
+
lg: "typo-heading-lg",
|
|
11
|
+
xl: "typo-heading-3xl"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: "md"
|
|
16
|
+
}
|
|
17
|
+
}), L = {
|
|
18
|
+
sm: "typo-body-xs",
|
|
19
|
+
md: "typo-body-sm",
|
|
20
|
+
lg: "typo-body-md",
|
|
21
|
+
xl: "typo-body-lg"
|
|
22
|
+
}, S = {
|
|
23
|
+
sm: "typo-body-xs",
|
|
24
|
+
md: "typo-body-xs",
|
|
25
|
+
lg: "typo-body-sm",
|
|
26
|
+
xl: "typo-body-lg"
|
|
27
|
+
};
|
|
28
|
+
function T({
|
|
29
|
+
className: h,
|
|
30
|
+
price: l,
|
|
31
|
+
maxPrice: e,
|
|
32
|
+
originalPrice: i,
|
|
33
|
+
showTaxLabel: y = !0,
|
|
34
|
+
currency: t = "¥",
|
|
35
|
+
size: n = "md",
|
|
36
|
+
...b
|
|
37
|
+
}) {
|
|
38
|
+
const a = l.toLocaleString("ja-JP"), m = e?.toLocaleString("ja-JP"), p = i?.toLocaleString("ja-JP"), d = i != null && i > l, r = e != null && e > l, x = n ?? "md", c = d ? `${t}${a} 税込、元の価格 ${t}${p}` : r ? `${t}${a}〜${t}${m} 税込` : `${t}${a} 税込`;
|
|
39
|
+
return /* @__PURE__ */ o(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "price-display",
|
|
43
|
+
className: s("flex flex-col", h),
|
|
44
|
+
role: "group",
|
|
45
|
+
"aria-label": c,
|
|
46
|
+
...b,
|
|
47
|
+
children: [
|
|
48
|
+
d && /* @__PURE__ */ o(
|
|
49
|
+
"span",
|
|
50
|
+
{
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
className: s(
|
|
53
|
+
"text-[var(--Text-Low-Emphasis)] line-through",
|
|
54
|
+
L[x]
|
|
55
|
+
),
|
|
56
|
+
children: [
|
|
57
|
+
t,
|
|
58
|
+
p
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ o(
|
|
63
|
+
"span",
|
|
64
|
+
{
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
className: s(
|
|
67
|
+
v({ size: n }),
|
|
68
|
+
d && "text-[var(--Text-Caution)]"
|
|
69
|
+
),
|
|
70
|
+
children: [
|
|
71
|
+
r ? /* @__PURE__ */ o(g, { children: [
|
|
72
|
+
t,
|
|
73
|
+
a,
|
|
74
|
+
"〜",
|
|
75
|
+
t,
|
|
76
|
+
m
|
|
77
|
+
] }) : /* @__PURE__ */ o(g, { children: [
|
|
78
|
+
t,
|
|
79
|
+
a
|
|
80
|
+
] }),
|
|
81
|
+
y && /* @__PURE__ */ f(
|
|
82
|
+
"span",
|
|
83
|
+
{
|
|
84
|
+
className: s(
|
|
85
|
+
"ml-0.5 text-[var(--Text-Low-Emphasis)]",
|
|
86
|
+
S[x]
|
|
87
|
+
),
|
|
88
|
+
children: "税込"
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
T as PriceDisplay,
|
|
100
|
+
v as priceDisplayVariants
|
|
101
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Check as p } from "lucide-react";
|
|
4
|
+
import { cn as s } from "../../lib/utils.js";
|
|
5
|
+
function b({
|
|
6
|
+
className: d,
|
|
7
|
+
steps: a,
|
|
8
|
+
currentStep: i,
|
|
9
|
+
showCheckmark: x = !0,
|
|
10
|
+
...f
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ e(
|
|
13
|
+
"div",
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "progress-steps",
|
|
16
|
+
className: s("flex w-full items-start justify-center px-4", d),
|
|
17
|
+
role: "navigation",
|
|
18
|
+
"aria-label": "ステップ",
|
|
19
|
+
...f,
|
|
20
|
+
children: a.map((l, r) => {
|
|
21
|
+
const t = r < i, n = r === i, o = t || n, c = r === a.length - 1;
|
|
22
|
+
return /* @__PURE__ */ m("div", { className: s("flex items-start", !c && "flex-1"), children: [
|
|
23
|
+
/* @__PURE__ */ m("div", { className: "flex flex-col items-center gap-1.5", children: [
|
|
24
|
+
/* @__PURE__ */ e(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: s(
|
|
28
|
+
"flex size-7 items-center justify-center rounded-full typo-label-sm transition-colors",
|
|
29
|
+
o ? "bg-[var(--Brand-Cake-Orange)] text-[var(--Text-on-Inverse)]" : "bg-[var(--Surface-Tertiary)] text-[var(--Text-Low-Emphasis)]"
|
|
30
|
+
),
|
|
31
|
+
"aria-current": n ? "step" : void 0,
|
|
32
|
+
children: x && t ? /* @__PURE__ */ e(p, { className: "size-4 shrink-0" }) : r + 1
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ e(
|
|
36
|
+
"span",
|
|
37
|
+
{
|
|
38
|
+
className: s(
|
|
39
|
+
"transition-colors",
|
|
40
|
+
o ? "typo-label-xs text-[var(--Text-High-Emphasis)]" : "typo-body-xs text-[var(--Text-Low-Emphasis)]"
|
|
41
|
+
),
|
|
42
|
+
children: l
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
] }),
|
|
46
|
+
!c && /* @__PURE__ */ e("div", { className: "mt-3 flex flex-1 items-center px-1.5", children: /* @__PURE__ */ e(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
className: s(
|
|
50
|
+
"h-0.5 w-full rounded-full transition-colors",
|
|
51
|
+
t ? "bg-[var(--Brand-Cake-Orange)]" : "bg-[var(--Border-Medium-Emphasis)]"
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
] }, l);
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
b as ProgressSteps
|
|
62
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import y from "iconsax-reactjs/dist/esm/SearchNormal1.js";
|
|
4
|
+
import { cn as n } from "../../lib/utils.js";
|
|
5
|
+
import { FOCUS_RING_INSET as b, FOCUS_RING_WITHIN as v } from "../../lib/focus-ring.js";
|
|
6
|
+
const x = a.forwardRef(
|
|
7
|
+
({
|
|
8
|
+
className: l,
|
|
9
|
+
placeholder: h = "キーワードを入力してください",
|
|
10
|
+
onSearch: d,
|
|
11
|
+
size: o = "md",
|
|
12
|
+
searchHref: s,
|
|
13
|
+
...i
|
|
14
|
+
}, r) => {
|
|
15
|
+
const c = a.useRef(null), u = a.useCallback(
|
|
16
|
+
(e) => {
|
|
17
|
+
c.current = e, typeof r == "function" ? r(e) : r && (r.current = e);
|
|
18
|
+
},
|
|
19
|
+
[r]
|
|
20
|
+
), m = () => {
|
|
21
|
+
const e = c.current?.value ?? "";
|
|
22
|
+
e.trim() && (d?.(e), s && (window.location.href = s.replace(
|
|
23
|
+
"{query}",
|
|
24
|
+
encodeURIComponent(e)
|
|
25
|
+
)));
|
|
26
|
+
}, p = (e) => {
|
|
27
|
+
e.key === "Enter" && m(), i.onKeyDown?.(e);
|
|
28
|
+
};
|
|
29
|
+
return /* @__PURE__ */ f(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "search-bar",
|
|
33
|
+
className: n(
|
|
34
|
+
"group flex items-center overflow-hidden rounded-lg border border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Secondary)] transition-colors",
|
|
35
|
+
// Tailwind の variant 順では focus-within が hover より先に出力される
|
|
36
|
+
// = hover が後勝ちしてフォーカス枠を潰すため、hover 側を明示的に抑制する。
|
|
37
|
+
"hover:not-focus-within:border-[var(--Border-High-Emphasis)]",
|
|
38
|
+
v,
|
|
39
|
+
o === "sm" ? "h-9" : "h-11",
|
|
40
|
+
l
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ t(
|
|
44
|
+
"input",
|
|
45
|
+
{
|
|
46
|
+
ref: u,
|
|
47
|
+
type: "search",
|
|
48
|
+
"aria-label": "キーワード検索",
|
|
49
|
+
placeholder: h,
|
|
50
|
+
className: n(
|
|
51
|
+
"min-w-0 flex-1 bg-transparent px-3 text-[var(--Text-High-Emphasis)] outline-none placeholder:text-[var(--Text-Low-Emphasis)]",
|
|
52
|
+
o === "sm" ? "typo-body-sm" : "typo-body-md"
|
|
53
|
+
),
|
|
54
|
+
onKeyDown: p,
|
|
55
|
+
...i
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
"button",
|
|
60
|
+
{
|
|
61
|
+
type: "button",
|
|
62
|
+
className: n(
|
|
63
|
+
"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)]",
|
|
64
|
+
// 親が overflow-hidden なので外向きリングは切れる。内側に描く。
|
|
65
|
+
b,
|
|
66
|
+
o === "sm" ? "size-9" : "h-11 w-11"
|
|
67
|
+
),
|
|
68
|
+
onClick: m,
|
|
69
|
+
"aria-label": "検索",
|
|
70
|
+
children: /* @__PURE__ */ t(y, { size: o === "sm" ? 14 : 16 })
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
x.displayName = "SearchBar";
|
|
79
|
+
export {
|
|
80
|
+
x as SearchBar
|
|
81
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as l } from "../../lib/utils.js";
|
|
4
|
+
import { Button as i } from "../foundations/button.js";
|
|
5
|
+
import n from "iconsax-reactjs/dist/esm/SearchNormal1.js";
|
|
6
|
+
const f = {
|
|
7
|
+
2: "@sm:grid-cols-2",
|
|
8
|
+
3: "@sm:grid-cols-2 @lg:grid-cols-3",
|
|
9
|
+
4: "@sm:grid-cols-2 @lg:grid-cols-4"
|
|
10
|
+
};
|
|
11
|
+
function v({
|
|
12
|
+
children: a,
|
|
13
|
+
onSearch: o,
|
|
14
|
+
onReset: s,
|
|
15
|
+
columns: c = 4,
|
|
16
|
+
layout: m = "grid",
|
|
17
|
+
className: d
|
|
18
|
+
}) {
|
|
19
|
+
const t = m === "flex" ? "flex flex-wrap items-end gap-3 [&>*]:flex [&>*]:flex-col [&>*]:min-w-[140px] [&>*]:flex-1" : l("grid grid-cols-1 gap-3 items-end [&>*]:flex [&>*]:flex-col", f[c]);
|
|
20
|
+
return /* @__PURE__ */ r(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
className: l(
|
|
24
|
+
"@container rounded-2xl bg-[var(--Surface-Primary)] border border-[var(--Border-Low-Emphasis)] p-4",
|
|
25
|
+
d
|
|
26
|
+
),
|
|
27
|
+
"data-slot": "search-panel",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ e("div", { className: t, children: a }),
|
|
30
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-end gap-2 mt-3", children: [
|
|
31
|
+
s && /* @__PURE__ */ e(i, { variant: "tertiary", size: "sm", onClick: s, children: "リセット" }),
|
|
32
|
+
/* @__PURE__ */ r(i, { variant: "default", size: "sm", onClick: o, children: [
|
|
33
|
+
/* @__PURE__ */ e(n, { size: 16, className: "mr-1" }),
|
|
34
|
+
" 検索"
|
|
35
|
+
] })
|
|
36
|
+
] })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
v as SearchPanel
|
|
43
|
+
};
|