@salutejs/plasma-new-hope 0.80.0 → 0.81.0-canary.1194.9102719796.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (280) hide show
  1. package/cjs/components/Combobox/hooks/useFocusController.js +1 -0
  2. package/cjs/components/Combobox/hooks/useFocusController.js.map +1 -1
  3. package/cjs/components/Slider/Slider.css +69 -0
  4. package/cjs/components/Slider/Slider.js +48 -0
  5. package/cjs/components/Slider/Slider.js.map +1 -0
  6. package/cjs/components/Slider/Slider.tokens.js +79 -0
  7. package/cjs/components/Slider/Slider.tokens.js.map +1 -0
  8. package/cjs/components/Slider/components/Double/Double.css +62 -0
  9. package/cjs/components/Slider/components/Double/Double.js +288 -0
  10. package/cjs/components/Slider/components/Double/Double.js.map +1 -0
  11. package/cjs/components/Slider/components/Double/Double.styles.js +61 -0
  12. package/cjs/components/Slider/components/Double/Double.styles.js.map +1 -0
  13. package/cjs/components/Slider/components/Double/Double.styles_1jhda4u.css +7 -0
  14. package/cjs/components/Slider/components/Single/Single.css +16 -0
  15. package/cjs/components/Slider/components/Single/Single.js +162 -0
  16. package/cjs/components/Slider/components/Single/Single.js.map +1 -0
  17. package/cjs/components/Slider/components/Single/Single.styles.js +45 -0
  18. package/cjs/components/Slider/components/Single/Single.styles.js.map +1 -0
  19. package/cjs/components/Slider/components/Single/Single.styles_1r9f1e0.css +6 -0
  20. package/cjs/components/Slider/components/SliderBase/SliderBase.css +4 -0
  21. package/cjs/components/Slider/components/SliderBase/SliderBase.js +82 -0
  22. package/cjs/components/Slider/components/SliderBase/SliderBase.js.map +1 -0
  23. package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +33 -0
  24. package/cjs/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -0
  25. package/cjs/components/Slider/components/SliderBase/SliderBase.styles_7is2ll.css +4 -0
  26. package/cjs/components/Slider/ui/Handler/Handler.css +4 -0
  27. package/cjs/components/Slider/ui/Handler/Handler.js +174 -0
  28. package/cjs/components/Slider/ui/Handler/Handler.js.map +1 -0
  29. package/cjs/components/Slider/ui/Handler/Handler.styles.js +21 -0
  30. package/cjs/components/Slider/ui/Handler/Handler.styles.js.map +1 -0
  31. package/cjs/components/Slider/ui/Handler/Handler.styles_8crx5z.css +2 -0
  32. package/cjs/components/Slider/ui/Thumb/Thumb.css +1 -0
  33. package/cjs/components/Slider/ui/Thumb/Thumb.js +31 -0
  34. package/cjs/components/Slider/ui/Thumb/Thumb.js.map +1 -0
  35. package/cjs/components/Slider/ui/Thumb/Thumb.styles.js +15 -0
  36. package/cjs/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -0
  37. package/cjs/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +1 -0
  38. package/cjs/components/Slider/utils/index.js +56 -0
  39. package/cjs/components/Slider/utils/index.js.map +1 -0
  40. package/cjs/components/Slider/variations/_disabled/base.js +9 -0
  41. package/cjs/components/Slider/variations/_disabled/base.js.map +1 -0
  42. package/cjs/components/Slider/variations/_disabled/base_x642ct.css +1 -0
  43. package/cjs/components/Slider/variations/_size/base.js +9 -0
  44. package/cjs/components/Slider/variations/_size/base.js.map +1 -0
  45. package/cjs/components/Slider/variations/_size/base_x642ct.css +1 -0
  46. package/cjs/components/Slider/variations/_view/base.js +9 -0
  47. package/cjs/components/Slider/variations/_view/base.js.map +1 -0
  48. package/cjs/components/Slider/variations/_view/base_x642ct.css +1 -0
  49. package/cjs/components/TextField/TextField.js +12 -3
  50. package/cjs/components/TextField/TextField.js.map +1 -1
  51. package/cjs/engines/common.js +4 -0
  52. package/cjs/engines/common.js.map +1 -1
  53. package/cjs/engines/index.js.map +1 -1
  54. package/cjs/hooks/useIsomorphicLayoutEffect.js +15 -0
  55. package/cjs/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  56. package/cjs/index.css +25 -0
  57. package/cjs/index.js +14 -0
  58. package/cjs/index.js.map +1 -1
  59. package/cjs/utils/canUseDOM.js +12 -0
  60. package/cjs/utils/canUseDOM.js.map +1 -0
  61. package/cjs/utils/index.js.map +1 -1
  62. package/es/components/Combobox/hooks/useFocusController.js +1 -0
  63. package/es/components/Combobox/hooks/useFocusController.js.map +1 -1
  64. package/es/components/Slider/Slider.css +69 -0
  65. package/es/components/Slider/Slider.js +43 -0
  66. package/es/components/Slider/Slider.js.map +1 -0
  67. package/es/components/Slider/Slider.tokens.js +74 -0
  68. package/es/components/Slider/Slider.tokens.js.map +1 -0
  69. package/es/components/Slider/components/Double/Double.css +62 -0
  70. package/es/components/Slider/components/Double/Double.js +284 -0
  71. package/es/components/Slider/components/Double/Double.js.map +1 -0
  72. package/es/components/Slider/components/Double/Double.styles.js +51 -0
  73. package/es/components/Slider/components/Double/Double.styles.js.map +1 -0
  74. package/es/components/Slider/components/Double/Double.styles_1jhda4u.css +7 -0
  75. package/es/components/Slider/components/Single/Single.css +16 -0
  76. package/es/components/Slider/components/Single/Single.js +158 -0
  77. package/es/components/Slider/components/Single/Single.js.map +1 -0
  78. package/es/components/Slider/components/Single/Single.styles.js +36 -0
  79. package/es/components/Slider/components/Single/Single.styles.js.map +1 -0
  80. package/es/components/Slider/components/Single/Single.styles_1r9f1e0.css +6 -0
  81. package/es/components/Slider/components/SliderBase/SliderBase.css +4 -0
  82. package/es/components/Slider/components/SliderBase/SliderBase.js +78 -0
  83. package/es/components/Slider/components/SliderBase/SliderBase.js.map +1 -0
  84. package/es/components/Slider/components/SliderBase/SliderBase.styles.js +26 -0
  85. package/es/components/Slider/components/SliderBase/SliderBase.styles.js.map +1 -0
  86. package/es/components/Slider/components/SliderBase/SliderBase.styles_7is2ll.css +4 -0
  87. package/es/components/Slider/ui/Handler/Handler.css +4 -0
  88. package/es/components/Slider/ui/Handler/Handler.js +170 -0
  89. package/es/components/Slider/ui/Handler/Handler.js.map +1 -0
  90. package/es/components/Slider/ui/Handler/Handler.styles.js +16 -0
  91. package/es/components/Slider/ui/Handler/Handler.styles.js.map +1 -0
  92. package/es/components/Slider/ui/Handler/Handler.styles_8crx5z.css +2 -0
  93. package/es/components/Slider/ui/Thumb/Thumb.css +1 -0
  94. package/es/components/Slider/ui/Thumb/Thumb.js +27 -0
  95. package/es/components/Slider/ui/Thumb/Thumb.js.map +1 -0
  96. package/es/components/Slider/ui/Thumb/Thumb.styles.js +11 -0
  97. package/es/components/Slider/ui/Thumb/Thumb.styles.js.map +1 -0
  98. package/es/components/Slider/ui/Thumb/Thumb.styles_4w4gzn.css +1 -0
  99. package/es/components/Slider/utils/index.js +50 -0
  100. package/es/components/Slider/utils/index.js.map +1 -0
  101. package/es/components/Slider/variations/_disabled/base.js +5 -0
  102. package/es/components/Slider/variations/_disabled/base.js.map +1 -0
  103. package/es/components/Slider/variations/_disabled/base_x642ct.css +1 -0
  104. package/es/components/Slider/variations/_size/base.js +5 -0
  105. package/es/components/Slider/variations/_size/base.js.map +1 -0
  106. package/es/components/Slider/variations/_size/base_x642ct.css +1 -0
  107. package/es/components/Slider/variations/_view/base.js +5 -0
  108. package/es/components/Slider/variations/_view/base.js.map +1 -0
  109. package/es/components/Slider/variations/_view/base_x642ct.css +1 -0
  110. package/es/components/TextField/TextField.js +12 -3
  111. package/es/components/TextField/TextField.js.map +1 -1
  112. package/es/engines/common.js +4 -0
  113. package/es/engines/common.js.map +1 -1
  114. package/es/engines/index.js.map +1 -1
  115. package/es/hooks/useIsomorphicLayoutEffect.js +11 -0
  116. package/es/hooks/useIsomorphicLayoutEffect.js.map +1 -0
  117. package/es/index.css +25 -0
  118. package/es/index.js +8 -0
  119. package/es/index.js.map +1 -1
  120. package/es/utils/canUseDOM.js +8 -0
  121. package/es/utils/canUseDOM.js.map +1 -0
  122. package/es/utils/index.js.map +1 -1
  123. package/package.json +3 -2
  124. package/styled-components/cjs/components/Slider/Slider.js +47 -0
  125. package/styled-components/cjs/components/Slider/Slider.tokens.js +77 -0
  126. package/styled-components/cjs/components/Slider/Slider.types.js +5 -0
  127. package/styled-components/cjs/components/Slider/components/Double/Double.js +300 -0
  128. package/styled-components/cjs/components/Slider/components/Double/Double.styles.js +36 -0
  129. package/styled-components/cjs/components/Slider/components/Double/Double.types.js +5 -0
  130. package/styled-components/cjs/components/Slider/components/Single/Single.js +174 -0
  131. package/styled-components/cjs/components/Slider/components/Single/Single.styles.js +27 -0
  132. package/styled-components/cjs/components/Slider/components/Single/Single.types.js +5 -0
  133. package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.js +83 -0
  134. package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.styles.js +21 -0
  135. package/styled-components/cjs/components/Slider/components/SliderBase/SliderBase.types.js +5 -0
  136. package/styled-components/cjs/components/Slider/components/index.js +27 -0
  137. package/styled-components/cjs/components/Slider/index.js +32 -0
  138. package/styled-components/cjs/components/Slider/ui/Handler/Handler.js +183 -0
  139. package/styled-components/cjs/components/Slider/ui/Handler/Handler.styles.js +15 -0
  140. package/styled-components/cjs/components/Slider/ui/Handler/Handler.types.js +5 -0
  141. package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.js +32 -0
  142. package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.styles.js +18 -0
  143. package/styled-components/cjs/components/Slider/ui/Thumb/Thumb.types.js +5 -0
  144. package/styled-components/cjs/components/Slider/ui/index.js +63 -0
  145. package/styled-components/cjs/components/Slider/utils/index.js +55 -0
  146. package/styled-components/cjs/components/Slider/variations/_disabled/base.js +8 -0
  147. package/styled-components/cjs/components/Slider/variations/_disabled/tokens.json +4 -0
  148. package/styled-components/cjs/components/Slider/variations/_size/base.js +8 -0
  149. package/styled-components/cjs/components/Slider/variations/_size/tokens.json +0 -0
  150. package/styled-components/cjs/components/Slider/variations/_view/base.js +8 -0
  151. package/styled-components/cjs/components/Slider/variations/_view/tokens.json +0 -0
  152. package/styled-components/cjs/components/TextField/TextField.js +12 -3
  153. package/styled-components/cjs/engines/common.js +4 -0
  154. package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.config.js +29 -0
  155. package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.js +16 -0
  156. package/styled-components/cjs/examples/plasma_b2c/components/Slider/Slider.stories.tsx +164 -0
  157. package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.config.js +29 -0
  158. package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.js +16 -0
  159. package/styled-components/cjs/examples/plasma_web/components/Slider/Slider.stories.tsx +163 -0
  160. package/styled-components/cjs/hooks/index.js +8 -1
  161. package/styled-components/cjs/hooks/useIsomorphicLayoutEffect.js +12 -0
  162. package/styled-components/cjs/index.js +11 -0
  163. package/styled-components/cjs/utils/canUseDOM.js +11 -0
  164. package/styled-components/cjs/utils/index.js +7 -0
  165. package/styled-components/es/components/Slider/Slider.js +38 -0
  166. package/styled-components/es/components/Slider/Slider.tokens.js +71 -0
  167. package/styled-components/es/components/Slider/Slider.types.js +1 -0
  168. package/styled-components/es/components/Slider/components/Double/Double.js +292 -0
  169. package/styled-components/es/components/Slider/components/Double/Double.styles.js +29 -0
  170. package/styled-components/es/components/Slider/components/Double/Double.types.js +1 -0
  171. package/styled-components/es/components/Slider/components/Single/Single.js +166 -0
  172. package/styled-components/es/components/Slider/components/Single/Single.styles.js +20 -0
  173. package/styled-components/es/components/Slider/components/Single/Single.types.js +1 -0
  174. package/styled-components/es/components/Slider/components/SliderBase/SliderBase.js +74 -0
  175. package/styled-components/es/components/Slider/components/SliderBase/SliderBase.styles.js +14 -0
  176. package/styled-components/es/components/Slider/components/SliderBase/SliderBase.types.js +1 -0
  177. package/styled-components/es/components/Slider/components/index.js +3 -0
  178. package/styled-components/es/components/Slider/index.js +3 -0
  179. package/styled-components/es/components/Slider/ui/Handler/Handler.js +174 -0
  180. package/styled-components/es/components/Slider/ui/Handler/Handler.styles.js +8 -0
  181. package/styled-components/es/components/Slider/ui/Handler/Handler.types.js +1 -0
  182. package/styled-components/es/components/Slider/ui/Thumb/Thumb.js +25 -0
  183. package/styled-components/es/components/Slider/ui/Thumb/Thumb.styles.js +11 -0
  184. package/styled-components/es/components/Slider/ui/Thumb/Thumb.types.js +1 -0
  185. package/styled-components/es/components/Slider/ui/index.js +5 -0
  186. package/styled-components/es/components/Slider/utils/index.js +47 -0
  187. package/styled-components/es/components/Slider/variations/_disabled/base.js +2 -0
  188. package/styled-components/es/components/Slider/variations/_disabled/tokens.json +4 -0
  189. package/styled-components/es/components/Slider/variations/_size/base.js +2 -0
  190. package/styled-components/es/components/Slider/variations/_size/tokens.json +0 -0
  191. package/styled-components/es/components/Slider/variations/_view/base.js +2 -0
  192. package/styled-components/es/components/Slider/variations/_view/tokens.json +0 -0
  193. package/styled-components/es/components/TextField/TextField.js +12 -3
  194. package/styled-components/es/engines/common.js +4 -0
  195. package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.config.js +23 -0
  196. package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.js +10 -0
  197. package/styled-components/es/examples/plasma_b2c/components/Slider/Slider.stories.tsx +164 -0
  198. package/styled-components/es/examples/plasma_web/components/Slider/Slider.config.js +23 -0
  199. package/styled-components/es/examples/plasma_web/components/Slider/Slider.js +10 -0
  200. package/styled-components/es/examples/plasma_web/components/Slider/Slider.stories.tsx +163 -0
  201. package/styled-components/es/hooks/index.js +2 -1
  202. package/styled-components/es/hooks/useIsomorphicLayoutEffect.js +7 -0
  203. package/styled-components/es/index.js +2 -1
  204. package/styled-components/es/utils/canUseDOM.js +5 -0
  205. package/styled-components/es/utils/index.js +1 -0
  206. package/types/components/Slider/Slider.d.ts +27 -0
  207. package/types/components/Slider/Slider.d.ts.map +1 -0
  208. package/types/components/Slider/Slider.tokens.d.ts +72 -0
  209. package/types/components/Slider/Slider.tokens.d.ts.map +1 -0
  210. package/types/components/Slider/Slider.types.d.ts +3 -0
  211. package/types/components/Slider/Slider.types.d.ts.map +1 -0
  212. package/types/components/Slider/components/Double/Double.d.ts +4 -0
  213. package/types/components/Slider/components/Double/Double.d.ts.map +1 -0
  214. package/types/components/Slider/components/Double/Double.styles.d.ts +43 -0
  215. package/types/components/Slider/components/Double/Double.styles.d.ts.map +1 -0
  216. package/types/components/Slider/components/Double/Double.types.d.ts +65 -0
  217. package/types/components/Slider/components/Double/Double.types.d.ts.map +1 -0
  218. package/types/components/Slider/components/Single/Single.d.ts +4 -0
  219. package/types/components/Slider/components/Single/Single.d.ts.map +1 -0
  220. package/types/components/Slider/components/Single/Single.styles.d.ts +8 -0
  221. package/types/components/Slider/components/Single/Single.styles.d.ts.map +1 -0
  222. package/types/components/Slider/components/Single/Single.types.d.ts +55 -0
  223. package/types/components/Slider/components/Single/Single.types.d.ts.map +1 -0
  224. package/types/components/Slider/components/SliderBase/SliderBase.d.ts +4 -0
  225. package/types/components/Slider/components/SliderBase/SliderBase.d.ts.map +1 -0
  226. package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts +6 -0
  227. package/types/components/Slider/components/SliderBase/SliderBase.styles.d.ts.map +1 -0
  228. package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts +45 -0
  229. package/types/components/Slider/components/SliderBase/SliderBase.types.d.ts.map +1 -0
  230. package/types/components/Slider/components/index.d.ts +6 -0
  231. package/types/components/Slider/components/index.d.ts.map +1 -0
  232. package/types/components/Slider/index.d.ts +6 -0
  233. package/types/components/Slider/index.d.ts.map +1 -0
  234. package/types/components/Slider/ui/Handler/Handler.d.ts +9 -0
  235. package/types/components/Slider/ui/Handler/Handler.d.ts.map +1 -0
  236. package/types/components/Slider/ui/Handler/Handler.styles.d.ts +4 -0
  237. package/types/components/Slider/ui/Handler/Handler.styles.d.ts.map +1 -0
  238. package/types/components/Slider/ui/Handler/Handler.types.d.ts +24 -0
  239. package/types/components/Slider/ui/Handler/Handler.types.d.ts.map +1 -0
  240. package/types/components/Slider/ui/Thumb/Thumb.d.ts +4 -0
  241. package/types/components/Slider/ui/Thumb/Thumb.d.ts.map +1 -0
  242. package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts +5 -0
  243. package/types/components/Slider/ui/Thumb/Thumb.styles.d.ts.map +1 -0
  244. package/types/components/Slider/ui/Thumb/Thumb.types.d.ts +12 -0
  245. package/types/components/Slider/ui/Thumb/Thumb.types.d.ts.map +1 -0
  246. package/types/components/Slider/ui/index.d.ts +6 -0
  247. package/types/components/Slider/ui/index.d.ts.map +1 -0
  248. package/types/components/Slider/utils/index.d.ts +33 -0
  249. package/types/components/Slider/utils/index.d.ts.map +1 -0
  250. package/types/components/Slider/variations/_disabled/base.d.ts +2 -0
  251. package/types/components/Slider/variations/_disabled/base.d.ts.map +1 -0
  252. package/types/components/Slider/variations/_size/base.d.ts +2 -0
  253. package/types/components/Slider/variations/_size/base.d.ts.map +1 -0
  254. package/types/components/Slider/variations/_view/base.d.ts +2 -0
  255. package/types/components/Slider/variations/_view/base.d.ts.map +1 -0
  256. package/types/components/TextField/TextField.d.ts.map +1 -1
  257. package/types/engines/common.d.ts +3 -3
  258. package/types/engines/common.d.ts.map +1 -1
  259. package/types/engines/index.d.ts +1 -1
  260. package/types/engines/index.d.ts.map +1 -1
  261. package/types/engines/types.d.ts +4 -0
  262. package/types/engines/types.d.ts.map +1 -1
  263. package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts +22 -0
  264. package/types/examples/plasma_b2c/components/Slider/Slider.config.d.ts.map +1 -0
  265. package/types/examples/plasma_b2c/components/Slider/Slider.d.ts +21 -0
  266. package/types/examples/plasma_b2c/components/Slider/Slider.d.ts.map +1 -0
  267. package/types/examples/plasma_web/components/Slider/Slider.config.d.ts +22 -0
  268. package/types/examples/plasma_web/components/Slider/Slider.config.d.ts.map +1 -0
  269. package/types/examples/plasma_web/components/Slider/Slider.d.ts +21 -0
  270. package/types/examples/plasma_web/components/Slider/Slider.d.ts.map +1 -0
  271. package/types/hooks/index.d.ts +1 -0
  272. package/types/hooks/index.d.ts.map +1 -1
  273. package/types/hooks/useIsomorphicLayoutEffect.d.ts +6 -0
  274. package/types/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
  275. package/types/index.d.ts +1 -0
  276. package/types/index.d.ts.map +1 -1
  277. package/types/utils/canUseDOM.d.ts +6 -0
  278. package/types/utils/canUseDOM.d.ts.map +1 -0
  279. package/types/utils/index.d.ts +1 -0
  280. package/types/utils/index.d.ts.map +1 -1
