@cloud-ru/ds-site-section 0.0.0-stage → 1.1.1

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.
Files changed (119) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/LICENSE +201 -0
  3. package/README.md +340 -2
  4. package/dist/cjs/components/SectionBasic/SectionBasic.d.ts +42 -0
  5. package/dist/cjs/components/SectionBasic/SectionBasic.js +18 -0
  6. package/dist/cjs/components/SectionBasic/index.d.ts +1 -0
  7. package/dist/cjs/components/SectionBasic/index.js +17 -0
  8. package/dist/cjs/components/index.d.ts +1 -0
  9. package/dist/cjs/components/index.js +17 -0
  10. package/dist/cjs/constants.d.ts +46 -0
  11. package/dist/cjs/constants.js +41 -0
  12. package/dist/cjs/helperComponents/BackgroundLayer/BackgroundLayer.d.ts +8 -0
  13. package/dist/cjs/helperComponents/BackgroundLayer/BackgroundLayer.js +15 -0
  14. package/dist/cjs/helperComponents/BackgroundLayer/index.d.ts +1 -0
  15. package/dist/cjs/helperComponents/BackgroundLayer/index.js +17 -0
  16. package/dist/cjs/helperComponents/BackgroundLayer/styles.module.css +216 -0
  17. package/dist/cjs/helperComponents/BackgroundLayer/utils.d.ts +9 -0
  18. package/dist/cjs/helperComponents/BackgroundLayer/utils.js +12 -0
  19. package/dist/cjs/helperComponents/BgLocal/BgLocal.d.ts +7 -0
  20. package/dist/cjs/helperComponents/BgLocal/BgLocal.js +21 -0
  21. package/dist/cjs/helperComponents/BgLocal/index.d.ts +1 -0
  22. package/dist/cjs/helperComponents/BgLocal/index.js +17 -0
  23. package/dist/cjs/helperComponents/BgLocal/styles.module.css +18 -0
  24. package/dist/cjs/helperComponents/SectionFilter/SectionFilter.d.ts +7 -0
  25. package/dist/cjs/helperComponents/SectionFilter/SectionFilter.js +15 -0
  26. package/dist/cjs/helperComponents/SectionFilter/index.d.ts +1 -0
  27. package/dist/cjs/helperComponents/SectionFilter/index.js +17 -0
  28. package/dist/cjs/helperComponents/SectionFilter/styles.module.css +10 -0
  29. package/dist/cjs/helperComponents/SectionFooter/SectionFooter.d.ts +10 -0
  30. package/dist/cjs/helperComponents/SectionFooter/SectionFooter.js +17 -0
  31. package/dist/cjs/helperComponents/SectionFooter/index.d.ts +1 -0
  32. package/dist/cjs/helperComponents/SectionFooter/index.js +17 -0
  33. package/dist/cjs/helperComponents/SectionFooter/styles.module.css +6 -0
  34. package/dist/cjs/helperComponents/SectionWrapper/SectionWrapper.d.ts +22 -0
  35. package/dist/cjs/helperComponents/SectionWrapper/SectionWrapper.js +25 -0
  36. package/dist/cjs/helperComponents/SectionWrapper/index.d.ts +1 -0
  37. package/dist/cjs/helperComponents/SectionWrapper/index.js +17 -0
  38. package/dist/cjs/helperComponents/SectionWrapper/styles.module.css +101 -0
  39. package/dist/cjs/helperComponents/index.d.ts +5 -0
  40. package/dist/cjs/helperComponents/index.js +21 -0
  41. package/dist/cjs/index.d.ts +4 -0
  42. package/dist/cjs/index.js +20 -0
  43. package/dist/cjs/locale/index.d.ts +19 -0
  44. package/dist/cjs/locale/index.js +10 -0
  45. package/dist/cjs/package.json +3 -0
  46. package/dist/cjs/style.css +351 -0
  47. package/dist/cjs/types.d.ts +44 -0
  48. package/dist/cjs/types.js +2 -0
  49. package/dist/esm/components/SectionBasic/SectionBasic.d.ts +42 -0
  50. package/dist/esm/components/SectionBasic/SectionBasic.js +15 -0
  51. package/dist/esm/components/SectionBasic/index.d.ts +1 -0
  52. package/dist/esm/components/SectionBasic/index.js +1 -0
  53. package/dist/esm/components/index.d.ts +1 -0
  54. package/dist/esm/components/index.js +1 -0
  55. package/dist/esm/constants.d.ts +46 -0
  56. package/dist/esm/constants.js +38 -0
  57. package/dist/esm/helperComponents/BackgroundLayer/BackgroundLayer.d.ts +8 -0
  58. package/dist/esm/helperComponents/BackgroundLayer/BackgroundLayer.js +9 -0
  59. package/dist/esm/helperComponents/BackgroundLayer/index.d.ts +1 -0
  60. package/dist/esm/helperComponents/BackgroundLayer/index.js +1 -0
  61. package/dist/esm/helperComponents/BackgroundLayer/styles.module.css +216 -0
  62. package/dist/esm/helperComponents/BackgroundLayer/utils.d.ts +9 -0
  63. package/dist/esm/helperComponents/BackgroundLayer/utils.js +9 -0
  64. package/dist/esm/helperComponents/BgLocal/BgLocal.d.ts +7 -0
  65. package/dist/esm/helperComponents/BgLocal/BgLocal.js +15 -0
  66. package/dist/esm/helperComponents/BgLocal/index.d.ts +1 -0
  67. package/dist/esm/helperComponents/BgLocal/index.js +1 -0
  68. package/dist/esm/helperComponents/BgLocal/styles.module.css +18 -0
  69. package/dist/esm/helperComponents/SectionFilter/SectionFilter.d.ts +7 -0
  70. package/dist/esm/helperComponents/SectionFilter/SectionFilter.js +9 -0
  71. package/dist/esm/helperComponents/SectionFilter/index.d.ts +1 -0
  72. package/dist/esm/helperComponents/SectionFilter/index.js +1 -0
  73. package/dist/esm/helperComponents/SectionFilter/styles.module.css +10 -0
  74. package/dist/esm/helperComponents/SectionFooter/SectionFooter.d.ts +10 -0
  75. package/dist/esm/helperComponents/SectionFooter/SectionFooter.js +11 -0
  76. package/dist/esm/helperComponents/SectionFooter/index.d.ts +1 -0
  77. package/dist/esm/helperComponents/SectionFooter/index.js +1 -0
  78. package/dist/esm/helperComponents/SectionFooter/styles.module.css +6 -0
  79. package/dist/esm/helperComponents/SectionWrapper/SectionWrapper.d.ts +22 -0
  80. package/dist/esm/helperComponents/SectionWrapper/SectionWrapper.js +19 -0
  81. package/dist/esm/helperComponents/SectionWrapper/index.d.ts +1 -0
  82. package/dist/esm/helperComponents/SectionWrapper/index.js +1 -0
  83. package/dist/esm/helperComponents/SectionWrapper/styles.module.css +101 -0
  84. package/dist/esm/helperComponents/index.d.ts +5 -0
  85. package/dist/esm/helperComponents/index.js +5 -0
  86. package/dist/esm/index.d.ts +4 -0
  87. package/dist/esm/index.js +4 -0
  88. package/dist/esm/locale/index.d.ts +19 -0
  89. package/dist/esm/locale/index.js +7 -0
  90. package/dist/esm/style.css +351 -0
  91. package/dist/esm/types.d.ts +44 -0
  92. package/dist/esm/types.js +1 -0
  93. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  94. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  95. package/package.json +54 -3
  96. package/src/components/SectionBasic/SectionBasic.tsx +110 -0
  97. package/src/components/SectionBasic/index.ts +1 -0
  98. package/src/components/index.ts +1 -0
  99. package/src/constants.ts +43 -0
  100. package/src/helperComponents/BackgroundLayer/BackgroundLayer.tsx +27 -0
  101. package/src/helperComponents/BackgroundLayer/index.ts +1 -0
  102. package/src/helperComponents/BackgroundLayer/styles.module.scss +16 -0
  103. package/src/helperComponents/BackgroundLayer/utils.ts +13 -0
  104. package/src/helperComponents/BgLocal/BgLocal.tsx +26 -0
  105. package/src/helperComponents/BgLocal/index.ts +1 -0
  106. package/src/helperComponents/BgLocal/styles.module.scss +22 -0
  107. package/src/helperComponents/SectionFilter/SectionFilter.tsx +21 -0
  108. package/src/helperComponents/SectionFilter/index.ts +1 -0
  109. package/src/helperComponents/SectionFilter/styles.module.scss +13 -0
  110. package/src/helperComponents/SectionFooter/SectionFooter.tsx +36 -0
  111. package/src/helperComponents/SectionFooter/index.ts +1 -0
  112. package/src/helperComponents/SectionFooter/styles.module.scss +8 -0
  113. package/src/helperComponents/SectionWrapper/SectionWrapper.tsx +62 -0
  114. package/src/helperComponents/SectionWrapper/index.ts +1 -0
  115. package/src/helperComponents/SectionWrapper/styles.module.scss +122 -0
  116. package/src/helperComponents/index.ts +5 -0
  117. package/src/index.ts +4 -0
  118. package/src/locale/index.ts +11 -0
  119. package/src/types.ts +55 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.1.1 (2026-11-12)
