@asante-org/atlascopco-vt-litesitegenerator 3.0.7 → 3.0.9

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/index.esm.js CHANGED
@@ -77,55 +77,117 @@ var LsgBanner = function (_a) {
77
77
  }, cta.label)));
78
78
  };
79
79
 
80
+ function cardVariantClass(variant) {
81
+ switch (variant) {
82
+ case "onlyText":
83
+ return "lsg-card--only-text";
84
+ case "withIcon":
85
+ return "lsg-card--with-icon";
86
+ case "withImage":
87
+ default:
88
+ return "lsg-card--with-image";
89
+ }
90
+ }
80
91
  var LsgCard = function (_a) {
92
+ var _b;
81
93
  var title = _a.title,
94
+ preTitle = _a.preTitle,
95
+ subtitle = _a.subtitle,
82
96
  description = _a.description,
83
97
  imageUrl = _a.imageUrl,
84
- _b = _a.imageAlt,
85
- imageAlt = _b === void 0 ? "" : _b,
98
+ _c = _a.imageAlt,
99
+ imageAlt = _c === void 0 ? "" : _c,
100
+ iconUrl = _a.iconUrl,
101
+ _d = _a.iconAlt,
102
+ iconAlt = _d === void 0 ? "" : _d,
86
103
  href = _a.href,
87
- cta = _a.cta;
88
- var inner = /*#__PURE__*/React.createElement(React.Fragment, null, imageUrl && /*#__PURE__*/React.createElement("div", {
89
- className: "lsg-card__image"
104
+ cta = _a.cta,
105
+ _e = _a.variant,
106
+ variant = _e === void 0 ? "withImage" : _e,
107
+ className = _a.className;
108
+ var resolvedIconUrl = iconUrl !== null && iconUrl !== void 0 ? iconUrl : imageUrl;
109
+ var actionLabel = (_b = cta === null || cta === void 0 ? void 0 : cta.label) !== null && _b !== void 0 ? _b : "Read more";
110
+ var cardClassName = ["lsg-card", cardVariantClass(variant), className].filter(Boolean).join(" ");
111
+ var content = /*#__PURE__*/React.createElement(React.Fragment, null, variant === "withImage" && imageUrl && /*#__PURE__*/React.createElement("div", {
112
+ className: "lsg-card__media"
90
113
  }, /*#__PURE__*/React.createElement("img", {
91
114
  src: imageUrl,
92
115
  alt: imageAlt,
93
116
  loading: "lazy"
94
117
  })), /*#__PURE__*/React.createElement("div", {
95
- className: "lsg-card__body"
96
- }, /*#__PURE__*/React.createElement("h3", {
118
+ className: "lsg-card__content"
119
+ }, variant === "withIcon" && resolvedIconUrl && /*#__PURE__*/React.createElement("div", {
120
+ className: "lsg-card__icon",
121
+ "aria-hidden": iconAlt ? undefined : true
122
+ }, /*#__PURE__*/React.createElement("img", {
123
+ src: resolvedIconUrl,
124
+ alt: iconAlt,
125
+ loading: "lazy"
126
+ })), /*#__PURE__*/React.createElement("div", {
127
+ className: "lsg-card__top"
128
+ }, preTitle && /*#__PURE__*/React.createElement("span", {
129
+ className: "lsg-card__pre-title"
130
+ }, /*#__PURE__*/React.createElement("span", {
131
+ className: "lsg-card__pre-title-dot",
132
+ "aria-hidden": "true"
133
+ }), /*#__PURE__*/React.createElement("span", {
134
+ className: "lsg-card__pre-title-text"
135
+ }, preTitle), /*#__PURE__*/React.createElement("span", {
136
+ className: "lsg-card__pre-title-arrow",
137
+ "aria-hidden": "true"
138
+ }, "\u2192")), /*#__PURE__*/React.createElement("h3", {
97
139
  className: "lsg-card__title"
98
- }, title), description && /*#__PURE__*/React.createElement("p", {
140
+ }, title), subtitle && /*#__PURE__*/React.createElement("h4", {
141
+ className: "lsg-card__subtitle"
142
+ }, subtitle)), /*#__PURE__*/React.createElement("div", {
143
+ className: "lsg-card__bottom"
144
+ }, description && /*#__PURE__*/React.createElement("p", {
99
145
  className: "lsg-card__description"
100
- }, description), cta && !href && /*#__PURE__*/React.createElement("div", {
101
- className: "lsg-card__footer"
102
- }, /*#__PURE__*/React.createElement(LsgButton, {
103
- href: cta.href,
104
- external: cta.external,
105
- variant: "primary"
106
- }, cta.label))));
107
- if (href) {
108
- return /*#__PURE__*/React.createElement("article", {
109
- className: "lsg-card"
110
- }, /*#__PURE__*/React.createElement("a", {
111
- href: href,
112
- className: "lsg-card__link",
113
- "aria-label": title
114
- }, inner));
115
- }
146
+ }, description), (href || cta) && (href ? /*#__PURE__*/React.createElement("span", {
147
+ className: "lsg-card__cta",
148
+ "aria-hidden": "true"
149
+ }, /*#__PURE__*/React.createElement("span", {
150
+ className: "lsg-card__cta-label"
151
+ }, actionLabel), /*#__PURE__*/React.createElement("span", {
152
+ className: "lsg-card__cta-arrow",
153
+ "aria-hidden": "true"
154
+ }, "\u2192")) : /*#__PURE__*/React.createElement("a", {
155
+ className: "lsg-card__cta",
156
+ href: cta === null || cta === void 0 ? void 0 : cta.href,
157
+ target: (cta === null || cta === void 0 ? void 0 : cta.external) ? "_blank" : undefined,
158
+ rel: (cta === null || cta === void 0 ? void 0 : cta.external) ? "noreferrer noopener" : undefined
159
+ }, /*#__PURE__*/React.createElement("span", {
160
+ className: "lsg-card__cta-label"
161
+ }, actionLabel), /*#__PURE__*/React.createElement("span", {
162
+ className: "lsg-card__cta-arrow",
163
+ "aria-hidden": "true"
164
+ }, "\u2192"))))));
116
165
  return /*#__PURE__*/React.createElement("article", {
117
- className: "lsg-card"
118
- }, inner);
166
+ className: cardClassName,
167
+ "data-lsg-card-variant": variant
168
+ }, href ? /*#__PURE__*/React.createElement("a", {
169
+ href: href,
170
+ className: "lsg-card__link",
171
+ "aria-label": title
172
+ }, content) : /*#__PURE__*/React.createElement("div", {
173
+ className: "lsg-card__link"
174
+ }, content));
119
175
  };
