@councilbox/councilbox-ui 2.0.53 → 2.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HOCs/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +18 -38
- package/dist/HOCs/useMenuNavigation.js +110 -0
- package/dist/HOCs/useOverlay.js +87 -0
- package/dist/HOCs/usePopoverPosition.js +228 -0
- package/dist/HOCs/useRipple.js +17 -35
- package/dist/HOCs/useWindowSize.js +24 -42
- package/dist/build-index.js +49 -99
- package/dist/components/1.Introduction.stories.mdx +1 -1
- package/dist/components/2.Changelog.stories.mdx +42 -0
- package/dist/components/3.Guide.stories.mdx +1 -1
- package/dist/components/Accordion/Accordion.css +7 -0
- package/dist/components/Accordion/Accordion.js +97 -102
- package/dist/components/Accordion/Accordion.stories.js +10 -12
- package/dist/components/Accordion/AccordionOld.js +32 -56
- package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
- package/dist/components/Alert/Alert.js +55 -55
- package/dist/components/Alert/Alert.stories.js +10 -11
- package/dist/components/Avatar/Avatar.js +82 -74
- package/dist/components/Avatar/Avatar.stories.js +19 -23
- package/dist/components/Avatar/AvatarOld.js +46 -60
- package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
- package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
- package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
- package/dist/components/Block/Block.css +3 -3
- package/dist/components/Block/Block.js +31 -45
- package/dist/components/Block/Block.stories.js +5 -12
- package/dist/components/Block/DesignBlock.stories.js +7 -13
- package/dist/components/Button/Button.js +44 -66
- package/dist/components/Button/Button.stories.js +8 -14
- package/dist/components/Button/button.css +1 -1
- package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
- package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
- package/dist/components/ButtonBasic/ButtonBasicOld.js +57 -77
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +81 -100
- package/dist/components/Checkbox/Checkbox.stories.js +10 -11
- package/dist/components/Checkbox/CheckboxOld.js +19 -35
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +80 -76
- package/dist/components/DragDrop/DragDrop.stories.js +9 -16
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
- package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
- package/dist/components/DrawerPanel/DrawerPanelOld.js +76 -98
- package/dist/components/DropDown/DesignDropDown.stories.js +79 -97
- package/dist/components/DropDown/DropDown.js +168 -342
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/DropDownOld.js +57 -89
- package/dist/components/DropDown/PopoverPlayground.js +68 -98
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
- package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
- package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
- package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
- package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
- package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
- package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
- package/dist/components/FabButton/FabButton.js +51 -54
- package/dist/components/FabButton/FabButton.stories.js +10 -12
- package/dist/components/Grid/DesignGrid.stories.js +7 -14
- package/dist/components/Grid/Grid.js +38 -46
- package/dist/components/Grid/Grid.stories.js +6 -13
- package/dist/components/Grid/GridItem.js +37 -39
- package/dist/components/Grid/GridItemOld.js +13 -18
- package/dist/components/Grid/GridOld.js +14 -21
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +201 -242
- package/dist/components/Header/Header.stories.js +9 -21
- package/dist/components/Header/header.css +10 -5
- package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
- package/dist/components/IconButton/IconButton.css +6 -1
- package/dist/components/IconButton/IconButton.js +132 -138
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButton/IconButtonOld.js +41 -57
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +11 -25
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +44 -62
- package/dist/components/IconFont/IconFont.js +27 -48
- package/dist/components/IconFont/IconFont.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +43 -62
- package/dist/components/InputPassword/InputPassword.css +0 -6
- package/dist/components/InputPassword/InputPassword.js +58 -73
- package/dist/components/InputPassword/InputPassword.stories.js +5 -11
- package/dist/components/InputText/InputText.css +86 -78
- package/dist/components/InputText/InputText.js +207 -211
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputText/InputTextOld.js +48 -74
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
- package/dist/components/InputTextArea/InputTextArea.js +84 -93
- package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
- package/dist/components/LoadingSection/LoadingSection.js +44 -51
- package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
- package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
- package/dist/components/MenuItem/MenuItem.css +7 -2
- package/dist/components/MenuItem/MenuItem.js +100 -113
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuItem/MenuItemOld.js +40 -56
- package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +120 -157
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
- package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +73 -77
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
- package/dist/components/Modal/DesignModal.stories.js +15 -30
- package/dist/components/Modal/Modal.css +35 -15
- package/dist/components/Modal/Modal.js +154 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/Modal/ModalOld.js +73 -90
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
- package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
- package/dist/components/RadioButton/Radio.css +19 -18
- package/dist/components/RadioButton/Radio.js +65 -83
- package/dist/components/RadioButton/Radio.stories.js +27 -36
- package/dist/components/RadioButton/RadioOld.js +23 -39
- package/dist/components/Ripple/DesignRipple.js +25 -41
- package/dist/components/Ripple/Ripple.stories.js +5 -11
- package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
- package/dist/components/Scrollbar/Scrollbar.js +37 -56
- package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
- package/dist/components/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +101 -155
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/SelectInput/SelectInputOld.js +52 -81
- package/dist/components/Slider/DesignSlider.js +8 -14
- package/dist/components/Slider/Slider.css +57 -37
- package/dist/components/Slider/Slider.js +85 -84
- package/dist/components/Slider/Slider.stories.js +5 -12
- package/dist/components/Spacing/Spacing.js +38 -45
- package/dist/components/Spacing/Spacing.stories.js +5 -11
- package/dist/components/Stars/DesignStars.js +17 -30
- package/dist/components/Stars/Stars.css +55 -104
- package/dist/components/Stars/Stars.js +89 -73
- package/dist/components/Stars/Stars.stories.js +5 -12
- package/dist/components/Stepper/DesignStepper.stories.js +16 -30
- package/dist/components/Stepper/Stepper.css +46 -10
- package/dist/components/Stepper/Stepper.js +118 -134
- package/dist/components/Stepper/Stepper.stories.js +5 -12
- package/dist/components/Table/DesignTable.stories.js +200 -211
- package/dist/components/Table/Table.css +33 -2
- package/dist/components/Table/Table.js +30 -38
- package/dist/components/Table/Table.stories.js +5 -12
- package/dist/components/Table/TableBody.js +22 -34
- package/dist/components/Table/TableCell.js +71 -61
- package/dist/components/Table/TableContainer.js +22 -34
- package/dist/components/Table/TableHead.js +22 -34
- package/dist/components/Table/TableOld.js +52 -84
- package/dist/components/Table/TableRow.js +33 -37
- package/dist/components/Table/TableSortLabel.js +42 -52
- package/dist/components/Tabs/DesignTabs.js +14 -28
- package/dist/components/Tabs/Tabs.css +30 -11
- package/dist/components/Tabs/Tabs.js +151 -137
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tabs/TabsOld.js +28 -42
- package/dist/components/Tag/DesignTags.stories.js +24 -39
- package/dist/components/Tag/Tag.css +61 -42
- package/dist/components/Tag/Tag.js +93 -91
- package/dist/components/Tag/Tag.stories.js +5 -12
- package/dist/components/TextInput/TextInput.js +38 -54
- package/dist/components/TextInput/TextInput.stories.js +5 -11
- package/dist/components/ThemeProvider/Colors.js +2 -2
- package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
- package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
- package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
- package/dist/components/Timeline/Timeline.js +66 -46
- package/dist/components/Timeline/Timeline.stories.js +5 -12
- package/dist/components/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +115 -98
- package/dist/components/Toggle/Toggle.stories.js +10 -11
- package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
- package/dist/components/Tooltip/Tooltip.css +17 -1
- package/dist/components/Tooltip/Tooltip.js +190 -366
- package/dist/components/Tooltip/Tooltip.stories.js +5 -12
- package/dist/components/Typography/Typography.css +57 -6
- package/dist/components/Typography/Typography.js +44 -97
- package/dist/components/Typography/Typography.stories.js +5 -11
- package/dist/components/Typography/TypographyOld.js +29 -42
- package/dist/index.js +2 -6
- package/dist/reportWebVitals.js +8 -14
- package/dist/storybook.test.js +2 -4
- package/dist/styles/colorConsts.css +4 -4
- package/dist/styles/main.css +16 -0
- package/dist/styles/stylesheet.js +10 -22
- package/dist/testing/TestAutocomplete.js +74 -97
- package/dist/testing/TestComponents.js +5 -10
- package/dist/testing/TestDropdown.js +33 -41
- package/dist/utils/autoDetectScroll.js +12 -35
- package/dist/utils/index.js +37 -63
- package/dist/utils/useFallbackId.js +19 -0
- package/package.json +5 -2
|
@@ -1,287 +1,262 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
require("../../styles/main.css");
|
|
13
|
-
|
|
14
11
|
require("./InputText.css");
|
|
15
|
-
|
|
16
12
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
17
|
-
|
|
18
13
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
-
|
|
20
14
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function _extends() { _extends = Object.assign
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
35
|
-
|
|
15
|
+
var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
|
|
16
|
+
var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
17
|
+
var _excluded = ["value", "defaultValue", "id", "placeholder", "autoComplete", "shrink", "helperText", "error", "helper", "tooltipText", "disabled", "label", "startAdornment", "endAdornment", "success", "multiline", "onChange", "variant", "type", "fullWidth", "rows", "onFocus", "onBlur", "onMouseEnter", "onMouseLeave", "sx", "style", "prefixClass", "children", "onClick", "className", "readOnly", "required", "width", "renderValue", "InputProps", "handleOpen", "options", "aria-label"];
|
|
18
|
+
/* eslint-disable no-tabs */
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
20
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
21
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
24
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
25
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
26
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
36
27
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
-
|
|
46
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
47
|
-
|
|
48
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
49
|
-
|
|
50
|
-
var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
28
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
29
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
30
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
32
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
33
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
34
|
+
var InputText = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
51
35
|
var _props$InputLabelProp;
|
|
52
|
-
|
|
53
36
|
var _ref$value = _ref.value,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
var _useDynamicStyles = (0, _useDynamicStyles2
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
37
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
38
|
+
defaultValue = _ref.defaultValue,
|
|
39
|
+
id = _ref.id,
|
|
40
|
+
_ref$placeholder = _ref.placeholder,
|
|
41
|
+
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
42
|
+
_ref$autoComplete = _ref.autoComplete,
|
|
43
|
+
autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
|
|
44
|
+
_ref$shrink = _ref.shrink,
|
|
45
|
+
shrink = _ref$shrink === void 0 ? false : _ref$shrink,
|
|
46
|
+
helperText = _ref.helperText,
|
|
47
|
+
error = _ref.error,
|
|
48
|
+
helper = _ref.helper,
|
|
49
|
+
tooltipText = _ref.tooltipText,
|
|
50
|
+
disabled = _ref.disabled,
|
|
51
|
+
label = _ref.label,
|
|
52
|
+
startAdornment = _ref.startAdornment,
|
|
53
|
+
endAdornment = _ref.endAdornment,
|
|
54
|
+
success = _ref.success,
|
|
55
|
+
multiline = _ref.multiline,
|
|
56
|
+
onChange = _ref.onChange,
|
|
57
|
+
_ref$variant = _ref.variant,
|
|
58
|
+
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
59
|
+
type = _ref.type,
|
|
60
|
+
fullWidth = _ref.fullWidth,
|
|
61
|
+
rows = _ref.rows,
|
|
62
|
+
onFocus = _ref.onFocus,
|
|
63
|
+
onBlur = _ref.onBlur,
|
|
64
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
65
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
66
|
+
sx = _ref.sx,
|
|
67
|
+
style = _ref.style,
|
|
68
|
+
propPrefixClass = _ref.prefixClass,
|
|
69
|
+
children = _ref.children,
|
|
70
|
+
onClick = _ref.onClick,
|
|
71
|
+
className = _ref.className,
|
|
72
|
+
readOnly = _ref.readOnly,
|
|
73
|
+
required = _ref.required,
|
|
74
|
+
width = _ref.width,
|
|
75
|
+
renderValue = _ref.renderValue,
|
|
76
|
+
InputProps = _ref.InputProps,
|
|
77
|
+
handleOpen = _ref.handleOpen,
|
|
78
|
+
options = _ref.options,
|
|
79
|
+
ariaLabel = _ref['aria-label'],
|
|
80
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
81
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
82
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
83
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
102
84
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
var
|
|
120
|
-
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
121
|
-
widthLabel = _React$useState8[0],
|
|
122
|
-
setWidthLabel = _React$useState8[1];
|
|
123
|
-
|
|
124
|
-
var textareaRef = _react.default.useRef(null);
|
|
125
|
-
|
|
85
|
+
var _React$useState = _react["default"].useState(false),
|
|
86
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
87
|
+
isInputFocused = _React$useState2[0],
|
|
88
|
+
setIsInputFocused = _React$useState2[1];
|
|
89
|
+
var _React$useState3 = _react["default"].useState(false),
|
|
90
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
91
|
+
isInputHover = _React$useState4[0],
|
|
92
|
+
setIsInputHover = _React$useState4[1];
|
|
93
|
+
var _React$useState5 = _react["default"].useState(defaultValue || value),
|
|
94
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
95
|
+
inputValue = _React$useState6[0],
|
|
96
|
+
setInputValue = _React$useState6[1];
|
|
97
|
+
var _React$useState7 = _react["default"].useState(0),
|
|
98
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
99
|
+
widthLabel = _React$useState8[0],
|
|
100
|
+
setWidthLabel = _React$useState8[1];
|
|
101
|
+
var textareaRef = _react["default"].useRef(null);
|
|
126
102
|
var inputShrink = !!(shrink || value || defaultValue || props !== null && props !== void 0 && props.InputLabelProps && props !== null && props !== void 0 && (_props$InputLabelProp = props.InputLabelProps) !== null && _props$InputLabelProp !== void 0 && _props$InputLabelProp.shrink);
|
|
127
|
-
|
|
103
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
104
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
105
|
+
var accessibleLabel = label || ariaLabel || placeholder;
|
|
106
|
+
requireAccessibleText(accessibleLabel, {
|
|
107
|
+
component: 'InputText',
|
|
108
|
+
prop: '"label", "aria-label" o "placeholder"',
|
|
109
|
+
hint: 'Un campo de texto (InputText) debe contar con una etiqueta visible (label), un "aria-label" o un "placeholder" descriptivo para ser identificado por los lectores de pantalla.',
|
|
110
|
+
receivedProps: {
|
|
111
|
+
label: label,
|
|
112
|
+
ariaLabel: ariaLabel,
|
|
113
|
+
placeholder: placeholder,
|
|
114
|
+
type: type,
|
|
115
|
+
id: id,
|
|
116
|
+
disabled: disabled
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
var fallbackId = (0, _useFallbackId["default"])('cbx-inputText-id');
|
|
120
|
+
var inputId = id || fallbackId;
|
|
121
|
+
var helperTextId = "".concat(inputId, "-helperText");
|
|
122
|
+
var helperMsgId = "".concat(inputId, "-helperMsg");
|
|
123
|
+
var errorId = "".concat(inputId, "-error");
|
|
124
|
+
var describedBy = [helperText ? helperTextId : null, error ? errorId : helper ? helperMsgId : null].filter(Boolean).join(' ') || undefined;
|
|
128
125
|
var getVariant = function getVariant() {
|
|
129
126
|
var variantInput = 'outlined';
|
|
130
|
-
|
|
131
127
|
if (variant === 'outlined') {
|
|
132
128
|
variantInput = variant;
|
|
133
129
|
}
|
|
134
|
-
|
|
135
130
|
if (variant === 'filled') {
|
|
136
131
|
variantInput = variant;
|
|
137
132
|
}
|
|
138
|
-
|
|
139
133
|
if (variant === 'standard') {
|
|
140
134
|
variantInput = variant;
|
|
141
135
|
}
|
|
142
|
-
|
|
143
136
|
return variantInput;
|
|
144
137
|
};
|
|
145
|
-
|
|
146
138
|
var getIcon = function getIcon() {
|
|
147
|
-
var icon = endAdornment ? /*#__PURE__*/_react
|
|
139
|
+
var icon = endAdornment ? /*#__PURE__*/_react["default"].createElement("i", {
|
|
148
140
|
className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ").concat(endAdornment),
|
|
149
|
-
tabIndex: "-1"
|
|
141
|
+
tabIndex: "-1",
|
|
142
|
+
"aria-hidden": "true"
|
|
150
143
|
}) : '';
|
|
151
|
-
|
|
152
144
|
if (success) {
|
|
153
|
-
icon = /*#__PURE__*/_react
|
|
145
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
154
146
|
className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-check-line"),
|
|
155
147
|
style: {
|
|
156
148
|
color: 'var(--success)'
|
|
157
149
|
},
|
|
158
|
-
tabIndex: "-1"
|
|
150
|
+
tabIndex: "-1",
|
|
151
|
+
"aria-hidden": "true"
|
|
159
152
|
});
|
|
160
153
|
}
|
|
161
|
-
|
|
162
154
|
if (error) {
|
|
163
|
-
icon = /*#__PURE__*/_react
|
|
155
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
164
156
|
className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-information-line"),
|
|
165
157
|
style: {
|
|
166
158
|
color: 'var(--error)'
|
|
167
159
|
},
|
|
168
|
-
tabIndex: "-1"
|
|
160
|
+
tabIndex: "-1",
|
|
161
|
+
"aria-hidden": "true"
|
|
169
162
|
});
|
|
170
163
|
}
|
|
171
|
-
|
|
172
164
|
if (tooltipText) {
|
|
173
|
-
icon = /*#__PURE__*/_react
|
|
165
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
174
166
|
className: "".concat(InputProps !== null && InputProps !== void 0 && InputProps.endAdornmentClass ? InputProps.endAdornmentClass : '', " cbx-inputText-endAdornment ri-information-line"),
|
|
175
|
-
tabIndex: "-1"
|
|
167
|
+
tabIndex: "-1",
|
|
168
|
+
"aria-hidden": "true"
|
|
176
169
|
});
|
|
177
170
|
}
|
|
178
|
-
|
|
179
171
|
if (tooltipText && icon) {
|
|
180
|
-
return /*#__PURE__*/_react
|
|
172
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
181
173
|
title: tooltipText
|
|
182
174
|
}, icon);
|
|
183
175
|
}
|
|
184
|
-
|
|
185
176
|
return icon;
|
|
186
177
|
};
|
|
187
|
-
|
|
188
178
|
var getIconStartAdornment = function getIconStartAdornment() {
|
|
189
|
-
var icon = startAdornment ? /*#__PURE__*/_react
|
|
179
|
+
var icon = startAdornment ? /*#__PURE__*/_react["default"].createElement("i", {
|
|
190
180
|
className: "cbx-inputText-startAdornment ".concat(startAdornment),
|
|
191
|
-
tabIndex: "-1"
|
|
181
|
+
tabIndex: "-1",
|
|
182
|
+
"aria-hidden": "true"
|
|
192
183
|
}) : '';
|
|
193
|
-
|
|
194
184
|
if (InputProps !== null && InputProps !== void 0 && InputProps.startAdornment) {
|
|
195
185
|
icon = InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment;
|
|
196
186
|
}
|
|
197
|
-
|
|
198
187
|
if (success) {
|
|
199
|
-
icon = /*#__PURE__*/_react
|
|
188
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
200
189
|
className: "cbx-inputText-startAdornment ri-check-line",
|
|
201
190
|
style: {
|
|
202
191
|
color: 'var(--success)'
|
|
203
192
|
},
|
|
204
|
-
tabIndex: "-1"
|
|
193
|
+
tabIndex: "-1",
|
|
194
|
+
"aria-hidden": "true"
|
|
205
195
|
});
|
|
206
196
|
}
|
|
207
|
-
|
|
208
197
|
if (error) {
|
|
209
|
-
icon = /*#__PURE__*/_react
|
|
198
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
210
199
|
className: 'cbx-inputText-startAdornment ri-information-line',
|
|
211
200
|
style: {
|
|
212
201
|
color: 'var(--error)'
|
|
213
202
|
},
|
|
214
|
-
tabIndex: "-1"
|
|
203
|
+
tabIndex: "-1",
|
|
204
|
+
"aria-hidden": "true"
|
|
215
205
|
});
|
|
216
206
|
}
|
|
217
|
-
|
|
218
207
|
if (tooltipText) {
|
|
219
|
-
icon = /*#__PURE__*/_react
|
|
208
|
+
icon = /*#__PURE__*/_react["default"].createElement("i", {
|
|
220
209
|
className: 'cbx-inputText-startAdornment ri-information-line',
|
|
221
|
-
tabIndex: "-1"
|
|
210
|
+
tabIndex: "-1",
|
|
211
|
+
"aria-hidden": "true"
|
|
222
212
|
});
|
|
223
213
|
}
|
|
224
|
-
|
|
225
214
|
if (tooltipText && icon) {
|
|
226
|
-
return /*#__PURE__*/_react
|
|
215
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
227
216
|
title: tooltipText
|
|
228
217
|
}, icon);
|
|
229
218
|
}
|
|
230
|
-
|
|
231
219
|
return icon;
|
|
232
220
|
};
|
|
233
|
-
|
|
234
221
|
var handleInputFocus = function handleInputFocus(event) {
|
|
235
222
|
setIsInputFocused(true);
|
|
236
|
-
|
|
237
223
|
if (onFocus) {
|
|
238
224
|
onFocus(event);
|
|
239
225
|
}
|
|
240
226
|
};
|
|
241
|
-
|
|
242
227
|
var handleInputBlur = function handleInputBlur(event) {
|
|
243
228
|
setIsInputFocused(false);
|
|
244
|
-
|
|
245
229
|
if (onBlur) {
|
|
246
230
|
onBlur(event);
|
|
247
231
|
}
|
|
248
232
|
};
|
|
249
|
-
|
|
250
233
|
var handleMouseEnter = function handleMouseEnter(event) {
|
|
251
234
|
setIsInputHover(true);
|
|
252
|
-
|
|
253
235
|
if (onMouseEnter) {
|
|
254
236
|
onMouseEnter(event);
|
|
255
237
|
}
|
|
256
238
|
};
|
|
257
|
-
|
|
258
239
|
var handleMouseLeave = function handleMouseLeave(event) {
|
|
259
240
|
setIsInputHover(false);
|
|
260
|
-
|
|
261
241
|
if (onMouseLeave) {
|
|
262
242
|
onMouseLeave(event);
|
|
263
243
|
}
|
|
264
244
|
};
|
|
265
|
-
|
|
266
245
|
var handleInputChange = function handleInputChange(event) {
|
|
267
246
|
setInputValue(event.target.value);
|
|
268
|
-
|
|
269
247
|
if (onChange) {
|
|
270
248
|
onChange(event);
|
|
271
249
|
}
|
|
272
250
|
};
|
|
273
|
-
|
|
274
|
-
_react.default.useEffect(function () {
|
|
251
|
+
_react["default"].useEffect(function () {
|
|
275
252
|
if (!rows) {
|
|
276
253
|
var textarea = textareaRef.current;
|
|
277
|
-
|
|
278
254
|
var adjustHeight = function adjustHeight() {
|
|
279
255
|
if (textarea) {
|
|
280
256
|
textarea.style.height = 'auto';
|
|
281
257
|
textarea.style.height = "".concat(textarea.scrollHeight, "px");
|
|
282
258
|
}
|
|
283
259
|
};
|
|
284
|
-
|
|
285
260
|
if (textarea) {
|
|
286
261
|
adjustHeight();
|
|
287
262
|
textarea.addEventListener('input', adjustHeight);
|
|
@@ -291,65 +266,73 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
291
266
|
}
|
|
292
267
|
}
|
|
293
268
|
}, [rows, value]);
|
|
294
|
-
|
|
295
|
-
_react.default.useEffect(function () {
|
|
269
|
+
_react["default"].useEffect(function () {
|
|
296
270
|
setInputValue(defaultValue || value);
|
|
297
271
|
}, [value]);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
272
|
+
_react["default"].useEffect(function () {
|
|
273
|
+
if (!label) {
|
|
274
|
+
setWidthLabel(0);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
var hiddenLabel = document.createElement('span');
|
|
301
278
|
hiddenLabel.classList.add('cbx-inputText-label-hidden');
|
|
302
279
|
hiddenLabel.innerText = label;
|
|
280
|
+
hiddenLabel.setAttribute('aria-hidden', 'true');
|
|
303
281
|
hiddenLabel.style.visibility = 'hidden';
|
|
282
|
+
hiddenLabel.style.position = 'absolute';
|
|
283
|
+
hiddenLabel.style.top = '-9999px';
|
|
304
284
|
document.body.appendChild(hiddenLabel);
|
|
305
285
|
setWidthLabel(hiddenLabel.clientWidth + 12);
|
|
306
286
|
return function () {
|
|
307
|
-
document.body.
|
|
287
|
+
if (document.body.contains(hiddenLabel)) {
|
|
288
|
+
document.body.removeChild(hiddenLabel);
|
|
289
|
+
}
|
|
308
290
|
};
|
|
309
291
|
}, [label, isInputFocused]);
|
|
310
|
-
|
|
311
292
|
var getLabel = function getLabel() {
|
|
312
|
-
|
|
293
|
+
if (!label) return null;
|
|
294
|
+
return /*#__PURE__*/_react["default"].createElement("label", {
|
|
295
|
+
htmlFor: inputId,
|
|
313
296
|
className: prefixClass("cbx-inputText-label ".concat(getVariant() === 'standard' ? 'cbx-inputText-label-standard' : ''))
|
|
314
|
-
}, /*#__PURE__*/_react
|
|
297
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
315
298
|
className: prefixClass('cbx-inputText-label-text')
|
|
316
|
-
}, label), required && /*#__PURE__*/_react
|
|
317
|
-
className: prefixClass('cbx-inputText-required')
|
|
299
|
+
}, label), required && /*#__PURE__*/_react["default"].createElement("span", {
|
|
300
|
+
className: prefixClass('cbx-inputText-required'),
|
|
301
|
+
"aria-hidden": "true"
|
|
318
302
|
}, "*"));
|
|
319
303
|
};
|
|
320
|
-
|
|
321
304
|
var Component = type === 'select' || type === 'autocomplete' ? 'input' : type === 'textArea' ? 'textarea' : 'input';
|
|
322
|
-
|
|
323
305
|
var handleKeyDown = function handleKeyDown(event) {
|
|
324
306
|
if (type === 'number') {
|
|
325
307
|
if (['e', 'E'].includes(event.key)) {
|
|
326
308
|
event.preventDefault();
|
|
327
309
|
}
|
|
328
310
|
}
|
|
329
|
-
|
|
330
311
|
if (props !== null && props !== void 0 && props.onKeyDown) {
|
|
331
312
|
props.onKeyDown(event);
|
|
332
313
|
}
|
|
333
314
|
};
|
|
334
|
-
|
|
335
|
-
|
|
315
|
+
var accessibleLabelProps = !label ? {
|
|
316
|
+
'aria-label': ariaLabel || placeholder || 'Campo de texto'
|
|
317
|
+
} : {};
|
|
318
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
336
319
|
className: prefixClass("cbx-inputText-allContainer ".concat(fullWidth || width === '100%' ? 'cbx-inputText-allContainer-fullWidth' : '', " cbx-inputText-allContainer-").concat(getVariant())),
|
|
337
320
|
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
338
|
-
}, /*#__PURE__*/_react
|
|
321
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
339
322
|
className: prefixClass("cbx-inputText-container ".concat(fullWidth || width === '100%' ? 'cbx-inputText-container-fullWidth' : '', " ").concat(getIcon() || InputProps !== null && InputProps !== void 0 && InputProps.endAdornment ? 'cbx-inputText-icon' : '', " ").concat(InputProps !== null && InputProps !== void 0 && InputProps.startAdornment || startAdornment ? 'cbx-inputText-icon-startAdornment' : '', " cbx-inputText-container-").concat(type, " cbx-inputText-container-").concat(getVariant(), " ").concat(disabled ? 'cbx-inputText-container-disabled' : '', " ").concat(type === 'textArea' ? 'cbx-inputText-container-textArea' : '', " ").concat(className || ''))
|
|
340
|
-
}, ((InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment) || startAdornment) && /*#__PURE__*/_react
|
|
323
|
+
}, ((InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment) || startAdornment) && /*#__PURE__*/_react["default"].createElement("div", {
|
|
341
324
|
className: prefixClass('cbx-inputText-startAdornmentContainer')
|
|
342
|
-
}, getIconStartAdornment()), renderValue ? /*#__PURE__*/_react
|
|
325
|
+
}, getIconStartAdornment()), renderValue ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
343
326
|
className: prefixClass("cbx-inputText-renderValue-container ".concat(fullWidth || width === '100%' ? 'cbx-inputText-renderValue-container-fullWidth' : '')),
|
|
344
327
|
style: {
|
|
345
328
|
minWidth: width,
|
|
346
329
|
width: width
|
|
347
330
|
}
|
|
348
|
-
}, /*#__PURE__*/_react
|
|
331
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
349
332
|
className: prefixClass('cbx-inputText-renderValue-block')
|
|
350
|
-
}, renderValue), /*#__PURE__*/_react
|
|
333
|
+
}, renderValue), /*#__PURE__*/_react["default"].createElement(Component, _extends({
|
|
351
334
|
className: prefixClass("cbx-input cbx-inputText cbx-inputText-".concat(getVariant(), " cbx-inputText-").concat(type, " cbx-inputText-renderValue ").concat(inputShrink && !isInputFocused ? 'shrink' : '', " ").concat(error ? 'cbx-inputText-error' : '', " ").concat(label ? '' : 'cbx-inputText-notLabel')),
|
|
352
|
-
id:
|
|
335
|
+
id: inputId,
|
|
353
336
|
placeholder: placeholder,
|
|
354
337
|
autoComplete: autoComplete,
|
|
355
338
|
onFocus: handleInputFocus,
|
|
@@ -364,10 +347,12 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
364
347
|
onClick: onClick,
|
|
365
348
|
ref: type === 'textArea' ? textareaRef : ref,
|
|
366
349
|
readOnly: readOnly,
|
|
367
|
-
|
|
368
|
-
|
|
350
|
+
required: required,
|
|
351
|
+
"aria-invalid": !!error,
|
|
352
|
+
"aria-describedby": describedBy
|
|
353
|
+
}, accessibleLabelProps, props)), getLabel()) : /*#__PURE__*/_react["default"].createElement(Component, _extends({
|
|
369
354
|
className: prefixClass("cbx-input cbx-inputText cbx-inputText-".concat(getVariant(), " cbx-inputText-").concat(type, " ").concat(inputShrink && !isInputFocused ? 'shrink' : '', " ").concat(error ? 'cbx-inputText-error' : '', " ").concat(label ? '' : 'cbx-inputText-notLabel')),
|
|
370
|
-
id:
|
|
355
|
+
id: inputId,
|
|
371
356
|
placeholder: placeholder,
|
|
372
357
|
autoComplete: autoComplete,
|
|
373
358
|
onFocus: handleInputFocus,
|
|
@@ -383,50 +368,61 @@ var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
|
383
368
|
onClick: onClick,
|
|
384
369
|
ref: type === 'textArea' ? textareaRef : ref,
|
|
385
370
|
readOnly: readOnly,
|
|
386
|
-
|
|
387
|
-
|
|
371
|
+
required: required,
|
|
372
|
+
"aria-invalid": !!error,
|
|
373
|
+
"aria-describedby": describedBy
|
|
374
|
+
}, accessibleLabelProps, props)), (getVariant() === 'filled' || getVariant() === 'standard') && /*#__PURE__*/_react["default"].createElement("span", {
|
|
388
375
|
className: prefixClass('cbx-inputText-bar')
|
|
389
|
-
}), !renderValue && getLabel(), type === 'autocomplete' && (options === null || options === void 0 ? void 0 : options.length) > 0 && /*#__PURE__*/_react
|
|
376
|
+
}), !renderValue && getLabel(), type === 'autocomplete' && (options === null || options === void 0 ? void 0 : options.length) > 0 && /*#__PURE__*/_react["default"].createElement("button", {
|
|
377
|
+
type: "button",
|
|
390
378
|
className: prefixClass('cbx-inputText-autocomplete-button-open'),
|
|
391
|
-
onClick: !disabled ? handleOpen : undefined
|
|
392
|
-
|
|
379
|
+
onClick: !disabled ? handleOpen : undefined,
|
|
380
|
+
disabled: disabled,
|
|
381
|
+
"aria-label": ariaLabel || 'Open options',
|
|
382
|
+
"aria-haspopup": "listbox"
|
|
383
|
+
}), /*#__PURE__*/_react["default"].createElement("fieldset", {
|
|
393
384
|
className: prefixClass("cbx-inputText-fieldset cbx-inputText-fieldset-".concat(getVariant(), " ").concat(isInputHover ? 'hover' : '', " ").concat(isInputFocused ? 'focused' : '', " ").concat(inputValue && !isInputFocused ? 'focusedNo value' : '', " ").concat(!label ? 'noLabel' : '', " ").concat(inputShrink && !isInputFocused ? 'focusedNo value shrink' : '')),
|
|
394
|
-
"aria-
|
|
395
|
-
}, /*#__PURE__*/_react
|
|
385
|
+
"aria-hidden": "true"
|
|
386
|
+
}, /*#__PURE__*/_react["default"].createElement("legend", {
|
|
396
387
|
style: {
|
|
397
388
|
width: "".concat(widthLabel, "px")
|
|
398
389
|
}
|
|
399
|
-
}, /*#__PURE__*/_react
|
|
390
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
391
|
+
"aria-hidden": "true"
|
|
392
|
+
}, label))), !multiline && ((InputProps === null || InputProps === void 0 ? void 0 : InputProps.endAdornment) || type !== 'select' && getIcon())), /*#__PURE__*/_react["default"].createElement("div", {
|
|
400
393
|
className: prefixClass('cbx-inputText-container-helpers')
|
|
401
|
-
}, /*#__PURE__*/_react
|
|
394
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
395
|
+
id: helperText ? helperTextId : undefined,
|
|
402
396
|
color: 'var(--gray3)',
|
|
403
397
|
variant: "XS",
|
|
404
398
|
component: 'span'
|
|
405
|
-
}, helperText), error ? /*#__PURE__*/_react
|
|
399
|
+
}, helperText), error ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
406
400
|
className: prefixClass('cbx-inputText-items-center')
|
|
407
|
-
}, /*#__PURE__*/_react
|
|
401
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
402
|
+
id: errorId,
|
|
408
403
|
variant: "XS",
|
|
409
|
-
color: 'var(--error)'
|
|
410
|
-
|
|
404
|
+
color: 'var(--error)',
|
|
405
|
+
role: "alert"
|
|
406
|
+
}, error)) : helper && /*#__PURE__*/_react["default"].createElement("div", {
|
|
411
407
|
className: prefixClass('cbx-inputText-items-center')
|
|
412
|
-
}, /*#__PURE__*/_react
|
|
408
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
409
|
+
id: helperMsgId,
|
|
413
410
|
color: 'var(--gray3)',
|
|
414
411
|
variant: "XS"
|
|
415
412
|
}, helper)))));
|
|
416
413
|
});
|
|
417
|
-
|
|
418
414
|
InputText.propTypes = {
|
|
419
|
-
label: _propTypes
|
|
420
|
-
helper: _propTypes
|
|
421
|
-
width: _propTypes
|
|
422
|
-
id: _propTypes
|
|
423
|
-
className: _propTypes
|
|
424
|
-
onChange: _propTypes
|
|
425
|
-
disabled: _propTypes
|
|
426
|
-
error: _propTypes
|
|
427
|
-
success: _propTypes
|
|
428
|
-
fullWidth: _propTypes
|
|
429
|
-
required: _propTypes
|
|
415
|
+
label: _propTypes["default"].string,
|
|
416
|
+
helper: _propTypes["default"].string,
|
|
417
|
+
width: _propTypes["default"].string,
|
|
418
|
+
id: _propTypes["default"].string,
|
|
419
|
+
className: _propTypes["default"].string,
|
|
420
|
+
onChange: _propTypes["default"].func,
|
|
421
|
+
disabled: _propTypes["default"].bool,
|
|
422
|
+
error: _propTypes["default"].oneOfType([_propTypes["default"].node, _propTypes["default"].bool]),
|
|
423
|
+
success: _propTypes["default"].bool,
|
|
424
|
+
fullWidth: _propTypes["default"].bool,
|
|
425
|
+
required: _propTypes["default"].bool
|
|
430
426
|
};
|
|
431
427
|
InputText.defaultProps = {
|
|
432
428
|
label: '',
|
|
@@ -444,4 +440,4 @@ InputText.defaultProps = {
|
|
|
444
440
|
required: false
|
|
445
441
|
};
|
|
446
442
|
var _default = InputText;
|
|
447
|
-
exports
|
|
443
|
+
exports["default"] = _default;
|