@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,84 +1,99 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.InputField = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
10
9
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
12
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var
|
|
13
|
+
var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _createSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/createSuper"));
|
|
16
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
17
|
-
var _index = require("@semcore/utils/lib/core/index");
|
|
18
16
|
var _core = require("@semcore/core");
|
|
19
|
-
var
|
|
20
|
-
var
|
|
17
|
+
var _baseComponents = require("@semcore/base-components");
|
|
18
|
+
var _ariaProps = require("@semcore/core/lib/utils/ariaProps");
|
|
19
|
+
var _uniqueID = _interopRequireDefault(require("@semcore/core/lib/utils/uniqueID"));
|
|
21
20
|
var _tooltip = _interopRequireDefault(require("@semcore/tooltip"));
|
|
22
|
-
var _ariaProps = require("@semcore/utils/lib/ariaProps");
|
|
23
|
-
var _uniqueID = _interopRequireDefault(require("@semcore/utils/lib/uniqueID"));
|
|
24
21
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
22
|
+
var _react = _interopRequireDefault(require("react"));
|
|
25
23
|
/*!__reshadow-styles__:"./inputField.shadow.css"*/
|
|
26
|
-
var style = ( /*__reshadow_css_start__*/_index.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_"),
|
|
24
|
+
var style = (/*__reshadow_css_start__*/_core.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_"),
|
|
27
25
|
/*__reshadow_css_end__*/
|
|
28
26
|
{
|
|
29
|
-
"__SInputField": "
|
|
30
|
-
"_showErrors": "
|
|
31
|
-
"_readonly": "
|
|
32
|
-
"_disabled": "
|
|
33
|
-
"_size_m": "
|
|
34
|
-
"--minRows": "--
|
|
35
|
-
"--maxRows": "--
|
|
36
|
-
"_size_l": "
|
|
37
|
-
"_state_normal": "
|
|
38
|
-
"_state_valid": "
|
|
39
|
-
"_state_invalid": "
|
|
27
|
+
"__SInputField": "___SInputField_w0knh_gg_",
|
|
28
|
+
"_showErrors": "__showErrors_w0knh_gg_",
|
|
29
|
+
"_readonly": "__readonly_w0knh_gg_",
|
|
30
|
+
"_disabled": "__disabled_w0knh_gg_",
|
|
31
|
+
"_size_m": "_size_m_w0knh_gg_",
|
|
32
|
+
"--minRows": "--minRows_w0knh",
|
|
33
|
+
"--maxRows": "--maxRows_w0knh",
|
|
34
|
+
"_size_l": "_size_l_w0knh_gg_",
|
|
35
|
+
"_state_normal": "_state_normal_w0knh_gg_",
|
|
36
|
+
"_state_valid": "_state_valid_w0knh_gg_",
|
|
37
|
+
"_state_invalid": "_state_invalid_w0knh_gg_"
|
|
40
38
|
});
|
|
41
|
-
var InputField = /*#__PURE__*/function (_Component) {
|
|
42
|
-
(0, _inherits2["default"])(InputField, _Component);
|
|
43
|
-
var _super = (0, _createSuper2["default"])(InputField);
|
|
39
|
+
var InputField = exports.InputField = /*#__PURE__*/function (_Component) {
|
|
44
40
|
function InputField(props) {
|
|
45
41
|
var _this;
|
|
46
42
|
(0, _classCallCheck2["default"])(this, InputField);
|
|
47
|
-
_this =
|
|
48
|
-
(0, _defineProperty2["default"])(
|
|
49
|
-
(0, _defineProperty2["default"])(
|
|
50
|
-
(0, _defineProperty2["default"])(
|
|
51
|
-
(0, _defineProperty2["default"])(
|
|
52
|
-
(0, _defineProperty2["default"])(
|
|
53
|
-
(0, _defineProperty2["default"])(
|
|
54
|
-
(0, _defineProperty2["default"])(
|
|
55
|
-
(0, _defineProperty2["default"])(
|
|
56
|
-
(0, _defineProperty2["default"])(
|
|
57
|
-
(0, _defineProperty2["default"])(
|
|
58
|
-
(0, _defineProperty2["default"])(
|
|
59
|
-
(0, _defineProperty2["default"])(
|
|
60
|
-
(0, _defineProperty2["default"])(
|
|
61
|
-
(0, _defineProperty2["default"])(
|
|
62
|
-
(0, _defineProperty2["default"])(
|
|
63
|
-
(0, _defineProperty2["default"])(
|
|
43
|
+
_this = (0, _callSuper2["default"])(this, InputField, [props]);
|
|
44
|
+
(0, _defineProperty2["default"])(_this, "delimiter", '\n');
|
|
45
|
+
(0, _defineProperty2["default"])(_this, "skipEmptyLines", true);
|
|
46
|
+
(0, _defineProperty2["default"])(_this, "emptyLineValue", '');
|
|
47
|
+
(0, _defineProperty2["default"])(_this, "spaceLineValue", ' ');
|
|
48
|
+
(0, _defineProperty2["default"])(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
49
|
+
(0, _defineProperty2["default"])(_this, "textarea", void 0);
|
|
50
|
+
(0, _defineProperty2["default"])(_this, "popper", null);
|
|
51
|
+
(0, _defineProperty2["default"])(_this, "setPopperTrigger", null);
|
|
52
|
+
(0, _defineProperty2["default"])(_this, "errorByInteraction", null);
|
|
53
|
+
(0, _defineProperty2["default"])(_this, "changeTriggerTimeout", 0);
|
|
54
|
+
(0, _defineProperty2["default"])(_this, "isScrolling", false);
|
|
55
|
+
(0, _defineProperty2["default"])(_this, "scrollingTimeout", 0);
|
|
56
|
+
(0, _defineProperty2["default"])(_this, "toggleErrorsPopperTimeout", 0);
|
|
57
|
+
(0, _defineProperty2["default"])(_this, "isFocusing", false);
|
|
58
|
+
(0, _defineProperty2["default"])(_this, "linesCountTimeout", 0);
|
|
59
|
+
(0, _defineProperty2["default"])(_this, "observer", void 0);
|
|
60
|
+
(0, _defineProperty2["default"])(_this, "state", {
|
|
64
61
|
visibleErrorPopper: false,
|
|
65
62
|
keyboardLineIndex: -1,
|
|
66
63
|
mouseLineIndex: -1
|
|
67
64
|
});
|
|
68
|
-
_this.handlePaste = _this.handlePaste.bind(
|
|
69
|
-
_this.handleChange = _this.handleChange.bind(
|
|
70
|
-
_this.handleFocus = _this.handleFocus.bind(
|
|
71
|
-
_this.handleBlur = _this.handleBlur.bind(
|
|
72
|
-
_this.handleKeyDown = _this.handleKeyDown.bind(
|
|
73
|
-
_this.handleMouseDown = _this.handleMouseDown.bind(
|
|
74
|
-
_this.handleMouseMove = _this.handleMouseMove.bind(
|
|
75
|
-
_this.handleMouseLeave = _this.handleMouseLeave.bind(
|
|
76
|
-
_this.handleScroll = _this.handleScroll.bind(
|
|
77
|
-
_this.handleSelectAll = _this.handleSelectAll.bind(
|
|
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);
|
|
78
75
|
_this.textarea = _this.createContentEditableElement(props);
|
|
76
|
+
_this.observer = new MutationObserver(function (mutationsList, observer) {
|
|
77
|
+
var _iterator = (0, _createForOfIteratorHelper2["default"])(mutationsList),
|
|
78
|
+
_step;
|
|
79
|
+
try {
|
|
80
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
81
|
+
var mutation = _step.value;
|
|
82
|
+
if (mutation.type === 'characterData' || mutation.type === 'childList') {
|
|
83
|
+
var _this$props$onImmedia, _this$props, _this$textarea$textCo;
|
|
84
|
+
(_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 : '');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
} catch (err) {
|
|
88
|
+
_iterator.e(err);
|
|
89
|
+
} finally {
|
|
90
|
+
_iterator.f();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
79
93
|
return _this;
|
|
80
94
|
}
|
|
81
|
-
(0,
|
|
95
|
+
(0, _inherits2["default"])(InputField, _Component);
|
|
96
|
+
return (0, _createClass2["default"])(InputField, [{
|
|
82
97
|
key: "uncontrolledProps",
|
|
83
98
|
value: function uncontrolledProps() {
|
|
84
99
|
return {
|
|
@@ -90,32 +105,71 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
90
105
|
}, {
|
|
91
106
|
key: "componentDidMount",
|
|
92
107
|
value: function componentDidMount() {
|
|
93
|
-
var _this$containerRef$cu
|
|
94
|
-
|
|
108
|
+
var _this$containerRef$cu,
|
|
109
|
+
_this2 = this;
|
|
110
|
+
var _this$asProps = this.asProps,
|
|
111
|
+
autoFocus = _this$asProps.autoFocus,
|
|
112
|
+
disabled = _this$asProps.disabled,
|
|
113
|
+
readonly = _this$asProps.readonly;
|
|
114
|
+
(_this$containerRef$cu = this.containerRef.current) === null || _this$containerRef$cu === void 0 || _this$containerRef$cu.append(this.textarea);
|
|
95
115
|
this.handleValueOutChange();
|
|
116
|
+
var config = {
|
|
117
|
+
childList: true,
|
|
118
|
+
characterData: true,
|
|
119
|
+
subtree: true
|
|
120
|
+
};
|
|
121
|
+
if (this.props.onImmediatelyChange) {
|
|
122
|
+
this.observer.observe(this.textarea, config);
|
|
123
|
+
}
|
|
124
|
+
if (autoFocus && !disabled) {
|
|
125
|
+
/* Safari & Firefox may silently ignore programmatic focus calls with very short
|
|
126
|
+
delays (<10ms). Using 10ms as a safe threshold based on observed behavior.
|
|
127
|
+
*/
|
|
128
|
+
setTimeout(function () {
|
|
129
|
+
return _this2.textarea.focus();
|
|
130
|
+
}, 10);
|
|
131
|
+
}
|
|
96
132
|
}
|
|
97
133
|
}, {
|
|
98
134
|
key: "componentDidUpdate",
|
|
99
135
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
100
|
-
var
|
|
101
|
-
var _this$
|
|
102
|
-
value = _this$
|
|
103
|
-
errors = _this$
|
|
104
|
-
errorIndex = _this$
|
|
105
|
-
showErrors = _this$
|
|
106
|
-
disabled = _this$
|
|
107
|
-
readonly = _this$
|
|
108
|
-
highlightErrorIndex = _this$
|
|
109
|
-
lineProcessing = _this$
|
|
110
|
-
_this$
|
|
111
|
-
ariaDescribedby = _this$
|
|
136
|
+
var _this3 = this;
|
|
137
|
+
var _this$props2 = this.props,
|
|
138
|
+
value = _this$props2.value,
|
|
139
|
+
errors = _this$props2.errors,
|
|
140
|
+
errorIndex = _this$props2.errorIndex,
|
|
141
|
+
showErrors = _this$props2.showErrors,
|
|
142
|
+
disabled = _this$props2.disabled,
|
|
143
|
+
readonly = _this$props2.readonly,
|
|
144
|
+
highlightErrorIndex = _this$props2.highlightErrorIndex,
|
|
145
|
+
lineProcessing = _this$props2.lineProcessing,
|
|
146
|
+
_this$props2$ariaDes = _this$props2['aria-describedby'],
|
|
147
|
+
ariaDescribedby = _this$props2$ariaDes === void 0 ? '' : _this$props2$ariaDes;
|
|
112
148
|
if (prevProps.value !== value) {
|
|
113
149
|
var currentValue = this.getValues().join(this.delimiter);
|
|
114
150
|
if (typeof value === 'string' ? value !== currentValue : value.join(this.delimiter) !== currentValue) {
|
|
115
151
|
this.handleValueOutChange();
|
|
116
152
|
}
|
|
117
153
|
}
|
|
118
|
-
if (prevProps.showErrors !== showErrors || prevProps.errors
|
|
154
|
+
if (prevProps.showErrors !== showErrors || prevProps.errors !== errors) {
|
|
155
|
+
if (showErrors) {
|
|
156
|
+
var errorsMap = new Map();
|
|
157
|
+
errors.forEach(function (error) {
|
|
158
|
+
errorsMap.set(error.lineIndex, error);
|
|
159
|
+
});
|
|
160
|
+
this.textarea.childNodes.forEach(function (node, index) {
|
|
161
|
+
if (node instanceof HTMLParagraphElement) {
|
|
162
|
+
var errorItem = errorsMap.get(index);
|
|
163
|
+
if (errorItem) {
|
|
164
|
+
node.setAttribute('aria-invalid', 'true');
|
|
165
|
+
node.dataset.errormessage = errorItem.errorMessage;
|
|
166
|
+
} else {
|
|
167
|
+
node.removeAttribute('aria-invalid');
|
|
168
|
+
node.dataset.errormessage = undefined;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}
|
|
119
173
|
this.toggleAriaInvalid(showErrors, errors.length);
|
|
120
174
|
if (showErrors === false) {
|
|
121
175
|
this.textarea.setAttribute('aria-describedby', ariaDescribedby);
|
|
@@ -155,13 +209,12 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
155
209
|
}
|
|
156
210
|
this.validateLine(paragraph);
|
|
157
211
|
setTimeout(function () {
|
|
158
|
-
var newNode =
|
|
212
|
+
var newNode = _this3.textarea.childNodes.item(keyboardLineIndex);
|
|
159
213
|
if (newNode) {
|
|
160
|
-
|
|
214
|
+
_this3.setErrorIndex(newNode);
|
|
161
215
|
}
|
|
162
216
|
}, 0); // need this timeout to update errorIndex to the new (usually empty) line
|
|
163
217
|
}
|
|
164
|
-
|
|
165
218
|
if (!showErrors) {
|
|
166
219
|
this.recalculateErrors();
|
|
167
220
|
}
|
|
@@ -173,13 +226,14 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
173
226
|
key: "componentWillUnmount",
|
|
174
227
|
value: function componentWillUnmount() {
|
|
175
228
|
this.removeEventListeners(this.textarea);
|
|
229
|
+
this.observer.disconnect();
|
|
176
230
|
}
|
|
177
231
|
}, {
|
|
178
232
|
key: "isDisabled",
|
|
179
233
|
get: function get() {
|
|
180
|
-
var _this$
|
|
181
|
-
disabled = _this$
|
|
182
|
-
readonly = _this$
|
|
234
|
+
var _this$asProps2 = this.asProps,
|
|
235
|
+
disabled = _this$asProps2.disabled,
|
|
236
|
+
readonly = _this$asProps2.readonly;
|
|
183
237
|
return Boolean(disabled || readonly);
|
|
184
238
|
}
|
|
185
239
|
}, {
|
|
@@ -192,11 +246,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
192
246
|
key: "errorMessage",
|
|
193
247
|
get: function get() {
|
|
194
248
|
var _errorItem$errorMessa, _errorItem, _errorItem2;
|
|
195
|
-
var _this$
|
|
196
|
-
errors = _this$
|
|
197
|
-
errorIndex = _this$
|
|
198
|
-
commonErrorMessage = _this$
|
|
199
|
-
prevError = _this$
|
|
249
|
+
var _this$asProps3 = this.asProps,
|
|
250
|
+
errors = _this$asProps3.errors,
|
|
251
|
+
errorIndex = _this$asProps3.errorIndex,
|
|
252
|
+
commonErrorMessage = _this$asProps3.commonErrorMessage,
|
|
253
|
+
prevError = _this$asProps3.prevError;
|
|
200
254
|
var _this$state = this.state,
|
|
201
255
|
mouseLineIndex = _this$state.mouseLineIndex,
|
|
202
256
|
keyboardLineIndex = _this$state.keyboardLineIndex;
|
|
@@ -251,9 +305,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
251
305
|
}, {
|
|
252
306
|
key: "handleValueOutChange",
|
|
253
307
|
value: function handleValueOutChange() {
|
|
254
|
-
var _this$
|
|
255
|
-
value = _this$
|
|
256
|
-
onChangeLinesCount = _this$
|
|
308
|
+
var _this$props3 = this.props,
|
|
309
|
+
value = _this$props3.value,
|
|
310
|
+
onChangeLinesCount = _this$props3.onChangeLinesCount;
|
|
257
311
|
if (value === '') {
|
|
258
312
|
this.textarea.textContent = '';
|
|
259
313
|
onChangeLinesCount(0);
|
|
@@ -268,13 +322,13 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
268
322
|
}, {
|
|
269
323
|
key: "handleScroll",
|
|
270
324
|
value: function handleScroll() {
|
|
271
|
-
var
|
|
325
|
+
var _this4 = this;
|
|
272
326
|
if (this.scrollingTimeout) {
|
|
273
327
|
clearTimeout(this.scrollingTimeout);
|
|
274
328
|
}
|
|
275
329
|
this.isScrolling = true;
|
|
276
330
|
this.scrollingTimeout = window.setTimeout(function () {
|
|
277
|
-
|
|
331
|
+
_this4.isScrolling = false;
|
|
278
332
|
}, 50);
|
|
279
333
|
}
|
|
280
334
|
}, {
|
|
@@ -304,7 +358,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
304
358
|
}
|
|
305
359
|
}, {
|
|
306
360
|
key: "handleMouseLeave",
|
|
307
|
-
value: function handleMouseLeave(
|
|
361
|
+
value: function handleMouseLeave() {
|
|
308
362
|
if (this.changeTriggerTimeout) {
|
|
309
363
|
clearTimeout(this.changeTriggerTimeout);
|
|
310
364
|
}
|
|
@@ -351,9 +405,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
351
405
|
textNode = lastNodeToInsert.childNodes.item(0);
|
|
352
406
|
position = ((_lastNodeToInsert$tex = lastNodeToInsert.textContent) !== null && _lastNodeToInsert$tex !== void 0 ? _lastNodeToInsert$tex : '').length;
|
|
353
407
|
} else if (focusNode instanceof HTMLParagraphElement && anchorNode instanceof HTMLParagraphElement) {
|
|
354
|
-
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2,
|
|
355
|
-
var before = (_anchorNode$textConte = anchorNode === null || anchorNode === void 0
|
|
356
|
-
var after = (_focusNode$textConten = focusNode === null || focusNode === void 0
|
|
408
|
+
var _anchorNode$textConte, _anchorNode$textConte2, _focusNode$textConten, _focusNode$textConten2, _firstNodeToInsert$te;
|
|
409
|
+
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 : '';
|
|
410
|
+
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 : '';
|
|
357
411
|
var noEmptyLineBefore = before.trim() === '' ? '' : before;
|
|
358
412
|
var noEmptyLineAfter = after.trim() === '' ? '' : after;
|
|
359
413
|
selection.deleteFromDocument();
|
|
@@ -362,7 +416,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
362
416
|
}
|
|
363
417
|
var firstNodeToInsert = listOfNodes.splice(0, 1)[0];
|
|
364
418
|
var _lastNodeToInsert = listOfNodes[listOfNodes.length - 1];
|
|
365
|
-
anchorNode.textContent =
|
|
419
|
+
anchorNode.textContent = noEmptyLineBefore + ((_firstNodeToInsert$te = firstNodeToInsert === null || firstNodeToInsert === void 0 ? void 0 : firstNodeToInsert.textContent) !== null && _firstNodeToInsert$te !== void 0 ? _firstNodeToInsert$te : '');
|
|
366
420
|
anchorNode.after.apply(anchorNode, (0, _toConsumableArray2["default"])(listOfNodes));
|
|
367
421
|
if (_lastNodeToInsert) {
|
|
368
422
|
var _lastNodeToInsert$tex2, _lastNodeToInsert$tex3;
|
|
@@ -381,11 +435,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
381
435
|
}
|
|
382
436
|
}
|
|
383
437
|
if (textNode instanceof Text) {
|
|
384
|
-
|
|
385
|
-
this.setSelection(textNode, (_position = position) !== null && _position !== void 0 ? _position : 1, (_position2 = position) !== null && _position2 !== void 0 ? _position2 : 1);
|
|
438
|
+
this.setSelection(textNode, position !== null && position !== void 0 ? position : 1, position !== null && position !== void 0 ? position : 1);
|
|
386
439
|
this.toggleErrorsPopper('keyboardLineIndex', textNode.parentNode);
|
|
387
440
|
} else {
|
|
388
441
|
var _textNode;
|
|
442
|
+
// eslint-disable-next-line no-console
|
|
389
443
|
console.warn('incorrect child type', textNode, (_textNode = textNode) === null || _textNode === void 0 ? void 0 : _textNode.parentNode);
|
|
390
444
|
}
|
|
391
445
|
}
|
|
@@ -411,7 +465,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
411
465
|
var text = document.createTextNode(nodeText);
|
|
412
466
|
firstRow.append(text);
|
|
413
467
|
firstNode.replaceWith(firstRow);
|
|
414
|
-
selection === null || selection === void 0
|
|
468
|
+
selection === null || selection === void 0 || selection.setPosition(firstRow, nodeText.length);
|
|
415
469
|
} else if (!firstNode || firstNode instanceof HTMLBRElement && nodes.length === 1) {
|
|
416
470
|
this.textarea.textContent = '';
|
|
417
471
|
this.setState({
|
|
@@ -463,9 +517,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
463
517
|
} else if (childNodes.length === 1 && childNodes[0] instanceof HTMLBRElement) {
|
|
464
518
|
rowNode.innerHTML = this.emptyLineValue;
|
|
465
519
|
}
|
|
466
|
-
var _this$
|
|
467
|
-
errors = _this$
|
|
468
|
-
showErrors = _this$
|
|
520
|
+
var _this$asProps4 = this.asProps,
|
|
521
|
+
errors = _this$asProps4.errors,
|
|
522
|
+
showErrors = _this$asProps4.showErrors;
|
|
469
523
|
var isValid = this.validateLine(rowNode);
|
|
470
524
|
this.recalculateErrors();
|
|
471
525
|
this.setErrorIndex(rowNode);
|
|
@@ -473,10 +527,10 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
473
527
|
this.toggleErrorsPopper('keyboardLineIndex', rowNode, 0);
|
|
474
528
|
}
|
|
475
529
|
var trigger = !isValid || isValid && errors.length === 1 && errors[0].lineNode === rowNode ? rowNode : this.textarea;
|
|
476
|
-
if (showErrors && ((_this$popper = this.popper) === null || _this$popper === void 0 ? void 0 : _this$popper.
|
|
530
|
+
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) {
|
|
477
531
|
if (this.shouldChangePopperTrigger(trigger)) {
|
|
478
532
|
var _this$setPopperTrigge;
|
|
479
|
-
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0
|
|
533
|
+
(_this$setPopperTrigge = this.setPopperTrigger) === null || _this$setPopperTrigge === void 0 || _this$setPopperTrigge.call(this, trigger);
|
|
480
534
|
} else {
|
|
481
535
|
this.setState({
|
|
482
536
|
visibleErrorPopper: false
|
|
@@ -485,7 +539,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
485
539
|
}
|
|
486
540
|
} else if (rowNode === null) {
|
|
487
541
|
var _this$setPopperTrigge2;
|
|
488
|
-
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0
|
|
542
|
+
(_this$setPopperTrigge2 = this.setPopperTrigger) === null || _this$setPopperTrigge2 === void 0 || _this$setPopperTrigge2.call(this, this.textarea);
|
|
489
543
|
if ((selection === null || selection === void 0 ? void 0 : selection.focusNode) === this.textarea && this.textarea.childNodes.length > 1) {
|
|
490
544
|
var nodeIndex = selection.focusOffset;
|
|
491
545
|
var emptyParagraph = this.textarea.childNodes.item(nodeIndex - 1);
|
|
@@ -506,7 +560,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
506
560
|
}
|
|
507
561
|
}, {
|
|
508
562
|
key: "handleFocus",
|
|
509
|
-
value: function handleFocus(
|
|
563
|
+
value: function handleFocus() {
|
|
510
564
|
this.isFocusing = true;
|
|
511
565
|
this.errorByInteraction = 'keyboard';
|
|
512
566
|
if (this.asProps.showErrors) {
|
|
@@ -518,22 +572,22 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
518
572
|
}, {
|
|
519
573
|
key: "handleBlur",
|
|
520
574
|
value: function handleBlur(event) {
|
|
521
|
-
var
|
|
575
|
+
var _this5 = this;
|
|
522
576
|
this.isFocusing = false;
|
|
523
577
|
this.setState({
|
|
524
578
|
visibleErrorPopper: false
|
|
525
579
|
});
|
|
526
|
-
var _this$
|
|
527
|
-
validateOn = _this$
|
|
528
|
-
onBlur = _this$
|
|
529
|
-
value = _this$
|
|
580
|
+
var _this$asProps5 = this.asProps,
|
|
581
|
+
validateOn = _this$asProps5.validateOn,
|
|
582
|
+
onBlur = _this$asProps5.onBlur,
|
|
583
|
+
value = _this$asProps5.value;
|
|
530
584
|
if (validateOn.includes('blur')) {
|
|
531
585
|
this.recalculateErrors();
|
|
532
586
|
}
|
|
533
587
|
var valueToChange = typeof value === 'string' ? this.getValues().join(this.delimiter) : this.getValues();
|
|
534
588
|
onBlur(valueToChange, event);
|
|
535
589
|
setTimeout(function () {
|
|
536
|
-
|
|
590
|
+
_this5.setState({
|
|
537
591
|
keyboardLineIndex: -1
|
|
538
592
|
});
|
|
539
593
|
}, 200);
|
|
@@ -541,7 +595,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
541
595
|
}, {
|
|
542
596
|
key: "handleKeyDown",
|
|
543
597
|
value: function handleKeyDown(event) {
|
|
544
|
-
var
|
|
598
|
+
var _this6 = this;
|
|
545
599
|
this.errorByInteraction = 'keyboard';
|
|
546
600
|
var linesDelimiters = this.asProps.linesDelimiters;
|
|
547
601
|
var currentNode = this.getNodeFromSelection();
|
|
@@ -558,7 +612,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
558
612
|
var _selection$focusNode, _selectionNode$textCo, _currentNode$textCont2, _row$textContent;
|
|
559
613
|
event.preventDefault();
|
|
560
614
|
var selection = document.getSelection();
|
|
561
|
-
var selectionNode = (selection === null || selection === void 0 ? void 0 : selection.focusNode) instanceof Text ? selection.focusNode : selection === null || selection === void 0
|
|
615
|
+
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);
|
|
562
616
|
var selectionOffset = selection === null || selection === void 0 ? void 0 : selection.focusOffset;
|
|
563
617
|
var newRowValue = '';
|
|
564
618
|
if (selectionNode instanceof Text && selectionOffset !== undefined && selectionOffset !== ((_selectionNode$textCo = selectionNode.textContent) === null || _selectionNode$textCo === void 0 ? void 0 : _selectionNode$textCo.length)) {
|
|
@@ -589,7 +643,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
589
643
|
this.recalculateLinesCount();
|
|
590
644
|
}
|
|
591
645
|
setTimeout(function () {
|
|
592
|
-
|
|
646
|
+
_this6.recalculateErrors();
|
|
593
647
|
}, 0);
|
|
594
648
|
this.toggleErrorsPopperByKeyboard(0);
|
|
595
649
|
}
|
|
@@ -619,16 +673,17 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
619
673
|
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;
|
|
620
674
|
this.setSelection(text, offset, offset);
|
|
621
675
|
} else {
|
|
676
|
+
// eslint-disable-next-line no-console
|
|
622
677
|
console.warn('incorrect prevNode type', prevNode);
|
|
623
678
|
}
|
|
624
679
|
}
|
|
625
680
|
setTimeout(function () {
|
|
626
|
-
|
|
681
|
+
_this6.recalculateErrors();
|
|
627
682
|
}, 0);
|
|
628
683
|
this.toggleErrorsPopperByKeyboard(0);
|
|
629
684
|
}
|
|
630
685
|
} else if (this.isRangeSelection()) {
|
|
631
|
-
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2
|
|
686
|
+
var _currentNode$textCont4, _focusElement$parentN, _anchorElement$parent, _focusElement$parentN2;
|
|
632
687
|
var _selection = document.getSelection();
|
|
633
688
|
var direction = this.getSelectionDirection();
|
|
634
689
|
var anchorElement = direction === 'backward' ? _selection === null || _selection === void 0 ? void 0 : _selection.focusNode : _selection === null || _selection === void 0 ? void 0 : _selection.anchorNode;
|
|
@@ -652,12 +707,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
652
707
|
this.setErrorIndex(currentNode);
|
|
653
708
|
this.recalculateLinesCount();
|
|
654
709
|
setTimeout(function () {
|
|
655
|
-
|
|
710
|
+
_this6.recalculateErrors();
|
|
656
711
|
}, 0);
|
|
657
712
|
this.toggleErrorsPopperByKeyboard(0);
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
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)) {
|
|
713
|
+
} 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)) {
|
|
714
|
+
// Backspace on selected few full rows
|
|
661
715
|
event.preventDefault();
|
|
662
716
|
var paragraphs = Array.from(this.textarea.children);
|
|
663
717
|
var _anchorParagraph = anchorElement.parentElement;
|
|
@@ -668,11 +722,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
668
722
|
this.setSelection(this.textarea, 0, 0);
|
|
669
723
|
} else {
|
|
670
724
|
var isCleaning = false;
|
|
671
|
-
var
|
|
672
|
-
|
|
725
|
+
var _iterator2 = (0, _createForOfIteratorHelper2["default"])(paragraphs),
|
|
726
|
+
_step2;
|
|
673
727
|
try {
|
|
674
|
-
for (
|
|
675
|
-
var paragraph =
|
|
728
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
729
|
+
var paragraph = _step2.value;
|
|
676
730
|
if (paragraph === _anchorParagraph || isCleaning) {
|
|
677
731
|
isCleaning = true;
|
|
678
732
|
if (paragraph === _focusParagraph) {
|
|
@@ -685,16 +739,16 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
685
739
|
}
|
|
686
740
|
}
|
|
687
741
|
} catch (err) {
|
|
688
|
-
|
|
742
|
+
_iterator2.e(err);
|
|
689
743
|
} finally {
|
|
690
|
-
|
|
744
|
+
_iterator2.f();
|
|
691
745
|
}
|
|
692
746
|
this.validateLine(currentNode);
|
|
693
747
|
}
|
|
694
748
|
this.setErrorIndex(currentNode);
|
|
695
749
|
this.recalculateLinesCount();
|
|
696
750
|
setTimeout(function () {
|
|
697
|
-
|
|
751
|
+
_this6.recalculateErrors();
|
|
698
752
|
}, 0);
|
|
699
753
|
this.toggleErrorsPopperByKeyboard(0);
|
|
700
754
|
}
|
|
@@ -709,11 +763,11 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
709
763
|
var _ref = this.asProps,
|
|
710
764
|
_ref2,
|
|
711
765
|
_this$containerRef$cu2,
|
|
712
|
-
|
|
713
|
-
var SInputField =
|
|
714
|
-
var _this$
|
|
715
|
-
styles = _this$
|
|
716
|
-
showErrors = _this$
|
|
766
|
+
_this7 = this;
|
|
767
|
+
var SInputField = _baseComponents.Box;
|
|
768
|
+
var _this$asProps6 = this.asProps,
|
|
769
|
+
styles = _this$asProps6.styles,
|
|
770
|
+
showErrors = _this$asProps6.showErrors;
|
|
717
771
|
var visibleErrorPopper = this.state.visibleErrorPopper;
|
|
718
772
|
var _this$errorMessage = this.errorMessage,
|
|
719
773
|
errorMessage = _this$errorMessage.errorMessage,
|
|
@@ -731,16 +785,16 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
731
785
|
boundary: (_this$containerRef$cu2 = this.containerRef.current) !== null && _this$containerRef$cu2 !== void 0 ? _this$containerRef$cu2 : undefined,
|
|
732
786
|
tether: false
|
|
733
787
|
}
|
|
734
|
-
}), function (
|
|
735
|
-
var popper =
|
|
736
|
-
setTrigger =
|
|
737
|
-
if (!
|
|
738
|
-
|
|
788
|
+
}), function (_ref3) {
|
|
789
|
+
var popper = _ref3.popper,
|
|
790
|
+
setTrigger = _ref3.setTrigger;
|
|
791
|
+
if (!_this7.popper) {
|
|
792
|
+
_this7.setPopperTrigger = setTrigger;
|
|
739
793
|
// @ts-ignore
|
|
740
|
-
|
|
794
|
+
_this7.popper = popper;
|
|
741
795
|
}
|
|
742
796
|
return /*#__PURE__*/_react["default"].createElement(_tooltip["default"].Popper, {
|
|
743
|
-
id:
|
|
797
|
+
id: _this7.popperDescribedId
|
|
744
798
|
}, errorMessage);
|
|
745
799
|
}), /*#__PURE__*/_react["default"].createElement(SInputField, _ref2.cn("SInputField", (0, _objectSpread2["default"])({}, (0, _core.assignProps)({
|
|
746
800
|
"ref": this.containerRef,
|
|
@@ -753,7 +807,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
753
807
|
var _pasteProps$lineProce,
|
|
754
808
|
_pasteProps$skipEmpty,
|
|
755
809
|
_pasteProps$delimiter,
|
|
756
|
-
|
|
810
|
+
_this8 = this;
|
|
757
811
|
var listOfNodes = [];
|
|
758
812
|
var pasteProps = this.asProps.pasteProps;
|
|
759
813
|
var lineProcessing = (_pasteProps$lineProce = pasteProps === null || pasteProps === void 0 ? void 0 : pasteProps.lineProcessing) !== null && _pasteProps$lineProce !== void 0 ? _pasteProps$lineProce : function (line) {
|
|
@@ -768,15 +822,15 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
768
822
|
if (preparedLine === '' && skipEmptyLines === false || preparedLine !== '') {
|
|
769
823
|
var node = document.createElement('p');
|
|
770
824
|
if (preparedLine === '') {
|
|
771
|
-
node.innerHTML =
|
|
825
|
+
node.innerHTML = _this8.emptyLineValue;
|
|
772
826
|
} else if (preparedLine.trim() === '') {
|
|
773
827
|
var allSpacesRegExp = new RegExp('\\s', 'g');
|
|
774
|
-
node.innerHTML = _dompurify["default"].sanitize(preparedLine.replace(allSpacesRegExp,
|
|
828
|
+
node.innerHTML = _dompurify["default"].sanitize(preparedLine.replace(allSpacesRegExp, _this8.spaceLineValue));
|
|
775
829
|
} else {
|
|
776
830
|
node.append(document.createTextNode(preparedLine));
|
|
777
831
|
}
|
|
778
832
|
listOfNodes.push(node);
|
|
779
|
-
|
|
833
|
+
_this8.validateLine(node);
|
|
780
834
|
}
|
|
781
835
|
});
|
|
782
836
|
return listOfNodes;
|
|
@@ -801,19 +855,19 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
801
855
|
}, {
|
|
802
856
|
key: "recalculateLinesCount",
|
|
803
857
|
value: function recalculateLinesCount() {
|
|
804
|
-
var
|
|
858
|
+
var _this9 = this;
|
|
805
859
|
if (this.linesCountTimeout) {
|
|
806
860
|
clearTimeout(this.linesCountTimeout);
|
|
807
861
|
}
|
|
808
862
|
this.linesCountTimeout = window.setTimeout(function () {
|
|
809
863
|
var lines = 0;
|
|
810
|
-
var
|
|
811
|
-
maxLines =
|
|
812
|
-
linesCount =
|
|
813
|
-
|
|
864
|
+
var _this9$asProps = _this9.asProps,
|
|
865
|
+
maxLines = _this9$asProps.maxLines,
|
|
866
|
+
linesCount = _this9$asProps.linesCount;
|
|
867
|
+
_this9.textarea.childNodes.forEach(function (node) {
|
|
814
868
|
if (node instanceof HTMLParagraphElement) {
|
|
815
869
|
node.dataset.overMaxRows = 'false';
|
|
816
|
-
if (node.textContent !==
|
|
870
|
+
if (node.textContent !== _this9.getEmptyParagraph().textContent && node.textContent !== '') {
|
|
817
871
|
lines++;
|
|
818
872
|
if (lines > maxLines) {
|
|
819
873
|
node.dataset.overMaxRows = 'true';
|
|
@@ -822,7 +876,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
822
876
|
}
|
|
823
877
|
});
|
|
824
878
|
if (linesCount !== lines) {
|
|
825
|
-
|
|
879
|
+
_this9.asProps.onChangeLinesCount(lines);
|
|
826
880
|
}
|
|
827
881
|
}, 100);
|
|
828
882
|
}
|
|
@@ -849,57 +903,57 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
849
903
|
}, {
|
|
850
904
|
key: "toggleErrorsPopperByKeyboard",
|
|
851
905
|
value: function toggleErrorsPopperByKeyboard(timer) {
|
|
852
|
-
var
|
|
906
|
+
var _this0 = this;
|
|
853
907
|
if (this.toggleErrorsPopperTimeout) {
|
|
854
908
|
clearTimeout(this.toggleErrorsPopperTimeout);
|
|
855
909
|
}
|
|
856
910
|
if (!this.isScrolling) {
|
|
857
911
|
setTimeout(function () {
|
|
858
|
-
var rowNode =
|
|
859
|
-
|
|
912
|
+
var rowNode = _this0.getNodeFromSelection();
|
|
913
|
+
_this0.toggleErrorsPopper('keyboardLineIndex', rowNode, timer);
|
|
860
914
|
}, 0);
|
|
861
915
|
} else {
|
|
862
916
|
this.toggleErrorsPopperTimeout = window.setTimeout(function () {
|
|
863
|
-
|
|
917
|
+
_this0.toggleErrorsPopperByKeyboard(timer);
|
|
864
918
|
}, 50);
|
|
865
919
|
}
|
|
866
920
|
}
|
|
867
921
|
}, {
|
|
868
922
|
key: "toggleErrorsPopper",
|
|
869
923
|
value: function toggleErrorsPopper(key, target, timer) {
|
|
870
|
-
var
|
|
924
|
+
var _this1 = this;
|
|
871
925
|
if (target instanceof HTMLDivElement || target instanceof HTMLParagraphElement) {
|
|
872
926
|
if (this.changeTriggerTimeout) {
|
|
873
927
|
clearTimeout(this.changeTriggerTimeout);
|
|
874
928
|
}
|
|
875
929
|
this.changeTriggerTimeout = window.setTimeout(function () {
|
|
876
|
-
var targetElement = target ===
|
|
930
|
+
var targetElement = target === _this1.textarea ? _this1.getNodeFromSelection() : target;
|
|
877
931
|
var lineIndex = -1;
|
|
878
932
|
var isInvalidRow = false;
|
|
879
933
|
if (targetElement instanceof HTMLParagraphElement) {
|
|
880
934
|
isInvalidRow = targetElement.getAttribute('aria-invalid') === 'true';
|
|
881
|
-
lineIndex = Array.from(
|
|
882
|
-
} else if (targetElement ===
|
|
935
|
+
lineIndex = Array.from(_this1.textarea.childNodes).indexOf(targetElement);
|
|
936
|
+
} else if (targetElement === _this1.textarea) {
|
|
883
937
|
lineIndex = 0;
|
|
884
938
|
}
|
|
885
939
|
if (targetElement instanceof HTMLElement) {
|
|
886
|
-
|
|
940
|
+
_this1.setState(function (prevState) {
|
|
887
941
|
var newState = {
|
|
888
|
-
visibleErrorPopper:
|
|
942
|
+
visibleErrorPopper: _this1.isFocusing && Boolean(_this1.asProps.commonErrorMessage) ? true : isInvalidRow,
|
|
889
943
|
mouseLineIndex: prevState.mouseLineIndex,
|
|
890
944
|
keyboardLineIndex: prevState.keyboardLineIndex
|
|
891
945
|
};
|
|
892
|
-
if (
|
|
946
|
+
if (_this1.isFocusing || key === 'mouseLineIndex' && isInvalidRow) {
|
|
893
947
|
newState[key] = lineIndex;
|
|
894
948
|
}
|
|
895
949
|
return newState;
|
|
896
950
|
}, function () {
|
|
897
|
-
|
|
898
|
-
var trigger = isInvalidRow ? targetElement :
|
|
899
|
-
if (
|
|
900
|
-
var
|
|
901
|
-
(
|
|
902
|
-
|
|
951
|
+
_this1.errorByInteraction = key === 'mouseLineIndex' ? 'mouse' : 'keyboard';
|
|
952
|
+
var trigger = isInvalidRow ? targetElement : _this1.textarea;
|
|
953
|
+
if (_this1.shouldChangePopperTrigger(trigger)) {
|
|
954
|
+
var _this1$setPopperTrigg;
|
|
955
|
+
(_this1$setPopperTrigg = _this1.setPopperTrigger) === null || _this1$setPopperTrigg === void 0 || _this1$setPopperTrigg.call(_this1, trigger);
|
|
956
|
+
_this1.forceUpdate();
|
|
903
957
|
}
|
|
904
958
|
});
|
|
905
959
|
}
|
|
@@ -925,7 +979,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
925
979
|
key: "handleChangeErrorIndex",
|
|
926
980
|
value: function handleChangeErrorIndex(errorIndex) {
|
|
927
981
|
var _error$lineNode,
|
|
928
|
-
|
|
982
|
+
_this10 = this;
|
|
929
983
|
var error = this.asProps.errors[errorIndex];
|
|
930
984
|
var childNodes = this.textarea.childNodes;
|
|
931
985
|
var node = error ? (_error$lineNode = error.lineNode) !== null && _error$lineNode !== void 0 ? _error$lineNode : childNodes.item(error.lineIndex) : null;
|
|
@@ -937,9 +991,9 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
937
991
|
setTimeout(function () {
|
|
938
992
|
var text = node.childNodes.item(0);
|
|
939
993
|
if (text instanceof Text) {
|
|
940
|
-
|
|
994
|
+
_this10.setSelection(text, 0, text.length);
|
|
941
995
|
} else {
|
|
942
|
-
|
|
996
|
+
_this10.setSelection(node, 0, 1);
|
|
943
997
|
}
|
|
944
998
|
}, 150);
|
|
945
999
|
}
|
|
@@ -972,8 +1026,8 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
972
1026
|
var range = document.createRange();
|
|
973
1027
|
range.setStart(node, start);
|
|
974
1028
|
range.setEnd(node, end);
|
|
975
|
-
selection === null || selection === void 0
|
|
976
|
-
selection === null || selection === void 0
|
|
1029
|
+
selection === null || selection === void 0 || selection.removeAllRanges();
|
|
1030
|
+
selection === null || selection === void 0 || selection.addRange(range);
|
|
977
1031
|
var nodeToScroll = node instanceof Text ? node.parentNode : node;
|
|
978
1032
|
if (nodeToScroll instanceof HTMLElement) {
|
|
979
1033
|
nodeToScroll.scrollIntoView({
|
|
@@ -1120,9 +1174,7 @@ var InputField = /*#__PURE__*/function (_Component) {
|
|
|
1120
1174
|
return null;
|
|
1121
1175
|
}
|
|
1122
1176
|
}]);
|
|
1123
|
-
return InputField;
|
|
1124
1177
|
}(_core.Component);
|
|
1125
|
-
exports.InputField = InputField;
|
|
1126
1178
|
(0, _defineProperty2["default"])(InputField, "displayName", 'Textarea');
|
|
1127
1179
|
(0, _defineProperty2["default"])(InputField, "style", style);
|
|
1128
1180
|
(0, _defineProperty2["default"])(InputField, "enhance", [(0, _uniqueID["default"])()]);
|