@foxford/ui 2.76.1-beta-3d975b5-20250715 → 2.77.0-beta-90a741d-20250807

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/LICENSE +27 -0
  2. package/components/Accordion/Accordion.js +1 -1
  3. package/components/Accordion/Accordion.js.map +1 -1
  4. package/components/Accordion/Accordion.mjs +1 -1
  5. package/components/Accordion/Accordion.mjs.map +1 -1
  6. package/components/Accordion/hooks.js +1 -1
  7. package/components/Accordion/hooks.js.map +1 -1
  8. package/components/Accordion/hooks.mjs +1 -1
  9. package/components/Accordion/hooks.mjs.map +1 -1
  10. package/components/AccordionItem/AccordionItem.js +1 -1
  11. package/components/AccordionItem/AccordionItem.js.map +1 -1
  12. package/components/AccordionItem/AccordionItem.mjs +1 -1
  13. package/components/AccordionItem/AccordionItem.mjs.map +1 -1
  14. package/components/ActionBtn/ActionBtn.js +1 -1
  15. package/components/ActionBtn/ActionBtn.js.map +1 -1
  16. package/components/ActionBtn/ActionBtn.mjs +1 -1
  17. package/components/ActionBtn/ActionBtn.mjs.map +1 -1
  18. package/components/ActionBtn/style.js.map +1 -1
  19. package/components/ActionBtn/style.mjs.map +1 -1
  20. package/components/Alert/Alert.js +1 -1
  21. package/components/Alert/Alert.js.map +1 -1
  22. package/components/Alert/Alert.mjs +1 -1
  23. package/components/Alert/Alert.mjs.map +1 -1
  24. package/components/Amount/Amount.js +1 -1
  25. package/components/Amount/Amount.js.map +1 -1
  26. package/components/Amount/Amount.mjs +1 -1
  27. package/components/Amount/Amount.mjs.map +1 -1
  28. package/components/Amount/data/index.js.map +1 -1
  29. package/components/Amount/data/index.mjs.map +1 -1
  30. package/components/Amount/style.js.map +1 -1
  31. package/components/Amount/style.mjs.map +1 -1
  32. package/components/Anchor/Anchor.js +1 -1
  33. package/components/Anchor/Anchor.js.map +1 -1
  34. package/components/Anchor/Anchor.mjs +1 -1
  35. package/components/Anchor/Anchor.mjs.map +1 -1
  36. package/components/Arrow/Arrow.js.map +1 -1
  37. package/components/Arrow/Arrow.mjs.map +1 -1
  38. package/components/ArrowBadge/ArrowBadge.js.map +1 -1
  39. package/components/ArrowBadge/ArrowBadge.mjs.map +1 -1
  40. package/components/AspectRatio/style.js.map +1 -1
  41. package/components/AspectRatio/style.mjs.map +1 -1
  42. package/components/Avatar/Avatar.js +1 -1
  43. package/components/Avatar/Avatar.js.map +1 -1
  44. package/components/Avatar/Avatar.mjs +1 -1
  45. package/components/Avatar/Avatar.mjs.map +1 -1
  46. package/components/Avatar/utils.js.map +1 -1
  47. package/components/Avatar/utils.mjs.map +1 -1
  48. package/components/Badge/Badge.js +1 -1
  49. package/components/Badge/Badge.js.map +1 -1
  50. package/components/Badge/Badge.mjs +1 -1
  51. package/components/Badge/Badge.mjs.map +1 -1
  52. package/components/Button/Button.js +1 -1
  53. package/components/Button/Button.js.map +1 -1
  54. package/components/Button/Button.mjs +1 -1
  55. package/components/Button/Button.mjs.map +1 -1
  56. package/components/Button/hooks.js.map +1 -1
  57. package/components/Button/hooks.mjs.map +1 -1
  58. package/components/Button/style.js.map +1 -1
  59. package/components/Button/style.mjs.map +1 -1
  60. package/components/Checkbox/Checkbox.js +1 -1
  61. package/components/Checkbox/Checkbox.js.map +1 -1
  62. package/components/Checkbox/Checkbox.mjs +1 -1
  63. package/components/Checkbox/Checkbox.mjs.map +1 -1
  64. package/components/Chip/Chip.js +1 -1
  65. package/components/Chip/Chip.js.map +1 -1
  66. package/components/Chip/Chip.mjs +1 -1
  67. package/components/Chip/Chip.mjs.map +1 -1
  68. package/components/Container/Container.js.map +1 -1
  69. package/components/Container/Container.mjs.map +1 -1
  70. package/components/Container/style.js.map +1 -1
  71. package/components/Container/style.mjs.map +1 -1
  72. package/components/ContextMenu/ContextMenu.js +1 -1
  73. package/components/ContextMenu/ContextMenu.js.map +1 -1
  74. package/components/ContextMenu/ContextMenu.mjs +1 -1
  75. package/components/ContextMenu/ContextMenu.mjs.map +1 -1
  76. package/components/ContextMenu/Item.js.map +1 -1
  77. package/components/ContextMenu/Item.mjs.map +1 -1
  78. package/components/ContextMenu/style.js.map +1 -1
  79. package/components/ContextMenu/style.mjs.map +1 -1
  80. package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.js +1 -1
  81. package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.js.map +1 -1
  82. package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.mjs +1 -1
  83. package/components/ContextMenu.Multilevel/ContextMenu.Multilevel.mjs.map +1 -1
  84. package/components/ContextMenu.Multilevel/Controls.js.map +1 -1
  85. package/components/ContextMenu.Multilevel/Controls.mjs.map +1 -1
  86. package/components/Dialog/Dialog.js.map +1 -1
  87. package/components/Dialog/Dialog.mjs.map +1 -1
  88. package/components/DialogComponent/DialogComponent.js +1 -1
  89. package/components/DialogComponent/DialogComponent.js.map +1 -1
  90. package/components/DialogComponent/DialogComponent.mjs +1 -1
  91. package/components/DialogComponent/DialogComponent.mjs.map +1 -1
  92. package/components/DialogComponent/style.js.map +1 -1
  93. package/components/DialogComponent/style.mjs.map +1 -1
  94. package/components/Divider/style.js.map +1 -1
  95. package/components/Divider/style.mjs.map +1 -1
  96. package/components/Dropdown/Dropdown.js +1 -1
  97. package/components/Dropdown/Dropdown.js.map +1 -1
  98. package/components/Dropdown/Dropdown.mjs +1 -1
  99. package/components/Dropdown/Dropdown.mjs.map +1 -1
  100. package/components/Dropdown/DropdownMenuNoOptions.js +1 -1
  101. package/components/Dropdown/DropdownMenuNoOptions.js.map +1 -1
  102. package/components/Dropdown/DropdownMenuNoOptions.mjs +1 -1
  103. package/components/Dropdown/DropdownMenuNoOptions.mjs.map +1 -1
  104. package/components/Dropdown/hooks.js.map +1 -1
  105. package/components/Dropdown/hooks.mjs.map +1 -1
  106. package/components/FormInput/FormInput.js.map +1 -1
  107. package/components/FormInput/FormInput.mjs.map +1 -1
  108. package/components/FormInputLabel/FormInputLabel.js +1 -1
  109. package/components/FormInputLabel/FormInputLabel.js.map +1 -1
  110. package/components/FormInputLabel/FormInputLabel.mjs +1 -1
  111. package/components/FormInputLabel/FormInputLabel.mjs.map +1 -1
  112. package/components/FormLabel/FormLabel.js +1 -1
  113. package/components/FormLabel/FormLabel.js.map +1 -1
  114. package/components/FormLabel/FormLabel.mjs +1 -1
  115. package/components/FormLabel/FormLabel.mjs.map +1 -1
  116. package/components/Icon/Icon.js +1 -1
  117. package/components/Icon/Icon.js.map +1 -1
  118. package/components/Icon/Icon.mjs +1 -1
  119. package/components/Icon/Icon.mjs.map +1 -1
  120. package/components/Icon/bg-worker.js.map +1 -1
  121. package/components/Icon/bg-worker.mjs.map +1 -1
  122. package/components/Icon/list/default.js.map +1 -1
  123. package/components/Icon/list/default.mjs.map +1 -1
  124. package/components/Icon/list/icon-pack.js.map +1 -1
  125. package/components/Icon/list/icon-pack.mjs.map +1 -1
  126. package/components/IconButton/IconButton.js.map +1 -1
  127. package/components/IconButton/IconButton.mjs.map +1 -1
  128. package/components/Indicator/Indicator.js +1 -1
  129. package/components/Indicator/Indicator.js.map +1 -1
  130. package/components/Indicator/Indicator.mjs +1 -1
  131. package/components/Indicator/Indicator.mjs.map +1 -1
  132. package/components/Input/Input.js.map +1 -1
  133. package/components/Input/Input.mjs.map +1 -1
  134. package/components/Input/helpers.js.map +1 -1
  135. package/components/Input/helpers.mjs.map +1 -1
  136. package/components/Input.Phone/Input.Phone.js.map +1 -1
  137. package/components/Input.Phone/Input.Phone.mjs.map +1 -1
  138. package/components/InputCheckbox/InputCheckbox.js.map +1 -1
  139. package/components/InputCheckbox/InputCheckbox.mjs.map +1 -1
  140. package/components/InputRadio/InputRadio.js.map +1 -1
  141. package/components/InputRadio/InputRadio.mjs.map +1 -1
  142. package/components/ListItem/ListItem.js +1 -1
  143. package/components/ListItem/ListItem.js.map +1 -1
  144. package/components/ListItem/ListItem.mjs +1 -1
  145. package/components/ListItem/ListItem.mjs.map +1 -1
  146. package/components/Menu/Menu.js.map +1 -1
  147. package/components/Menu/Menu.mjs.map +1 -1
  148. package/components/MenuComponent/MenuComponent.js.map +1 -1
  149. package/components/MenuComponent/MenuComponent.mjs.map +1 -1
  150. package/components/MenuComponent/style.js +1 -1
  151. package/components/MenuComponent/style.js.map +1 -1
  152. package/components/MenuComponent/style.mjs +1 -1
  153. package/components/MenuComponent/style.mjs.map +1 -1
  154. package/components/MenuContainer/MenuContainer.js +1 -1
  155. package/components/MenuContainer/MenuContainer.js.map +1 -1
  156. package/components/MenuContainer/MenuContainer.mjs +1 -1
  157. package/components/MenuContainer/MenuContainer.mjs.map +1 -1
  158. package/components/MenuDivider/MenuDivider.js +1 -1
  159. package/components/MenuDivider/MenuDivider.js.map +1 -1
  160. package/components/MenuDivider/MenuDivider.mjs +1 -1
  161. package/components/MenuDivider/MenuDivider.mjs.map +1 -1
  162. package/components/MenuList/MenuList.js.map +1 -1
  163. package/components/MenuList/MenuList.mjs.map +1 -1
  164. package/components/Modal/Modal.js.map +1 -1
  165. package/components/Modal/Modal.mjs.map +1 -1
  166. package/components/Modal/adapter.js.map +1 -1
  167. package/components/Modal/adapter.mjs.map +1 -1
  168. package/components/Modal/style.js +1 -1
  169. package/components/Modal/style.js.map +1 -1
  170. package/components/Modal/style.mjs +1 -1
  171. package/components/Modal/style.mjs.map +1 -1
  172. package/components/Notification/Notification.js +1 -1
  173. package/components/Notification/Notification.js.map +1 -1
  174. package/components/Notification/Notification.mjs +1 -1
  175. package/components/Notification/Notification.mjs.map +1 -1
  176. package/components/Paper/Paper.js.map +1 -1
  177. package/components/Paper/Paper.mjs.map +1 -1
  178. package/components/Paper/style.js.map +1 -1
  179. package/components/Paper/style.mjs.map +1 -1
  180. package/components/Popover/Popover.js.map +1 -1
  181. package/components/Popover/Popover.mjs.map +1 -1
  182. package/components/PopoverComponent/PopoverComponent.js +1 -1
  183. package/components/PopoverComponent/PopoverComponent.js.map +1 -1
  184. package/components/PopoverComponent/PopoverComponent.mjs +1 -1
  185. package/components/PopoverComponent/PopoverComponent.mjs.map +1 -1
  186. package/components/Progress/Progress.js.map +1 -1
  187. package/components/Progress/Progress.mjs.map +1 -1
  188. package/components/Progress/style.js +1 -1
  189. package/components/Progress/style.js.map +1 -1
  190. package/components/Progress/style.mjs +1 -1
  191. package/components/Progress/style.mjs.map +1 -1
  192. package/components/Progress.Circle/Progress.Circle.js +1 -1
  193. package/components/Progress.Circle/Progress.Circle.js.map +1 -1
  194. package/components/Progress.Circle/Progress.Circle.mjs +1 -1
  195. package/components/Progress.Circle/Progress.Circle.mjs.map +1 -1
  196. package/components/Progress.Circle/style.js +1 -1
  197. package/components/Progress.Circle/style.js.map +1 -1
  198. package/components/Progress.Circle/style.mjs +1 -1
  199. package/components/Progress.Circle/style.mjs.map +1 -1
  200. package/components/Progress.Segmented/Progress.Segmented.js.map +1 -1
  201. package/components/Progress.Segmented/Progress.Segmented.mjs.map +1 -1
  202. package/components/Progress.Segmented/style.js.map +1 -1
  203. package/components/Progress.Segmented/style.mjs.map +1 -1
  204. package/components/ProgressCircle/ProgressCircle.js +1 -1
  205. package/components/ProgressCircle/ProgressCircle.js.map +1 -1
  206. package/components/ProgressCircle/ProgressCircle.mjs +1 -1
  207. package/components/ProgressCircle/ProgressCircle.mjs.map +1 -1
  208. package/components/ProgressCircle/style.js +1 -1
  209. package/components/ProgressCircle/style.js.map +1 -1
  210. package/components/ProgressCircle/style.mjs +1 -1
  211. package/components/ProgressCircle/style.mjs.map +1 -1
  212. package/components/ProgressLine/ProgressLine.js +1 -1
  213. package/components/ProgressLine/ProgressLine.js.map +1 -1
  214. package/components/ProgressLine/ProgressLine.mjs +1 -1
  215. package/components/ProgressLine/ProgressLine.mjs.map +1 -1
  216. package/components/Radio/Group.js.map +1 -1
  217. package/components/Radio/Group.mjs.map +1 -1
  218. package/components/Radio/Radio.js +1 -1
  219. package/components/Radio/Radio.js.map +1 -1
  220. package/components/Radio/Radio.mjs +1 -1
  221. package/components/Radio/Radio.mjs.map +1 -1
  222. package/components/Radio/style.js.map +1 -1
  223. package/components/Radio/style.mjs.map +1 -1
  224. package/components/Scrollable/Scrollable.js +1 -1
  225. package/components/Scrollable/Scrollable.js.map +1 -1
  226. package/components/Scrollable/Scrollable.mjs +1 -1
  227. package/components/Scrollable/Scrollable.mjs.map +1 -1
  228. package/components/Section/Section.js.map +1 -1
  229. package/components/Section/Section.mjs.map +1 -1
  230. package/components/Section/style.js +1 -1
  231. package/components/Section/style.js.map +1 -1
  232. package/components/Section/style.mjs +1 -1
  233. package/components/Section/style.mjs.map +1 -1
  234. package/components/Select/Select.js.map +1 -1
  235. package/components/Select/Select.mjs.map +1 -1
  236. package/components/Select/style.js +1 -1
  237. package/components/Select/style.js.map +1 -1
  238. package/components/Select/style.mjs +1 -1
  239. package/components/Select/style.mjs.map +1 -1
  240. package/components/Separator/Separator.js.map +1 -1
  241. package/components/Separator/Separator.mjs.map +1 -1
  242. package/components/Separator/SeparatorText.js.map +1 -1
  243. package/components/Separator/SeparatorText.mjs.map +1 -1
  244. package/components/Separator/style.js +1 -1
  245. package/components/Separator/style.js.map +1 -1
  246. package/components/Separator/style.mjs +1 -1
  247. package/components/Separator/style.mjs.map +1 -1
  248. package/components/Spacer/Spacer.js.map +1 -1
  249. package/components/Spacer/Spacer.mjs.map +1 -1
  250. package/components/Spacer/style.js.map +1 -1
  251. package/components/Spacer/style.mjs.map +1 -1
  252. package/components/Spinner/Spinner.js.map +1 -1
  253. package/components/Spinner/Spinner.mjs.map +1 -1
  254. package/components/Spinner/style.js +1 -1
  255. package/components/Spinner/style.js.map +1 -1
  256. package/components/Spinner/style.mjs +1 -1
  257. package/components/Spinner/style.mjs.map +1 -1
  258. package/components/Switch/Switch.js.map +1 -1
  259. package/components/Switch/Switch.mjs.map +1 -1
  260. package/components/Switcher/style.js.map +1 -1
  261. package/components/Switcher/style.mjs.map +1 -1
  262. package/components/Tab/Tab.js +1 -1
  263. package/components/Tab/Tab.js.map +1 -1
  264. package/components/Tab/Tab.mjs +1 -1
  265. package/components/Tab/Tab.mjs.map +1 -1
  266. package/components/TabList/TabList.js +1 -1
  267. package/components/TabList/TabList.js.map +1 -1
  268. package/components/TabList/TabList.mjs +1 -1
  269. package/components/TabList/TabList.mjs.map +1 -1
  270. package/components/TabList/TabListMenuTab.js +1 -1
  271. package/components/TabList/TabListMenuTab.js.map +1 -1
  272. package/components/TabList/TabListMenuTab.mjs +1 -1
  273. package/components/TabList/TabListMenuTab.mjs.map +1 -1
  274. package/components/TabList/TabListPanel.js.map +1 -1
  275. package/components/TabList/TabListPanel.mjs.map +1 -1
  276. package/components/TabList/hooks.js +1 -1
  277. package/components/TabList/hooks.js.map +1 -1
  278. package/components/TabList/hooks.mjs +1 -1
  279. package/components/TabList/hooks.mjs.map +1 -1
  280. package/components/TabList/style.js +1 -1
  281. package/components/TabList/style.js.map +1 -1
  282. package/components/TabList/style.mjs +1 -1
  283. package/components/TabList/style.mjs.map +1 -1
  284. package/components/TabListTab/TabListTab.js.map +1 -1
  285. package/components/TabListTab/TabListTab.mjs.map +1 -1
  286. package/components/TabListTab/style.js +1 -1
  287. package/components/TabListTab/style.js.map +1 -1
  288. package/components/TabListTab/style.mjs +1 -1
  289. package/components/TabListTab/style.mjs.map +1 -1
  290. package/components/Tabs/Tabs.js.map +1 -1
  291. package/components/Tabs/Tabs.mjs.map +1 -1
  292. package/components/Tabs/style.js +1 -1
  293. package/components/Tabs/style.js.map +1 -1
  294. package/components/Tabs/style.mjs +1 -1
  295. package/components/Tabs/style.mjs.map +1 -1
  296. package/components/Tag/Tag.js +1 -1
  297. package/components/Tag/Tag.js.map +1 -1
  298. package/components/Tag/Tag.mjs +1 -1
  299. package/components/Tag/Tag.mjs.map +1 -1
  300. package/components/Tag/style.js +1 -1
  301. package/components/Tag/style.js.map +1 -1
  302. package/components/Tag/style.mjs +1 -1
  303. package/components/Tag/style.mjs.map +1 -1
  304. package/components/Text/Ellipsis.js +1 -1
  305. package/components/Text/Ellipsis.js.map +1 -1
  306. package/components/Text/Ellipsis.mjs +1 -1
  307. package/components/Text/Ellipsis.mjs.map +1 -1
  308. package/components/Text/Text.js.map +1 -1
  309. package/components/Text/Text.mjs.map +1 -1
  310. package/components/Text/style.js.map +1 -1
  311. package/components/Text/style.mjs.map +1 -1
  312. package/components/Text.Ellipse/Text.Ellipse.js +1 -1
  313. package/components/Text.Ellipse/Text.Ellipse.js.map +1 -1
  314. package/components/Text.Ellipse/Text.Ellipse.mjs +1 -1
  315. package/components/Text.Ellipse/Text.Ellipse.mjs.map +1 -1
  316. package/components/Textarea/Textarea.js +1 -1
  317. package/components/Textarea/Textarea.js.map +1 -1
  318. package/components/Textarea/Textarea.mjs +1 -1
  319. package/components/Textarea/Textarea.mjs.map +1 -1
  320. package/components/Tooltip/Tooltip.js.map +1 -1
  321. package/components/Tooltip/Tooltip.mjs.map +1 -1
  322. package/components/Tooltip/TooltipWrapper.js.map +1 -1
  323. package/components/Tooltip/TooltipWrapper.mjs.map +1 -1
  324. package/components/TooltipComponent/TooltipComponent.js +1 -1
  325. package/components/TooltipComponent/TooltipComponent.js.map +1 -1
  326. package/components/TooltipComponent/TooltipComponent.mjs +1 -1
  327. package/components/TooltipComponent/TooltipComponent.mjs.map +1 -1
  328. package/dts/index.d.ts +2630 -2557
  329. package/hocs/withMergedProps.js.map +1 -1
  330. package/hocs/withMergedProps.mjs.map +1 -1
  331. package/hocs/withTranslation.js +1 -1
  332. package/hocs/withTranslation.js.map +1 -1
  333. package/hocs/withTranslation.mjs +1 -1
  334. package/hocs/withTranslation.mjs.map +1 -1
  335. package/hooks/use-config-priority.js.map +1 -1
  336. package/hooks/use-config-priority.mjs +1 -1
  337. package/hooks/use-config-priority.mjs.map +1 -1
  338. package/hooks/useClickOutside.js.map +1 -1
  339. package/hooks/useClickOutside.mjs.map +1 -1
  340. package/hooks/useMergedPalette.js +1 -1
  341. package/hooks/useMergedPalette.js.map +1 -1
  342. package/hooks/useMergedPalette.mjs +1 -1
  343. package/hooks/useMergedPalette.mjs.map +1 -1
  344. package/hooks/useMergedProps.js.map +1 -1
  345. package/hooks/useMergedProps.mjs.map +1 -1
  346. package/hooks/useMergedSizes.js.map +1 -1
  347. package/hooks/useMergedSizes.mjs.map +1 -1
  348. package/hooks/useResizeObserver.js.map +1 -1
  349. package/hooks/useResizeObserver.mjs.map +1 -1
  350. package/hooks/useScrollMonitor.js +1 -1
  351. package/hooks/useScrollMonitor.js.map +1 -1
  352. package/hooks/useScrollMonitor.mjs +1 -1
  353. package/hooks/useScrollMonitor.mjs.map +1 -1
  354. package/hooks/useScrollThresholds.js.map +1 -1
  355. package/hooks/useScrollThresholds.mjs.map +1 -1
  356. package/mixins/color.js.map +1 -1
  357. package/mixins/color.mjs.map +1 -1
  358. package/mixins/create-responsive-props.js.map +1 -1
  359. package/mixins/create-responsive-props.mjs.map +1 -1
  360. package/mixins/display.js.map +1 -1
  361. package/mixins/display.mjs.map +1 -1
  362. package/mixins/responsive-margin.js.map +1 -1
  363. package/mixins/responsive-margin.mjs.map +1 -1
  364. package/mixins/responsive-property.js +1 -1
  365. package/mixins/responsive-property.js.map +1 -1
  366. package/mixins/responsive-property.mjs +1 -1
  367. package/mixins/responsive-property.mjs.map +1 -1
  368. package/mixins/screen.js +1 -1
  369. package/mixins/screen.js.map +1 -1
  370. package/mixins/screen.mjs +1 -1
  371. package/mixins/screen.mjs.map +1 -1
  372. package/mixins/shared.js +4 -4
  373. package/mixins/shared.js.map +1 -1
  374. package/mixins/shared.mjs +4 -4
  375. package/mixins/shared.mjs.map +1 -1
  376. package/mixins/vAlign.js.map +1 -1
  377. package/mixins/vAlign.mjs.map +1 -1
  378. package/package.json +7 -7
  379. package/shared/enums/sizeInput.js.map +1 -1
  380. package/shared/enums/sizeInput.mjs.map +1 -1
  381. package/shared/resize-observer.js.map +1 -1
  382. package/shared/resize-observer.mjs.map +1 -1
  383. package/shared/utils/colors.js.map +1 -1
  384. package/shared/utils/colors.mjs.map +1 -1
  385. package/shared/utils/dom.js.map +1 -1
  386. package/shared/utils/dom.mjs.map +1 -1
  387. package/shared/utils/react.js.map +1 -1
  388. package/shared/utils/react.mjs.map +1 -1
  389. package/shared/utils/rel-builder.js +1 -1
  390. package/shared/utils/rel-builder.js.map +1 -1
  391. package/shared/utils/rel-builder.mjs +1 -1
  392. package/shared/utils/rel-builder.mjs.map +1 -1
  393. package/theme/colors-dark.js.map +1 -1
  394. package/theme/colors-dark.mjs.map +1 -1
  395. package/theme/colors-light.js.map +1 -1
  396. package/theme/colors-light.mjs.map +1 -1
  397. package/theme/colors.js.map +1 -1
  398. package/theme/colors.mjs.map +1 -1
  399. package/theme/global-styled.js.map +1 -1
  400. package/theme/global-styled.mjs.map +1 -1
  401. package/theme/theme-provider.js.map +1 -1
  402. package/theme/theme-provider.mjs.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"display.mjs","sources":["../../../src/mixins/display.ts"],"sourcesContent":["import { css } from 'styled-components'\n\ntype Display = 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'table-cell' | 'inherit' | 'none'\n\nexport interface DisplayProperty {\n display?: Display\n}\n\nexport const display = (display: Display) => () =>\n css`\n display: ${display};\n `\n"],"names":["display","css"],"mappings":"mCAQO,MAAMA,QAAWA,GAAqB,IAC3CC,IACaD,CAAAA,WAAAA,KAAAA"}
