@salutejs/plasma-new-hope 0.174.0-canary.1505.11518120718.0 → 0.174.0-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (245) hide show
  1. package/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -27
  2. package/cjs/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  3. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
  4. package/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  5. package/cjs/components/Drawer/Drawer.js +2 -1
  6. package/cjs/components/Drawer/Drawer.js.map +1 -1
  7. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  8. package/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  9. package/cjs/components/Select/Select.js +25 -13
  10. package/cjs/components/Select/Select.js.map +1 -1
  11. package/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  12. package/cjs/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  13. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  14. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  15. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  16. package/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  17. package/cjs/components/Select/utils/getButtonLabel.js +1 -1
  18. package/cjs/components/Select/utils/getButtonLabel.js.map +1 -1
  19. package/cjs/components/Select/utils/initialItemsTransform.js +6 -9
  20. package/cjs/components/Select/utils/initialItemsTransform.js.map +1 -1
  21. package/cjs/components/ViewContainer/ViewContainer.js +38 -0
  22. package/cjs/components/ViewContainer/ViewContainer.js.map +1 -0
  23. package/cjs/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
  24. package/cjs/components/ViewContainer/_view/base.js +9 -0
  25. package/cjs/components/ViewContainer/_view/base.js.map +1 -0
  26. package/cjs/components/ViewContainer/_view/base_x642ct.css +1 -0
  27. package/cjs/index.css +2 -0
  28. package/cjs/index.js +3 -0
  29. package/cjs/index.js.map +1 -1
  30. package/emotion/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  31. package/emotion/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  32. package/emotion/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  33. package/emotion/cjs/components/Drawer/Drawer.js +4 -3
  34. package/emotion/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  35. package/emotion/cjs/components/Select/Select.js +25 -12
  36. package/emotion/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  37. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  38. package/emotion/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  39. package/emotion/cjs/components/Select/utils/getButtonLabel.js +1 -1
  40. package/emotion/cjs/components/Select/utils/index.js +1 -8
  41. package/emotion/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  42. package/emotion/cjs/components/ViewContainer/ViewContainer.js +49 -0
  43. package/emotion/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  44. package/emotion/cjs/components/ViewContainer/_view/base.js +8 -0
  45. package/emotion/cjs/components/ViewContainer/_view/tokens.json +1 -0
  46. package/emotion/cjs/components/ViewContainer/index.js +18 -0
  47. package/emotion/cjs/examples/_helpers.js +3 -14
  48. package/emotion/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  49. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
  50. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
  51. package/emotion/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  52. package/emotion/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  53. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
  54. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
  55. package/emotion/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  56. package/emotion/cjs/index.js +11 -0
  57. package/emotion/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  58. package/emotion/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  59. package/emotion/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  60. package/emotion/es/components/Drawer/Drawer.js +2 -1
  61. package/emotion/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  62. package/emotion/es/components/Select/Select.js +26 -13
  63. package/emotion/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  64. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  65. package/emotion/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +13 -13
  66. package/emotion/es/components/Select/utils/getButtonLabel.js +1 -1
  67. package/emotion/es/components/Select/utils/index.js +1 -2
  68. package/emotion/es/components/Select/utils/initialItemsTransform.js +6 -19
  69. package/emotion/es/components/ViewContainer/ViewContainer.js +40 -0
  70. package/emotion/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  71. package/emotion/es/components/ViewContainer/_view/base.js +2 -0
  72. package/emotion/es/components/ViewContainer/_view/tokens.json +1 -0
  73. package/emotion/es/components/ViewContainer/index.js +1 -0
  74. package/emotion/es/examples/_helpers.js +3 -14
  75. package/emotion/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  76. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
  77. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
  78. package/emotion/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  79. package/emotion/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  80. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
  81. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
  82. package/emotion/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  83. package/emotion/es/index.js +2 -1
  84. package/es/components/Combobox/ComboboxNew/Combobox.js +22 -27
  85. package/es/components/Combobox/ComboboxNew/Combobox.js.map +1 -1
  86. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -9
  87. package/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js.map +1 -1
  88. package/es/components/Drawer/Drawer.js +2 -1
  89. package/es/components/Drawer/Drawer.js.map +1 -1
  90. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  91. package/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js.map +1 -1
  92. package/es/components/Select/Select.js +26 -14
  93. package/es/components/Select/Select.js.map +1 -1
  94. package/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  95. package/es/components/Select/hooks/useKeyboardNavigation.js.map +1 -1
  96. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  97. package/es/components/Select/ui/Target/ui/Textfield/Textfield.js.map +1 -1
  98. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  99. package/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js.map +1 -1
  100. package/es/components/Select/utils/getButtonLabel.js +1 -1
  101. package/es/components/Select/utils/getButtonLabel.js.map +1 -1
  102. package/es/components/Select/utils/initialItemsTransform.js +6 -9
  103. package/es/components/Select/utils/initialItemsTransform.js.map +1 -1
  104. package/es/components/ViewContainer/ViewContainer.js +33 -0
  105. package/es/components/ViewContainer/ViewContainer.js.map +1 -0
  106. package/es/components/ViewContainer/ViewContainer_yiqfcb.css +1 -0
  107. package/es/components/ViewContainer/_view/base.js +5 -0
  108. package/es/components/ViewContainer/_view/base.js.map +1 -0
  109. package/es/components/ViewContainer/_view/base_x642ct.css +1 -0
  110. package/es/index.css +2 -0
  111. package/es/index.js +1 -0
  112. package/es/index.js.map +1 -1
  113. package/package.json +3 -2
  114. package/styled-components/cjs/components/Combobox/ComboboxNew/Combobox.js +22 -26
  115. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/index.js +1 -8
  116. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  117. package/styled-components/cjs/components/Drawer/Drawer.js +4 -3
  118. package/styled-components/cjs/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  119. package/styled-components/cjs/components/Select/Select.js +25 -12
  120. package/styled-components/cjs/components/Select/hooks/useKeyboardNavigation.js +1 -1
  121. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  122. package/styled-components/cjs/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  123. package/styled-components/cjs/components/Select/utils/getButtonLabel.js +1 -1
  124. package/styled-components/cjs/components/Select/utils/index.js +1 -8
  125. package/styled-components/cjs/components/Select/utils/initialItemsTransform.js +6 -19
  126. package/styled-components/cjs/components/ViewContainer/ViewContainer.js +40 -0
  127. package/styled-components/cjs/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  128. package/styled-components/cjs/components/ViewContainer/_view/base.js +8 -0
  129. package/styled-components/cjs/components/ViewContainer/_view/tokens.json +1 -0
  130. package/styled-components/cjs/components/ViewContainer/index.js +18 -0
  131. package/styled-components/cjs/examples/_helpers.js +3 -14
  132. package/styled-components/cjs/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  133. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +16 -0
  134. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +11 -0
  135. package/styled-components/cjs/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  136. package/styled-components/cjs/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  137. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +16 -0
  138. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.js +11 -0
  139. package/styled-components/cjs/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  140. package/styled-components/cjs/index.js +11 -0
  141. package/styled-components/es/components/Combobox/ComboboxNew/Combobox.js +23 -27
  142. package/styled-components/es/components/Combobox/ComboboxNew/utils/index.js +1 -2
  143. package/styled-components/es/components/Combobox/ComboboxNew/utils/initialItemsTransform.js +5 -19
  144. package/styled-components/es/components/Drawer/Drawer.js +2 -1
  145. package/styled-components/es/components/Pagination/ui/PaginationSelectPerPage/PaginationSelectPerPage.js +2 -2
  146. package/styled-components/es/components/Select/Select.js +26 -13
  147. package/styled-components/es/components/Select/hooks/useKeyboardNavigation.js +1 -1
  148. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.js +1 -1
  149. package/styled-components/es/components/Select/ui/Target/ui/Textfield/Textfield.styles.js +1 -1
  150. package/styled-components/es/components/Select/utils/getButtonLabel.js +1 -1
  151. package/styled-components/es/components/Select/utils/index.js +1 -2
  152. package/styled-components/es/components/Select/utils/initialItemsTransform.js +6 -19
  153. package/styled-components/es/components/ViewContainer/ViewContainer.js +31 -0
  154. package/styled-components/es/components/ViewContainer/ViewContainer.template-doc.mdx +82 -0
  155. package/styled-components/es/components/ViewContainer/_view/base.js +2 -0
  156. package/styled-components/es/components/ViewContainer/_view/tokens.json +1 -0
  157. package/styled-components/es/components/ViewContainer/index.js +1 -0
  158. package/styled-components/es/examples/_helpers.js +3 -14
  159. package/styled-components/es/examples/plasma_b2c/components/Combobox/Combobox.stories.tsx +0 -6
  160. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.js +10 -0
  161. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.js +5 -0
  162. package/styled-components/es/examples/plasma_b2c/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  163. package/styled-components/es/examples/plasma_web/components/Combobox/Combobox.stories.tsx +0 -6
  164. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.config.js +10 -0
  165. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.js +5 -0
  166. package/styled-components/es/examples/plasma_web/components/ViewContainer/ViewContainer.stories.tsx +65 -0
  167. package/styled-components/es/index.js +2 -1
  168. package/types/components/Combobox/ComboboxNew/Combobox.d.ts.map +1 -1
  169. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts +3 -14
  170. package/types/components/Combobox/ComboboxNew/Combobox.types.d.ts.map +1 -1
  171. package/types/components/Combobox/ComboboxNew/utils/index.d.ts +0 -1
  172. package/types/components/Combobox/ComboboxNew/utils/index.d.ts.map +1 -1
  173. package/types/components/Combobox/ComboboxNew/utils/initialItemsTransform.d.ts.map +1 -1
  174. package/types/components/Drawer/Drawer.d.ts.map +1 -1
  175. package/types/components/Select/Select.d.ts.map +1 -1
  176. package/types/components/Select/Select.types.d.ts +0 -1
  177. package/types/components/Select/Select.types.d.ts.map +1 -1
  178. package/types/components/Select/hooks/useKeyboardNavigation.d.ts +2 -2
  179. package/types/components/Select/hooks/useKeyboardNavigation.d.ts.map +1 -1
  180. package/types/components/Select/ui/Target/Target.types.d.ts +2 -2
  181. package/types/components/Select/ui/Target/Target.types.d.ts.map +1 -1
  182. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts +4 -4
  183. package/types/components/Select/ui/Target/ui/Textfield/Textfield.styles.d.ts.map +1 -1
  184. package/types/components/Select/utils/index.d.ts +0 -1
  185. package/types/components/Select/utils/index.d.ts.map +1 -1
  186. package/types/components/Select/utils/initialItemsTransform.d.ts.map +1 -1
  187. package/types/components/ViewContainer/ViewContainer.d.ts +26 -0
  188. package/types/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  189. package/types/components/ViewContainer/_view/base.d.ts +2 -0
  190. package/types/components/ViewContainer/_view/base.d.ts.map +1 -0
  191. package/types/components/ViewContainer/index.d.ts +2 -0
  192. package/types/components/ViewContainer/index.d.ts.map +1 -0
  193. package/types/examples/_helpers.d.ts.map +1 -1
  194. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts +6 -30
  195. package/types/examples/plasma_b2c/components/Combobox/Combobox.d.ts.map +1 -1
  196. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts +9 -0
  197. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
  198. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts +8 -0
  199. package/types/examples/plasma_b2c/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  200. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts +6 -30
  201. package/types/examples/plasma_web/components/Combobox/Combobox.d.ts.map +1 -1
  202. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts +9 -0
  203. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.config.d.ts.map +1 -0
  204. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts +8 -0
  205. package/types/examples/plasma_web/components/ViewContainer/ViewContainer.d.ts.map +1 -0
  206. package/types/index.d.ts +1 -0
  207. package/types/index.d.ts.map +1 -1
  208. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -21
  209. package/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  210. package/cjs/components/Select/utils/getInitialValue.js +0 -21
  211. package/cjs/components/Select/utils/getInitialValue.js.map +0 -1
  212. package/emotion/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  213. package/emotion/cjs/components/Select/utils/getInitialValue.js +0 -20
  214. package/emotion/cjs/examples/themes/declaration.d.ts +0 -4
  215. package/emotion/cjs/examples/themes/index.js +0 -15
  216. package/emotion/cjs/examples/themes/plasma_b2c.module.css +0 -984
  217. package/emotion/cjs/examples/themes/plasma_web.module.css +0 -984
  218. package/emotion/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  219. package/emotion/es/components/Select/utils/getInitialValue.js +0 -14
  220. package/emotion/es/examples/themes/declaration.d.ts +0 -4
  221. package/emotion/es/examples/themes/index.js +0 -7
  222. package/emotion/es/examples/themes/plasma_b2c.module.css +0 -984
  223. package/emotion/es/examples/themes/plasma_web.module.css +0 -984
  224. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -17
  225. package/es/components/Combobox/ComboboxNew/utils/getInitialValue.js.map +0 -1
  226. package/es/components/Select/utils/getInitialValue.js +0 -17
  227. package/es/components/Select/utils/getInitialValue.js.map +0 -1
  228. package/styled-components/cjs/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -20
  229. package/styled-components/cjs/components/Select/utils/getInitialValue.js +0 -20
  230. package/styled-components/cjs/examples/themes/declaration.d.ts +0 -4
  231. package/styled-components/cjs/examples/themes/index.js +0 -15
  232. package/styled-components/cjs/examples/themes/plasma_b2c.module.css +0 -984
  233. package/styled-components/cjs/examples/themes/plasma_web.module.css +0 -984
  234. package/styled-components/es/components/Combobox/ComboboxNew/utils/getInitialValue.js +0 -14
  235. package/styled-components/es/components/Select/utils/getInitialValue.js +0 -14
  236. package/styled-components/es/examples/themes/declaration.d.ts +0 -4
  237. package/styled-components/es/examples/themes/index.js +0 -7
  238. package/styled-components/es/examples/themes/plasma_b2c.module.css +0 -984
  239. package/styled-components/es/examples/themes/plasma_web.module.css +0 -984
  240. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts +0 -4
  241. package/types/components/Combobox/ComboboxNew/utils/getInitialValue.d.ts.map +0 -1
  242. package/types/components/Select/utils/getInitialValue.d.ts +0 -4
  243. package/types/components/Select/utils/getInitialValue.d.ts.map +0 -1
  244. package/types/examples/themes/index.d.ts +0 -6
  245. package/types/examples/themes/index.d.ts.map +0 -1