7
+
8
+ **Note:** Version bump only for package @ds/site-section
9
+
10
+ # 1.1.0 (2026-11-12)
11
+
12
+ ### Features
13
+
14
+ - **SITE-12373:** add @ds/site-section package with SectionBasic ([ce57287](https://github.com/cloud-ru-tech/snack-v2/commit/ce572877d77ea595df43db0b9d9820a7be87c571))
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 CHANGED
@@ -1,3 +1,341 @@
1
- # Temporary Holding Version
1
+ # SectionBasic
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `@cloud-ru/ds-site-section` — Базовая секция сайта — заголовок, вкладки, фильтры, произвольный контент и футер с пагинацией и кнопкой «Показать еще».
4
+
5
+ Базовая секция страницы сайта. Задаёт фоны, отступы и вертикальный ритм, собирает типовые блоки по данным: заголовок, вкладки, фильтры и футер. Содержимое между фильтрами и футером передаётся через `children`.
6
+
7
+ ## Когда использовать
8
+
9
+ - Типовой блок лендинга или каталога: заголовок, контент, «Показать еще».
10
+ - Список с переключением вкладками и фильтрацией по полям.
11
+
12
+ Когда **не** нужен:
13
+
14
+ - Вёрстка внутри приложения консоли:
15
+ - используйте компоненты `@cloud-ru/ds-uikit-product-*`.
16
+
17
+ ## Анатомия
18
+
19
+ У секции два фона:
20
+
21
+ - внешний — во всю ширину экрана;
22
+ - блок — по ширине `container`, по центру внешнего фона. В блоке лежит всё содержимое.
23
+
24
+ Блоки содержимого сверху вниз, каждый рендерится только при наличии данных:
25
+
26
+ - Заголовок — `SectionTitle` из `@cloud-ru/ds-site-section-title`, тип `descriptionRight`: `description` справа от `title` на desktop и под ним на tablet/mobile. Строки могут содержать HTML-разметку (рендерятся через `@cloud-ru/ds-site-rich-text`, который очищает HTML от XSS).
27
+ - Вкладки — `tabBarItems`, рендерятся как `TabsSegmented` из `@cloud-ru/ds-site-tabs-segmented`. Выбор:
28
+ - без `tabBarValue` хранится внутри секции, изначально — `defaultTabBarValue` или первая доступная вкладка;
29
+ - с `tabBarValue` + `onTabBarChange` управляется снаружи, например из параметра URL `?tab=ai`.
30
+ - Фильтры — `filterItems`, поля `FieldSelect` размера `l`. Делят ширину поровну и переносятся на новую строку.
31
+ - Контент — `children`.
32
+ - Футер — `pagination` и `moreButton`. Текст кнопки по умолчанию — «Показать еще» из локали пакета.
33
+
34
+ ### Container (обязательный)
35
+
36
+ Временная настройка на период редизайна: задаётся явно в каждом месте использования.
37
+
38
+ - `new` — целевой вид: блок до 1824 px, отступы меньше.
39
+ - `old` — визуальная совместимость со страницами до редизайна: блок до 1408 px (контент 1216 px), отступы как в прежней секции.
40
+
41
+ ### Фоны
42
+
43
+ У секции два слоя, у каждого своя тема и заливка:
44
+
45
+ - `background` — внешний слой во всю ширину экрана (Figma `sectionBackground`):
46
+ - `theme` — тема слоя. Не задана — тема страницы.
47
+ - `fill` — заливка из `SECTION_BACKGROUND_FILL` (default `neutralBackground`).
48
+ - `containerBackground` — блок по ширине `container`, в нём всё содержимое (Figma `contentWrapper` + `bgLocal`):
49
+ - `theme` — тема блока и содержимого. Не задана — тема внешнего слоя.
50
+ - `type` — вид заливки (default `bg`).
51
+
52
+ `theme` принимает те же оси, что `ChildThemeProvider` из `@cloud-ru/ds-theme` (`colorScheme`, `brand` и другие), поэтому блок может быть тёмным на светлом фоне и наоборот.
53
+
54
+ Заливка блока по `type`:
55
+
56
+ - `bg` — подложка из `SECTION_BACKGROUND_FILL`, поле `fill` (default `neutralBackground`).
57
+ - `image` — картинка во весь блок, поле `src`. Картинка декоративная и кадрируется по размеру блока.
58
+ - `accent` — акцентный цвет бренда.
59
+
60
+ Значения `SECTION_BACKGROUND_FILL`:
61
+
62
+ - `neutralBackground` — нейтральный фон страницы.
63
+ - `neutralBackground1Level` — светлая нейтральная подложка.
64
+ - `primaryBackground`, `redBackground`, `orangeBackground`, `yellowBackground`, `greenBackground`, `blueBackground`, `violetBackground`, `pinkBackground` — цветные подложки.
65
+ - `transparent`, `decorTransparent` — прозрачные подложки.
66
+
67
+ ### Тег заголовка (default `h2`)
68
+
69
+ `titleTag` — `h1`, `h2`, `h3` или `h4`.
70
+
71
+ ## Установка
72
+
73
+ ```bash
74
+ pnpm add @cloud-ru/ds-site-section
75
+ ```
76
+
77
+ ```ts
78
+ import { SectionBasic } from '@cloud-ru/ds-site-section'
79
+ ```
80
+
81
+ ## Примеры использования
82
+
83
+ ### Заголовок и контент
84
+
85
+ title, description и children
86
+
87
+ ```tsx
88
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
89
+
90
+ export function TitleAndContent() {
91
+ return (
92
+ <SectionBasic container='new' title='Облачные сервисы' description='Инфраструктура, данные и AI в одном облаке.'>
93
+ <p>Произвольный контент секции: карточки, сетка, карусель.</p>
94
+ </SectionBasic>
95
+ );
96
+ }
97
+ ```
98
+
99
+ ### Вкладки и фильтры
100
+
101
+ tabBarItems и filterItems
102
+
103
+ ```tsx
104
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
105
+ import { useState } from 'react';
106
+
107
+ const TABS = [
108
+ { value: 'infrastructure', label: 'Создание инфраструктуры' },
109
+ { value: 'data', label: 'Данные' },
110
+ { value: 'ai', label: 'Искусственный интеллект' },
111
+ ];
112
+
113
+ const ITEMS = [
114
+ { id: 'all', content: { label: 'Все' } },
115
+ { id: 'popular', content: { label: 'Популярные' } },
116
+ { id: 'new', content: { label: 'Новые' } },
117
+ ];
118
+
119
+ export function TabsAndFilters() {
120
+ const [category, setCategory] = useState('all');
121
+
122
+ return (
123
+ <SectionBasic
124
+ container='new'
125
+ title='Каталог'
126
+ tabBarItems={TABS}
127
+ filterItems={[
128
+ {
129
+ id: 'category',
130
+ label: 'Категория',
131
+ items: ITEMS,
132
+ value: category,
133
+ onChange: value => setCategory(String(value ?? 'all')),
134
+ },
135
+ ]}
136
+ >
137
+ <p>Выбрана категория: {category}</p>
138
+ </SectionBasic>
139
+ );
140
+ }
141
+ ```
142
+
143
+ ### Вкладка из URL
144
+
145
+ tabBarValue и onTabBarChange
146
+
147
+ ```tsx
148
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
149
+ import { useState } from 'react';
150
+
151
+ const TABS = [
152
+ { value: 'infrastructure', label: 'Создание инфраструктуры' },
153
+ { value: 'data', label: 'Данные' },
154
+ { value: 'ai', label: 'Искусственный интеллект' },
155
+ ];
156
+
157
+ export function ControlledTabs() {
158
+ // На странице начальное значение берётся из параметра URL, например `/catalog?tab=ai`.
159
+ const [tab, setTab] = useState('ai');
160
+
161
+ return (
162
+ <SectionBasic container='new' title='Каталог' tabBarItems={TABS} tabBarValue={tab} onTabBarChange={setTab}>
163
+ <p>Выбрана вкладка: {tab}</p>
164
+ </SectionBasic>
165
+ );
166
+ }
167
+ ```
168
+
169
+ ### Футер
170
+
171
+ pagination и moreButton
172
+
173
+ ```tsx
174
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
175
+ import { useState } from 'react';
176
+
177
+ export function Footer() {
178
+ const [page, setPage] = useState(1);
179
+ const [shown, setShown] = useState(3);
180
+
181
+ return (
182
+ <SectionBasic
183
+ container='new'
184
+ title='Новости'
185
+ pagination={{ total: 5, page, onChange: setPage }}
186
+ moreButton={{ onClick: () => setShown(count => count + 3) }}
187
+ >
188
+ <p>
189
+ Страница {page}, показано новостей: {shown}
190
+ </p>
191
+ </SectionBasic>
192
+ );
193
+ }
194
+ ```
195
+
196
+ ### Тёмный блок на светлом фоне
197
+
198
+ background.theme и containerBackground.theme
199
+
200
+ ```tsx
201
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
202
+
203
+ export function ContainerTheme() {
204
+ return (
205
+ <SectionBasic
206
+ container='new'
207
+ background={{ theme: { colorScheme: 'light' } }}
208
+ containerBackground={{ type: 'bg', theme: { colorScheme: 'dark' } }}
209
+ title='Облачные сервисы'
210
+ description='Блок по ширине container тёмный, внешний фон остаётся светлым.'
211
+ tabBarItems={[
212
+ { value: 'infrastructure', label: 'Инфраструктура' },
213
+ { value: 'data', label: 'Данные' },
214
+ ]}
215
+ >
216
+ <p>Контент секции</p>
217
+ </SectionBasic>
218
+ );
219
+ }
220
+ ```
221
+
222
+ ### Акцентный блок
223
+
224
+ containerBackground={{ type: 'accent' }}
225
+
226
+ ```tsx
227
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
228
+
229
+ export function AccentContainer() {
230
+ return (
231
+ <SectionBasic
232
+ container='new'
233
+ containerBackground={{ type: 'accent' }}
234
+ title='Облачные сервисы'
235
+ description='Блок по ширине container залит акцентным цветом бренда.'
236
+ >
237
+ <p>Контент секции</p>
238
+ </SectionBasic>
239
+ );
240
+ }
241
+ ```
242
+
243
+ ### Заливки слоёв
244
+
245
+ background.fill и containerBackground.fill
246
+
247
+ ```tsx
248
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
249
+
250
+ export function BackgroundFill() {
251
+ return (
252
+ <SectionBasic
253
+ container='new'
254
+ background={{ fill: 'blueBackground' }}
255
+ containerBackground={{ type: 'bg', fill: 'neutralBackground1Level' }}
256
+ title='Облачные сервисы'
257
+ description='Голубой внешний фон и светлая подложка блока.'
258
+ >
259
+ <p>Контент секции</p>
260
+ </SectionBasic>
261
+ );
262
+ }
263
+ ```
264
+
265
+ ### Совместимость со страницами до редизайна
266
+
267
+ container='old'
268
+
269
+ ```tsx
270
+ import { SectionBasic } from '@cloud-ru/ds-site-section';
271
+
272
+ export function OldContainer() {
273
+ return (
274
+ <SectionBasic container='old' title='Облачные сервисы' description='Отступы и ширина страниц до редизайна.'>
275
+ <p>Контент секции</p>
276
+ </SectionBasic>
277
+ );
278
+ }
279
+ ```
280
+
281
+ ## Props
282
+
283
+ **SectionBasicProps**
284
+
285
+ | Prop | Type | Default | Description |
286
+ |------|------|---------|-------------|
287
+ | `background` | `SectionBackground` | — | Внешний слой фона во всю ширину экрана (Figma `sectionBackground`): тема и заливка. |
288
+ | `children` | `ReactNode` | — | Содержимое секции между фильтрами и футером. |
289
+ | `className` | `string` | — | CSS-класс корня. |
290
+ | `container` | `"new"` \| `"old"` | — | Ширина и отступы секции: `new` — целевой вид, `old` — совместимость со страницами до редизайна. <br/> Временная настройка на период редизайна, задаётся явно. |
291
+ | `containerBackground` | `SectionContainerBackground` | `{ type: SECTION_CONTAINER_BACKGROUND_TYPE.Bg }` | Блок по ширине `container` (Figma `contentWrapper` + `bgLocal`): тема блока и всего содержимого и заливка — <br/> подложка, картинка или акцентный цвет. Тема не задана — тема внешнего слоя. |
292
+ | `data-test-id` | `string` | — | |
293
+ | `defaultTabBarValue` | `string` | — | Изначально выбранная вкладка (uncontrolled). |
294
+ | `description` | `string` | — | Описание. Строка может содержать HTML-разметку. |
295
+ | `filterItems` | `CustomOptionProps` \| `DroplistListProps` \| `DroplistMobileSlots` \| `EmptyState` \| `FieldSelectDecoratorProps` \| `FieldSelectProps` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | Поля-фильтры под вкладками. Рендерятся как `FieldSelect` размера `l`. |
296
+ | `id` | `string` | — | HTML-атрибут `id` секции — якорь для навигации по странице. |
297
+ | `moreButton` | `SectionMoreButton` | — | Кнопка «Показать еще» в футере. |
298
+ | `onTabBarChange` | `((value: string) => void)` | — | Колбэк выбора вкладки: значение `value` выбранного элемента `tabBarItems`. |
299
+ | `pagination` | `PaginationProps` | — | Пагинация в футере. |
300
+ | `tabBarItems` | `TabsSegmentedItem` | — | Вкладки под заголовком. Без `tabBarValue` / `defaultTabBarValue` изначально выбрана первая доступная. |
301
+ | `tabBarValue` | `string` | — | Выбранная вкладка (controlled), например из параметра URL `?tab=ai`. |
302
+ | `title` | `string` | — | Заголовок. Строка может содержать строчную HTML-разметку (`a`, `strong`, `em`, `br`). |
303
+ | `titleTag` | `"h1"` \| `"h2"` \| `"h3"` \| `"h4"` | — | Тег заголовка. |
304
+
305
+ #### Related types
306
+
307
+ **SectionBackground**
308
+
309
+ | Prop | Type | Default | Description |
310
+ |------|------|---------|-------------|
311
+ | `fill` | `"blueBackground"` \| `"decorTransparent"` \| `"greenBackground"` \| `"neutralBackground"` \| `"neutralBackground1Level"` \| `"orangeBackground"` \| `"pinkBackground"` \| `"primaryBackground"` \| `"redBackground"` \| `"transparent"` \| `"violetBackground"` \| `"yellowBackground"` | — | Заливка. По умолчанию `neutralBackground`. |
312
+ | `theme` | `ThemeAppearance` | — | Тема слоя. Не задана — тема страницы. |
313
+
314
+ - `SectionBackgroundFill` = `"blueBackground"` \| `"decorTransparent"` \| `"greenBackground"` \| `"neutralBackground"` \| `"neutralBackground1Level"` \| `"orangeBackground"` \| `"pinkBackground"` \| `"primaryBackground"` \| `"redBackground"` \| `"transparent"` \| `"violetBackground"` \| `"yellowBackground"`
315
+
316
+ - `SectionContainer` = `"new"` \| `"old"`
317
+
318
+ - `SectionContainerBackground` = `SectionContainerFill & { theme?: Partial<ThemeAppearance>; }`
319
+
320
+ **SectionMoreButton**
321
+
322
+ | Prop | Type | Default | Description |
323
+ |------|------|---------|-------------|
324
+ | `data-test-id` | `string \| undefined` | — | Тестовый id кнопки. По умолчанию — `TEST_IDS.moreButton`. |
325
+ | `href` | `string \| undefined` | — | Ссылка. Если задана, кнопка рендерится как `<a>`. |
326
+ | `label` | `string \| undefined` | — | Текст кнопки. По умолчанию — «Показать еще» из локали пакета. |
327
+ | `onClick` | `((event: MouseEvent<HTMLElement>) => void) \| undefined` | — | Колбэк клика. |
328
+
329
+ ## Адаптивность
330
+
331
+ Раскладка читается из `AdaptiveProvider` (`@cloud-ru/ds-adaptive`), пропа `layoutType` нет.
332
+
333
+ Отступы по раскладке и `container` (внешние — вокруг блока, внутренние — внутри блока, по вертикали / по горизонтали):
334
+
335
+ | Раскладка | `new`: внешние / внутренние | `old`: внешние / внутренние | Шаг между блоками |
336
+ |---|---|---|---|
337
+ | `desktop`, `desktopSmall` | 24 / 16 и 48 / 32 | 0 / 16 и 56 / 96 | 40 |
338
+ | `tablet` | 16 / 8 и 24 / 16 | 0 / 16 и 40 / 24 | 32 |
339
+ | `mobile` | 16 / 0 и 24 / 16 | 0 / 0 и 32 / 16 | 24 |
340
+
341
+ Вкладки на desktop — размер `l`, на tablet и mobile — `m`. Типографика заголовка — в документации `@cloud-ru/ds-site-section-title`.
@@ -0,0 +1,42 @@
1
+ import { FieldSelectProps } from '@cloud-ru/ds-fields';
2
+ import { PaginationProps } from '@cloud-ru/ds-pagination';
3
+ import { SectionTitleProps } from '@cloud-ru/ds-site-section-title';
4
+ import { TabsSegmentedItem } from '@cloud-ru/ds-site-tabs-segmented';
5
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
6
+ import { ReactNode } from 'react';
7
+ import { SectionBackground, SectionContainer, SectionContainerBackground, SectionMoreButton } from '../../types';
8
+ export type SectionBasicProps = WithSupportProps<Pick<SectionTitleProps, 'title' | 'description' | 'titleTag'> & {
9
+ /**
10
+ * Ширина и отступы секции: `new` — целевой вид, `old` — совместимость со страницами до редизайна.
11
+ * Временная настройка на период редизайна, задаётся явно.
12
+ */
13
+ container: SectionContainer;
14
+ /** Внешний слой фона во всю ширину экрана (Figma `sectionBackground`): тема и заливка. */
15
+ background?: SectionBackground;
16
+ /**
17
+ * Блок по ширине `container` (Figma `contentWrapper` + `bgLocal`): тема блока и всего содержимого и заливка —
18
+ * подложка, картинка или акцентный цвет. Тема не задана — тема внешнего слоя.
19
+ */
20
+ containerBackground?: SectionContainerBackground;
21
+ /** HTML-атрибут `id` секции — якорь для навигации по странице. */
22
+ id?: string;
23
+ /** Содержимое секции между фильтрами и футером. */
24
+ children?: ReactNode;
25
+ /** Вкладки под заголовком. Без `tabBarValue` / `defaultTabBarValue` изначально выбрана первая доступная. */
26
+ tabBarItems?: TabsSegmentedItem[];
27
+ /** Выбранная вкладка (controlled), например из параметра URL `?tab=ai`. */
28
+ tabBarValue?: string;
29
+ /** Изначально выбранная вкладка (uncontrolled). */
30
+ defaultTabBarValue?: string;
31
+ /** Колбэк выбора вкладки: значение `value` выбранного элемента `tabBarItems`. */
32
+ onTabBarChange?(value: string): void;
33
+ /** Поля-фильтры под вкладками. Рендерятся как `FieldSelect` размера `l`. */
34
+ filterItems?: FieldSelectProps[];
35
+ /** Пагинация в футере. */
36
+ pagination?: PaginationProps;
37
+ /** Кнопка «Показать еще» в футере. */
38
+ moreButton?: SectionMoreButton;
39
+ /** CSS-класс корня. */
40
+ className?: string;
41
+ }>;
42
+ export declare function SectionBasic({ container, background, containerBackground, id, children, title, description, titleTag, tabBarItems, tabBarValue, defaultTabBarValue, onTabBarChange, filterItems, pagination, moreButton, className, ...rest }: SectionBasicProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SectionBasic = SectionBasic;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const adaptive_1 = require("@cloud-ru/ds-adaptive");
6
+ const site_section_title_1 = require("@cloud-ru/ds-site-section-title");
7
+ const site_tabs_segmented_1 = require("@cloud-ru/ds-site-tabs-segmented");
8
+ const constants_1 = require("../../constants");
9
+ const helperComponents_1 = require("../../helperComponents");
10
+ const DEFAULT_CONTAINER_BACKGROUND = { type: constants_1.SECTION_CONTAINER_BACKGROUND_TYPE.Bg };
11
+ function SectionBasic({ container, background, containerBackground = DEFAULT_CONTAINER_BACKGROUND, id, children, title, description, titleTag, tabBarItems, tabBarValue, defaultTabBarValue, onTabBarChange, filterItems, pagination, moreButton, className, ...rest }) {
12
+ const { layoutType } = (0, adaptive_1.useAdaptiveLayout)();
13
+ const hasTitle = Boolean(title || description);
14
+ const hasFooter = Boolean(pagination || moreButton);
15
+ // Figma (container=new): на desktop вкладки size=l, на tablet и mobile — size=m. Для old так же.
16
+ const tabsSize = layoutType === adaptive_1.LAYOUT_TYPE.Desktop || layoutType === adaptive_1.LAYOUT_TYPE.DesktopSmall ? site_tabs_segmented_1.SIZE.L : site_tabs_segmented_1.SIZE.M;
17
+ return ((0, jsx_runtime_1.jsxs)(helperComponents_1.SectionWrapper, { id: id, container: container, background: background, containerBackground: containerBackground, className: className, "data-test-id": constants_1.TEST_IDS.root, ...rest, children: [hasTitle && ((0, jsx_runtime_1.jsx)(site_section_title_1.SectionTitle, { title: title, description: description, titleTag: titleTag, "data-test-id": constants_1.TEST_IDS.sectionTitle })), tabBarItems && tabBarItems.length > 0 && ((0, jsx_runtime_1.jsx)(site_tabs_segmented_1.TabsSegmented, { items: tabBarItems, value: tabBarValue, defaultValue: defaultTabBarValue, onChange: onTabBarChange, size: tabsSize, "data-test-id": constants_1.TEST_IDS.tabs })), filterItems && filterItems.length > 0 && (0, jsx_runtime_1.jsx)(helperComponents_1.SectionFilter, { items: filterItems }), children, hasFooter && (0, jsx_runtime_1.jsx)(helperComponents_1.SectionFooter, { pagination: pagination, moreButton: moreButton })] }));
18
+ }
@@ -0,0 +1 @@
1
+ export * from './SectionBasic';
@@ -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("./SectionBasic"), exports);
@@ -0,0 +1 @@
1
+ export * from './SectionBasic';