@bioturing/components 0.44.0 → 0.44.1
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/ds-root/component.d.ts.map +1 -1
- package/dist/components/ds-root/component.js +16 -14
- package/dist/components/ds-root/component.js.map +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/notification/NotificationProvider.d.ts +6 -0
- package/dist/components/notification/NotificationProvider.d.ts.map +1 -0
- package/dist/components/notification/NotificationProvider.js +67 -0
- package/dist/components/notification/NotificationProvider.js.map +1 -0
- package/dist/components/notification/NotificationService.d.ts +35 -0
- package/dist/components/notification/NotificationService.d.ts.map +1 -0
- package/dist/components/notification/NotificationService.js +26 -0
- package/dist/components/notification/NotificationService.js.map +1 -0
- package/dist/components/notification/functions.d.ts +11 -0
- package/dist/components/notification/functions.d.ts.map +1 -0
- package/dist/components/notification/functions.js +38 -0
- package/dist/components/notification/functions.js.map +1 -0
- package/dist/components/notification/index.d.ts +11 -0
- package/dist/components/notification/index.d.ts.map +1 -0
- package/dist/components/notification/index.js +27 -0
- package/dist/components/notification/index.js.map +1 -0
- package/dist/components/notification/style.css +1 -0
- package/dist/components/notification/themedNotificationConfig.d.ts +5 -0
- package/dist/components/notification/themedNotificationConfig.d.ts.map +1 -0
- package/dist/components/notification/themedNotificationConfig.js +34 -0
- package/dist/components/notification/themedNotificationConfig.js.map +1 -0
- package/dist/components/notification/useNotification.d.ts +3 -0
- package/dist/components/notification/useNotification.d.ts.map +1 -0
- package/dist/components/notification/useNotification.js +25 -0
- package/dist/components/notification/useNotification.js.map +1 -0
- package/dist/components/tour/style.css +1 -1
- package/dist/index.js +267 -255
- package/dist/index.js.map +1 -1
- package/dist/metadata.d.ts +9 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +13 -0
- package/dist/metadata.js.map +1 -1
- package/dist/stats.html +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/ds-root/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/ds-root/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAS,KAAK,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAM1D,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,WAAY,SAAQ,kBAAkB;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAEvC;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC;AAED,eAAO,MAAM,MAAM,GAAI,+EAOpB,WAAW,4CAcb,CAAC"}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as
|
|
2
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
3
3
|
import { ThemeProvider as d } from "../theme-provider/component.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { NotificationProvider as f } from "../notification/NotificationProvider.js";
|
|
5
|
+
import './style.css';import '../notification/style.css';/* empty css */
|
|
6
|
+
import { Modal as n } from "../modal/index.js";
|
|
7
|
+
import h from "antd/es/app/App";
|
|
8
|
+
/* empty css */
|
|
7
9
|
import { Toast as o } from "../toast/component.js";
|
|
8
|
-
import { useCls as
|
|
9
|
-
import { clsx as
|
|
10
|
-
const
|
|
11
|
-
className:
|
|
10
|
+
import { useCls as a } from "../utils/antdUtils.js";
|
|
11
|
+
import { clsx as v } from "../utils/cn.js";
|
|
12
|
+
const M = ({
|
|
13
|
+
className: i,
|
|
12
14
|
appendClassesTo: t = "html",
|
|
13
|
-
toastProviderProps:
|
|
15
|
+
toastProviderProps: m,
|
|
14
16
|
children: e,
|
|
15
17
|
theme: s,
|
|
16
18
|
...p
|
|
17
19
|
}) => {
|
|
18
|
-
const
|
|
19
|
-
return /* @__PURE__ */ r(d, { theme: s, ...p, appendClassesTo: t, children: /* @__PURE__ */ r(o.Provider, { ...
|
|
20
|
+
const c = a();
|
|
21
|
+
return /* @__PURE__ */ r(d, { theme: s, ...p, appendClassesTo: t, children: /* @__PURE__ */ r(f, { children: /* @__PURE__ */ r(o.Provider, { ...m, children: /* @__PURE__ */ l(n.Provider, { children: [
|
|
20
22
|
/* @__PURE__ */ r(o.List, {}),
|
|
21
|
-
/* @__PURE__ */ r(
|
|
22
|
-
] }) }) });
|
|
23
|
+
/* @__PURE__ */ r(h, { className: v(c("root"), i), children: e })
|
|
24
|
+
] }) }) }) });
|
|
23
25
|
};
|
|
24
26
|
export {
|
|
25
|
-
|
|
27
|
+
M as DSRoot
|
|
26
28
|
};
|
|
27
29
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/ds-root/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../theme-provider/component\";\nimport { Toast, type ToastProviderProps } from \"../toast\";\nimport { Modal } from \"../modal\";\nimport App from \"antd/es/app/App\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n\n /**\n * Props forwarded to `Toast.Provider`\n */\n toastProviderProps?: ToastProviderProps;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n toastProviderProps,\n children,\n theme,\n ...props\n}: DSRootProps) => {\n const cls = useCls();\n return (\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <Toast.Provider {...toastProviderProps}>\n
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/ds-root/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n ThemeProvider,\n type ThemeProviderProps,\n} from \"../theme-provider/component\";\nimport { NotificationProvider } from \"../notification\";\nimport { Toast, type ToastProviderProps } from \"../toast\";\nimport { Modal } from \"../modal\";\nimport App from \"antd/es/app/App\";\nimport { useCls, clsx } from \"../utils\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\nexport interface DSRootProps extends ThemeProviderProps {\n /**\n * Classname passed to App component\n */\n className?: string;\n\n /**\n * Element to which the theme classes are appended\n * @default \"html\"\n */\n appendClassesTo?: string | HTMLElement;\n\n /**\n * Props forwarded to `Toast.Provider`\n */\n toastProviderProps?: ToastProviderProps;\n}\n\nexport const DSRoot = ({\n className,\n appendClassesTo = \"html\",\n toastProviderProps,\n children,\n theme,\n ...props\n}: DSRootProps) => {\n const cls = useCls();\n return (\n <ThemeProvider theme={theme} {...props} appendClassesTo={appendClassesTo}>\n <NotificationProvider>\n <Toast.Provider {...toastProviderProps}>\n <Modal.Provider>\n <Toast.List />\n <App className={clsx(cls(\"root\"), className)}>{children}</App>\n </Modal.Provider>\n </Toast.Provider>\n </NotificationProvider>\n </ThemeProvider>\n );\n};\n"],"names":["DSRoot","className","appendClassesTo","toastProviderProps","children","theme","props","cls","useCls","ThemeProvider","jsx","NotificationProvider","Toast","jsxs","Modal","App","clsx"],"mappings":";;;;;;;;;;;AAgCO,MAAMA,IAAS,CAAC;AAAA,EACrB,WAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,oBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,MAAmB;AACjB,QAAMC,IAAMC,EAAA;AACZ,2BACGC,GAAA,EAAc,OAAAJ,GAAe,GAAGC,GAAO,iBAAAJ,GACtC,UAAA,gBAAAQ,EAACC,GAAA,EACC,UAAA,gBAAAD,EAACE,EAAM,UAAN,EAAgB,GAAGT,GAClB,UAAA,gBAAAU,EAACC,EAAM,UAAN,EACC,UAAA;AAAA,IAAA,gBAAAJ,EAACE,EAAM,MAAN,EAAW;AAAA,IACZ,gBAAAF,EAACK,KAAI,WAAWC,EAAKT,EAAI,MAAM,GAAGN,CAAS,GAAI,UAAAG,EAAA,CAAS;AAAA,EAAA,GAC1D,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { Affix, Anchor, App, AutoComplete, Avatar, BackTop, Calendar, Card, Carousel, Cascader, Col, ColorPicker, ConfigProvider, DatePicker, Descriptions, Divider, Drawer, Dropdown, Flex, FloatButton, Grid, InputNumber, Layout, List, Mentions, Menu, message,
|
|
1
|
+
export { Affix, Anchor, App, AutoComplete, Avatar, BackTop, Calendar, Card, Carousel, Cascader, Col, ColorPicker, ConfigProvider, DatePicker, Descriptions, Divider, Drawer, Dropdown, Flex, FloatButton, Grid, InputNumber, Layout, List, Mentions, Menu, message, Pagination, Popconfirm, Progress, QRCode, Rate, Result, Row, Skeleton, Space, Statistic, Steps, Tabs, theme, TimePicker, Timeline, Transfer, TreeSelect, Typography, version, Watermark, unstableSetRender, } from 'antd';
|
|
2
2
|
export type { AffixProps, AffixRef, AnchorLinkProps, AnchorProps, AppProps, AutoCompleteProps, AvatarProps, BackTopProps, CalendarMode, CalendarProps, CardProps, CarouselProps, CascaderProps, CascaderAutoProps, CascaderPanelProps, CascaderPanelAutoProps, CheckboxChangeEvent, CheckboxOptionType, CheckboxRef, ColProps, ColorPickerProps, ConfigProviderProps, ThemeConfig, DatePickerProps, DescriptionsProps, DividerProps, DrawerProps, DropDownProps, DropdownProps, FlexProps, FloatButtonGroupProps, FloatButtonProps, FloatButtonRef, FormInstance, FormListFieldData, FormListOperation, FormProps, InputNumberProps, LayoutProps, SiderProps, ListProps, MentionProps, MentionsProps, MenuItemProps, MenuProps, MenuRef, MenuTheme, SubMenuProps, MessageArgsProps, ModalFuncProps, NotificationArgsProps, PaginationProps, PopconfirmProps, ProgressProps, QRCodeProps, QRPropsCanvas, QRPropsSvg, RateProps, ResultProps, RowProps, RefSelectProps, SkeletonProps, SliderSingleProps, SpaceProps, CountdownProps, StatisticProps, StepProps, StepsProps, TableColumnGroupType, TableColumnProps, TableColumnType, TableColumnsType, TablePaginationConfig, TabPaneProps, TabsProps, TagType, GlobalToken, MappingAlgorithm, TimePickerProps, TimeRangePickerProps, TimelineItemProps, TimelineProps, TransferProps, TreeSelectProps, TypographyProps, UploadFile, WatermarkProps, } from 'antd';
|
|
3
3
|
export * from './select/index';
|
|
4
4
|
export * from './modal/index';
|
|
5
|
+
export * from './notification/index';
|
|
5
6
|
export * from './dialog/index';
|
|
6
7
|
export * from './icon-button/index';
|
|
7
8
|
export * from './switch/component';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EAEL,MAAM,EACN,GAAG,EACH,YAAY,EACZ,MAAM,EACN,OAAO,EAIP,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,QAAQ,EAER,GAAG,EAEH,WAAW,EACX,cAAc,EACd,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,QAAQ,EAER,IAAI,EACJ,WAAW,EAEX,IAAI,EAGJ,WAAW,EACX,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EAEP,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface NotificationProviderProps {
|
|
3
|
+
children?: ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const NotificationProvider: ({ children, }: NotificationProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=NotificationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationProvider.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAU1D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,eAAO,MAAM,oBAAoB,GAAI,eAElC,yBAAyB,4CAkF3B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as u, Fragment as y } from "react/jsx-runtime";
|
|
3
|
+
import m from "antd/es/notification";
|
|
4
|
+
import { useRef as s, useEffect as b } from "react";
|
|
5
|
+
import { notificationManager as k } from "./NotificationService.js";
|
|
6
|
+
import { createThemedNotificationConfig as g } from "./themedNotificationConfig.js";
|
|
7
|
+
import { useCls as x } from "../utils/antdUtils.js";
|
|
8
|
+
const j = ({
|
|
9
|
+
children: f
|
|
10
|
+
}) => {
|
|
11
|
+
const n = x(), [i, l] = m.useNotification(), p = s(
|
|
12
|
+
/* @__PURE__ */ new Map()
|
|
13
|
+
), a = s({});
|
|
14
|
+
return b(() => k.subscribe((o) => {
|
|
15
|
+
const e = p.current, c = (t) => {
|
|
16
|
+
const r = t.key;
|
|
17
|
+
if (r == null)
|
|
18
|
+
return;
|
|
19
|
+
e.set(r, t);
|
|
20
|
+
const d = g(
|
|
21
|
+
n,
|
|
22
|
+
t,
|
|
23
|
+
a.current,
|
|
24
|
+
() => {
|
|
25
|
+
e.delete(r);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
i.open(d);
|
|
29
|
+
};
|
|
30
|
+
switch (o.type) {
|
|
31
|
+
case "add":
|
|
32
|
+
c(o.payload);
|
|
33
|
+
break;
|
|
34
|
+
case "update": {
|
|
35
|
+
const t = e.get(o.payload.key);
|
|
36
|
+
if (!t)
|
|
37
|
+
return;
|
|
38
|
+
const r = typeof o.payload.config == "function" ? o.payload.config(t) : { ...t, ...o.payload.config };
|
|
39
|
+
c({
|
|
40
|
+
...t,
|
|
41
|
+
...r,
|
|
42
|
+
key: o.payload.key
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "config":
|
|
47
|
+
a.current = {
|
|
48
|
+
...a.current,
|
|
49
|
+
...o.payload
|
|
50
|
+
};
|
|
51
|
+
break;
|
|
52
|
+
case "destroy":
|
|
53
|
+
e.delete(o.payload.key), i.destroy(o.payload.key);
|
|
54
|
+
break;
|
|
55
|
+
case "destroyAll":
|
|
56
|
+
e.clear(), i.destroy();
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}), [i, n]), /* @__PURE__ */ u(y, { children: [
|
|
60
|
+
l,
|
|
61
|
+
f
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
j as NotificationProvider
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=NotificationProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationProvider.js","sources":["../../../src/components/notification/NotificationProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport type { GlobalConfigProps } from \"antd/es/notification/interface\";\nimport AntNotification from \"antd/es/notification\";\nimport { type ReactNode, useEffect, useRef } from \"react\";\nimport {\n notificationManager,\n type NotificationConfig,\n type NotificationEvent,\n type NotificationFuncProps,\n} from \"./NotificationService\";\nimport { createThemedNotificationConfig } from \"./themedNotificationConfig\";\nimport { useCls } from \"../utils\";\n\nexport interface NotificationProviderProps {\n children?: ReactNode;\n}\n\nexport const NotificationProvider = ({\n children,\n}: NotificationProviderProps) => {\n const cls = useCls();\n const [api, contextHolder] = AntNotification.useNotification();\n const notificationsRef = useRef(\n new Map<NonNullable<NotificationFuncProps[\"key\"]>, NotificationConfig>()\n );\n const globalConfigRef = useRef<GlobalConfigProps>({});\n\n useEffect(() => {\n const unsubscribe = notificationManager.subscribe((event: NotificationEvent) => {\n const notifications = notificationsRef.current;\n\n const openNotification = (config: NotificationConfig) => {\n const notificationKey = config.key;\n if (notificationKey == null) {\n return;\n }\n\n notifications.set(notificationKey, config);\n\n const nextConfig = createThemedNotificationConfig(\n cls,\n config,\n globalConfigRef.current,\n () => {\n notifications.delete(notificationKey);\n }\n );\n\n api.open(nextConfig);\n };\n\n switch (event.type) {\n case \"add\":\n openNotification(event.payload);\n break;\n case \"update\": {\n const current = notifications.get(event.payload.key);\n if (!current) {\n return;\n }\n\n const nextConfig =\n typeof event.payload.config === \"function\"\n ? event.payload.config(current)\n : { ...current, ...event.payload.config };\n\n openNotification({\n ...current,\n ...nextConfig,\n key: event.payload.key,\n });\n break;\n }\n case \"config\":\n globalConfigRef.current = {\n ...globalConfigRef.current,\n ...event.payload,\n };\n break;\n case \"destroy\":\n notifications.delete(event.payload.key);\n api.destroy(event.payload.key);\n break;\n case \"destroyAll\":\n notifications.clear();\n api.destroy();\n break;\n default:\n break;\n }\n });\n\n return unsubscribe;\n }, [api, cls]);\n\n return (\n <>\n {contextHolder}\n {children}\n </>\n );\n};\n"],"names":["NotificationProvider","children","cls","useCls","api","contextHolder","AntNotification","notificationsRef","useRef","globalConfigRef","useEffect","notificationManager","event","notifications","openNotification","config","notificationKey","nextConfig","createThemedNotificationConfig","current","jsxs","Fragment"],"mappings":";;;;;;;AAkBO,MAAMA,IAAuB,CAAC;AAAA,EACnC,UAAAC;AACF,MAAiC;AAC/B,QAAMC,IAAMC,EAAA,GACN,CAACC,GAAKC,CAAa,IAAIC,EAAgB,gBAAA,GACvCC,IAAmBC;AAAA,wBACnB,IAAA;AAAA,EAAmE,GAEnEC,IAAkBD,EAA0B,EAAE;AAEpD,SAAAE,EAAU,MACYC,EAAoB,UAAU,CAACC,MAA6B;AAC9E,UAAMC,IAAgBN,EAAiB,SAEjCO,IAAmB,CAACC,MAA+B;AACvD,YAAMC,IAAkBD,EAAO;AAC/B,UAAIC,KAAmB;AACrB;AAGF,MAAAH,EAAc,IAAIG,GAAiBD,CAAM;AAEzC,YAAME,IAAaC;AAAA,QACjBhB;AAAA,QACAa;AAAA,QACAN,EAAgB;AAAA,QAChB,MAAM;AACJ,UAAAI,EAAc,OAAOG,CAAe;AAAA,QACtC;AAAA,MAAA;AAGF,MAAAZ,EAAI,KAAKa,CAAU;AAAA,IACrB;AAEA,YAAQL,EAAM,MAAA;AAAA,MACZ,KAAK;AACH,QAAAE,EAAiBF,EAAM,OAAO;AAC9B;AAAA,MACF,KAAK,UAAU;AACb,cAAMO,IAAUN,EAAc,IAAID,EAAM,QAAQ,GAAG;AACnD,YAAI,CAACO;AACH;AAGF,cAAMF,IACJ,OAAOL,EAAM,QAAQ,UAAW,aAC5BA,EAAM,QAAQ,OAAOO,CAAO,IAC5B,EAAE,GAAGA,GAAS,GAAGP,EAAM,QAAQ,OAAA;AAErC,QAAAE,EAAiB;AAAA,UACf,GAAGK;AAAA,UACH,GAAGF;AAAA,UACH,KAAKL,EAAM,QAAQ;AAAA,QAAA,CACpB;AACD;AAAA,MACF;AAAA,MACA,KAAK;AACH,QAAAH,EAAgB,UAAU;AAAA,UACxB,GAAGA,EAAgB;AAAA,UACnB,GAAGG,EAAM;AAAA,QAAA;AAEX;AAAA,MACF,KAAK;AACH,QAAAC,EAAc,OAAOD,EAAM,QAAQ,GAAG,GACtCR,EAAI,QAAQQ,EAAM,QAAQ,GAAG;AAC7B;AAAA,MACF,KAAK;AACH,QAAAC,EAAc,MAAA,GACdT,EAAI,QAAA;AACJ;AAAA,IAEA;AAAA,EAEN,CAAC,GAGA,CAACA,GAAKF,CAAG,CAAC,GAGX,gBAAAkB,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAhB;AAAA,IACAJ;AAAA,EAAA,GACH;AAEJ;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GlobalConfigProps, NotificationInstance } from 'antd/es/notification/interface';
|
|
2
|
+
export type NotificationFuncProps = Parameters<NotificationInstance["open"]>[0];
|
|
3
|
+
export type NotificationConfig = NotificationFuncProps;
|
|
4
|
+
export type NotificationUpdateConfig = Partial<NotificationFuncProps> | ((prev: NotificationFuncProps) => NotificationFuncProps);
|
|
5
|
+
export type NotificationEvent = {
|
|
6
|
+
type: "add";
|
|
7
|
+
payload: NotificationConfig;
|
|
8
|
+
} | {
|
|
9
|
+
type: "update";
|
|
10
|
+
payload: {
|
|
11
|
+
key: NonNullable<NotificationFuncProps["key"]>;
|
|
12
|
+
config: NotificationUpdateConfig;
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: "config";
|
|
16
|
+
payload: GlobalConfigProps;
|
|
17
|
+
} | {
|
|
18
|
+
type: "destroy";
|
|
19
|
+
payload: {
|
|
20
|
+
key: NonNullable<NotificationFuncProps["key"]>;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
type: "destroyAll";
|
|
24
|
+
};
|
|
25
|
+
type Listener = (event: NotificationEvent) => void;
|
|
26
|
+
declare class NotificationManager {
|
|
27
|
+
private listeners;
|
|
28
|
+
private counter;
|
|
29
|
+
subscribe(listener: Listener): () => void;
|
|
30
|
+
emit(event: NotificationEvent): void;
|
|
31
|
+
generateId(): string;
|
|
32
|
+
}
|
|
33
|
+
export declare const notificationManager: NotificationManager;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=NotificationService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../../src/components/notification/NotificationService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAE9F,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEvD,MAAM,MAAM,wBAAwB,GAChC,OAAO,CAAC,qBAAqB,CAAC,GAC9B,CAAC,CAAC,IAAI,EAAE,qBAAqB,KAAK,qBAAqB,CAAC,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,kBAAkB,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE;QAAE,GAAG,EAAE,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;QAAC,MAAM,EAAE,wBAAwB,CAAA;KAAE,CAAA;CAAE,GACjH;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE;QAAE,GAAG,EAAE,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;KAAE,CAAA;CAAE,GAChF;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAE3B,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAEnD,cAAM,mBAAmB;IACvB,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAAK;IAEpB,SAAS,CAAC,QAAQ,EAAE,QAAQ;IAO5B,IAAI,CAAC,KAAK,EAAE,iBAAiB;IAU7B,UAAU;CAIX;AAED,eAAO,MAAM,mBAAmB,qBAA4B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
class i {
|
|
2
|
+
listeners = [];
|
|
3
|
+
counter = 0;
|
|
4
|
+
subscribe(t) {
|
|
5
|
+
return this.listeners.push(t), () => {
|
|
6
|
+
this.listeners = this.listeners.filter((e) => e !== t);
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
emit(t) {
|
|
10
|
+
this.listeners.forEach((e) => {
|
|
11
|
+
try {
|
|
12
|
+
e(t);
|
|
13
|
+
} catch (r) {
|
|
14
|
+
console.error("[notification] listener error", r);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
generateId() {
|
|
19
|
+
return this.counter += 1, `notification_${this.counter}_${Date.now()}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const s = new i();
|
|
23
|
+
export {
|
|
24
|
+
s as notificationManager
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=NotificationService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationService.js","sources":["../../../src/components/notification/NotificationService.ts"],"sourcesContent":["import type { GlobalConfigProps, NotificationInstance } from \"antd/es/notification/interface\";\n\nexport type NotificationFuncProps = Parameters<NotificationInstance[\"open\"]>[0];\n\nexport type NotificationConfig = NotificationFuncProps;\n\nexport type NotificationUpdateConfig =\n | Partial<NotificationFuncProps>\n | ((prev: NotificationFuncProps) => NotificationFuncProps);\n\nexport type NotificationEvent =\n | { type: \"add\"; payload: NotificationConfig }\n | { type: \"update\"; payload: { key: NonNullable<NotificationFuncProps[\"key\"]>; config: NotificationUpdateConfig } }\n | { type: \"config\"; payload: GlobalConfigProps }\n | { type: \"destroy\"; payload: { key: NonNullable<NotificationFuncProps[\"key\"]> } }\n | { type: \"destroyAll\" };\n\ntype Listener = (event: NotificationEvent) => void;\n\nclass NotificationManager {\n private listeners: Listener[] = [];\n private counter = 0;\n\n subscribe(listener: Listener) {\n this.listeners.push(listener);\n return () => {\n this.listeners = this.listeners.filter((item) => item !== listener);\n };\n }\n\n emit(event: NotificationEvent) {\n this.listeners.forEach((listener) => {\n try {\n listener(event);\n } catch (error) {\n console.error(\"[notification] listener error\", error);\n }\n });\n }\n\n generateId() {\n this.counter += 1;\n return `notification_${this.counter}_${Date.now()}`;\n }\n}\n\nexport const notificationManager = new NotificationManager();\n"],"names":["NotificationManager","listener","item","event","error","notificationManager"],"mappings":"AAmBA,MAAMA,EAAoB;AAAA,EAChB,YAAwB,CAAA;AAAA,EACxB,UAAU;AAAA,EAElB,UAAUC,GAAoB;AAC5B,gBAAK,UAAU,KAAKA,CAAQ,GACrB,MAAM;AACX,WAAK,YAAY,KAAK,UAAU,OAAO,CAACC,MAASA,MAASD,CAAQ;AAAA,IACpE;AAAA,EACF;AAAA,EAEA,KAAKE,GAA0B;AAC7B,SAAK,UAAU,QAAQ,CAACF,MAAa;AACnC,UAAI;AACF,QAAAA,EAASE,CAAK;AAAA,MAChB,SAASC,GAAO;AACd,gBAAQ,MAAM,iCAAiCA,CAAK;AAAA,MACtD;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,aAAa;AACX,gBAAK,WAAW,GACT,gBAAgB,KAAK,OAAO,IAAI,KAAK,KAAK;AAAA,EACnD;AACF;AAEO,MAAMC,IAAsB,IAAIL,EAAA;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GlobalConfigProps, NotificationInstance } from 'antd/es/notification/interface';
|
|
2
|
+
type NotificationStaticMethod = NotificationInstance["open"];
|
|
3
|
+
export declare const open: NotificationStaticMethod;
|
|
4
|
+
export declare const success: NotificationStaticMethod;
|
|
5
|
+
export declare const info: NotificationStaticMethod;
|
|
6
|
+
export declare const warning: NotificationStaticMethod;
|
|
7
|
+
export declare const error: NotificationStaticMethod;
|
|
8
|
+
export declare const config: (nextConfig: GlobalConfigProps) => void;
|
|
9
|
+
export declare const destroy: NotificationInstance["destroy"];
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.d.ts","sourceRoot":"","sources":["../../../src/components/notification/functions.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,iBAAiB,EAEjB,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAMxC,KAAK,wBAAwB,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAkB7D,eAAO,MAAM,IAAI,EAAE,wBAAiE,CAAC;AAErF,eAAO,MAAM,OAAO,EAAE,wBACiB,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,wBACiB,CAAC;AAErC,eAAO,MAAM,OAAO,EAAE,wBACiB,CAAC;AAExC,eAAO,MAAM,KAAK,EAAE,wBACiB,CAAC;AAEtC,eAAO,MAAM,MAAM,GAAI,YAAY,iBAAiB,SAKnD,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,oBAAoB,CAAC,SAAS,CAUnD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { notificationManager as t } from "./NotificationService.js";
|
|
3
|
+
function e(o, n) {
|
|
4
|
+
const i = o.key ?? t.generateId();
|
|
5
|
+
t.emit({
|
|
6
|
+
type: "add",
|
|
7
|
+
payload: {
|
|
8
|
+
...o,
|
|
9
|
+
key: i,
|
|
10
|
+
...n ? { type: n } : {}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
const c = (o) => e(o), s = (o) => e(o, "success"), a = (o) => e(o, "info"), d = (o) => e(o, "warning"), y = (o) => e(o, "error"), p = (o) => {
|
|
15
|
+
t.emit({
|
|
16
|
+
type: "config",
|
|
17
|
+
payload: o
|
|
18
|
+
});
|
|
19
|
+
}, f = (o) => {
|
|
20
|
+
if (o !== void 0) {
|
|
21
|
+
t.emit({
|
|
22
|
+
type: "destroy",
|
|
23
|
+
payload: { key: o }
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
t.emit({ type: "destroyAll" });
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
p as config,
|
|
31
|
+
f as destroy,
|
|
32
|
+
y as error,
|
|
33
|
+
a as info,
|
|
34
|
+
c as open,
|
|
35
|
+
s as success,
|
|
36
|
+
d as warning
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.js","sources":["../../../src/components/notification/functions.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n GlobalConfigProps,\n IconType,\n NotificationInstance,\n} from \"antd/es/notification/interface\";\nimport {\n notificationManager,\n type NotificationFuncProps,\n} from \"./NotificationService\";\n\ntype NotificationStaticMethod = NotificationInstance[\"open\"];\n\nfunction createNotification(\n config: NotificationFuncProps,\n type?: IconType\n): void {\n const key = config.key ?? notificationManager.generateId();\n\n notificationManager.emit({\n type: \"add\",\n payload: {\n ...config,\n key,\n ...(type ? { type } : {}),\n },\n });\n}\n\nexport const open: NotificationStaticMethod = (config) => createNotification(config);\n\nexport const success: NotificationStaticMethod = (config) =>\n createNotification(config, \"success\");\n\nexport const info: NotificationStaticMethod = (config) =>\n createNotification(config, \"info\");\n\nexport const warning: NotificationStaticMethod = (config) =>\n createNotification(config, \"warning\");\n\nexport const error: NotificationStaticMethod = (config) =>\n createNotification(config, \"error\");\n\nexport const config = (nextConfig: GlobalConfigProps) => {\n notificationManager.emit({\n type: \"config\",\n payload: nextConfig,\n });\n};\n\nexport const destroy: NotificationInstance[\"destroy\"] = (key) => {\n if (key !== undefined) {\n notificationManager.emit({\n type: \"destroy\",\n payload: { key },\n });\n return;\n }\n\n notificationManager.emit({ type: \"destroyAll\" });\n};\n"],"names":["createNotification","config","type","key","notificationManager","open","success","info","warning","error","nextConfig","destroy"],"mappings":";;AAcA,SAASA,EACPC,GACAC,GACM;AACN,QAAMC,IAAMF,EAAO,OAAOG,EAAoB,WAAA;AAE9C,EAAAA,EAAoB,KAAK;AAAA,IACvB,MAAM;AAAA,IACN,SAAS;AAAA,MACP,GAAGH;AAAAA,MACH,KAAAE;AAAA,MACA,GAAID,IAAO,EAAE,MAAAA,MAAS,CAAA;AAAA,IAAC;AAAA,EACzB,CACD;AACH;AAEO,MAAMG,IAAiC,CAACJ,MAAWD,EAAmBC,CAAM,GAEtEK,IAAoC,CAACL,MAChDD,EAAmBC,GAAQ,SAAS,GAEzBM,IAAiC,CAACN,MAC7CD,EAAmBC,GAAQ,MAAM,GAEtBO,IAAoC,CAACP,MAChDD,EAAmBC,GAAQ,SAAS,GAEzBQ,IAAkC,CAACR,MAC9CD,EAAmBC,GAAQ,OAAO,GAEvBA,IAAS,CAACS,MAAkC;AACvD,EAAAN,EAAoB,KAAK;AAAA,IACvB,MAAM;AAAA,IACN,SAASM;AAAA,EAAA,CACV;AACH,GAEaC,IAA2C,CAACR,MAAQ;AAC/D,MAAIA,MAAQ,QAAW;AACrB,IAAAC,EAAoB,KAAK;AAAA,MACvB,MAAM;AAAA,MACN,SAAS,EAAE,KAAAD,EAAA;AAAA,IAAI,CAChB;AACD;AAAA,EACF;AAEA,EAAAC,EAAoB,KAAK,EAAE,MAAM,aAAA,CAAc;AACjD;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as AntNotification } from 'antd/es/notification';
|
|
2
|
+
import { NotificationProvider, NotificationProviderProps } from './NotificationProvider';
|
|
3
|
+
import { destroy, error, info, open, success, warning } from './functions';
|
|
4
|
+
import { NotificationFuncProps } from './NotificationService';
|
|
5
|
+
import { useNotification } from './useNotification';
|
|
6
|
+
type AntNotificationStatic = typeof AntNotification;
|
|
7
|
+
export declare const notification: AntNotificationStatic;
|
|
8
|
+
export type NotificationUtility = typeof notification;
|
|
9
|
+
export { NotificationProvider, destroy as destroyNotification, error as errorNotification, info as infoNotification, open as openNotification, success as successNotification, useNotification, warning as warningNotification, };
|
|
10
|
+
export type { NotificationFuncProps, NotificationProviderProps };
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/notification/index.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,EACL,oBAAoB,EACpB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,OAAO,EACP,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,EACR,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,aAAa,CAAC;AAErB,KAAK,qBAAqB,GAAG,OAAO,eAAe,CAAC;AAEpD,eAAO,MAAM,YAAY,EAAE,qBAW1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,OAAO,YAAY,CAAC;AAEtD,OAAO,EACL,oBAAoB,EACpB,OAAO,IAAI,mBAAmB,EAC9B,KAAK,IAAI,iBAAiB,EAC1B,IAAI,IAAI,gBAAgB,EACxB,IAAI,IAAI,gBAAgB,EACxB,OAAO,IAAI,mBAAmB,EAC9B,eAAe,EACf,OAAO,IAAI,mBAAmB,GAC/B,CAAC;AAEF,YAAY,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import o from "antd/es/notification";
|
|
3
|
+
import { destroy as i, config as t, error as n, warning as r, info as e, success as a, open as s } from "./functions.js";
|
|
4
|
+
import { useNotification as c } from "./useNotification.js";
|
|
5
|
+
import './style.css';/* empty css */
|
|
6
|
+
const p = {
|
|
7
|
+
useNotification: c,
|
|
8
|
+
_InternalPanelDoNotUseOrYouWillBeFired: o._InternalPanelDoNotUseOrYouWillBeFired,
|
|
9
|
+
open: s,
|
|
10
|
+
success: a,
|
|
11
|
+
info: e,
|
|
12
|
+
warning: r,
|
|
13
|
+
error: n,
|
|
14
|
+
config: t,
|
|
15
|
+
destroy: i
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
i as destroyNotification,
|
|
19
|
+
n as errorNotification,
|
|
20
|
+
e as infoNotification,
|
|
21
|
+
p as notification,
|
|
22
|
+
s as openNotification,
|
|
23
|
+
a as successNotification,
|
|
24
|
+
c as useNotification,
|
|
25
|
+
r as warningNotification
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/notification/index.ts"],"sourcesContent":["\"use client\";\n\nimport AntNotification from \"antd/es/notification\";\nimport {\n NotificationProvider,\n type NotificationProviderProps,\n} from \"./NotificationProvider\";\nimport {\n config,\n destroy,\n error,\n info,\n open,\n success,\n warning,\n} from \"./functions\";\nimport type { NotificationFuncProps } from \"./NotificationService\";\nimport { useNotification } from \"./useNotification\";\n\nimport \"./style.css\";\n\ntype AntNotificationStatic = typeof AntNotification;\n\nexport const notification: AntNotificationStatic = {\n useNotification,\n _InternalPanelDoNotUseOrYouWillBeFired:\n AntNotification._InternalPanelDoNotUseOrYouWillBeFired,\n open,\n success,\n info,\n warning,\n error,\n config,\n destroy,\n};\n\nexport type NotificationUtility = typeof notification;\n\nexport {\n NotificationProvider,\n destroy as destroyNotification,\n error as errorNotification,\n info as infoNotification,\n open as openNotification,\n success as successNotification,\n useNotification,\n warning as warningNotification,\n};\n\nexport type { NotificationFuncProps, NotificationProviderProps };\n"],"names":["notification","useNotification","AntNotification","open","success","info","warning","error","config","destroy"],"mappings":";;;;;AAuBO,MAAMA,IAAsC;AAAA,EACjD,iBAAAC;AAAA,EACA,wCACEC,EAAgB;AAAA,EAClB,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC;AACF;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.ds-notification-notice-wrapper{box-shadow:var(--ds-box-shadow-secondary)}.ds-notification .ds-notification-notice{padding:1rem 1rem 1rem 1.125rem;border-radius:.75rem}.ds-notification .ds-notification-notice-content{align-items:flex-start}.ds-notification .ds-notification-notice-content .ds-notification-notice-message{font-size:var(--ds-font-size-heading-5);line-height:var(--ds-line-height-heading-5);font-weight:500;color:var(--ds-color-text);margin-bottom:0}.ds-notification .ds-notification-has-description .ds-notification-notice-message{font-weight:600}.ds-notification .ds-notification-notice-with-icon .ds-notification-notice-description{font-size:var(--ds-font-size);line-height:var(--ds-line-height);color:var(--ds-color-text-secondary)}.ds-notification .ds-notification-notice-description{color:var(--ds-color-text-secondary);margin-top:.25rem}.ds-notification .ds-notification-notice-description:last-child{margin-bottom:0}.ds-notification .ds-notification-notice-icon{font-size:1.25rem;line-height:1;margin-inline-end:.875rem;margin-top:.125rem;width:1.25rem;height:1.25rem;display:inline-flex;align-items:center;justify-content:center}.ds-notification .ds-notification-notice-close{top:1rem;inset-inline-end:.875rem;display:inline-flex;align-items:center;justify-content:center;color:var(--ds-color-icon);transition:color .2s ease;border-radius:9999px}.ds-notification .ds-notification-notice-close:hover{color:var(--ds-color-icon-hover)}.ds-notification-status-icon{width:1.25rem;height:1.25rem;display:inline-flex;align-items:center;justify-content:center}.ds-notification-status-icon-success{color:var(--ds-color-success)}.ds-notification-status-icon-info{color:var(--ds-color-primary)}.ds-notification-status-icon-warning{color:var(--ds-color-warning)}.ds-notification-status-icon-error{color:var(--ds-color-error)}}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GlobalConfigProps } from 'antd/es/notification/interface';
|
|
2
|
+
import { NotificationConfig, NotificationFuncProps } from './NotificationService';
|
|
3
|
+
import { useCls } from '../utils';
|
|
4
|
+
export declare function createThemedNotificationConfig(cls: ReturnType<typeof useCls>, config: NotificationConfig, globalConfig: GlobalConfigProps, onClose?: () => void): NotificationFuncProps;
|
|
5
|
+
//# sourceMappingURL=themedNotificationConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themedNotificationConfig.d.ts","sourceRoot":"","sources":["../../../src/components/notification/themedNotificationConfig.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAQxE,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAQ,MAAM,EAAE,MAAM,UAAU,CAAC;AAExC,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,EAC9B,MAAM,EAAE,kBAAkB,EAC1B,YAAY,EAAE,iBAAiB,EAC/B,OAAO,CAAC,EAAE,MAAM,IAAI,GACnB,qBAAqB,CA8CvB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
3
|
+
import { XIcon as d, CheckCircleIcon as g, InfoIcon as I, WarningCircleIcon as N, XCircleIcon as u } from "@bioturing/assets";
|
|
4
|
+
import { clsx as w } from "../utils/cn.js";
|
|
5
|
+
function X(n, s, t, a) {
|
|
6
|
+
const {
|
|
7
|
+
className: l,
|
|
8
|
+
closeIcon: r,
|
|
9
|
+
description: c,
|
|
10
|
+
icon: f,
|
|
11
|
+
onClose: m,
|
|
12
|
+
type: o,
|
|
13
|
+
...h
|
|
14
|
+
} = s, p = c != null && c !== !1, e = o ? n("notification-status-icon", `notification-status-icon-${o}`) : void 0, C = o === "success" ? /* @__PURE__ */ i(g, { weight: "fill", className: e }) : o === "info" ? /* @__PURE__ */ i(I, { weight: "fill", className: e }) : o === "warning" ? /* @__PURE__ */ i(N, { weight: "fill", className: e }) : o === "error" ? /* @__PURE__ */ i(u, { weight: "fill", className: e }) : void 0;
|
|
15
|
+
return {
|
|
16
|
+
...t,
|
|
17
|
+
...h,
|
|
18
|
+
description: c,
|
|
19
|
+
className: w(
|
|
20
|
+
n("notification"),
|
|
21
|
+
p && n("notification-has-description"),
|
|
22
|
+
l
|
|
23
|
+
),
|
|
24
|
+
icon: f ?? C,
|
|
25
|
+
closeIcon: r ?? /* @__PURE__ */ i("span", { className: n("notification-close-icon"), children: /* @__PURE__ */ i(d, { size: 16, weight: "bold" }) }),
|
|
26
|
+
onClose: () => {
|
|
27
|
+
a?.(), m?.();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
X as createThemedNotificationConfig
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=themedNotificationConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"themedNotificationConfig.js","sources":["../../../src/components/notification/themedNotificationConfig.tsx"],"sourcesContent":["\"use client\";\n\nimport type { GlobalConfigProps } from \"antd/es/notification/interface\";\nimport {\n CheckCircleIcon,\n InfoIcon,\n WarningCircleIcon,\n XCircleIcon,\n XIcon,\n} from \"@bioturing/assets\";\nimport type {\n NotificationConfig,\n NotificationFuncProps,\n} from \"./NotificationService\";\nimport { clsx, useCls } from \"../utils\";\n\nexport function createThemedNotificationConfig(\n cls: ReturnType<typeof useCls>,\n config: NotificationConfig,\n globalConfig: GlobalConfigProps,\n onClose?: () => void\n): NotificationFuncProps {\n const {\n className,\n closeIcon,\n description,\n icon,\n onClose: handleClose,\n type,\n ...restConfig\n } = config;\n const hasDescription =\n description !== undefined && description !== null && description !== false;\n const iconClassName = type\n ? cls(\"notification-status-icon\", `notification-status-icon-${type}`)\n : undefined;\n const typeIcon =\n type === \"success\" ? (\n <CheckCircleIcon weight=\"fill\" className={iconClassName} />\n ) : type === \"info\" ? (\n <InfoIcon weight=\"fill\" className={iconClassName} />\n ) : type === \"warning\" ? (\n <WarningCircleIcon weight=\"fill\" className={iconClassName} />\n ) : type === \"error\" ? (\n <XCircleIcon weight=\"fill\" className={iconClassName} />\n ) : undefined;\n\n return {\n ...globalConfig,\n ...restConfig,\n description,\n className: clsx(\n cls(\"notification\"),\n hasDescription && cls(\"notification-has-description\"),\n className\n ),\n icon: icon ?? typeIcon,\n closeIcon: closeIcon ?? (\n <span className={cls(\"notification-close-icon\")}>\n <XIcon size={16} weight=\"bold\" />\n </span>\n ),\n onClose: () => {\n onClose?.();\n handleClose?.();\n },\n };\n}\n"],"names":["createThemedNotificationConfig","cls","config","globalConfig","onClose","className","closeIcon","description","icon","handleClose","type","restConfig","hasDescription","iconClassName","typeIcon","jsx","CheckCircleIcon","InfoIcon","WarningCircleIcon","XCircleIcon","clsx","XIcon"],"mappings":";;;;AAgBO,SAASA,EACdC,GACAC,GACAC,GACAC,GACuB;AACvB,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,MAAAC;AAAA,IACA,SAASC;AAAA,IACT,MAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDT,GACEU,IACyBL,KAAgB,QAAQA,MAAgB,IACjEM,IAAgBH,IAClBT,EAAI,4BAA4B,4BAA4BS,CAAI,EAAE,IAClE,QACEI,IACJJ,MAAS,YACP,gBAAAK,EAACC,GAAA,EAAgB,QAAO,QAAO,WAAWH,EAAA,CAAe,IACvDH,MAAS,SACX,gBAAAK,EAACE,GAAA,EAAS,QAAO,QAAO,WAAWJ,EAAA,CAAe,IAChDH,MAAS,YACX,gBAAAK,EAACG,GAAA,EAAkB,QAAO,QAAO,WAAWL,GAAe,IACzDH,MAAS,4BACVS,GAAA,EAAY,QAAO,QAAO,WAAWN,GAAe,IACnD;AAEN,SAAO;AAAA,IACL,GAAGV;AAAA,IACH,GAAGQ;AAAA,IACH,aAAAJ;AAAA,IACA,WAAWa;AAAA,MACTnB,EAAI,cAAc;AAAA,MAClBW,KAAkBX,EAAI,8BAA8B;AAAA,MACpDI;AAAA,IAAA;AAAA,IAEF,MAAMG,KAAQM;AAAA,IACd,WAAWR,KACT,gBAAAS,EAAC,QAAA,EAAK,WAAWd,EAAI,yBAAyB,GAC5C,UAAA,gBAAAc,EAACM,GAAA,EAAM,MAAM,IAAI,QAAO,QAAO,GACjC;AAAA,IAEF,SAAS,MAAM;AACb,MAAAjB,IAAA,GACAK,IAAA;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NotificationConfig as AntNotificationConfig, NotificationInstance } from 'antd/es/notification/interface';
|
|
2
|
+
export declare function useNotification(notificationConfig?: AntNotificationConfig): readonly [NotificationInstance, import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>];
|
|
3
|
+
//# sourceMappingURL=useNotification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotification.d.ts","sourceRoot":"","sources":["../../../src/components/notification/useNotification.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,IAAI,qBAAqB,EAC3C,oBAAoB,EACrB,MAAM,gCAAgC,CAAC;AAKxC,wBAAgB,eAAe,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,+HAoBzE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import s from "antd/es/notification";
|
|
3
|
+
import { useMemo as c } from "react";
|
|
4
|
+
import { createThemedNotificationConfig as p } from "./themedNotificationConfig.js";
|
|
5
|
+
import { useCls as f } from "../utils/antdUtils.js";
|
|
6
|
+
function N(n) {
|
|
7
|
+
const i = f(), [e, r] = s.useNotification(n);
|
|
8
|
+
return [c(() => {
|
|
9
|
+
const t = (o) => {
|
|
10
|
+
e.open(p(i, o, {}));
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
open: t,
|
|
14
|
+
success: (o) => t({ ...o, type: "success" }),
|
|
15
|
+
info: (o) => t({ ...o, type: "info" }),
|
|
16
|
+
warning: (o) => t({ ...o, type: "warning" }),
|
|
17
|
+
error: (o) => t({ ...o, type: "error" }),
|
|
18
|
+
destroy: e.destroy
|
|
19
|
+
};
|
|
20
|
+
}, [e, i]), r];
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
N as useNotification
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotification.js","sources":["../../../src/components/notification/useNotification.ts"],"sourcesContent":["\"use client\";\n\nimport AntNotification from \"antd/es/notification\";\nimport type {\n NotificationConfig as AntNotificationConfig,\n NotificationInstance,\n} from \"antd/es/notification/interface\";\nimport { useMemo } from \"react\";\nimport { createThemedNotificationConfig } from \"./themedNotificationConfig\";\nimport { useCls } from \"../utils\";\n\nexport function useNotification(notificationConfig?: AntNotificationConfig) {\n const cls = useCls();\n const [api, contextHolder] = AntNotification.useNotification(notificationConfig);\n\n const themedApi = useMemo<NotificationInstance>(() => {\n const openNotification: NotificationInstance[\"open\"] = (config) => {\n api.open(createThemedNotificationConfig(cls, config, {}));\n };\n\n return {\n open: openNotification,\n success: (config) => openNotification({ ...config, type: \"success\" }),\n info: (config) => openNotification({ ...config, type: \"info\" }),\n warning: (config) => openNotification({ ...config, type: \"warning\" }),\n error: (config) => openNotification({ ...config, type: \"error\" }),\n destroy: api.destroy,\n };\n }, [api, cls]);\n\n return [themedApi, contextHolder] as const;\n}\n"],"names":["useNotification","notificationConfig","cls","useCls","api","contextHolder","AntNotification","useMemo","openNotification","config","createThemedNotificationConfig"],"mappings":";;;;;AAWO,SAASA,EAAgBC,GAA4C;AAC1E,QAAMC,IAAMC,EAAA,GACN,CAACC,GAAKC,CAAa,IAAIC,EAAgB,gBAAgBL,CAAkB;AAiB/E,SAAO,CAfWM,EAA8B,MAAM;AACpD,UAAMC,IAAiD,CAACC,MAAW;AACjE,MAAAL,EAAI,KAAKM,EAA+BR,GAAKO,GAAQ,CAAA,CAAE,CAAC;AAAA,IAC1D;AAEA,WAAO;AAAA,MACL,MAAMD;AAAA,MACN,SAAS,CAACC,MAAWD,EAAiB,EAAE,GAAGC,GAAQ,MAAM,WAAW;AAAA,MACpE,MAAM,CAACA,MAAWD,EAAiB,EAAE,GAAGC,GAAQ,MAAM,QAAQ;AAAA,MAC9D,SAAS,CAACA,MAAWD,EAAiB,EAAE,GAAGC,GAAQ,MAAM,WAAW;AAAA,MACpE,OAAO,CAACA,MAAWD,EAAiB,EAAE,GAAGC,GAAQ,MAAM,SAAS;AAAA,MAChE,SAASL,EAAI;AAAA,IAAA;AAAA,EAEjB,GAAG,CAACA,GAAKF,CAAG,CAAC,GAEMG,CAAa;AAClC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.ds-tour .ds-tour-header{padding-top:1rem;padding-bottom:.75rem}.ds-tour .ds-tour-title{font-size:var(--ds-font-size-heading-5);font-weight:600;line-height:var(--ds-line-height-heading-5)}.ds-tour .ds-tour-description{font-size:var(--ds-font-size);font-weight:400;line-height:var(--ds-line-height)}.ds-tour .ds-tour-description p:not(:first-child),.ds-tour .ds-tour-description ul:not(:first-child),.ds-tour .ds-tour-description ol:not(:first-child){margin-top:.875rem}.ds-tour .ds-tour-description strong{font-weight:600}.ds-tour .ds-tour-description ul{list-style:disc;padding-left:1rem}.ds-tour .ds-tour-description ol{list-style:decimal;padding-left:1rem}.ds-tour .ds-tour-description li{padding-left:.5rem}.ds-tour .ds-tour-description li:not(:first-child){margin-top:.5rem}.ds-tour .ds-tour-description li svg{display:inline-block;font-size:1.25rem;margin-bottom:-.25rem}.ds-tour .ds-tour-footer{padding-top:1rem}.ds-tour .ds-tour-indicator-wrapper{display:inline-flex;align-items:center;width:100%;height:100%;gap:.5rem}.ds-tour .ds-tour-indicator-summary-text{font-size:var(--ds-font-size-sm);font-weight:400;line-height:var(--ds-font-height-sm);color:var(--ds-color-text-tertiary);display:inline-flex;align-items:center;padding-top:.25rem}}
|
|
1
|
+
@layer components{.ds-tour .ds-tour-header{padding-top:1rem;padding-bottom:.75rem}.ds-tour .ds-tour-title{font-size:var(--ds-font-size-heading-5);font-weight:600;line-height:var(--ds-line-height-heading-5)}.ds-tour .ds-tour-description{font-size:var(--ds-font-size);font-weight:400;line-height:var(--ds-line-height)}.ds-tour .ds-tour-description p:not(:first-child),.ds-tour .ds-tour-description ul:not(:first-child),.ds-tour .ds-tour-description ol:not(:first-child){margin-top:.875rem}.ds-tour .ds-tour-description strong{font-weight:600}.ds-tour .ds-tour-description ul{list-style:disc;padding-left:1rem}.ds-tour .ds-tour-description ol{list-style:decimal;padding-left:1rem}.ds-tour .ds-tour-description li{padding-left:.5rem}.ds-tour .ds-tour-description li:not(:first-child){margin-top:.5rem}.ds-tour .ds-tour-description li svg{display:inline-block;font-size:1.25rem;margin-bottom:-.25rem}.ds-tour .ds-tour-footer{padding-top:1rem}.ds-tour .ds-tour-indicator-wrapper{display:inline-flex;align-items:center;width:100%;height:100%;gap:.5rem}.ds-tour .ds-tour-indicator-summary-text{font-size:var(--ds-font-size-sm);font-weight:400;line-height:var(--ds-font-height-sm);color:var(--ds-color-text-tertiary);display:inline-flex;align-items:center;padding-top:.25rem}.ds-tour .ds-tour-close{border-radius:9999px}}
|