@@ -0,0 +1,65 @@
1
+ import React, { ComponentProps } from 'react';
2
+ import type { StoryObj, Meta } from '@storybook/react';
3
+
4
+ import { Button } from '../Button/Button';
5
+ import { TextField } from '../TextField/TextField';
6
+ import { Checkbox } from '../Checkbox/Checkbox';
7
+
8
+ import { ViewContainer } from './ViewContainer';
9
+
10
+ type StoryViewProps = ComponentProps<typeof ViewContainer>;
11
+
12
+ const meta: Meta<StoryViewProps> = {
13
+ title: 'plasma_web/ViewContainer',
14
+ };
15
+
16
+ export default meta;
17
+
18
+ type Story = StoryObj<StoryViewProps>;
19
+
20
+ const ViewExample = ({ view }: StoryViewProps) => {
21
+ const style = view
22
+ ? {
23
+ background: view === 'onDark' ? '#1a1a1a' : '#ededed',
24
+ color: view === 'onDark' ? 'white' : 'black',
25
+ }
26
+ : undefined;
27
+
28
+ return (
29
+ <>
30
+ <h4>view: {view ?? 'default'}</h4>
31
+ <div>
32
+ <ViewContainer
33
+ view={view}
34
+ style={{
35
+ ...style,
36
+ padding: '1rem',
37
+ borderRadius: '1rem',
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ gap: '1rem',
41
+ }}
42
+ >
43
+ <h3 style={{ margin: 0 }}>Inside ViewContainer</h3>
44
+ <Button text="default Button" />
45
+ <Checkbox checked label="Label" />
46
+ <TextField value="Example Value" label="Label" labelPlacement="inner" />
47
+ </ViewContainer>
48
+ </div>
49
+ </>
50
+ );
51
+ };
52
+
53
+ export const Default: Story = {
54
+ render: () => {
55
+ return (
56
+ <>
57
+ <ViewExample />
58
+ <br />
59
+ <ViewExample view="onDark" />
60
+ <br />
61
+ <ViewExample view="onLight" />
62
+ </>
63
+ );
64
+ },
65
+ };
@@ -673,4 +673,15 @@ Object.keys(_Attach).forEach(function (key) {
673
673
  return _Attach[key];
674
674
  }
675
675
  });
