@cloud-ru/ds-uikit-product-widget 1.0.18 → 1.0.19-preview-a2208aeb.0

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 (29) hide show
  1. package/dist/cjs/components/Widget/Widget.js +4 -2
  2. package/dist/cjs/components/Widget/styles.module.css +84 -64
  3. package/dist/cjs/helperComponents/Actions/Actions.js +1 -1
  4. package/dist/cjs/helperComponents/Actions/styles.module.css +10 -29
  5. package/dist/cjs/helperComponents/Content/Content.js +1 -1
  6. package/dist/cjs/helperComponents/Content/styles.module.css +4 -0
  7. package/dist/cjs/helperComponents/ControlBlock/ControlBlock.js +3 -2
  8. package/dist/cjs/helperComponents/ControlBlock/styles.module.css +4 -0
  9. package/dist/cjs/style.css +99 -90
  10. package/dist/esm/components/Widget/Widget.js +4 -2
  11. package/dist/esm/components/Widget/styles.module.css +84 -64
  12. package/dist/esm/helperComponents/Actions/Actions.js +2 -2
  13. package/dist/esm/helperComponents/Actions/styles.module.css +10 -29
  14. package/dist/esm/helperComponents/Content/Content.js +1 -1
  15. package/dist/esm/helperComponents/Content/styles.module.css +4 -0
  16. package/dist/esm/helperComponents/ControlBlock/ControlBlock.js +3 -2
  17. package/dist/esm/helperComponents/ControlBlock/styles.module.css +4 -0
  18. package/dist/esm/style.css +99 -90
  19. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  20. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  21. package/package.json +13 -13
  22. package/src/components/Widget/Widget.tsx +9 -8
  23. package/src/components/Widget/styles.module.scss +28 -7
  24. package/src/helperComponents/Actions/Actions.tsx +2 -13
  25. package/src/helperComponents/Actions/styles.module.scss +13 -34
  26. package/src/helperComponents/Content/Content.tsx +1 -1
  27. package/src/helperComponents/Content/styles.module.scss +5 -0
  28. package/src/helperComponents/ControlBlock/ControlBlock.tsx +3 -2
  29. package/src/helperComponents/ControlBlock/styles.module.scss +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud-ru/ds-uikit-product-widget",
3
- "version": "1.0.18",
3
+ "version": "1.0.19-preview-a2208aeb.0",
4
4
  "description": "Карточка продуктового виджета с кликабельным заголовком, SegmentControl, действиями и состояниями loading/error.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -40,18 +40,18 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "classnames": "^2.5.1",
43
- "@cloud-ru/ds-button": "^1.0.2",
44
- "@cloud-ru/ds-adaptive": "^1.0.1",
45
- "@cloud-ru/ds-icons": "^1.2.0",
46
- "@cloud-ru/ds-info-block": "^1.0.1",
47
- "@cloud-ru/ds-list": "^2.2.0",
48
- "@cloud-ru/ds-locale": "^1.0.0",
49
- "@cloud-ru/ds-materials": "^1.0.1",
50
- "@cloud-ru/ds-segment-control": "^1.0.6",
51
- "@cloud-ru/ds-skeleton": "^1.0.1",
52
- "@cloud-ru/ds-uikit-product-title-clickable": "^1.0.9",
53
- "@cloud-ru/ds-utils": "^1.1.0",
54
- "@cloud-ru/ds-tooltip": "^1.0.5"
43
+ "@cloud-ru/ds-button": "1.0.3-preview-a2208aeb.0",
44
+ "@cloud-ru/ds-adaptive": "1.0.1",
45
+ "@cloud-ru/ds-icons": "1.2.1-preview-a2208aeb.0",
46
+ "@cloud-ru/ds-info-block": "1.0.2-preview-a2208aeb.0",
47
+ "@cloud-ru/ds-list": "2.2.1-preview-a2208aeb.0",
48
+ "@cloud-ru/ds-locale": "1.0.0",
49
+ "@cloud-ru/ds-materials": "1.0.2-preview-a2208aeb.0",
50
+ "@cloud-ru/ds-segment-control": "1.0.7-preview-a2208aeb.0",
51
+ "@cloud-ru/ds-skeleton": "1.0.1",
52
+ "@cloud-ru/ds-uikit-product-title-clickable": "1.0.10-preview-a2208aeb.0",
53
+ "@cloud-ru/ds-utils": "1.1.0",
54
+ "@cloud-ru/ds-tooltip": "1.0.6-preview-a2208aeb.0"
55
55
  },
