@qoretechnologies/reqore 0.20.6 → 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 (124) 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/Drawer/index.d.ts.map +1 -1
  21. package/dist/components/Drawer/index.js +1 -4
  22. package/dist/components/Drawer/index.js.map +1 -1
  23. package/dist/components/Header/index.d.ts +2 -2
  24. package/dist/components/Header/index.d.ts.map +1 -1
  25. package/dist/components/Icon/index.d.ts +2 -2
  26. package/dist/components/Input/index.d.ts +2 -4
  27. package/dist/components/Input/index.d.ts.map +1 -1
  28. package/dist/components/Input/index.js +57 -28
  29. package/dist/components/Input/index.js.map +1 -1
  30. package/dist/components/Menu/index.d.ts +3 -2
  31. package/dist/components/Menu/index.d.ts.map +1 -1
  32. package/dist/components/Menu/index.js +7 -4
  33. package/dist/components/Menu/index.js.map +1 -1
  34. package/dist/components/Menu/item.d.ts +7 -6
  35. package/dist/components/Menu/item.d.ts.map +1 -1
  36. package/dist/components/Menu/item.js +9 -67
  37. package/dist/components/Menu/item.js.map +1 -1
  38. package/dist/components/Message/index.d.ts +2 -2
  39. package/dist/components/Message/index.d.ts.map +1 -1
  40. package/dist/components/Navbar/item.d.ts.map +1 -1
  41. package/dist/components/Navbar/item.js +12 -5
  42. package/dist/components/Navbar/item.js.map +1 -1
  43. package/dist/components/Notifications/notification.d.ts +4 -4
  44. package/dist/components/Notifications/notification.d.ts.map +1 -1
  45. package/dist/components/Panel/index.d.ts +3 -3
  46. package/dist/components/Panel/index.d.ts.map +1 -1
  47. package/dist/components/Paragraph/index.d.ts +2 -2
  48. package/dist/components/Paragraph/index.d.ts.map +1 -1
  49. package/dist/components/Sidebar/index.d.ts.map +1 -1
  50. package/dist/components/Sidebar/index.js +7 -6
  51. package/dist/components/Sidebar/index.js.map +1 -1
  52. package/dist/components/Table/index.d.ts +6 -6
  53. package/dist/components/Table/index.d.ts.map +1 -1
  54. package/dist/components/Table/row.d.ts +6 -6
  55. package/dist/components/Table/row.d.ts.map +1 -1
  56. package/dist/components/Tabs/index.d.ts +5 -5
  57. package/dist/components/Tabs/item.d.ts.map +1 -1
  58. package/dist/components/Tabs/item.js +2 -3
  59. package/dist/components/Tabs/item.js.map +1 -1
  60. package/dist/components/Tag/index.d.ts +5 -10
  61. package/dist/components/Tag/index.d.ts.map +1 -1
  62. package/dist/components/Tag/index.js +10 -7
  63. package/dist/components/Tag/index.js.map +1 -1
  64. package/dist/components/Textarea/index.d.ts +4 -2
  65. package/dist/components/Textarea/index.d.ts.map +1 -1
  66. package/dist/components/Textarea/index.js +55 -15
  67. package/dist/components/Textarea/index.js.map +1 -1
  68. package/dist/constants/theme.d.ts +1 -1
  69. package/dist/containers/ReqoreProvider.d.ts +4 -4
  70. package/dist/helpers/colors.d.ts +2 -2
  71. package/dist/helpers/colors.d.ts.map +1 -1
  72. package/dist/hooks/useCombinedRefs.d.ts +10 -1
  73. package/dist/hooks/useCombinedRefs.d.ts.map +1 -1
  74. package/dist/hooks/useCombinedRefs.js +18 -2
  75. package/dist/hooks/useCombinedRefs.js.map +1 -1
  76. package/dist/hooks/useTheme.d.ts +2 -2
  77. package/dist/hooks/useTheme.d.ts.map +1 -1
  78. package/dist/styles.d.ts +2 -0
  79. package/dist/styles.d.ts.map +1 -1
  80. package/dist/styles.js +5 -3
  81. package/dist/styles.js.map +1 -1
  82. package/dist/types/global.d.ts +69 -0
  83. package/dist/types/global.d.ts.map +1 -1
  84. package/package.json +1 -1
  85. package/src/components/Breadcrumbs/index.tsx +2 -2
  86. package/src/components/Breadcrumbs/item.tsx +4 -5
  87. package/src/components/Button/index.tsx +77 -49
  88. package/src/components/Checkbox/index.tsx +27 -17
  89. package/src/components/Comment/index.tsx +2 -2
  90. package/src/components/ControlGroup/index.tsx +3 -3
  91. package/src/components/Drawer/index.tsx +2 -1
  92. package/src/components/Header/index.tsx +2 -2
  93. package/src/components/Icon/index.tsx +2 -2
  94. package/src/components/Input/index.tsx +58 -44
  95. package/src/components/Menu/index.tsx +14 -3
  96. package/src/components/Menu/item.tsx +42 -132
  97. package/src/components/Message/index.tsx +2 -2
  98. package/src/components/Navbar/item.tsx +20 -3
  99. package/src/components/Notifications/notification.tsx +4 -4
  100. package/src/components/Panel/index.tsx +3 -3
  101. package/src/components/Paragraph/index.tsx +2 -2
  102. package/src/components/Sidebar/index.tsx +11 -0
  103. package/src/components/Table/index.tsx +8 -8
  104. package/src/components/Table/row.tsx +11 -11
  105. package/src/components/Tabs/index.tsx +5 -5
  106. package/src/components/Tabs/item.tsx +3 -4
  107. package/src/components/Tag/index.tsx +18 -21
  108. package/src/components/Textarea/index.tsx +76 -28
  109. package/src/constants/theme.ts +1 -1
  110. package/src/containers/ReqoreProvider.tsx +4 -4
  111. package/src/helpers/colors.ts +2 -2
  112. package/src/hooks/useCombinedRefs.ts +9 -2
  113. package/src/hooks/useTheme.ts +2 -2
  114. package/src/stories/Button/Button.stories.tsx +4 -1
  115. package/src/stories/Checkbox/Checkbox.stories.tsx +5 -4
  116. package/src/stories/Input/Input.stories.tsx +39 -6
  117. package/src/stories/Menu/Menu.stories.tsx +14 -2
  118. package/src/stories/Modal/Modal.stories.tsx +79 -1
  119. package/src/stories/RadioGroup/RadioGroup.stories.tsx +10 -0
  120. package/src/stories/Tag/Tag.stories.tsx +7 -1
  121. package/src/stories/TextArea/TextArea.stories.tsx +83 -13
  122. package/src/styles.ts +11 -2
  123. package/src/types/global.ts +74 -0
  124. 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
