@elliemae/ds-accordion 3.62.1 → 3.70.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/index.js +3 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js +126 -221
- package/dist/cjs/parts/accordionItem/DSAccordionItem.js.map +2 -2
- package/dist/cjs/parts/accordionItem/ItemCustomActions.js +84 -0
- package/dist/cjs/parts/accordionItem/ItemCustomActions.js.map +7 -0
- package/dist/cjs/parts/accordionItem/ItemTitle.js +172 -0
- package/dist/cjs/parts/accordionItem/ItemTitle.js.map +7 -0
- package/dist/cjs/parts/accordionItem/styles.js +69 -14
- package/dist/cjs/parts/accordionItem/styles.js.map +2 -2
- package/dist/cjs/parts/accordionItem/useAccordionItem.js +4 -2
- package/dist/cjs/parts/accordionItem/useAccordionItem.js.map +2 -2
- package/dist/esm/constants/index.js +3 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/parts/accordionItem/DSAccordionItem.js +128 -227
- package/dist/esm/parts/accordionItem/DSAccordionItem.js.map +2 -2
- package/dist/esm/parts/accordionItem/ItemCustomActions.js +54 -0
- package/dist/esm/parts/accordionItem/ItemCustomActions.js.map +7 -0
- package/dist/esm/parts/accordionItem/ItemTitle.js +142 -0
- package/dist/esm/parts/accordionItem/ItemTitle.js.map +7 -0
- package/dist/esm/parts/accordionItem/styles.js +69 -14
- package/dist/esm/parts/accordionItem/styles.js.map +2 -2
- package/dist/esm/parts/accordionItem/useAccordionItem.js +4 -2
- package/dist/esm/parts/accordionItem/useAccordionItem.js.map +2 -2
- package/dist/types/constants/index.d.ts +4 -0
- package/dist/types/parts/accordionItem/ItemCustomActions.d.ts +14 -0
- package/dist/types/parts/accordionItem/ItemTitle.d.ts +23 -0
- package/dist/types/parts/accordionItem/styles.d.ts +6 -4
- package/dist/types/parts/accordionItem/useAccordionItem.d.ts +1 -0
- package/package.json +11 -11
- package/dist/types/tests/DSAccordion.a11y.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.callback.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.data-testid.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.events.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.exports.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.get-owner-props.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.keyboard.test.d.ts +0 -1
- package/dist/types/tests/DSAccordion.test.d.ts +0 -1
- package/dist/types/typescript-testing/typescript-accordion-valid.d.ts +0 -1
|
@@ -46,6 +46,9 @@ const ACCORDION_SLOTS = {
|
|
|
46
46
|
const DSAccordionSlots = ACCORDION_SLOTS;
|
|
47
47
|
const ACCORDION_ITEM_SLOTS = {
|
|
48
48
|
ITEM_CONTAINER: "item-container",
|
|
49
|
+
// additive slot: wraps the summary + content as a native <details> disclosure.
|
|
50
|
+
// New in the native-engine migration — not a breaking change (did not exist before).
|
|
51
|
+
ITEM_DETAILS: "item-details",
|
|
49
52
|
ITEM_HEADER_CONTAINER: "item-header-container",
|
|
50
53
|
ITEM_HEADER: "item-header",
|
|
51
54
|
ITEM_HEADER_ADDON: "item-header-addon",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/constants/index.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSAccordionName = 'DSAccordion';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const ACCORDION_SLOTS = {\n CONTAINER: 'root',\n} as const;\nexport const DSAccordionSlots = ACCORDION_SLOTS;\n\nexport const ACCORDION_ITEM_SLOTS = {\n ITEM_CONTAINER: 'item-container',\n ITEM_HEADER_CONTAINER: 'item-header-container',\n ITEM_HEADER: 'item-header',\n ITEM_HEADER_ADDON: 'item-header-addon',\n ITEM_HEADER_TITLE_CONTAINER: 'item-header-titles-container',\n ITEM_HEADER_PRIMARY_TITLE: 'item-header-primary-title',\n ITEM_HEADER_SECONDARY_TITLE: 'item-header-secondary-title',\n ITEM_HEADER_CUSTOM_ACTIONS_CONTAINER: 'item-header-custom-actions-container',\n ITEM_HEADER_TOOLTIP: 'item-header-tooltip',\n ITEM_CONTENT_CONTAINER: 'item-content-container',\n} as const;\nexport const DSAccordionItemSlots = ACCORDION_ITEM_SLOTS;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const ACCORDION_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSAccordionName, ACCORDION_SLOTS),\n ...slotObjectToDataTestIds(DSAccordionName, ACCORDION_ITEM_SLOTS),\n ITEM_CONTENT_CONTAINER: 'ds-accordion_item-content',\n ITEM_HEADER: 'ds-accordion_item-header',\n ITEM_CONTAINER: 'ds-accordion_item',\n CONTAINER: 'ds-accordion_group',\n};\nexport const DSAccordionDataTestid = ACCORDION_DATA_TESTID;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAAA,EAC7B,WAAW;AACb;AACO,MAAM,mBAAmB;AAEzB,MAAM,uBAAuB;AAAA,EAClC,gBAAgB;AAAA,
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSAccordionName = 'DSAccordion';\n\n// we are naming this with the ${component_name}_slots convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const ACCORDION_SLOTS = {\n CONTAINER: 'root',\n} as const;\nexport const DSAccordionSlots = ACCORDION_SLOTS;\n\nexport const ACCORDION_ITEM_SLOTS = {\n ITEM_CONTAINER: 'item-container',\n // additive slot: wraps the summary + content as a native <details> disclosure.\n // New in the native-engine migration \u2014 not a breaking change (did not exist before).\n ITEM_DETAILS: 'item-details',\n ITEM_HEADER_CONTAINER: 'item-header-container',\n ITEM_HEADER: 'item-header',\n ITEM_HEADER_ADDON: 'item-header-addon',\n ITEM_HEADER_TITLE_CONTAINER: 'item-header-titles-container',\n ITEM_HEADER_PRIMARY_TITLE: 'item-header-primary-title',\n ITEM_HEADER_SECONDARY_TITLE: 'item-header-secondary-title',\n ITEM_HEADER_CUSTOM_ACTIONS_CONTAINER: 'item-header-custom-actions-container',\n ITEM_HEADER_TOOLTIP: 'item-header-tooltip',\n ITEM_CONTENT_CONTAINER: 'item-content-container',\n} as const;\nexport const DSAccordionItemSlots = ACCORDION_ITEM_SLOTS;\n\n// we are naming this with the ${component_name}_data_testid convention to namespace & avoid errors on duplicate exports variables in aggregators\nexport const ACCORDION_DATA_TESTID = {\n ...slotObjectToDataTestIds(DSAccordionName, ACCORDION_SLOTS),\n ...slotObjectToDataTestIds(DSAccordionName, ACCORDION_ITEM_SLOTS),\n ITEM_CONTENT_CONTAINER: 'ds-accordion_item-content',\n ITEM_HEADER: 'ds-accordion_item-header',\n ITEM_CONTAINER: 'ds-accordion_item',\n CONTAINER: 'ds-accordion_group',\n};\nexport const DSAccordionDataTestid = ACCORDION_DATA_TESTID;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAGxB,MAAM,kBAAkB;AAAA,EAC7B,WAAW;AACb;AACO,MAAM,mBAAmB;AAEzB,MAAM,uBAAuB;AAAA,EAClC,gBAAgB;AAAA;AAAA;AAAA,EAGhB,cAAc;AAAA,EACd,uBAAuB;AAAA,EACvB,aAAa;AAAA,EACb,mBAAmB;AAAA,EACnB,6BAA6B;AAAA,EAC7B,2BAA2B;AAAA,EAC3B,6BAA6B;AAAA,EAC7B,sCAAsC;AAAA,EACtC,qBAAqB;AAAA,EACrB,wBAAwB;AAC1B;AACO,MAAM,uBAAuB;AAG7B,MAAM,wBAAwB;AAAA,EACnC,OAAG,0CAAwB,iBAAiB,eAAe;AAAA,EAC3D,OAAG,0CAAwB,iBAAiB,oBAAoB;AAAA,EAChE,wBAAwB;AAAA,EACxB,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,WAAW;AACb;AACO,MAAM,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -35,9 +35,7 @@ __export(DSAccordionItem_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(DSAccordionItem_exports);
|
|
36
36
|
var React = __toESM(require("react"));
|
|
37
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
-
var
|
|
39
|
-
var import_ds_grid = require("@elliemae/ds-grid");
|
|
40
|
-
var import_ds_popperjs = require("@elliemae/ds-popperjs");
|
|
38
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
41
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
42
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
43
41
|
var import_react = require("react");
|
|
@@ -45,6 +43,8 @@ var import_DSAccordionCTX = require("../../DSAccordionCTX.js");
|
|
|
45
43
|
var import_constants = require("../../constants/index.js");
|
|
46
44
|
var import_defaultProps = require("../../defaultProps.js");
|
|
47
45
|
var import_react_desc_prop_types = require("../../react-desc-prop-types.js");
|
|
46
|
+
var import_ItemCustomActions = require("./ItemCustomActions.js");
|
|
47
|
+
var import_ItemTitle = require("./ItemTitle.js");
|
|
48
48
|
var import_styles = require("./styles.js");
|
|
49
49
|
var import_useAccordionItem = require("./useAccordionItem.js");
|
|
50
50
|
var import_useIsShowingEllipsis = require("./useIsShowingEllipsis.js");
|
|
@@ -74,7 +74,7 @@ const DSAccordionItem = (props) => {
|
|
|
74
74
|
wrapLabel,
|
|
75
75
|
...rest
|
|
76
76
|
} = propsWithDefaults;
|
|
77
|
-
const {
|
|
77
|
+
const { handleOnKeyDown, toggle, selected } = (0, import_useAccordionItem.useAccordionItem)({ value, disabled, applyAriaDisabled });
|
|
78
78
|
const xstyledAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(rest);
|
|
79
79
|
const xstyledContentAttrs = (0, import_ds_props_helpers.useGetXstyledProps)(xStyledPropsContent);
|
|
80
80
|
const {
|
|
@@ -84,56 +84,44 @@ const DSAccordionItem = (props) => {
|
|
|
84
84
|
} = (0, import_react.useContext)(import_DSAccordionCTX.DSAccordionContext);
|
|
85
85
|
const [showPopover, setShowPopover] = (0, import_react.useState)(false);
|
|
86
86
|
const [referenceElement, setReferenceElement] = (0, import_react.useState)(null);
|
|
87
|
-
const CustomActionsContent = (0, import_react.useMemo)(() => {
|
|
88
|
-
if (!isDSMobile && customActions?.length > 0)
|
|
89
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
90
|
-
import_styles.StyledItemCustomActions,
|
|
91
|
-
{
|
|
92
|
-
isDSMobile,
|
|
93
|
-
getOwnerProps,
|
|
94
|
-
getOwnerPropsArguments,
|
|
95
|
-
children: customActions?.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
-
import_ds_button_v2.DSButtonV2,
|
|
97
|
-
{
|
|
98
|
-
onClick: (e) => {
|
|
99
|
-
e.stopPropagation();
|
|
100
|
-
if (onClick) onClick(e);
|
|
101
|
-
},
|
|
102
|
-
...otherProps,
|
|
103
|
-
buttonType: import_ds_button_v2.BUTTON_TYPES.OUTLINE
|
|
104
|
-
},
|
|
105
|
-
id
|
|
106
|
-
))
|
|
107
|
-
}
|
|
108
|
-
);
|
|
109
|
-
if (!isDSMobile && (renderCustomActions || CustomActions))
|
|
110
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
111
|
-
import_styles.StyledItemCustomActions,
|
|
112
|
-
{
|
|
113
|
-
isDSMobile,
|
|
114
|
-
getOwnerProps,
|
|
115
|
-
getOwnerPropsArguments,
|
|
116
|
-
children: CustomActions !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomActions, { allRefs: allChildrenReferences, actualActiveValue }) : renderCustomActions?.({ allRefs: allChildrenReferences, actualActiveValue })
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
return null;
|
|
120
|
-
}, [
|
|
121
|
-
CustomActions,
|
|
122
|
-
actualActiveValue,
|
|
123
|
-
allChildrenReferences,
|
|
124
|
-
customActions,
|
|
125
|
-
getOwnerProps,
|
|
126
|
-
getOwnerPropsArguments,
|
|
127
|
-
isDSMobile,
|
|
128
|
-
renderCustomActions
|
|
129
|
-
]);
|
|
130
87
|
const { isShowingEllipsis: isPrimaryShowingEllipsis, setElement: setPrimaryElement } = (0, import_useIsShowingEllipsis.useIsShowingEllipsis)();
|
|
131
88
|
const { isShowingEllipsis: isSecondaryShowingEllipsis, setElement: setSecondaryElement } = (0, import_useIsShowingEllipsis.useIsShowingEllipsis)();
|
|
132
|
-
const
|
|
89
|
+
const isTooltipOpen = !selected && showPopover;
|
|
90
|
+
const {
|
|
91
|
+
refs: floatingRefs,
|
|
92
|
+
floatingStyles,
|
|
93
|
+
arrowStyles,
|
|
94
|
+
context: floatingContext,
|
|
95
|
+
isOpen: isFloatingOpen
|
|
96
|
+
} = (0, import_ds_floating_context.useFloatingContext)({
|
|
97
|
+
externallyControlledIsOpen: isTooltipOpen,
|
|
98
|
+
externalReferenceElement: referenceElement,
|
|
99
|
+
withoutAnimation: true,
|
|
100
|
+
customOffset: [0, 14]
|
|
101
|
+
});
|
|
102
|
+
const handleSummaryClick = (0, import_react.useCallback)(
|
|
103
|
+
(e) => {
|
|
104
|
+
e.preventDefault();
|
|
105
|
+
toggle(e);
|
|
106
|
+
},
|
|
107
|
+
[toggle]
|
|
108
|
+
);
|
|
109
|
+
const handleSummaryKeyDown = (0, import_react.useCallback)(
|
|
133
110
|
(e) => {
|
|
111
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
toggle(e);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
134
116
|
handleOnKeyDown(e, dsIndex);
|
|
135
117
|
},
|
|
136
|
-
[
|
|
118
|
+
[toggle, handleOnKeyDown, dsIndex]
|
|
119
|
+
);
|
|
120
|
+
const handleSummaryMouseDown = (0, import_react.useCallback)(
|
|
121
|
+
(e) => {
|
|
122
|
+
if (disabled) e.preventDefault();
|
|
123
|
+
},
|
|
124
|
+
[disabled]
|
|
137
125
|
);
|
|
138
126
|
const handleOnFocus = (0, import_react.useCallback)(
|
|
139
127
|
() => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis),
|
|
@@ -141,225 +129,142 @@ const DSAccordionItem = (props) => {
|
|
|
141
129
|
);
|
|
142
130
|
const handleOnBlur = (0, import_react.useCallback)(() => setShowPopover(false), []);
|
|
143
131
|
const { className, ...globalAttrs } = (0, import_ds_props_helpers.useGetGlobalAttributes)(rest, {
|
|
144
|
-
onClick:
|
|
132
|
+
onClick: handleSummaryClick,
|
|
145
133
|
onFocus: handleOnFocus,
|
|
146
134
|
onBlur: handleOnBlur
|
|
147
135
|
});
|
|
148
136
|
const handlers = {
|
|
149
|
-
onClick:
|
|
137
|
+
onClick: handleSummaryClick,
|
|
138
|
+
onKeyDown: handleSummaryKeyDown,
|
|
139
|
+
onMouseDown: handleSummaryMouseDown,
|
|
150
140
|
onFocus: handleOnFocus,
|
|
151
141
|
onBlur: handleOnBlur
|
|
152
142
|
};
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{
|
|
157
|
-
onMouseEnter: handleOnFocus,
|
|
158
|
-
onMouseLeave: handleOnBlur,
|
|
159
|
-
cols: ["auto", "1fr"],
|
|
160
|
-
padding: "6px 0px",
|
|
161
|
-
marginRight: "20px",
|
|
162
|
-
width: "100%",
|
|
163
|
-
children: [
|
|
164
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
|
-
import_styles.StyledItemAddon,
|
|
166
|
-
{
|
|
167
|
-
disabled,
|
|
168
|
-
applyAriaDisabled,
|
|
169
|
-
getOwnerProps,
|
|
170
|
-
getOwnerPropsArguments,
|
|
171
|
-
children: selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconOpened, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconClosed, {})
|
|
172
|
-
}
|
|
173
|
-
),
|
|
174
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, { rows: secondaryTitle ? ["auto", "auto"] : ["auto"], rowGap: secondaryTitle ? "3px" : "0px", children: [
|
|
175
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
-
import_styles.StyledItemTitles,
|
|
177
|
-
{
|
|
178
|
-
withSecondaryTitle: secondaryTitle,
|
|
179
|
-
selected,
|
|
180
|
-
getOwnerProps,
|
|
181
|
-
getOwnerPropsArguments,
|
|
182
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
183
|
-
import_styles.StyledPrimaryTitle,
|
|
184
|
-
{
|
|
185
|
-
innerRef: setPrimaryElement,
|
|
186
|
-
...title ? { id: `accordion_${title || ""}id-${value}` } : void 0,
|
|
187
|
-
disabled,
|
|
188
|
-
applyAriaDisabled,
|
|
189
|
-
selected,
|
|
190
|
-
withSecondaryTitle: Boolean(secondaryTitle),
|
|
191
|
-
getOwnerProps,
|
|
192
|
-
getOwnerPropsArguments,
|
|
193
|
-
wrapLabel,
|
|
194
|
-
children: title
|
|
195
|
-
}
|
|
196
|
-
)
|
|
197
|
-
}
|
|
198
|
-
),
|
|
199
|
-
secondaryTitle && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
200
|
-
import_styles.StyledSecondaryTitle,
|
|
201
|
-
{
|
|
202
|
-
innerRef: setSecondaryElement,
|
|
203
|
-
disabled,
|
|
204
|
-
applyAriaDisabled,
|
|
205
|
-
selected,
|
|
206
|
-
getOwnerProps,
|
|
207
|
-
getOwnerPropsArguments,
|
|
208
|
-
wrapLabel,
|
|
209
|
-
children: secondaryTitle
|
|
210
|
-
}
|
|
211
|
-
)
|
|
212
|
-
] })
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
),
|
|
216
|
-
[
|
|
217
|
-
handleOnFocus,
|
|
218
|
-
handleOnBlur,
|
|
219
|
-
secondaryTitle,
|
|
220
|
-
disabled,
|
|
221
|
-
applyAriaDisabled,
|
|
222
|
-
getOwnerProps,
|
|
223
|
-
getOwnerPropsArguments,
|
|
224
|
-
selected,
|
|
225
|
-
IconOpened,
|
|
226
|
-
IconClosed,
|
|
227
|
-
setPrimaryElement,
|
|
228
|
-
title,
|
|
229
|
-
value,
|
|
230
|
-
wrapLabel,
|
|
231
|
-
setSecondaryElement
|
|
232
|
-
]
|
|
233
|
-
);
|
|
234
|
-
const titleMobile = (0, import_react.useMemo)(
|
|
235
|
-
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_grid.Grid, { width: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ds_grid.Grid, { cols: ["auto", "20px"], children: [
|
|
236
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
237
|
-
import_styles.StyledItemTitles,
|
|
238
|
-
{
|
|
239
|
-
onMouseEnter: handleOnFocus,
|
|
240
|
-
onMouseLeave: handleOnBlur,
|
|
241
|
-
isDSMobile: true,
|
|
242
|
-
withSecondaryTitle: secondaryTitle,
|
|
243
|
-
selected,
|
|
244
|
-
getOwnerProps,
|
|
245
|
-
getOwnerPropsArguments,
|
|
246
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
247
|
-
import_styles.StyledPrimaryTitle,
|
|
248
|
-
{
|
|
249
|
-
innerRef: setPrimaryElement,
|
|
250
|
-
...title ? { id: `accordion_${title || ""}id` } : void 0,
|
|
251
|
-
disabled,
|
|
252
|
-
applyAriaDisabled,
|
|
253
|
-
isDSMobile: true,
|
|
254
|
-
selected,
|
|
255
|
-
withSecondaryTitle: Boolean(secondaryTitle),
|
|
256
|
-
getOwnerProps,
|
|
257
|
-
getOwnerPropsArguments,
|
|
258
|
-
wrapLabel,
|
|
259
|
-
children: title
|
|
260
|
-
}
|
|
261
|
-
)
|
|
262
|
-
}
|
|
263
|
-
),
|
|
264
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
265
|
-
import_styles.StyledItemAddon,
|
|
266
|
-
{
|
|
267
|
-
disabled,
|
|
268
|
-
applyAriaDisabled,
|
|
269
|
-
isDSMobile: true,
|
|
270
|
-
getOwnerProps,
|
|
271
|
-
getOwnerPropsArguments,
|
|
272
|
-
children: selected ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconOpened, { isDSMobile: true }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IconClosed, { isDSMobile: true })
|
|
273
|
-
}
|
|
274
|
-
)
|
|
275
|
-
] }) }),
|
|
276
|
-
[
|
|
277
|
-
handleOnFocus,
|
|
278
|
-
handleOnBlur,
|
|
279
|
-
secondaryTitle,
|
|
280
|
-
selected,
|
|
281
|
-
getOwnerProps,
|
|
282
|
-
getOwnerPropsArguments,
|
|
283
|
-
setPrimaryElement,
|
|
284
|
-
title,
|
|
285
|
-
disabled,
|
|
286
|
-
applyAriaDisabled,
|
|
287
|
-
wrapLabel,
|
|
288
|
-
IconOpened,
|
|
289
|
-
IconClosed
|
|
290
|
-
]
|
|
291
|
-
);
|
|
143
|
+
const headerId = `ds-accordion-header-${value}`;
|
|
144
|
+
const contentId = `ds-accordion-content-${value}`;
|
|
145
|
+
const withCustomActions = (customActions?.length > 0 || renderCustomActions !== void 0 || CustomActions !== void 0) && !isDSMobile;
|
|
292
146
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
293
147
|
import_styles.StyledItemContainer,
|
|
294
148
|
{
|
|
295
149
|
"data-testid": import_constants.DSAccordionDataTestid.ITEM_CONTAINER,
|
|
296
150
|
className,
|
|
297
151
|
...xstyledAttrs,
|
|
152
|
+
disabled,
|
|
153
|
+
applyAriaDisabled,
|
|
298
154
|
getOwnerProps,
|
|
299
155
|
getOwnerPropsArguments,
|
|
300
156
|
children: [
|
|
301
157
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
302
|
-
import_styles.
|
|
158
|
+
import_styles.StyledItemDetails,
|
|
303
159
|
{
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
innerRef: (HTMLNode) => setReferenceElement(HTMLNode ?? null),
|
|
160
|
+
open: selected,
|
|
161
|
+
"data-testid": import_constants.DSAccordionDataTestid.ITEM_DETAILS,
|
|
307
162
|
getOwnerProps,
|
|
308
163
|
getOwnerPropsArguments,
|
|
309
164
|
children: [
|
|
310
165
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
311
166
|
import_styles.StyledItemHeader,
|
|
312
167
|
{
|
|
313
|
-
withCustomActions
|
|
168
|
+
withCustomActions,
|
|
314
169
|
withSecondaryTitle: secondaryTitle,
|
|
315
|
-
tabIndex:
|
|
170
|
+
tabIndex: disabled ? -1 : 0,
|
|
316
171
|
disabled,
|
|
317
172
|
"data-disabled": disabled,
|
|
318
173
|
innerRef: (0, import_ds_system.mergeRefs)(allChildrenReferences[dsIndex], innerRef),
|
|
319
|
-
onKeyDown: onKeyDownWithIndex,
|
|
320
174
|
isDSMobile,
|
|
321
175
|
"data-testid": import_constants.DSAccordionDataTestid.ITEM_HEADER,
|
|
322
|
-
id:
|
|
176
|
+
id: headerId,
|
|
323
177
|
"aria-expanded": selected,
|
|
324
178
|
"aria-disabled": disabled || applyAriaDisabled,
|
|
325
179
|
applyAriaDisabled,
|
|
326
|
-
"aria-controls":
|
|
180
|
+
"aria-controls": contentId,
|
|
327
181
|
...handlers,
|
|
328
182
|
...globalAttrs,
|
|
329
|
-
type: "button",
|
|
330
183
|
getOwnerProps,
|
|
331
184
|
getOwnerPropsArguments,
|
|
332
185
|
children: [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
187
|
+
import_styles.StyledItemHeaderContainer,
|
|
188
|
+
{
|
|
189
|
+
innerRef: (HTMLNode) => setReferenceElement(HTMLNode ?? null),
|
|
190
|
+
getOwnerProps,
|
|
191
|
+
getOwnerPropsArguments,
|
|
192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
193
|
+
import_ItemTitle.ItemTitle,
|
|
194
|
+
{
|
|
195
|
+
title,
|
|
196
|
+
secondaryTitle,
|
|
197
|
+
value,
|
|
198
|
+
selected,
|
|
199
|
+
disabled,
|
|
200
|
+
applyAriaDisabled,
|
|
201
|
+
wrapLabel,
|
|
202
|
+
isDSMobile,
|
|
203
|
+
IconOpened,
|
|
204
|
+
IconClosed,
|
|
205
|
+
onMouseEnter: handleOnFocus,
|
|
206
|
+
onMouseLeave: handleOnBlur,
|
|
207
|
+
setPrimaryElement,
|
|
208
|
+
setSecondaryElement,
|
|
209
|
+
getOwnerProps,
|
|
210
|
+
getOwnerPropsArguments
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
wrapLabel ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
216
|
+
import_ds_floating_context.FloatingWrapper,
|
|
217
|
+
{
|
|
218
|
+
innerRef: floatingRefs.setFloating,
|
|
219
|
+
isOpen: isFloatingOpen,
|
|
220
|
+
floatingStyles,
|
|
221
|
+
context: floatingContext,
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.StyledTooltipContent, { getOwnerProps, getOwnerPropsArguments, children: [
|
|
224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: title }),
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
226
|
+
" ",
|
|
227
|
+
secondaryTitle
|
|
228
|
+
] })
|
|
229
|
+
] }),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_floating_context.PopoverArrow, { ...arrowStyles })
|
|
231
|
+
]
|
|
232
|
+
}
|
|
233
|
+
)
|
|
341
234
|
]
|
|
342
235
|
}
|
|
343
236
|
),
|
|
344
|
-
|
|
237
|
+
(selected || keepContentMounted) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
238
|
+
import_styles.StyledItemContent,
|
|
239
|
+
{
|
|
240
|
+
"data-testid": import_constants.DSAccordionDataTestid.ITEM_CONTENT_CONTAINER,
|
|
241
|
+
"aria-labelledby": headerId,
|
|
242
|
+
role: "region",
|
|
243
|
+
isDSMobile,
|
|
244
|
+
id: contentId,
|
|
245
|
+
...xstyledContentAttrs,
|
|
246
|
+
selected,
|
|
247
|
+
keepContentMounted,
|
|
248
|
+
applyAriaDisabled,
|
|
249
|
+
getOwnerProps,
|
|
250
|
+
getOwnerPropsArguments,
|
|
251
|
+
children
|
|
252
|
+
}
|
|
253
|
+
)
|
|
345
254
|
]
|
|
346
255
|
}
|
|
347
256
|
),
|
|
348
|
-
|
|
349
|
-
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
258
|
+
import_ItemCustomActions.ItemCustomActions,
|
|
350
259
|
{
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
260
|
+
customActions,
|
|
261
|
+
renderCustomActions,
|
|
262
|
+
CustomActionsComponent: CustomActions,
|
|
354
263
|
isDSMobile,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
selected,
|
|
358
|
-
keepContentMounted,
|
|
359
|
-
applyAriaDisabled,
|
|
264
|
+
allRefs: allChildrenReferences,
|
|
265
|
+
actualActiveValue,
|
|
360
266
|
getOwnerProps,
|
|
361
|
-
getOwnerPropsArguments
|
|
362
|
-
children
|
|
267
|
+
getOwnerPropsArguments
|
|
363
268
|
}
|
|
364
269
|
)
|
|
365
270
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/parts/accordionItem/DSAccordionItem.tsx", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADwMX;AAtMZ,iCAAkE;AAClE,8BAMO;AACP,uBAA0B;AAC1B,mBAAyD;AACzD,4BAAmC;AACnC,uBAAsC;AACtC,0BAA0C;AAE1C,mCAAuC;AACvC,+BAAkC;AAClC,uBAA0B;AAC1B,oBAOO;AACP,8BAAiC;AACjC,kCAAqC;AAErC,MAAM,kBAAkB,CAAC,UAA+C;AACtE,QAAM,wBAAoB;AAAA,IACxB;AAAA,IACA;AA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A,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,gCAA4B,kCAAS,eAAe;AAC1D,0BAA0B,YAAY;AAGtC,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var ItemCustomActions_exports = {};
|
|
30
|
+
__export(ItemCustomActions_exports, {
|
|
31
|
+
ItemCustomActions: () => ItemCustomActions
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(ItemCustomActions_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
37
|
+
var import_styles = require("./styles.js");
|
|
38
|
+
const ItemCustomActions = ({
|
|
39
|
+
customActions,
|
|
40
|
+
renderCustomActions,
|
|
41
|
+
CustomActionsComponent,
|
|
42
|
+
isDSMobile,
|
|
43
|
+
allRefs,
|
|
44
|
+
actualActiveValue,
|
|
45
|
+
getOwnerProps,
|
|
46
|
+
getOwnerPropsArguments
|
|
47
|
+
}) => {
|
|
48
|
+
if (isDSMobile) return null;
|
|
49
|
+
if (customActions?.length > 0) {
|
|
50
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
51
|
+
import_styles.StyledItemCustomActions,
|
|
52
|
+
{
|
|
53
|
+
isDSMobile,
|
|
54
|
+
getOwnerProps,
|
|
55
|
+
getOwnerPropsArguments,
|
|
56
|
+
children: customActions.map(({ onClick, id, ...otherProps }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
|
+
import_ds_button_v2.DSButtonV2,
|
|
58
|
+
{
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
if (onClick) onClick(e);
|
|
62
|
+
},
|
|
63
|
+
...otherProps,
|
|
64
|
+
buttonType: import_ds_button_v2.BUTTON_TYPES.OUTLINE
|
|
65
|
+
},
|
|
66
|
+
id
|
|
67
|
+
))
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (renderCustomActions || CustomActionsComponent) {
|
|
72
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
|
+
import_styles.StyledItemCustomActions,
|
|
74
|
+
{
|
|
75
|
+
isDSMobile,
|
|
76
|
+
getOwnerProps,
|
|
77
|
+
getOwnerPropsArguments,
|
|
78
|
+
children: CustomActionsComponent !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CustomActionsComponent, { allRefs, actualActiveValue }) : renderCustomActions?.({ allRefs, actualActiveValue })
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=ItemCustomActions.js.map
|