@cloud-ru/ds-toolbar 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.
Files changed (261) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +201 -0
  3. package/README.md +301 -0
  4. package/dist/cjs/components/Toolbar/Toolbar.d.ts +3 -0
  5. package/dist/cjs/components/Toolbar/Toolbar.js +51 -0
  6. package/dist/cjs/components/Toolbar/helpers.d.ts +12 -0
  7. package/dist/cjs/components/Toolbar/helpers.js +27 -0
  8. package/dist/cjs/components/Toolbar/hooks/index.d.ts +2 -0
  9. package/dist/cjs/components/Toolbar/hooks/index.js +18 -0
  10. package/dist/cjs/components/Toolbar/hooks/useFilters.d.ts +12 -0
  11. package/dist/cjs/components/Toolbar/hooks/useFilters.js +55 -0
  12. package/dist/cjs/components/Toolbar/hooks/usePersistState/index.d.ts +1 -0
  13. package/dist/cjs/components/Toolbar/hooks/usePersistState/index.js +17 -0
  14. package/dist/cjs/components/Toolbar/hooks/usePersistState/usePersistState.d.ts +9 -0
  15. package/dist/cjs/components/Toolbar/hooks/usePersistState/usePersistState.js +72 -0
  16. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/index.d.ts +3 -0
  17. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/index.js +19 -0
  18. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/isDateString.d.ts +9 -0
  19. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/isDateString.js +45 -0
  20. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/parser.d.ts +4 -0
  21. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/parser.js +46 -0
  22. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +11 -0
  23. package/dist/cjs/components/Toolbar/hooks/usePersistState/utils/serializer.js +41 -0
  24. package/dist/cjs/components/Toolbar/index.d.ts +3 -0
  25. package/dist/cjs/components/Toolbar/index.js +19 -0
  26. package/dist/cjs/components/Toolbar/styles.module.css +297 -0
  27. package/dist/cjs/components/Toolbar/types.d.ts +80 -0
  28. package/dist/cjs/components/Toolbar/types.js +2 -0
  29. package/dist/cjs/components/Toolbar/typesUtils.d.ts +12 -0
  30. package/dist/cjs/components/Toolbar/typesUtils.js +2 -0
  31. package/dist/cjs/components/Toolbar/utils/buildMobileOverflowActions.d.ts +10 -0
  32. package/dist/cjs/components/Toolbar/utils/buildMobileOverflowActions.js +84 -0
  33. package/dist/cjs/components/Toolbar/utils/toolbarAfterOverflow.d.ts +2 -0
  34. package/dist/cjs/components/Toolbar/utils/toolbarAfterOverflow.js +5 -0
  35. package/dist/cjs/components/index.d.ts +4 -0
  36. package/dist/cjs/components/index.js +23 -0
  37. package/dist/cjs/helperComponents/BulkActions/BulkActions.d.ts +2 -0
  38. package/dist/cjs/helperComponents/BulkActions/BulkActions.js +20 -0
  39. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.d.ts +8 -0
  40. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.js +20 -0
  41. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/index.d.ts +1 -0
  42. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/index.js +17 -0
  43. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.css +3 -0
  44. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.d.ts +17 -0
  45. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +39 -0
  46. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/index.d.ts +1 -0
  47. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/index.js +17 -0
  48. package/dist/cjs/helperComponents/BulkActions/components/BulkActionsControls/styles.module.css +39 -0
  49. package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.d.ts +14 -0
  50. package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +27 -0
  51. package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.d.ts +1 -0
  52. package/dist/cjs/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.js +17 -0
  53. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.d.ts +9 -0
  54. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +21 -0
  55. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/index.d.ts +1 -0
  56. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/index.js +17 -0
  57. package/dist/cjs/helperComponents/BulkActions/components/SelectionLabel/styles.module.css +40 -0
  58. package/dist/cjs/helperComponents/BulkActions/components/index.d.ts +4 -0
  59. package/dist/cjs/helperComponents/BulkActions/components/index.js +20 -0
  60. package/dist/cjs/helperComponents/BulkActions/index.d.ts +2 -0
  61. package/dist/cjs/helperComponents/BulkActions/index.js +18 -0
  62. package/dist/cjs/helperComponents/BulkActions/styles.module.css +9 -0
  63. package/dist/cjs/helperComponents/BulkActions/types.d.ts +31 -0
  64. package/dist/cjs/helperComponents/BulkActions/types.js +2 -0
  65. package/dist/cjs/helperComponents/BulkActions/utils.d.ts +15 -0
  66. package/dist/cjs/helperComponents/BulkActions/utils.js +26 -0
  67. package/dist/cjs/helperComponents/DataView/DataView.d.ts +2 -0
  68. package/dist/cjs/helperComponents/DataView/DataView.js +9 -0
  69. package/dist/cjs/helperComponents/DataView/constants.d.ts +9 -0
  70. package/dist/cjs/helperComponents/DataView/constants.js +13 -0
  71. package/dist/cjs/helperComponents/DataView/index.d.ts +3 -0
  72. package/dist/cjs/helperComponents/DataView/index.js +19 -0
  73. package/dist/cjs/helperComponents/DataView/types.d.ts +12 -0
  74. package/dist/cjs/helperComponents/DataView/types.js +2 -0
  75. package/dist/cjs/helperComponents/FilterButton/FilterButton.d.ts +12 -0
  76. package/dist/cjs/helperComponents/FilterButton/FilterButton.js +17 -0
  77. package/dist/cjs/helperComponents/FilterButton/index.d.ts +1 -0
  78. package/dist/cjs/helperComponents/FilterButton/index.js +17 -0
  79. package/dist/cjs/helperComponents/FilterButton/styles.module.css +5 -0
  80. package/dist/cjs/helperComponents/MoreActions/MoreActions.d.ts +13 -0
  81. package/dist/cjs/helperComponents/MoreActions/MoreActions.js +35 -0
  82. package/dist/cjs/helperComponents/MoreActions/index.d.ts +1 -0
  83. package/dist/cjs/helperComponents/MoreActions/index.js +17 -0
  84. package/dist/cjs/helperComponents/MoreActions/styles.module.css +5 -0
  85. package/dist/cjs/helperComponents/Search/ToolbarSearch.d.ts +9 -0
  86. package/dist/cjs/helperComponents/Search/ToolbarSearch.js +19 -0
  87. package/dist/cjs/helperComponents/Search/index.d.ts +1 -0
  88. package/dist/cjs/helperComponents/Search/index.js +17 -0
  89. package/dist/cjs/helperComponents/Search/styles.module.css +25 -0
  90. package/dist/cjs/helperComponents/Separator/Separator.d.ts +1 -0
  91. package/dist/cjs/helperComponents/Separator/Separator.js +11 -0
  92. package/dist/cjs/helperComponents/Separator/index.d.ts +1 -0
  93. package/dist/cjs/helperComponents/Separator/index.js +17 -0
  94. package/dist/cjs/helperComponents/Separator/styles.module.css +14 -0
  95. package/dist/cjs/helperComponents/index.d.ts +6 -0
  96. package/dist/cjs/helperComponents/index.js +22 -0
  97. package/dist/cjs/index.d.ts +5 -0
  98. package/dist/cjs/index.js +24 -0
  99. package/dist/cjs/locale/index.d.ts +55 -0
  100. package/dist/cjs/locale/index.js +32 -0
  101. package/dist/cjs/package.json +3 -0
  102. package/dist/cjs/style.css +437 -0
  103. package/dist/cjs/testIds.d.ts +24 -0
  104. package/dist/cjs/testIds.js +27 -0
  105. package/dist/esm/components/Toolbar/Toolbar.d.ts +3 -0
  106. package/dist/esm/components/Toolbar/Toolbar.js +45 -0
  107. package/dist/esm/components/Toolbar/helpers.d.ts +12 -0
  108. package/dist/esm/components/Toolbar/helpers.js +23 -0
  109. package/dist/esm/components/Toolbar/hooks/index.d.ts +2 -0
  110. package/dist/esm/components/Toolbar/hooks/index.js +2 -0
  111. package/dist/esm/components/Toolbar/hooks/useFilters.d.ts +12 -0
  112. package/dist/esm/components/Toolbar/hooks/useFilters.js +49 -0
  113. package/dist/esm/components/Toolbar/hooks/usePersistState/index.d.ts +1 -0
  114. package/dist/esm/components/Toolbar/hooks/usePersistState/index.js +1 -0
  115. package/dist/esm/components/Toolbar/hooks/usePersistState/usePersistState.d.ts +9 -0
  116. package/dist/esm/components/Toolbar/hooks/usePersistState/usePersistState.js +69 -0
  117. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/index.d.ts +3 -0
  118. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/index.js +3 -0
  119. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/isDateString.d.ts +9 -0
  120. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/isDateString.js +42 -0
  121. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/parser.d.ts +4 -0
  122. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/parser.js +42 -0
  123. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.d.ts +11 -0
  124. package/dist/esm/components/Toolbar/hooks/usePersistState/utils/serializer.js +37 -0
  125. package/dist/esm/components/Toolbar/index.d.ts +3 -0
  126. package/dist/esm/components/Toolbar/index.js +3 -0
  127. package/dist/esm/components/Toolbar/styles.module.css +297 -0
  128. package/dist/esm/components/Toolbar/types.d.ts +80 -0
  129. package/dist/esm/components/Toolbar/types.js +1 -0
  130. package/dist/esm/components/Toolbar/typesUtils.d.ts +12 -0
  131. package/dist/esm/components/Toolbar/typesUtils.js +1 -0
  132. package/dist/esm/components/Toolbar/utils/buildMobileOverflowActions.d.ts +10 -0
  133. package/dist/esm/components/Toolbar/utils/buildMobileOverflowActions.js +81 -0
  134. package/dist/esm/components/Toolbar/utils/toolbarAfterOverflow.d.ts +2 -0
  135. package/dist/esm/components/Toolbar/utils/toolbarAfterOverflow.js +2 -0
  136. package/dist/esm/components/index.d.ts +4 -0
  137. package/dist/esm/components/index.js +3 -0
  138. package/dist/esm/helperComponents/BulkActions/BulkActions.d.ts +2 -0
  139. package/dist/esm/helperComponents/BulkActions/BulkActions.js +14 -0
  140. package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.d.ts +8 -0
  141. package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.js +14 -0
  142. package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/index.d.ts +1 -0
  143. package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/index.js +1 -0
  144. package/dist/esm/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.css +3 -0
  145. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.d.ts +17 -0
  146. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.js +33 -0
  147. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/index.d.ts +1 -0
  148. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/index.js +1 -0
  149. package/dist/esm/helperComponents/BulkActions/components/BulkActionsControls/styles.module.css +39 -0
  150. package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.d.ts +14 -0
  151. package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.js +24 -0
  152. package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.d.ts +1 -0
  153. package/dist/esm/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.js +1 -0
  154. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.d.ts +9 -0
  155. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.js +15 -0
  156. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/index.d.ts +1 -0
  157. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/index.js +1 -0
  158. package/dist/esm/helperComponents/BulkActions/components/SelectionLabel/styles.module.css +40 -0
  159. package/dist/esm/helperComponents/BulkActions/components/index.d.ts +4 -0
  160. package/dist/esm/helperComponents/BulkActions/components/index.js +4 -0
  161. package/dist/esm/helperComponents/BulkActions/index.d.ts +2 -0
  162. package/dist/esm/helperComponents/BulkActions/index.js +2 -0
  163. package/dist/esm/helperComponents/BulkActions/styles.module.css +9 -0
  164. package/dist/esm/helperComponents/BulkActions/types.d.ts +31 -0
  165. package/dist/esm/helperComponents/BulkActions/types.js +1 -0
  166. package/dist/esm/helperComponents/BulkActions/utils.d.ts +15 -0
  167. package/dist/esm/helperComponents/BulkActions/utils.js +21 -0
  168. package/dist/esm/helperComponents/DataView/DataView.d.ts +2 -0
  169. package/dist/esm/helperComponents/DataView/DataView.js +6 -0
  170. package/dist/esm/helperComponents/DataView/constants.d.ts +9 -0
  171. package/dist/esm/helperComponents/DataView/constants.js +10 -0
  172. package/dist/esm/helperComponents/DataView/index.d.ts +3 -0
  173. package/dist/esm/helperComponents/DataView/index.js +3 -0
  174. package/dist/esm/helperComponents/DataView/types.d.ts +12 -0
  175. package/dist/esm/helperComponents/DataView/types.js +1 -0
  176. package/dist/esm/helperComponents/FilterButton/FilterButton.d.ts +12 -0
  177. package/dist/esm/helperComponents/FilterButton/FilterButton.js +11 -0
  178. package/dist/esm/helperComponents/FilterButton/index.d.ts +1 -0
  179. package/dist/esm/helperComponents/FilterButton/index.js +1 -0
  180. package/dist/esm/helperComponents/FilterButton/styles.module.css +5 -0
  181. package/dist/esm/helperComponents/MoreActions/MoreActions.d.ts +13 -0
  182. package/dist/esm/helperComponents/MoreActions/MoreActions.js +29 -0
  183. package/dist/esm/helperComponents/MoreActions/index.d.ts +1 -0
  184. package/dist/esm/helperComponents/MoreActions/index.js +1 -0
  185. package/dist/esm/helperComponents/MoreActions/styles.module.css +5 -0
  186. package/dist/esm/helperComponents/Search/ToolbarSearch.d.ts +9 -0
  187. package/dist/esm/helperComponents/Search/ToolbarSearch.js +13 -0
  188. package/dist/esm/helperComponents/Search/index.d.ts +1 -0
  189. package/dist/esm/helperComponents/Search/index.js +1 -0
  190. package/dist/esm/helperComponents/Search/styles.module.css +25 -0
  191. package/dist/esm/helperComponents/Separator/Separator.d.ts +1 -0
  192. package/dist/esm/helperComponents/Separator/Separator.js +5 -0
  193. package/dist/esm/helperComponents/Separator/index.d.ts +1 -0
  194. package/dist/esm/helperComponents/Separator/index.js +1 -0
  195. package/dist/esm/helperComponents/Separator/styles.module.css +14 -0
  196. package/dist/esm/helperComponents/index.d.ts +6 -0
  197. package/dist/esm/helperComponents/index.js +6 -0
  198. package/dist/esm/index.d.ts +5 -0
  199. package/dist/esm/index.js +5 -0
  200. package/dist/esm/locale/index.d.ts +55 -0
  201. package/dist/esm/locale/index.js +29 -0
  202. package/dist/esm/style.css +437 -0
  203. package/dist/esm/testIds.d.ts +24 -0
  204. package/dist/esm/testIds.js +24 -0
  205. package/dist/tsconfig.cjs.tsbuildinfo +1 -0
  206. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  207. package/package.json +65 -0
  208. package/src/components/Toolbar/Toolbar.tsx +145 -0
  209. package/src/components/Toolbar/helpers.ts +39 -0
  210. package/src/components/Toolbar/hooks/index.ts +2 -0
  211. package/src/components/Toolbar/hooks/useFilters.ts +87 -0
  212. package/src/components/Toolbar/hooks/usePersistState/index.ts +1 -0
  213. package/src/components/Toolbar/hooks/usePersistState/usePersistState.ts +107 -0
  214. package/src/components/Toolbar/hooks/usePersistState/utils/index.ts +3 -0
  215. package/src/components/Toolbar/hooks/usePersistState/utils/isDateString.ts +49 -0
  216. package/src/components/Toolbar/hooks/usePersistState/utils/parser.ts +62 -0
  217. package/src/components/Toolbar/hooks/usePersistState/utils/serializer.ts +51 -0
  218. package/src/components/Toolbar/index.ts +3 -0
  219. package/src/components/Toolbar/styles.module.scss +116 -0
  220. package/src/components/Toolbar/types.ts +99 -0
  221. package/src/components/Toolbar/typesUtils.ts +17 -0
  222. package/src/components/Toolbar/utils/buildMobileOverflowActions.tsx +142 -0
  223. package/src/components/Toolbar/utils/toolbarAfterOverflow.ts +2 -0
  224. package/src/components/index.ts +4 -0
  225. package/src/helperComponents/BulkActions/BulkActions.tsx +54 -0
  226. package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/BulkActionsCheckbox.tsx +35 -0
  227. package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/index.ts +1 -0
  228. package/src/helperComponents/BulkActions/components/BulkActionsCheckbox/styles.module.scss +3 -0
  229. package/src/helperComponents/BulkActions/components/BulkActionsControls/BulkActionsControls.tsx +135 -0
  230. package/src/helperComponents/BulkActions/components/BulkActionsControls/index.ts +1 -0
  231. package/src/helperComponents/BulkActions/components/BulkActionsControls/styles.module.scss +49 -0
  232. package/src/helperComponents/BulkActions/components/MobileBulkActionsSheet/MobileBulkActionsSheet.tsx +88 -0
  233. package/src/helperComponents/BulkActions/components/MobileBulkActionsSheet/index.ts +1 -0
  234. package/src/helperComponents/BulkActions/components/SelectionLabel/SelectionLabel.tsx +40 -0
  235. package/src/helperComponents/BulkActions/components/SelectionLabel/index.ts +1 -0
  236. package/src/helperComponents/BulkActions/components/SelectionLabel/styles.module.scss +38 -0
  237. package/src/helperComponents/BulkActions/components/index.ts +4 -0
  238. package/src/helperComponents/BulkActions/index.ts +2 -0
  239. package/src/helperComponents/BulkActions/styles.module.scss +13 -0
  240. package/src/helperComponents/BulkActions/types.ts +32 -0
  241. package/src/helperComponents/BulkActions/utils.tsx +32 -0
  242. package/src/helperComponents/DataView/DataView.tsx +22 -0
  243. package/src/helperComponents/DataView/constants.tsx +15 -0
  244. package/src/helperComponents/DataView/index.ts +3 -0
  245. package/src/helperComponents/DataView/types.ts +15 -0
  246. package/src/helperComponents/FilterButton/FilterButton.tsx +40 -0
  247. package/src/helperComponents/FilterButton/index.ts +1 -0
  248. package/src/helperComponents/FilterButton/styles.module.scss +5 -0
  249. package/src/helperComponents/MoreActions/MoreActions.tsx +69 -0
  250. package/src/helperComponents/MoreActions/index.ts +1 -0
  251. package/src/helperComponents/MoreActions/styles.module.scss +5 -0
  252. package/src/helperComponents/Search/ToolbarSearch.tsx +48 -0
  253. package/src/helperComponents/Search/index.ts +1 -0
  254. package/src/helperComponents/Search/styles.module.scss +35 -0
  255. package/src/helperComponents/Separator/Separator.tsx +9 -0
  256. package/src/helperComponents/Separator/index.ts +1 -0
  257. package/src/helperComponents/Separator/styles.module.scss +18 -0
  258. package/src/helperComponents/index.ts +6 -0
  259. package/src/index.ts +5 -0
  260. package/src/locale/index.ts +33 -0
  261. package/src/testIds.ts +24 -0
