@koine/react 1.0.9 → 1.0.12

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 (359) hide show
  1. package/Alert/Alert.js +7 -13
  2. package/Animations/Reveal.js +12 -10
  3. package/Animations/Underline.js +3 -13
  4. package/Animations/useReveal.js +18 -17
  5. package/Autocomplete/AutocompleteDownshift.js +1 -1
  6. package/Autocomplete/AutocompleteDownshiftMultiselect.js +1 -1
  7. package/Autocomplete/AutocompleteMui.js +61 -56
  8. package/Autocomplete/AutocompleteReach.js +1 -1
  9. package/Autocomplete/components.js +17 -72
  10. package/Autocomplete/helpers.js +1 -1
  11. package/Bg/BgColor.js +14 -24
  12. package/Bg/BgPhoto.js +11 -54
  13. package/Bg/BgSvg.js +6 -9
  14. package/Breadcrumbs/Breadcrumbs.js +14 -54
  15. package/Buttons/Button.js +8 -73
  16. package/Buttons/ButtonComposite.js +20 -41
  17. package/Buttons/ButtonFab.js +4 -6
  18. package/Buttons/ButtonLink.js +7 -6
  19. package/Buttons/IconButton.js +5 -17
  20. package/Calendar/CalendarDaygridCell.js +20 -14
  21. package/Calendar/CalendarDaygridNav.js +10 -9
  22. package/Calendar/CalendarDaygridTable.js +32 -30
  23. package/Calendar/CalendarLegend.js +7 -2
  24. package/Calendar/calendar-api-google.js +101 -68
  25. package/Calendar/useCalendar.js +114 -113
  26. package/Calendar/utils.js +73 -74
  27. package/Carousel/Carousel.js +1 -1
  28. package/Carousel/CarouselCss.js +14 -27
  29. package/Collapsable/Collapsable.d.ts +1 -1
  30. package/Collapsable/Collapsable.js +1 -1
  31. package/Collapsable/CollapsableReach.d.ts +4 -64
  32. package/Collapsable/CollapsableReach.js +247 -129
  33. package/Collapsable/index.d.ts +1 -1
  34. package/Collapsable/index.js +2 -1
  35. package/Debug/Debug.js +5 -17
  36. package/Details/Details.d.ts +114 -0
  37. package/Details/Details.js +65 -0
  38. package/Details/index.d.ts +1 -0
  39. package/Details/index.js +1 -0
  40. package/{Forms/Form → Details}/package.json +1 -1
  41. package/Dialog/DialogMui.d.ts +1 -1
  42. package/Dialog/DialogMui.js +22 -20
  43. package/Dialog/css/bare.js +17 -15
  44. package/Dialog/m/bare.js +17 -13
  45. package/Dialog/m/basic.js +2 -2
  46. package/Dialog/m/index.js +4 -4
  47. package/Dialog/sc/bare.js +25 -43
  48. package/Dialog/sc/framer.js +6 -6
  49. package/Dialog/sc/framerMaterial.js +6 -6
  50. package/Dialog/sc/material.js +17 -37
  51. package/Dialog/tw/bare.js +25 -19
  52. package/Dialog/tw/elegant.js +17 -15
  53. package/Dialog/tw/framer.js +6 -6
  54. package/Dialog/tw/framerMaterial.js +6 -6
  55. package/Dialog/tw/material.js +17 -15
  56. package/Editor/Editor--tiptap.js +14 -11
  57. package/Editor/components.js +6 -24
  58. package/Favicon/FaviconTags.js +2 -1
  59. package/Form/Form.d.ts +111 -0
  60. package/Form/Form.js +61 -0
  61. package/{Forms/Form → Form}/index.d.ts +0 -0
  62. package/{Forms/Form → Form}/index.js +0 -0
  63. package/Form/package.json +6 -0
  64. package/Form/sc/bare.d.ts +33 -0
  65. package/Form/sc/bare.js +20 -0
  66. package/Forms/Checkbox/Checkbox.js +9 -15
  67. package/Forms/Feedback/Feedback.js +6 -7
  68. package/Forms/Field/Field.js +15 -26
  69. package/Forms/Field/FieldControl.js +19 -15
  70. package/Forms/Field/FieldHint.js +3 -5
  71. package/Forms/Input/Input.js +10 -16
  72. package/Forms/InputGroup/InputGroup.js +9 -36
  73. package/Forms/Label/Label.js +5 -23
  74. package/Forms/Password/Password.js +10 -23
  75. package/Forms/Radio/Radio.js +15 -18
  76. package/Forms/Switch/Switch.js +9 -39
  77. package/Forms/Textarea/Textarea.js +6 -7
  78. package/Forms/Textarea/TextareaRich.js +10 -24
  79. package/Forms/Toggle/Toggle.js +21 -68
  80. package/Forms/Toggle/useToggle.js +29 -29
  81. package/Forms/antispam.js +12 -12
  82. package/Forms/helpers.js +8 -7
  83. package/Forms/index.d.ts +0 -1
  84. package/Forms/index.js +0 -1
  85. package/Forms/styles.js +12 -43
  86. package/Gauge/Gauge.js +1 -1
  87. package/Grid/Grid.js +25 -51
  88. package/Hamburger/Hamburger.js +35 -47
  89. package/Header/useHeader.js +12 -12
  90. package/Hidden/Hidden.js +9 -13
  91. package/Img/sc/bare.js +3 -1
  92. package/Link/Link.js +3 -1
  93. package/Link/LinkBlank.js +8 -17
  94. package/Menu/Menu.js +3 -10
  95. package/MenuItem/MenuItem.js +3 -19
  96. package/Meta/Meta.js +3 -2
  97. package/NoJs/NoJs.js +2 -2
  98. package/Pagination/PaginationNav.js +26 -48
  99. package/Pagination/PaginationResults.js +7 -6
  100. package/Pill/Pill.js +6 -36
  101. package/Progress/ProgressCircular.js +9 -30
  102. package/Progress/ProgressLinear.js +8 -16
  103. package/Progress/ProgressOverlay.js +11 -27
  104. package/Rating/Rating.js +26 -45
  105. package/Rating/index.js +19 -15
  106. package/Select/SelectDownshift.js +1 -1
  107. package/Select/components.js +6 -12
  108. package/Sidebar/Sidebar.js +13 -38
  109. package/Spacing/Spacing.js +12 -12
  110. package/Sticky/Sticky.js +1 -1
  111. package/Sticky/StickyCss.js +4 -2
  112. package/Tabs/TabsMui.d.ts +244 -0
  113. package/Tabs/TabsMui.js +46 -0
  114. package/Tabs/index.d.ts +1 -1
  115. package/Tabs/index.js +1 -1
  116. package/Tabs/sc/bare.d.ts +5 -0
  117. package/Tabs/sc/bare.js +87 -0
  118. package/Tabs/tw/bare.d.ts +248 -0
  119. package/Tabs/tw/bare.js +17 -0
  120. package/Tabs/tw/material.d.ts +472 -0
  121. package/Tabs/tw/material.js +18 -0
  122. package/Tabs/useTabs.d.ts +43 -0
  123. package/Tabs/useTabs.js +44 -0
  124. package/Typography/CopyPasteVisible.js +3 -5
  125. package/Typography/Native.js +12 -45
  126. package/Typography/ReadMore.js +26 -52
  127. package/Typography/TextLoop.js +19 -22
  128. package/Typography/TypeStairs.js +20 -16
  129. package/css/index.js +1 -0
  130. package/helpers/classed.js +22 -18
  131. package/helpers/extend-component.js +6 -6
  132. package/hooks/index.d.ts +8 -0
  133. package/hooks/index.js +8 -0
  134. package/hooks/types.d.ts +8 -0
  135. package/hooks/types.js +1 -0
  136. package/hooks/useAsyncFn.d.ts +26 -0
  137. package/hooks/useAsyncFn.js +36 -0
  138. package/hooks/useDateLocale.js +22 -13
  139. package/hooks/useEffectOnce.d.ts +5 -0
  140. package/hooks/useEffectOnce.js +8 -0
  141. package/hooks/useFirstMountState.d.ts +4 -0
  142. package/hooks/useFirstMountState.js +12 -0
  143. package/hooks/useFocus.js +3 -3
  144. package/hooks/useId.d.ts +4 -0
  145. package/hooks/useId.js +8 -0
  146. package/hooks/useIsomorphicLayoutEffect.d.ts +5 -0
  147. package/hooks/useIsomorphicLayoutEffect.js +8 -0
  148. package/hooks/useMount.d.ts +4 -0
  149. package/hooks/useMount.js +9 -0
  150. package/hooks/useMountedState.d.ts +4 -0
  151. package/hooks/useMountedState.js +15 -0
  152. package/hooks/usePrevious.js +2 -2
  153. package/hooks/useScrollPosition.js +21 -16
  154. package/hooks/useScrollTo.js +7 -5
  155. package/hooks/useTraceUpdate.js +4 -3
  156. package/hooks/useUpdateEffect.d.ts +5 -0
  157. package/hooks/useUpdateEffect.js +14 -0
  158. package/hooks/useWindowSize.js +3 -3
  159. package/m/MotionProvider.js +4 -2
  160. package/node/Alert/Alert.js +9 -16
  161. package/node/Alert/index.js +1 -1
  162. package/node/Animations/Reveal.js +15 -13
  163. package/node/Animations/Underline.js +5 -16
  164. package/node/Animations/index.js +1 -1
  165. package/node/Animations/useReveal.js +19 -18
  166. package/node/Autocomplete/AutocompleteMui.js +69 -64
  167. package/node/Autocomplete/components.js +26 -82
  168. package/node/Autocomplete/helpers.js +2 -2
  169. package/node/Bg/BgColor.js +18 -29
  170. package/node/Bg/BgPhoto.js +15 -59
  171. package/node/Bg/BgSvg.js +8 -12
  172. package/node/Bg/index.js +1 -1
  173. package/node/Breadcrumbs/Breadcrumbs.js +20 -61
  174. package/node/Breadcrumbs/index.js +1 -1
  175. package/node/Buttons/Button.js +10 -76
  176. package/node/Buttons/ButtonComposite.js +23 -45
  177. package/node/Buttons/ButtonFab.js +6 -9
  178. package/node/Buttons/ButtonLink.js +10 -10
  179. package/node/Buttons/IconButton.js +7 -20
  180. package/node/Buttons/index.js +1 -1
  181. package/node/Calendar/CalendarDaygridCell.js +24 -18
  182. package/node/Calendar/CalendarDaygridNav.js +14 -13
  183. package/node/Calendar/CalendarDaygridTable.js +39 -38
  184. package/node/Calendar/CalendarLegend.js +8 -3
  185. package/node/Calendar/calendar-api-google.js +105 -73
  186. package/node/Calendar/index.js +1 -1
  187. package/node/Calendar/useCalendar.js +117 -116
  188. package/node/Calendar/utils.js +82 -84
  189. package/node/Carousel/CarouselCss.js +17 -31
  190. package/node/Carousel/index.js +1 -1
  191. package/node/Collapsable/Collapsable.js +2 -2
  192. package/node/Collapsable/CollapsableReach.js +246 -134
  193. package/node/Collapsable/index.js +3 -2
  194. package/node/Debug/Debug.js +7 -20
  195. package/node/Debug/index.js +1 -1
  196. package/node/Details/Details.js +67 -0
  197. package/node/Details/index.js +4 -0
  198. package/node/Dialog/DialogMui.js +12 -11
  199. package/node/Dialog/css/bare.js +11 -10
  200. package/node/Dialog/m/bare.js +18 -14
  201. package/node/Dialog/m/basic.js +1 -1
  202. package/node/Dialog/m/index.js +4 -4
  203. package/node/Dialog/sc/bare.js +22 -41
  204. package/node/Dialog/sc/framer.js +5 -5
  205. package/node/Dialog/sc/framerMaterial.js +5 -5
  206. package/node/Dialog/sc/material.js +12 -33
  207. package/node/Dialog/tw/bare.js +19 -14
  208. package/node/Dialog/tw/elegant.js +11 -9
  209. package/node/Dialog/tw/framer.js +5 -5
  210. package/node/Dialog/tw/framerMaterial.js +5 -5
  211. package/node/Dialog/tw/material.js +11 -9
  212. package/node/Editor/Editor--tiptap.js +19 -17
  213. package/node/Editor/components.js +9 -28
  214. package/node/Editor/index.js +1 -1
  215. package/node/Favicon/FaviconTags.js +3 -2
  216. package/node/Favicon/index.js +1 -1
  217. package/node/Form/Form.js +65 -0
  218. package/node/{Forms/Form → Form}/index.js +1 -1
  219. package/node/Form/sc/bare.js +23 -0
  220. package/node/Forms/Checkbox/Checkbox.js +13 -20
  221. package/node/Forms/Checkbox/index.js +1 -1
  222. package/node/Forms/Feedback/Feedback.js +8 -10
  223. package/node/Forms/Feedback/index.js +1 -1
  224. package/node/Forms/Field/Field.js +18 -30
  225. package/node/Forms/Field/FieldControl.js +26 -22
  226. package/node/Forms/Field/FieldHint.js +4 -7
  227. package/node/Forms/Field/index.js +1 -1
  228. package/node/Forms/Input/Input.js +15 -22
  229. package/node/Forms/Input/index.js +1 -1
  230. package/node/Forms/InputGroup/InputGroup.js +14 -42
  231. package/node/Forms/InputGroup/index.js +1 -1
  232. package/node/Forms/Label/Label.js +6 -25
  233. package/node/Forms/Label/index.js +1 -1
  234. package/node/Forms/Password/Password.js +16 -30
  235. package/node/Forms/Password/index.js +1 -1
  236. package/node/Forms/Radio/Radio.js +21 -25
  237. package/node/Forms/Radio/index.js +1 -1
  238. package/node/Forms/Switch/Switch.js +15 -46
  239. package/node/Forms/Switch/index.js +1 -1
  240. package/node/Forms/Textarea/Textarea.js +11 -13
  241. package/node/Forms/Textarea/TextareaRich.js +16 -31
  242. package/node/Forms/Textarea/index.js +1 -1
  243. package/node/Forms/Toggle/Toggle.js +24 -72
  244. package/node/Forms/Toggle/index.js +1 -1
  245. package/node/Forms/Toggle/useToggle.js +33 -33
  246. package/node/Forms/antispam.js +14 -14
  247. package/node/Forms/helpers.js +9 -8
  248. package/node/Forms/index.js +1 -2
  249. package/node/Forms/styles.js +16 -48
  250. package/node/Gauge/Gauge.js +1 -1
  251. package/node/Grid/Grid.js +24 -51
  252. package/node/Grid/index.js +1 -1
  253. package/node/Hamburger/Hamburger.js +37 -50
  254. package/node/Hamburger/index.js +1 -1
  255. package/node/Header/index.js +1 -1
  256. package/node/Header/useHeader.js +16 -16
  257. package/node/Hidden/Hidden.js +10 -15
  258. package/node/Hidden/index.js +1 -1
  259. package/node/Img/index.js +1 -1
  260. package/node/Img/sc/bare.js +4 -3
  261. package/node/Link/Link.js +4 -3
  262. package/node/Link/LinkBlank.js +11 -21
  263. package/node/Link/index.js +1 -1
  264. package/node/Menu/Menu.js +4 -12
  265. package/node/Menu/index.js +1 -1
  266. package/node/MenuItem/MenuItem.js +4 -21
  267. package/node/MenuItem/index.js +1 -1
  268. package/node/Meta/Meta.js +4 -3
  269. package/node/Meta/index.js +1 -1
  270. package/node/NoJs/NoJs.js +3 -3
  271. package/node/NoJs/index.js +1 -1
  272. package/node/Pagination/PaginationNav.js +30 -53
  273. package/node/Pagination/PaginationResults.js +10 -10
  274. package/node/Pagination/index.js +1 -1
  275. package/node/Pill/Pill.js +7 -38
  276. package/node/Pill/index.js +1 -1
  277. package/node/Progress/ProgressCircular.js +11 -33
  278. package/node/Progress/ProgressLinear.js +11 -20
  279. package/node/Progress/ProgressOverlay.js +18 -35
  280. package/node/Progress/index.js +1 -1
  281. package/node/Rating/Rating.js +28 -48
  282. package/node/Rating/index.js +20 -16
  283. package/node/Select/components.js +11 -18
  284. package/node/Sidebar/Sidebar.js +21 -47
  285. package/node/Sidebar/index.js +1 -1
  286. package/node/Spacing/Spacing.js +16 -17
  287. package/node/Spacing/index.js +1 -1
  288. package/node/Sticky/StickyCss.js +5 -3
  289. package/node/Sticky/index.js +1 -1
  290. package/node/Tabs/TabsMui.js +49 -0
  291. package/node/Tabs/index.js +2 -2
  292. package/node/Tabs/sc/bare.js +87 -0
  293. package/node/Tabs/tw/bare.js +20 -0
  294. package/node/Tabs/tw/material.js +21 -0
  295. package/node/Tabs/useTabs.js +48 -0
  296. package/node/Typography/CopyPasteVisible.js +4 -7
  297. package/node/Typography/Native.js +14 -48
  298. package/node/Typography/ReadMore.js +30 -57
  299. package/node/Typography/TextLoop.js +22 -25
  300. package/node/Typography/TypeStairs.js +22 -18
  301. package/node/Typography/index.js +1 -1
  302. package/node/css/index.js +2 -1
  303. package/node/helpers/classed.js +23 -19
  304. package/node/helpers/extend-component.js +7 -7
  305. package/node/helpers/index.js +1 -1
  306. package/node/hooks/index.js +9 -1
  307. package/node/hooks/types.js +2 -0
  308. package/node/hooks/useAsyncFn.js +40 -0
  309. package/node/hooks/useDateLocale.js +23 -37
  310. package/node/hooks/useEffectOnce.js +12 -0
  311. package/node/hooks/useFirstMountState.js +16 -0
  312. package/node/hooks/useFocus.js +4 -4
  313. package/node/hooks/useId.js +12 -0
  314. package/node/hooks/useIsomorphicLayoutEffect.js +11 -0
  315. package/node/hooks/useMount.js +13 -0
  316. package/node/hooks/useMountedState.js +19 -0
  317. package/node/hooks/usePrevious.js +3 -3
  318. package/node/hooks/useScrollPosition.js +23 -19
  319. package/node/hooks/useScrollTo.js +9 -7
  320. package/node/hooks/useTraceUpdate.js +5 -4
  321. package/node/hooks/useUpdateEffect.js +18 -0
  322. package/node/hooks/useWindowSize.js +4 -4
  323. package/node/index.js +1 -1
  324. package/node/m/MotionProvider.js +6 -4
  325. package/node/m/index.js +1 -1
  326. package/node/m/lite.js +1 -1
  327. package/node/m/max.js +1 -1
  328. package/node/sc/index.js +4 -2
  329. package/node/scm/index.js +2 -1
  330. package/node/shared/index.js +1 -1
  331. package/node/styles/Body.js +5 -10
  332. package/node/styles/Global.js +5 -37
  333. package/node/styles/index.js +1 -1
  334. package/node/styles/media.js +42 -38
  335. package/node/styles/spacing.js +15 -16
  336. package/node/styles/styled.js +7 -21
  337. package/node/styles/theme--vanilla.js +21 -19
  338. package/node/styles/theme.js +9 -9
  339. package/node/tw/index.js +2 -1
  340. package/node/twm/index.js +2 -1
  341. package/package.json +20 -9
  342. package/sc/index.d.ts +1 -0
  343. package/sc/index.js +1 -0
  344. package/scm/index.js +1 -0
  345. package/styles/Body.js +4 -8
  346. package/styles/Global.js +4 -36
  347. package/styles/media.js +41 -36
  348. package/styles/spacing.js +15 -16
  349. package/styles/styled.js +7 -21
  350. package/styles/theme--vanilla.js +21 -19
  351. package/styles/theme.js +11 -11
  352. package/tw/index.js +1 -0
  353. package/twm/index.js +1 -0
  354. package/Forms/Form/Form.d.ts +0 -31
  355. package/Forms/Form/Form.js +0 -62
  356. package/Tabs/Tabs.d.ts +0 -27
  357. package/Tabs/Tabs.js +0 -62
  358. package/node/Forms/Form/Form.js +0 -67
  359. package/node/Tabs/Tabs.js +0 -67
