ag-common 0.0.471 → 0.0.472
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const Accordion: ({ title, children, open, setOpen, chevronColour, className, }: {
|
|
3
|
+
children: string | JSX.Element | JSX.Element[];
|
|
4
|
+
title: string;
|
|
5
|
+
/** controlled component if provided */
|
|
6
|
+
open?: boolean | undefined;
|
|
7
|
+
/** called when openness changes */
|
|
8
|
+
setOpen?: ((open: boolean) => void) | undefined;
|
|
9
|
+
chevronColour?: string | undefined;
|
|
10
|
+
className?: string | undefined;
|
|
11
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.Accordion = void 0;
|
|
30
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
31
|
+
const react_1 = __importStar(require("react"));
|
|
32
|
+
const Chevron_1 = require("../Chevron");
|
|
33
|
+
const SBase = styled_1.default.div ``;
|
|
34
|
+
const SSubTitle = styled_1.default.div `
|
|
35
|
+
font-size: 1rem;
|
|
36
|
+
font-weight: bold;
|
|
37
|
+
text-align: center;
|
|
38
|
+
margin-right: 0.5rem;
|
|
39
|
+
`;
|
|
40
|
+
const SRollUpRow = styled_1.default.div `
|
|
41
|
+
display: flex;
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
`;
|
|
44
|
+
const Accordion = ({ title, children, open, setOpen, chevronColour = 'white', className, }) => {
|
|
45
|
+
const [openSt, setOpenSt] = (0, react_1.useState)(false);
|
|
46
|
+
const controlled = open !== undefined;
|
|
47
|
+
return (react_1.default.createElement(SBase, { className: className },
|
|
48
|
+
react_1.default.createElement(SRollUpRow, { onClick: () => {
|
|
49
|
+
setOpen === null || setOpen === void 0 ? void 0 : setOpen(controlled ? !open : !openSt);
|
|
50
|
+
if (!controlled) {
|
|
51
|
+
setOpenSt(!openSt);
|
|
52
|
+
}
|
|
53
|
+
} },
|
|
54
|
+
react_1.default.createElement(SSubTitle, null, title),
|
|
55
|
+
react_1.default.createElement(Chevron_1.Chevron, { point: openSt ? 'up' : 'down', colour: chevronColour })),
|
|
56
|
+
(controlled ? open : openSt) && children));
|
|
57
|
+
};
|
|
58
|
+
exports.Accordion = Accordion;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./Accordion"), exports);
|
|
17
18
|
__exportStar(require("./BorderGradient"), exports);
|
|
18
19
|
__exportStar(require("./Button"), exports);
|
|
19
20
|
__exportStar(require("./Chevron"), exports);
|
package/package.json
CHANGED