120
- /** Renders a responsive grid of LsgCard items. */
176
+ /** Renders the AEM/Storybook compatible responsive card grid. */
121
177
  var LsgCards = function (_a) {
122
- var cards = _a.cards;
178
+ var cards = _a.cards,
179
+ _b = _a.columns,
180
+ columns = _b === void 0 ? 3 : _b,
181
+ className = _a.className;
182
+ var listClassName = ["lsg-cards", "lsg-cards--cols-".concat(columns), className].filter(Boolean).join(" ");
123
183
  return /*#__PURE__*/React.createElement("ul", {
124
- className: "lsg-cards"
125
- }, cards.map(function (card, i) {
126
- var _a;
184
+ className: listClassName,
185
+ "data-columns": columns
186
+ }, cards.map(function (card, index) {
187
+ var _a, _b, _c;
127
188
  return /*#__PURE__*/React.createElement("li", {
128
- key: (_a = card.href) !== null && _a !== void 0 ? _a : i
189
+ className: "lsg-cards__item",
190
+ key: (_c = (_a = card.href) !== null && _a !== void 0 ? _a : (_b = card.cta) === null || _b === void 0 ? void 0 : _b.href) !== null && _c !== void 0 ? _c : "".concat(card.title, "-").concat(index)
129
191
  }, /*#__PURE__*/React.createElement(LsgCard, card));
130
192
  }));
131
193
  };