@tenancy.nz/ui 1.3.1 → 1.3.2
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/cjs/components/Checkbox.cjs +4 -2
- package/dist/cjs/components/InputClearIcon.cjs +20 -0
- package/dist/cjs/components/InputClearIcon.styled.cjs +16 -0
- package/dist/cjs/components/MultiSelect.cjs +197 -0
- package/dist/cjs/components/MultiSelect.styled.cjs +13 -0
- package/dist/cjs/components/Nameplate.cjs +12 -33
- package/dist/cjs/components/Radio.cjs +4 -2
- package/dist/cjs/components/Select.cjs +20 -14
- package/dist/cjs/theme/index.cjs +7 -5
- package/dist/esm/components/Checkbox.js +4 -2
- package/dist/esm/components/InputClearIcon.js +16 -0
- package/dist/esm/components/InputClearIcon.styled.js +12 -0
- package/dist/esm/components/MultiSelect.js +193 -0
- package/dist/esm/components/MultiSelect.styled.js +11 -0
- package/dist/esm/components/Nameplate.js +12 -33
- package/dist/esm/components/Radio.js +4 -2
- package/dist/esm/components/Select.js +22 -16
- package/dist/esm/theme/index.js +7 -5
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var CancelIcon = require('@mui/icons-material/Cancel');
|
|
7
|
+
var IconButton = require('./IconButton.cjs');
|
|
8
|
+
var InputClearIcon_styled = require('./InputClearIcon.styled.cjs');
|
|
9
|
+
|
|
10
|
+
function InputClearIcon(_ref) {
|
|
11
|
+
var onClick = _ref.onClick;
|
|
12
|
+
return /* @__PURE__ */React.createElement(InputClearIcon_styled.default, null, /* @__PURE__ */React.createElement(IconButton.default, {
|
|
13
|
+
onClick: onClick,
|
|
14
|
+
size: "small",
|
|
15
|
+
color: "inherit",
|
|
16
|
+
edges: "rounded"
|
|
17
|
+
}, /* @__PURE__ */React.createElement(CancelIcon, null)));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
exports.default = InputClearIcon;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
|
|
6
|
+
var styles = require('@mui/material/styles');
|
|
7
|
+
var react = require('@emotion/react');
|
|
8
|
+
var object = require('../utils/helpers/object.cjs');
|
|
9
|
+
|
|
10
|
+
var _templateObject, _templateObject2;
|
|
11
|
+
var StyledInputClearIcon = styles.styled("div")(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
12
|
+
var theme = _ref.theme;
|
|
13
|
+
return react.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n color: ", ";\n margin-left: 5px;\n transition: color 200ms ease;\n svg {\n font-size: 1.15rem;\n }\n\n &:hover {\n color: ", ";\n }\n "])), object.getObjectProp(theme, "vars.palette.grey.300", null), object.getObjectProp(theme, "vars.palette.grey.400", null));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
exports.default = StyledInputClearIcon;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var MuiMenuItem = require('@mui/material/MenuItem');
|
|
8
|
+
var KeyboardArrowDownIcon = require('@mui/icons-material/KeyboardArrowDown');
|
|
9
|
+
var Box = require('./Box.cjs');
|
|
10
|
+
var Checkbox = require('./Checkbox.cjs');
|
|
11
|
+
var FormControl = require('./FormControl.cjs');
|
|
12
|
+
var Select_styled = require('./Select.styled.cjs');
|
|
13
|
+
var InputClearIcon = require('./InputClearIcon.cjs');
|
|
14
|
+
var MultiSelect_styled = require('./MultiSelect.styled.cjs');
|
|
15
|
+
|
|
16
|
+
var _excluded = ["fullWidth", "color", "label", "helperText", "edges", "variant", "disabled", "required", "options", "onChange", "showError", "errorMessage", "inputRef", "placeholder", "IconComponent", "size", "value", "name", "inputProps", "hideLabel", "allowEmpty", "weight", "onClear", "keepClearIconSpace", "checkboxProps", "onToggleAll", "toggleAllOptionLabel"];
|
|
17
|
+
function MultiSelect(_ref) {
|
|
18
|
+
var _ref$fullWidth = _ref.fullWidth,
|
|
19
|
+
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
20
|
+
_ref$color = _ref.color,
|
|
21
|
+
color = _ref$color === void 0 ? "default" : _ref$color,
|
|
22
|
+
_ref$label = _ref.label,
|
|
23
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
24
|
+
_ref$helperText = _ref.helperText,
|
|
25
|
+
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
26
|
+
_ref$edges = _ref.edges,
|
|
27
|
+
edges = _ref$edges === void 0 ? "normal" : _ref$edges,
|
|
28
|
+
_ref$variant = _ref.variant,
|
|
29
|
+
variant = _ref$variant === void 0 ? "outlined" : _ref$variant,
|
|
30
|
+
_ref$disabled = _ref.disabled,
|
|
31
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
32
|
+
_ref$required = _ref.required,
|
|
33
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
34
|
+
options = _ref.options,
|
|
35
|
+
_ref$onChange = _ref.onChange,
|
|
36
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
37
|
+
return null;
|
|
38
|
+
} : _ref$onChange,
|
|
39
|
+
_ref$showError = _ref.showError,
|
|
40
|
+
showError = _ref$showError === void 0 ? false : _ref$showError,
|
|
41
|
+
_ref$errorMessage = _ref.errorMessage,
|
|
42
|
+
errorMessage = _ref$errorMessage === void 0 ? "" : _ref$errorMessage,
|
|
43
|
+
_ref$inputRef = _ref.inputRef,
|
|
44
|
+
inputRef = _ref$inputRef === void 0 ? null : _ref$inputRef,
|
|
45
|
+
_ref$placeholder = _ref.placeholder,
|
|
46
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
47
|
+
_ref$IconComponent = _ref.IconComponent,
|
|
48
|
+
IconComponent = _ref$IconComponent === void 0 ? void 0 : _ref$IconComponent,
|
|
49
|
+
_ref$size = _ref.size,
|
|
50
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
51
|
+
_ref$value = _ref.value,
|
|
52
|
+
value = _ref$value === void 0 ? [] : _ref$value,
|
|
53
|
+
name = _ref.name,
|
|
54
|
+
_ref$inputProps = _ref.inputProps,
|
|
55
|
+
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
|
|
56
|
+
_ref$hideLabel = _ref.hideLabel,
|
|
57
|
+
hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
|
|
58
|
+
_ref$allowEmpty = _ref.allowEmpty,
|
|
59
|
+
allowEmpty = _ref$allowEmpty === void 0 ? false : _ref$allowEmpty;
|
|
60
|
+
_ref.weight;
|
|
61
|
+
var _ref$onClear = _ref.onClear,
|
|
62
|
+
onClear = _ref$onClear === void 0 ? void 0 : _ref$onClear,
|
|
63
|
+
_ref$keepClearIconSpa = _ref.keepClearIconSpace,
|
|
64
|
+
keepClearIconSpace = _ref$keepClearIconSpa === void 0 ? false : _ref$keepClearIconSpa,
|
|
65
|
+
_ref$checkboxProps = _ref.checkboxProps,
|
|
66
|
+
checkboxProps = _ref$checkboxProps === void 0 ? {} : _ref$checkboxProps,
|
|
67
|
+
_ref$onToggleAll = _ref.onToggleAll,
|
|
68
|
+
onToggleAll = _ref$onToggleAll === void 0 ? void 0 : _ref$onToggleAll,
|
|
69
|
+
_ref$toggleAllOptionL = _ref.toggleAllOptionLabel,
|
|
70
|
+
toggleAllOptionLabel = _ref$toggleAllOptionL === void 0 ? "Select All" : _ref$toggleAllOptionL,
|
|
71
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
72
|
+
var ref = React.useRef(null);
|
|
73
|
+
var handleToggleAll = function handleToggleAll(e) {
|
|
74
|
+
e.stopPropagation();
|
|
75
|
+
var filtered = value.filter(function (val) {
|
|
76
|
+
return !isNaN(parseFloat(val)) || !!val;
|
|
77
|
+
});
|
|
78
|
+
var checked = filtered.length === options.length;
|
|
79
|
+
var vals = !checked ? options.map(function (option) {
|
|
80
|
+
return option.value;
|
|
81
|
+
}) : [];
|
|
82
|
+
if (typeof onToggleAll === "function") {
|
|
83
|
+
onToggleAll(vals);
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
};
|
|
87
|
+
return /* @__PURE__ */React.createElement(Box.default, {
|
|
88
|
+
width: fullWidth ? "100%" : "auto",
|
|
89
|
+
display: "flex",
|
|
90
|
+
align: "center"
|
|
91
|
+
}, /* @__PURE__ */React.createElement(FormControl.default, {
|
|
92
|
+
color: color,
|
|
93
|
+
fullWidth: fullWidth,
|
|
94
|
+
label: label,
|
|
95
|
+
name: name,
|
|
96
|
+
helperText: helperText,
|
|
97
|
+
disabled: disabled,
|
|
98
|
+
required: required,
|
|
99
|
+
showError: showError,
|
|
100
|
+
errorMessage: errorMessage,
|
|
101
|
+
edges: edges,
|
|
102
|
+
hideLabel: hideLabel
|
|
103
|
+
}, /* @__PURE__ */React.createElement(Select_styled.default, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
104
|
+
name: name,
|
|
105
|
+
size: size,
|
|
106
|
+
variant: variant,
|
|
107
|
+
disabled: disabled,
|
|
108
|
+
fullWidth: fullWidth,
|
|
109
|
+
displayEmpty: !!placeholder || allowEmpty,
|
|
110
|
+
error: !!(errorMessage && showError),
|
|
111
|
+
inputProps: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, inputProps), {}, {
|
|
112
|
+
ref: inputRef
|
|
113
|
+
}),
|
|
114
|
+
inputRef: ref,
|
|
115
|
+
MenuProps: _rollupPluginBabelHelpers.objectSpread2({
|
|
116
|
+
style: {
|
|
117
|
+
maxHeight: 500,
|
|
118
|
+
maxWidth: 250
|
|
119
|
+
},
|
|
120
|
+
getContentAnchorEl: null,
|
|
121
|
+
anchorOrigin: {
|
|
122
|
+
vertical: "bottom",
|
|
123
|
+
horizontal: "left"
|
|
124
|
+
}
|
|
125
|
+
}, !!rest.MenuProps && _rollupPluginBabelHelpers.objectSpread2({}, rest.MenuProps)),
|
|
126
|
+
renderValue: function renderValue(selected) {
|
|
127
|
+
var filtered = options.filter(function (option) {
|
|
128
|
+
return selected.includes(option.value);
|
|
129
|
+
});
|
|
130
|
+
if (filtered.length === 0) {
|
|
131
|
+
return /* @__PURE__ */React.createElement("span", null, placeholder);
|
|
132
|
+
}
|
|
133
|
+
return filtered.map(function (option) {
|
|
134
|
+
return option.label;
|
|
135
|
+
}).join(", ");
|
|
136
|
+
},
|
|
137
|
+
IconComponent: IconComponent === void 0 ? KeyboardArrowDownIcon : IconComponent,
|
|
138
|
+
value: value,
|
|
139
|
+
onChange: onChange
|
|
140
|
+
}, rest), {}, {
|
|
141
|
+
native: false,
|
|
142
|
+
multiple: true,
|
|
143
|
+
color: color
|
|
144
|
+
}), function () {
|
|
145
|
+
if (allowEmpty) {
|
|
146
|
+
return /* @__PURE__ */React.createElement(MuiMenuItem, {
|
|
147
|
+
selected: value.length === 0
|
|
148
|
+
}, placeholder);
|
|
149
|
+
}
|
|
150
|
+
return null;
|
|
151
|
+
}(), onToggleAll && /* @__PURE__ */React.createElement(MultiSelect_styled.StyledMultiSelectOption, {
|
|
152
|
+
as: "li",
|
|
153
|
+
item: true
|
|
154
|
+
}, /* @__PURE__ */React.createElement(Box.default, {
|
|
155
|
+
as: "span",
|
|
156
|
+
sx: {
|
|
157
|
+
pointerEvents: "auto"
|
|
158
|
+
},
|
|
159
|
+
display: "inline-flex"
|
|
160
|
+
}, /* @__PURE__ */React.createElement(Checkbox.default, _rollupPluginBabelHelpers.objectSpread2({
|
|
161
|
+
name: "".concat(name, "[]"),
|
|
162
|
+
value: "all",
|
|
163
|
+
label: toggleAllOptionLabel,
|
|
164
|
+
checked: value.length === options.length,
|
|
165
|
+
onChange: handleToggleAll,
|
|
166
|
+
color: "default",
|
|
167
|
+
size: size
|
|
168
|
+
}, checkboxProps)))), options && options.map(function (option) {
|
|
169
|
+
return /* @__PURE__ */React.createElement(MuiMenuItem, {
|
|
170
|
+
key: option.value,
|
|
171
|
+
value: option.value,
|
|
172
|
+
disabled: option.disabled,
|
|
173
|
+
"aria-selected": option.focused,
|
|
174
|
+
"data-focus": option.focused,
|
|
175
|
+
sx: {
|
|
176
|
+
"&&.Mui-selected": {
|
|
177
|
+
backgroundColor: "transparent"
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
disableRipple: true
|
|
181
|
+
}, /* @__PURE__ */React.createElement(MultiSelect_styled.StyledMultiSelectOption, null, /* @__PURE__ */React.createElement(Checkbox.default, _rollupPluginBabelHelpers.objectSpread2({
|
|
182
|
+
name: "".concat(name, "[]"),
|
|
183
|
+
value: option.value,
|
|
184
|
+
label: option.label,
|
|
185
|
+
checked: value.includes(option.value),
|
|
186
|
+
onChange: function onChange() {},
|
|
187
|
+
color: "default",
|
|
188
|
+
size: size
|
|
189
|
+
}, checkboxProps))));
|
|
190
|
+
}))), (onClear && value.length > 0 || keepClearIconSpace) && /* @__PURE__ */React.createElement(Box.default, {
|
|
191
|
+
minWidth: keepClearIconSpace ? "34px" : "initial"
|
|
192
|
+
}, onClear && value.length > 0 && /* @__PURE__ */React.createElement(InputClearIcon.default, {
|
|
193
|
+
onClick: onClear
|
|
194
|
+
})));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
exports.default = MultiSelect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
|
|
4
|
+
var styled = require('styled-components');
|
|
5
|
+
|
|
6
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
7
|
+
var StyledMultiSelectOption = styled.div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
8
|
+
var allowEvents = _ref.allowEvents,
|
|
9
|
+
item = _ref.item;
|
|
10
|
+
return styled.css(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n ", "\n\n ", "\n "])), !allowEvents && styled.css(_templateObject3 || (_templateObject3 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n pointer-events: none;\n "]))), item && styled.css(_templateObject4 || (_templateObject4 = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n padding-top: 6px;\n padding-bottom: 6px;\n padding-left: 16px;\n padding-right: 16px;\n box-sizing: border-box;\n width: auto;\n white-space: nowrap;\n "]))));
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
exports.StyledMultiSelectOption = StyledMultiSelectOption;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.cjs');
|
|
6
6
|
var React = require('react');
|
|
7
|
-
var PropTypes = require('prop-types');
|
|
8
7
|
var Skeleton = require('@mui/material/Skeleton');
|
|
9
8
|
var MuiContainer = require('@mui/material/Container');
|
|
10
9
|
var Box = require('@mui/material/Box');
|
|
@@ -37,8 +36,11 @@ function Nameplate(_ref) {
|
|
|
37
36
|
justifyContent: "space-between",
|
|
38
37
|
flexWrap: "nowrap",
|
|
39
38
|
alignItems: "center",
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
py: 4,
|
|
40
|
+
px: {
|
|
41
|
+
xs: 2,
|
|
42
|
+
sm: 0
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}, skeleton ? /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
|
|
44
46
|
style: {
|
|
@@ -51,44 +53,21 @@ function Nameplate(_ref) {
|
|
|
51
53
|
width: isMobile ? "60%" : "30%",
|
|
52
54
|
height: isMobile ? 22 : 30
|
|
53
55
|
})), /* @__PURE__ */React.createElement(Skeleton, {
|
|
54
|
-
variant: "
|
|
56
|
+
variant: "rectangular",
|
|
55
57
|
height: 100,
|
|
56
58
|
width: 100
|
|
57
59
|
})) : /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", null, title && /* @__PURE__ */React.createElement(Text.default, {
|
|
58
|
-
color: "
|
|
59
|
-
variant: "body1",
|
|
60
|
+
color: "violet.main",
|
|
60
61
|
weight: "600"
|
|
61
|
-
},
|
|
62
|
+
}, title), /* @__PURE__ */React.createElement(Heading.default, {
|
|
62
63
|
as: isMobile ? "h5" : "h3",
|
|
63
|
-
weight: "
|
|
64
|
-
color: "
|
|
64
|
+
weight: "600",
|
|
65
|
+
color: "primary",
|
|
65
66
|
gutterBottom: false
|
|
66
67
|
}, heading, subHeading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("br", null), " ", subHeading))), /* @__PURE__ */React.createElement(Nameplate_styled.StyledImgWrapper, null, logo && /* @__PURE__ */React.createElement(Nameplate_styled.StyledImg, {
|
|
67
68
|
src: logo,
|
|
68
|
-
alt: heading
|
|
69
|
-
}), !logo && heading && /* @__PURE__ */React.createElement(Nameplate_styled.StyledImgText, null, heading[0].toUpperCase()))))));
|
|
69
|
+
alt: typeof heading === "string" ? heading : ""
|
|
70
|
+
}), !logo && typeof heading === "string" && heading && /* @__PURE__ */React.createElement(Nameplate_styled.StyledImgText, null, heading[0].toUpperCase()))))));
|
|
70
71
|
}
|
|
71
|
-
Nameplate.propTypes = {
|
|
72
|
-
/**
|
|
73
|
-
* Heading
|
|
74
|
-
*/
|
|
75
|
-
heading: PropTypes.string,
|
|
76
|
-
/**
|
|
77
|
-
* Sub Heading
|
|
78
|
-
*/
|
|
79
|
-
subHeading: PropTypes.string,
|
|
80
|
-
/**
|
|
81
|
-
* Show skeleton layout
|
|
82
|
-
*/
|
|
83
|
-
skeleton: PropTypes.bool,
|
|
84
|
-
/**
|
|
85
|
-
* URL for the property manager logo
|
|
86
|
-
*/
|
|
87
|
-
logo: PropTypes.string,
|
|
88
|
-
/**
|
|
89
|
-
* Text displayed before heading
|
|
90
|
-
*/
|
|
91
|
-
title: PropTypes.string
|
|
92
|
-
};
|
|
93
72
|
|
|
94
73
|
exports.default = Nameplate;
|
|
@@ -9,9 +9,9 @@ var KeyboardArrowDownIcon = require('@mui/icons-material/KeyboardArrowDown');
|
|
|
9
9
|
var FormControl = require('./FormControl.cjs');
|
|
10
10
|
var Select_styled = require('./Select.styled.cjs');
|
|
11
11
|
|
|
12
|
-
var _excluded = ["color", "disabled", "edges", "errorMessage", "fullWidth", "helperText", "id", "inputRef", "inputProps", "label", "IconComponent", "message", "MenuProps", "name", "native", "placeholder", "required", "showError", "size", "readOnly", "options"],
|
|
12
|
+
var _excluded = ["color", "disabled", "edges", "errorMessage", "fullWidth", "helperText", "id", "inputRef", "inputProps", "label", "IconComponent", "message", "MenuProps", "name", "native", "placeholder", "required", "showError", "size", "readOnly", "options", "renderOptions"],
|
|
13
13
|
_excluded2 = ["label"];
|
|
14
|
-
|
|
14
|
+
var Select = /*#__PURE__*/React.forwardRef(function Select2(_ref, ref) {
|
|
15
15
|
var _ref$color = _ref.color,
|
|
16
16
|
color = _ref$color === void 0 ? "default" : _ref$color,
|
|
17
17
|
_ref$disabled = _ref.disabled,
|
|
@@ -53,6 +53,7 @@ function Select(_ref) {
|
|
|
53
53
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
54
54
|
_ref$options = _ref.options,
|
|
55
55
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
56
|
+
renderOptions = _ref.renderOptions,
|
|
56
57
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
|
57
58
|
var allowEmpty = !!placeholder;
|
|
58
59
|
var inputAttrs = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, readOnly && {
|
|
@@ -103,6 +104,20 @@ function Select(_ref) {
|
|
|
103
104
|
});
|
|
104
105
|
return /* @__PURE__ */React.createElement(Select_styled.StyledSelectValue, null, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label);
|
|
105
106
|
};
|
|
107
|
+
var render = function render(opt, i) {
|
|
108
|
+
if (!native && typeof renderOptions === "function") {
|
|
109
|
+
return renderOptions(opt, i);
|
|
110
|
+
}
|
|
111
|
+
var optionLabel = opt.label,
|
|
112
|
+
others = _rollupPluginBabelHelpers.objectWithoutProperties(opt, _excluded2);
|
|
113
|
+
return /* @__PURE__ */React.createElement(Select_styled.StyledSelectOption, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
114
|
+
key: reactUid.uid(_rollupPluginBabelHelpers.objectSpread2({
|
|
115
|
+
label: optionLabel
|
|
116
|
+
}, others), i)
|
|
117
|
+
}, others), native && {
|
|
118
|
+
as: "option"
|
|
119
|
+
}), optionLabel);
|
|
120
|
+
};
|
|
106
121
|
return /* @__PURE__ */React.createElement(FormControl.default, {
|
|
107
122
|
color: color,
|
|
108
123
|
id: props.id,
|
|
@@ -115,20 +130,11 @@ function Select(_ref) {
|
|
|
115
130
|
required: required,
|
|
116
131
|
size: size
|
|
117
132
|
}, /* @__PURE__ */React.createElement(Select_styled.default, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
133
|
+
ref: ref,
|
|
118
134
|
renderValue: renderValue
|
|
119
135
|
}, props), {}, {
|
|
120
136
|
variant: "outlined"
|
|
121
|
-
}), options.map(
|
|
122
|
-
|
|
123
|
-
others = _rollupPluginBabelHelpers.objectWithoutProperties(_ref2, _excluded2);
|
|
124
|
-
return /* @__PURE__ */React.createElement(Select_styled.StyledSelectOption, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
|
|
125
|
-
key: reactUid.uid(_rollupPluginBabelHelpers.objectSpread2({
|
|
126
|
-
label: optionLabel
|
|
127
|
-
}, others), i)
|
|
128
|
-
}, others), native && {
|
|
129
|
-
as: "option"
|
|
130
|
-
}), optionLabel);
|
|
131
|
-
})));
|
|
132
|
-
}
|
|
137
|
+
}), options.map(render)));
|
|
138
|
+
});
|
|
133
139
|
|
|
134
140
|
exports.default = Select;
|
package/dist/cjs/theme/index.cjs
CHANGED
|
@@ -27,10 +27,6 @@ var palette = {
|
|
|
27
27
|
contrastText: "#fff"
|
|
28
28
|
},
|
|
29
29
|
secondary: {
|
|
30
|
-
// main: '#394869',
|
|
31
|
-
// light: '#526897',
|
|
32
|
-
// dark: '#2E3B57',
|
|
33
|
-
// contrastText: '#fff',
|
|
34
30
|
main: "#274A9A",
|
|
35
31
|
light: "#2F5BC0",
|
|
36
32
|
dark: "#254794",
|
|
@@ -96,6 +92,12 @@ var palette = {
|
|
|
96
92
|
dark: "#884900",
|
|
97
93
|
contrastText: "#fff"
|
|
98
94
|
},
|
|
95
|
+
violet: {
|
|
96
|
+
main: "#6E668F",
|
|
97
|
+
light: "#8b84a5",
|
|
98
|
+
dark: "#4d4764",
|
|
99
|
+
contrastText: "#fff"
|
|
100
|
+
},
|
|
99
101
|
text: {
|
|
100
102
|
primary: "#0e0044",
|
|
101
103
|
secondary: "#274A9A",
|
|
@@ -185,7 +187,7 @@ var typography = {
|
|
|
185
187
|
fontWeight: 400
|
|
186
188
|
},
|
|
187
189
|
body1: {
|
|
188
|
-
fontSize:
|
|
190
|
+
fontSize: 16,
|
|
189
191
|
fontWeight: 500
|
|
190
192
|
},
|
|
191
193
|
body2: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CancelIcon from '@mui/icons-material/Cancel';
|
|
3
|
+
import IconButton from './IconButton.js';
|
|
4
|
+
import StyledInputClearIcon from './InputClearIcon.styled.js';
|
|
5
|
+
|
|
6
|
+
function InputClearIcon(_ref) {
|
|
7
|
+
var onClick = _ref.onClick;
|
|
8
|
+
return /* @__PURE__ */React.createElement(StyledInputClearIcon, null, /* @__PURE__ */React.createElement(IconButton, {
|
|
9
|
+
onClick: onClick,
|
|
10
|
+
size: "small",
|
|
11
|
+
color: "inherit",
|
|
12
|
+
edges: "rounded"
|
|
13
|
+
}, /* @__PURE__ */React.createElement(CancelIcon, null)));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { InputClearIcon as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { taggedTemplateLiteral as _taggedTemplateLiteral } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { styled } from '@mui/material/styles';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { getObjectProp } from '../utils/helpers/object.js';
|
|
5
|
+
|
|
6
|
+
var _templateObject, _templateObject2;
|
|
7
|
+
var StyledInputClearIcon = styled("div")(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
8
|
+
var theme = _ref.theme;
|
|
9
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n color: ", ";\n margin-left: 5px;\n transition: color 200ms ease;\n svg {\n font-size: 1.15rem;\n }\n\n &:hover {\n color: ", ";\n }\n "])), getObjectProp(theme, "vars.palette.grey.300", null), getObjectProp(theme, "vars.palette.grey.400", null));
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export { StyledInputClearIcon as default };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import MuiMenuItem from '@mui/material/MenuItem';
|
|
4
|
+
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
5
|
+
import Box from './Box.js';
|
|
6
|
+
import Checkbox from './Checkbox.js';
|
|
7
|
+
import FormControl from './FormControl.js';
|
|
8
|
+
import StyledSelect from './Select.styled.js';
|
|
9
|
+
import InputClearIcon from './InputClearIcon.js';
|
|
10
|
+
import { StyledMultiSelectOption } from './MultiSelect.styled.js';
|
|
11
|
+
|
|
12
|
+
var _excluded = ["fullWidth", "color", "label", "helperText", "edges", "variant", "disabled", "required", "options", "onChange", "showError", "errorMessage", "inputRef", "placeholder", "IconComponent", "size", "value", "name", "inputProps", "hideLabel", "allowEmpty", "weight", "onClear", "keepClearIconSpace", "checkboxProps", "onToggleAll", "toggleAllOptionLabel"];
|
|
13
|
+
function MultiSelect(_ref) {
|
|
14
|
+
var _ref$fullWidth = _ref.fullWidth,
|
|
15
|
+
fullWidth = _ref$fullWidth === void 0 ? true : _ref$fullWidth,
|
|
16
|
+
_ref$color = _ref.color,
|
|
17
|
+
color = _ref$color === void 0 ? "default" : _ref$color,
|
|
18
|
+
_ref$label = _ref.label,
|
|
19
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
20
|
+
_ref$helperText = _ref.helperText,
|
|
21
|
+
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
22
|
+
_ref$edges = _ref.edges,
|
|
23
|
+
edges = _ref$edges === void 0 ? "normal" : _ref$edges,
|
|
24
|
+
_ref$variant = _ref.variant,
|
|
25
|
+
variant = _ref$variant === void 0 ? "outlined" : _ref$variant,
|
|
26
|
+
_ref$disabled = _ref.disabled,
|
|
27
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
28
|
+
_ref$required = _ref.required,
|
|
29
|
+
required = _ref$required === void 0 ? false : _ref$required,
|
|
30
|
+
options = _ref.options,
|
|
31
|
+
_ref$onChange = _ref.onChange,
|
|
32
|
+
onChange = _ref$onChange === void 0 ? function () {
|
|
33
|
+
return null;
|
|
34
|
+
} : _ref$onChange,
|
|
35
|
+
_ref$showError = _ref.showError,
|
|
36
|
+
showError = _ref$showError === void 0 ? false : _ref$showError,
|
|
37
|
+
_ref$errorMessage = _ref.errorMessage,
|
|
38
|
+
errorMessage = _ref$errorMessage === void 0 ? "" : _ref$errorMessage,
|
|
39
|
+
_ref$inputRef = _ref.inputRef,
|
|
40
|
+
inputRef = _ref$inputRef === void 0 ? null : _ref$inputRef,
|
|
41
|
+
_ref$placeholder = _ref.placeholder,
|
|
42
|
+
placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
|
|
43
|
+
_ref$IconComponent = _ref.IconComponent,
|
|
44
|
+
IconComponent = _ref$IconComponent === void 0 ? void 0 : _ref$IconComponent,
|
|
45
|
+
_ref$size = _ref.size,
|
|
46
|
+
size = _ref$size === void 0 ? "medium" : _ref$size,
|
|
47
|
+
_ref$value = _ref.value,
|
|
48
|
+
value = _ref$value === void 0 ? [] : _ref$value,
|
|
49
|
+
name = _ref.name,
|
|
50
|
+
_ref$inputProps = _ref.inputProps,
|
|
51
|
+
inputProps = _ref$inputProps === void 0 ? {} : _ref$inputProps,
|
|
52
|
+
_ref$hideLabel = _ref.hideLabel,
|
|
53
|
+
hideLabel = _ref$hideLabel === void 0 ? false : _ref$hideLabel,
|
|
54
|
+
_ref$allowEmpty = _ref.allowEmpty,
|
|
55
|
+
allowEmpty = _ref$allowEmpty === void 0 ? false : _ref$allowEmpty;
|
|
56
|
+
_ref.weight;
|
|
57
|
+
var _ref$onClear = _ref.onClear,
|
|
58
|
+
onClear = _ref$onClear === void 0 ? void 0 : _ref$onClear,
|
|
59
|
+
_ref$keepClearIconSpa = _ref.keepClearIconSpace,
|
|
60
|
+
keepClearIconSpace = _ref$keepClearIconSpa === void 0 ? false : _ref$keepClearIconSpa,
|
|
61
|
+
_ref$checkboxProps = _ref.checkboxProps,
|
|
62
|
+
checkboxProps = _ref$checkboxProps === void 0 ? {} : _ref$checkboxProps,
|
|
63
|
+
_ref$onToggleAll = _ref.onToggleAll,
|
|
64
|
+
onToggleAll = _ref$onToggleAll === void 0 ? void 0 : _ref$onToggleAll,
|
|
65
|
+
_ref$toggleAllOptionL = _ref.toggleAllOptionLabel,
|
|
66
|
+
toggleAllOptionLabel = _ref$toggleAllOptionL === void 0 ? "Select All" : _ref$toggleAllOptionL,
|
|
67
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
68
|
+
var ref = useRef(null);
|
|
69
|
+
var handleToggleAll = function handleToggleAll(e) {
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
var filtered = value.filter(function (val) {
|
|
72
|
+
return !isNaN(parseFloat(val)) || !!val;
|
|
73
|
+
});
|
|
74
|
+
var checked = filtered.length === options.length;
|
|
75
|
+
var vals = !checked ? options.map(function (option) {
|
|
76
|
+
return option.value;
|
|
77
|
+
}) : [];
|
|
78
|
+
if (typeof onToggleAll === "function") {
|
|
79
|
+
onToggleAll(vals);
|
|
80
|
+
}
|
|
81
|
+
return false;
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */React.createElement(Box, {
|
|
84
|
+
width: fullWidth ? "100%" : "auto",
|
|
85
|
+
display: "flex",
|
|
86
|
+
align: "center"
|
|
87
|
+
}, /* @__PURE__ */React.createElement(FormControl, {
|
|
88
|
+
color: color,
|
|
89
|
+
fullWidth: fullWidth,
|
|
90
|
+
label: label,
|
|
91
|
+
name: name,
|
|
92
|
+
helperText: helperText,
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
required: required,
|
|
95
|
+
showError: showError,
|
|
96
|
+
errorMessage: errorMessage,
|
|
97
|
+
edges: edges,
|
|
98
|
+
hideLabel: hideLabel
|
|
99
|
+
}, /* @__PURE__ */React.createElement(StyledSelect, _objectSpread2(_objectSpread2({
|
|
100
|
+
name: name,
|
|
101
|
+
size: size,
|
|
102
|
+
variant: variant,
|
|
103
|
+
disabled: disabled,
|
|
104
|
+
fullWidth: fullWidth,
|
|
105
|
+
displayEmpty: !!placeholder || allowEmpty,
|
|
106
|
+
error: !!(errorMessage && showError),
|
|
107
|
+
inputProps: _objectSpread2(_objectSpread2({}, inputProps), {}, {
|
|
108
|
+
ref: inputRef
|
|
109
|
+
}),
|
|
110
|
+
inputRef: ref,
|
|
111
|
+
MenuProps: _objectSpread2({
|
|
112
|
+
style: {
|
|
113
|
+
maxHeight: 500,
|
|
114
|
+
maxWidth: 250
|
|
115
|
+
},
|
|
116
|
+
getContentAnchorEl: null,
|
|
117
|
+
anchorOrigin: {
|
|
118
|
+
vertical: "bottom",
|
|
119
|
+
horizontal: "left"
|
|
120
|
+
}
|
|
121
|
+
}, !!rest.MenuProps && _objectSpread2({}, rest.MenuProps)),
|
|
122
|
+
renderValue: function renderValue(selected) {
|
|
123
|
+
var filtered = options.filter(function (option) {
|
|
124
|
+
return selected.includes(option.value);
|
|
125
|
+
});
|
|
126
|
+
if (filtered.length === 0) {
|
|
127
|
+
return /* @__PURE__ */React.createElement("span", null, placeholder);
|
|
128
|
+
}
|
|
129
|
+
return filtered.map(function (option) {
|
|
130
|
+
return option.label;
|
|
131
|
+
}).join(", ");
|
|
132
|
+
},
|
|
133
|
+
IconComponent: IconComponent === void 0 ? KeyboardArrowDownIcon : IconComponent,
|
|
134
|
+
value: value,
|
|
135
|
+
onChange: onChange
|
|
136
|
+
}, rest), {}, {
|
|
137
|
+
native: false,
|
|
138
|
+
multiple: true,
|
|
139
|
+
color: color
|
|
140
|
+
}), function () {
|
|
141
|
+
if (allowEmpty) {
|
|
142
|
+
return /* @__PURE__ */React.createElement(MuiMenuItem, {
|
|
143
|
+
selected: value.length === 0
|
|
144
|
+
}, placeholder);
|
|
145
|
+
}
|
|
146
|
+
return null;
|
|
147
|
+
}(), onToggleAll && /* @__PURE__ */React.createElement(StyledMultiSelectOption, {
|
|
148
|
+
as: "li",
|
|
149
|
+
item: true
|
|
150
|
+
}, /* @__PURE__ */React.createElement(Box, {
|
|
151
|
+
as: "span",
|
|
152
|
+
sx: {
|
|
153
|
+
pointerEvents: "auto"
|
|
154
|
+
},
|
|
155
|
+
display: "inline-flex"
|
|
156
|
+
}, /* @__PURE__ */React.createElement(Checkbox, _objectSpread2({
|
|
157
|
+
name: "".concat(name, "[]"),
|
|
158
|
+
value: "all",
|
|
159
|
+
label: toggleAllOptionLabel,
|
|
160
|
+
checked: value.length === options.length,
|
|
161
|
+
onChange: handleToggleAll,
|
|
162
|
+
color: "default",
|
|
163
|
+
size: size
|
|
164
|
+
}, checkboxProps)))), options && options.map(function (option) {
|
|
165
|
+
return /* @__PURE__ */React.createElement(MuiMenuItem, {
|
|
166
|
+
key: option.value,
|
|
167
|
+
value: option.value,
|
|
168
|
+
disabled: option.disabled,
|
|
169
|
+
"aria-selected": option.focused,
|
|
170
|
+
"data-focus": option.focused,
|
|
171
|
+
sx: {
|
|
172
|
+
"&&.Mui-selected": {
|
|
173
|
+
backgroundColor: "transparent"
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
disableRipple: true
|
|
177
|
+
}, /* @__PURE__ */React.createElement(StyledMultiSelectOption, null, /* @__PURE__ */React.createElement(Checkbox, _objectSpread2({
|
|
178
|
+
name: "".concat(name, "[]"),
|
|
179
|
+
value: option.value,
|
|
180
|
+
label: option.label,
|
|
181
|
+
checked: value.includes(option.value),
|
|
182
|
+
onChange: function onChange() {},
|
|
183
|
+
color: "default",
|
|
184
|
+
size: size
|
|
185
|
+
}, checkboxProps))));
|
|
186
|
+
}))), (onClear && value.length > 0 || keepClearIconSpace) && /* @__PURE__ */React.createElement(Box, {
|
|
187
|
+
minWidth: keepClearIconSpace ? "34px" : "initial"
|
|
188
|
+
}, onClear && value.length > 0 && /* @__PURE__ */React.createElement(InputClearIcon, {
|
|
189
|
+
onClick: onClear
|
|
190
|
+
})));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export { MultiSelect as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { taggedTemplateLiteral as _taggedTemplateLiteral } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
5
|
+
var StyledMultiSelectOption = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n"])), function (_ref) {
|
|
6
|
+
var allowEvents = _ref.allowEvents,
|
|
7
|
+
item = _ref.item;
|
|
8
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n\n ", "\n "])), !allowEvents && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n pointer-events: none;\n "]))), item && css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding-top: 6px;\n padding-bottom: 6px;\n padding-left: 16px;\n padding-right: 16px;\n box-sizing: border-box;\n width: auto;\n white-space: nowrap;\n "]))));
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { StyledMultiSelectOption };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
3
|
import Skeleton from '@mui/material/Skeleton';
|
|
5
4
|
import MuiContainer from '@mui/material/Container';
|
|
6
5
|
import Box from '@mui/material/Box';
|
|
@@ -33,8 +32,11 @@ function Nameplate(_ref) {
|
|
|
33
32
|
justifyContent: "space-between",
|
|
34
33
|
flexWrap: "nowrap",
|
|
35
34
|
alignItems: "center",
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
py: 4,
|
|
36
|
+
px: {
|
|
37
|
+
xs: 2,
|
|
38
|
+
sm: 0
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
}, skeleton ? /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", {
|
|
40
42
|
style: {
|
|
@@ -47,44 +49,21 @@ function Nameplate(_ref) {
|
|
|
47
49
|
width: isMobile ? "60%" : "30%",
|
|
48
50
|
height: isMobile ? 22 : 30
|
|
49
51
|
})), /* @__PURE__ */React.createElement(Skeleton, {
|
|
50
|
-
variant: "
|
|
52
|
+
variant: "rectangular",
|
|
51
53
|
height: 100,
|
|
52
54
|
width: 100
|
|
53
55
|
})) : /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("div", null, title && /* @__PURE__ */React.createElement(Text, {
|
|
54
|
-
color: "
|
|
55
|
-
variant: "body1",
|
|
56
|
+
color: "violet.main",
|
|
56
57
|
weight: "600"
|
|
57
|
-
},
|
|
58
|
+
}, title), /* @__PURE__ */React.createElement(Heading, {
|
|
58
59
|
as: isMobile ? "h5" : "h3",
|
|
59
|
-
weight: "
|
|
60
|
-
color: "
|
|
60
|
+
weight: "600",
|
|
61
|
+
color: "primary",
|
|
61
62
|
gutterBottom: false
|
|
62
63
|
}, heading, subHeading && /* @__PURE__ */React.createElement(React.Fragment, null, /* @__PURE__ */React.createElement("br", null), " ", subHeading))), /* @__PURE__ */React.createElement(StyledImgWrapper, null, logo && /* @__PURE__ */React.createElement(StyledImg, {
|
|
63
64
|
src: logo,
|
|
64
|
-
alt: heading
|
|
65
|
-
}), !logo && heading && /* @__PURE__ */React.createElement(StyledImgText, null, heading[0].toUpperCase()))))));
|
|
65
|
+
alt: typeof heading === "string" ? heading : ""
|
|
66
|
+
}), !logo && typeof heading === "string" && heading && /* @__PURE__ */React.createElement(StyledImgText, null, heading[0].toUpperCase()))))));
|
|
66
67
|
}
|
|
67
|
-
Nameplate.propTypes = {
|
|
68
|
-
/**
|
|
69
|
-
* Heading
|
|
70
|
-
*/
|
|
71
|
-
heading: PropTypes.string,
|
|
72
|
-
/**
|
|
73
|
-
* Sub Heading
|
|
74
|
-
*/
|
|
75
|
-
subHeading: PropTypes.string,
|
|
76
|
-
/**
|
|
77
|
-
* Show skeleton layout
|
|
78
|
-
*/
|
|
79
|
-
skeleton: PropTypes.bool,
|
|
80
|
-
/**
|
|
81
|
-
* URL for the property manager logo
|
|
82
|
-
*/
|
|
83
|
-
logo: PropTypes.string,
|
|
84
|
-
/**
|
|
85
|
-
* Text displayed before heading
|
|
86
|
-
*/
|
|
87
|
-
title: PropTypes.string
|
|
88
|
-
};
|
|
89
68
|
|
|
90
69
|
export { Nameplate as default };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
3
|
import { uid } from 'react-uid';
|
|
4
4
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
|
5
5
|
import FormControl from './FormControl.js';
|
|
6
|
-
import StyledSelect, {
|
|
6
|
+
import StyledSelect, { StyledPlaceholder, StyledSelectValue, StyledSelectOption } from './Select.styled.js';
|
|
7
7
|
|
|
8
|
-
var _excluded = ["color", "disabled", "edges", "errorMessage", "fullWidth", "helperText", "id", "inputRef", "inputProps", "label", "IconComponent", "message", "MenuProps", "name", "native", "placeholder", "required", "showError", "size", "readOnly", "options"],
|
|
8
|
+
var _excluded = ["color", "disabled", "edges", "errorMessage", "fullWidth", "helperText", "id", "inputRef", "inputProps", "label", "IconComponent", "message", "MenuProps", "name", "native", "placeholder", "required", "showError", "size", "readOnly", "options", "renderOptions"],
|
|
9
9
|
_excluded2 = ["label"];
|
|
10
|
-
|
|
10
|
+
var Select = /*#__PURE__*/forwardRef(function Select2(_ref, ref) {
|
|
11
11
|
var _ref$color = _ref.color,
|
|
12
12
|
color = _ref$color === void 0 ? "default" : _ref$color,
|
|
13
13
|
_ref$disabled = _ref.disabled,
|
|
@@ -49,6 +49,7 @@ function Select(_ref) {
|
|
|
49
49
|
readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
|
|
50
50
|
_ref$options = _ref.options,
|
|
51
51
|
options = _ref$options === void 0 ? [] : _ref$options,
|
|
52
|
+
renderOptions = _ref.renderOptions,
|
|
52
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
53
54
|
var allowEmpty = !!placeholder;
|
|
54
55
|
var inputAttrs = _objectSpread2(_objectSpread2({}, readOnly && {
|
|
@@ -99,6 +100,20 @@ function Select(_ref) {
|
|
|
99
100
|
});
|
|
100
101
|
return /* @__PURE__ */React.createElement(StyledSelectValue, null, selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label);
|
|
101
102
|
};
|
|
103
|
+
var render = function render(opt, i) {
|
|
104
|
+
if (!native && typeof renderOptions === "function") {
|
|
105
|
+
return renderOptions(opt, i);
|
|
106
|
+
}
|
|
107
|
+
var optionLabel = opt.label,
|
|
108
|
+
others = _objectWithoutProperties(opt, _excluded2);
|
|
109
|
+
return /* @__PURE__ */React.createElement(StyledSelectOption, _objectSpread2(_objectSpread2({
|
|
110
|
+
key: uid(_objectSpread2({
|
|
111
|
+
label: optionLabel
|
|
112
|
+
}, others), i)
|
|
113
|
+
}, others), native && {
|
|
114
|
+
as: "option"
|
|
115
|
+
}), optionLabel);
|
|
116
|
+
};
|
|
102
117
|
return /* @__PURE__ */React.createElement(FormControl, {
|
|
103
118
|
color: color,
|
|
104
119
|
id: props.id,
|
|
@@ -111,20 +126,11 @@ function Select(_ref) {
|
|
|
111
126
|
required: required,
|
|
112
127
|
size: size
|
|
113
128
|
}, /* @__PURE__ */React.createElement(StyledSelect, _objectSpread2(_objectSpread2({
|
|
129
|
+
ref: ref,
|
|
114
130
|
renderValue: renderValue
|
|
115
131
|
}, props), {}, {
|
|
116
132
|
variant: "outlined"
|
|
117
|
-
}), options.map(
|
|
118
|
-
|
|
119
|
-
others = _objectWithoutProperties(_ref2, _excluded2);
|
|
120
|
-
return /* @__PURE__ */React.createElement(StyledSelectOption, _objectSpread2(_objectSpread2({
|
|
121
|
-
key: uid(_objectSpread2({
|
|
122
|
-
label: optionLabel
|
|
123
|
-
}, others), i)
|
|
124
|
-
}, others), native && {
|
|
125
|
-
as: "option"
|
|
126
|
-
}), optionLabel);
|
|
127
|
-
})));
|
|
128
|
-
}
|
|
133
|
+
}), options.map(render)));
|
|
134
|
+
});
|
|
129
135
|
|
|
130
136
|
export { Select as default };
|
package/dist/esm/theme/index.js
CHANGED
|
@@ -23,10 +23,6 @@ var palette = {
|
|
|
23
23
|
contrastText: "#fff"
|
|
24
24
|
},
|
|
25
25
|
secondary: {
|
|
26
|
-
// main: '#394869',
|
|
27
|
-
// light: '#526897',
|
|
28
|
-
// dark: '#2E3B57',
|
|
29
|
-
// contrastText: '#fff',
|
|
30
26
|
main: "#274A9A",
|
|
31
27
|
light: "#2F5BC0",
|
|
32
28
|
dark: "#254794",
|
|
@@ -92,6 +88,12 @@ var palette = {
|
|
|
92
88
|
dark: "#884900",
|
|
93
89
|
contrastText: "#fff"
|
|
94
90
|
},
|
|
91
|
+
violet: {
|
|
92
|
+
main: "#6E668F",
|
|
93
|
+
light: "#8b84a5",
|
|
94
|
+
dark: "#4d4764",
|
|
95
|
+
contrastText: "#fff"
|
|
96
|
+
},
|
|
95
97
|
text: {
|
|
96
98
|
primary: "#0e0044",
|
|
97
99
|
secondary: "#274A9A",
|
|
@@ -181,7 +183,7 @@ var typography = {
|
|
|
181
183
|
fontWeight: 400
|
|
182
184
|
},
|
|
183
185
|
body1: {
|
|
184
|
-
fontSize:
|
|
186
|
+
fontSize: 16,
|
|
185
187
|
fontWeight: 500
|
|
186
188
|
},
|
|
187
189
|
body2: {
|