@elliemae/ds-app-picker 2.3.1 → 3.0.0-alpha.3

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.
Files changed (51) hide show
  1. package/dist/cjs/AppPickerImpl.js +177 -0
  2. package/dist/cjs/AppPickerImpl.js.map +7 -0
  3. package/dist/cjs/DSAppPicker.js +141 -0
  4. package/dist/cjs/DSAppPicker.js.map +7 -0
  5. package/dist/cjs/index.js +36 -0
  6. package/dist/cjs/index.js.map +7 -0
  7. package/dist/cjs/propTypes.js +50 -0
  8. package/dist/cjs/propTypes.js.map +7 -0
  9. package/dist/cjs/styles.js +190 -0
  10. package/dist/cjs/styles.js.map +7 -0
  11. package/dist/cjs/types/AppPickerTypes.js +27 -0
  12. package/dist/cjs/types/AppPickerTypes.js.map +7 -0
  13. package/dist/cjs/utils.js +46 -0
  14. package/dist/cjs/utils.js.map +7 -0
  15. package/dist/esm/AppPickerImpl.js +158 -0
  16. package/dist/esm/AppPickerImpl.js.map +7 -0
  17. package/dist/esm/DSAppPicker.js +112 -0
  18. package/dist/esm/DSAppPicker.js.map +7 -0
  19. package/dist/esm/index.js +7 -0
  20. package/dist/esm/index.js.map +7 -0
  21. package/dist/esm/propTypes.js +21 -0
  22. package/dist/esm/propTypes.js.map +7 -0
  23. package/dist/esm/styles.js +161 -0
  24. package/dist/esm/styles.js.map +7 -0
  25. package/dist/esm/types/AppPickerTypes.js +2 -0
  26. package/dist/esm/types/AppPickerTypes.js.map +7 -0
  27. package/dist/esm/utils.js +17 -0
  28. package/dist/esm/utils.js.map +7 -0
  29. package/package.json +44 -35
  30. package/cjs/AppPickerImpl.js +0 -182
  31. package/cjs/DSAppPicker.js +0 -138
  32. package/cjs/index.js +0 -11
  33. package/cjs/propTypes.js +0 -25
  34. package/cjs/styles.js +0 -164
  35. package/cjs/types/AppPickerTypes.js +0 -2
  36. package/cjs/utils.js +0 -18
  37. package/esm/AppPickerImpl.js +0 -174
  38. package/esm/DSAppPicker.js +0 -126
  39. package/esm/index.js +0 -1
  40. package/esm/propTypes.js +0 -21
  41. package/esm/styles.js +0 -150
  42. package/esm/types/AppPickerTypes.js +0 -1
  43. package/esm/utils.js +0 -14
  44. package/types/AppPickerImpl.d.ts +0 -3
  45. package/types/DSAppPicker.d.ts +0 -11
  46. package/types/index.d.ts +0 -2
  47. package/types/propTypes.d.ts +0 -61
  48. package/types/styles.d.ts +0 -7
  49. package/types/tests/AppPicker.test.d.ts +0 -1
  50. package/types/types/AppPickerTypes.d.ts +0 -41
  51. package/types/utils.d.ts +0 -12
