@semcore/bulk-textarea 1.5.0-prerelease.0 → 1.5.0-prerelease.1
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/lib/cjs/BulkTextarea.js +38 -35
- package/lib/cjs/BulkTextarea.js.map +1 -1
- package/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/lib/cjs/components/ClearAll.js +2 -2
- package/lib/cjs/components/ClearAll.js.map +1 -1
- package/lib/cjs/components/Counter.js +5 -5
- package/lib/cjs/components/Counter.js.map +1 -1
- package/lib/cjs/components/ErrorsNavigation.js +14 -14
- package/lib/cjs/components/ErrorsNavigation.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.js +167 -219
- package/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/lib/cjs/components/InputField/inputField.shadow.css +18 -56
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js +5 -4
- package/lib/cjs/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/es6/BulkTextarea.js +32 -31
- package/lib/es6/BulkTextarea.js.map +1 -1
- package/lib/es6/BulkTextarea.types.js.map +1 -1
- package/lib/es6/components/ClearAll.js +2 -2
- package/lib/es6/components/ClearAll.js.map +1 -1
- package/lib/es6/components/Counter.js +2 -2
- package/lib/es6/components/Counter.js.map +1 -1
- package/lib/es6/components/ErrorsNavigation.js +10 -10
- package/lib/es6/components/ErrorsNavigation.js.map +1 -1
- package/lib/es6/components/InputField/InputField.js +165 -219
- package/lib/es6/components/InputField/InputField.js.map +1 -1
- package/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/lib/es6/components/InputField/inputField.shadow.css +18 -56
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/translations/__intergalactic-dynamic-locales.js +2 -2
- package/lib/es6/translations/__intergalactic-dynamic-locales.js.map +1 -1
- package/lib/esm/BulkTextarea.mjs +35 -33
- package/lib/esm/components/ClearAll.mjs +1 -1
- package/lib/esm/components/Counter.mjs +2 -2
- package/lib/esm/components/ErrorsNavigation.mjs +4 -4
- package/lib/esm/components/InputField/InputField.mjs +136 -181
- package/lib/esm/components/InputField/inputField.shadow.css +18 -56
- package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +2 -2
- package/lib/types/BulkTextarea.d.ts +1 -1
- package/lib/types/BulkTextarea.types.d.ts +8 -113
- package/lib/types/components/ClearAll.d.ts +2 -2
- package/lib/types/components/Counter.d.ts +4 -4
- package/lib/types/components/ErrorsNavigation.d.ts +2 -2
- package/lib/types/components/InputField/InputField.d.ts +7 -12
- package/lib/types/components/InputField/InputField.types.d.ts +125 -11
- package/package.json +10 -10
|
@@ -1,94 +1,78 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
6
|
-
import
|
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
10
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
10
11
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
11
|
-
import { Box } from '@semcore/base-components';
|
|
12
|
-
import { Component, sstyled, Root } from '@semcore/core';
|
|
13
|
-
import { extractAriaProps } from '@semcore/core/lib/utils/ariaProps';
|
|
14
|
-
import uniqueIDEnhancement from '@semcore/core/lib/utils/uniqueID';
|
|
15
|
-
import Tooltip from '@semcore/tooltip';
|
|
16
|
-
import DOMPurify from 'dompurify';
|
|
17
12
|
import React from 'react';
|
|
13
|
+
import { Component, sstyled, Root } from '@semcore/core';
|
|
14
|
+
import { Box } from '@semcore/flex-box';
|
|
18
15
|
/*!__reshadow-styles__:"./inputField.shadow.css"*/
|
|
19
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___SInputField_w0knh_gg_>div{box-sizing:content-box;outline:0;border-radius:var(--intergalactic-control-rounded, 6px);border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));border-style:solid;border-width:1px;overflow:auto;position:relative;background-color:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));word-wrap:break-word;word-break:break-word;font-family:inherit}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_>div{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SInputField_w0knh_gg_>div{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SInputField_w0knh_gg_>div:empty::before{content:\"1. \"attr(placeholder);color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457));position:absolute}.___SInputField_w0knh_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_w0knh_gg_>div:nth-child(even)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));margin-right:var(--intergalactic-spacing-1x, 4px)}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_w0knh_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_w0knh_gg_>div>p{counter-increment:row;margin:0 0 var(--intergalactic-spacing-1x, 4px)0;position:relative;word-break:break-all;white-space:pre-wrap;padding:0 var(--intergalactic-spacing-5x, 20px)0 var(--intergalactic-spacing-4x, 16px)}.___SInputField_w0knh_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_w0knh_gg_>div>p:not(:empty)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));margin-right:var(--intergalactic-spacing-1x, 4px);position:absolute;left:0}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_w0knh_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_w0knh_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 239))}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 239))}@media (color-gamut:p3){.___SInputField_w0knh_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, color(display-p3 1 0.92002 0.9342))}}}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+10))>p{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+100))>p{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+1000))>p{padding-left:calc(var(--intergalactic-spacing-10x, 40px) + var(--intergalactic-spacing-1x, 4px))}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+1000))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+1000))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+1000))>p:nth-child(n+100)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_w0knh_gg_>div:has(p:nth-child(n+1000))>p:nth-child(n+1000)::before{padding-left:0}.___SInputField_w0knh_gg_.__showErrors_w0knh_gg_>div[aria-invalid]>p[aria-invalid]:after{content:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjZDEwMDJmIj48cGF0aCBkPSJNNyA2aDJ2NEg3VjZabTIgN3YtMkg3djJoMloiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMTUyIDEuMTcyYy43MTktMS41NjMgMi45NzctMS41NjMgMy42OTYgMGw2LjA0MyAxMy4xNDFjLjM2My43OTEtLjIyNSAxLjY4Ny0xLjEwOSAxLjY4N0gxLjIxOGMtLjg4NCAwLTEuNDcyLS44OTYtMS4xMDktMS42ODdMNi4xNTIgMS4xNzJabTcuMzc0IDEyLjgzN0w4IDEuOTkgMi40NzQgMTQuMDFoMTEuMDUyWiIvPjwvc3ZnPgo=\\ );position:absolute;right:0;top:var(--intergalactic-spacing-05x, 2px)}.___SInputField_w0knh_gg_._size_m_w0knh_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_w0knh)*20px);max-height:calc((var(--maxRows_w0knh) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_w0knh_gg_._size_m_w0knh_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_w0knh_gg_._size_l_w0knh_gg_>div:empty::before,.___SInputField_w0knh_gg_._size_m_w0knh_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_w0knh_gg_._size_l_w0knh_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_w0knh)*24px);max-height:calc((var(--maxRows_w0knh) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_w0knh_gg_._size_l_w0knh_gg_>div:empty{padding-left:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px))}.___SInputField_w0knh_gg_._state_normal_w0knh_gg_:not(.__disabled_w0knh_gg_)>div:focus{border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386));outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_._state_normal_w0knh_gg_:not(.__disabled_w0knh_gg_)>div:focus{border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_normal_w0knh_gg_:not(.__disabled_w0knh_gg_)>div:focus{border-color:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08334 0.73488 / 0.386))}}}.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div{border-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154));outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}@supports (color:oklab(0%0 0%)){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div:focus{outline-color:var(--intergalactic-keyboard-focus-valid-outline, rgb(0, 190, 142))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_valid_w0knh_gg_>div:focus{outline-color:var(--intergalactic-keyboard-focus-valid-outline, oklch(0.711 0.146 166.9))}}}.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 1px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));border-bottom-left-radius:var(--intergalactic-control-rounded, 6px);border-top-left-radius:var(--intergalactic-control-rounded, 6px);background-repeat:repeat-y}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 1px, transparent 0, transparent 50%))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, color(display-p3 0.918 0.19866 0.14259 / 0.56) 0, color(display-p3 0.918 0.19866 0.14259 / 0.56) 1px, transparent 0, transparent 50%))}}}.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));outline-color:var(--intergalactic-keyboard-focus-outline, #008ff8);outline-style:solid;outline-width:2px;transition-duration:calc(var(--intergalactic-duration-extra-fast, 100)*1ms);transition-timing-function:ease-in-out;outline-offset:0;transition-property:outline-color,outline-width}@supports (color:color(display-p3 0 0 0%)){.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56))}@media (color-gamut:p3){.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div:focus{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56))}}}@supports (color:oklab(0%0 0%)){.___SInputField_w0knh_gg_._state_invalid_w0knh_gg_>div:focus{outline-color:var(--intergalactic-keyboard-focus-invalid-outline, oklch(0.628 0.257 28.9 / 0.652))}}.___SInputField_w0knh_gg_.__readonly_w0knh_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, rgb(248, 249, 248))}.___SInputField_w0knh_gg_.__disabled_w0knh_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.4)}", /*__inner_css_end__*/"w0knh_gg_"),
|
|
16
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SInputField_zc5ez_gg_>div{box-sizing:content-box;outline:0;border-radius:var(--intergalactic-control-rounded, 6px);border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));border-style:solid;border-width:1px;overflow:auto;position:relative;background-color:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899));word-wrap:break-word;word-break:break-word;font-family:inherit}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_>div{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_>div{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SInputField_zc5ez_gg_>div:empty::before{content:\"1. \"attr(placeholder);color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457));position:absolute}.___SInputField_zc5ez_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_zc5ez_gg_>div:nth-child(even)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));margin-right:var(--intergalactic-spacing-1x, 4px)}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_zc5ez_gg_>div>p{counter-increment:row;margin:0 0 var(--intergalactic-spacing-1x, 4px)0;position:relative;word-break:break-all;white-space:pre-wrap;padding:0 var(--intergalactic-spacing-5x, 20px)0 var(--intergalactic-spacing-4x, 16px)}.___SInputField_zc5ez_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_zc5ez_gg_>div>p:not(:empty)::before{content:counter(row)\".\";display:inline-block;white-space:nowrap;text-align:right;color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));margin-right:var(--intergalactic-spacing-1x, 4px);position:absolute;left:0}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_zc5ez_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 239))}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 238))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, color(display-p3 1 0.91978 0.9341))}}}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+10))>p{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+100))>p{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_zc5ez_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_zc5ez_gg_.__showErrors_zc5ez_gg_>div[aria-invalid]>p[aria-invalid]:after{content:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiBmaWxsPSIjZDEwMDJmIj48cGF0aCBkPSJNNyA2aDJ2NEg3VjZabTIgN3YtMkg3djJoMloiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTYuMTUyIDEuMTcyYy43MTktMS41NjMgMi45NzctMS41NjMgMy42OTYgMGw2LjA0MyAxMy4xNDFjLjM2My43OTEtLjIyNSAxLjY4Ny0xLjEwOSAxLjY4N0gxLjIxOGMtLjg4NCAwLTEuNDcyLS44OTYtMS4xMDktMS42ODdMNi4xNTIgMS4xNzJabTcuMzc0IDEyLjgzN0w4IDEuOTkgMi40NzQgMTQuMDFoMTEuMDUyWiIvPjwvc3ZnPgo=\\ );position:absolute;right:0;top:var(--intergalactic-spacing-05x, 2px)}.___SInputField_zc5ez_gg_._size_m_zc5ez_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_zc5ez)*20px);max-height:calc((var(--maxRows_zc5ez) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_zc5ez_gg_._size_m_zc5ez_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_zc5ez_gg_._size_l_zc5ez_gg_>div:empty::before,.___SInputField_zc5ez_gg_._size_m_zc5ez_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_zc5ez_gg_._size_l_zc5ez_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_zc5ez)*24px);max-height:calc((var(--maxRows_zc5ez) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_zc5ez_gg_._size_l_zc5ez_gg_>div:empty{padding-left:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px))}.___SInputField_zc5ez_gg_._state_normal_zc5ez_gg_:not(.__disabled_zc5ez_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 18, 193, 0.441));border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_._state_normal_zc5ez_gg_:not(.__disabled_zc5ez_gg_)>div:focus:focus{border-color:var(--intergalactic-border-info-active, rgba(0, 22, 195, 0.386))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_._state_normal_zc5ez_gg_:not(.__disabled_zc5ez_gg_)>div:focus:focus{border-color:var(--intergalactic-border-info-active, color(display-p3 0.01805 0.08333 0.73488 / 0.386))}}}.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div{border-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgb(0, 190, 142))}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgb(0, 190, 142))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_._state_valid_zc5ez_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px color(display-p3 0.33388 0.7337 0.56959))}}}.___SInputField_zc5ez_gg_._state_invalid_zc5ez_gg_>div{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 1px, transparent 0, transparent 50%));background-size:6px 6px;background-color:var(--intergalactic-bg-primary-neutral, rgb(255, 255, 255));border-bottom-left-radius:var(--intergalactic-control-rounded, 6px);border-top-left-radius:var(--intergalactic-control-rounded, 6px);background-repeat:repeat-y}@supports (color:color(display-p3 0 0 0)){.___SInputField_zc5ez_gg_._state_invalid_zc5ez_gg_>div{border-color:var(--intergalactic-border-critical-active, rgba(255, 0, 4, 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, rgba(255, 0, 4, 0.56) 0, rgba(255, 0, 4, 0.56) 1px, transparent 0, transparent 50%))}@media (color-gamut:p3){.___SInputField_zc5ez_gg_._state_invalid_zc5ez_gg_>div{border-color:var(--intergalactic-border-critical-active, color(display-p3 0.918 0.19866 0.14259 / 0.56));background-image:var(--intergalactic-border-critical-pattern, repeating-linear-gradient(315deg, color(display-p3 0.918 0.19866 0.14259 / 0.56) 0, color(display-p3 0.918 0.19866 0.14259 / 0.56) 1px, transparent 0, transparent 50%))}}}.___SInputField_zc5ez_gg_._state_invalid_zc5ez_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 2, 7, 0.652))}.___SInputField_zc5ez_gg_.__readonly_zc5ez_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, rgb(248, 249, 248))}.___SInputField_zc5ez_gg_.__disabled_zc5ez_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.4)}", /*__inner_css_end__*/"zc5ez_gg_"),
|
|
20
17
|
/*__reshadow_css_end__*/
|
|
21
18
|
{
|
|
22
|
-
"__SInputField": "
|
|
23
|
-
"_showErrors": "
|
|
24
|
-
"_readonly": "
|
|
25
|
-
"_disabled": "
|
|
26
|
-
"_size_m": "
|
|
27
|
-
"--minRows": "--
|
|
28
|
-
"--maxRows": "--
|
|
29
|
-
"_size_l": "
|
|
30
|
-
"_state_normal": "
|
|
31
|
-
"_state_valid": "
|
|
32
|
-
"_state_invalid": "
|
|
19
|
+
"__SInputField": "___SInputField_zc5ez_gg_",
|
|
20
|
+
"_showErrors": "__showErrors_zc5ez_gg_",
|
|
21
|
+
"_readonly": "__readonly_zc5ez_gg_",
|
|
22
|
+
"_disabled": "__disabled_zc5ez_gg_",
|
|
23
|
+
"_size_m": "_size_m_zc5ez_gg_",
|
|
24
|
+
"--minRows": "--minRows_zc5ez",
|
|
25
|
+
"--maxRows": "--maxRows_zc5ez",
|
|
26
|
+
"_size_l": "_size_l_zc5ez_gg_",
|
|
27
|
+
"_state_normal": "_state_normal_zc5ez_gg_",
|
|
28
|
+
"_state_valid": "_state_valid_zc5ez_gg_",
|
|
29
|
+
"_state_invalid": "_state_invalid_zc5ez_gg_"
|
|
33
30
|
});
|
|
31
|
+
import Tooltip from '@semcore/tooltip';
|
|
32
|
+
import { extractAriaProps } from '@semcore/utils/lib/ariaProps';
|
|
33
|
+
import uniqueIDEnhancement from '@semcore/utils/lib/uniqueID';
|
|
34
|
+
import DOMPurify from 'dompurify';
|
|
34
35
|
var InputField = /*#__PURE__*/function (_Component) {
|
|
36
|
+
_inherits(InputField, _Component);
|
|
37
|
+
var _super = _createSuper(InputField);
|
|
35
38
|
function InputField(props) {
|
|
36
39
|
var _this;
|
|
37
40
|
_classCallCheck(this, InputField);
|
|
38
|
-
_this =
|
|
39
|
-
_defineProperty(_this, "delimiter", '\n');
|
|
40
|
-
_defineProperty(_this, "skipEmptyLines", true);
|
|
41
|
-
_defineProperty(_this, "emptyLineValue", '');
|
|
42
|
-
_defineProperty(_this, "spaceLineValue", ' ');
|
|
43
|
-
_defineProperty(_this, "containerRef", /*#__PURE__*/React.createRef());
|
|
44
|
-
_defineProperty(_this, "textarea", void 0);
|
|
45
|
-
_defineProperty(_this, "popper", null);
|
|
46
|
-
_defineProperty(_this, "setPopperTrigger", null);
|
|
47
|
-
_defineProperty(_this, "errorByInteraction", null);
|
|
48
|
-
_defineProperty(_this, "changeTriggerTimeout", 0);
|
|
49
|
-
_defineProperty(_this, "isScrolling", false);
|
|
50
|
-
_defineProperty(_this, "scrollingTimeout", 0);
|
|
51
|
-
_defineProperty(_this, "toggleErrorsPopperTimeout", 0);
|
|
52
|
-
_defineProperty(_this, "isFocusing", false);
|
|
53
|
-
_defineProperty(_this, "linesCountTimeout", 0);
|
|
54
|
-
_defineProperty(_this, "
|
|
55
|
-
_defineProperty(_this, "state", {
|
|
41
|
+
_this = _super.call(this, props);
|
|
42
|
+
_defineProperty(_assertThisInitialized(_this), "delimiter", '\n');
|
|
43
|
+
_defineProperty(_assertThisInitialized(_this), "skipEmptyLines", true);
|
|
44
|
+
_defineProperty(_assertThisInitialized(_this), "emptyLineValue", '');
|
|
45
|
+
_defineProperty(_assertThisInitialized(_this), "spaceLineValue", ' ');
|
|
46
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/React.createRef());
|
|
47
|
+
_defineProperty(_assertThisInitialized(_this), "textarea", void 0);
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "popper", null);
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "setPopperTrigger", null);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "errorByInteraction", null);
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "changeTriggerTimeout", 0);
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "isScrolling", false);
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "scrollingTimeout", 0);
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "toggleErrorsPopperTimeout", 0);
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "isFocusing", false);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "linesCountTimeout", 0);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
56
58
|
visibleErrorPopper: false,
|
|
57
59
|
keyboardLineIndex: -1,
|
|
58
60
|
mouseLineIndex: -1
|
|
59
61
|
});
|
|
60
|
-
_this.handlePaste = _this.handlePaste.bind(_this);
|
|
61
|
-
_this.handleChange = _this.handleChange.bind(_this);
|
|
62
|
-
_this.handleFocus = _this.handleFocus.bind(_this);
|
|
63
|
-
_this.handleBlur = _this.handleBlur.bind(_this);
|
|
64
|
-
_this.handleKeyDown = _this.handleKeyDown.bind(_this);
|
|
65
|
-
_this.handleMouseDown = _this.handleMouseDown.bind(_this);
|
|
66
|
-
_this.handleMouseMove = _this.handleMouseMove.bind(_this);
|
|
67
|
-
_this.handleMouseLeave = _this.handleMouseLeave.bind(_this);
|
|
68
|
-
_this.handleScroll = _this.handleScroll.bind(_this);
|
|
69
|
-
_this.handleSelectAll = _this.handleSelectAll.bind(_this);
|
|
62
|
+
_this.handlePaste = _this.handlePaste.bind(_assertThisInitialized(_this));
|
|
63
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
64
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
|
65
|
+
_this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
|
|
66
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
|
67
|
+
_this.handleMouseDown = _this.handleMouseDown.bind(_assertThisInitialized(_this));
|
|
68
|
+
_this.handleMouseMove = _this.handleMouseMove.bind(_assertThisInitialized(_this));
|
|
69
|
+
_this.handleMouseLeave = _this.handleMouseLeave.bind(_assertThisInitialized(_this));
|
|
70
|
+
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
|
71
|
+
_this.handleSelectAll = _this.handleSelectAll.bind(_assertThisInitialized(_this));
|
|
70
72
|
_this.textarea = _this.createContentEditableElement(props);
|
|
71
|
-
_this.observer = new MutationObserver(function (mutationsList, observer) {
|
|
72
|
-
var _iterator = _createForOfIteratorHelper(mutationsList),
|
|
73
|
-
_step;
|
|
74
|
-
try {
|
|
75
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
76
|
-
var mutation = _step.value;
|
|
77
|
-
if (mutation.type === 'characterData' || mutation.type === 'childList') {
|
|
78
|
-
var _this$props$onImmedia, _this$props, _this$textarea$textCo;
|
|
79
|
-
(_this$props$onImmedia = (_this$props = _this.props).onImmediatelyChange) === null || _this$props$onImmedia === void 0 || _this$props$onImmedia.call(_this$props, _this.getValues(), (_this$textarea$textCo = _this.textarea.textContent) !== null && _this$textarea$textCo !== void 0 ? _this$textarea$textCo : '');
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
} catch (err) {
|
|
83
|
-
_iterator.e(err);
|
|
84
|
-
} finally {
|
|
85
|
-
_iterator.f();
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
73
|
return _this;
|
|
89
74
|
}
|
|
90
|
-
|
|
91
|
-
return _createClass(InputField, [{
|
|
75
|
+
_createClass(InputField, [{
|
|
92
76
|
key: "uncontrolledProps",
|
|
93
77
|
value: function uncontrolledProps() {
|
|
94
78
|
return {
|
|
@@ -100,71 +84,32 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
100
84
|
}, {
|
|
101
85
|
key: "componentDidMount",
|
|
102
86
|
value: function componentDidMount() {
|
|
103
|
-
var _this$containerRef$cu
|
|
104
|
-
|
|
105
|
-
var _this$asProps = this.asProps,
|
|
106
|
-
autoFocus = _this$asProps.autoFocus,
|
|
107
|
-
disabled = _this$asProps.disabled,
|
|
108
|
-
readonly = _this$asProps.readonly;
|
|
109
|
-
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 || _this$containerRef$cu.append(this.textarea);
|
|
87
|
+
var _this$containerRef$cu;
|
|
88
|
+
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 ? void 0 : _this$containerRef$cu.append(this.textarea);
|
|
110
89
|
this.handleValueOutChange();
|
|
111
|
-
var config = {
|
|
112
|
-
childList: true,
|
|
113
|
-
characterData: true,
|
|
114
|
-
subtree: true
|
|
115
|
-
};
|
|
116
|
-
if (this.props.onImmediatelyChange) {
|
|
117
|
-
this.observer.observe(this.textarea, config);
|
|
118
|
-
}
|
|
119
|
-
if (autoFocus && !disabled) {
|
|
120
|
-
/* Safari & Firefox may silently ignore programmatic focus calls with very short
|
|
121
|
-
delays (<10ms). Using 10ms as a safe threshold based on observed behavior.
|
|
122
|
-
*/
|
|
123
|
-
setTimeout(function () {
|
|
124
|
-
return _this2.textarea.focus();
|
|
125
|
-
}, 10);
|
|
126
|
-
}
|
|
127
90
|
}
|
|
128
91
|
}, {
|
|
129
92
|
key: "componentDidUpdate",
|
|
130
93
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
131
|
-
var
|
|
132
|
-
var _this$
|
|
133
|
-
value = _this$
|
|
134
|
-
errors = _this$
|
|
135
|
-
errorIndex = _this$
|
|
136
|
-
showErrors = _this$
|
|
137
|
-
disabled = _this$
|
|
138
|
-
readonly = _this$
|
|
139
|
-
highlightErrorIndex = _this$
|
|
140
|
-
lineProcessing = _this$
|
|
141
|
-
_this$
|
|
142
|
-
ariaDescribedby = _this$
|
|
94
|
+
var _this2 = this;
|
|
95
|
+
var _this$props = this.props,
|
|
96
|
+
value = _this$props.value,
|
|
97
|
+
errors = _this$props.errors,
|
|
98
|
+
errorIndex = _this$props.errorIndex,
|
|
99
|
+
showErrors = _this$props.showErrors,
|
|
100
|
+
disabled = _this$props.disabled,
|
|
101
|
+
readonly = _this$props.readonly,
|
|
102
|
+
highlightErrorIndex = _this$props.highlightErrorIndex,
|
|
103
|
+
lineProcessing = _this$props.lineProcessing,
|
|
104
|
+
_this$props$ariaDesc = _this$props['aria-describedby'],
|
|
105
|
+
ariaDescribedby = _this$props$ariaDesc === void 0 ? '' : _this$props$ariaDesc;
|
|
143
106
|
if (prevProps.value !== value) {
|
|
144
107
|
var currentValue = this.getValues().join(this.delimiter);
|
|
145
108
|
if (typeof value === 'string' ? value !== currentValue : value.join(this.delimiter) !== currentValue) {
|
|
146
109
|
this.handleValueOutChange();
|
|
147
110
|
}
|
|
148
111
|
}
|
|
149
|
-
if (prevProps.showErrors !== showErrors || prevProps.errors !== errors) {
|
|
150
|
-
if (showErrors) {
|
|
151
|
-
var errorsMap = new Map();
|
|
152
|
-
errors.forEach(function (error) {
|
|
153
|
-
errorsMap.set(error.lineIndex, error);
|
|
154
|
-
});
|
|
155
|
-
this.textarea.childNodes.forEach(function (node, index) {
|
|
156
|
-
if (node instanceof HTMLParagraphElement) {
|
|
157
|
-
var errorItem = errorsMap.get(index);
|
|
158
|
-
if (errorItem) {
|
|
159
|
-
node.setAttribute('aria-invalid', 'true');
|
|
160
|
-
node.dataset.errormessage = errorItem.errorMessage;
|
|
161
|
-
} else {
|
|
162
|
-
node.removeAttribute('aria-invalid');
|
|
163
|
-
node.dataset.errormessage = undefined;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
}
|
|
112
|
+
if (prevProps.showErrors !== showErrors || prevProps.errors.length !== errors.length) {
|
|
168
113
|
this.toggleAriaInvalid(showErrors, errors.length);
|
|
169
114
|
if (showErrors === false) {
|
|
170
115
|
this.textarea.setAttribute('aria-describedby', ariaDescribedby);
|
|
@@ -204,12 +149,13 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
204
149
|
}
|
|
205
150
|
this.validateLine(paragraph);
|
|
206
151
|
setTimeout(function () {
|
|
207
|
-
var newNode =
|
|
152
|
+
var newNode = _this2.textarea.childNodes.item(keyboardLineIndex);
|
|
208
153
|
if (newNode) {
|
|
209
|
-
|
|
154
|
+
_this2.setErrorIndex(newNode);
|
|
210
155
|
}
|
|
211
156
|
}, 0); // need this timeout to update errorIndex to the new (usually empty) line
|
|
212
157
|
}
|
|
158
|
+
|
|
213
159
|
if (!showErrors) {
|
|
214
160
|
this.recalculateErrors();
|
|
215
161
|
}
|
|
@@ -221,14 +167,13 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
221
167
|
key: "componentWillUnmount",
|
|
222
168
|
value: function componentWillUnmount() {
|
|
223
169
|
this.removeEventListeners(this.textarea);
|
|
224
|
-
this.observer.disconnect();
|
|
225
170
|
}
|
|
226
171
|
}, {
|
|
227
172
|
key: "isDisabled",
|
|
228
173
|
get: function get() {
|
|
229
|
-
var _this$
|
|
230
|
-
disabled = _this$
|
|
231
|
-
readonly = _this$
|
|
174
|
+
var _this$asProps = this.asProps,
|
|
175
|
+
disabled = _this$asProps.disabled,
|
|
176
|
+
readonly = _this$asProps.readonly;
|
|
232
177
|
return Boolean(disabled || readonly);
|
|
233
178
|
}
|
|
234
179
|
}, {
|
|
@@ -241,11 +186,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
241
186
|
key: "errorMessage",
|
|
242
187
|
get: function get() {
|
|
243
188
|
var _errorItem$errorMessa, _errorItem, _errorItem2;
|
|
244
|
-
var _this$
|
|
245
|
-
errors = _this$
|
|
246
|
-
errorIndex = _this$
|
|
247
|
-
commonErrorMessage = _this$
|
|
248
|
-
prevError = _this$
|
|
189
|
+
var _this$asProps2 = this.asProps,
|
|
190
|
+
errors = _this$asProps2.errors,
|
|
191
|
+
errorIndex = _this$asProps2.errorIndex,
|
|
192
|
+
commonErrorMessage = _this$asProps2.commonErrorMessage,
|
|
193
|
+
prevError = _this$asProps2.prevError;
|
|
249
194
|
var _this$state = this.state,
|
|
250
195
|
mouseLineIndex = _this$state.mouseLineIndex,
|
|
251
196
|
keyboardLineIndex = _this$state.keyboardLineIndex;
|
|
@@ -300,9 +245,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
300
245
|
}, {
|
|
301
246
|
key: "handleValueOutChange",
|
|
302
247
|
value: function handleValueOutChange() {
|
|
303
|
-
var _this$
|
|
304
|
-
value = _this$
|
|
305
|
-
onChangeLinesCount = _this$
|
|
248
|
+
var _this$props2 = this.props,
|
|
249
|
+
value = _this$props2.value,
|
|
250
|
+
onChangeLinesCount = _this$props2.onChangeLinesCount;
|
|
306
251
|
if (value === '') {
|
|
307
252
|
this.textarea.textContent = '';
|
|
308
253
|
onChangeLinesCount(0);
|
|
@@ -317,13 +262,13 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
317
262
|
}, {
|
|
318
263
|
key: "handleScroll",
|
|
319
264
|
value: function handleScroll() {
|
|
320
|
-
var
|
|
265
|
+
var _this3 = this;
|
|
321
266
|
if (this.scrollingTimeout) {
|
|
322
267
|
clearTimeout(this.scrollingTimeout);
|
|
323
268
|
}
|
|
324
269
|
this.isScrolling = true;
|
|
325
270
|
this.scrollingTimeout = window.setTimeout(function () {
|
|
326
|
-
|
|
271
|
+
_this3.isScrolling = false;
|
|
327
272
|
}, 50);
|
|
328
273
|
}
|
|
329
274
|
}, {
|
|
@@ -353,7 +298,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
353
298
|
}
|
|
354
299
|
}, {
|
|
355
300
|
key: "handleMouseLeave",
|
|
356
|
-
value: function handleMouseLeave() {
|
|
301
|
+
value: function handleMouseLeave(event) {
|
|
357
302
|
if (this.changeTriggerTimeout) {
|
|
358
303
|
clearTimeout(this.changeTriggerTimeout);
|
|
359
304
|
}
|
|
@@ -400,9 +345,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
400
345
|
textNode = lastNodeToInsert.childNodes.item(0);
|
|
401
346
|
position = ((_lastNodeToInsert$tex = lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex !== void 0 ? _lastNodeToInsert$tex : '').length;
|
|
402
347
|
} else if (focusNode instanceof HTMLParagraphElement && anchorNode instanceof HTMLParagraphElement) {
|
|
403
|
-
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2,
|
|
404
|
-
var before = (_anchorNode$textConte = anchorNode === null || anchorNode === void 0
|
|
405
|
-
var after = (_focusNode$textConten = focusNode === null || focusNode === void 0
|
|
348
|
+
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2, _ref3;
|
|
349
|
+
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 : '';
|
|
350
|
+
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 : '';
|
|
406
351
|
var noEmptyLineBefore = before.trim() === '' ? '' : before;
|
|
407
352
|
var noEmptyLineAfter = after.trim() === '' ? '' : after;
|
|
408
353
|
selection.deleteFromDocument();
|
|
@@ -411,7 +356,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
411
356
|
}
|
|
412
357
|
var firstNodeToInsert = listOfNodes.splice(0, 1)[0];
|
|
413
358
|
var _lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
|
414
|
-
anchorNode.textContent = noEmptyLineBefore + (
|
|
359
|
+
anchorNode.textContent = (_ref3 = noEmptyLineBefore + (firstNodeToInsert === null || firstNodeToInsert === void 0 ? void 0 : firstNodeToInsert.textContent)) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
415
360
|
anchorNode.after.apply(anchorNode, _toConsumableArray(listOfNodes));
|
|
416
361
|
if (_lastNodeToInsert) {
|
|
417
362
|
var _lastNodeToInsert$tex2, _lastNodeToInsert$tex3;
|
|
@@ -430,11 +375,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
430
375
|
}
|
|
431
376
|
}
|
|
432
377
|
if (textNode instanceof Text) {
|
|
433
|
-
|
|
378
|
+
var _position, _position2;
|
|
379
|
+
this.setSelection(textNode, (_position = position) !== null && _position !== void 0 ? _position : 1, (_position2 = position) !== null && _position2 !== void 0 ? _position2 : 1);
|
|
434
380
|
this.toggleErrorsPopper('keyboardLineIndex', textNode.parentNode);
|
|
435
381
|
} else {
|
|
436
382
|
var _textNode;
|
|
437
|
-
// eslint-disable-next-line no-console
|
|
438
383
|
console.warn('incorrect child type', textNode, (_textNode = textNode) === null || _textNode === void 0 ? void 0 : _textNode.parentNode);
|
|
439
384
|
}
|
|
440
385
|
}
|
|
@@ -460,7 +405,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
460
405
|
var text = document.createTextNode(nodeText);
|
|
461
406
|
firstRow.append(text);
|
|
462
407
|
firstNode.replaceWith(firstRow);
|
|
463
|
-
selection === null || selection === void 0
|
|
408
|
+
selection === null || selection === void 0 ? void 0 : selection.setPosition(firstRow, nodeText.length);
|
|
464
409
|
} else if (!firstNode || firstNode instanceof HTMLBRElement && nodes.length === 1) {
|
|
465
410
|
this.textarea.textContent = '';
|
|
466
411
|
this.setState({
|
|
@@ -512,9 +457,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
512
457
|
} else if (childNodes.length === 1 && childNodes[0] instanceof HTMLBRElement) {
|
|
513
458
|
rowNode.innerHTML = this.emptyLineValue;
|
|
514
459
|
}
|
|
515
|
-
var _this$
|
|
516
|
-
errors = _this$
|
|
517
|
-
showErrors = _this$
|
|
460
|
+
var _this$asProps3 = this.asProps,
|
|
461
|
+
errors = _this$asProps3.errors,
|
|
462
|
+
showErrors = _this$asProps3.showErrors;
|
|
518
463
|
var isValid = this.validateLine(rowNode);
|
|
519
464
|
this.recalculateErrors();
|
|
520
465
|
this.setErrorIndex(rowNode);
|
|
@@ -522,10 +467,10 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
522
467
|
this.toggleErrorsPopper('keyboardLineIndex', rowNode, 0);
|
|
523
468
|
}
|
|
524
469
|
var trigger = !isValid || isValid && errors.length === 1 && errors[0].lineNode === rowNode ? rowNode : this.textarea;
|
|
525
|
-
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0
|
|
470
|
+
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.current.state.elements.reference) !== trigger) {
|
|
526
471
|
if (this.shouldChangePopperTrigger(trigger)) {
|
|
527
472
|
var _this$setPopperTrigge;
|
|
528
|
-
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0
|
|
473
|
+
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0 ? void 0 : _this$setPopperTrigge.call(this, trigger);
|
|
529
474
|
} else {
|
|
530
475
|
this.setState({
|
|
531
476
|
visibleErrorPopper: false
|
|
@@ -534,7 +479,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
534
479
|
}
|
|
535
480
|
} else if (rowNode === null) {
|
|
536
481
|
var _this$setPopperTrigge2;
|
|
537
|
-
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0
|
|
482
|
+
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0 ? void 0 : _this$setPopperTrigge2.call(this, this.textarea);
|
|
538
483
|
if ((selection === null || selection === void 0 ? void 0 : selection.focusNode) === this.textarea && this.textarea.childNodes.length > 1) {
|
|
539
484
|
var nodeIndex = selection.focusOffset;
|
|
540
485
|
var emptyParagraph = this.textarea.childNodes.item(nodeIndex - 1);
|
|
@@ -555,7 +500,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
555
500
|
}
|
|
556
501
|
}, {
|
|
557
502
|
key: "handleFocus",
|
|
558
|
-
value: function handleFocus() {
|
|
503
|
+
value: function handleFocus(event) {
|
|
559
504
|
this.isFocusing = true;
|
|
560
505
|
this.errorByInteraction = 'keyboard';
|
|
561
506
|
if (this.asProps.showErrors) {
|
|
@@ -567,22 +512,22 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
567
512
|
}, {
|
|
568
513
|
key: "handleBlur",
|
|
569
514
|
value: function handleBlur(event) {
|
|
570
|
-
var
|
|
515
|
+
var _this4 = this;
|
|
571
516
|
this.isFocusing = false;
|
|
572
517
|
this.setState({
|
|
573
518
|
visibleErrorPopper: false
|
|
574
519
|
});
|
|
575
|
-
var _this$
|
|
576
|
-
validateOn = _this$
|
|
577
|
-
onBlur = _this$
|
|
578
|
-
value = _this$
|
|
520
|
+
var _this$asProps4 = this.asProps,
|
|
521
|
+
validateOn = _this$asProps4.validateOn,
|
|
522
|
+
onBlur = _this$asProps4.onBlur,
|
|
523
|
+
value = _this$asProps4.value;
|
|
579
524
|
if (validateOn.includes('blur')) {
|
|
580
525
|
this.recalculateErrors();
|
|
581
526
|
}
|
|
582
527
|
var valueToChange = typeof value === 'string' ? this.getValues().join(this.delimiter) : this.getValues();
|
|
583
528
|
onBlur(valueToChange, event);
|
|
584
529
|
setTimeout(function () {
|
|
585
|
-
|
|
530
|
+
_this4.setState({
|
|
586
531
|
keyboardLineIndex: -1
|
|
587
532
|
});
|
|
588
533
|
}, 200);
|
|
@@ -590,7 +535,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
590
535
|
}, {
|
|
591
536
|
key: "handleKeyDown",
|
|
592
537
|
value: function handleKeyDown(event) {
|
|
593
|
-
var
|
|
538
|
+
var _this5 = this;
|
|
594
539
|
this.errorByInteraction = 'keyboard';
|
|
595
540
|
var linesDelimiters = this.asProps.linesDelimiters;
|
|
596
541
|
var currentNode = this.getNodeFromSelection();
|
|
@@ -607,7 +552,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
607
552
|
var _selection$focusNode, _selectionNode$textCo, _currentNode$textCont2, _row$textContent;
|
|
608
553
|
event.preventDefault();
|
|
609
554
|
var selection = document.getSelection();
|
|
610
|
-
var selectionNode = (selection === null || selection === void 0 ? void 0 : selection.focusNode) instanceof Text ? selection.focusNode : selection === null || selection === void 0
|
|
555
|
+
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);
|
|
611
556
|
var selectionOffset = selection === null || selection === void 0 ? void 0 : selection.focusOffset;
|
|
612
557
|
var newRowValue = '';
|
|
613
558
|
if (selectionNode instanceof Text && selectionOffset !== undefined && selectionOffset !== ((_selectionNode$textCo = selectionNode.textContent) === null || _selectionNode$textCo === void 0 ? void 0 : _selectionNode$textCo.length)) {
|
|
@@ -638,7 +583,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
638
583
|
this.recalculateLinesCount();
|
|
639
584
|
}
|
|
640
585
|
setTimeout(function () {
|
|
641
|
-
|
|
586
|
+
_this5.recalculateErrors();
|
|
642
587
|
}, 0);
|
|
643
588
|
this.toggleErrorsPopperByKeyboard(0);
|
|
644
589
|
}
|
|
@@ -668,17 +613,16 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
668
613
|
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;
|
|
669
614
|
this.setSelection(text, offset, offset);
|
|
670
615
|
} else {
|
|
671
|
-
// eslint-disable-next-line no-console
|
|
672
616
|
console.warn('incorrect prevNode type', prevNode);
|
|
673
617
|
}
|
|
674
618
|
}
|
|
675
619
|
setTimeout(function () {
|
|
676
|
-
|
|
620
|
+
_this5.recalculateErrors();
|
|
677
621
|
}, 0);
|
|
678
622
|
this.toggleErrorsPopperByKeyboard(0);
|
|
679
623
|
}
|
|
680
624
|
} else if (this.isRangeSelection()) {
|
|
681
|
-
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2;
|
|
625
|
+
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2, _focusElement$parentN3;
|
|
682
626
|
var _selection = document.getSelection();
|
|
683
627
|
var direction = this.getSelectionDirection();
|
|
684
628
|
var anchorElement = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.focusNode : _selection === null || _selection === void 0 ? void 0 : _selection.anchorNode;
|
|
@@ -702,11 +646,12 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
702
646
|
this.setErrorIndex(currentNode);
|
|
703
647
|
this.recalculateLinesCount();
|
|
704
648
|
setTimeout(function () {
|
|
705
|
-
|
|
649
|
+
_this5.recalculateErrors();
|
|
706
650
|
}, 0);
|
|
707
651
|
this.toggleErrorsPopperByKeyboard(0);
|
|
708
|
-
}
|
|
709
|
-
|
|
652
|
+
}
|
|
653
|
+
// Backspace on selected few full rows
|
|
654
|
+
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)) {
|
|
710
655
|
event.preventDefault();
|
|
711
656
|
var paragraphs = Array.from(this.textarea.children);
|
|
712
657
|
var _anchorParagraph = anchorElement.parentElement;
|
|
@@ -717,11 +662,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
717
662
|
this.setSelection(this.textarea, 0, 0);
|
|
718
663
|
} else {
|
|
719
664
|
var isCleaning = false;
|
|
720
|
-
var
|
|
721
|
-
|
|
665
|
+
var _iterator = _createForOfIteratorHelper(paragraphs),
|
|
666
|
+
_step;
|
|
722
667
|
try {
|
|
723
|
-
for (
|
|
724
|
-
var paragraph =
|
|
668
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
669
|
+
var paragraph = _step.value;
|
|
725
670
|
if (paragraph === _anchorParagraph || isCleaning) {
|
|
726
671
|
isCleaning = true;
|
|
727
672
|
if (paragraph === _focusParagraph) {
|
|
@@ -734,16 +679,16 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
734
679
|
}
|
|
735
680
|
}
|
|
736
681
|
} catch (err) {
|
|
737
|
-
|
|
682
|
+
_iterator.e(err);
|
|
738
683
|
} finally {
|
|
739
|
-
|
|
684
|
+
_iterator.f();
|
|
740
685
|
}
|
|
741
686
|
this.validateLine(currentNode);
|
|
742
687
|
}
|
|
743
688
|
this.setErrorIndex(currentNode);
|
|
744
689
|
this.recalculateLinesCount();
|
|
745
690
|
setTimeout(function () {
|
|
746
|
-
|
|
691
|
+
_this5.recalculateErrors();
|
|
747
692
|
}, 0);
|
|
748
693
|
this.toggleErrorsPopperByKeyboard(0);
|
|
749
694
|
}
|
|
@@ -758,11 +703,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
758
703
|
var _ref = this.asProps,
|
|
759
704
|
_ref2,
|
|
760
705
|
_this$containerRef$cu2,
|
|
761
|
-
|
|
706
|
+
_this6 = this;
|
|
762
707
|
var SInputField = Box;
|
|
763
|
-
var _this$
|
|
764
|
-
styles = _this$
|
|
765
|
-
showErrors = _this$
|
|
708
|
+
var _this$asProps5 = this.asProps,
|
|
709
|
+
styles = _this$asProps5.styles,
|
|
710
|
+
showErrors = _this$asProps5.showErrors;
|
|
766
711
|
var visibleErrorPopper = this.state.visibleErrorPopper;
|
|
767
712
|
var _this$errorMessage = this.errorMessage,
|
|
768
713
|
errorMessage = _this$errorMessage.errorMessage,
|
|
@@ -780,16 +725,16 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
780
725
|
boundary: (_this$containerRef$cu2 = this.containerRef.current) !== null && _this$containerRef$cu2 !== void 0 ? _this$containerRef$cu2 : undefined,
|
|
781
726
|
tether: false
|
|
782
727
|
}
|
|
783
|
-
}), function (
|
|
784
|
-
var popper =
|
|
785
|
-
setTrigger =
|
|
786
|
-
if (!
|
|
787
|
-
|
|
728
|
+
}), function (_ref4) {
|
|
729
|
+
var popper = _ref4.popper,
|
|
730
|
+
setTrigger = _ref4.setTrigger;
|
|
731
|
+
if (!_this6.popper) {
|
|
732
|
+
_this6.setPopperTrigger = setTrigger;
|
|
788
733
|
// @ts-ignore
|
|
789
|
-
|
|
734
|
+
_this6.popper = popper;
|
|
790
735
|
}
|
|
791
736
|
return /*#__PURE__*/React.createElement(Tooltip.Popper, {
|
|
792
|
-
id:
|
|
737
|
+
id: _this6.popperDescribedId
|
|
793
738
|
}, errorMessage);
|
|
794
739
|
}), /*#__PURE__*/React.createElement(SInputField, _ref2.cn("SInputField", _objectSpread({}, _assignProps({
|
|
795
740
|
"ref": this.containerRef,
|
|
@@ -802,7 +747,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
802
747
|
var _pasteProps$lineProce,
|
|
803
748
|
_pasteProps$skipEmpty,
|
|
804
749
|
_pasteProps$delimiter,
|
|
805
|
-
|
|
750
|
+
_this7 = this;
|
|
806
751
|
var listOfNodes = [];
|
|
807
752
|
var pasteProps = this.asProps.pasteProps;
|
|
808
753
|
var lineProcessing = (_pasteProps$lineProce = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.lineProcessing) !== null && _pasteProps$lineProce !== void 0 ? _pasteProps$lineProce : function (line) {
|
|
@@ -817,15 +762,15 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
817
762
|
if (preparedLine === '' && skipEmptyLines === false || preparedLine !== '') {
|
|
818
763
|
var node = document.createElement('p');
|
|
819
764
|
if (preparedLine === '') {
|
|
820
|
-
node.innerHTML =
|
|
765
|
+
node.innerHTML = _this7.emptyLineValue;
|
|
821
766
|
} else if (preparedLine.trim() === '') {
|
|
822
767
|
var allSpacesRegExp = new RegExp('\\s', 'g');
|
|
823
|
-
node.innerHTML = DOMPurify.sanitize(preparedLine.replace(allSpacesRegExp,
|
|
768
|
+
node.innerHTML = DOMPurify.sanitize(preparedLine.replace(allSpacesRegExp, _this7.spaceLineValue));
|
|
824
769
|
} else {
|
|
825
770
|
node.append(document.createTextNode(preparedLine));
|
|
826
771
|
}
|
|
827
772
|
listOfNodes.push(node);
|
|
828
|
-
|
|
773
|
+
_this7.validateLine(node);
|
|
829
774
|
}
|
|
830
775
|
});
|
|
831
776
|
return listOfNodes;
|
|
@@ -850,19 +795,19 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
850
795
|
}, {
|
|
851
796
|
key: "recalculateLinesCount",
|
|
852
797
|
value: function recalculateLinesCount() {
|
|
853
|
-
var
|
|
798
|
+
var _this8 = this;
|
|
854
799
|
if (this.linesCountTimeout) {
|
|
855
800
|
clearTimeout(this.linesCountTimeout);
|
|
856
801
|
}
|
|
857
802
|
this.linesCountTimeout = window.setTimeout(function () {
|
|
858
803
|
var lines = 0;
|
|
859
|
-
var
|
|
860
|
-
maxLines =
|
|
861
|
-
linesCount =
|
|
862
|
-
|
|
804
|
+
var _this8$asProps = _this8.asProps,
|
|
805
|
+
maxLines = _this8$asProps.maxLines,
|
|
806
|
+
linesCount = _this8$asProps.linesCount;
|
|
807
|
+
_this8.textarea.childNodes.forEach(function (node, index) {
|
|
863
808
|
if (node instanceof HTMLParagraphElement) {
|
|
864
809
|
node.dataset.overMaxRows = 'false';
|
|
865
|
-
if (node.textContent !==
|
|
810
|
+
if (node.textContent !== _this8.getEmptyParagraph().textContent && node.textContent !== '') {
|
|
866
811
|
lines++;
|
|
867
812
|
if (lines > maxLines) {
|
|
868
813
|
node.dataset.overMaxRows = 'true';
|
|
@@ -871,7 +816,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
871
816
|
}
|
|
872
817
|
});
|
|
873
818
|
if (linesCount !== lines) {
|
|
874
|
-
|
|
819
|
+
_this8.asProps.onChangeLinesCount(lines);
|
|
875
820
|
}
|
|
876
821
|
}, 100);
|
|
877
822
|
}
|
|
@@ -898,57 +843,57 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
898
843
|
}, {
|
|
899
844
|
key: "toggleErrorsPopperByKeyboard",
|
|
900
845
|
value: function toggleErrorsPopperByKeyboard(timer) {
|
|
901
|
-
var
|
|
846
|
+
var _this9 = this;
|
|
902
847
|
if (this.toggleErrorsPopperTimeout) {
|
|
903
848
|
clearTimeout(this.toggleErrorsPopperTimeout);
|
|
904
849
|
}
|
|
905
850
|
if (!this.isScrolling) {
|
|
906
851
|
setTimeout(function () {
|
|
907
|
-
var rowNode =
|
|
908
|
-
|
|
852
|
+
var rowNode = _this9.getNodeFromSelection();
|
|
853
|
+
_this9.toggleErrorsPopper('keyboardLineIndex', rowNode, timer);
|
|
909
854
|
}, 0);
|
|
910
855
|
} else {
|
|
911
856
|
this.toggleErrorsPopperTimeout = window.setTimeout(function () {
|
|
912
|
-
|
|
857
|
+
_this9.toggleErrorsPopperByKeyboard(timer);
|
|
913
858
|
}, 50);
|
|
914
859
|
}
|
|
915
860
|
}
|
|
916
861
|
}, {
|
|
917
862
|
key: "toggleErrorsPopper",
|
|
918
863
|
value: function toggleErrorsPopper(key, target, timer) {
|
|
919
|
-
var
|
|
864
|
+
var _this10 = this;
|
|
920
865
|
if (target instanceof HTMLDivElement || target instanceof HTMLParagraphElement) {
|
|
921
866
|
if (this.changeTriggerTimeout) {
|
|
922
867
|
clearTimeout(this.changeTriggerTimeout);
|
|
923
868
|
}
|
|
924
869
|
this.changeTriggerTimeout = window.setTimeout(function () {
|
|
925
|
-
var targetElement = target ===
|
|
870
|
+
var targetElement = target === _this10.textarea ? _this10.getNodeFromSelection() : target;
|
|
926
871
|
var lineIndex = -1;
|
|
927
872
|
var isInvalidRow = false;
|
|
928
873
|
if (targetElement instanceof HTMLParagraphElement) {
|
|
929
874
|
isInvalidRow = targetElement.getAttribute('aria-invalid') === 'true';
|
|
930
|
-
lineIndex = Array.from(
|
|
931
|
-
} else if (targetElement ===
|
|
875
|
+
lineIndex = Array.from(_this10.textarea.childNodes).indexOf(targetElement);
|
|
876
|
+
} else if (targetElement === _this10.textarea) {
|
|
932
877
|
lineIndex = 0;
|
|
933
878
|
}
|
|
934
879
|
if (targetElement instanceof HTMLElement) {
|
|
935
|
-
|
|
880
|
+
_this10.setState(function (prevState) {
|
|
936
881
|
var newState = {
|
|
937
|
-
visibleErrorPopper:
|
|
882
|
+
visibleErrorPopper: _this10.isFocusing && Boolean(_this10.asProps.commonErrorMessage) ? true : isInvalidRow,
|
|
938
883
|
mouseLineIndex: prevState.mouseLineIndex,
|
|
939
884
|
keyboardLineIndex: prevState.keyboardLineIndex
|
|
940
885
|
};
|
|
941
|
-
if (
|
|
886
|
+
if (_this10.isFocusing || key === 'mouseLineIndex' && isInvalidRow) {
|
|
942
887
|
newState[key] = lineIndex;
|
|
943
888
|
}
|
|
944
889
|
return newState;
|
|
945
890
|
}, function () {
|
|
946
|
-
|
|
947
|
-
var trigger = isInvalidRow ? targetElement :
|
|
948
|
-
if (
|
|
949
|
-
var
|
|
950
|
-
(
|
|
951
|
-
|
|
891
|
+
_this10.errorByInteraction = key === 'mouseLineIndex' ? 'mouse' : 'keyboard';
|
|
892
|
+
var trigger = isInvalidRow ? targetElement : _this10.textarea;
|
|
893
|
+
if (_this10.shouldChangePopperTrigger(trigger)) {
|
|
894
|
+
var _this10$setPopperTrig;
|
|
895
|
+
(_this10$setPopperTrig = _this10.setPopperTrigger) === null || _this10$setPopperTrig === void 0 ? void 0 : _this10$setPopperTrig.call(_this10, trigger);
|
|
896
|
+
_this10.forceUpdate();
|
|
952
897
|
}
|
|
953
898
|
});
|
|
954
899
|
}
|
|
@@ -974,7 +919,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
974
919
|
key: "handleChangeErrorIndex",
|
|
975
920
|
value: function handleChangeErrorIndex(errorIndex) {
|
|
976
921
|
var _error$lineNode,
|
|
977
|
-
|
|
922
|
+
_this11 = this;
|
|
978
923
|
var error = this.asProps.errors[errorIndex];
|
|
979
924
|
var childNodes = this.textarea.childNodes;
|
|
980
925
|
var node = error ? (_error$lineNode = error.lineNode) !== null && _error$lineNode !== void 0 ? _error$lineNode : childNodes.item(error.lineIndex) : null;
|
|
@@ -986,9 +931,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
986
931
|
setTimeout(function () {
|
|
987
932
|
var text = node.childNodes.item(0);
|
|
988
933
|
if (text instanceof Text) {
|
|
989
|
-
|
|
934
|
+
_this11.setSelection(text, 0, text.length);
|
|
990
935
|
} else {
|
|
991
|
-
|
|
936
|
+
_this11.setSelection(node, 0, 1);
|
|
992
937
|
}
|
|
993
938
|
}, 150);
|
|
994
939
|
}
|
|
@@ -1021,8 +966,8 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
1021
966
|
var range = document.createRange();
|
|
1022
967
|
range.setStart(node, start);
|
|
1023
968
|
range.setEnd(node, end);
|
|
1024
|
-
selection === null || selection === void 0
|
|
1025
|
-
selection === null || selection === void 0
|
|
969
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
970
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range);
|
|
1026
971
|
var nodeToScroll = node instanceof Text ? node.parentNode : node;
|
|
1027
972
|
if (nodeToScroll instanceof HTMLElement) {
|
|
1028
973
|
nodeToScroll.scrollIntoView({
|
|
@@ -1169,6 +1114,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
1169
1114
|
return null;
|
|
1170
1115
|
}
|
|
1171
1116
|
}]);
|
|
1117
|
+
return InputField;
|
|
1172
1118
|
}(Component);
|
|
1173
1119
|
_defineProperty(InputField, "displayName", 'Textarea');
|
|
1174
1120
|
_defineProperty(InputField, "style", style);
|