@manamerge/mana-atomic-ui 1.0.2 → 1.0.3

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.d.ts CHANGED
@@ -221,4 +221,16 @@ interface CardBannerTypes {
221
221
  }
222
222
  declare const CardBanner: React.FC<CardBannerTypes>;
223
223
 
224
- export { BreakerTape, Button, CDNImage, CardBanner, CardSimpleRender, CardTeaser, Divider, Footer, Gradient, Header, Heading, Icon, Link, Navigation, Text };
224
+ interface ContentTypes {
225
+ title?: string;
226
+ description?: string;
227
+ }
228
+ interface AccordionTypes {
229
+ moleculeVariant?: string;
230
+ iconPlus?: FunctionComponent<SVGProps<SVGSVGElement>>;
231
+ iconMinus?: FunctionComponent<SVGProps<SVGSVGElement>>;
232
+ content?: ContentTypes[];
233
+ }
234
+ declare const Accordion: React.FC<AccordionTypes>;
235
+
236
+ export { Accordion, BreakerTape, Button, CDNImage, CardBanner, CardSimpleRender, CardTeaser, Divider, Footer, Gradient, Header, Heading, Icon, Link, Navigation, Text };
package/dist/index.js CHANGED
@@ -573,7 +573,7 @@ const AtomIconDot = styled(Icon).attrs(({ theme, moleculeVariant }) => {
573
573
  `;
574
574
  }}
575
575
  `;
576
- const AtomHeading$2 = styled(Heading).attrs(({ theme, moleculeVariant }) => {
576
+ const AtomHeading$3 = styled(Heading).attrs(({ theme, moleculeVariant }) => {
577
577
  var _a, _b, _c;
578
578
  return ({
579
579
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.header) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomHeading) === null || _c === void 0 ? void 0 : _c.variant
@@ -631,7 +631,7 @@ const AtomIconRight = styled(Icon).attrs(({ theme, moleculeVariant }) => {
631
631
 
632
632
  const Header = ({ moleculeVariant = "primary", iconTop, iconDot, iconLeft, iconRight, textBanner, headingTitle, textTitle, buttonLeftText, buttonLeftClick, buttonRightText, buttonRightClick }) => {
633
633
  const compVariant = `Header-${moleculeVariant}`;
634
- return (jsx(WrapperBackground, Object.assign({ className: classNames(compVariant), moleculeVariant: compVariant }, { children: jsxs(WrapperHeader, { children: [jsxs("div", { children: [iconTop && (jsx(AtomIconTop, { moleculeVariant: compVariant, svg: iconTop })), jsxs(WrapperLineTop, Object.assign({ moleculeVariant: compVariant }, { children: [iconDot && (jsx(AtomIconDot, { moleculeVariant: compVariant, svg: iconDot })), jsx(AtomTextTitle, Object.assign({ moleculeVariant: compVariant }, { children: textBanner }))] }))] }), jsx(AtomHeading$2, Object.assign({ moleculeVariant: compVariant }, { children: headingTitle })), jsx("div", { children: textTitle === null || textTitle === void 0 ? void 0 : textTitle.map((text, i) => (jsx(AtomTextTitle, Object.assign({ moleculeVariant: compVariant }, { children: text }), i))) }), jsxs(WrapperLineBottom, { children: [jsxs(AtomButtonLeft, Object.assign({ moleculeVariant: compVariant, onClick: buttonLeftClick }, { children: [iconLeft && (jsx(AtomIconLeft, { moleculeVariant: compVariant, svg: iconLeft })), jsx(AtomTextLeft, Object.assign({ moleculeVariant: compVariant }, { children: buttonLeftText }))] })), jsxs(AtomButtonRight, Object.assign({ moleculeVariant: compVariant, onClick: buttonRightClick }, { children: [jsx(AtomTextRight, Object.assign({ moleculeVariant: compVariant }, { children: buttonRightText })), iconRight && (jsx(AtomIconRight, { moleculeVariant: compVariant, svg: iconRight }))] }))] })] }) })));
634
+ return (jsx(WrapperBackground, Object.assign({ className: classNames(compVariant), moleculeVariant: compVariant }, { children: jsxs(WrapperHeader, { children: [jsxs("div", { children: [iconTop && (jsx(AtomIconTop, { moleculeVariant: compVariant, svg: iconTop })), jsxs(WrapperLineTop, Object.assign({ moleculeVariant: compVariant }, { children: [iconDot && (jsx(AtomIconDot, { moleculeVariant: compVariant, svg: iconDot })), jsx(AtomTextTitle, Object.assign({ moleculeVariant: compVariant }, { children: textBanner }))] }))] }), jsx(AtomHeading$3, Object.assign({ moleculeVariant: compVariant }, { children: headingTitle })), jsx("div", { children: textTitle === null || textTitle === void 0 ? void 0 : textTitle.map((text, i) => (jsx(AtomTextTitle, Object.assign({ moleculeVariant: compVariant }, { children: text }), i))) }), jsxs(WrapperLineBottom, { children: [jsxs(AtomButtonLeft, Object.assign({ moleculeVariant: compVariant, onClick: buttonLeftClick }, { children: [iconLeft && (jsx(AtomIconLeft, { moleculeVariant: compVariant, svg: iconLeft })), jsx(AtomTextLeft, Object.assign({ moleculeVariant: compVariant }, { children: buttonLeftText }))] })), jsxs(AtomButtonRight, Object.assign({ moleculeVariant: compVariant, onClick: buttonRightClick }, { children: [jsx(AtomTextRight, Object.assign({ moleculeVariant: compVariant }, { children: buttonRightText })), iconRight && (jsx(AtomIconRight, { moleculeVariant: compVariant, svg: iconRight }))] }))] })] }) })));
635
635
  };
636
636
 
637
637
  const NavBar = styled.nav `
@@ -1238,19 +1238,19 @@ const WrapperLine = styled.div `
1238
1238
  text-align: center;
1239
1239
  gap: 10px;
1240
1240
  `;
1241
- const AtomIcon$1 = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1241
+ const AtomIcon$2 = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1242
1242
  var _a, _b, _c;
1243
1243
  return ({
1244
1244
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardSimpleRender) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomIcon) === null || _c === void 0 ? void 0 : _c.variant
1245
1245
  });
1246
1246
  }) ``;
1247
- const AtomHeading$1 = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1247
+ const AtomHeading$2 = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1248
1248
  var _a, _b, _c;
1249
1249
  return ({
1250
1250
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardSimpleRender) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomHeading) === null || _c === void 0 ? void 0 : _c.variant
1251
1251
  });
1252
1252
  }) ``;
1253
- const AtomText$1 = styled(Text).attrs(({ theme, moleculeVariant }) => {
1253
+ const AtomText$2 = styled(Text).attrs(({ theme, moleculeVariant }) => {
1254
1254
  var _a, _b, _c;
1255
1255
  return ({
1256
1256
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardSimpleRender) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomText) === null || _c === void 0 ? void 0 : _c.variant
@@ -1258,7 +1258,7 @@ const AtomText$1 = styled(Text).attrs(({ theme, moleculeVariant }) => {
1258
1258
  }) ``;
1259
1259
 
1260
1260
  const CardSimpleRender = ({ moleculeVariant = "primary", icon, title, description, children, cardClick }) => {
1261
- return (jsxs(Card$1, Object.assign({ className: classNames("CardSimpleRender-", moleculeVariant), moleculeVariant: "CardSimpleRender-" + moleculeVariant, as: cardClick ? "button" : "div", onClick: cardClick, cardHover: !!cardClick }, { children: [jsxs("div", { children: [jsxs(WrapperLine, { children: [icon && (jsx(AtomIcon$1, { moleculeVariant: "CardSimpleRender-" + moleculeVariant, svg: icon })), jsx(AtomHeading$1, Object.assign({ moleculeVariant: "CardSimpleRender-" + moleculeVariant }, { children: title }))] }), jsx(AtomText$1, Object.assign({ moleculeVariant: "CardSimpleRender-" + moleculeVariant }, { children: description }))] }), children] })));
1261
+ return (jsxs(Card$1, Object.assign({ className: classNames("CardSimpleRender-", moleculeVariant), moleculeVariant: "CardSimpleRender-" + moleculeVariant, as: cardClick ? "button" : "div", onClick: cardClick, cardHover: !!cardClick }, { children: [jsxs("div", { children: [jsxs(WrapperLine, { children: [icon && (jsx(AtomIcon$2, { moleculeVariant: "CardSimpleRender-" + moleculeVariant, svg: icon })), jsx(AtomHeading$2, Object.assign({ moleculeVariant: "CardSimpleRender-" + moleculeVariant }, { children: title }))] }), jsx(AtomText$2, Object.assign({ moleculeVariant: "CardSimpleRender-" + moleculeVariant }, { children: description }))] }), children] })));
1262
1262
  };
1263
1263
 
1264
1264
  const Card = styled.div `
@@ -1288,13 +1288,13 @@ const Card = styled.div `
1288
1288
  `;
1289
1289
  }}
1290
1290
  `;
1291
- const AtomHeading = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1291
+ const AtomHeading$1 = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1292
1292
  var _a, _b, _c;
1293
1293
  return ({
1294
1294
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardBanner) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomHeading) === null || _c === void 0 ? void 0 : _c.variant
1295
1295
  });
1296
1296
  }) ``;
1297
- const AtomText = styled(Text).attrs(({ theme, moleculeVariant }) => {
1297
+ const AtomText$1 = styled(Text).attrs(({ theme, moleculeVariant }) => {
1298
1298
  var _a, _b, _c;
1299
1299
  return ({
1300
1300
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardBanner) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomText) === null || _c === void 0 ? void 0 : _c.variant
@@ -1312,7 +1312,7 @@ const AtomTextButton = styled(Text).attrs(({ theme, moleculeVariant }) => {
1312
1312
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardBanner) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomTextButton) === null || _c === void 0 ? void 0 : _c.variant
1313
1313
  });
1314
1314
  }) ``;
1315
- const AtomIcon = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1315
+ const AtomIcon$1 = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1316
1316
  var _a, _b, _c;
1317
1317
  return ({
1318
1318
  variant: (_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.cardBanner) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomIcon) === null || _c === void 0 ? void 0 : _c.variant
@@ -1320,8 +1320,112 @@ const AtomIcon = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1320
1320
  }) ``;
1321
1321
 
1322
1322
  const CardBanner = ({ moleculeVariant = "primary", icon, title, description, buttonText, buttonClick }) => {
1323
- return (jsxs(Card, Object.assign({ className: classNames("CardBanner-", moleculeVariant), moleculeVariant: "CardBanner-" + moleculeVariant }, { children: [jsxs("div", { children: [jsx(AtomHeading, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: title })), jsx(AtomText, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: description }))] }), buttonClick && (jsxs(AtomButton, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant, onClick: buttonClick }, { children: [jsx(AtomTextButton, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: buttonText })), icon && (jsx(AtomIcon, { moleculeVariant: "CardBanner-" + moleculeVariant, svg: icon }))] })))] })));
1323
+ return (jsxs(Card, Object.assign({ className: classNames("CardBanner-", moleculeVariant), moleculeVariant: "CardBanner-" + moleculeVariant }, { children: [jsxs("div", { children: [jsx(AtomHeading$1, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: title })), jsx(AtomText$1, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: description }))] }), buttonClick && (jsxs(AtomButton, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant, onClick: buttonClick }, { children: [jsx(AtomTextButton, Object.assign({ moleculeVariant: "CardBanner-" + moleculeVariant }, { children: buttonText })), icon && (jsx(AtomIcon$1, { moleculeVariant: "CardBanner-" + moleculeVariant, svg: icon }))] })))] })));
1324
+ };
1325
+
1326
+ const AccordionContainer = styled.div `
1327
+ ${({ theme, moleculeVariant }) => {
1328
+ var _a;
1329
+ const thisTheme = ((_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) || {};
1330
+ return css `
1331
+ width: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.width) || "100%"};
1332
+ border-radius: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.borderRadius};
1333
+ overflow: hidden;
1334
+ `;
1335
+ }};
1336
+ `;
1337
+ const AccordionTitle = styled.button `
1338
+ ${({ theme, moleculeVariant }) => {
1339
+ var _a, _b, _c, _d;
1340
+ const thisTheme = ((_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) || {};
1341
+ return css `
1342
+ all: unset;
1343
+ width: 100%;
1344
+ display: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.display) || "flex"};
1345
+ align-items: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.alignItems) || "center"};
1346
+ justify-content: ${(thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.justifyContent) || "space-between"};
1347
+ text-align: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.textAlign};
1348
+ gap: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.gap};
1349
+ cursor: pointer;
1350
+ background: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.backgroundTitle};
1351
+ &:hover {
1352
+ background: ${(_b = thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.hover) === null || _b === void 0 ? void 0 : _b.background};
1353
+ }
1354
+ &:focus-visible {
1355
+ outline: ${((_c = thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.focusVisible) === null || _c === void 0 ? void 0 : _c.outline) ||
1356
+ "#0078d4 2px solid"};
1357
+ outline-offset: ${((_d = thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.focusVisible) === null || _d === void 0 ? void 0 : _d.outlineOffset) ||
1358
+ "1px"};
1359
+ }
1360
+ > * {
1361
+ padding: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.paddingTitle};
1362
+ }
1363
+ `;
1364
+ }};
1365
+ `;
1366
+ const AccordionDescription = styled.div `
1367
+ ${({ theme, moleculeVariant }) => {
1368
+ var _a;
1369
+ const thisTheme = ((_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) || {};
1370
+ return css `
1371
+ background: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.backgroundDescription};
1372
+ `;
1373
+ }};
1374
+
1375
+ overflow: hidden;
1376
+ opacity: ${({ isOpen }) => (isOpen ? 1 : 0)};
1377
+ max-height: ${({ isOpen }) => (isOpen ? "1000px" : "0")};
1378
+ transition:
1379
+ max-height 0.5s ease,
1380
+ opacity 0.6s ease;
1381
+ `;
1382
+ const AtomHeading = styled(Heading).attrs(({ theme, moleculeVariant }) => {
1383
+ var _a, _b, _c;
1384
+ return ({
1385
+ variant: ((_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomHeading) === null || _c === void 0 ? void 0 : _c.variant) || "h5"
1386
+ });
1387
+ }) `
1388
+ ${({ theme, moleculeVariant }) => {
1389
+ var _a, _b;
1390
+ const thisTheme = ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomHeading) || {};
1391
+ return css `
1392
+ color: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.color};
1393
+ `;
1394
+ }};
1395
+ `;
1396
+ const AtomIcon = styled(Icon).attrs(({ theme, moleculeVariant }) => {
1397
+ var _a, _b, _c;
1398
+ return ({
1399
+ variant: ((_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomIcon) === null || _c === void 0 ? void 0 : _c.variant) || "small"
1400
+ });
1401
+ }) ``;
1402
+ const AtomText = styled(Text).attrs(({ theme, moleculeVariant }) => {
1403
+ var _a, _b, _c;
1404
+ return ({
1405
+ variant: ((_c = (_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomText) === null || _c === void 0 ? void 0 : _c.variant) || "regular"
1406
+ });
1407
+ }) `
1408
+ ${({ theme, moleculeVariant }) => {
1409
+ var _a, _b;
1410
+ const thisTheme = ((_b = (_a = theme === null || theme === void 0 ? void 0 : theme.accordion) === null || _a === void 0 ? void 0 : _a[moleculeVariant]) === null || _b === void 0 ? void 0 : _b.atomText) || {};
1411
+ return css `
1412
+ padding: ${thisTheme === null || thisTheme === void 0 ? void 0 : thisTheme.padding};
1413
+ `;
1414
+ }};
1415
+ `;
1416
+
1417
+ const Accordion = ({ moleculeVariant = "primary", iconPlus, iconMinus, content = [] }) => {
1418
+ const [openIndices, setOpenIndices] = useState([]);
1419
+ const toggleAccordion = (index) => {
1420
+ setOpenIndices((prev) => {
1421
+ const newOpenIndices = [...prev];
1422
+ newOpenIndices[index] = !newOpenIndices[index];
1423
+ return newOpenIndices;
1424
+ });
1425
+ };
1426
+ const compVariant = `Accordion-${moleculeVariant}`;
1427
+ return (jsx(AccordionContainer, Object.assign({ className: classNames(compVariant), moleculeVariant: compVariant }, { children: content === null || content === void 0 ? void 0 : content.map((item, index) => (jsxs(Fragment, { children: [jsxs(AccordionTitle, Object.assign({ moleculeVariant: compVariant, onClick: () => toggleAccordion(index), "aria-pressed": openIndices[index] }, { children: [jsx(AtomHeading, Object.assign({ moleculeVariant: compVariant }, { children: item.title })), iconPlus && iconMinus && (jsx(AtomIcon, { moleculeVariant: compVariant, svg: openIndices[index] ? iconMinus : iconPlus }))] })), jsx(AccordionDescription, Object.assign({ moleculeVariant: compVariant, isOpen: openIndices[index], onTransitionEnd: () => !openIndices[index] }, { children: jsx(AtomText, Object.assign({ moleculeVariant: compVariant }, { children: item.description })) }))] }))) })));
1324
1428
  };
1325
1429
 
1326
- export { BreakerTape, Button, CDNImage, CardBanner, CardSimpleRender, CardTeaser, Divider, Footer, Gradient, Header, Heading, Icon, Link, Navigation, Text };
1430
+ export { Accordion, BreakerTape, Button, CDNImage, CardBanner, CardSimpleRender, CardTeaser, Divider, Footer, Gradient, Header, Heading, Icon, Link, Navigation, Text };
1327
1431
  //# sourceMappingURL=index.js.map