@charcoal-ui/react 6.1.0-beta.1 → 6.1.0-beta.2
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/Notification/Snackbar/index.d.ts +15 -31
- package/dist/components/Notification/Snackbar/index.d.ts.map +1 -1
- package/dist/components/Notification/Snackbar/index2.cjs +33 -53
- package/dist/components/Notification/Snackbar/index2.cjs.map +1 -1
- package/dist/components/Notification/Snackbar/index2.js +35 -51
- package/dist/components/Notification/Snackbar/index2.js.map +1 -1
- package/dist/components/Notification/Toast/index2.js +20 -16
- package/dist/components/Notification/Toast/index2.js.map +1 -1
- package/dist/components/Pagination/index2.js +60 -52
- package/dist/components/Pagination/index2.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +844 -844
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layered.css +844 -844
- package/dist/layered.css.map +1 -1
- package/package.json +5 -5
- package/src/components/Notification/Snackbar/index.story.tsx +28 -21
- package/src/components/Notification/Snackbar/index.test.tsx +38 -7
- package/src/components/Notification/Snackbar/index.tsx +63 -58
- package/src/components/Notification/Toast/index.story.tsx +9 -6
- package/src/index.ts +3 -3
|
@@ -1,45 +1,29 @@
|
|
|
1
1
|
import '../layout.css';
|
|
2
2
|
import './index.css';
|
|
3
|
-
import type
|
|
3
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
4
4
|
import type { NotificationProps, Position } from '../types';
|
|
5
5
|
export type SnackbarCloseReason = 'timeout' | 'replaced' | 'action' | 'close' | 'unmounted';
|
|
6
6
|
export type ShowSnackbarOptions = {
|
|
7
|
-
/**
|
|
8
|
-
* Snackbar の右側に表示するアクション
|
|
9
|
-
*/
|
|
10
7
|
action?: ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Snackbar が閉じるときに呼び出される
|
|
13
|
-
*/
|
|
14
8
|
onClose?: (reason: SnackbarCloseReason) => void;
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export type SnackbarProps = Omit<NotificationProps, 'position'> & {
|
|
20
|
-
/**
|
|
21
|
-
* Snackbar の表示位置。ボタン付きの場合は `bottom` に固定される
|
|
22
|
-
* @default 'bottom'
|
|
23
|
-
*/
|
|
24
|
-
position?: Position;
|
|
25
|
-
/**
|
|
26
|
-
* 暗い背景色
|
|
27
|
-
* @default false
|
|
28
|
-
*/
|
|
10
|
+
type SnackbarBaseProps = {
|
|
11
|
+
message: ReactNode;
|
|
12
|
+
action?: ReactNode;
|
|
29
13
|
dim?: boolean;
|
|
14
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
15
|
+
export type SnackbarProps = Omit<SnackbarBaseProps, 'action'> & {
|
|
16
|
+
/** Snackbar の右側に表示するアクション */
|
|
17
|
+
action: NonNullable<ReactNode>;
|
|
30
18
|
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Snackbar の表示位置。ボタン付きの場合は `bottom` に固定される
|
|
34
|
-
* @default 'bottom'
|
|
35
|
-
*/
|
|
19
|
+
export type UseSnackbarProps = Omit<NotificationProps, 'position'> & {
|
|
36
20
|
position?: Position;
|
|
37
|
-
/**
|
|
38
|
-
* 暗い背景色
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
21
|
dim?: boolean;
|
|
42
|
-
}
|
|
22
|
+
};
|
|
23
|
+
declare const Snackbar: import("react").ForwardRefExoticComponent<Omit<SnackbarBaseProps, "action"> & {
|
|
24
|
+
/** Snackbar の右側に表示するアクション */
|
|
25
|
+
action: NonNullable<ReactNode>;
|
|
26
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
27
|
export default Snackbar;
|
|
44
|
-
export declare function useSnackbar(props?:
|
|
28
|
+
export declare function useSnackbar(props?: UseSnackbarProps): readonly [import("react/jsx-runtime").JSX.Element, (message: ReactNode, options?: ShowSnackbarOptions) => void];
|
|
45
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notification/Snackbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Notification/Snackbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAA;AACtB,OAAO,aAAa,CAAA;AAEpB,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAKvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAC7B,SAAS,GAAG,UAAU,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,CAAA;AAE3D,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAA;CAChD,CAAA;AAED,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,SAAS,CAAA;IAClB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAA;AAEpD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC,GAAG;IAC9D,6BAA6B;IAC7B,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;CAC/B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,GAAG;IACnE,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,GAAG,CAAC,EAAE,OAAO,CAAA;CACd,CAAA;AAOD,QAAA,MAAM,QAAQ;IAdZ,6BAA6B;YACrB,WAAW,CAAC,SAAS,CAAC;kDAiB/B,CAAA;eAEc,QAAQ;AAEvB,wBAAgB,WAAW,CAAC,KAAK,GAAE,gBAAqB,gEAkB/B,SAAS,YAAW,mBAAmB,WAsC/D"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
const require_useClassNames = require('../../../_lib/useClassNames.cjs');
|
|
2
3
|
require('../layout.cjs');
|
|
3
4
|
require('./index.cjs');
|
|
4
5
|
const require_NotificationItem = require('../NotificationItem.cjs');
|
|
@@ -6,11 +7,17 @@ const require_NotificationRegion = require('../NotificationRegion.cjs');
|
|
|
6
7
|
const require_useNotificationQueue = require('../useNotificationQueue.cjs');
|
|
7
8
|
let react = require("react");
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
-
let react_compiler_runtime = require("react-compiler-runtime");
|
|
10
10
|
|
|
11
11
|
//#region src/components/Notification/Snackbar/index.tsx
|
|
12
|
-
const Snackbar = (0, react.forwardRef)(function Snackbar(
|
|
12
|
+
const Snackbar = (0, react.forwardRef)(function Snackbar(props, ref) {
|
|
13
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarBase, {
|
|
14
|
+
...props,
|
|
15
|
+
ref
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
function useSnackbar(props = {}) {
|
|
13
19
|
"use memo";
|
|
20
|
+
const { position = "bottom", dim = false, duration, order, ...regionProps } = props;
|
|
14
21
|
const { state, itemRef, enqueue, close, onHoverStart, onHoverEnd } = require_useNotificationQueue.useNotificationQueue("snackbar", {
|
|
15
22
|
duration,
|
|
16
23
|
order,
|
|
@@ -23,8 +30,7 @@ const Snackbar = (0, react.forwardRef)(function Snackbar({ position = "bottom",
|
|
|
23
30
|
action: options.action
|
|
24
31
|
}, options.onClose);
|
|
25
32
|
}
|
|
26
|
-
(0,
|
|
27
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_NotificationRegion.NotificationRegion, {
|
|
33
|
+
return [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_NotificationRegion.NotificationRegion, {
|
|
28
34
|
name: "snackbar",
|
|
29
35
|
state,
|
|
30
36
|
position: state.visibleToasts.some((toast) => toast.content.action !== void 0) ? "bottom" : position,
|
|
@@ -38,59 +44,33 @@ const Snackbar = (0, react.forwardRef)(function Snackbar({ position = "bottom",
|
|
|
38
44
|
onHoverEnd,
|
|
39
45
|
"data-dim": dim,
|
|
40
46
|
"data-with-action": toast_0.content.action !== void 0,
|
|
41
|
-
children: toast_0.content.action !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
children: toast_0.content.action !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
48
|
+
onClick: () => close(toast_0.key, "action"),
|
|
49
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarAction, { action: toast_0.content.action })
|
|
44
50
|
})
|
|
45
51
|
}, toast_0.key))
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
function useSnackbar(t0) {
|
|
49
|
-
"use memo";
|
|
50
|
-
const $ = (0, react_compiler_runtime.c)(8);
|
|
51
|
-
if ($[0] !== "1dc1eb8429c7be1137abcfa05286c14e7ca96230a56b18d315897aa3a5101e4e") {
|
|
52
|
-
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
53
|
-
$[0] = "1dc1eb8429c7be1137abcfa05286c14e7ca96230a56b18d315897aa3a5101e4e";
|
|
54
|
-
}
|
|
55
|
-
let t1;
|
|
56
|
-
if ($[1] !== t0) {
|
|
57
|
-
t1 = t0 === void 0 ? {} : t0;
|
|
58
|
-
$[1] = t0;
|
|
59
|
-
$[2] = t1;
|
|
60
|
-
} else t1 = $[2];
|
|
61
|
-
const props = t1;
|
|
62
|
-
const snackbarHandlerRef = (0, react.useRef)(null);
|
|
63
|
-
let t2;
|
|
64
|
-
if ($[3] !== props) {
|
|
65
|
-
t2 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Snackbar, {
|
|
66
|
-
ref: snackbarHandlerRef,
|
|
67
|
-
...props
|
|
68
|
-
});
|
|
69
|
-
$[3] = props;
|
|
70
|
-
$[4] = t2;
|
|
71
|
-
} else t2 = $[4];
|
|
72
|
-
const element = t2;
|
|
73
|
-
let t3;
|
|
74
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
-
t3 = function show(message, options) {
|
|
76
|
-
snackbarHandlerRef.current?.show(message, options);
|
|
77
|
-
};
|
|
78
|
-
$[5] = t3;
|
|
79
|
-
} else t3 = $[5];
|
|
80
|
-
const show = t3;
|
|
81
|
-
let t4;
|
|
82
|
-
if ($[6] !== element) {
|
|
83
|
-
t4 = [element, show];
|
|
84
|
-
$[6] = element;
|
|
85
|
-
$[7] = t4;
|
|
86
|
-
} else t4 = $[7];
|
|
87
|
-
return t4;
|
|
52
|
+
}), show];
|
|
88
53
|
}
|
|
89
|
-
function
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
54
|
+
const SnackbarBase = (0, react.forwardRef)(function SnackbarBase({ message, action, dim = false, className, ...rootProps }, ref) {
|
|
55
|
+
const classNames = require_useClassNames.useClassNames("charcoal-notification", "charcoal-snackbar", className);
|
|
56
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
57
|
+
...rootProps,
|
|
58
|
+
ref,
|
|
59
|
+
className: classNames,
|
|
60
|
+
"data-dim": dim,
|
|
61
|
+
"data-with-action": action !== void 0,
|
|
62
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
63
|
+
role: "status",
|
|
64
|
+
className: "charcoal-notification-content",
|
|
65
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
66
|
+
className: "charcoal-notification-label",
|
|
67
|
+
children: message
|
|
68
|
+
})
|
|
69
|
+
}), action !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SnackbarAction, { action })]
|
|
93
70
|
});
|
|
71
|
+
});
|
|
72
|
+
function SnackbarAction({ action }) {
|
|
73
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: action });
|
|
94
74
|
}
|
|
95
75
|
|
|
96
76
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.cjs","names":["toast"
|
|
1
|
+
{"version":3,"file":"index2.cjs","names":["toast"],"sources":["../../../../src/components/Notification/Snackbar/index.tsx"],"sourcesContent":["import '../layout.css'\nimport './index.css'\n\nimport { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { NotificationItem } from '../NotificationItem'\nimport { NotificationRegion } from '../NotificationRegion'\nimport { useNotificationQueue } from '../useNotificationQueue'\nimport type { NotificationProps, Position } from '../types'\n\nexport type SnackbarCloseReason =\n 'timeout' | 'replaced' | 'action' | 'close' | 'unmounted'\n\nexport type ShowSnackbarOptions = {\n action?: ReactNode\n onClose?: (reason: SnackbarCloseReason) => void\n}\n\ntype SnackbarBaseProps = {\n message: ReactNode\n action?: ReactNode\n dim?: boolean\n} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>\n\nexport type SnackbarProps = Omit<SnackbarBaseProps, 'action'> & {\n /** Snackbar の右側に表示するアクション */\n action: NonNullable<ReactNode>\n}\n\nexport type UseSnackbarProps = Omit<NotificationProps, 'position'> & {\n position?: Position\n dim?: boolean\n}\n\ntype SnackbarContent = {\n message: ReactNode\n action?: ReactNode\n}\n\nconst Snackbar = forwardRef<HTMLDivElement, SnackbarProps>(\n function Snackbar(props, ref) {\n return <SnackbarBase {...props} ref={ref} />\n },\n)\n\nexport default Snackbar\n\nexport function useSnackbar(props: UseSnackbarProps = {}) {\n 'use memo'\n\n const {\n position = 'bottom',\n dim = false,\n duration,\n order,\n ...regionProps\n } = props\n const { state, itemRef, enqueue, close, onHoverStart, onHoverEnd } =\n useNotificationQueue<SnackbarContent, SnackbarCloseReason>('snackbar', {\n duration,\n order,\n timeoutReason: 'timeout',\n unmountedReason: 'unmounted',\n })\n\n function show(message: ReactNode, options: ShowSnackbarOptions = {}) {\n enqueue({ message, action: options.action }, options.onClose)\n }\n\n const hasAction = state.visibleToasts.some(\n (toast) => toast.content.action !== undefined,\n )\n const effectivePosition = hasAction ? 'bottom' : position\n const element = (\n <NotificationRegion\n name=\"snackbar\"\n state={state}\n position={effectivePosition}\n {...regionProps}\n >\n {state.visibleToasts.map((toast) => (\n <NotificationItem\n key={toast.key}\n name=\"snackbar\"\n toast={toast}\n state={state}\n itemRef={itemRef}\n onHoverStart={onHoverStart}\n onHoverEnd={onHoverEnd}\n data-dim={dim}\n data-with-action={toast.content.action !== undefined}\n >\n {toast.content.action !== undefined && (\n <div onClick={() => close(toast.key, 'action')}>\n <SnackbarAction action={toast.content.action} />\n </div>\n )}\n </NotificationItem>\n ))}\n </NotificationRegion>\n )\n\n return [element, show] as const\n}\n\nconst SnackbarBase = forwardRef<HTMLDivElement, SnackbarBaseProps>(\n function SnackbarBase(\n { message, action, dim = false, className, ...rootProps },\n ref,\n ) {\n const classNames = useClassNames(\n 'charcoal-notification',\n 'charcoal-snackbar',\n className,\n )\n\n return (\n <div\n {...rootProps}\n ref={ref}\n className={classNames}\n data-dim={dim}\n data-with-action={action !== undefined}\n >\n <div role=\"status\" className=\"charcoal-notification-content\">\n <div className=\"charcoal-notification-label\">{message}</div>\n </div>\n {action !== undefined && <SnackbarAction action={action} />}\n </div>\n )\n },\n)\n\nfunction SnackbarAction({ action }: { action: ReactNode }) {\n return <div>{action}</div>\n}\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,iCACJ,SAAS,SAAS,OAAO,KAAK;CAC5B,OAAO,2CAAC,cAAD;EAAc,GAAI;EAAY;CAAI;AAC3C,CACF;AAIA,SAAgB,YAAY,QAA0B,CAAC,GAAG;CACxD;CAEA,MAAM,EACJ,WAAW,UACX,MAAM,OACN,UACA,OACA,GAAG,gBACD;CACJ,MAAM,EAAE,OAAO,SAAS,SAAS,OAAO,cAAc,eACpD,kDAA2D,YAAY;EACrE;EACA;EACA,eAAe;EACf,iBAAiB;CACnB,CAAC;CAEH,SAAS,KAAK,SAAoB,UAA+B,CAAC,GAAG;EACnE,QAAQ;GAAE;GAAS,QAAQ,QAAQ;EAAO,GAAG,QAAQ,OAAO;CAC9D;CAmCA,OAAO,CAAC,2CA5BL,+CAAD;EACE,MAAK;EACE;EACP,UARc,MAAM,cAAc,MACnC,UAAU,MAAM,QAAQ,WAAW,MAEZ,IAAY,WAAW;EAM7C,GAAI;YAEH,MAAM,cAAc,KAAKA,YACxB,2CAAC,2CAAD;GAEE,MAAK;GACL,OAAOA;GACA;GACE;GACK;GACF;GACZ,YAAU;GACV,oBAAkBA,QAAM,QAAQ,WAAW;aAE1CA,QAAM,QAAQ,WAAW,UACxB,2CAAC,OAAD;IAAK,eAAe,MAAMA,QAAM,KAAK,QAAQ;cAC3C,2CAAC,gBAAD,EAAgB,QAAQA,QAAM,QAAQ,OAAO;GAC1C;EAES,GAfXA,QAAM,GAeK,CACnB;CACiB,CAGd,GAAS,IAAI;AACvB;AAEA,MAAM,qCACJ,SAAS,aACP,EAAE,SAAS,QAAQ,MAAM,OAAO,WAAW,GAAG,aAC9C,KACA;CACA,MAAM,aAAa,oCACjB,yBACA,qBACA,SACF;CAEA,OACE,4CAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,YAAU;EACV,oBAAkB,WAAW;YAL/B,CAOE,2CAAC,OAAD;GAAK,MAAK;GAAS,WAAU;aAC3B,2CAAC,OAAD;IAAK,WAAU;cAA+B;GAAa;EACxD,IACJ,WAAW,UAAa,2CAAC,gBAAD,EAAwB,OAAO,EACrD;;AAET,CACF;AAEA,SAAS,eAAe,EAAE,UAAiC;CACzD,OAAO,2CAAC,OAAD,YAAM,OAAY;AAC3B"}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useClassNames } from "../../../_lib/useClassNames.js";
|
|
2
3
|
/* empty css */
|
|
3
4
|
/* empty css */
|
|
4
5
|
import { NotificationItem } from "../NotificationItem.js";
|
|
5
6
|
import { NotificationRegion } from "../NotificationRegion.js";
|
|
6
7
|
import { useNotificationQueue } from "../useNotificationQueue.js";
|
|
7
|
-
import { forwardRef
|
|
8
|
-
import { jsx } from "react/jsx-runtime";
|
|
9
|
-
import { c } from "react-compiler-runtime";
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
|
|
11
11
|
//#region src/components/Notification/Snackbar/index.tsx
|
|
12
|
-
const Snackbar = forwardRef(function Snackbar(
|
|
12
|
+
const Snackbar = forwardRef(function Snackbar(props, ref) {
|
|
13
|
+
return /* @__PURE__ */ jsx(SnackbarBase, {
|
|
14
|
+
...props,
|
|
15
|
+
ref
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
function useSnackbar(props = {}) {
|
|
13
19
|
"use memo";
|
|
20
|
+
const { position = "bottom", dim = false, duration, order, ...regionProps } = props;
|
|
14
21
|
const { state, itemRef, enqueue, close, onHoverStart, onHoverEnd } = useNotificationQueue("snackbar", {
|
|
15
22
|
duration,
|
|
16
23
|
order,
|
|
@@ -23,8 +30,7 @@ const Snackbar = forwardRef(function Snackbar({ position = "bottom", dim = false
|
|
|
23
30
|
action: options.action
|
|
24
31
|
}, options.onClose);
|
|
25
32
|
}
|
|
26
|
-
|
|
27
|
-
return /* @__PURE__ */ jsx(NotificationRegion, {
|
|
33
|
+
return [/* @__PURE__ */ jsx(NotificationRegion, {
|
|
28
34
|
name: "snackbar",
|
|
29
35
|
state,
|
|
30
36
|
position: state.visibleToasts.some((toast) => toast.content.action !== void 0) ? "bottom" : position,
|
|
@@ -38,55 +44,33 @@ const Snackbar = forwardRef(function Snackbar({ position = "bottom", dim = false
|
|
|
38
44
|
onHoverEnd,
|
|
39
45
|
"data-dim": dim,
|
|
40
46
|
"data-with-action": toast_0.content.action !== void 0,
|
|
41
|
-
children: toast_0.content.action !== void 0 && /* @__PURE__ */ jsx(
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
children: toast_0.content.action !== void 0 && /* @__PURE__ */ jsx("div", {
|
|
48
|
+
onClick: () => close(toast_0.key, "action"),
|
|
49
|
+
children: /* @__PURE__ */ jsx(SnackbarAction, { action: toast_0.content.action })
|
|
44
50
|
})
|
|
45
51
|
}, toast_0.key))
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
function useSnackbar(t0) {
|
|
49
|
-
"use memo";
|
|
50
|
-
const $ = c(7);
|
|
51
|
-
let t1;
|
|
52
|
-
if ($[0] !== t0) {
|
|
53
|
-
t1 = t0 === void 0 ? {} : t0;
|
|
54
|
-
$[0] = t0;
|
|
55
|
-
$[1] = t1;
|
|
56
|
-
} else t1 = $[1];
|
|
57
|
-
const props = t1;
|
|
58
|
-
const snackbarHandlerRef = useRef(null);
|
|
59
|
-
let t2;
|
|
60
|
-
if ($[2] !== props) {
|
|
61
|
-
t2 = /* @__PURE__ */ jsx(Snackbar, {
|
|
62
|
-
ref: snackbarHandlerRef,
|
|
63
|
-
...props
|
|
64
|
-
});
|
|
65
|
-
$[2] = props;
|
|
66
|
-
$[3] = t2;
|
|
67
|
-
} else t2 = $[3];
|
|
68
|
-
const element = t2;
|
|
69
|
-
let t3;
|
|
70
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
71
|
-
t3 = function show(message, options) {
|
|
72
|
-
snackbarHandlerRef.current?.show(message, options);
|
|
73
|
-
};
|
|
74
|
-
$[4] = t3;
|
|
75
|
-
} else t3 = $[4];
|
|
76
|
-
const show = t3;
|
|
77
|
-
let t4;
|
|
78
|
-
if ($[5] !== element) {
|
|
79
|
-
t4 = [element, show];
|
|
80
|
-
$[5] = element;
|
|
81
|
-
$[6] = t4;
|
|
82
|
-
} else t4 = $[6];
|
|
83
|
-
return t4;
|
|
52
|
+
}), show];
|
|
84
53
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
54
|
+
const SnackbarBase = forwardRef(function SnackbarBase({ message, action, dim = false, className, ...rootProps }, ref) {
|
|
55
|
+
const classNames = useClassNames("charcoal-notification", "charcoal-snackbar", className);
|
|
56
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
57
|
+
...rootProps,
|
|
58
|
+
ref,
|
|
59
|
+
className: classNames,
|
|
60
|
+
"data-dim": dim,
|
|
61
|
+
"data-with-action": action !== void 0,
|
|
62
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
63
|
+
role: "status",
|
|
64
|
+
className: "charcoal-notification-content",
|
|
65
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
66
|
+
className: "charcoal-notification-label",
|
|
67
|
+
children: message
|
|
68
|
+
})
|
|
69
|
+
}), action !== void 0 && /* @__PURE__ */ jsx(SnackbarAction, { action })]
|
|
89
70
|
});
|
|
71
|
+
});
|
|
72
|
+
function SnackbarAction({ action }) {
|
|
73
|
+
return /* @__PURE__ */ jsx("div", { children: action });
|
|
90
74
|
}
|
|
91
75
|
|
|
92
76
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","names":["toast"
|
|
1
|
+
{"version":3,"file":"index2.js","names":["toast"],"sources":["../../../../src/components/Notification/Snackbar/index.tsx"],"sourcesContent":["import '../layout.css'\nimport './index.css'\n\nimport { forwardRef, type HTMLAttributes, type ReactNode } from 'react'\nimport { useClassNames } from '../../../_lib/useClassNames'\nimport { NotificationItem } from '../NotificationItem'\nimport { NotificationRegion } from '../NotificationRegion'\nimport { useNotificationQueue } from '../useNotificationQueue'\nimport type { NotificationProps, Position } from '../types'\n\nexport type SnackbarCloseReason =\n 'timeout' | 'replaced' | 'action' | 'close' | 'unmounted'\n\nexport type ShowSnackbarOptions = {\n action?: ReactNode\n onClose?: (reason: SnackbarCloseReason) => void\n}\n\ntype SnackbarBaseProps = {\n message: ReactNode\n action?: ReactNode\n dim?: boolean\n} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>\n\nexport type SnackbarProps = Omit<SnackbarBaseProps, 'action'> & {\n /** Snackbar の右側に表示するアクション */\n action: NonNullable<ReactNode>\n}\n\nexport type UseSnackbarProps = Omit<NotificationProps, 'position'> & {\n position?: Position\n dim?: boolean\n}\n\ntype SnackbarContent = {\n message: ReactNode\n action?: ReactNode\n}\n\nconst Snackbar = forwardRef<HTMLDivElement, SnackbarProps>(\n function Snackbar(props, ref) {\n return <SnackbarBase {...props} ref={ref} />\n },\n)\n\nexport default Snackbar\n\nexport function useSnackbar(props: UseSnackbarProps = {}) {\n 'use memo'\n\n const {\n position = 'bottom',\n dim = false,\n duration,\n order,\n ...regionProps\n } = props\n const { state, itemRef, enqueue, close, onHoverStart, onHoverEnd } =\n useNotificationQueue<SnackbarContent, SnackbarCloseReason>('snackbar', {\n duration,\n order,\n timeoutReason: 'timeout',\n unmountedReason: 'unmounted',\n })\n\n function show(message: ReactNode, options: ShowSnackbarOptions = {}) {\n enqueue({ message, action: options.action }, options.onClose)\n }\n\n const hasAction = state.visibleToasts.some(\n (toast) => toast.content.action !== undefined,\n )\n const effectivePosition = hasAction ? 'bottom' : position\n const element = (\n <NotificationRegion\n name=\"snackbar\"\n state={state}\n position={effectivePosition}\n {...regionProps}\n >\n {state.visibleToasts.map((toast) => (\n <NotificationItem\n key={toast.key}\n name=\"snackbar\"\n toast={toast}\n state={state}\n itemRef={itemRef}\n onHoverStart={onHoverStart}\n onHoverEnd={onHoverEnd}\n data-dim={dim}\n data-with-action={toast.content.action !== undefined}\n >\n {toast.content.action !== undefined && (\n <div onClick={() => close(toast.key, 'action')}>\n <SnackbarAction action={toast.content.action} />\n </div>\n )}\n </NotificationItem>\n ))}\n </NotificationRegion>\n )\n\n return [element, show] as const\n}\n\nconst SnackbarBase = forwardRef<HTMLDivElement, SnackbarBaseProps>(\n function SnackbarBase(\n { message, action, dim = false, className, ...rootProps },\n ref,\n ) {\n const classNames = useClassNames(\n 'charcoal-notification',\n 'charcoal-snackbar',\n className,\n )\n\n return (\n <div\n {...rootProps}\n ref={ref}\n className={classNames}\n data-dim={dim}\n data-with-action={action !== undefined}\n >\n <div role=\"status\" className=\"charcoal-notification-content\">\n <div className=\"charcoal-notification-label\">{message}</div>\n </div>\n {action !== undefined && <SnackbarAction action={action} />}\n </div>\n )\n },\n)\n\nfunction SnackbarAction({ action }: { action: ReactNode }) {\n return <div>{action}</div>\n}\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,WAAW,WACf,SAAS,SAAS,OAAO,KAAK;CAC5B,OAAO,oBAAC,cAAD;EAAc,GAAI;EAAY;CAAI;AAC3C,CACF;AAIA,SAAgB,YAAY,QAA0B,CAAC,GAAG;CACxD;CAEA,MAAM,EACJ,WAAW,UACX,MAAM,OACN,UACA,OACA,GAAG,gBACD;CACJ,MAAM,EAAE,OAAO,SAAS,SAAS,OAAO,cAAc,eACpD,qBAA2D,YAAY;EACrE;EACA;EACA,eAAe;EACf,iBAAiB;CACnB,CAAC;CAEH,SAAS,KAAK,SAAoB,UAA+B,CAAC,GAAG;EACnE,QAAQ;GAAE;GAAS,QAAQ,QAAQ;EAAO,GAAG,QAAQ,OAAO;CAC9D;CAmCA,OAAO,CAAC,oBA5BL,oBAAD;EACE,MAAK;EACE;EACP,UARc,MAAM,cAAc,MACnC,UAAU,MAAM,QAAQ,WAAW,MAEZ,IAAY,WAAW;EAM7C,GAAI;YAEH,MAAM,cAAc,KAAKA,YACxB,oBAAC,kBAAD;GAEE,MAAK;GACL,OAAOA;GACA;GACE;GACK;GACF;GACZ,YAAU;GACV,oBAAkBA,QAAM,QAAQ,WAAW;aAE1CA,QAAM,QAAQ,WAAW,UACxB,oBAAC,OAAD;IAAK,eAAe,MAAMA,QAAM,KAAK,QAAQ;cAC3C,oBAAC,gBAAD,EAAgB,QAAQA,QAAM,QAAQ,OAAO;GAC1C;EAES,GAfXA,QAAM,GAeK,CACnB;CACiB,CAGd,GAAS,IAAI;AACvB;AAEA,MAAM,eAAe,WACnB,SAAS,aACP,EAAE,SAAS,QAAQ,MAAM,OAAO,WAAW,GAAG,aAC9C,KACA;CACA,MAAM,aAAa,cACjB,yBACA,qBACA,SACF;CAEA,OACE,qBAAC,OAAD;EACE,GAAI;EACC;EACL,WAAW;EACX,YAAU;EACV,oBAAkB,WAAW;YAL/B,CAOE,oBAAC,OAAD;GAAK,MAAK;GAAS,WAAU;aAC3B,oBAAC,OAAD;IAAK,WAAU;cAA+B;GAAa;EACxD,IACJ,WAAW,UAAa,oBAAC,gBAAD,EAAwB,OAAO,EACrD;;AAET,CACF;AAEA,SAAS,eAAe,EAAE,UAAiC;CACzD,OAAO,oBAAC,OAAD,YAAM,OAAY;AAC3B"}
|
|
@@ -40,39 +40,43 @@ const Toast = forwardRef(function Toast({ position = "top", duration, order, ...
|
|
|
40
40
|
});
|
|
41
41
|
function useToast(t0) {
|
|
42
42
|
"use memo";
|
|
43
|
-
const $ = c(
|
|
43
|
+
const $ = c(8);
|
|
44
|
+
if ($[0] !== "aad1570b2784f7343f322f27996bd84f97380bf45debf5009829c7eb5dc91e8e") {
|
|
45
|
+
for (let $i = 0; $i < 8; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
46
|
+
$[0] = "aad1570b2784f7343f322f27996bd84f97380bf45debf5009829c7eb5dc91e8e";
|
|
47
|
+
}
|
|
44
48
|
let t1;
|
|
45
|
-
if ($[
|
|
49
|
+
if ($[1] !== t0) {
|
|
46
50
|
t1 = t0 === void 0 ? {} : t0;
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
} else t1 = $[
|
|
51
|
+
$[1] = t0;
|
|
52
|
+
$[2] = t1;
|
|
53
|
+
} else t1 = $[2];
|
|
50
54
|
const props = t1;
|
|
51
55
|
const toastHandlerRef = useRef(null);
|
|
52
56
|
let t2;
|
|
53
|
-
if ($[
|
|
57
|
+
if ($[3] !== props) {
|
|
54
58
|
t2 = /* @__PURE__ */ jsx(Toast, {
|
|
55
59
|
ref: toastHandlerRef,
|
|
56
60
|
...props
|
|
57
61
|
});
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
} else t2 = $[
|
|
62
|
+
$[3] = props;
|
|
63
|
+
$[4] = t2;
|
|
64
|
+
} else t2 = $[4];
|
|
61
65
|
const element = t2;
|
|
62
66
|
let t3;
|
|
63
|
-
if ($[
|
|
67
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
68
|
t3 = function show(message, options) {
|
|
65
69
|
toastHandlerRef.current?.show(message, options);
|
|
66
70
|
};
|
|
67
|
-
$[
|
|
68
|
-
} else t3 = $[
|
|
71
|
+
$[5] = t3;
|
|
72
|
+
} else t3 = $[5];
|
|
69
73
|
const show = t3;
|
|
70
74
|
let t4;
|
|
71
|
-
if ($[
|
|
75
|
+
if ($[6] !== element) {
|
|
72
76
|
t4 = [element, show];
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
75
|
-
} else t4 = $[
|
|
77
|
+
$[6] = element;
|
|
78
|
+
$[7] = t4;
|
|
79
|
+
} else t4 = $[7];
|
|
76
80
|
return t4;
|
|
77
81
|
}
|
|
78
82
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","names":["toastHandlerRef"],"sources":["../../../../src/components/Notification/Toast/index.tsx"],"sourcesContent":["import '../layout.css'\nimport './index.css'\n\nimport { forwardRef, useImperativeHandle, useRef } from 'react'\nimport type { ReactNode } from 'react'\nimport { NotificationItem } from '../NotificationItem'\nimport { NotificationRegion } from '../NotificationRegion'\nimport { useNotificationQueue } from '../useNotificationQueue'\nimport type { NotificationProps, Position } from '../types'\n\nexport type ToastType = 'success' | 'error'\n\nexport type ShowToastOptions = {\n type: ToastType\n}\n\nexport type ToastHandler = {\n show: (message: ReactNode, options: ShowToastOptions) => void\n}\n\nexport type ToastProps = Omit<NotificationProps, 'position'> & {\n /**\n * Toast の表示位置\n * @default 'top'\n */\n position?: Position\n}\n\ntype ToastContent = {\n message: ReactNode\n type: ToastType\n}\n\nconst Toast = forwardRef<ToastHandler, ToastProps>(function Toast(\n { position = 'top', duration, order, ...regionProps },\n ref,\n) {\n 'use memo'\n\n const { state, itemRef, enqueue, onHoverStart, onHoverEnd } =\n useNotificationQueue<ToastContent>('toast', { duration, order })\n\n function show(message: ReactNode, options: ShowToastOptions) {\n enqueue({\n message,\n type: options.type,\n })\n }\n\n useImperativeHandle(ref, () => ({ show }))\n\n return (\n <NotificationRegion\n name=\"toast\"\n state={state}\n position={position}\n {...regionProps}\n >\n {state.visibleToasts.map((toast) => (\n <NotificationItem\n key={toast.key}\n name=\"toast\"\n toast={toast}\n state={state}\n itemRef={itemRef}\n onHoverStart={onHoverStart}\n onHoverEnd={onHoverEnd}\n data-type={toast.content.type}\n />\n ))}\n </NotificationRegion>\n )\n})\n\nexport default Toast\n\nexport function useToast(props: ToastProps = {}) {\n 'use memo'\n\n const toastHandlerRef = useRef<ToastHandler>(null)\n const element = <Toast ref={toastHandlerRef} {...props} />\n function show(message: ReactNode, options: ShowToastOptions) {\n toastHandlerRef.current?.show(message, options)\n }\n return [element, show] as const\n}\n"],"mappings":";;;;;;;;;;;AAiCA,MAAM,QAAQ,WAAqC,SAAS,MAC1D,EAAE,WAAW,OAAO,UAAU,OAAO,GAAG,eACxC,KACA;CACA;CAEA,MAAM,EAAE,OAAO,SAAS,SAAS,cAAc,eAC7C,qBAAmC,SAAS;EAAE;EAAU;CAAM,CAAC;CAEjE,SAAS,KAAK,SAAoB,SAA2B;EAC3D,QAAQ;GACN;GACA,MAAM,QAAQ;EAChB,CAAC;CACH;CAEA,oBAAoB,YAAY,EAAE,KAAK,EAAE;CAEzC,OACE,oBAAC,oBAAD;EACE,MAAK;EACE;EACG;EACV,GAAI;YAEH,MAAM,cAAc,KAAK,UACxB,oBAAC,kBAAD;GAEE,MAAK;GACE;GACA;GACE;GACK;GACF;GACZ,aAAW,MAAM,QAAQ;EAAK,GAPzB,MAAM,GAOmB,CAEjC;CACiB;AAExB,CAAC;AAID,SAAO,SAAA,IAAA;CAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAkB,KAAA,OAAA,SAAA,CAAqB,IAArB;EAAsB,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAtB,MAAA,QAAA;CAGvB,MAAA,kBAAwB,OAAqB,IAAI;CAAC,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA;EAClC,KAAA,oBAAC,OAAD;GAAYA,KAAA;GAAe,GAAM;EAAK;EAAI,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAA1D,MAAA,UAAgB;CAA0C,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAC1D,KAAA,SAAA,KAAA,SAAA,SAAA;GACE,gBAAe,SAAc,KAAC,SAAS,OAAO;EAAC;EAChD,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAFD,MAAA,OAAA;CAEC,IAAA;CAAA,IAAA,EAAA,OAAA,SAAA;EACM,KAAA,CAAC,SAAS,IAAI;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAf;AAAwB"}
|
|
1
|
+
{"version":3,"file":"index2.js","names":["toastHandlerRef"],"sources":["../../../../src/components/Notification/Toast/index.tsx"],"sourcesContent":["import '../layout.css'\nimport './index.css'\n\nimport { forwardRef, useImperativeHandle, useRef } from 'react'\nimport type { ReactNode } from 'react'\nimport { NotificationItem } from '../NotificationItem'\nimport { NotificationRegion } from '../NotificationRegion'\nimport { useNotificationQueue } from '../useNotificationQueue'\nimport type { NotificationProps, Position } from '../types'\n\nexport type ToastType = 'success' | 'error'\n\nexport type ShowToastOptions = {\n type: ToastType\n}\n\nexport type ToastHandler = {\n show: (message: ReactNode, options: ShowToastOptions) => void\n}\n\nexport type ToastProps = Omit<NotificationProps, 'position'> & {\n /**\n * Toast の表示位置\n * @default 'top'\n */\n position?: Position\n}\n\ntype ToastContent = {\n message: ReactNode\n type: ToastType\n}\n\nconst Toast = forwardRef<ToastHandler, ToastProps>(function Toast(\n { position = 'top', duration, order, ...regionProps },\n ref,\n) {\n 'use memo'\n\n const { state, itemRef, enqueue, onHoverStart, onHoverEnd } =\n useNotificationQueue<ToastContent>('toast', { duration, order })\n\n function show(message: ReactNode, options: ShowToastOptions) {\n enqueue({\n message,\n type: options.type,\n })\n }\n\n useImperativeHandle(ref, () => ({ show }))\n\n return (\n <NotificationRegion\n name=\"toast\"\n state={state}\n position={position}\n {...regionProps}\n >\n {state.visibleToasts.map((toast) => (\n <NotificationItem\n key={toast.key}\n name=\"toast\"\n toast={toast}\n state={state}\n itemRef={itemRef}\n onHoverStart={onHoverStart}\n onHoverEnd={onHoverEnd}\n data-type={toast.content.type}\n />\n ))}\n </NotificationRegion>\n )\n})\n\nexport default Toast\n\nexport function useToast(props: ToastProps = {}) {\n 'use memo'\n\n const toastHandlerRef = useRef<ToastHandler>(null)\n const element = <Toast ref={toastHandlerRef} {...props} />\n function show(message: ReactNode, options: ShowToastOptions) {\n toastHandlerRef.current?.show(message, options)\n }\n return [element, show] as const\n}\n"],"mappings":";;;;;;;;;;;AAiCA,MAAM,QAAQ,WAAqC,SAAS,MAC1D,EAAE,WAAW,OAAO,UAAU,OAAO,GAAG,eACxC,KACA;CACA;CAEA,MAAM,EAAE,OAAO,SAAS,SAAS,cAAc,eAC7C,qBAAmC,SAAS;EAAE;EAAU;CAAM,CAAC;CAEjE,SAAS,KAAK,SAAoB,SAA2B;EAC3D,QAAQ;GACN;GACA,MAAM,QAAQ;EAChB,CAAC;CACH;CAEA,oBAAoB,YAAY,EAAE,KAAK,EAAE;CAEzC,OACE,oBAAC,oBAAD;EACE,MAAK;EACE;EACG;EACV,GAAI;YAEH,MAAM,cAAc,KAAK,UACxB,oBAAC,kBAAD;GAEE,MAAK;GACE;GACA;GACE;GACK;GACF;GACZ,aAAW,MAAM,QAAQ;EAAK,GAPzB,MAAM,GAOmB,CAEjC;CACiB;AAExB,CAAC;AAID,SAAO,SAAA,IAAA;CAAA;CAAA,MAAA,IAAA,EAAA,CAAA;CAAA,IAAA,EAAA,OAAA,oEAAA;EAAA,KAAA,IAAA,KAAA,GAAA,KAAA,GAAA,MAAA,GAAA,EAAA,MAAA,OAAA,IAAA,2BAAA;EAAA,EAAA,KAAA;CAAA;CAAA,IAAA;CAAA,IAAA,EAAA,OAAA,IAAA;EAAkB,KAAA,OAAA,SAAA,CAAqB,IAArB;EAAsB,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAtB,MAAA,QAAA;CAGvB,MAAA,kBAAwB,OAAqB,IAAI;CAAC,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA;EAClC,KAAA,oBAAC,OAAD;GAAYA,KAAA;GAAe,GAAM;EAAK;EAAI,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAA1D,MAAA,UAAgB;CAA0C,IAAA;CAAA,IAAA,EAAA,OAAA,OAAA,IAAA,2BAAA,GAAA;EAC1D,KAAA,SAAA,KAAA,SAAA,SAAA;GACE,gBAAe,SAAc,KAAC,SAAS,OAAO;EAAC;EAChD,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAFD,MAAA,OAAA;CAEC,IAAA;CAAA,IAAA,EAAA,OAAA,SAAA;EACM,KAAA,CAAC,SAAS,IAAI;EAAC,EAAA,KAAA;EAAA,EAAA,KAAA;CAAA,OAAA,KAAA,EAAA;CAAA,OAAf;AAAwB"}
|
|
@@ -10,7 +10,11 @@ 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(
|
|
13
|
+
const $ = c(16);
|
|
14
|
+
if ($[0] !== "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794") {
|
|
15
|
+
for (let $i = 0; $i < 16; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
|
+
$[0] = "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794";
|
|
17
|
+
}
|
|
14
18
|
const { direction, ariaLabel } = t0;
|
|
15
19
|
const { page, pageCount, size, isLinkMode, makeUrl, LinkComponent, makeClickHandler, linkProps } = usePaginationContext();
|
|
16
20
|
const isPrev = direction === "prev";
|
|
@@ -20,7 +24,7 @@ function NavButton(t0) {
|
|
|
20
24
|
const t1 = isPrev ? "24/Prev" : "24/Next";
|
|
21
25
|
const t2 = disabled || void 0;
|
|
22
26
|
let t3;
|
|
23
|
-
if ($[
|
|
27
|
+
if ($[1] !== LinkComponent || $[2] !== disabled || $[3] !== isLinkMode || $[4] !== linkProps || $[5] !== makeClickHandler || $[6] !== makeUrl || $[7] !== navButtonClassName || $[8] !== targetPage) {
|
|
24
28
|
t3 = isLinkMode && makeUrl ? {
|
|
25
29
|
component: LinkComponent,
|
|
26
30
|
href: makeUrl(targetPage),
|
|
@@ -32,18 +36,18 @@ function NavButton(t0) {
|
|
|
32
36
|
onClick: makeClickHandler(targetPage),
|
|
33
37
|
className: navButtonClassName
|
|
34
38
|
};
|
|
35
|
-
$[
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
38
|
-
$[
|
|
39
|
-
$[
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
$[
|
|
44
|
-
} else t3 = $[
|
|
39
|
+
$[1] = LinkComponent;
|
|
40
|
+
$[2] = disabled;
|
|
41
|
+
$[3] = isLinkMode;
|
|
42
|
+
$[4] = linkProps;
|
|
43
|
+
$[5] = makeClickHandler;
|
|
44
|
+
$[6] = makeUrl;
|
|
45
|
+
$[7] = navButtonClassName;
|
|
46
|
+
$[8] = targetPage;
|
|
47
|
+
$[9] = t3;
|
|
48
|
+
} else t3 = $[9];
|
|
45
49
|
let t4;
|
|
46
|
-
if ($[
|
|
50
|
+
if ($[10] !== ariaLabel || $[11] !== size || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
47
51
|
t4 = /* @__PURE__ */ jsx(IconButton, {
|
|
48
52
|
icon: t1,
|
|
49
53
|
size,
|
|
@@ -51,24 +55,28 @@ function NavButton(t0) {
|
|
|
51
55
|
"aria-label": ariaLabel,
|
|
52
56
|
...t3
|
|
53
57
|
});
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
} else t4 = $[
|
|
58
|
+
$[10] = ariaLabel;
|
|
59
|
+
$[11] = size;
|
|
60
|
+
$[12] = t1;
|
|
61
|
+
$[13] = t2;
|
|
62
|
+
$[14] = t3;
|
|
63
|
+
$[15] = t4;
|
|
64
|
+
} else t4 = $[15];
|
|
61
65
|
return t4;
|
|
62
66
|
}
|
|
63
67
|
function PageItem(t0) {
|
|
64
68
|
"use memo";
|
|
65
|
-
const $ = c(
|
|
69
|
+
const $ = c(20);
|
|
70
|
+
if ($[0] !== "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794") {
|
|
71
|
+
for (let $i = 0; $i < 20; $i += 1) $[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
72
|
+
$[0] = "6df9a461da70eeb5250dbca07b72d0ce43e952d7b7d08baba19bf889ba545794";
|
|
73
|
+
}
|
|
66
74
|
const { value } = t0;
|
|
67
75
|
const { page, size, isLinkMode, makeUrl, LinkComponent, makeClickHandler, linkProps } = usePaginationContext();
|
|
68
76
|
const pageItemClassName = useClassNames("charcoal-pagination-button", linkProps?.className);
|
|
69
77
|
if (value === "...") {
|
|
70
78
|
let t1;
|
|
71
|
-
if ($[
|
|
79
|
+
if ($[1] !== size) {
|
|
72
80
|
t1 = /* @__PURE__ */ jsx(IconButton, {
|
|
73
81
|
icon: "24/Dot",
|
|
74
82
|
size,
|
|
@@ -76,69 +84,69 @@ function PageItem(t0) {
|
|
|
76
84
|
className: "charcoal-pagination-spacer",
|
|
77
85
|
"aria-hidden": true
|
|
78
86
|
});
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
} else t1 = $[
|
|
87
|
+
$[1] = size;
|
|
88
|
+
$[2] = t1;
|
|
89
|
+
} else t1 = $[2];
|
|
82
90
|
return t1;
|
|
83
91
|
}
|
|
84
92
|
if (value === page) {
|
|
85
93
|
let t1;
|
|
86
|
-
if ($[
|
|
94
|
+
if ($[3] !== value) {
|
|
87
95
|
t1 = /* @__PURE__ */ jsx("span", {
|
|
88
96
|
className: "charcoal-pagination-button",
|
|
89
97
|
"aria-current": "page",
|
|
90
98
|
children: value
|
|
91
99
|
});
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
} else t1 = $[
|
|
100
|
+
$[3] = value;
|
|
101
|
+
$[4] = t1;
|
|
102
|
+
} else t1 = $[4];
|
|
95
103
|
return t1;
|
|
96
104
|
}
|
|
97
105
|
if (typeof value !== "number") return null;
|
|
98
106
|
if (isLinkMode && makeUrl) {
|
|
99
107
|
let t1;
|
|
100
|
-
if ($[
|
|
108
|
+
if ($[5] !== makeUrl || $[6] !== value) {
|
|
101
109
|
t1 = makeUrl(value);
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
} else t1 = $[
|
|
110
|
+
$[5] = makeUrl;
|
|
111
|
+
$[6] = value;
|
|
112
|
+
$[7] = t1;
|
|
113
|
+
} else t1 = $[7];
|
|
106
114
|
let t2;
|
|
107
|
-
if ($[
|
|
115
|
+
if ($[8] !== LinkComponent || $[9] !== linkProps || $[10] !== pageItemClassName || $[11] !== t1 || $[12] !== value) {
|
|
108
116
|
t2 = /* @__PURE__ */ jsx(LinkComponent, {
|
|
109
117
|
href: t1,
|
|
110
118
|
...linkProps,
|
|
111
119
|
className: pageItemClassName,
|
|
112
120
|
children: value
|
|
113
121
|
});
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
} else t2 = $[
|
|
122
|
+
$[8] = LinkComponent;
|
|
123
|
+
$[9] = linkProps;
|
|
124
|
+
$[10] = pageItemClassName;
|
|
125
|
+
$[11] = t1;
|
|
126
|
+
$[12] = value;
|
|
127
|
+
$[13] = t2;
|
|
128
|
+
} else t2 = $[13];
|
|
121
129
|
return t2;
|
|
122
130
|
}
|
|
123
131
|
let t1;
|
|
124
|
-
if ($[
|
|
132
|
+
if ($[14] !== makeClickHandler || $[15] !== value) {
|
|
125
133
|
t1 = makeClickHandler(value);
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
} else t1 = $[
|
|
134
|
+
$[14] = makeClickHandler;
|
|
135
|
+
$[15] = value;
|
|
136
|
+
$[16] = t1;
|
|
137
|
+
} else t1 = $[16];
|
|
130
138
|
let t2;
|
|
131
|
-
if ($[
|
|
139
|
+
if ($[17] !== t1 || $[18] !== value) {
|
|
132
140
|
t2 = /* @__PURE__ */ jsx("button", {
|
|
133
141
|
type: "button",
|
|
134
142
|
className: "charcoal-pagination-button",
|
|
135
143
|
onClick: t1,
|
|
136
144
|
children: value
|
|
137
145
|
});
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
} else t2 = $[
|
|
146
|
+
$[17] = t1;
|
|
147
|
+
$[18] = value;
|
|
148
|
+
$[19] = t2;
|
|
149
|
+
} else t2 = $[19];
|
|
142
150
|
return t2;
|
|
143
151
|
}
|
|
144
152
|
function Pagination({ page, pageCount, pageRangeDisplayed, size = "M", onChange, makeUrl, component: LinkComponent = "a", linkProps, className, ariaLabelNext = "Next", ariaLabelPrev = "Previous", ...navProps }) {
|