@councilbox/councilbox-ui 0.0.3 → 0.0.6
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/README.md +1 -1
- package/dist/HOCs/useWindowSize.js +78 -0
- package/dist/assets/img/check.svg +3 -0
- package/dist/assets/img/info.svg +5 -0
- package/dist/build-index.js +32 -0
- package/dist/components/Avatar/Avatar.js +46 -57
- package/dist/components/Avatar/Avatar.stories.js +15 -23
- package/dist/components/Avatar/DesignAvatar.stories.js +166 -0
- package/dist/components/Avatar/{DesignAvatarText.js → DesignAvatarText.stories.js} +65 -4
- package/dist/components/AvatarGroup/AvatarGroup.css +33 -0
- package/dist/components/AvatarGroup/AvatarGroup.js +40 -0
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +32 -0
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +129 -0
- package/dist/components/Button/Button.js +90 -16
- package/dist/components/Button/Button.stories.js +26 -37
- package/dist/components/Button/button.css +34 -0
- package/dist/components/Checkbox/Checkbox.css +0 -0
- package/dist/components/Checkbox/Checkbox.js +94 -0
- package/dist/components/Checkbox/Checkbox.stories.js +28 -0
- package/dist/components/Grid/DesignGrid.js +1 -5
- package/dist/components/Grid/Grid.js +1 -5
- package/dist/components/Grid/GridItem.js +1 -5
- package/dist/components/Header/Header.js +4 -4
- package/dist/components/InputPassword/InputPassword.css +26 -0
- package/dist/components/InputPassword/InputPassword.js +126 -27
- package/dist/components/InputPassword/InputPassword.stories.js +32 -33
- package/dist/components/InputText/InputText.css +13 -0
- package/dist/components/InputText/InputText.js +200 -30
- package/dist/components/InputText/InputText.stories.js +27 -35
- package/dist/components/RadioButton/Radio.css +0 -0
- package/dist/components/RadioButton/Radio.js +94 -0
- package/dist/components/RadioButton/Radio.stories.js +28 -0
- package/dist/components/Spacing/Spacing.css +0 -0
- package/dist/components/Spacing/Spacing.js +137 -0
- package/dist/components/Spacing/Spacing.stories.js +28 -0
- package/dist/components/ThemeProvider/Colors.js +102 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +18 -9
- package/dist/components/Typography/Typography.js +37 -13
- package/dist/components/Typography/Typography.stories.js +11 -2
- package/dist/index.js +6 -18
- package/dist/setupTests.js +6 -3
- package/dist/styles/main.css +98 -32
- package/dist/styles/reset.css +69 -37
- package/dist/styles/stylesheet.js +114 -0
- package/dist/testing/TestComponents.js +61 -16
- package/package.json +9 -2
- package/dist/Button/Button.js +0 -36
- package/dist/Button/Button.stories.js +0 -71
- package/dist/Button/button.css +0 -30
- package/dist/HOCs/withWindowSize.js +0 -122
- package/dist/Header/Header.js +0 -68
- package/dist/Header/Header.stories.js +0 -31
- package/dist/Header/header.css +0 -26
- package/dist/Introduction.stories.mdx +0 -211
- package/dist/components/Avatar/DesignAvatar.js +0 -66
- package/dist/components/Avatar/DesignAvatarGroup.js +0 -58
- package/dist/styles/stylesheet.ts +0 -49
|
@@ -11,8 +11,6 @@ require("../../styles/main.css");
|
|
|
11
11
|
|
|
12
12
|
var _Grid = _interopRequireDefault(require("@mui/material/Grid"));
|
|
13
13
|
|
|
14
|
-
var _withWindowSize = _interopRequireDefault(require("../../HOCs/withWindowSize"));
|
|
15
|
-
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
15
|
|
|
18
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
@@ -43,7 +41,5 @@ var GridItem = function GridItem(_ref) {
|
|
|
43
41
|
GridItem.displayName = "GridItem";
|
|
44
42
|
GridItem.propTypes = {};
|
|
45
43
|
GridItem.defaultProps = {};
|
|
46
|
-
|
|
47
|
-
var _default = (0, _withWindowSize.default)(GridItem);
|
|
48
|
-
|
|
44
|
+
var _default = GridItem;
|
|
49
45
|
exports.default = _default;
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
13
13
|
|
|
14
14
|
require("./header.css");
|
|
15
15
|
|
|
@@ -39,15 +39,15 @@ var Header = function Header(_ref) {
|
|
|
39
39
|
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
40
40
|
d: "M27.2 10.6v11.2l-10.5 6V16.5l10.5-6zM15.7 4.4v11L6 10l9.7-5.5z",
|
|
41
41
|
fill: "#91BAF8"
|
|
42
|
-
}))), /*#__PURE__*/_react.default.createElement("h1", null, "Acme")), /*#__PURE__*/_react.default.createElement("div", null, user ? /*#__PURE__*/_react.default.createElement(
|
|
42
|
+
}))), /*#__PURE__*/_react.default.createElement("h1", null, "Acme")), /*#__PURE__*/_react.default.createElement("div", null, user ? /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
43
43
|
size: "small",
|
|
44
44
|
onClick: onLogout,
|
|
45
45
|
label: "Log out"
|
|
46
|
-
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(
|
|
46
|
+
}) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
47
47
|
size: "small",
|
|
48
48
|
onClick: onLogin,
|
|
49
49
|
label: "Log in"
|
|
50
|
-
}), /*#__PURE__*/_react.default.createElement(
|
|
50
|
+
}), /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
51
51
|
primary: true,
|
|
52
52
|
size: "small",
|
|
53
53
|
onClick: onCreateAccount,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.cbx-inputPassword-validation {
|
|
2
|
+
width: 100%;
|
|
3
|
+
background: #DBDBDB;
|
|
4
|
+
height: var(--spacing8);
|
|
5
|
+
border-radius: 20px;
|
|
6
|
+
margin-top: var(--spacing4);
|
|
7
|
+
margin-bottom: var(--spacing4);
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
.cbx-inputPassword-validation > div {
|
|
11
|
+
height: var(--spacing8);
|
|
12
|
+
border-radius: 20px;
|
|
13
|
+
transition: all .5s;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
.cbx-inputPassword-icon-button {
|
|
18
|
+
outline: none;
|
|
19
|
+
width: var(--spacing24);
|
|
20
|
+
height: var(--spacing24);
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
.cbx-inputPassword-icon-size {
|
|
24
|
+
width: var(--spacing24);
|
|
25
|
+
height: var(--spacing24);
|
|
26
|
+
}
|
|
@@ -9,49 +9,148 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
+
|
|
14
|
+
var _Visibility = _interopRequireDefault(require("@mui/icons-material/Visibility"));
|
|
15
|
+
|
|
16
|
+
var _VisibilityOff = _interopRequireDefault(require("@mui/icons-material/VisibilityOff"));
|
|
13
17
|
|
|
14
18
|
require("../../styles/main.css");
|
|
15
19
|
|
|
20
|
+
require("./InputPassword.css");
|
|
21
|
+
|
|
22
|
+
var _CouncilboxThemeContext = require("../ThemeProvider/CouncilboxThemeContext");
|
|
23
|
+
|
|
24
|
+
var _InputText = _interopRequireDefault(require("../InputText/InputText"));
|
|
25
|
+
|
|
26
|
+
var _excluded = ["id", "className", "onChange", "onClick", "label", "disabled", "error", "helper", "width", "validation", "percentageError", "helperText", "fullWidth"];
|
|
27
|
+
|
|
16
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
29
|
|
|
30
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
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
|
+
|
|
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; }
|
|
45
|
+
|
|
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; }
|
|
47
|
+
|
|
18
48
|
var InputPassword = function InputPassword(_ref) {
|
|
19
|
-
var
|
|
49
|
+
var id = _ref.id,
|
|
50
|
+
className = _ref.className,
|
|
51
|
+
onChange = _ref.onChange,
|
|
20
52
|
onClick = _ref.onClick,
|
|
53
|
+
label = _ref.label,
|
|
21
54
|
disabled = _ref.disabled,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
error = _ref.error,
|
|
56
|
+
helper = _ref.helper,
|
|
57
|
+
width = _ref.width,
|
|
58
|
+
validation = _ref.validation,
|
|
59
|
+
percentageError = _ref.percentageError,
|
|
60
|
+
helperText = _ref.helperText,
|
|
61
|
+
fullWidth = _ref.fullWidth,
|
|
62
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
63
|
+
|
|
64
|
+
var _React$useState = _react.default.useState(false),
|
|
65
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
66
|
+
showPassword = _React$useState2[0],
|
|
67
|
+
setShowPassword = _React$useState2[1];
|
|
68
|
+
|
|
69
|
+
var themeData = (0, _CouncilboxThemeContext.useCouncilboxTheme)();
|
|
70
|
+
|
|
71
|
+
var getColorPercent = function getColorPercent(percent) {
|
|
72
|
+
var color = themeData.theme.colors.error600;
|
|
73
|
+
|
|
74
|
+
if (percent > 30 && percent < 90) {
|
|
75
|
+
color = themeData.theme.colors.warnig600;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (percent >= 90) {
|
|
79
|
+
color = themeData.theme.colors.success600;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return color;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_InputText.default, _extends({
|
|
86
|
+
id: id,
|
|
87
|
+
fullWidth: fullWidth,
|
|
88
|
+
className: className,
|
|
89
|
+
sx: {
|
|
90
|
+
width: width || '240px',
|
|
91
|
+
height: '48px'
|
|
92
|
+
},
|
|
93
|
+
label: label,
|
|
94
|
+
onChange: onChange,
|
|
95
|
+
disabled: disabled,
|
|
96
|
+
error: error,
|
|
97
|
+
helper: helper,
|
|
98
|
+
type: showPassword ? 'text' : 'password',
|
|
99
|
+
helperText: validation && /*#__PURE__*/_react.default.createElement("div", {
|
|
100
|
+
className: "cbx-inputPassword-validation"
|
|
101
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
102
|
+
style: {
|
|
103
|
+
width: "".concat(percentageError, "%"),
|
|
104
|
+
background: getColorPercent(percentageError)
|
|
105
|
+
}
|
|
106
|
+
})),
|
|
107
|
+
InputProps: {
|
|
108
|
+
endAdornment: /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
109
|
+
disabled: disabled,
|
|
110
|
+
"aria-label": "Toggle password visibility",
|
|
111
|
+
className: "cbx-inputPassword-icon-button",
|
|
112
|
+
onClick: function onClick() {
|
|
113
|
+
return !disabled && setShowPassword(!showPassword);
|
|
114
|
+
}
|
|
115
|
+
}, showPassword ? /*#__PURE__*/_react.default.createElement(_VisibilityOff.default, {
|
|
116
|
+
className: "cbx-inputPassword-icon-size",
|
|
117
|
+
sx: {
|
|
118
|
+
color: disabled ? 'var(--neutral400)' : 'black'
|
|
119
|
+
}
|
|
120
|
+
}) : /*#__PURE__*/_react.default.createElement(_Visibility.default, {
|
|
121
|
+
className: "cbx-inputPassword-icon-size",
|
|
122
|
+
sx: {
|
|
123
|
+
color: disabled ? 'var(--neutral400)' : 'black'
|
|
124
|
+
}
|
|
125
|
+
}))
|
|
126
|
+
}
|
|
127
|
+
}, props));
|
|
35
128
|
};
|
|
36
129
|
|
|
37
130
|
InputPassword.displayName = "InputPassword";
|
|
38
131
|
InputPassword.propTypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
132
|
+
label: _propTypes.default.string,
|
|
133
|
+
helper: _propTypes.default.string,
|
|
134
|
+
width: _propTypes.default.string,
|
|
135
|
+
id: _propTypes.default.string,
|
|
136
|
+
className: _propTypes.default.string,
|
|
137
|
+
onChange: _propTypes.default.func,
|
|
43
138
|
disabled: _propTypes.default.bool,
|
|
44
|
-
|
|
45
|
-
|
|
139
|
+
error: _propTypes.default.string,
|
|
140
|
+
validation: _propTypes.default.bool,
|
|
141
|
+
percentageError: _propTypes.default.number
|
|
46
142
|
};
|
|
47
143
|
InputPassword.defaultProps = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
144
|
+
label: 'Caption',
|
|
145
|
+
helper: '',
|
|
146
|
+
width: '',
|
|
147
|
+
id: '',
|
|
148
|
+
className: '',
|
|
149
|
+
onChange: undefined,
|
|
52
150
|
disabled: false,
|
|
53
|
-
|
|
54
|
-
|
|
151
|
+
error: '',
|
|
152
|
+
validation: false,
|
|
153
|
+
percentageError: 0
|
|
55
154
|
};
|
|
56
155
|
var _default = InputPassword;
|
|
57
156
|
exports.default = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.Default = void 0;
|
|
6
|
+
exports.default = exports.Validation = exports.Helper = exports.Error = exports.Disabled = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -14,35 +14,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
var _default = {
|
|
15
15
|
title: 'Example/Input Password',
|
|
16
16
|
component: _InputPassword.default,
|
|
17
|
-
argTypes: {
|
|
18
|
-
backgroundColor: {
|
|
19
|
-
control: 'color'
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
options: ['primary', 'secondary'],
|
|
23
|
-
control: {
|
|
24
|
-
type: 'radio'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
loading: {
|
|
28
|
-
options: [true, false],
|
|
29
|
-
control: {
|
|
30
|
-
type: 'radio'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
disabled: {
|
|
34
|
-
options: [true, false],
|
|
35
|
-
control: {
|
|
36
|
-
type: 'radio'
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
variant: {
|
|
40
|
-
options: ['contained', 'outlined', 'text'],
|
|
41
|
-
control: {
|
|
42
|
-
type: 'radio'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
17
|
+
argTypes: {}
|
|
46
18
|
};
|
|
47
19
|
exports.default = _default;
|
|
48
20
|
|
|
@@ -54,7 +26,34 @@ Template.displayName = "Template";
|
|
|
54
26
|
var Default = Template.bind({});
|
|
55
27
|
exports.Default = Default;
|
|
56
28
|
Default.args = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
29
|
+
label: 'password',
|
|
30
|
+
value: 'abc123.'
|
|
31
|
+
};
|
|
32
|
+
var Helper = Template.bind({});
|
|
33
|
+
exports.Helper = Helper;
|
|
34
|
+
Helper.args = {
|
|
35
|
+
label: 'password',
|
|
36
|
+
value: 'abc123.',
|
|
37
|
+
helper: 'Enim anim occaecat'
|
|
38
|
+
};
|
|
39
|
+
var Validation = Template.bind({});
|
|
40
|
+
exports.Validation = Validation;
|
|
41
|
+
Validation.args = {
|
|
42
|
+
label: 'password',
|
|
43
|
+
value: 'abc123.',
|
|
44
|
+
validation: true,
|
|
45
|
+
percentageError: 54
|
|
46
|
+
};
|
|
47
|
+
var Error = Template.bind({});
|
|
48
|
+
exports.Error = Error;
|
|
49
|
+
Error.args = {
|
|
50
|
+
label: 'password',
|
|
51
|
+
value: 'abc123.',
|
|
52
|
+
error: 'Enim anim occaecat'
|
|
53
|
+
};
|
|
54
|
+
var Disabled = Template.bind({});
|
|
55
|
+
exports.Disabled = Disabled;
|
|
56
|
+
Disabled.args = {
|
|
57
|
+
value: 'Occaecat',
|
|
58
|
+
disabled: true
|
|
60
59
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.cbx-inputText-items-center {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
}
|
|
5
|
+
.cbx-inputText-infoBtn {
|
|
6
|
+
margin-right: var(--spacing4);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.cbx-inputText-endAdornment {
|
|
10
|
+
margin-right: var(--spacing4);
|
|
11
|
+
margin-top: var(--spacing12);
|
|
12
|
+
margin-bottom: var(--spacing12);
|
|
13
|
+
}
|
|
@@ -9,49 +9,219 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
13
13
|
|
|
14
14
|
require("../../styles/main.css");
|
|
15
15
|
|
|
16
|
+
require("./InputText.css");
|
|
17
|
+
|
|
18
|
+
var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
|
|
19
|
+
|
|
20
|
+
var _info = require("../../assets/img/info.svg");
|
|
21
|
+
|
|
22
|
+
var _check = require("../../assets/img/check.svg");
|
|
23
|
+
|
|
24
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
25
|
+
|
|
26
|
+
var _CouncilboxThemeContext = require("../ThemeProvider/CouncilboxThemeContext");
|
|
27
|
+
|
|
28
|
+
var _excluded = ["id", "className", "onChange", "label", "disabled", "error", "helper", "success", "width", "helperText", "fullWidth"];
|
|
29
|
+
|
|
16
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
,
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
33
|
+
|
|
34
|
+
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
|
+
|
|
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; }
|
|
37
|
+
|
|
38
|
+
var CssTextField = (0, _styled.default)(_TextField.default)(function (_ref) {
|
|
39
|
+
var theme = _ref.theme;
|
|
40
|
+
return {
|
|
41
|
+
'& label.Mui-focused': {
|
|
42
|
+
color: 'primary',
|
|
43
|
+
borderWidth: '2px',
|
|
44
|
+
background: 'white',
|
|
45
|
+
top: '1px'
|
|
46
|
+
},
|
|
47
|
+
'& .MuiInput-underline:after': {
|
|
48
|
+
borderBottomColor: theme.palette.primary700,
|
|
49
|
+
borderWidth: '2px'
|
|
50
|
+
},
|
|
51
|
+
'& .MuiFormHelperText-root': {
|
|
52
|
+
marginTop: 'var(--spacing4)',
|
|
53
|
+
marginLeft: '0px',
|
|
54
|
+
marginRight: '0px'
|
|
55
|
+
},
|
|
56
|
+
'& .MuiInputBase-input': {
|
|
57
|
+
height: '24px',
|
|
58
|
+
lineHeight: 'var(--spacing12)',
|
|
59
|
+
padding: 'var(--spacing12)',
|
|
60
|
+
paddingRight: 'var(--spacing8)'
|
|
61
|
+
},
|
|
62
|
+
'& .MuiFormLabel-root': {
|
|
63
|
+
top: '-4px'
|
|
64
|
+
},
|
|
65
|
+
'& .Mui-error': {
|
|
66
|
+
color: theme.palette.error600
|
|
67
|
+
},
|
|
68
|
+
'& .MuiInputLabel-shrink': {
|
|
69
|
+
top: '1px'
|
|
70
|
+
},
|
|
71
|
+
'& .MuiOutlinedInput-root': {
|
|
72
|
+
color: theme.palette.neutral900,
|
|
73
|
+
paddingRight: 'var(--spacing8)',
|
|
74
|
+
'& fieldset': {
|
|
75
|
+
borderColor: theme.palette.neutral500,
|
|
76
|
+
borderWidth: '1px',
|
|
77
|
+
'& legend': {
|
|
78
|
+
'& span': {
|
|
79
|
+
paddingLeft: 'var(--spacing4)',
|
|
80
|
+
paddingRight: 'var(--spacing4)'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
'&:hover fieldset': {
|
|
85
|
+
borderColor: theme.palette.neutral500,
|
|
86
|
+
borderWidth: '2px'
|
|
87
|
+
},
|
|
88
|
+
'&:active fieldset': {
|
|
89
|
+
borderColor: theme.palette.primary700,
|
|
90
|
+
borderWidth: '2px'
|
|
91
|
+
},
|
|
92
|
+
'&.Mui-focused fieldset': {
|
|
93
|
+
borderColor: theme.palette.primary700,
|
|
94
|
+
borderWidth: '2px'
|
|
95
|
+
},
|
|
96
|
+
'&:focus-visible': {
|
|
97
|
+
outline: 'none',
|
|
98
|
+
'& fieldset': {
|
|
99
|
+
outline: 'none',
|
|
100
|
+
boxShadow: "0 0 0 3px white, 0 0 7px 4px ".concat(theme.palette.primary.main),
|
|
101
|
+
border: "2px solid ".concat(theme.palette.primary700)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
'& .MuiOutlinedInput-root.Mui-error': {
|
|
106
|
+
'& fieldset': {
|
|
107
|
+
borderColor: theme.palette.error600
|
|
108
|
+
},
|
|
109
|
+
'&:hover fieldset': {
|
|
110
|
+
borderColor: theme.palette.error600,
|
|
111
|
+
borderWidth: '2px'
|
|
112
|
+
},
|
|
113
|
+
'&:active fieldset': {
|
|
114
|
+
borderColor: theme.palette.error600,
|
|
115
|
+
borderWidth: '2px'
|
|
116
|
+
},
|
|
117
|
+
'&.Mui-focused fieldset': {
|
|
118
|
+
borderColor: theme.palette.error600,
|
|
119
|
+
borderWidth: '2px'
|
|
120
|
+
},
|
|
121
|
+
'&:focus-visible': {
|
|
122
|
+
borderColor: theme.palette.primary700,
|
|
123
|
+
borderWidth: '2px',
|
|
124
|
+
boxShadow: "0 0 0 3px white, 0 0 7px 4px ".concat(theme.palette.primary.main)
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
'& .MuiOutlinedInput-root.Mui-disabled': {
|
|
128
|
+
'& fieldset': {
|
|
129
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
130
|
+
borderWidth: '1px'
|
|
131
|
+
},
|
|
132
|
+
'&:hover fieldset': {
|
|
133
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
134
|
+
borderWidth: '1px'
|
|
135
|
+
},
|
|
136
|
+
'&:active fieldset': {
|
|
137
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
138
|
+
borderWidth: '1px'
|
|
139
|
+
},
|
|
140
|
+
'&.Mui-focused fieldset': {
|
|
141
|
+
borderColor: 'rgba(0,0,0,0.38)',
|
|
142
|
+
borderWidth: '1px'
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
var InputText = function InputText(_ref2) {
|
|
149
|
+
var id = _ref2.id,
|
|
150
|
+
className = _ref2.className,
|
|
151
|
+
onChange = _ref2.onChange,
|
|
152
|
+
label = _ref2.label,
|
|
153
|
+
disabled = _ref2.disabled,
|
|
154
|
+
error = _ref2.error,
|
|
155
|
+
helper = _ref2.helper,
|
|
156
|
+
success = _ref2.success,
|
|
157
|
+
width = _ref2.width,
|
|
158
|
+
helperText = _ref2.helperText,
|
|
159
|
+
fullWidth = _ref2.fullWidth,
|
|
160
|
+
props = _objectWithoutProperties(_ref2, _excluded);
|
|
161
|
+
|
|
162
|
+
var _useCouncilboxTheme = (0, _CouncilboxThemeContext.useCouncilboxTheme)(),
|
|
163
|
+
theme = _useCouncilboxTheme.theme;
|
|
164
|
+
|
|
165
|
+
return /*#__PURE__*/_react.default.createElement(CssTextField, _extends({
|
|
166
|
+
id: id,
|
|
167
|
+
className: className,
|
|
168
|
+
sx: {
|
|
169
|
+
width: width || '240px',
|
|
170
|
+
height: '48px'
|
|
171
|
+
},
|
|
172
|
+
label: label,
|
|
173
|
+
fullWidth: fullWidth,
|
|
174
|
+
onChange: onChange,
|
|
175
|
+
disabled: disabled,
|
|
176
|
+
error: error,
|
|
177
|
+
helperText: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, helperText && !error && helperText, error ? /*#__PURE__*/_react.default.createElement("div", {
|
|
178
|
+
className: "cbx-inputText-items-center"
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(_info.ReactComponent, {
|
|
180
|
+
className: "cbx-inputText-infoBtn",
|
|
181
|
+
fill: theme.colors.error600
|
|
182
|
+
}), " ", /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
183
|
+
variant: "XS",
|
|
184
|
+
color: theme.colors.error600
|
|
185
|
+
}, error)) : helper && /*#__PURE__*/_react.default.createElement("div", {
|
|
186
|
+
className: "cbx-inputText-items-center"
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement(_info.ReactComponent, {
|
|
188
|
+
className: "cbx-inputText-infoBtn",
|
|
189
|
+
fill: !disabled ? theme.colors.neutral500 : theme.colors.neutral400
|
|
190
|
+
}), " ", /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
191
|
+
color: !disabled ? theme.colors.neutral500 : theme.colors.neutral400,
|
|
192
|
+
variant: "XS"
|
|
193
|
+
}, helper))),
|
|
194
|
+
InputProps: {
|
|
195
|
+
endAdornment: success && /*#__PURE__*/_react.default.createElement(_check.ReactComponent, {
|
|
196
|
+
fill: '#138A00',
|
|
197
|
+
className: "cbx-inputText-endAdornment"
|
|
198
|
+
})
|
|
199
|
+
}
|
|
200
|
+
}, props));
|
|
35
201
|
};
|
|
36
202
|
|
|
37
203
|
InputText.displayName = "InputText";
|
|
38
204
|
InputText.propTypes = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
205
|
+
label: _propTypes.default.string,
|
|
206
|
+
helper: _propTypes.default.string,
|
|
207
|
+
width: _propTypes.default.string,
|
|
208
|
+
id: _propTypes.default.string,
|
|
209
|
+
className: _propTypes.default.string,
|
|
210
|
+
onChange: _propTypes.default.func,
|
|
43
211
|
disabled: _propTypes.default.bool,
|
|
44
|
-
|
|
45
|
-
|
|
212
|
+
error: _propTypes.default.string,
|
|
213
|
+
success: _propTypes.default.bool
|
|
46
214
|
};
|
|
47
215
|
InputText.defaultProps = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
216
|
+
label: 'Caption',
|
|
217
|
+
helper: '',
|
|
218
|
+
width: '',
|
|
219
|
+
id: '',
|
|
220
|
+
className: '',
|
|
221
|
+
onChange: undefined,
|
|
52
222
|
disabled: false,
|
|
53
|
-
|
|
54
|
-
|
|
223
|
+
error: '',
|
|
224
|
+
success: false
|
|
55
225
|
};
|
|
56
226
|
var _default = InputText;
|
|
57
227
|
exports.default = _default;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.Default = void 0;
|
|
6
|
+
exports.default = exports.Success = exports.Helper = exports.Error = exports.Disabled = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -12,37 +12,9 @@ var _InputText = _interopRequireDefault(require("./InputText"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
14
|
var _default = {
|
|
15
|
-
title: 'Example/
|
|
15
|
+
title: 'Example/InputText',
|
|
16
16
|
component: _InputText.default,
|
|
17
|
-
argTypes: {
|
|
18
|
-
backgroundColor: {
|
|
19
|
-
control: 'color'
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
options: ['primary', 'secondary'],
|
|
23
|
-
control: {
|
|
24
|
-
type: 'radio'
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
loading: {
|
|
28
|
-
options: [true, false],
|
|
29
|
-
control: {
|
|
30
|
-
type: 'radio'
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
disabled: {
|
|
34
|
-
options: [true, false],
|
|
35
|
-
control: {
|
|
36
|
-
type: 'radio'
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
variant: {
|
|
40
|
-
options: ['contained', 'outlined', 'text'],
|
|
41
|
-
control: {
|
|
42
|
-
type: 'radio'
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
17
|
+
argTypes: {}
|
|
46
18
|
};
|
|
47
19
|
exports.default = _default;
|
|
48
20
|
|
|
@@ -53,8 +25,28 @@ var Template = function Template(args) {
|
|
|
53
25
|
Template.displayName = "Template";
|
|
54
26
|
var Default = Template.bind({});
|
|
55
27
|
exports.Default = Default;
|
|
56
|
-
Default.args = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
Default.args = {};
|
|
29
|
+
var Helper = Template.bind({});
|
|
30
|
+
exports.Helper = Helper;
|
|
31
|
+
Helper.args = {
|
|
32
|
+
value: 'Occaecat',
|
|
33
|
+
helper: 'Helper'
|
|
34
|
+
};
|
|
35
|
+
var Success = Template.bind({});
|
|
36
|
+
exports.Success = Success;
|
|
37
|
+
Success.args = {
|
|
38
|
+
value: 'Occaecat',
|
|
39
|
+
success: true
|
|
40
|
+
};
|
|
41
|
+
var Disabled = Template.bind({});
|
|
42
|
+
exports.Disabled = Disabled;
|
|
43
|
+
Disabled.args = {
|
|
44
|
+
value: 'Occaecat',
|
|
45
|
+
disabled: true
|
|
46
|
+
};
|
|
47
|
+
var Error = Template.bind({});
|
|
48
|
+
exports.Error = Error;
|
|
49
|
+
Error.args = {
|
|
50
|
+
value: 'Occaecat',
|
|
51
|
+
error: 'Error'
|
|
60
52
|
};
|