@charcoal-ui/react 6.0.0 → 6.1.0-beta.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/dist/components/Pagination/index2.js +52 -60
- package/dist/components/Pagination/index2.js.map +1 -1
- package/dist/components/Snackbar/index.d.ts +52 -0
- package/dist/components/Snackbar/index.d.ts.map +1 -0
- package/dist/components/Snackbar/index2.cjs +268 -0
- package/dist/components/Snackbar/index2.cjs.map +1 -0
- package/dist/components/Snackbar/index2.js +263 -0
- package/dist/components/Snackbar/index2.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.css +1050 -939
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/layered.css +1050 -939
- package/dist/layered.css.map +1 -1
- package/package.json +5 -5
- package/src/components/LoadingSpinner/__snapshots__/index.css.snap +1 -1
- package/src/components/LoadingSpinner/index.css +1 -1
- package/src/components/Pagination/__snapshots__/index.css.snap +1 -1
- package/src/components/Pagination/index.css +1 -1
- package/src/components/Snackbar/__snapshots__/index.css.snap +110 -0
- package/src/components/Snackbar/index.css +110 -0
- package/src/components/Snackbar/index.story.tsx +184 -0
- package/src/components/Snackbar/index.test.tsx +294 -0
- package/src/components/Snackbar/index.tsx +455 -0
- package/src/index.ts +7 -0
|
@@ -10,11 +10,7 @@ import { c } from "react-compiler-runtime";
|
|
|
10
10
|
//#region src/components/Pagination/index.tsx
|
|
11
11
|
function NavButton(t0) {
|
|
12
12
|
"use memo";
|
|
13
|
-
const $ = c(
|
|
14
|
-
if ($[0] !== "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794") {
|
|
15
|
-
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
-
$[0] = "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794";
|
|
17
|
-
}
|
|
13
|
+
const $ = c(15);
|
|
18
14
|
const { direction, ariaLabel } = t0;
|
|
19
15
|
const { page, pageCount, size, isLinkMode, makeUrl, LinkComponent, makeClickHandler, linkProps } = usePaginationContext();
|
|
20
16
|
const isPrev = direction === "prev";
|
|
@@ -24,7 +20,7 @@ function NavButton(t0) {
|
|
|
24
20
|
const t1 = isPrev ? "24/Prev" : "24/Next";
|
|
25
21
|
const t2 = disabled || void 0;
|
|
26
22
|
let t3;
|
|
27
|
-
if ($[
|
|
23
|
+
if ($[0] !== LinkComponent || $[1] !== disabled || $[2] !== isLinkMode || $[3] !== linkProps || $[4] !== makeClickHandler || $[5] !== makeUrl || $[6] !== navButtonClassName || $[7] !== targetPage) {
|
|
28
24
|
t3 = isLinkMode && makeUrl ? {
|
|
29
25
|
component: LinkComponent,
|
|
30
26
|
href: makeUrl(targetPage),
|
|
@@ -36,18 +32,18 @@ function NavButton(t0) {
|
|
|
36
32
|
onClick: makeClickHandler(targetPage),
|
|
37
33
|
className: navButtonClassName
|
|
38
34
|
};
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
$[
|
|
45
|
-
$[
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
} else t3 = $[
|
|
35
|
+
$[0] = LinkComponent;
|
|
36
|
+
$[1] = disabled;
|
|
37
|
+
$[2] = isLinkMode;
|
|
38
|
+
$[3] = linkProps;
|
|
39
|
+
$[4] = makeClickHandler;
|
|
40
|
+
$[5] = makeUrl;
|
|
41
|
+
$[6] = navButtonClassName;
|
|
42
|
+
$[7] = targetPage;
|
|
43
|
+
$[8] = t3;
|
|
44
|
+
} else t3 = $[8];
|
|
49
45
|
let t4;
|
|
50
|
-
if ($[
|
|
46
|
+
if ($[9] !== ariaLabel || $[10] !== size || $[11] !== t1 || $[12] !== t2 || $[13] !== t3) {
|
|
51
47
|
t4 = /* @__PURE__ */ jsx(IconButton, {
|
|
52
48
|
icon: t1,
|
|
53
49
|
size,
|
|
@@ -55,28 +51,24 @@ function NavButton(t0) {
|
|
|
55
51
|
"aria-label": ariaLabel,
|
|
56
52
|
...t3
|
|
57
53
|
});
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
} else t4 = $[
|
|
54
|
+
$[9] = ariaLabel;
|
|
55
|
+
$[10] = size;
|
|
56
|
+
$[11] = t1;
|
|
57
|
+
$[12] = t2;
|
|
58
|
+
$[13] = t3;
|
|
59
|
+
$[14] = t4;
|
|
60
|
+
} else t4 = $[14];
|
|
65
61
|
return t4;
|
|
66
62
|
}
|
|
67
63
|
function PageItem(t0) {
|
|
68
64
|
"use memo";
|
|
69
|
-
const $ = c(
|
|
70
|
-
if ($[0] !== "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794") {
|
|
71
|
-
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
72
|
-
$[0] = "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794";
|
|
73
|
-
}
|
|
65
|
+
const $ = c(19);
|
|
74
66
|
const { value } = t0;
|
|
75
67
|
const { page, size, isLinkMode, makeUrl, LinkComponent, makeClickHandler, linkProps } = usePaginationContext();
|
|
76
68
|
const pageItemClassName = useClassNames("charcoal-pagination-button", linkProps?.className);
|
|
77
69
|
if (value === "...") {
|
|
78
70
|
let t1;
|
|
79
|
-
if ($[
|
|
71
|
+
if ($[0] !== size) {
|
|
80
72
|
t1 = /* @__PURE__ */ jsx(IconButton, {
|
|
81
73
|
icon: "24/Dot",
|
|
82
74
|
size,
|
|
@@ -84,69 +76,69 @@ function PageItem(t0) {
|
|
|
84
76
|
className: "charcoal-pagination-spacer",
|
|
85
77
|
"aria-hidden": true
|
|
86
78
|
});
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
89
|
-
} else t1 = $[
|
|
79
|
+
$[0] = size;
|
|
80
|
+
$[1] = t1;
|
|
81
|
+
} else t1 = $[1];
|
|
90
82
|
return t1;
|
|
91
83
|
}
|
|
92
84
|
if (value === page) {
|
|
93
85
|
let t1;
|
|
94
|
-
if ($[
|
|
86
|
+
if ($[2] !== value) {
|
|
95
87
|
t1 = /* @__PURE__ */ jsx("span", {
|
|
96
88
|
className: "charcoal-pagination-button",
|
|
97
89
|
"aria-current": "page",
|
|
98
90
|
children: value
|
|
99
91
|
});
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
} else t1 = $[
|
|
92
|
+
$[2] = value;
|
|
93
|
+
$[3] = t1;
|
|
94
|
+
} else t1 = $[3];
|
|
103
95
|
return t1;
|
|
104
96
|
}
|
|
105
97
|
if (typeof value !== "number") return null;
|
|
106
98
|
if (isLinkMode && makeUrl) {
|
|
107
99
|
let t1;
|
|
108
|
-
if ($[
|
|
100
|
+
if ($[4] !== makeUrl || $[5] !== value) {
|
|
109
101
|
t1 = makeUrl(value);
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
} else t1 = $[
|
|
102
|
+
$[4] = makeUrl;
|
|
103
|
+
$[5] = value;
|
|
104
|
+
$[6] = t1;
|
|
105
|
+
} else t1 = $[6];
|
|
114
106
|
let t2;
|
|
115
|
-
if ($[
|
|
107
|
+
if ($[7] !== LinkComponent || $[8] !== linkProps || $[9] !== pageItemClassName || $[10] !== t1 || $[11] !== value) {
|
|
116
108
|
t2 = /* @__PURE__ */ jsx(LinkComponent, {
|
|
117
109
|
href: t1,
|
|
118
110
|
...linkProps,
|
|
119
111
|
className: pageItemClassName,
|
|
120
112
|
children: value
|
|
121
113
|
});
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
} else t2 = $[
|
|
114
|
+
$[7] = LinkComponent;
|
|
115
|
+
$[8] = linkProps;
|
|
116
|
+
$[9] = pageItemClassName;
|
|
117
|
+
$[10] = t1;
|
|
118
|
+
$[11] = value;
|
|
119
|
+
$[12] = t2;
|
|
120
|
+
} else t2 = $[12];
|
|
129
121
|
return t2;
|
|
130
122
|
}
|
|
131
123
|
let t1;
|
|
132
|
-
if ($[
|
|
124
|
+
if ($[13] !== makeClickHandler || $[14] !== value) {
|
|
133
125
|
t1 = makeClickHandler(value);
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
} else t1 = $[
|
|
126
|
+
$[13] = makeClickHandler;
|
|
127
|
+
$[14] = value;
|
|
128
|
+
$[15] = t1;
|
|
129
|
+
} else t1 = $[15];
|
|
138
130
|
let t2;
|
|
139
|
-
if ($[
|
|
131
|
+
if ($[16] !== t1 || $[17] !== value) {
|
|
140
132
|
t2 = /* @__PURE__ */ jsx("button", {
|
|
141
133
|
type: "button",
|
|
142
134
|
className: "charcoal-pagination-button",
|
|
143
135
|
onClick: t1,
|
|
144
136
|
children: value
|
|
145
137
|
});
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
148
|
-
$[
|
|
149
|
-
} else t2 = $[
|
|
138
|
+
$[16] = t1;
|
|
139
|
+
$[17] = value;
|
|
140
|
+
$[18] = t2;
|
|
141
|
+
} else t2 = $[18];
|
|
150
142
|
return t2;
|
|
151
143
|
}
|
|
152
144
|
function Pagination({ page, pageCount, pageRangeDisplayed, size = "M", onChange, makeUrl, component: LinkComponent = "a", linkProps, className, ariaLabelNext = "Next", ariaLabelPrev = "Previous", ...navProps }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","names":["size","ariaLabel","value","pageItemClassName"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { usePaginationWindow } from './helper'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport IconButton, { IconButtonProps } from '../IconButton'\nimport {\n PaginationContext,\n usePaginationContext,\n type LinkComponentProps,\n type PaginationContextValue,\n type PageRangeDisplayed,\n type Size,\n} from './PaginationContext'\n\ntype NavButtonProps = {\n direction: 'prev' | 'next'\n ariaLabel: IconButtonProps['aria-label']\n}\n\nfunction NavButton({ direction, ariaLabel }: NavButtonProps) {\n 'use memo'\n const {\n page,\n pageCount,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n } = usePaginationContext()\n\n const isPrev = direction === 'prev'\n const targetPage = isPrev\n ? Math.max(1, page - 1)\n : Math.min(pageCount, page + 1)\n const disabled = isPrev ? page <= 1 : page >= pageCount\n const navButtonClassName = useClassNames(\n 'charcoal-pagination-nav-button',\n linkProps?.className,\n )\n\n return (\n <IconButton\n icon={isPrev ? '24/Prev' : '24/Next'}\n size={size}\n /* Use data-hidden, not [hidden]: Tailwind preflight's `[hidden] { display: none !important }` would clobber `visibility: hidden` and collapse the layout space. */\n data-hidden={disabled || undefined}\n aria-label={ariaLabel}\n {...(isLinkMode && makeUrl\n ? {\n component: LinkComponent as 'a',\n href: makeUrl(targetPage),\n 'aria-disabled': disabled,\n ...linkProps,\n className: navButtonClassName,\n }\n : {\n disabled,\n onClick: makeClickHandler(targetPage),\n className: navButtonClassName,\n })}\n />\n )\n}\n\nfunction PageItem({ value }: { value: number | string }) {\n 'use memo'\n const {\n page,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n } = usePaginationContext()\n const pageItemClassName = useClassNames(\n 'charcoal-pagination-button',\n linkProps?.className,\n )\n\n // 省略記号\n if (value === '...') {\n return (\n <IconButton\n icon=\"24/Dot\"\n size={size}\n disabled\n className=\"charcoal-pagination-spacer\"\n aria-hidden\n />\n )\n }\n // 現在ページ(クリック不可)\n if (value === page) {\n return (\n <span className=\"charcoal-pagination-button\" aria-current=\"page\">\n {value}\n </span>\n )\n }\n if (typeof value !== 'number') return null\n // リンクモード: ページへのリンク\n if (isLinkMode && makeUrl) {\n return (\n <LinkComponent\n href={makeUrl(value)}\n {...linkProps}\n className={pageItemClassName}\n >\n {value}\n </LinkComponent>\n )\n }\n // ボタンモード: クリックでページ遷移\n return (\n <button\n type=\"button\"\n className=\"charcoal-pagination-button\"\n onClick={makeClickHandler(value)}\n >\n {value}\n </button>\n )\n}\n\ninterface PaginationCommonProps {\n page: number\n pageCount: number\n pageRangeDisplayed?: PageRangeDisplayed\n size?: Size\n ariaLabelPrev?: string\n ariaLabelNext?: string\n}\n\ntype NavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'>\n\n/**\n * Pagination component. Use either `onChange` (button mode) or `makeUrl` (link mode).\n *\n * @example\n * // Button mode - for client-side state\n * <Pagination page={1} pageCount={10} onChange={setPage} />\n *\n * @example\n * // Link mode - for server routing / static pages\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} />\n *\n * @example\n * // Link mode with custom component (e.g. Next.js Link)\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} component={Link} />\n *\n * @example\n * // Link mode with linkProps (e.g. Next.js scroll)\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} component={Link} linkProps={{ scroll: 'marker' }} />\n */\nexport type PaginationProps<T extends React.ElementType = 'a'> =\n PaginationCommonProps &\n NavProps &\n (\n | {\n onChange(newPage: number): void\n makeUrl?: never\n component?: never\n linkProps?: undefined\n }\n | {\n makeUrl(page: number): string\n onChange?: never\n /**\n * The component used for link elements. Receives `href`, `className`, and `children`.\n * @default 'a'\n */\n component?: T\n /**\n * Additional props passed to all link elements (e.g. Next.js Link's scroll, prefetch).\n */\n linkProps?: Omit<\n React.ComponentPropsWithoutRef<T>,\n 'href' | 'children'\n >\n }\n )\n\nexport default function Pagination<T extends React.ElementType = 'a'>({\n page,\n pageCount,\n pageRangeDisplayed,\n size = 'M',\n onChange,\n makeUrl,\n component: LinkComponent = 'a' as T,\n linkProps,\n className,\n ariaLabelNext = 'Next',\n ariaLabelPrev = 'Previous',\n ...navProps\n}: PaginationProps<T>) {\n 'use memo'\n const window = usePaginationWindow(page, pageCount, pageRangeDisplayed)\n const isLinkMode = makeUrl !== undefined\n const makeClickHandler = (value: number) => () => onChange?.(value)\n const classNames = useClassNames('charcoal-pagination', className)\n\n const contextValue = {\n page,\n pageCount,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n }\n\n return (\n <PaginationContext.Provider\n value={\n contextValue as PaginationContextValue<\n React.ElementType<LinkComponentProps>\n >\n }\n >\n <nav\n data-size={size}\n aria-label=\"Pagination\"\n {...navProps}\n className={classNames}\n >\n <NavButton direction=\"prev\" ariaLabel={ariaLabelPrev} />\n {window.map((p) => (\n <PageItem key={p} value={p} />\n ))}\n <NavButton direction=\"next\" ariaLabel={ariaLabelNext} />\n </nav>\n </PaginationContext.Provider>\n )\n}\n"],"mappings":";;;;;;;;;;AAmBA,SAAA,UAAA,IAAA;CAAA;CAAA,MAAA,IAAA,EAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"index2.js","names":["size","ariaLabel","value","pageItemClassName"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import './index.css'\n\nimport { usePaginationWindow } from './helper'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport IconButton, { IconButtonProps } from '../IconButton'\nimport {\n PaginationContext,\n usePaginationContext,\n type LinkComponentProps,\n type PaginationContextValue,\n type PageRangeDisplayed,\n type Size,\n} from './PaginationContext'\n\ntype NavButtonProps = {\n direction: 'prev' | 'next'\n ariaLabel: IconButtonProps['aria-label']\n}\n\nfunction NavButton({ direction, ariaLabel }: NavButtonProps) {\n 'use memo'\n const {\n page,\n pageCount,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n } = usePaginationContext()\n\n const isPrev = direction === 'prev'\n const targetPage = isPrev\n ? Math.max(1, page - 1)\n : Math.min(pageCount, page + 1)\n const disabled = isPrev ? page <= 1 : page >= pageCount\n const navButtonClassName = useClassNames(\n 'charcoal-pagination-nav-button',\n linkProps?.className,\n )\n\n return (\n <IconButton\n icon={isPrev ? '24/Prev' : '24/Next'}\n size={size}\n /* Use data-hidden, not [hidden]: Tailwind preflight's `[hidden] { display: none !important }` would clobber `visibility: hidden` and collapse the layout space. */\n data-hidden={disabled || undefined}\n aria-label={ariaLabel}\n {...(isLinkMode && makeUrl\n ? {\n component: LinkComponent as 'a',\n href: makeUrl(targetPage),\n 'aria-disabled': disabled,\n ...linkProps,\n className: navButtonClassName,\n }\n : {\n disabled,\n onClick: makeClickHandler(targetPage),\n className: navButtonClassName,\n })}\n />\n )\n}\n\nfunction PageItem({ value }: { value: number | string }) {\n 'use memo'\n const {\n page,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n } = usePaginationContext()\n const pageItemClassName = useClassNames(\n 'charcoal-pagination-button',\n linkProps?.className,\n )\n\n // 省略記号\n if (value === '...') {\n return (\n <IconButton\n icon=\"24/Dot\"\n size={size}\n disabled\n className=\"charcoal-pagination-spacer\"\n aria-hidden\n />\n )\n }\n // 現在ページ(クリック不可)\n if (value === page) {\n return (\n <span className=\"charcoal-pagination-button\" aria-current=\"page\">\n {value}\n </span>\n )\n }\n if (typeof value !== 'number') return null\n // リンクモード: ページへのリンク\n if (isLinkMode && makeUrl) {\n return (\n <LinkComponent\n href={makeUrl(value)}\n {...linkProps}\n className={pageItemClassName}\n >\n {value}\n </LinkComponent>\n )\n }\n // ボタンモード: クリックでページ遷移\n return (\n <button\n type=\"button\"\n className=\"charcoal-pagination-button\"\n onClick={makeClickHandler(value)}\n >\n {value}\n </button>\n )\n}\n\ninterface PaginationCommonProps {\n page: number\n pageCount: number\n pageRangeDisplayed?: PageRangeDisplayed\n size?: Size\n ariaLabelPrev?: string\n ariaLabelNext?: string\n}\n\ntype NavProps = Omit<React.ComponentPropsWithoutRef<'nav'>, 'onChange'>\n\n/**\n * Pagination component. Use either `onChange` (button mode) or `makeUrl` (link mode).\n *\n * @example\n * // Button mode - for client-side state\n * <Pagination page={1} pageCount={10} onChange={setPage} />\n *\n * @example\n * // Link mode - for server routing / static pages\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} />\n *\n * @example\n * // Link mode with custom component (e.g. Next.js Link)\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} component={Link} />\n *\n * @example\n * // Link mode with linkProps (e.g. Next.js scroll)\n * <Pagination page={1} pageCount={10} makeUrl={(p) => `?page=${p}`} component={Link} linkProps={{ scroll: 'marker' }} />\n */\nexport type PaginationProps<T extends React.ElementType = 'a'> =\n PaginationCommonProps &\n NavProps &\n (\n | {\n onChange(newPage: number): void\n makeUrl?: never\n component?: never\n linkProps?: undefined\n }\n | {\n makeUrl(page: number): string\n onChange?: never\n /**\n * The component used for link elements. Receives `href`, `className`, and `children`.\n * @default 'a'\n */\n component?: T\n /**\n * Additional props passed to all link elements (e.g. Next.js Link's scroll, prefetch).\n */\n linkProps?: Omit<\n React.ComponentPropsWithoutRef<T>,\n 'href' | 'children'\n >\n }\n )\n\nexport default function Pagination<T extends React.ElementType = 'a'>({\n page,\n pageCount,\n pageRangeDisplayed,\n size = 'M',\n onChange,\n makeUrl,\n component: LinkComponent = 'a' as T,\n linkProps,\n className,\n ariaLabelNext = 'Next',\n ariaLabelPrev = 'Previous',\n ...navProps\n}: PaginationProps<T>) {\n 'use memo'\n const window = usePaginationWindow(page, pageCount, pageRangeDisplayed)\n const isLinkMode = makeUrl !== undefined\n const makeClickHandler = (value: number) => () => onChange?.(value)\n const classNames = useClassNames('charcoal-pagination', className)\n\n const contextValue = {\n page,\n pageCount,\n size,\n isLinkMode,\n makeUrl,\n LinkComponent,\n makeClickHandler,\n linkProps,\n }\n\n return (\n <PaginationContext.Provider\n value={\n contextValue as PaginationContextValue<\n React.ElementType<LinkComponentProps>\n >\n }\n >\n <nav\n data-size={size}\n aria-label=\"Pagination\"\n {...navProps}\n className={classNames}\n >\n <NavButton direction=\"prev\" ariaLabel={ariaLabelPrev} />\n {window.map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 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import type { ElementType, ReactNode } from 'react';
|
|
3
|
+
import { type ButtonProps } from '../Button';
|
|
4
|
+
type SnackbarPosition = 'top' | 'bottom';
|
|
5
|
+
type SnackbarButtonOption<T extends ElementType = 'button'> = Omit<ButtonProps<T>, 'component' | 'className' | 'size'> & {
|
|
6
|
+
/**
|
|
7
|
+
* ボタンのルート要素として使用するコンポーネント。ページ遷移を伴う場合は `Link` を指定する
|
|
8
|
+
* @default 'button'
|
|
9
|
+
* @example 'Link'
|
|
10
|
+
*/
|
|
11
|
+
component?: T;
|
|
12
|
+
} & ('button' extends T ? unknown : {
|
|
13
|
+
component: T;
|
|
14
|
+
});
|
|
15
|
+
export type SnackbarShowOptions<T extends ElementType = 'button'> = {
|
|
16
|
+
/**
|
|
17
|
+
* Snackbar を表示する時間(ミリ秒)。負の値は 0、数値でない値は 5000 として扱う
|
|
18
|
+
* @default 5000
|
|
19
|
+
*/
|
|
20
|
+
duration?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Snackbar の右側に表示するボタン
|
|
23
|
+
*/
|
|
24
|
+
button?: SnackbarButtonOption<T>;
|
|
25
|
+
};
|
|
26
|
+
export type SnackbarHandler = {
|
|
27
|
+
show: <T extends ElementType = 'button'>(message: ReactNode, options?: SnackbarShowOptions<T>) => void;
|
|
28
|
+
};
|
|
29
|
+
export type SnackbarProps = {
|
|
30
|
+
/**
|
|
31
|
+
* Snackbar の表示位置。ボタン付きの場合は `bottom` に固定される
|
|
32
|
+
* @default 'bottom'
|
|
33
|
+
*/
|
|
34
|
+
position?: SnackbarPosition;
|
|
35
|
+
/**
|
|
36
|
+
* 画面端からの距離(ピクセル)
|
|
37
|
+
* @default 16
|
|
38
|
+
*/
|
|
39
|
+
offset?: number;
|
|
40
|
+
/**
|
|
41
|
+
* 暗い背景色
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
dim?: boolean;
|
|
45
|
+
zIndex?: number;
|
|
46
|
+
portalContainer?: HTMLElement;
|
|
47
|
+
className?: string;
|
|
48
|
+
};
|
|
49
|
+
declare const Snackbar: import("react").ForwardRefExoticComponent<SnackbarProps & import("react").RefAttributes<SnackbarHandler>>;
|
|
50
|
+
export default Snackbar;
|
|
51
|
+
export declare function useSnackbar(props?: SnackbarProps): readonly [import("react/jsx-runtime").JSX.Element, <T extends ElementType = "button">(message: ReactNode, options?: SnackbarShowOptions<T>) => void];
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Snackbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAA;AASpB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAa,MAAM,OAAO,CAAA;AAS9D,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAA;AAOpD,KAAK,gBAAgB,GAAG,KAAK,GAAG,QAAQ,CAAA;AAExC,KAAK,oBAAoB,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,IAAI,IAAI,CAChE,WAAW,CAAC,CAAC,CAAC,EACd,WAAW,GAAG,WAAW,GAAG,MAAM,CACnC,GAAG;IACF;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,CAAA;CACd,GAAG,CAAC,QAAQ,SAAS,CAAC,GAAG,OAAO,GAAG;IAAE,SAAS,EAAE,CAAC,CAAA;CAAE,CAAC,CAAA;AAErD,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,IAAI;IAClE;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,CAAC,CAAC,SAAS,WAAW,GAAG,QAAQ,EACrC,OAAO,EAAE,SAAS,EAClB,OAAO,CAAC,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAC7B,IAAI,CAAA;CACV,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,WAAW,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAeD,QAAA,MAAM,QAAQ,2GA6JZ,CAAA;eAEa,QAAQ;AAEvB,wBAAgB,WAAW,CAAC,KAAK,GAAE,aAAkB,uDAgBrC,CAAC,SAAS,WAAW,sBACxB,SAAS,YACR,mBAAmB,CAAC,CAAC,CAAC,WAKnC"}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_useClassNames = require('../../_lib/useClassNames.cjs');
|
|
3
|
+
const require_index = require('../Button/index2.cjs');
|
|
4
|
+
require('./index.cjs');
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let react_aria_Overlay = require("react-aria/Overlay");
|
|
8
|
+
let react_compiler_runtime = require("react-compiler-runtime");
|
|
9
|
+
let react_aria_useToast = require("react-aria/useToast");
|
|
10
|
+
let react_stately_useToastState = require("react-stately/useToastState");
|
|
11
|
+
|
|
12
|
+
//#region src/components/Snackbar/index.tsx
|
|
13
|
+
const DEFAULT_DURATION_MS = 5e3;
|
|
14
|
+
const DEFAULT_Z_INDEX = 20;
|
|
15
|
+
const ENTER_ANIMATION_DURATION_MS = 300;
|
|
16
|
+
const Snackbar = (0, react.forwardRef)(function Snackbar({ position = "bottom", offset = 16, dim = false, zIndex = DEFAULT_Z_INDEX, portalContainer, className }, ref) {
|
|
17
|
+
"use memo";
|
|
18
|
+
const snackbarRef = (0, react.useRef)(null);
|
|
19
|
+
const queueRef = (0, react.useRef)([]);
|
|
20
|
+
const isShowingRef = (0, react.useRef)(false);
|
|
21
|
+
const hoverRef = (0, react.useRef)({
|
|
22
|
+
active: false,
|
|
23
|
+
pending: void 0
|
|
24
|
+
});
|
|
25
|
+
const playNextRef = (0, react.useRef)(void 0);
|
|
26
|
+
const state = (0, react_stately_useToastState.useToastState)({
|
|
27
|
+
maxVisibleToasts: 1,
|
|
28
|
+
wrapUpdate: (0, react.useCallback)(function wrapToastUpdate(update, action) {
|
|
29
|
+
if (action !== "remove") {
|
|
30
|
+
update();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
function finish() {
|
|
34
|
+
update();
|
|
35
|
+
playNextRef.current?.();
|
|
36
|
+
}
|
|
37
|
+
if (hoverRef.current.active) {
|
|
38
|
+
hoverRef.current.pending = () => wrapToastUpdate(update, "remove");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (snackbarRef.current === null) {
|
|
42
|
+
finish();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const snackbar = snackbarRef.current;
|
|
46
|
+
snackbar.dataset.exiting = "true";
|
|
47
|
+
let completed = false;
|
|
48
|
+
let fallbackTimer = 0;
|
|
49
|
+
function handleAnimationEnd(event) {
|
|
50
|
+
if (event.target === snackbar && event.animationName === "charcoal-snackbar-exit") complete();
|
|
51
|
+
}
|
|
52
|
+
function complete() {
|
|
53
|
+
if (completed) return;
|
|
54
|
+
completed = true;
|
|
55
|
+
snackbar.removeEventListener("animationend", handleAnimationEnd);
|
|
56
|
+
window.clearTimeout(fallbackTimer);
|
|
57
|
+
finish();
|
|
58
|
+
}
|
|
59
|
+
snackbar.addEventListener("animationend", handleAnimationEnd);
|
|
60
|
+
fallbackTimer = window.setTimeout(complete, 400);
|
|
61
|
+
if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) complete();
|
|
62
|
+
}, [])
|
|
63
|
+
});
|
|
64
|
+
(0, react.useEffect)(() => {
|
|
65
|
+
return () => {
|
|
66
|
+
queueRef.current = [];
|
|
67
|
+
isShowingRef.current = false;
|
|
68
|
+
};
|
|
69
|
+
}, []);
|
|
70
|
+
function playNext() {
|
|
71
|
+
const next = queueRef.current.shift();
|
|
72
|
+
if (next === void 0) {
|
|
73
|
+
isShowingRef.current = false;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const { duration, ...content } = next;
|
|
77
|
+
isShowingRef.current = true;
|
|
78
|
+
const enterMs = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : ENTER_ANIMATION_DURATION_MS;
|
|
79
|
+
state.add(content, { timeout: Math.max(1, duration + enterMs) });
|
|
80
|
+
}
|
|
81
|
+
playNextRef.current = playNext;
|
|
82
|
+
function show(message, options = {}) {
|
|
83
|
+
const { duration: durationOption = DEFAULT_DURATION_MS, button } = options;
|
|
84
|
+
const duration_0 = typeof durationOption === "number" && Number.isFinite(durationOption) ? Math.max(0, durationOption) : DEFAULT_DURATION_MS;
|
|
85
|
+
queueRef.current.push({
|
|
86
|
+
message,
|
|
87
|
+
button,
|
|
88
|
+
duration: duration_0
|
|
89
|
+
});
|
|
90
|
+
if (!isShowingRef.current) playNext();
|
|
91
|
+
}
|
|
92
|
+
(0, react.useImperativeHandle)(ref, () => ({ show }));
|
|
93
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarRegion, {
|
|
94
|
+
state,
|
|
95
|
+
position,
|
|
96
|
+
offset,
|
|
97
|
+
dim,
|
|
98
|
+
zIndex,
|
|
99
|
+
portalContainer,
|
|
100
|
+
className,
|
|
101
|
+
snackbarRef,
|
|
102
|
+
onHoverStart: () => {
|
|
103
|
+
hoverRef.current.active = true;
|
|
104
|
+
},
|
|
105
|
+
onHoverEnd: () => {
|
|
106
|
+
hoverRef.current.active = false;
|
|
107
|
+
const pending = hoverRef.current.pending;
|
|
108
|
+
hoverRef.current.pending = void 0;
|
|
109
|
+
pending?.();
|
|
110
|
+
},
|
|
111
|
+
onActionClose: () => {
|
|
112
|
+
hoverRef.current.active = false;
|
|
113
|
+
hoverRef.current.pending = void 0;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
function useSnackbar(t0) {
|
|
118
|
+
"use memo";
|
|
119
|
+
const $ = (0, react_compiler_runtime.c)(13);
|
|
120
|
+
if ($[0] !== "48b810b1254edf94a70dbb5631d15f47f0d432d4831df67ae86f2f07a6c66338") {
|
|
121
|
+
for (let $i = 0; $i < 13; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
122
|
+
$[0] = "48b810b1254edf94a70dbb5631d15f47f0d432d4831df67ae86f2f07a6c66338";
|
|
123
|
+
}
|
|
124
|
+
let t1;
|
|
125
|
+
if ($[1] !== t0) {
|
|
126
|
+
t1 = t0 === void 0 ? {} : t0;
|
|
127
|
+
$[1] = t0;
|
|
128
|
+
$[2] = t1;
|
|
129
|
+
} else t1 = $[2];
|
|
130
|
+
const { position, offset, dim, zIndex, portalContainer, className } = t1;
|
|
131
|
+
const snackbarHandlerRef = (0, react.useRef)(null);
|
|
132
|
+
let t2;
|
|
133
|
+
if ($[3] !== className || $[4] !== dim || $[5] !== offset || $[6] !== portalContainer || $[7] !== position || $[8] !== zIndex) {
|
|
134
|
+
t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Snackbar, {
|
|
135
|
+
ref: snackbarHandlerRef,
|
|
136
|
+
position,
|
|
137
|
+
offset,
|
|
138
|
+
dim,
|
|
139
|
+
zIndex,
|
|
140
|
+
portalContainer,
|
|
141
|
+
className
|
|
142
|
+
});
|
|
143
|
+
$[3] = className;
|
|
144
|
+
$[4] = dim;
|
|
145
|
+
$[5] = offset;
|
|
146
|
+
$[6] = portalContainer;
|
|
147
|
+
$[7] = position;
|
|
148
|
+
$[8] = zIndex;
|
|
149
|
+
$[9] = t2;
|
|
150
|
+
} else t2 = $[9];
|
|
151
|
+
const element = t2;
|
|
152
|
+
let t3;
|
|
153
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
154
|
+
t3 = function show(message, options) {
|
|
155
|
+
snackbarHandlerRef.current?.show(message, options);
|
|
156
|
+
};
|
|
157
|
+
$[10] = t3;
|
|
158
|
+
} else t3 = $[10];
|
|
159
|
+
const show = t3;
|
|
160
|
+
let t4;
|
|
161
|
+
if ($[11] !== element) {
|
|
162
|
+
t4 = [element, show];
|
|
163
|
+
$[11] = element;
|
|
164
|
+
$[12] = t4;
|
|
165
|
+
} else t4 = $[12];
|
|
166
|
+
return t4;
|
|
167
|
+
}
|
|
168
|
+
function SnackbarRegion({ state, position, offset, dim, zIndex, portalContainer, className, snackbarRef, onHoverStart, onHoverEnd, onActionClose }) {
|
|
169
|
+
const regionRef = (0, react.useRef)(null);
|
|
170
|
+
const pausedByFocusRef = (0, react.useRef)(false);
|
|
171
|
+
const { regionProps } = (0, react_aria_useToast.useToastRegion)({}, {
|
|
172
|
+
...state,
|
|
173
|
+
pauseAll() {
|
|
174
|
+
if (regionRef.current?.contains(document.activeElement)) {
|
|
175
|
+
pausedByFocusRef.current = true;
|
|
176
|
+
state.pauseAll();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
resumeAll() {
|
|
180
|
+
if (pausedByFocusRef.current) {
|
|
181
|
+
pausedByFocusRef.current = false;
|
|
182
|
+
state.resumeAll();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}, regionRef);
|
|
186
|
+
const classNames = require_useClassNames.useClassNames("charcoal-snackbar-region", className);
|
|
187
|
+
if (state.visibleToasts.length === 0) return null;
|
|
188
|
+
const effectivePosition = state.visibleToasts.some((toast) => toast.content.button !== void 0) ? "bottom" : position;
|
|
189
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_Overlay.Overlay, {
|
|
190
|
+
disableFocusManagement: true,
|
|
191
|
+
portalContainer,
|
|
192
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
193
|
+
...regionProps,
|
|
194
|
+
ref: regionRef,
|
|
195
|
+
className: classNames,
|
|
196
|
+
"data-position": effectivePosition,
|
|
197
|
+
style: {
|
|
198
|
+
zIndex,
|
|
199
|
+
"--charcoal-snackbar-offset": `${offset}px`
|
|
200
|
+
},
|
|
201
|
+
children: state.visibleToasts.map((toast) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarItem, {
|
|
202
|
+
toast,
|
|
203
|
+
state,
|
|
204
|
+
dim,
|
|
205
|
+
snackbarRef,
|
|
206
|
+
onHoverStart,
|
|
207
|
+
onHoverEnd,
|
|
208
|
+
onActionClose: () => {
|
|
209
|
+
onActionClose();
|
|
210
|
+
state.close(toast.key);
|
|
211
|
+
}
|
|
212
|
+
}, toast.key))
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function SnackbarItem({ toast, state, dim, snackbarRef, onHoverStart, onHoverEnd, onActionClose }) {
|
|
217
|
+
const { toastProps, contentProps, titleProps } = (0, react_aria_useToast.useToast)({ toast }, state, snackbarRef);
|
|
218
|
+
const { message, button } = toast.content;
|
|
219
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
220
|
+
...toastProps,
|
|
221
|
+
ref: snackbarRef,
|
|
222
|
+
className: "charcoal-snackbar",
|
|
223
|
+
"data-dim": dim,
|
|
224
|
+
"data-with-button": button !== void 0,
|
|
225
|
+
onPointerEnter: onHoverStart,
|
|
226
|
+
onPointerLeave: onHoverEnd,
|
|
227
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
228
|
+
...contentProps,
|
|
229
|
+
role: "status",
|
|
230
|
+
className: "charcoal-snackbar-content",
|
|
231
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
232
|
+
...titleProps,
|
|
233
|
+
className: "charcoal-snackbar-label",
|
|
234
|
+
children: message
|
|
235
|
+
})
|
|
236
|
+
}), button !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarAction, {
|
|
237
|
+
button,
|
|
238
|
+
dim,
|
|
239
|
+
onClose: onActionClose
|
|
240
|
+
})]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function SnackbarAction({ button, dim, onClose }) {
|
|
244
|
+
const { onClick, variant, children: buttonChildren, ...buttonProps } = button;
|
|
245
|
+
function handleButtonClick(event) {
|
|
246
|
+
onClick?.(event);
|
|
247
|
+
onClose();
|
|
248
|
+
}
|
|
249
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PolymorphicButton, {
|
|
250
|
+
...buttonProps,
|
|
251
|
+
size: "S",
|
|
252
|
+
variant: variant ?? (dim ? "Navigation" : void 0),
|
|
253
|
+
onClick: handleButtonClick,
|
|
254
|
+
children: buttonChildren
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function PolymorphicButton({ component, ...props }) {
|
|
258
|
+
if (component === void 0 || component === "button") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, { ...props });
|
|
259
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_index.default, {
|
|
260
|
+
...props,
|
|
261
|
+
component
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
//#endregion
|
|
266
|
+
exports.default = Snackbar;
|
|
267
|
+
exports.useSnackbar = useSnackbar;
|
|
268
|
+
//# sourceMappingURL=index2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["wrapToastUpdate","duration","snackbarHandlerRef","position","offset","dim","zIndex","portalContainer","className"],"sources":["../../../src/components/Snackbar/index.tsx"],"sourcesContent":["import './index.css'\n\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react'\nimport type { ElementType, ReactNode, RefObject } from 'react'\nimport { Overlay } from 'react-aria/Overlay'\nimport { useToast, useToastRegion } from 'react-aria/useToast'\nimport {\n useToastState,\n type QueuedToast,\n type ToastState,\n} from 'react-stately/useToastState'\nimport { useClassNames } from '../../_lib/useClassNames'\nimport Button, { type ButtonProps } from '../Button'\n\nconst DEFAULT_DURATION_MS = 5000\nconst DEFAULT_Z_INDEX = 20\nconst ENTER_ANIMATION_DURATION_MS = 300\nconst EXIT_ANIMATION_DURATION_MS = 300\n\ntype SnackbarPosition = 'top' | 'bottom'\n\ntype SnackbarButtonOption<T extends ElementType = 'button'> = Omit<\n ButtonProps<T>,\n 'component' | 'className' | 'size'\n> & {\n /**\n * ボタンのルート要素として使用するコンポーネント。ページ遷移を伴う場合は `Link` を指定する\n * @default 'button'\n * @example 'Link'\n */\n component?: T\n} & ('button' extends T ? unknown : { component: T })\n\nexport type SnackbarShowOptions<T extends ElementType = 'button'> = {\n /**\n * Snackbar を表示する時間(ミリ秒)。負の値は 0、数値でない値は 5000 として扱う\n * @default 5000\n */\n duration?: number\n /**\n * Snackbar の右側に表示するボタン\n */\n button?: SnackbarButtonOption<T>\n}\n\nexport type SnackbarHandler = {\n show: <T extends ElementType = 'button'>(\n message: ReactNode,\n options?: SnackbarShowOptions<T>,\n ) => void\n}\n\nexport type SnackbarProps = {\n /**\n * Snackbar の表示位置。ボタン付きの場合は `bottom` に固定される\n * @default 'bottom'\n */\n position?: SnackbarPosition\n /**\n * 画面端からの距離(ピクセル)\n * @default 16\n */\n offset?: number\n /**\n * 暗い背景色\n * @default false\n */\n dim?: boolean\n zIndex?: number\n portalContainer?: HTMLElement\n className?: string\n}\n\ntype SnackbarContent = {\n message: ReactNode\n button?: SnackbarButtonContent\n}\n\ntype QueuedSnackbar = SnackbarContent & {\n duration: number\n}\n\ntype SnackbarButtonContent = Omit<SnackbarButtonOption, 'component'> & {\n component?: ElementType\n}\n\nconst Snackbar = forwardRef<SnackbarHandler, SnackbarProps>(function Snackbar(\n {\n position = 'bottom',\n offset = 16,\n dim = false,\n zIndex = DEFAULT_Z_INDEX,\n portalContainer,\n className,\n },\n ref,\n) {\n 'use memo'\n\n const snackbarRef = useRef<HTMLDivElement>(null)\n const queueRef = useRef<QueuedSnackbar[]>([])\n const isShowingRef = useRef(false)\n const hoverRef = useRef({\n active: false,\n pending: undefined as (() => void) | undefined,\n })\n // wrapUpdate を固定したまま、後から定義する playNext の最新版を呼ぶ\n const playNextRef = useRef<(() => void) | undefined>(undefined)\n\n // wrapUpdate の参照が変わると useToastState が ToastQueue を作り直すため useCallback で固定する\n const wrapToastUpdate = useCallback(function wrapToastUpdate(\n update: () => void,\n action: 'add' | 'remove' | 'clear',\n ) {\n if (action !== 'remove') {\n update()\n return\n }\n\n function finish() {\n update()\n playNextRef.current?.()\n }\n\n if (hoverRef.current.active) {\n hoverRef.current.pending = () => wrapToastUpdate(update, 'remove')\n return\n }\n\n if (snackbarRef.current === null) {\n finish()\n return\n }\n const snackbar: HTMLDivElement = snackbarRef.current\n\n // allow-discreteが Newly Available で使えないので、要素の削除をアニメーション完了まで待つ\n snackbar.dataset.exiting = 'true'\n let completed = false\n let fallbackTimer = 0 // complete 内で clearTimeout(setTimeout(...)) すると新規タイマーを即キャンセルしてしまう\n function handleAnimationEnd(event: AnimationEvent) {\n if (\n event.target === snackbar &&\n event.animationName === 'charcoal-snackbar-exit'\n ) {\n complete()\n }\n }\n function complete() {\n if (completed) return\n completed = true\n snackbar.removeEventListener('animationend', handleAnimationEnd)\n window.clearTimeout(fallbackTimer)\n finish()\n }\n snackbar.addEventListener('animationend', handleAnimationEnd)\n fallbackTimer = window.setTimeout(\n complete,\n EXIT_ANIMATION_DURATION_MS + 100,\n )\n if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) {\n complete()\n }\n }, [])\n\n const state = useToastState<SnackbarContent>({\n maxVisibleToasts: 1,\n wrapUpdate: wrapToastUpdate,\n })\n\n useEffect(() => {\n return () => {\n queueRef.current = []\n isShowingRef.current = false\n }\n }, [])\n\n function playNext() {\n const next = queueRef.current.shift()\n if (next === undefined) {\n isShowingRef.current = false\n return\n }\n\n const { duration, ...content } = next\n isShowingRef.current = true\n const enterMs = window.matchMedia?.('(prefers-reduced-motion: reduce)')\n .matches\n ? 0\n : ENTER_ANIMATION_DURATION_MS\n state.add(content, {\n // react-stately は 0 を「タイマーなし」と扱うため、最小の正数を渡す\n timeout: Math.max(1, duration + enterMs),\n })\n }\n playNextRef.current = playNext\n\n function show<T extends ElementType = 'button'>(\n message: ReactNode,\n options: SnackbarShowOptions<T> = {},\n ) {\n const { duration: durationOption = DEFAULT_DURATION_MS, button } = options\n const duration =\n typeof durationOption === 'number' && Number.isFinite(durationOption)\n ? Math.max(0, durationOption)\n : DEFAULT_DURATION_MS\n\n queueRef.current.push({\n message,\n button: button as SnackbarButtonContent | undefined,\n duration,\n })\n if (!isShowingRef.current) {\n playNext()\n }\n }\n\n useImperativeHandle(ref, () => ({ show }))\n\n return (\n <SnackbarRegion\n state={state}\n position={position}\n offset={offset}\n dim={dim}\n zIndex={zIndex}\n portalContainer={portalContainer}\n className={className}\n snackbarRef={snackbarRef}\n onHoverStart={() => {\n hoverRef.current.active = true\n }}\n onHoverEnd={() => {\n hoverRef.current.active = false\n const pending = hoverRef.current.pending\n hoverRef.current.pending = undefined\n pending?.()\n }}\n onActionClose={() => {\n hoverRef.current.active = false\n hoverRef.current.pending = undefined\n }}\n />\n )\n})\n\nexport default Snackbar\n\nexport function useSnackbar(props: SnackbarProps = {}) {\n 'use memo'\n\n const { position, offset, dim, zIndex, portalContainer, className } = props\n const snackbarHandlerRef = useRef<SnackbarHandler>(null)\n const element = (\n <Snackbar\n ref={snackbarHandlerRef}\n position={position}\n offset={offset}\n dim={dim}\n zIndex={zIndex}\n portalContainer={portalContainer}\n className={className}\n />\n )\n function show<T extends ElementType = 'button'>(\n message: ReactNode,\n options?: SnackbarShowOptions<T>,\n ) {\n snackbarHandlerRef.current?.show(message, options)\n }\n return [element, show] as const\n}\n\nfunction SnackbarRegion({\n state,\n position,\n offset,\n dim,\n zIndex,\n portalContainer,\n className,\n snackbarRef,\n onHoverStart,\n onHoverEnd,\n onActionClose,\n}: {\n state: ToastState<SnackbarContent>\n position: SnackbarPosition\n offset: number\n dim: boolean\n zIndex: number\n portalContainer?: HTMLElement\n className?: string\n snackbarRef: RefObject<HTMLDivElement>\n onHoverStart: () => void\n onHoverEnd: () => void\n onActionClose: () => void\n}) {\n const regionRef = useRef<HTMLDivElement>(null)\n const pausedByFocusRef = useRef(false)\n const timerState: ToastState<SnackbarContent> = {\n ...state,\n pauseAll() {\n if (regionRef.current?.contains(document.activeElement)) {\n pausedByFocusRef.current = true\n state.pauseAll()\n }\n },\n resumeAll() {\n if (pausedByFocusRef.current) {\n pausedByFocusRef.current = false\n state.resumeAll()\n }\n },\n }\n const { regionProps } = useToastRegion({}, timerState, regionRef)\n const classNames = useClassNames('charcoal-snackbar-region', className)\n\n if (state.visibleToasts.length === 0) {\n return null\n }\n\n // ボタン付きの Snackbar は常に下部に表示される\n const hasButton = state.visibleToasts.some(\n (toast) => toast.content.button !== undefined,\n )\n const effectivePosition = hasButton ? 'bottom' : position\n\n return (\n <Overlay disableFocusManagement portalContainer={portalContainer}>\n <div\n {...regionProps}\n ref={regionRef}\n className={classNames}\n data-position={effectivePosition}\n style={{\n zIndex,\n '--charcoal-snackbar-offset': `${offset}px`,\n }}\n >\n {state.visibleToasts.map((toast) => (\n <SnackbarItem\n key={toast.key}\n toast={toast}\n state={state}\n dim={dim}\n snackbarRef={snackbarRef}\n onHoverStart={onHoverStart}\n onHoverEnd={onHoverEnd}\n onActionClose={() => {\n onActionClose()\n state.close(toast.key)\n }}\n />\n ))}\n </div>\n </Overlay>\n )\n}\n\nfunction SnackbarItem({\n toast,\n state,\n dim,\n snackbarRef,\n onHoverStart,\n onHoverEnd,\n onActionClose,\n}: {\n toast: QueuedToast<SnackbarContent>\n state: ToastState<SnackbarContent>\n dim: boolean\n snackbarRef: RefObject<HTMLDivElement>\n onHoverStart: () => void\n onHoverEnd: () => void\n onActionClose: () => void\n}) {\n const { toastProps, contentProps, titleProps } = useToast(\n { toast },\n state,\n snackbarRef,\n )\n const { message, button } = toast.content\n\n return (\n <div\n {...toastProps}\n ref={snackbarRef}\n className=\"charcoal-snackbar\"\n data-dim={dim}\n data-with-button={button !== undefined}\n onPointerEnter={onHoverStart}\n onPointerLeave={onHoverEnd}\n >\n <div\n {...contentProps}\n role=\"status\"\n className=\"charcoal-snackbar-content\"\n >\n <div {...titleProps} className=\"charcoal-snackbar-label\">\n {message}\n </div>\n </div>\n {button !== undefined && (\n <SnackbarAction button={button} dim={dim} onClose={onActionClose} />\n )}\n </div>\n )\n}\n\nfunction SnackbarAction({\n button,\n dim,\n onClose,\n}: {\n button: SnackbarButtonContent\n dim: boolean\n onClose: () => void\n}) {\n const { onClick, variant, children: buttonChildren, ...buttonProps } = button\n\n function handleButtonClick(\n event: Parameters<NonNullable<ButtonProps<'button'>['onClick']>>[0],\n ) {\n onClick?.(event)\n onClose()\n }\n\n return (\n <PolymorphicButton\n {...buttonProps}\n size=\"S\"\n variant={variant ?? (dim ? 'Navigation' : undefined)}\n onClick={handleButtonClick}\n >\n {buttonChildren}\n </PolymorphicButton>\n )\n}\n\nfunction PolymorphicButton({\n component,\n ...props\n}: Omit<ButtonProps, 'component'> & { component?: ElementType }) {\n if (component === undefined || component === 'button') {\n return <Button {...props} />\n }\n\n return <Button {...props} component={component} />\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AACxB,MAAM,8BAA8B;AAsEpC,MAAM,iCAAsD,SAAS,SACnE,EACE,WAAW,UACX,SAAS,IACT,MAAM,OACN,SAAS,iBACT,iBACA,aAEF,KACA;CACA;CAEA,MAAM,gCAAqC,IAAI;CAC/C,MAAM,6BAAoC,CAAA,CAAE;CAC5C,MAAM,iCAAsB,KAAK;CACjC,MAAM,6BAAkB;EACtB,QAAQ;EACR,SAAS;CACX,CAAC;CAED,MAAM,gCAA+C,MAAS;CAyD9D,MAAM,uDAAuC;EAC3C,kBAAkB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