@semcore/core 16.6.0 → 16.6.2-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/.cache/esbuild_plugin_semcore_resolver/src_LastInteractionType.ts_contents +47 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_LastInteractionType.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_LastInteractionType.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_LastInteractionType.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_Component.ts_contents +49 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_Component.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_Component.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_Component.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_symbols.ts_contents +9 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_symbols.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_symbols.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_core-types_symbols.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_coreFactory.tsx_contents +374 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_coreFactory.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_coreFactory.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_coreFactory.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Children.tsx_contents +110 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Children.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Children.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Children.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Root.tsx_contents +69 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Root.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Root.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_Root.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_dataName.tsx_contents +11 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_dataName.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_dataName.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_dataName.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_enhance.tsx_contents +14 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_enhance.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_enhance.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_enhance.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_functionDefaultProps.tsx_contents +28 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_functionDefaultProps.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_functionDefaultProps.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_functionDefaultProps.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_i18n.tsx_contents +19 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_i18n.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_i18n.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_i18n.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_inheritedName.tsx_contents +14 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_inheritedName.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_inheritedName.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_inheritedName.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_staticChildren.tsx_contents +122 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_staticChildren.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_staticChildren.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_staticChildren.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_style.tsx_contents +50 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_style.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_style.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_style.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_uncontrolledProps.tsx_contents +123 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_uncontrolledProps.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_uncontrolledProps.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_enhancement_uncontrolledProps.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_index.ts_contents +8 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_index.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_index.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_index.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_register.tsx_contents +27 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_register.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_register.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_register.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_index.tsx_contents +3 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_index.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_index.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_index.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_reshadow-core.ts_contents +236 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_reshadow-core.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_reshadow-core.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_reshadow-core.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_sstyled.tsx_contents +143 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_sstyled.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_sstyled.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_styled_sstyled.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_assignProps.ts_contents +83 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_assignProps.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_assignProps.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_assignProps.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_canUseDOM.ts_contents +3 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_canUseDOM.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_canUseDOM.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_canUseDOM.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_capitalizeFirstLetter.ts_contents +3 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_capitalizeFirstLetter.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_capitalizeFirstLetter.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_capitalizeFirstLetter.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_WithI18n.tsx_contents +26 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_WithI18n.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_WithI18n.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_WithI18n.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_i18nEnhance.tsx_contents +91 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_i18nEnhance.tsx_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_i18nEnhance.tsx_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_enhances_i18nEnhance.tsx_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_logger.ts_contents +30 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_logger.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_logger.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_logger.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_pick.ts_contents +12 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_pick.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_pick.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_pick.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_ref.ts_contents +70 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_ref.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_ref.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_ref.ts_last_use +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_use_useEnhancedEffect.ts_contents +4 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_use_useEnhancedEffect.ts_hash_sum +1 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_use_useEnhancedEffect.ts_imp_deps +0 -0
- package/.cache/esbuild_plugin_semcore_resolver/src_utils_use_useEnhancedEffect.ts_last_use +1 -0
- package/CHANGELOG.md +6 -0
- package/lib/core-types/Component.d.ts +79 -33
- package/lib/core-types/Component.js +46 -14
- package/lib/core-types/Component.js.map +1 -1
- package/lib/core-types/Component.mjs +7 -11
- package/lib/core-types/Component.mjs.map +1 -1
- package/lib/core-types/symbols.mjs +9 -9
- package/lib/coreFactory.d.ts +23 -6
- package/lib/coreFactory.js +22 -53
- package/lib/coreFactory.js.map +1 -1
- package/lib/coreFactory.mjs +35 -54
- package/lib/coreFactory.mjs.map +1 -1
- package/lib/enhancement/Children.mjs +1 -1
- package/lib/enhancement/bindHandler.d.ts +5 -0
- package/lib/enhancement/bindHandler.js +53 -0
- package/lib/enhancement/bindHandler.js.map +1 -0
- package/lib/enhancement/bindHandler.mjs +48 -0
- package/lib/enhancement/bindHandler.mjs.map +1 -0
- package/lib/enhancement/hoistProps.d.ts +10 -0
- package/lib/enhancement/hoistProps.js +95 -0
- package/lib/enhancement/hoistProps.js.map +1 -0
- package/lib/enhancement/hoistProps.mjs +78 -0
- package/lib/enhancement/hoistProps.mjs.map +1 -0
- package/lib/enhancement/staticChildren.mjs +3 -3
- package/lib/enhancement/style.mjs +2 -2
- package/lib/esm/core-types/Component.mjs +7 -11
- package/lib/esm/core-types/symbols.mjs +9 -9
- package/lib/esm/coreFactory.mjs +35 -54
- package/lib/esm/enhancement/Children.mjs +1 -1
- package/lib/esm/enhancement/bindHandler.mjs +48 -0
- package/lib/esm/enhancement/hoistProps.mjs +78 -0
- package/lib/esm/enhancement/staticChildren.mjs +3 -3
- package/lib/esm/enhancement/style.mjs +2 -2
- package/lib/esm/styled/sstyled.mjs +1 -1
- package/lib/esm/utils/createHoc.mjs +42 -0
- package/lib/esm/utils/enhances/WithI18n.mjs +46 -1
- package/lib/esm/utils/getDisplayName.mjs +6 -0
- package/lib/esm/utils/ref.mjs +14 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.js.map +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/styled/index.d.ts +5 -1
- package/lib/styled/index.js.map +1 -1
- package/lib/styled/index.mjs.map +1 -1
- package/lib/styled/sstyled.mjs +1 -1
- package/lib/utils/ScreenReaderOnly.d.ts +8 -0
- package/lib/utils/ScreenReaderOnly.js +30 -0
- package/lib/utils/ScreenReaderOnly.js.map +1 -0
- package/lib/utils/ScreenReaderOnly.mjs +24 -0
- package/lib/utils/ScreenReaderOnly.mjs.map +1 -0
- package/lib/utils/createHoc.d.ts +3 -0
- package/lib/utils/createHoc.js +52 -0
- package/lib/utils/createHoc.js.map +1 -0
- package/lib/utils/createHoc.mjs +42 -0
- package/lib/utils/createHoc.mjs.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.d.ts +14 -0
- package/lib/utils/enhances/WithAutoFocus.js +72 -0
- package/lib/utils/enhances/WithAutoFocus.js.map +1 -0
- package/lib/utils/enhances/WithAutoFocus.mjs +66 -0
- package/lib/utils/enhances/WithAutoFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithCSS.d.ts +30 -2
- package/lib/utils/enhances/WithCSS.js +57 -4
- package/lib/utils/enhances/WithCSS.js.map +1 -1
- package/lib/utils/enhances/WithCSS.mjs +53 -2
- package/lib/utils/enhances/WithCSS.mjs.map +1 -1
- package/lib/utils/enhances/WithI18n.d.ts +30 -1
- package/lib/utils/enhances/WithI18n.js +57 -1
- package/lib/utils/enhances/WithI18n.js.map +1 -1
- package/lib/utils/enhances/WithI18n.mjs +46 -1
- package/lib/utils/enhances/WithI18n.mjs.map +1 -1
- package/lib/utils/enhances/WithKeyboardFocus.d.ts +46 -0
- package/lib/utils/enhances/WithKeyboardFocus.js +94 -0
- package/lib/utils/enhances/WithKeyboardFocus.js.map +1 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs +88 -0
- package/lib/utils/enhances/WithKeyboardFocus.mjs.map +1 -0
- package/lib/utils/enhances/WithRef.d.ts +3 -0
- package/lib/utils/enhances/WithRef.js +25 -0
- package/lib/utils/enhances/WithRef.js.map +1 -0
- package/lib/utils/enhances/WithRef.mjs +18 -0
- package/lib/utils/enhances/WithRef.mjs.map +1 -0
- package/lib/utils/enhances/animatedSizeEnhance.d.ts +4 -0
- package/lib/utils/enhances/animatedSizeEnhance.js +2 -0
- package/lib/utils/enhances/animatedSizeEnhance.js.map +1 -1
- package/lib/utils/enhances/animatedSizeEnhance.mjs +3 -0
- package/lib/utils/enhances/animatedSizeEnhance.mjs.map +1 -1
- package/lib/utils/enhances/autoFocusEnhance.d.ts +10 -0
- package/lib/utils/enhances/autoFocusEnhance.js +45 -0
- package/lib/utils/enhances/autoFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs +38 -0
- package/lib/utils/enhances/autoFocusEnhance.mjs.map +1 -0
- package/lib/utils/enhances/i18nEnhance.d.ts +4 -0
- package/lib/utils/enhances/i18nEnhance.js +2 -0
- package/lib/utils/enhances/i18nEnhance.js.map +1 -1
- package/lib/utils/enhances/i18nEnhance.mjs.map +1 -1
- package/lib/utils/enhances/keyboardFocusEnhance.d.ts +27 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js +63 -0
- package/lib/utils/enhances/keyboardFocusEnhance.js.map +1 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs +57 -0
- package/lib/utils/enhances/keyboardFocusEnhance.mjs.map +1 -0
- package/lib/utils/eventEmitter.d.ts +6 -10
- package/lib/utils/eventEmitter.js +27 -55
- package/lib/utils/eventEmitter.js.map +1 -1
- package/lib/utils/eventEmitter.mjs +27 -55
- package/lib/utils/eventEmitter.mjs.map +1 -1
- package/lib/utils/getDisplayName.mjs +5 -3
- package/lib/utils/if.d.ts +11 -0
- package/lib/utils/if.js +15 -0
- package/lib/utils/if.js.map +1 -0
- package/lib/utils/if.mjs +9 -0
- package/lib/utils/if.mjs.map +1 -0
- package/lib/utils/injectStyle.js +1 -1
- package/lib/utils/injectStyle.mjs +1 -1
- package/lib/utils/ref.d.ts +3 -1
- package/lib/utils/ref.js +14 -0
- package/lib/utils/ref.js.map +1 -1
- package/lib/utils/ref.mjs +14 -0
- package/lib/utils/ref.mjs.map +1 -1
- package/lib/utils/uniqueID.d.ts +4 -0
- package/lib/utils/uniqueID.js +3 -1
- package/lib/utils/uniqueID.js.map +1 -1
- package/lib/utils/uniqueID.mjs +4 -1
- package/lib/utils/uniqueID.mjs.map +1 -1
- package/lib/utils/use/useColorResolver.js +4 -2
- package/lib/utils/use/useColorResolver.js.map +1 -1
- package/lib/utils/use/useColorResolver.mjs +4 -2
- package/lib/utils/use/useColorResolver.mjs.map +1 -1
- package/lib/utils/use/useCss.d.ts +4 -0
- package/lib/utils/use/useCss.js +19 -0
- package/lib/utils/use/useCss.js.map +1 -0
- package/lib/utils/use/useCss.mjs +12 -0
- package/lib/utils/use/useCss.mjs.map +1 -0
- package/lib/utils/use/useEnhancedEffect.d.ts +1 -1
- package/lib/utils/zIndexStacking.d.ts +1 -3
- package/lib/utils/zIndexStacking.js.map +1 -1
- package/lib/utils/zIndexStacking.mjs.map +1 -1
- package/package.json +1 -1
- package/lib/decorators/propsObserver.d.ts +0 -11
- package/lib/decorators/propsObserver.js +0 -77
- package/lib/decorators/propsObserver.js.map +0 -1
- package/lib/decorators/propsObserver.mjs +0 -70
- package/lib/decorators/propsObserver.mjs.map +0 -1
- package/lib/decorators/reactive.d.ts +0 -11
- package/lib/decorators/reactive.js +0 -51
- package/lib/decorators/reactive.js.map +0 -1
- package/lib/decorators/reactive.mjs +0 -45
- package/lib/decorators/reactive.mjs.map +0 -1
- package/lib/utils/indentStyles.d.ts +0 -3
- package/lib/utils/indentStyles.js +0 -45
- package/lib/utils/indentStyles.js.map +0 -1
- package/lib/utils/indentStyles.mjs +0 -36
- package/lib/utils/indentStyles.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithI18n.js","names":["_intl","require","_react","_interopRequireWildcard","_i18nEnhance","Context","exports","createContext","undefined","I18nProvider","Provider","I18nConsumer","Consumer","messagesCache","createIntlCache","
|
|
1
|
+
{"version":3,"file":"WithI18n.js","names":["_intl","require","_react","_interopRequireWildcard","_createHoc","_interopRequireDefault","_i18nEnhance","Context","exports","createContext","undefined","I18nProvider","Provider","I18nConsumer","Consumer","messagesCache","createIntlCache","getText","dictionaries","locale","key","dictionary","WithI18n","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","selfLocale","_this$props","props","contextLocale","context","_inherits2","_createClass2","value","render","_ref","children","Component","useI18n","_React$useContext","fallbackDictionary","lang","React","useContext","resolvedDictionary","useAsyncI18nMessages","intl","useMemo","createIntl","messages","useCallback","messageId","variables","formatMessage","id","_default","createHoc"],"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,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;A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,QAAQ,EAAEL;IAAmB,CAAC,EAAEtC,aAAa,CAAC;EAAA,GAC/E,CAACsC,kBAAkB,EAAEH,IAAI,CAC3B,CAAC;EAED,OAAOC,iBAAK,CAACQ,WAAW,CACtB,UAACC,SAAiB,EAAEC,SAA0D,EAAK;IACjF,OAAON,IAAI,CAACO,aAAa,CAAC;MAAEC,EAAE,EAAEH,SAAS,aAATA,SAAS,cAATA,SAAS,GAAI;IAAG,CAAC,EAAEC,SAAS,CAAC;EAC/D,CAAC,EACD,CAACN,IAAI,CACP,CAAC;AACH,CAAC;AAAC,IAAAS,QAAA,GAAAxD,OAAA,cAEa,IAAAyD,qBAAS,EAAC3C,QAAQ,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,52 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
6
|
import { createIntlCache, createIntl } from "@formatjs/intl";
|
|
2
|
-
import React, { createContext } from "react";
|
|
7
|
+
import React, { createContext, Component } from "react";
|
|
8
|
+
import createHoc from "../createHoc.mjs";
|
|
3
9
|
import { useAsyncI18nMessages } from "./i18nEnhance.mjs";
|
|
4
10
|
var Context = /* @__PURE__ */ createContext(void 0);
|
|
5
11
|
var I18nProvider = Context.Provider, I18nConsumer = Context.Consumer;
|
|
6
12
|
var messagesCache = createIntlCache();
|
|
13
|
+
function getText(dictionaries, locale) {
|
|
14
|
+
return function(key) {
|
|
15
|
+
var dictionary = dictionaries[locale];
|
|
16
|
+
return dictionary ? dictionary[key] : dictionaries["en"][key];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
var WithI18n = /* @__PURE__ */ (function(_Component) {
|
|
20
|
+
function WithI18n2() {
|
|
21
|
+
var _this;
|
|
22
|
+
_classCallCheck(this, WithI18n2);
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
_this = _callSuper(this, WithI18n2, [].concat(args));
|
|
27
|
+
_defineProperty(_this, "context", void 0);
|
|
28
|
+
_defineProperty(_this, "getText", function(dictionary, selfLocale) {
|
|
29
|
+
var _this$props = _this.props, locale = _this$props.locale, getText2 = _this$props.getText;
|
|
30
|
+
var contextLocale = _this.context;
|
|
31
|
+
return getText2(dictionary, selfLocale || locale || contextLocale);
|
|
32
|
+
});
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
_inherits(WithI18n2, _Component);
|
|
36
|
+
return _createClass(WithI18n2, [{
|
|
37
|
+
key: "render",
|
|
38
|
+
value: function render() {
|
|
39
|
+
var _ref = this.props, children = _ref.children;
|
|
40
|
+
return children({
|
|
41
|
+
getText: this.getText
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}]);
|
|
45
|
+
})(Component);
|
|
46
|
+
_defineProperty(WithI18n, "contextType", Context);
|
|
47
|
+
_defineProperty(WithI18n, "defaultProps", {
|
|
48
|
+
getText
|
|
49
|
+
});
|
|
7
50
|
var useI18n = function useI18n2(dictionary) {
|
|
8
51
|
var _React$useContext;
|
|
9
52
|
var locale = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "en";
|
|
@@ -22,9 +65,11 @@ var useI18n = function useI18n2(dictionary) {
|
|
|
22
65
|
}, variables);
|
|
23
66
|
}, [intl]);
|
|
24
67
|
};
|
|
68
|
+
const WithI18n_default = createHoc(WithI18n);
|
|
25
69
|
export {
|
|
26
70
|
Context,
|
|
27
71
|
I18nConsumer,
|
|
28
72
|
I18nProvider,
|
|
73
|
+
WithI18n_default as default,
|
|
29
74
|
useI18n
|
|
30
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithI18n.mjs","names":["createIntl","createIntlCache","React","createContext","useAsyncI18nMessages","Context","undefined","I18nProvider","Provider","I18nConsumer","Consumer","messagesCache","
|
|
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,QAAQ,OAAO;AAEvD,OAAOC,SAAS,MAAM,kBAAc;AACpC,SAASC,oBAAoB,QAAQ,mBAAe;AAMpD,OAAO,IAAMC,OAAO,gBAAGH,aAAa,CAAyBI,SAAS,CAAC;AACvE,IAAkBC,YAAY,GAA6BF,OAAO,CAA1DG,QAAQ;EAA0BC,YAAY,GAAKJ,OAAO,CAAlCK,QAAQ;AACxC,IAAMC,aAAa,GAAGZ,eAAe,CAAC,CAAC;AAEvC,SAASa,OAAOA,CAACC,YAAwB,EAAEC,MAAkB,EAAE;EAC7D,OAAO,UAAUC,GAAyB,EAAE;IAC1C,IAAMC,UAAU,GAAGH,YAAY,CAACC,MAAM,CAAC;IACvC,OAAOE,UAAU,GAAIA,UAAU,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nknownProperties } from '../../core-types/UnknownProperties';
|
|
4
|
+
/** @deprecated */
|
|
5
|
+
export interface IEnhancedWithKeyboardFocusInjectedProps extends EnhancedWithKeyboardFocusInjectedProps {
|
|
6
|
+
}
|
|
7
|
+
export type EnhancedWithKeyboardFocusInjectedProps = {
|
|
8
|
+
tabIndex: number;
|
|
9
|
+
keyboardFocused: boolean;
|
|
10
|
+
onFocus(e: FocusEvent): void;
|
|
11
|
+
onBlur(e: FocusEvent): void;
|
|
12
|
+
onKeyDown(e: KeyboardEvent): void;
|
|
13
|
+
onMouseDown(e: MouseEvent): void;
|
|
14
|
+
};
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
export interface IEnhancedWithKeyboardFocusProps extends EnhancedWithKeyboardFocusProps, UnknownProperties {
|
|
17
|
+
}
|
|
18
|
+
export type EnhancedWithKeyboardFocusProps = {
|
|
19
|
+
keyboardFocused?: boolean;
|
|
20
|
+
tabIndex?: number;
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
children(props: IEnhancedWithKeyboardFocusInjectedProps): React.ReactNode;
|
|
23
|
+
};
|
|
24
|
+
/** @deprecated */
|
|
25
|
+
export interface IEnhancedWithKeyboardFocusState extends EnhancedWithKeyboardFocusState, UnknownProperties {
|
|
26
|
+
}
|
|
27
|
+
export type EnhancedWithKeyboardFocusState = {
|
|
28
|
+
keyboardFocused: boolean;
|
|
29
|
+
};
|
|
30
|
+
export declare class EnhancedWithKeyboardFocus extends PureComponent<IEnhancedWithKeyboardFocusProps, IEnhancedWithKeyboardFocusState> {
|
|
31
|
+
static displayName: string;
|
|
32
|
+
static defaultProps: {
|
|
33
|
+
tabIndex: number;
|
|
34
|
+
};
|
|
35
|
+
static getDerivedStateFromProps(props: any, state: any): any;
|
|
36
|
+
state: {
|
|
37
|
+
keyboardFocused: boolean;
|
|
38
|
+
};
|
|
39
|
+
handlerFocus: (e: FocusEvent) => void;
|
|
40
|
+
handlerBlur: (e: FocusEvent) => void;
|
|
41
|
+
handlerKeyDown: (e: KeyboardEvent) => void;
|
|
42
|
+
handlerMouseDown: (e: MouseEvent) => void;
|
|
43
|
+
render(): React.ReactNode;
|
|
44
|
+
}
|
|
45
|
+
declare const _default: (options?: {}) => (WrappedComponent: React.ComponentType) => React.ComponentClass;
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.EnhancedWithKeyboardFocus = void 0;
|
|
8
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
+
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
11
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _react = require("react");
|
|
14
|
+
var _createHoc = _interopRequireDefault(require("../createHoc"));
|
|
15
|
+
var _fire = _interopRequireDefault(require("../fire"));
|
|
16
|
+
var _uncontroll = require("../uncontroll");
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
|
|
21
|
+
/** @deprecated */
|
|
22
|
+
|
|
23
|
+
var usingKeyBoard = true;
|
|
24
|
+
var EnhancedWithKeyboardFocus = exports.EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
25
|
+
function EnhancedWithKeyboardFocus() {
|
|
26
|
+
var _this;
|
|
27
|
+
(0, _classCallCheck2["default"])(this, EnhancedWithKeyboardFocus);
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
+
args[_key] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
_this = (0, _callSuper2["default"])(this, EnhancedWithKeyboardFocus, [].concat(args));
|
|
32
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
33
|
+
keyboardFocused: false
|
|
34
|
+
});
|
|
35
|
+
(0, _defineProperty2["default"])(_this, "handlerFocus", function (e) {
|
|
36
|
+
(0, _fire["default"])(_this, 'onFocus', e);
|
|
37
|
+
if (usingKeyBoard) {
|
|
38
|
+
(0, _uncontroll.internalSetState)(_this, {
|
|
39
|
+
keyboardFocused: true
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
(0, _defineProperty2["default"])(_this, "handlerBlur", function (e) {
|
|
44
|
+
(0, _fire["default"])(_this, 'onBlur', e);
|
|
45
|
+
(0, _uncontroll.internalSetState)(_this, {
|
|
46
|
+
keyboardFocused: false
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
(0, _defineProperty2["default"])(_this, "handlerKeyDown", function (e) {
|
|
50
|
+
(0, _fire["default"])(_this, 'onKeyDown', e);
|
|
51
|
+
usingKeyBoard = true;
|
|
52
|
+
});
|
|
53
|
+
(0, _defineProperty2["default"])(_this, "handlerMouseDown", function (e) {
|
|
54
|
+
(0, _fire["default"])(_this, 'onMouseDown', e);
|
|
55
|
+
usingKeyBoard = false;
|
|
56
|
+
});
|
|
57
|
+
return _this;
|
|
58
|
+
}
|
|
59
|
+
(0, _inherits2["default"])(EnhancedWithKeyboardFocus, _PureComponent);
|
|
60
|
+
return (0, _createClass2["default"])(EnhancedWithKeyboardFocus, [{
|
|
61
|
+
key: "render",
|
|
62
|
+
value: function render() {
|
|
63
|
+
var _this$props = this.props,
|
|
64
|
+
children = _this$props.children,
|
|
65
|
+
tabIndex = _this$props.tabIndex,
|
|
66
|
+
disabled = _this$props.disabled;
|
|
67
|
+
var keyboardFocused = this.state.keyboardFocused;
|
|
68
|
+
return children({
|
|
69
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
70
|
+
keyboardFocused: keyboardFocused,
|
|
71
|
+
onFocus: this.handlerFocus,
|
|
72
|
+
onBlur: this.handlerBlur,
|
|
73
|
+
onKeyDown: this.handlerKeyDown,
|
|
74
|
+
onMouseDown: this.handlerMouseDown
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}], [{
|
|
78
|
+
key: "getDerivedStateFromProps",
|
|
79
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
80
|
+
if (props.keyboardFocused !== undefined) {
|
|
81
|
+
return {
|
|
82
|
+
keyboardFocused: props.keyboardFocused
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return state;
|
|
86
|
+
}
|
|
87
|
+
}]);
|
|
88
|
+
}(_react.PureComponent);
|
|
89
|
+
(0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
|
|
90
|
+
(0, _defineProperty2["default"])(EnhancedWithKeyboardFocus, "defaultProps", {
|
|
91
|
+
tabIndex: 0
|
|
92
|
+
});
|
|
93
|
+
var _default = exports["default"] = (0, _createHoc["default"])(EnhancedWithKeyboardFocus);
|
|
94
|
+
//# sourceMappingURL=WithKeyboardFocus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WithKeyboardFocus.js","names":["_react","require","_createHoc","_interopRequireDefault","_fire","_uncontroll","usingKeyBoard","EnhancedWithKeyboardFocus","exports","_PureComponent","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","keyboardFocused","e","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;AAEA;;AAgBA;;AAYA;;AAQA,IAAIK,aAAa,GAAG,IAAI;AAAC,IAEZC,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,0BAAAE,cAAA;EAAA,SAAAF,0BAAA;IAAA,IAAAG,KAAA;IAAA,IAAAC,gBAAA,mBAAAJ,yBAAA;IAAA,SAAAK,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,OAAAQ,WAAA,mBAAAX,yBAAA,KAAAY,MAAA,CAAAJ,IAAA;IAAA,IAAAK,gBAAA,aAAAV,KAAA,WAmB5B;MACNW,eAAe,EAAE;IACnB,CAAC;IAAA,IAAAD,gBAAA,aAAAV,KAAA,kBAEc,UAACY,CAAa,EAAK;MAChC,IAAAC,gBAAI,EAAAb,KAAA,EAAO,SAAS,EAAEY,CAAC,CAAC;MACxB,IAAIhB,aAAa,EAAE;QACjB,IAAAkB,4BAAgB,EAAAd,KAAA,EAAO;UAAEW,eAAe,EAAE;Q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C;MACpB,CAAC,CAAC;IACJ;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EA9CD,SAAOgB,wBAAwBA,CAACb,KAAU,EAAEI,KAAU,EAAE;MACtD,IAAIJ,KAAK,CAACV,eAAe,KAAKwB,SAAS,EAAE;QACvC,OAAO;UACLxB,eAAe,EAAEU,KAAK,CAACV;QACzB,CAAC;MACH;MACA,OAAOc,KAAK;IACd;EAAC;AAAA,EAjB4CW,oBAAa;AAAA,IAAA1B,gBAAA,aAA/Cb,yBAAyB,iBAIf,2BAA2B;AAAA,IAAAa,gBAAA,aAJrCb,yBAAyB,kBAMd;EACpB0B,QAAQ,EAAE;AACZ,CAAC;AAAA,IAAAc,QAAA,GAAAvC,OAAA,cAmDY,IAAAwC,qBAAS,EAACzC,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
2
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
3
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
4
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
|
+
import { PureComponent } from 'react';
|
|
7
|
+
import createHoc from "../createHoc.mjs";
|
|
8
|
+
import fire from "../fire.mjs";
|
|
9
|
+
import { internalSetState } from "../uncontroll.mjs";
|
|
10
|
+
|
|
11
|
+
/** @deprecated */
|
|
12
|
+
|
|
13
|
+
/** @deprecated */
|
|
14
|
+
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
|
|
17
|
+
var usingKeyBoard = true;
|
|
18
|
+
export var EnhancedWithKeyboardFocus = /*#__PURE__*/function (_PureComponent) {
|
|
19
|
+
function EnhancedWithKeyboardFocus() {
|
|
20
|
+
var _this;
|
|
21
|
+
_classCallCheck(this, EnhancedWithKeyboardFocus);
|
|
22
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
23
|
+
args[_key] = arguments[_key];
|
|
24
|
+
}
|
|
25
|
+
_this = _callSuper(this, EnhancedWithKeyboardFocus, [].concat(args));
|
|
26
|
+
_defineProperty(_this, "state", {
|
|
27
|
+
keyboardFocused: false
|
|
28
|
+
});
|
|
29
|
+
_defineProperty(_this, "handlerFocus", function (e) {
|
|
30
|
+
fire(_this, 'onFocus', e);
|
|
31
|
+
if (usingKeyBoard) {
|
|
32
|
+
internalSetState(_this, {
|
|
33
|
+
keyboardFocused: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
_defineProperty(_this, "handlerBlur", function (e) {
|
|
38
|
+
fire(_this, 'onBlur', e);
|
|
39
|
+
internalSetState(_this, {
|
|
40
|
+
keyboardFocused: false
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
_defineProperty(_this, "handlerKeyDown", function (e) {
|
|
44
|
+
fire(_this, 'onKeyDown', e);
|
|
45
|
+
usingKeyBoard = true;
|
|
46
|
+
});
|
|
47
|
+
_defineProperty(_this, "handlerMouseDown", function (e) {
|
|
48
|
+
fire(_this, 'onMouseDown', e);
|
|
49
|
+
usingKeyBoard = false;
|
|
50
|
+
});
|
|
51
|
+
return _this;
|
|
52
|
+
}
|
|
53
|
+
_inherits(EnhancedWithKeyboardFocus, _PureComponent);
|
|
54
|
+
return _createClass(EnhancedWithKeyboardFocus, [{
|
|
55
|
+
key: "render",
|
|
56
|
+
value: function render() {
|
|
57
|
+
var _this$props = this.props,
|
|
58
|
+
children = _this$props.children,
|
|
59
|
+
tabIndex = _this$props.tabIndex,
|
|
60
|
+
disabled = _this$props.disabled;
|
|
61
|
+
var keyboardFocused = this.state.keyboardFocused;
|
|
62
|
+
return children({
|
|
63
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
64
|
+
keyboardFocused: keyboardFocused,
|
|
65
|
+
onFocus: this.handlerFocus,
|
|
66
|
+
onBlur: this.handlerBlur,
|
|
67
|
+
onKeyDown: this.handlerKeyDown,
|
|
68
|
+
onMouseDown: this.handlerMouseDown
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}], [{
|
|
72
|
+
key: "getDerivedStateFromProps",
|
|
73
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
74
|
+
if (props.keyboardFocused !== undefined) {
|
|
75
|
+
return {
|
|
76
|
+
keyboardFocused: props.keyboardFocused
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return state;
|
|
80
|
+
}
|
|
81
|
+
}]);
|
|
82
|
+
}(PureComponent);
|
|
83
|
+
_defineProperty(EnhancedWithKeyboardFocus, "displayName", 'EnhancedWithKeyboardFocus');
|
|
84
|
+
_defineProperty(EnhancedWithKeyboardFocus, "defaultProps", {
|
|
85
|
+
tabIndex: 0
|
|
86
|
+
});
|
|
87
|
+
export default createHoc(EnhancedWithKeyboardFocus);
|
|
88
|
+
//# sourceMappingURL=WithKeyboardFocus.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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 onKey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BAMd;EACpBuB,QAAQ,EAAE;AACZ,CAAC;AAmDH,eAAe3B,SAAS,CAACI,yBAAyB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _hoistNonReactStatics = _interopRequireDefault(require("hoist-non-react-statics"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _getDisplayName = _interopRequireDefault(require("../getDisplayName"));
|
|
12
|
+
function WithForwardRef() {
|
|
13
|
+
return function ForwardRef(Component) {
|
|
14
|
+
var Wrapped = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
return /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, Component.defaultProps || {}, props, {
|
|
17
|
+
forwardedRef: ref
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
Wrapped.displayName = (0, _getDisplayName["default"])(Component);
|
|
21
|
+
return (0, _hoistNonReactStatics["default"])(Wrapped, Component);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
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":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import getDisplayName from "../getDisplayName.mjs";
|
|
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.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,3 +1,7 @@
|
|
|
1
|
+
import type { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
2
|
+
/** @deprecated */
|
|
3
|
+
export interface IWithAnimatedSizeEnhanceProps extends WithAnimatedSizeEnhanceProps, UnknownProperties {
|
|
4
|
+
}
|
|
1
5
|
export type WithAnimatedSizeEnhanceProps = {
|
|
2
6
|
animationsDisabled?: boolean;
|
|
3
7
|
};
|
|
@@ -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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatedSizeEnhance.js","names":["_react","_interopRequireDefault","require","_ref2","_useEnhancedEffect","_excluded","uniqueId","animatedSizeEnhance","_ref","_ref$animateProps","animateProps","_ref$onChangeOf","onChangeOf","props","ref","__animatedEnhanceInstanceId","duration","other","_objectWithoutProperties2","nodeRef","React","createRef","lastSizesRef","useRef","prevPropsRef","animatedSizeInstanceIdRef","current","useEnhancedEffect","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","_toConsumableArray2","map","propName","_objectSpread2","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/animatedSizeEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\n\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 // @ts-ignore\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;
|
|
1
|
+
{"version":3,"file":"animatedSizeEnhance.js","names":["_react","_interopRequireDefault","require","_ref2","_useEnhancedEffect","_excluded","uniqueId","animatedSizeEnhance","_ref","_ref$animateProps","animateProps","_ref$onChangeOf","onChangeOf","props","ref","__animatedEnhanceInstanceId","duration","other","_objectWithoutProperties2","nodeRef","React","createRef","lastSizesRef","useRef","prevPropsRef","animatedSizeInstanceIdRef","current","useEnhancedEffect","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","_toConsumableArray2","map","propName","_objectSpread2","useForkRef","_default","exports"],"sources":["../../../src/utils/enhances/animatedSizeEnhance.tsx"],"sourcesContent":["import React from 'react';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\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 // @ts-ignore\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAyD,IAAAG,SAAA;AAEzD;;AAQA,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,Q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C1FT,KAAK;EAEZ,CAAC;AACH;AAAC,IAAAyC,QAAA,GAAAC,OAAA,cAEcpD,mBAAmB","ignoreList":[]}
|
|
@@ -5,6 +5,9 @@ var _excluded = ["ref", "__animatedEnhanceInstanceId", "duration"];
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { useForkRef } from "../ref.mjs";
|
|
7
7
|
import useEnhancedEffect from "../use/useEnhancedEffect.mjs";
|
|
8
|
+
|
|
9
|
+
/** @deprecated */
|
|
10
|
+
|
|
8
11
|
var uniqueId = 0;
|
|
9
12
|
function animatedSizeEnhance(_ref) {
|
|
10
13
|
var _ref$animateProps = _ref.animateProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animatedSizeEnhance.mjs","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';\n\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\n\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 // @ts-ignore\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;
|
|
1
|
+
{"version":3,"file":"animatedSizeEnhance.mjs","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';\n\nimport type { UnknownProperties } from '../../core-types/UnknownProperties';\nimport { useForkRef } from '../ref';\nimport useEnhancedEffect from '../use/useEnhancedEffect';\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 // @ts-ignore\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;AAGzB,SAASC,UAAU,QAAQ,YAAQ;AACnC,OAAOC,iBAAiB,MAAM,8BAA0B;;AAExD;;AAQA,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,CAAc,CAAC;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,GAAGb,KAAK;IAE5BR,iBAAiB,CAAC,YAAM;MACtB,IAAIQ,KAAK,CAACc,kBAAkB,EAAE;MAC9B,IACEZ,2BAA2B,KAAKa,SAAS,IACzCb,2BAA2B,KAAKU,yBAAyB,CAACC,OAAO,EAEjE;MACF,IAA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AAK,CAAC5B,YAAY,CAACsB,GAAC,CAAC,CAAC,MAAAU,MAAA,CAAMP,KAAK,CAACH,GAAC,CAAC,OAAI;QAC/C;MACF,CAAC,CAAC;MACFW,OAAO,GAAGO,UAAU,CAACN,oBAAmB,EAAE,GAAG,CAAQ;MACrD,OAAO,YAAM;QACXO,oBAAoB,CAACJ,cAAc,CAAC;QACpCH,oBAAmB,CAAC,CAAC;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,EACjD,CAAC;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","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { UnknownProperties } from '../../core-types/UnknownProperties';
|
|
2
|
+
/** @deprecated */
|
|
3
|
+
export interface IWithAutoFocusEnhanceProps extends WithAutoFocusEnhanceProps, UnknownProperties {
|
|
4
|
+
}
|
|
5
|
+
export type WithAutoFocusEnhanceProps = {
|
|
6
|
+
/** Native autofocus, but with support for working inside modals, you can also transmit the number of ms before focus is triggered */
|
|
7
|
+
autoFocus?: boolean | number;
|
|
8
|
+
};
|
|
9
|
+
declare function autoFocusEnhance(): (props: any) => any;
|
|
10
|
+
export default autoFocusEnhance;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _ref = require("../ref");
|
|
12
|
+
var _excluded = ["autoFocus", "ref"];
|
|
13
|
+
function notUsingNativeAutoFocus(autoFocus) {
|
|
14
|
+
return typeof autoFocus === 'boolean' || typeof autoFocus === 'number';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** @deprecated */
|
|
18
|
+
|
|
19
|
+
function autoFocusEnhance() {
|
|
20
|
+
return function (props) {
|
|
21
|
+
var autoFocus = props.autoFocus,
|
|
22
|
+
ref = props.ref,
|
|
23
|
+
other = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
24
|
+
if (!notUsingNativeAutoFocus(autoFocus)) {
|
|
25
|
+
return props;
|
|
26
|
+
}
|
|
27
|
+
var nodeRef = /*#__PURE__*/_react["default"].createRef();
|
|
28
|
+
_react["default"].useEffect(function () {
|
|
29
|
+
if (autoFocus === false) return;
|
|
30
|
+
var inputNode = nodeRef.current;
|
|
31
|
+
if (!inputNode || !inputNode.focus) return;
|
|
32
|
+
var timer = setTimeout(function () {
|
|
33
|
+
return inputNode === null || inputNode === void 0 ? void 0 : inputNode.focus();
|
|
34
|
+
}, autoFocus || 0);
|
|
35
|
+
return function () {
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
};
|
|
38
|
+
}, [autoFocus]);
|
|
39
|
+
return (0, _objectSpread2["default"])({
|
|
40
|
+
ref: (0, _ref.useForkRef)(ref, nodeRef)
|
|
41
|
+
}, other);
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
var _default = exports["default"] = autoFocusEnhance;
|
|
45
|
+
//# sourceMappingURL=autoFocusEnhance.js.map
|