@councilbox/councilbox-ui 0.3.9 → 0.3.11
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/components/InputText/InputText.js +10 -8
- package/dist/components/SelectInput/DesignSelectInput.js +65 -0
- package/dist/components/SelectInput/SelectInput.css +10 -0
- package/dist/components/SelectInput/SelectInput.js +137 -11
- package/dist/components/SelectInput/SelectInput.stories.js +1 -1
- package/dist/components/TextInput/TextInput.js +3 -6
- package/package.json +1 -1
- package/dist/components/SelectInput/DesignSelectInput.stories.js +0 -36
|
@@ -19,7 +19,7 @@ var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
|
|
|
19
19
|
|
|
20
20
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
21
21
|
|
|
22
|
-
var _excluded = ["id", "className", "onChange", "label", "disabled", "error", "helper", "success", "width", "helperText", "fullWidth"];
|
|
22
|
+
var _excluded = ["id", "className", "onChange", "label", "disabled", "error", "helper", "success", "width", "helperText", "fullWidth", "sx"];
|
|
23
23
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
25
|
|
|
@@ -32,9 +32,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
32
32
|
var CssTextField = (0, _styled.default)(_TextField.default)(function () {
|
|
33
33
|
return {
|
|
34
34
|
'& label.Mui-focused': {
|
|
35
|
-
color: 'primary',
|
|
36
|
-
borderWidth: '
|
|
37
|
-
background: 'white',
|
|
35
|
+
color: 'var(--primary)',
|
|
36
|
+
borderWidth: '0px!important',
|
|
37
|
+
background: 'white!important',
|
|
38
38
|
top: '1px'
|
|
39
39
|
},
|
|
40
40
|
'& .MuiInput-underline:after': {
|
|
@@ -61,7 +61,7 @@ var CssTextField = (0, _styled.default)(_TextField.default)(function () {
|
|
|
61
61
|
'& .MuiInputLabel-shrink': {
|
|
62
62
|
top: '1px'
|
|
63
63
|
},
|
|
64
|
-
'& .MuiOutlinedInput-
|
|
64
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
65
65
|
color: 'var(--gray5)',
|
|
66
66
|
paddingRight: 'var(--spacing8)',
|
|
67
67
|
'& fieldset': {
|
|
@@ -95,7 +95,7 @@ var CssTextField = (0, _styled.default)(_TextField.default)(function () {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
'& .MuiOutlinedInput-
|
|
98
|
+
'& .MuiOutlinedInput-notchedOutline.Mui-error': {
|
|
99
99
|
'& fieldset': {
|
|
100
100
|
borderColor: 'var(--error)'
|
|
101
101
|
},
|
|
@@ -118,7 +118,7 @@ var CssTextField = (0, _styled.default)(_TextField.default)(function () {
|
|
|
118
118
|
boxShadow: '0 0 0 3px white, 0 0 7px 4px var(--primary)'
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
'& .MuiOutlinedInput-
|
|
121
|
+
'& .MuiOutlinedInput-notchedOutline.Mui-disabled': {
|
|
122
122
|
'& fieldset': {
|
|
123
123
|
borderColor: 'rgba(0,0,0,0.38)',
|
|
124
124
|
borderWidth: '1px'
|
|
@@ -151,6 +151,7 @@ var InputText = function InputText(_ref) {
|
|
|
151
151
|
width = _ref.width,
|
|
152
152
|
helperText = _ref.helperText,
|
|
153
153
|
fullWidth = _ref.fullWidth,
|
|
154
|
+
sx = _ref.sx,
|
|
154
155
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
155
156
|
|
|
156
157
|
return /*#__PURE__*/_react.default.createElement(CssTextField, _extends({
|
|
@@ -158,7 +159,8 @@ var InputText = function InputText(_ref) {
|
|
|
158
159
|
className: className,
|
|
159
160
|
sx: {
|
|
160
161
|
minWidth: width || '15rem',
|
|
161
|
-
minHeight: '3rem'
|
|
162
|
+
minHeight: '3rem',
|
|
163
|
+
sx: sx
|
|
162
164
|
},
|
|
163
165
|
label: label,
|
|
164
166
|
fullWidth: fullWidth,
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _material = require("@mui/material");
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
require("../../styles/main.css");
|
|
13
|
+
|
|
14
|
+
var _InputText = _interopRequireDefault(require("../InputText/InputText"));
|
|
15
|
+
|
|
16
|
+
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
17
|
+
|
|
18
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
+
|
|
20
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
21
|
+
|
|
22
|
+
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."); }
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
31
|
+
|
|
32
|
+
var majorityTypes = ['Absolute', 'Two thirds', 'Percentage', 'Fraction', 'Number'];
|
|
33
|
+
|
|
34
|
+
var DesignSelectInput = function DesignSelectInput() {
|
|
35
|
+
var _React$useState = _react.default.useState(''),
|
|
36
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
37
|
+
item = _React$useState2[0],
|
|
38
|
+
setItem = _React$useState2[1];
|
|
39
|
+
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
style: {
|
|
42
|
+
display: 'flex'
|
|
43
|
+
}
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement(_SelectInput.default, {
|
|
45
|
+
label: 'Majority Type',
|
|
46
|
+
onChange: function onChange(e) {
|
|
47
|
+
return setItem(e.target.value);
|
|
48
|
+
},
|
|
49
|
+
value: item,
|
|
50
|
+
error: 'hola esto es un error '
|
|
51
|
+
}, majorityTypes.map(function (type) {
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
53
|
+
key: type,
|
|
54
|
+
value: type
|
|
55
|
+
}, type);
|
|
56
|
+
})), /*#__PURE__*/_react.default.createElement(_InputText.default, {
|
|
57
|
+
label: 'Majority Type',
|
|
58
|
+
error: 'hola esto es un error' // onChange={e => setItem(e.target.value)}
|
|
59
|
+
// value={item}
|
|
60
|
+
|
|
61
|
+
})));
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var _default = DesignSelectInput;
|
|
65
|
+
exports.default = _default;
|
|
@@ -15,11 +15,17 @@ var _InputLabel = _interopRequireDefault(require("@mui/material/InputLabel"));
|
|
|
15
15
|
|
|
16
16
|
var _FormControl = _interopRequireDefault(require("@mui/material/FormControl"));
|
|
17
17
|
|
|
18
|
+
var _material = require("@mui/material");
|
|
19
|
+
|
|
18
20
|
require("../../styles/main.css");
|
|
19
21
|
|
|
20
22
|
require("./SelectInput.css");
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
|
|
25
|
+
|
|
26
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
27
|
+
|
|
28
|
+
var _excluded = ["id", "className", "onChange", "label", "disabled", "width", "fullWidth", "children", "error", "helperText", "helper"];
|
|
23
29
|
|
|
24
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
31
|
|
|
@@ -29,6 +35,96 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
29
35
|
|
|
30
36
|
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; }
|
|
31
37
|
|
|
38
|
+
var CssSelect = (0, _styled.default)(_Select.default)(function () {
|
|
39
|
+
return {
|
|
40
|
+
'& .MuiInput-underline:after': {
|
|
41
|
+
borderBottomColor: 'var(--gray5)',
|
|
42
|
+
borderWidth: '2px'
|
|
43
|
+
},
|
|
44
|
+
'& .MuiSelect-nativeInput': {
|
|
45
|
+
height: '3rem',
|
|
46
|
+
lineHeight: 'var(--spacing12)',
|
|
47
|
+
padding: 'var(--spacing12)',
|
|
48
|
+
paddingRight: 'var(--spacing8)'
|
|
49
|
+
},
|
|
50
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
51
|
+
color: 'var(--gray5)',
|
|
52
|
+
paddingRight: 'var(--spacing8)',
|
|
53
|
+
'& fieldset': {
|
|
54
|
+
borderColor: 'var(--gray3)',
|
|
55
|
+
borderWidth: '1px',
|
|
56
|
+
'& legend': {
|
|
57
|
+
'& span': {
|
|
58
|
+
paddingLeft: 'var(--spacing4)',
|
|
59
|
+
paddingRight: 'var(--spacing4)'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
'&:hover fieldset': {
|
|
64
|
+
borderColor: 'var(--gray3)',
|
|
65
|
+
borderWidth: '2px'
|
|
66
|
+
},
|
|
67
|
+
'&:active fieldset': {
|
|
68
|
+
borderColor: 'var(--gray3)',
|
|
69
|
+
borderWidth: '2px'
|
|
70
|
+
},
|
|
71
|
+
'&.Mui-focused fieldset': {
|
|
72
|
+
borderColor: 'var(--primary)',
|
|
73
|
+
borderWidth: '2px'
|
|
74
|
+
},
|
|
75
|
+
'&:focus-visible': {
|
|
76
|
+
outline: 'none',
|
|
77
|
+
'& fieldset': {
|
|
78
|
+
outline: 'none',
|
|
79
|
+
boxShadow: '0 0 0 3px white, 0 0 7px 4px var(--primary)',
|
|
80
|
+
border: '2px solid var(--gray4)'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
'& .MuiOutlinedInput-notchedOutline.Mui-error': {
|
|
85
|
+
'& fieldset': {
|
|
86
|
+
borderColor: 'var(--error)'
|
|
87
|
+
},
|
|
88
|
+
'&:hover fieldset': {
|
|
89
|
+
borderColor: 'var(--error)',
|
|
90
|
+
borderWidth: '2px'
|
|
91
|
+
},
|
|
92
|
+
'&:active fieldset': {
|
|
93
|
+
borderColor: 'var(--error)',
|
|
94
|
+
borderWidth: '2px'
|
|
95
|
+
},
|
|
96
|
+
'&.Mui-focused fieldset': {
|
|
97
|
+
borderColor: 'var(--error)',
|
|
98
|
+
borderWidth: '2px'
|
|
99
|
+
},
|
|
100
|
+
'&:focus-visible': {
|
|
101
|
+
// falta revisar esto
|
|
102
|
+
borderColor: 'var(--gray4)',
|
|
103
|
+
borderWidth: '2px',
|
|
104
|
+
boxShadow: '0 0 0 3px white, 0 0 7px 4px var(--primary)'
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
'& .MuiOutlinedInput-notchedOutline.Mui-disabled': {
|
|
108
|
+
'& fieldset': {
|
|
109
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
110
|
+
borderWidth: '1px'
|
|
111
|
+
},
|
|
112
|
+
'&:hover fieldset': {
|
|
113
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
114
|
+
borderWidth: '1px'
|
|
115
|
+
},
|
|
116
|
+
'&:active fieldset': {
|
|
117
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
118
|
+
borderWidth: '1px'
|
|
119
|
+
},
|
|
120
|
+
'&.Mui-focused fieldset': {
|
|
121
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
122
|
+
borderWidth: '1px'
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
|
|
32
128
|
var SelectInput = function SelectInput(_ref) {
|
|
33
129
|
var id = _ref.id,
|
|
34
130
|
className = _ref.className,
|
|
@@ -38,35 +134,65 @@ var SelectInput = function SelectInput(_ref) {
|
|
|
38
134
|
width = _ref.width,
|
|
39
135
|
fullWidth = _ref.fullWidth,
|
|
40
136
|
children = _ref.children,
|
|
137
|
+
error = _ref.error,
|
|
138
|
+
helperText = _ref.helperText,
|
|
139
|
+
helper = _ref.helper,
|
|
41
140
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
42
141
|
|
|
43
142
|
return /*#__PURE__*/_react.default.createElement(_FormControl.default, {
|
|
44
143
|
fullWidth: fullWidth
|
|
45
144
|
}, label && /*#__PURE__*/_react.default.createElement(_InputLabel.default, {
|
|
46
145
|
disabled: disabled,
|
|
146
|
+
error: error,
|
|
47
147
|
sx: {
|
|
48
|
-
'
|
|
49
|
-
|
|
148
|
+
top: '-0.25rem',
|
|
149
|
+
'&.MuiInputLabel-root.Mui-focused': {
|
|
150
|
+
top: '0',
|
|
151
|
+
color: 'var(--primary)!important'
|
|
152
|
+
},
|
|
153
|
+
'&.MuiInputLabel-root.Mui-error': {
|
|
154
|
+
color: 'var(--error)'
|
|
155
|
+
},
|
|
156
|
+
'&.MuiInputLabel-root.MuiInputLabel-shrink': {
|
|
157
|
+
top: '1px'
|
|
50
158
|
}
|
|
51
159
|
}
|
|
52
|
-
}, label), /*#__PURE__*/_react.default.createElement(
|
|
160
|
+
}, label), /*#__PURE__*/_react.default.createElement(CssSelect, _extends({
|
|
53
161
|
id: id,
|
|
54
162
|
className: className,
|
|
55
163
|
sx: {
|
|
56
164
|
minWidth: width || '15rem',
|
|
57
|
-
minHeight: '3rem'
|
|
165
|
+
minHeight: '3rem',
|
|
166
|
+
maxHeight: '3rem'
|
|
58
167
|
},
|
|
59
168
|
label: label,
|
|
60
169
|
fullWidth: fullWidth,
|
|
61
170
|
onChange: onChange,
|
|
62
171
|
disabled: disabled,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
172
|
+
error: error
|
|
173
|
+
}, props), children), /*#__PURE__*/_react.default.createElement(_material.FormHelperText, {
|
|
174
|
+
sx: {
|
|
175
|
+
marginLeft: '0',
|
|
176
|
+
marginRight: '0px'
|
|
177
|
+
}
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, helperText, error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
179
|
+
className: "cbx-selectInput-items-center"
|
|
180
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
181
|
+
className: 'cbx-selectInput-infoBtn ri-information-line',
|
|
182
|
+
style: {
|
|
183
|
+
color: 'var(--error)'
|
|
68
184
|
}
|
|
69
|
-
},
|
|
185
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
186
|
+
variant: "XS",
|
|
187
|
+
color: 'var(--error)'
|
|
188
|
+
}, error)) : helper && /*#__PURE__*/_react.default.createElement("div", {
|
|
189
|
+
className: "cbx-inputText-items-center"
|
|
190
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
191
|
+
className: 'cbx-selectInput-infoBtn ri-information-line'
|
|
192
|
+
}), /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
193
|
+
color: !disabled ? 'var(--gray4)' : 'var(--gray3)',
|
|
194
|
+
variant: "XS"
|
|
195
|
+
}, helper)))));
|
|
70
196
|
};
|
|
71
197
|
|
|
72
198
|
SelectInput.displayName = "SelectInput";
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
11
11
|
|
|
12
|
-
var _DesignSelectInput = _interopRequireDefault(require("./DesignSelectInput
|
|
12
|
+
var _DesignSelectInput = _interopRequireDefault(require("./DesignSelectInput"));
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
@@ -33,9 +33,9 @@ var CssTextField = (0, _styled.default)(_TextField.default)(function (_ref) {
|
|
|
33
33
|
var theme = _ref.theme;
|
|
34
34
|
return {
|
|
35
35
|
'& label.Mui-focused': {
|
|
36
|
-
color: 'primary',
|
|
37
|
-
borderWidth: '
|
|
38
|
-
background: 'white',
|
|
36
|
+
color: 'var(--primary)',
|
|
37
|
+
borderWidth: '0px!important',
|
|
38
|
+
background: 'white!important',
|
|
39
39
|
top: '1px'
|
|
40
40
|
},
|
|
41
41
|
'& .MuiInput-underline:after': {
|
|
@@ -160,9 +160,6 @@ var TextInput = function TextInput(_ref2) {
|
|
|
160
160
|
sx: {
|
|
161
161
|
minWidth: width || '15rem',
|
|
162
162
|
height: '3rem',
|
|
163
|
-
'&.MuiFormControl-root label.Mui-focused': {
|
|
164
|
-
borderWidth: 0
|
|
165
|
-
},
|
|
166
163
|
sx: sx
|
|
167
164
|
},
|
|
168
165
|
label: label,
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _material = require("@mui/material");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
require("../../styles/main.css");
|
|
13
|
-
|
|
14
|
-
var _SelectInput = _interopRequireDefault(require("./SelectInput"));
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
var majorityTypes = ['Absolute', 'Two thirds', 'Percentage', 'Fraction', 'Number'];
|
|
19
|
-
|
|
20
|
-
var DesignSelectInput = function DesignSelectInput() {
|
|
21
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
-
style: {
|
|
23
|
-
display: 'flex'
|
|
24
|
-
}
|
|
25
|
-
}, /*#__PURE__*/_react.default.createElement(_SelectInput.default, {
|
|
26
|
-
label: 'Majority Type'
|
|
27
|
-
}, majorityTypes.map(function (type) {
|
|
28
|
-
return /*#__PURE__*/_react.default.createElement(_material.MenuItem, {
|
|
29
|
-
key: type
|
|
30
|
-
}, type);
|
|
31
|
-
})));
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
DesignSelectInput.displayName = "DesignSelectInput";
|
|
35
|
-
var _default = DesignSelectInput;
|
|
36
|
-
exports.default = _default;
|