@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.
Files changed (68) hide show
  1. package/dist/DatePicker_cjs_Cd7wsJCG.js +1 -0
  2. package/dist/DatePicker_es_BhrZj2OP.js +1 -0
  3. package/dist/cjs/components/AvatarStack.js +1 -1
  4. package/dist/cjs/components/DatePeriod.js +1 -1
  5. package/dist/cjs/components/DatePicker.js +1 -1
  6. package/dist/cjs/components/Dropzone.js +1 -1
  7. package/dist/components/AvatarStack.js +1 -1
  8. package/dist/components/DatePeriod.js +1 -1
  9. package/dist/components/DatePicker.js +1 -1
  10. package/dist/components/Dropzone.js +1 -1
  11. package/dist/css/styles/bundles.css +13 -1
  12. package/dist/stories/DatePickerOverview.mdx +1 -1
  13. package/dist/types/components/Avatar/stories/AvatarCount.stories.d.ts +4 -0
  14. package/dist/types/components/Avatar/stories/AvatarCount.stories.js +4 -0
  15. package/dist/types/components/Avatar/stories/AvatarDemo.stories.js +4 -0
  16. package/dist/types/components/Avatar/stories/AvatarImage.stories.d.ts +4 -0
  17. package/dist/types/components/Avatar/stories/AvatarImage.stories.js +4 -0
  18. package/dist/types/components/Avatar/stories/AvatarInteraction.stories.d.ts +4 -0
  19. package/dist/types/components/Avatar/stories/AvatarInteraction.stories.js +4 -0
  20. package/dist/types/components/Avatar/stories/AvatarLetters.stories.d.ts +4 -0
  21. package/dist/types/components/Avatar/stories/AvatarLetters.stories.js +4 -0
  22. package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.d.ts +4 -0
  23. package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.js +4 -0
  24. package/dist/types/components/AvatarStack/AvatarStack.interface.d.ts +6 -11
  25. package/dist/types/components/AvatarStack/AvatarStack.js +3 -13
  26. package/dist/types/components/AvatarStack/index.d.ts +1 -1
  27. package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.d.ts +12 -4
  28. package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.js +49 -13
  29. package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.d.ts +6 -2
  30. package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.js +7 -12
  31. package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.d.ts +9 -1
  32. package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.js +51 -37
  33. package/dist/types/components/AvatarStack/{__test__/AvatarStackTest.stories.d.ts → stories/AvatarStackSkeleton.stories.d.ts} +7 -2
  34. package/dist/types/components/AvatarStack/stories/AvatarStackSkeleton.stories.js +47 -0
  35. package/dist/types/components/AvatarStack/stories/__mock__/index.js +11 -5
  36. package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.d.ts +8 -9
  37. package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.js +33 -72
  38. package/dist/types/components/DatePicker/DatePicker.interface.d.ts +22 -28
  39. package/dist/types/components/DatePicker/DatePicker.js +3 -4
  40. package/dist/types/components/DatePicker/stories/DatePicker.stories.d.ts +10 -1
  41. package/dist/types/components/DatePicker/stories/DatePicker.stories.js +31 -33
  42. package/dist/types/components/DatePicker/stories/DatePickerClear.stories.d.ts +9 -1
  43. package/dist/types/components/DatePicker/stories/DatePickerClear.stories.js +20 -24
  44. package/dist/types/components/DatePicker/stories/DatePickerSize.stories.d.ts +8 -0
  45. package/dist/types/components/DatePicker/stories/DatePickerSize.stories.js +13 -24
  46. package/dist/types/components/DatePicker/stories/DatePickerStory.d.ts +2 -0
  47. package/dist/types/components/DatePicker/stories/DatePickerStory.js +18 -0
  48. package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.d.ts +8 -0
  49. package/dist/types/components/DatePicker/stories/DatePickerStyle.stories.js +13 -29
  50. package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.d.ts +12 -1
  51. package/dist/types/components/DatePicker/stories/DatePickerWithButton.stories.js +30 -32
  52. package/dist/types/components/Divider/__test__/DividerTest.stories.js +3 -3
  53. package/dist/types/components/Dropzone/Dropzone.appearance.d.ts +1 -0
  54. package/dist/types/components/Dropzone/Dropzone.js +1 -1
  55. package/dist/types/components/Dropzone/appearance/dropzoneDefault.d.ts +1 -0
  56. package/dist/types/components/Dropzone/appearance/dropzoneDefault.js +1 -0
  57. package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.d.ts +1 -0
  58. package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.js +7 -0
  59. package/dist/types/components/Dropzone/stories/__mock__/index.d.ts +4 -0
  60. package/dist/types/components/Dropzone/stories/__mock__/index.js +19 -0
  61. package/package.json +2 -2
  62. package/dist/DatePicker_cjs_BhZXIBZm.js +0 -1
  63. package/dist/DatePicker_es_vJagTqXm.js +0 -1
  64. package/dist/types/components/AvatarStack/AvatarStack.appearance.d.ts +0 -21
  65. package/dist/types/components/AvatarStack/AvatarStack.appearance.js +0 -5
  66. package/dist/types/components/AvatarStack/__test__/AvatarStackTest.stories.js +0 -45
  67. package/dist/types/components/AvatarStack/appearance/avatarStackSize.d.ts +0 -21
  68. package/dist/types/components/AvatarStack/appearance/avatarStackSize.js +0 -21
