@elliemae/ds-app-picker 2.0.0-rc.1 → 2.0.0-rc.13
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 +17 -35
- package/cjs/DSAppPicker.js +1 -1
- package/cjs/styles.js +49 -0
- package/esm/AppPickerImpl.js +19 -37
- package/esm/DSAppPicker.js +1 -1
- package/esm/styles.js +35 -0
- package/package.json +17 -7
- package/types/DSAppPicker.d.ts +7 -1
- package/types/propTypes.d.ts +59 -12
- package/types/styles.d.ts +9 -0
- package/types/types/AppPickerTypes.d.ts +9 -5
package/cjs/AppPickerImpl.js
CHANGED
|
@@ -8,34 +8,17 @@ require('core-js/modules/esnext.async-iterator.map.js');
|
|
|
8
8
|
require('core-js/modules/esnext.iterator.map.js');
|
|
9
9
|
var react = require('react');
|
|
10
10
|
var lodash = require('lodash');
|
|
11
|
-
var dsClassnames = require('@elliemae/ds-classnames');
|
|
12
11
|
var utils = require('./utils.js');
|
|
12
|
+
var styles = require('./styles.js');
|
|
13
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
|
|
15
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
16
|
|
|
17
17
|
var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
|
|
18
18
|
|
|
19
|
-
var
|
|
20
|
-
const blockName = 'app-picker';
|
|
21
|
-
const Wrapper = dsClassnames.aggregatedClasses('ul')(blockName, 'wrapper');
|
|
22
|
-
const Grid = dsClassnames.aggregatedClasses('div')(blockName, 'grid');
|
|
23
|
-
const Row = dsClassnames.aggregatedClasses('div')(blockName, 'row');
|
|
24
|
-
const Chip = dsClassnames.aggregatedClasses('button')(blockName, 'chip', _ref => {
|
|
25
|
-
let {
|
|
26
|
-
disabled,
|
|
27
|
-
selected
|
|
28
|
-
} = _ref;
|
|
29
|
-
return {
|
|
30
|
-
disabled,
|
|
31
|
-
selected
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
const ChipLabel = dsClassnames.aggregatedClasses('p')(blockName, 'chip-label');
|
|
35
|
-
const Separator = dsClassnames.aggregatedClasses('hr')(blockName, 'separator');
|
|
36
|
-
const SectionTitle = dsClassnames.aggregatedClasses('p')(blockName, 'section-title');
|
|
19
|
+
var _StyledSeparator;
|
|
37
20
|
|
|
38
|
-
const AppPickerImpl =
|
|
21
|
+
const AppPickerImpl = _ref => {
|
|
39
22
|
let {
|
|
40
23
|
apps = [],
|
|
41
24
|
customApps = [],
|
|
@@ -45,7 +28,7 @@ const AppPickerImpl = _ref2 => {
|
|
|
45
28
|
wrapperRef,
|
|
46
29
|
onKeyDown,
|
|
47
30
|
triggerRef
|
|
48
|
-
} =
|
|
31
|
+
} = _ref;
|
|
49
32
|
const allFocusableButtons = react.useRef([]);
|
|
50
33
|
const selectedButton = react.useRef(null);
|
|
51
34
|
react.useEffect(() => {
|
|
@@ -117,55 +100,54 @@ const AppPickerImpl = _ref2 => {
|
|
|
117
100
|
let prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
118
101
|
const rows = lodash.chunk(appList, 3); // divides array in subarrays of 3 items
|
|
119
102
|
|
|
120
|
-
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx__default["default"](
|
|
103
|
+
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx__default["default"](styles.StyledRow, {}, index, row.map((app, key) => {
|
|
121
104
|
const {
|
|
122
105
|
label,
|
|
123
106
|
disabled,
|
|
124
107
|
selected,
|
|
125
108
|
icon: Icon
|
|
126
109
|
} = app;
|
|
127
|
-
return /*#__PURE__*/_jsx__default["default"](
|
|
128
|
-
classProps: {
|
|
129
|
-
disabled,
|
|
130
|
-
selected
|
|
131
|
-
},
|
|
110
|
+
return /*#__PURE__*/_jsx__default["default"](styles.StyledChip, {
|
|
132
111
|
onClick: e => handleOnClick(e, app),
|
|
133
112
|
onKeyDown: handleKeyDown,
|
|
134
113
|
"data-testid": "app-picker__chip",
|
|
135
114
|
"aria-disabled": disabled,
|
|
136
115
|
disabled: disabled,
|
|
116
|
+
selected: selected,
|
|
137
117
|
"aria-selected": selected,
|
|
138
118
|
"aria-setsize": apps.length + customApps.length,
|
|
139
119
|
"aria-posinset": key + prevIndex
|
|
140
120
|
}, key, /*#__PURE__*/_jsx__default["default"](Icon, {
|
|
141
121
|
className: "app-picker__icon",
|
|
142
122
|
size: "m"
|
|
143
|
-
}), /*#__PURE__*/_jsx__default["default"](
|
|
123
|
+
}), /*#__PURE__*/_jsx__default["default"](styles.StyledChipLabel, {}, void 0, label));
|
|
144
124
|
})));
|
|
145
|
-
return
|
|
125
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
126
|
+
children: formattedRows
|
|
127
|
+
});
|
|
146
128
|
};
|
|
147
129
|
|
|
148
130
|
const AppsRows = () => buildRows(apps, 1);
|
|
149
131
|
|
|
150
132
|
const CustomRows = () => buildRows(customApps, apps.length);
|
|
151
133
|
|
|
152
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
134
|
+
return /*#__PURE__*/jsxRuntime.jsxs(styles.StyledWrapper, {
|
|
153
135
|
role: "listbox",
|
|
154
136
|
ref: wrapperRef,
|
|
155
137
|
onKeyDown: handleOnKeyDownWrapper,
|
|
156
138
|
"data-testid": "app-picker__wrapper",
|
|
157
|
-
children: [/*#__PURE__*/_jsx__default["default"](
|
|
139
|
+
children: [/*#__PURE__*/_jsx__default["default"](styles.StyledTitle, {
|
|
158
140
|
"data-testid": "app-picker__main-title",
|
|
159
141
|
"aria-hidden": true
|
|
160
|
-
}, void 0, sectionTitle), /*#__PURE__*/_jsx__default["default"](
|
|
142
|
+
}, void 0, sectionTitle), /*#__PURE__*/_jsx__default["default"](styles.StyledGrid, {
|
|
161
143
|
"data-testid": "app-picker__main-grid"
|
|
162
144
|
}, void 0, /*#__PURE__*/_jsx__default["default"](AppsRows, {})), !!customApps.length && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
163
|
-
children: [
|
|
145
|
+
children: [_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](styles.StyledSeparator, {
|
|
164
146
|
"aria-hidden": true
|
|
165
|
-
})), /*#__PURE__*/_jsx__default["default"](
|
|
147
|
+
})), /*#__PURE__*/_jsx__default["default"](styles.StyledTitle, {
|
|
166
148
|
"data-testid": "app-picker__custom-title",
|
|
167
149
|
"aria-hidden": true
|
|
168
|
-
}, void 0, customSectionTitle), /*#__PURE__*/_jsx__default["default"](
|
|
150
|
+
}, void 0, customSectionTitle), /*#__PURE__*/_jsx__default["default"](styles.StyledGrid, {
|
|
169
151
|
"data-testid": "app-picker__custom-grid"
|
|
170
152
|
}, void 0, /*#__PURE__*/_jsx__default["default"](CustomRows, {}))]
|
|
171
153
|
})]
|
package/cjs/DSAppPicker.js
CHANGED
|
@@ -44,7 +44,7 @@ const DSAppPicker = _ref => {
|
|
|
44
44
|
const wrapperRef = react.useRef(null);
|
|
45
45
|
const defaultTriggerRef = react.useRef(null);
|
|
46
46
|
react.useEffect(() => {
|
|
47
|
-
if (actionRef) {
|
|
47
|
+
if (actionRef && actionRef.current) {
|
|
48
48
|
actionRef.current.focusToIndex = index => {
|
|
49
49
|
if (wrapperRef.current) {
|
|
50
50
|
const parent = wrapperRef.current;
|
package/cjs/styles.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
|
|
6
|
+
var dsSystem = require('@elliemae/ds-system');
|
|
7
|
+
|
|
8
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
|
|
11
|
+
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
13
|
+
const StyledWrapper = dsSystem.styled('ul', {
|
|
14
|
+
name: 'DS-AppPicker',
|
|
15
|
+
slot: 'root'
|
|
16
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n display: flex;\n flex-direction: column;\n align-items: center;\n min-width: 244px;\n max-height: 449px;\n overflow-y: auto;\n padding: 4px 0;\n margin: 0 auto;\n\n &:focus {\n outline: none;\n }\n"])));
|
|
17
|
+
const StyledGrid = dsSystem.styled('div', {
|
|
18
|
+
name: 'DS-AppPicker',
|
|
19
|
+
slot: 'grid'
|
|
20
|
+
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 0 8px;\n"])));
|
|
21
|
+
const StyledRow = dsSystem.styled('div', {
|
|
22
|
+
name: 'DS-AppPicker',
|
|
23
|
+
slot: 'row'
|
|
24
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n display: flex;\n width: 100%;\n"])));
|
|
25
|
+
const StyledTitle = dsSystem.styled('p', {
|
|
26
|
+
name: 'DS-AppPicker',
|
|
27
|
+
slot: 'title'
|
|
28
|
+
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n color: ", ";\n font-size: 0.8461rem;\n font-weight: bold;\n margin: 8px 0 4px 0;\n line-height: 1;\n text-transform: uppercase;\n"])), props => props.theme.colors.neutral[700]);
|
|
29
|
+
const StyledChipLabel = dsSystem.styled('p', {
|
|
30
|
+
name: 'DS-AppPicker',
|
|
31
|
+
slot: 'chipLabel'
|
|
32
|
+
})(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n font-size: 0.8461rem;\n font-weight: 600;\n word-wrap: break-word;\n margin: 4px 0;\n line-height: 14px;\n text-overflow: ellipsis;\n max-width: 68px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n"])));
|
|
33
|
+
const styledChipSelectedCss = dsSystem.css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral__default["default"](["\n color: ", ";\n background-color: ", ";\n position: relative;\n\n .app-picker__icon {\n fill: ", ";\n }\n\n &::after {\n position: absolute;\n content: ' ';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 2px;\n }\n\n &:focus {\n border: 2px solid transparent;\n &::after {\n border: 2px solid ", ";\n }\n }\n"])), props => props.theme.colors.brand[800], props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => props.theme.colors.brand[600], props => props.theme.colors.brand[800]);
|
|
34
|
+
const StyledChip = dsSystem.styled('button', {
|
|
35
|
+
name: 'DS-AppPicker',
|
|
36
|
+
slot: 'chip'
|
|
37
|
+
})(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral__default["default"](["\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 2%;\n padding: 8px 0 4px 0;\n margin: 4px;\n height: 68px;\n width: 68px;\n line-height: 1px;\n background-color: #fff;\n color: ", ";\n cursor: pointer;\n border: 2px solid transparent;\n overflow: hidden;\n\n & .app-picker__icon {\n fill: ", ";\n }\n\n &:hover {\n color: ", ";\n background-color: ", ";\n .app-picker__icon {\n fill: ", ";\n }\n }\n\n &:focus {\n outline: none;\n border: 2px solid ", ";\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 border: 2px solid transparent;\n\n ", " {\n color: ", ";\n }\n }\n\n &:hover .app-picker__icon {\n fill: ", ";\n }\n }\n\n ", "\n"])), props => props.theme.colors.brand[600], props => props.theme.colors.brand[600], props => props.theme.colors.brand[800], props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => props.theme.colors.brand[800], props => props.theme.colors.neutral[500], props => props.theme.colors.neutral[500], StyledChipLabel, props => props.theme.colors.neutral[500], props => props.theme.colors.neutral[500], props => !props.selected ? '' : styledChipSelectedCss);
|
|
38
|
+
const StyledSeparator = dsSystem.styled('hr', {
|
|
39
|
+
name: 'DS-AppPicker',
|
|
40
|
+
slot: 'separator'
|
|
41
|
+
})(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral__default["default"](["\n border-top: 1px solid ", ";\n border-bottom: none;\n width: 99%;\n margin-bottom: 0;\n"])), props => props.theme.colors.neutral[100]);
|
|
42
|
+
|
|
43
|
+
exports.StyledChip = StyledChip;
|
|
44
|
+
exports.StyledChipLabel = StyledChipLabel;
|
|
45
|
+
exports.StyledGrid = StyledGrid;
|
|
46
|
+
exports.StyledRow = StyledRow;
|
|
47
|
+
exports.StyledSeparator = StyledSeparator;
|
|
48
|
+
exports.StyledTitle = StyledTitle;
|
|
49
|
+
exports.StyledWrapper = StyledWrapper;
|
package/esm/AppPickerImpl.js
CHANGED
|
@@ -6,30 +6,13 @@ import 'core-js/modules/esnext.async-iterator.map.js';
|
|
|
6
6
|
import 'core-js/modules/esnext.iterator.map.js';
|
|
7
7
|
import { useRef, useEffect, useCallback } from 'react';
|
|
8
8
|
import { chunk } from 'lodash';
|
|
9
|
-
import { aggregatedClasses } from '@elliemae/ds-classnames';
|
|
10
9
|
import { keys } from './utils.js';
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
var _Separator;
|
|
14
|
-
const blockName = 'app-picker';
|
|
15
|
-
const Wrapper = aggregatedClasses('ul')(blockName, 'wrapper');
|
|
16
|
-
const Grid = aggregatedClasses('div')(blockName, 'grid');
|
|
17
|
-
const Row = aggregatedClasses('div')(blockName, 'row');
|
|
18
|
-
const Chip = aggregatedClasses('button')(blockName, 'chip', _ref => {
|
|
19
|
-
let {
|
|
20
|
-
disabled,
|
|
21
|
-
selected
|
|
22
|
-
} = _ref;
|
|
23
|
-
return {
|
|
24
|
-
disabled,
|
|
25
|
-
selected
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
const ChipLabel = aggregatedClasses('p')(blockName, 'chip-label');
|
|
29
|
-
const Separator = aggregatedClasses('hr')(blockName, 'separator');
|
|
30
|
-
const SectionTitle = aggregatedClasses('p')(blockName, 'section-title');
|
|
10
|
+
import { StyledWrapper, StyledTitle, StyledGrid, StyledSeparator, StyledRow, StyledChip, StyledChipLabel } from './styles.js';
|
|
11
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
31
12
|
|
|
32
|
-
|
|
13
|
+
var _StyledSeparator;
|
|
14
|
+
|
|
15
|
+
const AppPickerImpl = _ref => {
|
|
33
16
|
let {
|
|
34
17
|
apps = [],
|
|
35
18
|
customApps = [],
|
|
@@ -39,7 +22,7 @@ const AppPickerImpl = _ref2 => {
|
|
|
39
22
|
wrapperRef,
|
|
40
23
|
onKeyDown,
|
|
41
24
|
triggerRef
|
|
42
|
-
} =
|
|
25
|
+
} = _ref;
|
|
43
26
|
const allFocusableButtons = useRef([]);
|
|
44
27
|
const selectedButton = useRef(null);
|
|
45
28
|
useEffect(() => {
|
|
@@ -111,55 +94,54 @@ const AppPickerImpl = _ref2 => {
|
|
|
111
94
|
let prevIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
112
95
|
const rows = chunk(appList, 3); // divides array in subarrays of 3 items
|
|
113
96
|
|
|
114
|
-
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx(
|
|
97
|
+
const formattedRows = rows.map((row, index) => /*#__PURE__*/_jsx(StyledRow, {}, index, row.map((app, key) => {
|
|
115
98
|
const {
|
|
116
99
|
label,
|
|
117
100
|
disabled,
|
|
118
101
|
selected,
|
|
119
102
|
icon: Icon
|
|
120
103
|
} = app;
|
|
121
|
-
return /*#__PURE__*/_jsx(
|
|
122
|
-
classProps: {
|
|
123
|
-
disabled,
|
|
124
|
-
selected
|
|
125
|
-
},
|
|
104
|
+
return /*#__PURE__*/_jsx(StyledChip, {
|
|
126
105
|
onClick: e => handleOnClick(e, app),
|
|
127
106
|
onKeyDown: handleKeyDown,
|
|
128
107
|
"data-testid": "app-picker__chip",
|
|
129
108
|
"aria-disabled": disabled,
|
|
130
109
|
disabled: disabled,
|
|
110
|
+
selected: selected,
|
|
131
111
|
"aria-selected": selected,
|
|
132
112
|
"aria-setsize": apps.length + customApps.length,
|
|
133
113
|
"aria-posinset": key + prevIndex
|
|
134
114
|
}, key, /*#__PURE__*/_jsx(Icon, {
|
|
135
115
|
className: "app-picker__icon",
|
|
136
116
|
size: "m"
|
|
137
|
-
}), /*#__PURE__*/_jsx(
|
|
117
|
+
}), /*#__PURE__*/_jsx(StyledChipLabel, {}, void 0, label));
|
|
138
118
|
})));
|
|
139
|
-
return
|
|
119
|
+
return /*#__PURE__*/jsx(Fragment, {
|
|
120
|
+
children: formattedRows
|
|
121
|
+
});
|
|
140
122
|
};
|
|
141
123
|
|
|
142
124
|
const AppsRows = () => buildRows(apps, 1);
|
|
143
125
|
|
|
144
126
|
const CustomRows = () => buildRows(customApps, apps.length);
|
|
145
127
|
|
|
146
|
-
return /*#__PURE__*/jsxs(
|
|
128
|
+
return /*#__PURE__*/jsxs(StyledWrapper, {
|
|
147
129
|
role: "listbox",
|
|
148
130
|
ref: wrapperRef,
|
|
149
131
|
onKeyDown: handleOnKeyDownWrapper,
|
|
150
132
|
"data-testid": "app-picker__wrapper",
|
|
151
|
-
children: [/*#__PURE__*/_jsx(
|
|
133
|
+
children: [/*#__PURE__*/_jsx(StyledTitle, {
|
|
152
134
|
"data-testid": "app-picker__main-title",
|
|
153
135
|
"aria-hidden": true
|
|
154
|
-
}, void 0, sectionTitle), /*#__PURE__*/_jsx(
|
|
136
|
+
}, void 0, sectionTitle), /*#__PURE__*/_jsx(StyledGrid, {
|
|
155
137
|
"data-testid": "app-picker__main-grid"
|
|
156
138
|
}, void 0, /*#__PURE__*/_jsx(AppsRows, {})), !!customApps.length && /*#__PURE__*/jsxs(Fragment, {
|
|
157
|
-
children: [
|
|
139
|
+
children: [_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
158
140
|
"aria-hidden": true
|
|
159
|
-
})), /*#__PURE__*/_jsx(
|
|
141
|
+
})), /*#__PURE__*/_jsx(StyledTitle, {
|
|
160
142
|
"data-testid": "app-picker__custom-title",
|
|
161
143
|
"aria-hidden": true
|
|
162
|
-
}, void 0, customSectionTitle), /*#__PURE__*/_jsx(
|
|
144
|
+
}, void 0, customSectionTitle), /*#__PURE__*/_jsx(StyledGrid, {
|
|
163
145
|
"data-testid": "app-picker__custom-grid"
|
|
164
146
|
}, void 0, /*#__PURE__*/_jsx(CustomRows, {}))]
|
|
165
147
|
})]
|
package/esm/DSAppPicker.js
CHANGED
|
@@ -34,7 +34,7 @@ const DSAppPicker = _ref => {
|
|
|
34
34
|
const wrapperRef = useRef(null);
|
|
35
35
|
const defaultTriggerRef = useRef(null);
|
|
36
36
|
useEffect(() => {
|
|
37
|
-
if (actionRef) {
|
|
37
|
+
if (actionRef && actionRef.current) {
|
|
38
38
|
actionRef.current.focusToIndex = index => {
|
|
39
39
|
if (wrapperRef.current) {
|
|
40
40
|
const parent = wrapperRef.current;
|
package/esm/styles.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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 StyledWrapper = styled('ul', {
|
|
6
|
+
name: 'DS-AppPicker',
|
|
7
|
+
slot: 'root'
|
|
8
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n min-width: 244px;\n max-height: 449px;\n overflow-y: auto;\n padding: 4px 0;\n margin: 0 auto;\n\n &:focus {\n outline: none;\n }\n"])));
|
|
9
|
+
const StyledGrid = styled('div', {
|
|
10
|
+
name: 'DS-AppPicker',
|
|
11
|
+
slot: 'grid'
|
|
12
|
+
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n padding: 0 8px;\n"])));
|
|
13
|
+
const StyledRow = styled('div', {
|
|
14
|
+
name: 'DS-AppPicker',
|
|
15
|
+
slot: 'row'
|
|
16
|
+
})(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n width: 100%;\n"])));
|
|
17
|
+
const StyledTitle = styled('p', {
|
|
18
|
+
name: 'DS-AppPicker',
|
|
19
|
+
slot: 'title'
|
|
20
|
+
})(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n color: ", ";\n font-size: 0.8461rem;\n font-weight: bold;\n margin: 8px 0 4px 0;\n line-height: 1;\n text-transform: uppercase;\n"])), props => props.theme.colors.neutral[700]);
|
|
21
|
+
const StyledChipLabel = styled('p', {
|
|
22
|
+
name: 'DS-AppPicker',
|
|
23
|
+
slot: 'chipLabel'
|
|
24
|
+
})(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n font-size: 0.8461rem;\n font-weight: 600;\n word-wrap: break-word;\n margin: 4px 0;\n line-height: 14px;\n text-overflow: ellipsis;\n max-width: 68px;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n"])));
|
|
25
|
+
const styledChipSelectedCss = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n color: ", ";\n background-color: ", ";\n position: relative;\n\n .app-picker__icon {\n fill: ", ";\n }\n\n &::after {\n position: absolute;\n content: ' ';\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: 1px solid ", ";\n border-radius: 2px;\n }\n\n &:focus {\n border: 2px solid transparent;\n &::after {\n border: 2px solid ", ";\n }\n }\n"])), props => props.theme.colors.brand[800], props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => props.theme.colors.brand[600], props => props.theme.colors.brand[800]);
|
|
26
|
+
const StyledChip = styled('button', {
|
|
27
|
+
name: 'DS-AppPicker',
|
|
28
|
+
slot: 'chip'
|
|
29
|
+
})(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n align-items: center;\n border-radius: 2%;\n padding: 8px 0 4px 0;\n margin: 4px;\n height: 68px;\n width: 68px;\n line-height: 1px;\n background-color: #fff;\n color: ", ";\n cursor: pointer;\n border: 2px solid transparent;\n overflow: hidden;\n\n & .app-picker__icon {\n fill: ", ";\n }\n\n &:hover {\n color: ", ";\n background-color: ", ";\n .app-picker__icon {\n fill: ", ";\n }\n }\n\n &:focus {\n outline: none;\n border: 2px solid ", ";\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 border: 2px solid transparent;\n\n ", " {\n color: ", ";\n }\n }\n\n &:hover .app-picker__icon {\n fill: ", ";\n }\n }\n\n ", "\n"])), props => props.theme.colors.brand[600], props => props.theme.colors.brand[600], props => props.theme.colors.brand[800], props => props.theme.colors.brand[200], props => props.theme.colors.brand[800], props => props.theme.colors.brand[800], props => props.theme.colors.neutral[500], props => props.theme.colors.neutral[500], StyledChipLabel, props => props.theme.colors.neutral[500], props => props.theme.colors.neutral[500], props => !props.selected ? '' : styledChipSelectedCss);
|
|
30
|
+
const StyledSeparator = styled('hr', {
|
|
31
|
+
name: 'DS-AppPicker',
|
|
32
|
+
slot: 'separator'
|
|
33
|
+
})(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n border-top: 1px solid ", ";\n border-bottom: none;\n width: 99%;\n margin-bottom: 0;\n"])), props => props.theme.colors.neutral[100]);
|
|
34
|
+
|
|
35
|
+
export { StyledChip, StyledChipLabel, StyledGrid, StyledRow, StyledSeparator, StyledTitle, StyledWrapper };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-app-picker",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - App Picker",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -19,6 +19,10 @@
|
|
|
19
19
|
"import": "./esm/types/AppPickerTypes.js",
|
|
20
20
|
"require": "./cjs/types/AppPickerTypes.js"
|
|
21
21
|
},
|
|
22
|
+
"./styles": {
|
|
23
|
+
"import": "./esm/styles.js",
|
|
24
|
+
"require": "./cjs/styles.js"
|
|
25
|
+
},
|
|
22
26
|
"./propTypes": {
|
|
23
27
|
"import": "./esm/propTypes.js",
|
|
24
28
|
"require": "./cjs/propTypes.js"
|
|
@@ -52,17 +56,23 @@
|
|
|
52
56
|
"build": "node ../../scripts/build/build.js"
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
|
-
"@elliemae/ds-button": "2.0.0-rc.
|
|
56
|
-
"@elliemae/ds-
|
|
57
|
-
"@elliemae/ds-
|
|
58
|
-
"@elliemae/ds-
|
|
59
|
-
"@elliemae/ds-utilities": "2.0.0-rc.
|
|
59
|
+
"@elliemae/ds-button": "2.0.0-rc.13",
|
|
60
|
+
"@elliemae/ds-icons": "2.0.0-rc.13",
|
|
61
|
+
"@elliemae/ds-popover": "2.0.0-rc.13",
|
|
62
|
+
"@elliemae/ds-system": "2.0.0-rc.13",
|
|
63
|
+
"@elliemae/ds-utilities": "2.0.0-rc.13",
|
|
60
64
|
"react-desc": "^4.1.3"
|
|
61
65
|
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@testing-library/jest-dom": "~5.15.0",
|
|
68
|
+
"@testing-library/react": "~12.1.2",
|
|
69
|
+
"styled-components": "~5.3.3"
|
|
70
|
+
},
|
|
62
71
|
"peerDependencies": {
|
|
63
72
|
"lodash": "^4.17.21",
|
|
64
73
|
"react": "^17.0.2",
|
|
65
|
-
"react-dom": "^17.0.2"
|
|
74
|
+
"react-dom": "^17.0.2",
|
|
75
|
+
"styled-components": "^5.3.3"
|
|
66
76
|
},
|
|
67
77
|
"publishConfig": {
|
|
68
78
|
"access": "public",
|
package/types/DSAppPicker.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
2
|
+
import React from 'react';
|
|
1
3
|
import type { DSAppPickerType } from './types/AppPickerTypes';
|
|
2
4
|
declare const DSAppPicker: DSAppPickerType;
|
|
3
|
-
declare const AppPickerWithSchema:
|
|
5
|
+
declare const AppPickerWithSchema: {
|
|
6
|
+
(props?: React.PropsWithChildren<import("./types/AppPickerTypes").AppPickerPropsType> | undefined): JSX.Element;
|
|
7
|
+
propTypes: unknown;
|
|
8
|
+
toTypescript: () => import("react-desc").TypescriptSchema;
|
|
9
|
+
};
|
|
4
10
|
export { DSAppPicker, AppPickerWithSchema };
|
|
5
11
|
export default DSAppPicker;
|
package/types/propTypes.d.ts
CHANGED
|
@@ -1,14 +1,61 @@
|
|
|
1
|
+
/// <reference path="../../../../shared/typings/react-desc.d.ts" />
|
|
1
2
|
export declare const propTypes: {
|
|
2
|
-
apps:
|
|
3
|
-
customApps:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
apps: import("react-desc").PropTypesDescValidator;
|
|
4
|
+
customApps: {
|
|
5
|
+
defaultValue<T = unknown>(arg: T): {
|
|
6
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
7
|
+
};
|
|
8
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
9
|
+
};
|
|
10
|
+
sectionTitle: {
|
|
11
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
12
|
+
};
|
|
13
|
+
customSectionTitle: {
|
|
14
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
15
|
+
};
|
|
16
|
+
icon: {
|
|
17
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
18
|
+
};
|
|
19
|
+
renderTrigger: {
|
|
20
|
+
defaultValue<T = unknown>(arg: T): {
|
|
21
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
22
|
+
};
|
|
23
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
24
|
+
};
|
|
25
|
+
actionRef: {
|
|
26
|
+
defaultValue<T = unknown>(arg: T): {
|
|
27
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
28
|
+
};
|
|
29
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
30
|
+
};
|
|
31
|
+
isOpen: {
|
|
32
|
+
defaultValue<T = unknown>(arg: T): {
|
|
33
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
34
|
+
};
|
|
35
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
36
|
+
};
|
|
37
|
+
onClose: {
|
|
38
|
+
defaultValue<T = unknown>(arg: T): {
|
|
39
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
40
|
+
};
|
|
41
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
42
|
+
};
|
|
43
|
+
onKeyDown: {
|
|
44
|
+
defaultValue<T = unknown>(arg: T): {
|
|
45
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
46
|
+
};
|
|
47
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
48
|
+
};
|
|
49
|
+
onClick: {
|
|
50
|
+
defaultValue<T = unknown>(arg: T): {
|
|
51
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
52
|
+
};
|
|
53
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
54
|
+
};
|
|
55
|
+
onClickOutside: {
|
|
56
|
+
defaultValue<T = unknown>(arg: T): {
|
|
57
|
+
deprecated: import("react-desc").PropTypesDescValidator;
|
|
58
|
+
};
|
|
59
|
+
isRequired: import("react-desc").PropTypesDescValidator;
|
|
60
|
+
};
|
|
14
61
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const StyledWrapper: import("styled-components").StyledComponent<"ul", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
2
|
+
export declare const StyledGrid: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
3
|
+
export declare const StyledRow: import("styled-components").StyledComponent<"div", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
4
|
+
export declare const StyledTitle: import("styled-components").StyledComponent<"p", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
5
|
+
export declare const StyledChipLabel: import("styled-components").StyledComponent<"p", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
6
|
+
export declare const StyledChip: import("styled-components").StyledComponent<"button", import("@elliemae/ds-system/types/styled/types").Theme, {
|
|
7
|
+
selected: boolean | undefined;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const StyledSeparator: import("styled-components").StyledComponent<"hr", import("@elliemae/ds-system/types/styled/types").Theme, {}, never>;
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import type { SvgIconType } from '@elliemae/ds-icons';
|
|
3
3
|
export interface AppItemType {
|
|
4
4
|
label: string;
|
|
5
|
-
icon: React.
|
|
5
|
+
icon: React.ComponentType<{
|
|
6
|
+
className: string;
|
|
7
|
+
size: string;
|
|
8
|
+
}>;
|
|
6
9
|
onClick: () => void | null;
|
|
7
10
|
disabled?: boolean;
|
|
8
11
|
selected?: boolean;
|
|
@@ -13,15 +16,16 @@ export interface AppPickerPropsType {
|
|
|
13
16
|
sectionTitle: string;
|
|
14
17
|
customSectionTitle: string;
|
|
15
18
|
icon: SvgIconType;
|
|
16
|
-
onKeyDown?: (e: KeyboardEvent) => void;
|
|
19
|
+
onKeyDown?: (e: React.KeyboardEvent) => void;
|
|
17
20
|
actionRef?: React.RefObject<{
|
|
18
21
|
focusToIndex: (index: number) => void;
|
|
19
22
|
}>;
|
|
20
23
|
onClick?: (e: MouseEvent) => void;
|
|
21
|
-
onClickOutside?: (e: MouseEvent) => void;
|
|
22
|
-
renderTrigger?:
|
|
24
|
+
onClickOutside?: (e: React.MouseEvent) => void;
|
|
25
|
+
renderTrigger?: React.ComponentType<any>;
|
|
23
26
|
isOpen?: boolean;
|
|
24
27
|
onClose?: () => void;
|
|
28
|
+
triggerRef?: React.RefObject<HTMLButtonElement>;
|
|
25
29
|
}
|
|
26
30
|
export interface AppPickerImplProps {
|
|
27
31
|
apps: AppItemType[];
|
|
@@ -30,7 +34,7 @@ export interface AppPickerImplProps {
|
|
|
30
34
|
customSectionTitle: string;
|
|
31
35
|
close?: () => void;
|
|
32
36
|
onKeyDown: (e: KeyboardEvent) => void;
|
|
33
|
-
wrapperRef: React.RefObject<
|
|
37
|
+
wrapperRef: React.RefObject<HTMLUListElement>;
|
|
34
38
|
triggerRef: React.RefObject<HTMLElement>;
|
|
35
39
|
}
|
|
36
40
|
export declare type DSAppPickerImplType = React.ComponentType<AppPickerImplProps>;
|