@@ -13,11 +13,13 @@ import { classes } from './TextField.tokens.js';
13
13
  import { TextFieldChip } from './ui/TextFieldChip/TextFieldChip.js';
14
14
  import { useKeyNavigation } from './hooks/useKeyNavigation.js';
15
15
 
16
- var _excluded = ["id", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "chips", "onChange", "onChangeChips", "onSearch"];
16
+ var _excluded = ["id", "className", "style", "contentLeft", "contentRight", "label", "labelPlacement", "placeholder", "leftHelper", "enumerationType", "view", "size", "readOnly", "disabled", "chips", "onChange", "onChangeChips", "onSearch", "onKeyDown"];
17
17
  var base = "bpunezx";
18
18
  var textFieldRoot = function textFieldRoot(Root) {
19
19
  return /*#__PURE__*/forwardRef(function (_ref, ref) {
20
20
  var id = _ref.id,
21
+ className = _ref.className,
22
+ style = _ref.style,
21
23
  contentLeft = _ref.contentLeft,
22
24
  contentRight = _ref.contentRight,
23
25
  label = _ref.label,
@@ -36,6 +38,7 @@ var textFieldRoot = function textFieldRoot(Root) {
36
38
  onChange = _ref.onChange,
37
39
  onChangeChips = _ref.onChangeChips,
38
40
  onSearch = _ref.onSearch,
41
+ onKeyDown = _ref.onKeyDown,
39
42
  rest = _objectWithoutProperties(_ref, _excluded);
40
43
  var contentRef = useRef(null);
41
44
  var inputRef = useRef(null);
@@ -115,6 +118,10 @@ var textFieldRoot = function textFieldRoot(Root) {
115
118
  chipsRefs.current[index] = element;
116
119
  }
117
120
  };
121
+ var handleOnKeyDown = function handleOnKeyDown(event) {
122
+ handleInputKeydown(event);
123
+ onKeyDown && onKeyDown(event);
124
+ };
118
125
  useEffect(function () {
119
126
  if (!isChipEnumeration && !(values !== null && values !== void 0 && values.length)) {
120
127
  return;
@@ -133,7 +140,9 @@ var textFieldRoot = function textFieldRoot(Root) {
133
140
  disabled: disabled,
134
141
  readOnly: !disabled && readOnly,
135
142
  labelPlacement: innerLabelPlacementValue,
136
- onClick: handleInputFocus
143
+ onClick: handleInputFocus,
144
+ className: className,
145
+ style: style
137
146
  }, labelInside || innerLabelValue && /*#__PURE__*/React.createElement(Label, {
138
147
  id: labelId,
139
148
  htmlFor: id
@@ -174,7 +183,7 @@ var textFieldRoot = function textFieldRoot(Root) {
174
183
  disabled: disabled,
175
184
  readOnly: !disabled && readOnly,
176
185
  onChange: handleChange,
177
- onKeyDown: handleInputKeydown
186
+ onKeyDown: handleOnKeyDown
178
187
  })), labelInside && /*#__PURE__*/React.createElement(Label, {
179
188
  id: labelId,
180
189
  htmlFor: innerId
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n id,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const inputForkRef = useForkRef(inputRef, ref);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputForkRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleInputKeydown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","rest","contentRef","useRef","inputRef","inputForkRef","useForkRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","className","cx","StyledContentLeft","InputLabelWrapper","tabIndex","onKeyDown","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnly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,EACbI,UAAU,iBAAIgF,KAAA,CAAAC,aAAA,CAACqB,UAAU,EAAA;AAAC5G,MAAAA,EAAE,EAAEqC,YAAAA;KAAe/B,EAAAA,UAAuB,CACnE,CAAC,CAAA;AAEf,GACJ,CAAC,CAAA;AAAA,EAAA;AAEE,IAAMuG,eAAe,GAAG;AAC3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAErH,aAAa;AACrBD,EAAAA,IAAI,EAAJA,IAAI;AACJuH,EAAAA,UAAU,EAAE;AACRxG,IAAAA,IAAI,EAAE;AACFyG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDzG,IAAAA,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDtG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACD1G,IAAAA,QAAQ,EAAE;AACNsG,MAAAA,GAAG,EAAEK,MAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDlH,IAAAA,cAAc,EAAE;AACZ8G,MAAAA,GAAG,EAAEM,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
1
+ {"version":3,"file":"TextField.js","sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import React, { forwardRef, useEffect, useRef, useState } from 'react';\nimport type { ChangeEventHandler, KeyboardEvent, ChangeEvent } from 'react';\nimport { safeUseId, useForkRef } from '@salutejs/plasma-core';\nimport { css } from '@linaria/core';\n\nimport type { RootProps } from '../../engines';\nimport { cx } from '../../utils';\n\nimport type { ChipValues, TextFieldPrimitiveValue, TextFieldProps } from './TextField.types';\nimport { base as sizeCSS } from './variations/_size/base';\nimport { base as viewCSS } from './variations/_view/base';\nimport { base as disabledCSS } from './variations/_disabled/base';\nimport { base as readOnlyCSS } from './variations/_read-only/base';\nimport { base as labelPlacementCSS } from './variations/_label-placement/base';\nimport {\n Input,\n LeftHelper,\n Label,\n InputWrapper,\n InputLabelWrapper,\n StyledContentLeft,\n StyledContentRight,\n StyledChips,\n} from './TextField.styles';\nimport { classes } from './TextField.tokens';\nimport { TextFieldChip } from './ui';\nimport { useKeyNavigation } from './hooks';\n\nexport const base = css`\n /* NOTE: Webkit не применяет opacity к inline тегам */\n display: block;\n overflow: hidden;\n`;\n\nexport const textFieldRoot = (Root: RootProps<HTMLDivElement, TextFieldProps>) =>\n forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n id,\n className,\n style,\n\n // layout\n contentLeft,\n contentRight,\n label,\n labelPlacement,\n placeholder,\n leftHelper,\n enumerationType = 'plain',\n\n // variations\n view,\n size,\n readOnly = false,\n disabled = false,\n\n // controlled\n chips: values,\n\n // events\n onChange,\n onChangeChips,\n onSearch,\n onKeyDown,\n\n ...rest\n },\n ref,\n ) => {\n const contentRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const inputForkRef = useForkRef(inputRef, ref);\n const chipsRefs = useRef<Array<HTMLButtonElement>>([]);\n\n const controlledRefs = { contentRef, inputRef, chipsRefs };\n\n const [chips, setChips] = useState<Array<ChipValues>>([]);\n\n const uniqId = safeUseId();\n const innerId = id || uniqId;\n const labelId = safeUseId();\n const helperTextId = safeUseId();\n\n const isChipEnumeration = enumerationType === 'chip';\n const hideLabel = (size === 'xs' || isChipEnumeration) && labelPlacement === 'inner';\n const labelInside = size !== 'xs' && labelPlacement === 'inner';\n const innerLabelPlacementValue = hideLabel ? 'outer' : labelPlacement;\n const innerPlaceholderValue = hideLabel ? label : placeholder;\n const innerLabelValue = hideLabel ? undefined : label;\n\n const isChipsVisible = isChipEnumeration && chips?.length;\n const withHasChips = isChipsVisible ? classes.hasChips : undefined;\n const wrapperWithoutLeftContent = !contentLeft && isChipsVisible ? classes.hasEmptyContentLeft : undefined;\n const wrapperWithoutRightContent =\n !contentRight && isChipsVisible ? classes.hasEmptyContentRight : undefined;\n\n const handleChange: ChangeEventHandler<HTMLInputElement> = (event) => {\n if (disabled || readOnly) {\n return;\n }\n\n const { maxLength, value } = event.target;\n\n if (maxLength !== -1 && value.length > maxLength) {\n return;\n }\n\n onChange?.(event);\n };\n\n const updateChips = (newChips: Array<ChipValues>, newValues: Array<TextFieldPrimitiveValue>) => {\n setChips(newChips);\n onChangeChips?.(newValues);\n };\n\n const { handleInputKeydown, handleChipKeyDown, onChipClear, handleContentKeyDown } = useKeyNavigation({\n controlledRefs,\n disabled,\n readOnly,\n chips,\n enumerationType,\n updateChips,\n onSearch,\n onChange,\n });\n\n const onChipClick = (event: React.MouseEvent<HTMLButtonElement>) => event.stopPropagation();\n\n const handleInputFocus = () => {\n if (readOnly || disabled || !inputRef?.current) {\n return;\n }\n\n inputRef.current.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'center',\n });\n\n inputRef.current.focus({ preventScroll: true });\n };\n\n const getRef = (element: HTMLButtonElement | null, index: number) => {\n if (element && chipsRefs?.current) {\n chipsRefs.current[index] = element;\n }\n };\n\n const handleOnKeyDown = (event: ChangeEvent<HTMLInputElement> & KeyboardEvent<HTMLInputElement>) => {\n handleInputKeydown(event);\n onKeyDown && onKeyDown(event);\n };\n\n useEffect(() => {\n if (!isChipEnumeration && !values?.length) {\n return;\n }\n\n const newChips =\n values?.map((value, index) => ({\n id: `${index}_${value}`,\n text: value,\n })) || [];\n\n setChips(newChips);\n }, [isChipEnumeration, values]);\n\n return (\n <Root\n view={view}\n size={size}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n labelPlacement={innerLabelPlacementValue}\n onClick={handleInputFocus}\n className={className}\n style={style}\n >\n {labelInside ||\n (innerLabelValue && (\n <Label id={labelId} htmlFor={id}>\n {innerLabelValue}\n </Label>\n ))}\n <InputWrapper className={cx(withHasChips, wrapperWithoutLeftContent, wrapperWithoutRightContent)}>\n {contentLeft && <StyledContentLeft>{contentLeft}</StyledContentLeft>}\n <InputLabelWrapper\n tabIndex={-1}\n ref={contentRef}\n onKeyDown={handleContentKeyDown}\n className={withHasChips}\n >\n {isChipEnumeration && Boolean(chips?.length) && (\n <StyledChips>\n {chips?.map(({ id: chipId, text }, index) => {\n return (\n <TextFieldChip\n id={chipId}\n ref={(element) => getRef(element, index)}\n key={`${chipId}_${index}`}\n disabled={disabled}\n readOnly={readOnly}\n value={text}\n text={text}\n onKeyDown={(event) => handleChipKeyDown(event, chipId, index)}\n onClear={() => onChipClear(chipId, index)}\n onClick={onChipClick}\n />\n );\n })}\n </StyledChips>\n )}\n <Input\n {...rest}\n ref={inputForkRef}\n id={innerId}\n aria-labelledby={labelId}\n aria-describedby={helperTextId}\n placeholder={innerPlaceholderValue}\n disabled={disabled}\n readOnly={!disabled && readOnly}\n onChange={handleChange}\n onKeyDown={handleOnKeyDown}\n />\n {labelInside && (\n <Label id={labelId} htmlFor={innerId}>\n {innerLabelValue}\n </Label>\n )}\n </InputLabelWrapper>\n {contentRight && <StyledContentRight>{contentRight}</StyledContentRight>}\n </InputWrapper>\n {leftHelper && <LeftHelper id={helperTextId}>{leftHelper}</LeftHelper>}\n </Root>\n );\n },\n );\n\nexport const textFieldConfig = {\n name: 'TextField',\n tag: 'div',\n layout: textFieldRoot,\n base,\n variations: {\n view: {\n css: viewCSS,\n },\n size: {\n css: sizeCSS,\n },\n disabled: {\n css: disabledCSS,\n attrs: true,\n },\n readOnly: {\n css: readOnlyCSS,\n attrs: true,\n },\n labelPlacement: {\n css: labelPlacementCSS,\n },\n },\n defaults: {\n size: 'm',\n view: 'default',\n },\n};\n"],"names":["base","textFieldRoot","Root","forwardRef","_ref","ref","id","className","style","contentLeft","contentRight","label","labelPlacement","placeholder","leftHelper","_ref$enumerationType","enumerationType","view","size","_ref$readOnly","readOnly","_ref$disabled","disabled","values","chips","onChange","onChangeChips","onSearch","onKeyDown","rest","contentRef","useRef","inputRef","inputForkRef","useForkRef","chipsRefs","controlledRefs","_useState","useState","_useState2","_slicedToArray","setChips","uniqId","safeUseId","innerId","labelId","helperTextId","isChipEnumeration","hideLabel","labelInside","innerLabelPlacementValue","innerPlaceholderValue","innerLabelValue","undefined","isChipsVisible","length","withHasChips","classes","hasChips","wrapperWithoutLeftContent","hasEmptyContentLeft","wrapperWithoutRightContent","hasEmptyContentRight","handleChange","event","_event$target","target","maxLength","value","updateChips","newChips","newValues","_useKeyNavigation","useKeyNavigation","handleInputKeydown","handleChipKeyDown","onChipClear","handleContentKeyDown","onChipClick","stopPropagation","handleInputFocus","current","scrollIntoView","behavior","block","inline","focus","preventScroll","getRef","element","index","handleOnKeyDown","useEffect","map","concat","text","React","createElement","onClick","Label","htmlFor","InputWrapper","cx","StyledContentLeft","InputLabelWrapper","tabIndex","Boolean","StyledChips","_ref2","chipId","TextFieldChip","key","onClear","Input","_extends","StyledContentRight","LeftHelper","textFieldConfig","name","tag","layout","variations","css","viewCSS","sizeCSS","disabledCSS","attrs","readOnlyCSS","labelPlacementCSS","defaults"],"mappings":";;;;;;;;;;;;;;;AA4BO,IAAMA,IAAI,GAIhB,UAAA;IAEYC,aAAa,GAAGA,SAAhBA,aAAaA,CAAIC,IAA+C,EAAA;AAAA,EAAA,oBACzEC,UAAU,CACN,UAAAC,IAAA,EAgCIC,GAAG,EACF;AAAA,IAAA,IA/BGC,EAAE,GAAAF,IAAA,CAAFE,EAAE;MACFC,SAAS,GAAAH,IAAA,CAATG,SAAS;MACTC,KAAK,GAAAJ,IAAA,CAALI,KAAK;MAGLC,WAAW,GAAAL,IAAA,CAAXK,WAAW;MACXC,YAAY,GAAAN,IAAA,CAAZM,YAAY;MACZC,KAAK,GAAAP,IAAA,CAALO,KAAK;MACLC,cAAc,GAAAR,IAAA,CAAdQ,cAAc;MACdC,WAAW,GAAAT,IAAA,CAAXS,WAAW;MACXC,UAAU,GAAAV,IAAA,CAAVU,UAAU;MAAAC,oB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3BC,EAAAA,IAAI,EAAE,WAAW;AACjBC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,MAAM,EAAEvH,aAAa;AACrBD,EAAAA,IAAI,EAAJA,IAAI;AACJyH,EAAAA,UAAU,EAAE;AACRxG,IAAAA,IAAI,EAAE;AACFyG,MAAAA,GAAG,EAAEC,MAAAA;KACR;AACDzG,IAAAA,IAAI,EAAE;AACFwG,MAAAA,GAAG,EAAEE,MAAAA;KACR;AACDtG,IAAAA,QAAQ,EAAE;AACNoG,MAAAA,GAAG,EAAEG,MAAW;AAChBC,MAAAA,KAAK,EAAE,IAAA;KACV;AACD1G,IAAAA,QAAQ,EAAE;AACNsG,MAAAA,GAAG,EAAEK,MAAW;AAChBD,MAAAA,KAAK,EAAE,IAAA;KACV;AACDlH,IAAAA,cAAc,EAAE;AACZ8G,MAAAA,GAAG,EAAEM,MAAAA;AACT,KAAA;GACH;AACDC,EAAAA,QAAQ,EAAE;AACN/G,IAAAA,IAAI,EAAE,GAAG;AACTD,IAAAA,IAAI,EAAE,SAAA;AACV,GAAA;AACJ;;;;"}
@@ -2,6 +2,10 @@ import { objectSpread2 as _objectSpread2, extends as _extends, toConsumableArray
2
2
  import React from 'react';
3
3
  import { _component } from './linaria.js';
4
4
 
5
+ //
6
+ // Тип HTMLAttributesOmitOnChange требуется чтобы использовать компонент с кастомным пропсом onChange
7
+ //
8
+
5
9
  var getStaticVariants = function getStaticVariants(config) {
6
10
  if (!config.variations) {
7
11
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type { ComponentConfig, HTMLAnyAttributes, HTMLTagList, PropsType, Variants } from './types';\n\nexport const getStaticVariants = (config: ComponentConfig) => {\n if (!config.variations) {\n return [];\n }\n const res = [];\n const { variations } = config;\n\n // eslint-disable-next-line guard-for-in\n for (const key in variations) {\n const { css } = variations[key];\n css && res.push(css);\n }\n\n return res;\n};\n\nexport const getDynamicVariants = (config: ComponentConfig) => {\n return (props: HTMLAnyAttributes) => {\n const res = [];\n\n // eslint-disable-next-line guard-for-in\n for (const key in config.variations) {\n if (key in props) {\n const variant = config.variations[key];\n\n const css = variant[props[key]];\n // no css for { modifier: true }\n css && Array.isArray(css) ? res.push(...css) : res.push(css);\n }\n }\n\n return res;\n };\n};\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends React.HTMLAttributes<HTMLElement>,\n LayoutPropsUser extends React.HTMLAttributes<HTMLElement> | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends React.HTMLAttributes<HTMLElement>\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) => (\n <Comp {...config?.defaults} {...props} ref={ref} />\n ));\n}\n"],"names":["getStaticVariants","config","variations","res","key","css","push","getDynamicVariants","props","variant","Array","isArray","apply","_toConsumableArray","mergeConfig","baseConfig","userConfig","_objectSpread","attrs","defaults","component","Comp","layout","_component","React","forwardRef","ref","createElement","_extends"],"mappings":";;;;IAKaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,MAAuB,EAAK;AAC1D,EAAA,IAAI,CAACA,MAAM,CAACC,UAAU,EAAE;AACpB,IAAA,OAAO,EAAE,CAAA;AACb,GAAA;EACA,IAAMC,GAAG,GAAG,EAAE,CAAA;AACd,EAAA,IAAQD,UAAU,GAAKD,MAAM,CAArBC,UAAU,CAAA;;AAElB;AACA,EAAA,KAAK,IAAME,GAAG,IAAIF,UAAU,EAAE;AAC1B,IAAA,IAAQG,GAAG,GAAKH,UAAU,CAACE,GAAG,CAAC,CAAvBC,GAAG,CAAA;AACXA,IAAAA,GAAG,IAAIF,GAAG,CAACG,IAAI,CAACD,GAAG,CAAC,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOF,GAAG,CAAA;AACd,EAAC;IAEYI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIN,MAAuB,EAAK;EAC3D,OAAO,UAACO,KAAwB,EAAK;IACjC,IAAML,GAAG,GAAG,EAAE,CAAA;;AAEd;AACA,IAAA,KAAK,IAAMC,GAAG,IAAIH,MAAM,CAACC,UAAU,EAAE;MACjC,IAAIE,GAAG,IAAII,KAAK,EAAE;AACd,QAAA,IAAMC,OAAO,GAAGR,MAAM,CAACC,UAAU,CAACE,GAAG,CAAC,CAAA;QAEtC,IAAMC,GAAG,GAAGI,OAAO,CAACD,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAA;AAC/B;QACAC,GAAG,IAAIK,KAAK,CAACC,OAAO,CAACN,GAAG,CAAC,GAAGF,GAAG,CAACG,IAAI,CAAAM,KAAA,CAART,GAAG,EAAAU,kBAAA,CAASR,G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ACI,QAAQ,IAAI,EAAE,EAAE;AACzC,IAAA,IAAI,EAAEf,IAAG,IAAID,GAAG,CAACgB,QAAQ,CAAC,EAAE;MACxBhB,GAAG,CAACgB,QAAQ,CAACf,IAAG,CAAC,GAAGW,UAAU,CAACI,QAAQ,CAACf,IAAG,CAAC,CAAA;AAChD,KAAA;AACJ,GAAA;AAEA,EAAA,OAAOD,GAAG,CAAA;AAMd,EAAC;AAEM,SAASiB,SAASA,CAMrBnB,MAAqE,EACjB;EACpD,IAAMoB,IAAI,GAAGpB,MAAM,CAACqB,MAAM,CAACC,UAAU,CAAEtB,MAAqC,CAAC,CAAC,CAAA;AAE9E,EAAA,oBAAOuB,KAAK,CAACC,UAAU,CAAmC,UAACjB,KAAK,EAAEkB,GAAG,EAAA;AAAA,IAAA,oBACjEF,KAAA,CAAAG,aAAA,CAACN,IAAI,EAAAO,QAAA,CAAA,EAAA,EAAK3B,MAAM,KAAA,IAAA,IAANA,MAAM,KAANA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,MAAM,CAAEkB,QAAQ,EAAMX,KAAK,EAAA;AAAEkB,MAAAA,GAAG,EAAEA,GAAAA;AAAI,KAAA,CAAE,CAAC,CAAA;AAAA,GACtD,CAAC,CAAA;AACN;;;;"}
1
+ {"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type {\n ComponentConfig,\n HTMLAnyAttributes,\n HTMLTagList,\n PropsType,\n Variants,\n HTMLAttributesOmitOnChange,\n} from './types';\n\n//\n// Тип HTMLAttributesOmitOnChange требуется чтобы использовать компонент с кастомным пропсом onChange\n//\n\nexport const getStaticVariants = (config: ComponentConfig) => {\n if (!config.variations) {\n return [];\n }\n const res = [];\n const { variations } = config;\n\n // eslint-disable-next-line guard-for-in\n for (const key in variations) {\n const { css } = variations[key];\n css && res.push(css);\n }\n\n return res;\n};\n\nexport const getDynamicVariants = (config: ComponentConfig) => {\n return (props: HTMLAnyAttributes) => {\n const res = [];\n\n // eslint-disable-next-line guard-for-in\n for (const key in config.variations) {\n if (key in props) {\n const variant = config.variations[key];\n\n const css = variant[props[key]];\n // no css for { modifier: true }\n css && Array.isArray(css) ? res.push(...css) : res.push(css);\n }\n }\n\n return res;\n };\n};\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends React.HTMLAttributes<HTMLElement> | HTMLAttributesOmitOnChange,\n LayoutPropsUser extends React.HTMLAttributes<HTMLElement> | HTMLAttributesOmitOnChange | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends React.HTMLAttributes<HTMLElement> | HTMLAttributesOmitOnChange\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) => (\n <Comp {...config?.defaults} {...props} ref={ref} />\n ));\n}\n"],"names":["getStaticVariants","config","variations","res","key","css","push","getDynamicVariants","props","variant","Array","isArray","apply","_toConsumableArray","mergeConfig","baseConfig","userConfig","_objectSpread","attrs","defaults","component","Comp","layout","_component","React","forwardRef","ref","createElement","_extends"],"mappings":";;;;AAYA;AACA;AACA;;IAEaA,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,MAAuB,EAAK;AAC1D,EAAA,IAAI,CAACA,MAAM,CAACC,UAAU,EAAE;AACpB,IAAA,OAAO,EAAE,CAAA;AACb,GAAA;EACA,IAAMC,GAAG,GAAG,EAAE,CAAA;AACd,EAAA,IAAQD,UAAU,GAAKD,MAAM,CAArBC,UAAU,CAAA;;AAElB;AACA,EAAA,KAAK,IAAME,GAAG,IAAIF,UAAU,EAAE;AAC1B,IAAA,IAAQG,GAAG,GAAKH,UAAU,CAACE,GAAG,CAAC,CAAvBC,GAAG,CAAA;AACXA,IAAAA,GAAG,IAAIF,GAAG,CAACG,IAAI,CAACD,GAAG,CAAC,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOF,GAAG,CAAA;AACd,EAAC;IAEYI,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAIN,MAAuB,EAAK;EAC3D,OAAO,UAACO,KAAwB,EAAK;IACjC,IAAML,GAAG,GAAG,EAAE,CAAA;;AAEd;AACA,IAAA,KAAK,IAAMC,GAAG,IAAIH,MAAM,CAACC,UAAU,EAAE;MACjC,IAAIE,GAAG,IAAII,KAAK,EAAE;AACd,QAAA,IAAMC,OAAO,GAAGR,MAAM,CAACC,UAAU,CAACE,GAAG,CAAC,CAAA;QAEtC,IAAMC,GAAG,GAAGI,OAAO,CAACD,KAAK,CAACJ,GAAG,CAAC,CAAC,CAAA;AAC/B;QACAC,GAAG,IAAIK,KAAK,CAACC,OAAO,CAACN,GAAG,CAAC,GAAGF,GAAG,CAACG,IAAI,CAAAM,KAAA,CA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,IAAMd,IAAG,IAAIW,UAAU,CAACI,QAAQ,IAAI,EAAE,EAAE;AACzC,IAAA,IAAI,EAAEf,IAAG,IAAID,GAAG,CAACgB,QAAQ,CAAC,EAAE;MACxBhB,GAAG,CAACgB,QAAQ,CAACf,IAAG,CAAC,GAAGW,UAAU,CAACI,QAAQ,CAACf,IAAG,CAAC,CAAA;AAChD,KAAA;AACJ,GAAA;AAEA,EAAA,OAAOD,GAAG,CAAA;AAMd,EAAC;AAEM,SAASiB,SAASA,CAMrBnB,MAAqE,EACjB;EACpD,IAAMoB,IAAI,GAAGpB,MAAM,CAACqB,MAAM,CAACC,UAAU,CAAEtB,MAAqC,CAAC,CAAC,CAAA;AAE9E,EAAA,oBAAOuB,KAAK,CAACC,UAAU,CAAmC,UAACjB,KAAK,EAAEkB,GAAG,EAAA;AAAA,IAAA,oBACjEF,KAAA,CAAAG,aAAA,CAACN,IAAI,EAAAO,QAAA,CAAA,EAAA,EAAK3B,MAAM,KAAA,IAAA,IAANA,MAAM,KAANA,KAAAA,CAAAA,GAAAA,KAAAA,CAAAA,GAAAA,MAAM,CAAEkB,QAAQ,EAAMX,KAAK,EAAA;AAAEkB,MAAAA,GAAG,EAAEA,GAAAA;AAAI,KAAA,CAAE,CAAC,CAAA;AAAA,GACtD,CAAC,CAAA;AACN;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/engines/index.ts"],"sourcesContent":["import { css as cssLibrary } from '@linaria/core';\n\nimport type { CSS } from './types';\n\nexport const css = cssLibrary as CSS;\nexport { mergeConfig, component } from './common';\n\nexport type { Variant, ComponentConfig, RootProps, CSS } from './types';\n"],"names":["css","cssLibrary"],"mappings":";;;;AAIO,IAAMA,GAAG,GAAGC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/engines/index.ts"],"sourcesContent":["import { css as cssLibrary } from '@linaria/core';\n\nimport type { CSS } from './types';\n\nexport const css = cssLibrary as CSS;\nexport { mergeConfig, component } from './common';\n\nexport type { Variant, ComponentConfig, RootProps, CSS, RootPropsOmitOnChange } from './types';\n"],"names":["css","cssLibrary"],"mappings":";;;;AAIO,IAAMA,GAAG,GAAGC;;;;"}
@@ -0,0 +1,11 @@
1
+ import { useLayoutEffect, useEffect } from 'react';
2
+ import { canUseDOM } from '../utils/canUseDOM.js';
3
+ import '../utils/react.js';
4
+
5
+ /**
6
+ * Runs effect safely on server.
7
+ */
8
+ var useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;
9
+
10
+ export { useIsomorphicLayoutEffect };
11
+ //# sourceMappingURL=useIsomorphicLayoutEffect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsomorphicLayoutEffect.js","sources":["../../src/hooks/useIsomorphicLayoutEffect.ts"],"sourcesContent":["import { useLayoutEffect, useEffect } from 'react';\n\nimport { canUseDOM } from '../utils';\n\n/**\n * Runs effect safely on server.\n */\nexport const useIsomorphicLayoutEffect = canUseDOM ? useLayoutEffect : useEffect;\n"],"names":["useIsomorphicLayoutEffect","canUseDOM","useLayoutEffect","useEffect"],"mappings":";;;;AAIA;AACA;AACA;IACaA,yBAAyB,GAAGC,SAAS,GAAGC,eAAe,GAAGC;;;;"}
package/es/index.css CHANGED
@@ -532,3 +532,28 @@
532
532
  .Toolbar_styles_iomsh3_bd5aerk__291bdbec{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;box-sizing:border-box;border-radius:var(--plasma-toolbar-border-radius);background:var(--plasma-toolbar-background);padding:var(--plasma-toolbar-padding);}.Toolbar_styles_iomsh3_bd5aerk__291bdbec.Toolbar_styles_iomsh3_toolbarShadow__291bdbec{box-shadow:var(--plasma-toolbar-box-shadow);}.Toolbar_styles_iomsh3_bd5aerk__291bdbec.Toolbar_styles_iomsh3_toolbarVertical__291bdbec{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;width:var(--plasma-toolbar-size);}.Toolbar_styles_iomsh3_bd5aerk__291bdbec.Toolbar_styles_iomsh3_toolbarHorizontal__291bdbec{-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;height:var(--plasma-toolbar-size);}.Toolbar_styles_iomsh3_bd5aerk__291bdbec.Toolbar_styles_iomsh3_toolbarVertical__291bdbec .Toolbar_styles_iomsh3_plasmaDivider__291bdbec{width:var(--plasma-toolbar-divider-size);height:0.063rem;margin:var(--plasma-toolbar-divider-offset) 0;}.Toolbar_styles_iomsh3_bd5aerk__291bdbec.Toolbar_styles_iomsh3_toolbarHorizontal__291bdbec .Toolbar_styles_iomsh3_plasmaDivider__291bdbec{width:0.063rem;height:var(--plasma-toolbar-divider-size);margin:0 var(--plasma-toolbar-divider-offset);}
533
533
 
534
534
  .ToolbarDivider_styles_1ypqhb1_mcdkovg__81732880{-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;--plasma-divider-background:var(--plasma-toolbar-divider-color);--plasma-divider-border-radius:var(--plasma-toolbar-divider-border-radius);}
535
+
536
+ .SliderBase_styles_7is2ll_s33crq1__0c0959e2{-webkit-flex:1;-ms-flex:1;flex:1;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;height:var(--plasma-slider-height);}
537
+ .SliderBase_styles_7is2ll_rnaoqfb__0c0959e2{height:100%;}
538
+ .SliderBase_styles_7is2ll_r1bro5xo__0c0959e2{position:relative;top:50%;height:var(--plasma-slider-rail-height);border-radius:var(--plasma-slider-rail-border-radius);background-color:var(--plasma-slider-rail-background-color);overflow:hidden;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}
539
+ .SliderBase_styles_7is2ll_fdg7yhg__0c0959e2{position:absolute;height:100%;top:0;left:0;background:var(--plasma-slider-fill-color);width:0;}
540
+
541
+ .Single_styles_1r9f1e0_l1p4kc08__4db690dd{color:var(--plasma-slider-label-color);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-slider-label-wrapper-gap);}
542
+
543
+ .Single_styles_1r9f1e0_lozb535__4db690dd{font-family:var(--plasma-slider-label-font-family);font-size:var(--plasma-slider-label-font-size);font-style:var(--plasma-slider-label-font-style);font-weight:var(--plasma-slider-label-font-weight);-webkit-letter-spacing:var(--plasma-slider-label-letter-spacing);-moz-letter-spacing:var(--plasma-slider-label-letter-spacing);-ms-letter-spacing:var(--plasma-slider-label-letter-spacing);letter-spacing:var(--plasma-slider-label-letter-spacing);line-height:var(--plasma-slider-label-line-height);}
544
+ .Single_styles_1r9f1e0_s1w9icbd__4db690dd{color:var(--plasma-slider-range-value-color);font-family:var(--plasma-slider-range-value-font-family);font-size:var(--plasma-slider-range-value-font-size);font-style:var(--plasma-slider-range-value-font-style);font-weight:var(--plasma-slider-range-value-font-weight);-webkit-letter-spacing:var(--plasma-slider-range-value-letter-spacing);-moz-letter-spacing:var(--plasma-slider-range-value-letter-spacing);-ms-letter-spacing:var(--plasma-slider-range-value-letter-spacing);letter-spacing:var(--plasma-slider-range-value-letter-spacing);line-height:var(--plasma-slider-range-value-line-height);-webkit-transition:opacity 0.1s ease-in-out;transition:opacity 0.1s ease-in-out;}.Single_styles_1r9f1e0_s1w9icbd__4db690dd.Single_styles_1r9f1e0_sliderHideMinValue__4db690dd,.Single_styles_1r9f1e0_s1w9icbd__4db690dd.Single_styles_1r9f1e0_sliderHideMaxValue__4db690dd{opacity:0;}.Single_styles_1r9f1e0_s1w9icbd__4db690dd.Single_styles_1r9f1e0_sliderActiveRangeValue__4db690dd{color:var(--plasma-slider-label-color);}
545
+ .Single_styles_1r9f1e0_s1d2sfgl__4db690dd{position:relative;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex:1;-ms-flex:1;flex:1;}.Single_styles_1r9f1e0_s1d2sfgl__4db690dd.Single_styles_1r9f1e0_sliderRangeValuesPlacementOuter__4db690dd .Single_styles_1r9f1e0_s1w9icbd__4db690dd{position:absolute;bottom:var(--plasma-slider-range-value-bottom-offset);left:0;}.Single_styles_1r9f1e0_s1d2sfgl__4db690dd.Single_styles_1r9f1e0_sliderRangeValuesPlacementOuter__4db690dd .Single_styles_1r9f1e0_s1w9icbd__4db690dd.Single_styles_1r9f1e0_sliderMaxRangeValue__4db690dd{left:unset;right:0;}.Single_styles_1r9f1e0_s1d2sfgl__4db690dd.Single_styles_1r9f1e0_sliderRangeValuesPlacementInner__4db690dd{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}.Single_styles_1r9f1e0_s1d2sfgl__4db690dd.Single_styles_1r9f1e0_sliderRangeValuesPlacementInner__4db690dd .Single_styles_1r9f1e0_s1w9icbd__4db690dd{margin-right:var(--plasma-slider-range-min-value-margin);}.Single_styles_1r9f1e0_s1d2sfgl__4db690dd.Single_styles_1r9f1e0_sliderRangeValuesPlacementInner__4db690dd .Single_styles_1r9f1e0_s1w9icbd__4db690dd.Single_styles_1r9f1e0_sliderMaxRangeValue__4db690dd{margin-right:0;margin-left:var(--plasma-slider-range-max-value-margin);}
546
+ .Single_styles_1r9f1e0_ss3ujqx__4db690dd{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;opacity:var(--plasma-slider-disabled-opacity);}.Single_styles_1r9f1e0_ss3ujqx__4db690dd.Single_styles_1r9f1e0_sliderLabelPlacementOuter__4db690dd{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.Single_styles_1r9f1e0_ss3ujqx__4db690dd.Single_styles_1r9f1e0_sliderLabelPlacementOuter__4db690dd .Single_styles_1r9f1e0_l1p4kc08__4db690dd{margin-bottom:var(--plasma-slider-label-wrapper-margin-bottom);}.Single_styles_1r9f1e0_ss3ujqx__4db690dd.Single_styles_1r9f1e0_sliderLabelPlacementInner__4db690dd .Single_styles_1r9f1e0_l1p4kc08__4db690dd{margin-right:var(--plasma-slider-label-wrapper-margin-right);}
547
+
548
+ .Double_styles_1jhda4u_lcs82cd__5dc981f4{color:var(--plasma-slider-label-color);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-slider-label-wrapper-gap);margin-bottom:var(--plasma-slider-label-wrapper-margin-bottom);}
549
+
550
+ .Double_styles_1jhda4u_l1at2q9b__5dc981f4{font-family:var(--plasma-slider-label-font-family);font-size:var(--plasma-slider-label-font-size);font-style:var(--plasma-slider-label-font-style);font-weight:var(--plasma-slider-label-font-weight);-webkit-letter-spacing:var(--plasma-slider-label-letter-spacing);-moz-letter-spacing:var(--plasma-slider-label-letter-spacing);-ms-letter-spacing:var(--plasma-slider-label-letter-spacing);letter-spacing:var(--plasma-slider-label-letter-spacing);line-height:var(--plasma-slider-label-line-height);}
551
+ .Double_styles_1jhda4u_i11dc2og__5dc981f4{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:var(--plasma-slider-text-field-wrapper-gap);margin-top:var(--plasma-slider-double-wrapper-gap);}
552
+ .Double_styles_1jhda4u_s4zvp7i__5dc981f4{-webkit-flex:1;-ms-flex:1;flex:1;--plasma-textfield-color:var(--plasma-slider-text-field-color);--plasma-textfield-bg-color:var(--plasma-slider-text-field-background-color);--plasma-textfield__caret-color:var(--plasma-slider-text-field-caret-color);--plasma-textfield__placeholder-color:var(--plasma-slider-text-field-placeholder-color);--plasma-textfield-disabled-opacity:var(--plasma-slider-disabled-opacity);--plasma-textfield-height:var(--plasma-slider-text-field-height);--plasma-textfield-padding:var(--plasma-slider-text-field-padding);--plasma-textfield-border-radius:var(--plasma-slider-text-field-border-radius);--plasma-textfield-font-family:var(--plasma-slider-text-field-font-family);--plasma-textfield-font-size:var(--plasma-slider-text-field-font-size);--plasma-textfield-font-style:var(--plasma-slider-text-field-font-style);--plasma-textfield-font-weight:var(--plasma-slider-text-field-font-weight);--plasma-textfield-letter-spacing:var(--plasma-slider-text-field-letter-spacing);--plasma-textfield-line-height:var(--plasma-slider-text-field-line-height);}.Double_styles_1jhda4u_s4zvp7i__5dc981f4.Double_styles_1jhda4u_sliderFirstTextField__5dc981f4 > div{border-top-right-radius:0;border-bottom-right-radius:0;}.Double_styles_1jhda4u_s4zvp7i__5dc981f4.Double_styles_1jhda4u_sliderSecondTextField__5dc981f4 > div{border-top-left-radius:0;border-bottom-left-radius:0;}.Double_styles_1jhda4u_s4zvp7i__5dc981f4 input:focus,.Double_styles_1jhda4u_s4zvp7i__5dc981f4.Double_styles_1jhda4u_sliderTextFieldActive__5dc981f4{--plasma-textfield-color:var(--plasma-slider-text-field-focus-color);}
553
+ .Double_styles_1jhda4u_d3kvcjo__5dc981f4{opacity:var(--plasma-slider-disabled-opacity);}
554
+
555
+
556
+ .Handler_styles_8crx5z_h1tnrnip__2d4342c7{cursor:pointer;position:absolute;z-index:1;top:0;left:0;}
557
+ .Handler_styles_8crx5z_s12uu2lj__2d4342c7{position:absolute;z-index:1;top:var(--plasma-slider-current-value-top-offset);text-align:center;width:100%;margin-left:-0.125rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;font-family:var(--plasma-slider-current-value-font-family);font-size:var(--plasma-slider-current-value-font-size);font-style:var(--plasma-slider-current-value-font-style);font-weight:var(--plasma-slider-current-value-font-weight);-webkit-letter-spacing:var(--plasma-slider-current-value-letter-spacing);-moz-letter-spacing:var(--plasma-slider-current-value-letter-spacing);-ms-letter-spacing:var(--plasma-slider-current-value-letter-spacing);letter-spacing:var(--plasma-slider-current-value-letter-spacing);line-height:var(--plasma-slider-current-value-line-height);}
558
+
559
+ .Thumb_styles_4w4gzn_tqbdf8b__14129a5b{width:var(--plasma-slider-thumb-size);height:var(--plasma-slider-thumb-size);position:relative;left:-0.125rem;top:-0.125rem;border-radius:50%;box-sizing:border-box;background:var(--plasma-slider-thumb-background-color);margin:0.125rem;-webkit-transition:border-color 0.1s ease-in-out;transition:border-color 0.1s ease-in-out;position:relative;}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b:after{background:var(--plasma-slider-thumb-border-color);margin:-0.125rem;content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b:not([disabled]):hover:after,.Thumb_styles_4w4gzn_tqbdf8b__14129a5b:not([disabled]):active:after{background:var(--plasma-slider-thumb-focus-border-color);}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b[disabled]{cursor:not-allowed;}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b:focus{outline:none;}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b::before{content:'';position:absolute;top:0.125rem;left:0.125rem;right:0.125rem;bottom:0.125rem;z-index:1;display:block;box-sizing:content-box;border:0.125rem solid transparent;border-radius:50%;-webkit-transition:box-shadow 0.2s ease-in-out;transition:box-shadow 0.2s ease-in-out;pointer-events:none;}.Thumb_styles_4w4gzn_tqbdf8b__14129a5b.Thumb_styles_4w4gzn_focusVisible__14129a5b:focus::before,.Thumb_styles_4w4gzn_tqbdf8b__14129a5b[data-focus-visible-added]::before{outline:none;box-shadow:0 0 0 0.125rem var(--plasma-slider-thumb-focus-border-color);}
package/es/index.js CHANGED
@@ -13,6 +13,7 @@ export { useUniqId } from './hooks/useUniqId.js';
13
13
  export { usePreviousValue } from './hooks/usePreviousValue.js';
14
14
  export { useForceUpdate } from './hooks/useForceUpdate.js';
15
15
  export { useDidMountEffect } from './hooks/useDidMountEffect.js';
16
+ export { useIsomorphicLayoutEffect } from './hooks/useIsomorphicLayoutEffect.js';
16
17
  export { composableStyle, cx } from './utils/index.js';
17
18
  export { buttonConfig, buttonRoot } from './components/Button/Button.js';
18
19
  export { classes as buttonClasses, tokens as buttonTokens } from './components/Button/Button.tokens.js';
@@ -165,7 +166,14 @@ export { classes as dividerClasses, tokens as dividerTokens } from './components
165
166
  export { toolbarConfig, toolbarRoot } from './components/Toolbar/Toolbar.js';
166
167
  export { tokens as toolbarTokens } from './components/Toolbar/Toolbar.tokens.js';
167
168
  export { toolbarDividerConfig, toolbarDividerRoot } from './components/Toolbar/ui/ToolbarDivider/ToolbarDivider.js';
169
+ export { sliderConfig, sliderRoot } from './components/Slider/Slider.js';
170
+ export { tokens as sliderTokens } from './components/Slider/Slider.tokens.js';
171
+ import 'react';
172
+ import 'react-draggable';
173
+ export { ThumbBase } from './components/Slider/ui/Thumb/Thumb.styles.js';
174
+ import '@linaria/react';
168
175
  export { component, mergeConfig } from './engines/common.js';
176
+ export { canUseDOM } from './utils/canUseDOM.js';
169
177
  export { extractTextFrom } from './utils/extractTextFrom.js';
170
178
  export { getSizeValueFromProp } from './utils/getSizeValueFromProp.js';
171
179
  export { IS_REACT_18, safeUseId } from './utils/react.js';
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This constant tells you whether can DOM be used.
3
+ * https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
4
+ */
5
+ var canUseDOM = /*#__PURE__*/Boolean(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined');
6
+
7
+ export { canUseDOM };
8
+ //# sourceMappingURL=canUseDOM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canUseDOM.js","sources":["../../src/utils/canUseDOM.ts"],"sourcesContent":["/**\n * This constant tells you whether can DOM be used.\n * https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js\n */\nexport const canUseDOM = Boolean(\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined',\n);\n"],"names":["canUseDOM","Boolean","window","document","createElement"],"mappings":"AAAA;AACA;AACA;AACA;AACO,IAAMA,SAAS,gBAAGC,OAAO,CAC5B,OAAOC,MAAM,KAAK,WAAW,IACzB,OAAOA,MAAM,CAACC,QAAQ,KAAK,WAAW,IACtC,OAAOD,MAAM,CAACC,QAAQ,CAACC,aAAa,KAAK,WACjD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import { CSSProperties } from '@linaria/core';\n\nexport { extractTextFrom } from './extractTextFrom';\nexport { getSizeValueFromProp } from './getSizeValueFromProp';\nexport { IS_REACT_18, safeUseId } from './react';\nexport { isNumber } from './isNumber';\n\nexport const cx = (...classes: (string | undefined)[]) => classes.filter((classItem) => classItem).join(' ');\n\nexport const composableStyle = (s: TemplateStringsArray, ...expr: Array<string | number | CSSProperties>): string => {\n let res = '';\n for (let i = 0; i < Math.max(s.length, expr.length); ++i) {\n res += s[i] ?? '';\n res += expr[i] ?? '';\n }\n\n return res;\n};\n"],"names":["cx","_len","arguments","length","classes","Array","_key","filter","classItem","join","composableStyle","s","res","i","Math","max","_s$i","_ref","undefined"],"mappings":";;;AAOaA,IAAAA,EAAE,GAAG,SAALA,EAAEA,GAAA;AAAA,EAAA,KAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,OAAO,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAPF,IAAAA,OAAO,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA,CAAA;AAAA,GAAA;AAAA,EAAA,OAA6BF,OAAO,CAACG,MAAM,CAAC,UAACC,SAAS,EAAA;AAAA,IAAA,OAAKA,SAAS,CAAA;AAAA,GAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;AAAA,EAAA;IAE/FC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,CAAuB,EAA8D;EACjH,IAAIC,GAAG,GAAG,EAAE,CAAA;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACR,MAAM,EAAAD,SAAA,CAAAC,MAAA,IAAA,CAAA,GAAA,CAAA,GAAAD,SAAA,CAAAC,MAAA,GAAA,CAAa,CAAC,EAAE,EAAEU,CAAC,EAAE;IAAA,IAAAG,IAAA,EAAAC,IAAA,CAAA;AACtDL,IAAAA,GAAG,IAAAI,CAAAA,IAAA,GAAIL,CAAC,CAACE,CAAC,CAAC,MAAA,IAAA,IAAAG,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAI,EAAE,CAAA;IACjBJ,GAAG,IAAA,CAAAK,IAAA,GAASJ,CAAC,YAAAX,SAAA,CAAAC,MAAA,IAADU,CAAC,OAAAK,SAAA,GAAAhB,SAAA,CAADW,CAAC,mBAAAI,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAK,EAAE,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOL,GAAG,CAAA;AACd;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/index.ts"],"sourcesContent":["import { CSSProperties } from '@linaria/core';\n\nexport { canUseDOM } from './canUseDOM';\nexport { extractTextFrom } from './extractTextFrom';\nexport { getSizeValueFromProp } from './getSizeValueFromProp';\nexport { IS_REACT_18, safeUseId } from './react';\nexport { isNumber } from './isNumber';\n\nexport const cx = (...classes: (string | undefined)[]) => classes.filter((classItem) => classItem).join(' ');\n\nexport const composableStyle = (s: TemplateStringsArray, ...expr: Array<string | number | CSSProperties>): string => {\n let res = '';\n for (let i = 0; i < Math.max(s.length, expr.length); ++i) {\n res += s[i] ?? '';\n res += expr[i] ?? '';\n }\n\n return res;\n};\n"],"names":["cx","_len","arguments","length","classes","Array","_key","filter","classItem","join","composableStyle","s","res","i","Math","max","_s$i","_ref","undefined"],"mappings":";;;AAQaA,IAAAA,EAAE,GAAG,SAALA,EAAEA,GAAA;AAAA,EAAA,KAAA,IAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAOC,OAAO,GAAAC,IAAAA,KAAA,CAAAJ,IAAA,GAAAK,IAAA,GAAA,CAAA,EAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA,EAAA,EAAA;AAAPF,IAAAA,OAAO,CAAAE,IAAA,CAAAJ,GAAAA,SAAA,CAAAI,IAAA,CAAA,CAAA;AAAA,GAAA;AAAA,EAAA,OAA6BF,OAAO,CAACG,MAAM,CAAC,UAACC,SAAS,EAAA;AAAA,IAAA,OAAKA,SAAS,CAAA;AAAA,GAAA,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC,CAAA;AAAA,EAAA;IAE/FC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,CAAuB,EAA8D;EACjH,IAAIC,GAAG,GAAG,EAAE,CAAA;EACZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACC,GAAG,CAACJ,CAAC,CAACR,MAAM,EAAAD,SAAA,CAAAC,MAAA,IAAA,CAAA,GAAA,CAAA,GAAAD,SAAA,CAAAC,MAAA,GAAA,CAAa,CAAC,EAAE,EAAEU,CAAC,EAAE;IAAA,IAAAG,IAAA,EAAAC,IAAA,CAAA;AACtDL,IAAAA,GAAG,IAAAI,CAAAA,IAAA,GAAIL,CAAC,CAACE,CAAC,CAAC,MAAA,IAAA,IAAAG,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAI,EAAE,CAAA;IACjBJ,GAAG,IAAA,CAAAK,IAAA,GAASJ,CAAC,YAAAX,SAAA,CAAAC,MAAA,IAADU,CAAC,OAAAK,SAAA,GAAAhB,SAAA,CAADW,CAAC,mBAAAI,IAAA,KAAA,KAAA,CAAA,GAAAA,IAAA,GAAK,EAAE,CAAA;AACxB,GAAA;AAEA,EAAA,OAAOL,GAAG,CAAA;AACd;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/plasma-new-hope",
3
- "version": "0.80.0",
3
+ "version": "0.81.0-canary.1194.9102719796.0",
4
4
  "description": "Salute Design System blueprint",
5
5
  "main": "cjs/index.js",
6
6
  "module": "es/index.js",
@@ -99,8 +99,9 @@
99
99
  "@popperjs/core": "2.11.8",
100
100
  "@salutejs/plasma-core": "1.159.0",
101
101
  "focus-visible": "5.2.0",
102
+ "react-draggable": "4.4.3",
102
103
  "react-popper": "2.3.0",
103
104
  "storeon": "3.1.5"
104
105
  },
105
- "gitHead": "018b3bdb3fc0ef131f01b75fe1cbaece1a4aca2d"
106
+ "gitHead": "5110d338806b5b2152ef724358fe70bafb3e2ca1"
106
107
  }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ 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); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.sliderRoot = exports.sliderConfig = void 0;
8
+ var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
9
+ var _base = /*#__PURE__*/require("./variations/_view/base");
10
+ var _base2 = /*#__PURE__*/require("./variations/_size/base");
11
+ var _base3 = /*#__PURE__*/require("./variations/_disabled/base");
12
+ var _components = /*#__PURE__*/require("./components");
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
15
+ 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); }
16
+ var isSingleValueProps = function isSingleValueProps(props) {
17
+ return typeof props.value === 'number';
18
+ };
19
+ var sliderRoot = exports.sliderRoot = function sliderRoot(Root) {
20
+ return /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
21
+ return /*#__PURE__*/_react["default"].createElement(Root, _extends({
22
+ ref: ref
23
+ }, props), isSingleValueProps(props) && /*#__PURE__*/_react["default"].createElement(_components.SingleSlider, props), !isSingleValueProps(props) && /*#__PURE__*/_react["default"].createElement(_components.DoubleSlider, props));
24
+ });
25
+ };
26
+ var sliderConfig = exports.sliderConfig = {
27
+ name: 'Slider',
28
+ tag: 'div',
29
+ layout: sliderRoot,
30
+ base: '',
31
+ variations: {
32
+ view: {
33
+ css: _base.base
34
+ },
35
+ size: {
36
+ css: _base2.base
37
+ },
38
+ disabled: {
39
+ css: _base3.base,
40
+ attrs: true
41
+ }
42
+ },
43
+ defaults: {
44
+ view: 'default',
45
+ size: 'm'
46
+ }
47
+ };
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tokens = exports.classes = void 0;
7
+ var classes = exports.classes = {
8
+ labelPlacementOuter: 'slider-label-placement-outer',
9
+ labelPlacementInner: 'slider-label-placement-inner',
10
+ rangeValuesPlacementOuter: 'slider-range-values-placement-outer',
11
+ rangeValuesPlacementInner: 'slider-range-values-placement-inner',
12
+ maxRangeValue: 'slider-max-range-value',
13
+ hideMinValue: 'slider-hide-min-value',
14
+ hideMaxValue: 'slider-hide-max-value',
15
+ textFieldActive: 'slider-text-field-active',
16
+ firstTextField: 'slider-first-text-field',
17
+ secondTextField: 'slider-second-text-field',
18
+ activeRangeValue: 'slider-active-range-value'
19
+ };
20
+ var tokens = exports.tokens = {
21
+ height: '--plasma-slider-height',
22
+ labelWrapperGap: '--plasma-slider-label-wrapper-gap',
23
+ labelWrapperMarginBottom: '--plasma-slider-label-wrapper-margin-bottom',
24
+ labelWrapperMarginRight: '--plasma-slider-label-wrapper-margin-right',
25
+ labelColor: '--plasma-slider-label-color',
26
+ labelFontFamily: '--plasma-slider-label-font-family',
27
+ labelFontSize: '--plasma-slider-label-font-size',
28
+ labelFontStyle: '--plasma-slider-label-font-style',
29
+ labelFontWeight: '--plasma-slider-label-font-weight',
30
+ labelLetterSpacing: '--plasma-slider-label-letter-spacing',
31
+ labelLineHeight: '--plasma-slider-label-line-height',
32
+ rangeMinValueMargin: '--plasma-slider-range-min-value-margin',
33
+ rangeMaxValueMargin: '--plasma-slider-range-max-value-margin',
34
+ rangeValueBottomOffset: '--plasma-slider-range-value-bottom-offset',
35
+ rangeValueColor: '--plasma-slider-range-value-color',
36
+ rangeValueFontFamily: '--plasma-slider-range-value-font-family',
37
+ rangeValueFontSize: '--plasma-slider-range-value-font-size',
38
+ rangeValueFontStyle: '--plasma-slider-range-value-font-style',
39
+ rangeValueFontWeight: '--plasma-slider-range-value-font-weight',
40
+ rangeValueLetterSpacing: '--plasma-slider-range-value-letter-spacing',
41
+ rangeValueLineHeight: '--plasma-slider-range-value-line-height',
42
+ doubleWrapperGap: '--plasma-slider-double-wrapper-gap',
43
+ thumbSize: '--plasma-slider-thumb-size',
44
+ thumbBorder: '--plasma-slider-thumb-border',
45
+ thumbBorderColor: '--plasma-slider-thumb-border-color',
46
+ thumbBackgroundColor: '--plasma-slider-thumb-background-color',
47
+ thumbFocusBorderColor: '--plasma-slider-thumb-focus-border-color',
48
+ currentValueTopOffset: '--plasma-slider-current-value-top-offset',
49
+ currentValueFontFamily: '--plasma-slider-current-value-font-family',
50
+ currentValueFontSize: '--plasma-slider-current-value-font-size',
51
+ currentValueFontStyle: '--plasma-slider-current-value-font-style',
52
+ currentValueFontWeight: '--plasma-slider-current-value-font-weight',
53
+ currentValueLetterSpacing: '--plasma-slider-current-value-letter-spacing',
54
+ currentValueLineHeight: '--plasma-slider-current-value-line-height',
55
+ railBackgroundColor: '--plasma-slider-rail-background-color',
56
+ railHeight: '--plasma-slider-rail-height',
57
+ railBorderRadius: '--plasma-slider-rail-border-radius',
58
+ railIndent: '--plasma-slider-rail-indent',
59
+ fillColor: '--plasma-slider-fill-color',
60
+ textFieldWrapperGap: '--plasma-slider-text-field-wrapper-gap',
61
+ textFieldFontFamily: '--plasma-slider-text-field-font-family',
62
+ textFieldFontSize: '--plasma-slider-text-field-font-size',
63
+ textFieldFontStyle: '--plasma-slider-text-field-font-style',
64
+ textFieldFontWeight: '--plasma-slider-text-field-font-weight',
65
+ textFieldLetterSpacing: '--plasma-slider-text-field-letter-spacing',
66
+ textFieldLineHeight: '--plasma-slider-text-field-line-height',
67
+ textFieldHeight: '--plasma-slider-text-field-height',
68
+ textFieldPadding: '--plasma-slider-text-field-padding',
69
+ textFieldBorderRadius: '--plasma-slider-text-field-border-radius',
70
+ textFieldColor: '--plasma-slider-text-field-color',
71
+ textFieldActiveColor: '--plasma-slider-text-field-active-color',
72
+ textFieldBackgroundColor: '--plasma-slider-text-field-background-color',
73
+ textFieldCaretColor: '--plasma-slider-text-field-caret-color',
74
+ textFieldPlaceholderColor: '--plasma-slider-text-field-placeholder-color',
75
+ textFiledFocusColor: '--plasma-slider-text-field-focus-color',
76
+ disabledOpacity: '--plasma-slider-disabled-opacity'
77
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });