mautourco-components 0.2.76 → 0.2.77

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.
@@ -137,12 +137,15 @@
137
137
 
138
138
  .car-booking-card__supplement-message {
139
139
  margin: 0;
140
- color: var(--color-messaging-danger-foreground, #a01414);
141
140
  white-space: normal;
142
141
  text-align: right;
143
142
  flex: 1 1 auto;
144
143
  }
145
144
 
145
+ .car-booking-card__supplement-header .car-booking-card__supplement-message--error {
146
+ color: var(--color-messaging-danger-foreground, #a01414);
147
+ }
148
+
146
149
  .car-booking-card__section--supplement {
147
150
  /* Control spacing precisely: divider -> header != header -> select */
148
151
  gap: 0;
@@ -30,8 +30,10 @@ export interface CarBookingCardProps {
30
30
  /** Supplement dropdown section */
31
31
  /** Whether to render the supplement section (matches Figma variants Supplement=Yes/No/-) */
32
32
  showSupplement?: boolean;
33
- /** Optional message shown in red next to the "Supplement" label (Figma: "Supplement is not available for this vehicle.") */
33
+ /** Optional message shown next to the "Supplement" label (Figma: "Supplement is not available for this vehicle.") */
34
34
  supplementMessage?: string;
35
+ /** State variant for the supplement message: 'error' applies danger/red styling, 'default' uses normal text color */
36
+ supplementMessageState?: 'default' | 'error';
35
37
  supplementLabel?: string;
36
38
  supplementPlaceholder?: string;
37
39
  supplementValue?: string;
@@ -19,9 +19,9 @@ import FeatureRow from '../../molecules/FeatureRow/FeatureRow';
19
19
  import './CarBookingCard.css';
20
20
  var CarBookingCard = function (_a) {
21
21
  var _b;
22
- var imageSrc = _a.imageSrc, title = _a.title, _c = _a.size, size = _c === void 0 ? 'large' : _c, _d = _a.state, state = _d === void 0 ? 'default' : _d, _e = _a.type, type = _e === void 0 ? 'default' : _e, features = _a.features, infoText = _a.infoText, _f = _a.priceTitle, priceTitle = _f === void 0 ? 'Price breakdown' : _f, _g = _a.priceRows, priceRows = _g === void 0 ? [] : _g, showSupplement = _a.showSupplement, supplementMessage = _a.supplementMessage, _h = _a.supplementLabel, supplementLabel = _h === void 0 ? 'Supplement' : _h, _j = _a.supplementPlaceholder, supplementPlaceholder = _j === void 0 ? 'Select a supplement' : _j, supplementValue = _a.supplementValue, _k = _a.supplementState, supplementState = _k === void 0 ? 'default' : _k, _l = _a.supplementOptions, supplementOptions = _l === void 0 ? [] : _l, onSupplementSelect = _a.onSupplementSelect, totalPrice = _a.totalPrice, _m = _a.totalPriceLabel, totalPriceLabel = _m === void 0 ? 'Total price' : _m, ctaLabel = _a.ctaLabel, ctaButtonProps = _a.ctaButtonProps, onCtaClick = _a.onCtaClick, _o = _a.readonly, readonly = _o === void 0 ? false : _o, _p = _a.className, className = _p === void 0 ? '' : _p;
23
- var _q = useState(state === 'selected'), isSelected = _q[0], setIsSelected = _q[1];
24
- var _r = useState(false), isHovered = _r[0], setIsHovered = _r[1];
22
+ var imageSrc = _a.imageSrc, title = _a.title, _c = _a.size, size = _c === void 0 ? 'large' : _c, _d = _a.state, state = _d === void 0 ? 'default' : _d, _e = _a.type, type = _e === void 0 ? 'default' : _e, features = _a.features, infoText = _a.infoText, _f = _a.priceTitle, priceTitle = _f === void 0 ? 'Price breakdown' : _f, _g = _a.priceRows, priceRows = _g === void 0 ? [] : _g, showSupplement = _a.showSupplement, supplementMessage = _a.supplementMessage, _h = _a.supplementMessageState, supplementMessageState = _h === void 0 ? 'error' : _h, _j = _a.supplementLabel, supplementLabel = _j === void 0 ? 'Supplement' : _j, _k = _a.supplementPlaceholder, supplementPlaceholder = _k === void 0 ? 'Select a supplement' : _k, supplementValue = _a.supplementValue, _l = _a.supplementState, supplementState = _l === void 0 ? 'default' : _l, _m = _a.supplementOptions, supplementOptions = _m === void 0 ? [] : _m, onSupplementSelect = _a.onSupplementSelect, totalPrice = _a.totalPrice, _o = _a.totalPriceLabel, totalPriceLabel = _o === void 0 ? 'Total price' : _o, ctaLabel = _a.ctaLabel, ctaButtonProps = _a.ctaButtonProps, onCtaClick = _a.onCtaClick, _p = _a.readonly, readonly = _p === void 0 ? false : _p, _q = _a.className, className = _q === void 0 ? '' : _q;
23
+ var _r = useState(state === 'selected'), isSelected = _r[0], setIsSelected = _r[1];
24
+ var _s = useState(false), isHovered = _s[0], setIsHovered = _s[1];
25
25
  var resolvedShowSupplement = showSupplement !== null && showSupplement !== void 0 ? showSupplement : Boolean(supplementLabel || supplementPlaceholder || supplementOptions.length > 0);
26
26
  var resolvedSupplementState = supplementMessage ? 'disabled' : supplementState;
27
27
  // Handle CTA click: toggle between "Add to quote" and "Selected"
@@ -71,6 +71,6 @@ var CarBookingCard = function (_a) {
71
71
  return (_jsxs("article", { className: classes, children: [_jsx("div", { className: "car-booking-card__image-wrap", children: _jsx("img", { className: "car-booking-card__image", src: imageSrc, alt: "" }) }), _jsx("div", { className: "car-booking-card__active-divider" }), _jsxs("div", { className: "car-booking-card__body", children: [_jsxs("section", { className: "car-booking-card__section car-booking-card__section--content", children: [_jsxs("div", { className: "car-booking-card__title", children: [_jsx("span", { className: "car-booking-card__title-marker", "aria-hidden": "true" }), _jsx(Heading, { level: 4, variant: "bold", color: "accent", className: "car-booking-card__title-text", children: title })] }), _jsx("div", { className: "car-booking-card__features", children: features.map(function (feature, idx) {
72
72
  var _a;
73
73
  return (_jsx(FeatureRow, __assign({}, feature, { className: "car-booking-card__feature-row ".concat((_a = feature.className) !== null && _a !== void 0 ? _a : '').trim() }), "".concat(feature.label, "-").concat(idx)));
74
- }) }), infoText && !readonly && (_jsxs("div", { className: "car-booking-card__info", children: [_jsx("span", { className: "car-booking-card__info-icon", "aria-hidden": "true", children: "i" }), _jsx(Text, { size: "sm", leading: "5", variant: "regular", color: "default", className: "car-booking-card__info-text", children: infoText })] }))] }), resolvedShowSupplement && !readonly && (_jsxs("section", { className: "car-booking-card__section car-booking-card__section--supplement", children: [_jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" }), _jsxs("div", { className: "car-booking-card__supplement-header", children: [_jsx(Text, { as: "h3", size: "md", variant: "bold", leading: "none", color: "default", className: "car-booking-card__section-title", children: supplementLabel }), supplementMessage && (_jsx(Text, { as: "p", size: "sm", leading: "5", variant: "regular", className: "car-booking-card__supplement-message", children: supplementMessage }))] }), readonly ? (_jsx(Text, { size: "sm", leading: "5", variant: "regular", color: supplementValue ? "default" : "subtle", className: "car-booking-card__supplement-value", children: supplementValue || supplementPlaceholder })) : (_jsx(DropdownInput, { placeholder: supplementPlaceholder, value: supplementValue, state: resolvedSupplementState, options: supplementOptions, onSelect: onSupplementSelect }))] })), priceRows.length > 0 && !readonly && (_jsxs("section", { className: "car-booking-card__section car-booking-card__section--price", children: [_jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" }), _jsxs("div", { className: "car-booking-card__price-content", children: [_jsx(Text, { as: "h3", size: "md", variant: "bold", leading: "none", color: "default", className: "car-booking-card__section-title", children: priceTitle }), _jsx("div", { className: "car-booking-card__price-rows", children: priceRows.map(function (row, idx) { return (_jsxs("div", { className: "car-booking-card__price-row", children: [_jsx(Text, { size: "sm", leading: "5", variant: "regular", color: "subtle", className: "car-booking-card__price-label", children: row.label }), _jsx(Text, { size: "sm", leading: "5", variant: "bold", color: "subtle", className: "car-booking-card__price-value", children: row.value })] }, "".concat(row.label, "-").concat(idx))); }) })] }), _jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" })] })), !readonly && _jsxs("footer", { className: "car-booking-card__footer", children: [_jsxs("div", { className: "car-booking-card__total", children: [_jsx(Text, { size: "base", variant: "bold", color: "accent", className: "car-booking-card__total-price", children: totalPrice }), _jsx(Text, { size: "sm", variant: "regular", color: "subtle", className: "car-booking-card__total-label", children: totalPriceLabel })] }), !readonly && (_jsx("div", { onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "car-booking-card__cta-wrapper", children: _jsx(Button, __assign({}, resolvedCtaButtonProps, { onClick: handleCtaClick, className: "car-booking-card__cta ".concat((_b = resolvedCtaButtonProps === null || resolvedCtaButtonProps === void 0 ? void 0 : resolvedCtaButtonProps.className) !== null && _b !== void 0 ? _b : '').trim(), children: resolvedCtaLabel })) }))] })] })] }));
74
+ }) }), infoText && !readonly && (_jsxs("div", { className: "car-booking-card__info", children: [_jsx("span", { className: "car-booking-card__info-icon", "aria-hidden": "true", children: "i" }), _jsx(Text, { size: "sm", leading: "5", variant: "regular", color: "default", className: "car-booking-card__info-text", children: infoText })] }))] }), resolvedShowSupplement && !readonly && (_jsxs("section", { className: "car-booking-card__section car-booking-card__section--supplement", children: [_jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" }), _jsxs("div", { className: "car-booking-card__supplement-header", children: [_jsx(Text, { as: "h3", size: "md", variant: "bold", leading: "none", color: "default", className: "car-booking-card__section-title", children: supplementLabel }), supplementMessage && (_jsx(Text, { as: "p", size: "sm", leading: "5", variant: "regular", className: "car-booking-card__supplement-message ".concat(supplementMessageState === 'error' ? 'car-booking-card__supplement-message--error' : '').trim(), children: supplementMessage }))] }), readonly ? (_jsx(Text, { size: "sm", leading: "5", variant: "regular", color: supplementValue ? "default" : "subtle", className: "car-booking-card__supplement-value", children: supplementValue || supplementPlaceholder })) : (_jsx(DropdownInput, { placeholder: supplementPlaceholder, value: supplementValue, state: resolvedSupplementState, options: supplementOptions, onSelect: onSupplementSelect }))] })), priceRows.length > 0 && !readonly && (_jsxs("section", { className: "car-booking-card__section car-booking-card__section--price", children: [_jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" }), _jsxs("div", { className: "car-booking-card__price-content", children: [_jsx(Text, { as: "h3", size: "md", variant: "bold", leading: "none", color: "default", className: "car-booking-card__section-title", children: priceTitle }), _jsx("div", { className: "car-booking-card__price-rows", children: priceRows.map(function (row, idx) { return (_jsxs("div", { className: "car-booking-card__price-row", children: [_jsx(Text, { size: "sm", leading: "5", variant: "regular", color: "subtle", className: "car-booking-card__price-label", children: row.label }), _jsx(Text, { size: "sm", leading: "5", variant: "bold", color: "subtle", className: "car-booking-card__price-value", children: row.value })] }, "".concat(row.label, "-").concat(idx))); }) })] }), _jsx(Divider, { variant: "dashed", className: "car-booking-card__dashed-divider" })] })), !readonly && _jsxs("footer", { className: "car-booking-card__footer", children: [_jsxs("div", { className: "car-booking-card__total", children: [_jsx(Text, { size: "base", variant: "bold", color: "accent", className: "car-booking-card__total-price", children: totalPrice }), _jsx(Text, { size: "sm", variant: "regular", color: "subtle", className: "car-booking-card__total-label", children: totalPriceLabel })] }), !readonly && (_jsx("div", { onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, className: "car-booking-card__cta-wrapper", children: _jsx(Button, __assign({}, resolvedCtaButtonProps, { onClick: handleCtaClick, className: "car-booking-card__cta ".concat((_b = resolvedCtaButtonProps === null || resolvedCtaButtonProps === void 0 ? void 0 : resolvedCtaButtonProps.className) !== null && _b !== void 0 ? _b : '').trim(), children: resolvedCtaLabel })) }))] })] })] }));
75
75
  };
