@snack-uikit/card 0.6.4-preview-00fa1de0.0 → 0.7.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # 0.7.0 (2023-12-28)
7
+
8
+
9
+ ### Features
10
+
11
+ * **FF-3960:** add S size ([1ef77b1](https://github.com/cloud-ru-tech/snack-uikit/commit/1ef77b133d182e2601372ad9e6304080d95516ac))
12
+
13
+
14
+
15
+
16
+
17
+ ## 0.6.4 (2023-12-25)
18
+
19
+ ### Only dependencies have been changed
20
+ * [@snack-uikit/droplist@0.12.3](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/droplist/CHANGELOG.md)
21
+ * [@snack-uikit/truncate-string@0.4.3](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/truncate-string/CHANGELOG.md)
22
+
23
+
24
+
25
+
26
+
6
27
  ## 0.6.3 (2023-12-18)
7
28
 
8
29
  ### Only dependencies have been changed
@@ -27,7 +48,13 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
27
48
 
28
49
  ## 0.6.1 (2023-12-14)
29
50
 
30
- **Note:** Version bump only for package @snack-uikit/card
51
+ ### Only dependencies have been changed
52
+ * [@snack-uikit/button@0.15.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/button/CHANGELOG.md)
53
+ * [@snack-uikit/droplist@0.12.4](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/droplist/CHANGELOG.md)
54
+ * [@snack-uikit/icon-predefined@0.4.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/icon-predefined/CHANGELOG.md)
55
+ * [@snack-uikit/promo-tag@0.4.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/promo-tag/CHANGELOG.md)
56
+ * [@snack-uikit/truncate-string@0.4.4](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/truncate-string/CHANGELOG.md)
57
+ * [@snack-uikit/typography@0.6.1](https://github.com/cloud-ru-tech/snack-uikit/blob/master/packages/typography/CHANGELOG.md)
31
58
 
32
59
 
33
60
 
package/README.md CHANGED
@@ -33,7 +33,7 @@ import { Card, SearchPrivate } from "@snack-uikit/card";
33
33
  | outline | `boolean` | - | Управление состоянием наличия обводки |
34
34
  | multipleSelection | `boolean` | - | Отображение галочки для режима массового выделения карточек |
35
35
  | onClick | `() => void` | - | Колбек на клик по карточке |
36
- | size | enum Size: `"m"`, `"l"` | - | Размер |
36
+ | size | enum Size: `"s"`, `"m"`, `"l"` | - | Размер |
37
37
  | promoBadge | `string` | - | Текст для PromoBadge |
38
38
  | children | `ReactNode` | - | Вложенный контент |
39
39
  | header | `ReactElement<HeaderProps, string \| JSXElementConstructor<any>>` | - | Вложенный Header |
@@ -31,5 +31,5 @@ export function Card(_a) {
31
31
  }, [onClick]);
32
32
  return (_jsx(CardContext.Provider, { value: { size, disabled }, children: _jsxs("div", Object.assign({ ref: localRef, className: cn(styles.card, className) }, extractSupportProps(rest), { onClick: onClick, "data-disabled": disabled || undefined, "data-checked": checked || undefined, "data-outline": outline || undefined, "data-pointer": onClick ? true : undefined,
33
33
  // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
34
- tabIndex: 0, onKeyDown: onKeyDown, children: [image, promoBadge && _jsx(PromoBadge, { text: promoBadge }), _jsxs("div", { className: styles.composition, tabIndex: -1, children: [!disabled && functionBadge && (_jsx(FunctionBadgeWrapper, { className: styles.functionBadgeWrapper, children: functionBadge })), _jsxs("div", { className: styles.contentWrapper, children: [_jsxs("div", { className: styles.content, "data-size": size, children: [header || null, _jsx(Typography, { family: 'sans', size: size, purpose: 'body', className: styles.body, children: children })] }), footer && _jsx("div", { className: styles.footer, children: footer })] })] }), !disabled && checked && multipleSelection && _jsx(Check, { className: styles.check })] })) }));
34
+ tabIndex: 0, onKeyDown: onKeyDown, children: [image, promoBadge && _jsx(PromoBadge, { text: promoBadge }), _jsxs("div", { className: styles.composition, tabIndex: -1, children: [!disabled && functionBadge && (_jsx(FunctionBadgeWrapper, { className: styles.functionBadgeWrapper, children: functionBadge })), _jsx("div", { className: styles.contentWrapper, children: _jsxs("div", { className: styles.content, "data-size": size, children: [header || null, children && (_jsx(Typography, { family: 'sans', size: size, purpose: 'body', className: styles.body, children: children })), footer && _jsx("div", { className: styles.footer, children: footer })] }) })] }), !disabled && checked && multipleSelection && _jsx(Check, { className: styles.check })] })) }));
35
35
  }
