@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.
Files changed (72) hide show
  1. package/dist/cjs/DSAccordion.js +14 -21
  2. package/dist/cjs/DSAccordion.js.map +2 -2
  3. package/dist/cjs/DSAccordionCTX.js +10 -26
  4. package/dist/cjs/DSAccordionCTX.js.map +2 -2
  5. package/dist/cjs/config/useAccordion.js +11 -18
  6. package/dist/cjs/config/useAccordion.js.map +2 -2
  7. package/dist/cjs/config/useAccordionRefs.js +9 -16
  8. package/dist/cjs/config/useAccordionRefs.js.map +2 -2
  9. package/dist/cjs/defaultProps.js +13 -19
  10. package/dist/cjs/defaultProps.js.map +2 -2
  11. package/dist/cjs/exported-related/DSAccordionDatatestid.js +35 -0
  12. package/dist/cjs/{DSAccordionDatatestid.js.map → exported-related/DSAccordionDatatestid.js.map} +2 -2
  13. package/dist/cjs/exported-related/index.js +23 -0
  14. package/dist/cjs/exported-related/index.js.map +7 -0
  15. package/dist/cjs/exported-related/theming.js +47 -0
  16. package/dist/cjs/exported-related/theming.js.map +7 -0
  17. package/dist/cjs/index.js +13 -18
  18. package/dist/cjs/index.js.map +3 -3
  19. package/dist/cjs/parts/accordionContent/AccordionContent.js +30 -24
  20. package/dist/cjs/parts/accordionContent/AccordionContent.js.map +2 -2
  21. package/dist/cjs/parts/accordionContent/styles.js +38 -0
  22. package/dist/cjs/parts/accordionContent/styles.js.map +7 -0
  23. package/dist/cjs/parts/accordionItem/DSAccordionItem.js +70 -57
  24. package/dist/cjs/parts/accordionItem/DSAccordionItem.js.map +2 -2
  25. package/dist/cjs/parts/accordionItem/styles.js +101 -47
  26. package/dist/cjs/parts/accordionItem/styles.js.map +2 -2
  27. package/dist/cjs/parts/accordionItem/useAccordionItem.js +15 -16
  28. package/dist/cjs/parts/accordionItem/useAccordionItem.js.map +2 -2
  29. package/dist/cjs/propTypes.js +26 -33
  30. package/dist/cjs/propTypes.js.map +3 -3
  31. package/dist/cjs/react-desc-prop-types.js +67 -0
  32. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  33. package/dist/cjs/sharedTypes.js +20 -0
  34. package/dist/cjs/sharedTypes.js.map +7 -0
  35. package/dist/esm/DSAccordion.js +3 -3
  36. package/dist/esm/DSAccordion.js.map +2 -2
  37. package/dist/esm/DSAccordionCTX.js +1 -10
  38. package/dist/esm/DSAccordionCTX.js.map +2 -2
  39. package/dist/esm/config/useAccordion.js +1 -1
  40. package/dist/esm/config/useAccordion.js.map +2 -2
  41. package/dist/esm/config/useAccordionRefs.js.map +2 -2
  42. package/dist/esm/defaultProps.js +4 -3
  43. package/dist/esm/defaultProps.js.map +2 -2
  44. package/dist/esm/{DSAccordionDatatestid.js → exported-related/DSAccordionDatatestid.js} +0 -0
  45. package/dist/esm/{DSAccordionDatatestid.js.map → exported-related/DSAccordionDatatestid.js.map} +2 -2
  46. package/dist/esm/exported-related/index.js +4 -0
  47. package/dist/esm/exported-related/index.js.map +7 -0
  48. package/dist/esm/exported-related/theming.js +25 -0
  49. package/dist/esm/exported-related/theming.js.map +7 -0
  50. package/dist/esm/index.js +1 -0
  51. package/dist/esm/index.js.map +3 -3
  52. package/dist/esm/parts/accordionContent/AccordionContent.js +21 -8
  53. package/dist/esm/parts/accordionContent/AccordionContent.js.map +2 -2
  54. package/dist/esm/parts/accordionContent/styles.js +16 -0
  55. package/dist/esm/parts/accordionContent/styles.js.map +7 -0
  56. package/dist/esm/parts/accordionItem/DSAccordionItem.js +66 -39
  57. package/dist/esm/parts/accordionItem/DSAccordionItem.js.map +2 -2
  58. package/dist/esm/parts/accordionItem/styles.js +92 -31
  59. package/dist/esm/parts/accordionItem/styles.js.map +2 -2
  60. package/dist/esm/parts/accordionItem/useAccordionItem.js +6 -0
  61. package/dist/esm/parts/accordionItem/useAccordionItem.js.map +2 -2
  62. package/dist/esm/propTypes.js +1 -1
  63. package/dist/esm/propTypes.js.map +3 -3
  64. package/dist/esm/react-desc-prop-types.js +47 -0
  65. package/dist/esm/react-desc-prop-types.js.map +7 -0
  66. package/dist/esm/sharedTypes.js +2 -0
  67. package/dist/esm/{DSAccordionTypes.js.map → sharedTypes.js.map} +0 -0
  68. package/package.json +19 -19
  69. package/dist/cjs/DSAccordionDatatestid.js +0 -42
  70. package/dist/cjs/DSAccordionTypes.js +0 -27
  71. package/dist/cjs/DSAccordionTypes.js.map +0 -7
  72. 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-props-helpers';\nimport { AccordionContent } from './parts/accordionContent/AccordionContent';\nimport { useAccordion } from './config/useAccordion';\nimport { DSAccordionContext } from './DSAccordionCTX';\nimport { accordionPropTypes } from './propTypes';\nimport type { DSAccordionPropsT } from './DSAccordionTypes';\n\nconst DSAccordion = (props: DSAccordionPropsT): JSX.Element => {\n const ctx = useAccordion(props);\n\n return (\n <DSAccordionContext.Provider value={ctx}>\n <AccordionContent />\n </DSAccordionContext.Provider>\n );\n};\n\nDSAccordion.propTypes = accordionPropTypes;\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,UAA0C;AAC7D,QAAM,MAAM,aAAa;AAEzB,SACE,qCAAC,mBAAmB,UAApB;AAAA,IAA6B,OAAO;AAAA,KAClC,qCAAC,kBAAD;AAAA;AAKN,YAAY,YAAY;AACxB,MAAM,wBAAwB,SAAS;AACvC,sBAAsB,YAAY;AAIlC,IAAO,sBAAQ;",
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
- import { defaultProps } from "./defaultProps";
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 { defaultProps } from './defaultProps';\nimport type { DSAccordionContextT } from './DSAccordionTypes';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nconst defaultContext = {\n props: defaultProps,\n actualActiveValue: [],\n setActiveValues: noop,\n focusableChildrenReferences: [],\n allChildrenReferences: {},\n};\n\nexport const DSAccordionContext = createContext<DSAccordionContextT>(defaultContext);\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAIA,MAAM,OAAO,MAAY;AAAA;AAEzB,MAAM,iBAAiB;AAAA,EACrB,OAAO;AAAA,EACP,mBAAmB;AAAA,EACnB,iBAAiB;AAAA,EACjB,6BAA6B;AAAA,EAC7B,uBAAuB;AAAA;AAGlB,MAAM,qBAAqB,cAAmC;",
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-props-helpers";
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-props-helpers';\nimport { useAccordionRefs } from './useAccordionRefs';\nimport { defaultProps } from '../defaultProps';\nimport type {\n DSAccordionPropsT,\n DSAccordionUseAccordionContextT,\n DSAccordionPropsWithDefaultsT,\n InternalActiveValueT,\n} from '../DSAccordionTypes';\n\nexport const useAccordion = (props: DSAccordionPropsT): DSAccordionUseAccordionContextT => {\n const propsWithDefaults = useMemoMergePropsWithDefault(props, defaultProps) as DSAccordionPropsWithDefaultsT;\n\n const { activeValue, allowMultipleOpen, onChange } = propsWithDefaults;\n\n const { focusableChildrenReferences, allChildrenReferences } = useAccordionRefs(propsWithDefaults);\n\n const [internalActiveValue, setInternalActiveValue] = useState<InternalActiveValueT>(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: InternalActiveValueT;\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;AAQO,MAAM,eAAe,CAAC,UAA8D;AACzF,QAAM,oBAAoB,6BAA6B,OAAO;AAE9D,QAAM,EAAE,aAAa,mBAAmB,aAAa;AAErD,QAAM,EAAE,6BAA6B,0BAA0B,iBAAiB;AAEhF,QAAM,CAAC,qBAAqB,0BAA0B,SAA+B;AAErF,QAAM,oBAAoB,QAAQ,MAAM;AACtC,QAAI,gBAAgB;AAAW,aAAO;AACtC,WAAO;AAAA,KACN,CAAC,aAAa;AAEjB,QAAM,kBAAkB,YACtB,CAAC,OAAwB,MAA8C;AACrE,QAAI;AACJ,QAAI,qBAAsB,uBAAsB,UAAa,sBAAsB;AAAO,iBAAW,CAAC;AAAA,aAC7F,qBAAqB,MAAM,QAAQ;AAC1C,UAAI,CAAC,kBAAkB,KAAK,CAAC,kBAAmC,kBAAkB;AAChF,mBAAW,CAAC,GAAG,mBAAmB;AAAA;AAC/B,mBAAW,kBAAkB,OAAO,CAAC,kBAAmC,kBAAkB;AAAA,aACxF,sBAAsB;AAAO,iBAAW;AAAA;AAC5C,iBAAW;AAChB,2BAAuB;AACvB,WAAO,SAAS,UAAU;AAAA,KAE5B,CAAC,mBAAmB,mBAAmB;AAGzC,QAAM,MAAM,QACV,MAAO;AAAA,IACL,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEF,CAAC,mBAAmB,uBAAuB,6BAA6B,mBAAmB;AAG7F,SAAO;AAAA;",
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 UseAccordionRefsPropsT,\n UseAccordionRefsReturnTypeT,\n FocusableChildrenReferences,\n AllChildrenReferences,\n} from '../DSAccordionTypes';\n\nexport const useAccordionRefs = ({ children }: UseAccordionRefsPropsT): UseAccordionRefsReturnTypeT =>\n useMemo(() => {\n const focusableChildrenReferences: FocusableChildrenReferences[] = [];\n const allChildrenReferences: AllChildrenReferences = {};\n\n React.Children.map(children, (child, index) => {\n const { value, disabled } = child.props;\n const currentRef = React.createRef<HTMLButtonElement>();\n allChildrenReferences[index] = currentRef;\n if (!disabled) focusableChildrenReferences.push({ index, value, ref: currentRef });\n });\n return { focusableChildrenReferences, allChildrenReferences };\n }, [children]);\n"],
5
- "mappings": "AAAA;ACAA;AAQO,MAAM,mBAAmB,CAAC,EAAE,eACjC,QAAQ,MAAM;AACZ,QAAM,8BAA6D;AACnE,QAAM,wBAA+C;AAErD,SAAM,SAAS,IAAI,UAAU,CAAC,OAAO,UAAU;AAC7C,UAAM,EAAE,OAAO,aAAa,MAAM;AAClC,UAAM,aAAa,OAAM;AACzB,0BAAsB,SAAS;AAC/B,QAAI,CAAC;AAAU,kCAA4B,KAAK,EAAE,OAAO,OAAO,KAAK;AAAA;AAEvE,SAAO,EAAE,6BAA6B;AAAA,GACrC,CAAC;",
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
  }
