@uxf/ui 1.0.0-beta.9 → 1.0.0-beta.91

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 (388) hide show
  1. package/_private-utils/get-provider-config.d.ts +2 -0
  2. package/_private-utils/get-provider-config.js +12 -0
  3. package/avatar/avatar.d.ts +5 -0
  4. package/avatar/avatar.js +14 -0
  5. package/avatar/avatar.spec.d.ts +1 -0
  6. package/avatar/avatar.spec.js +9 -0
  7. package/avatar/avatar.stories.d.ts +7 -0
  8. package/avatar/avatar.stories.js +21 -0
  9. package/avatar/index.d.ts +1 -0
  10. package/avatar/index.js +17 -0
  11. package/avatar-file-input/avatar-file-input.d.ts +32 -0
  12. package/avatar-file-input/avatar-file-input.js +69 -0
  13. package/avatar-file-input/avatar-file-input.stories.d.ts +7 -0
  14. package/avatar-file-input/avatar-file-input.stories.js +30 -0
  15. package/avatar-file-input/index.d.ts +1 -0
  16. package/{storybook → avatar-file-input}/index.js +1 -2
  17. package/badge/badge.d.ts +7 -0
  18. package/badge/badge.js +15 -0
  19. package/badge/badge.stories.d.ts +7 -0
  20. package/badge/badge.stories.js +39 -0
  21. package/badge/index.d.ts +1 -0
  22. package/badge/index.js +17 -0
  23. package/badge/theme.d.ts +5 -0
  24. package/badge/theme.js +2 -0
  25. package/button/button.d.ts +13 -13
  26. package/button/button.js +16 -12
  27. package/button/button.stories.d.ts +9 -5
  28. package/button/button.stories.js +56 -18
  29. package/button/index.d.ts +1 -2
  30. package/button/index.js +1 -8
  31. package/button/theme.d.ts +5 -2
  32. package/button/theme.js +0 -1
  33. package/checkbox/checkbox.d.ts +12 -0
  34. package/checkbox/checkbox.js +18 -0
  35. package/checkbox/checkbox.spec.d.ts +1 -0
  36. package/checkbox/checkbox.spec.js +11 -0
  37. package/checkbox/checkbox.stories.d.ts +7 -0
  38. package/checkbox/checkbox.stories.js +44 -0
  39. package/checkbox/index.d.ts +1 -0
  40. package/checkbox/index.js +17 -0
  41. package/checkbox-button/checkbox-button.d.ts +8 -0
  42. package/checkbox-button/checkbox-button.js +18 -0
  43. package/checkbox-button/checkbox-button.spec.d.ts +1 -0
  44. package/checkbox-button/checkbox-button.spec.js +10 -0
  45. package/checkbox-button/checkbox-button.stories.d.ts +7 -0
  46. package/checkbox-button/checkbox-button.stories.js +57 -0
  47. package/checkbox-button/index.d.ts +1 -0
  48. package/checkbox-button/index.js +17 -0
  49. package/checkbox-visual/checkbox-visual.d.ts +9 -0
  50. package/checkbox-visual/checkbox-visual.js +17 -0
  51. package/checkbox-visual/checkbox-visual.stories.d.ts +7 -0
  52. package/checkbox-visual/checkbox-visual.stories.js +44 -0
  53. package/checkbox-visual/index.d.ts +1 -0
  54. package/checkbox-visual/index.js +17 -0
  55. package/checkbox-visual/theme.d.ts +4 -0
  56. package/checkbox-visual/theme.js +2 -0
  57. package/chip/chip.d.ts +10 -0
  58. package/chip/chip.js +19 -0
  59. package/chip/chip.stories.d.ts +14 -0
  60. package/chip/chip.stories.js +32 -0
  61. package/chip/index.d.ts +1 -0
  62. package/chip/index.js +17 -0
  63. package/chip/theme.d.ts +14 -0
  64. package/chip/theme.js +2 -0
  65. package/color-radio-group/color-radio-group.d.ts +18 -0
  66. package/color-radio-group/color-radio-group.js +47 -0
  67. package/color-radio-group/color-radio-group.stories.d.ts +7 -0
  68. package/color-radio-group/color-radio-group.stories.js +79 -0
  69. package/color-radio-group/color-radio.d.ts +8 -0
  70. package/color-radio-group/color-radio.js +22 -0
  71. package/color-radio-group/index.d.ts +1 -0
  72. package/color-radio-group/index.js +17 -0
  73. package/combobox/combobox.d.ts +24 -0
  74. package/combobox/combobox.js +61 -0
  75. package/combobox/combobox.stories.d.ts +9 -0
  76. package/combobox/combobox.stories.js +67 -0
  77. package/combobox/index.d.ts +1 -0
  78. package/combobox/index.js +17 -0
  79. package/config/icons-config.d.ts +2 -0
  80. package/config/icons-config.js +5 -0
  81. package/config/icons.d.ts +77 -0
  82. package/config/icons.js +20 -0
  83. package/content/content-schema.d.ts +3 -0
  84. package/content/content-schema.js +2 -0
  85. package/content/types.d.ts +27 -0
  86. package/content/types.js +2 -0
  87. package/context/context.d.ts +15 -0
  88. package/context/context.js +5 -0
  89. package/context/index.d.ts +3 -0
  90. package/context/index.js +19 -0
  91. package/context/provider.d.ts +8 -0
  92. package/context/provider.js +13 -0
  93. package/context/use-component-context.d.ts +3 -0
  94. package/context/use-component-context.js +13 -0
  95. package/css/avatar-file-input.css +7 -0
  96. package/css/avatar.css +15 -0
  97. package/css/badge.css +23 -0
  98. package/css/button.css +221 -0
  99. package/css/button.old.css +231 -0
  100. package/css/checkbox-button.css +98 -0
  101. package/css/checkbox.css +142 -0
  102. package/css/chip.css +171 -0
  103. package/css/chip.old.css +37 -0
  104. package/css/color-radio-group.css +21 -0
  105. package/css/color-radio.css +21 -0
  106. package/css/combobox.css +108 -0
  107. package/css/combobox.old.css +102 -0
  108. package/css/component-structure-analyzer.css +31 -0
  109. package/css/date-picker-input.css +133 -0
  110. package/css/date-picker.css +90 -0
  111. package/css/dropdown.css +24 -0
  112. package/css/dropdown.old.css +24 -0
  113. package/css/error-message.css +3 -0
  114. package/css/flash-messages.css +20 -0
  115. package/css/form-control.css +7 -0
  116. package/css/icon.css +7 -0
  117. package/css/input-basic.css +18 -0
  118. package/css/input.css +205 -0
  119. package/css/input.old.css +193 -0
  120. package/css/label.css +15 -0
  121. package/css/layout.css +47 -0
  122. package/css/list-item.css +29 -0
  123. package/css/pagination.css +28 -0
  124. package/css/radio-group.css +160 -0
  125. package/css/radio.css +105 -0
  126. package/css/raster-image.css +20 -0
  127. package/css/select.css +72 -0
  128. package/css/select.old.css +66 -0
  129. package/css/tabs.css +131 -0
  130. package/css/text-link.css +12 -0
  131. package/css/textarea.css +117 -0
  132. package/css/time-picker-input.css +136 -0
  133. package/css/time-picker.css +27 -0
  134. package/css/toggle.css +80 -0
  135. package/date-picker-input/date-picker-day.d.ts +8 -0
  136. package/date-picker-input/date-picker-day.js +63 -0
  137. package/date-picker-input/date-picker-decade.d.ts +6 -0
  138. package/date-picker-input/date-picker-decade.js +71 -0
  139. package/date-picker-input/date-picker-input.d.ts +21 -0
  140. package/date-picker-input/date-picker-input.js +88 -0
  141. package/date-picker-input/date-picker-input.stories.d.ts +14 -0
  142. package/date-picker-input/date-picker-input.stories.js +54 -0
  143. package/date-picker-input/date-picker-month.d.ts +7 -0
  144. package/date-picker-input/date-picker-month.js +66 -0
  145. package/date-picker-input/date-picker-provider.d.ts +8 -0
  146. package/date-picker-input/date-picker-provider.js +26 -0
  147. package/date-picker-input/date-picker-year.d.ts +7 -0
  148. package/date-picker-input/date-picker-year.js +74 -0
  149. package/date-picker-input/date-picker.d.ts +3 -0
  150. package/date-picker-input/date-picker.js +53 -0
  151. package/date-picker-input/index.d.ts +3 -0
  152. package/date-picker-input/index.js +19 -0
  153. package/date-picker-input/types.d.ts +5 -0
  154. package/date-picker-input/types.js +2 -0
  155. package/dropdown/dropdown.d.ts +11 -0
  156. package/dropdown/dropdown.js +27 -0
  157. package/dropdown/dropdown.stories.d.ts +10 -0
  158. package/dropdown/dropdown.stories.js +30 -0
  159. package/dropdown/index.d.ts +1 -0
  160. package/dropdown/index.js +17 -0
  161. package/error-message/error-message.d.ts +7 -0
  162. package/error-message/error-message.js +11 -0
  163. package/error-message/error-message.stories.d.ts +8 -0
  164. package/error-message/error-message.stories.js +17 -0
  165. package/error-message/index.d.ts +1 -0
  166. package/error-message/index.js +17 -0
  167. package/flash-messages/flash-message.d.ts +16 -0
  168. package/flash-messages/flash-message.js +46 -0
  169. package/flash-messages/flash-messages-service.d.ts +5 -0
  170. package/flash-messages/flash-messages-service.js +15 -0
  171. package/flash-messages/flash-messages.d.ts +8 -0
  172. package/flash-messages/flash-messages.js +55 -0
  173. package/flash-messages/flash-messages.stories.d.ts +7 -0
  174. package/flash-messages/flash-messages.stories.js +31 -0
  175. package/flash-messages/theme.d.ts +4 -0
  176. package/flash-messages/theme.js +2 -0
  177. package/form-control/form-control.d.ts +13 -0
  178. package/form-control/form-control.js +19 -0
  179. package/form-control/form-control.stories.d.ts +12 -0
  180. package/form-control/form-control.stories.js +25 -0
  181. package/form-control/index.d.ts +1 -0
  182. package/form-control/index.js +17 -0
  183. package/hooks/use-dropdown.d.ts +2 -0
  184. package/hooks/use-dropdown.js +30 -0
  185. package/hooks/use-input-submit.d.ts +4 -0
  186. package/hooks/use-input-submit.js +40 -0
  187. package/icon/icon.d.ts +17 -0
  188. package/icon/icon.js +38 -0
  189. package/icon/icon.stories.d.ts +18 -0
  190. package/icon/icon.stories.js +53 -0
  191. package/icon/index.d.ts +1 -0
  192. package/icon/index.js +17 -0
  193. package/icon/theme.d.ts +2 -0
  194. package/icon/theme.js +2 -0
  195. package/icon/types.d.ts +2 -0
  196. package/icon/types.js +2 -0
  197. package/image-gallery/components/close-button.d.ts +6 -0
  198. package/image-gallery/components/close-button.js +12 -0
  199. package/image-gallery/components/dot.d.ts +6 -0
  200. package/image-gallery/components/dot.js +12 -0
  201. package/image-gallery/components/gallery.d.ts +11 -0
  202. package/image-gallery/components/gallery.js +72 -0
  203. package/image-gallery/components/next-button.d.ts +6 -0
  204. package/image-gallery/components/next-button.js +12 -0
  205. package/image-gallery/components/previous-button.d.ts +6 -0
  206. package/image-gallery/components/previous-button.js +12 -0
  207. package/image-gallery/context.d.ts +10 -0
  208. package/image-gallery/context.js +12 -0
  209. package/image-gallery/image-gallery.d.ts +6 -0
  210. package/image-gallery/image-gallery.js +55 -0
  211. package/image-gallery/image-gallery.stories.d.ts +13 -0
  212. package/image-gallery/image-gallery.stories.js +27 -0
  213. package/image-gallery/image.d.ts +4 -0
  214. package/image-gallery/image.js +14 -0
  215. package/image-gallery/index.d.ts +4 -0
  216. package/image-gallery/index.js +26 -0
  217. package/image-gallery/types.d.ts +7 -0
  218. package/image-gallery/types.js +2 -0
  219. package/image-gallery/use-image.d.ts +2 -0
  220. package/image-gallery/use-image.js +16 -0
  221. package/input/index.d.ts +12 -0
  222. package/input/index.js +16 -0
  223. package/input/input-element.d.ts +21 -0
  224. package/input/input-element.js +11 -0
  225. package/input/input-left-addon.d.ts +9 -0
  226. package/input/input-left-addon.js +12 -0
  227. package/input/input-left-element.d.ts +9 -0
  228. package/input/input-left-element.js +12 -0
  229. package/input/input-right-addon.d.ts +8 -0
  230. package/input/input-right-addon.js +12 -0
  231. package/input/input-right-element.d.ts +9 -0
  232. package/input/input-right-element.js +12 -0
  233. package/input/input.d.ts +8 -0
  234. package/input/input.js +65 -0
  235. package/input/input.stories.d.ts +15 -0
  236. package/input/input.stories.js +93 -0
  237. package/input/theme.d.ts +8 -0
  238. package/input/theme.js +2 -0
  239. package/label/index.d.ts +1 -0
  240. package/label/index.js +17 -0
  241. package/label/label.d.ts +12 -0
  242. package/label/label.js +14 -0
  243. package/label/label.stories.d.ts +7 -0
  244. package/label/label.stories.js +17 -0
  245. package/layout/index.d.ts +1 -0
  246. package/layout/index.js +17 -0
  247. package/layout/layout.d.ts +9 -0
  248. package/layout/layout.js +60 -0
  249. package/layout/layout.stories.d.ts +8 -0
  250. package/layout/layout.stories.js +21 -0
  251. package/layout/uxf-logo.d.ts +6 -0
  252. package/layout/uxf-logo.js +13 -0
  253. package/list-item/index.d.ts +1 -0
  254. package/list-item/index.js +17 -0
  255. package/list-item/list-item.d.ts +8 -0
  256. package/list-item/list-item.js +24 -0
  257. package/list-item/list-item.stories.d.ts +7 -0
  258. package/list-item/list-item.stories.js +32 -0
  259. package/package.json +18 -36
  260. package/pagination/pagination.d.ts +7 -0
  261. package/pagination/pagination.js +49 -0
  262. package/pagination/pagination.stories.d.ts +7 -0
  263. package/pagination/pagination.stories.js +47 -0
  264. package/radio/index.d.ts +1 -0
  265. package/radio/index.js +17 -0
  266. package/radio/radio.d.ts +9 -0
  267. package/radio/radio.js +16 -0
  268. package/radio/radio.spec.d.ts +1 -0
  269. package/radio/radio.spec.js +10 -0
  270. package/radio/radio.stories.d.ts +7 -0
  271. package/radio/radio.stories.js +35 -0
  272. package/radio/theme.d.ts +4 -0
  273. package/radio/theme.js +2 -0
  274. package/radio-group/index.d.ts +1 -0
  275. package/radio-group/index.js +17 -0
  276. package/radio-group/radio-group.d.ts +24 -0
  277. package/radio-group/radio-group.js +49 -0
  278. package/radio-group/radio-group.spec.d.ts +1 -0
  279. package/radio-group/radio-group.spec.js +24 -0
  280. package/radio-group/radio-group.stories.d.ts +7 -0
  281. package/radio-group/radio-group.stories.js +58 -0
  282. package/radio-group/theme.d.ts +5 -0
  283. package/radio-group/theme.js +2 -0
  284. package/raster-image/index.d.ts +1 -0
  285. package/raster-image/index.js +17 -0
  286. package/raster-image/raster-image.d.ts +30 -0
  287. package/raster-image/raster-image.js +35 -0
  288. package/raster-image/raster-image.stories.d.ts +30 -0
  289. package/raster-image/raster-image.stories.js +17 -0
  290. package/scripts/generate-tw-tokens.js +94 -0
  291. package/select/index.d.ts +1 -0
  292. package/select/index.js +17 -0
  293. package/select/select.d.ts +24 -0
  294. package/select/select.js +58 -0
  295. package/select/select.stories.d.ts +9 -0
  296. package/select/select.stories.js +81 -0
  297. package/tabs/index.d.ts +1 -0
  298. package/tabs/index.js +17 -0
  299. package/tabs/tabs.d.ts +19 -0
  300. package/tabs/tabs.js +68 -0
  301. package/tabs/tabs.stories.d.ts +11 -0
  302. package/tabs/tabs.stories.js +48 -0
  303. package/text-input/index.d.ts +1 -0
  304. package/text-input/index.js +17 -0
  305. package/text-input/text-input.d.ts +31 -0
  306. package/text-input/text-input.js +57 -0
  307. package/text-input/text-input.spec.d.ts +1 -0
  308. package/text-input/text-input.spec.js +9 -0
  309. package/text-input/text-input.stories.d.ts +8 -0
  310. package/text-input/text-input.stories.js +56 -0
  311. package/text-link/index.d.ts +1 -0
  312. package/text-link/index.js +17 -0
  313. package/text-link/text-link.d.ts +5 -0
  314. package/text-link/text-link.js +19 -0
  315. package/text-link/text-link.stories.d.ts +7 -0
  316. package/text-link/text-link.stories.js +24 -0
  317. package/textarea/index.d.ts +1 -0
  318. package/textarea/index.js +17 -0
  319. package/textarea/textarea.d.ts +18 -0
  320. package/textarea/textarea.js +81 -0
  321. package/textarea/textarea.stories.d.ts +7 -0
  322. package/textarea/textarea.stories.js +44 -0
  323. package/time-picker-input/index.d.ts +2 -0
  324. package/time-picker-input/index.js +18 -0
  325. package/time-picker-input/time-picker-hour.d.ts +5 -0
  326. package/time-picker-input/time-picker-hour.js +47 -0
  327. package/time-picker-input/time-picker-hours.d.ts +2 -0
  328. package/time-picker-input/time-picker-hours.js +14 -0
  329. package/time-picker-input/time-picker-input.d.ts +22 -0
  330. package/time-picker-input/time-picker-input.js +89 -0
  331. package/time-picker-input/time-picker-input.stories.d.ts +7 -0
  332. package/time-picker-input/time-picker-input.stories.js +45 -0
  333. package/time-picker-input/time-picker-minute.d.ts +5 -0
  334. package/time-picker-input/time-picker-minute.js +47 -0
  335. package/time-picker-input/time-picker-minutes.d.ts +2 -0
  336. package/time-picker-input/time-picker-minutes.js +14 -0
  337. package/time-picker-input/time-picker.d.ts +8 -0
  338. package/time-picker-input/time-picker.js +69 -0
  339. package/toggle/index.d.ts +1 -0
  340. package/toggle/index.js +17 -0
  341. package/toggle/theme.d.ts +4 -0
  342. package/toggle/theme.js +2 -0
  343. package/toggle/toggle.d.ts +12 -0
  344. package/toggle/toggle.js +19 -0
  345. package/toggle/toggle.stories.d.ts +7 -0
  346. package/toggle/toggle.stories.js +52 -0
  347. package/tw-tokens/tw-box-shadow.d.ts +11 -0
  348. package/tw-tokens/tw-box-shadow.js +14 -0
  349. package/tw-tokens/tw-colors.d.ts +328 -0
  350. package/tw-tokens/tw-colors.js +331 -0
  351. package/tw-tokens/tw-containers.d.ts +8 -0
  352. package/tw-tokens/tw-containers.js +11 -0
  353. package/tw-tokens/tw-font-size.d.ts +42 -0
  354. package/tw-tokens/tw-font-size.js +19 -0
  355. package/tw-tokens/tw-font-weight.d.ts +12 -0
  356. package/tw-tokens/tw-font-weight.js +15 -0
  357. package/tw-tokens/tw-line-height.d.ts +17 -0
  358. package/tw-tokens/tw-line-height.js +20 -0
  359. package/tw-tokens/tw-screens.d.ts +8 -0
  360. package/tw-tokens/tw-screens.js +11 -0
  361. package/tw-tokens/tw-spacing.d.ts +39 -0
  362. package/tw-tokens/tw-spacing.js +42 -0
  363. package/tw-tokens/tw-z-index.d.ts +19 -0
  364. package/tw-tokens/tw-z-index.js +22 -0
  365. package/types/form-control-props.d.ts +24 -0
  366. package/types/form-control-props.js +2 -0
  367. package/types/index.d.ts +1 -0
  368. package/types/index.js +17 -0
  369. package/utils/action.d.ts +2 -0
  370. package/utils/action.js +11 -0
  371. package/utils/component-structure-analyzer.d.ts +6 -0
  372. package/utils/component-structure-analyzer.js +10 -0
  373. package/utils/icons-config.js +73 -0
  374. package/utils/image.d.ts +19 -0
  375. package/utils/image.js +104 -0
  376. package/utils/is-light-background.d.ts +2 -0
  377. package/utils/is-light-background.js +11 -0
  378. package/utils/snap-test.d.ts +2 -0
  379. package/utils/snap-test.js +17 -0
  380. package/utils/storybook-config.d.ts +26 -0
  381. package/{storybook → utils}/storybook-config.js +12 -6
  382. package/utils/tailwind-config.js +170 -0
  383. package/stories/button.stories.tsx +0 -87
  384. package/storybook/index.d.ts +0 -1
  385. package/storybook/storybook-config.d.ts +0 -21
  386. package/tailwindui/button.css +0 -51
  387. package/types.d.ts +0 -3
  388. package/types.js +0 -3
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Default = void 0;
27
+ const index_1 = require("./index");
28
+ const react_1 = __importStar(require("react"));
29
+ exports.default = {
30
+ title: "UI/RadioGroup",
31
+ component: index_1.RadioGroup,
32
+ };
33
+ const options = [
34
+ {
35
+ value: "1",
36
+ label: "Radio one",
37
+ },
38
+ {
39
+ value: "2",
40
+ label: "Radio two",
41
+ },
42
+ {
43
+ value: "3",
44
+ label: "Radio three-sixty",
45
+ },
46
+ ];
47
+ function Default() {
48
+ const [value, setValue] = (0, react_1.useState)(options[0].value);
49
+ const testRadioGroups = (react_1.default.createElement("div", { className: "space-y-10" },
50
+ react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Light Radio group", onChange: (v) => setValue(v), options: options, value: value }),
51
+ react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Radio group variant radio button", onChange: (v) => setValue(v), options: options, value: value, variant: "radioButton" }),
52
+ react_1.default.createElement(index_1.RadioGroup, { hiddenLabel: true, id: "radiogroup", label: "Radio group variant row with hidden label", onChange: (v) => setValue(v), options: options, value: value, variant: "row" }),
53
+ react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Radio group variant row, radioSize lg", onChange: (v) => setValue(v), options: options, value: value, variant: "row", radioSize: "lg" })));
54
+ return (react_1.default.createElement(react_1.default.Fragment, null,
55
+ react_1.default.createElement("div", { className: "light rounded bg-white p-8" }, testRadioGroups),
56
+ react_1.default.createElement("div", { className: "dark rounded bg-gray-900 p-8 text-white" }, testRadioGroups)));
57
+ }
58
+ exports.Default = Default;
@@ -0,0 +1,5 @@
1
+ export interface RadioGroupVariants {
2
+ list: true;
3
+ radioButton: true;
4
+ row: true;
5
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./raster-image";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./raster-image"), exports);
@@ -0,0 +1,30 @@
1
+ import { ImageSource, ResizerImageProps } from "@uxf/core/utils/resizer";
2
+ import { FC, ImgHTMLAttributes, ReactNode } from "react";
3
+ import { Quality } from "../utils/image";
4
+ declare type ImgProps = ImgHTMLAttributes<HTMLImageElement>;
5
+ declare type Props = {
6
+ alt: string;
7
+ breakpoints?: Record<string, string>;
8
+ className?: string;
9
+ heights?: number[];
10
+ imgClassName?: string;
11
+ loading?: ImgProps["loading"];
12
+ mode?: "contain" | "cover" | "responsive";
13
+ noImageContent?: ReactNode;
14
+ options?: Omit<ResizerImageProps, "quality" | "toFormat">;
15
+ quality?: Quality;
16
+ role?: ImgProps["role"];
17
+ src: ImageSource | null | undefined;
18
+ widths?: number[];
19
+ } & ({
20
+ width: number;
21
+ height: number;
22
+ } | {
23
+ width?: never;
24
+ height: number;
25
+ } | {
26
+ width: number;
27
+ height?: never;
28
+ });
29
+ export declare const RasterImage: FC<Props>;
30
+ export {};
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RasterImage = void 0;
7
+ const cx_1 = require("@uxf/core/utils/cx");
8
+ const resizer_1 = require("@uxf/core/utils/resizer");
9
+ const react_1 = __importDefault(require("react"));
10
+ const context_1 = require("../context");
11
+ const image_1 = require("../utils/image");
12
+ const RasterImage = (props) => {
13
+ var _a, _b, _c, _d, _e, _f, _g, _h;
14
+ const componentContext = (0, context_1.useComponentContext)("rasterImage");
15
+ const className = [
16
+ props.mode === "contain" && "uxf-raster-image--contain",
17
+ props.mode === "cover" && "uxf-raster-image--cover",
18
+ props.className,
19
+ ];
20
+ const breakpoints = ["0em", ...Object.values((_a = props.breakpoints) !== null && _a !== void 0 ? _a : componentContext.breakpoints)];
21
+ const resizerSrc = (0, resizer_1.resizerImageUrl)(props.src, (_b = props.width) !== null && _b !== void 0 ? _b : "auto", (_c = props.height) !== null && _c !== void 0 ? _c : "auto", {
22
+ ...((_d = props.options) !== null && _d !== void 0 ? _d : {}),
23
+ quality: (0, image_1.getImgQuality)(props.quality, "original"),
24
+ });
25
+ if (!resizerSrc) {
26
+ return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-raster-image uxf-raster-image--no-image", ...className) }, props.noImageContent));
27
+ }
28
+ return (react_1.default.createElement("picture", { className: (0, cx_1.cx)("uxf-raster-image", ...className) }, (_f = (_e = props.widths) === null || _e === void 0 ? void 0 : _e.map((w, i) => i < breakpoints.length && (react_1.default.createElement(image_1.ImgSources, { breakpointIndex: i, breakpoints: breakpoints, height: props.heights && props.heights[i]
29
+ ? props.heights[i]
30
+ : props.width && props.height
31
+ ? Math.ceil((props.height / props.width) * w)
32
+ : "auto", key: w, options: props.options, quality: props.quality, src: props.src, width: w }))).reverse()) !== null && _f !== void 0 ? _f : (react_1.default.createElement(image_1.ImgSources, { height: (_g = props.height) !== null && _g !== void 0 ? _g : "auto", options: props.options, quality: props.quality, src: props.src, width: (_h = props.width) !== null && _h !== void 0 ? _h : "auto" })),
33
+ react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)("uxf-raster-image__img", props.mode === "contain" && "uxf-raster-image__img--contain", props.mode === "cover" && "uxf-raster-image__img--cover", props.imgClassName), height: props.height, loading: props.loading, src: resizerSrc, width: props.width })));
34
+ };
35
+ exports.RasterImage = RasterImage;
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.FC<{
5
+ alt: string;
6
+ breakpoints?: Record<string, string> | undefined;
7
+ className?: string | undefined;
8
+ heights?: number[] | undefined;
9
+ imgClassName?: string | undefined;
10
+ loading?: "eager" | "lazy" | undefined;
11
+ mode?: "contain" | "cover" | "responsive" | undefined;
12
+ noImageContent?: React.ReactNode;
13
+ options?: Omit<import("@uxf/core/utils/resizer").ResizerImageProps, "quality" | "toFormat"> | undefined;
14
+ quality?: import("../utils/image").Quality | undefined;
15
+ role?: React.AriaRole | undefined;
16
+ src: import("@uxf/core/utils/resizer").ImageSource | null | undefined;
17
+ widths?: number[] | undefined;
18
+ } & ({
19
+ width: number;
20
+ height: number;
21
+ } | {
22
+ width?: undefined;
23
+ height: number;
24
+ } | {
25
+ width: number;
26
+ height?: undefined;
27
+ })>;
28
+ };
29
+ export default _default;
30
+ export declare function Default(): JSX.Element;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Default = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const index_1 = require("./index");
9
+ exports.default = {
10
+ title: "UI/RasterImage",
11
+ component: index_1.RasterImage,
12
+ };
13
+ function Default() {
14
+ return (react_1.default.createElement("div", { className: "space-y-2" },
15
+ react_1.default.createElement(index_1.RasterImage, { alt: "Alt text", height: 100, width: 300, mode: "cover", src: undefined })));
16
+ }
17
+ exports.Default = Default;
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const resolveConfig = require("tailwindcss/resolveConfig");
5
+ const prettier = require("prettier");
6
+ const path = require("path");
7
+
8
+ function camelToSnakeCase(str) {
9
+ return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
10
+ }
11
+
12
+ function capitalizeFirstLetter(str) {
13
+ return str.charAt(0).toUpperCase() + str.slice(1);
14
+ }
15
+
16
+ function resolveProperty(property, theme) {
17
+ const entry = theme[property];
18
+
19
+ if (typeof entry === "undefined") {
20
+ return;
21
+ }
22
+
23
+ const propertyValue = JSON.stringify(entry);
24
+ const propertyKey = capitalizeFirstLetter(property);
25
+
26
+ return `
27
+ // this file is generated automatically, do not change anything manually in the contents of this file
28
+
29
+ export const tw${propertyKey} = ${propertyValue};
30
+
31
+ export type Tw${propertyKey} = typeof tw${propertyKey};
32
+ `;
33
+ }
34
+
35
+ const TW_TOKENS = [
36
+ "boxShadow",
37
+ "colors",
38
+ "containers",
39
+ "fontSize",
40
+ "fontWeight",
41
+ "letterSpacings",
42
+ "lineHeight",
43
+ "screens",
44
+ "spacing",
45
+ "zIndex",
46
+ ];
47
+
48
+ let error = false;
49
+
50
+ try {
51
+ const mode = process.argv.filter((c) => c.includes("--mode="))[0]?.split("=")[1];
52
+ const twConfig = process.argv.filter((c) => c.includes("--twConfig="))[0]?.split("=")[1];
53
+ const outputPath = process.argv.filter((c) => c.includes("--outputPath="))[0]?.split("=")[1];
54
+
55
+ if (!twConfig) {
56
+ throw Error(`Provide valid path to tailwind config. Use "--twConfig" argument.`);
57
+ }
58
+
59
+ if (!outputPath) {
60
+ throw Error(`Provide valid output path to tailwind tokens. Use "--outputPath" argument.`);
61
+ }
62
+
63
+ const loadedTwConfig = resolveConfig(require(path.resolve(process.cwd(), twConfig)));
64
+
65
+ TW_TOKENS.forEach((property) => {
66
+ const result = resolveProperty(property, loadedTwConfig.theme) || "";
67
+
68
+ const filePath = path.resolve(process.cwd(), `${outputPath}tw-${camelToSnakeCase(property)}.ts`);
69
+
70
+ if (!result && mode !== "check" && fs.existsSync(filePath)) {
71
+ fs.rmSync(filePath);
72
+ }
73
+
74
+ const newContent = prettier.format(result, {
75
+ parser: "babel",
76
+ tabWidth: 4,
77
+ });
78
+
79
+ if (mode === "check") {
80
+ const oldContent = fs.existsSync(filePath) ? fs.readFileSync(filePath).toString() : "";
81
+
82
+ if (newContent !== oldContent) {
83
+ throw new Error("Generated tailwind tokens doesn't match with current tailwind config.");
84
+ }
85
+ } else if (newContent) {
86
+ fs.writeFileSync(filePath, newContent, "utf-8");
87
+ }
88
+ });
89
+ } catch (err) {
90
+ console.error(err.message);
91
+ error = true;
92
+ }
93
+
94
+ process.exit(error ? 1 : 0);
@@ -0,0 +1 @@
1
+ export * from "./select";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./select"), exports);
@@ -0,0 +1,24 @@
1
+ import type { Placement } from "@floating-ui/react-dom";
2
+ import React, { ReactNode } from "react";
3
+ import { IconsSet } from "../icon/theme";
4
+ import { FormControlProps } from "../types";
5
+ export declare type SelectValue = number | string;
6
+ export declare type SelectOption<T = SelectValue> = {
7
+ disabled?: boolean;
8
+ id: T;
9
+ label: ReactNode;
10
+ };
11
+ export interface SelectProps<Value = SelectValue, Option = SelectOption<Value>> extends FormControlProps<Value | null> {
12
+ className?: string;
13
+ dropdownPlacement?: Placement;
14
+ helperText?: ReactNode;
15
+ hiddenLabel?: boolean;
16
+ iconName?: keyof IconsSet;
17
+ id?: string;
18
+ keyExtractor?: (option: Option) => string | number;
19
+ label?: ReactNode;
20
+ options: Option[];
21
+ placeholder?: string;
22
+ renderOption?: (option: Option) => ReactNode;
23
+ }
24
+ export declare const Select: React.ForwardRefExoticComponent<SelectProps<SelectValue, SelectOption<SelectValue>> & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Select = void 0;
27
+ const react_1 = require("@headlessui/react");
28
+ const classes_1 = require("@uxf/core/constants/classes");
29
+ const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
30
+ const composeRefs_1 = require("@uxf/core/utils/composeRefs");
31
+ const cx_1 = require("@uxf/core/utils/cx");
32
+ const forwardRef_1 = require("@uxf/core/utils/forwardRef");
33
+ const react_2 = __importStar(require("react"));
34
+ const use_dropdown_1 = require("../hooks/use-dropdown");
35
+ const icon_1 = require("../icon");
36
+ const label_1 = require("../label");
37
+ exports.Select = (0, forwardRef_1.forwardRef)("Select", (props, ref) => {
38
+ var _a, _b, _c;
39
+ const generatedId = (0, react_2.useId)();
40
+ const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
41
+ const selectedOption = props.options.find((option) => option.id === props.value);
42
+ const innerRef = (0, react_2.useRef)(null);
43
+ const errorId = props.isInvalid ? `${id}--error-message` : undefined;
44
+ const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
45
+ const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", true);
46
+ const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
47
+ const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "chevronDown";
48
+ return (react_2.default.createElement(react_1.Listbox, { as: "div", className: (0, cx_1.cx)("uxf-select", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), onChange: (v) => { var _a; return (_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, v.id); }, value: selectedOption, disabled: props.isDisabled || props.isReadOnly }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
49
+ react_2.default.createElement(react_1.Listbox.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label),
50
+ react_2.default.createElement(react_1.Listbox.Button, { as: "div", className: (0, cx_1.cx)("uxf-select__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && "is-open--bottom", dropdown.placement === "top" && "is-open--top", renderProps.open && "is-open"), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef, "aria-invalid": props.isInvalid, "aria-describedby": errorId },
51
+ react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-select__button-text", !(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) && "is-empty") }, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || props.placeholder),
52
+ react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select__button-icon", renderProps.open && "is-open"), name: iconName })),
53
+ react_2.default.createElement(react_1.Listbox.Options, { ref: dropdown.floating, className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top") }, props.options.map((option) => {
54
+ var _a, _b, _c, _d;
55
+ return (react_2.default.createElement(react_1.Listbox.Option, { key: (_b = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.id, value: option, className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED) }, (_d = (_c = props.renderOption) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.label));
56
+ })),
57
+ props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText))))));
58
+ });
@@ -0,0 +1,9 @@
1
+ import { SelectValue } from "./select";
2
+ import React from "react";
3
+ declare const _default: {
4
+ title: string;
5
+ component: React.ForwardRefExoticComponent<import("./select").SelectProps<SelectValue, import("./select").SelectOption<SelectValue>> & React.RefAttributes<HTMLDivElement>>;
6
+ };
7
+ export default _default;
8
+ export declare function Default(): JSX.Element;
9
+ export declare function ComponentStructure(): JSX.Element;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ComponentStructure = exports.Default = void 0;
30
+ const index_1 = require("./index");
31
+ const react_1 = __importStar(require("react"));
32
+ const component_structure_analyzer_1 = __importDefault(require("../utils/component-structure-analyzer"));
33
+ exports.default = {
34
+ title: "UI/Select",
35
+ component: index_1.Select,
36
+ };
37
+ const options = [
38
+ { id: "one", label: "Option one" },
39
+ { id: "two", label: "Option two" },
40
+ { id: "three", label: "Option three" },
41
+ { id: "three", label: "Option three" },
42
+ { id: "three", label: "Option three" },
43
+ { id: "three", label: "Option three" },
44
+ { id: "three", label: "Option three" },
45
+ { id: "three", label: "Option three" },
46
+ { id: "three", label: "Option three" },
47
+ { id: "three", label: "Option three" },
48
+ { id: "three", label: "Option three" },
49
+ { id: "three", label: "Option three" },
50
+ ];
51
+ function Default() {
52
+ const [value, setValue] = (0, react_1.useState)();
53
+ const handleChange = (v) => {
54
+ // eslint-disable-next-line no-console
55
+ console.log("Select value: ", v);
56
+ setValue(v);
57
+ };
58
+ const storySelects = (react_1.default.createElement(react_1.default.Fragment, null,
59
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text", label: "Default select", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
60
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text", isInvalid: true, label: "Invalid select", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
61
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text", isDisabled: true, label: "Disabled select", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
62
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text", isReadOnly: true, label: "Read only select", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
63
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text", isRequired: true, label: "Required select", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
64
+ react_1.default.createElement(index_1.Select, { dropdownPlacement: "top", isRequired: true, label: "Select with dropdown top", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value }),
65
+ react_1.default.createElement(index_1.Select, { helperText: "Helper text of Select with hidden label", hiddenLabel: true, label: "Hidden label", onChange: handleChange, options: options, placeholder: "Vyberte ..", value: value })));
66
+ return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
67
+ react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storySelects),
68
+ react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20 lg:w-1/2" }, storySelects)));
69
+ }
70
+ exports.Default = Default;
71
+ function ComponentStructure() {
72
+ const [value, setValue] = (0, react_1.useState)(null);
73
+ const handleChange = (v) => {
74
+ // eslint-disable-next-line no-console
75
+ console.log("Select value: ", v);
76
+ setValue(v);
77
+ };
78
+ return (react_1.default.createElement(component_structure_analyzer_1.default, null,
79
+ react_1.default.createElement(index_1.Select, { id: "select-1", name: "select", label: "Choose option...", options: options, onChange: handleChange, value: value })));
80
+ }
81
+ exports.ComponentStructure = ComponentStructure;
@@ -0,0 +1 @@
1
+ export * from "./tabs";
package/tabs/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./tabs"), exports);
package/tabs/tabs.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import React, { ReactNode } from "react";
2
+ export interface TabsPanelProps {
3
+ className?: string;
4
+ disabled?: boolean;
5
+ title: ReactNode;
6
+ }
7
+ export interface TabsProps {
8
+ className?: string;
9
+ defaultIndex?: number;
10
+ grow?: boolean;
11
+ onChange?: (index: number) => void;
12
+ tabListClassName?: string;
13
+ variant?: "default" | "segmented";
14
+ }
15
+ export declare const Tabs: React.ForwardRefExoticComponent<TabsProps & {
16
+ children?: React.ReactNode;
17
+ } & React.RefAttributes<HTMLDivElement>> & {
18
+ Panel: React.FC<React.PropsWithChildren<TabsPanelProps>>;
19
+ };
package/tabs/tabs.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Tabs = void 0;
27
+ const react_1 = require("@headlessui/react");
28
+ const classes_1 = require("@uxf/core/constants/classes");
29
+ const useMouseDragToScroll_1 = require("@uxf/core/hooks/useMouseDragToScroll");
30
+ const cx_1 = require("@uxf/core/utils/cx");
31
+ const forwardRef_1 = require("@uxf/core/utils/forwardRef");
32
+ const react_2 = __importStar(require("react"));
33
+ const Panel = (props) => react_2.default.createElement("div", { className: props.className }, props.children);
34
+ const TabsRoot = (0, forwardRef_1.forwardRef)("Tabs", (props, ref) => {
35
+ var _a, _b;
36
+ const tabsClassName = (0, cx_1.cx)("uxf-tabs", props.grow && "uxf-tabs--grow", props.className);
37
+ const containerRef = (0, react_2.useRef)(null);
38
+ const dragStyle = (0, useMouseDragToScroll_1.useMouseDragToScroll)(containerRef);
39
+ const [hasOverflow, setHasOverflow] = (0, react_2.useState)();
40
+ (0, react_2.useEffect)(() => {
41
+ const node = containerRef.current;
42
+ if (!node) {
43
+ return;
44
+ }
45
+ const handler = () => setHasOverflow(node.scrollWidth > node.clientWidth);
46
+ handler();
47
+ window.addEventListener("resize", handler);
48
+ return () => {
49
+ window.removeEventListener("resize", handler);
50
+ };
51
+ }, []);
52
+ if (react_2.Children.count(props.children) === 0) {
53
+ return react_2.default.createElement("div", { className: tabsClassName, ref: ref });
54
+ }
55
+ const tabPanels = react_2.Children.toArray(props.children).filter((child) => (0, react_2.isValidElement)(child) && child.props.title);
56
+ const tabs = tabPanels.map((c) => ({
57
+ title: c.props.title,
58
+ disabled: c.props.disabled,
59
+ }));
60
+ return (react_2.default.createElement(react_1.Tab.Group, { as: "div", className: tabsClassName, defaultIndex: props.defaultIndex, onChange: props.onChange, ref: ref },
61
+ react_2.default.createElement(react_1.Tab.List, { className: (0, cx_1.cx)("uxf-tabs__tab-list__wrapper", `uxf-tabs__tab-list__wrapper--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`, props.tabListClassName) },
62
+ react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-tabs__tab-list", `uxf-tabs__tab-list--${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`), ref: containerRef, style: { justifyContent: hasOverflow ? "flex-start" : undefined, ...dragStyle } }, tabs.map((tab, index) => (react_2.default.createElement(react_1.Tab, { disabled: tab.disabled, className: ({ selected }) => {
63
+ var _a;
64
+ return (0, cx_1.cx)("uxf-tabs__tab", selected && classes_1.CLASSES.IS_ACTIVE, tab.disabled && classes_1.CLASSES.IS_DISABLED, `uxf-tabs__tab--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`);
65
+ }, key: `${tab.title}--${index}` }, tab.title))))),
66
+ react_2.default.createElement(react_1.Tab.Panels, { className: "uxf-tabs__panels" }, tabPanels.map((tab, index) => (react_2.default.createElement(react_1.Tab.Panel, { className: "outline-none", key: `${tab}--${index}` }, tab))))));
67
+ });
68
+ exports.Tabs = Object.assign(TabsRoot, { Panel });
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ declare const _default: {
3
+ title: string;
4
+ component: React.ForwardRefExoticComponent<import("./tabs").TabsProps & {
5
+ children?: React.ReactNode;
6
+ } & React.RefAttributes<HTMLDivElement>> & {
7
+ Panel: React.FC<React.PropsWithChildren<import("./tabs").TabsPanelProps>>;
8
+ };
9
+ };
10
+ export default _default;
11
+ export declare function Default(): JSX.Element;