@elliemae/ds-app-picker 2.2.2-rc.1 → 2.3.0-alpha.10
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/dist/cjs/AppPickerImpl.js +152 -0
- package/dist/cjs/AppPickerImpl.js.map +7 -0
- package/dist/cjs/DSAppPicker.js +141 -0
- package/dist/cjs/DSAppPicker.js.map +7 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/propTypes.js +50 -0
- package/dist/cjs/propTypes.js.map +7 -0
- package/dist/cjs/styles.js +190 -0
- package/dist/cjs/styles.js.map +7 -0
- package/dist/cjs/types/AppPickerTypes.js +27 -0
- package/dist/cjs/types/AppPickerTypes.js.map +7 -0
- package/dist/cjs/utils.js +46 -0
- package/dist/cjs/utils.js.map +7 -0
- package/dist/esm/AppPickerImpl.js +131 -0
- package/dist/esm/AppPickerImpl.js.map +7 -0
- package/dist/esm/DSAppPicker.js +112 -0
- package/dist/esm/DSAppPicker.js.map +7 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/propTypes.js +21 -0
- package/dist/esm/propTypes.js.map +7 -0
- package/dist/esm/styles.js +161 -0
- package/dist/esm/styles.js.map +7 -0
- package/dist/esm/types/AppPickerTypes.js +2 -0
- package/dist/esm/types/AppPickerTypes.js.map +7 -0
- package/dist/esm/utils.js +17 -0
- package/dist/esm/utils.js.map +7 -0
- package/{types → dist/types}/AppPickerImpl.d.ts +0 -0
- package/{types → dist/types}/DSAppPicker.d.ts +0 -0
- package/{types → dist/types}/index.d.ts +0 -0
- package/{types → dist/types}/propTypes.d.ts +0 -0
- package/dist/types/styles.d.ts +9 -0
- package/{types → dist/types}/tests/AppPicker.test.d.ts +0 -0
- package/{types → dist/types}/types/AppPickerTypes.d.ts +0 -0
- package/{types → dist/types}/utils.d.ts +0 -0
- package/package.json +38 -34
- package/cjs/AppPickerImpl.js +0 -182
- package/cjs/DSAppPicker.js +0 -138
- package/cjs/index.js +0 -11
- package/cjs/propTypes.js +0 -25
- package/cjs/styles.js +0 -164
- package/cjs/types/AppPickerTypes.js +0 -2
- package/cjs/utils.js +0 -18
- package/esm/AppPickerImpl.js +0 -174
- package/esm/DSAppPicker.js +0 -126
- package/esm/index.js +0 -1
- package/esm/propTypes.js +0 -21
- package/esm/styles.js +0 -150
- package/esm/types/AppPickerTypes.js +0 -1
- package/esm/utils.js +0 -14
- package/types/styles.d.ts +0 -9
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
|
11
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (module2, isNodeMode) => {
|
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
20
|
+
return (module2, temp) => {
|
|
21
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
22
|
+
};
|
|
23
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
24
|
+
var AppPickerTypes_exports = {};
|
|
25
|
+
var React = __toESM(require("react"));
|
|
26
|
+
module.exports = __toCommonJS(AppPickerTypes_exports);
|
|
27
|
+
//# sourceMappingURL=AppPickerTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/AppPickerTypes.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { SvgIconType } from '@elliemae/ds-icons';\n\nexport interface AppItemType {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick: () => void | null;\n disabled?: boolean;\n selected?: boolean;\n}\n\nexport interface AppPickerPropsType {\n apps: AppItemType[];\n customApps: AppItemType[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: SvgIconType;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: React.RefObject<{ focusToIndex: (index: number) => void }>;\n onClick?: (e: MouseEvent) => void;\n onClickOutside?: (e: React.MouseEvent) => void;\n renderTrigger?: React.ComponentType<any>;\n isOpen?: boolean;\n onClose?: () => void;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n}\n\nexport interface AppPickerImplProps {\n apps: AppItemType[];\n customApps: AppItemType[];\n sectionTitle: string;\n customSectionTitle: string;\n close?: () => void;\n onKeyDown: (e: KeyboardEvent) => void;\n wrapperRef: React.RefObject<HTMLUListElement>;\n triggerRef: React.RefObject<HTMLElement>;\n}\n\nexport type DSAppPickerImplType = React.ComponentType<AppPickerImplProps>;\nexport type DSAppPickerType = React.ComponentType<AppPickerPropsType>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
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 utils_exports = {};
|
|
29
|
+
__export(utils_exports, {
|
|
30
|
+
keys: () => keys
|
|
31
|
+
});
|
|
32
|
+
var React = __toESM(require("react"));
|
|
33
|
+
const keys = {
|
|
34
|
+
LEFT: "ArrowLeft",
|
|
35
|
+
UP: "ArrowUp",
|
|
36
|
+
RIGHT: "ArrowRight",
|
|
37
|
+
DOWN: "ArrowDown",
|
|
38
|
+
ENTER: "Enter",
|
|
39
|
+
SPACE: "",
|
|
40
|
+
TAB: "Tab",
|
|
41
|
+
ESC: "Escape",
|
|
42
|
+
HOME: "Home",
|
|
43
|
+
END: "End"
|
|
44
|
+
};
|
|
45
|
+
module.exports = __toCommonJS(utils_exports);
|
|
46
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const keys = {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n ENTER: 'Enter',\n SPACE: '',\n TAB: 'Tab',\n ESC: 'Escape',\n HOME: 'Home',\n END: 'End',\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useEffect, useCallback, useRef } from "react";
|
|
3
|
+
import { getDataProps } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { chunk } from "lodash";
|
|
5
|
+
import { keys } from "./utils";
|
|
6
|
+
import { SimpleTruncatedTooltipText } from "@elliemae/ds-truncated-tooltip-text";
|
|
7
|
+
import {
|
|
8
|
+
StyledWrapper,
|
|
9
|
+
StyledChip,
|
|
10
|
+
StyledChipLabel,
|
|
11
|
+
StyledTitle,
|
|
12
|
+
StyledGrid,
|
|
13
|
+
StyledRow,
|
|
14
|
+
StyledSeparator
|
|
15
|
+
} from "./styles";
|
|
16
|
+
const AppPickerImpl = ({
|
|
17
|
+
apps = [],
|
|
18
|
+
customApps = [],
|
|
19
|
+
sectionTitle = "APPLICATIONS",
|
|
20
|
+
customSectionTitle = "CUSTOM APPLICATIONS",
|
|
21
|
+
close = () => null,
|
|
22
|
+
wrapperRef,
|
|
23
|
+
onKeyDown,
|
|
24
|
+
triggerRef,
|
|
25
|
+
isOverflow
|
|
26
|
+
}) => {
|
|
27
|
+
const allFocusableButtons = useRef([]);
|
|
28
|
+
const selectedButton = useRef(null);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
wrapperRef?.current?.querySelectorAll("button").forEach((e, index) => {
|
|
31
|
+
if (!e.hasAttribute("disabled")) {
|
|
32
|
+
allFocusableButtons?.current?.push(e);
|
|
33
|
+
}
|
|
34
|
+
if (e.getAttribute("aria-selected") === "true") {
|
|
35
|
+
selectedButton.current = index;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (selectedButton.current) {
|
|
39
|
+
wrapperRef?.current?.querySelectorAll("button")[selectedButton.current].focus();
|
|
40
|
+
} else {
|
|
41
|
+
allFocusableButtons?.current[0]?.focus();
|
|
42
|
+
}
|
|
43
|
+
}, [wrapperRef]);
|
|
44
|
+
const handleKeyDown = (e) => {
|
|
45
|
+
switch (e.key) {
|
|
46
|
+
case keys.ESC:
|
|
47
|
+
triggerRef?.current?.focus();
|
|
48
|
+
close();
|
|
49
|
+
break;
|
|
50
|
+
case keys.TAB:
|
|
51
|
+
if (e.shiftKey) {
|
|
52
|
+
if (e.target === allFocusableButtons.current[0]) {
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
allFocusableButtons?.current[allFocusableButtons.current.length - 1]?.focus();
|
|
55
|
+
}
|
|
56
|
+
} else if (e.target === allFocusableButtons.current[allFocusableButtons.current.length - 1]) {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
allFocusableButtons?.current[0]?.focus();
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const handleOnClick = useCallback((e, app) => {
|
|
66
|
+
if (app.onClick)
|
|
67
|
+
app.onClick(e, app);
|
|
68
|
+
}, []);
|
|
69
|
+
const handleOnKeyDownWrapper = useCallback((e) => {
|
|
70
|
+
if (onKeyDown)
|
|
71
|
+
onKeyDown(e);
|
|
72
|
+
if (!onKeyDown && e.key === keys.ESC) {
|
|
73
|
+
close();
|
|
74
|
+
}
|
|
75
|
+
}, [onKeyDown, close]);
|
|
76
|
+
const buildRows = (appList, prevIndex = 0) => {
|
|
77
|
+
const rows = chunk(appList, 3);
|
|
78
|
+
const formattedRows = rows.map((row, index) => /* @__PURE__ */ React2.createElement(StyledRow, {
|
|
79
|
+
key: index
|
|
80
|
+
}, row.map((app, key) => {
|
|
81
|
+
const { label, disabled, selected, icon: Icon, id, ...otherProps } = app;
|
|
82
|
+
return /* @__PURE__ */ React2.createElement(StyledChip, {
|
|
83
|
+
key,
|
|
84
|
+
onClick: (e) => handleOnClick(e, app),
|
|
85
|
+
onKeyDown: handleKeyDown,
|
|
86
|
+
"data-testid": "app-picker__chip",
|
|
87
|
+
"aria-disabled": disabled,
|
|
88
|
+
disabled,
|
|
89
|
+
selected,
|
|
90
|
+
"aria-selected": selected,
|
|
91
|
+
"aria-setsize": apps.length + customApps.length,
|
|
92
|
+
"aria-posinset": key + prevIndex,
|
|
93
|
+
id,
|
|
94
|
+
...getDataProps(otherProps)
|
|
95
|
+
}, /* @__PURE__ */ React2.createElement(Icon, {
|
|
96
|
+
className: "app-picker__icon",
|
|
97
|
+
size: "m"
|
|
98
|
+
}), /* @__PURE__ */ React2.createElement(StyledChipLabel, null, /* @__PURE__ */ React2.createElement(SimpleTruncatedTooltipText, {
|
|
99
|
+
value: label,
|
|
100
|
+
placement: "bottom"
|
|
101
|
+
})));
|
|
102
|
+
})));
|
|
103
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, formattedRows);
|
|
104
|
+
};
|
|
105
|
+
const AppsRows = () => buildRows(apps, 1);
|
|
106
|
+
const CustomRows = () => buildRows(customApps, apps.length);
|
|
107
|
+
return /* @__PURE__ */ React2.createElement(StyledWrapper, {
|
|
108
|
+
role: "listbox",
|
|
109
|
+
ref: wrapperRef,
|
|
110
|
+
onKeyDown: handleOnKeyDownWrapper,
|
|
111
|
+
"data-testid": "app-picker__wrapper",
|
|
112
|
+
isOverflow
|
|
113
|
+
}, /* @__PURE__ */ React2.createElement(StyledTitle, {
|
|
114
|
+
"data-testid": "app-picker__main-title",
|
|
115
|
+
"aria-hidden": true
|
|
116
|
+
}, sectionTitle), /* @__PURE__ */ React2.createElement(StyledGrid, {
|
|
117
|
+
"data-testid": "app-picker__main-grid"
|
|
118
|
+
}, /* @__PURE__ */ React2.createElement(AppsRows, null)), !!customApps.length && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(StyledSeparator, {
|
|
119
|
+
"aria-hidden": true
|
|
120
|
+
}), /* @__PURE__ */ React2.createElement(StyledTitle, {
|
|
121
|
+
"data-testid": "app-picker__custom-title",
|
|
122
|
+
"aria-hidden": true
|
|
123
|
+
}, customSectionTitle), /* @__PURE__ */ React2.createElement(StyledGrid, {
|
|
124
|
+
"data-testid": "app-picker__custom-grid"
|
|
125
|
+
}, /* @__PURE__ */ React2.createElement(CustomRows, null))));
|
|
126
|
+
};
|
|
127
|
+
var AppPickerImpl_default = AppPickerImpl;
|
|
128
|
+
export {
|
|
129
|
+
AppPickerImpl_default as default
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=AppPickerImpl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/AppPickerImpl.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\n/* eslint-disable react/no-array-index-key */\n/* eslint-disable max-lines */\nimport React, { useEffect, useCallback, useRef } from 'react';\nimport { getDataProps } from '@elliemae/ds-props-helpers';\nimport { chunk } from 'lodash';\nimport { keys } from './utils';\nimport { AppItemType, DSAppPickerImplType } from './types/AppPickerTypes';\nimport { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';\nimport {\n StyledWrapper,\n StyledChip,\n StyledChipLabel,\n StyledTitle,\n StyledGrid,\n StyledRow,\n StyledSeparator,\n} from './styles';\n\nconst AppPickerImpl: DSAppPickerImplType = ({\n apps = [],\n customApps = [],\n sectionTitle = 'APPLICATIONS',\n customSectionTitle = 'CUSTOM APPLICATIONS',\n close = () => null,\n wrapperRef,\n onKeyDown,\n triggerRef,\n isOverflow,\n}) => {\n const allFocusableButtons = useRef<HTMLButtonElement[]>([]);\n const selectedButton = useRef<number | null>(null);\n\n useEffect(() => {\n wrapperRef?.current?.querySelectorAll('button').forEach((e, index) => {\n if (!e.hasAttribute('disabled')) {\n allFocusableButtons?.current?.push(e);\n }\n if (e.getAttribute('aria-selected') === 'true') {\n selectedButton.current = index;\n }\n });\n\n if (selectedButton.current) {\n wrapperRef?.current?.querySelectorAll('button')[selectedButton.current].focus();\n } else {\n allFocusableButtons?.current[0]?.focus();\n }\n }, [wrapperRef]);\n\n // eslint-disable-next-line max-statements\n const handleKeyDown = (e: React.KeyboardEvent) => {\n switch (e.key) {\n case keys.ESC:\n triggerRef?.current?.focus();\n close();\n break;\n case keys.TAB:\n if (e.shiftKey) {\n if (e.target === allFocusableButtons.current[0]) {\n e.preventDefault();\n allFocusableButtons?.current[allFocusableButtons.current.length - 1]?.focus();\n }\n } else if (e.target === allFocusableButtons.current[allFocusableButtons.current.length - 1]) {\n e.preventDefault();\n allFocusableButtons?.current[0]?.focus();\n }\n break;\n default:\n break;\n }\n };\n\n const handleOnClick = useCallback((e, app) => {\n if (app.onClick) app.onClick(e, app);\n }, []);\n\n const handleOnKeyDownWrapper = useCallback(\n (e) => {\n if (onKeyDown) onKeyDown(e);\n if (!onKeyDown && e.key === keys.ESC) {\n close();\n }\n },\n [onKeyDown, close],\n );\n\n const buildRows = (appList: AppItemType[], prevIndex = 0): JSX.Element => {\n const rows = chunk(appList, 3); // divides array in subarrays of 3 items\n const formattedRows = rows.map((row, index) => (\n <StyledRow key={index}>\n {row.map((app, key) => {\n const { label, disabled, selected, icon: Icon, id, ...otherProps } = app;\n return (\n <StyledChip\n key={key}\n onClick={(e) => handleOnClick(e, app)}\n onKeyDown={handleKeyDown}\n data-testid=\"app-picker__chip\"\n aria-disabled={disabled}\n disabled={disabled}\n selected={selected}\n aria-selected={selected}\n aria-setsize={apps.length + customApps.length}\n aria-posinset={key + prevIndex}\n id={id}\n {...getDataProps(otherProps)}\n >\n <Icon className=\"app-picker__icon\" size=\"m\" />\n <StyledChipLabel>\n <SimpleTruncatedTooltipText value={label} placement=\"bottom\" />\n </StyledChipLabel>\n </StyledChip>\n );\n })}\n </StyledRow>\n ));\n return <>{formattedRows}</>;\n };\n\n const AppsRows = () => buildRows(apps, 1);\n const CustomRows = () => buildRows(customApps, apps.length);\n\n return (\n <StyledWrapper\n role=\"listbox\"\n ref={wrapperRef}\n onKeyDown={handleOnKeyDownWrapper}\n data-testid=\"app-picker__wrapper\"\n isOverflow={isOverflow}\n >\n <StyledTitle data-testid=\"app-picker__main-title\" aria-hidden>\n {sectionTitle}\n </StyledTitle>\n <StyledGrid data-testid=\"app-picker__main-grid\">\n <AppsRows />\n </StyledGrid>\n {!!customApps.length && (\n <>\n <StyledSeparator aria-hidden />\n <StyledTitle data-testid=\"app-picker__custom-title\" aria-hidden>\n {customSectionTitle}\n </StyledTitle>\n <StyledGrid data-testid=\"app-picker__custom-grid\">\n <CustomRows />\n </StyledGrid>\n </>\n )}\n </StyledWrapper>\n );\n};\n\nexport default AppPickerImpl;\n"],
|
|
5
|
+
"mappings": "AAAA;ACGA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,MAAM,gBAAqC,CAAC;AAAA,EAC1C,OAAO;AAAA,EACP,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,QAAQ,MAAM;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,MACI;AACJ,QAAM,sBAAsB,OAA4B;AACxD,QAAM,iBAAiB,OAAsB;AAE7C,YAAU,MAAM;AACd,gBAAY,SAAS,iBAAiB,UAAU,QAAQ,CAAC,GAAG,UAAU;AACpE,UAAI,CAAC,EAAE,aAAa,aAAa;AAC/B,6BAAqB,SAAS,KAAK;AAAA;AAErC,UAAI,EAAE,aAAa,qBAAqB,QAAQ;AAC9C,uBAAe,UAAU;AAAA;AAAA;AAI7B,QAAI,eAAe,SAAS;AAC1B,kBAAY,SAAS,iBAAiB,UAAU,eAAe,SAAS;AAAA,WACnE;AACL,2BAAqB,QAAQ,IAAI;AAAA;AAAA,KAElC,CAAC;AAGJ,QAAM,gBAAgB,CAAC,MAA2B;AAChD,YAAQ,EAAE;AAAA,WACH,KAAK;AACR,oBAAY,SAAS;AACrB;AACA;AAAA,WACG,KAAK;AACR,YAAI,EAAE,UAAU;AACd,cAAI,EAAE,WAAW,oBAAoB,QAAQ,IAAI;AAC/C,cAAE;AACF,iCAAqB,QAAQ,oBAAoB,QAAQ,SAAS,IAAI;AAAA;AAAA,mBAE/D,EAAE,WAAW,oBAAoB,QAAQ,oBAAoB,QAAQ,SAAS,IAAI;AAC3F,YAAE;AACF,+BAAqB,QAAQ,IAAI;AAAA;AAEnC;AAAA;AAEA;AAAA;AAAA;AAIN,Q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AAA,IAAY,eAAY;AAAA,KACtB,qCAAC,UAAD,QAED,CAAC,CAAC,WAAW,UACZ,4DACE,qCAAC,iBAAD;AAAA,IAAiB,eAAW;AAAA,MAC5B,qCAAC,aAAD;AAAA,IAAa,eAAY;AAAA,IAA2B,eAAW;AAAA,KAC5D,qBAEH,qCAAC,YAAD;AAAA,IAAY,eAAY;AAAA,KACtB,qCAAC,YAAD;AAAA;AAQZ,IAAO,wBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2, { useState, useEffect, useRef } from "react";
|
|
3
|
+
import { describe } from "react-desc";
|
|
4
|
+
import { MenuPicker } from "@elliemae/ds-icons";
|
|
5
|
+
import DSButton from "@elliemae/ds-button";
|
|
6
|
+
import DSPopover from "@elliemae/ds-popover";
|
|
7
|
+
import { mergeRefs } from "@elliemae/ds-utilities";
|
|
8
|
+
import AppPickerImpl from "./AppPickerImpl";
|
|
9
|
+
import { propTypes } from "./propTypes";
|
|
10
|
+
const DSAppPicker = ({
|
|
11
|
+
apps = [],
|
|
12
|
+
customApps = [],
|
|
13
|
+
sectionTitle = "APPLICATIONS",
|
|
14
|
+
customSectionTitle = "CUSTOM APPLICATIONS",
|
|
15
|
+
icon: Icon = () => /* @__PURE__ */ React2.createElement(MenuPicker, {
|
|
16
|
+
fill: ["brand-primary", 700],
|
|
17
|
+
size: "m"
|
|
18
|
+
}),
|
|
19
|
+
renderTrigger,
|
|
20
|
+
isOpen,
|
|
21
|
+
onClose = () => null,
|
|
22
|
+
actionRef,
|
|
23
|
+
onKeyDown,
|
|
24
|
+
onClick = () => null,
|
|
25
|
+
onClickOutside = () => null,
|
|
26
|
+
triggerRef
|
|
27
|
+
}) => {
|
|
28
|
+
const [open, setOpen] = useState(false);
|
|
29
|
+
const [isOverflow, setIsOverflow] = useState(false);
|
|
30
|
+
const wrapperRef = useRef(null);
|
|
31
|
+
const defaultTriggerRef = useRef(null);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (actionRef && actionRef.current) {
|
|
34
|
+
actionRef.current.focusToIndex = (index) => {
|
|
35
|
+
if (wrapperRef.current) {
|
|
36
|
+
const parent = wrapperRef.current;
|
|
37
|
+
const buttons = [...parent.querySelectorAll("button")];
|
|
38
|
+
buttons[index].focus();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}, [actionRef, apps, customApps]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
if (wrapperRef.current) {
|
|
46
|
+
const { scrollHeight, clientHeight } = wrapperRef.current;
|
|
47
|
+
if (scrollHeight > clientHeight)
|
|
48
|
+
return setIsOverflow(true);
|
|
49
|
+
}
|
|
50
|
+
return setIsOverflow(false);
|
|
51
|
+
});
|
|
52
|
+
}, [isOpen, open]);
|
|
53
|
+
const handleOnClose = () => {
|
|
54
|
+
if (typeof isOpen === "boolean") {
|
|
55
|
+
setOpen(isOpen);
|
|
56
|
+
} else {
|
|
57
|
+
setOpen(false);
|
|
58
|
+
}
|
|
59
|
+
onClose();
|
|
60
|
+
};
|
|
61
|
+
const handleOnClickOutside = (e) => {
|
|
62
|
+
setOpen(false);
|
|
63
|
+
onClose();
|
|
64
|
+
onClickOutside(e);
|
|
65
|
+
};
|
|
66
|
+
const AppPickerContent = () => /* @__PURE__ */ React2.createElement(AppPickerImpl, {
|
|
67
|
+
apps,
|
|
68
|
+
customApps,
|
|
69
|
+
sectionTitle,
|
|
70
|
+
customSectionTitle,
|
|
71
|
+
close: handleOnClose,
|
|
72
|
+
wrapperRef,
|
|
73
|
+
onKeyDown,
|
|
74
|
+
triggerRef: triggerRef || defaultTriggerRef,
|
|
75
|
+
isOverflow
|
|
76
|
+
});
|
|
77
|
+
const RenderTrigger = renderTrigger || (({ ref }) => /* @__PURE__ */ React2.createElement(DSButton, {
|
|
78
|
+
"data-testid": "app-picker__button",
|
|
79
|
+
id: "app-picker__button",
|
|
80
|
+
buttonType: "text",
|
|
81
|
+
icon: /* @__PURE__ */ React2.createElement(Icon, null),
|
|
82
|
+
innerRef: mergeRefs(ref, defaultTriggerRef),
|
|
83
|
+
onClick: (e) => {
|
|
84
|
+
onClick(e);
|
|
85
|
+
setOpen(true);
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
return /* @__PURE__ */ React2.createElement(DSPopover, {
|
|
89
|
+
content: /* @__PURE__ */ React2.createElement(AppPickerContent, null),
|
|
90
|
+
isOpen: typeof isOpen === "boolean" ? isOpen : open,
|
|
91
|
+
onClickOutside: handleOnClickOutside,
|
|
92
|
+
placement: "bottom",
|
|
93
|
+
interactionType: "click",
|
|
94
|
+
renderTrigger: RenderTrigger,
|
|
95
|
+
showArrow: true,
|
|
96
|
+
style: {
|
|
97
|
+
padding: "0",
|
|
98
|
+
maxWidth: "1000px",
|
|
99
|
+
width: "fit-content"
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
DSAppPicker.propTypes = propTypes;
|
|
104
|
+
const AppPickerWithSchema = describe(DSAppPicker);
|
|
105
|
+
AppPickerWithSchema.propTypes = propTypes;
|
|
106
|
+
var DSAppPicker_default = DSAppPicker;
|
|
107
|
+
export {
|
|
108
|
+
AppPickerWithSchema,
|
|
109
|
+
DSAppPicker,
|
|
110
|
+
DSAppPicker_default as default
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=DSAppPicker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSAppPicker.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useRef } from 'react';\nimport { describe } from 'react-desc';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport DSButton from '@elliemae/ds-button';\nimport DSPopover from '@elliemae/ds-popover';\nimport { mergeRefs } from '@elliemae/ds-utilities';\nimport AppPickerImpl from './AppPickerImpl';\nimport { propTypes } from './propTypes';\nimport type { DSAppPickerType } from './types/AppPickerTypes';\n\nconst DSAppPicker: DSAppPickerType = ({\n apps = [],\n customApps = [],\n sectionTitle = 'APPLICATIONS',\n customSectionTitle = 'CUSTOM APPLICATIONS',\n icon: Icon = () => <MenuPicker fill={['brand-primary', 700]} size=\"m\" />,\n renderTrigger,\n isOpen,\n onClose = () => null,\n actionRef,\n onKeyDown,\n onClick = () => null,\n onClickOutside = () => null,\n triggerRef,\n}) => {\n const [open, setOpen] = useState(false);\n const [isOverflow, setIsOverflow] = useState(false);\n const wrapperRef = useRef<HTMLUListElement>(null);\n const defaultTriggerRef = useRef(null);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToIndex = (index) => {\n if (wrapperRef.current) {\n const parent = wrapperRef.current;\n const buttons = [...parent.querySelectorAll('button')];\n buttons[index].focus();\n }\n };\n }\n }, [actionRef, apps, customApps]);\n\n useEffect(() => {\n setTimeout(() => {\n if (wrapperRef.current) {\n const { scrollHeight, clientHeight } = wrapperRef.current;\n if (scrollHeight > clientHeight) return setIsOverflow(true);\n }\n return setIsOverflow(false);\n });\n }, [isOpen, open]);\n\n const handleOnClose = () => {\n if (typeof isOpen === 'boolean') {\n setOpen(isOpen);\n } else {\n setOpen(false);\n }\n onClose();\n };\n\n const handleOnClickOutside = (e: MouseEvent) => {\n setOpen(false);\n onClose();\n onClickOutside(e);\n };\n\n const AppPickerContent = () => (\n <AppPickerImpl\n apps={apps}\n customApps={customApps}\n sectionTitle={sectionTitle}\n customSectionTitle={customSectionTitle}\n close={handleOnClose}\n wrapperRef={wrapperRef}\n onKeyDown={onKeyDown}\n triggerRef={triggerRef || defaultTriggerRef}\n isOverflow={isOverflow}\n />\n );\n\n const RenderTrigger =\n renderTrigger ||\n (({ ref }) => (\n <DSButton\n data-testid=\"app-picker__button\"\n id=\"app-picker__button\"\n buttonType=\"text\"\n icon={<Icon />}\n innerRef={mergeRefs(ref, defaultTriggerRef)}\n onClick={(e) => {\n onClick(e);\n setOpen(true);\n }}\n />\n ));\n\n return (\n <DSPopover\n content={<AppPickerContent />}\n isOpen={typeof isOpen === 'boolean' ? isOpen : open}\n onClickOutside={handleOnClickOutside}\n placement=\"bottom\"\n interactionType=\"click\"\n renderTrigger={RenderTrigger}\n showArrow\n style={{\n padding: '0',\n maxWidth: '1000px',\n width: 'fit-content',\n }}\n />\n );\n};\n\nDSAppPicker.propTypes = propTypes;\n\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = propTypes;\n\nexport { DSAppPicker, AppPickerWithSchema };\nexport default DSAppPicker;\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAM,cAA+B,CAAC;AAAA,EACpC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,MAAM,OAAO,MAAM,qCAAC,YAAD;AAAA,IAAY,MAAM,CAAC,iBAAiB;AAAA,IAAM,MAAK;AAAA;AAAA,EAClE;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAChB;AAAA,EACA;AAAA,EACA,UAAU,MAAM;AAAA,EAChB,iBAAiB,MAAM;AAAA,EACvB;AAAA,MACI;AACJ,QAAM,CAAC,MAAM,WAAW,SAAS;AACjC,QAAM,CAAC,YAAY,iBAAiB,SAAS;AAC7C,QAAM,aAAa,OAAyB;AAC5C,QAAM,oBAAoB,OAAO;AAEjC,YAAU,MAAM;AACd,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,eAAe,CAAC,UAAU;AAC1C,YAAI,WAAW,SAAS;AACtB,gBAAM,SAAS,WAAW;AAC1B,gBAAM,UAAU,CAAC,GAAG,OAAO,iBAAiB;AAC5C,kBAAQ,OAAO;AAAA;AAAA;AAAA;AAAA,KAIpB,CAAC,WAAW,MAAM;AAErB,Y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3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export * from './DSAppPicker';\n\nexport { default } from './DSAppPicker';\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AAEA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes } from "react-desc";
|
|
3
|
+
import { MenuPicker } from "@elliemae/ds-icons";
|
|
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({ current: PropTypes.any })]).description("Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker."),
|
|
12
|
+
isOpen: PropTypes.bool.description("Wether the AppPicker should be open or not."),
|
|
13
|
+
onClose: PropTypes.func.description("Callback function when the AppPicker closes"),
|
|
14
|
+
onKeyDown: PropTypes.func.description("OnKeyDown handler callback."),
|
|
15
|
+
onClick: PropTypes.func.description("Custom onClick for Trigger component."),
|
|
16
|
+
onClickOutside: PropTypes.func.description("Callback event when the user clicks outside the App Picker.")
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
propTypes
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=propTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/propTypes.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { PropTypes } from 'react-desc';\nimport { MenuPicker } from '@elliemae/ds-icons';\n\nexport const propTypes = {\n apps: PropTypes.array.description(\n 'Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]',\n ).isRequired,\n customApps: PropTypes.array.description(\n 'Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]',\n ),\n sectionTitle: PropTypes.string.description('main section title').defaultValue('APPLICATIONS'),\n customSectionTitle: PropTypes.string.description('custom section title').defaultValue('CUSTOM APPLICATIONS'),\n icon: PropTypes.func.description('trigger button s icon').defaultValue(MenuPicker),\n renderTrigger: PropTypes.func.description('Custom trigger component.'),\n actionRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker.',\n ),\n isOpen: PropTypes.bool.description('Wether the AppPicker should be open or not.'),\n onClose: PropTypes.func.description('Callback function when the AppPicker closes'),\n onKeyDown: PropTypes.func.description('OnKeyDown handler callback.'),\n onClick: PropTypes.func.description('Custom onClick for Trigger component.'),\n onClickOutside: PropTypes.func.description('Callback event when the user clicks outside the App Picker.'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAA;AACA;AAEO,MAAM,YAAY;AAAA,EACvB,MAAM,UAAU,MAAM,YACpB,sGACA;AAAA,EACF,YAAY,UAAU,MAAM,YAC1B;AAAA,EAEF,cAAc,UAAU,OAAO,YAAY,sBAAsB,aAAa;AAAA,EAC9E,oBAAoB,UAAU,OAAO,YAAY,wBAAwB,aAAa;AAAA,EACtF,MAAM,UAAU,KAAK,YAAY,yBAAyB,aAAa;AAAA,EACvE,eAAe,UAAU,KAAK,YAAY;AAAA,EAC1C,WAAW,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,SAAS,YAC5F;AAAA,EAEF,QAAQ,UAAU,KAAK,YAAY;AAAA,EACnC,SAAS,UAAU,KAAK,YAAY;AAAA,EACpC,WAAW,UAAU,KAAK,YAAY;AAAA,EACtC,SAAS,UAAU,KAAK,YAAY;AAAA,EACpC,gBAAgB,UAAU,KAAK,YAAY;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { styled, css } from "@elliemae/ds-system";
|
|
3
|
+
const StyledTitle = styled("h3", { name: "DS-AppPicker", slot: "title" })`
|
|
4
|
+
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
5
|
+
font-size: ${({ theme }) => theme.fontSizes.value[400]};
|
|
6
|
+
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
7
|
+
margin: 12px 0 0 0;
|
|
8
|
+
line-height: 1.38;
|
|
9
|
+
text-transform: uppercase;
|
|
10
|
+
`;
|
|
11
|
+
const StyledWrapper = styled("ul", { name: "DS-AppPicker", slot: "root" })`
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-width: 308px;
|
|
14
|
+
min-height: 110px;
|
|
15
|
+
max-height: 449px;
|
|
16
|
+
width: 308px;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
overflow-x: hidden;
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: ${({ isOverflow }) => isOverflow ? "0 0 0 16px" : "0 16px"};
|
|
21
|
+
&:focus {
|
|
22
|
+
outline: none;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const StyledGrid = styled("div", { name: "DS-AppPicker", slot: "grid" })`
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
align-items: center;
|
|
30
|
+
width: 100%;
|
|
31
|
+
margin: 8px 0;
|
|
32
|
+
`;
|
|
33
|
+
const StyledRow = styled("div", { name: "DS-AppPicker", slot: "row" })`
|
|
34
|
+
display: flex;
|
|
35
|
+
width: 100%;
|
|
36
|
+
`;
|
|
37
|
+
const StyledChipLabel = styled("p", { name: "DS-AppPicker", slot: "chipLabel" })`
|
|
38
|
+
font-size: ${({ theme }) => theme.fontSizes.label[200]};
|
|
39
|
+
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
40
|
+
word-wrap: break-word;
|
|
41
|
+
margin: 0 6px;
|
|
42
|
+
line-height: 1.45;
|
|
43
|
+
width: 100%;
|
|
44
|
+
z-index: 120;
|
|
45
|
+
|
|
46
|
+
& span {
|
|
47
|
+
padding-top: 6px;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
const styledChipSelectedCss = css`
|
|
51
|
+
color: ${({ theme }) => theme.colors.brand[800]};
|
|
52
|
+
background-color: ${({ theme }) => theme.colors.brand[200]};
|
|
53
|
+
|
|
54
|
+
.app-picker__icon {
|
|
55
|
+
fill: ${({ theme }) => theme.colors.brand[800]};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&:before {
|
|
59
|
+
border: 1px solid ${({ theme }) => theme.colors.brand[600]};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:focus {
|
|
63
|
+
&:before {
|
|
64
|
+
border: 2px solid ${({ theme }) => theme.colors.brand[800]};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
const StyledChip = styled("button", { name: "DS-AppPicker", slot: "chip" })`
|
|
69
|
+
position: relative;
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
border: none;
|
|
75
|
+
height: 68px;
|
|
76
|
+
width: 92px;
|
|
77
|
+
background-color: #fff;
|
|
78
|
+
color: ${({ theme }) => theme.colors.brand[600]};
|
|
79
|
+
cursor: pointer;
|
|
80
|
+
outline: none;
|
|
81
|
+
|
|
82
|
+
&:before {
|
|
83
|
+
content: '';
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 0;
|
|
86
|
+
left: 0;
|
|
87
|
+
width: 100%;
|
|
88
|
+
height: 100%;
|
|
89
|
+
border-radius: 2px;
|
|
90
|
+
border: 2px solid transparent;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
& .app-picker__icon {
|
|
94
|
+
fill: ${({ theme }) => theme.colors.brand[600]};
|
|
95
|
+
height: 28px;
|
|
96
|
+
width: 28px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
& .app-picker__icon svg {
|
|
100
|
+
height: 28px;
|
|
101
|
+
width: 28px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:hover {
|
|
105
|
+
color: ${({ theme }) => theme.colors.brand[800]};
|
|
106
|
+
background-color: ${({ theme }) => theme.colors.brand[200]};
|
|
107
|
+
.app-picker__icon {
|
|
108
|
+
fill: ${({ theme }) => theme.colors.brand[800]};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&:focus {
|
|
113
|
+
&:before {
|
|
114
|
+
border-color: ${({ theme }) => theme.colors.brand[800]};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:disabled {
|
|
119
|
+
color: ${({ theme }) => theme.colors.neutral[500]};
|
|
120
|
+
cursor: not-allowed;
|
|
121
|
+
|
|
122
|
+
.app-picker__icon {
|
|
123
|
+
fill: ${({ theme }) => theme.colors.neutral[500]};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
&:focus,
|
|
127
|
+
&:hover {
|
|
128
|
+
background-color: #fff;
|
|
129
|
+
cursor: not-allowed;
|
|
130
|
+
&:before {
|
|
131
|
+
border-color: transparent;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
${StyledChipLabel} {
|
|
135
|
+
color: ${({ theme }) => theme.colors.neutral[500]};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:hover .app-picker__icon {
|
|
140
|
+
fill: ${({ theme }) => theme.colors.neutral[500]};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
${({ selected }) => !selected ? "" : styledChipSelectedCss}
|
|
145
|
+
`;
|
|
146
|
+
const StyledSeparator = styled("hr", { name: "DS-AppPicker", slot: "separator" })`
|
|
147
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral[100]};
|
|
148
|
+
border-bottom: none;
|
|
149
|
+
width: 99%;
|
|
150
|
+
margin: 0;
|
|
151
|
+
`;
|
|
152
|
+
export {
|
|
153
|
+
StyledChip,
|
|
154
|
+
StyledChipLabel,
|
|
155
|
+
StyledGrid,
|
|
156
|
+
StyledRow,
|
|
157
|
+
StyledSeparator,
|
|
158
|
+
StyledTitle,
|
|
159
|
+
StyledWrapper
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable max-lines */\nimport { styled, css } from '@elliemae/ds-system';\n\nexport const StyledTitle = styled('h3', { name: 'DS-AppPicker', slot: 'title' })`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.value[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin: 12px 0 0 0;\n line-height: 1.38;\n text-transform: uppercase;\n`;\n\nexport const StyledWrapper = styled('ul', { name: 'DS-AppPicker', slot: 'root' })`\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: ${({ isOverflow }) => (isOverflow ? '0 0 0 16px' : '0 16px')};\n &:focus {\n outline: none;\n }\n`;\n\nexport const StyledGrid = styled('div', { name: 'DS-AppPicker', slot: 'grid' })`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n margin: 8px 0;\n`;\n\nexport const StyledRow = styled('div', { name: 'DS-AppPicker', slot: 'row' })`\n display: flex;\n width: 100%;\n`;\n\nexport const StyledChipLabel = styled('p', { name: 'DS-AppPicker', slot: 'chipLabel' })`\n font-size: ${({ theme }) => theme.fontSizes.label[200]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\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`;\n\nconst styledChipSelectedCss = css`\n color: ${({ theme }) => theme.colors.brand[800]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n\n .app-picker__icon {\n fill: ${({ theme }) => theme.colors.brand[800]};\n }\n\n &:before {\n border: 1px solid ${({ theme }) => theme.colors.brand[600]};\n }\n\n &:focus {\n &:before {\n border: 2px solid ${({ theme }) => theme.colors.brand[800]};\n }\n }\n`;\n\nexport const StyledChip = styled('button', { name: 'DS-AppPicker', slot: 'chip' })<{ selected: boolean | undefined }>`\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: ${({ theme }) => theme.colors.brand[600]};\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: ${({ theme }) => theme.colors.brand[600]};\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: ${({ theme }) => theme.colors.brand[800]};\n background-color: ${({ theme }) => theme.colors.brand[200]};\n .app-picker__icon {\n fill: ${({ theme }) => theme.colors.brand[800]};\n }\n }\n\n &:focus {\n &:before {\n border-color: ${({ theme }) => theme.colors.brand[800]};\n }\n }\n\n &:disabled {\n color: ${({ theme }) => theme.colors.neutral[500]};\n cursor: not-allowed;\n\n .app-picker__icon {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n\n &:focus,\n &:hover {\n background-color: #fff;\n cursor: not-allowed;\n &:before {\n border-color: transparent;\n }\n\n ${StyledChipLabel} {\n color: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n &:hover .app-picker__icon {\n fill: ${({ theme }) => theme.colors.neutral[500]};\n }\n }\n\n ${({ selected }) => (!selected ? '' : styledChipSelectedCss)}\n`;\n\nexport const StyledSeparator = styled('hr', { name: 'DS-AppPicker', slot: 'separator' })`\n border-top: 1px solid ${({ theme }) => theme.colors.neutral[100]};\n border-bottom: none;\n width: 99%;\n margin: 0;\n`;\n"],
|
|
5
|
+
"mappings": "AAAA;ACEA;AAEO,MAAM,cAAc,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM;AAAA,WAC3D,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA,eAChC,CAAC,EAAE,YAAY,MAAM,UAAU,MAAM;AAAA,iBACnC,CAAC,EAAE,YAAY,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAM3C,MAAM,gBAAgB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAS3D,CAAC,EAAE,iBAAkB,aAAa,eAAe;AAAA;AAAA;AAAA;AAAA;AAMvD,MAAM,aAAa,OAAO,OAAO,EAAE,MAAM,gBAAgB,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS/D,MAAM,YAAY,OAAO,OAAO,EAAE,MAAM,gBAAgB,MAAM;AAAA;AAAA;AAAA;AAK9D,MAAM,kBAAkB,OAAO,KAAK,EAAE,MAAM,gBAAgB,MAAM;AAAA,eAC1D,CAAC,EAAE,YAAY,MA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A;AAAA;AAAA;AAAA;AAAA;AAAA,QAW1C;AAAA,iBACS,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA,cAKvC,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA,IAI9C,CAAC,EAAE,eAAgB,CAAC,WAAW,KAAK;AAAA;AAGjC,MAAM,kBAAkB,OAAO,MAAM,EAAE,MAAM,gBAAgB,MAAM;AAAA,0BAChD,CAAC,EAAE,YAAY,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const keys = {
|
|
3
|
+
LEFT: "ArrowLeft",
|
|
4
|
+
UP: "ArrowUp",
|
|
5
|
+
RIGHT: "ArrowRight",
|
|
6
|
+
DOWN: "ArrowDown",
|
|
7
|
+
ENTER: "Enter",
|
|
8
|
+
SPACE: "",
|
|
9
|
+
TAB: "Tab",
|
|
10
|
+
ESC: "Escape",
|
|
11
|
+
HOME: "Home",
|
|
12
|
+
END: "End"
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
keys
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const keys = {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n ENTER: 'Enter',\n SPACE: '',\n TAB: 'Tab',\n ESC: 'Escape',\n HOME: 'Home',\n END: 'End',\n};\n"],
|
|
5
|
+
"mappings": "AAAA;ACAO,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
File without changes
|
|
File without changes
|