76
76
  export default CarBookingCard;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.76",
3
+ "version": "0.2.77",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Mautourco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -133,12 +133,15 @@
133
133
 
134
134
  .car-booking-card__supplement-message {
135
135
  margin: 0;
136
- color: var(--color-messaging-danger-foreground, #a01414);
137
136
  white-space: normal;
138
137
  text-align: right;
139
138
  flex: 1 1 auto;
140
139
  }
141
140
 
141
+ .car-booking-card__supplement-header .car-booking-card__supplement-message--error {
142
+ color: var(--color-messaging-danger-foreground, #a01414);
143
+ }
144
+
142
145
  .car-booking-card__section--supplement {
143
146
  /* Control spacing precisely: divider -> header != header -> select */
144
147
  gap: 0;
@@ -40,8 +40,10 @@ export interface CarBookingCardProps {
40
40
  /** Supplement dropdown section */
41
41
  /** Whether to render the supplement section (matches Figma variants Supplement=Yes/No/-) */
42
42
  showSupplement?: boolean;
43
- /** Optional message shown in red next to the "Supplement" label (Figma: "Supplement is not available for this vehicle.") */
43
+ /** Optional message shown next to the "Supplement" label (Figma: "Supplement is not available for this vehicle.") */
44
44
  supplementMessage?: string;
45
+ /** State variant for the supplement message: 'error' applies danger/red styling, 'default' uses normal text color */
46
+ supplementMessageState?: 'default' | 'error';
45
47
  supplementLabel?: string;
46
48
  supplementPlaceholder?: string;
47
49
  supplementValue?: string;
@@ -76,6 +78,7 @@ const CarBookingCard: React.FC<CarBookingCardProps> = ({
76
78
  priceRows = [],
77
79
  showSupplement,
78
80
  supplementMessage,
81
+ supplementMessageState = 'error',
79
82
  supplementLabel = 'Supplement',
80
83
  supplementPlaceholder = 'Select a supplement',
81
84
  supplementValue,
@@ -206,7 +209,7 @@ const CarBookingCard: React.FC<CarBookingCardProps> = ({
206
209
  size="sm"
207
210
  leading="5"
208
211
  variant="regular"
209
- className="car-booking-card__supplement-message"
212
+ className={`car-booking-card__supplement-message ${supplementMessageState === 'error' ? 'car-booking-card__supplement-message--error' : ''}`.trim()}
210
213
  >
211
214
  {supplementMessage}
212
215
  </Text>