@elliemae/ds-accordion 2.1.0-rc.6 → 2.1.0
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/cjs/DSAccordion.js +14 -99
- package/cjs/DSAccordionCTX.js +20 -0
- package/cjs/DSAccordionDatatestid.js +14 -0
- package/cjs/DSAccordionTypes.js +2 -0
- package/cjs/config/useAccordion.js +50 -0
- package/cjs/config/useAccordionRefs.js +40 -0
- package/cjs/defaultProps.js +54 -0
- package/cjs/index.js +1 -1
- package/cjs/{DSAccordionHeaderActions.js → parts/accordionContent/AccordionContent.js} +24 -38
- package/cjs/parts/accordionItem/DSAccordionItem.js +206 -0
- package/cjs/parts/accordionItem/styles.js +133 -0
- package/cjs/parts/accordionItem/useAccordionItem.js +53 -0
- package/cjs/parts/accordionItem/useIsShowingEllipsis.js +37 -0
- package/cjs/propTypes.js +26 -0
- package/esm/DSAccordion.js +16 -98
- package/esm/DSAccordionCTX.js +16 -0
- package/esm/DSAccordionDatatestid.js +10 -0
- package/esm/DSAccordionTypes.js +1 -0
- package/esm/config/useAccordion.js +46 -0
- package/esm/config/useAccordionRefs.js +32 -0
- package/esm/defaultProps.js +45 -0
- package/esm/index.js +1 -1
- package/esm/{DSAccordionHeaderActions.js → parts/accordionContent/AccordionContent.js} +21 -35
- package/esm/parts/accordionItem/DSAccordionItem.js +193 -0
- package/esm/parts/accordionItem/styles.js +117 -0
- package/esm/parts/accordionItem/useAccordionItem.js +49 -0
- package/esm/parts/accordionItem/useIsShowingEllipsis.js +33 -0
- package/esm/propTypes.js +21 -0
- package/package.json +50 -22
- package/types/DSAccordion.d.ts +5 -35
- package/types/DSAccordionCTX.d.ts +3 -0
- package/types/DSAccordionDatatestid.d.ts +8 -0
- package/types/DSAccordionTypes.d.ts +134 -0
- package/types/config/useAccordion.d.ts +2 -0
- package/types/config/useAccordionRefs.d.ts +2 -0
- package/types/defaultProps.d.ts +3 -0
- package/types/index.d.ts +2 -1
- package/types/parts/accordionContent/AccordionContent.d.ts +2 -0
- package/types/parts/accordionItem/DSAccordionItem.d.ts +53 -0
- package/types/parts/accordionItem/styles.d.ts +10 -0
- package/types/parts/accordionItem/useAccordionItem.d.ts +2 -0
- package/types/parts/accordionItem/useIsShowingEllipsis.d.ts +5 -0
- package/types/propTypes.d.ts +73 -0
- package/cjs/DSAccordionHeader.js +0 -57
- package/cjs/DSAccordionHeaderTitle.js +0 -36
- package/cjs/DSAccordionItem.js +0 -174
- package/cjs/blocks.js +0 -23
- package/esm/DSAccordionHeader.js +0 -50
- package/esm/DSAccordionHeaderTitle.js +0 -29
- package/esm/DSAccordionItem.js +0 -162
- package/esm/blocks.js +0 -13
- package/types/DSAccordionHeader.d.ts +0 -9
- package/types/DSAccordionHeaderActions.d.ts +0 -5
- package/types/DSAccordionHeaderTitle.d.ts +0 -7
- package/types/DSAccordionItem.d.ts +0 -16
- package/types/blocks.d.ts +0 -7
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type InternalActiveValueT = (string | number)[] | string | number | null | undefined;
|
|
3
|
+
export interface DefaultIconPropsT {
|
|
4
|
+
isDSMobile: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CustomActionsT {
|
|
7
|
+
onClick: (e: React.MouseEvent) => void;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FocusableChildrenReferences {
|
|
11
|
+
index: number;
|
|
12
|
+
value: string | number;
|
|
13
|
+
ref: React.MutableRefObject<HTMLButtonElement | null>;
|
|
14
|
+
}
|
|
15
|
+
export interface AllChildrenReferences {
|
|
16
|
+
[index: string]: React.MutableRefObject<HTMLButtonElement | null>;
|
|
17
|
+
}
|
|
18
|
+
export interface DSAccordionPropsT {
|
|
19
|
+
containerProps?: Record<string, unknown>;
|
|
20
|
+
activeValue?: (string | number)[] | string | number | null;
|
|
21
|
+
children?: React.ReactElement<DSAccordionItemPropsT>[];
|
|
22
|
+
allowMultipleOpen?: boolean;
|
|
23
|
+
contentExpandable?: boolean;
|
|
24
|
+
onChange?: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
isDSMobile?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface DSAccordionDefaultPropsT {
|
|
29
|
+
containerProps: Record<string, unknown>;
|
|
30
|
+
allowMultipleOpen: boolean;
|
|
31
|
+
contentExpandable: boolean;
|
|
32
|
+
onChange: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
33
|
+
children: React.ReactElement<DSAccordionItemPropsT>[];
|
|
34
|
+
isDSMobile: boolean;
|
|
35
|
+
}
|
|
36
|
+
export interface DSAccordionPropsWithDefaultsT {
|
|
37
|
+
containerProps: Record<string, unknown>;
|
|
38
|
+
activeValue?: (string | number)[] | string | number | null;
|
|
39
|
+
children: React.ReactElement<DSAccordionItemPropsT>[];
|
|
40
|
+
allowMultipleOpen: boolean;
|
|
41
|
+
contentExpandable: boolean;
|
|
42
|
+
onChange: (value: (string | number)[] | string | number | null, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
43
|
+
isDSMobile: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface DSAccordionItemPropsT {
|
|
46
|
+
title?: string;
|
|
47
|
+
value: string | number;
|
|
48
|
+
iconClosed?: React.FunctionComponent<DefaultIconPropsT>;
|
|
49
|
+
iconOpened?: React.FunctionComponent<DefaultIconPropsT>;
|
|
50
|
+
children?: React.ReactNode;
|
|
51
|
+
secondaryTitle?: string;
|
|
52
|
+
customActions?: CustomActionsT[];
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
dsIndex: number;
|
|
55
|
+
renderCustomActions?: (props: {
|
|
56
|
+
allRefs: AllChildrenReferences;
|
|
57
|
+
actualActiveValue: InternalActiveValueT;
|
|
58
|
+
}) => JSX.Element;
|
|
59
|
+
}
|
|
60
|
+
export interface DSAccordionItemDefaultPropsT {
|
|
61
|
+
iconClosed: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>;
|
|
62
|
+
iconOpened: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>>;
|
|
63
|
+
title: string;
|
|
64
|
+
customActions: CustomActionsT[];
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface DSAccordionItemPropsWithDefaultsT {
|
|
68
|
+
title: string;
|
|
69
|
+
value: string | number;
|
|
70
|
+
iconClosed: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>> | React.FunctionComponent<DefaultIconPropsT>;
|
|
71
|
+
iconOpened: React.MemoExoticComponent<React.FunctionComponent<DefaultIconPropsT>> | React.FunctionComponent<DefaultIconPropsT>;
|
|
72
|
+
children?: React.ReactNode;
|
|
73
|
+
secondaryTitle?: string;
|
|
74
|
+
customActions: CustomActionsT[];
|
|
75
|
+
disabled: boolean;
|
|
76
|
+
dsIndex: number;
|
|
77
|
+
renderCustomActions?: (props: {
|
|
78
|
+
allRefs: AllChildrenReferences;
|
|
79
|
+
actualActiveValue: InternalActiveValueT;
|
|
80
|
+
}) => JSX.Element;
|
|
81
|
+
}
|
|
82
|
+
export interface DSAccordionContextT {
|
|
83
|
+
props: DSAccordionPropsWithDefaultsT;
|
|
84
|
+
actualActiveValue: InternalActiveValueT;
|
|
85
|
+
setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
86
|
+
focusableChildrenReferences: FocusableChildrenReferences[];
|
|
87
|
+
allChildrenReferences: AllChildrenReferences;
|
|
88
|
+
}
|
|
89
|
+
export interface DSAccordionUseAccordionContextT {
|
|
90
|
+
props: DSAccordionPropsWithDefaultsT;
|
|
91
|
+
actualActiveValue: InternalActiveValueT;
|
|
92
|
+
setActiveValues: (value: string | number, e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
93
|
+
focusableChildrenReferences: FocusableChildrenReferences[];
|
|
94
|
+
allChildrenReferences: AllChildrenReferences;
|
|
95
|
+
}
|
|
96
|
+
export interface UseAccordionPropsT {
|
|
97
|
+
value: string | number;
|
|
98
|
+
disabled: boolean;
|
|
99
|
+
}
|
|
100
|
+
export interface UseAccordionItemReturnTypeT {
|
|
101
|
+
handleOnClick: (e: React.MouseEvent) => void;
|
|
102
|
+
handleOnKeyDown: (e: React.KeyboardEvent, dsIndex: number) => void;
|
|
103
|
+
selected: boolean;
|
|
104
|
+
}
|
|
105
|
+
export interface UseAccordionRefsPropsT {
|
|
106
|
+
children: React.ReactElement<DSAccordionItemPropsT>[];
|
|
107
|
+
}
|
|
108
|
+
export interface UseAccordionRefsReturnTypeT {
|
|
109
|
+
focusableChildrenReferences: FocusableChildrenReferences[];
|
|
110
|
+
allChildrenReferences: AllChildrenReferences;
|
|
111
|
+
}
|
|
112
|
+
export interface StyledItemHeaderPropsT {
|
|
113
|
+
withCustomActions: boolean;
|
|
114
|
+
withSecondaryTitle?: string;
|
|
115
|
+
isDSMobile: boolean;
|
|
116
|
+
}
|
|
117
|
+
export interface StyledItemTitlesPropsT {
|
|
118
|
+
withSecondaryTitle?: string;
|
|
119
|
+
isDSMobile: boolean;
|
|
120
|
+
}
|
|
121
|
+
export interface StyledPrimaryTitlePropsT {
|
|
122
|
+
disabled: boolean;
|
|
123
|
+
isDSMobile: boolean;
|
|
124
|
+
}
|
|
125
|
+
export interface StyledItemContentPropsT {
|
|
126
|
+
isDSMobile: boolean;
|
|
127
|
+
}
|
|
128
|
+
export interface StyledSecondaryTitlePropsT {
|
|
129
|
+
disabled: boolean;
|
|
130
|
+
}
|
|
131
|
+
export interface StyledItemAddonPropsT {
|
|
132
|
+
disabled: boolean;
|
|
133
|
+
isDSMobile: boolean;
|
|
134
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/// <reference path="../../../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { DSAccordionItemPropsT } from '../../DSAccordionTypes';
|
|
4
|
+
declare const DSAccordionItem: {
|
|
5
|
+
(props: DSAccordionItemPropsT): JSX.Element;
|
|
6
|
+
propTypes: {
|
|
7
|
+
children: import("react-desc").PropTypesDescValue;
|
|
8
|
+
title: {
|
|
9
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
10
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
11
|
+
};
|
|
12
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
13
|
+
};
|
|
14
|
+
value: import("react-desc").PropTypesDescValue;
|
|
15
|
+
iconClosed: {
|
|
16
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
17
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
18
|
+
};
|
|
19
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
20
|
+
};
|
|
21
|
+
iconOpened: {
|
|
22
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
23
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
26
|
+
};
|
|
27
|
+
secondaryTitle: {
|
|
28
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
29
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
32
|
+
};
|
|
33
|
+
customActions: {
|
|
34
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
35
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
38
|
+
};
|
|
39
|
+
renderCustomActions: {
|
|
40
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
41
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
declare const DSAccordionItemWithSchema: {
|
|
48
|
+
(props?: DSAccordionItemPropsT | undefined): JSX.Element;
|
|
49
|
+
propTypes: unknown;
|
|
50
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
51
|
+
};
|
|
52
|
+
export { DSAccordionItem, DSAccordionItemWithSchema };
|
|
53
|
+
export default DSAccordionItem;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StyledItemAddonPropsT, StyledItemHeaderPropsT, StyledItemTitlesPropsT, StyledPrimaryTitlePropsT, StyledSecondaryTitlePropsT, StyledItemContentPropsT } from '../../DSAccordionTypes';
|
|
2
|
+
export declare const StyledItemContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
+
export declare const StyledItemHeader: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, StyledItemHeaderPropsT, never>;
|
|
4
|
+
export declare const StyledItemContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemContentPropsT, never>;
|
|
5
|
+
export declare const StyledItemAddon: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemAddonPropsT, never>;
|
|
6
|
+
export declare const StyledItemTitles: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemTitlesPropsT, never>;
|
|
7
|
+
export declare const StyledPrimaryTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledPrimaryTitlePropsT, never>;
|
|
8
|
+
export declare const StyledSecondaryTitle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, StyledSecondaryTitlePropsT, never>;
|
|
9
|
+
export declare const StyledItemCustomActions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
10
|
+
export declare const StyledItemHeaderContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
export declare const accordionItemPropTypes: {
|
|
3
|
+
children: import("react-desc").PropTypesDescValue;
|
|
4
|
+
title: {
|
|
5
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
6
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
7
|
+
};
|
|
8
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
9
|
+
};
|
|
10
|
+
value: import("react-desc").PropTypesDescValue;
|
|
11
|
+
iconClosed: {
|
|
12
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
13
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
14
|
+
};
|
|
15
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
16
|
+
};
|
|
17
|
+
iconOpened: {
|
|
18
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
19
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
20
|
+
};
|
|
21
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
22
|
+
};
|
|
23
|
+
secondaryTitle: {
|
|
24
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
25
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
26
|
+
};
|
|
27
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
28
|
+
};
|
|
29
|
+
customActions: {
|
|
30
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
31
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
32
|
+
};
|
|
33
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
34
|
+
};
|
|
35
|
+
renderCustomActions: {
|
|
36
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
37
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
38
|
+
};
|
|
39
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const accordionPropTypes: {
|
|
43
|
+
containerProps: {
|
|
44
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
45
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
47
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
48
|
+
};
|
|
49
|
+
activeValue: {
|
|
50
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
51
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
+
};
|
|
53
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
54
|
+
};
|
|
55
|
+
children: {
|
|
56
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
57
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
58
|
+
};
|
|
59
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
60
|
+
};
|
|
61
|
+
allowMultipleOpen: {
|
|
62
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
63
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
64
|
+
};
|
|
65
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
66
|
+
};
|
|
67
|
+
onChange: {
|
|
68
|
+
defaultValue(arg: import("react-desc").ReactDescPossibleDefaultValues): {
|
|
69
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
70
|
+
};
|
|
71
|
+
isRequired: import("react-desc").PropTypesDescValue;
|
|
72
|
+
};
|
|
73
|
+
};
|
package/cjs/DSAccordionHeader.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('react');
|
|
5
|
-
var dsSystem = require('@elliemae/ds-system');
|
|
6
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
7
|
-
var DSButton = require('@elliemae/ds-button');
|
|
8
|
-
var DSAccordionHeaderActions = require('./DSAccordionHeaderActions.js');
|
|
9
|
-
var DSAccordionHeaderTitle = require('./DSAccordionHeaderTitle.js');
|
|
10
|
-
var blocks = require('./blocks.js');
|
|
11
|
-
|
|
12
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
|
-
|
|
14
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
15
|
-
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
16
|
-
|
|
17
|
-
const DSAccordionHeader = dsSystem.withTheme(_ref => {
|
|
18
|
-
let {
|
|
19
|
-
title,
|
|
20
|
-
secondaryTitle,
|
|
21
|
-
customActions,
|
|
22
|
-
idx,
|
|
23
|
-
icon,
|
|
24
|
-
selected,
|
|
25
|
-
setTabRef,
|
|
26
|
-
onClick,
|
|
27
|
-
onKeyDown
|
|
28
|
-
} = _ref;
|
|
29
|
-
const mobile = dsSystem.useIsMobile();
|
|
30
|
-
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
31
|
-
const selectedClass = selected ? 'selected' : '';
|
|
32
|
-
const labelClass = hasSecondaryTitle ? 'secondary-title' : '';
|
|
33
|
-
const IconMobile = selected ? dsIcons.ChevronDown : dsIcons.ChevronRight;
|
|
34
|
-
return /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
35
|
-
"aria-controls": "sec".concat(idx),
|
|
36
|
-
"aria-expanded": selected,
|
|
37
|
-
"aria-label": title,
|
|
38
|
-
as: "div",
|
|
39
|
-
buttonType: "secondary",
|
|
40
|
-
className: "".concat(blocks.accordionButton, " ").concat(selectedClass, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : ''),
|
|
41
|
-
"data-testid": "ds-accordion_item-header",
|
|
42
|
-
innerRef: setTabRef,
|
|
43
|
-
labelText: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
44
|
-
className: "".concat(blocks.accordionTitle, " ").concat(selectedClass, " ").concat(labelClass)
|
|
45
|
-
}, void 0, !mobile && icon, /*#__PURE__*/_jsx__default["default"](DSAccordionHeaderTitle, {
|
|
46
|
-
idx: idx,
|
|
47
|
-
secondaryTitle: secondaryTitle,
|
|
48
|
-
title: title
|
|
49
|
-
}), !mobile && /*#__PURE__*/_jsx__default["default"](DSAccordionHeaderActions, {
|
|
50
|
-
customActions: customActions
|
|
51
|
-
}), mobile && /*#__PURE__*/_jsx__default["default"](IconMobile, {})),
|
|
52
|
-
onClick: onClick,
|
|
53
|
-
onKeyDown: onKeyDown
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
module.exports = DSAccordionHeader;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
4
|
-
require('react');
|
|
5
|
-
var DSTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
6
|
-
var blocks = require('./blocks.js');
|
|
7
|
-
|
|
8
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
-
|
|
10
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
11
|
-
var DSTruncatedTooltipText__default = /*#__PURE__*/_interopDefaultLegacy(DSTruncatedTooltipText);
|
|
12
|
-
|
|
13
|
-
var _div;
|
|
14
|
-
|
|
15
|
-
const DSAccordionHeader = _ref => {
|
|
16
|
-
let {
|
|
17
|
-
title,
|
|
18
|
-
secondaryTitle,
|
|
19
|
-
idx
|
|
20
|
-
} = _ref;
|
|
21
|
-
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
22
|
-
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
23
|
-
className: "".concat(blocks.accordionTitleWrapper, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : '')
|
|
24
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"]("h2", {
|
|
25
|
-
id: "accordion_".concat(idx, "id")
|
|
26
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
27
|
-
className: blocks.accordionH2Title,
|
|
28
|
-
value: title
|
|
29
|
-
})), hasSecondaryTitle && /*#__PURE__*/_jsx__default["default"](DSTruncatedTooltipText__default["default"], {
|
|
30
|
-
className: blocks.accordionSecondaryTitle,
|
|
31
|
-
containerComponent: _div || (_div = /*#__PURE__*/_jsx__default["default"]("div", {})),
|
|
32
|
-
value: secondaryTitle
|
|
33
|
-
}));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
module.exports = DSAccordionHeader;
|
package/cjs/DSAccordionItem.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
-
var React = require('react');
|
|
7
|
-
var dsIcons = require('@elliemae/ds-icons');
|
|
8
|
-
var GroupItem = require('@elliemae/ds-shared/GroupContext/GroupItem');
|
|
9
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
10
|
-
var reactDesc = require('react-desc');
|
|
11
|
-
var DSAccordionHeader = require('./DSAccordionHeader.js');
|
|
12
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
13
|
-
|
|
14
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
|
-
|
|
16
|
-
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
17
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
-
var GroupItem__default = /*#__PURE__*/_interopDefaultLegacy(GroupItem);
|
|
19
|
-
|
|
20
|
-
const ICON_SIZE = 's';
|
|
21
|
-
const INCREMENT = 8;
|
|
22
|
-
const QTY_PADDING = 40;
|
|
23
|
-
const {
|
|
24
|
-
cssClassName,
|
|
25
|
-
classNameElement
|
|
26
|
-
} = dsClassnames.convertPropToCssClassName('accordion-item');
|
|
27
|
-
|
|
28
|
-
class DSAccordionItem extends React.Component {
|
|
29
|
-
constructor(props) {
|
|
30
|
-
super(props);
|
|
31
|
-
|
|
32
|
-
this.setHeight = element => {
|
|
33
|
-
const {
|
|
34
|
-
actualHeight
|
|
35
|
-
} = this.state;
|
|
36
|
-
setTimeout(() => {
|
|
37
|
-
const {
|
|
38
|
-
height
|
|
39
|
-
} = element.getBoundingClientRect();
|
|
40
|
-
|
|
41
|
-
if (height) {
|
|
42
|
-
const newHeight = INCREMENT * QTY_PADDING + height;
|
|
43
|
-
if (actualHeight === newHeight) return;
|
|
44
|
-
this.setState({
|
|
45
|
-
actualHeight: 'auto' // newHeight,
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}, 0);
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
this.childElements = /*#__PURE__*/React__default["default"].createRef();
|
|
53
|
-
this.state = {
|
|
54
|
-
actualHeight: null
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
componentDidMount() {
|
|
59
|
-
this.setHeight(this.childElements.current);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
componentDidUpdate() {
|
|
63
|
-
const {
|
|
64
|
-
expandable
|
|
65
|
-
} = this.props;
|
|
66
|
-
|
|
67
|
-
if (expandable) {
|
|
68
|
-
this.setHeight(this.childElements.current);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
render() {
|
|
73
|
-
const {
|
|
74
|
-
children,
|
|
75
|
-
title,
|
|
76
|
-
secondaryTitle,
|
|
77
|
-
customActions,
|
|
78
|
-
value,
|
|
79
|
-
idx,
|
|
80
|
-
iconOpened,
|
|
81
|
-
iconClosed,
|
|
82
|
-
setTabRef,
|
|
83
|
-
handleKeyPress
|
|
84
|
-
} = this.props;
|
|
85
|
-
const {
|
|
86
|
-
actualHeight
|
|
87
|
-
} = this.state;
|
|
88
|
-
return /*#__PURE__*/_jsx__default["default"](GroupItem__default["default"], {
|
|
89
|
-
render: context => {
|
|
90
|
-
const {
|
|
91
|
-
activeValue
|
|
92
|
-
} = context;
|
|
93
|
-
const selected = activeValue !== undefined && (activeValue === value || activeValue.length && activeValue.indexOf(value) > -1);
|
|
94
|
-
const OpenedCloseIcon = selected ? iconOpened : iconClosed;
|
|
95
|
-
return /*#__PURE__*/_jsx__default["default"]("div", {
|
|
96
|
-
className: cssClassName,
|
|
97
|
-
"data-testid": "ds-accordion_item"
|
|
98
|
-
}, void 0, /*#__PURE__*/_jsx__default["default"](DSAccordionHeader, {
|
|
99
|
-
customActions: customActions,
|
|
100
|
-
icon: /*#__PURE__*/_jsx__default["default"](OpenedCloseIcon, {
|
|
101
|
-
size: ICON_SIZE
|
|
102
|
-
}),
|
|
103
|
-
idx: idx,
|
|
104
|
-
onClick: () => context.onChange(value),
|
|
105
|
-
onKeyDown: e => handleKeyPress(idx, e),
|
|
106
|
-
secondaryTitle: secondaryTitle,
|
|
107
|
-
selected: selected,
|
|
108
|
-
setTabRef: setTabRef,
|
|
109
|
-
title: title
|
|
110
|
-
}), /*#__PURE__*/_jsx__default["default"]("div", {
|
|
111
|
-
"data-testid": "ds-accordion_item-content",
|
|
112
|
-
"aria-hidden": !selected,
|
|
113
|
-
"aria-labelledby": "accordion_".concat(idx, "id"),
|
|
114
|
-
className: "".concat(classNameElement('container'), " ").concat(selected ? 'expanded' : 'closed'),
|
|
115
|
-
"data-testid": "ds-accordion_item-content",
|
|
116
|
-
id: "sec".concat(idx),
|
|
117
|
-
role: "region",
|
|
118
|
-
style: {
|
|
119
|
-
height: selected ? actualHeight : 0
|
|
120
|
-
}
|
|
121
|
-
}, void 0, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
122
|
-
ref: this.childElements,
|
|
123
|
-
className: classNameElement('expand-zone'),
|
|
124
|
-
children: /*#__PURE__*/_jsx__default["default"]("div", {
|
|
125
|
-
className: classNameElement('expand-zone-space')
|
|
126
|
-
}, void 0, selected && children)
|
|
127
|
-
})));
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const props = {
|
|
135
|
-
/** accordion content */
|
|
136
|
-
children: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.node), reactDesc.PropTypes.node]).isRequired.description('accordion content'),
|
|
137
|
-
|
|
138
|
-
/** accordion title */
|
|
139
|
-
title: reactDesc.PropTypes.string.description('accordion title'),
|
|
140
|
-
|
|
141
|
-
/** accordion item value, for selected */
|
|
142
|
-
value: reactDesc.PropTypes.oneOfType([reactDesc.PropTypes.string, reactDesc.PropTypes.number]).isRequired.description('accordion item value, for selected'),
|
|
143
|
-
|
|
144
|
-
/** icon for closed accordion */
|
|
145
|
-
iconClosed: reactDesc.PropTypes.node.description('icon for closed accordion'),
|
|
146
|
-
|
|
147
|
-
/** icon for open accordion */
|
|
148
|
-
iconOpened: reactDesc.PropTypes.node.description('icon for open accordion'),
|
|
149
|
-
|
|
150
|
-
/** secondary title */
|
|
151
|
-
secondaryTitle: reactDesc.PropTypes.string.description('secondary title'),
|
|
152
|
-
|
|
153
|
-
/** accordion item custom actions */
|
|
154
|
-
customActions: reactDesc.PropTypes.arrayOf(reactDesc.PropTypes.object).description('accordion item custom actions')
|
|
155
|
-
};
|
|
156
|
-
DSAccordionItem.defaultProps = {
|
|
157
|
-
iconClosed: () => /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadRight, {
|
|
158
|
-
width: "20px",
|
|
159
|
-
color: ['brand-primary', 800]
|
|
160
|
-
}),
|
|
161
|
-
iconOpened: () => /*#__PURE__*/_jsx__default["default"](dsIcons.ArrowheadDown, {
|
|
162
|
-
width: "20px",
|
|
163
|
-
color: ['brand-primary', 800]
|
|
164
|
-
}),
|
|
165
|
-
title: '',
|
|
166
|
-
secondaryTitle: null,
|
|
167
|
-
customActions: null
|
|
168
|
-
};
|
|
169
|
-
const DSAccordionItemWithSchema = reactDesc.describe(DSAccordionItem);
|
|
170
|
-
DSAccordionItemWithSchema.propTypes = props;
|
|
171
|
-
|
|
172
|
-
exports.DSAccordionItem = DSAccordionItem;
|
|
173
|
-
exports.DSAccordionItemWithSchema = DSAccordionItemWithSchema;
|
|
174
|
-
exports["default"] = DSAccordionItem;
|
package/cjs/blocks.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
6
|
-
|
|
7
|
-
const {
|
|
8
|
-
classNameElement
|
|
9
|
-
} = dsClassnames.convertPropToCssClassName('accordion-item');
|
|
10
|
-
const accordionActions = classNameElement('accordion-actions');
|
|
11
|
-
const accordionTitleWrapper = classNameElement('title-wrapper');
|
|
12
|
-
const accordionH2Title = classNameElement('h2-title');
|
|
13
|
-
const accordionSecondaryTitle = classNameElement('secondary-title');
|
|
14
|
-
const accordionTitle = classNameElement('title');
|
|
15
|
-
const accordionButton = classNameElement('accordion-button');
|
|
16
|
-
|
|
17
|
-
exports.accordionActions = accordionActions;
|
|
18
|
-
exports.accordionButton = accordionButton;
|
|
19
|
-
exports.accordionH2Title = accordionH2Title;
|
|
20
|
-
exports.accordionSecondaryTitle = accordionSecondaryTitle;
|
|
21
|
-
exports.accordionTitle = accordionTitle;
|
|
22
|
-
exports.accordionTitleWrapper = accordionTitleWrapper;
|
|
23
|
-
exports.classNameElement = classNameElement;
|
package/esm/DSAccordionHeader.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
-
import 'react';
|
|
3
|
-
import { withTheme, useIsMobile } from '@elliemae/ds-system';
|
|
4
|
-
import { ChevronDown, ChevronRight } from '@elliemae/ds-icons';
|
|
5
|
-
import DSButton from '@elliemae/ds-button';
|
|
6
|
-
import DSAccordionHeaderActions from './DSAccordionHeaderActions.js';
|
|
7
|
-
import DSAccordionHeader$1 from './DSAccordionHeaderTitle.js';
|
|
8
|
-
import { accordionButton, accordionTitle } from './blocks.js';
|
|
9
|
-
|
|
10
|
-
const DSAccordionHeader = withTheme(_ref => {
|
|
11
|
-
let {
|
|
12
|
-
title,
|
|
13
|
-
secondaryTitle,
|
|
14
|
-
customActions,
|
|
15
|
-
idx,
|
|
16
|
-
icon,
|
|
17
|
-
selected,
|
|
18
|
-
setTabRef,
|
|
19
|
-
onClick,
|
|
20
|
-
onKeyDown
|
|
21
|
-
} = _ref;
|
|
22
|
-
const mobile = useIsMobile();
|
|
23
|
-
const hasSecondaryTitle = Boolean(secondaryTitle);
|
|
24
|
-
const selectedClass = selected ? 'selected' : '';
|
|
25
|
-
const labelClass = hasSecondaryTitle ? 'secondary-title' : '';
|
|
26
|
-
const IconMobile = selected ? ChevronDown : ChevronRight;
|
|
27
|
-
return /*#__PURE__*/_jsx(DSButton, {
|
|
28
|
-
"aria-controls": "sec".concat(idx),
|
|
29
|
-
"aria-expanded": selected,
|
|
30
|
-
"aria-label": title,
|
|
31
|
-
as: "div",
|
|
32
|
-
buttonType: "secondary",
|
|
33
|
-
className: "".concat(accordionButton, " ").concat(selectedClass, " ").concat(hasSecondaryTitle ? 'with-secondary-title' : ''),
|
|
34
|
-
"data-testid": "ds-accordion_item-header",
|
|
35
|
-
innerRef: setTabRef,
|
|
36
|
-
labelText: /*#__PURE__*/_jsx("div", {
|
|
37
|
-
className: "".concat(accordionTitle, " ").concat(selectedClass, " ").concat(labelClass)
|
|
38
|
-
}, void 0, !mobile && icon, /*#__PURE__*/_jsx(DSAccordionHeader$1, {
|
|
39
|
-
idx: idx,
|
|
40
|
-
secondaryTitle: secondaryTitle,
|
|
41
|
-
title: title
|
|
42
|
-
}), !mobile && /*#__PURE__*/_jsx(DSAccordionHeaderActions, {
|
|
43
|
-
customActions: customActions
|
|
44
|
-
}), mobile && /*#__PURE__*/_jsx(IconMobile, {})),
|
|
45
|
-
onClick: onClick,
|
|
46
|
-
onKeyDown: onKeyDown
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export { DSAccordionHeader as default };
|