@taiv/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/components/Data/CheckboxTable.d.ts +21 -0
- package/dist/components/Data/CheckboxTable.d.ts.map +1 -0
- package/dist/components/Data/CheckboxTable.js +85 -0
- package/dist/components/Data/RemovableItemList.d.ts +10 -0
- package/dist/components/Data/RemovableItemList.d.ts.map +1 -0
- package/dist/components/Data/RemovableItemList.js +44 -0
- package/dist/components/Info/Modals/ConfirmationModal.d.ts +18 -0
- package/dist/components/Info/Modals/ConfirmationModal.d.ts.map +1 -0
- package/dist/components/Info/Modals/ConfirmationModal.js +76 -0
- package/dist/components/Info/Modals/InfoModal.d.ts +15 -0
- package/dist/components/Info/Modals/InfoModal.d.ts.map +1 -0
- package/dist/components/Info/Modals/InfoModal.js +70 -0
- package/dist/components/Info/Modals/Modal.d.ts +13 -0
- package/dist/components/Info/Modals/Modal.d.ts.map +1 -0
- package/dist/components/Info/Modals/Modal.js +42 -0
- package/dist/components/Info/Modals/ModalProvider.d.ts +5 -0
- package/dist/components/Info/Modals/ModalProvider.d.ts.map +1 -0
- package/dist/components/Info/Modals/ModalProvider.js +15 -0
- package/dist/components/Info/Modals/variants.d.ts +63 -0
- package/dist/components/Info/Modals/variants.d.ts.map +1 -0
- package/dist/components/Info/Modals/variants.js +63 -0
- package/dist/components/Info/Notifications/NotificationProvider.d.ts +2 -0
- package/dist/components/Info/Notifications/NotificationProvider.d.ts.map +1 -0
- package/dist/components/Info/Notifications/NotificationProvider.js +46 -0
- package/dist/components/Info/Notifications/Notifications.d.ts +16 -0
- package/dist/components/Info/Notifications/Notifications.d.ts.map +1 -0
- package/dist/components/Info/Notifications/Notifications.js +41 -0
- package/dist/components/Info/Notifications/variants.d.ts +39 -0
- package/dist/components/Info/Notifications/variants.d.ts.map +1 -0
- package/dist/components/Info/Notifications/variants.js +41 -0
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts +18 -0
- package/dist/components/Info/Tooltips/InfoTooltip.d.ts.map +1 -0
- package/dist/components/Info/Tooltips/InfoTooltip.js +20 -0
- package/dist/components/Info/Tooltips/Tooltip.d.ts +13 -0
- package/dist/components/Info/Tooltips/Tooltip.d.ts.map +1 -0
- package/dist/components/Info/Tooltips/Tooltip.js +35 -0
- package/dist/components/Inputs/Buttons/Button.d.ts +11 -0
- package/dist/components/Inputs/Buttons/Button.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/Button.js +27 -0
- package/dist/components/Inputs/Buttons/UnstyledButton.d.ts +10 -0
- package/dist/components/Inputs/Buttons/UnstyledButton.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/UnstyledButton.js +6 -0
- package/dist/components/Inputs/Buttons/shared/sizes.d.ts +25 -0
- package/dist/components/Inputs/Buttons/shared/sizes.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/shared/sizes.js +7 -0
- package/dist/components/Inputs/Buttons/shared/variants.d.ts +141 -0
- package/dist/components/Inputs/Buttons/shared/variants.d.ts.map +1 -0
- package/dist/components/Inputs/Buttons/shared/variants.js +141 -0
- package/dist/components/Inputs/Controls/Checkbox.d.ts +27 -0
- package/dist/components/Inputs/Controls/Checkbox.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/Checkbox.js +55 -0
- package/dist/components/Inputs/Controls/Toggle.d.ts +29 -0
- package/dist/components/Inputs/Controls/Toggle.d.ts.map +1 -0
- package/dist/components/Inputs/Controls/Toggle.js +42 -0
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts +14 -0
- package/dist/components/Inputs/Dropdowns/FontSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/FontSelect.js +48 -0
- package/dist/components/Inputs/Dropdowns/MultiSelect.d.ts +12 -0
- package/dist/components/Inputs/Dropdowns/MultiSelect.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/MultiSelect.js +94 -0
- package/dist/components/Inputs/Dropdowns/Select.d.ts +11 -0
- package/dist/components/Inputs/Dropdowns/Select.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/Select.js +62 -0
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts +12 -0
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/shared/fontSelectList.js +68 -0
- package/dist/components/Inputs/Dropdowns/shared/sizes.d.ts +36 -0
- package/dist/components/Inputs/Dropdowns/shared/sizes.d.ts.map +1 -0
- package/dist/components/Inputs/Dropdowns/shared/sizes.js +33 -0
- package/dist/components/Inputs/Sliders/Slider.d.ts +16 -0
- package/dist/components/Inputs/Sliders/Slider.d.ts.map +1 -0
- package/dist/components/Inputs/Sliders/Slider.js +91 -0
- package/dist/components/Inputs/Sliders/VolumeSlider.d.ts +6 -0
- package/dist/components/Inputs/Sliders/VolumeSlider.d.ts.map +1 -0
- package/dist/components/Inputs/Sliders/VolumeSlider.js +37 -0
- package/dist/components/Inputs/Sliders/shared/sizes.d.ts +45 -0
- package/dist/components/Inputs/Sliders/shared/sizes.d.ts.map +1 -0
- package/dist/components/Inputs/Sliders/shared/sizes.js +27 -0
- package/dist/components/Inputs/TextInputs/AutoComplete.d.ts +11 -0
- package/dist/components/Inputs/TextInputs/AutoComplete.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/AutoComplete.js +57 -0
- package/dist/components/Inputs/TextInputs/PasswordInput.d.ts +12 -0
- package/dist/components/Inputs/TextInputs/PasswordInput.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/PasswordInput.js +52 -0
- package/dist/components/Inputs/TextInputs/SearchBar.d.ts +7 -0
- package/dist/components/Inputs/TextInputs/SearchBar.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/SearchBar.js +23 -0
- package/dist/components/Inputs/TextInputs/TextArea.d.ts +12 -0
- package/dist/components/Inputs/TextInputs/TextArea.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/TextArea.js +33 -0
- package/dist/components/Inputs/TextInputs/TextInput.d.ts +12 -0
- package/dist/components/Inputs/TextInputs/TextInput.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/TextInput.js +32 -0
- package/dist/components/Inputs/TextInputs/shared/sizes.d.ts +27 -0
- package/dist/components/Inputs/TextInputs/shared/sizes.d.ts.map +1 -0
- package/dist/components/Inputs/TextInputs/shared/sizes.js +6 -0
- package/dist/components/Layout/Box.d.ts +10 -0
- package/dist/components/Layout/Box.d.ts.map +1 -0
- package/dist/components/Layout/Box.js +6 -0
- package/dist/components/Layout/Center.d.ts +9 -0
- package/dist/components/Layout/Center.d.ts.map +1 -0
- package/dist/components/Layout/Center.js +6 -0
- package/dist/components/Layout/Divider.d.ts +9 -0
- package/dist/components/Layout/Divider.d.ts.map +1 -0
- package/dist/components/Layout/Divider.js +7 -0
- package/dist/components/Layout/Frame.d.ts +12 -0
- package/dist/components/Layout/Frame.d.ts.map +1 -0
- package/dist/components/Layout/Frame.js +7 -0
- package/dist/components/Layout/Group.d.ts +10 -0
- package/dist/components/Layout/Group.d.ts.map +1 -0
- package/dist/components/Layout/Group.js +6 -0
- package/dist/components/Layout/Loader.d.ts +8 -0
- package/dist/components/Layout/Loader.d.ts.map +1 -0
- package/dist/components/Layout/Loader.js +6 -0
- package/dist/components/Layout/Stack.d.ts +10 -0
- package/dist/components/Layout/Stack.d.ts.map +1 -0
- package/dist/components/Layout/Stack.js +6 -0
- package/dist/components/Misc/Copy.d.ts +10 -0
- package/dist/components/Misc/Copy.d.ts.map +1 -0
- package/dist/components/Misc/Copy.js +18 -0
- package/dist/components/Misc/MediaQuery.d.ts +3 -0
- package/dist/components/Misc/MediaQuery.d.ts.map +1 -0
- package/dist/components/Misc/MediaQuery.js +2 -0
- package/dist/components/Misc/Transition.d.ts +4 -0
- package/dist/components/Misc/Transition.d.ts.map +1 -0
- package/dist/components/Misc/Transition.js +6 -0
- package/dist/components/Typography/CollapsibleText.d.ts +14 -0
- package/dist/components/Typography/CollapsibleText.d.ts.map +1 -0
- package/dist/components/Typography/CollapsibleText.js +16 -0
- package/dist/components/Typography/Text.d.ts +14 -0
- package/dist/components/Typography/Text.d.ts.map +1 -0
- package/dist/components/Typography/Text.js +20 -0
- package/dist/components/Typography/Title.d.ts +22 -0
- package/dist/components/Typography/Title.d.ts.map +1 -0
- package/dist/components/Typography/Title.js +30 -0
- package/dist/components/index.d.ts +38 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +43 -0
- package/dist/constants/colors.d.ts +79 -0
- package/dist/constants/colors.d.ts.map +1 -0
- package/dist/constants/colors.js +53 -0
- package/dist/constants/font.d.ts +245 -0
- package/dist/constants/font.d.ts.map +1 -0
- package/dist/constants/font.js +114 -0
- package/dist/constants/index.d.ts +3 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/constants/index.js +2 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# taiv-ui-toolkit
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TableColumnProps {
|
|
3
|
+
label: string;
|
|
4
|
+
width?: string | number;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
key: string;
|
|
8
|
+
}
|
|
9
|
+
interface CheckboxTableProps {
|
|
10
|
+
columns: TableColumnProps[];
|
|
11
|
+
data: Record<string, any>[];
|
|
12
|
+
className?: string;
|
|
13
|
+
onRowClick?: (row: Record<string, any>) => void;
|
|
14
|
+
title?: string;
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
showColumnTitles?: boolean;
|
|
17
|
+
outlines?: boolean;
|
|
18
|
+
}
|
|
19
|
+
declare const CheckboxTable: ({ columns, data, className, onRowClick, title, subtitle, showColumnTitles, outlines, }: CheckboxTableProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export { CheckboxTable };
|
|
21
|
+
//# sourceMappingURL=CheckboxTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxTable.d.ts","sourceRoot":"","sources":["../../../src/components/Data/CheckboxTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,kBAAkB;IAC1B,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,QAAA,MAAM,aAAa,GAAI,wFASpB,kBAAkB,4CAuHpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMediaQuery } from '@mantine/hooks';
|
|
3
|
+
import { Checkbox } from '../Inputs/Controls/Checkbox';
|
|
4
|
+
import { Group } from '../Layout/Group';
|
|
5
|
+
import { Box } from '../Layout/Box';
|
|
6
|
+
import { Center } from '../Layout/Center';
|
|
7
|
+
import { Stack } from '../Layout/Stack';
|
|
8
|
+
import { Title } from '../Typography/Title';
|
|
9
|
+
import { neutral } from '../../constants/colors';
|
|
10
|
+
import { fontStyle } from '../../constants/font';
|
|
11
|
+
const CheckboxTable = ({ columns, data, className = 'none', onRowClick, title, subtitle, showColumnTitles = false, outlines = false, }) => {
|
|
12
|
+
const isMobile = useMediaQuery('(max-width: 768px)');
|
|
13
|
+
const style = {
|
|
14
|
+
container: {
|
|
15
|
+
borderRadius: '8px',
|
|
16
|
+
border: `1px solid ${neutral[50]}`,
|
|
17
|
+
padding: '0.8rem',
|
|
18
|
+
backgroundColor: 'white',
|
|
19
|
+
},
|
|
20
|
+
header: {
|
|
21
|
+
padding: '1.6rem',
|
|
22
|
+
minWidth: '0',
|
|
23
|
+
},
|
|
24
|
+
columns: {
|
|
25
|
+
paddingTop: '1.6rem',
|
|
26
|
+
paddingLeft: '3.6rem',
|
|
27
|
+
whiteSpace: 'nowrap',
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
},
|
|
30
|
+
column: {
|
|
31
|
+
justifyContent: isMobile ? 'flex-start' : 'center',
|
|
32
|
+
...fontStyle['body'],
|
|
33
|
+
color: neutral[300],
|
|
34
|
+
padding: '0.8rem 1.6rem',
|
|
35
|
+
minWidth: '10rem',
|
|
36
|
+
},
|
|
37
|
+
tableBody: {
|
|
38
|
+
gap: isMobile ? '0.5rem' : '0.25rem',
|
|
39
|
+
minWidth: '0',
|
|
40
|
+
},
|
|
41
|
+
tableRow: {
|
|
42
|
+
padding: isMobile ? '0.8rem 1.6rem' : '0.4rem 3.2rem',
|
|
43
|
+
backgroundColor: '#FFFFFF',
|
|
44
|
+
minWidth: '0',
|
|
45
|
+
gap: isMobile ? '2.4rem' : '0',
|
|
46
|
+
...(outlines && { borderTop: `1px solid ${neutral[50]}` }),
|
|
47
|
+
},
|
|
48
|
+
contentContainer: {
|
|
49
|
+
flex: 1,
|
|
50
|
+
flexDirection: (isMobile ? 'column' : 'row'),
|
|
51
|
+
gap: '0.25rem',
|
|
52
|
+
minWidth: 0,
|
|
53
|
+
},
|
|
54
|
+
item: {
|
|
55
|
+
justifyContent: isMobile ? 'flex-start' : 'space-between',
|
|
56
|
+
minWidth: isMobile ? '0' : '10rem',
|
|
57
|
+
...fontStyle['body'],
|
|
58
|
+
fontWeight: 400,
|
|
59
|
+
color: neutral[200],
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
const renderColumnTitles = () => {
|
|
63
|
+
return (_jsx(Group, { style: style.columns, children: columns === null || columns === void 0 ? void 0 : columns.map((column, index) => (_jsx(Box, { style: {
|
|
64
|
+
...style.column,
|
|
65
|
+
width: column.width || '100%',
|
|
66
|
+
...(column.className && { className: column.className }),
|
|
67
|
+
...(column.style && { ...column.style }),
|
|
68
|
+
}, children: column.label }, column.key))) }));
|
|
69
|
+
};
|
|
70
|
+
const renderRow = (row) => {
|
|
71
|
+
return (_jsxs(_Fragment, { children: [_jsx(Center, { mr: isMobile ? 0 : '3.2rem', ml: isMobile ? 0 : '-1.6rem', children: _jsx(Checkbox, { checked: row.checked, onChange: () => onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick(row) }) }), _jsx(Group, { style: style.contentContainer, children: columns === null || columns === void 0 ? void 0 : columns.map((column, index) => {
|
|
72
|
+
const text = row[column.key] || '';
|
|
73
|
+
const className = column.className || '';
|
|
74
|
+
return (_jsx(Box, { style: {
|
|
75
|
+
...style.item,
|
|
76
|
+
width: column.width || '100%',
|
|
77
|
+
flex: isMobile ? 'none' : column.key === 'volume' ? '1 1 30rem' : '0 0 auto',
|
|
78
|
+
minWidth: isMobile ? '0' : column.key === 'volume' ? '30rem' : '10rem',
|
|
79
|
+
...(className && { className }),
|
|
80
|
+
}, children: text }, index));
|
|
81
|
+
}) })] }));
|
|
82
|
+
};
|
|
83
|
+
return (_jsxs(Box, { style: style.container, children: [_jsxs(Stack, { style: style.header, children: [title && _jsx(Title, { variant: "cardHeader", children: title }), subtitle && _jsx(Title, { variant: "cardSubheader", children: subtitle }), showColumnTitles && !isMobile && renderColumnTitles()] }), _jsx(Stack, { style: style.tableBody, children: data === null || data === void 0 ? void 0 : data.map((row, index) => (_jsx(Group, { style: style.tableRow, children: renderRow(row) }, index))) })] }));
|
|
84
|
+
};
|
|
85
|
+
export { CheckboxTable };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RemovableItemListProps {
|
|
3
|
+
items: React.ReactNode[];
|
|
4
|
+
onRemove?: (item: React.ReactNode, index: number) => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
disabledIndices?: number[];
|
|
7
|
+
}
|
|
8
|
+
declare const RemovableItemList: ({ items, onRemove, title, disabledIndices }: RemovableItemListProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export { RemovableItemList };
|
|
10
|
+
//# sourceMappingURL=RemovableItemList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemovableItemList.d.ts","sourceRoot":"","sources":["../../../src/components/Data/RemovableItemList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,sBAAsB;IAC9B,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,QAAA,MAAM,iBAAiB,GAAI,6CAAkD,sBAAsB,4CAgElG,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from '@mantine/core';
|
|
3
|
+
import { neutral, error } from '../../constants/colors';
|
|
4
|
+
import { fontStyle } from '../../constants/font';
|
|
5
|
+
import { Title } from '../Typography/Title';
|
|
6
|
+
const RemovableItemList = ({ items, onRemove, title, disabledIndices = [] }) => {
|
|
7
|
+
const style = {
|
|
8
|
+
container: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
flexDirection: 'column',
|
|
11
|
+
borderRadius: '8px',
|
|
12
|
+
width: '100%',
|
|
13
|
+
overflow: 'hidden',
|
|
14
|
+
border: `1px solid ${neutral[50]}`,
|
|
15
|
+
},
|
|
16
|
+
titleContainer: {
|
|
17
|
+
display: 'flex',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
padding: '1.2rem 1.6rem',
|
|
20
|
+
backgroundColor: neutral[50],
|
|
21
|
+
},
|
|
22
|
+
itemContainer: {
|
|
23
|
+
display: 'flex',
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
padding: '1.2rem 1.6rem',
|
|
27
|
+
},
|
|
28
|
+
itemText: {
|
|
29
|
+
...fontStyle['body'],
|
|
30
|
+
fontWeight: 400,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs(Box, { style: style.container, children: [title && (_jsx(Box, { style: style.titleContainer, children: _jsx(Title, { variant: "cardSubheader", weight: "semibold", children: title }) })), items === null || items === void 0 ? void 0 : items.map((item, index) => (_jsxs(Box, { style: {
|
|
34
|
+
...style.itemContainer,
|
|
35
|
+
borderTop: index > 0 ? `1px solid ${neutral[50]}` : 'none',
|
|
36
|
+
}, children: [_jsx(Text, { style: style.itemText, children: item }), onRemove && (_jsx("i", { className: "fas fa-trash-alt", style: {
|
|
37
|
+
opacity: disabledIndices.includes(index) ? 0.5 : 1,
|
|
38
|
+
cursor: disabledIndices.includes(index) ? 'default' : 'pointer',
|
|
39
|
+
color: disabledIndices.includes(index) ? neutral[200] : error[100],
|
|
40
|
+
fontSize: '1.625rem',
|
|
41
|
+
fontWeight: 100,
|
|
42
|
+
}, onClick: () => !disabledIndices.includes(index) && onRemove(item, index) }))] }, index)))] }));
|
|
43
|
+
};
|
|
44
|
+
export { RemovableItemList };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { modalVariants } from './variants';
|
|
3
|
+
export declare const useConfirmationModal: () => {
|
|
4
|
+
show: (options: {
|
|
5
|
+
variant?: Exclude<keyof typeof modalVariants, "error">;
|
|
6
|
+
title?: string;
|
|
7
|
+
message?: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
cancelLabel?: string;
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
onConfirm?: () => void;
|
|
12
|
+
onCancel?: () => void;
|
|
13
|
+
size?: string | number;
|
|
14
|
+
}) => void;
|
|
15
|
+
close: (modalId: string) => void;
|
|
16
|
+
closeAll: () => void;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=ConfirmationModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Modals/ConfirmationModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAI3C,eAAO,MAAM,oBAAoB;oBACR;QACrB,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,OAAO,aAAa,EAAE,OAAO,CAAC,CAAC;QACvD,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;QACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB;qBAkGuB,MAAM;;CAa/B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { modals } from '@mantine/modals';
|
|
3
|
+
import { neutral } from '../../../constants/colors';
|
|
4
|
+
import { Title } from '../../Typography/Title';
|
|
5
|
+
import { Stack } from '../../Layout/Stack';
|
|
6
|
+
import { Center } from '../../Layout/Center';
|
|
7
|
+
import { modalVariants } from './variants';
|
|
8
|
+
import { Button } from '../../Inputs/Buttons/Button';
|
|
9
|
+
import { Group } from '../../Layout/Group';
|
|
10
|
+
export const useConfirmationModal = () => {
|
|
11
|
+
const show = (options) => {
|
|
12
|
+
const { variant = 'confirm', title, message, confirmLabel, cancelLabel, icon, onConfirm, onCancel, size = '40rem', } = options;
|
|
13
|
+
const handleConfirm = () => {
|
|
14
|
+
if (onConfirm)
|
|
15
|
+
onConfirm();
|
|
16
|
+
modals.closeAll();
|
|
17
|
+
};
|
|
18
|
+
const handleCancel = () => {
|
|
19
|
+
if (onCancel)
|
|
20
|
+
onCancel();
|
|
21
|
+
modals.closeAll();
|
|
22
|
+
};
|
|
23
|
+
const selectedVariant = modalVariants[variant];
|
|
24
|
+
const iconContainer = {
|
|
25
|
+
width: '4.2rem',
|
|
26
|
+
height: '4.2rem',
|
|
27
|
+
borderRadius: '50%',
|
|
28
|
+
backgroundColor: selectedVariant.iconBackgroundColor,
|
|
29
|
+
border: `2px solid ${selectedVariant.iconColor}`,
|
|
30
|
+
};
|
|
31
|
+
const modalIcon = icon || (_jsx("i", { className: selectedVariant.icon, style: { color: selectedVariant.iconColor, fontSize: '2rem' } }));
|
|
32
|
+
const ConfirmModalContent = () => {
|
|
33
|
+
return (_jsx(Center, { h: "100%", w: "100%", children: _jsxs(Stack, { gap: "2rem", h: "100%", w: "100%", align: "center", children: [_jsxs(Stack, { gap: "1.5rem", align: "center", children: [_jsx(Center, { style: iconContainer, children: modalIcon }), _jsxs(Stack, { gap: "0.25rem", align: "center", children: [_jsx(Title, { variant: "cardHeader", align: "center", children: title || selectedVariant.title }), _jsx(Title, { variant: "cardSubheader", align: "center", children: message || selectedVariant.message })] })] }), _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Group, { gap: "1rem", align: "center", children: [_jsx(Button, { onClick: handleCancel, variant: "secondary", children: cancelLabel || selectedVariant.cancelLabel }), _jsx(Button, { onClick: handleConfirm, variant: selectedVariant.buttonVariant, children: confirmLabel || selectedVariant.confirmLabel })] }) })] }) }));
|
|
34
|
+
};
|
|
35
|
+
modals.open({
|
|
36
|
+
children: _jsx(ConfirmModalContent, {}),
|
|
37
|
+
size,
|
|
38
|
+
styles: {
|
|
39
|
+
content: {
|
|
40
|
+
borderRadius: '8px',
|
|
41
|
+
border: `1px solid ${neutral[50]}`,
|
|
42
|
+
boxShadow: '0px 0px 19px 0px #00000040',
|
|
43
|
+
},
|
|
44
|
+
header: {
|
|
45
|
+
padding: '0.8rem',
|
|
46
|
+
},
|
|
47
|
+
close: {
|
|
48
|
+
borderRadius: '16px',
|
|
49
|
+
backgroundColor: neutral[50],
|
|
50
|
+
width: '1.8rem',
|
|
51
|
+
height: '1.8rem',
|
|
52
|
+
'&:hover': {
|
|
53
|
+
backgroundColor: neutral[50],
|
|
54
|
+
},
|
|
55
|
+
'&:active': {
|
|
56
|
+
transform: 'none',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
body: {
|
|
60
|
+
padding: '0 3.2rem 1.6rem 3.2rem',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const close = (modalId) => {
|
|
66
|
+
modals.close(modalId);
|
|
67
|
+
};
|
|
68
|
+
const closeAll = () => {
|
|
69
|
+
modals.closeAll();
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
show,
|
|
73
|
+
close,
|
|
74
|
+
closeAll,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { modalVariants } from './variants';
|
|
3
|
+
export declare const useInfoModal: () => {
|
|
4
|
+
show: (options: {
|
|
5
|
+
variant?: keyof typeof modalVariants;
|
|
6
|
+
title?: string;
|
|
7
|
+
message?: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
onConfirm?: () => void;
|
|
10
|
+
size?: string | number;
|
|
11
|
+
}) => void;
|
|
12
|
+
close: (modalId: string) => void;
|
|
13
|
+
closeAll: () => void;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=InfoModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InfoModal.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Modals/InfoModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG3C,eAAO,MAAM,YAAY;oBACA;QACrB,OAAO,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;QACrC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;QACvB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KACxB;qBA8EuB,MAAM;;CAa/B,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { modals } from '@mantine/modals';
|
|
3
|
+
import { neutral } from '../../../constants/colors';
|
|
4
|
+
import { Title } from '../../Typography/Title';
|
|
5
|
+
import { Stack } from '../../Layout/Stack';
|
|
6
|
+
import { Center } from '../../Layout/Center';
|
|
7
|
+
import { modalVariants } from './variants';
|
|
8
|
+
import { Button } from '../../Inputs/Buttons/Button';
|
|
9
|
+
export const useInfoModal = () => {
|
|
10
|
+
const show = (options) => {
|
|
11
|
+
const { variant = 'info', title, message, icon, onConfirm, size = '35rem' } = options;
|
|
12
|
+
const handleConfirm = () => {
|
|
13
|
+
if (onConfirm)
|
|
14
|
+
onConfirm();
|
|
15
|
+
modals.closeAll();
|
|
16
|
+
};
|
|
17
|
+
const selectedVariant = modalVariants[variant];
|
|
18
|
+
const iconContainer = {
|
|
19
|
+
width: '4.2rem',
|
|
20
|
+
height: '4.2rem',
|
|
21
|
+
borderRadius: '50%',
|
|
22
|
+
backgroundColor: selectedVariant.iconBackgroundColor,
|
|
23
|
+
border: `2px solid ${selectedVariant.iconColor}`,
|
|
24
|
+
};
|
|
25
|
+
const modalIcon = icon || (_jsx("i", { className: selectedVariant.icon, style: { color: selectedVariant.iconColor, fontSize: '2rem' } }));
|
|
26
|
+
const InfoModalContent = () => {
|
|
27
|
+
return (_jsx(Center, { h: "100%", w: "100%", children: _jsxs(Stack, { gap: "2rem", h: "100%", w: "100%", align: "center", children: [_jsxs(Stack, { gap: "1.5rem", align: "center", children: [_jsx(Center, { style: iconContainer, children: modalIcon }), _jsxs(Stack, { gap: "0.25rem", align: "center", children: [_jsx(Title, { variant: "cardHeader", align: "center", children: title || selectedVariant.title }), _jsx(Title, { variant: "cardSubheader", align: "center", children: message || selectedVariant.message })] })] }), _jsx(Center, { h: "100%", w: "100%", children: _jsx(Button, { onClick: handleConfirm, variant: selectedVariant.buttonVariant, children: "OK" }) })] }) }));
|
|
28
|
+
};
|
|
29
|
+
modals.open({
|
|
30
|
+
children: _jsx(InfoModalContent, {}),
|
|
31
|
+
size,
|
|
32
|
+
styles: {
|
|
33
|
+
content: {
|
|
34
|
+
borderRadius: '8px',
|
|
35
|
+
border: `1px solid ${neutral[50]}`,
|
|
36
|
+
boxShadow: '0px 0px 19px 0px #00000040',
|
|
37
|
+
},
|
|
38
|
+
header: {
|
|
39
|
+
padding: '0.8rem',
|
|
40
|
+
},
|
|
41
|
+
close: {
|
|
42
|
+
borderRadius: '16px',
|
|
43
|
+
backgroundColor: neutral[50],
|
|
44
|
+
width: '1.8rem',
|
|
45
|
+
height: '1.8rem',
|
|
46
|
+
'&:hover': {
|
|
47
|
+
backgroundColor: neutral[50],
|
|
48
|
+
},
|
|
49
|
+
'&:active': {
|
|
50
|
+
transform: 'none',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
body: {
|
|
54
|
+
padding: '0 3.2rem 1.6rem 3.2rem',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const close = (modalId) => {
|
|
60
|
+
modals.close(modalId);
|
|
61
|
+
};
|
|
62
|
+
const closeAll = () => {
|
|
63
|
+
modals.closeAll();
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
show,
|
|
67
|
+
close,
|
|
68
|
+
closeAll,
|
|
69
|
+
};
|
|
70
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ModalProps {
|
|
3
|
+
opened: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
width?: string | number;
|
|
10
|
+
}
|
|
11
|
+
export declare const Modal: ({ opened, onClose, icon, title, subtitle, children, width }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Modals/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,UAAU,UAAU;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,KAAK,GAAI,6DAAuE,UAAU,4CAoEtG,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as MantineModal } from '@mantine/core';
|
|
3
|
+
import { neutral } from '../../../constants/colors';
|
|
4
|
+
import { Title } from '../../Typography/Title';
|
|
5
|
+
import { Stack } from '../../Layout/Stack';
|
|
6
|
+
import { Center } from '../../Layout/Center';
|
|
7
|
+
export const Modal = ({ opened, onClose, icon, title, subtitle, children, width = '40rem' }) => {
|
|
8
|
+
return (_jsx(MantineModal, { opened: opened, onClose: onClose, centered: true, radius: '16px', overlayProps: {
|
|
9
|
+
opacity: 0,
|
|
10
|
+
blur: 4,
|
|
11
|
+
}, size: width, transitionProps: {
|
|
12
|
+
transition: 'pop',
|
|
13
|
+
duration: 200,
|
|
14
|
+
}, closeButtonProps: {
|
|
15
|
+
style: {
|
|
16
|
+
borderRadius: '16px',
|
|
17
|
+
backgroundColor: neutral[50],
|
|
18
|
+
width: '1.8rem',
|
|
19
|
+
height: '1.8rem',
|
|
20
|
+
},
|
|
21
|
+
}, styles: {
|
|
22
|
+
content: {
|
|
23
|
+
borderRadius: '8px',
|
|
24
|
+
border: `1px solid ${neutral[50]}`,
|
|
25
|
+
boxShadow: '0px 0px 19px 0px #00000040',
|
|
26
|
+
},
|
|
27
|
+
header: {
|
|
28
|
+
padding: '0.8rem',
|
|
29
|
+
},
|
|
30
|
+
close: {
|
|
31
|
+
'&:hover': {
|
|
32
|
+
backgroundColor: neutral[50],
|
|
33
|
+
},
|
|
34
|
+
'&:active': {
|
|
35
|
+
transform: 'none',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
body: {
|
|
39
|
+
padding: '0 3.2rem 1.6rem 3.2rem',
|
|
40
|
+
},
|
|
41
|
+
}, children: _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Stack, { gap: "2rem", h: "100%", w: "100%", align: "center", children: [_jsxs(Stack, { gap: "1.5rem", align: "center", children: [icon, _jsxs(Stack, { gap: "0.25rem", align: "center", children: [_jsx(Title, { variant: "cardHeader", align: "center", children: title }), subtitle && (_jsx(Title, { variant: "cardSubheader", align: "center", children: subtitle }))] })] }), _jsx(Center, { h: "100%", w: "100%", children: children })] }) }) }));
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Modals/ModalProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,aAAa,GAAI,cAAc;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAkBxE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ModalsProvider } from '@mantine/modals';
|
|
3
|
+
export const ModalProvider = ({ children }) => {
|
|
4
|
+
return (_jsx(ModalsProvider, { modalProps: {
|
|
5
|
+
centered: true,
|
|
6
|
+
overlayProps: {
|
|
7
|
+
opacity: 0,
|
|
8
|
+
blur: 4,
|
|
9
|
+
},
|
|
10
|
+
transitionProps: {
|
|
11
|
+
transition: 'pop',
|
|
12
|
+
duration: 200,
|
|
13
|
+
},
|
|
14
|
+
}, children: children }));
|
|
15
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const modalVariants: {
|
|
2
|
+
readonly confirm: {
|
|
3
|
+
readonly title: "Are you sure?";
|
|
4
|
+
readonly message: "This action cannot be undone.";
|
|
5
|
+
readonly confirmLabel: "OK";
|
|
6
|
+
readonly cancelLabel: "Cancel";
|
|
7
|
+
readonly buttonVariant: "primary";
|
|
8
|
+
readonly icon: "fas fa-circle-question";
|
|
9
|
+
readonly iconColor: "#00A6F4";
|
|
10
|
+
readonly iconBackgroundColor: "#BDEAFF";
|
|
11
|
+
};
|
|
12
|
+
readonly info: {
|
|
13
|
+
readonly title: "Info";
|
|
14
|
+
readonly message: "This action cannot be undone.";
|
|
15
|
+
readonly confirmLabel: "OK";
|
|
16
|
+
readonly cancelLabel: "Cancel";
|
|
17
|
+
readonly buttonVariant: "primary";
|
|
18
|
+
readonly icon: "fas fa-circle-info";
|
|
19
|
+
readonly iconColor: "#00A6F4";
|
|
20
|
+
readonly iconBackgroundColor: "#BDEAFF";
|
|
21
|
+
};
|
|
22
|
+
readonly success: {
|
|
23
|
+
readonly title: "Success";
|
|
24
|
+
readonly message: "Operation completed successfully!";
|
|
25
|
+
readonly confirmLabel: "OK";
|
|
26
|
+
readonly cancelLabel: "Cancel";
|
|
27
|
+
readonly buttonVariant: "success";
|
|
28
|
+
readonly icon: "fas fa-circle-check";
|
|
29
|
+
readonly iconColor: "#00A63E";
|
|
30
|
+
readonly iconBackgroundColor: "#E6F4E7";
|
|
31
|
+
};
|
|
32
|
+
readonly error: {
|
|
33
|
+
readonly title: "Oops!";
|
|
34
|
+
readonly message: "An error occurred and your changes were not saved. Please try again.";
|
|
35
|
+
readonly confirmLabel: "OK";
|
|
36
|
+
readonly cancelLabel: "Cancel";
|
|
37
|
+
readonly buttonVariant: "cancel";
|
|
38
|
+
readonly icon: "fas fa-circle-exclamation";
|
|
39
|
+
readonly iconColor: "#FB2C36";
|
|
40
|
+
readonly iconBackgroundColor: "#FFD7D9";
|
|
41
|
+
};
|
|
42
|
+
readonly warning: {
|
|
43
|
+
readonly title: "Warning";
|
|
44
|
+
readonly message: "This action cannot be undone. Are you sure?";
|
|
45
|
+
readonly confirmLabel: "Yes, proceed";
|
|
46
|
+
readonly cancelLabel: "Cancel";
|
|
47
|
+
readonly buttonVariant: "warning";
|
|
48
|
+
readonly icon: "fas fa-triangle-exclamation";
|
|
49
|
+
readonly iconColor: "#FE9A00";
|
|
50
|
+
readonly iconBackgroundColor: "#FFE5B4";
|
|
51
|
+
};
|
|
52
|
+
readonly cancel: {
|
|
53
|
+
readonly title: "Delete Item";
|
|
54
|
+
readonly message: "Are you sure you want to delete this item? This action cannot be undone.";
|
|
55
|
+
readonly confirmLabel: "Delete";
|
|
56
|
+
readonly cancelLabel: "Cancel";
|
|
57
|
+
readonly buttonVariant: "cancel";
|
|
58
|
+
readonly icon: "fas fa-trash-can";
|
|
59
|
+
readonly iconColor: "#FB2C36";
|
|
60
|
+
readonly iconBackgroundColor: "#FFD7D9";
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Modals/variants.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DhB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { primary, error, success, warning } from '../../../constants/colors';
|
|
2
|
+
export const modalVariants = {
|
|
3
|
+
confirm: {
|
|
4
|
+
title: 'Are you sure?',
|
|
5
|
+
message: 'This action cannot be undone.',
|
|
6
|
+
confirmLabel: 'OK',
|
|
7
|
+
cancelLabel: 'Cancel',
|
|
8
|
+
buttonVariant: 'primary',
|
|
9
|
+
icon: 'fas fa-circle-question',
|
|
10
|
+
iconColor: primary[200],
|
|
11
|
+
iconBackgroundColor: primary[50],
|
|
12
|
+
},
|
|
13
|
+
info: {
|
|
14
|
+
title: 'Info',
|
|
15
|
+
message: 'This action cannot be undone.',
|
|
16
|
+
confirmLabel: 'OK',
|
|
17
|
+
cancelLabel: 'Cancel',
|
|
18
|
+
buttonVariant: 'primary',
|
|
19
|
+
icon: 'fas fa-circle-info',
|
|
20
|
+
iconColor: primary[200],
|
|
21
|
+
iconBackgroundColor: primary[50],
|
|
22
|
+
},
|
|
23
|
+
success: {
|
|
24
|
+
title: 'Success',
|
|
25
|
+
message: 'Operation completed successfully!',
|
|
26
|
+
confirmLabel: 'OK',
|
|
27
|
+
cancelLabel: 'Cancel',
|
|
28
|
+
buttonVariant: 'success',
|
|
29
|
+
icon: 'fas fa-circle-check',
|
|
30
|
+
iconColor: success[200],
|
|
31
|
+
iconBackgroundColor: success[50],
|
|
32
|
+
},
|
|
33
|
+
error: {
|
|
34
|
+
title: 'Oops!',
|
|
35
|
+
message: 'An error occurred and your changes were not saved. Please try again.',
|
|
36
|
+
confirmLabel: 'OK',
|
|
37
|
+
cancelLabel: 'Cancel',
|
|
38
|
+
buttonVariant: 'cancel',
|
|
39
|
+
icon: 'fas fa-circle-exclamation',
|
|
40
|
+
iconColor: error[100],
|
|
41
|
+
iconBackgroundColor: error[50],
|
|
42
|
+
},
|
|
43
|
+
warning: {
|
|
44
|
+
title: 'Warning',
|
|
45
|
+
message: 'This action cannot be undone. Are you sure?',
|
|
46
|
+
confirmLabel: 'Yes, proceed',
|
|
47
|
+
cancelLabel: 'Cancel',
|
|
48
|
+
buttonVariant: 'warning',
|
|
49
|
+
icon: 'fas fa-triangle-exclamation',
|
|
50
|
+
iconColor: warning[100],
|
|
51
|
+
iconBackgroundColor: warning[50],
|
|
52
|
+
},
|
|
53
|
+
cancel: {
|
|
54
|
+
title: 'Delete Item',
|
|
55
|
+
message: 'Are you sure you want to delete this item? This action cannot be undone.',
|
|
56
|
+
confirmLabel: 'Delete',
|
|
57
|
+
cancelLabel: 'Cancel',
|
|
58
|
+
buttonVariant: 'cancel',
|
|
59
|
+
icon: 'fas fa-trash-can',
|
|
60
|
+
iconColor: error[100],
|
|
61
|
+
iconBackgroundColor: error[50],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/Info/Notifications/NotificationProvider.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,+CA0ChC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Notifications } from '@mantine/notifications';
|
|
3
|
+
import { createStyles } from '@mantine/core';
|
|
4
|
+
import { useMediaQuery } from '@mantine/hooks';
|
|
5
|
+
import { neutral } from '../../../constants/colors';
|
|
6
|
+
export const NotificationProvider = () => {
|
|
7
|
+
const isMobile = useMediaQuery('(max-width: 768px)');
|
|
8
|
+
const { classes } = createStyles(() => ({
|
|
9
|
+
root: {
|
|
10
|
+
'& .mantine-Notification-root': {
|
|
11
|
+
backgroundColor: 'white',
|
|
12
|
+
padding: '1.2rem 1.6rem',
|
|
13
|
+
minHeight: 'auto',
|
|
14
|
+
borderRadius: '0 8px 8px 0',
|
|
15
|
+
},
|
|
16
|
+
'& .mantine-Notification-title': {
|
|
17
|
+
fontSize: '1.5rem',
|
|
18
|
+
fontWeight: 500,
|
|
19
|
+
fontFamily: 'Poppins, sans-serif !important',
|
|
20
|
+
color: neutral[300],
|
|
21
|
+
},
|
|
22
|
+
'& .mantine-Notification-description': {
|
|
23
|
+
fontSize: '1.25rem',
|
|
24
|
+
color: neutral[200],
|
|
25
|
+
fontFamily: 'Poppins, sans-serif !important',
|
|
26
|
+
lineHeight: 1.4,
|
|
27
|
+
},
|
|
28
|
+
'& .mantine-Notification-icon': {
|
|
29
|
+
marginRight: '1.5rem',
|
|
30
|
+
marginLeft: '0.75rem',
|
|
31
|
+
fontSize: '2rem',
|
|
32
|
+
backgroundColor: 'transparent !important',
|
|
33
|
+
},
|
|
34
|
+
'& .mantine-Notification-icon > div': {
|
|
35
|
+
backgroundColor: 'transparent !important',
|
|
36
|
+
width: 'auto !important',
|
|
37
|
+
height: 'auto !important',
|
|
38
|
+
borderRadius: '0 !important',
|
|
39
|
+
display: 'flex !important',
|
|
40
|
+
alignItems: 'center !important',
|
|
41
|
+
justifyContent: 'center !important',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}))();
|
|
45
|
+
return _jsx(Notifications, { position: "top-right", className: classes.root, containerWidth: isMobile ? '100%' : 400 });
|
|
46
|
+
};
|