intergalactic 15.127.0 → 15.128.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 +29 -0
- package/add-filter/package.json +1 -1
- package/bulk-textarea/BulkTextarea.d.ts +1 -1
- package/bulk-textarea/BulkTextarea.types.d.ts +23 -21
- package/bulk-textarea/components/InputField/InputField.d.ts +4 -4
- package/bulk-textarea/components/InputField/InputField.types.d.ts +4 -4
- package/bulk-textarea/lib/cjs/BulkTextarea.js +10 -8
- package/bulk-textarea/lib/cjs/BulkTextarea.js.map +1 -1
- package/bulk-textarea/lib/cjs/BulkTextarea.types.js.map +1 -1
- package/bulk-textarea/lib/cjs/components/InputField/InputField.js +39 -26
- package/bulk-textarea/lib/cjs/components/InputField/InputField.js.map +1 -1
- package/bulk-textarea/lib/cjs/components/InputField/InputField.types.js.map +1 -1
- package/bulk-textarea/lib/cjs/components/InputField/inputField.shadow.css +17 -7
- package/bulk-textarea/lib/es6/BulkTextarea.js +10 -8
- package/bulk-textarea/lib/es6/BulkTextarea.js.map +1 -1
- package/bulk-textarea/lib/es6/BulkTextarea.types.js.map +1 -1
- package/bulk-textarea/lib/es6/components/InputField/InputField.js +39 -26
- package/bulk-textarea/lib/es6/components/InputField/InputField.js.map +1 -1
- package/bulk-textarea/lib/es6/components/InputField/InputField.types.js.map +1 -1
- package/bulk-textarea/lib/es6/components/InputField/inputField.shadow.css +17 -7
- package/bulk-textarea/lib/esm/BulkTextarea.mjs +53 -50
- package/bulk-textarea/lib/esm/components/InputField/InputField.mjs +273 -259
- package/bulk-textarea/lib/types/BulkTextarea.d.ts +1 -1
- package/bulk-textarea/lib/types/BulkTextarea.types.d.ts +23 -21
- package/bulk-textarea/lib/types/components/InputField/InputField.d.ts +4 -4
- package/bulk-textarea/lib/types/components/InputField/InputField.types.d.ts +4 -4
- package/bulk-textarea/package.json +1 -1
- package/components.json +14 -14
- package/errors/lib/cjs/Error.js +9 -9
- package/errors/lib/es6/Error.js +9 -9
- package/errors/lib/esm/Error.mjs +40 -40
- package/errors/package.json +1 -1
- package/feedback-form/lib/cjs/FeedbackForm.js +7 -7
- package/feedback-form/lib/cjs/component/checkbox-button/CheckboxButton.js +3 -3
- package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js +10 -4
- package/feedback-form/lib/cjs/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js +18 -14
- package/feedback-form/lib/cjs/component/slider-rating/SliderRating.js.map +1 -1
- package/feedback-form/lib/cjs/style/slider-rating.shadow.css +1 -3
- package/feedback-form/lib/es6/FeedbackForm.js +7 -7
- package/feedback-form/lib/es6/component/checkbox-button/CheckboxButton.js +3 -3
- package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js +10 -4
- package/feedback-form/lib/es6/component/feedback-rating/FeedbackRating.js.map +1 -1
- package/feedback-form/lib/es6/component/slider-rating/SliderRating.js +18 -14
- package/feedback-form/lib/es6/component/slider-rating/SliderRating.js.map +1 -1
- package/feedback-form/lib/es6/style/slider-rating.shadow.css +1 -3
- package/feedback-form/lib/esm/FeedbackForm.mjs +39 -39
- package/feedback-form/lib/esm/component/checkbox-button/CheckboxButton.mjs +13 -13
- package/feedback-form/lib/esm/component/feedback-rating/FeedbackRating.mjs +85 -81
- package/feedback-form/lib/esm/component/slider-rating/SliderRating.mjs +83 -79
- package/feedback-form/package.json +1 -1
- package/illustration/lib/cjs/index.js +1 -1
- package/illustration/lib/es6/index.js +1 -1
- package/illustration/package.json +1 -1
- package/modal/lib/cjs/Modal.js +8 -8
- package/modal/lib/es6/Modal.js +8 -8
- package/modal/lib/esm/Modal.mjs +73 -73
- package/modal/package.json +1 -1
- package/outside-click/lib/cjs/OutsideClick.js +14 -7
- package/outside-click/lib/cjs/OutsideClick.js.map +1 -1
- package/outside-click/lib/es6/OutsideClick.js +14 -7
- package/outside-click/lib/es6/OutsideClick.js.map +1 -1
- package/outside-click/lib/esm/OutsideClick.mjs +39 -35
- package/outside-click/package.json +1 -1
- package/package.json +1 -1
- package/popper/lib/cjs/Popper.js +6 -6
- package/popper/lib/es6/Popper.js +6 -6
- package/popper/lib/esm/Popper.mjs +25 -25
- package/popper/package.json +1 -1
- package/select/lib/cjs/InputSearch.js +15 -19
- package/select/lib/cjs/InputSearch.js.map +1 -1
- package/select/lib/cjs/Select.js +8 -8
- package/select/lib/es6/InputSearch.js +15 -19
- package/select/lib/es6/InputSearch.js.map +1 -1
- package/select/lib/es6/Select.js +8 -8
- package/select/lib/esm/InputSearch.mjs +63 -65
- package/select/lib/esm/Select.mjs +122 -122
- package/select/package.json +1 -1
- package/side-panel/lib/cjs/SidePanel.js +16 -16
- package/side-panel/lib/es6/SidePanel.js +16 -16
- package/side-panel/lib/esm/SidePanel.mjs +77 -77
- package/side-panel/package.json +1 -1
- package/time-picker/lib/cjs/TimePicker.js +12 -12
- package/time-picker/lib/es6/TimePicker.js +12 -12
- package/time-picker/lib/esm/TimePicker.mjs +38 -38
- package/time-picker/package.json +1 -1
- package/tooltip/lib/cjs/Tooltip.js +9 -9
- package/tooltip/lib/es6/Tooltip.js +9 -9
- package/tooltip/lib/esm/Tooltip.mjs +103 -103
- package/tooltip/package.json +1 -1
- package/widget-empty/lib/cjs/WidgetEmpty.js +5 -5
- package/widget-empty/lib/es6/WidgetEmpty.js +5 -5
- package/widget-empty/lib/esm/WidgetEmpty.mjs +32 -32
- package/widget-empty/package.json +1 -1
- package/wizard/lib/cjs/Wizard.js +12 -12
- package/wizard/lib/es6/Wizard.js +12 -12
- package/wizard/lib/esm/Wizard.mjs +103 -103
- package/wizard/package.json +1 -1
@@ -1,52 +1,52 @@
|
|
1
1
|
import ae from "@babel/runtime/helpers/esm/objectSpread2";
|
2
2
|
import ne from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
3
|
-
import
|
3
|
+
import W from "@babel/runtime/helpers/esm/toConsumableArray";
|
4
4
|
import le from "@babel/runtime/helpers/esm/classCallCheck";
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
5
|
+
import oe from "@babel/runtime/helpers/esm/createClass";
|
6
|
+
import x from "@babel/runtime/helpers/esm/assertThisInitialized";
|
7
|
+
import se from "@babel/runtime/helpers/esm/inherits";
|
8
8
|
import de from "@babel/runtime/helpers/esm/createSuper";
|
9
|
-
import
|
9
|
+
import E from "@babel/runtime/helpers/esm/defineProperty";
|
10
10
|
import { sstyled as ve } from 'intergalactic/utils/lib/core/index';
|
11
11
|
import { sstyled as ue, assignProps as he, Component as ce } from 'intergalactic/core';
|
12
|
-
import
|
12
|
+
import O from "react";
|
13
13
|
import { Box as ge } from 'intergalactic/flex-box';
|
14
|
-
import
|
15
|
-
import { extractAriaProps as
|
14
|
+
import $ from 'intergalactic/tooltip';
|
15
|
+
import { extractAriaProps as ee } from 'intergalactic/utils/lib/ariaProps';
|
16
16
|
import pe from 'intergalactic/utils/lib/uniqueID';
|
17
17
|
import fe from "dompurify";
|
18
18
|
var me = (
|
19
19
|
/*__reshadow_css_start__*/
|
20
20
|
(ve.insert(
|
21
21
|
/*__inner_css_start__*/
|
22
|
-
'.
|
23
|
-
"
|
22
|
+
'.___SInputField_pt9l8_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_pt9l8_gg_>div:empty::before{content:"1. "attr(placeholder);color:var(--intergalactic-text-placeholder, #8a8e9b);position:absolute}.___SInputField_pt9l8_gg_>div:nth-child(even){color:red;counter-increment:row;margin-bottom:var(--intergalactic-spacing-1x, 4px);position:relative;word-break:break-all}.___SInputField_pt9l8_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_pt9l8_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_pt9l8_gg_>div>p:last-of-type{margin-bottom:0}.___SInputField_pt9l8_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_pt9l8_gg_>div>p[data-over-max-rows=true]{background-color:var(--intergalactic-bg-secondary-critical, #fff0f7)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+10))>p{padding-left:var(--intergalactic-spacing-6x, 24px)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+10))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+100))>p{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+100))>p:nth-child(-n+9)::before{padding-left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+10)::before{padding-left:var(--intergalactic-spacing-2x, 8px)}.___SInputField_pt9l8_gg_>div:has(p:nth-child(n+100))>p:nth-child(n+100)::before{padding-left:0}.___SInputField_pt9l8_gg_.__showErrors_pt9l8_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_pt9l8_gg_._size_m_pt9l8_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_pt9l8)*20px);max-height:calc((var(--maxRows_pt9l8) - 1)*(20px + var(--intergalactic-spacing-1x, 4px)) + 18px)}.___SInputField_pt9l8_gg_._size_m_pt9l8_gg_>div:empty{padding-left:var(--intergalactic-spacing-8x, 32px)}.___SInputField_pt9l8_gg_._size_l_pt9l8_gg_>div:empty::before,.___SInputField_pt9l8_gg_._size_m_pt9l8_gg_>div:empty::before{left:var(--intergalactic-spacing-4x, 16px)}.___SInputField_pt9l8_gg_._size_l_pt9l8_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_pt9l8)*24px);max-height:calc((var(--maxRows_pt9l8) - 1)*(24px + var(--intergalactic-spacing-1x, 4px)) + 20px)}.___SInputField_pt9l8_gg_._size_l_pt9l8_gg_>div:empty{padding-left:calc(var(--intergalactic-spacing-8x, 32px) + var(--intergalactic-spacing-05x, 2px))}.___SInputField_pt9l8_gg_._state_normal_pt9l8_gg_:not(.__disabled_pt9l8_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_pt9l8_gg_._state_valid_pt9l8_gg_>div{border-color:var(--intergalactic-border-success-active, #007c65)}.___SInputField_pt9l8_gg_._state_valid_pt9l8_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-valid, 0px 0px 0px 3px rgba(0, 159, 129, 0.5))}.___SInputField_pt9l8_gg_._state_invalid_pt9l8_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_pt9l8_gg_._state_invalid_pt9l8_gg_>div:focus{box-shadow:var(--intergalactic-keyboard-focus-invalid, 0px 0px 0px 3px rgba(255, 73, 83, 0.5))}.___SInputField_pt9l8_gg_.__readonly_pt9l8_gg_>div{background-color:var(--intergalactic-bg-secondary-neutral, #f4f5f9)}.___SInputField_pt9l8_gg_.__disabled_pt9l8_gg_>div{opacity:var(--intergalactic-disabled-opacity, 0.3)}',
|
23
|
+
"pt9l8_gg_"
|
24
24
|
), {
|
25
|
-
__SInputField: "
|
26
|
-
_showErrors: "
|
27
|
-
_readonly: "
|
28
|
-
_disabled: "
|
29
|
-
_size_m: "
|
30
|
-
"--minRows": "--
|
31
|
-
"--maxRows": "--
|
32
|
-
_size_l: "
|
33
|
-
_state_normal: "
|
34
|
-
_state_valid: "
|
35
|
-
_state_invalid: "
|
25
|
+
__SInputField: "___SInputField_pt9l8_gg_",
|
26
|
+
_showErrors: "__showErrors_pt9l8_gg_",
|
27
|
+
_readonly: "__readonly_pt9l8_gg_",
|
28
|
+
_disabled: "__disabled_pt9l8_gg_",
|
29
|
+
_size_m: "_size_m_pt9l8_gg_",
|
30
|
+
"--minRows": "--minRows_pt9l8",
|
31
|
+
"--maxRows": "--maxRows_pt9l8",
|
32
|
+
_size_l: "_size_l_pt9l8_gg_",
|
33
|
+
_state_normal: "_state_normal_pt9l8_gg_",
|
34
|
+
_state_valid: "_state_valid_pt9l8_gg_",
|
35
|
+
_state_invalid: "_state_invalid_pt9l8_gg_"
|
36
36
|
})
|
37
|
-
),
|
38
|
-
|
39
|
-
var ie = de(
|
40
|
-
function
|
37
|
+
), Y = /* @__PURE__ */ function(te) {
|
38
|
+
se(K, te);
|
39
|
+
var ie = de(K);
|
40
|
+
function K(o) {
|
41
41
|
var e;
|
42
|
-
return le(this,
|
43
|
-
`),
|
42
|
+
return le(this, K), e = ie.call(this, o), E(x(e), "delimiter", `
|
43
|
+
`), E(x(e), "skipEmptyLines", !0), E(x(e), "emptyLineValue", ""), E(x(e), "spaceLineValue", " "), E(x(e), "containerRef", /* @__PURE__ */ O.createRef()), E(x(e), "textarea", void 0), E(x(e), "popper", null), E(x(e), "setPopperTrigger", null), E(x(e), "errorByInteraction", null), E(x(e), "changeTriggerTimeout", 0), E(x(e), "isScrolling", !1), E(x(e), "scrollingTimeout", 0), E(x(e), "toggleErrorsPopperTimeout", 0), E(x(e), "isFocusing", !1), E(x(e), "linesCountTimeout", 0), E(x(e), "state", {
|
44
44
|
visibleErrorPopper: !1,
|
45
45
|
keyboardLineIndex: -1,
|
46
46
|
mouseLineIndex: -1
|
47
|
-
}), e.handlePaste = e.handlePaste.bind(
|
47
|
+
}), e.handlePaste = e.handlePaste.bind(x(e)), e.handleChange = e.handleChange.bind(x(e)), e.handleFocus = e.handleFocus.bind(x(e)), e.handleBlur = e.handleBlur.bind(x(e)), e.handleKeyDown = e.handleKeyDown.bind(x(e)), e.handleMouseDown = e.handleMouseDown.bind(x(e)), e.handleMouseMove = e.handleMouseMove.bind(x(e)), e.handleMouseLeave = e.handleMouseLeave.bind(x(e)), e.handleScroll = e.handleScroll.bind(x(e)), e.handleSelectAll = e.handleSelectAll.bind(x(e)), e.textarea = e.createContentEditableElement(o), e;
|
48
48
|
}
|
49
|
-
return
|
49
|
+
return oe(K, [{
|
50
50
|
key: "uncontrolledProps",
|
51
51
|
value: function() {
|
52
52
|
return {
|
@@ -63,19 +63,23 @@ var me = (
|
|
63
63
|
}
|
64
64
|
}, {
|
65
65
|
key: "componentDidUpdate",
|
66
|
-
value: function(e,
|
67
|
-
var r = this,
|
68
|
-
e.value !== a
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
66
|
+
value: function(e, t) {
|
67
|
+
var r = this, i = this.props, a = i.value, n = i.errors, l = i.errorIndex, d = i.showErrors, g = i.disabled, b = i.readonly, c = i.highlightErrorIndex, u = i.lineProcessing, s = i["aria-describedby"], y = s === void 0 ? "" : s;
|
68
|
+
if (e.value !== a) {
|
69
|
+
var v = this.getValues().join(this.delimiter);
|
70
|
+
(typeof a == "string" ? a !== v : a.join(this.delimiter) !== v) && this.handleValueOutChange();
|
71
|
+
}
|
72
|
+
(e.showErrors !== d || e.errors.length !== n.length) && (this.toggleAriaInvalid(d, n.length), d === !1 && this.textarea.setAttribute("aria-describedby", y)), e.errorIndex !== l && c && this.handleChangeErrorIndex(l), (e.disabled !== g || e.readonly !== b) && (this.isDisabled ? (this.textarea.setAttribute("contenteditable", "false"), this.removeEventListeners(this.textarea)) : (this.textarea.setAttribute("contenteditable", "true"), this.addEventListeners(this.textarea)), g ? this.textarea.setAttribute("tabindex", "-1") : this.textarea.setAttribute("tabindex", "0"));
|
73
|
+
var p = this.state.keyboardLineIndex;
|
74
|
+
if (t.keyboardLineIndex !== -1 && t.keyboardLineIndex !== p) {
|
75
|
+
if (u) {
|
76
|
+
var f, I = this.getValues(), L = u((f = I[t.keyboardLineIndex]) !== null && f !== void 0 ? f : "", I), k = document.createTextNode(L), M = this.textarea.childNodes.item(t.keyboardLineIndex);
|
77
|
+
M instanceof HTMLParagraphElement && (L === "" ? M.innerHTML = this.emptyLineValue : M.replaceChild(k, M.childNodes.item(0))), this.validateLine(M), setTimeout(function() {
|
78
|
+
var P = r.textarea.childNodes.item(p);
|
79
|
+
P && r.setErrorIndex(P);
|
76
80
|
}, 0);
|
77
81
|
}
|
78
|
-
d || this.recalculateErrors(), this.recalculateLinesCount(), this.asProps.onChangeLineIndex(
|
82
|
+
d || this.recalculateErrors(), this.recalculateLinesCount(), this.asProps.onChangeLineIndex(p);
|
79
83
|
}
|
80
84
|
}
|
81
85
|
}, {
|
@@ -86,8 +90,8 @@ var me = (
|
|
86
90
|
}, {
|
87
91
|
key: "isDisabled",
|
88
92
|
get: function() {
|
89
|
-
var e = this.asProps,
|
90
|
-
return !!(
|
93
|
+
var e = this.asProps, t = e.disabled, r = e.readonly;
|
94
|
+
return !!(t || r);
|
91
95
|
}
|
92
96
|
}, {
|
93
97
|
key: "popperDescribedId",
|
@@ -98,37 +102,37 @@ var me = (
|
|
98
102
|
}, {
|
99
103
|
key: "errorMessage",
|
100
104
|
get: function() {
|
101
|
-
var e,
|
102
|
-
|
103
|
-
return (
|
105
|
+
var e, t, r, i = this.asProps, a = i.errors, n = i.errorIndex, l = i.commonErrorMessage, d = i.prevError, g = this.state, b = g.mouseLineIndex, c = g.keyboardLineIndex, u = this.errorByInteraction === "keyboard" ? c : this.errorByInteraction === "mouse" ? b : -1, s = a[n];
|
106
|
+
u !== -1 && (s = a.find(function(p) {
|
107
|
+
return (p == null ? void 0 : p.lineIndex) === u;
|
104
108
|
}));
|
105
|
-
var
|
109
|
+
var y = a.length === 0 && !d ? null : (e = (t = s) === null || t === void 0 ? void 0 : t.errorMessage) !== null && e !== void 0 ? e : l === "" || a.length === 0 ? d == null ? void 0 : d.errorMessage : l, v = !((r = s) !== null && r !== void 0 && r.errorMessage) && (l === "" || a.length === 0 ? !(d != null && d.errorMessage) : !0);
|
106
110
|
return {
|
107
|
-
errorMessage:
|
108
|
-
isCommonError:
|
111
|
+
errorMessage: y,
|
112
|
+
isCommonError: v
|
109
113
|
};
|
110
114
|
}
|
111
115
|
}, {
|
112
116
|
key: "createContentEditableElement",
|
113
117
|
value: function(e) {
|
114
|
-
var
|
115
|
-
|
116
|
-
var r =
|
117
|
-
for (var a in
|
118
|
+
var t = document.createElement("div");
|
119
|
+
t.setAttribute("contentEditable", e.disabled || e.readonly ? "false" : "true"), t.setAttribute("role", "textbox"), t.setAttribute("classname", "editable"), e.id && t.setAttribute("id", e.id), e.placeholder && t.setAttribute("placeholder", e.placeholder);
|
120
|
+
var r = ee(e), i = r.extractedAriaProps;
|
121
|
+
for (var a in i) {
|
118
122
|
var n = e[a];
|
119
|
-
n &&
|
123
|
+
n && t.setAttribute(a, n);
|
120
124
|
}
|
121
|
-
return e.disabled ?
|
125
|
+
return e.disabled ? t.setAttribute("tabIndex", "-1") : t.setAttribute("tabIndex", "0"), !e.disabled && !e.readonly ? this.addEventListeners(t) : t.addEventListener("keydown", this.handleSelectAll.bind(this)), t;
|
122
126
|
}
|
123
127
|
}, {
|
124
128
|
key: "handleValueOutChange",
|
125
129
|
value: function() {
|
126
|
-
var e = this.props,
|
127
|
-
if (
|
130
|
+
var e = this.props, t = e.value, r = e.onChangeLinesCount;
|
131
|
+
if (t === "")
|
128
132
|
this.textarea.textContent = "", r(0);
|
129
133
|
else {
|
130
|
-
var
|
131
|
-
(
|
134
|
+
var i, a = this.prepareNodesForPaste(t);
|
135
|
+
(i = this.textarea).replaceChildren.apply(i, W(a)), this.recalculateLinesCount(), this.recalculateErrors();
|
132
136
|
}
|
133
137
|
}
|
134
138
|
}, {
|
@@ -142,16 +146,15 @@ var me = (
|
|
142
146
|
}, {
|
143
147
|
key: "handleMouseDown",
|
144
148
|
value: function(e) {
|
145
|
-
|
146
|
-
|
147
|
-
i instanceof HTMLElement && (this.toggleErrorsPopper("keyboardLineIndex", i), this.setErrorIndex(i));
|
149
|
+
var t = e.target;
|
150
|
+
t instanceof HTMLElement && (this.toggleErrorsPopper("keyboardLineIndex", t), this.setErrorIndex(t));
|
148
151
|
}
|
149
152
|
}, {
|
150
153
|
key: "handleMouseMove",
|
151
154
|
value: function(e) {
|
152
155
|
this.errorByInteraction = "mouse";
|
153
|
-
var
|
154
|
-
|
156
|
+
var t = e.target;
|
157
|
+
t !== this.textarea && (this.isFocusing || t instanceof HTMLElement && t.getAttribute("aria-invalid") === "true" ? this.toggleErrorsPopper("mouseLineIndex", t) : this.setState({
|
155
158
|
visibleErrorPopper: !1
|
156
159
|
}));
|
157
160
|
}
|
@@ -160,8 +163,8 @@ var me = (
|
|
160
163
|
value: function(e) {
|
161
164
|
if (this.changeTriggerTimeout && clearTimeout(this.changeTriggerTimeout), this.isFocusing) {
|
162
165
|
this.errorByInteraction = "keyboard";
|
163
|
-
var
|
164
|
-
this.toggleErrorsPopper("keyboardLineIndex",
|
166
|
+
var t = this.getNodeFromSelection();
|
167
|
+
this.toggleErrorsPopper("keyboardLineIndex", t, 0), this.setState({
|
165
168
|
mouseLineIndex: -1
|
166
169
|
});
|
167
170
|
} else
|
@@ -172,85 +175,88 @@ var me = (
|
|
172
175
|
}, {
|
173
176
|
key: "handlePaste",
|
174
177
|
value: function(e) {
|
175
|
-
var
|
178
|
+
var t;
|
176
179
|
e.preventDefault();
|
177
|
-
var r = this.asProps.validateOn,
|
178
|
-
if (
|
179
|
-
var
|
180
|
-
if (
|
181
|
-
var b, I;
|
182
|
-
(
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
var
|
191
|
-
|
180
|
+
var r = this.asProps.validateOn, i = (t = e.clipboardData) === null || t === void 0 ? void 0 : t.getData("text/plain"), a = i ? this.prepareNodesForPaste(i) : [];
|
181
|
+
if (a.length !== 0) {
|
182
|
+
var n = document.getSelection();
|
183
|
+
if (n != null && n.anchorNode && n !== null && n !== void 0 && n.focusNode) {
|
184
|
+
var l = n.anchorOffset, d = n.focusOffset, g = n.anchorNode.compareDocumentPosition(n.focusNode), b = this.getSelectionDirection(), c = b === "forward" ? n.anchorNode : n.focusNode, u = b === "forward" ? n.focusNode : n.anchorNode, s = b === "forward" ? l : d, y = b === "forward" ? d : l, v = c instanceof Text ? c.parentElement : c, p = u instanceof Text ? u.parentElement : u, f = null, I = null;
|
185
|
+
if (u === this.textarea) {
|
186
|
+
var L, k;
|
187
|
+
(L = this.textarea).replaceChildren.apply(L, W(a));
|
188
|
+
var M = a[a.length - 1];
|
189
|
+
f = M.childNodes.item(0), I = ((k = M.textContent) !== null && k !== void 0 ? k : "").length;
|
190
|
+
} else if (p instanceof HTMLParagraphElement && v instanceof HTMLParagraphElement) {
|
191
|
+
var P, A, S, C, w, F = (P = v == null || (A = v.textContent) === null || A === void 0 ? void 0 : A.substring(0, s)) !== null && P !== void 0 ? P : "", D = (S = p == null || (C = p.textContent) === null || C === void 0 ? void 0 : C.substring(y)) !== null && S !== void 0 ? S : "", H = F.trim() === "" ? "" : F, h = D.trim() === "" ? "" : D;
|
192
|
+
n.deleteFromDocument(), g !== 0 && this.textarea.removeChild(p);
|
193
|
+
var T = a.splice(0, 1)[0], _ = a[a.length - 1];
|
194
|
+
if (v.textContent = (w = H + (T == null ? void 0 : T.textContent)) !== null && w !== void 0 ? w : "", v.after.apply(v, W(a)), _) {
|
195
|
+
var m, B;
|
196
|
+
_.textContent = ((m = _.textContent) !== null && m !== void 0 ? m : "") + h, f = _.childNodes.item(0), I = ((B = _.textContent) !== null && B !== void 0 ? B : "").length, this.validateLine(_), this.setErrorIndex(_);
|
197
|
+
} else {
|
198
|
+
var R, V;
|
199
|
+
I = ((R = v.textContent) !== null && R !== void 0 ? R : "").length, v.textContent = ((V = v.textContent) !== null && V !== void 0 ? V : "") + h, f = v.childNodes.item(0), this.validateLine(v), this.setErrorIndex(v);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
if (f instanceof Text) {
|
203
|
+
var j, z;
|
204
|
+
this.setSelection(f, (j = I) !== null && j !== void 0 ? j : 1, (z = I) !== null && z !== void 0 ? z : 1), this.toggleErrorsPopper("keyboardLineIndex", f.parentNode);
|
192
205
|
} else {
|
193
|
-
var
|
194
|
-
|
206
|
+
var Z;
|
207
|
+
console.warn("incorrect child type", f, (Z = f) === null || Z === void 0 ? void 0 : Z.parentNode);
|
195
208
|
}
|
196
209
|
}
|
197
|
-
|
198
|
-
var R, K;
|
199
|
-
this.setSelection(y, (R = L) !== null && R !== void 0 ? R : 1, (K = L) !== null && K !== void 0 ? K : 1), this.toggleErrorsPopper("keyboardLineIndex", y.parentNode);
|
200
|
-
} else {
|
201
|
-
var V;
|
202
|
-
console.warn("incorrect child type", y, (V = y) === null || V === void 0 ? void 0 : V.parentNode);
|
203
|
-
}
|
210
|
+
this.recalculateLinesCount(), (r.includes("paste") || this.asProps.showErrors) && this.recalculateErrors();
|
204
211
|
}
|
205
|
-
this.recalculateLinesCount(), (r.includes("paste") || this.asProps.showErrors) && this.recalculateErrors();
|
206
212
|
}
|
207
213
|
}, {
|
208
214
|
key: "handleChange",
|
209
215
|
value: function(e) {
|
210
|
-
var
|
211
|
-
if (
|
212
|
-
var r,
|
216
|
+
var t = e.target;
|
217
|
+
if (t instanceof HTMLDivElement && e instanceof InputEvent) {
|
218
|
+
var r, i = this.textarea.childNodes, a = i.item(0), n = i.item(1), l = document.getSelection();
|
213
219
|
if (a instanceof Text) {
|
214
|
-
var d, g = (d = a.textContent) !== null && d !== void 0 ? d : "",
|
215
|
-
|
216
|
-
} else !a || a instanceof HTMLBRElement &&
|
220
|
+
var d, g = (d = a.textContent) !== null && d !== void 0 ? d : "", b = document.createElement("p"), c = document.createTextNode(g);
|
221
|
+
b.append(c), a.replaceWith(b), l == null || l.setPosition(b, g.length);
|
222
|
+
} else !a || a instanceof HTMLBRElement && i.length === 1 ? (this.textarea.textContent = "", this.setState({
|
217
223
|
keyboardLineIndex: 0
|
218
|
-
})) : a instanceof HTMLParagraphElement && !((r = a.textContent) !== null && r !== void 0 && r.trim()) && (
|
224
|
+
})) : a instanceof HTMLParagraphElement && !((r = a.textContent) !== null && r !== void 0 && r.trim()) && (i.length <= 1 || n instanceof HTMLBRElement) && (this.textarea.textContent = "", this.setState({
|
219
225
|
keyboardLineIndex: 0
|
220
226
|
}));
|
221
|
-
for (var
|
222
|
-
var
|
223
|
-
|
227
|
+
for (var u = 10, s = l == null ? void 0 : l.focusNode; ((y = s) === null || y === void 0 ? void 0 : y.parentNode) !== this.textarea && u > 0; ) {
|
228
|
+
var y, v;
|
229
|
+
s = (v = s) === null || v === void 0 ? void 0 : v.parentNode, u--;
|
224
230
|
}
|
225
|
-
if (
|
226
|
-
var
|
227
|
-
if (
|
228
|
-
var
|
229
|
-
|
231
|
+
if (s instanceof HTMLParagraphElement) {
|
232
|
+
var p, f, I = s.childNodes, L = (p = s.textContent) !== null && p !== void 0 ? p : "";
|
233
|
+
if (I.length > 1) {
|
234
|
+
var k, M = (k = I.item(0).textContent) === null || k === void 0 ? void 0 : k.length;
|
235
|
+
s.textContent = L, M && this.setSelection(s.childNodes.item(0), M, M);
|
230
236
|
}
|
231
|
-
if (
|
232
|
-
var
|
233
|
-
if (
|
234
|
-
var
|
235
|
-
|
237
|
+
if (L.length > 0) {
|
238
|
+
var P = L.at(0), A = L.at(L.length - 1);
|
239
|
+
if (P === this.getEmptyParagraph().textContent || A === this.getEmptyParagraph().textContent) {
|
240
|
+
var S = null;
|
241
|
+
P === this.getEmptyParagraph().textContent ? (s.textContent = L.substring(1), S = e.inputType === "deleteContentBackward" || e.inputType === "deleteContentForward" ? 0 : s.textContent.length) : A === this.getEmptyParagraph().textContent && (s.textContent = L.substring(0, L.length - 1), S = s.textContent.length), S && this.setSelection(s.childNodes.item(0), S, S);
|
236
242
|
}
|
237
|
-
} else
|
238
|
-
var
|
239
|
-
this.recalculateErrors(), this.setErrorIndex(
|
240
|
-
var
|
241
|
-
if (
|
242
|
-
if (this.shouldChangePopperTrigger(
|
243
|
-
var
|
244
|
-
(
|
243
|
+
} else I.length === 1 && I[0] instanceof HTMLBRElement && (s.innerHTML = this.emptyLineValue);
|
244
|
+
var C = this.asProps, w = C.errors, F = C.showErrors, D = this.validateLine(s);
|
245
|
+
this.recalculateErrors(), this.setErrorIndex(s), !D && F && this.toggleErrorsPopper("keyboardLineIndex", s, 0);
|
246
|
+
var H = !D || D && w.length === 1 && w[0].lineNode === s ? s : this.textarea;
|
247
|
+
if (F && ((f = this.popper) === null || f === void 0 ? void 0 : f.current.state.elements.reference) !== H)
|
248
|
+
if (this.shouldChangePopperTrigger(H)) {
|
249
|
+
var h;
|
250
|
+
(h = this.setPopperTrigger) === null || h === void 0 || h.call(this, H);
|
245
251
|
} else
|
246
252
|
this.setState({
|
247
253
|
visibleErrorPopper: !1
|
248
254
|
});
|
249
|
-
} else if (
|
250
|
-
var
|
251
|
-
if ((
|
252
|
-
var _ = l.focusOffset,
|
253
|
-
this.textarea.removeChild(B),
|
255
|
+
} else if (s === null) {
|
256
|
+
var T;
|
257
|
+
if ((T = this.setPopperTrigger) === null || T === void 0 || T.call(this, this.textarea), (l == null ? void 0 : l.focusNode) === this.textarea && this.textarea.childNodes.length > 1) {
|
258
|
+
var _ = l.focusOffset, m = this.textarea.childNodes.item(_ - 1), B = this.textarea.childNodes.item(_);
|
259
|
+
this.textarea.removeChild(B), m instanceof HTMLParagraphElement && (m.innerHTML = this.emptyLineValue), m && this.setSelection(m, 0, 0);
|
254
260
|
} else
|
255
261
|
this.setSelection(this.textarea, 0, 0);
|
256
262
|
}
|
@@ -265,13 +271,15 @@ var me = (
|
|
265
271
|
}, {
|
266
272
|
key: "handleBlur",
|
267
273
|
value: function(e) {
|
268
|
-
var
|
274
|
+
var t = this;
|
269
275
|
this.isFocusing = !1, this.setState({
|
270
276
|
visibleErrorPopper: !1
|
271
277
|
});
|
272
|
-
var r = this.asProps,
|
273
|
-
|
274
|
-
|
278
|
+
var r = this.asProps, i = r.validateOn, a = r.onBlur, n = r.value;
|
279
|
+
i.includes("blur") && this.recalculateErrors();
|
280
|
+
var l = typeof n == "string" ? this.getValues().join(this.delimiter) : this.getValues();
|
281
|
+
a(l, e), setTimeout(function() {
|
282
|
+
t.setState({
|
275
283
|
keyboardLineIndex: -1
|
276
284
|
});
|
277
285
|
}, 200);
|
@@ -279,82 +287,82 @@ var me = (
|
|
279
287
|
}, {
|
280
288
|
key: "handleKeyDown",
|
281
289
|
value: function(e) {
|
282
|
-
var
|
290
|
+
var t = this;
|
283
291
|
this.errorByInteraction = "keyboard";
|
284
|
-
var r = this.asProps.linesDelimiters,
|
292
|
+
var r = this.asProps.linesDelimiters, i = this.getNodeFromSelection();
|
285
293
|
if (e.key === "Enter" || r != null && r.includes(e.key)) {
|
286
|
-
if (
|
287
|
-
var a, n = (a =
|
294
|
+
if (i === this.textarea && e.preventDefault(), i instanceof HTMLParagraphElement) {
|
295
|
+
var a, n = (a = i.textContent) === null || a === void 0 ? void 0 : a.trim();
|
288
296
|
if (!n)
|
289
297
|
e.preventDefault();
|
290
298
|
else {
|
291
|
-
var l, d, g,
|
299
|
+
var l, d, g, b;
|
292
300
|
e.preventDefault();
|
293
|
-
var
|
294
|
-
if (
|
295
|
-
var
|
296
|
-
|
301
|
+
var c = document.getSelection(), u = (c == null ? void 0 : c.focusNode) instanceof Text ? c.focusNode : c == null || (l = c.focusNode) === null || l === void 0 ? void 0 : l.childNodes.item(0), s = c == null ? void 0 : c.focusOffset, y = "";
|
302
|
+
if (u instanceof Text && s !== void 0 && s !== ((d = u.textContent) === null || d === void 0 ? void 0 : d.length)) {
|
303
|
+
var v, p;
|
304
|
+
y = (v = (p = u.textContent) === null || p === void 0 ? void 0 : p.substring(s)) !== null && v !== void 0 ? v : this.emptyLineValue, u.textContent && (u.textContent = u.textContent.substring(0, s));
|
297
305
|
}
|
298
|
-
((g =
|
299
|
-
var
|
300
|
-
|
301
|
-
|
306
|
+
((g = i.textContent) === null || g === void 0 ? void 0 : g.trim()) === "" && (i.innerHTML = this.emptyLineValue);
|
307
|
+
var f = document.createElement("p");
|
308
|
+
y ? f.textContent = y : f.innerHTML = this.emptyLineValue, i.after(f), this.setSelection(f, 0, 0), this.validateLine(i), this.validateLine(f), i.previousSibling && this.validateLine(i.previousSibling), this.setErrorIndex(f), ((b = f.textContent) === null || b === void 0 ? void 0 : b.trim()) !== "" && this.recalculateLinesCount(), setTimeout(function() {
|
309
|
+
t.recalculateErrors();
|
302
310
|
}, 0), this.toggleErrorsPopperByKeyboard(0);
|
303
311
|
}
|
304
312
|
}
|
305
313
|
} else if (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "ArrowLeft" || e.key === "ArrowRight")
|
306
|
-
|
307
|
-
else if (this.isDeleteKey(e) &&
|
308
|
-
var
|
309
|
-
if (((
|
310
|
-
var
|
311
|
-
if (
|
312
|
-
var
|
313
|
-
if (e.preventDefault(), this.textarea.removeChild(
|
314
|
+
i instanceof HTMLParagraphElement && this.handleCursorMovement(i, e), this.toggleErrorsPopperByKeyboard(200);
|
315
|
+
else if (this.isDeleteKey(e) && i instanceof HTMLParagraphElement) {
|
316
|
+
var I;
|
317
|
+
if (((I = i.textContent) === null || I === void 0 ? void 0 : I.trim()) === "" && !this.isRangeSelection()) {
|
318
|
+
var L = i.previousSibling;
|
319
|
+
if (L instanceof HTMLParagraphElement) {
|
320
|
+
var k;
|
321
|
+
if (e.preventDefault(), this.textarea.removeChild(i), this.toggleErrorsPopperByKeyboard(0), ((k = L.textContent) === null || k === void 0 ? void 0 : k.trim()) === "" && L.previousSibling === null && this.textarea.childNodes.length === 1)
|
314
322
|
this.textarea.textContent = "", this.setSelection(this.textarea, 0, 0);
|
315
|
-
else if (
|
316
|
-
var M,
|
317
|
-
this.setSelection(
|
323
|
+
else if (L instanceof HTMLParagraphElement) {
|
324
|
+
var M, P, A = L.childNodes.item(0), S = (M = (P = A.textContent) === null || P === void 0 ? void 0 : P.length) !== null && M !== void 0 ? M : 0;
|
325
|
+
this.setSelection(A, S, S);
|
318
326
|
} else
|
319
|
-
console.warn("incorrect prevNode type",
|
327
|
+
console.warn("incorrect prevNode type", L);
|
320
328
|
setTimeout(function() {
|
321
|
-
|
329
|
+
t.recalculateErrors();
|
322
330
|
}, 0), this.toggleErrorsPopperByKeyboard(0);
|
323
331
|
}
|
324
332
|
} else if (this.isRangeSelection()) {
|
325
|
-
var
|
326
|
-
if (_ ===
|
333
|
+
var C, w, F, D, H, h = document.getSelection(), T = this.getSelectionDirection(), _ = T === "backward" ? h == null ? void 0 : h.focusNode : h == null ? void 0 : h.anchorNode, m = T === "backward" ? h == null ? void 0 : h.anchorNode : h == null ? void 0 : h.focusNode, B = T === "backward" ? h == null ? void 0 : h.focusOffset : h == null ? void 0 : h.anchorOffset, R = T === "backward" ? h == null ? void 0 : h.anchorOffset : h == null ? void 0 : h.focusOffset;
|
334
|
+
if (_ === m && B === 0 && (m === i && R === 1 || R === ((C = i.textContent) === null || C === void 0 ? void 0 : C.length))) {
|
327
335
|
e.preventDefault();
|
328
|
-
var
|
329
|
-
|
330
|
-
|
336
|
+
var V = _ == null ? void 0 : _.parentElement, j = m == null ? void 0 : m.parentElement, z = this.textarea.childNodes;
|
337
|
+
V === z.item(0) && j === z.item(z.length - 1) ? (this.textarea.textContent = "", this.setSelection(this.textarea, 0, 0)) : (i.innerHTML = this.emptyLineValue, this.validateLine(i)), this.setErrorIndex(i), this.recalculateLinesCount(), setTimeout(function() {
|
338
|
+
t.recalculateErrors();
|
331
339
|
}, 0), this.toggleErrorsPopperByKeyboard(0);
|
332
|
-
} else if (
|
340
|
+
} else if (m !== _ && m instanceof Text && _ instanceof Text && (m == null ? void 0 : m.textContent) === (m == null || (w = m.parentNode) === null || w === void 0 ? void 0 : w.textContent) && (_ == null ? void 0 : _.textContent) === (_ == null || (F = _.parentNode) === null || F === void 0 ? void 0 : F.textContent) && B === 0 && R === (m == null || (D = m.parentNode) === null || D === void 0 || (H = D.textContent) === null || H === void 0 ? void 0 : H.length)) {
|
333
341
|
e.preventDefault();
|
334
|
-
var
|
335
|
-
if (
|
342
|
+
var Z = Array.from(this.textarea.children), Q = _.parentElement, U = m.parentElement, J = this.textarea.childNodes;
|
343
|
+
if (Q === J.item(0) && U === J.item(J.length - 1))
|
336
344
|
this.textarea.textContent = "", this.setSelection(this.textarea, 0, 0);
|
337
345
|
else {
|
338
|
-
var
|
346
|
+
var q = !1, G = ne(Z), N;
|
339
347
|
try {
|
340
|
-
for (
|
341
|
-
var
|
342
|
-
if (
|
343
|
-
if (
|
344
|
-
|
348
|
+
for (G.s(); !(N = G.n()).done; ) {
|
349
|
+
var X = N.value;
|
350
|
+
if (X === Q || q)
|
351
|
+
if (q = !0, X === U) {
|
352
|
+
U.innerHTML = this.emptyLineValue, this.setSelection(U, 0, 0);
|
345
353
|
break;
|
346
354
|
} else
|
347
|
-
this.textarea.removeChild(
|
355
|
+
this.textarea.removeChild(X);
|
348
356
|
}
|
349
357
|
} catch (re) {
|
350
|
-
|
358
|
+
G.e(re);
|
351
359
|
} finally {
|
352
|
-
|
360
|
+
G.f();
|
353
361
|
}
|
354
|
-
this.validateLine(
|
362
|
+
this.validateLine(i);
|
355
363
|
}
|
356
|
-
this.setErrorIndex(
|
357
|
-
|
364
|
+
this.setErrorIndex(i), this.recalculateLinesCount(), setTimeout(function() {
|
365
|
+
t.recalculateErrors();
|
358
366
|
}, 0), this.toggleErrorsPopperByKeyboard(0);
|
359
367
|
}
|
360
368
|
}
|
@@ -363,46 +371,46 @@ var me = (
|
|
363
371
|
}, {
|
364
372
|
key: "render",
|
365
373
|
value: function() {
|
366
|
-
var e = this.asProps,
|
367
|
-
return
|
374
|
+
var e = this.asProps, t, r, i = this, a = ge, n = this.asProps, l = n.styles, d = n.showErrors, g = this.state.visibleErrorPopper, b = this.errorMessage, c = b.errorMessage, u = b.isCommonError, s = d && g && !!c && !this.isDisabled, y = ee(this.asProps), v = y.__excludeProps;
|
375
|
+
return t = ue(l), /* @__PURE__ */ O.createElement(O.Fragment, null, /* @__PURE__ */ O.createElement($, t.cn("Tooltip", {
|
368
376
|
interaction: "none",
|
369
|
-
placement:
|
370
|
-
visible:
|
377
|
+
placement: u ? "right-start" : "right",
|
378
|
+
visible: s,
|
371
379
|
theme: "warning",
|
372
|
-
offset:
|
380
|
+
offset: u ? void 0 : [0, 26],
|
373
381
|
preventOverflow: {
|
374
382
|
boundary: (r = this.containerRef.current) !== null && r !== void 0 ? r : void 0,
|
375
383
|
tether: !1
|
376
384
|
}
|
377
|
-
}), function(
|
378
|
-
var
|
379
|
-
return
|
380
|
-
id:
|
381
|
-
},
|
382
|
-
}), /* @__PURE__ */
|
385
|
+
}), function(p) {
|
386
|
+
var f = p.popper, I = p.setTrigger;
|
387
|
+
return i.popper || (i.setPopperTrigger = I, i.popper = f), /* @__PURE__ */ O.createElement($.Popper, {
|
388
|
+
id: i.popperDescribedId
|
389
|
+
}, c);
|
390
|
+
}), /* @__PURE__ */ O.createElement(a, t.cn("SInputField", ae({}, he({
|
383
391
|
ref: this.containerRef,
|
384
|
-
__excludeProps: ["onBlur", "value"].concat(
|
392
|
+
__excludeProps: ["onBlur", "value"].concat(W(v))
|
385
393
|
}, e)))));
|
386
394
|
}
|
387
395
|
}, {
|
388
396
|
key: "prepareNodesForPaste",
|
389
397
|
value: function(e) {
|
390
|
-
var
|
391
|
-
var
|
392
|
-
return
|
393
|
-
}, g = (r = l == null ? void 0 : l.skipEmptyLines) !== null && r !== void 0 ? r : this.skipEmptyLines,
|
394
|
-
return
|
395
|
-
var
|
396
|
-
if (
|
397
|
-
var
|
398
|
-
if (
|
399
|
-
|
400
|
-
else if (
|
401
|
-
var
|
402
|
-
|
398
|
+
var t, r, i, a = this, n = [], l = this.asProps.pasteProps, d = (t = l == null ? void 0 : l.lineProcessing) !== null && t !== void 0 ? t : function(u) {
|
399
|
+
var s = u.trim();
|
400
|
+
return s === "" ? u : s;
|
401
|
+
}, g = (r = l == null ? void 0 : l.skipEmptyLines) !== null && r !== void 0 ? r : this.skipEmptyLines, b = (i = l == null ? void 0 : l.delimiter) !== null && i !== void 0 ? i : this.delimiter, c = Array.isArray(e) ? e : e.split(b);
|
402
|
+
return c.forEach(function(u, s) {
|
403
|
+
var y = d(u, s, c.length);
|
404
|
+
if (y === "" && g === !1 || y !== "") {
|
405
|
+
var v = document.createElement("p");
|
406
|
+
if (y === "")
|
407
|
+
v.innerHTML = a.emptyLineValue;
|
408
|
+
else if (y.trim() === "") {
|
409
|
+
var p = new RegExp("\\s", "g");
|
410
|
+
v.innerHTML = fe.sanitize(y.replace(p, a.spaceLineValue));
|
403
411
|
} else
|
404
|
-
|
405
|
-
n.push(
|
412
|
+
v.append(document.createTextNode(y));
|
413
|
+
n.push(v), a.validateLine(v);
|
406
414
|
}
|
407
415
|
}), n;
|
408
416
|
}
|
@@ -410,11 +418,11 @@ var me = (
|
|
410
418
|
key: "recalculateErrors",
|
411
419
|
value: function() {
|
412
420
|
var e = [];
|
413
|
-
this.textarea.childNodes.forEach(function(
|
414
|
-
if (
|
415
|
-
var
|
416
|
-
errorMessage: (
|
417
|
-
lineNode:
|
421
|
+
this.textarea.childNodes.forEach(function(t, r) {
|
422
|
+
if (t instanceof HTMLParagraphElement && t.getAttribute("aria-invalid") === "true") {
|
423
|
+
var i, a = {
|
424
|
+
errorMessage: (i = t.dataset.errormessage) !== null && i !== void 0 ? i : "",
|
425
|
+
lineNode: t,
|
418
426
|
lineIndex: r
|
419
427
|
};
|
420
428
|
e.push(a);
|
@@ -426,19 +434,24 @@ var me = (
|
|
426
434
|
value: function() {
|
427
435
|
var e = this;
|
428
436
|
this.linesCountTimeout && clearTimeout(this.linesCountTimeout), this.linesCountTimeout = window.setTimeout(function() {
|
429
|
-
var
|
437
|
+
var t = 0, r = e.asProps, i = r.maxLines, a = r.linesCount;
|
430
438
|
e.textarea.childNodes.forEach(function(n, l) {
|
431
|
-
n instanceof HTMLParagraphElement && (n.dataset.overMaxRows = "false", n.textContent !== e.getEmptyParagraph().textContent && n.textContent !== "" && (
|
432
|
-
}), a !==
|
439
|
+
n instanceof HTMLParagraphElement && (n.dataset.overMaxRows = "false", n.textContent !== e.getEmptyParagraph().textContent && n.textContent !== "" && (t++, t > i && (n.dataset.overMaxRows = "true")));
|
440
|
+
}), a !== t && e.asProps.onChangeLinesCount(t);
|
433
441
|
}, 100);
|
434
442
|
}
|
435
443
|
}, {
|
436
444
|
key: "getValues",
|
437
445
|
value: function() {
|
438
446
|
var e = [];
|
439
|
-
return this.textarea.childNodes.forEach(function(
|
447
|
+
return this.textarea.childNodes.forEach(function(t) {
|
440
448
|
var r;
|
441
|
-
|
449
|
+
if (((r = t.textContent) === null || r === void 0 ? void 0 : r.trim()) === "")
|
450
|
+
e.push("");
|
451
|
+
else {
|
452
|
+
var i;
|
453
|
+
e.push((i = t.textContent) !== null && i !== void 0 ? i : "");
|
454
|
+
}
|
442
455
|
}), e;
|
443
456
|
}
|
444
457
|
}, {
|
@@ -449,32 +462,33 @@ var me = (
|
|
449
462
|
}, {
|
450
463
|
key: "toggleErrorsPopperByKeyboard",
|
451
464
|
value: function(e) {
|
452
|
-
var
|
465
|
+
var t = this;
|
453
466
|
this.toggleErrorsPopperTimeout && clearTimeout(this.toggleErrorsPopperTimeout), this.isScrolling ? this.toggleErrorsPopperTimeout = window.setTimeout(function() {
|
454
|
-
|
467
|
+
t.toggleErrorsPopperByKeyboard(e);
|
455
468
|
}, 50) : setTimeout(function() {
|
456
|
-
var r =
|
457
|
-
|
469
|
+
var r = t.getNodeFromSelection();
|
470
|
+
t.toggleErrorsPopper("keyboardLineIndex", r, e);
|
458
471
|
}, 0);
|
459
472
|
}
|
460
473
|
}, {
|
461
474
|
key: "toggleErrorsPopper",
|
462
|
-
value: function(e,
|
463
|
-
var
|
464
|
-
|
465
|
-
var a =
|
466
|
-
a instanceof HTMLParagraphElement ? (l = a.getAttribute("aria-invalid") === "true", n = Array.from(
|
475
|
+
value: function(e, t, r) {
|
476
|
+
var i = this;
|
477
|
+
t instanceof HTMLDivElement || t instanceof HTMLParagraphElement ? (this.changeTriggerTimeout && clearTimeout(this.changeTriggerTimeout), this.changeTriggerTimeout = window.setTimeout(function() {
|
478
|
+
var a = t === i.textarea ? i.getNodeFromSelection() : t, n = -1, l = !1;
|
479
|
+
a instanceof HTMLParagraphElement ? (l = a.getAttribute("aria-invalid") === "true", n = Array.from(i.textarea.childNodes).indexOf(a)) : a === i.textarea && (n = 0), a instanceof HTMLElement && i.setState(function(d) {
|
467
480
|
var g = {
|
468
|
-
visibleErrorPopper:
|
481
|
+
visibleErrorPopper: i.isFocusing && i.asProps.commonErrorMessage ? !0 : l,
|
469
482
|
mouseLineIndex: d.mouseLineIndex,
|
470
483
|
keyboardLineIndex: d.keyboardLineIndex
|
471
484
|
};
|
472
|
-
return (
|
485
|
+
return (i.isFocusing || e === "mouseLineIndex" && l) && (g[e] = n), g;
|
473
486
|
}, function() {
|
474
|
-
|
475
|
-
|
487
|
+
i.errorByInteraction = e === "mouseLineIndex" ? "mouse" : "keyboard";
|
488
|
+
var d = l ? a : i.textarea;
|
489
|
+
if (i.shouldChangePopperTrigger(d)) {
|
476
490
|
var g;
|
477
|
-
(g =
|
491
|
+
(g = i.setPopperTrigger) === null || g === void 0 || g.call(i, d), i.forceUpdate();
|
478
492
|
}
|
479
493
|
});
|
480
494
|
}, r ?? 50)) : this.setState({
|
@@ -483,13 +497,13 @@ var me = (
|
|
483
497
|
}
|
484
498
|
}, {
|
485
499
|
key: "toggleAriaInvalid",
|
486
|
-
value: function(e,
|
487
|
-
e &&
|
500
|
+
value: function(e, t) {
|
501
|
+
e && t > 0 ? (this.textarea.setAttribute("aria-describedby", this.popperDescribedId), this.textarea.setAttribute("aria-invalid", "true")) : (this.textarea.removeAttribute("aria-invalid"), this.textarea.removeAttribute("aria-describedby"));
|
488
502
|
}
|
489
503
|
}, {
|
490
504
|
key: "handleChangeErrorIndex",
|
491
505
|
value: function(e) {
|
492
|
-
var
|
506
|
+
var t, r = this, i = this.asProps.errors[e], a = this.textarea.childNodes, n = i ? (t = i.lineNode) !== null && t !== void 0 ? t : a.item(i.lineIndex) : null, l = document.getSelection();
|
493
507
|
l && n instanceof HTMLParagraphElement && (this.setState({
|
494
508
|
visibleErrorPopper: !1
|
495
509
|
}), setTimeout(function() {
|
@@ -500,63 +514,63 @@ var me = (
|
|
500
514
|
}, {
|
501
515
|
key: "validateLine",
|
502
516
|
value: function(e) {
|
503
|
-
var
|
504
|
-
if (
|
505
|
-
var r,
|
517
|
+
var t = this.asProps.lineValidation;
|
518
|
+
if (t && e instanceof HTMLElement) {
|
519
|
+
var r, i = t((r = e.textContent) !== null && r !== void 0 ? r : "", this.getValues()), a = i.isValid, n = i.errorMessage;
|
506
520
|
return a ? (e.removeAttribute("aria-invalid"), e.dataset.errormessage = void 0) : (e.setAttribute("aria-invalid", "true"), e.dataset.errormessage = n), a;
|
507
521
|
}
|
508
522
|
return !0;
|
509
523
|
}
|
510
524
|
}, {
|
511
525
|
key: "setSelection",
|
512
|
-
value: function(e,
|
513
|
-
var
|
514
|
-
n.setStart(e,
|
526
|
+
value: function(e, t, r) {
|
527
|
+
var i = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "center", a = document.getSelection(), n = document.createRange();
|
528
|
+
n.setStart(e, t), n.setEnd(e, r), a == null || a.removeAllRanges(), a == null || a.addRange(n);
|
515
529
|
var l = e instanceof Text ? e.parentNode : e;
|
516
530
|
l instanceof HTMLElement && l.scrollIntoView({
|
517
|
-
block:
|
518
|
-
inline:
|
531
|
+
block: i,
|
532
|
+
inline: i,
|
519
533
|
behavior: "smooth"
|
520
534
|
});
|
521
535
|
}
|
522
536
|
}, {
|
523
537
|
key: "getNodeFromSelection",
|
524
538
|
value: function() {
|
525
|
-
var e = document.getSelection(),
|
526
|
-
return
|
539
|
+
var e = document.getSelection(), t = (e == null ? void 0 : e.focusNode) instanceof Text ? e.focusNode.parentNode : e == null ? void 0 : e.focusNode;
|
540
|
+
return t ?? null;
|
527
541
|
}
|
528
542
|
}, {
|
529
543
|
key: "handleCursorMovement",
|
530
|
-
value: function(e,
|
544
|
+
value: function(e, t) {
|
531
545
|
var r = null;
|
532
|
-
switch (
|
546
|
+
switch (t.key) {
|
533
547
|
case "ArrowUp":
|
534
|
-
|
548
|
+
t.preventDefault(), r = e.previousSibling;
|
535
549
|
break;
|
536
550
|
case "ArrowDown":
|
537
|
-
|
551
|
+
t.preventDefault(), r = e.nextSibling;
|
538
552
|
break;
|
539
553
|
case "ArrowLeft": {
|
540
|
-
e.textContent === this.getEmptyParagraph().textContent && (
|
554
|
+
e.textContent === this.getEmptyParagraph().textContent && (t.preventDefault(), r = e.previousSibling);
|
541
555
|
break;
|
542
556
|
}
|
543
557
|
case "ArrowRight":
|
544
|
-
e.textContent === this.getEmptyParagraph().textContent && (
|
558
|
+
e.textContent === this.getEmptyParagraph().textContent && (t.preventDefault(), r = e.nextSibling);
|
545
559
|
}
|
546
560
|
if (r instanceof HTMLParagraphElement) {
|
547
|
-
var
|
548
|
-
|
561
|
+
var i, a, n, l = document.getSelection(), d = r.childNodes.item(0), g = d instanceof Text ? d : r, b = (i = (a = r.textContent) === null || a === void 0 ? void 0 : a.trim()) !== null && i !== void 0 ? i : "", c = (n = l == null ? void 0 : l.focusOffset) !== null && n !== void 0 ? n : 0, u = c <= b.length ? c : b.length;
|
562
|
+
t.key === "ArrowLeft" ? u = b.length : t.key === "ArrowRight" && (u = 0), this.setSelection(g, u, u, "nearest");
|
549
563
|
}
|
550
564
|
}
|
551
565
|
}, {
|
552
566
|
key: "setErrorIndex",
|
553
567
|
value: function(e) {
|
554
|
-
var
|
568
|
+
var t = Array.from(this.textarea.childNodes).filter(function(r) {
|
555
569
|
return r instanceof Element && r.getAttribute("aria-invalid") === "true";
|
556
570
|
}).findIndex(function(r) {
|
557
571
|
return r === e;
|
558
572
|
});
|
559
|
-
this.handlers.errorIndex(
|
573
|
+
this.handlers.errorIndex(t);
|
560
574
|
}
|
561
575
|
}, {
|
562
576
|
key: "isDeleteKey",
|
@@ -584,8 +598,8 @@ var me = (
|
|
584
598
|
value: function(e) {
|
585
599
|
if (e.key === "a" && (e.metaKey || e.ctrlKey)) {
|
586
600
|
e.preventDefault();
|
587
|
-
var
|
588
|
-
|
601
|
+
var t = e.target;
|
602
|
+
t instanceof HTMLElement && t === this.textarea && this.setSelection(t, 0, t.childNodes.length);
|
589
603
|
}
|
590
604
|
}
|
591
605
|
}, {
|
@@ -599,18 +613,18 @@ var me = (
|
|
599
613
|
value: function() {
|
600
614
|
var e = document.getSelection();
|
601
615
|
if (e != null && e.anchorNode && e !== null && e !== void 0 && e.focusNode) {
|
602
|
-
var
|
603
|
-
return
|
604
|
-
|
616
|
+
var t = e.anchorNode.compareDocumentPosition(e.focusNode);
|
617
|
+
return t === 0 && e.anchorOffset > e.focusOffset || // if nodes are the same
|
618
|
+
t === Node.DOCUMENT_POSITION_PRECEDING ? "backward" : "forward";
|
605
619
|
}
|
606
620
|
return null;
|
607
621
|
}
|
608
|
-
}]),
|
622
|
+
}]), K;
|
609
623
|
}(ce);
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
624
|
+
E(Y, "displayName", "Textarea");
|
625
|
+
E(Y, "style", me);
|
626
|
+
E(Y, "enhance", [pe()]);
|
627
|
+
E(Y, "defaultProps", {
|
614
628
|
defaultValue: "",
|
615
629
|
size: "m",
|
616
630
|
state: "normal",
|
@@ -621,5 +635,5 @@ k(G, "defaultProps", {
|
|
621
635
|
defaultLinesCount: 0
|
622
636
|
});
|
623
637
|
export {
|
624
|
-
|
638
|
+
Y as InputField
|
625
639
|
};
|