@elliemae/ds-accordion 3.0.0-next.9 → 3.0.1
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 +14 -21
- package/dist/cjs/DSAccordion.js.map +2 -2
- package/dist/cjs/DSAccordionCTX.js +10 -26
- package/dist/cjs/DSAccordionCTX.js.map +2 -2
- package/dist/cjs/config/useAccordion.js +11 -18
- package/dist/cjs/config/useAccordion.js.map +2 -2
- package/dist/cjs/config/useAccordionRefs.js +9 -16
- package/dist/cjs/config/useAccordionRefs.js.map +2 -2
- package/dist/cjs/defaultProps.js +13 -19
- package/dist/cjs/defaultProps.js.map +2 -2
- package/dist/cjs/exported-related/DSAccordionDatatestid.js +35 -0
- package/dist/cjs/{DSAccordionDatatestid.js.map → exported-related/DSAccordionDatatestid.js.map} +2 -2
- package/dist/cjs/exported-related/index.js +23 -0
- package/dist/cjs/exported-related/index.js.map +7 -0
- package/dist/cjs/exported-related/theming.js +47 -0
- package/dist/cjs/exported-related/theming.js.map +7 -0
- package/dist/cjs/index.js +13 -18
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/parts/accordionContent/AccordionContent.js +30 -24
- package/dist/cjs/parts/accordionContent/AccordionContent.js.map +2 -2
- package/dist/cjs/parts/accordionContent/styles.js +38 -0
- package/dist/cjs/parts/accordionContent/styles.js.map +7 -0
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js +70 -57
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js.map +2 -2
- package/dist/cjs/parts/accordionItem/styles.js +101 -47
- package/dist/cjs/parts/accordionItem/styles.js.map +2 -2
- package/dist/cjs/parts/accordionItem/useAccordionItem.js +15 -16
- package/dist/cjs/parts/accordionItem/useAccordionItem.js.map +2 -2
- package/dist/cjs/propTypes.js +26 -33
- package/dist/cjs/propTypes.js.map +3 -3
- package/dist/cjs/react-desc-prop-types.js +67 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/sharedTypes.js +20 -0
- package/dist/cjs/sharedTypes.js.map +7 -0
- package/dist/esm/DSAccordion.js +3 -3
- package/dist/esm/DSAccordion.js.map +2 -2
- package/dist/esm/DSAccordionCTX.js +1 -10
- package/dist/esm/DSAccordionCTX.js.map +2 -2
- package/dist/esm/config/useAccordion.js +1 -1
- package/dist/esm/config/useAccordion.js.map +2 -2
- package/dist/esm/config/useAccordionRefs.js.map +2 -2
- package/dist/esm/defaultProps.js +4 -3
- package/dist/esm/defaultProps.js.map +2 -2
- package/dist/esm/{DSAccordionDatatestid.js → exported-related/DSAccordionDatatestid.js} +0 -0
- package/dist/esm/{DSAccordionDatatestid.js.map → exported-related/DSAccordionDatatestid.js.map} +2 -2
- package/dist/esm/exported-related/index.js +4 -0
- package/dist/esm/exported-related/index.js.map +7 -0
- package/dist/esm/exported-related/theming.js +25 -0
- package/dist/esm/exported-related/theming.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/parts/accordionContent/AccordionContent.js +21 -8
- package/dist/esm/parts/accordionContent/AccordionContent.js.map +2 -2
- package/dist/esm/parts/accordionContent/styles.js +16 -0
- package/dist/esm/parts/accordionContent/styles.js.map +7 -0
- package/dist/esm/parts/accordionItem/DSAccordionItem.js +66 -39
- package/dist/esm/parts/accordionItem/DSAccordionItem.js.map +2 -2
- package/dist/esm/parts/accordionItem/styles.js +92 -31
- package/dist/esm/parts/accordionItem/styles.js.map +2 -2
- package/dist/esm/parts/accordionItem/useAccordionItem.js +6 -0
- package/dist/esm/parts/accordionItem/useAccordionItem.js.map +2 -2
- package/dist/esm/propTypes.js +1 -1
- package/dist/esm/propTypes.js.map +3 -3
- package/dist/esm/react-desc-prop-types.js +47 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/sharedTypes.js +2 -0
- package/dist/esm/{DSAccordionTypes.js.map → sharedTypes.js.map} +0 -0
- package/package.json +19 -19
- package/dist/cjs/DSAccordionDatatestid.js +0 -42
- package/dist/cjs/DSAccordionTypes.js +0 -27
- package/dist/cjs/DSAccordionTypes.js.map +0 -7
- package/dist/esm/DSAccordionTypes.js +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSAccordion.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { WeakValidationMap } from 'react';\nimport { describe } from '@elliemae/ds-
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,cAAc,CAAC,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { WeakValidationMap } 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';\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 = 'DSAccordion';\nconst DSAccordionWithSchema = describe(DSAccordion);\nDSAccordionWithSchema.propTypes = accordionPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordion, DSAccordionWithSchema };\n\nexport default DSAccordion;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,cAAc,CAAC,UAA2C;AAC9D,QAAM,MAAM,aAAa,KAAK;AAE9B,SACE,qCAAC,mBAAmB,UAAnB;AAAA,IAA4B,OAAO;AAAA,KAClC,qCAAC,sBAAiB,CACpB;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,wBAAwB,SAAS,WAAW;AAClD,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createContext } from "react";
|
|
3
|
-
|
|
4
|
-
const noop = () => {
|
|
5
|
-
};
|
|
6
|
-
const defaultContext = {
|
|
7
|
-
props: defaultProps,
|
|
8
|
-
actualActiveValue: [],
|
|
9
|
-
setActiveValues: noop,
|
|
10
|
-
focusableChildrenReferences: [],
|
|
11
|
-
allChildrenReferences: {}
|
|
12
|
-
};
|
|
3
|
+
const defaultContext = {};
|
|
13
4
|
const DSAccordionContext = createContext(defaultContext);
|
|
14
5
|
export {
|
|
15
6
|
DSAccordionContext
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSAccordionCTX.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport {
|
|
5
|
-
"mappings": "AAAA;ACAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { createContext } from 'react';\nimport type { DSAccordionT } from './react-desc-prop-types';\nimport type { DSAccordionInternalsT } from './sharedTypes';\n\ninterface DSAccordionContextT {\n props: DSAccordionT.InternalProps;\n actualActiveValue: DSAccordionInternalsT.InternalActiveValue;\n setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;\n focusableChildrenReferences: DSAccordionInternalsT.FocusableChildrenReferences[];\n allChildrenReferences: DSAccordionInternalsT.AllChildrenReferences;\n}\n\nconst defaultContext = {} as DSAccordionContextT;\n\nexport const DSAccordionContext = createContext<DSAccordionContextT>(defaultContext);\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAYA,MAAM,iBAAiB,CAAC;AAEjB,MAAM,qBAAqB,cAAmC,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { useMemo, useState, useCallback } from "react";
|
|
3
|
-
import { useMemoMergePropsWithDefault } from "@elliemae/ds-
|
|
3
|
+
import { useMemoMergePropsWithDefault } from "@elliemae/ds-utilities";
|
|
4
4
|
import { useAccordionRefs } from "./useAccordionRefs";
|
|
5
5
|
import { defaultProps } from "../defaultProps";
|
|
6
6
|
const useAccordion = (props) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAccordion.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useState, useCallback } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;AACA;AACA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo, useState, useCallback } from 'react';\nimport { useMemoMergePropsWithDefault } from '@elliemae/ds-utilities';\nimport { useAccordionRefs } from './useAccordionRefs';\nimport { defaultProps } from '../defaultProps';\nimport type { DSAccordionT } from '../react-desc-prop-types';\nimport type { DSAccordionInternalsT } from '../sharedTypes';\n\ninterface DSAccordionUseAccordionContextT {\n props: DSAccordionT.InternalProps;\n actualActiveValue: DSAccordionInternalsT.InternalActiveValue;\n setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;\n focusableChildrenReferences: DSAccordionInternalsT.FocusableChildrenReferences[];\n allChildrenReferences: DSAccordionInternalsT.AllChildrenReferences;\n}\n\nexport const useAccordion = (props: DSAccordionT.Props): DSAccordionUseAccordionContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps) as DSAccordionT.InternalProps;\n\n const { activeValue, allowMultipleOpen, onChange } = propsWithDefaults;\n\n const { focusableChildrenReferences, allChildrenReferences } = useAccordionRefs(propsWithDefaults);\n\n const [internalActiveValue, setInternalActiveValue] =\n useState<DSAccordionInternalsT.InternalActiveValue>(activeValue);\n\n const actualActiveValue = useMemo(() => {\n if (activeValue === undefined) return internalActiveValue;\n return activeValue;\n }, [activeValue, internalActiveValue]);\n\n const setActiveValues = useCallback(\n (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => {\n let newState: DSAccordionInternalsT.InternalActiveValue;\n if (allowMultipleOpen && (actualActiveValue === undefined || actualActiveValue === null)) newState = [value];\n else if (allowMultipleOpen && Array.isArray(actualActiveValue))\n if (!actualActiveValue.some((currentValues: string | number) => currentValues === value))\n newState = [...actualActiveValue, value];\n else newState = actualActiveValue.filter((currentValues: string | number) => currentValues !== value);\n else if (actualActiveValue === value) newState = null;\n else newState = value;\n setInternalActiveValue(newState);\n return onChange(newState, e);\n },\n [actualActiveValue, allowMultipleOpen, onChange],\n );\n\n const ctx = useMemo(\n () => ({\n props: propsWithDefaults,\n actualActiveValue,\n setActiveValues,\n focusableChildrenReferences,\n allChildrenReferences,\n }),\n [actualActiveValue, allChildrenReferences, focusableChildrenReferences, propsWithDefaults, setActiveValues],\n );\n\n return ctx;\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AAYO,MAAM,eAAe,CAAC,UAA+D;AAC1F,QAAM,oBAAoB,6BAA6B,OAAO,YAAY;AAE1E,QAAM,EAAE,aAAa,mBAAmB,aAAa;AAErD,QAAM,EAAE,6BAA6B,0BAA0B,iBAAiB,iBAAiB;AAEjG,QAAM,CAAC,qBAAqB,0BAC1B,SAAoD,WAAW;AAEjE,QAAM,oBAAoB,QAAQ,MAAM;AACtC,QAAI,gBAAgB;AAAW,aAAO;AACtC,WAAO;AAAA,EACT,GAAG,CAAC,aAAa,mBAAmB,CAAC;AAErC,QAAM,kBAAkB,YACtB,CAAC,OAAwB,MAA8C;AACrE,QAAI;AACJ,QAAI,qBAAsB,uBAAsB,UAAa,sBAAsB;AAAO,iBAAW,CAAC,KAAK;AAAA,aAClG,qBAAqB,MAAM,QAAQ,iBAAiB;AAC3D,UAAI,CAAC,kBAAkB,KAAK,CAAC,kBAAmC,kBAAkB,KAAK;AACrF,mBAAW,CAAC,GAAG,mBAAmB,KAAK;AAAA;AACpC,mBAAW,kBAAkB,OAAO,CAAC,kBAAmC,kBAAkB,KAAK;AAAA,aAC7F,sBAAsB;AAAO,iBAAW;AAAA;AAC5C,iBAAW;AAChB,2BAAuB,QAAQ;AAC/B,WAAO,SAAS,UAAU,CAAC;AAAA,EAC7B,GACA,CAAC,mBAAmB,mBAAmB,QAAQ,CACjD;AAEA,QAAM,MAAM,QACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACA,CAAC,mBAAmB,uBAAuB,6BAA6B,mBAAmB,eAAe,CAC5G;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAccordionRefs.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport type {\n
|
|
5
|
-
"mappings": "AAAA;ACAA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useMemo } from 'react';\nimport type { DSAccordionT } from 'react-desc-prop-types';\nimport type { DSAccordionInternalsT } from '../sharedTypes';\n\ninterface UseAccordionRefsPropsT {\n children: React.ReactElement<DSAccordionT.InternalItemProps>[];\n}\n\ninterface UseAccordionRefsReturnTypeT {\n focusableChildrenReferences: DSAccordionInternalsT.FocusableChildrenReferences[];\n allChildrenReferences: DSAccordionInternalsT.AllChildrenReferences;\n}\n\nexport const useAccordionRefs = ({ children }: UseAccordionRefsPropsT): UseAccordionRefsReturnTypeT =>\n useMemo(() => {\n const focusableChildrenReferences: DSAccordionInternalsT.FocusableChildrenReferences[] = [];\n const allChildrenReferences: DSAccordionInternalsT.AllChildrenReferences = {};\n\n React.Children.map(children, (child: React.ReactElement<DSAccordionT.InternalItemProps>, index) => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { value, disabled } = child.props;\n const currentRef = React.createRef<HTMLButtonElement>();\n allChildrenReferences[index] = currentRef;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n if (!disabled) focusableChildrenReferences.push({ index, value, ref: currentRef });\n });\n return { focusableChildrenReferences, allChildrenReferences };\n }, [children]);\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAaO,MAAM,mBAAmB,CAAC,EAAE,eACjC,QAAQ,MAAM;AACZ,QAAM,8BAAmF,CAAC;AAC1F,QAAM,wBAAqE,CAAC;AAE5E,SAAM,SAAS,IAAI,UAAU,CAAC,OAA2D,UAAU;AAEjG,UAAM,EAAE,OAAO,aAAa,MAAM;AAClC,UAAM,aAAa,OAAM,UAA6B;AACtD,0BAAsB,SAAS;AAE/B,QAAI,CAAC;AAAU,kCAA4B,KAAK,EAAE,OAAO,OAAO,KAAK,WAAW,CAAC;AAAA,EACnF,CAAC;AACD,SAAO,EAAE,6BAA6B,sBAAsB;AAC9D,GAAG,CAAC,QAAQ,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/defaultProps.js
CHANGED
|
@@ -2,12 +2,14 @@ import * as React from "react";
|
|
|
2
2
|
import React2, { memo } from "react";
|
|
3
3
|
import { ArrowheadRight, ArrowheadDown, ChevronRight, ChevronDown } from "@elliemae/ds-icons";
|
|
4
4
|
const DefaultIconClosed = memo(({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ React2.createElement(ChevronRight, {
|
|
5
|
-
width: "20px"
|
|
5
|
+
width: "20px",
|
|
6
|
+
color: ["brand", "800"]
|
|
6
7
|
}) : /* @__PURE__ */ React2.createElement(ArrowheadRight, {
|
|
7
8
|
width: "20px"
|
|
8
9
|
}));
|
|
9
10
|
const DefaultIconOpen = memo(({ isDSMobile = false }) => isDSMobile ? /* @__PURE__ */ React2.createElement(ChevronDown, {
|
|
10
|
-
width: "20px"
|
|
11
|
+
width: "20px",
|
|
12
|
+
color: ["brand", "800"]
|
|
11
13
|
}) : /* @__PURE__ */ React2.createElement(ArrowheadDown, {
|
|
12
14
|
width: "20px"
|
|
13
15
|
}));
|
|
@@ -16,7 +18,6 @@ const noop = () => {
|
|
|
16
18
|
const defaultProps = {
|
|
17
19
|
containerProps: {},
|
|
18
20
|
allowMultipleOpen: false,
|
|
19
|
-
contentExpandable: false,
|
|
20
21
|
onChange: noop,
|
|
21
22
|
children: [],
|
|
22
23
|
isDSMobile: false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/defaultProps.tsx"],
|
|
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 {
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;
|
|
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', '800']} /> : <ArrowheadRight width=\"20px\" />,\n);\n\nconst DefaultIconOpen = memo(({ isDSMobile = false }: DSAccordionInternalsT.DefaultIconProps) =>\n isDSMobile ? <ChevronDown width=\"20px\" color={['brand', '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;ACAA;AACA;AAIA,MAAM,oBAAoB,KAAK,CAAC,EAAE,aAAa,YAC7C,aAAa,qCAAC;AAAA,EAAa,OAAM;AAAA,EAAO,OAAO,CAAC,SAAS,KAAK;AAAA,CAAG,IAAK,qCAAC;AAAA,EAAe,OAAM;AAAA,CAAO,CACrG;AAEA,MAAM,kBAAkB,KAAK,CAAC,EAAE,aAAa,YAC3C,aAAa,qCAAC;AAAA,EAAY,OAAM;AAAA,EAAO,OAAO,CAAC,SAAS,KAAK;AAAA,CAAG,IAAK,qCAAC;AAAA,EAAc,OAAM;AAAA,CAAO,CACnG;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
|
}
|
|
File without changes
|
package/dist/esm/{DSAccordionDatatestid.js.map → exported-related/DSAccordionDatatestid.js.map}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/DSAccordionDatatestid.ts"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSAccordionDataTestid = {\n ITEM: {\n CONTENT: 'ds-accordion_item-content',\n HEADER: 'ds-accordion_item-header',\n CONTAINER: 'ds-accordion_item',\n },\n GROUP: 'ds-accordion_group',\n};\n"],
|
|
5
|
-
"mappings": "AAAA;ACAO,MAAM,wBAAwB;AAAA,EACnC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,WAAW;AAAA;AAAA,
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,wBAAwB;AAAA,EACnC,MAAM;AAAA,IACJ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,WAAW;AAAA,EACb;AAAA,EACA,OAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSAccordionDatatestid';\nexport * from './theming';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const COMPONENT_NAME = "DS-Accordion";
|
|
3
|
+
const slots = {
|
|
4
|
+
CONTAINER: "root",
|
|
5
|
+
ITEM: {
|
|
6
|
+
CONTAINER: "item-container",
|
|
7
|
+
HEADER: {
|
|
8
|
+
CONTAINER: "item-header-container",
|
|
9
|
+
ADDON: "item-header-addon",
|
|
10
|
+
TITLE_CONTAINER: "item-header-titles-container",
|
|
11
|
+
PRIMARY_TITLE: "item-header-primary-title",
|
|
12
|
+
SECONDARY_TITLE: "item-header-secondary-title",
|
|
13
|
+
CUSTOM_ACTIONS_CONTAINER: "item-header-custom-actions-container",
|
|
14
|
+
TOOLTIP: "item-header-tooltip"
|
|
15
|
+
},
|
|
16
|
+
CONTENT: {
|
|
17
|
+
CONTAINER: "item-content-container"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
COMPONENT_NAME,
|
|
23
|
+
slots
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=theming.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/exported-related/theming.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const COMPONENT_NAME = 'DS-Accordion';\n\nexport const slots = {\n CONTAINER: 'root',\n ITEM: {\n CONTAINER: 'item-container',\n HEADER: {\n CONTAINER: 'item-header-container',\n ADDON: 'item-header-addon',\n TITLE_CONTAINER: 'item-header-titles-container',\n PRIMARY_TITLE: 'item-header-primary-title',\n SECONDARY_TITLE: 'item-header-secondary-title',\n CUSTOM_ACTIONS_CONTAINER: 'item-header-custom-actions-container',\n TOOLTIP: 'item-header-tooltip',\n },\n CONTENT: {\n CONTAINER: 'item-content-container',\n },\n },\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,iBAAiB;AAEvB,MAAM,QAAQ;AAAA,EACnB,WAAW;AAAA,EACX,MAAM;AAAA,IACJ,WAAW;AAAA,IACX,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,OAAO;AAAA,MACP,iBAAiB;AAAA,MACjB,eAAe;AAAA,MACf,iBAAiB;AAAA,MACjB,0BAA0B;AAAA,MAC1B,SAAS;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACP,WAAW;AAAA,IACb;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSAccordion';\nexport * from './parts/accordionItem/DSAccordionItem';\
|
|
5
|
-
"mappings": "AAAA;ACAA;AACA;
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSAccordion';\nexport * from './parts/accordionItem/DSAccordionItem';\nexport * from './exported-related';\n\nexport { default } from './DSAccordion';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,22 +14,37 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
20
29
|
import * as React from "react";
|
|
21
30
|
import React2, { useContext } from "react";
|
|
31
|
+
import { useGetGlobalAttributes, useGetXstyledProps } from "@elliemae/ds-utilities";
|
|
22
32
|
import { DSAccordionContext } from "../../DSAccordionCTX";
|
|
23
|
-
import { DSAccordionDataTestid } from "../../DSAccordionDatatestid";
|
|
33
|
+
import { DSAccordionDataTestid } from "../../exported-related/DSAccordionDatatestid";
|
|
34
|
+
import { StyledContainer } from "./styles";
|
|
24
35
|
const AccordionContent = () => {
|
|
25
36
|
const {
|
|
26
|
-
props:
|
|
27
|
-
} = useContext(DSAccordionContext);
|
|
37
|
+
props: _a
|
|
38
|
+
} = useContext(DSAccordionContext), _b = _a, { containerProps, children } = _b, rest = __objRest(_b, ["containerProps", "children"]);
|
|
28
39
|
const childrenWithIndex = [];
|
|
40
|
+
const xstyledAttrs = useGetXstyledProps(rest);
|
|
41
|
+
const globalAttrs = useGetGlobalAttributes(rest);
|
|
29
42
|
React2.Children.forEach(children, (child, index) => childrenWithIndex.push(React2.cloneElement(child, {
|
|
30
43
|
dsIndex: index
|
|
31
44
|
})));
|
|
32
|
-
return /* @__PURE__ */ React2.createElement(
|
|
45
|
+
return /* @__PURE__ */ React2.createElement(StyledContainer, __spreadValues(__spreadValues(__spreadValues({
|
|
33
46
|
"data-testid": DSAccordionDataTestid.GROUP
|
|
34
|
-
}), childrenWithIndex);
|
|
47
|
+
}, containerProps), globalAttrs), xstyledAttrs), childrenWithIndex);
|
|
35
48
|
};
|
|
36
49
|
export {
|
|
37
50
|
AccordionContent
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionContent/AccordionContent.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useContext } from 'react';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../DSAccordionDatatestid';\nimport type {
|
|
5
|
-
"mappings": "
|
|
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, ...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;ACAA;AACA;AACA;AACA;AACA;AAGO,MAAM,mBAAmB,MAAmB;AACjD,QACS;AAAA,IAAP,OAAO;AAAA,MACL,WAAW,kBAAkB,GADxB,SAAE,kBAAgB,aAAlB,IAA+B,iBAA/B,IAA+B,CAA7B,kBAAgB;AAG3B,QAAM,oBAA0E,CAAC;AAEjF,QAAM,eAAe,mBAAmB,IAAI;AAE5C,QAAM,cAAc,uBAAuB,IAAI;AAE/C,SAAM,SAAS,QAAQ,UAAU,CAAC,OAAO,UACvC,kBAAkB,KAChB,OAAM,aAAa,OAAO;AAAA,IACxB,SAAS;AAAA,EACX,CAAC,CACH,CACF;AAEA,SACE,qCAAC;AAAA,IAAgB,eAAa,sBAAsB;AAAA,KAAW,iBAAoB,cAAiB,eACjG,iBACH;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styled } from "@elliemae/ds-system";
|
|
3
|
+
import { sizing, space, layout } from "@xstyled/styled-components";
|
|
4
|
+
import { COMPONENT_NAME, slots } from "../../exported-related";
|
|
5
|
+
const StyledContainer = styled("div", {
|
|
6
|
+
name: COMPONENT_NAME,
|
|
7
|
+
slot: slots.CONTAINER
|
|
8
|
+
})`
|
|
9
|
+
${sizing}
|
|
10
|
+
${space}
|
|
11
|
+
${layout}
|
|
12
|
+
`;
|
|
13
|
+
export {
|
|
14
|
+
StyledContainer
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionContent/styles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { styled } from '@elliemae/ds-system';\nimport { sizing, space, layout } from '@xstyled/styled-components';\nimport { COMPONENT_NAME, slots } from '../../exported-related';\n\nexport const StyledContainer = styled('div', {\n name: COMPONENT_NAME,\n slot: slots.CONTAINER,\n})`\n ${sizing}\n ${space}\n ${layout}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AAEO,MAAM,kBAAkB,OAAO,OAAO;AAAA,EAC3C,MAAM;AAAA,EACN,MAAM,MAAM;AACd,CAAC;AAAA,IACG;AAAA,IACA;AAAA,IACA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -31,10 +31,15 @@ var __objRest = (source, exclude) => {
|
|
|
31
31
|
};
|
|
32
32
|
import * as React from "react";
|
|
33
33
|
import React2, { useState, useContext, useCallback, useMemo } from "react";
|
|
34
|
-
import {
|
|
34
|
+
import {
|
|
35
|
+
useMemoMergePropsWithDefault,
|
|
36
|
+
describe,
|
|
37
|
+
useIsShowingEllipsis,
|
|
38
|
+
useGetGlobalAttributes,
|
|
39
|
+
useGetXstyledProps
|
|
40
|
+
} from "@elliemae/ds-utilities";
|
|
35
41
|
import { DSButton, BUTTON_TYPE } from "@elliemae/ds-button";
|
|
36
42
|
import { DSPopperJS } from "@elliemae/ds-popperjs";
|
|
37
|
-
import { useIsShowingEllipsis } from "@elliemae/ds-utilities";
|
|
38
43
|
import { accordionItemDefaultProps } from "../../defaultProps";
|
|
39
44
|
import {
|
|
40
45
|
StyledItemAddon,
|
|
@@ -45,15 +50,16 @@ import {
|
|
|
45
50
|
StyledItemHeaderContainer,
|
|
46
51
|
StyledItemTitles,
|
|
47
52
|
StyledPrimaryTitle,
|
|
48
|
-
StyledSecondaryTitle
|
|
53
|
+
StyledSecondaryTitle,
|
|
54
|
+
StyledTooltipContent
|
|
49
55
|
} from "./styles";
|
|
50
|
-
import { accordionItemPropTypes } from "../../propTypes";
|
|
51
56
|
import { useAccordionItem } from "./useAccordionItem";
|
|
52
57
|
import { DSAccordionContext } from "../../DSAccordionCTX";
|
|
53
|
-
import { DSAccordionDataTestid } from "../../DSAccordionDatatestid";
|
|
58
|
+
import { DSAccordionDataTestid } from "../../exported-related/DSAccordionDatatestid";
|
|
59
|
+
import { accordionItemPropTypes } from "../../react-desc-prop-types";
|
|
54
60
|
const DSAccordionItem = (props) => {
|
|
55
61
|
const propsWithDefaults = useMemoMergePropsWithDefault(props, accordionItemDefaultProps);
|
|
56
|
-
const {
|
|
62
|
+
const _a = propsWithDefaults, {
|
|
57
63
|
children,
|
|
58
64
|
title,
|
|
59
65
|
secondaryTitle,
|
|
@@ -64,7 +70,20 @@ const DSAccordionItem = (props) => {
|
|
|
64
70
|
disabled,
|
|
65
71
|
dsIndex,
|
|
66
72
|
renderCustomActions
|
|
67
|
-
} =
|
|
73
|
+
} = _a, rest = __objRest(_a, [
|
|
74
|
+
"children",
|
|
75
|
+
"title",
|
|
76
|
+
"secondaryTitle",
|
|
77
|
+
"customActions",
|
|
78
|
+
"iconOpened",
|
|
79
|
+
"iconClosed",
|
|
80
|
+
"value",
|
|
81
|
+
"disabled",
|
|
82
|
+
"dsIndex",
|
|
83
|
+
"renderCustomActions"
|
|
84
|
+
]);
|
|
85
|
+
const _b = useGetGlobalAttributes(rest), { className } = _b, globalAttrs = __objRest(_b, ["className"]);
|
|
86
|
+
const xstyledAttrs = useGetXstyledProps(rest);
|
|
68
87
|
const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled });
|
|
69
88
|
const {
|
|
70
89
|
allChildrenReferences,
|
|
@@ -78,8 +97,10 @@ const DSAccordionItem = (props) => {
|
|
|
78
97
|
const [referenceElement, setReferenceElement] = useState();
|
|
79
98
|
const CustomActionsContent = useMemo(() => {
|
|
80
99
|
if (!isDSMobile && customActions?.length > 0)
|
|
81
|
-
return /* @__PURE__ */ React2.createElement(StyledItemCustomActions,
|
|
82
|
-
|
|
100
|
+
return /* @__PURE__ */ React2.createElement(StyledItemCustomActions, {
|
|
101
|
+
isDSMobile
|
|
102
|
+
}, customActions?.map((_a2) => {
|
|
103
|
+
var _b2 = _a2, { onClick, id } = _b2, otherProps = __objRest(_b2, ["onClick", "id"]);
|
|
83
104
|
return /* @__PURE__ */ React2.createElement(DSButton, __spreadProps(__spreadValues({
|
|
84
105
|
key: id,
|
|
85
106
|
onClick: (e) => {
|
|
@@ -87,12 +108,14 @@ const DSAccordionItem = (props) => {
|
|
|
87
108
|
if (onClick)
|
|
88
109
|
onClick(e);
|
|
89
110
|
}
|
|
90
|
-
},
|
|
111
|
+
}, otherProps), {
|
|
91
112
|
buttonType: BUTTON_TYPE.SECONDARY
|
|
92
113
|
}));
|
|
93
114
|
}));
|
|
94
115
|
if (!isDSMobile && renderCustomActions)
|
|
95
|
-
return /* @__PURE__ */ React2.createElement(StyledItemCustomActions,
|
|
116
|
+
return /* @__PURE__ */ React2.createElement(StyledItemCustomActions, {
|
|
117
|
+
isDSMobile
|
|
118
|
+
}, renderCustomActions({ allRefs: allChildrenReferences, actualActiveValue }));
|
|
96
119
|
return null;
|
|
97
120
|
}, [actualActiveValue, allChildrenReferences, customActions, isDSMobile, renderCustomActions]);
|
|
98
121
|
const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();
|
|
@@ -100,33 +123,33 @@ const DSAccordionItem = (props) => {
|
|
|
100
123
|
const handleOnFocus = useCallback(() => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis), [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis]);
|
|
101
124
|
const handleOnBlur = useCallback(() => setShowPopover(false), []);
|
|
102
125
|
const Titles = useMemo(() => {
|
|
103
|
-
if (isPrimaryShowingEllipsis || isSecondaryShowingEllipsis)
|
|
104
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, {
|
|
105
|
-
ref: setPrimaryElement
|
|
106
|
-
|
|
126
|
+
if ((isPrimaryShowingEllipsis || isSecondaryShowingEllipsis) && !isDSMobile)
|
|
127
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, __spreadProps(__spreadValues({
|
|
128
|
+
ref: setPrimaryElement
|
|
129
|
+
}, title ? { id: `accordion_${title || ""}id` } : void 0), {
|
|
107
130
|
disabled,
|
|
108
|
-
isDSMobile
|
|
109
|
-
|
|
131
|
+
isDSMobile,
|
|
132
|
+
selected,
|
|
133
|
+
withSecondaryTitle: secondaryTitle
|
|
134
|
+
}), title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
|
|
110
135
|
ref: setSecondaryElement,
|
|
111
|
-
disabled
|
|
136
|
+
disabled,
|
|
137
|
+
selected
|
|
112
138
|
}, secondaryTitle), /* @__PURE__ */ React2.createElement(DSPopperJS, {
|
|
113
139
|
referenceElement,
|
|
114
140
|
showPopover
|
|
115
|
-
}, /* @__PURE__ */ React2.createElement("
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}, title), /* @__PURE__ */ React2.createElement("p", {
|
|
120
|
-
style: { margin: 0 }
|
|
121
|
-
}, " ", secondaryTitle))));
|
|
122
|
-
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, {
|
|
123
|
-
ref: setPrimaryElement,
|
|
124
|
-
id: `accordion_${title}id`,
|
|
141
|
+
}, /* @__PURE__ */ React2.createElement(StyledTooltipContent, null, /* @__PURE__ */ React2.createElement("p", null, title), /* @__PURE__ */ React2.createElement("p", null, " ", secondaryTitle))));
|
|
142
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledPrimaryTitle, __spreadProps(__spreadValues({
|
|
143
|
+
ref: setPrimaryElement
|
|
144
|
+
}, title ? { id: `accordion_${title || ""}id` } : void 0), {
|
|
125
145
|
disabled,
|
|
126
|
-
isDSMobile
|
|
127
|
-
|
|
146
|
+
isDSMobile,
|
|
147
|
+
selected,
|
|
148
|
+
withSecondaryTitle: secondaryTitle
|
|
149
|
+
}), title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
|
|
128
150
|
ref: setSecondaryElement,
|
|
129
|
-
disabled
|
|
151
|
+
disabled,
|
|
152
|
+
selected
|
|
130
153
|
}, secondaryTitle));
|
|
131
154
|
}, [
|
|
132
155
|
disabled,
|
|
@@ -138,13 +161,16 @@ const DSAccordionItem = (props) => {
|
|
|
138
161
|
setPrimaryElement,
|
|
139
162
|
setSecondaryElement,
|
|
140
163
|
showPopover,
|
|
164
|
+
selected,
|
|
141
165
|
title
|
|
142
166
|
]);
|
|
143
|
-
return /* @__PURE__ */ React2.createElement(StyledItemContainer, {
|
|
144
|
-
"data-testid": DSAccordionDataTestid.ITEM.CONTAINER
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
167
|
+
return /* @__PURE__ */ React2.createElement(StyledItemContainer, __spreadValues({
|
|
168
|
+
"data-testid": DSAccordionDataTestid.ITEM.CONTAINER,
|
|
169
|
+
className
|
|
170
|
+
}, xstyledAttrs), /* @__PURE__ */ React2.createElement(StyledItemHeaderContainer, {
|
|
171
|
+
disabled,
|
|
172
|
+
ref: setReferenceElement
|
|
173
|
+
}, /* @__PURE__ */ React2.createElement(StyledItemHeader, __spreadValues({
|
|
148
174
|
withCustomActions: (customActions?.length > 0 || renderCustomActions !== void 0) && !isDSMobile,
|
|
149
175
|
withSecondaryTitle: secondaryTitle,
|
|
150
176
|
onClick: handleOnClick,
|
|
@@ -161,7 +187,7 @@ const DSAccordionItem = (props) => {
|
|
|
161
187
|
"aria-controls": `ds-accordion-content-${value}`,
|
|
162
188
|
onFocus: handleOnFocus,
|
|
163
189
|
onBlur: handleOnBlur
|
|
164
|
-
}, /* @__PURE__ */ React2.createElement(StyledItemAddon, {
|
|
190
|
+
}, globalAttrs), /* @__PURE__ */ React2.createElement(StyledItemAddon, {
|
|
165
191
|
disabled,
|
|
166
192
|
isDSMobile
|
|
167
193
|
}, selected ? /* @__PURE__ */ React2.createElement(IconOpened, {
|
|
@@ -172,7 +198,8 @@ const DSAccordionItem = (props) => {
|
|
|
172
198
|
onMouseEnter: handleOnFocus,
|
|
173
199
|
onMouseLeave: handleOnBlur,
|
|
174
200
|
isDSMobile,
|
|
175
|
-
|
|
201
|
+
withSecondaryTitle: secondaryTitle,
|
|
202
|
+
selected
|
|
176
203
|
}, Titles)), CustomActionsContent), selected && /* @__PURE__ */ React2.createElement(StyledItemContent, {
|
|
177
204
|
"data-testid": DSAccordionDataTestid.ITEM.CONTENT,
|
|
178
205
|
"aria-labelledby": `ds-accordion-header-${value}`,
|
|
@@ -181,7 +208,7 @@ const DSAccordionItem = (props) => {
|
|
|
181
208
|
id: `ds-accordion-content-${value}`
|
|
182
209
|
}, children));
|
|
183
210
|
};
|
|
184
|
-
DSAccordionItem.
|
|
211
|
+
DSAccordionItem.displayName = "DSAccordionItem";
|
|
185
212
|
const DSAccordionItemWithSchema = describe(DSAccordionItem);
|
|
186
213
|
DSAccordionItemWithSchema.propTypes = accordionItemPropTypes;
|
|
187
214
|
var DSAccordionItem_default = DSAccordionItem;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionItem/DSAccordionItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useState, useContext, useCallback, useMemo, WeakValidationMap } from 'react';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACCA;AACA;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\nimport React, { useState, useContext, useCallback, useMemo, WeakValidationMap } 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 ...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)\n return (\n <StyledItemCustomActions isDSMobile={isDSMobile}>\n {renderCustomActions({ allRefs: allChildrenReferences, actualActiveValue })}\n </StyledItemCustomActions>\n );\n return null;\n }, [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 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;ACCA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA;AACA;AACA;AACA;AAGA,MAAM,kBAAkB,CAAC,UAA+C;AACt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