@@ -0,0 +1,81 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '@cloud-ru/ds-button';
3
+ import { UpdateSVG } from '@cloud-ru/ds-icons/interface/system';
4
+ import { Children, Fragment, isValidElement } from 'react';
5
+ import { TEST_IDS } from '../../../testIds.js';
6
+ import { TOOLBAR_AFTER_OVERFLOW_ATTR } from './toolbarAfterOverflow.js';
7
+ function collectElements(node) {
8
+ if (node == null || typeof node === 'boolean') {
9
+ return [];
10
+ }
11
+ return Children.toArray(node).flatMap(child => {
12
+ if (!isValidElement(child)) {
13
+ return [];
14
+ }
15
+ if (child.type === Fragment) {
16
+ return collectElements(child.props.children);
17
+ }
18
+ return [child];
19
+ });
20
+ }
21
+ function hasOverflowMarker(element) {
22
+ return TOOLBAR_AFTER_OVERFLOW_ATTR in element.props;
23
+ }
24
+ function isSlotButton(element) {
25
+ if (hasOverflowMarker(element)) {
26
+ return true;
27
+ }
28
+ if (element.type === Button) {
29
+ return true;
30
+ }
31
+ const { onClick, label, icon, 'aria-label': ariaLabel, } = element.props;
32
+ return typeof onClick === 'function' && Boolean(label || icon || ariaLabel);
33
+ }
34
+ function resolveAfterActionElement(element) {
35
+ if (isSlotButton(element)) {
36
+ return element;
37
+ }
38
+ const childElements = collectElements(element.props.children);
39
+ if (childElements.length === 1) {
40
+ return resolveAfterActionElement(childElements[0]);
41
+ }
42
+ return null;
43
+ }
44
+ function mapSlotButtonToAction(element) {
45
+ const { label, icon, onClick, disabled, 'aria-label': ariaLabel, } = element.props;
46
+ const optionLabel = label ?? ariaLabel;
47
+ if (!optionLabel && !icon) {
48
+ return null;
49
+ }
50
+ return {
51
+ content: optionLabel ? { label: optionLabel } : { label: '' },
52
+ icon,
53
+ onClick,
54
+ disabled,
55
+ };
56
+ }
57
+ export function buildMobileOverflowActions({ onRefresh, after, moreActions = [], refreshLabel, }) {
58
+ const actions = [];
59
+ if (onRefresh) {
60
+ actions.push({
61
+ content: { label: refreshLabel },
62
+ icon: _jsx(UpdateSVG, {}),
63
+ onClick: onRefresh,
64
+ 'data-test-id': TEST_IDS.refreshOption,
65
+ });
66
+ }
67
+ collectElements(after).forEach((element, index) => {
68
+ const actionElement = resolveAfterActionElement(element);
69
+ if (!actionElement) {
70
+ return;
71
+ }
72
+ const action = mapSlotButtonToAction(actionElement);
73
+ if (action) {
74
+ actions.push({
75
+ ...action,
76
+ 'data-test-id': `${TEST_IDS.afterOption}__${index}`,
77
+ });
78
+ }
79
+ });
80
+ return [...actions, ...moreActions];
81
+ }
@@ -0,0 +1,2 @@
1
+ /** Маркер для кастомных кнопок в слоте `after`, которые нужно перенести в mobile overflow «⋯». */
2
+ export declare const TOOLBAR_AFTER_OVERFLOW_ATTR = "data-toolbar-after-overflow";
@@ -0,0 +1,2 @@
1
+ /** Маркер для кастомных кнопок в слоте `after`, которые нужно перенести в mobile overflow «⋯». */
2
+ export const TOOLBAR_AFTER_OVERFLOW_ATTR = 'data-toolbar-after-overflow';
@@ -0,0 +1,4 @@
1
+ export * from './Toolbar/index.js';
2
+ export type { BulkAction, BulkActionsProps } from '../helperComponents/index.js';
3
+ export { formatFilterStateToRequestPayload, isDateString } from './Toolbar/hooks/usePersistState/utils/index.js';
4
+ export { TOOLBAR_AFTER_OVERFLOW_ATTR } from './Toolbar/utils/toolbarAfterOverflow.js';
@@ -0,0 +1,3 @@
1
+ export * from './Toolbar/index.js';
2
+ export { formatFilterStateToRequestPayload, isDateString } from './Toolbar/hooks/usePersistState/utils/index.js';
3
+ export { TOOLBAR_AFTER_OVERFLOW_ATTR } from './Toolbar/utils/toolbarAfterOverflow.js';
@@ -0,0 +1,2 @@
1
+ import { BulkActionsComponentProps } from './types.js';
2
+ export declare function BulkActions({ actions, checked, onCheck, indeterminate, selectedCount, totalCount, showBulkCheckbox, resizingContainerRef, }: BulkActionsComponentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { isMobileLayout, useAdaptiveLayout } from '@cloud-ru/ds-adaptive';
3
+ import { TEST_IDS } from '../../testIds.js';
4
+ import { BulkActionsCheckbox, BulkActionsControls, MobileBulkActionsSheet, SelectionLabel } from './components/index.js';
5
+ import styles from './styles.module.css';
6
+ export function BulkActions({ actions = [], checked, onCheck, indeterminate, selectedCount = 0, totalCount, showBulkCheckbox = true, resizingContainerRef, }) {
7
+ const { layoutType } = useAdaptiveLayout();
8
+ const isMobile = isMobileLayout(layoutType);
9
+ const hasSelection = Boolean(checked || indeterminate);
10
+ const showActions = hasSelection && actions.length > 0;
11
+ const showInlineActions = showActions && !isMobile;
12
+ const showCheckboxInToolbar = showBulkCheckbox;
13
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: styles.bulkTool, "data-test-id": TEST_IDS.bulkTool, children: [showCheckboxInToolbar && (_jsx(BulkActionsCheckbox, { checked: checked, indeterminate: indeterminate, onCheck: onCheck })), _jsx(SelectionLabel, { selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showInlineActions && (_jsx(BulkActionsControls, { variant: 'toolbar', actions: actions, resizingContainerRef: resizingContainerRef }))] }), isMobile && showActions && (_jsx(MobileBulkActionsSheet, { open: hasSelection, actions: actions, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showBulkCheckbox: showBulkCheckbox }))] }));
14
+ }
@@ -0,0 +1,8 @@
1
+ type BulkActionsCheckboxProps = {
2
+ checked?: boolean;
3
+ indeterminate?: boolean;
4
+ onCheck?(): void;
5
+ className?: string;
6
+ };
7
+ export declare function BulkActionsCheckbox({ checked, indeterminate, onCheck, className }: BulkActionsCheckboxProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Checkbox } from '@cloud-ru/ds-toggles';
3
+ import cn from 'classnames';
4
+ import { TEST_IDS } from '../../../../testIds.js';
5
+ import styles from './styles.module.css';
6
+ function getCheckboxAriaChecked(checked, indeterminate) {
7
+ if (indeterminate) {
8
+ return 'mixed';
9
+ }
10
+ return Boolean(checked);
11
+ }
12
+ export function BulkActionsCheckbox({ checked, indeterminate, onCheck, className }) {
13
+ return (_jsx(Checkbox, { size: 'xs', checked: checked, indeterminate: indeterminate, tabIndex: -1, "data-test-id": TEST_IDS.checkbox, className: cn(styles.checkbox, className), onClick: onCheck, "aria-checked": getCheckboxAriaChecked(checked, indeterminate) }));
14
+ }
@@ -0,0 +1 @@
1
+ export * from './BulkActionsCheckbox.js';
@@ -0,0 +1 @@
1
+ export * from './BulkActionsCheckbox.js';
@@ -0,0 +1,17 @@
1
+ import { RefObject } from 'react';
2
+ import { BulkAction } from '../../types.js';
3
+ type BulkActionsControlsVariant = 'toolbar' | 'sheet';
4
+ type BulkActionsControlsProps = {
5
+ actions: BulkAction[];
6
+ variant: BulkActionsControlsVariant;
7
+ checked?: boolean;
8
+ indeterminate?: boolean;
9
+ onCheck?(): void;
10
+ showCheckbox?: boolean;
11
+ resizingContainerRef?: RefObject<HTMLDivElement>;
12
+ selectedCount?: number;
13
+ totalCount?: number;
14
+ hasSelection?: boolean;
15
+ };
16
+ export declare function BulkActionsControls({ actions, variant, checked, indeterminate, onCheck, showCheckbox, resizingContainerRef, selectedCount, totalCount, hasSelection, }: BulkActionsControlsProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '@cloud-ru/ds-button';
3
+ import { KebabSVG } from '@cloud-ru/ds-icons/interface/system';
4
+ import { Droplist } from '@cloud-ru/ds-list';
5
+ import { Tooltip } from '@cloud-ru/ds-tooltip';
6
+ import { useDynamicList } from '@cloud-ru/ds-utils';
7
+ import { useRef, useState } from 'react';
8
+ import { toolbarLocale } from '../../../../locale/index.js';
9
+ import { TEST_IDS } from '../../../../testIds.js';
10
+ import { getBulkActionIndex, getBulkActionKey, mapBulkActionToDroplistItem } from '../../utils.js';
11
+ import { BulkActionsCheckbox } from '../BulkActionsCheckbox/index.js';
12
+ import { SelectionLabel } from '../SelectionLabel/index.js';
13
+ import styles from './styles.module.css';
14
+ export function BulkActionsControls({ actions, variant, checked, indeterminate, onCheck, showCheckbox = false, resizingContainerRef, selectedCount = 0, totalCount, hasSelection = false, }) {
15
+ const { t } = toolbarLocale.useTranslations();
16
+ const [isMoreOpen, setIsMoreOpen] = useState(false);
17
+ const actionsAreaRef = useRef(null);
18
+ const triggerRef = useRef(null);
19
+ const isSheet = variant === 'sheet';
20
+ const { visibleItems, hiddenItems } = useDynamicList({
21
+ items: actions,
22
+ resizingContainerRef: isSheet ? undefined : resizingContainerRef,
23
+ parentContainerRef: actionsAreaRef,
24
+ });
25
+ const droplistActions = isSheet ? actions : hiddenItems;
26
+ return (_jsxs("div", { className: styles.actionsArea, ref: actionsAreaRef, "data-variant": variant, "data-test-id": TEST_IDS.bulkActions, children: [showCheckbox && _jsx(BulkActionsCheckbox, { checked: checked, indeterminate: indeterminate, onCheck: onCheck }), _jsx("div", { className: isSheet ? styles.sheetActions : styles.bulkActions, children: visibleItems.map((action, visibleIndex) => {
27
+ const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
28
+ const actionIndex = getBulkActionIndex(actions, action, visibleIndex);
29
+ return (_jsx(Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'top', "data-test-id": `${testId}-tooltip`, triggerClassName: styles.triggerClassName, children: _jsx(Button, { view: 'tonal', appearance: 'primary', className: styles.action, "data-test-id": testId, iconPosition: 'before', icon: _jsx(Icon, {}), label: label, size: 's', onClick: onClick, disabled: disabled }) }, getBulkActionKey(action, actionIndex)));
30
+ }) }), hiddenItems.length > 0 && (_jsx(Droplist, { label: isSheet ? t('multipleActions') : undefined,
31
+ // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
32
+ slotAfterTitle: isSheet ? (_jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection })) : undefined, open: isMoreOpen, onOpenChange: setIsMoreOpen, trigger: 'clickAndFocusVisible', triggerElemRef: triggerRef, triggerClassName: styles.triggerClassName, closeDroplistOnItemClick: true, placement: 'bottom-end', scroll: true, size: 's', items: droplistActions.map((action, index) => mapBulkActionToDroplistItem(action, getBulkActionIndex(actions, action, index))), children: ({ onKeyDown }) => (_jsx(Button, { view: 'function', appearance: 'neutral', className: styles.moreActionButton, size: 's', icon: _jsx(KebabSVG, {}), "data-test-id": TEST_IDS.moreBulkActionsButton, innerRef: triggerRef, onKeyDown: onKeyDown })) }))] }));
33
+ }
@@ -0,0 +1 @@
1
+ export * from './BulkActionsControls.js';
@@ -0,0 +1 @@
1
+ export * from './BulkActionsControls.js';
@@ -0,0 +1,39 @@
1
+ .actionsArea{
2
+ display:flex;
3
+ flex:1 1 0;
4
+ gap:var(--sn-toolbar-anatomy-container-tool-bulkAction-gap, var(--sn-primitive-dimension-8, 8px));
5
+ align-items:center;
6
+ box-sizing:border-box;
7
+ width:100%;
8
+ min-width:0;
9
+ }
10
+ .actionsArea[data-variant=sheet]{
11
+ padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
12
+ }
13
+
14
+ .bulkActions{
15
+ display:inline-flex;
16
+ flex-shrink:0;
17
+ gap:var(--sn-primitive-dimension-4, 4px);
18
+ align-items:center;
19
+ }
20
+
21
+ .moreActionButton{
22
+ flex-shrink:0;
23
+ }
24
+
25
+ .action{
26
+ flex-shrink:0;
27
+ white-space:nowrap;
28
+ }
29
+
30
+ .sheetActions{
31
+ display:inline-flex;
32
+ flex-shrink:0;
33
+ gap:var(--sn-primitive-dimension-4, 4px);
34
+ align-items:center;
35
+ }
36
+
37
+ .triggerClassName{
38
+ display:inline-flex;
39
+ }
@@ -0,0 +1,14 @@
1
+ import { BulkAction } from '../../types.js';
2
+ type MobileBulkActionsSheetProps = {
3
+ open: boolean;
4
+ actions: BulkAction[];
5
+ selectedCount: number;
6
+ totalCount?: number;
7
+ hasSelection: boolean;
8
+ checked?: boolean;
9
+ indeterminate?: boolean;
10
+ onCheck?(): void;
11
+ showBulkCheckbox?: boolean;
12
+ };
13
+ export declare function MobileBulkActionsSheet({ open, actions, selectedCount, totalCount, hasSelection, checked, indeterminate, onCheck, showBulkCheckbox, }: MobileBulkActionsSheetProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { BottomSheet } from '@cloud-ru/ds-bottom-sheet';
3
+ import { usePortalContext } from '@cloud-ru/ds-portal-context';
4
+ import { useThemeClassnames } from '@cloud-ru/ds-theme';
5
+ import { useLayoutEffect } from '@cloud-ru/ds-utils';
6
+ import { useState } from 'react';
7
+ import { toolbarLocale } from '../../../../locale/index.js';
8
+ import { TEST_IDS } from '../../../../testIds.js';
9
+ import { BulkActionsControls } from '../BulkActionsControls/index.js';
10
+ import { SelectionLabel } from '../SelectionLabel/index.js';
11
+ const CLOSE_STUB_CALLBACK = () => undefined;
12
+ export function MobileBulkActionsSheet({ open, actions, selectedCount, totalCount, hasSelection, checked, indeterminate, onCheck, showBulkCheckbox, }) {
13
+ const { t } = toolbarLocale.useTranslations();
14
+ const portalContext = usePortalContext();
15
+ const [bottomSheetKey, setBottomSheetKey] = useState('notReady');
16
+ useLayoutEffect(() => {
17
+ setBottomSheetKey('ready');
18
+ }, []);
19
+ // Фиксируем density, остальные оси (colorScheme/brand/…) наследуем из контекста темы.
20
+ const themeClassName = useThemeClassnames({ density: 'comfort' });
21
+ return (_jsx(BottomSheet, { className: themeClassName, container: portalContext.current ?? undefined, open: open, onClose: CLOSE_STUB_CALLBACK, title: t('multipleActions'),
22
+ // TODO: slotAfterTitle должен расширяться на всю ширину, а section-label уходить вправо
23
+ slotAfterTitle: _jsx(SelectionLabel, { placement: 'headline', selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), content: _jsx(BulkActionsControls, { variant: 'sheet', actions: actions, checked: checked, indeterminate: indeterminate, onCheck: onCheck, showCheckbox: showBulkCheckbox, selectedCount: selectedCount, totalCount: totalCount, hasSelection: hasSelection }), showBackdrop: false, swipeEnabled: false, lockScroll: false, closeOnPopstate: false, safeArea: false, withDividers: false, "data-test-id": TEST_IDS.mobileBulkActionsSheet }, bottomSheetKey));
24
+ }
@@ -0,0 +1 @@
1
+ export * from './MobileBulkActionsSheet.js';
@@ -0,0 +1 @@
1
+ export * from './MobileBulkActionsSheet.js';
@@ -0,0 +1,9 @@
1
+ type SelectionLabelProps = {
2
+ selectedCount: number;
3
+ totalCount?: number;
4
+ hasSelection: boolean;
5
+ className?: string;
6
+ placement?: 'inline' | 'headline';
7
+ };
8
+ export declare function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement, }: SelectionLabelProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import cn from 'classnames';
3
+ import { toolbarLocale } from '../../../../locale/index.js';
4
+ import styles from './styles.module.css';
5
+ export function SelectionLabel({ selectedCount, totalCount, hasSelection, className, placement = 'inline', }) {
6
+ const { t } = toolbarLocale.useTranslations();
7
+ const valueLabel = hasSelection && totalCount != null
8
+ ? t('selectedCountOf', { count: selectedCount, total: totalCount })
9
+ : t('selectedCount', { count: selectedCount });
10
+ const label = (_jsxs("div", { className: cn(styles.selectionLabel, className), "data-has-selection": hasSelection || undefined, children: [_jsx("span", { className: styles.selectionLabelPrefix, children: t('selectedPrefix') }), _jsx("span", { className: styles.selectionLabelValue, children: valueLabel })] }));
11
+ if (placement === 'headline') {
12
+ return _jsx("div", { className: styles.headlinePlacement, children: label });
13
+ }
14
+ return label;
15
+ }
@@ -0,0 +1 @@
1
+ export * from './SelectionLabel.js';
@@ -0,0 +1 @@
1
+ export * from './SelectionLabel.js';
@@ -0,0 +1,40 @@
1
+ .selectionLabel{
2
+ display:inline-flex;
3
+ flex-shrink:0;
4
+ gap:var(--sn-chip-anatomy-size-s-container-textWrapper-gap, var(--sn-density-spacing-control-wrapper-horizontal-s, var(--sn-primitive-dimension-8, 8px)));
5
+ align-items:center;
6
+ padding-inline:var(--sn-chip-anatomy-size-s-container-textWrapper-paddingHorizontal, var(--sn-density-spacing-control-wrapper-horizontal-s, var(--sn-primitive-dimension-8, 8px)));
7
+ white-space:nowrap;
8
+ }
9
+
10
+ .selectionLabelPrefix{
11
+ font-family:var(--sn-thin-label-m-fontFamily, var(--sn-brand-font-fontFamily-thin-label, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
12
+ font-weight:var(--sn-thin-label-m-fontWeight, var(--sn-theme-typography-fontWeight-thin-label-m, var(--sn-brand-font-fontWeight-light-thin-label-m, var(--sn-primitive-font-fontWeightValue-450, 450))));
13
+ line-height:var(--sn-thin-label-m-lineHeight, var(--sn-density-typography-roleLabel-lineHeightM, var(--sn-primitive-font-lineHeight-by16, 24px)));
14
+ font-size:var(--sn-thin-label-m-fontSize, var(--sn-density-typography-roleLabel-fontSizeM, var(--sn-primitive-font-fontSize-16, 16px)));
15
+ letter-spacing:var(--sn-thin-label-m-letterSpacing, var(--sn-primitive-font-letterSpacing-s, 0px));
16
+ paragraph-spacing:var(--sn-thin-label-m-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
17
+ color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
18
+ }
19
+
20
+ .selectionLabelValue{
21
+ font-family:var(--sn-regular-body-s-fontFamily, var(--sn-brand-font-fontFamily-regular-body, var(--sn-primitive-fontFamily-brandA-sans, SB Sans Interface)));
22
+ 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))));
23
+ line-height:var(--sn-regular-body-s-lineHeight, var(--sn-density-typography-roleBody-lineHeightS, var(--sn-primitive-font-lineHeight-by14, 20px)));
24
+ font-size:var(--sn-regular-body-s-fontSize, var(--sn-density-typography-roleBody-fontSizeS, var(--sn-primitive-font-fontSize-14, 14px)));
25
+ letter-spacing:var(--sn-regular-body-s-letterSpacing, var(--sn-primitive-font-letterSpacing-m, 0.1px));
26
+ paragraph-spacing:var(--sn-regular-body-s-paragraphSpacing, var(--sn-primitive-font-paragraphSpacing-byFontSize12, 6px));
27
+ color:var(--sn-theme-color-available-version-textTertiary, var(--sn-brand-color-text-version-tertiary, rgba(65, 66, 78, 0.5490196078)));
28
+ }
29
+
30
+ .selectionLabel:not([data-has-selection]) .selectionLabelValue{
31
+ color:var(--sn-theme-color-available-version-textDisabled, var(--sn-brand-color-text-version-disabled, rgba(65, 66, 78, 0.3490196078)));
32
+ }
33
+
34
+ .headlinePlacement{
35
+ display:flex;
36
+ flex:1 1 auto;
37
+ justify-content:flex-end;
38
+ width:100%;
39
+ min-width:0;
40
+ }
@@ -0,0 +1,4 @@
1
+ export * from './BulkActionsCheckbox/index.js';
2
+ export * from './BulkActionsControls/index.js';
3
+ export * from './MobileBulkActionsSheet/index.js';
4
+ export * from './SelectionLabel/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './BulkActionsCheckbox/index.js';
2
+ export * from './BulkActionsControls/index.js';
3
+ export * from './MobileBulkActionsSheet/index.js';
4
+ export * from './SelectionLabel/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './BulkActions.js';
2
+ export * from './types.js';
@@ -0,0 +1,2 @@
1
+ export * from './BulkActions.js';
2
+ export * from './types.js';
@@ -0,0 +1,9 @@
1
+ .bulkTool{
2
+ display:flex;
3
+ gap:var(--sn-toolbar-anatomy-container-tool-bulkAction-gap, var(--sn-primitive-dimension-8, 8px));
4
+ align-items:center;
5
+ box-sizing:border-box;
6
+ width:100%;
7
+ min-height:var(--sn-primitive-dimension-24, 24px);
8
+ padding-left:var(--sn-toolbar-anatomy-container-tool-bulkAction-paddingLeft, var(--sn-primitive-dimension-4, 4px));
9
+ }
@@ -0,0 +1,31 @@
1
+ import { TooltipProps } from '@cloud-ru/ds-tooltip';
2
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
3
+ import { JSXElementConstructor, RefObject } from 'react';
4
+ export type BulkAction = WithSupportProps<{
5
+ label: string;
6
+ icon: JSXElementConstructor<{
7
+ className?: string;
8
+ }>;
9
+ disabled?: boolean;
10
+ tooltip?: TooltipProps['tip'];
11
+ onClick?(): void;
12
+ }>;
13
+ export type BulkActionsProps = WithSupportProps<{
14
+ /** Список массовых действий */
15
+ actions?: BulkAction[];
16
+ /** Колбек смены значения чекбокса */
17
+ onCheck?(): void;
18
+ /** Значение чекбокса */
19
+ checked?: boolean;
20
+ /** Состояние частичного выбора */
21
+ indeterminate?: boolean;
22
+ /** Показывать чекбокс слева (Figma: showBulkCheckbox) @default true */
23
+ showBulkCheckbox?: boolean;
24
+ /** Количество выбранных элементов (для подписи Selected: N) */
25
+ selectedCount?: number;
26
+ /** Общее количество элементов (для подписи Selected: N of M) */
27
+ totalCount?: number;
28
+ }>;
29
+ export type BulkActionsComponentProps = BulkActionsProps & {
30
+ resizingContainerRef?: RefObject<HTMLDivElement>;
31
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import { ReactNode } from 'react';
2
+ import { BulkAction } from './types.js';
3
+ export declare function getBulkActionKey(action: BulkAction, index: number): string;
4
+ export declare function getBulkActionIndex(actions: BulkAction[], action: BulkAction, fallbackIndex: number): number;
5
+ export declare function mapBulkActionToDroplistItem(action: BulkAction, index: number): {
6
+ id: string;
7
+ content: {
8
+ label: string;
9
+ };
10
+ beforeContent: import("react/jsx-runtime").JSX.Element;
11
+ onClick: (() => void) | undefined;
12
+ disabled: boolean | undefined;
13
+ itemWrapRender: (item: ReactNode) => import("react/jsx-runtime").JSX.Element;
14
+ 'data-test-id': string | undefined;
15
+ };
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tooltip } from '@cloud-ru/ds-tooltip';
3
+ export function getBulkActionKey(action, index) {
4
+ return action['data-test-id'] ?? `bulk-action__${index}`;
5
+ }
6
+ export function getBulkActionIndex(actions, action, fallbackIndex) {
7
+ const index = actions.indexOf(action);
8
+ return index >= 0 ? index : fallbackIndex;
9
+ }
10
+ export function mapBulkActionToDroplistItem(action, index) {
11
+ const { label, icon: Icon, onClick, disabled, tooltip, 'data-test-id': testId } = action;
12
+ return {
13
+ id: getBulkActionKey(action, index),
14
+ content: { label },
15
+ beforeContent: _jsx(Icon, {}),
16
+ onClick,
17
+ disabled,
18
+ itemWrapRender: (item) => (_jsx(Tooltip, { tip: tooltip, open: tooltip ? undefined : false, placement: 'right', "data-test-id": `${testId}-tooltip`, children: item })),
19
+ 'data-test-id': testId,
20
+ };
21
+ }
@@ -0,0 +1,2 @@
1
+ import { DataViewProps } from './types.js';
2
+ export declare function DataView({ value, defaultValue, onChange, items, }: DataViewProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SegmentControl, SIZE } from '@cloud-ru/ds-segment-control';
3
+ import { DATA_VIEW_VALUE, DEFAULT_ITEMS } from './constants.js';
4
+ export function DataView({ value, defaultValue = DATA_VIEW_VALUE.List, onChange, items = DEFAULT_ITEMS, }) {
5
+ return (_jsx(SegmentControl, { outline: false, size: SIZE.M, value: value, defaultValue: defaultValue, onChange: onChange, items: items }));
6
+ }
@@ -0,0 +1,9 @@
1
+ import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
2
+ import { ValueOf } from '@cloud-ru/ds-utils';
3
+ export declare const DATA_VIEW_VALUE: {
4
+ readonly List: "list";
5
+ readonly Compact: "compact";
6
+ };
7
+ type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
8
+ export declare const DEFAULT_ITEMS: SegmentControlProps<DataViewValue>['items'];
9
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ViewCardSVG, ViewTableSVG } from '@cloud-ru/ds-icons/interface/product';
3
+ export const DATA_VIEW_VALUE = {
4
+ List: 'list',
5
+ Compact: 'compact',
6
+ };
7
+ export const DEFAULT_ITEMS = [
8
+ { value: DATA_VIEW_VALUE.List, label: '', icon: _jsx(ViewTableSVG, {}) },
9
+ { value: DATA_VIEW_VALUE.Compact, label: '', icon: _jsx(ViewCardSVG, {}) },
10
+ ];
@@ -0,0 +1,3 @@
1
+ export * from './DataView.js';
2
+ export * from './constants.js';
3
+ export * from './types.js';
@@ -0,0 +1,3 @@
1
+ export * from './DataView.js';
2
+ export * from './constants.js';
3
+ export * from './types.js';
@@ -0,0 +1,12 @@
1
+ import { type SegmentControlProps } from '@cloud-ru/ds-segment-control';
2
+ import { ValueOf, WithSupportProps } from '@cloud-ru/ds-utils';
3
+ import { DATA_VIEW_VALUE } from './constants.js';
4
+ export type DataViewValue = ValueOf<typeof DATA_VIEW_VALUE>;
5
+ type DataViewBaseProps = {
6
+ value?: DataViewValue;
7
+ defaultValue?: DataViewValue;
8
+ onChange?(value: DataViewValue): void;
9
+ items?: SegmentControlProps<DataViewValue>['items'];
10
+ };
11
+ export type DataViewProps = WithSupportProps<DataViewBaseProps>;
12
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
2
+ type FilterButtonBaseProps = {
3
+ /** Открыта ли строка фильтров */
4
+ open: boolean;
5
+ /** Колбек смены состояния открытия строки фильтров */
6
+ onOpenChange(open: boolean): void;
7
+ /** Количество активных фильтров для отображения в counter */
8
+ numberOfFilters?: number;
9
+ };
10
+ export type FilterButtonProps = WithSupportProps<FilterButtonBaseProps>;
11
+ export declare function FilterButton({ open, onOpenChange, numberOfFilters }: FilterButtonProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Button } from '@cloud-ru/ds-button';
3
+ import { FilterSVG } from '@cloud-ru/ds-icons/interface/system';
4
+ import { Tooltip } from '@cloud-ru/ds-tooltip';
5
+ import { toolbarLocale } from '../../locale/index.js';
6
+ import { TEST_IDS } from '../../testIds.js';
7
+ import styles from './styles.module.css';
8
+ export function FilterButton({ open, onOpenChange, numberOfFilters }) {
9
+ const { t } = toolbarLocale.useTranslations();
10
+ return (_jsx(Tooltip, { tip: open ? t('hideFilters') : t('showFilters'), triggerClassName: styles.trigger, children: _jsx(Button, { view: open ? 'tonal' : 'function', appearance: open ? 'primary' : 'neutral', size: 'm', icon: _jsx(FilterSVG, {}), iconPosition: 'after', counter: numberOfFilters ? { value: numberOfFilters } : undefined, onClick: () => onOpenChange(!open), "aria-pressed": open, "data-test-id": TEST_IDS.filterButton, "data-filter-open": open || undefined }) }));
11
+ }
@@ -0,0 +1 @@
1
+ export * from './FilterButton.js';
@@ -0,0 +1 @@
1
+ export * from './FilterButton.js';
@@ -0,0 +1,5 @@
1
+ .trigger{
2
+ display:inline-flex;
3
+ flex-shrink:0;
4
+ align-items:center;
5
+ }
@@ -0,0 +1,13 @@
1
+ import { BaseItem } from '@cloud-ru/ds-list';
2
+ import { WithSupportProps } from '@cloud-ru/ds-utils';
3
+ import { ReactNode } from 'react';
4
+ export type Action = {
5
+ tagLabel?: string;
6
+ icon?: ReactNode;
7
+ 'data-test-id'?: string;
8
+ } & Pick<BaseItem, 'content' | 'disabled' | 'onClick'>;
9
+ export type MoreActionsProps = WithSupportProps<{
10
+ /** Элементы выпадающего списка кнопки с действиями */
11
+ moreActions: Action[];
12
+ }>;
13
+ export declare function MoreActions({ moreActions, 'data-test-id': dataTestId, ...rest }: MoreActionsProps): import("react/jsx-runtime").JSX.Element;