@portnet/ui 2.0.8 → 3.0.1
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/package.json +1 -4
- package/dist/components/buttons/PuiButton.js +0 -146
- package/dist/components/buttons/PuiIconButton.js +0 -99
- package/dist/components/buttons/PuiNewUserButton.js +0 -121
- package/dist/components/common/PuiAlertContext.js +0 -13
- package/dist/components/common/StyledMuiButton.js +0 -49
- package/dist/components/common/StyledMuiTextField.js +0 -157
- package/dist/components/inputs/PuiAutocomplete.js +0 -353
- package/dist/components/inputs/PuiCheckbox.js +0 -310
- package/dist/components/inputs/PuiCheckboxGroup.js +0 -215
- package/dist/components/inputs/PuiCheckboxItem.js +0 -163
- package/dist/components/inputs/PuiDateField.js +0 -281
- package/dist/components/inputs/PuiDateTimeField.js +0 -397
- package/dist/components/inputs/PuiFileField.js +0 -338
- package/dist/components/inputs/PuiRadioGroup.js +0 -198
- package/dist/components/inputs/PuiRadioItem.js +0 -101
- package/dist/components/inputs/PuiSelect.js +0 -425
- package/dist/components/inputs/PuiTextField.js +0 -264
- package/dist/components/others/PuiBadge.js +0 -58
- package/dist/components/others/PuiChip.js +0 -291
- package/dist/components/others/PuiDialog.js +0 -112
- package/dist/components/others/PuiFormikForm.js +0 -71
- package/dist/components/others/PuiGrid.js +0 -23
- package/dist/components/others/PuiIcon.js +0 -93
- package/dist/components/others/PuiLoadingBackdrop.js +0 -32
- package/dist/components/others/PuiMainContainer.js +0 -42
- package/dist/components/others/PuiNavigation.js +0 -69
- package/dist/components/others/PuiSection.js +0 -99
- package/dist/components/others/PuiTooltip.js +0 -87
- package/dist/components/providers/PuiAlertProvider.js +0 -135
- package/dist/components/providers/PuiLocalizationProvider.js +0 -34
- package/dist/components/referentiel/common/ReferetielContext.js +0 -13
- package/dist/components/referentiel/common/constants/specificReferentielsApis.js +0 -22
- package/dist/components/referentiel/common/constants/specificReferentielsBaseColumns.js +0 -691
- package/dist/components/referentiel/common/constants/specificReferentielsBaseFilters.js +0 -598
- package/dist/components/referentiel/common/constants/specificReferentielsInitialValues.js +0 -80
- package/dist/components/referentiel/common/constants/specificReferentielsKeys.js +0 -18
- package/dist/components/referentiel/common/constants/specificReferentielsTitles.js +0 -22
- package/dist/components/referentiel/common/constants/specificReferentielsValidationSchemas.js +0 -86
- package/dist/components/referentiel/components/PuiBasePopupReferentielField.js +0 -357
- package/dist/components/referentiel/components/PuiCustomPopupReferentielField.js +0 -182
- package/dist/components/referentiel/components/PuiSimplePopupReferentielField.js +0 -326
- package/dist/components/referentiel/components/PuiSimpleReferentielField.js +0 -204
- package/dist/components/referentiel/components/PuiSpecificReferentielField.js +0 -328
- package/dist/components/referentiel/providers/PuiReferentielProvider.js +0 -67
- package/dist/components/tab/PuiTab.js +0 -25
- package/dist/components/tab/PuiTabs.js +0 -149
- package/dist/components/table/ActionPopover.js +0 -56
- package/dist/components/table/PuiTable.js +0 -688
- package/dist/components/table/PuiTableAction.js +0 -65
- package/dist/components/typography/PuiDefinition.js +0 -42
- package/dist/components/typography/PuiIndication.js +0 -81
- package/dist/components/typography/PuiMainTitle.js +0 -88
- package/dist/components/ui/dialogs/PuiSearchDialog.js +0 -255
- package/dist/components/ui/layout/Header.js +0 -253
- package/dist/components/ui/layout/Layout.js +0 -104
- package/dist/components/ui/layout/Sidebar.js +0 -193
- package/dist/components/ui/layout/index.js +0 -29
- package/dist/components/ui/pages/errors/PuiErrorBasePage.js +0 -73
- package/dist/components/ui/pages/errors/PuiForbiddenErrorPage.js +0 -36
- package/dist/components/ui/pages/errors/PuiNetworkErrorPage.js +0 -36
- package/dist/components/ui/pages/errors/PuiNotFoundErrorPage.js +0 -30
- package/dist/components/ui/pages/errors/PuiServerErrorPage.js +0 -37
- package/dist/components/ui/pages/general/PuiDefaultPage.js +0 -68
- package/dist/components/ui/pages/general/PuiSearchPage.js +0 -436
- package/dist/config/ThemeProvider.js +0 -32
- package/dist/config/apperance.js +0 -26
- package/dist/config/mapping.js +0 -26
- package/dist/config/referentiel.js +0 -10
- package/dist/config/styleUtils.js +0 -135
- package/dist/config/theme.js +0 -183
- package/dist/general/yupValidationErrors.js +0 -8
- package/dist/hooks/useAlert.js +0 -20
- package/dist/hooks/useAxios.js +0 -25
- package/dist/hooks/useQuery.js +0 -21
- package/dist/index.js +0 -434
|
@@ -1,353 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.find.js");
|
|
11
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
12
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
13
|
-
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
14
|
-
var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
|
15
|
-
var _material = require("@mui/material");
|
|
16
|
-
var _styles = require("@mui/material/styles");
|
|
17
|
-
var _formik = require("formik");
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
20
|
-
var React = _react;
|
|
21
|
-
var _apperance = require("../../config/apperance");
|
|
22
|
-
var _StyledMuiTextField = _interopRequireDefault(require("../common/StyledMuiTextField"));
|
|
23
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["id", "className", "sx", "label", "name", "value", "error", "disabled", "required", "focused", "loading", "fullWidth", "helperText", "readOnly", "options", "onChange", "isOptionEqualToValue", "getOptionLabel", "getOptionValue", "getOptionKey"],
|
|
25
|
-
_excluded2 = ["id", "className", "sx", "label", "name", "value", "error", "disabled", "required", "focused", "loading", "fullWidth", "helperText", "readOnly", "options", "onChange", "getOptionLabel", "getOptionValue", "getOptionKey"],
|
|
26
|
-
_excluded3 = ["formik", "id", "className", "sx", "label", "name", "value", "error", "disabled", "required", "focused", "loading", "fullWidth", "helperText", "readOnly", "options", "onChange", "isOptionEqualToValue", "getOptionLabel", "getOptionValue", "getOptionKey"];
|
|
27
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
28
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
30
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
31
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
32
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
33
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
34
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
35
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
36
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
37
|
-
const StyledAutocompleteMuiTextField = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledMuiTextField.default, _objectSpread({
|
|
38
|
-
ref: ref
|
|
39
|
-
}, props))))(() => {
|
|
40
|
-
return {
|
|
41
|
-
"& .MuiInputBase-root": {
|
|
42
|
-
padding: 0,
|
|
43
|
-
"&.Mui-error .MuiSvgIcon-root": {
|
|
44
|
-
color: _apperance.palette.error
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"& .MuiAutocomplete-endAdornment .MuiButtonBase-root:hover": {
|
|
48
|
-
backgroundColor: "transparent"
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
const PuiStandardAutocomplete = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
53
|
-
let {
|
|
54
|
-
id,
|
|
55
|
-
className,
|
|
56
|
-
sx,
|
|
57
|
-
label,
|
|
58
|
-
name,
|
|
59
|
-
value,
|
|
60
|
-
error,
|
|
61
|
-
disabled,
|
|
62
|
-
required,
|
|
63
|
-
focused,
|
|
64
|
-
loading,
|
|
65
|
-
fullWidth,
|
|
66
|
-
helperText,
|
|
67
|
-
readOnly,
|
|
68
|
-
options,
|
|
69
|
-
onChange,
|
|
70
|
-
isOptionEqualToValue,
|
|
71
|
-
getOptionLabel,
|
|
72
|
-
getOptionValue,
|
|
73
|
-
getOptionKey
|
|
74
|
-
} = _ref,
|
|
75
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
76
|
-
const handleChange = (event, option) => {
|
|
77
|
-
onChange(option !== null ? getOptionValue(option) : null);
|
|
78
|
-
};
|
|
79
|
-
const inputChangeHandler = (event, newInputValue, reason) => {
|
|
80
|
-
if (reason === "clear") {
|
|
81
|
-
onChange(null);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Autocomplete, _objectSpread({
|
|
85
|
-
ref: ref,
|
|
86
|
-
id: id,
|
|
87
|
-
className: className,
|
|
88
|
-
sx: sx,
|
|
89
|
-
label: label,
|
|
90
|
-
name: name,
|
|
91
|
-
value: value,
|
|
92
|
-
options: options,
|
|
93
|
-
disabled: loading || disabled,
|
|
94
|
-
loading: loading,
|
|
95
|
-
readOnly: readOnly,
|
|
96
|
-
clearText: "",
|
|
97
|
-
closeText: "",
|
|
98
|
-
openText: "",
|
|
99
|
-
fullWidth: fullWidth,
|
|
100
|
-
noOptionsText: "Pas d'options",
|
|
101
|
-
getOptionLabel: getOptionLabel,
|
|
102
|
-
isOptionEqualToValue: isOptionEqualToValue,
|
|
103
|
-
onChange: handleChange,
|
|
104
|
-
clearIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Clear.default, {
|
|
105
|
-
fontSize: "small"
|
|
106
|
-
}),
|
|
107
|
-
onInputChange: inputChangeHandler,
|
|
108
|
-
popupIcon: loading || disabled || readOnly ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowDropDown.default, {}),
|
|
109
|
-
PaperComponent: _ref2 => {
|
|
110
|
-
let {
|
|
111
|
-
children
|
|
112
|
-
} = _ref2;
|
|
113
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Paper, {
|
|
114
|
-
style: {
|
|
115
|
-
background: "white",
|
|
116
|
-
fontSize: 13
|
|
117
|
-
},
|
|
118
|
-
children: children
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
componentsProps: {
|
|
122
|
-
popper: {
|
|
123
|
-
sx: {
|
|
124
|
-
"& .MuiAutocomplete-listbox": {
|
|
125
|
-
paddingY: 0,
|
|
126
|
-
"& .MuiAutocomplete-option:not(:last-child)": {
|
|
127
|
-
borderBottom: "1px solid ".concat(_apperance.palette.gray.light)
|
|
128
|
-
},
|
|
129
|
-
"& .MuiAutocomplete-option": {
|
|
130
|
-
minHeight: "fit-content !important"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
renderOption: (props, option) => {
|
|
137
|
-
return /*#__PURE__*/(0, _react.createElement)(_material.MenuItem, _objectSpread(_objectSpread({}, props), {}, {
|
|
138
|
-
value: getOptionValue(option),
|
|
139
|
-
key: getOptionKey(option),
|
|
140
|
-
sx: {
|
|
141
|
-
fontSize: 13
|
|
142
|
-
}
|
|
143
|
-
}), getOptionLabel(option));
|
|
144
|
-
},
|
|
145
|
-
renderInput: params => {
|
|
146
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledAutocompleteMuiTextField, _objectSpread(_objectSpread({}, params), {}, {
|
|
147
|
-
required: required,
|
|
148
|
-
focused: focused,
|
|
149
|
-
fullWidth: fullWidth,
|
|
150
|
-
label: label,
|
|
151
|
-
error: error,
|
|
152
|
-
helperText: helperText,
|
|
153
|
-
inputProps: _objectSpread(_objectSpread({}, params.inputProps), {}, {
|
|
154
|
-
name
|
|
155
|
-
}),
|
|
156
|
-
InputProps: _objectSpread(_objectSpread({}, params.InputProps), {}, {
|
|
157
|
-
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
158
|
-
children: [loading && !disabled ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
|
|
159
|
-
size: 16,
|
|
160
|
-
sx: {
|
|
161
|
-
color: _apperance.palette.primary,
|
|
162
|
-
marginRight: "-25px"
|
|
163
|
-
}
|
|
164
|
-
}) : null, params.InputProps.endAdornment]
|
|
165
|
-
})
|
|
166
|
-
})
|
|
167
|
-
}));
|
|
168
|
-
}
|
|
169
|
-
}, rest));
|
|
170
|
-
});
|
|
171
|
-
const PuiFormikAutocomplete = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
172
|
-
let {
|
|
173
|
-
id,
|
|
174
|
-
className,
|
|
175
|
-
sx,
|
|
176
|
-
label,
|
|
177
|
-
name,
|
|
178
|
-
value,
|
|
179
|
-
error,
|
|
180
|
-
disabled,
|
|
181
|
-
required,
|
|
182
|
-
focused,
|
|
183
|
-
loading,
|
|
184
|
-
fullWidth,
|
|
185
|
-
helperText,
|
|
186
|
-
readOnly,
|
|
187
|
-
options,
|
|
188
|
-
onChange,
|
|
189
|
-
getOptionLabel,
|
|
190
|
-
getOptionValue,
|
|
191
|
-
getOptionKey
|
|
192
|
-
} = _ref3,
|
|
193
|
-
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
194
|
-
const formikContext = (0, _formik.useFormikContext)();
|
|
195
|
-
const [field, meta] = (0, _formik.useField)(name);
|
|
196
|
-
const [selectedOption, setSelectedOption] = React.useState(null);
|
|
197
|
-
const [hasError, setHasError] = React.useState(false);
|
|
198
|
-
const changeHandler = option => {
|
|
199
|
-
formikContext.setFieldValue(name, option !== null ? getOptionValue(option) : "");
|
|
200
|
-
setSelectedOption(option);
|
|
201
|
-
onChange(option);
|
|
202
|
-
};
|
|
203
|
-
React.useEffect(() => {
|
|
204
|
-
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
205
|
-
}, [meta]);
|
|
206
|
-
React.useEffect(() => {
|
|
207
|
-
if ((!Boolean(selectedOption) || getOptionValue(selectedOption) !== value) && value !== undefined && options !== undefined) {
|
|
208
|
-
let option;
|
|
209
|
-
if (typeof value === "object") {
|
|
210
|
-
option = value;
|
|
211
|
-
} else {
|
|
212
|
-
option = options.find(option => String(getOptionValue(option)) === String(value));
|
|
213
|
-
}
|
|
214
|
-
setSelectedOption(option);
|
|
215
|
-
formikContext.setFieldValue(name, getOptionValue(option));
|
|
216
|
-
}
|
|
217
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
218
|
-
}, [value, options]);
|
|
219
|
-
React.useEffect(() => {
|
|
220
|
-
if (!Boolean(field.value)) {
|
|
221
|
-
setSelectedOption(null);
|
|
222
|
-
}
|
|
223
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
224
|
-
}, [field.value]);
|
|
225
|
-
React.useEffect(() => {
|
|
226
|
-
if ((!Boolean(selectedOption) || getOptionValue(selectedOption) !== field.value) && field.value !== undefined && options !== undefined) {
|
|
227
|
-
let option;
|
|
228
|
-
if (typeof field.value === "object") {
|
|
229
|
-
option = field.value;
|
|
230
|
-
} else {
|
|
231
|
-
option = options.find(option => getOptionValue(option) === field.value);
|
|
232
|
-
}
|
|
233
|
-
setSelectedOption(option);
|
|
234
|
-
}
|
|
235
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
236
|
-
}, [field.value, options]);
|
|
237
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardAutocomplete, _objectSpread({
|
|
238
|
-
id: id,
|
|
239
|
-
ref: ref,
|
|
240
|
-
className: className,
|
|
241
|
-
sx: sx,
|
|
242
|
-
label: label,
|
|
243
|
-
name: name,
|
|
244
|
-
value: selectedOption !== null && selectedOption !== void 0 ? selectedOption : null,
|
|
245
|
-
error: error || hasError,
|
|
246
|
-
disabled: disabled,
|
|
247
|
-
required: required,
|
|
248
|
-
focused: focused,
|
|
249
|
-
loading: loading,
|
|
250
|
-
fullWidth: fullWidth,
|
|
251
|
-
helperText: hasError && Boolean(meta.error) ? meta.error : helperText !== null && helperText !== void 0 ? helperText : "",
|
|
252
|
-
readOnly: readOnly,
|
|
253
|
-
options: options,
|
|
254
|
-
onChange: changeHandler,
|
|
255
|
-
getOptionKey: getOptionKey,
|
|
256
|
-
getOptionLabel: getOptionLabel,
|
|
257
|
-
getOptionValue: option => option
|
|
258
|
-
}, rest));
|
|
259
|
-
});
|
|
260
|
-
const PuiAutocomplete = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
|
|
261
|
-
let {
|
|
262
|
-
formik,
|
|
263
|
-
id,
|
|
264
|
-
className,
|
|
265
|
-
sx,
|
|
266
|
-
label,
|
|
267
|
-
name,
|
|
268
|
-
value,
|
|
269
|
-
error,
|
|
270
|
-
disabled,
|
|
271
|
-
required,
|
|
272
|
-
focused,
|
|
273
|
-
loading,
|
|
274
|
-
fullWidth,
|
|
275
|
-
helperText,
|
|
276
|
-
readOnly,
|
|
277
|
-
options,
|
|
278
|
-
onChange,
|
|
279
|
-
isOptionEqualToValue,
|
|
280
|
-
getOptionLabel,
|
|
281
|
-
getOptionValue,
|
|
282
|
-
getOptionKey
|
|
283
|
-
} = _ref4,
|
|
284
|
-
rest = _objectWithoutProperties(_ref4, _excluded3);
|
|
285
|
-
return /*#__PURE__*/React.createElement(formik ? PuiFormikAutocomplete : PuiStandardAutocomplete, _objectSpread({
|
|
286
|
-
ref,
|
|
287
|
-
id,
|
|
288
|
-
className,
|
|
289
|
-
sx,
|
|
290
|
-
label,
|
|
291
|
-
name,
|
|
292
|
-
value,
|
|
293
|
-
error,
|
|
294
|
-
disabled,
|
|
295
|
-
required,
|
|
296
|
-
focused,
|
|
297
|
-
loading,
|
|
298
|
-
fullWidth,
|
|
299
|
-
helperText,
|
|
300
|
-
readOnly,
|
|
301
|
-
options,
|
|
302
|
-
onChange,
|
|
303
|
-
isOptionEqualToValue,
|
|
304
|
-
getOptionLabel,
|
|
305
|
-
getOptionValue,
|
|
306
|
-
getOptionKey
|
|
307
|
-
}, rest), null);
|
|
308
|
-
});
|
|
309
|
-
PuiAutocomplete.propTypes = {
|
|
310
|
-
id: _propTypes.default.string,
|
|
311
|
-
className: _propTypes.default.string,
|
|
312
|
-
sx: _propTypes.default.object,
|
|
313
|
-
label: _propTypes.default.string,
|
|
314
|
-
name: _propTypes.default.string,
|
|
315
|
-
helperText: _propTypes.default.string,
|
|
316
|
-
disabled: _propTypes.default.bool,
|
|
317
|
-
required: _propTypes.default.bool,
|
|
318
|
-
error: _propTypes.default.bool,
|
|
319
|
-
formik: _propTypes.default.bool,
|
|
320
|
-
focused: _propTypes.default.bool,
|
|
321
|
-
loading: _propTypes.default.bool,
|
|
322
|
-
readOnly: _propTypes.default.bool,
|
|
323
|
-
fullWidth: _propTypes.default.bool,
|
|
324
|
-
options: _propTypes.default.array,
|
|
325
|
-
onChange: _propTypes.default.func,
|
|
326
|
-
isOptionEqualToValue: _propTypes.default.func,
|
|
327
|
-
getOptionKey: _propTypes.default.func,
|
|
328
|
-
getOptionValue: _propTypes.default.func,
|
|
329
|
-
getOptionLabel: _propTypes.default.func.isRequired
|
|
330
|
-
};
|
|
331
|
-
PuiAutocomplete.defaultProps = {
|
|
332
|
-
disabled: false,
|
|
333
|
-
loading: false,
|
|
334
|
-
required: false,
|
|
335
|
-
formik: true,
|
|
336
|
-
error: false,
|
|
337
|
-
fullWidth: true,
|
|
338
|
-
readOnly: false,
|
|
339
|
-
options: [],
|
|
340
|
-
getOptionKey: option => {
|
|
341
|
-
if (typeof option === "object") {
|
|
342
|
-
let key = "";
|
|
343
|
-
Object.keys(option).forEach(optionKey => {
|
|
344
|
-
key += "".concat(key.length === 0 ? "" : "-").concat(String(option[optionKey]));
|
|
345
|
-
});
|
|
346
|
-
return key;
|
|
347
|
-
}
|
|
348
|
-
return option;
|
|
349
|
-
},
|
|
350
|
-
getOptionValue: option => option,
|
|
351
|
-
onChange: () => {}
|
|
352
|
-
};
|
|
353
|
-
var _default = exports.default = PuiAutocomplete;
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
require("core-js/modules/es.array.includes.js");
|
|
10
|
-
require("core-js/modules/es.json.stringify.js");
|
|
11
|
-
require("core-js/modules/es.string.includes.js");
|
|
12
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
13
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
14
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
15
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
|
-
var _CheckBoxOutlineBlankRounded = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlankRounded"));
|
|
17
|
-
var _CheckBoxRounded = _interopRequireDefault(require("@mui/icons-material/CheckBoxRounded"));
|
|
18
|
-
var _material = require("@mui/material");
|
|
19
|
-
var _styles = require("@mui/material/styles");
|
|
20
|
-
var _formik = require("formik");
|
|
21
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
22
|
-
var React = _interopRequireWildcard(require("react"));
|
|
23
|
-
var _apperance = require("../../config/apperance");
|
|
24
|
-
var _PuiIcon = _interopRequireDefault(require("../others/PuiIcon"));
|
|
25
|
-
var _PuiIndication = _interopRequireDefault(require("../typography/PuiIndication"));
|
|
26
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
const _excluded = ["id", "className", "sx", "name", "value", "label", "checked", "error", "helperText", "disableHelperText", "disabled", "required", "onChange", "asArray"],
|
|
28
|
-
_excluded2 = ["id", "className", "sx", "name", "value", "defaultValue", "label", "error", "disableHelperText", "helperText", "disabled", "checked", "required", "asArray", "onChange"],
|
|
29
|
-
_excluded3 = ["formik", "id", "className", "sx", "name", "value", "defaultValue", "label", "checked", "asArray", "error", "helperText", "disableHelperText", "disabled", "required", "onChange"];
|
|
30
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
31
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
32
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
33
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
34
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
35
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
37
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
38
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
39
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
40
|
-
const StyledMuiFormControl = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, _objectSpread({
|
|
41
|
-
ref: ref
|
|
42
|
-
}, props))))(() => {
|
|
43
|
-
return {
|
|
44
|
-
"&.MuiFormControl-root": {
|
|
45
|
-
"& .MuiCheckbox-root": {
|
|
46
|
-
"& .MuiTouchRipple-root": {
|
|
47
|
-
display: "none"
|
|
48
|
-
},
|
|
49
|
-
"&.Mui-checked .MuiTouchRipple-root": {
|
|
50
|
-
boxSizing: "border-box",
|
|
51
|
-
display: "block",
|
|
52
|
-
position: "absolute",
|
|
53
|
-
width: "20px",
|
|
54
|
-
height: "20px",
|
|
55
|
-
left: "50%",
|
|
56
|
-
top: "50%",
|
|
57
|
-
transform: "translate(-50%,-50%)",
|
|
58
|
-
backgroundColor: _apperance.palette.primary,
|
|
59
|
-
border: "2px ".concat(_apperance.palette.gray.light, " solid"),
|
|
60
|
-
borderRadius: "2px",
|
|
61
|
-
"& *": {
|
|
62
|
-
display: "none"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"& .MuiSvgIcon-root": {
|
|
66
|
-
width: "32px",
|
|
67
|
-
height: "32px"
|
|
68
|
-
},
|
|
69
|
-
"&.Mui-disabled .MuiSvgIcon-root": {
|
|
70
|
-
color: _apperance.palette.gray.dark
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
"& .Mui-error .MuiCheckbox-colorPrimary": {
|
|
74
|
-
color: _apperance.palette.error
|
|
75
|
-
},
|
|
76
|
-
"& .Mui-error .Mui-checked .MuiTouchRipple-root": {
|
|
77
|
-
backgroundColor: _apperance.palette.error
|
|
78
|
-
},
|
|
79
|
-
"& .MuiCheckbox-colorPrimary": {
|
|
80
|
-
color: _apperance.palette.primary
|
|
81
|
-
},
|
|
82
|
-
"&.required .MuiInputBase-root": {
|
|
83
|
-
backgroundColor: _apperance.palette.background.required
|
|
84
|
-
},
|
|
85
|
-
"& .MuiFormControlLabel-root": {
|
|
86
|
-
margin: 0,
|
|
87
|
-
"& .MuiTypography-root": {
|
|
88
|
-
fontSize: ".8rem",
|
|
89
|
-
color: _apperance.palette.gray.darker,
|
|
90
|
-
lineSpacing: "-0.03em",
|
|
91
|
-
userSelect: "none",
|
|
92
|
-
fontWeight: "600"
|
|
93
|
-
},
|
|
94
|
-
"&.Mui-error": {
|
|
95
|
-
"& .MuiTypography-root": {
|
|
96
|
-
color: _apperance.palette.error
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"& .MuiFormHelperText-root": {
|
|
101
|
-
marginTop: "-10px",
|
|
102
|
-
fontWeight: "bold",
|
|
103
|
-
fontSize: ".7rem",
|
|
104
|
-
color: _apperance.palette.gray.darker
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
});
|
|
109
|
-
const PuiStandardCheckbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
110
|
-
let {
|
|
111
|
-
id,
|
|
112
|
-
className,
|
|
113
|
-
sx,
|
|
114
|
-
name,
|
|
115
|
-
value,
|
|
116
|
-
label,
|
|
117
|
-
checked,
|
|
118
|
-
error,
|
|
119
|
-
helperText,
|
|
120
|
-
disableHelperText,
|
|
121
|
-
disabled,
|
|
122
|
-
required,
|
|
123
|
-
onChange,
|
|
124
|
-
asArray
|
|
125
|
-
} = _ref,
|
|
126
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
127
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMuiFormControl, {
|
|
128
|
-
error: error,
|
|
129
|
-
sx: sx,
|
|
130
|
-
id: id,
|
|
131
|
-
className: className,
|
|
132
|
-
disabled: disabled,
|
|
133
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControlLabel, {
|
|
134
|
-
ref: ref,
|
|
135
|
-
disabled: disabled,
|
|
136
|
-
label: label !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
137
|
-
children: [label, required && " *"]
|
|
138
|
-
}) : undefined,
|
|
139
|
-
control: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, _objectSpread({
|
|
140
|
-
name: name,
|
|
141
|
-
checked: checked,
|
|
142
|
-
required: required,
|
|
143
|
-
disabled: disabled,
|
|
144
|
-
value: value !== null && value !== void 0 ? value : true,
|
|
145
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBoxOutlineBlankRounded.default, {}),
|
|
146
|
-
checkedIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckBoxRounded.default, {}),
|
|
147
|
-
onChange: onChange
|
|
148
|
-
}, rest))
|
|
149
|
-
}), !disableHelperText && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormHelperText, {
|
|
150
|
-
component: "div",
|
|
151
|
-
children: error && Boolean(helperText) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIndication.default, {
|
|
152
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
153
|
-
type: "danger"
|
|
154
|
-
}),
|
|
155
|
-
color: "error",
|
|
156
|
-
size: "small",
|
|
157
|
-
children: typeof helperText === "object" ? JSON.stringify(helperText) : helperText
|
|
158
|
-
}) : helperText
|
|
159
|
-
})]
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
const PuiFormikCheckbox = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
163
|
-
var _field$value;
|
|
164
|
-
let {
|
|
165
|
-
id,
|
|
166
|
-
className,
|
|
167
|
-
sx,
|
|
168
|
-
name,
|
|
169
|
-
value,
|
|
170
|
-
defaultValue,
|
|
171
|
-
label,
|
|
172
|
-
error,
|
|
173
|
-
disableHelperText,
|
|
174
|
-
helperText,
|
|
175
|
-
disabled,
|
|
176
|
-
checked,
|
|
177
|
-
required,
|
|
178
|
-
asArray,
|
|
179
|
-
onChange
|
|
180
|
-
} = _ref2,
|
|
181
|
-
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
182
|
-
const [field, meta] = (0, _formik.useField)(name);
|
|
183
|
-
const formikContext = (0, _formik.useFormikContext)();
|
|
184
|
-
const [hasError, setHasError] = React.useState(false);
|
|
185
|
-
const changeHandler = (event, hasBeenChecked) => {
|
|
186
|
-
if (checked === undefined) {
|
|
187
|
-
if (asArray || value === undefined) {
|
|
188
|
-
field.onChange(event);
|
|
189
|
-
} else {
|
|
190
|
-
formikContext.setFieldValue(name, hasBeenChecked ? event.target.value : formikContext.initialValues[name]);
|
|
191
|
-
}
|
|
192
|
-
onChange(event);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
React.useEffect(() => {
|
|
196
|
-
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
197
|
-
}, [meta]);
|
|
198
|
-
React.useEffect(() => {
|
|
199
|
-
if (defaultValue !== undefined && !asArray) {
|
|
200
|
-
formikContext.setFieldValue(name, defaultValue);
|
|
201
|
-
}
|
|
202
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
203
|
-
}, [defaultValue, asArray]);
|
|
204
|
-
React.useEffect(() => {
|
|
205
|
-
if (checked !== undefined) {
|
|
206
|
-
if (checked) {
|
|
207
|
-
if (asArray) {
|
|
208
|
-
if (Array.isArray(field.value) && !field.value.map(checkedValue => JSON.stringify(checkedValue)).includes(JSON.stringify(value))) {
|
|
209
|
-
formikContext.setFieldValue(name, [...field.value, value]);
|
|
210
|
-
} else {
|
|
211
|
-
formikContext.setFieldValue(name, [value]);
|
|
212
|
-
}
|
|
213
|
-
} else {
|
|
214
|
-
formikContext.setFieldValue(name, value);
|
|
215
|
-
}
|
|
216
|
-
} else {
|
|
217
|
-
if (asArray && Array.isArray(field.value) && field.value.map(checkedValue => JSON.stringify(checkedValue)).includes(JSON.stringify(value))) {
|
|
218
|
-
formikContext.setFieldValue(name, field.value.filter(checkedValue => JSON.stringify(checkedValue) !== JSON.stringify(value)));
|
|
219
|
-
} else {
|
|
220
|
-
if (JSON.stringify(field.value) === JSON.stringify(value)) {
|
|
221
|
-
formikContext.setFieldValue(name, formikContext.initialValues[name]);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
227
|
-
}, [checked]);
|
|
228
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardCheckbox, _objectSpread({
|
|
229
|
-
id: id,
|
|
230
|
-
ref: ref,
|
|
231
|
-
className: className,
|
|
232
|
-
sx: sx,
|
|
233
|
-
name: name,
|
|
234
|
-
error: error || hasError,
|
|
235
|
-
helperText: hasError && Boolean(meta.error) ? meta.error : helperText !== null && helperText !== void 0 ? helperText : "",
|
|
236
|
-
value: value,
|
|
237
|
-
label: label,
|
|
238
|
-
disableHelperText: disableHelperText,
|
|
239
|
-
checked: checked !== undefined ? checked : value !== undefined ? !Array.isArray(field.value) && String(field.value) === String(value) || Array.isArray(field.value) && ((_field$value = field.value) === null || _field$value === void 0 ? void 0 : _field$value.includes(String(value))) : Boolean(field.value),
|
|
240
|
-
disabled: disabled,
|
|
241
|
-
required: required,
|
|
242
|
-
onChange: changeHandler
|
|
243
|
-
}, rest));
|
|
244
|
-
});
|
|
245
|
-
const PuiCheckbox = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
246
|
-
let {
|
|
247
|
-
formik,
|
|
248
|
-
id,
|
|
249
|
-
className,
|
|
250
|
-
sx,
|
|
251
|
-
name,
|
|
252
|
-
value,
|
|
253
|
-
defaultValue,
|
|
254
|
-
label,
|
|
255
|
-
checked,
|
|
256
|
-
asArray,
|
|
257
|
-
error,
|
|
258
|
-
helperText,
|
|
259
|
-
disableHelperText,
|
|
260
|
-
disabled,
|
|
261
|
-
required,
|
|
262
|
-
onChange
|
|
263
|
-
} = _ref3,
|
|
264
|
-
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
265
|
-
return /*#__PURE__*/React.createElement(formik ? PuiFormikCheckbox : PuiStandardCheckbox, _objectSpread({
|
|
266
|
-
id,
|
|
267
|
-
ref,
|
|
268
|
-
className,
|
|
269
|
-
sx,
|
|
270
|
-
name,
|
|
271
|
-
value,
|
|
272
|
-
defaultValue,
|
|
273
|
-
label,
|
|
274
|
-
checked,
|
|
275
|
-
asArray,
|
|
276
|
-
error,
|
|
277
|
-
helperText,
|
|
278
|
-
disableHelperText,
|
|
279
|
-
disabled,
|
|
280
|
-
required,
|
|
281
|
-
onChange
|
|
282
|
-
}, rest));
|
|
283
|
-
});
|
|
284
|
-
PuiCheckbox.propTypes = {
|
|
285
|
-
id: _propTypes.default.string,
|
|
286
|
-
className: _propTypes.default.string,
|
|
287
|
-
sx: _propTypes.default.object,
|
|
288
|
-
label: _propTypes.default.any,
|
|
289
|
-
helperText: _propTypes.default.string,
|
|
290
|
-
name: _propTypes.default.string,
|
|
291
|
-
defaultValue: _propTypes.default.any,
|
|
292
|
-
asArray: _propTypes.default.bool,
|
|
293
|
-
error: _propTypes.default.bool,
|
|
294
|
-
formik: _propTypes.default.bool,
|
|
295
|
-
disabled: _propTypes.default.bool,
|
|
296
|
-
disableHelperText: _propTypes.default.bool,
|
|
297
|
-
required: _propTypes.default.bool,
|
|
298
|
-
checked: _propTypes.default.bool,
|
|
299
|
-
onChange: _propTypes.default.func
|
|
300
|
-
};
|
|
301
|
-
PuiCheckbox.defaultProps = {
|
|
302
|
-
error: false,
|
|
303
|
-
formik: true,
|
|
304
|
-
disabled: false,
|
|
305
|
-
asArray: false,
|
|
306
|
-
disableHelperText: false,
|
|
307
|
-
required: false,
|
|
308
|
-
onChange: () => {}
|
|
309
|
-
};
|
|
310
|
-
var _default = exports.default = PuiCheckbox;
|