@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,91 +1,108 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { Checkbox as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { FOCUS_RING as
|
|
9
|
-
import { useFieldLabelling as
|
|
10
|
-
function
|
|
11
|
-
|
|
2
|
+
import { jsx as t, jsxs as x } from "react/jsx-runtime";
|
|
3
|
+
import * as i from "react";
|
|
4
|
+
import S from "iconsax-reactjs/dist/esm/TickSquare.js";
|
|
5
|
+
import T from "iconsax-reactjs/dist/esm/MinusSquare.js";
|
|
6
|
+
import { Checkbox as y } from "radix-ui";
|
|
7
|
+
import { cn as E } from "../../lib/utils.js";
|
|
8
|
+
import { FOCUS_RING as j } from "../../lib/focus-ring.js";
|
|
9
|
+
import { useFieldLabelling as w, resolveFieldAria as L } from "../../lib/field-labelling.js";
|
|
10
|
+
function k(e, r) {
|
|
11
|
+
if (typeof e == "function") {
|
|
12
|
+
const a = e(r);
|
|
13
|
+
return typeof a == "function" ? a : void 0;
|
|
14
|
+
}
|
|
15
|
+
e && typeof e == "object" && (e.current = r);
|
|
16
|
+
}
|
|
17
|
+
const g = i.forwardRef(function({
|
|
18
|
+
className: r,
|
|
12
19
|
...a
|
|
13
|
-
}) {
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
20
|
+
}, l) {
|
|
21
|
+
return /* @__PURE__ */ t(
|
|
22
|
+
y.Root,
|
|
16
23
|
{
|
|
17
24
|
"data-slot": "checkbox",
|
|
18
|
-
|
|
25
|
+
ref: l,
|
|
26
|
+
className: E(
|
|
19
27
|
// lint-scratch-allow: rounded-[5px] は Figma チェックボックス固有値(トークン外)
|
|
20
|
-
"peer flex size-5 shrink-0 items-center justify-center rounded-[5px] border-2 border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Primary)] transition-colors outline-none",
|
|
28
|
+
"peer flex size-5 shrink-0 items-center justify-center rounded-[5px] border-2 border-[var(--Border-Control,var(--Border-Medium-Emphasis))] bg-[var(--Surface-Primary)] transition-colors outline-none",
|
|
21
29
|
"data-[state=checked]:border-transparent data-[state=checked]:bg-transparent",
|
|
22
30
|
"data-[state=indeterminate]:border-transparent data-[state=indeterminate]:bg-transparent",
|
|
23
31
|
// hover はフォーカス中に抑制する(checked 時の border-transparent が
|
|
24
32
|
// フォーカスリングの枠を消してしまうため)。
|
|
25
33
|
"hover:border-[var(--Focus-High-Emphasis)] data-[state=checked]:hover:not-focus-visible:border-transparent data-[state=indeterminate]:hover:not-focus-visible:border-transparent",
|
|
26
|
-
|
|
27
|
-
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-[var(--Border-Medium-Emphasis)]",
|
|
28
|
-
|
|
34
|
+
j,
|
|
35
|
+
"disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-[var(--Border-Control,var(--Border-Medium-Emphasis))]",
|
|
36
|
+
r
|
|
29
37
|
),
|
|
30
38
|
...a,
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
|
|
39
|
+
children: /* @__PURE__ */ t(
|
|
40
|
+
y.Indicator,
|
|
33
41
|
{
|
|
34
42
|
"data-slot": "checkbox-indicator",
|
|
35
43
|
className: "flex items-center justify-center",
|
|
36
|
-
children: a.checked === "indeterminate" ? /* @__PURE__ */
|
|
44
|
+
children: a.checked === "indeterminate" ? /* @__PURE__ */ t(T, { size: 24, variant: "Bold", className: "text-[var(--Object-Accent-Primary)]" }) : /* @__PURE__ */ t(S, { size: 24, variant: "Bold", className: "text-[var(--Object-Accent-Primary)]" })
|
|
37
45
|
}
|
|
38
46
|
)
|
|
39
47
|
}
|
|
40
48
|
);
|
|
41
|
-
}
|
|
42
|
-
function
|
|
43
|
-
label:
|
|
44
|
-
description:
|
|
45
|
-
count:
|
|
46
|
-
containerClassName:
|
|
47
|
-
className:
|
|
48
|
-
id:
|
|
49
|
-
|
|
49
|
+
});
|
|
50
|
+
function $({
|
|
51
|
+
label: e,
|
|
52
|
+
description: r,
|
|
53
|
+
count: a,
|
|
54
|
+
containerClassName: l,
|
|
55
|
+
className: m,
|
|
56
|
+
id: C,
|
|
57
|
+
ref: u,
|
|
58
|
+
...s
|
|
50
59
|
}) {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
const c = w(), b = i.useRef(null), f = i.useRef(void 0), [I, R] = i.useState(!1), N = i.useId(), n = C ?? N, h = i.useCallback((o) => {
|
|
61
|
+
const d = f.current;
|
|
62
|
+
f.current = void 0, d ? d() : o || k(u, null), b.current = o, o && (f.current = k(u, o));
|
|
63
|
+
}, [u]), v = `${n}-label`, p = r ? `${n}-description` : void 0;
|
|
64
|
+
if ((typeof window > "u" ? i.useEffect : i.useLayoutEffect)(() => {
|
|
65
|
+
if (e !== void 0 || !b.current || !c) return;
|
|
66
|
+
const o = Array.from(b.current.labels ?? []).filter((d) => d.id !== c.labelId);
|
|
67
|
+
R(o.length > 0);
|
|
68
|
+
}, [c, e]), e === void 0) {
|
|
69
|
+
const o = L({ ...s, id: n }, c, I);
|
|
70
|
+
return /* @__PURE__ */ t(g, { ref: h, id: n, className: m, ...s, ...o });
|
|
55
71
|
}
|
|
56
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ x(
|
|
57
73
|
"label",
|
|
58
74
|
{
|
|
59
|
-
htmlFor:
|
|
75
|
+
htmlFor: n,
|
|
60
76
|
"data-slot": "checkbox-row",
|
|
61
|
-
"data-disabled":
|
|
62
|
-
className:
|
|
77
|
+
"data-disabled": s.disabled || void 0,
|
|
78
|
+
className: E(
|
|
63
79
|
"flex items-center gap-3 rounded-md px-3 py-2 transition-colors cursor-pointer",
|
|
64
80
|
"hover:bg-[var(--Surface-Tertiary)]",
|
|
65
81
|
"has-[:focus-visible]:bg-[var(--Surface-Tertiary)]",
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
s.disabled && "cursor-not-allowed opacity-60 hover:bg-transparent has-[:focus-visible]:bg-transparent",
|
|
83
|
+
l
|
|
68
84
|
),
|
|
69
85
|
children: [
|
|
70
|
-
/* @__PURE__ */
|
|
71
|
-
|
|
86
|
+
/* @__PURE__ */ t(
|
|
87
|
+
g,
|
|
72
88
|
{
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"aria-
|
|
77
|
-
|
|
89
|
+
ref: h,
|
|
90
|
+
id: n,
|
|
91
|
+
className: m,
|
|
92
|
+
"aria-labelledby": s["aria-label"] ? void 0 : v,
|
|
93
|
+
"aria-describedby": p,
|
|
94
|
+
...s
|
|
78
95
|
}
|
|
79
96
|
),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
|
|
97
|
+
/* @__PURE__ */ x("div", { className: "flex-1 min-w-0", children: [
|
|
98
|
+
/* @__PURE__ */ t("span", { id: v, className: "typo-body-md text-[var(--Text-High-Emphasis)]", children: e }),
|
|
99
|
+
r && /* @__PURE__ */ t("span", { id: p, className: "block typo-body-sm text-[var(--Text-Medium-Emphasis)] mt-0.5", children: r })
|
|
83
100
|
] }),
|
|
84
|
-
|
|
101
|
+
a !== void 0 && /* @__PURE__ */ t("span", { className: "shrink-0 typo-label-sm text-[var(--Text-Medium-Emphasis)] tabular-nums", children: a.toLocaleString() })
|
|
85
102
|
]
|
|
86
103
|
}
|
|
87
104
|
);
|
|
88
105
|
}
|
|
89
106
|
export {
|
|
90
|
-
|
|
107
|
+
$ as Checkbox
|
|
91
108
|
};
|
|
@@ -10,10 +10,23 @@ const t = e(
|
|
|
10
10
|
"hover:bg-[var(--Surface-Tertiary)]",
|
|
11
11
|
"disabled:text-[var(--Text-Disable)] disabled:hover:bg-[var(--Surface-Secondary)]"
|
|
12
12
|
].join(" "),
|
|
13
|
+
/** accent — 薄いブランド色地 + ブランド色文字。Chip の selected は使わなくなった(明示指定の互換のために残す) */
|
|
13
14
|
accent: [
|
|
14
15
|
"bg-[var(--Surface-Accent-Primary-Light)] text-[var(--Brand-Cake-Orange)]",
|
|
15
16
|
"hover:bg-[var(--Surface-Accent-Primary)] hover:text-[var(--Text-on-Inverse)]",
|
|
16
17
|
"disabled:bg-[var(--Surface-Secondary)] disabled:text-[var(--Text-Disable)] disabled:hover:bg-[var(--Surface-Secondary)] disabled:hover:text-[var(--Text-Disable)]"
|
|
18
|
+
].join(" "),
|
|
19
|
+
/**
|
|
20
|
+
* selected — Chip の選択中。ブランド色を使わず、グレー地 + 1px の黒系の枠で示す
|
|
21
|
+
* (contracts/composition.json の brandColorUsage。ナビ・絞り込みの選択中表示にブランド色を使わない)。
|
|
22
|
+
* 枠は border ではなく内側リング(inset-ring)で描く: border だと未選択→選択で 2px 大きくなる。
|
|
23
|
+
* inset-ring は FOCUS_RING の ring(外側)と別の box-shadow 層なので、フォーカス中も両方見える。
|
|
24
|
+
* forced-colors では box-shadow が消えるため、Chip 側が Highlight の塗りで選択中を示す。
|
|
25
|
+
*/
|
|
26
|
+
selected: [
|
|
27
|
+
"bg-[var(--Surface-Tertiary)] text-[var(--Text-High-Emphasis)] inset-ring-1 inset-ring-[var(--Border-High-Emphasis)]",
|
|
28
|
+
"hover:bg-[var(--Hover-Tertiary-Button)]",
|
|
29
|
+
"disabled:bg-[var(--Surface-Secondary)] disabled:text-[var(--Text-Disable)] disabled:inset-ring-transparent disabled:hover:bg-[var(--Surface-Secondary)]"
|
|
17
30
|
].join(" ")
|
|
18
31
|
},
|
|
19
32
|
size: {
|
|
@@ -1,172 +1,174 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as t, jsxs as
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Command as
|
|
5
|
-
import { SearchIcon as
|
|
6
|
-
import { cn as
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { Command as a } from "cmdk";
|
|
5
|
+
import { SearchIcon as c } from "lucide-react";
|
|
6
|
+
import { cn as r } from "../../lib/utils.js";
|
|
7
|
+
import { FORCED_COLORS_COMMAND_ITEM as l } from "../../lib/focus-ring.js";
|
|
8
|
+
import { Dialog as u, DialogHeader as p, DialogTitle as f, DialogDescription as g, DialogContent as h } from "./dialog.js";
|
|
9
|
+
function x({
|
|
10
|
+
className: o,
|
|
11
|
+
...e
|
|
11
12
|
}) {
|
|
12
13
|
return /* @__PURE__ */ t(
|
|
13
|
-
|
|
14
|
+
a,
|
|
14
15
|
{
|
|
15
16
|
"data-slot": "command",
|
|
16
|
-
className:
|
|
17
|
+
className: r(
|
|
17
18
|
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
18
|
-
|
|
19
|
+
o
|
|
19
20
|
),
|
|
20
|
-
...
|
|
21
|
+
...e
|
|
21
22
|
}
|
|
22
23
|
);
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
-
title:
|
|
26
|
-
description:
|
|
27
|
-
children:
|
|
25
|
+
function N({
|
|
26
|
+
title: o = "Command Palette",
|
|
27
|
+
description: e = "Search for a command to run...",
|
|
28
|
+
children: d,
|
|
28
29
|
className: m,
|
|
29
30
|
showCloseButton: s = !0,
|
|
30
|
-
...
|
|
31
|
+
...i
|
|
31
32
|
}) {
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
34
|
-
/* @__PURE__ */ t(
|
|
35
|
-
/* @__PURE__ */ t(g, { children:
|
|
33
|
+
return /* @__PURE__ */ n(u, { ...i, children: [
|
|
34
|
+
/* @__PURE__ */ n(p, { className: "sr-only", children: [
|
|
35
|
+
/* @__PURE__ */ t(f, { children: o }),
|
|
36
|
+
/* @__PURE__ */ t(g, { children: e })
|
|
36
37
|
] }),
|
|
37
38
|
/* @__PURE__ */ t(
|
|
38
39
|
h,
|
|
39
40
|
{
|
|
40
|
-
className:
|
|
41
|
+
className: r("overflow-hidden p-0", m),
|
|
41
42
|
showCloseButton: s,
|
|
42
|
-
children: /* @__PURE__ */ t(
|
|
43
|
+
children: /* @__PURE__ */ t(x, { className: "**:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:typo-label-sm [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5", children: d })
|
|
43
44
|
}
|
|
44
45
|
)
|
|
45
46
|
] });
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
className:
|
|
49
|
-
...
|
|
48
|
+
function D({
|
|
49
|
+
className: o,
|
|
50
|
+
...e
|
|
50
51
|
}) {
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ n(
|
|
52
53
|
"div",
|
|
53
54
|
{
|
|
54
55
|
"data-slot": "command-input-wrapper",
|
|
55
|
-
className: "flex h-9 items-center gap-2 border-b border-[var(--Border-Medium-Emphasis)] px-3 focus-within:border-[var(--Focus-High-Emphasis)]",
|
|
56
|
+
className: "flex h-9 items-center gap-2 border-b border-[var(--Border-Medium-Emphasis)] px-3 focus-within:border-[var(--Focus-High-Emphasis)] forced-colors:focus-within:outline-solid forced-colors:focus-within:outline-2 forced-colors:focus-within:-outline-offset-2 forced-colors:focus-within:outline-[Highlight]",
|
|
56
57
|
children: [
|
|
57
|
-
/* @__PURE__ */ t(
|
|
58
|
+
/* @__PURE__ */ t(c, { className: "size-4 shrink-0 opacity-50" }),
|
|
58
59
|
/* @__PURE__ */ t(
|
|
59
|
-
|
|
60
|
+
a.Input,
|
|
60
61
|
{
|
|
61
62
|
"data-slot": "command-input",
|
|
62
|
-
className:
|
|
63
|
-
"flex h-10 w-full rounded-md bg-transparent py-3 typo-body-md outline-
|
|
64
|
-
|
|
63
|
+
className: r(
|
|
64
|
+
"flex h-10 w-full rounded-md bg-transparent py-3 typo-body-md outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
65
|
+
o
|
|
65
66
|
),
|
|
66
|
-
...
|
|
67
|
+
...e
|
|
67
68
|
}
|
|
68
69
|
)
|
|
69
70
|
]
|
|
70
71
|
}
|
|
71
72
|
);
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
-
className:
|
|
75
|
-
...
|
|
74
|
+
function E({
|
|
75
|
+
className: o,
|
|
76
|
+
...e
|
|
76
77
|
}) {
|
|
77
78
|
return /* @__PURE__ */ t(
|
|
78
|
-
|
|
79
|
+
a.List,
|
|
79
80
|
{
|
|
80
81
|
"data-slot": "command-list",
|
|
81
|
-
className:
|
|
82
|
+
className: r(
|
|
82
83
|
"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
|
|
83
|
-
|
|
84
|
+
o
|
|
84
85
|
),
|
|
85
|
-
...
|
|
86
|
+
...e
|
|
86
87
|
}
|
|
87
88
|
);
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
-
...
|
|
90
|
+
function I({
|
|
91
|
+
...o
|
|
91
92
|
}) {
|
|
92
93
|
return /* @__PURE__ */ t(
|
|
93
|
-
|
|
94
|
+
a.Empty,
|
|
94
95
|
{
|
|
95
96
|
"data-slot": "command-empty",
|
|
96
97
|
className: "py-6 text-center typo-body-md",
|
|
97
|
-
...
|
|
98
|
+
...o
|
|
98
99
|
}
|
|
99
100
|
);
|
|
100
101
|
}
|
|
101
|
-
function
|
|
102
|
-
className:
|
|
103
|
-
...
|
|
102
|
+
function S({
|
|
103
|
+
className: o,
|
|
104
|
+
...e
|
|
104
105
|
}) {
|
|
105
106
|
return /* @__PURE__ */ t(
|
|
106
|
-
|
|
107
|
+
a.Group,
|
|
107
108
|
{
|
|
108
109
|
"data-slot": "command-group",
|
|
109
|
-
className:
|
|
110
|
+
className: r(
|
|
110
111
|
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:typo-label-sm [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
111
|
-
|
|
112
|
+
o
|
|
112
113
|
),
|
|
113
|
-
...
|
|
114
|
+
...e
|
|
114
115
|
}
|
|
115
116
|
);
|
|
116
117
|
}
|
|
117
|
-
function
|
|
118
|
-
className:
|
|
119
|
-
...
|
|
118
|
+
function M({
|
|
119
|
+
className: o,
|
|
120
|
+
...e
|
|
120
121
|
}) {
|
|
121
122
|
return /* @__PURE__ */ t(
|
|
122
|
-
|
|
123
|
+
a.Separator,
|
|
123
124
|
{
|
|
124
125
|
"data-slot": "command-separator",
|
|
125
|
-
className:
|
|
126
|
-
...
|
|
126
|
+
className: r("-mx-1 h-px bg-border", o),
|
|
127
|
+
...e
|
|
127
128
|
}
|
|
128
129
|
);
|
|
129
130
|
}
|
|
130
|
-
function
|
|
131
|
-
className:
|
|
132
|
-
...
|
|
131
|
+
function O({
|
|
132
|
+
className: o,
|
|
133
|
+
...e
|
|
133
134
|
}) {
|
|
134
135
|
return /* @__PURE__ */ t(
|
|
135
|
-
|
|
136
|
+
a.Item,
|
|
136
137
|
{
|
|
137
138
|
"data-slot": "command-item",
|
|
138
|
-
className:
|
|
139
|
-
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 typo-body-md outline-
|
|
140
|
-
|
|
139
|
+
className: r(
|
|
140
|
+
"relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 typo-body-md outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",
|
|
141
|
+
l,
|
|
142
|
+
o
|
|
141
143
|
),
|
|
142
|
-
...
|
|
144
|
+
...e
|
|
143
145
|
}
|
|
144
146
|
);
|
|
145
147
|
}
|
|
146
148
|
function z({
|
|
147
|
-
className:
|
|
148
|
-
...
|
|
149
|
+
className: o,
|
|
150
|
+
...e
|
|
149
151
|
}) {
|
|
150
152
|
return /* @__PURE__ */ t(
|
|
151
153
|
"span",
|
|
152
154
|
{
|
|
153
155
|
"data-slot": "command-shortcut",
|
|
154
|
-
className:
|
|
156
|
+
className: r(
|
|
155
157
|
"ml-auto typo-body-xs text-muted-foreground",
|
|
156
|
-
|
|
158
|
+
o
|
|
157
159
|
),
|
|
158
|
-
...
|
|
160
|
+
...e
|
|
159
161
|
}
|
|
160
162
|
);
|
|
161
163
|
}
|
|
162
164
|
export {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
165
|
+
x as Command,
|
|
166
|
+
N as CommandDialog,
|
|
167
|
+
I as CommandEmpty,
|
|
168
|
+
S as CommandGroup,
|
|
169
|
+
D as CommandInput,
|
|
170
|
+
O as CommandItem,
|
|
171
|
+
E as CommandList,
|
|
172
|
+
M as CommandSeparator,
|
|
171
173
|
z as CommandShortcut
|
|
172
174
|
};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as D, jsx as f } from "react/jsx-runtime";
|
|
3
|
+
import * as o from "react";
|
|
4
|
+
import { AlertDialog as w, AlertDialogContent as x, AlertDialogHeader as E, AlertDialogTitle as I, AlertDialogDescription as T, AlertDialogFooter as q, AlertDialogCancel as v } from "./alert-dialog.js";
|
|
5
|
+
import { Button as L } from "./button.js";
|
|
6
|
+
const A = { active: null, open: !1, queue: [] };
|
|
7
|
+
function M(e, r) {
|
|
8
|
+
if (e.active === r) {
|
|
9
|
+
if (!e.open) return e;
|
|
10
|
+
const [n, ...u] = e.queue;
|
|
11
|
+
return n ? { active: n, open: !0, queue: u } : { ...e, open: !1 };
|
|
12
|
+
}
|
|
13
|
+
return e.queue.includes(r) ? { ...e, queue: e.queue.filter((n) => n !== r) } : e;
|
|
14
|
+
}
|
|
15
|
+
const R = "data-confirm-dialog";
|
|
16
|
+
function y(e) {
|
|
17
|
+
return !(e instanceof HTMLElement) || e === e.ownerDocument.body ? !1 : !e.closest(`[${R}]`);
|
|
18
|
+
}
|
|
19
|
+
function O(e) {
|
|
20
|
+
let r = null, n = e;
|
|
21
|
+
for (let u = 0; u < 8; u++) {
|
|
22
|
+
const s = n.closest('[role="menu"]')?.getAttribute("aria-labelledby"), t = s ? e.ownerDocument.getElementById(s) : null;
|
|
23
|
+
if (!(t instanceof HTMLElement) || t === n) break;
|
|
24
|
+
r = t, n = t;
|
|
25
|
+
}
|
|
26
|
+
return r;
|
|
27
|
+
}
|
|
28
|
+
const k = o.createContext(null);
|
|
29
|
+
function j({ children: e }) {
|
|
30
|
+
const [r, n] = o.useState(A), u = o.useRef(/* @__PURE__ */ new Set()), i = o.useRef(!1), s = o.useRef(0), t = o.useRef(
|
|
31
|
+
null
|
|
32
|
+
), d = o.useCallback((c, l) => {
|
|
33
|
+
u.current.delete(c) && c.resolve(l), n((a) => M(a, c));
|
|
34
|
+
}, []), F = o.useCallback(
|
|
35
|
+
(c) => new Promise((l) => {
|
|
36
|
+
const a = typeof document > "u" ? null : document.activeElement, h = y(a) ? { returnFocus: a, fallbackFocus: O(a) } : t.current ?? { returnFocus: null, fallbackFocus: null };
|
|
37
|
+
t.current = h;
|
|
38
|
+
const C = { id: s.current++, options: c, resolve: l, ...h };
|
|
39
|
+
u.current.add(C), n(
|
|
40
|
+
(g) => g.active && g.open ? { ...g, queue: [...g.queue, C] } : (
|
|
41
|
+
// 閉じるアニメーション中の要求は key の変更で即座に差し替える
|
|
42
|
+
{ active: C, open: !0, queue: g.queue }
|
|
43
|
+
)
|
|
44
|
+
), i.current && queueMicrotask(() => {
|
|
45
|
+
i.current && d(C, !1);
|
|
46
|
+
});
|
|
47
|
+
}),
|
|
48
|
+
[d]
|
|
49
|
+
), m = o.useCallback((c, l) => {
|
|
50
|
+
if (c.preventDefault(), document.activeElement?.closest(`[${R}]`)) return;
|
|
51
|
+
(l.returnFocus?.isConnected ? l.returnFocus : l.fallbackFocus?.isConnected ? l.fallbackFocus : null)?.focus(), t.current = null;
|
|
52
|
+
}, []);
|
|
53
|
+
o.useEffect(() => {
|
|
54
|
+
i.current = !1;
|
|
55
|
+
const c = u.current;
|
|
56
|
+
return () => {
|
|
57
|
+
i.current = !0, queueMicrotask(() => {
|
|
58
|
+
if (i.current) {
|
|
59
|
+
for (const l of c) l.resolve(!1);
|
|
60
|
+
c.clear(), t.current = null, n(A);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
}, []);
|
|
65
|
+
const { active: b, open: p } = r;
|
|
66
|
+
return /* @__PURE__ */ D(k.Provider, { value: F, children: [
|
|
67
|
+
e,
|
|
68
|
+
b ? /* @__PURE__ */ f(
|
|
69
|
+
P,
|
|
70
|
+
{
|
|
71
|
+
request: b,
|
|
72
|
+
open: p,
|
|
73
|
+
onFinish: d,
|
|
74
|
+
onCloseAutoFocus: m
|
|
75
|
+
},
|
|
76
|
+
b.id
|
|
77
|
+
) : null
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function P({
|
|
81
|
+
request: e,
|
|
82
|
+
open: r,
|
|
83
|
+
onFinish: n,
|
|
84
|
+
onCloseAutoFocus: u
|
|
85
|
+
}) {
|
|
86
|
+
const {
|
|
87
|
+
title: i,
|
|
88
|
+
description: s,
|
|
89
|
+
confirmLabel: t = "確認",
|
|
90
|
+
cancelLabel: d = "キャンセル",
|
|
91
|
+
tone: F = "default"
|
|
92
|
+
} = e.options;
|
|
93
|
+
return /* @__PURE__ */ f(
|
|
94
|
+
w,
|
|
95
|
+
{
|
|
96
|
+
open: r,
|
|
97
|
+
onOpenChange: (m) => {
|
|
98
|
+
m || n(e, !1);
|
|
99
|
+
},
|
|
100
|
+
children: /* @__PURE__ */ D(
|
|
101
|
+
x,
|
|
102
|
+
{
|
|
103
|
+
"data-confirm-dialog": "",
|
|
104
|
+
onCloseAutoFocus: (m) => u(m, e),
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ D(E, { children: [
|
|
107
|
+
/* @__PURE__ */ f(I, { children: i }),
|
|
108
|
+
s != null ? /* @__PURE__ */ f(T, { children: s }) : null
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ D(q, { children: [
|
|
111
|
+
/* @__PURE__ */ f(v, { children: d }),
|
|
112
|
+
/* @__PURE__ */ f(
|
|
113
|
+
L,
|
|
114
|
+
{
|
|
115
|
+
variant: F === "destructive" ? "destructive" : "default",
|
|
116
|
+
onClick: () => n(e, !0),
|
|
117
|
+
children: t
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
] })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
function B() {
|
|
128
|
+
const e = o.useContext(k);
|
|
129
|
+
if (!e)
|
|
130
|
+
throw new Error("useConfirm は <ConfirmDialogProvider> の内側で使ってください。");
|
|
131
|
+
return e;
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
j as ConfirmDialogProvider,
|
|
135
|
+
B as useConfirm
|
|
136
|
+
};
|