@cloud-ru/ds-uikit-product-widget 1.0.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 +8 -0
- package/LICENSE +201 -0
- package/README.md +374 -0
- package/dist/cjs/components/Widget/Widget.d.ts +2 -0
- package/dist/cjs/components/Widget/Widget.js +42 -0
- package/dist/cjs/components/Widget/index.d.ts +1 -0
- package/dist/cjs/components/Widget/index.js +17 -0
- package/dist/cjs/components/Widget/styles.module.css +284 -0
- package/dist/cjs/components/index.d.ts +1 -0
- package/dist/cjs/components/index.js +17 -0
- package/dist/cjs/constants.d.ts +25 -0
- package/dist/cjs/constants.js +28 -0
- package/dist/cjs/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/cjs/helperComponents/Actions/ActionView.js +40 -0
- package/dist/cjs/helperComponents/Actions/Actions.d.ts +12 -0
- package/dist/cjs/helperComponents/Actions/Actions.js +43 -0
- package/dist/cjs/helperComponents/Actions/helpers.d.ts +21 -0
- package/dist/cjs/helperComponents/Actions/helpers.js +57 -0
- package/dist/cjs/helperComponents/Actions/index.d.ts +3 -0
- package/dist/cjs/helperComponents/Actions/index.js +21 -0
- package/dist/cjs/helperComponents/Actions/styles.module.css +46 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ActionList.d.ts +9 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ActionList.js +39 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +2 -0
- package/dist/cjs/helperComponents/ButtonDroplist/ButtonDroplist.js +34 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonDroplist/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonDroplist/styles.module.css +5 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.d.ts +2 -0
- package/dist/cjs/helperComponents/ButtonKebab/ButtonKebab.js +18 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ButtonKebab/index.js +17 -0
- package/dist/cjs/helperComponents/ButtonKebab/styles.module.css +5 -0
- package/dist/cjs/helperComponents/Content/Content.d.ts +11 -0
- package/dist/cjs/helperComponents/Content/Content.js +36 -0
- package/dist/cjs/helperComponents/Content/index.d.ts +1 -0
- package/dist/cjs/helperComponents/Content/index.js +17 -0
- package/dist/cjs/helperComponents/Content/styles.module.css +22 -0
- package/dist/cjs/helperComponents/ControlBlock/ControlBlock.d.ts +12 -0
- package/dist/cjs/helperComponents/ControlBlock/ControlBlock.js +22 -0
- package/dist/cjs/helperComponents/ControlBlock/index.d.ts +1 -0
- package/dist/cjs/helperComponents/ControlBlock/index.js +17 -0
- package/dist/cjs/helperComponents/ControlBlock/styles.module.css +12 -0
- package/dist/cjs/helperComponents/index.d.ts +5 -0
- package/dist/cjs/helperComponents/index.js +21 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/locale/index.d.ts +27 -0
- package/dist/cjs/locale/index.js +18 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/style.css +374 -0
- package/dist/cjs/types.d.ts +116 -0
- package/dist/cjs/types.js +2 -0
- package/dist/esm/components/Widget/Widget.d.ts +2 -0
- package/dist/esm/components/Widget/Widget.js +36 -0
- package/dist/esm/components/Widget/index.d.ts +1 -0
- package/dist/esm/components/Widget/index.js +1 -0
- package/dist/esm/components/Widget/styles.module.css +284 -0
- package/dist/esm/components/index.d.ts +1 -0
- package/dist/esm/components/index.js +1 -0
- package/dist/esm/constants.d.ts +25 -0
- package/dist/esm/constants.js +25 -0
- package/dist/esm/helperComponents/Actions/ActionView.d.ts +10 -0
- package/dist/esm/helperComponents/Actions/ActionView.js +37 -0
- package/dist/esm/helperComponents/Actions/Actions.d.ts +12 -0
- package/dist/esm/helperComponents/Actions/Actions.js +37 -0
- package/dist/esm/helperComponents/Actions/helpers.d.ts +21 -0
- package/dist/esm/helperComponents/Actions/helpers.js +50 -0
- package/dist/esm/helperComponents/Actions/index.d.ts +3 -0
- package/dist/esm/helperComponents/Actions/index.js +3 -0
- package/dist/esm/helperComponents/Actions/styles.module.css +46 -0
- package/dist/esm/helperComponents/ButtonDroplist/ActionList.d.ts +9 -0
- package/dist/esm/helperComponents/ButtonDroplist/ActionList.js +33 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.d.ts +2 -0
- package/dist/esm/helperComponents/ButtonDroplist/ButtonDroplist.js +28 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/index.js +1 -0
- package/dist/esm/helperComponents/ButtonDroplist/styles.module.css +5 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.d.ts +2 -0
- package/dist/esm/helperComponents/ButtonKebab/ButtonKebab.js +12 -0
- package/dist/esm/helperComponents/ButtonKebab/index.d.ts +1 -0
- package/dist/esm/helperComponents/ButtonKebab/index.js +1 -0
- package/dist/esm/helperComponents/ButtonKebab/styles.module.css +5 -0
- package/dist/esm/helperComponents/Content/Content.d.ts +11 -0
- package/dist/esm/helperComponents/Content/Content.js +30 -0
- package/dist/esm/helperComponents/Content/index.d.ts +1 -0
- package/dist/esm/helperComponents/Content/index.js +1 -0
- package/dist/esm/helperComponents/Content/styles.module.css +22 -0
- package/dist/esm/helperComponents/ControlBlock/ControlBlock.d.ts +12 -0
- package/dist/esm/helperComponents/ControlBlock/ControlBlock.js +16 -0
- package/dist/esm/helperComponents/ControlBlock/index.d.ts +1 -0
- package/dist/esm/helperComponents/ControlBlock/index.js +1 -0
- package/dist/esm/helperComponents/ControlBlock/styles.module.css +12 -0
- package/dist/esm/helperComponents/index.d.ts +5 -0
- package/dist/esm/helperComponents/index.js +5 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/locale/index.d.ts +27 -0
- package/dist/esm/locale/index.js +15 -0
- package/dist/esm/style.css +374 -0
- package/dist/esm/types.d.ts +116 -0
- package/dist/esm/types.js +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/package.json +59 -0
- package/src/components/Widget/Widget.tsx +113 -0
- package/src/components/Widget/index.ts +1 -0
- package/src/components/Widget/styles.module.scss +93 -0
- package/src/components/index.ts +1 -0
- package/src/constants.ts +27 -0
- package/src/helperComponents/Actions/ActionView.tsx +56 -0
- package/src/helperComponents/Actions/Actions.tsx +84 -0
- package/src/helperComponents/Actions/helpers.ts +84 -0
- package/src/helperComponents/Actions/index.ts +3 -0
- package/src/helperComponents/Actions/styles.module.scss +54 -0
- package/src/helperComponents/ButtonDroplist/ButtonDroplist.tsx +50 -0
- package/src/helperComponents/ButtonDroplist/index.ts +1 -0
- package/src/helperComponents/ButtonDroplist/styles.module.scss +5 -0
- package/src/helperComponents/ButtonKebab/ButtonKebab.tsx +36 -0
- package/src/helperComponents/ButtonKebab/index.ts +1 -0
- package/src/helperComponents/ButtonKebab/styles.module.scss +5 -0
- package/src/helperComponents/Content/Content.tsx +72 -0
- package/src/helperComponents/Content/index.ts +1 -0
- package/src/helperComponents/Content/styles.module.scss +26 -0
- package/src/helperComponents/ControlBlock/ControlBlock.tsx +40 -0
- package/src/helperComponents/ControlBlock/index.ts +1 -0
- package/src/helperComponents/ControlBlock/styles.module.scss +16 -0
- package/src/helperComponents/index.ts +5 -0
- package/src/index.ts +4 -0
- package/src/locale/index.ts +19 -0
- package/src/types.ts +151 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.widget{
|
|
3
|
+
position:relative;
|
|
4
|
+
display:flex;
|
|
5
|
+
flex-direction:column;
|
|
6
|
+
gap:var(--sn-primitive-dimension-12, 12px);
|
|
7
|
+
box-sizing:border-box;
|
|
8
|
+
width:100%;
|
|
9
|
+
min-width:0;
|
|
10
|
+
padding:var(--sn-primitive-dimension-16, 16px);
|
|
11
|
+
border-radius:var(--sn-card-anatomy-radius-l-container-borderRadius, var(--sn-brand-anatomy-radius-card-l, var(--sn-primitive-dimension-4, 4px)));
|
|
12
|
+
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
|
|
13
|
+
background:var(--sn-theme-color-neutral-background1Level, var(--sn-brand-color-neutral-95, var(--sn-primitive-color-gray-95, #fdfdfd)));
|
|
14
|
+
}
|
|
15
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level=default]{
|
|
16
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
17
|
+
}
|
|
18
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level=default] .acrylic{
|
|
19
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
20
|
+
background:var(--sn-theme-color-primary-background, var(--sn-brand-color-primary-90, var(--sn-brandRole-color-brandA-90, var(--sn-primitive-color-brandA-90, #edf7f1))));
|
|
21
|
+
}
|
|
22
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level="1Level"]{
|
|
23
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
24
|
+
}
|
|
25
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level="1Level"] .acrylic{
|
|
26
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
27
|
+
background:var(--sn-theme-color-primary-background1Level, var(--sn-brand-color-primary-95, var(--sn-brandRole-color-brandA-95, var(--sn-primitive-color-brandA-95, #f5fdf8))));
|
|
28
|
+
}
|
|
29
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level="2Level"]{
|
|
30
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
31
|
+
}
|
|
32
|
+
.widget[data-acrylic-appearance=primary][data-acrylic-level="2Level"] .acrylic{
|
|
33
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
34
|
+
background:var(--sn-theme-color-primary-background2Level, var(--sn-brand-color-primary-99, var(--sn-brandRole-color-brandA-99, var(--sn-primitive-color-brandA-99, #fbfffc))));
|
|
35
|
+
}
|
|
36
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level=default]{
|
|
37
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
38
|
+
}
|
|
39
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level=default] .acrylic{
|
|
40
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
41
|
+
background:var(--sn-theme-color-neutral-background, var(--sn-brand-color-neutral-90, var(--sn-primitive-color-gray-90, #eeeff3)));
|
|
42
|
+
}
|
|
43
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level="1Level"]{
|
|
44
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
45
|
+
}
|
|
46
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level="1Level"] .acrylic{
|
|
47
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
48
|
+
background:var(--sn-theme-color-neutral-background1Level, var(--sn-brand-color-neutral-95, var(--sn-primitive-color-gray-95, #fdfdfd)));
|
|
49
|
+
}
|
|
50
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level="2Level"]{
|
|
51
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
52
|
+
}
|
|
53
|
+
.widget[data-acrylic-appearance=neutral][data-acrylic-level="2Level"] .acrylic{
|
|
54
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
55
|
+
background:var(--sn-theme-color-neutral-background2Level, var(--sn-brand-color-neutral-99, var(--sn-primitive-color-gray-99, #ffffff)));
|
|
56
|
+
}
|
|
57
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level=default]{
|
|
58
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
59
|
+
}
|
|
60
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level=default] .acrylic{
|
|
61
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
62
|
+
background:var(--sn-theme-color-red-background, var(--sn-primitive-color-red-90, #fee8e5));
|
|
63
|
+
}
|
|
64
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level="1Level"]{
|
|
65
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
66
|
+
}
|
|
67
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level="1Level"] .acrylic{
|
|
68
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
69
|
+
background:var(--sn-theme-color-red-background1Level, var(--sn-primitive-color-red-95, #fef5f1));
|
|
70
|
+
}
|
|
71
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level="2Level"]{
|
|
72
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
73
|
+
}
|
|
74
|
+
.widget[data-acrylic-appearance=red][data-acrylic-level="2Level"] .acrylic{
|
|
75
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
76
|
+
background:var(--sn-theme-color-red-background2Level, var(--sn-primitive-color-red-99, #fffaf7));
|
|
77
|
+
}
|
|
78
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level=default]{
|
|
79
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
80
|
+
}
|
|
81
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level=default] .acrylic{
|
|
82
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
83
|
+
background:var(--sn-theme-color-orange-background, var(--sn-primitive-color-orange-90, #ffedcf));
|
|
84
|
+
}
|
|
85
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level="1Level"]{
|
|
86
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
87
|
+
}
|
|
88
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level="1Level"] .acrylic{
|
|
89
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
90
|
+
background:var(--sn-theme-color-orange-background1Level, var(--sn-primitive-color-orange-95, #fff6e5));
|
|
91
|
+
}
|
|
92
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level="2Level"]{
|
|
93
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
94
|
+
}
|
|
95
|
+
.widget[data-acrylic-appearance=orange][data-acrylic-level="2Level"] .acrylic{
|
|
96
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
97
|
+
background:var(--sn-theme-color-orange-background2Level, var(--sn-primitive-color-orange-99, #fffcf4));
|
|
98
|
+
}
|
|
99
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level=default]{
|
|
100
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
101
|
+
}
|
|
102
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level=default] .acrylic{
|
|
103
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
104
|
+
background:var(--sn-theme-color-yellow-background, var(--sn-primitive-color-yellow-90, #fdf4cc));
|
|
105
|
+
}
|
|
106
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level="1Level"]{
|
|
107
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
108
|
+
}
|
|
109
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level="1Level"] .acrylic{
|
|
110
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
111
|
+
background:var(--sn-theme-color-yellow-background1Level, var(--sn-primitive-color-yellow-95, #fffbe6));
|
|
112
|
+
}
|
|
113
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level="2Level"]{
|
|
114
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
115
|
+
}
|
|
116
|
+
.widget[data-acrylic-appearance=yellow][data-acrylic-level="2Level"] .acrylic{
|
|
117
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
118
|
+
background:var(--sn-theme-color-yellow-background2Level, var(--sn-primitive-color-yellow-99, #fffef6));
|
|
119
|
+
}
|
|
120
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level=default]{
|
|
121
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
122
|
+
}
|
|
123
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level=default] .acrylic{
|
|
124
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
125
|
+
background:var(--sn-theme-color-green-background, var(--sn-primitive-color-green-90, #e4f5df));
|
|
126
|
+
}
|
|
127
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level="1Level"]{
|
|
128
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
129
|
+
}
|
|
130
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level="1Level"] .acrylic{
|
|
131
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
132
|
+
background:var(--sn-theme-color-green-background1Level, var(--sn-primitive-color-green-95, #f1faed));
|
|
133
|
+
}
|
|
134
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level="2Level"]{
|
|
135
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
136
|
+
}
|
|
137
|
+
.widget[data-acrylic-appearance=green][data-acrylic-level="2Level"] .acrylic{
|
|
138
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
139
|
+
background:var(--sn-theme-color-green-background2Level, var(--sn-primitive-color-green-99, #fcfefa));
|
|
140
|
+
}
|
|
141
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level=default]{
|
|
142
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
143
|
+
}
|
|
144
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level=default] .acrylic{
|
|
145
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
146
|
+
background:var(--sn-theme-color-blue-background, var(--sn-primitive-color-blue-90, #e6f4fd));
|
|
147
|
+
}
|
|
148
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level="1Level"]{
|
|
149
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
150
|
+
}
|
|
151
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level="1Level"] .acrylic{
|
|
152
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
153
|
+
background:var(--sn-theme-color-blue-background1Level, var(--sn-primitive-color-blue-95, #f2f9ff));
|
|
154
|
+
}
|
|
155
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level="2Level"]{
|
|
156
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
157
|
+
}
|
|
158
|
+
.widget[data-acrylic-appearance=blue][data-acrylic-level="2Level"] .acrylic{
|
|
159
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
160
|
+
background:var(--sn-theme-color-blue-background2Level, var(--sn-primitive-color-blue-99, #fdfeff));
|
|
161
|
+
}
|
|
162
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level=default]{
|
|
163
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
164
|
+
}
|
|
165
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level=default] .acrylic{
|
|
166
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
167
|
+
background:var(--sn-theme-color-violet-background, var(--sn-primitive-color-violet-90, #f3edfc));
|
|
168
|
+
}
|
|
169
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level="1Level"]{
|
|
170
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
171
|
+
}
|
|
172
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level="1Level"] .acrylic{
|
|
173
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
174
|
+
background:var(--sn-theme-color-violet-background1Level, var(--sn-primitive-color-violet-95, #f9f5ff));
|
|
175
|
+
}
|
|
176
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level="2Level"]{
|
|
177
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
178
|
+
}
|
|
179
|
+
.widget[data-acrylic-appearance=violet][data-acrylic-level="2Level"] .acrylic{
|
|
180
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
181
|
+
background:var(--sn-theme-color-violet-background2Level, var(--sn-primitive-color-violet-99, #fdfdfd));
|
|
182
|
+
}
|
|
183
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level=default]{
|
|
184
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground, 0) / 2));
|
|
185
|
+
}
|
|
186
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level=default] .acrylic{
|
|
187
|
+
opacity:var(--sn-acrylic-opacityBackground, 1);
|
|
188
|
+
background:var(--sn-theme-color-pink-background, var(--sn-primitive-color-pink-90, #fceaf0));
|
|
189
|
+
}
|
|
190
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level="1Level"]{
|
|
191
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
192
|
+
}
|
|
193
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level="1Level"] .acrylic{
|
|
194
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
195
|
+
background:var(--sn-theme-color-pink-background1Level, var(--sn-primitive-color-pink-95, #fff5f7));
|
|
196
|
+
}
|
|
197
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level="2Level"]{
|
|
198
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground2Level, 0) / 2));
|
|
199
|
+
}
|
|
200
|
+
.widget[data-acrylic-appearance=pink][data-acrylic-level="2Level"] .acrylic{
|
|
201
|
+
opacity:var(--sn-acrylic-opacityBackground2Level, 1);
|
|
202
|
+
background:var(--sn-theme-color-pink-background2Level, var(--sn-primitive-color-pink-99, #fdfcfc));
|
|
203
|
+
}
|
|
204
|
+
.widget[data-acrylic-appearance=transparent]{
|
|
205
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
206
|
+
}
|
|
207
|
+
.widget[data-acrylic-appearance=transparent] .acrylic{
|
|
208
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
209
|
+
background:transparent;
|
|
210
|
+
}
|
|
211
|
+
.widget[data-acrylic-appearance=decorTransparent]{
|
|
212
|
+
backdrop-filter:blur(calc(var(--sn-acrylic-blurBackground1Level, 0) / 2));
|
|
213
|
+
}
|
|
214
|
+
.widget[data-acrylic-appearance=decorTransparent] .acrylic{
|
|
215
|
+
opacity:var(--sn-acrylic-opacityBackground1Level, 1);
|
|
216
|
+
background:var(--sn-theme-color-neutral-decorTransparent, var(--sn-brand-color-neutral-transparent-forLightMode, rgba(124, 131, 182, 0.0784313725)));
|
|
217
|
+
}
|
|
218
|
+
.widget[data-state=loading][data-wide]{
|
|
219
|
+
gap:var(--sn-primitive-dimension-16, 16px);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.widgetHeader{
|
|
223
|
+
display:flex;
|
|
224
|
+
gap:var(--sn-primitive-dimension-16, 16px);
|
|
225
|
+
align-items:center;
|
|
226
|
+
justify-content:space-between;
|
|
227
|
+
min-width:0;
|
|
228
|
+
}
|
|
229
|
+
.widgetHeader[data-mobile]{
|
|
230
|
+
flex-direction:column;
|
|
231
|
+
align-items:flex-start;
|
|
232
|
+
}
|
|
233
|
+
.widgetHeader[data-loading]{
|
|
234
|
+
gap:var(--sn-primitive-dimension-12, 12px);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.headerMain{
|
|
238
|
+
display:flex;
|
|
239
|
+
flex:0 1 auto;
|
|
240
|
+
gap:var(--sn-primitive-dimension-16, 16px);
|
|
241
|
+
align-items:center;
|
|
242
|
+
justify-content:space-between;
|
|
243
|
+
min-width:0;
|
|
244
|
+
max-width:100%;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.widgetHeader[data-mobile] .headerMain{
|
|
248
|
+
width:100%;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.titleClickable{
|
|
252
|
+
flex:0 1 auto;
|
|
253
|
+
min-width:0;
|
|
254
|
+
max-width:100%;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.widgetContent{
|
|
258
|
+
min-height:0;
|
|
259
|
+
color:var(--sn-theme-color-available-version-textMain, var(--sn-brand-color-text-version-main, #41424e));
|
|
260
|
+
font-family:var(--sn-regular-body-s-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
|
|
261
|
+
font-weight:var(--sn-regular-body-s-fontWeight, var(--sn-theme-typography-fontWeight-regular-body-s, var(--sn-brand-font-fontWeight-light-regular-body-s, var(--sn-primitive-font-fontWeightValue-400, 400))));
|
|
262
|
+
line-height:var(--sn-regular-body-s-lineHeight, var(--sn-density-typography-roleBody-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
|
|
263
|
+
font-size:var(--sn-regular-body-s-fontSize, var(--sn-density-typography-roleBody-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
|
|
264
|
+
letter-spacing:var(--sn-regular-body-s-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
|
|
265
|
+
paragraph-spacing:var(--sn-regular-body-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.skeletonHeader{
|
|
269
|
+
flex:1;
|
|
270
|
+
width:100%;
|
|
271
|
+
min-width:0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.button{
|
|
275
|
+
white-space:nowrap;
|
|
276
|
+
}
|
|
277
|
+
.button[data-full-width]:not([data-variant=icon-only]){
|
|
278
|
+
flex-shrink:0;
|
|
279
|
+
width:auto;
|
|
280
|
+
}
|
|
281
|
+
.button[data-variant=icon-only]{
|
|
282
|
+
flex-grow:0;
|
|
283
|
+
flex-shrink:0;
|
|
284
|
+
}
|
|
285
|
+
.mobileActionsWrapper{
|
|
286
|
+
scrollbar-width:none;
|
|
287
|
+
overflow-y:auto;
|
|
288
|
+
display:flex;
|
|
289
|
+
flex-shrink:0;
|
|
290
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
291
|
+
justify-content:stretch;
|
|
292
|
+
width:100%;
|
|
293
|
+
}
|
|
294
|
+
.mobileActionsWrapper::-webkit-scrollbar{
|
|
295
|
+
display:none;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.button{
|
|
299
|
+
white-space:nowrap;
|
|
300
|
+
}
|
|
301
|
+
.button[data-full-width]:not([data-variant=icon-only]){
|
|
302
|
+
flex-shrink:0;
|
|
303
|
+
width:auto;
|
|
304
|
+
}
|
|
305
|
+
.button[data-variant=icon-only]{
|
|
306
|
+
flex-grow:0;
|
|
307
|
+
flex-shrink:0;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.actionsWrapper{
|
|
311
|
+
display:flex;
|
|
312
|
+
flex-shrink:0;
|
|
313
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
314
|
+
align-items:center;
|
|
315
|
+
}
|
|
316
|
+
.actionsWrapper[data-wide]{
|
|
317
|
+
justify-content:flex-end;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.skeletonActions{
|
|
321
|
+
display:flex;
|
|
322
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
323
|
+
align-items:center;
|
|
324
|
+
width:100%;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.skeletonActionFull{
|
|
328
|
+
flex:1;
|
|
329
|
+
min-width:0;
|
|
330
|
+
}
|
|
331
|
+
.trigger{
|
|
332
|
+
display:inline-flex;
|
|
333
|
+
align-items:center;
|
|
334
|
+
vertical-align:top;
|
|
335
|
+
}
|
|
336
|
+
.trigger{
|
|
337
|
+
display:inline-flex;
|
|
338
|
+
align-items:center;
|
|
339
|
+
vertical-align:top;
|
|
340
|
+
}
|
|
341
|
+
.skeletonContent{
|
|
342
|
+
display:flex;
|
|
343
|
+
flex-direction:column;
|
|
344
|
+
gap:var(--sn-primitive-dimension-4, 4px);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.errorWrapper{
|
|
348
|
+
display:flex;
|
|
349
|
+
justify-content:center;
|
|
350
|
+
box-sizing:border-box;
|
|
351
|
+
width:100%;
|
|
352
|
+
padding-block:var(--sn-primitive-dimension-8, 8px);
|
|
353
|
+
}
|
|
354
|
+
.errorWrapper[data-wide]{
|
|
355
|
+
padding-block:var(--sn-primitive-dimension-16, 16px);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.infoBlock{
|
|
359
|
+
justify-content:center;
|
|
360
|
+
width:100%;
|
|
361
|
+
max-width:calc(9 * var(--sn-primitive-dimension-64, 64px) + var(--sn-primitive-dimension-48, 48px));
|
|
362
|
+
}
|
|
363
|
+
.controlWrapper{
|
|
364
|
+
display:flex;
|
|
365
|
+
flex-shrink:0;
|
|
366
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
367
|
+
align-items:center;
|
|
368
|
+
}
|
|
369
|
+
.controlWrapper[data-mobile]{
|
|
370
|
+
width:100%;
|
|
371
|
+
}
|
|
372
|
+
.controlWrapper[data-mobile] > *{
|
|
373
|
+
width:100%;
|
|
374
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ButtonProps } from '@cloud-ru/ds-button';
|
|
2
|
+
import type { InfoBlockProps } from '@cloud-ru/ds-info-block';
|
|
3
|
+
import type { SegmentControlProps } from '@cloud-ru/ds-segment-control';
|
|
4
|
+
import { TooltipProps } from '@cloud-ru/ds-tooltip';
|
|
5
|
+
import { TitleClickableProps } from '@cloud-ru/ds-uikit-product-title-clickable';
|
|
6
|
+
import { WithSupportProps } from '@cloud-ru/ds-utils';
|
|
7
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
8
|
+
import { BUTTON_TYPE } from './constants';
|
|
9
|
+
export type WidgetState = 'default' | 'loading' | 'error';
|
|
10
|
+
export type WidgetLayoutType = 'desktop' | 'mobile';
|
|
11
|
+
export type WidgetHeaderProps = Pick<TitleClickableProps, 'title' | 'icon' | 'avatar' | 'href' | 'target' | 'onClick' | 'titleTag' | 'fullWidth' | 'children' | 'className'>;
|
|
12
|
+
export type WidgetLoadingStateProps = {
|
|
13
|
+
/** Кастомный контент для состояния загрузки. */
|
|
14
|
+
loadingContent?: ReactNode;
|
|
15
|
+
/** Показывать skeleton-заглушку в body. */
|
|
16
|
+
showSkeleton?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type WidgetErrorStateProps = {
|
|
19
|
+
/** Заголовок ошибки. */
|
|
20
|
+
errorTitle?: string;
|
|
21
|
+
/** Описание ошибки. */
|
|
22
|
+
errorDescription?: string;
|
|
23
|
+
/** Иконка InfoBlock. */
|
|
24
|
+
errorIcon?: InfoBlockProps['icon'];
|
|
25
|
+
/** Текст кнопки повтора. */
|
|
26
|
+
updateButtonLabel?: string;
|
|
27
|
+
/** Клик по кнопке повтора. */
|
|
28
|
+
onClickUpdate: MouseEventHandler<HTMLElement>;
|
|
29
|
+
};
|
|
30
|
+
export type WidgetActionListItem = {
|
|
31
|
+
content: {
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
beforeContent?: ReactNode;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
hidden?: boolean;
|
|
37
|
+
onClick?: MouseEventHandler<HTMLElement>;
|
|
38
|
+
};
|
|
39
|
+
export type WidgetActionListGroup = {
|
|
40
|
+
type: 'group';
|
|
41
|
+
label?: string;
|
|
42
|
+
divider?: boolean;
|
|
43
|
+
items: WidgetActionListItem[];
|
|
44
|
+
};
|
|
45
|
+
export type WidgetActionListEntry = WidgetActionListItem | WidgetActionListGroup;
|
|
46
|
+
export type WidgetActionListProps = {
|
|
47
|
+
items: WidgetActionListEntry[];
|
|
48
|
+
closeDroplistOnItemClick?: boolean;
|
|
49
|
+
className?: string;
|
|
50
|
+
open?: boolean;
|
|
51
|
+
onOpenChange?: (open: boolean) => void;
|
|
52
|
+
};
|
|
53
|
+
type BaseAction = {
|
|
54
|
+
/** Tooltip вокруг кнопки действия. */
|
|
55
|
+
tooltip?: TooltipProps;
|
|
56
|
+
/** Скрыть действие без удаления из массива. */
|
|
57
|
+
hidden?: boolean;
|
|
58
|
+
};
|
|
59
|
+
type ButtonAction = BaseAction & Omit<ButtonProps<'button'>, 'view'> & {
|
|
60
|
+
variant?: typeof BUTTON_TYPE.Filled;
|
|
61
|
+
};
|
|
62
|
+
type OutlineAction = BaseAction & Omit<ButtonProps<'button'>, 'view'> & {
|
|
63
|
+
variant: typeof BUTTON_TYPE.Outline;
|
|
64
|
+
};
|
|
65
|
+
type TonalAction = BaseAction & Omit<ButtonProps<'button'>, 'view'> & {
|
|
66
|
+
variant: typeof BUTTON_TYPE.Tonal;
|
|
67
|
+
};
|
|
68
|
+
type FunctionAction = BaseAction & Omit<ButtonProps<'button'>, 'view'> & {
|
|
69
|
+
variant: typeof BUTTON_TYPE.Function;
|
|
70
|
+
};
|
|
71
|
+
type SimpleAction = BaseAction & Omit<ButtonProps<'button'>, 'view'> & {
|
|
72
|
+
variant: typeof BUTTON_TYPE.Simple;
|
|
73
|
+
};
|
|
74
|
+
export type ButtonKebabProps = {
|
|
75
|
+
button?: Omit<ButtonProps<'button'>, 'label' | 'icon' | 'view'>;
|
|
76
|
+
list: WidgetActionListProps;
|
|
77
|
+
};
|
|
78
|
+
export type ButtonDroplistProps = {
|
|
79
|
+
button: (Omit<ButtonProps<'button'>, 'appearance' | 'view'> & {
|
|
80
|
+
buttonType?: 'filled';
|
|
81
|
+
}) | (Omit<ButtonProps<'button'>, 'icon' | 'iconPosition' | 'appearance' | 'view'> & {
|
|
82
|
+
buttonType?: 'function';
|
|
83
|
+
});
|
|
84
|
+
list: WidgetActionListProps;
|
|
85
|
+
};
|
|
86
|
+
type KebabAction = BaseAction & ButtonKebabProps & {
|
|
87
|
+
variant: typeof BUTTON_TYPE.Kebab;
|
|
88
|
+
};
|
|
89
|
+
type DroplistAction = BaseAction & ButtonDroplistProps & {
|
|
90
|
+
variant: typeof BUTTON_TYPE.Droplist;
|
|
91
|
+
};
|
|
92
|
+
export type Action = ButtonAction | OutlineAction | TonalAction | FunctionAction | SimpleAction | KebabAction | DroplistAction;
|
|
93
|
+
export type WidgetAction = Action;
|
|
94
|
+
export type WidgetProps = WithSupportProps<{
|
|
95
|
+
/** Пропсы кликабельного заголовка. */
|
|
96
|
+
header: WidgetHeaderProps;
|
|
97
|
+
/** Контент виджета. */
|
|
98
|
+
children: ReactNode;
|
|
99
|
+
/** Действия в шапке/footer. */
|
|
100
|
+
actions?: Action[];
|
|
101
|
+
/** Дополнительный слот рядом с действиями. */
|
|
102
|
+
actionsChildren?: ReactNode;
|
|
103
|
+
/** Пропсы SegmentControl в шапке. */
|
|
104
|
+
segmentControl?: SegmentControlProps;
|
|
105
|
+
/** Только desktop: wide-раскладка виджета. На mobile принудительно выключается (`wide && !isMobile`). */
|
|
106
|
+
wide?: boolean;
|
|
107
|
+
/** Состояние виджета. */
|
|
108
|
+
state?: WidgetState;
|
|
109
|
+
/** Настройки loading-состояния. */
|
|
110
|
+
loadingState?: WidgetLoadingStateProps;
|
|
111
|
+
/** Настройки error-состояния. */
|
|
112
|
+
errorState?: WidgetErrorStateProps;
|
|
113
|
+
/** Дополнительный CSS-класс. */
|
|
114
|
+
className?: string;
|
|
115
|
+
}>;
|
|
116
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
|
|
4
|
+
import { Skeleton } from '@cloud-ru/ds-skeleton';
|
|
5
|
+
import { TitleClickable } from '@cloud-ru/ds-uikit-product-title-clickable';
|
|
6
|
+
import { extractSupportProps, useDynamicList } from '@cloud-ru/ds-utils';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import { memo, useMemo, useRef } from 'react';
|
|
9
|
+
import { BUTTON_TYPE, TEST_IDS, WIDGET_STATE } from '../../constants.js';
|
|
10
|
+
import { Actions, ActionView, Content, ControlBlock, isVisibleAction } from '../../helperComponents/index.js';
|
|
11
|
+
import styles from './styles.module.css';
|
|
12
|
+
function WidgetComponent({ header, children, actions = [], wide: wideProp = false, state = WIDGET_STATE.Default, loadingState, errorState, className, actionsChildren, segmentControl, ...rest }) {
|
|
13
|
+
const { layoutType: contextLayoutType } = useAdaptiveLayout();
|
|
14
|
+
const isMobile = isMobileLayout(contextLayoutType);
|
|
15
|
+
const wide = wideProp && !isMobile;
|
|
16
|
+
const containerRef = useRef(null);
|
|
17
|
+
const visibleSource = useMemo(() => actions.filter(isVisibleAction), [actions]);
|
|
18
|
+
const { visibleItems, hiddenItems } = useDynamicList({
|
|
19
|
+
parentContainerRef: containerRef,
|
|
20
|
+
items: visibleSource,
|
|
21
|
+
maxVisibleItems: 1,
|
|
22
|
+
});
|
|
23
|
+
const [visibleItemsWithoutKebab, hiddenItemsWithKebab] = useMemo(() => {
|
|
24
|
+
const withoutKebab = visibleItems.filter(item => item.variant !== BUTTON_TYPE.Kebab);
|
|
25
|
+
const withKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === BUTTON_TYPE.Kebab));
|
|
26
|
+
return [withoutKebab, withKebab];
|
|
27
|
+
}, [visibleItems, hiddenItems]);
|
|
28
|
+
return (_jsxs("div", { className: cn(styles.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, ...extractSupportProps(rest), children: [_jsxs("div", { className: styles.widgetHeader, "data-mobile": !wide || undefined, "data-loading": state === WIDGET_STATE.Loading || undefined, "data-test-id": TEST_IDS.header, children: [_jsxs("div", { className: styles.headerMain, children: [state === WIDGET_STATE.Loading ? (_jsx("div", { className: styles.skeletonHeader, children: _jsx(Skeleton, { loading: true, width: wide ? '96px' : '100%', height: '32px', borderRadius: '4px' }) })) : (_jsx(TitleClickable, { ...header, className: cn(styles.titleClickable, header.className) })), !wide && (_jsx(Actions, { actions: state === WIDGET_STATE.Error ? actions : hiddenItemsWithKebab, actionsChildren: actionsChildren, wide: wide, state: state }))] }), _jsx(ControlBlock, { actions: actions, actionsChildren: actionsChildren, segmentControl: segmentControl, wide: wide, state: state })] }), _jsx("div", { className: styles.widgetContent, "data-test-id": TEST_IDS.content, children: _jsx(Content, { state: state, wide: wide, loadingState: loadingState, errorState: errorState, children: children }) }), !wide &&
|
|
29
|
+
state !== WIDGET_STATE.Error &&
|
|
30
|
+
visibleItemsWithoutKebab.map((action, index) => state === WIDGET_STATE.Loading ? (_jsx(Skeleton, { loading: true, height: '32px', borderRadius: '8px' }, index)) : (_createElement(ActionView, { ...action, key: index, commonProps: {
|
|
31
|
+
className: styles.button,
|
|
32
|
+
size: 'm',
|
|
33
|
+
fullWidth: true,
|
|
34
|
+
} })))] }));
|
|
35
|
+
}
|
|
36
|
+
export const Widget = memo(WidgetComponent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Widget.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Widget.js';
|