package/node/tw/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KoineDialog = void 0;
4
- const tslib_1 = require("tslib");
4
+ var tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("../shared"), exports);
6
6
  // export * from "../Alert";
7
7
  // export * from "../Animations";
@@ -14,6 +14,7 @@ tslib_1.__exportStar(require("../shared"), exports);
14
14
  // export * from "../Debug";
15
15
  var bare_1 = require("../Dialog/tw/bare");
16
16
  Object.defineProperty(exports, "KoineDialog", { enumerable: true, get: function () { return bare_1.KoineDialog; } });
17
+ // export * from "../Form";
17
18
  // export * from "../Forms";
18
19
  // export * from "../Grid";
19
20
  // export * from "../Hamburger";
package/node/twm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.KoineDialog = void 0;
4
- const tslib_1 = require("tslib");
4
+ var tslib_1 = require("tslib");
5
5
  tslib_1.__exportStar(require("../shared"), exports);
6
6
  // export * from "../Alert";
7
7
  // export * from "../Animations";
@@ -14,6 +14,7 @@ tslib_1.__exportStar(require("../shared"), exports);
14
14
  // export * from "../Debug";
15
15
  var framer_1 = require("../Dialog/tw/framer");
16
16
  Object.defineProperty(exports, "KoineDialog", { enumerable: true, get: function () { return framer_1.KoineDialog; } });
