@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,425 +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/es.json.stringify.js");
|
|
10
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
11
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
12
|
-
require("core-js/modules/esnext.iterator.map.js");
|
|
13
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
14
|
-
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown"));
|
|
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 _apperance = require("../../config/apperance");
|
|
21
|
-
var _PuiIcon = _interopRequireDefault(require("../others/PuiIcon"));
|
|
22
|
-
var _PuiIndication = _interopRequireDefault(require("../typography/PuiIndication"));
|
|
23
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["id", "className", "sx", "name", "label", "value", "error", "helperText", "fullWidth", "disabled", "focused", "loading", "readOnly", "required", "options", "getOptionKey", "getOptionLabel", "getOptionValue", "isOptionEqualToValue", "onChange"],
|
|
25
|
-
_excluded2 = ["id", "className", "sx", "name", "label", "value", "error", "helperText", "fullWidth", "disabled", "focused", "loading", "readOnly", "required", "options", "getOptionKey", "getOptionLabel", "getOptionValue", "onChange"],
|
|
26
|
-
_excluded3 = ["formik", "id", "className", "sx", "name", "label", "value", "error", "helperText", "fullWidth", "disabled", "focused", "loading", "readOnly", "required", "options", "getOptionKey", "getOptionLabel", "getOptionValue", "onChange"];
|
|
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 StyledMuiFormControl = (0, _styles.styled)(/*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormControl, _objectSpread(_objectSpread({}, props), {}, {
|
|
38
|
-
ref: ref
|
|
39
|
-
}))))(() => {
|
|
40
|
-
return {
|
|
41
|
-
"&.MuiFormControl-root": {
|
|
42
|
-
marginBottom: "16px",
|
|
43
|
-
transition: "all 0.2s ease",
|
|
44
|
-
"&.required .MuiInputBase-root": {
|
|
45
|
-
backgroundColor: "".concat(_apperance.palette.background.required)
|
|
46
|
-
},
|
|
47
|
-
"& .MuiFormLabel-root": {
|
|
48
|
-
zIndex: 0,
|
|
49
|
-
lineSpacing: "-0.03em",
|
|
50
|
-
position: "initial",
|
|
51
|
-
transform: "none",
|
|
52
|
-
fontSize: "0.85rem",
|
|
53
|
-
fontWeight: "600",
|
|
54
|
-
marginBottom: "6px",
|
|
55
|
-
color: _apperance.palette.gray.darker,
|
|
56
|
-
transition: "color 0.2s ease",
|
|
57
|
-
"&.Mui-focused": {
|
|
58
|
-
color: _apperance.palette.primary
|
|
59
|
-
},
|
|
60
|
-
"&.Mui-disabled": {
|
|
61
|
-
color: _apperance.palette.gray.darker
|
|
62
|
-
},
|
|
63
|
-
"&.Mui-error": {
|
|
64
|
-
color: _apperance.palette.error
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"& .MuiInputBase-root": {
|
|
68
|
-
backgroundColor: _apperance.palette.white,
|
|
69
|
-
border: "1px solid ".concat(_apperance.palette.gray.dark),
|
|
70
|
-
borderRadius: "8px",
|
|
71
|
-
boxShadow: "0 2px 4px rgba(0, 0, 0, 0.05)",
|
|
72
|
-
transition: "all 0.3s ease",
|
|
73
|
-
"&:hover:not(.Mui-disabled):not(.Mui-error)": {
|
|
74
|
-
borderColor: "".concat(_apperance.palette.primary, "80"),
|
|
75
|
-
boxShadow: "0 3px 6px rgba(0, 0, 0, 0.08)"
|
|
76
|
-
},
|
|
77
|
-
"&.Mui-focused": {
|
|
78
|
-
border: "2px solid ".concat(_apperance.palette.primary),
|
|
79
|
-
boxShadow: "0 0 0 3px ".concat(_apperance.palette.primary, "20")
|
|
80
|
-
},
|
|
81
|
-
"&.Mui-error": {
|
|
82
|
-
border: "2px solid ".concat(_apperance.palette.error),
|
|
83
|
-
backgroundColor: _apperance.palette.background.error,
|
|
84
|
-
boxShadow: "0 0 0 3px ".concat(_apperance.palette.error, "20")
|
|
85
|
-
},
|
|
86
|
-
"&.Mui-disabled": {
|
|
87
|
-
opacity: 0.7,
|
|
88
|
-
border: "1px solid ".concat(_apperance.palette.gray.main),
|
|
89
|
-
backgroundColor: "".concat(_apperance.palette.secondary)
|
|
90
|
-
},
|
|
91
|
-
"& .MuiSelect-select": {
|
|
92
|
-
lineHeight: "1.5",
|
|
93
|
-
padding: "12px 14px",
|
|
94
|
-
fontSize: "0.9rem",
|
|
95
|
-
fontWeight: 400,
|
|
96
|
-
color: "rgba(0, 0, 0, 0.85)",
|
|
97
|
-
minHeight: "auto",
|
|
98
|
-
display: "flex",
|
|
99
|
-
alignItems: "center"
|
|
100
|
-
},
|
|
101
|
-
"& .MuiSvgIcon-root": {
|
|
102
|
-
fontSize: "1.2rem",
|
|
103
|
-
color: _apperance.palette.gray.dark,
|
|
104
|
-
marginRight: "8px",
|
|
105
|
-
transition: "transform 0.2s ease"
|
|
106
|
-
},
|
|
107
|
-
"&.Mui-focused .MuiSvgIcon-root": {
|
|
108
|
-
transform: "rotate(180deg)",
|
|
109
|
-
color: _apperance.palette.primary
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"& .MuiFormHelperText-root": {
|
|
113
|
-
marginTop: "6px",
|
|
114
|
-
marginLeft: "4px",
|
|
115
|
-
fontWeight: "500",
|
|
116
|
-
fontSize: "0.75rem",
|
|
117
|
-
color: _apperance.palette.gray.darker,
|
|
118
|
-
transition: "color 0.2s ease",
|
|
119
|
-
"&.Mui-error": {
|
|
120
|
-
color: _apperance.palette.error
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"& fieldset": {
|
|
124
|
-
display: "none"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
});
|
|
129
|
-
const LoadingProgress = () => {
|
|
130
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
|
|
131
|
-
size: 20,
|
|
132
|
-
thickness: 4,
|
|
133
|
-
sx: {
|
|
134
|
-
color: _apperance.palette.primary,
|
|
135
|
-
position: "absolute",
|
|
136
|
-
right: "14px",
|
|
137
|
-
top: "calc(50% - 10px)",
|
|
138
|
-
opacity: 0.7,
|
|
139
|
-
animation: "spin 1.5s linear infinite",
|
|
140
|
-
"@keyframes spin": {
|
|
141
|
-
"0%": {
|
|
142
|
-
transform: "rotate(0deg)"
|
|
143
|
-
},
|
|
144
|
-
"100%": {
|
|
145
|
-
transform: "rotate(360deg)"
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
};
|
|
151
|
-
const PuiStandardSelect = _ref => {
|
|
152
|
-
let {
|
|
153
|
-
id,
|
|
154
|
-
className,
|
|
155
|
-
sx,
|
|
156
|
-
name,
|
|
157
|
-
label,
|
|
158
|
-
value,
|
|
159
|
-
error,
|
|
160
|
-
helperText,
|
|
161
|
-
fullWidth,
|
|
162
|
-
disabled,
|
|
163
|
-
focused,
|
|
164
|
-
loading,
|
|
165
|
-
readOnly,
|
|
166
|
-
required,
|
|
167
|
-
options,
|
|
168
|
-
getOptionKey,
|
|
169
|
-
getOptionLabel,
|
|
170
|
-
getOptionValue,
|
|
171
|
-
isOptionEqualToValue,
|
|
172
|
-
onChange
|
|
173
|
-
} = _ref,
|
|
174
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
175
|
-
const selectId = React.useId();
|
|
176
|
-
const [selectedValue, setSelectedValue] = React.useState(value !== null && value !== void 0 ? value : "");
|
|
177
|
-
const changeHandler = (event, option) => {
|
|
178
|
-
setSelectedValue(option.props.value);
|
|
179
|
-
onChange(option.props.value);
|
|
180
|
-
};
|
|
181
|
-
React.useEffect(() => {
|
|
182
|
-
setSelectedValue(value !== null && value !== void 0 ? value : "");
|
|
183
|
-
}, [value]);
|
|
184
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(StyledMuiFormControl, {
|
|
185
|
-
fullWidth: fullWidth,
|
|
186
|
-
sx: sx,
|
|
187
|
-
className: "".concat(required ? "required" : "", " ").concat(className),
|
|
188
|
-
focused: focused,
|
|
189
|
-
error: error,
|
|
190
|
-
disabled: disabled || loading,
|
|
191
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
|
|
192
|
-
id: selectId,
|
|
193
|
-
required: required,
|
|
194
|
-
children: label
|
|
195
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Select, _objectSpread(_objectSpread({
|
|
196
|
-
labelId: selectId,
|
|
197
|
-
id: id,
|
|
198
|
-
label: label,
|
|
199
|
-
onChange: changeHandler,
|
|
200
|
-
value: selectedValue,
|
|
201
|
-
IconComponent: loading ? LoadingProgress : _ArrowDropDown.default,
|
|
202
|
-
inputProps: {
|
|
203
|
-
readOnly,
|
|
204
|
-
name
|
|
205
|
-
},
|
|
206
|
-
MenuProps: {
|
|
207
|
-
sx: {
|
|
208
|
-
"& .MuiPaper-root": {
|
|
209
|
-
marginTop: "4px",
|
|
210
|
-
borderRadius: "8px",
|
|
211
|
-
boxShadow: "0 6px 16px rgba(0, 0, 0, 0.1)",
|
|
212
|
-
border: "1px solid ".concat(_apperance.palette.gray.light),
|
|
213
|
-
overflow: "hidden"
|
|
214
|
-
},
|
|
215
|
-
"& .MuiMenu-list": {
|
|
216
|
-
padding: "4px 0",
|
|
217
|
-
"& .MuiMenuItem-root": {
|
|
218
|
-
fontSize: "0.9rem",
|
|
219
|
-
padding: "8px 16px",
|
|
220
|
-
borderRadius: "0",
|
|
221
|
-
transition: "all 0.2s ease",
|
|
222
|
-
height: "auto",
|
|
223
|
-
minHeight: "40px",
|
|
224
|
-
"&:hover": {
|
|
225
|
-
backgroundColor: "rgba(24, 144, 255, 0.05)"
|
|
226
|
-
},
|
|
227
|
-
"&.Mui-selected": {
|
|
228
|
-
backgroundColor: "rgba(24, 144, 255, 0.1)",
|
|
229
|
-
color: _apperance.palette.primary,
|
|
230
|
-
fontWeight: 500,
|
|
231
|
-
"&:hover": {
|
|
232
|
-
backgroundColor: "rgba(24, 144, 255, 0.15)"
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
"&:not(:last-child)": {
|
|
236
|
-
borderBottom: "1px solid ".concat(_apperance.palette.gray.light)
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
},
|
|
241
|
-
anchorOrigin: {
|
|
242
|
-
vertical: "bottom",
|
|
243
|
-
horizontal: "left"
|
|
244
|
-
},
|
|
245
|
-
transformOrigin: {
|
|
246
|
-
vertical: "top",
|
|
247
|
-
horizontal: "left"
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}, rest), {}, {
|
|
251
|
-
children: Boolean(options) && options.map(option => /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
252
|
-
value: getOptionValue(option),
|
|
253
|
-
children: getOptionLabel(option)
|
|
254
|
-
}, getOptionKey(option)))
|
|
255
|
-
})), Boolean(helperText) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.FormHelperText, {
|
|
256
|
-
component: "div",
|
|
257
|
-
children: error && Boolean(helperText) ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIndication.default, {
|
|
258
|
-
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiIcon.default, {
|
|
259
|
-
type: "danger"
|
|
260
|
-
}),
|
|
261
|
-
color: "error",
|
|
262
|
-
size: "small",
|
|
263
|
-
children: typeof helperText === "object" ? JSON.stringify(helperText) : helperText
|
|
264
|
-
}) : helperText
|
|
265
|
-
})]
|
|
266
|
-
});
|
|
267
|
-
};
|
|
268
|
-
const PuiFormikSelect = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
269
|
-
let {
|
|
270
|
-
id,
|
|
271
|
-
className,
|
|
272
|
-
sx,
|
|
273
|
-
name,
|
|
274
|
-
label,
|
|
275
|
-
value,
|
|
276
|
-
error,
|
|
277
|
-
helperText,
|
|
278
|
-
fullWidth,
|
|
279
|
-
disabled,
|
|
280
|
-
focused,
|
|
281
|
-
loading,
|
|
282
|
-
readOnly,
|
|
283
|
-
required,
|
|
284
|
-
options,
|
|
285
|
-
getOptionKey,
|
|
286
|
-
getOptionLabel,
|
|
287
|
-
getOptionValue,
|
|
288
|
-
onChange
|
|
289
|
-
} = _ref2,
|
|
290
|
-
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
291
|
-
const [innerValue, setInnerValue] = React.useState(value);
|
|
292
|
-
const [field, meta] = (0, _formik.useField)(name);
|
|
293
|
-
const [hasError, setHasError] = React.useState(false);
|
|
294
|
-
const formikContext = (0, _formik.useFormikContext)();
|
|
295
|
-
const changeHandler = option => {
|
|
296
|
-
formikContext.setFieldValue(name, option);
|
|
297
|
-
onChange(option);
|
|
298
|
-
};
|
|
299
|
-
React.useEffect(() => {
|
|
300
|
-
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
301
|
-
}, [meta]);
|
|
302
|
-
React.useEffect(() => {
|
|
303
|
-
if (value !== undefined) {
|
|
304
|
-
formikContext.setFieldValue(name, typeof value === "object" ? getOptionValue(value) : value);
|
|
305
|
-
}
|
|
306
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
307
|
-
}, [value]);
|
|
308
|
-
React.useEffect(() => {
|
|
309
|
-
setInnerValue(field.value);
|
|
310
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
311
|
-
}, [field.value]);
|
|
312
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardSelect, _objectSpread({
|
|
313
|
-
id: id,
|
|
314
|
-
ref: ref,
|
|
315
|
-
className: className,
|
|
316
|
-
sx: sx,
|
|
317
|
-
name: name,
|
|
318
|
-
label: label,
|
|
319
|
-
value: innerValue,
|
|
320
|
-
error: error || hasError,
|
|
321
|
-
helperText: hasError && Boolean(meta.error) ? meta.error : helperText !== null && helperText !== void 0 ? helperText : "",
|
|
322
|
-
fullWidth: fullWidth,
|
|
323
|
-
disabled: disabled,
|
|
324
|
-
focused: focused,
|
|
325
|
-
loading: loading,
|
|
326
|
-
readOnly: readOnly,
|
|
327
|
-
required: required,
|
|
328
|
-
options: options,
|
|
329
|
-
getOptionKey: getOptionKey,
|
|
330
|
-
getOptionLabel: getOptionLabel,
|
|
331
|
-
getOptionValue: getOptionValue,
|
|
332
|
-
onChange: changeHandler
|
|
333
|
-
}, rest));
|
|
334
|
-
});
|
|
335
|
-
const PuiSelect = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
336
|
-
let {
|
|
337
|
-
formik,
|
|
338
|
-
id,
|
|
339
|
-
className,
|
|
340
|
-
sx,
|
|
341
|
-
name,
|
|
342
|
-
label,
|
|
343
|
-
value,
|
|
344
|
-
error,
|
|
345
|
-
helperText,
|
|
346
|
-
fullWidth,
|
|
347
|
-
disabled,
|
|
348
|
-
focused,
|
|
349
|
-
loading,
|
|
350
|
-
readOnly,
|
|
351
|
-
required,
|
|
352
|
-
options,
|
|
353
|
-
getOptionKey,
|
|
354
|
-
getOptionLabel,
|
|
355
|
-
getOptionValue,
|
|
356
|
-
onChange
|
|
357
|
-
} = _ref3,
|
|
358
|
-
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
359
|
-
return /*#__PURE__*/React.createElement(formik ? PuiFormikSelect : PuiStandardSelect, _objectSpread({
|
|
360
|
-
ref,
|
|
361
|
-
id,
|
|
362
|
-
className,
|
|
363
|
-
sx,
|
|
364
|
-
name,
|
|
365
|
-
label,
|
|
366
|
-
value,
|
|
367
|
-
error,
|
|
368
|
-
helperText,
|
|
369
|
-
fullWidth,
|
|
370
|
-
disabled,
|
|
371
|
-
focused,
|
|
372
|
-
loading,
|
|
373
|
-
readOnly,
|
|
374
|
-
required,
|
|
375
|
-
options,
|
|
376
|
-
getOptionKey,
|
|
377
|
-
getOptionLabel,
|
|
378
|
-
getOptionValue,
|
|
379
|
-
onChange
|
|
380
|
-
}, rest));
|
|
381
|
-
});
|
|
382
|
-
PuiSelect.propTypes = {
|
|
383
|
-
id: _propTypes.default.string,
|
|
384
|
-
className: _propTypes.default.string,
|
|
385
|
-
sx: _propTypes.default.object,
|
|
386
|
-
name: _propTypes.default.string,
|
|
387
|
-
label: _propTypes.default.string,
|
|
388
|
-
helperText: _propTypes.default.string,
|
|
389
|
-
formik: _propTypes.default.bool,
|
|
390
|
-
disabled: _propTypes.default.bool,
|
|
391
|
-
required: _propTypes.default.bool,
|
|
392
|
-
error: _propTypes.default.bool,
|
|
393
|
-
focused: _propTypes.default.bool,
|
|
394
|
-
loading: _propTypes.default.bool,
|
|
395
|
-
readOnly: _propTypes.default.bool,
|
|
396
|
-
fullWidth: _propTypes.default.bool,
|
|
397
|
-
options: _propTypes.default.array.isRequired,
|
|
398
|
-
getOptionKey: _propTypes.default.func,
|
|
399
|
-
getOptionValue: _propTypes.default.func,
|
|
400
|
-
getOptionLabel: _propTypes.default.func.isRequired,
|
|
401
|
-
onChange: _propTypes.default.func
|
|
402
|
-
};
|
|
403
|
-
PuiSelect.defaultProps = {
|
|
404
|
-
formik: true,
|
|
405
|
-
disabled: false,
|
|
406
|
-
loading: false,
|
|
407
|
-
required: false,
|
|
408
|
-
error: false,
|
|
409
|
-
fullWidth: true,
|
|
410
|
-
readOnly: false,
|
|
411
|
-
options: [],
|
|
412
|
-
getOptionKey: option => {
|
|
413
|
-
if (typeof option === "object") {
|
|
414
|
-
let key = "";
|
|
415
|
-
Object.keys(option).forEach(optionKey => {
|
|
416
|
-
key += "".concat(key.length === 0 ? "" : "-").concat(String(option[optionKey]));
|
|
417
|
-
});
|
|
418
|
-
return key;
|
|
419
|
-
}
|
|
420
|
-
return option;
|
|
421
|
-
},
|
|
422
|
-
getOptionValue: option => option,
|
|
423
|
-
onChange: () => {}
|
|
424
|
-
};
|
|
425
|
-
var _default = exports.default = PuiSelect;
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/modules/es.weak-map.js");
|
|
4
|
-
require("core-js/modules/esnext.iterator.constructor.js");
|
|
5
|
-
require("core-js/modules/esnext.iterator.filter.js");
|
|
6
|
-
require("core-js/modules/esnext.iterator.for-each.js");
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.default = void 0;
|
|
11
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
-
var _formik = require("formik");
|
|
13
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
-
var React = _interopRequireWildcard(require("react"));
|
|
15
|
-
var _StyledMuiTextField = _interopRequireDefault(require("../common/StyledMuiTextField"));
|
|
16
|
-
var _PuiDefinition = _interopRequireDefault(require("../typography/PuiDefinition"));
|
|
17
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["id", "className", "label", "name", "type", "value", "disabled", "required", "helperText", "error", "focused", "consultation", "readOnly", "fullWidth", "sx", "multiline", "rows", "maxRows", "minRows", "onChange", "onClick", "onBlur", "InputProps"],
|
|
19
|
-
_excluded2 = ["id", "className", "label", "name", "type", "value", "disabled", "required", "helperText", "error", "focused", "consultation", "readOnly", "fullWidth", "sx", "multiline", "rows", "maxRows", "minRows", "onChange", "onClick", "onBlur", "InputProps"],
|
|
20
|
-
_excluded3 = ["formik", "id", "className", "sx", "label", "name", "type", "value", "disabled", "required", "helperText", "error", "focused", "consultation", "readOnly", "fullWidth", "multiline", "rows", "maxRows", "minRows", "InputProps", "onChange", "onClick", "onBlur"];
|
|
21
|
-
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); }
|
|
22
|
-
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; }
|
|
23
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
|
-
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; }
|
|
25
|
-
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; }
|
|
26
|
-
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; }
|
|
27
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
28
|
-
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); }
|
|
29
|
-
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; }
|
|
30
|
-
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; }
|
|
31
|
-
const PuiStandardTextField = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
32
|
-
let {
|
|
33
|
-
id,
|
|
34
|
-
className,
|
|
35
|
-
label,
|
|
36
|
-
name,
|
|
37
|
-
type,
|
|
38
|
-
value,
|
|
39
|
-
disabled,
|
|
40
|
-
required,
|
|
41
|
-
helperText,
|
|
42
|
-
error,
|
|
43
|
-
focused,
|
|
44
|
-
consultation,
|
|
45
|
-
readOnly,
|
|
46
|
-
fullWidth,
|
|
47
|
-
sx,
|
|
48
|
-
multiline,
|
|
49
|
-
rows,
|
|
50
|
-
maxRows,
|
|
51
|
-
minRows,
|
|
52
|
-
onChange,
|
|
53
|
-
onClick,
|
|
54
|
-
onBlur,
|
|
55
|
-
InputProps
|
|
56
|
-
} = _ref,
|
|
57
|
-
rest = _objectWithoutProperties(_ref, _excluded);
|
|
58
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
59
|
-
children: consultation ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_PuiDefinition.default, {
|
|
60
|
-
label: label,
|
|
61
|
-
children: value
|
|
62
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_StyledMuiTextField.default, _objectSpread({
|
|
63
|
-
ref: ref,
|
|
64
|
-
id: id,
|
|
65
|
-
className: className,
|
|
66
|
-
sx: sx,
|
|
67
|
-
name: name,
|
|
68
|
-
multiline: multiline,
|
|
69
|
-
rows: rows,
|
|
70
|
-
maxRows: maxRows,
|
|
71
|
-
minRows: minRows,
|
|
72
|
-
required: required,
|
|
73
|
-
label: label,
|
|
74
|
-
InputLabelProps: {
|
|
75
|
-
shrink: true
|
|
76
|
-
},
|
|
77
|
-
error: error,
|
|
78
|
-
helperText: helperText,
|
|
79
|
-
disabled: disabled,
|
|
80
|
-
focused: focused,
|
|
81
|
-
fullWidth: fullWidth,
|
|
82
|
-
type: type,
|
|
83
|
-
value: value,
|
|
84
|
-
onChange: onChange,
|
|
85
|
-
onClick: onClick,
|
|
86
|
-
onBlur: onBlur,
|
|
87
|
-
inputProps: {
|
|
88
|
-
name
|
|
89
|
-
},
|
|
90
|
-
InputProps: _objectSpread({
|
|
91
|
-
readOnly
|
|
92
|
-
}, InputProps)
|
|
93
|
-
}, rest))
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
const PuiFormikTextField = /*#__PURE__*/React.forwardRef((_ref2, ref) => {
|
|
97
|
-
var _field$value;
|
|
98
|
-
let {
|
|
99
|
-
id,
|
|
100
|
-
className,
|
|
101
|
-
label,
|
|
102
|
-
name,
|
|
103
|
-
type,
|
|
104
|
-
value,
|
|
105
|
-
disabled,
|
|
106
|
-
required,
|
|
107
|
-
helperText,
|
|
108
|
-
error,
|
|
109
|
-
focused,
|
|
110
|
-
consultation,
|
|
111
|
-
readOnly,
|
|
112
|
-
fullWidth,
|
|
113
|
-
sx,
|
|
114
|
-
multiline,
|
|
115
|
-
rows,
|
|
116
|
-
maxRows,
|
|
117
|
-
minRows,
|
|
118
|
-
onChange,
|
|
119
|
-
onClick,
|
|
120
|
-
onBlur,
|
|
121
|
-
InputProps
|
|
122
|
-
} = _ref2,
|
|
123
|
-
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
124
|
-
const [field, meta] = (0, _formik.useField)(name);
|
|
125
|
-
const formikContext = (0, _formik.useFormikContext)();
|
|
126
|
-
const [hasError, setHasError] = React.useState(false);
|
|
127
|
-
const changeHandler = event => {
|
|
128
|
-
formikContext.setFieldValue(name, event.target.value);
|
|
129
|
-
onChange(event);
|
|
130
|
-
};
|
|
131
|
-
const blurHandler = event => {
|
|
132
|
-
field.onBlur(event);
|
|
133
|
-
onBlur(event);
|
|
134
|
-
};
|
|
135
|
-
React.useEffect(() => {
|
|
136
|
-
setHasError(Boolean(meta) && Boolean(meta.touched) && Boolean(meta.error));
|
|
137
|
-
}, [meta]);
|
|
138
|
-
React.useEffect(() => {
|
|
139
|
-
if (value !== undefined) {
|
|
140
|
-
formikContext.setFieldValue(name, value);
|
|
141
|
-
}
|
|
142
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
143
|
-
}, [value]);
|
|
144
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PuiStandardTextField, _objectSpread({
|
|
145
|
-
ref: ref,
|
|
146
|
-
id: id,
|
|
147
|
-
className: className,
|
|
148
|
-
sx: sx,
|
|
149
|
-
name: field.name,
|
|
150
|
-
multiline: multiline,
|
|
151
|
-
rows: rows,
|
|
152
|
-
maxRows: maxRows,
|
|
153
|
-
minRows: minRows,
|
|
154
|
-
required: required,
|
|
155
|
-
label: label,
|
|
156
|
-
error: error || hasError,
|
|
157
|
-
helperText: hasError && Boolean(meta.error) ? meta.error : helperText !== null && helperText !== void 0 ? helperText : "",
|
|
158
|
-
disabled: disabled,
|
|
159
|
-
focused: focused,
|
|
160
|
-
fullWidth: fullWidth,
|
|
161
|
-
type: type,
|
|
162
|
-
value: (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : "",
|
|
163
|
-
onChange: changeHandler,
|
|
164
|
-
onBlur: blurHandler,
|
|
165
|
-
onClick: onClick,
|
|
166
|
-
InputProps: _objectSpread({
|
|
167
|
-
readOnly
|
|
168
|
-
}, InputProps)
|
|
169
|
-
}, rest));
|
|
170
|
-
});
|
|
171
|
-
const PuiTextField = /*#__PURE__*/React.forwardRef((_ref3, ref) => {
|
|
172
|
-
let {
|
|
173
|
-
formik,
|
|
174
|
-
id,
|
|
175
|
-
className,
|
|
176
|
-
sx,
|
|
177
|
-
label,
|
|
178
|
-
name,
|
|
179
|
-
type,
|
|
180
|
-
value,
|
|
181
|
-
disabled,
|
|
182
|
-
required,
|
|
183
|
-
helperText,
|
|
184
|
-
error,
|
|
185
|
-
focused,
|
|
186
|
-
consultation,
|
|
187
|
-
readOnly,
|
|
188
|
-
fullWidth,
|
|
189
|
-
multiline,
|
|
190
|
-
rows,
|
|
191
|
-
maxRows,
|
|
192
|
-
minRows,
|
|
193
|
-
InputProps,
|
|
194
|
-
onChange,
|
|
195
|
-
onClick,
|
|
196
|
-
onBlur
|
|
197
|
-
} = _ref3,
|
|
198
|
-
rest = _objectWithoutProperties(_ref3, _excluded3);
|
|
199
|
-
return /*#__PURE__*/React.createElement(formik ? PuiFormikTextField : PuiStandardTextField, _objectSpread({
|
|
200
|
-
ref,
|
|
201
|
-
id,
|
|
202
|
-
className,
|
|
203
|
-
sx,
|
|
204
|
-
label,
|
|
205
|
-
name,
|
|
206
|
-
type,
|
|
207
|
-
value,
|
|
208
|
-
disabled,
|
|
209
|
-
required,
|
|
210
|
-
helperText,
|
|
211
|
-
error,
|
|
212
|
-
focused,
|
|
213
|
-
consultation,
|
|
214
|
-
readOnly,
|
|
215
|
-
fullWidth,
|
|
216
|
-
multiline,
|
|
217
|
-
rows,
|
|
218
|
-
maxRows,
|
|
219
|
-
minRows,
|
|
220
|
-
InputProps,
|
|
221
|
-
onChange,
|
|
222
|
-
onClick,
|
|
223
|
-
onBlur
|
|
224
|
-
}, rest));
|
|
225
|
-
});
|
|
226
|
-
PuiTextField.propTypes = {
|
|
227
|
-
id: _propTypes.default.string,
|
|
228
|
-
className: _propTypes.default.string,
|
|
229
|
-
sx: _propTypes.default.object,
|
|
230
|
-
label: _propTypes.default.string,
|
|
231
|
-
name: _propTypes.default.string,
|
|
232
|
-
type: _propTypes.default.oneOf(["text", "number", "email", "password", "search", "tel", "url"]),
|
|
233
|
-
helperText: _propTypes.default.string,
|
|
234
|
-
formik: _propTypes.default.bool,
|
|
235
|
-
disabled: _propTypes.default.bool,
|
|
236
|
-
required: _propTypes.default.bool,
|
|
237
|
-
consultation: _propTypes.default.bool,
|
|
238
|
-
multiline: _propTypes.default.bool,
|
|
239
|
-
error: _propTypes.default.bool,
|
|
240
|
-
focused: _propTypes.default.bool,
|
|
241
|
-
readOnly: _propTypes.default.bool,
|
|
242
|
-
fullWidth: _propTypes.default.bool,
|
|
243
|
-
InputProps: _propTypes.default.object,
|
|
244
|
-
maxRows: _propTypes.default.number,
|
|
245
|
-
minRows: _propTypes.default.number,
|
|
246
|
-
rows: _propTypes.default.number,
|
|
247
|
-
onChange: _propTypes.default.func,
|
|
248
|
-
onClick: _propTypes.default.func,
|
|
249
|
-
onBlur: _propTypes.default.func
|
|
250
|
-
};
|
|
251
|
-
PuiTextField.defaultProps = {
|
|
252
|
-
type: "text",
|
|
253
|
-
formik: true,
|
|
254
|
-
disabled: false,
|
|
255
|
-
consultation: false,
|
|
256
|
-
multiline: false,
|
|
257
|
-
required: false,
|
|
258
|
-
error: false,
|
|
259
|
-
fullWidth: true,
|
|
260
|
-
readOnly: false,
|
|
261
|
-
onChange: () => {},
|
|
262
|
-
onBlur: () => {}
|
|
263
|
-
};
|
|
264
|
-
var _default = exports.default = PuiTextField;
|