@stenajs-webui/forms 17.6.0 → 17.7.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 +12 -0
- package/dist/components/ui/checkbox/Checkbox.d.ts +10 -10
- package/dist/components/ui/checkbox/CheckboxWithLabel.d.ts +10 -10
- package/dist/components/ui/numeric-stepper/NumericStepper.d.ts +6 -6
- package/dist/components/ui/numeric-text-input/NumericTextInput.d.ts +10 -10
- package/dist/components/ui/numeric-text-input/hooks/UseNumericInputValue.d.ts +4 -4
- package/dist/components/ui/password-input/PasswordInput.d.ts +8 -8
- package/dist/components/ui/radio/RadioButton.d.ts +8 -8
- package/dist/components/ui/radio/RadioButtonWithLabel.d.ts +10 -10
- package/dist/components/ui/switch/Switch.d.ts +8 -8
- package/dist/components/ui/switch/SwitchWithLabel.d.ts +7 -7
- package/dist/components/ui/text-area/TextArea.d.ts +12 -12
- package/dist/components/ui/text-input/TextInput.d.ts +43 -43
- package/dist/components/ui/text-input/TextInputBox.d.ts +7 -7
- package/dist/components/ui/text-input/TextInputIcon.d.ts +14 -14
- package/dist/components/ui/text-input/__tests__/TextInput.test.d.ts +1 -1
- package/dist/components/ui/types.d.ts +17 -17
- package/dist/hooks/UseKeyboardNavigation.d.ts +8 -8
- package/dist/hooks/UseSelectAllOnMount.d.ts +4 -4
- package/dist/hooks/UseTextInput.d.ts +30 -30
- package/dist/index.d.ts +18 -18
- package/dist/index.es.js +665 -465
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -528
- package/dist/index.js.map +1 -1
- package/dist/storybook-helpers/storybook-controls.d.ts +46 -46
- package/dist/utils/NumberComparator.d.ts +2 -2
- package/dist/utils/NumericHelpers.d.ts +13 -13
- package/package.json +7 -8
- package/dist/components/ui/Form.stories.d.ts +0 -6
- package/dist/components/ui/checkbox/Checkbox.stories.d.ts +0 -24
- package/dist/components/ui/checkbox/CheckboxWithLabel.stories.d.ts +0 -27
- package/dist/components/ui/numeric-stepper/NumericStepper.stories.d.ts +0 -40
- package/dist/components/ui/numeric-text-input/NumericTextInput.stories.d.ts +0 -57
- package/dist/components/ui/password-input/PasswordInput.stories.d.ts +0 -9
- package/dist/components/ui/radio/RadioButton.stories.d.ts +0 -25
- package/dist/components/ui/radio/RadioButtonWithLabel.stories.d.ts +0 -7
- package/dist/components/ui/switch/Switch.stories.d.ts +0 -13
- package/dist/components/ui/switch/SwitchWithLabel.stories.d.ts +0 -12
- package/dist/components/ui/text-area/TextArea.stories.d.ts +0 -21
- package/dist/components/ui/text-input/TextInput.stories.d.ts +0 -62
- package/dist/components/ui/text-input/TextInputBox.stories.d.ts +0 -7
- package/dist/hooks/__tests__/useSelectAllOnMount.test.d.ts +0 -1
- package/dist/utils/__tests__/NumberComparator.test.d.ts +0 -1
- package/dist/utils/__tests__/NumericHelpers.test.d.ts +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,486 +1,686 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import cx from
|
|
5
|
-
import { FlatButton,
|
|
6
|
-
import { FontAwesomeIcon } from
|
|
7
|
-
import { faEye } from
|
|
8
|
-
import { faEyeSlash } from
|
|
9
|
-
import { faExclamationTriangle } from
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode("._switch_ven48_1{--swui-switch-width: 50px;--swui-switch-height: var(--swui-field-box-size-medium);--swui-switch-animation-time: var(--swui-animation-time-medium);--swui-switch-selected-highlight-color: var(--swui-primary-action-color);--swui-switch-knob-width: calc(var(--swui-switch-height) - 2px);--swui-switch-knob-bg-color-enabled: var(--swui-handle-bg-enabled-color);--swui-switch-knob-bg-color-disabled: var(--swui-handle-bg-disabled-color);--swui-switch-container-bg-color-enabled: var(--swui-field-bg-enabled);--swui-switch-container-bg-color-disabled: var(--swui-field-bg-disabled);--swui-switch-knob-border-color-enabled: var(--swui-separator-color);--swui-switch-container-border-color: var(--swui-field-border-color);--swui-switch-container-border-color-hover: var( --swui-field-border-color-hover );--swui-switch-container-border-color-disabled: var( --swui-field-border-color-disabled );--swui-switch-knob-shadow-color: var(--swui-field-shadow-color);display:flex;flex-direction:row;border:1px solid var(--swui-switch-container-border-color);box-sizing:border-box;background-color:var(--swui-switch-container-bg-color-enabled);height:var(--swui-switch-height);width:var(--swui-switch-width);border-radius:calc(var(--swui-switch-height) / 2);padding:0;margin:0;cursor:pointer;transition:background-color var(--swui-switch-animation-time)}._switch_ven48_1:focus{outline:0;border:1px solid var(--swui-switch-selected-highlight-color);box-shadow:inset var(--swui-switch-selected-highlight-color) 0 0 4px 0}._switch_ven48_1:hover{border:1px solid var(--swui-switch-selected-highlight-color)}._switch_ven48_1:disabled{cursor:default;background-color:var(--swui-switch-container-bg-color-disabled);border:1px solid var(--swui-switch-container-border-color-disabled)}._switch_ven48_1:disabled ._knob_ven48_52{background-color:var(--swui-switch-knob-bg-color-disabled)}._switch_ven48_1 ._filler_ven48_57{flex:none;transition:flex var(--swui-switch-animation-time)}._switch_ven48_1 ._knob_ven48_52{width:var(--swui-switch-knob-width);height:var(--swui-switch-knob-width);border-radius:50%;background-color:var(--swui-switch-knob-bg-color-enabled);box-shadow:var(--swui-switch-knob-shadow-color) 0 0 4px 1px}._checked_ven48_71{border:1px solid var(--swui-switch-selected-highlight-color);background-color:var(--swui-switch-selected-highlight-color)}._checked_ven48_71 ._filler_ven48_57{flex:1}._checkbox_pf7pg_1{--swui-checkbox-height: var(--swui-field-box-size-medium);--swui-checkbox-height-small: var(--swui-field-box-size-small);--swui-checkbox-border-radius: var(--swui-field-border-radius);--swui-checkbox-animation-time: var(--swui-animation-time-medium);--swui-checkbox-icon-color: var(--swui-field-indicator-active-color);--swui-checkbox-disabled-icon-color: var(--swui-field-border-color-disabled);--swui-checkbox-unchecked-icon-color: var( --swui-field-indicator-inactive-color );--swui-checkbox-unchecked-bg-color: var(--swui-white);--swui-checkbox-checked-bg-color: var(--swui-primary-action-color);--swui-checkbox-disabled-bg-color: var(--swui-field-bg-disabled);--swui-checkbox-disabled-checked-bg-color: var(--swui-field-bg-disabled);--swui-checkbox-border-color: var(--swui-field-border-color);--swui-checkbox-border-hover-color: var(--swui-field-border-color-hover);--swui-checkbox-disabled-border-color: var( --swui-field-border-color-disabled );--swui-checkbox-checked-focus-shadow: var(--swui-field-focus-shadow-inverted);--swui-checkbox-unchecked-focus-shadow: var(--swui-field-focus-shadow);-webkit-appearance:none;-moz-appearance:none;border-radius:var(--swui-checkbox-border-radius);outline:none;display:inline-block;vertical-align:top;position:relative;margin:0;cursor:pointer;border:1px solid var(--current-border-color, var(--swui-checkbox-border-color));background:var(--current-bg-color, var(--swui-checkbox-unchecked-bg-color));transition:background var(--swui-checkbox-animation-time),border-color var(--swui-checkbox-animation-time),box-shadow var(--swui-checkbox-animation-time);flex-shrink:0}._checkbox_pf7pg_1._standard_pf7pg_44{width:var(--swui-checkbox-height);height:var(--swui-checkbox-height)}._checkbox_pf7pg_1._standard_pf7pg_44:after{width:3px;height:6px;left:9px;top:6px}._checkbox_pf7pg_1._small_pf7pg_56{width:var(--swui-checkbox-height-small);height:var(--swui-checkbox-height-small)}._checkbox_pf7pg_1._small_pf7pg_56:after{width:3px;height:6px;left:5px;top:2px}._checkbox_pf7pg_1:after{content:\"\";display:block;position:absolute;transition:opacity var(--swui-checkbox-animation-time),width var(--swui-checkbox-animation-time),top var(--swui-checkbox-animation-time),-webkit-transform var(--swui-checkbox-animation-time) var(--d-t-e, ease);transition:transform var(--swui-checkbox-animation-time) var(--d-t-e, ease),opacity var(--swui-checkbox-animation-time),width var(--swui-checkbox-animation-time),top var(--swui-checkbox-animation-time);transition:transform var(--swui-checkbox-animation-time) var(--d-t-e, ease),opacity var(--swui-checkbox-animation-time),width var(--swui-checkbox-animation-time),top var(--swui-checkbox-animation-time),-webkit-transform var(--swui-checkbox-animation-time) var(--d-t-e, ease);border:2px solid var( --current-checkbox-icon-color, var(--swui-checkbox-unchecked-icon-color) );border-top:0;border-left:0;-webkit-transform:rotate(var(--current-check-rotation, 20deg));transform:rotate(var(--current-check-rotation, 20deg));box-sizing:content-box}._checkbox_pf7pg_1:checked{--current-check-rotation: 43deg;--current-bg-color: var(--swui-checkbox-checked-bg-color);--current-border-color: var(--swui-checkbox-checked-bg-color);--d-t-e: cubic-bezier(.2, .85, .32, 1.2)}._checkbox_pf7pg_1:checked:after{--current-checkbox-icon-color: var(--swui-checkbox-icon-color)}._checkbox_pf7pg_1:disabled:not(:checked){--current-bg-color: var(--swui-checkbox-disabled-bg-color);--current-border-color: var(--swui-checkbox-disabled-border-color)}._checkbox_pf7pg_1:disabled:not(:checked):after{--current-checkbox-icon-color: --swui-checkbox-unchecked-icon-color}._checkbox_pf7pg_1:disabled:checked{--current-bg-color: var(--swui-checkbox-disabled-checked-bg-color);--current-border-color: var(--swui-checkbox-disabled-border-color)}._checkbox_pf7pg_1:disabled:checked:after{--current-checkbox-icon-color: var(--swui-checkbox-disabled-icon-color)}._checkbox_pf7pg_1:indeterminate{--current-check-rotation: 43deg;--current-bg-color: var(--swui-checkbox-checked-bg-color);--current-border-color: var(--swui-checkbox-checked-bg-color);--d-t-e: cubic-bezier(.2, .85, .32, 1.2)}._checkbox_pf7pg_1:indeterminate:after{--current-checkbox-icon-color: var(--swui-checkbox-icon-color);border-right:0;-webkit-transform:rotate(0deg);transform:rotate(0);width:6px}._checkbox_pf7pg_1:indeterminate._standard_pf7pg_44:after{top:4px;left:8px}._checkbox_pf7pg_1:indeterminate._small_pf7pg_56:after{top:0;left:4px}._checkbox_pf7pg_1:indeterminate:disabled:after{--current-checkbox-icon-color: var(--swui-checkbox-disabled-icon-color)}._checkbox_pf7pg_1:hover:not(:checked):not(:disabled){--current-border-color: var(--swui-checkbox-border-hover-color)}._checkbox_pf7pg_1:focus:checked{box-shadow:var(--swui-checkbox-checked-focus-shadow)}._checkbox_pf7pg_1:focus:not(:checked){box-shadow:var(--swui-checkbox-unchecked-focus-shadow)}._checkbox_pf7pg_1+label{font-size:1.4rem;line-height:var(--swui-checkbox-height);display:inline-block;vertical-align:top;cursor:pointer;margin-left:4px}._radiobutton_qxvf5_1{--swui-radiobutton-size-standard: var(--swui-field-box-size-medium);--swui-radiobutton-size-small: var(--swui-field-box-size-small);--swui-radiobutton-animation-time: var(--swui-animation-time-medium);--swui-radiobutton-icon-color: var(--swui-field-indicator-active-color);--swui-radiobutton-disabled-icon-color: var(--swui-separator-color);--swui-radiobutton-unchecked-icon-color: var( --swui-field-indicator-inactive-color );--swui-radiobutton-checked-bg-color: var(--swui-primary-action-color);--swui-radiobutton-checked-disabled-bg-color: var(--swui-field-bg-disabled);--swui-radiobutton-unchecked-bg-color: var(--swui-white);--swui-radiobutton-unchecked-disabled-bg-color: var(--swui-field-bg-disabled);--swui-radiobutton-unchecked-border-color: var(--swui-field-border-color);--swui-radiobutton-unchecked-hover-border-color: var( --swui-field-border-color-hover );--swui-radiobutton-disabled-border-color: var( --swui-field-border-color-disabled );--swui-radiobutton-checked-focus-shadow: var( --swui-field-focus-shadow-inverted );--swui-radiobutton-unchecked-focus-shadow: var(--swui-field-focus-shadow);-webkit-appearance:none;-moz-appearance:none;outline:none;display:inline-block;vertical-align:top;position:relative;margin:0;flex:none;cursor:pointer;border:1px solid var(--current-border-color, var(--swui-radiobutton-unchecked-border-color));border-radius:50%;background:var( --current-bg-color, var(--swui-radiobutton-unchecked-bg-color) );transition:background var(--swui-radiobutton-animation-time),border-color var(--swui-radiobutton-animation-time),box-shadow var(--swui-radiobutton-animation-time)}._radiobutton_qxvf5_1._standard_qxvf5_51{height:var(--swui-radiobutton-size-standard);width:var(--swui-radiobutton-size-standard)}._radiobutton_qxvf5_1._standard_qxvf5_51:after{left:7px;top:7px}._radiobutton_qxvf5_1._small_qxvf5_61{height:var(--swui-radiobutton-size-small);width:var(--swui-radiobutton-size-small)}._radiobutton_qxvf5_1._small_qxvf5_61:after{left:3px;top:3px}._radiobutton_qxvf5_1:after{content:\"\";display:block;position:absolute;transition:opacity var(--current-opacity-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease),-webkit-transform var(--current-transform-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease);transition:transform var(--current-transform-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease),opacity var(--current-opacity-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease);transition:transform var(--current-transform-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease),opacity var(--current-opacity-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease),-webkit-transform var(--current-transform-time, var(--swui-radiobutton-animation-time)) var(--current-transform-type, ease);-webkit-transform:scale(var(--current-scale, 0));transform:scale(var(--current-scale, 0));width:8px;height:8px;border-radius:50%;background:var( --current-icon-color, var(--swui-radiobutton-unchecked-icon-color) );opacity:var(--current-opacity, 0)}._radiobutton_qxvf5_1:checked{--current-bg-color: var(--swui-radiobutton-checked-bg-color);--current-border-color: var(--swui-radiobutton-checked-bg-color);--current-opacity-time: var(--swui-radiobutton-animation-time);--current-transform-time: .6s;--current-transform-type: cubic-bezier(.2, .85, .32, 1.2);--current-opacity: 1;--current-scale: 1}._radiobutton_qxvf5_1:checked:after{--current-icon-color: var(--swui-radiobutton-icon-color)}._radiobutton_qxvf5_1:disabled{--current-bg-color: var(--swui-radiobutton-unchecked-disabled-bg-color);--current-border-color: var(--swui-radiobutton-disabled-border-color)}._radiobutton_qxvf5_1:disabled:checked{--current-bg-color: var(--swui-radiobutton-checked-disabled-bg-color)}._radiobutton_qxvf5_1:disabled:checked:after{--current-icon-color: var(--swui-radiobutton-disabled-icon-color)}._radiobutton_qxvf5_1:hover:not(:checked):not(:disabled){--current-border-color: var( --swui-radiobutton-unchecked-hover-border-color )}._radiobutton_qxvf5_1:focus:checked{box-shadow:var(--swui-radiobutton-checked-focus-shadow)}._radiobutton_qxvf5_1:focus:not(:checked){box-shadow:var(--swui-radiobutton-unchecked-focus-shadow)}._radiobutton_qxvf5_1+label{font-size:1.4rem;line-height:var(--swui-radiobutton-size-standard);display:inline-block;vertical-align:top;cursor:pointer;margin-left:4px}._textInput_ijduv_1{--swui-textinput-text-color: var(--swui-field-text-color);--swui-textinput-text-color-disabled: var(--swui-field-text-color-disabled);--swui-textinput-letter-spacing: var(--swui-field-letter-spacing);--swui-textinput-line-height: var(--swui-field-text-line-height);--swui-textinput-indent: var(--swui-metrics-indent);--swui-textinput-spacing: calc(var(--swui-field-text-spacing) - 1px);--swui-textinput-font-size: var(--swui-font-size-inputs);--swui-textinput-font-family: var(--swui-font-input);--swui-textinput-font-weight: var(--swui-font-weight-inputs);--swui-textinput-placeholder-color: var(--swui-field-placeholder-color);--swui-textinput-animation-time: var(--swui-animation-time-medium);--swui-textinput-icon-color: var(--swui-field-border-color-disabled);--swui-textinput-icon-hover-color: var(--swui-primary-action-color);--swui-textinput-icon-size: var(--swui-field-icon-size);--swui-textinput-icon-color-success: var(--swui-state-success-color);--swui-textinput-bg-loading: var(--swui-state-loading-light-color);--swui-textinput-border-color-loading: var(--swui-state-loading-color);--swui-textinput-bg-modified: var(--swui-state-modified-light-color);--swui-textinput-border-color-modified: var(--swui-state-modified-color);--swui-textinput-bg-warning: var(--swui-state-alert-light-color);--swui-textinput-border-color-warning: var(--swui-state-alert-color);--swui-textinput-bg-error: var(--swui-state-error-light-color);--swui-textinput-border-color-error: var(--swui-state-error-color);--swui-textinput-bg-color: var(--swui-field-bg-enabled);--swui-textinput-bg-color-disabled: var(--swui-field-bg-disabled);--swui-textinput-border-radius: var(--swui-field-border-radius);--swui-textinput-border-color: var(--swui-field-border-color);--swui-textinput-border-color-hover: var(--swui-field-border-color-hover);--swui-textinput-border-color-disabled: var( --swui-field-border-color-disabled );--swui-textinput-focus-shadow: var(--swui-field-focus-shadow);--current-bg: var(--swui-textinput-bg-color);--current-border-color: var(--swui-textinput-border-color);--current-icon-color: var(--swui-textinput-icon-color);display:flex;width:100%;align-items:center;background:var(--current-bg);border:1px solid var(--current-border-color);border-radius:var(--swui-textinput-border-radius);transition:all var(--swui-textinput-animation-time)}._textInput_ijduv_1._textInput_ijduv_1:focus-within:not(._disabled_ijduv_61){box-shadow:var(--swui-textinput-focus-shadow);--current-border-color: var(--swui-textinput-border-color-hover);--current-bg: var(--swui-textinput-bg-color)}._textInput_ijduv_1 ._input_ijduv_67{letter-spacing:var(--swui-textinput-letter-spacing);line-height:var(--swui-textinput-line-height);width:100%;padding:var(--swui-textinput-spacing) var(--swui-textinput-indent);color:var(--swui-textinput-text-color);font-size:var(--swui-textinput-font-size);font-family:var(--swui-textinput-font-family);font-weight:var(--swui-textinput-font-weight);background:var(--swui-hidden);border:none;min-width:0;margin:0}._textInput_ijduv_1 ._input_ijduv_67:disabled{color:var(--swui-textinput-text-color-disabled)}._textInput_ijduv_1 ._input_ijduv_67::-webkit-input-placeholder{color:var(--swui-textinput-placeholder-color)}._textInput_ijduv_1 ._input_ijduv_67:-ms-input-placeholder{color:var(--swui-textinput-placeholder-color)}._textInput_ijduv_1 ._input_ijduv_67::placeholder{color:var(--swui-textinput-placeholder-color)}._textInput_ijduv_1 ._input_ijduv_67:focus{outline:none}._textInput_ijduv_1 ._input_ijduv_67::-webkit-calendar-picker-indicator{display:none}._textInput_ijduv_1._standard_ijduv_102:hover:not(._disabled_ijduv_61),._textInput_ijduv_1._success_ijduv_103:hover:not(._disabled_ijduv_61){--current-border-color: var(--swui-textinput-border-color-hover)}._textInput_ijduv_1._success_ijduv_103{--current-icon-color: var(--swui-textinput-icon-color-success)}._textInput_ijduv_1._loading_ijduv_115{--current-bg: var(--swui-textinput-bg-loading);--current-border-color: var(--swui-textinput-border-color-loading)}._textInput_ijduv_1._modified_ijduv_120{--current-bg: var(--swui-textinput-bg-modified);--current-border-color: var(--swui-textinput-border-color-modified);--current-icon-color: var(--lhds-color-blue-300)}._textInput_ijduv_1._error_ijduv_126{--current-bg: var(--swui-textinput-bg-error);--current-border-color: var(--swui-textinput-border-color-error);--current-icon-color: var(--swui-textinput-border-color-error)}._textInput_ijduv_1._warning_ijduv_132{--current-bg: var(--swui-textinput-bg-warning);--current-border-color: var(--swui-textinput-border-color-warning);--current-icon-color: var(--swui-textinput-border-color-warning)}._textInput_ijduv_1._disabled_ijduv_61{--current-bg: var(--swui-textinput-bg-color-disabled);--current-border-color: var(--swui-textinput-border-color-disabled)}._textInput_ijduv_1._textInput_ijduv_1._hideBorder_ijduv_143{border:none;box-shadow:none;background:none}._textInput_ijduv_1 ._clickable_ijduv_149:hover{--current-icon-color: var(--swui-textinput-icon-hover-color);cursor:pointer}._textInput_ijduv_1 ._icon_ijduv_154{transition:color var(--swui-textinput-animation-time);color:var(--current-icon-color);font-size:var(--swui-textinput-icon-size)}._numericTextInputInput_1tnr6_1{-moz-appearance:textfield}._numericTextInputInput_1tnr6_1::-webkit-outer-spin-button,._numericTextInputInput_1tnr6_1::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}._textArea_1ta4a_1{--swui-textarea-text-color: var(--swui-field-text-color);--swui-textarea-text-color-disabled: var(--swui-field-text-color-disabled);--swui-textarea-letter-spacing: var(--swui-field-letter-spacing);--swui-textarea-line-height: var(--swui-field-text-line-height);--swui-textarea-indent: var(--swui-metrics-indent);--swui-textarea-spacing: calc(var(--swui-field-text-spacing) - 1px);--swui-textarea-font-size: var(--swui-font-size-inputs);--swui-textarea-font-family: var(--swui-font-input);--swui-textarea-font-weight: var(--swui-font-weight-inputs);--swui-textarea-placeholder-color: var(--swui-text-disabled-color);--swui-textarea-animation-time: var(--swui-animation-time-medium);--swui-textarea-icon-color: var(--swui-field-border-color-disabled);--swui-textarea-icon-size: var(--swui-field-icon-size);--swui-textarea-icon-color-success: var(--swui-state-success-color);--swui-textarea-bg-loading: var(--swui-state-loading-light-color);--swui-textarea-border-color-loading: var(--swui-state-loading-color);--swui-textarea-bg-modified: var(--swui-state-modified-light-color);--swui-textarea-border-color-modified: var(--swui-state-modified-color);--swui-textarea-bg-warning: var(--swui-state-alert-light-color);--swui-textarea-border-color-warning: var(--swui-state-alert-color);--swui-textarea-bg-error: var(--swui-state-error-light-color);--swui-textarea-border-color-error: var(--swui-state-error-color);--swui-textarea-bg-color: var(--swui-field-bg-enabled);--swui-textarea-bg-color-disabled: var(--swui-field-bg-disabled);--swui-textarea-border-radius: var(--swui-field-border-radius);--swui-textarea-border-color: var(--swui-field-border-color);--swui-textarea-border-color-hover: var(--swui-field-border-color-hover);--swui-textarea-border-color-disabled: var( --swui-field-border-color-disabled );--swui-textarea-focus-shadow: var(--swui-field-focus-shadow);max-width:100%;letter-spacing:var(--swui-textarea-letter-spacing);line-height:var(--swui-textarea-line-height);padding:var(--swui-textarea-spacing) var(--swui-textarea-indent);color:var(--swui-textarea-text-color);font-size:var(--swui-textarea-font-size);font-family:var(--swui-textarea-font-family);font-weight:var(--swui-textarea-font-weight);background:var(--current-bg, var(--swui-textarea-bg-color));border:1px solid var(--current-border-color, var(--swui-textarea-border-color));border-radius:var(--swui-textarea-border-radius);transition:border var(--swui-textarea-animation-time);--current-icon-color: var(--swui-textarea-icon-color)}._textArea_1ta4a_1:focus{outline:none;box-shadow:var(--swui-textarea-focus-shadow);--current-border-color: var(--swui-textarea-border-color-hover);--current-bg: var(--swui-textarea-bg-color)}._textArea_1ta4a_1:disabled{color:var(--swui-textarea-text-color-disabled);--current-bg: var(--swui-textarea-bg-color-disabled);--current-border-color: var(--swui-textarea-border-color-disabled)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Space, Text, Row, parseFloatElseUndefined } from "@stenajs-webui/core";
|
|
3
|
+
import { forwardRef, useRef, useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
+
import cx from "classnames";
|
|
5
|
+
import { FlatButton, stenaCheck, stenaExclamationTriangle, InputSpinner, UpDownButtons } from "@stenajs-webui/elements";
|
|
6
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
7
|
+
import { faEye } from "@fortawesome/free-solid-svg-icons/faEye";
|
|
8
|
+
import { faEyeSlash } from "@fortawesome/free-solid-svg-icons/faEyeSlash";
|
|
9
|
+
import { faExclamationTriangle } from "@fortawesome/free-solid-svg-icons/faExclamationTriangle";
|
|
10
|
+
const knob = "_knob_ven48_52";
|
|
11
|
+
const filler = "_filler_ven48_57";
|
|
12
|
+
const checked = "_checked_ven48_71";
|
|
13
|
+
var styles$5 = {
|
|
14
|
+
"switch": "_switch_ven48_1",
|
|
15
|
+
knob,
|
|
16
|
+
filler,
|
|
17
|
+
checked
|
|
18
|
+
};
|
|
19
|
+
const styleChecked = `${styles$5.switch} ${styles$5.checked}`;
|
|
20
|
+
const Switch = ({
|
|
21
|
+
value,
|
|
22
|
+
disabled: disabled2,
|
|
23
|
+
onValueChange,
|
|
24
|
+
className,
|
|
25
|
+
wrapperRef,
|
|
26
|
+
...restProps
|
|
27
|
+
}) => {
|
|
28
|
+
return /* @__PURE__ */ jsx("div", {
|
|
29
|
+
className,
|
|
30
|
+
ref: wrapperRef,
|
|
31
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
32
|
+
type: "button",
|
|
33
|
+
role: "switch",
|
|
34
|
+
"aria-checked": value,
|
|
35
|
+
className: value ? styleChecked : styles$5.switch,
|
|
36
|
+
disabled: disabled2,
|
|
37
|
+
onClick: () => onValueChange && onValueChange(!value),
|
|
38
|
+
...restProps,
|
|
39
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: styles$5.filler
|
|
41
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
42
|
+
className: styles$5.knob
|
|
43
|
+
})]
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const SwitchWithLabel = ({
|
|
48
|
+
label,
|
|
49
|
+
disabled: disabled2,
|
|
50
|
+
textColor,
|
|
51
|
+
wrapperRef,
|
|
52
|
+
...switchProps
|
|
53
|
+
}) => {
|
|
54
|
+
return /* @__PURE__ */ jsx("div", {
|
|
55
|
+
ref: wrapperRef,
|
|
56
|
+
children: /* @__PURE__ */ jsx("label", {
|
|
57
|
+
children: /* @__PURE__ */ jsxs(Box, {
|
|
58
|
+
row: true,
|
|
59
|
+
alignItems: "center",
|
|
60
|
+
children: [/* @__PURE__ */ jsx(Switch, {
|
|
61
|
+
disabled: disabled2,
|
|
62
|
+
...switchProps
|
|
63
|
+
}), /* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(Text, {
|
|
64
|
+
userSelect: "none",
|
|
65
|
+
color: textColor,
|
|
66
|
+
children: label
|
|
67
|
+
})]
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const checkbox = "_checkbox_pf7pg_1";
|
|
73
|
+
const standard$2 = "_standard_pf7pg_44";
|
|
74
|
+
const small$1 = "_small_pf7pg_56";
|
|
75
|
+
var styles$4 = {
|
|
76
|
+
checkbox,
|
|
77
|
+
standard: standard$2,
|
|
78
|
+
small: small$1
|
|
79
|
+
};
|
|
80
|
+
const Checkbox = forwardRef(({
|
|
81
|
+
indeterminate = false,
|
|
82
|
+
onChange,
|
|
83
|
+
onValueChange,
|
|
84
|
+
value = false,
|
|
85
|
+
size = "standard",
|
|
86
|
+
...inputProps
|
|
87
|
+
}, ref) => {
|
|
88
|
+
const localRef = useRef();
|
|
89
|
+
const setRef = (element) => {
|
|
90
|
+
localRef.current = element;
|
|
91
|
+
if (localRef.current) {
|
|
92
|
+
localRef.current.indeterminate = Boolean(indeterminate);
|
|
93
|
+
}
|
|
94
|
+
if (ref) {
|
|
95
|
+
if (typeof ref === "function") {
|
|
96
|
+
ref(element);
|
|
97
|
+
} else {
|
|
98
|
+
ref.current = element;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
const handleInputChange = useCallback((ev) => {
|
|
103
|
+
if (onChange) {
|
|
104
|
+
onChange(ev);
|
|
105
|
+
}
|
|
106
|
+
if (onValueChange) {
|
|
107
|
+
onValueChange(ev.target.checked);
|
|
108
|
+
}
|
|
109
|
+
}, [onChange, onValueChange]);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (localRef.current) {
|
|
112
|
+
localRef.current.indeterminate = Boolean(indeterminate);
|
|
113
|
+
}
|
|
114
|
+
}, [indeterminate, localRef]);
|
|
115
|
+
return /* @__PURE__ */ jsx("input", {
|
|
116
|
+
type: "checkbox",
|
|
117
|
+
className: cx(styles$4.checkbox, styles$4[size]),
|
|
118
|
+
checked: value,
|
|
119
|
+
onChange: handleInputChange,
|
|
120
|
+
ref: setRef,
|
|
121
|
+
...inputProps
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
const CheckboxWithLabel = ({
|
|
125
|
+
children,
|
|
126
|
+
label,
|
|
127
|
+
inputRef,
|
|
128
|
+
wrapperRef,
|
|
129
|
+
textColor,
|
|
130
|
+
...checkboxProps
|
|
131
|
+
}) => {
|
|
132
|
+
return /* @__PURE__ */ jsx("div", {
|
|
133
|
+
ref: wrapperRef,
|
|
134
|
+
children: /* @__PURE__ */ jsx("label", {
|
|
135
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
children: [/* @__PURE__ */ jsx(Checkbox, {
|
|
138
|
+
...checkboxProps,
|
|
139
|
+
ref: inputRef
|
|
140
|
+
}), /* @__PURE__ */ jsx(Space, {}), label && /* @__PURE__ */ jsx(Text, {
|
|
141
|
+
userSelect: "none",
|
|
142
|
+
color: textColor,
|
|
143
|
+
children: label
|
|
144
|
+
}), children]
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
const radiobutton = "_radiobutton_qxvf5_1";
|
|
150
|
+
const standard$1 = "_standard_qxvf5_51";
|
|
151
|
+
const small = "_small_qxvf5_61";
|
|
152
|
+
var styles$3 = {
|
|
153
|
+
radiobutton,
|
|
154
|
+
standard: standard$1,
|
|
155
|
+
small
|
|
156
|
+
};
|
|
157
|
+
const RadioButton = forwardRef(({
|
|
158
|
+
onChange,
|
|
159
|
+
onValueChange,
|
|
160
|
+
size = "standard",
|
|
161
|
+
name,
|
|
162
|
+
...inputProps
|
|
163
|
+
}, ref) => {
|
|
164
|
+
const handleInputChange = useCallback((ev) => {
|
|
165
|
+
if (onChange) {
|
|
166
|
+
onChange(ev);
|
|
167
|
+
}
|
|
168
|
+
if (onValueChange) {
|
|
169
|
+
onValueChange(ev.target.value);
|
|
170
|
+
}
|
|
171
|
+
}, [onChange, onValueChange]);
|
|
172
|
+
return /* @__PURE__ */ jsx("input", {
|
|
173
|
+
type: "radio",
|
|
174
|
+
name,
|
|
175
|
+
className: styles$3.radiobutton + " " + styles$3[size],
|
|
176
|
+
onChange: handleInputChange,
|
|
177
|
+
ref,
|
|
178
|
+
...inputProps
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
const RadioButtonWithLabel = ({
|
|
182
|
+
label,
|
|
183
|
+
inputRef,
|
|
184
|
+
wrapperRef,
|
|
185
|
+
textColor,
|
|
186
|
+
...radioButtonProps
|
|
187
|
+
}) => {
|
|
188
|
+
return /* @__PURE__ */ jsx("div", {
|
|
189
|
+
ref: wrapperRef,
|
|
190
|
+
children: /* @__PURE__ */ jsx("label", {
|
|
191
|
+
children: /* @__PURE__ */ jsxs(Row, {
|
|
192
|
+
alignItems: "center",
|
|
193
|
+
children: [/* @__PURE__ */ jsx(RadioButton, {
|
|
194
|
+
ref: inputRef,
|
|
195
|
+
...radioButtonProps
|
|
196
|
+
}), /* @__PURE__ */ jsx(Space, {}), /* @__PURE__ */ jsx(Text, {
|
|
197
|
+
color: textColor,
|
|
198
|
+
userSelect: "none",
|
|
199
|
+
children: label
|
|
200
|
+
})]
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
const useKeyboardNavigation = (ref, onKeyDown, onEnter, onEsc, onMove, onDone, onBlur, onFocus) => {
|
|
206
|
+
const wasHandled = useRef(false);
|
|
207
|
+
const onBlurHandler = (ev) => {
|
|
208
|
+
var _a;
|
|
209
|
+
if (!wasHandled.current) {
|
|
210
|
+
onDone == null ? void 0 : onDone((_a = ev.target.value) != null ? _a : "");
|
|
211
|
+
}
|
|
212
|
+
onBlur == null ? void 0 : onBlur(ev);
|
|
213
|
+
};
|
|
214
|
+
const onFocusHandler = (ev) => {
|
|
215
|
+
wasHandled.current = false;
|
|
216
|
+
onFocus == null ? void 0 : onFocus(ev);
|
|
217
|
+
};
|
|
218
|
+
const onKeyDownHandler = useCallback((ev) => {
|
|
219
|
+
var _a;
|
|
220
|
+
const { key } = ev;
|
|
221
|
+
if (key === "Enter") {
|
|
222
|
+
wasHandled.current = true;
|
|
223
|
+
onEnter == null ? void 0 : onEnter();
|
|
224
|
+
onDone == null ? void 0 : onDone((_a = ev.currentTarget.value) != null ? _a : "");
|
|
225
|
+
} else if (key === "Escape") {
|
|
226
|
+
wasHandled.current = true;
|
|
227
|
+
onEsc == null ? void 0 : onEsc();
|
|
228
|
+
ev.preventDefault();
|
|
229
|
+
ev.stopPropagation();
|
|
230
|
+
} else if (onMove) {
|
|
231
|
+
const blurMoveAndCancel = (direction, e) => {
|
|
232
|
+
wasHandled.current = true;
|
|
233
|
+
ref.current.blur();
|
|
234
|
+
onMove(direction);
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
};
|
|
238
|
+
if (ev.shiftKey && key === "Tab") {
|
|
239
|
+
blurMoveAndCancel("left", ev);
|
|
240
|
+
} else if (key === "Tab") {
|
|
241
|
+
blurMoveAndCancel("right", ev);
|
|
242
|
+
} else if (key === "ArrowUp") {
|
|
243
|
+
blurMoveAndCancel("up", ev);
|
|
244
|
+
} else if (key === "ArrowDown") {
|
|
245
|
+
blurMoveAndCancel("down", ev);
|
|
246
|
+
} else if (key === "ArrowRight") {
|
|
247
|
+
if (ref.current.value.length === ref.current.selectionStart) {
|
|
248
|
+
blurMoveAndCancel("right", ev);
|
|
249
|
+
}
|
|
250
|
+
} else if (key === "ArrowLeft") {
|
|
251
|
+
if (ref.current.selectionStart === 0) {
|
|
252
|
+
blurMoveAndCancel("left", ev);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
if (onKeyDown) {
|
|
257
|
+
onKeyDown(ev);
|
|
64
258
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
259
|
+
}, [onEsc, onMove, onKeyDown, ref, onEnter, onDone]);
|
|
260
|
+
return {
|
|
261
|
+
onKeyDownHandler,
|
|
262
|
+
onBlurHandler,
|
|
263
|
+
onFocusHandler
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
function elementHasSelectionRange(element) {
|
|
267
|
+
if (element.tagName === "TEXTAREA") {
|
|
268
|
+
return true;
|
|
67
269
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
style.styleSheet.cssText = css;
|
|
71
|
-
} else {
|
|
72
|
-
style.appendChild(document.createTextNode(css));
|
|
270
|
+
if (element.tagName === "INPUT" && (element.type === "text" || element.type === "search" || element.type === "url" || element.type === "tel" || element.type === "password")) {
|
|
271
|
+
return true;
|
|
73
272
|
}
|
|
273
|
+
return false;
|
|
74
274
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
275
|
+
const useSelectAllOnMount = (ref, moveCursorToEnd, enabled) => {
|
|
276
|
+
useEffect(() => {
|
|
277
|
+
if (!ref.current) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
if (!elementHasSelectionRange(ref.current)) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (enabled) {
|
|
284
|
+
ref.current.setSelectionRange(0, ref.current.value.length);
|
|
285
|
+
} else if (moveCursorToEnd) {
|
|
286
|
+
ref.current.setSelectionRange(ref.current.value.length, ref.current.value.length);
|
|
287
|
+
}
|
|
288
|
+
}, [moveCursorToEnd, ref, enabled]);
|
|
87
289
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
290
|
+
const useTextInput = (ref, {
|
|
291
|
+
onEnter,
|
|
292
|
+
onEsc,
|
|
293
|
+
onChange,
|
|
294
|
+
onValueChange,
|
|
295
|
+
selectAllOnMount,
|
|
296
|
+
moveCursorToEndOnMount,
|
|
297
|
+
onDone,
|
|
298
|
+
onMove,
|
|
299
|
+
onFocus,
|
|
300
|
+
onBlur,
|
|
301
|
+
onKeyDown,
|
|
302
|
+
autoFocus
|
|
303
|
+
}) => {
|
|
304
|
+
useSelectAllOnMount(ref, !!moveCursorToEndOnMount, !!selectAllOnMount);
|
|
305
|
+
const { onKeyDownHandler, onFocusHandler, onBlurHandler } = useKeyboardNavigation(ref, onKeyDown, onEnter, onEsc, onMove, onDone, onBlur, onFocus);
|
|
306
|
+
const onChangeHandler = useCallback((ev) => {
|
|
307
|
+
onChange == null ? void 0 : onChange(ev);
|
|
308
|
+
onValueChange == null ? void 0 : onValueChange(ev.target.value);
|
|
309
|
+
}, [onChange, onValueChange]);
|
|
310
|
+
return {
|
|
311
|
+
onBlur: onBlurHandler,
|
|
312
|
+
onChange: onChangeHandler,
|
|
313
|
+
onFocus: onFocusHandler,
|
|
314
|
+
onKeyDown: onKeyDownHandler,
|
|
315
|
+
autoFocus: selectAllOnMount || autoFocus
|
|
316
|
+
};
|
|
97
317
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
if (onValueChange) {
|
|
125
|
-
onValueChange(ev.target.checked);
|
|
126
|
-
}
|
|
127
|
-
}, [onChange, onValueChange]);
|
|
128
|
-
useEffect(function () {
|
|
129
|
-
if (localRef.current) {
|
|
130
|
-
localRef.current.indeterminate = Boolean(indeterminate);
|
|
131
|
-
}
|
|
132
|
-
}, [indeterminate, localRef]);
|
|
133
|
-
return (React.createElement("input", __assign({ type: "checkbox", className: cx(styles$4.checkbox, styles$4[size]), checked: value, onChange: handleInputChange, ref: setRef }, inputProps)));
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
var CheckboxWithLabel = function (_a) {
|
|
137
|
-
var children = _a.children, label = _a.label, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, textColor = _a.textColor, checkboxProps = __rest(_a, ["children", "label", "inputRef", "wrapperRef", "textColor"]);
|
|
138
|
-
return (React.createElement("div", { ref: wrapperRef },
|
|
139
|
-
React.createElement("label", null,
|
|
140
|
-
React.createElement(Row, { alignItems: "center" },
|
|
141
|
-
React.createElement(Checkbox, __assign({}, checkboxProps, { ref: inputRef })),
|
|
142
|
-
React.createElement(Space, null),
|
|
143
|
-
label && (React.createElement(Text, { userSelect: "none", color: textColor }, label)),
|
|
144
|
-
children))));
|
|
318
|
+
const textInput = "_textInput_ijduv_1";
|
|
319
|
+
const disabled = "_disabled_ijduv_61";
|
|
320
|
+
const input = "_input_ijduv_67";
|
|
321
|
+
const standard = "_standard_ijduv_102";
|
|
322
|
+
const success = "_success_ijduv_103";
|
|
323
|
+
const loading = "_loading_ijduv_115";
|
|
324
|
+
const modified = "_modified_ijduv_120";
|
|
325
|
+
const error = "_error_ijduv_126";
|
|
326
|
+
const warning = "_warning_ijduv_132";
|
|
327
|
+
const hideBorder = "_hideBorder_ijduv_143";
|
|
328
|
+
const clickable = "_clickable_ijduv_149";
|
|
329
|
+
const icon = "_icon_ijduv_154";
|
|
330
|
+
var styles$2 = {
|
|
331
|
+
textInput,
|
|
332
|
+
disabled,
|
|
333
|
+
input,
|
|
334
|
+
standard,
|
|
335
|
+
success,
|
|
336
|
+
loading,
|
|
337
|
+
modified,
|
|
338
|
+
error,
|
|
339
|
+
warning,
|
|
340
|
+
hideBorder,
|
|
341
|
+
clickable,
|
|
342
|
+
icon
|
|
145
343
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
return
|
|
162
|
-
})
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
344
|
+
const TextInputIcon = ({
|
|
345
|
+
icon: icon2,
|
|
346
|
+
iconClassName,
|
|
347
|
+
content,
|
|
348
|
+
spaceOnLeft,
|
|
349
|
+
spaceOnRight,
|
|
350
|
+
disableContentPadding,
|
|
351
|
+
disableContentPaddingLeft,
|
|
352
|
+
disableContentPaddingRight,
|
|
353
|
+
onClick
|
|
354
|
+
}) => {
|
|
355
|
+
if (!content && !icon2) {
|
|
356
|
+
return null;
|
|
357
|
+
}
|
|
358
|
+
if (content) {
|
|
359
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
360
|
+
children: [spaceOnLeft && !(disableContentPadding || disableContentPaddingLeft) ? /* @__PURE__ */ jsx(Space, {}) : null, onClick ? /* @__PURE__ */ jsx("span", {
|
|
361
|
+
onClick,
|
|
362
|
+
className: styles$2.clickable,
|
|
363
|
+
children: content || null
|
|
364
|
+
}) : /* @__PURE__ */ jsx(Fragment, {
|
|
365
|
+
children: content || null
|
|
366
|
+
}), spaceOnRight && !(disableContentPadding || disableContentPaddingRight) ? /* @__PURE__ */ jsx(Space, {}) : null]
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
370
|
+
children: [spaceOnLeft ? /* @__PURE__ */ jsx(Space, {}) : null, icon2 && /* @__PURE__ */ jsx(Fragment, {
|
|
371
|
+
children: onClick ? /* @__PURE__ */ jsx(FlatButton, {
|
|
372
|
+
onClick,
|
|
373
|
+
leftIcon: icon2,
|
|
374
|
+
size: "small"
|
|
375
|
+
}) : /* @__PURE__ */ jsx(FontAwesomeIcon, {
|
|
376
|
+
icon: icon2,
|
|
377
|
+
className: cx(styles$2.icon, iconClassName)
|
|
378
|
+
})
|
|
379
|
+
}), spaceOnRight ? /* @__PURE__ */ jsx(Space, {}) : null]
|
|
380
|
+
});
|
|
172
381
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
382
|
+
const TextInput = (props) => {
|
|
383
|
+
const {
|
|
384
|
+
variant = "standard",
|
|
385
|
+
inputRef,
|
|
386
|
+
disabled: disabled2,
|
|
387
|
+
className,
|
|
388
|
+
contentLeft,
|
|
389
|
+
contentRight,
|
|
390
|
+
disableContentPadding,
|
|
391
|
+
disableContentPaddingLeft,
|
|
392
|
+
disableContentPaddingRight,
|
|
393
|
+
iconLeft,
|
|
394
|
+
iconRight,
|
|
395
|
+
onClickLeft,
|
|
396
|
+
onClickRight,
|
|
397
|
+
moveCursorToEndOnMount,
|
|
398
|
+
selectAllOnMount,
|
|
399
|
+
autoFocus,
|
|
400
|
+
onValueChange,
|
|
401
|
+
wrapperClassName,
|
|
402
|
+
wrapperStyle,
|
|
403
|
+
onDone,
|
|
404
|
+
onEnter,
|
|
405
|
+
onEsc,
|
|
406
|
+
onMove,
|
|
407
|
+
onChange,
|
|
408
|
+
onKeyDown,
|
|
409
|
+
hideBorder: hideBorder2,
|
|
410
|
+
onFocus,
|
|
411
|
+
onBlur,
|
|
412
|
+
...inputProps
|
|
413
|
+
} = props;
|
|
414
|
+
const localRef = useRef(null);
|
|
415
|
+
const refToUse = inputRef != null ? inputRef : localRef;
|
|
416
|
+
const hookProps = useTextInput(refToUse, {
|
|
417
|
+
onEnter,
|
|
418
|
+
onEsc,
|
|
419
|
+
onChange,
|
|
420
|
+
onValueChange,
|
|
421
|
+
selectAllOnMount,
|
|
422
|
+
moveCursorToEndOnMount,
|
|
423
|
+
onDone,
|
|
424
|
+
onMove,
|
|
425
|
+
onFocus,
|
|
426
|
+
onBlur,
|
|
427
|
+
onKeyDown,
|
|
428
|
+
autoFocus
|
|
429
|
+
});
|
|
430
|
+
const currentIconRight = variant === "success" ? stenaCheck : variant === "warning" || variant === "error" ? stenaExclamationTriangle : iconRight;
|
|
431
|
+
const currentContentRight = variant === "loading" ? /* @__PURE__ */ jsx(InputSpinner, {}) : contentRight;
|
|
432
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
433
|
+
className: cx(styles$2.textInput, styles$2[variant], {
|
|
434
|
+
[styles$2.disabled]: disabled2
|
|
435
|
+
}, {
|
|
436
|
+
[styles$2.hideBorder]: hideBorder2
|
|
437
|
+
}, wrapperClassName),
|
|
438
|
+
style: wrapperStyle,
|
|
439
|
+
children: [/* @__PURE__ */ jsx(TextInputIcon, {
|
|
440
|
+
content: contentLeft,
|
|
441
|
+
disableContentPadding,
|
|
442
|
+
disableContentPaddingLeft,
|
|
443
|
+
disableContentPaddingRight,
|
|
444
|
+
icon: iconLeft,
|
|
445
|
+
spaceOnLeft: true,
|
|
446
|
+
onClick: onClickLeft
|
|
447
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
448
|
+
className: cx(styles$2.input, className),
|
|
449
|
+
type: "text",
|
|
450
|
+
disabled: disabled2,
|
|
451
|
+
ref: refToUse,
|
|
452
|
+
autoFocus,
|
|
453
|
+
...inputProps,
|
|
454
|
+
...hookProps
|
|
455
|
+
}), /* @__PURE__ */ jsx(TextInputIcon, {
|
|
456
|
+
content: currentContentRight,
|
|
457
|
+
disableContentPadding,
|
|
458
|
+
disableContentPaddingLeft,
|
|
459
|
+
disableContentPaddingRight,
|
|
460
|
+
icon: currentIconRight,
|
|
461
|
+
spaceOnRight: true,
|
|
462
|
+
onClick: onClickRight
|
|
463
|
+
})]
|
|
464
|
+
});
|
|
249
465
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return true;
|
|
254
|
-
}
|
|
255
|
-
if (element.tagName === "INPUT" &&
|
|
256
|
-
(element.type === "text" ||
|
|
257
|
-
element.type === "search" ||
|
|
258
|
-
element.type === "url" ||
|
|
259
|
-
element.type === "tel" ||
|
|
260
|
-
element.type === "password")) {
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
return false;
|
|
264
|
-
}
|
|
265
|
-
var useSelectAllOnMount = function (ref, moveCursorToEnd, enabled) {
|
|
266
|
-
useEffect(function () {
|
|
267
|
-
if (!ref.current) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
/*
|
|
271
|
-
`selectionStart`, `selectionEnd` properties and `setSelectionRange` method apply only to inputs of types text, search, URL, tel and password.
|
|
272
|
-
Chrome, starting from version 33, throws an exception while accessing those properties and method on the rest of input types.
|
|
273
|
-
https://html.spec.whatwg.org/multipage/input.html#concept-input-apply
|
|
274
|
-
*/
|
|
275
|
-
if (!elementHasSelectionRange(ref.current)) {
|
|
276
|
-
return;
|
|
277
|
-
}
|
|
278
|
-
if (enabled) {
|
|
279
|
-
ref.current.setSelectionRange(0, ref.current.value.length);
|
|
280
|
-
}
|
|
281
|
-
else if (moveCursorToEnd) {
|
|
282
|
-
ref.current.setSelectionRange(ref.current.value.length, ref.current.value.length);
|
|
283
|
-
}
|
|
284
|
-
}, [moveCursorToEnd, ref, enabled]);
|
|
466
|
+
const numericTextInputInput = "_numericTextInputInput_1tnr6_1";
|
|
467
|
+
var styles$1 = {
|
|
468
|
+
numericTextInputInput
|
|
285
469
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
470
|
+
const onStepValueChange = ({
|
|
471
|
+
onValueChange,
|
|
472
|
+
value,
|
|
473
|
+
numSteps,
|
|
474
|
+
min,
|
|
475
|
+
max
|
|
476
|
+
}) => {
|
|
477
|
+
if (onValueChange) {
|
|
478
|
+
if (!value) {
|
|
479
|
+
onValueChange(String(limitWithinRange(numSteps, min, max)));
|
|
480
|
+
} else {
|
|
481
|
+
const parsedValue = parseFloatElseUndefined(value);
|
|
482
|
+
const newValue = (parsedValue || 0) + numSteps;
|
|
483
|
+
onValueChange(String(limitWithinRange(newValue, min, max)));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
302
486
|
};
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
if (
|
|
311
|
-
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
spaceOnRight &&
|
|
319
|
-
!(disableContentPadding || disableContentPaddingRight) ? (React.createElement(Space, null)) : null));
|
|
320
|
-
}
|
|
321
|
-
return (React.createElement(React.Fragment, null,
|
|
322
|
-
spaceOnLeft ? React.createElement(Space, null) : null,
|
|
323
|
-
icon && (React.createElement(React.Fragment, null, onClick ? (React.createElement(FlatButton, { onClick: onClick, leftIcon: icon, size: "small" })) : (React.createElement(FontAwesomeIcon, { icon: icon, className: cx(styles$2.icon, iconClassName) })))),
|
|
324
|
-
spaceOnRight ? React.createElement(Space, null) : null));
|
|
487
|
+
const onTextValueChange = ({
|
|
488
|
+
onValueChange,
|
|
489
|
+
newValue,
|
|
490
|
+
min,
|
|
491
|
+
max
|
|
492
|
+
}) => {
|
|
493
|
+
if (onValueChange) {
|
|
494
|
+
if (newValue === "") {
|
|
495
|
+
onValueChange("");
|
|
496
|
+
} else {
|
|
497
|
+
const parsedValue = parseFloatElseUndefined(newValue);
|
|
498
|
+
const value = parsedValue || 0;
|
|
499
|
+
onValueChange(String(limitWithinRange(value, min, max)));
|
|
500
|
+
}
|
|
501
|
+
}
|
|
325
502
|
};
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
onChange: onChange,
|
|
336
|
-
onValueChange: onValueChange,
|
|
337
|
-
selectAllOnMount: selectAllOnMount,
|
|
338
|
-
moveCursorToEndOnMount: moveCursorToEndOnMount,
|
|
339
|
-
onDone: onDone,
|
|
340
|
-
onMove: onMove,
|
|
341
|
-
onFocus: onFocus,
|
|
342
|
-
onBlur: onBlur,
|
|
343
|
-
onKeyDown: onKeyDown,
|
|
344
|
-
autoFocus: autoFocus,
|
|
345
|
-
});
|
|
346
|
-
var currentIconRight = variant === "success"
|
|
347
|
-
? stenaCheck
|
|
348
|
-
: variant === "warning" || variant === "error"
|
|
349
|
-
? stenaExclamationTriangle
|
|
350
|
-
: iconRight;
|
|
351
|
-
var currentContentRight = variant === "loading" ? React.createElement(InputSpinner, null) : contentRight;
|
|
352
|
-
return (React.createElement("div", { className: cx(styles$2.textInput, styles$2[variant], (_a = {},
|
|
353
|
-
_a[styles$2.disabled] = disabled,
|
|
354
|
-
_a), (_b = {},
|
|
355
|
-
_b[styles$2.hideBorder] = hideBorder,
|
|
356
|
-
_b), wrapperClassName), style: wrapperStyle },
|
|
357
|
-
React.createElement(TextInputIcon, { content: contentLeft, disableContentPadding: disableContentPadding, disableContentPaddingLeft: disableContentPaddingLeft, disableContentPaddingRight: disableContentPaddingRight, icon: iconLeft, spaceOnLeft: true, onClick: onClickLeft }),
|
|
358
|
-
React.createElement("input", __assign({ className: cx(styles$2.input, className), type: "text", disabled: disabled, ref: refToUse, autoFocus: autoFocus }, inputProps, hookProps)),
|
|
359
|
-
React.createElement(TextInputIcon, { content: currentContentRight, disableContentPadding: disableContentPadding, disableContentPaddingLeft: disableContentPaddingLeft, disableContentPaddingRight: disableContentPaddingRight, icon: currentIconRight, spaceOnRight: true, onClick: onClickRight })));
|
|
503
|
+
const limitWithinRange = (value, min, max) => {
|
|
504
|
+
let v = value;
|
|
505
|
+
if (min != null) {
|
|
506
|
+
v = Math.max(min, v);
|
|
507
|
+
}
|
|
508
|
+
if (max != null) {
|
|
509
|
+
v = Math.min(max, v);
|
|
510
|
+
}
|
|
511
|
+
return v;
|
|
360
512
|
};
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
513
|
+
const NumericTextInput = ({
|
|
514
|
+
value,
|
|
515
|
+
onValueChange,
|
|
516
|
+
max,
|
|
517
|
+
min,
|
|
518
|
+
step = 1,
|
|
519
|
+
contentRight,
|
|
520
|
+
disabled: disabled2,
|
|
521
|
+
className,
|
|
522
|
+
hideButtons,
|
|
523
|
+
...restProps
|
|
524
|
+
}) => {
|
|
525
|
+
const onClick = useCallback((numSteps) => {
|
|
526
|
+
onStepValueChange({
|
|
527
|
+
onValueChange,
|
|
528
|
+
value,
|
|
529
|
+
numSteps,
|
|
530
|
+
min,
|
|
531
|
+
max
|
|
532
|
+
});
|
|
533
|
+
}, [value, max, min, onValueChange]);
|
|
534
|
+
const onChange = useCallback((newValue) => {
|
|
535
|
+
onTextValueChange({
|
|
536
|
+
onValueChange,
|
|
537
|
+
newValue,
|
|
538
|
+
min,
|
|
539
|
+
max
|
|
540
|
+
});
|
|
541
|
+
}, [max, min, onValueChange]);
|
|
542
|
+
const contentRightToUse = hideButtons ? contentRight : /* @__PURE__ */ jsxs(Fragment, {
|
|
543
|
+
children: [contentRight && /* @__PURE__ */ jsxs(Fragment, {
|
|
544
|
+
children: [contentRight, /* @__PURE__ */ jsx(Space, {})]
|
|
545
|
+
}), /* @__PURE__ */ jsx(UpDownButtons, {
|
|
546
|
+
onClickUp: disabled2 ? void 0 : () => onClick(step),
|
|
547
|
+
onClickDown: disabled2 ? void 0 : () => onClick(-step),
|
|
548
|
+
iconColor: "var(--swui-textinput-text-color)",
|
|
549
|
+
disabled: disabled2
|
|
550
|
+
})]
|
|
551
|
+
});
|
|
552
|
+
return /* @__PURE__ */ jsx(TextInput, {
|
|
553
|
+
contentRight: contentRightToUse,
|
|
554
|
+
value,
|
|
555
|
+
onValueChange: onChange,
|
|
556
|
+
disableContentPaddingRight: !hideButtons,
|
|
557
|
+
type: "number",
|
|
558
|
+
min,
|
|
559
|
+
max,
|
|
560
|
+
step,
|
|
561
|
+
className: cx(styles$1.numericTextInputInput, className),
|
|
562
|
+
disabled: disabled2,
|
|
563
|
+
...restProps
|
|
564
|
+
});
|
|
401
565
|
};
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
566
|
+
const useNumericInputValue = (value, onValueChange) => {
|
|
567
|
+
const onValueChangeString = useCallback((newValue) => {
|
|
568
|
+
if (onValueChange) {
|
|
569
|
+
if (!newValue) {
|
|
570
|
+
onValueChange(void 0);
|
|
571
|
+
} else {
|
|
572
|
+
const n = parseFloatElseUndefined(newValue);
|
|
573
|
+
if (n !== void 0) {
|
|
574
|
+
onValueChange(n);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}, [onValueChange]);
|
|
579
|
+
const valueString = useMemo(() => {
|
|
580
|
+
if (value === void 0) {
|
|
581
|
+
return "";
|
|
582
|
+
}
|
|
583
|
+
return String(value);
|
|
584
|
+
}, [value]);
|
|
585
|
+
return {
|
|
586
|
+
onValueChange: onValueChangeString,
|
|
587
|
+
value: valueString
|
|
588
|
+
};
|
|
417
589
|
};
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}, [onValueChange]);
|
|
433
|
-
var valueString = useMemo(function () {
|
|
434
|
-
if (value === undefined) {
|
|
435
|
-
return "";
|
|
436
|
-
}
|
|
437
|
-
return String(value);
|
|
438
|
-
}, [value]);
|
|
439
|
-
return {
|
|
440
|
-
onValueChange: onValueChangeString,
|
|
441
|
-
value: valueString,
|
|
442
|
-
};
|
|
590
|
+
const PasswordInput = ({
|
|
591
|
+
hiddenIcon = faEye,
|
|
592
|
+
visibleIcon = faEyeSlash,
|
|
593
|
+
...props
|
|
594
|
+
}) => {
|
|
595
|
+
const [isPassword, setIsPassword] = useState(true);
|
|
596
|
+
return /* @__PURE__ */ jsx(TextInput, {
|
|
597
|
+
iconRight: isPassword ? hiddenIcon : visibleIcon,
|
|
598
|
+
onClickRight: () => setIsPassword((x) => !x),
|
|
599
|
+
type: isPassword ? "password" : "text",
|
|
600
|
+
...props
|
|
601
|
+
});
|
|
443
602
|
};
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
603
|
+
const TextInputBox = ({
|
|
604
|
+
variant = "standard",
|
|
605
|
+
disabled: disabled2,
|
|
606
|
+
wrapperClassName,
|
|
607
|
+
wrapperStyle,
|
|
608
|
+
contentLeft,
|
|
609
|
+
contentRight,
|
|
610
|
+
disableContentPadding,
|
|
611
|
+
disableContentPaddingLeft,
|
|
612
|
+
disableContentPaddingRight,
|
|
613
|
+
iconRight,
|
|
614
|
+
iconLeft,
|
|
615
|
+
onClickLeft,
|
|
616
|
+
onClickRight,
|
|
617
|
+
children
|
|
618
|
+
}) => {
|
|
619
|
+
const currentIconRight = variant === "success" ? stenaCheck : variant === "warning" || variant === "error" ? faExclamationTriangle : iconRight;
|
|
620
|
+
const currentContentRight = variant === "loading" ? /* @__PURE__ */ jsx(InputSpinner, {}) : contentRight;
|
|
621
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
622
|
+
className: cx(styles$2.textInput, styles$2.inputContainer, styles$2[variant], {
|
|
623
|
+
[styles$2.disabled]: disabled2
|
|
624
|
+
}, wrapperClassName),
|
|
625
|
+
style: wrapperStyle,
|
|
626
|
+
children: [/* @__PURE__ */ jsx(TextInputIcon, {
|
|
627
|
+
content: contentLeft,
|
|
628
|
+
disableContentPadding,
|
|
629
|
+
disableContentPaddingLeft,
|
|
630
|
+
disableContentPaddingRight,
|
|
631
|
+
icon: iconLeft,
|
|
632
|
+
spaceOnLeft: true,
|
|
633
|
+
onClick: onClickLeft
|
|
634
|
+
}), /* @__PURE__ */ jsx(Row, {
|
|
635
|
+
alignItems: "center",
|
|
636
|
+
children
|
|
637
|
+
}), /* @__PURE__ */ jsx(TextInputIcon, {
|
|
638
|
+
content: currentContentRight,
|
|
639
|
+
disableContentPadding,
|
|
640
|
+
disableContentPaddingLeft,
|
|
641
|
+
disableContentPaddingRight,
|
|
642
|
+
icon: currentIconRight,
|
|
643
|
+
spaceOnRight: true,
|
|
644
|
+
onClick: onClickRight
|
|
645
|
+
})]
|
|
646
|
+
});
|
|
449
647
|
};
|
|
450
|
-
|
|
451
|
-
var
|
|
452
|
-
|
|
453
|
-
var _c = _a.variant, variant = _c === void 0 ? "standard" : _c, disabled = _a.disabled, wrapperClassName = _a.wrapperClassName, wrapperStyle = _a.wrapperStyle, contentLeft = _a.contentLeft, contentRight = _a.contentRight, disableContentPadding = _a.disableContentPadding, disableContentPaddingLeft = _a.disableContentPaddingLeft, disableContentPaddingRight = _a.disableContentPaddingRight, iconRight = _a.iconRight, iconLeft = _a.iconLeft, onClickLeft = _a.onClickLeft, onClickRight = _a.onClickRight, children = _a.children;
|
|
454
|
-
var currentIconRight = variant === "success"
|
|
455
|
-
? stenaCheck
|
|
456
|
-
: variant === "warning" || variant === "error"
|
|
457
|
-
? faExclamationTriangle
|
|
458
|
-
: iconRight;
|
|
459
|
-
var currentContentRight = variant === "loading" ? React.createElement(InputSpinner, null) : contentRight;
|
|
460
|
-
return (React.createElement("div", { className: cx(styles$2.textInput, styles$2.inputContainer, styles$2[variant], (_b = {},
|
|
461
|
-
_b[styles$2.disabled] = disabled,
|
|
462
|
-
_b), wrapperClassName), style: wrapperStyle },
|
|
463
|
-
React.createElement(TextInputIcon, { content: contentLeft, disableContentPadding: disableContentPadding, disableContentPaddingLeft: disableContentPaddingLeft, disableContentPaddingRight: disableContentPaddingRight, icon: iconLeft, spaceOnLeft: true, onClick: onClickLeft }),
|
|
464
|
-
React.createElement(Row, { alignItems: "center" }, children),
|
|
465
|
-
React.createElement(TextInputIcon, { content: currentContentRight, disableContentPadding: disableContentPadding, disableContentPaddingLeft: disableContentPaddingLeft, disableContentPaddingRight: disableContentPaddingRight, icon: currentIconRight, spaceOnRight: true, onClick: onClickRight })));
|
|
648
|
+
const textArea = "_textArea_1ta4a_1";
|
|
649
|
+
var styles = {
|
|
650
|
+
textArea
|
|
466
651
|
};
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
|
|
652
|
+
const TextArea = forwardRef(({
|
|
653
|
+
className,
|
|
654
|
+
value,
|
|
655
|
+
onValueChange,
|
|
656
|
+
onChange,
|
|
657
|
+
resize = "none",
|
|
658
|
+
readOnly = false,
|
|
659
|
+
rows,
|
|
660
|
+
disabled: disabled2,
|
|
661
|
+
...textAreaProps
|
|
662
|
+
}, ref) => {
|
|
663
|
+
const onChangeHandler = useCallback((ev) => {
|
|
664
|
+
if (onChange) {
|
|
665
|
+
onChange(ev);
|
|
666
|
+
}
|
|
667
|
+
if (onValueChange) {
|
|
668
|
+
onValueChange(ev.target.value);
|
|
669
|
+
}
|
|
670
|
+
}, [onChange, onValueChange]);
|
|
671
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
672
|
+
disabled: disabled2,
|
|
673
|
+
rows,
|
|
674
|
+
readOnly,
|
|
675
|
+
className: cx(styles.textArea, className),
|
|
676
|
+
style: {
|
|
677
|
+
resize
|
|
678
|
+
},
|
|
679
|
+
onChange: onChangeHandler,
|
|
680
|
+
value,
|
|
681
|
+
ref,
|
|
682
|
+
...textAreaProps
|
|
683
|
+
});
|
|
483
684
|
});
|
|
484
|
-
|
|
485
685
|
export { Checkbox, CheckboxWithLabel, NumericTextInput, PasswordInput, RadioButton, RadioButtonWithLabel, Switch, SwitchWithLabel, TextArea, TextInput, TextInputBox, elementHasSelectionRange, onStepValueChange, onTextValueChange, useKeyboardNavigation, useNumericInputValue, useSelectAllOnMount, useTextInput };
|
|
486
686
|
//# sourceMappingURL=index.es.js.map
|