17
+ // export * from "../Form";
17
18
  // export * from "../Forms";
18
19
  // export * from "../Grid";
19
20
  // export * from "../Hamburger";
package/package.json CHANGED
@@ -1,15 +1,26 @@
1
1
  {
2
- "version": "1.0.9",
3
2
  "name": "@koine/react",
3
+ "version": "1.0.12",
4
4
  "sideEffects": false,
5
- "dependencies": {
6
- "@types/react": "^17.0.0 || ^18.0.0",
7
- "@types/react-dom": "^17.0.0 || ^18.0.0",
8
- "@types/react-is": "^17.0.0 || ^18.0.0",
9
- "@types/styled-components": "^5.1.25",
10
- "@types/yup": "^0.29.13"
11
- },
12
5
  "main": "./node/index.js",
13
6
  "typings": "./index.d.ts",
14
- "module": "./index.js"
7
+ "dependencies": {
8
+ "styled-components": "^5.3.5",
9
+ "framer-motion": "^6.3.3",
10
+ "react": "^16.8 || ^17 || ^18",
11
+ "react-dom": "^16.8 || ^17 || ^18",
12
+ "@mui/base": "^5.0.0-alpha.81",
13
+ "react-icons": "^4.3.1",
14
+ "date-fns": "^2.28.0",
15
+ "react-swipeable": "^7.0.0",
16
+ "@tiptap/react": "^2.0.0-beta.109",
17
+ "@tiptap/starter-kit": "^2.0.0-beta.184",
18
+ "yup": "^0.32.11",
19
+ "react-hook-form": "^7.31.1",
20
+ "type-fest": "^2.12.2",
21
+ "tslib": "^2.4.0"
22
+ },
23
+ "peerDependencies": {},
24
+ "module": "./index.js",
25
+ "types": "./index.d.ts"
15
26
  }
