@councilbox/councilbox-ui 1.0.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/HOCs/useDynamicStyles.js +99 -0
- package/dist/HOCs/useRipple.js +91 -0
- package/dist/build-index.js +8 -0
- package/dist/components/1.Introduction.stories.mdx +2 -1
- package/dist/components/2.Changelog.stories.mdx +3 -0
- package/dist/components/3.Guide.stories.mdx +56 -0
- package/dist/components/Accordion/Accordion.css +39 -1
- package/dist/components/Accordion/Accordion.js +84 -45
- package/dist/components/Accordion/Accordion.stories.js +4 -2
- package/dist/components/Accordion/AccordionOld.css +16 -0
- package/dist/components/Accordion/AccordionOld.js +115 -0
- package/dist/components/Accordion/DesignAccordion.stories.js +38 -0
- package/dist/components/Alert/Alert.css +5 -0
- package/dist/components/Alert/Alert.js +17 -6
- package/dist/components/Avatar/Avatar.css +3 -3
- package/dist/components/Avatar/Avatar.js +36 -20
- package/dist/components/Avatar/AvatarOld.js +138 -0
- package/dist/components/Avatar/DesignAvatar.stories.js +1 -1
- package/dist/components/Block/Block.js +17 -2
- package/dist/components/ButtonBasic/ButtonBasic.css +264 -20
- package/dist/components/ButtonBasic/ButtonBasic.js +85 -110
- package/dist/components/ButtonBasic/ButtonBasicOld.css +41 -0
- package/dist/components/ButtonBasic/ButtonBasicOld.js +231 -0
- package/dist/components/Checkbox/Checkbox.css +101 -22
- package/dist/components/Checkbox/Checkbox.js +119 -63
- package/dist/components/Checkbox/CheckboxOld.css +31 -0
- package/dist/components/Checkbox/CheckboxOld.js +112 -0
- package/dist/components/DragDrop/DragDrop.js +24 -9
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +4 -2
- package/dist/components/DrawerPanel/DrawerPanel.css +76 -36
- package/dist/components/DrawerPanel/DrawerPanel.js +137 -115
- package/dist/components/DrawerPanel/DrawerPanelOld.css +56 -0
- package/dist/components/DrawerPanel/DrawerPanelOld.js +233 -0
- package/dist/components/DropDown/DesignDropDown.stories.js +146 -17
- package/dist/components/DropDown/DropDown.css +96 -1
- package/dist/components/DropDown/DropDown.js +363 -82
- package/dist/components/DropDown/DropDown.stories.js +1 -0
- package/dist/components/DropDown/DropDownOld.css +3 -0
- package/dist/components/DropDown/DropDownOld.js +186 -0
- package/dist/components/DropDown/PopoverPlayground.css +22 -0
- package/dist/components/DropDown/PopoverPlayground.js +235 -0
- package/dist/components/EnhancedTable/EnhancedTable.js +5 -6
- package/dist/components/FabButton/DesignFabButton.stories.js +3 -1
- package/dist/components/FabButton/FabButton.js +25 -5
- package/dist/components/Grid/DesignGrid.stories.js +9 -3
- package/dist/components/Grid/Grid.css +325 -0
- package/dist/components/Grid/Grid.js +57 -16
- package/dist/components/Grid/GridItem.js +31 -13
- package/dist/components/Grid/GridItemOld.js +43 -0
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +53 -0
- package/dist/components/Header/Header.js +95 -116
- package/dist/components/IconButton/DesignIconButton.stories.js +22 -2
- package/dist/components/IconButton/IconButton.css +121 -1
- package/dist/components/IconButton/IconButton.js +98 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +138 -0
- package/dist/components/IconButtonSquare/IconButtonSquare.js +20 -90
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +43 -0
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +133 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.css +109 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +316 -77
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +118 -6
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +5 -0
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +178 -0
- package/dist/components/InputPassword/InputPassword.js +10 -20
- package/dist/components/InputText/InputText.css +442 -1
- package/dist/components/InputText/InputText.js +298 -239
- package/dist/components/InputText/InputText.stories.js +12 -3
- package/dist/components/InputText/InputTextOld.css +10 -0
- package/dist/components/InputText/InputTextOld.js +340 -0
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +30 -4
- package/dist/components/InputTextArea/InputTextArea.js +13 -6
- package/dist/components/LoadingSection/LoadingSection.css +44 -2
- package/dist/components/LoadingSection/LoadingSection.js +63 -9
- package/dist/components/MenuItem/DesignMenuItem.stories.js +1 -0
- package/dist/components/MenuItem/MenuItem.css +31 -6
- package/dist/components/MenuItem/MenuItem.js +95 -50
- package/dist/components/MenuItem/MenuItemOld.js +139 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +60 -40
- package/dist/components/MenuLateralRight/MenuLateralRight.js +23 -8
- package/dist/components/Modal/DesignModal.stories.js +54 -0
- package/dist/components/Modal/Modal.css +81 -2
- package/dist/components/Modal/Modal.js +112 -80
- package/dist/components/Modal/Modal.stories.js +13 -2
- package/dist/components/Modal/ModalOld.css +3 -0
- package/dist/components/Modal/ModalOld.js +230 -0
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +9 -1
- package/dist/components/PaginationFooter/PaginationFooter.css +73 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +45 -87
- package/dist/components/RadioButton/Radio.css +115 -16
- package/dist/components/RadioButton/Radio.js +70 -94
- package/dist/components/RadioButton/Radio.stories.js +42 -18
- package/dist/components/RadioButton/RadioOld.css +31 -0
- package/dist/components/RadioButton/RadioOld.js +142 -0
- package/dist/components/Ripple/DesignRipple.js +77 -0
- package/dist/components/Ripple/Ripple.stories.js +45 -0
- package/dist/components/Scrollbar/Scrollbar.js +21 -6
- package/dist/components/SelectInput/DesignSelectInput.js +62 -23
- package/dist/components/SelectInput/SelectInput.css +128 -10
- package/dist/components/SelectInput/SelectInput.js +233 -246
- package/dist/components/SelectInput/SelectInputOld.css +17 -0
- package/dist/components/SelectInput/SelectInputOld.js +325 -0
- package/dist/components/Stars/Stars.css +28 -28
- package/dist/components/Stars/Stars.js +22 -12
- package/dist/components/Stepper/Stepper.css +1 -0
- package/dist/components/Stepper/Stepper.js +81 -24
- package/dist/components/Table/DesignTable.stories.js +1 -0
- package/dist/components/Table/Table.css +56 -53
- package/dist/components/Table/Table.js +55 -75
- package/dist/components/Table/TableOld.css +79 -0
- package/dist/components/Table/TableOld.js +165 -0
- package/dist/components/Tabs/DesignTabs.js +37 -12
- package/dist/components/Tabs/Tabs.css +39 -4
- package/dist/components/Tabs/Tabs.js +194 -30
- package/dist/components/Tabs/Tabs.stories.js +8 -1
- package/dist/components/Tabs/TabsOld.js +92 -0
- package/dist/components/Tag/Tag.js +19 -9
- package/dist/components/Toggle/Toggle.css +122 -3
- package/dist/components/Toggle/Toggle.js +95 -68
- package/dist/components/Tooltip/DesignTooltip.stories.js +48 -0
- package/dist/components/Tooltip/Tooltip.css +75 -0
- package/dist/components/Tooltip/Tooltip.js +126 -0
- package/dist/components/Tooltip/Tooltip.stories.js +40 -0
- package/dist/components/Typography/Typography.css +9 -0
- package/dist/components/Typography/Typography.js +30 -21
- package/dist/components/Typography/TypographyOld.js +132 -0
- package/dist/styles/colorConsts.css +24 -0
- package/dist/styles/main.css +41 -49
- package/dist/styles/scpacingConsts.css +26 -0
- package/dist/styles/zIndexConsts.css +9 -0
- package/package.json +2 -1
|
@@ -9,17 +9,15 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
|
-
|
|
14
12
|
require("../../styles/main.css");
|
|
15
13
|
|
|
16
14
|
require("./InputText.css");
|
|
17
15
|
|
|
18
|
-
var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
|
|
19
|
-
|
|
20
16
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
+
|
|
20
|
+
var _excluded = ["value", "defaultValue", "id", "placeholder", "autoComplete", "shrink", "helperText", "error", "helper", "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"];
|
|
23
21
|
|
|
24
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
23
|
|
|
@@ -31,203 +29,119 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
31
29
|
|
|
32
30
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
31
|
|
|
32
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
33
|
+
|
|
34
|
+
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."); }
|
|
35
|
+
|
|
36
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
37
|
+
|
|
38
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
39
|
+
|
|
40
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
41
|
+
|
|
42
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
43
|
+
|
|
34
44
|
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; }
|
|
35
45
|
|
|
36
46
|
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; }
|
|
37
47
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
'& label.Mui-focused': {
|
|
41
|
-
color: 'var(--primary)',
|
|
42
|
-
borderWidth: '0px!important',
|
|
43
|
-
background: 'white!important',
|
|
44
|
-
transform: 'translate(0 ,-0.625rem) scale(0.75)!important'
|
|
45
|
-
},
|
|
46
|
-
'& .MuiInput-underline:after': {
|
|
47
|
-
borderColor: 'var(--primary)',
|
|
48
|
-
borderBottomColor: 'var(--primary)',
|
|
49
|
-
borderWidth: '2px'
|
|
50
|
-
},
|
|
51
|
-
'& .MuiInputBase-root.MuiInput-root': {
|
|
52
|
-
height: '3rem'
|
|
53
|
-
},
|
|
54
|
-
'& .MuiInputBase-root.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline': {
|
|
55
|
-
borderColor: 'var(--primary)'
|
|
56
|
-
},
|
|
57
|
-
'& .MuiFormHelperText-root': {
|
|
58
|
-
marginTop: 'var(--spacing4)',
|
|
59
|
-
marginLeft: '0px',
|
|
60
|
-
marginRight: '0px'
|
|
61
|
-
},
|
|
62
|
-
'& input.MuiOutlinedInput-input.MuiInputBase-input': {
|
|
63
|
-
height: '1.5rem',
|
|
64
|
-
lineHeight: 'var(--spacing12)',
|
|
65
|
-
padding: 'var(--spacing12) var(--spacing12) var(--spacing12) var(--spacing12)!important',
|
|
66
|
-
paddingRight: 'var(--spacing8)!important'
|
|
67
|
-
},
|
|
68
|
-
'& input.MuiFilledInput-input.MuiInputBase-input': {
|
|
69
|
-
height: '1.5rem',
|
|
70
|
-
lineHeight: 'var(--spacing12)',
|
|
71
|
-
padding: 'var(--spacing12) var(--spacing12) var(--spacing12) 0!important',
|
|
72
|
-
paddingRight: 'var(--spacing8)!important'
|
|
73
|
-
},
|
|
74
|
-
'& .MuiInputLabel-filled.MuiInputLabel-shrink': {
|
|
75
|
-
transform: 'translate(0 ,-0.625rem) scale(0.75)!important'
|
|
76
|
-
},
|
|
77
|
-
'& .MuiInputLabel-outlined.MuiFormLabel-root:not(.MuiInputLabel-shrink)': {
|
|
78
|
-
transform: 'translate(0.875rem ,0.75rem) scale(1)!important'
|
|
79
|
-
},
|
|
80
|
-
'& .MuiInputLabel-outlined.MuiFormLabel-root.MuiInputLabel-shrink': {
|
|
81
|
-
transform: 'translate(0.875rem ,-0.625rem) scale(0.75)!important'
|
|
82
|
-
},
|
|
83
|
-
'& .MuiFormLabel-root.MuiInputLabel-root.MuiInputLabel-formControl.MuiInputLabel-animated.MuiInputLabel-filled:not(.MuiInputLabel-shrink)': {
|
|
84
|
-
transform: 'translate(0 ,0.75rem) scale(1)!important'
|
|
85
|
-
},
|
|
86
|
-
'& .MuiFormLabel-root.MuiInputLabel-root.MuiInputLabel-formControl.MuiInputLabel-animated.MuiInputLabel-standard:not(.MuiInputLabel-shrink)': {
|
|
87
|
-
transform: 'translate(0 ,0.75rem) scale(1)!important'
|
|
88
|
-
},
|
|
89
|
-
'& label.Mui-error': {
|
|
90
|
-
color: 'var(--error)!important'
|
|
91
|
-
},
|
|
92
|
-
'& .MuiInputLabel-shrink': {
|
|
93
|
-
transform: 'translate(0 ,-0.625rem) scale(0.75)!important',
|
|
94
|
-
zIndex: '1'
|
|
95
|
-
},
|
|
96
|
-
'& .MuiOutlinedInput-notchedOutline': {
|
|
97
|
-
transition: '0.2s',
|
|
98
|
-
color: 'var(--gray5)',
|
|
99
|
-
paddingRight: 'var(--spacing8)',
|
|
100
|
-
'& fieldset': {
|
|
101
|
-
borderColor: 'var(--gray3)',
|
|
102
|
-
borderWidth: '0.063rem',
|
|
103
|
-
'& legend': {
|
|
104
|
-
'& span': {
|
|
105
|
-
paddingLeft: 'var(--spacing4)',
|
|
106
|
-
paddingRight: 'var(--spacing4)'
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
'&:hover fieldset': {
|
|
111
|
-
borderColor: 'var(--gray3)',
|
|
112
|
-
borderWidth: '0.125rem'
|
|
113
|
-
},
|
|
114
|
-
'&:active fieldset': {
|
|
115
|
-
borderColor: 'var(--gray3)',
|
|
116
|
-
borderWidth: '0.125rem'
|
|
117
|
-
},
|
|
118
|
-
'&.Mui-focused fieldset': {
|
|
119
|
-
borderColor: 'var(--primary)',
|
|
120
|
-
borderWidth: '0.125rem'
|
|
121
|
-
},
|
|
122
|
-
'&:focus-visible': {
|
|
123
|
-
outline: 'none',
|
|
124
|
-
'& fieldset': {
|
|
125
|
-
outline: 'none',
|
|
126
|
-
boxShadow: '0 0 0 3px white, 0 0 7px 4px var(--primary)',
|
|
127
|
-
border: '0.125rem solid var(--gray4)'
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
'& .MuiOutlinedInput-root.Mui-disabled .MuiOutlinedInput-notchedOutline': {
|
|
132
|
-
border: '0.063rem dashed var(--gray2)'
|
|
133
|
-
},
|
|
134
|
-
'& .MuiOutlinedInput-input.Mui-disabled': {
|
|
135
|
-
color: 'var(--gray5)',
|
|
136
|
-
WebkitTextFillColor: 'unset'
|
|
137
|
-
},
|
|
138
|
-
'& .MuiInputBase-input.Mui-disabled': {
|
|
139
|
-
color: 'var(--gray5)',
|
|
140
|
-
WebkitTextFillColor: 'unset'
|
|
141
|
-
},
|
|
142
|
-
'& .MuiInputLabel-root, .MuiInputBase-root.MuiOutlinedInput-root': {
|
|
143
|
-
color: 'var(--gray5)'
|
|
144
|
-
},
|
|
145
|
-
'& .MuiInputLabel-root.Mui-disabled': {
|
|
146
|
-
color: 'var(--gray3)'
|
|
147
|
-
},
|
|
148
|
-
'& .MuiFormHelperText-root.Mui-focused div h6': {
|
|
149
|
-
color: 'var(--primary)'
|
|
150
|
-
},
|
|
151
|
-
'& .MuiInput-input.MuiInputBase-input': {
|
|
152
|
-
height: '1.5rem',
|
|
153
|
-
lineHeight: 'var(--spacing12)',
|
|
154
|
-
padding: 'var(--spacing12) var(--spacing12) var(--spacing12) 0!important',
|
|
155
|
-
paddingRight: 'var(--spacing8)!important'
|
|
156
|
-
},
|
|
157
|
-
'& textarea.MuiInputBase-input.MuiInput-input.MuiInputBase-inputMultiline': {
|
|
158
|
-
padding: '0!important',
|
|
159
|
-
lineHeight: '1.125rem',
|
|
160
|
-
maxHeight: '2.25rem',
|
|
161
|
-
overflowY: 'auto!important'
|
|
162
|
-
},
|
|
163
|
-
'& input.MuiInputBase-root.MuiOutlinedInput-root': {
|
|
164
|
-
padding: '0'
|
|
165
|
-
},
|
|
166
|
-
'& .MuiInputBase-multiline': {
|
|
167
|
-
fontWeight: '400',
|
|
168
|
-
fontSize: '1rem',
|
|
169
|
-
lineHeight: '1.4375em',
|
|
170
|
-
letterSpacing: '0.00938em',
|
|
171
|
-
boxSizing: 'border-box',
|
|
172
|
-
cursor: 'text',
|
|
173
|
-
display: 'inline-flex',
|
|
174
|
-
alignItems: 'center',
|
|
175
|
-
position: 'relative',
|
|
176
|
-
borderRadius: '0.25rem',
|
|
177
|
-
padding: 'var(--spacing12)!important'
|
|
178
|
-
},
|
|
179
|
-
'& .MuiInputBase-multiline textarea': {
|
|
180
|
-
font: 'inherit',
|
|
181
|
-
letterSpacing: 'inherit',
|
|
182
|
-
color: 'currentcolor',
|
|
183
|
-
border: '0px',
|
|
184
|
-
boxSizing: 'content-box',
|
|
185
|
-
background: 'none',
|
|
186
|
-
height: 'auto',
|
|
187
|
-
margin: '0px',
|
|
188
|
-
display: 'block',
|
|
189
|
-
minWidth: '0px',
|
|
190
|
-
width: '100%',
|
|
191
|
-
animationName: 'mui-auto-fill-cancel',
|
|
192
|
-
animationDuration: '10ms',
|
|
193
|
-
resize: 'none',
|
|
194
|
-
padding: '0px',
|
|
195
|
-
minHeight: '1.5rem'
|
|
196
|
-
},
|
|
197
|
-
'& .MuiInput-underline.MuiInputBase-multiline': {
|
|
198
|
-
paddingLeft: '0!important'
|
|
199
|
-
},
|
|
200
|
-
'& .MuiFormControl-root .MuiFormLabel-root.MuiInputBase-root': {
|
|
201
|
-
marginTop: '0rem!important'
|
|
202
|
-
},
|
|
203
|
-
'& label + .MuiInputBase-root.MuiInput-root': {
|
|
204
|
-
marginTop: '0'
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
});
|
|
48
|
+
var InputText = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
49
|
+
var _props$InputLabelProp;
|
|
208
50
|
|
|
209
|
-
var
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
51
|
+
var _ref$value = _ref.value,
|
|
52
|
+
value = _ref$value === void 0 ? '' : _ref$value,
|
|
53
|
+
defaultValue = _ref.defaultValue,
|
|
54
|
+
id = _ref.id,
|
|
55
|
+
_ref$placeholder = _ref.placeholder,
|
|
56
|
+
placeholder = _ref$placeholder === void 0 ? '' : _ref$placeholder,
|
|
57
|
+
_ref$autoComplete = _ref.autoComplete,
|
|
58
|
+
autoComplete = _ref$autoComplete === void 0 ? 'off' : _ref$autoComplete,
|
|
59
|
+
_ref$shrink = _ref.shrink,
|
|
60
|
+
shrink = _ref$shrink === void 0 ? false : _ref$shrink,
|
|
61
|
+
helperText = _ref.helperText,
|
|
215
62
|
error = _ref.error,
|
|
216
63
|
helper = _ref.helper,
|
|
64
|
+
disabled = _ref.disabled,
|
|
65
|
+
label = _ref.label,
|
|
66
|
+
startAdornment = _ref.startAdornment,
|
|
67
|
+
endAdornment = _ref.endAdornment,
|
|
217
68
|
success = _ref.success,
|
|
218
|
-
|
|
219
|
-
|
|
69
|
+
multiline = _ref.multiline,
|
|
70
|
+
onChange = _ref.onChange,
|
|
71
|
+
_ref$variant = _ref.variant,
|
|
72
|
+
variant = _ref$variant === void 0 ? 'outlined' : _ref$variant,
|
|
73
|
+
type = _ref.type,
|
|
220
74
|
fullWidth = _ref.fullWidth,
|
|
75
|
+
rows = _ref.rows,
|
|
76
|
+
onFocus = _ref.onFocus,
|
|
77
|
+
onBlur = _ref.onBlur,
|
|
78
|
+
onMouseEnter = _ref.onMouseEnter,
|
|
79
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
221
80
|
sx = _ref.sx,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
81
|
+
style = _ref.style,
|
|
82
|
+
propPrefixClass = _ref.prefixClass,
|
|
83
|
+
children = _ref.children,
|
|
84
|
+
onClick = _ref.onClick,
|
|
85
|
+
className = _ref.className,
|
|
86
|
+
readOnly = _ref.readOnly,
|
|
87
|
+
required = _ref.required,
|
|
88
|
+
width = _ref.width,
|
|
89
|
+
renderValue = _ref.renderValue,
|
|
90
|
+
InputProps = _ref.InputProps,
|
|
226
91
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
227
92
|
|
|
93
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
94
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
95
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
96
|
+
|
|
97
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
98
|
+
|
|
99
|
+
var _React$useState = _react.default.useState(false),
|
|
100
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
101
|
+
isInputFocused = _React$useState2[0],
|
|
102
|
+
setIsInputFocused = _React$useState2[1];
|
|
103
|
+
|
|
104
|
+
var _React$useState3 = _react.default.useState(false),
|
|
105
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
106
|
+
isInputHover = _React$useState4[0],
|
|
107
|
+
setIsInputHover = _React$useState4[1];
|
|
108
|
+
|
|
109
|
+
var _React$useState5 = _react.default.useState(defaultValue || value),
|
|
110
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
111
|
+
inputValue = _React$useState6[0],
|
|
112
|
+
setInputValue = _React$useState6[1];
|
|
113
|
+
|
|
114
|
+
var _React$useState7 = _react.default.useState(0),
|
|
115
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
116
|
+
widthLabel = _React$useState8[0],
|
|
117
|
+
setWidthLabel = _React$useState8[1];
|
|
118
|
+
|
|
119
|
+
var textareaRef = _react.default.useRef(null);
|
|
120
|
+
|
|
121
|
+
var inputShrink = !!(shrink || props !== null && props !== void 0 && props.InputLabelProps && props !== null && props !== void 0 && (_props$InputLabelProp = props.InputLabelProps) !== null && _props$InputLabelProp !== void 0 && _props$InputLabelProp.shrink);
|
|
122
|
+
|
|
123
|
+
var getVariant = function getVariant() {
|
|
124
|
+
var variantInput = 'outlined';
|
|
125
|
+
|
|
126
|
+
if (variant === 'outlined') {
|
|
127
|
+
variantInput = variant;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (variant === 'filled') {
|
|
131
|
+
variantInput = variant;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (variant === 'standard') {
|
|
135
|
+
variantInput = variant;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return variantInput;
|
|
139
|
+
};
|
|
140
|
+
|
|
228
141
|
var getIcon = function getIcon() {
|
|
229
142
|
var icon = endAdornment ? /*#__PURE__*/_react.default.createElement("i", {
|
|
230
|
-
className: "cbx-inputText-endAdornment ".concat(endAdornment)
|
|
143
|
+
className: "cbx-inputText-endAdornment ".concat(endAdornment),
|
|
144
|
+
tabIndex: "-1"
|
|
231
145
|
}) : '';
|
|
232
146
|
|
|
233
147
|
if (success) {
|
|
@@ -235,7 +149,8 @@ var InputText = function InputText(_ref) {
|
|
|
235
149
|
className: "cbx-inputText-endAdornment ri-check-line",
|
|
236
150
|
style: {
|
|
237
151
|
color: 'var(--success)'
|
|
238
|
-
}
|
|
152
|
+
},
|
|
153
|
+
tabIndex: "-1"
|
|
239
154
|
});
|
|
240
155
|
}
|
|
241
156
|
|
|
@@ -244,78 +159,220 @@ var InputText = function InputText(_ref) {
|
|
|
244
159
|
className: 'cbx-inputText-endAdornment ri-information-line',
|
|
245
160
|
style: {
|
|
246
161
|
color: 'var(--error)'
|
|
247
|
-
}
|
|
162
|
+
},
|
|
163
|
+
tabIndex: "-1"
|
|
248
164
|
});
|
|
249
165
|
}
|
|
250
166
|
|
|
251
167
|
if (helper) {
|
|
252
168
|
icon = /*#__PURE__*/_react.default.createElement("i", {
|
|
253
|
-
className: 'cbx-inputText-endAdornment ri-information-line'
|
|
169
|
+
className: 'cbx-inputText-endAdornment ri-information-line',
|
|
170
|
+
tabIndex: "-1"
|
|
254
171
|
});
|
|
255
172
|
}
|
|
256
173
|
|
|
257
174
|
return icon;
|
|
258
175
|
};
|
|
259
176
|
|
|
260
|
-
var
|
|
261
|
-
var
|
|
177
|
+
var getIconStartAdornment = function getIconStartAdornment() {
|
|
178
|
+
var icon = startAdornment ? /*#__PURE__*/_react.default.createElement("i", {
|
|
179
|
+
className: "cbx-inputText-startAdornment ".concat(startAdornment),
|
|
180
|
+
tabIndex: "-1"
|
|
181
|
+
}) : '';
|
|
262
182
|
|
|
263
|
-
if (
|
|
264
|
-
|
|
183
|
+
if (InputProps !== null && InputProps !== void 0 && InputProps.startAdornment) {
|
|
184
|
+
icon = InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment;
|
|
265
185
|
}
|
|
266
186
|
|
|
267
|
-
if (
|
|
268
|
-
|
|
187
|
+
if (success) {
|
|
188
|
+
icon = /*#__PURE__*/_react.default.createElement("i", {
|
|
189
|
+
className: "cbx-inputText-startAdornment ri-check-line",
|
|
190
|
+
style: {
|
|
191
|
+
color: 'var(--success)'
|
|
192
|
+
},
|
|
193
|
+
tabIndex: "-1"
|
|
194
|
+
});
|
|
269
195
|
}
|
|
270
196
|
|
|
271
|
-
if (
|
|
272
|
-
|
|
197
|
+
if (error) {
|
|
198
|
+
icon = /*#__PURE__*/_react.default.createElement("i", {
|
|
199
|
+
className: 'cbx-inputText-startAdornment ri-information-line',
|
|
200
|
+
style: {
|
|
201
|
+
color: 'var(--error)'
|
|
202
|
+
},
|
|
203
|
+
tabIndex: "-1"
|
|
204
|
+
});
|
|
273
205
|
}
|
|
274
206
|
|
|
275
|
-
|
|
207
|
+
if (helper) {
|
|
208
|
+
icon = /*#__PURE__*/_react.default.createElement("i", {
|
|
209
|
+
className: 'cbx-inputText-startAdornment ri-information-line',
|
|
210
|
+
tabIndex: "-1"
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return icon;
|
|
276
215
|
};
|
|
277
216
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
217
|
+
var handleInputFocus = function handleInputFocus(event) {
|
|
218
|
+
setIsInputFocused(true);
|
|
219
|
+
|
|
220
|
+
if (onFocus) {
|
|
221
|
+
onFocus(event);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
var handleInputBlur = function handleInputBlur(event) {
|
|
226
|
+
setIsInputFocused(false);
|
|
227
|
+
|
|
228
|
+
if (onBlur) {
|
|
229
|
+
onBlur(event);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
var handleMouseEnter = function handleMouseEnter(event) {
|
|
234
|
+
setIsInputHover(true);
|
|
235
|
+
|
|
236
|
+
if (onMouseEnter) {
|
|
237
|
+
onMouseEnter(event);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
var handleMouseLeave = function handleMouseLeave(event) {
|
|
242
|
+
setIsInputHover(false);
|
|
243
|
+
|
|
244
|
+
if (onMouseLeave) {
|
|
245
|
+
onMouseLeave(event);
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
var handleInputChange = function handleInputChange(event) {
|
|
250
|
+
setInputValue(event.target.value);
|
|
251
|
+
|
|
252
|
+
if (onChange) {
|
|
253
|
+
onChange(event);
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
_react.default.useEffect(function () {
|
|
258
|
+
if (!rows) {
|
|
259
|
+
var textarea = textareaRef.current;
|
|
260
|
+
|
|
261
|
+
var adjustHeight = function adjustHeight() {
|
|
262
|
+
if (textarea) {
|
|
263
|
+
textarea.style.height = 'auto';
|
|
264
|
+
textarea.style.height = "".concat(textarea.scrollHeight, "px");
|
|
290
265
|
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
if (textarea) {
|
|
269
|
+
adjustHeight();
|
|
270
|
+
textarea.addEventListener('input', adjustHeight);
|
|
271
|
+
return function () {
|
|
272
|
+
textarea.removeEventListener('input', adjustHeight);
|
|
273
|
+
};
|
|
291
274
|
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
275
|
+
}
|
|
276
|
+
}, [rows, value]);
|
|
277
|
+
|
|
278
|
+
_react.default.useEffect(function () {
|
|
279
|
+
var hiddenLabel = document.createElement('label');
|
|
280
|
+
hiddenLabel.classList.add('cbx-inputText-label-hidden');
|
|
281
|
+
hiddenLabel.innerText = label;
|
|
282
|
+
hiddenLabel.style.visibility = 'hidden';
|
|
283
|
+
document.body.appendChild(hiddenLabel);
|
|
284
|
+
setWidthLabel(hiddenLabel.clientWidth + 12);
|
|
285
|
+
return function () {
|
|
286
|
+
document.body.removeChild(hiddenLabel);
|
|
287
|
+
};
|
|
288
|
+
}, [label, isInputFocused]);
|
|
289
|
+
|
|
290
|
+
var getLabel = function getLabel() {
|
|
291
|
+
return /*#__PURE__*/_react.default.createElement("label", {
|
|
292
|
+
className: prefixClass("cbx-inputText-label ".concat(getVariant() === 'standard' ? 'cbx-inputText-label-standard' : ''))
|
|
293
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
294
|
+
className: prefixClass('cbx-inputText-label-text')
|
|
295
|
+
}, label), required && /*#__PURE__*/_react.default.createElement("span", {
|
|
296
|
+
className: prefixClass('cbx-inputText-required')
|
|
297
|
+
}, "*"));
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
var Component = type === 'select' || type === 'autocomplete' ? 'input' : type === 'textArea' ? 'textarea' : 'input';
|
|
301
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
302
|
+
className: prefixClass("cbx-inputText-allContainer ".concat(fullWidth || width === '100%' ? 'cbx-inputText-allContainer-fullWidth' : '', " cbx-inputText-allContainer-").concat(getVariant())),
|
|
303
|
+
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
304
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
305
|
+
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 || ''))
|
|
306
|
+
}, ((InputProps === null || InputProps === void 0 ? void 0 : InputProps.startAdornment) || startAdornment) && /*#__PURE__*/_react.default.createElement("div", {
|
|
307
|
+
className: prefixClass('cbx-inputText-startAdornmentContainer')
|
|
308
|
+
}, getIconStartAdornment()), renderValue ? /*#__PURE__*/_react.default.createElement("div", {
|
|
309
|
+
className: prefixClass("cbx-inputText-renderValue-container ".concat(fullWidth || width === '100%' ? 'cbx-inputText-renderValue-container-fullWidth' : '')),
|
|
310
|
+
style: {
|
|
311
|
+
minWidth: width,
|
|
312
|
+
width: width
|
|
313
|
+
}
|
|
314
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
315
|
+
className: prefixClass('cbx-inputText-renderValue-block')
|
|
316
|
+
}, renderValue), /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
317
|
+
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')),
|
|
318
|
+
id: id,
|
|
319
|
+
placeholder: placeholder,
|
|
320
|
+
autoComplete: autoComplete,
|
|
321
|
+
onFocus: handleInputFocus,
|
|
322
|
+
onBlur: handleInputBlur,
|
|
323
|
+
onMouseEnter: handleMouseEnter,
|
|
324
|
+
onMouseLeave: handleMouseLeave,
|
|
325
|
+
value: value || '',
|
|
326
|
+
onChange: handleInputChange,
|
|
297
327
|
disabled: disabled,
|
|
298
|
-
|
|
328
|
+
type: type,
|
|
329
|
+
rows: rows,
|
|
330
|
+
onClick: onClick,
|
|
331
|
+
ref: type === 'textArea' ? textareaRef : ref,
|
|
332
|
+
readOnly: readOnly
|
|
333
|
+
}, props)), getLabel()) : /*#__PURE__*/_react.default.createElement(Component, _extends({
|
|
334
|
+
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')),
|
|
335
|
+
id: id,
|
|
336
|
+
placeholder: placeholder,
|
|
337
|
+
autoComplete: autoComplete,
|
|
338
|
+
onFocus: handleInputFocus,
|
|
339
|
+
onBlur: handleInputBlur,
|
|
340
|
+
onMouseEnter: handleMouseEnter,
|
|
341
|
+
onMouseLeave: handleMouseLeave,
|
|
299
342
|
value: value || '',
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
343
|
+
onChange: handleInputChange,
|
|
344
|
+
disabled: disabled,
|
|
345
|
+
type: type,
|
|
346
|
+
rows: rows,
|
|
347
|
+
onClick: onClick,
|
|
348
|
+
ref: type === 'textArea' ? textareaRef : ref,
|
|
349
|
+
readOnly: readOnly
|
|
350
|
+
}, props)), (getVariant() === 'filled' || getVariant() === 'standard') && /*#__PURE__*/_react.default.createElement("span", {
|
|
351
|
+
className: prefixClass('cbx-inputText-bar')
|
|
352
|
+
}), !renderValue && getLabel(), /*#__PURE__*/_react.default.createElement("fieldset", {
|
|
353
|
+
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' : ''))
|
|
354
|
+
}, /*#__PURE__*/_react.default.createElement("legend", {
|
|
355
|
+
style: {
|
|
356
|
+
width: "".concat(widthLabel, "px")
|
|
314
357
|
}
|
|
315
|
-
},
|
|
316
|
-
|
|
358
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, label))), !multiline && ((InputProps === null || InputProps === void 0 ? void 0 : InputProps.endAdornment) || type !== 'select' && getIcon())), /*#__PURE__*/_react.default.createElement("div", {
|
|
359
|
+
className: prefixClass('cbx-inputText-container-helpers')
|
|
360
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
361
|
+
color: 'var(--gray3)',
|
|
362
|
+
variant: "XS"
|
|
363
|
+
}, helperText), error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
364
|
+
className: prefixClass('cbx-inputText-items-center')
|
|
365
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
366
|
+
variant: "XS",
|
|
367
|
+
color: 'var(--error)'
|
|
368
|
+
}, error)) : helper && /*#__PURE__*/_react.default.createElement("div", {
|
|
369
|
+
className: prefixClass('cbx-inputText-items-center')
|
|
370
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
371
|
+
color: 'var(--gray3)',
|
|
372
|
+
variant: "XS"
|
|
373
|
+
}, helper)))));
|
|
374
|
+
});
|
|
317
375
|
|
|
318
|
-
InputText.displayName = "InputText";
|
|
319
376
|
InputText.propTypes = {
|
|
320
377
|
label: _propTypes.default.string,
|
|
321
378
|
helper: _propTypes.default.string,
|
|
@@ -324,9 +381,10 @@ InputText.propTypes = {
|
|
|
324
381
|
className: _propTypes.default.string,
|
|
325
382
|
onChange: _propTypes.default.func,
|
|
326
383
|
disabled: _propTypes.default.bool,
|
|
327
|
-
error: _propTypes.default.node,
|
|
384
|
+
error: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.bool]),
|
|
328
385
|
success: _propTypes.default.bool,
|
|
329
|
-
fullWidth: _propTypes.default.bool
|
|
386
|
+
fullWidth: _propTypes.default.bool,
|
|
387
|
+
required: _propTypes.default.bool
|
|
330
388
|
};
|
|
331
389
|
InputText.defaultProps = {
|
|
332
390
|
label: '',
|
|
@@ -337,10 +395,11 @@ InputText.defaultProps = {
|
|
|
337
395
|
className: '',
|
|
338
396
|
onChange: undefined,
|
|
339
397
|
disabled: false,
|
|
340
|
-
error:
|
|
398
|
+
error: null,
|
|
341
399
|
fullWidth: false,
|
|
342
400
|
endAdornment: '',
|
|
343
|
-
helperText: ''
|
|
401
|
+
helperText: '',
|
|
402
|
+
required: false
|
|
344
403
|
};
|
|
345
404
|
var _default = InputText;
|
|
346
405
|
exports.default = _default;
|
|
@@ -20,6 +20,12 @@ var _default = {
|
|
|
20
20
|
control: {
|
|
21
21
|
type: 'radio'
|
|
22
22
|
}
|
|
23
|
+
},
|
|
24
|
+
required: {
|
|
25
|
+
options: [true, false],
|
|
26
|
+
control: {
|
|
27
|
+
type: 'boolean'
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
},
|
|
25
31
|
parameters: {
|
|
@@ -47,9 +53,11 @@ Template.displayName = "Template";
|
|
|
47
53
|
var Default = Template.bind({});
|
|
48
54
|
exports.Default = Default;
|
|
49
55
|
Default.args = {
|
|
50
|
-
variant: 'outlined'
|
|
51
|
-
//
|
|
52
|
-
|
|
56
|
+
variant: 'outlined',
|
|
57
|
+
// error: 'asda asd asd asd asd asd asd sad sad asd sad asd asdas dasd as',
|
|
58
|
+
label: 'Occaecat',
|
|
59
|
+
placeholder: 'Occaecat',
|
|
60
|
+
value: 'Occaecat'
|
|
53
61
|
};
|
|
54
62
|
var Helper = Template.bind({});
|
|
55
63
|
exports.Helper = Helper;
|
|
@@ -72,6 +80,7 @@ Disabled.args = {
|
|
|
72
80
|
var ErrorTemplate = Template.bind({});
|
|
73
81
|
exports.ErrorTemplate = ErrorTemplate;
|
|
74
82
|
ErrorTemplate.args = {
|
|
83
|
+
label: 'hola',
|
|
75
84
|
value: 'Occaecat',
|
|
76
85
|
error: 'Error'
|
|
77
86
|
};
|