@@ -61264,8 +61264,12 @@ h2.react-datepicker__current-month {
61264
61264
  right: 12px;
61265
61265
  transform: translateY(-50%);
61266
61266
  }
61267
- &__clear-label {
61267
+ &__clear-button {
61268
+ position: absolute;
61269
+ top: 50%;
61270
+ right: 12px;
61268
61271
  width: auto;
61272
+ transform: translateY(-50%);
61269
61273
  }
61270
61274
  &__input-icon.icon {
61271
61275
  background: #fff;
@@ -61340,6 +61344,12 @@ h2.react-datepicker__current-month {
61340
61344
  &__input-time-container {
61341
61345
  grid-row-start: 2;
61342
61346
  grid-column-start: span 2;
61347
+ &:not(:last-child) {
61348
+ display: none;
61349
+ }
61350
+ &:last-child {
61351
+ grid-column: 1 / -1;
61352
+ }
61343
61353
  }
61344
61354
  }
61345
61355
  }
@@ -61347,12 +61357,14 @@ h2.react-datepicker__current-month {
61347
61357
  :root {
61348
61358
  --date-picker-padding: 24px 12px;
61349
61359
  --date-picker-fill: var(--color-surface-fill-primary);
61360
+ --date-picker-background: var(--date-picker-fill);
61350
61361
  --date-picker-box-shadow: 0px 4px 24px 0px rgb(0, 0, 0, 0.2);
61351
61362
  --date-picker-border-radius: 12px;
61352
61363
  --date-picker-border: solid 1px var(--color-surface-fill-tertiary);
61353
61364
 
61354
61365
  --date-picker-input-container-padding: 9px 15px;
61355
61366
  --date-picker-input-border-radius: 6px;
61367
+ --date-picker-input-min-width: 70px;
61356
61368
 
61357
61369
  --date-picker-selected-weight: 400;
61358
61370
  --date-picker-week-width: 40px;
@@ -8,5 +8,5 @@ import * as DatePickerStories from '../stories/DatePicker.stories'
8
8
 
9
9
  `DatePicker` — это календарь, который используется для выбора даты, либо диапазона дат.
10
10
 
11
- <Story of={DatePickerStories.Date} />
11
+ <Story of={DatePickerStories.Default} />
12
12
 
@@ -10,6 +10,10 @@ declare const meta: {
10
10
  };
11
11
  parameters: {
12
12
  layout: string;
13
+ design: {
14
+ type: string;
15
+ url: string;
16
+ };
13
17
  };
14
18
  tags: string[];
15
19
  };
@@ -11,6 +11,10 @@ const meta = {
11
11
  },
12
12
  parameters: {
13
13
  layout: 'centered',
14
+ design: {
15
+ type: 'figma',
16
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
17
+ },
14
18
  },
15
19
  tags: ['test'],
16
20
  };
@@ -32,6 +32,10 @@ const meta = {
32
32
  isSkeleton: false,
33
33
  },
34
34
  parameters: {
35
+ design: {
36
+ type: 'figma',
37
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
38
+ },
35
39
  layout: 'centered',
36
40
  },
37
41
  argTypes: {
@@ -10,6 +10,10 @@ declare const meta: {
10
10
  };
11
11
  parameters: {
12
12
  layout: string;
13
+ design: {
14
+ type: string;
15
+ url: string;
16
+ };
13
17
  };
14
18
  tags: string[];
15
19
  };
@@ -11,6 +11,10 @@ const meta = {
11
11
  },
12
12
  parameters: {
13
13
  layout: 'centered',
14
+ design: {
15
+ type: 'figma',
16
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
17
+ },
14
18
  },
15
19
  tags: ['test'],
16
20
  };
