@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.
Files changed (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/components/ui/checkbox/Checkbox.d.ts +10 -10
  3. package/dist/components/ui/checkbox/CheckboxWithLabel.d.ts +10 -10
  4. package/dist/components/ui/numeric-stepper/NumericStepper.d.ts +6 -6
  5. package/dist/components/ui/numeric-text-input/NumericTextInput.d.ts +10 -10
  6. package/dist/components/ui/numeric-text-input/hooks/UseNumericInputValue.d.ts +4 -4
  7. package/dist/components/ui/password-input/PasswordInput.d.ts +8 -8
  8. package/dist/components/ui/radio/RadioButton.d.ts +8 -8
  9. package/dist/components/ui/radio/RadioButtonWithLabel.d.ts +10 -10
  10. package/dist/components/ui/switch/Switch.d.ts +8 -8
  11. package/dist/components/ui/switch/SwitchWithLabel.d.ts +7 -7
  12. package/dist/components/ui/text-area/TextArea.d.ts +12 -12
  13. package/dist/components/ui/text-input/TextInput.d.ts +43 -43
  14. package/dist/components/ui/text-input/TextInputBox.d.ts +7 -7
  15. package/dist/components/ui/text-input/TextInputIcon.d.ts +14 -14
  16. package/dist/components/ui/text-input/__tests__/TextInput.test.d.ts +1 -1
  17. package/dist/components/ui/types.d.ts +17 -17
  18. package/dist/hooks/UseKeyboardNavigation.d.ts +8 -8
  19. package/dist/hooks/UseSelectAllOnMount.d.ts +4 -4
  20. package/dist/hooks/UseTextInput.d.ts +30 -30
  21. package/dist/index.d.ts +18 -18
  22. package/dist/index.es.js +665 -465
  23. package/dist/index.es.js.map +1 -1
  24. package/dist/index.js +1 -528
  25. package/dist/index.js.map +1 -1
  26. package/dist/storybook-helpers/storybook-controls.d.ts +46 -46
  27. package/dist/utils/NumberComparator.d.ts +2 -2
  28. package/dist/utils/NumericHelpers.d.ts +13 -13
  29. package/package.json +7 -8
  30. package/dist/components/ui/Form.stories.d.ts +0 -6
  31. package/dist/components/ui/checkbox/Checkbox.stories.d.ts +0 -24
  32. package/dist/components/ui/checkbox/CheckboxWithLabel.stories.d.ts +0 -27
  33. package/dist/components/ui/numeric-stepper/NumericStepper.stories.d.ts +0 -40
  34. package/dist/components/ui/numeric-text-input/NumericTextInput.stories.d.ts +0 -57
  35. package/dist/components/ui/password-input/PasswordInput.stories.d.ts +0 -9
  36. package/dist/components/ui/radio/RadioButton.stories.d.ts +0 -25
  37. package/dist/components/ui/radio/RadioButtonWithLabel.stories.d.ts +0 -7
  38. package/dist/components/ui/switch/Switch.stories.d.ts +0 -13
  39. package/dist/components/ui/switch/SwitchWithLabel.stories.d.ts +0 -12
  40. package/dist/components/ui/text-area/TextArea.stories.d.ts +0 -21
  41. package/dist/components/ui/text-input/TextInput.stories.d.ts +0 -62
  42. package/dist/components/ui/text-input/TextInputBox.stories.d.ts +0 -7
  43. package/dist/hooks/__tests__/useSelectAllOnMount.test.d.ts +0 -1
  44. package/dist/utils/__tests__/NumberComparator.test.d.ts +0 -1
  45. 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 { forwardRef, useRef, useCallback, useEffect, useMemo, useState } from 'react';
3
- import { Box, Space, Text, Row, parseFloatElseUndefined } from '@stenajs-webui/core';
4
- import cx from 'classnames';
5
- import { FlatButton, InputSpinner, stenaCheck, stenaExclamationTriangle, 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
-
11
- /*! *****************************************************************************
12
- Copyright (c) Microsoft Corporation.
13
-
14
- Permission to use, copy, modify, and/or distribute this software for any
15
- purpose with or without fee is hereby granted.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
18
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
19
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
20
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
21
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
22
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23
- PERFORMANCE OF THIS SOFTWARE.
24
- ***************************************************************************** */
25
-
26
- var __assign = function() {
27
- __assign = Object.assign || function __assign(t) {
28
- for (var s, i = 1, n = arguments.length; i < n; i++) {
29
- s = arguments[i];
30
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
31
- }
32
- return t;
33
- };
34
- return __assign.apply(this, arguments);
35
- };
36
-
37
- function __rest(s, e) {
38
- var t = {};
39
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
40
- t[p] = s[p];
41
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
42
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
43
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
44
- t[p[i]] = s[p[i]];
45
- }
46
- return t;
47
- }
48
-
49
- function styleInject(css, ref) {
50
- if ( ref === void 0 ) ref = {};
51
- var insertAt = ref.insertAt;
52
-
53
- if (!css || typeof document === 'undefined') { return; }
54
-
55
- var head = document.head || document.getElementsByTagName('head')[0];
56
- var style = document.createElement('style');
57
- style.type = 'text/css';
58
-
59
- if (insertAt === 'top') {
60
- if (head.firstChild) {
61
- head.insertBefore(style, head.firstChild);
62
- } else {
63
- head.appendChild(style);
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
- } else {
66
- head.appendChild(style);
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
- if (style.styleSheet) {
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
- var css_248z$5 = ".Switch-module_switch__aK2ff {\n --swui-switch-width: 50px;\n --swui-switch-height: var(--swui-field-box-size-medium);\n --swui-switch-animation-time: var(--swui-animation-time-medium);\n --swui-switch-selected-highlight-color: var(--swui-primary-action-color);\n --swui-switch-knob-width: calc(var(--swui-switch-height) - 2px);\n /* Backgrounds */\n --swui-switch-knob-bg-color-enabled: var(--swui-handle-bg-enabled-color);\n --swui-switch-knob-bg-color-disabled: var(--swui-handle-bg-disabled-color);\n --swui-switch-container-bg-color-enabled: var(--swui-field-bg-enabled);\n --swui-switch-container-bg-color-disabled: var(--swui-field-bg-disabled);\n /* Borders */\n --swui-switch-knob-border-color-enabled: var(--swui-separator-color);\n --swui-switch-container-border-color: var(--swui-field-border-color);\n --swui-switch-container-border-color-hover: var(\n --swui-field-border-color-hover\n );\n --swui-switch-container-border-color-disabled: var(\n --swui-field-border-color-disabled\n );\n /* Shadow */\n --swui-switch-knob-shadow-color: var(--swui-field-shadow-color);\n\n display: flex;\n flex-direction: row;\n border: 1px solid var(--swui-switch-container-border-color);\n box-sizing: border-box;\n background-color: var(--swui-switch-container-bg-color-enabled);\n height: var(--swui-switch-height);\n width: var(--swui-switch-width);\n border-radius: calc(var(--swui-switch-height) / 2);\n padding: 0;\n margin: 0;\n cursor: pointer;\n transition: background-color var(--swui-switch-animation-time);\n}\n\n .Switch-module_switch__aK2ff:focus {\n outline: 0;\n border: 1px solid var(--swui-switch-selected-highlight-color);\n box-shadow: inset var(--swui-switch-selected-highlight-color) 0 0 4px 0;\n }\n\n .Switch-module_switch__aK2ff:hover {\n border: 1px solid var(--swui-switch-selected-highlight-color);\n }\n\n .Switch-module_switch__aK2ff:disabled {\n cursor: default;\n background-color: var(--swui-switch-container-bg-color-disabled);\n border: 1px solid var(--swui-switch-container-border-color-disabled);\n }\n\n .Switch-module_switch__aK2ff:disabled .Switch-module_knob__1Kx4S {\n background-color: var(--swui-switch-knob-bg-color-disabled);\n }\n\n .Switch-module_switch__aK2ff .Switch-module_filler__184NF {\n flex: none;\n transition: flex var(--swui-switch-animation-time);\n }\n\n .Switch-module_switch__aK2ff .Switch-module_knob__1Kx4S {\n width: var(--swui-switch-knob-width);\n height: var(--swui-switch-knob-width);\n border-radius: 50%;\n background-color: var(--swui-switch-knob-bg-color-enabled);\n box-shadow: var(--swui-switch-knob-shadow-color) 0 0 4px 1px;\n }\n\n.Switch-module_checked__EgDKL {\n border: 1px solid var(--swui-switch-selected-highlight-color);\n background-color: var(--swui-switch-selected-highlight-color);\n}\n\n.Switch-module_checked__EgDKL .Switch-module_filler__184NF {\n flex: 1;\n }\n";
77
- var styles$5 = {"switch":"Switch-module_switch__aK2ff","knob":"Switch-module_knob__1Kx4S","filler":"Switch-module_filler__184NF","checked":"Switch-module_checked__EgDKL"};
78
- styleInject(css_248z$5);
79
-
80
- var styleChecked = "".concat(styles$5.switch, " ").concat(styles$5.checked);
81
- var Switch = function (_a) {
82
- var value = _a.value, disabled = _a.disabled, onValueChange = _a.onValueChange, className = _a.className, wrapperRef = _a.wrapperRef, restProps = __rest(_a, ["value", "disabled", "onValueChange", "className", "wrapperRef"]);
83
- return (React.createElement("div", { className: className, ref: wrapperRef },
84
- React.createElement("button", __assign({ type: "button", role: "switch", "aria-checked": value, className: value ? styleChecked : styles$5.switch, disabled: disabled, onClick: function () { return onValueChange && onValueChange(!value); } }, restProps),
85
- React.createElement("div", { className: styles$5.filler }),
86
- React.createElement("div", { className: styles$5.knob }))));
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
- var SwitchWithLabel = function (_a) {
90
- var label = _a.label, disabled = _a.disabled, textColor = _a.textColor, wrapperRef = _a.wrapperRef, switchProps = __rest(_a, ["label", "disabled", "textColor", "wrapperRef"]);
91
- return (React.createElement("div", { ref: wrapperRef },
92
- React.createElement("label", null,
93
- React.createElement(Box, { row: true, alignItems: "center" },
94
- React.createElement(Switch, __assign({ disabled: disabled }, switchProps)),
95
- React.createElement(Space, null),
96
- React.createElement(Text, { userSelect: "none", color: textColor }, label)))));
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
- var css_248z$4 = ".Checkbox-module_checkbox__Ey0_E {\n --swui-checkbox-height: var(--swui-field-box-size-medium);\n --swui-checkbox-height-small: var(--swui-field-box-size-small);\n --swui-checkbox-border-radius: var(--swui-field-border-radius);\n --swui-checkbox-animation-time: var(--swui-animation-time-medium);\n /* Icon */\n --swui-checkbox-icon-color: var(--swui-field-indicator-active-color);\n --swui-checkbox-disabled-icon-color: var(--swui-field-border-color-disabled);\n --swui-checkbox-unchecked-icon-color: var(\n --swui-field-indicator-inactive-color\n );\n /* Background */\n --swui-checkbox-unchecked-bg-color: var(--swui-white);\n --swui-checkbox-checked-bg-color: var(--swui-primary-action-color);\n --swui-checkbox-disabled-bg-color: var(--swui-field-bg-disabled);\n --swui-checkbox-disabled-checked-bg-color: var(--swui-field-bg-disabled);\n /* Border */\n --swui-checkbox-border-color: var(--swui-field-border-color);\n --swui-checkbox-border-hover-color: var(--swui-field-border-color-hover);\n --swui-checkbox-disabled-border-color: var(\n --swui-field-border-color-disabled\n );\n /* Shadow */\n --swui-checkbox-checked-focus-shadow: var(--swui-field-focus-shadow-inverted);\n --swui-checkbox-unchecked-focus-shadow: var(--swui-field-focus-shadow);\n\n -webkit-appearance: none;\n -moz-appearance: none;\n border-radius: var(--swui-checkbox-border-radius);\n outline: none;\n display: inline-block;\n vertical-align: top;\n position: relative;\n margin: 0;\n cursor: pointer;\n border: 1px solid\n var(--current-border-color, var(--swui-checkbox-border-color));\n background: var(--current-bg-color, var(--swui-checkbox-unchecked-bg-color));\n transition: background var(--swui-checkbox-animation-time),\n border-color var(--swui-checkbox-animation-time),\n box-shadow var(--swui-checkbox-animation-time);\n flex-shrink: 0;\n}\n\n .Checkbox-module_checkbox__Ey0_E.Checkbox-module_standard__1WgNJ {\n width: var(--swui-checkbox-height);\n height: var(--swui-checkbox-height);\n }\n\n .Checkbox-module_checkbox__Ey0_E.Checkbox-module_standard__1WgNJ:after {\n width: 3px;\n height: 6px;\n left: 9px;\n top: 6px;\n }\n\n .Checkbox-module_checkbox__Ey0_E.Checkbox-module_small__IGbRq {\n width: var(--swui-checkbox-height-small);\n height: var(--swui-checkbox-height-small);\n }\n\n .Checkbox-module_checkbox__Ey0_E.Checkbox-module_small__IGbRq:after {\n width: 3px;\n height: 6px;\n left: 5px;\n top: 2px;\n }\n\n .Checkbox-module_checkbox__Ey0_E:after {\n content: \"\";\n display: block;\n position: absolute;\n transition: opacity var(--swui-checkbox-animation-time),\n width var(--swui-checkbox-animation-time),\n top var(--swui-checkbox-animation-time),\n -webkit-transform var(--swui-checkbox-animation-time) var(--d-t-e, ease);\n transition: transform var(--swui-checkbox-animation-time) var(--d-t-e, ease),\n opacity var(--swui-checkbox-animation-time),\n width var(--swui-checkbox-animation-time),\n top var(--swui-checkbox-animation-time);\n transition: transform var(--swui-checkbox-animation-time) var(--d-t-e, ease),\n opacity var(--swui-checkbox-animation-time),\n width var(--swui-checkbox-animation-time),\n top var(--swui-checkbox-animation-time),\n -webkit-transform var(--swui-checkbox-animation-time) var(--d-t-e, ease);\n border: 2px solid\n var(\n --current-checkbox-icon-color,\n var(--swui-checkbox-unchecked-icon-color)\n );\n border-top: 0;\n border-left: 0;\n -webkit-transform: rotate(var(--current-check-rotation, 20deg));\n transform: rotate(var(--current-check-rotation, 20deg));\n box-sizing: content-box;\n }\n\n .Checkbox-module_checkbox__Ey0_E:checked {\n --current-check-rotation: 43deg;\n --current-bg-color: var(--swui-checkbox-checked-bg-color);\n --current-border-color: var(--swui-checkbox-checked-bg-color);\n --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);\n }\n\n .Checkbox-module_checkbox__Ey0_E:checked:after {\n --current-checkbox-icon-color: var(--swui-checkbox-icon-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:disabled:not(:checked) {\n --current-bg-color: var(--swui-checkbox-disabled-bg-color);\n --current-border-color: var(--swui-checkbox-disabled-border-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:disabled:not(:checked):after {\n --current-checkbox-icon-color: --swui-checkbox-unchecked-icon-color;\n }\n\n .Checkbox-module_checkbox__Ey0_E:disabled:checked {\n --current-bg-color: var(--swui-checkbox-disabled-checked-bg-color);\n --current-border-color: var(--swui-checkbox-disabled-border-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:disabled:checked:after {\n --current-checkbox-icon-color: var(--swui-checkbox-disabled-icon-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:disabled:checked + label {\n }\n\n .Checkbox-module_checkbox__Ey0_E:indeterminate {\n --current-check-rotation: 43deg;\n --current-bg-color: var(--swui-checkbox-checked-bg-color);\n --current-border-color: var(--swui-checkbox-checked-bg-color);\n --d-t-e: cubic-bezier(0.2, 0.85, 0.32, 1.2);\n }\n\n .Checkbox-module_checkbox__Ey0_E:indeterminate:after {\n --current-checkbox-icon-color: var(--swui-checkbox-icon-color);\n border-right: 0;\n -webkit-transform: rotate(0deg);\n transform: rotate(0deg);\n width: 6px;\n }\n\n .Checkbox-module_checkbox__Ey0_E:indeterminate.Checkbox-module_standard__1WgNJ:after {\n top: 4px;\n left: 8px;\n }\n\n .Checkbox-module_checkbox__Ey0_E:indeterminate.Checkbox-module_small__IGbRq:after {\n top: 0;\n left: 4px;\n }\n\n .Checkbox-module_checkbox__Ey0_E:indeterminate:disabled:after {\n --current-checkbox-icon-color: var(--swui-checkbox-disabled-icon-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:hover:not(:checked):not(:disabled) {\n --current-border-color: var(--swui-checkbox-border-hover-color);\n }\n\n .Checkbox-module_checkbox__Ey0_E:focus:checked {\n box-shadow: var(--swui-checkbox-checked-focus-shadow);\n }\n\n .Checkbox-module_checkbox__Ey0_E:focus:not(:checked) {\n box-shadow: var(--swui-checkbox-unchecked-focus-shadow);\n }\n\n .Checkbox-module_checkbox__Ey0_E + label {\n font-size: 1.4rem;\n line-height: var(--swui-checkbox-height);\n display: inline-block;\n vertical-align: top;\n cursor: pointer;\n margin-left: 4px;\n }\n";
100
- var styles$4 = {"checkbox":"Checkbox-module_checkbox__Ey0_E","standard":"Checkbox-module_standard__1WgNJ","small":"Checkbox-module_small__IGbRq"};
101
- styleInject(css_248z$4);
102
-
103
- var Checkbox = forwardRef(function (_a, ref) {
104
- var _b = _a.indeterminate, indeterminate = _b === void 0 ? false : _b, onChange = _a.onChange, onValueChange = _a.onValueChange, _c = _a.value, value = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? "standard" : _d, inputProps = __rest(_a, ["indeterminate", "onChange", "onValueChange", "value", "size"]);
105
- var localRef = useRef();
106
- var setRef = function (element) {
107
- localRef.current = element;
108
- if (localRef.current) {
109
- localRef.current.indeterminate = Boolean(indeterminate);
110
- }
111
- if (ref) {
112
- if (typeof ref === "function") {
113
- ref(element);
114
- }
115
- else {
116
- ref.current = element;
117
- }
118
- }
119
- };
120
- var handleInputChange = useCallback(function (ev) {
121
- if (onChange) {
122
- onChange(ev);
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
- var css_248z$3 = ".RadioButton-module_radiobutton__13XTW {\n /* Sizes */\n --swui-radiobutton-size-standard: var(--swui-field-box-size-medium);\n --swui-radiobutton-size-small: var(--swui-field-box-size-small);\n --swui-radiobutton-animation-time: var(--swui-animation-time-medium);\n /* Icon */\n --swui-radiobutton-icon-color: var(--swui-field-indicator-active-color);\n --swui-radiobutton-disabled-icon-color: var(--swui-separator-color);\n --swui-radiobutton-unchecked-icon-color: var(\n --swui-field-indicator-inactive-color\n );\n /* Background */\n --swui-radiobutton-checked-bg-color: var(--swui-primary-action-color);\n --swui-radiobutton-checked-disabled-bg-color: var(--swui-field-bg-disabled);\n --swui-radiobutton-unchecked-bg-color: var(--swui-white);\n --swui-radiobutton-unchecked-disabled-bg-color: var(--swui-field-bg-disabled);\n /* Border */\n --swui-radiobutton-unchecked-border-color: var(--swui-field-border-color);\n --swui-radiobutton-unchecked-hover-border-color: var(\n --swui-field-border-color-hover\n );\n --swui-radiobutton-disabled-border-color: var(\n --swui-field-border-color-disabled\n );\n /* Shadow */\n --swui-radiobutton-checked-focus-shadow: var(\n --swui-field-focus-shadow-inverted\n );\n --swui-radiobutton-unchecked-focus-shadow: var(--swui-field-focus-shadow);\n\n -webkit-appearance: none;\n -moz-appearance: none;\n outline: none;\n display: inline-block;\n vertical-align: top;\n position: relative;\n margin: 0;\n flex: none;\n cursor: pointer;\n border: 1px solid\n var(--current-border-color, var(--swui-radiobutton-unchecked-border-color));\n border-radius: 50%;\n background: var(\n --current-bg-color,\n var(--swui-radiobutton-unchecked-bg-color)\n );\n transition: background var(--swui-radiobutton-animation-time),\n border-color var(--swui-radiobutton-animation-time),\n box-shadow var(--swui-radiobutton-animation-time);\n}\n\n .RadioButton-module_radiobutton__13XTW.RadioButton-module_standard__PVQ2A {\n height: var(--swui-radiobutton-size-standard);\n width: var(--swui-radiobutton-size-standard);\n }\n\n .RadioButton-module_radiobutton__13XTW.RadioButton-module_standard__PVQ2A:after {\n left: 7px;\n top: 7px;\n }\n\n .RadioButton-module_radiobutton__13XTW.RadioButton-module_small__37EpP {\n height: var(--swui-radiobutton-size-small);\n width: var(--swui-radiobutton-size-small);\n }\n\n .RadioButton-module_radiobutton__13XTW.RadioButton-module_small__37EpP:after {\n left: 3px;\n top: 3px;\n }\n\n .RadioButton-module_radiobutton__13XTW:after {\n content: \"\";\n display: block;\n position: absolute;\n transition: opacity\n var(--current-opacity-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease),\n -webkit-transform\n var(--current-transform-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease);\n transition: transform\n var(--current-transform-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease),\n opacity\n var(--current-opacity-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease);\n transition: transform\n var(--current-transform-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease),\n opacity\n var(--current-opacity-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease),\n -webkit-transform\n var(--current-transform-time, var(--swui-radiobutton-animation-time))\n var(--current-transform-type, ease);\n -webkit-transform: scale(var(--current-scale, 0));\n transform: scale(var(--current-scale, 0));\n width: 8px;\n height: 8px;\n border-radius: 50%;\n background: var(\n --current-icon-color,\n var(--swui-radiobutton-unchecked-icon-color)\n );\n opacity: var(--current-opacity, 0);\n }\n\n .RadioButton-module_radiobutton__13XTW:checked {\n --current-bg-color: var(--swui-radiobutton-checked-bg-color);\n --current-border-color: var(--swui-radiobutton-checked-bg-color);\n --current-opacity-time: var(--swui-radiobutton-animation-time);\n --current-transform-time: 0.6s;\n --current-transform-type: cubic-bezier(0.2, 0.85, 0.32, 1.2);\n --current-opacity: 1;\n --current-scale: 1;\n }\n\n .RadioButton-module_radiobutton__13XTW:checked:after {\n --current-icon-color: var(--swui-radiobutton-icon-color);\n }\n\n .RadioButton-module_radiobutton__13XTW:disabled {\n --current-bg-color: var(--swui-radiobutton-unchecked-disabled-bg-color);\n --current-border-color: var(--swui-radiobutton-disabled-border-color);\n }\n\n .RadioButton-module_radiobutton__13XTW:disabled:checked {\n --current-bg-color: var(--swui-radiobutton-checked-disabled-bg-color);\n }\n\n .RadioButton-module_radiobutton__13XTW:disabled:checked:after {\n --current-icon-color: var(--swui-radiobutton-disabled-icon-color);\n }\n\n .RadioButton-module_radiobutton__13XTW:disabled + label {\n }\n\n .RadioButton-module_radiobutton__13XTW:hover:not(:checked):not(:disabled) {\n --current-border-color: var(\n --swui-radiobutton-unchecked-hover-border-color\n );\n }\n\n .RadioButton-module_radiobutton__13XTW:focus:checked {\n box-shadow: var(--swui-radiobutton-checked-focus-shadow);\n }\n\n .RadioButton-module_radiobutton__13XTW:focus:not(:checked) {\n box-shadow: var(--swui-radiobutton-unchecked-focus-shadow);\n }\n\n .RadioButton-module_radiobutton__13XTW + label {\n font-size: 1.4rem;\n line-height: var(--swui-radiobutton-size-standard);\n display: inline-block;\n vertical-align: top;\n cursor: pointer;\n margin-left: 4px;\n }\n";
148
- var styles$3 = {"radiobutton":"RadioButton-module_radiobutton__13XTW","standard":"RadioButton-module_standard__PVQ2A","small":"RadioButton-module_small__37EpP"};
149
- styleInject(css_248z$3);
150
-
151
- var RadioButton = forwardRef(function (_a, ref) {
152
- var onChange = _a.onChange, onValueChange = _a.onValueChange, _b = _a.size, size = _b === void 0 ? "standard" : _b, name = _a.name, inputProps = __rest(_a, ["onChange", "onValueChange", "size", "name"]);
153
- var handleInputChange = useCallback(function (ev) {
154
- if (onChange) {
155
- onChange(ev);
156
- }
157
- if (onValueChange) {
158
- onValueChange(ev.target.value);
159
- }
160
- }, [onChange, onValueChange]);
161
- return (React.createElement("input", __assign({ type: "radio", name: name, className: styles$3.radiobutton + " " + styles$3[size], onChange: handleInputChange, ref: ref }, inputProps)));
162
- });
163
-
164
- var RadioButtonWithLabel = function (_a) {
165
- var label = _a.label, inputRef = _a.inputRef, wrapperRef = _a.wrapperRef, textColor = _a.textColor, radioButtonProps = __rest(_a, ["label", "inputRef", "wrapperRef", "textColor"]);
166
- return (React.createElement("div", { ref: wrapperRef },
167
- React.createElement("label", null,
168
- React.createElement(Row, { alignItems: "center" },
169
- React.createElement(RadioButton, __assign({ ref: inputRef }, radioButtonProps)),
170
- React.createElement(Space, null),
171
- React.createElement(Text, { color: textColor, userSelect: "none" }, label)))));
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
- var useKeyboardNavigation = function (ref,
175
- /**
176
- * User-provided onKeyDown. Internal handler should forward calls to this.
177
- * */
178
- onKeyDown, onEnter, onEsc,
179
- /**
180
- * onMove callback, triggered when user tries to move outside of field using arrow keys, tab or shift+tab.
181
- * */
182
- onMove, onDone, onBlur, onFocus) {
183
- var wasHandled = useRef(false);
184
- var onBlurHandler = function (ev) {
185
- var _a;
186
- if (!wasHandled.current) {
187
- onDone === null || onDone === void 0 ? void 0 : onDone((_a = ev.target.value) !== null && _a !== void 0 ? _a : "");
188
- }
189
- onBlur === null || onBlur === void 0 ? void 0 : onBlur(ev);
190
- };
191
- var onFocusHandler = function (ev) {
192
- wasHandled.current = false;
193
- onFocus === null || onFocus === void 0 ? void 0 : onFocus(ev);
194
- };
195
- var onKeyDownHandler = useCallback(function (ev) {
196
- var _a;
197
- var key = ev.key;
198
- if (key === "Enter") {
199
- wasHandled.current = true;
200
- onEnter === null || onEnter === void 0 ? void 0 : onEnter();
201
- onDone === null || onDone === void 0 ? void 0 : onDone((_a = ev.currentTarget.value) !== null && _a !== void 0 ? _a : "");
202
- }
203
- else if (key === "Escape") {
204
- wasHandled.current = true;
205
- onEsc === null || onEsc === void 0 ? void 0 : onEsc();
206
- ev.preventDefault();
207
- ev.stopPropagation();
208
- }
209
- else if (onMove) {
210
- var blurMoveAndCancel = function (direction, e) {
211
- wasHandled.current = true;
212
- ref.current.blur();
213
- onMove(direction);
214
- e.preventDefault();
215
- e.stopPropagation();
216
- };
217
- if (ev.shiftKey && key === "Tab") {
218
- blurMoveAndCancel("left", ev);
219
- }
220
- else if (key === "Tab") {
221
- blurMoveAndCancel("right", ev);
222
- }
223
- else if (key === "ArrowUp") {
224
- blurMoveAndCancel("up", ev);
225
- }
226
- else if (key === "ArrowDown") {
227
- blurMoveAndCancel("down", ev);
228
- }
229
- else if (key === "ArrowRight") {
230
- if (ref.current.value.length === ref.current.selectionStart) {
231
- blurMoveAndCancel("right", ev);
232
- }
233
- }
234
- else if (key === "ArrowLeft") {
235
- if (ref.current.selectionStart === 0) {
236
- blurMoveAndCancel("left", ev);
237
- }
238
- }
239
- }
240
- if (onKeyDown) {
241
- onKeyDown(ev);
242
- }
243
- }, [onEsc, onMove, onKeyDown, ref, onEnter, onDone]);
244
- return {
245
- onKeyDownHandler: onKeyDownHandler,
246
- onBlurHandler: onBlurHandler,
247
- onFocusHandler: onFocusHandler,
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
- function elementHasSelectionRange(element) {
252
- if (element.tagName === "TEXTAREA") {
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
- var useTextInput = function (ref, _a) {
288
- var onEnter = _a.onEnter, onEsc = _a.onEsc, onChange = _a.onChange, onValueChange = _a.onValueChange, selectAllOnMount = _a.selectAllOnMount, moveCursorToEndOnMount = _a.moveCursorToEndOnMount, onDone = _a.onDone, onMove = _a.onMove, onFocus = _a.onFocus, onBlur = _a.onBlur, onKeyDown = _a.onKeyDown, autoFocus = _a.autoFocus;
289
- useSelectAllOnMount(ref, !!moveCursorToEndOnMount, !!selectAllOnMount);
290
- var _b = useKeyboardNavigation(ref, onKeyDown, onEnter, onEsc, onMove, onDone, onBlur, onFocus), onKeyDownHandler = _b.onKeyDownHandler, onFocusHandler = _b.onFocusHandler, onBlurHandler = _b.onBlurHandler;
291
- var onChangeHandler = useCallback(function (ev) {
292
- onChange === null || onChange === void 0 ? void 0 : onChange(ev);
293
- onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(ev.target.value);
294
- }, [onChange, onValueChange]);
295
- return {
296
- onBlur: onBlurHandler,
297
- onChange: onChangeHandler,
298
- onFocus: onFocusHandler,
299
- onKeyDown: onKeyDownHandler,
300
- autoFocus: selectAllOnMount || autoFocus,
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
- var css_248z$2 = ".TextInput-module_textInput__241mK {\n --swui-textinput-text-color: var(--swui-field-text-color);\n --swui-textinput-text-color-disabled: var(--swui-field-text-color-disabled);\n --swui-textinput-letter-spacing: var(--swui-field-letter-spacing);\n --swui-textinput-line-height: var(--swui-field-text-line-height);\n --swui-textinput-indent: var(--swui-metrics-indent);\n --swui-textinput-spacing: calc(var(--swui-field-text-spacing) - 1px);\n --swui-textinput-font-size: var(--swui-font-size-inputs);\n --swui-textinput-font-family: var(--swui-font-input);\n --swui-textinput-font-weight: var(--swui-font-weight-inputs);\n --swui-textinput-placeholder-color: var(--swui-field-placeholder-color);\n --swui-textinput-animation-time: var(--swui-animation-time-medium);\n --swui-textinput-icon-color: var(--swui-field-border-color-disabled);\n --swui-textinput-icon-hover-color: var(--swui-primary-action-color);\n --swui-textinput-icon-size: var(--swui-field-icon-size);\n\n /* States */\n --swui-textinput-icon-color-success: var(--swui-state-success-color);\n\n --swui-textinput-bg-loading: var(--swui-state-loading-light-color);\n --swui-textinput-border-color-loading: var(--swui-state-loading-color);\n\n --swui-textinput-bg-modified: var(--swui-state-modified-light-color);\n --swui-textinput-border-color-modified: var(--swui-state-modified-color);\n\n --swui-textinput-bg-warning: var(--swui-state-alert-light-color);\n --swui-textinput-border-color-warning: var(--swui-state-alert-color);\n\n --swui-textinput-bg-error: var(--swui-state-error-light-color);\n --swui-textinput-border-color-error: var(--swui-state-error-color);\n\n /* Background */\n --swui-textinput-bg-color: var(--swui-field-bg-enabled);\n --swui-textinput-bg-color-disabled: var(--swui-field-bg-disabled);\n\n /* Border */\n --swui-textinput-border-radius: var(--swui-field-border-radius);\n --swui-textinput-border-color: var(--swui-field-border-color);\n --swui-textinput-border-color-hover: var(--swui-field-border-color-hover);\n --swui-textinput-border-color-disabled: var(\n --swui-field-border-color-disabled\n );\n\n /* Shadow */\n --swui-textinput-focus-shadow: var(--swui-field-focus-shadow);\n\n /* Current vars */\n --current-bg: var(--swui-textinput-bg-color);\n --current-border-color: var(--swui-textinput-border-color);\n --current-icon-color: var(--swui-textinput-icon-color);\n\n /* Styling */\n display: flex;\n width: 100%;\n align-items: center;\n background: var(--current-bg);\n border: 1px solid var(--current-border-color);\n border-radius: var(--swui-textinput-border-radius);\n transition: all var(--swui-textinput-animation-time);\n}\n\n .TextInput-module_textInput__241mK.TextInput-module_textInput__241mK:focus-within:not(.TextInput-module_disabled__1uxhM) {\n box-shadow: var(--swui-textinput-focus-shadow);\n --current-border-color: var(--swui-textinput-border-color-hover);\n --current-bg: var(--swui-textinput-bg-color);\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az {\n letter-spacing: var(--swui-textinput-letter-spacing);\n line-height: var(--swui-textinput-line-height);\n width: 100%;\n padding: var(--swui-textinput-spacing) var(--swui-textinput-indent);\n color: var(--swui-textinput-text-color);\n font-size: var(--swui-textinput-font-size);\n font-family: var(--swui-textinput-font-family);\n font-weight: var(--swui-textinput-font-weight);\n background: var(--swui-hidden);\n border: none;\n min-width: 0; /* https://stackoverflow.com/a/43361500 */\n margin: 0;\n }\n\n /* Safari */\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az:disabled {\n color: var(--swui-textinput-text-color-disabled);\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az::-webkit-input-placeholder {\n color: var(--swui-textinput-placeholder-color);\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az:-ms-input-placeholder {\n color: var(--swui-textinput-placeholder-color);\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az::placeholder {\n color: var(--swui-textinput-placeholder-color);\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az:focus {\n outline: none;\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_input__2k0az::-webkit-calendar-picker-indicator {\n display: none;\n }\n\n /*\n * States\n */\n\n .TextInput-module_textInput__241mK.TextInput-module_standard__UTt4V:hover:not(.TextInput-module_disabled__1uxhM), .TextInput-module_textInput__241mK.TextInput-module_success__12K-z:hover:not(.TextInput-module_disabled__1uxhM) {\n --current-border-color: var(--swui-textinput-border-color-hover);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_success__12K-z {\n --current-icon-color: var(--swui-textinput-icon-color-success);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_loading__oczVY {\n --current-bg: var(--swui-textinput-bg-loading);\n --current-border-color: var(--swui-textinput-border-color-loading);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_modified__2042t {\n --current-bg: var(--swui-textinput-bg-modified);\n --current-border-color: var(--swui-textinput-border-color-modified);\n --current-icon-color: var(--lhds-color-blue-300);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_error__39qGr {\n --current-bg: var(--swui-textinput-bg-error);\n --current-border-color: var(--swui-textinput-border-color-error);\n --current-icon-color: var(--swui-textinput-border-color-error);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_warning__kpGF8 {\n --current-bg: var(--swui-textinput-bg-warning);\n --current-border-color: var(--swui-textinput-border-color-warning);\n --current-icon-color: var(--swui-textinput-border-color-warning);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_disabled__1uxhM {\n --current-bg: var(--swui-textinput-bg-color-disabled);\n --current-border-color: var(--swui-textinput-border-color-disabled);\n }\n\n .TextInput-module_textInput__241mK.TextInput-module_textInput__241mK.TextInput-module_hideBorder__1_dYg {\n border: none;\n box-shadow: none;\n background: none;\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_clickable__2fPUX:hover {\n --current-icon-color: var(--swui-textinput-icon-hover-color);\n cursor: pointer;\n }\n\n .TextInput-module_textInput__241mK .TextInput-module_icon__1U2OO {\n transition: color var(--swui-textinput-animation-time);\n color: var(--current-icon-color);\n font-size: var(--swui-textinput-icon-size);\n }\n";
305
- var styles$2 = {"textInput":"TextInput-module_textInput__241mK","disabled":"TextInput-module_disabled__1uxhM","input":"TextInput-module_input__2k0az","standard":"TextInput-module_standard__UTt4V","success":"TextInput-module_success__12K-z","loading":"TextInput-module_loading__oczVY","modified":"TextInput-module_modified__2042t","error":"TextInput-module_error__39qGr","warning":"TextInput-module_warning__kpGF8","hideBorder":"TextInput-module_hideBorder__1_dYg","clickable":"TextInput-module_clickable__2fPUX","icon":"TextInput-module_icon__1U2OO"};
306
- styleInject(css_248z$2);
307
-
308
- var TextInputIcon = function (_a) {
309
- var icon = _a.icon, iconClassName = _a.iconClassName, content = _a.content, spaceOnLeft = _a.spaceOnLeft, spaceOnRight = _a.spaceOnRight, disableContentPadding = _a.disableContentPadding, disableContentPaddingLeft = _a.disableContentPaddingLeft, disableContentPaddingRight = _a.disableContentPaddingRight, onClick = _a.onClick;
310
- if (!content && !icon) {
311
- return null;
312
- }
313
- if (content) {
314
- return (React.createElement(React.Fragment, null,
315
- spaceOnLeft &&
316
- !(disableContentPadding || disableContentPaddingLeft) ? (React.createElement(Space, null)) : null,
317
- onClick ? (React.createElement("span", { onClick: onClick, className: styles$2.clickable }, content || null)) : (React.createElement(React.Fragment, null, content || null)),
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
- var TextInput = function (props) {
328
- var _a, _b;
329
- var _c = props.variant, variant = _c === void 0 ? "standard" : _c, inputRef = props.inputRef, disabled = props.disabled, className = props.className, contentLeft = props.contentLeft, contentRight = props.contentRight, disableContentPadding = props.disableContentPadding, disableContentPaddingLeft = props.disableContentPaddingLeft, disableContentPaddingRight = props.disableContentPaddingRight, iconLeft = props.iconLeft, iconRight = props.iconRight, onClickLeft = props.onClickLeft, onClickRight = props.onClickRight, moveCursorToEndOnMount = props.moveCursorToEndOnMount, selectAllOnMount = props.selectAllOnMount, autoFocus = props.autoFocus, onValueChange = props.onValueChange, wrapperClassName = props.wrapperClassName, wrapperStyle = props.wrapperStyle, onDone = props.onDone, onEnter = props.onEnter, onEsc = props.onEsc, onMove = props.onMove, onChange = props.onChange, onKeyDown = props.onKeyDown, hideBorder = props.hideBorder, onFocus = props.onFocus, onBlur = props.onBlur, inputProps = __rest(props, ["variant", "inputRef", "disabled", "className", "contentLeft", "contentRight", "disableContentPadding", "disableContentPaddingLeft", "disableContentPaddingRight", "iconLeft", "iconRight", "onClickLeft", "onClickRight", "moveCursorToEndOnMount", "selectAllOnMount", "autoFocus", "onValueChange", "wrapperClassName", "wrapperStyle", "onDone", "onEnter", "onEsc", "onMove", "onChange", "onKeyDown", "hideBorder", "onFocus", "onBlur"]);
330
- var localRef = useRef(null);
331
- var refToUse = inputRef !== null && inputRef !== void 0 ? inputRef : localRef;
332
- var hookProps = useTextInput(refToUse, {
333
- onEnter: onEnter,
334
- onEsc: onEsc,
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
- var css_248z$1 = ".NumericTextInput-module_numericTextInputInput__1UdyM {\n -moz-appearance: textfield;\n}\n .NumericTextInput-module_numericTextInputInput__1UdyM::-webkit-outer-spin-button,\n .NumericTextInput-module_numericTextInputInput__1UdyM::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n";
363
- var styles$1 = {"numericTextInputInput":"NumericTextInput-module_numericTextInputInput__1UdyM"};
364
- styleInject(css_248z$1);
365
-
366
- var onStepValueChange = function (_a) {
367
- var onValueChange = _a.onValueChange, value = _a.value, numSteps = _a.numSteps, min = _a.min, max = _a.max;
368
- if (onValueChange) {
369
- if (!value) {
370
- onValueChange(String(limitWithinRange(numSteps, min, max)));
371
- }
372
- else {
373
- var parsedValue = parseFloatElseUndefined(value);
374
- var newValue = (parsedValue || 0) + numSteps;
375
- onValueChange(String(limitWithinRange(newValue, min, max)));
376
- }
377
- }
378
- };
379
- var onTextValueChange = function (_a) {
380
- var onValueChange = _a.onValueChange, newValue = _a.newValue, min = _a.min, max = _a.max;
381
- if (onValueChange) {
382
- if (newValue === "") {
383
- onValueChange("");
384
- }
385
- else {
386
- var parsedValue = parseFloatElseUndefined(newValue);
387
- var value = parsedValue || 0;
388
- onValueChange(String(limitWithinRange(value, min, max)));
389
- }
390
- }
391
- };
392
- var limitWithinRange = function (value, min, max) {
393
- var v = value;
394
- if (min != null) {
395
- v = Math.max(min, v);
396
- }
397
- if (max != null) {
398
- v = Math.min(max, v);
399
- }
400
- return v;
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
- var NumericTextInput = function (_a) {
404
- var value = _a.value, onValueChange = _a.onValueChange, max = _a.max, min = _a.min, _b = _a.step, step = _b === void 0 ? 1 : _b, contentRight = _a.contentRight, disabled = _a.disabled, className = _a.className, hideButtons = _a.hideButtons, restProps = __rest(_a, ["value", "onValueChange", "max", "min", "step", "contentRight", "disabled", "className", "hideButtons"]);
405
- var onClick = useCallback(function (numSteps) {
406
- onStepValueChange({ onValueChange: onValueChange, value: value, numSteps: numSteps, min: min, max: max });
407
- }, [value, max, min, onValueChange]);
408
- var onChange = useCallback(function (newValue) {
409
- onTextValueChange({ onValueChange: onValueChange, newValue: newValue, min: min, max: max });
410
- }, [max, min, onValueChange]);
411
- var contentRightToUse = hideButtons ? (contentRight) : (React.createElement(React.Fragment, null,
412
- contentRight && (React.createElement(React.Fragment, null,
413
- contentRight,
414
- React.createElement(Space, null))),
415
- React.createElement(UpDownButtons, { onClickUp: disabled ? undefined : function () { return onClick(step); }, onClickDown: disabled ? undefined : function () { return onClick(-step); }, iconColor: "var(--swui-textinput-text-color)", disabled: disabled })));
416
- return (React.createElement(TextInput, __assign({ contentRight: contentRightToUse, value: value, onValueChange: onChange, disableContentPaddingRight: !hideButtons, type: "number", min: min, max: max, step: step, className: cx(styles$1.numericTextInputInput, className), disabled: disabled }, restProps)));
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
- var useNumericInputValue = function (value, onValueChange) {
420
- var onValueChangeString = useCallback(function (newValue) {
421
- if (onValueChange) {
422
- if (!newValue) {
423
- onValueChange(undefined);
424
- }
425
- else {
426
- var n = parseFloatElseUndefined(newValue);
427
- if (n !== undefined) {
428
- onValueChange(n);
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
- var PasswordInput = function (_a) {
446
- var _b = _a.hiddenIcon, hiddenIcon = _b === void 0 ? faEye : _b, _c = _a.visibleIcon, visibleIcon = _c === void 0 ? faEyeSlash : _c, props = __rest(_a, ["hiddenIcon", "visibleIcon"]);
447
- var _d = useState(true), isPassword = _d[0], setIsPassword = _d[1];
448
- return (React.createElement(TextInput, __assign({ iconRight: isPassword ? hiddenIcon : visibleIcon, onClickRight: function () { return setIsPassword(function (x) { return !x; }); }, type: isPassword ? "password" : "text" }, props)));
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 TextInputBox = function (_a) {
452
- var _b;
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
- var css_248z = ".TextArea-module_textArea__RgCLh {\n --swui-textarea-text-color: var(--swui-field-text-color);\n --swui-textarea-text-color-disabled: var(--swui-field-text-color-disabled);\n --swui-textarea-letter-spacing: var(--swui-field-letter-spacing);\n --swui-textarea-line-height: var(--swui-field-text-line-height);\n --swui-textarea-indent: var(--swui-metrics-indent);\n --swui-textarea-spacing: calc(var(--swui-field-text-spacing) - 1px);\n --swui-textarea-font-size: var(--swui-font-size-inputs);\n --swui-textarea-font-family: var(--swui-font-input);\n --swui-textarea-font-weight: var(--swui-font-weight-inputs);\n --swui-textarea-placeholder-color: var(--swui-text-disabled-color);\n --swui-textarea-animation-time: var(--swui-animation-time-medium);\n --swui-textarea-icon-color: var(--swui-field-border-color-disabled);\n --swui-textarea-icon-size: var(--swui-field-icon-size);\n\n /* States */\n --swui-textarea-icon-color-success: var(--swui-state-success-color);\n\n --swui-textarea-bg-loading: var(--swui-state-loading-light-color);\n --swui-textarea-border-color-loading: var(--swui-state-loading-color);\n\n --swui-textarea-bg-modified: var(--swui-state-modified-light-color);\n --swui-textarea-border-color-modified: var(--swui-state-modified-color);\n\n --swui-textarea-bg-warning: var(--swui-state-alert-light-color);\n --swui-textarea-border-color-warning: var(--swui-state-alert-color);\n\n --swui-textarea-bg-error: var(--swui-state-error-light-color);\n --swui-textarea-border-color-error: var(--swui-state-error-color);\n\n /* Background */\n --swui-textarea-bg-color: var(--swui-field-bg-enabled);\n --swui-textarea-bg-color-disabled: var(--swui-field-bg-disabled);\n\n /* Border */\n --swui-textarea-border-radius: var(--swui-field-border-radius);\n --swui-textarea-border-color: var(--swui-field-border-color);\n --swui-textarea-border-color-hover: var(--swui-field-border-color-hover);\n --swui-textarea-border-color-disabled: var(\n --swui-field-border-color-disabled\n );\n /* Shadow */\n --swui-textarea-focus-shadow: var(--swui-field-focus-shadow);\n\n /*\n * Styling\n */\n max-width: 100%;\n letter-spacing: var(--swui-textarea-letter-spacing);\n line-height: var(--swui-textarea-line-height);\n padding: var(--swui-textarea-spacing) var(--swui-textarea-indent);\n color: var(--swui-textarea-text-color);\n font-size: var(--swui-textarea-font-size);\n font-family: var(--swui-textarea-font-family);\n font-weight: var(--swui-textarea-font-weight);\n\n background: var(--current-bg, var(--swui-textarea-bg-color));\n border: 1px solid\n var(--current-border-color, var(--swui-textarea-border-color));\n border-radius: var(--swui-textarea-border-radius);\n transition: border var(--swui-textarea-animation-time);\n --current-icon-color: var(--swui-textarea-icon-color);\n}\n\n .TextArea-module_textArea__RgCLh:focus {\n outline: none;\n box-shadow: var(--swui-textarea-focus-shadow);\n --current-border-color: var(--swui-textarea-border-color-hover);\n --current-bg: var(--swui-textarea-bg-color);\n }\n\n .TextArea-module_textArea__RgCLh:disabled {\n color: var(--swui-textarea-text-color-disabled);\n --current-bg: var(--swui-textarea-bg-color-disabled);\n --current-border-color: var(--swui-textarea-border-color-disabled);\n }\n";
469
- var styles = {"textArea":"TextArea-module_textArea__RgCLh"};
470
- styleInject(css_248z);
471
-
472
- var TextArea = forwardRef(function (_a, ref) {
473
- var className = _a.className, value = _a.value, onValueChange = _a.onValueChange, onChange = _a.onChange, _b = _a.resize, resize = _b === void 0 ? "none" : _b, _c = _a.readOnly, readOnly = _c === void 0 ? false : _c, rows = _a.rows, disabled = _a.disabled, textAreaProps = __rest(_a, ["className", "value", "onValueChange", "onChange", "resize", "readOnly", "rows", "disabled"]);
474
- var onChangeHandler = useCallback(function (ev) {
475
- if (onChange) {
476
- onChange(ev);
477
- }
478
- if (onValueChange) {
479
- onValueChange(ev.target.value);
480
- }
481
- }, [onChange, onValueChange]);
482
- return (React.createElement("textarea", __assign({ disabled: disabled, rows: rows, readOnly: readOnly, className: cx(styles.textArea, className), style: { resize: resize }, onChange: onChangeHandler, value: value, ref: ref }, textAreaProps)));
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