@cloud-ru/ds-card 1.0.36 → 1.0.38-preview-2f5fa273.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.
@@ -1,3 +1,4 @@
1
+ import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
1
2
  import { ACRYLIC_LEVEL, BACKGROUND_PREDEFINED_FILL, backgroundPredefinedFillToAcrylic } from '@cloud-ru/ds-materials';
2
3
  import { Checkbox, SIZE as CHECKBOX_SIZE } from '@cloud-ru/ds-toggles';
3
4
  import { extractSupportProps, withInnerRefSupport } from '@cloud-ru/ds-utils';
@@ -25,6 +26,7 @@ export function Card<T extends ElementType = 'div'>({
25
26
  innerRef,
26
27
  ...rest
27
28
  }: CardProps<T>): ReactElement | null {
29
+ const { layoutType } = useAdaptiveLayout();
28
30
  const Component: ElementType = as ?? 'div';
29
31
  const supportProps = extractSupportProps(rest);
30
32
  const { appearance, level } = backgroundPredefinedFillToAcrylic(backgroundPredefined);
@@ -87,7 +89,7 @@ export function Card<T extends ElementType = 'div'>({
87
89
  цвет переключается по data-view/data-checked родителя (см. styles.module.scss). */}
88
90
  {(view === VIEW.Outline || checked) && <span className={styles.outlineBorder} aria-hidden />}
89
91
  {checked && multiSelect && (
90
- <span className={styles.checkWrapper} aria-hidden>
92
+ <span className={styles.checkWrapper} data-mobile={isMobileLayout(layoutType) || undefined} aria-hidden>
91
93
  <Checkbox checked size={CHECKBOX_SIZE.XS} tabIndex={-1} data-test-id={TEST_IDS.checkBadge} />
92
94
  </span>
93
95
  )}
@@ -61,6 +61,10 @@ $radius-to-badge-padding-top: (
61
61
  display: flex;
62
62
  align-items: center;
63
63
  justify-content: center;
64
+
65
+ &[data-mobile] {
66
+ inset: auto 0 0 auto;
67
+ }
64
68
  }
65
69
 
66
70
  .card {
@@ -160,10 +164,15 @@ $radius-to-badge-padding-top: (
160
164
  &[data-radius='#{$r}'] {
161
165
  border-radius: base.simple-var($radius-to-border-radius, $r);
162
166
 
163
- .checkWrapper {
167
+ .checkWrapper:not([data-mobile]) {
164
168
  padding-top: base.simple-var($radius-to-badge-padding-top, $r);
165
169
  padding-left: base.simple-var($radius-to-badge-padding-left, $r);
166
170
  }
171
+
172
+ .checkWrapper[data-mobile] {
173
+ padding-right: base.simple-var($radius-to-badge-padding-left, $r);
174
+ padding-bottom: base.simple-var($radius-to-badge-padding-top, $r);
175
+ }
167
176
  }
168
177
  }
169
178