@coopdigital/react 0.14.0 → 0.15.0
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/Expandable/Expandable.d.ts +15 -0
- package/dist/components/Expandable/Expandable.js +14 -0
- package/dist/components/Expandable/index.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +3 -3
- package/src/components/Expandable/Expandable.tsx +48 -0
- package/src/components/Expandable/index.ts +5 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DetailsHTMLAttributes, JSX } from "react";
|
|
2
|
+
export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
3
|
+
/** **(Optional)** Specifies the Expandable background color from the available options. */
|
|
4
|
+
background?: "grey" | "purple" | "pink" | "green" | "orange" | "red" | "yellow" | "lilac" | "blue";
|
|
5
|
+
/** Represents the content inside the Expandable component, only visible when expanded. It can be any valid JSX or string. */
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/** Specifies summary for this component. It can be any valid JSX or string. */
|
|
8
|
+
summary: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
12
|
+
* It can be used to reveal more context for a specific issue or action.
|
|
13
|
+
*/
|
|
14
|
+
export declare const Expandable: ({ background, children, className, summary, ...props }: ExpandableProps) => JSX.Element;
|
|
15
|
+
export default Expandable;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __rest } from '../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
6
|
+
* It can be used to reveal more context for a specific issue or action.
|
|
7
|
+
*/
|
|
8
|
+
const Expandable = (_a) => {
|
|
9
|
+
var { background, children, className, summary } = _a, props = __rest(_a, ["background", "children", "className", "summary"]);
|
|
10
|
+
const componentProps = Object.assign({ className: `coop-expandable ${className}`, "data-bg": background }, props);
|
|
11
|
+
return (jsxs("details", Object.assign({}, componentProps, { children: [jsxs("summary", { children: [summary, jsx("svg", { fill: "none", height: "24", width: "24", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "m20.25 9.75-6.22 6.22a.75.75 0 0 1-1.06 0L6.75 9.75", stroke: "black", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5" }) })] }), jsx("div", { className: "coop-expandable--content", children: children })] })));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { Expandable, Expandable as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./components/AlertBanner";
|
|
|
2
2
|
export * from "./components/Author";
|
|
3
3
|
export * from "./components/Button";
|
|
4
4
|
export * from "./components/Card";
|
|
5
|
+
export * from "./components/Expandable";
|
|
5
6
|
export * from "./components/Image";
|
|
6
7
|
export * from "./components/Pill";
|
|
7
8
|
export * from "./components/RootSVG";
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export { AlertBanner } from './components/AlertBanner/AlertBanner.js';
|
|
|
2
2
|
export { Author } from './components/Author/Author.js';
|
|
3
3
|
export { Button } from './components/Button/Button.js';
|
|
4
4
|
export { Card } from './components/Card/Card.js';
|
|
5
|
+
export { Expandable } from './components/Expandable/Expandable.js';
|
|
5
6
|
export { Image } from './components/Image/Image.js';
|
|
6
7
|
export { Pill } from './components/Pill/Pill.js';
|
|
7
8
|
export { default as RootSVG } from './components/RootSVG/RootSVG.js';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coopdigital/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.15.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"description": "",
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@axe-core/playwright": "^4.10.1",
|
|
47
|
-
"@coopdigital/styles": "^0.
|
|
47
|
+
"@coopdigital/styles": "^0.14.0",
|
|
48
48
|
"@playwright/test": "^1.51.1",
|
|
49
49
|
"@storybook/addon-a11y": "^8.6.12",
|
|
50
50
|
"@storybook/addon-essentials": "^8.6.12",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"react": "^19.0.0",
|
|
67
67
|
"react-dom": "^19.0.0"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "86b6861deb12d0f826dfd719fb28a754fda81cbd"
|
|
70
70
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DetailsHTMLAttributes, JSX } from "react"
|
|
2
|
+
|
|
3
|
+
export interface ExpandableProps extends DetailsHTMLAttributes<HTMLDetailsElement> {
|
|
4
|
+
/** **(Optional)** Specifies the Expandable background color from the available options. */
|
|
5
|
+
background?: "grey" | "purple" | "pink" | "green" | "orange" | "red" | "yellow" | "lilac" | "blue"
|
|
6
|
+
/** Represents the content inside the Expandable component, only visible when expanded. It can be any valid JSX or string. */
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
/** Specifies summary for this component. It can be any valid JSX or string. */
|
|
9
|
+
summary: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The Expandable component wraps content in an expandable block using the details/summary HTML elements.
|
|
14
|
+
* It can be used to reveal more context for a specific issue or action.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const Expandable = ({
|
|
18
|
+
background,
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
summary,
|
|
22
|
+
...props
|
|
23
|
+
}: ExpandableProps): JSX.Element => {
|
|
24
|
+
const componentProps = {
|
|
25
|
+
className: `coop-expandable ${className}`,
|
|
26
|
+
"data-bg": background,
|
|
27
|
+
...props,
|
|
28
|
+
}
|
|
29
|
+
return (
|
|
30
|
+
<details {...componentProps}>
|
|
31
|
+
<summary>
|
|
32
|
+
{summary}
|
|
33
|
+
<svg fill="none" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
|
|
34
|
+
<path
|
|
35
|
+
d="m20.25 9.75-6.22 6.22a.75.75 0 0 1-1.06 0L6.75 9.75"
|
|
36
|
+
stroke="black"
|
|
37
|
+
strokeLinecap="round"
|
|
38
|
+
strokeLinejoin="round"
|
|
39
|
+
strokeWidth="1.5"
|
|
40
|
+
/>
|
|
41
|
+
</svg>
|
|
42
|
+
</summary>
|
|
43
|
+
<div className="coop-expandable--content">{children}</div>
|
|
44
|
+
</details>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default Expandable
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from "./components/AlertBanner"
|
|
|
2
2
|
export * from "./components/Author"
|
|
3
3
|
export * from "./components/Button"
|
|
4
4
|
export * from "./components/Card"
|
|
5
|
+
export * from "./components/Expandable"
|
|
5
6
|
export * from "./components/Image"
|
|
6
7
|
export * from "./components/Pill"
|
|
7
8
|
export * from "./components/RootSVG"
|