@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindlogic-ai/logician-ui",
3
- "version": "2.0.0-alpha.21",
3
+ "version": "2.0.0-alpha.22",
4
4
  "description": "A comprehensive React design system built on Chakra UI",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -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
+ };
@@ -1,7 +1,8 @@
1
+ import { ReactNode } from 'react';
1
2
  import { FlexProps, theme } from '@chakra-ui/react';
2
3
 
3
4
  export type SegmentedControlOption = {
4
- label: string;
5
+ label: ReactNode;
5
6
  value: string;
6
7
  };
7
8
 
@@ -17,22 +17,32 @@ export function Toasts() {
17
17
  <Button
18
18
  onClick={() =>
19
19
  showToast({
20
- description: 'Your action was successful.',
21
- status: 'success',
20
+ description: 'There was an error processing your request.',
21
+ status: 'info',
22
22
  })
23
23
  }
24
24
  >
25
- Show Success Toast
25
+ Show Info Toast
26
26
  </Button>
27
27
  <Button
28
28
  onClick={() =>
29
29
  showToast({
30
- description: 'There was an error processing your request.',
31
- status: 'info',
30
+ description: 'This is a warning toast.',
31
+ status: 'warning',
32
32
  })
33
33
  }
34
34
  >
35
- Show Info Toast
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
- export const toastStyles: Record<string, BoxProps> = {
4
- success: {
5
- bg: 'success.lighter',
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>;
@@ -10,7 +10,7 @@ export interface MLToastOptions {
10
10
  description: ReactNode;
11
11
  status?: Extract<
12
12
  ChakraUseToastOptions['status'],
13
- 'success' | 'error' | 'info'
13
+ 'info' | 'warning' | 'success' | 'error'
14
14
  >;
15
15
  }
16
16
 
@@ -1,12 +1,18 @@
1
- import { IoIosCheckmarkCircle, LuInfo, MdError } from '@/components/Icon';
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
  };