676
+ });
677
+ var _ViewContainer = /*#__PURE__*/require("./components/ViewContainer");
678
+ Object.keys(_ViewContainer).forEach(function (key) {
679
+ if (key === "default" || key === "__esModule") return;
680
+ if (key in exports && exports[key] === _ViewContainer[key]) return;
681
+ Object.defineProperty(exports, key, {
682
+ enumerable: true,
683
+ get: function get() {
684
+ return _ViewContainer[key];
685
+ }
686
+ });
676
687
  });
@@ -1,4 +1,4 @@
1
- var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "targetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect", "renderValue"];
1
+ var _excluded = ["multiple", "value", "onChange", "isTargetAmount", "items", "placement", "label", "placeholder", "helperText", "contentLeft", "textBefore", "textAfter", "variant", "listOverflow", "listHeight", "listWidth", "portal", "renderItem", "view", "size", "labelPlacement", "readOnly", "disabled", "alwaysOpened", "filter", "closeAfterSelect"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -16,7 +16,7 @@ import { sizeToIconSize } from '../../Select/utils';
16
16
  import { classes } from './Combobox.tokens';
17
17
  import { FloatingPopover } from './FloatingPopover';
18
18
  import { useKeyNavigation, getItemByFocused } from './hooks/useKeyboardNavigation';
19
- import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId, getInitialValue } from './utils';
19
+ import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, filterItems, getItemId } from './utils';
20
20
  import { Inner, StyledTextField } from './ui';
