@qoretechnologies/reqore 0.38.1 → 0.38.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/build-storybook.log +144 -141
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +4 -4
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +1 -1
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/Dropdown/item.js +1 -1
- package/dist/components/Dropdown/item.js.map +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Input/index.js +3 -3
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/InputClearButton/index.d.ts.map +1 -1
- package/dist/components/InputClearButton/index.js +1 -1
- package/dist/components/InputClearButton/index.js.map +1 -1
- package/dist/components/Menu/item.js +2 -2
- package/dist/components/Menu/item.js.map +1 -1
- package/dist/components/Panel/index.d.ts.map +1 -1
- package/dist/components/Panel/index.js +6 -2
- package/dist/components/Panel/index.js.map +1 -1
- package/dist/components/Tabs/item.d.ts.map +1 -1
- package/dist/components/Tabs/item.js +4 -3
- package/dist/components/Tabs/item.js.map +1 -1
- package/dist/components/Tabs/list.d.ts.map +1 -1
- package/dist/components/Tabs/list.js +3 -4
- package/dist/components/Tabs/list.js.map +1 -1
- package/dist/components/Tag/index.js +2 -2
- package/dist/components/Tag/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts.map +1 -1
- package/dist/components/Textarea/index.js +10 -4
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/constants/sizes.d.ts +7 -0
- package/dist/constants/sizes.d.ts.map +1 -1
- package/dist/constants/sizes.js +8 -1
- package/dist/constants/sizes.js.map +1 -1
- package/migration-storybook.log +49 -81
- package/package.json +15 -15
- package/src/components/Button/index.tsx +5 -3
- package/src/components/Checkbox/index.tsx +7 -2
- package/src/components/Dropdown/item.tsx +1 -1
- package/src/components/Input/index.tsx +9 -3
- package/src/components/InputClearButton/index.tsx +1 -0
- package/src/components/Menu/item.tsx +2 -2
- package/src/components/Panel/index.tsx +6 -2
- package/src/components/Tabs/item.tsx +7 -5
- package/src/components/Tabs/list.tsx +7 -5
- package/src/components/Tag/index.tsx +3 -3
- package/src/components/Textarea/index.tsx +17 -3
- package/src/constants/sizes.ts +8 -0
- package/src/stories/Button/Button.stories.tsx +5 -0
- package/src/stories/Dropdown/DropdownTests.stories.tsx +33 -0
- package/src/stories/Input/Input.stories.tsx +1 -0
- package/src/stories/Panel/Panel.stories.tsx +10 -0
- package/src/stories/Tabs/Tabs.stories.tsx +27 -0
- package/src/stories/TextArea/TextArea.stories.tsx +1 -1
- package/tests.json +1 -1
|
@@ -2,7 +2,13 @@ import { rgba } from 'polished';
|
|
|
2
2
|
import React, { forwardRef, useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { ReqoreDropdown } from '../..';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CONTROL_TEXT_FROM_SIZE,
|
|
7
|
+
PADDING_FROM_SIZE,
|
|
8
|
+
RADIUS_FROM_SIZE,
|
|
9
|
+
SIZE_TO_PX,
|
|
10
|
+
TSizes,
|
|
11
|
+
} from '../../constants/sizes';
|
|
6
12
|
import { IReqoreTheme } from '../../constants/theme';
|
|
7
13
|
import { changeLightness, getReadableColor } from '../../helpers/colors';
|
|
8
14
|
import { IReqoreAutoFocusRules, useAutoFocus } from '../../hooks/useAutoFocus';
|
|
@@ -67,16 +73,23 @@ export const StyledTextareaWrapper = styled.div<IReqoreTextareaStyle>`
|
|
|
67
73
|
align-self: ${({ fixed, fluid }) => (fixed ? 'flex-start' : fluid ? 'stretch' : undefined)};
|
|
68
74
|
position: relative;
|
|
69
75
|
overflow: hidden;
|
|
76
|
+
|
|
77
|
+
&:focus-within {
|
|
78
|
+
.reqore-clear-input-button {
|
|
79
|
+
display: flex;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
70
82
|
`;
|
|
71
83
|
|
|
72
84
|
export const StyledTextarea = styled(StyledEffect)<IReqoreTextareaStyle>`
|
|
73
85
|
width: 100%;
|
|
74
86
|
max-width: 100%;
|
|
75
87
|
max-height: 100%;
|
|
76
|
-
font-size: ${({ _size }) =>
|
|
88
|
+
font-size: ${({ _size }) => CONTROL_TEXT_FROM_SIZE[_size]}px;
|
|
77
89
|
margin: 0;
|
|
78
|
-
padding:
|
|
90
|
+
padding: ${({ _size }) => PADDING_FROM_SIZE[_size] / 2}px;
|
|
79
91
|
min-height: ${({ _size }) => SIZE_TO_PX[_size]}px;
|
|
92
|
+
line-height: ${({ _size }) => SIZE_TO_PX[_size] - CONTROL_TEXT_FROM_SIZE[_size]}px;
|
|
80
93
|
|
|
81
94
|
background-color: ${({ theme, minimal }: IReqoreInputStyle) =>
|
|
82
95
|
minimal ? 'transparent' : rgba(theme.main, 0.1)};
|
|
@@ -201,6 +214,7 @@ const ReqoreInput = forwardRef<HTMLTextAreaElement, IReqoreTextareaProps>(
|
|
|
201
214
|
rows={1}
|
|
202
215
|
value={_value}
|
|
203
216
|
readonly={rest?.readOnly}
|
|
217
|
+
tabIndex={rest?.disabled ? -1 : 0}
|
|
204
218
|
/>
|
|
205
219
|
<ReqoreInputClearButton
|
|
206
220
|
enabled={!rest?.readOnly && !rest?.disabled && !!(onClearClick && onChange)}
|
package/src/constants/sizes.ts
CHANGED
|
@@ -109,6 +109,14 @@ export const TEXT_FROM_SIZE = {
|
|
|
109
109
|
huge: 21,
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
+
export const CONTROL_TEXT_FROM_SIZE = {
|
|
113
|
+
tiny: 7,
|
|
114
|
+
small: 10,
|
|
115
|
+
normal: 13,
|
|
116
|
+
big: 16,
|
|
117
|
+
huge: 19,
|
|
118
|
+
};
|
|
119
|
+
|
|
112
120
|
export const ICON_FROM_SIZE = {
|
|
113
121
|
tiny: 13,
|
|
114
122
|
small: 17,
|
|
@@ -48,6 +48,11 @@ const Template: StoryFn<typeof ReqoreButton> = (buttonProps) => {
|
|
|
48
48
|
<ReqoreButton {...buttonProps} minimal flat>
|
|
49
49
|
Minimal
|
|
50
50
|
</ReqoreButton>
|
|
51
|
+
<ReqoreButton {...buttonProps} icon={undefined} rightIcon={undefined} compact>
|
|
52
|
+
Compact
|
|
53
|
+
</ReqoreButton>
|
|
54
|
+
<ReqoreButton {...buttonProps} rightIcon={undefined} compact />
|
|
55
|
+
<ReqoreButton {...buttonProps} compact />
|
|
51
56
|
<ReqoreButton {...buttonProps} readOnly onClick={alert}>
|
|
52
57
|
Read only
|
|
53
58
|
</ReqoreButton>
|
|
@@ -3,6 +3,7 @@ import { StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { fireEvent, waitFor, within } from '@storybook/testing-library';
|
|
4
4
|
import ReqoreButton, { IReqoreButtonProps } from '../../components/Button';
|
|
5
5
|
import { IReqoreDropdownProps } from '../../components/Dropdown';
|
|
6
|
+
import { sleep } from '../../helpers/utils';
|
|
6
7
|
import { ReqoreDropdown } from '../../index';
|
|
7
8
|
import { StoryMeta } from '../utils';
|
|
8
9
|
import { argManager } from '../utils/args';
|
|
@@ -47,6 +48,38 @@ export default meta;
|
|
|
47
48
|
|
|
48
49
|
type Story = StoryObj<typeof meta>;
|
|
49
50
|
|
|
51
|
+
export const ListIsClosedWhenItemIsClicked: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
label: 'Default dropdown',
|
|
54
|
+
items: [
|
|
55
|
+
{
|
|
56
|
+
label: 'Test item 1',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: 'Test item 2',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
label: 'Test item 3',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
play: async ({ canvasElement, ...rest }) => {
|
|
67
|
+
const canvas = within(canvasElement);
|
|
68
|
+
|
|
69
|
+
await sleep(200);
|
|
70
|
+
|
|
71
|
+
await fireEvent.click(canvas.getAllByText('Default dropdown')[0]);
|
|
72
|
+
|
|
73
|
+
await sleep(200);
|
|
74
|
+
|
|
75
|
+
await fireEvent.click(canvas.getAllByText('Test item 1')[0]);
|
|
76
|
+
|
|
77
|
+
await sleep(200);
|
|
78
|
+
|
|
79
|
+
await expect(document.querySelector('.reqore-popover-content')).toBeFalsy();
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
|
|
50
83
|
export const ItemsCanBeTraversed: Story = {
|
|
51
84
|
...WithChildItems,
|
|
52
85
|
play: async ({ canvasElement, ...rest }) => {
|
|
@@ -107,6 +107,7 @@ const Template: StoryFn<typeof ReqoreInput> = (args: IReqoreInputProps) => {
|
|
|
107
107
|
placeholder='Clearable Input'
|
|
108
108
|
onClearClick={handleValueClear}
|
|
109
109
|
value={value}
|
|
110
|
+
focusRules={{ type: 'auto' }}
|
|
110
111
|
onChange={handleValueChange}
|
|
111
112
|
/>
|
|
112
113
|
<ReqoreInput
|
|
@@ -359,6 +359,16 @@ export const Minimal: Story = {
|
|
|
359
359
|
},
|
|
360
360
|
};
|
|
361
361
|
|
|
362
|
+
export const MinimalCollapsed: Story = {
|
|
363
|
+
render: Template,
|
|
364
|
+
|
|
365
|
+
args: {
|
|
366
|
+
minimal: true,
|
|
367
|
+
flat: true,
|
|
368
|
+
isCollapsed: true,
|
|
369
|
+
},
|
|
370
|
+
};
|
|
371
|
+
|
|
362
372
|
export const MinimalOnlyContent: Story = {
|
|
363
373
|
render: Template,
|
|
364
374
|
|
|
@@ -247,6 +247,33 @@ export const Fill: Story = {
|
|
|
247
247
|
},
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
+
export const FillWithFixedItem: Story = {
|
|
251
|
+
render: () => {
|
|
252
|
+
return (
|
|
253
|
+
<ReqoreTabs
|
|
254
|
+
fill
|
|
255
|
+
tabs={[
|
|
256
|
+
{ id: 'tab1', label: 'Non fixed tab that should be very long', icon: 'FunctionLine' },
|
|
257
|
+
{ id: 'tab2', fixed: true, label: 'Fixed tab', icon: 'DirectionFill' },
|
|
258
|
+
{ id: 'tab3', label: 'Non fixed tab that should be very long', icon: 'FunctionLine' },
|
|
259
|
+
{ id: 'tab4', fixed: true, label: 'Fixed tab', icon: 'DirectionFill' },
|
|
260
|
+
]}
|
|
261
|
+
>
|
|
262
|
+
<ReqoreTabsContent tabId='tab1'>
|
|
263
|
+
<ReqoreH3>Tab 1</ReqoreH3>
|
|
264
|
+
</ReqoreTabsContent>
|
|
265
|
+
<ReqoreTabsContent tabId='tab2'>
|
|
266
|
+
<ReqoreH3>Tab 2</ReqoreH3>
|
|
267
|
+
</ReqoreTabsContent>
|
|
268
|
+
</ReqoreTabs>
|
|
269
|
+
);
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
args: {
|
|
273
|
+
fill: true,
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
|
|
250
277
|
export const CustomActiveIntent: Story = {
|
|
251
278
|
render: Template,
|
|
252
279
|
|
|
@@ -150,7 +150,7 @@ const Template: StoryFn<IReqoreTextareaProps> = (args) => {
|
|
|
150
150
|
onClearClick={handleValueClear}
|
|
151
151
|
value={value}
|
|
152
152
|
fluid
|
|
153
|
-
focusRules={{ type: '
|
|
153
|
+
focusRules={{ type: 'auto' }}
|
|
154
154
|
/>
|
|
155
155
|
</ReqoreControlGroup>
|
|
156
156
|
</>
|