@itcase/ui-web 1.9.112 → 1.9.114

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 (45) hide show
  1. package/dist/cjs/components/AvatarStack.js +1 -1
  2. package/dist/cjs/components/Dropzone.js +1 -1
  3. package/dist/components/AvatarStack.js +1 -1
  4. package/dist/components/Dropzone.js +1 -1
  5. package/dist/css/styles/bundles.css +14 -7
  6. package/dist/types/components/Avatar/stories/AvatarCount.stories.d.ts +4 -0
  7. package/dist/types/components/Avatar/stories/AvatarCount.stories.js +4 -0
  8. package/dist/types/components/Avatar/stories/AvatarDemo.stories.js +4 -0
  9. package/dist/types/components/Avatar/stories/AvatarImage.stories.d.ts +4 -0
  10. package/dist/types/components/Avatar/stories/AvatarImage.stories.js +4 -0
  11. package/dist/types/components/Avatar/stories/AvatarInteraction.stories.d.ts +4 -0
  12. package/dist/types/components/Avatar/stories/AvatarInteraction.stories.js +4 -0
  13. package/dist/types/components/Avatar/stories/AvatarLetters.stories.d.ts +4 -0
  14. package/dist/types/components/Avatar/stories/AvatarLetters.stories.js +4 -0
  15. package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.d.ts +4 -0
  16. package/dist/types/components/Avatar/stories/AvatarSkeleton.stories.js +4 -0
  17. package/dist/types/components/AvatarStack/AvatarStack.interface.d.ts +6 -11
  18. package/dist/types/components/AvatarStack/AvatarStack.js +3 -13
  19. package/dist/types/components/AvatarStack/index.d.ts +1 -1
  20. package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.d.ts +12 -4
  21. package/dist/types/components/AvatarStack/stories/AvatarStackCount.stories.js +49 -13
  22. package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.d.ts +6 -2
  23. package/dist/types/components/AvatarStack/stories/AvatarStackDemo.stories.js +7 -12
  24. package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.d.ts +9 -1
  25. package/dist/types/components/AvatarStack/stories/AvatarStackSize.stories.js +51 -37
  26. package/dist/types/components/AvatarStack/{__test__/AvatarStackTest.stories.d.ts → stories/AvatarStackSkeleton.stories.d.ts} +7 -2
  27. package/dist/types/components/AvatarStack/stories/AvatarStackSkeleton.stories.js +47 -0
  28. package/dist/types/components/AvatarStack/stories/__mock__/index.js +11 -5
  29. package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.d.ts +8 -9
  30. package/dist/types/components/Badge/stories/BadgeDotIconCounter.stories.js +33 -72
  31. package/dist/types/components/Divider/__test__/DividerTest.stories.js +3 -3
  32. package/dist/types/components/Dropzone/Dropzone.appearance.d.ts +1 -0
  33. package/dist/types/components/Dropzone/Dropzone.js +1 -1
  34. package/dist/types/components/Dropzone/appearance/dropzoneDefault.d.ts +1 -0
  35. package/dist/types/components/Dropzone/appearance/dropzoneDefault.js +1 -0
  36. package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.d.ts +1 -0
  37. package/dist/types/components/Dropzone/stories/DropzoneDemo.stories.js +7 -0
  38. package/dist/types/components/Dropzone/stories/__mock__/index.d.ts +4 -0
  39. package/dist/types/components/Dropzone/stories/__mock__/index.js +19 -0
  40. package/package.json +2 -2
  41. package/dist/types/components/AvatarStack/AvatarStack.appearance.d.ts +0 -21
  42. package/dist/types/components/AvatarStack/AvatarStack.appearance.js +0 -5
  43. package/dist/types/components/AvatarStack/__test__/AvatarStackTest.stories.js +0 -45
  44. package/dist/types/components/AvatarStack/appearance/avatarStackSize.d.ts +0 -21
  45. package/dist/types/components/AvatarStack/appearance/avatarStackSize.js +0 -21
