pcm-shared-components 2.1.407 → 2.1.408
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.
|
@@ -119,6 +119,17 @@ const NoticeFieldControl = ({
|
|
|
119
119
|
color: error ? 'error' : 'primary'
|
|
120
120
|
}),
|
|
121
121
|
label: i18next.t('animal.read_notice_confirmation')
|
|
122
|
+
// The checkbox icon already goes red via `color` above when unchecked-and-required, but
|
|
123
|
+
// the label text next to it (the actual "I have read this" wording someone needs to read
|
|
124
|
+
// and act on) stayed the default color regardless -- targeting FormControlLabel's own
|
|
125
|
+
// label class is the supported way to color just that text, matching every other field's
|
|
126
|
+
// red label treatment above the control.
|
|
127
|
+
,
|
|
128
|
+
sx: {
|
|
129
|
+
'& .MuiFormControlLabel-label': {
|
|
130
|
+
color: error ? 'error.main' : 'text.primary'
|
|
131
|
+
}
|
|
132
|
+
}
|
|
122
133
|
}), helperText && /*#__PURE__*/React.createElement(FormHelperText, {
|
|
123
134
|
error: error
|
|
124
135
|
}, helperText));
|
|
@@ -92,12 +92,29 @@ export const AnimalVehicleDetailsEditor = props => {
|
|
|
92
92
|
canAddMore,
|
|
93
93
|
maxItems,
|
|
94
94
|
showHistoricalAnswers,
|
|
95
|
+
bare,
|
|
95
96
|
className,
|
|
96
97
|
theme,
|
|
97
98
|
i18next
|
|
98
99
|
} = props;
|
|
99
100
|
const compTheme = theme || useTheme();
|
|
100
101
|
const defaultTheme = createTheme(compTheme);
|
|
102
|
+
|
|
103
|
+
// `bare`: skip this component's own outer card (background/border/rounding) and render its
|
|
104
|
+
// content as a plain fragment instead -- for a caller that wants to place this editor and
|
|
105
|
+
// AnimalFieldsOnceBlock's once-per-reservation fields inside ONE shared outer card (a Divider
|
|
106
|
+
// between them, not two separate adjacent cards), rather than this component supplying its own
|
|
107
|
+
// competing card around just the per-item half. Off by default so every existing usage keeps
|
|
108
|
+
// its current self-contained card look unchanged.
|
|
109
|
+
const OuterWrapper = bare ? React.Fragment : Paper;
|
|
110
|
+
const outerWrapperProps = bare ? {} : {
|
|
111
|
+
variant: 'outlined',
|
|
112
|
+
sx: {
|
|
113
|
+
p: 1.5,
|
|
114
|
+
borderRadius: 2,
|
|
115
|
+
bgcolor: 'action.hover'
|
|
116
|
+
}
|
|
117
|
+
};
|
|
101
118
|
const keys = KEYS[itemType] || KEYS.animal;
|
|
102
119
|
const requiredErrorText = fieldType => i18next.t(REQUIRED_ERROR_KEY_BY_TYPE[fieldType] || 'animal.required_error');
|
|
103
120
|
const missingRequiredFields = item => fieldConfig.filter(f => f.required).filter(f => !isFieldAnswered(f.type, item.values?.[f.key] ?? (f.type === 'select_multiple' ? [] : '')));
|
|
@@ -234,14 +251,7 @@ export const AnimalVehicleDetailsEditor = props => {
|
|
|
234
251
|
theme: defaultTheme
|
|
235
252
|
}, /*#__PURE__*/React.createElement("div", {
|
|
236
253
|
className: className
|
|
237
|
-
}, /*#__PURE__*/React.createElement(
|
|
238
|
-
variant: "outlined",
|
|
239
|
-
sx: {
|
|
240
|
-
p: 1.5,
|
|
241
|
-
borderRadius: 2,
|
|
242
|
-
bgcolor: 'action.hover'
|
|
243
|
-
}
|
|
244
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
254
|
+
}, /*#__PURE__*/React.createElement(OuterWrapper, outerWrapperProps, /*#__PURE__*/React.createElement("div", {
|
|
245
255
|
className: "flex items-center justify-between mb-8"
|
|
246
256
|
}, /*#__PURE__*/React.createElement("div", {
|
|
247
257
|
className: "flex items-center",
|
|
@@ -605,6 +615,7 @@ AnimalVehicleDetailsEditor.defaultProps = {
|
|
|
605
615
|
canAddMore: true,
|
|
606
616
|
maxItems: 0,
|
|
607
617
|
showHistoricalAnswers: true,
|
|
618
|
+
bare: false,
|
|
608
619
|
className: 'w-full',
|
|
609
620
|
theme: undefined,
|
|
610
621
|
i18next: i18nextLocal
|
|
@@ -654,6 +665,10 @@ AnimalVehicleDetailsEditor.propTypes = {
|
|
|
654
665
|
* since-retired answer on an EXISTING reservation is legitimate. A guest-facing booking widget
|
|
655
666
|
* creating a brand-new reservation has no history to show and should pass false. */
|
|
656
667
|
showHistoricalAnswers: PropTypes.bool,
|
|
668
|
+
/** Skip this component's own outer card (background/border/rounding) and render a plain
|
|
669
|
+
* fragment instead -- for a caller placing this editor and AnimalFieldsOnceBlock's fields inside
|
|
670
|
+
* one shared outer card. Defaults to false so every existing usage keeps its current look. */
|
|
671
|
+
bare: PropTypes.bool,
|
|
657
672
|
/** Classes applied to the component's own wrapper div. */
|
|
658
673
|
className: PropTypes.string,
|
|
659
674
|
/** Theme object to use on this component, if none provided then the MUI5 theme provider theme is used. */
|