@ainias42/react-bootstrap-mobile 0.2.4 → 0.2.6

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 (31) hide show
  1. package/bin/updateCopies.js +1 -1
  2. package/bootstrapReactMobile.ts +4 -0
  3. package/dist/bootstrapReactMobile.d.ts +4 -0
  4. package/dist/bootstrapReactMobile.js +751 -589
  5. package/dist/bootstrapReactMobile.js.map +1 -1
  6. package/dist/src/Components/FormElements/CheckBox/Checkbox.d.ts +2 -1
  7. package/dist/src/Components/FormElements/ColorInput/ColorInput.d.ts +2 -1
  8. package/dist/src/Components/FormElements/Controller/ColorInputController.d.ts +3 -0
  9. package/dist/src/Components/FormElements/Controller/FileInputController.d.ts +8 -0
  10. package/dist/src/Components/FormElements/FormError.d.ts +5 -0
  11. package/dist/src/Components/FormElements/Input/FileInput/FileInput.d.ts +1 -1
  12. package/dist/src/Components/FormElements/Input/FileInput/FileType.d.ts +2 -2
  13. package/dist/src/Components/FormElements/Switch/Switch.d.ts +2 -1
  14. package/dist/src/Components/Hooks/useDelayedEffect.d.ts +1 -0
  15. package/package.json +1 -1
  16. package/src/Components/Card/card.scss +2 -2
  17. package/src/Components/FormElements/CheckBox/Checkbox.tsx +4 -0
  18. package/src/Components/FormElements/ColorInput/ColorInput.tsx +15 -10
  19. package/src/Components/FormElements/Controller/ColorInputController.ts +4 -0
  20. package/src/Components/FormElements/Controller/FileInputController.tsx +42 -0
  21. package/src/Components/FormElements/Controller/MultipleFileInputController.ts +1 -0
  22. package/src/Components/FormElements/Controller/withHookController.tsx +6 -4
  23. package/src/Components/FormElements/FormError.tsx +29 -0
  24. package/src/Components/FormElements/Input/FileInput/FileInput.tsx +3 -2
  25. package/src/Components/FormElements/Input/FileInput/FileType.ts +1 -1
  26. package/src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx +13 -9
  27. package/src/Components/FormElements/Input/Input.tsx +2 -4
  28. package/src/Components/FormElements/Input/input.scss +2 -2
  29. package/src/Components/FormElements/Switch/Switch.tsx +47 -43
  30. package/src/Components/FormElements/formError.scss +4 -0
  31. package/src/Components/Hooks/useDelayedEffect.ts +14 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @ainias42/react-bootstrap-mobile v0.2.3
3
+ * @ainias42/react-bootstrap-mobile v0.2.5
4
4
  * git+https://github.com/Ainias/Bootstrap-React-Mobile.git
5
5
  * Copyright (c) Silas Günther and project contributors.
6
6
  * This source code is licensed under the MIT license found in the
@@ -1223,7 +1223,7 @@ var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(1354);
1223
1223
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
1224
1224
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
1225
1225
  // Module
1226
- ___CSS_LOADER_EXPORT___.push([module.id, `.card__JNkK_{margin:8px;padding:16px;word-wrap:break-word;background-color:#fff}.card__JNkK_.fullHeight__xYEuK{height:calc(100% - 16px)}.card__JNkK_.noPaddingHeight__hOIog{padding-top:0;padding-bottom:0}.card__JNkK_.noPaddingWidth__ontjp{padding-left:0;padding-right:0}.card__JNkK_.noPadding__bi80V{padding:0}.card__JNkK_.noMargin__NLiNU{margin:0}.card__JNkK_.noMargin__NLiNU.fullHeight__xYEuK{height:100%}.card__JNkK_ .content__jwaqW{font-size:16px;margin:0;line-height:1.4}.card__JNkK_ .title__BrHn0{padding:0}.material-design .card__JNkK_{border-radius:2px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2)}.material-design .card__JNkK_ .content__jwaqW{color:#000;color:rgba(0,0,0,.54)}.material-design .card__JNkK_ .title__BrHn0{margin:8px 0 12px 0;font-size:24px}.flat-design .card__JNkK_{border-radius:8px;box-shadow:0 1px 2px 0 rgba(0,0,0,.12)}.flat-design .card__JNkK_ .content__jwaqW{color:#030303}.flat-design .card__JNkK_ .title__BrHn0{margin:4px 0 8px 0;font-size:20px}`, "",{"version":3,"sources":["webpack://./src/Components/Card/card.scss","webpack://./src/scss/_variables.scss","webpack://./src/scss/_designMixin.scss"],"names":[],"mappings":"AAKA,aACE,UAHW,CAIX,YAAA,CACA,oBAAA,CACA,qBAAA,CAEA,+BACE,wBAAA,CAGF,oCACE,aAAA,CACA,gBAAA,CAGF,mCACE,cAAA,CACA,eAAA,CAGF,8BACE,SAAA,CAGF,6BACE,QAAA,CAEA,+CACE,WAAA,CAIJ,6BACE,cCrBW,CDsBX,QAAA,CACA,eAAA,CAGF,2BACE,SAAA,CExCS,8BF4CT,iBAAA,CACA,gGC9BgB,CDgChB,8CACE,UAAA,CACA,qBAAA,CAGF,4CACE,mBAAA,CACA,cAAA,CEtDO,0BF2DT,iBAAA,CACA,sCAAA,CAEA,0CACE,aAAA,CAGF,wCACE,kBAAA,CACA,cAAA","sourcesContent":["@import \"../../scss/variables\";\n@import \"../../scss/designMixin\";\n\n$marginCard: 8px;\n\n.card {\n margin: $marginCard;\n padding: 16px;\n word-wrap: break-word;\n background-color: #ffffff;\n\n &.fullHeight {\n height: calc(100% - #{2*$marginCard})\n }\n\n &.noPaddingHeight {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n &.noPaddingWidth {\n padding-left: 0;\n padding-right: 0;\n }\n\n &.noPadding {\n padding: 0\n }\n\n &.noMargin {\n margin: 0;\n\n &.fullHeight {\n height: 100%\n }\n }\n\n .content {\n font-size: $fontSizeBase;\n margin: 0;\n line-height: 1.4;\n }\n\n .title {\n padding: 0;\n }\n\n @include design($material) {\n border-radius: 2px;\n box-shadow: $boxShadowMaterial;\n\n .content {\n color: #000000;\n color: rgba(0, 0, 0, 0.54);\n }\n\n .title {\n margin: 8px 0 12px 0;\n font-size: 24px;\n }\n }\n\n @include design($flat) {\n border-radius: 8px;\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / 12%);\n\n .content {\n color: #030303;\n }\n\n .title {\n margin: 4px 0 8px 0;\n font-size: 20px;\n }\n }\n}\n","@import 'bootstrap/scss/functions';\n@import 'bootstrap/scss/variables';\n\n$classPrefix: \"rbm-\";\n\n$material: \"material-design\";\n$flat: \"flat-design\";\n\n$android: $material;\n$ios: $flat;\n\n$animationDuration: 0.3s;\n$animationDurationMaterial: $animationDuration;\n$animationDurationFlat: $animationDuration;\n$animationDurationAndroid: $animationDurationMaterial;\n$animationDurationIos: $animationDurationFlat;\n\n$fontSizeBase: 16px;\n\n$boxShadowMaterial: 0 2px 2px 0 rgb(0 0 0 / 14%),\n0 1px 5px 0 rgb(0 0 0 / 12%),\n0 3px 1px -2px rgb(0 0 0 / 20%);\n","@use 'sass:selector';\n\n@mixin design($designName) {\n @if & {\n @at-root #{selector.nest(':global(.'+$designName+\")\", &)} {\n @content\n }\n } @else {\n :global(.#{$designName}) {\n @content\n }\n }\n}\n"],"sourceRoot":""}]);
1226
+ ___CSS_LOADER_EXPORT___.push([module.id, `.card__JNkK_{margin:8px;padding:16px;word-wrap:break-word;background-color:#fff}.card__JNkK_.fullHeight__xYEuK{height:calc(100% - 16px)}.card__JNkK_.noPaddingHeight__hOIog{padding-top:0;padding-bottom:0}.card__JNkK_.noPaddingWidth__ontjp{padding-left:0;padding-right:0}.card__JNkK_.noPadding__bi80V{padding:0}.card__JNkK_.noMargin__NLiNU{margin:0}.card__JNkK_.noMargin__NLiNU.fullHeight__xYEuK{height:100%}.card__JNkK_ .content__jwaqW{font-size:16px;margin:0;line-height:1.4}.card__JNkK_ .title__BrHn0{padding:0}.material-design .card__JNkK_{border-radius:2px;box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 1px 5px 0 rgba(0,0,0,.12),0 3px 1px -2px rgba(0,0,0,.2)}.material-design .card__JNkK_ .content__jwaqW{color:#000;color:var(--card-text-color, rgba(0, 0, 0, 0.54))}.material-design .card__JNkK_ .title__BrHn0{margin:8px 0 12px 0;font-size:24px}.flat-design .card__JNkK_{border-radius:8px;box-shadow:0 1px 2px 0 rgba(0,0,0,.12)}.flat-design .card__JNkK_ .content__jwaqW{color:var(--card-text-color, #030303)}.flat-design .card__JNkK_ .title__BrHn0{margin:4px 0 8px 0;font-size:20px}`, "",{"version":3,"sources":["webpack://./src/Components/Card/card.scss","webpack://./src/scss/_variables.scss","webpack://./src/scss/_designMixin.scss"],"names":[],"mappings":"AAKA,aACE,UAHW,CAIX,YAAA,CACA,oBAAA,CACA,qBAAA,CAEA,+BACE,wBAAA,CAGF,oCACE,aAAA,CACA,gBAAA,CAGF,mCACE,cAAA,CACA,eAAA,CAGF,8BACE,SAAA,CAGF,6BACE,QAAA,CAEA,+CACE,WAAA,CAIJ,6BACE,cCrBW,CDsBX,QAAA,CACA,eAAA,CAGF,2BACE,SAAA,CExCS,8BF4CT,iBAAA,CACA,gGC9BgB,CDgChB,8CACE,UAAA,CACA,iDAAA,CAGF,4CACE,mBAAA,CACA,cAAA,CEtDO,0BF2DT,iBAAA,CACA,sCAAA,CAEA,0CACE,qCAAA,CAGF,wCACE,kBAAA,CACA,cAAA","sourcesContent":["@import \"../../scss/variables\";\n@import \"../../scss/designMixin\";\n\n$marginCard: 8px;\n\n.card {\n margin: $marginCard;\n padding: 16px;\n word-wrap: break-word;\n background-color: #ffffff;\n\n &.fullHeight {\n height: calc(100% - #{2*$marginCard})\n }\n\n &.noPaddingHeight {\n padding-top: 0;\n padding-bottom: 0;\n }\n\n &.noPaddingWidth {\n padding-left: 0;\n padding-right: 0;\n }\n\n &.noPadding {\n padding: 0\n }\n\n &.noMargin {\n margin: 0;\n\n &.fullHeight {\n height: 100%\n }\n }\n\n .content {\n font-size: $fontSizeBase;\n margin: 0;\n line-height: 1.4;\n }\n\n .title {\n padding: 0;\n }\n\n @include design($material) {\n border-radius: 2px;\n box-shadow: $boxShadowMaterial;\n\n .content {\n color: #000000;\n color: var(--card-text-color, rgba(0, 0, 0, 0.54));\n }\n\n .title {\n margin: 8px 0 12px 0;\n font-size: 24px;\n }\n }\n\n @include design($flat) {\n border-radius: 8px;\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / 12%);\n\n .content {\n color: var(--card-text-color, #030303);\n }\n\n .title {\n margin: 4px 0 8px 0;\n font-size: 20px;\n }\n }\n}\n","@import 'bootstrap/scss/functions';\n@import 'bootstrap/scss/variables';\n\n$classPrefix: \"rbm-\";\n\n$material: \"material-design\";\n$flat: \"flat-design\";\n\n$android: $material;\n$ios: $flat;\n\n$animationDuration: 0.3s;\n$animationDurationMaterial: $animationDuration;\n$animationDurationFlat: $animationDuration;\n$animationDurationAndroid: $animationDurationMaterial;\n$animationDurationIos: $animationDurationFlat;\n\n$fontSizeBase: 16px;\n\n$boxShadowMaterial: 0 2px 2px 0 rgb(0 0 0 / 14%),\n0 1px 5px 0 rgb(0 0 0 / 12%),\n0 3px 1px -2px rgb(0 0 0 / 20%);\n","@use 'sass:selector';\n\n@mixin design($designName) {\n @if & {\n @at-root #{selector.nest(':global(.'+$designName+\")\", &)} {\n @content\n }\n } @else {\n :global(.#{$designName}) {\n @content\n }\n }\n}\n"],"sourceRoot":""}]);
1227
1227
  // Exports
