@xqmsg/ui-core 0.10.0 → 0.12.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.
Files changed (44) hide show
  1. package/dist/components/button/index.d.ts +3 -7
  2. package/dist/components/input/Input.stories.d.ts +4 -0
  3. package/dist/components/table/TableTypes.d.ts +0 -1
  4. package/dist/components/table/{loading → components/loading}/index.d.ts +0 -0
  5. package/dist/components/table/components/text/index.d.ts +9 -0
  6. package/dist/components/table/index.d.ts +2 -4
  7. package/dist/theme/components/button.d.ts +68 -207
  8. package/dist/theme/components/table.d.ts +28 -0
  9. package/dist/theme/foundations/colors.d.ts +44 -22
  10. package/dist/ui-core.cjs.development.js +188 -390
  11. package/dist/ui-core.cjs.development.js.map +1 -1
  12. package/dist/ui-core.cjs.production.min.js +1 -1
  13. package/dist/ui-core.cjs.production.min.js.map +1 -1
  14. package/dist/ui-core.esm.js +190 -392
  15. package/dist/ui-core.esm.js.map +1 -1
  16. package/package.json +1 -2
  17. package/src/components/banner/index.tsx +7 -1
  18. package/src/components/button/Button.stories.tsx +19 -7
  19. package/src/components/button/index.tsx +7 -19
  20. package/src/components/button/spinner/index.tsx +2 -7
  21. package/src/components/input/Input.stories.tsx +45 -59
  22. package/src/components/input/StackedMultiSelect/index.tsx +11 -11
  23. package/src/components/input/StackedPilledInput/index.tsx +6 -12
  24. package/src/components/input/components/dropdown/index.tsx +3 -2
  25. package/src/components/input/index.tsx +0 -1
  26. package/src/components/loading/index.tsx +1 -1
  27. package/src/components/table/Table.stories.tsx +5 -3
  28. package/src/components/table/TableTypes.ts +0 -20
  29. package/src/components/table/{loading → components/loading}/index.tsx +8 -5
  30. package/src/components/table/components/text/index.tsx +23 -0
  31. package/src/components/table/index.tsx +4 -10
  32. package/src/components/tabs/index.tsx +1 -1
  33. package/src/components/text/index.tsx +1 -1
  34. package/src/theme/components/alert.ts +2 -2
  35. package/src/theme/components/button.ts +45 -186
  36. package/src/theme/components/input.ts +1 -1
  37. package/src/theme/components/link.ts +2 -1
  38. package/src/theme/components/table.ts +34 -0
  39. package/src/theme/components/tabs.ts +3 -3
  40. package/src/theme/customXQChakraTheme.ts +2 -2
  41. package/src/theme/foundations/colors.ts +19 -14
  42. package/src/theme/foundations/shadows.ts +3 -3
  43. package/dist/theme/components/menu.d.ts +0 -48
  44. package/src/theme/components/menu.ts +0 -70
@@ -26,7 +26,7 @@ export const Text: React.FC<TextProps> = ({
26
26
  letterSpacing,
27
27
  fontWeight,
28
28
  variant,
29
- color = colors.black,
29
+ color = colors.label.primary.light,
30
30
  className,
31
31
  }) => {
32
32
  return (
@@ -19,7 +19,7 @@ const baseStyle = {
19
19
 
20
20
  function variantPositive() {
21
21
  return {
22
- container: { bg: colors.fill.positive },
22
+ container: { bg: colors.fill.success },
23
23
  };
24
24
  }
25
25
 
@@ -37,7 +37,7 @@ function variantError() {
37
37
 
38
38
  function variantNeutral() {
39
39
  return {
40
- container: { bg: colors.fill.light },
40
+ container: { bg: colors.fill.light.tertiary },
41
41
  };
42
42
  }
43
43
 
@@ -1,211 +1,70 @@
1
- import { mode, transparentize, getColor } from '@chakra-ui/theme-tools';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
5
-
6
- const baseStyle = {
7
- lineHeight: 1,
8
- borderRadius: 'md',
9
- fontWeight: 'bold',
10
- _focus: {
11
- boxShadow: 'outline',
12
- },
1
+ import { defineStyle } from '@chakra-ui/system';
2
+ import colors from '../foundations/colors';
3
+
4
+ const baseStyle = defineStyle({
5
+ borderRadius: '4px',
6
+ fontSize: '18px',
7
+ bg: colors.fill.action,
8
+ color: colors.label.primary.dark,
9
+ px: '8px',
10
+ py: '4px',
11
+ bgGradient: 'linear-gradient(#FFFFFF29, #FFFFFF00)',
12
+ shadow: '1px 0.5px #0000001A',
13
13
  _disabled: {
14
- opacity: 0.4,
15
- cursor: 'not-allowed',
16
- boxShadow: 'none',
14
+ backgroundColor: 'gray.100',
15
+ borderColor: 'gray.100',
16
+ color: 'gray.500',
17
+ pointerEvents: 'none',
17
18
  },
18
- };
19
-
20
- const focusShadow = (color: string) => `0 0 0 3px ${color}`;
21
-
22
- function variantGhost(props: Dict) {
23
- const { colorScheme: c, theme } = props;
24
-
25
- if (c === 'gray') {
26
- const focusColor = getColor(theme, 'gray.100');
27
- return {
28
- color: mode(`gray.500`, `whiteAlpha.900`)(props),
29
- _hover: { bg: mode(`gray.50`, `whiteAlpha.200`)(props) },
30
- _active: { bg: mode(`gray.200`, `whiteAlpha.300`)(props) },
31
- _focus: { boxShadow: focusShadow(focusColor) },
32
- };
33
- }
19
+ _hover: {
20
+ bg: colors.fill.action,
21
+ },
22
+ _active: {
23
+ color: colors.label.primary.dark,
24
+ bg: colors.fill.action,
25
+ bgGradient: colors.fill.light.quaternary,
26
+ },
27
+ _focus: {
28
+ bg: colors.fill.action,
29
+ border: `2px solid ${colors.border.focus}`,
30
+ },
31
+ });
34
32
 
35
- const darkHoverBg = transparentize(`${c}.200`, 0.12)(theme);
36
- const darkActiveBg = transparentize(`${c}.200`, 0.24)(theme);
37
- const focusColor = getColor(theme, `${c}.200`);
33
+ const variantSolid = () => {
34
+ return { ...baseStyle };
35
+ };
38
36
 
37
+ const variantOutline = () => {
39
38
  return {
40
- color: mode(`${c}.500`, `${c}.200`)(props),
41
- bg: 'transparent',
39
+ ...baseStyle,
40
+ color: colors.fill.action,
41
+ bg: colors.label.primary.dark,
42
+ border: 'none',
42
43
  _hover: {
43
- bg: mode(`${c}.50`, darkHoverBg)(props),
44
+ bg: colors.label.primary.dark,
44
45
  },
45
46
  _active: {
46
- bg: mode(`${c}.100`, darkActiveBg)(props),
47
- },
48
- _focus: {
49
- boxShadow: focusShadow(focusColor),
47
+ color: colors.fill.action,
48
+ bg: colors.label.primary.dark,
49
+ bgGradient: colors.fill.light.quaternary,
50
50
  },
51
- };
52
- }
53
-
54
- function variantOutline(props: Dict) {
55
- const { colorScheme: c } = props;
56
- const borderColor = mode(`gray.200`, `whiteAlpha.300`)(props);
57
- return {
58
- border: '1px solid',
59
- borderColor: c === 'gray' ? borderColor : 'currentColor',
60
- ...variantGhost(props),
61
- };
62
- }
63
-
64
- type AccessibleColor = {
65
- bg?: string;
66
- color?: string;
67
- hoverBg?: string;
68
- activeBg?: string;
69
- };
70
-
71
- /** Accessible color overrides for less accessible colors. */
72
- const accessibleColorMap: { [key: string]: AccessibleColor } = {
73
- yellow: {
74
- bg: 'yellow.400',
75
- color: 'black',
76
- hoverBg: 'yellow.500',
77
- activeBg: 'yellow.600',
78
- },
79
- cyan: {
80
- bg: 'cyan.400',
81
- color: 'black',
82
- hoverBg: 'cyan.500',
83
- activeBg: 'cyan.600',
84
- },
85
- };
86
-
87
- function variantSolid(props: Dict) {
88
- const { colorScheme: c, theme } = props;
89
-
90
- if (c === 'gray')
91
- return {
92
- color: 'gray.500',
93
- bg: mode(`gray.50`, `whiteAlpha.200`)(props),
94
- _hover: { bg: mode(`gray.100`, `whiteAlpha.300`)(props) },
95
- _active: { bg: mode(`gray.200`, `whiteAlpha.400`)(props) },
96
- };
97
-
98
- if (c === 'darkgray')
99
- return {
100
- color: 'white',
101
- bg: 'gray.400',
102
- _hover: { bg: 'gray.600' },
103
- _active: { bg: 'gray.700' },
104
- };
105
-
106
- const {
107
- bg = `${c}.500`,
108
- color = 'white',
109
- hoverBg = `${c}.600`,
110
- activeBg = `${c}.700`,
111
- } = accessibleColorMap[c] || {};
112
- const focusColor = getColor(theme, `${c}.200`);
113
- return {
114
- bg: mode(bg, `${c}.200`)(props),
115
- color: mode(color, `gray.800`)(props),
116
- _hover: { bg: mode(hoverBg, `${c}.300`)(props) },
117
- _active: { bg: mode(activeBg, `${c}.400`)(props) },
118
51
  _focus: {
119
- boxShadow: focusShadow(focusColor),
120
- },
121
- };
122
- }
123
-
124
- /**
125
- * A variant that displays a solid variant when an active CSS class is
126
- * detected, otherwise display a ghost variant. This is useful for pill nav filters.
127
- */
128
- function variantActiveSolid(props: Dict) {
129
- return {
130
- ...variantGhost({ ...props, colorScheme: 'gray' }),
131
- '&.active': {
132
- ...variantSolid(props),
52
+ bg: colors.label.primary.dark,
133
53
  },
134
54
  };
135
- }
136
-
137
- function variantLink(props: Dict) {
138
- const { colorScheme: c } = props;
139
- return {
140
- padding: 0,
141
- height: 'auto',
142
- lineHeight: 'normal',
143
- color: mode(`${c}.500`, `${c}.200`)(props),
144
- _hover: { textDecoration: 'underline' },
145
- _active: {
146
- color: mode(`${c}.700`, `${c}.500`)(props),
147
- },
148
- };
149
- }
150
-
151
- const variantUnstyled = {
152
- bg: 'none',
153
- color: 'inherit',
154
- display: 'inline',
155
- lineHeight: 'inherit',
156
- m: 0,
157
- p: 0,
158
55
  };
159
56
 
160
57
  const variants = {
161
- ghost: variantGhost,
162
- outline: variantOutline,
163
- solid: variantSolid,
164
- activeSolid: variantActiveSolid,
165
- link: variantLink,
166
- unstyled: variantUnstyled,
167
- };
168
-
169
- const sizes = {
170
- lg: {
171
- borderRadius: 'full',
172
- h: 12,
173
- minW: 20,
174
- fontSize: 'lg',
175
- px: 6,
176
- },
177
- md: {
178
- borderRadius: 'full',
179
- h: 10,
180
- minW: 20,
181
- fontSize: 'md',
182
- px: 4,
183
- },
184
- sm: {
185
- borderRadius: 'full',
186
- h: 8,
187
- minW: 8,
188
- fontSize: 'sm',
189
- px: 3,
190
- },
191
- xs: {
192
- borderRadius: 'full',
193
- h: 6,
194
- minW: 6,
195
- fontSize: 'xs',
196
- px: 2,
197
- },
58
+ solid: variantSolid(),
59
+ outline: variantOutline(),
198
60
  };
199
61
 
200
62
  const defaultProps = {
201
- variant: 'solid',
202
- size: 'md',
203
- colorScheme: 'primary',
63
+ solid: 'solid',
204
64
  };
205
65
 
206
66
  export default {
207
67
  baseStyle,
208
68
  variants,
209
- sizes,
210
69
  defaultProps,
211
70
  };
@@ -14,7 +14,7 @@ const baseStyle = {
14
14
  borderColor: colors.border.default,
15
15
  _disabled: {
16
16
  cursor: 'not-allowed',
17
- bg: colors.fill.light,
17
+ bg: colors.fill.light.quaternary,
18
18
  color: colors.label.secondary.light,
19
19
  },
20
20
  _focus: {
@@ -1,10 +1,11 @@
1
1
  import { getColor } from '@chakra-ui/theme-tools';
2
+ import colors from '../foundations/colors';
2
3
 
3
4
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
5
  type Dict = Record<string, any>;
5
6
 
6
7
  const baseStyle = {
7
- color: 'blue.500',
8
+ color: colors.fill.action,
8
9
  textDecoration: 'underline',
9
10
  transition: 'none',
10
11
  _hover: {
@@ -0,0 +1,34 @@
1
+ import colors from '../foundations/colors';
2
+
3
+ const parts = ['th', 'td', 'tr', 'body'];
4
+
5
+ const baseStyle = {
6
+ th: {
7
+ height: 'fit-content',
8
+ width: '100%',
9
+ bg: colors.label.primary.dark,
10
+ padding: '5px 8px !important',
11
+ },
12
+ tr: {
13
+ fontSize: '13px',
14
+ display: 'flex',
15
+ alignItems: 'center',
16
+ width: '100%',
17
+
18
+ height: 'fit-content',
19
+ borderRadius: 'md',
20
+ _odd: {
21
+ background: colors.fill.light.tertiary,
22
+ },
23
+ },
24
+ td: {
25
+ padding: '5px 8px !important',
26
+ borderRadius: 'md',
27
+ width: '100%',
28
+ },
29
+ };
30
+
31
+ export default {
32
+ parts,
33
+ baseStyle,
34
+ };
@@ -206,12 +206,12 @@ const variantSimple = {
206
206
  position: 'relative',
207
207
  borderColor: 'transparent',
208
208
  '&.active': {
209
- color: colors.blue[500],
209
+ color: colors.fill.action,
210
210
  bg: 'transparent',
211
- borderBottom: '1px solid blue.500',
211
+ borderBottom: `1px solid ${colors.fill.action}`,
212
212
  },
213
213
  _selected: {
214
- color: colors.blue[500],
214
+ color: colors.fill.action,
215
215
  bg: 'transparent',
216
216
  _after: {
217
217
  content: '""',
@@ -12,10 +12,10 @@ import FormError from './components/form-error';
12
12
  import FormLabel from './components/form-label';
13
13
  import Input from './components/input';
14
14
  import Link from './components/link';
15
- import Menu from './components/menu';
16
15
  import Modal from './components/modal';
17
16
  import Select from './components/select';
18
17
  import Switch from './components/switch';
18
+ import Table from './components/table';
19
19
  import Tabs from './components/tabs';
20
20
  import Textarea from './components/textarea';
21
21
  import Text from './components/text';
@@ -36,10 +36,10 @@ const customXQChakraTheme = extendTheme({
36
36
  FormLabel,
37
37
  Input,
38
38
  Link,
39
- Menu,
40
39
  Modal,
41
40
  Select,
42
41
  Switch,
42
+ Table,
43
43
  Tabs,
44
44
  Textarea,
45
45
  Text,
@@ -63,13 +63,6 @@ const green: ColorHues = {
63
63
  900: 'hsl(138, 42%, 6%)',
64
64
  };
65
65
 
66
- const aliases: Record<string, ColorHues> = {
67
- primary: blue,
68
- success: green,
69
- warning: orange,
70
- danger: red,
71
- };
72
-
73
66
  const label = {
74
67
  primary: { light: '#000000', dark: '#FFFFFF' },
75
68
  secondary: { light: '#3C3C4399' },
@@ -82,14 +75,30 @@ const border = {
82
75
  };
83
76
 
84
77
  const fill = {
85
- light: '#7474800D',
86
- positive: '#d8f1b8',
78
+ light: {
79
+ primary: '#74748033',
80
+ secondary: '#74748029',
81
+ tertiary: '#7474801F',
82
+ quaternary: ':#7474800D',
83
+ },
84
+ success: '#d8f1b8',
87
85
  error: '#ffbdb9',
88
86
  warning: '#ffefb4',
89
- blue: '#0082ff',
87
+ action: '#0082ff',
88
+ };
89
+
90
+ const semantic = {
91
+ action: '#488ef7',
92
+ success: '#5fcf65',
93
+ warning: '#f8c352',
94
+ error: '#f96057',
90
95
  };
91
96
 
92
97
  const colors = {
98
+ label,
99
+ border,
100
+ fill,
101
+ semantic,
93
102
  transparent: 'transparent',
94
103
  current: 'currentColor',
95
104
  black: '#000000',
@@ -98,10 +107,6 @@ const colors = {
98
107
  coolGray: '#F6F7FB',
99
108
  darkBlue: '#292f4c',
100
109
  backdrop: '#fbfcff',
101
- ...aliases,
102
- label,
103
- border,
104
- fill,
105
110
  whiteAlpha: {
106
111
  50: 'rgba(255, 255, 255, 0.04)',
107
112
  100: 'rgba(255, 255, 255, 0.06)',
@@ -9,9 +9,9 @@ const shadows = {
9
9
  xl:
10
10
  '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
11
11
  '2xl': '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
12
- insetOutline: `inset 0 0 0 2px ${colors.blue[200]}`,
13
- outline: `0 0 0 2px ${colors.blue[200]}`,
14
- outlineDanger600: `0 0 0 2px ${colors.red[600]}`,
12
+ insetOutline: `inset 0 0 0 2px ${colors.fill.action}`,
13
+ outline: `0 0 0 2px ${colors.fill.action}`,
14
+ outlineDanger600: `0 0 0 2px ${colors.fill.error}`,
15
15
  inner: 'inset 0 2px 4px 0 rgba(0,0,0,0.06)',
16
16
  none: 'none',
17
17
  'dark-lg':
@@ -1,48 +0,0 @@
1
- declare const _default: {
2
- parts: string[];
3
- baseStyle: (props: Record<string, any>) => {
4
- list: {
5
- bg: string;
6
- boxShadow: string;
7
- color: string;
8
- minW: string;
9
- py: number;
10
- zIndex: string;
11
- borderRadius: string;
12
- borderWidth: number;
13
- overflow: string;
14
- };
15
- item: {
16
- fontSize: string;
17
- py: number;
18
- px: number;
19
- transition: string;
20
- _focus: {
21
- bg: string;
22
- };
23
- _hover: {
24
- bg: string;
25
- };
26
- _active: {
27
- bg: string;
28
- };
29
- _expanded: {
30
- bg: string;
31
- };
32
- _disabled: {
33
- opacity: number;
34
- cursor: string;
35
- };
36
- };
37
- groupTitle: {
38
- mx: number;
39
- my: number;
40
- fontWeight: string;
41
- fontSize: string;
42
- };
43
- command: {
44
- opacity: number;
45
- };
46
- };
47
- };
48
- export default _default;
@@ -1,70 +0,0 @@
1
- import { mode } from '@chakra-ui/theme-tools';
2
-
3
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
- type Dict = Record<string, any>;
5
-
6
- const parts = ['item', 'command', 'list', 'button', 'groupTitle'];
7
-
8
- function baseStyleList(props: Dict) {
9
- return {
10
- bg: mode(`#fff`, `gray.700`)(props),
11
- boxShadow: mode(`2xl`, `dark-lg`)(props),
12
- color: 'inherit',
13
- minW: '3xs',
14
- py: 2,
15
- zIndex: 'docked',
16
- borderRadius: 'md',
17
- borderWidth: 0,
18
- overflow: 'hidden',
19
- };
20
- }
21
-
22
- function baseStyleItem(props: Dict) {
23
- return {
24
- fontSize: 'sm',
25
- py: 2,
26
- px: 4,
27
- transition: 'background 50ms ease-in 0s',
28
- _focus: {
29
- bg: mode(`blue.50`, `whiteAlpha.200`)(props),
30
- },
31
- _hover: {
32
- bg: mode(`blue.50`, `whiteAlpha.200`)(props),
33
- },
34
- _active: {
35
- bg: mode(`gray.200`, `whiteAlpha.200`)(props),
36
- },
37
- _expanded: {
38
- bg: mode(`gray.100`, `whiteAlpha.100`)(props),
39
- },
40
- _disabled: {
41
- opacity: 0.4,
42
- cursor: 'not-allowed',
43
- },
44
- };
45
- }
46
-
47
- const baseStyleGroupTitle = {
48
- mx: 4,
49
- my: 2,
50
- fontWeight: 'semibold',
51
- fontSize: 'sm',
52
- };
53
-
54
- const baseStyleCommand = {
55
- opacity: 0.6,
56
- };
57
-
58
- const baseStyle = (props: Dict) => {
59
- return {
60
- list: baseStyleList(props),
61
- item: baseStyleItem(props),
62
- groupTitle: baseStyleGroupTitle,
63
- command: baseStyleCommand,
64
- };
65
- };
66
-
67
- export default {
68
- parts,
69
- baseStyle,
70
- };