package/sc/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from "../Carousel";
9
9
  export * from "../Collapsable";
10
10
  export * from "../Debug";
11
11
  export { KoineDialog, type KoineDialogProps } from "../Dialog/sc/bare";
12
+ export { KoineForm, type KoineFormProps } from "../Form/sc/bare";
12
13
  export * from "../Forms";
13
14
  export * from "../Grid";
14
15
  export * from "../Hamburger";
package/sc/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "../Carousel";
9
9
  export * from "../Collapsable";
10
10
  export * from "../Debug";
11
11
  export { KoineDialog } from "../Dialog/sc/bare";
12
+ export { KoineForm } from "../Form/sc/bare";
12
13
  export * from "../Forms";
13
14
  export * from "../Grid";
14
15
  export * from "../Hamburger";
package/scm/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "../Carousel";
9
9
  export * from "../Collapsable";
10
10
  export * from "../Debug";
11
11
  export { KoineDialog } from "../Dialog/sc/framer";
12
+ // export { KoineForm, type KoineFormProps} from "../Form/sc/framer";
12
13
  export * from "../Forms";
13
14
  export * from "../Grid";
14
15
  export * from "../Hamburger";
package/styles/Body.js CHANGED
@@ -1,9 +1,6 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import styled from "styled-components";
2
- export const BodyRoot = styled.div `
3
- display: flex;
4
- flex-direction: column;
5
- min-height: 100vh;
6
- `;
3
+ export var BodyRoot = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n"], ["\n display: flex;\n flex-direction: column;\n min-height: 100vh;\n"])));
7
4
  /**
8
5
  * If you have background graphics to overlap you might need to add:
9
6
  *
@@ -12,6 +9,5 @@ export const BodyRoot = styled.div `
12
9
  * position: relative;
13
10
  * ```
14
11
  */