1228
1228
  ___CSS_LOADER_EXPORT___.locals = {
1229
1229
  "card": `card__JNkK_`,
@@ -1443,7 +1443,7 @@ var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(1354);
1443
1443
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
1444
1444
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
1445
1445
  // Module
1446
- ___CSS_LOADER_EXPORT___.push([module.id, `.input__ylsuY{width:100%}.input__ylsuY.inline__CuO0B{--basis: 50%;display:flex}.input__ylsuY.inline__CuO0B .label__Uty0i{display:inline-block;flex-grow:1;flex-shrink:0;flex-basis:var(--basis);font-weight:normal}.input__ylsuY.inline__CuO0B .text__OJDZ5{min-width:41px}.input__ylsuY .label__Uty0i{display:block;font-weight:bold}.input__ylsuY .text__OJDZ5{width:100%;background-color:rgba(0,0,0,0);border:0;outline:none;padding:0;font-size:1rem}.material-design .input__ylsuY .text__OJDZ5{color:#212121;background-image:linear-gradient(to top, transparent 1px, #afafaf 1px);background-size:100% 2px;background-repeat:no-repeat;background-position:center bottom;padding-bottom:2px}.material-design .input__ylsuY .text__OJDZ5:read-only,.material-design .input__ylsuY .text__OJDZ5:read-only:focus{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.material-design .input__ylsuY .text__OJDZ5:focus{background-image:linear-gradient(var(--flavor-accent), var(--flavor-accent)),linear-gradient(to top, transparent 1px, #afafaf 1px)}.flat-design .input__ylsuY .text__OJDZ5{color:#1f1f21}.flat-design .input__ylsuY .text__OJDZ5,.flat-design .input__ylsuY .text__OJDZ5:focus{border-bottom:1px solid var(--border-light)}.input__ylsuY.hiddenInput__KSMQB .text__OJDZ5{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.input__ylsuY.hiddenInput__KSMQB.noFocusHint__bBtc8 .text__OJDZ5:focus{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.input__ylsuY .error__LVBul{font-size:.7rem;--text-primary-default-color: var(--text-error) }`, "",{"version":3,"sources":["webpack://./src/Components/FormElements/Input/input.scss","webpack://./src/scss/_designMixin.scss"],"names":[],"mappings":"AAGA,cACE,UAAA,CAEA,4BACE,YAAA,CACA,YAAA,CACA,0CACE,oBAAA,CACA,WAAA,CACA,aAAA,CACA,uBAAA,CACA,kBAAA,CAEF,yCAEE,cAAA,CAIJ,4BACE,aAAA,CACA,gBAAA,CAGF,2BACE,UAAA,CACA,8BAAA,CACA,QAAA,CACA,YAAA,CACA,SAAA,CACA,cAAA,CC7BS,4CDgCP,aAAA,CACA,sEAAA,CACA,wBAAA,CACA,2BAAA,CACA,iCAAA,CACA,kBAAA,CAEA,kHACE,qBAAA,CACA,qCAAA,CAGF,kDACE,kIAAA,CC7CK,wCDmDP,aAAA,CACA,sFACE,2CAAA,CAMJ,8CACE,qBAAA,CACA,qCAAA,CAKE,uEACE,qBAAA,CACA,qCAAA,CAMR,4BACE,eAAA,CACA,gDAAA","sourcesContent":["@import \"../../../scss/variables\";\n@import \"../../../scss/designMixin\";\n\n.input {\n width: 100%;\n\n &.inline {\n --basis: 50%;\n display: flex;\n .label {\n display: inline-block;\n flex-grow: 1;\n flex-shrink: 0;\n flex-basis: var(--basis);\n font-weight: normal;\n }\n .text {\n // 3 numbers\n min-width: 41px;\n }\n }\n\n .label {\n display: block;\n font-weight: bold;\n }\n\n .text {\n width: 100%;\n background-color: transparent;\n border: 0;\n outline: none;\n padding: 0;\n font-size: 1rem;\n\n @include design($material) {\n color: #212121;\n background-image: linear-gradient(to top, transparent 1px, #afafaf 1px);\n background-size: 100% 2px;\n background-repeat: no-repeat;\n background-position: center bottom;\n padding-bottom: 2px;\n\n &:read-only, &:read-only:focus {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n\n &:focus {\n background-image: linear-gradient(var(--flavor-accent), var(--flavor-accent)),\n linear-gradient(to top, transparent 1px, #afafaf 1px);\n }\n }\n\n @include design($flat) {\n color: #1f1f21;\n &, &:focus {\n border-bottom: 1px solid var(--border-light);\n }\n }\n }\n\n &.hiddenInput {\n .text {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n\n &.noFocusHint {\n .text {\n &:focus {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n }\n }\n }\n\n .error {\n font-size: 0.7rem;\n --text-primary-default-color: var(--text-error)\n }\n}\n","@use 'sass:selector';\n\n@mixin design($designName) {\n @if & {\n @at-root #{selector.nest(':global(.'+$designName+\")\", &)} {\n @content\n }\n } @else {\n :global(.#{$designName}) {\n @content\n }\n }\n}\n"],"sourceRoot":""}]);
1446
+ ___CSS_LOADER_EXPORT___.push([module.id, `.input__ylsuY{width:100%}.input__ylsuY.inline__CuO0B{--basis: 50%;display:flex}.input__ylsuY.inline__CuO0B .label__Uty0i{display:inline-block;flex-grow:1;flex-shrink:0;flex-basis:var(--basis);font-weight:normal}.input__ylsuY.inline__CuO0B .text__OJDZ5{min-width:41px}.input__ylsuY .label__Uty0i{display:block;font-weight:bold}.input__ylsuY .text__OJDZ5{width:100%;background-color:rgba(0,0,0,0);border:0;outline:none;padding:0;font-size:1rem}.material-design .input__ylsuY .text__OJDZ5{color:var(--input-text-color, #212121);background-image:linear-gradient(to top, transparent 1px, #afafaf 1px);background-size:100% 2px;background-repeat:no-repeat;background-position:center bottom;padding-bottom:2px}.material-design .input__ylsuY .text__OJDZ5:read-only,.material-design .input__ylsuY .text__OJDZ5:read-only:focus{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.material-design .input__ylsuY .text__OJDZ5:focus{background-image:linear-gradient(var(--flavor-accent), var(--flavor-accent)),linear-gradient(to top, transparent 1px, #afafaf 1px)}.flat-design .input__ylsuY .text__OJDZ5{color:var(--input-text-color, #1f1f21)}.flat-design .input__ylsuY .text__OJDZ5,.flat-design .input__ylsuY .text__OJDZ5:focus{border-bottom:1px solid var(--border-light)}.input__ylsuY.hiddenInput__KSMQB .text__OJDZ5{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.input__ylsuY.hiddenInput__KSMQB.noFocusHint__bBtc8 .text__OJDZ5:focus{background-image:none;border-bottom:1px solid rgba(0,0,0,0)}.input__ylsuY .error__LVBul{font-size:.7rem;--text-primary-default-color: var(--text-error) }`, "",{"version":3,"sources":["webpack://./src/Components/FormElements/Input/input.scss","webpack://./src/scss/_designMixin.scss"],"names":[],"mappings":"AAGA,cACE,UAAA,CAEA,4BACE,YAAA,CACA,YAAA,CACA,0CACE,oBAAA,CACA,WAAA,CACA,aAAA,CACA,uBAAA,CACA,kBAAA,CAEF,yCAEE,cAAA,CAIJ,4BACE,aAAA,CACA,gBAAA,CAGF,2BACE,UAAA,CACA,8BAAA,CACA,QAAA,CACA,YAAA,CACA,SAAA,CACA,cAAA,CC7BS,4CDgCP,sCAAA,CACA,sEAAA,CACA,wBAAA,CACA,2BAAA,CACA,iCAAA,CACA,kBAAA,CAEA,kHACE,qBAAA,CACA,qCAAA,CAGF,kDACE,kIAAA,CC7CK,wCDmDP,sCAAA,CACA,sFACE,2CAAA,CAMJ,8CACE,qBAAA,CACA,qCAAA,CAKE,uEACE,qBAAA,CACA,qCAAA,CAMR,4BACE,eAAA,CACA,gDAAA","sourcesContent":["@import \"../../../scss/variables\";\n@import \"../../../scss/designMixin\";\n\n.input {\n width: 100%;\n\n &.inline {\n --basis: 50%;\n display: flex;\n .label {\n display: inline-block;\n flex-grow: 1;\n flex-shrink: 0;\n flex-basis: var(--basis);\n font-weight: normal;\n }\n .text {\n // 3 numbers\n min-width: 41px;\n }\n }\n\n .label {\n display: block;\n font-weight: bold;\n }\n\n .text {\n width: 100%;\n background-color: transparent;\n border: 0;\n outline: none;\n padding: 0;\n font-size: 1rem;\n\n @include design($material) {\n color: var(--input-text-color, #212121);\n background-image: linear-gradient(to top, transparent 1px, #afafaf 1px);\n background-size: 100% 2px;\n background-repeat: no-repeat;\n background-position: center bottom;\n padding-bottom: 2px;\n\n &:read-only, &:read-only:focus {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n\n &:focus {\n background-image: linear-gradient(var(--flavor-accent), var(--flavor-accent)),\n linear-gradient(to top, transparent 1px, #afafaf 1px);\n }\n }\n\n @include design($flat) {\n color: var(--input-text-color, #1f1f21);\n &, &:focus {\n border-bottom: 1px solid var(--border-light);\n }\n }\n }\n\n &.hiddenInput {\n .text {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n\n &.noFocusHint {\n .text {\n &:focus {\n background-image: none;\n border-bottom: 1px solid transparent;\n }\n }\n }\n }\n\n .error {\n font-size: 0.7rem;\n --text-primary-default-color: var(--text-error)\n }\n}\n","@use 'sass:selector';\n\n@mixin design($designName) {\n @if & {\n @at-root #{selector.nest(':global(.'+$designName+\")\", &)} {\n @content\n }\n } @else {\n :global(.#{$designName}) {\n @content\n }\n }\n}\n"],"sourceRoot":""}]);
1447
1447
  // Exports
1448
1448
  ___CSS_LOADER_EXPORT___.locals = {
1449
1449
  "input": `input__ylsuY`,
@@ -1566,6 +1566,24 @@ ___CSS_LOADER_EXPORT___.locals = {
1566
1566
  module.exports = ___CSS_LOADER_EXPORT___;
1567
1567
 
1568
1568
 
1569
+ /***/ }),
1570
+
1571
+ /***/ 7666:
1572
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1573
+
1574
+ // Imports
1575
+ var ___CSS_LOADER_API_SOURCEMAP_IMPORT___ = __webpack_require__(1354);
1576
+ var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
1577
+ var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_SOURCEMAP_IMPORT___);
1578
+ // Module
1579
+ ___CSS_LOADER_EXPORT___.push([module.id, `.error__TgU4D{font-size:.7rem;--text-primary-default-color: var(--text-error) }`, "",{"version":3,"sources":["webpack://./src/Components/FormElements/formError.scss"],"names":[],"mappings":"AAAA,cACE,eAAA,CACA,gDAAA","sourcesContent":[".error {\n font-size: 0.7rem;\n --text-primary-default-color: var(--text-error)\n}\n"],"sourceRoot":""}]);
1580
+ // Exports
1581
+ ___CSS_LOADER_EXPORT___.locals = {
1582
+ "error": `error__TgU4D`
1583
+ };
1584
+ module.exports = ___CSS_LOADER_EXPORT___;
1585
+
1586
+
1569
1587
  /***/ }),
1570
1588
 
1571
1589
  /***/ 4325:
@@ -3273,6 +3291,28 @@ module.exports = StyleContext;
3273
3291
  if (false) { var removeCss; }
3274
3292
 
3275
3293
 
3294
+ /***/ }),
3295
+
3296
+ /***/ 8704:
3297
+ /***/ ((module, exports, __webpack_require__) => {
3298
+
3299
+
3300
+ var refs = 0;
3301
+ var css = __webpack_require__(7666);
3302
+ var insertCss = __webpack_require__(1352);
3303
+ var content = typeof css === 'string' ? [[module.id, css, '']] : css;
3304
+
3305
+ exports = module.exports = css.locals || {};
3306
+ exports._getContent = function() { return content; };
3307
+ exports._getCss = function() { return '' + css; };
3308
+ exports._insertCss = function(options) { return insertCss(content, options) };
3309
+
3310
+ // Hot Module Replacement
3311
+ // https://webpack.github.io/docs/hot-module-replacement
3312
+ // Only activated in browser context
3313
+ if (false) { var removeCss; }
3314
+
3315
+
3276
3316
  /***/ }),
3277
3317
 
3278
3318
  /***/ 4023:
@@ -4763,7 +4803,7 @@ module.exports = baseForOwn;
4763
4803
  /***/ 7422:
4764
4804
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
4765
4805
 
4766
- var castPath = __webpack_require__(1769),
4806
+ var castPath = __webpack_require__(4150),
4767
4807
  toKey = __webpack_require__(7797);
4768
4808
 
