@dnb/eufemia 10.48.0 → 10.49.0
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.
- package/CHANGELOG.md +19 -0
- package/cjs/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/cjs/components/height-animation/HeightAnimationInstance.js +13 -6
- package/cjs/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Context.d.ts +6 -4
- package/cjs/extensions/forms/DataContext/Context.js +1 -2
- package/cjs/extensions/forms/DataContext/Context.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/cjs/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/cjs/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/cjs/extensions/forms/DataContext/Provider/Provider.js +27 -28
- package/cjs/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/cjs/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/cjs/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/Array.js +12 -6
- package/cjs/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/cjs/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/cjs/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/cjs/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/cjs/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js +19 -7
- package/cjs/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js +18 -2
- package/cjs/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/cjs/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js +3 -5
- package/cjs/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/cjs/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/cjs/extensions/forms/hooks/useFieldProps.js +20 -14
- package/cjs/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/cjs/shared/Eufemia.d.ts +1 -1
- package/cjs/shared/Eufemia.js +2 -2
- package/cjs/shared/Eufemia.js.map +1 -1
- package/cjs/style/core/scopes.scss +1 -1
- package/cjs/style/dnb-ui-basis.css +1 -1
- package/cjs/style/dnb-ui-basis.min.css +1 -1
- package/cjs/style/dnb-ui-body.css +1 -1
- package/cjs/style/dnb-ui-body.min.css +1 -1
- package/cjs/style/dnb-ui-core.css +1 -1
- package/cjs/style/dnb-ui-core.min.css +1 -1
- package/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/components/height-animation/HeightAnimationInstance.js +13 -6
- package/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/es/components/height-animation/HeightAnimationInstance.d.ts +1 -0
- package/es/components/height-animation/HeightAnimationInstance.js +13 -6
- package/es/components/height-animation/HeightAnimationInstance.js.map +1 -1
- package/es/extensions/forms/DataContext/Context.d.ts +6 -4
- package/es/extensions/forms/DataContext/Context.js +1 -2
- package/es/extensions/forms/DataContext/Context.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/es/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/es/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/es/extensions/forms/DataContext/Provider/Provider.js +27 -26
- package/es/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/es/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/es/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/Array.js +14 -8
- package/es/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/es/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/es/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/es/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/es/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/es/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
- package/es/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/es/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/es/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/es/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/es/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/es/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/es/extensions/forms/hooks/useFieldProps.js +20 -14
- package/es/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/es/shared/Eufemia.d.ts +1 -1
- package/es/shared/Eufemia.js +2 -2
- package/es/shared/Eufemia.js.map +1 -1
- package/es/style/core/scopes.scss +1 -1
- package/es/style/dnb-ui-basis.css +1 -1
- package/es/style/dnb-ui-basis.min.css +1 -1
- package/es/style/dnb-ui-body.css +1 -1
- package/es/style/dnb-ui-body.min.css +1 -1
- package/es/style/dnb-ui-core.css +1 -1
- package/es/style/dnb-ui-core.min.css +1 -1
- package/esm/dnb-ui-basis.min.mjs +1 -1
- package/esm/dnb-ui-components.min.mjs +1 -1
- package/esm/dnb-ui-elements.min.mjs +1 -1
- package/esm/dnb-ui-extensions.min.mjs +2 -2
- package/esm/dnb-ui-lib.min.mjs +1 -1
- package/extensions/forms/DataContext/Context.d.ts +6 -4
- package/extensions/forms/DataContext/Context.js +1 -2
- package/extensions/forms/DataContext/Context.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.d.ts +4 -0
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.js.map +1 -1
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js +13 -4
- package/extensions/forms/DataContext/FieldBoundary/FieldBoundaryProvider.js.map +1 -1
- package/extensions/forms/DataContext/Provider/Provider.d.ts +0 -4
- package/extensions/forms/DataContext/Provider/Provider.js +27 -26
- package/extensions/forms/DataContext/Provider/Provider.js.map +1 -1
- package/extensions/forms/Form/Isolation/Isolation.js +5 -4
- package/extensions/forms/Form/Isolation/Isolation.js.map +1 -1
- package/extensions/forms/Iterate/Array/Array.js +14 -8
- package/extensions/forms/Iterate/Array/Array.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js +6 -1
- package/extensions/forms/Iterate/Array/ArrayDocs.js.map +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.d.ts +1 -1
- package/extensions/forms/Iterate/Array/ArrayItemArea.js.map +1 -1
- package/extensions/forms/Iterate/Array/types.d.ts +1 -0
- package/extensions/forms/Iterate/Array/types.js.map +1 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js +0 -1
- package/extensions/forms/Iterate/EditContainer/DoneButton.js.map +1 -1
- package/extensions/forms/Iterate/PushButton/PushButton.js +20 -8
- package/extensions/forms/Iterate/PushButton/PushButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/OpenButton.js +19 -3
- package/extensions/forms/Iterate/PushContainer/OpenButton.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.d.ts +2 -1
- package/extensions/forms/Iterate/PushContainer/PushContainer.js.map +1 -1
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js +5 -0
- package/extensions/forms/Iterate/PushContainer/PushContainerDocs.js.map +1 -1
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js +4 -6
- package/extensions/forms/Iterate/RemoveButton/RemoveButton.js.map +1 -1
- package/extensions/forms/Wizard/Step/Step.d.ts +1 -1
- package/extensions/forms/Wizard/Step/Step.js.map +1 -1
- package/extensions/forms/hooks/useFieldProps.js +20 -14
- package/extensions/forms/hooks/useFieldProps.js.map +1 -1
- package/package.json +1 -1
- package/shared/Eufemia.d.ts +1 -1
- package/shared/Eufemia.js +2 -2
- package/shared/Eufemia.js.map +1 -1
- package/style/core/scopes.scss +1 -1
- package/style/dnb-ui-basis.css +1 -1
- package/style/dnb-ui-basis.min.css +1 -1
- package/style/dnb-ui-body.css +1 -1
- package/style/dnb-ui-body.min.css +1 -1
- package/style/dnb-ui-core.css +1 -1
- package/style/dnb-ui-core.min.css +1 -1
- package/umd/dnb-ui-basis.min.js +1 -1
- package/umd/dnb-ui-components.min.js +1 -1
- package/umd/dnb-ui-elements.min.js +1 -1
- package/umd/dnb-ui-extensions.min.js +2 -2
- package/umd/dnb-ui-lib.min.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.
|
|
1
|
+
html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.49.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}body :after,body :before{text-decoration:inherit;vertical-align:inherit}body hr{height:0;overflow:visible}body main{display:block}body nav ol,body nav ul{list-style:none}body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}body b,body strong{font-weight:bolder}body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}body audio,body video{display:inline-block}body audio:not([controls]){display:none;height:0}body img{border-style:none}body svg:not([fill]){fill:currentcolor}body svg:not(:root){overflow:hidden}body table{border-collapse:collapse}body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}body button,body figure,body input,body select{margin:0}body button{overflow:visible;text-transform:none}body fieldset{padding:.35rem .75rem .625rem}body input{overflow:visible;word-break:normal}body legend{color:inherit;display:table;max-width:100%;white-space:normal}body progress{display:inline-block;vertical-align:baseline}body select{text-transform:none}body textarea{overflow:auto;resize:vertical}body [type=checkbox],body [type=radio]{padding:0}body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}body ::input-placeholder{color:inherit;opacity:.54}body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}body ::-moz-focus-inner{border-style:none;padding:0}body details{display:block}body summary{display:list-item}body canvas{display:inline-block}body template{display:none}body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}body [hidden]{display:none}body [aria-busy=true]{cursor:progress}body [aria-controls]:not(input){cursor:pointer}body [aria-disabled=true],body [disabled]{cursor:not-allowed}body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{body{background-color:#fff;color:#000}}body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.48.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style fieldset,body fieldset{padding:.35rem .75rem .625rem}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:""}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
|
|
1
|
+
@charset "UTF-8";html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;cursor:default;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:var(--line-height-basis);-moz-tab-size:4;tab-size:4;word-break:break-word}body{margin:0}html{font-size:100%}html:not([data-visual-test]){scroll-behavior:smooth}@supports (-webkit-touch-callout:none){@supports (font:-apple-system-body){html{font:-apple-system-body}}}html[xmlns="http://www.w3.org/1999/xhtml"] a:hover{-webkit-text-decoration:none;text-decoration:none}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--active{color:var(--color-mint-green)!important}html[xmlns="http://www.w3.org/1999/xhtml"] .dnb-anchor--contrast:not(:hover){color:var(--color-white)!important}html[xmlns="http://www.w3.org/1999/xhtml"] a.dnb-button--primary{color:var(--color-white)}html[xmlns="http://www.w3.org/1999/xhtml"] ul{list-style:initial}html[xmlns="http://www.w3.org/1999/xhtml"] p{background-color:initial;overflow:initial;text-align:inherit}html[xmlns="http://www.w3.org/1999/xhtml"] i{font-style:italic}html[xmlns="http://www.w3.org/1999/xhtml"] #column_left,html[xmlns="http://www.w3.org/1999/xhtml"] #root{width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefault #wrapper,html[xmlns="http://www.w3.org/1999/xhtml"] body#dnbLayoutDefaultStartPage #wrapper{max-width:60rem;width:100%}html[xmlns="http://www.w3.org/1999/xhtml"] #column_content{box-shadow:none}.dnb-core-style,body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0);-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;--eufemia-version:"10.49.0";color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis);tab-size:4;-moz-tab-size:4;word-break:break-word}.dnb-core-style *,.dnb-core-style :after,.dnb-core-style :before,body *,body :after,body :before{background-repeat:no-repeat;box-sizing:border-box}.dnb-core-style :after,.dnb-core-style :before,body :after,body :before{text-decoration:inherit;vertical-align:inherit}.dnb-core-style hr,body hr{height:0;overflow:visible}.dnb-core-style main,body main{display:block}.dnb-core-style nav ol,.dnb-core-style nav ul,body nav ol,body nav ul{list-style:none}.dnb-core-style abbr[title],body abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.dnb-core-style b,.dnb-core-style strong,body b,body strong{font-weight:bolder}.dnb-core-style code,.dnb-core-style kbd,.dnb-core-style pre,.dnb-core-style samp,body code,body kbd,body pre,body samp{font-family:var(--font-family-monospace)}.dnb-core-style ::selection,body ::selection{background-color:#b3d4fc;color:#000;text-shadow:none}.dnb-core-style audio,.dnb-core-style canvas,.dnb-core-style iframe,.dnb-core-style img,.dnb-core-style svg,.dnb-core-style video,body audio,body canvas,body iframe,body img,body svg,body video{vertical-align:middle}.dnb-core-style audio,.dnb-core-style video,body audio,body video{display:inline-block}.dnb-core-style audio:not([controls]),body audio:not([controls]){display:none;height:0}.dnb-core-style img,body img{border-style:none}.dnb-core-style svg:not([fill]),body svg:not([fill]){fill:currentcolor}.dnb-core-style svg:not(:root),body svg:not(:root){overflow:hidden}.dnb-core-style table,body table{border-collapse:collapse}.dnb-core-style button,.dnb-core-style input,.dnb-core-style select,.dnb-core-style textarea,body button,body input,body select,body textarea{font-family:inherit;font-size:inherit;line-height:inherit}.dnb-core-style button,.dnb-core-style figure,.dnb-core-style input,.dnb-core-style select,body button,body figure,body input,body select{margin:0}.dnb-core-style button,body button{overflow:visible;text-transform:none}.dnb-core-style fieldset,body fieldset{padding:.35rem .75rem .625rem}.dnb-core-style input,body input{overflow:visible;word-break:normal}.dnb-core-style legend,body legend{color:inherit;display:table;max-width:100%;white-space:normal}.dnb-core-style progress,body progress{display:inline-block;vertical-align:baseline}.dnb-core-style select,body select{text-transform:none}.dnb-core-style textarea,body textarea{overflow:auto;resize:vertical}.dnb-core-style [type=checkbox],.dnb-core-style [type=radio],body [type=checkbox],body [type=radio]{padding:0}.dnb-core-style input[type=search],body input[type=search]{-webkit-appearance:textfield;appearance:textfield;outline-offset:-2px}.dnb-core-style ::-webkit-inner-spin-button,.dnb-core-style ::-webkit-outer-spin-button,body ::-webkit-inner-spin-button,body ::-webkit-outer-spin-button{height:auto}.dnb-core-style ::input-placeholder,body ::input-placeholder{color:inherit;opacity:.54}.dnb-core-style ::-webkit-search-decoration,body ::-webkit-search-decoration{-webkit-appearance:none;appearance:none}.dnb-core-style ::-webkit-file-upload-button,body ::-webkit-file-upload-button{background-color:transparent;border:none;font:inherit}.dnb-core-style ::-moz-focus-inner,body ::-moz-focus-inner{border-style:none;padding:0}.dnb-core-style details,body details{display:block}.dnb-core-style summary,body summary{display:list-item}.dnb-core-style canvas,body canvas{display:inline-block}.dnb-core-style template,body template{display:none}.dnb-core-style [tabindex],.dnb-core-style a,.dnb-core-style area,.dnb-core-style button,.dnb-core-style input,.dnb-core-style label,.dnb-core-style select,.dnb-core-style summary,.dnb-core-style textarea,body [tabindex],body a,body area,body button,body input,body label,body select,body summary,body textarea{touch-action:manipulation}.dnb-core-style [hidden],body [hidden]{display:none}.dnb-core-style [aria-busy=true],body [aria-busy=true]{cursor:progress}.dnb-core-style [aria-controls]:not(input),body [aria-controls]:not(input){cursor:pointer}.dnb-core-style [aria-disabled=true],.dnb-core-style [disabled],body [aria-disabled=true],body [disabled]{cursor:not-allowed}.dnb-core-style [aria-hidden=false][hidden]:not(:focus),body [aria-hidden=false][hidden]:not(:focus){clip:rect(0,0,0,0);display:inherit;position:absolute}@media print{.dnb-core-style,body{background-color:#fff;color:#000}}.dnb-core-style .eufemia-theme,body .eufemia-theme{color:var(--theme-color-body,var(--color-black-80,#333));font-family:var(--font-family-default);font-size:var(--font-size-small);font-style:normal;font-weight:var(--font-weight-basis);line-height:var(--line-height-basis)}.dnb-no-focus,.dnb-tab-focus,.dnb-tab-focus:focus{outline:none}html[data-whatinput=keyboard] .dnb-tab-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-mouse-focus,.dnb-mouse-focus:focus{outline:none}html[data-whatinput=mouse] .dnb-mouse-focus:focus{box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-focus-ring,html[data-whatinput=mouse] .dnb-mouse-focus:focus{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent}.dnb-focus-ring{box-shadow:0 0 0 var(--border-width) var(--border-color)!important}.dnb-scrollbar-appearance{-webkit-overflow-scrolling:touch;-ms-overflow-style:auto;scrollbar-color:var(--scrollbar-thumb-color,#888) transparent}@supports not (scrollbar-color:auto){.dnb-scrollbar-appearance::-webkit-scrollbar{background-color:var(--scrollbar-track-color,#eee);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:vertical{width:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar:horizontal{height:var(--scrollbar-track-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb{background-color:var(--scrollbar-thumb-color,#888);border-radius:var(--scrollbar-thumb-width,.5rem)}.dnb-scrollbar-appearance::-webkit-scrollbar-thumb:hover{background-color:var(--scrollbar-thumb-hover-color,#666)}}.dnb-skip-link{opacity:.3;position:absolute;top:-100vh;transition:opacity .3s ease-out;z-index:0}.dnb-skip-link--active,.dnb-skip-link:focus{background-color:transparent;border:none;border-radius:0;box-shadow:none;color:var(--skip-link-color);font-size:var(--font-size-basis);left:40%;margin:0;outline:none;padding:.5rem 1rem;position:fixed;text-align:center;-webkit-text-decoration:none;text-decoration:none;top:5%;user-select:none;-webkit-user-select:none;white-space:nowrap;z-index:9999}.dnb-skip-link--active:after,.dnb-skip-link:focus:after{background-color:hsla(0,0%,100%,.85);box-shadow:150vw 150vh 0 0 hsla(0,0%,100%,.85);content:"";height:150vh;left:-200vw;position:absolute;top:-200vh;width:150vw;z-index:-2}.dnb-skip-link--active:before,.dnb-skip-link:focus:before{background-color:var(--skip-link-background);border-radius:1.5rem;content:"";height:100%;left:0;outline:none;position:absolute;top:0;width:100%;z-index:-1}html[data-whatinput=mouse] .dnb-skip-link--active:before,html[data-whatinput=mouse] .dnb-skip-link:focus:before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:hover:before,.dnb-skip-link:focus:hover:before{background-color:var(--skip-link-background--hover)}.dnb-skip-link--active:active:before,.dnb-skip-link:focus:active:before{background-color:var(--skip-link-background--active)}.dnb-skip-link--active:focus:not(:active):before,.dnb-skip-link:focus:focus:not(:active):before{outline:none}html[data-whatinput=keyboard] .dnb-skip-link--active:focus:not(:active):before,html[data-whatinput=keyboard] .dnb-skip-link:focus:focus:not(:active):before{--border-color:var(--focus-ring-color);--border-width:var(--focus-ring-width);border-color:transparent;box-shadow:0 0 0 var(--border-width) var(--border-color)}.dnb-skip-link--active:focus,.dnb-skip-link:focus:focus{opacity:1}.dnb-skip-link--active:hover,.dnb-skip-link:focus:hover{background-color:transparent;box-shadow:none;color:var(--skip-link-color--hover)}.dnb-skip-link--active:focus:not(:hover):not(:active),.dnb-skip-link:focus:focus:not(:hover):not(:active){background-color:transparent;box-shadow:none;color:var(--skip-link-color)}.dnb-skip-link--active:active,.dnb-skip-link:focus:active{background-color:transparent;color:var(--skip-link-color--active)}html[data-whatintent=touch] .dnb-skip-link{display:none}.dnb-alignment-helper,.dnb-alignment-helper:before{speak:none;display:inline-block;font-size:var(--font-size-small);height:0;width:0}.dnb-alignment-helper:before{content:""}.dnb-drop-shadow{box-shadow:var(--shadow-default)}.dnb-sr-only{-webkit-touch-callout:none!important;border:0!important;clip-path:inset(50%)!important;margin:0!important;max-height:1px!important;max-width:1px!important;overflow:hidden!important;padding:0!important;pointer-events:none!important;position:absolute!important;-webkit-user-select:none!important;user-select:none!important;white-space:nowrap!important}.dnb-suffix{font-size:var(--font-size-basis);line-height:var(--line-height-basis);padding-left:.5rem;word-break:normal}
|
|
@@ -51,6 +51,7 @@ export default class HeightAnimation {
|
|
|
51
51
|
setAsClosed(): void;
|
|
52
52
|
getHeight(): number;
|
|
53
53
|
getUnknownHeight(): number;
|
|
54
|
+
withFallback(elem: HTMLElement, key: 'clientHeight' | 'clientWidth', fallback?: 'data-height' | 'data-width'): number;
|
|
54
55
|
onStart(fn: HeightAnimationOnStartCallback): void;
|
|
55
56
|
onEnd(fn: HeightAnimationOnEndCallback): void;
|
|
56
57
|
start(fromHeight: HeightAnimationFromHeight, toHeight: HeightAnimationToHeight): void;
|
|
@@ -129,11 +129,11 @@ export default class HeightAnimation {
|
|
|
129
129
|
this.callAnimationEnd();
|
|
130
130
|
}
|
|
131
131
|
getHeight() {
|
|
132
|
-
var _this$
|
|
133
|
-
return
|
|
132
|
+
var _this$withFallback;
|
|
133
|
+
return (_this$withFallback = this.withFallback(this.elem, 'clientHeight')) !== null && _this$withFallback !== void 0 ? _this$withFallback : null;
|
|
134
134
|
}
|
|
135
135
|
getUnknownHeight() {
|
|
136
|
-
var _this$elem$parentNode, _clonedElem$parentNod;
|
|
136
|
+
var _this$elem$parentNode, _this$withFallback2, _this$withFallback3, _clonedElem$parentNod;
|
|
137
137
|
if (!this.elem) {
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
@@ -152,17 +152,24 @@ export default class HeightAnimation {
|
|
|
152
152
|
clonedElem.style.position = 'absolute';
|
|
153
153
|
(_this$elem$parentNode = this.elem.parentNode) === null || _this$elem$parentNode === void 0 ? void 0 : _this$elem$parentNode.insertBefore(clonedElem, this.elem.nextSibling);
|
|
154
154
|
const elemWidth = this.elem.clientWidth;
|
|
155
|
-
const clonedWidth =
|
|
155
|
+
const clonedWidth = (_this$withFallback2 = this.withFallback(clonedElem, 'clientWidth', 'data-width')) !== null && _this$withFallback2 !== void 0 ? _this$withFallback2 : 0;
|
|
156
156
|
if (clonedWidth > elemWidth) {
|
|
157
157
|
clonedElem.style.width = `${elemWidth}px`;
|
|
158
158
|
}
|
|
159
|
-
const height =
|
|
159
|
+
const height = (_this$withFallback3 = this.withFallback(this.elem, 'clientHeight', 'data-height')) !== null && _this$withFallback3 !== void 0 ? _this$withFallback3 : null;
|
|
160
160
|
(_clonedElem$parentNod = clonedElem.parentNode) === null || _clonedElem$parentNod === void 0 ? void 0 : _clonedElem$parentNod.removeChild(clonedElem);
|
|
161
161
|
if (height) {
|
|
162
162
|
this.__currentHeight = height;
|
|
163
163
|
}
|
|
164
164
|
return height;
|
|
165
165
|
}
|
|
166
|
+
withFallback(elem, key, fallback) {
|
|
167
|
+
const val = fallback && elem.hasAttribute(fallback) ? parseFloat(elem.getAttribute(fallback)) : elem === null || elem === void 0 ? void 0 : elem[key];
|
|
168
|
+
if (isNaN(val)) {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
return val;
|
|
172
|
+
}
|
|
166
173
|
onStart(fn) {
|
|
167
174
|
this.onStartStack.push(fn);
|
|
168
175
|
}
|
|
@@ -246,7 +253,7 @@ export default class HeightAnimation {
|
|
|
246
253
|
if (!this.elem || opts.animate === false || this.state === 'opening' || this.state === 'closing') {
|
|
247
254
|
return;
|
|
248
255
|
}
|
|
249
|
-
if (fromHeight ===
|
|
256
|
+
if (fromHeight === null) {
|
|
250
257
|
fromHeight = this.getHeight();
|
|
251
258
|
}
|
|
252
259
|
if (toHeight === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeightAnimationInstance.js","names":["HeightAnimation","constructor","opts","arguments","length","undefined","_defineProperty","animate","visibility","opacity","height","isInBrowser","window","setState","setOptions","callAnimationStart","startTime","Date","now","firstTime","onStartStack","forEach","fn","state","callAnimationEnd","isAnimating","__currentHeight","removeEndEvents","onEndStack","addEndEvent","listener","_this$elem","_this$elem$addEventLi","handleTransitionEnd","e","canFinish","delay","duration","timeouts","push","setTimeout","events","elem","addEventListener","call","_this$elem2","_this$elem2$removeEve","removeEventListener","setElement","_this$elem3","_globalThis$animation","document","createElement","String","nodeName","toLowerCase","parentElement","globalThis","animationDuration","parseFloat","getComputedStyle","transitionDuration","Object","freeze","_objectSpread","getOptions","remove","stop","setAsOpen","setAsClosed","getHeight","_this$elem4","clientHeight","getUnknownHeight","_this$elem$parentNode","_clonedElem$parentNod","clonedElem","cloneNode","inputs","querySelectorAll","input","removeAttribute","key","firstPaintStyle","style","position","parentNode","insertBefore","nextSibling","elemWidth","clientWidth","clonedWidth","getAttribute","width","removeChild","onStart","onEnd","start","fromHeight","toHeight","requestAnimationFrame","reqId1","reqId2","id","clearTimeout","cancelAnimationFrame","open","shouldBypassAnimation","target","currentTarget","overflowY","readjust","close","adjustTo","endHeight","newHeight","_globalThis$animation2","Boolean","_globalThis$bypassTim","IS_TEST","bypassTime"],"sources":["../../../../src/components/height-animation/HeightAnimationInstance.ts"],"sourcesContent":["export type HeightAnimationOnStartStates =\n | 'opening'\n | 'closing'\n | 'adjusting'\nexport type HeightAnimationOnEndStates = 'opened' | 'closed' | 'adjusted'\nexport type HeightAnimationStates =\n | HeightAnimationOnStartStates\n | HeightAnimationOnEndStates\n | 'init'\nexport type HeightAnimationOptions = {\n animate?: boolean\n}\nexport type HeightAnimationOnStartCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnEndCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnStartStack =\n Array<HeightAnimationOnStartCallback>\nexport type HeightAnimationOnEndStack = Array<HeightAnimationOnEndCallback>\nexport type HeightAnimationEventListener = (e: Event) => void\nexport type HeightAnimationEvents = Array<HeightAnimationEventListener>\nexport type HeightAnimationElement = HTMLElement\nexport type HeightAnimationContainer = HTMLElement\nexport type HeightAnimationFromHeight = number\nexport type HeightAnimationToHeight = number\n\nexport default class HeightAnimation {\n private state: Readonly<HeightAnimationStates>\n isInBrowser: boolean\n onStartStack: HeightAnimationOnStartStack = []\n onEndStack: HeightAnimationOnEndStack = []\n events: HeightAnimationEvents = []\n opts: HeightAnimationOptions = { animate: true }\n elem: HeightAnimationElement\n reqId1: number\n reqId2: number\n resizeTimeout: NodeJS.Timeout\n timeouts: NodeJS.Timeout[] = []\n firstTime?: number = 0\n startTime?: number = 0\n duration?: number = 0\n isAnimating: boolean\n __currentHeight: number\n\n firstPaintStyle = {\n visibility: 'hidden',\n opacity: '0', // prevents before/after elements to be visible\n height: 'auto',\n } as const\n\n constructor(opts: HeightAnimationOptions = {}) {\n this.isInBrowser = typeof window !== 'undefined'\n this.setState('init')\n this.setOptions(opts)\n }\n\n callAnimationStart() {\n this.startTime = Date.now()\n if (!this.firstTime) {\n this.firstTime = this.startTime\n }\n if (this.onStartStack) {\n this.onStartStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n callAnimationEnd() {\n this.isAnimating = false\n\n if (this.state !== 'opened') {\n delete this.__currentHeight\n }\n\n this.removeEndEvents()\n\n if (this.onEndStack) {\n this.onEndStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n addEndEvent(listener: HeightAnimationEventListener) {\n this.removeEndEvents() // also, remove events on every open (but not on close!)\n\n const handleTransitionEnd = (e) => {\n if (this.canFinish()) {\n listener(e)\n } else {\n const delay = this.duration - (Date.now() - this.startTime)\n\n if (delay === -1) {\n listener(e)\n } else {\n this.timeouts.push(setTimeout(() => listener(e), delay))\n }\n }\n }\n\n this.events.push(handleTransitionEnd)\n this.elem?.addEventListener?.('transitionend', handleTransitionEnd)\n }\n removeEndEvents() {\n this.events.forEach((listener) => {\n this.elem?.removeEventListener?.('transitionend', listener)\n })\n this.events = []\n }\n\n // Public methods\n setElement(elem: HeightAnimationElement) {\n this.elem =\n elem ||\n (typeof document !== 'undefined' && document.createElement('div'))\n\n // TODO: remove when responsive tables are supported\n if (String(this.elem?.nodeName).toLowerCase() === 'td') {\n this.elem = this.elem.parentElement\n }\n\n this.duration =\n globalThis.animationDuration ??\n (parseFloat(window.getComputedStyle(this.elem).transitionDuration) *\n 1000 ||\n 400) // The default duration\n }\n setState(state: HeightAnimationStates) {\n this.state = Object.freeze(state)\n }\n setOptions(opts: HeightAnimationOptions) {\n this.opts = Object.freeze({ ...this.opts, ...opts })\n }\n getOptions() {\n return this.opts\n }\n remove() {\n this.stop()\n this.removeEndEvents()\n this.setState('init')\n this.isAnimating = false\n this.onEndStack = []\n this.onStartStack = []\n this.__currentHeight = undefined\n this.elem = undefined\n }\n setAsOpen() {\n if (this.state === 'opened') {\n return\n }\n this.setState('opening')\n this.callAnimationStart()\n this.setState('opened')\n this.callAnimationEnd()\n }\n setAsClosed() {\n if (this.state === 'closed') {\n return\n }\n this.setState('closing')\n this.callAnimationStart()\n this.setState('closed')\n this.callAnimationEnd()\n }\n getHeight() {\n return parseFloat(String(this.elem?.clientHeight)) || null\n }\n getUnknownHeight() {\n if (!this.elem) {\n return null\n }\n\n if (this.isAnimating && typeof this.__currentHeight !== 'undefined') {\n return this.__currentHeight\n }\n\n const clonedElem = this.elem.cloneNode(true) as HTMLElement\n const inputs = clonedElem.querySelectorAll('input')\n inputs.forEach((input) => {\n input.removeAttribute('name') // because type=\"radio\" will be else effected negatively\n input.removeAttribute('id') // don't put IDs twice in the DOM\n })\n\n // Hide the cloned element\n for (const key in this.firstPaintStyle) {\n clonedElem.style[key] = this.firstPaintStyle[key]\n }\n clonedElem.style.position = 'absolute' // not a part of the \"firstPaintStyle\"\n\n this.elem.parentNode?.insertBefore(clonedElem, this.elem.nextSibling)\n\n // When text is wrapped, we get different widths,\n // so we need to set the width to the original width\n const elemWidth = this.elem.clientWidth\n const clonedWidth =\n clonedElem.clientWidth ||\n // data-width is used for mockup testing with \"mockHeight\"\n parseFloat(clonedElem.getAttribute('data-width')) ||\n 0\n\n if (clonedWidth > elemWidth) {\n clonedElem.style.width = `${elemWidth}px`\n }\n\n const height =\n clonedElem.clientHeight ||\n // data-height is used for mockup testing with \"mockHeight\"\n parseFloat(clonedElem.getAttribute('data-height')) ||\n null\n\n clonedElem.parentNode?.removeChild(clonedElem)\n\n if (height) {\n this.__currentHeight = height\n }\n\n return height\n }\n onStart(fn: HeightAnimationOnStartCallback) {\n this.onStartStack.push(fn)\n }\n onEnd(fn: HeightAnimationOnEndCallback) {\n this.onEndStack.push(fn)\n }\n start(\n fromHeight: HeightAnimationFromHeight,\n toHeight: HeightAnimationToHeight\n ) {\n if (\n !this.elem ||\n !(\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n )\n ) {\n return\n }\n\n const opts = this.getOptions()\n if (opts.animate === false) {\n return\n }\n\n this.stop()\n this.isAnimating = true\n\n // make the animation\n this.reqId1 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${fromHeight}px`\n\n this.reqId2 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${toHeight}px`\n })\n })\n }\n stop() {\n this.timeouts.forEach((id) => clearTimeout(id))\n this.timeouts = []\n\n if (\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n ) {\n window.cancelAnimationFrame(this.reqId1)\n window.cancelAnimationFrame(this.reqId2)\n }\n }\n open() {\n if (\n this.state === 'opened' ||\n this.state === 'opening' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsOpen()\n return\n }\n\n this.setState('opening')\n this.callAnimationStart()\n\n const toHeight = this.getUnknownHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.overflowY = ''\n }\n this.setState('opened')\n this.readjust()\n }\n })\n\n this.start(0, toHeight)\n }\n close() {\n if (\n this.state === 'closed' ||\n this.state === 'closing' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsClosed()\n return\n }\n\n this.setState('closing')\n this.callAnimationStart()\n\n const fromHeight = this.getHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.visibility = 'hidden'\n this.elem.style.overflowY = 'clip'\n }\n this.setState('closed')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, 0)\n }\n adjustTo(\n fromHeight: HeightAnimationFromHeight = null,\n toHeight: HeightAnimationToHeight = null\n ) {\n const opts = this.getOptions()\n\n if (\n !this.elem ||\n opts.animate === false ||\n this.state === 'opening' ||\n this.state === 'closing'\n ) {\n return\n }\n\n if (fromHeight === 0 || fromHeight === null) {\n fromHeight = this.getHeight()\n }\n if (toHeight === null) {\n toHeight = this.getUnknownHeight()\n }\n\n if (fromHeight === toHeight) {\n this.setState('adjusted')\n return\n }\n\n this.setState('adjusting')\n this.callAnimationStart()\n\n this.addEndEvent((e) => {\n if (\n this.state === 'adjusting' &&\n (e.target === e.currentTarget || !e.currentTarget)\n ) {\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n this.setState('adjusted')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, toHeight)\n }\n readjust() {\n const endHeight = this.getHeight()\n\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n\n this.__currentHeight = undefined\n const newHeight = this.getUnknownHeight()\n\n // If the height has changed during the animation, we need to adjust it\n if (endHeight !== newHeight) {\n this.adjustTo(endHeight, newHeight)\n } else {\n this.callAnimationEnd()\n }\n }\n /**\n * Determines whether the animation can finish.\n * Check for certain states and if the time passed is too short.\n * With a so short first state change, we do not call animation end.\n */\n canFinish() {\n return Boolean(\n this.startTime &&\n Date.now() - this.startTime >\n (globalThis.animationDuration ?? this.duration)\n )\n }\n /**\n * Determines whether the animation should be bypassed.\n * Check for certain states and if the time passed is too short to be correct.\n * With a very short first state change, we skip animation.\n */\n shouldBypassAnimation() {\n const opts = this.getOptions()\n\n if (!this.elem || opts.animate === false) {\n return true\n }\n\n if (\n this.isInBrowser &&\n (globalThis.IS_TEST || globalThis.bypassTime === -1)\n ) {\n return false\n }\n\n return Boolean(\n this.firstTime &&\n Date.now() - this.firstTime < (globalThis.bypassTime ?? 100)\n )\n }\n}\n"],"mappings":";;;AA4BA,eAAe,MAAMA,eAAe,CAAC;EAwBnCC,WAAWA,CAAA,EAAoC;IAAA,IAAnCC,IAA4B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAAG,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBArBD,EAAE;IAAAA,eAAA,qBACN,EAAE;IAAAA,eAAA,iBACV,EAAE;IAAAA,eAAA,eACH;MAAEC,OAAO,EAAE;IAAK,CAAC;IAAAD,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAKnB,EAAE;IAAAA,eAAA,oBACV,CAAC;IAAAA,eAAA,oBACD,CAAC;IAAAA,eAAA,mBACF,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,0BAIH;MAChBE,UAAU,EAAE,QAAQ;MACpBC,OAAO,EAAE,GAAG;MACZC,MAAM,EAAE;IACV,CAAC;IAGC,IAAI,CAACC,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW;IAChD,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC;IACrB,IAAI,CAACC,UAAU,CAACZ,IAAI,CAAC;EACvB;EAEAa,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAI,CAACC,SAAS,EAA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,KAAK,CAAC1E,MAAM,GAAG,MAAM;IACjC;IAEA,IAAI,CAACgB,eAAe,GAAGrB,SAAS;IAChC,MAAM8G,SAAS,GAAG,IAAI,CAAC1C,gBAAgB,CAAC,CAAC;IAGzC,IAAIyC,SAAS,KAAKC,SAAS,EAAE;MAC3B,IAAI,CAACF,QAAQ,CAACC,SAAS,EAAEC,SAAS,CAAC;IACrC,CAAC,MAAM;MACL,IAAI,CAAC3F,gBAAgB,CAAC,CAAC;IACzB;EACF;EAMAW,SAASA,CAAA,EAAG;IAAA,IAAAiF,sBAAA;IACV,OAAOC,OAAO,CACZ,IAAI,CAACrG,SAAS,IACZC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACF,SAAS,KAAAoG,sBAAA,GACxB3D,UAAU,CAACC,iBAAiB,cAAA0D,sBAAA,cAAAA,sBAAA,GAAI,IAAI,CAAC/E,QAAQ,CACpD,CAAC;EACH;EAMAsE,qBAAqBA,CAAA,EAAG;IAAA,IAAAW,qBAAA;IACtB,MAAMpH,IAAI,GAAG,IAAI,CAAC+D,UAAU,CAAC,CAAC;IAE9B,IAAI,CAAC,IAAI,CAACvB,IAAI,IAAIxC,IAAI,CAACK,OAAO,KAAK,KAAK,EAAE;MACxC,OAAO,IAAI;IACb;IAEA,IACE,IAAI,CAACI,WAAW,KACf8C,UAAU,CAAC8D,OAAO,IAAI9D,UAAU,CAAC+D,UAAU,KAAK,CAAC,CAAC,CAAC,EACpD;MACA,OAAO,KAAK;IACd;IAEA,OAAOH,OAAO,CACZ,IAAI,CAAClG,SAAS,IACZF,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,SAAS,KAAAmG,qBAAA,GAAI7D,UAAU,CAAC+D,UAAU,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,GAAG,CAC/D,CAAC;EACH;AACF"}
|
|
1
|
+
{"version":3,"file":"HeightAnimationInstance.js","names":["HeightAnimation","constructor","opts","arguments","length","undefined","_defineProperty","animate","visibility","opacity","height","isInBrowser","window","setState","setOptions","callAnimationStart","startTime","Date","now","firstTime","onStartStack","forEach","fn","state","callAnimationEnd","isAnimating","__currentHeight","removeEndEvents","onEndStack","addEndEvent","listener","_this$elem","_this$elem$addEventLi","handleTransitionEnd","e","canFinish","delay","duration","timeouts","push","setTimeout","events","elem","addEventListener","call","_this$elem2","_this$elem2$removeEve","removeEventListener","setElement","_this$elem3","_globalThis$animation","document","createElement","String","nodeName","toLowerCase","parentElement","globalThis","animationDuration","parseFloat","getComputedStyle","transitionDuration","Object","freeze","_objectSpread","getOptions","remove","stop","setAsOpen","setAsClosed","getHeight","_this$withFallback","withFallback","getUnknownHeight","_this$elem$parentNode","_this$withFallback2","_this$withFallback3","_clonedElem$parentNod","clonedElem","cloneNode","inputs","querySelectorAll","input","removeAttribute","key","firstPaintStyle","style","position","parentNode","insertBefore","nextSibling","elemWidth","clientWidth","clonedWidth","width","removeChild","fallback","val","hasAttribute","getAttribute","isNaN","onStart","onEnd","start","fromHeight","toHeight","requestAnimationFrame","reqId1","reqId2","id","clearTimeout","cancelAnimationFrame","open","shouldBypassAnimation","target","currentTarget","overflowY","readjust","close","adjustTo","endHeight","newHeight","_globalThis$animation2","Boolean","_globalThis$bypassTim","IS_TEST","bypassTime"],"sources":["../../../../src/components/height-animation/HeightAnimationInstance.ts"],"sourcesContent":["export type HeightAnimationOnStartStates =\n | 'opening'\n | 'closing'\n | 'adjusting'\nexport type HeightAnimationOnEndStates = 'opened' | 'closed' | 'adjusted'\nexport type HeightAnimationStates =\n | HeightAnimationOnStartStates\n | HeightAnimationOnEndStates\n | 'init'\nexport type HeightAnimationOptions = {\n animate?: boolean\n}\nexport type HeightAnimationOnStartCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnEndCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnStartStack =\n Array<HeightAnimationOnStartCallback>\nexport type HeightAnimationOnEndStack = Array<HeightAnimationOnEndCallback>\nexport type HeightAnimationEventListener = (e: Event) => void\nexport type HeightAnimationEvents = Array<HeightAnimationEventListener>\nexport type HeightAnimationElement = HTMLElement\nexport type HeightAnimationContainer = HTMLElement\nexport type HeightAnimationFromHeight = number\nexport type HeightAnimationToHeight = number\n\nexport default class HeightAnimation {\n private state: Readonly<HeightAnimationStates>\n isInBrowser: boolean\n onStartStack: HeightAnimationOnStartStack = []\n onEndStack: HeightAnimationOnEndStack = []\n events: HeightAnimationEvents = []\n opts: HeightAnimationOptions = { animate: true }\n elem: HeightAnimationElement\n reqId1: number\n reqId2: number\n resizeTimeout: NodeJS.Timeout\n timeouts: NodeJS.Timeout[] = []\n firstTime?: number = 0\n startTime?: number = 0\n duration?: number = 0\n isAnimating: boolean\n __currentHeight: number\n\n firstPaintStyle = {\n visibility: 'hidden',\n opacity: '0', // prevents before/after elements to be visible\n height: 'auto',\n } as const\n\n constructor(opts: HeightAnimationOptions = {}) {\n this.isInBrowser = typeof window !== 'undefined'\n this.setState('init')\n this.setOptions(opts)\n }\n\n callAnimationStart() {\n this.startTime = Date.now()\n if (!this.firstTime) {\n this.firstTime = this.startTime\n }\n if (this.onStartStack) {\n this.onStartStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n callAnimationEnd() {\n this.isAnimating = false\n\n if (this.state !== 'opened') {\n delete this.__currentHeight\n }\n\n this.removeEndEvents()\n\n if (this.onEndStack) {\n this.onEndStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n addEndEvent(listener: HeightAnimationEventListener) {\n this.removeEndEvents() // also, remove events on every open (but not on close!)\n\n const handleTransitionEnd = (e) => {\n if (this.canFinish()) {\n listener(e)\n } else {\n const delay = this.duration - (Date.now() - this.startTime)\n\n if (delay === -1) {\n listener(e)\n } else {\n this.timeouts.push(setTimeout(() => listener(e), delay))\n }\n }\n }\n\n this.events.push(handleTransitionEnd)\n this.elem?.addEventListener?.('transitionend', handleTransitionEnd)\n }\n removeEndEvents() {\n this.events.forEach((listener) => {\n this.elem?.removeEventListener?.('transitionend', listener)\n })\n this.events = []\n }\n\n // Public methods\n setElement(elem: HeightAnimationElement) {\n this.elem =\n elem ||\n (typeof document !== 'undefined' && document.createElement('div'))\n\n // TODO: remove when responsive tables are supported\n if (String(this.elem?.nodeName).toLowerCase() === 'td') {\n this.elem = this.elem.parentElement\n }\n\n this.duration =\n globalThis.animationDuration ??\n (parseFloat(window.getComputedStyle(this.elem).transitionDuration) *\n 1000 ||\n 400) // The default duration\n }\n setState(state: HeightAnimationStates) {\n this.state = Object.freeze(state)\n }\n setOptions(opts: HeightAnimationOptions) {\n this.opts = Object.freeze({ ...this.opts, ...opts })\n }\n getOptions() {\n return this.opts\n }\n remove() {\n this.stop()\n this.removeEndEvents()\n this.setState('init')\n this.isAnimating = false\n this.onEndStack = []\n this.onStartStack = []\n this.__currentHeight = undefined\n this.elem = undefined\n }\n setAsOpen() {\n if (this.state === 'opened') {\n return\n }\n this.setState('opening')\n this.callAnimationStart()\n this.setState('opened')\n this.callAnimationEnd()\n }\n setAsClosed() {\n if (this.state === 'closed') {\n return\n }\n this.setState('closing')\n this.callAnimationStart()\n this.setState('closed')\n this.callAnimationEnd()\n }\n getHeight() {\n return this.withFallback(this.elem, 'clientHeight') ?? null\n }\n getUnknownHeight() {\n if (!this.elem) {\n return null\n }\n\n if (this.isAnimating && typeof this.__currentHeight !== 'undefined') {\n return this.__currentHeight\n }\n\n const clonedElem = this.elem.cloneNode(true) as HTMLElement\n const inputs = clonedElem.querySelectorAll('input')\n inputs.forEach((input) => {\n input.removeAttribute('name') // because type=\"radio\" will be else effected negatively\n input.removeAttribute('id') // don't put IDs twice in the DOM\n })\n\n // Hide the cloned element\n for (const key in this.firstPaintStyle) {\n clonedElem.style[key] = this.firstPaintStyle[key]\n }\n clonedElem.style.position = 'absolute' // not a part of the \"firstPaintStyle\"\n\n this.elem.parentNode?.insertBefore(clonedElem, this.elem.nextSibling)\n\n // When text is wrapped, we get different widths,\n // so we need to set the width to the original width\n const elemWidth = this.elem.clientWidth\n const clonedWidth =\n this.withFallback(clonedElem, 'clientWidth', 'data-width') ?? 0\n\n if (clonedWidth > elemWidth) {\n clonedElem.style.width = `${elemWidth}px`\n }\n\n const height =\n // data-height is used for mockup testing with \"mockHeight\"\n this.withFallback(this.elem, 'clientHeight', 'data-height') ?? null\n\n clonedElem.parentNode?.removeChild(clonedElem)\n\n if (height) {\n this.__currentHeight = height\n }\n\n return height\n }\n withFallback(\n elem: HTMLElement,\n key: 'clientHeight' | 'clientWidth',\n fallback?: 'data-height' | 'data-width'\n ) {\n const val =\n fallback && elem.hasAttribute(fallback)\n ? parseFloat(elem.getAttribute(fallback))\n : elem?.[key]\n\n if (isNaN(val)) {\n return null\n }\n\n return val\n }\n onStart(fn: HeightAnimationOnStartCallback) {\n this.onStartStack.push(fn)\n }\n onEnd(fn: HeightAnimationOnEndCallback) {\n this.onEndStack.push(fn)\n }\n start(\n fromHeight: HeightAnimationFromHeight,\n toHeight: HeightAnimationToHeight\n ) {\n if (\n !this.elem ||\n !(\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n )\n ) {\n return\n }\n\n const opts = this.getOptions()\n if (opts.animate === false) {\n return\n }\n\n this.stop()\n this.isAnimating = true\n\n // make the animation\n this.reqId1 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${fromHeight}px`\n\n this.reqId2 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${toHeight}px`\n })\n })\n }\n stop() {\n this.timeouts.forEach((id) => clearTimeout(id))\n this.timeouts = []\n\n if (\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n ) {\n window.cancelAnimationFrame(this.reqId1)\n window.cancelAnimationFrame(this.reqId2)\n }\n }\n open() {\n if (\n this.state === 'opened' ||\n this.state === 'opening' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsOpen()\n return\n }\n\n this.setState('opening')\n this.callAnimationStart()\n\n const toHeight = this.getUnknownHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.overflowY = ''\n }\n this.setState('opened')\n this.readjust()\n }\n })\n\n this.start(0, toHeight)\n }\n close() {\n if (\n this.state === 'closed' ||\n this.state === 'closing' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsClosed()\n return\n }\n\n this.setState('closing')\n this.callAnimationStart()\n\n const fromHeight = this.getHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.visibility = 'hidden'\n this.elem.style.overflowY = 'clip'\n }\n this.setState('closed')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, 0)\n }\n adjustTo(\n fromHeight: HeightAnimationFromHeight = null,\n toHeight: HeightAnimationToHeight = null\n ) {\n const opts = this.getOptions()\n\n if (\n !this.elem ||\n opts.animate === false ||\n this.state === 'opening' ||\n this.state === 'closing'\n ) {\n return\n }\n\n if (fromHeight === null) {\n fromHeight = this.getHeight()\n }\n if (toHeight === null) {\n toHeight = this.getUnknownHeight()\n }\n\n if (fromHeight === toHeight) {\n this.setState('adjusted')\n return\n }\n\n this.setState('adjusting')\n this.callAnimationStart()\n\n this.addEndEvent((e) => {\n if (\n this.state === 'adjusting' &&\n (e.target === e.currentTarget || !e.currentTarget)\n ) {\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n this.setState('adjusted')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, toHeight)\n }\n readjust() {\n const endHeight = this.getHeight()\n\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n\n this.__currentHeight = undefined\n const newHeight = this.getUnknownHeight()\n\n // If the height has changed during the animation, we need to adjust it\n if (endHeight !== newHeight) {\n this.adjustTo(endHeight, newHeight)\n } else {\n this.callAnimationEnd()\n }\n }\n /**\n * Determines whether the animation can finish.\n * Check for certain states and if the time passed is too short.\n * With a so short first state change, we do not call animation end.\n */\n canFinish() {\n return Boolean(\n this.startTime &&\n Date.now() - this.startTime >\n (globalThis.animationDuration ?? this.duration)\n )\n }\n /**\n * Determines whether the animation should be bypassed.\n * Check for certain states and if the time passed is too short to be correct.\n * With a very short first state change, we skip animation.\n */\n shouldBypassAnimation() {\n const opts = this.getOptions()\n\n if (!this.elem || opts.animate === false) {\n return true\n }\n\n if (\n this.isInBrowser &&\n (globalThis.IS_TEST || globalThis.bypassTime === -1)\n ) {\n return false\n }\n\n return Boolean(\n this.firstTime &&\n Date.now() - this.firstTime < (globalThis.bypassTime ?? 100)\n )\n }\n}\n"],"mappings":";;;AA4BA,eAAe,MAAMA,eAAe,CAAC;EAwBnCC,WAAWA,CAAA,EAAoC;IAAA,IAAnCC,IAA4B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAAAG,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBArBD,EAAE;IAAAA,eAAA,qBACN,EAAE;IAAAA,eAAA,iBACV,EAAE;IAAAA,eAAA,eACH;MAAEC,OAAO,EAAE;IAAK,CAAC;IAAAD,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAKnB,EAAE;IAAAA,eAAA,oBACV,CAAC;IAAAA,eAAA,oBACD,CAAC;IAAAA,eAAA,mBACF,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,0BAIH;MAChBE,UAAU,EAAE,QAAQ;MACpBC,OAAO,EAAE,GAAG;MACZC,MAAM,EAAE;IACV,CAAC;IAGC,IAAI,CAACC,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW;IAChD,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC;IACrB,IAAI,CAACC,UAAU,CAACZ,IAAI,CAAC;EACvB;EAEAa,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,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I;IACb;IAEA,IACE,IAAI,CAACI,WAAW,KACf8C,UAAU,CAACoE,OAAO,IAAIpE,UAAU,CAACqE,UAAU,KAAK,CAAC,CAAC,CAAC,EACpD;MACA,OAAO,KAAK;IACd;IAEA,OAAOH,OAAO,CACZ,IAAI,CAACxG,SAAS,IACZF,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,SAAS,KAAAyG,qBAAA,GAAInE,UAAU,CAACqE,UAAU,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,GAAG,CAC/D,CAAC;EACH;AACF"}
|
|
@@ -51,6 +51,7 @@ export default class HeightAnimation {
|
|
|
51
51
|
setAsClosed(): void;
|
|
52
52
|
getHeight(): number;
|
|
53
53
|
getUnknownHeight(): number;
|
|
54
|
+
withFallback(elem: HTMLElement, key: 'clientHeight' | 'clientWidth', fallback?: 'data-height' | 'data-width'): number;
|
|
54
55
|
onStart(fn: HeightAnimationOnStartCallback): void;
|
|
55
56
|
onEnd(fn: HeightAnimationOnEndCallback): void;
|
|
56
57
|
start(fromHeight: HeightAnimationFromHeight, toHeight: HeightAnimationToHeight): void;
|
|
@@ -128,11 +128,11 @@ export default class HeightAnimation {
|
|
|
128
128
|
this.callAnimationEnd();
|
|
129
129
|
}
|
|
130
130
|
getHeight() {
|
|
131
|
-
var _this$
|
|
132
|
-
return
|
|
131
|
+
var _this$withFallback;
|
|
132
|
+
return (_this$withFallback = this.withFallback(this.elem, 'clientHeight')) !== null && _this$withFallback !== void 0 ? _this$withFallback : null;
|
|
133
133
|
}
|
|
134
134
|
getUnknownHeight() {
|
|
135
|
-
var _this$elem$parentNode, _clonedElem$parentNod;
|
|
135
|
+
var _this$elem$parentNode, _this$withFallback2, _this$withFallback3, _clonedElem$parentNod;
|
|
136
136
|
if (!this.elem) {
|
|
137
137
|
return null;
|
|
138
138
|
}
|
|
@@ -151,17 +151,24 @@ export default class HeightAnimation {
|
|
|
151
151
|
clonedElem.style.position = 'absolute';
|
|
152
152
|
(_this$elem$parentNode = this.elem.parentNode) === null || _this$elem$parentNode === void 0 ? void 0 : _this$elem$parentNode.insertBefore(clonedElem, this.elem.nextSibling);
|
|
153
153
|
const elemWidth = this.elem.clientWidth;
|
|
154
|
-
const clonedWidth =
|
|
154
|
+
const clonedWidth = (_this$withFallback2 = this.withFallback(clonedElem, 'clientWidth', 'data-width')) !== null && _this$withFallback2 !== void 0 ? _this$withFallback2 : 0;
|
|
155
155
|
if (clonedWidth > elemWidth) {
|
|
156
156
|
clonedElem.style.width = `${elemWidth}px`;
|
|
157
157
|
}
|
|
158
|
-
const height =
|
|
158
|
+
const height = (_this$withFallback3 = this.withFallback(this.elem, 'clientHeight', 'data-height')) !== null && _this$withFallback3 !== void 0 ? _this$withFallback3 : null;
|
|
159
159
|
(_clonedElem$parentNod = clonedElem.parentNode) === null || _clonedElem$parentNod === void 0 ? void 0 : _clonedElem$parentNod.removeChild(clonedElem);
|
|
160
160
|
if (height) {
|
|
161
161
|
this.__currentHeight = height;
|
|
162
162
|
}
|
|
163
163
|
return height;
|
|
164
164
|
}
|
|
165
|
+
withFallback(elem, key, fallback) {
|
|
166
|
+
const val = fallback && elem.hasAttribute(fallback) ? parseFloat(elem.getAttribute(fallback)) : elem === null || elem === void 0 ? void 0 : elem[key];
|
|
167
|
+
if (isNaN(val)) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return val;
|
|
171
|
+
}
|
|
165
172
|
onStart(fn) {
|
|
166
173
|
this.onStartStack.push(fn);
|
|
167
174
|
}
|
|
@@ -243,7 +250,7 @@ export default class HeightAnimation {
|
|
|
243
250
|
if (!this.elem || opts.animate === false || this.state === 'opening' || this.state === 'closing') {
|
|
244
251
|
return;
|
|
245
252
|
}
|
|
246
|
-
if (fromHeight ===
|
|
253
|
+
if (fromHeight === null) {
|
|
247
254
|
fromHeight = this.getHeight();
|
|
248
255
|
}
|
|
249
256
|
if (toHeight === null) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeightAnimationInstance.js","names":["HeightAnimation","constructor","opts","_defineProperty","animate","visibility","opacity","height","isInBrowser","window","setState","setOptions","callAnimationStart","startTime","Date","now","firstTime","onStartStack","forEach","fn","state","callAnimationEnd","isAnimating","__currentHeight","removeEndEvents","onEndStack","addEndEvent","listener","_this$elem","_this$elem$addEventLi","handleTransitionEnd","e","canFinish","delay","duration","timeouts","push","setTimeout","events","elem","addEventListener","call","_this$elem2","_this$elem2$removeEve","removeEventListener","setElement","_this$elem3","_globalThis$animation","document","createElement","String","nodeName","toLowerCase","parentElement","globalThis","animationDuration","parseFloat","getComputedStyle","transitionDuration","Object","freeze","_objectSpread","getOptions","remove","stop","undefined","setAsOpen","setAsClosed","getHeight","_this$elem4","clientHeight","getUnknownHeight","_this$elem$parentNode","_clonedElem$parentNod","clonedElem","cloneNode","inputs","querySelectorAll","input","removeAttribute","key","firstPaintStyle","style","position","parentNode","insertBefore","nextSibling","elemWidth","clientWidth","clonedWidth","getAttribute","width","removeChild","onStart","onEnd","start","fromHeight","toHeight","requestAnimationFrame","reqId1","reqId2","id","clearTimeout","cancelAnimationFrame","open","shouldBypassAnimation","target","currentTarget","overflowY","readjust","close","adjustTo","endHeight","newHeight","_globalThis$animation2","Boolean","_globalThis$bypassTim","IS_TEST","bypassTime"],"sources":["../../../../src/components/height-animation/HeightAnimationInstance.ts"],"sourcesContent":["export type HeightAnimationOnStartStates =\n | 'opening'\n | 'closing'\n | 'adjusting'\nexport type HeightAnimationOnEndStates = 'opened' | 'closed' | 'adjusted'\nexport type HeightAnimationStates =\n | HeightAnimationOnStartStates\n | HeightAnimationOnEndStates\n | 'init'\nexport type HeightAnimationOptions = {\n animate?: boolean\n}\nexport type HeightAnimationOnStartCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnEndCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnStartStack =\n Array<HeightAnimationOnStartCallback>\nexport type HeightAnimationOnEndStack = Array<HeightAnimationOnEndCallback>\nexport type HeightAnimationEventListener = (e: Event) => void\nexport type HeightAnimationEvents = Array<HeightAnimationEventListener>\nexport type HeightAnimationElement = HTMLElement\nexport type HeightAnimationContainer = HTMLElement\nexport type HeightAnimationFromHeight = number\nexport type HeightAnimationToHeight = number\n\nexport default class HeightAnimation {\n private state: Readonly<HeightAnimationStates>\n isInBrowser: boolean\n onStartStack: HeightAnimationOnStartStack = []\n onEndStack: HeightAnimationOnEndStack = []\n events: HeightAnimationEvents = []\n opts: HeightAnimationOptions = { animate: true }\n elem: HeightAnimationElement\n reqId1: number\n reqId2: number\n resizeTimeout: NodeJS.Timeout\n timeouts: NodeJS.Timeout[] = []\n firstTime?: number = 0\n startTime?: number = 0\n duration?: number = 0\n isAnimating: boolean\n __currentHeight: number\n\n firstPaintStyle = {\n visibility: 'hidden',\n opacity: '0', // prevents before/after elements to be visible\n height: 'auto',\n } as const\n\n constructor(opts: HeightAnimationOptions = {}) {\n this.isInBrowser = typeof window !== 'undefined'\n this.setState('init')\n this.setOptions(opts)\n }\n\n callAnimationStart() {\n this.startTime = Date.now()\n if (!this.firstTime) {\n this.firstTime = this.startTime\n }\n if (this.onStartStack) {\n this.onStartStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n callAnimationEnd() {\n this.isAnimating = false\n\n if (this.state !== 'opened') {\n delete this.__currentHeight\n }\n\n this.removeEndEvents()\n\n if (this.onEndStack) {\n this.onEndStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n addEndEvent(listener: HeightAnimationEventListener) {\n this.removeEndEvents() // also, remove events on every open (but not on close!)\n\n const handleTransitionEnd = (e) => {\n if (this.canFinish()) {\n listener(e)\n } else {\n const delay = this.duration - (Date.now() - this.startTime)\n\n if (delay === -1) {\n listener(e)\n } else {\n this.timeouts.push(setTimeout(() => listener(e), delay))\n }\n }\n }\n\n this.events.push(handleTransitionEnd)\n this.elem?.addEventListener?.('transitionend', handleTransitionEnd)\n }\n removeEndEvents() {\n this.events.forEach((listener) => {\n this.elem?.removeEventListener?.('transitionend', listener)\n })\n this.events = []\n }\n\n // Public methods\n setElement(elem: HeightAnimationElement) {\n this.elem =\n elem ||\n (typeof document !== 'undefined' && document.createElement('div'))\n\n // TODO: remove when responsive tables are supported\n if (String(this.elem?.nodeName).toLowerCase() === 'td') {\n this.elem = this.elem.parentElement\n }\n\n this.duration =\n globalThis.animationDuration ??\n (parseFloat(window.getComputedStyle(this.elem).transitionDuration) *\n 1000 ||\n 400) // The default duration\n }\n setState(state: HeightAnimationStates) {\n this.state = Object.freeze(state)\n }\n setOptions(opts: HeightAnimationOptions) {\n this.opts = Object.freeze({ ...this.opts, ...opts })\n }\n getOptions() {\n return this.opts\n }\n remove() {\n this.stop()\n this.removeEndEvents()\n this.setState('init')\n this.isAnimating = false\n this.onEndStack = []\n this.onStartStack = []\n this.__currentHeight = undefined\n this.elem = undefined\n }\n setAsOpen() {\n if (this.state === 'opened') {\n return\n }\n this.setState('opening')\n this.callAnimationStart()\n this.setState('opened')\n this.callAnimationEnd()\n }\n setAsClosed() {\n if (this.state === 'closed') {\n return\n }\n this.setState('closing')\n this.callAnimationStart()\n this.setState('closed')\n this.callAnimationEnd()\n }\n getHeight() {\n return parseFloat(String(this.elem?.clientHeight)) || null\n }\n getUnknownHeight() {\n if (!this.elem) {\n return null\n }\n\n if (this.isAnimating && typeof this.__currentHeight !== 'undefined') {\n return this.__currentHeight\n }\n\n const clonedElem = this.elem.cloneNode(true) as HTMLElement\n const inputs = clonedElem.querySelectorAll('input')\n inputs.forEach((input) => {\n input.removeAttribute('name') // because type=\"radio\" will be else effected negatively\n input.removeAttribute('id') // don't put IDs twice in the DOM\n })\n\n // Hide the cloned element\n for (const key in this.firstPaintStyle) {\n clonedElem.style[key] = this.firstPaintStyle[key]\n }\n clonedElem.style.position = 'absolute' // not a part of the \"firstPaintStyle\"\n\n this.elem.parentNode?.insertBefore(clonedElem, this.elem.nextSibling)\n\n // When text is wrapped, we get different widths,\n // so we need to set the width to the original width\n const elemWidth = this.elem.clientWidth\n const clonedWidth =\n clonedElem.clientWidth ||\n // data-width is used for mockup testing with \"mockHeight\"\n parseFloat(clonedElem.getAttribute('data-width')) ||\n 0\n\n if (clonedWidth > elemWidth) {\n clonedElem.style.width = `${elemWidth}px`\n }\n\n const height =\n clonedElem.clientHeight ||\n // data-height is used for mockup testing with \"mockHeight\"\n parseFloat(clonedElem.getAttribute('data-height')) ||\n null\n\n clonedElem.parentNode?.removeChild(clonedElem)\n\n if (height) {\n this.__currentHeight = height\n }\n\n return height\n }\n onStart(fn: HeightAnimationOnStartCallback) {\n this.onStartStack.push(fn)\n }\n onEnd(fn: HeightAnimationOnEndCallback) {\n this.onEndStack.push(fn)\n }\n start(\n fromHeight: HeightAnimationFromHeight,\n toHeight: HeightAnimationToHeight\n ) {\n if (\n !this.elem ||\n !(\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n )\n ) {\n return\n }\n\n const opts = this.getOptions()\n if (opts.animate === false) {\n return\n }\n\n this.stop()\n this.isAnimating = true\n\n // make the animation\n this.reqId1 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${fromHeight}px`\n\n this.reqId2 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${toHeight}px`\n })\n })\n }\n stop() {\n this.timeouts.forEach((id) => clearTimeout(id))\n this.timeouts = []\n\n if (\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n ) {\n window.cancelAnimationFrame(this.reqId1)\n window.cancelAnimationFrame(this.reqId2)\n }\n }\n open() {\n if (\n this.state === 'opened' ||\n this.state === 'opening' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsOpen()\n return\n }\n\n this.setState('opening')\n this.callAnimationStart()\n\n const toHeight = this.getUnknownHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.overflowY = ''\n }\n this.setState('opened')\n this.readjust()\n }\n })\n\n this.start(0, toHeight)\n }\n close() {\n if (\n this.state === 'closed' ||\n this.state === 'closing' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsClosed()\n return\n }\n\n this.setState('closing')\n this.callAnimationStart()\n\n const fromHeight = this.getHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.visibility = 'hidden'\n this.elem.style.overflowY = 'clip'\n }\n this.setState('closed')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, 0)\n }\n adjustTo(\n fromHeight: HeightAnimationFromHeight = null,\n toHeight: HeightAnimationToHeight = null\n ) {\n const opts = this.getOptions()\n\n if (\n !this.elem ||\n opts.animate === false ||\n this.state === 'opening' ||\n this.state === 'closing'\n ) {\n return\n }\n\n if (fromHeight === 0 || fromHeight === null) {\n fromHeight = this.getHeight()\n }\n if (toHeight === null) {\n toHeight = this.getUnknownHeight()\n }\n\n if (fromHeight === toHeight) {\n this.setState('adjusted')\n return\n }\n\n this.setState('adjusting')\n this.callAnimationStart()\n\n this.addEndEvent((e) => {\n if (\n this.state === 'adjusting' &&\n (e.target === e.currentTarget || !e.currentTarget)\n ) {\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n this.setState('adjusted')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, toHeight)\n }\n readjust() {\n const endHeight = this.getHeight()\n\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n\n this.__currentHeight = undefined\n const newHeight = this.getUnknownHeight()\n\n // If the height has changed during the animation, we need to adjust it\n if (endHeight !== newHeight) {\n this.adjustTo(endHeight, newHeight)\n } else {\n this.callAnimationEnd()\n }\n }\n /**\n * Determines whether the animation can finish.\n * Check for certain states and if the time passed is too short.\n * With a so short first state change, we do not call animation end.\n */\n canFinish() {\n return Boolean(\n this.startTime &&\n Date.now() - this.startTime >\n (globalThis.animationDuration ?? this.duration)\n )\n }\n /**\n * Determines whether the animation should be bypassed.\n * Check for certain states and if the time passed is too short to be correct.\n * With a very short first state change, we skip animation.\n */\n shouldBypassAnimation() {\n const opts = this.getOptions()\n\n if (!this.elem || opts.animate === false) {\n return true\n }\n\n if (\n this.isInBrowser &&\n (globalThis.IS_TEST || globalThis.bypassTime === -1)\n ) {\n return false\n }\n\n return Boolean(\n this.firstTime &&\n Date.now() - this.firstTime < (globalThis.bypassTime ?? 100)\n )\n }\n}\n"],"mappings":";;;AA4BA,eAAe,MAAMA,eAAe,CAAC;EAwBnCC,WAAWA,CAACC,IAA4B,GAAG,CAAC,CAAC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBArBH,EAAE;IAAAA,eAAA,qBACN,EAAE;IAAAA,eAAA,iBACV,EAAE;IAAAA,eAAA,eACH;MAAEC,OAAO,EAAE;IAAK,CAAC;IAAAD,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAKnB,EAAE;IAAAA,eAAA,oBACV,CAAC;IAAAA,eAAA,oBACD,CAAC;IAAAA,eAAA,mBACF,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,0BAIH;MAChBE,UAAU,EAAE,QAAQ;MACpBC,OAAO,EAAE,GAAG;MACZC,MAAM,EAAE;IACV,CAAC;IAGC,IAAI,CAACC,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW;IAChD,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC;IACrB,IAAI,CAACC,UAAU,CAACT,IAAI,CAAC;EACvB;EAEAU,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAI,CAACH,SAAS;IACjC;IACA,IAAI,IAAI,CAACI,YAAY,EAAE;MACrB,IAAI,CAACA,YAAY,CAACC,OAAO,CAAEC,EA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C,CAAC;IACzB;EACF;EAMAW,SAASA,CAAA,EAAG;IAAA,IAAAkF,sBAAA;IACV,OAAOC,OAAO,CACZ,IAAI,CAACtG,SAAS,IACZC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACF,SAAS,KAAAqG,sBAAA,GACxB5D,UAAU,CAACC,iBAAiB,cAAA2D,sBAAA,cAAAA,sBAAA,GAAI,IAAI,CAAChF,QAAQ,CACpD,CAAC;EACH;EAMAuE,qBAAqBA,CAAA,EAAG;IAAA,IAAAW,qBAAA;IACtB,MAAMlH,IAAI,GAAG,IAAI,CAAC4D,UAAU,CAAC,CAAC;IAE9B,IAAI,CAAC,IAAI,CAACvB,IAAI,IAAIrC,IAAI,CAACE,OAAO,KAAK,KAAK,EAAE;MACxC,OAAO,IAAI;IACb;IAEA,IACE,IAAI,CAACI,WAAW,KACf8C,UAAU,CAAC+D,OAAO,IAAI/D,UAAU,CAACgE,UAAU,KAAK,CAAC,CAAC,CAAC,EACpD;MACA,OAAO,KAAK;IACd;IAEA,OAAOH,OAAO,CACZ,IAAI,CAACnG,SAAS,IACZF,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,SAAS,KAAAoG,qBAAA,GAAI9D,UAAU,CAACgE,UAAU,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,GAAG,CAC/D,CAAC;EACH;AACF"}
|
|
1
|
+
{"version":3,"file":"HeightAnimationInstance.js","names":["HeightAnimation","constructor","opts","_defineProperty","animate","visibility","opacity","height","isInBrowser","window","setState","setOptions","callAnimationStart","startTime","Date","now","firstTime","onStartStack","forEach","fn","state","callAnimationEnd","isAnimating","__currentHeight","removeEndEvents","onEndStack","addEndEvent","listener","_this$elem","_this$elem$addEventLi","handleTransitionEnd","e","canFinish","delay","duration","timeouts","push","setTimeout","events","elem","addEventListener","call","_this$elem2","_this$elem2$removeEve","removeEventListener","setElement","_this$elem3","_globalThis$animation","document","createElement","String","nodeName","toLowerCase","parentElement","globalThis","animationDuration","parseFloat","getComputedStyle","transitionDuration","Object","freeze","_objectSpread","getOptions","remove","stop","undefined","setAsOpen","setAsClosed","getHeight","_this$withFallback","withFallback","getUnknownHeight","_this$elem$parentNode","_this$withFallback2","_this$withFallback3","_clonedElem$parentNod","clonedElem","cloneNode","inputs","querySelectorAll","input","removeAttribute","key","firstPaintStyle","style","position","parentNode","insertBefore","nextSibling","elemWidth","clientWidth","clonedWidth","width","removeChild","fallback","val","hasAttribute","getAttribute","isNaN","onStart","onEnd","start","fromHeight","toHeight","requestAnimationFrame","reqId1","reqId2","id","clearTimeout","cancelAnimationFrame","open","shouldBypassAnimation","target","currentTarget","overflowY","readjust","close","adjustTo","endHeight","newHeight","_globalThis$animation2","Boolean","_globalThis$bypassTim","IS_TEST","bypassTime"],"sources":["../../../../src/components/height-animation/HeightAnimationInstance.ts"],"sourcesContent":["export type HeightAnimationOnStartStates =\n | 'opening'\n | 'closing'\n | 'adjusting'\nexport type HeightAnimationOnEndStates = 'opened' | 'closed' | 'adjusted'\nexport type HeightAnimationStates =\n | HeightAnimationOnStartStates\n | HeightAnimationOnEndStates\n | 'init'\nexport type HeightAnimationOptions = {\n animate?: boolean\n}\nexport type HeightAnimationOnStartCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnEndCallback = (\n state: HeightAnimationStates\n) => void\nexport type HeightAnimationOnStartStack =\n Array<HeightAnimationOnStartCallback>\nexport type HeightAnimationOnEndStack = Array<HeightAnimationOnEndCallback>\nexport type HeightAnimationEventListener = (e: Event) => void\nexport type HeightAnimationEvents = Array<HeightAnimationEventListener>\nexport type HeightAnimationElement = HTMLElement\nexport type HeightAnimationContainer = HTMLElement\nexport type HeightAnimationFromHeight = number\nexport type HeightAnimationToHeight = number\n\nexport default class HeightAnimation {\n private state: Readonly<HeightAnimationStates>\n isInBrowser: boolean\n onStartStack: HeightAnimationOnStartStack = []\n onEndStack: HeightAnimationOnEndStack = []\n events: HeightAnimationEvents = []\n opts: HeightAnimationOptions = { animate: true }\n elem: HeightAnimationElement\n reqId1: number\n reqId2: number\n resizeTimeout: NodeJS.Timeout\n timeouts: NodeJS.Timeout[] = []\n firstTime?: number = 0\n startTime?: number = 0\n duration?: number = 0\n isAnimating: boolean\n __currentHeight: number\n\n firstPaintStyle = {\n visibility: 'hidden',\n opacity: '0', // prevents before/after elements to be visible\n height: 'auto',\n } as const\n\n constructor(opts: HeightAnimationOptions = {}) {\n this.isInBrowser = typeof window !== 'undefined'\n this.setState('init')\n this.setOptions(opts)\n }\n\n callAnimationStart() {\n this.startTime = Date.now()\n if (!this.firstTime) {\n this.firstTime = this.startTime\n }\n if (this.onStartStack) {\n this.onStartStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n callAnimationEnd() {\n this.isAnimating = false\n\n if (this.state !== 'opened') {\n delete this.__currentHeight\n }\n\n this.removeEndEvents()\n\n if (this.onEndStack) {\n this.onEndStack.forEach((fn) => {\n if (typeof fn === 'function') {\n fn(this.state)\n }\n })\n }\n }\n addEndEvent(listener: HeightAnimationEventListener) {\n this.removeEndEvents() // also, remove events on every open (but not on close!)\n\n const handleTransitionEnd = (e) => {\n if (this.canFinish()) {\n listener(e)\n } else {\n const delay = this.duration - (Date.now() - this.startTime)\n\n if (delay === -1) {\n listener(e)\n } else {\n this.timeouts.push(setTimeout(() => listener(e), delay))\n }\n }\n }\n\n this.events.push(handleTransitionEnd)\n this.elem?.addEventListener?.('transitionend', handleTransitionEnd)\n }\n removeEndEvents() {\n this.events.forEach((listener) => {\n this.elem?.removeEventListener?.('transitionend', listener)\n })\n this.events = []\n }\n\n // Public methods\n setElement(elem: HeightAnimationElement) {\n this.elem =\n elem ||\n (typeof document !== 'undefined' && document.createElement('div'))\n\n // TODO: remove when responsive tables are supported\n if (String(this.elem?.nodeName).toLowerCase() === 'td') {\n this.elem = this.elem.parentElement\n }\n\n this.duration =\n globalThis.animationDuration ??\n (parseFloat(window.getComputedStyle(this.elem).transitionDuration) *\n 1000 ||\n 400) // The default duration\n }\n setState(state: HeightAnimationStates) {\n this.state = Object.freeze(state)\n }\n setOptions(opts: HeightAnimationOptions) {\n this.opts = Object.freeze({ ...this.opts, ...opts })\n }\n getOptions() {\n return this.opts\n }\n remove() {\n this.stop()\n this.removeEndEvents()\n this.setState('init')\n this.isAnimating = false\n this.onEndStack = []\n this.onStartStack = []\n this.__currentHeight = undefined\n this.elem = undefined\n }\n setAsOpen() {\n if (this.state === 'opened') {\n return\n }\n this.setState('opening')\n this.callAnimationStart()\n this.setState('opened')\n this.callAnimationEnd()\n }\n setAsClosed() {\n if (this.state === 'closed') {\n return\n }\n this.setState('closing')\n this.callAnimationStart()\n this.setState('closed')\n this.callAnimationEnd()\n }\n getHeight() {\n return this.withFallback(this.elem, 'clientHeight') ?? null\n }\n getUnknownHeight() {\n if (!this.elem) {\n return null\n }\n\n if (this.isAnimating && typeof this.__currentHeight !== 'undefined') {\n return this.__currentHeight\n }\n\n const clonedElem = this.elem.cloneNode(true) as HTMLElement\n const inputs = clonedElem.querySelectorAll('input')\n inputs.forEach((input) => {\n input.removeAttribute('name') // because type=\"radio\" will be else effected negatively\n input.removeAttribute('id') // don't put IDs twice in the DOM\n })\n\n // Hide the cloned element\n for (const key in this.firstPaintStyle) {\n clonedElem.style[key] = this.firstPaintStyle[key]\n }\n clonedElem.style.position = 'absolute' // not a part of the \"firstPaintStyle\"\n\n this.elem.parentNode?.insertBefore(clonedElem, this.elem.nextSibling)\n\n // When text is wrapped, we get different widths,\n // so we need to set the width to the original width\n const elemWidth = this.elem.clientWidth\n const clonedWidth =\n this.withFallback(clonedElem, 'clientWidth', 'data-width') ?? 0\n\n if (clonedWidth > elemWidth) {\n clonedElem.style.width = `${elemWidth}px`\n }\n\n const height =\n // data-height is used for mockup testing with \"mockHeight\"\n this.withFallback(this.elem, 'clientHeight', 'data-height') ?? null\n\n clonedElem.parentNode?.removeChild(clonedElem)\n\n if (height) {\n this.__currentHeight = height\n }\n\n return height\n }\n withFallback(\n elem: HTMLElement,\n key: 'clientHeight' | 'clientWidth',\n fallback?: 'data-height' | 'data-width'\n ) {\n const val =\n fallback && elem.hasAttribute(fallback)\n ? parseFloat(elem.getAttribute(fallback))\n : elem?.[key]\n\n if (isNaN(val)) {\n return null\n }\n\n return val\n }\n onStart(fn: HeightAnimationOnStartCallback) {\n this.onStartStack.push(fn)\n }\n onEnd(fn: HeightAnimationOnEndCallback) {\n this.onEndStack.push(fn)\n }\n start(\n fromHeight: HeightAnimationFromHeight,\n toHeight: HeightAnimationToHeight\n ) {\n if (\n !this.elem ||\n !(\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n )\n ) {\n return\n }\n\n const opts = this.getOptions()\n if (opts.animate === false) {\n return\n }\n\n this.stop()\n this.isAnimating = true\n\n // make the animation\n this.reqId1 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${fromHeight}px`\n\n this.reqId2 = window.requestAnimationFrame(() => {\n if (!this.elem) {\n return\n }\n\n this.elem.style.height = `${toHeight}px`\n })\n })\n }\n stop() {\n this.timeouts.forEach((id) => clearTimeout(id))\n this.timeouts = []\n\n if (\n this.isInBrowser &&\n typeof window.requestAnimationFrame === 'function'\n ) {\n window.cancelAnimationFrame(this.reqId1)\n window.cancelAnimationFrame(this.reqId2)\n }\n }\n open() {\n if (\n this.state === 'opened' ||\n this.state === 'opening' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsOpen()\n return\n }\n\n this.setState('opening')\n this.callAnimationStart()\n\n const toHeight = this.getUnknownHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.overflowY = ''\n }\n this.setState('opened')\n this.readjust()\n }\n })\n\n this.start(0, toHeight)\n }\n close() {\n if (\n this.state === 'closed' ||\n this.state === 'closing' ||\n this.shouldBypassAnimation()\n ) {\n this.setAsClosed()\n return\n }\n\n this.setState('closing')\n this.callAnimationStart()\n\n const fromHeight = this.getHeight()\n\n this.addEndEvent((e) => {\n if (e.target === e.currentTarget || !e.currentTarget) {\n if (this.elem) {\n this.elem.style.visibility = 'hidden'\n this.elem.style.overflowY = 'clip'\n }\n this.setState('closed')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, 0)\n }\n adjustTo(\n fromHeight: HeightAnimationFromHeight = null,\n toHeight: HeightAnimationToHeight = null\n ) {\n const opts = this.getOptions()\n\n if (\n !this.elem ||\n opts.animate === false ||\n this.state === 'opening' ||\n this.state === 'closing'\n ) {\n return\n }\n\n if (fromHeight === null) {\n fromHeight = this.getHeight()\n }\n if (toHeight === null) {\n toHeight = this.getUnknownHeight()\n }\n\n if (fromHeight === toHeight) {\n this.setState('adjusted')\n return\n }\n\n this.setState('adjusting')\n this.callAnimationStart()\n\n this.addEndEvent((e) => {\n if (\n this.state === 'adjusting' &&\n (e.target === e.currentTarget || !e.currentTarget)\n ) {\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n this.setState('adjusted')\n this.callAnimationEnd()\n }\n })\n\n this.start(fromHeight, toHeight)\n }\n readjust() {\n const endHeight = this.getHeight()\n\n if (this.elem) {\n this.elem.style.height = 'auto'\n }\n\n this.__currentHeight = undefined\n const newHeight = this.getUnknownHeight()\n\n // If the height has changed during the animation, we need to adjust it\n if (endHeight !== newHeight) {\n this.adjustTo(endHeight, newHeight)\n } else {\n this.callAnimationEnd()\n }\n }\n /**\n * Determines whether the animation can finish.\n * Check for certain states and if the time passed is too short.\n * With a so short first state change, we do not call animation end.\n */\n canFinish() {\n return Boolean(\n this.startTime &&\n Date.now() - this.startTime >\n (globalThis.animationDuration ?? this.duration)\n )\n }\n /**\n * Determines whether the animation should be bypassed.\n * Check for certain states and if the time passed is too short to be correct.\n * With a very short first state change, we skip animation.\n */\n shouldBypassAnimation() {\n const opts = this.getOptions()\n\n if (!this.elem || opts.animate === false) {\n return true\n }\n\n if (\n this.isInBrowser &&\n (globalThis.IS_TEST || globalThis.bypassTime === -1)\n ) {\n return false\n }\n\n return Boolean(\n this.firstTime &&\n Date.now() - this.firstTime < (globalThis.bypassTime ?? 100)\n )\n }\n}\n"],"mappings":";;;AA4BA,eAAe,MAAMA,eAAe,CAAC;EAwBnCC,WAAWA,CAACC,IAA4B,GAAG,CAAC,CAAC,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA,uBArBH,EAAE;IAAAA,eAAA,qBACN,EAAE;IAAAA,eAAA,iBACV,EAAE;IAAAA,eAAA,eACH;MAAEC,OAAO,EAAE;IAAK,CAAC;IAAAD,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAKnB,EAAE;IAAAA,eAAA,oBACV,CAAC;IAAAA,eAAA,oBACD,CAAC;IAAAA,eAAA,mBACF,CAAC;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,0BAIH;MAChBE,UAAU,EAAE,QAAQ;MACpBC,OAAO,EAAE,GAAG;MACZC,MAAM,EAAE;IACV,CAAC;IAGC,IAAI,CAACC,WAAW,GAAG,OAAOC,MAAM,KAAK,WAAW;IAChD,IAAI,CAACC,QAAQ,CAAC,MAAM,CAAC;IACrB,IAAI,CAACC,UAAU,CAACT,IAAI,CAAC;EACvB;EAEAU,kBAAkBA,CAAA,EAAG;IACnB,IAAI,CAACC,SAAS,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,IAAI,CAACC,SAAS,EAAE;MACnB,IAAI,CAACA,SAAS,GAAG,IAAI,CAACH,SAAS;IACjC;IACA,IAAI,IAAI,CAACI,YAAY,EAAE;MACrB,IAAI,CAACA,YAAY,CAACC,OAAO,CAAEC,EAAE,IAAK;QAChC,IAAI,OAAOA,EAAE,KAAK,UAAU,EAAE;UAC5BA,EAAE,CAAC,IAAI,CAACC,KAAK,CAAC;QAChB;MACF,CAAC,CAAC;IACJ;EACF;EACAC,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACC,WAAW,GAAG,KAAK;IAEx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AMsD,SAAS,GAAG,IAAI,CAAChD,gBAAgB,CAAC,CAAC;IAGzC,IAAI+C,SAAS,KAAKC,SAAS,EAAE;MAC3B,IAAI,CAACF,QAAQ,CAACC,SAAS,EAAEC,SAAS,CAAC;IACrC,CAAC,MAAM;MACL,IAAI,CAAClG,gBAAgB,CAAC,CAAC;IACzB;EACF;EAMAW,SAASA,CAAA,EAAG;IAAA,IAAAwF,sBAAA;IACV,OAAOC,OAAO,CACZ,IAAI,CAAC5G,SAAS,IACZC,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACF,SAAS,KAAA2G,sBAAA,GACxBlE,UAAU,CAACC,iBAAiB,cAAAiE,sBAAA,cAAAA,sBAAA,GAAI,IAAI,CAACtF,QAAQ,CACpD,CAAC;EACH;EAMA6E,qBAAqBA,CAAA,EAAG;IAAA,IAAAW,qBAAA;IACtB,MAAMxH,IAAI,GAAG,IAAI,CAAC4D,UAAU,CAAC,CAAC;IAE9B,IAAI,CAAC,IAAI,CAACvB,IAAI,IAAIrC,IAAI,CAACE,OAAO,KAAK,KAAK,EAAE;MACxC,OAAO,IAAI;IACb;IAEA,IACE,IAAI,CAACI,WAAW,KACf8C,UAAU,CAACqE,OAAO,IAAIrE,UAAU,CAACsE,UAAU,KAAK,CAAC,CAAC,CAAC,EACpD;MACA,OAAO,KAAK;IACd;IAEA,OAAOH,OAAO,CACZ,IAAI,CAACzG,SAAS,IACZF,IAAI,CAACC,GAAG,CAAC,CAAC,GAAG,IAAI,CAACC,SAAS,KAAA0G,qBAAA,GAAIpE,UAAU,CAACsE,UAAU,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,GAAG,CAC/D,CAAC;EACH;AACF"}
|
|
@@ -5,6 +5,9 @@ import { Props as ProviderProps } from './Provider';
|
|
|
5
5
|
type HandleSubmitProps = {
|
|
6
6
|
formElement?: HTMLFormElement;
|
|
7
7
|
};
|
|
8
|
+
export type MountOptions = {
|
|
9
|
+
isMounted?: boolean;
|
|
10
|
+
};
|
|
8
11
|
export type EventListenerCall = {
|
|
9
12
|
path?: Path;
|
|
10
13
|
type?: 'onSubmit' | 'onPathChange';
|
|
@@ -58,8 +61,7 @@ export interface ContextState {
|
|
|
58
61
|
hasFieldError: (path: Path) => boolean;
|
|
59
62
|
setFieldState: (path: Path, fieldState: SubmitState) => void;
|
|
60
63
|
setFieldError: (path: Path, error: Error | FormError) => void;
|
|
61
|
-
|
|
62
|
-
handleUnMountField: (path: Path) => void;
|
|
64
|
+
setMountedFieldState: (path: Path, options: MountOptions) => void;
|
|
63
65
|
setFormState?: (state: SubmitState) => void;
|
|
64
66
|
setSubmitState?: (state: EventStateObject) => void;
|
|
65
67
|
addOnChangeHandler?: (callback: OnChange) => void;
|
|
@@ -70,13 +72,13 @@ export interface ContextState {
|
|
|
70
72
|
skipErrorCheck?: boolean;
|
|
71
73
|
}) => void;
|
|
72
74
|
setFieldEventListener?: (path: EventListenerCall['path'], type: EventListenerCall['type'], callback: EventListenerCall['callback']) => void;
|
|
73
|
-
|
|
75
|
+
setVisibleError?: (path: Path, hasError: boolean) => void;
|
|
74
76
|
setFieldProps?: (path: Path, props: unknown) => void;
|
|
75
77
|
setValueProps?: (path: Path, props: unknown) => void;
|
|
76
78
|
setHandleSubmit?: (callback: HandleSubmitCallback) => void;
|
|
77
79
|
fieldPropsRef?: React.MutableRefObject<Record<string, FieldProps>>;
|
|
78
80
|
valuePropsRef?: React.MutableRefObject<Record<string, ValueProps>>;
|
|
79
|
-
|
|
81
|
+
mountedFieldsRef?: React.MutableRefObject<Record<Path, MountOptions>>;
|
|
80
82
|
showAllErrors: boolean;
|
|
81
83
|
hasVisibleError: boolean;
|
|
82
84
|
formState: SubmitState;
|
|
@@ -19,8 +19,7 @@ export const defaultContextState = {
|
|
|
19
19
|
setSubmitState: () => null,
|
|
20
20
|
handleSubmitCall: () => null,
|
|
21
21
|
setShowAllErrors: () => null,
|
|
22
|
-
|
|
23
|
-
handleUnMountField: () => null,
|
|
22
|
+
setMountedFieldState: () => null,
|
|
24
23
|
hasErrors: () => false,
|
|
25
24
|
hasFieldState: () => false,
|
|
26
25
|
hasFieldError: () => false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","names":["React","makeAjvInstance","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","
|
|
1
|
+
{"version":3,"file":"Context.js","names":["React","makeAjvInstance","defaultContextState","hasContext","data","undefined","schema","submitState","handlePathChange","handlePathChangeUnvalidated","updateDataValue","setData","validateData","handleSubmit","scrollToTop","showAllErrors","hasVisibleError","formState","setFormState","setSubmitState","handleSubmitCall","setShowAllErrors","setMountedFieldState","hasErrors","hasFieldState","hasFieldError","setFieldState","setFieldError","ajvInstance","contextErrorMessages","isInsideFormElement","props","Context","createContext"],"sources":["../../../../../src/extensions/forms/DataContext/Context.ts"],"sourcesContent":["import React from 'react'\nimport { Ajv, makeAjvInstance } from '../utils/ajv'\nimport {\n AllJSONSchemaVersions,\n CustomErrorMessagesWithPaths,\n SubmitState,\n Path,\n EventStateObject,\n EventReturnWithStateObject,\n Identifier,\n FieldProps,\n FormError,\n ValueProps,\n OnChange,\n} from '../types'\nimport { Props as ProviderProps } from './Provider'\n\ntype HandleSubmitProps = {\n formElement?: HTMLFormElement\n}\n\nexport type MountOptions = {\n isMounted?: boolean\n}\n\nexport type EventListenerCall = {\n path?: Path\n type?: 'onSubmit' | 'onPathChange'\n callback: (params?: { value: unknown }) => void | Promise<void | Error>\n}\n\nexport type FilterDataHandler<Data> = (\n data: Data,\n filter: FilterData\n) => Partial<Data>\nexport type FilterDataHandlerCallback<R> = (\n parameters: FilterDataHandlerParameters\n) => R\nexport type FilterDataHandlerParameters =\n FilterDataPathConditionParameters & {\n path: Path\n }\nexport type FilterDataPathCondition<Data = unknown> = (\n parameters: FilterDataPathConditionParameters<Data>\n) => boolean | undefined\nexport type FilterDataPathConditionParameters<Data = unknown> = {\n value: unknown\n props: FieldProps\n data: Data\n internal: {\n error: Error | undefined\n }\n}\nexport type FilterDataPathObject<Data> = Record<\n Path,\n FilterDataPathCondition<Data> | boolean | undefined\n>\nexport type FilterData<Data = unknown> =\n | FilterDataPathObject<Data>\n | FilterDataHandlerCallback<boolean | undefined>\nexport type TransformData = FilterDataHandlerCallback<unknown>\nexport type HandleSubmitCallback = ({\n preventSubmit,\n}: {\n preventSubmit: () => void\n}) => void\n\nexport interface ContextState {\n id?: Identifier\n hasContext: boolean\n /** The dataset for the form / form wizard */\n data: any\n internalDataRef?: React.MutableRefObject<any>\n /** Should the form validate data before submitting? */\n errors?: Record<string, Error>\n /** Will set autoComplete=\"on\" on each nested Field.String and Field.Number */\n autoComplete?: boolean\n handlePathChange: (\n path: Path,\n value?: any\n ) =>\n | EventReturnWithStateObject\n | unknown\n | Promise<EventReturnWithStateObject | unknown>\n handlePathChangeUnvalidated: (path: Path, value: any) => void\n updateDataValue: (path: Path, value: any) => void\n setData: (data: any) => void\n clearData?: () => void\n mutateDataHandler?: (data: any, mutate: TransformData) => any\n filterDataHandler?: (data: any, filter: FilterData) => any\n validateData: () => void\n handleSubmit: (props?: HandleSubmitProps) => any\n scrollToTop: () => void\n setShowAllErrors: (showAllErrors: boolean) => void\n hasErrors: () => boolean\n hasFieldState: (state: SubmitState) => boolean\n hasFieldError: (path: Path) => boolean\n setFieldState: (path: Path, fieldState: SubmitState) => void\n setFieldError: (path: Path, error: Error | FormError) => void\n setMountedFieldState: (path: Path, options: MountOptions) => void\n setFormState?: (state: SubmitState) => void\n setSubmitState?: (state: EventStateObject) => void\n addOnChangeHandler?: (callback: OnChange) => void\n handleSubmitCall: ({\n onSubmit,\n enableAsyncBehavior,\n skipFieldValidation,\n skipErrorCheck,\n }: {\n onSubmit: () =>\n | EventReturnWithStateObject\n | void\n | Promise<EventReturnWithStateObject | void>\n enableAsyncBehavior: boolean\n skipFieldValidation?: boolean\n skipErrorCheck?: boolean\n }) => void\n setFieldEventListener?: (\n path: EventListenerCall['path'],\n type: EventListenerCall['type'],\n callback: EventListenerCall['callback']\n ) => void\n setVisibleError?: (path: Path, hasError: boolean) => void\n setFieldProps?: (path: Path, props: unknown) => void\n setValueProps?: (path: Path, props: unknown) => void\n setHandleSubmit?: (callback: HandleSubmitCallback) => void\n fieldPropsRef?: React.MutableRefObject<Record<string, FieldProps>>\n valuePropsRef?: React.MutableRefObject<Record<string, ValueProps>>\n mountedFieldsRef?: React.MutableRefObject<Record<Path, MountOptions>>\n showAllErrors: boolean\n hasVisibleError: boolean\n formState: SubmitState\n ajvInstance: Ajv\n contextErrorMessages: CustomErrorMessagesWithPaths\n schema: AllJSONSchemaVersions\n path?: Path\n disabled?: boolean\n required?: boolean\n submitState: Partial<EventStateObject>\n isInsideFormElement?: boolean\n prerenderFieldProps?: boolean\n props: ProviderProps<unknown>\n}\n\nexport const defaultContextState: ContextState = {\n hasContext: false,\n data: undefined,\n schema: undefined,\n submitState: undefined,\n handlePathChange: () => null,\n handlePathChangeUnvalidated: () => null,\n updateDataValue: () => null,\n setData: () => null,\n validateData: () => null,\n handleSubmit: () => null,\n scrollToTop: () => null,\n showAllErrors: false,\n hasVisibleError: false,\n formState: undefined,\n setFormState: () => null,\n setSubmitState: () => null,\n handleSubmitCall: () => null,\n setShowAllErrors: () => null,\n setMountedFieldState: () => null,\n hasErrors: () => false,\n hasFieldState: () => false,\n hasFieldError: () => false,\n setFieldState: () => null,\n setFieldError: () => null,\n ajvInstance: makeAjvInstance(),\n contextErrorMessages: undefined,\n isInsideFormElement: false,\n props: null,\n}\n\nconst Context = React.createContext<ContextState>(defaultContextState)\n\nexport default Context\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAcC,eAAe,QAAQ,cAAc;AA+InD,OAAO,MAAMC,mBAAiC,GAAG;EAC/CC,UAAU,EAAE,KAAK;EACjBC,IAAI,EAAEC,SAAS;EACfC,MAAM,EAAED,SAAS;EACjBE,WAAW,EAAEF,SAAS;EACtBG,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,2BAA2B,EAAEA,CAAA,KAAM,IAAI;EACvCC,eAAe,EAAEA,CAAA,KAAM,IAAI;EAC3BC,OAAO,EAAEA,CAAA,KAAM,IAAI;EACnBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,WAAW,EAAEA,CAAA,KAAM,IAAI;EACvBC,aAAa,EAAE,KAAK;EACpBC,eAAe,EAAE,KAAK;EACtBC,SAAS,EAAEZ,SAAS;EACpBa,YAAY,EAAEA,CAAA,KAAM,IAAI;EACxBC,cAAc,EAAEA,CAAA,KAAM,IAAI;EAC1BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,gBAAgB,EAAEA,CAAA,KAAM,IAAI;EAC5BC,oBAAoB,EAAEA,CAAA,KAAM,IAAI;EAChCC,SAAS,EAAEA,CAAA,KAAM,KAAK;EACtBC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,KAAK;EAC1BC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,aAAa,EAAEA,CAAA,KAAM,IAAI;EACzBC,WAAW,EAAE3B,eAAe,CAAC,CAAC;EAC9B4B,oBAAoB,EAAExB,SAAS;EAC/ByB,mBAAmB,EAAE,KAAK;EAC1BC,KAAK,EAAE;AACT,CAAC;AAED,MAAMC,OAAO,GAAGhC,KAAK,CAACiC,aAAa,CAAe/B,mBAAmB,CAAC;AAEtE,eAAe8B,OAAO"}
|
|
@@ -30,6 +30,10 @@ export interface FieldBoundaryContextState {
|
|
|
30
30
|
* To set the local error state.
|
|
31
31
|
*/
|
|
32
32
|
setFieldError?: (path: Path, error: Error) => void;
|
|
33
|
+
/**
|
|
34
|
+
* To set the local visible error state.
|
|
35
|
+
*/
|
|
36
|
+
setVisibleError?: (path: Path, hasError: boolean) => void;
|
|
33
37
|
}
|
|
34
38
|
declare const FieldBoundaryContext: React.Context<FieldBoundaryContextState>;
|
|
35
39
|
export default FieldBoundaryContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldBoundaryContext.js","names":["React","FieldBoundaryContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\n\nexport interface FieldBoundaryContextState {\n /**\n * Will be set to true when one or more nested fields are in error state.\n */\n hasError?: boolean\n\n /**\n * Will be set to true when the inherited data context has submit errors and the `hasError` has errors as well.\n */\n hasSubmitError?: boolean\n\n /**\n * Will be set to true when a nested field contains a visible error.\n */\n hasVisibleError?: boolean\n\n /**\n * Contains the nested field errors.\n */\n errorsRef?: React.RefObject<unknown>\n\n /**\n * Will be set to true when the boundary context error state should be shown.\n * Support a number to ensure we can renew hooks each time we get a new value.\n */\n showBoundaryErrors?: boolean | number\n\n /**\n * To set the boundary context error state.\n */\n setShowBoundaryErrors?: (\n showBoundaryErrors: FieldBoundaryContextState['showBoundaryErrors']\n ) => void\n\n /**\n * To set the local error state.\n */\n setFieldError?: (path: Path, error: Error) => void\n}\n\nconst FieldBoundaryContext = React.createContext<\n FieldBoundaryContextState | undefined\n>(undefined)\n\nexport default FieldBoundaryContext\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"FieldBoundaryContext.js","names":["React","FieldBoundaryContext","createContext","undefined"],"sources":["../../../../../../src/extensions/forms/DataContext/FieldBoundary/FieldBoundaryContext.ts"],"sourcesContent":["import React from 'react'\nimport { Path } from '../../types'\n\nexport interface FieldBoundaryContextState {\n /**\n * Will be set to true when one or more nested fields are in error state.\n */\n hasError?: boolean\n\n /**\n * Will be set to true when the inherited data context has submit errors and the `hasError` has errors as well.\n */\n hasSubmitError?: boolean\n\n /**\n * Will be set to true when a nested field contains a visible error.\n */\n hasVisibleError?: boolean\n\n /**\n * Contains the nested field errors.\n */\n errorsRef?: React.RefObject<unknown>\n\n /**\n * Will be set to true when the boundary context error state should be shown.\n * Support a number to ensure we can renew hooks each time we get a new value.\n */\n showBoundaryErrors?: boolean | number\n\n /**\n * To set the boundary context error state.\n */\n setShowBoundaryErrors?: (\n showBoundaryErrors: FieldBoundaryContextState['showBoundaryErrors']\n ) => void\n\n /**\n * To set the local error state.\n */\n setFieldError?: (path: Path, error: Error) => void\n\n /**\n * To set the local visible error state.\n */\n setVisibleError?: (path: Path, hasError: boolean) => void\n}\n\nconst FieldBoundaryContext = React.createContext<\n FieldBoundaryContextState | undefined\n>(undefined)\n\nexport default FieldBoundaryContext\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAgDzB,MAAMC,oBAAoB,GAAGD,KAAK,CAACE,aAAa,CAE9CC,SAAS,CAAC;AAEZ,eAAeF,oBAAoB"}
|