@salutejs/plasma-new-hope 0.88.0-canary.1223.9316788273.0 → 0.88.0-canary.1225.9347054103.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. package/cjs/components/Sheet/Sheet.css +5 -0
  2. package/cjs/components/Sheet/Sheet.js +91 -0
  3. package/cjs/components/Sheet/Sheet.js.map +1 -0
  4. package/cjs/components/Sheet/Sheet.styles.js +62 -0
  5. package/cjs/components/Sheet/Sheet.styles.js.map +1 -0
  6. package/cjs/components/Sheet/Sheet.styles_1bm46e7.css +5 -0
  7. package/cjs/components/Sheet/Sheet.tokens.js +16 -0
  8. package/cjs/components/Sheet/Sheet.tokens.js.map +1 -0
  9. package/cjs/components/Sheet/hooks/useSheet.js +26 -0
  10. package/cjs/components/Sheet/hooks/useSheet.js.map +1 -0
  11. package/cjs/components/Sheet/hooks/useSheetSwipe.js +98 -0
  12. package/cjs/components/Sheet/hooks/useSheetSwipe.js.map +1 -0
  13. package/cjs/components/Sheet/hooks/useThemeContext.js +17 -0
  14. package/cjs/components/Sheet/hooks/useThemeContext.js.map +1 -0
  15. package/cjs/components/Sheet/utils/handleTransition.js +14 -0
  16. package/cjs/components/Sheet/utils/handleTransition.js.map +1 -0
  17. package/cjs/components/{Accordion/variations/_size → Sheet/variations/_view}/base.js +1 -1
  18. package/cjs/components/Sheet/variations/_view/base.js.map +1 -0
  19. package/cjs/index.css +6 -2
  20. package/cjs/index.js +6 -8
  21. package/cjs/index.js.map +1 -1
  22. package/es/components/Sheet/Sheet.css +5 -0
  23. package/es/components/Sheet/Sheet.js +86 -0
  24. package/es/components/Sheet/Sheet.js.map +1 -0
  25. package/es/components/Sheet/Sheet.styles.js +54 -0
  26. package/es/components/Sheet/Sheet.styles.js.map +1 -0
  27. package/es/components/Sheet/Sheet.styles_1bm46e7.css +5 -0
  28. package/es/components/Sheet/Sheet.tokens.js +11 -0
  29. package/es/components/Sheet/Sheet.tokens.js.map +1 -0
  30. package/es/components/Sheet/hooks/useSheet.js +22 -0
  31. package/es/components/Sheet/hooks/useSheet.js.map +1 -0
  32. package/es/components/Sheet/hooks/useSheetSwipe.js +94 -0
  33. package/es/components/Sheet/hooks/useSheetSwipe.js.map +1 -0
  34. package/es/components/Sheet/hooks/useThemeContext.js +13 -0
  35. package/es/components/Sheet/hooks/useThemeContext.js.map +1 -0
  36. package/es/components/Sheet/utils/handleTransition.js +10 -0
  37. package/es/components/Sheet/utils/handleTransition.js.map +1 -0
  38. package/es/components/{Accordion → Sheet}/variations/_view/base.js +1 -1
  39. package/es/components/Sheet/variations/_view/base.js.map +1 -0
  40. package/es/index.css +6 -2
  41. package/es/index.js +2 -3
  42. package/es/index.js.map +1 -1
  43. package/package.json +4 -2
  44. package/styled-components/cjs/components/Sheet/Sheet.js +90 -0
  45. package/styled-components/cjs/components/Sheet/Sheet.styles.js +28 -0
  46. package/styled-components/cjs/components/Sheet/Sheet.tokens.js +14 -0
  47. package/styled-components/cjs/components/Sheet/hooks/index.js +26 -0
  48. package/styled-components/cjs/components/Sheet/hooks/useSheet.js +24 -0
  49. package/styled-components/cjs/components/Sheet/hooks/useSheetSwipe.js +102 -0
  50. package/styled-components/cjs/components/Sheet/hooks/useThemeContext.js +15 -0
  51. package/styled-components/cjs/components/Sheet/index.js +31 -0
  52. package/styled-components/cjs/components/Sheet/utils/handleTransition.js +13 -0
  53. package/styled-components/cjs/components/Sheet/utils/index.js +12 -0
  54. package/styled-components/cjs/components/Sheet/variations/_view/tokens.json +3 -0
  55. package/styled-components/cjs/components/_Icon/index.js +1 -15
  56. package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.config.js +18 -0
  57. package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.js +17 -0
  58. package/styled-components/cjs/examples/plasma_b2c/components/Sheet/Sheet.stories.tsx +239 -0
  59. package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.config.js +18 -0
  60. package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.js +17 -0
  61. package/styled-components/cjs/examples/plasma_web/components/Sheet/Sheet.stories.tsx +239 -0
  62. package/styled-components/cjs/index.js +11 -11
  63. package/styled-components/es/components/Sheet/Sheet.js +82 -0
  64. package/styled-components/es/components/Sheet/Sheet.styles.js +21 -0
  65. package/styled-components/es/components/Sheet/Sheet.tokens.js +8 -0
  66. package/styled-components/es/components/Sheet/hooks/index.js +3 -0
  67. package/styled-components/es/components/Sheet/hooks/useSheet.js +18 -0
  68. package/styled-components/es/components/Sheet/hooks/useSheetSwipe.js +95 -0
  69. package/styled-components/es/components/Sheet/hooks/useThemeContext.js +9 -0
  70. package/styled-components/es/components/Sheet/index.js +2 -0
  71. package/styled-components/es/components/Sheet/utils/handleTransition.js +7 -0
  72. package/styled-components/es/components/Sheet/utils/index.js +1 -0
  73. package/styled-components/es/components/Sheet/variations/_view/tokens.json +3 -0
  74. package/styled-components/es/components/_Icon/index.js +1 -3
  75. package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.config.js +12 -0
  76. package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.js +6 -0
  77. package/styled-components/es/examples/plasma_b2c/components/Sheet/Sheet.stories.tsx +239 -0
  78. package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.config.js +12 -0
  79. package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.js +6 -0
  80. package/styled-components/es/examples/plasma_web/components/Sheet/Sheet.stories.tsx +239 -0
  81. package/styled-components/es/index.js +2 -2
  82. package/types/components/Sheet/Sheet.d.ts +22 -0
  83. package/types/components/Sheet/Sheet.d.ts.map +1 -0
  84. package/types/components/Sheet/Sheet.styles.d.ts +13 -0
  85. package/types/components/Sheet/Sheet.styles.d.ts.map +1 -0
  86. package/types/components/Sheet/Sheet.tokens.d.ts +9 -0
  87. package/types/components/Sheet/Sheet.tokens.d.ts.map +1 -0
  88. package/types/components/Sheet/Sheet.types.d.ts +35 -0
  89. package/types/components/Sheet/Sheet.types.d.ts.map +1 -0
  90. package/types/components/Sheet/hooks/index.d.ts +4 -0
  91. package/types/components/Sheet/hooks/index.d.ts.map +1 -0
  92. package/types/components/Sheet/hooks/useSheet.d.ts +3 -0
  93. package/types/components/Sheet/hooks/useSheet.d.ts.map +1 -0
  94. package/types/components/Sheet/hooks/useSheetSwipe.d.ts +9 -0
  95. package/types/components/Sheet/hooks/useSheetSwipe.d.ts.map +1 -0
  96. package/types/components/Sheet/hooks/useThemeContext.d.ts +7 -0
  97. package/types/components/Sheet/hooks/useThemeContext.d.ts.map +1 -0
  98. package/types/components/Sheet/index.d.ts +4 -0
  99. package/types/components/Sheet/index.d.ts.map +1 -0
  100. package/types/components/Sheet/utils/handleTransition.d.ts +5 -0
  101. package/types/components/Sheet/utils/handleTransition.d.ts.map +1 -0
  102. package/types/components/Sheet/utils/index.d.ts +2 -0
  103. package/types/components/Sheet/utils/index.d.ts.map +1 -0
  104. package/types/components/Sheet/variations/_view/base.d.ts.map +1 -0
  105. package/types/components/_Icon/index.d.ts +0 -2
  106. package/types/components/_Icon/index.d.ts.map +1 -1
  107. package/types/examples/plasma_b2c/components/Sheet/Sheet.config.d.ts +11 -0
  108. package/types/examples/plasma_b2c/components/Sheet/Sheet.config.d.ts.map +1 -0
  109. package/types/examples/plasma_b2c/components/Sheet/Sheet.d.ts +8 -0
  110. package/types/examples/plasma_b2c/components/Sheet/Sheet.d.ts.map +1 -0
  111. package/types/examples/plasma_web/components/Sheet/Sheet.config.d.ts +11 -0
  112. package/types/examples/plasma_web/components/Sheet/Sheet.config.d.ts.map +1 -0
  113. package/types/examples/plasma_web/components/Sheet/Sheet.d.ts +8 -0
  114. package/types/examples/plasma_web/components/Sheet/Sheet.d.ts.map +1 -0
  115. package/types/index.d.ts +1 -1
  116. package/types/index.d.ts.map +1 -1
  117. package/cjs/components/Accordion/Accordion.css +0 -1
  118. package/cjs/components/Accordion/Accordion.js +0 -50
  119. package/cjs/components/Accordion/Accordion.js.map +0 -1
  120. package/cjs/components/Accordion/Accordion.styles.js +0 -9
  121. package/cjs/components/Accordion/Accordion.styles.js.map +0 -1
  122. package/cjs/components/Accordion/Accordion.styles_1mo1sxr.css +0 -1
  123. package/cjs/components/Accordion/Accordion.tokens.js +0 -45
  124. package/cjs/components/Accordion/Accordion.tokens.js.map +0 -1
  125. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -93
  126. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js.map +0 -1
  127. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -63
  128. package/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +0 -1
  129. package/cjs/components/Accordion/variations/_size/base.js.map +0 -1
  130. package/cjs/components/Accordion/variations/_view/base.js +0 -9
  131. package/cjs/components/Accordion/variations/_view/base.js.map +0 -1
  132. package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +0 -33
  133. package/cjs/components/_Icon/Icon.assets/ChevronDownFill.js.map +0 -1
  134. package/cjs/components/_Icon/Icon.assets/Minus.js +0 -22
  135. package/cjs/components/_Icon/Icon.assets/Minus.js.map +0 -1
  136. package/cjs/components/_Icon/Icons/IconChevronDownFill.js +0 -23
  137. package/cjs/components/_Icon/Icons/IconChevronDownFill.js.map +0 -1
  138. package/cjs/components/_Icon/Icons/IconMinus.js +0 -23
  139. package/cjs/components/_Icon/Icons/IconMinus.js.map +0 -1
  140. package/es/components/Accordion/Accordion.css +0 -1
  141. package/es/components/Accordion/Accordion.js +0 -45
  142. package/es/components/Accordion/Accordion.js.map +0 -1
  143. package/es/components/Accordion/Accordion.styles.js +0 -5
  144. package/es/components/Accordion/Accordion.styles.js.map +0 -1
  145. package/es/components/Accordion/Accordion.styles_1mo1sxr.css +0 -1
  146. package/es/components/Accordion/Accordion.tokens.js +0 -40
  147. package/es/components/Accordion/Accordion.tokens.js.map +0 -1
  148. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -89
  149. package/es/components/Accordion/ui/AccordionItem/AccordionItem.js.map +0 -1
  150. package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -49
  151. package/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js.map +0 -1
  152. package/es/components/Accordion/variations/_size/base.js +0 -5
  153. package/es/components/Accordion/variations/_size/base.js.map +0 -1
  154. package/es/components/Accordion/variations/_size/base_x642ct.css +0 -1
  155. package/es/components/Accordion/variations/_view/base.js.map +0 -1
  156. package/es/components/Accordion/variations/_view/base_x642ct.css +0 -1
  157. package/es/components/_Icon/Icon.assets/ChevronDownFill.js +0 -29
  158. package/es/components/_Icon/Icon.assets/ChevronDownFill.js.map +0 -1
  159. package/es/components/_Icon/Icon.assets/Minus.js +0 -18
  160. package/es/components/_Icon/Icon.assets/Minus.js.map +0 -1
  161. package/es/components/_Icon/Icons/IconChevronDownFill.js +0 -19
  162. package/es/components/_Icon/Icons/IconChevronDownFill.js.map +0 -1
  163. package/es/components/_Icon/Icons/IconMinus.js +0 -19
  164. package/es/components/_Icon/Icons/IconMinus.js.map +0 -1
  165. package/styled-components/cjs/components/Accordion/Accordion.js +0 -50
  166. package/styled-components/cjs/components/Accordion/Accordion.styles.js +0 -9
  167. package/styled-components/cjs/components/Accordion/Accordion.tokens.js +0 -43
  168. package/styled-components/cjs/components/Accordion/index.js +0 -38
  169. package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -99
  170. package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -49
  171. package/styled-components/cjs/components/Accordion/ui/AccordionItem/AccordionItem.types.js +0 -5
  172. package/styled-components/cjs/components/Accordion/variations/_size/tokens.json +0 -6
  173. package/styled-components/cjs/components/Accordion/variations/_stretching/base.js +0 -8
  174. package/styled-components/cjs/components/Accordion/variations/_stretching/tokens.json +0 -1
  175. package/styled-components/cjs/components/Accordion/variations/_view/base.js +0 -8
  176. package/styled-components/cjs/components/Accordion/variations/_view/tokens.json +0 -8
  177. package/styled-components/cjs/components/_Icon/Icon.assets/ChevronDownFill.js +0 -32
  178. package/styled-components/cjs/components/_Icon/Icon.assets/Minus.js +0 -21
  179. package/styled-components/cjs/components/_Icon/Icons/IconChevronDownFill.js +0 -22
  180. package/styled-components/cjs/components/_Icon/Icons/IconMinus.js +0 -22
  181. package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -30
  182. package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.js +0 -17
  183. package/styled-components/cjs/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +0 -75
  184. package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.config.js +0 -30
  185. package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.js +0 -17
  186. package/styled-components/cjs/examples/plasma_web/components/Accordion/Accordion.stories.tsx +0 -75
  187. package/styled-components/es/components/Accordion/Accordion.js +0 -41
  188. package/styled-components/es/components/Accordion/Accordion.styles.js +0 -3
  189. package/styled-components/es/components/Accordion/Accordion.tokens.js +0 -37
  190. package/styled-components/es/components/Accordion/index.js +0 -3
  191. package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.js +0 -90
  192. package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.styles.js +0 -42
  193. package/styled-components/es/components/Accordion/ui/AccordionItem/AccordionItem.types.js +0 -1
  194. package/styled-components/es/components/Accordion/variations/_size/tokens.json +0 -6
  195. package/styled-components/es/components/Accordion/variations/_stretching/base.js +0 -2
  196. package/styled-components/es/components/Accordion/variations/_stretching/tokens.json +0 -1
  197. package/styled-components/es/components/Accordion/variations/_view/base.js +0 -2
  198. package/styled-components/es/components/Accordion/variations/_view/tokens.json +0 -8
  199. package/styled-components/es/components/_Icon/Icon.assets/ChevronDownFill.js +0 -25
  200. package/styled-components/es/components/_Icon/Icon.assets/Minus.js +0 -14
  201. package/styled-components/es/components/_Icon/Icons/IconChevronDownFill.js +0 -15
  202. package/styled-components/es/components/_Icon/Icons/IconMinus.js +0 -15
  203. package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.config.js +0 -24
  204. package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.js +0 -6
  205. package/styled-components/es/examples/plasma_b2c/components/Accordion/Accordion.stories.tsx +0 -75
  206. package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.config.js +0 -24
  207. package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.js +0 -6
  208. package/styled-components/es/examples/plasma_web/components/Accordion/Accordion.stories.tsx +0 -75
  209. package/types/components/Accordion/Accordion.d.ts +0 -35
  210. package/types/components/Accordion/Accordion.d.ts.map +0 -1
  211. package/types/components/Accordion/Accordion.styles.d.ts +0 -2
  212. package/types/components/Accordion/Accordion.styles.d.ts.map +0 -1
  213. package/types/components/Accordion/Accordion.tokens.d.ts +0 -38
  214. package/types/components/Accordion/Accordion.tokens.d.ts.map +0 -1
  215. package/types/components/Accordion/Accordion.types.d.ts +0 -24
  216. package/types/components/Accordion/Accordion.types.d.ts.map +0 -1
  217. package/types/components/Accordion/index.d.ts +0 -5
  218. package/types/components/Accordion/index.d.ts.map +0 -1
  219. package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts +0 -4
  220. package/types/components/Accordion/ui/AccordionItem/AccordionItem.d.ts.map +0 -1
  221. package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts +0 -13
  222. package/types/components/Accordion/ui/AccordionItem/AccordionItem.styles.d.ts.map +0 -1
  223. package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts +0 -43
  224. package/types/components/Accordion/ui/AccordionItem/AccordionItem.types.d.ts.map +0 -1
  225. package/types/components/Accordion/variations/_size/base.d.ts.map +0 -1
  226. package/types/components/Accordion/variations/_stretching/base.d.ts +0 -2
  227. package/types/components/Accordion/variations/_stretching/base.d.ts.map +0 -1
  228. package/types/components/Accordion/variations/_view/base.d.ts +0 -2
  229. package/types/components/Accordion/variations/_view/base.d.ts.map +0 -1
  230. package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts +0 -4
  231. package/types/components/_Icon/Icon.assets/ChevronDownFill.d.ts.map +0 -1
  232. package/types/components/_Icon/Icon.assets/Minus.d.ts +0 -4
  233. package/types/components/_Icon/Icon.assets/Minus.d.ts.map +0 -1
  234. package/types/components/_Icon/Icons/IconChevronDownFill.d.ts +0 -4
  235. package/types/components/_Icon/Icons/IconChevronDownFill.d.ts.map +0 -1
  236. package/types/components/_Icon/Icons/IconMinus.d.ts +0 -4
  237. package/types/components/_Icon/Icons/IconMinus.d.ts.map +0 -1
  238. package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts +0 -23
  239. package/types/examples/plasma_b2c/components/Accordion/Accordion.config.d.ts.map +0 -1
  240. package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts +0 -26
  241. package/types/examples/plasma_b2c/components/Accordion/Accordion.d.ts.map +0 -1
  242. package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts +0 -23
  243. package/types/examples/plasma_web/components/Accordion/Accordion.config.d.ts.map +0 -1
  244. package/types/examples/plasma_web/components/Accordion/Accordion.d.ts +0 -26
  245. package/types/examples/plasma_web/components/Accordion/Accordion.d.ts.map +0 -1
  246. /package/cjs/components/{Accordion/variations/_size → Sheet/variations/_view}/base_x642ct.css +0 -0
  247. /package/cjs/components/{Accordion/ui/AccordionItem/AccordionItem.css → _Icon/Icons/IconClose.css} +0 -0
  248. /package/{cjs/components/Accordion → es/components/Sheet}/variations/_view/base_x642ct.css +0 -0
  249. /package/es/components/{Accordion/ui/AccordionItem/AccordionItem.css → _Icon/Icons/IconClose.css} +0 -0
  250. /package/styled-components/cjs/components/{Accordion/Accordion.types.js → Sheet/Sheet.types.js} +0 -0
  251. /package/styled-components/cjs/components/{Accordion/variations/_size → Sheet/variations/_view}/base.js +0 -0
  252. /package/styled-components/es/components/{Accordion/Accordion.types.js → Sheet/Sheet.types.js} +0 -0
  253. /package/styled-components/es/components/{Accordion/variations/_size → Sheet/variations/_view}/base.js +0 -0
  254. /package/types/components/{Accordion/variations/_size → Sheet/variations/_view}/base.d.ts +0 -0
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSheetSwipe = void 0;
7
+ var _lodash = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("lodash.throttle"));
8
+ var _react = /*#__PURE__*/require("react");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
+ 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."); }
12
+ 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); }
13
+ 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; }
14
+ 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; } }
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+ var SWIPE_THRESHOLD = 0.2;
17
+ var THROTTLE_DEFAULT_MS = 0;
18
+ var isScrollable = function isScrollable(element) {
19
+ if (!element) {
20
+ return false;
21
+ }
22
+ var style = getComputedStyle(element);
23
+ return style.overflow === 'scroll' || style.overflow === 'auto' || style.overflowY === 'scroll' || style.overflowY === 'auto';
24
+ };
25
+ var useSheetSwipe = exports.useSheetSwipe = function useSheetSwipe(args) {
26
+ var contentWrapperRef = args.contentWrapperRef,
27
+ contentRef = args.contentRef,
28
+ handleRef = args.handleRef,
29
+ onClose = args.onClose,
30
+ _args$throttleMs = args.throttleMs,
31
+ throttleMs = _args$throttleMs === void 0 ? THROTTLE_DEFAULT_MS : _args$throttleMs;
32
+ var _useState = (0, _react.useState)(true),
33
+ _useState2 = _slicedToArray(_useState, 2),
34
+ isTopScroll = _useState2[0],
35
+ setIsTopScroll = _useState2[1];
36
+ var isOverscroll = (0, _react.useRef)(false);
37
+ var startY = (0, _react.useRef)(0);
38
+ var currentY = (0, _react.useRef)(0);
39
+ (0, _react.useEffect)(function () {
40
+ var contentWrapperEl = contentWrapperRef.current;
41
+ var handleEl = handleRef.current;
42
+ var contentEl = contentRef.current;
43
+ var triggerElement = !isTopScroll ? handleEl : contentWrapperEl;
44
+ if (!triggerElement || !contentEl || !contentWrapperEl) {
45
+ return;
46
+ }
47
+ var nodes = Array.from(contentWrapperEl.querySelectorAll('*'));
48
+ var scrollableElements = nodes.filter(isScrollable);
49
+ contentWrapperEl.style.willChange = 'transform';
50
+ var onTouchStart = function onTouchStart(event) {
51
+ isOverscroll.current = false;
52
+ startY.current = event.changedTouches[0].clientY;
53
+ currentY.current = startY.current;
54
+ contentWrapperEl.style.transition = 'none';
55
+ };
56
+ var onTouchMove = function onTouchMove(event) {
57
+ var clientY = event.changedTouches[0].clientY;
58
+ currentY.current = Math.max(startY.current, clientY);
59
+ var offsetY = currentY.current - startY.current;
60
+ if (isOverscroll.current) {
61
+ startY.current = Infinity;
62
+ return;
63
+ }
64
+ if (offsetY !== 0 && event.cancelable) {
65
+ event.preventDefault();
66
+ }
67
+ contentWrapperEl.style.transform = "translateY(".concat(offsetY, "px)");
68
+ };
69
+ var onTouchEnd = function onTouchEnd(event) {
70
+ isOverscroll.current = false;
71
+ var curtainHeight = contentWrapperEl.offsetHeight;
72
+ var endY = event.changedTouches[0].clientY;
73
+ var offsetY = endY - startY.current;
74
+ contentWrapperEl.style.transform = '';
75
+ contentWrapperEl.style.transition = '';
76
+ if (offsetY / curtainHeight > SWIPE_THRESHOLD) {
77
+ onClose();
78
+ }
79
+ };
80
+ var onScroll = (0, _lodash["default"])(function (event) {
81
+ var onTop = event.target.scrollTop <= 0;
82
+ if (!onTop) {
83
+ isOverscroll.current = true;
84
+ }
85
+ setIsTopScroll(onTop);
86
+ }, throttleMs);
87
+ triggerElement.addEventListener('touchstart', onTouchStart);
88
+ triggerElement.addEventListener('touchmove', onTouchMove);
89
+ triggerElement.addEventListener('touchend', onTouchEnd);
90
+ scrollableElements.forEach(function (element) {
91
+ element.addEventListener('scroll', onScroll);
92
+ });
93
+ return function () {
94
+ triggerElement.removeEventListener('touchstart', onTouchStart);
95
+ triggerElement.removeEventListener('touchmove', onTouchMove);
96
+ triggerElement.removeEventListener('touchend', onTouchEnd);
97
+ scrollableElements.forEach(function (element) {
98
+ element.removeEventListener('scroll', onScroll);
99
+ });
100
+ };
101
+ }, [isTopScroll]);
102
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useThemeContext = void 0;
7
+ var _react = /*#__PURE__*/require("react");
8
+ var _styledComponents = /*#__PURE__*/require("styled-components");
9
+ /**
10
+ * Возвращает контекст темы.
11
+ * @return {ThemeProviderContext}
12
+ */
13
+ var useThemeContext = exports.useThemeContext = function useThemeContext() {
14
+ return (0, _react.useContext)(_styledComponents.ThemeContext) || {};
15
+ };
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "sheetClasses", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _Sheet2.classes;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "sheetConfig", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _Sheet.sheetConfig;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "sheetRoot", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _Sheet.sheetRoot;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "sheetTokens", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _Sheet2.tokens;
28
+ }
29
+ });
30
+ var _Sheet = /*#__PURE__*/require("./Sheet");
31
+ var _Sheet2 = /*#__PURE__*/require("./Sheet.tokens");
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleTransition = void 0;
7
+ var handleTransition = exports.handleTransition = function handleTransition(transition) {
8
+ return function (props) {
9
+ var lowPerformance = props.theme.lowPerformance,
10
+ withTransition = props.withTransition;
11
+ return !withTransition || lowPerformance ? 'unset' : transition;
12
+ };
13
+ };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "handleTransition", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _handleTransition.handleTransition;
10
+ }
11
+ });
12
+ var _handleTransition = /*#__PURE__*/require("./handleTransition");
@@ -0,0 +1,3 @@
1
+ [
2
+ "--plasma-sheet-overlay-background-color, --plasma-sheet-content-background-color, --plasma-sheet-handle-background-color"
3
+ ]
@@ -15,12 +15,6 @@ Object.defineProperty(exports, "IconChevronDown", {
15
15
  return _IconChevronDown.IconChevronDown;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "IconChevronDownFill", {
19
- enumerable: true,
20
- get: function get() {
21
- return _IconChevronDownFill.IconChevronDownFill;
22
- }
23
- });
24
18
  Object.defineProperty(exports, "IconChevronLeft", {
25
19
  enumerable: true,
26
20
  get: function get() {
@@ -63,20 +57,12 @@ Object.defineProperty(exports, "IconMic", {
63
57
  return _IconMic.IconMic;
64
58
  }
65
59
  });
66
- Object.defineProperty(exports, "IconMinus", {
67
- enumerable: true,
68
- get: function get() {
69
- return _IconMinus.IconMinus;
70
- }
71
- });
72
60
  var _IconDisclosureLeft = /*#__PURE__*/require("./Icons/IconDisclosureLeft");
73
61
  var _IconDisclosureRight = /*#__PURE__*/require("./Icons/IconDisclosureRight");
74
62
  var _IconMic = /*#__PURE__*/require("./Icons/IconMic");
75
63
  var _IconChevronLeft = /*#__PURE__*/require("./Icons/IconChevronLeft");
76
64
  var _IconChevronDoubleLeft = /*#__PURE__*/require("./Icons/IconChevronDoubleLeft");
77
65
  var _IconChevronDown = /*#__PURE__*/require("./Icons/IconChevronDown");
78
- var _IconChevronDownFill = /*#__PURE__*/require("./Icons/IconChevronDownFill");
79
66
  var _IconClose = /*#__PURE__*/require("./Icons/IconClose");
80
67
  var _IconCross = /*#__PURE__*/require("./Icons/IconCross");
81
- var _IconDone = /*#__PURE__*/require("./Icons/IconDone");
82
- var _IconMinus = /*#__PURE__*/require("./Icons/IconMinus");
68
+ var _IconDone = /*#__PURE__*/require("./Icons/IconDone");
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.config = void 0;
7
+ var _styledComponents = /*#__PURE__*/require("styled-components");
8
+ var _Sheet = /*#__PURE__*/require("../../../../components/Sheet");
9
+ var config = exports.config = {
10
+ defaults: {
11
+ view: 'default'
12
+ },
13
+ variations: {
14
+ view: {
15
+ "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--surface-solid-card);", ":var(--overlay-soft);", ":var(--text-primary);"], _Sheet.sheetTokens.contentBackgroundColor, _Sheet.sheetTokens.overlayBackgroundColor, _Sheet.sheetTokens.handleColor)
16
+ }
17
+ }
18
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Sheet = void 0;
7
+ Object.defineProperty(exports, "sheetClasses", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _Sheet.sheetClasses;
11
+ }
12
+ });
13
+ var _Sheet = /*#__PURE__*/require("../../../../components/Sheet");
14
+ var _engines = /*#__PURE__*/require("../../../../engines");
15
+ var _Sheet2 = /*#__PURE__*/require("./Sheet.config");
16
+ var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Sheet.sheetConfig, _Sheet2.config);
17
+ var Sheet = exports.Sheet = /*#__PURE__*/(0, _engines.component)(mergedConfig);
@@ -0,0 +1,239 @@
1
+ import React, { useState } from 'react';
2
+ import type { StoryObj, Meta } from '@storybook/react';
3
+ import type { ComponentProps } from 'react';
4
+ import { Body1 } from '@salutejs/plasma-core';
5
+
6
+ import { Button } from '../Button/Button';
7
+ import { WithTheme } from '../../../_helpers';
8
+
9
+ import { Sheet } from './Sheet';
10
+
11
+ const meta: Meta<typeof Sheet> = {
12
+ title: 'plasma_b2c/Sheet',
13
+ decorators: [WithTheme],
14
+ parameters: { viewport: { defaultViewport: '860' } },
15
+ };
16
+
17
+ export default meta;
18
+
19
+ type StorySheetProps = ComponentProps<typeof Sheet>;
20
+
21
+ const StoryDefault = ({ withOverlay, withTransition }: StorySheetProps) => {
22
+ const [isOpen, setIsOpen] = useState(false);
23
+
24
+ return (
25
+ <>
26
+ <Button onClick={() => setIsOpen(true)}>Открыть</Button>
27
+ <Sheet
28
+ isOpen={isOpen}
29
+ withOverlay={withOverlay}
30
+ withTransition={withTransition}
31
+ onClose={() => setIsOpen(false)}
32
+ >
33
+ <p>Вложенные кнопки</p>
34
+ <div
35
+ style={{
36
+ height: '75px',
37
+ overflow: 'scroll',
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ gap: '1rem',
41
+ }}
42
+ >
43
+ <Button>Кнопка 1</Button>
44
+ <Button>Кнопка 2</Button>
45
+ <Button>Кнопка 3</Button>
46
+ <Button>Кнопка 4</Button>
47
+ <Button>Кнопка 5</Button>
48
+ <Button>Кнопка 6</Button>
49
+ <Button>Кнопка 7</Button>
50
+ <Button>Кнопка 8</Button>
51
+ </div>
52
+ <Body1>
53
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
54
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel illum ea
55
+ fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos nostrum
56
+ placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt ullam,
57
+ dolorem labore quaerat vero maxime ab ipsa nihil.
58
+ </Body1>
59
+ </Sheet>
60
+ </>
61
+ );
62
+ };
63
+
64
+ export const Default: StoryObj<StorySheetProps> = {
65
+ args: {
66
+ withOverlay: true,
67
+ withTransition: true,
68
+ },
69
+ render: (args) => <StoryDefault {...args} />,
70
+ };
71
+
72
+ const StoryWithoutOverlay = () => {
73
+ const [isOpen, setIsOpen] = useState(false);
74
+
75
+ return (
76
+ <>
77
+ <Button onClick={() => setIsOpen(true)}>Открыть</Button>
78
+ <Sheet isOpen={isOpen} withOverlay={false} onClose={() => setIsOpen(false)}>
79
+ <Body1>
80
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
81
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel illum ea
82
+ fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos nostrum
83
+ placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt ullam,
84
+ dolorem labore quaerat vero maxime ab ipsa nihil.
85
+ </Body1>
86
+ </Sheet>
87
+ </>
88
+ );
89
+ };
90
+
91
+ export const WithoutOverlay: StoryObj = {
92
+ render: () => <StoryWithoutOverlay />,
93
+ };
94
+
95
+ const StoryWithScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
96
+ const [isOpen, setIsOpen] = useState(false);
97
+
98
+ return (
99
+ <>
100
+ <Button onClick={() => setIsOpen(true)}>Открыть</Button>
101
+ <Sheet
102
+ isOpen={isOpen}
103
+ withOverlay={withOverlay}
104
+ withTransition={withTransition}
105
+ onClose={() => setIsOpen(false)}
106
+ >
107
+ <Body1>
108
+ <Button onClick={() => setIsOpen(false)}>Закрыть</Button>
109
+ <p>
110
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
111
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
112
+ illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
113
+ nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
114
+ ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
115
+ </p>
116
+ <Button onClick={() => setIsOpen(false)}>Закрыть</Button>
117
+ <p>
118
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
119
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
120
+ illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
121
+ nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
122
+ ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
123
+ </p>
124
+ </Body1>
125
+ </Sheet>
126
+ </>
127
+ );
128
+ };
129
+
130
+ export const WithScroll: StoryObj<StorySheetProps> = {
131
+ render: (args) => <StoryWithScroll {...args} />,
132
+ };
133
+
134
+ const StoryWithInsideScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
135
+ const [isOpen, setIsOpen] = useState(false);
136
+
137
+ return (
138
+ <>
139
+ <Button onClick={() => setIsOpen(true)}>Открыть</Button>
140
+ <Sheet
141
+ isOpen={isOpen}
142
+ withOverlay={withOverlay}
143
+ withTransition={withTransition}
144
+ onClose={() => setIsOpen(false)}
145
+ >
146
+ <p>Вложенные кнопки</p>
147
+ <div
148
+ style={{
149
+ height: '150px',
150
+ overflow: 'scroll',
151
+ display: 'flex',
152
+ flexDirection: 'column',
153
+ gap: '1rem',
154
+ }}
155
+ >
156
+ <Button>Кнопка 1</Button>
157
+ <Button>Кнопка 2</Button>
158
+ <Button>Кнопка 3</Button>
159
+ <Button>Кнопка 4</Button>
160
+ <Button>Кнопка 5</Button>
161
+ <Button>Кнопка 6</Button>
162
+ <Button>Кнопка 7</Button>
163
+ <Button>Кнопка 8</Button>
164
+ </div>
165
+ <Body1>Lorem ipsum dolor sit amet consectetur adipisicing elit.</Body1>
166
+ </Sheet>
167
+ </>
168
+ );
169
+ };
170
+
171
+ export const WithInsideScroll: StoryObj<StorySheetProps> = {
172
+ args: {
173
+ withOverlay: true,
174
+ withTransition: true,
175
+ },
176
+ render: (args) => <StoryWithInsideScroll {...args} />,
177
+ };
178
+
179
+ const StoryWithDoubleScroll = ({ withOverlay, withTransition }: StorySheetProps) => {
180
+ const [isOpen, setIsOpen] = useState(false);
181
+
182
+ return (
183
+ <>
184
+ <Button onClick={() => setIsOpen(true)}>Открыть</Button>
185
+ <Sheet
186
+ isOpen={isOpen}
187
+ withOverlay={withOverlay}
188
+ withTransition={withTransition}
189
+ onClose={() => setIsOpen(false)}
190
+ >
191
+ <Body1>
192
+ <Button onClick={() => setIsOpen(false)}>Закрыть</Button>
193
+ <p>Вложенные кнопки</p>
194
+ <div
195
+ style={{
196
+ height: '150px',
197
+ overflow: 'scroll',
198
+ display: 'flex',
199
+ flexDirection: 'column',
200
+ gap: '1rem',
201
+ }}
202
+ >
203
+ <Button>Кнопка 1</Button>
204
+ <Button>Кнопка 2</Button>
205
+ <Button>Кнопка 3</Button>
206
+ <Button>Кнопка 4</Button>
207
+ <Button>Кнопка 5</Button>
208
+ <Button>Кнопка 6</Button>
209
+ <Button>Кнопка 7</Button>
210
+ <Button>Кнопка 8</Button>
211
+ </div>
212
+ <p>
213
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
214
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
215
+ illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
216
+ nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
217
+ ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
218
+ </p>
219
+ <Button onClick={() => setIsOpen(false)}>Закрыть</Button>
220
+ <p>
221
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Quae tempore vitae porro laboriosam
222
+ consectetur fugiat assumenda, earum nesciunt. Distinctio minima nesciunt dicta rem quae vel
223
+ illum ea fugit molestiae dolorem? Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quos
224
+ nostrum placeat, neque repudiandae consectetur voluptates soluta et sint eum obcaecati nesciunt
225
+ ullam, dolorem labore quaerat vero maxime ab ipsa nihil.
226
+ </p>
227
+ </Body1>
228
+ </Sheet>
229
+ </>
230
+ );
231
+ };
232
+
233
+ export const WithDoubleScroll: StoryObj<StorySheetProps> = {
234
+ args: {
235
+ withOverlay: true,
236
+ withTransition: true,
237
+ },
238
+ render: (args) => <StoryWithDoubleScroll {...args} />,
239
+ };
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.config = void 0;
7
+ var _styledComponents = /*#__PURE__*/require("styled-components");
8
+ var _Sheet = /*#__PURE__*/require("../../../../components/Sheet");
9
+ var config = exports.config = {
10
+ defaults: {
11
+ view: 'default'
12
+ },
13
+ variations: {
14
+ view: {
15
+ "default": /*#__PURE__*/(0, _styledComponents.css)(["", ":var(--plasma-colors-background-primary);", ":var(--plasma-colors-overlay);", ":var(--plasma-colors-white);"], _Sheet.sheetTokens.contentBackgroundColor, _Sheet.sheetTokens.overlayBackgroundColor, _Sheet.sheetTokens.handleColor)
16
+ }
17
+ }
18
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Sheet = void 0;
7
+ Object.defineProperty(exports, "sheetClasses", {
8
+ enumerable: true,
9
+ get: function get() {
10
+ return _Sheet.sheetClasses;
11
+ }
12
+ });
13
+ var _Sheet = /*#__PURE__*/require("../../../../components/Sheet");
14
+ var _engines = /*#__PURE__*/require("../../../../engines");
15
+ var _Sheet2 = /*#__PURE__*/require("./Sheet.config");
16
+ var mergedConfig = /*#__PURE__*/(0, _engines.mergeConfig)(_Sheet.sheetConfig, _Sheet2.config);
17
+ var Sheet = exports.Sheet = /*#__PURE__*/(0, _engines.component)(mergedConfig);