@cakejp/design-system 0.17.1 → 0.19.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 +50 -0
- package/CLAUDE.md +15 -0
- package/contracts/components.json +144 -16
- package/contracts/composition.json +1 -1
- package/contracts/rules.json +5 -1
- package/contracts/screen-patterns.json +1 -1
- package/dist/components/ec/admin-shell.js +7 -6
- package/dist/components/ec/product-card.js +107 -102
- package/dist/components/ec/product-option.js +1 -0
- package/dist/components/ec/review-card.js +22 -20
- package/dist/components/ec/review-form.js +1 -0
- package/dist/components/foundations/accordion.js +23 -22
- package/dist/components/foundations/alert.js +1 -0
- package/dist/components/foundations/aspect-ratio.js +3 -2
- package/dist/components/foundations/avatar.js +1 -0
- package/dist/components/foundations/button.js +7 -1
- package/dist/components/foundations/calendar.js +1 -0
- package/dist/components/foundations/checkbox-group.js +1 -0
- package/dist/components/foundations/checkbox.js +1 -0
- package/dist/components/foundations/command.js +1 -0
- package/dist/components/foundations/context-menu.js +1 -0
- package/dist/components/foundations/drawer.js +1 -0
- package/dist/components/foundations/file-input.js +1 -0
- package/dist/components/foundations/form.js +26 -25
- package/dist/components/foundations/pagination.js +49 -46
- package/dist/components/foundations/popover.js +9 -8
- package/dist/components/foundations/radio-group.js +3 -2
- package/dist/components/foundations/responsive-dialog.js +1 -0
- package/dist/components/foundations/separator.js +7 -6
- package/dist/components/foundations/sheet.js +40 -33
- package/dist/components/foundations/slider.js +7 -6
- package/dist/components/foundations/social-icon.js +30 -10
- package/dist/components/foundations/sonner.js +5 -4
- package/dist/components/foundations/tabs.js +45 -25
- package/dist/components/foundations/toggle-group.js +6 -5
- package/dist/components/primitives/admin-side-nav.js +1 -0
- package/dist/components/primitives/chat-composer.js +1 -0
- package/dist/components/primitives/combobox.js +1 -0
- package/dist/components/primitives/content-card.js +111 -0
- package/dist/components/primitives/content-carousel.js +9 -8
- package/dist/components/primitives/date-picker.js +9 -8
- package/dist/components/primitives/footer.js +169 -100
- package/dist/components/primitives/form-field.js +1 -0
- package/dist/components/primitives/header.js +220 -176
- package/dist/components/primitives/image-carousel.js +8 -7
- package/dist/components/primitives/image-gallery.js +15 -14
- package/dist/components/primitives/image-input.js +9 -8
- package/dist/components/primitives/list-item.js +9 -8
- package/dist/components/primitives/menu-drawer.js +60 -56
- package/dist/components/primitives/multi-select.js +7 -6
- package/dist/components/primitives/number-input.js +1 -0
- package/dist/components/primitives/prose.js +52 -0
- package/dist/components/primitives/search-bar.js +81 -66
- package/dist/components/primitives/section-header.js +58 -55
- package/dist/components/primitives/share-buttons.js +93 -85
- package/dist/components/primitives/status-count-tabs.js +8 -7
- package/dist/components/primitives/sub-nav.js +52 -52
- package/dist/index.css +1 -1
- package/dist/index.js +1513 -559
- package/dist/lib/field-labelling.js +7 -6
- package/dist/lib/link-component.js +6 -0
- package/dist/lib/use-value-length.js +1 -0
- package/dist/types/components/ec/product-card.d.ts +12 -19
- package/dist/types/components/ec/review-card.d.ts +6 -1
- package/dist/types/components/foundations/button.d.ts +1 -1
- package/dist/types/components/foundations/chip-variants.d.ts +1 -1
- package/dist/types/components/foundations/data-table.d.ts +9 -1
- package/dist/types/components/foundations/pagination.d.ts +7 -1
- package/dist/types/components/foundations/sheet.d.ts +6 -1
- package/dist/types/components/foundations/social-icon.d.ts +1 -1
- package/dist/types/components/foundations/tabs.d.ts +2 -1
- package/dist/types/components/primitives/content-card.d.ts +67 -0
- package/dist/types/components/primitives/footer.d.ts +21 -1
- package/dist/types/components/primitives/header.d.ts +30 -2
- package/dist/types/components/primitives/menu-drawer.d.ts +7 -1
- package/dist/types/components/primitives/prose.d.ts +35 -0
- package/dist/types/components/primitives/search-bar.d.ts +14 -1
- package/dist/types/components/primitives/section-header.d.ts +2 -1
- package/dist/types/components/primitives/share-buttons.d.ts +26 -4
- package/dist/types/components/primitives/sub-nav.d.ts +16 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/lib/link-component.d.ts +26 -0
- package/package.json +4 -3
- package/src/components/COMPONENT_LOOKUP.md +7 -5
- package/src/preset-standalone.css +1 -0
- package/src/preset.css +8 -0
- package/src/styles/semantic.css +1 -0
- package/tokens.json +8 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as g, jsx as i } from "react/jsx-runtime";
|
|
2
3
|
import * as s from "react";
|
|
3
4
|
import { cva as J } from "class-variance-authority";
|
|
@@ -69,12 +70,12 @@ function ce({
|
|
|
69
70
|
onBlur: n,
|
|
70
71
|
id: r,
|
|
71
72
|
name: l,
|
|
72
|
-
accept:
|
|
73
|
+
accept: u = "image/png,image/jpeg",
|
|
73
74
|
maxSizeMb: v = 2,
|
|
74
75
|
aspect: F,
|
|
75
76
|
size: L,
|
|
76
77
|
objectFit: U = "cover",
|
|
77
|
-
disabled:
|
|
78
|
+
disabled: d = !1,
|
|
78
79
|
clearable: A = !0,
|
|
79
80
|
error: C,
|
|
80
81
|
onValidationError: P,
|
|
@@ -100,11 +101,11 @@ function ce({
|
|
|
100
101
|
}, M = (t) => {
|
|
101
102
|
const o = t[0];
|
|
102
103
|
if (o) {
|
|
103
|
-
if (!Y(o,
|
|
104
|
+
if (!Y(o, u)) {
|
|
104
105
|
y(
|
|
105
106
|
"accept",
|
|
106
107
|
o,
|
|
107
|
-
`画像形式は${Z(
|
|
108
|
+
`画像形式は${Z(u)}のみアップロードできます。`
|
|
108
109
|
);
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
@@ -119,7 +120,7 @@ function ce({
|
|
|
119
120
|
"div",
|
|
120
121
|
{
|
|
121
122
|
"data-slot": "image-input",
|
|
122
|
-
"data-disabled":
|
|
123
|
+
"data-disabled": d || void 0,
|
|
123
124
|
className: h("flex min-w-0 flex-col gap-2", G),
|
|
124
125
|
onBlur: q,
|
|
125
126
|
children: [
|
|
@@ -156,7 +157,7 @@ function ce({
|
|
|
156
157
|
),
|
|
157
158
|
/* @__PURE__ */ i("span", { className: "typo-body-xs text-[var(--Text-Low-Emphasis)]", children: R })
|
|
158
159
|
] }),
|
|
159
|
-
c && A && !
|
|
160
|
+
c && A && !d && /* @__PURE__ */ i(
|
|
160
161
|
X,
|
|
161
162
|
{
|
|
162
163
|
type: "button",
|
|
@@ -176,9 +177,9 @@ function ce({
|
|
|
176
177
|
{
|
|
177
178
|
id: b,
|
|
178
179
|
name: l,
|
|
179
|
-
accept:
|
|
180
|
+
accept: u,
|
|
180
181
|
maxSize: v * 1024 * 1024,
|
|
181
|
-
disabled:
|
|
182
|
+
disabled: d,
|
|
182
183
|
buttonLabel: T ?? (c ? "画像を変更" : "画像を選択"),
|
|
183
184
|
placeholder: "",
|
|
184
185
|
value: [],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as x, Fragment as D, jsx as e } from "react/jsx-runtime";
|
|
2
3
|
import * as L from "react";
|
|
3
4
|
import K from "iconsax-reactjs/dist/esm/ArrowRight2.js";
|
|
@@ -7,7 +8,7 @@ import { cn as g } from "../../lib/utils.js";
|
|
|
7
8
|
function q({
|
|
8
9
|
title: p,
|
|
9
10
|
caption: o,
|
|
10
|
-
rightType:
|
|
11
|
+
rightType: a = "arrow-right",
|
|
11
12
|
rightText: d,
|
|
12
13
|
badgeCount: m,
|
|
13
14
|
toggleChecked: y = !1,
|
|
@@ -22,8 +23,8 @@ function q({
|
|
|
22
23
|
className: S,
|
|
23
24
|
...s
|
|
24
25
|
}) {
|
|
25
|
-
const u = L.useId(), t = o ? "md" : !!(l || n) ? "lg" : N, v = !!c, r = !v && typeof s.onClick == "function", j = v || r, C = r ? (
|
|
26
|
-
s.onKeyDown?.(
|
|
26
|
+
const u = L.useId(), t = o ? "md" : !!(l || n) ? "lg" : N, v = !!c, r = !v && typeof s.onClick == "function", j = v || r, C = r ? (i) => {
|
|
27
|
+
s.onKeyDown?.(i), !i.defaultPrevented && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), i.currentTarget.click());
|
|
27
28
|
} : s.onKeyDown, z = t === "lg" ? "min-h-16 py-4" : t === "md" ? "min-h-14 py-2" : "min-h-11 py-2", H = t === "lg" ? "typo-body-lg text-[var(--Text-High-Emphasis)]" : "typo-body-md text-[var(--Text-High-Emphasis)]", f = g(
|
|
28
29
|
"relative flex w-full items-center gap-2 bg-[var(--Surface-Primary)] px-4 rounded-lg",
|
|
29
30
|
z,
|
|
@@ -38,11 +39,11 @@ function q({
|
|
|
38
39
|
/* @__PURE__ */ e("span", { id: u, className: g("truncate", H), children: p }),
|
|
39
40
|
o && /* @__PURE__ */ e("span", { className: "truncate typo-body-sm text-[var(--Text-Medium-Emphasis)]", children: o })
|
|
40
41
|
] }),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
a === "arrow-right" && /* @__PURE__ */ e(K, { size: 20, className: "shrink-0 text-[var(--Object-Low-Emphasis)]" }),
|
|
43
|
+
a === "arrow-down" && /* @__PURE__ */ e(F, { size: 20, className: "shrink-0 text-[var(--Object-Low-Emphasis)]" }),
|
|
44
|
+
a === "text" && d && /* @__PURE__ */ e("span", { className: "shrink-0 typo-body-md text-[var(--Text-High-Emphasis)]", children: d }),
|
|
45
|
+
a === "badge" && m !== void 0 && /* @__PURE__ */ e("span", { className: "flex shrink-0 h-[13px] min-w-[13px] items-center justify-center rounded-full bg-[var(--Surface-Caution,#ec0000)] px-1 typo-label-xs text-white", children: m }),
|
|
46
|
+
a === "toggle" && /* @__PURE__ */ e(
|
|
46
47
|
O,
|
|
47
48
|
{
|
|
48
49
|
checked: y,
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as l, jsx as e, Fragment as c } from "react/jsx-runtime";
|
|
3
|
+
import * as z from "react";
|
|
4
|
+
import j from "iconsax-reactjs/dist/esm/ArrowDown2.js";
|
|
5
|
+
import S from "iconsax-reactjs/dist/esm/ArrowRight2.js";
|
|
6
|
+
import B from "iconsax-reactjs/dist/esm/ArrowUp2.js";
|
|
7
|
+
import L from "iconsax-reactjs/dist/esm/Add.js";
|
|
8
|
+
import { X as M } from "lucide-react";
|
|
9
|
+
import { cn as A } from "../../lib/utils.js";
|
|
10
|
+
import { resolveLinkComponent as m } from "../../lib/link-component.js";
|
|
11
|
+
import { Button as x } from "../foundations/button.js";
|
|
12
|
+
const v = "flex min-h-12 items-center gap-1 mx-2 rounded-lg px-2 py-3 typo-body-md text-[var(--Text-High-Emphasis)] transition-colors duration-[var(--Motion-Duration-Base)] ease-[var(--Motion-Easing-Standard)] hover:bg-[var(--Surface-Secondary)] active:bg-[var(--Surface-Tertiary)]";
|
|
13
|
+
function _({
|
|
12
14
|
userName: r,
|
|
13
|
-
isLoggedIn:
|
|
14
|
-
hideLoginLink:
|
|
15
|
-
sections:
|
|
16
|
-
banners:
|
|
17
|
-
onClose:
|
|
18
|
-
onLogin:
|
|
19
|
-
loginHref:
|
|
20
|
-
className:
|
|
21
|
-
|
|
15
|
+
isLoggedIn: t = !1,
|
|
16
|
+
hideLoginLink: d = !1,
|
|
17
|
+
sections: g,
|
|
18
|
+
banners: o,
|
|
19
|
+
onClose: h,
|
|
20
|
+
onLogin: p,
|
|
21
|
+
loginHref: N = "/security/login_link/",
|
|
22
|
+
className: b,
|
|
23
|
+
linkComponent: n,
|
|
24
|
+
...y
|
|
22
25
|
}) {
|
|
23
|
-
const [
|
|
26
|
+
const w = m(n), k = m(n), [f, E] = z.useState(
|
|
24
27
|
/* @__PURE__ */ new Set()
|
|
25
|
-
),
|
|
26
|
-
|
|
28
|
+
), T = (a) => {
|
|
29
|
+
E((i) => {
|
|
27
30
|
const s = new Set(i);
|
|
28
31
|
return s.has(a) ? s.delete(a) : s.add(a), s;
|
|
29
32
|
});
|
|
@@ -32,39 +35,39 @@ function P({
|
|
|
32
35
|
"div",
|
|
33
36
|
{
|
|
34
37
|
"data-slot": "menu-drawer",
|
|
35
|
-
className:
|
|
38
|
+
className: A(
|
|
36
39
|
"flex h-full w-80 flex-col bg-[var(--Surface-Primary)]",
|
|
37
|
-
|
|
40
|
+
b
|
|
38
41
|
),
|
|
39
|
-
...
|
|
42
|
+
...y,
|
|
40
43
|
children: [
|
|
41
|
-
(
|
|
42
|
-
|
|
44
|
+
(t || h) && /* @__PURE__ */ l("div", { className: "flex items-center justify-between px-4 py-3", children: [
|
|
45
|
+
t ? /* @__PURE__ */ e("div", { children: /* @__PURE__ */ l("p", { className: "typo-label-md text-[var(--Text-High-Emphasis)]", children: [
|
|
43
46
|
r ?? "ゲスト",
|
|
44
47
|
"さま"
|
|
45
48
|
] }) }) : /* @__PURE__ */ e("div", {}),
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
h && /* @__PURE__ */ e(
|
|
50
|
+
x,
|
|
48
51
|
{
|
|
49
52
|
variant: "ghost",
|
|
50
53
|
size: "icon-sm",
|
|
51
|
-
onClick:
|
|
54
|
+
onClick: h,
|
|
52
55
|
"aria-label": "メニューを閉じる",
|
|
53
|
-
children: /* @__PURE__ */ e(
|
|
56
|
+
children: /* @__PURE__ */ e(M, { className: "size-5" })
|
|
54
57
|
}
|
|
55
58
|
)
|
|
56
59
|
] }),
|
|
57
|
-
!
|
|
60
|
+
!t && !d && /* @__PURE__ */ l(c, { children: [
|
|
58
61
|
/* @__PURE__ */ e("div", { className: "py-2", children: /* @__PURE__ */ e("ul", { children: /* @__PURE__ */ e("li", { children: /* @__PURE__ */ l(
|
|
59
|
-
|
|
62
|
+
w,
|
|
60
63
|
{
|
|
61
|
-
href:
|
|
62
|
-
onClick:
|
|
63
|
-
a.preventDefault(),
|
|
64
|
+
href: N,
|
|
65
|
+
onClick: p ? (a) => {
|
|
66
|
+
a.preventDefault(), p();
|
|
64
67
|
} : void 0,
|
|
65
|
-
className:
|
|
68
|
+
className: v,
|
|
66
69
|
children: [
|
|
67
|
-
/* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center text-[var(--Text-Medium-Emphasis)]", children: /* @__PURE__ */ e(
|
|
70
|
+
/* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center text-[var(--Text-Medium-Emphasis)]", children: /* @__PURE__ */ e(L, { size: 16 }) }),
|
|
68
71
|
/* @__PURE__ */ e("span", { className: "flex-1", children: "ログイン・新規会員登録" })
|
|
69
72
|
]
|
|
70
73
|
}
|
|
@@ -72,36 +75,36 @@ function P({
|
|
|
72
75
|
/* @__PURE__ */ e("div", { className: "h-px w-full bg-[var(--Border-Low-Emphasis)]" })
|
|
73
76
|
] }),
|
|
74
77
|
/* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto", children: [
|
|
75
|
-
|
|
78
|
+
g.map((a, i) => /* @__PURE__ */ l("div", { children: [
|
|
76
79
|
a.border && /* @__PURE__ */ e("div", { className: "h-px w-full bg-[var(--Border-Low-Emphasis)]" }),
|
|
77
80
|
/* @__PURE__ */ l("div", { className: "py-2", children: [
|
|
78
81
|
a.title && /* @__PURE__ */ e("div", { className: "px-4 pb-1 pt-2", children: /* @__PURE__ */ l("p", { className: "flex items-center gap-1 typo-label-md font-bold text-[var(--Text-High-Emphasis)]", children: [
|
|
79
82
|
a.icon && /* @__PURE__ */ e("span", { className: "flex size-5 shrink-0 items-center justify-center", children: a.icon }),
|
|
80
83
|
/* @__PURE__ */ e("span", { children: a.title })
|
|
81
84
|
] }) }),
|
|
82
|
-
/* @__PURE__ */ e("ul", { children: a.items.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(
|
|
83
|
-
a.itemsExtra && a.itemsExtra.length > 0 && /* @__PURE__ */ l(
|
|
84
|
-
|
|
85
|
+
/* @__PURE__ */ e("ul", { children: a.items.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(u, { linkComponent: n, item: s }) }, s.label)) }),
|
|
86
|
+
a.itemsExtra && a.itemsExtra.length > 0 && /* @__PURE__ */ l(c, { children: [
|
|
87
|
+
f.has(i) && /* @__PURE__ */ e("ul", { children: a.itemsExtra.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ e(u, { linkComponent: n, item: s }) }, s.label)) }),
|
|
85
88
|
/* @__PURE__ */ e(
|
|
86
|
-
|
|
89
|
+
x,
|
|
87
90
|
{
|
|
88
91
|
variant: "ghost",
|
|
89
92
|
className: "flex w-full items-center justify-center gap-1 rounded-none px-4 py-3 typo-label-md text-[var(--Text-Accent-Primary)]",
|
|
90
|
-
onClick: () =>
|
|
91
|
-
children:
|
|
93
|
+
onClick: () => T(i),
|
|
94
|
+
children: f.has(i) ? /* @__PURE__ */ l(c, { children: [
|
|
92
95
|
/* @__PURE__ */ e("span", { children: "折りたたむ" }),
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
] }) : /* @__PURE__ */ l(
|
|
96
|
+
/* @__PURE__ */ e(B, { size: 16 })
|
|
97
|
+
] }) : /* @__PURE__ */ l(c, { children: [
|
|
95
98
|
/* @__PURE__ */ e("span", { children: "すべて表示" }),
|
|
96
|
-
/* @__PURE__ */ e(
|
|
99
|
+
/* @__PURE__ */ e(j, { size: 16 })
|
|
97
100
|
] })
|
|
98
101
|
}
|
|
99
102
|
)
|
|
100
103
|
] })
|
|
101
104
|
] })
|
|
102
105
|
] }, i)),
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
o && o.length > 0 && /* @__PURE__ */ e("div", { className: "px-6 py-6", children: /* @__PURE__ */ e("ul", { className: "flex justify-center", children: o.map((a, i) => /* @__PURE__ */ e("li", { className: "w-1/2 max-w-28 px-2", children: /* @__PURE__ */ e(
|
|
107
|
+
k,
|
|
105
108
|
{
|
|
106
109
|
href: a.href ?? "#",
|
|
107
110
|
className: "block overflow-hidden rounded",
|
|
@@ -121,13 +124,14 @@ function P({
|
|
|
121
124
|
}
|
|
122
125
|
);
|
|
123
126
|
}
|
|
124
|
-
function
|
|
127
|
+
function u({ item: r, linkComponent: t }) {
|
|
128
|
+
const d = m(t);
|
|
125
129
|
return /* @__PURE__ */ l(
|
|
126
|
-
|
|
130
|
+
d,
|
|
127
131
|
{
|
|
128
132
|
href: r.href ?? "#",
|
|
129
133
|
onClick: r.onClick,
|
|
130
|
-
className:
|
|
134
|
+
className: v,
|
|
131
135
|
children: [
|
|
132
136
|
r.thumb && /* @__PURE__ */ e("picture", { className: "relative mr-1 block size-9 shrink-0 overflow-hidden rounded", children: /* @__PURE__ */ e(
|
|
133
137
|
"img",
|
|
@@ -144,11 +148,11 @@ function p({ item: r }) {
|
|
|
144
148
|
r.badge && /* @__PURE__ */ e("span", { className: "rounded-full bg-[var(--Brand-Cake-Orange)] px-2 py-0.5 typo-label-xs text-[var(--Text-on-Inverse)]", children: r.badge }),
|
|
145
149
|
r.subText && /* @__PURE__ */ e("span", { className: "typo-body-sm text-[var(--Text-Low-Emphasis)]", children: r.subText })
|
|
146
150
|
] }),
|
|
147
|
-
r.hasChildren && /* @__PURE__ */ e(
|
|
151
|
+
r.hasChildren && /* @__PURE__ */ e(S, { size: 16, className: "shrink-0 text-[var(--Object-High-Emphasis)]" })
|
|
148
152
|
]
|
|
149
153
|
}
|
|
150
154
|
);
|
|
151
155
|
}
|
|
152
156
|
export {
|
|
153
|
-
|
|
157
|
+
_ as MenuDrawer
|
|
154
158
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs as r, jsx as a } from "react/jsx-runtime";
|
|
2
3
|
import * as E from "react";
|
|
3
4
|
import { ChevronsUpDown as P, Check as S } from "lucide-react";
|
|
@@ -8,10 +9,10 @@ import { Popover as R, PopoverTrigger as B, PopoverContent as G } from "../found
|
|
|
8
9
|
import { useFieldLabelling as H, resolveFieldAria as U } from "../../lib/field-labelling.js";
|
|
9
10
|
import { Chip as $ } from "./chip.js";
|
|
10
11
|
function W({
|
|
11
|
-
options:
|
|
12
|
+
options: n,
|
|
12
13
|
value: l = [],
|
|
13
14
|
onValueChange: f,
|
|
14
|
-
placeholder:
|
|
15
|
+
placeholder: d = "選択してください",
|
|
15
16
|
searchPlaceholder: v = "検索",
|
|
16
17
|
emptyLabel: g = "候補がありません",
|
|
17
18
|
disabled: m,
|
|
@@ -22,7 +23,7 @@ function W({
|
|
|
22
23
|
"aria-label": t,
|
|
23
24
|
"aria-labelledby": s
|
|
24
25
|
}) {
|
|
25
|
-
const [p, C] = E.useState(!1), i =
|
|
26
|
+
const [p, C] = E.useState(!1), i = n.filter((e) => l.includes(e.value)), h = H(), w = U(
|
|
26
27
|
{
|
|
27
28
|
id: o,
|
|
28
29
|
"aria-label": t,
|
|
@@ -30,7 +31,7 @@ function W({
|
|
|
30
31
|
"aria-describedby": c
|
|
31
32
|
},
|
|
32
33
|
h
|
|
33
|
-
), N = !h && !t && !s ?
|
|
34
|
+
), N = !h && !t && !s ? d : void 0, u = (e) => f?.(l.includes(e) ? l.filter((j) => j !== e) : [...l, e]);
|
|
34
35
|
return /* @__PURE__ */ r("div", { "data-slot": "multi-select", className: b("flex flex-col gap-2", x), children: [
|
|
35
36
|
/* @__PURE__ */ r(R, { open: p, onOpenChange: C, children: [
|
|
36
37
|
/* @__PURE__ */ a(B, { asChild: !0, children: /* @__PURE__ */ r(
|
|
@@ -50,7 +51,7 @@ function W({
|
|
|
50
51
|
disabled: m,
|
|
51
52
|
className: "w-full justify-between bg-[var(--Surface-Primary)]",
|
|
52
53
|
children: [
|
|
53
|
-
/* @__PURE__ */ a("span", { className: i.length ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]", children: i.length ? `${i.length}件選択中` :
|
|
54
|
+
/* @__PURE__ */ a("span", { className: i.length ? "text-[var(--Text-High-Emphasis)]" : "text-[var(--Text-Low-Emphasis)]", children: i.length ? `${i.length}件選択中` : d }),
|
|
54
55
|
/* @__PURE__ */ a(P, { "aria-hidden": "true", className: "text-[var(--Object-Medium-Emphasis)]" })
|
|
55
56
|
]
|
|
56
57
|
}
|
|
@@ -59,7 +60,7 @@ function W({
|
|
|
59
60
|
/* @__PURE__ */ a(T, { placeholder: v }),
|
|
60
61
|
/* @__PURE__ */ r(A, { children: [
|
|
61
62
|
/* @__PURE__ */ a(F, { children: g }),
|
|
62
|
-
/* @__PURE__ */ a(I, { children:
|
|
63
|
+
/* @__PURE__ */ a(I, { children: n.map((e) => /* @__PURE__ */ r(
|
|
63
64
|
M,
|
|
64
65
|
{
|
|
65
66
|
value: [e.label, ...e.keywords ?? []].join(" "),
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { cn as l } from "../../lib/utils.js";
|
|
4
|
+
function s({ className: a, html: e, as: r = "div", children: d, ...o }) {
|
|
5
|
+
const t = l(
|
|
6
|
+
// 基本の本文
|
|
7
|
+
"typo-body-md text-[var(--Text-High-Emphasis)]",
|
|
8
|
+
// 見出し
|
|
9
|
+
"[&_h2]:mt-10 [&_h2]:mb-4 [&_h2]:typo-heading-2xl",
|
|
10
|
+
"[&_h3]:mt-8 [&_h3]:mb-3 [&_h3]:typo-heading-xl",
|
|
11
|
+
"[&_h4]:mt-6 [&_h4]:mb-2 [&_h4]:typo-heading-lg",
|
|
12
|
+
"[&_h5]:mt-6 [&_h5]:mb-2 [&_h5]:typo-heading-md",
|
|
13
|
+
// 段落・リスト
|
|
14
|
+
"[&_p]:my-4",
|
|
15
|
+
"[&_ul]:my-4 [&_ul]:list-disc [&_ul]:pl-6",
|
|
16
|
+
"[&_ol]:my-4 [&_ol]:list-decimal [&_ol]:pl-6",
|
|
17
|
+
"[&_li]:my-1",
|
|
18
|
+
// 引用
|
|
19
|
+
"[&_blockquote]:my-6 [&_blockquote]:border-l-4 [&_blockquote]:border-[var(--Border-Medium-Emphasis)] [&_blockquote]:pl-4 [&_blockquote]:text-[var(--Text-Medium-Emphasis)]",
|
|
20
|
+
// リンク
|
|
21
|
+
"[&_a]:text-[var(--Text-Accent-Primary)] [&_a]:underline [&_a]:underline-offset-2 [&_a:hover]:no-underline",
|
|
22
|
+
// 画像・図版
|
|
23
|
+
"[&_img]:my-6 [&_img]:h-auto [&_img]:w-full [&_img]:rounded-lg",
|
|
24
|
+
"[&_figure]:my-6 [&_figcaption]:mt-2 [&_figcaption]:typo-body-sm [&_figcaption]:text-[var(--Text-Medium-Emphasis)]",
|
|
25
|
+
// 表。block + w-max + max-w-full で、枠に収まるまで縮み、縮みきれなければ
|
|
26
|
+
// 表自身が横スクロールする。どちらの場合もページを横に伸ばさない
|
|
27
|
+
"[&_table]:my-6 [&_table]:block [&_table]:w-max [&_table]:max-w-full [&_table]:overflow-x-auto [&_table]:border-collapse",
|
|
28
|
+
"[&_th]:border [&_th]:border-[var(--Border-Low-Emphasis)] [&_th]:bg-[var(--Surface-Secondary)] [&_th]:px-3 [&_th]:py-2 [&_th]:text-left [&_th]:typo-label-sm",
|
|
29
|
+
"[&_td]:border [&_td]:border-[var(--Border-Low-Emphasis)] [&_td]:px-3 [&_td]:py-2",
|
|
30
|
+
// コード
|
|
31
|
+
"[&_code]:rounded-xs [&_code]:bg-[var(--Surface-Secondary)] [&_code]:px-1 [&_code]:py-0.5",
|
|
32
|
+
"[&_pre]:my-6 [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-[var(--Surface-Secondary)] [&_pre]:p-4",
|
|
33
|
+
"[&_pre_code]:bg-transparent [&_pre_code]:p-0",
|
|
34
|
+
// 区切り線
|
|
35
|
+
"[&_hr]:my-8 [&_hr]:border-t [&_hr]:border-[var(--Border-Low-Emphasis)]",
|
|
36
|
+
// 先頭・末尾は外側の余白と二重にしない
|
|
37
|
+
"[&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
38
|
+
a
|
|
39
|
+
);
|
|
40
|
+
return e !== void 0 ? /* @__PURE__ */ _(
|
|
41
|
+
r,
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "prose",
|
|
44
|
+
className: t,
|
|
45
|
+
dangerouslySetInnerHTML: { __html: e },
|
|
46
|
+
...o
|
|
47
|
+
}
|
|
48
|
+
) : /* @__PURE__ */ _(r, { "data-slot": "prose", className: t, ...o, children: d });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
s as Prose
|
|
52
|
+
};
|
|
@@ -1,81 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as N, Fragment as S, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import * as s from "react";
|
|
4
|
+
import E from "iconsax-reactjs/dist/esm/SearchNormal1.js";
|
|
5
|
+
import { cn as i } from "../../lib/utils.js";
|
|
6
|
+
import { FOCUS_RING_INSET as R, FOCUS_RING_WITHIN as T } from "../../lib/focus-ring.js";
|
|
7
|
+
const C = s.forwardRef(
|
|
7
8
|
({
|
|
8
|
-
className:
|
|
9
|
-
placeholder:
|
|
10
|
-
onSearch:
|
|
11
|
-
size:
|
|
12
|
-
searchHref:
|
|
13
|
-
|
|
9
|
+
className: v,
|
|
10
|
+
placeholder: y = "キーワードを入力してください",
|
|
11
|
+
onSearch: c,
|
|
12
|
+
size: a = "md",
|
|
13
|
+
searchHref: m,
|
|
14
|
+
action: l,
|
|
15
|
+
name: u,
|
|
16
|
+
...d
|
|
14
17
|
}, r) => {
|
|
15
|
-
const
|
|
18
|
+
const t = !!l, n = s.useRef(null), x = s.useCallback(
|
|
16
19
|
(e) => {
|
|
17
|
-
|
|
20
|
+
n.current = e, typeof r == "function" ? r(e) : r && (r.current = e);
|
|
18
21
|
},
|
|
19
22
|
[r]
|
|
20
|
-
),
|
|
21
|
-
const e =
|
|
22
|
-
e.trim() && (
|
|
23
|
+
), h = () => {
|
|
24
|
+
const e = n.current?.value ?? "";
|
|
25
|
+
e.trim() && (c?.(e), m && (window.location.href = m.replace(
|
|
23
26
|
"{query}",
|
|
24
27
|
encodeURIComponent(e)
|
|
25
28
|
)));
|
|
26
|
-
},
|
|
27
|
-
e.key === "Enter" &&
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
}, g = (e) => {
|
|
30
|
+
e.key === "Enter" && !t && h(), d.onKeyDown?.(e);
|
|
31
|
+
}, w = (e) => {
|
|
32
|
+
const b = n.current?.value ?? "";
|
|
33
|
+
if (!b.trim()) {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
c?.(b);
|
|
38
|
+
}, f = i(
|
|
39
|
+
"group flex items-center overflow-hidden rounded-lg border border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Secondary)] transition-colors",
|
|
40
|
+
// Tailwind の variant 順では focus-within が hover より先に出力される
|
|
41
|
+
// = hover が後勝ちしてフォーカス枠を潰すため、hover 側を明示的に抑制する。
|
|
42
|
+
"hover:not-focus-within:border-[var(--Border-High-Emphasis)]",
|
|
43
|
+
T,
|
|
44
|
+
a === "sm" ? "h-9" : "h-11",
|
|
45
|
+
v
|
|
46
|
+
), p = /* @__PURE__ */ N(S, { children: [
|
|
47
|
+
/* @__PURE__ */ o(
|
|
48
|
+
"input",
|
|
49
|
+
{
|
|
50
|
+
ref: x,
|
|
51
|
+
type: "search",
|
|
52
|
+
"aria-label": "キーワード検索",
|
|
53
|
+
name: t ? u ?? "q" : u,
|
|
54
|
+
placeholder: y,
|
|
55
|
+
className: i(
|
|
56
|
+
"min-w-0 flex-1 bg-transparent px-3 text-[var(--Text-High-Emphasis)] outline-none placeholder:text-[var(--Text-Low-Emphasis)]",
|
|
57
|
+
a === "sm" ? "typo-body-sm" : "typo-body-md"
|
|
58
|
+
),
|
|
59
|
+
onKeyDown: g,
|
|
60
|
+
...d
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ o(
|
|
64
|
+
"button",
|
|
65
|
+
{
|
|
66
|
+
type: t ? "submit" : "button",
|
|
67
|
+
className: i(
|
|
68
|
+
"flex shrink-0 items-center justify-center border-l border-[var(--Border-Medium-Emphasis)] text-[var(--Text-Low-Emphasis)] transition-colors outline-none hover:bg-[var(--Surface-Tertiary)] hover:text-[var(--Text-High-Emphasis)]",
|
|
69
|
+
// 親が overflow-hidden なので外向きリングは切れる。内側に描く。
|
|
70
|
+
R,
|
|
71
|
+
a === "sm" ? "size-9" : "h-11 w-11"
|
|
72
|
+
),
|
|
73
|
+
onClick: t ? void 0 : h,
|
|
74
|
+
"aria-label": "検索",
|
|
75
|
+
children: /* @__PURE__ */ o(E, { size: a === "sm" ? 14 : 16 })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
79
|
+
return t ? /* @__PURE__ */ o(
|
|
80
|
+
"form",
|
|
31
81
|
{
|
|
32
82
|
"data-slot": "search-bar",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
]
|
|
83
|
+
action: l,
|
|
84
|
+
method: "get",
|
|
85
|
+
role: "search",
|
|
86
|
+
onSubmit: w,
|
|
87
|
+
className: f,
|
|
88
|
+
children: p
|
|
74
89
|
}
|
|
75
|
-
);
|
|
90
|
+
) : /* @__PURE__ */ o("div", { "data-slot": "search-bar", className: f, children: p });
|
|
76
91
|
}
|
|
77
92
|
);
|
|
78
|
-
|
|
93
|
+
C.displayName = "SearchBar";
|
|
79
94
|
export {
|
|
80
|
-
|
|
95
|
+
C as SearchBar
|
|
81
96
|
};
|