@phillips/seldon 1.38.4 → 1.38.5
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/Accordion/Accordion.d.ts +17 -0
- package/dist/components/Accordion/Accordion.js +13 -12
- package/dist/components/Accordion/types.d.ts +6 -0
- package/dist/components/Accordion/types.js +4 -0
- package/dist/components/Accordion/utils.d.ts +17 -0
- package/dist/components/Accordion/utils.js +8 -0
- package/package.json +1 -1
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
import { AccordionVariantKey } from './types';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
4
|
/**
|
|
4
5
|
* Unique id for component testing
|
|
5
6
|
*/
|
|
6
7
|
id?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Determines the Accordion variant to use. `multiple` allows multiple elements to be opened at the same time.
|
|
10
|
+
* The `single` variants only allow one element opened at a time.
|
|
11
|
+
* `singleCollapsible` allows users to close an open element by clicking on it, while `singleNonCollapsible` does not.
|
|
12
|
+
* Defaults to `multiple`.
|
|
13
|
+
*/
|
|
14
|
+
variant?: AccordionVariantKey;
|
|
7
15
|
/**
|
|
8
16
|
* Child element pass in to display as item content.
|
|
9
17
|
*/
|
|
10
18
|
children?: React.ReactNode;
|
|
11
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* ## Overview
|
|
22
|
+
*
|
|
23
|
+
* Overview of this component
|
|
24
|
+
*
|
|
25
|
+
* [Figma Link](https://www.figma.com/design/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?node-id=4433-163013&t=lhB2YjBptvQ97UWF-0)
|
|
26
|
+
*
|
|
27
|
+
* [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-accordion--overview)
|
|
28
|
+
*/
|
|
12
29
|
declare const AccordionComponent: ({ className, children, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
30
|
export default AccordionComponent;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { getCommonProps as
|
|
4
|
-
import { Root as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import c from "../../node_modules/classnames/index.js";
|
|
3
|
+
import { getCommonProps as i } from "../../utils/index.js";
|
|
4
|
+
import { Root as e } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
|
|
5
|
+
import { getAccordionVariantProps as d } from "./utils.js";
|
|
6
|
+
const N = ({ className: m, children: t, ...o }) => {
|
|
7
|
+
const { className: a, ...r } = i(o, "Accordion"), n = d(o.variant);
|
|
8
|
+
return /* @__PURE__ */ s(
|
|
9
|
+
e,
|
|
9
10
|
{
|
|
10
|
-
className:
|
|
11
|
-
|
|
12
|
-
...
|
|
11
|
+
className: c(`${a}`, m),
|
|
12
|
+
...r,
|
|
13
|
+
...n,
|
|
13
14
|
id: o == null ? void 0 : o.id,
|
|
14
15
|
children: t
|
|
15
16
|
}
|
|
16
17
|
);
|
|
17
18
|
};
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
+
N as default
|
|
20
21
|
};
|
|
@@ -41,3 +41,9 @@ export interface AccordionContentType {
|
|
|
41
41
|
isLargeVariation: boolean;
|
|
42
42
|
isCollapsed: boolean;
|
|
43
43
|
}
|
|
44
|
+
export declare enum AccordionVariants {
|
|
45
|
+
multiple = "multiple",
|
|
46
|
+
singleCollapsible = "singleCollapsible",
|
|
47
|
+
singleNonCollapsible = "singleNonCollapsible"
|
|
48
|
+
}
|
|
49
|
+
export type AccordionVariantKey = keyof typeof AccordionVariants;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AccordionVariantKey } from './types';
|
|
2
|
+
export interface AccordionVariantProps {
|
|
3
|
+
/**
|
|
4
|
+
* Determines whether multiple elements can be opened at the same time or not.
|
|
5
|
+
*/
|
|
6
|
+
type: 'single' | 'multiple';
|
|
7
|
+
/**
|
|
8
|
+
* Determines if an open element can be closed by clicking on it.
|
|
9
|
+
* Only applicable to the `single` variants.
|
|
10
|
+
*/
|
|
11
|
+
collapsible?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Sets the type and collapsible props based on the variant prop
|
|
15
|
+
* The collapsible prop should only be passed when the variant is single
|
|
16
|
+
*/
|
|
17
|
+
export declare const getAccordionVariantProps: (variant?: AccordionVariantKey) => AccordionVariantProps;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AccordionVariants as i } from "./types.js";
|
|
2
|
+
const s = (e) => {
|
|
3
|
+
const l = { type: "multiple" };
|
|
4
|
+
return e === i.singleCollapsible && (l.type = "single", l.collapsible = !0), e === i.singleNonCollapsible && (l.type = "single", l.collapsible = !1), l;
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
s as getAccordionVariantProps
|
|
8
|
+
};
|