@@ -0,0 +1,177 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __reExport = (target, module2, copyDefault, desc) => {
39
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
40
+ for (let key of __getOwnPropNames(module2))
41
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
42
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
43
+ }
44
+ return target;
45
+ };
46
+ var __toESM = (module2, isNodeMode) => {
47
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
48
+ };
49
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
50
+ return (module2, temp) => {
51
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
52
+ };
53
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
54
+ var AppPickerImpl_exports = {};
55
+ __export(AppPickerImpl_exports, {
56
+ default: () => AppPickerImpl_default
57
+ });
58
+ var React = __toESM(require("react"));
59
+ var import_react = __toESM(require("react"));
60
+ var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
61
+ var import_lodash = require("lodash");
62
+ var import_utils = require("./utils");
63
+ var import_ds_truncated_tooltip_text = require("@elliemae/ds-truncated-tooltip-text");
64
+ var import_styles = require("./styles");
65
+ const AppPickerImpl = ({
66
+ apps = [],
67
+ customApps = [],
68
+ sectionTitle = "APPLICATIONS",
69
+ customSectionTitle = "CUSTOM APPLICATIONS",
70
+ close = () => null,
71
+ wrapperRef,
72
+ onKeyDown,
73
+ triggerRef,
74
+ isOverflow
75
+ }) => {
76
+ const allFocusableButtons = (0, import_react.useRef)([]);
77
+ const selectedButton = (0, import_react.useRef)(null);
78
+ (0, import_react.useEffect)(() => {
79
+ wrapperRef?.current?.querySelectorAll("button").forEach((e, index) => {
80
+ if (!e.hasAttribute("disabled")) {
81
+ allFocusableButtons?.current?.push(e);
82
+ }
83
+ if (e.getAttribute("aria-selected") === "true") {
84
+ selectedButton.current = index;
85
+ }
86
+ });
87
+ if (selectedButton.current) {
88
+ wrapperRef?.current?.querySelectorAll("button")[selectedButton.current].focus();
89
+ } else {
90
+ allFocusableButtons?.current[0]?.focus();
91
+ }
92
+ }, [wrapperRef]);
93
+ const handleKeyDown = (e) => {
94
+ switch (e.key) {
95
+ case import_utils.keys.ESC:
96
+ triggerRef?.current?.focus();
97
+ close();
98
+ break;
99
+ case import_utils.keys.TAB:
100
+ if (e.shiftKey) {
101
+ if (e.target === allFocusableButtons.current[0]) {
102
+ e.preventDefault();
103
+ allFocusableButtons?.current[allFocusableButtons.current.length - 1]?.focus();
104
+ }
105
+ } else if (e.target === allFocusableButtons.current[allFocusableButtons.current.length - 1]) {
106
+ e.preventDefault();
107
+ allFocusableButtons?.current[0]?.focus();
108
+ }
109
+ break;
110
+ default:
111
+ break;
112
+ }
113
+ };
114
+ const handleOnClick = (0, import_react.useCallback)((e, app) => {
115
+ if (app.onClick)
116
+ app.onClick(e, app);
117
+ }, []);
118
+ const handleOnKeyDownWrapper = (0, import_react.useCallback)((e) => {
119
+ if (onKeyDown)
120
+ onKeyDown(e);
121
+ if (!onKeyDown && e.key === import_utils.keys.ESC) {
122
+ close();
123
+ }
124
+ }, [onKeyDown, close]);
125
+ const buildRows = (appList, prevIndex = 0) => {
126
+ const rows = (0, import_lodash.chunk)(appList, 3);
127
+ const formattedRows = rows.map((row, index) => /* @__PURE__ */ import_react.default.createElement(import_styles.StyledRow, {
128
+ key: index
129
+ }, row.map((app, key) => {
130
+ const _a = app, { label, disabled, selected, icon: Icon, id } = _a, otherProps = __objRest(_a, ["label", "disabled", "selected", "icon", "id"]);
131
+ return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChip, __spreadValues({
132
+ key,
133
+ onClick: (e) => handleOnClick(e, app),
134
+ onKeyDown: handleKeyDown,
135
+ "data-testid": "app-picker__chip",
136
+ "aria-disabled": disabled,
137
+ disabled,
138
+ selected,
139
+ "aria-selected": selected,
140
+ "aria-setsize": apps.length + customApps.length,
141
+ "aria-posinset": key + prevIndex,
142
+ id
143
+ }, (0, import_ds_props_helpers.getDataProps)(otherProps)), /* @__PURE__ */ import_react.default.createElement(Icon, {
144
+ className: "app-picker__icon",
145
+ size: "m"
146
+ }), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledChipLabel, null, /* @__PURE__ */ import_react.default.createElement(import_ds_truncated_tooltip_text.SimpleTruncatedTooltipText, {
147
+ value: label,
148
+ placement: "bottom"
149
+ })));
150
+ })));
151
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, formattedRows);
152
+ };
153
+ const AppsRows = () => buildRows(apps, 1);
154
+ const CustomRows = () => buildRows(customApps, apps.length);
155
+ return /* @__PURE__ */ import_react.default.createElement(import_styles.StyledWrapper, {
156
+ role: "listbox",
157
+ ref: wrapperRef,
158
+ onKeyDown: handleOnKeyDownWrapper,
159
+ "data-testid": "app-picker__wrapper",
160
+ isOverflow
161
+ }, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledTitle, {
162
+ "data-testid": "app-picker__main-title",
163
+ "aria-hidden": true
164
+ }, sectionTitle), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledGrid, {
165
+ "data-testid": "app-picker__main-grid"
166
+ }, /* @__PURE__ */ import_react.default.createElement(AppsRows, null)), !!customApps.length && /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(import_styles.StyledSeparator, {
167
+ "aria-hidden": true
168
+ }), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledTitle, {
169
+ "data-testid": "app-picker__custom-title",
170
+ "aria-hidden": true
171
+ }, customSectionTitle), /* @__PURE__ */ import_react.default.createElement(import_styles.StyledGrid, {
172
+ "data-testid": "app-picker__custom-grid"
173
+ }, /* @__PURE__ */ import_react.default.createElement(CustomRows, null))));
174
+ };
175
+ var AppPickerImpl_default = AppPickerImpl;
176
+ module.exports = __toCommonJS(AppPickerImpl_exports);
177
+ //# sourceMappingURL=AppPickerImpl.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/AppPickerImpl.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* 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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,141 @@
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 DSAppPicker_exports = {};
29
+ __export(DSAppPicker_exports, {
30
+ AppPickerWithSchema: () => AppPickerWithSchema,
31
+ DSAppPicker: () => DSAppPicker,
32
+ default: () => DSAppPicker_default
33
+ });
34
+ var React = __toESM(require("react"));
35
+ var import_react = __toESM(require("react"));
36
+ var import_react_desc = require("react-desc");
37
+ var import_ds_icons = require("@elliemae/ds-icons");
38
+ var import_ds_button = __toESM(require("@elliemae/ds-button"));
39
+ var import_ds_popover = __toESM(require("@elliemae/ds-popover"));
40
+ var import_ds_utilities = require("@elliemae/ds-utilities");
41
+ var import_AppPickerImpl = __toESM(require("./AppPickerImpl"));
42
+ var import_propTypes = require("./propTypes");
43
+ const DSAppPicker = ({
44
+ apps = [],
45
+ customApps = [],
46
+ sectionTitle = "APPLICATIONS",
47
+ customSectionTitle = "CUSTOM APPLICATIONS",
48
+ icon: Icon = () => /* @__PURE__ */ import_react.default.createElement(import_ds_icons.MenuPicker, {
49
+ fill: ["brand-primary", 700],
50
+ size: "m"
51
+ }),
52
+ renderTrigger,
53
+ isOpen,
54
+ onClose = () => null,
55
+ actionRef,
56
+ onKeyDown,
57
+ onClick = () => null,
58
+ onClickOutside = () => null,
59
+ triggerRef
60
+ }) => {
61
+ const [open, setOpen] = (0, import_react.useState)(false);
62
+ const [isOverflow, setIsOverflow] = (0, import_react.useState)(false);
63
+ const wrapperRef = (0, import_react.useRef)(null);
64
+ const defaultTriggerRef = (0, import_react.useRef)(null);
65
+ (0, import_react.useEffect)(() => {
66
+ if (actionRef && actionRef.current) {
67
+ actionRef.current.focusToIndex = (index) => {
68
+ if (wrapperRef.current) {
69
+ const parent = wrapperRef.current;
70
+ const buttons = [...parent.querySelectorAll("button")];
71
+ buttons[index].focus();
72
+ }
73
+ };
74
+ }
75
+ }, [actionRef, apps, customApps]);
76
+ (0, import_react.useEffect)(() => {
77
+ setTimeout(() => {
78
+ if (wrapperRef.current) {
79
+ const { scrollHeight, clientHeight } = wrapperRef.current;
80
+ if (scrollHeight > clientHeight)
81
+ return setIsOverflow(true);
82
+ }
83
+ return setIsOverflow(false);
84
+ });
85
+ }, [isOpen, open]);
86
+ const handleOnClose = () => {
87
+ if (typeof isOpen === "boolean") {
88
+ setOpen(isOpen);
89
+ } else {
90
+ setOpen(false);
91
+ }
92
+ onClose();
93
+ };
94
+ const handleOnClickOutside = (e) => {
95
+ setOpen(false);
96
+ onClose();
97
+ onClickOutside(e);
98
+ };
99
+ const AppPickerContent = () => /* @__PURE__ */ import_react.default.createElement(import_AppPickerImpl.default, {
100
+ apps,
101
+ customApps,
102
+ sectionTitle,
103
+ customSectionTitle,
104
+ close: handleOnClose,
105
+ wrapperRef,
106
+ onKeyDown,
107
+ triggerRef: triggerRef || defaultTriggerRef,
108
+ isOverflow
109
+ });
110
+ const RenderTrigger = renderTrigger || (({ ref }) => /* @__PURE__ */ import_react.default.createElement(import_ds_button.default, {
111
+ "data-testid": "app-picker__button",
112
+ id: "app-picker__button",
113
+ buttonType: "text",
114
+ icon: /* @__PURE__ */ import_react.default.createElement(Icon, null),
115
+ innerRef: (0, import_ds_utilities.mergeRefs)(ref, defaultTriggerRef),
116
+ onClick: (e) => {
117
+ onClick(e);
118
+ setOpen(true);
119
+ }
120
+ }));
121
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_popover.default, {
122
+ content: /* @__PURE__ */ import_react.default.createElement(AppPickerContent, null),
123
+ isOpen: typeof isOpen === "boolean" ? isOpen : open,
124
+ onClickOutside: handleOnClickOutside,
125
+ placement: "bottom",
126
+ interactionType: "click",
127
+ renderTrigger: RenderTrigger,
128
+ showArrow: true,
129
+ style: {
130
+ padding: "0",
131
+ maxWidth: "1000px",
132
+ width: "fit-content"
133
+ }
134
+ });
135
+ };
136
+ DSAppPicker.propTypes = import_propTypes.propTypes;
137
+ const AppPickerWithSchema = (0, import_react_desc.describe)(DSAppPicker);
138
+ AppPickerWithSchema.propTypes = import_propTypes.propTypes;
139
+ var DSAppPicker_default = DSAppPicker;
140
+ module.exports = __toCommonJS(DSAppPicker_exports);
141
+ //# sourceMappingURL=DSAppPicker.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSAppPicker.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAmD;AACnD,wBAAyB;AACzB,sBAA2B;AAC3B,uBAAqB;AACrB,wBAAsB;AACtB,0BAA0B;AAC1B,2BAA0B;AAC1B,uBAA0B;AAG1B,MAAM,cAA+B,CAAC;AAAA,EACpC,OAAO;AAAA,EACP,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,MAAM,OAAO,MAAM,mDAAC,4BAAD;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,2BAAS;AACjC,QAAM,CAAC,YAAY,iBAAiB,2BAAS;AAC7C,QAAM,aAAa,yBAAyB;AAC5C,QAAM,oBAAoB,yBAAO;AAEjC,8BAAU,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,8BAAU,MAAM;AACd,eAAW,MAAM;AACf,UAAI,WAAW,SAAS;AACtB,cAAM,EAAE,cAAc,iBAAiB,WAAW;AAClD,YAAI,eAAe;AAAc,iBAAO,cAAc;AAAA;AAExD,aAAO,cAAc;AAAA;AAAA,KAEtB,CAAC,QAAQ;AAEZ,QAAM,gBAAgB,MAAM;AAC1B,QAAI,OAAO,WAAW,WAAW;AAC/B,cAAQ;AAAA,WACH;AACL,cAAQ;AAAA;AAEV;AAAA;AAGF,QAAM,uBAAuB,CAAC,MAAkB;AAC9C,YAAQ;AACR;AACA,mBAAe;AAAA;AAGjB,QAAM,mBAAmB,MACvB,mDAAC,8BAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,YAAY,cAAc;AAAA,IAC1B;AAAA;AAIJ,QAAM,gBACJ,iBACC,EAAC,EAAE,UACF,mDAAC,0BAAD;AAAA,IACE,eAAY;AAAA,IACZ,IAAG;AAAA,IACH,YAAW;AAAA,IACX,MAAM,mDAAC,MAAD;AAAA,IACN,UAAU,mCAAU,KAAK;AAAA,IACzB,SAAS,CAAC,MAAM;AACd,cAAQ;AACR,cAAQ;AAAA;AAAA;AAKhB,SACE,mDAAC,2BAAD;AAAA,IACE,SAAS,mDAAC,kBAAD;AAAA,IACT,QAAQ,OAAO,WAAW,YAAY,SAAS;AAAA,IAC/C,gBAAgB;AAAA,IAChB,WAAU;AAAA,IACV,iBAAgB;AAAA,IAChB,eAAe;AAAA,IACf,WAAS;AAAA,IACT,OAAO;AAAA,MACL,SAAS;AAAA,MACT,UAAU;AAAA,MACV,OAAO;AAAA;AAAA;AAAA;AAMf,YAAY,YAAY;AAExB,MAAM,sBAAsB,gCAAS;AACrC,oBAAoB,YAAY;AAGhC,IAAO,sBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,36 @@
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 src_exports = {};
29
+ __export(src_exports, {
30
+ default: () => import_DSAppPicker.default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ __reExport(src_exports, require("./DSAppPicker"));
34
+ var import_DSAppPicker = __toESM(require("./DSAppPicker"));
35
+ module.exports = __toCommonJS(src_exports);
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export * from './DSAppPicker';\n\nexport { default } from './DSAppPicker';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAAc;AAEd,yBAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,50 @@
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 propTypes_exports = {};
29
+ __export(propTypes_exports, {
30
+ propTypes: () => propTypes
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_react_desc = require("react-desc");
34
+ var import_ds_icons = require("@elliemae/ds-icons");
35
+ const propTypes = {
36
+ apps: import_react_desc.PropTypes.array.description("Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]").isRequired,
37
+ customApps: import_react_desc.PropTypes.array.description("Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"),
38
+ sectionTitle: import_react_desc.PropTypes.string.description("main section title").defaultValue("APPLICATIONS"),
39
+ customSectionTitle: import_react_desc.PropTypes.string.description("custom section title").defaultValue("CUSTOM APPLICATIONS"),
40
+ icon: import_react_desc.PropTypes.func.description("trigger button s icon").defaultValue(import_ds_icons.MenuPicker),
41
+ renderTrigger: import_react_desc.PropTypes.func.description("Custom trigger component."),
42
+ actionRef: import_react_desc.PropTypes.oneOfType([import_react_desc.PropTypes.func, import_react_desc.PropTypes.shape({ current: import_react_desc.PropTypes.any })]).description("Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker."),
43
+ isOpen: import_react_desc.PropTypes.bool.description("Wether the AppPicker should be open or not."),
44
+ onClose: import_react_desc.PropTypes.func.description("Callback function when the AppPicker closes"),
45
+ onKeyDown: import_react_desc.PropTypes.func.description("OnKeyDown handler callback."),
46
+ onClick: import_react_desc.PropTypes.func.description("Custom onClick for Trigger component."),
47
+ onClickOutside: import_react_desc.PropTypes.func.description("Callback event when the user clicks outside the App Picker.")
48
+ };
49
+ module.exports = __toCommonJS(propTypes_exports);
50
+ //# sourceMappingURL=propTypes.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/propTypes.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["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", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,wBAA0B;AAC1B,sBAA2B;AAEpB,MAAM,YAAY;AAAA,EACvB,MAAM,4BAAU,MAAM,YACpB,sGACA;AAAA,EACF,YAAY,4BAAU,MAAM,YAC1B;AAAA,EAEF,cAAc,4BAAU,OAAO,YAAY,sBAAsB,aAAa;AAAA,EAC9E,oBAAoB,4BAAU,OAAO,YAAY,wBAAwB,aAAa;AAAA,EACtF,MAAM,4BAAU,KAAK,YAAY,yBAAyB,aAAa;AAAA,EACvE,eAAe,4BAAU,KAAK,YAAY;AAAA,EAC1C,WAAW,4BAAU,UAAU,CAAC,4BAAU,MAAM,4BAAU,MAAM,EAAE,SAAS,4BAAU,SAAS,YAC5F;AAAA,EAEF,QAAQ,4BAAU,KAAK,YAAY;AAAA,EACnC,SAAS,4BAAU,KAAK,YAAY;AAAA,EACpC,WAAW,4BAAU,KAAK,YAAY;AAAA,EACtC,SAAS,4BAAU,KAAK,YAAY;AAAA,EACpC,gBAAgB,4BAAU,KAAK,YAAY;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,190 @@
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 styles_exports = {};
29
+ __export(styles_exports, {
30
+ StyledChip: () => StyledChip,
31
+ StyledChipLabel: () => StyledChipLabel,
32
+ StyledGrid: () => StyledGrid,
33
+ StyledRow: () => StyledRow,
34
+ StyledSeparator: () => StyledSeparator,
35
+ StyledTitle: () => StyledTitle,
36
+ StyledWrapper: () => StyledWrapper
37
+ });
38
+ var React = __toESM(require("react"));
39
+ var import_ds_system = require("@elliemae/ds-system");
40
+ const StyledTitle = (0, import_ds_system.styled)("h3", { name: "DS-AppPicker", slot: "title" })`
41
+ color: ${({ theme }) => theme.colors.neutral[700]};
42
+ font-size: ${({ theme }) => theme.fontSizes.value[400]};
43
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
44
+ margin: 12px 0 0 0;
45
+ line-height: 1.38;
46
+ text-transform: uppercase;
47
+ `;
48
+ const StyledWrapper = (0, import_ds_system.styled)("ul", { name: "DS-AppPicker", slot: "root" })`
49
+ align-items: center;
50
+ min-width: 308px;
51
+ min-height: 110px;
52
+ max-height: 449px;
53
+ width: 308px;
54
+ overflow-y: auto;
55
+ overflow-x: hidden;
56
+ margin: 0;
57
+ padding: ${({ isOverflow }) => isOverflow ? "0 0 0 16px" : "0 16px"};
58
+ &:focus {
59
+ outline: none;
60
+ }
61
+ `;
62
+ const StyledGrid = (0, import_ds_system.styled)("div", { name: "DS-AppPicker", slot: "grid" })`
63
+ display: flex;
64
+ flex-direction: column;
65
+ justify-content: center;
66
+ align-items: center;
67
+ width: 100%;
68
+ margin: 8px 0;
69
+ `;
70
+ const StyledRow = (0, import_ds_system.styled)("div", { name: "DS-AppPicker", slot: "row" })`
71
+ display: flex;
72
+ width: 100%;
73
+ `;
74
+ const StyledChipLabel = (0, import_ds_system.styled)("p", { name: "DS-AppPicker", slot: "chipLabel" })`
75
+ font-size: ${({ theme }) => theme.fontSizes.label[200]};
76
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
77
+ word-wrap: break-word;
78
+ margin: 0 6px;
79
+ line-height: 1.45;
80
+ width: 100%;
81
+ z-index: 120;
82
+
83
+ & span {
84
+ padding-top: 6px;
85
+ }
86
+ `;
87
+ const styledChipSelectedCss = import_ds_system.css`
88
+ color: ${({ theme }) => theme.colors.brand[800]};
89
+ background-color: ${({ theme }) => theme.colors.brand[200]};
90
+
91
+ .app-picker__icon {
92
+ fill: ${({ theme }) => theme.colors.brand[800]};
93
+ }
94
+
95
+ &:before {
96
+ border: 1px solid ${({ theme }) => theme.colors.brand[600]};
97
+ }
98
+
99
+ &:focus {
100
+ &:before {
101
+ border: 2px solid ${({ theme }) => theme.colors.brand[800]};
102
+ }
103
+ }
104
+ `;
105
+ const StyledChip = (0, import_ds_system.styled)("button", { name: "DS-AppPicker", slot: "chip" })`
106
+ position: relative;
107
+ display: flex;
108
+ flex-direction: column;
109
+ align-items: center;
110
+ justify-content: center;
111
+ border: none;
112
+ height: 68px;
113
+ width: 92px;
114
+ background-color: #fff;
115
+ color: ${({ theme }) => theme.colors.brand[600]};
116
+ cursor: pointer;
117
+ outline: none;
118
+
119
+ &:before {
120
+ content: '';
121
+ position: absolute;
122
+ top: 0;
123
+ left: 0;
124
+ width: 100%;
125
+ height: 100%;
126
+ border-radius: 2px;
127
+ border: 2px solid transparent;
128
+ }
129
+
130
+ & .app-picker__icon {
131
+ fill: ${({ theme }) => theme.colors.brand[600]};
132
+ height: 28px;
133
+ width: 28px;
134
+ }
135
+
136
+ & .app-picker__icon svg {
137
+ height: 28px;
138
+ width: 28px;
139
+ }
140
+
141
+ &:hover {
142
+ color: ${({ theme }) => theme.colors.brand[800]};
143
+ background-color: ${({ theme }) => theme.colors.brand[200]};
144
+ .app-picker__icon {
145
+ fill: ${({ theme }) => theme.colors.brand[800]};
146
+ }
147
+ }
148
+
149
+ &:focus {
150
+ &:before {
151
+ border-color: ${({ theme }) => theme.colors.brand[800]};
152
+ }
153
+ }
154
+
155
+ &:disabled {
156
+ color: ${({ theme }) => theme.colors.neutral[500]};
157
+ cursor: not-allowed;
158
+
159
+ .app-picker__icon {
160
+ fill: ${({ theme }) => theme.colors.neutral[500]};
161
+ }
162
+
163
+ &:focus,
164
+ &:hover {
165
+ background-color: #fff;
166
+ cursor: not-allowed;
167
+ &:before {
168
+ border-color: transparent;
169
+ }
170
+
171
+ ${StyledChipLabel} {
172
+ color: ${({ theme }) => theme.colors.neutral[500]};
173
+ }
174
+ }
175
+
176
+ &:hover .app-picker__icon {
177
+ fill: ${({ theme }) => theme.colors.neutral[500]};
178
+ }
179
+ }
180
+
181
+ ${({ selected }) => !selected ? "" : styledChipSelectedCss}
182
+ `;
183
+ const StyledSeparator = (0, import_ds_system.styled)("hr", { name: "DS-AppPicker", slot: "separator" })`
184
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral[100]};
185
+ border-bottom: none;
186
+ width: 99%;
187
+ margin: 0;
188
+ `;
189
+ module.exports = __toCommonJS(styles_exports);
190
+ //# sourceMappingURL=styles.js.map