@purr-react-styled-components/components.collapse 0.0.3 → 0.0.4
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/package.json +9 -7
- package/dist/_components/_expand-icon.d.ts +0 -4
- package/dist/_components/_item-header.d.ts +0 -4
- package/dist/_components/_item.d.ts +0 -4
- package/dist/_components/index.d.ts +0 -4
- package/dist/_styles.d.ts +0 -17
- package/dist/_types.d.ts +0 -55
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -129
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.collapse",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"react": "*",
|
|
26
26
|
"styled-components": "*",
|
|
27
27
|
"clsx": "*",
|
|
28
|
-
"@purr-core/utils.definitions": "0.0.
|
|
29
|
-
"@purr-react-styled-components/
|
|
30
|
-
"@purr-react-styled-components/components.
|
|
31
|
-
"@purr-react-styled-components/components.
|
|
32
|
-
"@purr-react-styled-components/
|
|
28
|
+
"@purr-core/utils.definitions": "0.0.11",
|
|
29
|
+
"@purr-react-styled-components/components.icon": "0.0.8",
|
|
30
|
+
"@purr-react-styled-components/components.typography": "0.0.9",
|
|
31
|
+
"@purr-react-styled-components/components.divider": "0.0.4",
|
|
32
|
+
"@purr-react-styled-components/utils.helpers": "0.0.7"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@purr-react-styled-components/components.flex-box": "0.0.
|
|
35
|
+
"@purr-react-styled-components/components.flex-box": "0.0.9"
|
|
36
36
|
},
|
|
37
37
|
"author": "@DinhThienPhuc",
|
|
38
38
|
"license": "ISC",
|
|
@@ -41,6 +41,8 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"dev": "vite build --watch",
|
|
43
43
|
"build": "tsc && vite build",
|
|
44
|
+
"build:vite": "tsc && vite build",
|
|
45
|
+
"build:tsup": "tsup",
|
|
44
46
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
45
47
|
}
|
|
46
48
|
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ICollapseItemExpandIconProps } from '../_types';
|
|
3
|
-
|
|
4
|
-
export declare const CollapseItemExpandIcon: React.MemoExoticComponent<({ expandIcon, isExpanded, htmlAttributes, showExpandIcon, }: ICollapseItemExpandIconProps) => React.JSX.Element | null>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ICollapseItemHeaderProps } from '../_types';
|
|
3
|
-
|
|
4
|
-
export declare const CollapseItemHeader: React.MemoExoticComponent<({ label, preIcon, postIcon, expandIcon, isExpanded, isOnlyOneExpand, id, showExpandIcon, expandIconHtmlAttributes, htmlAttributes, labelHtmlAttributes, setItemDictionary, }: ICollapseItemHeaderProps) => React.JSX.Element>;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
|
-
import { ICollapseItemProps } from '../_types';
|
|
3
|
-
|
|
4
|
-
export declare const CollapseItem: React.MemoExoticComponent<({ id, label, body, preIcon, postIcon, expandIcon, disabled, bodyHtmlAttributes, htmlAttributes, expandIconHtmlAttributes, itemHeaderHtmlAttributes, itemHeaderLabelHtmlAttributes, isExpanded, isOnlyOneExpand, showExpandIcon, setItemDictionary, }: ICollapseItemProps) => React.JSX.Element>;
|
package/dist/_styles.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const Styled: {
|
|
2
|
-
Container: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
-
ItemContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
4
|
-
$disabled?: boolean;
|
|
5
|
-
}>> & string;
|
|
6
|
-
ItemHeader: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {
|
|
7
|
-
$isExpanded: boolean;
|
|
8
|
-
}>> & string;
|
|
9
|
-
ItemHeaderSection: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
10
|
-
ItemHeaderSectionGroup: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
11
|
-
ItemHeaderExpandIcon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
12
|
-
$isExpanded: boolean;
|
|
13
|
-
}>> & string;
|
|
14
|
-
ItemContent: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
15
|
-
$isExpanded: boolean;
|
|
16
|
-
}>> & string;
|
|
17
|
-
};
|
package/dist/_types.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { ButtonHTMLAttributes, Dispatch, HTMLAttributes, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { IExtendable } from '@purr-core/utils.definitions';
|
|
3
|
-
|
|
4
|
-
export type TItemDictionary = Record<string, boolean>;
|
|
5
|
-
export interface ICollapseItem {
|
|
6
|
-
id: string;
|
|
7
|
-
label: string;
|
|
8
|
-
body: ReactNode;
|
|
9
|
-
preIcon?: ReactNode;
|
|
10
|
-
postIcon?: ReactNode;
|
|
11
|
-
expandIcon?: ReactNode;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
bodyHtmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
14
|
-
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
15
|
-
expandIconHtmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
16
|
-
itemHeaderHtmlAttributes?: ButtonHTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
17
|
-
itemHeaderLabelHtmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
18
|
-
showExpandIcon?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface ICollapseItemProps extends ICollapseItem {
|
|
21
|
-
isExpanded: boolean;
|
|
22
|
-
isOnlyOneExpand: boolean;
|
|
23
|
-
setItemDictionary: Dispatch<SetStateAction<TItemDictionary>>;
|
|
24
|
-
}
|
|
25
|
-
export interface ICollapseProps {
|
|
26
|
-
items?: ICollapseItem[];
|
|
27
|
-
className?: string;
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
preIcon?: ReactNode;
|
|
30
|
-
postIcon?: ReactNode;
|
|
31
|
-
expandIcon?: ReactNode;
|
|
32
|
-
expandIds?: string[];
|
|
33
|
-
isOnlyOneExpand?: boolean;
|
|
34
|
-
htmlAttributes?: HTMLAttributes<HTMLDivElement> & IExtendable;
|
|
35
|
-
}
|
|
36
|
-
export interface ICollapseItemExpandIconProps {
|
|
37
|
-
expandIcon?: ReactNode;
|
|
38
|
-
isExpanded: boolean;
|
|
39
|
-
htmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
40
|
-
showExpandIcon?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export interface ICollapseItemHeaderProps {
|
|
43
|
-
label: string;
|
|
44
|
-
preIcon?: ReactNode;
|
|
45
|
-
postIcon?: ReactNode;
|
|
46
|
-
expandIcon?: ReactNode;
|
|
47
|
-
isExpanded: boolean;
|
|
48
|
-
isOnlyOneExpand: boolean;
|
|
49
|
-
id: string;
|
|
50
|
-
showExpandIcon?: boolean;
|
|
51
|
-
expandIconHtmlAttributes?: HTMLAttributes<HTMLSpanElement> & IExtendable;
|
|
52
|
-
htmlAttributes?: HTMLAttributes<HTMLButtonElement> & IExtendable;
|
|
53
|
-
labelHtmlAttributes?: HTMLAttributes<HTMLElement> & IExtendable;
|
|
54
|
-
setItemDictionary: Dispatch<SetStateAction<TItemDictionary>>;
|
|
55
|
-
}
|
package/dist/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),y=require("clsx"),h=require("react"),N=require("@purr-react-styled-components/components.divider"),n=require("styled-components"),z=require("@purr-react-styled-components/utils.helpers"),A=require("@purr-react-styled-components/components.typography"),S=require("@purr-react-styled-components/components.icon"),r={Container:n.div.withConfig({displayName:"_styles__Container",componentId:"sc-ob6zrz-0"})(["border:1px solid #d9d9d9;border-radius:8px;overflow:hidden;"]),ItemContainer:n.div.withConfig({displayName:"_styles__ItemContainer",componentId:"sc-ob6zrz-1"})(["transition:margin 150ms ease-in-out;width:100%;will-change:margin;&:first-of-type{margin-top:0px;}&:last-of-type{margin-bottom:0px;}",";"],({$disabled:t})=>t?n.css(["opacity:0.3;pointer-events:none;cursor:not-allowed;"]):n.css(["cursor:pointer;"])),ItemHeader:n.button.withConfig({displayName:"_styles__ItemHeader",componentId:"sc-ob6zrz-2"})(["display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0px 16px;width:100%;height:46px;border-bottom:1px solid ",";background-color:#00000005;",""],({$isExpanded:t})=>t?"#d9d9d9":"transparent",z.getInvisibleButton),ItemHeaderSection:n.span.withConfig({displayName:"_styles__ItemHeaderSection",componentId:"sc-ob6zrz-3"})(["display:flex;align-items:center;gap:16px;"]),ItemHeaderSectionGroup:n.span.withConfig({displayName:"_styles__ItemHeaderSectionGroup",componentId:"sc-ob6zrz-4"})(["display:flex;justify-content:space-between;flex-grow:1;"]),ItemHeaderExpandIcon:n.span.withConfig({displayName:"_styles__ItemHeaderExpandIcon",componentId:"sc-ob6zrz-5"})(["display:flex;transition:all 250ms ease-in-out;transform:",";"],({$isExpanded:t})=>t?"rotate(180deg)":"none"),ItemContent:n.div.withConfig({displayName:"_styles__ItemContent",componentId:"sc-ob6zrz-6"})(["transition:max-height 150ms ease-in-out,opacity 150ms ease-in-out,padding-top 150ms ease-in-out,padding-bottom 150ms ease-in-out;padding-left:16px;padding-right:16px;overflow:hidden;will-change:max-height,opacity,padding-top,padding-bottom;",";"],({$isExpanded:t})=>t?n.css(["max-height:200vh;padding-top:16px;padding-bottom:16px;opacity:1;"]):n.css(["max-height:0px;padding-top:0px;padding-bottom:0px;opacity:0;"]))},H=h.memo(({expandIcon:t,isExpanded:i,htmlAttributes:l,showExpandIcon:a})=>(console.log("showExpandIcon",a),a?o.jsx(r.ItemHeaderExpandIcon,{...l,$isExpanded:i,className:"collapse-item__header__right__expand-icon",children:t??o.jsx(S.Icon,{name:"chevron-down",width:14,height:14})}):null));H.displayName="CollapseItemExpandIcon";const C=h.memo(({label:t,preIcon:i,postIcon:l,expandIcon:a,isExpanded:c,isOnlyOneExpand:x,id:p,showExpandIcon:b,expandIconHtmlAttributes:g,htmlAttributes:I,labelHtmlAttributes:m,setItemDictionary:e})=>{const s=u=>()=>{e(x?d=>({...Object.keys(d).reduce((f,j)=>(f[j]=!1,f),{}),[u]:!d[u]}):d=>({...d,[u]:!d[u]}))},_=h.useMemo(()=>o.jsxs(r.ItemHeaderSectionGroup,{children:[o.jsxs(r.ItemHeaderSection,{className:"collapse-item__header__left",children:[i,o.jsx(A.Typography,{className:"collapse-item__header-label",htmlAttributes:m,children:t})]}),o.jsx(r.ItemHeaderSection,{className:"collapse-item__header__right",children:l})]}),[t,m,l,i]);return o.jsxs(r.ItemHeader,{...I,$isExpanded:c,className:"collapse-item__header",onClick:s(p),children:[o.jsx(H,{htmlAttributes:g,expandIcon:a,isExpanded:c,showExpandIcon:b}),_]})});C.displayName="CollapseItemHeader";const w=h.memo(({id:t,label:i,body:l,preIcon:a,postIcon:c,expandIcon:x,disabled:p,bodyHtmlAttributes:b,htmlAttributes:g,expandIconHtmlAttributes:I,itemHeaderHtmlAttributes:m,itemHeaderLabelHtmlAttributes:e,isExpanded:s,isOnlyOneExpand:_,showExpandIcon:u,setItemDictionary:d})=>o.jsxs(r.ItemContainer,{...g,$disabled:p,className:y("collapse-item",s&&"collapse-item--isExpanded",p&&"collapse-item--disabled"),children:[o.jsx(C,{label:i,preIcon:a,postIcon:c,expandIcon:x,isExpanded:s,isOnlyOneExpand:_,id:t,showExpandIcon:u,expandIconHtmlAttributes:I,htmlAttributes:m,labelHtmlAttributes:e,setItemDictionary:d}),o.jsx(r.ItemContent,{...b,$isExpanded:s,className:y("collapse-item__content",s&&"collapse-item__content--isExpanded"),children:l})]}));w.displayName="CollapseItem";const v=({items:t,className:i,isOnlyOneExpand:l=!1,expandIds:a,preIcon:c=null,postIcon:x=null,expandIcon:p=null,disabled:b=!1,htmlAttributes:g})=>{const[I,m]=h.useState(()=>a?a.reduce((e,s)=>(e[s]=!0,e),{}):{});return o.jsx(r.Container,{...g,className:y("collapse",i),children:t==null?void 0:t.map((e,s)=>o.jsxs(h.Fragment,{children:[!!s&&o.jsx(N.Divider,{color:"#d9d9d9",className:"collapse-divider"}),o.jsx(w,{id:e.id,label:e.label,body:e.body,preIcon:c??e.preIcon,postIcon:x??e.postIcon,expandIcon:p??e.expandIcon,disabled:b||e.disabled,bodyHtmlAttributes:e.bodyHtmlAttributes,htmlAttributes:e.htmlAttributes,expandIconHtmlAttributes:e.expandIconHtmlAttributes,itemHeaderHtmlAttributes:e.itemHeaderHtmlAttributes,itemHeaderLabelHtmlAttributes:e.itemHeaderLabelHtmlAttributes,isExpanded:e.id?!!I[e.id]:!1,showExpandIcon:e.showExpandIcon??!0,isOnlyOneExpand:l,setItemDictionary:m})]},e.id))})};exports.Collapse=v;
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { jsx as n, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import f from "clsx";
|
|
3
|
-
import { memo as H, useMemo as S, useState as v, Fragment as E } from "react";
|
|
4
|
-
import { Divider as j } from "@purr-react-styled-components/components.divider";
|
|
5
|
-
import d, { css as _ } from "styled-components";
|
|
6
|
-
import { getInvisibleButton as k } from "@purr-react-styled-components/utils.helpers";
|
|
7
|
-
import { Typography as $ } from "@purr-react-styled-components/components.typography";
|
|
8
|
-
import { Icon as G } from "@purr-react-styled-components/components.icon";
|
|
9
|
-
const s = {
|
|
10
|
-
Container: d.div.withConfig({
|
|
11
|
-
displayName: "_styles__Container",
|
|
12
|
-
componentId: "sc-ob6zrz-0"
|
|
13
|
-
})(["border:1px solid #d9d9d9;border-radius:8px;overflow:hidden;"]),
|
|
14
|
-
ItemContainer: d.div.withConfig({
|
|
15
|
-
displayName: "_styles__ItemContainer",
|
|
16
|
-
componentId: "sc-ob6zrz-1"
|
|
17
|
-
})(["transition:margin 150ms ease-in-out;width:100%;will-change:margin;&:first-of-type{margin-top:0px;}&:last-of-type{margin-bottom:0px;}", ";"], ({
|
|
18
|
-
$disabled: t
|
|
19
|
-
}) => t ? _(["opacity:0.3;pointer-events:none;cursor:not-allowed;"]) : _(["cursor:pointer;"])),
|
|
20
|
-
ItemHeader: d.button.withConfig({
|
|
21
|
-
displayName: "_styles__ItemHeader",
|
|
22
|
-
componentId: "sc-ob6zrz-2"
|
|
23
|
-
})(["display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0px 16px;width:100%;height:46px;border-bottom:1px solid ", ";background-color:#00000005;", ""], ({
|
|
24
|
-
$isExpanded: t
|
|
25
|
-
}) => t ? "#d9d9d9" : "transparent", k),
|
|
26
|
-
ItemHeaderSection: d.span.withConfig({
|
|
27
|
-
displayName: "_styles__ItemHeaderSection",
|
|
28
|
-
componentId: "sc-ob6zrz-3"
|
|
29
|
-
})(["display:flex;align-items:center;gap:16px;"]),
|
|
30
|
-
ItemHeaderSectionGroup: d.span.withConfig({
|
|
31
|
-
displayName: "_styles__ItemHeaderSectionGroup",
|
|
32
|
-
componentId: "sc-ob6zrz-4"
|
|
33
|
-
})(["display:flex;justify-content:space-between;flex-grow:1;"]),
|
|
34
|
-
ItemHeaderExpandIcon: d.span.withConfig({
|
|
35
|
-
displayName: "_styles__ItemHeaderExpandIcon",
|
|
36
|
-
componentId: "sc-ob6zrz-5"
|
|
37
|
-
})(["display:flex;transition:all 250ms ease-in-out;transform:", ";"], ({
|
|
38
|
-
$isExpanded: t
|
|
39
|
-
}) => t ? "rotate(180deg)" : "none"),
|
|
40
|
-
ItemContent: d.div.withConfig({
|
|
41
|
-
displayName: "_styles__ItemContent",
|
|
42
|
-
componentId: "sc-ob6zrz-6"
|
|
43
|
-
})(["transition:max-height 150ms ease-in-out,opacity 150ms ease-in-out,padding-top 150ms ease-in-out,padding-bottom 150ms ease-in-out;padding-left:16px;padding-right:16px;overflow:hidden;will-change:max-height,opacity,padding-top,padding-bottom;", ";"], ({
|
|
44
|
-
$isExpanded: t
|
|
45
|
-
}) => t ? _(["max-height:200vh;padding-top:16px;padding-bottom:16px;opacity:1;"]) : _(["max-height:0px;padding-top:0px;padding-bottom:0px;opacity:0;"]))
|
|
46
|
-
}, w = H(({
|
|
47
|
-
expandIcon: t,
|
|
48
|
-
isExpanded: i,
|
|
49
|
-
htmlAttributes: l,
|
|
50
|
-
showExpandIcon: a
|
|
51
|
-
}) => (console.log("showExpandIcon", a), a ? /* @__PURE__ */ n(s.ItemHeaderExpandIcon, { ...l, $isExpanded: i, className: "collapse-item__header__right__expand-icon", children: t ?? /* @__PURE__ */ n(G, { name: "chevron-down", width: 14, height: 14 }) }) : null));
|
|
52
|
-
w.displayName = "CollapseItemExpandIcon";
|
|
53
|
-
const N = H(({
|
|
54
|
-
label: t,
|
|
55
|
-
preIcon: i,
|
|
56
|
-
postIcon: l,
|
|
57
|
-
expandIcon: a,
|
|
58
|
-
isExpanded: p,
|
|
59
|
-
isOnlyOneExpand: u,
|
|
60
|
-
id: m,
|
|
61
|
-
showExpandIcon: b,
|
|
62
|
-
expandIconHtmlAttributes: I,
|
|
63
|
-
htmlAttributes: g,
|
|
64
|
-
labelHtmlAttributes: c,
|
|
65
|
-
setItemDictionary: e
|
|
66
|
-
}) => {
|
|
67
|
-
const o = (h) => () => {
|
|
68
|
-
e(u ? (r) => ({
|
|
69
|
-
...Object.keys(r).reduce((C, A) => (C[A] = !1, C), {}),
|
|
70
|
-
[h]: !r[h]
|
|
71
|
-
}) : (r) => ({
|
|
72
|
-
...r,
|
|
73
|
-
[h]: !r[h]
|
|
74
|
-
}));
|
|
75
|
-
}, y = S(() => /* @__PURE__ */ x(s.ItemHeaderSectionGroup, { children: [
|
|
76
|
-
/* @__PURE__ */ x(s.ItemHeaderSection, { className: "collapse-item__header__left", children: [
|
|
77
|
-
i,
|
|
78
|
-
/* @__PURE__ */ n($, { className: "collapse-item__header-label", htmlAttributes: c, children: t })
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ n(s.ItemHeaderSection, { className: "collapse-item__header__right", children: l })
|
|
81
|
-
] }), [t, c, l, i]);
|
|
82
|
-
return /* @__PURE__ */ x(s.ItemHeader, { ...g, $isExpanded: p, className: "collapse-item__header", onClick: o(m), children: [
|
|
83
|
-
/* @__PURE__ */ n(w, { htmlAttributes: I, expandIcon: a, isExpanded: p, showExpandIcon: b }),
|
|
84
|
-
y
|
|
85
|
-
] });
|
|
86
|
-
});
|
|
87
|
-
N.displayName = "CollapseItemHeader";
|
|
88
|
-
const z = H(({
|
|
89
|
-
id: t,
|
|
90
|
-
label: i,
|
|
91
|
-
body: l,
|
|
92
|
-
preIcon: a,
|
|
93
|
-
postIcon: p,
|
|
94
|
-
expandIcon: u,
|
|
95
|
-
disabled: m,
|
|
96
|
-
bodyHtmlAttributes: b,
|
|
97
|
-
htmlAttributes: I,
|
|
98
|
-
expandIconHtmlAttributes: g,
|
|
99
|
-
itemHeaderHtmlAttributes: c,
|
|
100
|
-
itemHeaderLabelHtmlAttributes: e,
|
|
101
|
-
isExpanded: o,
|
|
102
|
-
isOnlyOneExpand: y,
|
|
103
|
-
showExpandIcon: h,
|
|
104
|
-
setItemDictionary: r
|
|
105
|
-
}) => /* @__PURE__ */ x(s.ItemContainer, { ...I, $disabled: m, className: f("collapse-item", o && "collapse-item--isExpanded", m && "collapse-item--disabled"), children: [
|
|
106
|
-
/* @__PURE__ */ n(N, { label: i, preIcon: a, postIcon: p, expandIcon: u, isExpanded: o, isOnlyOneExpand: y, id: t, showExpandIcon: h, expandIconHtmlAttributes: g, htmlAttributes: c, labelHtmlAttributes: e, setItemDictionary: r }),
|
|
107
|
-
/* @__PURE__ */ n(s.ItemContent, { ...b, $isExpanded: o, className: f("collapse-item__content", o && "collapse-item__content--isExpanded"), children: l })
|
|
108
|
-
] }));
|
|
109
|
-
z.displayName = "CollapseItem";
|
|
110
|
-
const J = ({
|
|
111
|
-
items: t,
|
|
112
|
-
className: i,
|
|
113
|
-
isOnlyOneExpand: l = !1,
|
|
114
|
-
expandIds: a,
|
|
115
|
-
preIcon: p = null,
|
|
116
|
-
postIcon: u = null,
|
|
117
|
-
expandIcon: m = null,
|
|
118
|
-
disabled: b = !1,
|
|
119
|
-
htmlAttributes: I
|
|
120
|
-
}) => {
|
|
121
|
-
const [g, c] = v(() => a ? a.reduce((e, o) => (e[o] = !0, e), {}) : {});
|
|
122
|
-
return /* @__PURE__ */ n(s.Container, { ...I, className: f("collapse", i), children: t == null ? void 0 : t.map((e, o) => /* @__PURE__ */ x(E, { children: [
|
|
123
|
-
!!o && /* @__PURE__ */ n(j, { color: "#d9d9d9", className: "collapse-divider" }),
|
|
124
|
-
/* @__PURE__ */ n(z, { id: e.id, label: e.label, body: e.body, preIcon: p ?? e.preIcon, postIcon: u ?? e.postIcon, expandIcon: m ?? e.expandIcon, disabled: b || e.disabled, bodyHtmlAttributes: e.bodyHtmlAttributes, htmlAttributes: e.htmlAttributes, expandIconHtmlAttributes: e.expandIconHtmlAttributes, itemHeaderHtmlAttributes: e.itemHeaderHtmlAttributes, itemHeaderLabelHtmlAttributes: e.itemHeaderLabelHtmlAttributes, isExpanded: e.id ? !!g[e.id] : !1, showExpandIcon: e.showExpandIcon ?? !0, isOnlyOneExpand: l, setItemDictionary: c })
|
|
125
|
-
] }, e.id)) });
|
|
126
|
-
};
|
|
127
|
-
export {
|
|
128
|
-
J as Collapse
|
|
129
|
-
};
|