@elliemae/ds-accordion 3.12.0-rc.2 → 3.12.0-rc.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/dist/cjs/DSAccordion.js +1 -4
- package/dist/cjs/DSAccordion.js.map +1 -1
- package/dist/cjs/defaultProps.js +2 -12
- package/dist/cjs/defaultProps.js.map +1 -1
- package/dist/cjs/parts/accordionContent/AccordionContent.js +1 -7
- package/dist/cjs/parts/accordionContent/AccordionContent.js.map +1 -1
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js +71 -102
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js.map +1 -1
- package/dist/esm/DSAccordion.js +1 -4
- package/dist/esm/DSAccordion.js.map +1 -1
- package/dist/esm/defaultProps.js +2 -12
- package/dist/esm/defaultProps.js.map +1 -1
- package/dist/esm/parts/accordionContent/AccordionContent.js +1 -7
- package/dist/esm/parts/accordionContent/AccordionContent.js.map +1 -1
- package/dist/esm/parts/accordionItem/DSAccordionItem.js +71 -102
- package/dist/esm/parts/accordionItem/DSAccordionItem.js.map +1 -1
- package/package.json +6 -6
package/dist/cjs/DSAccordion.js
CHANGED
|
@@ -39,10 +39,7 @@ var import_react_desc_prop_types = require("./react-desc-prop-types");
|
|
|
39
39
|
var import_theming = require("./exported-related/theming");
|
|
40
40
|
const DSAccordion = (props) => {
|
|
41
41
|
const ctx = (0, import_useAccordion.useAccordion)(props);
|
|
42
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSAccordionCTX.DSAccordionContext.Provider, {
|
|
43
|
-
value: ctx,
|
|
44
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AccordionContent.AccordionContent, {})
|
|
45
|
-
});
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DSAccordionCTX.DSAccordionContext.Provider, { value: ctx, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AccordionContent.AccordionContent, {}) });
|
|
46
43
|
};
|
|
47
44
|
DSAccordion.displayName = import_theming.DSAccordionName;
|
|
48
45
|
const DSAccordionWithSchema = (0, import_ds_utilities.describe)(DSAccordion);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSAccordion.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { AccordionContent } from './parts/accordionContent/AccordionContent';\nimport { useAccordion } from './config/useAccordion';\nimport { DSAccordionContext } from './DSAccordionCTX';\nimport { accordionPropTypes } from './react-desc-prop-types';\nimport type { DSAccordionT } from './react-desc-prop-types';\nimport { DSAccordionName } from './exported-related/theming';\n\nconst DSAccordion = (props: DSAccordionT.Props): JSX.Element => {\n const ctx = useAccordion(props);\n\n return (\n <DSAccordionContext.Provider value={ctx}>\n <AccordionContent />\n </DSAccordionContext.Provider>\n );\n};\n\nDSAccordion.displayName = DSAccordionName;\nconst DSAccordionWithSchema = describe(DSAccordion);\nDSAccordionWithSchema.propTypes = accordionPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordion, DSAccordionWithSchema };\n\nexport default DSAccordion;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADejB;AAbN,0BAAyB;AACzB,8BAAiC;AACjC,0BAA6B;AAC7B,4BAAmC;AACnC,mCAAmC;AAEnC,qBAAgC;AAEhC,MAAM,cAAc,CAAC,UAA2C;AAC9D,QAAM,UAAM,kCAAa,KAAK;AAE9B,SACE,4CAAC,yCAAmB,UAAnB
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADejB;AAbN,0BAAyB;AACzB,8BAAiC;AACjC,0BAA6B;AAC7B,4BAAmC;AACnC,mCAAmC;AAEnC,qBAAgC;AAEhC,MAAM,cAAc,CAAC,UAA2C;AAC9D,QAAM,UAAM,kCAAa,KAAK;AAE9B,SACE,4CAAC,yCAAmB,UAAnB,EAA4B,OAAO,KAClC,sDAAC,4CAAiB,GACpB;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,4BAAwB,8BAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/defaultProps.js
CHANGED
|
@@ -33,20 +33,10 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
33
33
|
var import_react = require("react");
|
|
34
34
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
35
35
|
const DefaultIconClosed = (0, import_react.memo)(
|
|
36
|
-
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronRight, {
|
|
37
|
-
width: "20px",
|
|
38
|
-
color: ["brand-primary", "800"]
|
|
39
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadRight, {
|
|
40
|
-
width: "20px"
|
|
41
|
-
})
|
|
36
|
+
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronRight, { width: "20px", color: ["brand-primary", "800"] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadRight, { width: "20px" })
|
|
42
37
|
);
|
|
43
38
|
const DefaultIconOpen = (0, import_react.memo)(
|
|
44
|
-
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronDown, {
|
|
45
|
-
width: "20px",
|
|
46
|
-
color: ["brand-primary", "800"]
|
|
47
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadDown, {
|
|
48
|
-
width: "20px"
|
|
49
|
-
})
|
|
39
|
+
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ChevronDown, { width: "20px", color: ["brand-primary", "800"] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.ArrowheadDown, { width: "20px" })
|
|
50
40
|
);
|
|
51
41
|
const noop = () => {
|
|
52
42
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/defaultProps.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { memo } from 'react';\nimport { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from '@elliemae/ds-icons';\nimport type { DSAccordionInternalsT } from './sharedTypes';\nimport type { DSAccordionT } from './react-desc-prop-types';\n\nconst DefaultIconClosed = memo(({ isDSMobile = false }: DSAccordionInternalsT.DefaultIconProps) =>\n isDSMobile ? <ChevronRight width=\"20px\" color={['brand-primary', '800']} /> : <ArrowheadRight width=\"20px\" />,\n);\n\nconst DefaultIconOpen = memo(({ isDSMobile = false }: DSAccordionInternalsT.DefaultIconProps) =>\n isDSMobile ? <ChevronDown width=\"20px\" color={['brand-primary', '800']} /> : <ArrowheadDown width=\"20px\" />,\n);\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const defaultProps: DSAccordionT.DefaultProps = {\n containerProps: {},\n allowMultipleOpen: false,\n onChange: noop,\n children: [],\n isDSMobile: false,\n};\n\nexport const accordionItemDefaultProps: DSAccordionT.ItemDefaultProps = {\n iconClosed: DefaultIconClosed,\n iconOpened: DefaultIconOpen,\n title: '',\n customActions: [],\n disabled: false,\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMR;AANf,mBAA4B;AAC5B,sBAAyE;AAIzE,MAAM,wBAAoB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACnD,aAAa,4CAAC
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADMR;AANf,mBAA4B;AAC5B,sBAAyE;AAIzE,MAAM,wBAAoB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACnD,aAAa,4CAAC,gCAAa,OAAM,QAAO,OAAO,CAAC,iBAAiB,KAAK,GAAG,IAAK,4CAAC,kCAAe,OAAM,QAAO;AAC7G;AAEA,MAAM,sBAAkB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACjD,aAAa,4CAAC,+BAAY,OAAM,QAAO,OAAO,CAAC,iBAAiB,KAAK,GAAG,IAAK,4CAAC,iCAAc,OAAM,QAAO;AAC3G;AAGA,MAAM,OAAO,MAAY;AAAC;AAEnB,MAAM,eAA0C;AAAA,EACrD,gBAAgB,CAAC;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU,CAAC;AAAA,EACX,YAAY;AACd;AAEO,MAAM,4BAA2D;AAAA,EACtE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,eAAe,CAAC;AAAA,EAChB,UAAU;AACZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -49,12 +49,6 @@ const AccordionContent = () => {
|
|
|
49
49
|
})
|
|
50
50
|
)
|
|
51
51
|
);
|
|
52
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, {
|
|
53
|
-
"data-testid": import_DSAccordionDatatestid.DSAccordionDataTestid.GROUP,
|
|
54
|
-
...containerProps,
|
|
55
|
-
...globalAttrs,
|
|
56
|
-
...xstyledAttrs,
|
|
57
|
-
children: childrenWithIndex
|
|
58
|
-
});
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledContainer, { "data-testid": import_DSAccordionDatatestid.DSAccordionDataTestid.GROUP, ...containerProps, ...globalAttrs, ...xstyledAttrs, children: childrenWithIndex });
|
|
59
53
|
};
|
|
60
54
|
//# sourceMappingURL=AccordionContent.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/accordionContent/AccordionContent.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../exported-related/DSAccordionDatatestid';\nimport { StyledContainer } from './styles';\nimport type { DSAccordionT } from '../../react-desc-prop-types';\n\nexport const AccordionContent = (): JSX.Element => {\n const {\n props: { containerProps, children, onChange, ...rest },\n } = useContext(DSAccordionContext);\n\n const childrenWithIndex: React.ReactElement<DSAccordionT.InternalItemProps>[] = [];\n\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const globalAttrs = useGetGlobalAttributes(rest);\n\n React.Children.forEach(children, (child, index) =>\n childrenWithIndex.push(\n React.cloneElement(child, {\n dsIndex: index,\n }),\n ),\n );\n\n return (\n <StyledContainer data-testid={DSAccordionDataTestid.GROUP} {...containerProps} {...globalAttrs} {...xstyledAttrs}>\n {childrenWithIndex}\n </StyledContainer>\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BnB;AA3BJ,mBAAkC;AAClC,0BAA2D;AAC3D,4BAAmC;AACnC,mCAAsC;AACtC,oBAAgC;AAGzB,MAAM,mBAAmB,MAAmB;AACjD,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,UAAU,aAAa,KAAK;AAAA,EACvD,QAAI,yBAAW,wCAAkB;AAEjC,QAAM,oBAA0E,CAAC;AAEjF,QAAM,mBAAe,wCAAmB,IAAI;AAE5C,QAAM,kBAAc,4CAAuB,IAAI;AAE/C,eAAAA,QAAM,SAAS;AAAA,IAAQ;AAAA,IAAU,CAAC,OAAO,UACvC,kBAAkB;AAAA,MAChB,aAAAA,QAAM,aAAa,OAAO;AAAA,QACxB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SACE,4CAAC
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD2BnB;AA3BJ,mBAAkC;AAClC,0BAA2D;AAC3D,4BAAmC;AACnC,mCAAsC;AACtC,oBAAgC;AAGzB,MAAM,mBAAmB,MAAmB;AACjD,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB,UAAU,aAAa,KAAK;AAAA,EACvD,QAAI,yBAAW,wCAAkB;AAEjC,QAAM,oBAA0E,CAAC;AAEjF,QAAM,mBAAe,wCAAmB,IAAI;AAE5C,QAAM,kBAAc,4CAAuB,IAAI;AAE/C,eAAAA,QAAM,SAAS;AAAA,IAAQ;AAAA,IAAU,CAAC,OAAO,UACvC,kBAAkB;AAAA,MAChB,aAAAA,QAAM,aAAa,OAAO;AAAA,QACxB,SAAS;AAAA,MACX,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SACE,4CAAC,iCAAgB,eAAa,mDAAsB,OAAQ,GAAG,gBAAiB,GAAG,aAAc,GAAG,cACjG,6BACH;AAEJ;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|
|
@@ -78,9 +78,9 @@ const DSAccordionItem = (props) => {
|
|
|
78
78
|
const [referenceElement, setReferenceElement] = (0, import_react.useState)();
|
|
79
79
|
const CustomActionsContent = (0, import_react.useMemo)(() => {
|
|
80
80
|
if (!isDSMobile && customActions?.length > 0)
|
|
81
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemCustomActions, {
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemCustomActions, { isDSMobile, children: customActions?.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
+
import_ds_button.DSButton,
|
|
83
|
+
{
|
|
84
84
|
onClick: (e) => {
|
|
85
85
|
e.stopPropagation();
|
|
86
86
|
if (onClick)
|
|
@@ -88,16 +88,11 @@ const DSAccordionItem = (props) => {
|
|
|
88
88
|
},
|
|
89
89
|
...otherProps,
|
|
90
90
|
buttonType: import_ds_button.BUTTON_TYPE.SECONDARY
|
|
91
|
-
},
|
|
92
|
-
|
|
91
|
+
},
|
|
92
|
+
id
|
|
93
|
+
)) });
|
|
93
94
|
if (!isDSMobile && (renderCustomActions || CustomActions))
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemCustomActions, {
|
|
95
|
-
isDSMobile,
|
|
96
|
-
children: CustomActions !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomActions, {
|
|
97
|
-
allRefs: allChildrenReferences,
|
|
98
|
-
actualActiveValue
|
|
99
|
-
}) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })
|
|
100
|
-
});
|
|
95
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemCustomActions, { isDSMobile, children: CustomActions !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomActions, { allRefs: allChildrenReferences, actualActiveValue }) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue }) });
|
|
101
96
|
return null;
|
|
102
97
|
}, [CustomActions, actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);
|
|
103
98
|
const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = (0, import_ds_utilities.useIsShowingEllipsis)();
|
|
@@ -109,9 +104,10 @@ const DSAccordionItem = (props) => {
|
|
|
109
104
|
const handleOnBlur = (0, import_react.useCallback)(() => setShowPopover(false), []);
|
|
110
105
|
const Titles = (0, import_react.useMemo)(() => {
|
|
111
106
|
if ((isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) && !isDSMobile)
|
|
112
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
108
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
|
+
import_styles.StyledPrimaryTitle,
|
|
110
|
+
{
|
|
115
111
|
ref: setPrimaryElement,
|
|
116
112
|
...title ? { id: `accordion_${title || ""}id` } : void 0,
|
|
117
113
|
disabled,
|
|
@@ -119,35 +115,21 @@ const DSAccordionItem = (props) => {
|
|
|
119
115
|
selected,
|
|
120
116
|
withSecondaryTitle: secondaryTitle,
|
|
121
117
|
children: title
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
138
|
-
children: [
|
|
139
|
-
" ",
|
|
140
|
-
secondaryTitle
|
|
141
|
-
]
|
|
142
|
-
})
|
|
143
|
-
]
|
|
144
|
-
})
|
|
145
|
-
})
|
|
146
|
-
]
|
|
147
|
-
});
|
|
148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
149
|
-
children: [
|
|
150
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledPrimaryTitle, {
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
!isDSMobile && secondaryTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSecondaryTitle, { ref: setSecondaryElement, disabled, selected, children: secondaryTitle }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_popperjs.DSPopperJS, { referenceElement, showPopover, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledTooltipContent, { children: [
|
|
122
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
124
|
+
" ",
|
|
125
|
+
secondaryTitle
|
|
126
|
+
] })
|
|
127
|
+
] }) })
|
|
128
|
+
] });
|
|
129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
|
+
import_styles.StyledPrimaryTitle,
|
|
132
|
+
{
|
|
151
133
|
ref: setPrimaryElement,
|
|
152
134
|
...title ? { id: `accordion_${title || ""}id` } : void 0,
|
|
153
135
|
disabled,
|
|
@@ -155,15 +137,10 @@ const DSAccordionItem = (props) => {
|
|
|
155
137
|
selected,
|
|
156
138
|
withSecondaryTitle: secondaryTitle,
|
|
157
139
|
children: title
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
selected,
|
|
163
|
-
children: secondaryTitle
|
|
164
|
-
})
|
|
165
|
-
]
|
|
166
|
-
});
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
!isDSMobile && secondaryTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSecondaryTitle, { ref: setSecondaryElement, disabled, selected, children: secondaryTitle })
|
|
143
|
+
] });
|
|
167
144
|
}, [
|
|
168
145
|
disabled,
|
|
169
146
|
isDSMobile,
|
|
@@ -177,67 +154,59 @@ const DSAccordionItem = (props) => {
|
|
|
177
154
|
selected,
|
|
178
155
|
title
|
|
179
156
|
]);
|
|
180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledItemContainer, {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
children: [
|
|
209
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemAddon, {
|
|
210
|
-
disabled,
|
|
211
|
-
isDSMobile,
|
|
212
|
-
children: selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconOpened, {
|
|
213
|
-
isDSMobile
|
|
214
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconClosed, {
|
|
215
|
-
isDSMobile
|
|
216
|
-
})
|
|
217
|
-
}),
|
|
218
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemTitles, {
|
|
157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledItemContainer, { "data-testid": import_DSAccordionDatatestid.DSAccordionDataTestid.ITEM.CONTAINER, className, ...xstyledAttrs, children: [
|
|
158
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledItemHeaderContainer, { disabled, ref: setReferenceElement, children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
160
|
+
import_styles.StyledItemHeader,
|
|
161
|
+
{
|
|
162
|
+
type: "button",
|
|
163
|
+
withCustomActions: (customActions?.length > 0 || renderCustomActions !== void 0) && !isDSMobile,
|
|
164
|
+
withSecondaryTitle: secondaryTitle,
|
|
165
|
+
onClick: handleOnClick,
|
|
166
|
+
tabIndex: !disabled ? 0 : void 0,
|
|
167
|
+
disabled,
|
|
168
|
+
"data-disabled": disabled,
|
|
169
|
+
ref: allChildrenReferences[dsIndex],
|
|
170
|
+
onKeyDown: onKeyDownWithIndex,
|
|
171
|
+
isDSMobile,
|
|
172
|
+
"data-testid": import_DSAccordionDatatestid.DSAccordionDataTestid.ITEM.HEADER,
|
|
173
|
+
id: `ds-accordion-header-${value}`,
|
|
174
|
+
"aria-expanded": selected,
|
|
175
|
+
"aria-disabled": disabled,
|
|
176
|
+
"aria-controls": `ds-accordion-content-${value}`,
|
|
177
|
+
onFocus: handleOnFocus,
|
|
178
|
+
onBlur: handleOnBlur,
|
|
179
|
+
...globalAttrs,
|
|
180
|
+
children: [
|
|
181
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledItemAddon, { disabled, isDSMobile, children: selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconOpened, { isDSMobile }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconClosed, { isDSMobile }) }),
|
|
182
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
183
|
+
import_styles.StyledItemTitles,
|
|
184
|
+
{
|
|
219
185
|
onMouseEnter: handleOnFocus,
|
|
220
186
|
onMouseLeave: handleOnBlur,
|
|
221
187
|
isDSMobile,
|
|
222
188
|
withSecondaryTitle: secondaryTitle,
|
|
223
189
|
selected,
|
|
224
190
|
children: Titles
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
CustomActionsContent
|
|
197
|
+
] }),
|
|
198
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
199
|
+
import_styles.StyledItemContent,
|
|
200
|
+
{
|
|
232
201
|
"data-testid": import_DSAccordionDatatestid.DSAccordionDataTestid.ITEM.CONTENT,
|
|
233
202
|
"aria-labelledby": `ds-accordion-header-${value}`,
|
|
234
203
|
role: "region",
|
|
235
204
|
isDSMobile,
|
|
236
205
|
id: `ds-accordion-content-${value}`,
|
|
237
206
|
children
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
});
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
] });
|
|
241
210
|
};
|
|
242
211
|
DSAccordionItem.displayName = "DSAccordionItem";
|
|
243
212
|
const DSAccordionItemWithSchema = (0, import_ds_utilities.describe)(DSAccordionItem);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/accordionItem/DSAccordionItem.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
4
|
"sourcesContent": ["/* eslint-disable max-lines */\nimport type { WeakValidationMap } from 'react';\nimport React, { useState, useContext, useCallback, useMemo } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n describe,\n useIsShowingEllipsis,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { DSButton, BUTTON_TYPE } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { accordionItemDefaultProps } from '../../defaultProps';\nimport {\n StyledItemAddon,\n StyledItemContainer,\n StyledItemContent,\n StyledItemCustomActions,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledItemTitles,\n StyledPrimaryTitle,\n StyledSecondaryTitle,\n StyledTooltipContent,\n} from './styles';\nimport { useAccordionItem } from './useAccordionItem';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../exported-related/DSAccordionDatatestid';\nimport { accordionItemPropTypes } from '../../react-desc-prop-types';\nimport type { DSAccordionT } from '../../react-desc-prop-types';\n\nconst DSAccordionItem = (props: DSAccordionT.ItemProps): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionT.InternalItemProps;\n\n const {\n children,\n title,\n secondaryTitle,\n customActions,\n iconOpened: IconOpened,\n iconClosed: IconClosed,\n value,\n disabled,\n dsIndex,\n renderCustomActions,\n CustomActions,\n ...rest\n } = propsWithDefaults;\n\n const { className, ...globalAttrs } = useGetGlobalAttributes(rest);\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled });\n const {\n allChildrenReferences,\n actualActiveValue,\n props: { isDSMobile },\n } = useContext(DSAccordionContext);\n\n const onKeyDownWithIndex = useCallback(\n (e: React.KeyboardEvent) => {\n handleOnKeyDown(e, dsIndex);\n },\n [dsIndex, handleOnKeyDown],\n );\n\n const [showPopover, setShowPopover] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>();\n\n const CustomActionsContent = useMemo(() => {\n if (!isDSMobile && customActions?.length > 0)\n return (\n <StyledItemCustomActions isDSMobile={isDSMobile}>\n {customActions?.map(({ onClick, id, ...otherProps }) => (\n <DSButton\n key={id}\n onClick={(e: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>): void => {\n e.stopPropagation();\n if (onClick) onClick(e as React.MouseEvent<HTMLElement, MouseEvent>);\n }}\n {...otherProps}\n buttonType={BUTTON_TYPE.SECONDARY}\n />\n ))}\n </StyledItemCustomActions>\n );\n\n if (!isDSMobile && (renderCustomActions || CustomActions))\n return (\n <StyledItemCustomActions isDSMobile={isDSMobile}>\n {CustomActions !== undefined ? (\n <CustomActions allRefs={allChildrenReferences} actualActiveValue={actualActiveValue} />\n ) : (\n renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })\n )}\n </StyledItemCustomActions>\n );\n return null;\n }, [CustomActions, actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);\n\n const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();\n\n const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();\n\n const handleOnFocus = useCallback(\n () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),\n [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis],\n );\n\n const handleOnBlur = useCallback(() => setShowPopover(false), []);\n\n // eslint-disable-next-line complexity\n const Titles = useMemo(() => {\n if ((isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) && !isDSMobile)\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id` } : undefined)}\n disabled={disabled}\n isDSMobile={isDSMobile}\n selected={selected}\n withSecondaryTitle={secondaryTitle}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled} selected={selected}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n <DSPopperJS referenceElement={referenceElement} showPopover={showPopover}>\n <StyledTooltipContent>\n <p>{title}</p>\n <p> {secondaryTitle}</p>\n </StyledTooltipContent>\n </DSPopperJS>\n </>\n );\n\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id` } : undefined)}\n disabled={disabled}\n isDSMobile={isDSMobile}\n selected={selected}\n withSecondaryTitle={secondaryTitle}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled} selected={selected}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n </>\n );\n }, [\n disabled,\n isDSMobile,\n isPrimaryShowingEllipsis,\n isSecondaryShowingEllipsis,\n referenceElement,\n secondaryTitle,\n setPrimaryElement,\n setSecondaryElement,\n showPopover,\n selected,\n title,\n ]);\n\n return (\n <StyledItemContainer data-testid={DSAccordionDataTestid.ITEM.CONTAINER} className={className} {...xstyledAttrs}>\n <StyledItemHeaderContainer disabled={disabled} ref={setReferenceElement}>\n <StyledItemHeader\n type=\"button\"\n withCustomActions={(customActions?.length > 0 || renderCustomActions !== undefined) && !isDSMobile}\n withSecondaryTitle={secondaryTitle}\n onClick={handleOnClick}\n tabIndex={!disabled ? 0 : undefined}\n disabled={disabled}\n data-disabled={disabled}\n ref={allChildrenReferences[dsIndex]}\n onKeyDown={onKeyDownWithIndex}\n isDSMobile={isDSMobile}\n data-testid={DSAccordionDataTestid.ITEM.HEADER}\n id={`ds-accordion-header-${value}`}\n aria-expanded={selected}\n aria-disabled={disabled}\n aria-controls={`ds-accordion-content-${value}`}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n {...globalAttrs}\n >\n <StyledItemAddon disabled={disabled} isDSMobile={isDSMobile}>\n {selected ? <IconOpened isDSMobile={isDSMobile} /> : <IconClosed isDSMobile={isDSMobile} />}\n </StyledItemAddon>\n <StyledItemTitles\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n isDSMobile={isDSMobile}\n withSecondaryTitle={secondaryTitle}\n selected={selected}\n >\n {Titles}\n </StyledItemTitles>\n </StyledItemHeader>\n {CustomActionsContent}\n </StyledItemHeaderContainer>\n {selected && (\n <StyledItemContent\n data-testid={DSAccordionDataTestid.ITEM.CONTENT}\n aria-labelledby={`ds-accordion-header-${value}`}\n role=\"region\"\n isDSMobile={isDSMobile}\n id={`ds-accordion-content-${value}`}\n >\n {children}\n </StyledItemContent>\n )}\n </StyledItemContainer>\n );\n};\n\nDSAccordionItem.displayName = 'DSAccordionItem';\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n", "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xC,mBAAiB,uBAAuB;AAAA,QACxC,MAAK;AAAA,QACL;AAAA,QACA,IAAI,wBAAwB;AAAA,QAE3B;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;AAEA,gBAAgB,cAAc;AAC9B,MAAM,gCAA4B,8BAAS,eAAe;AAC1D,0BAA0B,YAAY;AAGtC,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSAccordion.js
CHANGED
|
@@ -8,10 +8,7 @@ import { accordionPropTypes } from "./react-desc-prop-types";
|
|
|
8
8
|
import { DSAccordionName } from "./exported-related/theming";
|
|
9
9
|
const DSAccordion = (props) => {
|
|
10
10
|
const ctx = useAccordion(props);
|
|
11
|
-
return /* @__PURE__ */ jsx(DSAccordionContext.Provider, {
|
|
12
|
-
value: ctx,
|
|
13
|
-
children: /* @__PURE__ */ jsx(AccordionContent, {})
|
|
14
|
-
});
|
|
11
|
+
return /* @__PURE__ */ jsx(DSAccordionContext.Provider, { value: ctx, children: /* @__PURE__ */ jsx(AccordionContent, {}) });
|
|
15
12
|
};
|
|
16
13
|
DSAccordion.displayName = DSAccordionName;
|
|
17
14
|
const DSAccordionWithSchema = describe(DSAccordion);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSAccordion.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { WeakValidationMap } from 'react';\nimport React from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { AccordionContent } from './parts/accordionContent/AccordionContent';\nimport { useAccordion } from './config/useAccordion';\nimport { DSAccordionContext } from './DSAccordionCTX';\nimport { accordionPropTypes } from './react-desc-prop-types';\nimport type { DSAccordionT } from './react-desc-prop-types';\nimport { DSAccordionName } from './exported-related/theming';\n\nconst DSAccordion = (props: DSAccordionT.Props): JSX.Element => {\n const ctx = useAccordion(props);\n\n return (\n <DSAccordionContext.Provider value={ctx}>\n <AccordionContent />\n </DSAccordionContext.Provider>\n );\n};\n\nDSAccordion.displayName = DSAccordionName;\nconst DSAccordionWithSchema = describe(DSAccordion);\nDSAccordionWithSchema.propTypes = accordionPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordion, DSAccordionWithSchema };\n\nexport default DSAccordion;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACejB;AAbN,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AAEnC,SAAS,uBAAuB;AAEhC,MAAM,cAAc,CAAC,UAA2C;AAC9D,QAAM,MAAM,aAAa,KAAK;AAE9B,SACE,oBAAC,mBAAmB,UAAnB
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACejB;AAbN,SAAS,gBAAgB;AACzB,SAAS,wBAAwB;AACjC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AAEnC,SAAS,uBAAuB;AAEhC,MAAM,cAAc,CAAC,UAA2C;AAC9D,QAAM,MAAM,aAAa,KAAK;AAE9B,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,KAClC,8BAAC,oBAAiB,GACpB;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/defaultProps.js
CHANGED
|
@@ -3,20 +3,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { memo } from "react";
|
|
4
4
|
import { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from "@elliemae/ds-icons";
|
|
5
5
|
const DefaultIconClosed = memo(
|
|
6
|
-
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ jsx(ChevronRight, {
|
|
7
|
-
width: "20px",
|
|
8
|
-
color: ["brand-primary", "800"]
|
|
9
|
-
}) : /* @__PURE__ */ jsx(ArrowheadRight, {
|
|
10
|
-
width: "20px"
|
|
11
|
-
})
|
|
6
|
+
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ jsx(ChevronRight, { width: "20px", color: ["brand-primary", "800"] }) : /* @__PURE__ */ jsx(ArrowheadRight, { width: "20px" })
|
|
12
7
|
);
|
|
13
8
|
const DefaultIconOpen = memo(
|
|
14
|
-
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ jsx(ChevronDown, {
|
|
15
|
-
width: "20px",
|
|
16
|
-
color: ["brand-primary", "800"]
|
|
17
|
-
}) : /* @__PURE__ */ jsx(ArrowheadDown, {
|
|
18
|
-
width: "20px"
|
|
19
|
-
})
|
|
9
|
+
({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ jsx(ChevronDown, { width: "20px", color: ["brand-primary", "800"] }) : /* @__PURE__ */ jsx(ArrowheadDown, { width: "20px" })
|
|
20
10
|
);
|
|
21
11
|
const noop = () => {
|
|
22
12
|
};
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { memo } from 'react';\nimport { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from '@elliemae/ds-icons';\nimport type { DSAccordionInternalsT } from './sharedTypes';\nimport type { DSAccordionT } from './react-desc-prop-types';\n\nconst DefaultIconClosed = memo(({ isDSMobile = false }: DSAccordionInternalsT.DefaultIconProps) =>\n isDSMobile ? <ChevronRight width=\"20px\" color={['brand-primary', '800']} /> : <ArrowheadRight width=\"20px\" />,\n);\n\nconst DefaultIconOpen = memo(({ isDSMobile = false }: DSAccordionInternalsT.DefaultIconProps) =>\n isDSMobile ? <ChevronDown width=\"20px\" color={['brand-primary', '800']} /> : <ArrowheadDown width=\"20px\" />,\n);\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const defaultProps: DSAccordionT.DefaultProps = {\n containerProps: {},\n allowMultipleOpen: false,\n onChange: noop,\n children: [],\n isDSMobile: false,\n};\n\nexport const accordionItemDefaultProps: DSAccordionT.ItemDefaultProps = {\n iconClosed: DefaultIconClosed,\n iconOpened: DefaultIconOpen,\n title: '',\n customActions: [],\n disabled: false,\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;ACMR;AANf,SAAgB,YAAY;AAC5B,SAAS,gBAAgB,eAAe,cAAc,mBAAmB;AAIzE,MAAM,oBAAoB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACnD,aAAa,oBAAC
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACMR;AANf,SAAgB,YAAY;AAC5B,SAAS,gBAAgB,eAAe,cAAc,mBAAmB;AAIzE,MAAM,oBAAoB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACnD,aAAa,oBAAC,gBAAa,OAAM,QAAO,OAAO,CAAC,iBAAiB,KAAK,GAAG,IAAK,oBAAC,kBAAe,OAAM,QAAO;AAC7G;AAEA,MAAM,kBAAkB;AAAA,EAAK,CAAC,EAAE,aAAa,MAAM,MACjD,aAAa,oBAAC,eAAY,OAAM,QAAO,OAAO,CAAC,iBAAiB,KAAK,GAAG,IAAK,oBAAC,iBAAc,OAAM,QAAO;AAC3G;AAGA,MAAM,OAAO,MAAY;AAAC;AAEnB,MAAM,eAA0C;AAAA,EACrD,gBAAgB,CAAC;AAAA,EACjB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU,CAAC;AAAA,EACX,YAAY;AACd;AAEO,MAAM,4BAA2D;AAAA,EACtE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,eAAe,CAAC;AAAA,EAChB,UAAU;AACZ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,13 +20,7 @@ const AccordionContent = () => {
|
|
|
20
20
|
})
|
|
21
21
|
)
|
|
22
22
|
);
|
|
23
|
-
return /* @__PURE__ */ jsx(StyledContainer, {
|
|
24
|
-
"data-testid": DSAccordionDataTestid.GROUP,
|
|
25
|
-
...containerProps,
|
|
26
|
-
...globalAttrs,
|
|
27
|
-
...xstyledAttrs,
|
|
28
|
-
children: childrenWithIndex
|
|
29
|
-
});
|
|
23
|
+
return /* @__PURE__ */ jsx(StyledContainer, { "data-testid": DSAccordionDataTestid.GROUP, ...containerProps, ...globalAttrs, ...xstyledAttrs, children: childrenWithIndex });
|
|
30
24
|
};
|
|
31
25
|
export {
|
|
32
26
|
AccordionContent
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionContent/AccordionContent.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-utilities';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../exported-related/DSAccordionDatatestid';\nimport { StyledContainer } from './styles';\nimport type { DSAccordionT } from '../../react-desc-prop-types';\n\nexport const AccordionContent = (): JSX.Element => {\n const {\n props: { containerProps, children, onChange, ...rest },\n } = useContext(DSAccordionContext);\n\n const childrenWithIndex: React.ReactElement<DSAccordionT.InternalItemProps>[] = [];\n\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const globalAttrs = useGetGlobalAttributes(rest);\n\n React.Children.forEach(children, (child, index) =>\n childrenWithIndex.push(\n React.cloneElement(child, {\n dsIndex: index,\n }),\n ),\n );\n\n return (\n <StyledContainer data-testid={DSAccordionDataTestid.GROUP} {...containerProps} {...globalAttrs} {...xstyledAttrs}>\n {childrenWithIndex}\n </StyledContainer>\n );\n};\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW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@ -64,9 +64,9 @@ const DSAccordionItem = (props) => {
|
|
|
64
64
|
const [referenceElement, setReferenceElement] = useState();
|
|
65
65
|
const CustomActionsContent = useMemo(() => {
|
|
66
66
|
if (!isDSMobile && customActions?.length > 0)
|
|
67
|
-
return /* @__PURE__ */ jsx(StyledItemCustomActions, {
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
return /* @__PURE__ */ jsx(StyledItemCustomActions, { isDSMobile, children: customActions?.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ jsx(
|
|
68
|
+
DSButton,
|
|
69
|
+
{
|
|
70
70
|
onClick: (e) => {
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
if (onClick)
|
|
@@ -74,16 +74,11 @@ const DSAccordionItem = (props) => {
|
|
|
74
74
|
},
|
|
75
75
|
...otherProps,
|
|
76
76
|
buttonType: BUTTON_TYPE.SECONDARY
|
|
77
|
-
},
|
|
78
|
-
|
|
77
|
+
},
|
|
78
|
+
id
|
|
79
|
+
)) });
|
|
79
80
|
if (!isDSMobile && (renderCustomActions || CustomActions))
|
|
80
|
-
return /* @__PURE__ */ jsx(StyledItemCustomActions, {
|
|
81
|
-
isDSMobile,
|
|
82
|
-
children: CustomActions !== void 0 ? /* @__PURE__ */ jsx(CustomActions, {
|
|
83
|
-
allRefs: allChildrenReferences,
|
|
84
|
-
actualActiveValue
|
|
85
|
-
}) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })
|
|
86
|
-
});
|
|
81
|
+
return /* @__PURE__ */ jsx(StyledItemCustomActions, { isDSMobile, children: CustomActions !== void 0 ? /* @__PURE__ */ jsx(CustomActions, { allRefs: allChildrenReferences, actualActiveValue }) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue }) });
|
|
87
82
|
return null;
|
|
88
83
|
}, [CustomActions, actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);
|
|
89
84
|
const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();
|
|
@@ -95,9 +90,10 @@ const DSAccordionItem = (props) => {
|
|
|
95
90
|
const handleOnBlur = useCallback(() => setShowPopover(false), []);
|
|
96
91
|
const Titles = useMemo(() => {
|
|
97
92
|
if ((isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) && !isDSMobile)
|
|
98
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
StyledPrimaryTitle,
|
|
96
|
+
{
|
|
101
97
|
ref: setPrimaryElement,
|
|
102
98
|
...title ? { id: `accordion_${title || ""}id` } : void 0,
|
|
103
99
|
disabled,
|
|
@@ -105,35 +101,21 @@ const DSAccordionItem = (props) => {
|
|
|
105
101
|
selected,
|
|
106
102
|
withSecondaryTitle: secondaryTitle,
|
|
107
103
|
children: title
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/* @__PURE__ */ jsxs("p", {
|
|
124
|
-
children: [
|
|
125
|
-
" ",
|
|
126
|
-
secondaryTitle
|
|
127
|
-
]
|
|
128
|
-
})
|
|
129
|
-
]
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
]
|
|
133
|
-
});
|
|
134
|
-
return /* @__PURE__ */ jsxs(Fragment, {
|
|
135
|
-
children: [
|
|
136
|
-
/* @__PURE__ */ jsx(StyledPrimaryTitle, {
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
!isDSMobile && secondaryTitle && /* @__PURE__ */ jsx(StyledSecondaryTitle, { ref: setSecondaryElement, disabled, selected, children: secondaryTitle }),
|
|
107
|
+
/* @__PURE__ */ jsx(DSPopperJS, { referenceElement, showPopover, children: /* @__PURE__ */ jsxs(StyledTooltipContent, { children: [
|
|
108
|
+
/* @__PURE__ */ jsx("p", { children: title }),
|
|
109
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
110
|
+
" ",
|
|
111
|
+
secondaryTitle
|
|
112
|
+
] })
|
|
113
|
+
] }) })
|
|
114
|
+
] });
|
|
115
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
StyledPrimaryTitle,
|
|
118
|
+
{
|
|
137
119
|
ref: setPrimaryElement,
|
|
138
120
|
...title ? { id: `accordion_${title || ""}id` } : void 0,
|
|
139
121
|
disabled,
|
|
@@ -141,15 +123,10 @@ const DSAccordionItem = (props) => {
|
|
|
141
123
|
selected,
|
|
142
124
|
withSecondaryTitle: secondaryTitle,
|
|
143
125
|
children: title
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
selected,
|
|
149
|
-
children: secondaryTitle
|
|
150
|
-
})
|
|
151
|
-
]
|
|
152
|
-
});
|
|
126
|
+
}
|
|
127
|
+
),
|
|
128
|
+
!isDSMobile && secondaryTitle && /* @__PURE__ */ jsx(StyledSecondaryTitle, { ref: setSecondaryElement, disabled, selected, children: secondaryTitle })
|
|
129
|
+
] });
|
|
153
130
|
}, [
|
|
154
131
|
disabled,
|
|
155
132
|
isDSMobile,
|
|
@@ -163,67 +140,59 @@ const DSAccordionItem = (props) => {
|
|
|
163
140
|
selected,
|
|
164
141
|
title
|
|
165
142
|
]);
|
|
166
|
-
return /* @__PURE__ */ jsxs(StyledItemContainer, {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
children: [
|
|
195
|
-
/* @__PURE__ */ jsx(StyledItemAddon, {
|
|
196
|
-
disabled,
|
|
197
|
-
isDSMobile,
|
|
198
|
-
children: selected ? /* @__PURE__ */ jsx(IconOpened, {
|
|
199
|
-
isDSMobile
|
|
200
|
-
}) : /* @__PURE__ */ jsx(IconClosed, {
|
|
201
|
-
isDSMobile
|
|
202
|
-
})
|
|
203
|
-
}),
|
|
204
|
-
/* @__PURE__ */ jsx(StyledItemTitles, {
|
|
143
|
+
return /* @__PURE__ */ jsxs(StyledItemContainer, { "data-testid": DSAccordionDataTestid.ITEM.CONTAINER, className, ...xstyledAttrs, children: [
|
|
144
|
+
/* @__PURE__ */ jsxs(StyledItemHeaderContainer, { disabled, ref: setReferenceElement, children: [
|
|
145
|
+
/* @__PURE__ */ jsxs(
|
|
146
|
+
StyledItemHeader,
|
|
147
|
+
{
|
|
148
|
+
type: "button",
|
|
149
|
+
withCustomActions: (customActions?.length > 0 || renderCustomActions !== void 0) && !isDSMobile,
|
|
150
|
+
withSecondaryTitle: secondaryTitle,
|
|
151
|
+
onClick: handleOnClick,
|
|
152
|
+
tabIndex: !disabled ? 0 : void 0,
|
|
153
|
+
disabled,
|
|
154
|
+
"data-disabled": disabled,
|
|
155
|
+
ref: allChildrenReferences[dsIndex],
|
|
156
|
+
onKeyDown: onKeyDownWithIndex,
|
|
157
|
+
isDSMobile,
|
|
158
|
+
"data-testid": DSAccordionDataTestid.ITEM.HEADER,
|
|
159
|
+
id: `ds-accordion-header-${value}`,
|
|
160
|
+
"aria-expanded": selected,
|
|
161
|
+
"aria-disabled": disabled,
|
|
162
|
+
"aria-controls": `ds-accordion-content-${value}`,
|
|
163
|
+
onFocus: handleOnFocus,
|
|
164
|
+
onBlur: handleOnBlur,
|
|
165
|
+
...globalAttrs,
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx(StyledItemAddon, { disabled, isDSMobile, children: selected ? /* @__PURE__ */ jsx(IconOpened, { isDSMobile }) : /* @__PURE__ */ jsx(IconClosed, { isDSMobile }) }),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
StyledItemTitles,
|
|
170
|
+
{
|
|
205
171
|
onMouseEnter: handleOnFocus,
|
|
206
172
|
onMouseLeave: handleOnBlur,
|
|
207
173
|
isDSMobile,
|
|
208
174
|
withSecondaryTitle: secondaryTitle,
|
|
209
175
|
selected,
|
|
210
176
|
children: Titles
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
CustomActionsContent
|
|
183
|
+
] }),
|
|
184
|
+
selected && /* @__PURE__ */ jsx(
|
|
185
|
+
StyledItemContent,
|
|
186
|
+
{
|
|
218
187
|
"data-testid": DSAccordionDataTestid.ITEM.CONTENT,
|
|
219
188
|
"aria-labelledby": `ds-accordion-header-${value}`,
|
|
220
189
|
role: "region",
|
|
221
190
|
isDSMobile,
|
|
222
191
|
id: `ds-accordion-content-${value}`,
|
|
223
192
|
children
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
});
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
] });
|
|
227
196
|
};
|
|
228
197
|
DSAccordionItem.displayName = "DSAccordionItem";
|
|
229
198
|
const DSAccordionItemWithSchema = describe(DSAccordionItem);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionItem/DSAccordionItem.tsx"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport type { WeakValidationMap } from 'react';\nimport React, { useState, useContext, useCallback, useMemo } from 'react';\nimport {\n useMemoMergePropsWithDefault,\n describe,\n useIsShowingEllipsis,\n useGetGlobalAttributes,\n useGetXstyledProps,\n} from '@elliemae/ds-utilities';\nimport { DSButton, BUTTON_TYPE } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { accordionItemDefaultProps } from '../../defaultProps';\nimport {\n StyledItemAddon,\n StyledItemContainer,\n StyledItemContent,\n StyledItemCustomActions,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledItemTitles,\n StyledPrimaryTitle,\n StyledSecondaryTitle,\n StyledTooltipContent,\n} from './styles';\nimport { useAccordionItem } from './useAccordionItem';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../exported-related/DSAccordionDatatestid';\nimport { accordionItemPropTypes } from '../../react-desc-prop-types';\nimport type { DSAccordionT } from '../../react-desc-prop-types';\n\nconst DSAccordionItem = (props: DSAccordionT.ItemProps): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionT.InternalItemProps;\n\n const {\n children,\n title,\n secondaryTitle,\n customActions,\n iconOpened: IconOpened,\n iconClosed: IconClosed,\n value,\n disabled,\n dsIndex,\n renderCustomActions,\n CustomActions,\n ...rest\n } = propsWithDefaults;\n\n const { className, ...globalAttrs } = useGetGlobalAttributes(rest);\n const xstyledAttrs = useGetXstyledProps(rest);\n\n const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled });\n const {\n allChildrenReferences,\n actualActiveValue,\n props: { isDSMobile },\n } = useContext(DSAccordionContext);\n\n const onKeyDownWithIndex = useCallback(\n (e: React.KeyboardEvent) => {\n handleOnKeyDown(e, dsIndex);\n },\n [dsIndex, handleOnKeyDown],\n );\n\n const [showPopover, setShowPopover] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>();\n\n const CustomActionsContent = useMemo(() => {\n if (!isDSMobile && customActions?.length > 0)\n return (\n <StyledItemCustomActions isDSMobile={isDSMobile}>\n {customActions?.map(({ onClick, id, ...otherProps }) => (\n <DSButton\n key={id}\n onClick={(e: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>): void => {\n e.stopPropagation();\n if (onClick) onClick(e as React.MouseEvent<HTMLElement, MouseEvent>);\n }}\n {...otherProps}\n buttonType={BUTTON_TYPE.SECONDARY}\n />\n ))}\n </StyledItemCustomActions>\n );\n\n if (!isDSMobile && (renderCustomActions || CustomActions))\n return (\n <StyledItemCustomActions isDSMobile={isDSMobile}>\n {CustomActions !== undefined ? (\n <CustomActions allRefs={allChildrenReferences} actualActiveValue={actualActiveValue} />\n ) : (\n renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })\n )}\n </StyledItemCustomActions>\n );\n return null;\n }, [CustomActions, actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);\n\n const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();\n\n const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();\n\n const handleOnFocus = useCallback(\n () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),\n [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis],\n );\n\n const handleOnBlur = useCallback(() => setShowPopover(false), []);\n\n // eslint-disable-next-line complexity\n const Titles = useMemo(() => {\n if ((isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) && !isDSMobile)\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id` } : undefined)}\n disabled={disabled}\n isDSMobile={isDSMobile}\n selected={selected}\n withSecondaryTitle={secondaryTitle}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled} selected={selected}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n <DSPopperJS referenceElement={referenceElement} showPopover={showPopover}>\n <StyledTooltipContent>\n <p>{title}</p>\n <p> {secondaryTitle}</p>\n </StyledTooltipContent>\n </DSPopperJS>\n </>\n );\n\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id` } : undefined)}\n disabled={disabled}\n isDSMobile={isDSMobile}\n selected={selected}\n withSecondaryTitle={secondaryTitle}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled} selected={selected}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n </>\n );\n }, [\n disabled,\n isDSMobile,\n isPrimaryShowingEllipsis,\n isSecondaryShowingEllipsis,\n referenceElement,\n secondaryTitle,\n setPrimaryElement,\n setSecondaryElement,\n showPopover,\n selected,\n title,\n ]);\n\n return (\n <StyledItemContainer data-testid={DSAccordionDataTestid.ITEM.CONTAINER} className={className} {...xstyledAttrs}>\n <StyledItemHeaderContainer disabled={disabled} ref={setReferenceElement}>\n <StyledItemHeader\n type=\"button\"\n withCustomActions={(customActions?.length > 0 || renderCustomActions !== undefined) && !isDSMobile}\n withSecondaryTitle={secondaryTitle}\n onClick={handleOnClick}\n tabIndex={!disabled ? 0 : undefined}\n disabled={disabled}\n data-disabled={disabled}\n ref={allChildrenReferences[dsIndex]}\n onKeyDown={onKeyDownWithIndex}\n isDSMobile={isDSMobile}\n data-testid={DSAccordionDataTestid.ITEM.HEADER}\n id={`ds-accordion-header-${value}`}\n aria-expanded={selected}\n aria-disabled={disabled}\n aria-controls={`ds-accordion-content-${value}`}\n onFocus={handleOnFocus}\n onBlur={handleOnBlur}\n {...globalAttrs}\n >\n <StyledItemAddon disabled={disabled} isDSMobile={isDSMobile}>\n {selected ? <IconOpened isDSMobile={isDSMobile} /> : <IconClosed isDSMobile={isDSMobile} />}\n </StyledItemAddon>\n <StyledItemTitles\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n isDSMobile={isDSMobile}\n withSecondaryTitle={secondaryTitle}\n selected={selected}\n >\n {Titles}\n </StyledItemTitles>\n </StyledItemHeader>\n {CustomActionsContent}\n </StyledItemHeaderContainer>\n {selected && (\n <StyledItemContent\n data-testid={DSAccordionDataTestid.ITEM.CONTENT}\n aria-labelledby={`ds-accordion-header-${value}`}\n role=\"region\"\n isDSMobile={isDSMobile}\n id={`ds-accordion-content-${value}`}\n >\n {children}\n </StyledItemContent>\n )}\n </StyledItemContainer>\n );\n};\n\nDSAccordionItem.displayName = 'DSAccordionItem';\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;AC6EX,SAyCJ,UAzCI,KA4DE,YA5DF;AA3EZ,SAAgB,UAAU,YAAY,aAAa,eAAe;AAClE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,UAAU,mBAAmB;AACtC,SAAS,kBAAkB;AAC3B,SAAS,iCAAiC;AAC1C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B;AACtC,SAAS,8BAA8B;AAGvC,MAAM,kBAAkB,CAAC,UAA+C;AACtE,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA;AAAA,EACF;AAEA,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA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
|
{
|
|
2
2
|
"name": "@elliemae/ds-accordion",
|
|
3
|
-
"version": "3.12.0-rc.
|
|
3
|
+
"version": "3.12.0-rc.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Accordion",
|
|
6
6
|
"files": [
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"indent": 4
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@elliemae/ds-button": "3.12.0-rc.
|
|
87
|
-
"@elliemae/ds-icons": "3.12.0-rc.
|
|
88
|
-
"@elliemae/ds-popperjs": "3.12.0-rc.
|
|
89
|
-
"@elliemae/ds-system": "3.12.0-rc.
|
|
90
|
-
"@elliemae/ds-utilities": "3.12.0-rc.
|
|
86
|
+
"@elliemae/ds-button": "3.12.0-rc.4",
|
|
87
|
+
"@elliemae/ds-icons": "3.12.0-rc.4",
|
|
88
|
+
"@elliemae/ds-popperjs": "3.12.0-rc.4",
|
|
89
|
+
"@elliemae/ds-system": "3.12.0-rc.4",
|
|
90
|
+
"@elliemae/ds-utilities": "3.12.0-rc.4"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@testing-library/jest-dom": "~5.16.4",
|