@cakejp/design-system 0.22.1 → 0.23.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 +82 -0
- package/CLAUDE.md +3 -1
- package/MIGRATION.md +43 -0
- package/UPDATING.md +1 -1
- package/bin/check-tokens.mjs +20 -0
- package/contracts/components.json +87 -25
- package/contracts/composition.json +9 -9
- package/contracts/rules.json +1 -1
- package/contracts/screen-patterns.json +1 -1
- package/dist/components/ec/admin-shell.js +7 -7
- package/dist/components/ec/anniversary-card.js +1 -1
- package/dist/components/ec/chart-controls.js +7 -7
- package/dist/components/ec/coupon-card.js +10 -10
- package/dist/components/ec/delivery-calendar.js +1 -1
- package/dist/components/ec/mypage-shell.js +1 -1
- package/dist/components/ec/order-section.js +1 -1
- package/dist/components/ec/order-summary.js +7 -5
- package/dist/components/ec/product-card.js +32 -30
- package/dist/components/ec/product-detail-sidebar.js +1 -1
- package/dist/components/ec/product-list-item.js +57 -56
- package/dist/components/ec/product-option.js +30 -30
- package/dist/components/ec/review-summary.js +1 -1
- package/dist/components/ec/shop-card.js +7 -7
- package/dist/components/foundations/accordion.js +1 -1
- package/dist/components/foundations/alert-dialog.js +65 -43
- package/dist/components/foundations/alert.js +74 -68
- package/dist/components/foundations/badge.js +4 -4
- package/dist/components/foundations/button.js +15 -15
- package/dist/components/foundations/checkbox-card.js +18 -18
- package/dist/components/foundations/checkbox.js +6 -6
- package/dist/components/foundations/chip-variants.js +8 -8
- package/dist/components/foundations/data-table.js +244 -209
- package/dist/components/foundations/dialog.js +84 -60
- package/dist/components/foundations/drawer.js +61 -53
- package/dist/components/foundations/field.js +51 -35
- package/dist/components/foundations/file-input.js +1 -1
- package/dist/components/foundations/input.js +9 -8
- package/dist/components/foundations/popover.js +15 -12
- package/dist/components/foundations/progress.js +19 -18
- package/dist/components/foundations/radio-group.js +26 -23
- package/dist/components/foundations/select.js +9 -8
- package/dist/components/foundations/sheet.js +82 -59
- package/dist/components/foundations/skeleton.js +6 -6
- package/dist/components/foundations/slider.js +7 -7
- package/dist/components/foundations/sonner.js +9 -8
- package/dist/components/foundations/switch.js +3 -2
- package/dist/components/foundations/tabs.js +5 -5
- package/dist/components/foundations/textarea.js +7 -6
- package/dist/components/foundations/toggle-group.js +5 -5
- package/dist/components/primitives/admin-header.js +3 -3
- package/dist/components/primitives/admin-side-nav.js +101 -92
- package/dist/components/primitives/category-shortcuts.js +6 -6
- package/dist/components/primitives/chat-composer.js +1 -1
- package/dist/components/primitives/chip.js +25 -25
- package/dist/components/primitives/combobox.js +74 -63
- package/dist/components/primitives/content-carousel.js +64 -62
- package/dist/components/primitives/date-picker.js +99 -96
- package/dist/components/primitives/error-state.js +9 -9
- package/dist/components/primitives/filter-bar.js +4 -4
- package/dist/components/primitives/footer.js +1 -1
- package/dist/components/primitives/form-field.js +8 -8
- package/dist/components/primitives/funnel-shell.js +5 -5
- package/dist/components/primitives/header.js +16 -16
- package/dist/components/primitives/image-carousel.js +42 -41
- package/dist/components/primitives/image-gallery.js +61 -58
- package/dist/components/primitives/image-input.js +2 -2
- package/dist/components/primitives/image-uploader.js +1 -1
- package/dist/components/primitives/kebab-menu.js +20 -16
- package/dist/components/primitives/list-item.js +17 -17
- package/dist/components/primitives/menu-drawer.js +11 -11
- package/dist/components/primitives/multi-select.js +66 -66
- package/dist/components/primitives/notification-list.js +13 -13
- package/dist/components/primitives/number-input.js +118 -112
- package/dist/components/primitives/progress-steps.js +3 -3
- package/dist/components/primitives/search-bar.js +6 -6
- package/dist/components/primitives/section-nav.js +1 -1
- package/dist/components/primitives/side-nav.js +1 -1
- package/dist/components/primitives/sub-nav.js +12 -12
- package/dist/components/primitives/tag.js +3 -3
- package/dist/components/primitives/workspace-shell.js +8 -8
- package/dist/index.css +1 -1
- package/dist/index.js +1479 -704
- package/dist/lib/focus-restore.js +67 -0
- package/dist/lib/focus-ring.js +1 -1
- package/dist/lib/ime.js +17 -0
- package/dist/lib/search-normalize.js +30 -0
- package/dist/types/components/ec/admin-shell.d.ts +1 -1
- package/dist/types/components/foundations/alert-dialog.d.ts +2 -2
- package/dist/types/components/foundations/alert.d.ts +14 -1
- package/dist/types/components/foundations/card.d.ts +3 -3
- package/dist/types/components/foundations/confirm-dialog.d.ts +3 -3
- package/dist/types/components/foundations/data-table.d.ts +1 -1
- package/dist/types/components/foundations/dialog.d.ts +2 -2
- package/dist/types/components/foundations/drawer.d.ts +1 -1
- package/dist/types/components/foundations/field.d.ts +23 -3
- package/dist/types/components/foundations/popover.d.ts +1 -1
- package/dist/types/components/foundations/sheet.d.ts +4 -3
- package/dist/types/components/foundations/sonner.d.ts +3 -2
- package/dist/types/components/primitives/admin-side-nav.d.ts +2 -0
- package/dist/types/components/primitives/combobox.d.ts +6 -0
- package/dist/types/components/primitives/date-picker.d.ts +8 -3
- package/dist/types/components/primitives/funnel-shell.d.ts +1 -1
- package/dist/types/components/primitives/kebab-menu.d.ts +10 -1
- package/dist/types/components/primitives/number-input.d.ts +20 -1
- package/dist/types/components/primitives/progress-steps.d.ts +1 -1
- package/dist/types/components/primitives/section.d.ts +1 -1
- package/dist/types/components/primitives/workspace-shell.d.ts +2 -2
- package/dist/types/index.d.ts +3 -4
- package/dist/types/lib/focus-restore.d.ts +52 -0
- package/dist/types/lib/focus-ring.d.ts +3 -0
- package/dist/types/lib/ime.d.ts +36 -0
- package/dist/types/lib/search-normalize.d.ts +28 -0
- package/package.json +3 -1
- package/src/components/COMPONENT_LOOKUP.md +12 -12
- package/src/preset-standalone.css +43 -21
- package/src/preset.css +36 -18
- package/src/styles/primitive.css +1 -0
- package/src/styles/semantic.css +12 -2
- package/tokens.json +22 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
-
import { Loader2Icon as t, OctagonXIcon as i, TriangleAlertIcon as o, InfoIcon as
|
|
3
|
+
import { Loader2Icon as t, OctagonXIcon as i, TriangleAlertIcon as o, InfoIcon as s, CircleCheckIcon as n } from "lucide-react";
|
|
4
4
|
import { useTheme as v } from "next-themes";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as c, Toaster as m } from "sonner";
|
|
6
6
|
const g = ({ ...a }) => {
|
|
7
7
|
const { theme: e = "system" } = v();
|
|
8
8
|
return /* @__PURE__ */ r(
|
|
9
|
-
|
|
9
|
+
m,
|
|
10
10
|
{
|
|
11
11
|
theme: e,
|
|
12
12
|
className: "toaster group",
|
|
13
13
|
icons: {
|
|
14
|
-
success: /* @__PURE__ */ r(
|
|
15
|
-
info: /* @__PURE__ */ r(
|
|
14
|
+
success: /* @__PURE__ */ r(n, { className: "size-4 text-[var(--Text-Success)]" }),
|
|
15
|
+
info: /* @__PURE__ */ r(s, { className: "size-4 text-[var(--Primitive-Sea-600)]" }),
|
|
16
16
|
warning: /* @__PURE__ */ r(o, { className: "size-4 text-[var(--Text-Warning)]" }),
|
|
17
17
|
error: /* @__PURE__ */ r(i, { className: "size-4 text-[var(--Primitive-Sun-800)]" }),
|
|
18
18
|
// 動きを減らす設定では回転を止める(--Motion-* の一括制御は animate-spin に効かない)
|
|
@@ -23,7 +23,7 @@ const g = ({ ...a }) => {
|
|
|
23
23
|
toast: "!mx-auto",
|
|
24
24
|
description: "!text-[var(--Text-Medium-Emphasis)]",
|
|
25
25
|
actionButton: "!bg-[var(--Brand-Cake-Orange)] !text-[var(--Text-on-Inverse)] !typo-label-sm !rounded-lg !px-4 !py-2 !h-8 hover:!bg-[var(--Hover-Primary-Button)]",
|
|
26
|
-
cancelButton: "!bg-[var(--Surface-Tertiary)] !text-[var(--Text-High-Emphasis)] !typo-label-sm !rounded-lg !px-4 !py-2 !h-8",
|
|
26
|
+
cancelButton: "!bg-[var(--Surface-Neutral-Tertiary)] !text-[var(--Text-High-Emphasis)] !typo-label-sm !rounded-lg !px-4 !py-2 !h-8",
|
|
27
27
|
// 状態トースト(success/error/warning/info)は背景を primitive の明色で固定しているため、
|
|
28
28
|
// 中の description / cancel もモード反転しない primitive に固定する。
|
|
29
29
|
// semantic(Text-Medium-Emphasis 等)のままだとダークモードで白系に反転し、
|
|
@@ -45,7 +45,8 @@ const g = ({ ...a }) => {
|
|
|
45
45
|
...a
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
|
-
};
|
|
48
|
+
}, p = c;
|
|
49
49
|
export {
|
|
50
|
-
g as Toaster
|
|
50
|
+
g as Toaster,
|
|
51
|
+
p as toast
|
|
51
52
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
3
|
import "react";
|
|
3
4
|
import { Switch as o } from "radix-ui";
|
|
4
5
|
import { Check as n } from "lucide-react";
|
|
5
6
|
import { cn as a } from "../../lib/utils.js";
|
|
6
7
|
import { FOCUS_RING_ONLY as d } from "../../lib/focus-ring.js";
|
|
7
|
-
import { resolveFieldAria as u, useFieldLabelling as
|
|
8
|
+
import { resolveFieldAria as u, useFieldLabelling as l } from "../../lib/field-labelling.js";
|
|
8
9
|
function v({
|
|
9
10
|
className: s,
|
|
10
11
|
size: r = "default",
|
|
11
12
|
...i
|
|
12
13
|
}) {
|
|
13
|
-
const t = r === "default", c = u(i,
|
|
14
|
+
const t = r === "default", c = u(i, l());
|
|
14
15
|
return /* @__PURE__ */ e(
|
|
15
16
|
o.Root,
|
|
16
17
|
{
|
|
@@ -4,13 +4,13 @@ import { cva as l } from "class-variance-authority";
|
|
|
4
4
|
import { Tabs as i } from "radix-ui";
|
|
5
5
|
import { cn as s } from "../../lib/utils.js";
|
|
6
6
|
import { FOCUS_RING as d } from "../../lib/focus-ring.js";
|
|
7
|
-
const b = "data-[orientation=vertical]:flex-row data-[orientation=vertical]:items-start data-[orientation=vertical]:gap-4", g = "data-[orientation=vertical]:w-auto data-[orientation=vertical]:max-w-[50%] data-[orientation=vertical]:shrink-0 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch",
|
|
7
|
+
const b = "data-[orientation=vertical]:flex-row data-[orientation=vertical]:items-start data-[orientation=vertical]:gap-4", g = "data-[orientation=vertical]:w-auto data-[orientation=vertical]:max-w-[50%] data-[orientation=vertical]:shrink-0 data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch", u = [
|
|
8
8
|
"data-[orientation=vertical]:justify-start data-[orientation=vertical]:whitespace-normal data-[orientation=vertical]:text-left",
|
|
9
9
|
// underbar: 均等割り(flex-1)と下線をやめ、パネル側(右)の線で選択中を示す。高さは折り返しに合わせて伸ばす
|
|
10
10
|
"group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:h-auto group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:min-h-12 group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:flex-none group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:border-b-0 group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:border-r-2 group-data-[variant=underbar]/tabs-list:data-[orientation=vertical]:px-4",
|
|
11
11
|
// segment: 高さを折り返しに合わせて伸ばす(1 行なら従来の 37px)
|
|
12
12
|
"group-data-[variant=segment]/tabs-list:data-[orientation=vertical]:h-auto group-data-[variant=segment]/tabs-list:data-[orientation=vertical]:min-h-[37px] group-data-[variant=segment]/tabs-list:data-[orientation=vertical]:py-2"
|
|
13
|
-
].join(" "),
|
|
13
|
+
].join(" "), c = "data-[orientation=vertical]:min-w-0", p = [
|
|
14
14
|
"forced-colors:group-data-[variant=segment]/tabs-list:data-[state=active]:bg-[Highlight] forced-colors:group-data-[variant=segment]/tabs-list:data-[state=active]:text-[HighlightText]",
|
|
15
15
|
"forced-colors:group-data-[variant=underbar]/tabs-list:data-[state=inactive]:border-[Canvas] forced-colors:group-data-[variant=underbar]/tabs-list:data-[state=active]:border-[Highlight]"
|
|
16
16
|
].join(" "), v = "forced-colors:group-data-[scrollable]/tabs-list:group-data-[state=inactive]/trigger:border-[Canvas] forced-colors:group-data-[state=active]/trigger:border-[Highlight]";
|
|
@@ -34,7 +34,7 @@ const m = l(
|
|
|
34
34
|
variant: {
|
|
35
35
|
underbar: "w-full bg-transparent overflow-x-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",
|
|
36
36
|
// 縦向きでは縦長の地に rounded-full だと上下が半円になり、先頭・末尾のタブの角がはみ出すため角丸を 2xl に抑える
|
|
37
|
-
segment: "w-fit rounded-full bg-[var(--Surface-Tertiary)] p-2 data-[orientation=vertical]:rounded-2xl"
|
|
37
|
+
segment: "w-fit rounded-full bg-[var(--Surface-Neutral-Tertiary)] p-2 data-[orientation=vertical]:rounded-2xl"
|
|
38
38
|
},
|
|
39
39
|
scrollable: {
|
|
40
40
|
true: "gap-4"
|
|
@@ -106,7 +106,7 @@ function C({
|
|
|
106
106
|
"group-data-[size=sm]/tabs-list:!min-w-0 group-data-[size=sm]/tabs-list:!px-2",
|
|
107
107
|
// Segment active
|
|
108
108
|
"group-data-[variant=segment]/tabs-list:data-[state=active]:bg-[var(--Surface-Primary)] group-data-[variant=segment]/tabs-list:data-[state=active]:shadow-[0px_4px_6px_-4px_rgba(24,39,75,0.12),0px_8px_8px_-4px_rgba(24,39,75,0.08)]",
|
|
109
|
-
|
|
109
|
+
u,
|
|
110
110
|
p,
|
|
111
111
|
t
|
|
112
112
|
),
|
|
@@ -123,7 +123,7 @@ function L({
|
|
|
123
123
|
i.Content,
|
|
124
124
|
{
|
|
125
125
|
"data-slot": "tabs-content",
|
|
126
|
-
className: s("flex-1 outline-none", d,
|
|
126
|
+
className: s("flex-1 outline-none", d, c, t),
|
|
127
127
|
...a
|
|
128
128
|
}
|
|
129
129
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as n, jsxs as s } from "react/jsx-runtime";
|
|
2
3
|
import "react";
|
|
3
4
|
import { cn as c } from "../../lib/utils.js";
|
|
4
5
|
import { useValueLength as h } from "../../lib/use-value-length.js";
|
|
5
6
|
import { FOCUS_RING as g } from "../../lib/focus-ring.js";
|
|
6
|
-
import { resolveNativeFieldAria as y, useFieldLabelling as
|
|
7
|
+
import { resolveNativeFieldAria as y, useFieldLabelling as N } from "../../lib/field-labelling.js";
|
|
7
8
|
function D({
|
|
8
9
|
className: m,
|
|
9
10
|
showCount: r,
|
|
@@ -11,14 +12,14 @@ function D({
|
|
|
11
12
|
value: a,
|
|
12
13
|
defaultValue: t,
|
|
13
14
|
onChange: o,
|
|
14
|
-
ref:
|
|
15
|
+
ref: u,
|
|
15
16
|
...i
|
|
16
17
|
}) {
|
|
17
|
-
const
|
|
18
|
+
const b = y(i, N()), { ref: f, length: d, syncFromDom: p } = h({
|
|
18
19
|
enabled: r === !0,
|
|
19
20
|
value: a,
|
|
20
21
|
defaultValue: t,
|
|
21
|
-
forwardedRef:
|
|
22
|
+
forwardedRef: u
|
|
22
23
|
}), l = /* @__PURE__ */ n(
|
|
23
24
|
"textarea",
|
|
24
25
|
{
|
|
@@ -31,13 +32,13 @@ function D({
|
|
|
31
32
|
p(), o?.(v);
|
|
32
33
|
} : o,
|
|
33
34
|
className: c(
|
|
34
|
-
"flex field-sizing-content min-h-16 w-full rounded-lg border border-[var(--Border-High-Emphasis)] bg-transparent px-3 py-2 typo-body-lg md:typo-body-md transition-[color,box-shadow,border-color] outline-none placeholder:text-muted-foreground hover:border-[var(--Focus-High-Emphasis)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-[var(--Border-Low-Emphasis)] disabled:bg-[var(--Surface-Secondary)] disabled:text-[var(--Text-Disable)] disabled:placeholder:text-[var(--Text-Disable)] aria-invalid:border-[var(--Border-Caution)] aria-invalid:ring-[var(--Border-Caution)]/20",
|
|
35
|
+
"flex field-sizing-content min-h-16 w-full rounded-lg border border-[var(--Border-High-Emphasis)] bg-transparent px-3 py-2 typo-body-lg md:typo-body-md transition-[color,box-shadow,border-color] outline-none placeholder:text-muted-foreground hover:border-[var(--Focus-High-Emphasis)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-[var(--Border-Low-Emphasis)] disabled:bg-[var(--Surface-Neutral-Secondary)] disabled:text-[var(--Text-Disable)] disabled:placeholder:text-[var(--Text-Disable)] aria-invalid:border-[var(--Border-Caution)] aria-invalid:ring-[var(--Border-Caution)]/20",
|
|
35
36
|
// フォーカス意匠は DS 共通(FOCUS_RING)。
|
|
36
37
|
g,
|
|
37
38
|
m
|
|
38
39
|
),
|
|
39
40
|
...i,
|
|
40
|
-
...
|
|
41
|
+
...b
|
|
41
42
|
}
|
|
42
43
|
);
|
|
43
44
|
if (!r) return l;
|
|
@@ -6,7 +6,7 @@ import { ToggleGroup as c } from "radix-ui";
|
|
|
6
6
|
import { cn as d } from "../../lib/utils.js";
|
|
7
7
|
import { FORCED_COLORS_FOCUS_INSET as u } from "../../lib/focus-ring.js";
|
|
8
8
|
const p = l(
|
|
9
|
-
"flex items-center gap-1.5 py-1.5 overflow-x-auto scrollbar-
|
|
9
|
+
"flex items-center gap-1.5 py-1.5 overflow-x-auto scrollbar-hide",
|
|
10
10
|
{
|
|
11
11
|
variants: {
|
|
12
12
|
/** グループ全体の幅 */
|
|
@@ -40,15 +40,15 @@ const p = l(
|
|
|
40
40
|
variants: {
|
|
41
41
|
variant: {
|
|
42
42
|
default: [
|
|
43
|
-
"bg-[var(--Surface-Tertiary)] text-[var(--Text-Medium-Emphasis)]",
|
|
44
|
-
"hover:bg-[var(--Surface-Tertiary)]/80",
|
|
43
|
+
"bg-[var(--Surface-Neutral-Tertiary)] text-[var(--Text-Medium-Emphasis)]",
|
|
44
|
+
"hover:bg-[var(--Surface-Neutral-Tertiary)]/80",
|
|
45
45
|
"data-[state=on]:bg-[var(--Surface-Accent-Primary-Light)] data-[state=on]:text-[var(--Text-Accent-Primary)] data-[state=on]:font-bold",
|
|
46
|
-
"dark:bg-[var(--Surface-Secondary)] dark:text-[var(--Text-Low-Emphasis)]",
|
|
46
|
+
"dark:bg-[var(--Surface-Neutral-Secondary)] dark:text-[var(--Text-Low-Emphasis)]",
|
|
47
47
|
"dark:data-[state=on]:bg-[var(--Surface-Accent-Primary-Light)] dark:data-[state=on]:text-[var(--Text-Accent-Primary)]"
|
|
48
48
|
].join(" "),
|
|
49
49
|
outline: [
|
|
50
50
|
"border border-[var(--Border-Control,var(--Border-Low-Emphasis))] bg-transparent text-[var(--Text-Low-Emphasis)]",
|
|
51
|
-
"hover:bg-[var(--Surface-Tertiary)]",
|
|
51
|
+
"hover:bg-[var(--Surface-Neutral-Tertiary)]",
|
|
52
52
|
"data-[state=on]:border-[var(--Text-High-Emphasis)] data-[state=on]:bg-transparent data-[state=on]:text-[var(--Text-High-Emphasis)]"
|
|
53
53
|
].join(" ")
|
|
54
54
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import s from "iconsax-reactjs/dist/esm/HamburgerMenu.js";
|
|
4
|
-
function
|
|
4
|
+
function n({ brand: r, onMenuClick: a, actions: t }) {
|
|
5
5
|
return /* @__PURE__ */ i(
|
|
6
6
|
"header",
|
|
7
7
|
{
|
|
@@ -13,7 +13,7 @@ function l({ brand: r, onMenuClick: a, actions: t }) {
|
|
|
13
13
|
"button",
|
|
14
14
|
{
|
|
15
15
|
type: "button",
|
|
16
|
-
className: "flex items-center justify-center size-10 shrink-0 rounded-lg hover:bg-[var(--Surface-Secondary)] @md:hidden",
|
|
16
|
+
className: "flex items-center justify-center size-10 shrink-0 rounded-lg hover:bg-[var(--Surface-Neutral-Secondary)] @md:hidden",
|
|
17
17
|
"aria-label": "メニュー",
|
|
18
18
|
onClick: a,
|
|
19
19
|
children: /* @__PURE__ */ e(s, { size: 20, className: "text-[var(--Text-High-Emphasis)]" })
|
|
@@ -27,5 +27,5 @@ function l({ brand: r, onMenuClick: a, actions: t }) {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
export {
|
|
30
|
-
|
|
30
|
+
n as AdminHeader
|
|
31
31
|
};
|
|
@@ -1,58 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as h, Fragment as S, jsx as n } from "react/jsx-runtime";
|
|
3
3
|
import * as t from "react";
|
|
4
|
-
import
|
|
5
|
-
import { XIcon as
|
|
6
|
-
import { DropdownMenu as q, DropdownMenuTrigger as Z, DropdownMenuContent as
|
|
7
|
-
import { FOCUS_RING as
|
|
4
|
+
import G from "iconsax-reactjs/dist/esm/ArrowDown2.js";
|
|
5
|
+
import { XIcon as K } from "lucide-react";
|
|
6
|
+
import { DropdownMenu as q, DropdownMenuTrigger as Z, DropdownMenuContent as _, DropdownMenuItem as U } from "../foundations/dropdown-menu.js";
|
|
7
|
+
import { FOCUS_RING as W } from "../../lib/focus-ring.js";
|
|
8
8
|
import { cn as F } from "../../lib/utils.js";
|
|
9
|
-
function H(
|
|
10
|
-
return typeof
|
|
9
|
+
function H(u, p) {
|
|
10
|
+
return typeof u == "function" ? u(p) : u;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
function L(u) {
|
|
13
|
+
if (u.button !== 0 || u.metaKey || u.ctrlKey || u.shiftKey || u.altKey) return !1;
|
|
14
|
+
const p = u.currentTarget.getAttribute("target");
|
|
15
|
+
return !(p && p !== "_self");
|
|
16
|
+
}
|
|
17
|
+
function ee({
|
|
18
|
+
items: u,
|
|
19
|
+
activeKey: p,
|
|
15
20
|
drawerTitle: z,
|
|
16
|
-
open:
|
|
17
|
-
onOpenChange:
|
|
21
|
+
open: I = !1,
|
|
22
|
+
onOpenChange: N,
|
|
18
23
|
ariaLabel: E = "管理メニュー",
|
|
19
|
-
linkComponent:
|
|
24
|
+
linkComponent: j
|
|
20
25
|
}) {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, []),
|
|
24
|
-
|
|
25
|
-
}, []),
|
|
26
|
+
const R = j ?? "a", [P, M] = t.useState(null), s = t.useRef(null), g = t.useRef(/* @__PURE__ */ new Set()), b = t.useRef(null), a = t.useRef(null), m = t.useRef(null), o = t.useRef(null), x = t.useRef(/* @__PURE__ */ new Map()), T = t.useRef(/* @__PURE__ */ new Map()), y = t.useRef(null), v = t.useRef(null), D = t.useRef(null), i = t.useCallback(() => {
|
|
27
|
+
v.current !== null && (clearTimeout(v.current), v.current = null);
|
|
28
|
+
}, []), f = t.useCallback(() => {
|
|
29
|
+
y.current !== null && (clearTimeout(y.current), y.current = null);
|
|
30
|
+
}, []), B = t.useCallback(
|
|
26
31
|
(e, l) => {
|
|
27
|
-
l !== "touch" && (
|
|
28
|
-
|
|
32
|
+
l !== "touch" && (f(), i(), y.current = setTimeout(() => {
|
|
33
|
+
a.current !== null && a.current !== e && (a.current = null, x.current.get(e)?.focus({ preventScroll: !0 })), s.current = e, g.current.add(e), M(e), y.current = null;
|
|
29
34
|
}, 80));
|
|
30
35
|
},
|
|
31
|
-
[
|
|
36
|
+
[i, f]
|
|
32
37
|
), A = t.useCallback(
|
|
33
38
|
(e) => {
|
|
34
|
-
|
|
35
|
-
M((l) => l === e ? null : l),
|
|
39
|
+
f(), i(), v.current = setTimeout(() => {
|
|
40
|
+
M((l) => l === e ? null : l), v.current = null;
|
|
36
41
|
}, 120);
|
|
37
42
|
},
|
|
38
|
-
[
|
|
43
|
+
[i, f]
|
|
39
44
|
), O = t.useCallback(() => {
|
|
40
|
-
|
|
41
|
-
}, [
|
|
45
|
+
f(), i(), s.current = null, g.current.clear(), b.current = null, a.current = null, m.current = null, o.current = null, M(null);
|
|
46
|
+
}, [i, f]);
|
|
42
47
|
return t.useEffect(
|
|
43
48
|
() => () => {
|
|
44
|
-
|
|
49
|
+
y.current !== null && clearTimeout(y.current), v.current !== null && clearTimeout(v.current), b.current = null, a.current = null, m.current = null, o.current = null, x.current.clear(), T.current.clear();
|
|
45
50
|
},
|
|
46
51
|
[]
|
|
47
52
|
), t.useEffect(() => {
|
|
48
53
|
const e = D.current;
|
|
49
54
|
if (!e || typeof ResizeObserver > "u") return;
|
|
50
55
|
const l = () => {
|
|
51
|
-
const
|
|
52
|
-
(getComputedStyle(e).display === "none" ||
|
|
53
|
-
},
|
|
54
|
-
return
|
|
55
|
-
}, [O]), /* @__PURE__ */
|
|
56
|
+
const c = e.getBoundingClientRect();
|
|
57
|
+
(getComputedStyle(e).display === "none" || c.width === 0 || c.height === 0) && O();
|
|
58
|
+
}, k = new ResizeObserver(l);
|
|
59
|
+
return k.observe(e), l(), () => k.disconnect();
|
|
60
|
+
}, [O]), /* @__PURE__ */ h(S, { children: [
|
|
56
61
|
/* @__PURE__ */ n(
|
|
57
62
|
"nav",
|
|
58
63
|
{
|
|
@@ -60,25 +65,25 @@ function K({
|
|
|
60
65
|
"data-slot": "admin-side-nav",
|
|
61
66
|
"aria-label": E,
|
|
62
67
|
className: "hidden @md:flex fixed left-0 top-16 bottom-0 z-[var(--Z-Sticky)] w-[72px] flex-col items-center bg-[var(--Surface-Elevated)] border-r border-[var(--Border-Low-Emphasis)]",
|
|
63
|
-
children:
|
|
64
|
-
const l =
|
|
68
|
+
children: u.map((e) => {
|
|
69
|
+
const l = p === e.key, k = !!e.subMenus && e.subMenus.length > 0;
|
|
65
70
|
return /* @__PURE__ */ n("div", { className: "relative", children: (() => {
|
|
66
|
-
const
|
|
71
|
+
const c = F(
|
|
67
72
|
"flex h-16 w-16 flex-col items-center justify-center gap-1 rounded-md transition-colors",
|
|
68
73
|
l ? "text-[var(--Text-Accent-Primary)]" : "text-[var(--Text-Medium-Emphasis)] hover:text-[var(--Text-High-Emphasis)]",
|
|
69
|
-
|
|
70
|
-
),
|
|
74
|
+
W
|
|
75
|
+
), d = /* @__PURE__ */ h(S, { children: [
|
|
71
76
|
H(e.icon, { active: l, placement: "rail" }),
|
|
72
77
|
/* @__PURE__ */ n("span", { className: "max-w-12 text-center typo-label-xs", children: e.label })
|
|
73
78
|
] });
|
|
74
|
-
return
|
|
79
|
+
return k ? /* @__PURE__ */ h(
|
|
75
80
|
q,
|
|
76
81
|
{
|
|
77
82
|
modal: !1,
|
|
78
83
|
open: P === e.key,
|
|
79
84
|
onOpenChange: (r) => {
|
|
80
|
-
|
|
81
|
-
(
|
|
85
|
+
i(), r ? (o.current === e.key && (o.current = null), s.current = null, g.current.delete(e.key), M(e.key)) : M(
|
|
86
|
+
(w) => w === e.key ? null : w
|
|
82
87
|
);
|
|
83
88
|
},
|
|
84
89
|
children: [
|
|
@@ -86,67 +91,67 @@ function K({
|
|
|
86
91
|
"button",
|
|
87
92
|
{
|
|
88
93
|
ref: (r) => {
|
|
89
|
-
r ?
|
|
94
|
+
r ? x.current.set(e.key, r) : x.current.delete(e.key);
|
|
90
95
|
},
|
|
91
96
|
type: "button",
|
|
92
|
-
className:
|
|
97
|
+
className: c,
|
|
93
98
|
onFocus: () => {
|
|
94
|
-
|
|
99
|
+
f(), b.current = e.key, s.current === e.key && (s.current = null), g.current.delete(e.key);
|
|
95
100
|
},
|
|
96
101
|
onBlur: () => {
|
|
97
|
-
|
|
102
|
+
b.current === e.key && (b.current = null);
|
|
98
103
|
},
|
|
99
104
|
onPointerEnter: (r) => {
|
|
100
|
-
|
|
105
|
+
b.current === e.key || m.current === e.key || B(e.key, r.pointerType);
|
|
101
106
|
},
|
|
102
107
|
onPointerDownCapture: () => {
|
|
103
|
-
|
|
108
|
+
f(), P !== e.key && (a.current = e.key);
|
|
104
109
|
},
|
|
105
110
|
onPointerLeave: () => {
|
|
106
|
-
|
|
111
|
+
m.current === e.key && (m.current = null), A(e.key);
|
|
107
112
|
},
|
|
108
|
-
children:
|
|
113
|
+
children: d
|
|
109
114
|
}
|
|
110
115
|
) }),
|
|
111
116
|
/* @__PURE__ */ n(
|
|
112
|
-
|
|
117
|
+
_,
|
|
113
118
|
{
|
|
114
119
|
side: "right",
|
|
115
120
|
align: "start",
|
|
116
121
|
sideOffset: 0,
|
|
117
122
|
collisionPadding: 8,
|
|
118
123
|
className: "w-[240px] rounded-2xl p-2 shadow-menu",
|
|
119
|
-
onPointerEnter:
|
|
124
|
+
onPointerEnter: i,
|
|
120
125
|
onPointerLeave: () => A(e.key),
|
|
121
126
|
onPointerMoveCapture: (r) => {
|
|
122
|
-
|
|
127
|
+
s.current === e.key && r.preventDefault();
|
|
123
128
|
},
|
|
124
129
|
onInteractOutside: (r) => {
|
|
125
|
-
const
|
|
126
|
-
|
|
130
|
+
const w = x.current.get(e.key);
|
|
131
|
+
a.current === e.key && r.target instanceof Node && !w?.contains(r.target) && (o.current = e.key);
|
|
127
132
|
},
|
|
128
133
|
onOpenAutoFocus: (r) => {
|
|
129
|
-
|
|
134
|
+
s.current === e.key ? r.preventDefault() : a.current === e.key && (r.preventDefault(), requestAnimationFrame(() => {
|
|
130
135
|
T.current.get(e.key)?.focus();
|
|
131
136
|
}));
|
|
132
137
|
},
|
|
133
138
|
onCloseAutoFocus: (r) => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}))),
|
|
139
|
+
g.current.has(e.key) && (r.preventDefault(), g.current.delete(e.key), s.current === e.key && (s.current = null)), a.current === e.key && (r.preventDefault(), a.current = null, o.current !== e.key && (m.current = e.key, requestAnimationFrame(() => {
|
|
140
|
+
x.current.get(e.key)?.focus();
|
|
141
|
+
}))), o.current === e.key && (o.current = null);
|
|
137
142
|
},
|
|
138
|
-
children: e.subMenus.map((r,
|
|
139
|
-
|
|
143
|
+
children: e.subMenus.map((r, w) => /* @__PURE__ */ n(
|
|
144
|
+
U,
|
|
140
145
|
{
|
|
141
146
|
asChild: !0,
|
|
142
147
|
className: "min-h-11 px-4",
|
|
143
148
|
onPointerLeave: (C) => {
|
|
144
|
-
|
|
149
|
+
s.current === e.key && C.preventDefault();
|
|
145
150
|
},
|
|
146
151
|
children: /* @__PURE__ */ n(
|
|
147
|
-
|
|
152
|
+
R,
|
|
148
153
|
{
|
|
149
|
-
ref:
|
|
154
|
+
ref: w === 0 ? (C) => {
|
|
150
155
|
C ? T.current.set(
|
|
151
156
|
e.key,
|
|
152
157
|
C
|
|
@@ -164,76 +169,80 @@ function K({
|
|
|
164
169
|
]
|
|
165
170
|
}
|
|
166
171
|
) : e.href ? /* @__PURE__ */ n(
|
|
167
|
-
|
|
172
|
+
R,
|
|
168
173
|
{
|
|
169
174
|
href: e.href,
|
|
170
|
-
className:
|
|
175
|
+
className: c,
|
|
171
176
|
"aria-current": l ? "page" : void 0,
|
|
172
|
-
children:
|
|
177
|
+
children: d
|
|
173
178
|
}
|
|
174
|
-
) : /* @__PURE__ */ n("button", { type: "button", className:
|
|
179
|
+
) : /* @__PURE__ */ n("button", { type: "button", className: c, children: d });
|
|
175
180
|
})() }, e.key);
|
|
176
181
|
})
|
|
177
182
|
}
|
|
178
183
|
),
|
|
179
|
-
|
|
184
|
+
I && /* @__PURE__ */ h("div", { className: "fixed inset-0 z-[var(--Z-Overlay)] @md:hidden", children: [
|
|
180
185
|
/* @__PURE__ */ n(
|
|
181
186
|
"div",
|
|
182
187
|
{
|
|
183
188
|
className: "absolute inset-0 bg-[var(--Overlay-Medium)]",
|
|
184
|
-
onClick: () =>
|
|
189
|
+
onClick: () => N?.(!1)
|
|
185
190
|
}
|
|
186
191
|
),
|
|
187
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ h(
|
|
188
193
|
"nav",
|
|
189
194
|
{
|
|
190
195
|
"aria-label": E,
|
|
191
196
|
className: "absolute left-0 top-0 h-full w-[280px] bg-[var(--Surface-Primary)] shadow-lg overflow-y-auto dark:bg-[var(--Primitive-Gray-900)]",
|
|
192
197
|
children: [
|
|
193
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-between px-4 py-3", children: [
|
|
194
199
|
/* @__PURE__ */ n("span", { className: "typo-label-md text-[var(--Text-High-Emphasis)]", children: z }),
|
|
195
200
|
/* @__PURE__ */ n(
|
|
196
201
|
"button",
|
|
197
202
|
{
|
|
198
|
-
onClick: () =>
|
|
199
|
-
className: "flex size-10 shrink-0 items-center justify-center rounded-full text-[var(--Text-Low-Emphasis)] transition-colors hover:bg-[var(--Surface-Tertiary)] hover:text-[var(--Text-High-Emphasis)] focus-visible:ring-2 focus-visible:ring-[var(--Focus-High-Emphasis)] focus-visible:outline-hidden",
|
|
203
|
+
onClick: () => N?.(!1),
|
|
204
|
+
className: "flex size-10 shrink-0 items-center justify-center rounded-full text-[var(--Text-Low-Emphasis)] transition-colors hover:bg-[var(--Surface-Neutral-Tertiary)] hover:text-[var(--Text-High-Emphasis)] focus-visible:ring-2 focus-visible:ring-[var(--Focus-High-Emphasis)] focus-visible:outline-hidden",
|
|
200
205
|
"aria-label": "閉じる",
|
|
201
|
-
children: /* @__PURE__ */ n(
|
|
206
|
+
children: /* @__PURE__ */ n(K, { className: "size-5" })
|
|
202
207
|
}
|
|
203
208
|
)
|
|
204
209
|
] }),
|
|
205
|
-
|
|
206
|
-
const l =
|
|
207
|
-
return /* @__PURE__ */
|
|
210
|
+
u.map((e) => {
|
|
211
|
+
const l = p === e.key, k = !!e.subMenus && e.subMenus.length > 0;
|
|
212
|
+
return /* @__PURE__ */ h("div", { children: [
|
|
208
213
|
(() => {
|
|
209
|
-
const
|
|
214
|
+
const c = F(
|
|
210
215
|
"flex w-full items-center gap-3 px-4 py-3 transition-colors",
|
|
211
|
-
l ? "text-[var(--Text-Accent-Primary)] bg-[var(--Surface-Accent-Primary-Light)]" : "text-[var(--Text-High-Emphasis)] hover:bg-[var(--Surface-Secondary)]"
|
|
212
|
-
),
|
|
216
|
+
l ? "text-[var(--Text-Accent-Primary)] bg-[var(--Surface-Accent-Primary-Light)]" : "text-[var(--Text-High-Emphasis)] hover:bg-[var(--Surface-Neutral-Secondary)]"
|
|
217
|
+
), d = /* @__PURE__ */ h(S, { children: [
|
|
213
218
|
H(e.icon, { active: l, placement: "drawer" }),
|
|
214
219
|
/* @__PURE__ */ n("span", { className: "typo-label-md", children: e.label }),
|
|
215
|
-
|
|
220
|
+
k && /* @__PURE__ */ n(G, { size: 16, className: "ml-auto text-[var(--Text-Low-Emphasis)]" })
|
|
216
221
|
] });
|
|
217
222
|
return e.href ? /* @__PURE__ */ n(
|
|
218
|
-
|
|
223
|
+
R,
|
|
219
224
|
{
|
|
220
225
|
href: e.href,
|
|
221
|
-
className:
|
|
226
|
+
className: c,
|
|
222
227
|
"aria-current": l ? "page" : void 0,
|
|
223
|
-
onClick: () =>
|
|
224
|
-
|
|
228
|
+
onClick: (r) => {
|
|
229
|
+
L(r) && N?.(!1);
|
|
230
|
+
},
|
|
231
|
+
children: d
|
|
225
232
|
}
|
|
226
|
-
) : /* @__PURE__ */ n("button", { type: "button", className:
|
|
233
|
+
) : /* @__PURE__ */ n("button", { type: "button", className: c, children: d });
|
|
227
234
|
})(),
|
|
228
|
-
|
|
229
|
-
|
|
235
|
+
k && /* @__PURE__ */ n("div", { className: "bg-[var(--Surface-Neutral-Secondary)] dark:bg-[var(--Primitive-Gray-900)]", children: e.subMenus.map((c) => /* @__PURE__ */ n(
|
|
236
|
+
R,
|
|
230
237
|
{
|
|
231
|
-
href:
|
|
232
|
-
onClick: () =>
|
|
238
|
+
href: c.href,
|
|
239
|
+
onClick: (d) => {
|
|
240
|
+
L(d) && N?.(!1);
|
|
241
|
+
},
|
|
233
242
|
className: "flex min-h-11 items-center px-12 py-2.5 typo-body-md text-[var(--Text-Medium-Emphasis)] hover:text-[var(--Text-High-Emphasis)]",
|
|
234
|
-
children:
|
|
243
|
+
children: c.label
|
|
235
244
|
},
|
|
236
|
-
|
|
245
|
+
c.label
|
|
237
246
|
)) })
|
|
238
247
|
] }, e.key);
|
|
239
248
|
})
|
|
@@ -244,5 +253,5 @@ function K({
|
|
|
244
253
|
] });
|
|
245
254
|
}
|
|
246
255
|
export {
|
|
247
|
-
|
|
256
|
+
ee as AdminSideNav
|
|
248
257
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import { cn as a } from "../../lib/utils.js";
|
|
4
|
-
function g({ items: c, className:
|
|
4
|
+
function g({ items: c, className: l, linkComponent: s }) {
|
|
5
5
|
return /* @__PURE__ */ o(
|
|
6
6
|
"div",
|
|
7
7
|
{
|
|
8
8
|
"data-slot": "category-shortcuts",
|
|
9
9
|
className: a(
|
|
10
10
|
"flex gap-3 overflow-x-auto px-4 py-2 scrollbar-hide",
|
|
11
|
-
|
|
11
|
+
l
|
|
12
12
|
),
|
|
13
13
|
children: [
|
|
14
|
-
c.map((r,
|
|
15
|
-
const
|
|
14
|
+
c.map((r, t) => {
|
|
15
|
+
const n = !!r.href || !!r.onClick, i = r.href ? s ?? "a" : "button", d = r.href ? { href: r.href, onClick: r.onClick } : { type: "button", onClick: r.onClick };
|
|
16
16
|
return /* @__PURE__ */ o(
|
|
17
17
|
i,
|
|
18
18
|
{
|
|
19
19
|
...d,
|
|
20
20
|
className: a(
|
|
21
21
|
"flex shrink-0 flex-col items-center gap-1 rounded-lg p-1 transition-colors",
|
|
22
|
-
|
|
22
|
+
n && "hover:bg-[var(--Surface-Neutral-Secondary)]",
|
|
23
23
|
r.isSelected && "bg-[var(--Surface-Accent-Primary-Light)]"
|
|
24
24
|
),
|
|
25
25
|
children: [
|
|
@@ -53,7 +53,7 @@ function g({ items: c, className: s, linkComponent: l }) {
|
|
|
53
53
|
)
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
|
-
|
|
56
|
+
t
|
|
57
57
|
);
|
|
58
58
|
}),
|
|
59
59
|
/* @__PURE__ */ e("div", { className: "shrink-0 w-2", "aria-hidden": "true" })
|
|
@@ -65,7 +65,7 @@ function re({
|
|
|
65
65
|
// フォーカス意匠は DS 共通(FOCUS_RING_WITHIN。以前は同じクラスを手で書いていた)。
|
|
66
66
|
// 枠はこのラッパーが描く(内側の Textarea はリングを消している)
|
|
67
67
|
U,
|
|
68
|
-
i && "border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Secondary)]",
|
|
68
|
+
i && "border-[var(--Border-Low-Emphasis)] bg-[var(--Surface-Neutral-Secondary)]",
|
|
69
69
|
j
|
|
70
70
|
),
|
|
71
71
|
children: [
|