@@ -80315,7 +80315,8 @@ div.label {
80315
80315
  &_xxl {
80316
80316
  min-width: var(--menu-item-size-xxl-min-width);
80317
80317
  min-height: var(--menu-item-size-xxl-min-height);
80318
- padding: var(--menu-item-size-xxl-padding);
80318
+ padding: var(--menu-item-size-xxl-padding-vertical)
80319
+ var(--menu-item-size-xxl-padding-horizontal);
80319
80320
  gap: var(--menu-item-size-xxl-gap);
80320
80321
  ^^&__icon_before {
80321
80322
  padding: var(--menu-item-size-xxl-icon-padding);
@@ -80324,7 +80325,8 @@ div.label {
80324
80325
  &_xl {
80325
80326
  min-width: var(--menu-item-size-xl-min-width);
80326
80327
  min-height: var(--menu-item-size-xl-min-height);
80327
- padding: var(--menu-item-size-xl-padding);
80328
+ padding: var(--menu-item-size-xl-padding-vertical)
80329
+ var(--menu-item-size-xl-padding-horizontal);
80328
80330
  gap: var(--menu-item-size-xl-gap);
80329
80331
  ^^&__icon_before {
80330
80332
  padding: var(--menu-item-size-xl-icon-padding);
@@ -80333,7 +80335,8 @@ div.label {
80333
80335
  &_l {
80334
80336
  min-width: var(--menu-item-size-l-min-width);
80335
80337
  min-height: var(--menu-item-size-l-min-height);
80336
- padding: var(--menu-item-size-l-padding);
80338
+ padding: var(--menu-item-size-l-padding-vertical)
80339
+ var(--menu-item-size-l-padding-horizontal);
80337
80340
  gap: var(--menu-item-size-l-gap);
80338
80341
  ^^&__icon_before {
80339
80342
  padding: var(--menu-item-size-l-icon-padding);
@@ -80342,7 +80345,8 @@ div.label {
80342
80345
  &_m {
80343
80346
  min-width: var(--menu-item-size-m-min-width);
80344
80347
  min-height: var(--menu-item-size-m-min-height);
80345
- padding: var(--menu-item-size-m-padding);
80348
+ padding: var(--menu-item-size-m-padding-vertical)
80349
+ var(--menu-item-size-m-padding-horizontal);
80346
80350
  gap: var(--menu-item-size-m-gap);
80347
80351
  ^^&__icon_before {
80348
80352
  padding: var(--menu-item-size-m-icon-padding);
@@ -80351,7 +80355,8 @@ div.label {
80351
80355
  &_s {
80352
80356
  min-width: var(--menu-item-size-s-min-width);
80353
80357
  min-height: var(--menu-item-size-s-min-height);
80354
- padding: var(--menu-item-size-s-padding);
80358
+ padding: var(--menu-item-size-s-padding-vertical)
80359
+ var(--menu-item-size-s-padding-horizontal);
80355
80360
  gap: var(--menu-item-size-s-gap);
80356
80361
  ^^&__icon_before {
80357
80362
  padding: var(--menu-item-size-s-icon-padding);
@@ -80360,7 +80365,8 @@ div.label {
80360
80365
  &_xs {
80361
80366
  min-width: var(--menu-item-size-xs-min-width);
80362
80367
  min-height: var(--menu-item-size-xs-min-height);
80363
- padding: var(--menu-item-size-xs-padding);
80368
+ padding: var(--menu-item-size-xs-padding-vertical)
80369
+ var(--menu-item-size-xs-padding-horizontal);
80364
80370
  gap: var(--menu-item-size-xs-gap);
80365
80371
  ^^&__icon_before {
80366
80372
  padding: var(--menu-item-size-xs-icon-padding);
@@ -80369,7 +80375,8 @@ div.label {
80369
80375
  &_xxs {
80370
80376
  min-width: var(--menu-item-size-xxs-min-width);
80371
80377
  min-height: var(--menu-item-size-xxs-min-height);
80372
- padding: var(--menu-item-size-xxs-padding);
80378
+ padding: var(--menu-item-size-xxs-padding-vertical)
80379
+ var(--menu-item-size-xxs-padding-horizontal);
80373
80380
  gap: var(--menu-item-size-xxs-gap);
80374
80381
  ^^&__icon_before {
80375
80382
  padding: var(--menu-item-size-xxs-icon-padding);
@@ -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
+ };