@elliemae/ds-app-picker 2.3.0-alpha.8 → 2.3.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 +182 -0
- package/cjs/DSAppPicker.js +138 -0
- package/cjs/index.js +11 -0
- package/cjs/propTypes.js +25 -0
- package/cjs/styles.js +164 -0
- package/cjs/types/AppPickerTypes.js +2 -0
- package/cjs/utils.js +18 -0
- package/esm/AppPickerImpl.js +174 -0
- package/esm/DSAppPicker.js +126 -0
- package/esm/index.js +1 -0
- package/esm/propTypes.js +21 -0
- package/esm/styles.js +150 -0
- package/esm/types/AppPickerTypes.js +1 -0
- package/esm/utils.js +14 -0
- package/package.json +34 -38
- package/types/AppPickerImpl.d.ts +3 -0
- package/types/DSAppPicker.d.ts +11 -0
- package/types/index.d.ts +2 -0
- package/types/propTypes.d.ts +61 -0
- package/types/styles.d.ts +9 -0
- package/types/tests/AppPicker.test.d.ts +1 -0
- package/types/types/AppPickerTypes.d.ts +41 -0
- package/types/utils.d.ts +12 -0
- package/dist/cjs/AppPickerImpl.js +0 -152
- package/dist/cjs/AppPickerImpl.js.map +0 -7
- package/dist/cjs/DSAppPicker.js +0 -141
- package/dist/cjs/DSAppPicker.js.map +0 -7
- package/dist/cjs/index.js +0 -36
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/propTypes.js +0 -50
- package/dist/cjs/propTypes.js.map +0 -7
- package/dist/cjs/styles.js +0 -190
- package/dist/cjs/styles.js.map +0 -7
- package/dist/cjs/types/AppPickerTypes.js +0 -27
- package/dist/cjs/types/AppPickerTypes.js.map +0 -7
- package/dist/cjs/utils.js +0 -46
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/AppPickerImpl.js +0 -131
- package/dist/esm/AppPickerImpl.js.map +0 -7
- package/dist/esm/DSAppPicker.js +0 -112
- package/dist/esm/DSAppPicker.js.map +0 -7
- package/dist/esm/index.js +0 -7
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/propTypes.js +0 -21
- package/dist/esm/propTypes.js.map +0 -7
- package/dist/esm/styles.js +0 -161
- package/dist/esm/styles.js.map +0 -7
- package/dist/esm/types/AppPickerTypes.js +0 -2
- package/dist/esm/types/AppPickerTypes.js.map +0 -7
- package/dist/esm/utils.js +0 -17
- package/dist/esm/utils.js.map +0 -7
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
|
|
4
|
+
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
|
+
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
6
|
+
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
7
|
+
import 'core-js/modules/esnext.async-iterator.map.js';
|
|
8
|
+
import 'core-js/modules/esnext.iterator.map.js';
|
|
9
|
+
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
10
|
+
import 'core-js/modules/esnext.iterator.filter.js';
|
|
11
|
+
import { useRef, useEffect, useCallback } from 'react';
|
|
12
|
+
import { getDataProps } from '@elliemae/ds-props-helpers';
|
|
13
|
+
import { chunk } from 'lodash';
|
|
14
|
+
import { keys } from './utils.js';
|
|
15
|
+
import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
|
|
16
|
+
import { StyledWrapper, StyledTitle, StyledGrid, StyledSeparator, StyledRow, StyledChip, StyledChipLabel } from './styles.js';
|
|
17
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
18
|
+
|
|
19
|
+
var _StyledSeparator;
|
|
20
|
+
|
|
21
|
+
const _excluded = ["label", "disabled", "selected", "icon", "id"];
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
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(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; }
|
|
26
|
+
|
|
27
|
+
const AppPickerImpl = _ref => {
|
|
28
|
+
let {
|
|
29
|
+
apps = [],
|
|
30
|
+
customApps = [],
|
|
31
|
+
sectionTitle = 'APPLICATIONS',
|
|
32
|
+
customSectionTitle = 'CUSTOM APPLICATIONS',
|
|
33
|
+
close = () => null,
|
|
34
|
+
wrapperRef,
|
|
35
|
+
onKeyDown,
|
|
36
|
+
triggerRef,
|
|
37
|
+
isOverflow
|
|
38
|
+
} = _ref;
|
|
39
|
+
const allFocusableButtons = useRef([]);
|
|
40
|
+
const selectedButton = useRef(null);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
var _wrapperRef$current;
|
|
43
|
+
|
|
44
|
+
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) => {
|
|
45
|
+
if (!e.hasAttribute('disabled')) {
|
|
46
|
+
var _allFocusableButtons$;
|
|
47
|
+
|
|
48
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$ = allFocusableButtons.current) === null || _allFocusableButtons$ === void 0 ? void 0 : _allFocusableButtons$.push(e);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (e.getAttribute('aria-selected') === 'true') {
|
|
52
|
+
selectedButton.current = index;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (selectedButton.current) {
|
|
57
|
+
var _wrapperRef$current2;
|
|
58
|
+
|
|
59
|
+
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();
|
|
60
|
+
} else {
|
|
61
|
+
var _allFocusableButtons$2;
|
|
62
|
+
|
|
63
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$2 = allFocusableButtons.current[0]) === null || _allFocusableButtons$2 === void 0 ? void 0 : _allFocusableButtons$2.focus();
|
|
64
|
+
}
|
|
65
|
+
}, [wrapperRef]); // eslint-disable-next-line max-statements
|
|
66
|
+
|
|
67
|
+
const handleKeyDown = e => {
|
|
68
|
+
var _triggerRef$current;
|
|
69
|
+
|
|
70
|
+
switch (e.key) {
|
|
71
|
+
case keys.ESC:
|
|
72
|
+
triggerRef === null || triggerRef === void 0 ? void 0 : (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
73
|
+
close();
|
|
74
|
+
break;
|
|
75
|
+
|
|
76
|
+
case keys.TAB:
|
|
77
|
+
if (e.shiftKey) {
|
|
78
|
+
if (e.target === allFocusableButtons.current[0]) {
|
|
79
|
+
var _allFocusableButtons$3;
|
|
80
|
+
|
|
81
|
+
e.preventDefault();
|
|
82
|
+
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();
|
|
83
|
+
}
|
|
84
|
+
} else if (e.target === allFocusableButtons.current[allFocusableButtons.current.length - 1]) {
|
|
85
|
+
var _allFocusableButtons$4;
|
|
86
|
+
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
allFocusableButtons === null || allFocusableButtons === void 0 ? void 0 : (_allFocusableButtons$4 = allFocusableButtons.current[0]) === null || _allFocusableButtons$4 === void 0 ? void 0 : _allFocusableButtons$4.focus();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const handleOnClick = useCallback((e, app) => {
|
|
96
|
+
if (app.onClick) app.onClick(e, app);
|
|
97
|
+
}, []);
|
|
98
|
+
const handleOnKeyDownWrapper = useCallback(e => {
|
|
99
|
+
if (onKeyDown) onKeyDown(e);
|
|
100
|
+
|
|
101
|
+
if (!onKeyDown && e.key === keys.ESC) {
|
|
102
|
+
close();
|
|
103
|
+
}
|
|
104
|
+
}, [onKeyDown, close]);
|
|
105
|
+
|
|
106
|
+
const buildRows = function (appList) {
|
|
107
|
+
let prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
108
|
+
const rows = chunk(appList, 3); // divides array in subarrays of 3 items
|
|
109
|
+
|
|
110
|
+
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx(StyledRow, {}, index, row.map((app, key) => {
|
|
111
|
+
const {
|
|
112
|
+
label,
|
|
113
|
+
disabled,
|
|
114
|
+
selected,
|
|
115
|
+
icon: Icon,
|
|
116
|
+
id
|
|
117
|
+
} = app,
|
|
118
|
+
otherProps = _objectWithoutProperties(app, _excluded);
|
|
119
|
+
|
|
120
|
+
return /*#__PURE__*/jsxs(StyledChip, _objectSpread(_objectSpread({
|
|
121
|
+
onClick: e => handleOnClick(e, app),
|
|
122
|
+
onKeyDown: handleKeyDown,
|
|
123
|
+
"data-testid": "app-picker__chip",
|
|
124
|
+
"aria-disabled": disabled,
|
|
125
|
+
disabled: disabled,
|
|
126
|
+
selected: selected,
|
|
127
|
+
"aria-selected": selected,
|
|
128
|
+
"aria-setsize": apps.length + customApps.length,
|
|
129
|
+
"aria-posinset": key + prevIndex,
|
|
130
|
+
id: id
|
|
131
|
+
}, getDataProps(otherProps)), {}, {
|
|
132
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
133
|
+
className: "app-picker__icon",
|
|
134
|
+
size: "m"
|
|
135
|
+
}), /*#__PURE__*/_jsx(StyledChipLabel, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
|
|
136
|
+
value: label,
|
|
137
|
+
placement: "bottom"
|
|
138
|
+
}))]
|
|
139
|
+
}), key);
|
|
140
|
+
})));
|
|
141
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
142
|
+
children: formattedRows
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const AppsRows = () => buildRows(apps, 1);
|
|
147
|
+
|
|
148
|
+
const CustomRows = () => buildRows(customApps, apps.length);
|
|
149
|
+
|
|
150
|
+
return /*#__PURE__*/jsxs(StyledWrapper, {
|
|
151
|
+
role: "listbox",
|
|
152
|
+
ref: wrapperRef,
|
|
153
|
+
onKeyDown: handleOnKeyDownWrapper,
|
|
154
|
+
"data-testid": "app-picker__wrapper",
|
|
155
|
+
isOverflow: isOverflow,
|
|
156
|
+
children: [/*#__PURE__*/_jsx(StyledTitle, {
|
|
157
|
+
"data-testid": "app-picker__main-title",
|
|
158
|
+
"aria-hidden": true
|
|
159
|
+
}, void 0, sectionTitle), /*#__PURE__*/_jsx(StyledGrid, {
|
|
160
|
+
"data-testid": "app-picker__main-grid"
|
|
161
|
+
}, void 0, /*#__PURE__*/_jsx(AppsRows, {})), !!customApps.length && /*#__PURE__*/jsxs(Fragment, {
|
|
162
|
+
children: [_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
163
|
+
"aria-hidden": true
|
|
164
|
+
})), /*#__PURE__*/_jsx(StyledTitle, {
|
|
165
|
+
"data-testid": "app-picker__custom-title",
|
|
166
|
+
"aria-hidden": true
|
|
167
|
+
}, void 0, customSectionTitle), /*#__PURE__*/_jsx(StyledGrid, {
|
|
168
|
+
"data-testid": "app-picker__custom-grid"
|
|
169
|
+
}, void 0, /*#__PURE__*/_jsx(CustomRows, {}))]
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export { AppPickerImpl as default };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
2
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { describe } from 'react-desc';
|
|
5
|
+
import { MenuPicker } from '@elliemae/ds-icons';
|
|
6
|
+
import DSButton from '@elliemae/ds-button';
|
|
7
|
+
import DSPopover from '@elliemae/ds-popover';
|
|
8
|
+
import { mergeRefs } from '@elliemae/ds-utilities';
|
|
9
|
+
import AppPickerImpl from './AppPickerImpl.js';
|
|
10
|
+
import { propTypes } from './propTypes.js';
|
|
11
|
+
|
|
12
|
+
const DSAppPicker = _ref => {
|
|
13
|
+
var _Icon;
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
apps = [],
|
|
17
|
+
customApps = [],
|
|
18
|
+
sectionTitle = 'APPLICATIONS',
|
|
19
|
+
customSectionTitle = 'CUSTOM APPLICATIONS',
|
|
20
|
+
icon: Icon = () => /*#__PURE__*/_jsx(MenuPicker, {
|
|
21
|
+
fill: ['brand-primary', 700],
|
|
22
|
+
size: "m"
|
|
23
|
+
}),
|
|
24
|
+
renderTrigger,
|
|
25
|
+
isOpen,
|
|
26
|
+
onClose = () => null,
|
|
27
|
+
actionRef,
|
|
28
|
+
onKeyDown,
|
|
29
|
+
onClick = () => null,
|
|
30
|
+
onClickOutside = () => null,
|
|
31
|
+
triggerRef
|
|
32
|
+
} = _ref;
|
|
33
|
+
const [open, setOpen] = useState(false);
|
|
34
|
+
const [isOverflow, setIsOverflow] = useState(false);
|
|
35
|
+
const wrapperRef = useRef(null);
|
|
36
|
+
const defaultTriggerRef = useRef(null);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (actionRef && actionRef.current) {
|
|
39
|
+
actionRef.current.focusToIndex = index => {
|
|
40
|
+
if (wrapperRef.current) {
|
|
41
|
+
const parent = wrapperRef.current;
|
|
42
|
+
const buttons = [...parent.querySelectorAll('button')];
|
|
43
|
+
buttons[index].focus();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}, [actionRef, apps, customApps]);
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
if (wrapperRef.current) {
|
|
51
|
+
const {
|
|
52
|
+
scrollHeight,
|
|
53
|
+
clientHeight
|
|
54
|
+
} = wrapperRef.current;
|
|
55
|
+
if (scrollHeight > clientHeight) return setIsOverflow(true);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return setIsOverflow(false);
|
|
59
|
+
});
|
|
60
|
+
}, [isOpen, open]);
|
|
61
|
+
|
|
62
|
+
const handleOnClose = () => {
|
|
63
|
+
if (typeof isOpen === 'boolean') {
|
|
64
|
+
setOpen(isOpen);
|
|
65
|
+
} else {
|
|
66
|
+
setOpen(false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
onClose();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const handleOnClickOutside = e => {
|
|
73
|
+
setOpen(false);
|
|
74
|
+
onClose();
|
|
75
|
+
onClickOutside(e);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const AppPickerContent = () => /*#__PURE__*/_jsx(AppPickerImpl, {
|
|
79
|
+
apps: apps,
|
|
80
|
+
customApps: customApps,
|
|
81
|
+
sectionTitle: sectionTitle,
|
|
82
|
+
customSectionTitle: customSectionTitle,
|
|
83
|
+
close: handleOnClose,
|
|
84
|
+
wrapperRef: wrapperRef,
|
|
85
|
+
onKeyDown: onKeyDown,
|
|
86
|
+
triggerRef: triggerRef || defaultTriggerRef,
|
|
87
|
+
isOverflow: isOverflow
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
const RenderTrigger = renderTrigger || (_ref2 => {
|
|
91
|
+
let {
|
|
92
|
+
ref
|
|
93
|
+
} = _ref2;
|
|
94
|
+
return /*#__PURE__*/_jsx(DSButton, {
|
|
95
|
+
"data-testid": "app-picker__button",
|
|
96
|
+
id: "app-picker__button",
|
|
97
|
+
buttonType: "text",
|
|
98
|
+
icon: _Icon || (_Icon = /*#__PURE__*/_jsx(Icon, {})),
|
|
99
|
+
innerRef: mergeRefs(ref, defaultTriggerRef),
|
|
100
|
+
onClick: e => {
|
|
101
|
+
onClick(e);
|
|
102
|
+
setOpen(true);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return /*#__PURE__*/_jsx(DSPopover, {
|
|
108
|
+
content: /*#__PURE__*/_jsx(AppPickerContent, {}),
|
|
109
|
+
isOpen: typeof isOpen === 'boolean' ? isOpen : open,
|
|
110
|
+
onClickOutside: handleOnClickOutside,
|
|
111
|
+
placement: "bottom",
|
|
112
|
+
interactionType: "click",
|
|
113
|
+
renderTrigger: RenderTrigger,
|
|
114
|
+
showArrow: true,
|
|
115
|
+
style: {
|
|
116
|
+
padding: '0',
|
|
117
|
+
maxWidth: '1000px',
|
|
118
|
+
width: 'fit-content'
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const AppPickerWithSchema = describe(DSAppPicker);
|
|
124
|
+
AppPickerWithSchema.propTypes = propTypes;
|
|
125
|
+
|
|
126
|
+
export { AppPickerWithSchema, DSAppPicker, DSAppPicker as default };
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AppPickerWithSchema, DSAppPicker, DSAppPicker as default } from './DSAppPicker.js';
|
package/esm/propTypes.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropTypes } from 'react-desc';
|
|
2
|
+
import { MenuPicker } from '@elliemae/ds-icons';
|
|
3
|
+
|
|
4
|
+
const propTypes = {
|
|
5
|
+
apps: PropTypes.array.description('Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]').isRequired,
|
|
6
|
+
customApps: PropTypes.array.description('Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]'),
|
|
7
|
+
sectionTitle: PropTypes.string.description('main section title').defaultValue('APPLICATIONS'),
|
|
8
|
+
customSectionTitle: PropTypes.string.description('custom section title').defaultValue('CUSTOM APPLICATIONS'),
|
|
9
|
+
icon: PropTypes.func.description('trigger button s icon').defaultValue(MenuPicker),
|
|
10
|
+
renderTrigger: PropTypes.func.description('Custom trigger component.'),
|
|
11
|
+
actionRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
12
|
+
current: PropTypes.any
|
|
13
|
+
})]).description('Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker.'),
|
|
14
|
+
isOpen: PropTypes.bool.description('Wether the AppPicker should be open or not.'),
|
|
15
|
+
onClose: PropTypes.func.description('Callback function when the AppPicker closes'),
|
|
16
|
+
onKeyDown: PropTypes.func.description('OnKeyDown handler callback.'),
|
|
17
|
+
onClick: PropTypes.func.description('Custom onClick for Trigger component.'),
|
|
18
|
+
onClickOutside: PropTypes.func.description('Callback event when the user clicks outside the App Picker.')
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { propTypes };
|
package/esm/styles.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
|
|
2
|
+
import { styled, css } from '@elliemae/ds-system';
|
|
3
|
+
|
|
4
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
5
|
+
const StyledTitle = styled('h3', {
|
|
6
|
+
name: 'DS-AppPicker',
|
|
7
|
+
slot: 'title'
|
|
8
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n margin: 12px 0 0 0;\n line-height: 1.38;\n text-transform: uppercase;\n"])), _ref => {
|
|
9
|
+
let {
|
|
10
|
+
theme
|
|
11
|
+
} = _ref;
|
|
12
|
+
return theme.colors.neutral[700];
|
|
13
|
+
}, _ref2 => {
|
|
14
|
+
let {
|
|
15
|
+
theme
|
|
16
|
+
} = _ref2;
|
|
17
|
+
return theme.fontSizes.value[400];
|
|
18
|
+
}, _ref3 => {
|
|
19
|
+
let {
|
|
20
|
+
theme
|
|
21
|
+
} = _ref3;
|
|
22
|
+
return theme.fontWeights.semibold;
|
|
23
|
+
});
|
|
24
|
+
const StyledWrapper = styled('ul', {
|
|
25
|
+
name: 'DS-AppPicker',
|
|
26
|
+
slot: 'root'
|
|
27
|
+
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n align-items: center;\n min-width: 308px;\n min-height: 110px;\n max-height: 449px;\n width: 308px;\n overflow-y: auto;\n overflow-x: hidden;\n margin: 0;\n padding: ", ";\n &:focus {\n outline: none;\n }\n"])), _ref4 => {
|
|
28
|
+
let {
|
|
29
|
+
isOverflow
|
|
30
|
+
} = _ref4;
|
|
31
|
+
return isOverflow ? '0 0 0 16px' : '0 16px';
|
|
32
|
+
});
|
|
33
|
+
const StyledGrid = styled('div', {
|
|
34
|
+
name: 'DS-AppPicker',
|
|
35
|
+
slot: 'grid'
|
|
36
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n margin: 8px 0;\n"])));
|
|
37
|
+
const StyledRow = styled('div', {
|
|
38
|
+
name: 'DS-AppPicker',
|
|
39
|
+
slot: 'row'
|
|
40
|
+
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n"])));
|
|
41
|
+
const StyledChipLabel = styled('p', {
|
|
42
|
+
name: 'DS-AppPicker',
|
|
43
|
+
slot: 'chipLabel'
|
|
44
|
+
})(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: ", ";\n font-weight: ", ";\n word-wrap: break-word;\n margin: 0 6px;\n line-height: 1.45;\n width: 100%;\n z-index: 120;\n\n & span {\n padding-top: 6px;\n }\n"])), _ref5 => {
|
|
45
|
+
let {
|
|
46
|
+
theme
|
|
47
|
+
} = _ref5;
|
|
48
|
+
return theme.fontSizes.label[200];
|
|
49
|
+
}, _ref6 => {
|
|
50
|
+
let {
|
|
51
|
+
theme
|
|
52
|
+
} = _ref6;
|
|
53
|
+
return theme.fontWeights.semibold;
|
|
54
|
+
});
|
|
55
|
+
const styledChipSelectedCss = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n\n .app-picker__icon {\n fill: ", ";\n }\n\n &:before {\n border: 1px solid ", ";\n }\n\n &:focus {\n &:before {\n border: 2px solid ", ";\n }\n }\n"])), _ref7 => {
|
|
56
|
+
let {
|
|
57
|
+
theme
|
|
58
|
+
} = _ref7;
|
|
59
|
+
return theme.colors.brand[800];
|
|
60
|
+
}, _ref8 => {
|
|
61
|
+
let {
|
|
62
|
+
theme
|
|
63
|
+
} = _ref8;
|
|
64
|
+
return theme.colors.brand[200];
|
|
65
|
+
}, _ref9 => {
|
|
66
|
+
let {
|
|
67
|
+
theme
|
|
68
|
+
} = _ref9;
|
|
69
|
+
return theme.colors.brand[800];
|
|
70
|
+
}, _ref10 => {
|
|
71
|
+
let {
|
|
72
|
+
theme
|
|
73
|
+
} = _ref10;
|
|
74
|
+
return theme.colors.brand[600];
|
|
75
|
+
}, _ref11 => {
|
|
76
|
+
let {
|
|
77
|
+
theme
|
|
78
|
+
} = _ref11;
|
|
79
|
+
return theme.colors.brand[800];
|
|
80
|
+
});
|
|
81
|
+
const StyledChip = styled('button', {
|
|
82
|
+
name: 'DS-AppPicker',
|
|
83
|
+
slot: 'chip'
|
|
84
|
+
})(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n position: relative;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border: none;\n height: 68px;\n width: 92px;\n background-color: #fff;\n color: ", ";\n cursor: pointer;\n outline: none;\n\n &:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border-radius: 2px;\n border: 2px solid transparent;\n }\n\n & .app-picker__icon {\n fill: ", ";\n height: 28px;\n width: 28px;\n }\n\n & .app-picker__icon svg {\n height: 28px;\n width: 28px;\n }\n\n &:hover {\n color: ", ";\n background-color: ", ";\n .app-picker__icon {\n fill: ", ";\n }\n }\n\n &:focus {\n &:before {\n border-color: ", ";\n }\n }\n\n &:disabled {\n color: ", ";\n cursor: not-allowed;\n\n .app-picker__icon {\n fill: ", ";\n }\n\n &:focus,\n &:hover {\n background-color: #fff;\n cursor: not-allowed;\n &:before {\n border-color: transparent;\n }\n\n ", " {\n color: ", ";\n }\n }\n\n &:hover .app-picker__icon {\n fill: ", ";\n }\n }\n\n ", "\n"])), _ref12 => {
|
|
85
|
+
let {
|
|
86
|
+
theme
|
|
87
|
+
} = _ref12;
|
|
88
|
+
return theme.colors.brand[600];
|
|
89
|
+
}, _ref13 => {
|
|
90
|
+
let {
|
|
91
|
+
theme
|
|
92
|
+
} = _ref13;
|
|
93
|
+
return theme.colors.brand[600];
|
|
94
|
+
}, _ref14 => {
|
|
95
|
+
let {
|
|
96
|
+
theme
|
|
97
|
+
} = _ref14;
|
|
98
|
+
return theme.colors.brand[800];
|
|
99
|
+
}, _ref15 => {
|
|
100
|
+
let {
|
|
101
|
+
theme
|
|
102
|
+
} = _ref15;
|
|
103
|
+
return theme.colors.brand[200];
|
|
104
|
+
}, _ref16 => {
|
|
105
|
+
let {
|
|
106
|
+
theme
|
|
107
|
+
} = _ref16;
|
|
108
|
+
return theme.colors.brand[800];
|
|
109
|
+
}, _ref17 => {
|
|
110
|
+
let {
|
|
111
|
+
theme
|
|
112
|
+
} = _ref17;
|
|
113
|
+
return theme.colors.brand[800];
|
|
114
|
+
}, _ref18 => {
|
|
115
|
+
let {
|
|
116
|
+
theme
|
|
117
|
+
} = _ref18;
|
|
118
|
+
return theme.colors.neutral[500];
|
|
119
|
+
}, _ref19 => {
|
|
120
|
+
let {
|
|
121
|
+
theme
|
|
122
|
+
} = _ref19;
|
|
123
|
+
return theme.colors.neutral[500];
|
|
124
|
+
}, StyledChipLabel, _ref20 => {
|
|
125
|
+
let {
|
|
126
|
+
theme
|
|
127
|
+
} = _ref20;
|
|
128
|
+
return theme.colors.neutral[500];
|
|
129
|
+
}, _ref21 => {
|
|
130
|
+
let {
|
|
131
|
+
theme
|
|
132
|
+
} = _ref21;
|
|
133
|
+
return theme.colors.neutral[500];
|
|
134
|
+
}, _ref22 => {
|
|
135
|
+
let {
|
|
136
|
+
selected
|
|
137
|
+
} = _ref22;
|
|
138
|
+
return !selected ? '' : styledChipSelectedCss;
|
|
139
|
+
});
|
|
140
|
+
const StyledSeparator = styled('hr', {
|
|
141
|
+
name: 'DS-AppPicker',
|
|
142
|
+
slot: 'separator'
|
|
143
|
+
})(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n border-bottom: none;\n width: 99%;\n margin: 0;\n"])), _ref23 => {
|
|
144
|
+
let {
|
|
145
|
+
theme
|
|
146
|
+
} = _ref23;
|
|
147
|
+
return theme.colors.neutral[100];
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export { StyledChip, StyledChipLabel, StyledGrid, StyledRow, StyledSeparator, StyledTitle, StyledWrapper };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/esm/utils.js
ADDED
package/package.json
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-app-picker",
|
|
3
|
-
"version": "2.3.0-
|
|
3
|
+
"version": "2.3.0-next.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - App Picker",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"module": "./dist/esm/index.js",
|
|
10
|
-
"main": "./dist/cjs/index.js",
|
|
11
|
-
"types": "./dist/types/index.d.ts",
|
|
6
|
+
"module": "./esm/index.js",
|
|
7
|
+
"main": "./cjs/index.js",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
12
9
|
"exports": {
|
|
13
10
|
".": {
|
|
14
|
-
"import": "./
|
|
15
|
-
"require": "./
|
|
11
|
+
"import": "./esm/index.js",
|
|
12
|
+
"require": "./cjs/index.js"
|
|
16
13
|
},
|
|
17
14
|
"./utils": {
|
|
18
|
-
"import": "./
|
|
19
|
-
"require": "./
|
|
15
|
+
"import": "./esm/utils.js",
|
|
16
|
+
"require": "./cjs/utils.js"
|
|
20
17
|
},
|
|
21
18
|
"./types/AppPickerTypes": {
|
|
22
|
-
"import": "./
|
|
23
|
-
"require": "./
|
|
19
|
+
"import": "./esm/types/AppPickerTypes.js",
|
|
20
|
+
"require": "./cjs/types/AppPickerTypes.js"
|
|
24
21
|
},
|
|
25
22
|
"./styles": {
|
|
26
|
-
"import": "./
|
|
27
|
-
"require": "./
|
|
23
|
+
"import": "./esm/styles.js",
|
|
24
|
+
"require": "./cjs/styles.js"
|
|
28
25
|
},
|
|
29
26
|
"./propTypes": {
|
|
30
|
-
"import": "./
|
|
31
|
-
"require": "./
|
|
27
|
+
"import": "./esm/propTypes.js",
|
|
28
|
+
"require": "./cjs/propTypes.js"
|
|
32
29
|
},
|
|
33
30
|
"./DSAppPicker": {
|
|
34
|
-
"import": "./
|
|
35
|
-
"require": "./
|
|
31
|
+
"import": "./esm/DSAppPicker.js",
|
|
32
|
+
"require": "./cjs/DSAppPicker.js"
|
|
36
33
|
},
|
|
37
34
|
"./AppPickerImpl": {
|
|
38
|
-
"import": "./
|
|
39
|
-
"require": "./
|
|
35
|
+
"import": "./esm/AppPickerImpl.js",
|
|
36
|
+
"require": "./cjs/AppPickerImpl.js"
|
|
40
37
|
}
|
|
41
38
|
},
|
|
42
39
|
"sideEffects": [
|
|
@@ -48,22 +45,26 @@
|
|
|
48
45
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
49
46
|
},
|
|
50
47
|
"engines": {
|
|
51
|
-
"
|
|
52
|
-
"node": ">=
|
|
48
|
+
"npm": ">=7",
|
|
49
|
+
"node": ">=14"
|
|
53
50
|
},
|
|
54
51
|
"author": "ICE MT",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
54
|
+
"prebuild": "exit 0",
|
|
55
|
+
"predev": "exit 0",
|
|
56
|
+
"build": "node ../../scripts/build/build.js"
|
|
57
|
+
},
|
|
55
58
|
"dependencies": {
|
|
56
|
-
"@elliemae/ds-button": "2.3.0-
|
|
57
|
-
"@elliemae/ds-icons": "2.3.0-
|
|
58
|
-
"@elliemae/ds-popover": "2.3.0-
|
|
59
|
-
"@elliemae/ds-
|
|
60
|
-
"@elliemae/ds-
|
|
61
|
-
"@elliemae/ds-truncated-tooltip-text": "2.3.0-alpha.8",
|
|
62
|
-
"@elliemae/ds-utilities": "2.3.0-alpha.8",
|
|
59
|
+
"@elliemae/ds-button": "2.3.0-next.2",
|
|
60
|
+
"@elliemae/ds-icons": "2.3.0-next.2",
|
|
61
|
+
"@elliemae/ds-popover": "2.3.0-next.2",
|
|
62
|
+
"@elliemae/ds-system": "2.3.0-next.1",
|
|
63
|
+
"@elliemae/ds-utilities": "2.3.0-next.2",
|
|
63
64
|
"react-desc": "^4.1.3"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@testing-library/jest-dom": "~5.15.
|
|
67
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
67
68
|
"@testing-library/react": "~12.1.2"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
@@ -73,12 +74,7 @@
|
|
|
73
74
|
},
|
|
74
75
|
"publishConfig": {
|
|
75
76
|
"access": "public",
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
"scripts": {
|
|
79
|
-
"dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
|
|
80
|
-
"prebuild": "exit 0",
|
|
81
|
-
"predev": "exit 0",
|
|
82
|
-
"build": "node ../../scripts/build/build.js"
|
|
77
|
+
"directory": "dist",
|
|
78
|
+
"generateSubmodules": true
|
|
83
79
|
}
|
|
84
80
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
/// <reference types="react" />
|
|
3
|
+
import type { DSAppPickerType } from './types/AppPickerTypes';
|
|
4
|
+
declare const DSAppPicker: DSAppPickerType;
|
|
5
|
+
declare const AppPickerWithSchema: {
|
|
6
|
+
(props?: unknown): JSX.Element;
|
|
7
|
+
propTypes: unknown;
|
|
8
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
9
|
+
};
|
|
10
|
+
export { DSAppPicker, AppPickerWithSchema };
|
|
11
|
+
export default DSAppPicker;
|
package/types/index.d.ts
ADDED