@snack-uikit/status 0.4.0 → 0.5.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 +22 -1
- package/README.md +9 -9
- package/dist/components/Status/Status.d.ts +2 -10
- package/dist/components/Status/Status.js +4 -14
- package/dist/components/Status/constants.d.ts +8 -0
- package/dist/components/Status/constants.js +9 -0
- package/dist/components/Status/types.d.ts +3 -0
- package/dist/components/Status/types.js +1 -0
- package/dist/components/StatusIndicator/StatusIndicator.d.ts +2 -13
- package/dist/components/StatusIndicator/StatusIndicator.js +3 -12
- package/dist/components/StatusIndicator/constants.d.ts +7 -0
- package/dist/components/StatusIndicator/constants.js +7 -0
- package/dist/components/StatusIndicator/types.d.ts +3 -0
- package/dist/components/StatusIndicator/types.js +1 -0
- package/dist/constants.d.ts +11 -11
- package/dist/constants.js +11 -12
- package/dist/types.d.ts +3 -0
- package/dist/types.js +1 -0
- package/package.json +3 -3
- package/src/components/Status/Status.tsx +7 -17
- package/src/components/Status/constants.ts +11 -0
- package/src/components/Status/types.ts +5 -0
- package/src/components/StatusIndicator/StatusIndicator.tsx +6 -14
- package/src/components/StatusIndicator/constants.ts +7 -0
- package/src/components/StatusIndicator/types.ts +5 -0
- package/src/constants.ts +11 -11
- package/src/types.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.5.0 (2023-12-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* **FF-3729:** replace enum with unions ([910db4a](https://github.com/cloud-ru-tech/snack-uikit/commit/910db4aa8231ccbc58e538e5c5c1f461b1dec275))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## 0.4.1 (2023-12-06)
|
|
18
|
+
|
|
19
|
+
### Only dependencies have been changed
|
|
20
|
+
* [@snack-uikit/utils@3.1.0](https://git.sbercloud.tech/sbercloud-ui/tokens-design-system/snack-uikit/-/blob/master/packages/utils/CHANGELOG.md)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
# 0.4.0 (2023-12-06)
|
|
7
27
|
|
|
8
28
|
|
|
@@ -170,7 +190,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
170
190
|
|
|
171
191
|
## 0.1.1 (2023-04-07)
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
### Only dependencies have been changed
|
|
194
|
+
* [@snack-uikit/utils@3.2.0](https://git.sbercloud.tech/sbercloud-ui/tokens-design-system/snack-uikit/-/blob/master/packages/utils/CHANGELOG.md)
|
|
174
195
|
|
|
175
196
|
|
|
176
197
|
|
package/README.md
CHANGED
|
@@ -8,18 +8,18 @@
|
|
|
8
8
|
## Example
|
|
9
9
|
|
|
10
10
|
```typescript jsx
|
|
11
|
-
import {Status, StatusIndicator} from
|
|
11
|
+
import { Status, StatusIndicator } from '@snack-uikit/status';
|
|
12
12
|
|
|
13
13
|
<Status
|
|
14
14
|
label="Text after status"
|
|
15
|
-
appearance=
|
|
16
|
-
size=
|
|
15
|
+
appearance='pink'
|
|
16
|
+
size='xs'
|
|
17
17
|
hasBackground={true}
|
|
18
18
|
/>
|
|
19
19
|
|
|
20
20
|
<StatusIndicator
|
|
21
|
-
appearance=
|
|
22
|
-
size=
|
|
21
|
+
appearance='violet'
|
|
22
|
+
size='l'
|
|
23
23
|
/>
|
|
24
24
|
```
|
|
25
25
|
|
|
@@ -30,16 +30,16 @@ import {Status, StatusIndicator} from "@snack-uikit/status";
|
|
|
30
30
|
| name | type | default value | description |
|
|
31
31
|
|------|------|---------------|-------------|
|
|
32
32
|
| label* | `string` | - | Текст |
|
|
33
|
-
| size | enum Size: `"xs"`, `"s"` |
|
|
34
|
-
| appearance | enum Appearance: `"primary"`, `"neutral"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` |
|
|
33
|
+
| size | enum Size: `"xs"`, `"s"` | xs | Размер |
|
|
34
|
+
| appearance | enum Appearance: `"primary"`, `"neutral"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` | primary | Внешний вид |
|
|
35
35
|
| hasBackground | `boolean` | - | Наличие фона |
|
|
36
36
|
| className | `string` | - | CSS-класс |
|
|
37
37
|
## StatusIndicator
|
|
38
38
|
### Props
|
|
39
39
|
| name | type | default value | description |
|
|
40
40
|
|------|------|---------------|-------------|
|
|
41
|
-
| size | enum Size: `"
|
|
42
|
-
| appearance | enum Appearance: `"primary"`, `"neutral"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` |
|
|
41
|
+
| size | enum Size: `"xs"`, `"s"`, `"xxs"`, `"m"`, `"l"` | m | Размер |
|
|
42
|
+
| appearance | enum Appearance: `"primary"`, `"neutral"`, `"red"`, `"orange"`, `"yellow"`, `"green"`, `"blue"`, `"violet"`, `"pink"` | primary | Внешний вид |
|
|
43
43
|
| className | `string` | - | CSS-класс |
|
|
44
44
|
|
|
45
45
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
|
-
import { Appearance } from '../../
|
|
3
|
-
|
|
4
|
-
Xs = "xs",
|
|
5
|
-
S = "s"
|
|
6
|
-
}
|
|
2
|
+
import { Appearance } from '../../types';
|
|
3
|
+
import { Size } from './types';
|
|
7
4
|
export type StatusProps = WithSupportProps<{
|
|
8
5
|
/** Текст */
|
|
9
6
|
label: string;
|
|
@@ -16,8 +13,3 @@ export type StatusProps = WithSupportProps<{
|
|
|
16
13
|
className?: string;
|
|
17
14
|
}>;
|
|
18
15
|
export declare function Status({ label, size, appearance, hasBackground, className, ...rest }: StatusProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare namespace Status {
|
|
20
|
-
var sizes: typeof Size;
|
|
21
|
-
var appearances: typeof Appearance;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -12,21 +12,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
14
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
15
|
-
import {
|
|
15
|
+
import { APPEARANCE } from '../../constants';
|
|
16
16
|
import { StatusIndicator } from '../StatusIndicator';
|
|
17
|
+
import { SIZE, STATUS_INDICATOR_SIZE_MAP } from './constants';
|
|
17
18
|
import styles from './styles.module.css';
|
|
18
|
-
var Size;
|
|
19
|
-
(function (Size) {
|
|
20
|
-
Size["Xs"] = "xs";
|
|
21
|
-
Size["S"] = "s";
|
|
22
|
-
})(Size || (Size = {}));
|
|
23
|
-
const statusIndicatorSizeMap = {
|
|
24
|
-
[Size.Xs]: StatusIndicator.sizes.Xs,
|
|
25
|
-
[Size.S]: StatusIndicator.sizes.S,
|
|
26
|
-
};
|
|
27
19
|
export function Status(_a) {
|
|
28
|
-
var { label, size =
|
|
29
|
-
return (_jsxs("div", Object.assign({ className: cn(styles.container, className) }, extractSupportProps(rest), { "data-size": size, "data-has-background": hasBackground || undefined }, { children: [_jsx(StatusIndicator, { appearance: appearance, size:
|
|
20
|
+
var { label, size = SIZE.Xs, appearance = APPEARANCE.Primary, hasBackground, className } = _a, rest = __rest(_a, ["label", "size", "appearance", "hasBackground", "className"]);
|
|
21
|
+
return (_jsxs("div", Object.assign({ className: cn(styles.container, className) }, extractSupportProps(rest), { "data-size": size, "data-has-background": hasBackground || undefined }, { children: [_jsx(StatusIndicator, { appearance: appearance, size: STATUS_INDICATOR_SIZE_MAP[size] }), _jsx("span", Object.assign({ className: styles.label }, { children: label }))] })));
|
|
30
22
|
}
|
|
31
|
-
Status.sizes = Size;
|
|
32
|
-
Status.appearances = Appearance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
2
|
-
import { Appearance } from '../../
|
|
3
|
-
|
|
4
|
-
Xxs = "xxs",
|
|
5
|
-
Xs = "xs",
|
|
6
|
-
S = "s",
|
|
7
|
-
M = "m",
|
|
8
|
-
L = "l"
|
|
9
|
-
}
|
|
2
|
+
import { Appearance } from '../../types';
|
|
3
|
+
import { Size } from './types';
|
|
10
4
|
export type StatusIndicatorProps = WithSupportProps<{
|
|
11
5
|
/** Размер */
|
|
12
6
|
size?: Size;
|
|
@@ -15,8 +9,3 @@ export type StatusIndicatorProps = WithSupportProps<{
|
|
|
15
9
|
className?: string;
|
|
16
10
|
}>;
|
|
17
11
|
export declare function StatusIndicator({ size, appearance, className, ...rest }: StatusIndicatorProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export declare namespace StatusIndicator {
|
|
19
|
-
var sizes: typeof Size;
|
|
20
|
-
var appearances: typeof Appearance;
|
|
21
|
-
}
|
|
22
|
-
export {};
|
|
@@ -12,19 +12,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import cn from 'classnames';
|
|
14
14
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
15
|
-
import {
|
|
15
|
+
import { APPEARANCE } from '../../constants';
|
|
16
|
+
import { SIZE } from './constants';
|
|
16
17
|
import styles from './styles.module.css';
|
|
17
|
-
var Size;
|
|
18
|
-
(function (Size) {
|
|
19
|
-
Size["Xxs"] = "xxs";
|
|
20
|
-
Size["Xs"] = "xs";
|
|
21
|
-
Size["S"] = "s";
|
|
22
|
-
Size["M"] = "m";
|
|
23
|
-
Size["L"] = "l";
|
|
24
|
-
})(Size || (Size = {}));
|
|
25
18
|
export function StatusIndicator(_a) {
|
|
26
|
-
var { size =
|
|
19
|
+
var { size = SIZE.M, appearance = APPEARANCE.Primary, className } = _a, rest = __rest(_a, ["size", "appearance", "className"]);
|
|
27
20
|
return (_jsx("div", Object.assign({ className: cn(styles.container, className) }, extractSupportProps(rest), { "data-size": size }, { children: _jsx("div", { className: styles.indicator, "data-appearance": appearance }) })));
|
|
28
21
|
}
|
|
29
|
-
StatusIndicator.sizes = Size;
|
|
30
|
-
StatusIndicator.appearances = Appearance;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/constants.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
Primary
|
|
3
|
-
Neutral
|
|
4
|
-
Red
|
|
5
|
-
Orange
|
|
6
|
-
Yellow
|
|
7
|
-
Green
|
|
8
|
-
Blue
|
|
9
|
-
Violet
|
|
10
|
-
Pink
|
|
11
|
-
}
|
|
1
|
+
export declare const APPEARANCE: {
|
|
2
|
+
readonly Primary: "primary";
|
|
3
|
+
readonly Neutral: "neutral";
|
|
4
|
+
readonly Red: "red";
|
|
5
|
+
readonly Orange: "orange";
|
|
6
|
+
readonly Yellow: "yellow";
|
|
7
|
+
readonly Green: "green";
|
|
8
|
+
readonly Blue: "blue";
|
|
9
|
+
readonly Violet: "violet";
|
|
10
|
+
readonly Pink: "pink";
|
|
11
|
+
};
|
package/dist/constants.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})(Appearance || (Appearance = {}));
|
|
1
|
+
export const APPEARANCE = {
|
|
2
|
+
Primary: 'primary',
|
|
3
|
+
Neutral: 'neutral',
|
|
4
|
+
Red: 'red',
|
|
5
|
+
Orange: 'orange',
|
|
6
|
+
Yellow: 'yellow',
|
|
7
|
+
Green: 'green',
|
|
8
|
+
Blue: 'blue',
|
|
9
|
+
Violet: 'violet',
|
|
10
|
+
Pink: 'pink',
|
|
11
|
+
};
|
package/dist/types.d.ts
ADDED
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Status",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.5.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"license": "Apache-2.0",
|
|
33
33
|
"scripts": {},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@snack-uikit/utils": "3.
|
|
35
|
+
"@snack-uikit/utils": "3.2.0",
|
|
36
36
|
"classnames": "2.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "bd39c5e674f3b91b0e2487782a04b15034cf3d8b"
|
|
39
39
|
}
|
|
@@ -2,19 +2,12 @@ import cn from 'classnames';
|
|
|
2
2
|
|
|
3
3
|
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { APPEARANCE } from '../../constants';
|
|
6
|
+
import { Appearance } from '../../types';
|
|
6
7
|
import { StatusIndicator } from '../StatusIndicator';
|
|
8
|
+
import { SIZE, STATUS_INDICATOR_SIZE_MAP } from './constants';
|
|
7
9
|
import styles from './styles.module.scss';
|
|
8
|
-
|
|
9
|
-
enum Size {
|
|
10
|
-
Xs = 'xs',
|
|
11
|
-
S = 's',
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const statusIndicatorSizeMap = {
|
|
15
|
-
[Size.Xs]: StatusIndicator.sizes.Xs,
|
|
16
|
-
[Size.S]: StatusIndicator.sizes.S,
|
|
17
|
-
};
|
|
10
|
+
import { Size } from './types';
|
|
18
11
|
|
|
19
12
|
export type StatusProps = WithSupportProps<{
|
|
20
13
|
/** Текст */
|
|
@@ -30,8 +23,8 @@ export type StatusProps = WithSupportProps<{
|
|
|
30
23
|
|
|
31
24
|
export function Status({
|
|
32
25
|
label,
|
|
33
|
-
size =
|
|
34
|
-
appearance =
|
|
26
|
+
size = SIZE.Xs,
|
|
27
|
+
appearance = APPEARANCE.Primary,
|
|
35
28
|
hasBackground,
|
|
36
29
|
className,
|
|
37
30
|
...rest
|
|
@@ -43,11 +36,8 @@ export function Status({
|
|
|
43
36
|
data-size={size}
|
|
44
37
|
data-has-background={hasBackground || undefined}
|
|
45
38
|
>
|
|
46
|
-
<StatusIndicator appearance={appearance} size={
|
|
39
|
+
<StatusIndicator appearance={appearance} size={STATUS_INDICATOR_SIZE_MAP[size]} />
|
|
47
40
|
<span className={styles.label}>{label}</span>
|
|
48
41
|
</div>
|
|
49
42
|
);
|
|
50
43
|
}
|
|
51
|
-
|
|
52
|
-
Status.sizes = Size;
|
|
53
|
-
Status.appearances = Appearance;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SIZE as StatusIndicatorSize } from '../StatusIndicator/constants';
|
|
2
|
+
|
|
3
|
+
export const SIZE = {
|
|
4
|
+
Xs: 'xs',
|
|
5
|
+
S: 's',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export const STATUS_INDICATOR_SIZE_MAP = {
|
|
9
|
+
[SIZE.Xs]: StatusIndicatorSize.Xs,
|
|
10
|
+
[SIZE.S]: StatusIndicatorSize.S,
|
|
11
|
+
};
|
|
@@ -2,16 +2,11 @@ import cn from 'classnames';
|
|
|
2
2
|
|
|
3
3
|
import { extractSupportProps, WithSupportProps } from '@snack-uikit/utils';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { APPEARANCE } from '../../constants';
|
|
6
|
+
import { Appearance } from '../../types';
|
|
7
|
+
import { SIZE } from './constants';
|
|
6
8
|
import styles from './styles.module.scss';
|
|
7
|
-
|
|
8
|
-
enum Size {
|
|
9
|
-
Xxs = 'xxs',
|
|
10
|
-
Xs = 'xs',
|
|
11
|
-
S = 's',
|
|
12
|
-
M = 'm',
|
|
13
|
-
L = 'l',
|
|
14
|
-
}
|
|
9
|
+
import { Size } from './types';
|
|
15
10
|
|
|
16
11
|
export type StatusIndicatorProps = WithSupportProps<{
|
|
17
12
|
/** Размер */
|
|
@@ -22,8 +17,8 @@ export type StatusIndicatorProps = WithSupportProps<{
|
|
|
22
17
|
}>;
|
|
23
18
|
|
|
24
19
|
export function StatusIndicator({
|
|
25
|
-
size =
|
|
26
|
-
appearance =
|
|
20
|
+
size = SIZE.M,
|
|
21
|
+
appearance = APPEARANCE.Primary,
|
|
27
22
|
className,
|
|
28
23
|
...rest
|
|
29
24
|
}: StatusIndicatorProps) {
|
|
@@ -33,6 +28,3 @@ export function StatusIndicator({
|
|
|
33
28
|
</div>
|
|
34
29
|
);
|
|
35
30
|
}
|
|
36
|
-
|
|
37
|
-
StatusIndicator.sizes = Size;
|
|
38
|
-
StatusIndicator.appearances = Appearance;
|
package/src/constants.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
Primary
|
|
3
|
-
Neutral
|
|
4
|
-
Red
|
|
5
|
-
Orange
|
|
6
|
-
Yellow
|
|
7
|
-
Green
|
|
8
|
-
Blue
|
|
9
|
-
Violet
|
|
10
|
-
Pink
|
|
11
|
-
}
|
|
1
|
+
export const APPEARANCE = {
|
|
2
|
+
Primary: 'primary',
|
|
3
|
+
Neutral: 'neutral',
|
|
4
|
+
Red: 'red',
|
|
5
|
+
Orange: 'orange',
|
|
6
|
+
Yellow: 'yellow',
|
|
7
|
+
Green: 'green',
|
|
8
|
+
Blue: 'blue',
|
|
9
|
+
Violet: 'violet',
|
|
10
|
+
Pink: 'pink',
|
|
11
|
+
} as const;
|