@itcase/ui-web 1.9.111 → 1.9.113
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/dist/DatePicker_cjs_Cd7wsJCG.js +1 -0
- package/dist/DatePicker_es_BhrZj2OP.js +1 -0
- package/dist/cjs/components/AvatarStack.js +1 -1
- package/dist/cjs/components/DatePeriod.js +1 -1
- package/dist/cjs/components/DatePicker.js +1 -1
- package/dist/cjs/components/Dropzone.js +1 -1
- package/dist/components/AvatarStack.js +1 -1
- package/dist/components/DatePeriod.js +1 -1
- package/dist/components/DatePicker.js +1 -1
- package/dist/components/Dropzone.js +1 -1
- package/dist/css/styles/bundles.css +13 -1
- package/dist/stories/DatePickerOverview.mdx +1 -1
- package/dist/types/components/Avatar/stories/AvatarCount.stories.d.ts +4 -0
- package/dist/types/components/Avatar/stories/AvatarCount.stories.js +4 -0
- package/dist/types/components/Avatar/stories/AvatarDemo.stories.js +4 -0
- package/dist/types/components/Avatar/stories/AvatarImage.stories.d.ts +4 -0
- package/dist/types/components/Avatar/stories/AvatarImage.stories.js +4 -0
- package/dist/types/components/Avatar/stories/AvatarInteraction.stories.d.ts +4 -0
- package/dist/types/components/Avatar/stories/AvatarInteraction.stories.js +4 -0
- package/dist/types/components/Avatar/stories/AvatarLetters.stories.d.ts +4 -0
- package/dist/types/components/Avatar/stories/AvatarLetters.stories.js +4 -0
- package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.d.ts +4 -0
- package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.js +4 -0
- package/dist/types/components/AvatarStack/AvatarStack.interface.d.ts +6 -11
- package/dist/types/components/AvatarStack/AvatarStack.js +3 -13
- package/dist/types/components/AvatarStack/index.d.ts +1 -1
- package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.d.ts +12 -4
- package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.js +49 -13
- package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.d.ts +6 -2
- package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.js +7 -12
- package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.d.ts +9 -1
- package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.js +51 -37
- package/dist/types/components/AvatarStack/{__test__/AvatarStackTest.stories.d.ts → stories/AvatarStackSkeleton.stories.d.ts} +7 -2
- package/dist/types/components/AvatarStack/stories/AvatarStackSkeleton.stories.js +47 -0
- package/dist/types/components/AvatarStack/stories/__mock__/index.js +11 -5
- package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.d.ts +8 -9
- package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.js +33 -72
- package/dist/types/components/DatePicker/DatePicker.interface.d.ts +22 -28
- package/dist/types/components/DatePicker/DatePicker.js +3 -4
- package/dist/types/components/DatePicker/stories/DatePicker.stories.d.ts +10 -1
- package/dist/types/components/DatePicker/stories/DatePicker.stories.js +31 -33
- package/dist/types/components/DatePicker/stories/DatePickerClear.stories.d.ts +9 -1
- package/dist/types/components/DatePicker/stories/DatePickerClear.stories.js +20 -24
- package/dist/types/components/DatePicker/stories/DatePickerSize.stories.d.ts +8 -0
- package/dist/types/components/DatePicker/stories/DatePickerSize.stories.js +13 -24
- package/dist/types/components/DatePicker/stories/DatePickerStory.d.ts +2 -0
- package/dist/types/components/DatePicker/stories/DatePickerStory.js +18 -0
- package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.d.ts +8 -0
- package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.js +13 -29
- package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.d.ts +12 -1
- package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.js +30 -32
- package/dist/types/components/Divider/__test__/DividerTest.stories.js +3 -3
- package/dist/types/components/Dropzone/Dropzone.appearance.d.ts +1 -0
- package/dist/types/components/Dropzone/Dropzone.js +1 -1
- package/dist/types/components/Dropzone/appearance/dropzoneDefault.d.ts +1 -0
- package/dist/types/components/Dropzone/appearance/dropzoneDefault.js +1 -0
- package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.d.ts +1 -0
- package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.js +7 -0
- package/dist/types/components/Dropzone/stories/__mock__/index.d.ts +4 -0
- package/dist/types/components/Dropzone/stories/__mock__/index.js +19 -0
- package/package.json +2 -2
- package/dist/DatePicker_cjs_BhZXIBZm.js +0 -1
- package/dist/DatePicker_es_vJagTqXm.js +0 -1
- package/dist/types/components/AvatarStack/AvatarStack.appearance.d.ts +0 -21
- package/dist/types/components/AvatarStack/AvatarStack.appearance.js +0 -5
- package/dist/types/components/AvatarStack/__test__/AvatarStackTest.stories.js +0 -45
- package/dist/types/components/AvatarStack/appearance/avatarStackSize.d.ts +0 -21
- package/dist/types/components/AvatarStack/appearance/avatarStackSize.js +0 -21
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
const avatarsListMock = [
|
|
2
2
|
{
|
|
3
|
-
id: '
|
|
3
|
+
id: '1',
|
|
4
4
|
src: '/avatar/Man.png',
|
|
5
5
|
firstName: 'firstName',
|
|
6
6
|
lastName: 'lastName',
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
id: '
|
|
9
|
+
id: '2',
|
|
10
10
|
src: '/avatar/Woman.png',
|
|
11
11
|
firstName: 'firstName',
|
|
12
12
|
lastName: 'lastName',
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
id: '
|
|
15
|
+
id: '3',
|
|
16
16
|
src: '',
|
|
17
17
|
firstName: 'firstName',
|
|
18
18
|
lastName: 'lastName',
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
id: '
|
|
22
|
-
src: '',
|
|
21
|
+
id: '4',
|
|
22
|
+
src: '/avatar/Woman2.png',
|
|
23
|
+
firstName: 'firstName',
|
|
24
|
+
lastName: 'lastName',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: '5',
|
|
28
|
+
src: '/avatar/Woman2.png',
|
|
23
29
|
firstName: 'firstName',
|
|
24
30
|
lastName: 'lastName',
|
|
25
31
|
},
|
|
@@ -4,22 +4,21 @@ declare const meta: {
|
|
|
4
4
|
title: string;
|
|
5
5
|
component: typeof Badge;
|
|
6
6
|
args: {
|
|
7
|
+
appearance: "accentPrimary sizeXXL solid rounded";
|
|
8
|
+
dataTestId: string;
|
|
7
9
|
dot: true;
|
|
8
10
|
icon: import("react").FunctionComponent<import("react").SVGAttributes<SVGElement>>;
|
|
9
11
|
value: number;
|
|
10
12
|
};
|
|
11
13
|
parameters: {
|
|
12
14
|
layout: string;
|
|
15
|
+
design: {
|
|
16
|
+
type: string;
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
13
19
|
};
|
|
20
|
+
tags: string[];
|
|
14
21
|
};
|
|
15
22
|
export default meta;
|
|
16
23
|
type Story = StoryObj<typeof meta>;
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const Special: Story;
|
|
19
|
-
export declare const Extra: Story;
|
|
20
|
-
export declare const Surface: Story;
|
|
21
|
-
export declare const Success: Story;
|
|
22
|
-
export declare const Warning: Story;
|
|
23
|
-
export declare const Danger: Story;
|
|
24
|
-
export declare const Info: Story;
|
|
25
|
-
export declare const Disabled: Story;
|
|
24
|
+
export declare const DotIconCounter: Story;
|
|
@@ -1,88 +1,49 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as storybookTest from 'storybook/test';
|
|
2
3
|
import { icons24 } from '@itcase/icons-default';
|
|
3
4
|
import { Badge } from '../Badge';
|
|
4
5
|
const meta = {
|
|
5
|
-
title: 'Atoms / Badge
|
|
6
|
+
title: 'Atoms / Badge',
|
|
6
7
|
component: Badge,
|
|
7
8
|
args: {
|
|
9
|
+
appearance: 'accentPrimary sizeXXL solid rounded',
|
|
10
|
+
dataTestId: 'badgeDotIconCounterTestId',
|
|
8
11
|
dot: true,
|
|
9
12
|
icon: icons24.Placeholder.Default,
|
|
10
13
|
value: 3,
|
|
11
14
|
},
|
|
12
15
|
parameters: {
|
|
13
16
|
layout: 'centered',
|
|
17
|
+
design: {
|
|
18
|
+
type: 'figma',
|
|
19
|
+
url: 'https://www.figma.com/design/HmHn0BShJPXHU8SmuIP71M/ITCase---Atoms?node-id=0-1&t=n7EGLyP33amnXKYl-1',
|
|
20
|
+
},
|
|
14
21
|
},
|
|
22
|
+
tags: ['test'],
|
|
15
23
|
};
|
|
16
24
|
export default meta;
|
|
17
|
-
export const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
}
|
|
41
|
-
export const Surface = {
|
|
42
|
-
args: {
|
|
43
|
-
appearance: 'surfacePrimary sizeXXL solid rounded',
|
|
44
|
-
},
|
|
45
|
-
render: (args) => {
|
|
46
|
-
return _jsx(Badge, { ...args });
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
export const Success = {
|
|
50
|
-
args: {
|
|
51
|
-
appearance: 'successPrimary sizeXXL solid rounded',
|
|
52
|
-
},
|
|
53
|
-
render: (args) => {
|
|
54
|
-
return _jsx(Badge, { ...args });
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
export const Warning = {
|
|
58
|
-
args: {
|
|
59
|
-
appearance: 'warningPrimary sizeXXL solid rounded',
|
|
60
|
-
},
|
|
61
|
-
render: (args) => {
|
|
62
|
-
return _jsx(Badge, { ...args });
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
export const Danger = {
|
|
66
|
-
args: {
|
|
67
|
-
appearance: 'dangerPrimary sizeXXL solid rounded',
|
|
68
|
-
},
|
|
69
|
-
render: (args) => {
|
|
70
|
-
return _jsx(Badge, { ...args });
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
export const Info = {
|
|
74
|
-
args: {
|
|
75
|
-
appearance: 'infoPrimary sizeXXL solid rounded',
|
|
76
|
-
},
|
|
77
|
-
render: (args) => {
|
|
78
|
-
return _jsx(Badge, { ...args });
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
export const Disabled = {
|
|
82
|
-
args: {
|
|
83
|
-
appearance: 'disabledPrimary sizeXXL solid rounded',
|
|
84
|
-
},
|
|
85
|
-
render: (args) => {
|
|
86
|
-
return _jsx(Badge, { ...args });
|
|
87
|
-
},
|
|
25
|
+
export const DotIconCounter = {
|
|
26
|
+
name: 'Dot + Icon + Counter',
|
|
27
|
+
play: async ({ args, canvas, step }) => {
|
|
28
|
+
await step('Badge: dot, icon and counter', async () => {
|
|
29
|
+
const badge = canvas.getByTestId(args.dataTestId);
|
|
30
|
+
await step(`Badge has class "badge_type_dot-icon-counter"`, async () => {
|
|
31
|
+
await storybookTest
|
|
32
|
+
.expect(badge)
|
|
33
|
+
.toHaveClass('badge_type_dot-icon-counter');
|
|
34
|
+
});
|
|
35
|
+
await step(`Badge has counter value is ${args.value}`, async () => {
|
|
36
|
+
await storybookTest.expect(badge).toHaveTextContent(String(args.value));
|
|
37
|
+
});
|
|
38
|
+
await step('Badge has icon', async () => {
|
|
39
|
+
await storybookTest.expect(badge.querySelector('.icon')).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
await step('Badge has dot', async () => {
|
|
42
|
+
await storybookTest
|
|
43
|
+
.expect(badge.querySelector('.badge__dot'))
|
|
44
|
+
.toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
render: (args) => _jsx(Badge, { ...args }),
|
|
88
49
|
};
|
|
@@ -6,14 +6,13 @@ import type { AppearancePartialRecord, AppearanceRecord } from '@itcase/types-ui
|
|
|
6
6
|
import { ButtonProps } from 'src/components/Button/Button.interface';
|
|
7
7
|
import { IconProps } from 'src/components/Icon/Icon.interface';
|
|
8
8
|
import { InputProps } from 'src/components/Input/Input.interface';
|
|
9
|
-
import { LabelProps } from 'src/components/Label/Label.interface';
|
|
10
9
|
import { TextProps } from 'src/components/Text/Text.interface';
|
|
11
10
|
type DatePickerInputAppearanceProps = {
|
|
12
11
|
appearance?: CompositeAppearanceKeys;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
clearButton?: ButtonProps['label'];
|
|
13
|
+
clearButtonAppearance?: ButtonProps['appearance'];
|
|
14
|
+
clearIcon?: IconProps['SvgImage'];
|
|
15
|
+
clearIconAppearance?: IconProps['appearance'];
|
|
17
16
|
daySize?: ButtonProps['size'];
|
|
18
17
|
dayTextColor?: ButtonProps['labelTextColor'];
|
|
19
18
|
dayTextShape?: ButtonProps['shape'];
|
|
@@ -40,32 +39,12 @@ type DatePickerInputAppearanceProps = {
|
|
|
40
39
|
yearTextSize?: TextProps['size'];
|
|
41
40
|
yearTextWeight?: TextProps['textWeight'];
|
|
42
41
|
};
|
|
43
|
-
type DatePickerInputProps = DatePickerInputAppearanceProps & Omit<DatePickerProps, 'onChange'> & {
|
|
44
|
-
className?: string;
|
|
45
|
-
dataTestId?: string;
|
|
46
|
-
dataTour?: string;
|
|
47
|
-
datePickerProps?: DatePickerInputAppearanceProps & Omit<DatePickerProps, 'selectsRange'> & {
|
|
48
|
-
selectsRange?: boolean;
|
|
49
|
-
};
|
|
50
|
-
endValue?: string | Date | DateIso;
|
|
51
|
-
onChange?: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
52
|
-
popperPlacement?: ReactNode;
|
|
53
|
-
value?: string | Date | DateIso;
|
|
54
|
-
};
|
|
55
42
|
type DatePickerCustomInput = {
|
|
43
|
+
clearButton?: ButtonProps['label'];
|
|
44
|
+
clearButtonAppearance?: ButtonProps['appearance'];
|
|
56
45
|
clearIcon?: IconProps['SvgImage'];
|
|
57
|
-
|
|
58
|
-
clearIconFillHover?: IconProps['fillHover'];
|
|
59
|
-
clearIconFillSize?: IconProps['fillSize'];
|
|
60
|
-
clearIconItemFill?: IconProps['iconFill'];
|
|
61
|
-
clearIconItemFillHover?: IconProps['iconFillHover'];
|
|
62
|
-
clearIconShape?: IconProps['shape'];
|
|
63
|
-
clearIconSize?: IconProps['size'];
|
|
46
|
+
clearIconAppearance?: IconProps['appearance'];
|
|
64
47
|
clearIconSrc?: IconProps['imageSrc'];
|
|
65
|
-
clearLabel?: LabelProps['label'];
|
|
66
|
-
clearLabelTextColor?: LabelProps['labelTextColor'];
|
|
67
|
-
clearLabelTextColorHover?: LabelProps['labelTextColorHover'];
|
|
68
|
-
clearLabelTextSize?: LabelProps['labelTextSize'];
|
|
69
48
|
datepickerRef?: RefObject<DatePicker | null>;
|
|
70
49
|
inputIcon?: IconProps['SvgImage'];
|
|
71
50
|
inputIconFill?: IconProps['fill'];
|
|
@@ -80,6 +59,21 @@ type DatePickerCustomInput = {
|
|
|
80
59
|
labelTextSize?: TextSizeProps;
|
|
81
60
|
value?: string;
|
|
82
61
|
};
|
|
62
|
+
type DatePickerInputClearProps = Pick<DatePickerCustomInput, 'clearButton' | 'clearButtonAppearance' | 'clearIcon' | 'clearIconAppearance' | 'clearIconSrc'>;
|
|
63
|
+
type DatePickerInputProps = DatePickerInputAppearanceProps & Omit<DatePickerProps, 'onChange'> & {
|
|
64
|
+
className?: string;
|
|
65
|
+
dataTestId?: string;
|
|
66
|
+
dataTour?: string;
|
|
67
|
+
datePickerProps?: DatePickerInputAppearanceProps & Omit<DatePickerProps, 'selectsRange'> & {
|
|
68
|
+
isClearable?: boolean;
|
|
69
|
+
selectsRange?: boolean;
|
|
70
|
+
};
|
|
71
|
+
endValue?: string | Date | DateIso;
|
|
72
|
+
inputProps?: DatePickerInputClearProps & InputProps;
|
|
73
|
+
onChange?: (dateStart: Date | null, dateEnd: Date | null) => void;
|
|
74
|
+
popperPlacement?: ReactNode;
|
|
75
|
+
value?: string | Date | DateIso;
|
|
76
|
+
};
|
|
83
77
|
type DatePickerInputIcon = {
|
|
84
78
|
inputIcon?: IconProps['SvgImage'];
|
|
85
79
|
inputIconFill?: IconProps['fill'];
|
|
@@ -7,7 +7,6 @@ import { useAppearanceConfig, useDevicePropsGenerator, useStyles, } from '@itcas
|
|
|
7
7
|
import { Button } from 'src/components/Button';
|
|
8
8
|
import { Icon } from 'src/components/Icon';
|
|
9
9
|
import { Input } from 'src/components/Input';
|
|
10
|
-
import { Label } from 'src/components/Label';
|
|
11
10
|
import { Text } from 'src/components/Text';
|
|
12
11
|
import { datePickerAppearance } from './DatePicker.appearance';
|
|
13
12
|
import { getWeekRange } from './DatePicker.utils';
|
|
@@ -90,16 +89,16 @@ const DatePickerCustomInput = React.forwardRef((props, ref) => {
|
|
|
90
89
|
}
|
|
91
90
|
return '';
|
|
92
91
|
}, [value]);
|
|
93
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Input, { ...props, ...inputProps, className: clsx(inputProps?.className, 'datepicker__input'), ref: ref, autocomplete: "off", value: multipleValue }), inputIcon && _jsx(DatePickerInputIcon, { ...inputProps }), isClearable && _jsx(DatePickerClearButton, { ...inputProps })] }));
|
|
92
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Input, { ...props, ...inputProps, className: clsx(inputProps?.className, 'datepicker__input'), ref: ref, autocomplete: "off", value: multipleValue }), inputIcon && _jsx(DatePickerInputIcon, { ...inputProps }), isClearable && (_jsx(DatePickerClearButton, { datepickerRef: props.datepickerRef, ...inputProps }))] }));
|
|
94
93
|
});
|
|
95
94
|
function DatePickerClearButton(props) {
|
|
96
|
-
const {
|
|
95
|
+
const { clearButton, clearButtonAppearance, clearIcon, clearIconAppearance, clearIconSrc, datepickerRef, } = props;
|
|
97
96
|
const onClick = useCallback((event) => {
|
|
98
97
|
datepickerRef?.current?.onClearClick(event);
|
|
99
98
|
datepickerRef?.current?.handleFocus(event);
|
|
100
99
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
101
100
|
}, []);
|
|
102
|
-
return (_jsx(React.Fragment, { children:
|
|
101
|
+
return (_jsx(React.Fragment, { children: clearButton ? (_jsx(Button, { appearance: clearButtonAppearance, className: clsx('react-datepicker__clear-button', 'cursor_type_pointer'), label: clearButton, onClick: onClick })) : ((clearIcon || clearIconSrc) && (_jsx(Icon, { appearance: clearIconAppearance, className: clsx('react-datepicker__clear-icon', 'cursor_type_pointer'), imageSrc: clearIconSrc, SvgImage: clearIcon, onClick: onClick }))) }));
|
|
103
102
|
}
|
|
104
103
|
function DatePickerInputIcon(props) {
|
|
105
104
|
const { inputIcon, inputIconFill, inputIconFillHover, inputIconFillSize, inputIconItemFill, inputIconShape, inputIconSize, inputIconSrc, onClick, } = props;
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -12,7 +20,8 @@ declare const meta: {
|
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
14
22
|
type Story = StoryObj<typeof meta>;
|
|
15
|
-
export declare const
|
|
23
|
+
export declare const Default: Story;
|
|
24
|
+
export declare const WithInitialDate: Story;
|
|
16
25
|
export declare const DateTime: Story;
|
|
17
26
|
export declare const DateRange: Story;
|
|
18
27
|
export declare const DateWeek: Story;
|
|
@@ -1,82 +1,80 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DatePickerInput } from '../DatePicker';
|
|
2
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Molecules / DatePicker',
|
|
5
5
|
component: DatePickerInput,
|
|
6
6
|
args: {
|
|
7
7
|
width: '220px',
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
10
|
+
dateFormat: 'dd.MM.yyyy',
|
|
11
|
+
placeholderText: 'Выберите дату',
|
|
12
|
+
},
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: 'centered',
|
|
11
19
|
},
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
14
|
-
|
|
22
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
23
|
+
export const Default = {
|
|
24
|
+
render: DatePickerStory,
|
|
25
|
+
};
|
|
26
|
+
export const WithInitialDate = {
|
|
15
27
|
args: {
|
|
16
28
|
datePickerProps: {
|
|
17
|
-
|
|
18
|
-
},
|
|
19
|
-
inputProps: {
|
|
20
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
29
|
+
placeholderText: 'Дата с начальным значением',
|
|
21
30
|
},
|
|
31
|
+
value: '2025-06-15',
|
|
22
32
|
},
|
|
23
|
-
render:
|
|
24
|
-
return _jsx(DatePickerInput, { ...args });
|
|
25
|
-
},
|
|
33
|
+
render: DatePickerStory,
|
|
26
34
|
};
|
|
27
35
|
export const DateTime = {
|
|
28
36
|
args: {
|
|
29
37
|
datePickerProps: {
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
dateFormat: 'dd.MM.yyyy HH:mm',
|
|
39
|
+
placeholderText: 'Дата и время',
|
|
32
40
|
popperPlacement: 'bottom',
|
|
33
41
|
showTimeSelect: true,
|
|
34
42
|
timeCaption: 'Время',
|
|
35
|
-
timeFormat: '
|
|
43
|
+
timeFormat: 'HH:mm',
|
|
36
44
|
timeIntervals: 15,
|
|
37
45
|
},
|
|
38
|
-
|
|
39
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
render: (args) => {
|
|
43
|
-
return _jsx(DatePickerInput, { ...args });
|
|
46
|
+
value: '2025-06-15T14:30:00',
|
|
44
47
|
},
|
|
48
|
+
render: DatePickerStory,
|
|
45
49
|
};
|
|
46
50
|
export const DateRange = {
|
|
47
51
|
args: {
|
|
48
52
|
width: '360px',
|
|
49
53
|
datePickerProps: {
|
|
50
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
51
54
|
monthsShown: 2,
|
|
52
|
-
placeholderText: '
|
|
55
|
+
placeholderText: 'Начало – конец',
|
|
53
56
|
selectsRange: true,
|
|
54
57
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
render: (args) => {
|
|
60
|
-
return _jsx(DatePickerInput, { ...args });
|
|
58
|
+
endValue: '2025-06-20',
|
|
59
|
+
value: '2025-06-01',
|
|
61
60
|
},
|
|
61
|
+
render: DatePickerStory,
|
|
62
62
|
};
|
|
63
63
|
export const DateWeek = {
|
|
64
64
|
args: {
|
|
65
|
+
width: '360px',
|
|
65
66
|
datePickerProps: {
|
|
66
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
67
67
|
dateFormat: 'I неделя',
|
|
68
68
|
monthsShown: 2,
|
|
69
|
+
placeholderText: 'Выберите неделю',
|
|
69
70
|
readOnly: false,
|
|
70
71
|
selectsRange: true,
|
|
71
72
|
showWeekNumbers: true,
|
|
72
73
|
showWeekPicker: false,
|
|
73
74
|
isClearable: false,
|
|
74
75
|
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
render: (args) => {
|
|
80
|
-
return _jsx(DatePickerInput, { ...args });
|
|
76
|
+
endValue: '2025-06-15',
|
|
77
|
+
value: '2025-06-09',
|
|
81
78
|
},
|
|
79
|
+
render: DatePickerStory,
|
|
82
80
|
};
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
readOnly: false;
|
|
13
|
+
isClearable: true;
|
|
14
|
+
onKeyDown: (event: import("react").KeyboardEvent<HTMLElement>) => void;
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -13,4 +21,4 @@ declare const meta: {
|
|
|
13
21
|
export default meta;
|
|
14
22
|
type Story = StoryObj<typeof meta>;
|
|
15
23
|
export declare const ClearIcon: Story;
|
|
16
|
-
export declare const
|
|
24
|
+
export declare const ClearButton: Story;
|
|
@@ -1,50 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { icons24 } from '@itcase/icons-default';
|
|
2
2
|
import { DatePickerInput } from '../DatePicker';
|
|
3
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
4
|
const meta = {
|
|
4
5
|
title: 'Molecules / DatePicker / Clear',
|
|
5
6
|
component: DatePickerInput,
|
|
6
7
|
args: {
|
|
7
8
|
width: '220px',
|
|
9
|
+
datePickerProps: {
|
|
10
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
11
|
+
dateFormat: 'dd.MM.yyyy',
|
|
12
|
+
placeholderText: 'Выберите дату',
|
|
13
|
+
readOnly: false,
|
|
14
|
+
isClearable: true,
|
|
15
|
+
onKeyDown: (event) => event.preventDefault(),
|
|
16
|
+
},
|
|
8
17
|
},
|
|
9
18
|
parameters: {
|
|
10
19
|
layout: 'centered',
|
|
11
20
|
},
|
|
12
21
|
};
|
|
13
22
|
export default meta;
|
|
23
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
14
24
|
export const ClearIcon = {
|
|
15
25
|
args: {
|
|
16
|
-
datePickerProps: {
|
|
17
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
18
|
-
readOnly: false,
|
|
19
|
-
isClearable: true,
|
|
20
|
-
onKeyDown: (e) => {
|
|
21
|
-
e.preventDefault();
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
26
|
inputProps: {
|
|
25
27
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
28
|
+
clearIcon: icons24.Action.Clear,
|
|
29
|
+
clearIconAppearance: 'surfaceTertiary size24_24 ghost circular',
|
|
26
30
|
},
|
|
31
|
+
value: '2025-06-15',
|
|
27
32
|
},
|
|
28
|
-
render:
|
|
29
|
-
return _jsx(DatePickerInput, { ...args });
|
|
30
|
-
},
|
|
33
|
+
render: DatePickerStory,
|
|
31
34
|
};
|
|
32
|
-
export const
|
|
35
|
+
export const ClearButton = {
|
|
33
36
|
args: {
|
|
34
37
|
width: '360px',
|
|
35
|
-
datePickerProps: {
|
|
36
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
37
|
-
readOnly: false,
|
|
38
|
-
isClearable: true,
|
|
39
|
-
onKeyDown: (e) => {
|
|
40
|
-
e.preventDefault();
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
38
|
inputProps: {
|
|
44
39
|
appearance: 'defaultPrimary sizeM solid rounded',
|
|
40
|
+
clearButton: 'Очистить',
|
|
41
|
+
clearButtonAppearance: 'surfaceSecondary sizeM solid rounded',
|
|
45
42
|
},
|
|
43
|
+
value: '2025-06-15',
|
|
46
44
|
},
|
|
47
|
-
render:
|
|
48
|
-
return _jsx(DatePickerInput, { ...args });
|
|
49
|
-
},
|
|
45
|
+
render: DatePickerStory,
|
|
50
46
|
};
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|
|
@@ -1,52 +1,41 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DatePickerInput } from '../DatePicker';
|
|
2
|
+
import { createDatePickerStory } from './DatePickerStory';
|
|
3
3
|
const meta = {
|
|
4
4
|
title: 'Molecules / DatePicker / Size',
|
|
5
5
|
component: DatePickerInput,
|
|
6
6
|
args: {
|
|
7
7
|
width: '220px',
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: 'surfacePrimary sizeM solid rounded',
|
|
10
|
+
dateFormat: 'dd.MM.yyyy',
|
|
11
|
+
placeholderText: 'Выберите дату',
|
|
12
|
+
},
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: 'defaultPrimary sizeM solid rounded',
|
|
15
|
+
},
|
|
8
16
|
},
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: 'centered',
|
|
11
19
|
},
|
|
12
20
|
};
|
|
13
21
|
export default meta;
|
|
22
|
+
const DatePickerStory = createDatePickerStory(meta.args);
|
|
14
23
|
export const SizeL = {
|
|
15
24
|
args: {
|
|
16
|
-
datePickerProps: {
|
|
17
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
18
|
-
},
|
|
19
25
|
inputProps: {
|
|
20
26
|
appearance: 'defaultPrimary sizeL solid rounded',
|
|
21
27
|
},
|
|
22
28
|
},
|
|
23
|
-
render:
|
|
24
|
-
return _jsx(DatePickerInput, { ...args });
|
|
25
|
-
},
|
|
29
|
+
render: DatePickerStory,
|
|
26
30
|
};
|
|
27
31
|
export const SizeM = {
|
|
28
|
-
|
|
29
|
-
datePickerProps: {
|
|
30
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
31
|
-
},
|
|
32
|
-
inputProps: {
|
|
33
|
-
appearance: 'defaultPrimary sizeM solid rounded',
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
render: (args) => {
|
|
37
|
-
return _jsx(DatePickerInput, { ...args });
|
|
38
|
-
},
|
|
32
|
+
render: DatePickerStory,
|
|
39
33
|
};
|
|
40
34
|
export const SizeS = {
|
|
41
35
|
args: {
|
|
42
|
-
datePickerProps: {
|
|
43
|
-
appearance: 'surfacePrimary sizeM solid rounded',
|
|
44
|
-
},
|
|
45
36
|
inputProps: {
|
|
46
37
|
appearance: 'defaultPrimary sizeS solid rounded',
|
|
47
38
|
},
|
|
48
39
|
},
|
|
49
|
-
render:
|
|
50
|
-
return _jsx(DatePickerInput, { ...args });
|
|
51
|
-
},
|
|
40
|
+
render: DatePickerStory,
|
|
52
41
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { DatePickerInput } from '../DatePicker';
|
|
4
|
+
export function createDatePickerStory(defaultArgs = {}) {
|
|
5
|
+
return function DatePickerStory(args) {
|
|
6
|
+
const [dates, setDates] = useState(() => ({
|
|
7
|
+
end: args.endValue ? new Date(args.endValue) : null,
|
|
8
|
+
start: args.value ? new Date(args.value) : null,
|
|
9
|
+
}));
|
|
10
|
+
return (_jsx(DatePickerInput, { ...defaultArgs, ...args, datePickerProps: {
|
|
11
|
+
...defaultArgs.datePickerProps,
|
|
12
|
+
...args.datePickerProps,
|
|
13
|
+
}, endValue: dates.end?.toISOString(), inputProps: {
|
|
14
|
+
...defaultArgs.inputProps,
|
|
15
|
+
...args.inputProps,
|
|
16
|
+
}, value: dates.start?.toISOString(), onChange: (start, end) => setDates({ end, start }) }));
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -5,6 +5,14 @@ declare const meta: {
|
|
|
5
5
|
component: typeof DatePickerInput;
|
|
6
6
|
args: {
|
|
7
7
|
width: "220px";
|
|
8
|
+
datePickerProps: {
|
|
9
|
+
appearance: "surfacePrimary sizeM solid rounded";
|
|
10
|
+
dateFormat: string;
|
|
11
|
+
placeholderText: string;
|
|
12
|
+
};
|
|
13
|
+
inputProps: {
|
|
14
|
+
appearance: "defaultPrimary sizeM solid rounded";
|
|
15
|
+
};
|
|
8
16
|
};
|
|
9
17
|
parameters: {
|
|
10
18
|
layout: string;
|