@elliemae/ds-app-picker 3.49.0-rc.9 → 3.49.0
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 +43 -21
- package/dist/cjs/AppPickerImpl.js.map +2 -2
- package/dist/cjs/DSAppPicker.js +9 -3
- package/dist/cjs/DSAppPicker.js.map +2 -2
- package/dist/cjs/DSAppPickerDefinitions.js +5 -8
- package/dist/cjs/DSAppPickerDefinitions.js.map +2 -2
- package/dist/cjs/config/useAppPicker.js +51 -0
- package/dist/cjs/config/useAppPicker.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +3 -0
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/esm/AppPickerImpl.js +43 -21
- package/dist/esm/AppPickerImpl.js.map +2 -2
- package/dist/esm/DSAppPicker.js +12 -6
- package/dist/esm/DSAppPicker.js.map +2 -2
- package/dist/esm/DSAppPickerDefinitions.js +5 -8
- package/dist/esm/DSAppPickerDefinitions.js.map +2 -2
- package/dist/esm/config/useAppPicker.js +25 -0
- package/dist/esm/config/useAppPicker.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +4 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/types/DSAppPickerDefinitions.d.ts +7 -7
- package/dist/types/config/useAppPicker.d.ts +8 -0
- package/dist/types/react-desc-prop-types.d.ts +4 -2
- package/package.json +15 -12
|
@@ -40,20 +40,23 @@ var import_utils = require("./utils.js");
|
|
|
40
40
|
var import_styles = require("./styles.js");
|
|
41
41
|
var import_useKeepTrackButtons = require("./hooks/useKeepTrackButtons.js");
|
|
42
42
|
var import_DSAppPickerDefinitions = require("./DSAppPickerDefinitions.js");
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
var import_useAppPicker = require("./config/useAppPicker.js");
|
|
44
|
+
const AppPickerImpl = (props) => {
|
|
45
|
+
const {
|
|
46
|
+
apps,
|
|
47
|
+
customApps,
|
|
48
|
+
sectionTitle,
|
|
49
|
+
customSectionTitle,
|
|
50
|
+
close,
|
|
51
|
+
wrapperRef,
|
|
52
|
+
onKeyDown,
|
|
53
|
+
triggerRef,
|
|
54
|
+
isOverflow,
|
|
55
|
+
actionRef,
|
|
56
|
+
wasOpenedByKeyboardRef,
|
|
57
|
+
triggerIsInternal
|
|
58
|
+
} = props;
|
|
59
|
+
const { ownerPropsConfig } = (0, import_useAppPicker.useAppPicker)(props);
|
|
57
60
|
const { allFocusableButtons } = (0, import_useKeepTrackButtons.useKeepTrackButtons)({
|
|
58
61
|
wrapperRef,
|
|
59
62
|
wasOpenedByKeyboardRef,
|
|
@@ -91,11 +94,11 @@ const AppPickerImpl = ({
|
|
|
91
94
|
(appList, prevIndex, title) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: appList.map((app, index) => {
|
|
92
95
|
const { label, disabled, applyAriaDisabled, selected, icon: Icon, id } = app;
|
|
93
96
|
const IconComp = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "app-picker__icon", size: "m" });
|
|
94
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledListItem, { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
97
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledListItem, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.ITEM, role: "presentation", ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
98
|
import_ds_chip.DSChip,
|
|
96
99
|
{
|
|
97
100
|
onClick: handleOnClick(app),
|
|
98
|
-
"data-testid":
|
|
101
|
+
"data-testid": "app-picker__chip",
|
|
99
102
|
disabled,
|
|
100
103
|
applyAriaDisabled,
|
|
101
104
|
selected,
|
|
@@ -109,7 +112,7 @@ const AppPickerImpl = ({
|
|
|
109
112
|
index
|
|
110
113
|
) });
|
|
111
114
|
}) }),
|
|
112
|
-
[handleOnClick, totalAppsLength]
|
|
115
|
+
[handleOnClick, totalAppsLength, ownerPropsConfig]
|
|
113
116
|
);
|
|
114
117
|
const AppsRows = (0, import_react.useMemo)(() => buildRows(apps, 1, sectionTitle), [apps, buildRows, sectionTitle]);
|
|
115
118
|
const CustomRows = (0, import_react.useMemo)(
|
|
@@ -142,18 +145,37 @@ const AppPickerImpl = ({
|
|
|
142
145
|
role: "listbox",
|
|
143
146
|
innerRef: convertedTypeReference,
|
|
144
147
|
onKeyDown: handleOnKeyDown,
|
|
145
|
-
"data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.
|
|
148
|
+
"data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.ROOT,
|
|
146
149
|
isOverflow,
|
|
147
150
|
cols: layout.cols,
|
|
148
151
|
rows: layout.rows,
|
|
149
152
|
tabIndex: -1,
|
|
150
153
|
"aria-label": `Application picker, ${sectionTitle} (${apps.length} apps)${customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ""}`,
|
|
154
|
+
...ownerPropsConfig,
|
|
151
155
|
children: [
|
|
152
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledListItemFullRow, { "aria-hidden": true, role: "group", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledListItemFullRow, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.ROW, "aria-hidden": true, role: "group", ...ownerPropsConfig, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.TITLE, role: "presentation", ...ownerPropsConfig, children: sectionTitle }) }),
|
|
153
157
|
AppsRows,
|
|
154
158
|
customApps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
155
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
-
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
160
|
+
import_styles.StyledListItemFullRow,
|
|
161
|
+
{
|
|
162
|
+
"data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.ROW,
|
|
163
|
+
"aria-hidden": true,
|
|
164
|
+
role: "group",
|
|
165
|
+
...ownerPropsConfig,
|
|
166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledSeparator, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.SEPARATOR, role: "presentation", ...ownerPropsConfig })
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
|
+
import_styles.StyledListItemFullRow,
|
|
171
|
+
{
|
|
172
|
+
"data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.ROW,
|
|
173
|
+
"aria-hidden": true,
|
|
174
|
+
role: "group",
|
|
175
|
+
...ownerPropsConfig,
|
|
176
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.StyledTitle, { "data-testid": import_DSAppPickerDefinitions.DSAppPickerDataTestIds.TITLE, role: "presentation", ...ownerPropsConfig, children: customSectionTitle })
|
|
177
|
+
}
|
|
178
|
+
),
|
|
157
179
|
CustomRows
|
|
158
180
|
] })
|
|
159
181
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/AppPickerImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/no-array-index-key */\nimport React, { useCallback, useRef, useMemo } from 'react';\nimport { DSChip } from '@elliemae/ds-chip';\nimport { useFocusTrap } from '@elliemae/ds-hooks-focus-trap';\nimport { keys } from './utils.js';\nimport { StyledWrapper, StyledSeparator, StyledListItemFullRow, StyledListItem, StyledTitle } from './styles.js';\nimport { useKeepTrackButtons } from './hooks/useKeepTrackButtons.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';\n\ninterface AppPickerImplProps\n extends Omit<\n DSAppPickerT.InternalProps,\n 'onClose' | 'icon' | 'onClick' | 'onClickOutside' | 'renderTrigger' | 'isOpen'\n > {\n close: () => void;\n wrapperRef: React.RefObject<HTMLDivElement>;\n isOverflow: boolean;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n triggerIsInternal: boolean;\n}\n\nconst AppPickerImpl: React.ComponentType<AppPickerImplProps> = ({\n apps,\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable max-lines */\n/* eslint-disable react/no-array-index-key */\nimport React, { useCallback, useRef, useMemo } from 'react';\nimport { DSChip } from '@elliemae/ds-chip';\nimport { useFocusTrap } from '@elliemae/ds-hooks-focus-trap';\nimport { keys } from './utils.js';\nimport { StyledWrapper, StyledSeparator, StyledListItemFullRow, StyledListItem, StyledTitle } from './styles.js';\nimport { useKeepTrackButtons } from './hooks/useKeepTrackButtons.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';\nimport { useAppPicker } from './config/useAppPicker.js';\n\ninterface AppPickerImplProps\n extends Omit<\n DSAppPickerT.InternalProps,\n 'onClose' | 'icon' | 'onClick' | 'onClickOutside' | 'renderTrigger' | 'isOpen'\n > {\n close: () => void;\n wrapperRef: React.RefObject<HTMLDivElement>;\n isOverflow: boolean;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n triggerIsInternal: boolean;\n}\n\nconst AppPickerImpl: React.ComponentType<AppPickerImplProps> = (props) => {\n const {\n apps,\n customApps,\n sectionTitle,\n customSectionTitle,\n close,\n wrapperRef,\n onKeyDown,\n triggerRef,\n isOverflow,\n actionRef,\n wasOpenedByKeyboardRef,\n triggerIsInternal,\n } = props;\n\n const { ownerPropsConfig } = useAppPicker(props);\n\n const { allFocusableButtons } = useKeepTrackButtons({\n wrapperRef,\n wasOpenedByKeyboardRef,\n actionRef,\n triggerIsInternal,\n });\n\n const firstElementRef = useRef<HTMLElement | null>(null);\n const lastElementRef = useRef<HTMLElement | null>(null);\n\n const handleOnClick = useCallback(\n (app: DSAppPickerT.AppItem) => (e: React.MouseEvent) => {\n if (app.onClick) app.onClick(e, app);\n },\n [],\n );\n\n const handleOnKeyDownWrapper: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (onKeyDown) onKeyDown(e);\n if (!onKeyDown && e.key === keys.ESC) {\n triggerRef?.current?.focus();\n close();\n }\n },\n [onKeyDown, triggerRef, close],\n );\n const [firstButton] = allFocusableButtons;\n firstElementRef.current = firstButton;\n lastElementRef.current = allFocusableButtons[allFocusableButtons.length - 1];\n\n const handleOnKeyDown = useFocusTrap({\n firstElementRef,\n lastElementRef,\n onKeyDown: handleOnKeyDownWrapper,\n });\n\n const totalAppsLength = useMemo(() => apps.length + customApps.length, [apps.length, customApps.length]);\n\n const buildRows = useCallback(\n (appList: DSAppPickerT.AppItem[], prevIndex: number, title: string): JSX.Element => (\n <>\n {appList.map((app, index) => {\n const { label, disabled, applyAriaDisabled, selected, icon: Icon, id } = app;\n\n // eslint-disable-next-line react/no-unstable-nested-components\n const IconComp = () => <Icon className=\"app-picker__icon\" size=\"m\" />;\n\n return (\n <StyledListItem data-testid={DSAppPickerDataTestIds.ITEM} role=\"presentation\" {...ownerPropsConfig}>\n <DSChip\n key={index}\n onClick={handleOnClick(app)}\n data-testid=\"app-picker__chip\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n selected={selected}\n aria-selected={selected}\n role=\"option\"\n id={id}\n aria-label={`${label}. ${title} (${index + prevIndex} of ${totalAppsLength})`}\n icon={IconComp}\n label={label}\n />\n </StyledListItem>\n );\n })}\n </>\n ),\n [handleOnClick, totalAppsLength, ownerPropsConfig],\n );\n\n const AppsRows = useMemo(() => buildRows(apps, 1, sectionTitle), [apps, buildRows, sectionTitle]);\n const CustomRows = useMemo(\n () => buildRows(customApps, apps.length, customSectionTitle),\n [apps.length, buildRows, customApps, customSectionTitle],\n );\n\n const layout = useMemo(() => {\n const cols = ['repeat(3, 92px)'];\n let appsRows = 0;\n let customRows = 0;\n const rows = [];\n if (apps.length > 0) {\n appsRows = apps.length / 3;\n rows.push('68px', `repeat(${appsRows}, 68px})`);\n }\n if (customApps.length > 0) {\n customRows = customApps.length / 3;\n rows.push('9px', '68px', `repeat(${customRows}, 68px})`);\n }\n return {\n rows,\n cols,\n };\n }, [apps.length, customApps.length]);\n\n // Needed just for typescript reasons\n const convertedTypeReference = wrapperRef as unknown as React.RefObject<HTMLDivElement> &\n React.RefObject<HTMLUListElement>;\n\n return (\n <StyledWrapper\n forwardedAs=\"ul\"\n role=\"listbox\"\n innerRef={convertedTypeReference}\n onKeyDown={handleOnKeyDown}\n data-testid={DSAppPickerDataTestIds.ROOT}\n isOverflow={isOverflow}\n cols={layout.cols}\n rows={layout.rows}\n tabIndex={-1}\n aria-label={`Application picker, ${sectionTitle} (${apps.length} apps)${\n customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ''\n }`}\n {...ownerPropsConfig}\n >\n <StyledListItemFullRow data-testid={DSAppPickerDataTestIds.ROW} aria-hidden role=\"group\" {...ownerPropsConfig}>\n <StyledTitle data-testid={DSAppPickerDataTestIds.TITLE} role=\"presentation\" {...ownerPropsConfig}>\n {sectionTitle}\n </StyledTitle>\n </StyledListItemFullRow>\n {AppsRows}\n {customApps.length > 0 && (\n <>\n <StyledListItemFullRow\n data-testid={DSAppPickerDataTestIds.ROW}\n aria-hidden\n role=\"group\"\n {...ownerPropsConfig}\n >\n <StyledSeparator data-testid={DSAppPickerDataTestIds.SEPARATOR} role=\"presentation\" {...ownerPropsConfig} />\n </StyledListItemFullRow>\n <StyledListItemFullRow\n data-testid={DSAppPickerDataTestIds.ROW}\n aria-hidden\n role=\"group\"\n {...ownerPropsConfig}\n >\n <StyledTitle data-testid={DSAppPickerDataTestIds.TITLE} role=\"presentation\" {...ownerPropsConfig}>\n {customSectionTitle}\n </StyledTitle>\n </StyledListItemFullRow>\n {CustomRows}\n </>\n )}\n </StyledWrapper>\n );\n};\n\nexport default AppPickerImpl;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADmFjB;AAjFN,mBAAoD;AACpD,qBAAuB;AACvB,iCAA6B;AAC7B,mBAAqB;AACrB,oBAAmG;AACnG,iCAAoC;AAEpC,oCAAuC;AACvC,0BAA6B;AAc7B,MAAM,gBAAyD,CAAC,UAAU;AACxE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,QAAM,EAAE,iBAAiB,QAAI,kCAAa,KAAK;AAE/C,QAAM,EAAE,oBAAoB,QAAI,gDAAoB;AAAA,IAClD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,QAAM,sBAAkB,qBAA2B,IAAI;AACvD,QAAM,qBAAiB,qBAA2B,IAAI;AAEtD,QAAM,oBAAgB;AAAA,IACpB,CAAC,QAA8B,CAAC,MAAwB;AAC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H,GACF;AAAA,QACC;AAAA,QACA,WAAW,SAAS,KACnB,4EACE;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,qDAAuB;AAAA,cACpC,eAAW;AAAA,cACX,MAAK;AAAA,cACJ,GAAG;AAAA,cAEJ,sDAAC,iCAAgB,eAAa,qDAAuB,WAAW,MAAK,gBAAgB,GAAG,kBAAkB;AAAA;AAAA,UAC5G;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,eAAa,qDAAuB;AAAA,cACpC,eAAW;AAAA,cACX,MAAK;AAAA,cACJ,GAAG;AAAA,cAEJ,sDAAC,6BAAY,eAAa,qDAAuB,OAAO,MAAK,gBAAgB,GAAG,kBAC7E,8BACH;AAAA;AAAA,UACF;AAAA,UACC;AAAA,WACH;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/DSAppPicker.js
CHANGED
|
@@ -43,8 +43,10 @@ var import_ds_popover = require("@elliemae/ds-popover");
|
|
|
43
43
|
var import_AppPickerImpl = __toESM(require("./AppPickerImpl.js"));
|
|
44
44
|
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
45
45
|
var import_DSAppPickerDefinitions = require("./DSAppPickerDefinitions.js");
|
|
46
|
+
var import_useAppPicker = require("./config/useAppPicker.js");
|
|
46
47
|
const DSAppPicker = (props) => {
|
|
47
|
-
const propsWithDefault = (0,
|
|
48
|
+
const { propsWithDefault, ownerPropsConfig } = (0, import_useAppPicker.useAppPicker)(props);
|
|
49
|
+
const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;
|
|
48
50
|
const {
|
|
49
51
|
apps,
|
|
50
52
|
customApps,
|
|
@@ -101,6 +103,8 @@ const DSAppPicker = (props) => {
|
|
|
101
103
|
() => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
104
|
import_AppPickerImpl.default,
|
|
103
105
|
{
|
|
106
|
+
...getOwnerProps(),
|
|
107
|
+
...getOwnerPropsArguments(),
|
|
104
108
|
apps,
|
|
105
109
|
customApps,
|
|
106
110
|
sectionTitle,
|
|
@@ -125,14 +129,16 @@ const DSAppPicker = (props) => {
|
|
|
125
129
|
onKeyDown,
|
|
126
130
|
renderTrigger,
|
|
127
131
|
sectionTitle,
|
|
128
|
-
triggerRef
|
|
132
|
+
triggerRef,
|
|
133
|
+
getOwnerProps,
|
|
134
|
+
getOwnerPropsArguments
|
|
129
135
|
]
|
|
130
136
|
);
|
|
131
137
|
const RenderTrigger = (0, import_react.useMemo)(
|
|
132
138
|
() => renderTrigger || (({ ref }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
133
139
|
import_ds_button_v2.DSButtonV2,
|
|
134
140
|
{
|
|
135
|
-
"data-testid":
|
|
141
|
+
"data-testid": "app-picker__button",
|
|
136
142
|
id: "app-picker__button",
|
|
137
143
|
buttonType: "icon",
|
|
138
144
|
"aria-haspopup": "true",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSAppPicker.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { describe
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { describe } from '@elliemae/ds-props-helpers';\n\nimport { DSPopover } from '@elliemae/ds-popover';\nimport AppPickerImpl from './AppPickerImpl.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerPropTypes } from './react-desc-prop-types.js';\nimport { DSAppPickerName } from './DSAppPickerDefinitions.js';\nimport { useAppPicker } from './config/useAppPicker.js';\n\nconst DSAppPicker: React.ComponentType<DSAppPickerT.Props> = (props) => {\n const { propsWithDefault, ownerPropsConfig } = useAppPicker(props);\n\n const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;\n\n const {\n apps,\n customApps,\n sectionTitle,\n customSectionTitle,\n icon: Icon,\n renderTrigger,\n isOpen,\n onClose,\n actionRef,\n onKeyDown,\n onClick,\n onClickOutside,\n triggerRef,\n } = propsWithDefault;\n\n const [open, setOpen] = useState(false);\n const [isOverflow, setIsOverflow] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const defaultTriggerRef = useRef(null);\n const wasOpenedByKeyboardRef = useRef(false);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToIndex = (index: number) => {\n if (wrapperRef.current) {\n const parent = wrapperRef.current;\n const buttons = [...parent.querySelectorAll('button')];\n buttons[index].focus();\n }\n };\n actionRef.current.focusWrapper = () => {\n wrapperRef.current?.focus();\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 = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n\n const handleOnClickOutside = (e: React.MouseEvent) => {\n setOpen(false);\n onClose?.();\n onClickOutside?.(e);\n };\n\n const AppPickerContent = useCallback(\n () => (\n <AppPickerImpl\n {...getOwnerProps()}\n {...getOwnerPropsArguments()}\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 actionRef={actionRef}\n triggerIsInternal={!renderTrigger}\n wasOpenedByKeyboardRef={wasOpenedByKeyboardRef}\n isOverflow={isOverflow}\n />\n ),\n [\n actionRef,\n apps,\n customApps,\n customSectionTitle,\n handleOnClose,\n isOverflow,\n onKeyDown,\n renderTrigger,\n sectionTitle,\n triggerRef,\n getOwnerProps,\n getOwnerPropsArguments,\n ],\n );\n\n const RenderTrigger = useMemo(\n () =>\n renderTrigger ||\n (({ ref }: { ref: React.RefObject<HTMLButtonElement> }) => (\n <DSButtonV2\n data-testid=\"app-picker__button\"\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen ?? open}\n aria-label=\"Application picker\"\n innerRef={mergeRefs(ref, triggerRef || defaultTriggerRef)}\n onClick={(e: React.MouseEvent | React.KeyboardEvent) => {\n wasOpenedByKeyboardRef.current = e.detail === 0;\n onClick?.(e);\n setOpen(true);\n }}\n >\n <Icon />\n </DSButtonV2>\n )),\n [Icon, isOpen, onClick, open, renderTrigger, triggerRef],\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.displayName = DSAppPickerName;\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = DSAppPickerPropTypes;\n\nexport { DSAppPicker, AppPickerWithSchema };\nexport default DSAppPicker;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD6EjB;AA7EN,mBAAyE;AACzE,0BAA2B;AAC3B,uBAA0B;AAC1B,8BAAyB;AAEzB,wBAA0B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U;AAAA,MACV,iBAAgB;AAAA,MAChB,eAAe;AAAA,MACf,WAAS;AAAA,MACT,OAAO;AAAA,QACL,SAAS;AAAA,QACT,UAAU;AAAA,QACV,OAAO;AAAA,MACT;AAAA;AAAA,EACF;AAEJ;AAEA,YAAY,cAAc;AAC1B,MAAM,0BAAsB,kCAAS,WAAW;AAChD,oBAAoB,YAAY;AAGhC,IAAO,sBAAQ;",
|
|
6
6
|
"names": ["AppPickerImpl"]
|
|
7
7
|
}
|
|
@@ -34,19 +34,16 @@ __export(DSAppPickerDefinitions_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(DSAppPickerDefinitions_exports);
|
|
36
36
|
var React = __toESM(require("react"));
|
|
37
|
-
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
const DSAppPickerName = "DSApppicker";
|
|
38
39
|
const DSAppPickerSlots = {
|
|
39
40
|
ROOT: "root",
|
|
41
|
+
ITEM: "item",
|
|
40
42
|
TITLE: "title",
|
|
41
43
|
SEPARATOR: "separator",
|
|
42
|
-
ROW: "row"
|
|
43
|
-
ITEM: "item"
|
|
44
|
+
ROW: "row"
|
|
44
45
|
};
|
|
45
46
|
const DSAppPickerDataTestIds = {
|
|
46
|
-
|
|
47
|
-
WRAPPER: "app-picker__wrapper",
|
|
48
|
-
CHIP: "app-picker__chip",
|
|
49
|
-
MAIN_TITLE: "app-picker__main-title",
|
|
50
|
-
CUSTOM_TITLE: "app-picker__custom-title"
|
|
47
|
+
...(0, import_ds_system.slotObjectToDataTestIds)(DSAppPickerName, DSAppPickerSlots)
|
|
51
48
|
};
|
|
52
49
|
//# sourceMappingURL=DSAppPickerDefinitions.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/DSAppPickerDefinitions.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSAppPickerName = 'DSApppicker';\n\nexport const DSAppPickerSlots = {\n ROOT: 'root',\n ITEM: 'item',\n TITLE: 'title',\n SEPARATOR: 'separator',\n ROW: 'row',\n};\n\nexport const DSAppPickerDataTestIds = {\n ...(slotObjectToDataTestIds(DSAppPickerName, DSAppPickerSlots) as Record<keyof typeof DSAppPickerSlots, string>),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAwC;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AAAA,EACX,KAAK;AACP;AAEO,MAAM,yBAAyB;AAAA,EACpC,OAAI,0CAAwB,iBAAiB,gBAAgB;AAC/D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useAppPicker_exports = {};
|
|
30
|
+
__export(useAppPicker_exports, {
|
|
31
|
+
useAppPicker: () => useAppPicker
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useAppPicker_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
38
|
+
var import_DSAppPickerDefinitions = require("../DSAppPickerDefinitions.js");
|
|
39
|
+
const useAppPicker = (props) => {
|
|
40
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(props, import_react_desc_prop_types.defaultProps);
|
|
41
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(propsWithDefault, import_react_desc_prop_types.DSAppPickerPropTypes, import_DSAppPickerDefinitions.DSAppPickerName);
|
|
42
|
+
const ownerPropsConfig = (0, import_ds_props_helpers.useOwnerProps)(propsWithDefault, { ...props });
|
|
43
|
+
return import_react.default.useMemo(
|
|
44
|
+
() => ({
|
|
45
|
+
propsWithDefault,
|
|
46
|
+
ownerPropsConfig
|
|
47
|
+
}),
|
|
48
|
+
[propsWithDefault, ownerPropsConfig]
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=useAppPicker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useAppPicker.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useOwnerProps,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type DSAppPickerT, defaultProps, DSAppPickerPropTypes } from '../react-desc-prop-types.js';\nimport { DSAppPickerName } from '../DSAppPickerDefinitions.js';\n\nexport const useAppPicker = (props: DSAppPickerT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSAppPickerT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSAppPickerPropTypes, DSAppPickerName);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n ownerPropsConfig,\n }),\n [propsWithDefault, ownerPropsConfig],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAIO;AACP,mCAAsE;AACtE,oCAAgC;AAEzB,MAAM,eAAe,CAAC,UAA8B;AAIzD,QAAM,uBAAmB,sDAAyD,OAAO,yCAAY;AACrG,8DAA+B,kBAAkB,mDAAsB,6CAAe;AAItF,QAAM,uBAAmB,uCAAc,kBAAkB,EAAE,GAAG,MAAM,CAAC;AAErE,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,gBAAgB;AAAA,EACrC;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -36,7 +36,9 @@ var React = __toESM(require("react"));
|
|
|
36
36
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
var import_ds_icons = require("@elliemae/ds-icons");
|
|
38
38
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
|
+
var import_DSAppPickerDefinitions = require("./DSAppPickerDefinitions.js");
|
|
39
40
|
const defaultProps = {
|
|
41
|
+
// export const defaultProps: DSAppPickerT.DefaultProps = {
|
|
40
42
|
apps: [],
|
|
41
43
|
customApps: [],
|
|
42
44
|
sectionTitle: "APPLICATIONS",
|
|
@@ -44,6 +46,7 @@ const defaultProps = {
|
|
|
44
46
|
icon: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ds_icons.MenuPicker, { color: ["brand-primary", "700"], size: "m" })
|
|
45
47
|
};
|
|
46
48
|
const DSAppPickerPropTypes = {
|
|
49
|
+
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_DSAppPickerDefinitions.DSAppPickerName, import_DSAppPickerDefinitions.DSAppPickerSlots),
|
|
47
50
|
apps: import_ds_props_helpers.PropTypes.array.description(
|
|
48
51
|
"Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"
|
|
49
52
|
).isRequired,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/react-desc-prop-types.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
-
"sourcesContent": ["import React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.MutableRefObject<HTMLButtonElement>;\n [key: string]: unknown;\n }\n export interface OptionalProps {\n onClose?: () => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: React.ComponentType<RenderTriggerProp>;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes = {\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 triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n} as ValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, getPropsPerSlotPropTypes } from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSAppPickerName, DSAppPickerSlots } from './DSAppPickerDefinitions.js';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.MutableRefObject<HTMLButtonElement>;\n [key: string]: unknown;\n }\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSAppPickerName, typeof DSAppPickerSlots> {\n onClose?: () => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: React.ComponentType<RenderTriggerProp>;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: Omit<DSAppPickerT.DefaultProps, `dsAppPicker${Capitalize<string>}`> = {\n // export const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes = {\n ...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),\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 triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n} as ValidationMap<unknown>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoET;AAnEd,sBAA2B;AAG3B,8BAAoD;AAEpD,oCAAkD;AAwD3C,MAAM,eAAoF;AAAA;AAAA,EAE/F,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM,4CAAC,8BAAW,OAAO,CAAC,iBAAiB,KAAK,GAAG,MAAK,KAAI;AACpE;AAMO,MAAM,uBAAuB;AAAA,EAClC,OAAG,kDAAyB,+CAAiB,8CAAgB;AAAA,EAC7D,MAAM,kCAAU,MAAM;AAAA,IACpB;AAAA,EACF,EAAE;AAAA,EACF,YAAY,kCAAU,MAAM;AAAA,IAC1B;AAAA,EACF;AAAA,EACA,cAAc,kCAAU,OAAO,YAAY,oBAAoB,EAAE,aAAa,cAAc;AAAA,EAC5F,oBAAoB,kCAAU,OAAO,YAAY,sBAAsB,EAAE,aAAa,qBAAqB;AAAA,EAC3G,MAAM,kCAAU,KAAK,YAAY,uBAAuB,EAAE,aAAa,0BAAU;AAAA,EACjF,eAAe,kCAAU,KAAK,YAAY,2BAA2B;AAAA,EACrE,WAAW,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC5F;AAAA,EACF;AAAA,EACA,QAAQ,kCAAU,KAAK,YAAY,6CAA6C;AAAA,EAChF,SAAS,kCAAU,KAAK,YAAY,6CAA6C;AAAA,EACjF,WAAW,kCAAU,KAAK,YAAY,6BAA6B;AAAA,EACnE,SAAS,kCAAU,KAAK,YAAY,uCAAuC;AAAA,EAC3E,gBAAgB,kCAAU,KAAK,YAAY,6DAA6D;AAAA,EACxG,YAAY,kCAAU,UAAU,CAAC,kCAAU,MAAM,kCAAU,MAAM,EAAE,SAAS,kCAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7F;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -7,20 +7,23 @@ import { keys } from "./utils.js";
|
|
|
7
7
|
import { StyledWrapper, StyledSeparator, StyledListItemFullRow, StyledListItem, StyledTitle } from "./styles.js";
|
|
8
8
|
import { useKeepTrackButtons } from "./hooks/useKeepTrackButtons.js";
|
|
9
9
|
import { DSAppPickerDataTestIds } from "./DSAppPickerDefinitions.js";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
import { useAppPicker } from "./config/useAppPicker.js";
|
|
11
|
+
const AppPickerImpl = (props) => {
|
|
12
|
+
const {
|
|
13
|
+
apps,
|
|
14
|
+
customApps,
|
|
15
|
+
sectionTitle,
|
|
16
|
+
customSectionTitle,
|
|
17
|
+
close,
|
|
18
|
+
wrapperRef,
|
|
19
|
+
onKeyDown,
|
|
20
|
+
triggerRef,
|
|
21
|
+
isOverflow,
|
|
22
|
+
actionRef,
|
|
23
|
+
wasOpenedByKeyboardRef,
|
|
24
|
+
triggerIsInternal
|
|
25
|
+
} = props;
|
|
26
|
+
const { ownerPropsConfig } = useAppPicker(props);
|
|
24
27
|
const { allFocusableButtons } = useKeepTrackButtons({
|
|
25
28
|
wrapperRef,
|
|
26
29
|
wasOpenedByKeyboardRef,
|
|
@@ -58,11 +61,11 @@ const AppPickerImpl = ({
|
|
|
58
61
|
(appList, prevIndex, title) => /* @__PURE__ */ jsx(Fragment, { children: appList.map((app, index) => {
|
|
59
62
|
const { label, disabled, applyAriaDisabled, selected, icon: Icon, id } = app;
|
|
60
63
|
const IconComp = () => /* @__PURE__ */ jsx(Icon, { className: "app-picker__icon", size: "m" });
|
|
61
|
-
return /* @__PURE__ */ jsx(StyledListItem, { role: "presentation", children: /* @__PURE__ */ jsx(
|
|
64
|
+
return /* @__PURE__ */ jsx(StyledListItem, { "data-testid": DSAppPickerDataTestIds.ITEM, role: "presentation", ...ownerPropsConfig, children: /* @__PURE__ */ jsx(
|
|
62
65
|
DSChip,
|
|
63
66
|
{
|
|
64
67
|
onClick: handleOnClick(app),
|
|
65
|
-
"data-testid":
|
|
68
|
+
"data-testid": "app-picker__chip",
|
|
66
69
|
disabled,
|
|
67
70
|
applyAriaDisabled,
|
|
68
71
|
selected,
|
|
@@ -76,7 +79,7 @@ const AppPickerImpl = ({
|
|
|
76
79
|
index
|
|
77
80
|
) });
|
|
78
81
|
}) }),
|
|
79
|
-
[handleOnClick, totalAppsLength]
|
|
82
|
+
[handleOnClick, totalAppsLength, ownerPropsConfig]
|
|
80
83
|
);
|
|
81
84
|
const AppsRows = useMemo(() => buildRows(apps, 1, sectionTitle), [apps, buildRows, sectionTitle]);
|
|
82
85
|
const CustomRows = useMemo(
|
|
@@ -109,18 +112,37 @@ const AppPickerImpl = ({
|
|
|
109
112
|
role: "listbox",
|
|
110
113
|
innerRef: convertedTypeReference,
|
|
111
114
|
onKeyDown: handleOnKeyDown,
|
|
112
|
-
"data-testid": DSAppPickerDataTestIds.
|
|
115
|
+
"data-testid": DSAppPickerDataTestIds.ROOT,
|
|
113
116
|
isOverflow,
|
|
114
117
|
cols: layout.cols,
|
|
115
118
|
rows: layout.rows,
|
|
116
119
|
tabIndex: -1,
|
|
117
120
|
"aria-label": `Application picker, ${sectionTitle} (${apps.length} apps)${customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ""}`,
|
|
121
|
+
...ownerPropsConfig,
|
|
118
122
|
children: [
|
|
119
|
-
/* @__PURE__ */ jsx(StyledListItemFullRow, { "aria-hidden": true, role: "group", children: /* @__PURE__ */ jsx(StyledTitle, { "data-testid": DSAppPickerDataTestIds.
|
|
123
|
+
/* @__PURE__ */ jsx(StyledListItemFullRow, { "data-testid": DSAppPickerDataTestIds.ROW, "aria-hidden": true, role: "group", ...ownerPropsConfig, children: /* @__PURE__ */ jsx(StyledTitle, { "data-testid": DSAppPickerDataTestIds.TITLE, role: "presentation", ...ownerPropsConfig, children: sectionTitle }) }),
|
|
120
124
|
AppsRows,
|
|
121
125
|
customApps.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
122
|
-
/* @__PURE__ */ jsx(
|
|
123
|
-
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
StyledListItemFullRow,
|
|
128
|
+
{
|
|
129
|
+
"data-testid": DSAppPickerDataTestIds.ROW,
|
|
130
|
+
"aria-hidden": true,
|
|
131
|
+
role: "group",
|
|
132
|
+
...ownerPropsConfig,
|
|
133
|
+
children: /* @__PURE__ */ jsx(StyledSeparator, { "data-testid": DSAppPickerDataTestIds.SEPARATOR, role: "presentation", ...ownerPropsConfig })
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ jsx(
|
|
137
|
+
StyledListItemFullRow,
|
|
138
|
+
{
|
|
139
|
+
"data-testid": DSAppPickerDataTestIds.ROW,
|
|
140
|
+
"aria-hidden": true,
|
|
141
|
+
role: "group",
|
|
142
|
+
...ownerPropsConfig,
|
|
143
|
+
children: /* @__PURE__ */ jsx(StyledTitle, { "data-testid": DSAppPickerDataTestIds.TITLE, role: "presentation", ...ownerPropsConfig, children: customSectionTitle })
|
|
144
|
+
}
|
|
145
|
+
),
|
|
124
146
|
CustomRows
|
|
125
147
|
] })
|
|
126
148
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/AppPickerImpl.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable react/no-array-index-key */\nimport React, { useCallback, useRef, useMemo } from 'react';\nimport { DSChip } from '@elliemae/ds-chip';\nimport { useFocusTrap } from '@elliemae/ds-hooks-focus-trap';\nimport { keys } from './utils.js';\nimport { StyledWrapper, StyledSeparator, StyledListItemFullRow, StyledListItem, StyledTitle } from './styles.js';\nimport { useKeepTrackButtons } from './hooks/useKeepTrackButtons.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';\n\ninterface AppPickerImplProps\n extends Omit<\n DSAppPickerT.InternalProps,\n 'onClose' | 'icon' | 'onClick' | 'onClickOutside' | 'renderTrigger' | 'isOpen'\n > {\n close: () => void;\n wrapperRef: React.RefObject<HTMLDivElement>;\n isOverflow: boolean;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n triggerIsInternal: boolean;\n}\n\nconst AppPickerImpl: React.ComponentType<AppPickerImplProps> = ({\n apps,\n
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable max-lines */\n/* eslint-disable react/no-array-index-key */\nimport React, { useCallback, useRef, useMemo } from 'react';\nimport { DSChip } from '@elliemae/ds-chip';\nimport { useFocusTrap } from '@elliemae/ds-hooks-focus-trap';\nimport { keys } from './utils.js';\nimport { StyledWrapper, StyledSeparator, StyledListItemFullRow, StyledListItem, StyledTitle } from './styles.js';\nimport { useKeepTrackButtons } from './hooks/useKeepTrackButtons.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';\nimport { useAppPicker } from './config/useAppPicker.js';\n\ninterface AppPickerImplProps\n extends Omit<\n DSAppPickerT.InternalProps,\n 'onClose' | 'icon' | 'onClick' | 'onClickOutside' | 'renderTrigger' | 'isOpen'\n > {\n close: () => void;\n wrapperRef: React.RefObject<HTMLDivElement>;\n isOverflow: boolean;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n triggerIsInternal: boolean;\n}\n\nconst AppPickerImpl: React.ComponentType<AppPickerImplProps> = (props) => {\n const {\n apps,\n customApps,\n sectionTitle,\n customSectionTitle,\n close,\n wrapperRef,\n onKeyDown,\n triggerRef,\n isOverflow,\n actionRef,\n wasOpenedByKeyboardRef,\n triggerIsInternal,\n } = props;\n\n const { ownerPropsConfig } = useAppPicker(props);\n\n const { allFocusableButtons } = useKeepTrackButtons({\n wrapperRef,\n wasOpenedByKeyboardRef,\n actionRef,\n triggerIsInternal,\n });\n\n const firstElementRef = useRef<HTMLElement | null>(null);\n const lastElementRef = useRef<HTMLElement | null>(null);\n\n const handleOnClick = useCallback(\n (app: DSAppPickerT.AppItem) => (e: React.MouseEvent) => {\n if (app.onClick) app.onClick(e, app);\n },\n [],\n );\n\n const handleOnKeyDownWrapper: React.KeyboardEventHandler = useCallback(\n (e) => {\n if (onKeyDown) onKeyDown(e);\n if (!onKeyDown && e.key === keys.ESC) {\n triggerRef?.current?.focus();\n close();\n }\n },\n [onKeyDown, triggerRef, close],\n );\n const [firstButton] = allFocusableButtons;\n firstElementRef.current = firstButton;\n lastElementRef.current = allFocusableButtons[allFocusableButtons.length - 1];\n\n const handleOnKeyDown = useFocusTrap({\n firstElementRef,\n lastElementRef,\n onKeyDown: handleOnKeyDownWrapper,\n });\n\n const totalAppsLength = useMemo(() => apps.length + customApps.length, [apps.length, customApps.length]);\n\n const buildRows = useCallback(\n (appList: DSAppPickerT.AppItem[], prevIndex: number, title: string): JSX.Element => (\n <>\n {appList.map((app, index) => {\n const { label, disabled, applyAriaDisabled, selected, icon: Icon, id } = app;\n\n // eslint-disable-next-line react/no-unstable-nested-components\n const IconComp = () => <Icon className=\"app-picker__icon\" size=\"m\" />;\n\n return (\n <StyledListItem data-testid={DSAppPickerDataTestIds.ITEM} role=\"presentation\" {...ownerPropsConfig}>\n <DSChip\n key={index}\n onClick={handleOnClick(app)}\n data-testid=\"app-picker__chip\"\n disabled={disabled}\n applyAriaDisabled={applyAriaDisabled}\n selected={selected}\n aria-selected={selected}\n role=\"option\"\n id={id}\n aria-label={`${label}. ${title} (${index + prevIndex} of ${totalAppsLength})`}\n icon={IconComp}\n label={label}\n />\n </StyledListItem>\n );\n })}\n </>\n ),\n [handleOnClick, totalAppsLength, ownerPropsConfig],\n );\n\n const AppsRows = useMemo(() => buildRows(apps, 1, sectionTitle), [apps, buildRows, sectionTitle]);\n const CustomRows = useMemo(\n () => buildRows(customApps, apps.length, customSectionTitle),\n [apps.length, buildRows, customApps, customSectionTitle],\n );\n\n const layout = useMemo(() => {\n const cols = ['repeat(3, 92px)'];\n let appsRows = 0;\n let customRows = 0;\n const rows = [];\n if (apps.length > 0) {\n appsRows = apps.length / 3;\n rows.push('68px', `repeat(${appsRows}, 68px})`);\n }\n if (customApps.length > 0) {\n customRows = customApps.length / 3;\n rows.push('9px', '68px', `repeat(${customRows}, 68px})`);\n }\n return {\n rows,\n cols,\n };\n }, [apps.length, customApps.length]);\n\n // Needed just for typescript reasons\n const convertedTypeReference = wrapperRef as unknown as React.RefObject<HTMLDivElement> &\n React.RefObject<HTMLUListElement>;\n\n return (\n <StyledWrapper\n forwardedAs=\"ul\"\n role=\"listbox\"\n innerRef={convertedTypeReference}\n onKeyDown={handleOnKeyDown}\n data-testid={DSAppPickerDataTestIds.ROOT}\n isOverflow={isOverflow}\n cols={layout.cols}\n rows={layout.rows}\n tabIndex={-1}\n aria-label={`Application picker, ${sectionTitle} (${apps.length} apps)${\n customApps.length > 0 ? `, ${customSectionTitle} (${customApps.length} apps)` : ''\n }`}\n {...ownerPropsConfig}\n >\n <StyledListItemFullRow data-testid={DSAppPickerDataTestIds.ROW} aria-hidden role=\"group\" {...ownerPropsConfig}>\n <StyledTitle data-testid={DSAppPickerDataTestIds.TITLE} role=\"presentation\" {...ownerPropsConfig}>\n {sectionTitle}\n </StyledTitle>\n </StyledListItemFullRow>\n {AppsRows}\n {customApps.length > 0 && (\n <>\n <StyledListItemFullRow\n data-testid={DSAppPickerDataTestIds.ROW}\n aria-hidden\n role=\"group\"\n {...ownerPropsConfig}\n >\n <StyledSeparator data-testid={DSAppPickerDataTestIds.SEPARATOR} role=\"presentation\" {...ownerPropsConfig} />\n </StyledListItemFullRow>\n <StyledListItemFullRow\n data-testid={DSAppPickerDataTestIds.ROW}\n aria-hidden\n role=\"group\"\n {...ownerPropsConfig}\n >\n <StyledTitle data-testid={DSAppPickerDataTestIds.TITLE} role=\"presentation\" {...ownerPropsConfig}>\n {customSectionTitle}\n </StyledTitle>\n </StyledListItemFullRow>\n {CustomRows}\n </>\n )}\n </StyledWrapper>\n );\n};\n\nexport default AppPickerImpl;\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A;AAAA,EAEJ;AAEJ;AAEA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSAppPicker.js
CHANGED
|
@@ -3,13 +3,15 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useEffect, useMemo, useRef, useCallback } from "react";
|
|
4
4
|
import { DSButtonV2 } from "@elliemae/ds-button-v2";
|
|
5
5
|
import { mergeRefs } from "@elliemae/ds-system";
|
|
6
|
-
import { describe
|
|
6
|
+
import { describe } from "@elliemae/ds-props-helpers";
|
|
7
7
|
import { DSPopover } from "@elliemae/ds-popover";
|
|
8
8
|
import AppPickerImpl from "./AppPickerImpl.js";
|
|
9
|
-
import { DSAppPickerPropTypes
|
|
10
|
-
import {
|
|
9
|
+
import { DSAppPickerPropTypes } from "./react-desc-prop-types.js";
|
|
10
|
+
import { DSAppPickerName } from "./DSAppPickerDefinitions.js";
|
|
11
|
+
import { useAppPicker } from "./config/useAppPicker.js";
|
|
11
12
|
const DSAppPicker = (props) => {
|
|
12
|
-
const propsWithDefault =
|
|
13
|
+
const { propsWithDefault, ownerPropsConfig } = useAppPicker(props);
|
|
14
|
+
const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;
|
|
13
15
|
const {
|
|
14
16
|
apps,
|
|
15
17
|
customApps,
|
|
@@ -66,6 +68,8 @@ const DSAppPicker = (props) => {
|
|
|
66
68
|
() => /* @__PURE__ */ jsx(
|
|
67
69
|
AppPickerImpl,
|
|
68
70
|
{
|
|
71
|
+
...getOwnerProps(),
|
|
72
|
+
...getOwnerPropsArguments(),
|
|
69
73
|
apps,
|
|
70
74
|
customApps,
|
|
71
75
|
sectionTitle,
|
|
@@ -90,14 +94,16 @@ const DSAppPicker = (props) => {
|
|
|
90
94
|
onKeyDown,
|
|
91
95
|
renderTrigger,
|
|
92
96
|
sectionTitle,
|
|
93
|
-
triggerRef
|
|
97
|
+
triggerRef,
|
|
98
|
+
getOwnerProps,
|
|
99
|
+
getOwnerPropsArguments
|
|
94
100
|
]
|
|
95
101
|
);
|
|
96
102
|
const RenderTrigger = useMemo(
|
|
97
103
|
() => renderTrigger || (({ ref }) => /* @__PURE__ */ jsx(
|
|
98
104
|
DSButtonV2,
|
|
99
105
|
{
|
|
100
|
-
"data-testid":
|
|
106
|
+
"data-testid": "app-picker__button",
|
|
101
107
|
id: "app-picker__button",
|
|
102
108
|
buttonType: "icon",
|
|
103
109
|
"aria-haspopup": "true",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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, useMemo, useRef, useCallback } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { describe
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useState, useEffect, useMemo, useRef, useCallback } from 'react';\nimport { DSButtonV2 } from '@elliemae/ds-button-v2';\nimport { mergeRefs } from '@elliemae/ds-system';\nimport { describe } from '@elliemae/ds-props-helpers';\n\nimport { DSPopover } from '@elliemae/ds-popover';\nimport AppPickerImpl from './AppPickerImpl.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerPropTypes } from './react-desc-prop-types.js';\nimport { DSAppPickerName } from './DSAppPickerDefinitions.js';\nimport { useAppPicker } from './config/useAppPicker.js';\n\nconst DSAppPicker: React.ComponentType<DSAppPickerT.Props> = (props) => {\n const { propsWithDefault, ownerPropsConfig } = useAppPicker(props);\n\n const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;\n\n const {\n apps,\n customApps,\n sectionTitle,\n customSectionTitle,\n icon: Icon,\n renderTrigger,\n isOpen,\n onClose,\n actionRef,\n onKeyDown,\n onClick,\n onClickOutside,\n triggerRef,\n } = propsWithDefault;\n\n const [open, setOpen] = useState(false);\n const [isOverflow, setIsOverflow] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n const defaultTriggerRef = useRef(null);\n const wasOpenedByKeyboardRef = useRef(false);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusToIndex = (index: number) => {\n if (wrapperRef.current) {\n const parent = wrapperRef.current;\n const buttons = [...parent.querySelectorAll('button')];\n buttons[index].focus();\n }\n };\n actionRef.current.focusWrapper = () => {\n wrapperRef.current?.focus();\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 = useCallback(() => {\n setOpen(false);\n onClose?.();\n }, [onClose]);\n\n const handleOnClickOutside = (e: React.MouseEvent) => {\n setOpen(false);\n onClose?.();\n onClickOutside?.(e);\n };\n\n const AppPickerContent = useCallback(\n () => (\n <AppPickerImpl\n {...getOwnerProps()}\n {...getOwnerPropsArguments()}\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 actionRef={actionRef}\n triggerIsInternal={!renderTrigger}\n wasOpenedByKeyboardRef={wasOpenedByKeyboardRef}\n isOverflow={isOverflow}\n />\n ),\n [\n actionRef,\n apps,\n customApps,\n customSectionTitle,\n handleOnClose,\n isOverflow,\n onKeyDown,\n renderTrigger,\n sectionTitle,\n triggerRef,\n getOwnerProps,\n getOwnerPropsArguments,\n ],\n );\n\n const RenderTrigger = useMemo(\n () =>\n renderTrigger ||\n (({ ref }: { ref: React.RefObject<HTMLButtonElement> }) => (\n <DSButtonV2\n data-testid=\"app-picker__button\"\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen ?? open}\n aria-label=\"Application picker\"\n innerRef={mergeRefs(ref, triggerRef || defaultTriggerRef)}\n onClick={(e: React.MouseEvent | React.KeyboardEvent) => {\n wasOpenedByKeyboardRef.current = e.detail === 0;\n onClick?.(e);\n setOpen(true);\n }}\n >\n <Icon />\n </DSButtonV2>\n )),\n [Icon, isOpen, onClick, open, renderTrigger, triggerRef],\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.displayName = DSAppPickerName;\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = DSAppPickerPropTypes;\n\nexport { DSAppPicker, AppPickerWithSchema };\nexport default DSAppPicker;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC6EjB;AA7EN,SAAgB,UAAU,WAAW,SAAS,QAAQ,mBAAmB;AACzE,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAC1B,OAAO,mBAAmB;AAE1B,SAAS,4BAA4B;AACrC,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAE7B,MAAM,cAAuD,CAAC,UAAU;AACtE,QAAM,EAAE,kBAAkB,iBAAiB,IAAI,aAAa,KAAK;AAEjE,QAAM,EAAE,eAAe,uBAAuB,IAAI;AAElD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAC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elliemae/ds-system";
|
|
3
|
+
const DSAppPickerName = "DSApppicker";
|
|
3
4
|
const DSAppPickerSlots = {
|
|
4
5
|
ROOT: "root",
|
|
6
|
+
ITEM: "item",
|
|
5
7
|
TITLE: "title",
|
|
6
8
|
SEPARATOR: "separator",
|
|
7
|
-
ROW: "row"
|
|
8
|
-
ITEM: "item"
|
|
9
|
+
ROW: "row"
|
|
9
10
|
};
|
|
10
11
|
const DSAppPickerDataTestIds = {
|
|
11
|
-
|
|
12
|
-
WRAPPER: "app-picker__wrapper",
|
|
13
|
-
CHIP: "app-picker__chip",
|
|
14
|
-
MAIN_TITLE: "app-picker__main-title",
|
|
15
|
-
CUSTOM_TITLE: "app-picker__custom-title"
|
|
12
|
+
...slotObjectToDataTestIds(DSAppPickerName, DSAppPickerSlots)
|
|
16
13
|
};
|
|
17
14
|
export {
|
|
18
15
|
DSAppPickerDataTestIds,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSAppPickerDefinitions.ts"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { slotObjectToDataTestIds } from '@elliemae/ds-system';\n\nexport const DSAppPickerName = 'DSApppicker';\n\nexport const DSAppPickerSlots = {\n ROOT: 'root',\n ITEM: 'item',\n TITLE: 'title',\n SEPARATOR: 'separator',\n ROW: 'row',\n};\n\nexport const DSAppPickerDataTestIds = {\n ...(slotObjectToDataTestIds(DSAppPickerName, DSAppPickerSlots) as Record<keyof typeof DSAppPickerSlots, string>),\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,+BAA+B;AAEjC,MAAM,kBAAkB;AAExB,MAAM,mBAAmB;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,OAAO;AAAA,EACP,WAAW;AAAA,EACX,KAAK;AACP;AAEO,MAAM,yBAAyB;AAAA,EACpC,GAAI,wBAAwB,iBAAiB,gBAAgB;AAC/D;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import {
|
|
4
|
+
useMemoMergePropsWithDefault,
|
|
5
|
+
useOwnerProps,
|
|
6
|
+
useValidateTypescriptPropTypes
|
|
7
|
+
} from "@elliemae/ds-props-helpers";
|
|
8
|
+
import { defaultProps, DSAppPickerPropTypes } from "../react-desc-prop-types.js";
|
|
9
|
+
import { DSAppPickerName } from "../DSAppPickerDefinitions.js";
|
|
10
|
+
const useAppPicker = (props) => {
|
|
11
|
+
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
12
|
+
useValidateTypescriptPropTypes(propsWithDefault, DSAppPickerPropTypes, DSAppPickerName);
|
|
13
|
+
const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });
|
|
14
|
+
return React2.useMemo(
|
|
15
|
+
() => ({
|
|
16
|
+
propsWithDefault,
|
|
17
|
+
ownerPropsConfig
|
|
18
|
+
}),
|
|
19
|
+
[propsWithDefault, ownerPropsConfig]
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
useAppPicker
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=useAppPicker.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useAppPicker.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport {\n useMemoMergePropsWithDefault,\n useOwnerProps,\n useValidateTypescriptPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport { type DSAppPickerT, defaultProps, DSAppPickerPropTypes } from '../react-desc-prop-types.js';\nimport { DSAppPickerName } from '../DSAppPickerDefinitions.js';\n\nexport const useAppPicker = (props: DSAppPickerT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSAppPickerT.InternalProps>(props, defaultProps);\n useValidateTypescriptPropTypes(propsWithDefault, DSAppPickerPropTypes, DSAppPickerName);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const ownerPropsConfig = useOwnerProps(propsWithDefault, { ...props });\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n ownerPropsConfig,\n }),\n [propsWithDefault, ownerPropsConfig],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAA4B,cAAc,4BAA4B;AACtE,SAAS,uBAAuB;AAEzB,MAAM,eAAe,CAAC,UAA8B;AAIzD,QAAM,mBAAmB,6BAAyD,OAAO,YAAY;AACrG,iCAA+B,kBAAkB,sBAAsB,eAAe;AAItF,QAAM,mBAAmB,cAAc,kBAAkB,EAAE,GAAG,MAAM,CAAC;AAErE,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,gBAAgB;AAAA,EACrC;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { MenuPicker } from "@elliemae/ds-icons";
|
|
4
|
-
import { PropTypes } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { PropTypes, getPropsPerSlotPropTypes } from "@elliemae/ds-props-helpers";
|
|
5
|
+
import { DSAppPickerName, DSAppPickerSlots } from "./DSAppPickerDefinitions.js";
|
|
5
6
|
const defaultProps = {
|
|
7
|
+
// export const defaultProps: DSAppPickerT.DefaultProps = {
|
|
6
8
|
apps: [],
|
|
7
9
|
customApps: [],
|
|
8
10
|
sectionTitle: "APPLICATIONS",
|
|
@@ -10,6 +12,7 @@ const defaultProps = {
|
|
|
10
12
|
icon: () => /* @__PURE__ */ jsx(MenuPicker, { color: ["brand-primary", "700"], size: "m" })
|
|
11
13
|
};
|
|
12
14
|
const DSAppPickerPropTypes = {
|
|
15
|
+
...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),
|
|
13
16
|
apps: PropTypes.array.description(
|
|
14
17
|
"Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"
|
|
15
18
|
).isRequired,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.MutableRefObject<HTMLButtonElement>;\n [key: string]: unknown;\n }\n export interface OptionalProps {\n onClose?: () => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: React.ComponentType<RenderTriggerProp>;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes = {\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 triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n} as ValidationMap<unknown>;\n"],
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';\nimport { PropTypes, getPropsPerSlotPropTypes } from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSAppPickerName, DSAppPickerSlots } from './DSAppPickerDefinitions.js';\n\nexport declare namespace DSAppPickerT {\n export interface AppItem {\n label: string;\n icon: React.ComponentType<{ className: string; size: string }>;\n onClick?: (e: React.MouseEvent, item: AppItem) => void | null;\n disabled?: boolean;\n applyAriaDisabled?: boolean;\n id?: string;\n selected?: boolean;\n }\n\n export type ActionRef = React.MutableRefObject<{\n focusToIndex?: (index: number) => void;\n focusSelectedOrFirstAvailable?: () => void;\n focusWrapper: () => void;\n }>;\n\n export interface DefaultProps {\n apps: AppItem[];\n customApps: AppItem[];\n sectionTitle: string;\n customSectionTitle: string;\n icon: React.ComponentType<SvgIconT.Props>;\n }\n\n interface RenderTriggerProp {\n ref: React.MutableRefObject<HTMLButtonElement>;\n [key: string]: unknown;\n }\n export interface OptionalProps\n extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSAppPickerName, typeof DSAppPickerSlots> {\n onClose?: () => void;\n onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;\n onClickOutside?: (e: React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: React.ComponentType<RenderTriggerProp>;\n isOpen?: boolean;\n triggerRef?: React.RefObject<HTMLButtonElement>;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps {}\n}\n\nexport const defaultProps: Omit<DSAppPickerT.DefaultProps, `dsAppPicker${Capitalize<string>}`> = {\n // export const defaultProps: DSAppPickerT.DefaultProps = {\n apps: [],\n customApps: [],\n sectionTitle: 'APPLICATIONS',\n customSectionTitle: 'CUSTOM APPLICATIONS',\n icon: () => <MenuPicker color={['brand-primary', '700']} size=\"m\" />,\n};\n\n// =============================================================================\n// PropTypes\n// =============================================================================\n\nexport const DSAppPickerPropTypes = {\n ...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),\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 triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(\n 'Ref to the trigger button.',\n ),\n} as ValidationMap<unknown>;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACoET;AAnEd,SAAS,kBAAkB;AAG3B,SAAS,WAAW,gCAAgC;AAEpD,SAAS,iBAAiB,wBAAwB;AAwD3C,MAAM,eAAoF;AAAA;AAAA,EAE/F,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM,oBAAC,cAAW,OAAO,CAAC,iBAAiB,KAAK,GAAG,MAAK,KAAI;AACpE;AAMO,MAAM,uBAAuB;AAAA,EAClC,GAAG,yBAAyB,iBAAiB,gBAAgB;AAAA,EAC7D,MAAM,UAAU,MAAM;AAAA,IACpB;AAAA,EACF,EAAE;AAAA,EACF,YAAY,UAAU,MAAM;AAAA,IAC1B;AAAA,EACF;AAAA,EACA,cAAc,UAAU,OAAO,YAAY,oBAAoB,EAAE,aAAa,cAAc;AAAA,EAC5F,oBAAoB,UAAU,OAAO,YAAY,sBAAsB,EAAE,aAAa,qBAAqB;AAAA,EAC3G,MAAM,UAAU,KAAK,YAAY,uBAAuB,EAAE,aAAa,UAAU;AAAA,EACjF,eAAe,UAAU,KAAK,YAAY,2BAA2B;AAAA,EACrE,WAAW,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC5F;AAAA,EACF;AAAA,EACA,QAAQ,UAAU,KAAK,YAAY,6CAA6C;AAAA,EAChF,SAAS,UAAU,KAAK,YAAY,6CAA6C;AAAA,EACjF,WAAW,UAAU,KAAK,YAAY,6BAA6B;AAAA,EACnE,SAAS,UAAU,KAAK,YAAY,uCAAuC;AAAA,EAC3E,gBAAgB,UAAU,KAAK,YAAY,6DAA6D;AAAA,EACxG,YAAY,UAAU,UAAU,CAAC,UAAU,MAAM,UAAU,MAAM,EAAE,SAAS,UAAU,IAAI,CAAC,CAAC,CAAC,EAAE;AAAA,IAC7F;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare const DSAppPickerName = "
|
|
1
|
+
export declare const DSAppPickerName = "DSApppicker";
|
|
2
2
|
export declare const DSAppPickerSlots: {
|
|
3
3
|
ROOT: string;
|
|
4
|
+
ITEM: string;
|
|
4
5
|
TITLE: string;
|
|
5
6
|
SEPARATOR: string;
|
|
6
7
|
ROW: string;
|
|
7
|
-
ITEM: string;
|
|
8
8
|
};
|
|
9
9
|
export declare const DSAppPickerDataTestIds: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
ROOT: string;
|
|
11
|
+
ITEM: string;
|
|
12
|
+
TITLE: string;
|
|
13
|
+
SEPARATOR: string;
|
|
14
|
+
ROW: string;
|
|
15
15
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DSAppPickerT } from '../react-desc-prop-types.js';
|
|
2
|
+
export declare const useAppPicker: (props: DSAppPickerT.Props) => {
|
|
3
|
+
propsWithDefault: DSAppPickerT.InternalProps;
|
|
4
|
+
ownerPropsConfig: {
|
|
5
|
+
getOwnerProps: () => DSAppPickerT.InternalProps;
|
|
6
|
+
getOwnerPropsArguments: () => {};
|
|
7
|
+
};
|
|
8
|
+
};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { SvgIconT } from '@elliemae/ds-icons';
|
|
4
4
|
import type { GlobalAttributesT, XstyledProps, ValidationMap } from '@elliemae/ds-props-helpers';
|
|
5
|
+
import type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';
|
|
6
|
+
import { DSAppPickerName, DSAppPickerSlots } from './DSAppPickerDefinitions.js';
|
|
5
7
|
export declare namespace DSAppPickerT {
|
|
6
8
|
interface AppItem {
|
|
7
9
|
label: string;
|
|
@@ -31,7 +33,7 @@ export declare namespace DSAppPickerT {
|
|
|
31
33
|
ref: React.MutableRefObject<HTMLButtonElement>;
|
|
32
34
|
[key: string]: unknown;
|
|
33
35
|
}
|
|
34
|
-
interface OptionalProps {
|
|
36
|
+
interface OptionalProps extends TypescriptHelpersT.PropsForGlobalOnSlots<typeof DSAppPickerName, typeof DSAppPickerSlots> {
|
|
35
37
|
onClose?: () => void;
|
|
36
38
|
onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
|
|
37
39
|
onClickOutside?: (e: React.MouseEvent) => void;
|
|
@@ -46,5 +48,5 @@ export declare namespace DSAppPickerT {
|
|
|
46
48
|
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>, XstyledProps {
|
|
47
49
|
}
|
|
48
50
|
}
|
|
49
|
-
export declare const defaultProps: DSAppPickerT.DefaultProps
|
|
51
|
+
export declare const defaultProps: Omit<DSAppPickerT.DefaultProps, `dsAppPicker${Capitalize<string>}`>;
|
|
50
52
|
export declare const DSAppPickerPropTypes: ValidationMap<unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-app-picker",
|
|
3
|
-
"version": "3.49.0
|
|
3
|
+
"version": "3.49.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - App Picker",
|
|
6
6
|
"files": [
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
|
52
|
-
"pnpm": ">=
|
|
53
|
-
"node": ">=
|
|
52
|
+
"pnpm": ">=9",
|
|
53
|
+
"node": ">=22"
|
|
54
54
|
},
|
|
55
55
|
"author": "ICE MT",
|
|
56
56
|
"jestSonar": {
|
|
@@ -60,19 +60,22 @@
|
|
|
60
60
|
"indent": 4
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@elliemae/ds-button-v2": "3.49.0
|
|
64
|
-
"@elliemae/ds-
|
|
65
|
-
"@elliemae/ds-
|
|
66
|
-
"@elliemae/ds-
|
|
67
|
-
"@elliemae/ds-popover": "3.49.0
|
|
68
|
-
"@elliemae/ds-
|
|
69
|
-
"@elliemae/ds-
|
|
70
|
-
"@elliemae/ds-system": "3.49.0
|
|
63
|
+
"@elliemae/ds-button-v2": "3.49.0",
|
|
64
|
+
"@elliemae/ds-chip": "3.49.0",
|
|
65
|
+
"@elliemae/ds-grid": "3.49.0",
|
|
66
|
+
"@elliemae/ds-hooks-focus-trap": "3.49.0",
|
|
67
|
+
"@elliemae/ds-popover": "3.49.0",
|
|
68
|
+
"@elliemae/ds-props-helpers": "3.49.0",
|
|
69
|
+
"@elliemae/ds-icons": "3.49.0",
|
|
70
|
+
"@elliemae/ds-system": "3.49.0",
|
|
71
|
+
"@elliemae/ds-typescript-helpers": "3.49.0"
|
|
71
72
|
},
|
|
72
73
|
"devDependencies": {
|
|
73
74
|
"@elliemae/pui-cli": "9.0.0-next.50",
|
|
75
|
+
"jest": "~29.7.0",
|
|
76
|
+
"jest-cli": "~29.7.0",
|
|
74
77
|
"styled-components": "~5.3.9",
|
|
75
|
-
"@elliemae/ds-monorepo-devops": "3.49.0
|
|
78
|
+
"@elliemae/ds-monorepo-devops": "3.49.0"
|
|
76
79
|
},
|
|
77
80
|
"peerDependencies": {
|
|
78
81
|
"lodash": "^4.17.21",
|