@elliemae/ds-app-picker 2.2.0-alpha.4 → 3.0.0-next.2
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/AppPickerImpl.js +143 -113
- package/cjs/DSAppPicker.js +101 -104
- package/cjs/index.js +11 -36
- package/cjs/propTypes.js +23 -48
- package/cjs/styles.js +158 -184
- package/cjs/types/AppPickerTypes.js +2 -27
- package/cjs/utils.js +16 -44
- package/esm/AppPickerImpl.js +128 -85
- package/esm/DSAppPicker.js +81 -67
- package/esm/index.js +1 -7
- package/esm/propTypes.js +19 -19
- package/esm/styles.js +148 -159
- package/esm/types/AppPickerTypes.js +1 -2
- package/esm/utils.js +12 -15
- package/package.json +6 -6
- package/cjs/AppPickerImpl.js.map +0 -7
- package/cjs/DSAppPicker.js.map +0 -7
- package/cjs/index.js.map +0 -7
- package/cjs/propTypes.js.map +0 -7
- package/cjs/styles.js.map +0 -7
- package/cjs/types/AppPickerTypes.js.map +0 -7
- package/cjs/utils.js.map +0 -7
- package/esm/AppPickerImpl.js.map +0 -7
- package/esm/DSAppPicker.js.map +0 -7
- package/esm/index.js.map +0 -7
- package/esm/propTypes.js.map +0 -7
- package/esm/styles.js.map +0 -7
- package/esm/types/AppPickerTypes.js.map +0 -7
- package/esm/utils.js.map +0 -7
package/cjs/AppPickerImpl.js
CHANGED
|
@@ -1,152 +1,182 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
5
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
6
|
+
require('core-js/modules/esnext.async-iterator.for-each.js');
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js');
|
|
8
|
+
require('core-js/modules/esnext.iterator.for-each.js');
|
|
9
|
+
require('core-js/modules/esnext.async-iterator.map.js');
|
|
10
|
+
require('core-js/modules/esnext.iterator.map.js');
|
|
11
|
+
require('core-js/modules/esnext.async-iterator.filter.js');
|
|
12
|
+
require('core-js/modules/esnext.iterator.filter.js');
|
|
13
|
+
var react = require('react');
|
|
14
|
+
var dsPropsHelpers = require('@elliemae/ds-props-helpers');
|
|
15
|
+
var lodash = require('lodash');
|
|
16
|
+
var utils = require('./utils.js');
|
|
17
|
+
var dsTruncatedTooltipText = require('@elliemae/ds-truncated-tooltip-text');
|
|
18
|
+
var styles = require('./styles.js');
|
|
19
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
20
|
+
|
|
21
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
22
|
+
|
|
23
|
+
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
24
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
25
|
+
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
|
|
26
|
+
|
|
27
|
+
var _StyledSeparator;
|
|
28
|
+
|
|
29
|
+
const _excluded = ["label", "disabled", "selected", "icon", "id"];
|
|
30
|
+
|
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
|
|
33
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
|
|
35
|
+
const AppPickerImpl = _ref => {
|
|
36
|
+
let {
|
|
37
|
+
apps = [],
|
|
38
|
+
customApps = [],
|
|
39
|
+
sectionTitle = 'APPLICATIONS',
|
|
40
|
+
customSectionTitle = 'CUSTOM APPLICATIONS',
|
|
41
|
+
close = () => null,
|
|
42
|
+
wrapperRef,
|
|
43
|
+
onKeyDown,
|
|
44
|
+
triggerRef,
|
|
45
|
+
isOverflow
|
|
46
|
+
} = _ref;
|
|
47
|
+
const allFocusableButtons = react.useRef([]);
|
|
48
|
+
const selectedButton = react.useRef(null);
|
|
49
|
+
react.useEffect(() => {
|
|
50
|
+
var _wrapperRef$current;
|
|
51
|
+
|
|
52
|
+
wrapperRef === null || wrapperRef === void 0 ? void 0 : (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 ? void 0 : _wrapperRef$current.querySelectorAll('button').forEach((e, index) => {
|
|
53
|
+
if (!e.hasAttribute('disabled')) {
|
|
54
|
+
var _allFocusableButtons$;
|
|
55
|
+
|
|
56
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$ = allFocusableButtons.current) === null || _allFocusableButtons$ === void 0 ? void 0 : _allFocusableButtons$.push(e);
|
|
56
57
|
}
|
|
57
|
-
|
|
58
|
+
|
|
59
|
+
if (e.getAttribute('aria-selected') === 'true') {
|
|
58
60
|
selectedButton.current = index;
|
|
59
61
|
}
|
|
60
62
|
});
|
|
63
|
+
|
|
61
64
|
if (selectedButton.current) {
|
|
62
|
-
|
|
65
|
+
var _wrapperRef$current2;
|
|
66
|
+
|
|
67
|
+
wrapperRef === null || wrapperRef === void 0 ? void 0 : (_wrapperRef$current2 = wrapperRef.current) === null || _wrapperRef$current2 === void 0 ? void 0 : _wrapperRef$current2.querySelectorAll('button')[selectedButton.current].focus();
|
|
63
68
|
} else {
|
|
64
|
-
|
|
69
|
+
var _allFocusableButtons$2;
|
|
70
|
+
|
|
71
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$2 = allFocusableButtons.current[0]) === null || _allFocusableButtons$2 === void 0 ? void 0 : _allFocusableButtons$2.focus();
|
|
65
72
|
}
|
|
66
|
-
}, [wrapperRef]);
|
|
67
|
-
|
|
73
|
+
}, [wrapperRef]); // eslint-disable-next-line max-statements
|
|
74
|
+
|
|
75
|
+
const handleKeyDown = e => {
|
|
76
|
+
var _triggerRef$current;
|
|
77
|
+
|
|
68
78
|
switch (e.key) {
|
|
69
|
-
case
|
|
70
|
-
triggerRef
|
|
79
|
+
case utils.keys.ESC:
|
|
80
|
+
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
71
81
|
close();
|
|
72
82
|
break;
|
|
73
|
-
|
|
83
|
+
|
|
84
|
+
case utils.keys.TAB:
|
|
74
85
|
if (e.shiftKey) {
|
|
75
86
|
if (e.target === allFocusableButtons.current[0]) {
|
|
87
|
+
var _allFocusableButtons$3;
|
|
88
|
+
|
|
76
89
|
e.preventDefault();
|
|
77
|
-
allFocusableButtons
|
|
90
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$3 = allFocusableButtons.current[allFocusableButtons.current.length - 1]) === null || _allFocusableButtons$3 === void 0 ? void 0 : _allFocusableButtons$3.focus();
|
|
78
91
|
}
|
|
79
92
|
} else if (e.target === allFocusableButtons.current[allFocusableButtons.current.length - 1]) {
|
|
93
|
+
var _allFocusableButtons$4;
|
|
94
|
+
|
|
80
95
|
e.preventDefault();
|
|
81
|
-
allFocusableButtons
|
|
96
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$4 = allFocusableButtons.current[0]) === null || _allFocusableButtons$4 === void 0 ? void 0 : _allFocusableButtons$4.focus();
|
|
82
97
|
}
|
|
83
|
-
|
|
84
|
-
default:
|
|
98
|
+
|
|
85
99
|
break;
|
|
86
100
|
}
|
|
87
101
|
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
102
|
+
|
|
103
|
+
const handleOnClick = react.useCallback((e, app) => {
|
|
104
|
+
if (app.onClick) app.onClick(e, app);
|
|
91
105
|
}, []);
|
|
92
|
-
const handleOnKeyDownWrapper =
|
|
93
|
-
if (onKeyDown)
|
|
94
|
-
|
|
95
|
-
if (!onKeyDown && e.key ===
|
|
106
|
+
const handleOnKeyDownWrapper = react.useCallback(e => {
|
|
107
|
+
if (onKeyDown) onKeyDown(e);
|
|
108
|
+
|
|
109
|
+
if (!onKeyDown && e.key === utils.keys.ESC) {
|
|
96
110
|
close();
|
|
97
111
|
}
|
|
98
112
|
}, [onKeyDown, close]);
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
|
|
114
|
+
const buildRows = function (appList) {
|
|
115
|
+
let prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
116
|
+
const rows = lodash.chunk(appList, 3); // divides array in subarrays of 3 items
|
|
117
|
+
|
|
118
|
+
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx__default["default"](styles.StyledRow, {}, index, row.map((app, key) => {
|
|
119
|
+
const {
|
|
120
|
+
label,
|
|
121
|
+
disabled,
|
|
122
|
+
selected,
|
|
123
|
+
icon: Icon,
|
|
124
|
+
id
|
|
125
|
+
} = app,
|
|
126
|
+
otherProps = _objectWithoutProperties__default["default"](app, _excluded);
|
|
127
|
+
|
|
128
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styles.StyledChip, _objectSpread(_objectSpread({
|
|
129
|
+
onClick: e => handleOnClick(e, app),
|
|
108
130
|
onKeyDown: handleKeyDown,
|
|
109
131
|
"data-testid": "app-picker__chip",
|
|
110
132
|
"aria-disabled": disabled,
|
|
111
|
-
disabled,
|
|
112
|
-
selected,
|
|
133
|
+
disabled: disabled,
|
|
134
|
+
selected: selected,
|
|
113
135
|
"aria-selected": selected,
|
|
114
136
|
"aria-setsize": apps.length + customApps.length,
|
|
115
137
|
"aria-posinset": key + prevIndex,
|
|
116
|
-
id
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
138
|
+
id: id
|
|
139
|
+
}, dsPropsHelpers.getDataProps(otherProps)), {}, {
|
|
140
|
+
children: [/*#__PURE__*/_jsx__default["default"](Icon, {
|
|
141
|
+
className: "app-picker__icon",
|
|
142
|
+
size: "m"
|
|
143
|
+
}), /*#__PURE__*/_jsx__default["default"](styles.StyledChipLabel, {}, void 0, /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
|
|
144
|
+
value: label,
|
|
145
|
+
placement: "bottom"
|
|
146
|
+
}))]
|
|
147
|
+
}), key);
|
|
125
148
|
})));
|
|
126
|
-
return
|
|
149
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
150
|
+
children: formattedRows
|
|
151
|
+
});
|
|
127
152
|
};
|
|
153
|
+
|
|
128
154
|
const AppsRows = () => buildRows(apps, 1);
|
|
155
|
+
|
|
129
156
|
const CustomRows = () => buildRows(customApps, apps.length);
|
|
130
|
-
|
|
157
|
+
|
|
158
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styles.StyledWrapper, {
|
|
131
159
|
role: "listbox",
|
|
132
160
|
ref: wrapperRef,
|
|
133
161
|
onKeyDown: handleOnKeyDownWrapper,
|
|
134
162
|
"data-testid": "app-picker__wrapper",
|
|
135
|
-
isOverflow
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
isOverflow: isOverflow,
|
|
164
|
+
children: [/*#__PURE__*/_jsx__default["default"](styles.StyledTitle, {
|
|
165
|
+
"data-testid": "app-picker__main-title",
|
|
166
|
+
"aria-hidden": true
|
|
167
|
+
}, void 0, sectionTitle), /*#__PURE__*/_jsx__default["default"](styles.StyledGrid, {
|
|
168
|
+
"data-testid": "app-picker__main-grid"
|
|
169
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](AppsRows, {})), !!customApps.length && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
170
|
+
children: [_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](styles.StyledSeparator, {
|
|
171
|
+
"aria-hidden": true
|
|
172
|
+
})), /*#__PURE__*/_jsx__default["default"](styles.StyledTitle, {
|
|
173
|
+
"data-testid": "app-picker__custom-title",
|
|
174
|
+
"aria-hidden": true
|
|
175
|
+
}, void 0, customSectionTitle), /*#__PURE__*/_jsx__default["default"](styles.StyledGrid, {
|
|
176
|
+
"data-testid": "app-picker__custom-grid"
|
|
177
|
+
}, void 0, /*#__PURE__*/_jsx__default["default"](CustomRows, {}))]
|
|
178
|
+
})]
|
|
179
|
+
});
|
|
149
180
|
};
|
|
150
|
-
|
|
151
|
-
module.exports =
|
|
152
|
-
//# sourceMappingURL=AppPickerImpl.js.map
|
|
181
|
+
|
|
182
|
+
module.exports = AppPickerImpl;
|
package/cjs/DSAppPicker.js
CHANGED
|
@@ -1,141 +1,138 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
icon: Icon = () => /* @__PURE__ */ import_react.default.createElement(import_ds_icons.MenuPicker, {
|
|
49
|
-
fill: ["brand-primary", 700],
|
|
50
|
-
size: "m"
|
|
51
|
-
}),
|
|
52
|
-
renderTrigger,
|
|
53
|
-
isOpen,
|
|
54
|
-
onClose = () => null,
|
|
55
|
-
actionRef,
|
|
56
|
-
onKeyDown,
|
|
57
|
-
onClick = () => null,
|
|
58
|
-
onClickOutside = () => null,
|
|
59
|
-
triggerRef
|
|
60
|
-
}) => {
|
|
61
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
|
62
|
-
const [isOverflow, setIsOverflow] = (0, import_react.useState)(false);
|
|
63
|
-
const wrapperRef = (0, import_react.useRef)(null);
|
|
64
|
-
const defaultTriggerRef = (0, import_react.useRef)(null);
|
|
65
|
-
(0, import_react.useEffect)(() => {
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _jsx = require('@babel/runtime/helpers/jsx');
|
|
6
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
7
|
+
var react = require('react');
|
|
8
|
+
var reactDesc = require('react-desc');
|
|
9
|
+
var dsIcons = require('@elliemae/ds-icons');
|
|
10
|
+
var DSButton = require('@elliemae/ds-button');
|
|
11
|
+
var DSPopover = require('@elliemae/ds-popover');
|
|
12
|
+
var dsUtilities = require('@elliemae/ds-utilities');
|
|
13
|
+
var AppPickerImpl = require('./AppPickerImpl.js');
|
|
14
|
+
var propTypes = require('./propTypes.js');
|
|
15
|
+
|
|
16
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
|
+
|
|
18
|
+
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
19
|
+
var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
|
|
20
|
+
var DSPopover__default = /*#__PURE__*/_interopDefaultLegacy(DSPopover);
|
|
21
|
+
|
|
22
|
+
const DSAppPicker = _ref => {
|
|
23
|
+
var _Icon;
|
|
24
|
+
|
|
25
|
+
let {
|
|
26
|
+
apps = [],
|
|
27
|
+
customApps = [],
|
|
28
|
+
sectionTitle = 'APPLICATIONS',
|
|
29
|
+
customSectionTitle = 'CUSTOM APPLICATIONS',
|
|
30
|
+
icon: Icon = () => /*#__PURE__*/_jsx__default["default"](dsIcons.MenuPicker, {
|
|
31
|
+
fill: ['brand-primary', 700],
|
|
32
|
+
size: "m"
|
|
33
|
+
}),
|
|
34
|
+
renderTrigger,
|
|
35
|
+
isOpen,
|
|
36
|
+
onClose = () => null,
|
|
37
|
+
actionRef,
|
|
38
|
+
onKeyDown,
|
|
39
|
+
onClick = () => null,
|
|
40
|
+
onClickOutside = () => null,
|
|
41
|
+
triggerRef
|
|
42
|
+
} = _ref;
|
|
43
|
+
const [open, setOpen] = react.useState(false);
|
|
44
|
+
const [isOverflow, setIsOverflow] = react.useState(false);
|
|
45
|
+
const wrapperRef = react.useRef(null);
|
|
46
|
+
const defaultTriggerRef = react.useRef(null);
|
|
47
|
+
react.useEffect(() => {
|
|
66
48
|
if (actionRef && actionRef.current) {
|
|
67
|
-
actionRef.current.focusToIndex =
|
|
49
|
+
actionRef.current.focusToIndex = index => {
|
|
68
50
|
if (wrapperRef.current) {
|
|
69
51
|
const parent = wrapperRef.current;
|
|
70
|
-
const buttons = [...parent.querySelectorAll(
|
|
52
|
+
const buttons = [...parent.querySelectorAll('button')];
|
|
71
53
|
buttons[index].focus();
|
|
72
54
|
}
|
|
73
55
|
};
|
|
74
56
|
}
|
|
75
57
|
}, [actionRef, apps, customApps]);
|
|
76
|
-
|
|
58
|
+
react.useEffect(() => {
|
|
77
59
|
setTimeout(() => {
|
|
78
60
|
if (wrapperRef.current) {
|
|
79
|
-
const {
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
const {
|
|
62
|
+
scrollHeight,
|
|
63
|
+
clientHeight
|
|
64
|
+
} = wrapperRef.current;
|
|
65
|
+
if (scrollHeight > clientHeight) return setIsOverflow(true);
|
|
82
66
|
}
|
|
67
|
+
|
|
83
68
|
return setIsOverflow(false);
|
|
84
69
|
});
|
|
85
70
|
}, [isOpen, open]);
|
|
71
|
+
|
|
86
72
|
const handleOnClose = () => {
|
|
87
|
-
if (typeof isOpen ===
|
|
73
|
+
if (typeof isOpen === 'boolean') {
|
|
88
74
|
setOpen(isOpen);
|
|
89
75
|
} else {
|
|
90
76
|
setOpen(false);
|
|
91
77
|
}
|
|
78
|
+
|
|
92
79
|
onClose();
|
|
93
80
|
};
|
|
94
|
-
|
|
81
|
+
|
|
82
|
+
const handleOnClickOutside = e => {
|
|
95
83
|
setOpen(false);
|
|
96
84
|
onClose();
|
|
97
85
|
onClickOutside(e);
|
|
98
86
|
};
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
|
|
88
|
+
const AppPickerContent = () => /*#__PURE__*/_jsx__default["default"](AppPickerImpl, {
|
|
89
|
+
apps: apps,
|
|
90
|
+
customApps: customApps,
|
|
91
|
+
sectionTitle: sectionTitle,
|
|
92
|
+
customSectionTitle: customSectionTitle,
|
|
104
93
|
close: handleOnClose,
|
|
105
|
-
wrapperRef,
|
|
106
|
-
onKeyDown,
|
|
94
|
+
wrapperRef: wrapperRef,
|
|
95
|
+
onKeyDown: onKeyDown,
|
|
107
96
|
triggerRef: triggerRef || defaultTriggerRef,
|
|
108
|
-
isOverflow
|
|
97
|
+
isOverflow: isOverflow
|
|
109
98
|
});
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
99
|
+
|
|
100
|
+
const RenderTrigger = renderTrigger || (_ref2 => {
|
|
101
|
+
let {
|
|
102
|
+
ref
|
|
103
|
+
} = _ref2;
|
|
104
|
+
return /*#__PURE__*/_jsx__default["default"](DSButton__default["default"], {
|
|
105
|
+
"data-testid": "app-picker__button",
|
|
106
|
+
id: "app-picker__button",
|
|
107
|
+
buttonType: "text",
|
|
108
|
+
icon: _Icon || (_Icon = /*#__PURE__*/_jsx__default["default"](Icon, {})),
|
|
109
|
+
innerRef: dsUtilities.mergeRefs(ref, defaultTriggerRef),
|
|
110
|
+
onClick: e => {
|
|
111
|
+
onClick(e);
|
|
112
|
+
setOpen(true);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return /*#__PURE__*/_jsx__default["default"](DSPopover__default["default"], {
|
|
118
|
+
content: /*#__PURE__*/_jsx__default["default"](AppPickerContent, {}),
|
|
119
|
+
isOpen: typeof isOpen === 'boolean' ? isOpen : open,
|
|
124
120
|
onClickOutside: handleOnClickOutside,
|
|
125
121
|
placement: "bottom",
|
|
126
122
|
interactionType: "click",
|
|
127
123
|
renderTrigger: RenderTrigger,
|
|
128
124
|
showArrow: true,
|
|
129
125
|
style: {
|
|
130
|
-
padding:
|
|
131
|
-
maxWidth:
|
|
132
|
-
width:
|
|
126
|
+
padding: '0',
|
|
127
|
+
maxWidth: '1000px',
|
|
128
|
+
width: 'fit-content'
|
|
133
129
|
}
|
|
134
130
|
});
|
|
135
131
|
};
|
|
136
|
-
|
|
137
|
-
const AppPickerWithSchema =
|
|
138
|
-
AppPickerWithSchema.propTypes =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
132
|
+
|
|
133
|
+
const AppPickerWithSchema = reactDesc.describe(DSAppPicker);
|
|
134
|
+
AppPickerWithSchema.propTypes = propTypes.propTypes;
|
|
135
|
+
|
|
136
|
+
exports.AppPickerWithSchema = AppPickerWithSchema;
|
|
137
|
+
exports.DSAppPicker = DSAppPicker;
|
|
138
|
+
exports["default"] = DSAppPicker;
|
package/cjs/index.js
CHANGED
|
@@ -1,36 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(module2))
|
|
15
|
-
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
16
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return target;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (module2, isNodeMode) => {
|
|
21
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
22
|
-
};
|
|
23
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
24
|
-
return (module2, temp) => {
|
|
25
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
26
|
-
};
|
|
27
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
28
|
-
var src_exports = {};
|
|
29
|
-
__export(src_exports, {
|
|
30
|
-
default: () => import_DSAppPicker.default
|
|
31
|
-
});
|
|
32
|
-
var React = __toESM(require("react"));
|
|
33
|
-
__reExport(src_exports, require("./DSAppPicker"));
|
|
34
|
-
var import_DSAppPicker = require("./DSAppPicker");
|
|
35
|
-
module.exports = __toCommonJS(src_exports);
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var DSAppPicker = require('./DSAppPicker.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.AppPickerWithSchema = DSAppPicker.AppPickerWithSchema;
|
|
10
|
+
exports.DSAppPicker = DSAppPicker.DSAppPicker;
|
|
11
|
+
exports["default"] = DSAppPicker.DSAppPicker;
|