@taiv/ui 1.10.6 → 1.10.8
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/Info/Modals/FormModal/FormModal.d.ts +2 -1
- package/dist/components/Info/Modals/FormModal/FormModal.d.ts.map +1 -1
- package/dist/components/Info/Modals/FormModal/FormModal.js +2 -2
- package/dist/components/Info/Modals/FormModal/FormModal.stories.d.ts +1 -0
- package/dist/components/Info/Modals/FormModal/FormModal.stories.d.ts.map +1 -1
- package/dist/components/Info/Modals/FormModal/FormModal.stories.js +21 -0
- package/dist/components/Inputs/Buttons/IconButton/IconButton.d.ts +1 -2
- package/dist/components/Inputs/Buttons/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.js +2 -3
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.d.ts +0 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.d.ts.map +1 -1
- package/dist/components/Inputs/Buttons/IconButton/IconButton.stories.js +0 -3
- package/package.json +1 -1
|
@@ -8,10 +8,11 @@ export interface FormModalProps {
|
|
|
8
8
|
size?: string | number;
|
|
9
9
|
modalVariant?: keyof typeof modalVariants;
|
|
10
10
|
confirmButtonDisabled?: boolean;
|
|
11
|
+
confirmButtonLoading?: boolean;
|
|
11
12
|
onCancel?: () => void;
|
|
12
13
|
onConfirm?: () => void;
|
|
13
14
|
cancelLabel?: string;
|
|
14
15
|
confirmLabel?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const FormModal: ({ opened, onClose, icon, children, size, modalVariant, confirmButtonDisabled, onCancel, onConfirm, cancelLabel, confirmLabel, }: FormModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const FormModal: ({ opened, onClose, icon, children, size, modalVariant, confirmButtonDisabled, confirmButtonLoading, onCancel, onConfirm, cancelLabel, confirmLabel, }: FormModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
//# sourceMappingURL=FormModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IAC1C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,GAAI,
|
|
1
|
+
{"version":3,"file":"FormModal.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,OAAO,aAAa,CAAC;IAC1C,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,SAAS,GAAI,uJAavB,cAAc,4CAiGhB,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { Center } from "../../../Layout/Center/Center";
|
|
|
7
7
|
import { modalVariants } from "../variants";
|
|
8
8
|
import { Group } from "../../../Layout/Group/Group";
|
|
9
9
|
import { Button } from "../../../Inputs/Buttons/Button/Button";
|
|
10
|
-
export const FormModal = ({ opened, onClose, icon, children, size = "40rem", modalVariant = "info", confirmButtonDisabled = false, onCancel, onConfirm, cancelLabel, confirmLabel, }) => {
|
|
10
|
+
export const FormModal = ({ opened, onClose, icon, children, size = "40rem", modalVariant = "info", confirmButtonDisabled = false, confirmButtonLoading = false, onCancel, onConfirm, cancelLabel, confirmLabel, }) => {
|
|
11
11
|
const selectedVariant = modalVariants[modalVariant];
|
|
12
12
|
const iconContainer = {
|
|
13
13
|
width: "4.2rem",
|
|
@@ -55,5 +55,5 @@ export const FormModal = ({ opened, onClose, icon, children, size = "40rem", mod
|
|
|
55
55
|
body: {
|
|
56
56
|
padding: "0 3.2rem 1.6rem 3.2rem",
|
|
57
57
|
},
|
|
58
|
-
}, 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: [_jsx(Center, { style: iconContainer, children: modalIcon }), children && (_jsx(Stack, { gap: "0.25rem", align: "center", children: children }))] }), _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Group, { gap: "1rem", align: "center", children: [_jsx(Button, { onClick: onCancel, variant: "secondary", children: cancelLabel || selectedVariant.cancelLabel }), _jsx(Button, { onClick: onConfirm, variant: selectedVariant.buttonVariant, disabled: confirmButtonDisabled, children: confirmLabel || selectedVariant.confirmLabel })] }) })] }) }) }));
|
|
58
|
+
}, 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: [_jsx(Center, { style: iconContainer, children: modalIcon }), children && (_jsx(Stack, { gap: "0.25rem", align: "center", children: children }))] }), _jsx(Center, { h: "100%", w: "100%", children: _jsxs(Group, { gap: "1rem", align: "center", children: [_jsx(Button, { onClick: onCancel, variant: "secondary", children: cancelLabel || selectedVariant.cancelLabel }), _jsx(Button, { onClick: onConfirm, variant: selectedVariant.buttonVariant, disabled: confirmButtonDisabled, loading: confirmButtonLoading, children: confirmLabel || selectedVariant.confirmLabel })] }) })] }) }) }));
|
|
59
59
|
};
|
|
@@ -11,5 +11,6 @@ export declare const Variants: Story;
|
|
|
11
11
|
export declare const Sizes: Story;
|
|
12
12
|
export declare const CustomLabels: Story;
|
|
13
13
|
export declare const ConfirmButtonDisabled: Story;
|
|
14
|
+
export declare const ConfirmButtonLoading: Story;
|
|
14
15
|
export declare const CompleteExample: Story;
|
|
15
16
|
//# sourceMappingURL=FormModal.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormModal.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAYxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,
|
|
1
|
+
{"version":3,"file":"FormModal.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Info/Modals/FormModal/FormModal.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAYxC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CA+FhC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,SAAS,CAAC,CAAC;AAExC,eAAO,MAAM,OAAO,EAAE,KAyDrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAuB5B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAuBjC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAwB3B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAuCtB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAyCnB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAwB1B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAgCnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,KAiClC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAwC7B,CAAC"}
|
|
@@ -69,6 +69,13 @@ const meta = {
|
|
|
69
69
|
type: { summary: "boolean" },
|
|
70
70
|
},
|
|
71
71
|
},
|
|
72
|
+
confirmButtonLoading: {
|
|
73
|
+
control: false,
|
|
74
|
+
description: "Whether the modal confirm button shows a loading state.",
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: "boolean" },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
72
79
|
onCancel: {
|
|
73
80
|
control: false,
|
|
74
81
|
description: "Handler for the cancel button click.",
|
|
@@ -192,6 +199,20 @@ export const ConfirmButtonDisabled = {
|
|
|
192
199
|
return (_jsxs(_Fragment, { children: [_jsx(Center, { children: _jsx(Button, { onClick: () => setOpened(true), children: "Open FormModal" }) }), _jsx(FormModal, { opened: opened, onClose: () => setOpened(false), onCancel: () => setOpened(false), onConfirm: () => setOpened(false), confirmButtonDisabled: name.trim().length === 0, children: _jsxs(Stack, { gap: "1rem", align: "center", children: [_jsx(Title, { variant: "cardSubheader", align: "center", children: "Enter your name to enable the confirm button." }), _jsx(TextInput, { label: "Name", placeholder: "Enter your name", value: name, onChange: (e) => setName(e.target.value) })] }) })] }));
|
|
193
200
|
},
|
|
194
201
|
};
|
|
202
|
+
export const ConfirmButtonLoading = {
|
|
203
|
+
render: () => {
|
|
204
|
+
const [opened, setOpened] = useState(false);
|
|
205
|
+
const [loading, setLoading] = useState(false);
|
|
206
|
+
const handleConfirm = () => {
|
|
207
|
+
setLoading(true);
|
|
208
|
+
setTimeout(() => {
|
|
209
|
+
setLoading(false);
|
|
210
|
+
setOpened(false);
|
|
211
|
+
}, 2000);
|
|
212
|
+
};
|
|
213
|
+
return (_jsxs(_Fragment, { children: [_jsx(Center, { children: _jsx(Button, { onClick: () => setOpened(true), children: "Open FormModal" }) }), _jsx(FormModal, { opened: opened, onClose: () => setOpened(false), onCancel: () => setOpened(false), onConfirm: handleConfirm, confirmButtonLoading: loading, children: _jsx(Title, { variant: "cardSubheader", align: "center", children: "Click OK to see the button loading state." }) })] }));
|
|
214
|
+
},
|
|
215
|
+
};
|
|
195
216
|
export const CompleteExample = {
|
|
196
217
|
render: () => {
|
|
197
218
|
const [opened, setOpened] = useState(false);
|
|
@@ -9,10 +9,9 @@ export interface IconButtonProps extends Omit<MantineButtonProps, 'leftIcon' | '
|
|
|
9
9
|
toggled?: boolean;
|
|
10
10
|
shadow?: boolean;
|
|
11
11
|
subtle?: boolean;
|
|
12
|
-
tooltip?: string;
|
|
13
12
|
children?: ReactElement<{
|
|
14
13
|
size?: number;
|
|
15
14
|
}>;
|
|
16
15
|
}
|
|
17
|
-
export declare const IconButton: ({ onClick, size, variant, toggled, shadow, subtle,
|
|
16
|
+
export declare const IconButton: ({ onClick, size, variant, toggled, shadow, subtle, styles, children, ...props }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
17
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAA2B,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAkB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAA2B,WAAW,IAAI,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAGvF,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,WAAW,CAAC;IACzF,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,OAAO,YAAY,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,CAAC;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,UAAU,GAAI,iFAA4H,eAAe,4CA8DrK,CAAC"}
|
|
@@ -3,8 +3,7 @@ import { Button as MantineButton } from '@mantine/core';
|
|
|
3
3
|
import { componentSizes } from './sizes';
|
|
4
4
|
import { componentVariants as baseVariants, subtleVariants } from '../shared/variants';
|
|
5
5
|
import { neutral } from '../../../../constants/colors';
|
|
6
|
-
|
|
7
|
-
export const IconButton = ({ onClick, size = 'md', variant = 'primary', toggled = false, shadow = false, subtle = false, tooltip = '', styles, children, ...props }) => {
|
|
6
|
+
export const IconButton = ({ onClick, size = 'md', variant = 'primary', toggled = false, shadow = false, subtle = false, styles, children, ...props }) => {
|
|
8
7
|
const selectedVariant = baseVariants[variant];
|
|
9
8
|
const selectedSize = componentSizes[size];
|
|
10
9
|
const getVariantStyles = () => {
|
|
@@ -49,5 +48,5 @@ export const IconButton = ({ onClick, size = 'md', variant = 'primary', toggled
|
|
|
49
48
|
...styles,
|
|
50
49
|
};
|
|
51
50
|
const Button = (_jsx(MantineButton, { styles: style, size: size, onClick: onClick, loaderPosition: "center", loaderProps: { size: selectedSize.iconSize }, ...props, children: props.loading ? _jsx(_Fragment, {}) : children }));
|
|
52
|
-
return
|
|
51
|
+
return Button;
|
|
53
52
|
};
|
|
@@ -6,7 +6,6 @@ type Story = StoryObj<typeof meta>;
|
|
|
6
6
|
export declare const Default: Story;
|
|
7
7
|
export declare const Variants: Story;
|
|
8
8
|
export declare const Subtle: Story;
|
|
9
|
-
export declare const Tooltip: Story;
|
|
10
9
|
export declare const Sizes: Story;
|
|
11
10
|
export declare const States: Story;
|
|
12
11
|
export declare const SubtleStates: Story;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAsFjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAWpB,CAAC;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"IconButton.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Inputs/Buttons/IconButton/IconButton.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAsFjC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAYrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAWtB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAWpB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAQnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KASpB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAS1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAsE1B,CAAC"}
|
|
@@ -108,9 +108,6 @@ export const Variants = {
|
|
|
108
108
|
export const Subtle = {
|
|
109
109
|
render: () => (_jsxs(Group, { gap: "1.6rem", children: [_jsx(IconButton, { variant: "primary", subtle: true, children: _jsx(Icon12Hours, {}) }), _jsx(IconButton, { variant: "secondary", subtle: true, children: _jsx(Icon24Hours, {}) }), _jsx(IconButton, { variant: "cancel", subtle: true, children: _jsx(IconClock, {}) }), _jsx(IconButton, { variant: "success", subtle: true, children: _jsx(IconCheck, {}) }), _jsx(IconButton, { variant: "warning", subtle: true, children: _jsx(IconAlertCircle, {}) }), _jsx(IconButton, { variant: "text", subtle: true, children: _jsx(IconClock2, {}) })] })),
|
|
110
110
|
};
|
|
111
|
-
export const Tooltip = {
|
|
112
|
-
render: () => (_jsx(Group, { gap: "1.6rem", children: _jsx(IconButton, { tooltip: "Tooltip", children: _jsx(Icon12Hours, {}) }) })),
|
|
113
|
-
};
|
|
114
111
|
export const Sizes = {
|
|
115
112
|
render: () => (_jsxs(Group, { gap: "1.6rem", children: [_jsx(IconButton, { size: "sm", children: _jsx(Icon360View, {}) }), _jsx(IconButton, { size: "md", children: _jsx(IconAdjustments, {}) }), _jsx(IconButton, { size: "lg", children: _jsx(IconArrowsMaximize, {}) })] })),
|
|
116
113
|
};
|