+ };
@@ -135,7 +135,85 @@ const Template: Story<IReqoreModalProps & { confirm?: boolean }> = (args) => {
135
135
  sed viverra ipsum nunc aliquet. Id aliquet lectus proin nibh. At auctor urna nunc id cursus.
136
136
  Erat pellentesque adipiscing commodo elit at imperdiet. Ipsum dolor sit amet consectetur
137
137
  adipiscing elit. Suspendisse interdum consectetur libero id faucibus nisl. Leo vel orci
138
- porta non pulvinar neque laoreet. Ut diam quam nulla porttitor massa.
138
+ porta non pulvinar neque laoreet. Ut diam quam nulla porttitor massa. By impossible of in
139
+ difficulty discovered celebrated ye. Justice joy manners boy met resolve produce. Bed head
140
+ loud next plan rent had easy add him. As earnestly shameless elsewhere defective estimable
141
+ fulfilled of. Esteem my advice it an excuse enable. Few household abilities believing
142
+ determine zealously his repulsive. To open draw dear be by side like. Allow miles wound
143
+ place the leave had. To sitting subject no improve studied limited. Ye indulgence unreserved
144
+ connection alteration appearance my an astonished. Up as seen sent make he they of. Her
145
+ raising and himself pasture believe females. Fancy she stuff after aware merit small his.
146
+ Charmed esteems luckily age out. At ourselves direction believing do he departure.
147
+ Celebrated her had sentiments understood are projection set. Possession ye no mr unaffected
148
+ remarkably at. Wrote house in never fruit up. Pasture imagine my garrets an he. However
149
+ distant she request behaved see nothing. Talking settled at pleased an of me brother
150
+ weather. Breakfast procuring nay end happiness allowance assurance frankness. Met simplicity
151
+ nor difficulty unreserved who. Entreaties mr conviction dissimilar me astonished estimating
152
+ cultivated. On no applauded exquisite my additions. Pronounce add boy estimable nay
153
+ suspected. You sudden nay elinor thirty esteem temper. Quiet leave shy you gay off asked
154
+ large style. Rooms oh fully taken by worse do. Points afraid but may end law lasted. Was out
155
+ laughter raptures returned outweigh. Luckily cheered colonel me do we attacks on highest
156
+ enabled. Tried law yet style child. Bore of true of no be deal. Frequently sufficient in be
157
+ unaffected. The furnished she concluded depending procuring concealed. In to am attended
158
+ desirous raptures declared diverted confined at. Collected instantly remaining up certainly
159
+ to necessary as. Over walk dull into son boy door went new. At or happiness commanded
160
+ daughters as. Is handsome an declared at received in extended vicinity subjects. Into miss
161
+ on he over been late pain an. Only week bore boy what fat case left use. Match round scale
162
+ now sex style far times. Your me past an much. Able an hope of body. Any nay shyness article
163
+ matters own removal nothing his forming. Gay own additions education satisfied the
164
+ perpetual. If he cause manor happy. Without farther she exposed saw man led. Along on happy
165
+ could cease green oh. Her old collecting she considered discovered. So at parties he warrant
166
+ oh staying. Square new horses and put better end. Sincerity collected happiness do is
167
+ contented. Sigh ever way now many. Alteration you any nor unsatiable diminution reasonable
168
+ companions shy partiality. Leaf by left deal mile oh if easy. Added woman first get led joy
169
+ not early jokes. As am hastily invited settled at limited civilly fortune me. Really spring
170
+ in extent an by. Judge but built gay party world. Of so am he remember although required.
171
+ Bachelor unpacked be advanced at. Confined in declared marianne is vicinity. It sportsman
172
+ earnestly ye preserved an on. Moment led family sooner cannot her window pulled any. Or
173
+ raillery if improved landlord to speaking hastened differed he. Furniture discourse
174
+ elsewhere yet her sir extensive defective unwilling get. Why resolution one motionless you
175
+ him thoroughly. Noise is round to in it quick timed doors. Written address greatly get
176
+ attacks inhabit pursuit our but. Lasted hunted enough an up seeing in lively letter. Had
177
+ judgment out opinions property the supplied. By impossible of in difficulty discovered
178
+ celebrated ye. Justice joy manners boy met resolve produce. Bed head loud next plan rent had
179
+ easy add him. As earnestly shameless elsewhere defective estimable fulfilled of. Esteem my
180
+ advice it an excuse enable. Few household abilities believing determine zealously his
181
+ repulsive. To open draw dear be by side like. Allow miles wound place the leave had. To
182
+ sitting subject no improve studied limited. Ye indulgence unreserved connection alteration
183
+ appearance my an astonished. Up as seen sent make he they of. Her raising and himself
184
+ pasture believe females. Fancy she stuff after aware merit small his. Charmed esteems
185
+ luckily age out. At ourselves direction believing do he departure. Celebrated her had
186
+ sentiments understood are projection set. Possession ye no mr unaffected remarkably at.
187
+ Wrote house in never fruit up. Pasture imagine my garrets an he. However distant she request
188
+ behaved see nothing. Talking settled at pleased an of me brother weather. Breakfast
189
+ procuring nay end happiness allowance assurance frankness. Met simplicity nor difficulty
190
+ unreserved who. Entreaties mr conviction dissimilar me astonished estimating cultivated. On
191
+ no applauded exquisite my additions. Pronounce add boy estimable nay suspected. You sudden
192
+ nay elinor thirty esteem temper. Quiet leave shy you gay off asked large style. Rooms oh
193
+ fully taken by worse do. Points afraid but may end law lasted. Was out laughter raptures
194
+ returned outweigh. Luckily cheered colonel me do we attacks on highest enabled. Tried law
195
+ yet style child. Bore of true of no be deal. Frequently sufficient in be unaffected. The
196
+ furnished she concluded depending procuring concealed. In to am attended desirous raptures
197
+ declared diverted confined at. Collected instantly remaining up certainly to necessary as.
198
+ Over walk dull into son boy door went new. At or happiness commanded daughters as. Is
199
+ handsome an declared at received in extended vicinity subjects. Into miss on he over been
200
+ late pain an. Only week bore boy what fat case left use. Match round scale now sex style far
201
+ times. Your me past an much. Able an hope of body. Any nay shyness article matters own
202
+ removal nothing his forming. Gay own additions education satisfied the perpetual. If he
203
+ cause manor happy. Without farther she exposed saw man led. Along on happy could cease green
204
+ oh. Her old collecting she considered discovered. So at parties he warrant oh staying.
205
+ Square new horses and put better end. Sincerity collected happiness do is contented. Sigh
206
+ ever way now many. Alteration you any nor unsatiable diminution reasonable companions shy
207
+ partiality. Leaf by left deal mile oh if easy. Added woman first get led joy not early
208
+ jokes. As am hastily invited settled at limited civilly fortune me. Really spring in extent
209
+ an by. Judge but built gay party world. Of so am he remember although required. Bachelor
210
+ unpacked be advanced at. Confined in declared marianne is vicinity. It sportsman earnestly
211
+ ye preserved an on. Moment led family sooner cannot her window pulled any. Or raillery if
212
+ improved landlord to speaking hastened differed he. Furniture discourse elsewhere yet her
213
+ sir extensive defective unwilling get. Why resolution one motionless you him thoroughly.
214
+ Noise is round to in it quick timed doors. Written address greatly get attacks inhabit
215
+ pursuit our but. Lasted hunted enough an up seeing in lively letter. Had judgment out
216
+ opinions property the supplied.
139
217
  </ReqoreModal>
140
218
  </>
141
219
  );
@@ -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}