@semcore/bulk-textarea 1.5.0-prerelease.0 → 1.5.0-prerelease.4
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 +19 -57
- 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 +19 -57
- 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 +19 -57
- 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,98 +1,84 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
5
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
6
|
-
import
|
|
6
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
8
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
8
9
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
|
-
import { sstyled
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
10
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
11
|
+
import { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { Box } from "@semcore/flex-box";
|
|
13
14
|
import Tooltip from "@semcore/tooltip";
|
|
15
|
+
import { extractAriaProps } from "@semcore/utils/lib/ariaProps";
|
|
16
|
+
import uniqueIDEnhancement from "@semcore/utils/lib/uniqueID";
|
|
14
17
|
import DOMPurify from "dompurify";
|
|
15
|
-
import React from "react";
|
|
16
18
|
/*!__reshadow-styles__:"./inputField.shadow.css"*/
|
|
17
19
|
var style = (
|
|
18
20
|
/*__reshadow_css_start__*/
|
|
19
21
|
(sstyled.insert(
|
|
20
22
|
/*__inner_css_start__*/
|
|
21
|
-
'.___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)}',
|
|
23
|
+
'.___SInputField_1972c_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_1972c_gg_>div{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SInputField_1972c_gg_>div{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___SInputField_1972c_gg_>div:empty::before{content:"1. "attr(placeholder);color:var(--intergalactic-text-placeholder, rgba(0, 5, 2, 0.457));position:absolute}.___SInputField_1972c_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_1972c_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_1972c_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_1972c_gg_>div:nth-child(even)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_1972c_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_1972c_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_1972c_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_1972c_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SInputField_1972c_gg_>div>p:not(:empty)::before{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SInputField_1972c_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_1972c_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, rgb(255, 235, 238))}@media (color-gamut:p3){.___SInputField_1972c_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, color(display-p3 1 0.91978 0.9341))}}}.___SInputField_1972c_gg_>div:has(p:nth-child(n+10))>p{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_1972c_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_1972c_gg_>div:has(p:nth-child(n+100))>p{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_1972c_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_1972c_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_1972c_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_1972c_gg_.__showErrors_1972c_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_1972c_gg_._size_m_1972c_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_1972c)*20px);max-height:calc((var(--maxRows_1972c) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_1972c_gg_._size_m_1972c_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_1972c_gg_._size_l_1972c_gg_>div:empty::before,.___SInputField_1972c_gg_._size_m_1972c_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_1972c_gg_._size_l_1972c_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_1972c)*24px);max-height:calc((var(--maxRows_1972c) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_1972c_gg_._size_l_1972c_gg_>div:empty{padding-left:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px))}.___SInputField_1972c_gg_._state_normal_1972c_gg_:not(.__disabled_1972c_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469));border-color:var(--intergalactic-border-info-active, rgba(0, 40, 230, 0.419))}@supports (color:color(display-p3 0 0 0)){.___SInputField_1972c_gg_._state_normal_1972c_gg_:not(.__disabled_1972c_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___SInputField_1972c_gg_._state_normal_1972c_gg_:not(.__disabled_1972c_gg_)>div:focus:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SInputField_1972c_gg_._state_valid_1972c_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@supports (color:color(display-p3 0 0 0)){.___SInputField_1972c_gg_._state_valid_1972c_gg_>div{border-color:var(--intergalactic-border-success-active, rgb(0, 204, 154))}@media (color-gamut:p3){.___SInputField_1972c_gg_._state_valid_1972c_gg_>div{border-color:var(--intergalactic-border-success-active, color(display-p3 0.36013 0.78771 0.61714))}}}.___SInputField_1972c_gg_._state_valid_1972c_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_1972c_gg_._state_valid_1972c_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgb(0, 190, 142))}@media (color-gamut:p3){.___SInputField_1972c_gg_._state_valid_1972c_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px color(display-p3 0.33388 0.7337 0.56959))}}}.___SInputField_1972c_gg_._state_invalid_1972c_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_1972c_gg_._state_invalid_1972c_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_1972c_gg_._state_invalid_1972c_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_1972c_gg_._state_invalid_1972c_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 2, 7, 0.652))}.___SInputField_1972c_gg_.__readonly_1972c_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, rgb(248, 249, 248))}.___SInputField_1972c_gg_.__disabled_1972c_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.4)}',
|
|
22
24
|
/*__inner_css_end__*/
|
|
23
|
-
"
|
|
25
|
+
"1972c_gg_"
|
|
24
26
|
), /*__reshadow_css_end__*/
|
|
25
27
|
{
|
|
26
|
-
"__SInputField": "
|
|
27
|
-
"_showErrors": "
|
|
28
|
-
"_readonly": "
|
|
29
|
-
"_disabled": "
|
|
30
|
-
"_size_m": "
|
|
31
|
-
"--minRows": "--
|
|
32
|
-
"--maxRows": "--
|
|
33
|
-
"_size_l": "
|
|
34
|
-
"_state_normal": "
|
|
35
|
-
"_state_valid": "
|
|
36
|
-
"_state_invalid": "
|
|
28
|
+
"__SInputField": "___SInputField_1972c_gg_",
|
|
29
|
+
"_showErrors": "__showErrors_1972c_gg_",
|
|
30
|
+
"_readonly": "__readonly_1972c_gg_",
|
|
31
|
+
"_disabled": "__disabled_1972c_gg_",
|
|
32
|
+
"_size_m": "_size_m_1972c_gg_",
|
|
33
|
+
"--minRows": "--minRows_1972c",
|
|
34
|
+
"--maxRows": "--maxRows_1972c",
|
|
35
|
+
"_size_l": "_size_l_1972c_gg_",
|
|
36
|
+
"_state_normal": "_state_normal_1972c_gg_",
|
|
37
|
+
"_state_valid": "_state_valid_1972c_gg_",
|
|
38
|
+
"_state_invalid": "_state_invalid_1972c_gg_"
|
|
37
39
|
})
|
|
38
40
|
);
|
|
39
|
-
var InputField = /* @__PURE__ */
|
|
41
|
+
var InputField = /* @__PURE__ */ function(_Component) {
|
|
42
|
+
_inherits(InputField2, _Component);
|
|
43
|
+
var _super = _createSuper(InputField2);
|
|
40
44
|
function InputField2(props) {
|
|
41
45
|
var _this;
|
|
42
46
|
_classCallCheck(this, InputField2);
|
|
43
|
-
_this =
|
|
44
|
-
_defineProperty(_this, "delimiter", "\n");
|
|
45
|
-
_defineProperty(_this, "skipEmptyLines", true);
|
|
46
|
-
_defineProperty(_this, "emptyLineValue", "");
|
|
47
|
-
_defineProperty(_this, "spaceLineValue", " ");
|
|
48
|
-
_defineProperty(_this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
49
|
-
_defineProperty(_this, "textarea", void 0);
|
|
50
|
-
_defineProperty(_this, "popper", null);
|
|
51
|
-
_defineProperty(_this, "setPopperTrigger", null);
|
|
52
|
-
_defineProperty(_this, "errorByInteraction", null);
|
|
53
|
-
_defineProperty(_this, "changeTriggerTimeout", 0);
|
|
54
|
-
_defineProperty(_this, "isScrolling", false);
|
|
55
|
-
_defineProperty(_this, "scrollingTimeout", 0);
|
|
56
|
-
_defineProperty(_this, "toggleErrorsPopperTimeout", 0);
|
|
57
|
-
_defineProperty(_this, "isFocusing", false);
|
|
58
|
-
_defineProperty(_this, "linesCountTimeout", 0);
|
|
59
|
-
_defineProperty(_this, "
|
|
60
|
-
_defineProperty(_this, "state", {
|
|
47
|
+
_this = _super.call(this, props);
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "delimiter", "\n");
|
|
49
|
+
_defineProperty(_assertThisInitialized(_this), "skipEmptyLines", true);
|
|
50
|
+
_defineProperty(_assertThisInitialized(_this), "emptyLineValue", "");
|
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "spaceLineValue", " ");
|
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
|
|
53
|
+
_defineProperty(_assertThisInitialized(_this), "textarea", void 0);
|
|
54
|
+
_defineProperty(_assertThisInitialized(_this), "popper", null);
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "setPopperTrigger", null);
|
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "errorByInteraction", null);
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "changeTriggerTimeout", 0);
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "isScrolling", false);
|
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "scrollingTimeout", 0);
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "toggleErrorsPopperTimeout", 0);
|
|
61
|
+
_defineProperty(_assertThisInitialized(_this), "isFocusing", false);
|
|
62
|
+
_defineProperty(_assertThisInitialized(_this), "linesCountTimeout", 0);
|
|
63
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
61
64
|
visibleErrorPopper: false,
|
|
62
65
|
keyboardLineIndex: -1,
|
|
63
66
|
mouseLineIndex: -1
|
|
64
67
|
});
|
|
65
|
-
_this.handlePaste = _this.handlePaste.bind(_this);
|
|
66
|
-
_this.handleChange = _this.handleChange.bind(_this);
|
|
67
|
-
_this.handleFocus = _this.handleFocus.bind(_this);
|
|
68
|
-
_this.handleBlur = _this.handleBlur.bind(_this);
|
|
69
|
-
_this.handleKeyDown = _this.handleKeyDown.bind(_this);
|
|
70
|
-
_this.handleMouseDown = _this.handleMouseDown.bind(_this);
|
|
71
|
-
_this.handleMouseMove = _this.handleMouseMove.bind(_this);
|
|
72
|
-
_this.handleMouseLeave = _this.handleMouseLeave.bind(_this);
|
|
73
|
-
_this.handleScroll = _this.handleScroll.bind(_this);
|
|
74
|
-
_this.handleSelectAll = _this.handleSelectAll.bind(_this);
|
|
68
|
+
_this.handlePaste = _this.handlePaste.bind(_assertThisInitialized(_this));
|
|
69
|
+
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
70
|
+
_this.handleFocus = _this.handleFocus.bind(_assertThisInitialized(_this));
|
|
71
|
+
_this.handleBlur = _this.handleBlur.bind(_assertThisInitialized(_this));
|
|
72
|
+
_this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
|
|
73
|
+
_this.handleMouseDown = _this.handleMouseDown.bind(_assertThisInitialized(_this));
|
|
74
|
+
_this.handleMouseMove = _this.handleMouseMove.bind(_assertThisInitialized(_this));
|
|
75
|
+
_this.handleMouseLeave = _this.handleMouseLeave.bind(_assertThisInitialized(_this));
|
|
76
|
+
_this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
|
|
77
|
+
_this.handleSelectAll = _this.handleSelectAll.bind(_assertThisInitialized(_this));
|
|
75
78
|
_this.textarea = _this.createContentEditableElement(props);
|
|
76
|
-
_this.observer = new MutationObserver(function(mutationsList, observer) {
|
|
77
|
-
var _iterator = _createForOfIteratorHelper(mutationsList), _step;
|
|
78
|
-
try {
|
|
79
|
-
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
80
|
-
var mutation = _step.value;
|
|
81
|
-
if (mutation.type === "characterData" || mutation.type === "childList") {
|
|
82
|
-
var _this$props$onImmedia, _this$props, _this$textarea$textCo;
|
|
83
|
-
(_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 : "");
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
} catch (err) {
|
|
87
|
-
_iterator.e(err);
|
|
88
|
-
} finally {
|
|
89
|
-
_iterator.f();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
79
|
return _this;
|
|
93
80
|
}
|
|
94
|
-
|
|
95
|
-
return _createClass(InputField2, [{
|
|
81
|
+
_createClass(InputField2, [{
|
|
96
82
|
key: "uncontrolledProps",
|
|
97
83
|
value: function uncontrolledProps() {
|
|
98
84
|
return {
|
|
@@ -104,54 +90,22 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
104
90
|
}, {
|
|
105
91
|
key: "componentDidMount",
|
|
106
92
|
value: function componentDidMount() {
|
|
107
|
-
var _this$containerRef$cu
|
|
108
|
-
|
|
109
|
-
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 || _this$containerRef$cu.append(this.textarea);
|
|
93
|
+
var _this$containerRef$cu;
|
|
94
|
+
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 ? void 0 : _this$containerRef$cu.append(this.textarea);
|
|
110
95
|
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
|
-
setTimeout(function() {
|
|
121
|
-
return _this2.textarea.focus();
|
|
122
|
-
}, 10);
|
|
123
|
-
}
|
|
124
96
|
}
|
|
125
97
|
}, {
|
|
126
98
|
key: "componentDidUpdate",
|
|
127
99
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
128
|
-
var
|
|
129
|
-
var _this$
|
|
100
|
+
var _this2 = this;
|
|
101
|
+
var _this$props = this.props, value = _this$props.value, errors = _this$props.errors, errorIndex = _this$props.errorIndex, showErrors = _this$props.showErrors, disabled = _this$props.disabled, readonly = _this$props.readonly, highlightErrorIndex = _this$props.highlightErrorIndex, lineProcessing = _this$props.lineProcessing, _this$props$ariaDesc = _this$props["aria-describedby"], ariaDescribedby = _this$props$ariaDesc === void 0 ? "" : _this$props$ariaDesc;
|
|
130
102
|
if (prevProps.value !== value) {
|
|
131
103
|
var currentValue = this.getValues().join(this.delimiter);
|
|
132
104
|
if (typeof value === "string" ? value !== currentValue : value.join(this.delimiter) !== currentValue) {
|
|
133
105
|
this.handleValueOutChange();
|
|
134
106
|
}
|
|
135
107
|
}
|
|
136
|
-
if (prevProps.showErrors !== showErrors || prevProps.errors !== errors) {
|
|
137
|
-
if (showErrors) {
|
|
138
|
-
var errorsMap = /* @__PURE__ */ new Map();
|
|
139
|
-
errors.forEach(function(error) {
|
|
140
|
-
errorsMap.set(error.lineIndex, error);
|
|
141
|
-
});
|
|
142
|
-
this.textarea.childNodes.forEach(function(node, index) {
|
|
143
|
-
if (node instanceof HTMLParagraphElement) {
|
|
144
|
-
var errorItem = errorsMap.get(index);
|
|
145
|
-
if (errorItem) {
|
|
146
|
-
node.setAttribute("aria-invalid", "true");
|
|
147
|
-
node.dataset.errormessage = errorItem.errorMessage;
|
|
148
|
-
} else {
|
|
149
|
-
node.removeAttribute("aria-invalid");
|
|
150
|
-
node.dataset.errormessage = void 0;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
}
|
|
108
|
+
if (prevProps.showErrors !== showErrors || prevProps.errors.length !== errors.length) {
|
|
155
109
|
this.toggleAriaInvalid(showErrors, errors.length);
|
|
156
110
|
if (showErrors === false) {
|
|
157
111
|
this.textarea.setAttribute("aria-describedby", ariaDescribedby);
|
|
@@ -191,9 +145,9 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
191
145
|
}
|
|
192
146
|
this.validateLine(paragraph);
|
|
193
147
|
setTimeout(function() {
|
|
194
|
-
var newNode =
|
|
148
|
+
var newNode = _this2.textarea.childNodes.item(keyboardLineIndex);
|
|
195
149
|
if (newNode) {
|
|
196
|
-
|
|
150
|
+
_this2.setErrorIndex(newNode);
|
|
197
151
|
}
|
|
198
152
|
}, 0);
|
|
199
153
|
}
|
|
@@ -208,12 +162,11 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
208
162
|
key: "componentWillUnmount",
|
|
209
163
|
value: function componentWillUnmount() {
|
|
210
164
|
this.removeEventListeners(this.textarea);
|
|
211
|
-
this.observer.disconnect();
|
|
212
165
|
}
|
|
213
166
|
}, {
|
|
214
167
|
key: "isDisabled",
|
|
215
168
|
get: function get() {
|
|
216
|
-
var _this$
|
|
169
|
+
var _this$asProps = this.asProps, disabled = _this$asProps.disabled, readonly = _this$asProps.readonly;
|
|
217
170
|
return Boolean(disabled || readonly);
|
|
218
171
|
}
|
|
219
172
|
}, {
|
|
@@ -226,7 +179,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
226
179
|
key: "errorMessage",
|
|
227
180
|
get: function get() {
|
|
228
181
|
var _errorItem$errorMessa, _errorItem, _errorItem2;
|
|
229
|
-
var _this$
|
|
182
|
+
var _this$asProps2 = this.asProps, errors = _this$asProps2.errors, errorIndex = _this$asProps2.errorIndex, commonErrorMessage = _this$asProps2.commonErrorMessage, prevError = _this$asProps2.prevError;
|
|
230
183
|
var _this$state = this.state, mouseLineIndex = _this$state.mouseLineIndex, keyboardLineIndex = _this$state.keyboardLineIndex;
|
|
231
184
|
var currentLineIndex = this.errorByInteraction === "keyboard" ? keyboardLineIndex : this.errorByInteraction === "mouse" ? mouseLineIndex : -1;
|
|
232
185
|
var errorItem = errors[errorIndex];
|
|
@@ -277,7 +230,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
277
230
|
}, {
|
|
278
231
|
key: "handleValueOutChange",
|
|
279
232
|
value: function handleValueOutChange() {
|
|
280
|
-
var _this$
|
|
233
|
+
var _this$props2 = this.props, value = _this$props2.value, onChangeLinesCount = _this$props2.onChangeLinesCount;
|
|
281
234
|
if (value === "") {
|
|
282
235
|
this.textarea.textContent = "";
|
|
283
236
|
onChangeLinesCount(0);
|
|
@@ -292,13 +245,13 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
292
245
|
}, {
|
|
293
246
|
key: "handleScroll",
|
|
294
247
|
value: function handleScroll() {
|
|
295
|
-
var
|
|
248
|
+
var _this3 = this;
|
|
296
249
|
if (this.scrollingTimeout) {
|
|
297
250
|
clearTimeout(this.scrollingTimeout);
|
|
298
251
|
}
|
|
299
252
|
this.isScrolling = true;
|
|
300
253
|
this.scrollingTimeout = window.setTimeout(function() {
|
|
301
|
-
|
|
254
|
+
_this3.isScrolling = false;
|
|
302
255
|
}, 50);
|
|
303
256
|
}
|
|
304
257
|
}, {
|
|
@@ -327,7 +280,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
327
280
|
}
|
|
328
281
|
}, {
|
|
329
282
|
key: "handleMouseLeave",
|
|
330
|
-
value: function handleMouseLeave() {
|
|
283
|
+
value: function handleMouseLeave(event) {
|
|
331
284
|
if (this.changeTriggerTimeout) {
|
|
332
285
|
clearTimeout(this.changeTriggerTimeout);
|
|
333
286
|
}
|
|
@@ -374,9 +327,9 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
374
327
|
textNode = lastNodeToInsert.childNodes.item(0);
|
|
375
328
|
position = ((_lastNodeToInsert$tex = lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex !== void 0 ? _lastNodeToInsert$tex : "").length;
|
|
376
329
|
} else if (focusNode instanceof HTMLParagraphElement && anchorNode instanceof HTMLParagraphElement) {
|
|
377
|
-
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2,
|
|
378
|
-
var before = (_anchorNode$textConte = anchorNode === null || anchorNode === void 0
|
|
379
|
-
var after = (_focusNode$textConten = focusNode === null || focusNode === void 0
|
|
330
|
+
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2, _ref3;
|
|
331
|
+
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 : "";
|
|
332
|
+
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 : "";
|
|
380
333
|
var noEmptyLineBefore = before.trim() === "" ? "" : before;
|
|
381
334
|
var noEmptyLineAfter = after.trim() === "" ? "" : after;
|
|
382
335
|
selection.deleteFromDocument();
|
|
@@ -385,7 +338,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
385
338
|
}
|
|
386
339
|
var firstNodeToInsert = listOfNodes.splice(0, 1)[0];
|
|
387
340
|
var _lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
|
388
|
-
anchorNode.textContent = noEmptyLineBefore + (
|
|
341
|
+
anchorNode.textContent = (_ref3 = noEmptyLineBefore + (firstNodeToInsert === null || firstNodeToInsert === void 0 ? void 0 : firstNodeToInsert.textContent)) !== null && _ref3 !== void 0 ? _ref3 : "";
|
|
389
342
|
anchorNode.after.apply(anchorNode, _toConsumableArray(listOfNodes));
|
|
390
343
|
if (_lastNodeToInsert) {
|
|
391
344
|
var _lastNodeToInsert$tex2, _lastNodeToInsert$tex3;
|
|
@@ -404,7 +357,8 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
404
357
|
}
|
|
405
358
|
}
|
|
406
359
|
if (textNode instanceof Text) {
|
|
407
|
-
|
|
360
|
+
var _position, _position2;
|
|
361
|
+
this.setSelection(textNode, (_position = position) !== null && _position !== void 0 ? _position : 1, (_position2 = position) !== null && _position2 !== void 0 ? _position2 : 1);
|
|
408
362
|
this.toggleErrorsPopper("keyboardLineIndex", textNode.parentNode);
|
|
409
363
|
} else {
|
|
410
364
|
var _textNode;
|
|
@@ -433,7 +387,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
433
387
|
var text = document.createTextNode(nodeText);
|
|
434
388
|
firstRow.append(text);
|
|
435
389
|
firstNode.replaceWith(firstRow);
|
|
436
|
-
selection === null || selection === void 0
|
|
390
|
+
selection === null || selection === void 0 ? void 0 : selection.setPosition(firstRow, nodeText.length);
|
|
437
391
|
} else if (!firstNode || firstNode instanceof HTMLBRElement && nodes.length === 1) {
|
|
438
392
|
this.textarea.textContent = "";
|
|
439
393
|
this.setState({
|
|
@@ -485,7 +439,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
485
439
|
} else if (childNodes.length === 1 && childNodes[0] instanceof HTMLBRElement) {
|
|
486
440
|
rowNode.innerHTML = this.emptyLineValue;
|
|
487
441
|
}
|
|
488
|
-
var _this$
|
|
442
|
+
var _this$asProps3 = this.asProps, errors = _this$asProps3.errors, showErrors = _this$asProps3.showErrors;
|
|
489
443
|
var isValid = this.validateLine(rowNode);
|
|
490
444
|
this.recalculateErrors();
|
|
491
445
|
this.setErrorIndex(rowNode);
|
|
@@ -493,10 +447,10 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
493
447
|
this.toggleErrorsPopper("keyboardLineIndex", rowNode, 0);
|
|
494
448
|
}
|
|
495
449
|
var trigger = !isValid || isValid && errors.length === 1 && errors[0].lineNode === rowNode ? rowNode : this.textarea;
|
|
496
|
-
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0
|
|
450
|
+
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.current.state.elements.reference) !== trigger) {
|
|
497
451
|
if (this.shouldChangePopperTrigger(trigger)) {
|
|
498
452
|
var _this$setPopperTrigge;
|
|
499
|
-
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0
|
|
453
|
+
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0 ? void 0 : _this$setPopperTrigge.call(this, trigger);
|
|
500
454
|
} else {
|
|
501
455
|
this.setState({
|
|
502
456
|
visibleErrorPopper: false
|
|
@@ -505,7 +459,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
505
459
|
}
|
|
506
460
|
} else if (rowNode === null) {
|
|
507
461
|
var _this$setPopperTrigge2;
|
|
508
|
-
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0
|
|
462
|
+
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0 ? void 0 : _this$setPopperTrigge2.call(this, this.textarea);
|
|
509
463
|
if ((selection === null || selection === void 0 ? void 0 : selection.focusNode) === this.textarea && this.textarea.childNodes.length > 1) {
|
|
510
464
|
var nodeIndex = selection.focusOffset;
|
|
511
465
|
var emptyParagraph = this.textarea.childNodes.item(nodeIndex - 1);
|
|
@@ -526,7 +480,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
526
480
|
}
|
|
527
481
|
}, {
|
|
528
482
|
key: "handleFocus",
|
|
529
|
-
value: function handleFocus() {
|
|
483
|
+
value: function handleFocus(event) {
|
|
530
484
|
this.isFocusing = true;
|
|
531
485
|
this.errorByInteraction = "keyboard";
|
|
532
486
|
if (this.asProps.showErrors) {
|
|
@@ -538,19 +492,19 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
538
492
|
}, {
|
|
539
493
|
key: "handleBlur",
|
|
540
494
|
value: function handleBlur(event) {
|
|
541
|
-
var
|
|
495
|
+
var _this4 = this;
|
|
542
496
|
this.isFocusing = false;
|
|
543
497
|
this.setState({
|
|
544
498
|
visibleErrorPopper: false
|
|
545
499
|
});
|
|
546
|
-
var _this$
|
|
500
|
+
var _this$asProps4 = this.asProps, validateOn = _this$asProps4.validateOn, onBlur = _this$asProps4.onBlur, value = _this$asProps4.value;
|
|
547
501
|
if (validateOn.includes("blur")) {
|
|
548
502
|
this.recalculateErrors();
|
|
549
503
|
}
|
|
550
504
|
var valueToChange = typeof value === "string" ? this.getValues().join(this.delimiter) : this.getValues();
|
|
551
505
|
onBlur(valueToChange, event);
|
|
552
506
|
setTimeout(function() {
|
|
553
|
-
|
|
507
|
+
_this4.setState({
|
|
554
508
|
keyboardLineIndex: -1
|
|
555
509
|
});
|
|
556
510
|
}, 200);
|
|
@@ -558,7 +512,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
558
512
|
}, {
|
|
559
513
|
key: "handleKeyDown",
|
|
560
514
|
value: function handleKeyDown(event) {
|
|
561
|
-
var
|
|
515
|
+
var _this5 = this;
|
|
562
516
|
this.errorByInteraction = "keyboard";
|
|
563
517
|
var linesDelimiters = this.asProps.linesDelimiters;
|
|
564
518
|
var currentNode = this.getNodeFromSelection();
|
|
@@ -575,7 +529,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
575
529
|
var _selection$focusNode, _selectionNode$textCo, _currentNode$textCont2, _row$textContent;
|
|
576
530
|
event.preventDefault();
|
|
577
531
|
var selection = document.getSelection();
|
|
578
|
-
var selectionNode = (selection === null || selection === void 0 ? void 0 : selection.focusNode) instanceof Text ? selection.focusNode : selection === null || selection === void 0
|
|
532
|
+
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);
|
|
579
533
|
var selectionOffset = selection === null || selection === void 0 ? void 0 : selection.focusOffset;
|
|
580
534
|
var newRowValue = "";
|
|
581
535
|
if (selectionNode instanceof Text && selectionOffset !== void 0 && selectionOffset !== ((_selectionNode$textCo = selectionNode.textContent) === null || _selectionNode$textCo === void 0 ? void 0 : _selectionNode$textCo.length)) {
|
|
@@ -606,7 +560,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
606
560
|
this.recalculateLinesCount();
|
|
607
561
|
}
|
|
608
562
|
setTimeout(function() {
|
|
609
|
-
|
|
563
|
+
_this5.recalculateErrors();
|
|
610
564
|
}, 0);
|
|
611
565
|
this.toggleErrorsPopperByKeyboard(0);
|
|
612
566
|
}
|
|
@@ -639,12 +593,12 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
639
593
|
}
|
|
640
594
|
}
|
|
641
595
|
setTimeout(function() {
|
|
642
|
-
|
|
596
|
+
_this5.recalculateErrors();
|
|
643
597
|
}, 0);
|
|
644
598
|
this.toggleErrorsPopperByKeyboard(0);
|
|
645
599
|
}
|
|
646
600
|
} else if (this.isRangeSelection()) {
|
|
647
|
-
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2;
|
|
601
|
+
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2, _focusElement$parentN3;
|
|
648
602
|
var _selection = document.getSelection();
|
|
649
603
|
var direction = this.getSelectionDirection();
|
|
650
604
|
var anchorElement = direction === "backward" ? _selection === null || _selection === void 0 ? void 0 : _selection.focusNode : _selection === null || _selection === void 0 ? void 0 : _selection.anchorNode;
|
|
@@ -666,10 +620,10 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
666
620
|
this.setErrorIndex(currentNode);
|
|
667
621
|
this.recalculateLinesCount();
|
|
668
622
|
setTimeout(function() {
|
|
669
|
-
|
|
623
|
+
_this5.recalculateErrors();
|
|
670
624
|
}, 0);
|
|
671
625
|
this.toggleErrorsPopperByKeyboard(0);
|
|
672
|
-
} else if (focusElement !== anchorElement && focusElement instanceof Text && anchorElement instanceof Text && (focusElement === null || focusElement === void 0 ? void 0 : focusElement.textContent) === (focusElement === null || focusElement === void 0
|
|
626
|
+
} 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)) {
|
|
673
627
|
event.preventDefault();
|
|
674
628
|
var paragraphs = Array.from(this.textarea.children);
|
|
675
629
|
var _anchorParagraph = anchorElement.parentElement;
|
|
@@ -680,10 +634,10 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
680
634
|
this.setSelection(this.textarea, 0, 0);
|
|
681
635
|
} else {
|
|
682
636
|
var isCleaning = false;
|
|
683
|
-
var
|
|
637
|
+
var _iterator = _createForOfIteratorHelper(paragraphs), _step;
|
|
684
638
|
try {
|
|
685
|
-
for (
|
|
686
|
-
var paragraph =
|
|
639
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
640
|
+
var paragraph = _step.value;
|
|
687
641
|
if (paragraph === _anchorParagraph || isCleaning) {
|
|
688
642
|
isCleaning = true;
|
|
689
643
|
if (paragraph === _focusParagraph) {
|
|
@@ -696,16 +650,16 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
696
650
|
}
|
|
697
651
|
}
|
|
698
652
|
} catch (err) {
|
|
699
|
-
|
|
653
|
+
_iterator.e(err);
|
|
700
654
|
} finally {
|
|
701
|
-
|
|
655
|
+
_iterator.f();
|
|
702
656
|
}
|
|
703
657
|
this.validateLine(currentNode);
|
|
704
658
|
}
|
|
705
659
|
this.setErrorIndex(currentNode);
|
|
706
660
|
this.recalculateLinesCount();
|
|
707
661
|
setTimeout(function() {
|
|
708
|
-
|
|
662
|
+
_this5.recalculateErrors();
|
|
709
663
|
}, 0);
|
|
710
664
|
this.toggleErrorsPopperByKeyboard(0);
|
|
711
665
|
}
|
|
@@ -717,14 +671,14 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
717
671
|
}, {
|
|
718
672
|
key: "render",
|
|
719
673
|
value: function render() {
|
|
720
|
-
var _ref = this.asProps, _ref2, _this$containerRef$cu2,
|
|
674
|
+
var _ref = this.asProps, _ref2, _this$containerRef$cu2, _this6 = this;
|
|
721
675
|
var SInputField = Box;
|
|
722
|
-
var _this$
|
|
676
|
+
var _this$asProps5 = this.asProps, styles = _this$asProps5.styles, showErrors = _this$asProps5.showErrors;
|
|
723
677
|
var visibleErrorPopper = this.state.visibleErrorPopper;
|
|
724
678
|
var _this$errorMessage = this.errorMessage, errorMessage = _this$errorMessage.errorMessage, isCommonError = _this$errorMessage.isCommonError;
|
|
725
679
|
var visibleErrorTooltip = showErrors && visibleErrorPopper && Boolean(errorMessage) && !this.isDisabled;
|
|
726
680
|
var _extractAriaProps2 = extractAriaProps(this.asProps), __excludeProps = _extractAriaProps2.__excludeProps;
|
|
727
|
-
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, _ref2.cn("Tooltip", {
|
|
681
|
+
return _ref2 = sstyled$1(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Tooltip, _ref2.cn("Tooltip", {
|
|
728
682
|
"interaction": "none",
|
|
729
683
|
"placement": isCommonError ? "right-start" : "right",
|
|
730
684
|
"visible": visibleErrorTooltip,
|
|
@@ -734,14 +688,14 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
734
688
|
boundary: (_this$containerRef$cu2 = this.containerRef.current) !== null && _this$containerRef$cu2 !== void 0 ? _this$containerRef$cu2 : void 0,
|
|
735
689
|
tether: false
|
|
736
690
|
}
|
|
737
|
-
}), function(
|
|
738
|
-
var popper =
|
|
739
|
-
if (!
|
|
740
|
-
|
|
741
|
-
|
|
691
|
+
}), function(_ref4) {
|
|
692
|
+
var popper = _ref4.popper, setTrigger = _ref4.setTrigger;
|
|
693
|
+
if (!_this6.popper) {
|
|
694
|
+
_this6.setPopperTrigger = setTrigger;
|
|
695
|
+
_this6.popper = popper;
|
|
742
696
|
}
|
|
743
697
|
return /* @__PURE__ */ React.createElement(Tooltip.Popper, {
|
|
744
|
-
id:
|
|
698
|
+
id: _this6.popperDescribedId
|
|
745
699
|
}, errorMessage);
|
|
746
700
|
}), /* @__PURE__ */ React.createElement(SInputField, _ref2.cn("SInputField", _objectSpread({}, assignProps({
|
|
747
701
|
"ref": this.containerRef,
|
|
@@ -751,7 +705,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
751
705
|
}, {
|
|
752
706
|
key: "prepareNodesForPaste",
|
|
753
707
|
value: function prepareNodesForPaste(value) {
|
|
754
|
-
var _pasteProps$lineProce, _pasteProps$skipEmpty, _pasteProps$delimiter,
|
|
708
|
+
var _pasteProps$lineProce, _pasteProps$skipEmpty, _pasteProps$delimiter, _this7 = this;
|
|
755
709
|
var listOfNodes = [];
|
|
756
710
|
var pasteProps = this.asProps.pasteProps;
|
|
757
711
|
var lineProcessing = (_pasteProps$lineProce = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.lineProcessing) !== null && _pasteProps$lineProce !== void 0 ? _pasteProps$lineProce : function(line) {
|
|
@@ -766,15 +720,15 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
766
720
|
if (preparedLine === "" && skipEmptyLines === false || preparedLine !== "") {
|
|
767
721
|
var node = document.createElement("p");
|
|
768
722
|
if (preparedLine === "") {
|
|
769
|
-
node.innerHTML =
|
|
723
|
+
node.innerHTML = _this7.emptyLineValue;
|
|
770
724
|
} else if (preparedLine.trim() === "") {
|
|
771
725
|
var allSpacesRegExp = new RegExp("\\s", "g");
|
|
772
|
-
node.innerHTML = DOMPurify.sanitize(preparedLine.replace(allSpacesRegExp,
|
|
726
|
+
node.innerHTML = DOMPurify.sanitize(preparedLine.replace(allSpacesRegExp, _this7.spaceLineValue));
|
|
773
727
|
} else {
|
|
774
728
|
node.append(document.createTextNode(preparedLine));
|
|
775
729
|
}
|
|
776
730
|
listOfNodes.push(node);
|
|
777
|
-
|
|
731
|
+
_this7.validateLine(node);
|
|
778
732
|
}
|
|
779
733
|
});
|
|
780
734
|
return listOfNodes;
|
|
@@ -799,17 +753,17 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
799
753
|
}, {
|
|
800
754
|
key: "recalculateLinesCount",
|
|
801
755
|
value: function recalculateLinesCount() {
|
|
802
|
-
var
|
|
756
|
+
var _this8 = this;
|
|
803
757
|
if (this.linesCountTimeout) {
|
|
804
758
|
clearTimeout(this.linesCountTimeout);
|
|
805
759
|
}
|
|
806
760
|
this.linesCountTimeout = window.setTimeout(function() {
|
|
807
761
|
var lines = 0;
|
|
808
|
-
var
|
|
809
|
-
|
|
762
|
+
var _this8$asProps = _this8.asProps, maxLines = _this8$asProps.maxLines, linesCount = _this8$asProps.linesCount;
|
|
763
|
+
_this8.textarea.childNodes.forEach(function(node, index) {
|
|
810
764
|
if (node instanceof HTMLParagraphElement) {
|
|
811
765
|
node.dataset.overMaxRows = "false";
|
|
812
|
-
if (node.textContent !==
|
|
766
|
+
if (node.textContent !== _this8.getEmptyParagraph().textContent && node.textContent !== "") {
|
|
813
767
|
lines++;
|
|
814
768
|
if (lines > maxLines) {
|
|
815
769
|
node.dataset.overMaxRows = "true";
|
|
@@ -818,7 +772,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
818
772
|
}
|
|
819
773
|
});
|
|
820
774
|
if (linesCount !== lines) {
|
|
821
|
-
|
|
775
|
+
_this8.asProps.onChangeLinesCount(lines);
|
|
822
776
|
}
|
|
823
777
|
}, 100);
|
|
824
778
|
}
|
|
@@ -845,57 +799,57 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
845
799
|
}, {
|
|
846
800
|
key: "toggleErrorsPopperByKeyboard",
|
|
847
801
|
value: function toggleErrorsPopperByKeyboard(timer) {
|
|
848
|
-
var
|
|
802
|
+
var _this9 = this;
|
|
849
803
|
if (this.toggleErrorsPopperTimeout) {
|
|
850
804
|
clearTimeout(this.toggleErrorsPopperTimeout);
|
|
851
805
|
}
|
|
852
806
|
if (!this.isScrolling) {
|
|
853
807
|
setTimeout(function() {
|
|
854
|
-
var rowNode =
|
|
855
|
-
|
|
808
|
+
var rowNode = _this9.getNodeFromSelection();
|
|
809
|
+
_this9.toggleErrorsPopper("keyboardLineIndex", rowNode, timer);
|
|
856
810
|
}, 0);
|
|
857
811
|
} else {
|
|
858
812
|
this.toggleErrorsPopperTimeout = window.setTimeout(function() {
|
|
859
|
-
|
|
813
|
+
_this9.toggleErrorsPopperByKeyboard(timer);
|
|
860
814
|
}, 50);
|
|
861
815
|
}
|
|
862
816
|
}
|
|
863
817
|
}, {
|
|
864
818
|
key: "toggleErrorsPopper",
|
|
865
819
|
value: function toggleErrorsPopper(key, target, timer) {
|
|
866
|
-
var
|
|
820
|
+
var _this10 = this;
|
|
867
821
|
if (target instanceof HTMLDivElement || target instanceof HTMLParagraphElement) {
|
|
868
822
|
if (this.changeTriggerTimeout) {
|
|
869
823
|
clearTimeout(this.changeTriggerTimeout);
|
|
870
824
|
}
|
|
871
825
|
this.changeTriggerTimeout = window.setTimeout(function() {
|
|
872
|
-
var targetElement = target ===
|
|
826
|
+
var targetElement = target === _this10.textarea ? _this10.getNodeFromSelection() : target;
|
|
873
827
|
var lineIndex = -1;
|
|
874
828
|
var isInvalidRow = false;
|
|
875
829
|
if (targetElement instanceof HTMLParagraphElement) {
|
|
876
830
|
isInvalidRow = targetElement.getAttribute("aria-invalid") === "true";
|
|
877
|
-
lineIndex = Array.from(
|
|
878
|
-
} else if (targetElement ===
|
|
831
|
+
lineIndex = Array.from(_this10.textarea.childNodes).indexOf(targetElement);
|
|
832
|
+
} else if (targetElement === _this10.textarea) {
|
|
879
833
|
lineIndex = 0;
|
|
880
834
|
}
|
|
881
835
|
if (targetElement instanceof HTMLElement) {
|
|
882
|
-
|
|
836
|
+
_this10.setState(function(prevState) {
|
|
883
837
|
var newState = {
|
|
884
|
-
visibleErrorPopper:
|
|
838
|
+
visibleErrorPopper: _this10.isFocusing && Boolean(_this10.asProps.commonErrorMessage) ? true : isInvalidRow,
|
|
885
839
|
mouseLineIndex: prevState.mouseLineIndex,
|
|
886
840
|
keyboardLineIndex: prevState.keyboardLineIndex
|
|
887
841
|
};
|
|
888
|
-
if (
|
|
842
|
+
if (_this10.isFocusing || key === "mouseLineIndex" && isInvalidRow) {
|
|
889
843
|
newState[key] = lineIndex;
|
|
890
844
|
}
|
|
891
845
|
return newState;
|
|
892
846
|
}, function() {
|
|
893
|
-
|
|
894
|
-
var trigger = isInvalidRow ? targetElement :
|
|
895
|
-
if (
|
|
896
|
-
var
|
|
897
|
-
(
|
|
898
|
-
|
|
847
|
+
_this10.errorByInteraction = key === "mouseLineIndex" ? "mouse" : "keyboard";
|
|
848
|
+
var trigger = isInvalidRow ? targetElement : _this10.textarea;
|
|
849
|
+
if (_this10.shouldChangePopperTrigger(trigger)) {
|
|
850
|
+
var _this10$setPopperTrig;
|
|
851
|
+
(_this10$setPopperTrig = _this10.setPopperTrigger) === null || _this10$setPopperTrig === void 0 ? void 0 : _this10$setPopperTrig.call(_this10, trigger);
|
|
852
|
+
_this10.forceUpdate();
|
|
899
853
|
}
|
|
900
854
|
});
|
|
901
855
|
}
|
|
@@ -920,7 +874,7 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
920
874
|
}, {
|
|
921
875
|
key: "handleChangeErrorIndex",
|
|
922
876
|
value: function handleChangeErrorIndex(errorIndex) {
|
|
923
|
-
var _error$lineNode,
|
|
877
|
+
var _error$lineNode, _this11 = this;
|
|
924
878
|
var error = this.asProps.errors[errorIndex];
|
|
925
879
|
var childNodes = this.textarea.childNodes;
|
|
926
880
|
var node = error ? (_error$lineNode = error.lineNode) !== null && _error$lineNode !== void 0 ? _error$lineNode : childNodes.item(error.lineIndex) : null;
|
|
@@ -932,9 +886,9 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
932
886
|
setTimeout(function() {
|
|
933
887
|
var text = node.childNodes.item(0);
|
|
934
888
|
if (text instanceof Text) {
|
|
935
|
-
|
|
889
|
+
_this11.setSelection(text, 0, text.length);
|
|
936
890
|
} else {
|
|
937
|
-
|
|
891
|
+
_this11.setSelection(node, 0, 1);
|
|
938
892
|
}
|
|
939
893
|
}, 150);
|
|
940
894
|
}
|
|
@@ -965,8 +919,8 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
965
919
|
var range = document.createRange();
|
|
966
920
|
range.setStart(node, start);
|
|
967
921
|
range.setEnd(node, end);
|
|
968
|
-
selection === null || selection === void 0
|
|
969
|
-
selection === null || selection === void 0
|
|
922
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
923
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range);
|
|
970
924
|
var nodeToScroll = node instanceof Text ? node.parentNode : node;
|
|
971
925
|
if (nodeToScroll instanceof HTMLElement) {
|
|
972
926
|
nodeToScroll.scrollIntoView({
|
|
@@ -1108,7 +1062,8 @@ var InputField = /* @__PURE__ */ (function(_Component) {
|
|
|
1108
1062
|
return null;
|
|
1109
1063
|
}
|
|
1110
1064
|
}]);
|
|
1111
|
-
|
|
1065
|
+
return InputField2;
|
|
1066
|
+
}(Component);
|
|
1112
1067
|
_defineProperty(InputField, "displayName", "Textarea");
|
|
1113
1068
|
_defineProperty(InputField, "style", style);
|
|
1114
1069
|
_defineProperty(InputField, "enhance", [uniqueIDEnhancement()]);
|