@xylabs/react-accordion 3.0.17 → 3.0.19
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/README.md +67 -0
- package/package.json +7 -7
- package/dist/browser/AccordionGroup.cjs +0 -48
- package/dist/browser/AccordionGroup.cjs.map +0 -1
- package/dist/browser/AccordionGroup.js +0 -27
- package/dist/browser/AccordionGroup.js.map +0 -1
- package/dist/node/AccordionGroup.cjs +0 -53
- package/dist/node/AccordionGroup.cjs.map +0 -1
- package/dist/node/AccordionGroup.js +0 -27
- package/dist/node/AccordionGroup.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[![logo][]](https://xylabs.com)
|
|
2
|
+
|
|
3
|
+
# @xylabs/react-accordion
|
|
4
|
+
|
|
5
|
+
[![npm-badge][]][npm-link]
|
|
6
|
+
[![npm-downloads-badge][]][npm-link]
|
|
7
|
+
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
|
+
[![npm-license-badge][]](LICENSE)
|
|
9
|
+
|
|
10
|
+
> XY Labs generalized React library
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- [Description](#description)
|
|
15
|
+
- [Install](#install)
|
|
16
|
+
- [Maintainers](#maintainers)
|
|
17
|
+
- [License](#license)
|
|
18
|
+
- [Credits](#credits)
|
|
19
|
+
|
|
20
|
+
## Description
|
|
21
|
+
|
|
22
|
+
Common React code that is used throughout XYO projects that use React.
|
|
23
|
+
|
|
24
|
+
## Install
|
|
25
|
+
|
|
26
|
+
Using npm:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
npm i --save @xylabs/react-accordion
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Using yarn:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
yarn add @xylabs/react-accordion
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Documentation
|
|
39
|
+
[Developer Reference](https://xylabs.github.io/sdk-react)
|
|
40
|
+
|
|
41
|
+
[Storybook](https://xylabs.github.io/sdk-react/storybook)
|
|
42
|
+
|
|
43
|
+
## Maintainers
|
|
44
|
+
|
|
45
|
+
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
46
|
+
- [Matt Jones](https://github.com/jonesmac)
|
|
47
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
48
|
+
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
See the [LICENSE](LICENSE) file for license details
|
|
53
|
+
|
|
54
|
+
## Credits
|
|
55
|
+
|
|
56
|
+
[Made with 🔥and ❄️ by XY Labs](https://xylabs.com)
|
|
57
|
+
|
|
58
|
+
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
59
|
+
|
|
60
|
+
[npm-badge]: https://img.shields.io/npm/v/@xylabs/react-accordion.svg
|
|
61
|
+
[npm-link]: https://www.npmjs.com/package/@xylabs/react-accordion
|
|
62
|
+
|
|
63
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/react-accordion
|
|
64
|
+
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/react-accordion
|
|
65
|
+
|
|
66
|
+
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/react-accordion/badge
|
|
67
|
+
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/react-accordion
|
package/package.json
CHANGED
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"packages/*"
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xylabs/react-button": "~3.0.
|
|
16
|
+
"@xylabs/react-button": "~3.0.19"
|
|
17
17
|
},
|
|
18
18
|
"description": "Common React library for all XY Labs projects that use React",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@mui/icons-material": "^5.14.
|
|
21
|
-
"@mui/material": "^5.14.
|
|
20
|
+
"@mui/icons-material": "^5.14.13",
|
|
21
|
+
"@mui/material": "^5.14.13",
|
|
22
22
|
"@storybook/react": "^7.4.6",
|
|
23
|
-
"@xylabs/react-flexbox": "~3.0.
|
|
24
|
-
"@xylabs/ts-scripts-yarn3": "^3.
|
|
25
|
-
"@xylabs/tsconfig-react": "^3.
|
|
23
|
+
"@xylabs/react-flexbox": "~3.0.19",
|
|
24
|
+
"@xylabs/ts-scripts-yarn3": "^3.1.9",
|
|
25
|
+
"@xylabs/tsconfig-react": "^3.1.9",
|
|
26
26
|
"react": "^18.2.0",
|
|
27
27
|
"react-dom": "^18.2.0",
|
|
28
28
|
"typescript": "^5.2.2"
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"url": "https://github.com/xylabs/sdk-react.git"
|
|
82
82
|
},
|
|
83
83
|
"sideEffects": false,
|
|
84
|
-
"version": "3.0.
|
|
84
|
+
"version": "3.0.19",
|
|
85
85
|
"type": "module"
|
|
86
86
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/AccordionGroup.tsx
|
|
21
|
-
var AccordionGroup_exports = {};
|
|
22
|
-
__export(AccordionGroup_exports, {
|
|
23
|
-
AccordionGroup: () => AccordionGroup,
|
|
24
|
-
SimpleAccordion: () => SimpleAccordion
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(AccordionGroup_exports);
|
|
27
|
-
var import_icons_material = require("@mui/icons-material");
|
|
28
|
-
var import_material = require("@mui/material");
|
|
29
|
-
var import_react_button = require("@xylabs/react-button");
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var AccordionGroup = ({ defaultExpandedIndex, data }) => {
|
|
33
|
-
const [expandedIndex, setExpandedIndex] = (0, import_react.useState)(defaultExpandedIndex ?? 0);
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: data?.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SimpleAccordion, { ...item, expanded: index === expandedIndex, onChange: () => setExpandedIndex(index) }, index)) });
|
|
35
|
-
};
|
|
36
|
-
var SimpleAccordion = ({ name, linkText, to, href, description, expanded, onChange, children }) => {
|
|
37
|
-
const theme = (0, import_material.useTheme)();
|
|
38
|
-
const isMobile = (0, import_material.useMediaQuery)(theme.breakpoints.down("md"));
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Accordion, { expanded, onChange: () => onChange?.(), children: [
|
|
40
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AccordionSummary, { expandIcon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExpandMoreRounded, {}), "aria-controls": "panel1bh-content", id: "panel1bh-header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h6", textAlign: "left", gutterBottom: isMobile ? true : false, children: name }) }),
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.AccordionDetails, { children: [
|
|
42
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body1", fontWeight: 400, textAlign: "left", children: description }),
|
|
43
|
-
children,
|
|
44
|
-
(href || to) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { href, to, target: href ?? "_blank", children: linkText ?? "Learn More" })
|
|
45
|
-
] })
|
|
46
|
-
] });
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=AccordionGroup.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AccordionGroup.tsx"],"sourcesContent":["import { ExpandMoreRounded } from '@mui/icons-material'\nimport { Accordion, AccordionDetails, AccordionProps, AccordionSummary, Typography, useMediaQuery, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ReactNode, useState } from 'react'\n\ntype Override<T1, T2> = Omit<T1, keyof T2> & T2\n\ninterface SimpleAccordionCardAdditionalProps extends AccordionProps {\n description?: string\n expanded?: boolean\n href?: string\n linkText?: string\n name: string\n onChange?: () => void\n to?: string\n}\n\ninterface OptionalChildren {\n children?: ReactNode\n}\n//this makes the requirement for children from AccordionProps go away\nexport type SimpleAccordionCardProps = Override<SimpleAccordionCardAdditionalProps, OptionalChildren>\n\ninterface AccordionGroupProps {\n data?: SimpleAccordionCardProps[]\n defaultExpandedIndex?: number\n}\n\nexport const AccordionGroup: React.FC<AccordionGroupProps> = ({ defaultExpandedIndex, data }) => {\n const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0)\n\n return (\n <>\n {data?.map((item, index) => (\n <SimpleAccordion key={index} {...item} expanded={index === expandedIndex} onChange={() => setExpandedIndex(index)} />\n ))}\n </>\n )\n}\nexport const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({ name, linkText, to, href, description, expanded, onChange, children }) => {\n const theme = useTheme()\n const isMobile = useMediaQuery(theme.breakpoints.down('md'))\n return (\n <Accordion expanded={expanded} onChange={() => onChange?.()}>\n <AccordionSummary expandIcon={<ExpandMoreRounded />} aria-controls=\"panel1bh-content\" id=\"panel1bh-header\">\n <Typography variant=\"h6\" textAlign=\"left\" gutterBottom={isMobile ? true : false}>\n {name}\n </Typography>\n </AccordionSummary>\n <AccordionDetails>\n {description && (\n <Typography variant=\"body1\" fontWeight={400} textAlign=\"left\">\n {description}\n </Typography>\n )}\n {children}\n {(href || to) && (\n <ButtonEx href={href} to={to} target={href ?? '_blank'}>\n {linkText ?? 'Learn More'}\n </ButtonEx>\n )}\n </AccordionDetails>\n </Accordion>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAkC;AAClC,sBAAmH;AACnH,0BAAyB;AACzB,mBAAoC;AA6BhC;AAJG,IAAM,iBAAgD,CAAC,EAAE,sBAAsB,KAAK,MAAM;AAC/F,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,wBAAwB,CAAC;AAE5E,SACE,2EACG,gBAAM,IAAI,CAAC,MAAM,UAChB,4CAAC,mBAA6B,GAAG,MAAM,UAAU,UAAU,eAAe,UAAU,MAAM,iBAAiB,KAAK,KAA1F,KAA6F,CACpH,GACH;AAEJ;AACO,IAAM,kBAAsD,CAAC,EAAE,MAAM,UAAU,IAAI,MAAM,aAAa,UAAU,UAAU,SAAS,MAAM;AAC9I,QAAM,YAAQ,0BAAS;AACvB,QAAM,eAAW,+BAAc,MAAM,YAAY,KAAK,IAAI,CAAC;AAC3D,SACE,6CAAC,6BAAU,UAAoB,UAAU,MAAM,WAAW,GACxD;AAAA,gDAAC,oCAAiB,YAAY,4CAAC,2CAAkB,GAAI,iBAAc,oBAAmB,IAAG,mBACvF,sDAAC,8BAAW,SAAQ,MAAK,WAAU,QAAO,cAAc,WAAW,OAAO,OACvE,gBACH,GACF;AAAA,IACA,6CAAC,oCACE;AAAA,qBACC,4CAAC,8BAAW,SAAQ,SAAQ,YAAY,KAAK,WAAU,QACpD,uBACH;AAAA,MAED;AAAA,OACC,QAAQ,OACR,4CAAC,gCAAS,MAAY,IAAQ,QAAQ,QAAQ,UAC3C,sBAAY,cACf;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/AccordionGroup.tsx
|
|
2
|
-
import { ExpandMoreRounded } from "@mui/icons-material";
|
|
3
|
-
import { Accordion, AccordionDetails, AccordionSummary, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
4
|
-
import { ButtonEx } from "@xylabs/react-button";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
var AccordionGroup = ({ defaultExpandedIndex, data }) => {
|
|
8
|
-
const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0);
|
|
9
|
-
return /* @__PURE__ */ jsx(Fragment, { children: data?.map((item, index) => /* @__PURE__ */ jsx(SimpleAccordion, { ...item, expanded: index === expandedIndex, onChange: () => setExpandedIndex(index) }, index)) });
|
|
10
|
-
};
|
|
11
|
-
var SimpleAccordion = ({ name, linkText, to, href, description, expanded, onChange, children }) => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
|
14
|
-
return /* @__PURE__ */ jsxs(Accordion, { expanded, onChange: () => onChange?.(), children: [
|
|
15
|
-
/* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreRounded, {}), "aria-controls": "panel1bh-content", id: "panel1bh-header", children: /* @__PURE__ */ jsx(Typography, { variant: "h6", textAlign: "left", gutterBottom: isMobile ? true : false, children: name }) }),
|
|
16
|
-
/* @__PURE__ */ jsxs(AccordionDetails, { children: [
|
|
17
|
-
description && /* @__PURE__ */ jsx(Typography, { variant: "body1", fontWeight: 400, textAlign: "left", children: description }),
|
|
18
|
-
children,
|
|
19
|
-
(href || to) && /* @__PURE__ */ jsx(ButtonEx, { href, to, target: href ?? "_blank", children: linkText ?? "Learn More" })
|
|
20
|
-
] })
|
|
21
|
-
] });
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
AccordionGroup,
|
|
25
|
-
SimpleAccordion
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=AccordionGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AccordionGroup.tsx"],"sourcesContent":["import { ExpandMoreRounded } from '@mui/icons-material'\nimport { Accordion, AccordionDetails, AccordionProps, AccordionSummary, Typography, useMediaQuery, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ReactNode, useState } from 'react'\n\ntype Override<T1, T2> = Omit<T1, keyof T2> & T2\n\ninterface SimpleAccordionCardAdditionalProps extends AccordionProps {\n description?: string\n expanded?: boolean\n href?: string\n linkText?: string\n name: string\n onChange?: () => void\n to?: string\n}\n\ninterface OptionalChildren {\n children?: ReactNode\n}\n//this makes the requirement for children from AccordionProps go away\nexport type SimpleAccordionCardProps = Override<SimpleAccordionCardAdditionalProps, OptionalChildren>\n\ninterface AccordionGroupProps {\n data?: SimpleAccordionCardProps[]\n defaultExpandedIndex?: number\n}\n\nexport const AccordionGroup: React.FC<AccordionGroupProps> = ({ defaultExpandedIndex, data }) => {\n const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0)\n\n return (\n <>\n {data?.map((item, index) => (\n <SimpleAccordion key={index} {...item} expanded={index === expandedIndex} onChange={() => setExpandedIndex(index)} />\n ))}\n </>\n )\n}\nexport const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({ name, linkText, to, href, description, expanded, onChange, children }) => {\n const theme = useTheme()\n const isMobile = useMediaQuery(theme.breakpoints.down('md'))\n return (\n <Accordion expanded={expanded} onChange={() => onChange?.()}>\n <AccordionSummary expandIcon={<ExpandMoreRounded />} aria-controls=\"panel1bh-content\" id=\"panel1bh-header\">\n <Typography variant=\"h6\" textAlign=\"left\" gutterBottom={isMobile ? true : false}>\n {name}\n </Typography>\n </AccordionSummary>\n <AccordionDetails>\n {description && (\n <Typography variant=\"body1\" fontWeight={400} textAlign=\"left\">\n {description}\n </Typography>\n )}\n {children}\n {(href || to) && (\n <ButtonEx href={href} to={to} target={href ?? '_blank'}>\n {linkText ?? 'Learn More'}\n </ButtonEx>\n )}\n </AccordionDetails>\n </Accordion>\n )\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,WAAW,kBAAkC,kBAAkB,YAAY,eAAe,gBAAgB;AACnH,SAAS,gBAAgB;AACzB,SAAoB,gBAAgB;AA6BhC,mBAEI,KAeF,YAjBF;AAJG,IAAM,iBAAgD,CAAC,EAAE,sBAAsB,KAAK,MAAM;AAC/F,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,wBAAwB,CAAC;AAE5E,SACE,gCACG,gBAAM,IAAI,CAAC,MAAM,UAChB,oBAAC,mBAA6B,GAAG,MAAM,UAAU,UAAU,eAAe,UAAU,MAAM,iBAAiB,KAAK,KAA1F,KAA6F,CACpH,GACH;AAEJ;AACO,IAAM,kBAAsD,CAAC,EAAE,MAAM,UAAU,IAAI,MAAM,aAAa,UAAU,UAAU,SAAS,MAAM;AAC9I,QAAM,QAAQ,SAAS;AACvB,QAAM,WAAW,cAAc,MAAM,YAAY,KAAK,IAAI,CAAC;AAC3D,SACE,qBAAC,aAAU,UAAoB,UAAU,MAAM,WAAW,GACxD;AAAA,wBAAC,oBAAiB,YAAY,oBAAC,qBAAkB,GAAI,iBAAc,oBAAmB,IAAG,mBACvF,8BAAC,cAAW,SAAQ,MAAK,WAAU,QAAO,cAAc,WAAW,OAAO,OACvE,gBACH,GACF;AAAA,IACA,qBAAC,oBACE;AAAA,qBACC,oBAAC,cAAW,SAAQ,SAAQ,YAAY,KAAK,WAAU,QACpD,uBACH;AAAA,MAED;AAAA,OACC,QAAQ,OACR,oBAAC,YAAS,MAAY,IAAQ,QAAQ,QAAQ,UAC3C,sBAAY,cACf;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/AccordionGroup.tsx
|
|
21
|
-
var AccordionGroup_exports = {};
|
|
22
|
-
__export(AccordionGroup_exports, {
|
|
23
|
-
AccordionGroup: () => AccordionGroup,
|
|
24
|
-
SimpleAccordion: () => SimpleAccordion
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(AccordionGroup_exports);
|
|
27
|
-
var import_icons_material = require("@mui/icons-material");
|
|
28
|
-
var import_material = require("@mui/material");
|
|
29
|
-
var import_react_button = require("@xylabs/react-button");
|
|
30
|
-
var import_react = require("react");
|
|
31
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
32
|
-
var AccordionGroup = ({ defaultExpandedIndex, data }) => {
|
|
33
|
-
const [expandedIndex, setExpandedIndex] = (0, import_react.useState)(defaultExpandedIndex ?? 0);
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: data == null ? void 0 : data.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SimpleAccordion, { ...item, expanded: index === expandedIndex, onChange: () => setExpandedIndex(index) }, index)) });
|
|
35
|
-
};
|
|
36
|
-
var SimpleAccordion = ({ name, linkText, to, href, description, expanded, onChange, children }) => {
|
|
37
|
-
const theme = (0, import_material.useTheme)();
|
|
38
|
-
const isMobile = (0, import_material.useMediaQuery)(theme.breakpoints.down("md"));
|
|
39
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.Accordion, { expanded, onChange: () => onChange == null ? void 0 : onChange(), children: [
|
|
40
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.AccordionSummary, { expandIcon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons_material.ExpandMoreRounded, {}), "aria-controls": "panel1bh-content", id: "panel1bh-header", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "h6", textAlign: "left", gutterBottom: isMobile ? true : false, children: name }) }),
|
|
41
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_material.AccordionDetails, { children: [
|
|
42
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Typography, { variant: "body1", fontWeight: 400, textAlign: "left", children: description }),
|
|
43
|
-
children,
|
|
44
|
-
(href || to) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_button.ButtonEx, { href, to, target: href ?? "_blank", children: linkText ?? "Learn More" })
|
|
45
|
-
] })
|
|
46
|
-
] });
|
|
47
|
-
};
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
AccordionGroup,
|
|
51
|
-
SimpleAccordion
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=AccordionGroup.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AccordionGroup.tsx"],"sourcesContent":["import { ExpandMoreRounded } from '@mui/icons-material'\nimport { Accordion, AccordionDetails, AccordionProps, AccordionSummary, Typography, useMediaQuery, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ReactNode, useState } from 'react'\n\ntype Override<T1, T2> = Omit<T1, keyof T2> & T2\n\ninterface SimpleAccordionCardAdditionalProps extends AccordionProps {\n description?: string\n expanded?: boolean\n href?: string\n linkText?: string\n name: string\n onChange?: () => void\n to?: string\n}\n\ninterface OptionalChildren {\n children?: ReactNode\n}\n//this makes the requirement for children from AccordionProps go away\nexport type SimpleAccordionCardProps = Override<SimpleAccordionCardAdditionalProps, OptionalChildren>\n\ninterface AccordionGroupProps {\n data?: SimpleAccordionCardProps[]\n defaultExpandedIndex?: number\n}\n\nexport const AccordionGroup: React.FC<AccordionGroupProps> = ({ defaultExpandedIndex, data }) => {\n const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0)\n\n return (\n <>\n {data?.map((item, index) => (\n <SimpleAccordion key={index} {...item} expanded={index === expandedIndex} onChange={() => setExpandedIndex(index)} />\n ))}\n </>\n )\n}\nexport const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({ name, linkText, to, href, description, expanded, onChange, children }) => {\n const theme = useTheme()\n const isMobile = useMediaQuery(theme.breakpoints.down('md'))\n return (\n <Accordion expanded={expanded} onChange={() => onChange?.()}>\n <AccordionSummary expandIcon={<ExpandMoreRounded />} aria-controls=\"panel1bh-content\" id=\"panel1bh-header\">\n <Typography variant=\"h6\" textAlign=\"left\" gutterBottom={isMobile ? true : false}>\n {name}\n </Typography>\n </AccordionSummary>\n <AccordionDetails>\n {description && (\n <Typography variant=\"body1\" fontWeight={400} textAlign=\"left\">\n {description}\n </Typography>\n )}\n {children}\n {(href || to) && (\n <ButtonEx href={href} to={to} target={href ?? '_blank'}>\n {linkText ?? 'Learn More'}\n </ButtonEx>\n )}\n </AccordionDetails>\n </Accordion>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAkC;AAClC,sBAAmH;AACnH,0BAAyB;AACzB,mBAAoC;AA6BhC;AAJG,IAAM,iBAAgD,CAAC,EAAE,sBAAsB,KAAK,MAAM;AAC/F,QAAM,CAAC,eAAe,gBAAgB,QAAI,uBAAS,wBAAwB,CAAC;AAE5E,SACE,2EACG,uCAAM,IAAI,CAAC,MAAM,UAChB,4CAAC,mBAA6B,GAAG,MAAM,UAAU,UAAU,eAAe,UAAU,MAAM,iBAAiB,KAAK,KAA1F,KAA6F,IAEvH;AAEJ;AACO,IAAM,kBAAsD,CAAC,EAAE,MAAM,UAAU,IAAI,MAAM,aAAa,UAAU,UAAU,SAAS,MAAM;AAC9I,QAAM,YAAQ,0BAAS;AACvB,QAAM,eAAW,+BAAc,MAAM,YAAY,KAAK,IAAI,CAAC;AAC3D,SACE,6CAAC,6BAAU,UAAoB,UAAU,MAAM,wCAC7C;AAAA,gDAAC,oCAAiB,YAAY,4CAAC,2CAAkB,GAAI,iBAAc,oBAAmB,IAAG,mBACvF,sDAAC,8BAAW,SAAQ,MAAK,WAAU,QAAO,cAAc,WAAW,OAAO,OACvE,gBACH,GACF;AAAA,IACA,6CAAC,oCACE;AAAA,qBACC,4CAAC,8BAAW,SAAQ,SAAQ,YAAY,KAAK,WAAU,QACpD,uBACH;AAAA,MAED;AAAA,OACC,QAAQ,OACR,4CAAC,gCAAS,MAAY,IAAQ,QAAQ,QAAQ,UAC3C,sBAAY,cACf;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
// src/AccordionGroup.tsx
|
|
2
|
-
import { ExpandMoreRounded } from "@mui/icons-material";
|
|
3
|
-
import { Accordion, AccordionDetails, AccordionSummary, Typography, useMediaQuery, useTheme } from "@mui/material";
|
|
4
|
-
import { ButtonEx } from "@xylabs/react-button";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
var AccordionGroup = ({ defaultExpandedIndex, data }) => {
|
|
8
|
-
const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0);
|
|
9
|
-
return /* @__PURE__ */ jsx(Fragment, { children: data == null ? void 0 : data.map((item, index) => /* @__PURE__ */ jsx(SimpleAccordion, { ...item, expanded: index === expandedIndex, onChange: () => setExpandedIndex(index) }, index)) });
|
|
10
|
-
};
|
|
11
|
-
var SimpleAccordion = ({ name, linkText, to, href, description, expanded, onChange, children }) => {
|
|
12
|
-
const theme = useTheme();
|
|
13
|
-
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
|
|
14
|
-
return /* @__PURE__ */ jsxs(Accordion, { expanded, onChange: () => onChange == null ? void 0 : onChange(), children: [
|
|
15
|
-
/* @__PURE__ */ jsx(AccordionSummary, { expandIcon: /* @__PURE__ */ jsx(ExpandMoreRounded, {}), "aria-controls": "panel1bh-content", id: "panel1bh-header", children: /* @__PURE__ */ jsx(Typography, { variant: "h6", textAlign: "left", gutterBottom: isMobile ? true : false, children: name }) }),
|
|
16
|
-
/* @__PURE__ */ jsxs(AccordionDetails, { children: [
|
|
17
|
-
description && /* @__PURE__ */ jsx(Typography, { variant: "body1", fontWeight: 400, textAlign: "left", children: description }),
|
|
18
|
-
children,
|
|
19
|
-
(href || to) && /* @__PURE__ */ jsx(ButtonEx, { href, to, target: href ?? "_blank", children: linkText ?? "Learn More" })
|
|
20
|
-
] })
|
|
21
|
-
] });
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
AccordionGroup,
|
|
25
|
-
SimpleAccordion
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=AccordionGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/AccordionGroup.tsx"],"sourcesContent":["import { ExpandMoreRounded } from '@mui/icons-material'\nimport { Accordion, AccordionDetails, AccordionProps, AccordionSummary, Typography, useMediaQuery, useTheme } from '@mui/material'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ReactNode, useState } from 'react'\n\ntype Override<T1, T2> = Omit<T1, keyof T2> & T2\n\ninterface SimpleAccordionCardAdditionalProps extends AccordionProps {\n description?: string\n expanded?: boolean\n href?: string\n linkText?: string\n name: string\n onChange?: () => void\n to?: string\n}\n\ninterface OptionalChildren {\n children?: ReactNode\n}\n//this makes the requirement for children from AccordionProps go away\nexport type SimpleAccordionCardProps = Override<SimpleAccordionCardAdditionalProps, OptionalChildren>\n\ninterface AccordionGroupProps {\n data?: SimpleAccordionCardProps[]\n defaultExpandedIndex?: number\n}\n\nexport const AccordionGroup: React.FC<AccordionGroupProps> = ({ defaultExpandedIndex, data }) => {\n const [expandedIndex, setExpandedIndex] = useState(defaultExpandedIndex ?? 0)\n\n return (\n <>\n {data?.map((item, index) => (\n <SimpleAccordion key={index} {...item} expanded={index === expandedIndex} onChange={() => setExpandedIndex(index)} />\n ))}\n </>\n )\n}\nexport const SimpleAccordion: React.FC<SimpleAccordionCardProps> = ({ name, linkText, to, href, description, expanded, onChange, children }) => {\n const theme = useTheme()\n const isMobile = useMediaQuery(theme.breakpoints.down('md'))\n return (\n <Accordion expanded={expanded} onChange={() => onChange?.()}>\n <AccordionSummary expandIcon={<ExpandMoreRounded />} aria-controls=\"panel1bh-content\" id=\"panel1bh-header\">\n <Typography variant=\"h6\" textAlign=\"left\" gutterBottom={isMobile ? true : false}>\n {name}\n </Typography>\n </AccordionSummary>\n <AccordionDetails>\n {description && (\n <Typography variant=\"body1\" fontWeight={400} textAlign=\"left\">\n {description}\n </Typography>\n )}\n {children}\n {(href || to) && (\n <ButtonEx href={href} to={to} target={href ?? '_blank'}>\n {linkText ?? 'Learn More'}\n </ButtonEx>\n )}\n </AccordionDetails>\n </Accordion>\n )\n}\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,WAAW,kBAAkC,kBAAkB,YAAY,eAAe,gBAAgB;AACnH,SAAS,gBAAgB;AACzB,SAAoB,gBAAgB;AA6BhC,mBAEI,KAeF,YAjBF;AAJG,IAAM,iBAAgD,CAAC,EAAE,sBAAsB,KAAK,MAAM;AAC/F,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,wBAAwB,CAAC;AAE5E,SACE,gCACG,uCAAM,IAAI,CAAC,MAAM,UAChB,oBAAC,mBAA6B,GAAG,MAAM,UAAU,UAAU,eAAe,UAAU,MAAM,iBAAiB,KAAK,KAA1F,KAA6F,IAEvH;AAEJ;AACO,IAAM,kBAAsD,CAAC,EAAE,MAAM,UAAU,IAAI,MAAM,aAAa,UAAU,UAAU,SAAS,MAAM;AAC9I,QAAM,QAAQ,SAAS;AACvB,QAAM,WAAW,cAAc,MAAM,YAAY,KAAK,IAAI,CAAC;AAC3D,SACE,qBAAC,aAAU,UAAoB,UAAU,MAAM,wCAC7C;AAAA,wBAAC,oBAAiB,YAAY,oBAAC,qBAAkB,GAAI,iBAAc,oBAAmB,IAAG,mBACvF,8BAAC,cAAW,SAAQ,MAAK,WAAU,QAAO,cAAc,WAAW,OAAO,OACvE,gBACH,GACF;AAAA,IACA,qBAAC,oBACE;AAAA,qBACC,oBAAC,cAAW,SAAQ,SAAQ,YAAY,KAAK,WAAU,QACpD,uBACH;AAAA,MAED;AAAA,OACC,QAAQ,OACR,oBAAC,YAAS,MAAY,IAAQ,QAAQ,QAAQ,UAC3C,sBAAY,cACf;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|