@elliemae/ds-accordion 3.62.1 → 3.70.0-alpha.9

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 (39) hide show
  1. package/dist/cjs/constants/index.js +3 -0
  2. package/dist/cjs/constants/index.js.map +2 -2
  3. package/dist/cjs/parts/accordionItem/DSAccordionItem.js +126 -221
  4. package/dist/cjs/parts/accordionItem/DSAccordionItem.js.map +2 -2
  5. package/dist/cjs/parts/accordionItem/ItemCustomActions.js +84 -0
  6. package/dist/cjs/parts/accordionItem/ItemCustomActions.js.map +7 -0
  7. package/dist/cjs/parts/accordionItem/ItemTitle.js +172 -0
  8. package/dist/cjs/parts/accordionItem/ItemTitle.js.map +7 -0
  9. package/dist/cjs/parts/accordionItem/styles.js +69 -14
  10. package/dist/cjs/parts/accordionItem/styles.js.map +2 -2
  11. package/dist/cjs/parts/accordionItem/useAccordionItem.js +4 -2
  12. package/dist/cjs/parts/accordionItem/useAccordionItem.js.map +2 -2
  13. package/dist/esm/constants/index.js +3 -0
  14. package/dist/esm/constants/index.js.map +2 -2
  15. package/dist/esm/parts/accordionItem/DSAccordionItem.js +128 -227
  16. package/dist/esm/parts/accordionItem/DSAccordionItem.js.map +2 -2
  17. package/dist/esm/parts/accordionItem/ItemCustomActions.js +54 -0
  18. package/dist/esm/parts/accordionItem/ItemCustomActions.js.map +7 -0
  19. package/dist/esm/parts/accordionItem/ItemTitle.js +142 -0
  20. package/dist/esm/parts/accordionItem/ItemTitle.js.map +7 -0
  21. package/dist/esm/parts/accordionItem/styles.js +69 -14
  22. package/dist/esm/parts/accordionItem/styles.js.map +2 -2
  23. package/dist/esm/parts/accordionItem/useAccordionItem.js +4 -2
  24. package/dist/esm/parts/accordionItem/useAccordionItem.js.map +2 -2
  25. package/dist/types/constants/index.d.ts +4 -0
  26. package/dist/types/parts/accordionItem/ItemCustomActions.d.ts +14 -0
  27. package/dist/types/parts/accordionItem/ItemTitle.d.ts +23 -0
  28. package/dist/types/parts/accordionItem/styles.d.ts +6 -4
  29. package/dist/types/parts/accordionItem/useAccordionItem.d.ts +1 -0
  30. package/package.json +11 -11
  31. package/dist/types/tests/DSAccordion.a11y.test.d.ts +0 -1
  32. package/dist/types/tests/DSAccordion.callback.test.d.ts +0 -1
  33. package/dist/types/tests/DSAccordion.data-testid.test.d.ts +0 -1
  34. package/dist/types/tests/DSAccordion.events.test.d.ts +0 -1
  35. package/dist/types/tests/DSAccordion.exports.test.d.ts +0 -1
  36. package/dist/types/tests/DSAccordion.get-owner-props.test.d.ts +0 -1
  37. package/dist/types/tests/DSAccordion.keyboard.test.d.ts +0 -1
  38. package/dist/types/tests/DSAccordion.test.d.ts +0 -1
  39. package/dist/types/typescript-testing/typescript-accordion-valid.d.ts +0 -1
@@ -1,8 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { BUTTON_TYPES, DSButtonV2 } from "@elliemae/ds-button-v2";
4
- import { Grid } from "@elliemae/ds-grid";
5
- import { DSPopperJS } from "@elliemae/ds-popperjs";
3
+ import { useFloatingContext, FloatingWrapper, PopoverArrow } from "@elliemae/ds-floating-context";
6
4
  import {
7
5
  describe,
8
6
  useGetGlobalAttributes,
@@ -10,21 +8,19 @@ import {
10
8
  useMemoMergePropsWithDefault
11
9
  } from "@elliemae/ds-props-helpers";
12
10
  import { mergeRefs } from "@elliemae/ds-system";
13
- import { useCallback, useContext, useMemo, useState } from "react";
11
+ import { useCallback, useContext, useState } from "react";
14
12
  import { DSAccordionContext } from "../../DSAccordionCTX.js";
15
13
  import { DSAccordionDataTestid } from "../../constants/index.js";
16
14
  import { accordionItemDefaultProps } from "../../defaultProps.js";
17
15
  import { accordionItemPropTypes } from "../../react-desc-prop-types.js";
16
+ import { ItemCustomActions } from "./ItemCustomActions.js";
17
+ import { ItemTitle } from "./ItemTitle.js";
18
18
  import {
19
- StyledItemAddon,
20
19
  StyledItemContainer,
21
20
  StyledItemContent,
22
- StyledItemCustomActions,
21
+ StyledItemDetails,
23
22
  StyledItemHeader,
24
23
  StyledItemHeaderContainer,
25
- StyledItemTitles,
26
- StyledPrimaryTitle,
27
- StyledSecondaryTitle,
28
24
  StyledTooltipContent
29
25
  } from "./styles.js";
30
26
  import { useAccordionItem } from "./useAccordionItem.js";
@@ -55,7 +51,7 @@ const DSAccordionItem = (props) => {
55
51
  wrapLabel,
56
52
  ...rest
57
53
  } = propsWithDefaults;
58
- const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled, applyAriaDisabled });
54
+ const { handleOnKeyDown, toggle, selected } = useAccordionItem({ value, disabled, applyAriaDisabled });
59
55
  const xstyledAttrs = useGetXstyledProps(rest);
60
56
  const xstyledContentAttrs = useGetXstyledProps(xStyledPropsContent);