56
56
  "publishConfig": {
57
57
  "access": "public"
@@ -1,4 +1,5 @@
1
1
  import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
2
+ import { BACKGROUND_PREDEFINED_FILL, backgroundPredefinedFillToAcrylic } from '@cloud-ru/ds-materials';
2
3
  import { Skeleton } from '@cloud-ru/ds-skeleton';
3
4
  import { TitleClickable } from '@cloud-ru/ds-uikit-product-title-clickable';
4
5
  import { extractSupportProps, useDynamicList } from '@cloud-ru/ds-utils';
@@ -10,6 +11,8 @@ import { Actions, ActionView, Content, ControlBlock, isVisibleAction } from '../
10
11
  import { WidgetProps } from '../../types';
11
12
  import styles from './styles.module.scss';
12
13
 
14
+ const ACRYLIC = backgroundPredefinedFillToAcrylic(BACKGROUND_PREDEFINED_FILL.NeutralBackground1Level);
15
+
13
16
  function WidgetComponent({
14
17
  header,
15
18
  children,
@@ -48,18 +51,16 @@ function WidgetComponent({
48
51
  data-state={state}
49
52
  ref={containerRef}
50
53
  data-wide={wide || undefined}
54
+ data-acrylic-appearance={ACRYLIC.appearance}
55
+ data-acrylic-level={ACRYLIC.level}
51
56
  {...extractSupportProps(rest)}
52
57
  >
53
- <div
54
- className={styles.widgetHeader}
55
- data-mobile={!wide || undefined}
56
- data-loading={state === WIDGET_STATE.Loading || undefined}
57
- data-test-id={TEST_IDS.header}
58
- >
58
+ <span className={styles.acrylic} aria-hidden />
59
+ <div className={styles.widgetHeader} data-mobile={!wide || undefined} data-test-id={TEST_IDS.header}>
59
60
  <div className={styles.headerMain}>
60
61
  {state === WIDGET_STATE.Loading ? (
61
62
  <div className={styles.skeletonHeader}>
62
- <Skeleton loading width={wide ? '96px' : '100%'} height='32px' borderRadius='4px' />
63
+ <Skeleton loading className={styles.skeletonTitle} />
63
64
  </div>
64
65
  ) : (
65
66
  <TitleClickable {...header} className={cn(styles.titleClickable, header.className)} />
@@ -93,7 +94,7 @@ function WidgetComponent({
93
94
  state !== WIDGET_STATE.Error &&
94
95
  visibleItemsWithoutKebab.map((action, index) =>
95
96
  state === WIDGET_STATE.Loading ? (
96
- <Skeleton key={index} loading height='32px' borderRadius='8px' />
97
+ <Skeleton key={index} loading className={styles.skeletonButton} />
97
98
  ) : (
98
99
  <ActionView
99
100
  {...action}
@@ -2,7 +2,18 @@
2
2
  @use '@cloud-ru/ds-figma-variables/build/scss/components/card.module' as card;
3
3
  @use '@cloud-ru/ds-materials' as m;
4
4
 
5
+ .acrylic {
6
+ pointer-events: none;
7
+
8
+ position: absolute;
9
+ z-index: -1;
10
+ inset: 0;
11
+
12
+ border-radius: inherit;
13
+ }
14
+
5
15
  .widget {
16
+ isolation: isolate;
6
17
  position: relative;
7
18
 
8
19
  display: flex;
@@ -12,13 +23,11 @@
12
23
  box-sizing: border-box;
13
24
  width: 100%;
14
25
  min-width: 0;
15
- padding: base.$sn-primitive-dimension-16;
26
+ padding: base.$sn-density-spacing-interval-m;
16
27
  border-radius: card.$sn-card-anatomy-radius-l-container-borderRadius;
17
28
 
18
29
  color: base.$sn-theme-color-available-version-textMain;
19
30
 
20
- background: base.$sn-theme-color-neutral-background1Level;
21
-
22
31
  @include m.with-material('acrylic', #{acrylic});
23
32
 
24
33
  &[data-state='loading'][data-wide] {
@@ -36,11 +45,8 @@
36
45
 
37
46
  &[data-mobile] {
38
47
  flex-direction: column;
39
- align-items: flex-start;
40
- }
41
-
42
- &[data-loading] {
43
48
  gap: base.$sn-primitive-dimension-12;
49
+ align-items: flex-start;
44
50
  }
45
51
  }
46
52
 
@@ -76,6 +82,21 @@
76
82
  flex: 1;
77
83
  width: 100%;
78
84
  min-width: 0;
85
+
86
+ .skeletonTitle {
87
+ width: 100%;
88
+ height: base.$sn-primitive-dimension-24;
89
+ border-radius: base.$sn-density-radius-2xs;
90
+ }
91
+ }
92
+
93
+ .widget[data-wide] .skeletonTitle {
94
+ width: base.$sn-primitive-dimension-96;
95
+ }
96
+
97
+ .widget .skeletonButton {
98
+ height: base.$sn-primitive-dimension-32;
99
+ border-radius: base.$sn-density-radius-2xs;
79
100
  }
80
101
 
81
102
  .button {
@@ -21,19 +21,8 @@ function ActionsSkeleton({ wide }: Pick<ActionsProps, 'wide'>) {
21
21
  return (
22
22
  <div className={styles.actionsWrapper} data-wide={wide || undefined}>
23
23
  <div className={styles.skeletonActions}>
24
- {wide ? (
25
- <>
26
- <Skeleton loading width='96px' height='32px' borderRadius='8px' />
27
- <Skeleton loading width='32px' height='32px' borderRadius='8px' />
28
- </>
29
- ) : (
30
- <>
31
- <div className={styles.skeletonActionFull}>
32
- <Skeleton loading width='100%' height='32px' borderRadius='8px' />
33
- </div>
34
- <Skeleton loading width='32px' height='32px' borderRadius='8px' />
35
- </>
36
- )}
24
+ {wide && <Skeleton loading className={styles.skeletonAction} />}
25
+ <Skeleton loading className={styles.skeletonIconAction} />
37
26
  </div>
38
27
  </div>
39
28
  );
@@ -1,35 +1,5 @@
1
1
  @use '@cloud-ru/ds-figma-variables/build/scss/styles/styles.module' as base;
2
2
 
3
- .mobileActionsWrapper {
4
- scrollbar-width: none;
5
-
6
- overflow-y: auto;
7
- display: flex;
8
- flex-shrink: 0;
9
- gap: base.$sn-primitive-dimension-8;
10
- justify-content: stretch;
11
-
12
- width: 100%;
13
-
14
- &::-webkit-scrollbar {
15
- display: none;
16
- }
17
- }
18
-
19
- .button {
20
- white-space: nowrap;
21
-
22
- &[data-full-width]:not([data-variant='icon-only']) {
23
- flex-shrink: 0;
24
- width: auto;
25
- }
26
-
27
- &[data-variant='icon-only'] {
28
- flex-grow: 0;
29
- flex-shrink: 0;
30
- }
31
- }
32
-
33
3
  .actionsWrapper {
34
4
  display: flex;
35
5
  flex-shrink: 0;
@@ -46,9 +16,18 @@
46
16
  gap: base.$sn-primitive-dimension-8;
47
17
  align-items: center;
48
18
  width: 100%;
49
- }
50
19
 
51
- .skeletonActionFull {
52
- flex: 1;
53
- min-width: 0;
20
+ .skeletonAction,
21
+ .skeletonIconAction {
22
+ height: base.$sn-primitive-dimension-32;
23
+ border-radius: base.$sn-density-radius-2xs;
24
+ }
25
+
26
+ .skeletonAction {
27
+ width: base.$sn-primitive-dimension-96;
28
+ }
29
+
30
+ .skeletonIconAction {
31
+ width: base.$sn-primitive-dimension-32;
32
+ }
54
33
  }
@@ -28,7 +28,7 @@ function ContentComponent({ children, state, wide, loadingState, errorState }: C
28
28
  if (loadingState?.showSkeleton) {
29
29
  return (
30
30
  <div className={styles.skeletonContent}>
31
- <Skeleton loading width='100%' height='80px' borderRadius='8px' />
31
+ <Skeleton loading className={styles.skeleton} />
32
32
  </div>
33
33
  );
34
34
  }
@@ -4,6 +4,11 @@
4
4
  display: flex;
5
5
  flex-direction: column;
6
6
  gap: base.$sn-primitive-dimension-4;
7
+
8
+ .skeleton {
9
+ height: base.$sn-primitive-dimension-80;
10
+ border-radius: base.$sn-density-radius-2xs;
11
+ }
7
12
  }
8
13
 
9
14
  .errorWrapper {
@@ -16,7 +16,8 @@ type ControlBlockProps = {
16
16
  };
17
17
 
18
18
  function ControlBlockComponent({ actions, actionsChildren, segmentControl, wide, state }: ControlBlockProps) {
19
- const shouldShowControl = segmentControl || state === 'loading';
19
+ // В wide-загрузке у макета нет скелетона контрола — только кнопки справа.
20
+ const shouldShowControl = state === 'loading' ? !wide : Boolean(segmentControl);
20
21
 
21
22
  if (!shouldShowControl && !wide) {
22
23
  return null;
@@ -24,7 +25,7 @@ function ControlBlockComponent({ actions, actionsChildren, segmentControl, wide,
24
25
 
25
26
  const content =
26
27
  state === 'loading' ? (
27
- <Skeleton loading width='100%' height='32px' borderRadius='8px' />
28
+ <Skeleton loading className={styles.skeletonControl} />
28
29
  ) : (
29
30
  segmentControl && <SegmentControl {...segmentControl} />
30
31
  );
@@ -6,6 +6,11 @@
6
6
  gap: base.$sn-primitive-dimension-8;
7
7
  align-items: center;
8
8
 
9
+ .skeletonControl {
10
+ height: base.$sn-primitive-dimension-32;
11
+ border-radius: base.$sn-density-radius-2xs;
12
+ }
13
+
9
14
  &[data-mobile] {
10
15
  width: 100%;
11
16