@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,30 +1,40 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import * as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
return
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
const l = a.createContext(null);
|
|
4
|
+
function o() {
|
|
5
|
+
return a.useContext(l);
|
|
6
6
|
}
|
|
7
|
-
function d(r
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
function d(...r) {
|
|
8
|
+
const e = r.flatMap((i) => i ? i.split(/\s+/) : []).filter(Boolean);
|
|
9
|
+
return e.length > 0 ? Array.from(new Set(e)).join(" ") : void 0;
|
|
10
|
+
}
|
|
11
|
+
function n(r, e) {
|
|
12
|
+
const i = r ?? (e?.errorId ? !0 : void 0);
|
|
13
|
+
return i === void 0 ? {} : { "aria-invalid": i };
|
|
14
|
+
}
|
|
15
|
+
function t(r, e) {
|
|
16
|
+
return d(e.descriptionId, e.errorId, r);
|
|
17
|
+
}
|
|
18
|
+
function c(r, e, i = !1) {
|
|
19
|
+
return e ? {
|
|
11
20
|
id: r.id ?? e.controlId,
|
|
12
21
|
// aria-label が明示されていれば labelledby は当てない(二重命名を避ける)
|
|
13
|
-
"aria-labelledby": r["aria-labelledby"] ?? (r["aria-label"] ? void 0 : e.labelId),
|
|
14
|
-
"aria-describedby": r["aria-describedby"]
|
|
15
|
-
|
|
22
|
+
"aria-labelledby": r["aria-labelledby"] ?? (r["aria-label"] || i ? void 0 : e.labelId),
|
|
23
|
+
"aria-describedby": t(r["aria-describedby"], e),
|
|
24
|
+
...n(r["aria-invalid"], e)
|
|
25
|
+
} : {};
|
|
16
26
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
const i = [e.descriptionId, e.errorId].filter(Boolean).join(" ");
|
|
20
|
-
return {
|
|
27
|
+
function u(r, e) {
|
|
28
|
+
return e ? {
|
|
21
29
|
id: r.id ?? e.controlId,
|
|
22
|
-
"aria-describedby": r["aria-describedby"]
|
|
23
|
-
|
|
30
|
+
"aria-describedby": t(r["aria-describedby"], e),
|
|
31
|
+
...n(r["aria-invalid"], e)
|
|
32
|
+
} : {};
|
|
24
33
|
}
|
|
25
34
|
export {
|
|
26
|
-
|
|
27
|
-
d as
|
|
28
|
-
|
|
29
|
-
|
|
35
|
+
l as FieldLabellingContext,
|
|
36
|
+
d as mergeIdRefs,
|
|
37
|
+
c as resolveFieldAria,
|
|
38
|
+
u as resolveNativeFieldAria,
|
|
39
|
+
o as useFieldLabelling
|
|
30
40
|
};
|
package/dist/lib/focus-ring.js
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = "forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:outline-offset-2 forced-colors:focus-visible:outline-[Highlight]", i = "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]", s = "forced-colors:focus-visible:outline-solid forced-colors:focus-visible:outline-2 forced-colors:focus-visible:-outline-offset-2 forced-colors:focus-visible:outline-[Highlight]", c = "forced-colors:focus:bg-[Highlight]! forced-colors:focus:text-[HighlightText]! forced-colors:focus:[&_*]:text-[HighlightText]!", r = "forced-colors:data-[selected=true]:bg-[Highlight]! forced-colors:data-[selected=true]:text-[HighlightText]! forced-colors:data-[selected=true]:[&_*]:text-[HighlightText]!", e = [
|
|
2
|
+
"focus-visible:border-[var(--Focus-High-Emphasis)] focus-visible:ring-[3px] focus-visible:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
|
|
3
|
+
o
|
|
4
|
+
].join(" "), l = [
|
|
5
|
+
"focus-within:border-[var(--Focus-High-Emphasis)] focus-within:ring-[3px] focus-within:ring-[var(--Focus-High-Emphasis)]/50",
|
|
6
|
+
i
|
|
7
|
+
].join(" "), t = [
|
|
8
|
+
"focus-visible:ring-[3px] focus-visible:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
|
|
9
|
+
o
|
|
10
|
+
].join(" "), n = [
|
|
11
|
+
"focus-visible:ring-[3px] focus-visible:ring-inset focus-visible:ring-[color:var(--Focus-Ring-Control,color-mix(in_oklab,var(--Focus-High-Emphasis)_50%,transparent))]",
|
|
12
|
+
s
|
|
13
|
+
].join(" ");
|
|
2
14
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
15
|
+
e as FOCUS_RING,
|
|
16
|
+
n as FOCUS_RING_INSET,
|
|
17
|
+
t as FOCUS_RING_ONLY,
|
|
18
|
+
l as FOCUS_RING_WITHIN,
|
|
19
|
+
r as FORCED_COLORS_COMMAND_ITEM,
|
|
20
|
+
o as FORCED_COLORS_FOCUS,
|
|
21
|
+
s as FORCED_COLORS_FOCUS_INSET,
|
|
22
|
+
i as FORCED_COLORS_FOCUS_WITHIN,
|
|
23
|
+
c as FORCED_COLORS_MENU_ITEM
|
|
6
24
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
const t = "(prefers-reduced-motion: reduce)";
|
|
4
|
+
function o(e) {
|
|
5
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return () => {
|
|
6
|
+
};
|
|
7
|
+
const n = window.matchMedia(t);
|
|
8
|
+
return n.addEventListener("change", e), () => n.removeEventListener("change", e);
|
|
9
|
+
}
|
|
10
|
+
function i() {
|
|
11
|
+
return typeof window.matchMedia == "function" && window.matchMedia(t).matches;
|
|
12
|
+
}
|
|
13
|
+
function c() {
|
|
14
|
+
return !1;
|
|
15
|
+
}
|
|
16
|
+
function u() {
|
|
17
|
+
return r.useSyncExternalStore(o, i, c);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
u as usePrefersReducedMotion
|
|
21
|
+
};
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* - CSS: admin_shops/layout/nav_layout.css
|
|
28
28
|
*/
|
|
29
29
|
import * as React from "react";
|
|
30
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
30
31
|
import { type AdminNavItem } from "../../components/primitives/admin-side-nav";
|
|
31
32
|
export declare function MissingComponent({ name, children, className, }: {
|
|
32
33
|
name: string;
|
|
@@ -79,5 +80,14 @@ export interface AdminShellProps {
|
|
|
79
80
|
* `sr-only` なので視覚には影響しない。`false` で無効化。
|
|
80
81
|
*/
|
|
81
82
|
skipLink?: false;
|
|
83
|
+
/**
|
|
84
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
85
|
+
* サイドナビ(`AdminSideNav`)の項目・サブメニューと、パンくずのリンクに効く。
|
|
86
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
87
|
+
* この部品は Client Component のため、Server Component から渡すと
|
|
88
|
+
* `Functions cannot be passed directly to Client Components` で落ちる。
|
|
89
|
+
* Next.js App Router では呼び出し側のファイルを `"use client"` にする。
|
|
90
|
+
*/
|
|
91
|
+
linkComponent?: LinkComponent;
|
|
82
92
|
}
|
|
83
|
-
export declare function AdminShell({ children, activeNav, title, breadcrumbs, shopName, brand, sidebarHeader, navItems, headerActions, onBack, backLabel, mainId, skipLink, }: AdminShellProps): import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
export declare function AdminShell({ children, activeNav, title, breadcrumbs, shopName, brand, sidebarHeader, navItems, headerActions, onBack, backLabel, mainId, skipLink, linkComponent, }: AdminShellProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
export interface AnniversaryCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
/** 対象者の名前(例: "山田 花子") */
|
|
4
5
|
name: string;
|
|
@@ -16,6 +17,12 @@ export interface AnniversaryCardProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
16
17
|
editHref?: string;
|
|
17
18
|
/** 編集ボタンのクリックハンドラ(editHref が無い場合に使用) */
|
|
18
19
|
onEdit?: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* 編集リンク(`editHref`)の描画に使うコンポーネント(既定 `a`)。
|
|
22
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
23
|
+
* この部品は Server Component のまま使える。
|
|
24
|
+
*/
|
|
25
|
+
linkComponent?: LinkComponent;
|
|
19
26
|
}
|
|
20
27
|
/**
|
|
21
28
|
* 記念日カード / AnniversaryCard
|
|
@@ -39,6 +46,7 @@ export interface AnniversaryCardProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
39
46
|
* | memo | string | — | メモ(任意) |
|
|
40
47
|
* | editHref | string | — | 編集リンクの href |
|
|
41
48
|
* | onEdit | () => void | — | 編集ボタンのクリックハンドラ |
|
|
49
|
+
* | linkComponent | LinkComponent | "a" | 編集リンクの描画に使うコンポーネント(next/link 等) |
|
|
42
50
|
*
|
|
43
51
|
* ### AI 向け使用ルール
|
|
44
52
|
* - マイページの記念日一覧タブ内で使用する
|
|
@@ -46,5 +54,5 @@ export interface AnniversaryCardProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
46
54
|
* - `editHref` を渡すと編集ボタンが `<a>` リンクになる
|
|
47
55
|
* - `onEdit` を渡すと編集ボタンが `<button>` になる
|
|
48
56
|
*/
|
|
49
|
-
declare function AnniversaryCard({ name, relation, type, date, daysLeft, memo, editHref, onEdit, className, ...props }: AnniversaryCardProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
declare function AnniversaryCard({ name, relation, type, date, daysLeft, memo, editHref, onEdit, linkComponent, className, ...props }: AnniversaryCardProps): import("react/jsx-runtime").JSX.Element;
|
|
50
58
|
export { AnniversaryCard };
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
* 「マイページ配下だけ Cake.jp ロゴに割れる」問題を避けられる。
|
|
28
28
|
*/
|
|
29
29
|
import React from "react";
|
|
30
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
30
31
|
import { type HeaderAction, type HeaderNavItem } from "../../components/primitives/header";
|
|
31
32
|
import { type SideNavGroup, type SideNavItem } from "../../components/primitives/side-nav";
|
|
32
33
|
import { type BottomTabBarItem } from "../../components/primitives/bottom-tab-bar";
|
|
@@ -90,6 +91,16 @@ export interface MypageShellProps {
|
|
|
90
91
|
* `sr-only` なので視覚には影響しない。`false` で無効化。
|
|
91
92
|
*/
|
|
92
93
|
skipLink?: false;
|
|
94
|
+
/**
|
|
95
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
96
|
+
* PC ヘッダー(`navItems` / `headerActions` の `href`)・サイドメニュー(`SideNav`)・
|
|
97
|
+
* パンくず・SP の `BottomTabBar` の `href` に効く。`next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
98
|
+
* 内部で Client Component の `Header` へ渡すため、Server Component から渡すと
|
|
99
|
+
* `Functions cannot be passed directly to Client Components` で落ちる。また内部の `SideNav` が
|
|
100
|
+
* 全項目にイベントハンドラを付けるため、`linkComponent` の有無によらず Server Component からは描けない。
|
|
101
|
+
* Next.js App Router では呼び出し側のファイルを `"use client"` にする。
|
|
102
|
+
*/
|
|
103
|
+
linkComponent?: LinkComponent;
|
|
93
104
|
}
|
|
94
|
-
declare function MypageShell({ title, activeMenu, currentPath, activeMatch, isActiveMenuItem, children, breadcrumbs, bottomNavItems, menuGroups, headerActions, logo, navItems, onBack, mainId, skipLink, }: MypageShellProps): import("react/jsx-runtime").JSX.Element;
|
|
105
|
+
declare function MypageShell({ title, activeMenu, currentPath, activeMatch, isActiveMenuItem, children, breadcrumbs, bottomNavItems, menuGroups, headerActions, logo, navItems, onBack, mainId, skipLink, linkComponent, }: MypageShellProps): import("react/jsx-runtime").JSX.Element;
|
|
95
106
|
export { MypageShell };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
import { type TagProps } from "../../components/primitives/tag";
|
|
3
4
|
export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
5
|
/** 商品名 */
|
|
@@ -59,6 +60,17 @@ export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
59
60
|
onCartAdd?: () => void;
|
|
60
61
|
/** カートボタンのラベル */
|
|
61
62
|
cartButtonLabel?: string;
|
|
63
|
+
/**
|
|
64
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
65
|
+
* 商品リンク(`href`)とショップ名リンク(`shopHref`)の両方に効く。
|
|
66
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
67
|
+
* `shopHref`(ショップ名リンクの `stopPropagation`)または `showCartButton`(カートボタンの `onClick`)を
|
|
68
|
+
* 指定するときは、内部でイベントハンドラを付けるため React Server Components では Server Component から
|
|
69
|
+
* 描けない(`Event handlers cannot be passed to Client Component props` で落ちる)。
|
|
70
|
+
* その場合、Next.js App Router では呼び出し側のファイルを `"use client"` にする。どちらも使わなければ
|
|
71
|
+
* Server Component のまま使える。
|
|
72
|
+
*/
|
|
73
|
+
linkComponent?: LinkComponent;
|
|
62
74
|
}
|
|
63
75
|
/**
|
|
64
76
|
* ブックマーク(しおり/リボン)アイコン — 本番 .m-bookmark-button 準拠
|
|
@@ -68,5 +80,5 @@ export declare function BookmarkRibbonIcon({ size, filled }: {
|
|
|
68
80
|
size?: number;
|
|
69
81
|
filled?: boolean;
|
|
70
82
|
}): import("react/jsx-runtime").JSX.Element;
|
|
71
|
-
declare function ProductCard({ className, name, imageUrl, imageAlt, price, originalPrice, caption, rating, reviewCount, shopName, shopHref, hoverEffect, tags, isFavorite, onFavoriteToggle, onCardClick, href, ranking, deliveryDate, orientation, showDiscountBadge, showCartButton, onCartAdd, cartButtonLabel, ...props }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
declare function ProductCard({ className, name, imageUrl, imageAlt, price, originalPrice, caption, rating, reviewCount, shopName, shopHref, hoverEffect, tags, isFavorite, onFavoriteToggle, onCardClick, href, ranking, deliveryDate, orientation, showDiscountBadge, showCartButton, onCartAdd, cartButtonLabel, linkComponent, ...props }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
|
|
72
84
|
export { ProductCard };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
1
2
|
import { type SectionHeaderSize } from "../../components/primitives/section-header";
|
|
2
3
|
import { type ProductCardProps } from "../../components/ec/product-card";
|
|
3
4
|
export interface ProductCarouselProps {
|
|
@@ -31,6 +32,17 @@ export interface ProductCarouselProps {
|
|
|
31
32
|
showCartButton?: boolean;
|
|
32
33
|
/** 追加クラス */
|
|
33
34
|
className?: string;
|
|
35
|
+
/**
|
|
36
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
37
|
+
* セクション画像リンク・「もっと見る」・各商品カード(商品とショップ名)のリンクに効く。
|
|
38
|
+
* 商品ごとに `products[].linkComponent` を渡した場合はそちらを優先する。
|
|
39
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
40
|
+
* `showCartButton` を指定するか、商品に `shopHref` を指定するときは、内部の `ProductCard` がイベントハンドラを
|
|
41
|
+
* 付けるため React Server Components では Server Component から描けない
|
|
42
|
+
* (`Event handlers cannot be passed to Client Component props` で落ちる)。その場合、Next.js App Router では
|
|
43
|
+
* 呼び出し側のファイルを `"use client"` にする。どちらも使わなければ Server Component のまま使える。
|
|
44
|
+
*/
|
|
45
|
+
linkComponent?: LinkComponent;
|
|
34
46
|
}
|
|
35
47
|
/**
|
|
36
48
|
* 商品カルーセルコンポーネント — Atomic Design Level 3 Organism
|
|
@@ -52,5 +64,5 @@ export interface ProductCarouselProps {
|
|
|
52
64
|
* - `description` でセクション説明文を追加(コラボ紹介、特集説明等)
|
|
53
65
|
* - 横パディング(px-4)はヘッダー行(SectionHeader もしくは画像ラッパー)とスクロールコンテナが各自で持つ
|
|
54
66
|
*/
|
|
55
|
-
declare function ProductCarousel({ title, subtitle, description, sectionImage, sectionImageAlt, sectionImageHref, moreHref, moreLabel, onMoreClick, headerSize, products, cardSize, showRanking, showCartButton, className, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
+
declare function ProductCarousel({ title, subtitle, description, sectionImage, sectionImageAlt, sectionImageHref, moreHref, moreLabel, onMoreClick, headerSize, products, cardSize, showRanking, showCartButton, className, linkComponent, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
56
68
|
export { ProductCarousel };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
export interface ProductDetailBarTab {
|
|
3
4
|
/** タブラベル(例: "写真") */
|
|
4
5
|
label: string;
|
|
@@ -28,6 +29,16 @@ export interface ProductDetailBarProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
28
29
|
ctaDisabled?: boolean;
|
|
29
30
|
/** タブクリック */
|
|
30
31
|
onTabClick?: (tab: ProductDetailBarTab) => void;
|
|
32
|
+
/**
|
|
33
|
+
* タブのリンクの描画に使うコンポーネント(既定 `a`)。
|
|
34
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
35
|
+
* タブの `href` は通常ページ内アンカー(`#detail-slider` 等)で、その用途では指定不要。
|
|
36
|
+
* 別ページへ遷移するタブ(レビュー一覧ページ等)があるときに使う。
|
|
37
|
+
* 全タブの `<a>` に `onClick`(`onTabClick` 用)を付けるため、React Server Components では
|
|
38
|
+
* Server Component から描けない(`Event handlers cannot be passed to Client Component props` で落ちる)。
|
|
39
|
+
* Next.js App Router では呼び出し側のファイルを `"use client"` にする(`linkComponent` の有無によらない)。
|
|
40
|
+
*/
|
|
41
|
+
linkComponent?: LinkComponent;
|
|
31
42
|
}
|
|
32
43
|
/**
|
|
33
44
|
* 商品詳細スティッキーバー
|
|
@@ -58,5 +69,5 @@ export interface ProductDetailBarProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
58
69
|
* />
|
|
59
70
|
* ```
|
|
60
71
|
*/
|
|
61
|
-
declare function ProductDetailBar({ className, tabs, productName, price, isSale, rating, reviewCount, ctaLabel, onCtaClick, ctaDisabled, onTabClick, ...props }: ProductDetailBarProps): import("react/jsx-runtime").JSX.Element;
|
|
72
|
+
declare function ProductDetailBar({ className, tabs, productName, price, isSale, rating, reviewCount, ctaLabel, onCtaClick, ctaDisabled, onTabClick, linkComponent, ...props }: ProductDetailBarProps): import("react/jsx-runtime").JSX.Element;
|
|
62
73
|
export { ProductDetailBar };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
/** サイズピッカーの選択肢 */
|
|
3
4
|
export interface SizeOption {
|
|
4
5
|
/** 表示ラベル(例: "3号") */
|
|
@@ -95,6 +96,15 @@ export interface ProductDetailSidebarProps extends React.HTMLAttributes<HTMLDivE
|
|
|
95
96
|
isBookmarked?: boolean;
|
|
96
97
|
/** プロモバナー */
|
|
97
98
|
promoBanner?: PromoBanner;
|
|
99
|
+
/**
|
|
100
|
+
* ショップ名(`shopHref`)とブランド(`brandHref`)のリンクの描画に使うコンポーネント(既定 `a`)。
|
|
101
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
102
|
+
* `sizeOptions` を指定するときは、サイズの選択肢(Chip)に `onClick` を付けるため React Server Components
|
|
103
|
+
* では Server Component から描けない(`Event handlers cannot be passed to Client Component props` で落ちる)。
|
|
104
|
+
* その場合、Next.js App Router では呼び出し側のファイルを `"use client"` にする。`sizeOptions` を使わなければ
|
|
105
|
+
* Server Component のまま使える。
|
|
106
|
+
*/
|
|
107
|
+
linkComponent?: LinkComponent;
|
|
98
108
|
}
|
|
99
109
|
/**
|
|
100
110
|
* 商品詳細サイドバー(CV セット)
|
|
@@ -111,5 +121,5 @@ export interface ProductDetailSidebarProps extends React.HTMLAttributes<HTMLDivE
|
|
|
111
121
|
* - サイズ選択肢は行単位の2次元配列で渡す
|
|
112
122
|
* - `onAddToCart` が未指定の場合、ボタンは disabled
|
|
113
123
|
*/
|
|
114
|
-
declare function ProductDetailSidebar({ className, productName, price, tags, shopName, shopHref, brandLabel, brandHref, rating, reviewCount, coupons, sizeOptions, selectedSize, onSizeChange, sizeInfoLabel, onSizeInfoClick, deliveryPrefecture, onPrefectureChange, earliestDelivery, quantity, onQuantityChange, pointInfo, onAddToCart, addToCartLabel, onBookmark, isBookmarked, promoBanner, ...props }: ProductDetailSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
124
|
+
declare function ProductDetailSidebar({ className, productName, price, tags, shopName, shopHref, brandLabel, brandHref, rating, reviewCount, coupons, sizeOptions, selectedSize, onSizeChange, sizeInfoLabel, onSizeInfoClick, deliveryPrefecture, onPrefectureChange, earliestDelivery, quantity, onQuantityChange, pointInfo, onAddToCart, addToCartLabel, onBookmark, isBookmarked, promoBanner, linkComponent, ...props }: ProductDetailSidebarProps): import("react/jsx-runtime").JSX.Element;
|
|
115
125
|
export { ProductDetailSidebar };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
export interface ProductListItemTag {
|
|
3
4
|
label: string;
|
|
4
5
|
variant?: "default" | "accent" | "info" | "timesale" | "sale";
|
|
@@ -76,6 +77,13 @@ export interface ProductListItemProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
76
77
|
rightSlot?: React.ReactNode;
|
|
77
78
|
/** 下部スロット(アクションボタンの代わりに任意コンテンツ) */
|
|
78
79
|
bottomSlot?: React.ReactNode;
|
|
80
|
+
/**
|
|
81
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
82
|
+
* 商品画像・商品名(`href`)とショップ名(`shopHref`)のリンクに効く。
|
|
83
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
84
|
+
* この部品は Server Component のまま使える。
|
|
85
|
+
*/
|
|
86
|
+
linkComponent?: LinkComponent;
|
|
79
87
|
}
|
|
80
88
|
/**
|
|
81
89
|
* カードリストアイテム — Figma Card/List 準拠
|
|
@@ -93,5 +101,5 @@ export interface ProductListItemProps extends React.HTMLAttributes<HTMLDivElemen
|
|
|
93
101
|
* - 小さい: `<ListItem variant="small" />`
|
|
94
102
|
* - 極小: `<ListItem variant="xsm" />`
|
|
95
103
|
*/
|
|
96
|
-
declare function ProductListItem({ name, imageUrl, price, caption, shopName, shopHref, brandName, tags, hashTags, statusLabel, variant, showCartButton, onAddToCart, showDetailButton, onViewDetail, showBookmark, href, orderDate, deliveryInfo, totalPrice, showReviewButton, optionInfo, quantity, onQuantityChange, quantitySize, originalPrice, priceLabel, deliveryText, onDelete, onSaveForLater, imageSize, subtotal, subtotalLabel, leftSlot, rightSlot, bottomSlot, className, ...props }: ProductListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
104
|
+
declare function ProductListItem({ name, imageUrl, price, caption, shopName, shopHref, brandName, tags, hashTags, statusLabel, variant, showCartButton, onAddToCart, showDetailButton, onViewDetail, showBookmark, href, orderDate, deliveryInfo, totalPrice, showReviewButton, optionInfo, quantity, onQuantityChange, quantitySize, originalPrice, priceLabel, deliveryText, onDelete, onSaveForLater, imageSize, subtotal, subtotalLabel, leftSlot, rightSlot, bottomSlot, linkComponent, className, ...props }: ProductListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
97
105
|
export { ProductListItem };
|
|
@@ -25,6 +25,8 @@ declare function SparkleIcon({ size, className, }: {
|
|
|
25
25
|
*
|
|
26
26
|
* Cake.jp 標準パターン: ✦ 4.67 (345)
|
|
27
27
|
* 1つのスパークルアイコン + 数値 + レビュー件数。
|
|
28
|
+
* 表示用の評価なのでブランド色は使わず、黒系(Text-High-Emphasis)で描く
|
|
29
|
+
* (入力用の星 = ReviewForm の選択済みはブランド色のまま)。
|
|
28
30
|
*/
|
|
29
31
|
declare function RatingStars({ className, rating, reviewCount, size, showCount, showValue, ...props }: RatingStarsProps): import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
export { RatingStars, SparkleIcon };
|
|
@@ -43,7 +43,7 @@ export interface ReviewCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
43
43
|
* - `variant="card"` は商品ヘッダー付きカード
|
|
44
44
|
* - `variant="pc"` はPC向け幅広レイアウト
|
|
45
45
|
* - 既存の `RatingStars` の `SparkleIcon` を星表示に使用
|
|
46
|
-
* -
|
|
46
|
+
* - 「もっと見る」はグレー(Text-Medium-Emphasis)+ 下線(ブランド色は使わない)
|
|
47
47
|
*/
|
|
48
48
|
declare function ReviewCard({ className, variant, bordered, rating, date, text, imageUrl, productName, productImageUrl, helpfulCount, isLiked, onLikeClick, onMoreClick, maxLength, ...props }: ReviewCardProps): import("react/jsx-runtime").JSX.Element;
|
|
49
49
|
export { ReviewCard };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
export interface ShopCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
/** 店舗名 */
|
|
4
5
|
name: string;
|
|
@@ -24,6 +25,12 @@ export interface ShopCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
24
25
|
href?: string;
|
|
25
26
|
/** バリエーション */
|
|
26
27
|
variant?: "default" | "compact";
|
|
28
|
+
/**
|
|
29
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。`href` 指定時だけ使われる。
|
|
30
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
31
|
+
* この部品は Server Component のまま使える。
|
|
32
|
+
*/
|
|
33
|
+
linkComponent?: LinkComponent;
|
|
27
34
|
}
|
|
28
35
|
/**
|
|
29
36
|
* 店舗カード
|
|
@@ -44,5 +51,5 @@ export interface ShopCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
44
51
|
* - 画像は productImageUrl(商品)と shopImageUrl(店舗)の2枚を指定
|
|
45
52
|
* - ブックマークは onBookmarkToggle を渡すと表示される
|
|
46
53
|
*/
|
|
47
|
-
declare function ShopCard({ name, ruby, productImageUrl, shopImageUrl, rating, reviewCount, area, deliveryDate, isBookmarked, onBookmarkToggle, href, variant, className, ...props }: ShopCardProps): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
declare function ShopCard({ name, ruby, productImageUrl, shopImageUrl, rating, reviewCount, area, deliveryDate, isBookmarked, onBookmarkToggle, href, variant, linkComponent, className, ...props }: ShopCardProps): import("react/jsx-runtime").JSX.Element;
|
|
48
55
|
export { ShopCard };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const badgeVariants: (props?: {
|
|
4
|
-
variant?: "link" | "default" | "success" | "secondary" | "destructive" | "ghost" | "info-subtle" | "success-subtle" | "accent-subtle" | "caution-subtle" | "warning-subtle" | "muted-subtle"
|
|
4
|
+
variant?: "link" | "default" | "success" | "secondary" | "destructive" | "ghost" | "outline" | "info-subtle" | "success-subtle" | "accent-subtle" | "caution-subtle" | "warning-subtle" | "muted-subtle";
|
|
5
5
|
} & import("class-variance-authority/types").ClassProp) => string;
|
|
6
6
|
declare function Badge({ className, variant, asChild, ...props }: React.ComponentProps<"span"> & VariantProps<typeof badgeVariants> & {
|
|
7
7
|
asChild?: boolean;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
2
3
|
declare function Breadcrumb({ ...props }: React.ComponentProps<"nav">): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
declare function BreadcrumbList({ className, ...props }: React.ComponentProps<"ol">): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
declare function BreadcrumbItem({ className, ...props }: React.ComponentProps<"li">): import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
declare function BreadcrumbLink({ asChild, className, ...props }: React.ComponentProps<"a"> & {
|
|
6
|
+
declare function BreadcrumbLink({ asChild, linkComponent, className, ...props }: React.ComponentProps<"a"> & {
|
|
6
7
|
asChild?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。
|
|
10
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
11
|
+
* `asChild` と併用した場合は `asChild` が優先され、子要素がそのまま描かれる。
|
|
12
|
+
*/
|
|
13
|
+
linkComponent?: LinkComponent;
|
|
7
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
15
|
declare function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
9
16
|
declare function BreadcrumbSeparator({ children, className, ...props }: React.ComponentProps<"li">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const buttonVariants: (props?: {
|
|
4
|
-
variant?: "link" | "default" | "secondary" | "tertiary" | "destructive" | "ghost" | "inverse" | "ghost-inverse" | "overlay";
|
|
4
|
+
variant?: "link" | "default" | "secondary" | "tertiary" | "destructive" | "ghost" | "outline" | "inverse" | "ghost-inverse" | "overlay";
|
|
5
5
|
size?: "default" | "icon" | "xs" | "sm" | "lg" | "xl" | "hero" | "icon-xs" | "icon-sm" | "icon-lg" | "icon-xl";
|
|
6
6
|
} & import("class-variance-authority/types").ClassProp) => string;
|
|
7
|
-
|
|
7
|
+
type ButtonProps = React.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
8
8
|
asChild?: boolean;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 処理中の表示(opt-in・既定 false)。未指定 / false のときの出力は従来と同一。
|
|
11
|
+
*
|
|
12
|
+
* true のとき:
|
|
13
|
+
* - ラベルを透明にしてスピナーを中央に重ねる。ラベルは DOM に残るので幅は変わらない。
|
|
14
|
+
* - `aria-busy="true"` と `aria-disabled="true"` を付け、click 系(クリック・Enter / Space・
|
|
15
|
+
* フォームの送信と暗黙送信)を止める。onClick / onClickCapture も、親やボタン内の要素の
|
|
16
|
+
* onClick も呼ばれない。
|
|
17
|
+
* - 止めるのは click 系だけ。onPointerDown / onMouseDown / onKeyDown は loading 中も
|
|
18
|
+
* 呼ばれるので、pointerdown で開く部品(`DropdownMenuTrigger asChild` 等)の起点に
|
|
19
|
+
* するときは、利用側で loading 中は開かないようにする。
|
|
20
|
+
* - native の `disabled` は付けない。付けるとフォーカス中のボタンからフォーカスが
|
|
21
|
+
* body へ落ち、キーボード / スクリーンリーダー利用者が処理後に操作位置を見失う。
|
|
22
|
+
* - 色は variant のまま(disabled のグレー塗りにしない)。forced-colors ではシステム色で
|
|
23
|
+
* 描く。スピナーは `prefers-reduced-motion` で回転を止める。
|
|
24
|
+
*
|
|
25
|
+
* クリック抑止に関数を使うため、Server Component から loading={true} を静的に
|
|
26
|
+
* 描くことはできない(処理中は client の状態なので Client Component から渡す)。
|
|
27
|
+
*
|
|
28
|
+
* `asChild` 併用時: Slot は子 1 つを差し替えるだけなのでスピナーも読み上げの文言も出さず
|
|
29
|
+
* (見た目は変わらない)、`aria-busy` と disabled 相当(aria-disabled・tabIndex=-1・
|
|
30
|
+
* クリック抑止)だけを子へ渡す。リンクの意味を保つため href は外さない。
|
|
31
|
+
*/
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* loading 中に読み上げる文言(画面には出さない。既定「処理中」)。
|
|
35
|
+
* 読み上げ名の後ろに足すので、名前は「保存 処理中」のようになる。`aria-label` 指定時は
|
|
36
|
+
* aria-label に連結し(文字列のときだけ)、`aria-labelledby` 指定時は参照に足す。
|
|
37
|
+
* 同じ `aria-labelledby` を複数のボタンで共有して loading にする場合は、各ボタンに `id` を
|
|
38
|
+
* 付ける(付けないと読み上げ文言の id が重複する。開発時は console.warn で知らせる)。
|
|
39
|
+
* `aria-busy` を読まない読み上げソフトがあるため、処理中であることは名前で伝える。
|
|
40
|
+
* null / 空文字で出さない。
|
|
41
|
+
*/
|
|
42
|
+
loadingLabel?: React.ReactNode;
|
|
43
|
+
};
|
|
44
|
+
declare function Button({ className, variant, size, asChild, loading, loadingLabel, ...props }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
10
45
|
export { Button, buttonVariants };
|
|
@@ -16,8 +16,14 @@ declare function CheckboxCardGroup({ className, ...props }: React.HTMLAttributes
|
|
|
16
16
|
* - 単一選択のカード型は RadioGroupItem を使用
|
|
17
17
|
* - `CheckboxCardGroup` でグループ化する
|
|
18
18
|
* - `badge` でタグバッジ(割引率等)を表示可能
|
|
19
|
+
*
|
|
20
|
+
* ### 読み上げ
|
|
21
|
+
* アクセシブルネームはラベル(+ バッジ)だけにし、説明(`description`)と、選択中だけ
|
|
22
|
+
* 見える展開内容(`expandedContent`)は `aria-describedby` に分ける。名前をボタンの内容に
|
|
23
|
+
* 任せると説明・展開内容まで名前に入り、選択の前後で名前が変わってしまうため。
|
|
24
|
+
* `aria-label` / `aria-labelledby` を明示した場合はそちらが名前になる。
|
|
19
25
|
*/
|
|
20
|
-
declare function CheckboxCardItem({ className, children, description, expandedContent, badge, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root> & {
|
|
26
|
+
declare function CheckboxCardItem({ className, children, description, expandedContent, badge, checked: checkedProp, defaultChecked, onCheckedChange, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, ...props }: React.ComponentProps<typeof CheckboxPrimitive.Root> & {
|
|
21
27
|
/** ラベルテキスト */
|
|
22
28
|
children?: React.ReactNode;
|
|
23
29
|
/** 補足説明テキスト */
|
|
@@ -39,5 +39,5 @@ export interface CheckboxProps extends CheckboxRootProps {
|
|
|
39
39
|
*
|
|
40
40
|
* カード型の選択肢には `CheckboxCard` (foundations) を使用。
|
|
41
41
|
*/
|
|
42
|
-
declare function Checkbox({ label, description, count, containerClassName, className, id, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
declare function Checkbox({ label, description, count, containerClassName, className, id, ref: consumerRef, ...props }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
43
43
|
export { Checkbox };
|
|
@@ -10,8 +10,8 @@ import { type VariantProps } from "class-variance-authority";
|
|
|
10
10
|
* Chip と RadioGroup の chip variant の両方へ自動追従する。
|
|
11
11
|
*/
|
|
12
12
|
export declare const chipVariants: (props?: {
|
|
13
|
-
variant?: "accent" | "filled";
|
|
13
|
+
variant?: "accent" | "selected" | "filled";
|
|
14
14
|
size?: "sm" | "lg" | "md" | "tile";
|
|
15
|
-
shape?: "
|
|
15
|
+
shape?: "pill" | "square";
|
|
16
16
|
} & import("class-variance-authority/types").ClassProp) => string;
|
|
17
17
|
export type ChipVariantProps = VariantProps<typeof chipVariants>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** useConfirm() の confirm に渡す内容。 */
|
|
3
|
+
interface ConfirmOptions {
|
|
4
|
+
/** 確認の見出し。ダイアログの読み上げ名を兼ねる(例: 「このメモを削除しますか?」) */
|
|
5
|
+
title: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* 判断材料(例: 「削除したメモは元に戻せません。」)。ダイアログの説明として読み上げられる。
|
|
8
|
+
* 省略すると Radix AlertDialog が開発時に console.warn を出すので、原則渡す。
|
|
9
|
+
*/
|
|
10
|
+
description?: React.ReactNode;
|
|
11
|
+
/** 確定ボタンの文言。既定「確認」。操作を表す動詞(「削除する」等)を渡すのを推奨 */
|
|
12
|
+
confirmLabel?: React.ReactNode;
|
|
13
|
+
/** キャンセルボタンの文言。既定「キャンセル」 */
|
|
14
|
+
cancelLabel?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* 確定ボタンの意匠。`destructive` は削除など取り消せない操作用(Button variant="destructive")。
|
|
17
|
+
* 既定 `default`(Button variant="default")。キャンセルは常に AlertDialogCancel 既定の tertiary。
|
|
18
|
+
*/
|
|
19
|
+
tone?: "default" | "destructive";
|
|
20
|
+
}
|
|
21
|
+
/** 確定で true、キャンセル / Esc で false に resolve する。 */
|
|
22
|
+
type ConfirmFn = (options: ConfirmOptions) => Promise<boolean>;
|
|
23
|
+
interface ConfirmDialogProviderProps {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* ConfirmDialogProvider — `useConfirm()` を使えるようにする Provider。アプリのルートに 1 つ置く。
|
|
28
|
+
*
|
|
29
|
+
* - `confirm(options)` が呼ばれると AlertDialog を開き、確定で true、キャンセル / Esc で
|
|
30
|
+
* false に resolve する(背景クリックでは閉じない)。
|
|
31
|
+
* - 同時に複数呼ばれたら待ち行列にして 1 件ずつ表示する。
|
|
32
|
+
* - Provider が unmount されたとき、未解決の confirm は false で resolve する
|
|
33
|
+
* (画面遷移で await が宙に浮いたままにならないようにする)。unmount 後の呼び出しも即 false。
|
|
34
|
+
* - 閉じた後は confirm() を呼んだ時点でフォーカスがあった要素へ戻す(Trigger を持たないため、
|
|
35
|
+
* Radix の既定のままだと body へ落ちる)。閉じるアニメーション中に次の confirm() が来ても、
|
|
36
|
+
* 最後に閉じたときは元の呼び出し元へ戻る。
|
|
37
|
+
*/
|
|
38
|
+
declare function ConfirmDialogProvider({ children }: ConfirmDialogProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
/**
|
|
40
|
+
* useConfirm — `window.confirm()` の置き換え。
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* const confirm = useConfirm()
|
|
44
|
+
* const ok = await confirm({
|
|
45
|
+
* title: "このメモを削除しますか?",
|
|
46
|
+
* description: "削除したメモは元に戻せません。",
|
|
47
|
+
* confirmLabel: "削除する",
|
|
48
|
+
* tone: "destructive",
|
|
49
|
+
* })
|
|
50
|
+
* if (ok) await remove()
|
|
51
|
+
* ```
|
|
52
|
+
*
|
|
53
|
+
* `<ConfirmDialogProvider>` の内側でだけ使える。外側で使うと例外を投げる
|
|
54
|
+
* (設定漏れを「常にキャンセル」として黙って通すと、削除等の操作が無言で何もしなくなり
|
|
55
|
+
* 気付けないため)。確定ボタンを押した時点で true に resolve してダイアログを閉じる。
|
|
56
|
+
* 処理完了までダイアログ内で待たせたい場合は AlertDialog を直接組み、確定ボタンに
|
|
57
|
+
* Button の `loading` を使う。
|
|
58
|
+
*/
|
|
59
|
+
declare function useConfirm(): ConfirmFn;
|
|
60
|
+
export { ConfirmDialogProvider, useConfirm };
|
|
61
|
+
export type { ConfirmDialogProviderProps, ConfirmFn, ConfirmOptions };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
import type { LinkComponent } from "../../lib/link-component";
|
|
3
4
|
declare function DataTable({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
declare function DataTableTable({ className, ...props }: React.ComponentProps<"table">): import("react/jsx-runtime").JSX.Element;
|
|
5
6
|
declare function DataTableHeader({ className, ...props }: React.ComponentProps<"thead">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -87,10 +88,16 @@ declare function DataTableDragHandleCell({ className, ...props }: Omit<React.Com
|
|
|
87
88
|
onMouseDown?: React.MouseEventHandler;
|
|
88
89
|
onTouchStart?: React.TouchEventHandler;
|
|
89
90
|
}): import("react/jsx-runtime").JSX.Element;
|
|
90
|
-
declare function DataTableLinkCell({ className, href, external, children, ...props }: Omit<React.ComponentProps<"td">, "width" | "align"> & {
|
|
91
|
+
declare function DataTableLinkCell({ className, href, external, linkComponent, children, ...props }: Omit<React.ComponentProps<"td">, "width" | "align"> & {
|
|
91
92
|
href?: string;
|
|
92
|
-
/**
|
|
93
|
+
/** 外部リンクアイコンを表示(`linkComponent` は通さず、常に素の `<a target="_blank">`) */
|
|
93
94
|
external?: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* リンクの描画に使うコンポーネント(既定 `a`)。`external` のリンクには使われない。
|
|
97
|
+
* `next/link` 等を渡すとクライアント遷移になる(#236)。
|
|
98
|
+
* この部品は Server Component のまま使える。
|
|
99
|
+
*/
|
|
100
|
+
linkComponent?: LinkComponent;
|
|
94
101
|
}): import("react/jsx-runtime").JSX.Element;
|
|
95
102
|
declare function DataTableInputCell({ className, value, onChange, placeholder, type, name, ...props }: Omit<React.ComponentProps<"td">, "children" | "onChange"> & {
|
|
96
103
|
value?: string;
|