61
57
  const {
@@ -65,56 +61,44 @@ const DSAccordionItem = (props) => {
65
61
  } = useContext(DSAccordionContext);
66
62
  const [showPopover, setShowPopover] = useState(false);
67
63
  const [referenceElement, setReferenceElement] = useState(null);
68
- const CustomActionsContent = useMemo(() => {
69
- if (!isDSMobile && customActions?.length > 0)
70
- return /* @__PURE__ */ jsx(
71
- StyledItemCustomActions,
72
- {
73
- isDSMobile,
74
- getOwnerProps,
75
- getOwnerPropsArguments,
76
- children: customActions?.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ jsx(
77
- DSButtonV2,
78
- {
79
- onClick: (e) => {
80
- e.stopPropagation();
81
- if (onClick) onClick(e);
82
- },
83
- ...otherProps,
84
- buttonType: BUTTON_TYPES.OUTLINE
85
- },
86
- id
87
- ))
88
- }
89
- );
90
- if (!isDSMobile && (renderCustomActions || CustomActions))
91
- return /* @__PURE__ */ jsx(
92
- StyledItemCustomActions,
93
- {
94
- isDSMobile,
95
- getOwnerProps,
96
- getOwnerPropsArguments,
97
- children: CustomActions !== void 0 ? /* @__PURE__ */ jsx(CustomActions, { allRefs: allChildrenReferences, actualActiveValue }) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })
98
- }
99
- );
100
- return null;
101
- }, [
102
- CustomActions,
103
- actualActiveValue,
104
- allChildrenReferences,
105
- customActions,
106
- getOwnerProps,
107
- getOwnerPropsArguments,
108
- isDSMobile,
109
- renderCustomActions
110
- ]);
111
64
  const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();
112
65
  const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();
