mautourco-components 0.2.75 → 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.
- package/dist/components/molecules/FeatureRow/FeatureRow.css +4 -0
- package/dist/components/molecules/FeatureRow/FeatureRow.d.ts +2 -0
- package/dist/components/molecules/FeatureRow/FeatureRow.js +10 -4
- package/dist/components/organisms/CarBookingCard/CarBookingCard.css +4 -1
- package/dist/components/organisms/CarBookingCard/CarBookingCard.d.ts +3 -1
- package/dist/components/organisms/CarBookingCard/CarBookingCard.js +4 -4
- package/package.json +1 -1
- package/src/components/molecules/FeatureRow/FeatureRow.css +4 -0
- package/src/components/molecules/FeatureRow/FeatureRow.tsx +14 -3
- package/src/components/organisms/CarBookingCard/CarBookingCard.css +4 -1
- package/src/components/organisms/CarBookingCard/CarBookingCard.tsx +5 -2
|
@@ -10,6 +10,8 @@ export interface FeatureRowProps {
|
|
|
10
10
|
icon?: IconName;
|
|
11
11
|
/** Size of the icon */
|
|
12
12
|
iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
/** State variant: 'not-applicable' applies error/danger styling to the value */
|
|
14
|
+
state?: 'default' | 'not-applicable';
|
|
13
15
|
/** Additional CSS classes */
|
|
14
16
|
className?: string;
|
|
15
17
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import Icon from '../../atoms/Icon/Icon';
|
|
3
2
|
import Divider from '../../atoms/Divider/Divider';
|
|
3
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
4
4
|
import './FeatureRow.css';
|
|
5
5
|
var FeatureRow = function (_a) {
|
|
6
|
-
var label = _a.label, value = _a.value, icon = _a.icon, _b = _a.iconSize, iconSize = _b === void 0 ? 'sm' : _b, _c = _a.className, className =
|
|
6
|
+
var label = _a.label, value = _a.value, icon = _a.icon, _b = _a.iconSize, iconSize = _b === void 0 ? 'sm' : _b, _c = _a.state, state = _c === void 0 ? 'default' : _c, _d = _a.className, className = _d === void 0 ? '' : _d;
|
|
7
7
|
var baseClass = 'feature-row';
|
|
8
|
-
var classes = [
|
|
9
|
-
|
|
8
|
+
var classes = [
|
|
9
|
+
baseClass,
|
|
10
|
+
state === 'not-applicable' ? "".concat(baseClass, "--not-applicable") : '',
|
|
11
|
+
className,
|
|
12
|
+
]
|
|
13
|
+
.filter(Boolean)
|
|
14
|
+
.join(' ');
|
|
15
|
+
return (_jsxs("div", { className: classes, children: [_jsx("div", { className: "feature-row__label", children: _jsx("span", { className: "feature-row__label-text", children: label }) }), _jsx(Divider, { orientation: "vertical", className: "feature-row__divider" }), _jsxs("div", { className: "feature-row__value", children: [icon && (_jsx(Icon, { name: icon, size: iconSize, className: "feature-row__value-icon" })), _jsx("span", { className: "feature-row__value-text ".concat(state === 'not-applicable' ? 'feature-row__value-text--not-applicable' : '').trim(), children: value })] })] }));
|
|
10
16
|
};
|
|
11
17
|
export default FeatureRow;
|
|
@@ -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
|
|
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.
|
|
23
|
-
var
|
|
24
|
-
var
|
|
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
|
import React from 'react';
|
|
2
|
-
import Icon, { IconName } from '../../atoms/Icon/Icon';
|
|
3
2
|
import Divider from '../../atoms/Divider/Divider';
|
|
3
|
+
import Icon, { IconName } from '../../atoms/Icon/Icon';
|
|
4
4
|
import './FeatureRow.css';
|
|
5
5
|
|
|
6
6
|
export interface FeatureRowProps {
|
|
@@ -12,6 +12,8 @@ export interface FeatureRowProps {
|
|
|
12
12
|
icon?: IconName;
|
|
13
13
|
/** Size of the icon */
|
|
14
14
|
iconSize?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
15
|
+
/** State variant: 'not-applicable' applies error/danger styling to the value */
|
|
16
|
+
state?: 'default' | 'not-applicable';
|
|
15
17
|
/** Additional CSS classes */
|
|
16
18
|
className?: string;
|
|
17
19
|
}
|
|
@@ -21,10 +23,17 @@ const FeatureRow: React.FC<FeatureRowProps> = ({
|
|
|
21
23
|
value,
|
|
22
24
|
icon,
|
|
23
25
|
iconSize = 'sm',
|
|
26
|
+
state = 'default',
|
|
24
27
|
className = '',
|
|
25
28
|
}) => {
|
|
26
29
|
const baseClass = 'feature-row';
|
|
27
|
-
const classes = [
|
|
30
|
+
const classes = [
|
|
31
|
+
baseClass,
|
|
32
|
+
state === 'not-applicable' ? `${baseClass}--not-applicable` : '',
|
|
33
|
+
className,
|
|
34
|
+
]
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join(' ');
|
|
28
37
|
|
|
29
38
|
return (
|
|
30
39
|
<div className={classes}>
|
|
@@ -36,7 +45,9 @@ const FeatureRow: React.FC<FeatureRowProps> = ({
|
|
|
36
45
|
{icon && (
|
|
37
46
|
<Icon name={icon} size={iconSize} className="feature-row__value-icon" />
|
|
38
47
|
)}
|
|
39
|
-
<span className=
|
|
48
|
+
<span className={`feature-row__value-text ${state === 'not-applicable' ? 'feature-row__value-text--not-applicable' : ''}`.trim()}>
|
|
49
|
+
{value}
|
|
50
|
+
</span>
|
|
40
51
|
</div>
|
|
41
52
|
</div>
|
|
42
53
|
);
|
|
@@ -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
|
|
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=
|
|
212
|
+
className={`car-booking-card__supplement-message ${supplementMessageState === 'error' ? 'car-booking-card__supplement-message--error' : ''}`.trim()}
|
|
210
213
|
>
|
|
211
214
|
{supplementMessage}
|
|
212
215
|
</Text>
|