@qoretechnologies/reqore 0.40.1 → 0.40.3
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/__tests__/textarea.test.tsx +0 -1
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +7 -7
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +4 -0
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +13 -7
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +2 -2
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/constants/colors.js +1 -1
- package/dist/constants/colors.js.map +1 -1
- package/dist/constants/sizes.d.ts +1 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +2 -1
- package/dist/constants/sizes.js.map +1 -1
- package/dist/hooks/useAutoFocus.d.ts +1 -0
- package/dist/hooks/useAutoFocus.d.ts.map +1 -1
- package/dist/hooks/useAutoFocus.js +4 -2
- package/dist/hooks/useAutoFocus.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Button/index.tsx +15 -5
- package/src/components/Input/index.tsx +27 -9
- package/src/components/Menu/index.tsx +4 -7
- package/src/constants/colors.ts +1 -1
- package/src/constants/sizes.ts +2 -0
- package/src/hooks/useAutoFocus.ts +4 -2
- package/src/stories/Button/Button.stories.tsx +30 -0
- package/src/stories/Input/Input.stories.tsx +10 -0
- package/src/stories/Menu/Menu.stories.tsx +10 -0
- package/tests.json +1 -1
|
@@ -3,7 +3,7 @@ import styled, { css } from 'styled-components';
|
|
|
3
3
|
import { RADIUS_FROM_SIZE } from '../../constants/sizes';
|
|
4
4
|
import { IReqoreCustomTheme, IReqoreTheme, TReqoreIntent } from '../../constants/theme';
|
|
5
5
|
import ReqoreThemeProvider from '../../containers/ThemeProvider';
|
|
6
|
-
import { changeDarkness,
|
|
6
|
+
import { changeDarkness, getMainBackgroundColor } from '../../helpers/colors';
|
|
7
7
|
import { useCloneThroughFragments } from '../../hooks/useCloneThroughFragments';
|
|
8
8
|
import { useReqoreTheme } from '../../hooks/useTheme';
|
|
9
9
|
import { IReqoreComponent, IWithReqoreMinimal, IWithReqoreTransparent } from '../../types/global';
|
|
@@ -43,14 +43,11 @@ const StyledReqoreMenu = styled.div<IReqoreMenuStyle>`
|
|
|
43
43
|
transparent ? 'transparent' : changeDarkness(getMainBackgroundColor(theme), 0.03)};
|
|
44
44
|
border-radius: ${({ rounded }) => (rounded ? `${RADIUS_FROM_SIZE['normal']}px` : `0`)};
|
|
45
45
|
|
|
46
|
-
${({ theme, position }) =>
|
|
46
|
+
${({ theme, position, padded }) =>
|
|
47
47
|
position &&
|
|
48
48
|
css`
|
|
49
|
-
border-${position === 'left' ? 'right' : 'left'}: 1px solid ${
|
|
50
|
-
|
|
51
|
-
0.05
|
|
52
|
-
)};
|
|
53
|
-
padding-${position === 'left' ? 'right' : 'left'}: 10px;
|
|
49
|
+
border-${position === 'left' ? 'right' : 'left'}: 1px solid ${changeDarkness(theme.main, 0.04)};
|
|
50
|
+
padding-${position === 'left' ? 'right' : 'left'}: ${padded ? '10px' : undefined};
|
|
54
51
|
`}
|
|
55
52
|
`;
|
|
56
53
|
|
package/src/constants/colors.ts
CHANGED
package/src/constants/sizes.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface IReqoreAutoFocusRules {
|
|
|
10
10
|
viewportMargin?: string;
|
|
11
11
|
shortcut?: 'letters' | 'numbers' | string | ('letters' | 'numbers' | string)[];
|
|
12
12
|
clearOnFocus?: boolean;
|
|
13
|
+
doNotInsertShortcut?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const useAutoFocus = (
|
|
@@ -96,9 +97,10 @@ export const useAutoFocus = (
|
|
|
96
97
|
|
|
97
98
|
useEffect(() => {
|
|
98
99
|
if (element && rules && rules.type === 'keypress') {
|
|
99
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
100
|
+
window.addEventListener(rules.doNotInsertShortcut ? 'keyup' : 'keydown', handleKeyDown);
|
|
100
101
|
}
|
|
101
102
|
|
|
102
|
-
return () =>
|
|
103
|
+
return () =>
|
|
104
|
+
window.removeEventListener(rules?.doNotInsertShortcut ? 'keyup' : 'keydown', handleKeyDown);
|
|
103
105
|
}, [element, rules]);
|
|
104
106
|
};
|
|
@@ -88,6 +88,28 @@ const Template: StoryFn<typeof ReqoreButton> = (buttonProps) => {
|
|
|
88
88
|
Disabled not flat
|
|
89
89
|
</ReqoreButton>
|
|
90
90
|
</ReqoreControlGroup>
|
|
91
|
+
<ReqoreControlGroup fluid wrap>
|
|
92
|
+
<ReqoreButton {...buttonProps} verticalPadding='tiny'>
|
|
93
|
+
Vertical padding tiny
|
|
94
|
+
</ReqoreButton>
|
|
95
|
+
<ReqoreButton {...buttonProps} verticalPadding='small'>
|
|
96
|
+
Vertical padding small
|
|
97
|
+
</ReqoreButton>
|
|
98
|
+
<ReqoreButton {...buttonProps} verticalPadding='normal'>
|
|
99
|
+
Vertical padding normal
|
|
100
|
+
</ReqoreButton>
|
|
101
|
+
<ReqoreButton {...buttonProps} verticalPadding='big'>
|
|
102
|
+
Vertical padding big
|
|
103
|
+
</ReqoreButton>
|
|
104
|
+
<ReqoreButton
|
|
105
|
+
{...buttonProps}
|
|
106
|
+
verticalPadding='huge'
|
|
107
|
+
badge={10}
|
|
108
|
+
description='This is a description'
|
|
109
|
+
>
|
|
110
|
+
Vertical padding huge
|
|
111
|
+
</ReqoreButton>
|
|
112
|
+
</ReqoreControlGroup>
|
|
91
113
|
<ReqoreControlGroup fluid wrap>
|
|
92
114
|
<ReqoreButton {...buttonProps} fluid>
|
|
93
115
|
Fluid button
|
|
@@ -347,3 +369,11 @@ export const GlobalEffect: Story = {
|
|
|
347
369
|
},
|
|
348
370
|
},
|
|
349
371
|
};
|
|
372
|
+
|
|
373
|
+
export const Pill: Story = {
|
|
374
|
+
render: Template,
|
|
375
|
+
|
|
376
|
+
args: {
|
|
377
|
+
pill: true,
|
|
378
|
+
},
|
|
379
|
+
};
|
|
@@ -57,6 +57,7 @@ const Template: StoryFn<typeof ReqoreInput> = (args: IReqoreInputProps) => {
|
|
|
57
57
|
placeholder='Clearable Input'
|
|
58
58
|
onClearClick={handleValueClear}
|
|
59
59
|
onChange={handleValueChange}
|
|
60
|
+
leftIconProps={{ size: 'tiny' }}
|
|
60
61
|
/>
|
|
61
62
|
<ReqoreInput
|
|
62
63
|
{...args}
|
|
@@ -66,6 +67,7 @@ const Template: StoryFn<typeof ReqoreInput> = (args: IReqoreInputProps) => {
|
|
|
66
67
|
onChange={handleValueChange}
|
|
67
68
|
rightIcon='EraserFill'
|
|
68
69
|
rightIconColor='#8727b7'
|
|
70
|
+
focusRules={{ type: 'keypress', shortcut: '.', doNotInsertShortcut: true }}
|
|
69
71
|
/>
|
|
70
72
|
<ReqoreInput {...args} placeholder='Disabled Input' disabled onChange={handleValueChange} />
|
|
71
73
|
<ReqoreInput
|
|
@@ -208,3 +210,11 @@ export const Effect: Story = {
|
|
|
208
210
|
},
|
|
209
211
|
},
|
|
210
212
|
};
|
|
213
|
+
|
|
214
|
+
export const Pill: Story = {
|
|
215
|
+
render: Template,
|
|
216
|
+
|
|
217
|
+
args: {
|
|
218
|
+
pill: true,
|
|
219
|
+
},
|
|
220
|
+
};
|
|
@@ -298,6 +298,16 @@ export const Transparent: Story = {
|
|
|
298
298
|
},
|
|
299
299
|
};
|
|
300
300
|
|
|
301
|
+
export const Positioned: Story = {
|
|
302
|
+
render: Template,
|
|
303
|
+
|
|
304
|
+
args: {
|
|
305
|
+
position: 'left',
|
|
306
|
+
padded: false,
|
|
307
|
+
rounded: false,
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
|
|
301
311
|
export const BigGapSize: Story = {
|
|
302
312
|
render: Template,
|
|
303
313
|
|