1
+ {"version":3,"file":"display.mjs","sources":["../../../src/mixins/display.ts"],"sourcesContent":["import { css } from 'styled-components'\n\ntype Display = 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'table-cell' | 'inherit' | 'none'\n\nexport interface DisplayProperty {\n display?: Display\n}\n\nexport const display = (value: Display) => () => css`\n display: ${value};\n`\n"],"names":["display","value","css"],"mappings":"mCAQO,MAAMA,QAAWC,GAAmB,IAAMC,IACpCD,CAAAA,WAAAA,KAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-margin.js","sources":["../../../src/mixins/responsive-margin.ts"],"sourcesContent":["import { createResponsivePropsMixin } from 'mixins/create-responsive-props'\nimport type { ResponsiveProps } from 'mixins/create-responsive-props'\nimport type { CSSGlobalValue } from 'shared/types'\n\ntype MarginProperty = 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype MarginValue = CSSGlobalValue | (string & {}) | number\n\ntype ResponsiveMarginProps = ResponsiveProps<MarginProperty, MarginValue>\n\n/**\n *\n * Mixin enables responsive margin interface\n */\nconst responsiveMargin = createResponsivePropsMixin<MarginProperty, MarginValue | void, ResponsiveMarginProps>(\n ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n (propKey, propValue) => {\n if (propValue === undefined || propValue === null) return {}\n\n return {\n [propKey]: typeof propValue === 'string' ? propValue : `${propValue}px`,\n }\n }\n)\n\nexport type { ResponsiveMarginProps }\n\nexport { responsiveMargin }\n"],"names":["responsiveMargin","createResponsivePropsMixin","propKey","propValue","undefined"],"mappings":"aAeMA,MAAAA,yDAA6CC,2BACjD,CAAC,SAAU,YAAa,cAAe,eAAgB,eACvD,CAACC,EAASC,IACJA,SAAcC,GAAaD,IAAc,KAAa,CAAA,EAEnD,CACLD,CAACA,UAAiBC,GAAc,SAAWA,EAAY,GAAGA"}
1
+ {"version":3,"file":"responsive-margin.js","sources":["../../../src/mixins/responsive-margin.ts"],"sourcesContent":["import { createResponsivePropsMixin } from 'mixins/create-responsive-props'\nimport type { ResponsiveProps } from 'mixins/create-responsive-props'\nimport type { CSSGlobalValue } from 'shared/types'\n\ntype MarginProperty = 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft'\n\ntype MarginValue = CSSGlobalValue | (string & {}) | number\n\ntype ResponsiveMarginProps = ResponsiveProps<MarginProperty, MarginValue>\n\n/**\n *\n * Mixin enables responsive margin interface\n */\nconst responsiveMargin = createResponsivePropsMixin<MarginProperty, MarginValue | void, ResponsiveMarginProps>(\n ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n (propKey, propValue) => {\n if (propValue === undefined || propValue === null) return {}\n\n return {\n [propKey]: typeof propValue === 'string' ? propValue : `${propValue}px`,\n }\n }\n)\n\nexport type { ResponsiveMarginProps }\n\nexport { responsiveMargin }\n"],"names":["responsiveMargin","createResponsivePropsMixin","propKey","propValue","undefined"],"mappings":"aAcMA,MAAAA,yDAA6CC,2BACjD,CAAC,SAAU,YAAa,cAAe,eAAgB,eACvD,CAACC,EAASC,IACJA,SAAcC,GAAaD,IAAc,KAAa,CAAA,EAEnD,CACLD,CAACA,UAAiBC,GAAc,SAAWA,EAAY,GAAGA"}
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-margin.mjs","sources":["../../../src/mixins/responsive-margin.ts"],"sourcesContent":["import { createResponsivePropsMixin } from 'mixins/create-responsive-props'\nimport type { ResponsiveProps } from 'mixins/create-responsive-props'\nimport type { CSSGlobalValue } from 'shared/types'\n\ntype MarginProperty = 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft'\n\n// eslint-disable-next-line @typescript-eslint/ban-types\ntype MarginValue = CSSGlobalValue | (string & {}) | number\n\ntype ResponsiveMarginProps = ResponsiveProps<MarginProperty, MarginValue>\n\n/**\n *\n * Mixin enables responsive margin interface\n */\nconst responsiveMargin = createResponsivePropsMixin<MarginProperty, MarginValue | void, ResponsiveMarginProps>(\n ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n (propKey, propValue) => {\n if (propValue === undefined || propValue === null) return {}\n\n return {\n [propKey]: typeof propValue === 'string' ? propValue : `${propValue}px`,\n }\n }\n)\n\nexport type { ResponsiveMarginProps }\n\nexport { responsiveMargin }\n"],"names":["responsiveMargin","createResponsivePropsMixin","propKey","propValue","undefined"],"mappings":"sEAeMA,MAAAA,iBAAmBC,2BACvB,CAAC,SAAU,YAAa,cAAe,eAAgB,eACvD,CAACC,EAASC,IACJA,SAAcC,GAAaD,IAAc,KAAa,CAAA,EAEnD,CACLD,CAACA,UAAiBC,GAAc,SAAWA,EAAY,GAAGA"}
1
+ {"version":3,"file":"responsive-margin.mjs","sources":["../../../src/mixins/responsive-margin.ts"],"sourcesContent":["import { createResponsivePropsMixin } from 'mixins/create-responsive-props'\nimport type { ResponsiveProps } from 'mixins/create-responsive-props'\nimport type { CSSGlobalValue } from 'shared/types'\n\ntype MarginProperty = 'margin' | 'marginTop' | 'marginRight' | 'marginBottom' | 'marginLeft'\n\ntype MarginValue = CSSGlobalValue | (string & {}) | number\n\ntype ResponsiveMarginProps = ResponsiveProps<MarginProperty, MarginValue>\n\n/**\n *\n * Mixin enables responsive margin interface\n */\nconst responsiveMargin = createResponsivePropsMixin<MarginProperty, MarginValue | void, ResponsiveMarginProps>(\n ['margin', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft'],\n (propKey, propValue) => {\n if (propValue === undefined || propValue === null) return {}\n\n return {\n [propKey]: typeof propValue === 'string' ? propValue : `${propValue}px`,\n }\n }\n)\n\nexport type { ResponsiveMarginProps }\n\nexport { responsiveMargin }\n"],"names":["responsiveMargin","createResponsivePropsMixin","propKey","propValue","undefined"],"mappings":"sEAcMA,MAAAA,iBAAmBC,2BACvB,CAAC,SAAU,YAAa,cAAe,eAAgB,eACvD,CAACC,EAASC,IACJA,SAAcC,GAAaD,IAAc,KAAa,CAAA,EAEnD,CACLD,CAACA,UAAiBC,GAAc,SAAWA,EAAY,GAAGA"}
@@ -1,4 +1,4 @@
1
- 'use strict';var styled=require('styled-components');var screen=require('./screen.js');var shared=require('./shared.js');const SCREEN_SIZE_MAP={XXS:screen.screenMaxXxs,XS:screen.screenMaxXs,S:screen.screenMaxS,M:screen.screenMaxM,L:screen.screenMaxL,XL:screen.screenMinL};const SCREEN_SIZE_MAP_BY_DEVICE_ALIAS={desktop:screen.screenMinM,tablet:screen.screenMaxM,mobile:screen.screenMaxS};exports.property=(e,r="size",s="px",t)=>()=>()=>{if(typeof e=='boolean')return typeof r=='function'?r(1):null;const n=t??shared.getLatinSizeMapByCssProperty(r);return typeof r=='function'?r(typeof e=='number'?e:n[e]):typeof e=='string'&&['auto','initial','inherit'].includes(e)?styled.css(["",":",";"],r,e):styled.css(["",":","",";"],r,typeof e=='string'&&n[e]?n[e]:e,s??'')},exports.responsiveNamedProperty=({sizes:e,predefinedSizes:r,cssProperty:s="size",sizing:t="px",customSizeHandler:n,sort:o=shared.desktopFirst})=>()=>()=>Object.keys(e).sort(o).map((o=>{if(e[o]!==void 0){const i=typeof n=='function'?n(e[o]):e[o];return shared.buildMediaQuery(i,s,shared.getMediaQueryByResponsiveProp(o),t,r)}return null})).filter(Boolean).map((e=>styled.css(["",""],e))),exports.responsiveProperty=(e,r=null,s="px")=>()=>t=>{const n=t[e]??null;const o=r??e;if(!n)return null;if(Array.isArray(n)&&n.length===3){const[e,r,t]=n;return styled.css([""," "," ",""],SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`
1
+ 'use strict';var styled=require('styled-components');var screen=require('./screen.js');var shared=require('./shared.js');const SCREEN_SIZE_MAP={XXS:screen.screenMaxXxs,XS:screen.screenMaxXs,S:screen.screenMaxS,M:screen.screenMaxM,L:screen.screenMaxL,XL:screen.screenMinL};const SCREEN_SIZE_MAP_BY_DEVICE_ALIAS={desktop:screen.screenMinM,tablet:screen.screenMaxM,mobile:screen.screenMaxS};exports.property=(e,r="size",s="px",t)=>()=>()=>{if(typeof e=='boolean')return typeof r=='function'?r(1):null;const n=t??shared.getLatinSizeMapByCssProperty(r);return typeof r=='function'?r(typeof e=='number'?e:n[e]):typeof e=='string'&&['auto','initial','inherit'].includes(e)?styled.css(["",":",";"],r,e):styled.css(["",":","",";"],r,typeof e=='string'&&n[e]?n[e]:e,s??'')},exports.responsiveNamedProperty=({sizes:e,predefinedSizes:r,cssProperty:s="size",sizing:t="px",customSizeHandler:n,sort:o=shared.desktopFirst})=>()=>()=>Object.keys(e).sort(o).map((o=>{const i=e[o];if(i!==void 0){const e=typeof n=='function'?n(i):i;return shared.buildMediaQuery(e,s,shared.getMediaQueryByResponsiveProp(o),t,r)}return null})).filter(Boolean).map((e=>styled.css(["",""],e))),exports.responsiveProperty=(e,r=null,s="px")=>()=>t=>{const n=t[e]??null;const o=r??e;if(!n)return null;if(Array.isArray(n)&&n.length===3){const[e,r,t]=n;return styled.css([""," "," ",""],SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`
2
2
  ${o}: ${typeof e=='number'?`${e}${s??''}`:e};
3
3
  `,SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`
4
4
  ${o}: ${typeof r=='number'?`${r}${s??''}`:r};
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-property.js","sources":["../../../src/mixins/responsive-property.ts"],"sourcesContent":["import { css, FlattenSimpleInterpolation } from 'styled-components'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs, screenMinM } from 'mixins/screen'\nimport {\n buildMediaQuery,\n getLatinSizeMapByCssProperty,\n desktopFirst,\n getMediaQueryByResponsiveProp,\n} from 'mixins/shared'\nimport type { Size } from 'shared/types'\n\n/**\n * Value for breakpoint\n */\nexport type PossibleValues = number | Size | 'auto' | 'initial' | 'inherit' | boolean\n\ntype PropsProperties =\n | 'size'\n | 'fontSize'\n | 'height'\n | 'width'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'padding'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'margin'\n | 'marginTop'\n | 'marginRight'\n | 'marginBottom'\n | 'marginLeft'\n | 'fluid'\n\nexport type CalcProperty = (\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n) => FlattenSimpleInterpolation | null\ntype CssProperty = string | CalcProperty\ntype ResponsiveKeys = '' | 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL'\n\nexport type ResponsiveNamedProperty<T extends PropsProperties, V extends PossibleValues = PossibleValues> = {\n /**\n * Size for breakpoint\n */\n [key in `${T}${ResponsiveKeys}`]?: V // eslint-disable-line no-unused-vars\n}\n\nexport type ResponsiveProperty<V = number | Size> =\n | V\n | [desktop: V, tablet: V, mobile: V]\n | [xl: V, l: V, m: V, s: V, xs: V, xxs: V]\n\nexport const property =\n (\n value: PossibleValues,\n cssProperty: CssProperty = 'size',\n sizing: null | string = 'px',\n sizes?: Record<Size, number>\n ) =>\n () =>\n () => {\n if (typeof value === 'boolean') {\n return typeof cssProperty === 'function' ? cssProperty(1) : null\n }\n\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(cssProperty)\n\n if (typeof cssProperty === 'function') {\n return cssProperty(typeof value === 'number' ? value : sizeMap[value])\n }\n\n if (typeof value === 'string' && ['auto', 'initial', 'inherit'].includes(value))\n return css`\n ${cssProperty}: ${value};\n `\n\n return css`\n ${cssProperty}: ${typeof value === 'string' && sizeMap[value] ? sizeMap[value] : value}${sizing ?? ''};\n `\n }\n\nconst SCREEN_SIZE_MAP: Record<Exclude<ResponsiveKeys, ''>, typeof screenMaxXs> = {\n XXS: screenMaxXxs,\n XS: screenMaxXs,\n S: screenMaxS,\n M: screenMaxM,\n L: screenMaxL,\n XL: screenMinL,\n}\n\nconst SCREEN_SIZE_MAP_BY_DEVICE_ALIAS: Record<'desktop' | 'tablet' | 'mobile', typeof screenMaxXs> = {\n desktop: screenMinM,\n tablet: screenMaxM,\n mobile: screenMaxS,\n}\n\ninterface ResponsiveNamedPropertyPayload<T extends PropsProperties> {\n sizes: ResponsiveNamedProperty<T>\n cssProperty: CssProperty\n sizing?: null | string\n customSizeHandler?: (_value: PossibleValues) => PossibleValues\n sort?: (_a: string, _b: string) => number\n predefinedSizes?: Record<Size, number>\n}\n\n/**\n * Миксин для генерации media запросов\n *\n * @param obj.sizes Объект, в качестве ключей брэйкпоинт, в качестве значений - величина\n * @param obj.cssProperty CSS свойство, может быть функцией, возвращающей css`` из styled-components\n * @param obj.sizing значение величины, по умолчанию `px`\n * @param obj.customSizeHandler функция для вычисления кастомных значений величин\n * @returns строки медиазапросов\n */\nexport const responsiveNamedProperty =\n <T extends PropsProperties>({\n sizes,\n predefinedSizes,\n cssProperty = 'size',\n sizing = 'px',\n customSizeHandler,\n sort = desktopFirst,\n }: ResponsiveNamedPropertyPayload<T>) =>\n () =>\n () => {\n const mediaCssStrArr = Object.keys(sizes)\n .sort(sort)\n .map((size) => {\n if (sizes[size] !== undefined) {\n const _size: PossibleValues =\n typeof customSizeHandler === 'function' ? customSizeHandler(sizes[size]) : sizes[size]\n\n return buildMediaQuery(_size, cssProperty, getMediaQueryByResponsiveProp(size), sizing, predefinedSizes)\n }\n return null\n })\n .filter(Boolean)\n .map(\n (item) =>\n css`\n ${item}\n `\n )\n\n return mediaCssStrArr\n }\n\n/**\n * Миксин для генерации media запросов\n *\n * @param propName имя пропсы\n * @param cssProperty имя css свойства\n * @param sizing значение величины, по умолчанию `px`\n * @returns строки медиазапросов\n */\nexport const responsiveProperty =\n (propName: string, cssProperty: string | null = null, sizing: null | string = 'px') =>\n () =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (props: any) => {\n const prop: ResponsiveProperty | null = props[propName] ?? null\n const _cssProperty = cssProperty ?? propName\n if (!prop) return null\n\n if (Array.isArray(prop) && prop.length === 3) {\n const [desktop, tablet, mobile] = prop\n return css`\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`\n ${_cssProperty}: ${typeof desktop === 'number' ? `${desktop}${sizing ?? ''}` : desktop};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`\n ${_cssProperty}: ${typeof tablet === 'number' ? `${tablet}${sizing ?? ''}` : tablet};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.mobile()`\n ${_cssProperty}: ${typeof mobile === 'number' ? `${mobile}${sizing ?? ''}` : mobile};\n `}\n `\n }\n\n if (Array.isArray(prop) && prop.length === 6 && typeof _cssProperty === 'string') {\n const [xl, l, m, s, xs, xxs] = prop\n return css`\n ${SCREEN_SIZE_MAP.XL()`\n ${_cssProperty}: ${typeof xl === 'number' ? `${xl}${sizing ?? ''}` : xl};\n `}\n ${SCREEN_SIZE_MAP.L()`\n ${_cssProperty}: ${typeof l === 'number' ? `${l}${sizing ?? ''}` : l};\n `}\n ${SCREEN_SIZE_MAP.M()`\n ${_cssProperty}: ${typeof m === 'number' ? `${m}${sizing ?? ''}` : m};\n `}\n ${SCREEN_SIZE_MAP.S()`\n ${_cssProperty}: ${typeof s === 'number' ? `${s}${sizing ?? ''}` : s};\n `}\n ${SCREEN_SIZE_MAP.XS()`\n ${_cssProperty}: ${typeof xs === 'number' ? `${xs}${sizing ?? ''}` : xs};\n `}\n ${SCREEN_SIZE_MAP.XXS()`\n ${_cssProperty}: ${typeof xxs === 'number' ? `${xxs}${sizing ?? ''}` : xxs};\n `}\n `\n }\n\n if (typeof prop === 'number') {\n return css`\n ${_cssProperty}: ${prop}${sizing ?? null};\n `\n }\n\n if (typeof prop === 'string') {\n return css`\n ${_cssProperty}: ${prop};\n `\n }\n\n return null\n }\n"],"names":["SCREEN_SIZE_MAP","XXS","screenMaxXxs","XS","screenMaxXs","S","screenMaxS","M","screenMaxM","L","screenMaxL","XL","screenMinL","SCREEN_SIZE_MAP_BY_DEVICE_ALIAS","desktop","screenMinM","tablet","mobile","property","value","cssProperty","sizing","sizes","sizeMap","getLatinSizeMapByCssProperty","includes","css","responsiveNamedProperty","predefinedSizes","customSizeHandler","sort","desktopFirst","Object","keys","map","size","undefined","_size","buildMediaQuery","getMediaQueryByResponsiveProp","filter","Boolean","item","responsiveProperty","propName","props","prop","_cssProperty","Array","isArray","length","xl","l","m","s","xs","xxs"],"mappings":"yHAoFA,MAAMA,gBAA2E,CAC/EC,IAAKC,OAAYA,aACjBC,GAAIC,OAAWA,YACfC,EAAGC,OAAUA,WACbC,EAAGC,OAAUA,WACbC,EAAGC,OAAUA,WACbC,GAAIC,OAAAA,YAGN,MAAMC,gCAA+F,CACnGC,QAASC,OAAUA,WACnBC,OAAQR,OAAUA,WAClBS,OAAQX,OAAAA,6BAxCRY,CACEC,EACAC,EAA2B,OAC3BC,EAAwB,KACxB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AAOL;UAE7EH,gCAAgCI,QAAQ;YACtC8B,aAAwB9B,GAAW,SAAW,GAAGA,IAASI,GAAU,KAAOJ;UAGnF,CAEA,GAAI+B,MAAMC,QAAQH,IAASA,EAAKI,SAAW,UAAYH,GAAiB,SAAU,CAChF,MAAOI,EAAIC,EAAGC,EAAGC,EAAGC,EAAIC,GAAOV,EAC/B,OAAOpB,WACH1B,CAAAA,GAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,IAAAA,gBAAgBW,IAAI;cAChBoC,aAAwBI,GAAO,SAAW,GAAGA,IAAK9B,GAAU,KAAO8B;YAEvEnD,gBAAgBS,GAAG;cACfsC,aAAwBK,GAAM,SAAW,GAAGA,IAAI/B,GAAU,KAAO+B;YAEnEpD,gBAAgBO,GAAG;cACjBwC,aAAwBM,GAAM,SAAW,GAAGA,IAAIhC,GAAU,KAAOgC;YAEnErD,gBAAgBK,GAAG;cACjB0C,aAAwBO,GAAM,SAAW,GAAGA,IAAIjC,GAAU,KAAOiC;YAEnEtD,gBAAgBG,IAAI;cAClB4C,aAAwBQ,GAAO,SAAW,GAAGA,IAAKlC,GAAU,KAAOkC;YAErEvD,gBAAgBC,KAAK;cACnB8C,aAAwBS,GAAQ,SAAW,GAAGA,IAAMnC,GAAU,KAAOmC;YAG/E,CAEA,cAAWV,GAAS,SACXpB,2BACHqB,EAAiBD,EAAOzB,GAAU,aAI7ByB,GAAS,SACXpB,OAAAA,IAAG,CAAA,GAAA,IAAA,KACNqB,EAAiBD,GAIhB,IAAI"}
1
+ {"version":3,"file":"responsive-property.js","sources":["../../../src/mixins/responsive-property.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { FlattenSimpleInterpolation } from 'styled-components'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs, screenMinM } from 'mixins/screen'\nimport {\n buildMediaQuery,\n getLatinSizeMapByCssProperty,\n desktopFirst,\n getMediaQueryByResponsiveProp,\n} from 'mixins/shared'\nimport type { Size } from 'shared/types'\n\n/**\n * Value for breakpoint\n */\nexport type PossibleValues = number | Size | 'auto' | 'initial' | 'inherit' | boolean\n\ntype PropsProperties =\n | 'size'\n | 'fontSize'\n | 'height'\n | 'width'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'padding'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'margin'\n | 'marginTop'\n | 'marginRight'\n | 'marginBottom'\n | 'marginLeft'\n | 'fluid'\n\nexport type CalcProperty = (\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n) => FlattenSimpleInterpolation | null\ntype CssProperty = string | CalcProperty\ntype ResponsiveKeys = '' | 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL'\n\nexport type ResponsiveNamedProperty<T extends PropsProperties, V extends PossibleValues = PossibleValues> = Partial<\n Record<`${T}${ResponsiveKeys}`, V>\n>\n\nexport type ResponsiveProperty<V = number | Size> =\n | V\n | [desktop: V, tablet: V, mobile: V]\n | [xl: V, l: V, m: V, s: V, xs: V, xxs: V]\n\nexport const property =\n (\n value: PossibleValues,\n cssProperty: CssProperty = 'size',\n sizing: null | string = 'px',\n sizes?: Record<Size, number>\n ) =>\n () =>\n () => {\n if (typeof value === 'boolean') {\n return typeof cssProperty === 'function' ? cssProperty(1) : null\n }\n\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(cssProperty)\n\n if (typeof cssProperty === 'function') {\n return cssProperty(typeof value === 'number' ? value : sizeMap[value as keyof typeof sizeMap])\n }\n\n if (typeof value === 'string' && ['auto', 'initial', 'inherit'].includes(value))\n return css`\n ${cssProperty}: ${value};\n `\n\n return css`\n ${cssProperty}: ${typeof value === 'string' && sizeMap[value as keyof typeof sizeMap]\n ? sizeMap[value as keyof typeof sizeMap]\n : value}${sizing ?? ''};\n `\n }\n\nconst SCREEN_SIZE_MAP: Record<Exclude<ResponsiveKeys, ''>, typeof screenMaxXs> = {\n XXS: screenMaxXxs,\n XS: screenMaxXs,\n S: screenMaxS,\n M: screenMaxM,\n L: screenMaxL,\n XL: screenMinL,\n}\n\nconst SCREEN_SIZE_MAP_BY_DEVICE_ALIAS: Record<'desktop' | 'tablet' | 'mobile', typeof screenMaxXs> = {\n desktop: screenMinM,\n tablet: screenMaxM,\n mobile: screenMaxS,\n}\n\ninterface ResponsiveNamedPropertyPayload<T extends PropsProperties> {\n sizes: ResponsiveNamedProperty<T>\n cssProperty: CssProperty\n sizing?: null | string\n customSizeHandler?: (_value: PossibleValues) => PossibleValues\n sort?: (_a: string, _b: string) => number\n predefinedSizes?: Record<Size, number>\n}\n\n/**\n * Миксин для генерации media запросов\n *\n * @param obj.sizes Объект, в качестве ключей брэйкпоинт, в качестве значений - величина\n * @param obj.cssProperty CSS свойство, может быть функцией, возвращающей css`` из styled-components\n * @param obj.sizing значение величины, по умолчанию `px`\n * @param obj.customSizeHandler функция для вычисления кастомных значений величин\n * @returns строки медиазапросов\n */\nexport const responsiveNamedProperty =\n <T extends PropsProperties>({\n sizes,\n predefinedSizes,\n cssProperty = 'size',\n sizing = 'px',\n customSizeHandler,\n sort = desktopFirst,\n }: ResponsiveNamedPropertyPayload<T>) =>\n () =>\n () => {\n const mediaCssStrArr = Object.keys(sizes)\n .sort(sort)\n .map((size) => {\n const value = sizes[size as keyof Required<typeof sizes>]\n\n if (value !== undefined) {\n const _size: PossibleValues = typeof customSizeHandler === 'function' ? customSizeHandler(value) : value\n\n return buildMediaQuery(_size, cssProperty, getMediaQueryByResponsiveProp(size), sizing, predefinedSizes)\n }\n return null\n })\n .filter(Boolean)\n .map(\n (item) => css`\n ${item}\n `\n )\n\n return mediaCssStrArr\n }\n\n/**\n * Миксин для генерации media запросов\n *\n * @param propName имя пропсы\n * @param cssProperty имя css свойства\n * @param sizing значение величины, по умолчанию `px`\n * @returns строки медиазапросов\n */\nexport const responsiveProperty =\n (propName: string, cssProperty: string | null = null, sizing: null | string = 'px') =>\n () =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (props: any) => {\n const prop: ResponsiveProperty | null = props[propName] ?? null\n const _cssProperty = cssProperty ?? propName\n if (!prop) return null\n\n if (Array.isArray(prop) && prop.length === 3) {\n const [desktop, tablet, mobile] = prop\n return css`\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`\n ${_cssProperty}: ${typeof desktop === 'number' ? `${desktop}${sizing ?? ''}` : desktop};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`\n ${_cssProperty}: ${typeof tablet === 'number' ? `${tablet}${sizing ?? ''}` : tablet};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.mobile()`\n ${_cssProperty}: ${typeof mobile === 'number' ? `${mobile}${sizing ?? ''}` : mobile};\n `}\n `\n }\n\n if (Array.isArray(prop) && prop.length === 6 && typeof _cssProperty === 'string') {\n const [xl, l, m, s, xs, xxs] = prop\n return css`\n ${SCREEN_SIZE_MAP.XL()`\n ${_cssProperty}: ${typeof xl === 'number' ? `${xl}${sizing ?? ''}` : xl};\n `}\n ${SCREEN_SIZE_MAP.L()`\n ${_cssProperty}: ${typeof l === 'number' ? `${l}${sizing ?? ''}` : l};\n `}\n ${SCREEN_SIZE_MAP.M()`\n ${_cssProperty}: ${typeof m === 'number' ? `${m}${sizing ?? ''}` : m};\n `}\n ${SCREEN_SIZE_MAP.S()`\n ${_cssProperty}: ${typeof s === 'number' ? `${s}${sizing ?? ''}` : s};\n `}\n ${SCREEN_SIZE_MAP.XS()`\n ${_cssProperty}: ${typeof xs === 'number' ? `${xs}${sizing ?? ''}` : xs};\n `}\n ${SCREEN_SIZE_MAP.XXS()`\n ${_cssProperty}: ${typeof xxs === 'number' ? `${xxs}${sizing ?? ''}` : xxs};\n `}\n `\n }\n\n if (typeof prop === 'number') {\n return css`\n ${_cssProperty}: ${prop}${sizing ?? null};\n `\n }\n\n if (typeof prop === 'string') {\n return css`\n ${_cssProperty}: ${prop};\n `\n }\n\n return null\n }\n"],"names":["SCREEN_SIZE_MAP","XXS","screenMaxXxs","XS","screenMaxXs","S","screenMaxS","M","screenMaxM","L","screenMaxL","XL","screenMinL","SCREEN_SIZE_MAP_BY_DEVICE_ALIAS","desktop","screenMinM","tablet","mobile","property","value","cssProperty","sizing","sizes","sizeMap","getLatinSizeMapByCssProperty","includes","css","responsiveNamedProperty","predefinedSizes","customSizeHandler","sort","desktopFirst","Object","keys","map","size","undefined","_size","buildMediaQuery","getMediaQueryByResponsiveProp","filter","Boolean","item","responsiveProperty","propName","props","prop","_cssProperty","Array","isArray","length","xl","l","m","s","xs","xxs"],"mappings":"yHAoFA,MAAMA,gBAA2E,CAC/EC,IAAKC,OAAYA,aACjBC,GAAIC,OAAWA,YACfC,EAAGC,OAAUA,WACbC,EAAGC,OAAUA,WACbC,EAAGC,OAAUA,WACbC,GAAIC,OAAAA,YAGN,MAAMC,gCAA+F,CACnGC,QAASC,OAAUA,WACnBC,OAAQR,OAAUA,WAClBS,OAAQX,OAAAA,6BA1CRY,CACEC,EACAC,EAA2B,OAC3BC,EAAwB,KACxBC,IAEF,IACA,KACE,UAAWH,GAAU,UACnB,cAAcC,GAAgB,WAAaA,EAAY,GAAK,KAG9D,MAAMG,EAAUD,GAASE,OAA4BA,6BAACJ,GAEtD,cAAWA,GAAgB,WAClBA,SAAmBD,GAAU,SAAWA,EAAQI,EAAQJ,WAGtDA,GAAU,UAAY,CAAC,OAAQ,UAAW,WAAWM,SAASN,GAChEO,OAAAA,IAAG,CAAA,GAAA,IAAA,KACNN,EAAgBD,GAGfO,OAAGA,oBACNN,SAAuBD,GAAU,UAAYI,EAAQJ,GACnDI,EAAQJ,GACRA,EAAQE,GAAU,GAAE,kCAsC5BM,EACEL,QACAM,kBACAR,cAAc,OACdC,SAAS,KACTQ,oBACAC,OAAOC,OAAAA,gBAET,IACA,IACyBC,OAAOC,KAAKX,GAChCQ,KAAKA,GACLI,KAAKC,IACJ,MAAMhB,EAAQG,EAAMa,GAEpB,GAAIh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AEnErD,gBAAgBK,GAAG;cACjB0C,aAAwBO,GAAM,SAAW,GAAGA,IAAIjC,GAAU,KAAOiC;YAEnEtD,gBAAgBG,IAAI;cAClB4C,aAAwBQ,GAAO,SAAW,GAAGA,IAAKlC,GAAU,KAAOkC;YAErEvD,gBAAgBC,KAAK;cACnB8C,aAAwBS,GAAQ,SAAW,GAAGA,IAAMnC,GAAU,KAAOmC;YAG/E,CAEA,cAAWV,GAAS,SACXpB,2BACHqB,EAAiBD,EAAOzB,GAAU,aAI7ByB,GAAS,SACXpB,OAAAA,IAAG,CAAA,GAAA,IAAA,KACNqB,EAAiBD,GAIhB,IAAI"}
@@ -1,4 +1,4 @@
1
- import{css}from'styled-components';import{screenMaxXxs,screenMaxXs,screenMaxS,screenMaxM,screenMaxL,screenMinL,screenMinM}from'./screen.mjs';import{buildMediaQuery,getMediaQueryByResponsiveProp,desktopFirst,getLatinSizeMapByCssProperty}from'./shared.mjs';const property=(e,r="size",s="px",n)=>()=>()=>{if(typeof e=='boolean')return typeof r=='function'?r(1):null;const t=n??getLatinSizeMapByCssProperty(r);return typeof r=='function'?r(typeof e=='number'?e:t[e]):typeof e=='string'&&['auto','initial','inherit'].includes(e)?css(["",":",";"],r,e):css(["",":","",";"],r,typeof e=='string'&&t[e]?t[e]:e,s??'')};const SCREEN_SIZE_MAP={XXS:screenMaxXxs,XS:screenMaxXs,S:screenMaxS,M:screenMaxM,L:screenMaxL,XL:screenMinL};const SCREEN_SIZE_MAP_BY_DEVICE_ALIAS={desktop:screenMinM,tablet:screenMaxM,mobile:screenMaxS};const responsiveNamedProperty=({sizes:e,predefinedSizes:r,cssProperty:s="size",sizing:n="px",customSizeHandler:t,sort:o=desktopFirst})=>()=>()=>Object.keys(e).sort(o).map((o=>{if(e[o]!==void 0){const i=typeof t=='function'?t(e[o]):e[o];return buildMediaQuery(i,s,getMediaQueryByResponsiveProp(o),n,r)}return null})).filter(Boolean).map((e=>css(["",""],e)));const responsiveProperty=(e,r=null,s="px")=>()=>n=>{const t=n[e]??null;const o=r??e;if(!t)return null;if(Array.isArray(t)&&t.length===3){const[e,r,n]=t;return css([""," "," ",""],SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`
1
+ import{css}from'styled-components';import{screenMaxXxs,screenMaxXs,screenMaxS,screenMaxM,screenMaxL,screenMinL,screenMinM}from'./screen.mjs';import{buildMediaQuery,getMediaQueryByResponsiveProp,desktopFirst,getLatinSizeMapByCssProperty}from'./shared.mjs';const property=(e,r="size",s="px",n)=>()=>()=>{if(typeof e=='boolean')return typeof r=='function'?r(1):null;const t=n??getLatinSizeMapByCssProperty(r);return typeof r=='function'?r(typeof e=='number'?e:t[e]):typeof e=='string'&&['auto','initial','inherit'].includes(e)?css(["",":",";"],r,e):css(["",":","",";"],r,typeof e=='string'&&t[e]?t[e]:e,s??'')};const SCREEN_SIZE_MAP={XXS:screenMaxXxs,XS:screenMaxXs,S:screenMaxS,M:screenMaxM,L:screenMaxL,XL:screenMinL};const SCREEN_SIZE_MAP_BY_DEVICE_ALIAS={desktop:screenMinM,tablet:screenMaxM,mobile:screenMaxS};const responsiveNamedProperty=({sizes:e,predefinedSizes:r,cssProperty:s="size",sizing:n="px",customSizeHandler:t,sort:o=desktopFirst})=>()=>()=>Object.keys(e).sort(o).map((o=>{const i=e[o];if(i!==void 0){const e=typeof t=='function'?t(i):i;return buildMediaQuery(e,s,getMediaQueryByResponsiveProp(o),n,r)}return null})).filter(Boolean).map((e=>css(["",""],e)));const responsiveProperty=(e,r=null,s="px")=>()=>n=>{const t=n[e]??null;const o=r??e;if(!t)return null;if(Array.isArray(t)&&t.length===3){const[e,r,n]=t;return css([""," "," ",""],SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`
2
2
  ${o}: ${typeof e=='number'?`${e}${s??''}`:e};
3
3
  `,SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`
4
4
  ${o}: ${typeof r=='number'?`${r}${s??''}`:r};
@@ -1 +1 @@
1
- {"version":3,"file":"responsive-property.mjs","sources":["../../../src/mixins/responsive-property.ts"],"sourcesContent":["import { css, FlattenSimpleInterpolation } from 'styled-components'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs, screenMinM } from 'mixins/screen'\nimport {\n buildMediaQuery,\n getLatinSizeMapByCssProperty,\n desktopFirst,\n getMediaQueryByResponsiveProp,\n} from 'mixins/shared'\nimport type { Size } from 'shared/types'\n\n/**\n * Value for breakpoint\n */\nexport type PossibleValues = number | Size | 'auto' | 'initial' | 'inherit' | boolean\n\ntype PropsProperties =\n | 'size'\n | 'fontSize'\n | 'height'\n | 'width'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'padding'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'margin'\n | 'marginTop'\n | 'marginRight'\n | 'marginBottom'\n | 'marginLeft'\n | 'fluid'\n\nexport type CalcProperty = (\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n) => FlattenSimpleInterpolation | null\ntype CssProperty = string | CalcProperty\ntype ResponsiveKeys = '' | 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL'\n\nexport type ResponsiveNamedProperty<T extends PropsProperties, V extends PossibleValues = PossibleValues> = {\n /**\n * Size for breakpoint\n */\n [key in `${T}${ResponsiveKeys}`]?: V // eslint-disable-line no-unused-vars\n}\n\nexport type ResponsiveProperty<V = number | Size> =\n | V\n | [desktop: V, tablet: V, mobile: V]\n | [xl: V, l: V, m: V, s: V, xs: V, xxs: V]\n\nexport const property =\n (\n value: PossibleValues,\n cssProperty: CssProperty = 'size',\n sizing: null | string = 'px',\n sizes?: Record<Size, number>\n ) =>\n () =>\n () => {\n if (typeof value === 'boolean') {\n return typeof cssProperty === 'function' ? cssProperty(1) : null\n }\n\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(cssProperty)\n\n if (typeof cssProperty === 'function') {\n return cssProperty(typeof value === 'number' ? value : sizeMap[value])\n }\n\n if (typeof value === 'string' && ['auto', 'initial', 'inherit'].includes(value))\n return css`\n ${cssProperty}: ${value};\n `\n\n return css`\n ${cssProperty}: ${typeof value === 'string' && sizeMap[value] ? sizeMap[value] : value}${sizing ?? ''};\n `\n }\n\nconst SCREEN_SIZE_MAP: Record<Exclude<ResponsiveKeys, ''>, typeof screenMaxXs> = {\n XXS: screenMaxXxs,\n XS: screenMaxXs,\n S: screenMaxS,\n M: screenMaxM,\n L: screenMaxL,\n XL: screenMinL,\n}\n\nconst SCREEN_SIZE_MAP_BY_DEVICE_ALIAS: Record<'desktop' | 'tablet' | 'mobile', typeof screenMaxXs> = {\n desktop: screenMinM,\n tablet: screenMaxM,\n mobile: screenMaxS,\n}\n\ninterface ResponsiveNamedPropertyPayload<T extends PropsProperties> {\n sizes: ResponsiveNamedProperty<T>\n cssProperty: CssProperty\n sizing?: null | string\n customSizeHandler?: (_value: PossibleValues) => PossibleValues\n sort?: (_a: string, _b: string) => number\n predefinedSizes?: Record<Size, number>\n}\n\n/**\n * Миксин для генерации media запросов\n *\n * @param obj.sizes Объект, в качестве ключей брэйкпоинт, в качестве значений - величина\n * @param obj.cssProperty CSS свойство, может быть функцией, возвращающей css`` из styled-components\n * @param obj.sizing значение величины, по умолчанию `px`\n * @param obj.customSizeHandler функция для вычисления кастомных значений величин\n * @returns строки медиазапросов\n */\nexport const responsiveNamedProperty =\n <T extends PropsProperties>({\n sizes,\n predefinedSizes,\n cssProperty = 'size',\n sizing = 'px',\n customSizeHandler,\n sort = desktopFirst,\n }: ResponsiveNamedPropertyPayload<T>) =>\n () =>\n () => {\n const mediaCssStrArr = Object.keys(sizes)\n .sort(sort)\n .map((size) => {\n if (sizes[size] !== undefined) {\n const _size: PossibleValues =\n typeof customSizeHandler === 'function' ? customSizeHandler(sizes[size]) : sizes[size]\n\n return buildMediaQuery(_size, cssProperty, getMediaQueryByResponsiveProp(size), sizing, predefinedSizes)\n }\n return null\n })\n .filter(Boolean)\n .map(\n (item) =>\n css`\n ${item}\n `\n )\n\n return mediaCssStrArr\n }\n\n/**\n * Миксин для генерации media запросов\n *\n * @param propName имя пропсы\n * @param cssProperty имя css свойства\n * @param sizing значение величины, по умолчанию `px`\n * @returns строки медиазапросов\n */\nexport const responsiveProperty =\n (propName: string, cssProperty: string | null = null, sizing: null | string = 'px') =>\n () =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (props: any) => {\n const prop: ResponsiveProperty | null = props[propName] ?? null\n const _cssProperty = cssProperty ?? propName\n if (!prop) return null\n\n if (Array.isArray(prop) && prop.length === 3) {\n const [desktop, tablet, mobile] = prop\n return css`\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`\n ${_cssProperty}: ${typeof desktop === 'number' ? `${desktop}${sizing ?? ''}` : desktop};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`\n ${_cssProperty}: ${typeof tablet === 'number' ? `${tablet}${sizing ?? ''}` : tablet};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.mobile()`\n ${_cssProperty}: ${typeof mobile === 'number' ? `${mobile}${sizing ?? ''}` : mobile};\n `}\n `\n }\n\n if (Array.isArray(prop) && prop.length === 6 && typeof _cssProperty === 'string') {\n const [xl, l, m, s, xs, xxs] = prop\n return css`\n ${SCREEN_SIZE_MAP.XL()`\n ${_cssProperty}: ${typeof xl === 'number' ? `${xl}${sizing ?? ''}` : xl};\n `}\n ${SCREEN_SIZE_MAP.L()`\n ${_cssProperty}: ${typeof l === 'number' ? `${l}${sizing ?? ''}` : l};\n `}\n ${SCREEN_SIZE_MAP.M()`\n ${_cssProperty}: ${typeof m === 'number' ? `${m}${sizing ?? ''}` : m};\n `}\n ${SCREEN_SIZE_MAP.S()`\n ${_cssProperty}: ${typeof s === 'number' ? `${s}${sizing ?? ''}` : s};\n `}\n ${SCREEN_SIZE_MAP.XS()`\n ${_cssProperty}: ${typeof xs === 'number' ? `${xs}${sizing ?? ''}` : xs};\n `}\n ${SCREEN_SIZE_MAP.XXS()`\n ${_cssProperty}: ${typeof xxs === 'number' ? `${xxs}${sizing ?? ''}` : xxs};\n `}\n `\n }\n\n if (typeof prop === 'number') {\n return css`\n ${_cssProperty}: ${prop}${sizing ?? null};\n `\n }\n\n if (typeof prop === 'string') {\n return css`\n ${_cssProperty}: ${prop};\n `\n }\n\n return null\n }\n"],"names":["property","value","cssProperty","sizing","sizes","sizeMap","getLatinSizeMapByCssProperty","includes","css","SCREEN_SIZE_MAP","XXS","screenMaxXxs","XS","screenMaxXs","S","screenMaxS","M","screenMaxM","L","screenMaxL","XL","screenMinL","SCREEN_SIZE_MAP_BY_DEVICE_ALIAS","desktop","screenMinM","tablet","mobile","responsiveNamedProperty","predefinedSizes","customSizeHandler","sort","desktopFirst","Object","keys","map","size","undefined","_size","buildMediaQuery","getMediaQueryByResponsiveProp","filter","Boolean","item","responsiveProperty","propName","props","prop","_cssProperty","Array","isArray","length","xl","l","m","s","xs","xxs"],"mappings":"qQAuDaA,SACXA,CACEC,EACAC,EAA2B,OAC3BC,EAAwB,KACxBC,IAEF,IACA,KACE,UAAWH,GAAU,UACnB,cAAcC,GAAgB,WAAaA,EAAY,GAAK,KAG9D,MAAMG,EAAUD,GAASE,6BAA6BJ,GAEtD,cAAWA,GAAgB,WAClBA,SAAmBD,GAAU,SAAWA,EAAQI,EAAQJ,WAGtDA,GAAU,UAAY,CAAC,OAAQ,UAAW,WAAWM,SAASN,GAChEO,IAAG,CAAA,GAAA,IAAA,KACNN,EAAgBD,GAGfO,oBACHN,SAAuBD,GAAU,UAAYI,EAAQJ,GAASI,EAAQJ,GAASA,EAAQE,GAAU,GAAE,EAI3G,MAAMM,gBAA2E,CAC/EC,IAAKC,aACLC,GAAIC,YACJC,EAAGC,WACHC,EAAGC,WACHC,EAAGC,WACHC,GAAIC,YAGN,MAAMC,gCAA+F,CACnGC,QAASC,WACTC,OAAQR,WACRS,OAAQX,YAqBH,MAAMY,wBACXA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EvE1C,gBAAgBS,GAAG;cACf6B,aAAwBK,GAAM,SAAW,GAAGA,IAAIjD,GAAU,KAAOiD;YAEnE3C,gBAAgBO,GAAG;cACjB+B,aAAwBM,GAAM,SAAW,GAAGA,IAAIlD,GAAU,KAAOkD;YAEnE5C,gBAAgBK,GAAG;cACjBiC,aAAwBO,GAAM,SAAW,GAAGA,IAAInD,GAAU,KAAOmD;YAEnE7C,gBAAgBG,IAAI;cAClBmC,aAAwBQ,GAAO,SAAW,GAAGA,IAAKpD,GAAU,KAAOoD;YAErE9C,gBAAgBC,KAAK;cACnBqC,aAAwBS,GAAQ,SAAW,GAAGA,IAAMrD,GAAU,KAAOqD;YAG/E,CAEA,cAAWV,GAAS,SACXtC,oBACHuC,EAAiBD,EAAO3C,GAAU,aAI7B2C,GAAS,SACXtC,IAAG,CAAA,GAAA,IAAA,KACNuC,EAAiBD,GAIhB,IAAI"}
1
+ {"version":3,"file":"responsive-property.mjs","sources":["../../../src/mixins/responsive-property.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { FlattenSimpleInterpolation } from 'styled-components'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs, screenMinM } from 'mixins/screen'\nimport {\n buildMediaQuery,\n getLatinSizeMapByCssProperty,\n desktopFirst,\n getMediaQueryByResponsiveProp,\n} from 'mixins/shared'\nimport type { Size } from 'shared/types'\n\n/**\n * Value for breakpoint\n */\nexport type PossibleValues = number | Size | 'auto' | 'initial' | 'inherit' | boolean\n\ntype PropsProperties =\n | 'size'\n | 'fontSize'\n | 'height'\n | 'width'\n | 'top'\n | 'right'\n | 'bottom'\n | 'left'\n | 'padding'\n | 'paddingTop'\n | 'paddingRight'\n | 'paddingBottom'\n | 'paddingLeft'\n | 'margin'\n | 'marginTop'\n | 'marginRight'\n | 'marginBottom'\n | 'marginLeft'\n | 'fluid'\n\nexport type CalcProperty = (\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n) => FlattenSimpleInterpolation | null\ntype CssProperty = string | CalcProperty\ntype ResponsiveKeys = '' | 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL'\n\nexport type ResponsiveNamedProperty<T extends PropsProperties, V extends PossibleValues = PossibleValues> = Partial<\n Record<`${T}${ResponsiveKeys}`, V>\n>\n\nexport type ResponsiveProperty<V = number | Size> =\n | V\n | [desktop: V, tablet: V, mobile: V]\n | [xl: V, l: V, m: V, s: V, xs: V, xxs: V]\n\nexport const property =\n (\n value: PossibleValues,\n cssProperty: CssProperty = 'size',\n sizing: null | string = 'px',\n sizes?: Record<Size, number>\n ) =>\n () =>\n () => {\n if (typeof value === 'boolean') {\n return typeof cssProperty === 'function' ? cssProperty(1) : null\n }\n\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(cssProperty)\n\n if (typeof cssProperty === 'function') {\n return cssProperty(typeof value === 'number' ? value : sizeMap[value as keyof typeof sizeMap])\n }\n\n if (typeof value === 'string' && ['auto', 'initial', 'inherit'].includes(value))\n return css`\n ${cssProperty}: ${value};\n `\n\n return css`\n ${cssProperty}: ${typeof value === 'string' && sizeMap[value as keyof typeof sizeMap]\n ? sizeMap[value as keyof typeof sizeMap]\n : value}${sizing ?? ''};\n `\n }\n\nconst SCREEN_SIZE_MAP: Record<Exclude<ResponsiveKeys, ''>, typeof screenMaxXs> = {\n XXS: screenMaxXxs,\n XS: screenMaxXs,\n S: screenMaxS,\n M: screenMaxM,\n L: screenMaxL,\n XL: screenMinL,\n}\n\nconst SCREEN_SIZE_MAP_BY_DEVICE_ALIAS: Record<'desktop' | 'tablet' | 'mobile', typeof screenMaxXs> = {\n desktop: screenMinM,\n tablet: screenMaxM,\n mobile: screenMaxS,\n}\n\ninterface ResponsiveNamedPropertyPayload<T extends PropsProperties> {\n sizes: ResponsiveNamedProperty<T>\n cssProperty: CssProperty\n sizing?: null | string\n customSizeHandler?: (_value: PossibleValues) => PossibleValues\n sort?: (_a: string, _b: string) => number\n predefinedSizes?: Record<Size, number>\n}\n\n/**\n * Миксин для генерации media запросов\n *\n * @param obj.sizes Объект, в качестве ключей брэйкпоинт, в качестве значений - величина\n * @param obj.cssProperty CSS свойство, может быть функцией, возвращающей css`` из styled-components\n * @param obj.sizing значение величины, по умолчанию `px`\n * @param obj.customSizeHandler функция для вычисления кастомных значений величин\n * @returns строки медиазапросов\n */\nexport const responsiveNamedProperty =\n <T extends PropsProperties>({\n sizes,\n predefinedSizes,\n cssProperty = 'size',\n sizing = 'px',\n customSizeHandler,\n sort = desktopFirst,\n }: ResponsiveNamedPropertyPayload<T>) =>\n () =>\n () => {\n const mediaCssStrArr = Object.keys(sizes)\n .sort(sort)\n .map((size) => {\n const value = sizes[size as keyof Required<typeof sizes>]\n\n if (value !== undefined) {\n const _size: PossibleValues = typeof customSizeHandler === 'function' ? customSizeHandler(value) : value\n\n return buildMediaQuery(_size, cssProperty, getMediaQueryByResponsiveProp(size), sizing, predefinedSizes)\n }\n return null\n })\n .filter(Boolean)\n .map(\n (item) => css`\n ${item}\n `\n )\n\n return mediaCssStrArr\n }\n\n/**\n * Миксин для генерации media запросов\n *\n * @param propName имя пропсы\n * @param cssProperty имя css свойства\n * @param sizing значение величины, по умолчанию `px`\n * @returns строки медиазапросов\n */\nexport const responsiveProperty =\n (propName: string, cssProperty: string | null = null, sizing: null | string = 'px') =>\n () =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (props: any) => {\n const prop: ResponsiveProperty | null = props[propName] ?? null\n const _cssProperty = cssProperty ?? propName\n if (!prop) return null\n\n if (Array.isArray(prop) && prop.length === 3) {\n const [desktop, tablet, mobile] = prop\n return css`\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.desktop()`\n ${_cssProperty}: ${typeof desktop === 'number' ? `${desktop}${sizing ?? ''}` : desktop};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.tablet()`\n ${_cssProperty}: ${typeof tablet === 'number' ? `${tablet}${sizing ?? ''}` : tablet};\n `}\n ${SCREEN_SIZE_MAP_BY_DEVICE_ALIAS.mobile()`\n ${_cssProperty}: ${typeof mobile === 'number' ? `${mobile}${sizing ?? ''}` : mobile};\n `}\n `\n }\n\n if (Array.isArray(prop) && prop.length === 6 && typeof _cssProperty === 'string') {\n const [xl, l, m, s, xs, xxs] = prop\n return css`\n ${SCREEN_SIZE_MAP.XL()`\n ${_cssProperty}: ${typeof xl === 'number' ? `${xl}${sizing ?? ''}` : xl};\n `}\n ${SCREEN_SIZE_MAP.L()`\n ${_cssProperty}: ${typeof l === 'number' ? `${l}${sizing ?? ''}` : l};\n `}\n ${SCREEN_SIZE_MAP.M()`\n ${_cssProperty}: ${typeof m === 'number' ? `${m}${sizing ?? ''}` : m};\n `}\n ${SCREEN_SIZE_MAP.S()`\n ${_cssProperty}: ${typeof s === 'number' ? `${s}${sizing ?? ''}` : s};\n `}\n ${SCREEN_SIZE_MAP.XS()`\n ${_cssProperty}: ${typeof xs === 'number' ? `${xs}${sizing ?? ''}` : xs};\n `}\n ${SCREEN_SIZE_MAP.XXS()`\n ${_cssProperty}: ${typeof xxs === 'number' ? `${xxs}${sizing ?? ''}` : xxs};\n `}\n `\n }\n\n if (typeof prop === 'number') {\n return css`\n ${_cssProperty}: ${prop}${sizing ?? null};\n `\n }\n\n if (typeof prop === 'string') {\n return css`\n ${_cssProperty}: ${prop};\n `\n }\n\n return null\n }\n"],"names":["property","value","cssProperty","sizing","sizes","sizeMap","getLatinSizeMapByCssProperty","includes","css","SCREEN_SIZE_MAP","XXS","screenMaxXxs","XS","screenMaxXs","S","screenMaxS","M","screenMaxM","L","screenMaxL","XL","screenMinL","SCREEN_SIZE_MAP_BY_DEVICE_ALIAS","desktop","screenMinM","tablet","mobile","responsiveNamedProperty","predefinedSizes","customSizeHandler","sort","desktopFirst","Object","keys","map","size","undefined","_size","buildMediaQuery","getMediaQueryByResponsiveProp","filter","Boolean","item","responsiveProperty","propName","props","prop","_cssProperty","Array","isArray","length","xl","l","m","s","xs","xxs"],"mappings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-components');var constants=require('../shared/constants.js');const CONDITIONS=(()=>{const maxWidth=(e,s)=>`(max-width: ${e[s]-.02}px)`;const minWidth=(e,s)=>`(min-width: ${e[s]}px)`;return{MAX:maxWidth,MIN:minWidth,RANGE:(e,s,r)=>`${minWidth(e,s)} and ${maxWidth(e,r)}`}})();const createMediaQuery=(e,...s)=>r=>(...n)=>c=>{const t={...constants.BREAKPOINTS,...c.theme?.breakpoints??{}};return r!==void 0&&typeof r.condition=='function'&&r.condition(c)===!1?styled.css([""]):styled.css(["@media screen and "," ","{","}"],e(t,...s),r!==void 0&&typeof r.and=='string'?`and ${r.and}`:"",styled.css(...n))};const screenXs=createMediaQuery(CONDITIONS.RANGE,'xxs','xs');const screenS=createMediaQuery(CONDITIONS.RANGE,'xs','s');const screenM=createMediaQuery(CONDITIONS.RANGE,'s','m');const screenL=createMediaQuery(CONDITIONS.RANGE,'m','l');const screenXl=createMediaQuery(CONDITIONS.RANGE,'l','xl');const screenMaxXxs=createMediaQuery(CONDITIONS.MAX,'xxs');const screenMaxXs=createMediaQuery(CONDITIONS.MAX,'xs');const screenMinXs=createMediaQuery(CONDITIONS.MIN,'xs');const screenMaxS=createMediaQuery(CONDITIONS.MAX,'s');const screenMinS=createMediaQuery(CONDITIONS.MIN,'s');const screenMaxM=createMediaQuery(CONDITIONS.MAX,'m');const screenMinM=createMediaQuery(CONDITIONS.MIN,'m');const screenMaxL=createMediaQuery(CONDITIONS.MAX,'l');const screenMinL=createMediaQuery(CONDITIONS.MIN,'l');const screenMaxXl=createMediaQuery(CONDITIONS.MAX,'xl');const screenMinXl=createMediaQuery(CONDITIONS.MIN,'xl');exports.createMediaQuery=createMediaQuery,exports.screenL=screenL,exports.screenM=screenM,exports.screenMaxL=screenMaxL,exports.screenMaxM=screenMaxM,exports.screenMaxS=screenMaxS,exports.screenMaxXl=screenMaxXl,exports.screenMaxXs=screenMaxXs,exports.screenMaxXxs=screenMaxXxs,exports.screenMinL=screenMinL,exports.screenMinM=screenMinM,exports.screenMinS=screenMinS,exports.screenMinXl=screenMinXl,exports.screenMinXs=screenMinXs,exports.screenRetina=(...e)=>styled.css(["@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){","}"],styled.css(...e)),exports.screenS=screenS,exports.screenXl=screenXl,exports.screenXs=screenXs;
1
+ 'use strict';var styled=require('styled-components');var constants=require('../shared/constants.js');const CONDITIONS=(()=>{const maxWidth=(e,s)=>`(max-width: ${e[s]-.02}px)`;const minWidth=(e,s)=>`(min-width: ${e[s]}px)`;return{MAX:maxWidth,MIN:minWidth,RANGE:(e,s,r)=>`${minWidth(e,s)} and ${maxWidth(e,r)}`}})();const createMediaQuery=(e,...s)=>r=>(...n)=>c=>{const t={...constants.BREAKPOINTS,...c.theme?.breakpoints??{}};return r!==void 0&&typeof r.condition=='function'&&r.condition(c)===!1?'':styled.css(["@media screen and "," ","{","}"],e(t,...s),r!==void 0&&typeof r.and=='string'?`and ${r.and}`:"",styled.css(...n))};const screenXs=createMediaQuery(CONDITIONS.RANGE,'xxs','xs');const screenS=createMediaQuery(CONDITIONS.RANGE,'xs','s');const screenM=createMediaQuery(CONDITIONS.RANGE,'s','m');const screenL=createMediaQuery(CONDITIONS.RANGE,'m','l');const screenXl=createMediaQuery(CONDITIONS.RANGE,'l','xl');const screenMaxXxs=createMediaQuery(CONDITIONS.MAX,'xxs');const screenMaxXs=createMediaQuery(CONDITIONS.MAX,'xs');const screenMinXs=createMediaQuery(CONDITIONS.MIN,'xs');const screenMaxS=createMediaQuery(CONDITIONS.MAX,'s');const screenMinS=createMediaQuery(CONDITIONS.MIN,'s');const screenMaxM=createMediaQuery(CONDITIONS.MAX,'m');const screenMinM=createMediaQuery(CONDITIONS.MIN,'m');const screenMaxL=createMediaQuery(CONDITIONS.MAX,'l');const screenMinL=createMediaQuery(CONDITIONS.MIN,'l');const screenMaxXl=createMediaQuery(CONDITIONS.MAX,'xl');const screenMinXl=createMediaQuery(CONDITIONS.MIN,'xl');exports.createMediaQuery=createMediaQuery,exports.screenL=screenL,exports.screenM=screenM,exports.screenMaxL=screenMaxL,exports.screenMaxM=screenMaxM,exports.screenMaxS=screenMaxS,exports.screenMaxXl=screenMaxXl,exports.screenMaxXs=screenMaxXs,exports.screenMaxXxs=screenMaxXxs,exports.screenMinL=screenMinL,exports.screenMinM=screenMinM,exports.screenMinS=screenMinS,exports.screenMinXl=screenMinXl,exports.screenMinXs=screenMinXs,exports.screenRetina=(...e)=>styled.css(["@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){","}"],styled.css(...e)),exports.screenS=screenS,exports.screenXl=screenXl,exports.screenXs=screenXs;
2
2
  //# sourceMappingURL=screen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"screen.js","sources":["../../../src/mixins/screen.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { CSSObject, ThemeProps, DefaultTheme, SimpleInterpolation, Interpolation } from 'styled-components'\nimport { BREAKPOINTS } from 'shared/constants'\n\ntype MediaQueryParams = {\n and?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n condition?: (_props: any) => boolean\n}\n\ntype ThemeBreakpoints = DefaultTheme['breakpoints']\n\ntype BreakpointKey = keyof ThemeBreakpoints\n\nconst CONDITIONS = (() => {\n const maxWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) =>\n `(max-width: ${breakpoints[point] - 0.02}px)`\n const minWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) => `(min-width: ${breakpoints[point]}px)`\n\n return {\n MAX: maxWidth,\n MIN: minWidth,\n RANGE: (breakpoints: ThemeBreakpoints, point1: BreakpointKey, point2: BreakpointKey) =>\n `${minWidth(breakpoints, point1)} and ${maxWidth(breakpoints, point2)}`,\n }\n})()\n\nexport const createMediaQuery =\n (condition: (_breakpoints: ThemeBreakpoints, ..._points: BreakpointKey[]) => string, ...points: BreakpointKey[]) =>\n (params?: MediaQueryParams) =>\n <T extends object>(...args: [CSSObject | TemplateStringsArray, ...Interpolation<T & ThemeProps<DefaultTheme>>[]]) =>\n (props: ThemeProps<DefaultTheme>) => {\n const contextBreakpoints = props.theme?.breakpoints ?? {}\n const breakpoints: ThemeBreakpoints = { ...BREAKPOINTS, ...contextBreakpoints }\n\n if (params !== undefined && typeof params.condition === 'function' && params.condition(props) === false) {\n return css``\n }\n\n return css<T>`\n @media screen and ${condition(breakpoints, ...points)} ${params !== undefined && typeof params.and === 'string'\n ? `and ${params.and}`\n : ``} {\n ${css<T>(...args)}\n }\n `\n }\n\n/**\n * @return `@media screen and (min-width: 320px) and (max-width: 374px) { ...args }`\n */\nexport const screenXs = createMediaQuery(CONDITIONS.RANGE, 'xxs', 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) and (max-width: 767px) { ...args }`\n */\nexport const screenS = createMediaQuery(CONDITIONS.RANGE, 'xs', 's')\n\n/**\n * @return `@media screen and (min-width: 768) and (max-width: 1023px) { ...args }`\n */\nexport const screenM = createMediaQuery(CONDITIONS.RANGE, 's', 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) and (max-width: 1279px) { ...args }`\n */\nexport const screenL = createMediaQuery(CONDITIONS.RANGE, 'm', 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) and (max-width: 1439px) { ...args }`\n */\nexport const screenXl = createMediaQuery(CONDITIONS.RANGE, 'l', 'xl')\n\n/**\n * @return `@media screen and (max-width: 319px) { ...args }`\n */\nexport const screenMaxXxs = createMediaQuery(CONDITIONS.MAX, 'xxs')\n\n/**\n * @return `@media screen and (max-width: 374px) { ...args }`\n */\nexport const screenMaxXs = createMediaQuery(CONDITIONS.MAX, 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) { ...args }`\n */\nexport const screenMinXs = createMediaQuery(CONDITIONS.MIN, 'xs')\n\n/**\n * @return `@media screen and (max-width: 767px) { ...args }`\n */\nexport const screenMaxS = createMediaQuery(CONDITIONS.MAX, 's')\n\n/**\n * @return `@media screen and (min-width: 768px) { ...args }`\n */\nexport const screenMinS = createMediaQuery(CONDITIONS.MIN, 's')\n\n/**\n * @return `@media screen and (max-width: 1023px) { ...args }`\n */\nexport const screenMaxM = createMediaQuery(CONDITIONS.MAX, 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) { ...args }`\n */\nexport const screenMinM = createMediaQuery(CONDITIONS.MIN, 'm')\n\n/**\n * @return `@media screen and (max-width: 1279px) { ...args }`\n */\nexport const screenMaxL = createMediaQuery(CONDITIONS.MAX, 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) { ...args }`\n */\nexport const screenMinL = createMediaQuery(CONDITIONS.MIN, 'l')\n\n/**\n * @return `@media screen and (max-width: 1439px) { ...args }`\n */\nexport const screenMaxXl = createMediaQuery(CONDITIONS.MAX, 'xl')\n\n/**\n * @return `@media screen and (min-width: 1440px) { ...args }`\n */\nexport const screenMinXl = createMediaQuery(CONDITIONS.MIN, 'xl')\n\n/**\n * @return `@media -webkit-min-device-pixel-ratio: 2 and (min-resolution: 192dpi) { ...args }`\n */\nexport const screenRetina = (...args: [CSSObject | TemplateStringsArray, SimpleInterpolation]) => css`\n @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n ${css(...args)}\n }\n`\n\nexport type MediaQuery = ReturnType<typeof createMediaQuery>\n"],"names":["CONDITIONS","maxWidth","breakpoints","point","minWidth","MAX","MIN","RANGE","point1","point2","createMediaQuery","condition","points","params","args","props","BREAKPOINTS","theme","undefined","css","and","screenXs","screenS","screenM","screenL","screenXl","screenMaxXxs","screenMaxXs","screenMinXs","screenMaxS","screenMinS","screenMaxM","screenMinM","screenMaxL","screenMinL","screenMaxXl","screenMinXl","screenRetina"],"mappings":"qGAcA,MAAMA,WAAa,MACjB,MAAMC,SAAWA,CAACC,EAA+BC,IAC/C,eAAeD,EAAYC,GAAS,SACtC,MAAMC,SAAWA,CAACF,EAA+BC,IAAyB,eAAeD,EAAYC,QAErG,MAAO,CACLE,IAAKJ,SACLK,IAAKF,SACLG,MAAOA,CAACL,EAA+BM,EAAuBC,IAC5D,GAAGL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AAA,KAE/FA,cAAOL"}
1
+ {"version":3,"file":"screen.js","sources":["../../../src/mixins/screen.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { CSSObject, ThemeProps, DefaultTheme, SimpleInterpolation, Interpolation } from 'styled-components'\nimport { BREAKPOINTS } from 'shared/constants'\n\ntype MediaQueryParams = {\n and?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n condition?: (_props: any) => boolean\n}\n\ntype ThemeBreakpoints = DefaultTheme['breakpoints']\n\ntype BreakpointKey = keyof ThemeBreakpoints\n\nconst CONDITIONS = (() => {\n const maxWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) =>\n `(max-width: ${breakpoints[point] - 0.02}px)`\n const minWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) => `(min-width: ${breakpoints[point]}px)`\n\n return {\n MAX: maxWidth,\n MIN: minWidth,\n RANGE: (breakpoints: ThemeBreakpoints, point1: BreakpointKey, point2: BreakpointKey) =>\n `${minWidth(breakpoints, point1)} and ${maxWidth(breakpoints, point2)}`,\n }\n})()\n\nexport const createMediaQuery =\n (condition: (_breakpoints: ThemeBreakpoints, ..._points: BreakpointKey[]) => string, ...points: BreakpointKey[]) =>\n (params?: MediaQueryParams) =>\n <T extends object>(...args: [CSSObject | TemplateStringsArray, ...Interpolation<T & ThemeProps<DefaultTheme>>[]]) =>\n (props: ThemeProps<DefaultTheme>) => {\n const contextBreakpoints = props.theme?.breakpoints ?? {}\n const breakpoints: ThemeBreakpoints = { ...BREAKPOINTS, ...contextBreakpoints }\n\n if (params !== undefined && typeof params.condition === 'function' && params.condition(props) === false) {\n return ''\n }\n\n return css<T>`\n /* stylelint-disable-next-line media-query-no-invalid */\n @media screen and ${condition(breakpoints, ...points)} ${params !== undefined && typeof params.and === 'string'\n ? `and ${params.and}`\n : ``} {\n ${css<T>(...args)}\n }\n `\n }\n\n/**\n * @return `@media screen and (min-width: 320px) and (max-width: 374px) { ...args }`\n */\nexport const screenXs = createMediaQuery(CONDITIONS.RANGE, 'xxs', 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) and (max-width: 767px) { ...args }`\n */\nexport const screenS = createMediaQuery(CONDITIONS.RANGE, 'xs', 's')\n\n/**\n * @return `@media screen and (min-width: 768) and (max-width: 1023px) { ...args }`\n */\nexport const screenM = createMediaQuery(CONDITIONS.RANGE, 's', 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) and (max-width: 1279px) { ...args }`\n */\nexport const screenL = createMediaQuery(CONDITIONS.RANGE, 'm', 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) and (max-width: 1439px) { ...args }`\n */\nexport const screenXl = createMediaQuery(CONDITIONS.RANGE, 'l', 'xl')\n\n/**\n * @return `@media screen and (max-width: 319px) { ...args }`\n */\nexport const screenMaxXxs = createMediaQuery(CONDITIONS.MAX, 'xxs')\n\n/**\n * @return `@media screen and (max-width: 374px) { ...args }`\n */\nexport const screenMaxXs = createMediaQuery(CONDITIONS.MAX, 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) { ...args }`\n */\nexport const screenMinXs = createMediaQuery(CONDITIONS.MIN, 'xs')\n\n/**\n * @return `@media screen and (max-width: 767px) { ...args }`\n */\nexport const screenMaxS = createMediaQuery(CONDITIONS.MAX, 's')\n\n/**\n * @return `@media screen and (min-width: 768px) { ...args }`\n */\nexport const screenMinS = createMediaQuery(CONDITIONS.MIN, 's')\n\n/**\n * @return `@media screen and (max-width: 1023px) { ...args }`\n */\nexport const screenMaxM = createMediaQuery(CONDITIONS.MAX, 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) { ...args }`\n */\nexport const screenMinM = createMediaQuery(CONDITIONS.MIN, 'm')\n\n/**\n * @return `@media screen and (max-width: 1279px) { ...args }`\n */\nexport const screenMaxL = createMediaQuery(CONDITIONS.MAX, 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) { ...args }`\n */\nexport const screenMinL = createMediaQuery(CONDITIONS.MIN, 'l')\n\n/**\n * @return `@media screen and (max-width: 1439px) { ...args }`\n */\nexport const screenMaxXl = createMediaQuery(CONDITIONS.MAX, 'xl')\n\n/**\n * @return `@media screen and (min-width: 1440px) { ...args }`\n */\nexport const screenMinXl = createMediaQuery(CONDITIONS.MIN, 'xl')\n\n/**\n * @return `@media -webkit-min-device-pixel-ratio: 2 and (min-resolution: 192dpi) { ...args }`\n */\nexport const screenRetina = (...args: [CSSObject | TemplateStringsArray, SimpleInterpolation]) => css`\n @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n ${css(...args)}\n }\n`\n\nexport type MediaQuery = ReturnType<typeof createMediaQuery>\n"],"names":["CONDITIONS","maxWidth","breakpoints","point","minWidth","MAX","MIN","RANGE","point1","point2","createMediaQuery","condition","points","params","args","props","BREAKPOINTS","theme","undefined","css","and","screenXs","screenS","screenM","screenL","screenXl","screenMaxXxs","screenMaxXs","screenMinXs","screenMaxS","screenMinS","screenMaxM","screenMinM","screenMaxL","screenMinL","screenMaxXl","screenMinXl","screenRetina"],"mappings":"qGAcA,MAAMA,WAAa,MACjB,MAAMC,SAAWA,CAACC,EAA+BC,IAC/C,eAAeD,EAAYC,GAAS,SACtC,MAAMC,SAAWA,CAACF,EAA+BC,IAAyB,eAAeD,EAAYC,QAErG,MAAO,CACLE,IAAKJ,SACLK,IAAKF,SACLG,MAAOA,CAACL,EAA+BM,EAAuBC,IAC5D,GAAGL,SAASF,EAAaM,UAAeP,SAASC,EAAaO,KAEnE,EAXkB,SAaNC,iBACXA,CAACC,KAAuFC,IACvFC,GACD,IAAsBC,IACrBC,IAEC,MAAMb,EAAgC,IAAKc,UAAWA,eAD3BD,EAAME,OAAOf,aAAe,CAAA,GAGvD,OAAIW,SAAWK,UAAoBL,EAAOF,WAAc,YAAcE,EAAOF,UAAUI,MAAW,EACzF,GAGFI,WAAG,CAAA,qBAAA,IAAA,IAAA,KAEYR,EAAUT,KAAgBU,GAAWC,SAAWK,UAAoBL,EAAOO,KAAQ,SACjG,OAAOP,EAAOO,MACd,GACFD,OAAAA,OAAUL,GAAK,EAQZO,MAAAA,SAAWX,iBAAiBV,WAAWO,MAAO,MAAO,MAKrDe,MAAAA,QAAUZ,iBAAiBV,WAAWO,MAAO,KAAM,KAKnDgB,MAAAA,QAAUb,iBAAiBV,WAAWO,MAAO,IAAK,KAKlDiB,MAAAA,QAAUd,iBAAiBV,WAAWO,MAAO,IAAK,KAKlDkB,MAAAA,SAAWf,iBAAiBV,WAAWO,MAAO,IAAK,MAKzD,MAAMmB,aAAehB,iBAAiBV,WAAWK,IAAK,OAKtD,MAAMsB,YAAcjB,iBAAiBV,WAAWK,IAAK,MAKrD,MAAMuB,YAAclB,iBAAiBV,WAAWM,IAAK,MAKrD,MAAMuB,WAAanB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAMyB,WAAapB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAMyB,WAAarB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAM2B,WAAatB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAM2B,WAAavB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAM6B,WAAaxB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAM6B,YAAczB,iBAAiBV,WAAWK,IAAK,MAKrD,MAAM+B,YAAc1B,iBAAiBV,WAAWM,IAAK,2cAKhC+B,IAAIvB,IAAkEK,WAAG,CAAA,qEAAA,KAE/FA,cAAOL"}
package/mixins/screen.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{css}from'styled-components';import{BREAKPOINTS}from'../shared/constants.mjs';const CONDITIONS=(()=>{const maxWidth=(e,s)=>`(max-width: ${e[s]-.02}px)`;const minWidth=(e,s)=>`(min-width: ${e[s]}px)`;return{MAX:maxWidth,MIN:minWidth,RANGE:(e,s,n)=>`${minWidth(e,s)} and ${maxWidth(e,n)}`}})();const createMediaQuery=(e,...s)=>n=>(...c)=>r=>{const t={...BREAKPOINTS,...r.theme?.breakpoints??{}};return n!==void 0&&typeof n.condition=='function'&&n.condition(r)===!1?css([""]):css(["@media screen and "," ","{","}"],e(t,...s),n!==void 0&&typeof n.and=='string'?`and ${n.and}`:"",css(...c))};const screenXs=createMediaQuery(CONDITIONS.RANGE,'xxs','xs');const screenS=createMediaQuery(CONDITIONS.RANGE,'xs','s');const screenM=createMediaQuery(CONDITIONS.RANGE,'s','m');const screenL=createMediaQuery(CONDITIONS.RANGE,'m','l');const screenXl=createMediaQuery(CONDITIONS.RANGE,'l','xl');const screenMaxXxs=createMediaQuery(CONDITIONS.MAX,'xxs');const screenMaxXs=createMediaQuery(CONDITIONS.MAX,'xs');const screenMinXs=createMediaQuery(CONDITIONS.MIN,'xs');const screenMaxS=createMediaQuery(CONDITIONS.MAX,'s');const screenMinS=createMediaQuery(CONDITIONS.MIN,'s');const screenMaxM=createMediaQuery(CONDITIONS.MAX,'m');const screenMinM=createMediaQuery(CONDITIONS.MIN,'m');const screenMaxL=createMediaQuery(CONDITIONS.MAX,'l');const screenMinL=createMediaQuery(CONDITIONS.MIN,'l');const screenMaxXl=createMediaQuery(CONDITIONS.MAX,'xl');const screenMinXl=createMediaQuery(CONDITIONS.MIN,'xl');const screenRetina=(...e)=>css(["@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){","}"],css(...e));export{createMediaQuery,screenL,screenM,screenMaxL,screenMaxM,screenMaxS,screenMaxXl,screenMaxXs,screenMaxXxs,screenMinL,screenMinM,screenMinS,screenMinXl,screenMinXs,screenRetina,screenS,screenXl,screenXs};
1
+ import{css}from'styled-components';import{BREAKPOINTS}from'../shared/constants.mjs';const CONDITIONS=(()=>{const maxWidth=(e,s)=>`(max-width: ${e[s]-.02}px)`;const minWidth=(e,s)=>`(min-width: ${e[s]}px)`;return{MAX:maxWidth,MIN:minWidth,RANGE:(e,s,n)=>`${minWidth(e,s)} and ${maxWidth(e,n)}`}})();const createMediaQuery=(e,...s)=>n=>(...c)=>r=>{const t={...BREAKPOINTS,...r.theme?.breakpoints??{}};return n!==void 0&&typeof n.condition=='function'&&n.condition(r)===!1?'':css(["@media screen and "," ","{","}"],e(t,...s),n!==void 0&&typeof n.and=='string'?`and ${n.and}`:"",css(...c))};const screenXs=createMediaQuery(CONDITIONS.RANGE,'xxs','xs');const screenS=createMediaQuery(CONDITIONS.RANGE,'xs','s');const screenM=createMediaQuery(CONDITIONS.RANGE,'s','m');const screenL=createMediaQuery(CONDITIONS.RANGE,'m','l');const screenXl=createMediaQuery(CONDITIONS.RANGE,'l','xl');const screenMaxXxs=createMediaQuery(CONDITIONS.MAX,'xxs');const screenMaxXs=createMediaQuery(CONDITIONS.MAX,'xs');const screenMinXs=createMediaQuery(CONDITIONS.MIN,'xs');const screenMaxS=createMediaQuery(CONDITIONS.MAX,'s');const screenMinS=createMediaQuery(CONDITIONS.MIN,'s');const screenMaxM=createMediaQuery(CONDITIONS.MAX,'m');const screenMinM=createMediaQuery(CONDITIONS.MIN,'m');const screenMaxL=createMediaQuery(CONDITIONS.MAX,'l');const screenMinL=createMediaQuery(CONDITIONS.MIN,'l');const screenMaxXl=createMediaQuery(CONDITIONS.MAX,'xl');const screenMinXl=createMediaQuery(CONDITIONS.MIN,'xl');const screenRetina=(...e)=>css(["@media (-webkit-min-device-pixel-ratio:2),(min-resolution:192dpi){","}"],css(...e));export{createMediaQuery,screenL,screenM,screenMaxL,screenMaxM,screenMaxS,screenMaxXl,screenMaxXs,screenMaxXxs,screenMinL,screenMinM,screenMinS,screenMinXl,screenMinXs,screenRetina,screenS,screenXl,screenXs};
2
2
  //# sourceMappingURL=screen.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"screen.mjs","sources":["../../../src/mixins/screen.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { CSSObject, ThemeProps, DefaultTheme, SimpleInterpolation, Interpolation } from 'styled-components'\nimport { BREAKPOINTS } from 'shared/constants'\n\ntype MediaQueryParams = {\n and?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n condition?: (_props: any) => boolean\n}\n\ntype ThemeBreakpoints = DefaultTheme['breakpoints']\n\ntype BreakpointKey = keyof ThemeBreakpoints\n\nconst CONDITIONS = (() => {\n const maxWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) =>\n `(max-width: ${breakpoints[point] - 0.02}px)`\n const minWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) => `(min-width: ${breakpoints[point]}px)`\n\n return {\n MAX: maxWidth,\n MIN: minWidth,\n RANGE: (breakpoints: ThemeBreakpoints, point1: BreakpointKey, point2: BreakpointKey) =>\n `${minWidth(breakpoints, point1)} and ${maxWidth(breakpoints, point2)}`,\n }\n})()\n\nexport const createMediaQuery =\n (condition: (_breakpoints: ThemeBreakpoints, ..._points: BreakpointKey[]) => string, ...points: BreakpointKey[]) =>\n (params?: MediaQueryParams) =>\n <T extends object>(...args: [CSSObject | TemplateStringsArray, ...Interpolation<T & ThemeProps<DefaultTheme>>[]]) =>\n (props: ThemeProps<DefaultTheme>) => {\n const contextBreakpoints = props.theme?.breakpoints ?? {}\n const breakpoints: ThemeBreakpoints = { ...BREAKPOINTS, ...contextBreakpoints }\n\n if (params !== undefined && typeof params.condition === 'function' && params.condition(props) === false) {\n return css``\n }\n\n return css<T>`\n @media screen and ${condition(breakpoints, ...points)} ${params !== undefined && typeof params.and === 'string'\n ? `and ${params.and}`\n : ``} {\n ${css<T>(...args)}\n }\n `\n }\n\n/**\n * @return `@media screen and (min-width: 320px) and (max-width: 374px) { ...args }`\n */\nexport const screenXs = createMediaQuery(CONDITIONS.RANGE, 'xxs', 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) and (max-width: 767px) { ...args }`\n */\nexport const screenS = createMediaQuery(CONDITIONS.RANGE, 'xs', 's')\n\n/**\n * @return `@media screen and (min-width: 768) and (max-width: 1023px) { ...args }`\n */\nexport const screenM = createMediaQuery(CONDITIONS.RANGE, 's', 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) and (max-width: 1279px) { ...args }`\n */\nexport const screenL = createMediaQuery(CONDITIONS.RANGE, 'm', 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) and (max-width: 1439px) { ...args }`\n */\nexport const screenXl = createMediaQuery(CONDITIONS.RANGE, 'l', 'xl')\n\n/**\n * @return `@media screen and (max-width: 319px) { ...args }`\n */\nexport const screenMaxXxs = createMediaQuery(CONDITIONS.MAX, 'xxs')\n\n/**\n * @return `@media screen and (max-width: 374px) { ...args }`\n */\nexport const screenMaxXs = createMediaQuery(CONDITIONS.MAX, 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) { ...args }`\n */\nexport const screenMinXs = createMediaQuery(CONDITIONS.MIN, 'xs')\n\n/**\n * @return `@media screen and (max-width: 767px) { ...args }`\n */\nexport const screenMaxS = createMediaQuery(CONDITIONS.MAX, 's')\n\n/**\n * @return `@media screen and (min-width: 768px) { ...args }`\n */\nexport const screenMinS = createMediaQuery(CONDITIONS.MIN, 's')\n\n/**\n * @return `@media screen and (max-width: 1023px) { ...args }`\n */\nexport const screenMaxM = createMediaQuery(CONDITIONS.MAX, 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) { ...args }`\n */\nexport const screenMinM = createMediaQuery(CONDITIONS.MIN, 'm')\n\n/**\n * @return `@media screen and (max-width: 1279px) { ...args }`\n */\nexport const screenMaxL = createMediaQuery(CONDITIONS.MAX, 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) { ...args }`\n */\nexport const screenMinL = createMediaQuery(CONDITIONS.MIN, 'l')\n\n/**\n * @return `@media screen and (max-width: 1439px) { ...args }`\n */\nexport const screenMaxXl = createMediaQuery(CONDITIONS.MAX, 'xl')\n\n/**\n * @return `@media screen and (min-width: 1440px) { ...args }`\n */\nexport const screenMinXl = createMediaQuery(CONDITIONS.MIN, 'xl')\n\n/**\n * @return `@media -webkit-min-device-pixel-ratio: 2 and (min-resolution: 192dpi) { ...args }`\n */\nexport const screenRetina = (...args: [CSSObject | TemplateStringsArray, SimpleInterpolation]) => css`\n @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n ${css(...args)}\n }\n`\n\nexport type MediaQuery = ReturnType<typeof createMediaQuery>\n"],"names":["CONDITIONS","maxWidth","breakpoints","point","minWidth","MAX","MIN","RANGE","point1","point2","createMediaQuery","condition","points","params","args","props","BREAKPOINTS","theme","undefined","css","and","screenXs","screenS","screenM","screenL","screenXl","screenMaxXxs","screenMaxXs","screenMinXs","screenMaxS","screenMinS","screenMaxM","screenMinM","screenMaxL","screenMinL","screenMaxXl","screenMinXl","screenRetina"],"mappings":"oFAcA,MAAMA,WAAa,MACjB,MAAMC,SAAWA,CAACC,EAA+BC,IAC/C,eAAeD,EAAYC,GAAS,SACtC,MAAMC,SAAWA,CAACF,EAA+BC,IAAyB,eAAeD,EAAYC,QAErG,MAAO,CACLE,IAAKJ,SACLK,IAAKF,SACLG,MAAOA,CAACL,EAA+BM,EAAuBC,IAC5D,GAAGL,SAASF,EAAaM,UAAeP,SAASC,EAAaO,KAEnE,EAXkB,SAaNC,iBACXA,CAACC,KAAuFC,IACvFC,GACD,IAAsBC,IACrBC,IAEC,MAAMb,EAAgC,IAAKc,eADhBD,EAAME,OAAOf,aAAe,CAAA,GAGvD,OAAIW,SAAWK,UAAoBL,EAAOF,WAAc,YAAcE,EAAOF,UAAUI,MAAW,EACzFI,IAAG,CAAA,KAGLA,IAAG,CAAA,qBAAA,IAAA,IAAA,KACYR,EAAUT,KAAgBU,GAAWC,SAAWK,UAAoBL,EAAOO,KAAQ,SACjG,OAAOP,EAAOO,MACd,GACFD,OAAUL,GAAK,EAQZO,MAAAA,SAAWX,iBAAiBV,WAAWO,MAAO,MAAO,MAKrDe,MAAAA,QAAUZ,iBAAiBV,WAAWO,MAAO,KAAM,KAKnDgB,MAAAA,QAAUb,iBAAiBV,WAAWO,MAAO,IAAK,KAKlDiB,MAAAA,QAAUd,iBAAiBV,WAAWO,MAAO,IAAK,KAKlDkB,MAAAA,SAAWf,iBAAiBV,WAAWO,MAAO,IAAK,MAKzD,MAAMmB,aAAehB,iBAAiBV,WAAWK,IAAK,OAKtD,MAAMsB,YAAcjB,iBAAiBV,WAAWK,IAAK,MAKrD,MAAMuB,YAAclB,iBAAiBV,WAAWM,IAAK,MAKrD,MAAMuB,WAAanB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAMyB,WAAapB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAMyB,WAAarB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAM2B,WAAatB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAM2B,WAAavB,iBAAiBV,WAAWK,IAAK,KAKpD,MAAM6B,WAAaxB,iBAAiBV,WAAWM,IAAK,KAKpD,MAAM6B,YAAczB,iBAAiBV,WAAWK,IAAK,MAKrD,MAAM+B,YAAc1B,iBAAiBV,WAAWM,IAAK,MAK/C+B,MAAAA,aAAeA,IAAIvB,IAAkEK,IAAG,CAAA,qEAAA,KAE/FA,OAAOL"}
1
+ {"version":3,"file":"screen.mjs","sources":["../../../src/mixins/screen.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { CSSObject, ThemeProps, DefaultTheme, SimpleInterpolation, Interpolation } from 'styled-components'\nimport { BREAKPOINTS } from 'shared/constants'\n\ntype MediaQueryParams = {\n and?: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n condition?: (_props: any) => boolean\n}\n\ntype ThemeBreakpoints = DefaultTheme['breakpoints']\n\ntype BreakpointKey = keyof ThemeBreakpoints\n\nconst CONDITIONS = (() => {\n const maxWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) =>\n `(max-width: ${breakpoints[point] - 0.02}px)`\n const minWidth = (breakpoints: ThemeBreakpoints, point: BreakpointKey) => `(min-width: ${breakpoints[point]}px)`\n\n return {\n MAX: maxWidth,\n MIN: minWidth,\n RANGE: (breakpoints: ThemeBreakpoints, point1: BreakpointKey, point2: BreakpointKey) =>\n `${minWidth(breakpoints, point1)} and ${maxWidth(breakpoints, point2)}`,\n }\n})()\n\nexport const createMediaQuery =\n (condition: (_breakpoints: ThemeBreakpoints, ..._points: BreakpointKey[]) => string, ...points: BreakpointKey[]) =>\n (params?: MediaQueryParams) =>\n <T extends object>(...args: [CSSObject | TemplateStringsArray, ...Interpolation<T & ThemeProps<DefaultTheme>>[]]) =>\n (props: ThemeProps<DefaultTheme>) => {\n const contextBreakpoints = props.theme?.breakpoints ?? {}\n const breakpoints: ThemeBreakpoints = { ...BREAKPOINTS, ...contextBreakpoints }\n\n if (params !== undefined && typeof params.condition === 'function' && params.condition(props) === false) {\n return ''\n }\n\n return css<T>`\n /* stylelint-disable-next-line media-query-no-invalid */\n @media screen and ${condition(breakpoints, ...points)} ${params !== undefined && typeof params.and === 'string'\n ? `and ${params.and}`\n : ``} {\n ${css<T>(...args)}\n }\n `\n }\n\n/**\n * @return `@media screen and (min-width: 320px) and (max-width: 374px) { ...args }`\n */\nexport const screenXs = createMediaQuery(CONDITIONS.RANGE, 'xxs', 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) and (max-width: 767px) { ...args }`\n */\nexport const screenS = createMediaQuery(CONDITIONS.RANGE, 'xs', 's')\n\n/**\n * @return `@media screen and (min-width: 768) and (max-width: 1023px) { ...args }`\n */\nexport const screenM = createMediaQuery(CONDITIONS.RANGE, 's', 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) and (max-width: 1279px) { ...args }`\n */\nexport const screenL = createMediaQuery(CONDITIONS.RANGE, 'm', 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) and (max-width: 1439px) { ...args }`\n */\nexport const screenXl = createMediaQuery(CONDITIONS.RANGE, 'l', 'xl')\n\n/**\n * @return `@media screen and (max-width: 319px) { ...args }`\n */\nexport const screenMaxXxs = createMediaQuery(CONDITIONS.MAX, 'xxs')\n\n/**\n * @return `@media screen and (max-width: 374px) { ...args }`\n */\nexport const screenMaxXs = createMediaQuery(CONDITIONS.MAX, 'xs')\n\n/**\n * @return `@media screen and (min-width: 375px) { ...args }`\n */\nexport const screenMinXs = createMediaQuery(CONDITIONS.MIN, 'xs')\n\n/**\n * @return `@media screen and (max-width: 767px) { ...args }`\n */\nexport const screenMaxS = createMediaQuery(CONDITIONS.MAX, 's')\n\n/**\n * @return `@media screen and (min-width: 768px) { ...args }`\n */\nexport const screenMinS = createMediaQuery(CONDITIONS.MIN, 's')\n\n/**\n * @return `@media screen and (max-width: 1023px) { ...args }`\n */\nexport const screenMaxM = createMediaQuery(CONDITIONS.MAX, 'm')\n\n/**\n * @return `@media screen and (min-width: 1024px) { ...args }`\n */\nexport const screenMinM = createMediaQuery(CONDITIONS.MIN, 'm')\n\n/**\n * @return `@media screen and (max-width: 1279px) { ...args }`\n */\nexport const screenMaxL = createMediaQuery(CONDITIONS.MAX, 'l')\n\n/**\n * @return `@media screen and (min-width: 1280px) { ...args }`\n */\nexport const screenMinL = createMediaQuery(CONDITIONS.MIN, 'l')\n\n/**\n * @return `@media screen and (max-width: 1439px) { ...args }`\n */\nexport const screenMaxXl = createMediaQuery(CONDITIONS.MAX, 'xl')\n\n/**\n * @return `@media screen and (min-width: 1440px) { ...args }`\n */\nexport const screenMinXl = createMediaQuery(CONDITIONS.MIN, 'xl')\n\n/**\n * @return `@media -webkit-min-device-pixel-ratio: 2 and (min-resolution: 192dpi) { ...args }`\n */\nexport const screenRetina = (...args: [CSSObject | TemplateStringsArray, SimpleInterpolation]) => css`\n @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {\n ${css(...args)}\n }\n`\n\nexport type MediaQuery = ReturnType<typeof createMediaQuery>\n"],"names":["CONDITIONS","maxWidth","breakpoints","point","minWidth","MAX","MIN","RANGE","point1","point2","createMediaQuery","condition","points","params","args","props","BREAKPOINTS","theme","undefined","css","and","screenXs","screenS","screenM","screenL","screenXl","screenMaxXxs","screenMaxXs","screenMinXs","screenMaxS","screenMinS","screenMaxM","screenMinM","screenMaxL","screenMinL","screenMaxXl","screenMinXl","screenRetina"],"mappings":"oFAcA,MAAMA,WAAa,MACjB,MAAMC,SAAWA,CAACC,EAA+BC,IAC/C,eAAeD,EAAYC,GAA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,iBAAiBV,WAAWK,IAAK,MAKrD,MAAM+B,YAAc1B,iBAAiBV,WAAWM,IAAK,MAK/C+B,MAAAA,aAAeA,IAAIvB,IAAkEK,IAAG,CAAA,qEAAA,KAE/FA,OAAOL"}
package/mixins/shared.js CHANGED
@@ -1,6 +1,6 @@
1
- 'use strict';var styled=require('styled-components');var screen=require('./screen.js');const SIZES_LATIN=Object.freeze({xxxl:44,xxl:40,xl:36,l:28,m:24,s:20,xs:16,xxs:8,xxxs:4});const FONT_SIZES_LATIN=Object.freeze({xxxl:24,xxl:22,xl:20,l:18,m:16,s:14,xs:12,xxs:10,xxxs:8});const DESKTOP_FIRST_KEYS=['xl','l','m','s','xs','xxs'];const MOBILE_FIRST_KEYS=['xxs','xs','s','m','l','xl'];function getLatinSizeMapByCssProperty(e){return typeof e=='string'&&e==='font-size'?FONT_SIZES_LATIN:SIZES_LATIN}const getKey=e=>e.endsWith('XXS')?'xxs':e.endsWith('XS')?'xs':e.endsWith('S')?'s':e.endsWith('M')?'m':e.endsWith('XL')?'xl':e.endsWith('L')?'l':null;exports.FONT_SIZES_LATIN=FONT_SIZES_LATIN,exports.SIZES_LATIN=SIZES_LATIN,exports.buildMediaQuery=(e,s,t,n,r)=>{const x=r??getLatinSizeMapByCssProperty(s);const S=typeof e=='string'?x[e]??e:e;if(typeof s=='function'){const e=s(S,n);return styled.css(["",""],t()`
2
- ${e}
3
- `)}return styled.css(["",""],t()`
4
- ${s}: ${S}${typeof S=='string'?'':n??''};
1
+ 'use strict';var styled=require('styled-components');var screen=require('./screen.js');const SIZES_LATIN=Object.freeze({xxxl:44,xxl:40,xl:36,l:28,m:24,s:20,xs:16,xxs:8,xxxs:4});const FONT_SIZES_LATIN=Object.freeze({xxxl:24,xxl:22,xl:20,l:18,m:16,s:14,xs:12,xxs:10,xxxs:8});const DESKTOP_FIRST_KEYS=['xl','l','m','s','xs','xxs'];const MOBILE_FIRST_KEYS=['xxs','xs','s','m','l','xl'];function getLatinSizeMapByCssProperty(e){return typeof e=='string'&&e==='font-size'?FONT_SIZES_LATIN:SIZES_LATIN}const getKey=e=>e.endsWith('XXS')?'xxs':e.endsWith('XS')?'xs':e.endsWith('S')?'s':e.endsWith('M')?'m':e.endsWith('XL')?'xl':e.endsWith('L')?'l':null;exports.FONT_SIZES_LATIN=FONT_SIZES_LATIN,exports.SIZES_LATIN=SIZES_LATIN,exports.buildMediaQuery=(e,s,t,n,r)=>{const x=r??getLatinSizeMapByCssProperty(s);const S=typeof e=='string'?x[e]??e:e;return styled.css(["",""],typeof s=='function'?t()`
2
+ ${s(S,n)}
3
+ `:t()`
4
+ ${s}: ${String(S)}${typeof S=='string'?'':n??''};
5
5
  `)},exports.desktopFirst=(e,s)=>{const t=getKey(e);const n=getKey(s);return t&&n?DESKTOP_FIRST_KEYS.findIndex((e=>e===t))<DESKTOP_FIRST_KEYS.findIndex((e=>e===n))?-1:1:0},exports.getLatinSizeMapByCssProperty=getLatinSizeMapByCssProperty,exports.getMediaQueryByResponsiveProp=e=>e.endsWith('XXS')?screen.screenMaxXxs:e.endsWith('XS')?screen.screenMaxXs:e.endsWith('S')?screen.screenMaxS:e.endsWith('M')?screen.screenMaxM:e.endsWith('XL')?screen.screenMinL:screen.screenMaxL,exports.mobileFirst=(e,s)=>{const t=getKey(e);const n=getKey(s);return t&&n?MOBILE_FIRST_KEYS.findIndex((e=>e===t))<MOBILE_FIRST_KEYS.findIndex((e=>e===n))?-1:1:0};
6
6
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sources":["../../../src/mixins/shared.ts"],"sourcesContent":["import { css, FlattenSimpleInterpolation } from 'styled-components'\nimport type { Size } from 'shared/types'\nimport { screenXs, screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs } from './screen'\nimport type { MediaQuery } from './screen'\n\nexport const SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 44,\n xxl: 40,\n xl: 36,\n l: 28,\n m: 24,\n s: 20,\n xs: 16,\n xxs: 8,\n xxxs: 4,\n})\n\n// eslint-disable-next-line no-unused-vars\nexport const FONT_SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 24,\n xxl: 22,\n xl: 20,\n l: 18,\n m: 16,\n s: 14,\n xs: 12,\n xxs: 10,\n xxxs: 8,\n})\n\nconst DESKTOP_FIRST_KEYS = ['xl', 'l', 'm', 's', 'xs', 'xxs']\nconst MOBILE_FIRST_KEYS = ['xxs', 'xs', 's', 'm', 'l', 'xl']\n\nexport function getLatinSizeMapByCssProperty<T>(cssProperty: T) {\n if (typeof cssProperty === 'string' && cssProperty === 'font-size') return FONT_SIZES_LATIN\n return SIZES_LATIN\n}\n\nexport function buildMediaQuery(\n value: number | Size | 'auto' | 'initial' | 'inherit' | boolean,\n property:\n | string\n | ((\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n ) => FlattenSimpleInterpolation | null),\n screenQueryFunction: typeof screenXs,\n sizing: null | string,\n sizes?: Record<Size, number>\n): ReturnType<typeof css> {\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(property)\n\n const size: number | 'auto' | 'initial' | 'inherit' | boolean =\n typeof value === 'string' ? sizeMap[value] ?? value : value\n\n if (typeof property === 'function') {\n const value = property(size, sizing)\n return css`\n ${screenQueryFunction()`\n ${value}\n `}\n `\n }\n\n return css`\n ${screenQueryFunction()`\n ${property}: ${size as string}${typeof size === 'string' ? '' : sizing ?? ''};\n `}\n `\n}\n\nconst getKey = (key: string): 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | null => {\n if (key.endsWith('XXS')) return 'xxs'\n if (key.endsWith('XS')) return 'xs'\n if (key.endsWith('S')) return 's'\n if (key.endsWith('M')) return 'm'\n if (key.endsWith('XL')) return 'xl'\n if (key.endsWith('L')) return 'l'\n return null\n}\n\nexport const desktopFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const mobileFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const getMediaQueryByResponsiveProp = (prop: string): MediaQuery => {\n if (prop.endsWith('XXS')) return screenMaxXxs\n if (prop.endsWith('XS')) return screenMaxXs\n if (prop.endsWith('S')) return screenMaxS\n if (prop.endsWith('M')) return screenMaxM\n if (prop.endsWith('XL')) return screenMinL\n return screenMaxL\n}\n"],"names":["SIZES_LATIN","Object","freeze","xxxl","xxl","xl","l","m","s","xs","xxs","xxxs","FONT_SIZES_LATIN","DESKTOP_FIRST_KEYS","MOBILE_FIRST_KEYS","getLatinSizeMapByCssProperty","cssProperty","getKey","key","endsWith","value","property","screenQueryFunction","sizing","sizes","sizeMap","size","css","desktopFirst","a","b","aKey","bKey","findIndex","el","prop","screenMaxXxs","screenMaxXs","screenMaxS","screenMaxM","screenMinL","screenMaxL","mobileFirst"],"mappings":"6FAKaA,YAA8CC,OAAOC,OAAO,CACvEC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,GACJC,IAAK,EACLC,KAAM,UAIKC,iBAAmDX,OAAOC,OAAO,CAC5EC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,GACJC,IAAK,GACLC,KAAM,IAGR,MAAME,mBAAqB,CAAC,KAAM,IAAK,IAAK,IAAK,KAAM,OACvD,MAAMC,kBAAoB,CAAC,MAAO,KAAM,IAAK,IAAK,IAAK,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hC,EAAI,EALH,CAKI"}
1
+ {"version":3,"file":"shared.js","sources":["../../../src/mixins/shared.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { FlattenSimpleInterpolation } from 'styled-components'\nimport type { Size } from 'shared/types'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs } from './screen'\nimport type { MediaQuery, screenXs } from './screen'\n\nexport const SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 44,\n xxl: 40,\n xl: 36,\n l: 28,\n m: 24,\n s: 20,\n xs: 16,\n xxs: 8,\n xxxs: 4,\n})\n\nexport const FONT_SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 24,\n xxl: 22,\n xl: 20,\n l: 18,\n m: 16,\n s: 14,\n xs: 12,\n xxs: 10,\n xxxs: 8,\n})\n\nconst DESKTOP_FIRST_KEYS = ['xl', 'l', 'm', 's', 'xs', 'xxs']\nconst MOBILE_FIRST_KEYS = ['xxs', 'xs', 's', 'm', 'l', 'xl']\n\nexport function getLatinSizeMapByCssProperty<T>(cssProperty: T) {\n if (typeof cssProperty === 'string' && cssProperty === 'font-size') return FONT_SIZES_LATIN\n return SIZES_LATIN\n}\n\nexport function buildMediaQuery(\n value: number | Size | 'auto' | 'initial' | 'inherit' | boolean,\n property:\n | string\n | ((\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n ) => FlattenSimpleInterpolation | null),\n screenQueryFunction: typeof screenXs,\n sizing: null | string,\n sizes?: Record<Size, number>\n): ReturnType<typeof css> {\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(property)\n\n const size = typeof value === 'string' ? (sizeMap[value as keyof typeof sizeMap] ?? value) : value\n\n if (typeof property === 'function') {\n return css`\n ${screenQueryFunction()`\n ${property(size, sizing)}\n `}\n `\n }\n\n return css`\n ${screenQueryFunction()`\n ${property}: ${String(size)}${typeof size === 'string' ? '' : (sizing ?? '')};\n `}\n `\n}\n\nconst getKey = (key: string): 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | null => {\n if (key.endsWith('XXS')) return 'xxs'\n if (key.endsWith('XS')) return 'xs'\n if (key.endsWith('S')) return 's'\n if (key.endsWith('M')) return 'm'\n if (key.endsWith('XL')) return 'xl'\n if (key.endsWith('L')) return 'l'\n return null\n}\n\nexport const desktopFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const mobileFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const getMediaQueryByResponsiveProp = (prop: string): MediaQuery => {\n if (prop.endsWith('XXS')) return screenMaxXxs\n if (prop.endsWith('XS')) return screenMaxXs\n if (prop.endsWith('S')) return screenMaxS\n if (prop.endsWith('M')) return screenMaxM\n if (prop.endsWith('XL')) return screenMinL\n return screenMaxL\n}\n"],"names":["SIZES_LATIN","Object","freeze","xxxl","xxl","xl","l","m","s","xs","xxs","xxxs","FONT_SIZES_LATIN","DESKTOP_FIRST_KEYS","MOBILE_FIRST_KEYS","getLatinSizeMapByCssProperty","cssProperty","getKey","key","endsWith","value","property","screenQueryFunction","sizing","sizes","sizeMap","size","css","String","desktopFirst","a","b","aKey","bKey","findIndex","el","prop","screenMaxXxs","screenMaxXs","screenMaxS","screenMaxM","screenMinL","screenMaxL","mobileFirst"],"mappings":"6FAMaA,YAA8CC,OAAOC,OAAO,CACvEC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAA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3BJ,EAAKjB,SAAS,MAAcsB,OAAAA,WACzBC,sCAjBkBC,CAACb,EAAWC,KACrC,MAAMC,EAAOf,OAAOa,GACpB,MAAMG,EAAOhB,OAAOc,GACpB,OAAKC,GAASC,EAECnB,kBAAkBoB,WAAWC,GAAOA,IAAOH,IAC3ClB,kBAAkBoB,WAAWC,GAAOA,IAAOF,KAEhC,EAAI,EALH,CAKI"}
package/mixins/shared.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import{css}from'styled-components';import{screenMaxXxs,screenMaxXs,screenMaxS,screenMaxM,screenMinL,screenMaxL}from'./screen.mjs';const SIZES_LATIN=Object.freeze({xxxl:44,xxl:40,xl:36,l:28,m:24,s:20,xs:16,xxs:8,xxxs:4});const FONT_SIZES_LATIN=Object.freeze({xxxl:24,xxl:22,xl:20,l:18,m:16,s:14,xs:12,xxs:10,xxxs:8});const DESKTOP_FIRST_KEYS=['xl','l','m','s','xs','xxs'];const MOBILE_FIRST_KEYS=['xxs','xs','s','m','l','xl'];function getLatinSizeMapByCssProperty(e){return typeof e=='string'&&e==='font-size'?FONT_SIZES_LATIN:SIZES_LATIN}function buildMediaQuery(e,s,n,t,x){const r=x??getLatinSizeMapByCssProperty(s);const i=typeof e=='string'?r[e]??e:e;if(typeof s=='function'){const e=s(i,t);return css(["",""],n()`
2
- ${e}
3
- `)}return css(["",""],n()`
4
- ${s}: ${i}${typeof i=='string'?'':t??''};
1
+ import{css}from'styled-components';import{screenMaxXxs,screenMaxXs,screenMaxS,screenMaxM,screenMinL,screenMaxL}from'./screen.mjs';const SIZES_LATIN=Object.freeze({xxxl:44,xxl:40,xl:36,l:28,m:24,s:20,xs:16,xxs:8,xxxs:4});const FONT_SIZES_LATIN=Object.freeze({xxxl:24,xxl:22,xl:20,l:18,m:16,s:14,xs:12,xxs:10,xxxs:8});const DESKTOP_FIRST_KEYS=['xl','l','m','s','xs','xxs'];const MOBILE_FIRST_KEYS=['xxs','xs','s','m','l','xl'];function getLatinSizeMapByCssProperty(e){return typeof e=='string'&&e==='font-size'?FONT_SIZES_LATIN:SIZES_LATIN}function buildMediaQuery(e,s,n,t,x){const r=x??getLatinSizeMapByCssProperty(s);const i=typeof e=='string'?r[e]??e:e;return css(["",""],typeof s=='function'?n()`
2
+ ${s(i,t)}
3
+ `:n()`
4
+ ${s}: ${String(i)}${typeof i=='string'?'':t??''};
5
5
  `)}const getKey=e=>e.endsWith('XXS')?'xxs':e.endsWith('XS')?'xs':e.endsWith('S')?'s':e.endsWith('M')?'m':e.endsWith('XL')?'xl':e.endsWith('L')?'l':null;const desktopFirst=(e,s)=>{const n=getKey(e);const t=getKey(s);return n&&t?DESKTOP_FIRST_KEYS.findIndex((e=>e===n))<DESKTOP_FIRST_KEYS.findIndex((e=>e===t))?-1:1:0};const mobileFirst=(e,s)=>{const n=getKey(e);const t=getKey(s);return n&&t?MOBILE_FIRST_KEYS.findIndex((e=>e===n))<MOBILE_FIRST_KEYS.findIndex((e=>e===t))?-1:1:0};const getMediaQueryByResponsiveProp=e=>e.endsWith('XXS')?screenMaxXxs:e.endsWith('XS')?screenMaxXs:e.endsWith('S')?screenMaxS:e.endsWith('M')?screenMaxM:e.endsWith('XL')?screenMinL:screenMaxL;export{FONT_SIZES_LATIN,SIZES_LATIN,buildMediaQuery,desktopFirst,getLatinSizeMapByCssProperty,getMediaQueryByResponsiveProp,mobileFirst};
6
6
  //# sourceMappingURL=shared.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.mjs","sources":["../../../src/mixins/shared.ts"],"sourcesContent":["import { css, FlattenSimpleInterpolation } from 'styled-components'\nimport type { Size } from 'shared/types'\nimport { screenXs, screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs } from './screen'\nimport type { MediaQuery } from './screen'\n\nexport const SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 44,\n xxl: 40,\n xl: 36,\n l: 28,\n m: 24,\n s: 20,\n xs: 16,\n xxs: 8,\n xxxs: 4,\n})\n\n// eslint-disable-next-line no-unused-vars\nexport const FONT_SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 24,\n xxl: 22,\n xl: 20,\n l: 18,\n m: 16,\n s: 14,\n xs: 12,\n xxs: 10,\n xxxs: 8,\n})\n\nconst DESKTOP_FIRST_KEYS = ['xl', 'l', 'm', 's', 'xs', 'xxs']\nconst MOBILE_FIRST_KEYS = ['xxs', 'xs', 's', 'm', 'l', 'xl']\n\nexport function getLatinSizeMapByCssProperty<T>(cssProperty: T) {\n if (typeof cssProperty === 'string' && cssProperty === 'font-size') return FONT_SIZES_LATIN\n return SIZES_LATIN\n}\n\nexport function buildMediaQuery(\n value: number | Size | 'auto' | 'initial' | 'inherit' | boolean,\n property:\n | string\n | ((\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n ) => FlattenSimpleInterpolation | null),\n screenQueryFunction: typeof screenXs,\n sizing: null | string,\n sizes?: Record<Size, number>\n): ReturnType<typeof css> {\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(property)\n\n const size: number | 'auto' | 'initial' | 'inherit' | boolean =\n typeof value === 'string' ? sizeMap[value] ?? value : value\n\n if (typeof property === 'function') {\n const value = property(size, sizing)\n return css`\n ${screenQueryFunction()`\n ${value}\n `}\n `\n }\n\n return css`\n ${screenQueryFunction()`\n ${property}: ${size as string}${typeof size === 'string' ? '' : sizing ?? ''};\n `}\n `\n}\n\nconst getKey = (key: string): 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | null => {\n if (key.endsWith('XXS')) return 'xxs'\n if (key.endsWith('XS')) return 'xs'\n if (key.endsWith('S')) return 's'\n if (key.endsWith('M')) return 'm'\n if (key.endsWith('XL')) return 'xl'\n if (key.endsWith('L')) return 'l'\n return null\n}\n\nexport const desktopFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const mobileFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const getMediaQueryByResponsiveProp = (prop: string): MediaQuery => {\n if (prop.endsWith('XXS')) return screenMaxXxs\n if (prop.endsWith('XS')) return screenMaxXs\n if (prop.endsWith('S')) return screenMaxS\n if (prop.endsWith('M')) return screenMaxM\n if (prop.endsWith('XL')) return screenMinL\n return screenMaxL\n}\n"],"names":["SIZES_LATIN","Object","freeze","xxxl","xxl","xl","l","m","s","xs","xxs","xxxs","FONT_SIZES_LATIN","DESKTOP_FIRST_KEYS","MOBILE_FIRST_KEYS","getLatinSizeMapByCssProperty","cssProperty","buildMediaQuery","value","property","screenQueryFunction","sizing","sizes","sizeMap","size","css","getKey","key","endsWith","desktopFirst","a","b","aKey","bKey","findIndex","el","mobileFirst","getMediaQueryByResponsiveProp","prop","screenMaxXxs","screenMaxXs","screenMaxS","screenMaxM","screenMinL","screenMaxL"],"mappings":"wIAKaA,YAA8CC,OAAOC,OAAO,CACvEC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,GACJC,IAAK,EACLC,KAAM,UAIKC,iBAAmDX,OAAOC,OAAO,CAC5EC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,GACJC,IAAK,GACLC,KAAM,IAGR,MAAME,mBAAqB,CAAC,KAAM,IAAK,IAAK,IAAK,KAAM,OACvD,MAAMC,kBAAoB,CAAC,MAAO,KAAM,IAAK,IAAK,IAAK,MAEhD,SAASC,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sources":["../../../src/mixins/shared.ts"],"sourcesContent":["import { css } from 'styled-components'\nimport type { FlattenSimpleInterpolation } from 'styled-components'\nimport type { Size } from 'shared/types'\nimport { screenMaxL, screenMaxM, screenMaxS, screenMaxXs, screenMinL, screenMaxXxs } from './screen'\nimport type { MediaQuery, screenXs } from './screen'\n\nexport const SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 44,\n xxl: 40,\n xl: 36,\n l: 28,\n m: 24,\n s: 20,\n xs: 16,\n xxs: 8,\n xxxs: 4,\n})\n\nexport const FONT_SIZES_LATIN: Readonly<Record<Size, number>> = Object.freeze({\n xxxl: 24,\n xxl: 22,\n xl: 20,\n l: 18,\n m: 16,\n s: 14,\n xs: 12,\n xxs: 10,\n xxxs: 8,\n})\n\nconst DESKTOP_FIRST_KEYS = ['xl', 'l', 'm', 's', 'xs', 'xxs']\nconst MOBILE_FIRST_KEYS = ['xxs', 'xs', 's', 'm', 'l', 'xl']\n\nexport function getLatinSizeMapByCssProperty<T>(cssProperty: T) {\n if (typeof cssProperty === 'string' && cssProperty === 'font-size') return FONT_SIZES_LATIN\n return SIZES_LATIN\n}\n\nexport function buildMediaQuery(\n value: number | Size | 'auto' | 'initial' | 'inherit' | boolean,\n property:\n | string\n | ((\n _size: number | 'auto' | 'initial' | 'inherit' | boolean,\n _sizing?: null | string\n ) => FlattenSimpleInterpolation | null),\n screenQueryFunction: typeof screenXs,\n sizing: null | string,\n sizes?: Record<Size, number>\n): ReturnType<typeof css> {\n const sizeMap = sizes ?? getLatinSizeMapByCssProperty(property)\n\n const size = typeof value === 'string' ? (sizeMap[value as keyof typeof sizeMap] ?? value) : value\n\n if (typeof property === 'function') {\n return css`\n ${screenQueryFunction()`\n ${property(size, sizing)}\n `}\n `\n }\n\n return css`\n ${screenQueryFunction()`\n ${property}: ${String(size)}${typeof size === 'string' ? '' : (sizing ?? '')};\n `}\n `\n}\n\nconst getKey = (key: string): 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | null => {\n if (key.endsWith('XXS')) return 'xxs'\n if (key.endsWith('XS')) return 'xs'\n if (key.endsWith('S')) return 's'\n if (key.endsWith('M')) return 'm'\n if (key.endsWith('XL')) return 'xl'\n if (key.endsWith('L')) return 'l'\n return null\n}\n\nexport const desktopFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = DESKTOP_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const mobileFirst = (a: string, b: string): number => {\n const aKey = getKey(a)\n const bKey = getKey(b)\n if (!aKey || !bKey) return 0\n\n const aIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === aKey)\n const bIndex = MOBILE_FIRST_KEYS.findIndex((el) => el === bKey)\n\n return aIndex < bIndex ? -1 : 1\n}\n\nexport const getMediaQueryByResponsiveProp = (prop: string): MediaQuery => {\n if (prop.endsWith('XXS')) return screenMaxXxs\n if (prop.endsWith('XS')) return screenMaxXs\n if (prop.endsWith('S')) return screenMaxS\n if (prop.endsWith('M')) return screenMaxM\n if (prop.endsWith('XL')) return screenMinL\n return screenMaxL\n}\n"],"names":["SIZES_LATIN","Object","freeze","xxxl","xxl","xl","l","m","s","xs","xxs","xxxs","FONT_SIZES_LATIN","DESKTOP_FIRST_KEYS","MOBILE_FIRST_KEYS","getLatinSizeMapByCssProperty","cssProperty","buildMediaQuery","value","property","screenQueryFunction","sizing","sizes","sizeMap","size","css","String","getKey","key","endsWith","desktopFirst","a","b","aKey","bKey","findIndex","el","mobileFirst","getMediaQueryByResponsiveProp","prop","screenMaxXxs","screenMaxXs","screenMaxS","screenMaxM","screenMinL","screenMaxL"],"mappings":"wIAMaA,YAA8CC,OAAOC,OAAO,CACvEC,KAAM,GACNC,IAAK,GACLC,GAAI,GACJC,EAAG,GACHC,EAAG,GACHC,EAAG,GACHC,GAAI,G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OF,KAEhC,EAAI,EALH,CAKI,EAGpBI,MAAAA,8BAAiCC,GACxCA,EAAKV,SAAS,OAAeW,aAC7BD,EAAKV,SAAS,MAAcY,YAC5BF,EAAKV,SAAS,KAAaa,WAC3BH,EAAKV,SAAS,KAAac,WAC3BJ,EAAKV,SAAS,MAAce,WACzBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"vAlign.js","sources":["../../../src/mixins/vAlign.ts"],"sourcesContent":["import { css } from 'styled-components'\n\nexport interface VAlign {\n vAlign?: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline'\n}\n\nexport const vAlign = (vAlign: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline') => css`\n vertical-align: ${vAlign};\n`\n"],"names":["vAlign","css"],"mappings":"oEAMuBA,GAAkFC,OAAGA,IAAA,CAAA,kBAAA,KACxFD"}
1
+ {"version":3,"file":"vAlign.js","sources":["../../../src/mixins/vAlign.ts"],"sourcesContent":["import { css } from 'styled-components'\n\nexport interface VAlign {\n vAlign?: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline'\n}\n\nexport const vAlign = (align: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline') => css`\n vertical-align: ${align};\n`\n"],"names":["align","css"],"mappings":"oEAMuBA,GAAiFC,OAAGA,IAAA,CAAA,kBAAA,KACvFD"}
@@ -1 +1 @@
1
- {"version":3,"file":"vAlign.mjs","sources":["../../../src/mixins/vAlign.ts"],"sourcesContent":["import { css } from 'styled-components'\n\nexport interface VAlign {\n vAlign?: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline'\n}\n\nexport const vAlign = (vAlign: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline') => css`\n vertical-align: ${vAlign};\n`\n"],"names":["vAlign","css"],"mappings":"mCAMO,MAAMA,OAAUA,GAAkFC,IAAG,CAAA,kBAAA,KACxFD"}
1
+ {"version":3,"file":"vAlign.mjs","sources":["../../../src/mixins/vAlign.ts"],"sourcesContent":["import { css } from 'styled-components'\n\nexport interface VAlign {\n vAlign?: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline'\n}\n\nexport const vAlign = (align: 'top' | 'middle' | 'bottom' | 'text-top' | 'text-bottom' | 'baseline') => css`\n vertical-align: ${align};\n`\n"],"names":["vAlign","align","css"],"mappings":"mCAMO,MAAMA,OAAUC,GAAiFC,IAAG,CAAA,kBAAA,KACvFD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxford/ui",
3
- "version": "2.76.1-beta-3d975b5-20250715",
4
- "description": "UI components library",
3
+ "version": "2.77.0-beta-90a741d-20250807",
4
+ "description": "UI components and utilities",
5
5
  "bugs": {
6
6
  "url": "https://github.com/foxford/ui/issues"
7
7
  },
@@ -12,10 +12,10 @@
12
12
  "license": "MIT",
13
13
  "author": "Foxford LLC",
14
14
  "contributors": [
15
- "Roman Olin <r.v.olin@foxford.ru>"
15
+ "Roman Olin <r.v.olin@foxford.ru>",
16
+ "Kostya Proshin <constantine.proshin@gmail.com>"
16
17
  ],
17
18
  "sideEffects": false,
18
- "scripts": {},
19
19
  "engines": {
20
20
  "node": ">=20",
21
21
  "npm": ">=6.x"
@@ -67,6 +67,6 @@
67
67
  "mixins",
68
68
  "shared",
69
69
  "theme"
70
- ]
71
- }
72
-
70
+ ],
71
+ "scripts": {}
72
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"sizeInput.js","sources":["../../../../src/shared/enums/sizeInput.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\nexport enum SizeInput {\n l = 380,\n m = 300,\n s = 220,\n xs = 140,\n}\n"],"names":["SizeInput"],"mappings":"gCACYA,IAAAA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,GAAA,KAAA,KAATA,IAAS,CAAA"}
1
+ {"version":3,"file":"sizeInput.js","sources":["../../../../src/shared/enums/sizeInput.ts"],"sourcesContent":["export enum SizeInput {\n l = 380,\n m = 300,\n s = 220,\n xs = 140,\n}\n"],"names":["SizeInput"],"mappings":"gCAAYA,IAAAA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,GAAA,KAAA,KAATA,IAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"sizeInput.mjs","sources":["../../../../src/shared/enums/sizeInput.ts"],"sourcesContent":["/* eslint-disable no-unused-vars */\nexport enum SizeInput {\n l = 380,\n m = 300,\n s = 220,\n xs = 140,\n}\n"],"names":["SizeInput"],"mappings":"AACYA,IAAAA,WAAAA,IAAAA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,GAAA,KAAA,KAATA,IAAS,CAAA"}
1
+ {"version":3,"file":"sizeInput.mjs","sources":["../../../../src/shared/enums/sizeInput.ts"],"sourcesContent":["export enum SizeInput {\n l = 380,\n m = 300,\n s = 220,\n xs = 140,\n}\n"],"names":["SizeInput"],"mappings":"AAAYA,IAAAA,WAAAA,IAAAA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,EAAA,KAAA,IAATA,EAAAA,EAAS,GAAA,KAAA,KAATA,IAAS,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"resize-observer.js","sources":["../../../src/shared/resize-observer.ts"],"sourcesContent":["import ResizeObserver from 'resize-observer-polyfill'\n\nexport const resizeObserver = Object.assign<\n ResizeObserver,\n {\n readonly symbol: symbol\n }\n>(\n new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n if (typeof entry.target[resizeObserver.symbol] === 'function') {\n entry.target[resizeObserver.symbol](entry.target)\n }\n })\n }),\n { symbol: Symbol('resize-handler') }\n)\n"],"names":["resizeObserver","Object","assign","ResizeObserver","entries","forEach","entry","target","symbol","Symbol"],"mappings":"qIAEO,MAAMA,eAAiBC,OAAOC,OAMnC,oCAAIC,UAAgBC,IAClBA,EAAQC,SAASC,WACJA,EAAMC,OAAOP,eAAeQ,SAAY,YACjDF,EAAMC,OAAOP,eAAeQ,QAAQF,EAAMC,OAC5C,GACA,IAEJ,CAAEC,OAAQC,OAAO"}
1
+ {"version":3,"file":"resize-observer.js","sources":["../../../src/shared/resize-observer.ts"],"sourcesContent":["import ResizeObserver from 'resize-observer-polyfill'\n\nexport const resizeObserver = Object.assign<\n ResizeObserver,\n {\n readonly symbol: symbol\n }\n>(\n new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (typeof entry.target[resizeObserver.symbol] === 'function') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n entry.target[resizeObserver.symbol](entry.target)\n }\n })\n }),\n { symbol: Symbol('resize-handler') }\n)\n"],"names":["resizeObserver","Object","assign","ResizeObserver","entries","forEach","entry","target","symbol","Symbol"],"mappings":"qIAEO,MAAMA,eAAiBC,OAAOC,OAMnC,oCAAIC,UAAgBC,IAClBA,EAAQC,SAASC,WAGJA,EAAMC,OAAOP,eAAeQ,SAAY,YAGjDF,EAAMC,OAAOP,eAAeQ,QAAQF,EAAMC,OAC5C,GACA,IAEJ,CAAEC,OAAQC,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"resize-observer.mjs","sources":["../../../src/shared/resize-observer.ts"],"sourcesContent":["import ResizeObserver from 'resize-observer-polyfill'\n\nexport const resizeObserver = Object.assign<\n ResizeObserver,\n {\n readonly symbol: symbol\n }\n>(\n new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n if (typeof entry.target[resizeObserver.symbol] === 'function') {\n entry.target[resizeObserver.symbol](entry.target)\n }\n })\n }),\n { symbol: Symbol('resize-handler') }\n)\n"],"names":["resizeObserver","Object","assign","ResizeObserver","entries","forEach","entry","target","symbol","Symbol"],"mappings":"qDAEO,MAAMA,eAAiBC,OAAOC,OAMnC,IAAIC,gBAAgBC,IAClBA,EAAQC,SAASC,WACJA,EAAMC,OAAOP,eAAeQ,SAAY,YACjDF,EAAMC,OAAOP,eAAeQ,QAAQF,EAAMC,OAC5C,GACA,IAEJ,CAAEC,OAAQC,OAAO"}
1
+ {"version":3,"file":"resize-observer.mjs","sources":["../../../src/shared/resize-observer.ts"],"sourcesContent":["import ResizeObserver from 'resize-observer-polyfill'\n\nexport const resizeObserver = Object.assign<\n ResizeObserver,\n {\n readonly symbol: symbol\n }\n>(\n new ResizeObserver((entries) => {\n entries.forEach((entry) => {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (typeof entry.target[resizeObserver.symbol] === 'function') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n entry.target[resizeObserver.symbol](entry.target)\n }\n })\n }),\n { symbol: Symbol('resize-handler') }\n)\n"],"names":["resizeObserver","Object","assign","ResizeObserver","entries","forEach","entry","target","symbol","Symbol"],"mappings":"qDAEO,MAAMA,eAAiBC,OAAOC,OAMnC,IAAIC,gBAAgBC,IAClBA,EAAQC,SAASC,WAGJA,EAAMC,OAAOP,eAAeQ,SAAY,YAGjDF,EAAMC,OAAOP,eAAeQ,QAAQF,EAAMC,OAC5C,GACA,IAEJ,CAAEC,OAAQC,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"colors.js","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd"],"mappings":"aAEA,MAAMA,qBAAuB,8CAWtB,CAAmBC,EAAaC,KACrC,IAAKF,qBAAqBG,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,gBASsBZ,GACbD,qBAAqBG,KAAKF"}
1
+ {"version":3,"file":"colors.js","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import type { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd"],"mappings":"aAEA,MAAMA,qBAAuB,8CAWtB,CAAmBC,EAAaC,KACrC,IAAKF,qBAAqBG,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,gBASsBZ,GACbD,qBAAqBG,KAAKF"}
@@ -1 +1 @@
1
- {"version":3,"file":"colors.mjs","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hexToRgbA","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd","isHex"],"mappings":"AAEA,MAAMA,qBAAuB,4BAWtB,SAASC,UAAUC,EAAaC,GACrC,IAAKH,qBAAqBI,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,CASO,SAASM,MAAMlB,GACpB,OAAOF,qBAAqBI,KAAKF,EACnC"}
1
+ {"version":3,"file":"colors.mjs","sources":["../../../../src/shared/utils/colors.ts"],"sourcesContent":["import type { RGB, RGBA } from 'shared/types'\n\nconst allowedHexColorCodes = /^#?([0-9a-fA-F]{3}){1,2}$/\nconst getHexCodePattern = (groupLength: number) => new RegExp(`([A-Fa-f0-9]){${groupLength}}`, 'g')\n\n/**\n * Converts HEX color code to RGB(A) string\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @param {Number} alpha channel which specifies the opacity of the color\n * @returns {RGB | RGBA} RGB(A) string\n */\nexport function hexToRgbA(hex: string, alpha?: number): RGB | RGBA {\n if (!allowedHexColorCodes.test(hex)) {\n throw new Error(`Provided HEX color code \"${hex}\" is incorrect`)\n }\n\n const codeGroupLength = Math.floor(hex.length / 3)\n const hexCodePattern = getHexCodePattern(codeGroupLength)\n const [r, g, b] = [...hex.matchAll(hexCodePattern)].map(([code]) => parseInt(code.padEnd(2, code), 16))\n\n if (typeof alpha === 'number') {\n return `rgba(${r}, ${g}, ${b}, ${alpha})`\n }\n\n return `rgb(${r}, ${g}, ${b})`\n}\n\n/**\n * Checks if value is HEX color\n *\n * @export\n * @param {string} HEX color with length of either 3 or 6 (can be with or without '#' sign)\n * @returns {boolean}\n */\nexport function isHex(hex: string): boolean {\n return allowedHexColorCodes.test(hex)\n}\n"],"names":["allowedHexColorCodes","hexToRgbA","hex","alpha","test","Error","codeGroupLength","Math","floor","length","hexCodePattern","RegExp","r","g","b","matchAll","map","code","parseInt","padEnd","isHex"],"mappings":"AAEA,MAAMA,qBAAuB,4BAWtB,SAASC,UAAUC,EAAaC,GACrC,IAAKH,qBAAqBI,KAAKF,GAC7B,MAAM,IAAIG,MAAM,4BAA4BH,mBAG9C,MAAMI,EAAkBC,KAAKC,MAAMN,EAAIO,OAAS,GAChD,MAAMC,EAhB2C,IAAIC,OAAO,iBAgBnBL,KAhBoD,KAiB7F,MAAOM,EAAGC,EAAGC,GAAK,IAAIZ,EAAIa,SAASL,IAAiBM,KAAI,EAAEC,KAAUC,SAASD,EAAKE,OAAO,EAAGF,GAAO,MAEnG,cAAWd,GAAU,SACZ,QAAQS,MAAMC,MAAMC,MAAMX,KAG5B,OAAOS,MAAMC,MAAMC,IAC5B,CASO,SAASM,MAAMlB,GACpB,OAAOF,qBAAqBI,KAAKF,EACnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import { keyboardKeys } from 'shared/constants'\nimport type { Nullable, DomTarget } from 'shared/types'\n\nexport const SELECTORS_KEYBOARD_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"], :disabled), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const SELECTORS_FOCUSABLE =\n 'a[href], button:not(:disabled), input:not(:disabled, [type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), area[href], iframe, object, summary, [tabindex]:not(:disabled), [contenteditable]:not([contenteditable=\"false\"])'\n\nexport const focusFirstFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n if (element.matches(selectors) && typeof element.focus === 'function') {\n element.focus()\n\n return true\n }\n\n const descendent = element.querySelector(selectors)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus()\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n const descendants = element.querySelectorAll(selectors)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus()\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n\nexport const createKeyboardNavigation = ({\n prevKey,\n nextKey,\n}: {\n prevKey: keyof typeof keyboardKeys\n nextKey: keyof typeof keyboardKeys\n}) => {\n return (\n key: React.KeyboardEvent['key'],\n active: HTMLElement,\n list: HTMLElement[],\n selectorsFocusable = SELECTORS_KEYBOARD_FOCUSABLE\n ) => {\n let idx = list.indexOf(active)\n\n if (idx === -1 || list.length === 0) {\n return\n }\n\n do {\n if (keyboardKeys[prevKey].validate(key)) {\n idx--\n } else if (keyboardKeys[nextKey].validate(key)) {\n idx++\n }\n\n if (idx < 0) {\n idx = list.length - 1\n } else if (idx > list.length - 1) {\n idx = 0\n }\n } while (!focusFirstFocusable(list[idx], selectorsFocusable))\n }\n}\n\nexport const navigateVerticalList = createKeyboardNavigation({\n prevKey: 'ArrowUp',\n nextKey: 'ArrowDown',\n})\n\nexport const navigateHorizontalList = createKeyboardNavigation({\n prevKey: 'ArrowLeft',\n nextKey: 'ArrowRight',\n})\n\nexport const getDomTargets = <T extends HTMLElement = HTMLElement>(target: DomTarget<T> | DomTarget<T>[]): T[] =>\n (Array.isArray(target) ? target : [target]).reduce<T[]>((acc, target) => {\n if (target instanceof HTMLElement) {\n if (target.isConnected) acc.push(target)\n } else if (target && target.current instanceof HTMLElement) {\n if (target.current.isConnected) acc.push(target.current)\n }\n\n return acc\n }, [])\n"],"names":["SELECTORS_KEYBOARD_FOCUSABLE","focusFirstFocusable","element","selectors","matches","focus","descendent","querySelector","HTMLElement","createKeyboardNavigation","prevKey","nextKey","key","active","list","selectorsFocusable","idx","indexOf","length","keyboardKeys","validate","navigateVerticalList","navigateHorizontalList","concatClassNames","classNames","reduce","acc","className","focusLastFocusable","descendants","querySelectorAll","lastDescendant","target","Array","isArray","isConnected","push","current"],"mappings":"sDAGO,MAAMA,6BACX,ybAKK,MAAMC,oBAAsBA,CAACC,EAAsBC,EAAYH,gCACpE,GAAIE,EAAQE,QAAQD,WAAqBD,EAAQG,OAAU,WAGzD,OAFAH,EAAQG,SAED,EAGT,MAAMC,EAAaJ,EAAQK,cAAcJ,GAEzC,OAAIG,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,SAEJ,EAGG,EAyBP,MAAMI,yBAA2BA,EACtCC,UACAC,aAKO,CACLC,EACAC,EACAC,EACAC,EAAqBf,gCAErB,IAAIgB,EAAMF,EAAKG,QAAQJ,GAEvB,GAAIG,KAAS,GAAKF,EAAKI,SAAW,EAIlC,GACMC,UAAYA,aAACT,GAASU,SAASR,GACjCI,IACSG,UAAAA,aAAaR,GAASS,SAASR,IACxCI,IAGEA,EAAM,EACRA,EAAMF,EAAKI,OAAS,EACXF,EAAMF,EAAKI,OAAS,IAC7BF,EAAM,UAEAf,oBAAoBa,EAAKE,GAAMD,GAAmB,EAInDM,MAAAA,qBAAuBZ,yBAAyB,CAC3DC,QAAS,UACTC,QAAS,cAGEW,MAAAA,uBAAyBb,yBAAyB,CAC7DC,QAAS,YACTC,QAAS,2CApFT,qUAiC8BY,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WACvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN,yIApB6BE,CAAC1B,EAAsBC,EAAYH,gCACnE,MAAM6B,EAAc3B,EAAQ4B,iBAAiB3B,GAC7C,MAAM4B,EAAiBF,EAAYA,EAAYX,OAAS,GAExD,OAAIa,aAA0BvB,oBAAsBuB,EAAe1B,OAAU,aAC3E0B,EAAe1B,SAER,EAGG,wBAyDqD2B,IAChEC,MAAMC,QAAQF,GAAUA,EAAS,CAACA,IAASP,QAAY,CAACC,EAAKM,KACxDA,aAAkBxB,YAChBwB,EAAOG,aAAaT,EAAIU,KAAKJ,GACxBA,GAAUA,EAAOK,mBAAmB7B,aACzCwB,EAAOK,QAAQF,aAAaT,EAAIU,KAAKJ,EAAOK,SAG3CX,IACN"}
1
+ {"version":3,"file":"dom.js","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import { keyboardKeys } from 'shared/constants'\nimport type { Nullable, DomTarget } from 'shared/types'\n\nexport const SELECTORS_KEYBOARD_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"], :disabled), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const SELECTORS_FOCUSABLE =\n 'a[href], button:not(:disabled), input:not(:disabled, [type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), area[href], iframe, object, summary, [tabindex]:not(:disabled), [contenteditable]:not([contenteditable=\"false\"])'\n\nexport const focusFirstFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n if (element.matches(selectors) && typeof element.focus === 'function') {\n element.focus()\n\n return true\n }\n\n const descendent = element.querySelector(selectors)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus()\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n const descendants = element.querySelectorAll(selectors)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus()\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n // eslint-disable-next-line no-param-reassign\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n\nexport const createKeyboardNavigation = ({\n prevKey,\n nextKey,\n}: {\n prevKey: keyof typeof keyboardKeys\n nextKey: keyof typeof keyboardKeys\n}) => {\n return (\n key: React.KeyboardEvent['key'],\n active: HTMLElement,\n list: HTMLElement[],\n selectorsFocusable = SELECTORS_KEYBOARD_FOCUSABLE\n ) => {\n let idx = list.indexOf(active)\n\n if (idx === -1 || list.length === 0) {\n return\n }\n\n do {\n if (keyboardKeys[prevKey].validate(key)) {\n idx--\n } else if (keyboardKeys[nextKey].validate(key)) {\n idx++\n }\n\n if (idx < 0) {\n idx = list.length - 1\n } else if (idx > list.length - 1) {\n idx = 0\n }\n } while (!focusFirstFocusable(list[idx], selectorsFocusable))\n }\n}\n\nexport const navigateVerticalList = createKeyboardNavigation({\n prevKey: 'ArrowUp',\n nextKey: 'ArrowDown',\n})\n\nexport const navigateHorizontalList = createKeyboardNavigation({\n prevKey: 'ArrowLeft',\n nextKey: 'ArrowRight',\n})\n\nexport const getDomTargets = <T extends HTMLElement = HTMLElement>(target: DomTarget<T> | DomTarget<T>[]): T[] =>\n (Array.isArray(target) ? target : [target]).reduce<T[]>((acc, item) => {\n if (item instanceof HTMLElement) {\n if (item.isConnected) acc.push(item)\n } else if (item && item.current instanceof HTMLElement) {\n if (item.current.isConnected) acc.push(item.current)\n }\n\n return acc\n }, [])\n"],"names":["SELECTORS_KEYBOARD_FOCUSABLE","focusFirstFocusable","element","selectors","matches","focus","descendent","querySelector","HTMLElement","createKeyboardNavigation","prevKey","nextKey","key","active","list","selectorsFocusable","idx","indexOf","length","keyboardKeys","validate","navigateVerticalList","navigateHorizontalList","concatClassNames","classNames","reduce","acc","className","focusLastFocusable","descendants","querySelectorAll","lastDescendant","target","Array","isArray","item","isConnected","push","current"],"mappings":"sDAGO,MAAMA,6BACX,ybAKK,MAAMC,oBAAsBA,CAACC,EAAsBC,EAAYH,gCACpE,GAAIE,EAAQE,QAAQD,WAAqBD,EAAQG,OAAU,WAGzD,OAFAH,EAAQG,SAED,EAGT,MAAMC,EAAaJ,EAAQK,cAAcJ,GAEzC,OAAIG,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,SAEJ,EAGG,EA0BP,MAAMI,yBAA2BA,EACtCC,UACAC,aAKO,CACLC,EACAC,EACAC,EACAC,EAAqBf,gCAErB,IAAIgB,EAAMF,EAAKG,QAAQJ,GAEvB,GAAIG,KAAS,GAAKF,EAAKI,SAAW,EAIlC,GACMC,UAAYA,aAACT,GAASU,SAASR,GACjCI,IACSG,UAAAA,aAAaR,GAASS,SAASR,IACxCI,IAGEA,EAAM,EACRA,EAAMF,EAAKI,OAAS,EACXF,EAAMF,EAAKI,OAAS,IAC7BF,EAAM,UAEAf,oBAAoBa,EAAKE,GAAMD,GAAmB,EAInDM,MAAAA,qBAAuBZ,yBAAyB,CAC3DC,QAAS,UACTC,QAAS,cAGEW,MAAAA,uBAAyBb,yBAAyB,CAC7DC,QAAS,YACTC,QAAS,2CArFT,qUAiC8BY,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WAEvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN,yIArB6BE,CAAC1B,EAAsBC,EAAYH,gCACnE,MAAM6B,EAAc3B,EAAQ4B,iBAAiB3B,GAC7C,MAAM4B,EAAiBF,EAAYA,EAAYX,OAAS,GAExD,OAAIa,aAA0BvB,oBAAsBuB,EAAe1B,OAAU,aAC3E0B,EAAe1B,SAER,EAGG,wBA0DqD2B,IAChEC,MAAMC,QAAQF,GAAUA,EAAS,CAACA,IAASP,QAAY,CAACC,EAAKS,KACxDA,aAAgB3B,YACd2B,EAAKC,aAAaV,EAAIW,KAAKF,GACtBA,GAAQA,EAAKG,mBAAmB9B,aACrC2B,EAAKG,QAAQF,aAAaV,EAAIW,KAAKF,EAAKG,SAGvCZ,IACN"}
@@ -1 +1 @@
1
- {"version":3,"file":"dom.mjs","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import { keyboardKeys } from 'shared/constants'\nimport type { Nullable, DomTarget } from 'shared/types'\n\nexport const SELECTORS_KEYBOARD_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"], :disabled), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const SELECTORS_FOCUSABLE =\n 'a[href], button:not(:disabled), input:not(:disabled, [type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), area[href], iframe, object, summary, [tabindex]:not(:disabled), [contenteditable]:not([contenteditable=\"false\"])'\n\nexport const focusFirstFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n if (element.matches(selectors) && typeof element.focus === 'function') {\n element.focus()\n\n return true\n }\n\n const descendent = element.querySelector(selectors)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus()\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n const descendants = element.querySelectorAll(selectors)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus()\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n\nexport const createKeyboardNavigation = ({\n prevKey,\n nextKey,\n}: {\n prevKey: keyof typeof keyboardKeys\n nextKey: keyof typeof keyboardKeys\n}) => {\n return (\n key: React.KeyboardEvent['key'],\n active: HTMLElement,\n list: HTMLElement[],\n selectorsFocusable = SELECTORS_KEYBOARD_FOCUSABLE\n ) => {\n let idx = list.indexOf(active)\n\n if (idx === -1 || list.length === 0) {\n return\n }\n\n do {\n if (keyboardKeys[prevKey].validate(key)) {\n idx--\n } else if (keyboardKeys[nextKey].validate(key)) {\n idx++\n }\n\n if (idx < 0) {\n idx = list.length - 1\n } else if (idx > list.length - 1) {\n idx = 0\n }\n } while (!focusFirstFocusable(list[idx], selectorsFocusable))\n }\n}\n\nexport const navigateVerticalList = createKeyboardNavigation({\n prevKey: 'ArrowUp',\n nextKey: 'ArrowDown',\n})\n\nexport const navigateHorizontalList = createKeyboardNavigation({\n prevKey: 'ArrowLeft',\n nextKey: 'ArrowRight',\n})\n\nexport const getDomTargets = <T extends HTMLElement = HTMLElement>(target: DomTarget<T> | DomTarget<T>[]): T[] =>\n (Array.isArray(target) ? target : [target]).reduce<T[]>((acc, target) => {\n if (target instanceof HTMLElement) {\n if (target.isConnected) acc.push(target)\n } else if (target && target.current instanceof HTMLElement) {\n if (target.current.isConnected) acc.push(target.current)\n }\n\n return acc\n }, [])\n"],"names":["SELECTORS_KEYBOARD_FOCUSABLE","SELECTORS_FOCUSABLE","focusFirstFocusable","element","selectors","matches","focus","descendent","querySelector","HTMLElement","focusLastFocusable","descendants","querySelectorAll","lastDescendant","length","concatClassNames","classNames","reduce","acc","className","createKeyboardNavigation","prevKey","nextKey","key","active","list","selectorsFocusable","idx","indexOf","keyboardKeys","validate","navigateVerticalList","navigateHorizontalList","getDomTargets","target","Array","isArray","isConnected","push","current"],"mappings":"2CAGO,MAAMA,6BACX,ybAEK,MAAMC,oBACX,0OAEK,MAAMC,oBAAsBA,CAACC,EAAsBC,EAAYJ,gCACpE,GAAIG,EAAQE,QAAQD,WAAqBD,EAAQG,OAAU,WAGzD,OAFAH,EAAQG,SAED,EAGT,MAAMC,EAAaJ,EAAQK,cAAcJ,GAEzC,OAAIG,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,SAEJ,EAGG,EAGP,MAAMI,mBAAqBA,CAACP,EAAsBC,EAAYJ,gCACnE,MAAMW,EAAcR,EAAQS,iBAAiBR,GAC7C,MAAMS,EAAiBF,EAAYA,EAAYG,OAAS,GAExD,OAAID,aAA0BJ,oBAAsBI,EAAeP,OAAU,aAC3EO,EAAeP,SAER,EAGG,EAGDS,MAAAA,iBAAmBA,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WACvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN,IAEE,MAAME,yBAA2BA,EACtCC,UACAC,aAKO,CACLC,EACAC,EACAC,EACAC,EAAqB1B,gCAErB,IAAI2B,EAAMF,EAAKG,QAAQJ,GAEvB,GAAIG,KAAS,GAAKF,EAAKX,SAAW,EAIlC,GACMe,aAAaR,GAASS,SAASP,GACjCI,IACSE,aAAaP,GAASQ,SAASP,IACxCI,IAGEA,EAAM,EACRA,EAAMF,EAAKX,OAAS,EACXa,EAAMF,EAAKX,OAAS,IAC7Ba,EAAM,UAEAzB,oBAAoBuB,EAAKE,GAAMD,GAAmB,EAInDK,MAAAA,qBAAuBX,yBAAyB,CAC3DC,QAAS,UACTC,QAAS,cAGEU,MAAAA,uBAAyBZ,yBAAyB,CAC7DC,QAAS,YACTC,QAAS,eAGJ,MAAMW,cAAsDC,IAChEC,MAAMC,QAAQF,GAAUA,EAAS,CAACA,IAASjB,QAAY,CAACC,EAAKgB,KACxDA,aAAkBzB,YAChByB,EAAOG,aAAanB,EAAIoB,KAAKJ,GACxBA,GAAUA,EAAOK,mBAAmB9B,aACzCyB,EAAOK,QAAQF,aAAanB,EAAIoB,KAAKJ,EAAOK,SAG3CrB,IACN"}
1
+ {"version":3,"file":"dom.mjs","sources":["../../../../src/shared/utils/dom.ts"],"sourcesContent":["import { keyboardKeys } from 'shared/constants'\nimport type { Nullable, DomTarget } from 'shared/types'\n\nexport const SELECTORS_KEYBOARD_FOCUSABLE =\n 'a[href]:not([tabindex^=\"-\"]), button:not(:disabled, [tabindex^=\"-\"]), input:not(:disabled, [type=\"hidden\"], [tabindex^=\"-\"]), select:not(:disabled, [tabindex^=\"-\"]), textarea:not(:disabled, [tabindex^=\"-\"]), area[href]:not([tabindex^=\"-\"]), iframe:not([tabindex^=\"-\"]), object:not([tabindex^=\"-\"]), summary:not([tabindex^=\"-\"]), [tabindex]:not([tabindex^=\"-\"], :disabled), [contenteditable]:not([contenteditable=\"false\"], [tabindex^=\"-\"])'\n\nexport const SELECTORS_FOCUSABLE =\n 'a[href], button:not(:disabled), input:not(:disabled, [type=\"hidden\"]), select:not(:disabled), textarea:not(:disabled), area[href], iframe, object, summary, [tabindex]:not(:disabled), [contenteditable]:not([contenteditable=\"false\"])'\n\nexport const focusFirstFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n if (element.matches(selectors) && typeof element.focus === 'function') {\n element.focus()\n\n return true\n }\n\n const descendent = element.querySelector(selectors)\n\n if (descendent instanceof HTMLElement && typeof descendent.focus === 'function') {\n descendent.focus()\n\n return true\n }\n\n return false\n}\n\nexport const focusLastFocusable = (element: HTMLElement, selectors = SELECTORS_KEYBOARD_FOCUSABLE): boolean => {\n const descendants = element.querySelectorAll(selectors)\n const lastDescendant = descendants[descendants.length - 1]\n\n if (lastDescendant instanceof HTMLElement && typeof lastDescendant.focus === 'function') {\n lastDescendant.focus()\n\n return true\n }\n\n return false\n}\n\nexport const concatClassNames = (...classNames: Nullable<unknown>[]): string =>\n classNames.reduce<string>((acc, className) => {\n if (typeof className === 'string') {\n // eslint-disable-next-line no-param-reassign\n acc = acc ? acc + ' ' + className : className\n }\n\n return acc\n }, '')\n\nexport const createKeyboardNavigation = ({\n prevKey,\n nextKey,\n}: {\n prevKey: keyof typeof keyboardKeys\n nextKey: keyof typeof keyboardKeys\n}) => {\n return (\n key: React.KeyboardEvent['key'],\n active: HTMLElement,\n list: HTMLElement[],\n selectorsFocusable = SELECTORS_KEYBOARD_FOCUSABLE\n ) => {\n let idx = list.indexOf(active)\n\n if (idx === -1 || list.length === 0) {\n return\n }\n\n do {\n if (keyboardKeys[prevKey].validate(key)) {\n idx--\n } else if (keyboardKeys[nextKey].validate(key)) {\n idx++\n }\n\n if (idx < 0) {\n idx = list.length - 1\n } else if (idx > list.length - 1) {\n idx = 0\n }\n } while (!focusFirstFocusable(list[idx], selectorsFocusable))\n }\n}\n\nexport const navigateVerticalList = createKeyboardNavigation({\n prevKey: 'ArrowUp',\n nextKey: 'ArrowDown',\n})\n\nexport const navigateHorizontalList = createKeyboardNavigation({\n prevKey: 'ArrowLeft',\n nextKey: 'ArrowRight',\n})\n\nexport const getDomTargets = <T extends HTMLElement = HTMLElement>(target: DomTarget<T> | DomTarget<T>[]): T[] =>\n (Array.isArray(target) ? target : [target]).reduce<T[]>((acc, item) => {\n if (item instanceof HTMLElement) {\n if (item.isConnected) acc.push(item)\n } else if (item && item.current instanceof HTMLElement) {\n if (item.current.isConnected) acc.push(item.current)\n }\n\n return acc\n }, [])\n"],"names":["SELECTORS_KEYBOARD_FOCUSABLE","SELECTORS_FOCUSABLE","focusFirstFocusable","element","selectors","matches","focus","descendent","querySelector","HTMLElement","focusLastFocusable","descendants","querySelectorAll","lastDescendant","length","concatClassNames","classNames","reduce","acc","className","createKeyboardNavigation","prevKey","nextKey","key","active","list","selectorsFocusable","idx","indexOf","keyboardKeys","validate","navigateVerticalList","navigateHorizontalList","getDomTargets","target","Array","isArray","item","isConnected","push","current"],"mappings":"2CAGO,MAAMA,6BACX,ybAEK,MAAMC,oBACX,0OAEK,MAAMC,oBAAsBA,CAACC,EAAsBC,EAAYJ,gCACpE,GAAIG,EAAQE,QAAQD,WAAqBD,EAAQG,OAAU,WAGzD,OAFAH,EAAQG,SAED,EAGT,MAAMC,EAAaJ,EAAQK,cAAcJ,GAEzC,OAAIG,aAAsBE,oBAAsBF,EAAWD,OAAU,aACnEC,EAAWD,SAEJ,EAGG,EAGP,MAAMI,mBAAqBA,CAACP,EAAsBC,EAAYJ,gCACnE,MAAMW,EAAcR,EAAQS,iBAAiBR,GAC7C,MAAMS,EAAiBF,EAAYA,EAAYG,OAAS,GAExD,OAAID,aAA0BJ,oBAAsBI,EAAeP,OAAU,aAC3EO,EAAeP,SAER,EAGG,EAGDS,MAAAA,iBAAmBA,IAAIC,IAClCA,EAAWC,QAAe,CAACC,EAAKC,YACnBA,GAAc,WAEvBD,EAAMA,EAAMA,EAAM,IAAMC,EAAYA,GAG/BD,IACN,IAEE,MAAME,yBAA2BA,EACtCC,UACAC,aAKO,CACLC,EACAC,EACAC,EACAC,EAAqB1B,gCAErB,IAAI2B,EAAMF,EAAKG,QAAQJ,GAEvB,GAAIG,KAAS,GAAKF,EAAKX,SAAW,EAIlC,GACMe,aAAaR,GAASS,SAASP,GACjCI,IACSE,aAAaP,GAASQ,SAASP,IACxCI,IAGEA,EAAM,EACRA,EAAMF,EAAKX,OAAS,EACXa,EAAMF,EAAKX,OAAS,IAC7Ba,EAAM,UAEAzB,oBAAoBuB,EAAKE,GAAMD,GAAmB,EAInDK,MAAAA,qBAAuBX,yBAAyB,CAC3DC,QAAS,UACTC,QAAS,cAGEU,MAAAA,uBAAyBZ,yBAAyB,CAC7DC,QAAS,YACTC,QAAS,eAGJ,MAAMW,cAAsDC,IAChEC,MAAMC,QAAQF,GAAUA,EAAS,CAACA,IAASjB,QAAY,CAACC,EAAKmB,KACxDA,aAAgB5B,YACd4B,EAAKC,aAAapB,EAAIqB,KAAKF,GACtBA,GAAQA,EAAKG,mBAAmB/B,aACrC4B,EAAKG,QAAQF,aAAapB,EAAIqB,KAAKF,EAAKG,SAGvCtB,IACN"}
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sources":["../../../../src/shared/utils/react.ts"],"sourcesContent":["import { Children, isValidElement, Fragment, cloneElement } from 'react'\n\nexport const removeFragments = (children: React.ReactNode, targetDepth = 1): React.ReactNode[] => {\n if (targetDepth <= 0) {\n return Children.toArray(children)\n }\n\n const func = (children: React.ReactNode, depth: number): React.ReactNode[] => {\n const iterable = Children.toArray(children).map((child, idx) =>\n isValidElement(child) ? cloneElement(child, { key: '.'.repeat(depth) + idx }) : child\n )\n\n if (depth >= targetDepth) {\n return iterable\n }\n\n return iterable.reduce<React.ReactNode[]>((acc, child) => {\n if (isValidElement(child) && child.type === Fragment) {\n if (child.props.children) {\n acc.push(...func(child.props.children, depth + 1))\n }\n } else {\n acc.push(child)\n }\n\n return acc\n }, [])\n }\n\n return func(children, 0)\n}\n"],"names":["removeFragments","children","targetDepth","Children","toArray","func","depth","iterable","map","child","idx","isValidElement","cloneElement","key","repeat","reduce","acc","type","Fragment","props","push"],"mappings":"gEAE+BA,CAACC,EAA2BC,EAAc,KACvE,GAAIA,GAAe,EACjB,OAAOC,MAAQA,SAACC,QAAQH,GAG1B,MAAMI,KAAOA,CAACJ,EAA2BK,KACvC,MAAMC,EAAWJ,MAAQA,SAACC,QAAQH,GAAUO,KAAI,CAACC,EAAOC,IACtDC,MAAcA,eAACF,GAASG,MAAAA,aAAaH,EAAO,CAAEI,IAAK,IAAIC,OAAOR,GAASI,IAASD,IAGlF,OAAIH,GAASJ,EACJK,EAGFA,EAASQ,QAA0B,CAACC,EAAKP,KAC1CE,MAAcA,eAACF,IAAUA,EAAMQ,OAASC,MAAAA,SACtCT,EAAMU,MAAMlB,UACde,EAAII,QAAQf,KAAKI,EAAMU,MAAMlB,SAAUK,EAAQ,IAGjDU,EAAII,KAAKX,GAGJO,IACN,GAAG,EAGR,OAAOX,KAAKJ,EAAU,EAAE"}
1
+ {"version":3,"file":"react.js","sources":["../../../../src/shared/utils/react.ts"],"sourcesContent":["import { Children, isValidElement, Fragment, cloneElement } from 'react'\n\nexport const removeFragments = (children: React.ReactNode, targetDepth = 1): React.ReactNode[] => {\n if (targetDepth <= 0) {\n return Children.toArray(children)\n }\n\n const func = (input: React.ReactNode, depth: number): React.ReactNode[] => {\n const iterable = Children.toArray(input).map((child, idx) =>\n isValidElement(child) ? cloneElement(child, { key: '.'.repeat(depth) + idx }) : child\n )\n\n if (depth >= targetDepth) {\n return iterable\n }\n\n return iterable.reduce<React.ReactNode[]>((acc, child) => {\n if (isValidElement(child) && child.type === Fragment) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n if (child.props.children) {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n acc.push(...func(child.props.children, depth + 1))\n }\n } else {\n acc.push(child)\n }\n\n return acc\n }, [])\n }\n\n return func(children, 0)\n}\n"],"names":["removeFragments","children","targetDepth","Children","toArray","func","input","depth","iterable","map","child","idx","isValidElement","cloneElement","key","repeat","reduce","acc","type","Fragment","props","push"],"mappings":"gEAE+BA,CAACC,EAA2BC,EAAc,KACvE,GAAIA,GAAe,EACjB,OAAOC,MAAQA,SAACC,QAAQH,GAG1B,MAAMI,KAAOA,CAACC,EAAwBC,KACpC,MAAMC,EAAWL,MAAQA,SAACC,QAAQE,GAAOG,KAAI,CAACC,EAAOC,IACnDC,MAAcA,eAACF,GAASG,MAAAA,aAAaH,EAAO,CAAEI,IAAK,IAAIC,OAAOR,GAASI,IAASD,IAGlF,OAAIH,GAASL,EACJM,EAGFA,EAASQ,QAA0B,CAACC,EAAKP,KAC1CE,MAAcA,eAACF,IAAUA,EAAMQ,OAASC,MAAAA,SAGtCT,EAAMU,MAAMnB,UAGdgB,EAAII,QAAQhB,KAAKK,EAAMU,MAAMnB,SAAUM,EAAQ,IAGjDU,EAAII,KAAKX,GAGJO,IACN,GAAG,EAGR,OAAOZ,KAAKJ,EAAU,EAAE"}