@qoretechnologies/reqore 0.20.7 → 0.21.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 (119) hide show
  1. package/__tests__/dropdown.test.tsx +1 -1
  2. package/dist/components/Breadcrumbs/index.d.ts +2 -2
  3. package/dist/components/Breadcrumbs/index.d.ts.map +1 -1
  4. package/dist/components/Breadcrumbs/item.d.ts.map +1 -1
  5. package/dist/components/Breadcrumbs/item.js +3 -4
  6. package/dist/components/Breadcrumbs/item.js.map +1 -1
  7. package/dist/components/Button/index.d.ts +3 -7
  8. package/dist/components/Button/index.d.ts.map +1 -1
  9. package/dist/components/Button/index.js +28 -19
  10. package/dist/components/Button/index.js.map +1 -1
  11. package/dist/components/Checkbox/index.d.ts +3 -4
  12. package/dist/components/Checkbox/index.d.ts.map +1 -1
  13. package/dist/components/Checkbox/index.js +35 -12
  14. package/dist/components/Checkbox/index.js.map +1 -1
  15. package/dist/components/Comment/index.d.ts +2 -2
  16. package/dist/components/ControlGroup/index.d.ts +1 -0
  17. package/dist/components/ControlGroup/index.d.ts.map +1 -1
  18. package/dist/components/ControlGroup/index.js +3 -2
  19. package/dist/components/ControlGroup/index.js.map +1 -1
  20. package/dist/components/Header/index.d.ts +2 -2
  21. package/dist/components/Header/index.d.ts.map +1 -1
  22. package/dist/components/Icon/index.d.ts +2 -2
  23. package/dist/components/Input/index.d.ts +2 -4
  24. package/dist/components/Input/index.d.ts.map +1 -1
  25. package/dist/components/Input/index.js +57 -28
  26. package/dist/components/Input/index.js.map +1 -1
  27. package/dist/components/Menu/index.d.ts +3 -2
  28. package/dist/components/Menu/index.d.ts.map +1 -1
  29. package/dist/components/Menu/index.js +7 -4
  30. package/dist/components/Menu/index.js.map +1 -1
  31. package/dist/components/Menu/item.d.ts +7 -6
  32. package/dist/components/Menu/item.d.ts.map +1 -1
  33. package/dist/components/Menu/item.js +9 -67
  34. package/dist/components/Menu/item.js.map +1 -1
  35. package/dist/components/Message/index.d.ts +2 -2
  36. package/dist/components/Message/index.d.ts.map +1 -1
  37. package/dist/components/Navbar/item.d.ts.map +1 -1
  38. package/dist/components/Navbar/item.js +12 -5
  39. package/dist/components/Navbar/item.js.map +1 -1
  40. package/dist/components/Notifications/notification.d.ts +4 -4
  41. package/dist/components/Notifications/notification.d.ts.map +1 -1
  42. package/dist/components/Panel/index.d.ts +3 -3
  43. package/dist/components/Panel/index.d.ts.map +1 -1
  44. package/dist/components/Paragraph/index.d.ts +2 -2
  45. package/dist/components/Paragraph/index.d.ts.map +1 -1
  46. package/dist/components/Sidebar/index.d.ts.map +1 -1
  47. package/dist/components/Sidebar/index.js +7 -6
  48. package/dist/components/Sidebar/index.js.map +1 -1
  49. package/dist/components/Table/index.d.ts +6 -6
  50. package/dist/components/Table/index.d.ts.map +1 -1
  51. package/dist/components/Table/row.d.ts +6 -6
  52. package/dist/components/Table/row.d.ts.map +1 -1
  53. package/dist/components/Tabs/index.d.ts +5 -5
  54. package/dist/components/Tabs/item.d.ts.map +1 -1
  55. package/dist/components/Tabs/item.js +2 -3
  56. package/dist/components/Tabs/item.js.map +1 -1
  57. package/dist/components/Tag/index.d.ts +5 -10
  58. package/dist/components/Tag/index.d.ts.map +1 -1
  59. package/dist/components/Tag/index.js +10 -7
  60. package/dist/components/Tag/index.js.map +1 -1
  61. package/dist/components/Textarea/index.d.ts +4 -2
  62. package/dist/components/Textarea/index.d.ts.map +1 -1
  63. package/dist/components/Textarea/index.js +55 -15
  64. package/dist/components/Textarea/index.js.map +1 -1
  65. package/dist/constants/theme.d.ts +1 -1
  66. package/dist/containers/ReqoreProvider.d.ts +4 -4
  67. package/dist/helpers/colors.d.ts +2 -2
  68. package/dist/helpers/colors.d.ts.map +1 -1
  69. package/dist/hooks/useCombinedRefs.d.ts +10 -1
  70. package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
  71. package/dist/hooks/useCombinedRefs.js +18 -2
  72. package/dist/hooks/useCombinedRefs.js.map +1 -1
  73. package/dist/hooks/useTheme.d.ts +2 -2
  74. package/dist/hooks/useTheme.d.ts.map +1 -1
  75. package/dist/styles.d.ts +2 -0
  76. package/dist/styles.d.ts.map +1 -1
  77. package/dist/styles.js +5 -3
  78. package/dist/styles.js.map +1 -1
  79. package/dist/types/global.d.ts +69 -0
  80. package/dist/types/global.d.ts.map +1 -1
  81. package/package.json +1 -1
  82. package/src/components/Breadcrumbs/index.tsx +2 -2
  83. package/src/components/Breadcrumbs/item.tsx +4 -5
  84. package/src/components/Button/index.tsx +77 -49
  85. package/src/components/Checkbox/index.tsx +27 -17
  86. package/src/components/Comment/index.tsx +2 -2
  87. package/src/components/ControlGroup/index.tsx +3 -3
  88. package/src/components/Header/index.tsx +2 -2
  89. package/src/components/Icon/index.tsx +2 -2
  90. package/src/components/Input/index.tsx +58 -44
  91. package/src/components/Menu/index.tsx +14 -3
  92. package/src/components/Menu/item.tsx +42 -132
  93. package/src/components/Message/index.tsx +2 -2
  94. package/src/components/Navbar/item.tsx +20 -3
  95. package/src/components/Notifications/notification.tsx +4 -4
  96. package/src/components/Panel/index.tsx +3 -3
  97. package/src/components/Paragraph/index.tsx +2 -2
  98. package/src/components/Sidebar/index.tsx +11 -0
  99. package/src/components/Table/index.tsx +8 -8
  100. package/src/components/Table/row.tsx +11 -11
  101. package/src/components/Tabs/index.tsx +5 -5
  102. package/src/components/Tabs/item.tsx +3 -4
  103. package/src/components/Tag/index.tsx +18 -21
  104. package/src/components/Textarea/index.tsx +76 -28
  105. package/src/constants/theme.ts +1 -1
  106. package/src/containers/ReqoreProvider.tsx +4 -4
  107. package/src/helpers/colors.ts +2 -2
  108. package/src/hooks/useCombinedRefs.ts +9 -2
  109. package/src/hooks/useTheme.ts +2 -2
  110. package/src/stories/Button/Button.stories.tsx +4 -1
  111. package/src/stories/Checkbox/Checkbox.stories.tsx +5 -4
  112. package/src/stories/Input/Input.stories.tsx +39 -6
  113. package/src/stories/Menu/Menu.stories.tsx +14 -2
  114. package/src/stories/RadioGroup/RadioGroup.stories.tsx +10 -0
  115. package/src/stories/Tag/Tag.stories.tsx +7 -1
  116. package/src/stories/TextArea/TextArea.stories.tsx +83 -13
  117. package/src/styles.ts +11 -2
  118. package/src/types/global.ts +74 -0
  119. package/tests.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import _size from 'lodash/size';
2
- import React, { forwardRef, useContext, useRef } from 'react';
2
+ import React, { forwardRef, useContext } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { ReqorePopover } from '../..';
5
5
  import {
@@ -9,24 +9,24 @@ import {
9
9
  TEXT_FROM_SIZE,
10
10
  TSizes,
11
11
  } from '../../constants/sizes';
12
- import { IReqoreIntent, IReqoreTheme } from '../../constants/theme';
12
+ import { IReqoreTheme, TReqoreIntent } from '../../constants/theme';
13
13
  import ThemeContext from '../../context/ThemeContext';
14
14
  import { changeLightness, getReadableColor, getReadableColorFrom } from '../../helpers/colors';
15
15
  import { useCombinedRefs } from '../../hooks/useCombinedRefs';
16
- import usePopover from '../../hooks/usePopover';
17
- import { IReqoreTooltip } from '../../types/global';
16
+ import { useTooltip } from '../../hooks/useTooltip';
17
+ import { IReqoreDisabled, IReqoreIntent, IWithReqoreTooltip } from '../../types/global';
18
18
  import { IReqoreIconName } from '../../types/icons';
19
19
  import ReqoreIcon from '../Icon';
20
20
 
21
- export interface IReqoreTagAction {
21
+ export interface IReqoreTagAction extends IWithReqoreTooltip, IReqoreDisabled, IReqoreIntent {
22
22
  icon: IReqoreIconName;
23
23
  onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
24
- disabled?: boolean;
25
- tooltip?: IReqoreTooltip;
26
- intent?: IReqoreIntent;
27
24
  }
28
25
 
29
- export interface IReqoreTagProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {
26
+ export interface IReqoreTagProps
27
+ extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'>,
28
+ IWithReqoreTooltip,
29
+ IReqoreDisabled {
30
30
  size?: TSizes;
31
31
  label?: string;
32
32
  onRemoveClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
@@ -34,12 +34,10 @@ export interface IReqoreTagProps extends Omit<React.HTMLAttributes<HTMLSpanEleme
34
34
  icon?: IReqoreIconName;
35
35
  rightIcon?: IReqoreIconName;
36
36
  color?: string;
37
- tooltip?: IReqoreTooltip;
38
- disabled?: boolean;
39
37
  actions?: IReqoreTagAction[];
40
38
  width?: string;
41
39
  badge?: boolean;
42
- intent?: IReqoreIntent;
40
+ intent?: TReqoreIntent;
43
41
  }
44
42
 
45
43
  export interface IReqoreTagStyle extends IReqoreTagProps {
@@ -154,15 +152,10 @@ const ReqoreTag = forwardRef(
154
152
  }: IReqoreTagProps,
155
153
  ref
156
154
  ) => {
157
- const innerRef = useRef(null);
158
- const combinedRef = useCombinedRefs(innerRef, ref);
155
+ const { targetRef } = useCombinedRefs(ref);
159
156
  const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
160
157
 
161
- usePopover({
162
- ...tooltip,
163
- targetElement: combinedRef.current,
164
- show: !!tooltip?.content,
165
- });
158
+ useTooltip(targetRef.current, tooltip);
166
159
 
167
160
  // If color or intent was specified, set the color
168
161
  const customColor = intent ? theme.intents[intent] : color;
@@ -173,7 +166,7 @@ const ReqoreTag = forwardRef(
173
166
  color={customColor}
174
167
  className={`${className || ''} reqore-tag`}
175
168
  size={size}
176
- ref={combinedRef}
169
+ ref={targetRef}
177
170
  badge={badge}
178
171
  removable={!!onRemoveClick}
179
172
  interactive={!!onClick && !rest.disabled}
@@ -199,7 +192,6 @@ const ReqoreTag = forwardRef(
199
192
  ? actions.map((action) => (
200
193
  <>
201
194
  <ReqorePopover
202
- {...action.tooltip}
203
195
  component={StyledButtonWrapper}
204
196
  componentProps={{
205
197
  size,
@@ -207,6 +199,11 @@ const ReqoreTag = forwardRef(
207
199
  className: 'reqore-tag-action',
208
200
  onClick: action.onClick,
209
201
  }}
202
+ {...(action.tooltip
203
+ ? typeof action.tooltip === 'string'
204
+ ? { tooltip: action.tooltip }
205
+ : action.tooltip || {}
206
+ : {})}
210
207
  noWrapper
211
208
  >
212
209
  <ReqoreIcon icon={action.icon} size={`${TEXT_FROM_SIZE[size]}px`} />
@@ -1,14 +1,31 @@
1
- import { darken, rgba } from 'polished';
1
+ import { rgba } from 'polished';
2
2
  import React, { forwardRef } from 'react';
3
- import styled from 'styled-components';
4
- import { TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
3
+ import styled, { css } from 'styled-components';
4
+ import { RADIUS_FROM_SIZE, TEXT_FROM_SIZE, TSizes } from '../../constants/sizes';
5
5
  import { IReqoreTheme } from '../../constants/theme';
6
- import { getReadableColor } from '../../helpers/colors';
6
+ import { changeLightness, getReadableColor } from '../../helpers/colors';
7
+ import { useCombinedRefs } from '../../hooks/useCombinedRefs';
8
+ import { useReqoreTheme } from '../../hooks/useTheme';
9
+ import { useTooltip } from '../../hooks/useTooltip';
10
+ import { DisabledElement, ReadOnlyElement } from '../../styles';
11
+ import {
12
+ IReqoreDisabled,
13
+ IReqoreIntent,
14
+ IReqoreReadOnly,
15
+ IWithReqoreCustomTheme,
16
+ IWithReqoreTooltip,
17
+ } from '../../types/global';
18
+ import { IReqoreInputStyle } from '../Input';
7
19
  import ReqoreInputClearButton from '../InputClearButton';
8
20
 
9
- export interface IReqoreTextareaProps extends React.HTMLAttributes<HTMLTextAreaElement> {
21
+ export interface IReqoreTextareaProps
22
+ extends React.HTMLAttributes<HTMLTextAreaElement>,
23
+ IReqoreReadOnly,
24
+ IReqoreDisabled,
25
+ IWithReqoreCustomTheme,
26
+ IWithReqoreTooltip,
27
+ IReqoreIntent {
10
28
  autoFocus?: boolean;
11
- disabled?: boolean;
12
29
  width?: number;
13
30
  height?: number;
14
31
  scaleWithContent?: boolean;
@@ -18,6 +35,8 @@ export interface IReqoreTextareaProps extends React.HTMLAttributes<HTMLTextAreaE
18
35
  value?: string;
19
36
  rows?: number;
20
37
  cols?: number;
38
+ rounded?: boolean;
39
+ flat?: boolean;
21
40
  onClearClick?: () => any;
22
41
  }
23
42
 
@@ -42,25 +61,39 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
42
61
  padding: 5px 7px;
43
62
  resize: none;
44
63
 
45
- background-color: ${({ theme, minimal }: IReqoreTextareaStyle) =>
46
- minimal ? 'transparent' : darken(0.01, theme.main)};
47
- color: ${({ theme }: IReqoreTextareaStyle) => getReadableColor(theme)};
64
+ background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
65
+ minimal ? 'transparent' : rgba(theme.main, 0.3)};
66
+ color: ${({ theme }: IReqoreInputStyle) => getReadableColor(theme)};
48
67
 
49
- border: ${({ minimal, theme }) =>
50
- !minimal ? `1px solid ${rgba(getReadableColor(theme), 0.2)}` : 0};
51
- border-bottom: ${({ minimal, theme }) =>
52
- minimal ? `0.5px solid ${rgba(getReadableColor(theme), 0.2)}` : undefined};
53
-
54
- border-radius: ${({ minimal }) => (minimal ? 0 : 3)}px;
55
68
  transition: all 0.2s ease-out;
56
69
 
57
70
  &:active,
58
- &:focus,
59
- &:hover {
60
- outline: none;
61
- border-color: ${({ theme }) => rgba(getReadableColor(theme), 0.3)};
71
+ &:focus {
72
+ background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
73
+ minimal ? 'transparent' : rgba(theme.main, 0.5)};
62
74
  }
63
75
 
76
+ border-radius: ${({ minimal, rounded, _size }) =>
77
+ minimal || !rounded ? 0 : RADIUS_FROM_SIZE[_size]}px;
78
+ border: ${({ minimal, theme, flat }) =>
79
+ !minimal && !flat ? `1px solid ${changeLightness(theme.main, 0.05)}` : 0};
80
+ border-bottom: ${({ minimal, theme, flat }) =>
81
+ minimal && !flat ? `0.5px solid ${changeLightness(theme.main, 0.05)}` : undefined};
82
+
83
+ transition: all 0.2s ease-out;
84
+
85
+ ${({ disabled, readOnly }) =>
86
+ !disabled && !readOnly
87
+ ? css`
88
+ &:active,
89
+ &:focus,
90
+ &:hover {
91
+ outline: none;
92
+ border-color: ${({ theme }) => changeLightness(theme.main, 0.1)};
93
+ }
94
+ `
95
+ : undefined}
96
+
64
97
  &::placeholder {
65
98
  transition: all 0.2s ease-out;
66
99
  color: ${({ theme }) => rgba(getReadableColor(theme), 0.3)};
@@ -72,9 +105,10 @@ export const StyledTextarea = styled.textarea<IReqoreTextareaStyle>`
72
105
  }
73
106
  }
74
107
 
108
+ ${({ readOnly }) => readOnly && ReadOnlyElement};
109
+
75
110
  &:disabled {
76
- pointer-events: none;
77
- opacity: 0.3;
111
+ ${DisabledElement};
78
112
  }
79
113
  `;
80
114
 
@@ -88,10 +122,19 @@ const ReqoreInput = forwardRef(
88
122
  className,
89
123
  onClearClick,
90
124
  fluid,
125
+ tooltip,
126
+ customTheme,
127
+ intent,
128
+ rounded = true,
91
129
  ...rest
92
130
  }: IReqoreTextareaProps,
93
131
  ref: any
94
132
  ) => {
133
+ const { targetRef } = useCombinedRefs(ref);
134
+ const theme = useReqoreTheme('main', customTheme, intent);
135
+
136
+ useTooltip(targetRef?.current, tooltip);
137
+
95
138
  return (
96
139
  <StyledTextareaWrapper
97
140
  className={`${className || ''} reqore-control-wrapper`}
@@ -99,20 +142,25 @@ const ReqoreInput = forwardRef(
99
142
  height={height}
100
143
  fluid={fluid}
101
144
  _size={size}
145
+ theme={theme}
102
146
  >
103
147
  <StyledTextarea
104
148
  {...rest}
105
149
  className={`${className || ''} reqore-control reqore-textarea`}
106
150
  _size={size}
107
- ref={ref}
151
+ ref={targetRef}
152
+ theme={theme}
153
+ rounded={rounded}
108
154
  rows={scaleWithContent ? (rest?.value?.split(/\r\n|\r|\n/).length || 1) + 1 : rest.rows}
109
155
  />
110
- <ReqoreInputClearButton
111
- enabled={!rest?.disabled && !!(onClearClick && rest?.onChange)}
112
- show={rest?.value && rest.value !== ''}
113
- onClick={onClearClick}
114
- size='big'
115
- />
156
+ {!rest.readOnly && (
157
+ <ReqoreInputClearButton
158
+ enabled={!rest?.disabled && !!(onClearClick && rest?.onChange)}
159
+ show={rest?.value && rest.value !== ''}
160
+ onClick={onClearClick}
161
+ size='big'
162
+ />
163
+ )}
116
164
  </StyledTextareaWrapper>
117
165
  );
118
166
  }
@@ -81,7 +81,7 @@ export interface IReqoreIntents {
81
81
  muted?: string;
82
82
  }
83
83
 
84
- export type IReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
84
+ export type TReqoreIntent = 'info' | 'success' | 'pending' | 'warning' | 'danger' | 'muted';
85
85
 
86
86
  export const DEFAULT_INTENTS: IReqoreIntents = {
87
87
  info: '#0E5A8A',
@@ -10,7 +10,7 @@ import ReqoreNotification, {
10
10
  IReqoreNotificationType,
11
11
  } from '../components/Notifications/notification';
12
12
  import { TSizes } from '../constants/sizes';
13
- import { IReqoreIntent } from '../constants/theme';
13
+ import { TReqoreIntent } from '../constants/theme';
14
14
  import ReqoreContext from '../context/ReqoreContext';
15
15
  import { IReqoreIconName } from '../types/icons';
16
16
 
@@ -24,7 +24,7 @@ export interface IReqoreNotificationData {
24
24
  onFinish?: (id?: string) => any;
25
25
  id?: string;
26
26
  type?: IReqoreNotificationType;
27
- intent?: IReqoreIntent;
27
+ intent?: TReqoreIntent;
28
28
  flat?: boolean;
29
29
  inverted?: boolean;
30
30
  size?: TSizes;
@@ -40,12 +40,12 @@ export interface IReqoreConfirmationModal {
40
40
  description?: string;
41
41
  onConfirm?: () => void;
42
42
  onCancel?: () => void;
43
- confirmButtonIntent?: IReqoreIntent;
43
+ confirmButtonIntent?: TReqoreIntent;
44
44
  confirmLabel?: string;
45
45
  confirmIcon?: IReqoreIconName;
46
46
  cancelLabel?: string;
47
47
  isOpen?: boolean;
48
- intent?: IReqoreIntent;
48
+ intent?: TReqoreIntent;
49
49
  }
50
50
 
51
51
  const ReqoreProvider: React.FC<IReqoreNotifications> = ({ children, position }) => {
@@ -1,7 +1,7 @@
1
1
  import { cloneDeep, merge } from 'lodash';
2
2
  import { darken, lighten, readableColor } from 'polished';
3
3
  import { Colors } from '../constants/colors';
4
- import { DEFAULT_INTENTS, IReqoreIntent, IReqoreTheme } from '../constants/theme';
4
+ import { DEFAULT_INTENTS, IReqoreTheme, TReqoreIntent } from '../constants/theme';
5
5
 
6
6
  export const getReadableColor: (
7
7
  theme: Partial<IReqoreTheme>,
@@ -130,7 +130,7 @@ export const mergeThemes = (element: string, theme: IReqoreTheme, customTheme: a
130
130
  return clonedTheme;
131
131
  };
132
132
 
133
- export const getNotificationIntent = (theme: IReqoreTheme, intent?: IReqoreIntent) => {
133
+ export const getNotificationIntent = (theme: IReqoreTheme, intent?: TReqoreIntent) => {
134
134
  if (intent) {
135
135
  return theme.notifications[intent];
136
136
  }
@@ -1,10 +1,17 @@
1
1
  import React from 'react';
2
2
 
3
+ /**
4
+ * It takes a list of refs and returns a single ref that can be used to reference the same underlying
5
+ * DOM element
6
+ * @param refs - An array of refs to combine.
7
+ * @returns A ref object.
8
+ */
3
9
  export function useCombinedRefs(...refs) {
10
+ const [_innerRef, setInnerRef] = React.useState(null);
4
11
  const targetRef = React.useRef();
5
12
 
6
13
  React.useEffect(() => {
7
- refs.forEach((ref) => {
14
+ [...refs, setInnerRef].forEach((ref) => {
8
15
  if (!ref) return;
9
16
 
10
17
  if (typeof ref === 'function') {
@@ -15,5 +22,5 @@ export function useCombinedRefs(...refs) {
15
22
  });
16
23
  }, [refs]);
17
24
 
18
- return targetRef;
25
+ return { _innerRef, targetRef };
19
26
  }
@@ -1,13 +1,13 @@
1
1
  import { cloneDeep } from 'lodash';
2
2
  import { useContext } from 'react';
3
- import { IReqoreIntent, IReqoreTheme } from '../constants/theme';
3
+ import { IReqoreTheme, TReqoreIntent } from '../constants/theme';
4
4
  import ThemeContext from '../context/ThemeContext';
5
5
  import { mergeThemes } from '../helpers/colors';
6
6
 
7
7
  export const useReqoreTheme = (
8
8
  element: string,
9
9
  customTheme: Partial<IReqoreTheme> = {},
10
- intent?: IReqoreIntent
10
+ intent?: TReqoreIntent
11
11
  ) => {
12
12
  const theme: IReqoreTheme = useContext<IReqoreTheme>(ThemeContext);
13
13
  let _customTheme: Partial<IReqoreTheme> = cloneDeep(customTheme);
@@ -22,7 +22,7 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
22
22
  <ReqoreButton {...buttonProps} disabled>
23
23
  Disabled
24
24
  </ReqoreButton>
25
- <ReqoreButton {...buttonProps} active>
25
+ <ReqoreButton {...buttonProps} active tooltip='hello'>
26
26
  Active
27
27
  </ReqoreButton>
28
28
  <ReqoreButton {...buttonProps} flat>
@@ -31,6 +31,9 @@ const Template: ComponentStory<typeof ReqoreButton> = (buttonProps) => {
31
31
  <ReqoreButton {...buttonProps} minimal>
32
32
  Minimal
33
33
  </ReqoreButton>
34
+ <ReqoreButton {...buttonProps} readOnly onClick={alert}>
35
+ Read only
36
+ </ReqoreButton>
34
37
  </ReqoreControlGroup>
35
38
  <br />
36
39
  <ReqoreControlGroup fluid>
@@ -1,6 +1,6 @@
1
1
  import { ComponentMeta, ComponentStory } from '@storybook/react';
2
2
  import Checkbox from '../../components/Checkbox';
3
- import { ReqoreCheckbox } from '../../index';
3
+ import { ReqoreCheckbox, ReqoreControlGroup } from '../../index';
4
4
 
5
5
  export default {
6
6
  title: 'Components/Checkbox',
@@ -9,13 +9,14 @@ export default {
9
9
 
10
10
  const Template: ComponentStory<typeof Checkbox> = (args) => {
11
11
  return (
12
- <>
12
+ <ReqoreControlGroup>
13
13
  <ReqoreCheckbox {...args} />
14
14
  <ReqoreCheckbox {...args} label='Label' labelDetail='Detail' labelDetailPosition='left' />
15
- <ReqoreCheckbox {...args} checked />
15
+ <ReqoreCheckbox {...args} checked tooltip='I am checked' />
16
16
  <ReqoreCheckbox {...args} disabled />
17
17
  <ReqoreCheckbox {...args} label='Label' labelDetail='Detail' labelPosition='left' />
18
- </>
18
+ <ReqoreCheckbox {...args} label='Read Only' labelPosition='left' readOnly />
19
+ </ReqoreControlGroup>
19
20
  );
20
21
  };
21
22
 
@@ -2,13 +2,14 @@ import { Meta, Story } from '@storybook/react/types-6-0';
2
2
  import { useState } from 'react';
3
3
  import ReqoreInput, { IReqoreInputProps } from '../../components/Input';
4
4
  import { ReqoreControlGroup } from '../../index';
5
- import { FlatArg, MinimalArg } from '../utils/args';
5
+ import { FlatArg, IconArg, MinimalArg } from '../utils/args';
6
6
 
7
7
  export default {
8
8
  title: 'Components/Input',
9
9
  argTypes: {
10
10
  ...MinimalArg,
11
11
  ...FlatArg,
12
+ ...IconArg('icon', 'Icon', 'SearchLine'),
12
13
  },
13
14
  } as Meta<IReqoreInputProps>;
14
15
 
@@ -27,47 +28,55 @@ const Template: Story<IReqoreInputProps> = (args: IReqoreInputProps) => {
27
28
  <>
28
29
  <ReqoreControlGroup>
29
30
  <ReqoreInput
31
+ {...args}
30
32
  placeholder='Reqore Input'
31
33
  onChange={handleValueChange}
32
34
  value={value}
33
- {...args}
34
35
  />
35
36
  <ReqoreInput
37
+ {...args}
36
38
  placeholder='Minimal Input'
37
39
  minimal
38
40
  onChange={handleValueChange}
39
41
  value={value}
40
- {...args}
41
42
  />
42
43
  <ReqoreInput
44
+ {...args}
43
45
  placeholder='Flat Input'
44
46
  flat
47
+ tooltip="I'm a tooltip"
45
48
  onChange={handleValueChange}
46
49
  value={value}
47
- {...args}
48
50
  />
49
51
  <ReqoreInput
52
+ {...args}
50
53
  placeholder='Clearable Input'
51
54
  onClearClick={handleValueClear}
52
55
  value={value}
53
56
  onChange={handleValueChange}
54
- {...args}
55
57
  />
56
58
  <ReqoreInput
59
+ {...args}
57
60
  placeholder='Disabled Input'
58
61
  disabled
59
62
  onChange={handleValueChange}
60
63
  value={value}
64
+ />
65
+ <ReqoreInput
61
66
  {...args}
67
+ placeholder='Read Only Input'
68
+ readOnly
69
+ onChange={handleValueChange}
70
+ value={value}
62
71
  />
63
72
  </ReqoreControlGroup>
64
73
  <br />
65
74
  <ReqoreControlGroup fluid>
66
75
  <ReqoreInput
76
+ {...args}
67
77
  placeholder='Fluid Input'
68
78
  onChange={handleValueChange}
69
79
  value={value}
70
- {...args}
71
80
  />
72
81
  </ReqoreControlGroup>
73
82
  </>
@@ -75,3 +84,27 @@ const Template: Story<IReqoreInputProps> = (args: IReqoreInputProps) => {
75
84
  };
76
85
 
77
86
  export const Basic = Template.bind({});
87
+ export const Info = Template.bind({});
88
+ Info.args = {
89
+ intent: 'info',
90
+ };
91
+ export const Success = Template.bind({});
92
+ Success.args = {
93
+ intent: 'success',
94
+ };
95
+ export const Warning = Template.bind({});
96
+ Warning.args = {
97
+ intent: 'warning',
98
+ };
99
+ export const Danger = Template.bind({});
100
+ Danger.args = {
101
+ intent: 'danger',
102
+ };
103
+ export const Pending = Template.bind({});
104
+ Pending.args = {
105
+ intent: 'pending',
106
+ };
107
+ export const Muted = Template.bind({});
108
+ Muted.args = {
109
+ intent: 'muted',
110
+ };
@@ -27,11 +27,19 @@ export default {
27
27
  type: 'select',
28
28
  },
29
29
  }),
30
+ ...createArg('wrapText', {
31
+ defaultValue: true,
32
+ name: 'Wrap text',
33
+ control: {
34
+ type: 'boolean',
35
+ },
36
+ description: 'Whether to wrap text or not',
37
+ }),
30
38
  ...IntentArg,
31
39
  },
32
40
  } as Meta<IReqoreMenuProps>;
33
41
 
34
- export const MenuStory: Story<IReqoreMenuProps> = (args) => {
42
+ const Template: Story<IReqoreMenuProps> = (args) => {
35
43
  return (
36
44
  <ReqoreMenu {...args}>
37
45
  <ReqoreMenuItem icon='Save3Fill' intent='success' selected>
@@ -91,4 +99,8 @@ export const MenuStory: Story<IReqoreMenuProps> = (args) => {
91
99
  );
92
100
  };
93
101
 
94
- MenuStory.storyName = 'Menu';
102
+ export const Basic = Template.bind({});
103
+ export const WrappedText = Template.bind({});
104
+ WrappedText.args = {
105
+ wrapText: false,
106
+ };
@@ -37,6 +37,16 @@ const Template: Story<IReqoreRadioGroupProps> = (args: IReqoreRadioGroupProps) =
37
37
  label: 'Option 3',
38
38
  value: 'opt3',
39
39
  },
40
+ {
41
+ label: 'Read Only Option',
42
+ value: 'opt4',
43
+ readOnly: true,
44
+ },
45
+ {
46
+ label: 'Disabled Option',
47
+ value: 'opt5',
48
+ disabled: true,
49
+ },
40
50
  ]}
41
51
  onSelectClick={(value) => setSelected(value)}
42
52
  selected={selected}
@@ -60,7 +60,13 @@ const Template: Story<IReqoreTagGroup & IReqoreTagProps> = ({ columns, ...args }
60
60
  <ReqoreTagGroup columns={columns} size={args.size}>
61
61
  <ReqoreTag label='Basic Tag' icon='AlarmWarningLine' {...args} />
62
62
  <ReqoreTag label='Disabled Tag' disabled icon='AlarmWarningLine' {...args} />
63
- <ReqoreTag label='300px Tag' width='300px' icon='AlarmWarningLine' {...args} />
63
+ <ReqoreTag
64
+ label='300px Tag'
65
+ width='300px'
66
+ icon='AlarmWarningLine'
67
+ {...args}
68
+ tooltip='I am wiiiiiiide'
69
+ />
64
70
  <ReqoreTag label='Danger Tag' icon='AlarmWarningLine' intent='danger' {...args} />
65
71
  <ReqoreTag label='Custom Color Tag' icon='AlarmWarningLine' color='#38fdb2' {...args} />
66
72
  </ReqoreTagGroup>