15
- export const BodyMain = styled.main `
16
- flex: 1;
17
- `;
12
+ export var BodyMain = styled.main(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex: 1;\n"], ["\n flex: 1;\n"])));
13
+ var templateObject_1, templateObject_2;
package/styles/Global.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __makeTemplateObject } from "tslib";
1
2
  import { createGlobalStyle } from "styled-components";
2
3
  /**
3
4
  * App global style
@@ -12,39 +13,6 @@ import { createGlobalStyle } from "styled-components";
12
13
  * - @see https://www.warrenchandler.com/2019/04/02/stop-iphones-from-zooming-in-on-form-fields/
13
14
  * - @see https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/
14
15
  */
15
- export const stylesGlobal = `
16
- body {
17
- margin: 0;
18
- padding: 0;
19
- overflow-x: hidden;
20
- overflow-y: scroll;
21
- }
22
-
23
- body,
24
- button,
25
- input,
26
- textarea,
27
- select,
28
- select:-webkit-autofill::first-line,
29
- input:-webkit-autofill::first-line {
30
- font-family: var(--font), -apple-system, BlinkMacSystemFont, "Segoe UI",
31
- Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
32
- sans-serif;
33
- font-size: var(--fontSize);
34
- }
35
-
36
- html {
37
- box-sizing: border-box;
38
- @media (prefers-reduced-motion: no-preference) {
39
- scroll-behavior: smooth;
40
- }
41
- }
42
-
43
- *,
44
- *:before,
45
- *:after {
46
- box-sizing: inherit;
47
- -webkit-tap-highlight-color: transparent;
48
- }
49
- `;
50
- export const StylesGlobal = createGlobalStyle `${stylesGlobal}`;
16
+ export var stylesGlobal = "\n body {\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n\n body,\n button,\n input,\n textarea,\n select,\n select:-webkit-autofill::first-line,\n input:-webkit-autofill::first-line {\n font-family: var(--font), -apple-system, BlinkMacSystemFont, \"Segoe UI\",\n Roboto, Oxygen, Ubuntu, Cantarell, \"Open Sans\", \"Helvetica Neue\",\n sans-serif;\n font-size: var(--fontSize);\n }\n\n html {\n box-sizing: border-box;\n @media (prefers-reduced-motion: no-preference) {\n scroll-behavior: smooth;\n }\n }\n\n *,\n *:before,\n *:after {\n box-sizing: inherit;\n -webkit-tap-highlight-color: transparent;\n }\n";
17
+ export var StylesGlobal = createGlobalStyle(templateObject_1 || (templateObject_1 = __makeTemplateObject(["", ""], ["", ""])), stylesGlobal);
18
+ var templateObject_1;
package/styles/media.js CHANGED
@@ -1,18 +1,19 @@
1
+ var _a;
1
2
  import { useState, useEffect } from "react";
2
3
  import { useTheme, breakpoints } from "./theme";