@@ -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 { DefaultIconPropsT, DSAccordionDefaultPropsT, DSAccordionItemDefaultPropsT } from './DSAccordionTypes';\n\nconst DefaultIconClosed = memo(({ isDSMobile = false }: DefaultIconPropsT) =>\n isDSMobile ? <ChevronRight width=\"20px\" /> : <ArrowheadRight width=\"20px\" />,\n);\n\nconst DefaultIconOpen = memo(({ isDSMobile = false }: DefaultIconPropsT) =>\n isDSMobile ? <ChevronDown width=\"20px\" /> : <ArrowheadDown width=\"20px\" />,\n);\n\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nconst noop = (): void => {};\n\nexport const defaultProps: DSAccordionDefaultPropsT = {\n containerProps: {},\n allowMultipleOpen: false,\n contentExpandable: false,\n onChange: noop,\n children: [],\n isDSMobile: false,\n};\n\nexport const accordionItemDefaultProps: DSAccordionItemDefaultPropsT = {\n iconClosed: DefaultIconClosed,\n iconOpened: DefaultIconOpen,\n title: '',\n customActions: [],\n disabled: false,\n};\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAGA,MAAM,oBAAoB,KAAK,CAAC,EAAE,aAAa,YAC7C,aAAa,qCAAC,cAAD;AAAA,EAAc,OAAM;AAAA,KAAY,qCAAC,gBAAD;AAAA,EAAgB,OAAM;AAAA;AAGrE,MAAM,kBAAkB,KAAK,CAAC,EAAE,aAAa,YAC3C,aAAa,qCAAC,aAAD;AAAA,EAAa,OAAM;AAAA,KAAY,qCAAC,eAAD;AAAA,EAAe,OAAM;AAAA;AAInE,MAAM,OAAO,MAAY;AAAA;AAElB,MAAM,eAAyC;AAAA,EACpD,gBAAgB;AAAA,EAChB,mBAAmB;AAAA,EACnB,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,UAAU;AAAA,EACV,YAAY;AAAA;AAGP,MAAM,4BAA0D;AAAA,EACrE,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,eAAe;AAAA,EACf,UAAU;AAAA;",
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
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSAccordionDatatestid.tsx"],
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,EAEb,OAAO;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,4 @@
1
+ import * as React from "react";
2
+ export * from "./DSAccordionDatatestid";
3
+ export * from "./theming";
4
+ //# sourceMappingURL=index.js.map
@@ -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
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
2
  export * from "./DSAccordion";
3
3
  export * from "./parts/accordionItem/DSAccordionItem";
4
+ export * from "./exported-related";
4
5
  import { default as default2 } from "./DSAccordion";
5
6
  export {
6
7
  default2 as default
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSAccordion';\nexport * from './parts/accordionItem/DSAccordionItem';\n\nexport type { DSAccordionPropsT, DSAccordionItemPropsT } from './DSAccordionTypes';\n\nexport { default } from './DSAccordion';\n"],
5
- "mappings": "AAAA;ACAA;AACA;AAIA;",
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 __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
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: { containerProps, children }
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("div", __spreadProps(__spreadValues({}, containerProps), {
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 { DSAccordionItemPropsT } from '../../DSAccordionTypes';\n\nexport const AccordionContent = (): JSX.Element => {\n const {\n props: { containerProps, children },\n } = useContext(DSAccordionContext);\n\n const childrenWithIndex: React.ReactElement<DSAccordionItemPropsT>[] = [];\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 <div {...containerProps} data-testid={DSAccordionDataTestid.GROUP}>\n {childrenWithIndex}\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAGO,MAAM,mBAAmB,MAAmB;AACjD,QAAM;AAAA,IACJ,OAAO,EAAE,gBAAgB;AAAA,MACvB,WAAW;AAEf,QAAM,oBAAiE;AAEvE,SAAM,SAAS,QAAQ,UAAU,CAAC,OAAO,UACvC,kBAAkB,KAChB,OAAM,aAAa,OAAO;AAAA,IACxB,SAAS;AAAA;AAKf,SACE,qCAAC,OAAD,iCAAS,iBAAT;AAAA,IAAyB,eAAa,sBAAsB;AAAA,MACzD;AAAA;",
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 { useMemoMergePropsWithDefault, describe } from "@elliemae/ds-props-helpers";
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
- } = propsWithDefaults;
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, null, customActions?.map((_a) => {
82
- var _b = _a, { onClick, id } = _b, rest = __objRest(_b, ["onClick", "id"]);
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
- }, rest), {
111
+ }, otherProps), {
91
112
  buttonType: BUTTON_TYPE.SECONDARY
92
113
  }));
93
114
  }));
