@elliemae/ds-legacy-app-picker 1.0.0-rc.1

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 (45) hide show
  1. package/dist/cjs/AppPickerImpl.js +165 -0
  2. package/dist/cjs/AppPickerImpl.js.map +7 -0
  3. package/dist/cjs/DSAppPicker.js +175 -0
  4. package/dist/cjs/DSAppPicker.js.map +7 -0
  5. package/dist/cjs/DSAppPickerDefinitions.js +52 -0
  6. package/dist/cjs/DSAppPickerDefinitions.js.map +7 -0
  7. package/dist/cjs/hooks/useKeepTrackButtons.js +70 -0
  8. package/dist/cjs/hooks/useKeepTrackButtons.js.map +7 -0
  9. package/dist/cjs/index.js +43 -0
  10. package/dist/cjs/index.js.map +7 -0
  11. package/dist/cjs/package.json +7 -0
  12. package/dist/cjs/react-desc-prop-types.js +69 -0
  13. package/dist/cjs/react-desc-prop-types.js.map +7 -0
  14. package/dist/cjs/styles.js +77 -0
  15. package/dist/cjs/styles.js.map +7 -0
  16. package/dist/cjs/utils.js +55 -0
  17. package/dist/cjs/utils.js.map +7 -0
  18. package/dist/esm/AppPickerImpl.js +135 -0
  19. package/dist/esm/AppPickerImpl.js.map +7 -0
  20. package/dist/esm/DSAppPicker.js +145 -0
  21. package/dist/esm/DSAppPicker.js.map +7 -0
  22. package/dist/esm/DSAppPickerDefinitions.js +22 -0
  23. package/dist/esm/DSAppPickerDefinitions.js.map +7 -0
  24. package/dist/esm/hooks/useKeepTrackButtons.js +40 -0
  25. package/dist/esm/hooks/useKeepTrackButtons.js.map +7 -0
  26. package/dist/esm/index.js +13 -0
  27. package/dist/esm/index.js.map +7 -0
  28. package/dist/esm/package.json +7 -0
  29. package/dist/esm/react-desc-prop-types.js +39 -0
  30. package/dist/esm/react-desc-prop-types.js.map +7 -0
  31. package/dist/esm/styles.js +47 -0
  32. package/dist/esm/styles.js.map +7 -0
  33. package/dist/esm/utils.js +25 -0
  34. package/dist/esm/utils.js.map +7 -0
  35. package/dist/types/AppPickerImpl.d.ts +11 -0
  36. package/dist/types/DSAppPicker.d.ts +6 -0
  37. package/dist/types/DSAppPickerDefinitions.d.ts +15 -0
  38. package/dist/types/hooks/useKeepTrackButtons.d.ts +13 -0
  39. package/dist/types/index.d.ts +4 -0
  40. package/dist/types/react-desc-prop-types.d.ts +48 -0
  41. package/dist/types/styles.d.ts +8 -0
  42. package/dist/types/tests/AppPicker.test.d.ts +1 -0
  43. package/dist/types/tests/a11y/axe.test.d.ts +1 -0
  44. package/dist/types/utils.d.ts +14 -0
  45. package/package.json +97 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/hooks/useKeepTrackButtons.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\nimport { useEffect, useRef, useState } from 'react';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { focusSelectedOrFirstAvailable } from '../utils.js';\n\ninterface UseKeepTrackButtonsT {\n wrapperRef: React.RefObject<HTMLDivElement>;\n wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;\n actionRef?: DSAppPickerT.ActionRef;\n triggerIsInternal?: boolean;\n}\n\nexport const useKeepTrackButtons = ({\n wrapperRef,\n wasOpenedByKeyboardRef,\n actionRef,\n triggerIsInternal,\n}: UseKeepTrackButtonsT) => {\n const [allFocusableButtons, setAllFocusableButtons] = useState<HTMLButtonElement[]>([]);\n const selectedButton = useRef<number | null>(null);\n\n useEffect(() => {\n if (actionRef && actionRef.current) {\n actionRef.current.focusSelectedOrFirstAvailable = () =>\n setTimeout(() => {\n focusSelectedOrFirstAvailable(wrapperRef, allFocusableButtons, selectedButton);\n });\n }\n }, [actionRef, allFocusableButtons, wrapperRef]);\n\n useEffect(() => {\n wrapperRef?.current?.querySelectorAll('button').forEach((e, index) => {\n if (!e.hasAttribute('disabled')) setAllFocusableButtons((prev) => [...prev, e]);\n if (e.getAttribute('aria-selected') === 'true') {\n selectedButton.current = index;\n }\n });\n }, [wasOpenedByKeyboardRef, wrapperRef, triggerIsInternal]);\n\n useEffect(() => {\n if (wasOpenedByKeyboardRef?.current || !triggerIsInternal) {\n focusSelectedOrFirstAvailable(wrapperRef, allFocusableButtons, selectedButton);\n } else {\n wrapperRef.current?.focus();\n }\n }, [wasOpenedByKeyboardRef, wrapperRef, triggerIsInternal, allFocusableButtons]);\n\n return { allFocusableButtons, selectedButton };\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,qCAAqC;AASvC,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAA4B;AAC1B,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAA8B,CAAC,CAAC;AACtF,QAAM,iBAAiB,OAAsB,IAAI;AAEjD,YAAU,MAAM;AACd,QAAI,aAAa,UAAU,SAAS;AAClC,gBAAU,QAAQ,gCAAgC,MAChD,WAAW,MAAM;AACf,sCAA8B,YAAY,qBAAqB,cAAc;AAAA,MAC/E,CAAC;AAAA,IACL;AAAA,EACF,GAAG,CAAC,WAAW,qBAAqB,UAAU,CAAC;AAE/C,YAAU,MAAM;AACd,gBAAY,SAAS,iBAAiB,QAAQ,EAAE,QAAQ,CAAC,GAAG,UAAU;AACpE,UAAI,CAAC,EAAE,aAAa,UAAU;AAAG,+BAAuB,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC,CAAC;AAC9E,UAAI,EAAE,aAAa,eAAe,MAAM,QAAQ;AAC9C,uBAAe,UAAU;AAAA,MAC3B;AAAA,IACF,CAAC;AAAA,EACH,GAAG,CAAC,wBAAwB,YAAY,iBAAiB,CAAC;AAE1D,YAAU,MAAM;AACd,QAAI,wBAAwB,WAAW,CAAC,mBAAmB;AACzD,oCAA8B,YAAY,qBAAqB,cAAc;AAAA,IAC/E,OAAO;AACL,iBAAW,SAAS,MAAM;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,wBAAwB,YAAY,mBAAmB,mBAAmB,CAAC;AAE/E,SAAO,EAAE,qBAAqB,eAAe;AAC/C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ import * as React from "react";
2
+ import { DSAppPicker, AppPickerWithSchema } from "./DSAppPicker.js";
3
+ import { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from "./DSAppPickerDefinitions.js";
4
+ import { default as default2 } from "./DSAppPicker.js";
5
+ export {
6
+ AppPickerWithSchema,
7
+ DSAppPicker,
8
+ DSAppPickerDataTestIds,
9
+ DSAppPickerName,
10
+ DSAppPickerSlots,
11
+ default2 as default
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/index.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export { DSAppPicker, AppPickerWithSchema } from './DSAppPicker.js';\nexport { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';\nexport type { DSAppPickerT } from './react-desc-prop-types.js';\n\nexport { default } from './DSAppPicker.js';\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACAvB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,kBAAkB,8BAA8B;AAG1E,SAAS,WAAAA,gBAAe;",
6
+ "names": ["default"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": [
4
+ "*.css",
5
+ "*.scss"
6
+ ]
7
+ }
@@ -0,0 +1,39 @@
1
+ import * as React from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { MenuPicker } from "@elliemae/ds-legacy-icons";
4
+ import { PropTypes } from "@elliemae/ds-legacy-props-helpers";
5
+ const defaultProps = {
6
+ apps: [],
7
+ customApps: [],
8
+ sectionTitle: "APPLICATIONS",
9
+ customSectionTitle: "CUSTOM APPLICATIONS",
10
+ icon: () => /* @__PURE__ */ jsx(MenuPicker, { color: ["brand-primary", "700"], size: "m" })
11
+ };
12
+ const DSAppPickerPropTypes = {
13
+ apps: PropTypes.array.description(
14
+ "Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"
15
+ ).isRequired,
16
+ customApps: PropTypes.array.description(
17
+ "Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"
18
+ ),
19
+ sectionTitle: PropTypes.string.description("main section title").defaultValue("APPLICATIONS"),
20
+ customSectionTitle: PropTypes.string.description("custom section title").defaultValue("CUSTOM APPLICATIONS"),
21
+ icon: PropTypes.func.description("trigger button s icon").defaultValue(MenuPicker),
22
+ renderTrigger: PropTypes.func.description("Custom trigger component."),
23
+ actionRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(
24
+ "Ref containing a focusToIndex method. This method allows you to focus any App inside the AppPicker."
25
+ ),
26
+ isOpen: PropTypes.bool.description("Wether the AppPicker should be open or not."),
27
+ onClose: PropTypes.func.description("Callback function when the AppPicker closes"),
28
+ onKeyDown: PropTypes.func.description("OnKeyDown handler callback."),
29
+ onClick: PropTypes.func.description("Custom onClick for Trigger component."),
30
+ onClickOutside: PropTypes.func.description("Callback event when the user clicks outside the App Picker."),
31
+ triggerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ current: PropTypes.any })]).description(
32
+ "Ref to the trigger button."
33
+ )
34
+ };
35
+ export {
36
+ DSAppPickerPropTypes,
37
+ defaultProps
38
+ };
39
+ //# sourceMappingURL=react-desc-prop-types.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 type { WeakValidationMap } from 'react';\nimport { MenuPicker } from '@elliemae/ds-legacy-icons';\nimport type { SvgIconT } from '@elliemae/ds-legacy-icons';\nimport type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-legacy-props-helpers';\nimport { PropTypes } from '@elliemae/ds-legacy-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 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 WeakValidationMap<unknown>;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACgET;AA9Dd,SAAS,kBAAkB;AAG3B,SAAS,iBAAiB;AAsDnB,MAAM,eAA0C;AAAA,EACrD,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,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
+ "names": []
7
+ }
@@ -0,0 +1,47 @@
1
+ import * as React from "react";
2
+ import { styled } from "@elliemae/ds-legacy-system";
3
+ import { Grid } from "@elliemae/ds-legacy-grid";
4
+ import { DSAppPickerName, DSAppPickerSlots } from "./DSAppPickerDefinitions.js";
5
+ const StyledWrapper = styled(Grid, { name: DSAppPickerName, slot: DSAppPickerSlots.ROOT })`
6
+ align-items: center;
7
+ min-width: 308px;
8
+ min-height: 110px;
9
+ max-height: 449px;
10
+ width: 308px;
11
+ overflow-y: auto;
12
+ overflow-x: hidden;
13
+ margin: 0;
14
+ padding: ${({ isOverflow }) => isOverflow ? "0 0 8px 16px" : "0 16px 8px 16px"};
15
+ &:focus {
16
+ outline: none;
17
+ }
18
+ `;
19
+ const StyledListItem = styled("li", { name: DSAppPickerName, slot: DSAppPickerSlots.ITEM })`
20
+ list-style: none;
21
+ `;
22
+ const StyledListItemFullRow = styled("li", { name: DSAppPickerName, slot: DSAppPickerSlots.ROW })`
23
+ list-style: none;
24
+ grid-column: 1/4;
25
+ `;
26
+ const StyledTitle = styled("h3", { name: DSAppPickerName, slot: DSAppPickerSlots.TITLE })`
27
+ color: ${({ theme }) => theme.colors.neutral[700]};
28
+ font-size: ${({ theme }) => theme.fontSizes.value[400]};
29
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
30
+ margin: 12px 0 8px 0;
31
+ line-height: 1.385;
32
+ text-transform: uppercase;
33
+ `;
34
+ const StyledSeparator = styled("hr", { name: DSAppPickerName, slot: DSAppPickerSlots.SEPARATOR })`
35
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral[100]};
36
+ border-bottom: none;
37
+ width: 99%;
38
+ margin: 8px 0 0 0;
39
+ `;
40
+ export {
41
+ StyledListItem,
42
+ StyledListItemFullRow,
43
+ StyledSeparator,
44
+ StyledTitle,
45
+ StyledWrapper
46
+ };
47
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/styles.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable max-lines */\nimport { styled } from '@elliemae/ds-legacy-system';\nimport { Grid } from '@elliemae/ds-legacy-grid';\nimport { DSAppPickerName, DSAppPickerSlots } from './DSAppPickerDefinitions.js';\n\nexport const StyledWrapper = styled(Grid, { name: DSAppPickerName, slot: DSAppPickerSlots.ROOT })<{\n isOverflow: boolean;\n}>`\n align-items: center;\n min-width: 308px;\n min-height: 110px;\n max-height: 449px;\n width: 308px;\n overflow-y: auto;\n overflow-x: hidden;\n margin: 0;\n padding: ${({ isOverflow }) => (isOverflow ? '0 0 8px 16px' : '0 16px 8px 16px')};\n &:focus {\n outline: none;\n }\n`;\n\nexport const StyledListItem = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ITEM })`\n list-style: none;\n`;\n\nexport const StyledListItemFullRow = styled('li', { name: DSAppPickerName, slot: DSAppPickerSlots.ROW })`\n list-style: none;\n grid-column: 1/4;\n`;\n\nexport const StyledTitle = styled('h3', { name: DSAppPickerName, slot: DSAppPickerSlots.TITLE })`\n color: ${({ theme }) => theme.colors.neutral[700]};\n font-size: ${({ theme }) => theme.fontSizes.value[400]};\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n margin: 12px 0 8px 0;\n line-height: 1.385;\n text-transform: uppercase;\n`;\n\nexport const StyledSeparator = styled('hr', { name: DSAppPickerName, slot: DSAppPickerSlots.SEPARATOR })`\n border-top: 1px solid ${({ theme }) => theme.colors.neutral[100]};\n border-bottom: none;\n width: 99%;\n margin: 8px 0 0 0;\n`;\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,iBAAiB,wBAAwB;AAE3C,MAAM,gBAAgB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,KAAK,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWnF,CAAC,EAAE,WAAW,MAAO,aAAa,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAMzD,MAAM,iBAAiB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,KAAK,CAAC;AAAA;AAAA;AAI1F,MAAM,wBAAwB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,IAAI,CAAC;AAAA;AAAA;AAAA;AAKhG,MAAM,cAAc,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,MAAM,CAAC;AAAA,WACpF,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA,eACnC,CAAC,EAAE,MAAM,MAAM,MAAM,UAAU,MAAM,GAAG;AAAA,iBACtC,CAAC,EAAE,MAAM,MAAM,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAM3C,MAAM,kBAAkB,OAAO,MAAM,EAAE,MAAM,iBAAiB,MAAM,iBAAiB,UAAU,CAAC;AAAA,0BAC7E,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,QAAQ,GAAG;AAAA;AAAA;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+ const keys = {
3
+ LEFT: "ArrowLeft",
4
+ UP: "ArrowUp",
5
+ RIGHT: "ArrowRight",
6
+ DOWN: "ArrowDown",
7
+ ENTER: "Enter",
8
+ SPACE: "",
9
+ TAB: "Tab",
10
+ ESC: "Escape",
11
+ HOME: "Home",
12
+ END: "End"
13
+ };
14
+ const focusSelectedOrFirstAvailable = (wrapperRef, allFocusableButtonsRef, selectedButtonRef) => {
15
+ if (selectedButtonRef.current !== null) {
16
+ wrapperRef?.current?.querySelectorAll("button")[selectedButtonRef.current].focus();
17
+ } else {
18
+ allFocusableButtonsRef?.[0]?.focus();
19
+ }
20
+ };
21
+ export {
22
+ focusSelectedOrFirstAvailable,
23
+ keys
24
+ };
25
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/utils.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type React from 'react';\n\nexport const keys = {\n LEFT: 'ArrowLeft',\n UP: 'ArrowUp',\n RIGHT: 'ArrowRight',\n DOWN: 'ArrowDown',\n ENTER: 'Enter',\n SPACE: '',\n TAB: 'Tab',\n ESC: 'Escape',\n HOME: 'Home',\n END: 'End',\n};\n\nexport const focusSelectedOrFirstAvailable = (\n wrapperRef: React.RefObject<HTMLDivElement>,\n allFocusableButtonsRef: HTMLButtonElement[],\n selectedButtonRef: React.MutableRefObject<number | null>,\n) => {\n if (selectedButtonRef.current !== null) {\n wrapperRef?.current?.querySelectorAll('button')[selectedButtonRef.current].focus();\n } else {\n allFocusableButtonsRef?.[0]?.focus();\n }\n};\n"],
5
+ "mappings": "AAAA,YAAY,WAAW;ACEhB,MAAM,OAAO;AAAA,EAClB,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AACP;AAEO,MAAM,gCAAgC,CAC3C,YACA,wBACA,sBACG;AACH,MAAI,kBAAkB,YAAY,MAAM;AACtC,gBAAY,SAAS,iBAAiB,QAAQ,EAAE,kBAAkB,OAAO,EAAE,MAAM;AAAA,EACnF,OAAO;AACL,6BAAyB,CAAC,GAAG,MAAM;AAAA,EACrC;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { DSAppPickerT } from './react-desc-prop-types.js';
3
+ interface AppPickerImplProps extends Omit<DSAppPickerT.InternalProps, 'onClose' | 'icon' | 'onClick' | 'onClickOutside' | 'renderTrigger' | 'isOpen'> {
4
+ close: () => void;
5
+ wrapperRef: React.RefObject<HTMLDivElement>;
6
+ isOverflow: boolean;
7
+ wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;
8
+ triggerIsInternal: boolean;
9
+ }
10
+ declare const AppPickerImpl: React.ComponentType<AppPickerImplProps>;
11
+ export default AppPickerImpl;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { DSAppPickerT } from './react-desc-prop-types.js';
3
+ declare const DSAppPicker: React.ComponentType<DSAppPickerT.Props>;
4
+ declare const AppPickerWithSchema: import("@elliemae/ds-legacy-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSAppPickerT.Props>;
5
+ export { DSAppPicker, AppPickerWithSchema };
6
+ export default DSAppPicker;
@@ -0,0 +1,15 @@
1
+ export declare const DSAppPickerName = "DSAppPicker";
2
+ export declare const DSAppPickerSlots: {
3
+ ROOT: string;
4
+ TITLE: string;
5
+ SEPARATOR: string;
6
+ ROW: string;
7
+ ITEM: string;
8
+ };
9
+ export declare const DSAppPickerDataTestIds: {
10
+ TRIGGER: string;
11
+ WRAPPER: string;
12
+ CHIP: string;
13
+ MAIN_TITLE: string;
14
+ CUSTOM_TITLE: string;
15
+ };
@@ -0,0 +1,13 @@
1
+ import type React from 'react';
2
+ import type { DSAppPickerT } from '../react-desc-prop-types.js';
3
+ interface UseKeepTrackButtonsT {
4
+ wrapperRef: React.RefObject<HTMLDivElement>;
5
+ wasOpenedByKeyboardRef: React.MutableRefObject<boolean>;
6
+ actionRef?: DSAppPickerT.ActionRef;
7
+ triggerIsInternal?: boolean;
8
+ }
9
+ export declare const useKeepTrackButtons: ({ wrapperRef, wasOpenedByKeyboardRef, actionRef, triggerIsInternal, }: UseKeepTrackButtonsT) => {
10
+ allFocusableButtons: HTMLButtonElement[];
11
+ selectedButton: React.MutableRefObject<number | null>;
12
+ };
13
+ export {};
@@ -0,0 +1,4 @@
1
+ export { DSAppPicker, AppPickerWithSchema } from './DSAppPicker.js';
2
+ export { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from './DSAppPickerDefinitions.js';
3
+ export type { DSAppPickerT } from './react-desc-prop-types.js';
4
+ export { default } from './DSAppPicker.js';
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import type { SvgIconT } from '@elliemae/ds-legacy-icons';
3
+ import type { GlobalAttributesT, XstyledProps } from '@elliemae/ds-legacy-props-helpers';
4
+ export declare namespace DSAppPickerT {
5
+ interface AppItem {
6
+ label: string;
7
+ icon: React.ComponentType<{
8
+ className: string;
9
+ size: string;
10
+ }>;
11
+ onClick?: (e: React.MouseEvent, item: AppItem) => void | null;
12
+ disabled?: boolean;
13
+ id?: string;
14
+ selected?: boolean;
15
+ }
16
+ type ActionRef = React.MutableRefObject<{
17
+ focusToIndex?: (index: number) => void;
18
+ focusSelectedOrFirstAvailable?: () => void;
19
+ focusWrapper: () => void;
20
+ }>;
21
+ interface DefaultProps {
22
+ apps: AppItem[];
23
+ customApps: AppItem[];
24
+ sectionTitle: string;
25
+ customSectionTitle: string;
26
+ icon: React.ComponentType<SvgIconT.Props>;
27
+ }
28
+ interface RenderTriggerProp {
29
+ ref: React.MutableRefObject<HTMLButtonElement>;
30
+ [key: string]: unknown;
31
+ }
32
+ interface OptionalProps {
33
+ onClose?: () => void;
34
+ onClick?: (e: React.MouseEvent | React.KeyboardEvent) => void;
35
+ onClickOutside?: (e: React.MouseEvent) => void;
36
+ onKeyDown?: (e: React.KeyboardEvent) => void;
37
+ actionRef?: ActionRef;
38
+ renderTrigger?: React.ComponentType<RenderTriggerProp>;
39
+ isOpen?: boolean;
40
+ triggerRef?: React.RefObject<HTMLButtonElement>;
41
+ }
42
+ interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>, XstyledProps {
43
+ }
44
+ interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>, XstyledProps {
45
+ }
46
+ }
47
+ export declare const defaultProps: DSAppPickerT.DefaultProps;
48
+ export declare const DSAppPickerPropTypes: React.WeakValidationMap<unknown>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledWrapper: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("@elliemae/ds-legacy-grid").DSGridT.Props & import("react").RefAttributes<HTMLDivElement>>, import("@elliemae/ds-legacy-system").Theme, {
3
+ isOverflow: boolean;
4
+ } & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
5
+ export declare const StyledListItem: import("styled-components").StyledComponent<"li", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
6
+ export declare const StyledListItemFullRow: import("styled-components").StyledComponent<"li", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
7
+ export declare const StyledTitle: import("styled-components").StyledComponent<"h3", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
8
+ export declare const StyledSeparator: import("styled-components").StyledComponent<"hr", import("@elliemae/ds-legacy-system").Theme, object & import("@elliemae/ds-legacy-system").OwnerInterface, never>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import type React from 'react';
2
+ export declare const keys: {
3
+ LEFT: string;
4
+ UP: string;
5
+ RIGHT: string;
6
+ DOWN: string;
7
+ ENTER: string;
8
+ SPACE: string;
9
+ TAB: string;
10
+ ESC: string;
11
+ HOME: string;
12
+ END: string;
13
+ };
14
+ export declare const focusSelectedOrFirstAvailable: (wrapperRef: React.RefObject<HTMLDivElement>, allFocusableButtonsRef: HTMLButtonElement[], selectedButtonRef: React.MutableRefObject<number | null>) => void;
package/package.json ADDED
@@ -0,0 +1,97 @@
1
+ {
2
+ "name": "@elliemae/ds-legacy-app-picker",
3
+ "version": "1.0.0-rc.1",
4
+ "license": "MIT",
5
+ "description": "ICE MT - Dimsum - App Picker",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
16
+ },
17
+ "./utils": {
18
+ "import": "./dist/esm/utils.js",
19
+ "require": "./dist/cjs/utils.js"
20
+ },
21
+ "./types/AppPickerTypes": {
22
+ "import": "./dist/esm/types/AppPickerTypes.js",
23
+ "require": "./dist/cjs/types/AppPickerTypes.js"
24
+ },
25
+ "./styles": {
26
+ "import": "./dist/esm/styles.js",
27
+ "require": "./dist/cjs/styles.js"
28
+ },
29
+ "./propTypes": {
30
+ "import": "./dist/esm/propTypes.js",
31
+ "require": "./dist/cjs/propTypes.js"
32
+ },
33
+ "./DSAppPicker": {
34
+ "import": "./dist/esm/DSAppPicker.js",
35
+ "require": "./dist/cjs/DSAppPicker.js"
36
+ },
37
+ "./AppPickerImpl": {
38
+ "import": "./dist/esm/AppPickerImpl.js",
39
+ "require": "./dist/cjs/AppPickerImpl.js"
40
+ }
41
+ },
42
+ "sideEffects": [
43
+ "*.css",
44
+ "*.scss"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "https://git.elliemae.io/platform-ui/dimsum-legacy.git"
49
+ },
50
+ "engines": {
51
+ "pnpm": ">=6",
52
+ "node": ">=16"
53
+ },
54
+ "author": "ICE MT",
55
+ "jestSonar": {
56
+ "sonar56x": true,
57
+ "reportPath": "reports",
58
+ "reportFile": "tests.xml",
59
+ "indent": 4
60
+ },
61
+ "dependencies": {
62
+ "@elliemae/ds-legacy-button-v2": "1.0.0-rc.1",
63
+ "@elliemae/ds-legacy-chip": "1.0.0-rc.1",
64
+ "@elliemae/ds-legacy-grid": "1.0.0-rc.1",
65
+ "@elliemae/ds-legacy-popover": "1.0.0-rc.1",
66
+ "@elliemae/ds-legacy-icons": "1.0.0-rc.1",
67
+ "@elliemae/ds-legacy-props-helpers": "1.0.0-rc.1",
68
+ "@elliemae/ds-legacy-utilities": "1.0.0-rc.1",
69
+ "@elliemae/ds-legacy-system": "1.0.0-rc.1"
70
+ },
71
+ "devDependencies": {
72
+ "@elliemae/pui-cli": "~9.0.0-next.31",
73
+ "styled-components": "~5.3.9",
74
+ "@elliemae/ds-legacy-monorepo-devops": "1.0.0-rc.1"
75
+ },
76
+ "peerDependencies": {
77
+ "lodash": "^4.17.21",
78
+ "react": "^17.0.2",
79
+ "react-dom": "^17.0.2",
80
+ "styled-components": "~5.3.9"
81
+ },
82
+ "publishConfig": {
83
+ "access": "public",
84
+ "typeSafety": false
85
+ },
86
+ "scripts": {
87
+ "dev": "cross-env NODE_ENV=development node ../../../scripts/build/build.mjs --watch",
88
+ "test": "pui-cli test --passWithNoTests",
89
+ "lint": "node ../../../scripts/lint.mjs",
90
+ "eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../../.eslintrc.js' src/",
91
+ "dts": "node ../../../scripts/dts.mjs",
92
+ "build": "cross-env NODE_ENV=production node ../../../scripts/build/build.mjs",
93
+ "dev:build": "pnpm --filter {.}... build",
94
+ "dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
95
+ "checkDeps": "npm exec ../../util/ds-codemods -- check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
96
+ }
97
+ }