3
- export const { min, max, up, down, between, only } = generateMediaQueries(breakpoints);
4
+ export var min = (_a = generateMediaQueries(breakpoints), _a.min), max = _a.max, up = _a.up, down = _a.down, between = _a.between, only = _a.only;
4
5
  export function useMedia(media) {
5
- const { breakpoints } = useTheme();
6
- const [matches, setMatches] = useState(false);
7
- const [direction = "min", breakpoint] = media.split(":");
8
- let px = breakpoints[breakpoint];
6
+ var breakpoints = useTheme().breakpoints;
7
+ var _a = useState(false), matches = _a[0], setMatches = _a[1];
8
+ var _b = media.split(":"), _c = _b[0], direction = _c === void 0 ? "min" : _c, breakpoint = _b[1];
9
+ var px = breakpoints[breakpoint];
9
10
  if (direction === "max") {
10
11
  px = px - 0.02;
11
12
  }
12
- const query = `(${direction}-width: ${px}px)`;
13
- useEffect(() => {
14
- const mq = window.matchMedia(query);
15
- const handleChange = (event) => {
13
+ var query = "(".concat(direction, "-width: ").concat(px, "px)");
14
+ useEffect(function () {
15
+ var mq = window.matchMedia(query);
16
+ var handleChange = function (event) {
16
17
  setMatches(event.matches);
17
18
  };
18
19
  setMatches(mq.matches);
@@ -22,12 +23,12 @@ export function useMedia(media) {
22
23
  // Update the state whenever the media query match state changes
23
24
  mq.addListener(handleChange);
24
25
  // Clean up on unmount and if the query changes
25
- return () => {
26
+ return function () {
26
27
  mq.removeListener(handleChange);
27
28
  };
28
29
  }
29
30
  mq.addEventListener("change", handleChange);
30
- return () => {
31
+ return function () {
31
32
  mq.removeEventListener("change", handleChange);
32
33
  };
33
34
  }, [query]);
@@ -83,13 +84,13 @@ export function useMedia(media) {
83
84
  * ```
84
85
  */
85
86
  export function generateMediaQueries(breakpoints) {
86
- const temp = Object.keys(breakpoints).map((key) => {
87
- const br = key;
87
+ var temp = Object.keys(breakpoints).map(function (key) {
88
+ var br = key;
88
89
  return [br, breakpoints[br]];
89
90
  });
90
- const sortedKeys = temp.sort((a, b) => a[1] - b[1]).map((item) => item[0]);
91
- const getNext = (breakpoint) => {
92
- const index = sortedKeys.indexOf(breakpoint);
91
+ var sortedKeys = temp.sort(function (a, b) { return a[1] - b[1]; }).map(function (item) { return item[0]; });
92
+ var getNext = function (breakpoint) {
93
+ var index = sortedKeys.indexOf(breakpoint);
93
94
  return sortedKeys[index + 1];
94
95
  };
95
96
  /**
@@ -98,53 +99,57 @@ export function generateMediaQueries(breakpoints) {
98
99
  * For ease of use this can be used both as a function `min("md")` and as an
99
100
  * object literal `min.md`.
100
101
  */ // @ts-expect-error FIXME: at some point
101
- const min = (br) => `@media (min-width: ${breakpoints[br]}px)`;
102
+ var min = function (br) {
103
+ return "@media (min-width: ".concat(breakpoints[br], "px)");
104
+ };
102
105
  /**
103
106
  * It behaves the same as `@media (max-width: ${value}px)`
104
107
  * where value is the given breakpoint value.
105
108
  * For ease of use this can be used both as a function `max("md")` and as an
106
109
  * object literal `max.md`.
107
110
  */ // @ts-expect-error FIXME: at some point
108
- const max = (br) => `@media (max-width: ${breakpoints[br] - 0.02}px)`;
109
- for (const br in breakpoints) {
110
- const _br = br;
111
- min[_br] = `@media (min-width: ${breakpoints[_br]}px)`;
112
- max[_br] = `@media (max-width: ${breakpoints[_br] - 0.02}px)`;
111
+ var max = function (br) {
112
+ return "@media (max-width: ".concat(breakpoints[br] - 0.02, "px)");
113
+ };
114
+ for (var br in breakpoints) {
115
+ var _br = br;
116
+ min[_br] = "@media (min-width: ".concat(breakpoints[_br], "px)");
117
+ max[_br] = "@media (max-width: ".concat(breakpoints[_br] - 0.02, "px)");
113
118
  }
114
119
  /**
115
120
  * It behaves the same as `min`
116
121
  * @inheritdoc {max}
117
122
  */
118
- const up = min;
123
+ var up = min;
119
124
  /**
120
125
  * It behaves similarly to `max` but you will use the "next" breakpoint,
121
126
  * specifying CSS that will apply from the given breakpoint and down.
122
127
  */
123
- const down = (br) => {
124
- const brNext = getNext(br);
128
+ var down = function (br) {
129
+ var brNext = getNext(br);
125
130
  // TODO: if br does not exists otherwise throw Error
126
- return brNext && `@media (max-width: ${breakpoints[brNext] - 0.02}px)`;
131
+ return brNext && "@media (max-width: ".concat(breakpoints[brNext] - 0.02, "px)");
127
132
  };
128
133
  /**
129
134
  * Media query between the two given breakpoints
130
135
  */
131
- const between = (br1, br2) => {
132
- return `@media (min-width: ${breakpoints[br1]}px) and (max-width: ${breakpoints[br2] - 0.02}px)`;
136
+ var between = function (br1, br2) {
137
+ return "@media (min-width: ".concat(breakpoints[br1], "px) and (max-width: ").concat(breakpoints[br2] - 0.02, "px)");
133
138
  };
134
139
  /**
135
140
  * Media query to apply from the given breakpoint until the next, just for its
136
141
  * full range
137
142
  */
138
- const only = (br) => {
139
- const brNext = getNext(br);
143
+ var only = function (br) {
144
+ var brNext = getNext(br);
140
145
  return brNext ? between(br, brNext) : min(br);
141
146
  };
142
147
  return {
143
- min,
144
- max,
145
- up,
146
- down,
147
- between,
148
- only,
148
+ min: min,
149
+ max: max,
150
+ up: up,
151
+ down: down,
152
+ between: between,
153
+ only: only,
149
154
  };
150
155
  }
package/styles/spacing.js CHANGED
@@ -1,27 +1,26 @@
1
- function _spacing(theme, size = "md", factor = 1, property = "padding", direction = "top", devices = ["mobile", "tablet", "desktop"]) {
2
- const { breakpoints, devices: DEVICES, spaces: SPACES } = theme;
3
- let css = "";
4
- const prop = `${property}-${direction}`;
1
+ function _spacing(theme, size, factor, property, direction, devices) {
2
+ if (size === void 0) { size = "md"; }
3
+ if (factor === void 0) { factor = 1; }
4
+ if (property === void 0) { property = "padding"; }
5
+ if (direction === void 0) { direction = "top"; }
6
+ if (devices === void 0) { devices = ["mobile", "tablet", "desktop"]; }
7
+ var breakpoints = theme.breakpoints, DEVICES = theme.devices, SPACES = theme.spaces;
8
+ var css = "";
9
+ var prop = "".concat(property, "-").concat(direction);
5
10
  if (!devices.length || devices[0] === "mobile") {
6
- css += `@media(max-width: ${breakpoints[DEVICES.mobile]}px){
7
- ${prop}: ${SPACES["mobile"][size] * factor}px;
8
- }`;
11
+ css += "@media(max-width: ".concat(breakpoints[DEVICES.mobile], "px){\n ").concat(prop, ": ").concat(SPACES["mobile"][size] * factor, "px;\n }");
9
12
  }
10
13
  else {
11
- for (let index = 0; index < devices.length; index++) {
12
- const device = devices[index];
14
+ for (var index = 0; index < devices.length; index++) {
15
+ var device = devices[index];
13
16
  if (device === "mobile") {
14
- css += `${prop}: ${SPACES[device][size] * factor}px;`;
17
+ css += "".concat(prop, ": ").concat(SPACES[device][size] * factor, "px;");
15
18
  }
16
19
  else if (device === "tablet") {
17
- css += `@media(min-width: ${breakpoints[DEVICES.tablet]}px){
18
- ${prop}: ${SPACES["tablet"][size] * factor}px;
19
- }`;
20
+ css += "@media(min-width: ".concat(breakpoints[DEVICES.tablet], "px){\n ").concat(prop, ": ").concat(SPACES["tablet"][size] * factor, "px;\n }");
20
21
  }
21
22
  else if (device === "desktop") {
22
- css += `@media(min-width: ${breakpoints[DEVICES.desktop]}px){
23
- ${prop}: ${SPACES["desktop"][size] * factor}px;
24
- }`;
23
+ css += "@media(min-width: ".concat(breakpoints[DEVICES.desktop], "px){\n ").concat(prop, ": ").concat(SPACES["desktop"][size] * factor, "px;\n }");
25
24
  }
26
25
  }
27
26
  }
package/styles/styled.js CHANGED
@@ -1,27 +1,13 @@
1
1
  export function colStretch(direction, bg) {
2
- return `
3
- background: ${bg};
4
- position: relative;
5
-
6
- &:before{
7
- z-index: -1;
8
- content: '';
9
- position: absolute;
10
- right: ${direction === "left" ? "100%" : "-100vw"};
11
- left: ${direction === "right" ? "100%" : "-100vw"};
12
- top: 0;
13
- bottom: 0;
14
- background: ${bg};
15
- }
16
- `;
2
+ return "\n background: ".concat(bg, ";\n position: relative;\n\n &:before{\n z-index: -1;\n content: '';\n position: absolute;\n right: ").concat(direction === "left" ? "100%" : "-100vw", ";\n left: ").concat(direction === "right" ? "100%" : "-100vw", ";\n top: 0;\n bottom: 0;\n background: ").concat(bg, ";\n }\n ");
17
3
  }
18
4
  /** @see https://caniuse.com/?search=inset */
19
- export const inset0 = `top:0;left:0;right:0;bottom:0;`;
20
- export const overlay = `position: absolute;${inset0}`;
21
- export const centered = `display: flex;align-items: center;justify-content: center;`;
22
- export const ellipsis = `overflow: hidden;text-overflow: ellipsis;white-space: nowrap;`;
5
+ export var inset0 = "top:0;left:0;right:0;bottom:0;";
6
+ export var overlay = "position: absolute;".concat(inset0);
7
+ export var centered = "display: flex;align-items: center;justify-content: center;";
8
+ export var ellipsis = "overflow: hidden;text-overflow: ellipsis;white-space: nowrap;";
23
9
  /**
24
10
  * @see import("@mui/utils").visuallyHidden https://github.com/mui-org/material-ui/blob/master/packages/mui-utils/src/visuallyHidden.ts
25
11
  */
26
- export const invisible = `border: 0;clip: rect(0 0 0 0);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;white-space: nowrap;width: 1px;`;
27
- export const stateFocus = `outline: 0px;box-shadow: 0 0 0 0.2rem rgba(200, 200, 200, 0.25);`;
12
+ export var invisible = "border: 0;clip: rect(0 0 0 0);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;white-space: nowrap;width: 1px;";
13
+ export var stateFocus = "outline: 0px;box-shadow: 0 0 0 0.2rem rgba(200, 200, 200, 0.25);";
@@ -1,53 +1,55 @@
1
+ import { __assign } from "tslib";
1
2
  import { jsx as _jsx } from "react/jsx-runtime";
2
3
  import { createContext, useState } from "react";
3
4
  import { isBrowser, setCookie, parseCookie } from "@koine/utils";
4
- import { useMount, useUpdateEffect } from "react-use";
5
- export const THEME_KEY = "theme";
6
- export const THEME_DEFAULT = "light";
7
- export const getInitialThemeFromRequest = (cookie) => {
5
+ import { useMount, useUpdateEffect } from "../hooks";
6
+ export var THEME_KEY = "theme";
7
+ export var THEME_DEFAULT = "light";
8
+ export var getInitialThemeFromRequest = function (cookie) {
8
9
  if (cookie) {
9
- const parsed = parseCookie(cookie);
10
- return parsed?.theme;
10
+ var parsed = parseCookie(cookie);
11
+ return parsed === null || parsed === void 0 ? void 0 : parsed.theme;
11
12
  }
12
13
  return THEME_DEFAULT;
13
14
  };
14
- export const getInitialThemeFromClient = () => {
15
+ export var getInitialThemeFromClient = function () {
15
16
  if (typeof window !== "undefined" && window.localStorage) {
16
- const storedPrefs = window.localStorage.getItem(THEME_KEY);
17
+ var storedPrefs = window.localStorage.getItem(THEME_KEY);
17
18
  if (typeof storedPrefs === "string") {
18
19
  return storedPrefs;
19
20
  }
20
- const userMedia = window.matchMedia("(prefers-color-scheme: dark)");
21
+ var userMedia = window.matchMedia("(prefers-color-scheme: dark)");
21
22
  if (userMedia.matches) {
22
23
  return "dark";
23
24
  }
24
25
  }
25
26
  return THEME_DEFAULT;
26
27
  };
27
- export const ThemeVanillaContext = createContext({
28
+ export var ThemeVanillaContext = createContext({
28
29
  theme: "light",
29
30
  setTheme: undefined,
30
31
  });
31
- export const ThemeVanillaProvider = ({ initialTheme, children, }) => {
32
- const [theme, setTheme] = useState(initialTheme);
33
- const rawSetTheme = (rawTheme) => {
32
+ export var ThemeVanillaProvider = function (_a) {
33
+ var initialTheme = _a.initialTheme, children = _a.children;
34
+ var _b = useState(initialTheme), theme = _b[0], setTheme = _b[1];
35
+ var rawSetTheme = function (rawTheme) {
34
36
  if (!rawTheme || !isBrowser) {
35
37
  return;
36
38
  }
37
- const root = window.document.documentElement;
38
- const isDark = rawTheme === "dark";
39
+ var root = window.document.documentElement;
40
+ var isDark = rawTheme === "dark";
39
41
  root.classList.remove(isDark ? "light" : "dark");
40
42
  root.classList.add(rawTheme);
41
43
  localStorage.setItem(THEME_KEY, rawTheme);
42
44
  setCookie(THEME_KEY, rawTheme);
43
45
  };
44
- useMount(() => {
45
- const theme = getInitialThemeFromClient();
46
+ useMount(function () {
47
+ var theme = getInitialThemeFromClient();
46
48
  setTheme(theme);
47
49
  rawSetTheme(theme);
48
50
  });
49
- useUpdateEffect(() => {
51
+ useUpdateEffect(function () {
50
52
  rawSetTheme(theme);
51
53
  }, [theme]);
52
- return (_jsx(ThemeVanillaContext.Provider, { value: { theme, setTheme }, children: children }));
54
+ return (_jsx(ThemeVanillaContext.Provider, __assign({ value: { theme: theme, setTheme: setTheme } }, { children: children })));
53
55
  };
package/styles/theme.js CHANGED
@@ -1,5 +1,6 @@
1
+ import { __assign } from "tslib";
1
2
  import { useTheme as _useTheme } from "styled-components";
2
- const DEFAULT_BREAKPOINTS = {
3
+ var DEFAULT_BREAKPOINTS = {
3
4
  xs: 0,
4
5
  sm: 440,
5
6
  md: 768,
@@ -18,24 +19,23 @@ const DEFAULT_BREAKPOINTS = {
18
19
  * BREAKPOINTS=xs:0,sm:440,md:768,lg:1024,xl:1368,xxl:1690
19
20
  * ```
20
21
  */
21
- export const breakpoints = process.env["BREAKPOINTS"]
22
- ? process.env["BREAKPOINTS"].split(",").reduce((map, pair) => {
23
- const [key, value] = pair.split(":");
22
+ export var breakpoints = process.env["BREAKPOINTS"]
23
+ ? process.env["BREAKPOINTS"].split(",").reduce(function (map, pair) {
24
+ var _a = pair.split(":"), key = _a[0], value = _a[1];
24
25
  map[key] = parseFloat(value);
25
26
  return map;
26
27
  }, {})
27
28
  : DEFAULT_BREAKPOINTS;
28
- const themeDefault = {
29
+ var themeDefault = {
29
30
  maxWidth: breakpoints.xxl,
30
- breakpoints,
31
+ breakpoints: breakpoints,
31
32
  devices: {
32
33
  mobile: "sm",
33
34
  tablet: "md",
34
35
  desktop: "lg",
35
36
  },
36
37
  };
37
- export const createTheme = (options) => ({
38
- ...themeDefault,
39
- ...options,
40
- });
41
- export const useTheme = _useTheme;
38
+ export var createTheme = function (options) {
39
+ return (__assign(__assign({}, themeDefault), options));
40
+ };
41
+ export var useTheme = _useTheme;
package/tw/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "../shared";
9
9
  // export * from "../Collapsable";
10
10
  // export * from "../Debug";
11
11
  export { KoineDialog } from "../Dialog/tw/bare";
12
+ // export * from "../Form";
12
13
  // export * from "../Forms";
13
14
  // export * from "../Grid";
14
15
  // export * from "../Hamburger";
package/twm/index.js CHANGED
@@ -9,6 +9,7 @@ export * from "../shared";
9
9
  // export * from "../Collapsable";
10
10
  // export * from "../Debug";
11
11
  export { KoineDialog } from "../Dialog/tw/framer";
12
+ // export * from "../Form";
12
13
  // export * from "../Forms";
13
14
  // export * from "../Grid";
14
15
  // export * from "../Hamburger";
@@ -1,31 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const FormRoot: import("styled-components").StyledComponent<"form", import("styled-components").DefaultTheme, {}, never>;
3
- export declare const FormOverlay: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
- export declare const FormFeedback: import("styled-components").StyledComponent<({ $danger, children, ...props }: import("../../Alert").AlertProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
5
- export declare type FormProps = React.ComponentPropsWithoutRef<"form"> & {
6
- action: string;
7
- ok?: boolean;
8
- Ok?: typeof FormFeedback;
9
- okProps?: object;
10
- fail?: boolean;
11
- Fail?: typeof FormFeedback;
12
- failProps?: object;
13
- loading?: boolean;
14
- /** Whether the form should collapse on `ok` */
15
- collapseOnOk?: boolean;
16
- /** Whether the form should collapse on `fail` */
17
- collapseOnFail?: boolean;
18
- /**
19
- * Determines the time (in ms) that the `Ok` component wait before collapsing
20
- * When <= 0 the `Ok` component will persist
21
- *
22
- * @default 3000 */
23
- okTimeout?: number;
24
- /**
25
- * Determines the time (in ms) that the `Fail` component wait before collapsing
26
- * When <= 0 the `Fail` component will persist
27
- *
28
- * @default 3000 */
29
- failTimeout?: number;
30
- };
31
- export declare const Form: ({ ok, fail, loading, Ok, okProps, Fail, failProps, collapseOnOk, collapseOnFail, okTimeout, failTimeout, children, ...props }: FormProps) => JSX.Element;
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import styled from "styled-components";
4
- import { overlay, centered } from "../../styles/styled";
5
- import { Collapsable } from "../../Collapsable";
6
- import { ProgressCircular } from "../../Progress";
7
- import { Alert } from "../../Alert";
8
- export const FormRoot = styled.form `
9
- position: relative;
10
- `;
11
- export const FormOverlay = styled.div `
12
- z-index: 4;
13
- ${overlay}
14
- ${centered}
15
- background: rgba(var(--bodyBg--rgb),.8);
16
- pointer-events: none;
17
- backdrop-filter: blur(2px);
18
- `;
19
- export const FormFeedback = styled(Alert) `
20
- padding: 2em 0;
21
- `;
22
- export const Form = ({ ok, fail, loading, Ok = FormFeedback, okProps = {
23
- children: "Sent!",
24
- }, Fail = FormFeedback, failProps = {
25
- children: "Failed.",
26
- }, collapseOnOk, collapseOnFail, okTimeout = 3000, failTimeout = 3000, children, ...props }) => {
27
- const [expanded, setExpanded] = useState("");
28
- const commonProps = {
29
- head: null,
30
- components: {
31
- HeadIcon: null,
32
- },
33
- };
34
- useEffect(() => {
35
- if (!loading) {
36
- if (ok)
37
- setExpanded("ok");
38
- else if (fail)
39
- setExpanded("fail");
40
- }
41
- }, [ok, fail, loading]);
42
- useEffect(() => {
43
- let timeout;
44
- if (expanded === "fail" && failTimeout) {
45
- timeout = setTimeout(() => setExpanded(""), failTimeout);
46
- }
47
- else if (expanded === "ok" && okTimeout) {
48
- timeout = setTimeout(() => setExpanded(""), okTimeout);
49
- }
50
- return () => {
51
- if (timeout) {
52
- clearTimeout(timeout);
53
- }
54
- };
55
- }, [expanded, failTimeout, okTimeout]);
56
- let formExpanded = true;
57
- if (collapseOnFail && fail)
58
- formExpanded = false;
59
- if (collapseOnOk && ok)
60
- formExpanded = false;
61
- return (_jsxs(FormRoot, { method: "post", noValidate: true, ...props, children: [_jsx(Collapsable, { ...commonProps, expanded: formExpanded, recalc: loading, body: _jsxs(_Fragment, { children: [children, loading && (_jsx(FormOverlay, { children: _jsx(ProgressCircular, { size: "2em", color: "var(--accent300)" }) }))] }) }), _jsx(Collapsable, { ...commonProps, expanded: expanded === "ok" && !loading, body: _jsx(Ok, { ...okProps }) }), _jsx(Collapsable, { ...commonProps, expanded: expanded === "fail" && !loading, body: _jsx(Fail, { ...failProps }) })] }));
62
- };