4769
4809
  /**
@@ -5653,7 +5693,7 @@ module.exports = castFunction;
5653
5693
 
5654
5694
  /***/ }),
5655
5695
 
5656
- /***/ 1769:
5696
+ /***/ 4150:
5657
5697
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
5658
5698
 
5659
5699
  var isArray = __webpack_require__(6449),
@@ -6732,7 +6772,7 @@ module.exports = getValue;
6732
6772
  /***/ 9326:
6733
6773
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
6734
6774
 
6735
- var castPath = __webpack_require__(1769),
6775
+ var castPath = __webpack_require__(4150),
6736
6776
  isArguments = __webpack_require__(2428),
6737
6777
  isArray = __webpack_require__(6449),
6738
6778
  isIndex = __webpack_require__(361),
@@ -10008,6 +10048,7 @@ __webpack_require__.d(__webpack_exports__, {
10008
10048
  Checkbox: () => (/* reexport */ Checkbox_tmp),
10009
10049
  Clickable: () => (/* reexport */ ClickableMemo),
10010
10050
  ColorInput: () => (/* reexport */ ColorInputMemo),
10051
+ ColorInputController: () => (/* reexport */ ColorInputController),
10011
10052
  ConfirmDialog: () => (/* reexport */ ConfirmDialogMemo),
10012
10053
  Container: () => (/* reexport */ Container),
10013
10054
  Dialog: () => (/* reexport */ DialogMemo),
@@ -10018,8 +10059,10 @@ __webpack_require__.d(__webpack_exports__, {
10018
10059
  DragItem: () => (/* reexport */ DragItemMemo),
10019
10060
  DropArea: () => (/* reexport */ DropArea),
10020
10061
  FileInput: () => (/* reexport */ FileInput),
10062
+ FileInputController: () => (/* reexport */ FileInputController),
10021
10063
  Flavor: () => (/* reexport */ Flavor),
10022
10064
  Flex: () => (/* reexport */ Flex_tmp),
10065
+ FormError: () => (/* reexport */ FormError),
10023
10066
  FullScreen: () => (/* reexport */ FullScreen),
10024
10067
  Grid: () => (/* reexport */ GridMemo),
10025
10068
  GridItem: () => (/* reexport */ GridItemMemo),
@@ -10092,6 +10135,7 @@ __webpack_require__.d(__webpack_exports__, {
10092
10135
  useConfirmDialog: () => (/* reexport */ useConfirmDialog),
10093
10136
  useDebounced: () => (/* reexport */ useDebounced),
10094
10137
  useDelayed: () => (/* reexport */ useDelayed),
10138
+ useDelayedEffect: () => (/* reexport */ useDelayedEffect),
10095
10139
  useDelayedState: () => (/* reexport */ useDelayedState),
10096
10140
  useDialog: () => (/* reexport */ useDialog),
10097
10141
  useInViewport: () => (/* reexport */ useInViewport),
@@ -11562,6 +11606,32 @@ const Button = withMemo(function Button(_a) {
11562
11606
  // EXTERNAL MODULE: ./src/Components/FormElements/CheckBox/checkbox.scss
11563
11607
  var CheckBox_checkbox = __webpack_require__(4675);
11564
11608
  var checkbox_default = /*#__PURE__*/__webpack_require__.n(CheckBox_checkbox);
11609
+ // EXTERNAL MODULE: ./src/Components/FormElements/formError.scss
11610
+ var formError = __webpack_require__(8704);
11611
+ var formError_default = /*#__PURE__*/__webpack_require__.n(formError);
11612
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/FormError.tsx
11613
+
11614
+
11615
+
11616
+
11617
+
11618
+ const FormError = withMemo(function FormError({
11619
+ error
11620
+ }) {
11621
+ // Refs
11622
+ // States/Variables/Selectors
11623
+ // Dispatch
11624
+ // Callbacks
11625
+ // Effects
11626
+ // Other
11627
+ // RenderFunctions
11628
+ if (!error) {
11629
+ return null;
11630
+ }
11631
+ return /*#__PURE__*/external_react_default().createElement(BlockMemo, {
11632
+ className: (formError_default()).error
11633
+ }, /*#__PURE__*/external_react_default().createElement(tmp, null, error));
11634
+ }, (formError_default()));
11565
11635
  ;// CONCATENATED MODULE: ./src/Components/FormElements/CheckBox/Checkbox.tsx
11566
11636
  function Checkbox_extends() { return Checkbox_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, Checkbox_extends.apply(null, arguments); }
11567
11637
  var Checkbox_rest = undefined && undefined.__rest || function (s, e) {
@@ -11578,6 +11648,7 @@ var Checkbox_rest = undefined && undefined.__rest || function (s, e) {
11578
11648
 
11579
11649
 
11580
11650
 
11651
+
11581
11652
  function Checkbox(_a) {
11582
11653
  // Variables
11583
11654
  var {
@@ -11586,9 +11657,10 @@ function Checkbox(_a) {
11586
11657
  isLabelBeforeCheckbox = false,
11587
11658
  id,
11588
11659
  className,
11660
+ error,
11589
11661
  style
11590
11662
  } = _a,
11591
- props = Checkbox_rest(_a, ["children", "label", "isLabelBeforeCheckbox", "id", "className", "style"]);
11663
+ props = Checkbox_rest(_a, ["children", "label", "isLabelBeforeCheckbox", "id", "className", "error", "style"]);
11592
11664
  // States
11593
11665
  // Refs
11594
11666
  // Callbacks
@@ -11625,7 +11697,9 @@ function Checkbox(_a) {
11625
11697
  className: (checkbox_default()).checkmark
11626
11698
  }), /*#__PURE__*/external_react_.createElement("span", {
11627
11699
  className: (checkbox_default()).label
11628
- }, label)));
11700
+ }, label), /*#__PURE__*/external_react_.createElement(FormError, {
11701
+ error: error
11702
+ })));
11629
11703
  }
11630
11704
  const Checkbox_tmp = withMemo(Checkbox, (checkbox_default()));
11631
11705
 
@@ -23035,6 +23109,7 @@ var ColorInput_rest = undefined && undefined.__rest || function (s, e) {
23035
23109
 
23036
23110
 
23037
23111
 
23112
+
23038
23113
  function convertToHex(color, disableAlpha) {
23039
23114
  let newColor = `#${color.r.toString(16).padStart(2, '0')}${color.g.toString(16).padStart(2, '0')}${color.b.toString(16).padStart(2, '0')}`;
23040
23115
  if (color.a !== undefined && !disableAlpha) {
@@ -23056,10 +23131,11 @@ function ColorInput(_a) {
23056
23131
  onClose,
23057
23132
  disableAlpha,
23058
23133
  presetColors,
23134
+ error,
23059
23135
  sharedColorKey = "default",
23060
23136
  disabled
23061
23137
  } = _a,
23062
- otherProps = ColorInput_rest(_a, ["defaultValue", "value", "label", "onChangeColor", "onChangeColorComplete", "onOpen", "onClose", "disableAlpha", "presetColors", "sharedColorKey", "disabled"]);
23138
+ otherProps = ColorInput_rest(_a, ["defaultValue", "value", "label", "onChangeColor", "onChangeColorComplete", "onOpen", "onClose", "disableAlpha", "presetColors", "error", "sharedColorKey", "disabled"]);
23063
23139
  // Refs
23064
23140
  const modalRef = (0,external_react_.useRef)(null);
23065
23141
  // States
@@ -23127,7 +23203,7 @@ function ColorInput(_a) {
23127
23203
  }, [position]);
23128
23204
  // Other
23129
23205
  // Render Functions
23130
- return /*#__PURE__*/external_react_.createElement("span", {
23206
+ return /*#__PURE__*/external_react_.createElement(external_react_.Fragment, null, /*#__PURE__*/external_react_.createElement("span", {
23131
23207
  className: (colorInput_default()).colorInput
23132
23208
  }, /*#__PURE__*/external_react_.createElement(Menu, {
23133
23209
  x: position.x,
@@ -23149,6 +23225,8 @@ function ColorInput(_a) {
23149
23225
  backgroundColor: colVal
23150
23226
  },
23151
23227
  className: (colorInput_default()).preview
23228
+ })), /*#__PURE__*/external_react_.createElement(FormError, {
23229
+ error: error
23152
23230
  }));
23153
23231
  }
23154
23232
  // Need ColorInputMemo for autocompletion of phpstorm
@@ -23156,95 +23234,110 @@ const ColorInputMemo = withMemo(ColorInput, (colorInput_default()));
23156
23234
 
23157
23235
  ;// CONCATENATED MODULE: external "react-hook-form"
23158
23236
  const external_react_hook_form_namespaceObject = require("react-hook-form");
23159
- // EXTERNAL MODULE: ./src/Components/LoadingCircle/loadingCircle.scss
23160
- var loadingCircle = __webpack_require__(5391);
23161
- var loadingCircle_default = /*#__PURE__*/__webpack_require__.n(loadingCircle);
23162
- ;// CONCATENATED MODULE: ./src/Components/LoadingCircle/LoadingCircle.tsx
23237
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/withHookController.tsx
23238
+ function withHookController_extends() { return withHookController_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, withHookController_extends.apply(null, arguments); }
23239
+ var withHookController_rest = undefined && undefined.__rest || function (s, e) {
23240
+ var t = {};
23241
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23242
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23243
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
23244
+ }
23245
+ return t;
23246
+ };
23163
23247
 
23164
23248
 
23165
23249
 
23166
23250
 
23167
- function LoadingCircle({
23168
- size = 32,
23169
- className,
23170
- style
23171
- }) {
23172
- // Variables
23173
- // States
23174
- // Refs
23175
- // Callbacks
23176
- // Effects
23177
- // Other
23178
- // Render Functions
23179
- return /*#__PURE__*/external_react_.createElement("svg", {
23180
- className: classnames_default()((loadingCircle_default()).loadingCircle, className),
23181
- viewBox: `0 0 ${size} ${size}`,
23182
- width: size,
23183
- height: size,
23184
- style: style
23185
- }, /*#__PURE__*/external_react_.createElement("circle", {
23186
- cx: "50%",
23187
- cy: "50%",
23188
- r: "40%",
23189
- fill: "none",
23190
- className: (loadingCircle_default()).spinner
23191
- }));
23251
+ function withHookController(Comp, onChangeProp, emptyValue = null) {
23252
+ function WithHookComponent(_a, ref) {
23253
+ var _b, _c, _d;
23254
+ var {
23255
+ name
23256
+ } = _a,
23257
+ otherProps = withHookController_rest(_a, ["name"]);
23258
+ const children = "children" in otherProps ? otherProps.children : undefined;
23259
+ const {
23260
+ field,
23261
+ fieldState
23262
+ } = (0,external_react_hook_form_namespaceObject.useController)({
23263
+ name
23264
+ });
23265
+ const {
23266
+ clearErrors
23267
+ } = (0,external_react_hook_form_namespaceObject.useFormContext)();
23268
+ const composedRef = useComposedRef(ref, field.ref);
23269
+ const errorMessage = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
23270
+ const internalOnChange = (0,external_react_.useCallback)(arg => {
23271
+ clearErrors(name);
23272
+ field.onChange(arg);
23273
+ }, [clearErrors, field, name]);
23274
+ const onChangeProps = {
23275
+ [onChangeProp]: internalOnChange
23276
+ };
23277
+ return (
23278
+ /*#__PURE__*/
23279
+ // @ts-expect-error Because of the prop spreading, typescript is really confused here
23280
+ external_react_default().createElement(Comp, withHookController_extends({}, otherProps, {
23281
+ name: field.name,
23282
+ onBlur: field.onBlur,
23283
+ disabled: field.disabled
23284
+ }, onChangeProps, {
23285
+ value: (_c = field.value) !== null && _c !== void 0 ? _c : emptyValue,
23286
+ checked: (_d = field.value) !== null && _d !== void 0 ? _d : emptyValue,
23287
+ ref: composedRef,
23288
+ error: errorMessage
23289
+ }), children)
23290
+ );
23291
+ }
23292
+ return withForwardRef(WithHookComponent);
23192
23293
  }
23193
- const LoadingCircleMemo = withMemo(LoadingCircle, (loadingCircle_default()));
23294
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/ColorInputController.ts
23194
23295
 
23195
- // EXTERNAL MODULE: ./src/Components/LoadingArea/loadingArea.scss
23196
- var loadingArea = __webpack_require__(5455);
23197
- var loadingArea_default = /*#__PURE__*/__webpack_require__.n(loadingArea);
23198
- ;// CONCATENATED MODULE: ./src/Components/LoadingArea/LoadingArea.tsx
23199
23296
 
23297
+ const ColorInputController = withHookController(ColorInputMemo, "onChangeColor");
23298
+ // EXTERNAL MODULE: ./src/Components/FormElements/Input/FileInput/fileInput.scss
23299
+ var fileInput = __webpack_require__(4372);
23300
+ var fileInput_default = /*#__PURE__*/__webpack_require__.n(fileInput);
23301
+ ;// CONCATENATED MODULE: ./src/Components/Layout/Grow.tsx
23200
23302
 
23201
23303
 
23202
23304
 
23203
23305
 
23204
- function LoadingArea({
23205
- loading,
23206
- fullWidth = false,
23207
- fullSize = false,
23208
- fullHeight = false,
23209
- opacity = 0.65,
23306
+ const Grow = withForwardRef(function Grow({
23210
23307
  className,
23308
+ children,
23309
+ center = false,
23211
23310
  style,
23212
- children
23213
- }) {
23311
+ weight = 1
23312
+ }, ref) {
23214
23313
  // Variables
23215
- if (fullSize) {
23216
- fullHeight = true;
23217
- fullWidth = true;
23218
- }
23219
23314
  // States
23220
23315
  // Refs
23221
23316
  // Callbacks
23222
23317
  // Effects
23223
23318
  // Other
23224
23319
  // Render Functions
23225
- return /*#__PURE__*/external_react_.createElement("span", {
23226
- className: classnames_default()((loadingArea_default()).loadingArea, className, {
23227
- 'full-height': fullHeight,
23228
- 'full-width': fullWidth
23229
- }),
23320
+ return /*#__PURE__*/external_react_.createElement("div", {
23321
+ ref: ref,
23322
+ className: classnames_default()((layout_default()).grow, {
23323
+ [(layout_default()).center]: center,
23324
+ [(layout_default()).weight0]: weight === 0,
23325
+ [(layout_default()).weight1]: weight === 1,
23326
+ [(layout_default()).weight2]: weight === 2,
23327
+ [(layout_default()).weight3]: weight === 3,
23328
+ [(layout_default()).weight4]: weight === 4,
23329
+ [(layout_default()).weight5]: weight === 5,
23330
+ [(layout_default()).weight6]: weight === 6
23331
+ }, className),
23230
23332
  style: style
23231
- }, children, loading ? /*#__PURE__*/external_react_.createElement("span", {
23232
- className: (loadingArea_default()).curtain,
23233
- style: {
23234
- opacity
23235
- }
23236
- }, /*#__PURE__*/external_react_.createElement(LoadingCircleMemo, null)) : null);
23237
- }
23238
- const LoadingAreaMemo = withMemo(LoadingArea, (loadingArea_default()));
23239
-
23240
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/SendFormContext.ts
23241
-
23242
- const SendFormContext = /*#__PURE__*/(0,external_react_.createContext)(undefined);
23243
- function useSendFormContext() {
23244
- return (0,external_react_.useContext)(SendFormContext);
23245
- }
23246
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/HookForm.tsx
23247
- var HookForm_rest = undefined && undefined.__rest || function (s, e) {
23333
+ }, children);
23334
+ }, (layout_default()));
23335
+ // EXTERNAL MODULE: ./src/Components/Image/image.scss
23336
+ var Image_image = __webpack_require__(6435);
23337
+ var image_default = /*#__PURE__*/__webpack_require__.n(Image_image);
23338
+ ;// CONCATENATED MODULE: ./src/Components/Image/Image.tsx
23339
+ function Image_extends() { return Image_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, Image_extends.apply(null, arguments); }
23340
+ var Image_rest = undefined && undefined.__rest || function (s, e) {
23248
23341
  var t = {};
23249
23342
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23250
23343
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
@@ -23256,64 +23349,62 @@ var HookForm_rest = undefined && undefined.__rest || function (s, e) {
23256
23349
 
23257
23350
 
23258
23351
 
23259
-
23260
- const HookForm = withMemo(function HookForm(_a) {
23261
- // Refs
23352
+ function Image(_a) {
23353
+ // Variables
23262
23354
  var {
23263
- children,
23264
- onSend
23355
+ src,
23356
+ alt = '',
23357
+ className,
23358
+ style
23265
23359
  } = _a,
23266
- methods = HookForm_rest(_a, ["children", "onSend"]);
23267
- // States/Variables/Selectors
23268
- // Create an inner, as the onSend may have other attributes
23269
- const innerOnSend = (0,external_react_.useCallback)(() => onSend === null || onSend === void 0 ? void 0 : onSend(), [onSend]);
23270
- // Dispatch
23360
+ otherProps = Image_rest(_a, ["src", "alt", "className", "style"]);
23361
+ // Refs
23362
+ // States
23363
+ // Selectors
23271
23364
  // Callbacks
23272
23365
  // Effects
23273
23366
  // Other
23274
- // RenderFunctions
23275
- return /*#__PURE__*/external_react_default().createElement(external_react_hook_form_namespaceObject.FormProvider, methods, /*#__PURE__*/external_react_default().createElement(SendFormContext.Provider, {
23276
- value: innerOnSend
23277
- }, /*#__PURE__*/external_react_default().createElement(LoadingAreaMemo, {
23278
- loading: methods.formState.isSubmitting,
23279
- __allowChildren: "all"
23280
- }, children)));
23281
- });
23282
- // EXTERNAL MODULE: ./src/Components/FormElements/Input/input.scss
23283
- var input = __webpack_require__(2923);
23284
- var input_default = /*#__PURE__*/__webpack_require__.n(input);
23285
- ;// CONCATENATED MODULE: ./src/Components/FormElements/hooks/useOnChangeDone.ts
23286
-
23287
- function useOnChangeDone(onChangeDone, ref) {
23288
- const innerRef = (0,external_react_.useRef)(null);
23289
- const usedRef = ref !== null && ref !== void 0 ? ref : innerRef;
23290
- (0,external_react_.useEffect)(() => {
23291
- const elem = usedRef.current;
23292
- elem === null || elem === void 0 ? void 0 : elem.addEventListener('change', onChangeDone);
23293
- return () => {
23294
- elem === null || elem === void 0 ? void 0 : elem.removeEventListener('change', onChangeDone);
23295
- };
23296
- }, [onChangeDone, usedRef]);
23297
- return usedRef;
23367
+ // Render Functions
23368
+ return /*#__PURE__*/external_react_.createElement("img", Image_extends({
23369
+ src: src,
23370
+ alt: alt,
23371
+ className: classnames_default()((image_default()).image, className),
23372
+ style: style
23373
+ }, otherProps));
23298
23374
  }
23299
- ;// CONCATENATED MODULE: ./src/Components/Hooks/useDebounced.ts
23375
+ // Need ImageMemo for autocompletion of phpstorm
23376
+ const ImageMemo = withMemo(Image, (image_default()));
23300
23377
 
23301
- function useDebounced(callback, dependencies, delay = 100) {
23302
- const [shared] = (0,external_react_.useState)({
23303
- timeout: undefined
23304
- });
23305
- // eslint-disable-next-line react-hooks/exhaustive-deps
23306
- const realCB = (0,external_react_.useCallback)(callback, dependencies);
23307
- return (0,external_react_.useCallback)((...newArgs) => {
23308
- if (shared.timeout === undefined) {
23309
- realCB(...newArgs);
23310
- shared.timeout = setTimeout(() => shared.timeout = undefined, delay);
23378
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx
23379
+ function MultipleFileInput_extends() { return MultipleFileInput_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, MultipleFileInput_extends.apply(null, arguments); }
23380
+ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
23381
+ function adopt(value) {
23382
+ return value instanceof P ? value : new P(function (resolve) {
23383
+ resolve(value);
23384
+ });
23385
+ }
23386
+ return new (P || (P = Promise))(function (resolve, reject) {
23387
+ function fulfilled(value) {
23388
+ try {
23389
+ step(generator.next(value));
23390
+ } catch (e) {
23391
+ reject(e);
23392
+ }
23311
23393
  }
23312
- }, [delay, realCB, shared]);
23313
- }
23314
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/Input.tsx
23315
- function Input_extends() { return Input_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, Input_extends.apply(null, arguments); }
23316
- var Input_rest = undefined && undefined.__rest || function (s, e) {
23394
+ function rejected(value) {
23395
+ try {
23396
+ step(generator["throw"](value));
23397
+ } catch (e) {
23398
+ reject(e);
23399
+ }
23400
+ }
23401
+ function step(result) {
23402
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23403
+ }
23404
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23405
+ });
23406
+ };
23407
+ var MultipleFileInput_rest = undefined && undefined.__rest || function (s, e) {
23317
23408
  var t = {};
23318
23409
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23319
23410
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
@@ -23333,142 +23424,206 @@ var Input_rest = undefined && undefined.__rest || function (s, e) {
23333
23424
 
23334
23425
 
23335
23426
 
23336
- const Input = withForwardRef(function Input(_a, ref) {
23427
+
23428
+
23429
+
23430
+
23431
+ const MultipleFileInput = withMemo(function MultipleImageInput(_a) {
23337
23432
  // Variables
23338
23433
  var {
23339
- label,
23340
23434
  className,
23341
23435
  style,
23342
- onKeyDown,
23343
- inline = false,
23344
23436
  value,
23437
+ label,
23438
+ mimeTypes = ['image/*'],
23439
+ maxFiles = 1,
23440
+ maxSizePerFile = 1024 * 1024 * 10,
23441
+ allowOverride = maxFiles === 1,
23442
+ onError,
23443
+ showDeleteButton = true,
23345
23444
  error,
23346
- onChangeText,
23347
- onEnter
23445
+ "data-test-id": testId
23348
23446
  } = _a,
23349
- otherProps = Input_rest(_a, ["label", "className", "style", "onKeyDown", "inline", "value", "error", "onChangeText", "onEnter"]);
23447
+ otherProps = MultipleFileInput_rest(_a, ["className", "style", "value", "label", "mimeTypes", "maxFiles", "maxSizePerFile", "allowOverride", "onError", "showDeleteButton", "error", "data-test-id"]);
23448
+ // Refs
23449
+ const inputRef = (0,external_react_.useRef)(null);
23450
+ const indexRef = (0,external_react_.useRef)(undefined);
23350
23451
  // States
23351
- const usedValue = (0,external_react_.useMemo)(() => {
23352
- if (otherProps.type !== "number" || typeof value === "number") {
23353
- return value;
23354
- }
23355
- if (typeof value === "string") {
23356
- if (value === "-") {
23357
- return value;
23358
- }
23359
- const numberValue = parseFloat(value);
23360
- if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {
23361
- if (otherProps.max !== undefined && numberValue > Number(otherProps.max)) {
23362
- return otherProps.max;
23363
- }
23364
- if (otherProps.min !== undefined && numberValue < Number(otherProps.min)) {
23365
- return otherProps.min;
23366
- }
23367
- }
23368
- if (!Number.isNaN(Number(value))) {
23369
- // Do not parse to allow ., and so on
23370
- return value;
23452
+ // Selectors
23453
+ // Callbacks
23454
+ const checkMimeType = (0,external_react_.useCallback)(fileType => {
23455
+ return mimeTypes.some(type => {
23456
+ if (type === '*/*' || type === '*') {
23457
+ return true;
23371
23458
  }
23372
- if (!Number.isNaN(numberValue)) {
23373
- return parseFloat(value);
23459
+ if (type.endsWith('/*')) {
23460
+ return fileType.startsWith(type.substring(0, type.length - 2));
23374
23461
  }
23462
+ return fileType === type;
23463
+ });
23464
+ }, [mimeTypes]);
23465
+ const [onChangeFiles, props] = useListenerWithExtractedProps('onChangeFiles', otherProps);
23466
+ const getBase64 = (0,external_react_.useCallback)(inputFiles => {
23467
+ const promises = inputFiles.map(file => new Promise((resolve, reject) => {
23468
+ const reader = new FileReader();
23469
+ reader.onload = () => {
23470
+ resolve(reader.result);
23471
+ };
23472
+ reader.onerror = reject;
23473
+ reader.readAsDataURL(file);
23474
+ }));
23475
+ return Promise.all(promises);
23476
+ }, []);
23477
+ const onNewFiles = (0,external_react_.useCallback)((newFiles, index) => __awaiter(this, void 0, void 0, function* () {
23478
+ if (newFiles.some(file => !checkMimeType(file.type))) {
23479
+ onError === null || onError === void 0 ? void 0 : onError('Eine Datei ist im falschen Format');
23480
+ return;
23375
23481
  }
23376
- return "";
23377
- }, [value, otherProps.max, otherProps.min, otherProps.type]);
23378
- // Refs
23379
- const innerRef = (0,external_react_.useRef)(null);
23380
- const refFunction = useComposedRef(ref, innerRef);
23381
- // Callbacks
23382
- const sendForm = useSendFormContext();
23383
- onEnter !== null && onEnter !== void 0 ? onEnter : onEnter = sendForm;
23384
- const [onChangeWithData, otherPropsWithoutOnchange] = useListenerWithExtractedProps('onChange', otherProps);
23385
- const onChange = (0,external_react_.useCallback)(e => {
23386
- if (onChangeText) {
23387
- if (otherProps.type === "number") {
23388
- if (e.currentTarget.value === "-") {
23389
- onChangeText(e.currentTarget.value);
23390
- return;
23391
- }
23392
- const val = !Number.isNaN(Number(e.currentTarget.value)) ? e.currentTarget.value : !Number.isNaN(parseFloat(e.currentTarget.value)) ? String(parseFloat(e.currentTarget.value)) : "";
23393
- onChangeText(val);
23394
- } else {
23395
- onChangeText(e.currentTarget.value);
23396
- }
23482
+ if (newFiles.length + value.length > maxFiles && (!allowOverride || index === undefined || index + newFiles.length > maxFiles)) {
23483
+ onError === null || onError === void 0 ? void 0 : onError(`Es sind nur ${maxFiles} Dateien erlaubt.`);
23484
+ return;
23397
23485
  }
23398
- onChangeWithData(e);
23399
- }, [onChangeWithData, onChangeText, otherProps.type]);
23400
- const [onBlur, otherPropsWithoutBlur] = useListenerWithExtractedProps('onBlur', otherPropsWithoutOnchange);
23401
- const [onChangeDoneWithoutDeboune, otherPropsWithoutData] = useListenerWithExtractedProps('onChangeDone', otherPropsWithoutBlur);
23402
- const onChangeDone = useDebounced(onChangeDoneWithoutDeboune, [onChangeDoneWithoutDeboune]);
23403
- const realOnKeyDown = (0,external_react_.useCallback)(e => {
23404
- onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
23405
- if (onEnter && e.key === 'Enter' && !e.defaultPrevented) {
23406
- if (otherProps.type === "number") {
23407
- const stringValue = e.target.value;
23408
- const val = !Number.isNaN(Number(stringValue)) ? stringValue : !Number.isNaN(parseFloat(stringValue)) ? String(parseFloat(stringValue)) : "";
23409
- onEnter(val);
23410
- } else {
23411
- onEnter(e.target.value);
23412
- }
23486
+ if (maxSizePerFile && newFiles.some(file => file.size > maxSizePerFile)) {
23487
+ onError === null || onError === void 0 ? void 0 : onError(`Eine Datei ist zu groß. Jede Datei darf nur ${maxSizePerFile / 1024 / 1024}MB groß sein.`);
23488
+ return;
23413
23489
  }
23414
- if (otherProps.type === "number") {
23415
- const step = otherProps.step ? Number(otherProps.step) : 1;
23416
- if (e.key === "ArrowUp") {
23417
- let newValue = (parseFloat(e.currentTarget.value) || 0) + step;
23418
- if (otherProps.max !== undefined && newValue > Number(otherProps.max)) {
23419
- newValue = Number(otherProps.max);
23420
- }
23421
- e.currentTarget.value = newValue.toString();
23422
- onChange(e);
23423
- } else if (e.key === "ArrowDown") {
23424
- let newValue = (parseFloat(e.currentTarget.value) || 0) - step;
23425
- if (otherProps.min !== undefined && newValue < Number(otherProps.min)) {
23426
- newValue = Number(otherProps.min);
23490
+ const newUrls = yield getBase64(newFiles);
23491
+ const newValue = newFiles.map((file, fileIndex) => ({
23492
+ name: file.name,
23493
+ src: newUrls[fileIndex],
23494
+ type: file.type,
23495
+ blob: file
23496
+ }));
23497
+ if (newFiles.length + value.length > maxFiles && index !== undefined) {
23498
+ const onChangeFilesValue = [...value];
23499
+ onChangeFilesValue.splice(index, newFiles.length, ...newValue);
23500
+ onChangeFiles(onChangeFilesValue);
23501
+ } else {
23502
+ onChangeFiles([...value, ...newValue]);
23503
+ }
23504
+ }), [allowOverride, checkMimeType, getBase64, maxFiles, maxSizePerFile, onChangeFiles, onError, value]);
23505
+ const onInputChange = (0,external_react_.useCallback)(e => __awaiter(this, void 0, void 0, function* () {
23506
+ const index = indexRef.current;
23507
+ indexRef.current = undefined;
23508
+ if (!e.target.files || e.target.files.length === 0) {
23509
+ return;
23510
+ }
23511
+ const newFiles = Array.from(e.target.files);
23512
+ yield onNewFiles(newFiles, index);
23513
+ }), [onNewFiles]);
23514
+ const removeFile = (0,external_react_.useCallback)((_, index) => {
23515
+ if (index >= 0 && index < value.length) {
23516
+ const newData = [...value];
23517
+ newData.splice(index, 1);
23518
+ onChangeFiles(newData);
23519
+ }
23520
+ }, [onChangeFiles, value]);
23521
+ const onDrop = (0,external_react_.useCallback)((event, index) => __awaiter(this, void 0, void 0, function* () {
23522
+ event.preventDefault();
23523
+ const files = [];
23524
+ if (event.dataTransfer.items) {
23525
+ for (let i = 0; i < event.dataTransfer.items.length; i++) {
23526
+ if (event.dataTransfer.items[i].kind === 'file') {
23527
+ const file = event.dataTransfer.items[i].getAsFile();
23528
+ if (file) {
23529
+ files.push(file);
23530
+ }
23427
23531
  }
23428
- e.currentTarget.value = newValue.toString();
23429
- onChange(e);
23532
+ }
23533
+ } else {
23534
+ for (let i = 0; i < event.dataTransfer.files.length; i++) {
23535
+ files.push(event.dataTransfer.files[i]);
23430
23536
  }
23431
23537
  }
23432
- }, [onKeyDown, onEnter, otherProps.type, otherProps.step, otherProps.max, otherProps.min, onChange]);
23433
- // Effects
23434
- useOnChangeDone(onChangeDone, innerRef);
23435
- (0,external_react_.useEffect)(() => {
23436
- // Add the onChangeDone for numbers
23437
- if (otherProps.type === "number") {
23438
- const elem = innerRef.current;
23439
- elem === null || elem === void 0 ? void 0 : elem.addEventListener('blur', onChangeDone);
23440
- return () => {
23441
- elem === null || elem === void 0 ? void 0 : elem.removeEventListener('blur', onChangeDone);
23442
- };
23538
+ yield onNewFiles(files, index);
23539
+ }), [onNewFiles]);
23540
+ const onDragOver = (0,external_react_.useCallback)(e => e.preventDefault(), []);
23541
+ const clickOnFile = (0,external_react_.useCallback)((_, index) => {
23542
+ if (index !== undefined && !allowOverride || !inputRef.current) {
23543
+ return;
23443
23544
  }
23444
- return undefined;
23445
- }, [ref, onChangeDone, innerRef, otherProps.type]);
23545
+ indexRef.current = index;
23546
+ inputRef.current.dispatchEvent(new MouseEvent("click"));
23547
+ }, [allowOverride]);
23548
+ // Effects
23446
23549
  // Other
23447
23550
  // Render Functions
23448
- return /*#__PURE__*/external_react_.createElement("label", {
23449
- className: classnames_default()((input_default()).input, {
23450
- [(input_default()).inline]: inline
23451
- }, className),
23452
- style: style
23453
- }, label ? /*#__PURE__*/external_react_.createElement("span", {
23454
- className: (input_default()).label
23455
- }, label) : null, /*#__PURE__*/external_react_.createElement("input", Input_extends({
23456
- inputMode: otherProps.type === "number" ? "numeric" : undefined
23457
- }, otherPropsWithoutData, {
23458
- value: usedValue,
23459
- type: otherProps.type === "number" ? "text" : otherProps.type,
23460
- ref: refFunction,
23461
- className: (input_default()).text,
23462
- onBlur: onBlur,
23463
- onChange: onChange,
23464
- onKeyDown: realOnKeyDown
23465
- })), error && /*#__PURE__*/external_react_.createElement(InlineBlockMemo, {
23466
- className: (input_default()).error
23467
- }, /*#__PURE__*/external_react_.createElement(tmp, null, error)));
23468
- }, (input_default()));
23469
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/withHookController.tsx
23470
- function withHookController_extends() { return withHookController_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, withHookController_extends.apply(null, arguments); }
23471
- var withHookController_rest = undefined && undefined.__rest || function (s, e) {
23551
+ const renderFile = file => {
23552
+ if (file.type.startsWith('image/')) {
23553
+ return /*#__PURE__*/external_react_.createElement(ImageMemo, {
23554
+ key: file.src,
23555
+ src: file.src,
23556
+ alt: file.name,
23557
+ className: classnames_default()((fileInput_default()).previewImage)
23558
+ });
23559
+ }
23560
+ // TODO style
23561
+ return /*#__PURE__*/external_react_.createElement(BlockMemo, {
23562
+ className: (fileInput_default()).previewText
23563
+ }, /*#__PURE__*/external_react_.createElement(Icon, {
23564
+ icon: free_solid_svg_icons_namespaceObject.faFile,
23565
+ className: (fileInput_default()).previewTextIcon
23566
+ }), /*#__PURE__*/external_react_.createElement(tmp, null, file.name));
23567
+ };
23568
+ if (error) {
23569
+ console.log("LOG-d error inside MultipleFileInput:", error);
23570
+ }
23571
+ return /*#__PURE__*/external_react_.createElement("span", {
23572
+ className: classnames_default()((fileInput_default()).fileInput, className),
23573
+ style: style,
23574
+ "data-test-id": testId
23575
+ }, /*#__PURE__*/external_react_.createElement(Flex_tmp, {
23576
+ horizontal: true
23577
+ }, !!label && /*#__PURE__*/external_react_.createElement(Grow, null, /*#__PURE__*/external_react_.createElement(tmp, null, label)), maxFiles > 1 && /*#__PURE__*/external_react_.createElement(InlineMemo, null, /*#__PURE__*/external_react_.createElement(tmp, null, value.length, "/", maxFiles))), /*#__PURE__*/external_react_.createElement(Flex_tmp, {
23578
+ horizontal: true,
23579
+ className: (fileInput_default()).previewContainer
23580
+ }, value === null || value === void 0 ? void 0 : value.map((file, index) => {
23581
+ return /*#__PURE__*/external_react_.createElement(Grow, {
23582
+ className: (fileInput_default()).preview,
23583
+ center: true,
23584
+ key: file.src
23585
+ }, /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23586
+ onDrop: onDrop,
23587
+ onDragOver: onDragOver,
23588
+ onDropData: index,
23589
+ onClick: clickOnFile,
23590
+ onClickData: index
23591
+ }, renderFile(file), showDeleteButton && /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23592
+ className: (fileInput_default()).previewRemove,
23593
+ onClick: removeFile,
23594
+ onClickData: index
23595
+ }, /*#__PURE__*/external_react_.createElement(Icon, {
23596
+ icon: free_solid_svg_icons_namespaceObject.faTimesCircle
23597
+ }))));
23598
+ }), /*#__PURE__*/external_react_.createElement(Grow, {
23599
+ className: classnames_default()((fileInput_default()).addFile, {
23600
+ [(fileInput_default()).hidden]: value.length >= maxFiles
23601
+ }),
23602
+ center: true
23603
+ }, /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23604
+ className: (fileInput_default()).addFileButton,
23605
+ onDrop: onDrop,
23606
+ onDragOver: onDragOver,
23607
+ onDropData: maxFiles,
23608
+ onClick: clickOnFile,
23609
+ __allowChildren: "html"
23610
+ }, /*#__PURE__*/external_react_.createElement(Icon, {
23611
+ icon: free_solid_svg_icons_namespaceObject.faPlus
23612
+ }), /*#__PURE__*/external_react_.createElement("input", MultipleFileInput_extends({}, props, {
23613
+ ref: inputRef,
23614
+ className: (fileInput_default()).value,
23615
+ onChange: onInputChange,
23616
+ value: "",
23617
+ type: "file",
23618
+ multiple: maxFiles > 1,
23619
+ accept: mimeTypes.join(', ')
23620
+ }))))), /*#__PURE__*/external_react_.createElement(FormError, {
23621
+ error: error
23622
+ }));
23623
+ }, (fileInput_default()));
23624
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/FileInput/FileInput.tsx
23625
+ function FileInput_extends() { return FileInput_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FileInput_extends.apply(null, arguments); }
23626
+ var FileInput_rest = undefined && undefined.__rest || function (s, e) {
23472
23627
  var t = {};
23473
23628
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23474
23629
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
@@ -23480,92 +23635,175 @@ var withHookController_rest = undefined && undefined.__rest || function (s, e) {
23480
23635
 
23481
23636
 
23482
23637
 
23483
- function withHookController(Comp, onChangeProp, emptyValue = null) {
23484
- function WithHookComponent(_a, ref) {
23485
- var _b, _c, _d;
23486
- var {
23487
- name
23488
- } = _a,
23489
- otherProps = withHookController_rest(_a, ["name"]);
23490
- const children = "children" in otherProps ? otherProps.children : undefined;
23491
- const {
23492
- field,
23493
- fieldState
23494
- } = (0,external_react_hook_form_namespaceObject.useController)({
23495
- name
23496
- });
23497
- const {
23498
- clearErrors
23499
- } = (0,external_react_hook_form_namespaceObject.useFormContext)();
23500
- const composedRef = useComposedRef(ref, field.ref);
23501
- const errorMessage = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message;
23502
- const internalOnChange = (0,external_react_.useCallback)(arg => {
23503
- clearErrors(name);
23504
- field.onChange(arg);
23505
- }, [clearErrors, field, name]);
23506
- const onChangeProps = {
23507
- [onChangeProp]: internalOnChange
23508
- };
23509
- return (
23510
- /*#__PURE__*/
23511
- // @ts-expect-error Because of the prop spreading, typescript is really confused here
23512
- external_react_default().createElement(Comp, withHookController_extends({}, otherProps, field, onChangeProps, {
23513
- value: (_c = field.value) !== null && _c !== void 0 ? _c : emptyValue,
23514
- checked: (_d = field.value) !== null && _d !== void 0 ? _d : emptyValue,
23515
- ref: composedRef,
23516
- error: errorMessage
23517
- }), children)
23518
- );
23638
+
23639
+
23640
+ const FileInput = withMemo(function FileInput(_a) {
23641
+ // Variables
23642
+ var {
23643
+ value,
23644
+ mimeType,
23645
+ required = false
23646
+ } = _a,
23647
+ otherProps = FileInput_rest(_a, ["value", "mimeType", "required"]);
23648
+ // Refs
23649
+ // States
23650
+ const mimeTypes = (0,external_react_.useMemo)(() => mimeType ? Array.isArray(mimeType) ? mimeType : [mimeType] : undefined, [mimeType]);
23651
+ const innerValue = (0,external_react_.useMemo)(() => value ? [value] : [], [value]);
23652
+ // Selectors
23653
+ // Callbacks
23654
+ const [onChangeFile, multipleFileInputProps] = useListenerWithExtractedProps("onChangeFile", otherProps);
23655
+ const onChangeFiles = (0,external_react_.useCallback)(files => {
23656
+ if (!required || files[0]) {
23657
+ console.log("LOG-d onChangeFile", files[0]);
23658
+ onChangeFile(files[0]);
23659
+ }
23660
+ }, [onChangeFile, required]);
23661
+ // Effects
23662
+ // Other
23663
+ // Render Functions
23664
+ return /*#__PURE__*/external_react_.createElement(MultipleFileInput, FileInput_extends({
23665
+ maxFiles: 1,
23666
+ value: innerValue,
23667
+ onChangeFiles: onChangeFiles,
23668
+ mimeTypes: mimeTypes,
23669
+ showDeleteButton: !required
23670
+ }, multipleFileInputProps));
23671
+ }, (fileInput_default()));
23672
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/FileInputController.tsx
23673
+ function FileInputController_extends() { return FileInputController_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FileInputController_extends.apply(null, arguments); }
23674
+ var FileInputController_rest = undefined && undefined.__rest || function (s, e) {
23675
+ var t = {};
23676
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23677
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
23678
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
23519
23679
  }
23520
- return withForwardRef(WithHookComponent);
23680
+ return t;
23681
+ };
23682
+
23683
+
23684
+
23685
+
23686
+ const FileInputController = withMemo(function FileInputController(_a) {
23687
+ var _b, _c, _d, _e, _f, _g, _h;
23688
+ var {
23689
+ name
23690
+ } = _a,
23691
+ otherProps = FileInputController_rest(_a, ["name"]);
23692
+ const {
23693
+ field,
23694
+ fieldState
23695
+ } = (0,external_react_hook_form_namespaceObject.useController)({
23696
+ name
23697
+ });
23698
+ const {
23699
+ errors
23700
+ } = (0,external_react_hook_form_namespaceObject.useFormState)();
23701
+ const {
23702
+ clearErrors
23703
+ } = (0,external_react_hook_form_namespaceObject.useFormContext)();
23704
+ const errorMessage = (_g = (_e = (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : (_d = errors[`${name}.src`]) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : (_f = errors[`${name}.name`]) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : (_h = errors[`${name}.type`]) === null || _h === void 0 ? void 0 : _h.message;
23705
+ const internalOnChange = (0,external_react_.useCallback)(arg => {
23706
+ clearErrors(name);
23707
+ clearErrors(`${name}.name`);
23708
+ clearErrors(`${name}.src`);
23709
+ clearErrors(`${name}.type`);
23710
+ field.onChange(arg);
23711
+ }, [clearErrors, field, name]);
23712
+ return /*#__PURE__*/external_react_default().createElement(FileInput, FileInputController_extends({}, otherProps, field, {
23713
+ onChangeFile: internalOnChange,
23714
+ value: field.value,
23715
+ error: errorMessage
23716
+ }));
23717
+ });
23718
+ // EXTERNAL MODULE: ./src/Components/LoadingCircle/loadingCircle.scss
23719
+ var loadingCircle = __webpack_require__(5391);
23720
+ var loadingCircle_default = /*#__PURE__*/__webpack_require__.n(loadingCircle);
23721
+ ;// CONCATENATED MODULE: ./src/Components/LoadingCircle/LoadingCircle.tsx
23722
+
23723
+
23724
+
23725
+
23726
+ function LoadingCircle({
23727
+ size = 32,
23728
+ className,
23729
+ style
23730
+ }) {
23731
+ // Variables
23732
+ // States
23733
+ // Refs
23734
+ // Callbacks
23735
+ // Effects
23736
+ // Other
23737
+ // Render Functions
23738
+ return /*#__PURE__*/external_react_.createElement("svg", {
23739
+ className: classnames_default()((loadingCircle_default()).loadingCircle, className),
23740
+ viewBox: `0 0 ${size} ${size}`,
23741
+ width: size,
23742
+ height: size,
23743
+ style: style
23744
+ }, /*#__PURE__*/external_react_.createElement("circle", {
23745
+ cx: "50%",
23746
+ cy: "50%",
23747
+ r: "40%",
23748
+ fill: "none",
23749
+ className: (loadingCircle_default()).spinner
23750
+ }));
23521
23751
  }
23522
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/InputController.ts
23752
+ const LoadingCircleMemo = withMemo(LoadingCircle, (loadingCircle_default()));
23523
23753
 
23754
+ // EXTERNAL MODULE: ./src/Components/LoadingArea/loadingArea.scss
23755
+ var loadingArea = __webpack_require__(5455);
23756
+ var loadingArea_default = /*#__PURE__*/__webpack_require__.n(loadingArea);
23757
+ ;// CONCATENATED MODULE: ./src/Components/LoadingArea/LoadingArea.tsx
23524
23758
 
23525
- const InputController = withHookController(Input, "onChangeText");
23526
- // EXTERNAL MODULE: ./src/Components/FormElements/Input/FileInput/fileInput.scss
23527
- var fileInput = __webpack_require__(4372);
23528
- var fileInput_default = /*#__PURE__*/__webpack_require__.n(fileInput);
23529
- ;// CONCATENATED MODULE: ./src/Components/Layout/Grow.tsx
23530
23759
 
23531
23760
 
23532
23761
 
23533
23762
 
23534
- const Grow = withForwardRef(function Grow({
23763
+ function LoadingArea({
23764
+ loading,
23765
+ fullWidth = false,
23766
+ fullSize = false,
23767
+ fullHeight = false,
23768
+ opacity = 0.65,
23535
23769
  className,
23536
- children,
23537
- center = false,
23538
23770
  style,
23539
- weight = 1
23540
- }, ref) {
23771
+ children
23772
+ }) {
23541
23773
  // Variables
23774
+ if (fullSize) {
23775
+ fullHeight = true;
23776
+ fullWidth = true;
23777
+ }
23542
23778
  // States
23543
23779
  // Refs
23544
23780
  // Callbacks
23545
23781
  // Effects
23546
23782
  // Other
23547
23783
  // Render Functions
23548
- return /*#__PURE__*/external_react_.createElement("div", {
23549
- ref: ref,
23550
- className: classnames_default()((layout_default()).grow, {
23551
- [(layout_default()).center]: center,
23552
- [(layout_default()).weight0]: weight === 0,
23553
- [(layout_default()).weight1]: weight === 1,
23554
- [(layout_default()).weight2]: weight === 2,
23555
- [(layout_default()).weight3]: weight === 3,
23556
- [(layout_default()).weight4]: weight === 4,
23557
- [(layout_default()).weight5]: weight === 5,
23558
- [(layout_default()).weight6]: weight === 6
23559
- }, className),
23784
+ return /*#__PURE__*/external_react_.createElement("span", {
23785
+ className: classnames_default()((loadingArea_default()).loadingArea, className, {
23786
+ 'full-height': fullHeight,
23787
+ 'full-width': fullWidth
23788
+ }),
23560
23789
  style: style
23561
- }, children);
23562
- }, (layout_default()));
23563
- // EXTERNAL MODULE: ./src/Components/Image/image.scss
23564
- var Image_image = __webpack_require__(6435);
23565
- var image_default = /*#__PURE__*/__webpack_require__.n(Image_image);
23566
- ;// CONCATENATED MODULE: ./src/Components/Image/Image.tsx
23567
- function Image_extends() { return Image_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, Image_extends.apply(null, arguments); }
23568
- var Image_rest = undefined && undefined.__rest || function (s, e) {
23790
+ }, children, loading ? /*#__PURE__*/external_react_.createElement("span", {
23791
+ className: (loadingArea_default()).curtain,
23792
+ style: {
23793
+ opacity
23794
+ }
23795
+ }, /*#__PURE__*/external_react_.createElement(LoadingCircleMemo, null)) : null);
23796
+ }
23797
+ const LoadingAreaMemo = withMemo(LoadingArea, (loadingArea_default()));
23798
+
23799
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/SendFormContext.ts
23800
+
23801
+ const SendFormContext = /*#__PURE__*/(0,external_react_.createContext)(undefined);
23802
+ function useSendFormContext() {
23803
+ return (0,external_react_.useContext)(SendFormContext);
23804
+ }
23805
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/HookForm.tsx
23806
+ var HookForm_rest = undefined && undefined.__rest || function (s, e) {
23569
23807
  var t = {};
23570
23808
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23571
23809
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
@@ -23577,62 +23815,64 @@ var Image_rest = undefined && undefined.__rest || function (s, e) {
23577
23815
 
23578
23816
 
23579
23817
 
23580
- function Image(_a) {
23581
- // Variables
23818
+
23819
+ const HookForm = withMemo(function HookForm(_a) {
23820
+ // Refs
23582
23821
  var {
23583
- src,
23584
- alt = '',
23585
- className,
23586
- style
23822
+ children,
23823
+ onSend
23587
23824
  } = _a,
23588
- otherProps = Image_rest(_a, ["src", "alt", "className", "style"]);
23589
- // Refs
23590
- // States
23591
- // Selectors
23825
+ methods = HookForm_rest(_a, ["children", "onSend"]);
23826
+ // States/Variables/Selectors
23827
+ // Create an inner, as the onSend may have other attributes
23828
+ const innerOnSend = (0,external_react_.useCallback)(() => onSend === null || onSend === void 0 ? void 0 : onSend(), [onSend]);
23829
+ // Dispatch
23592
23830
  // Callbacks
23593
23831
  // Effects
23594
23832
  // Other
23595
- // Render Functions
23596
- return /*#__PURE__*/external_react_.createElement("img", Image_extends({
23597
- src: src,
23598
- alt: alt,
23599
- className: classnames_default()((image_default()).image, className),
23600
- style: style
23601
- }, otherProps));
23833
+ // RenderFunctions
23834
+ return /*#__PURE__*/external_react_default().createElement(external_react_hook_form_namespaceObject.FormProvider, methods, /*#__PURE__*/external_react_default().createElement(SendFormContext.Provider, {
23835
+ value: innerOnSend
23836
+ }, /*#__PURE__*/external_react_default().createElement(LoadingAreaMemo, {
23837
+ loading: methods.formState.isSubmitting,
23838
+ __allowChildren: "all"
23839
+ }, children)));
23840
+ });
23841
+ // EXTERNAL MODULE: ./src/Components/FormElements/Input/input.scss
23842
+ var input = __webpack_require__(2923);
23843
+ var input_default = /*#__PURE__*/__webpack_require__.n(input);
23844
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/hooks/useOnChangeDone.ts
23845
+
23846
+ function useOnChangeDone(onChangeDone, ref) {
23847
+ const innerRef = (0,external_react_.useRef)(null);
23848
+ const usedRef = ref !== null && ref !== void 0 ? ref : innerRef;
23849
+ (0,external_react_.useEffect)(() => {
23850
+ const elem = usedRef.current;
23851
+ elem === null || elem === void 0 ? void 0 : elem.addEventListener('change', onChangeDone);
23852
+ return () => {
23853
+ elem === null || elem === void 0 ? void 0 : elem.removeEventListener('change', onChangeDone);
23854
+ };
23855
+ }, [onChangeDone, usedRef]);
23856
+ return usedRef;
23602
23857
  }
23603
- // Need ImageMemo for autocompletion of phpstorm
23604
- const ImageMemo = withMemo(Image, (image_default()));
23858
+ ;// CONCATENATED MODULE: ./src/Components/Hooks/useDebounced.ts
23605
23859
 
23606
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/FileInput/MultipleFileInput.tsx
23607
- function MultipleFileInput_extends() { return MultipleFileInput_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, MultipleFileInput_extends.apply(null, arguments); }
23608
- var __awaiter = undefined && undefined.__awaiter || function (thisArg, _arguments, P, generator) {
23609
- function adopt(value) {
23610
- return value instanceof P ? value : new P(function (resolve) {
23611
- resolve(value);
23612
- });
23613
- }
23614
- return new (P || (P = Promise))(function (resolve, reject) {
23615
- function fulfilled(value) {
23616
- try {
23617
- step(generator.next(value));
23618
- } catch (e) {
23619
- reject(e);
23620
- }
23621
- }
23622
- function rejected(value) {
23623
- try {
23624
- step(generator["throw"](value));
23625
- } catch (e) {
23626
- reject(e);
23627
- }
23628
- }
23629
- function step(result) {
23630
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
23631
- }
23632
- step((generator = generator.apply(thisArg, _arguments || [])).next());
23860
+ function useDebounced(callback, dependencies, delay = 100) {
23861
+ const [shared] = (0,external_react_.useState)({
23862
+ timeout: undefined
23633
23863
  });
23634
- };
23635
- var MultipleFileInput_rest = undefined && undefined.__rest || function (s, e) {
23864
+ // eslint-disable-next-line react-hooks/exhaustive-deps
23865
+ const realCB = (0,external_react_.useCallback)(callback, dependencies);
23866
+ return (0,external_react_.useCallback)((...newArgs) => {
23867
+ if (shared.timeout === undefined) {
23868
+ realCB(...newArgs);
23869
+ shared.timeout = setTimeout(() => shared.timeout = undefined, delay);
23870
+ }
23871
+ }, [delay, realCB, shared]);
23872
+ }
23873
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/Input.tsx
23874
+ function Input_extends() { return Input_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, Input_extends.apply(null, arguments); }
23875
+ var Input_rest = undefined && undefined.__rest || function (s, e) {
23636
23876
  var t = {};
23637
23877
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
23638
23878
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
@@ -23651,204 +23891,147 @@ var MultipleFileInput_rest = undefined && undefined.__rest || function (s, e) {
23651
23891
 
23652
23892
 
23653
23893
 
23654
-
23655
-
23656
-
23657
-
23658
-
23659
- const MultipleFileInput = withMemo(function MultipleImageInput(_a) {
23894
+ const Input = withForwardRef(function Input(_a, ref) {
23660
23895
  // Variables
23661
23896
  var {
23897
+ label,
23662
23898
  className,
23663
23899
  style,
23900
+ onKeyDown,
23901
+ inline = false,
23664
23902
  value,
23665
- label,
23666
- mimeTypes = ['image/*'],
23667
- maxFiles = 1,
23668
- maxSizePerFile = 1024 * 1024 * 10,
23669
- allowOverride = maxFiles === 1,
23670
- onError,
23671
- showDeleteButton = true,
23672
23903
  error,
23673
- "data-test-id": testId
23904
+ onChangeText,
23905
+ onEnter
23674
23906
  } = _a,
23675
- otherProps = MultipleFileInput_rest(_a, ["className", "style", "value", "label", "mimeTypes", "maxFiles", "maxSizePerFile", "allowOverride", "onError", "showDeleteButton", "error", "data-test-id"]);
23676
- // Refs
23677
- const inputRef = (0,external_react_.useRef)(null);
23678
- const indexRef = (0,external_react_.useRef)(undefined);
23679
- // States
23680
- // Selectors
23681
- // Callbacks
23682
- const checkMimeType = (0,external_react_.useCallback)(fileType => {
23683
- return mimeTypes.some(type => {
23684
- if (type === '*/*' || type === '*') {
23685
- return true;
23686
- }
23687
- if (type.endsWith('/*')) {
23688
- return fileType.startsWith(type.substring(0, type.length - 2));
23689
- }
23690
- return fileType === type;
23691
- });
23692
- }, [mimeTypes]);
23693
- const [onChangeFiles, props] = useListenerWithExtractedProps('onChangeFiles', otherProps);
23694
- const getBase64 = (0,external_react_.useCallback)(inputFiles => {
23695
- const promises = inputFiles.map(file => new Promise((resolve, reject) => {
23696
- const reader = new FileReader();
23697
- reader.onload = () => {
23698
- resolve(reader.result);
23699
- };
23700
- reader.onerror = reject;
23701
- reader.readAsDataURL(file);
23702
- }));
23703
- return Promise.all(promises);
23704
- }, []);
23705
- const onNewFiles = (0,external_react_.useCallback)((newFiles, index) => __awaiter(this, void 0, void 0, function* () {
23706
- if (newFiles.some(file => !checkMimeType(file.type))) {
23707
- onError === null || onError === void 0 ? void 0 : onError('Eine Datei ist im falschen Format');
23708
- return;
23709
- }
23710
- if (newFiles.length + value.length > maxFiles && (!allowOverride || index === undefined || index + newFiles.length > maxFiles)) {
23711
- onError === null || onError === void 0 ? void 0 : onError(`Es sind nur ${maxFiles} Dateien erlaubt.`);
23712
- return;
23713
- }
23714
- if (maxSizePerFile && newFiles.some(file => file.size > maxSizePerFile)) {
23715
- onError === null || onError === void 0 ? void 0 : onError(`Eine Datei ist zu groß. Jede Datei darf nur ${maxSizePerFile / 1024 / 1024}MB groß sein.`);
23716
- return;
23717
- }
23718
- const newUrls = yield getBase64(newFiles);
23719
- const newValue = newFiles.map((file, fileIndex) => ({
23720
- name: file.name,
23721
- data: newUrls[fileIndex],
23722
- mimeType: file.type,
23723
- blob: file
23724
- }));
23725
- if (newFiles.length + value.length > maxFiles && index !== undefined) {
23726
- const onChangeFilesValue = [...value];
23727
- onChangeFilesValue.splice(index, newFiles.length, ...newValue);
23728
- onChangeFiles(onChangeFilesValue);
23729
- } else {
23730
- onChangeFiles([...value, ...newValue]);
23731
- }
23732
- }), [allowOverride, checkMimeType, getBase64, maxFiles, maxSizePerFile, onChangeFiles, onError, value]);
23733
- const onInputChange = (0,external_react_.useCallback)(e => __awaiter(this, void 0, void 0, function* () {
23734
- const index = indexRef.current;
23735
- indexRef.current = undefined;
23736
- if (!e.target.files || e.target.files.length === 0) {
23737
- return;
23738
- }
23739
- const newFiles = Array.from(e.target.files);
23740
- yield onNewFiles(newFiles, index);
23741
- }), [onNewFiles]);
23742
- const removeFile = (0,external_react_.useCallback)((_, index) => {
23743
- if (index >= 0 && index < value.length) {
23744
- const newData = [...value];
23745
- newData.splice(index, 1);
23746
- onChangeFiles(newData);
23907
+ otherProps = Input_rest(_a, ["label", "className", "style", "onKeyDown", "inline", "value", "error", "onChangeText", "onEnter"]);
23908
+ // States
23909
+ const usedValue = (0,external_react_.useMemo)(() => {
23910
+ if (otherProps.type !== "number" || typeof value === "number") {
23911
+ return value;
23747
23912
  }
23748
- }, [onChangeFiles, value]);
23749
- const onDrop = (0,external_react_.useCallback)((event, index) => __awaiter(this, void 0, void 0, function* () {
23750
- event.preventDefault();
23751
- const files = [];
23752
- if (event.dataTransfer.items) {
23753
- for (let i = 0; i < event.dataTransfer.items.length; i++) {
23754
- if (event.dataTransfer.items[i].kind === 'file') {
23755
- const file = event.dataTransfer.items[i].getAsFile();
23756
- if (file) {
23757
- files.push(file);
23758
- }
23913
+ if (typeof value === "string") {
23914
+ if (value === "-") {
23915
+ return value;
23916
+ }
23917
+ const numberValue = parseFloat(value);
23918
+ if (!Number.isNaN(numberValue) && Number.isFinite(numberValue)) {
23919
+ if (otherProps.max !== undefined && numberValue > Number(otherProps.max)) {
23920
+ return otherProps.max;
23921
+ }
23922
+ if (otherProps.min !== undefined && numberValue < Number(otherProps.min)) {
23923
+ return otherProps.min;
23759
23924
  }
23760
23925
  }
23761
- } else {
23762
- for (let i = 0; i < event.dataTransfer.files.length; i++) {
23763
- files.push(event.dataTransfer.files[i]);
23926
+ if (!Number.isNaN(Number(value))) {
23927
+ // Do not parse to allow ., and so on
23928
+ return value;
23929
+ }
23930
+ if (!Number.isNaN(numberValue)) {
23931
+ return parseFloat(value);
23764
23932
  }
23765
23933
  }
23766
- yield onNewFiles(files, index);
23767
- }), [onNewFiles]);
23768
- const onDragOver = (0,external_react_.useCallback)(e => e.preventDefault(), []);
23769
- const clickOnFile = (0,external_react_.useCallback)((_, index) => {
23770
- if (index !== undefined && !allowOverride || !inputRef.current) {
23771
- return;
23934
+ return "";
23935
+ }, [value, otherProps.max, otherProps.min, otherProps.type]);
23936
+ // Refs
23937
+ const innerRef = (0,external_react_.useRef)(null);
23938
+ const refFunction = useComposedRef(ref, innerRef);
23939
+ // Callbacks
23940
+ const sendForm = useSendFormContext();
23941
+ onEnter !== null && onEnter !== void 0 ? onEnter : onEnter = sendForm;
23942
+ const [onChangeWithData, otherPropsWithoutOnchange] = useListenerWithExtractedProps('onChange', otherProps);
23943
+ const onChange = (0,external_react_.useCallback)(e => {
23944
+ if (onChangeText) {
23945
+ if (otherProps.type === "number") {
23946
+ if (e.currentTarget.value === "-") {
23947
+ onChangeText(e.currentTarget.value);
23948
+ return;
23949
+ }
23950
+ const val = !Number.isNaN(Number(e.currentTarget.value)) ? e.currentTarget.value : !Number.isNaN(parseFloat(e.currentTarget.value)) ? String(parseFloat(e.currentTarget.value)) : "";
23951
+ onChangeText(val);
23952
+ } else {
23953
+ onChangeText(e.currentTarget.value);
23954
+ }
23772
23955
  }
23773
- indexRef.current = index;
23774
- inputRef.current.dispatchEvent(new MouseEvent("click"));
23775
- }, [allowOverride]);
23956
+ onChangeWithData(e);
23957
+ }, [onChangeWithData, onChangeText, otherProps.type]);
23958
+ const [onBlur, otherPropsWithoutBlur] = useListenerWithExtractedProps('onBlur', otherPropsWithoutOnchange);
23959
+ const [onChangeDoneWithoutDeboune, otherPropsWithoutData] = useListenerWithExtractedProps('onChangeDone', otherPropsWithoutBlur);
23960
+ const onChangeDone = useDebounced(onChangeDoneWithoutDeboune, [onChangeDoneWithoutDeboune]);
23961
+ const realOnKeyDown = (0,external_react_.useCallback)(e => {
23962
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
23963
+ if (onEnter && e.key === 'Enter' && !e.defaultPrevented) {
23964
+ if (otherProps.type === "number") {
23965
+ const stringValue = e.target.value;
23966
+ const val = !Number.isNaN(Number(stringValue)) ? stringValue : !Number.isNaN(parseFloat(stringValue)) ? String(parseFloat(stringValue)) : "";
23967
+ onEnter(val);
23968
+ } else {
23969
+ onEnter(e.target.value);
23970
+ }
23971
+ }
23972
+ if (otherProps.type === "number") {
23973
+ const step = otherProps.step ? Number(otherProps.step) : 1;
23974
+ if (e.key === "ArrowUp") {
23975
+ let newValue = (parseFloat(e.currentTarget.value) || 0) + step;
23976
+ if (otherProps.max !== undefined && newValue > Number(otherProps.max)) {
23977
+ newValue = Number(otherProps.max);
23978
+ }
23979
+ e.currentTarget.value = newValue.toString();
23980
+ onChange(e);
23981
+ } else if (e.key === "ArrowDown") {
23982
+ let newValue = (parseFloat(e.currentTarget.value) || 0) - step;
23983
+ if (otherProps.min !== undefined && newValue < Number(otherProps.min)) {
23984
+ newValue = Number(otherProps.min);
23985
+ }
23986
+ e.currentTarget.value = newValue.toString();
23987
+ onChange(e);
23988
+ }
23989
+ }
23990
+ }, [onKeyDown, onEnter, otherProps.type, otherProps.step, otherProps.max, otherProps.min, onChange]);
23776
23991
  // Effects
23992
+ useOnChangeDone(onChangeDone, innerRef);
23993
+ (0,external_react_.useEffect)(() => {
23994
+ // Add the onChangeDone for numbers
23995
+ if (otherProps.type === "number") {
23996
+ const elem = innerRef.current;
23997
+ elem === null || elem === void 0 ? void 0 : elem.addEventListener('blur', onChangeDone);
23998
+ return () => {
23999
+ elem === null || elem === void 0 ? void 0 : elem.removeEventListener('blur', onChangeDone);
24000
+ };
24001
+ }
24002
+ return undefined;
24003
+ }, [ref, onChangeDone, innerRef, otherProps.type]);
23777
24004
  // Other
23778
24005
  // Render Functions
23779
- const renderFile = file => {
23780
- if (file.mimeType.startsWith('image/')) {
23781
- return /*#__PURE__*/external_react_.createElement(ImageMemo, {
23782
- key: file.data,
23783
- src: file.data,
23784
- alt: file.name,
23785
- className: classnames_default()((fileInput_default()).previewImage, file.data)
23786
- });
23787
- }
23788
- // TODO style
23789
- return /*#__PURE__*/external_react_.createElement(BlockMemo, {
23790
- className: (fileInput_default()).previewText
23791
- }, /*#__PURE__*/external_react_.createElement(Icon, {
23792
- icon: free_solid_svg_icons_namespaceObject.faFile,
23793
- className: (fileInput_default()).previewTextIcon
23794
- }), /*#__PURE__*/external_react_.createElement(tmp, null, file.name));
23795
- };
23796
- return /*#__PURE__*/external_react_.createElement("span", {
23797
- className: classnames_default()((fileInput_default()).fileInput, className),
23798
- style: style,
23799
- "data-test-id": testId
23800
- }, /*#__PURE__*/external_react_.createElement(Flex_tmp, {
23801
- horizontal: true
23802
- }, !!label && /*#__PURE__*/external_react_.createElement(Grow, null, /*#__PURE__*/external_react_.createElement(tmp, null, label)), maxFiles > 1 && /*#__PURE__*/external_react_.createElement(InlineMemo, null, /*#__PURE__*/external_react_.createElement(tmp, null, value.length, "/", maxFiles))), /*#__PURE__*/external_react_.createElement(Flex_tmp, {
23803
- horizontal: true,
23804
- className: (fileInput_default()).previewContainer
23805
- }, value === null || value === void 0 ? void 0 : value.map((file, index) => {
23806
- return /*#__PURE__*/external_react_.createElement(Grow, {
23807
- className: (fileInput_default()).preview,
23808
- center: true,
23809
- key: file.data
23810
- }, /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23811
- onDrop: onDrop,
23812
- onDragOver: onDragOver,
23813
- onDropData: index,
23814
- onClick: clickOnFile,
23815
- onClickData: index
23816
- }, renderFile(file), showDeleteButton && /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23817
- className: (fileInput_default()).previewRemove,
23818
- onClick: removeFile,
23819
- onClickData: index
23820
- }, /*#__PURE__*/external_react_.createElement(Icon, {
23821
- icon: free_solid_svg_icons_namespaceObject.faTimesCircle
23822
- }))));
23823
- }), /*#__PURE__*/external_react_.createElement(Grow, {
23824
- className: classnames_default()((fileInput_default()).addFile, {
23825
- [(fileInput_default()).hidden]: value.length >= maxFiles
23826
- }),
23827
- center: true
23828
- }, /*#__PURE__*/external_react_.createElement(ClickableMemo, {
23829
- className: (fileInput_default()).addFileButton,
23830
- onDrop: onDrop,
23831
- onDragOver: onDragOver,
23832
- onDropData: maxFiles,
23833
- onClick: clickOnFile,
23834
- __allowChildren: "html"
23835
- }, /*#__PURE__*/external_react_.createElement(Icon, {
23836
- icon: free_solid_svg_icons_namespaceObject.faPlus
23837
- }), /*#__PURE__*/external_react_.createElement("input", MultipleFileInput_extends({}, props, {
23838
- ref: inputRef,
23839
- className: (fileInput_default()).value,
23840
- onChange: onInputChange,
23841
- value: "",
23842
- type: "file",
23843
- multiple: maxFiles > 1,
23844
- accept: mimeTypes.join(', ')
23845
- }))))), error && /*#__PURE__*/external_react_.createElement(InlineBlockMemo, {
23846
- className: (fileInput_default()).error
23847
- }, /*#__PURE__*/external_react_.createElement(tmp, null, error)));
23848
- }, (fileInput_default()));
24006
+ return /*#__PURE__*/external_react_.createElement("label", {
24007
+ className: classnames_default()((input_default()).input, {
24008
+ [(input_default()).inline]: inline
24009
+ }, className),
24010
+ style: style
24011
+ }, label ? /*#__PURE__*/external_react_.createElement("span", {
24012
+ className: (input_default()).label
24013
+ }, label) : null, /*#__PURE__*/external_react_.createElement("input", Input_extends({
24014
+ inputMode: otherProps.type === "number" ? "numeric" : undefined
24015
+ }, otherPropsWithoutData, {
24016
+ value: usedValue,
24017
+ type: otherProps.type === "number" ? "text" : otherProps.type,
24018
+ ref: refFunction,
24019
+ className: (input_default()).text,
24020
+ onBlur: onBlur,
24021
+ onChange: onChange,
24022
+ onKeyDown: realOnKeyDown
24023
+ })), /*#__PURE__*/external_react_.createElement(FormError, {
24024
+ error: error
24025
+ }));
24026
+ }, (input_default()));
24027
+ ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/InputController.ts
24028
+
24029
+
24030
+ const InputController = withHookController(Input, "onChangeText");
23849
24031
  ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/MultipleFileInputController.ts
23850
24032
 
23851
24033
 
24034
+ // TODO Error handling(?)
23852
24035
  const MultipleFileInputController = withHookController(MultipleFileInput, 'onChangeFiles');
23853
24036
  // EXTERNAL MODULE: ./src/Components/FormElements/Input/PasswordInput/passwordInput.scss
23854
24037
  var passwordInput = __webpack_require__(1436);
@@ -24002,6 +24185,7 @@ var Switch_rest = undefined && undefined.__rest || function (s, e) {
24002
24185
 
24003
24186
 
24004
24187
 
24188
+
24005
24189
  const Switch = withMemo(function Switch(_a) {
24006
24190
  // Variables
24007
24191
  var {
@@ -24013,9 +24197,10 @@ const Switch = withMemo(function Switch(_a) {
24013
24197
  id,
24014
24198
  className,
24015
24199
  style,
24200
+ error,
24016
24201
  onChange
24017
24202
  } = _a,
24018
- props = Switch_rest(_a, ["children", "label", "preLabel", "isLabelBeforeSwitch", "isDual", "id", "className", "style", "onChange"]);
24203
+ props = Switch_rest(_a, ["children", "label", "preLabel", "isLabelBeforeSwitch", "isDual", "id", "className", "style", "error", "onChange"]);
24019
24204
  // States
24020
24205
  // Refs
24021
24206
  // Callbacks
@@ -24056,7 +24241,9 @@ const Switch = withMemo(function Switch(_a) {
24056
24241
  className: (switch_default()).handle
24057
24242
  })), /*#__PURE__*/external_react_.createElement("span", {
24058
24243
  className: (switch_default()).label
24059
- }, label)));
24244
+ }, label), /*#__PURE__*/external_react_.createElement(FormError, {
24245
+ error: error
24246
+ })));
24060
24247
  }, (switch_default()));
24061
24248
  ;// CONCATENATED MODULE: ./src/Components/FormElements/Controller/SwitchController.ts
24062
24249
 
@@ -24148,53 +24335,6 @@ const Textarea = withForwardRef(function Textarea(_a, ref) {
24148
24335
 
24149
24336
 
24150
24337
  const TextareaController = withHookController(Textarea, 'onChangeText');
24151
- ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/FileInput/FileInput.tsx
24152
- function FileInput_extends() { return FileInput_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, FileInput_extends.apply(null, arguments); }
24153
- var FileInput_rest = undefined && undefined.__rest || function (s, e) {
24154
- var t = {};
24155
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
24156
- if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
24157
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
24158
- }
24159
- return t;
24160
- };
24161
-
24162
-
24163
-
24164
-
24165
-
24166
-
24167
- const FileInput = withMemo(function FileInput(_a) {
24168
- // Variables
24169
- var {
24170
- value,
24171
- mimeType,
24172
- required = false
24173
- } = _a,
24174
- otherProps = FileInput_rest(_a, ["value", "mimeType", "required"]);
24175
- // Refs
24176
- // States
24177
- const mimeTypes = (0,external_react_.useMemo)(() => mimeType ? [mimeType] : undefined, [mimeType]);
24178
- const innerValue = (0,external_react_.useMemo)(() => value ? [value] : [], [value]);
24179
- // Selectors
24180
- // Callbacks
24181
- const [onChangeFile, multipleFileInputProps] = useListenerWithExtractedProps("onChangeFile", otherProps);
24182
- const onChangeFiles = (0,external_react_.useCallback)(files => {
24183
- if (!required || files[0]) {
24184
- onChangeFile(files[0]);
24185
- }
24186
- }, [onChangeFile, required]);
24187
- // Effects
24188
- // Other
24189
- // Render Functions
24190
- return /*#__PURE__*/external_react_.createElement(MultipleFileInput, FileInput_extends({
24191
- maxFiles: 1,
24192
- value: innerValue,
24193
- onChangeFiles: onChangeFiles,
24194
- mimeTypes: mimeTypes,
24195
- showDeleteButton: !required
24196
- }, multipleFileInputProps));
24197
- }, (fileInput_default()));
24198
24338
  ;// CONCATENATED MODULE: ./src/Components/FormElements/Input/HiddenInput.tsx
24199
24339
  function HiddenInput_extends() { return HiddenInput_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, HiddenInput_extends.apply(null, arguments); }
24200
24340
  var HiddenInput_rest = undefined && undefined.__rest || function (s, e) {
@@ -24609,6 +24749,20 @@ function useDelayed(callback, dependencies, delay = 100, maxDelay = undefined) {
24609
24749
  const maxDelayTimeout = (0,external_react_.useRef)();
24610
24750
  return func;
24611
24751
  }
24752
+ ;// CONCATENATED MODULE: ./src/Components/Hooks/useDelayedEffect.ts
24753
+
24754
+ function useDelayedEffect(effect, dependencies, delay = 100) {
24755
+ (0,external_react_.useEffect)(() => {
24756
+ let cleanup;
24757
+ let timeout = setTimeout(() => {
24758
+ cleanup = effect();
24759
+ }, delay);
24760
+ return () => {
24761
+ clearTimeout(timeout);
24762
+ cleanup === null || cleanup === void 0 ? void 0 : cleanup();
24763
+ };
24764
+ }, dependencies);
24765
+ }
24612
24766
  ;// CONCATENATED MODULE: ./src/Components/Hooks/useDelayedState.ts
24613
24767
 
24614
24768
 
@@ -29118,6 +29272,10 @@ function nonEmptyString(str, other = Characters.NBSP) {
29118
29272
 
29119
29273
 
29120
29274
 
29275
+
29276
+
29277
+
29278
+
29121
29279
 
29122
29280
 
29123
29281
 
@@ -29140,6 +29298,7 @@ exports.Characters = __webpack_exports__.Characters;
29140
29298
  exports.Checkbox = __webpack_exports__.Checkbox;
29141
29299
  exports.Clickable = __webpack_exports__.Clickable;
29142
29300
  exports.ColorInput = __webpack_exports__.ColorInput;
29301
+ exports.ColorInputController = __webpack_exports__.ColorInputController;
29143
29302
  exports.ConfirmDialog = __webpack_exports__.ConfirmDialog;
29144
29303
  exports.Container = __webpack_exports__.Container;
29145
29304
  exports.Dialog = __webpack_exports__.Dialog;
@@ -29150,8 +29309,10 @@ exports.DoubleIcon = __webpack_exports__.DoubleIcon;
29150
29309
  exports.DragItem = __webpack_exports__.DragItem;
29151
29310
  exports.DropArea = __webpack_exports__.DropArea;
29152
29311
  exports.FileInput = __webpack_exports__.FileInput;
29312
+ exports.FileInputController = __webpack_exports__.FileInputController;
29153
29313
  exports.Flavor = __webpack_exports__.Flavor;
29154
29314
  exports.Flex = __webpack_exports__.Flex;
29315
+ exports.FormError = __webpack_exports__.FormError;
29155
29316
  exports.FullScreen = __webpack_exports__.FullScreen;
29156
29317
  exports.Grid = __webpack_exports__.Grid;
29157
29318
  exports.GridItem = __webpack_exports__.GridItem;
@@ -29224,6 +29385,7 @@ exports.useComposedRef = __webpack_exports__.useComposedRef;
29224
29385
  exports.useConfirmDialog = __webpack_exports__.useConfirmDialog;
29225
29386
  exports.useDebounced = __webpack_exports__.useDebounced;
29226
29387
  exports.useDelayed = __webpack_exports__.useDelayed;
29388
+ exports.useDelayedEffect = __webpack_exports__.useDelayedEffect;
29227
29389
  exports.useDelayedState = __webpack_exports__.useDelayedState;
29228
29390
  exports.useDialog = __webpack_exports__.useDialog;
29229
29391
  exports.useInViewport = __webpack_exports__.useInViewport;