@@ -9,6 +9,10 @@ declare const meta: {
9
9
  };
10
10
  parameters: {
11
11
  layout: string;
12
+ design: {
13
+ type: string;
14
+ url: string;
15
+ };
12
16
  };
13
17
  tags: string[];
14
18
  };
@@ -10,6 +10,10 @@ const meta = {
10
10
  },
11
11
  parameters: {
12
12
  layout: 'centered',
13
+ design: {
14
+ type: 'figma',
15
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
16
+ },
13
17
  },
14
18
  tags: ['test'],
15
19
  };
@@ -11,6 +11,10 @@ declare const meta: {
11
11
  };
12
12
  parameters: {
13
13
  layout: string;
14
+ design: {
15
+ type: string;
16
+ url: string;
17
+ };
14
18
  };
15
19
  tags: string[];
16
20
  };
@@ -12,6 +12,10 @@ const meta = {
12
12
  },
13
13
  parameters: {
14
14
  layout: 'centered',
15
+ design: {
16
+ type: 'figma',
17
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
18
+ },
15
19
  },
16
20
  tags: ['test'],
17
21
  };
@@ -10,6 +10,10 @@ declare const meta: {
10
10
  };
11
11
  parameters: {
12
12
  layout: string;
13
+ design: {
14
+ type: string;
15
+ url: string;
16
+ };
13
17
  };
14
18
  tags: string[];
15
19
  };
@@ -11,6 +11,10 @@ const meta = {
11
11
  },
12
12
  parameters: {
13
13
  layout: 'centered',
14
+ design: {
15
+ type: 'figma',
16
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=3-2&t=nC7GgbHgKhjeziiL-1',
17
+ },
14
18
  },
15
19
  tags: ['test'],
16
20
  };
@@ -1,26 +1,21 @@
1
1
  import { StringId } from '@itcase/types-core';
2
- import type { AppearanceKeysPx, AppearancePartialRecord, AppearanceSizePxKey, DirectionProps, SizePXProps } from '@itcase/types-ui';
2
+ import type { DirectionProps, SizePXProps } from '@itcase/types-ui';
3
+ import { CompositeAppearanceWithoutSizeKeys } from '@itcase/types-ui';
3
4
  import { StyleAttributes } from '@itcase/ui-core/hooks';
4
- import { AvatarConfig, AvatarProps } from '../Avatar/Avatar.interface';
5
- type AvatarStackAppearanceProps = {
6
- size?: SizePXProps;
7
- };
8
5
  type AvatarsItem = {
9
6
  id: StringId;
10
7
  firstName: string;
11
8
  lastName: string;
12
9
  src: string;
13
10
  };
