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