@mindlogic-ai/logician-ui 2.0.0-alpha.21 → 2.0.0-alpha.22
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/index.d.mts +37 -4
- package/dist/index.d.ts +37 -4
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +35 -0
- package/src/components/SegmentedControl/SegmentedControl.types.ts +2 -1
- package/src/components/Toast/Toast.stories.tsx +16 -6
- package/src/components/Toast/Toast.styles.ts +14 -7
- package/src/components/Toast/Toast.types.ts +1 -1
- package/src/components/Toast/ToastIcon/ToastIcon.tsx +8 -2
- package/src/components/Toast/useToast.tsx +7 -1
package/package.json
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { Meta, StoryFn } from '@storybook/react';
|
|
3
|
+
import { Icon, HStack, Text } from '@chakra-ui/react';
|
|
4
|
+
import { FiHome, FiUser, FiSettings } from 'react-icons/fi';
|
|
3
5
|
|
|
4
6
|
import { SegmentedControl } from './SegmentedControl';
|
|
5
7
|
|
|
@@ -94,3 +96,36 @@ Small.args = {
|
|
|
94
96
|
borderRadius: 'full',
|
|
95
97
|
w: 'fit-content',
|
|
96
98
|
};
|
|
99
|
+
|
|
100
|
+
export const WithCustomContent = Template.bind({});
|
|
101
|
+
WithCustomContent.args = {
|
|
102
|
+
options: [
|
|
103
|
+
{
|
|
104
|
+
label: (
|
|
105
|
+
<HStack spacing={2}>
|
|
106
|
+
<Icon as={FiHome} />
|
|
107
|
+
<Text>Home</Text>
|
|
108
|
+
</HStack>
|
|
109
|
+
),
|
|
110
|
+
value: 'home',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
label: (
|
|
114
|
+
<HStack spacing={2}>
|
|
115
|
+
<Icon as={FiUser} />
|
|
116
|
+
<Text>Profile</Text>
|
|
117
|
+
</HStack>
|
|
118
|
+
),
|
|
119
|
+
value: 'profile',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
label: (
|
|
123
|
+
<HStack spacing={2}>
|
|
124
|
+
<Icon as={FiSettings} />
|
|
125
|
+
<Text>Settings</Text>
|
|
126
|
+
</HStack>
|
|
127
|
+
),
|
|
128
|
+
value: 'settings',
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
};
|
|
@@ -17,22 +17,32 @@ export function Toasts() {
|
|
|
17
17
|
<Button
|
|
18
18
|
onClick={() =>
|
|
19
19
|
showToast({
|
|
20
|
-
description: '
|
|
21
|
-
status: '
|
|
20
|
+
description: 'There was an error processing your request.',
|
|
21
|
+
status: 'info',
|
|
22
22
|
})
|
|
23
23
|
}
|
|
24
24
|
>
|
|
25
|
-
Show
|
|
25
|
+
Show Info Toast
|
|
26
26
|
</Button>
|
|
27
27
|
<Button
|
|
28
28
|
onClick={() =>
|
|
29
29
|
showToast({
|
|
30
|
-
description: '
|
|
31
|
-
status: '
|
|
30
|
+
description: 'This is a warning toast.',
|
|
31
|
+
status: 'warning',
|
|
32
32
|
})
|
|
33
33
|
}
|
|
34
34
|
>
|
|
35
|
-
Show
|
|
35
|
+
Show Warning Toast
|
|
36
|
+
</Button>
|
|
37
|
+
<Button
|
|
38
|
+
onClick={() =>
|
|
39
|
+
showToast({
|
|
40
|
+
description: 'Your action was successful.',
|
|
41
|
+
status: 'success',
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
Show Success Toast
|
|
36
46
|
</Button>
|
|
37
47
|
<Button
|
|
38
48
|
onClick={() =>
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { BoxProps } from '@chakra-ui/react';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
color: 'success.dark',
|
|
7
|
-
borderColor: 'success.light',
|
|
8
|
-
},
|
|
3
|
+
import type { MLToastOptions } from './Toast.types';
|
|
4
|
+
|
|
5
|
+
export const toastStyles = {
|
|
9
6
|
info: {
|
|
10
7
|
bg: 'primary.light',
|
|
11
8
|
color: 'primary.dark',
|
|
12
9
|
borderColor: 'primary.lighter',
|
|
13
10
|
},
|
|
11
|
+
warning: {
|
|
12
|
+
bg: 'warning.lighter',
|
|
13
|
+
color: 'warning.dark',
|
|
14
|
+
borderColor: 'warning.light',
|
|
15
|
+
},
|
|
16
|
+
success: {
|
|
17
|
+
bg: 'success.lighter',
|
|
18
|
+
color: 'success.dark',
|
|
19
|
+
borderColor: 'success.light',
|
|
20
|
+
},
|
|
14
21
|
error: {
|
|
15
22
|
bg: 'danger.lighter',
|
|
16
23
|
color: 'danger.dark',
|
|
17
24
|
borderColor: 'danger.light',
|
|
18
25
|
},
|
|
19
|
-
}
|
|
26
|
+
} satisfies Record<MLToastOptions['status'], BoxProps>;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IoIosCheckmarkCircle,
|
|
3
|
+
IoWarning,
|
|
4
|
+
LuInfo,
|
|
5
|
+
MdError,
|
|
6
|
+
} from '@/components/Icon';
|
|
2
7
|
|
|
3
8
|
import { ToastProps } from '../Toast.types';
|
|
4
9
|
|
|
5
10
|
export const ToastIcon = ({ status }: Required<Pick<ToastProps, 'status'>>) => {
|
|
6
11
|
const iconProps: { [K in typeof status]: React.ReactNode } = {
|
|
12
|
+
info: <LuInfo boxSize="md" color="primary.main" />,
|
|
13
|
+
warning: <IoWarning boxSize="lg" color="warning.main" />,
|
|
7
14
|
success: <IoIosCheckmarkCircle boxSize="lg" color="success.main" />,
|
|
8
15
|
error: <MdError boxSize="lg" color="danger.main" />,
|
|
9
|
-
info: <LuInfo boxSize="md" color="primary.main" />,
|
|
10
16
|
};
|
|
11
17
|
|
|
12
18
|
return iconProps[status];
|
|
@@ -63,5 +63,11 @@ export const useToast = (props?: UseToastOptions) => {
|
|
|
63
63
|
return toastId;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
return showToast
|
|
66
|
+
return Object.assign(showToast, {
|
|
67
|
+
close: toast.close,
|
|
68
|
+
closeAll: toast.closeAll,
|
|
69
|
+
update: toast.update,
|
|
70
|
+
isActive: toast.isActive,
|
|
71
|
+
promise: toast.promise,
|
|
72
|
+
});
|
|
67
73
|
};
|