@semcore/core 16.0.0-prerelease.9 → 16.0.1-prerelease.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 +33 -1
- package/README.md +1 -31
- package/lib/{LastInteractionType.cjs → LastInteractionType.js} +4 -6
- package/lib/LastInteractionType.js.map +1 -0
- package/lib/LastInteractionType.mjs +1 -2
- package/lib/LastInteractionType.mjs.map +1 -1
- package/lib/core-types/Component.d.ts +11 -13
- package/lib/core-types/Component.js +88 -0
- package/lib/core-types/Component.js.map +1 -0
- package/lib/core-types/Component.mjs +11 -14
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/UnknownProperties.js +2 -0
- package/lib/core-types/UnknownProperties.js.map +1 -0
- package/lib/core-types/UnknownProperties.mjs.map +1 -1
- package/lib/core-types/reshadow.d.js +2 -0
- package/lib/core-types/reshadow.d.js.map +1 -0
- package/lib/core-types/reshadow.d.mjs.map +1 -1
- package/lib/core-types/symbols.js +16 -0
- package/lib/core-types/symbols.js.map +1 -0
- package/lib/core-types/symbols.mjs.map +1 -1
- package/lib/coreFactory.d.ts +4 -4
- package/lib/{coreFactory.cjs → coreFactory.js} +38 -39
- package/lib/coreFactory.js.map +1 -0
- package/lib/coreFactory.mjs +39 -34
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/enhancement/{Children.cjs → Children.js} +10 -11
- package/lib/enhancement/Children.js.map +1 -0
- package/lib/enhancement/Children.mjs +8 -8
- package/lib/enhancement/Children.mjs.map +1 -1
- package/lib/enhancement/Root.d.ts +1 -1
- package/lib/enhancement/{Root.cjs → Root.js} +6 -7
- package/lib/enhancement/Root.js.map +1 -0
- package/lib/enhancement/Root.mjs +2 -6
- package/lib/enhancement/Root.mjs.map +1 -1
- package/lib/enhancement/bindHandler.d.ts +1 -1
- package/lib/enhancement/{bindHandler.cjs → bindHandler.js} +3 -4
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/bindHandler.mjs +1 -1
- package/lib/enhancement/bindHandler.mjs.map +1 -1
- package/lib/enhancement/{dataName.cjs → dataName.js} +3 -4
- package/lib/enhancement/dataName.js.map +1 -0
- package/lib/enhancement/dataName.mjs.map +1 -1
- package/lib/enhancement/{enhance.cjs → enhance.js} +2 -3
- package/lib/enhancement/enhance.js.map +1 -0
- package/lib/enhancement/enhance.mjs.map +1 -1
- package/lib/enhancement/{functionDefaultProps.cjs → functionDefaultProps.js} +2 -3
- package/lib/enhancement/functionDefaultProps.js.map +1 -0
- package/lib/enhancement/functionDefaultProps.mjs.map +1 -1
- package/lib/enhancement/hoistProps.d.ts +1 -1
- package/lib/enhancement/{hoistProps.cjs → hoistProps.js} +6 -8
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/hoistProps.mjs +2 -2
- package/lib/enhancement/hoistProps.mjs.map +1 -1
- package/lib/enhancement/{i18n.cjs → i18n.js} +3 -4
- package/lib/enhancement/i18n.js.map +1 -0
- package/lib/enhancement/i18n.mjs.map +1 -1
- package/lib/enhancement/{inheritedName.cjs → inheritedName.js} +3 -4
- package/lib/enhancement/inheritedName.js.map +1 -0
- package/lib/enhancement/inheritedName.mjs.map +1 -1
- package/lib/enhancement/{staticChildren.cjs → staticChildren.js} +6 -9
- package/lib/enhancement/staticChildren.js.map +1 -0
- package/lib/enhancement/staticChildren.mjs +1 -1
- package/lib/enhancement/staticChildren.mjs.map +1 -1
- package/lib/enhancement/{style.cjs → style.js} +5 -7
- package/lib/enhancement/style.js.map +1 -0
- package/lib/enhancement/style.mjs +2 -3
- package/lib/enhancement/style.mjs.map +1 -1
- package/lib/enhancement/{uncontrolledProps.cjs → uncontrolledProps.js} +5 -7
- package/lib/enhancement/uncontrolledProps.js.map +1 -0
- package/lib/enhancement/uncontrolledProps.mjs +2 -3
- package/lib/enhancement/uncontrolledProps.mjs.map +1 -1
- package/lib/esm/LastInteractionType.mjs +1 -2
- package/lib/esm/core-types/Component.mjs +11 -14
- package/lib/esm/coreFactory.mjs +39 -34
- package/lib/esm/enhancement/Children.mjs +8 -8
- package/lib/esm/enhancement/Root.mjs +2 -6
- package/lib/esm/enhancement/bindHandler.mjs +1 -1
- package/lib/esm/enhancement/hoistProps.mjs +2 -2
- package/lib/esm/enhancement/staticChildren.mjs +1 -1
- package/lib/esm/enhancement/style.mjs +2 -3
- package/lib/esm/enhancement/uncontrolledProps.mjs +2 -3
- package/lib/esm/index.mjs +3 -2
- package/lib/esm/register.mjs +1 -2
- package/lib/esm/styled/index.mjs +8 -0
- package/lib/esm/styled/reshadow-core.mjs +219 -3
- package/lib/esm/styled/sstyled.mjs +1 -1
- package/lib/esm/utils/assignProps.mjs +10 -0
- package/lib/esm/utils/createHoc.mjs +47 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +41 -15
- package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/logger.mjs +1 -2
- package/lib/esm/utils/ref.mjs +46 -2
- package/lib/index.d.ts +5 -5
- package/lib/{index.cjs → index.js} +5 -5
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +3 -2
- package/lib/index.mjs.map +1 -1
- package/lib/{register.cjs → register.js} +5 -8
- package/lib/register.js.map +1 -0
- package/lib/register.mjs +1 -2
- package/lib/register.mjs.map +1 -1
- package/lib/styled/index.d.ts +1 -2
- package/lib/styled/{index.cjs → index.js} +1 -1
- package/lib/styled/index.js.map +1 -0
- package/lib/styled/index.mjs +8 -6
- package/lib/styled/index.mjs.map +1 -1
- package/lib/styled/{reshadow-core.cjs → reshadow-core.js} +28 -51
- package/lib/styled/reshadow-core.js.map +1 -0
- package/lib/styled/reshadow-core.mjs +219 -3
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.d.ts +2 -2
- package/lib/styled/{sstyled.cjs → sstyled.js} +4 -4
- package/lib/styled/sstyled.js.map +1 -0
- package/lib/styled/sstyled.mjs +1 -1
- package/lib/styled/sstyled.mjs.map +1 -1
- package/lib/theme/dark.json +4 -4
- package/lib/theme/light.json +4 -44
- package/lib/theme/{processor.cjs → processor.js} +62 -64
- package/lib/theme/processor.js.map +1 -0
- package/lib/theme/processor.mjs +52 -53
- package/lib/theme/processor.mjs.map +1 -1
- package/lib/theme/themes/auto.css +228 -6
- package/lib/theme/themes/dark.css +114 -3
- package/lib/theme/themes/dark.d.ts +92 -1
- package/lib/theme/themes/{dark.cjs → dark.js} +95 -5
- package/lib/theme/themes/dark.js.map +1 -0
- package/lib/theme/themes/dark.mjs +93 -2
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +114 -3
- package/lib/theme/themes/default.d.ts +92 -1
- package/lib/theme/themes/{light.cjs → default.js} +95 -5
- package/lib/theme/themes/default.js.map +1 -0
- package/lib/theme/themes/default.mjs +93 -2
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/light.css +114 -3
- package/lib/theme/themes/light.d.ts +92 -1
- package/lib/theme/themes/{default.cjs → light.js} +95 -5
- package/lib/theme/themes/light.js.map +1 -0
- package/lib/theme/themes/light.mjs +93 -2
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/theme/utils.d.ts +2 -1
- package/lib/theme/{utils.cjs → utils.js} +37 -33
- package/lib/theme/utils.js.map +1 -0
- package/lib/theme/utils.mjs +31 -23
- package/lib/theme/utils.mjs.map +1 -1
- package/lib/utils/CSSinJS.d.ts +1 -1
- package/lib/utils/{CSSinJS.cjs → CSSinJS.js} +5 -6
- package/lib/utils/CSSinJS.js.map +1 -0
- package/lib/utils/CSSinJS.mjs +2 -2
- package/lib/utils/CSSinJS.mjs.map +1 -1
- package/lib/utils/ScreenReaderOnly.d.ts +1 -1
- package/lib/utils/{ScreenReaderOnly.cjs → ScreenReaderOnly.js} +3 -4
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -1
- package/lib/utils/ThemeProvider.d.ts +1 -1
- package/lib/utils/{ThemeProvider.cjs → ThemeProvider.js} +6 -10
- package/lib/utils/ThemeProvider.js.map +1 -0
- package/lib/utils/ThemeProvider.mjs.map +1 -1
- package/lib/utils/addonText.d.ts +1 -1
- package/lib/utils/{addonText.cjs → addonText.js} +2 -2
- package/lib/utils/addonText.js.map +1 -0
- package/lib/utils/addonText.mjs.map +1 -1
- package/lib/utils/addonTextChildren.d.ts +1 -1
- package/lib/utils/{addonTextChildren.cjs → addonTextChildren.js} +4 -5
- package/lib/utils/addonTextChildren.js.map +1 -0
- package/lib/utils/addonTextChildren.mjs +1 -1
- package/lib/utils/addonTextChildren.mjs.map +1 -1
- package/lib/utils/ariaProps.d.ts +1 -1
- package/lib/utils/{ariaProps.cjs → ariaProps.js} +1 -1
- package/lib/utils/ariaProps.js.map +1 -0
- package/lib/utils/ariaProps.mjs.map +1 -1
- package/lib/utils/assignProps.d.ts +1 -1
- package/lib/utils/{assignProps.cjs → assignProps.js} +3 -3
- package/lib/utils/assignProps.js.map +1 -0
- package/lib/utils/assignProps.mjs +10 -0
- package/lib/utils/assignProps.mjs.map +1 -1
- package/lib/utils/{canUseDOM.cjs → canUseDOM.js} +1 -1
- package/lib/utils/canUseDOM.js.map +1 -0
- package/lib/utils/canUseDOM.mjs.map +1 -1
- package/lib/utils/{capitalizeFirstLetter.cjs → capitalizeFirstLetter.js} +1 -1
- package/lib/utils/capitalizeFirstLetter.js.map +1 -0
- package/lib/utils/capitalizeFirstLetter.mjs.map +1 -1
- package/lib/utils/{color.cjs → color.js} +19 -19
- package/lib/utils/color.js.map +1 -0
- package/lib/utils/color.mjs +16 -15
- package/lib/utils/color.mjs.map +1 -1
- package/lib/utils/{compose.cjs → compose.js} +1 -1
- package/lib/utils/compose.js.map +1 -0
- package/lib/utils/compose.mjs.map +1 -1
- package/lib/utils/createHoc.d.ts +1 -1
- package/lib/utils/{createHoc.cjs → createHoc.js} +12 -12
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +24 -23
- package/lib/utils/createHoc.mjs.map +1 -1
- package/lib/utils/{createUUID.cjs → createUUID.js} +1 -1
- package/lib/utils/createUUID.js.map +1 -0
- package/lib/utils/createUUID.mjs.map +1 -1
- package/lib/utils/cssToIntDefault.d.ts +1 -1
- package/lib/utils/{cssToIntDefault.cjs → cssToIntDefault.js} +3 -3
- package/lib/utils/cssToIntDefault.js.map +1 -0
- package/lib/utils/cssToIntDefault.mjs +2 -2
- package/lib/utils/cssToIntDefault.mjs.map +1 -1
- package/lib/utils/enhances/WithAutoFocus.d.ts +3 -3
- package/lib/utils/enhances/{WithAutoFocus.cjs → WithAutoFocus.js} +13 -13
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.mjs +11 -9
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -1
- package/lib/utils/enhances/WithCSS.d.ts +4 -4
- package/lib/utils/enhances/{WithCSS.cjs → WithCSS.js} +16 -21
- package/lib/utils/enhances/WithCSS.js.map +1 -0
- package/lib/utils/enhances/WithCSS.mjs +8 -8
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.d.ts +3 -3
- package/lib/utils/enhances/{WithI18n.cjs → WithI18n.js} +20 -23
- package/lib/utils/enhances/WithI18n.js.map +1 -0
- package/lib/utils/enhances/WithI18n.mjs +41 -15
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +4 -3
- package/lib/utils/enhances/{WithKeyboardFocus.cjs → WithKeyboardFocus.js} +29 -25
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs +26 -19
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -1
- package/lib/utils/enhances/WithRef.d.ts +1 -1
- package/lib/utils/enhances/{WithRef.cjs → WithRef.js} +4 -5
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/WithRef.mjs +1 -1
- package/lib/utils/enhances/WithRef.mjs.map +1 -1
- package/lib/utils/enhances/{a11yEnhance.cjs → a11yEnhance.js} +10 -11
- package/lib/utils/enhances/a11yEnhance.js.map +1 -0
- package/lib/utils/enhances/a11yEnhance.mjs +7 -7
- package/lib/utils/enhances/a11yEnhance.mjs.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +1 -1
- package/lib/utils/enhances/{animatedSizeEnhance.cjs → animatedSizeEnhance.js} +13 -11
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs +11 -7
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.d.ts +1 -1
- package/lib/utils/enhances/{autoFocusEnhance.cjs → autoFocusEnhance.js} +3 -4
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -1
- package/lib/utils/enhances/{contextEnhance.cjs → contextEnhance.js} +3 -4
- package/lib/utils/enhances/contextEnhance.js.map +1 -0
- package/lib/utils/enhances/contextEnhance.mjs.map +1 -1
- package/lib/utils/enhances/i18nEnhance.d.ts +2 -2
- package/lib/utils/enhances/{i18nEnhance.cjs → i18nEnhance.js} +11 -11
- package/lib/utils/enhances/i18nEnhance.js.map +1 -0
- package/lib/utils/enhances/i18nEnhance.mjs +36 -37
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +1 -1
- package/lib/utils/enhances/{keyboardFocusEnhance.cjs → keyboardFocusEnhance.js} +8 -8
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +2 -2
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -1
- package/lib/utils/enhances/{resolveColorEnhance.cjs → resolveColorEnhance.js} +5 -6
- package/lib/utils/enhances/resolveColorEnhance.js.map +1 -0
- package/lib/utils/enhances/resolveColorEnhance.mjs +2 -2
- package/lib/utils/enhances/resolveColorEnhance.mjs.map +1 -1
- package/lib/utils/{eventEmitter.cjs → eventEmitter.js} +3 -4
- package/lib/utils/eventEmitter.js.map +1 -0
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/findComponent.d.ts +2 -2
- package/lib/utils/{findComponent.cjs → findComponent.js} +15 -16
- package/lib/utils/findComponent.js.map +1 -0
- package/lib/utils/findComponent.mjs +12 -12
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/{fire.cjs → fire.js} +2 -2
- package/lib/utils/fire.js.map +1 -0
- package/lib/utils/fire.mjs.map +1 -1
- package/lib/utils/focus-lock/{focusBorders.cjs → focusBorders.js} +13 -17
- package/lib/utils/focus-lock/focusBorders.js.map +1 -0
- package/lib/utils/focus-lock/focusBorders.mjs +8 -8
- package/lib/utils/focus-lock/focusBorders.mjs.map +1 -1
- package/lib/utils/focus-lock/{getFocusableIn.cjs → getFocusableIn.js} +3 -4
- package/lib/utils/focus-lock/getFocusableIn.js.map +1 -0
- package/lib/utils/focus-lock/getFocusableIn.mjs +1 -1
- package/lib/utils/focus-lock/getFocusableIn.mjs.map +1 -1
- package/lib/utils/focus-lock/{isFocusInside.cjs → isFocusInside.js} +2 -3
- package/lib/utils/focus-lock/isFocusInside.js.map +1 -0
- package/lib/utils/focus-lock/isFocusInside.mjs.map +1 -1
- package/lib/utils/focus-lock/{isFocusable.cjs → isFocusable.js} +3 -4
- package/lib/utils/focus-lock/isFocusable.js.map +1 -0
- package/lib/utils/focus-lock/isFocusable.mjs.map +1 -1
- package/lib/utils/focus-lock/{setFocus.cjs → setFocus.js} +5 -6
- package/lib/utils/focus-lock/setFocus.js.map +1 -0
- package/lib/utils/focus-lock/setFocus.mjs +2 -2
- package/lib/utils/focus-lock/setFocus.mjs.map +1 -1
- package/lib/utils/{getAccessibleName.cjs → getAccessibleName.js} +2 -2
- package/lib/utils/getAccessibleName.js.map +1 -0
- package/lib/utils/getAccessibleName.mjs.map +1 -1
- package/lib/utils/getDisplayName.d.ts +1 -1
- package/lib/utils/{getDisplayName.cjs → getDisplayName.js} +1 -1
- package/lib/utils/getDisplayName.js.map +1 -0
- package/lib/utils/getDisplayName.mjs +5 -3
- package/lib/utils/getDisplayName.mjs.map +1 -1
- package/lib/utils/{getEventTarget.cjs → getEventTarget.js} +3 -4
- package/lib/utils/getEventTarget.js.map +1 -0
- package/lib/utils/getEventTarget.mjs.map +1 -1
- package/lib/utils/{getOriginChildren.cjs → getOriginChildren.js} +4 -5
- package/lib/utils/getOriginChildren.js.map +1 -0
- package/lib/utils/getOriginChildren.mjs +1 -1
- package/lib/utils/getOriginChildren.mjs.map +1 -1
- package/lib/utils/{getRandomInt.cjs → getRandomInt.js} +1 -1
- package/lib/utils/getRandomInt.js.map +1 -0
- package/lib/utils/getRandomInt.mjs.map +1 -1
- package/lib/utils/{getValue.cjs → getValue.js} +2 -4
- package/lib/utils/getValue.js.map +1 -0
- package/lib/utils/getValue.mjs +1 -3
- package/lib/utils/getValue.mjs.map +1 -1
- package/lib/utils/{hasLabels.cjs → hasLabels.js} +6 -7
- package/lib/utils/hasLabels.js.map +1 -0
- package/lib/utils/hasLabels.mjs +3 -3
- package/lib/utils/hasLabels.mjs.map +1 -1
- package/lib/utils/{hasParent.cjs → hasParent.js} +3 -4
- package/lib/utils/hasParent.js.map +1 -0
- package/lib/utils/hasParent.mjs +3 -2
- package/lib/utils/hasParent.mjs.map +1 -1
- package/lib/utils/if.d.ts +2 -2
- package/lib/utils/{if.cjs → if.js} +2 -3
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/if.mjs.map +1 -1
- package/lib/utils/ifChildren.d.ts +1 -1
- package/lib/utils/{ifChildren.cjs → ifChildren.js} +2 -3
- package/lib/utils/ifChildren.js.map +1 -0
- package/lib/utils/ifChildren.mjs.map +1 -1
- package/lib/utils/{injectStyle.cjs → injectStyle.js} +4 -6
- package/lib/utils/injectStyle.js.map +1 -0
- package/lib/utils/injectStyle.mjs +1 -2
- package/lib/utils/injectStyle.mjs.map +1 -1
- package/lib/utils/{inputProps.cjs → inputProps.js} +2 -3
- package/lib/utils/inputProps.js.map +1 -0
- package/lib/utils/inputProps.mjs.map +1 -1
- package/lib/utils/isInteractiveElement.d.ts +1 -0
- package/lib/utils/isInteractiveElement.js +34 -0
- package/lib/utils/isInteractiveElement.js.map +1 -0
- package/lib/utils/isInteractiveElement.mjs +28 -0
- package/lib/utils/isInteractiveElement.mjs.map +1 -0
- package/lib/utils/{isNode.cjs → isNode.js} +2 -2
- package/lib/utils/isNode.js.map +1 -0
- package/lib/utils/isNode.mjs.map +1 -1
- package/lib/utils/{isPromise.cjs → isPromise.js} +1 -1
- package/lib/utils/isPromise.js.map +1 -0
- package/lib/utils/isPromise.mjs.map +1 -1
- package/lib/utils/{isRetina.cjs → isRetina.js} +1 -1
- package/lib/utils/isRetina.js.map +1 -0
- package/lib/utils/isRetina.mjs.map +1 -1
- package/lib/utils/{logger.cjs → logger.js} +5 -8
- package/lib/utils/logger.js.map +1 -0
- package/lib/utils/logger.mjs +1 -2
- package/lib/utils/logger.mjs.map +1 -1
- package/lib/utils/{numericChecker.cjs → numericChecker.js} +1 -1
- package/lib/utils/numericChecker.js.map +1 -0
- package/lib/utils/numericChecker.mjs.map +1 -1
- package/lib/utils/{ownerDocument.cjs → ownerDocument.js} +1 -1
- package/lib/utils/ownerDocument.js.map +1 -0
- package/lib/utils/ownerDocument.mjs.map +1 -1
- package/lib/utils/{pick.cjs → pick.js} +1 -1
- package/lib/utils/pick.js.map +1 -0
- package/lib/utils/pick.mjs.map +1 -1
- package/lib/utils/propsForElement.d.ts +1 -1
- package/lib/utils/{propsForElement.cjs → propsForElement.js} +3 -4
- package/lib/utils/propsForElement.js.map +1 -0
- package/lib/utils/propsForElement.mjs.map +1 -1
- package/lib/utils/{rafTrottle.cjs → rafTrottle.js} +2 -3
- package/lib/utils/rafTrottle.js.map +1 -0
- package/lib/utils/rafTrottle.mjs.map +1 -1
- package/lib/utils/reactToText.d.ts +1 -1
- package/lib/utils/{reactToText.cjs → reactToText.js} +2 -3
- package/lib/utils/reactToText.js.map +1 -0
- package/lib/utils/reactToText.mjs.map +1 -1
- package/lib/utils/ref.d.ts +4 -2
- package/lib/utils/{ref.cjs → ref.js} +4 -3
- package/lib/utils/ref.js.map +1 -0
- package/lib/utils/ref.mjs +46 -2
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/{setRef.cjs → setRef.js} +2 -3
- package/lib/utils/setRef.js.map +1 -0
- package/lib/utils/setRef.mjs.map +1 -1
- package/lib/utils/{syncScroll.cjs → syncScroll.js} +3 -3
- package/lib/utils/syncScroll.js.map +1 -0
- package/lib/utils/syncScroll.mjs +1 -1
- package/lib/utils/syncScroll.mjs.map +1 -1
- package/lib/utils/uncontroll.d.ts +1 -1
- package/lib/utils/{uncontroll.cjs → uncontroll.js} +2 -2
- package/lib/utils/uncontroll.js.map +1 -0
- package/lib/utils/uncontroll.mjs.map +1 -1
- package/lib/utils/uniqueID.d.ts +1 -1
- package/lib/utils/{uniqueID.cjs → uniqueID.js} +6 -6
- package/lib/utils/uniqueID.js.map +1 -0
- package/lib/utils/uniqueID.mjs +3 -0
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/{useColorResolver.cjs → useColorResolver.js} +8 -107
- package/lib/utils/use/useColorResolver.js.map +1 -0
- package/lib/utils/use/useColorResolver.mjs +5 -103
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useCss.d.ts +1 -1
- package/lib/utils/use/{useCss.cjs → useCss.js} +3 -4
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/useCss.mjs.map +1 -1
- package/lib/utils/use/{useEnhancedEffect.cjs → useEnhancedEffect.js} +3 -4
- package/lib/utils/use/useEnhancedEffect.js.map +1 -0
- package/lib/utils/use/useEnhancedEffect.mjs.map +1 -1
- package/lib/utils/use/{useEventCallback.cjs → useEventCallback.js} +2 -2
- package/lib/utils/use/useEventCallback.js.map +1 -0
- package/lib/utils/use/useEventCallback.mjs.map +1 -1
- package/lib/utils/use/{useEventListener.cjs → useEventListener.js} +4 -5
- package/lib/utils/use/useEventListener.js.map +1 -0
- package/lib/utils/use/useEventListener.mjs +1 -1
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.d.ts +1 -1
- package/lib/utils/use/{useFocusLock.cjs → useFocusLock.js} +9 -12
- package/lib/utils/use/useFocusLock.js.map +1 -0
- package/lib/utils/use/useFocusLock.mjs +4 -4
- package/lib/utils/use/useFocusLock.mjs.map +1 -1
- package/lib/utils/use/{usePreventScroll.cjs → usePreventScroll.js} +3 -3
- package/lib/utils/use/usePreventScroll.js.map +1 -0
- package/lib/utils/use/usePreventScroll.mjs +1 -1
- package/lib/utils/use/usePreventScroll.mjs.map +1 -1
- package/lib/utils/useCssVariable.d.ts +2 -2
- package/lib/utils/{useCssVariable.cjs → useCssVariable.js} +4 -6
- package/lib/utils/useCssVariable.js.map +1 -0
- package/lib/utils/useCssVariable.mjs.map +1 -1
- package/lib/utils/{zIndexStacking.cjs → zIndexStacking.js} +7 -10
- package/lib/utils/zIndexStacking.js.map +1 -0
- package/lib/utils/zIndexStacking.mjs +2 -2
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +45 -23
- package/vite.config.ts +1 -1
- package/lib/LastInteractionType.cjs.map +0 -1
- package/lib/core-types/Component.cjs +0 -59
- package/lib/core-types/Component.cjs.map +0 -1
- package/lib/core-types/UnknownProperties.cjs +0 -2
- package/lib/core-types/UnknownProperties.cjs.map +0 -1
- package/lib/core-types/reshadow.d.cjs +0 -2
- package/lib/core-types/reshadow.d.cjs.map +0 -1
- package/lib/core-types/symbols.cjs +0 -25
- package/lib/core-types/symbols.cjs.map +0 -1
- package/lib/coreFactory.cjs.map +0 -1
- package/lib/enhancement/Children.cjs.map +0 -1
- package/lib/enhancement/Root.cjs.map +0 -1
- package/lib/enhancement/bindHandler.cjs.map +0 -1
- package/lib/enhancement/dataName.cjs.map +0 -1
- package/lib/enhancement/enhance.cjs.map +0 -1
- package/lib/enhancement/functionDefaultProps.cjs.map +0 -1
- package/lib/enhancement/hoistProps.cjs.map +0 -1
- package/lib/enhancement/i18n.cjs.map +0 -1
- package/lib/enhancement/inheritedName.cjs.map +0 -1
- package/lib/enhancement/staticChildren.cjs.map +0 -1
- package/lib/enhancement/style.cjs.map +0 -1
- package/lib/enhancement/uncontrolledProps.cjs.map +0 -1
- package/lib/index.cjs.map +0 -1
- package/lib/register.cjs.map +0 -1
- package/lib/styled/index.cjs.map +0 -1
- package/lib/styled/reshadow-core.cjs.map +0 -1
- package/lib/styled/sstyled.cjs.map +0 -1
- package/lib/theme/processor.cjs.map +0 -1
- package/lib/theme/themes/dark.cjs.map +0 -1
- package/lib/theme/themes/default.cjs.map +0 -1
- package/lib/theme/themes/light.cjs.map +0 -1
- package/lib/theme/utils.cjs.map +0 -1
- package/lib/utils/CSSinJS.cjs.map +0 -1
- package/lib/utils/ScreenReaderOnly.cjs.map +0 -1
- package/lib/utils/ThemeProvider.cjs.map +0 -1
- package/lib/utils/addonText.cjs.map +0 -1
- package/lib/utils/addonTextChildren.cjs.map +0 -1
- package/lib/utils/ariaProps.cjs.map +0 -1
- package/lib/utils/assignProps.cjs.map +0 -1
- package/lib/utils/canUseDOM.cjs.map +0 -1
- package/lib/utils/capitalizeFirstLetter.cjs.map +0 -1
- package/lib/utils/color.cjs.map +0 -1
- package/lib/utils/compose.cjs.map +0 -1
- package/lib/utils/createHoc.cjs.map +0 -1
- package/lib/utils/createUUID.cjs.map +0 -1
- package/lib/utils/cssToIntDefault.cjs.map +0 -1
- package/lib/utils/enhances/WithAutoFocus.cjs.map +0 -1
- package/lib/utils/enhances/WithCSS.cjs.map +0 -1
- package/lib/utils/enhances/WithI18n.cjs.map +0 -1
- package/lib/utils/enhances/WithKeyboardFocus.cjs.map +0 -1
- package/lib/utils/enhances/WithRef.cjs.map +0 -1
- package/lib/utils/enhances/a11yEnhance.cjs.map +0 -1
- package/lib/utils/enhances/animatedSizeEnhance.cjs.map +0 -1
- package/lib/utils/enhances/autoFocusEnhance.cjs.map +0 -1
- package/lib/utils/enhances/contextEnhance.cjs.map +0 -1
- package/lib/utils/enhances/i18nEnhance.cjs.map +0 -1
- package/lib/utils/enhances/keyboardFocusEnhance.cjs.map +0 -1
- package/lib/utils/enhances/resolveColorEnhance.cjs.map +0 -1
- package/lib/utils/eventEmitter.cjs.map +0 -1
- package/lib/utils/findComponent.cjs.map +0 -1
- package/lib/utils/fire.cjs.map +0 -1
- package/lib/utils/focus-lock/focusBorders.cjs.map +0 -1
- package/lib/utils/focus-lock/getFocusableIn.cjs.map +0 -1
- package/lib/utils/focus-lock/isFocusInside.cjs.map +0 -1
- package/lib/utils/focus-lock/isFocusable.cjs.map +0 -1
- package/lib/utils/focus-lock/setFocus.cjs.map +0 -1
- package/lib/utils/getAccessibleName.cjs.map +0 -1
- package/lib/utils/getDisplayName.cjs.map +0 -1
- package/lib/utils/getEventTarget.cjs.map +0 -1
- package/lib/utils/getOriginChildren.cjs.map +0 -1
- package/lib/utils/getRandomInt.cjs.map +0 -1
- package/lib/utils/getValue.cjs.map +0 -1
- package/lib/utils/hasLabels.cjs.map +0 -1
- package/lib/utils/hasParent.cjs.map +0 -1
- package/lib/utils/if.cjs.map +0 -1
- package/lib/utils/ifChildren.cjs.map +0 -1
- package/lib/utils/injectStyle.cjs.map +0 -1
- package/lib/utils/inputProps.cjs.map +0 -1
- package/lib/utils/isNode.cjs.map +0 -1
- package/lib/utils/isPromise.cjs.map +0 -1
- package/lib/utils/isRetina.cjs.map +0 -1
- package/lib/utils/logger.cjs.map +0 -1
- package/lib/utils/numericChecker.cjs.map +0 -1
- package/lib/utils/ownerDocument.cjs.map +0 -1
- package/lib/utils/pick.cjs.map +0 -1
- package/lib/utils/propsForElement.cjs.map +0 -1
- package/lib/utils/rafTrottle.cjs.map +0 -1
- package/lib/utils/reactToText.cjs.map +0 -1
- package/lib/utils/ref.cjs.map +0 -1
- package/lib/utils/setRef.cjs.map +0 -1
- package/lib/utils/syncScroll.cjs.map +0 -1
- package/lib/utils/uncontroll.cjs.map +0 -1
- package/lib/utils/uniqueID.cjs.map +0 -1
- package/lib/utils/use/useColorResolver.cjs.map +0 -1
- package/lib/utils/use/useCss.cjs.map +0 -1
- package/lib/utils/use/useEnhancedEffect.cjs.map +0 -1
- package/lib/utils/use/useEventCallback.cjs.map +0 -1
- package/lib/utils/use/useEventListener.cjs.map +0 -1
- package/lib/utils/use/useFocusLock.cjs.map +0 -1
- package/lib/utils/use/usePreventScroll.cjs.map +0 -1
- package/lib/utils/useCssVariable.cjs.map +0 -1
- package/lib/utils/zIndexStacking.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithI18n.mjs","names":["
|
|
1
|
+
{"version":3,"file":"WithI18n.mjs","names":["createIntl","createIntlCache","React","Component","createContext","createHoc","useAsyncI18nMessages","Context","undefined","I18nProvider","Provider","I18nConsumer","Consumer","messagesCache","getText","dictionaries","locale","key","dictionary","WithI18n","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","selfLocale","_this$props","props","contextLocale","context","_inherits","_createClass","value","render","_ref","children","useI18n","_React$useContext","fallbackDictionary","lang","useContext","resolvedDictionary","intl","useMemo","messages","useCallback","messageId","variables","formatMessage","id"],"sources":["../../../src/utils/enhances/WithI18n.tsx"],"sourcesContent":["import { createIntl, createIntlCache } from '@formatjs/intl';\nimport React, { Component, createContext } from 'react';\n\nimport createHoc from '../createHoc';\nimport { useAsyncI18nMessages } from './i18nEnhance';\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\n\nexport type LocaleKeys = string;\nexport type DictionaryItem = { [key: string]: string };\nexport type Dictionary = { [locale: string]: DictionaryItem | (() => Promise<DictionaryItem>) };\nexport const Context = createContext<LocaleKeys | undefined>(undefined);\nconst { Provider: I18nProvider, Consumer: I18nConsumer } = Context;\nconst messagesCache = createIntlCache();\n\nfunction getText(dictionaries: Dictionary, locale: LocaleKeys) {\n return function (key: keyof DictionaryItem) {\n const dictionary = dictionaries[locale];\n return dictionary ? (dictionary as any)[key] : (dictionaries as any)['en'][key];\n };\n}\n\n/** @deprecated */\nexport interface IWithI18nInjectedProps extends WithI18nInjectedProps, UnknownProperties {}\nexport type WithI18nInjectedProps = {\n getText: WithI18n['getText'];\n};\n\n/** @deprecated */\nexport interface IWithI18nProps extends WithI18nProps, UnknownProperties {}\nexport type WithI18nProps = WithI18nInjectedProps & {\n locale?: LocaleKeys;\n\n children?(props: IWithI18nInjectedProps): React.ReactNode;\n};\n\n/**\n * @deprecated use `useI18n` instead\n */\nclass WithI18n extends Component<IWithI18nProps> {\n /* @ts-ignore */\n context: LocaleKeys;\n\n static contextType = Context;\n static defaultProps = {\n getText,\n };\n\n getText = (dictionary: Dictionary, selfLocale?: string): string => {\n const { locale, getText } = this.props;\n const contextLocale = this.context;\n return getText(dictionary, selfLocale || locale || contextLocale);\n };\n\n render() {\n const { children } = this.props as any;\n return children({\n getText: this.getText,\n });\n }\n}\n\nconst useI18n = (\n dictionary: Dictionary,\n locale: LocaleKeys = 'en',\n fallbackDictionary?: Dictionary,\n) => {\n const lang = React.useContext(Context) ?? locale;\n const resolvedDictionary = useAsyncI18nMessages(dictionary, lang, fallbackDictionary);\n const intl = React.useMemo(\n () => createIntl({ locale: lang, messages: resolvedDictionary }, messagesCache),\n [resolvedDictionary, lang],\n );\n\n return React.useCallback(\n (messageId: string, variables?: { [key: string]: string | number | undefined }) => {\n return intl.formatMessage({ id: messageId ?? '' }, variables);\n },\n [intl],\n );\n};\n\nexport default createHoc(WithI18n);\nexport { useI18n, I18nProvider, I18nConsumer };\n"],"mappings":";;;;;;;;AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,gBAAgB;AAC5D,OAAOC,KAAK,IAAIC,SAAS,EAAEC,aAAa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AI,CAC3B,CAAC;EAED,OAAO5C,KAAK,CAACkD,WAAW,CACtB,UAACC,SAAiB,EAAEC,SAA0D,EAAK;IACjF,OAAOL,IAAI,CAACM,aAAa,CAAC;MAAEC,EAAE,EAAEH,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI;IAAG,CAAC,EAAEC,SAAS,CAAC;EAC/D,CAAC,EACD,CAACL,IAAI,CACP,CAAC;AACH,CAAC;AAED,eAAe5C,SAAS,CAACc,QAAQ,CAAC;AAClC,SAASwB,OAAO,EAAElC,YAAY,EAAEE,YAAY","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import type { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
3
4
|
/** @deprecated */
|
|
4
5
|
export interface IEnhancedWithKeyboardFocusInjectedProps extends EnhancedWithKeyboardFocusInjectedProps {
|
|
5
6
|
}
|
|
@@ -41,5 +42,5 @@ export declare class EnhancedWithKeyboardFocus extends PureComponent<IEnhancedWi
|
|
|
41
42
|
handlerMouseDown: (e: MouseEvent) => void;
|
|
42
43
|
render(): React.ReactNode;
|
|
43
44
|
}
|
|
44
|
-
declare const _default: (options?: {}
|
|
45
|
+
declare const _default: (options?: {}) => (WrappedComponent: React.ComponentType) => React.ComponentClass;
|
|
45
46
|
export default _default;
|
|
@@ -1,59 +1,66 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = exports.EnhancedWithKeyboardFocus = void 0;
|
|
8
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var
|
|
10
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
11
|
+
var _isNativeReflectConstruct2 = _interopRequireDefault(require("@babel/runtime/helpers/isNativeReflectConstruct"));
|
|
12
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
11
13
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
13
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
15
|
var _react = require("react");
|
|
15
16
|
var _createHoc = _interopRequireDefault(require("../createHoc"));
|
|
16
|
-
var _uncontroll = require("../uncontroll");
|
|
17
17
|
var _fire = _interopRequireDefault(require("../fire"));
|
|
18
|
+
var _uncontroll = require("../uncontroll");
|
|
19
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, (0, _isNativeReflectConstruct2["default"])() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
20
|
+
/** @deprecated */
|
|
21
|
+
|
|
22
|
+
/** @deprecated */
|
|
23
|
+
|
|
24
|
+
/** @deprecated */
|
|
25
|
+
|
|
18
26
|
var usingKeyBoard = true;
|
|
19
|
-
var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
20
|
-
(0, _inherits2["default"])(EnhancedWithKeyboardFocus, _PureComponent);
|
|
21
|
-
var _super = (0, _createSuper2["default"])(EnhancedWithKeyboardFocus);
|
|
27
|
+
var EnhancedWithKeyboardFocus = exports.EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
22
28
|
function EnhancedWithKeyboardFocus() {
|
|
23
29
|
var _this;
|
|
24
30
|
(0, _classCallCheck2["default"])(this, EnhancedWithKeyboardFocus);
|
|
25
31
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
32
|
args[_key] = arguments[_key];
|
|
27
33
|
}
|
|
28
|
-
_this =
|
|
29
|
-
(0, _defineProperty2["default"])(
|
|
34
|
+
_this = _callSuper(this, EnhancedWithKeyboardFocus, [].concat(args));
|
|
35
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
30
36
|
keyboardFocused: false
|
|
31
37
|
});
|
|
32
|
-
(0, _defineProperty2["default"])(
|
|
33
|
-
(0, _fire["default"])(
|
|
38
|
+
(0, _defineProperty2["default"])(_this, "handlerFocus", function (e) {
|
|
39
|
+
(0, _fire["default"])(_this, 'onFocus', e);
|
|
34
40
|
if (usingKeyBoard) {
|
|
35
|
-
(0, _uncontroll.internalSetState)(
|
|
41
|
+
(0, _uncontroll.internalSetState)(_this, {
|
|
36
42
|
keyboardFocused: true
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
45
|
});
|
|
40
|
-
(0, _defineProperty2["default"])(
|
|
41
|
-
(0, _fire["default"])(
|
|
42
|
-
(0, _uncontroll.internalSetState)(
|
|
46
|
+
(0, _defineProperty2["default"])(_this, "handlerBlur", function (e) {
|
|
47
|
+
(0, _fire["default"])(_this, 'onBlur', e);
|
|
48
|
+
(0, _uncontroll.internalSetState)(_this, {
|
|
43
49
|
keyboardFocused: false
|
|
44
50
|
});
|
|
45
51
|
});
|
|
46
|
-
(0, _defineProperty2["default"])(
|
|
47
|
-
(0, _fire["default"])(
|
|
52
|
+
(0, _defineProperty2["default"])(_this, "handlerKeyDown", function (e) {
|
|
53
|
+
(0, _fire["default"])(_this, 'onKeyDown', e);
|
|
48
54
|
usingKeyBoard = true;
|
|
49
55
|
});
|
|
50
|
-
(0, _defineProperty2["default"])(
|
|
51
|
-
(0, _fire["default"])(
|
|
56
|
+
(0, _defineProperty2["default"])(_this, "handlerMouseDown", function (e) {
|
|
57
|
+
(0, _fire["default"])(_this, 'onMouseDown', e);
|
|
52
58
|
usingKeyBoard = false;
|
|
53
59
|
});
|
|
54
60
|
return _this;
|
|
55
61
|
}
|
|
56
|
-
(0,
|
|
62
|
+
(0, _inherits2["default"])(EnhancedWithKeyboardFocus, _PureComponent);
|
|
63
|
+
return (0, _createClass2["default"])(EnhancedWithKeyboardFocus, [{
|
|
57
64
|
key: "render",
|
|
58
65
|
value: function render() {
|
|
59
66
|
var _this$props = this.props,
|
|
@@ -81,13 +88,10 @@ var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
|
81
88
|
return state;
|
|
82
89
|
}
|
|
83
90
|
}]);
|
|
84
|
-
return EnhancedWithKeyboardFocus;
|
|
85
91
|
}(_react.PureComponent);
|
|
86
|
-
exports.EnhancedWithKeyboardFocus = EnhancedWithKeyboardFocus;
|
|
87
92
|
(0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
|
|
88
93
|
(0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "defaultProps", {
|
|
89
94
|
tabIndex: 0
|
|
90
95
|
});
|
|
91
|
-
var _default = (0, _createHoc["default"])(EnhancedWithKeyboardFocus);
|
|
92
|
-
|
|
93
|
-
//# sourceMappingURL=WithKeyboardFocus.cjs.map
|
|
96
|
+
var _default = exports["default"] = (0, _createHoc["default"])(EnhancedWithKeyboardFocus);
|
|
97
|
+
//# sourceMappingURL=WithKeyboardFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithKeyboardFocus.js","names":["_react","require","_createHoc","_interopRequireDefault","_fire","_uncontroll","_callSuper","t","o","e","_getPrototypeOf2","_possibleConstructorReturn2","_isNativeReflectConstruct2","Reflect","construct","constructor","apply","usingKeyBoard","EnhancedWithKeyboardFocus","exports","_PureComponent","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","concat","_defineProperty2","keyboardFocused","fire","internalSetState","_inherits2","_createClass2","key","value","render","_this$props","props","children","tabIndex","disabled","state","onFocus","handlerFocus","onBlur","handlerBlur","onKeyDown","handlerKeyDown","onMouseDown","handlerMouseDown","getDerivedStateFromProps","undefined","PureComponent","_default","createHoc"],"sources":["../../../src/utils/enhances/WithKeyboardFocus.tsx"],"sourcesContent":["import type React from 'react';\nimport { PureComponent } from 'react';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport createHoc from '../createHoc';\nimport fire from '../fire';\nimport { internalSetState } from '../uncontroll';\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusInjectedProps\n extends EnhancedWithKeyboardFocusInjectedProps {}\nexport type EnhancedWithKeyboardFocusInjectedProps = {\n tabIndex: number;\n keyboardFocused: boolean;\n\n onFocus(e: FocusEvent): void;\n\n onBlur(e: FocusEvent): void;\n\n onKeyDown(e: KeyboardEvent): void;\n\n onMouseDown(e: MouseEvent): void;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusProps\n extends EnhancedWithKeyboardFocusProps,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusProps = {\n keyboardFocused?: boolean;\n tabIndex?: number;\n disabled?: boolean;\n\n children(props: IEnhancedWithKeyboardFocusInjectedProps): React.ReactNode;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusState\n extends EnhancedWithKeyboardFocusState,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusState = {\n keyboardFocused: boolean;\n};\n\nlet usingKeyBoard = true;\n\nexport class EnhancedWithKeyboardFocus extends PureComponent<\n IEnhancedWithKeyboardFocusProps,\n IEnhancedWithKeyboardFocusState\n> {\n static displayName = 'EnhancedWithKeyboardFocus';\n\n static defaultProps = {\n tabIndex: 0,\n };\n\n static getDerivedStateFromProps(props: any, state: any) {\n if (props.keyboardFocused !== undefined) {\n return {\n keyboardFocused: props.keyboardFocused,\n };\n }\n return state;\n }\n\n state = {\n keyboardFocused: false,\n };\n\n handlerFocus = (e: FocusEvent) => {\n fire(this, 'onFocus', e);\n if (usingKeyBoard) {\n internalSetState(this, { keyboardFocused: true });\n }\n };\n\n handlerBlur = (e: FocusEvent) => {\n fire(this, 'onBlur', e);\n internalSetState(this, { keyboardFocused: false });\n };\n\n handlerKeyDown = (e: KeyboardEvent) => {\n fire(this, 'onKeyDown', e);\n usingKeyBoard = true;\n };\n\n handlerMouseDown = (e: MouseEvent) => {\n fire(this, 'onMouseDown', e);\n usingKeyBoard = false;\n };\n\n render() {\n const { children, tabIndex, disabled } = this.props;\n const { keyboardFocused } = this.state;\n return children({\n tabIndex: disabled ? -1 : tabIndex!,\n keyboardFocused,\n onFocus: this.handlerFocus,\n onBlur: this.handlerBlur,\n onKeyDown: this.handlerKeyDown,\n onMouseDown: this.handlerMouseDown,\n });\n }\n}\n\nexport default createHoc(EnhancedWithKeyboardFocus);\n"],"mappings":";;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAiD,SAAAK,WAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,WAAAD,CAAA,OAAAE,gBAAA,aAAAF,CAAA,OAAAG,2BAAA,aAAAJ,CAAA,MAAAK,0BAAA,iBAAAC,OAAA,CAAAC,SAAA,CAAAN,CAAA,EAAAC,CAAA,YAAAC,gBAAA,aAAAH,CAAA,EAAAQ,WAAA,IAAAP,CAAA,CAAAQ,KAAA,CAAAT,CAAA,EAAAE,CAAA;AAEjD;;AAgBA;;AAYA;;AAQA,IAAIQ,aAAa,GAAG,IAAI;AAAC,IAEZC,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,0BAAAE,cAAA;EAAA,SAAAF,0BAAA;IAAA,IAAAG,KAAA;IAAA,IAAAC,gBAAA,mBAAAJ,yBAAA;IAAA,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aAAA,aAAAjB,yBAAA;IAAAkB,GAAA;IAAAC,KAAA,EAED,SAAAC,MAAMA,CAAA,EAAG;MACP,IAAAC,WAAA,GAAyC,IAAI,CAACC,KAAK;QAA3CC,QAAQ,GAAAF,WAAA,CAARE,QAAQ;QAAEC,QAAQ,GAAAH,WAAA,CAARG,QAAQ;QAAEC,QAAQ,GAAAJ,WAAA,CAARI,QAAQ;MACpC,IAAQZ,eAAe,GAAK,IAAI,CAACa,KAAK,CAA9Bb,eAAe;MACvB,OAAOU,QAAQ,CAAC;QACdC,QAAQ,EAAEC,QAAQ,GAAG,CAAC,CAAC,GAAGD,QAAS;QACnCX,eAAe,EAAfA,eAAe;QACfc,OAAO,EAAE,IAAI,CAACC,YAAY;QAC1BC,MAAM,EAAE,IAAI,CAACC,WAAW;QACxBC,SAAS,EAAE,IAAI,CAACC,cAAc;QAC9BC,WAAW,EAAE,IAAI,CAACC;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EA9CD,SAAOgB,wBAAwBA,CAACb,KAAU,EAAEI,KAAU,EAAE;MACtD,IAAIJ,KAAK,CAACT,eAAe,KAAKuB,SAAS,EAAE;QACvC,OAAO;UACLvB,eAAe,EAAES,KAAK,CAACT;QACzB,CAAC;MACH;MACA,OAAOa,KAAK;IACd;EAAC;AAAA,EAjB4CW,oBAAa;AAAA,IAAAzB,gBAAA,aAA/CZ,yBAAyB,iBAIf,2BAA2B;AAAA,IAAAY,gBAAA,aAJrCZ,yBAAyB,kBAMd;EACpBwB,QAAQ,EAAE;AACZ,CAAC;AAAA,IAAAc,QAAA,GAAArC,OAAA,cAmDY,IAAAsC,qBAAS,EAACvC,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -1,52 +1,60 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
-
import
|
|
3
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
4
|
+
import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
4
6
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
7
9
|
import { PureComponent } from 'react';
|
|
8
10
|
import createHoc from "../createHoc.mjs";
|
|
9
|
-
import { internalSetState } from "../uncontroll.mjs";
|
|
10
11
|
import fire from "../fire.mjs";
|
|
12
|
+
import { internalSetState } from "../uncontroll.mjs";
|
|
13
|
+
|
|
14
|
+
/** @deprecated */
|
|
15
|
+
|
|
16
|
+
/** @deprecated */
|
|
17
|
+
|
|
18
|
+
/** @deprecated */
|
|
19
|
+
|
|
11
20
|
var usingKeyBoard = true;
|
|
12
21
|
export var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
13
|
-
_inherits(EnhancedWithKeyboardFocus, _PureComponent);
|
|
14
|
-
var _super = _createSuper(EnhancedWithKeyboardFocus);
|
|
15
22
|
function EnhancedWithKeyboardFocus() {
|
|
16
23
|
var _this;
|
|
17
24
|
_classCallCheck(this, EnhancedWithKeyboardFocus);
|
|
18
25
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
26
|
args[_key] = arguments[_key];
|
|
20
27
|
}
|
|
21
|
-
_this =
|
|
22
|
-
_defineProperty(
|
|
28
|
+
_this = _callSuper(this, EnhancedWithKeyboardFocus, [].concat(args));
|
|
29
|
+
_defineProperty(_this, "state", {
|
|
23
30
|
keyboardFocused: false
|
|
24
31
|
});
|
|
25
|
-
_defineProperty(
|
|
26
|
-
fire(
|
|
32
|
+
_defineProperty(_this, "handlerFocus", function (e) {
|
|
33
|
+
fire(_this, 'onFocus', e);
|
|
27
34
|
if (usingKeyBoard) {
|
|
28
|
-
internalSetState(
|
|
35
|
+
internalSetState(_this, {
|
|
29
36
|
keyboardFocused: true
|
|
30
37
|
});
|
|
31
38
|
}
|
|
32
39
|
});
|
|
33
|
-
_defineProperty(
|
|
34
|
-
fire(
|
|
35
|
-
internalSetState(
|
|
40
|
+
_defineProperty(_this, "handlerBlur", function (e) {
|
|
41
|
+
fire(_this, 'onBlur', e);
|
|
42
|
+
internalSetState(_this, {
|
|
36
43
|
keyboardFocused: false
|
|
37
44
|
});
|
|
38
45
|
});
|
|
39
|
-
_defineProperty(
|
|
40
|
-
fire(
|
|
46
|
+
_defineProperty(_this, "handlerKeyDown", function (e) {
|
|
47
|
+
fire(_this, 'onKeyDown', e);
|
|
41
48
|
usingKeyBoard = true;
|
|
42
49
|
});
|
|
43
|
-
_defineProperty(
|
|
44
|
-
fire(
|
|
50
|
+
_defineProperty(_this, "handlerMouseDown", function (e) {
|
|
51
|
+
fire(_this, 'onMouseDown', e);
|
|
45
52
|
usingKeyBoard = false;
|
|
46
53
|
});
|
|
47
54
|
return _this;
|
|
48
55
|
}
|
|
49
|
-
|
|
56
|
+
_inherits(EnhancedWithKeyboardFocus, _PureComponent);
|
|
57
|
+
return _createClass(EnhancedWithKeyboardFocus, [{
|
|
50
58
|
key: "render",
|
|
51
59
|
value: function render() {
|
|
52
60
|
var _this$props = this.props,
|
|
@@ -74,7 +82,6 @@ export var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
|
74
82
|
return state;
|
|
75
83
|
}
|
|
76
84
|
}]);
|
|
77
|
-
return EnhancedWithKeyboardFocus;
|
|
78
85
|
}(PureComponent);
|
|
79
86
|
_defineProperty(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
|
|
80
87
|
_defineProperty(EnhancedWithKeyboardFocus, "defaultProps", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithKeyboardFocus.mjs","names":["PureComponent","createHoc","
|
|
1
|
+
{"version":3,"file":"WithKeyboardFocus.mjs","names":["PureComponent","createHoc","fire","internalSetState","usingKeyBoard","EnhancedWithKeyboardFocus","_PureComponent","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","keyboardFocused","e","_inherits","_createClass","key","value","render","_this$props","props","children","tabIndex","disabled","state","onFocus","handlerFocus","onBlur","handlerBlur","onKeyDown","handlerKeyDown","onMouseDown","handlerMouseDown","getDerivedStateFromProps","undefined"],"sources":["../../../src/utils/enhances/WithKeyboardFocus.tsx"],"sourcesContent":["import type React from 'react';\nimport { PureComponent } from 'react';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport createHoc from '../createHoc';\nimport fire from '../fire';\nimport { internalSetState } from '../uncontroll';\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusInjectedProps\n extends EnhancedWithKeyboardFocusInjectedProps {}\nexport type EnhancedWithKeyboardFocusInjectedProps = {\n tabIndex: number;\n keyboardFocused: boolean;\n\n onFocus(e: FocusEvent): void;\n\n onBlur(e: FocusEvent): void;\n\n onKeyDown(e: KeyboardEvent): void;\n\n onMouseDown(e: MouseEvent): void;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusProps\n extends EnhancedWithKeyboardFocusProps,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusProps = {\n keyboardFocused?: boolean;\n tabIndex?: number;\n disabled?: boolean;\n\n children(props: IEnhancedWithKeyboardFocusInjectedProps): React.ReactNode;\n};\n\n/** @deprecated */\nexport interface IEnhancedWithKeyboardFocusState\n extends EnhancedWithKeyboardFocusState,\n UnknownProperties {}\nexport type EnhancedWithKeyboardFocusState = {\n keyboardFocused: boolean;\n};\n\nlet usingKeyBoard = true;\n\nexport class EnhancedWithKeyboardFocus extends PureComponent<\n IEnhancedWithKeyboardFocusProps,\n IEnhancedWithKeyboardFocusState\n> {\n static displayName = 'EnhancedWithKeyboardFocus';\n\n static defaultProps = {\n tabIndex: 0,\n };\n\n static getDerivedStateFromProps(props: any, state: any) {\n if (props.keyboardFocused !== undefined) {\n return {\n keyboardFocused: props.keyboardFocused,\n };\n }\n return state;\n }\n\n state = {\n keyboardFocused: false,\n };\n\n handlerFocus = (e: FocusEvent) => {\n fire(this, 'onFocus', e);\n if (usingKeyBoard) {\n internalSetState(this, { keyboardFocused: true });\n }\n };\n\n handlerBlur = (e: FocusEvent) => {\n fire(this, 'onBlur', e);\n internalSetState(this, { keyboardFocused: false });\n };\n\n handlerKeyDown = (e: KeyboardEvent) => {\n fire(this, 'onKeyDown', e);\n usingKeyBoard = true;\n };\n\n handlerMouseDown = (e: MouseEvent) => {\n fire(this, 'onMouseDown', e);\n usingKeyBoard = false;\n };\n\n render() {\n const { children, tabIndex, disabled } = this.props;\n const { keyboardFocused } = this.state;\n return children({\n tabIndex: disabled ? -1 : tabIndex!,\n keyboardFocused,\n onFocus: this.handlerFocus,\n onBlur: this.handlerBlur,\n onKeyDown: this.handlerKeyDown,\n onMouseDown: this.handlerMouseDown,\n });\n }\n}\n\nexport default createHoc(EnhancedWithKeyboardFocus);\n"],"mappings":";;;;;;;;AACA,SAASA,aAAa,QAAQ,OAAO;AAGrC,OAAOC,SAAS,MAAM,kBAAc;AACpC,OAAOC,IAAI,MAAM,aAAS;AAC1B,SAASC,gBAAgB,QAAQ,mBAAe;;AAEhD;;AAgBA;;AAYA;;AAQA,IAAIC,aAAa,GAAG,IAAI;AAExB,WAAaC,yBAAyB,0BAAAC,cAAA;EAAA,SAAAD,0BAAA;IAAA,IAAAE,KAAA;IAAAC,eAAA,OAAAH,yBAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAA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WAAA,CAARG,QAAQ;QAAEC,QAAQ,GAAAJ,WAAA,CAARI,QAAQ;MACpC,IAAQX,eAAe,GAAK,IAAI,CAACY,KAAK,CAA9BZ,eAAe;MACvB,OAAOS,QAAQ,CAAC;QACdC,QAAQ,EAAEC,QAAQ,GAAG,CAAC,CAAC,GAAGD,QAAS;QACnCV,eAAe,EAAfA,eAAe;QACfa,OAAO,EAAE,IAAI,CAACC,YAAY;QAC1BC,MAAM,EAAE,IAAI,CAACC,WAAW;QACxBC,SAAS,EAAE,IAAI,CAACC,cAAc;QAC9BC,WAAW,EAAE,IAAI,CAACC;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EA9CD,SAAOgB,wBAAwBA,CAACb,KAAU,EAAEI,KAAU,EAAE;MACtD,IAAIJ,KAAK,CAACR,eAAe,KAAKsB,SAAS,EAAE;QACvC,OAAO;UACLtB,eAAe,EAAEQ,KAAK,CAACR;QACzB,CAAC;MACH;MACA,OAAOY,KAAK;IACd;EAAC;AAAA,EAjB4C9B,aAAa;AAyD3DiB,eAAA,CAzDYZ,yBAAyB,iBAIf,2BAA2B;AAAAY,eAAA,CAJrCZ,yBAAyB,kBAMd;EACpBuB,QAAQ,EAAE;AACZ,CAAC;AAmDH,eAAe3B,SAAS,CAACI,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports["default"] = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
10
11
|
var _getDisplayName = _interopRequireDefault(require("../getDisplayName"));
|
|
11
|
-
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
12
12
|
function WithForwardRef() {
|
|
13
13
|
return function ForwardRef(Component) {
|
|
14
14
|
var Wrapped = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
@@ -21,6 +21,5 @@ function WithForwardRef() {
|
|
|
21
21
|
return (0, _hoistNonReactStatics["default"])(Wrapped, Component);
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
var _default = WithForwardRef;
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=WithRef.cjs.map
|
|
24
|
+
var _default = exports["default"] = WithForwardRef;
|
|
25
|
+
//# sourceMappingURL=WithRef.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithRef.js","names":["_hoistNonReactStatics","_interopRequireDefault","require","_react","_getDisplayName","WithForwardRef","ForwardRef","Component","Wrapped","React","forwardRef","props","ref","createElement","_extends2","defaultProps","forwardedRef","displayName","getDisplayName","hoistNonReactStatics","_default","exports"],"sources":["../../../src/utils/enhances/WithRef.tsx"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\n\nimport getDisplayName from '../getDisplayName';\n\nfunction WithForwardRef() {\n return function ForwardRef<T extends React.ComponentType>(Component: T) {\n const Wrapped = React.forwardRef((props, ref) => {\n // @ts-ignore\n return <Component {...(Component.defaultProps || {})} {...props} forwardedRef={ref} />;\n });\n Wrapped.displayName = getDisplayName(Component);\n return hoistNonReactStatics(Wrapped, Component) as any;\n };\n}\n\nexport default WithForwardRef;\n"],"mappings":";;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,SAASG,cAAcA,CAAA,EAAG;EACxB,OAAO,SAASC,UAAUA,CAAgCC,SAAY,EAAE;IACtE,IAAMC,OAAO,gBAAGC,iBAAK,CAACC,UAAU,CAAC,UAACC,KAAK,EAAEC,GAAG,EAAK;MAC/C;MACA,oBAAOT,MAAA,YAAAU,aAAA,CAACN,SAAS,MAAAO,SAAA,iBAAMP,SAAS,CAACQ,YAAY,IAAI,CAAC,CAAC,EAAOJ,KAAK;QAAEK,YAAY,EAAEJ;MAAI,EAAE,CAAC;IACxF,CAAC,CAAC;IACFJ,OAAO,CAACS,WAAW,GAAG,IAAAC,0BAAc,EAACX,SAAS,CAAC;IAC/C,OAAO,IAAAY,gCAAoB,EAACX,OAAO,EAAED,SAAS,CAAC;EACjD,CAAC;AACH;AAAC,IAAAa,QAAA,GAAAC,OAAA,cAEchB,cAAc","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import getDisplayName from "../getDisplayName.mjs";
|
|
4
|
-
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
5
|
function WithForwardRef() {
|
|
6
6
|
return function ForwardRef(Component) {
|
|
7
7
|
var Wrapped = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithRef.mjs","names":["
|
|
1
|
+
{"version":3,"file":"WithRef.mjs","names":["hoistNonReactStatics","React","getDisplayName","WithForwardRef","ForwardRef","Component","Wrapped","forwardRef","props","ref","createElement","_extends","defaultProps","forwardedRef","displayName"],"sources":["../../../src/utils/enhances/WithRef.tsx"],"sourcesContent":["import hoistNonReactStatics from 'hoist-non-react-statics';\nimport React from 'react';\n\nimport getDisplayName from '../getDisplayName';\n\nfunction WithForwardRef() {\n return function ForwardRef<T extends React.ComponentType>(Component: T) {\n const Wrapped = React.forwardRef((props, ref) => {\n // @ts-ignore\n return <Component {...(Component.defaultProps || {})} {...props} forwardedRef={ref} />;\n });\n Wrapped.displayName = getDisplayName(Component);\n return hoistNonReactStatics(Wrapped, Component) as any;\n };\n}\n\nexport default WithForwardRef;\n"],"mappings":";AAAA,OAAOA,oBAAoB,MAAM,yBAAyB;AAC1D,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,cAAc,MAAM,uBAAmB;AAE9C,SAASC,cAAcA,CAAA,EAAG;EACxB,OAAO,SAASC,UAAUA,CAAgCC,SAAY,EAAE;IACtE,IAAMC,OAAO,gBAAGL,KAAK,CAACM,UAAU,CAAC,UAACC,KAAK,EAAEC,GAAG,EAAK;MAC/C;MACA,oBAAOR,KAAA,CAAAS,aAAA,CAACL,SAAS,EAAAM,QAAA,KAAMN,SAAS,CAACO,YAAY,IAAI,CAAC,CAAC,EAAOJ,KAAK;QAAEK,YAAY,EAAEJ;MAAI,EAAE,CAAC;IACxF,CAAC,CAAC;IACFH,OAAO,CAACQ,WAAW,GAAGZ,cAAc,CAACG,SAAS,CAAC;IAC/C,OAAOL,oBAAoB,CAACM,OAAO,EAAED,SAAS,CAAC;EACjD,CAAC;AACH;AAEA,eAAeF,cAAc","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -9,7 +9,7 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _assignProps = require("../assignProps");
|
|
11
11
|
var defaultOnNeighborChange = function defaultOnNeighborChange(neighborElement) {
|
|
12
|
-
neighborElement === null || neighborElement === void 0
|
|
12
|
+
neighborElement === null || neighborElement === void 0 || neighborElement.focus();
|
|
13
13
|
};
|
|
14
14
|
var defaultFindNeighbor = function defaultFindNeighbor(listSelectors, element, direction) {
|
|
15
15
|
var elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;
|
|
@@ -29,10 +29,10 @@ var a11yEnhance = function a11yEnhance(options) {
|
|
|
29
29
|
var childSelector = options.childSelector;
|
|
30
30
|
return function (props) {
|
|
31
31
|
if (!childSelector) throw "parameter childSelector not passed in options for a11yEnhance for ".concat(props['data-ui-name']);
|
|
32
|
-
var
|
|
32
|
+
var _getNeighbor = function getNeighbor(listSelectors, element, direction) {
|
|
33
33
|
var neighbor = findNeighbor(listSelectors, element, direction);
|
|
34
34
|
if (!neighbor) return element;
|
|
35
|
-
if ('disabled' in neighbor && neighbor.disabled) return
|
|
35
|
+
if ('disabled' in neighbor && neighbor.disabled) return _getNeighbor(listSelectors, neighbor, direction);
|
|
36
36
|
return neighbor;
|
|
37
37
|
};
|
|
38
38
|
var handleKeyDown = function handleKeyDown(event) {
|
|
@@ -47,19 +47,19 @@ var a11yEnhance = function a11yEnhance(options) {
|
|
|
47
47
|
if (!listSelectors.length) throw "no children found querySelectorAll([".concat(childAttrName, "=\"").concat(childAttrValue, "\"] a11yEnhance for ").concat(props['data-ui-name']);
|
|
48
48
|
switch (event.key) {
|
|
49
49
|
case 'ArrowLeft':
|
|
50
|
-
onNeighborChange(
|
|
50
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'left'), props);
|
|
51
51
|
event.preventDefault();
|
|
52
52
|
break;
|
|
53
53
|
case 'ArrowTop':
|
|
54
|
-
onNeighborChange(
|
|
54
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'top'), props);
|
|
55
55
|
event.preventDefault();
|
|
56
56
|
break;
|
|
57
57
|
case 'ArrowRight':
|
|
58
|
-
onNeighborChange(
|
|
58
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'right'), props);
|
|
59
59
|
event.preventDefault();
|
|
60
60
|
break;
|
|
61
61
|
case 'ArrowBottom':
|
|
62
|
-
onNeighborChange(
|
|
62
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'bottom'), props);
|
|
63
63
|
event.preventDefault();
|
|
64
64
|
break;
|
|
65
65
|
}
|
|
@@ -69,6 +69,5 @@ var a11yEnhance = function a11yEnhance(options) {
|
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
|
-
var _default = a11yEnhance;
|
|
73
|
-
|
|
74
|
-
//# sourceMappingURL=a11yEnhance.cjs.map
|
|
72
|
+
var _default = exports["default"] = a11yEnhance;
|
|
73
|
+
//# sourceMappingURL=a11yEnhance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a11yEnhance.js","names":["_assignProps","require","defaultOnNeighborChange","neighborElement","focus","defaultFindNeighbor","listSelectors","element","direction","elementSibling","includes","indexElement","findIndex","node","lengthList","length","lastIndex","indexNext","a11yEnhance","options","findNeighbor","onNeighborChange","childSelector","props","concat","getNeighbor","neighbor","disabled","handleKeyDown","event","parent","currentTarget","selectedElement","target","_ref","_ref2","_slicedToArray2","childAttrName","childAttrValue","getAttribute","Array","from","querySelectorAll","key","preventDefault","_objectSpread2","onKeyDown","callAllEventHandlers","_default","exports"],"sources":["../../../src/utils/enhances/a11yEnhance.tsx"],"sourcesContent":["import type React from 'react';\n\nimport { callAllEventHandlers } from '../assignProps';\n\ntype OnNeighborChange<P> = (neighborElement: HTMLElement, props: P) => void;\ntype FindNeighbor = (\n listSelectors: HTMLElement[],\n element: HTMLElement,\n direction: string,\n) => HTMLElement | undefined;\ntype ChildSelector<P> = [string, string] | ((props: P) => [string, string]);\n\ntype A11yEnhanceOptions<P = any> = {\n findNeighbor?: FindNeighbor;\n onNeighborChange?: OnNeighborChange<P>;\n childSelector: ChildSelector<P>;\n};\n\nconst defaultOnNeighborChange: OnNeighborChange<any> = (neighborElement) => {\n neighborElement?.focus();\n};\n\nconst defaultFindNeighbor: FindNeighbor = (listSelectors, element, direction) => {\n const elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;\n const indexElement = listSelectors.findIndex((node) => node === element);\n const lengthList = listSelectors.length;\n\n const lastIndex = lengthList - 1;\n let indexNext = indexElement + elementSibling;\n if (indexNext < 0) indexNext = lastIndex;\n if (indexNext > lastIndex) indexNext = 0;\n return listSelectors[indexNext];\n};\n\nconst a11yEnhance = (options: A11yEnhanceOptions) => {\n const findNeighbor = options.findNeighbor || defaultFindNeighbor;\n const onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;\n const { childSelector } = options;\n\n return (props: any) => {\n if (!childSelector)\n throw `parameter childSelector not passed in options for a11yEnhance for ${props['data-ui-name']}`;\n const getNeighbor = (\n listSelectors: any,\n element: HTMLElement,\n direction: string,\n ): HTMLElement => {\n const neighbor = findNeighbor(listSelectors, element, direction);\n if (!neighbor) return element;\n if ('disabled' in neighbor && neighbor.disabled)\n return getNeighbor(listSelectors, neighbor, direction);\n return neighbor;\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n const parent = event.currentTarget;\n const selectedElement = event.target as HTMLElement;\n const [childAttrName, childAttrValue] =\n typeof childSelector === 'function' ? childSelector(props) : childSelector;\n if (!selectedElement.getAttribute(childAttrName)) return;\n\n const listSelectors = Array.from(\n parent.querySelectorAll(`[${childAttrName}=\"${childAttrValue}\"]`),\n );\n if (!listSelectors.length)\n throw `no children found querySelectorAll([${childAttrName}=\"${childAttrValue}\"] a11yEnhance for ${props['data-ui-name']}`;\n\n switch (event.key) {\n case 'ArrowLeft':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);\n event.preventDefault();\n break;\n case 'ArrowTop':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);\n event.preventDefault();\n break;\n case 'ArrowRight':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);\n event.preventDefault();\n break;\n case 'ArrowBottom':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);\n event.preventDefault();\n break;\n }\n };\n\n return {\n ...props,\n onKeyDown: callAllEventHandlers(props.onKeyDown, handleKeyDown),\n };\n };\n};\n\nexport default a11yEnhance;\n"],"mappings":";;;;;;;;;AAEA,IAAAA,YAAA,GAAAC,OAAA;AAgBA,IAAMC,uBAA8C,GAAG,SAAjDA,uBAA8CA,CAAIC,eAAe,EAAK;EAC1EA,eAAe,aAAfA,eAAe,eAAfA,eAAe,CAAEC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAED,IAAMC,mBAAiC,GAAG,SAApCA,mBAAiCA,CAAIC,aAAa,EAAEC,OAAO,EAAEC,SAAS,EAAK;EAC/E,IAAMC,cAAc,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAACC,QAAQ,CAACF,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;EACpE,IAAMG,YAAY,GAAGL,aAAa,CAACM,SAAS,CAAC,UAACC,IAAI;IAAA,OAAKA,IAAI,KAAKN,OAAO;EAAA,EAAC;EACxE,IAAMO,UAAU,GAAGR,aAAa,CAACS,MAAM;EAEvC,IAAMC,SAAS,GAAGF,UAAU,GAAG,CAAC;EAChC,IAAIG,SAAS,GAAGN,YAAY,GAAGF,cAAc;EAC7C,IAAIQ,SAAS,GAAG,CAAC,EAAEA,SAAS,GAAGD,SAAS;EACxC,IAAIC,SAAS,GAAGD,SAAS,EAAEC,SAAS,GAAG,CAAC;EACxC,OAAOX,aAAa,CAACW,SAAS,CAAC;AACjC,CAAC;AAED,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,OAA2B,EAAK;EACnD,IAAMC,YAAY,GAAGD,OAAO,CAACC,YAAY,IAAIf,mBAAmB;EAChE,IAAMgB,gBAAgB,GAAGF,OAAO,CAACE,gBAAgB,IAAInB,uBAAuB;EAC5E,IAAQoB,aAAa,GAAKH,OAAO,CAAzBG,aAAa;EAErB,OAA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AACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,MAAM,CAAC,EAAET,KAAK,CAAC;UAC5EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,UAAU;UACbvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,KAAK,CAAC,EAAET,KAAK,CAAC;UAC3EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,YAAY;UACfvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,OAAO,CAAC,EAAET,KAAK,CAAC;UAC7EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,aAAa;UAChBvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,QAAQ,CAAC,EAAET,KAAK,CAAC;UAC9EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;MACJ;IACF,CAAC;IAED,WAAAC,cAAA,iBAAAA,cAAA,iBACKtB,KAAK;MACRuB,SAAS,EAAE,IAAAC,iCAAoB,EAACxB,KAAK,CAACuB,SAAS,EAAElB,aAAa;IAAC;EAEnE,CAAC;AACH,CAAC;AAAC,IAAAoB,QAAA,GAAAC,OAAA,cAEa/B,WAAW","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
3
|
import { callAllEventHandlers } from "../assignProps.mjs";
|
|
4
4
|
var defaultOnNeighborChange = function defaultOnNeighborChange(neighborElement) {
|
|
5
|
-
neighborElement === null || neighborElement === void 0
|
|
5
|
+
neighborElement === null || neighborElement === void 0 || neighborElement.focus();
|
|
6
6
|
};
|
|
7
7
|
var defaultFindNeighbor = function defaultFindNeighbor(listSelectors, element, direction) {
|
|
8
8
|
var elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;
|
|
@@ -22,10 +22,10 @@ var a11yEnhance = function a11yEnhance(options) {
|
|
|
22
22
|
var childSelector = options.childSelector;
|
|
23
23
|
return function (props) {
|
|
24
24
|
if (!childSelector) throw "parameter childSelector not passed in options for a11yEnhance for ".concat(props['data-ui-name']);
|
|
25
|
-
var
|
|
25
|
+
var _getNeighbor = function getNeighbor(listSelectors, element, direction) {
|
|
26
26
|
var neighbor = findNeighbor(listSelectors, element, direction);
|
|
27
27
|
if (!neighbor) return element;
|
|
28
|
-
if ('disabled' in neighbor && neighbor.disabled) return
|
|
28
|
+
if ('disabled' in neighbor && neighbor.disabled) return _getNeighbor(listSelectors, neighbor, direction);
|
|
29
29
|
return neighbor;
|
|
30
30
|
};
|
|
31
31
|
var handleKeyDown = function handleKeyDown(event) {
|
|
@@ -40,19 +40,19 @@ var a11yEnhance = function a11yEnhance(options) {
|
|
|
40
40
|
if (!listSelectors.length) throw "no children found querySelectorAll([".concat(childAttrName, "=\"").concat(childAttrValue, "\"] a11yEnhance for ").concat(props['data-ui-name']);
|
|
41
41
|
switch (event.key) {
|
|
42
42
|
case 'ArrowLeft':
|
|
43
|
-
onNeighborChange(
|
|
43
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'left'), props);
|
|
44
44
|
event.preventDefault();
|
|
45
45
|
break;
|
|
46
46
|
case 'ArrowTop':
|
|
47
|
-
onNeighborChange(
|
|
47
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'top'), props);
|
|
48
48
|
event.preventDefault();
|
|
49
49
|
break;
|
|
50
50
|
case 'ArrowRight':
|
|
51
|
-
onNeighborChange(
|
|
51
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'right'), props);
|
|
52
52
|
event.preventDefault();
|
|
53
53
|
break;
|
|
54
54
|
case 'ArrowBottom':
|
|
55
|
-
onNeighborChange(
|
|
55
|
+
onNeighborChange(_getNeighbor(listSelectors, selectedElement, 'bottom'), props);
|
|
56
56
|
event.preventDefault();
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"a11yEnhance.mjs","names":["callAllEventHandlers","defaultOnNeighborChange","neighborElement","focus","defaultFindNeighbor","listSelectors","element","direction","elementSibling","includes","indexElement","findIndex","node","lengthList","length","lastIndex","indexNext","a11yEnhance","options","findNeighbor","onNeighborChange","childSelector","props","concat","getNeighbor","neighbor","disabled","handleKeyDown","event","parent","currentTarget","selectedElement","target","_ref","_ref2","_slicedToArray","childAttrName","childAttrValue","getAttribute","Array","from","querySelectorAll","key","preventDefault","_objectSpread","onKeyDown"],"sources":["../../../src/utils/enhances/a11yEnhance.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"a11yEnhance.mjs","names":["callAllEventHandlers","defaultOnNeighborChange","neighborElement","focus","defaultFindNeighbor","listSelectors","element","direction","elementSibling","includes","indexElement","findIndex","node","lengthList","length","lastIndex","indexNext","a11yEnhance","options","findNeighbor","onNeighborChange","childSelector","props","concat","getNeighbor","neighbor","disabled","handleKeyDown","event","parent","currentTarget","selectedElement","target","_ref","_ref2","_slicedToArray","childAttrName","childAttrValue","getAttribute","Array","from","querySelectorAll","key","preventDefault","_objectSpread","onKeyDown"],"sources":["../../../src/utils/enhances/a11yEnhance.tsx"],"sourcesContent":["import type React from 'react';\n\nimport { callAllEventHandlers } from '../assignProps';\n\ntype OnNeighborChange<P> = (neighborElement: HTMLElement, props: P) => void;\ntype FindNeighbor = (\n listSelectors: HTMLElement[],\n element: HTMLElement,\n direction: string,\n) => HTMLElement | undefined;\ntype ChildSelector<P> = [string, string] | ((props: P) => [string, string]);\n\ntype A11yEnhanceOptions<P = any> = {\n findNeighbor?: FindNeighbor;\n onNeighborChange?: OnNeighborChange<P>;\n childSelector: ChildSelector<P>;\n};\n\nconst defaultOnNeighborChange: OnNeighborChange<any> = (neighborElement) => {\n neighborElement?.focus();\n};\n\nconst defaultFindNeighbor: FindNeighbor = (listSelectors, element, direction) => {\n const elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;\n const indexElement = listSelectors.findIndex((node) => node === element);\n const lengthList = listSelectors.length;\n\n const lastIndex = lengthList - 1;\n let indexNext = indexElement + elementSibling;\n if (indexNext < 0) indexNext = lastIndex;\n if (indexNext > lastIndex) indexNext = 0;\n return listSelectors[indexNext];\n};\n\nconst a11yEnhance = (options: A11yEnhanceOptions) => {\n const findNeighbor = options.findNeighbor || defaultFindNeighbor;\n const onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;\n const { childSelector } = options;\n\n return (props: any) => {\n if (!childSelector)\n throw `parameter childSelector not passed in options for a11yEnhance for ${props['data-ui-name']}`;\n const getNeighbor = (\n listSelectors: any,\n element: HTMLElement,\n direction: string,\n ): HTMLElement => {\n const neighbor = findNeighbor(listSelectors, element, direction);\n if (!neighbor) return element;\n if ('disabled' in neighbor && neighbor.disabled)\n return getNeighbor(listSelectors, neighbor, direction);\n return neighbor;\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {\n const parent = event.currentTarget;\n const selectedElement = event.target as HTMLElement;\n const [childAttrName, childAttrValue] =\n typeof childSelector === 'function' ? childSelector(props) : childSelector;\n if (!selectedElement.getAttribute(childAttrName)) return;\n\n const listSelectors = Array.from(\n parent.querySelectorAll(`[${childAttrName}=\"${childAttrValue}\"]`),\n );\n if (!listSelectors.length)\n throw `no children found querySelectorAll([${childAttrName}=\"${childAttrValue}\"] a11yEnhance for ${props['data-ui-name']}`;\n\n switch (event.key) {\n case 'ArrowLeft':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);\n event.preventDefault();\n break;\n case 'ArrowTop':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);\n event.preventDefault();\n break;\n case 'ArrowRight':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);\n event.preventDefault();\n break;\n case 'ArrowBottom':\n onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);\n event.preventDefault();\n break;\n }\n };\n\n return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,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,UAAU;UACbvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,KAAK,CAAC,EAAET,KAAK,CAAC;UAC3EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,YAAY;UACfvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,OAAO,CAAC,EAAET,KAAK,CAAC;UAC7EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;QACF,KAAK,aAAa;UAChBvB,gBAAgB,CAACI,YAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,QAAQ,CAAC,EAAET,KAAK,CAAC;UAC9EM,KAAK,CAACe,cAAc,CAAC,CAAC;UACtB;MACJ;IACF,CAAC;IAED,OAAAC,aAAA,CAAAA,aAAA,KACKtB,KAAK;MACRuB,SAAS,EAAE7C,oBAAoB,CAACsB,KAAK,CAACuB,SAAS,EAAElB,aAAa;IAAC;EAEnE,CAAC;AACH,CAAC;AAED,eAAeV,WAAW","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
1
|
+
import type { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
2
2
|
/** @deprecated */
|
|
3
3
|
export interface IWithAnimatedSizeEnhanceProps extends WithAnimatedSizeEnhanceProps, UnknownProperties {
|
|
4
4
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -12,6 +12,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
12
12
|
var _ref2 = require("../ref");
|
|
13
13
|
var _useEnhancedEffect = _interopRequireDefault(require("../use/useEnhancedEffect"));
|
|
14
14
|
var _excluded = ["ref", "__animatedEnhanceInstanceId", "duration"];
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
|
|
15
17
|
var uniqueId = 0;
|
|
16
18
|
function animatedSizeEnhance(_ref) {
|
|
17
19
|
var _ref$animateProps = _ref.animateProps,
|
|
@@ -39,6 +41,7 @@ function animatedSizeEnhance(_ref) {
|
|
|
39
41
|
return value === undefined;
|
|
40
42
|
})) {
|
|
41
43
|
for (var i = 0; i < animateProps.length; i++) {
|
|
44
|
+
// @ts-ignore
|
|
42
45
|
lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];
|
|
43
46
|
}
|
|
44
47
|
return;
|
|
@@ -59,30 +62,30 @@ function animatedSizeEnhance(_ref) {
|
|
|
59
62
|
node.style[animateProps[_i2]] = "".concat(lastSizesRef.current[_i2], "px");
|
|
60
63
|
}
|
|
61
64
|
var timeout = -1;
|
|
62
|
-
var
|
|
65
|
+
var _handleTransitionEnd = function handleTransitionEnd() {
|
|
63
66
|
clearTimeout(timeout);
|
|
64
67
|
if (!node) return;
|
|
65
68
|
node.style.transition = null;
|
|
66
69
|
for (var _i3 = 0; _i3 < animateProps.length; _i3++) {
|
|
67
70
|
node.style[animateProps[_i3]] = null;
|
|
68
71
|
}
|
|
69
|
-
node.removeEventListener('transitionend',
|
|
70
|
-
node.removeEventListener('transitioncancel',
|
|
72
|
+
node.removeEventListener('transitionend', _handleTransitionEnd);
|
|
73
|
+
node.removeEventListener('transitioncancel', _handleTransitionEnd);
|
|
71
74
|
};
|
|
72
75
|
var animationFrame = requestAnimationFrame(function () {
|
|
73
76
|
if (!node) return;
|
|
74
|
-
node.addEventListener('transitionend',
|
|
75
|
-
node.addEventListener('transitioncancel',
|
|
77
|
+
node.addEventListener('transitionend', _handleTransitionEnd);
|
|
78
|
+
node.addEventListener('transitioncancel', _handleTransitionEnd);
|
|
76
79
|
node.style.transition = "".concat(duration, "ms all ease-in-out");
|
|
77
80
|
for (var _i4 = 0; _i4 < animateProps.length; _i4++) {
|
|
78
81
|
lastSizesRef.current[_i4] = sizes[_i4];
|
|
79
82
|
node.style[animateProps[_i4]] = "".concat(sizes[_i4], "px");
|
|
80
83
|
}
|
|
81
84
|
});
|
|
82
|
-
timeout = setTimeout(
|
|
85
|
+
timeout = setTimeout(_handleTransitionEnd, 500);
|
|
83
86
|
return function () {
|
|
84
87
|
cancelAnimationFrame(animationFrame);
|
|
85
|
-
|
|
88
|
+
_handleTransitionEnd();
|
|
86
89
|
};
|
|
87
90
|
}, [__animatedEnhanceInstanceId, props.animationsDisabled, duration].concat((0, _toConsumableArray2["default"])(onChangeOf.map(function (propName) {
|
|
88
91
|
return props[propName];
|
|
@@ -93,6 +96,5 @@ function animatedSizeEnhance(_ref) {
|
|
|
93
96
|
}, other);
|
|
94
97
|
};
|
|
95
98
|
}
|
|
96
|
-
var _default = animatedSizeEnhance;
|
|
97
|
-
|
|
98
|
-
//# sourceMappingURL=animatedSizeEnhance.cjs.map
|
|
99
|
+
var _default = exports["default"] = animatedSizeEnhance;
|
|
100
|
+
//# sourceMappingURL=animatedSizeEnhance.js.map
|