@@ -137,17 +137,21 @@
137
137
  box-sizing:border-box;
138
138
  max-width:100%;
139
139
  }
140
+ .content[data-size=s]{
141
+ padding:var(--space-card-padding-container-s, 8px);
142
+ gap:var(--space-card-gap-s, 4px);
143
+ }
140
144
  .content[data-size=m]{
141
- padding:var(--space-card-padding-container, 16px);
145
+ padding:var(--space-card-padding-container-m, 16px);
142
146
  gap:var(--space-card-gap-m, 8px);
143
147
  }
144
148
  .content[data-size=l]{
145
- padding:var(--space-card-padding-container, 16px);
149
+ padding:var(--space-card-padding-container-l, 24px);
146
150
  gap:var(--space-card-gap-l, 16px);
147
151
  }
148
152
 
149
153
  .footer{
150
- padding:var(--space-card-padding-container, 16px);
151
154
  position:relative;
152
155
  box-sizing:border-box;
156
+ width:100%;
153
157
  }
@@ -1,5 +1,6 @@
1
1
  import { SIZE } from '../../../../constants';
2
2
  export const TYPOGRAPHY_SIZE_MAP = {
3
+ [SIZE.S]: 'm',
3
4
  [SIZE.M]: 'm',
4
5
  [SIZE.L]: 'l',
5
6
  };
@@ -1,9 +1,11 @@
1
1
  import { SIZE } from '../../constants';
2
2
  export const TITLE_SIZE_MAP = {
3
+ [SIZE.S]: 's',
3
4
  [SIZE.M]: 's',
4
5
  [SIZE.L]: 'l',
5
6
  };
6
7
  export const DESCRIPTION_SIZE_MAP = {
8
+ [SIZE.S]: 'm',
7
9
  [SIZE.M]: 'm',
8
10
  [SIZE.L]: 'l',
9
11
  };
@@ -4,6 +4,9 @@
4
4
  box-sizing:border-box;
5
5
  width:100%;
6
6
  }
7
+ .titleLayout[data-size=s]{
8
+ gap:var(--space-card-gap-s, 4px);
9
+ }
7
10
  .titleLayout[data-size=m]{
8
11
  gap:var(--space-card-gap-m, 8px);
9
12
  }
@@ -1,4 +1,5 @@
1
1
  export declare const SIZE: {
2
+ readonly S: "s";
2
3
  readonly M: "m";
3
4
  readonly L: "l";
4
5
  };
package/dist/constants.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export const SIZE = {
2
+ S: 's',
2
3
  M: 'm',
3
4
  L: 'l',
4
5
  };
@@ -7,6 +7,12 @@
7
7
  border-color:var(--sys-neutral-decor-disabled, #e7e7e7);
8
8
  border-style:solid;
9
9
  }
10
+ .img[data-size=s]{
11
+ width:var(--size-card-picture-s, 32px);
12
+ height:var(--size-card-picture-s, 32px);
13
+ border-width:var(--border-width-card-picture, 1px);
14
+ border-radius:var(--radius-card-picture, 8px);
15
+ }
10
16
  .img[data-size=m]{
11
17
  width:var(--size-card-picture-m, 40px);
12
18
  height:var(--size-card-picture-m, 40px);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public"
5
5
  },
6
6
  "title": "Card",
7
- "version": "0.6.4-preview-00fa1de0.0",
7
+ "version": "0.7.0",
8
8
  "sideEffects": [
9
9
  "*.css",
10
10
  "*.woff",
@@ -32,15 +32,15 @@
32
32
  "license": "Apache-2.0",
33
33
  "scripts": {},
34
34
  "dependencies": {
35
- "@snack-uikit/button": "0.15.0",
36
- "@snack-uikit/droplist": "0.12.3-preview-00fa1de0.0",
37
- "@snack-uikit/icon-predefined": "0.4.0",
35
+ "@snack-uikit/button": "0.15.1",
36
+ "@snack-uikit/droplist": "0.12.4",
37
+ "@snack-uikit/icon-predefined": "0.4.1",
38
38
  "@snack-uikit/icons": "0.19.2",
39
- "@snack-uikit/promo-tag": "0.4.0",
40
- "@snack-uikit/truncate-string": "0.4.3-preview-00fa1de0.0",
41
- "@snack-uikit/typography": "0.6.0",
39
+ "@snack-uikit/promo-tag": "0.4.1",
40
+ "@snack-uikit/truncate-string": "0.4.4",
41
+ "@snack-uikit/typography": "0.6.1",
42
42
  "@snack-uikit/utils": "3.2.0",
43
43
  "classnames": "2.3.2"
44
44
  },
45
- "gitHead": "197debfa780364e989e8de7c27ebe15474429c57"
45
+ "gitHead": "57c597a3eebaf6528c0c61b6b27dd244753de1cf"
46
46
  }
