@semcore/core 16.0.0-prerelease.2 → 16.0.0-prerelease.21
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 +23 -1
- package/lib/LastInteractionType.d.ts +1 -1
- package/lib/LastInteractionType.js.map +1 -0
- package/lib/LastInteractionType.mjs +51 -0
- package/lib/LastInteractionType.mjs.map +1 -0
- package/lib/{types/core-types → core-types}/Component.d.ts +2 -2
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +28 -31
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/UnknownProperties.mjs +0 -1
- package/lib/core-types/symbols.mjs +20 -10
- package/lib/coreFactory.js.map +1 -0
- package/lib/coreFactory.mjs +324 -0
- package/lib/coreFactory.mjs.map +1 -0
- package/lib/enhancement/Children.mjs +35 -50
- package/lib/enhancement/Root.mjs +21 -35
- package/lib/enhancement/bindHandler.mjs +10 -9
- package/lib/enhancement/dataName.mjs +5 -4
- package/lib/enhancement/enhance.mjs +4 -3
- package/lib/enhancement/functionDefaultProps.mjs +5 -5
- package/lib/enhancement/hoistProps.mjs +22 -32
- package/lib/enhancement/i18n.mjs +8 -8
- package/lib/enhancement/inheritedName.mjs +5 -4
- package/lib/enhancement/staticChildren.mjs +35 -38
- package/lib/enhancement/style.mjs +15 -17
- package/lib/enhancement/uncontrolledProps.mjs +28 -44
- package/lib/esm/LastInteractionType.mjs +51 -0
- package/lib/esm/core-types/Component.mjs +51 -0
- package/lib/esm/core-types/symbols.mjs +20 -0
- package/lib/esm/coreFactory.mjs +324 -0
- package/lib/esm/enhancement/Children.mjs +96 -0
- package/lib/esm/enhancement/Root.mjs +56 -0
- package/lib/{es6/enhancement/bindHandler.js → esm/enhancement/bindHandler.mjs} +10 -9
- package/lib/esm/enhancement/dataName.mjs +13 -0
- package/lib/{es6/enhancement/enhance.js → esm/enhancement/enhance.mjs} +4 -3
- package/lib/{es6/enhancement/functionDefaultProps.js → esm/enhancement/functionDefaultProps.mjs} +5 -5
- package/lib/{es6/enhancement/hoistProps.js → esm/enhancement/hoistProps.mjs} +25 -35
- package/lib/esm/enhancement/i18n.mjs +20 -0
- package/lib/{es6/enhancement/inheritedName.js → esm/enhancement/inheritedName.mjs} +6 -5
- package/lib/{es6/enhancement/staticChildren.js → esm/enhancement/staticChildren.mjs} +38 -41
- package/lib/{es6/enhancement/style.js → esm/enhancement/style.mjs} +16 -18
- package/lib/{es6/enhancement/uncontrolledProps.js → esm/enhancement/uncontrolledProps.mjs} +30 -46
- package/lib/esm/index.mjs +24 -0
- package/lib/esm/register.mjs +31 -0
- package/lib/esm/styled/index.mjs +8 -0
- package/lib/esm/styled/reshadow-core.mjs +234 -0
- package/lib/esm/styled/sstyled.mjs +121 -0
- package/lib/{es6/utils/assignProps.js → esm/utils/assignProps.mjs} +32 -30
- package/lib/esm/utils/canUseDOM.mjs +6 -0
- package/lib/esm/utils/capitalizeFirstLetter.mjs +6 -0
- package/lib/esm/utils/createHoc.mjs +44 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +78 -0
- package/lib/esm/utils/enhances/i18nEnhance.mjs +91 -0
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/logger.mjs +35 -0
- package/lib/{es6/utils/pick.js → esm/utils/pick.mjs} +4 -2
- package/lib/esm/utils/ref.mjs +87 -0
- package/lib/esm/utils/use/useEnhancedEffect.mjs +6 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +24 -0
- package/lib/index.mjs.map +1 -0
- package/lib/register.mjs +13 -11
- package/lib/styled/index.mjs +8 -6
- package/lib/styled/reshadow-core.mjs +92 -101
- package/lib/styled/reshadow-core.mjs.map +1 -1
- package/lib/styled/sstyled.mjs +40 -61
- package/lib/theme/dark.json +2 -2
- package/lib/theme/light.json +3 -3
- package/lib/theme/processor.mjs +4 -4
- package/lib/theme/themes/auto.css +5 -5
- package/lib/theme/themes/dark.css +2 -2
- package/lib/{types/theme → theme}/themes/dark.d.ts +1 -1
- package/lib/theme/themes/dark.js +1 -1
- package/lib/theme/themes/dark.js.map +1 -1
- package/lib/theme/themes/dark.mjs +1 -1
- package/lib/theme/themes/dark.mjs.map +1 -1
- package/lib/theme/themes/default.css +3 -3
- package/lib/theme/themes/default.d.ts +1 -1
- package/lib/theme/themes/default.js +2 -2
- package/lib/theme/themes/default.js.map +1 -1
- package/lib/theme/themes/default.mjs +2 -2
- package/lib/theme/themes/default.mjs.map +1 -1
- package/lib/theme/themes/light.css +3 -3
- package/lib/{types/theme → theme}/themes/light.d.ts +1 -1
- package/lib/theme/themes/light.js +2 -2
- package/lib/theme/themes/light.js.map +1 -1
- package/lib/theme/themes/light.mjs +2 -2
- package/lib/theme/themes/light.mjs.map +1 -1
- package/lib/theme/utils.mjs +9 -9
- package/lib/theme/utils.mjs.map +1 -1
- package/lib/utils/CSSinJS.mjs +1 -1
- package/lib/utils/ScreenReaderOnly.mjs +1 -1
- package/lib/utils/ThemeProvider.mjs +4 -4
- package/lib/utils/addonText.d.ts +1 -1
- package/lib/utils/addonTextChildren.mjs +1 -1
- package/lib/utils/assignProps.mjs +35 -33
- package/lib/utils/canUseDOM.mjs +5 -3
- package/lib/utils/capitalizeFirstLetter.mjs +4 -2
- package/lib/utils/color.mjs +2 -2
- package/lib/utils/createHoc.mjs +27 -29
- package/lib/utils/enhances/WithAutoFocus.mjs +6 -6
- package/lib/utils/enhances/WithCSS.mjs +6 -6
- package/lib/utils/enhances/WithI18n.mjs +38 -43
- package/lib/utils/enhances/WithKeyboardFocus.mjs +6 -6
- package/lib/utils/enhances/WithRef.mjs +1 -1
- package/lib/utils/enhances/a11yEnhance.mjs +2 -2
- package/lib/utils/enhances/animatedSizeEnhance.mjs +15 -15
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.mjs +2 -2
- package/lib/utils/enhances/contextEnhance.mjs +4 -4
- package/lib/utils/enhances/i18nEnhance.mjs +39 -40
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +1 -1
- package/lib/utils/eventEmitter.mjs +3 -3
- package/lib/utils/findComponent.d.ts +2 -2
- package/lib/utils/findComponent.js.map +1 -1
- package/lib/utils/findComponent.mjs.map +1 -1
- package/lib/utils/focus-lock/isFocusable.mjs +1 -1
- package/lib/utils/getAccessibleName.mjs +1 -1
- package/lib/utils/getDisplayName.mjs +5 -3
- package/lib/utils/getEventTarget.mjs +1 -1
- package/lib/utils/hasLabels.mjs +1 -1
- package/lib/utils/injectStyle.mjs +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.mjs +1 -1
- package/lib/utils/logger.mjs +19 -16
- package/lib/utils/pick.mjs +4 -2
- package/lib/utils/propsForElement.mjs +1 -1
- package/lib/utils/ref.d.ts +4 -2
- package/lib/utils/ref.js +2 -1
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +50 -46
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/syncScroll.mjs +1 -1
- package/lib/utils/uncontroll.mjs +1 -1
- package/lib/utils/uniqueID.mjs +2 -2
- package/lib/utils/use/useEnhancedEffect.mjs +4 -3
- package/lib/utils/use/useEventListener.js +1 -1
- package/lib/utils/use/useEventListener.js.map +1 -1
- package/lib/utils/use/useEventListener.mjs +1 -1
- package/lib/utils/use/useEventListener.mjs.map +1 -1
- package/lib/utils/use/useFocusLock.mjs +2 -2
- package/lib/utils/useCssVariable.mjs +3 -3
- package/lib/utils/zIndexStacking.mjs +3 -3
- package/package.json +44 -20
- package/vite.config.ts +24 -0
- package/lib/cjs/LastInteractionType.js.map +0 -1
- package/lib/cjs/core-types/Component.js +0 -59
- package/lib/cjs/core-types/Component.js.map +0 -1
- package/lib/cjs/core-types/UnknownProperties.js +0 -2
- package/lib/cjs/core-types/UnknownProperties.js.map +0 -1
- package/lib/cjs/core-types/reshadow.d.js +0 -2
- package/lib/cjs/core-types/reshadow.d.js.map +0 -1
- package/lib/cjs/core-types/symbols.js +0 -25
- package/lib/cjs/core-types/symbols.js.map +0 -1
- package/lib/cjs/coreFactory.js.map +0 -1
- package/lib/cjs/enhancement/Children.js +0 -119
- package/lib/cjs/enhancement/Children.js.map +0 -1
- package/lib/cjs/enhancement/Root.js +0 -78
- package/lib/cjs/enhancement/Root.js.map +0 -1
- package/lib/cjs/enhancement/bindHandler.js +0 -54
- package/lib/cjs/enhancement/bindHandler.js.map +0 -1
- package/lib/cjs/enhancement/dataName.js +0 -20
- package/lib/cjs/enhancement/dataName.js.map +0 -1
- package/lib/cjs/enhancement/enhance.js +0 -22
- package/lib/cjs/enhancement/enhance.js.map +0 -1
- package/lib/cjs/enhancement/functionDefaultProps.js +0 -36
- package/lib/cjs/enhancement/functionDefaultProps.js.map +0 -1
- package/lib/cjs/enhancement/hoistProps.js +0 -97
- package/lib/cjs/enhancement/hoistProps.js.map +0 -1
- package/lib/cjs/enhancement/i18n.js +0 -28
- package/lib/cjs/enhancement/i18n.js.map +0 -1
- package/lib/cjs/enhancement/inheritedName.js +0 -23
- package/lib/cjs/enhancement/inheritedName.js.map +0 -1
- package/lib/cjs/enhancement/staticChildren.js +0 -135
- package/lib/cjs/enhancement/staticChildren.js.map +0 -1
- package/lib/cjs/enhancement/style.js +0 -60
- package/lib/cjs/enhancement/style.js.map +0 -1
- package/lib/cjs/enhancement/uncontrolledProps.js +0 -131
- package/lib/cjs/enhancement/uncontrolledProps.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/register.js +0 -37
- package/lib/cjs/register.js.map +0 -1
- package/lib/cjs/styled/index.js +0 -32
- package/lib/cjs/styled/index.js.map +0 -1
- package/lib/cjs/styled/reshadow-core.js +0 -256
- package/lib/cjs/styled/reshadow-core.js.map +0 -1
- package/lib/cjs/styled/sstyled.js +0 -149
- package/lib/cjs/styled/sstyled.js.map +0 -1
- package/lib/cjs/theme/dark.json +0 -2506
- package/lib/cjs/theme/exclude-tokens.json +0 -10
- package/lib/cjs/theme/light.json +0 -2584
- package/lib/cjs/theme/processor.js +0 -315
- package/lib/cjs/theme/processor.js.map +0 -1
- package/lib/cjs/theme/themes/auto.css +0 -1465
- package/lib/cjs/theme/themes/dark.css +0 -723
- package/lib/cjs/theme/themes/dark.js +0 -385
- package/lib/cjs/theme/themes/dark.js.map +0 -1
- package/lib/cjs/theme/themes/default.css +0 -742
- package/lib/cjs/theme/themes/default.js +0 -394
- package/lib/cjs/theme/themes/default.js.map +0 -1
- package/lib/cjs/theme/themes/light.css +0 -742
- package/lib/cjs/theme/themes/light.js +0 -394
- package/lib/cjs/theme/themes/light.js.map +0 -1
- package/lib/cjs/theme/utils.js +0 -297
- package/lib/cjs/theme/utils.js.map +0 -1
- package/lib/cjs/utils/CSSinJS.js +0 -36
- package/lib/cjs/utils/CSSinJS.js.map +0 -1
- package/lib/cjs/utils/ScreenReaderOnly.js +0 -31
- package/lib/cjs/utils/ScreenReaderOnly.js.map +0 -1
- package/lib/cjs/utils/ThemeProvider.js +0 -82
- package/lib/cjs/utils/ThemeProvider.js.map +0 -1
- package/lib/cjs/utils/addonText.js +0 -18
- package/lib/cjs/utils/addonText.js.map +0 -1
- package/lib/cjs/utils/addonTextChildren.js +0 -45
- package/lib/cjs/utils/addonTextChildren.js.map +0 -1
- package/lib/cjs/utils/ariaProps.js +0 -22
- package/lib/cjs/utils/ariaProps.js.map +0 -1
- package/lib/cjs/utils/assignProps.js +0 -93
- package/lib/cjs/utils/assignProps.js.map +0 -1
- package/lib/cjs/utils/canUseDOM.js +0 -10
- package/lib/cjs/utils/canUseDOM.js.map +0 -1
- package/lib/cjs/utils/capitalizeFirstLetter.js +0 -10
- package/lib/cjs/utils/capitalizeFirstLetter.js.map +0 -1
- package/lib/cjs/utils/color.js +0 -208
- package/lib/cjs/utils/color.js.map +0 -1
- package/lib/cjs/utils/compose.js +0 -21
- package/lib/cjs/utils/compose.js.map +0 -1
- package/lib/cjs/utils/createHoc.js +0 -55
- package/lib/cjs/utils/createHoc.js.map +0 -1
- package/lib/cjs/utils/createUUID.js +0 -15
- package/lib/cjs/utils/createUUID.js.map +0 -1
- package/lib/cjs/utils/cssToIntDefault.js +0 -22
- package/lib/cjs/utils/cssToIntDefault.js.map +0 -1
- package/lib/cjs/utils/enhances/WithAutoFocus.js +0 -75
- package/lib/cjs/utils/enhances/WithAutoFocus.js.map +0 -1
- package/lib/cjs/utils/enhances/WithCSS.js +0 -93
- package/lib/cjs/utils/enhances/WithCSS.js.map +0 -1
- package/lib/cjs/utils/enhances/WithI18n.js +0 -95
- package/lib/cjs/utils/enhances/WithI18n.js.map +0 -1
- package/lib/cjs/utils/enhances/WithKeyboardFocus.js +0 -93
- package/lib/cjs/utils/enhances/WithKeyboardFocus.js.map +0 -1
- package/lib/cjs/utils/enhances/WithRef.js +0 -26
- package/lib/cjs/utils/enhances/WithRef.js.map +0 -1
- package/lib/cjs/utils/enhances/a11yEnhance.js +0 -74
- package/lib/cjs/utils/enhances/a11yEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/animatedSizeEnhance.js +0 -98
- package/lib/cjs/utils/enhances/animatedSizeEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/autoFocusEnhance.js +0 -46
- package/lib/cjs/utils/enhances/autoFocusEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/contextEnhance.js +0 -22
- package/lib/cjs/utils/enhances/contextEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/i18nEnhance.js +0 -101
- package/lib/cjs/utils/enhances/i18nEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/keyboardFocusEnhance.js +0 -63
- package/lib/cjs/utils/enhances/keyboardFocusEnhance.js.map +0 -1
- package/lib/cjs/utils/enhances/resolveColorEnhance.js +0 -25
- package/lib/cjs/utils/enhances/resolveColorEnhance.js.map +0 -1
- package/lib/cjs/utils/eventEmitter.js +0 -41
- package/lib/cjs/utils/eventEmitter.js.map +0 -1
- package/lib/cjs/utils/findComponent.js +0 -106
- package/lib/cjs/utils/findComponent.js.map +0 -1
- package/lib/cjs/utils/fire.js +0 -23
- package/lib/cjs/utils/fire.js.map +0 -1
- package/lib/cjs/utils/focus-lock/focusBorders.js +0 -72
- package/lib/cjs/utils/focus-lock/focusBorders.js.map +0 -1
- package/lib/cjs/utils/focus-lock/getFocusableIn.js +0 -26
- package/lib/cjs/utils/focus-lock/getFocusableIn.js.map +0 -1
- package/lib/cjs/utils/focus-lock/isFocusInside.js +0 -16
- package/lib/cjs/utils/focus-lock/isFocusInside.js.map +0 -1
- package/lib/cjs/utils/focus-lock/isFocusable.js +0 -51
- package/lib/cjs/utils/focus-lock/isFocusable.js.map +0 -1
- package/lib/cjs/utils/focus-lock/setFocus.js +0 -63
- package/lib/cjs/utils/focus-lock/setFocus.js.map +0 -1
- package/lib/cjs/utils/getAccessibleName.js +0 -56
- package/lib/cjs/utils/getAccessibleName.js.map +0 -1
- package/lib/cjs/utils/getDisplayName.js +0 -10
- package/lib/cjs/utils/getDisplayName.js.map +0 -1
- package/lib/cjs/utils/getEventTarget.js +0 -53
- package/lib/cjs/utils/getEventTarget.js.map +0 -1
- package/lib/cjs/utils/getOriginChildren.js +0 -18
- package/lib/cjs/utils/getOriginChildren.js.map +0 -1
- package/lib/cjs/utils/getRandomInt.js +0 -11
- package/lib/cjs/utils/getRandomInt.js.map +0 -1
- package/lib/cjs/utils/getValue.js +0 -16
- package/lib/cjs/utils/getValue.js.map +0 -1
- package/lib/cjs/utils/hasLabels.js +0 -47
- package/lib/cjs/utils/hasLabels.js.map +0 -1
- package/lib/cjs/utils/hasParent.js +0 -14
- package/lib/cjs/utils/hasParent.js.map +0 -1
- package/lib/cjs/utils/if.js +0 -16
- package/lib/cjs/utils/if.js.map +0 -1
- package/lib/cjs/utils/ifChildren.js +0 -17
- package/lib/cjs/utils/ifChildren.js.map +0 -1
- package/lib/cjs/utils/injectStyle.js +0 -49
- package/lib/cjs/utils/injectStyle.js.map +0 -1
- package/lib/cjs/utils/inputProps.js +0 -22
- package/lib/cjs/utils/inputProps.js.map +0 -1
- package/lib/cjs/utils/isNode.js +0 -28
- package/lib/cjs/utils/isNode.js.map +0 -1
- package/lib/cjs/utils/isPromise.js +0 -10
- package/lib/cjs/utils/isPromise.js.map +0 -1
- package/lib/cjs/utils/isRetina.js +0 -15
- package/lib/cjs/utils/isRetina.js.map +0 -1
- package/lib/cjs/utils/logger.js +0 -40
- package/lib/cjs/utils/logger.js.map +0 -1
- package/lib/cjs/utils/numericChecker.js +0 -33
- package/lib/cjs/utils/numericChecker.js.map +0 -1
- package/lib/cjs/utils/ownerDocument.js +0 -10
- package/lib/cjs/utils/ownerDocument.js.map +0 -1
- package/lib/cjs/utils/pick.js +0 -19
- package/lib/cjs/utils/pick.js.map +0 -1
- package/lib/cjs/utils/propsForElement.js +0 -59
- package/lib/cjs/utils/propsForElement.js.map +0 -1
- package/lib/cjs/utils/rafTrottle.js +0 -33
- package/lib/cjs/utils/rafTrottle.js.map +0 -1
- package/lib/cjs/utils/reactToText.js +0 -33
- package/lib/cjs/utils/reactToText.js.map +0 -1
- package/lib/cjs/utils/ref.js +0 -95
- package/lib/cjs/utils/ref.js.map +0 -1
- package/lib/cjs/utils/setRef.js +0 -10
- package/lib/cjs/utils/setRef.js.map +0 -1
- package/lib/cjs/utils/syncScroll.js +0 -61
- package/lib/cjs/utils/syncScroll.js.map +0 -1
- package/lib/cjs/utils/uncontroll.js +0 -47
- package/lib/cjs/utils/uncontroll.js.map +0 -1
- package/lib/cjs/utils/uniqueID.js +0 -42
- package/lib/cjs/utils/uniqueID.js.map +0 -1
- package/lib/cjs/utils/use/useColorResolver.js +0 -208
- package/lib/cjs/utils/use/useColorResolver.js.map +0 -1
- package/lib/cjs/utils/use/useCss.js +0 -20
- package/lib/cjs/utils/use/useCss.js.map +0 -1
- package/lib/cjs/utils/use/useEnhancedEffect.js +0 -13
- package/lib/cjs/utils/use/useEnhancedEffect.js.map +0 -1
- package/lib/cjs/utils/use/useEventCallback.js +0 -25
- package/lib/cjs/utils/use/useEventCallback.js.map +0 -1
- package/lib/cjs/utils/use/useEventListener.js +0 -33
- package/lib/cjs/utils/use/useEventListener.js.map +0 -1
- package/lib/cjs/utils/use/useFocusLock.js +0 -289
- package/lib/cjs/utils/use/useFocusLock.js.map +0 -1
- package/lib/cjs/utils/use/usePreventScroll.js +0 -78
- package/lib/cjs/utils/use/usePreventScroll.js.map +0 -1
- package/lib/cjs/utils/useCssVariable.js +0 -55
- package/lib/cjs/utils/useCssVariable.js.map +0 -1
- package/lib/cjs/utils/zIndexStacking.js +0 -48
- package/lib/cjs/utils/zIndexStacking.js.map +0 -1
- package/lib/es6/LastInteractionType.js +0 -49
- package/lib/es6/LastInteractionType.js.map +0 -1
- package/lib/es6/core-types/Component.js +0 -54
- package/lib/es6/core-types/Component.js.map +0 -1
- package/lib/es6/core-types/UnknownProperties.js +0 -2
- package/lib/es6/core-types/UnknownProperties.js.map +0 -1
- package/lib/es6/core-types/reshadow.d.js +0 -2
- package/lib/es6/core-types/reshadow.d.js.map +0 -1
- package/lib/es6/core-types/symbols.js +0 -10
- package/lib/es6/core-types/symbols.js.map +0 -1
- package/lib/es6/coreFactory.js +0 -343
- package/lib/es6/coreFactory.js.map +0 -1
- package/lib/es6/enhancement/Children.js +0 -111
- package/lib/es6/enhancement/Children.js.map +0 -1
- package/lib/es6/enhancement/Root.js +0 -70
- package/lib/es6/enhancement/Root.js.map +0 -1
- package/lib/es6/enhancement/bindHandler.js.map +0 -1
- package/lib/es6/enhancement/dataName.js +0 -12
- package/lib/es6/enhancement/dataName.js.map +0 -1
- package/lib/es6/enhancement/enhance.js.map +0 -1
- package/lib/es6/enhancement/functionDefaultProps.js.map +0 -1
- package/lib/es6/enhancement/hoistProps.js.map +0 -1
- package/lib/es6/enhancement/i18n.js +0 -20
- package/lib/es6/enhancement/i18n.js.map +0 -1
- package/lib/es6/enhancement/inheritedName.js.map +0 -1
- package/lib/es6/enhancement/staticChildren.js.map +0 -1
- package/lib/es6/enhancement/style.js.map +0 -1
- package/lib/es6/enhancement/uncontrolledProps.js.map +0 -1
- package/lib/es6/index.js +0 -9
- package/lib/es6/index.js.map +0 -1
- package/lib/es6/register.js +0 -29
- package/lib/es6/register.js.map +0 -1
- package/lib/es6/styled/index.js +0 -6
- package/lib/es6/styled/index.js.map +0 -1
- package/lib/es6/styled/reshadow-core.js +0 -243
- package/lib/es6/styled/reshadow-core.js.map +0 -1
- package/lib/es6/styled/sstyled.js +0 -142
- package/lib/es6/styled/sstyled.js.map +0 -1
- package/lib/es6/theme/dark.json +0 -2506
- package/lib/es6/theme/exclude-tokens.json +0 -10
- package/lib/es6/theme/light.json +0 -2584
- package/lib/es6/theme/processor.js +0 -307
- package/lib/es6/theme/processor.js.map +0 -1
- package/lib/es6/theme/themes/auto.css +0 -1465
- package/lib/es6/theme/themes/dark.css +0 -723
- package/lib/es6/theme/themes/dark.js +0 -378
- package/lib/es6/theme/themes/dark.js.map +0 -1
- package/lib/es6/theme/themes/default.css +0 -742
- package/lib/es6/theme/themes/default.js +0 -387
- package/lib/es6/theme/themes/default.js.map +0 -1
- package/lib/es6/theme/themes/light.css +0 -742
- package/lib/es6/theme/themes/light.js +0 -387
- package/lib/es6/theme/themes/light.js.map +0 -1
- package/lib/es6/theme/utils.js +0 -286
- package/lib/es6/theme/utils.js.map +0 -1
- package/lib/es6/utils/CSSinJS.js +0 -28
- package/lib/es6/utils/CSSinJS.js.map +0 -1
- package/lib/es6/utils/ScreenReaderOnly.js +0 -24
- package/lib/es6/utils/ScreenReaderOnly.js.map +0 -1
- package/lib/es6/utils/ThemeProvider.js +0 -71
- package/lib/es6/utils/ThemeProvider.js.map +0 -1
- package/lib/es6/utils/addonText.js +0 -11
- package/lib/es6/utils/addonText.js.map +0 -1
- package/lib/es6/utils/addonTextChildren.js +0 -37
- package/lib/es6/utils/addonTextChildren.js.map +0 -1
- package/lib/es6/utils/ariaProps.js +0 -16
- package/lib/es6/utils/ariaProps.js.map +0 -1
- package/lib/es6/utils/assignProps.js.map +0 -1
- package/lib/es6/utils/canUseDOM.js +0 -4
- package/lib/es6/utils/canUseDOM.js.map +0 -1
- package/lib/es6/utils/capitalizeFirstLetter.js +0 -4
- package/lib/es6/utils/capitalizeFirstLetter.js.map +0 -1
- package/lib/es6/utils/color.js +0 -196
- package/lib/es6/utils/color.js.map +0 -1
- package/lib/es6/utils/compose.js +0 -15
- package/lib/es6/utils/compose.js.map +0 -1
- package/lib/es6/utils/createHoc.js +0 -46
- package/lib/es6/utils/createHoc.js.map +0 -1
- package/lib/es6/utils/createUUID.js +0 -9
- package/lib/es6/utils/createUUID.js.map +0 -1
- package/lib/es6/utils/cssToIntDefault.js +0 -16
- package/lib/es6/utils/cssToIntDefault.js.map +0 -1
- package/lib/es6/utils/enhances/WithAutoFocus.js +0 -67
- package/lib/es6/utils/enhances/WithAutoFocus.js.map +0 -1
- package/lib/es6/utils/enhances/WithCSS.js +0 -79
- package/lib/es6/utils/enhances/WithCSS.js.map +0 -1
- package/lib/es6/utils/enhances/WithI18n.js +0 -83
- package/lib/es6/utils/enhances/WithI18n.js.map +0 -1
- package/lib/es6/utils/enhances/WithKeyboardFocus.js +0 -84
- package/lib/es6/utils/enhances/WithKeyboardFocus.js.map +0 -1
- package/lib/es6/utils/enhances/WithRef.js +0 -18
- package/lib/es6/utils/enhances/WithRef.js.map +0 -1
- package/lib/es6/utils/enhances/a11yEnhance.js +0 -66
- package/lib/es6/utils/enhances/a11yEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/animatedSizeEnhance.js +0 -90
- package/lib/es6/utils/enhances/animatedSizeEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/autoFocusEnhance.js +0 -38
- package/lib/es6/utils/enhances/autoFocusEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/contextEnhance.js +0 -14
- package/lib/es6/utils/enhances/contextEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/i18nEnhance.js +0 -92
- package/lib/es6/utils/enhances/i18nEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/keyboardFocusEnhance.js +0 -57
- package/lib/es6/utils/enhances/keyboardFocusEnhance.js.map +0 -1
- package/lib/es6/utils/enhances/resolveColorEnhance.js +0 -17
- package/lib/es6/utils/enhances/resolveColorEnhance.js.map +0 -1
- package/lib/es6/utils/eventEmitter.js +0 -34
- package/lib/es6/utils/eventEmitter.js.map +0 -1
- package/lib/es6/utils/findComponent.js +0 -95
- package/lib/es6/utils/findComponent.js.map +0 -1
- package/lib/es6/utils/fire.js +0 -15
- package/lib/es6/utils/fire.js.map +0 -1
- package/lib/es6/utils/focus-lock/focusBorders.js +0 -62
- package/lib/es6/utils/focus-lock/focusBorders.js.map +0 -1
- package/lib/es6/utils/focus-lock/getFocusableIn.js +0 -19
- package/lib/es6/utils/focus-lock/getFocusableIn.js.map +0 -1
- package/lib/es6/utils/focus-lock/isFocusInside.js +0 -9
- package/lib/es6/utils/focus-lock/isFocusInside.js.map +0 -1
- package/lib/es6/utils/focus-lock/isFocusable.js +0 -43
- package/lib/es6/utils/focus-lock/isFocusable.js.map +0 -1
- package/lib/es6/utils/focus-lock/setFocus.js +0 -55
- package/lib/es6/utils/focus-lock/setFocus.js.map +0 -1
- package/lib/es6/utils/getAccessibleName.js +0 -49
- package/lib/es6/utils/getAccessibleName.js.map +0 -1
- package/lib/es6/utils/getDisplayName.js +0 -4
- package/lib/es6/utils/getDisplayName.js.map +0 -1
- package/lib/es6/utils/getEventTarget.js +0 -45
- package/lib/es6/utils/getEventTarget.js.map +0 -1
- package/lib/es6/utils/getOriginChildren.js +0 -10
- package/lib/es6/utils/getOriginChildren.js.map +0 -1
- package/lib/es6/utils/getRandomInt.js +0 -5
- package/lib/es6/utils/getRandomInt.js.map +0 -1
- package/lib/es6/utils/getValue.js +0 -10
- package/lib/es6/utils/getValue.js.map +0 -1
- package/lib/es6/utils/hasLabels.js +0 -39
- package/lib/es6/utils/hasLabels.js.map +0 -1
- package/lib/es6/utils/hasParent.js +0 -7
- package/lib/es6/utils/hasParent.js.map +0 -1
- package/lib/es6/utils/if.js +0 -9
- package/lib/es6/utils/if.js.map +0 -1
- package/lib/es6/utils/ifChildren.js +0 -10
- package/lib/es6/utils/ifChildren.js.map +0 -1
- package/lib/es6/utils/injectStyle.js +0 -41
- package/lib/es6/utils/injectStyle.js.map +0 -1
- package/lib/es6/utils/inputProps.js +0 -14
- package/lib/es6/utils/inputProps.js.map +0 -1
- package/lib/es6/utils/isNode.js +0 -21
- package/lib/es6/utils/isNode.js.map +0 -1
- package/lib/es6/utils/isPromise.js +0 -4
- package/lib/es6/utils/isPromise.js.map +0 -1
- package/lib/es6/utils/isRetina.js +0 -9
- package/lib/es6/utils/isRetina.js.map +0 -1
- package/lib/es6/utils/logger.js +0 -32
- package/lib/es6/utils/logger.js.map +0 -1
- package/lib/es6/utils/numericChecker.js +0 -27
- package/lib/es6/utils/numericChecker.js.map +0 -1
- package/lib/es6/utils/ownerDocument.js +0 -4
- package/lib/es6/utils/ownerDocument.js.map +0 -1
- package/lib/es6/utils/pick.js.map +0 -1
- package/lib/es6/utils/propsForElement.js +0 -50
- package/lib/es6/utils/propsForElement.js.map +0 -1
- package/lib/es6/utils/rafTrottle.js +0 -26
- package/lib/es6/utils/rafTrottle.js.map +0 -1
- package/lib/es6/utils/reactToText.js +0 -26
- package/lib/es6/utils/reactToText.js.map +0 -1
- package/lib/es6/utils/ref.js +0 -83
- package/lib/es6/utils/ref.js.map +0 -1
- package/lib/es6/utils/setRef.js +0 -3
- package/lib/es6/utils/setRef.js.map +0 -1
- package/lib/es6/utils/syncScroll.js +0 -54
- package/lib/es6/utils/syncScroll.js.map +0 -1
- package/lib/es6/utils/uncontroll.js +0 -38
- package/lib/es6/utils/uncontroll.js.map +0 -1
- package/lib/es6/utils/uniqueID.js +0 -33
- package/lib/es6/utils/uniqueID.js.map +0 -1
- package/lib/es6/utils/use/useColorResolver.js +0 -200
- package/lib/es6/utils/use/useColorResolver.js.map +0 -1
- package/lib/es6/utils/use/useCss.js +0 -12
- package/lib/es6/utils/use/useCss.js.map +0 -1
- package/lib/es6/utils/use/useEnhancedEffect.js +0 -5
- package/lib/es6/utils/use/useEnhancedEffect.js.map +0 -1
- package/lib/es6/utils/use/useEventCallback.js +0 -19
- package/lib/es6/utils/use/useEventCallback.js.map +0 -1
- package/lib/es6/utils/use/useEventListener.js +0 -25
- package/lib/es6/utils/use/useEventListener.js.map +0 -1
- package/lib/es6/utils/use/useFocusLock.js +0 -266
- package/lib/es6/utils/use/useFocusLock.js.map +0 -1
- package/lib/es6/utils/use/usePreventScroll.js +0 -70
- package/lib/es6/utils/use/usePreventScroll.js.map +0 -1
- package/lib/es6/utils/useCssVariable.js +0 -46
- package/lib/es6/utils/useCssVariable.js.map +0 -1
- package/lib/es6/utils/zIndexStacking.js +0 -38
- package/lib/es6/utils/zIndexStacking.js.map +0 -1
- package/lib/esm/_virtual/_commonjsHelpers.mjs +0 -6
- package/lib/esm/_virtual/index.mjs +0 -4
- package/lib/esm/_virtual/index2.mjs +0 -4
- package/lib/esm/_virtual/react-is.development.mjs +0 -4
- package/lib/esm/_virtual/react-is.production.min.mjs +0 -4
- package/lib/types/LastInteractionType.d.ts +0 -11
- package/lib/types/core-types/UnknownProperties.d.ts +0 -3
- package/lib/types/core-types/symbols.d.ts +0 -9
- package/lib/types/register.d.ts +0 -8
- package/lib/types/styled/index.d.ts +0 -11
- package/lib/types/styled/reshadow-core.d.ts +0 -37
- package/lib/types/styled/sstyled.d.ts +0 -17
- package/lib/types/theme/themes/default.d.ts +0 -387
- package/lib/types/utils/CSSinJS.d.ts +0 -5
- package/lib/types/utils/ScreenReaderOnly.d.ts +0 -8
- package/lib/types/utils/ThemeProvider.d.ts +0 -15
- package/lib/types/utils/addonText.d.ts +0 -2
- package/lib/types/utils/addonTextChildren.d.ts +0 -3
- package/lib/types/utils/ariaProps.d.ts +0 -12
- package/lib/types/utils/assignProps.d.ts +0 -11
- package/lib/types/utils/canUseDOM.d.ts +0 -1
- package/lib/types/utils/capitalizeFirstLetter.d.ts +0 -1
- package/lib/types/utils/color.d.ts +0 -5
- package/lib/types/utils/compose.d.ts +0 -1
- package/lib/types/utils/createHoc.d.ts +0 -3
- package/lib/types/utils/createUUID.d.ts +0 -1
- package/lib/types/utils/cssToIntDefault.d.ts +0 -8
- package/lib/types/utils/enhances/WithAutoFocus.d.ts +0 -14
- package/lib/types/utils/enhances/WithCSS.d.ts +0 -41
- package/lib/types/utils/enhances/WithI18n.d.ts +0 -43
- package/lib/types/utils/enhances/WithKeyboardFocus.d.ts +0 -45
- package/lib/types/utils/enhances/WithRef.d.ts +0 -3
- package/lib/types/utils/enhances/a11yEnhance.d.ts +0 -10
- package/lib/types/utils/enhances/animatedSizeEnhance.d.ts +0 -12
- package/lib/types/utils/enhances/autoFocusEnhance.d.ts +0 -10
- package/lib/types/utils/enhances/contextEnhance.d.ts +0 -3
- package/lib/types/utils/enhances/i18nEnhance.d.ts +0 -25
- package/lib/types/utils/enhances/keyboardFocusEnhance.d.ts +0 -27
- package/lib/types/utils/enhances/resolveColorEnhance.d.ts +0 -2
- package/lib/types/utils/eventEmitter.d.ts +0 -9
- package/lib/types/utils/findComponent.d.ts +0 -12
- package/lib/types/utils/fire.d.ts +0 -2
- package/lib/types/utils/focus-lock/focusBorders.d.ts +0 -4
- package/lib/types/utils/focus-lock/getFocusableIn.d.ts +0 -1
- package/lib/types/utils/focus-lock/isFocusInside.d.ts +0 -1
- package/lib/types/utils/focus-lock/isFocusable.d.ts +0 -1
- package/lib/types/utils/focus-lock/setFocus.d.ts +0 -1
- package/lib/types/utils/getAccessibleName.d.ts +0 -1
- package/lib/types/utils/getDisplayName.d.ts +0 -2
- package/lib/types/utils/getEventTarget.d.ts +0 -1
- package/lib/types/utils/getOriginChildren.d.ts +0 -2
- package/lib/types/utils/getRandomInt.d.ts +0 -1
- package/lib/types/utils/getValue.d.ts +0 -1
- package/lib/types/utils/hasLabels.d.ts +0 -7
- package/lib/types/utils/hasParent.d.ts +0 -1
- package/lib/types/utils/if.d.ts +0 -11
- package/lib/types/utils/ifChildren.d.ts +0 -8
- package/lib/types/utils/injectStyle.d.ts +0 -2
- package/lib/types/utils/inputProps.d.ts +0 -2
- package/lib/types/utils/isNode.d.ts +0 -1
- package/lib/types/utils/isPromise.d.ts +0 -1
- package/lib/types/utils/isRetina.d.ts +0 -1
- package/lib/types/utils/logger.d.ts +0 -9
- package/lib/types/utils/numericChecker.d.ts +0 -5
- package/lib/types/utils/ownerDocument.d.ts +0 -1
- package/lib/types/utils/pick.d.ts +0 -1
- package/lib/types/utils/propsForElement.d.ts +0 -3
- package/lib/types/utils/rafTrottle.d.ts +0 -2
- package/lib/types/utils/reactToText.d.ts +0 -3
- package/lib/types/utils/ref.d.ts +0 -8
- package/lib/types/utils/setRef.d.ts +0 -2
- package/lib/types/utils/syncScroll.d.ts +0 -1
- package/lib/types/utils/uncontroll.d.ts +0 -4
- package/lib/types/utils/uniqueID.d.ts +0 -12
- package/lib/types/utils/use/useColorResolver.d.ts +0 -1
- package/lib/types/utils/use/useCss.d.ts +0 -4
- package/lib/types/utils/use/useEnhancedEffect.d.ts +0 -3
- package/lib/types/utils/use/useEventCallback.d.ts +0 -4
- package/lib/types/utils/use/useEventListener.d.ts +0 -2
- package/lib/types/utils/use/useFocusLock.d.ts +0 -10
- package/lib/types/utils/use/usePreventScroll.d.ts +0 -2
- package/lib/types/utils/useCssVariable.d.ts +0 -8
- package/lib/types/utils/zIndexStacking.d.ts +0 -8
- /package/lib/{cjs/LastInteractionType.js → LastInteractionType.js} +0 -0
- /package/lib/{types/coreFactory.d.ts → coreFactory.d.ts} +0 -0
- /package/lib/{cjs/coreFactory.js → coreFactory.js} +0 -0
- /package/lib/{types/enhancement → enhancement}/Children.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/Root.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/bindHandler.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/dataName.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/enhance.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/functionDefaultProps.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/hoistProps.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/i18n.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/inheritedName.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/staticChildren.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/style.d.ts +0 -0
- /package/lib/{types/enhancement → enhancement}/uncontrolledProps.d.ts +0 -0
- /package/lib/{types/index.d.ts → index.d.ts} +0 -0
- /package/lib/{cjs/index.js → index.js} +0 -0
- /package/lib/{types/theme → theme}/processor.d.ts +0 -0
- /package/lib/{types/theme → theme}/utils.d.ts +0 -0
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import { PureComponent } from 'react';
|
|
8
|
-
import createHoc from '../createHoc';
|
|
9
|
-
import { internalSetState } from '../uncontroll';
|
|
10
|
-
import fire from '../fire';
|
|
11
|
-
var usingKeyBoard = true;
|
|
12
|
-
export var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
13
|
-
_inherits(EnhancedWithKeyboardFocus, _PureComponent);
|
|
14
|
-
var _super = _createSuper(EnhancedWithKeyboardFocus);
|
|
15
|
-
function EnhancedWithKeyboardFocus() {
|
|
16
|
-
var _this;
|
|
17
|
-
_classCallCheck(this, EnhancedWithKeyboardFocus);
|
|
18
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
-
args[_key] = arguments[_key];
|
|
20
|
-
}
|
|
21
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
22
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
23
|
-
keyboardFocused: false
|
|
24
|
-
});
|
|
25
|
-
_defineProperty(_assertThisInitialized(_this), "handlerFocus", function (e) {
|
|
26
|
-
fire(_assertThisInitialized(_this), 'onFocus', e);
|
|
27
|
-
if (usingKeyBoard) {
|
|
28
|
-
internalSetState(_assertThisInitialized(_this), {
|
|
29
|
-
keyboardFocused: true
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
_defineProperty(_assertThisInitialized(_this), "handlerBlur", function (e) {
|
|
34
|
-
fire(_assertThisInitialized(_this), 'onBlur', e);
|
|
35
|
-
internalSetState(_assertThisInitialized(_this), {
|
|
36
|
-
keyboardFocused: false
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
_defineProperty(_assertThisInitialized(_this), "handlerKeyDown", function (e) {
|
|
40
|
-
fire(_assertThisInitialized(_this), 'onKeyDown', e);
|
|
41
|
-
usingKeyBoard = true;
|
|
42
|
-
});
|
|
43
|
-
_defineProperty(_assertThisInitialized(_this), "handlerMouseDown", function (e) {
|
|
44
|
-
fire(_assertThisInitialized(_this), 'onMouseDown', e);
|
|
45
|
-
usingKeyBoard = false;
|
|
46
|
-
});
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
_createClass(EnhancedWithKeyboardFocus, [{
|
|
50
|
-
key: "render",
|
|
51
|
-
value: function render() {
|
|
52
|
-
var _this$props = this.props,
|
|
53
|
-
children = _this$props.children,
|
|
54
|
-
tabIndex = _this$props.tabIndex,
|
|
55
|
-
disabled = _this$props.disabled;
|
|
56
|
-
var keyboardFocused = this.state.keyboardFocused;
|
|
57
|
-
return children({
|
|
58
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
59
|
-
keyboardFocused: keyboardFocused,
|
|
60
|
-
onFocus: this.handlerFocus,
|
|
61
|
-
onBlur: this.handlerBlur,
|
|
62
|
-
onKeyDown: this.handlerKeyDown,
|
|
63
|
-
onMouseDown: this.handlerMouseDown
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}], [{
|
|
67
|
-
key: "getDerivedStateFromProps",
|
|
68
|
-
value: function getDerivedStateFromProps(props, state) {
|
|
69
|
-
if (props.keyboardFocused !== undefined) {
|
|
70
|
-
return {
|
|
71
|
-
keyboardFocused: props.keyboardFocused
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return state;
|
|
75
|
-
}
|
|
76
|
-
}]);
|
|
77
|
-
return EnhancedWithKeyboardFocus;
|
|
78
|
-
}(PureComponent);
|
|
79
|
-
_defineProperty(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
|
|
80
|
-
_defineProperty(EnhancedWithKeyboardFocus, "defaultProps", {
|
|
81
|
-
tabIndex: 0
|
|
82
|
-
});
|
|
83
|
-
export default createHoc(EnhancedWithKeyboardFocus);
|
|
84
|
-
//# sourceMappingURL=WithKeyboardFocus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithKeyboardFocus.js","names":["PureComponent","createHoc","internalSetState","fire","usingKeyBoard","EnhancedWithKeyboardFocus","_PureComponent","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","keyboardFocused","e","_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 React, { PureComponent } from 'react';\nimport createHoc from '../createHoc';\nimport { internalSetState } from '../uncontroll';\nimport fire from '../fire';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\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":";;;;;;AAAA,SAAgBA,aAAa,QAAQ,OAAO;AAC5C,OAAOC,SAAS,MAAM,cAAc;AACpC,SAASC,gBAAgB,QAAQ,eAAe;AAChD,OAAOC,IAAI,MAAM,SAAS;AAuC1B,IAAIC,aAAa,GAAG,IAAI;AAExB,WAAaC,yBAAyB,0BAAAC,cAAA;EAAAC,SAAA,CAAAF,yBAAA,EAAAC,cAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,yBAAA;EAAA,SAAAA,0BAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,yBAAA;IAAA,SAAAO,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAF,MAAA,CAAAU,IAAA,CAAAC,KAAA,CAAAX,MAAA,SAAAY,MAAA,CAAAL,IAAA;IAAAM,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,YAmB5B;MACNa,eAAe,EAAE;IACnB,CAAC;IAAAF,eAAA,CAAAC,sBAAA,CAAAZ,KAAA,mBAEc,UAACc,CAAa,EAAK;MAChCrB,IAAI,CAAAmB,sBAAA,CAAAZ,KAAA,GAAO,SAAS,EAAEc,CAAC,CAAC;MACxB,IAAIpB,aAAa,EAAE;QACjBF,gBAAgB,CAAAoB,sBAAA,CAAAZ,KAAA,GAAO;UAAEa,eAAe,EA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,IAAI,CAACC;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EA9CD,SAAAgB,yBAAgCb,KAAU,EAAEI,KAAU,EAAE;MACtD,IAAIJ,KAAK,CAACP,eAAe,KAAKqB,SAAS,EAAE;QACvC,OAAO;UACLrB,eAAe,EAAEO,KAAK,CAACP;QACzB,CAAC;MACH;MACA,OAAOW,KAAK;IACd;EAAC;EAAA,OAAA7B,yBAAA;AAAA,EAjB4CL,aAAa;AAyD3DqB,eAAA,CAzDYhB,yBAAyB,iBAIf,2BAA2B;AAAAgB,eAAA,CAJrChB,yBAAyB,kBAMd;EACpB2B,QAAQ,EAAE;AACZ,CAAC;AAmDH,eAAe/B,SAAS,CAACI,yBAAyB,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import getDisplayName from '../getDisplayName';
|
|
4
|
-
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
5
|
-
function WithForwardRef() {
|
|
6
|
-
return function ForwardRef(Component) {
|
|
7
|
-
var Wrapped = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8
|
-
// @ts-ignore
|
|
9
|
-
return /*#__PURE__*/React.createElement(Component, _extends({}, Component.defaultProps || {}, props, {
|
|
10
|
-
forwardedRef: ref
|
|
11
|
-
}));
|
|
12
|
-
});
|
|
13
|
-
Wrapped.displayName = getDisplayName(Component);
|
|
14
|
-
return hoistNonReactStatics(Wrapped, Component);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export default WithForwardRef;
|
|
18
|
-
//# sourceMappingURL=WithRef.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WithRef.js","names":["React","getDisplayName","hoistNonReactStatics","WithForwardRef","ForwardRef","Component","Wrapped","forwardRef","props","ref","createElement","_extends","defaultProps","forwardedRef","displayName"],"sources":["../../../../src/utils/enhances/WithRef.tsx"],"sourcesContent":["import React from 'react';\nimport getDisplayName from '../getDisplayName';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\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,KAAK,MAAM,OAAO;AACzB,OAAOC,cAAc,MAAM,mBAAmB;AAC9C,OAAOC,oBAAoB,MAAM,yBAAyB;AAE1D,SAASC,cAAcA,CAAA,EAAG;EACxB,OAAO,SAASC,UAAUA,CAAgCC,SAAY,EAAE;IACtE,IAAMC,OAAO,gBAAGN,KAAK,CAACO,UAAU,CAAC,UAACC,KAAK,EAAEC,GAAG,EAAK;MAC/C;MACA,oBAAOT,KAAA,CAAAU,aAAA,CAACL,SAAS,EAAAM,QAAA,KAAMN,SAAS,CAACO,YAAY,IAAI,CAAC,CAAC,EAAOJ,KAAK;QAAEK,YAAY,EAAEJ;MAAI,GAAG;IACxF,CAAC,CAAC;IACFH,OAAO,CAACQ,WAAW,GAAGb,cAAc,CAACI,SAAS,CAAC;IAC/C,OAAOH,oBAAoB,CAACI,OAAO,EAAED,SAAS,CAAC;EACjD,CAAC;AACH;AAEA,eAAeF,cAAc"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import { callAllEventHandlers } from '../assignProps';
|
|
4
|
-
var defaultOnNeighborChange = function defaultOnNeighborChange(neighborElement) {
|
|
5
|
-
neighborElement === null || neighborElement === void 0 ? void 0 : neighborElement.focus();
|
|
6
|
-
};
|
|
7
|
-
var defaultFindNeighbor = function defaultFindNeighbor(listSelectors, element, direction) {
|
|
8
|
-
var elementSibling = ['right', 'top'].includes(direction) ? 1 : -1;
|
|
9
|
-
var indexElement = listSelectors.findIndex(function (node) {
|
|
10
|
-
return node === element;
|
|
11
|
-
});
|
|
12
|
-
var lengthList = listSelectors.length;
|
|
13
|
-
var lastIndex = lengthList - 1;
|
|
14
|
-
var indexNext = indexElement + elementSibling;
|
|
15
|
-
if (indexNext < 0) indexNext = lastIndex;
|
|
16
|
-
if (indexNext > lastIndex) indexNext = 0;
|
|
17
|
-
return listSelectors[indexNext];
|
|
18
|
-
};
|
|
19
|
-
var a11yEnhance = function a11yEnhance(options) {
|
|
20
|
-
var findNeighbor = options.findNeighbor || defaultFindNeighbor;
|
|
21
|
-
var onNeighborChange = options.onNeighborChange || defaultOnNeighborChange;
|
|
22
|
-
var childSelector = options.childSelector;
|
|
23
|
-
return function (props) {
|
|
24
|
-
if (!childSelector) throw "parameter childSelector not passed in options for a11yEnhance for ".concat(props['data-ui-name']);
|
|
25
|
-
var getNeighbor = function getNeighbor(listSelectors, element, direction) {
|
|
26
|
-
var neighbor = findNeighbor(listSelectors, element, direction);
|
|
27
|
-
if (!neighbor) return element;
|
|
28
|
-
if ('disabled' in neighbor && neighbor.disabled) return getNeighbor(listSelectors, neighbor, direction);
|
|
29
|
-
return neighbor;
|
|
30
|
-
};
|
|
31
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
32
|
-
var parent = event.currentTarget;
|
|
33
|
-
var selectedElement = event.target;
|
|
34
|
-
var _ref = typeof childSelector === 'function' ? childSelector(props) : childSelector,
|
|
35
|
-
_ref2 = _slicedToArray(_ref, 2),
|
|
36
|
-
childAttrName = _ref2[0],
|
|
37
|
-
childAttrValue = _ref2[1];
|
|
38
|
-
if (!selectedElement.getAttribute(childAttrName)) return;
|
|
39
|
-
var listSelectors = Array.from(parent.querySelectorAll("[".concat(childAttrName, "=\"").concat(childAttrValue, "\"]")));
|
|
40
|
-
if (!listSelectors.length) throw "no children found querySelectorAll([".concat(childAttrName, "=\"").concat(childAttrValue, "\"] a11yEnhance for ").concat(props['data-ui-name']);
|
|
41
|
-
switch (event.key) {
|
|
42
|
-
case 'ArrowLeft':
|
|
43
|
-
onNeighborChange(getNeighbor(listSelectors, selectedElement, 'left'), props);
|
|
44
|
-
event.preventDefault();
|
|
45
|
-
break;
|
|
46
|
-
case 'ArrowTop':
|
|
47
|
-
onNeighborChange(getNeighbor(listSelectors, selectedElement, 'top'), props);
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
break;
|
|
50
|
-
case 'ArrowRight':
|
|
51
|
-
onNeighborChange(getNeighbor(listSelectors, selectedElement, 'right'), props);
|
|
52
|
-
event.preventDefault();
|
|
53
|
-
break;
|
|
54
|
-
case 'ArrowBottom':
|
|
55
|
-
onNeighborChange(getNeighbor(listSelectors, selectedElement, 'bottom'), props);
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
break;
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
return _objectSpread(_objectSpread({}, props), {}, {
|
|
61
|
-
onKeyDown: callAllEventHandlers(props.onKeyDown, handleKeyDown)
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export default a11yEnhance;
|
|
66
|
-
//# sourceMappingURL=a11yEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"a11yEnhance.js","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 { callAllEventHandlers } from '../assignProps';\nimport React from 'react';\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":";;AAAA,SAASA,oBAAoB,QAAQ,gBAAgB;AAiBrD,IAAMC,uBAA8C,GAAG,SAAjDA,uBAA8CA,CAAIC,eAAe,EAAK;EAC1EA,eAAe,aAAfA,eAAe,uBAAfA,eAAe,CAAEC,KAAK,EAAE;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,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,CAACY,gBAAgB,KAAAlB,MAAA,CAAKa,aAAa,SAAAb,MAAA,CAAKc,cAAc,SAAK,CAClE;MACD,IAAI,CAAChC,aAAa,CAACS,MAAM,EACvB,6CAAAS,MAAA,CAA6Ca,aAAa,SAAAb,MAAA,CAAKc,cAAc,0BAAAd,MAAA,CAAsBD,KAAK,CAAC,cAAc,CAAC;MAE1H,QAAQM,KAAK,CAACc,GAAG;QACf,KAAK,WAAW;UACdtB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,MAAM,CAAC,EAAET,KAAK,CAAC;UAC5EM,KAAK,CAACe,cAAc,EAAE;UACtB;QACF,KAAK,UAAU;UACbvB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,KAAK,CAAC,EAAET,KAAK,CAAC;UAC3EM,KAAK,CAACe,cAAc,EAAE;UACtB;QACF,KAAK,YAAY;UACfvB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,OAAO,CAAC,EAAET,KAAK,CAAC;UAC7EM,KAAK,CAACe,cAAc,EAAE;UACtB;QACF,KAAK,aAAa;UAChBvB,gBAAgB,CAACI,WAAW,CAACnB,aAAa,EAAE0B,eAAe,EAAE,QAAQ,CAAC,EAAET,KAAK,CAAC;UAC9EM,KAAK,CAACe,cAAc,EAAE;UACtB;MAAM;IAEZ,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"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["ref", "__animatedEnhanceInstanceId", "duration"];
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { useForkRef } from '../ref';
|
|
7
|
-
import useEnhancedEffect from '../use/useEnhancedEffect';
|
|
8
|
-
var uniqueId = 0;
|
|
9
|
-
function animatedSizeEnhance(_ref) {
|
|
10
|
-
var _ref$animateProps = _ref.animateProps,
|
|
11
|
-
animateProps = _ref$animateProps === void 0 ? [] : _ref$animateProps,
|
|
12
|
-
_ref$onChangeOf = _ref.onChangeOf,
|
|
13
|
-
onChangeOf = _ref$onChangeOf === void 0 ? [] : _ref$onChangeOf;
|
|
14
|
-
return function (props) {
|
|
15
|
-
var ref = props.ref,
|
|
16
|
-
__animatedEnhanceInstanceId = props.__animatedEnhanceInstanceId,
|
|
17
|
-
duration = props.duration,
|
|
18
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
19
|
-
var nodeRef = /*#__PURE__*/React.createRef();
|
|
20
|
-
var lastSizesRef = React.useRef([]);
|
|
21
|
-
var prevPropsRef = React.useRef(props);
|
|
22
|
-
var animatedSizeInstanceIdRef = React.useRef(uniqueId++);
|
|
23
|
-
prevPropsRef.current = props;
|
|
24
|
-
useEnhancedEffect(function () {
|
|
25
|
-
if (props.animationsDisabled) return;
|
|
26
|
-
if (__animatedEnhanceInstanceId !== undefined && __animatedEnhanceInstanceId !== animatedSizeInstanceIdRef.current) return;
|
|
27
|
-
if (!nodeRef.current) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
var node = nodeRef.current;
|
|
31
|
-
if (lastSizesRef.current.every(function (value) {
|
|
32
|
-
return value === undefined;
|
|
33
|
-
})) {
|
|
34
|
-
for (var i = 0; i < animateProps.length; i++) {
|
|
35
|
-
lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];
|
|
36
|
-
}
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
var sizes = [];
|
|
40
|
-
for (var _i = 0; _i < animateProps.length; _i++) {
|
|
41
|
-
sizes[_i] = node.getBoundingClientRect()[animateProps[_i]];
|
|
42
|
-
if (Math.abs(lastSizesRef.current[_i] - sizes[_i]) < 3 || node.style.getPropertyValue(animateProps[_i]).endsWith('%')) {
|
|
43
|
-
lastSizesRef.current[_i] = sizes[_i];
|
|
44
|
-
sizes[_i] = undefined;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (sizes.every(function (value) {
|
|
48
|
-
return value === undefined;
|
|
49
|
-
})) return;
|
|
50
|
-
node.style.transition = 'none';
|
|
51
|
-
for (var _i2 = 0; _i2 < animateProps.length; _i2++) {
|
|
52
|
-
node.style[animateProps[_i2]] = "".concat(lastSizesRef.current[_i2], "px");
|
|
53
|
-
}
|
|
54
|
-
var timeout = -1;
|
|
55
|
-
var handleTransitionEnd = function handleTransitionEnd() {
|
|
56
|
-
clearTimeout(timeout);
|
|
57
|
-
if (!node) return;
|
|
58
|
-
node.style.transition = null;
|
|
59
|
-
for (var _i3 = 0; _i3 < animateProps.length; _i3++) {
|
|
60
|
-
node.style[animateProps[_i3]] = null;
|
|
61
|
-
}
|
|
62
|
-
node.removeEventListener('transitionend', handleTransitionEnd);
|
|
63
|
-
node.removeEventListener('transitioncancel', handleTransitionEnd);
|
|
64
|
-
};
|
|
65
|
-
var animationFrame = requestAnimationFrame(function () {
|
|
66
|
-
if (!node) return;
|
|
67
|
-
node.addEventListener('transitionend', handleTransitionEnd);
|
|
68
|
-
node.addEventListener('transitioncancel', handleTransitionEnd);
|
|
69
|
-
node.style.transition = "".concat(duration, "ms all ease-in-out");
|
|
70
|
-
for (var _i4 = 0; _i4 < animateProps.length; _i4++) {
|
|
71
|
-
lastSizesRef.current[_i4] = sizes[_i4];
|
|
72
|
-
node.style[animateProps[_i4]] = "".concat(sizes[_i4], "px");
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
timeout = setTimeout(handleTransitionEnd, 500);
|
|
76
|
-
return function () {
|
|
77
|
-
cancelAnimationFrame(animationFrame);
|
|
78
|
-
handleTransitionEnd();
|
|
79
|
-
};
|
|
80
|
-
}, [__animatedEnhanceInstanceId, props.animationsDisabled, duration].concat(_toConsumableArray(onChangeOf.map(function (propName) {
|
|
81
|
-
return props[propName];
|
|
82
|
-
}))));
|
|
83
|
-
return _objectSpread({
|
|
84
|
-
ref: useForkRef(ref, nodeRef),
|
|
85
|
-
__animatedEnhanceInstanceId: __animatedEnhanceInstanceId !== null && __animatedEnhanceInstanceId !== void 0 ? __animatedEnhanceInstanceId : animatedSizeInstanceIdRef.current
|
|
86
|
-
}, other);
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
export default animatedSizeEnhance;
|
|
90
|
-
//# sourceMappingURL=animatedSizeEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"animatedSizeEnhance.js","names":["React","useForkRef","useEnhancedEffect","uniqueId","animatedSizeEnhance","_ref","_ref$animateProps","animateProps","_ref$onChangeOf","onChangeOf","props","ref","__animatedEnhanceInstanceId","duration","other","_objectWithoutProperties","_excluded","nodeRef","createRef","lastSizesRef","useRef","prevPropsRef","animatedSizeInstanceIdRef","current","animationsDisabled","undefined","node","every","value","i","length","getBoundingClientRect","sizes","Math","abs","style","getPropertyValue","endsWith","transition","concat","timeout","handleTransitionEnd","clearTimeout","removeEventListener","animationFrame","requestAnimationFrame","addEventListener","setTimeout","cancelAnimationFrame","_toConsumableArray","map","propName","_objectSpread"],"sources":["../../../../src/utils/enhances/animatedSizeEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithAnimatedSizeEnhanceProps\n extends WithAnimatedSizeEnhanceProps,\n UnknownProperties {}\nexport type WithAnimatedSizeEnhanceProps = {\n animationsDisabled?: boolean;\n};\n\nlet uniqueId = 0;\n\nfunction animatedSizeEnhance({\n animateProps = [],\n onChangeOf = [],\n}: {\n animateProps: ('width' | 'height')[];\n onChangeOf: string[];\n}) {\n return (props: any) => {\n const { ref, __animatedEnhanceInstanceId, duration, ...other } = props;\n const nodeRef = React.createRef<HTMLElement>();\n const lastSizesRef = React.useRef<(number | undefined)[]>([]);\n const prevPropsRef = React.useRef(props);\n const animatedSizeInstanceIdRef = React.useRef(uniqueId++);\n\n prevPropsRef.current = props;\n\n useEnhancedEffect(() => {\n if (props.animationsDisabled) return;\n if (\n __animatedEnhanceInstanceId !== undefined &&\n __animatedEnhanceInstanceId !== animatedSizeInstanceIdRef.current\n )\n return;\n if (!nodeRef.current) {\n return;\n }\n const node = nodeRef.current;\n if (lastSizesRef.current.every((value) => value === undefined)) {\n for (let i = 0; i < animateProps.length; i++) {\n lastSizesRef.current[i] = node.getBoundingClientRect()[animateProps[i]];\n }\n return;\n }\n\n const sizes: (number | undefined)[] = [];\n for (let i = 0; i < animateProps.length; i++) {\n sizes[i] = node.getBoundingClientRect()[animateProps[i]];\n if (\n Math.abs(lastSizesRef.current[i]! - sizes[i]!) < 3 ||\n node.style.getPropertyValue(animateProps[i]).endsWith('%')\n ) {\n lastSizesRef.current[i] = sizes[i];\n sizes[i] = undefined;\n }\n }\n if (sizes.every((value) => value === undefined)) return;\n\n node.style.transition = 'none';\n for (let i = 0; i < animateProps.length; i++) {\n node.style[animateProps[i]] = `${lastSizesRef.current[i]}px`;\n }\n let timeout = -1;\n const handleTransitionEnd = () => {\n clearTimeout(timeout);\n if (!node) return;\n node.style.transition = null as any;\n for (let i = 0; i < animateProps.length; i++) {\n node.style[animateProps[i]] = null as any;\n }\n node.removeEventListener('transitionend', handleTransitionEnd);\n node.removeEventListener('transitioncancel', handleTransitionEnd);\n };\n const animationFrame = requestAnimationFrame(() => {\n if (!node) return;\n node.addEventListener('transitionend', handleTransitionEnd);\n node.addEventListener('transitioncancel', handleTransitionEnd);\n node.style.transition = `${duration}ms all ease-in-out`;\n for (let i = 0; i < animateProps.length; i++) {\n lastSizesRef.current[i] = sizes[i];\n node.style[animateProps[i]] = `${sizes[i]}px`;\n }\n });\n timeout = setTimeout(handleTransitionEnd, 500) as any;\n return () => {\n cancelAnimationFrame(animationFrame);\n handleTransitionEnd();\n };\n }, [\n __animatedEnhanceInstanceId,\n props.animationsDisabled,\n duration,\n ...onChangeOf.map((propName) => props[propName]),\n ]);\n\n return {\n ref: useForkRef(ref, nodeRef),\n __animatedEnhanceInstanceId: __animatedEnhanceInstanceId ?? animatedSizeInstanceIdRef.current,\n ...other,\n };\n };\n}\n\nexport default animatedSizeEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,QAAQ;AACnC,OAAOC,iBAAiB,MAAM,0BAA0B;AAWxD,IAAIC,QAAQ,GAAG,CAAC;AAEhB,SAASC,mBAAmBA,CAAAC,IAAA,EAMzB;EAAA,IAAAC,iBAAA,GAAAD,IAAA,CALDE,YAAY;IAAZA,YAAY,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;IAAAE,eAAA,GAAAH,IAAA,CACjBI,UAAU;IAAVA,UAAU,GAAAD,eAAA,cAAG,EAAE,GAAAA,eAAA;EAKf,OAAO,UAACE,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAsDD,KAAK,CAA9DC,GAAG;MAAEC,2BAA2B,GAAyBF,KAAK,CAAzDE,2BAA2B;MAAEC,QAAQ,GAAeH,KAAK,CAA5BG,QAAQ;MAAKC,KAAK,GAAAC,wBAAA,CAAKL,KAAK,EAAAM,SAAA;IACtE,IAAMC,OAAO,gBAAGjB,KAAK,CAACkB,SAAS,EAAe;IAC9C,IAAMC,YAAY,GAAGnB,KAAK,CAACoB,MAAM,CAAyB,EAAE,CAAC;IAC7D,IAAMC,YAAY,GAAGrB,KAAK,CAACoB,MAAM,CAACV,KAAK,CAAC;IACxC,IAAMY,yBAAyB,GAAGtB,KAAK,CAACoB,MAAM,CAACjB,QAAQ,EAAE,CAAC;IAE1DkB,YAAY,CAACE,OAAO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,EAAEA,GAAC,GAAGtB,YAAY,CAACuB,MAAM,EAAED,GAAC,EAAE,EAAE;UAC5CV,YAAY,CAACI,OAAO,CAACM,GAAC,CAAC,GAAGG,KAAK,CAACH,GAAC,CAAC;UAClCH,IAAI,CAACS,KAAK,CAAC5B,YAAY,CAACsB,GAAC,CAAC,CAAC,MAAAU,MAAA,CAAMP,KAAK,CAACH,GAAC,CAAC,OAAI;QAC/C;MACF,CAAC,CAAC;MACFW,OAAO,GAAGO,UAAU,CAACN,mBAAmB,EAAE,GAAG,CAAQ;MACrD,OAAO,YAAM;QACXO,oBAAoB,CAACJ,cAAc,CAAC;QACpCH,mBAAmB,EAAE;MACvB,CAAC;IACH,CAAC,GACC7B,2BAA2B,EAC3BF,KAAK,CAACc,kBAAkB,EACxBX,QAAQ,EAAA0B,MAAA,CAAAU,kBAAA,CACLxC,UAAU,CAACyC,GAAG,CAAC,UAACC,QAAQ;MAAA,OAAKzC,KAAK,CAACyC,QAAQ,CAAC;IAAA,EAAC,GAChD;IAEF,OAAAC,aAAA;MACEzC,GAAG,EAAEV,UAAU,CAACU,GAAG,EAAEM,OAAO,CAAC;MAC7BL,2BAA2B,EAAEA,2BAA2B,aAA3BA,2BAA2B,cAA3BA,2BAA2B,GAAIU,yBAAyB,CAACC;IAAO,GAC1FT,KAAK;EAEZ,CAAC;AACH;AAEA,eAAeV,mBAAmB"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["autoFocus", "ref"];
|
|
4
|
-
import React from 'react';
|
|
5
|
-
import { useForkRef } from '../ref';
|
|
6
|
-
function notUsingNativeAutoFocus(autoFocus) {
|
|
7
|
-
return typeof autoFocus === 'boolean' || typeof autoFocus === 'number';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/** @deprecated */
|
|
11
|
-
|
|
12
|
-
function autoFocusEnhance() {
|
|
13
|
-
return function (props) {
|
|
14
|
-
var autoFocus = props.autoFocus,
|
|
15
|
-
ref = props.ref,
|
|
16
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
17
|
-
if (!notUsingNativeAutoFocus(autoFocus)) {
|
|
18
|
-
return props;
|
|
19
|
-
}
|
|
20
|
-
var nodeRef = /*#__PURE__*/React.createRef();
|
|
21
|
-
React.useEffect(function () {
|
|
22
|
-
if (autoFocus === false) return;
|
|
23
|
-
var inputNode = nodeRef.current;
|
|
24
|
-
if (!inputNode || !inputNode.focus) return;
|
|
25
|
-
var timer = setTimeout(function () {
|
|
26
|
-
return inputNode === null || inputNode === void 0 ? void 0 : inputNode.focus();
|
|
27
|
-
}, autoFocus || 0);
|
|
28
|
-
return function () {
|
|
29
|
-
clearTimeout(timer);
|
|
30
|
-
};
|
|
31
|
-
}, [autoFocus]);
|
|
32
|
-
return _objectSpread({
|
|
33
|
-
ref: useForkRef(ref, nodeRef)
|
|
34
|
-
}, other);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export default autoFocusEnhance;
|
|
38
|
-
//# sourceMappingURL=autoFocusEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"autoFocusEnhance.js","names":["React","useForkRef","notUsingNativeAutoFocus","autoFocus","autoFocusEnhance","props","ref","other","_objectWithoutProperties","_excluded","nodeRef","createRef","useEffect","inputNode","current","focus","timer","setTimeout","clearTimeout","_objectSpread"],"sources":["../../../../src/utils/enhances/autoFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useForkRef } from '../ref';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\nfunction notUsingNativeAutoFocus(autoFocus: any) {\n return typeof autoFocus === 'boolean' || typeof autoFocus === 'number';\n}\n\n/** @deprecated */\nexport interface IWithAutoFocusEnhanceProps extends WithAutoFocusEnhanceProps, UnknownProperties {}\nexport type WithAutoFocusEnhanceProps = {\n /** Native autofocus, but with support for working inside modals, you can also transmit the number of ms before focus is triggered */\n autoFocus?: boolean | number;\n};\n\nfunction autoFocusEnhance() {\n return (props: any) => {\n const { autoFocus, ref, ...other } = props;\n if (!notUsingNativeAutoFocus(autoFocus)) {\n return props;\n }\n const nodeRef = React.createRef<HTMLElement>();\n React.useEffect(() => {\n if (autoFocus === false) return;\n const { current: inputNode } = nodeRef;\n if (!inputNode || !inputNode.focus) return;\n const timer = setTimeout(() => inputNode?.focus(), (autoFocus as number) || 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n return {\n ref: useForkRef(ref, nodeRef),\n ...other,\n };\n };\n}\n\nexport default autoFocusEnhance;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,QAAQ,QAAQ;AAGnC,SAASC,uBAAuBA,CAACC,SAAc,EAAE;EAC/C,OAAO,OAAOA,SAAS,KAAK,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ;AACxE;;AAEA;;AAOA,SAASC,gBAAgBA,CAAA,EAAG;EAC1B,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQF,SAAS,GAAoBE,KAAK,CAAlCF,SAAS;MAAEG,GAAG,GAAeD,KAAK,CAAvBC,GAAG;MAAKC,KAAK,GAAAC,wBAAA,CAAKH,KAAK,EAAAI,SAAA;IAC1C,IAAI,CAACP,uBAAuB,CAACC,SAAS,CAAC,EAAE;MACvC,OAAOE,KAAK;IACd;IACA,IAAMK,OAAO,gBAAGV,KAAK,CAACW,SAAS,EAAe;IAC9CX,KAAK,CAACY,SAAS,CAAC,YAAM;MACpB,IAAIT,SAAS,KAAK,KAAK,EAAE;MACzB,IAAiBU,SAAS,GAAKH,OAAO,CAA9BI,OAAO;MACf,IAAI,CAACD,SAAS,IAAI,CAACA,SAAS,CAACE,KAAK,EAAE;MACpC,IAAMC,KAAK,GAAGC,UAAU,CAAC;QAAA,OAAMJ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEE,KAAK,EAAE;MAAA,GAAGZ,SAAS,IAAe,CAAC,CAAC;MAC9E,OAAO,YAAM;QACXe,YAAY,CAACF,KAAK,CAAC;MACrB,CAAC;IACH,CAAC,EAAE,CAACb,SAAS,CAAC,CAAC;IACf,OAAAgB,aAAA;MACEb,GAAG,EAAEL,UAAU,CAACK,GAAG,EAAEI,OAAO;IAAC,GAC1BH,KAAK;EAEZ,CAAC;AACH;AAEA,eAAeH,gBAAgB"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
3
|
-
import _objectDestructuringEmpty from "@babel/runtime/helpers/objectDestructuringEmpty";
|
|
4
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
5
|
-
import React from 'react';
|
|
6
|
-
function contextEnhance(context, setOnProp) {
|
|
7
|
-
return function (props) {
|
|
8
|
-
var other = _extends({}, (_objectDestructuringEmpty(props), props));
|
|
9
|
-
var value = React.useContext(context);
|
|
10
|
-
return _objectSpread(_objectSpread({}, other), {}, _defineProperty({}, setOnProp, value));
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export default contextEnhance;
|
|
14
|
-
//# sourceMappingURL=contextEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contextEnhance.js","names":["React","contextEnhance","context","setOnProp","props","other","_extends","_objectDestructuringEmpty","value","useContext","_objectSpread","_defineProperty"],"sources":["../../../../src/utils/enhances/contextEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nfunction contextEnhance(context: React.Context<any>, setOnProp: string) {\n return (props: any) => {\n const { ...other } = props;\n const value = React.useContext(context);\n return {\n ...other,\n [setOnProp]: value,\n };\n };\n}\n\nexport default contextEnhance;\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,cAAcA,CAACC,OAA2B,EAAEC,SAAiB,EAAE;EACtE,OAAO,UAACC,KAAU,EAAK;IACrB,IAAWC,KAAK,GAAAC,QAAA,MAAAC,yBAAA,CAAKH,KAAK,GAALA,KAAK;IAC1B,IAAMI,KAAK,GAAGR,KAAK,CAACS,UAAU,CAACP,OAAO,CAAC;IACvC,OAAAQ,aAAA,CAAAA,aAAA,KACKL,KAAK,OAAAM,eAAA,KACPR,SAAS,EAAGK,KAAK;EAEtB,CAAC;AACH;AAEA,eAAeP,cAAc"}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _typeof from "@babel/runtime/helpers/typeof";
|
|
3
|
-
import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
|
|
4
|
-
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
5
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
6
|
-
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { useI18n } from './WithI18n';
|
|
9
|
-
export var useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
|
|
10
|
-
var _store$locale;
|
|
11
|
-
var container = React.useMemo(function () {
|
|
12
|
-
if (!fallbackContainer) return primaryContainer;
|
|
13
|
-
if (!primaryContainer) return fallbackContainer;
|
|
14
|
-
if (primaryContainer === fallbackContainer) return primaryContainer;
|
|
15
|
-
var container = {};
|
|
16
|
-
var _loop = function _loop(_locale) {
|
|
17
|
-
if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
|
|
18
|
-
container[_locale] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
19
|
-
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
|
20
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
-
while (1) switch (_context.prev = _context.next) {
|
|
22
|
-
case 0:
|
|
23
|
-
_context.next = 2;
|
|
24
|
-
return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
|
|
25
|
-
case 2:
|
|
26
|
-
_yield$Promise$all = _context.sent;
|
|
27
|
-
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
28
|
-
primary = _yield$Promise$all2[0];
|
|
29
|
-
fallback = _yield$Promise$all2[1];
|
|
30
|
-
return _context.abrupt("return", _objectSpread(_objectSpread({}, primary), fallback));
|
|
31
|
-
case 7:
|
|
32
|
-
case "end":
|
|
33
|
-
return _context.stop();
|
|
34
|
-
}
|
|
35
|
-
}, _callee);
|
|
36
|
-
}));
|
|
37
|
-
} else {
|
|
38
|
-
var _primaryContainer$_lo, _fallbackContainer$_l;
|
|
39
|
-
container[_locale] = _objectSpread(_objectSpread({}, (_primaryContainer$_lo = primaryContainer[_locale]) !== null && _primaryContainer$_lo !== void 0 ? _primaryContainer$_lo : {}), (_fallbackContainer$_l = fallbackContainer[_locale]) !== null && _fallbackContainer$_l !== void 0 ? _fallbackContainer$_l : {});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
for (var _locale in primaryContainer) {
|
|
43
|
-
_loop(_locale);
|
|
44
|
-
}
|
|
45
|
-
return container;
|
|
46
|
-
}, [primaryContainer, fallbackContainer]);
|
|
47
|
-
var initStore = React.useMemo(function () {
|
|
48
|
-
var store = {};
|
|
49
|
-
for (var _locale2 in container) {
|
|
50
|
-
if (_typeof(container[_locale2]) === 'object') {
|
|
51
|
-
store[_locale2] = container[_locale2];
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return store;
|
|
55
|
-
}, [container]);
|
|
56
|
-
var _React$useState = React.useState(initStore),
|
|
57
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
58
|
-
store = _React$useState2[0],
|
|
59
|
-
setStore = _React$useState2[1];
|
|
60
|
-
var lastLoadedLocaleRef = React.useRef(null);
|
|
61
|
-
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
|
62
|
-
var fallbackMessages = React.useMemo(function () {
|
|
63
|
-
return Object.values(store)[0];
|
|
64
|
-
}, [store]);
|
|
65
|
-
var loadingLocaleRef = React.useRef(null);
|
|
66
|
-
React.useEffect(function () {
|
|
67
|
-
loadingLocaleRef.current = locale;
|
|
68
|
-
var asyncMessages = container[locale];
|
|
69
|
-
if (typeof asyncMessages === 'function') {
|
|
70
|
-
asyncMessages().then(function (module) {
|
|
71
|
-
if (loadingLocaleRef.current !== locale) return;
|
|
72
|
-
var messages = module;
|
|
73
|
-
if ('default' in module && _typeof(module["default"]) === 'object') messages = module["default"];
|
|
74
|
-
setStore(function (store) {
|
|
75
|
-
return _objectSpread(_objectSpread({}, store), {}, _defineProperty({}, locale, messages));
|
|
76
|
-
});
|
|
77
|
-
})["catch"](console.error);
|
|
78
|
-
}
|
|
79
|
-
}, [container, locale]);
|
|
80
|
-
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
|
81
|
-
};
|
|
82
|
-
export default (function (container) {
|
|
83
|
-
return function (props) {
|
|
84
|
-
var i18n = props.i18n,
|
|
85
|
-
locale = props.locale;
|
|
86
|
-
var getI18nText = useI18n(i18n, locale, container);
|
|
87
|
-
return _objectSpread(_objectSpread({}, props), {}, {
|
|
88
|
-
getI18nText: getI18nText
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
});
|
|
92
|
-
//# sourceMappingURL=i18nEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18nEnhance.js","names":["React","useI18n","useAsyncI18nMessages","primaryContainer","locale","fallbackContainer","_store$locale","container","useMemo","_loop","_locale","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_yield$Promise$all","_yield$Promise$all2","primary","fallback","wrap","_callee$","_context","prev","next","Promise","all","sent","_slicedToArray","abrupt","_objectSpread","stop","_primaryContainer$_lo","_fallbackContainer$_l","initStore","store","_typeof","_React$useState","useState","_React$useState2","setStore","lastLoadedLocaleRef","useRef","current","fallbackMessages","Object","values","loadingLocaleRef","useEffect","asyncMessages","then","module","messages","_defineProperty","console","error","props","i18n","getI18nText"],"sources":["../../../../src/utils/enhances/i18nEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { LocaleKeys, useI18n } from './WithI18n';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\n\n/** @deprecated */\nexport interface IWithI18nEnhanceProps extends WithI18nEnhanceProps, UnknownProperties {}\nexport type WithI18nEnhanceProps = {\n /* Function for getting the required field from the translation dictionary */\n getI18nText?: (key?: string, variables?: {}) => any;\n /* Object with translations */\n i18n?: {\n [locale: string]: {\n [key: string]: string;\n };\n };\n /* Locale for translations */\n locale?: LocaleKeys;\n};\n\ntype Messages = { [messageId: string]: string };\ntype MessagesContainer = { [locale: string]: Messages | (() => Promise<Messages>) };\ntype MessagesStore = { [locale: string]: Messages };\nexport const useAsyncI18nMessages = (\n primaryContainer: MessagesContainer,\n locale: string,\n fallbackContainer?: MessagesContainer,\n) => {\n const container = React.useMemo(() => {\n if (!fallbackContainer) return primaryContainer;\n if (!primaryContainer) return fallbackContainer;\n if (primaryContainer === fallbackContainer) return primaryContainer;\n const container: MessagesContainer = {};\n for (const locale in primaryContainer) {\n if (\n typeof primaryContainer[locale] === 'function' ||\n typeof fallbackContainer[locale] === 'function'\n ) {\n container[locale] = async () => {\n const [primary, fallback] = await Promise.all([\n primaryContainer[locale],\n fallbackContainer[locale],\n ]);\n return { ...primary, ...fallback };\n };\n } else {\n container[locale] = {\n ...(primaryContainer[locale] ?? {}),\n ...(fallbackContainer[locale] ?? {}),\n };\n }\n }\n return container;\n }, [primaryContainer, fallbackContainer]);\n const initStore = React.useMemo(() => {\n const store: MessagesStore = {};\n for (const locale in container) {\n if (typeof container[locale] === 'object') {\n store[locale] = container[locale] as Messages;\n }\n }\n return store;\n }, [container]);\n const [store, setStore] = React.useState(initStore);\n const lastLoadedLocaleRef = React.useRef<string | null>(null);\n if (store[locale]) lastLoadedLocaleRef.current = locale;\n const fallbackMessages = React.useMemo(() => Object.values(store)[0], [store]);\n\n const loadingLocaleRef = React.useRef<string | null>(null);\n React.useEffect(() => {\n loadingLocaleRef.current = locale;\n const asyncMessages = container[locale];\n if (typeof asyncMessages === 'function') {\n asyncMessages()\n .then((module) => {\n if (loadingLocaleRef.current !== locale) return;\n let messages = module;\n if ('default' in module && typeof module.default === 'object') messages = module.default;\n setStore((store) => ({\n ...store,\n [locale]: messages,\n }));\n })\n\n .catch(console.error);\n }\n }, [container, locale]);\n\n return store[locale] ?? fallbackMessages;\n};\nexport default (container?: MessagesContainer) => {\n return (props: any): { getI18nText: ReturnType<typeof useI18n> } => {\n const { i18n, locale } = props;\n const getI18nText = useI18n(i18n, locale, container);\n\n return { ...props, getI18nText };\n };\n};\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAAqBC,OAAO,QAAQ,YAAY;AAqBhD,OAAO,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAC/BC,gBAAmC,EACnCC,MAAc,EACdC,iBAAqC,EAClC;EAAA,IAAAC,aAAA;EACH,IAAMC,SAAS,GAAGP,KAAK,CAACQ,OAAO,CAAC,YAAM;IACpC,IAAI,CAACH,iBAAiB,EAAE,OAAOF,gBAAgB;IAC/C,IAAI,CAACA,gBAAgB,EAAE,OAAOE,iBAAiB;IAC/C,IAAIF,gBAAgB,KAAKE,iBAAiB,EAAE,OAAOF,gBAAgB;IACnE,IAAMI,SAA4B,GAAG,CAAC,CAAC;IAAC,IAAAE,KAAA,YAAAA,MAAAC,OAAA,EACD;MACrC,IACE,OAAOP,gBAAgB,CAACC,OAAM,CAAC,KAAK,UAAU,IAC9C,OAAOC,iBAAiB,CAACD,OAAM,CAAC,KAAK,UAAU,EAC/C;QACAG,SAAS,CAACH,OAAM,CAAC,gBAAAO,iBAAA,eAAAC,mBAAA,GAAAC,IAAA,CAAG,SAAAC,QAAA;UAAA,IAAAC,kBAAA,EAAA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AAQ;QACxFX,QAAQ,CAAC,UAACL,KAAK;UAAA,OAAAL,aAAA,CAAAA,aAAA,KACVK,KAAK,OAAAkB,eAAA,KACPhD,MAAM,EAAG+C,QAAQ;QAAA,CAClB,CAAC;MACL,CAAC,CAAC,SAEI,CAACE,OAAO,CAACC,KAAK,CAAC;IACzB;EACF,CAAC,EAAE,CAAC/C,SAAS,EAAEH,MAAM,CAAC,CAAC;EAEvB,QAAAE,aAAA,GAAO4B,KAAK,CAAC9B,MAAM,CAAC,cAAAE,aAAA,cAAAA,aAAA,GAAIqC,gBAAgB;AAC1C,CAAC;AACD,gBAAe,UAACpC,SAA6B,EAAK;EAChD,OAAO,UAACgD,KAAU,EAAkD;IAClE,IAAQC,IAAI,GAAaD,KAAK,CAAtBC,IAAI;MAAEpD,MAAM,GAAKmD,KAAK,CAAhBnD,MAAM;IACpB,IAAMqD,WAAW,GAAGxD,OAAO,CAACuD,IAAI,EAAEpD,MAAM,EAAEG,SAAS,CAAC;IAEpD,OAAAsB,aAAA,CAAAA,aAAA,KAAY0B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import assignProps from '../assignProps';
|
|
4
|
-
import { lastInteraction } from '../../LastInteractionType';
|
|
5
|
-
|
|
6
|
-
/** @deprecated */
|
|
7
|
-
|
|
8
|
-
export var enforcedKeyboardFocusEnhanceContext = /*#__PURE__*/React.createContext(false);
|
|
9
|
-
var keyboardFocusEnhance = function keyboardFocusEnhance() {
|
|
10
|
-
var makeFocusable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
11
|
-
return function (props) {
|
|
12
|
-
var _props$tabIndex;
|
|
13
|
-
var autoFocus = props.autoFocus;
|
|
14
|
-
var disabled = props.disabled || props.loading;
|
|
15
|
-
var tabIndex = (_props$tabIndex = props.tabIndex) !== null && _props$tabIndex !== void 0 ? _props$tabIndex : makeFocusable ? 0 : undefined;
|
|
16
|
-
var _React$useState = React.useState(false),
|
|
17
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
18
|
-
keyboardFocused = _React$useState2[0],
|
|
19
|
-
setKeyboardFocused = _React$useState2[1];
|
|
20
|
-
var ref = React.useRef(null);
|
|
21
|
-
var handleFocus = React.useCallback(function (event) {
|
|
22
|
-
if (event.isTrusted === true) {
|
|
23
|
-
if (!lastInteraction.isKeyboard()) return;
|
|
24
|
-
}
|
|
25
|
-
setKeyboardFocused(true);
|
|
26
|
-
}, []);
|
|
27
|
-
var handlerBlur = React.useCallback(function () {
|
|
28
|
-
return setKeyboardFocused(false);
|
|
29
|
-
}, []);
|
|
30
|
-
React.useEffect(function () {
|
|
31
|
-
if (typeof autoFocus !== 'number' && !autoFocus) return;
|
|
32
|
-
var timer = setTimeout(function () {
|
|
33
|
-
var _ref$current;
|
|
34
|
-
(_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus();
|
|
35
|
-
setKeyboardFocused(true);
|
|
36
|
-
}, 0);
|
|
37
|
-
return function () {
|
|
38
|
-
clearTimeout(timer);
|
|
39
|
-
};
|
|
40
|
-
}, [autoFocus]);
|
|
41
|
-
React.useEffect(function () {
|
|
42
|
-
if (disabled) {
|
|
43
|
-
setKeyboardFocused(false);
|
|
44
|
-
}
|
|
45
|
-
}, [disabled]);
|
|
46
|
-
var enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);
|
|
47
|
-
return assignProps(props, {
|
|
48
|
-
tabIndex: disabled ? -1 : tabIndex,
|
|
49
|
-
keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,
|
|
50
|
-
onFocus: handleFocus,
|
|
51
|
-
onBlur: handlerBlur,
|
|
52
|
-
ref: ref
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export default keyboardFocusEnhance;
|
|
57
|
-
//# sourceMappingURL=keyboardFocusEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keyboardFocusEnhance.js","names":["React","assignProps","lastInteraction","enforcedKeyboardFocusEnhanceContext","createContext","keyboardFocusEnhance","makeFocusable","arguments","length","undefined","props","_props$tabIndex","autoFocus","disabled","loading","tabIndex","_React$useState","useState","_React$useState2","_slicedToArray","keyboardFocused","setKeyboardFocused","ref","useRef","handleFocus","useCallback","event","isTrusted","isKeyboard","handlerBlur","useEffect","timer","setTimeout","_ref$current","current","focus","clearTimeout","enforcedKeyboardFocus","useContext","onFocus","onBlur"],"sources":["../../../../src/utils/enhances/keyboardFocusEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport assignProps from '../assignProps';\nimport { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { lastInteraction } from '../../LastInteractionType';\n\n/** @deprecated */\nexport interface IKeyboardFocusProps extends KeyboardFocusProps, UnknownProperties {}\nexport type KeyboardFocusProps = {\n /* Property responsible for displaying \"keyboard\" focus */\n keyboardFocused?: boolean;\n /**\n * Makes component to catch browser focus on component mount\n * @default false\n */\n autoFocus?: boolean;\n};\n\nexport const enforcedKeyboardFocusEnhanceContext = React.createContext(false);\n\nexport type KeyboardFocusEnhanceHook = (props: {\n tabIndex?: number;\n disabled?: boolean;\n loading?: boolean;\n autoFocus?: boolean;\n}) => {\n tabIndex: number;\n keyboardFocused: boolean;\n onFocus: (e: React.FocusEvent) => void;\n onBlur: () => void;\n};\n\nconst keyboardFocusEnhance = (makeFocusable = true): KeyboardFocusEnhanceHook => {\n return (props) => {\n const { autoFocus } = props;\n const disabled = props.disabled || props.loading;\n const tabIndex = props.tabIndex ?? (makeFocusable ? 0 : undefined);\n const [keyboardFocused, setKeyboardFocused] = React.useState(false);\n const ref = React.useRef<HTMLElement>(null);\n\n const handleFocus = React.useCallback((event: React.FocusEvent) => {\n if (event.isTrusted === true) {\n if (!lastInteraction.isKeyboard()) return;\n }\n setKeyboardFocused(true);\n }, []);\n const handlerBlur = React.useCallback(() => setKeyboardFocused(false), []);\n React.useEffect(() => {\n if (typeof autoFocus !== 'number' && !autoFocus) return;\n const timer = setTimeout(() => {\n ref.current?.focus();\n setKeyboardFocused(true);\n }, 0);\n return () => {\n clearTimeout(timer);\n };\n }, [autoFocus]);\n React.useEffect(() => {\n if (disabled) {\n setKeyboardFocused(false);\n }\n }, [disabled]);\n\n const enforcedKeyboardFocus = React.useContext(enforcedKeyboardFocusEnhanceContext);\n\n return assignProps(props, {\n tabIndex: disabled ? -1 : tabIndex,\n keyboardFocused: (keyboardFocused || enforcedKeyboardFocus) && !disabled,\n onFocus: handleFocus,\n onBlur: handlerBlur,\n ref,\n });\n };\n};\n\nexport default keyboardFocusEnhance;\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,WAAW,MAAM,gBAAgB;AAExC,SAASC,eAAe,QAAQ,2BAA2B;;AAE3D;;AAYA,OAAO,IAAMC,mCAAmC,gBAAGH,KAAK,CAACI,aAAa,CAAC,KAAK,CAAC;AAc7E,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAA,EAAuD;EAAA,IAAnDC,aAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EAChD,OAAO,UAACG,KAAK,EAAK;IAAA,IAAAC,eAAA;IAChB,IAAQC,SAAS,GAAKF,KAAK,CAAnBE,SAAS;IACjB,IAAMC,QAAQ,GAAGH,KAAK,CAACG,QAAQ,IAAIH,KAAK,CAACI,OAAO;IAChD,IAAMC,QAAQ,IAAAJ,eAAA,GAAGD,KAAK,CAACK,QAAQ,cAAAJ,eAAA,cAAAA,eAAA,GAAKL,aAAa,GAAG,CAAC,GAAGG,SAAU;IAClE,IAAAO,eAAA,GAA8ChB,KAAK,CAACiB,QAAQ,CAAC,KAAK,CAAC;MAAAC,gBAAA,GAAAC,cAAA,CAAAH,eAA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GE,QAAQ;MAClCK,eAAe,EAAE,CAACA,eAAe,IAAIiB,qBAAqB,KAAK,CAACxB,QAAQ;MACxE0B,OAAO,EAAEf,WAAW;MACpBgB,MAAM,EAAEX,WAAW;MACnBP,GAAG,EAAHA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAejB,oBAAoB"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useColorResolver } from '../use/useColorResolver';
|
|
3
|
-
import { useForkRef } from '../ref';
|
|
4
|
-
import assignProps from '../assignProps';
|
|
5
|
-
var resolveColorEnhance = function resolveColorEnhance() {
|
|
6
|
-
return function (props) {
|
|
7
|
-
var ref = props.ref;
|
|
8
|
-
var internalRef = React.useRef();
|
|
9
|
-
var resolveColor = useColorResolver();
|
|
10
|
-
return assignProps(props, {
|
|
11
|
-
ref: useForkRef(ref, internalRef),
|
|
12
|
-
resolveColor: resolveColor
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export default resolveColorEnhance;
|
|
17
|
-
//# sourceMappingURL=resolveColorEnhance.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveColorEnhance.js","names":["React","useColorResolver","useForkRef","assignProps","resolveColorEnhance","props","ref","internalRef","useRef","resolveColor"],"sources":["../../../../src/utils/enhances/resolveColorEnhance.tsx"],"sourcesContent":["import React from 'react';\nimport { useColorResolver } from '../use/useColorResolver';\nimport { useForkRef } from '../ref';\nimport assignProps from '../assignProps';\n\nconst resolveColorEnhance = () => {\n return (props: any) => {\n const { ref } = props;\n const internalRef = React.useRef<HTMLElement>();\n const resolveColor = useColorResolver();\n\n return assignProps(props, {\n ref: useForkRef(ref, internalRef),\n resolveColor,\n });\n };\n};\n\nexport default resolveColorEnhance;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,UAAU,QAAQ,QAAQ;AACnC,OAAOC,WAAW,MAAM,gBAAgB;AAExC,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAA,EAAS;EAChC,OAAO,UAACC,KAAU,EAAK;IACrB,IAAQC,GAAG,GAAKD,KAAK,CAAbC,GAAG;IACX,IAAMC,WAAW,GAAGP,KAAK,CAACQ,MAAM,EAAe;IAC/C,IAAMC,YAAY,GAAGR,gBAAgB,EAAE;IAEvC,OAAOE,WAAW,CAACE,KAAK,EAAE;MACxBC,GAAG,EAAEJ,UAAU,CAACI,GAAG,EAAEC,WAAW,CAAC;MACjCE,YAAY,EAAZA;IACF,CAAC,CAAC;EACJ,CAAC;AACH,CAAC;AAED,eAAeL,mBAAmB"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var EventEmitter = /*#__PURE__*/_createClass(function EventEmitter() {
|
|
5
|
-
var _this = this;
|
|
6
|
-
_classCallCheck(this, EventEmitter);
|
|
7
|
-
_defineProperty(this, "events", {});
|
|
8
|
-
_defineProperty(this, "emit", void 0);
|
|
9
|
-
_defineProperty(this, "subscribe", void 0);
|
|
10
|
-
this.emit = function (eventName) {
|
|
11
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
12
|
-
args[_key - 1] = arguments[_key];
|
|
13
|
-
}
|
|
14
|
-
var event = _this.events[eventName];
|
|
15
|
-
if (event) {
|
|
16
|
-
event.forEach(function (fn) {
|
|
17
|
-
fn.call.apply(fn, [null].concat(args));
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
this.subscribe = function (eventName, fn) {
|
|
22
|
-
if (!_this.events[eventName]) {
|
|
23
|
-
_this.events[eventName] = [];
|
|
24
|
-
}
|
|
25
|
-
_this.events[eventName].push(fn);
|
|
26
|
-
return function () {
|
|
27
|
-
_this.events[eventName] = _this.events[eventName].filter(function (eventFn) {
|
|
28
|
-
return fn !== eventFn;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
export { EventEmitter as default };
|
|
34
|
-
//# sourceMappingURL=eventEmitter.js.map
|