14
- type AvatarStackProps = AvatarStackAppearanceProps & StyleAttributes & {
15
- appearance?: AppearanceKeysPx;
16
- avatarAppearance?: AvatarProps['appearance'];
11
+ type AvatarStackProps = StyleAttributes & {
12
+ avatarAppearance?: CompositeAppearanceWithoutSizeKeys;
17
13
  avatarsList: AvatarsItem[];
18
14
  className?: string;
19
15
  dataTestId?: string;
20
16
  direction?: DirectionProps;
21
17
  isSkeleton?: boolean;
22
18
  length?: number;
19
+ size?: SizePXProps;
23
20
  };
24
- type AvatarStackAppearance = AvatarConfig['appearance'];
25
- type AvatarStackAppearanceSize = AppearancePartialRecord<AppearanceSizePxKey, AvatarStackAppearanceProps, 'size'>;
26
- export type { AvatarStackAppearance, AvatarStackAppearanceSize, AvatarStackProps, };
21
+ export type { AvatarStackProps };
@@ -1,23 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import clsx from 'clsx';
3
- import { useAppearanceConfig, useDevicePropsGenerator, useStyles, } from '@itcase/ui-core/hooks';
3
+ import { useStyles } from '@itcase/ui-core/hooks';
4
4
  import { mergeAppearanceKeys } from '@itcase/ui-core/utils';
5
5
  import { Avatar } from 'src/components/Avatar';
6
6
  import { Group } from 'src/components/Group';
7
7
  import { Text } from 'src/components/Text';
8
- import { avatarStackAppearance } from './AvatarStack.appearance';
9
- const avatarStackConfig = {
10
- appearance: avatarStackAppearance,
11
- setAppearance: (appearanceConfig) => {
12
- avatarStackConfig.appearance = appearanceConfig;
13
- },
14
- };
15
8
  function AvatarStack(props) {
16
- const { appearance, className, dataTestId, direction = 'horizontal', avatarAppearance, avatarsList, length = 3, isSkeleton, } = props;
17
- const appearanceConfig = useAppearanceConfig(appearance, avatarStackConfig);
18
- const propsGenerator = useDevicePropsGenerator(props, appearanceConfig);
19
- const { size } = propsGenerator;
9
+ const { className, dataTestId, direction = 'horizontal', size = '56', avatarAppearance, avatarsList, length = 3, isSkeleton, } = props;
20
10
  const { styles: avatarStackStyles } = useStyles(props);
21
- return (avatarsList.length && (_jsxs("div", { className: clsx(className, 'avatar-stack', direction && `group_direction_${direction}`, size && `avatar-stack_size_${size}`, isSkeleton && `skeleton`), "data-testid": dataTestId, style: avatarStackStyles, children: [avatarsList.slice(0, length).map((item) => (_jsx(Avatar, { appearance: mergeAppearanceKeys(avatarAppearance, `size${size}`), className: "avatar-stack__item", src: item.src, textSize: "l", firstName: item.firstName, secondName: item.lastName, shape: "circular" }, item.id))), avatarsList.length > length && (_jsx(Group, { className: "avatar-stack__item avatar-stack__item-text", width: `${size}px`, height: `${size}px`, fill: "surfaceSecondary", children: _jsxs(Text, { size: "xs", textColor: "surfaceTextPrimary", textWeight: "600", children: ["+", avatarsList.length - length] }) }))] })));
11
+ return (avatarsList.length && (_jsxs("div", { className: clsx(className, 'avatar-stack', direction && `avatar-stack_direction_${direction}`, `avatar-stack_size_${size}`), "data-testid": dataTestId, style: avatarStackStyles, children: [avatarsList.slice(0, length).map((item) => (_jsx(Avatar, { appearance: mergeAppearanceKeys(avatarAppearance, `size${size}`), className: "avatar-stack__item", src: item.src, firstName: item.firstName, secondName: item.lastName, isSkeleton: isSkeleton }, item.id))), avatarsList.length > length && (_jsx(Group, { className: clsx('avatar-stack__item avatar-stack__item-text', isSkeleton && 'skeleton'), width: `${size}px`, height: `${size}px`, fill: "surfaceSecondary", children: _jsxs(Text, { size: "xs", textColor: "surfaceTextPrimary", textWeight: "600", children: ["+", avatarsList.length - length] }) }))] })));
22
12
  }
23
13
  export { AvatarStack };
@@ -1,3 +1,3 @@
1
1
  import { AvatarStack } from './AvatarStack';
2
2
  export { AvatarStack };
3
- export type { AvatarStackAppearance, AvatarStackProps, } from './AvatarStack.interface';
3
+ export type { AvatarStackProps } from './AvatarStack.interface';
@@ -4,8 +4,9 @@ declare const meta: {
4
4
  title: string;
5
5
  component: typeof AvatarStack;
6
6
  args: {
7
- appearance: "size56";
8
- avatarAppearance: "surfaceSecondary size56 solid rounded";
7
+ dataTestId: string;
8
+ size: "56";
9
+ avatarAppearance: "surfaceSecondary solid circular";
9
10
  avatarsList: {
10
11
  id: string;
11
12
  src: string;
@@ -15,10 +16,17 @@ declare const meta: {
15
16
  };
16
17
  parameters: {
17
18
  layout: string;
19
+ design: {
20
+ type: string;
21
+ url: string;
22
+ };
18
23
  };
24
+ tags: string[];
19
25
  };
20
26
  export default meta;
21
27
  type Story = StoryObj<typeof meta>;
22
- export declare const Length3: Story;
23
- export declare const Length2: Story;
24
28
  export declare const Length1: Story;
29
+ export declare const Length2: Story;
30
+ export declare const Length3: Story;
31
+ export declare const Length4: Story;
32
+ export declare const Length5: Story;
@@ -1,40 +1,76 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as storybookTest from 'storybook/test';
2
3
  import { AvatarStack } from '..';
3
4
  import { avatarsListMock } from './__mock__';
4
5
  const meta = {
5
6
  title: 'Molecules / Avatar Stack / Length',
6
7
  component: AvatarStack,
7
8
  args: {
8
- appearance: 'size56',
9
- avatarAppearance: `surfaceSecondary size56 solid rounded`,
9
+ dataTestId: 'avatarStackLengthTestId',
10
+ size: '56',
11
+ avatarAppearance: 'surfaceSecondary solid circular',
10
12
  avatarsList: avatarsListMock,
11
13
  },
12
14
  parameters: {
13
15
  layout: 'centered',
16
+ design: {
17
+ type: 'figma',
18
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=726-536&t=nC7GgbHgKhjeziiL-1',
19
+ },
14
20
  },
21
+ tags: ['test'],
15
22
  };
16
23
  export default meta;
17
- export const Length3 = {
24
+ const lengthPlay = async ({ args, canvas, step }) => {
25
+ const { dataTestId, avatarsList = avatarsListMock, length = 0 } = args;
26
+ const overflow = avatarsList.length - length;
27
+ await step(`AvatarStack: ${length} avatar(s)${overflow > 0 ? ` and +${overflow} badge` : ', no overflow badge'}`, async () => {
28
+ const root = canvas.getByTestId(dataTestId);
29
+ const items = root.querySelectorAll(':scope > .avatar-stack__item:not(.avatar-stack__item-text)');
30
+ const badge = root.querySelector(':scope > .avatar-stack__item-text');
31
+ await storybookTest
32
+ .expect({
33
+ overflow: badge?.textContent ?? null,
34
+ avatars: items.length,
35
+ })
36
+ .toEqual({
37
+ overflow: overflow > 0 ? `+${overflow}` : null,
38
+ avatars: length,
39
+ });
40
+ });
41
+ };
42
+ export const Length1 = {
18
43
  args: {
19
- length: 3,
20
- },
21
- render: (args) => {
22
- return _jsx(AvatarStack, { ...args });
44
+ length: 1,
23
45
  },
46
+ play: lengthPlay,
47
+ render: (args) => _jsx(AvatarStack, { ...args }),
24
48
  };
25
49
  export const Length2 = {
26
50
  args: {
27
51
  length: 2,
28
52
  },
29
- render: (args) => {
30
- return _jsx(AvatarStack, { ...args });
53
+ play: lengthPlay,
54
+ render: (args) => _jsx(AvatarStack, { ...args }),
55
+ };
56
+ export const Length3 = {
57
+ args: {
58
+ length: 3,
31
59
  },
60
+ play: lengthPlay,
61
+ render: (args) => _jsx(AvatarStack, { ...args }),
32
62
  };
33
- export const Length1 = {
63
+ export const Length4 = {
34
64
  args: {
35
- length: 1,
65
+ length: 4,
36
66
  },
37
- render: (args) => {
38
- return _jsx(AvatarStack, { ...args });
67
+ play: lengthPlay,
68
+ render: (args) => _jsx(AvatarStack, { ...args }),
69
+ };
70
+ export const Length5 = {
71
+ args: {
72
+ length: 5,
39
73
  },
74
+ play: lengthPlay,
75
+ render: (args) => _jsx(AvatarStack, { ...args }),
40
76
  };
@@ -4,7 +4,8 @@ declare const meta: {
4
4
  title: string;
5
5
  component: typeof AvatarStack;
6
6
  args: {
7
- avatarAppearance: "surfaceSecondary size56 solid rounded";
7
+ size: "56";
8
+ avatarAppearance: "surfaceSecondary solid circular";
8
9
  avatarsList: {
9
10
  id: string;
10
11
  src: string;
@@ -14,9 +15,12 @@ declare const meta: {
14
15
  };
15
16
  parameters: {
16
17
  layout: string;
18
+ design: {
19
+ type: string;
20
+ url: string;
21
+ };
17
22
  };
18
23
  };
19
24
  export default meta;
20
25
  type Story = StoryObj<typeof meta>;
21
26
  export declare const Demo: Story;
22
- export declare const Skeleton: Story;
@@ -5,24 +5,19 @@ const meta = {
5
5
  title: 'Molecules / Avatar Stack',
6
6
  component: AvatarStack,
7
7
  args: {
8
- avatarAppearance: `surfaceSecondary size56 solid rounded`,
8
+ size: '56',
9
+ avatarAppearance: 'surfaceSecondary solid circular',
9
10
  avatarsList: avatarsListMock,
10
11
  },
11
12
  parameters: {
12
13
  layout: 'centered',
14
+ design: {
15
+ type: 'figma',
16
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=726-536&t=nC7GgbHgKhjeziiL-1',
17
+ },
13
18
  },
14
19
  };
15
20
  export default meta;
16
21
  export const Demo = {
17
- render: (args) => {
18
- return _jsx(AvatarStack, { ...args });
19
- },
20
- };
21
- export const Skeleton = {
22
- args: {
23
- isSkeleton: true,
24
- },
25
- render: (args) => {
26
- return _jsx(AvatarStack, { ...args });
27
- },
22
+ render: (args) => _jsx(AvatarStack, { ...args }),
28
23
  };
@@ -4,17 +4,25 @@ declare const meta: {
4
4
  title: string;
5
5
  component: typeof AvatarStack;
6
6
  args: {
7
- avatarAppearance: "surfaceSecondary size56 solid rounded";
7
+ dataTestId: string;
8
+ size: "56";
9
+ avatarAppearance: "surfaceSecondary solid circular";
8
10
  avatarsList: {
9
11
  id: string;
10
12
  src: string;
11
13
  firstName: string;
12
14
  lastName: string;
13
15
  }[];
16
+ length: number;
14
17
  };
15
18
  parameters: {
16
19
  layout: string;
20
+ design: {
21
+ type: string;
22
+ url: string;
23
+ };
17
24
  };
25
+ tags: string[];
18
26
  };
19
27
  export default meta;
20
28
  type Story = StoryObj<typeof meta>;
@@ -1,63 +1,77 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as storybookTest from 'storybook/test';
2
3
  import { AvatarStack } from '..';
3
4
  import { avatarsListMock } from './__mock__';
4
5
  const meta = {
5
6
  title: 'Molecules / Avatar Stack / Size',
6
7
  component: AvatarStack,
7
8
  args: {
8
- avatarAppearance: `surfaceSecondary size56 solid rounded`,
9
+ dataTestId: 'avatarStackSizeTestId',
10
+ size: '56',
11
+ avatarAppearance: 'surfaceSecondary solid circular',
9
12
  avatarsList: avatarsListMock,
13
+ length: 1,
10
14
  },
11
15
  parameters: {
12
16
  layout: 'centered',
17
+ design: {
18
+ type: 'figma',
19
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=726-536&t=nC7GgbHgKhjeziiL-1',
20
+ },
13
21
  },
22
+ tags: ['test'],
14
23
  };
15
24
  export default meta;
25
+ const sizePlay = async ({ args, canvas, step }) => {
26
+ const { dataTestId, size, avatarsList = avatarsListMock, length = avatarsListMock.length, } = args;
27
+ const root = canvas.getByTestId(dataTestId);
28
+ const item = root.querySelector(':scope > .avatar-stack__item:not(.avatar-stack__item-text)');
29
+ await step(`AvatarStack: avatar ${size}px`, async () => {
30
+ await storybookTest.expect(root).toHaveClass(`avatar-stack_size_${size}`);
31
+ await storybookTest.expect(item).toHaveClass(`avatar_size_${size}`);
32
+ await storybookTest
33
+ .expect([item.clientWidth, item.clientHeight])
34
+ .toEqual([Number(size), Number(size)]);
35
+ });
36
+ const badge = root.querySelector(':scope > .avatar-stack__item-text');
37
+ await step(`Badge text is +${avatarsList.length - length}`, async () => {
38
+ await storybookTest
39
+ .expect(badge)
40
+ .toHaveTextContent(`+${avatarsList.length - length}`);
41
+ });
42
+ await step(`Badge size is ${size}px`, async () => {
43
+ await storybookTest
44
+ .expect([badge.clientWidth, badge.clientHeight])
45
+ .toEqual([Number(size), Number(size)]);
46
+ });
47
+ };
16
48
  export const Size56 = {
17
- args: {
18
- appearance: 'size56',
19
- },
20
- render: (args) => {
21
- return _jsx(AvatarStack, { ...args });
22
- },
49
+ args: { size: '56' },
50
+ play: sizePlay,
51
+ render: (args) => _jsx(AvatarStack, { ...args }),
23
52
  };
24
53
  export const Size40 = {
25
- args: {
26
- appearance: 'size40',
27
- },
28
- render: (args) => {
29
- return _jsx(AvatarStack, { ...args });
30
- },
54
+ args: { size: '40' },
55
+ play: sizePlay,
56
+ render: (args) => _jsx(AvatarStack, { ...args }),
31
57
  };
32
58
  export const Size32 = {
33
- args: {
34
- appearance: 'size32',
35
- },
36
- render: (args) => {
37
- return _jsx(AvatarStack, { ...args });
38
- },
59
+ args: { size: '32' },
60
+ play: sizePlay,
61
+ render: (args) => _jsx(AvatarStack, { ...args }),
39
62
  };
40
63
  export const Size24 = {
41
- args: {
42
- appearance: 'size24',
43
- },
44
- render: (args) => {
45
- return _jsx(AvatarStack, { ...args });
46
- },
64
+ args: { size: '24' },
65
+ play: sizePlay,
66
+ render: (args) => _jsx(AvatarStack, { ...args }),
47
67
  };
48
68
  export const Size20 = {
49
- args: {
50
- appearance: 'size20',
51
- },
52
- render: (args) => {
53
- return _jsx(AvatarStack, { ...args });
54
- },
69
+ args: { size: '20' },
70
+ play: sizePlay,
71
+ render: (args) => _jsx(AvatarStack, { ...args }),
55
72
  };
56
73
  export const Size16 = {
57
- args: {
58
- appearance: 'size16',
59
- },
60
- render: (args) => {
61
- return _jsx(AvatarStack, { ...args });
62
- },
74
+ args: { size: '16' },
75
+ play: sizePlay,
76
+ render: (args) => _jsx(AvatarStack, { ...args }),
63
77
  };
@@ -5,20 +5,25 @@ declare const meta: {
5
5
  component: typeof AvatarStack;
6
6
  args: {
7
7
  dataTestId: string;
8
- avatarAppearance: "surfaceSecondary size56 solid rounded";
8
+ size: "56";
9
+ avatarAppearance: "surfaceSecondary solid circular";
9
10
  avatarsList: {
10
11
  id: string;
11
12
  src: string;
12
13
  firstName: string;
13
14
  lastName: string;
14
15
  }[];
16
+ isSkeleton: true;
15
17
  };
16
18
  parameters: {
17
19
  layout: string;
20
+ design: {
21
+ type: string;
22
+ url: string;
23
+ };
18
24
  };
19
25
  tags: string[];
20
26
  };
21
27
  export default meta;
22
28
  type Story = StoryObj<typeof meta>;
23
29
  export declare const Skeleton: Story;
24
- export declare const Length: Story;
@@ -0,0 +1,47 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as storybookTest from 'storybook/test';
3
+ import { AvatarStack } from '../AvatarStack';
4
+ import { avatarsListMock } from './__mock__';
5
+ const meta = {
6
+ title: 'Molecules / Avatar Stack / Skeleton',
7
+ component: AvatarStack,
8
+ args: {
9
+ dataTestId: 'avatarStackSkeletonTestId',
10
+ size: '56',
11
+ avatarAppearance: 'surfaceSecondary solid circular',
12
+ avatarsList: avatarsListMock,
13
+ isSkeleton: true,
14
+ },
15
+ parameters: {
16
+ layout: 'centered',
17
+ design: {
18
+ type: 'figma',
19
+ url: 'https://www.figma.com/design/FcCWZlLa17BPr0zh3Wq9DO/ITCase---Molecules?node-id=726-536&t=nC7GgbHgKhjeziiL-1',
20
+ },
21
+ },
22
+ tags: ['test'],
23
+ };
24
+ export default meta;
25
+ const avatarItemSelector = ':scope > .avatar-stack__item:not(.avatar-stack__item-text)';
26
+ export const Skeleton = {
27
+ play: async ({ args, canvas, step }) => {
28
+ const { avatarsList = avatarsListMock, length = 3 } = args;
29
+ const hasOverflow = avatarsList.length > length;
30
+ await step(`AvatarStack: ${length} skeleton avatar(s)${hasOverflow ? ' and skeleton overflow badge' : ''}`, async () => {
31
+ const root = canvas.getByTestId(args.dataTestId);
32
+ const avatars = root.querySelectorAll(avatarItemSelector);
33
+ const overflow = root.querySelector(':scope > .avatar-stack__item-text');
34
+ await storybookTest.expect(avatars.length).toBe(length);
35
+ for (const avatar of avatars) {
36
+ await storybookTest.expect(avatar).toHaveClass('skeleton');
37
+ }
38
+ if (hasOverflow) {
39
+ await storybookTest.expect(overflow).toHaveClass('skeleton');
40
+ }
41
+ else {
42
+ await storybookTest.expect(overflow).toBeNull();
43
+ }
44
+ });
45
+ },
46
+ render: (args) => _jsx(AvatarStack, { ...args }),
47
+ };