@cloud-ru/uikit-product-quota 0.6.4
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 +1110 -0
- package/LICENSE +201 -0
- package/README.md +8 -0
- package/package.json +52 -0
- package/src/components/QuotaButtonDropdown/QuotaDropdown.tsx +72 -0
- package/src/components/QuotaButtonDropdown/components/NoData.tsx +20 -0
- package/src/components/QuotaButtonDropdown/components/QuotaDropdownContent.tsx +16 -0
- package/src/components/QuotaButtonDropdown/components/QuotaDropdownLayout.tsx +28 -0
- package/src/components/QuotaButtonDropdown/components/index.ts +1 -0
- package/src/components/QuotaButtonDropdown/index.ts +2 -0
- package/src/components/QuotaButtonDropdown/styles.module.scss +106 -0
- package/src/components/QuotaCard/QuotaCard.tsx +102 -0
- package/src/components/QuotaCard/components/DataRow.tsx +31 -0
- package/src/components/QuotaCard/components/DataSkeleton.tsx +12 -0
- package/src/components/QuotaCard/components/NoData.tsx +20 -0
- package/src/components/QuotaCard/components/QuotaCardLayout.tsx +29 -0
- package/src/components/QuotaCard/components/index.ts +3 -0
- package/src/components/QuotaCard/index.ts +1 -0
- package/src/components/QuotaCard/styles.module.scss +109 -0
- package/src/components/index.ts +2 -0
- package/src/index.ts +2 -0
- package/src/types.ts +1 -0
- package/src/utils.ts +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import { extractSupportProps, WithSupportProps } from '@cloud-ru/uikit-product-utils';
|
|
4
|
+
import { WithSkeleton } from '@snack-uikit/skeleton';
|
|
5
|
+
import { TruncateString } from '@snack-uikit/truncate-string';
|
|
6
|
+
|
|
7
|
+
import styles from '../styles.module.scss';
|
|
8
|
+
import { DataSkeleton } from './DataSkeleton';
|
|
9
|
+
|
|
10
|
+
type QuotaCardLayoutProps = WithSupportProps<{
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
title: string;
|
|
13
|
+
exceeded?: boolean;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
export function QuotaCardLayout({ title, exceeded, loading, children, ...rest }: QuotaCardLayoutProps) {
|
|
18
|
+
return (
|
|
19
|
+
<div className={styles.quotaCard} data-exceeded={exceeded || undefined} {...extractSupportProps(rest)}>
|
|
20
|
+
<div className={styles.title}>
|
|
21
|
+
<TruncateString text={title} maxLines={1} />
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<WithSkeleton loading={loading} skeleton={<DataSkeleton />}>
|
|
25
|
+
<div className={styles.dataWrapper}>{children}</div>
|
|
26
|
+
</WithSkeleton>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuotaCard';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
@use '@sbercloud/figma-tokens-cloud-platform/build/scss/styles-theme-variables';
|
|
2
|
+
|
|
3
|
+
.title {
|
|
4
|
+
@include styles-theme-variables.composite-var(styles-theme-variables.$sans-title-s);
|
|
5
|
+
|
|
6
|
+
color: styles-theme-variables.$sys-neutral-text-main;
|
|
7
|
+
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
width: 100%;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.dataWrapper {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: 8px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.dataRow {
|
|
21
|
+
display: grid;
|
|
22
|
+
grid-template-columns: 1fr auto;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.text {
|
|
28
|
+
@include styles-theme-variables.composite-var(styles-theme-variables.$light-label-m);
|
|
29
|
+
|
|
30
|
+
align-content: center;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.created {
|
|
35
|
+
color: styles-theme-variables.$sys-neutral-text-light;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.available {
|
|
39
|
+
color: styles-theme-variables.$sys-neutral-text-support;
|
|
40
|
+
height: 24px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.exceededState {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: 2px;
|
|
47
|
+
|
|
48
|
+
svg {
|
|
49
|
+
color: styles-theme-variables.$sys-red-accent-default;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.quotaCard {
|
|
54
|
+
box-sizing: border-box;
|
|
55
|
+
display: flex;
|
|
56
|
+
width: 240px;
|
|
57
|
+
min-width: 240px;
|
|
58
|
+
max-width: 240px;
|
|
59
|
+
height: 100px;
|
|
60
|
+
min-height: 100px;
|
|
61
|
+
max-height: 104px;
|
|
62
|
+
padding: 12px;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
align-items: flex-start;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
|
|
67
|
+
border-radius: 4px;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
|
|
70
|
+
border-style: solid;
|
|
71
|
+
border-width: 1px;
|
|
72
|
+
border-color: styles-theme-variables.$sys-neutral-decor-default;
|
|
73
|
+
|
|
74
|
+
background-color: styles-theme-variables.$sys-neutral-background1-level;
|
|
75
|
+
|
|
76
|
+
&[data-exceeded] {
|
|
77
|
+
.text .exceededState {
|
|
78
|
+
color: styles-theme-variables.$sys-red-text-support;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.noDataWrapper {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
width: 100%;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-items: center;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.noData {
|
|
92
|
+
@include styles-theme-variables.composite-var(styles-theme-variables.$sans-body-s);
|
|
93
|
+
text-align: center;
|
|
94
|
+
color: styles-theme-variables.$sys-neutral-text-support;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.retryButton {
|
|
98
|
+
svg {
|
|
99
|
+
transform: rotate(-360deg);
|
|
100
|
+
transition: transform 0.5s;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:active {
|
|
104
|
+
svg {
|
|
105
|
+
transform: rotate(0deg);
|
|
106
|
+
transition-duration: 0s;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
package/src/index.ts
ADDED
package/src/types.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type QuotaUnitType = 'instances' | 'value' | 'custom';
|
package/src/utils.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const checkExceeded = (available: number) => available <= 0;
|