@elliemae/ds-accordion 2.2.0-next.6 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/parts/accordionItem/DSAccordionItem.js +3 -3
- package/cjs/parts/accordionItem/styles.js +49 -33
- package/cjs/parts/accordionItem/useIsShowingEllipsis.js +37 -0
- package/esm/parts/accordionItem/DSAccordionItem.js +1 -1
- package/esm/parts/accordionItem/styles.js +49 -33
- package/esm/parts/accordionItem/useIsShowingEllipsis.js +33 -0
- package/package.json +11 -7
- package/types/DSAccordion.d.ts +1 -1
- package/types/DSAccordionTypes.d.ts +3 -0
- package/types/parts/accordionItem/DSAccordionItem.d.ts +1 -1
- package/types/parts/accordionItem/styles.d.ts +2 -2
- package/types/parts/accordionItem/useIsShowingEllipsis.d.ts +5 -0
|
@@ -18,13 +18,13 @@ var reactDesc = require('react-desc');
|
|
|
18
18
|
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
19
19
|
var DSButton = require('@elliemae/ds-button');
|
|
20
20
|
var dsPopperjs = require('@elliemae/ds-popperjs');
|
|
21
|
-
var dsUtilities = require('@elliemae/ds-utilities');
|
|
22
21
|
var defaultProps = require('../../defaultProps.js');
|
|
23
22
|
var styles = require('./styles.js');
|
|
24
23
|
var propTypes = require('../../propTypes.js');
|
|
25
24
|
var useAccordionItem = require('./useAccordionItem.js');
|
|
26
25
|
var DSAccordionCTX = require('../../DSAccordionCTX.js');
|
|
27
26
|
var DSAccordionDatatestid = require('../../DSAccordionDatatestid.js');
|
|
27
|
+
var useIsShowingEllipsis = require('./useIsShowingEllipsis.js');
|
|
28
28
|
var jsxRuntime = require('react/jsx-runtime');
|
|
29
29
|
|
|
30
30
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -100,11 +100,11 @@ const DSAccordionItem = props => {
|
|
|
100
100
|
const {
|
|
101
101
|
isShowingEllipsis: isPrimaryShowingEllipsis,
|
|
102
102
|
setElement: setPrimaryElement
|
|
103
|
-
} =
|
|
103
|
+
} = useIsShowingEllipsis.useIsShowingEllipsis();
|
|
104
104
|
const {
|
|
105
105
|
isShowingEllipsis: isSecondaryShowingEllipsis,
|
|
106
106
|
setElement: setSecondaryElement
|
|
107
|
-
} =
|
|
107
|
+
} = useIsShowingEllipsis.useIsShowingEllipsis();
|
|
108
108
|
const handleOnFocus = React.useCallback(() => setShowPopover(isPrimaryShowingEllipsis || isSecondaryShowingEllipsis), [isPrimaryShowingEllipsis, isSecondaryShowingEllipsis]);
|
|
109
109
|
const handleOnBlur = React.useCallback(() => setShowPopover(false), []);
|
|
110
110
|
const Titles = React.useMemo(() => {
|
|
@@ -18,53 +18,54 @@ const StyledItemContainer = /*#__PURE__*/styled__default["default"].div.withConf
|
|
|
18
18
|
});
|
|
19
19
|
const StyledItemHeader = /*#__PURE__*/styled__default["default"].button.withConfig({
|
|
20
20
|
componentId: "sc-fnpjby-1"
|
|
21
|
-
})(["display:
|
|
21
|
+
})(["display:flex;height:", ";width:100%;align-items:center;border:none;outline:none;background:none;&:hover{cursor:", ";}padding:", ";", " &:focus{&:after{position:absolute;content:'';left:0;top:0;width:100%;height:100%;border-radius:2px;border:2px solid ", ";pointer-events:none;}}"], _ref2 => {
|
|
22
22
|
let {
|
|
23
|
+
theme,
|
|
23
24
|
withSecondaryTitle
|
|
24
25
|
} = _ref2;
|
|
25
|
-
return withSecondaryTitle ?
|
|
26
|
+
return withSecondaryTitle ? theme.space.m : theme.space.s;
|
|
26
27
|
}, _ref3 => {
|
|
27
28
|
let {
|
|
28
|
-
|
|
29
|
-
isDSMobile
|
|
29
|
+
disabled
|
|
30
30
|
} = _ref3;
|
|
31
|
-
return
|
|
31
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
32
32
|
}, _ref4 => {
|
|
33
33
|
let {
|
|
34
|
-
|
|
34
|
+
isDSMobile
|
|
35
35
|
} = _ref4;
|
|
36
|
-
return
|
|
36
|
+
return isDSMobile ? "0 16px" : "0";
|
|
37
37
|
}, _ref5 => {
|
|
38
38
|
let {
|
|
39
39
|
isDSMobile
|
|
40
40
|
} = _ref5;
|
|
41
|
-
return isDSMobile ? "
|
|
41
|
+
return isDSMobile ? "flex-direction: row-reverse;" : "";
|
|
42
42
|
}, _ref6 => {
|
|
43
|
-
let {
|
|
44
|
-
isDSMobile
|
|
45
|
-
} = _ref6;
|
|
46
|
-
return isDSMobile ? "grid-template-areas: 'title addon';" : "";
|
|
47
|
-
}, _ref7 => {
|
|
48
43
|
let {
|
|
49
44
|
theme
|
|
50
|
-
} =
|
|
45
|
+
} = _ref6;
|
|
51
46
|
return theme.colors.brand[700];
|
|
52
47
|
});
|
|
53
48
|
const StyledItemContent = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
54
49
|
componentId: "sc-fnpjby-2"
|
|
55
|
-
})(["margin:", ";grid-column:1/2;"],
|
|
50
|
+
})(["margin:", ";grid-column:1/2;"], _ref7 => {
|
|
56
51
|
let {
|
|
57
52
|
isDSMobile
|
|
58
|
-
} =
|
|
53
|
+
} = _ref7;
|
|
59
54
|
return isDSMobile ? "16px 16px 24px 16px" : "16px 16px 16px 32px";
|
|
60
55
|
});
|
|
61
56
|
const StyledItemAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
62
57
|
componentId: "sc-fnpjby-3"
|
|
63
|
-
})(["", " height:100%;display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"],
|
|
58
|
+
})(["", " height:100%;width:", ";display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"], _ref8 => {
|
|
64
59
|
let {
|
|
60
|
+
theme,
|
|
65
61
|
isDSMobile
|
|
62
|
+
} = _ref8;
|
|
63
|
+
return !isDSMobile ? "padding: 0 ".concat(theme.space.xxs, ";") : "";
|
|
64
|
+
}, _ref9 => {
|
|
65
|
+
let {
|
|
66
|
+
theme
|
|
66
67
|
} = _ref9;
|
|
67
|
-
return
|
|
68
|
+
return theme.space.s;
|
|
68
69
|
}, _ref10 => {
|
|
69
70
|
let {
|
|
70
71
|
disabled,
|
|
@@ -74,30 +75,30 @@ const StyledItemAddon = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
|
74
75
|
});
|
|
75
76
|
const StyledItemTitles = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
76
77
|
componentId: "sc-fnpjby-4"
|
|
77
|
-
})(["display:grid;grid-template-columns:100%;align-content:center;"
|
|
78
|
-
let {
|
|
79
|
-
isDSMobile
|
|
80
|
-
} = _ref11;
|
|
81
|
-
return isDSMobile ? "grid-area: title;" : "";
|
|
82
|
-
});
|
|
78
|
+
})(["display:grid;grid-template-columns:100%;width:100%;align-content:center;"]);
|
|
83
79
|
const StyledPrimaryTitle = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
84
80
|
componentId: "sc-fnpjby-5"
|
|
85
|
-
})(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:
|
|
81
|
+
})(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref11 => {
|
|
86
82
|
let {
|
|
87
83
|
disabled,
|
|
88
84
|
theme
|
|
89
|
-
} =
|
|
85
|
+
} = _ref11;
|
|
90
86
|
return disabled ? theme.colors.neutral[200] : theme.colors.neutral[700];
|
|
91
|
-
},
|
|
87
|
+
}, _ref12 => {
|
|
92
88
|
let {
|
|
93
89
|
theme,
|
|
94
90
|
isDSMobile
|
|
95
|
-
} =
|
|
91
|
+
} = _ref12;
|
|
96
92
|
return isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular;
|
|
93
|
+
}, _ref13 => {
|
|
94
|
+
let {
|
|
95
|
+
theme
|
|
96
|
+
} = _ref13;
|
|
97
|
+
return theme.space.xs;
|
|
97
98
|
});
|
|
98
99
|
const StyledSecondaryTitle = /*#__PURE__*/styled__default["default"].span.withConfig({
|
|
99
100
|
componentId: "sc-fnpjby-6"
|
|
100
|
-
})(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:
|
|
101
|
+
})(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref14 => {
|
|
101
102
|
let {
|
|
102
103
|
theme
|
|
103
104
|
} = _ref14;
|
|
@@ -108,18 +109,33 @@ const StyledSecondaryTitle = /*#__PURE__*/styled__default["default"].span.withCo
|
|
|
108
109
|
theme
|
|
109
110
|
} = _ref15;
|
|
110
111
|
return disabled ? theme.colors.neutral[200] : theme.colors.neutral[500];
|
|
112
|
+
}, _ref16 => {
|
|
113
|
+
let {
|
|
114
|
+
theme
|
|
115
|
+
} = _ref16;
|
|
116
|
+
return theme.space.xs;
|
|
111
117
|
});
|
|
112
118
|
const StyledItemCustomActions = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
113
119
|
componentId: "sc-fnpjby-7"
|
|
114
|
-
})(["display:grid;grid-auto-flow:column;grid-gap:
|
|
120
|
+
})(["display:grid;grid-auto-flow:column;grid-gap:", ";margin:0 ", ";justify-content:flex-end;"], _ref17 => {
|
|
121
|
+
let {
|
|
122
|
+
theme
|
|
123
|
+
} = _ref17;
|
|
124
|
+
return theme.space.xxs;
|
|
125
|
+
}, _ref18 => {
|
|
126
|
+
let {
|
|
127
|
+
theme
|
|
128
|
+
} = _ref18;
|
|
129
|
+
return theme.space.xs;
|
|
130
|
+
});
|
|
115
131
|
const StyledItemHeaderContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
|
|
116
132
|
componentId: "sc-fnpjby-8"
|
|
117
|
-
})(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", "
|
|
133
|
+
})(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", "}"], _ref19 => {
|
|
118
134
|
let {
|
|
119
135
|
disabled,
|
|
120
136
|
theme
|
|
121
|
-
} =
|
|
122
|
-
return !disabled ? "background: ".concat(theme.colors.brand[200]) : "";
|
|
137
|
+
} = _ref19;
|
|
138
|
+
return !disabled ? "background: ".concat(theme.colors.brand[200], ";") : "";
|
|
123
139
|
});
|
|
124
140
|
|
|
125
141
|
exports.StyledItemAddon = StyledItemAddon;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
|
|
8
|
+
const useIsShowingEllipsis = () => {
|
|
9
|
+
const [element, setElement] = React.useState();
|
|
10
|
+
const [isShowingEllipsis, setIsShowingEllipsis] = React.useState(false); // const isShowingEllipsis = element?.scrollWidth > primaryTitleWrapperEl?.clientWidth;
|
|
11
|
+
|
|
12
|
+
const resizeObserver = React.useMemo(() => new ResizeObserver(entries => {
|
|
13
|
+
if (entries.length) {
|
|
14
|
+
const [textWrapperEntry] = entries;
|
|
15
|
+
const el = textWrapperEntry.target;
|
|
16
|
+
setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
|
|
17
|
+
}
|
|
18
|
+
}), []);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (element) {
|
|
21
|
+
setIsShowingEllipsis((element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth));
|
|
22
|
+
resizeObserver.observe(element);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return () => {
|
|
26
|
+
if (element) {
|
|
27
|
+
resizeObserver.unobserve(element);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, [resizeObserver, element]);
|
|
31
|
+
return {
|
|
32
|
+
setElement,
|
|
33
|
+
isShowingEllipsis
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.useIsShowingEllipsis = useIsShowingEllipsis;
|
|
@@ -14,13 +14,13 @@ import { describe } from 'react-desc';
|
|
|
14
14
|
import { useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';
|
|
15
15
|
import DSButton, { BUTTON_TYPE } from '@elliemae/ds-button';
|
|
16
16
|
import { DSPopperJS } from '@elliemae/ds-popperjs';
|
|
17
|
-
import { useIsShowingEllipsis } from '@elliemae/ds-utilities';
|
|
18
17
|
import { accordionItemDefaultProps } from '../../defaultProps.js';
|
|
19
18
|
import { StyledItemCustomActions, StyledPrimaryTitle, StyledSecondaryTitle, StyledItemContainer, StyledItemHeaderContainer, StyledItemHeader, StyledItemAddon, StyledItemTitles, StyledItemContent } from './styles.js';
|
|
20
19
|
import { accordionItemPropTypes } from '../../propTypes.js';
|
|
21
20
|
import { useAccordionItem } from './useAccordionItem.js';
|
|
22
21
|
import { DSAccordionContext } from '../../DSAccordionCTX.js';
|
|
23
22
|
import { DSAccordionDataTestid } from '../../DSAccordionDatatestid.js';
|
|
23
|
+
import { useIsShowingEllipsis } from './useIsShowingEllipsis.js';
|
|
24
24
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
25
25
|
|
|
26
26
|
const _excluded = ["onClick", "id"];
|
|
@@ -10,53 +10,54 @@ const StyledItemContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
10
10
|
});
|
|
11
11
|
const StyledItemHeader = /*#__PURE__*/styled.button.withConfig({
|
|
12
12
|
componentId: "sc-fnpjby-1"
|
|
13
|
-
})(["display:
|
|
13
|
+
})(["display:flex;height:", ";width:100%;align-items:center;border:none;outline:none;background:none;&:hover{cursor:", ";}padding:", ";", " &:focus{&:after{position:absolute;content:'';left:0;top:0;width:100%;height:100%;border-radius:2px;border:2px solid ", ";pointer-events:none;}}"], _ref2 => {
|
|
14
14
|
let {
|
|
15
|
+
theme,
|
|
15
16
|
withSecondaryTitle
|
|
16
17
|
} = _ref2;
|
|
17
|
-
return withSecondaryTitle ?
|
|
18
|
+
return withSecondaryTitle ? theme.space.m : theme.space.s;
|
|
18
19
|
}, _ref3 => {
|
|
19
20
|
let {
|
|
20
|
-
|
|
21
|
-
isDSMobile
|
|
21
|
+
disabled
|
|
22
22
|
} = _ref3;
|
|
23
|
-
return
|
|
23
|
+
return disabled ? 'not-allowed' : 'pointer';
|
|
24
24
|
}, _ref4 => {
|
|
25
25
|
let {
|
|
26
|
-
|
|
26
|
+
isDSMobile
|
|
27
27
|
} = _ref4;
|
|
28
|
-
return
|
|
28
|
+
return isDSMobile ? "0 16px" : "0";
|
|
29
29
|
}, _ref5 => {
|
|
30
30
|
let {
|
|
31
31
|
isDSMobile
|
|
32
32
|
} = _ref5;
|
|
33
|
-
return isDSMobile ? "
|
|
33
|
+
return isDSMobile ? "flex-direction: row-reverse;" : "";
|
|
34
34
|
}, _ref6 => {
|
|
35
|
-
let {
|
|
36
|
-
isDSMobile
|
|
37
|
-
} = _ref6;
|
|
38
|
-
return isDSMobile ? "grid-template-areas: 'title addon';" : "";
|
|
39
|
-
}, _ref7 => {
|
|
40
35
|
let {
|
|
41
36
|
theme
|
|
42
|
-
} =
|
|
37
|
+
} = _ref6;
|
|
43
38
|
return theme.colors.brand[700];
|
|
44
39
|
});
|
|
45
40
|
const StyledItemContent = /*#__PURE__*/styled.div.withConfig({
|
|
46
41
|
componentId: "sc-fnpjby-2"
|
|
47
|
-
})(["margin:", ";grid-column:1/2;"],
|
|
42
|
+
})(["margin:", ";grid-column:1/2;"], _ref7 => {
|
|
48
43
|
let {
|
|
49
44
|
isDSMobile
|
|
50
|
-
} =
|
|
45
|
+
} = _ref7;
|
|
51
46
|
return isDSMobile ? "16px 16px 24px 16px" : "16px 16px 16px 32px";
|
|
52
47
|
});
|
|
53
48
|
const StyledItemAddon = /*#__PURE__*/styled.div.withConfig({
|
|
54
49
|
componentId: "sc-fnpjby-3"
|
|
55
|
-
})(["", " height:100%;display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"],
|
|
50
|
+
})(["", " height:100%;width:", ";display:grid;place-items:center;& .em-ds-icon svg{fill:", ";}"], _ref8 => {
|
|
56
51
|
let {
|
|
52
|
+
theme,
|
|
57
53
|
isDSMobile
|
|
54
|
+
} = _ref8;
|
|
55
|
+
return !isDSMobile ? "padding: 0 ".concat(theme.space.xxs, ";") : "";
|
|
56
|
+
}, _ref9 => {
|
|
57
|
+
let {
|
|
58
|
+
theme
|
|
58
59
|
} = _ref9;
|
|
59
|
-
return
|
|
60
|
+
return theme.space.s;
|
|
60
61
|
}, _ref10 => {
|
|
61
62
|
let {
|
|
62
63
|
disabled,
|
|
@@ -66,30 +67,30 @@ const StyledItemAddon = /*#__PURE__*/styled.div.withConfig({
|
|
|
66
67
|
});
|
|
67
68
|
const StyledItemTitles = /*#__PURE__*/styled.div.withConfig({
|
|
68
69
|
componentId: "sc-fnpjby-4"
|
|
69
|
-
})(["display:grid;grid-template-columns:100%;align-content:center;"
|
|
70
|
-
let {
|
|
71
|
-
isDSMobile
|
|
72
|
-
} = _ref11;
|
|
73
|
-
return isDSMobile ? "grid-area: title;" : "";
|
|
74
|
-
});
|
|
70
|
+
})(["display:grid;grid-template-columns:100%;width:100%;align-content:center;"]);
|
|
75
71
|
const StyledPrimaryTitle = /*#__PURE__*/styled.div.withConfig({
|
|
76
72
|
componentId: "sc-fnpjby-5"
|
|
77
|
-
})(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:
|
|
73
|
+
})(["margin:0;font-size:16px;color:", ";font-weight:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref11 => {
|
|
78
74
|
let {
|
|
79
75
|
disabled,
|
|
80
76
|
theme
|
|
81
|
-
} =
|
|
77
|
+
} = _ref11;
|
|
82
78
|
return disabled ? theme.colors.neutral[200] : theme.colors.neutral[700];
|
|
83
|
-
},
|
|
79
|
+
}, _ref12 => {
|
|
84
80
|
let {
|
|
85
81
|
theme,
|
|
86
82
|
isDSMobile
|
|
87
|
-
} =
|
|
83
|
+
} = _ref12;
|
|
88
84
|
return isDSMobile ? theme.fontWeights.regular : theme.fontWeights.regular;
|
|
85
|
+
}, _ref13 => {
|
|
86
|
+
let {
|
|
87
|
+
theme
|
|
88
|
+
} = _ref13;
|
|
89
|
+
return theme.space.xs;
|
|
89
90
|
});
|
|
90
91
|
const StyledSecondaryTitle = /*#__PURE__*/styled.span.withConfig({
|
|
91
92
|
componentId: "sc-fnpjby-6"
|
|
92
|
-
})(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:
|
|
93
|
+
})(["margin:0;font-size:", ";text-align:left;color:", ";text-overflow:ellipsis;overflow:hidden;height:", ";width:100%;text-align:left;display:block;white-space:nowrap;"], _ref14 => {
|
|
93
94
|
let {
|
|
94
95
|
theme
|
|
95
96
|
} = _ref14;
|
|
@@ -100,18 +101,33 @@ const StyledSecondaryTitle = /*#__PURE__*/styled.span.withConfig({
|
|
|
100
101
|
theme
|
|
101
102
|
} = _ref15;
|
|
102
103
|
return disabled ? theme.colors.neutral[200] : theme.colors.neutral[500];
|
|
104
|
+
}, _ref16 => {
|
|
105
|
+
let {
|
|
106
|
+
theme
|
|
107
|
+
} = _ref16;
|
|
108
|
+
return theme.space.xs;
|
|
103
109
|
});
|
|
104
110
|
const StyledItemCustomActions = /*#__PURE__*/styled.div.withConfig({
|
|
105
111
|
componentId: "sc-fnpjby-7"
|
|
106
|
-
})(["display:grid;grid-auto-flow:column;grid-gap:
|
|
112
|
+
})(["display:grid;grid-auto-flow:column;grid-gap:", ";margin:0 ", ";justify-content:flex-end;"], _ref17 => {
|
|
113
|
+
let {
|
|
114
|
+
theme
|
|
115
|
+
} = _ref17;
|
|
116
|
+
return theme.space.xxs;
|
|
117
|
+
}, _ref18 => {
|
|
118
|
+
let {
|
|
119
|
+
theme
|
|
120
|
+
} = _ref18;
|
|
121
|
+
return theme.space.xs;
|
|
122
|
+
});
|
|
107
123
|
const StyledItemHeaderContainer = /*#__PURE__*/styled.div.withConfig({
|
|
108
124
|
componentId: "sc-fnpjby-8"
|
|
109
|
-
})(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", "
|
|
125
|
+
})(["display:grid;grid-template-columns:auto max-content;place-items:center;position:relative;&:hover{", "}"], _ref19 => {
|
|
110
126
|
let {
|
|
111
127
|
disabled,
|
|
112
128
|
theme
|
|
113
|
-
} =
|
|
114
|
-
return !disabled ? "background: ".concat(theme.colors.brand[200]) : "";
|
|
129
|
+
} = _ref19;
|
|
130
|
+
return !disabled ? "background: ".concat(theme.colors.brand[200], ";") : "";
|
|
115
131
|
});
|
|
116
132
|
|
|
117
133
|
export { StyledItemAddon, StyledItemContainer, StyledItemContent, StyledItemCustomActions, StyledItemHeader, StyledItemHeaderContainer, StyledItemTitles, StyledPrimaryTitle, StyledSecondaryTitle };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const useIsShowingEllipsis = () => {
|
|
5
|
+
const [element, setElement] = useState();
|
|
6
|
+
const [isShowingEllipsis, setIsShowingEllipsis] = useState(false); // const isShowingEllipsis = element?.scrollWidth > primaryTitleWrapperEl?.clientWidth;
|
|
7
|
+
|
|
8
|
+
const resizeObserver = useMemo(() => new ResizeObserver(entries => {
|
|
9
|
+
if (entries.length) {
|
|
10
|
+
const [textWrapperEntry] = entries;
|
|
11
|
+
const el = textWrapperEntry.target;
|
|
12
|
+
setIsShowingEllipsis((el === null || el === void 0 ? void 0 : el.scrollWidth) > (el === null || el === void 0 ? void 0 : el.clientWidth));
|
|
13
|
+
}
|
|
14
|
+
}), []);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (element) {
|
|
17
|
+
setIsShowingEllipsis((element === null || element === void 0 ? void 0 : element.scrollWidth) > (element === null || element === void 0 ? void 0 : element.clientWidth));
|
|
18
|
+
resizeObserver.observe(element);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
if (element) {
|
|
23
|
+
resizeObserver.unobserve(element);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, [resizeObserver, element]);
|
|
27
|
+
return {
|
|
28
|
+
setElement,
|
|
29
|
+
isShowingEllipsis
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { useIsShowingEllipsis };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-accordion",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Accordion",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
"import": "./esm/propTypes.js",
|
|
16
16
|
"require": "./cjs/propTypes.js"
|
|
17
17
|
},
|
|
18
|
+
"./parts/accordionItem/useIsShowingEllipsis": {
|
|
19
|
+
"import": "./esm/parts/accordionItem/useIsShowingEllipsis.js",
|
|
20
|
+
"require": "./cjs/parts/accordionItem/useIsShowingEllipsis.js"
|
|
21
|
+
},
|
|
18
22
|
"./parts/accordionItem/useAccordionItem": {
|
|
19
23
|
"import": "./esm/parts/accordionItem/useAccordionItem.js",
|
|
20
24
|
"require": "./cjs/parts/accordionItem/useAccordionItem.js"
|
|
@@ -80,12 +84,12 @@
|
|
|
80
84
|
"build": "node ../../scripts/build/build.js"
|
|
81
85
|
},
|
|
82
86
|
"dependencies": {
|
|
83
|
-
"@elliemae/ds-button": "2.2.
|
|
84
|
-
"@elliemae/ds-classnames": "2.2.
|
|
85
|
-
"@elliemae/ds-icons": "2.2.
|
|
86
|
-
"@elliemae/ds-shared": "2.2.
|
|
87
|
-
"@elliemae/ds-system": "2.2.
|
|
88
|
-
"@elliemae/ds-truncated-tooltip-text": "2.2.
|
|
87
|
+
"@elliemae/ds-button": "2.2.1",
|
|
88
|
+
"@elliemae/ds-classnames": "2.2.1",
|
|
89
|
+
"@elliemae/ds-icons": "2.2.1",
|
|
90
|
+
"@elliemae/ds-shared": "2.2.1",
|
|
91
|
+
"@elliemae/ds-system": "2.2.1",
|
|
92
|
+
"@elliemae/ds-truncated-tooltip-text": "2.2.1",
|
|
89
93
|
"react-desc": "^4.1.3"
|
|
90
94
|
},
|
|
91
95
|
"devDependencies": {
|
package/types/DSAccordion.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare const DSAccordion: {
|
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
declare const DSAccordionWithSchema: {
|
|
40
|
-
(props?:
|
|
40
|
+
(props?: unknown): JSX.Element;
|
|
41
41
|
propTypes: unknown;
|
|
42
42
|
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
43
43
|
};
|
|
@@ -45,7 +45,7 @@ declare const DSAccordionItem: {
|
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
declare const DSAccordionItemWithSchema: {
|
|
48
|
-
(props?:
|
|
48
|
+
(props?: unknown): JSX.Element;
|
|
49
49
|
propTypes: unknown;
|
|
50
50
|
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
51
51
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyledItemAddonPropsT, StyledItemHeaderPropsT, StyledItemTitlesPropsT, StyledPrimaryTitlePropsT, StyledSecondaryTitlePropsT, StyledItemContentPropsT } from '../../DSAccordionTypes';
|
|
1
|
+
import type { StyledItemAddonPropsT, StyledItemHeaderPropsT, StyledItemTitlesPropsT, StyledPrimaryTitlePropsT, StyledSecondaryTitlePropsT, StyledItemContentPropsT, StyledItemHeaderContainerPropsT } from '../../DSAccordionTypes';
|
|
2
2
|
export declare const StyledItemContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
3
|
export declare const StyledItemHeader: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, StyledItemHeaderPropsT, never>;
|
|
4
4
|
export declare const StyledItemContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemContentPropsT, never>;
|
|
@@ -7,4 +7,4 @@ export declare const StyledItemTitles: import("styled-components").StyledCompone
|
|
|
7
7
|
export declare const StyledPrimaryTitle: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledPrimaryTitlePropsT, never>;
|
|
8
8
|
export declare const StyledSecondaryTitle: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, StyledSecondaryTitlePropsT, never>;
|
|
9
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,
|
|
10
|
+
export declare const StyledItemHeaderContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, StyledItemHeaderContainerPropsT, never>;
|