@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
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2023 Cloud technology Limited (Ltd.)
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
# Widget
|
|
2
|
+
|
|
3
|
+
`@cloud-ru/ds-uikit-product-widget` — Карточка продуктового виджета с кликабельным заголовком, SegmentControl, действиями и состояниями loading/error.
|
|
4
|
+
|
|
5
|
+
`Widget` — контейнер продуктовой карточки: **`TitleClickable`** в шапке, опциональный **`SegmentControl`**, слот управления, массив действий (`Button`, kebab/droplist) и body с состояниями `default` / `loading` / `error`.
|
|
6
|
+
|
|
7
|
+
## Когда использовать
|
|
8
|
+
|
|
9
|
+
- Компактные блоки на dashboard и overview-страницах: заголовок-ссылка, переключатель вкладок, действия и контент в одной карточке.
|
|
10
|
+
- Нужны единые состояния загрузки и ошибки с `InfoBlock` и кнопкой повтора без ручной вёрстки.
|
|
11
|
+
- Действия должны адаптироваться по ширине: primary в шапке (wide desktop), overflow в kebab, на узком layout — кнопки в footer.
|
|
12
|
+
|
|
13
|
+
Когда **не** нужен `Widget`:
|
|
14
|
+
|
|
15
|
+
- Простая карточка без шапки и действий:
|
|
16
|
+
- используйте **`@cloud-ru/ds-block`** или **`@cloud-ru/ds-card`**.
|
|
17
|
+
- Только кликабельный заголовок без оболочки:
|
|
18
|
+
- используйте **`TitleClickable`**.
|
|
19
|
+
- Сложная таблица или список с сортировкой и пагинацией:
|
|
20
|
+
- используйте отдельный data-компонент, не оборачивайте в виджет.
|
|
21
|
+
|
|
22
|
+
- ✅ Передавайте `errorState.onClickUpdate` и переключайте `state` обратно в `default` после успешного retry.
|
|
23
|
+
- ❌ Оставлять `state='error'` без обработчика повтора — кнопка в `InfoBlock` не сможет восстановить контент.
|
|
24
|
+
|
|
25
|
+
- ✅ На desktop с несколькими действиями включайте `wide`, чтобы primary и kebab жили в шапке.
|
|
26
|
+
- ❌ Ожидать wide-раскладку на mobile — флаг `wide` принудительно отключается.
|
|
27
|
+
|
|
28
|
+
- ✅ Оборачивайте демо и страницу с kebab/droplist в `PortalContextProvider`, если порталы рендерятся вне корня приложения.
|
|
29
|
+
- ❌ Полагаться на глобальный portal-context из layout docs-сайта — каждый `client:visible`-островок изолирован.
|
|
30
|
+
|
|
31
|
+
- ✅ Скрывайте лишние действия через `hidden: true`, не удаляя элемент из массива.
|
|
32
|
+
- ❌ Дублировать один и тот же primary CTA в `actions` и в `children` — достаточно одного места.
|
|
33
|
+
|
|
34
|
+
## Анатомия
|
|
35
|
+
|
|
36
|
+
### State (default `default`)
|
|
37
|
+
|
|
38
|
+
Состояние из `WIDGET_STATE`:
|
|
39
|
+
|
|
40
|
+
- `default` — рендерит `children` в body.
|
|
41
|
+
- `loading` — skeleton в шапке; body — `loadingState.loadingContent` или skeleton при `loadingState.showSkeleton`.
|
|
42
|
+
- `error` — `InfoBlock` с `errorState` и кнопкой `onClickUpdate`; видимые `actions` остаются в шапке для retry/навигации.
|
|
43
|
+
|
|
44
|
+
### Wide (default `false`)
|
|
45
|
+
|
|
46
|
+
- `false` — legacy layout: overflow-действия в kebab шапки, primary-кнопки на всю ширину под контентом (кроме `error`).
|
|
47
|
+
- `true` — primary и kebab в одной строке шапки рядом с `SegmentControl` / `actionsChildren`. На mobile-раскладке игнорируется.
|
|
48
|
+
|
|
49
|
+
### Action variant
|
|
50
|
+
|
|
51
|
+
Элемент `actions[i]` — discriminated union по `variant` (default — filled `Button`):
|
|
52
|
+
|
|
53
|
+
- `filled` / `outline` / `tonal` / `function` / `simple` — пропсы `@cloud-ru/ds-button` + опциональный `tooltip`.
|
|
54
|
+
- `kebab` — `ButtonKebab` + `list.items` (группы и пункты меню).
|
|
55
|
+
- `droplist` — кнопка-триггер + выпадающий список.
|
|
56
|
+
|
|
57
|
+
Меню обоих вариантов рендерит `Droplist` из `@cloud-ru/ds-list`: на mobile список открывается в `BottomSheet`, на desktop — анкорным popover'ом. Раскладка берётся из `AdaptiveProvider`.
|
|
58
|
+
|
|
59
|
+
Общие поля: `hidden`, `tooltip`. Для списков: `closeDroplistOnItemClick`, controlled `open` / `onOpenChange`.
|
|
60
|
+
|
|
61
|
+
### Slots
|
|
62
|
+
|
|
63
|
+
- `header` — пропсы **`TitleClickable`**: `title`, `href`, `icon`, `avatar`, `onClick`, …
|
|
64
|
+
- `children` — основной контент body.
|
|
65
|
+
- `segmentControl` — пропсы **`SegmentControl`** в шапке (часто `width: full` на desktop).
|
|
66
|
+
- `actionsChildren` — произвольный узел слева от кнопок (фильтр, badge, …).
|
|
67
|
+
- `loadingState` / `errorState` — настройки соответствующих состояний.
|
|
68
|
+
|
|
69
|
+
## Установка
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pnpm add @cloud-ru/ds-uikit-product-widget
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { Widget, BUTTON_TYPE, WIDGET_STATE } from '@cloud-ru/ds-uikit-product-widget'
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Примеры использования
|
|
80
|
+
|
|
81
|
+
### Контент и SegmentControl
|
|
82
|
+
|
|
83
|
+
Uncontrolled сегменты через defaultValue
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
import { WIDTH } from '@cloud-ru/ds-segment-control';
|
|
87
|
+
import { Widget } from '@cloud-ru/ds-uikit-product-widget';
|
|
88
|
+
|
|
89
|
+
export function DefaultContent() {
|
|
90
|
+
return (
|
|
91
|
+
<Widget
|
|
92
|
+
header={{ title: 'Cloud servers', href: '#' }}
|
|
93
|
+
segmentControl={{
|
|
94
|
+
width: WIDTH.Full,
|
|
95
|
+
defaultValue: 'overview',
|
|
96
|
+
items: [
|
|
97
|
+
{ value: 'overview', label: 'Overview' },
|
|
98
|
+
{ value: 'events', label: 'Events' },
|
|
99
|
+
],
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
Keep product metrics, shortcuts, and status details in one compact card.
|
|
103
|
+
</Widget>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Wide desktop и действия
|
|
109
|
+
|
|
110
|
+
Primary в шапке, overflow в kebab; PortalContextProvider для dropdown
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { WIDTH } from '@cloud-ru/ds-segment-control';
|
|
114
|
+
import { BUTTON_TYPE, Widget } from '@cloud-ru/ds-uikit-product-widget';
|
|
115
|
+
import { useState } from 'react';
|
|
116
|
+
|
|
117
|
+
export function WithActions() {
|
|
118
|
+
const [lastAction, setLastAction] = useState<string | null>(null);
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
122
|
+
<Widget
|
|
123
|
+
wide
|
|
124
|
+
header={{ title: 'Managed databases', href: '#' }}
|
|
125
|
+
segmentControl={{
|
|
126
|
+
width: WIDTH.Auto,
|
|
127
|
+
defaultValue: 'overview',
|
|
128
|
+
items: [
|
|
129
|
+
{ value: 'overview', label: 'Overview' },
|
|
130
|
+
{ value: 'events', label: 'Events' },
|
|
131
|
+
],
|
|
132
|
+
}}
|
|
133
|
+
actions={[
|
|
134
|
+
{ label: 'Create', onClick: () => setLastAction('Create') },
|
|
135
|
+
{
|
|
136
|
+
variant: BUTTON_TYPE.Outline,
|
|
137
|
+
label: 'Settings',
|
|
138
|
+
onClick: () => setLastAction('Settings'),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: BUTTON_TYPE.Kebab,
|
|
142
|
+
list: {
|
|
143
|
+
items: [
|
|
144
|
+
{ content: { label: 'Export' }, onClick: () => setLastAction('Export') },
|
|
145
|
+
{ content: { label: 'Archive' }, onClick: () => setLastAction('Archive') },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
]}
|
|
150
|
+
>
|
|
151
|
+
Actions are shown in the header for wide desktop widgets.
|
|
152
|
+
</Widget>
|
|
153
|
+
{lastAction ? <span>Last action: {lastAction}</span> : null}
|
|
154
|
+
</div>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Loading
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Widget } from '@cloud-ru/ds-uikit-product-widget';
|
|
163
|
+
|
|
164
|
+
export function LoadingState() {
|
|
165
|
+
return (
|
|
166
|
+
<Widget
|
|
167
|
+
header={{ title: 'Billing', href: '#' }}
|
|
168
|
+
state='loading'
|
|
169
|
+
loadingState={{ showSkeleton: true }}
|
|
170
|
+
actions={[{ label: 'Refresh' }]}
|
|
171
|
+
>
|
|
172
|
+
Billing summary
|
|
173
|
+
</Widget>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Error и повтор
|
|
179
|
+
|
|
180
|
+
onClickUpdate переключает state обратно в default
|
|
181
|
+
|
|
182
|
+
```tsx
|
|
183
|
+
import { Widget } from '@cloud-ru/ds-uikit-product-widget';
|
|
184
|
+
import { useState } from 'react';
|
|
185
|
+
|
|
186
|
+
export function ErrorState() {
|
|
187
|
+
const [state, setState] = useState<'default' | 'error'>('error');
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<Widget
|
|
191
|
+
header={{ title: 'Monitoring', href: '#' }}
|
|
192
|
+
state={state}
|
|
193
|
+
errorState={{
|
|
194
|
+
errorTitle: 'Metrics are unavailable',
|
|
195
|
+
errorDescription: 'Try reloading the widget.',
|
|
196
|
+
updateButtonLabel: 'Reload',
|
|
197
|
+
onClickUpdate: () => setState('default'),
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{state === 'error' ? 'Metrics' : 'Metrics loaded successfully.'}
|
|
201
|
+
</Widget>
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Props
|
|
207
|
+
|
|
208
|
+
**WidgetProps**
|
|
209
|
+
|
|
210
|
+
| Prop | Type | Default | Description |
|
|
211
|
+
|------|------|---------|-------------|
|
|
212
|
+
| `actions` | `Action` \| `BaseAction` \| `ButtonDroplistProps` \| `ButtonKebabProps` | — | Действия в шапке/footer. |
|
|
213
|
+
| `actionsChildren` | `ReactNode` | — | Дополнительный слот рядом с действиями. |
|
|
214
|
+
| `children` | `ReactNode` | — | Контент виджета. |
|
|
215
|
+
| `className` | `string` | — | Дополнительный CSS-класс. |
|
|
216
|
+
| `data-test-id` | `string` | — | |
|
|
217
|
+
| `errorState` | `WidgetErrorStateProps` | — | Настройки error-состояния. |
|
|
218
|
+
| `header` | `WidgetHeaderProps` | — | Пропсы кликабельного заголовка. |
|
|
219
|
+
| `loadingState` | `WidgetLoadingStateProps` | — | Настройки loading-состояния. |
|
|
220
|
+
| `segmentControl` | `SegmentControlProps` | — | Пропсы SegmentControl в шапке. |
|
|
221
|
+
| `state` | `"default"` \| `"error"` \| `"loading"` | — | Состояние виджета. |
|
|
222
|
+
| `wide` | `boolean` | — | Только desktop: wide-раскладка виджета. На mobile принудительно выключается (`wide && !isMobile`). |
|
|
223
|
+
|
|
224
|
+
#### Related types
|
|
225
|
+
|
|
226
|
+
- `Action` = `ButtonAction | OutlineAction | TonalAction | FunctionAction | SimpleAction | KebabAction | DroplistAction`
|
|
227
|
+
|
|
228
|
+
**BaseAction**
|
|
229
|
+
|
|
230
|
+
| Prop | Type | Default | Description |
|
|
231
|
+
|------|------|---------|-------------|
|
|
232
|
+
| `hidden` | `boolean \| undefined` | — | Скрыть действие без удаления из массива. |
|
|
233
|
+
| `tooltip` | `TooltipProps` | — | Tooltip вокруг кнопки действия. |
|
|
234
|
+
|
|
235
|
+
**ButtonDroplistProps**
|
|
236
|
+
|
|
237
|
+
| Prop | Type | Default | Description |
|
|
238
|
+
|------|------|---------|-------------|
|
|
239
|
+
| `button` | `ButtonProps` | — | |
|
|
240
|
+
| `list` | `WidgetActionListProps` | — | |
|
|
241
|
+
|
|
242
|
+
**ButtonKebabProps**
|
|
243
|
+
|
|
244
|
+
| Prop | Type | Default | Description |
|
|
245
|
+
|------|------|---------|-------------|
|
|
246
|
+
| `button` | `ButtonProps` | — | |
|
|
247
|
+
| `list` | `WidgetActionListProps` | — | |
|
|
248
|
+
|
|
249
|
+
**WidgetActionListProps**
|
|
250
|
+
|
|
251
|
+
| Prop | Type | Default | Description |
|
|
252
|
+
|------|------|---------|-------------|
|
|
253
|
+
| `className` | `string \| undefined` | — | |
|
|
254
|
+
| `closeDroplistOnItemClick` | `boolean \| undefined` | — | |
|
|
255
|
+
| `items` | `WidgetActionListEntry` \| `WidgetActionListGroup` \| `WidgetActionListItem` | — | |
|
|
256
|
+
| `onOpenChange` | `((open: boolean) => void) \| undefined` | — | |
|
|
257
|
+
| `open` | `boolean \| undefined` | — | |
|
|
258
|
+
|
|
259
|
+
**WidgetErrorStateProps**
|
|
260
|
+
|
|
261
|
+
| Prop | Type | Default | Description |
|
|
262
|
+
|------|------|---------|-------------|
|
|
263
|
+
| `errorDescription` | `string \| undefined` | — | Описание ошибки. |
|
|
264
|
+
| `errorIcon` | `InfoBlockProps` | — | Иконка InfoBlock. |
|
|
265
|
+
| `errorTitle` | `string \| undefined` | — | Заголовок ошибки. |
|
|
266
|
+
| `onClickUpdate` | `(event: MouseEvent<HTMLElement, MouseEvent>) => void` | — | Клик по кнопке повтора. |
|
|
267
|
+
| `updateButtonLabel` | `string \| undefined` | — | Текст кнопки повтора. |
|
|
268
|
+
|
|
269
|
+
**WidgetHeaderProps**
|
|
270
|
+
|
|
271
|
+
| Prop | Type | Default | Description |
|
|
272
|
+
|------|------|---------|-------------|
|
|
273
|
+
| `avatar` | `AvatarProps` | — | |
|
|
274
|
+
| `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Кастомное содержимое вместо title/before |
|
|
275
|
+
| `className` | `string \| undefined` | — | CSS-класс |
|
|
276
|
+
| `fullWidth` | `boolean \| undefined` | — | Занимает ли всю ширину |
|
|
277
|
+
| `icon` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
|
|
278
|
+
| `title` | `string \| undefined` | — | Заголовок |
|
|
279
|
+
| `titleTag` | `ElementType \| undefined` | — | Тег заголовка для семантики (например `'h2'`, `'h3'`, `'span'`) |
|
|
280
|
+
|
|
281
|
+
**WidgetLoadingStateProps**
|
|
282
|
+
|
|
283
|
+
| Prop | Type | Default | Description |
|
|
284
|
+
|------|------|---------|-------------|
|
|
285
|
+
| `loadingContent` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | Кастомный контент для состояния загрузки. |
|
|
286
|
+
| `showSkeleton` | `boolean \| undefined` | — | Показывать skeleton-заглушку в body. |
|
|
287
|
+
|
|
288
|
+
- `WidgetState` = `"default"` \| `"error"` \| `"loading"`
|
|
289
|
+
|
|
290
|
+
## Смотри также
|
|
291
|
+
|
|
292
|
+
- **`TitleClickable`** — заголовок-ссылка в шапке виджета.
|
|
293
|
+
- **`SegmentControl`** — переключатель вкладок в шапке.
|
|
294
|
+
- **`InfoBlock`** — блок ошибки внутри `state='error'`.
|
|
295
|
+
## Адаптивность
|
|
296
|
+
|
|
297
|
+
`Widget` — адаптивный компонент: DOM остаётся единым, но при mobile-раскладке карточка перестраивается. Раскладку он берёт из `AdaptiveProvider` (контекст `@cloud-ru/ds-adaptive`); публичный API единый для обеих платформ:
|
|
298
|
+
|
|
299
|
+
- **desktop** (по умолчанию) — учитывает `wide` и динамическое схлопывание действий в kebab по ширине контейнера.
|
|
300
|
+
- **mobile** — узкий режим: `wide` принудительно выключен, primary-кнопки уезжают в footer.
|
|
301
|
+
|
|
302
|
+
Верстайте под desktop и поставьте один `<AdaptiveProvider>` в корне приложения — mobile-перестроение включается автоматически (desktop-first). Пропа `layoutType` у компонента нет: источник раскладки — только контекст.
|
|
303
|
+
|
|
304
|
+
### Mobile layout
|
|
305
|
+
|
|
306
|
+
wide игнорируется, primary уезжает в footer
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
import { AdaptiveProvider, LAYOUT_TYPE } from '@cloud-ru/ds-adaptive';
|
|
310
|
+
import { BUTTON_TYPE, Widget } from '@cloud-ru/ds-uikit-product-widget';
|
|
311
|
+
import { useState } from 'react';
|
|
312
|
+
|
|
313
|
+
export function MobileLayout() {
|
|
314
|
+
const [lastAction, setLastAction] = useState<string | null>(null);
|
|
315
|
+
|
|
316
|
+
return (
|
|
317
|
+
<AdaptiveProvider layoutType={LAYOUT_TYPE.Mobile}>
|
|
318
|
+
<div style={{ maxWidth: 360, display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
319
|
+
<Widget
|
|
320
|
+
wide
|
|
321
|
+
header={{ title: 'Object storage', href: '#' }}
|
|
322
|
+
actions={[
|
|
323
|
+
{ label: 'Upload', onClick: () => setLastAction('Upload') },
|
|
324
|
+
{
|
|
325
|
+
variant: BUTTON_TYPE.Kebab,
|
|
326
|
+
list: {
|
|
327
|
+
items: [
|
|
328
|
+
{
|
|
329
|
+
content: { label: 'Delete bucket' },
|
|
330
|
+
onClick: () => setLastAction('Delete bucket'),
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
]}
|
|
336
|
+
>
|
|
337
|
+
On mobile, wide is ignored: primary actions move to the footer, overflow goes to kebab.
|
|
338
|
+
</Widget>
|
|
339
|
+
{lastAction ? <span>Last action: {lastAction}</span> : null}
|
|
340
|
+
</div>
|
|
341
|
+
</AdaptiveProvider>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Как форсировать платформу
|
|
347
|
+
|
|
348
|
+
Форс — только контекстом, не пропом:
|
|
349
|
+
|
|
350
|
+
- Поддерево — вложенный провайдер:
|
|
351
|
+
```tsx
|
|
352
|
+
import { AdaptiveProvider } from '@cloud-ru/ds-adaptive'
|
|
353
|
+
|
|
354
|
+
<AdaptiveProvider layoutType='mobile'>
|
|
355
|
+
<Widget header={header} actions={actions}>{content}</Widget>
|
|
356
|
+
</AdaptiveProvider>
|
|
357
|
+
```
|
|
358
|
+
- Отдельный компонент — `withLayoutType` (module-scope, сахар над провайдером):
|
|
359
|
+
```tsx
|
|
360
|
+
import { withLayoutType } from '@cloud-ru/ds-adaptive'
|
|
361
|
+
import { Widget } from '@cloud-ru/ds-uikit-product-widget'
|
|
362
|
+
|
|
363
|
+
const MobileWidget = withLayoutType(Widget, 'mobile')
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### Платформенные пропы
|
|
367
|
+
|
|
368
|
+
Таблица синхронизирована с JSDoc-пометками у `WidgetProps`.
|
|
369
|
+
|
|
370
|
+
| Проп | desktop | mobile |
|
|
371
|
+
|------|---------|--------|
|
|
372
|
+
| `wide` | используется | игнорируется (принудительно выключен) |
|
|
373
|
+
|
|
374
|
+
Подробнее о модели адаптивности — [Адаптивность — паттерн](/patterns/adaptive).
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Widget = void 0;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const adaptive_1 = require("@cloud-ru/ds-adaptive");
|
|
10
|
+
const skeleton_1 = require("@cloud-ru/ds-skeleton");
|
|
11
|
+
const uikit_product_title_clickable_1 = require("@cloud-ru/ds-uikit-product-title-clickable");
|
|
12
|
+
const utils_1 = require("@cloud-ru/ds-utils");
|
|
13
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
+
const react_2 = require("react");
|
|
15
|
+
const constants_1 = require("../../constants");
|
|
16
|
+
const helperComponents_1 = require("../../helperComponents");
|
|
17
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
18
|
+
function WidgetComponent({ header, children, actions = [], wide: wideProp = false, state = constants_1.WIDGET_STATE.Default, loadingState, errorState, className, actionsChildren, segmentControl, ...rest }) {
|
|
19
|
+
const { layoutType: contextLayoutType } = (0, adaptive_1.useAdaptiveLayout)();
|
|
20
|
+
const isMobile = (0, adaptive_1.isMobileLayout)(contextLayoutType);
|
|
21
|
+
const wide = wideProp && !isMobile;
|
|
22
|
+
const containerRef = (0, react_2.useRef)(null);
|
|
23
|
+
const visibleSource = (0, react_2.useMemo)(() => actions.filter(helperComponents_1.isVisibleAction), [actions]);
|
|
24
|
+
const { visibleItems, hiddenItems } = (0, utils_1.useDynamicList)({
|
|
25
|
+
parentContainerRef: containerRef,
|
|
26
|
+
items: visibleSource,
|
|
27
|
+
maxVisibleItems: 1,
|
|
28
|
+
});
|
|
29
|
+
const [visibleItemsWithoutKebab, hiddenItemsWithKebab] = (0, react_2.useMemo)(() => {
|
|
30
|
+
const withoutKebab = visibleItems.filter(item => item.variant !== constants_1.BUTTON_TYPE.Kebab);
|
|
31
|
+
const withKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === constants_1.BUTTON_TYPE.Kebab));
|
|
32
|
+
return [withoutKebab, withKebab];
|
|
33
|
+
}, [visibleItems, hiddenItems]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(styles_module_scss_1.default.widget, className), "data-state": state, ref: containerRef, "data-wide": wide || undefined, ...(0, utils_1.extractSupportProps)(rest), children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.widgetHeader, "data-mobile": !wide || undefined, "data-loading": state === constants_1.WIDGET_STATE.Loading || undefined, "data-test-id": constants_1.TEST_IDS.header, children: [(0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.headerMain, children: [state === constants_1.WIDGET_STATE.Loading ? ((0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.skeletonHeader, children: (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, width: wide ? '96px' : '100%', height: '32px', borderRadius: '4px' }) })) : ((0, jsx_runtime_1.jsx)(uikit_product_title_clickable_1.TitleClickable, { ...header, className: (0, classnames_1.default)(styles_module_scss_1.default.titleClickable, header.className) })), !wide && ((0, jsx_runtime_1.jsx)(helperComponents_1.Actions, { actions: state === constants_1.WIDGET_STATE.Error ? actions : hiddenItemsWithKebab, actionsChildren: actionsChildren, wide: wide, state: state }))] }), (0, jsx_runtime_1.jsx)(helperComponents_1.ControlBlock, { actions: actions, actionsChildren: actionsChildren, segmentControl: segmentControl, wide: wide, state: state })] }), (0, jsx_runtime_1.jsx)("div", { className: styles_module_scss_1.default.widgetContent, "data-test-id": constants_1.TEST_IDS.content, children: (0, jsx_runtime_1.jsx)(helperComponents_1.Content, { state: state, wide: wide, loadingState: loadingState, errorState: errorState, children: children }) }), !wide &&
|
|
35
|
+
state !== constants_1.WIDGET_STATE.Error &&
|
|
36
|
+
visibleItemsWithoutKebab.map((action, index) => state === constants_1.WIDGET_STATE.Loading ? ((0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, { loading: true, height: '32px', borderRadius: '8px' }, index)) : ((0, react_1.createElement)(helperComponents_1.ActionView, { ...action, key: index, commonProps: {
|
|
37
|
+
className: styles_module_scss_1.default.button,
|
|
38
|
+
size: 'm',
|
|
39
|
+
fullWidth: true,
|
|
40
|
+
} })))] }));
|
|
41
|
+
}
|
|
42
|
+
exports.Widget = (0, react_2.memo)(WidgetComponent);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Widget';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Widget"), exports);
|