@@ -99,12 +99,14 @@ export function Card({
99
99
  <div className={styles.content} data-size={size}>
100
100
  {header || null}
101
101
 
102
- <Typography family='sans' size={size} purpose='body' className={styles.body}>
103
- {children}
104
- </Typography>
105
- </div>
102
+ {children && (
103
+ <Typography family='sans' size={size} purpose='body' className={styles.body}>
104
+ {children}
105
+ </Typography>
106
+ )}
106
107
 
107
- {footer && <div className={styles.footer}>{footer}</div>}
108
+ {footer && <div className={styles.footer}>{footer}</div>}
109
+ </div>
108
110
  </div>
109
111
  </div>
110
112
 
@@ -1,7 +1,7 @@
1
1
  @import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-card';
2
2
  @import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-element';
3
3
 
4
- $sizes: 'm', 'l';
4
+ $sizes: 's', 'm', 'l';
5
5
 
6
6
  .functionBadgeWrapper {
7
7
  position: absolute;
@@ -17,12 +17,12 @@ $sizes: 'm', 'l';
17
17
  .composition {
18
18
  @include composite-var($card-composition-container);
19
19
 
20
- box-sizing: border-box;
20
+ box-sizing: border-box;
21
21
  }
22
22
 
23
23
  .card {
24
24
  @include composite-var($card-container);
25
-
25
+
26
26
  position: relative;
27
27
 
28
28
  overflow: hidden;
@@ -32,7 +32,7 @@ $sizes: 'm', 'l';
32
32
  padding: 0;
33
33
 
34
34
  text-align: left;
35
-
35
+
36
36
  background-color: $sys-neutral-background1-level;
37
37
  border: 0;
38
38
  outline-color: transparent;
@@ -76,8 +76,6 @@ $sizes: 'm', 'l';
76
76
  }
77
77
  }
78
78
 
79
-
80
-
81
79
  &[data-pointer] {
82
80
  * {
83
81
  cursor: pointer;
@@ -153,14 +151,13 @@ $sizes: 'm', 'l';
153
151
  background-color: $sys-neutral-background;
154
152
  outline-color: $sys-neutral-decor-default;
155
153
  outline-width: $border-width-card-container;
156
-
154
+
157
155
  * {
158
156
  cursor: not-allowed;
159
157
  }
160
158
  }
161
159
  }
162
160
 
163
-
164
161
  .body {
165
162
  display: block;
166
163
  color: $sys-neutral-text-support;
@@ -186,9 +183,7 @@ $sizes: 'm', 'l';
186
183
  }
187
184
 
188
185
  .footer {
189
- @include composite-var($card-footer);
190
-
191
186
  position: relative;
192
187
  box-sizing: border-box;
188
+ width: 100%;
193
189
  }
194
-
@@ -3,6 +3,7 @@ import { TypographyProps } from '@snack-uikit/typography';
3
3
  import { SIZE } from '../../../../constants';
4
4
 
5
5
  export const TYPOGRAPHY_SIZE_MAP: Record<string, TypographyProps['size']> = {
6
+ [SIZE.S]: 'm',
6
7
  [SIZE.M]: 'm',
7
8
  [SIZE.L]: 'l',
8
9
  };
@@ -4,11 +4,13 @@ import { SIZE } from '../../constants';
4
4
  import { Size } from '../../types';
5
5
 
6
6
  export const TITLE_SIZE_MAP: Record<Size, TypographyProps['size']> = {
7
+ [SIZE.S]: 's',
7
8
  [SIZE.M]: 's',
8
9
  [SIZE.L]: 'l',
9
10
  };
10
11
 
11
12
  export const DESCRIPTION_SIZE_MAP: Record<Size, TypographyProps['size']> = {
13
+ [SIZE.S]: 'm',
12
14
  [SIZE.M]: 'm',
13
15
  [SIZE.L]: 'l',
14
16
  };
@@ -1,6 +1,6 @@
1
1
  @import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-card';
2
2
 
3
- $sizes: 'm', 'l';
3
+ $sizes: 's', 'm', 'l';
4
4
 
5
5
  .titleLayout {
6
6
  display: flex;
package/src/constants.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export const SIZE = {
2
+ S: 's',
2
3
  M: 'm',
3
4
  L: 'l',
4
5
  } as const;
@@ -1,6 +1,6 @@
1
1
  @import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-card';
2
2
 
3
- $sizes: 'm', 'l';
3
+ $sizes: 's', 'm', 'l';
4
4
 
5
5
  .img {
6
6
  overflow: hidden;