94
115
  if (!isDSMobile && renderCustomActions)
95
- return /* @__PURE__ */ React2.createElement(StyledItemCustomActions, null, renderCustomActions({ allRefs: allChildrenReferences, actualActiveValue }));
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
- id: `accordion_${title}id`,
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
- }, title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
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("div", {
116
- style: { maxWidth: 260, padding: 8, background: "white", display: "grid", gap: 8 }
117
- }, /* @__PURE__ */ React2.createElement("p", {
118
- style: { margin: 0 }
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
- }, title), !isDSMobile && secondaryTitle && /* @__PURE__ */ React2.createElement(StyledSecondaryTitle, {
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
- }, /* @__PURE__ */ React2.createElement(StyledItemHeaderContainer, {
146
- disabled
147
- }, /* @__PURE__ */ React2.createElement(StyledItemHeader, {
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
- ref: setReferenceElement
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.propTypes = accordionItemPropTypes;
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 { useMemoMergePropsWithDefault, describe } from '@elliemae/ds-props-helpers';\nimport { DSButton, BUTTON_TYPE } from '@elliemae/ds-button';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport { useIsShowingEllipsis } from '@elliemae/ds-utilities';\nimport { accordionItemDefaultProps } from '../../defaultProps';\nimport {\n StyledItemAddon,\n StyledItemContainer,\n StyledItemContent,\n StyledItemCustomActions,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledItemTitles,\n StyledPrimaryTitle,\n StyledSecondaryTitle,\n} from './styles';\nimport { accordionItemPropTypes } from '../../propTypes';\nimport { useAccordionItem } from './useAccordionItem';\nimport { DSAccordionContext } from '../../DSAccordionCTX';\nimport { DSAccordionDataTestid } from '../../DSAccordionDatatestid';\nimport type { DSAccordionItemPropsT, DSAccordionItemPropsWithDefaultsT } from '../../DSAccordionTypes';\n\nconst DSAccordionItem = (props: DSAccordionItemPropsT): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionItemPropsWithDefaultsT;\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 } = propsWithDefaults;\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>\n {customActions?.map(({ onClick, id, ...rest }) => (\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 {...rest}\n buttonType={BUTTON_TYPE.SECONDARY}\n />\n ))}\n </StyledItemCustomActions>\n );\n\n if (!isDSMobile && renderCustomActions)\n return (\n <StyledItemCustomActions>\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 const Titles = useMemo(() => {\n if (isPrimaryShowingEllipsis || isSecondaryShowingEllipsis)\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n id={`accordion_${title}id`}\n disabled={disabled}\n isDSMobile={isDSMobile}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled}>\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n <DSPopperJS referenceElement={referenceElement} showPopover={showPopover}>\n <div style={{ maxWidth: 260, padding: 8, background: 'white', display: 'grid', gap: 8 }}>\n <p style={{ margin: 0 }}>{title}</p>\n <p style={{ margin: 0 }}> {secondaryTitle}</p>\n </div>\n </DSPopperJS>\n </>\n );\n\n return (\n <>\n <StyledPrimaryTitle\n ref={setPrimaryElement}\n id={`accordion_${title}id`}\n disabled={disabled}\n isDSMobile={isDSMobile}\n >\n {title}\n </StyledPrimaryTitle>\n {!isDSMobile && secondaryTitle && (\n <StyledSecondaryTitle ref={setSecondaryElement} disabled={disabled}>\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 title,\n ]);\n\n return (\n <StyledItemContainer data-testid={DSAccordionDataTestid.ITEM.CONTAINER}>\n <StyledItemHeaderContainer disabled={disabled}>\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 >\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 ref={setReferenceElement}\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.propTypes = accordionItemPropTypes;\n\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes as WeakValidationMap<unknown>;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACCA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AACA;AACA;AACA;AAGA,MAAM,kBAAkB,CAAC,UAA8C;AACrE,QAAM,oBAAoB,6BACxB,OACA;AAGF,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,EAAE,eAAe,iBAAiB,aAAa,iBAAiB,EAAE,OAAO;AAC/E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,OAAO,EAAE;AAAA,MACP,WAAW;AAEf,QAAM,qBAAqB,YACzB,CAAC,MAA2B;AAC1B,oBAAgB,GAAG;AAAA,KAErB,CAAC,SAAS;AAGZ,QAAM,CAAC,aAAa,kBAAkB,SAAS;AAC/C,QAAM,CAAC,kBAAkB,uBAAuB;AAEhD,QAAM,uBAAuB,QAAQ,MAAM;AACzC,QAAI,CAAC,cAAc,eAAe,SAAS;AACzC,aACE,qCAAC,yBAAD,MACG,eAAe,IAAI,CAAC,OAA0B;AAA1B,qBAAE,WAAS,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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;AACtE,QAAM,oBAAoB,6BACxB,OACA,yBACF;AAEA,QAYI,wBAXF;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MAEE,IADC,iBACD,IADC;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAIF,QAAsC,4BAAuB,IAAI,GAAzD,gBAA8B,IAAhB,wBAAgB,IAAhB,CAAd;AACR,QAAM,eAAe,mBAAmB,IAAI;AAE5C,QAAM,EAAE,eAAe,iBAAiB,aAAa,iBAAiB,EAAE,OAAO,SAAS,CAAC;AACzF,QAAM;AAAA,IACJ;AAAA,IACA;AA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