21
21
  import { pathReducer, focusedPathReducer } from './reducers';
22
22
  import { getPathMap, getTreeMaps } from './hooks/getPathMaps';
@@ -35,7 +35,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
35
35
  outerValue = props.value,
36
36
  outerOnChange = props.onChange,
37
37
  isTargetAmount = props.isTargetAmount,
38
- targetAmount = props.targetAmount,
39
38
  items = props.items,
40
39
  _props$placement = props.placement,
41
40
  placement = _props$placement === void 0 ? 'bottom-start' : _props$placement,
@@ -63,15 +62,10 @@ export var comboboxRoot = function comboboxRoot(Root) {
63
62
  alwaysOpened = _props$alwaysOpened === void 0 ? false : _props$alwaysOpened,
64
63
  filter = props.filter,
65
64
  outerCloseAfterSelect = props.closeAfterSelect,
66
- renderValue = props.renderValue,
67
65
  rest = _objectWithoutProperties(props, _excluded);
68
- var transformedItems = useMemo(function () {
69
- return initialItemsTransform(items || []);
70
- }, [items]);
71
-
72
66
  // Создаем структуры для быстрой работы с деревом
73
67
  var _useMemo = useMemo(function () {
74
- return getTreeMaps(transformedItems);
68
+ return getTreeMaps(items);
75
69
  }, [items]),
76
70
  _useMemo2 = _slicedToArray(_useMemo, 3),
77
71
  valueToCheckedMap = _useMemo2[0],
@@ -85,11 +79,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
85
79
  _useState4 = _slicedToArray(_useState3, 2),
86
80
  internalValue = _useState4[0],
87
81
  setInternalValue = _useState4[1];
88
- var value = outerValue !== null && outerValue !== undefined ? getInitialValue(outerValue, valueToItemMap) : internalValue;
82
+ var value = outerValue || internalValue;
89
83
  var inputRef = useRef(null);
90
84
  var floatingPopoverRef = useRef(null);
91
85
  var inputForkRef = useForkRef(inputRef, ref);
92
86
  var treeId = safeUseId();
87
+ var transformedItems = useMemo(function () {
88
+ return initialItemsTransform(items || []);
89
+ }, [items]);
93
90
  var filteredItems = filterItems(transformedItems, textValue, (_valueToItemMap$get2 = valueToItemMap.get(value)) === null || _valueToItemMap$get2 === void 0 ? void 0 : _valueToItemMap$get2.label, filter);
94
91
  var _useMemo3 = useMemo(function () {
95
92
  return getPathMap(filteredItems);
@@ -256,7 +253,16 @@ export var comboboxRoot = function comboboxRoot(Root) {
256
253
  if (e) {
257
254
  e.stopPropagation();
258
255
  }
259
- var isCurrentChecked = checked.get(item.value);
256
+ var checkedCopy = new Map(checked);
257
+ var isCurrentChecked = checkedCopy.get(item.value);
258
+ checkedCopy.forEach(function (_, key) {
259
+ checkedCopy.set(key, false);
260
+ });
261
+ if (!isCurrentChecked) {
262
+ checkedCopy.set(item.value, 'done');
263
+ updateSingleAncestors(item, checkedCopy, 'dot');
264
+ }
265
+ setTextValue(isCurrentChecked ? '' : item.label);
260
266
  if (!alwaysOpened && closeAfterSelect) {
261
267
  dispatchPath({
262
268
  type: 'reset'
@@ -270,18 +276,14 @@ export var comboboxRoot = function comboboxRoot(Root) {
270
276
  }
271
277
  };
272
278
  var getChips = function getChips() {
273
- if (multiple && Array.isArray(value)) {
279
+ if (multiple) {
274
280
  if (value.length === 0) return [];
275
281
  if (isTargetAmount) {
276
- return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(targetAmount || value.length)];
282
+ return ["\u0412\u044B\u0431\u0440\u0430\u043D\u043E ".concat(value.length)];
277
283
  }
278
- var renderValueMapper = renderValue && function (stringValue) {
279
- return renderValue(valueToItemMap.get(stringValue));
280
- };
281
- var valueToItemMapper = function valueToItemMapper(stringValue) {
282
- return valueToItemMap.get(stringValue).label;
283
- };
284
- return value.map(renderValueMapper || valueToItemMapper);
284
+ return value.map(function (value) {
285
+ return valueToItemMap.get(value).label;
286
+ });
285
287
  }
286
288
  return [];
287
289
  };
@@ -309,7 +311,6 @@ export var comboboxRoot = function comboboxRoot(Root) {
309
311
  // В данном эффекте мы следим за изменениями value снаружи и вносим коррективы в дерево чекбоксов.
310
312
  // Пример: когда юзер очистил value извне, тогда нужно пройтись по элементам и выключить все чекбоксы.
311
313
  useLayoutEffect(function () {
312
- var _valueToItemMap$get4;
313
314
  var checkedCopy = new Map(checked);
314
315
  checkedCopy.forEach(function (_, key) {
315
316
  checkedCopy.set(key, false);
@@ -327,12 +328,7 @@ export var comboboxRoot = function comboboxRoot(Root) {
327
328
  }
328
329
  }
329
330
  setChecked(checkedCopy);
330
- setTextValue(((_valueToItemMap$get4 = valueToItemMap.get(outerValue)) === null || _valueToItemMap$get4 === void 0 ? void 0 : _valueToItemMap$get4.label) || '');
331
-
332
- // В deps мы кладем именно outerValue и internalValue, а не просто value.
333
- // Т.к. вначале нужно отфильтровать и провалидировать outerValue и результат положить в переменную.
334
- // А переменную, содержащую сложные типы данных, нельзя помещать в deps.
335
- }, [outerValue, internalValue, items]);
331
+ }, [value]);
336
332
  return /*#__PURE__*/React.createElement(Root, {
337
333
  size: size,
338
334
  view: view,
@@ -4,5 +4,4 @@ export { updateAncestors } from './updateAncestors';
4
4
  export { updateSingleAncestors } from './updateSingleAncestors';
5
5
  export { sizeToIconSize } from './sizeToIconSize';
6
6
  export { filterItems } from './filterItems';
7
- export { getItemId } from './getItemId';
8
- export { getInitialValue } from './getInitialValue';
7
+ export { getItemId } from './getItemId';
@@ -1,25 +1,11 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
1
  // Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
14
2
  // Дает возможность прохода к корневому элементу (снизу вверх).
15
- // На выходе получаем глубокую копию исходного массива items.
16
3
  export var initialItemsTransform = function initialItemsTransform(items, parent) {
17
- return _toConsumableArray(items).map(function (item) {
18
- var itemCopy = _objectSpread({}, item);
19
- itemCopy.parent = parent;
20
- if (itemCopy.items) {
21
- itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
4
+ items.forEach(function (item) {
5
+ item.parent = parent;
6
+ if (item.items) {
7
+ item.items = initialItemsTransform(item.items, item);
22
8
  }
23
- return itemCopy;
24
9
  });
10
+ return items;
25
11
  };
@@ -3,13 +3,14 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
5
  import React, { forwardRef, useMemo } from 'react';
6
- import { useFocusTrap, useForkRef, safeUseId } from '@salutejs/plasma-core';
6
+ import { useForkRef, safeUseId } from '@salutejs/plasma-core';
7
7
  import { component, mergeConfig } from '../../engines';
8
8
  import { usePopupContext } from '../Popup';
9
9
  import { Overlay } from '../Overlay';
10
10
  import { DEFAULT_Z_INDEX } from '../Popup/utils';
11
11
  import { panelConfig } from '../Panel';
12
12
  import { cx, getSizeValueFromProp } from '../../utils';
13
+ import { useFocusTrap } from '../../hooks';
13
14
  import { classes, tokens } from './Drawer.tokens';
14
15
  import { base as viewCSS } from './variations/_view/base';
15
16
  import { base as sizeCSS } from './variations/_size/base';
@@ -17,8 +17,8 @@ export var PaginationSelectPerPage = function PaginationSelectPerPage(_ref) {
17
17
  listWidth = _ref.listWidth,
18
18
  rest = _objectWithoutProperties(_ref, _excluded);
19
19
  var handleSelectChange = function handleSelectChange(newValue) {
20
- if (newValue && !Array.isArray(newValue) && onChangeValue) {
21
- onChangeValue(Number(newValue));
20
+ if (newValue) {
21
+ onChangeValue === null || onChangeValue === void 0 || onChangeValue(Number(newValue));
22
22
  }
23
23
  };
24
24
  var transformedList = perPageList.map(function (num) {
@@ -12,7 +12,7 @@ import React, { forwardRef, useState, useReducer, useMemo, createContext, useLay
12
12
  import { isEmpty, getPlacements } from '../../utils';
13
13
  import { useOutsideClick } from '../../hooks';
14
14
  import { useKeyNavigation } from './hooks/useKeyboardNavigation';
15
- import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView, getInitialValue } from './utils';
15
+ import { initialItemsTransform, updateAncestors, updateDescendants, updateSingleAncestors, getView } from './utils';
16
16
  import { Inner, Target } from './ui';
17
17
  import { pathReducer, focusedPathReducer, focusedChipIndexReducer } from './reducers';
18
18
  import { usePathMaps } from './hooks/usePathMaps';
@@ -58,6 +58,17 @@ export var selectRoot = function selectRoot(Root) {
58
58
  separator = props.separator,
59
59
  outerCloseAfterSelect = props.closeAfterSelect,
60
60
  rest = _objectWithoutProperties(props, _excluded);
61
+ var _useState = useState(outerValue || props.multiselect ? [] : ''),
62
+ _useState2 = _slicedToArray(_useState, 2),
63
+ internalValue = _useState2[0],
64
+ setInternalValue = _useState2[1];
65
+ var value = outerValue || internalValue;
66
+ var onChange = function onChange(e) {
67
+ if (outerOnChange) {
68
+ outerOnChange(e);
69
+ }
70
+ setInternalValue(e);
71
+ };
61
72
  var transformedItems = useMemo(function () {
62
73
  return initialItemsTransform(items || []);
63
74
  }, [items]);
@@ -67,12 +78,6 @@ export var selectRoot = function selectRoot(Root) {
67
78
  focusedToValueMap = _usePathMaps2[1],
68
79
  valueToCheckedMap = _usePathMaps2[2],
69
80
  valueToItemMap = _usePathMaps2[3];
70
- var value = getInitialValue(outerValue, valueToItemMap);
71
- var onChange = function onChange(e) {
72
- if (outerOnChange) {
73
- outerOnChange(e);
74
- }
75
- };
76
81
  var _useReducer = useReducer(pathReducer, []),
77
82
  _useReducer2 = _slicedToArray(_useReducer, 2),
78
83
  path = _useReducer2[0],
@@ -85,10 +90,10 @@ export var selectRoot = function selectRoot(Root) {
85
90
  _useReducer6 = _slicedToArray(_useReducer5, 2),
86
91
  focusedChipIndex = _useReducer6[0],
87
92
  dispatchFocusedChipIndex = _useReducer6[1];
88
- var _useState = useState(valueToCheckedMap),
89
- _useState2 = _slicedToArray(_useState, 2),
90
- checked = _useState2[0],
91
- setChecked = _useState2[1];
93
+ var _useState3 = useState(valueToCheckedMap),
94
+ _useState4 = _slicedToArray(_useState3, 2),
95
+ checked = _useState4[0],
96
+ setChecked = _useState4[1];
92
97
  var closeAfterSelect = outerCloseAfterSelect !== null && outerCloseAfterSelect !== void 0 ? outerCloseAfterSelect : !props.multiselect;
93
98
  var targetRef = useOutsideClick(function () {
94
99
  if (focusedChipIndex != null) {
@@ -154,7 +159,15 @@ export var selectRoot = function selectRoot(Root) {
154
159
  if (e) {
155
160
  e.stopPropagation();
156
161
  }
157
- var isCurrentChecked = checked.get(item.value);
162
+ var checkedCopy = new Map(checked);
163
+ var isCurrentChecked = checkedCopy.get(item.value);
164
+ checkedCopy.forEach(function (_, key) {
165
+ checkedCopy.set(key, false);
166
+ });
167
+ if (!isCurrentChecked) {
168
+ checkedCopy.set(item.value, 'done');
169
+ updateSingleAncestors(item, checkedCopy, 'dot');
170
+ }
158
171
  if (closeAfterSelect) {
159
172
  dispatchPath({
160
173
  type: 'reset'
@@ -226,7 +239,7 @@ export var selectRoot = function selectRoot(Root) {
226
239
  }
227
240
  }
228
241
  setChecked(checkedCopy);
229
- }, [outerValue, items]);
242
+ }, [value]);
230
243
  return /*#__PURE__*/React.createElement(Root, _extends({
231
244
  ref: ref,
232
245
  size: size,
@@ -153,7 +153,7 @@ export var useKeyNavigation = function useKeyNavigation(_ref) {
153
153
  }
154
154
  case keys.Backspace:
155
155
  {
156
- if (!multiselect || !Array.isArray(value)) break;
156
+ if (!multiselect) break;
157
157
  if (focusedChipIndex !== null) {
158
158
  var _currentItem = valueToItemMap.get(value[focusedChipIndex]);
159
159
  handlePressDown(_currentItem);
@@ -34,7 +34,7 @@ var getLabel = function getLabel(_ref) {
34
34
  text: renderValue ? renderValue(valueToItemMap.get(currentValue)) : itemLabel,
35
35
  onClick: function onClick(e) {
36
36
  e.stopPropagation();
37
- onChipClick(currentValue.toString());
37
+ onChipClick(currentValue);
38
38
  },
39
39
  focused: focusedChipIndex === index
40
40
  });
@@ -47,7 +47,7 @@ export var ChipWrapper = /*#__PURE__*/styled.div.withConfig({
47
47
  })(["width:100%;display:flex;min-width:0;padding:", ";gap:0.25rem;overflow-x:scroll;border-top-right-radius:var(", ");border-bottom-right-radius:var(", ");-ms-overflow-style:none;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"], function (_ref6) {
48
48
  var multiselect = _ref6.multiselect,
49
49
  value = _ref6.value;
50
- return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.toString().length > 0 ? "var(".concat(tokens.focusOffset, ")") : 0, ")");
50
+ return "calc(".concat(constants.focusSize, " + ").concat(multiselect && value && value.length > 0 ? "var(".concat(tokens.focusOffset, ")") : 0, ")");
51
51
  }, tokens.chipBorderRadius, tokens.chipBorderRadius);
52
52
  export var Label = /*#__PURE__*/styled.label.withConfig({
53
53
  componentId: "plasma-new-hope__sc-1akl2tk-6"
@@ -16,7 +16,7 @@ export var getButtonLabel = function getButtonLabel(_ref3) {
16
16
  if (isEmpty(value) && typeof value !== 'number') {
17
17
  return label || '';
18
18
  }
19
- if (selectProps.multiselect && Array.isArray(value) && selectProps.isTargetAmount) {
19
+ if (selectProps.multiselect && selectProps.isTargetAmount) {
20
20
  return "\u0412\u044B\u0431\u0440\u0430\u043D\u043E: ".concat(value.length);
21
21
  }
22
22
  if (selectProps.multiselect && Array.isArray(value)) {
@@ -5,5 +5,4 @@ export { updateSingleAncestors } from './updateSingleAncestors';
5
5
  export { sizeToIconSize } from './sizeToIconSize';
6
6
  export { getCorrectHeight } from './getCorrectHeight';
7
7
  export { getButtonLabel } from './getButtonLabel';
8
- export { getView } from './getView';
9
- export { getInitialValue } from './getInitialValue';
8
+ export { getView } from './getView';
@@ -1,25 +1,12 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
8
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
11
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
13
1
  // Проходимся по массиву items и добавляем в каждый item ключ parent, который ссылается на item родителя.
14
2
  // Дает возможность прохода к корневому элементу (снизу вверх).
15
- // На выходе получаем глубокую копию исходного массива items.
3
+
16
4
  export var initialItemsTransform = function initialItemsTransform(items, parent) {
17
- return _toConsumableArray(items).map(function (item) {
18
- var itemCopy = _objectSpread({}, item);
19
- itemCopy.parent = parent;
20
- if (itemCopy.items) {
21
- itemCopy.items = initialItemsTransform(itemCopy.items, itemCopy);
5
+ items.forEach(function (item) {
6
+ item.parent = parent;
7
+ if (item.items) {
8
+ item.items = initialItemsTransform(item.items, item);
22
9
  }
23
- return itemCopy;
24
10
  });
11
+ return items;
25
12
  };
@@ -0,0 +1,31 @@
1
+ var _excluded = ["children"];
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
5
+ import React, { forwardRef } from 'react';
6
+ import { css } from 'styled-components';
7
+ import { base as viewCSS } from './_view/base';
8
+ var base = /*#__PURE__*/css(["position:relative;"]);
9
+ export var viewContainerRoot = function viewContainerRoot(Root) {
10
+ return /*#__PURE__*/forwardRef(function (props, ref) {
11
+ var children = props.children,
12
+ rest = _objectWithoutProperties(props, _excluded);
13
+ return /*#__PURE__*/React.createElement(Root, _extends({
14
+ ref: ref
15
+ }, rest), children);
16
+ });
17
+ };
18
+ export var viewContainerConfig = {
19
+ name: 'ViewContainer',
20
+ tag: 'div',
21
+ layout: viewContainerRoot,
22
+ base: base,
23
+ variations: {
24
+ view: {
25
+ css: viewCSS
26
+ }
27
+ },
28
+ defaults: {
29
+ view: undefined
30
+ }
31
+ };
@@ -0,0 +1,82 @@
1
+ ---
2
+ id: viewContainer
3
+ title: ViewContainer
4
+ ---
5
+
6
+ import { PropsTable, Description } from '@site/src/components';
7
+
8
+ # ViewContainer
9
+ <Description name="ViewContainer" />
10
+ <PropsTable name="ViewContainer" exclude={['css']} />
11
+
12
+ # Описание
13
+
14
+ Данный компонент представляет собой обёртку, которая инвертирует токены компонент, которые в неё помещены, в зависимости от выбранного значения свойства view - `onDark` или `onLight`.
15
+
16
+ При этом, независимо от режима темы (тёмный или светлый) для всего приложения, токены внутри не будут меняться.
17
+
18
+ Этот механизм необходим для случаев, когда требуется отобразить компонент на специфичном бэкграунде, чтобы избежать наложение цветов.
19
+
20
+ # Пример использования
21
+
22
+ ```tsx live
23
+ import React from 'react';
24
+ import { ViewContainer, Button, Checkbox, TextField } from '@salutejs/{{ package }}';
25
+
26
+ export function App() {
27
+ return (
28
+ <div>
29
+ <ViewContainer
30
+ style=\{{
31
+ padding: '1rem',
32
+ borderRadius: '1rem',
33
+ display: 'flex',
34
+ flexDirection: 'column',
35
+ gap: '1rem',
36
+ }}
37
+ >
38
+ <h3 style=\{{ margin: 0 }}>Inside default ViewContainer</h3>
39
+ <Button text="default Button" />
40
+ <Checkbox checked label="Label" />
41
+ <TextField value="Example Value" label="Label" labelPlacement="inner" />
42
+ </ViewContainer>
43
+ <br />
44
+ <ViewContainer
45
+ view="onDark"
46
+ style=\{{
47
+ background: '#1a1a1a',
48
+ color: 'white',
49
+ padding: '1rem',
50
+ borderRadius: '1rem',
51
+ display: 'flex',
52
+ flexDirection: 'column',
53
+ gap: '1rem',
54
+ }}
55
+ >
56
+ <h3 style=\{{ margin: 0 }}>Inside onDark ViewContainer</h3>
57
+ <Button text="default Button" />
58
+ <Checkbox checked label="Label" />
59
+ <TextField value="Example Value" label="Label" labelPlacement="inner" />
60
+ </ViewContainer>
61
+ <br />
62
+ <ViewContainer
63
+ view="onLight"
64
+ style=\{{
65
+ background: '#ededed',
66
+ color: 'black',
67
+ padding: '1rem',
68
+ borderRadius: '1rem',
69
+ display: 'flex',
70
+ flexDirection: 'column',
71
+ gap: '1rem',
72
+ }}
73
+ >
74
+ <h3 style=\{{ margin: 0 }}>Inside onLight ViewContainer</h3>
75
+ <Button text="default Button" />
76
+ <Checkbox checked label="Label" />
77
+ <TextField value="Example Value" label="Label" labelPlacement="inner" />
78
+ </ViewContainer>
79
+ </div>
80
+ );
81
+ }
82
+ ```
@@ -0,0 +1,2 @@
1
+ import { css } from 'styled-components';
2
+ export var base = /*#__PURE__*/css([""]);
@@ -0,0 +1 @@
1
+ export { viewContainerRoot, viewContainerConfig } from './ViewContainer';
@@ -6,20 +6,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
6
6
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
8
  import React from 'react';
9
- import { themes } from './themes';
10
- export var WithTheme = function WithTheme(Story, context) {
11
- var _themes$themeName;
12
- var themeType = context.globals.theme;
13
- var themeName = context.title.split('/')[0];
14
- return /*#__PURE__*/React.createElement("div", {
15
- id: "theme-root",
16
- className: themes === null || themes === void 0 || (_themes$themeName = themes[themeName]) === null || _themes$themeName === void 0 ? void 0 : _themes$themeName[themeType],
17
- style: {
18
- padding: '1rem',
19
- minHeight: '100vh',
20
- boxSizing: 'border-box'
21
- }
22
- }, /*#__PURE__*/React.createElement(Story, null));
9
+ // TODO: Удалить в отдельном пр из всех компонент
10
+ export var WithTheme = function WithTheme(Story) {
11
+ return /*#__PURE__*/React.createElement(Story, null);
23
12
  };
24
13
  export function argTypesFromConfig(config) {
25
14
  var exclude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -68,10 +68,6 @@ const meta: Meta<StorySelectProps> = {
68
68
  control: { type: 'boolean' },
69
69
  if: { arg: 'alwaysOpened', truthy: false },
70
70
  },
71
- targetAmount: {
72
- control: { type: 'number' },
73
- if: { arg: 'isTargetAmount', truthy: true },
74
- },
75
71
  },
76
72
  args: {
77
73
  label: 'Label',
@@ -82,7 +78,6 @@ const meta: Meta<StorySelectProps> = {
82
78
  view: 'default',
83
79
  enableContentLeft: false,
84
80
  isTargetAmount: false,
85
- targetAmount: undefined,
86
81
  variant: 'normal',
87
82
  alwaysOpened: false,
88
83
  disabled: false,
@@ -99,7 +94,6 @@ const meta: Meta<StorySelectProps> = {
99
94
  'placeholder',
100
95
  'helperText',
101
96
  'isTargetAmount',
102
- 'targetAmount',
103
97
  'closeAfterSelect',
104
98
  'alwaysOpened',
105
99
  'variant',
@@ -0,0 +1,10 @@
1
+ import { css } from 'styled-components';
2
+ import { viewContainer } from '@salutejs/plasma-themes/tokens/plasma_b2c';
3
+ export var config = {
4
+ variations: {
5
+ view: {
6
+ onDark: /*#__PURE__*/css(["", ""], viewContainer.dark),
7
+ onLight: /*#__PURE__*/css(["", ""], viewContainer.light)
8
+ }
9
+ }
10
+ };
@@ -0,0 +1,5 @@
1
+ import { viewContainerConfig } from '../../../../components/ViewContainer';
2
+ import { component, mergeConfig } from '../../../../engines';
3
+ import { config } from './ViewContainer.config';
4
+ var mergedConfig = /*#__PURE__*/mergeConfig(viewContainerConfig, config);
5
+ export var ViewContainer = /*#__PURE__*/component(mergedConfig);