@cerberus-design/react 1.3.0 → 1.4.0-rc.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/admonition/primitives.cjs +1 -1
- package/dist/components/admonition/primitives.d.cts +2 -2
- package/dist/components/admonition/primitives.d.ts +2 -2
- package/dist/components/admonition/primitives.js +1 -1
- package/dist/components/combobox/combobox.d.cts +2 -3
- package/dist/components/combobox/combobox.d.ts +2 -3
- package/dist/components/combobox/index.cjs +1 -0
- package/dist/components/combobox/index.js +2 -2
- package/dist/components/combobox/parts.cjs +1 -0
- package/dist/components/combobox/parts.d.cts +4 -0
- package/dist/components/combobox/parts.d.ts +4 -0
- package/dist/components/combobox/parts.js +2 -1
- package/dist/components/combobox/primitives.cjs +2 -0
- package/dist/components/combobox/primitives.d.cts +4 -2
- package/dist/components/combobox/primitives.d.ts +4 -2
- package/dist/components/combobox/primitives.js +2 -1
- package/dist/components/field/field.d.cts +2 -1
- package/dist/components/field/field.d.ts +2 -1
- package/dist/components/file-upload/file-status.cjs +28 -28
- package/dist/components/file-upload/file-status.js +28 -28
- package/dist/components/marquee/Marquee.1.d.cts +1 -0
- package/dist/components/marquee/Marquee.1.d.ts +1 -0
- package/dist/components/marquee/index.cjs +10 -0
- package/dist/components/marquee/index.d.cts +2 -0
- package/dist/components/marquee/index.d.ts +2 -0
- package/dist/components/marquee/index.js +3 -0
- package/dist/components/marquee/marquee.cjs +46 -0
- package/dist/components/marquee/marquee.d.cts +23 -0
- package/dist/components/marquee/marquee.d.ts +23 -0
- package/dist/components/marquee/marquee.js +46 -0
- package/dist/components/marquee/primitives.cjs +18 -0
- package/dist/components/marquee/primitives.d.cts +16 -0
- package/dist/components/marquee/primitives.d.ts +16 -0
- package/dist/components/marquee/primitives.js +13 -0
- package/dist/components/marquee/utils.cjs +33 -0
- package/dist/components/marquee/utils.d.cts +4 -0
- package/dist/components/marquee/utils.d.ts +4 -0
- package/dist/components/marquee/utils.js +31 -0
- package/dist/components/notifications/center.cjs +11 -13
- package/dist/components/notifications/center.d.cts +0 -2
- package/dist/components/notifications/center.d.ts +0 -2
- package/dist/components/notifications/center.js +12 -13
- package/dist/components/notifications/index.cjs +0 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/match-icon.cjs +3 -4
- package/dist/components/notifications/match-icon.js +3 -4
- package/dist/components/tag/closable.cjs +1 -1
- package/dist/components/tag/closable.js +1 -1
- package/dist/config/icons/default.cjs +5 -1
- package/dist/config/icons/default.js +6 -2
- package/dist/config/types.d.cts +4 -0
- package/dist/config/types.d.ts +4 -0
- package/dist/index.cjs +140 -106
- package/dist/index.client.d.cts +2 -1
- package/dist/index.client.d.ts +2 -1
- package/dist/index.client.js +3 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -4
- package/dist/panda.buildinfo.json +3 -1
- package/package.json +19 -19
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Show } from "../show/show.js";
|
|
2
|
+
import { MarqueeContent, MarqueeEdge, MarqueeItem, MarqueeRoot, MarqueeRootProvider, MarqueeViewport } from "./primitives.js";
|
|
3
|
+
import { getEndEdge, getStartEdge, shouldShowEdge } from "./utils.js";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { MarqueeContext } from "@ark-ui/react";
|
|
6
|
+
//#region src/components/marquee/marquee.tsx
|
|
7
|
+
/**
|
|
8
|
+
* The marquee component displays a horizontally scrolling content with optional edges.
|
|
9
|
+
* @description [Marquee Docs](https://cerberus.digitalu.design/docs/components/marquee)
|
|
10
|
+
*/
|
|
11
|
+
function Marquee(props) {
|
|
12
|
+
const { children, edges, ...rootProps } = props;
|
|
13
|
+
return /* @__PURE__ */ jsxs(MarqueeRoot, {
|
|
14
|
+
autoFill: true,
|
|
15
|
+
...rootProps,
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Show, {
|
|
18
|
+
when: shouldShowEdge([
|
|
19
|
+
"start",
|
|
20
|
+
"top",
|
|
21
|
+
"both"
|
|
22
|
+
], edges),
|
|
23
|
+
children: () => /* @__PURE__ */ jsx(MarqueeEdge, { side: getStartEdge(edges, rootProps.side) })
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsx(MarqueeViewport, { children: /* @__PURE__ */ jsx(MarqueeContent, { children }) }),
|
|
26
|
+
/* @__PURE__ */ jsx(Show, {
|
|
27
|
+
when: shouldShowEdge([
|
|
28
|
+
"end",
|
|
29
|
+
"bottom",
|
|
30
|
+
"both"
|
|
31
|
+
], edges),
|
|
32
|
+
children: () => /* @__PURE__ */ jsx(MarqueeEdge, { side: getEndEdge(edges, rootProps.side) })
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
Marquee.Context = MarqueeContext;
|
|
38
|
+
Marquee.RootProvider = MarqueeRootProvider;
|
|
39
|
+
Marquee.Root = MarqueeRoot;
|
|
40
|
+
Marquee.Edge = MarqueeEdge;
|
|
41
|
+
Marquee.Viewport = MarqueeViewport;
|
|
42
|
+
Marquee.Content = MarqueeContent;
|
|
43
|
+
Marquee.Item = MarqueeItem;
|
|
44
|
+
Marquee.displayName = "Cerberus.Marquee";
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Marquee };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_index = require("../../system/index.cjs");
|
|
2
|
+
let styled_system_recipes = require("styled-system/recipes");
|
|
3
|
+
let _ark_ui_react_marquee = require("@ark-ui/react/marquee");
|
|
4
|
+
//#region src/components/marquee/primitives.ts
|
|
5
|
+
var { withSlotRecipe, withNoRecipe } = require_index.createCerberusPrimitive(styled_system_recipes.marquee);
|
|
6
|
+
var MarqueeRootProvider = withSlotRecipe(_ark_ui_react_marquee.Marquee.RootProvider, "root");
|
|
7
|
+
var MarqueeRoot = withSlotRecipe(_ark_ui_react_marquee.Marquee.Root, "root");
|
|
8
|
+
var MarqueeViewport = withSlotRecipe(_ark_ui_react_marquee.Marquee.Viewport, "viewport");
|
|
9
|
+
var MarqueeContent = withSlotRecipe(_ark_ui_react_marquee.Marquee.Content, "content");
|
|
10
|
+
var MarqueeEdge = withSlotRecipe(_ark_ui_react_marquee.Marquee.Edge, "edge");
|
|
11
|
+
var MarqueeItem = withNoRecipe(_ark_ui_react_marquee.Marquee.Item);
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.MarqueeContent = MarqueeContent;
|
|
14
|
+
exports.MarqueeEdge = MarqueeEdge;
|
|
15
|
+
exports.MarqueeItem = MarqueeItem;
|
|
16
|
+
exports.MarqueeRoot = MarqueeRoot;
|
|
17
|
+
exports.MarqueeRootProvider = MarqueeRootProvider;
|
|
18
|
+
exports.MarqueeViewport = MarqueeViewport;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Marquee } from '@ark-ui/react/marquee';
|
|
2
|
+
import { MarqueeVariantProps } from 'styled-system/recipes';
|
|
3
|
+
import { CerberusPrimitiveProps } from '../../system';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
export type MarqueeRootProviderProps = CerberusPrimitiveProps<Marquee.RootProviderProps>;
|
|
6
|
+
export declare const MarqueeRootProvider: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.RootProviderProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
7
|
+
export type MarqueeRootProps = CerberusPrimitiveProps<Marquee.RootProps & MarqueeVariantProps>;
|
|
8
|
+
export declare const MarqueeRoot: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.RootProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
9
|
+
export type MarqueeViewportProps = CerberusPrimitiveProps<Marquee.ViewportProps>;
|
|
10
|
+
export declare const MarqueeViewport: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ViewportProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
11
|
+
export type MarqueeContentProps = CerberusPrimitiveProps<Marquee.ContentProps>;
|
|
12
|
+
export declare const MarqueeContent: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ContentProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
13
|
+
export type MarqueeEdgeProps = CerberusPrimitiveProps<Marquee.EdgeProps>;
|
|
14
|
+
export declare const MarqueeEdge: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.EdgeProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
15
|
+
export type MarqueeItemProps = CerberusPrimitiveProps<Marquee.ItemProps>;
|
|
16
|
+
export declare const MarqueeItem: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ItemProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Marquee } from '@ark-ui/react/marquee';
|
|
2
|
+
import { MarqueeVariantProps } from 'styled-system/recipes';
|
|
3
|
+
import { CerberusPrimitiveProps } from '../../system';
|
|
4
|
+
import { ForwardRefExoticComponent, RefAttributes } from 'react';
|
|
5
|
+
export type MarqueeRootProviderProps = CerberusPrimitiveProps<Marquee.RootProviderProps>;
|
|
6
|
+
export declare const MarqueeRootProvider: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.RootProviderProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
7
|
+
export type MarqueeRootProps = CerberusPrimitiveProps<Marquee.RootProps & MarqueeVariantProps>;
|
|
8
|
+
export declare const MarqueeRoot: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.RootProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
9
|
+
export type MarqueeViewportProps = CerberusPrimitiveProps<Marquee.ViewportProps>;
|
|
10
|
+
export declare const MarqueeViewport: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ViewportProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
11
|
+
export type MarqueeContentProps = CerberusPrimitiveProps<Marquee.ContentProps>;
|
|
12
|
+
export declare const MarqueeContent: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ContentProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
13
|
+
export type MarqueeEdgeProps = CerberusPrimitiveProps<Marquee.EdgeProps>;
|
|
14
|
+
export declare const MarqueeEdge: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.EdgeProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
15
|
+
export type MarqueeItemProps = CerberusPrimitiveProps<Marquee.ItemProps>;
|
|
16
|
+
export declare const MarqueeItem: ForwardRefExoticComponent<Omit<CerberusPrimitiveProps<Marquee.ItemProps & RefAttributes<HTMLDivElement>>, "ref"> & RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createCerberusPrimitive } from "../../system/index.js";
|
|
2
|
+
import { marquee } from "styled-system/recipes";
|
|
3
|
+
import { Marquee } from "@ark-ui/react/marquee";
|
|
4
|
+
//#region src/components/marquee/primitives.ts
|
|
5
|
+
var { withSlotRecipe, withNoRecipe } = createCerberusPrimitive(marquee);
|
|
6
|
+
var MarqueeRootProvider = withSlotRecipe(Marquee.RootProvider, "root");
|
|
7
|
+
var MarqueeRoot = withSlotRecipe(Marquee.Root, "root");
|
|
8
|
+
var MarqueeViewport = withSlotRecipe(Marquee.Viewport, "viewport");
|
|
9
|
+
var MarqueeContent = withSlotRecipe(Marquee.Content, "content");
|
|
10
|
+
var MarqueeEdge = withSlotRecipe(Marquee.Edge, "edge");
|
|
11
|
+
var MarqueeItem = withNoRecipe(Marquee.Item);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { MarqueeContent, MarqueeEdge, MarqueeItem, MarqueeRoot, MarqueeRootProvider, MarqueeViewport };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/marquee/utils.ts
|
|
3
|
+
var dir = {
|
|
4
|
+
start: 1,
|
|
5
|
+
end: 1,
|
|
6
|
+
top: 2,
|
|
7
|
+
bottom: 2,
|
|
8
|
+
both: 3,
|
|
9
|
+
hor: 1,
|
|
10
|
+
vert: 2
|
|
11
|
+
};
|
|
12
|
+
function shouldShowEdge(edge, edges) {
|
|
13
|
+
if (!edges) return false;
|
|
14
|
+
return edge.some((e) => edges.includes(e));
|
|
15
|
+
}
|
|
16
|
+
function getStartEdge(edges, side) {
|
|
17
|
+
if (!edges) return "start";
|
|
18
|
+
const direction = dir[side ?? "start"];
|
|
19
|
+
if (direction === dir.hor) return "start";
|
|
20
|
+
if (direction === dir.vert) return "top";
|
|
21
|
+
return "start";
|
|
22
|
+
}
|
|
23
|
+
function getEndEdge(edges, side) {
|
|
24
|
+
if (!edges) return "end";
|
|
25
|
+
const direction = dir[side ?? "end"];
|
|
26
|
+
if (direction === dir.hor) return "end";
|
|
27
|
+
if (direction === dir.vert) return "bottom";
|
|
28
|
+
return "end";
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.getEndEdge = getEndEdge;
|
|
32
|
+
exports.getStartEdge = getStartEdge;
|
|
33
|
+
exports.shouldShowEdge = shouldShowEdge;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MarqueeEdgeOption, MarqueeProps } from './marquee';
|
|
2
|
+
export declare function shouldShowEdge(edge: MarqueeEdgeOption[], edges: MarqueeProps['edges']): boolean;
|
|
3
|
+
export declare function getStartEdge(edges: MarqueeProps['edges'], side: MarqueeProps['side']): MarqueeEdgeOption;
|
|
4
|
+
export declare function getEndEdge(edges: MarqueeProps['edges'], side: MarqueeProps['side']): MarqueeEdgeOption;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MarqueeEdgeOption, MarqueeProps } from './marquee';
|
|
2
|
+
export declare function shouldShowEdge(edge: MarqueeEdgeOption[], edges: MarqueeProps['edges']): boolean;
|
|
3
|
+
export declare function getStartEdge(edges: MarqueeProps['edges'], side: MarqueeProps['side']): MarqueeEdgeOption;
|
|
4
|
+
export declare function getEndEdge(edges: MarqueeProps['edges'], side: MarqueeProps['side']): MarqueeEdgeOption;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/marquee/utils.ts
|
|
3
|
+
var dir = {
|
|
4
|
+
start: 1,
|
|
5
|
+
end: 1,
|
|
6
|
+
top: 2,
|
|
7
|
+
bottom: 2,
|
|
8
|
+
both: 3,
|
|
9
|
+
hor: 1,
|
|
10
|
+
vert: 2
|
|
11
|
+
};
|
|
12
|
+
function shouldShowEdge(edge, edges) {
|
|
13
|
+
if (!edges) return false;
|
|
14
|
+
return edge.some((e) => edges.includes(e));
|
|
15
|
+
}
|
|
16
|
+
function getStartEdge(edges, side) {
|
|
17
|
+
if (!edges) return "start";
|
|
18
|
+
const direction = dir[side ?? "start"];
|
|
19
|
+
if (direction === dir.hor) return "start";
|
|
20
|
+
if (direction === dir.vert) return "top";
|
|
21
|
+
return "start";
|
|
22
|
+
}
|
|
23
|
+
function getEndEdge(edges, side) {
|
|
24
|
+
if (!edges) return "end";
|
|
25
|
+
const direction = dir[side ?? "end"];
|
|
26
|
+
if (direction === dir.hor) return "end";
|
|
27
|
+
if (direction === dir.vert) return "bottom";
|
|
28
|
+
return "end";
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { getEndEdge, getStartEdge, shouldShowEdge };
|
|
@@ -12,24 +12,23 @@ let styled_system_jsx = require("styled-system/jsx");
|
|
|
12
12
|
let _ark_ui_react_toast = require("@ark-ui/react/toast");
|
|
13
13
|
//#region src/components/notifications/center.tsx
|
|
14
14
|
/**
|
|
15
|
-
* This module contains an abstraction of the Notification parts.
|
|
16
|
-
* @module 'notification/center'
|
|
17
|
-
*/
|
|
18
|
-
function getEmphasis(options) {
|
|
19
|
-
if (options.usage === "subtle") return "low";
|
|
20
|
-
return "high";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
15
|
* The NotificationCenter component is an abstraction for the Notification
|
|
24
16
|
* component. It manages displaying all the toasts in the center.
|
|
25
17
|
*/
|
|
26
18
|
function NotificationCenter(props) {
|
|
19
|
+
const cachedToaster = (0, react.useMemo)(() => props.toaster || require_toaster.toaster, [props.toaster]);
|
|
20
|
+
const typeToPalette = (0, react.useMemo)(() => ({
|
|
21
|
+
info: "info",
|
|
22
|
+
success: "success",
|
|
23
|
+
warning: "warning",
|
|
24
|
+
error: "danger"
|
|
25
|
+
}), []);
|
|
27
26
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_toast.Toaster, {
|
|
28
|
-
toaster:
|
|
27
|
+
toaster: cachedToaster,
|
|
29
28
|
children: (toast) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_parts.NotificationParts.Root, {
|
|
30
|
-
"data-emphasis":
|
|
29
|
+
"data-emphasis": toast.usage ?? "high",
|
|
31
30
|
children: [
|
|
32
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_match_icon.MatchNotificationIcon, {
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_match_icon.MatchNotificationIcon, { ...toast }),
|
|
33
32
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(styled_system_jsx.Box, {
|
|
34
33
|
flex: "1",
|
|
35
34
|
paddingBlock: "sm",
|
|
@@ -41,7 +40,7 @@ function NotificationCenter(props) {
|
|
|
41
40
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_parts.NotificationParts.ActionTrigger, {
|
|
42
41
|
asChild: true,
|
|
43
42
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
44
|
-
palette: toast.type,
|
|
43
|
+
palette: typeToPalette[String(toast.type)],
|
|
45
44
|
usage: "ghost",
|
|
46
45
|
size: "sm",
|
|
47
46
|
children: toast.action?.label
|
|
@@ -57,4 +56,3 @@ function NotificationCenter(props) {
|
|
|
57
56
|
}
|
|
58
57
|
//#endregion
|
|
59
58
|
exports.NotificationCenter = NotificationCenter;
|
|
60
|
-
exports.getEmphasis = getEmphasis;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CreateToasterReturn } from '@ark-ui/react/toast';
|
|
2
|
-
import { NotifyOptions } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* This module contains an abstraction of the Notification parts.
|
|
5
4
|
* @module 'notification/center'
|
|
6
5
|
*/
|
|
7
|
-
export declare function getEmphasis(options: NotifyOptions): "high" | "low";
|
|
8
6
|
export interface NotificationCenterProps {
|
|
9
7
|
toaster?: CreateToasterReturn;
|
|
10
8
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { CreateToasterReturn } from '@ark-ui/react/toast';
|
|
2
|
-
import { NotifyOptions } from './types';
|
|
3
2
|
/**
|
|
4
3
|
* This module contains an abstraction of the Notification parts.
|
|
5
4
|
* @module 'notification/center'
|
|
6
5
|
*/
|
|
7
|
-
export declare function getEmphasis(options: NotifyOptions): "high" | "low";
|
|
8
6
|
export interface NotificationCenterProps {
|
|
9
7
|
toaster?: CreateToasterReturn;
|
|
10
8
|
}
|
|
@@ -12,24 +12,23 @@ import { Box } from "styled-system/jsx";
|
|
|
12
12
|
import { Toaster } from "@ark-ui/react/toast";
|
|
13
13
|
//#region src/components/notifications/center.tsx
|
|
14
14
|
/**
|
|
15
|
-
* This module contains an abstraction of the Notification parts.
|
|
16
|
-
* @module 'notification/center'
|
|
17
|
-
*/
|
|
18
|
-
function getEmphasis(options) {
|
|
19
|
-
if (options.usage === "subtle") return "low";
|
|
20
|
-
return "high";
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
15
|
* The NotificationCenter component is an abstraction for the Notification
|
|
24
16
|
* component. It manages displaying all the toasts in the center.
|
|
25
17
|
*/
|
|
26
18
|
function NotificationCenter(props) {
|
|
19
|
+
const cachedToaster = useMemo(() => props.toaster || toaster, [props.toaster]);
|
|
20
|
+
const typeToPalette = useMemo(() => ({
|
|
21
|
+
info: "info",
|
|
22
|
+
success: "success",
|
|
23
|
+
warning: "warning",
|
|
24
|
+
error: "danger"
|
|
25
|
+
}), []);
|
|
27
26
|
return /* @__PURE__ */ jsx(Toaster, {
|
|
28
|
-
toaster:
|
|
27
|
+
toaster: cachedToaster,
|
|
29
28
|
children: (toast) => /* @__PURE__ */ jsxs(NotificationParts.Root, {
|
|
30
|
-
"data-emphasis":
|
|
29
|
+
"data-emphasis": toast.usage ?? "high",
|
|
31
30
|
children: [
|
|
32
|
-
/* @__PURE__ */ jsx(MatchNotificationIcon, {
|
|
31
|
+
/* @__PURE__ */ jsx(MatchNotificationIcon, { ...toast }),
|
|
33
32
|
/* @__PURE__ */ jsxs(Box, {
|
|
34
33
|
flex: "1",
|
|
35
34
|
paddingBlock: "sm",
|
|
@@ -41,7 +40,7 @@ function NotificationCenter(props) {
|
|
|
41
40
|
children: /* @__PURE__ */ jsx(NotificationParts.ActionTrigger, {
|
|
42
41
|
asChild: true,
|
|
43
42
|
children: /* @__PURE__ */ jsx(Button, {
|
|
44
|
-
palette: toast.type,
|
|
43
|
+
palette: typeToPalette[String(toast.type)],
|
|
45
44
|
usage: "ghost",
|
|
46
45
|
size: "sm",
|
|
47
46
|
children: toast.action?.label
|
|
@@ -56,4 +55,4 @@ function NotificationCenter(props) {
|
|
|
56
55
|
});
|
|
57
56
|
}
|
|
58
57
|
//#endregion
|
|
59
|
-
export { NotificationCenter
|
|
58
|
+
export { NotificationCenter };
|
|
@@ -11,5 +11,4 @@ exports.NotificationHeading = require_primitives.NotificationHeading;
|
|
|
11
11
|
exports.NotificationParts = require_parts.NotificationParts;
|
|
12
12
|
exports.NotificationProvider = require_primitives.NotificationProvider;
|
|
13
13
|
exports.NotificationRoot = require_primitives.NotificationRoot;
|
|
14
|
-
exports.getEmphasis = require_center.getEmphasis;
|
|
15
14
|
exports.toaster = require_toaster.toaster;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NotificationActionTrigger, NotificationCloseTrigger, NotificationDescription, NotificationHeading, NotificationProvider, NotificationRoot } from "./primitives.js";
|
|
2
2
|
import { NotificationParts } from "./parts.js";
|
|
3
3
|
import { toaster } from "./toaster.js";
|
|
4
|
-
import { NotificationCenter
|
|
5
|
-
export { NotificationActionTrigger, NotificationCenter, NotificationCloseTrigger, NotificationDescription, NotificationHeading, NotificationParts, NotificationProvider, NotificationRoot,
|
|
4
|
+
import { NotificationCenter } from "./center.js";
|
|
5
|
+
export { NotificationActionTrigger, NotificationCenter, NotificationCloseTrigger, NotificationDescription, NotificationHeading, NotificationParts, NotificationProvider, NotificationRoot, toaster };
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
const require_cerberus = require("../../context/cerberus.cjs");
|
|
4
4
|
const require_spinner = require("../spinner/spinner.cjs");
|
|
5
|
-
const require_center = require("./center.cjs");
|
|
6
5
|
let styled_system_recipes = require("styled-system/recipes");
|
|
7
6
|
let _ark_ui_react_factory = require("@ark-ui/react/factory");
|
|
8
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -15,11 +14,11 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
15
14
|
*/
|
|
16
15
|
function MatchNotificationIcon(props) {
|
|
17
16
|
const { icons } = require_cerberus.useCerberusContext();
|
|
18
|
-
const type = props.type
|
|
17
|
+
const type = props.type || "info";
|
|
19
18
|
const styles = (0, styled_system_recipes.toast)();
|
|
20
|
-
const Icon = icons[
|
|
19
|
+
const Icon = icons[type] || ToastLoadingIcon;
|
|
21
20
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_ark_ui_react_factory.ark.div, {
|
|
22
|
-
"data-emphasis":
|
|
21
|
+
"data-emphasis": props.usage,
|
|
23
22
|
className: styles.icon,
|
|
24
23
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {})
|
|
25
24
|
});
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { useCerberusContext } from "../../context/cerberus.js";
|
|
4
4
|
import { Spinner } from "../spinner/spinner.js";
|
|
5
|
-
import { getEmphasis } from "./center.js";
|
|
6
5
|
import { toast } from "styled-system/recipes";
|
|
7
6
|
import { ark } from "@ark-ui/react/factory";
|
|
8
7
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -15,11 +14,11 @@ import { jsx } from "react/jsx-runtime";
|
|
|
15
14
|
*/
|
|
16
15
|
function MatchNotificationIcon(props) {
|
|
17
16
|
const { icons } = useCerberusContext();
|
|
18
|
-
const type = props.type
|
|
17
|
+
const type = props.type || "info";
|
|
19
18
|
const styles = toast();
|
|
20
|
-
const Icon = icons[
|
|
19
|
+
const Icon = icons[type] || ToastLoadingIcon;
|
|
21
20
|
return /* @__PURE__ */ jsx(ark.div, {
|
|
22
|
-
"data-emphasis":
|
|
21
|
+
"data-emphasis": props.usage,
|
|
23
22
|
className: styles.icon,
|
|
24
23
|
children: /* @__PURE__ */ jsx(Icon, {})
|
|
25
24
|
});
|
|
@@ -22,12 +22,14 @@ var defaultIcons = {
|
|
|
22
22
|
dangerNotification: _carbon_icons_react.WarningFilled,
|
|
23
23
|
decrement: _carbon_icons_react.ChevronDown,
|
|
24
24
|
delete: _carbon_icons_react.TrashCan,
|
|
25
|
+
error: _carbon_icons_react.ErrorFilled,
|
|
25
26
|
fileUploader: require_AnimatingUploadIcon.AnimatingUploadIcon,
|
|
26
27
|
filter: _carbon_icons_react.Filter,
|
|
27
28
|
filterEdit: _carbon_icons_react.FilterEdit,
|
|
28
29
|
filterClear: _carbon_icons_react.FilterRemove,
|
|
29
30
|
increment: _carbon_icons_react.ChevronUp,
|
|
30
31
|
indeterminate: require_checkbox_icons.IndeterminateIcon,
|
|
32
|
+
info: _carbon_icons_react.InformationFilled,
|
|
31
33
|
infoNotification: _carbon_icons_react.Information,
|
|
32
34
|
invalid: _carbon_icons_react.WarningFilled,
|
|
33
35
|
invalidAlt: _carbon_icons_react.Warning,
|
|
@@ -42,11 +44,13 @@ var defaultIcons = {
|
|
|
42
44
|
selectChecked: _carbon_icons_react.Checkmark,
|
|
43
45
|
sortAsc: require_sort_icons.SortAscIcon,
|
|
44
46
|
sortDesc: require_sort_icons.SortDescIcon,
|
|
47
|
+
success: _carbon_icons_react.CheckmarkFilled,
|
|
45
48
|
successNotification: _carbon_icons_react.CheckmarkOutline,
|
|
46
49
|
table: _carbon_icons_react.TableSplit,
|
|
47
50
|
toggleChecked: _carbon_icons_react.Checkmark,
|
|
48
51
|
waitingFileUploader: _carbon_icons_react.CloudUpload,
|
|
49
|
-
warningNotification: _carbon_icons_react.WarningAlt
|
|
52
|
+
warningNotification: _carbon_icons_react.WarningAlt,
|
|
53
|
+
warning: _carbon_icons_react.WarningFilled
|
|
50
54
|
};
|
|
51
55
|
//#endregion
|
|
52
56
|
exports.defaultIcons = defaultIcons;
|
|
@@ -3,7 +3,7 @@ import { AnimatingUploadIcon } from "../../components/AnimatingUploadIcon.js";
|
|
|
3
3
|
import { CheckmarkIcon, IndeterminateIcon } from "./checkbox.icons.js";
|
|
4
4
|
import { PinLeftFilledIcon, PinLeftIcon, PinRightFilledIcon, PinRightIcon } from "./pinned.icons.js";
|
|
5
5
|
import { SortAscIcon, SortDescIcon } from "./sort.icons.js";
|
|
6
|
-
import { ArrowRight, Calendar, CaretDown, Checkmark, CheckmarkOutline, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Close, CloudUpload, Filter, FilterEdit, FilterRemove, Information, OverflowMenuVertical, Restart, TableSplit, TrashCan, UserFilled, Warning, WarningAlt, WarningFilled } from "@carbon/icons-react";
|
|
6
|
+
import { ArrowRight, Calendar, CaretDown, Checkmark, CheckmarkFilled, CheckmarkOutline, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, Close, CloudUpload, ErrorFilled, Filter, FilterEdit, FilterRemove, Information, InformationFilled, OverflowMenuVertical, Restart, TableSplit, TrashCan, UserFilled, Warning, WarningAlt, WarningFilled } from "@carbon/icons-react";
|
|
7
7
|
//#region src/config/icons/default.ts
|
|
8
8
|
/**
|
|
9
9
|
* Fallback icons when there is no custom set provided by the user.
|
|
@@ -22,12 +22,14 @@ var defaultIcons = {
|
|
|
22
22
|
dangerNotification: WarningFilled,
|
|
23
23
|
decrement: ChevronDown,
|
|
24
24
|
delete: TrashCan,
|
|
25
|
+
error: ErrorFilled,
|
|
25
26
|
fileUploader: AnimatingUploadIcon,
|
|
26
27
|
filter: Filter,
|
|
27
28
|
filterEdit: FilterEdit,
|
|
28
29
|
filterClear: FilterRemove,
|
|
29
30
|
increment: ChevronUp,
|
|
30
31
|
indeterminate: IndeterminateIcon,
|
|
32
|
+
info: InformationFilled,
|
|
31
33
|
infoNotification: Information,
|
|
32
34
|
invalid: WarningFilled,
|
|
33
35
|
invalidAlt: Warning,
|
|
@@ -42,11 +44,13 @@ var defaultIcons = {
|
|
|
42
44
|
selectChecked: Checkmark,
|
|
43
45
|
sortAsc: SortAscIcon,
|
|
44
46
|
sortDesc: SortDescIcon,
|
|
47
|
+
success: CheckmarkFilled,
|
|
45
48
|
successNotification: CheckmarkOutline,
|
|
46
49
|
table: TableSplit,
|
|
47
50
|
toggleChecked: Checkmark,
|
|
48
51
|
waitingFileUploader: CloudUpload,
|
|
49
|
-
warningNotification: WarningAlt
|
|
52
|
+
warningNotification: WarningAlt,
|
|
53
|
+
warning: WarningFilled
|
|
50
54
|
};
|
|
51
55
|
//#endregion
|
|
52
56
|
export { defaultIcons };
|
package/dist/config/types.d.cts
CHANGED
|
@@ -23,12 +23,14 @@ export interface DefinedIcons<T extends IconType = IconType> {
|
|
|
23
23
|
decrement?: T;
|
|
24
24
|
delete?: T;
|
|
25
25
|
dangerNotification?: T;
|
|
26
|
+
error?: T;
|
|
26
27
|
fileUploader?: T;
|
|
27
28
|
filter?: T;
|
|
28
29
|
filterEdit?: T;
|
|
29
30
|
filterClear?: T;
|
|
30
31
|
indeterminate?: T;
|
|
31
32
|
increment?: T;
|
|
33
|
+
info?: T;
|
|
32
34
|
infoNotification?: T;
|
|
33
35
|
invalid?: T;
|
|
34
36
|
invalidAlt?: T;
|
|
@@ -43,10 +45,12 @@ export interface DefinedIcons<T extends IconType = IconType> {
|
|
|
43
45
|
selectChecked?: T;
|
|
44
46
|
sortAsc?: T;
|
|
45
47
|
sortDesc?: T;
|
|
48
|
+
success?: T;
|
|
46
49
|
successNotification?: T;
|
|
47
50
|
table?: T;
|
|
48
51
|
toggleChecked?: T;
|
|
49
52
|
waitingFileUploader?: T;
|
|
50
53
|
warningNotification?: T;
|
|
54
|
+
warning?: T;
|
|
51
55
|
}
|
|
52
56
|
export type IconType = ElementType;
|
package/dist/config/types.d.ts
CHANGED
|
@@ -23,12 +23,14 @@ export interface DefinedIcons<T extends IconType = IconType> {
|
|
|
23
23
|
decrement?: T;
|
|
24
24
|
delete?: T;
|
|
25
25
|
dangerNotification?: T;
|
|
26
|
+
error?: T;
|
|
26
27
|
fileUploader?: T;
|
|
27
28
|
filter?: T;
|
|
28
29
|
filterEdit?: T;
|
|
29
30
|
filterClear?: T;
|
|
30
31
|
indeterminate?: T;
|
|
31
32
|
increment?: T;
|
|
33
|
+
info?: T;
|
|
32
34
|
infoNotification?: T;
|
|
33
35
|
invalid?: T;
|
|
34
36
|
invalidAlt?: T;
|
|
@@ -43,10 +45,12 @@ export interface DefinedIcons<T extends IconType = IconType> {
|
|
|
43
45
|
selectChecked?: T;
|
|
44
46
|
sortAsc?: T;
|
|
45
47
|
sortDesc?: T;
|
|
48
|
+
success?: T;
|
|
46
49
|
successNotification?: T;
|
|
47
50
|
table?: T;
|
|
48
51
|
toggleChecked?: T;
|
|
49
52
|
waitingFileUploader?: T;
|
|
50
53
|
warningNotification?: T;
|
|
54
|
+
warning?: T;
|
|
51
55
|
}
|
|
52
56
|
export type IconType = ElementType;
|