intergalactic 15.122.0 → 15.124.0-prerelease.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/accordion/lib/cjs/Accordion.js +9 -9
- package/accordion/lib/es6/Accordion.js +9 -9
- package/accordion/package.json +1 -1
- package/add-filter/AddFilter.d.ts +3 -0
- package/add-filter/AddFilter.types.d.ts +62 -0
- package/add-filter/components/AddFilterDropdown.d.ts +4 -0
- package/add-filter/components/AddFilterInput.d.ts +4 -0
- package/add-filter/components/AddFilterSelect.d.ts +3 -0
- package/add-filter/index.d.ts +3 -0
- package/add-filter/index.js +8 -0
- package/add-filter/index.mjs +2 -0
- package/add-filter/lib/cjs/AddFilter.js +336 -0
- package/add-filter/lib/cjs/AddFilter.js.map +1 -0
- package/add-filter/lib/cjs/AddFilter.types.js +2 -0
- package/add-filter/lib/cjs/AddFilter.types.js.map +1 -0
- package/add-filter/lib/cjs/components/AddFilterDropdown.js +92 -0
- package/add-filter/lib/cjs/components/AddFilterDropdown.js.map +1 -0
- package/add-filter/lib/cjs/components/AddFilterInput.js +87 -0
- package/add-filter/lib/cjs/components/AddFilterInput.js.map +1 -0
- package/add-filter/lib/cjs/components/AddFilterSelect.js +103 -0
- package/add-filter/lib/cjs/components/AddFilterSelect.js.map +1 -0
- package/add-filter/lib/cjs/index.js +38 -0
- package/add-filter/lib/cjs/index.js.map +1 -0
- package/add-filter/lib/cjs/translations/__intergalactic-dynamic-locales.js +39 -0
- package/add-filter/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/add-filter/lib/cjs/translations/de.json +4 -0
- package/add-filter/lib/cjs/translations/en.json +5 -0
- package/add-filter/lib/cjs/translations/es.json +4 -0
- package/add-filter/lib/cjs/translations/fr.json +4 -0
- package/add-filter/lib/cjs/translations/it.json +4 -0
- package/add-filter/lib/cjs/translations/ja.json +4 -0
- package/add-filter/lib/cjs/translations/ko.json +4 -0
- package/add-filter/lib/cjs/translations/nl.json +4 -0
- package/add-filter/lib/cjs/translations/pl.json +4 -0
- package/add-filter/lib/cjs/translations/pt.json +4 -0
- package/add-filter/lib/cjs/translations/sv.json +4 -0
- package/add-filter/lib/cjs/translations/tr.json +4 -0
- package/add-filter/lib/cjs/translations/vi.json +4 -0
- package/add-filter/lib/cjs/translations/zh.json +4 -0
- package/add-filter/lib/es6/AddFilter.js +328 -0
- package/add-filter/lib/es6/AddFilter.js.map +1 -0
- package/add-filter/lib/es6/AddFilter.types.js +2 -0
- package/add-filter/lib/es6/AddFilter.types.js.map +1 -0
- package/add-filter/lib/es6/components/AddFilterDropdown.js +84 -0
- package/add-filter/lib/es6/components/AddFilterDropdown.js.map +1 -0
- package/add-filter/lib/es6/components/AddFilterInput.js +80 -0
- package/add-filter/lib/es6/components/AddFilterInput.js.map +1 -0
- package/add-filter/lib/es6/components/AddFilterSelect.js +95 -0
- package/add-filter/lib/es6/components/AddFilterSelect.js.map +1 -0
- package/add-filter/lib/es6/index.js +4 -0
- package/add-filter/lib/es6/index.js.map +1 -0
- package/add-filter/lib/es6/translations/__intergalactic-dynamic-locales.js +31 -0
- package/add-filter/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/add-filter/lib/es6/translations/de.json +4 -0
- package/add-filter/lib/es6/translations/en.json +5 -0
- package/add-filter/lib/es6/translations/es.json +4 -0
- package/add-filter/lib/es6/translations/fr.json +4 -0
- package/add-filter/lib/es6/translations/it.json +4 -0
- package/add-filter/lib/es6/translations/ja.json +4 -0
- package/add-filter/lib/es6/translations/ko.json +4 -0
- package/add-filter/lib/es6/translations/nl.json +4 -0
- package/add-filter/lib/es6/translations/pl.json +4 -0
- package/add-filter/lib/es6/translations/pt.json +4 -0
- package/add-filter/lib/es6/translations/sv.json +4 -0
- package/add-filter/lib/es6/translations/tr.json +4 -0
- package/add-filter/lib/es6/translations/vi.json +4 -0
- package/add-filter/lib/es6/translations/zh.json +4 -0
- package/add-filter/lib/types/AddFilter.d.ts +3 -0
- package/add-filter/lib/types/AddFilter.types.d.ts +62 -0
- package/add-filter/lib/types/components/AddFilterDropdown.d.ts +4 -0
- package/add-filter/lib/types/components/AddFilterInput.d.ts +4 -0
- package/add-filter/lib/types/components/AddFilterSelect.d.ts +3 -0
- package/add-filter/lib/types/index.d.ts +3 -0
- package/add-filter/lib/types/translations/__intergalactic-dynamic-locales.d.ts +59 -0
- package/add-filter/package.json +1 -0
- package/add-filter/translations/__intergalactic-dynamic-locales.d.ts +59 -0
- 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/animation/package.json +1 -1
- package/badge/lib/cjs/Badge.js +6 -6
- package/badge/lib/es6/Badge.js +6 -6
- package/badge/package.json +1 -1
- package/base-trigger/lib/cjs/BaseTrigger.js +18 -18
- 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/es6/BaseTrigger.js +18 -18
- 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/package.json +1 -1
- package/breadcrumbs/lib/cjs/Breadcrumbs.js +8 -8
- package/breadcrumbs/lib/es6/Breadcrumbs.js +8 -8
- package/breadcrumbs/package.json +1 -1
- package/breakpoints/package.json +1 -1
- package/bulk-textarea/BulkTextarea.d.ts +3 -0
- package/bulk-textarea/BulkTextarea.types.d.ts +33 -0
- package/bulk-textarea/components/ClearAll.d.ts +7 -0
- package/bulk-textarea/components/Counter.d.ts +10 -0
- package/bulk-textarea/components/ErrorsNavigation.d.ts +15 -0
- package/bulk-textarea/components/InputField/InputField.d.ts +98 -0
- package/bulk-textarea/components/InputField/InputField.types.d.ts +157 -0
- package/bulk-textarea/index.d.ts +3 -0
- package/bulk-textarea/index.js +8 -0
- package/bulk-textarea/index.mjs +2 -0
- package/bulk-textarea/lib/cjs/BulkTextarea.js +318 -0
- package/bulk-textarea/lib/cjs/BulkTextarea.js.map +1 -0
- package/bulk-textarea/lib/cjs/BulkTextarea.types.js +2 -0
- package/bulk-textarea/lib/cjs/BulkTextarea.types.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/ClearAll.js +23 -0
- package/bulk-textarea/lib/cjs/components/ClearAll.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/Counter.js +27 -0
- package/bulk-textarea/lib/cjs/components/Counter.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/ErrorsNavigation.js +57 -0
- package/bulk-textarea/lib/cjs/components/ErrorsNavigation.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/InputField/InputField.js +1110 -0
- package/bulk-textarea/lib/cjs/components/InputField/InputField.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/InputField/InputField.types.js +2 -0
- package/bulk-textarea/lib/cjs/components/InputField/InputField.types.js.map +1 -0
- package/bulk-textarea/lib/cjs/components/InputField/inputField.shadow.css +160 -0
- package/bulk-textarea/lib/cjs/index.js +14 -0
- package/bulk-textarea/lib/cjs/index.js.map +1 -0
- package/bulk-textarea/lib/cjs/translations/__intergalactic-dynamic-locales.js +39 -0
- package/bulk-textarea/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/bulk-textarea/lib/cjs/translations/de.json +10 -0
- package/bulk-textarea/lib/cjs/translations/en.json +10 -0
- package/bulk-textarea/lib/cjs/translations/es.json +10 -0
- package/bulk-textarea/lib/cjs/translations/fr.json +10 -0
- package/bulk-textarea/lib/cjs/translations/it.json +10 -0
- package/bulk-textarea/lib/cjs/translations/ja.json +10 -0
- package/bulk-textarea/lib/cjs/translations/ko.json +10 -0
- package/bulk-textarea/lib/cjs/translations/nl.json +10 -0
- package/bulk-textarea/lib/cjs/translations/pl.json +10 -0
- package/bulk-textarea/lib/cjs/translations/pt.json +10 -0
- package/bulk-textarea/lib/cjs/translations/sv.json +10 -0
- package/bulk-textarea/lib/cjs/translations/tr.json +10 -0
- package/bulk-textarea/lib/cjs/translations/vi.json +10 -0
- package/bulk-textarea/lib/cjs/translations/zh.json +10 -0
- package/bulk-textarea/lib/es6/BulkTextarea.js +310 -0
- package/bulk-textarea/lib/es6/BulkTextarea.js.map +1 -0
- package/bulk-textarea/lib/es6/BulkTextarea.types.js +2 -0
- package/bulk-textarea/lib/es6/BulkTextarea.types.js.map +1 -0
- package/bulk-textarea/lib/es6/components/ClearAll.js +17 -0
- package/bulk-textarea/lib/es6/components/ClearAll.js.map +1 -0
- package/bulk-textarea/lib/es6/components/Counter.js +21 -0
- package/bulk-textarea/lib/es6/components/Counter.js.map +1 -0
- package/bulk-textarea/lib/es6/components/ErrorsNavigation.js +50 -0
- package/bulk-textarea/lib/es6/components/ErrorsNavigation.js.map +1 -0
- package/bulk-textarea/lib/es6/components/InputField/InputField.js +1104 -0
- package/bulk-textarea/lib/es6/components/InputField/InputField.js.map +1 -0
- package/bulk-textarea/lib/es6/components/InputField/InputField.types.js +2 -0
- package/bulk-textarea/lib/es6/components/InputField/InputField.types.js.map +1 -0
- package/bulk-textarea/lib/es6/components/InputField/inputField.shadow.css +160 -0
- package/bulk-textarea/lib/es6/index.js +2 -0
- package/bulk-textarea/lib/es6/index.js.map +1 -0
- package/bulk-textarea/lib/es6/translations/__intergalactic-dynamic-locales.js +31 -0
- package/bulk-textarea/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -0
- package/bulk-textarea/lib/es6/translations/de.json +10 -0
- package/bulk-textarea/lib/es6/translations/en.json +10 -0
- package/bulk-textarea/lib/es6/translations/es.json +10 -0
- package/bulk-textarea/lib/es6/translations/fr.json +10 -0
- package/bulk-textarea/lib/es6/translations/it.json +10 -0
- package/bulk-textarea/lib/es6/translations/ja.json +10 -0
- package/bulk-textarea/lib/es6/translations/ko.json +10 -0
- package/bulk-textarea/lib/es6/translations/nl.json +10 -0
- package/bulk-textarea/lib/es6/translations/pl.json +10 -0
- package/bulk-textarea/lib/es6/translations/pt.json +10 -0
- package/bulk-textarea/lib/es6/translations/sv.json +10 -0
- package/bulk-textarea/lib/es6/translations/tr.json +10 -0
- package/bulk-textarea/lib/es6/translations/vi.json +10 -0
- package/bulk-textarea/lib/es6/translations/zh.json +10 -0
- package/bulk-textarea/lib/types/BulkTextarea.d.ts +3 -0
- package/bulk-textarea/lib/types/BulkTextarea.types.d.ts +33 -0
- package/bulk-textarea/lib/types/components/ClearAll.d.ts +7 -0
- package/bulk-textarea/lib/types/components/Counter.d.ts +10 -0
- package/bulk-textarea/lib/types/components/ErrorsNavigation.d.ts +15 -0
- package/bulk-textarea/lib/types/components/InputField/InputField.d.ts +98 -0
- package/bulk-textarea/lib/types/components/InputField/InputField.types.d.ts +157 -0
- package/bulk-textarea/lib/types/index.d.ts +3 -0
- package/bulk-textarea/lib/types/translations/__intergalactic-dynamic-locales.d.ts +142 -0
- package/bulk-textarea/package.json +1 -0
- package/bulk-textarea/translations/__intergalactic-dynamic-locales.d.ts +142 -0
- package/button/lib/cjs/component/Button/Button.js +27 -27
- package/button/lib/cjs/component/Button/button.shadow.css +1 -1
- package/button/lib/cjs/component/ButtonLink/ButtonLink.js +20 -20
- package/button/lib/es6/component/Button/Button.js +27 -27
- package/button/lib/es6/component/Button/button.shadow.css +1 -1
- package/button/lib/es6/component/ButtonLink/ButtonLink.js +20 -20
- package/button/package.json +1 -1
- package/card/lib/cjs/Card.js +6 -6
- package/card/lib/es6/Card.js +6 -6
- package/card/package.json +1 -1
- package/carousel/lib/cjs/Carousel.js +21 -21
- package/carousel/lib/es6/Carousel.js +21 -21
- package/carousel/package.json +1 -1
- package/checkbox/lib/cjs/Checkbox.js +18 -18
- package/checkbox/lib/es6/Checkbox.js +18 -18
- package/checkbox/package.json +1 -1
- package/color-picker/lib/cjs/ColorPicker.js +24 -24
- package/color-picker/lib/cjs/PaletteManager.js +24 -24
- package/color-picker/lib/cjs/components/InputColor.js +24 -24
- package/color-picker/lib/es6/ColorPicker.js +24 -24
- package/color-picker/lib/es6/PaletteManager.js +24 -24
- package/color-picker/lib/es6/components/InputColor.js +24 -24
- package/color-picker/package.json +1 -1
- package/components.json +75 -73
- package/core/package.json +1 -1
- package/counter/lib/cjs/Counter.js +11 -11
- package/counter/lib/cjs/style/counter.shadow.css +1 -0
- package/counter/lib/es6/Counter.js +11 -11
- package/counter/lib/es6/style/counter.shadow.css +1 -0
- package/counter/package.json +1 -1
- package/d3-chart/lib/cjs/Area.js +11 -11
- package/d3-chart/lib/cjs/Axis.js +14 -14
- package/d3-chart/lib/cjs/Bar.js +16 -16
- package/d3-chart/lib/cjs/Bubble.js +12 -12
- package/d3-chart/lib/cjs/CompactHorizontalBar.js +16 -16
- package/d3-chart/lib/cjs/Donut.js +9 -9
- package/d3-chart/lib/cjs/Dots.js +8 -8
- package/d3-chart/lib/cjs/HorizontalBar.js +16 -16
- 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 +19 -19
- package/d3-chart/lib/cjs/RadialTree.js +12 -12
- package/d3-chart/lib/cjs/Reference.js +12 -12
- package/d3-chart/lib/cjs/ScatterPlot.js +9 -9
- package/d3-chart/lib/cjs/Tooltip.js +9 -9
- package/d3-chart/lib/cjs/Venn.js +9 -9
- 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 +17 -17
- package/d3-chart/lib/cjs/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/d3-chart/lib/es6/Area.js +11 -11
- package/d3-chart/lib/es6/Axis.js +14 -14
- package/d3-chart/lib/es6/Bar.js +16 -16
- package/d3-chart/lib/es6/Bubble.js +12 -12
- package/d3-chart/lib/es6/CompactHorizontalBar.js +16 -16
- package/d3-chart/lib/es6/Donut.js +9 -9
- package/d3-chart/lib/es6/Dots.js +8 -8
- package/d3-chart/lib/es6/HorizontalBar.js +16 -16
- 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 +19 -19
- package/d3-chart/lib/es6/RadialTree.js +12 -12
- package/d3-chart/lib/es6/Reference.js +12 -12
- package/d3-chart/lib/es6/ScatterPlot.js +9 -9
- package/d3-chart/lib/es6/Tooltip.js +9 -9
- package/d3-chart/lib/es6/Venn.js +9 -9
- 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 +17 -17
- package/d3-chart/lib/es6/component/ChartLegend/LegendTable/LegendTable.js +6 -6
- package/d3-chart/package.json +1 -1
- package/data-table/lib/cjs/Body.js +4 -4
- package/data-table/lib/cjs/Body.js.map +1 -1
- package/data-table/lib/cjs/DataTable.js +36 -36
- package/data-table/lib/es6/Body.js +4 -4
- package/data-table/lib/es6/Body.js.map +1 -1
- package/data-table/lib/es6/DataTable.js +36 -36
- package/data-table/package.json +1 -1
- package/date-picker/lib/cjs/components/Calendar.js +21 -21
- package/date-picker/lib/cjs/components/DateRangeComparatorAbstract.js +29 -29
- package/date-picker/lib/cjs/components/InputTrigger.js +31 -30
- package/date-picker/lib/cjs/components/InputTrigger.js.map +1 -1
- package/date-picker/lib/cjs/components/PickerAbstract.js +29 -29
- package/date-picker/lib/cjs/components/RangePickerAbstract.js +29 -29
- package/date-picker/lib/es6/components/Calendar.js +21 -21
- package/date-picker/lib/es6/components/DateRangeComparatorAbstract.js +29 -29
- package/date-picker/lib/es6/components/InputTrigger.js +31 -30
- package/date-picker/lib/es6/components/InputTrigger.js.map +1 -1
- package/date-picker/lib/es6/components/PickerAbstract.js +29 -29
- package/date-picker/lib/es6/components/RangePickerAbstract.js +29 -29
- package/date-picker/package.json +1 -1
- package/divider/lib/cjs/Divider.js +10 -10
- package/divider/lib/es6/Divider.js +10 -10
- package/divider/package.json +1 -1
- package/dot/lib/cjs/Dot.js +10 -10
- package/dot/lib/es6/Dot.js +10 -10
- package/dot/package.json +1 -1
- package/drag-and-drop/lib/cjs/DragAndDrop.js +17 -17
- package/drag-and-drop/lib/es6/DragAndDrop.js +17 -17
- package/drag-and-drop/package.json +1 -1
- package/dropdown/lib/cjs/Dropdown.js +16 -16
- package/dropdown/lib/es6/Dropdown.js +16 -16
- package/dropdown/package.json +1 -1
- package/dropdown-menu/lib/cjs/DropdownMenu.js +18 -18
- package/dropdown-menu/lib/es6/DropdownMenu.js +18 -18
- package/dropdown-menu/package.json +1 -1
- package/ellipsis/lib/cjs/Ellipsis.js +10 -10
- package/ellipsis/lib/es6/Ellipsis.js +10 -10
- package/ellipsis/package.json +1 -1
- package/errors/lib/cjs/Error.js +9 -9
- package/errors/lib/es6/Error.js +9 -9
- package/errors/package.json +1 -1
- package/feature-popover/lib/cjs/FeaturePopover.js +11 -11
- package/feature-popover/lib/es6/FeaturePopover.js +11 -11
- package/feature-popover/package.json +1 -1
- package/feedback-form/component/feedback-rating/FeedbackRating.type.d.ts +3 -1
- package/feedback-form/lib/cjs/FeedbackForm.js +7 -7
- package/feedback-form/lib/cjs/component/checkbox-button/CheckboxButton.js +3 -3
- package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js +14 -9
- package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js +7 -7
- package/feedback-form/lib/es6/FeedbackForm.js +7 -7
- package/feedback-form/lib/es6/component/checkbox-button/CheckboxButton.js +3 -3
- package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js +14 -9
- package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.type.js.map +1 -1
- package/feedback-form/lib/es6/component/slider-rating/SliderRating.js +7 -7
- package/feedback-form/lib/types/component/feedback-rating/FeedbackRating.type.d.ts +3 -1
- package/feedback-form/package.json +1 -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/flags/package.json +1 -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/cjs/invalid-state-box/InvalidStateBox.js +2 -2
- package/flex-box/lib/cjs/screen-reader-only-box/ScreenReaderOnlyBox.js +2 -2
- package/flex-box/lib/es6/Box/useBox.js +3 -3
- package/flex-box/lib/es6/Flex/useFlex.js +3 -3
- package/flex-box/lib/es6/invalid-state-box/InvalidStateBox.js +2 -2
- package/flex-box/lib/es6/screen-reader-only-box/ScreenReaderOnlyBox.js +2 -2
- package/flex-box/package.json +1 -1
- package/format-text/lib/cjs/FormatText.js +5 -5
- package/format-text/lib/es6/FormatText.js +5 -5
- package/format-text/package.json +1 -1
- package/fullscreen-modal/lib/cjs/FullscreenModal.js +13 -13
- package/fullscreen-modal/lib/es6/FullscreenModal.js +13 -13
- package/fullscreen-modal/package.json +1 -1
- package/grid/lib/cjs/Grid.js +114 -114
- package/grid/lib/es6/Grid.js +114 -114
- package/grid/package.json +1 -1
- package/i18n-unplugin/package.json +1 -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/Copilot/l/index.d.ts +6 -0
- package/icon/color/Copilot/l/index.js +79 -0
- package/icon/color/Copilot/l/index.mjs +67 -0
- package/icon/color/Copilot/m/index.d.ts +6 -0
- package/icon/color/Copilot/m/index.js +79 -0
- package/icon/color/Copilot/m/index.mjs +67 -0
- package/icon/color/MetaColored/l/index.js +4 -4
- package/icon/color/MetaColored/l/index.mjs +4 -4
- package/icon/color/MetaColored/m/index.js +4 -4
- package/icon/color/MetaColored/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/lib/cjs/Icon.js +5 -5
- package/icon/lib/es6/Icon.js +5 -5
- package/icon/package.json +1 -1
- 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/lib/cjs/index.js +1 -1
- package/illustration/lib/es6/index.js +1 -1
- package/illustration/package.json +1 -1
- package/inline-edit/lib/cjs/InlineEdit.js +4 -4
- package/inline-edit/lib/es6/InlineEdit.js +4 -4
- package/inline-edit/package.json +1 -1
- package/inline-input/lib/cjs/InlineInput.js +14 -14
- package/inline-input/lib/es6/InlineInput.js +14 -14
- package/inline-input/package.json +1 -1
- package/input/lib/cjs/Input.js +17 -17
- package/input/lib/es6/Input.js +17 -17
- package/input/package.json +1 -1
- package/input-mask/InputMask.d.ts +1 -1
- package/input-mask/lib/cjs/InputMask.js +6 -6
- package/input-mask/lib/cjs/InputMask.js.map +1 -1
- package/input-mask/lib/es6/InputMask.js +6 -6
- package/input-mask/lib/es6/InputMask.js.map +1 -1
- package/input-mask/lib/types/InputMask.d.ts +1 -1
- package/input-mask/package.json +1 -1
- package/input-number/lib/cjs/InputNumber.js +10 -10
- package/input-number/lib/cjs/InputNumber.js.map +1 -1
- package/input-number/lib/es6/InputNumber.js +10 -10
- package/input-number/lib/es6/InputNumber.js.map +1 -1
- package/input-number/package.json +1 -1
- package/input-tags/lib/cjs/InputTags.js +12 -12
- package/input-tags/lib/es6/InputTags.js +12 -12
- package/input-tags/package.json +1 -1
- package/link/lib/cjs/Link.js +12 -12
- package/link/lib/es6/Link.js +12 -12
- package/link/package.json +1 -1
- package/mini-chart/lib/cjs/component/score/Donut.js +9 -9
- package/mini-chart/lib/cjs/component/score/Line.js +18 -18
- package/mini-chart/lib/cjs/component/trend/Bar.js +7 -7
- package/mini-chart/lib/cjs/component/trend/Line.js +7 -7
- package/mini-chart/lib/es6/component/score/Donut.js +9 -9
- package/mini-chart/lib/es6/component/score/Line.js +18 -18
- package/mini-chart/lib/es6/component/trend/Bar.js +7 -7
- package/mini-chart/lib/es6/component/trend/Line.js +7 -7
- package/mini-chart/package.json +1 -1
- package/modal/lib/cjs/Modal.js +8 -8
- package/modal/lib/es6/Modal.js +8 -8
- package/modal/package.json +1 -1
- package/neighbor-location/package.json +1 -1
- package/notice/lib/cjs/Notice.js +16 -16
- package/notice/lib/es6/Notice.js +16 -16
- package/notice/package.json +1 -1
- package/notice-bubble/lib/cjs/NoticeBubble.js +15 -15
- package/notice-bubble/lib/es6/NoticeBubble.js +15 -15
- package/notice-bubble/package.json +1 -1
- package/notice-global/lib/cjs/NoticeGlobal.js +11 -11
- package/notice-global/lib/es6/NoticeGlobal.js +11 -11
- package/notice-global/package.json +1 -1
- package/outside-click/package.json +1 -1
- package/package.json +3 -1
- package/pagination/lib/cjs/Pagination.js +10 -10
- package/pagination/lib/es6/Pagination.js +10 -10
- package/pagination/package.json +1 -1
- package/pills/lib/cjs/Pills.js +13 -13
- package/pills/lib/es6/Pills.js +13 -13
- package/pills/package.json +1 -1
- package/popper/index.d.ts +3 -1
- package/popper/lib/cjs/Popper.js +16 -6
- package/popper/lib/cjs/Popper.js.map +1 -1
- package/popper/lib/cjs/createPopper.js +3 -1
- package/popper/lib/cjs/createPopper.js.map +1 -1
- package/popper/lib/cjs/index.d.js.map +1 -1
- package/popper/lib/cjs/modifiers/applyMaxSize.js +34 -0
- package/popper/lib/cjs/modifiers/applyMaxSize.js.map +1 -0
- package/popper/lib/cjs/style/popper.shadow.css +1 -1
- package/popper/lib/es6/Popper.js +16 -6
- package/popper/lib/es6/Popper.js.map +1 -1
- package/popper/lib/es6/createPopper.js +3 -1
- package/popper/lib/es6/createPopper.js.map +1 -1
- package/popper/lib/es6/index.d.js.map +1 -1
- package/popper/lib/es6/modifiers/applyMaxSize.js +26 -0
- package/popper/lib/es6/modifiers/applyMaxSize.js.map +1 -0
- package/popper/lib/es6/style/popper.shadow.css +1 -1
- package/popper/lib/types/index.d.ts +3 -1
- package/popper/package.json +1 -1
- package/portal/package.json +1 -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/product-head/package.json +1 -1
- package/progress-bar/lib/cjs/ProgressBar.js +15 -15
- package/progress-bar/lib/es6/ProgressBar.js +15 -15
- package/progress-bar/package.json +1 -1
- package/radio/lib/cjs/Radio.js +16 -16
- package/radio/lib/es6/Radio.js +16 -16
- package/radio/package.json +1 -1
- package/scroll-area/lib/cjs/ScrollArea.js +21 -21
- package/scroll-area/lib/cjs/ScrollBar.js +6 -6
- package/scroll-area/lib/es6/ScrollArea.js +21 -21
- package/scroll-area/lib/es6/ScrollBar.js +6 -6
- package/scroll-area/package.json +1 -1
- package/select/lib/cjs/InputSearch.js +6 -6
- package/select/lib/cjs/Select.js +8 -8
- package/select/lib/es6/InputSearch.js +6 -6
- package/select/lib/es6/Select.js +8 -8
- package/select/package.json +1 -1
- package/side-panel/lib/cjs/SidePanel.js +16 -16
- package/side-panel/lib/es6/SidePanel.js +16 -16
- package/side-panel/package.json +1 -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/CompactHorizontalBar.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/CompactHorizontalBar.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/skeleton/package.json +1 -1
- package/slider/lib/cjs/Slider.js +8 -8
- package/slider/lib/es6/Slider.js +8 -8
- package/slider/package.json +1 -1
- package/spin/lib/cjs/Spin.js +13 -13
- package/spin/lib/es6/Spin.js +13 -13
- package/spin/package.json +1 -1
- package/spin-container/lib/cjs/SpinContainer.js +42 -12
- package/spin-container/lib/cjs/SpinContainer.js.map +1 -1
- package/spin-container/lib/es6/SpinContainer.js +42 -12
- package/spin-container/lib/es6/SpinContainer.js.map +1 -1
- package/spin-container/package.json +1 -1
- package/sticky/lib/cjs/Sticky.js +2 -2
- package/sticky/lib/es6/Sticky.js +2 -2
- package/sticky/package.json +1 -1
- package/switch/lib/cjs/Switch.js +21 -21
- package/switch/lib/es6/Switch.js +21 -21
- package/switch/package.json +1 -1
- package/tab-line/lib/cjs/TabLine.js +13 -13
- package/tab-line/lib/es6/TabLine.js +13 -13
- package/tab-line/package.json +1 -1
- package/tab-panel/lib/cjs/TabPanel.js +8 -8
- package/tab-panel/lib/es6/TabPanel.js +8 -8
- package/tab-panel/package.json +1 -1
- package/tag/lib/cjs/Tag.js +23 -23
- package/tag/lib/es6/Tag.js +23 -23
- package/tag/package.json +1 -1
- package/textarea/lib/cjs/Textarea.js +8 -8
- package/textarea/lib/es6/Textarea.js +8 -8
- package/textarea/package.json +1 -1
- package/time-picker/lib/cjs/PickerInput.js +1 -0
- package/time-picker/lib/cjs/PickerInput.js.map +1 -1
- package/time-picker/lib/cjs/TimePicker.js +12 -12
- package/time-picker/lib/es6/PickerInput.js +1 -0
- package/time-picker/lib/es6/PickerInput.js.map +1 -1
- package/time-picker/lib/es6/TimePicker.js +12 -12
- package/time-picker/package.json +1 -1
- package/tooltip/lib/cjs/Tooltip.js +9 -9
- package/tooltip/lib/es6/Tooltip.js +9 -9
- package/tooltip/package.json +1 -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/typography/package.json +1 -1
- package/utils/lib/components/invalid-state-pattern/InvalidStatePattern.js +2 -2
- package/utils/lib/components/invalid-state-pattern/InvalidStatePattern.mjs +2 -2
- package/utils/lib/enhances/WithI18n.js +15 -5
- package/utils/lib/enhances/WithI18n.js.map +1 -1
- package/utils/lib/enhances/WithI18n.mjs +16 -6
- package/utils/lib/enhances/WithI18n.mjs.map +1 -1
- package/utils/lib/enhances/i18nEnhance.d.ts +0 -1
- package/utils/lib/enhances/i18nEnhance.js +1 -33
- package/utils/lib/enhances/i18nEnhance.js.map +1 -1
- package/utils/lib/enhances/i18nEnhance.mjs +0 -30
- package/utils/lib/enhances/i18nEnhance.mjs.map +1 -1
- package/utils/lib/injectStyle.js +1 -1
- package/utils/lib/injectStyle.mjs +1 -1
- package/utils/lib/inputProps.js +1 -1
- package/utils/lib/inputProps.js.map +1 -1
- package/utils/lib/inputProps.mjs +1 -1
- package/utils/lib/inputProps.mjs.map +1 -1
- package/widget-empty/lib/cjs/WidgetEmpty.js +5 -5
- package/widget-empty/lib/es6/WidgetEmpty.js +5 -5
- package/widget-empty/package.json +1 -1
- package/wizard/lib/cjs/Wizard.js +12 -12
- package/wizard/lib/es6/Wizard.js +12 -12
- package/wizard/package.json +1 -1
@@ -0,0 +1,1104 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
5
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
7
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
8
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
10
|
+
import { sstyled as _sstyled } from 'intergalactic/utils/lib/core/index';
|
11
|
+
import { assignProps as _assignProps } from 'intergalactic/core';
|
12
|
+
import React from 'react';
|
13
|
+
import { Component, sstyled, Root } from 'intergalactic/core';
|
14
|
+
import { Box } from 'intergalactic/flex-box';
|
15
|
+
/*__reshadow-styles__:"./inputField.shadow.css"*/
|
16
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SInputField_h7hpq_gg_>div{box-sizing:content-box;outline:0;border-radius:var(--intergalactic-control-rounded, 6px);border-color:var(--intergalactic-border-primary, #c4c7cf);border-style:solid;border-width:1px;overflow:auto;position:relative;color:var(--intergalactic-text-primary, #191b23);word-wrap:break-word;word-break:break-word;font-family:inherit}.___SInputField_h7hpq_gg_>div:empty::before{content:\"1. \"attr(placeholder);color:var(--intergalactic-text-placeholder, #8a8e9b);position:absolute}.___SInputField_h7hpq_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_h7hpq_gg_>div:nth-child(even)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, #6c6e79);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SInputField_h7hpq_gg_>div>p{counter-increment:row;display:flex;margin:0 0 var(--intergalactic-spacing-1x, 4px)0;position:relative;word-break:break-all;white-space:pre-wrap;padding-right:20px}.___SInputField_h7hpq_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_h7hpq_gg_>div>p:not(:empty)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, #6c6e79);margin-right:var(--intergalactic-spacing-1x, 4px)}.___SInputField_h7hpq_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7)}.___SInputField_h7hpq_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:8px}.___SInputField_h7hpq_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:16px}.___SInputField_h7hpq_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:8px}.___SInputField_h7hpq_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_h7hpq_gg_.__showErrors_h7hpq_gg_>div[aria-invalid]>p[aria-invalid]:after{content:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjZDEwMDJmIj48cGF0aCBkPSJNNyA2aDJ2NEg3VjZabTIgN3YtMkg3djJoMloiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMTUyIDEuMTcyYy43MTktMS41NjMgMi45NzctMS41NjMgMy42OTYgMGw2LjA0MyAxMy4xNDFjLjM2My43OTEtLjIyNSAxLjY4Ny0xLjEwOSAxLjY4N0gxLjIxOGMtLjg4NCAwLTEuNDcyLS44OTYtMS4xMDktMS42ODdMNi4xNTIgMS4xNzJabTcuMzc0IDEyLjgzN0w4IDEuOTkgMi40NzQgMTQuMDFoMTEuMDUyWiIvPjwvc3ZnPgo=\\ );position:absolute;right:0}.___SInputField_h7hpq_gg_._size_m_h7hpq_gg_>div{padding:var(--intergalactic-spacing-2x, 8px) var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);min-height:calc(var(--minRows_h7hpq)*20px);max-height:calc((var(--maxRows_h7hpq) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_h7hpq_gg_._size_l_h7hpq_gg_>div:empty,.___SInputField_h7hpq_gg_._size_m_h7hpq_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_h7hpq_gg_._size_m_h7hpq_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_h7hpq_gg_._size_l_h7hpq_gg_>div{padding:var(--intergalactic-spacing-3x, 12px) var(--intergalactic-spacing-4x, 16px);font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%);min-height:calc(var(--minRows_h7hpq)*24px);max-height:calc((var(--maxRows_h7hpq) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_h7hpq_gg_._size_l_h7hpq_gg_>div:empty::before{left:calc(var(--intergalactic-spacing-4x, 16px) - var(--intergalactic-spacing-05x, 2px))}.___SInputField_h7hpq_gg_._state_normal_h7hpq_gg_:not(.__disabled_h7hpq_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5));border-color:var(--intergalactic-border-info-active, #006dca)}.___SInputField_h7hpq_gg_._state_valid_h7hpq_gg_>div{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInputField_h7hpq_gg_._state_valid_h7hpq_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInputField_h7hpq_gg_._state_invalid_h7hpq_gg_>div{border-color:var(--intergalactic-border-critical-active, #d1002f);background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(209, 0, 47, 1) 0, rgba(209, 0, 47, 1) 2px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, #ffffff);border-bottom-left-radius:var(--intergalactic-control-rounded, 6px);border-top-left-radius:var(--intergalactic-control-rounded, 6px);background-repeat:repeat-y}.___SInputField_h7hpq_gg_._state_invalid_h7hpq_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInputField_h7hpq_gg_.__readonly_h7hpq_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SInputField_h7hpq_gg_.__disabled_h7hpq_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.3)}" /*__inner_css_end__*/, "h7hpq_gg_") /*__reshadow_css_end__*/, {
|
17
|
+
"__SInputField": "___SInputField_h7hpq_gg_",
|
18
|
+
"_showErrors": "__showErrors_h7hpq_gg_",
|
19
|
+
"_readonly": "__readonly_h7hpq_gg_",
|
20
|
+
"_disabled": "__disabled_h7hpq_gg_",
|
21
|
+
"_size_m": "_size_m_h7hpq_gg_",
|
22
|
+
"--minRows": "--minRows_h7hpq",
|
23
|
+
"--maxRows": "--maxRows_h7hpq",
|
24
|
+
"_size_l": "_size_l_h7hpq_gg_",
|
25
|
+
"_state_normal": "_state_normal_h7hpq_gg_",
|
26
|
+
"_state_valid": "_state_valid_h7hpq_gg_",
|
27
|
+
"_state_invalid": "_state_invalid_h7hpq_gg_"
|
28
|
+
});
|
29
|
+
import Tooltip from 'intergalactic/tooltip';
|
30
|
+
import { extractAriaProps } from 'intergalactic/utils/lib/ariaProps';
|
31
|
+
import uniqueIDEnhancement from 'intergalactic/utils/lib/uniqueID';
|
32
|
+
import DOMPurify from 'dompurify';
|
33
|
+
var InputField = /*#__PURE__*/function (_Component) {
|
34
|
+
_inherits(InputField, _Component);
|
35
|
+
var _super = _createSuper(InputField);
|
36
|
+
function InputField(props) {
|
37
|
+
var _this;
|
38
|
+
_classCallCheck(this, InputField);
|
39
|
+
_this = _super.call(this, props);
|
40
|
+
_defineProperty(_assertThisInitialized(_this), "delimiter", '\n');
|
41
|
+
_defineProperty(_assertThisInitialized(_this), "skipEmptyLines", true);
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "emptyLineValue", '');
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "spaceLineValue", ' ');
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/React.createRef());
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "textarea", void 0);
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "popper", null);
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "setPopperTrigger", null);
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "errorByInteraction", null);
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "changeTriggerTimeout", 0);
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "isScrolling", false);
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "scrollingTimeout", 0);
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "toggleErrorsPopperTimeout", 0);
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "isFocusing", false);
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "linesCountTimeout", 0);
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
56
|
+
visibleErrorPopper: false,
|
57
|
+
keyboardLineIndex: -1,
|
58
|
+
mouseLineIndex: -1
|
59
|
+
});
|
60
|
+
_this.handlePaste = _this.handlePaste.bind(_assertThisInitialized(_this));
|
61
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
62
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
63
|
+
_this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
|
64
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
65
|
+
_this.handleMouseDown = _this.handleMouseDown.bind(_assertThisInitialized(_this));
|
66
|
+
_this.handleMouseMove = _this.handleMouseMove.bind(_assertThisInitialized(_this));
|
67
|
+
_this.handleMouseLeave = _this.handleMouseLeave.bind(_assertThisInitialized(_this));
|
68
|
+
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
69
|
+
_this.handleSelectAll = _this.handleSelectAll.bind(_assertThisInitialized(_this));
|
70
|
+
_this.textarea = _this.createContentEditableElement(props);
|
71
|
+
return _this;
|
72
|
+
}
|
73
|
+
_createClass(InputField, [{
|
74
|
+
key: "uncontrolledProps",
|
75
|
+
value: function uncontrolledProps() {
|
76
|
+
return {
|
77
|
+
value: null,
|
78
|
+
linesCount: null,
|
79
|
+
errorIndex: null
|
80
|
+
};
|
81
|
+
}
|
82
|
+
}, {
|
83
|
+
key: "componentDidMount",
|
84
|
+
value: function componentDidMount() {
|
85
|
+
var _this$containerRef$cu;
|
86
|
+
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 ? void 0 : _this$containerRef$cu.append(this.textarea);
|
87
|
+
this.handleValueOutChange();
|
88
|
+
}
|
89
|
+
}, {
|
90
|
+
key: "componentDidUpdate",
|
91
|
+
value: function componentDidUpdate(prevProps, prevState) {
|
92
|
+
var _this2 = this;
|
93
|
+
var _this$props = this.props,
|
94
|
+
value = _this$props.value,
|
95
|
+
errors = _this$props.errors,
|
96
|
+
errorIndex = _this$props.errorIndex,
|
97
|
+
showErrors = _this$props.showErrors,
|
98
|
+
disabled = _this$props.disabled,
|
99
|
+
readonly = _this$props.readonly,
|
100
|
+
highlightErrorIndex = _this$props.highlightErrorIndex,
|
101
|
+
lineProcessing = _this$props.lineProcessing,
|
102
|
+
_this$props$ariaDesc = _this$props['aria-describedby'],
|
103
|
+
ariaDescribedby = _this$props$ariaDesc === void 0 ? '' : _this$props$ariaDesc;
|
104
|
+
if (prevProps.value !== value && value !== this.getValues().join(this.delimiter)) {
|
105
|
+
this.handleValueOutChange();
|
106
|
+
}
|
107
|
+
if (prevProps.showErrors !== showErrors || prevProps.errors.length !== errors.length) {
|
108
|
+
this.toggleAriaInvalid(showErrors, errors.length);
|
109
|
+
if (showErrors === false) {
|
110
|
+
this.textarea.setAttribute('aria-describedby', ariaDescribedby);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
if (prevProps.errorIndex !== errorIndex && highlightErrorIndex) {
|
114
|
+
this.handleChangeErrorIndex(errorIndex);
|
115
|
+
}
|
116
|
+
if (prevProps.disabled !== disabled || prevProps.readonly !== readonly) {
|
117
|
+
if (this.isDisabled) {
|
118
|
+
this.textarea.setAttribute('contenteditable', 'false');
|
119
|
+
this.removeEventListeners(this.textarea);
|
120
|
+
} else {
|
121
|
+
this.textarea.setAttribute('contenteditable', 'true');
|
122
|
+
this.addEventListeners(this.textarea);
|
123
|
+
}
|
124
|
+
if (disabled) {
|
125
|
+
this.textarea.setAttribute('tabindex', '-1');
|
126
|
+
} else {
|
127
|
+
this.textarea.setAttribute('tabindex', '0');
|
128
|
+
}
|
129
|
+
}
|
130
|
+
var keyboardLineIndex = this.state.keyboardLineIndex;
|
131
|
+
if (prevState.keyboardLineIndex !== -1 && prevState.keyboardLineIndex !== keyboardLineIndex) {
|
132
|
+
if (lineProcessing) {
|
133
|
+
var _lines$prevState$keyb;
|
134
|
+
var lines = this.getValues();
|
135
|
+
var newValue = lineProcessing((_lines$prevState$keyb = lines[prevState.keyboardLineIndex]) !== null && _lines$prevState$keyb !== void 0 ? _lines$prevState$keyb : '', lines);
|
136
|
+
var newValueTextNode = document.createTextNode(newValue);
|
137
|
+
var paragraph = this.textarea.childNodes.item(prevState.keyboardLineIndex);
|
138
|
+
if (paragraph instanceof HTMLParagraphElement) {
|
139
|
+
if (newValue === '') {
|
140
|
+
paragraph.innerHTML = this.emptyLineValue;
|
141
|
+
} else {
|
142
|
+
paragraph.replaceChild(newValueTextNode, paragraph.childNodes.item(0));
|
143
|
+
}
|
144
|
+
}
|
145
|
+
this.validateLine(paragraph);
|
146
|
+
setTimeout(function () {
|
147
|
+
var newNode = _this2.textarea.childNodes.item(keyboardLineIndex);
|
148
|
+
if (newNode) {
|
149
|
+
_this2.setErrorIndex(newNode);
|
150
|
+
}
|
151
|
+
}, 0); // need this timeout to update errorIndex to the new (usually empty) line
|
152
|
+
}
|
153
|
+
|
154
|
+
if (!showErrors) {
|
155
|
+
this.recalculateErrors();
|
156
|
+
}
|
157
|
+
this.recalculateLinesCount();
|
158
|
+
this.asProps.onChangeLineIndex(keyboardLineIndex);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}, {
|
162
|
+
key: "componentWillUnmount",
|
163
|
+
value: function componentWillUnmount() {
|
164
|
+
this.removeEventListeners(this.textarea);
|
165
|
+
}
|
166
|
+
}, {
|
167
|
+
key: "isDisabled",
|
168
|
+
get: function get() {
|
169
|
+
var _this$asProps = this.asProps,
|
170
|
+
disabled = _this$asProps.disabled,
|
171
|
+
readonly = _this$asProps.readonly;
|
172
|
+
return Boolean(disabled || readonly);
|
173
|
+
}
|
174
|
+
}, {
|
175
|
+
key: "popperDescribedId",
|
176
|
+
get: function get() {
|
177
|
+
var uid = this.asProps.uid;
|
178
|
+
return "bulk-textarea-".concat(uid, "-popper-describedby");
|
179
|
+
}
|
180
|
+
}, {
|
181
|
+
key: "errorMessage",
|
182
|
+
get: function get() {
|
183
|
+
var _ref3, _errorItem$errorMessa, _errorItem, _errorItem2;
|
184
|
+
var _this$asProps2 = this.asProps,
|
185
|
+
errors = _this$asProps2.errors,
|
186
|
+
errorIndex = _this$asProps2.errorIndex,
|
187
|
+
commonErrorMessage = _this$asProps2.commonErrorMessage,
|
188
|
+
lastError = _this$asProps2.lastError;
|
189
|
+
var _this$state = this.state,
|
190
|
+
mouseLineIndex = _this$state.mouseLineIndex,
|
191
|
+
keyboardLineIndex = _this$state.keyboardLineIndex;
|
192
|
+
var currentLineIndex = this.errorByInteraction === 'keyboard' ? keyboardLineIndex : this.errorByInteraction === 'mouse' ? mouseLineIndex : -1;
|
193
|
+
var errorItem = errors[errorIndex];
|
194
|
+
if (currentLineIndex !== -1) {
|
195
|
+
errorItem = errors.find(function (e) {
|
196
|
+
return (e === null || e === void 0 ? void 0 : e.lineIndex) === currentLineIndex;
|
197
|
+
});
|
198
|
+
}
|
199
|
+
var errorMessage = errors.length === 0 && !lastError // show any errors only if there are at least one error
|
200
|
+
? null : (_ref3 = (_errorItem$errorMessa = (_errorItem = errorItem) === null || _errorItem === void 0 ? void 0 : _errorItem.errorMessage) !== null && _errorItem$errorMessa !== void 0 ? _errorItem$errorMessa : lastError === null || lastError === void 0 ? void 0 : lastError.errorMessage) !== null && _ref3 !== void 0 ? _ref3 : commonErrorMessage;
|
201
|
+
var isCommonError = !((_errorItem2 = errorItem) !== null && _errorItem2 !== void 0 && _errorItem2.errorMessage) && !(lastError !== null && lastError !== void 0 && lastError.errorMessage);
|
202
|
+
return {
|
203
|
+
errorMessage: errorMessage,
|
204
|
+
isCommonError: isCommonError
|
205
|
+
};
|
206
|
+
}
|
207
|
+
}, {
|
208
|
+
key: "createContentEditableElement",
|
209
|
+
value: function createContentEditableElement(props) {
|
210
|
+
var textarea = document.createElement('div');
|
211
|
+
textarea.setAttribute('contentEditable', props.disabled || props.readonly ? 'false' : 'true');
|
212
|
+
textarea.setAttribute('role', 'textbox');
|
213
|
+
textarea.setAttribute('classname', 'editable');
|
214
|
+
if (props.id) {
|
215
|
+
textarea.setAttribute('id', props.id);
|
216
|
+
}
|
217
|
+
if (props.placeholder) {
|
218
|
+
textarea.setAttribute('placeholder', props.placeholder);
|
219
|
+
}
|
220
|
+
var _extractAriaProps = extractAriaProps(props),
|
221
|
+
extractedAriaProps = _extractAriaProps.extractedAriaProps;
|
222
|
+
for (var key in extractedAriaProps) {
|
223
|
+
var ariaProp = props[key];
|
224
|
+
if (ariaProp) {
|
225
|
+
textarea.setAttribute(key, ariaProp);
|
226
|
+
}
|
227
|
+
}
|
228
|
+
if (!props.disabled) {
|
229
|
+
textarea.setAttribute('tabIndex', '0');
|
230
|
+
} else {
|
231
|
+
textarea.setAttribute('tabIndex', '-1');
|
232
|
+
}
|
233
|
+
if (!props.disabled && !props.readonly) {
|
234
|
+
this.addEventListeners(textarea);
|
235
|
+
} else {
|
236
|
+
textarea.addEventListener('keydown', this.handleSelectAll.bind(this));
|
237
|
+
}
|
238
|
+
return textarea;
|
239
|
+
}
|
240
|
+
}, {
|
241
|
+
key: "handleValueOutChange",
|
242
|
+
value: function handleValueOutChange() {
|
243
|
+
var _this$props2 = this.props,
|
244
|
+
value = _this$props2.value,
|
245
|
+
onChangeLinesCount = _this$props2.onChangeLinesCount;
|
246
|
+
if (value === '') {
|
247
|
+
this.textarea.textContent = '';
|
248
|
+
onChangeLinesCount(0);
|
249
|
+
} else {
|
250
|
+
var _this$textarea;
|
251
|
+
var listOfNodes = this.prepareNodesForPaste(value);
|
252
|
+
(_this$textarea = this.textarea).replaceChildren.apply(_this$textarea, _toConsumableArray(listOfNodes));
|
253
|
+
this.recalculateLinesCount();
|
254
|
+
}
|
255
|
+
}
|
256
|
+
}, {
|
257
|
+
key: "handleScroll",
|
258
|
+
value: function handleScroll() {
|
259
|
+
var _this3 = this;
|
260
|
+
if (this.scrollingTimeout) {
|
261
|
+
clearTimeout(this.scrollingTimeout);
|
262
|
+
}
|
263
|
+
this.isScrolling = true;
|
264
|
+
this.scrollingTimeout = window.setTimeout(function () {
|
265
|
+
_this3.isScrolling = false;
|
266
|
+
}, 50);
|
267
|
+
}
|
268
|
+
}, {
|
269
|
+
key: "handleMouseDown",
|
270
|
+
value: function handleMouseDown(event) {
|
271
|
+
// we need to change keyboardLineIndex, because the caret in real on that current row
|
272
|
+
this.errorByInteraction = 'keyboard';
|
273
|
+
var element = event.target;
|
274
|
+
if (element instanceof HTMLElement) {
|
275
|
+
// we need to change keyboardLineIndex, because the caret in real on that current row
|
276
|
+
this.toggleErrorsPopper('keyboardLineIndex', element);
|
277
|
+
this.setErrorIndex(element);
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}, {
|
281
|
+
key: "handleMouseMove",
|
282
|
+
value: function handleMouseMove(event) {
|
283
|
+
this.errorByInteraction = 'mouse';
|
284
|
+
var element = event.target;
|
285
|
+
if (element !== this.textarea) {
|
286
|
+
if (this.isFocusing || element instanceof HTMLElement && element.getAttribute('aria-invalid') === 'true') {
|
287
|
+
this.toggleErrorsPopper('mouseLineIndex', element);
|
288
|
+
} else {
|
289
|
+
this.setState({
|
290
|
+
visibleErrorPopper: false
|
291
|
+
});
|
292
|
+
}
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}, {
|
296
|
+
key: "handleMouseLeave",
|
297
|
+
value: function handleMouseLeave(event) {
|
298
|
+
if (this.changeTriggerTimeout) {
|
299
|
+
clearTimeout(this.changeTriggerTimeout);
|
300
|
+
}
|
301
|
+
if (this.isFocusing) {
|
302
|
+
this.errorByInteraction = 'keyboard';
|
303
|
+
var rowNode = this.getNodeFromSelection();
|
304
|
+
this.toggleErrorsPopper('keyboardLineIndex', rowNode, 0);
|
305
|
+
this.setState({
|
306
|
+
mouseLineIndex: -1
|
307
|
+
});
|
308
|
+
} else {
|
309
|
+
this.setState({
|
310
|
+
visibleErrorPopper: false
|
311
|
+
});
|
312
|
+
}
|
313
|
+
}
|
314
|
+
}, {
|
315
|
+
key: "handlePaste",
|
316
|
+
value: function handlePaste(event) {
|
317
|
+
var _event$clipboardData;
|
318
|
+
event.preventDefault();
|
319
|
+
var validateOn = this.asProps.validateOn;
|
320
|
+
var value = (_event$clipboardData = event.clipboardData) === null || _event$clipboardData === void 0 ? void 0 : _event$clipboardData.getData('text/plain');
|
321
|
+
var listOfNodes = value ? this.prepareNodesForPaste(value) : [];
|
322
|
+
var selection = document.getSelection();
|
323
|
+
if (selection !== null && selection !== void 0 && selection.anchorNode && selection !== null && selection !== void 0 && selection.focusNode) {
|
324
|
+
var anchorOffset = selection.anchorOffset;
|
325
|
+
var focusOffset = selection.focusOffset;
|
326
|
+
var documentPosition = selection.anchorNode.compareDocumentPosition(selection.focusNode);
|
327
|
+
var direction = this.getSelectionDirection();
|
328
|
+
var anchorElement = direction === 'forward' ? selection.anchorNode : selection.focusNode;
|
329
|
+
var focusElement = direction === 'forward' ? selection.focusNode : selection.anchorNode;
|
330
|
+
var fromOffset = direction === 'forward' ? anchorOffset : focusOffset;
|
331
|
+
var toOffset = direction === 'forward' ? focusOffset : anchorOffset;
|
332
|
+
var anchorNode = anchorElement instanceof Text ? anchorElement.parentElement : anchorElement;
|
333
|
+
var focusNode = focusElement instanceof Text ? focusElement.parentElement : focusElement;
|
334
|
+
var textNode = null;
|
335
|
+
var position = null;
|
336
|
+
if (focusElement === this.textarea) {
|
337
|
+
var _this$textarea2, _lastNodeToInsert$tex;
|
338
|
+
(_this$textarea2 = this.textarea).replaceChildren.apply(_this$textarea2, _toConsumableArray(listOfNodes));
|
339
|
+
var lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
340
|
+
textNode = lastNodeToInsert.childNodes.item(0);
|
341
|
+
position = ((_lastNodeToInsert$tex = lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex !== void 0 ? _lastNodeToInsert$tex : '').length;
|
342
|
+
} else if (focusNode instanceof HTMLParagraphElement && anchorNode instanceof HTMLParagraphElement) {
|
343
|
+
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2, _ref4;
|
344
|
+
var before = (_anchorNode$textConte = anchorNode === null || anchorNode === void 0 ? void 0 : (_anchorNode$textConte2 = anchorNode.textContent) === null || _anchorNode$textConte2 === void 0 ? void 0 : _anchorNode$textConte2.substring(0, fromOffset)) !== null && _anchorNode$textConte !== void 0 ? _anchorNode$textConte : '';
|
345
|
+
var after = (_focusNode$textConten = focusNode === null || focusNode === void 0 ? void 0 : (_focusNode$textConten2 = focusNode.textContent) === null || _focusNode$textConten2 === void 0 ? void 0 : _focusNode$textConten2.substring(toOffset)) !== null && _focusNode$textConten !== void 0 ? _focusNode$textConten : '';
|
346
|
+
selection.deleteFromDocument();
|
347
|
+
if (documentPosition !== 0) {
|
348
|
+
this.textarea.removeChild(focusNode);
|
349
|
+
}
|
350
|
+
var firstNodeToInsert = listOfNodes.splice(0, 1)[0];
|
351
|
+
var _lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
352
|
+
anchorNode.textContent = (_ref4 = before + (firstNodeToInsert === null || firstNodeToInsert === void 0 ? void 0 : firstNodeToInsert.textContent)) !== null && _ref4 !== void 0 ? _ref4 : '';
|
353
|
+
anchorNode.after.apply(anchorNode, _toConsumableArray(listOfNodes));
|
354
|
+
if (_lastNodeToInsert) {
|
355
|
+
var _lastNodeToInsert$tex2, _lastNodeToInsert$tex3;
|
356
|
+
_lastNodeToInsert.textContent = ((_lastNodeToInsert$tex2 = _lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex2 !== void 0 ? _lastNodeToInsert$tex2 : '') + after;
|
357
|
+
textNode = _lastNodeToInsert.childNodes.item(0);
|
358
|
+
position = ((_lastNodeToInsert$tex3 = _lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex3 !== void 0 ? _lastNodeToInsert$tex3 : '').length;
|
359
|
+
this.validateLine(_lastNodeToInsert);
|
360
|
+
this.setErrorIndex(_lastNodeToInsert);
|
361
|
+
} else {
|
362
|
+
var _anchorNode$textConte3, _anchorNode$textConte4;
|
363
|
+
position = ((_anchorNode$textConte3 = anchorNode.textContent) !== null && _anchorNode$textConte3 !== void 0 ? _anchorNode$textConte3 : '').length;
|
364
|
+
anchorNode.textContent = ((_anchorNode$textConte4 = anchorNode.textContent) !== null && _anchorNode$textConte4 !== void 0 ? _anchorNode$textConte4 : '') + after;
|
365
|
+
textNode = anchorNode.childNodes.item(0);
|
366
|
+
this.validateLine(anchorNode);
|
367
|
+
this.setErrorIndex(anchorNode);
|
368
|
+
}
|
369
|
+
}
|
370
|
+
if (textNode instanceof Text) {
|
371
|
+
var _position, _position2;
|
372
|
+
this.setSelection(textNode, (_position = position) !== null && _position !== void 0 ? _position : 1, (_position2 = position) !== null && _position2 !== void 0 ? _position2 : 1);
|
373
|
+
this.toggleErrorsPopper('keyboardLineIndex', textNode.parentNode);
|
374
|
+
} else {
|
375
|
+
var _textNode;
|
376
|
+
console.warn('incorrect child type', textNode, (_textNode = textNode) === null || _textNode === void 0 ? void 0 : _textNode.parentNode);
|
377
|
+
}
|
378
|
+
}
|
379
|
+
this.recalculateLinesCount();
|
380
|
+
if (validateOn.includes('paste') || this.asProps.showErrors) {
|
381
|
+
this.recalculateErrors();
|
382
|
+
}
|
383
|
+
}
|
384
|
+
}, {
|
385
|
+
key: "handleChange",
|
386
|
+
value: function handleChange(event) {
|
387
|
+
var target = event.target;
|
388
|
+
if (target instanceof HTMLDivElement && event instanceof InputEvent) {
|
389
|
+
var _firstNode$textConten2;
|
390
|
+
var nodes = this.textarea.childNodes;
|
391
|
+
var firstNode = nodes.item(0);
|
392
|
+
var secondNode = nodes.item(1);
|
393
|
+
var selection = document.getSelection();
|
394
|
+
if (firstNode instanceof Text) {
|
395
|
+
var _firstNode$textConten;
|
396
|
+
var nodeText = (_firstNode$textConten = firstNode.textContent) !== null && _firstNode$textConten !== void 0 ? _firstNode$textConten : '';
|
397
|
+
var firstRow = document.createElement('p');
|
398
|
+
var text = document.createTextNode(nodeText);
|
399
|
+
firstRow.append(text);
|
400
|
+
firstNode.replaceWith(firstRow);
|
401
|
+
selection === null || selection === void 0 ? void 0 : selection.setPosition(firstRow, nodeText.length);
|
402
|
+
} else if (!firstNode || firstNode instanceof HTMLBRElement && nodes.length === 1) {
|
403
|
+
this.textarea.textContent = '';
|
404
|
+
this.setState({
|
405
|
+
keyboardLineIndex: 0
|
406
|
+
});
|
407
|
+
} else if (firstNode instanceof HTMLParagraphElement && !((_firstNode$textConten2 = firstNode.textContent) !== null && _firstNode$textConten2 !== void 0 && _firstNode$textConten2.trim())) {
|
408
|
+
if (nodes.length <= 1 || secondNode instanceof HTMLBRElement) {
|
409
|
+
this.textarea.textContent = '';
|
410
|
+
this.setState({
|
411
|
+
keyboardLineIndex: 0
|
412
|
+
});
|
413
|
+
}
|
414
|
+
}
|
415
|
+
var maxDeep = 10;
|
416
|
+
var rowNode = selection === null || selection === void 0 ? void 0 : selection.focusNode;
|
417
|
+
while (((_rowNode = rowNode) === null || _rowNode === void 0 ? void 0 : _rowNode.parentNode) !== this.textarea && maxDeep > 0) {
|
418
|
+
var _rowNode, _rowNode2;
|
419
|
+
rowNode = (_rowNode2 = rowNode) === null || _rowNode2 === void 0 ? void 0 : _rowNode2.parentNode;
|
420
|
+
maxDeep--;
|
421
|
+
}
|
422
|
+
if (rowNode instanceof HTMLParagraphElement) {
|
423
|
+
var _rowNode$textContent, _this$popper;
|
424
|
+
var childNodes = rowNode.childNodes;
|
425
|
+
var textContent = (_rowNode$textContent = rowNode.textContent) !== null && _rowNode$textContent !== void 0 ? _rowNode$textContent : '';
|
426
|
+
if (childNodes.length > 1) {
|
427
|
+
var _childNodes$item$text;
|
428
|
+
var offset = (_childNodes$item$text = childNodes.item(0).textContent) === null || _childNodes$item$text === void 0 ? void 0 : _childNodes$item$text.length;
|
429
|
+
rowNode.textContent = textContent;
|
430
|
+
if (offset) {
|
431
|
+
this.setSelection(rowNode.childNodes.item(0), offset, offset);
|
432
|
+
}
|
433
|
+
}
|
434
|
+
if (textContent.length > 0) {
|
435
|
+
var firstSymbol = textContent.at(0);
|
436
|
+
var lastSymbol = textContent.at(textContent.length - 1);
|
437
|
+
if (firstSymbol === this.getEmptyParagraph().textContent || lastSymbol === this.getEmptyParagraph().textContent) {
|
438
|
+
var _offset = null;
|
439
|
+
if (firstSymbol === this.getEmptyParagraph().textContent) {
|
440
|
+
rowNode.textContent = textContent.substring(1);
|
441
|
+
_offset = event.inputType === 'deleteContentBackward' || event.inputType === 'deleteContentForward' ? 0 : rowNode.textContent.length;
|
442
|
+
} else if (lastSymbol === this.getEmptyParagraph().textContent) {
|
443
|
+
rowNode.textContent = textContent.substring(0, textContent.length - 1);
|
444
|
+
_offset = rowNode.textContent.length;
|
445
|
+
}
|
446
|
+
if (_offset) {
|
447
|
+
this.setSelection(rowNode.childNodes.item(0), _offset, _offset);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
} else if (childNodes.length === 1 && childNodes[0] instanceof HTMLBRElement) {
|
451
|
+
rowNode.innerHTML = this.emptyLineValue;
|
452
|
+
}
|
453
|
+
var _this$asProps3 = this.asProps,
|
454
|
+
errors = _this$asProps3.errors,
|
455
|
+
showErrors = _this$asProps3.showErrors;
|
456
|
+
var isValid = this.validateLine(rowNode);
|
457
|
+
this.recalculateErrors();
|
458
|
+
this.setErrorIndex(rowNode);
|
459
|
+
if (!isValid && showErrors) {
|
460
|
+
this.toggleErrorsPopper('keyboardLineIndex', rowNode, 0);
|
461
|
+
}
|
462
|
+
var trigger = !isValid || isValid && errors.length === 1 && errors[0].lineNode === rowNode ? rowNode : this.textarea;
|
463
|
+
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.current.state.elements.reference) !== trigger) {
|
464
|
+
var _this$setPopperTrigge;
|
465
|
+
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0 ? void 0 : _this$setPopperTrigge.call(this, trigger);
|
466
|
+
}
|
467
|
+
} else if (rowNode === null) {
|
468
|
+
var _this$setPopperTrigge2;
|
469
|
+
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0 ? void 0 : _this$setPopperTrigge2.call(this, this.textarea);
|
470
|
+
if ((selection === null || selection === void 0 ? void 0 : selection.focusNode) === this.textarea && this.textarea.childNodes.length > 1) {
|
471
|
+
var nodeIndex = selection.focusOffset;
|
472
|
+
var emptyParagraph = this.textarea.childNodes.item(nodeIndex - 1);
|
473
|
+
var emptyBr = this.textarea.childNodes.item(nodeIndex);
|
474
|
+
this.textarea.removeChild(emptyBr);
|
475
|
+
if (emptyParagraph instanceof HTMLParagraphElement) {
|
476
|
+
emptyParagraph.innerHTML = this.emptyLineValue;
|
477
|
+
}
|
478
|
+
if (emptyParagraph) {
|
479
|
+
this.setSelection(emptyParagraph, 0, 0);
|
480
|
+
}
|
481
|
+
} else {
|
482
|
+
this.setSelection(this.textarea, 0, 0);
|
483
|
+
}
|
484
|
+
}
|
485
|
+
this.recalculateLinesCount();
|
486
|
+
}
|
487
|
+
}
|
488
|
+
}, {
|
489
|
+
key: "handleFocus",
|
490
|
+
value: function handleFocus(event) {
|
491
|
+
this.isFocusing = true;
|
492
|
+
this.errorByInteraction = 'keyboard';
|
493
|
+
if (this.asProps.showErrors) {
|
494
|
+
this.toggleErrorsPopperByKeyboard(150);
|
495
|
+
} else {
|
496
|
+
this.toggleErrorsPopper('keyboardLineIndex', this.textarea);
|
497
|
+
}
|
498
|
+
}
|
499
|
+
}, {
|
500
|
+
key: "handleBlur",
|
501
|
+
value: function handleBlur(event) {
|
502
|
+
var _this4 = this;
|
503
|
+
this.isFocusing = false;
|
504
|
+
this.setState({
|
505
|
+
visibleErrorPopper: false
|
506
|
+
});
|
507
|
+
var _this$asProps4 = this.asProps,
|
508
|
+
validateOn = _this$asProps4.validateOn,
|
509
|
+
onBlur = _this$asProps4.onBlur;
|
510
|
+
if (validateOn.includes('blur')) {
|
511
|
+
this.recalculateErrors();
|
512
|
+
}
|
513
|
+
onBlur(this.getValues().join(this.delimiter), event);
|
514
|
+
setTimeout(function () {
|
515
|
+
_this4.setState({
|
516
|
+
keyboardLineIndex: -1
|
517
|
+
});
|
518
|
+
}, 200);
|
519
|
+
}
|
520
|
+
}, {
|
521
|
+
key: "handleKeyDown",
|
522
|
+
value: function handleKeyDown(event) {
|
523
|
+
var _this5 = this;
|
524
|
+
this.errorByInteraction = 'keyboard';
|
525
|
+
var linesDelimiters = this.asProps.linesDelimiters;
|
526
|
+
var currentNode = this.getNodeFromSelection();
|
527
|
+
if (event.key === 'Enter' || linesDelimiters !== null && linesDelimiters !== void 0 && linesDelimiters.includes(event.key)) {
|
528
|
+
if (currentNode === this.textarea) {
|
529
|
+
event.preventDefault();
|
530
|
+
}
|
531
|
+
if (currentNode instanceof HTMLParagraphElement) {
|
532
|
+
var _currentNode$textCont;
|
533
|
+
var currentRowValue = (_currentNode$textCont = currentNode.textContent) === null || _currentNode$textCont === void 0 ? void 0 : _currentNode$textCont.trim();
|
534
|
+
if (!currentRowValue) {
|
535
|
+
event.preventDefault();
|
536
|
+
} else {
|
537
|
+
var _selection$focusNode, _selectionNode$textCo, _currentNode$textCont2, _row$textContent;
|
538
|
+
event.preventDefault();
|
539
|
+
var selection = document.getSelection();
|
540
|
+
var selectionNode = (selection === null || selection === void 0 ? void 0 : selection.focusNode) instanceof Text ? selection.focusNode : selection === null || selection === void 0 ? void 0 : (_selection$focusNode = selection.focusNode) === null || _selection$focusNode === void 0 ? void 0 : _selection$focusNode.childNodes.item(0);
|
541
|
+
var selectionOffset = selection === null || selection === void 0 ? void 0 : selection.focusOffset;
|
542
|
+
var newRowValue = '';
|
543
|
+
if (selectionNode instanceof Text && selectionOffset !== undefined && selectionOffset !== ((_selectionNode$textCo = selectionNode.textContent) === null || _selectionNode$textCo === void 0 ? void 0 : _selectionNode$textCo.length)) {
|
544
|
+
var _selectionNode$textCo2, _selectionNode$textCo3;
|
545
|
+
newRowValue = (_selectionNode$textCo2 = (_selectionNode$textCo3 = selectionNode.textContent) === null || _selectionNode$textCo3 === void 0 ? void 0 : _selectionNode$textCo3.substring(selectionOffset)) !== null && _selectionNode$textCo2 !== void 0 ? _selectionNode$textCo2 : this.emptyLineValue;
|
546
|
+
if (selectionNode.textContent) {
|
547
|
+
selectionNode.textContent = selectionNode.textContent.substring(0, selectionOffset);
|
548
|
+
}
|
549
|
+
}
|
550
|
+
if (((_currentNode$textCont2 = currentNode.textContent) === null || _currentNode$textCont2 === void 0 ? void 0 : _currentNode$textCont2.trim()) === '') {
|
551
|
+
currentNode.innerHTML = this.emptyLineValue;
|
552
|
+
}
|
553
|
+
var row = document.createElement('p');
|
554
|
+
if (newRowValue) {
|
555
|
+
row.textContent = newRowValue;
|
556
|
+
} else {
|
557
|
+
row.innerHTML = this.emptyLineValue;
|
558
|
+
}
|
559
|
+
currentNode.after(row);
|
560
|
+
this.setSelection(row, 0, 0);
|
561
|
+
this.validateLine(currentNode);
|
562
|
+
this.validateLine(row);
|
563
|
+
if (currentNode.previousSibling) {
|
564
|
+
this.validateLine(currentNode.previousSibling);
|
565
|
+
}
|
566
|
+
this.setErrorIndex(row);
|
567
|
+
if (((_row$textContent = row.textContent) === null || _row$textContent === void 0 ? void 0 : _row$textContent.trim()) !== '') {
|
568
|
+
this.recalculateLinesCount();
|
569
|
+
}
|
570
|
+
setTimeout(function () {
|
571
|
+
_this5.recalculateErrors();
|
572
|
+
}, 0);
|
573
|
+
this.toggleErrorsPopperByKeyboard(0);
|
574
|
+
}
|
575
|
+
}
|
576
|
+
} else if (event.key === 'ArrowDown' || event.key === 'ArrowUp' || event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
577
|
+
if (currentNode instanceof HTMLParagraphElement) {
|
578
|
+
this.handleCursorMovement(currentNode, event);
|
579
|
+
}
|
580
|
+
this.toggleErrorsPopperByKeyboard(200);
|
581
|
+
} else if (this.isDeleteKey(event) && currentNode instanceof HTMLParagraphElement) {
|
582
|
+
var _currentNode$textCont3;
|
583
|
+
if (((_currentNode$textCont3 = currentNode.textContent) === null || _currentNode$textCont3 === void 0 ? void 0 : _currentNode$textCont3.trim()) === '' && !this.isRangeSelection()) {
|
584
|
+
// Backspace on empty row
|
585
|
+
var prevNode = currentNode.previousSibling;
|
586
|
+
if (prevNode instanceof HTMLParagraphElement) {
|
587
|
+
var _prevNode$textContent;
|
588
|
+
event.preventDefault();
|
589
|
+
this.textarea.removeChild(currentNode);
|
590
|
+
this.toggleErrorsPopperByKeyboard(0);
|
591
|
+
if (((_prevNode$textContent = prevNode.textContent) === null || _prevNode$textContent === void 0 ? void 0 : _prevNode$textContent.trim()) === '' && prevNode.previousSibling === null && this.textarea.childNodes.length === 1) {
|
592
|
+
this.textarea.textContent = '';
|
593
|
+
this.setSelection(this.textarea, 0, 0);
|
594
|
+
} else {
|
595
|
+
if (prevNode instanceof HTMLParagraphElement) {
|
596
|
+
var _text$textContent$len, _text$textContent;
|
597
|
+
var text = prevNode.childNodes.item(0);
|
598
|
+
var offset = (_text$textContent$len = (_text$textContent = text.textContent) === null || _text$textContent === void 0 ? void 0 : _text$textContent.length) !== null && _text$textContent$len !== void 0 ? _text$textContent$len : 0;
|
599
|
+
this.setSelection(text, offset, offset);
|
600
|
+
} else {
|
601
|
+
console.warn('incorrect prevNode type', prevNode);
|
602
|
+
}
|
603
|
+
}
|
604
|
+
setTimeout(function () {
|
605
|
+
_this5.recalculateErrors();
|
606
|
+
}, 0);
|
607
|
+
this.toggleErrorsPopperByKeyboard(0);
|
608
|
+
}
|
609
|
+
} else if (this.isRangeSelection()) {
|
610
|
+
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2, _focusElement$parentN3;
|
611
|
+
var _selection = document.getSelection();
|
612
|
+
var direction = this.getSelectionDirection();
|
613
|
+
var anchorElement = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.focusNode : _selection === null || _selection === void 0 ? void 0 : _selection.anchorNode;
|
614
|
+
var focusElement = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.anchorNode : _selection === null || _selection === void 0 ? void 0 : _selection.focusNode;
|
615
|
+
var anchorOffset = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.focusOffset : _selection === null || _selection === void 0 ? void 0 : _selection.anchorOffset;
|
616
|
+
var focusOffset = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.anchorOffset : _selection === null || _selection === void 0 ? void 0 : _selection.focusOffset;
|
617
|
+
|
618
|
+
// Backspace on selected full row
|
619
|
+
if (anchorElement === focusElement && anchorOffset === 0 && (focusElement === currentNode && focusOffset === 1 || focusOffset === ((_currentNode$textCont4 = currentNode.textContent) === null || _currentNode$textCont4 === void 0 ? void 0 : _currentNode$textCont4.length))) {
|
620
|
+
event.preventDefault();
|
621
|
+
var anchorParagraph = anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.parentElement;
|
622
|
+
var focusParagraph = focusElement === null || focusElement === void 0 ? void 0 : focusElement.parentElement;
|
623
|
+
var childNodes = this.textarea.childNodes;
|
624
|
+
if (anchorParagraph === childNodes.item(0) && focusParagraph === childNodes.item(childNodes.length - 1)) {
|
625
|
+
this.textarea.textContent = '';
|
626
|
+
this.setSelection(this.textarea, 0, 0);
|
627
|
+
} else {
|
628
|
+
currentNode.innerHTML = this.emptyLineValue;
|
629
|
+
this.validateLine(currentNode);
|
630
|
+
}
|
631
|
+
this.setErrorIndex(currentNode);
|
632
|
+
this.recalculateLinesCount();
|
633
|
+
setTimeout(function () {
|
634
|
+
_this5.recalculateErrors();
|
635
|
+
}, 0);
|
636
|
+
this.toggleErrorsPopperByKeyboard(0);
|
637
|
+
}
|
638
|
+
// Backspace on selected few full rows
|
639
|
+
else if (focusElement !== anchorElement && focusElement instanceof Text && anchorElement instanceof Text && (focusElement === null || focusElement === void 0 ? void 0 : focusElement.textContent) === (focusElement === null || focusElement === void 0 ? void 0 : (_focusElement$parentN = focusElement.parentNode) === null || _focusElement$parentN === void 0 ? void 0 : _focusElement$parentN.textContent) && (anchorElement === null || anchorElement === void 0 ? void 0 : anchorElement.textContent) === (anchorElement === null || anchorElement === void 0 ? void 0 : (_anchorElement$parent = anchorElement.parentNode) === null || _anchorElement$parent === void 0 ? void 0 : _anchorElement$parent.textContent) && anchorOffset === 0 && focusOffset === (focusElement === null || focusElement === void 0 ? void 0 : (_focusElement$parentN2 = focusElement.parentNode) === null || _focusElement$parentN2 === void 0 ? void 0 : (_focusElement$parentN3 = _focusElement$parentN2.textContent) === null || _focusElement$parentN3 === void 0 ? void 0 : _focusElement$parentN3.length)) {
|
640
|
+
event.preventDefault();
|
641
|
+
var paragraphs = Array.from(this.textarea.children);
|
642
|
+
var _anchorParagraph = anchorElement.parentElement;
|
643
|
+
var _focusParagraph = focusElement.parentElement;
|
644
|
+
var _childNodes = this.textarea.childNodes;
|
645
|
+
if (_anchorParagraph === _childNodes.item(0) && _focusParagraph === _childNodes.item(_childNodes.length - 1)) {
|
646
|
+
this.textarea.textContent = '';
|
647
|
+
this.setSelection(this.textarea, 0, 0);
|
648
|
+
} else {
|
649
|
+
var isCleaning = false;
|
650
|
+
var _iterator = _createForOfIteratorHelper(paragraphs),
|
651
|
+
_step;
|
652
|
+
try {
|
653
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
654
|
+
var paragraph = _step.value;
|
655
|
+
if (paragraph === _anchorParagraph || isCleaning) {
|
656
|
+
isCleaning = true;
|
657
|
+
if (paragraph === _focusParagraph) {
|
658
|
+
_focusParagraph.innerHTML = this.emptyLineValue;
|
659
|
+
this.setSelection(_focusParagraph, 0, 0);
|
660
|
+
break;
|
661
|
+
} else {
|
662
|
+
this.textarea.removeChild(paragraph);
|
663
|
+
}
|
664
|
+
}
|
665
|
+
}
|
666
|
+
} catch (err) {
|
667
|
+
_iterator.e(err);
|
668
|
+
} finally {
|
669
|
+
_iterator.f();
|
670
|
+
}
|
671
|
+
this.validateLine(currentNode);
|
672
|
+
}
|
673
|
+
this.setErrorIndex(currentNode);
|
674
|
+
this.recalculateLinesCount();
|
675
|
+
setTimeout(function () {
|
676
|
+
_this5.recalculateErrors();
|
677
|
+
}, 0);
|
678
|
+
this.toggleErrorsPopperByKeyboard(0);
|
679
|
+
}
|
680
|
+
}
|
681
|
+
} else if (event.key === 'z' && (event.ctrlKey || event.metaKey)) {
|
682
|
+
event.preventDefault();
|
683
|
+
}
|
684
|
+
}
|
685
|
+
}, {
|
686
|
+
key: "render",
|
687
|
+
value: function render() {
|
688
|
+
var _ref = this.asProps,
|
689
|
+
_ref2,
|
690
|
+
_this$containerRef$cu2,
|
691
|
+
_this6 = this;
|
692
|
+
var SInputField = Box;
|
693
|
+
var _this$asProps5 = this.asProps,
|
694
|
+
styles = _this$asProps5.styles,
|
695
|
+
showErrors = _this$asProps5.showErrors;
|
696
|
+
var visibleErrorPopper = this.state.visibleErrorPopper;
|
697
|
+
var _this$errorMessage = this.errorMessage,
|
698
|
+
errorMessage = _this$errorMessage.errorMessage,
|
699
|
+
isCommonError = _this$errorMessage.isCommonError;
|
700
|
+
var visibleErrorTooltip = showErrors && visibleErrorPopper && Boolean(errorMessage) && !this.isDisabled;
|
701
|
+
var _extractAriaProps2 = extractAriaProps(this.asProps),
|
702
|
+
__excludeProps = _extractAriaProps2.__excludeProps;
|
703
|
+
return _ref2 = sstyled(styles), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, _ref2.cn("Tooltip", {
|
704
|
+
"interaction": 'none',
|
705
|
+
"placement": isCommonError ? 'right-start' : 'right',
|
706
|
+
"visible": visibleErrorTooltip,
|
707
|
+
"theme": 'warning',
|
708
|
+
"offset": isCommonError ? undefined : [0, 26],
|
709
|
+
"preventOverflow": {
|
710
|
+
boundary: (_this$containerRef$cu2 = this.containerRef.current) !== null && _this$containerRef$cu2 !== void 0 ? _this$containerRef$cu2 : undefined,
|
711
|
+
tether: false
|
712
|
+
}
|
713
|
+
}), function (_ref5) {
|
714
|
+
var popper = _ref5.popper,
|
715
|
+
setTrigger = _ref5.setTrigger;
|
716
|
+
if (!_this6.popper) {
|
717
|
+
_this6.setPopperTrigger = setTrigger;
|
718
|
+
// @ts-ignore
|
719
|
+
_this6.popper = popper;
|
720
|
+
}
|
721
|
+
return /*#__PURE__*/React.createElement(Tooltip.Popper, {
|
722
|
+
id: _this6.popperDescribedId
|
723
|
+
}, errorMessage);
|
724
|
+
}), /*#__PURE__*/React.createElement(SInputField, _ref2.cn("SInputField", _objectSpread({}, _assignProps({
|
725
|
+
"ref": this.containerRef,
|
726
|
+
"__excludeProps": ['onBlur', 'value'].concat(_toConsumableArray(__excludeProps))
|
727
|
+
}, _ref)))));
|
728
|
+
}
|
729
|
+
}, {
|
730
|
+
key: "prepareNodesForPaste",
|
731
|
+
value: function prepareNodesForPaste(value) {
|
732
|
+
var _pasteProps$lineProce,
|
733
|
+
_pasteProps$skipEmpty,
|
734
|
+
_pasteProps$delimiter,
|
735
|
+
_this7 = this;
|
736
|
+
var listOfNodes = [];
|
737
|
+
var pasteProps = this.asProps.pasteProps;
|
738
|
+
var lineProcessing = (_pasteProps$lineProce = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.lineProcessing) !== null && _pasteProps$lineProce !== void 0 ? _pasteProps$lineProce : function (line) {
|
739
|
+
var trimmedLine = line.trim();
|
740
|
+
return trimmedLine === '' ? line : trimmedLine;
|
741
|
+
};
|
742
|
+
var skipEmptyLines = (_pasteProps$skipEmpty = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.skipEmptyLines) !== null && _pasteProps$skipEmpty !== void 0 ? _pasteProps$skipEmpty : this.skipEmptyLines;
|
743
|
+
var delimiter = (_pasteProps$delimiter = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.delimiter) !== null && _pasteProps$delimiter !== void 0 ? _pasteProps$delimiter : this.delimiter;
|
744
|
+
value.split(delimiter).forEach(function (line) {
|
745
|
+
var preparedLine = lineProcessing(line);
|
746
|
+
if (preparedLine === '' && skipEmptyLines === false || preparedLine !== '') {
|
747
|
+
var node = document.createElement('p');
|
748
|
+
if (preparedLine === '') {
|
749
|
+
node.innerHTML = _this7.emptyLineValue;
|
750
|
+
} else if (preparedLine.trim() === '') {
|
751
|
+
var allSpacesRegExp = new RegExp('\\s', 'g');
|
752
|
+
node.innerHTML = DOMPurify.sanitize(preparedLine.replace(allSpacesRegExp, _this7.spaceLineValue));
|
753
|
+
} else {
|
754
|
+
node.append(document.createTextNode(preparedLine));
|
755
|
+
}
|
756
|
+
listOfNodes.push(node);
|
757
|
+
_this7.validateLine(node);
|
758
|
+
}
|
759
|
+
});
|
760
|
+
return listOfNodes;
|
761
|
+
}
|
762
|
+
}, {
|
763
|
+
key: "recalculateErrors",
|
764
|
+
value: function recalculateErrors() {
|
765
|
+
var errors = [];
|
766
|
+
this.textarea.childNodes.forEach(function (node, index) {
|
767
|
+
if (node instanceof HTMLParagraphElement && node.getAttribute('aria-invalid') === 'true') {
|
768
|
+
var _node$dataset$errorme;
|
769
|
+
var errorItem = {
|
770
|
+
errorMessage: (_node$dataset$errorme = node.dataset.errormessage) !== null && _node$dataset$errorme !== void 0 ? _node$dataset$errorme : '',
|
771
|
+
lineNode: node,
|
772
|
+
lineIndex: index
|
773
|
+
};
|
774
|
+
errors.push(errorItem);
|
775
|
+
}
|
776
|
+
});
|
777
|
+
this.asProps.onErrorsChange(errors);
|
778
|
+
}
|
779
|
+
}, {
|
780
|
+
key: "recalculateLinesCount",
|
781
|
+
value: function recalculateLinesCount() {
|
782
|
+
var _this8 = this;
|
783
|
+
if (this.linesCountTimeout) {
|
784
|
+
clearTimeout(this.linesCountTimeout);
|
785
|
+
}
|
786
|
+
this.linesCountTimeout = window.setTimeout(function () {
|
787
|
+
var lines = 0;
|
788
|
+
var _this8$asProps = _this8.asProps,
|
789
|
+
maxLines = _this8$asProps.maxLines,
|
790
|
+
linesCount = _this8$asProps.linesCount;
|
791
|
+
_this8.textarea.childNodes.forEach(function (node, index) {
|
792
|
+
if (node instanceof HTMLParagraphElement) {
|
793
|
+
node.dataset.overMaxRows = 'false';
|
794
|
+
if (node.textContent !== _this8.getEmptyParagraph().textContent && node.textContent !== '') {
|
795
|
+
lines++;
|
796
|
+
if (lines > maxLines) {
|
797
|
+
node.dataset.overMaxRows = 'true';
|
798
|
+
}
|
799
|
+
}
|
800
|
+
}
|
801
|
+
});
|
802
|
+
if (linesCount !== lines) {
|
803
|
+
_this8.asProps.onChangeLinesCount(lines);
|
804
|
+
}
|
805
|
+
}, 100);
|
806
|
+
}
|
807
|
+
}, {
|
808
|
+
key: "getValues",
|
809
|
+
value: function getValues() {
|
810
|
+
var values = [];
|
811
|
+
this.textarea.childNodes.forEach(function (node) {
|
812
|
+
var _node$textContent;
|
813
|
+
values.push((_node$textContent = node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : '');
|
814
|
+
});
|
815
|
+
return values;
|
816
|
+
}
|
817
|
+
}, {
|
818
|
+
key: "toggleErrorsPopperByKeyboard",
|
819
|
+
value: function toggleErrorsPopperByKeyboard(timer) {
|
820
|
+
var _this9 = this;
|
821
|
+
if (this.toggleErrorsPopperTimeout) {
|
822
|
+
clearTimeout(this.toggleErrorsPopperTimeout);
|
823
|
+
}
|
824
|
+
if (!this.isScrolling) {
|
825
|
+
setTimeout(function () {
|
826
|
+
var rowNode = _this9.getNodeFromSelection();
|
827
|
+
_this9.toggleErrorsPopper('keyboardLineIndex', rowNode, timer);
|
828
|
+
}, 0);
|
829
|
+
} else {
|
830
|
+
this.toggleErrorsPopperTimeout = window.setTimeout(function () {
|
831
|
+
_this9.toggleErrorsPopperByKeyboard(timer);
|
832
|
+
}, 50);
|
833
|
+
}
|
834
|
+
}
|
835
|
+
}, {
|
836
|
+
key: "toggleErrorsPopper",
|
837
|
+
value: function toggleErrorsPopper(key, target, timer) {
|
838
|
+
var _this10 = this;
|
839
|
+
if (target instanceof HTMLDivElement || target instanceof HTMLParagraphElement) {
|
840
|
+
if (this.changeTriggerTimeout) {
|
841
|
+
clearTimeout(this.changeTriggerTimeout);
|
842
|
+
}
|
843
|
+
this.changeTriggerTimeout = window.setTimeout(function () {
|
844
|
+
var targetElement = target === _this10.textarea ? _this10.getNodeFromSelection() : target;
|
845
|
+
var lineIndex = -1;
|
846
|
+
var isInvalidRow = false;
|
847
|
+
if (targetElement instanceof HTMLParagraphElement) {
|
848
|
+
isInvalidRow = targetElement.getAttribute('aria-invalid') === 'true';
|
849
|
+
lineIndex = Array.from(_this10.textarea.childNodes).indexOf(targetElement);
|
850
|
+
} else if (targetElement === _this10.textarea) {
|
851
|
+
lineIndex = 0;
|
852
|
+
}
|
853
|
+
if (targetElement instanceof HTMLElement) {
|
854
|
+
_this10.setState(function (prevState) {
|
855
|
+
var newState = {
|
856
|
+
visibleErrorPopper: _this10.isFocusing ? true : isInvalidRow,
|
857
|
+
mouseLineIndex: prevState.mouseLineIndex,
|
858
|
+
keyboardLineIndex: prevState.keyboardLineIndex
|
859
|
+
};
|
860
|
+
if (_this10.isFocusing || key === 'mouseLineIndex' && isInvalidRow) {
|
861
|
+
newState[key] = lineIndex;
|
862
|
+
}
|
863
|
+
return newState;
|
864
|
+
}, function () {
|
865
|
+
var _this10$setPopperTrig;
|
866
|
+
var trigger = isInvalidRow ? targetElement : _this10.textarea;
|
867
|
+
(_this10$setPopperTrig = _this10.setPopperTrigger) === null || _this10$setPopperTrig === void 0 ? void 0 : _this10$setPopperTrig.call(_this10, trigger);
|
868
|
+
_this10.forceUpdate();
|
869
|
+
});
|
870
|
+
}
|
871
|
+
}, timer !== null && timer !== void 0 ? timer : 50);
|
872
|
+
} else {
|
873
|
+
this.setState({
|
874
|
+
visibleErrorPopper: false
|
875
|
+
});
|
876
|
+
}
|
877
|
+
}
|
878
|
+
}, {
|
879
|
+
key: "toggleAriaInvalid",
|
880
|
+
value: function toggleAriaInvalid(showErrors, errorsLength) {
|
881
|
+
if (showErrors && errorsLength > 0) {
|
882
|
+
this.textarea.setAttribute('aria-describedby', this.popperDescribedId);
|
883
|
+
this.textarea.setAttribute('aria-invalid', 'true');
|
884
|
+
} else {
|
885
|
+
this.textarea.removeAttribute('aria-invalid');
|
886
|
+
this.textarea.removeAttribute('aria-describedby');
|
887
|
+
}
|
888
|
+
}
|
889
|
+
}, {
|
890
|
+
key: "handleChangeErrorIndex",
|
891
|
+
value: function handleChangeErrorIndex(errorIndex) {
|
892
|
+
var _error$lineNode,
|
893
|
+
_this11 = this;
|
894
|
+
var error = this.asProps.errors[errorIndex];
|
895
|
+
var childNodes = this.textarea.childNodes;
|
896
|
+
var node = error ? (_error$lineNode = error.lineNode) !== null && _error$lineNode !== void 0 ? _error$lineNode : childNodes.item(error.lineIndex) : null;
|
897
|
+
var selection = document.getSelection();
|
898
|
+
if (selection && node instanceof HTMLParagraphElement) {
|
899
|
+
this.setState({
|
900
|
+
visibleErrorPopper: false
|
901
|
+
});
|
902
|
+
setTimeout(function () {
|
903
|
+
var text = node.childNodes.item(0);
|
904
|
+
if (text instanceof Text) {
|
905
|
+
_this11.setSelection(text, 0, text.length);
|
906
|
+
} else {
|
907
|
+
_this11.setSelection(node, 0, 1);
|
908
|
+
}
|
909
|
+
}, 150);
|
910
|
+
}
|
911
|
+
}
|
912
|
+
}, {
|
913
|
+
key: "validateLine",
|
914
|
+
value: function validateLine(node) {
|
915
|
+
var lineValidation = this.asProps.lineValidation;
|
916
|
+
if (lineValidation && node instanceof HTMLElement) {
|
917
|
+
var _node$textContent2;
|
918
|
+
var _lineValidation = lineValidation((_node$textContent2 = node.textContent) !== null && _node$textContent2 !== void 0 ? _node$textContent2 : '', this.getValues()),
|
919
|
+
isValid = _lineValidation.isValid,
|
920
|
+
errorMessage = _lineValidation.errorMessage;
|
921
|
+
if (!isValid) {
|
922
|
+
node.setAttribute('aria-invalid', 'true');
|
923
|
+
node.dataset.errormessage = errorMessage;
|
924
|
+
} else {
|
925
|
+
node.removeAttribute('aria-invalid');
|
926
|
+
node.dataset.errormessage = undefined;
|
927
|
+
}
|
928
|
+
return isValid;
|
929
|
+
}
|
930
|
+
return true;
|
931
|
+
}
|
932
|
+
}, {
|
933
|
+
key: "setSelection",
|
934
|
+
value: function setSelection(node, start, end) {
|
935
|
+
var scrollType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'center';
|
936
|
+
var selection = document.getSelection();
|
937
|
+
var range = document.createRange();
|
938
|
+
range.setStart(node, start);
|
939
|
+
range.setEnd(node, end);
|
940
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
941
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range);
|
942
|
+
var nodeToScroll = node instanceof Text ? node.parentNode : node;
|
943
|
+
if (nodeToScroll instanceof HTMLElement) {
|
944
|
+
nodeToScroll.scrollIntoView({
|
945
|
+
block: scrollType,
|
946
|
+
inline: scrollType,
|
947
|
+
behavior: 'smooth'
|
948
|
+
});
|
949
|
+
}
|
950
|
+
}
|
951
|
+
}, {
|
952
|
+
key: "getNodeFromSelection",
|
953
|
+
value: function getNodeFromSelection() {
|
954
|
+
var selection = document.getSelection();
|
955
|
+
var rowNode = (selection === null || selection === void 0 ? void 0 : selection.focusNode) instanceof Text ? selection.focusNode.parentNode : selection === null || selection === void 0 ? void 0 : selection.focusNode;
|
956
|
+
return rowNode !== null && rowNode !== void 0 ? rowNode : null;
|
957
|
+
}
|
958
|
+
}, {
|
959
|
+
key: "handleCursorMovement",
|
960
|
+
value: function handleCursorMovement(currentNode, event) {
|
961
|
+
var nextNode = null;
|
962
|
+
switch (event.key) {
|
963
|
+
case 'ArrowUp':
|
964
|
+
event.preventDefault();
|
965
|
+
nextNode = currentNode.previousSibling;
|
966
|
+
break;
|
967
|
+
case 'ArrowDown':
|
968
|
+
event.preventDefault();
|
969
|
+
nextNode = currentNode.nextSibling;
|
970
|
+
break;
|
971
|
+
case 'ArrowLeft':
|
972
|
+
{
|
973
|
+
if (currentNode.textContent === this.getEmptyParagraph().textContent) {
|
974
|
+
event.preventDefault();
|
975
|
+
nextNode = currentNode.previousSibling;
|
976
|
+
}
|
977
|
+
break;
|
978
|
+
}
|
979
|
+
case 'ArrowRight':
|
980
|
+
{
|
981
|
+
if (currentNode.textContent === this.getEmptyParagraph().textContent) {
|
982
|
+
event.preventDefault();
|
983
|
+
nextNode = currentNode.nextSibling;
|
984
|
+
}
|
985
|
+
}
|
986
|
+
}
|
987
|
+
if (nextNode instanceof HTMLParagraphElement) {
|
988
|
+
var _nextNode$textContent, _nextNode$textContent2, _selection$focusOffse;
|
989
|
+
var selection = document.getSelection();
|
990
|
+
var firstNode = nextNode.childNodes.item(0);
|
991
|
+
var nodeToSetSelection = firstNode instanceof Text ? firstNode : nextNode;
|
992
|
+
var textNode = (_nextNode$textContent = (_nextNode$textContent2 = nextNode.textContent) === null || _nextNode$textContent2 === void 0 ? void 0 : _nextNode$textContent2.trim()) !== null && _nextNode$textContent !== void 0 ? _nextNode$textContent : '';
|
993
|
+
var currentOffset = (_selection$focusOffse = selection === null || selection === void 0 ? void 0 : selection.focusOffset) !== null && _selection$focusOffse !== void 0 ? _selection$focusOffse : 0;
|
994
|
+
var offset = currentOffset <= textNode.length ? currentOffset : textNode.length;
|
995
|
+
|
996
|
+
// it only works if node is empty, that's why here we could set 0 or node.length
|
997
|
+
if (event.key === 'ArrowLeft') {
|
998
|
+
offset = textNode.length;
|
999
|
+
} else if (event.key === 'ArrowRight') {
|
1000
|
+
offset = 0;
|
1001
|
+
}
|
1002
|
+
this.setSelection(nodeToSetSelection, offset, offset, 'nearest');
|
1003
|
+
}
|
1004
|
+
}
|
1005
|
+
}, {
|
1006
|
+
key: "setErrorIndex",
|
1007
|
+
value: function setErrorIndex(nodeToCompare) {
|
1008
|
+
var errorIndex = Array.from(this.textarea.childNodes).filter(function (node) {
|
1009
|
+
return node instanceof Element && node.getAttribute('aria-invalid') === 'true';
|
1010
|
+
}).findIndex(function (node) {
|
1011
|
+
return node === nodeToCompare;
|
1012
|
+
});
|
1013
|
+
this.handlers.errorIndex(errorIndex);
|
1014
|
+
}
|
1015
|
+
}, {
|
1016
|
+
key: "isDeleteKey",
|
1017
|
+
value: function isDeleteKey(event) {
|
1018
|
+
return event.key === 'Backspace' || event.key === 'x' && (event.ctrlKey || event.metaKey);
|
1019
|
+
}
|
1020
|
+
}, {
|
1021
|
+
key: "getEmptyParagraph",
|
1022
|
+
value: function getEmptyParagraph() {
|
1023
|
+
var element = document.createElement('p');
|
1024
|
+
element.innerHTML = this.emptyLineValue;
|
1025
|
+
return element;
|
1026
|
+
}
|
1027
|
+
}, {
|
1028
|
+
key: "addEventListeners",
|
1029
|
+
value: function addEventListeners(textarea) {
|
1030
|
+
textarea.addEventListener('paste', this.handlePaste);
|
1031
|
+
textarea.addEventListener('input', this.handleChange);
|
1032
|
+
textarea.addEventListener('focus', this.handleFocus);
|
1033
|
+
textarea.addEventListener('blur', this.handleBlur);
|
1034
|
+
textarea.addEventListener('keydown', this.handleKeyDown);
|
1035
|
+
textarea.addEventListener('mousedown', this.handleMouseDown);
|
1036
|
+
textarea.addEventListener('mousemove', this.handleMouseMove);
|
1037
|
+
textarea.addEventListener('mouseleave', this.handleMouseLeave);
|
1038
|
+
textarea.addEventListener('scroll', this.handleScroll);
|
1039
|
+
textarea.removeEventListener('keydown', this.handleSelectAll);
|
1040
|
+
}
|
1041
|
+
}, {
|
1042
|
+
key: "removeEventListeners",
|
1043
|
+
value: function removeEventListeners(textarea) {
|
1044
|
+
textarea.removeEventListener('paste', this.handlePaste);
|
1045
|
+
textarea.removeEventListener('input', this.handleChange);
|
1046
|
+
textarea.removeEventListener('focus', this.handleFocus);
|
1047
|
+
textarea.removeEventListener('blur', this.handleBlur);
|
1048
|
+
textarea.removeEventListener('keydown', this.handleKeyDown);
|
1049
|
+
textarea.removeEventListener('mousedown', this.handleMouseDown);
|
1050
|
+
textarea.removeEventListener('mousemove', this.handleMouseMove);
|
1051
|
+
textarea.removeEventListener('mouseleave', this.handleMouseLeave);
|
1052
|
+
textarea.removeEventListener('scroll', this.handleScroll);
|
1053
|
+
textarea.addEventListener('keydown', this.handleSelectAll);
|
1054
|
+
}
|
1055
|
+
}, {
|
1056
|
+
key: "handleSelectAll",
|
1057
|
+
value: function handleSelectAll(event) {
|
1058
|
+
if (event.key === 'a' && (event.metaKey || event.ctrlKey)) {
|
1059
|
+
event.preventDefault();
|
1060
|
+
var node = event.target;
|
1061
|
+
if (node instanceof HTMLElement && node === this.textarea) {
|
1062
|
+
this.setSelection(node, 0, node.childNodes.length);
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
}, {
|
1067
|
+
key: "isRangeSelection",
|
1068
|
+
value: function isRangeSelection() {
|
1069
|
+
var selection = document.getSelection();
|
1070
|
+
return (selection === null || selection === void 0 ? void 0 : selection.focusNode) !== (selection === null || selection === void 0 ? void 0 : selection.anchorNode) || (selection === null || selection === void 0 ? void 0 : selection.focusOffset) !== (selection === null || selection === void 0 ? void 0 : selection.anchorOffset);
|
1071
|
+
}
|
1072
|
+
}, {
|
1073
|
+
key: "getSelectionDirection",
|
1074
|
+
value: function getSelectionDirection() {
|
1075
|
+
var selection = document.getSelection();
|
1076
|
+
if (selection !== null && selection !== void 0 && selection.anchorNode && selection !== null && selection !== void 0 && selection.focusNode) {
|
1077
|
+
var documentPosition = selection.anchorNode.compareDocumentPosition(selection.focusNode);
|
1078
|
+
if (documentPosition === 0 && selection.anchorOffset > selection.focusOffset ||
|
1079
|
+
// if nodes are the same
|
1080
|
+
documentPosition === Node.DOCUMENT_POSITION_PRECEDING) {
|
1081
|
+
return 'backward';
|
1082
|
+
}
|
1083
|
+
return 'forward';
|
1084
|
+
}
|
1085
|
+
return null;
|
1086
|
+
}
|
1087
|
+
}]);
|
1088
|
+
return InputField;
|
1089
|
+
}(Component);
|
1090
|
+
_defineProperty(InputField, "displayName", 'Textarea');
|
1091
|
+
_defineProperty(InputField, "style", style);
|
1092
|
+
_defineProperty(InputField, "enhance", [uniqueIDEnhancement()]);
|
1093
|
+
_defineProperty(InputField, "defaultProps", {
|
1094
|
+
defaultValue: '',
|
1095
|
+
size: 'm',
|
1096
|
+
state: 'normal',
|
1097
|
+
minRows: 2,
|
1098
|
+
maxRows: 10,
|
1099
|
+
defaultShowErrors: false,
|
1100
|
+
defaultErrorIndex: -1,
|
1101
|
+
defaultLinesCount: 0
|
1102
|
+
});
|
1103
|
+
export { InputField };
|
1104
|
+
//# sourceMappingURL=InputField.js.map
|