113
- const onKeyDownWithIndex = useCallback(
66
+ const isTooltipOpen = !selected && showPopover;
67
+ const {
68
+ refs: floatingRefs,
69
+ floatingStyles,
70
+ arrowStyles,
71
+ context: floatingContext,
72
+ isOpen: isFloatingOpen
73
+ } = useFloatingContext({
74
+ externallyControlledIsOpen: isTooltipOpen,
75
+ externalReferenceElement: referenceElement,
76
+ withoutAnimation: true,
77
+ customOffset: [0, 14]
78
+ });
79
+ const handleSummaryClick = useCallback(
80
+ (e) => {
81
+ e.preventDefault();
82
+ toggle(e);
83
+ },
84
+ [toggle]
85
+ );
86
+ const handleSummaryKeyDown = useCallback(
114
87
  (e) => {
88
+ if (e.key === "Enter" || e.key === " ") {
89
+ e.preventDefault();
90
+ toggle(e);
91
+ return;
92
+ }
115
93
  handleOnKeyDown(e, dsIndex);
116
94
  },
117
- [dsIndex, handleOnKeyDown]
95
+ [toggle, handleOnKeyDown, dsIndex]
96
+ );
97
+ const handleSummaryMouseDown = useCallback(
98
+ (e) => {
99
+ if (disabled) e.preventDefault();
100
+ },
101
+ [disabled]
118
102
  );
119
103
  const handleOnFocus = useCallback(
120
104
  () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),
@@ -122,225 +106,142 @@ const DSAccordionItem = (props) => {
122
106
  );
123
107
  const handleOnBlur = useCallback(() => setShowPopover(false), []);
124
108
  const { className, ...globalAttrs } = useGetGlobalAttributes(rest, {
125
- onClick: handleOnClick,
109
+ onClick: handleSummaryClick,
126
110
  onFocus: handleOnFocus,
127
111
  onBlur: handleOnBlur
128
112
  });
129
113
  const handlers = {
130
- onClick: handleOnClick,
114
+ onClick: handleSummaryClick,
115
+ onKeyDown: handleSummaryKeyDown,
116
+ onMouseDown: handleSummaryMouseDown,
131
117
  onFocus: handleOnFocus,
132
118
  onBlur: handleOnBlur
133
119
  };
134
- const titleDesktop = useMemo(
135
- () => /* @__PURE__ */ jsxs(
136
- Grid,
137
- {
138
- onMouseEnter: handleOnFocus,
139
- onMouseLeave: handleOnBlur,
140
- cols: ["auto", "1fr"],
141
- padding: "6px 0px",
142
- marginRight: "20px",
143
- width: "100%",
144
- children: [
145
- /* @__PURE__ */ jsx(
146
- StyledItemAddon,
147
- {
148
- disabled,
149
- applyAriaDisabled,
150
- getOwnerProps,
151
- getOwnerPropsArguments,
152
- children: selected ? /* @__PURE__ */ jsx(IconOpened, {}) : /* @__PURE__ */ jsx(IconClosed, {})
153
- }
154
- ),
155
- /* @__PURE__ */ jsxs(Grid, { rows: secondaryTitle ? ["auto", "auto"] : ["auto"], rowGap: secondaryTitle ? "3px" : "0px", children: [
156
- /* @__PURE__ */ jsx(
157
- StyledItemTitles,
158
- {
159
- withSecondaryTitle: secondaryTitle,
160
- selected,
161
- getOwnerProps,
162
- getOwnerPropsArguments,
163
- children: /* @__PURE__ */ jsx(
164
- StyledPrimaryTitle,
165
- {
166
- innerRef: setPrimaryElement,
167
- ...title ? { id: `accordion_${title || ""}id-${value}` } : void 0,
168
- disabled,
169
- applyAriaDisabled,
170
- selected,
171
- withSecondaryTitle: Boolean(secondaryTitle),
172
- getOwnerProps,
173
- getOwnerPropsArguments,
174
- wrapLabel,
175
- children: title
176
- }
177
- )
178
- }
179
- ),
180
- secondaryTitle && /* @__PURE__ */ jsx(
181
- StyledSecondaryTitle,
182
- {
183
- innerRef: setSecondaryElement,
184
- disabled,
185
- applyAriaDisabled,
186
- selected,
187
- getOwnerProps,
188
- getOwnerPropsArguments,
189
- wrapLabel,
190
- children: secondaryTitle
191
- }
192
- )
193
- ] })
194
- ]
195
- }
196
- ),
197
- [
198
- handleOnFocus,
199
- handleOnBlur,
200
- secondaryTitle,
201
- disabled,
202
- applyAriaDisabled,
203
- getOwnerProps,
204
- getOwnerPropsArguments,
205
- selected,
206
- IconOpened,
207
- IconClosed,
208
- setPrimaryElement,
209
- title,
210
- value,
211
- wrapLabel,
212
- setSecondaryElement
213
- ]
214
- );
215
- const titleMobile = useMemo(
216
- () => /* @__PURE__ */ jsx(Grid, { width: "100%", children: /* @__PURE__ */ jsxs(Grid, { cols: ["auto", "20px"], children: [
217
- /* @__PURE__ */ jsx(
218
- StyledItemTitles,
219
- {
220
- onMouseEnter: handleOnFocus,
221
- onMouseLeave: handleOnBlur,
222
- isDSMobile: true,
223
- withSecondaryTitle: secondaryTitle,
224
- selected,
225
- getOwnerProps,
226
- getOwnerPropsArguments,
227
- children: /* @__PURE__ */ jsx(
228
- StyledPrimaryTitle,
229
- {
230
- innerRef: setPrimaryElement,
231
- ...title ? { id: `accordion_${title || ""}id` } : void 0,
232
- disabled,
233
- applyAriaDisabled,
234
- isDSMobile: true,
235
- selected,
236
- withSecondaryTitle: Boolean(secondaryTitle),
237
- getOwnerProps,
238
- getOwnerPropsArguments,
239
- wrapLabel,
240
- children: title
241
- }
242
- )
243
- }
244
- ),
245
- /* @__PURE__ */ jsx(
246
- StyledItemAddon,
247
- {
248
- disabled,
249
- applyAriaDisabled,
250
- isDSMobile: true,
251
- getOwnerProps,
252
- getOwnerPropsArguments,
253
- children: selected ? /* @__PURE__ */ jsx(IconOpened, { isDSMobile: true }) : /* @__PURE__ */ jsx(IconClosed, { isDSMobile: true })
254
- }
255
- )
256
- ] }) }),
257
- [
258
- handleOnFocus,
259
- handleOnBlur,
260
- secondaryTitle,
261
- selected,
262
- getOwnerProps,
263
- getOwnerPropsArguments,
264
- setPrimaryElement,
265
- title,
266
- disabled,
267
- applyAriaDisabled,
268
- wrapLabel,
269
- IconOpened,
270
- IconClosed
271
- ]
272
- );
120
+ const headerId = `ds-accordion-header-${value}`;
121
+ const contentId = `ds-accordion-content-${value}`;
122
+ const withCustomActions = (customActions?.length > 0 || renderCustomActions !== void 0 || CustomActions !== void 0) && !isDSMobile;
273
123
  return /* @__PURE__ */ jsxs(
274
124
  StyledItemContainer,
275
125
  {
276
126
  "data-testid": DSAccordionDataTestid.ITEM_CONTAINER,
277
127
  className,
278
128
  ...xstyledAttrs,
129
+ disabled,
130
+ applyAriaDisabled,
279
131
  getOwnerProps,
280
132
  getOwnerPropsArguments,
281
133
  children: [
282
134
  /* @__PURE__ */ jsxs(
283
- StyledItemHeaderContainer,
135
+ StyledItemDetails,
284
136
  {
285
- disabled,
286
- applyAriaDisabled,
287
- innerRef: (HTMLNode) => setReferenceElement(HTMLNode ?? null),
137
+ open: selected,
138
+ "data-testid": DSAccordionDataTestid.ITEM_DETAILS,
288
139
  getOwnerProps,
289
140
  getOwnerPropsArguments,
290
141
  children: [
291
142
  /* @__PURE__ */ jsxs(
292
143
  StyledItemHeader,
293
144
  {
294
- withCustomActions: (customActions?.length > 0 || renderCustomActions !== void 0) && !isDSMobile,
145
+ withCustomActions,
295
146
  withSecondaryTitle: secondaryTitle,
296
- tabIndex: !disabled ? 0 : void 0,
147
+ tabIndex: disabled ? -1 : 0,
297
148
  disabled,
298
149
  "data-disabled": disabled,
299
150
  innerRef: mergeRefs(allChildrenReferences[dsIndex], innerRef),
300
- onKeyDown: onKeyDownWithIndex,
301
151
  isDSMobile,
302
152
  "data-testid": DSAccordionDataTestid.ITEM_HEADER,
303
- id: `ds-accordion-header-${value}`,
153
+ id: headerId,
304
154
  "aria-expanded": selected,
305
155
  "aria-disabled": disabled || applyAriaDisabled,
306
156
  applyAriaDisabled,
307
- "aria-controls": `ds-accordion-content-${value}`,
157
+ "aria-controls": contentId,
308
158
  ...handlers,
309
159
  ...globalAttrs,
310
- type: "button",
311
160
  getOwnerProps,
312
161
  getOwnerPropsArguments,
313
162
  children: [
314
- isDSMobile ? titleMobile : titleDesktop,
315
- wrapLabel ? null : /* @__PURE__ */ jsx(DSPopperJS, { referenceElement, showPopover: !selected && showPopover, children: /* @__PURE__ */ jsxs(StyledTooltipContent, { getOwnerProps, getOwnerPropsArguments, children: [
316
- /* @__PURE__ */ jsx("p", { children: title }),
317
- /* @__PURE__ */ jsxs("p", { children: [
318
- " ",
319
- secondaryTitle
320
- ] })
321
- ] }) })
163
+ /* @__PURE__ */ jsx(
164
+ StyledItemHeaderContainer,
165
+ {
166
+ innerRef: (HTMLNode) => setReferenceElement(HTMLNode ?? null),
167
+ getOwnerProps,
168
+ getOwnerPropsArguments,
169
+ children: /* @__PURE__ */ jsx(
170
+ ItemTitle,
171
+ {
172
+ title,
173
+ secondaryTitle,
174
+ value,
175
+ selected,
176
+ disabled,
177
+ applyAriaDisabled,
178
+ wrapLabel,
179
+ isDSMobile,
180
+ IconOpened,
181
+ IconClosed,
182
+ onMouseEnter: handleOnFocus,
183
+ onMouseLeave: handleOnBlur,
184
+ setPrimaryElement,
185
+ setSecondaryElement,
186
+ getOwnerProps,
187
+ getOwnerPropsArguments
188
+ }
189
+ )
190
+ }
191
+ ),
192
+ wrapLabel ? null : /* @__PURE__ */ jsxs(
193
+ FloatingWrapper,
194
+ {
195
+ innerRef: floatingRefs.setFloating,
196
+ isOpen: isFloatingOpen,
197
+ floatingStyles,
198
+ context: floatingContext,
199
+ children: [
200
+ /* @__PURE__ */ jsxs(StyledTooltipContent, { getOwnerProps, getOwnerPropsArguments, children: [
201
+ /* @__PURE__ */ jsx("p", { children: title }),
202
+ /* @__PURE__ */ jsxs("p", { children: [
203
+ " ",
204
+ secondaryTitle
205
+ ] })
206
+ ] }),
207
+ /* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
208
+ ]
209
+ }
210
+ )
322
211
  ]
323
212
  }
324
213
  ),
325
- CustomActionsContent
214
+ (selected || keepContentMounted) && /* @__PURE__ */ jsx(
215
+ StyledItemContent,
216
+ {
217
+ "data-testid": DSAccordionDataTestid.ITEM_CONTENT_CONTAINER,
218
+ "aria-labelledby": headerId,
219
+ role: "region",
220
+ isDSMobile,
221
+ id: contentId,
222
+ ...xstyledContentAttrs,
223
+ selected,
224
+ keepContentMounted,
225
+ applyAriaDisabled,
226
+ getOwnerProps,
227
+ getOwnerPropsArguments,
228
+ children
229
+ }
230
+ )
326
231
  ]
327
232
  }
328
233
  ),
329
- (selected || keepContentMounted) && /* @__PURE__ */ jsx(
330
- StyledItemContent,
234
+ /* @__PURE__ */ jsx(
235
+ ItemCustomActions,
331
236
  {
332
- "data-testid": DSAccordionDataTestid.ITEM_CONTENT_CONTAINER,
333
- "aria-labelledby": `ds-accordion-header-${value}`,
334
- role: "region",
237
+ customActions,
238
+ renderCustomActions,
239
+ CustomActionsComponent: CustomActions,
335
240
  isDSMobile,
336
- id: `ds-accordion-content-${value}`,
337
- ...xstyledContentAttrs,
338
- selected,
339
- keepContentMounted,
340
- applyAriaDisabled,
241
+ allRefs: allChildrenReferences,
242
+ actualActiveValue,
341
243
  getOwnerProps,
342
- getOwnerPropsArguments,
343
- children
244
+ getOwnerPropsArguments
344
245
  }
345
246
  )
346
247
  ]
@@ -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-statements */\n/* eslint-disable max-lines */\nimport { BUTTON_TYPES, DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSPopperJS } from '@elliemae/ds-popperjs';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport React, { useCallback, useContext, useMemo, useState } from 'react';\nimport { DSAccordionContext } from '../../DSAccordionCTX.js';\nimport { DSAccordionDataTestid } from '../../constants/index.js';\nimport { accordionItemDefaultProps } from '../../defaultProps.js';\nimport type { DSAccordionT } from '../../react-desc-prop-types.js';\nimport { accordionItemPropTypes } from '../../react-desc-prop-types.js';\nimport {\n StyledItemAddon,\n StyledItemContainer,\n StyledItemContent,\n StyledItemCustomActions,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledItemTitles,\n StyledPrimaryTitle,\n StyledSecondaryTitle,\n StyledTooltipContent,\n} from './styles.js';\nimport { useAccordionItem } from './useAccordionItem.js';\nimport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\n\nconst DSAccordionItem = (props: DSAccordionT.ItemProps): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionT.InternalItemProps;\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const {\n children,\n title,\n secondaryTitle,\n customActions,\n iconOpened: IconOpened,\n iconClosed: IconClosed,\n value,\n disabled,\n dsIndex,\n renderCustomActions,\n CustomActions,\n xStyledPropsContent,\n keepContentMounted,\n innerRef,\n applyAriaDisabled,\n wrapLabel,\n ...rest\n } = propsWithDefaults;\n\n const { handleOnClick, handleOnKeyDown, selected } = useAccordionItem({ value, disabled, applyAriaDisabled });\n\n const xstyledAttrs = useGetXstyledProps(rest);\n const xstyledContentAttrs = useGetXstyledProps(xStyledPropsContent);\n\n const {\n allChildrenReferences,\n actualActiveValue,\n props: { isDSMobile },\n } = useContext(DSAccordionContext);\n\n const [showPopover, setShowPopover] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const CustomActionsContent = useMemo(() => {\n if (!isDSMobile && customActions?.length > 0)\n return (\n <StyledItemCustomActions\n isDSMobile={isDSMobile}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {customActions?.map(({ onClick, id, ...otherProps }) => (\n <DSButtonV2\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_TYPES.OUTLINE}\n />\n ))}\n </StyledItemCustomActions>\n );\n\n if (!isDSMobile && (renderCustomActions || CustomActions))\n return (\n <StyledItemCustomActions\n isDSMobile={isDSMobile}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {CustomActions !== undefined ? (\n <CustomActions allRefs={allChildrenReferences} actualActiveValue={actualActiveValue} />\n ) : (\n renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })\n )}\n </StyledItemCustomActions>\n );\n return null;\n }, [\n CustomActions,\n actualActiveValue,\n allChildrenReferences,\n customActions,\n getOwnerProps,\n getOwnerPropsArguments,\n isDSMobile,\n renderCustomActions,\n ]);\n\n const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();\n\n const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();\n\n const onKeyDownWithIndex = useCallback(\n (e: React.KeyboardEvent) => {\n handleOnKeyDown(e, dsIndex);\n },\n [dsIndex, handleOnKeyDown],\n );\n const handleOnFocus = useCallback(\n () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),\n [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis],\n );\n\n const handleOnBlur = useCallback(() => setShowPopover(false), []);\n\n const { className, ...globalAttrs } = useGetGlobalAttributes(rest, {\n onClick: handleOnClick,\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const handlers = {\n onClick: handleOnClick,\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n };\n\n const titleDesktop = useMemo(\n () => (\n <Grid\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n cols={['auto', '1fr']}\n padding=\"6px 0px\"\n marginRight=\"20px\"\n width=\"100%\"\n >\n <StyledItemAddon\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {selected ? <IconOpened /> : <IconClosed />}\n </StyledItemAddon>\n <Grid rows={secondaryTitle ? ['auto', 'auto'] : ['auto']} rowGap={secondaryTitle ? '3px' : '0px'}>\n <StyledItemTitles\n withSecondaryTitle={secondaryTitle}\n selected={selected}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledPrimaryTitle\n innerRef={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id-${value}` } : undefined)}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n selected={selected}\n withSecondaryTitle={Boolean(secondaryTitle)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n wrapLabel={wrapLabel}\n >\n {title}\n </StyledPrimaryTitle>\n </StyledItemTitles>\n {secondaryTitle && (\n <StyledSecondaryTitle\n innerRef={setSecondaryElement}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n selected={selected}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n wrapLabel={wrapLabel}\n >\n {secondaryTitle}\n </StyledSecondaryTitle>\n )}\n </Grid>\n </Grid>\n ),\n [\n handleOnFocus,\n handleOnBlur,\n secondaryTitle,\n disabled,\n applyAriaDisabled,\n getOwnerProps,\n getOwnerPropsArguments,\n selected,\n IconOpened,\n IconClosed,\n setPrimaryElement,\n title,\n value,\n wrapLabel,\n setSecondaryElement,\n ],\n );\n\n const titleMobile = useMemo(\n () => (\n <Grid width=\"100%\">\n <Grid cols={['auto', '20px']}>\n <StyledItemTitles\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n isDSMobile\n withSecondaryTitle={secondaryTitle}\n selected={selected}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledPrimaryTitle\n innerRef={setPrimaryElement}\n {...(title ? { id: `accordion_${title || ''}id` } : undefined)}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n isDSMobile\n selected={selected}\n withSecondaryTitle={Boolean(secondaryTitle)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n wrapLabel={wrapLabel}\n >\n {title}\n </StyledPrimaryTitle>\n </StyledItemTitles>\n <StyledItemAddon\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n isDSMobile\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {selected ? <IconOpened isDSMobile /> : <IconClosed isDSMobile />}\n </StyledItemAddon>\n </Grid>\n </Grid>\n ),\n [\n handleOnFocus,\n handleOnBlur,\n secondaryTitle,\n selected,\n getOwnerProps,\n getOwnerPropsArguments,\n setPrimaryElement,\n title,\n disabled,\n applyAriaDisabled,\n wrapLabel,\n IconOpened,\n IconClosed,\n ],\n );\n return (\n <StyledItemContainer\n data-testid={DSAccordionDataTestid.ITEM_CONTAINER}\n className={className}\n {...xstyledAttrs}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledItemHeaderContainer\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n innerRef={(HTMLNode) => setReferenceElement(HTMLNode ?? null)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledItemHeader\n withCustomActions={(customActions?.length > 0 || renderCustomActions !== undefined) && !isDSMobile}\n withSecondaryTitle={secondaryTitle}\n tabIndex={!disabled ? 0 : undefined}\n disabled={disabled}\n data-disabled={disabled}\n innerRef={mergeRefs(allChildrenReferences[dsIndex], innerRef)}\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 || applyAriaDisabled}\n applyAriaDisabled={applyAriaDisabled}\n aria-controls={`ds-accordion-content-${value}`}\n {...handlers}\n {...globalAttrs}\n type=\"button\"\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {isDSMobile ? titleMobile : titleDesktop}\n {wrapLabel ? null : (\n <DSPopperJS referenceElement={referenceElement} showPopover={!selected && showPopover}>\n <StyledTooltipContent getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <p>{title}</p>\n <p> {secondaryTitle}</p>\n </StyledTooltipContent>\n </DSPopperJS>\n )}\n </StyledItemHeader>\n {CustomActionsContent}\n </StyledItemHeaderContainer>\n {(selected || keepContentMounted) && (\n <StyledItemContent\n data-testid={DSAccordionDataTestid.ITEM_CONTENT_CONTAINER}\n aria-labelledby={`ds-accordion-header-${value}`}\n role=\"region\"\n isDSMobile={isDSMobile}\n id={`ds-accordion-content-${value}`}\n {...xstyledContentAttrs}\n selected={selected}\n keepContentMounted={keepContentMounted}\n applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n </StyledItemContent>\n )}\n </StyledItemContainer>\n );\n};\n\nDSAccordionItem.displayName = 'DSAccordionItem';\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes as ValidationMap<unknown>;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n"],
5
- "mappings": "AAAA,YAAY,WAAW;ACsFX,cAsFJ,YAtFI;AApFZ,SAAS,cAAc,kBAAkB;AACzC,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,iBAAiB;AAC1B,SAAgB,aAAa,YAAY,SAAS,gBAAgB;AAClE,SAAS,0BAA0B;AACnC,SAAS,6B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U,UAAU,sBAAsB,OAAO,GAAG,QAAQ;AAAA,kBAC5D,WAAW;AAAA,kBACX;AAAA,kBACA,eAAa,sBAAsB;AAAA,kBACnC,IAAI,uBAAuB,KAAK;AAAA,kBAChC,iBAAe;AAAA,kBACf,iBAAe,YAAY;AAAA,kBAC3B;AAAA,kBACA,iBAAe,wBAAwB,KAAK;AAAA,kBAC3C,GAAG;AAAA,kBACH,GAAG;AAAA,kBACJ,MAAK;AAAA,kBACL;AAAA,kBACA;AAAA,kBAEC;AAAA,iCAAa,cAAc;AAAA,oBAC3B,YAAY,OACX,oBAAC,cAAW,kBAAoC,aAAa,CAAC,YAAY,aACxE,+BAAC,wBAAqB,eAA8B,wBAClD;AAAA,0CAAC,OAAG,iBAAM;AAAA,sBACV,qBAAC,OAAE;AAAA;AAAA,wBAAE;AAAA,yBAAe;AAAA,uBACtB,GACF;AAAA;AAAA;AAAA,cAEJ;AAAA,cACC;AAAA;AAAA;AAAA,QACH;AAAA,SACE,YAAY,uBACZ;AAAA,UAAC;AAAA;AAAA,YACC,eAAa,sBAAsB;AAAA,YACnC,mBAAiB,uBAAuB,KAAK;AAAA,YAC7C,MAAK;AAAA,YACL;AAAA,YACA,IAAI,wBAAwB,KAAK;AAAA,YAChC,GAAG;AAAA,YACJ;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YAEC;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,gBAAgB,cAAc;AAC9B,MAAM,4BAA4B,SAAS,eAAe;AAC1D,0BAA0B,YAAY;AAGtC,IAAO,0BAAQ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable max-statements */\nimport { useFloatingContext, FloatingWrapper, PopoverArrow } from '@elliemae/ds-floating-context';\nimport {\n describe,\n useGetGlobalAttributes,\n useGetXstyledProps,\n useMemoMergePropsWithDefault,\n type ValidationMap,\n} from '@elliemae/ds-props-helpers';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport React, { useCallback, useContext, useState } from 'react';\nimport { DSAccordionContext } from '../../DSAccordionCTX.js';\nimport { DSAccordionDataTestid } from '../../constants/index.js';\nimport { accordionItemDefaultProps } from '../../defaultProps.js';\nimport type { DSAccordionT } from '../../react-desc-prop-types.js';\nimport { accordionItemPropTypes } from '../../react-desc-prop-types.js';\nimport { ItemCustomActions } from './ItemCustomActions.js';\nimport { ItemTitle } from './ItemTitle.js';\nimport {\n StyledItemContainer,\n StyledItemContent,\n StyledItemDetails,\n StyledItemHeader,\n StyledItemHeaderContainer,\n StyledTooltipContent,\n} from './styles.js';\nimport { useAccordionItem } from './useAccordionItem.js';\nimport { useIsShowingEllipsis } from './useIsShowingEllipsis.js';\n\nconst DSAccordionItem = (props: DSAccordionT.ItemProps): JSX.Element => {\n const propsWithDefaults = useMemoMergePropsWithDefault(\n props,\n accordionItemDefaultProps,\n ) as DSAccordionT.InternalItemProps;\n\n const getOwnerProps = useCallback(() => props, [props]);\n const getOwnerPropsArguments = useCallback(() => ({}), []);\n\n const {\n children,\n title,\n secondaryTitle,\n customActions,\n iconOpened: IconOpened,\n iconClosed: IconClosed,\n value,\n disabled,\n dsIndex,\n renderCustomActions,\n CustomActions,\n xStyledPropsContent,\n keepContentMounted,\n innerRef,\n applyAriaDisabled,\n wrapLabel,\n ...rest\n } = propsWithDefaults;\n\n const { handleOnKeyDown, toggle, selected } = useAccordionItem({ value, disabled, applyAriaDisabled });\n\n const xstyledAttrs = useGetXstyledProps(rest);\n const xstyledContentAttrs = useGetXstyledProps(xStyledPropsContent);\n\n const {\n allChildrenReferences,\n actualActiveValue,\n props: { isDSMobile },\n } = useContext(DSAccordionContext);\n\n const [showPopover, setShowPopover] = useState(false);\n const [referenceElement, setReferenceElement] = useState<HTMLElement | null>(null);\n\n const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = useIsShowingEllipsis();\n const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = useIsShowingEllipsis();\n\n const isTooltipOpen = !selected && showPopover;\n const {\n refs: floatingRefs,\n floatingStyles,\n arrowStyles,\n context: floatingContext,\n isOpen: isFloatingOpen,\n } = useFloatingContext({\n externallyControlledIsOpen: isTooltipOpen,\n externalReferenceElement: referenceElement,\n withoutAnimation: true,\n customOffset: [0, 14],\n });\n\n const handleSummaryClick = useCallback(\n (e: React.MouseEvent) => {\n // Prevent the native <details> toggle \u2014 React state (activeValue) is the\n // single source of truth and drives the `open` attribute below.\n e.preventDefault();\n toggle(e);\n },\n [toggle],\n );\n\n const handleSummaryKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n // A <summary> toggles natively on Enter/Space; intercept so the toggle is\n // routed through React state exactly like a click (keeps controlled mode,\n // allowMultipleOpen exclusivity, and onChange firing once).\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle(e);\n return;\n }\n handleOnKeyDown(e, dsIndex);\n },\n [toggle, handleOnKeyDown, dsIndex],\n );\n\n const handleSummaryMouseDown = useCallback(\n (e: React.MouseEvent) => {\n // A native <summary> takes focus on mousedown even with tabIndex -1.\n // Cancel that for disabled items so they cannot be focused by click either,\n // matching the pre-migration <button disabled> behavior. applyAriaDisabled\n // stays focusable by design, so it is intentionally not guarded here.\n if (disabled) e.preventDefault();\n },\n [disabled],\n );\n\n const handleOnFocus = useCallback(\n () => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),\n [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis],\n );\n\n const handleOnBlur = useCallback(() => setShowPopover(false), []);\n\n const { className, ...globalAttrs } = useGetGlobalAttributes(rest, {\n onClick: handleSummaryClick,\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n });\n\n const handlers = {\n onClick: handleSummaryClick,\n onKeyDown: handleSummaryKeyDown,\n onMouseDown: handleSummaryMouseDown,\n onFocus: handleOnFocus,\n onBlur: handleOnBlur,\n };\n\n const headerId = `ds-accordion-header-${value}`;\n const contentId = `ds-accordion-content-${value}`;\n const withCustomActions =\n (customActions?.length > 0 || renderCustomActions !== undefined || CustomActions !== undefined) && !isDSMobile;\n\n return (\n <StyledItemContainer\n data-testid={DSAccordionDataTestid.ITEM_CONTAINER}\n className={className}\n {...xstyledAttrs}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledItemDetails\n // Native disclosure state mirrors the React-controlled `selected` flag.\n // Visibility is still governed by React (content is conditionally\n // rendered below), so this is for native semantics/consistency only.\n open={selected}\n data-testid={DSAccordionDataTestid.ITEM_DETAILS}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledItemHeader\n withCustomActions={withCustomActions}\n withSecondaryTitle={secondaryTitle}\n // A native <summary> is always focusable, so `disabled` (unlike the old\n // <button disabled>) must be removed from the tab order explicitly.\n // applyAriaDisabled stays focusable (tabIndex 0) by design.\n tabIndex={disabled ? -1 : 0}\n disabled={disabled}\n data-disabled={disabled}\n // The trigger is a <summary>; the public innerRef type stays\n // HTMLButtonElement for backward compatibility, so cast at the boundary.\n innerRef={mergeRefs(allChildrenReferences[dsIndex], innerRef) as React.Ref<HTMLElement>}\n isDSMobile={isDSMobile}\n data-testid={DSAccordionDataTestid.ITEM_HEADER}\n id={headerId}\n aria-expanded={selected}\n aria-disabled={disabled || applyAriaDisabled}\n applyAriaDisabled={applyAriaDisabled}\n aria-controls={contentId}\n {...handlers}\n {...globalAttrs}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <StyledItemHeaderContainer\n innerRef={(HTMLNode) => setReferenceElement(HTMLNode ?? null)}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n <ItemTitle\n title={title}\n secondaryTitle={secondaryTitle}\n value={value}\n selected={selected}\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n wrapLabel={wrapLabel}\n isDSMobile={isDSMobile}\n IconOpened={IconOpened}\n IconClosed={IconClosed}\n onMouseEnter={handleOnFocus}\n onMouseLeave={handleOnBlur}\n setPrimaryElement={setPrimaryElement}\n setSecondaryElement={setSecondaryElement}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n </StyledItemHeaderContainer>\n {wrapLabel ? null : (\n <FloatingWrapper\n innerRef={floatingRefs.setFloating}\n isOpen={isFloatingOpen}\n floatingStyles={floatingStyles}\n context={floatingContext}\n >\n <StyledTooltipContent getOwnerProps={getOwnerProps} getOwnerPropsArguments={getOwnerPropsArguments}>\n <p>{title}</p>\n <p> {secondaryTitle}</p>\n </StyledTooltipContent>\n <PopoverArrow {...arrowStyles} />\n </FloatingWrapper>\n )}\n </StyledItemHeader>\n {(selected || keepContentMounted) && (\n <StyledItemContent\n data-testid={DSAccordionDataTestid.ITEM_CONTENT_CONTAINER}\n aria-labelledby={headerId}\n role=\"region\"\n isDSMobile={isDSMobile}\n id={contentId}\n {...xstyledContentAttrs}\n selected={selected}\n keepContentMounted={keepContentMounted}\n applyAriaDisabled={applyAriaDisabled}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {children}\n </StyledItemContent>\n )}\n </StyledItemDetails>\n <ItemCustomActions\n customActions={customActions}\n renderCustomActions={renderCustomActions}\n CustomActionsComponent={CustomActions}\n isDSMobile={isDSMobile}\n allRefs={allChildrenReferences}\n actualActiveValue={actualActiveValue}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n />\n </StyledItemContainer>\n );\n};\n\nDSAccordionItem.displayName = 'DSAccordionItem';\nconst DSAccordionItemWithSchema = describe(DSAccordionItem);\nDSAccordionItemWithSchema.propTypes = accordionItemPropTypes as ValidationMap<unknown>;\n\nexport { DSAccordionItem, DSAccordionItemWithSchema };\nexport default DSAccordionItem;\n"],
5
+ "mappings": "AAAA,YA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AAA,sBAAC;AAAA;AAAA,wBACC,UAAU,aAAa;AAAA,wBACvB,QAAQ;AAAA,wBACR;AAAA,wBACA,SAAS;AAAA,wBAET;AAAA,+CAAC,wBAAqB,eAA8B,wBAClD;AAAA,gDAAC,OAAG,iBAAM;AAAA,4BACV,qBAAC,OAAE;AAAA;AAAA,8BAAE;AAAA,+BAAe;AAAA,6BACtB;AAAA,0BACA,oBAAC,gBAAc,GAAG,aAAa;AAAA;AAAA;AAAA,oBACjC;AAAA;AAAA;AAAA,cAEJ;AAAA,eACE,YAAY,uBACZ;AAAA,gBAAC;AAAA;AAAA,kBACC,eAAa,sBAAsB;AAAA,kBACnC,mBAAiB;AAAA,kBACjB,MAAK;AAAA,kBACL;AAAA,kBACA,IAAI;AAAA,kBACH,GAAG;AAAA,kBACJ;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBAEC;AAAA;AAAA,cACH;AAAA;AAAA;AAAA,QAEJ;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC;AAAA,YACA;AAAA,YACA,wBAAwB;AAAA,YACxB;AAAA,YACA,SAAS;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAEA,gBAAgB,cAAc;AAC9B,MAAM,4BAA4B,SAAS,eAAe;AAC1D,0BAA0B,YAAY;AAGtC,IAAO,0BAAQ;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,54 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { BUTTON_TYPES, DSButtonV2 } from "@elliemae/ds-button-v2";
4
+ import { StyledItemCustomActions } from "./styles.js";
5
+ const ItemCustomActions = ({
6
+ customActions,
7
+ renderCustomActions,
8
+ CustomActionsComponent,
9
+ isDSMobile,
10
+ allRefs,
11
+ actualActiveValue,
12
+ getOwnerProps,
13
+ getOwnerPropsArguments
14
+ }) => {
15
+ if (isDSMobile) return null;
16
+ if (customActions?.length > 0) {
17
+ return /* @__PURE__ */ jsx(
18
+ StyledItemCustomActions,
19
+ {
20
+ isDSMobile,
21
+ getOwnerProps,
22
+ getOwnerPropsArguments,
23
+ children: customActions.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ jsx(
24
+ DSButtonV2,
25
+ {
26
+ onClick: (e) => {
27
+ e.stopPropagation();
28
+ if (onClick) onClick(e);
29
+ },
30
+ ...otherProps,
31
+ buttonType: BUTTON_TYPES.OUTLINE
32
+ },
33
+ id
34
+ ))
35
+ }
36
+ );
37
+ }
38
+ if (renderCustomActions || CustomActionsComponent) {
39
+ return /* @__PURE__ */ jsx(
40
+ StyledItemCustomActions,
41
+ {
42
+ isDSMobile,
43
+ getOwnerProps,
44
+ getOwnerPropsArguments,
45
+ children: CustomActionsComponent !== void 0 ? /* @__PURE__ */ jsx(CustomActionsComponent, { allRefs, actualActiveValue }) : renderCustomActions?.({ allRefs, actualActiveValue })
46
+ }
47
+ );
48
+ }
49
+ return null;
50
+ };
51
+ export {
52
+ ItemCustomActions
53
+ };
54
+ //# sourceMappingURL=ItemCustomActions.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../scripts/build/transpile/react-shim.js", "../../../../src/parts/accordionItem/ItemCustomActions.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { BUTTON_TYPES, DSButtonV2 } from '@elliemae/ds-button-v2';\nimport React from 'react';\n\nimport type { DSAccordionT } from '../../react-desc-prop-types.js';\nimport type { DSAccordionInternalsT } from '../../sharedTypes.js';\nimport { StyledItemCustomActions } from './styles.js';\n\ninterface ItemCustomActionsProps {\n customActions: DSAccordionInternalsT.CustomActions[];\n renderCustomActions?: DSAccordionT.ItemOptionalProps['renderCustomActions'];\n CustomActionsComponent?: DSAccordionT.ItemOptionalProps['CustomActions'];\n isDSMobile: boolean;\n allRefs: DSAccordionInternalsT.AllChildrenReferences;\n actualActiveValue: DSAccordionInternalsT.InternalActiveValue;\n getOwnerProps: () => DSAccordionT.ItemProps;\n getOwnerPropsArguments: () => object;\n}\n\nexport const ItemCustomActions = ({\n customActions,\n renderCustomActions,\n CustomActionsComponent,\n isDSMobile,\n allRefs,\n actualActiveValue,\n getOwnerProps,\n getOwnerPropsArguments,\n}: ItemCustomActionsProps): JSX.Element | null => {\n if (isDSMobile) return null;\n\n if (customActions?.length > 0) {\n return (\n <StyledItemCustomActions\n isDSMobile={isDSMobile}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {customActions.map(({ onClick, id, ...otherProps }) => (\n <DSButtonV2\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_TYPES.OUTLINE}\n />\n ))}\n </StyledItemCustomActions>\n );\n }\n\n if (renderCustomActions || CustomActionsComponent) {\n return (\n <StyledItemCustomActions\n isDSMobile={isDSMobile}\n getOwnerProps={getOwnerProps}\n getOwnerPropsArguments={getOwnerPropsArguments}\n >\n {CustomActionsComponent !== undefined ? (\n <CustomActionsComponent allRefs={allRefs} actualActiveValue={actualActiveValue} />\n ) : (\n renderCustomActions?.({ allRefs, actualActiveValue })\n )}\n </StyledItemCustomActions>\n );\n }\n\n return null;\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACsCb;AAtCV,SAAS,cAAc,kBAAkB;AAKzC,SAAS,+BAA+B;AAajC,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAkD;AAChD,MAAI,WAAY,QAAO;AAEvB,MAAI,eAAe,SAAS,GAAG;AAC7B,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QAEC,wBAAc,IAAI,CAAC,EAAE,SAAS,IAAI,GAAG,WAAW,MAC/C;AAAA,UAAC;AAAA;AAAA,YAEC,SAAS,CAAC,MAA0F;AAClG,gBAAE,gBAAgB;AAClB,kBAAI,QAAS,SAAQ,CAA8C;AAAA,YACrE;AAAA,YACC,GAAG;AAAA,YACJ,YAAY,aAAa;AAAA;AAAA,UANpB;AAAA,QAOP,CACD;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,MAAI,uBAAuB,wBAAwB;AACjD,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QAEC,qCAA2B,SAC1B,oBAAC,0BAAuB,SAAkB,mBAAsC,IAEhF,sBAAsB,EAAE,SAAS,kBAAkB,CAAC;AAAA;AAAA,IAExD;AAAA,EAEJ;AAEA,SAAO;AACT;",
6
+ "names": []
7
+ }