intergalactic 15.43.0-prerelease-7718b840 → 15.43.0-prerelease-fbfdafde
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/accordion/index.js +25 -1
- package/accordion/lib/cjs/Accordion.js +6 -6
- package/accordion/lib/cjs/style/accordion.shadow.css +9 -2
- package/accordion/lib/es6/Accordion.js +6 -6
- package/accordion/lib/es6/style/accordion.shadow.css +9 -2
- package/animation/index.js +25 -1
- package/animation/lib/cjs/Animation.js +11 -11
- package/animation/lib/cjs/Collapse.js +28 -28
- package/animation/lib/cjs/FadeInOut.js +28 -28
- package/animation/lib/cjs/Scale.js +28 -28
- package/animation/lib/cjs/Slide.js +28 -28
- package/animation/lib/cjs/Transform.js +28 -28
- package/animation/lib/es6/Animation.js +11 -11
- package/animation/lib/es6/Collapse.js +28 -28
- package/animation/lib/es6/FadeInOut.js +28 -28
- package/animation/lib/es6/Scale.js +28 -28
- package/animation/lib/es6/Slide.js +28 -28
- package/animation/lib/es6/Transform.js +28 -28
- package/badge/index.js +25 -1
- package/badge/lib/cjs/Badge.js +6 -6
- package/badge/lib/es6/Badge.js +6 -6
- package/base-trigger/index.js +25 -1
- package/base-trigger/lib/cjs/BaseTrigger.js +26 -19
- package/base-trigger/lib/cjs/BaseTrigger.js.map +1 -1
- package/base-trigger/lib/cjs/ButtonTrigger.js +3 -3
- package/base-trigger/lib/cjs/FilterTrigger.js +7 -7
- package/base-trigger/lib/cjs/LinkTrigger.js +12 -12
- package/base-trigger/lib/cjs/style/base-trigger.shadow.css +8 -0
- package/base-trigger/lib/es6/BaseTrigger.js +26 -19
- package/base-trigger/lib/es6/BaseTrigger.js.map +1 -1
- package/base-trigger/lib/es6/ButtonTrigger.js +3 -3
- package/base-trigger/lib/es6/FilterTrigger.js +7 -7
- package/base-trigger/lib/es6/LinkTrigger.js +12 -12
- package/base-trigger/lib/es6/style/base-trigger.shadow.css +8 -0
- package/breadcrumbs/index.js +25 -1
- package/breadcrumbs/lib/cjs/Breadcrumbs.js +6 -6
- package/breadcrumbs/lib/es6/Breadcrumbs.js +6 -6
- package/breakpoints/index.js +25 -1
- package/button/index.js +25 -1
- package/button/lib/cjs/Button.js +26 -26
- package/button/lib/es6/Button.js +26 -26
- package/card/index.js +25 -1
- package/card/lib/cjs/Card.js +8 -8
- package/card/lib/es6/Card.js +8 -8
- package/carousel/index.js +25 -1
- package/carousel/lib/cjs/Carousel.js +16 -16
- package/carousel/lib/es6/Carousel.js +16 -16
- package/checkbox/index.js +25 -1
- package/checkbox/lib/cjs/Checkbox.js +25 -21
- package/checkbox/lib/cjs/Checkbox.js.map +1 -1
- package/checkbox/lib/es6/Checkbox.js +25 -21
- package/checkbox/lib/es6/Checkbox.js.map +1 -1
- package/color-picker/index.d.ts +174 -0
- package/color-picker/index.js +25 -1
- package/color-picker/lib/cjs/ColorPicker.js +23 -23
- package/color-picker/lib/cjs/PaletteManager.js +23 -23
- package/color-picker/lib/cjs/components/InputColor.js +23 -23
- package/color-picker/lib/cjs/index.d.js.map +1 -1
- package/color-picker/lib/es6/ColorPicker.js +23 -23
- package/color-picker/lib/es6/PaletteManager.js +23 -23
- package/color-picker/lib/es6/components/InputColor.js +23 -23
- package/color-picker/lib/es6/index.d.js.map +1 -1
- package/color-picker/lib/types/index.d.ts +174 -0
- package/core/index.js +25 -1
- package/core/lib/cjs/utils/assignProps.js +93 -0
- package/core/lib/cjs/utils/assignProps.js.map +1 -0
- package/core/lib/cjs/utils/canUseDOM.js +10 -0
- package/core/lib/cjs/utils/canUseDOM.js.map +1 -0
- package/core/lib/cjs/utils/capitalizeFirstLetter.js +10 -0
- package/core/lib/cjs/utils/capitalizeFirstLetter.js.map +1 -0
- package/core/lib/cjs/utils/createHoc.js +55 -0
- package/core/lib/cjs/utils/createHoc.js.map +1 -0
- package/core/lib/cjs/utils/enhances/WithI18n.js +85 -0
- package/core/lib/cjs/utils/enhances/WithI18n.js.map +1 -0
- package/core/lib/cjs/utils/enhances/i18nEnhance.js +133 -0
- package/core/lib/cjs/utils/enhances/i18nEnhance.js.map +1 -0
- package/core/lib/cjs/utils/getDisplayName.js +10 -0
- package/core/lib/cjs/utils/getDisplayName.js.map +1 -0
- package/core/lib/cjs/utils/logger.js +40 -0
- package/core/lib/cjs/utils/logger.js.map +1 -0
- package/core/lib/cjs/utils/pick.js +19 -0
- package/core/lib/cjs/utils/pick.js.map +1 -0
- package/core/lib/cjs/utils/ref.js +94 -0
- package/core/lib/cjs/utils/ref.js.map +1 -0
- package/core/lib/cjs/utils/use/useEnhancedEffect.js +13 -0
- package/core/lib/cjs/utils/use/useEnhancedEffect.js.map +1 -0
- package/core/lib/es6/utils/assignProps.js +84 -0
- package/core/lib/es6/utils/assignProps.js.map +1 -0
- package/core/lib/es6/utils/canUseDOM.js +4 -0
- package/core/lib/es6/utils/canUseDOM.js.map +1 -0
- package/core/lib/es6/utils/capitalizeFirstLetter.js +4 -0
- package/core/lib/es6/utils/capitalizeFirstLetter.js.map +1 -0
- package/core/lib/es6/utils/createHoc.js +46 -0
- package/core/lib/es6/utils/createHoc.js.map +1 -0
- package/core/lib/es6/utils/enhances/WithI18n.js +73 -0
- package/core/lib/es6/utils/enhances/WithI18n.js.map +1 -0
- package/core/lib/es6/utils/enhances/i18nEnhance.js +122 -0
- package/core/lib/es6/utils/enhances/i18nEnhance.js.map +1 -0
- package/core/lib/es6/utils/getDisplayName.js +4 -0
- package/core/lib/es6/utils/getDisplayName.js.map +1 -0
- package/core/lib/es6/utils/logger.js +32 -0
- package/core/lib/es6/utils/logger.js.map +1 -0
- package/core/lib/es6/utils/pick.js +13 -0
- package/core/lib/es6/utils/pick.js.map +1 -0
- package/core/lib/es6/utils/ref.js +82 -0
- package/core/lib/es6/utils/ref.js.map +1 -0
- package/core/lib/es6/utils/use/useEnhancedEffect.js +5 -0
- package/core/lib/es6/utils/use/useEnhancedEffect.js.map +1 -0
- package/core/lib/types/utils/assignProps.d.ts +13 -0
- package/core/lib/types/utils/canUseDOM.d.ts +1 -0
- package/core/lib/types/utils/capitalizeFirstLetter.d.ts +1 -0
- package/core/lib/types/utils/createHoc.d.ts +3 -0
- package/core/lib/types/utils/enhances/WithI18n.d.ts +43 -0
- package/core/lib/types/utils/enhances/i18nEnhance.d.ts +26 -0
- package/core/lib/types/utils/getDisplayName.d.ts +2 -0
- package/core/lib/types/utils/logger.d.ts +9 -0
- package/core/lib/types/utils/pick.d.ts +1 -0
- package/core/lib/types/utils/ref.d.ts +8 -0
- package/core/lib/types/utils/use/useEnhancedEffect.d.ts +3 -0
- package/core/utils/assignProps.d.ts +13 -0
- package/core/utils/canUseDOM.d.ts +1 -0
- package/core/utils/capitalizeFirstLetter.d.ts +1 -0
- package/core/utils/createHoc.d.ts +3 -0
- package/core/utils/enhances/WithI18n.d.ts +43 -0
- package/core/utils/enhances/i18nEnhance.d.ts +26 -0
- package/core/utils/getDisplayName.d.ts +2 -0
- package/core/utils/logger.d.ts +9 -0
- package/core/utils/pick.d.ts +1 -0
- package/core/utils/ref.d.ts +8 -0
- package/core/utils/use/useEnhancedEffect.d.ts +3 -0
- package/counter/index.js +25 -1
- package/counter/lib/cjs/Counter.js +10 -10
- package/counter/lib/es6/Counter.js +10 -10
- package/d3-chart/index.js +25 -1
- package/d3-chart/lib/cjs/Area.js +9 -9
- package/d3-chart/lib/cjs/Axis.js +14 -14
- package/d3-chart/lib/cjs/Bar.js +8 -8
- package/d3-chart/lib/cjs/Bubble.js +10 -10
- package/d3-chart/lib/cjs/Donut.js +7 -7
- package/d3-chart/lib/cjs/Dots.js +19 -22
- package/d3-chart/lib/cjs/Dots.js.map +1 -1
- package/d3-chart/lib/cjs/HorizontalBar.js +8 -8
- package/d3-chart/lib/cjs/Hover.js +3 -3
- package/d3-chart/lib/cjs/Line.js +9 -9
- package/d3-chart/lib/cjs/Plot.js +3 -3
- package/d3-chart/lib/cjs/Radar.js +17 -17
- package/d3-chart/lib/cjs/RadialTree.js +10 -10
- package/d3-chart/lib/cjs/ReferenceLine.js +9 -9
- package/d3-chart/lib/cjs/ScatterPlot.js +7 -7
- package/d3-chart/lib/cjs/Tooltip.js +8 -8
- package/d3-chart/lib/cjs/Venn.js +7 -7
- package/d3-chart/lib/cjs/a11y/PlotA11yModule.js +2 -2
- package/d3-chart/lib/cjs/a11y/PlotA11yView.js +2 -2
- package/d3-chart/lib/cjs/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/d3-chart/lib/cjs/component/ChartLegend/LegendItem/LegendItem.js +15 -15
- package/d3-chart/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/d3-chart/lib/es6/Area.js +9 -9
- package/d3-chart/lib/es6/Axis.js +14 -14
- package/d3-chart/lib/es6/Bar.js +8 -8
- package/d3-chart/lib/es6/Bubble.js +10 -10
- package/d3-chart/lib/es6/Donut.js +7 -7
- package/d3-chart/lib/es6/Dots.js +19 -22
- package/d3-chart/lib/es6/Dots.js.map +1 -1
- package/d3-chart/lib/es6/HorizontalBar.js +8 -8
- package/d3-chart/lib/es6/Hover.js +3 -3
- package/d3-chart/lib/es6/Line.js +9 -9
- package/d3-chart/lib/es6/Plot.js +3 -3
- package/d3-chart/lib/es6/Radar.js +17 -17
- package/d3-chart/lib/es6/RadialTree.js +10 -10
- package/d3-chart/lib/es6/ReferenceLine.js +9 -9
- package/d3-chart/lib/es6/ScatterPlot.js +7 -7
- package/d3-chart/lib/es6/Tooltip.js +8 -8
- package/d3-chart/lib/es6/Venn.js +7 -7
- package/d3-chart/lib/es6/a11y/PlotA11yModule.js +2 -2
- package/d3-chart/lib/es6/a11y/PlotA11yView.js +2 -2
- package/d3-chart/lib/es6/component/ChartLegend/LegendFlex/LegendFlex.js +4 -4
- package/d3-chart/lib/es6/component/ChartLegend/LegendItem/LegendItem.js +15 -15
- package/d3-chart/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/data-table/index.js +25 -1
- package/data-table/lib/cjs/Body.js +4 -4
- package/data-table/lib/cjs/DataTable.js +40 -40
- package/data-table/lib/cjs/Head.js +4 -4
- package/data-table/lib/es6/Body.js +4 -4
- package/data-table/lib/es6/DataTable.js +40 -40
- package/data-table/lib/es6/Head.js +4 -4
- package/date-picker/index.js +25 -1
- package/date-picker/lib/cjs/DateRangeComparator.js +1 -0
- package/date-picker/lib/cjs/DateRangeComparator.js.map +1 -1
- package/date-picker/lib/cjs/MonthDateRangeComparator.js +1 -0
- package/date-picker/lib/cjs/MonthDateRangeComparator.js.map +1 -1
- package/date-picker/lib/cjs/components/Calendar.js +21 -21
- package/date-picker/lib/cjs/components/DateRangeComparatorAbstract.js +26 -25
- package/date-picker/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/date-picker/lib/cjs/components/InputTrigger.js +40 -31
- package/date-picker/lib/cjs/components/InputTrigger.js.map +1 -1
- package/date-picker/lib/cjs/components/PickerAbstract.js +27 -27
- package/date-picker/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/date-picker/lib/cjs/components/RangePickerAbstract.js +26 -25
- package/date-picker/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/date-picker/lib/cjs/style/date-picker.shadow.css +4 -0
- package/date-picker/lib/es6/DateRangeComparator.js +1 -0
- package/date-picker/lib/es6/DateRangeComparator.js.map +1 -1
- package/date-picker/lib/es6/MonthDateRangeComparator.js +1 -0
- package/date-picker/lib/es6/MonthDateRangeComparator.js.map +1 -1
- package/date-picker/lib/es6/components/Calendar.js +21 -21
- package/date-picker/lib/es6/components/DateRangeComparatorAbstract.js +26 -25
- package/date-picker/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/date-picker/lib/es6/components/InputTrigger.js +40 -31
- package/date-picker/lib/es6/components/InputTrigger.js.map +1 -1
- package/date-picker/lib/es6/components/PickerAbstract.js +27 -27
- package/date-picker/lib/es6/components/PickerAbstract.js.map +1 -1
- package/date-picker/lib/es6/components/RangePickerAbstract.js +26 -25
- package/date-picker/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/date-picker/lib/es6/style/date-picker.shadow.css +4 -0
- package/divider/index.js +25 -1
- package/divider/lib/cjs/Divider.js +9 -9
- package/divider/lib/es6/Divider.js +9 -9
- package/dot/index.js +25 -1
- package/dot/lib/cjs/Dot.js +10 -10
- package/dot/lib/es6/Dot.js +10 -10
- package/drag-and-drop/index.js +25 -1
- package/drag-and-drop/lib/cjs/DragAndDrop.js +12 -12
- package/drag-and-drop/lib/es6/DragAndDrop.js +12 -12
- package/dropdown/index.js +25 -1
- package/dropdown/lib/cjs/Dropdown.js +2 -2
- package/dropdown/lib/es6/Dropdown.js +2 -2
- package/dropdown-menu/index.js +25 -1
- package/dropdown-menu/lib/cjs/DropdownMenu.js +12 -12
- package/dropdown-menu/lib/cjs/styleScrollArea.js +6 -6
- package/dropdown-menu/lib/es6/DropdownMenu.js +12 -12
- package/dropdown-menu/lib/es6/styleScrollArea.js +6 -6
- package/ellipsis/index.js +25 -1
- package/ellipsis/lib/cjs/Ellipsis.js +10 -10
- package/ellipsis/lib/es6/Ellipsis.js +10 -10
- package/errors/index.js +25 -1
- package/errors/lib/cjs/Error.js +9 -9
- package/errors/lib/es6/Error.js +9 -9
- package/feature-popover/index.js +25 -1
- package/feature-popover/lib/cjs/FeaturePopover.js +10 -10
- package/feature-popover/lib/es6/FeaturePopover.js +10 -10
- package/feedback-form/index.js +25 -1
- package/feedback-form/lib/cjs/FeedbackForm.js +7 -7
- package/feedback-form/lib/es6/FeedbackForm.js +7 -7
- package/flags/index.js +25 -1
- package/flags/lib/cjs/Flags.js +3 -3
- package/flags/lib/es6/Flags.js +3 -3
- package/flags/lib/sprites/sprite@1x.css +256 -256
- package/flags/lib/sprites/sprite@2x.css +257 -257
- package/flex-box/index.js +25 -1
- package/flex-box/lib/cjs/Box/useBox.js +3 -3
- package/flex-box/lib/cjs/Flex/useFlex.js +3 -3
- package/flex-box/lib/es6/Box/useBox.js +3 -3
- package/flex-box/lib/es6/Flex/useFlex.js +3 -3
- package/format-text/index.js +25 -1
- package/format-text/lib/cjs/FormatText.js +5 -5
- package/format-text/lib/es6/FormatText.js +5 -5
- package/fullscreen-modal/index.js +25 -1
- package/fullscreen-modal/lib/cjs/FullscreenModal.js +13 -13
- package/fullscreen-modal/lib/es6/FullscreenModal.js +13 -13
- package/grid/index.js +25 -1
- package/grid/lib/cjs/Grid.js +114 -114
- package/grid/lib/es6/Grid.js +114 -114
- package/i18n-unplugin/index.js +25 -1
- package/icon/color/Confluence/l/index.js +4 -4
- package/icon/color/Confluence/l/index.mjs +4 -4
- package/icon/color/Confluence/m/index.js +4 -4
- package/icon/color/Confluence/m/index.mjs +4 -4
- package/icon/color/MicrosoftOffice/l/index.js +10 -10
- package/icon/color/MicrosoftOffice/l/index.mjs +10 -10
- package/icon/color/MicrosoftOffice/m/index.js +10 -10
- package/icon/color/MicrosoftOffice/m/index.mjs +10 -10
- package/icon/index.js +25 -1
- package/icon/lib/cjs/Icon.js +5 -5
- package/icon/lib/es6/Icon.js +5 -5
- package/icon/pay/Discover/l/index.js +1 -1
- package/icon/pay/Discover/l/index.mjs +1 -1
- package/icon/pay/Discover/m/index.js +1 -1
- package/icon/pay/Discover/m/index.mjs +1 -1
- package/icon/pay/JCB/l/index.js +10 -10
- package/icon/pay/JCB/l/index.mjs +10 -10
- package/icon/pay/JCB/m/index.js +10 -10
- package/icon/pay/JCB/m/index.mjs +10 -10
- package/icon/pay/Visa/l/index.js +2 -2
- package/icon/pay/Visa/l/index.mjs +2 -2
- package/icon/pay/Visa/m/index.js +2 -2
- package/icon/pay/Visa/m/index.mjs +2 -2
- package/illustration/index.js +25 -1
- package/illustration/lib/cjs/index.js +1 -1
- package/illustration/lib/es6/index.js +1 -1
- package/inline-edit/index.js +25 -1
- package/inline-edit/lib/cjs/InlineEdit.js +4 -4
- package/inline-edit/lib/es6/InlineEdit.js +4 -4
- package/inline-input/index.js +25 -1
- package/inline-input/lib/cjs/InlineInput.js +26 -20
- package/inline-input/lib/cjs/InlineInput.js.map +1 -1
- package/inline-input/lib/cjs/style/inline-input.shadow.css +7 -0
- package/inline-input/lib/es6/InlineInput.js +26 -20
- package/inline-input/lib/es6/InlineInput.js.map +1 -1
- package/inline-input/lib/es6/style/inline-input.shadow.css +7 -0
- package/input/index.js +25 -1
- package/input/lib/cjs/Input.js +21 -19
- package/input/lib/cjs/Input.js.map +1 -1
- package/input/lib/cjs/style/input.shadow.css +7 -6
- package/input/lib/es6/Input.js +21 -19
- package/input/lib/es6/Input.js.map +1 -1
- package/input/lib/es6/style/input.shadow.css +7 -6
- package/input-mask/index.js +25 -1
- package/input-mask/lib/cjs/InputMask.js +6 -6
- package/input-mask/lib/es6/InputMask.js +6 -6
- package/input-number/index.js +25 -1
- package/input-number/lib/cjs/InputNumber.js +9 -9
- package/input-number/lib/es6/InputNumber.js +9 -9
- package/input-tags/index.js +25 -1
- package/input-tags/lib/cjs/InputTags.js +57 -42
- package/input-tags/lib/cjs/InputTags.js.map +1 -1
- package/input-tags/lib/cjs/style/input-tag.shadow.css +2 -6
- package/input-tags/lib/es6/InputTags.js +57 -42
- package/input-tags/lib/es6/InputTags.js.map +1 -1
- package/input-tags/lib/es6/style/input-tag.shadow.css +2 -6
- package/link/index.js +25 -1
- package/link/lib/cjs/Link.js +12 -12
- package/link/lib/es6/Link.js +12 -12
- package/modal/index.js +25 -1
- package/modal/lib/cjs/Modal.js +11 -9
- package/modal/lib/cjs/Modal.js.map +1 -1
- package/modal/lib/es6/Modal.js +11 -9
- package/modal/lib/es6/Modal.js.map +1 -1
- package/neighbor-location/index.js +25 -1
- package/notice/index.js +25 -1
- package/notice/lib/cjs/Notice.js +13 -13
- package/notice/lib/es6/Notice.js +13 -13
- package/notice-bubble/index.js +25 -1
- package/notice-bubble/lib/cjs/NoticeBubble.js +12 -12
- package/notice-bubble/lib/es6/NoticeBubble.js +12 -12
- package/notice-global/index.js +25 -1
- package/notice-global/lib/cjs/NoticeGlobal.js +11 -11
- package/notice-global/lib/es6/NoticeGlobal.js +11 -11
- package/outside-click/index.js +25 -1
- package/package.json +3 -3
- package/pagination/index.js +25 -1
- package/pagination/lib/cjs/Pagination.js +10 -10
- package/pagination/lib/es6/Pagination.js +10 -10
- package/pills/index.js +25 -1
- package/pills/lib/cjs/Pills.js +17 -17
- package/pills/lib/es6/Pills.js +17 -17
- package/popper/index.js +25 -1
- package/popper/lib/cjs/Popper.js +6 -6
- package/popper/lib/es6/Popper.js +6 -6
- package/portal/index.js +25 -1
- package/product-head/index.js +25 -1
- package/product-head/lib/cjs/Info.js +4 -4
- package/product-head/lib/cjs/ProductHead.js +5 -5
- package/product-head/lib/cjs/Title.js +4 -4
- package/product-head/lib/es6/Info.js +4 -4
- package/product-head/lib/es6/ProductHead.js +5 -5
- package/product-head/lib/es6/Title.js +4 -4
- package/progress-bar/index.js +25 -1
- package/progress-bar/lib/cjs/ProgressBar.js +15 -15
- package/progress-bar/lib/es6/ProgressBar.js +15 -15
- package/radio/index.js +25 -1
- package/radio/lib/cjs/Radio.js +23 -16
- package/radio/lib/cjs/Radio.js.map +1 -1
- package/radio/lib/cjs/style/radio.shadow.css +7 -0
- package/radio/lib/es6/Radio.js +23 -16
- package/radio/lib/es6/Radio.js.map +1 -1
- package/radio/lib/es6/style/radio.shadow.css +7 -0
- package/scroll-area/index.js +25 -1
- package/scroll-area/lib/cjs/ScrollArea.js +9 -9
- package/scroll-area/lib/cjs/ScrollBar.js +5 -5
- package/scroll-area/lib/es6/ScrollArea.js +9 -9
- package/scroll-area/lib/es6/ScrollBar.js +5 -5
- package/select/index.js +25 -1
- package/select/lib/cjs/InputSearch.js +6 -6
- package/select/lib/cjs/Select.js +7 -7
- package/select/lib/es6/InputSearch.js +6 -6
- package/select/lib/es6/Select.js +7 -7
- package/side-panel/index.js +25 -1
- package/side-panel/lib/cjs/SidePanel.js +15 -15
- package/side-panel/lib/es6/SidePanel.js +15 -15
- package/skeleton/index.js +25 -1
- package/skeleton/lib/cjs/Charts/Area.js +9 -9
- package/skeleton/lib/cjs/Charts/Bar.js +9 -9
- package/skeleton/lib/cjs/Charts/Bubble.js +9 -9
- package/skeleton/lib/cjs/Charts/Donut.js +9 -9
- package/skeleton/lib/cjs/Charts/Histogram.js +9 -9
- package/skeleton/lib/cjs/Charts/Line.js +9 -9
- package/skeleton/lib/cjs/Charts/RadialTree.js +9 -9
- package/skeleton/lib/cjs/Charts/ScatterPlot.js +9 -9
- package/skeleton/lib/cjs/Charts/Venn.js +9 -9
- package/skeleton/lib/cjs/Skeleton.js +8 -8
- package/skeleton/lib/es6/Charts/Area.js +9 -9
- package/skeleton/lib/es6/Charts/Bar.js +9 -9
- package/skeleton/lib/es6/Charts/Bubble.js +9 -9
- package/skeleton/lib/es6/Charts/Donut.js +9 -9
- package/skeleton/lib/es6/Charts/Histogram.js +9 -9
- package/skeleton/lib/es6/Charts/Line.js +9 -9
- package/skeleton/lib/es6/Charts/RadialTree.js +9 -9
- package/skeleton/lib/es6/Charts/ScatterPlot.js +9 -9
- package/skeleton/lib/es6/Charts/Venn.js +9 -9
- package/skeleton/lib/es6/Skeleton.js +8 -8
- package/slider/index.js +25 -1
- package/slider/lib/cjs/Slider.js +7 -7
- package/slider/lib/es6/Slider.js +7 -7
- package/spin/index.js +25 -1
- package/spin/lib/cjs/Spin.js +13 -13
- package/spin/lib/es6/Spin.js +13 -13
- package/spin-container/index.js +25 -1
- package/spin-container/lib/cjs/SpinContainer.js +8 -8
- package/spin-container/lib/es6/SpinContainer.js +8 -8
- package/sticky/index.js +25 -1
- package/sticky/lib/cjs/Sticky.js +2 -2
- package/sticky/lib/es6/Sticky.js +2 -2
- package/switch/index.js +25 -1
- package/switch/lib/cjs/Switch.js +21 -21
- package/switch/lib/es6/Switch.js +21 -21
- package/tab-line/index.js +25 -1
- package/tab-line/lib/cjs/TabLine.js +13 -13
- package/tab-line/lib/es6/TabLine.js +13 -13
- package/tab-panel/index.js +25 -1
- package/tab-panel/lib/cjs/TabPanel.js +8 -8
- package/tab-panel/lib/es6/TabPanel.js +8 -8
- package/tag/index.js +25 -1
- package/tag/lib/cjs/Tag.js +19 -19
- package/tag/lib/es6/Tag.js +19 -19
- package/textarea/index.js +25 -1
- package/textarea/lib/cjs/Textarea.js +8 -8
- package/textarea/lib/cjs/style/textarea.shadow.css +8 -1
- package/textarea/lib/es6/Textarea.js +8 -8
- package/textarea/lib/es6/style/textarea.shadow.css +8 -1
- package/time-picker/index.js +25 -1
- package/time-picker/lib/cjs/TimePicker.js +12 -12
- package/time-picker/lib/es6/TimePicker.js +12 -12
- package/tooltip/index.d.ts +2 -1
- package/tooltip/index.js +25 -1
- package/tooltip/lib/cjs/Tooltip.js +6 -6
- package/tooltip/lib/cjs/index.d.js.map +1 -1
- package/tooltip/lib/es6/Tooltip.js +6 -6
- package/tooltip/lib/es6/index.d.js.map +1 -1
- package/tooltip/lib/types/index.d.ts +2 -1
- package/typography/index.js +25 -1
- package/typography/lib/cjs/Blockquote.js +4 -4
- package/typography/lib/cjs/Hint.js +7 -7
- package/typography/lib/cjs/List.js +5 -5
- package/typography/lib/cjs/Text.js +34 -34
- package/typography/lib/es6/Blockquote.js +4 -4
- package/typography/lib/es6/Hint.js +7 -7
- package/typography/lib/es6/List.js +5 -5
- package/typography/lib/es6/Text.js +34 -34
- package/utils/lib/propsForElement.js +1 -2
- package/utils/lib/propsForElement.js.map +1 -1
- package/utils/lib/propsForElement.mjs +1 -2
- package/utils/lib/propsForElement.mjs.map +1 -1
- package/utils/lib/use/useFocusLock.js +2 -2
- package/utils/lib/use/useFocusLock.js.map +1 -1
- package/utils/lib/use/useFocusLock.mjs +2 -2
- package/utils/lib/use/useFocusLock.mjs.map +1 -1
- package/widget-empty/index.js +25 -1
- package/widget-empty/lib/cjs/WidgetEmpty.js +5 -5
- package/widget-empty/lib/es6/WidgetEmpty.js +5 -5
- package/wizard/index.js +25 -1
- package/wizard/lib/cjs/Wizard.js +11 -11
- package/wizard/lib/es6/Wizard.js +11 -11
@@ -0,0 +1,84 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
2
|
+
import cn from 'classnames';
|
3
|
+
import { sstyled } from '../styled';
|
4
|
+
import { forkRef } from './ref';
|
5
|
+
export function callAllEventHandlers() {
|
6
|
+
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
|
7
|
+
fns[_key] = arguments[_key];
|
8
|
+
}
|
9
|
+
return function () {
|
10
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
11
|
+
args[_key2] = arguments[_key2];
|
12
|
+
}
|
13
|
+
return !fns.some(function (fn) {
|
14
|
+
var result;
|
15
|
+
if (fn) {
|
16
|
+
result = fn.apply(void 0, args);
|
17
|
+
}
|
18
|
+
return typeof result === 'boolean' && !result;
|
19
|
+
});
|
20
|
+
};
|
21
|
+
}
|
22
|
+
export function assignHandlers(props, source) {
|
23
|
+
return Object.keys(source).reduce(function (proxySource, propName) {
|
24
|
+
if (typeof source[propName] === 'function' && propName.startsWith('on')) {
|
25
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
26
|
+
}
|
27
|
+
return proxySource;
|
28
|
+
}, {});
|
29
|
+
}
|
30
|
+
function assignHandlersInner(props, source) {
|
31
|
+
return Object.keys(source).reduce(function (proxySource, propName) {
|
32
|
+
if (propName !== 'ref' && propName.startsWith('on')) {
|
33
|
+
if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {
|
34
|
+
proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);
|
35
|
+
} else if (typeof source[propName] === 'function') {
|
36
|
+
proxySource[propName] = source[propName];
|
37
|
+
} else if (typeof props[propName] === 'function') {
|
38
|
+
proxySource[propName] = props[propName];
|
39
|
+
}
|
40
|
+
}
|
41
|
+
return proxySource;
|
42
|
+
}, {});
|
43
|
+
}
|
44
|
+
export default function assignProps() {
|
45
|
+
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
46
|
+
var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
47
|
+
// @ts-ignore
|
48
|
+
if (props === source) return props;
|
49
|
+
var newProps = _objectSpread(_objectSpread(_objectSpread({}, source), props), assignHandlersInner(props, source));
|
50
|
+
for (var _key3 in source) {
|
51
|
+
if (_key3.startsWith('use:')) {
|
52
|
+
var originalKey = _key3.slice('use:'.length);
|
53
|
+
newProps[originalKey] = source[_key3];
|
54
|
+
}
|
55
|
+
}
|
56
|
+
for (var _key4 in props) {
|
57
|
+
if (_key4.startsWith('use:')) {
|
58
|
+
var _originalKey = _key4.slice('use:'.length);
|
59
|
+
newProps[_originalKey] = props[_key4];
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
// because react set getter for ref
|
64
|
+
var sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');
|
65
|
+
var propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');
|
66
|
+
if (sourceDescriptorRef !== null && sourceDescriptorRef !== void 0 && sourceDescriptorRef.configurable && propsDescriptorRef !== null && propsDescriptorRef !== void 0 && propsDescriptorRef.configurable) {
|
67
|
+
newProps.ref = forkRef(source.ref, props.ref);
|
68
|
+
}
|
69
|
+
if (props.forwardRef) {
|
70
|
+
newProps.ref = forkRef(newProps.ref, props.forwardRef);
|
71
|
+
newProps.forwardRef = newProps.ref;
|
72
|
+
}
|
73
|
+
if (source.style && props.style) {
|
74
|
+
newProps.style = _objectSpread(_objectSpread({}, source.style), props.style);
|
75
|
+
}
|
76
|
+
if (source.className) {
|
77
|
+
newProps.className = cn(props.className, source.className);
|
78
|
+
}
|
79
|
+
if (source.styles && props.styles) {
|
80
|
+
newProps.styles = sstyled.merge(source.styles, props.styles);
|
81
|
+
}
|
82
|
+
return newProps;
|
83
|
+
}
|
84
|
+
//# sourceMappingURL=assignProps.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"assignProps.js","names":["cn","sstyled","forkRef","callAllEventHandlers","_len","arguments","length","fns","Array","_key","_len2","args","_key2","some","fn","result","apply","assignHandlers","props","source","Object","keys","reduce","proxySource","propName","startsWith","assignHandlersInner","assignProps","undefined","newProps","_objectSpread","key","originalKey","slice","sourceDescriptorRef","getOwnPropertyDescriptor","propsDescriptorRef","configurable","ref","forwardRef","style","className","styles","merge"],"sources":["../../../src/utils/assignProps.ts"],"sourcesContent":["import { CSSProperties, Ref } from 'react';\nimport cn from 'classnames';\nimport { sstyled } from '../styled';\nimport { forkRef } from './ref';\n\nexport function callAllEventHandlers(...fns: Array<Function | undefined>) {\n return (...args: any[]) =>\n !fns.some((fn) => {\n let result;\n if (fn) {\n result = fn(...args);\n }\n return typeof result === 'boolean' && !result;\n });\n}\n\nexport function assignHandlers(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (typeof source[propName] === 'function' && propName.startsWith('on')) {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n }\n return proxySource;\n }, {});\n}\n\nfunction assignHandlersInner(props: any, source: any) {\n return Object.keys(source).reduce((proxySource: any, propName) => {\n if (propName !== 'ref' && propName.startsWith('on')) {\n if (typeof source[propName] === 'function' && typeof props[propName] === 'function') {\n proxySource[propName] = callAllEventHandlers(props[propName], source[propName]);\n } else if (typeof source[propName] === 'function') {\n proxySource[propName] = source[propName];\n } else if (typeof props[propName] === 'function') {\n proxySource[propName] = props[propName];\n }\n }\n return proxySource;\n }, {});\n}\n\nexport interface AssignableProps {\n ref?: Ref<any>;\n style?: CSSProperties;\n className?: string;\n styles?: { [key: string]: string };\n\n [key: string]: any;\n}\n\nexport default function assignProps<P extends AssignableProps, S extends AssignableProps>(\n props: P = {} as P,\n source: S = {} as S,\n) {\n // @ts-ignore\n if (props === source) return props;\n const newProps = {\n ...source,\n ...props,\n ...assignHandlersInner(props, source),\n };\n for (const key in source) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = source[key];\n }\n }\n for (const key in props) {\n if (key.startsWith('use:')) {\n const originalKey = key.slice('use:'.length);\n newProps[originalKey] = props[key];\n }\n }\n\n // because react set getter for ref\n const sourceDescriptorRef = Object.getOwnPropertyDescriptor(source, 'ref');\n const propsDescriptorRef = Object.getOwnPropertyDescriptor(props, 'ref');\n if (sourceDescriptorRef?.configurable && propsDescriptorRef?.configurable) {\n newProps.ref = forkRef(source.ref as any, props.ref as any);\n }\n\n if (props.forwardRef) {\n newProps.ref = forkRef(newProps.ref as any, props.forwardRef as any);\n newProps.forwardRef = newProps.ref;\n }\n\n if (source.style && props.style) {\n newProps.style = {\n ...source.style,\n ...props.style,\n };\n }\n\n if (source.className) {\n newProps.className = cn(props.className, source.className);\n }\n\n if (source.styles && props.styles) {\n newProps.styles = sstyled.merge(source.styles, props.styles);\n }\n\n return newProps;\n}\n"],"mappings":";AACA,OAAOA,EAAE,MAAM,YAAY;AAC3B,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,OAAO,QAAQ,OAAO;AAE/B,OAAO,SAASC,oBAAoBA,CAAA,EAAsC;EAAA,SAAAC,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAlCC,GAAG,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;IAAHF,GAAG,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;EAAA;EACzC,OAAO;IAAA,SAAAC,KAAA,GAAAL,SAAA,CAAAC,MAAA,EAAIK,IAAI,OAAAH,KAAA,CAAAE,KAAA,GAAAE,KAAA,MAAAA,KAAA,GAAAF,KAAA,EAAAE,KAAA;MAAJD,IAAI,CAAAC,KAAA,IAAAP,SAAA,CAAAO,KAAA;IAAA;IAAA,OACb,CAACL,GAAG,CAACM,IAAI,CAAC,UAACC,EAAE,EAAK;MAChB,IAAIC,MAAM;MACV,IAAID,EAAE,EAAE;QACNC,MAAM,GAAGD,EAAE,CAAAE,KAAA,SAAIL,IAAI,CAAC;MACtB;MACA,OAAO,OAAOI,MAAM,KAAK,SAAS,IAAI,CAACA,MAAM;IAC/C,CAAC,CA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,YAAY,IAAID,kBAAkB,aAAlBA,kBAAkB,eAAlBA,kBAAkB,CAAEC,YAAY,EAAE;IACzER,QAAQ,CAACS,GAAG,GAAGpC,OAAO,CAACiB,MAAM,CAACmB,GAAG,EAASpB,KAAK,CAACoB,GAAG,CAAQ;EAC7D;EAEA,IAAIpB,KAAK,CAACqB,UAAU,EAAE;IACpBV,QAAQ,CAACS,GAAG,GAAGpC,OAAO,CAAC2B,QAAQ,CAACS,GAAG,EAASpB,KAAK,CAACqB,UAAU,CAAQ;IACpEV,QAAQ,CAACU,UAAU,GAAGV,QAAQ,CAACS,GAAG;EACpC;EAEA,IAAInB,MAAM,CAACqB,KAAK,IAAItB,KAAK,CAACsB,KAAK,EAAE;IAC/BX,QAAQ,CAACW,KAAK,GAAAV,aAAA,CAAAA,aAAA,KACTX,MAAM,CAACqB,KAAK,GACZtB,KAAK,CAACsB,KAAK,CACf;EACH;EAEA,IAAIrB,MAAM,CAACsB,SAAS,EAAE;IACpBZ,QAAQ,CAACY,SAAS,GAAGzC,EAAE,CAACkB,KAAK,CAACuB,SAAS,EAAEtB,MAAM,CAACsB,SAAS,CAAC;EAC5D;EAEA,IAAItB,MAAM,CAACuB,MAAM,IAAIxB,KAAK,CAACwB,MAAM,EAAE;IACjCb,QAAQ,CAACa,MAAM,GAAGzC,OAAO,CAAC0C,KAAK,CAACxB,MAAM,CAACuB,MAAM,EAAExB,KAAK,CAACwB,MAAM,CAAC;EAC9D;EAEA,OAAOb,QAAQ;AACjB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"canUseDOM.js","names":["window","document","createElement"],"sources":["../../../src/utils/canUseDOM.ts"],"sourcesContent":["export default function () {\n return !!(typeof window !== 'undefined' && window.document && window.document.createElement);\n}\n"],"mappings":"AAAA,eAAe,YAAY;EACzB,OAAO,CAAC,EAAE,OAAOA,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACC,QAAQ,IAAID,MAAM,CAACC,QAAQ,CAACC,aAAa,CAAC;AAC9F"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"capitalizeFirstLetter.js","names":["capitalizeFirstLetter","input","charAt","toUpperCase","slice"],"sources":["../../../src/utils/capitalizeFirstLetter.ts"],"sourcesContent":["export default function capitalizeFirstLetter(input: string) {\n return input.charAt(0).toUpperCase() + input.slice(1);\n}\n"],"mappings":"AAAA,eAAe,SAASA,qBAAqBA,CAACC,KAAa,EAAE;EAC3D,OAAOA,KAAK,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE,GAAGF,KAAK,CAACG,KAAK,CAAC,CAAC,CAAC;AACvD"}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
5
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
7
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
8
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
9
|
+
var _excluded = ["forwardedRef"];
|
10
|
+
import React, { PureComponent } from 'react';
|
11
|
+
import hoistNonReactStatics from 'hoist-non-react-statics';
|
12
|
+
import getDisplayName from './getDisplayName';
|
13
|
+
function createHoc(EnhancedComponent) {
|
14
|
+
return function createWrapper() {
|
15
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
16
|
+
return function (WrappedComponent) {
|
17
|
+
var Component = /*#__PURE__*/function (_PureComponent) {
|
18
|
+
_inherits(Component, _PureComponent);
|
19
|
+
var _super = _createSuper(Component);
|
20
|
+
function Component() {
|
21
|
+
_classCallCheck(this, Component);
|
22
|
+
return _super.apply(this, arguments);
|
23
|
+
}
|
24
|
+
_createClass(Component, [{
|
25
|
+
key: "render",
|
26
|
+
value: function render() {
|
27
|
+
// @ts-ignore
|
28
|
+
var _WrappedComponent$def = _objectSpread(_objectSpread({}, WrappedComponent.defaultProps), this.props),
|
29
|
+
forwardedRef = _WrappedComponent$def.forwardedRef,
|
30
|
+
others = _objectWithoutProperties(_WrappedComponent$def, _excluded);
|
31
|
+
return /*#__PURE__*/React.createElement(EnhancedComponent, _extends({}, options, this.props), function (enhancedComponentProps) {
|
32
|
+
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({
|
33
|
+
forwardedRef: forwardedRef
|
34
|
+
}, others, enhancedComponentProps));
|
35
|
+
});
|
36
|
+
}
|
37
|
+
}]);
|
38
|
+
return Component;
|
39
|
+
}(PureComponent);
|
40
|
+
_defineProperty(Component, "displayName", getDisplayName(WrappedComponent));
|
41
|
+
return hoistNonReactStatics(Component, WrappedComponent);
|
42
|
+
};
|
43
|
+
};
|
44
|
+
}
|
45
|
+
export default createHoc;
|
46
|
+
//# sourceMappingURL=createHoc.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createHoc.js","names":["React","PureComponent","hoistNonReactStatics","getDisplayName","createHoc","EnhancedComponent","createWrapper","options","arguments","length","undefined","WrappedComponent","Component","_PureComponent","_inherits","_super","_createSuper","_classCallCheck","apply","_createClass","key","value","render","_WrappedComponent$def","_objectSpread","defaultProps","props","forwardedRef","others","_objectWithoutProperties","_excluded","createElement","_extends","enhancedComponentProps","_defineProperty"],"sources":["../../../src/utils/createHoc.tsx"],"sourcesContent":["import React, { ComponentClass, ComponentType, PureComponent } from 'react';\nimport hoistNonReactStatics from 'hoist-non-react-statics';\nimport getDisplayName from './getDisplayName';\n\nfunction createHoc(\n EnhancedComponent: any,\n): (options?: {}) => (WrappedComponent: ComponentType) => ComponentClass {\n return function createWrapper(options = {}) {\n return (WrappedComponent) => {\n class Component extends PureComponent {\n static displayName = getDisplayName(WrappedComponent);\n\n render() {\n // @ts-ignore\n const { forwardedRef, ...others } = { ...WrappedComponent.defaultProps, ...this.props };\n return (\n <EnhancedComponent {...options} {...this.props}>\n {(enhancedComponentProps: any) => (\n <WrappedComponent\n forwardedRef={forwardedRef}\n {...others}\n {...enhancedComponentProps}\n />\n )}\n </EnhancedComponent>\n );\n }\n }\n\n return hoistNonReactStatics(Component, WrappedComponent);\n };\n };\n}\n\nexport default createHoc;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IAAmCC,aAAa,QAAQ,OAAO;AAC3E,OAAOC,oBAAoB,MAAM,yBAAyB;AAC1D,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,SAASC,SAASA,CAChBC,iBAAsB,EACiD;EACvE,OAAO,SAASC,aAAaA,CAAA,EAAe;IAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IACxC,OAAO,UAACG,gBAAgB,EAAK;MAAA,IACrBC,SAAS,0BAAAC,cAAA;QAAAC,SAAA,CAAAF,SAAA,EAAAC,cAAA;QAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,SAAA;QAAA,SAAAA,UAAA;UAAAK,eAAA,OAAAL,SAAA;UAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAV,SAAA;QAAA;QAAAW,YAAA,CAAAP,SAAA;UAAAQ,GAAA;UAAAC,KAAA,EAGb,SAAAC,OAAA,EAAS;YACP;YACA,IAAAC,qBAAA,GAAAC,aAAA,CAAAA,aAAA,KAAyCb,gBAAgB,CAACc,YAAY,GAAK,IAAI,CAACC,KAAK;cAA7EC,YAAY,GAAAJ,qBAAA,CAAZI,YAAY;cAAKC,MAAM,GAAAC,wBAAA,CAAAN,qBAAA,EAAAO,SAAA;YAC/B,oBACE9B,KAAA,CAAA+B,aAAA,CAAC1B,iBAAiB,EAAA2B,QAAA,KAAKzB,OAAO,EAAM,IAAI,CAACmB,KAAK,GAC3C,UAACO,sBAA2B;cAAA,oBAC3BjC,KAAA,CAAA+B,aAAA,CAACpB,gBAAgB,EAAAqB,QAAA;gBACfL,YAAY,EAAEA;cAAa,GACvBC,MAAM,EACNK,sBAAsB,EAC1B;YAAA,CACH,CACiB;UAExB;QAAC;QAAA,OAAArB,SAAA;MAAA,EAjBqBX,aAAa;MAAAiC,eAAA,CAA/BtB,SAAS,iBACQT,cAAc,CAACQ,gBAAgB,CAAC;MAmBvD,OAAOT,oBAAoB,CAACU,SAAS,EAAED,gBAAgB,CAAC;IAC1D,CAAC;EACH,CAAC;AACH;AAEA,eAAeP,SAAS"}
|
@@ -0,0 +1,73 @@
|
|
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 React, { Component, createContext } from 'react';
|
8
|
+
import createHoc from '../createHoc';
|
9
|
+
import { interpolate, useAsyncI18nMessages } from './i18nEnhance';
|
10
|
+
export var Context = /*#__PURE__*/createContext(undefined);
|
11
|
+
var I18nProvider = Context.Provider,
|
12
|
+
I18nConsumer = Context.Consumer;
|
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
|
+
|
20
|
+
/** @deprecated */
|
21
|
+
/**
|
22
|
+
* @deprecated use `useI18n` instead
|
23
|
+
*/
|
24
|
+
var WithI18n = /*#__PURE__*/function (_Component) {
|
25
|
+
_inherits(WithI18n, _Component);
|
26
|
+
var _super = _createSuper(WithI18n);
|
27
|
+
function WithI18n() {
|
28
|
+
var _this;
|
29
|
+
_classCallCheck(this, WithI18n);
|
30
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
31
|
+
args[_key] = arguments[_key];
|
32
|
+
}
|
33
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
34
|
+
/* @ts-ignore */
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "context", void 0);
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "getText", function (dictionary, selfLocale) {
|
37
|
+
var _this$props = _this.props,
|
38
|
+
locale = _this$props.locale,
|
39
|
+
getText = _this$props.getText;
|
40
|
+
var contextLocale = _this.context;
|
41
|
+
return getText(dictionary, selfLocale || locale || contextLocale);
|
42
|
+
});
|
43
|
+
return _this;
|
44
|
+
}
|
45
|
+
_createClass(WithI18n, [{
|
46
|
+
key: "render",
|
47
|
+
value: function render() {
|
48
|
+
var _ref = this.props,
|
49
|
+
children = _ref.children;
|
50
|
+
return children({
|
51
|
+
getText: this.getText
|
52
|
+
});
|
53
|
+
}
|
54
|
+
}]);
|
55
|
+
return WithI18n;
|
56
|
+
}(Component);
|
57
|
+
_defineProperty(WithI18n, "contextType", Context);
|
58
|
+
_defineProperty(WithI18n, "defaultProps", {
|
59
|
+
getText: getText
|
60
|
+
});
|
61
|
+
var useI18n = function useI18n(dictionary) {
|
62
|
+
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
63
|
+
var fallbackDictionary = arguments.length > 2 ? arguments[2] : undefined;
|
64
|
+
var lang = React.useContext(Context);
|
65
|
+
var resolvedDictionary = useAsyncI18nMessages(dictionary, lang || locale, fallbackDictionary);
|
66
|
+
return React.useCallback(function (messageId, variables) {
|
67
|
+
var _resolvedDictionary$m;
|
68
|
+
return interpolate((_resolvedDictionary$m = resolvedDictionary[messageId]) !== null && _resolvedDictionary$m !== void 0 ? _resolvedDictionary$m : '', variables);
|
69
|
+
}, [resolvedDictionary]);
|
70
|
+
};
|
71
|
+
export default createHoc(WithI18n);
|
72
|
+
export { useI18n, I18nProvider, I18nConsumer };
|
73
|
+
//# sourceMappingURL=WithI18n.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WithI18n.js","names":["React","Component","createContext","createHoc","interpolate","useAsyncI18nMessages","Context","undefined","I18nProvider","Provider","I18nConsumer","Consumer","getText","dictionaries","locale","key","dictionary","WithI18n","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","selfLocale","_this$props","props","contextLocale","context","_createClass","value","render","_ref","children","useI18n","fallbackDictionary","lang","useContext","resolvedDictionary","useCallback","messageId","variables","_resolvedDictionary$m"],"sources":["../../../../src/utils/enhances/WithI18n.tsx"],"sourcesContent":["import React, { Component, createContext } from 'react';\nimport createHoc from '../createHoc';\nimport { interpolate, useAsyncI18nMessages } from './i18nEnhance';\nimport {UnknownProperties} from \"../../index\";\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;\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);\n const resolvedDictionary = useAsyncI18nMessages(dictionary, lang || locale, fallbackDictionary);\n return React.useCallback(\n (messageId: string, variables?: { [key: string]: string | number | undefined }) => {\n return interpolate(resolvedDictionary[messageId] ?? '', variables);\n },\n [resolvedDictionary],\n );\n};\n\nexport default createHoc(WithI18n);\nexport { useI18n, I18nProvider, I18nConsumer };\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,aAAa,QAAQ,OAAO;AACvD,OAAOC,SAAS,MAAM,cAAc;AACpC,SAASC,WAAW,EAAEC,oBAAoB,QAAQ,eAAe;AAMjE,OAAO,IAAMC,OAAO,gBAAGJ,aAAa,CAAyBK,SAAS,CAAC;AACvE,IAAkBC,YAAY,GAA6BF,OAAO,CAA1DG,QAAQ;EAA0BC,YAAY,GAAKJ,OAAO,CAAlCK,QAAQ;AAExC,SAASC,OAAOA,CAACC,YAAwB,EAAEC,MAAkB,EAAE;EAC7D,OAAO,UAAUC,GAAyB,EAAE;IAC1C,IAAMC,UAAU,GAAGH,YAAY,CAACC,MAAM,CAAC;IACvC,OAAOE,UAAU,GAAIA,UAAU,CAASD,GAAG,CAAC,GAAIF,YAAY,CAAS,IAAI,CAAC,CAACE,GAAG,CAAC;EACjF,CAAC;AACH;;AAEA;AAcA;AACA;AACA;AAFA,IAGME,QAAQ,0BAAAC,UAAA;EAAAC,SAAA,CAAAF,QAAA,EAAAC,UAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,QAAA;EAAA,SAAAA,SAAA;IAAA,IAAAK,KAAA;IAAAC,eAAA,OAAAN,QAAA;IAAA,SAAAO,IAAA,GAAAC,S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QAAAlB,SAAA,GAAAkB,SAAA,MAAG,IAAI;EAAA,IACzBqB,kBAA+B,GAAArB,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAlB,SAAA;EAE/B,IAAMwC,IAAI,GAAG/C,KAAK,CAACgD,UAAU,CAAC1C,OAAO,CAAC;EACtC,IAAM2C,kBAAkB,GAAG5C,oBAAoB,CAACW,UAAU,EAAE+B,IAAI,IAAIjC,MAAM,EAAEgC,kBAAkB,CAAC;EAC/F,OAAO9C,KAAK,CAACkD,WAAW,CACtB,UAACC,SAAiB,EAAEC,SAA0D,EAAK;IAAA,IAAAC,qBAAA;IACjF,OAAOjD,WAAW,EAAAiD,qBAAA,GAACJ,kBAAkB,CAACE,SAAS,CAAC,cAAAE,qBAAA,cAAAA,qBAAA,GAAI,EAAE,EAAED,SAAS,CAAC;EACpE,CAAC,EACD,CAACH,kBAAkB,CAAC,CACrB;AACH,CAAC;AAED,eAAe9C,SAAS,CAACc,QAAQ,CAAC;AAClC,SAAS4B,OAAO,EAAErC,YAAY,EAAEE,YAAY"}
|
@@ -0,0 +1,122 @@
|
|
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
|
+
var interpolationRegex = /{(.*?)}/g;
|
10
|
+
var escapeHtml = function escapeHtml(html) {
|
11
|
+
return String(html).split('').map(function (_char) {
|
12
|
+
switch (_char) {
|
13
|
+
case '<':
|
14
|
+
return '<';
|
15
|
+
case '>':
|
16
|
+
return '>';
|
17
|
+
case '&':
|
18
|
+
return '&';
|
19
|
+
case '"':
|
20
|
+
return '"';
|
21
|
+
case '`':
|
22
|
+
return '`';
|
23
|
+
}
|
24
|
+
return _char;
|
25
|
+
}).join('');
|
26
|
+
};
|
27
|
+
export function interpolate(template) {
|
28
|
+
var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
29
|
+
return template.replace(interpolationRegex, function (_, key) {
|
30
|
+
if (variables[key] !== undefined) {
|
31
|
+
return escapeHtml(variables[key]);
|
32
|
+
}
|
33
|
+
return _;
|
34
|
+
});
|
35
|
+
}
|
36
|
+
|
37
|
+
/** @deprecated */
|
38
|
+
|
39
|
+
export var useAsyncI18nMessages = function useAsyncI18nMessages(primaryContainer, locale, fallbackContainer) {
|
40
|
+
var _store$locale;
|
41
|
+
var container = React.useMemo(function () {
|
42
|
+
if (!fallbackContainer) return primaryContainer;
|
43
|
+
if (!primaryContainer) return fallbackContainer;
|
44
|
+
if (primaryContainer === fallbackContainer) return primaryContainer;
|
45
|
+
var container = {};
|
46
|
+
var _loop = function _loop(_locale) {
|
47
|
+
if (typeof primaryContainer[_locale] === 'function' || typeof fallbackContainer[_locale] === 'function') {
|
48
|
+
container[_locale] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
49
|
+
var _yield$Promise$all, _yield$Promise$all2, primary, fallback;
|
50
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
51
|
+
while (1) switch (_context.prev = _context.next) {
|
52
|
+
case 0:
|
53
|
+
_context.next = 2;
|
54
|
+
return Promise.all([primaryContainer[_locale], fallbackContainer[_locale]]);
|
55
|
+
case 2:
|
56
|
+
_yield$Promise$all = _context.sent;
|
57
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
58
|
+
primary = _yield$Promise$all2[0];
|
59
|
+
fallback = _yield$Promise$all2[1];
|
60
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, primary), fallback));
|
61
|
+
case 7:
|
62
|
+
case "end":
|
63
|
+
return _context.stop();
|
64
|
+
}
|
65
|
+
}, _callee);
|
66
|
+
}));
|
67
|
+
} else {
|
68
|
+
var _primaryContainer$_lo, _fallbackContainer$_l;
|
69
|
+
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 : {});
|
70
|
+
}
|
71
|
+
};
|
72
|
+
for (var _locale in primaryContainer) {
|
73
|
+
_loop(_locale);
|
74
|
+
}
|
75
|
+
return container;
|
76
|
+
}, [primaryContainer, fallbackContainer]);
|
77
|
+
var initStore = React.useMemo(function () {
|
78
|
+
var store = {};
|
79
|
+
for (var _locale2 in container) {
|
80
|
+
if (_typeof(container[_locale2]) === 'object') {
|
81
|
+
store[_locale2] = container[_locale2];
|
82
|
+
}
|
83
|
+
}
|
84
|
+
return store;
|
85
|
+
}, [container]);
|
86
|
+
var _React$useState = React.useState(initStore),
|
87
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
88
|
+
store = _React$useState2[0],
|
89
|
+
setStore = _React$useState2[1];
|
90
|
+
var lastLoadedLocaleRef = React.useRef(null);
|
91
|
+
if (store[locale]) lastLoadedLocaleRef.current = locale;
|
92
|
+
var fallbackMessages = React.useMemo(function () {
|
93
|
+
return Object.values(store)[0];
|
94
|
+
}, [store]);
|
95
|
+
var loadingLocaleRef = React.useRef(null);
|
96
|
+
React.useEffect(function () {
|
97
|
+
loadingLocaleRef.current = locale;
|
98
|
+
var asyncMessages = container[locale];
|
99
|
+
if (typeof asyncMessages === 'function') {
|
100
|
+
asyncMessages().then(function (module) {
|
101
|
+
if (loadingLocaleRef.current !== locale) return;
|
102
|
+
var messages = module;
|
103
|
+
if ('default' in module && _typeof(module["default"]) === 'object') messages = module["default"];
|
104
|
+
setStore(function (store) {
|
105
|
+
return _objectSpread(_objectSpread({}, store), {}, _defineProperty({}, locale, messages));
|
106
|
+
});
|
107
|
+
})["catch"](console.error);
|
108
|
+
}
|
109
|
+
}, [container, locale]);
|
110
|
+
return (_store$locale = store[locale]) !== null && _store$locale !== void 0 ? _store$locale : fallbackMessages;
|
111
|
+
};
|
112
|
+
export default (function (container) {
|
113
|
+
return function (props) {
|
114
|
+
var i18n = props.i18n,
|
115
|
+
locale = props.locale;
|
116
|
+
var getI18nText = useI18n(i18n, locale, container);
|
117
|
+
return _objectSpread(_objectSpread({}, props), {}, {
|
118
|
+
getI18nText: getI18nText
|
119
|
+
});
|
120
|
+
};
|
121
|
+
});
|
122
|
+
//# sourceMappingURL=i18nEnhance.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"i18nEnhance.js","names":["React","useI18n","interpolationRegex","escapeHtml","html","String","split","map","char","join","interpolate","template","variables","arguments","length","undefined","replace","_","key","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 \"../../index\";\n\nconst interpolationRegex = /{(.*?)}/g;\n\nconst escapeHtml = (html: string) =>\n String(html)\n .split('')\n .map((char) => {\n switch (char) {\n case '<':\n return '<';\n case '>':\n return '>';\n case '&':\n return '&';\n case '\"':\n return '"';\n case '`':\n return '`';\n }\n return char;\n })\n .join('');\n\nexport function interpolate(template: string, variables: {} = {}) {\n return template.replace(interpolationRegex, (_, key) => {\n if ((variables as any)[key] !== undefined) {\n return escapeHtml((variables as any)[key]);\n }\n return _;\n });\n}\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;AAGhD,IAAMC,kBAAkB,GAAG,UAAU;AAErC,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAY;EAAA,OAC9BC,MAAM,CAACD,IAAI,CAAC,CACTE,KAAK,CAAC,EAAE,CAAC,CACTC,GAAG,CAAC,UAACC,KAAI,EAAK;IACb,QAAQA,KAAI;MACV,KAAK,GAAG;QACN,OAAO,MAAM;MACf,KAAK,GAAG;QACN,OAAO,MAAM;MACf,KAAK,GAAG;QACN,OAAO,OAAO;MAChB,KAAK,GAAG;QACN,OAAO,QAAQ;MACjB,KAAK,GAAG;QACN,OAAO,OAAO;IAAC;IAEnB,OAAOA,KAAI;EACb,CAAC,CAAC,CACDC,IAAI,CAAC,EAAE,CAAC;AAAA;AAEb,OAAO,SAASC,WAAWA,CAACC,QAAgB,EAAsB;EAAA,IAApBC,SAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAC9D,OAAOF,QAAQ,CAACK,OAAO,CAACd,kBAAkB,EAAE,UAACe,CAAC,EAAEC,GAAG,EAAK;IACtD,IAAKN,SAAS,CAASM,GAAG,CAAC,KAAKH,SAAS,EAAE;MACzC,OAAOZ,UAAU,CAAES,SAAS,CAASM,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KmD,KAAK,CAAhBnD,MAAM;IACpB,IAAMqD,WAAW,GAAGzE,OAAO,CAACwE,IAAI,EAAEpD,MAAM,EAAEG,SAAS,CAAC;IAEpD,OAAAsB,aAAA,CAAAA,aAAA,KAAY0B,KAAK;MAAEE,WAAW,EAAXA;IAAW;EAChC,CAAC;AACH,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getDisplayName.js","names":["getDisplayName","WrappedComponent","displayName","name"],"sources":["../../../src/utils/getDisplayName.ts"],"sourcesContent":["import { ComponentType } from 'react';\n\nexport default function getDisplayName(WrappedComponent: ComponentType) {\n return WrappedComponent.displayName || WrappedComponent.name || 'Component';\n}\n"],"mappings":"AAEA,eAAe,SAASA,cAAcA,CAACC,gBAA+B,EAAE;EACtE,OAAOA,gBAAgB,CAACC,WAAW,IAAID,gBAAgB,CAACE,IAAI,IAAI,WAAW;AAC7E"}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
2
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
|
+
var DEV = process.env.NODE_ENV !== 'production';
|
5
|
+
var Logger = /*#__PURE__*/function () {
|
6
|
+
function Logger(logger) {
|
7
|
+
_classCallCheck(this, Logger);
|
8
|
+
_defineProperty(this, "logger", void 0);
|
9
|
+
this.logger = logger || {
|
10
|
+
warn: function warn() {}
|
11
|
+
};
|
12
|
+
}
|
13
|
+
_createClass(Logger, [{
|
14
|
+
key: "console",
|
15
|
+
value: function console(level, msg, component) {
|
16
|
+
this.logger[level](component ? "[".concat(component, "]: ").concat(msg) : msg);
|
17
|
+
}
|
18
|
+
}, {
|
19
|
+
key: "warn",
|
20
|
+
value: function warn(condition, msg, component) {
|
21
|
+
if (DEV) {
|
22
|
+
if (condition) {
|
23
|
+
this.console('warn', msg, component);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}]);
|
28
|
+
return Logger;
|
29
|
+
}();
|
30
|
+
export { Logger };
|
31
|
+
export default new Logger(console);
|
32
|
+
//# sourceMappingURL=logger.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logger.js","names":["DEV","process","env","NODE_ENV","Logger","logger","_classCallCheck","_defineProperty","warn","_createClass","key","value","console","level","msg","component","concat","condition"],"sources":["../../../src/utils/logger.ts"],"sourcesContent":["const DEV = process.env.NODE_ENV !== 'production';\n\nclass Logger {\n private logger: any;\n\n constructor(logger?: typeof console) {\n this.logger = logger || {\n warn: () => {},\n };\n }\n\n console(level: string, msg: string, component: any) {\n this.logger[level](component ? `[${component}]: ${msg}` : msg);\n }\n\n warn(condition: any, msg: string, component: any) {\n if (DEV) {\n if (condition) {\n this.console('warn', msg, component);\n }\n }\n }\n}\nexport { Logger };\nexport default new Logger(console);\n"],"mappings":";;;AAAA,IAAMA,GAAG,GAAGC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY;AAAC,IAE5CC,MAAM;EAGV,SAAAA,OAAYC,MAAuB,EAAE;IAAAC,eAAA,OAAAF,MAAA;IAAAG,eAAA;IACnC,IAAI,CAACF,MAAM,GAAGA,MAAM,IAAI;MACtBG,IAAI,EAAE,SAAAA,KAAA,EAAM,CAAC;IACf,CAAC;EACH;EAACC,YAAA,CAAAL,MAAA;IAAAM,GAAA;IAAAC,KAAA,EAED,SAAAC,QAAQC,KAAa,EAAEC,GAAW,EAAEC,SAAc,EAAE;MAClD,IAAI,CAACV,MAAM,CAACQ,KAAK,CAAC,CAACE,SAAS,OAAAC,MAAA,CAAOD,SAAS,SAAAC,MAAA,CAAMF,GAAG,IAAKA,GAAG,CAAC;IAChE;EAAC;IAAAJ,GAAA;IAAAC,KAAA,EAED,SAAAH,KAAKS,SAAc,EAAEH,GAAW,EAAEC,SAAc,EAAE;MAChD,IAAIf,GAAG,EAAE;QACP,IAAIiB,SAAS,EAAE;UACb,IAAI,CAACL,OAAO,CAAC,MAAM,EAAEE,GAAG,EAAEC,SAAS,CAAC;QACtC;MACF;IACF;EAAC;EAAA,OAAAX,MAAA;AAAA;AAEH,SAASA,MAAM;AACf,eAAe,IAAIA,MAAM,CAACQ,OAAO,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pick.js","names":["pick","obj","keys","res","len","length","idx","key"],"sources":["../../../src/utils/pick.ts"],"sourcesContent":["export default function pick<T extends {}, K extends keyof T>(obj: T, keys: K[]) {\n const res: any = {};\n const len = keys.length;\n let idx = -1;\n while (++idx < len) {\n const key = keys[idx];\n if (key in obj) {\n res[key] = obj[key];\n }\n }\n return res as Pick<T, K>;\n}\n"],"mappings":"AAAA,eAAe,SAASA,IAAIA,CAAkCC,GAAM,EAAEC,IAAS,EAAE;EAC/E,IAAMC,GAAQ,GAAG,CAAC,CAAC;EACnB,IAAMC,GAAG,GAAGF,IAAI,CAACG,MAAM;EACvB,IAAIC,GAAG,GAAG,CAAC,CAAC;EACZ,OAAO,EAAEA,GAAG,GAAGF,GAAG,EAAE;IAClB,IAAMG,GAAG,GAAGL,IAAI,CAACI,GAAG,CAAC;IACrB,IAAIC,GAAG,IAAIN,GAAG,EAAE;MACdE,GAAG,CAACI,GAAG,CAAC,GAAGN,GAAG,CAACM,GAAG,CAAC;IACrB;EACF;EACA,OAAOJ,GAAG;AACZ"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import React from 'react';
|
4
|
+
import { findDOMNode } from 'react-dom';
|
5
|
+
export function setRef(ref, value) {
|
6
|
+
if (typeof ref === 'function') {
|
7
|
+
ref(value);
|
8
|
+
} else if (ref !== null && ref !== void 0 && ref.hasOwnProperty('current')) {
|
9
|
+
// @ts-ignore
|
10
|
+
ref['current'] = value;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
export function getRef(ref) {
|
14
|
+
if (!ref) return null;
|
15
|
+
return 'current' in ref ? ref.current : ref;
|
16
|
+
}
|
17
|
+
export function useCallbackRef(initialValue, callback) {
|
18
|
+
var _React$useState = React.useState(function () {
|
19
|
+
return {
|
20
|
+
// value
|
21
|
+
value: initialValue,
|
22
|
+
// last callback
|
23
|
+
callback: callback,
|
24
|
+
// "memoized" public interface
|
25
|
+
facade: {
|
26
|
+
get current() {
|
27
|
+
return ref.value;
|
28
|
+
},
|
29
|
+
set current(value) {
|
30
|
+
var last = ref.value;
|
31
|
+
if (last !== value) {
|
32
|
+
ref.value = value;
|
33
|
+
ref.callback(value, last);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
}),
|
39
|
+
_React$useState2 = _slicedToArray(_React$useState, 1),
|
40
|
+
ref = _React$useState2[0];
|
41
|
+
// update callback
|
42
|
+
ref.callback = callback;
|
43
|
+
return ref.facade;
|
44
|
+
}
|
45
|
+
export function useForkRef() {
|
46
|
+
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
47
|
+
refs[_key] = arguments[_key];
|
48
|
+
}
|
49
|
+
return React.useCallback(function (refValue) {
|
50
|
+
var uniqueRefs = _toConsumableArray(new Set(refs));
|
51
|
+
uniqueRefs.forEach(function (ref) {
|
52
|
+
return setRef(ref, refValue);
|
53
|
+
});
|
54
|
+
}, refs);
|
55
|
+
}
|
56
|
+
export function forkRef() {
|
57
|
+
for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
58
|
+
refs[_key2] = arguments[_key2];
|
59
|
+
}
|
60
|
+
if (refs.every(function (ref) {
|
61
|
+
return ref == null;
|
62
|
+
})) {
|
63
|
+
return null;
|
64
|
+
}
|
65
|
+
return function (refValue) {
|
66
|
+
var uniqueRefs = _toConsumableArray(new Set(refs));
|
67
|
+
uniqueRefs.forEach(function (ref) {
|
68
|
+
return setRef(ref, refValue);
|
69
|
+
});
|
70
|
+
};
|
71
|
+
}
|
72
|
+
export function getNodeByRef(ref) {
|
73
|
+
if (typeof ref === 'function') {
|
74
|
+
ref = ref();
|
75
|
+
}
|
76
|
+
if (!ref) return null;
|
77
|
+
var node = getRef(ref);
|
78
|
+
if (!node) return null;
|
79
|
+
if (node.nodeType === 1) return node;
|
80
|
+
return findDOMNode(node);
|
81
|
+
}
|
82
|
+
//# sourceMappingURL=ref.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ref.js","names":["React","findDOMNode","setRef","ref","value","hasOwnProperty","getRef","current","useCallbackRef","initialValue","callback","_React$useState","useState","facade","last","_React$useState2","_slicedToArray","useForkRef","_len","arguments","length","refs","Array","_key","useCallback","refValue","uniqueRefs","_toConsumableArray","Set","forEach","forkRef","_len2","_key2","every","getNodeByRef","node","nodeType"],"sources":["../../../src/utils/ref.ts"],"sourcesContent":["import React, { MutableRefObject, Ref, RefObject } from 'react';\nimport { findDOMNode } from 'react-dom';\n\nexport function setRef<T>(ref: Ref<T>, value: T) {\n if (typeof ref === 'function') {\n ref(value);\n } else if (ref?.hasOwnProperty('current')) {\n // @ts-ignore\n ref['current'] = value;\n }\n}\n\nexport function getRef(ref: RefObject<Element> | Element): Element | null {\n if (!ref) return null;\n return 'current' in ref ? ref.current : ref;\n}\n\nexport function useCallbackRef<T>(\n initialValue: T | null,\n callback: (newValue: T | null, lastValue: T | null) => void,\n): MutableRefObject<T | null> {\n const [ref] = React.useState(() => ({\n // value\n value: initialValue,\n // last callback\n callback,\n // \"memoized\" public interface\n facade: {\n get current() {\n return ref.value;\n },\n set current(value) {\n const last = ref.value;\n if (last !== value) {\n ref.value = value;\n ref.callback(value, last);\n }\n },\n },\n }));\n // update callback\n ref.callback = callback;\n\n return ref.facade;\n}\n\nexport function useForkRef<T>(...refs: Ref<T>[]): Ref<T> {\n return React.useCallback((refValue: any) => {\n const uniqueRefs = [...new Set(refs)];\n uniqueRefs.forEach((ref) => setRef(ref, refValue));\n }, refs);\n}\n\nexport function forkRef<T>(...refs: Ref<T>[]): Ref<T> {\n if (refs.every((ref) => ref == null)) {\n return null;\n }\n return (refValue) => {\n const uniqueRefs = [...new Set(refs)];\n uniqueRefs.forEach((ref) => setRef(ref, refValue));\n };\n}\n\nexport type NodeByRef = RefObject<Element> | Element | (() => RefObject<Element> | Element);\n\nexport function getNodeByRef(ref: NodeByRef): Element | null {\n if (typeof ref === 'function') {\n ref = ref();\n }\n if (!ref) return null;\n\n const node = getRef(ref);\n if (!node) return null;\n if (node.nodeType === 1) return node;\n\n return findDOMNode(node) as Element;\n}\n"],"mappings":";;AAAA,OAAOA,KAAK,MAA4C,OAAO;AAC/D,SAASC,WAAW,QAAQ,WAAW;AAEvC,OAAO,SAASC,MAAMA,CAAIC,GAAW,EAAEC,KAAQ,EAAE;EAC/C,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7BA,GAAG,CAACC,KAAK,CAAC;EACZ,CAAC,MAAM,IAAID,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEE,cAAc,CAAC,SAAS,CAAC,EAAE;IACzC;IACAF,GAAG,CAAC,SAAS,CAAC,GAAGC,KAAK;EACxB;AACF;AAEA,OAAO,SAASE,MAAMA,CAACH,GAAiC,EAAkB;EACxE,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;EACrB,OAAO,SAAS,IAAIA,GAAG,GAAGA,GAAG,CAACI,OAAO,GAAGJ,GAAG;AAC7C;AAEA,OAAO,SAASK,cAAcA,CAC5BC,YAAsB,EACtBC,QAA2D,EAC/B;EAC5B,IAAAC,eAAA,GAAcX,KAAK,CAACY,QAAQ,CAAC;MAAA,OAAO;QAClC;QACAR,KAAK,EAAEK,YAAY;QACnB;QACAC,QAAQ,EAARA,QAAQ;QACR;QACAG,MAAM,EAAE;UACN,IAAIN,OAAOA,CAAA,EAAG;YACZ,OAAOJ,GAAG,CAACC,KAAK;UAClB,CAAC;UACD,IAAIG,OAAOA,CAACH,KAAK,EAAE;YACjB,IAAMU,IAA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,OAAO,IAAI;EACb;EACA,OAAO,UAACsB,QAAQ,EAAK;IACnB,IAAMC,UAAU,GAAAC,kBAAA,CAAO,IAAIC,GAAG,CAACP,IAAI,CAAC,CAAC;IACrCK,UAAU,CAACG,OAAO,CAAC,UAAC1B,GAAG;MAAA,OAAKD,MAAM,CAACC,GAAG,EAAEsB,QAAQ,CAAC;IAAA,EAAC;EACpD,CAAC;AACH;AAIA,OAAO,SAASS,YAAYA,CAAC/B,GAAc,EAAkB;EAC3D,IAAI,OAAOA,GAAG,KAAK,UAAU,EAAE;IAC7BA,GAAG,GAAGA,GAAG,EAAE;EACb;EACA,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;EAErB,IAAMgC,IAAI,GAAG7B,MAAM,CAACH,GAAG,CAAC;EACxB,IAAI,CAACgC,IAAI,EAAE,OAAO,IAAI;EACtB,IAAIA,IAAI,CAACC,QAAQ,KAAK,CAAC,EAAE,OAAOD,IAAI;EAEpC,OAAOlC,WAAW,CAACkC,IAAI,CAAC;AAC1B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useEnhancedEffect.js","names":["React","canUseDOM","useEnhancedEffect","useLayoutEffect","useEffect"],"sources":["../../../../src/utils/use/useEnhancedEffect.ts"],"sourcesContent":["import React from 'react';\nimport canUseDOM from '../canUseDOM';\n\nconst useEnhancedEffect = canUseDOM() ? React.useLayoutEffect : React.useEffect;\n\nexport default useEnhancedEffect;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,cAAc;AAEpC,IAAMC,iBAAiB,GAAGD,SAAS,EAAE,GAAGD,KAAK,CAACG,eAAe,GAAGH,KAAK,CAACI,SAAS;AAE/E,eAAeF,iBAAiB"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CSSProperties, Ref } from 'react';
|
2
|
+
export declare function callAllEventHandlers(...fns: Array<Function | undefined>): (...args: any[]) => boolean;
|
3
|
+
export declare function assignHandlers(props: any, source: any): any;
|
4
|
+
export interface AssignableProps {
|
5
|
+
ref?: Ref<any>;
|
6
|
+
style?: CSSProperties;
|
7
|
+
className?: string;
|
8
|
+
styles?: {
|
9
|
+
[key: string]: string;
|
10
|
+
};
|
11
|
+
[key: string]: any;
|
12
|
+
}
|
13
|
+
export default function assignProps<P extends AssignableProps, S extends AssignableProps>(props?: P, source?: S): any;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function (): boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
export default function capitalizeFirstLetter(input: string): string;
|