@cerberus-design/react 0.12.0 → 0.13.1-next-e3e9e48
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/build/legacy/_tsup-dts-rollup.d.cts +128 -1
- package/build/legacy/components/Portal.cjs +3 -5
- package/build/legacy/components/Portal.cjs.map +1 -1
- package/build/legacy/components/Tooltip.cjs +55 -0
- package/build/legacy/components/Tooltip.cjs.map +1 -0
- package/build/legacy/context/confirm-modal.cjs +2 -5
- package/build/legacy/context/confirm-modal.cjs.map +1 -1
- package/build/legacy/context/cta-modal.cjs +2 -5
- package/build/legacy/context/cta-modal.cjs.map +1 -1
- package/build/legacy/context/notification-center.cjs +3 -6
- package/build/legacy/context/notification-center.cjs.map +1 -1
- package/build/legacy/context/prompt-modal.cjs +2 -5
- package/build/legacy/context/prompt-modal.cjs.map +1 -1
- package/build/legacy/hooks/useDate.cjs +122 -0
- package/build/legacy/hooks/useDate.cjs.map +1 -0
- package/build/legacy/hooks/useModal.cjs.map +1 -1
- package/build/legacy/index.cjs +214 -93
- package/build/legacy/index.cjs.map +1 -1
- package/build/modern/_tsup-dts-rollup.d.ts +128 -1
- package/build/modern/{chunk-ZBMA5G54.js → chunk-7MM5KYEX.js} +4 -4
- package/build/modern/chunk-CZND26FC.js +98 -0
- package/build/modern/chunk-CZND26FC.js.map +1 -0
- package/build/modern/{chunk-T6LS5P5W.js → chunk-J4LOSTEP.js} +13 -13
- package/build/modern/chunk-K2PSHGS7.js +11 -0
- package/build/modern/chunk-K2PSHGS7.js.map +1 -0
- package/build/modern/{chunk-CSEHDNMJ.js → chunk-KFGI37CO.js} +12 -12
- package/build/modern/{chunk-7T3JIGM7.js → chunk-KGQG5JGW.js} +1 -1
- package/build/modern/chunk-KGQG5JGW.js.map +1 -0
- package/build/modern/chunk-KML4CTMK.js +33 -0
- package/build/modern/chunk-KML4CTMK.js.map +1 -0
- package/build/modern/{chunk-5OSUZUR4.js → chunk-KUT2YEEQ.js} +7 -7
- package/build/modern/chunk-KUT2YEEQ.js.map +1 -0
- package/build/modern/{chunk-VP5ERLAY.js → chunk-NCUHRVW2.js} +15 -15
- package/build/modern/components/FileStatus.js +2 -2
- package/build/modern/components/Portal.js +2 -1
- package/build/modern/components/Tooltip.js +7 -0
- package/build/modern/components/Tooltip.js.map +1 -0
- package/build/modern/context/confirm-modal.js +5 -5
- package/build/modern/context/cta-modal.js +5 -5
- package/build/modern/context/notification-center.js +3 -3
- package/build/modern/context/prompt-modal.js +6 -6
- package/build/modern/hooks/useDate.js +14 -0
- package/build/modern/hooks/useDate.js.map +1 -0
- package/build/modern/hooks/useModal.js +1 -1
- package/build/modern/index.js +43 -29
- package/build/modern/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Portal.tsx +17 -6
- package/src/components/Tooltip.tsx +61 -0
- package/src/context/notification-center.tsx +1 -1
- package/src/hooks/useDate.ts +164 -0
- package/src/hooks/useModal.ts +1 -1
- package/src/index.ts +2 -0
- package/build/modern/chunk-5OSUZUR4.js.map +0 -1
- package/build/modern/chunk-7T3JIGM7.js.map +0 -1
- package/build/modern/chunk-GLY7GU5S.js +0 -14
- package/build/modern/chunk-GLY7GU5S.js.map +0 -1
- /package/build/modern/{chunk-ZBMA5G54.js.map → chunk-7MM5KYEX.js.map} +0 -0
- /package/build/modern/{chunk-T6LS5P5W.js.map → chunk-J4LOSTEP.js.map} +0 -0
- /package/build/modern/{chunk-CSEHDNMJ.js.map → chunk-KFGI37CO.js.map} +0 -0
- /package/build/modern/{chunk-VP5ERLAY.js.map → chunk-NCUHRVW2.js.map} +0 -0
|
@@ -130,6 +130,7 @@ import { TdVariantProps } from '@cerberus/styled-system/recipes';
|
|
|
130
130
|
import type { TextareaHTMLAttributes } from 'react';
|
|
131
131
|
import { ThVariantProps } from '@cerberus/styled-system/recipes';
|
|
132
132
|
import { ToggleVariantProps } from '@cerberus/styled-system/recipes';
|
|
133
|
+
import { TooltipContentProps } from '@ark-ui/react/tooltip';
|
|
133
134
|
import { TouchSensor } from '@dnd-kit/core';
|
|
134
135
|
import { TouchSensorOptions } from '@dnd-kit/core';
|
|
135
136
|
import { Translate } from '@dnd-kit/core';
|
|
@@ -579,6 +580,21 @@ export { Data }
|
|
|
579
580
|
|
|
580
581
|
export { DataRef }
|
|
581
582
|
|
|
583
|
+
/**
|
|
584
|
+
* Date formatting options
|
|
585
|
+
* @example
|
|
586
|
+
* ```tsx
|
|
587
|
+
* const date = new Date()
|
|
588
|
+
* const formatted = date.format(DateFormats.USMilitary)
|
|
589
|
+
*/
|
|
590
|
+
declare const DateFormats: {
|
|
591
|
+
readonly ISO: string;
|
|
592
|
+
readonly USMilitary: string;
|
|
593
|
+
readonly Months: string[];
|
|
594
|
+
};
|
|
595
|
+
export { DateFormats }
|
|
596
|
+
export { DateFormats as DateFormats_alias_1 }
|
|
597
|
+
|
|
582
598
|
export { defaultAnnouncements }
|
|
583
599
|
|
|
584
600
|
export { defaultCoordinates }
|
|
@@ -1015,6 +1031,24 @@ declare interface FileUploaderProps extends InputHTMLAttributes<HTMLInputElement
|
|
|
1015
1031
|
export { FileUploaderProps }
|
|
1016
1032
|
export { FileUploaderProps as FileUploaderProps_alias_1 }
|
|
1017
1033
|
|
|
1034
|
+
/**
|
|
1035
|
+
* Converts a string to US Military format. Used within the `useDate` hook.
|
|
1036
|
+
* @param input The string to format
|
|
1037
|
+
* @returns The formatted string in US Military format (DD MMM YYYY)
|
|
1038
|
+
*/
|
|
1039
|
+
declare function formatMilitaryDate(input: string): string;
|
|
1040
|
+
export { formatMilitaryDate }
|
|
1041
|
+
export { formatMilitaryDate as formatMilitaryDate_alias_1 }
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* Converts a string in US Military format to ISO format. Used within the `useDate` hook.
|
|
1045
|
+
* @param input The string to format
|
|
1046
|
+
* @returns The formatted string in ISO format (YYYY-MM-DD)
|
|
1047
|
+
*/
|
|
1048
|
+
declare function formatMilitaryToISO(input: string): string;
|
|
1049
|
+
export { formatMilitaryToISO }
|
|
1050
|
+
export { formatMilitaryToISO as formatMilitaryToISO_alias_1 }
|
|
1051
|
+
|
|
1018
1052
|
/**
|
|
1019
1053
|
* This module contains utility functions that are used across your app.
|
|
1020
1054
|
* @module Utils
|
|
@@ -1821,8 +1855,21 @@ export { pointerWithin }
|
|
|
1821
1855
|
* The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.
|
|
1822
1856
|
* @see https://cerberus.digitalu.design/react/portal
|
|
1823
1857
|
* @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```tsx
|
|
1860
|
+
* 'use client'
|
|
1861
|
+
*
|
|
1862
|
+
* import { Portal } from '@cerberus/react'
|
|
1863
|
+
*
|
|
1864
|
+
* function SomeFeatureWithinSSRPage() {
|
|
1865
|
+
* return (
|
|
1866
|
+
* <Portal>
|
|
1867
|
+
* <div>Portal Content outside of the React VDom tree</div>
|
|
1868
|
+
* </Portal>
|
|
1869
|
+
* )
|
|
1870
|
+
* }
|
|
1824
1871
|
*/
|
|
1825
|
-
declare function Portal(props: PropsWithChildren<PortalProps>): ReactPortal
|
|
1872
|
+
declare function Portal(props: PropsWithChildren<PortalProps>): ReactPortal;
|
|
1826
1873
|
export { Portal }
|
|
1827
1874
|
export { Portal as Portal_alias_1 }
|
|
1828
1875
|
|
|
@@ -2718,6 +2765,36 @@ declare type ToggleProps = ToggleBase & ToggleVariantProps;
|
|
|
2718
2765
|
export { ToggleProps }
|
|
2719
2766
|
export { ToggleProps as ToggleProps_alias_1 }
|
|
2720
2767
|
|
|
2768
|
+
/**
|
|
2769
|
+
* The Tooltip component is used to provide additional information about an element when it is hovered over.
|
|
2770
|
+
* @definition [Tooltip docs](https://cerberus.digitalu.design/react/tooltip)
|
|
2771
|
+
* @example
|
|
2772
|
+
* ```tsx
|
|
2773
|
+
* <Tooltip content="This is a tooltip">
|
|
2774
|
+
* <Information />
|
|
2775
|
+
* </Tooltip>
|
|
2776
|
+
*/
|
|
2777
|
+
declare function Tooltip(props: TooltipProps & TooltipContentProps): JSX_2.Element;
|
|
2778
|
+
export { Tooltip }
|
|
2779
|
+
export { Tooltip as Tooltip_alias_1 }
|
|
2780
|
+
|
|
2781
|
+
/**
|
|
2782
|
+
* This module contains the Tooltip component.
|
|
2783
|
+
* @module Tooltip
|
|
2784
|
+
*/
|
|
2785
|
+
declare interface TooltipProps {
|
|
2786
|
+
/**
|
|
2787
|
+
* The text content to display in the tooltip.
|
|
2788
|
+
*/
|
|
2789
|
+
content: ReactNode;
|
|
2790
|
+
/**
|
|
2791
|
+
* The position of the tooltip relative to the trigger element.
|
|
2792
|
+
*/
|
|
2793
|
+
position?: 'top' | 'right' | 'bottom' | 'left';
|
|
2794
|
+
}
|
|
2795
|
+
export { TooltipProps }
|
|
2796
|
+
export { TooltipProps as TooltipProps_alias_1 }
|
|
2797
|
+
|
|
2721
2798
|
export { TouchSensor }
|
|
2722
2799
|
|
|
2723
2800
|
export { TouchSensorOptions }
|
|
@@ -2758,6 +2835,54 @@ declare function useCTAModal(): CTAModalValue;
|
|
|
2758
2835
|
export { useCTAModal }
|
|
2759
2836
|
export { useCTAModal as useCTAModal_alias_1 }
|
|
2760
2837
|
|
|
2838
|
+
/**
|
|
2839
|
+
* A hook for formatting and validating date inputs. The date format defaults to US Military format.
|
|
2840
|
+
* @example
|
|
2841
|
+
* ```tsx
|
|
2842
|
+
* const MyComponent = () => {
|
|
2843
|
+
* const date = useDate({ initialValue: '01 JAN 2024' })
|
|
2844
|
+
* return <input onChange={date.onChange} type="text" value={date.value} />
|
|
2845
|
+
* }
|
|
2846
|
+
*/
|
|
2847
|
+
declare function useDate(options?: UseDateOptions): UseDateReturn;
|
|
2848
|
+
export { useDate }
|
|
2849
|
+
export { useDate as useDate_alias_1 }
|
|
2850
|
+
|
|
2851
|
+
declare interface UseDateBase {
|
|
2852
|
+
/**
|
|
2853
|
+
* The format of the date input
|
|
2854
|
+
*/
|
|
2855
|
+
format?: string;
|
|
2856
|
+
/**
|
|
2857
|
+
* The callback to run when the date input changes
|
|
2858
|
+
*/
|
|
2859
|
+
onChange?: InputHTMLAttributes<HTMLInputElement>['onChange'];
|
|
2860
|
+
}
|
|
2861
|
+
export { UseDateBase }
|
|
2862
|
+
export { UseDateBase as UseDateBase_alias_1 }
|
|
2863
|
+
|
|
2864
|
+
declare interface UseDateOptions extends UseDateBase {
|
|
2865
|
+
/**
|
|
2866
|
+
* The initial value of the date input
|
|
2867
|
+
*/
|
|
2868
|
+
initialValue?: string;
|
|
2869
|
+
}
|
|
2870
|
+
export { UseDateOptions }
|
|
2871
|
+
export { UseDateOptions as UseDateOptions_alias_1 }
|
|
2872
|
+
|
|
2873
|
+
declare interface UseDateReturn extends UseDateBase {
|
|
2874
|
+
/**
|
|
2875
|
+
* The ISO formatted date string
|
|
2876
|
+
*/
|
|
2877
|
+
ISO: string;
|
|
2878
|
+
/**
|
|
2879
|
+
* The value of the date input
|
|
2880
|
+
*/
|
|
2881
|
+
value: string;
|
|
2882
|
+
}
|
|
2883
|
+
export { UseDateReturn }
|
|
2884
|
+
export { UseDateReturn as UseDateReturn_alias_1 }
|
|
2885
|
+
|
|
2761
2886
|
export { useDndContext }
|
|
2762
2887
|
|
|
2763
2888
|
export { UseDndContextReturnValue }
|
|
@@ -2825,6 +2950,8 @@ declare interface UseModalReturnValue {
|
|
|
2825
2950
|
*/
|
|
2826
2951
|
isOpen: boolean;
|
|
2827
2952
|
}
|
|
2953
|
+
export { UseModalReturnValue }
|
|
2954
|
+
export { UseModalReturnValue as UseModalReturnValue_alias_1 }
|
|
2828
2955
|
|
|
2829
2956
|
/**
|
|
2830
2957
|
* Used to access the nav menu context.
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
FieldMessage
|
|
9
9
|
} from "./chunk-JWIJHSI6.js";
|
|
10
|
-
import {
|
|
11
|
-
Avatar
|
|
12
|
-
} from "./chunk-SPZYPRZ6.js";
|
|
13
10
|
import {
|
|
14
11
|
Field
|
|
15
12
|
} from "./chunk-UZDVOIW5.js";
|
|
13
|
+
import {
|
|
14
|
+
Avatar
|
|
15
|
+
} from "./chunk-SPZYPRZ6.js";
|
|
16
16
|
import {
|
|
17
17
|
$cerberusIcons
|
|
18
18
|
} from "./chunk-VERRHMW4.js";
|
|
@@ -225,4 +225,4 @@ export {
|
|
|
225
225
|
processStatus,
|
|
226
226
|
FileStatus
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-7MM5KYEX.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// src/hooks/useDate.ts
|
|
2
|
+
import {
|
|
3
|
+
useState,
|
|
4
|
+
useCallback,
|
|
5
|
+
useMemo
|
|
6
|
+
} from "react";
|
|
7
|
+
function useDate(options) {
|
|
8
|
+
const initialValue = options?.initialValue ?? "";
|
|
9
|
+
const format = options?.format ?? DateFormats.USMilitary;
|
|
10
|
+
const onChange = options?.onChange;
|
|
11
|
+
const [value, setValue] = useState(initialValue);
|
|
12
|
+
const handleChange = useCallback(
|
|
13
|
+
(e) => {
|
|
14
|
+
const newValue = formatMilitaryDate(e.currentTarget.value);
|
|
15
|
+
if (onChange) onChange(e);
|
|
16
|
+
setValue(newValue);
|
|
17
|
+
},
|
|
18
|
+
[onChange]
|
|
19
|
+
);
|
|
20
|
+
return useMemo(
|
|
21
|
+
() => ({
|
|
22
|
+
format,
|
|
23
|
+
value,
|
|
24
|
+
ISO: formatMilitaryToISO(value),
|
|
25
|
+
onChange: handleChange
|
|
26
|
+
}),
|
|
27
|
+
[format, value, handleChange]
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
function formatMilitaryToISO(input) {
|
|
31
|
+
const [day, month, year] = input.split(" ");
|
|
32
|
+
const monthIndex = MONTHS.findIndex((m) => m.startsWith(month));
|
|
33
|
+
const monthNum = monthIndex + 1;
|
|
34
|
+
return `${year ?? "0000"}-${monthNum.toString().padStart(2, "0")}-${day.padStart(
|
|
35
|
+
2,
|
|
36
|
+
"0"
|
|
37
|
+
)}`;
|
|
38
|
+
}
|
|
39
|
+
function formatMilitaryDate(input) {
|
|
40
|
+
let formatted = input.toUpperCase().replace(/[^0-9A-Z]/g, "");
|
|
41
|
+
let day = "";
|
|
42
|
+
let month = "";
|
|
43
|
+
let year = "";
|
|
44
|
+
if (formatted.length >= 2) {
|
|
45
|
+
day = formatted.replace(/[^0-9]/g, "").slice(0, 2);
|
|
46
|
+
const dayNum = parseInt(day, 10);
|
|
47
|
+
if (dayNum > 31) day = "31";
|
|
48
|
+
else if (dayNum === 0) day = "01";
|
|
49
|
+
formatted = formatted.slice(2);
|
|
50
|
+
}
|
|
51
|
+
if (formatted.length >= 3) {
|
|
52
|
+
month = formatted.slice(0, 3);
|
|
53
|
+
const monthIndex = MONTHS.findIndex((m) => m.startsWith(month));
|
|
54
|
+
if (monthIndex !== -1) {
|
|
55
|
+
month = MONTHS[monthIndex];
|
|
56
|
+
} else {
|
|
57
|
+
month = month.replace(/[^A-Z]/g, "");
|
|
58
|
+
}
|
|
59
|
+
formatted = formatted.slice(3);
|
|
60
|
+
}
|
|
61
|
+
if (formatted.length > 0) {
|
|
62
|
+
year = formatted.slice(0, 4);
|
|
63
|
+
}
|
|
64
|
+
return [day, month, year].filter(Boolean).join(" ");
|
|
65
|
+
}
|
|
66
|
+
var DateFormats = {
|
|
67
|
+
get ISO() {
|
|
68
|
+
return "YYYY-MM-DD";
|
|
69
|
+
},
|
|
70
|
+
get USMilitary() {
|
|
71
|
+
return "DD MMM YYYY";
|
|
72
|
+
},
|
|
73
|
+
get Months() {
|
|
74
|
+
return MONTHS;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var MONTHS = [
|
|
78
|
+
"JAN",
|
|
79
|
+
"FEB",
|
|
80
|
+
"MAR",
|
|
81
|
+
"APR",
|
|
82
|
+
"MAY",
|
|
83
|
+
"JUN",
|
|
84
|
+
"JUL",
|
|
85
|
+
"AUG",
|
|
86
|
+
"SEP",
|
|
87
|
+
"OCT",
|
|
88
|
+
"NOV",
|
|
89
|
+
"DEC"
|
|
90
|
+
];
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
useDate,
|
|
94
|
+
formatMilitaryToISO,
|
|
95
|
+
formatMilitaryDate,
|
|
96
|
+
DateFormats
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=chunk-CZND26FC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useDate.ts"],"sourcesContent":["'use client'\n\nimport {\n useState,\n useCallback,\n ChangeEvent,\n useMemo,\n type InputHTMLAttributes,\n} from 'react'\n\nexport interface UseDateBase {\n /**\n * The format of the date input\n */\n format?: string\n /**\n * The callback to run when the date input changes\n */\n onChange?: InputHTMLAttributes<HTMLInputElement>['onChange']\n}\n\nexport interface UseDateOptions extends UseDateBase {\n /**\n * The initial value of the date input\n */\n initialValue?: string\n}\n\nexport interface UseDateReturn extends UseDateBase {\n /**\n * The ISO formatted date string\n */\n ISO: string\n /**\n * The value of the date input\n */\n value: string\n}\n\n/**\n * A hook for formatting and validating date inputs. The date format defaults to US Military format.\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const date = useDate({ initialValue: '01 JAN 2024' })\n * return <input onChange={date.onChange} type=\"text\" value={date.value} />\n * }\n */\nexport function useDate(options?: UseDateOptions): UseDateReturn {\n const initialValue = options?.initialValue ?? ''\n const format = options?.format ?? DateFormats.USMilitary\n const onChange = options?.onChange\n const [value, setValue] = useState(initialValue)\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const newValue = formatMilitaryDate(e.currentTarget.value)\n if (onChange) onChange(e)\n setValue(newValue)\n },\n [onChange],\n )\n\n return useMemo(\n () => ({\n format,\n value,\n ISO: formatMilitaryToISO(value),\n onChange: handleChange,\n }),\n [format, value, handleChange],\n )\n}\n\n// helpers\n\n/**\n * Converts a string in US Military format to ISO format. Used within the `useDate` hook.\n * @param input The string to format\n * @returns The formatted string in ISO format (YYYY-MM-DD)\n */\nexport function formatMilitaryToISO(input: string) {\n const [day, month, year] = input.split(' ')\n const monthIndex = MONTHS.findIndex((m) => m.startsWith(month))\n const monthNum = monthIndex + 1\n return `${year ?? '0000'}-${monthNum.toString().padStart(2, '0')}-${day.padStart(\n 2,\n '0',\n )}`\n}\n\n/**\n * Converts a string to US Military format. Used within the `useDate` hook.\n * @param input The string to format\n * @returns The formatted string in US Military format (DD MMM YYYY)\n */\nexport function formatMilitaryDate(input: string): string {\n let formatted = input.toUpperCase().replace(/[^0-9A-Z]/g, '')\n let day = ''\n let month = ''\n let year = ''\n\n // Format day\n if (formatted.length >= 2) {\n day = formatted.replace(/[^0-9]/g, '').slice(0, 2)\n const dayNum = parseInt(day, 10)\n if (dayNum > 31) day = '31'\n else if (dayNum === 0) day = '01'\n formatted = formatted.slice(2)\n }\n\n // Format month\n if (formatted.length >= 3) {\n month = formatted.slice(0, 3)\n const monthIndex = MONTHS.findIndex((m) => m.startsWith(month))\n if (monthIndex !== -1) {\n month = MONTHS[monthIndex]\n } else {\n month = month.replace(/[^A-Z]/g, '')\n }\n formatted = formatted.slice(3)\n }\n\n // Format year\n if (formatted.length > 0) {\n year = formatted.slice(0, 4)\n }\n\n return [day, month, year].filter(Boolean).join(' ')\n}\n\n/**\n * Date formatting options\n * @example\n * ```tsx\n * const date = new Date()\n * const formatted = date.format(DateFormats.USMilitary)\n */\nexport const DateFormats = {\n get ISO() {\n return 'YYYY-MM-DD'\n },\n get USMilitary() {\n return 'DD MMM YYYY'\n },\n get Months() {\n return MONTHS\n },\n}\n\nconst MONTHS = [\n 'JAN',\n 'FEB',\n 'MAR',\n 'APR',\n 'MAY',\n 'JUN',\n 'JUL',\n 'AUG',\n 'SEP',\n 'OCT',\n 'NOV',\n 'DEC',\n]\n"],"mappings":";AAEA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OAEK;AAwCA,SAAS,QAAQ,SAAyC;AAC/D,QAAM,eAAe,SAAS,gBAAgB;AAC9C,QAAM,SAAS,SAAS,UAAU,YAAY;AAC9C,QAAM,WAAW,SAAS;AAC1B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,YAAY;AAE/C,QAAM,eAAe;AAAA,IACnB,CAAC,MAAqC;AACpC,YAAM,WAAW,mBAAmB,EAAE,cAAc,KAAK;AACzD,UAAI,SAAU,UAAS,CAAC;AACxB,eAAS,QAAQ;AAAA,IACnB;AAAA,IACA,CAAC,QAAQ;AAAA,EACX;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,KAAK,oBAAoB,KAAK;AAAA,MAC9B,UAAU;AAAA,IACZ;AAAA,IACA,CAAC,QAAQ,OAAO,YAAY;AAAA,EAC9B;AACF;AASO,SAAS,oBAAoB,OAAe;AACjD,QAAM,CAAC,KAAK,OAAO,IAAI,IAAI,MAAM,MAAM,GAAG;AAC1C,QAAM,aAAa,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC;AAC9D,QAAM,WAAW,aAAa;AAC9B,SAAO,GAAG,QAAQ,MAAM,IAAI,SAAS,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI;AAAA,IACtE;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAOO,SAAS,mBAAmB,OAAuB;AACxD,MAAI,YAAY,MAAM,YAAY,EAAE,QAAQ,cAAc,EAAE;AAC5D,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,OAAO;AAGX,MAAI,UAAU,UAAU,GAAG;AACzB,UAAM,UAAU,QAAQ,WAAW,EAAE,EAAE,MAAM,GAAG,CAAC;AACjD,UAAM,SAAS,SAAS,KAAK,EAAE;AAC/B,QAAI,SAAS,GAAI,OAAM;AAAA,aACd,WAAW,EAAG,OAAM;AAC7B,gBAAY,UAAU,MAAM,CAAC;AAAA,EAC/B;AAGA,MAAI,UAAU,UAAU,GAAG;AACzB,YAAQ,UAAU,MAAM,GAAG,CAAC;AAC5B,UAAM,aAAa,OAAO,UAAU,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC;AAC9D,QAAI,eAAe,IAAI;AACrB,cAAQ,OAAO,UAAU;AAAA,IAC3B,OAAO;AACL,cAAQ,MAAM,QAAQ,WAAW,EAAE;AAAA,IACrC;AACA,gBAAY,UAAU,MAAM,CAAC;AAAA,EAC/B;AAGA,MAAI,UAAU,SAAS,GAAG;AACxB,WAAO,UAAU,MAAM,GAAG,CAAC;AAAA,EAC7B;AAEA,SAAO,CAAC,KAAK,OAAO,IAAI,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AACpD;AASO,IAAM,cAAc;AAAA,EACzB,IAAI,MAAM;AACR,WAAO;AAAA,EACT;AAAA,EACA,IAAI,aAAa;AACf,WAAO;AAAA,EACT;AAAA,EACA,IAAI,SAAS;AACX,WAAO;AAAA,EACT;AACF;AAEA,IAAM,SAAS;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal
|
|
3
|
+
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalHeader
|
|
6
|
+
} from "./chunk-ZFAIE47A.js";
|
|
1
7
|
import {
|
|
2
8
|
ModalHeading
|
|
3
9
|
} from "./chunk-2UXE5PDG.js";
|
|
4
|
-
import {
|
|
5
|
-
Portal
|
|
6
|
-
} from "./chunk-GLY7GU5S.js";
|
|
7
10
|
import {
|
|
8
11
|
Modal
|
|
9
12
|
} from "./chunk-BE4EOU2P.js";
|
|
10
13
|
import {
|
|
11
14
|
ModalDescription
|
|
12
15
|
} from "./chunk-Q7BRMIBR.js";
|
|
13
|
-
import {
|
|
14
|
-
ModalHeader
|
|
15
|
-
} from "./chunk-ZFAIE47A.js";
|
|
16
16
|
import {
|
|
17
17
|
IconButton
|
|
18
18
|
} from "./chunk-APD6IX5R.js";
|
|
19
|
+
import {
|
|
20
|
+
useModal
|
|
21
|
+
} from "./chunk-KGQG5JGW.js";
|
|
19
22
|
import {
|
|
20
23
|
Avatar
|
|
21
24
|
} from "./chunk-SPZYPRZ6.js";
|
|
22
|
-
import {
|
|
23
|
-
Button
|
|
24
|
-
} from "./chunk-EXGKZGML.js";
|
|
25
25
|
import {
|
|
26
26
|
Show
|
|
27
27
|
} from "./chunk-BUVVRQLZ.js";
|
|
28
|
+
import {
|
|
29
|
+
Button
|
|
30
|
+
} from "./chunk-EXGKZGML.js";
|
|
28
31
|
import {
|
|
29
32
|
trapFocus
|
|
30
33
|
} from "./chunk-JIZQFTW6.js";
|
|
31
34
|
import {
|
|
32
35
|
$cerberusIcons
|
|
33
36
|
} from "./chunk-VERRHMW4.js";
|
|
34
|
-
import {
|
|
35
|
-
useModal
|
|
36
|
-
} from "./chunk-7T3JIGM7.js";
|
|
37
37
|
|
|
38
38
|
// src/context/cta-modal.tsx
|
|
39
39
|
import {
|
|
@@ -152,4 +152,4 @@ export {
|
|
|
152
152
|
CTAModal,
|
|
153
153
|
useCTAModal
|
|
154
154
|
};
|
|
155
|
-
//# sourceMappingURL=chunk-
|
|
155
|
+
//# sourceMappingURL=chunk-J4LOSTEP.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/components/Portal.tsx
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
3
|
+
function Portal(props) {
|
|
4
|
+
const container = props.container || document.body;
|
|
5
|
+
return createPortal(props.children, container, props.key);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
Portal
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-K2PSHGS7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Portal.tsx"],"sourcesContent":["'use client'\n\nimport type { PropsWithChildren } from 'react'\nimport { createPortal } from 'react-dom'\n\n/**\n * This module is the Portal component.\n * @module\n */\n\nexport interface PortalProps {\n /**\n * The root container to render the children into.\n * @default document.body\n */\n container?: Element | DocumentFragment\n /**\n * An optional key to use for the Portal component.\n */\n key?: null | string\n}\n\n/**\n * The Portal component is used to render children into a DOM node that exists outside the DOM hierarchy of the parent component.\n * @see https://cerberus.digitalu.design/react/portal\n * @definition [React Portal Docs](https://react.dev/reference/react-dom/createPortal)\n * @example\n * ```tsx\n * 'use client'\n *\n * import { Portal } from '@cerberus/react'\n *\n * function SomeFeatureWithinSSRPage() {\n * return (\n * <Portal>\n * <div>Portal Content outside of the React VDom tree</div>\n * </Portal>\n * )\n * }\n */\nexport function Portal(props: PropsWithChildren<PortalProps>) {\n const container = props.container || document.body\n return createPortal(props.children, container, props.key)\n}\n"],"mappings":";AAGA,SAAS,oBAAoB;AAqCtB,SAAS,OAAO,OAAuC;AAC5D,QAAM,YAAY,MAAM,aAAa,SAAS;AAC9C,SAAO,aAAa,MAAM,UAAU,WAAW,MAAM,GAAG;AAC1D;","names":[]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal
|
|
3
|
+
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalHeader
|
|
6
|
+
} from "./chunk-ZFAIE47A.js";
|
|
1
7
|
import {
|
|
2
8
|
ModalHeading
|
|
3
9
|
} from "./chunk-2UXE5PDG.js";
|
|
4
|
-
import {
|
|
5
|
-
Portal
|
|
6
|
-
} from "./chunk-GLY7GU5S.js";
|
|
7
10
|
import {
|
|
8
11
|
Modal
|
|
9
12
|
} from "./chunk-BE4EOU2P.js";
|
|
@@ -11,26 +14,23 @@ import {
|
|
|
11
14
|
ModalDescription
|
|
12
15
|
} from "./chunk-Q7BRMIBR.js";
|
|
13
16
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./chunk-
|
|
17
|
+
useModal
|
|
18
|
+
} from "./chunk-KGQG5JGW.js";
|
|
16
19
|
import {
|
|
17
20
|
Avatar
|
|
18
21
|
} from "./chunk-SPZYPRZ6.js";
|
|
19
|
-
import {
|
|
20
|
-
Button
|
|
21
|
-
} from "./chunk-EXGKZGML.js";
|
|
22
22
|
import {
|
|
23
23
|
Show
|
|
24
24
|
} from "./chunk-BUVVRQLZ.js";
|
|
25
|
+
import {
|
|
26
|
+
Button
|
|
27
|
+
} from "./chunk-EXGKZGML.js";
|
|
25
28
|
import {
|
|
26
29
|
trapFocus
|
|
27
30
|
} from "./chunk-JIZQFTW6.js";
|
|
28
31
|
import {
|
|
29
32
|
$cerberusIcons
|
|
30
33
|
} from "./chunk-VERRHMW4.js";
|
|
31
|
-
import {
|
|
32
|
-
useModal
|
|
33
|
-
} from "./chunk-7T3JIGM7.js";
|
|
34
34
|
|
|
35
35
|
// src/context/confirm-modal.tsx
|
|
36
36
|
import {
|
|
@@ -176,4 +176,4 @@ export {
|
|
|
176
176
|
ConfirmModal,
|
|
177
177
|
useConfirmModal
|
|
178
178
|
};
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-KFGI37CO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useModal.ts"],"sourcesContent":["'use client'\n\nimport { useCallback, useMemo, useRef, useState, type RefObject } from 'react'\n\n/**\n * This module provides a hook for using a custom modal.\n * @module\n */\n\nexport interface UseModalReturnValue {\n /**\n * The ref for the modal.\n */\n modalRef: RefObject<HTMLDialogElement>\n /**\n * Shows the modal.\n */\n show: () => void\n /**\n * Closes the modal.\n */\n close: () => void\n /**\n * Whether the modal is open based on the show and close methods.\n */\n isOpen: boolean\n}\n\n/**\n * Provides a hook for using a custom modal via the native dialog element\n * methods.\n *\n * Cerberus modals use the native dialog element. This hook\n * does not control the modal via React state but rather by calling the\n * native dialog element's `showModal` and `close` methods.\n *\n * @memberof module:Modal\n * @see https://cerberus.digitalu.design/react/modal\n * @description [Moz Dev Dialog Docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLDialogElement/showModal)\n */\nexport function useModal(): UseModalReturnValue {\n const modalRef = useRef<HTMLDialogElement | null>(null)\n const [isOpen, setIsOpen] = useState<boolean>(false)\n\n const show = useCallback(() => {\n modalRef.current?.showModal()\n setIsOpen(true)\n }, [])\n\n const close = useCallback(() => {\n modalRef.current?.close()\n setIsOpen(false)\n }, [])\n\n return useMemo(() => {\n return {\n modalRef,\n show,\n close,\n isOpen,\n }\n }, [modalRef, show, close, isOpen])\n}\n"],"mappings":";AAEA,SAAS,aAAa,SAAS,QAAQ,gBAAgC;AAsChE,SAAS,WAAgC;AAC9C,QAAM,WAAW,OAAiC,IAAI;AACtD,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAkB,KAAK;AAEnD,QAAM,OAAO,YAAY,MAAM;AAC7B,aAAS,SAAS,UAAU;AAC5B,cAAU,IAAI;AAAA,EAChB,GAAG,CAAC,CAAC;AAEL,QAAM,QAAQ,YAAY,MAAM;AAC9B,aAAS,SAAS,MAAM;AACxB,cAAU,KAAK;AAAA,EACjB,GAAG,CAAC,CAAC;AAEL,SAAO,QAAQ,MAAM;AACnB,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF,GAAG,CAAC,UAAU,MAAM,OAAO,MAAM,CAAC;AACpC;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/components/Tooltip.tsx
|
|
2
|
+
import {
|
|
3
|
+
Tooltip as ArkTooltip
|
|
4
|
+
} from "@ark-ui/react/tooltip";
|
|
5
|
+
import { cx } from "@cerberus/styled-system/css";
|
|
6
|
+
import { tooltip } from "@cerberus/styled-system/recipes";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
function Tooltip(props) {
|
|
9
|
+
const { content, children, ...nativeProps } = props;
|
|
10
|
+
const styles = tooltip();
|
|
11
|
+
const position = {
|
|
12
|
+
placement: props.position || "top"
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ jsxs(ArkTooltip.Root, { openDelay: 400, positioning: position, children: [
|
|
15
|
+
/* @__PURE__ */ jsx(ArkTooltip.Trigger, { className: styles.trigger, children }),
|
|
16
|
+
/* @__PURE__ */ jsx(ArkTooltip.Positioner, { children: /* @__PURE__ */ jsxs(
|
|
17
|
+
ArkTooltip.Content,
|
|
18
|
+
{
|
|
19
|
+
...nativeProps,
|
|
20
|
+
className: cx(nativeProps.className, styles.content),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx(ArkTooltip.Arrow, { className: styles.arrow, children: /* @__PURE__ */ jsx(ArkTooltip.ArrowTip, { className: styles.arrowTip }) }),
|
|
23
|
+
content
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) })
|
|
27
|
+
] });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
Tooltip
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=chunk-KML4CTMK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/Tooltip.tsx"],"sourcesContent":["import {\n Tooltip as ArkTooltip,\n type TooltipContentProps,\n} from '@ark-ui/react/tooltip'\nimport { cx } from '@cerberus/styled-system/css'\nimport { tooltip } from '@cerberus/styled-system/recipes'\nimport type { ReactNode } from 'react'\n\n/**\n * This module contains the Tooltip component.\n * @module Tooltip\n */\n\nexport interface TooltipProps {\n /**\n * The text content to display in the tooltip.\n */\n content: ReactNode\n /**\n * The position of the tooltip relative to the trigger element.\n */\n position?: 'top' | 'right' | 'bottom' | 'left'\n}\n\n/**\n * The Tooltip component is used to provide additional information about an element when it is hovered over.\n * @definition [Tooltip docs](https://cerberus.digitalu.design/react/tooltip)\n * @example\n * ```tsx\n * <Tooltip content=\"This is a tooltip\">\n * <Information />\n * </Tooltip>\n */\nexport function Tooltip(props: TooltipProps & TooltipContentProps) {\n const { content, children, ...nativeProps } = props\n const styles = tooltip()\n const position = {\n placement: props.position || 'top',\n }\n\n return (\n <ArkTooltip.Root openDelay={400} positioning={position}>\n <ArkTooltip.Trigger className={styles.trigger}>\n {children}\n </ArkTooltip.Trigger>\n\n <ArkTooltip.Positioner>\n <ArkTooltip.Content\n {...nativeProps}\n className={cx(nativeProps.className, styles.content)}\n >\n <ArkTooltip.Arrow className={styles.arrow}>\n <ArkTooltip.ArrowTip className={styles.arrowTip} />\n </ArkTooltip.Arrow>\n\n {content}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n </ArkTooltip.Root>\n )\n}\n"],"mappings":";AAAA;AAAA,EACE,WAAW;AAAA,OAEN;AACP,SAAS,UAAU;AACnB,SAAS,eAAe;AAqClB,cAKE,YALF;AATC,SAAS,QAAQ,OAA2C;AACjE,QAAM,EAAE,SAAS,UAAU,GAAG,YAAY,IAAI;AAC9C,QAAM,SAAS,QAAQ;AACvB,QAAM,WAAW;AAAA,IACf,WAAW,MAAM,YAAY;AAAA,EAC/B;AAEA,SACE,qBAAC,WAAW,MAAX,EAAgB,WAAW,KAAK,aAAa,UAC5C;AAAA,wBAAC,WAAW,SAAX,EAAmB,WAAW,OAAO,SACnC,UACH;AAAA,IAEA,oBAAC,WAAW,YAAX,EACC;AAAA,MAAC,WAAW;AAAA,MAAX;AAAA,QACE,GAAG;AAAA,QACJ,WAAW,GAAG,YAAY,WAAW,OAAO,OAAO;AAAA,QAEnD;AAAA,8BAAC,WAAW,OAAX,EAAiB,WAAW,OAAO,OAClC,8BAAC,WAAW,UAAX,EAAoB,WAAW,OAAO,UAAU,GACnD;AAAA,UAEC;AAAA;AAAA;AAAA,IACH,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal
|
|
3
|
+
} from "./chunk-K2PSHGS7.js";
|
|
1
4
|
import {
|
|
2
5
|
Notification
|
|
3
6
|
} from "./chunk-7SGPJM66.js";
|
|
@@ -8,14 +11,11 @@ import {
|
|
|
8
11
|
NotificationHeading
|
|
9
12
|
} from "./chunk-SXIXDXG3.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
14
|
+
Show
|
|
15
|
+
} from "./chunk-BUVVRQLZ.js";
|
|
13
16
|
import {
|
|
14
17
|
Button
|
|
15
18
|
} from "./chunk-EXGKZGML.js";
|
|
16
|
-
import {
|
|
17
|
-
Show
|
|
18
|
-
} from "./chunk-BUVVRQLZ.js";
|
|
19
19
|
|
|
20
20
|
// src/context/notification-center.tsx
|
|
21
21
|
import {
|
|
@@ -72,7 +72,7 @@ function NotificationCenter(props) {
|
|
|
72
72
|
palette: "action",
|
|
73
73
|
shape: "rounded",
|
|
74
74
|
size: "sm",
|
|
75
|
-
usage: "
|
|
75
|
+
usage: "ghost",
|
|
76
76
|
children: "Close all"
|
|
77
77
|
}
|
|
78
78
|
) }),
|
|
@@ -159,4 +159,4 @@ export {
|
|
|
159
159
|
NotificationCenter,
|
|
160
160
|
useNotificationCenter
|
|
161
161
|
};
|
|
162
|
-
//# sourceMappingURL=chunk-
|
|
162
|
+
//# sourceMappingURL=chunk-KUT2YEEQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/context/notification-center.tsx"],"sourcesContent":["'use client'\n\nimport {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n type MouseEvent,\n type PropsWithChildren,\n type ReactNode,\n} from 'react'\nimport { Show } from '../components/Show'\nimport { NotificationHeading } from '../components/NotificationHeading'\nimport { NotificationDescription } from '../components/NotificationDescription'\nimport { Notification } from '../components/Notification'\nimport { animateIn, vstack } from '@cerberus/styled-system/patterns'\nimport { Portal, type PortalProps } from '../components/Portal'\nimport { notification } from '@cerberus/styled-system/recipes'\nimport { Button } from '../components/Button'\nimport { cx } from '@cerberus/styled-system/css'\n\n/**\n * This module provides a context and hook for notifications.\n * @module\n */\n\nexport interface NotifyOptions {\n /**\n * The palette of the notification.\n * @default 'info'\n */\n palette: 'info' | 'success' | 'warning' | 'danger'\n /**\n * The heading of the notification.\n */\n heading: string\n /**\n * The unique id of the notification.\n */\n id?: string\n /**\n * The description of the notification.\n */\n description?: ReactNode\n /**\n * The action to take when the notification is closed\n */\n onClose?: () => void\n}\n\nexport interface NotificationsValue {\n notify: (options: NotifyOptions) => void\n}\n\nconst NotificationsContext = createContext<NotificationsValue | null>(null)\n\nexport interface NotificationsProviderProps extends PortalProps {}\n\n/**\n * Provides a notification center to the app.\n * @see https://cerberus.digitalu.design/react/notification\n * @example\n * ```tsx\n * // Wrap the Provider around the root of the feature.\n * <Notifications>\n * <SomeFeatureSection />\n * </Notifications>\n *\n * // Use the hook to show a notification.\n * const notify = useNotifications()\n *\n * const handleClick = useCallback(() => {\n * notify({\n * palette: 'info',\n * heading: 'New feature!',\n * description: 'We have added a new feature to the app.',\n * })\n * }, [notify])\n * ```\n */\nexport function NotificationCenter(\n props: PropsWithChildren<NotificationsProviderProps>,\n) {\n const [activeNotifications, setActiveNotifications] = useState<\n NotifyOptions[]\n >([])\n const styles = notification()\n\n const handleNotify = useCallback((options: NotifyOptions) => {\n setActiveNotifications((prev) => {\n const id = `${options.palette}:${prev.length + 1}`\n return [...prev, { ...options, id }]\n })\n }, [])\n\n const handleClose = useCallback((e: MouseEvent<HTMLButtonElement>) => {\n const target = e.currentTarget as HTMLButtonElement\n setActiveNotifications((prev) => {\n const item = prev.find((option) => option.id === target.value)\n if (item?.onClose) item.onClose()\n return prev.filter((option) => option.id !== target.value)\n })\n }, [])\n\n const handleCloseAll = useCallback(() => {\n setActiveNotifications((prev) => {\n prev.forEach((item) => {\n if (item.onClose) item.onClose()\n })\n return []\n })\n }, [])\n\n const value = useMemo(\n () => ({\n notify: handleNotify,\n }),\n [handleNotify],\n )\n\n // For some reason, the vstack pattern alignItems is not registering here.\n // So we are forcing it with the style prop.\n\n return (\n <NotificationsContext.Provider value={value}>\n {props.children}\n\n <Show when={activeNotifications.length > 0}>\n <Portal container={props.container}>\n <div className={styles.center}>\n <Show when={activeNotifications.length >= 4}>\n <Button\n className={cx(styles.closeAll, animateIn())}\n onClick={handleCloseAll}\n palette=\"action\"\n shape=\"rounded\"\n size=\"sm\"\n usage=\"ghost\"\n >\n Close all\n </Button>\n </Show>\n <div\n className={vstack({\n alignItems: 'flex-end',\n gap: '4',\n })}\n style={{\n alignItems: 'flex-end',\n }}\n >\n {activeNotifications.map((option) => (\n <MatchNotification\n key={option.id}\n {...option}\n onClose={handleClose}\n />\n ))}\n </div>\n </div>\n </Portal>\n </Show>\n </NotificationsContext.Provider>\n )\n}\n\ninterface MatchNotificationProps extends Omit<NotifyOptions, 'onClose'> {\n onClose: (e: MouseEvent<HTMLButtonElement>) => void\n key: string | undefined\n}\n\nfunction MatchNotification(props: MatchNotificationProps) {\n const { palette, id, onClose, heading, description } = props\n\n switch (palette) {\n case 'success':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"success\"\n >\n <NotificationHeading palette=\"success\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"success\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'warning':\n return (\n <Notification\n id={id!}\n key={id}\n onClose={onClose}\n open\n palette=\"warning\"\n >\n <NotificationHeading palette=\"warning\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"warning\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'danger':\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"danger\">\n <NotificationHeading palette=\"danger\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"danger\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n\n case 'info':\n default:\n return (\n <Notification id={id!} key={id} onClose={onClose} open palette=\"info\">\n <NotificationHeading palette=\"info\">{heading}</NotificationHeading>\n <NotificationDescription palette=\"info\">\n {description}\n </NotificationDescription>\n </Notification>\n )\n }\n}\n\n/**\n * The hook to use the NotificationCenter.\n * @returns The notify method to trigger a notification.\n * @example\n * ```tsx\n * const {notify} = useNotificationCenter()\n * notify({\n * palette: 'info',\n * heading: 'New feature',\n * description: 'We have added a new feature to the app.',\n * })\n * ```\n */\nexport function useNotificationCenter(): NotificationsValue {\n const context = useContext(NotificationsContext)\n if (!context) {\n throw new Error(\n 'useNotificationCenter must be used within a NotificationsProvider',\n )\n }\n return context\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Portal
|
|
3
|
+
} from "./chunk-K2PSHGS7.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalHeader
|
|
6
|
+
} from "./chunk-ZFAIE47A.js";
|
|
1
7
|
import {
|
|
2
8
|
ModalHeading
|
|
3
9
|
} from "./chunk-2UXE5PDG.js";
|
|
4
|
-
import {
|
|
5
|
-
Portal
|
|
6
|
-
} from "./chunk-GLY7GU5S.js";
|
|
7
10
|
import {
|
|
8
11
|
Input
|
|
9
12
|
} from "./chunk-NKM6PISB.js";
|
|
@@ -17,29 +20,26 @@ import {
|
|
|
17
20
|
ModalDescription
|
|
18
21
|
} from "./chunk-Q7BRMIBR.js";
|
|
19
22
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
23
|
+
Field
|
|
24
|
+
} from "./chunk-UZDVOIW5.js";
|
|
25
|
+
import {
|
|
26
|
+
useModal
|
|
27
|
+
} from "./chunk-KGQG5JGW.js";
|
|
22
28
|
import {
|
|
23
29
|
Avatar
|
|
24
30
|
} from "./chunk-SPZYPRZ6.js";
|
|
25
|
-
import {
|
|
26
|
-
Button
|
|
27
|
-
} from "./chunk-EXGKZGML.js";
|
|
28
|
-
import {
|
|
29
|
-
Field
|
|
30
|
-
} from "./chunk-UZDVOIW5.js";
|
|
31
31
|
import {
|
|
32
32
|
Show
|
|
33
33
|
} from "./chunk-BUVVRQLZ.js";
|
|
34
|
+
import {
|
|
35
|
+
Button
|
|
36
|
+
} from "./chunk-EXGKZGML.js";
|
|
34
37
|
import {
|
|
35
38
|
trapFocus
|
|
36
39
|
} from "./chunk-JIZQFTW6.js";
|
|
37
40
|
import {
|
|
38
41
|
$cerberusIcons
|
|
39
42
|
} from "./chunk-VERRHMW4.js";
|
|
40
|
-
import {
|
|
41
|
-
useModal
|
|
42
|
-
} from "./chunk-7T3JIGM7.js";
|
|
43
43
|
|
|
44
44
|
// src/context/prompt-modal.tsx
|
|
45
45
|
import {
|
|
@@ -240,4 +240,4 @@ export {
|
|
|
240
240
|
PromptModal,
|
|
241
241
|
usePromptModal
|
|
242
242
|
};
|
|
243
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-NCUHRVW2.js.map
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
FileStatus,
|
|
4
4
|
processStatus
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-7MM5KYEX.js";
|
|
6
6
|
import "../chunk-KCANMM64.js";
|
|
7
7
|
import "../chunk-APD6IX5R.js";
|
|
8
8
|
import "../chunk-JWIJHSI6.js";
|
|
9
|
-
import "../chunk-SPZYPRZ6.js";
|
|
10
9
|
import "../chunk-UZDVOIW5.js";
|
|
10
|
+
import "../chunk-SPZYPRZ6.js";
|
|
11
11
|
import "../chunk-BUVVRQLZ.js";
|
|
12
12
|
import "../chunk-VERRHMW4.js";
|
|
13
13
|
import "../chunk-F27AAKQ3.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|