@elliemae/ds-app-picker 3.70.0-next.3 → 3.70.0-next.30
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/DSAppPicker.js +59 -132
- package/dist/cjs/DSAppPicker.js.map +3 -3
- package/dist/cjs/{utils.js → DSAppPickerCTX.js} +26 -23
- package/dist/cjs/DSAppPickerCTX.js.map +7 -0
- package/dist/cjs/config/useAppPicker.js +3 -3
- package/dist/cjs/config/useAppPicker.js.map +3 -3
- package/dist/cjs/config/useAppPickerBehavior.js +156 -0
- package/dist/cjs/config/useAppPickerBehavior.js.map +7 -0
- package/dist/cjs/config/useFocusTracker.js +115 -0
- package/dist/cjs/config/useFocusTracker.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +45 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +8 -1
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/parts/AppPanel.js +159 -0
- package/dist/cjs/parts/AppPanel.js.map +7 -0
- package/dist/cjs/parts/AppPickerItem.js +102 -0
- package/dist/cjs/parts/AppPickerItem.js.map +7 -0
- package/dist/cjs/parts/AppSection.js +68 -0
- package/dist/cjs/parts/AppSection.js.map +7 -0
- package/dist/cjs/parts/Trigger.js +62 -0
- package/dist/cjs/parts/Trigger.js.map +7 -0
- package/dist/cjs/{styles.js → parts/style.js} +21 -9
- package/dist/cjs/parts/style.js.map +7 -0
- package/dist/cjs/react-desc-prop-types.js +6 -7
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js +5 -0
- package/dist/cjs/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/esm/DSAppPicker.js +62 -135
- package/dist/esm/DSAppPicker.js.map +2 -2
- package/dist/esm/DSAppPickerCTX.js +28 -0
- package/dist/esm/DSAppPickerCTX.js.map +7 -0
- package/dist/esm/config/useAppPicker.js +4 -5
- package/dist/esm/config/useAppPicker.js.map +3 -3
- package/dist/esm/config/useAppPickerBehavior.js +126 -0
- package/dist/esm/config/useAppPickerBehavior.js.map +7 -0
- package/dist/esm/config/useFocusTracker.js +85 -0
- package/dist/esm/config/useFocusTracker.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +15 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +8 -1
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/parts/AppPanel.js +129 -0
- package/dist/esm/parts/AppPanel.js.map +7 -0
- package/dist/esm/parts/AppPickerItem.js +72 -0
- package/dist/esm/parts/AppPickerItem.js.map +7 -0
- package/dist/esm/parts/AppSection.js +38 -0
- package/dist/esm/parts/AppSection.js.map +7 -0
- package/dist/esm/parts/Trigger.js +32 -0
- package/dist/esm/parts/Trigger.js.map +7 -0
- package/dist/esm/{styles.js → parts/style.js} +18 -6
- package/dist/esm/parts/style.js.map +7 -0
- package/dist/esm/react-desc-prop-types.js +12 -8
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js +5 -0
- package/dist/esm/typescript-testing/typescript-app-picker-valid.js.map +2 -2
- package/dist/types/DSAppPicker.d.ts +0 -1
- package/dist/types/DSAppPickerCTX.d.ts +17 -0
- package/dist/types/config/useAppPicker.d.ts +5 -5
- package/dist/types/config/useAppPickerBehavior.d.ts +39 -0
- package/dist/types/config/useFocusTracker.d.ts +15 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +14 -7
- package/dist/types/parts/AppPanel.d.ts +9 -0
- package/dist/types/parts/AppPickerItem.d.ts +14 -0
- package/dist/types/parts/AppSection.d.ts +17 -0
- package/dist/types/parts/Trigger.d.ts +15 -0
- package/dist/types/{styles.d.ts → parts/style.d.ts} +3 -4
- package/dist/types/react-desc-prop-types.d.ts +21 -8
- package/dist/types/tests/app-picker.get-owner-props-arguments-18354.test.d.ts +1 -0
- package/dist/types/tests/app-picker.proptype-schema.test.d.ts +1 -0
- package/dist/types/tests/app-picker.pui-18354.test.d.ts +1 -0
- package/dist/types/tests/playwright/DSAppPicker.slot-contracts-dynamic.test.playwright.d.ts +1 -0
- package/dist/types/tests/playwright/DSAppPickerSlotContractRenderer.d.ts +1 -0
- package/package.json +16 -14
- package/dist/cjs/AppPickerImpl.js +0 -204
- package/dist/cjs/AppPickerImpl.js.map +0 -7
- package/dist/cjs/hooks/useKeepTrackButtons.js +0 -69
- package/dist/cjs/hooks/useKeepTrackButtons.js.map +0 -7
- package/dist/cjs/styles.js.map +0 -7
- package/dist/cjs/utils.js.map +0 -7
- package/dist/esm/AppPickerImpl.js +0 -174
- package/dist/esm/AppPickerImpl.js.map +0 -7
- package/dist/esm/hooks/useKeepTrackButtons.js +0 -39
- package/dist/esm/hooks/useKeepTrackButtons.js.map +0 -7
- package/dist/esm/styles.js.map +0 -7
- package/dist/esm/utils.js +0 -25
- package/dist/esm/utils.js.map +0 -7
- package/dist/types/AppPickerImpl.d.ts +0 -11
- package/dist/types/hooks/useKeepTrackButtons.d.ts +0 -13
- package/dist/types/utils.d.ts +0 -14
- /package/dist/types/tests/{app-picker.get-owner-props.test.d.ts → app-picker.api.test.d.ts} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
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 Trigger_exports = {};
|
|
30
|
+
__export(Trigger_exports, {
|
|
31
|
+
Trigger: () => Trigger
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Trigger_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_ds_button_v2 = require("@elliemae/ds-button-v2");
|
|
37
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
38
|
+
var import_constants = require("../constants/index.js");
|
|
39
|
+
const StyledButton = (0, import_ds_system.styled)(import_ds_button_v2.DSButtonV3, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.BUTTON })``;
|
|
40
|
+
const Trigger = ({ Icon, isOpen, setRef, ownerProps, onClick, renderTrigger }) => {
|
|
41
|
+
if (renderTrigger) {
|
|
42
|
+
return renderTrigger({ ref: setRef });
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
|
+
StyledButton,
|
|
46
|
+
{
|
|
47
|
+
"data-testid": import_constants.DSAppPickerDataTestIds.BUTTON,
|
|
48
|
+
id: "app-picker__button",
|
|
49
|
+
buttonType: "icon",
|
|
50
|
+
"aria-haspopup": "true",
|
|
51
|
+
"aria-expanded": isOpen,
|
|
52
|
+
"aria-label": "Application picker",
|
|
53
|
+
innerRef: setRef,
|
|
54
|
+
onClick,
|
|
55
|
+
getOwnerProps: ownerProps.getOwnerProps,
|
|
56
|
+
getOwnerPropsArguments: ownerProps.getOwnerPropsArguments,
|
|
57
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {})
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
Trigger.displayName = "DSAppPicker.Trigger";
|
|
62
|
+
//# sourceMappingURL=Trigger.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/Trigger.tsx", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { DSButtonV3 } from '@elliemae/ds-button-v2';\nimport { styled } from '@elliemae/ds-system';\nimport type { DSAppPickerT } from '../react-desc-prop-types.js';\nimport { DSAppPickerName, DSAppPickerSlots, DSAppPickerDataTestIds } from '../constants/index.js';\n\nconst StyledButton = styled(DSButtonV3, { name: DSAppPickerName, slot: DSAppPickerSlots.BUTTON })``;\n\ninterface TriggerProps {\n Icon: DSAppPickerT.InternalProps['icon'];\n isOpen: boolean;\n setRef: React.RefCallback<HTMLButtonElement>;\n ownerProps: { getOwnerProps: () => object; getOwnerPropsArguments: () => object };\n onClick: (e: React.MouseEvent | React.KeyboardEvent) => void;\n renderTrigger?: DSAppPickerT.OptionalProps['renderTrigger'];\n}\n\nexport const Trigger: React.FC<TriggerProps> = ({ Icon, isOpen, setRef, ownerProps, onClick, renderTrigger }) => {\n if (renderTrigger) {\n // Plain function call (not React element) preserves the legacy DSPopover render-prop contract:\n // consumers receive `ref` as a regular prop, no forwardRef required.\n return renderTrigger({ ref: setRef });\n }\n return (\n <StyledButton\n data-testid={DSAppPickerDataTestIds.BUTTON}\n id=\"app-picker__button\"\n buttonType=\"icon\"\n aria-haspopup=\"true\"\n aria-expanded={isOpen}\n aria-label=\"Application picker\"\n innerRef={setRef}\n onClick={onClick}\n getOwnerProps={ownerProps.getOwnerProps}\n getOwnerPropsArguments={ownerProps.getOwnerPropsArguments}\n >\n <Icon />\n </StyledButton>\n );\n};\n\nTrigger.displayName = 'DSAppPicker.Trigger';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADoCjB;AAnCN,0BAA2B;AAC3B,uBAAuB;AAEvB,uBAA0E;AAE1E,MAAM,mBAAe,yBAAO,gCAAY,EAAE,MAAM,kCAAiB,MAAM,kCAAiB,OAAO,CAAC;AAWzF,MAAM,UAAkC,CAAC,EAAE,MAAM,QAAQ,QAAQ,YAAY,SAAS,cAAc,MAAM;AAC/G,MAAI,eAAe;AAGjB,WAAO,cAAc,EAAE,KAAK,OAAO,CAAC;AAAA,EACtC;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa,wCAAuB;AAAA,MACpC,IAAG;AAAA,MACH,YAAW;AAAA,MACX,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,cAAW;AAAA,MACX,UAAU;AAAA,MACV;AAAA,MACA,eAAe,WAAW;AAAA,MAC1B,wBAAwB,WAAW;AAAA,MAEnC,sDAAC,QAAK;AAAA;AAAA,EACR;AAEJ;AAEA,QAAQ,cAAc;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -26,28 +26,39 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var style_exports = {};
|
|
30
|
+
__export(style_exports, {
|
|
31
|
+
StyledAppPickerFloating: () => StyledAppPickerFloating,
|
|
31
32
|
StyledListItem: () => StyledListItem,
|
|
32
33
|
StyledListItemFullRow: () => StyledListItemFullRow,
|
|
33
34
|
StyledSeparator: () => StyledSeparator,
|
|
34
35
|
StyledTitle: () => StyledTitle,
|
|
35
36
|
StyledWrapper: () => StyledWrapper
|
|
36
37
|
});
|
|
37
|
-
module.exports = __toCommonJS(
|
|
38
|
+
module.exports = __toCommonJS(style_exports);
|
|
38
39
|
var React = __toESM(require("react"));
|
|
39
40
|
var import_ds_system = require("@elliemae/ds-system");
|
|
40
41
|
var import_ds_grid = require("@elliemae/ds-grid");
|
|
41
|
-
var
|
|
42
|
+
var import_ds_typography = require("@elliemae/ds-typography");
|
|
43
|
+
var import_ds_floating_context = require("@elliemae/ds-floating-context");
|
|
44
|
+
var import_constants = require("../constants/index.js");
|
|
45
|
+
const StyledAppPickerFloating = (0, import_ds_system.styled)(import_ds_floating_context.FloatingWrapper, {
|
|
46
|
+
name: import_constants.DSAppPickerName,
|
|
47
|
+
slot: import_constants.DSAppPickerSlots.FLOATING_WRAPPER
|
|
48
|
+
})``;
|
|
42
49
|
const StyledWrapper = (0, import_ds_system.styled)(import_ds_grid.Grid, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.ROOT })`
|
|
50
|
+
background-color: ${({ theme }) => theme.colors.neutral["000"]};
|
|
43
51
|
min-width: 308px;
|
|
44
52
|
min-height: 110px;
|
|
45
53
|
max-height: 449px;
|
|
46
54
|
width: 308px;
|
|
47
55
|
overflow-y: auto;
|
|
48
56
|
overflow-x: hidden;
|
|
57
|
+
/* Baseline 2024: reserve scrollbar gutter so the layout doesn't shift between overflow/no-overflow.
|
|
58
|
+
Replaces a JS isOverflow detection effect that toggled right padding. */
|
|
59
|
+
scrollbar-gutter: stable;
|
|
49
60
|
margin: 0;
|
|
50
|
-
padding:
|
|
61
|
+
padding: 0 0 8px 16px;
|
|
51
62
|
&:focus {
|
|
52
63
|
outline: none;
|
|
53
64
|
}
|
|
@@ -59,18 +70,19 @@ const StyledListItemFullRow = (0, import_ds_system.styled)("li", { name: import_
|
|
|
59
70
|
list-style: none;
|
|
60
71
|
grid-column: 1/4;
|
|
61
72
|
`;
|
|
62
|
-
const StyledTitle = (0, import_ds_system.styled)(
|
|
73
|
+
const StyledTitle = (0, import_ds_system.styled)(import_ds_typography.DSTypography, { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.TITLE })`
|
|
63
74
|
color: ${({ theme }) => theme.colors.neutral[700]};
|
|
64
75
|
font-size: ${({ theme }) => theme.fontSizes.value[400]};
|
|
65
76
|
font-weight: ${({ theme }) => theme.fontWeights.semibold};
|
|
66
77
|
margin: 12px 0 8px 0;
|
|
67
78
|
line-height: 1.385;
|
|
68
79
|
text-transform: uppercase;
|
|
80
|
+
text-align: center;
|
|
69
81
|
`;
|
|
70
82
|
const StyledSeparator = (0, import_ds_system.styled)("hr", { name: import_constants.DSAppPickerName, slot: import_constants.DSAppPickerSlots.SEPARATOR })`
|
|
71
|
-
border-top: 1px solid ${({ theme }) => theme.colors.neutral[
|
|
83
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral[300]};
|
|
72
84
|
border-bottom: none;
|
|
73
|
-
width:
|
|
85
|
+
width: 100%;
|
|
74
86
|
margin: 8px 0 0 0;
|
|
75
87
|
`;
|
|
76
|
-
//# sourceMappingURL=
|
|
88
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/parts/style.ts", "../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport { styled } from '@elliemae/ds-system';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSTypography } from '@elliemae/ds-typography';\nimport { FloatingWrapper } from '@elliemae/ds-floating-context';\nimport { DSAppPickerName, DSAppPickerSlots } from '../constants/index.js';\n\nexport const StyledAppPickerFloating = styled(FloatingWrapper, {\n name: DSAppPickerName,\n slot: DSAppPickerSlots.FLOATING_WRAPPER,\n})``;\n\nexport const StyledWrapper = styled(Grid, { name: DSAppPickerName, slot: DSAppPickerSlots.ROOT })`\n background-color: ${({ theme }) => theme.colors.neutral['000']};\n min-width: 308px;\n min-height: 110px;\n max-height: 449px;\n width: 308px;\n overflow-y: auto;\n overflow-x: hidden;\n /* Baseline 2024: reserve scrollbar gutter so the layout doesn't shift between overflow/no-overflow.\n Replaces a JS isOverflow detection effect that toggled right padding. */\n scrollbar-gutter: stable;\n margin: 0;\n padding: 0 0 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(DSTypography, { 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 text-align: center;\n`;\n\nexport const StyledSeparator = styled('hr', { name: DSAppPickerName, slot: DSAppPickerSlots.SEPARATOR })`\n border-top: 1px solid ${({ theme }) => theme.colors.neutral[300]};\n border-bottom: none;\n width: 100%;\n margin: 8px 0 0 0;\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;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toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var react_desc_prop_types_exports = {};
|
|
30
30
|
__export(react_desc_prop_types_exports, {
|
|
31
31
|
DSAppPickerPropTypes: () => DSAppPickerPropTypes,
|
|
32
|
+
DSAppPickerPropTypesSchema: () => DSAppPickerPropTypesSchema,
|
|
32
33
|
defaultProps: () => defaultProps
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
@@ -38,7 +39,6 @@ var import_ds_icons = require("@elliemae/ds-icons");
|
|
|
38
39
|
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
39
40
|
var import_constants = require("./constants/index.js");
|
|
40
41
|
const defaultProps = {
|
|
41
|
-
// export const defaultProps: DSAppPickerT.DefaultProps = {
|
|
42
42
|
apps: [],
|
|
43
43
|
customApps: [],
|
|
44
44
|
sectionTitle: "APPLICATIONS",
|
|
@@ -47,12 +47,10 @@ const defaultProps = {
|
|
|
47
47
|
};
|
|
48
48
|
const DSAppPickerPropTypes = {
|
|
49
49
|
...(0, import_ds_props_helpers.getPropsPerSlotPropTypes)(import_constants.DSAppPickerName, import_constants.DSAppPickerSlots),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
).
|
|
53
|
-
customApps: import_ds_props_helpers.PropTypes.array.description(
|
|
54
|
-
"Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]"
|
|
55
|
-
),
|
|
50
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
51
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
52
|
+
apps: import_ds_props_helpers.PropTypes.array.description("Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]").defaultValue([]),
|
|
53
|
+
customApps: import_ds_props_helpers.PropTypes.array.description("Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]").defaultValue([]),
|
|
56
54
|
sectionTitle: import_ds_props_helpers.PropTypes.string.description("main section title").defaultValue("APPLICATIONS"),
|
|
57
55
|
customSectionTitle: import_ds_props_helpers.PropTypes.string.description("custom section title").defaultValue("CUSTOM APPLICATIONS"),
|
|
58
56
|
icon: import_ds_props_helpers.PropTypes.func.description("trigger button s icon").defaultValue(import_ds_icons.MenuPicker),
|
|
@@ -69,4 +67,5 @@ const DSAppPickerPropTypes = {
|
|
|
69
67
|
"Ref to the trigger button."
|
|
70
68
|
)
|
|
71
69
|
};
|
|
70
|
+
const DSAppPickerPropTypesSchema = DSAppPickerPropTypes;
|
|
72
71
|
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -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": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport React from 'react';\nimport { MenuPicker } from '@elliemae/ds-icons';\nimport type { SvgIconT } from '@elliemae/ds-icons';\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema, ValidationMap } from '@elliemae/ds-props-helpers';\nimport {\n PropTypes,\n getPropsPerSlotPropTypes,\n globalAttributesPropTypes,\n xstyledPropTypes,\n} from '@elliemae/ds-props-helpers';\nimport type { TypescriptHelpersT } from '@elliemae/ds-typescript-helpers';\nimport { DSAppPickerName, DSAppPickerSlots } from './constants/index.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 wrapText?: 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 RequiredProps {}\n\n export type SlotFunctionArguments = {\n dsApppickerRoot: () => object;\n dsApppickerItem: () => object;\n dsApppickerTitle: () => object;\n dsApppickerSeparator: () => object;\n dsApppickerRow: () => object;\n dsApppickerChip: () => object;\n dsApppickerButton: () => object;\n dsApppickerFloatingWrapper: () => object;\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.RefCallback<HTMLButtonElement>;\n [key: string]: unknown;\n }\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: MouseEvent | React.MouseEvent) => void;\n onKeyDown?: (e: React.KeyboardEvent) => void;\n actionRef?: ActionRef;\n renderTrigger?: (props: RenderTriggerProp) => React.ReactElement | null;\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 RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<GlobalAttributesT<HTMLDivElement>, keyof DefaultProps | keyof OptionalProps | keyof XstyledProps>,\n XstyledProps,\n RequiredProps {}\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: DSPropTypesSchema<DSAppPickerT.Props> = {\n ...getPropsPerSlotPropTypes(DSAppPickerName, DSAppPickerSlots),\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n apps: PropTypes.array\n .description('Main items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\n customApps: PropTypes.array\n .description('Custom items. Format: [{ label:string, icon:component, onClick:func, disabled:bool, selected:bool }]')\n .defaultValue([]),\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};\n\nexport const DSAppPickerPropTypesSchema = DSAppPickerPropTypes as unknown as ValidationMap<DSAppPickerT.Props>;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;AD0FT;AAxFd,sBAA2B;AAG3B,8BAKO;AAEP,uBAAkD;AAyE3C,MAAM,eAA0C;AAAA,EACrD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAo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26
|
var import__ = require("../index.js");
|
|
27
27
|
const testOptionalProps = {};
|
|
28
|
+
const testRequiredProps = {};
|
|
28
29
|
const testPartialDefaults = {
|
|
29
30
|
apps: [],
|
|
30
31
|
customApps: [],
|
|
@@ -34,10 +35,12 @@ const testPartialDefaults = {
|
|
|
34
35
|
};
|
|
35
36
|
const testProps = {
|
|
36
37
|
...testOptionalProps,
|
|
38
|
+
...testRequiredProps,
|
|
37
39
|
...testPartialDefaults
|
|
38
40
|
};
|
|
39
41
|
const testPropsAsSyntax = {
|
|
40
42
|
...testOptionalProps,
|
|
43
|
+
...testRequiredProps,
|
|
41
44
|
...testPartialDefaults
|
|
42
45
|
};
|
|
43
46
|
const testCompleteDefaults = {
|
|
@@ -49,10 +52,12 @@ const testCompleteDefaults = {
|
|
|
49
52
|
};
|
|
50
53
|
const testInternalProps = {
|
|
51
54
|
...testOptionalProps,
|
|
55
|
+
...testRequiredProps,
|
|
52
56
|
...testCompleteDefaults
|
|
53
57
|
};
|
|
54
58
|
const testInternalPropsAsSyntax = {
|
|
55
59
|
...testOptionalProps,
|
|
60
|
+
...testRequiredProps,
|
|
56
61
|
...testCompleteDefaults
|
|
57
62
|
};
|
|
58
63
|
const testExplicitDefinition = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../scripts/build/transpile/react-shim.js", "../../../src/typescript-testing/typescript-app-picker-valid.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSAppPicker } from '../index.js';\nimport type { DSAppPickerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSAppPickerT.Props;\ntype ComponentPropsInternals = DSAppPickerT.InternalProps;\ntype ComponentPropsDefaultProps = DSAppPickerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSAppPickerT.OptionalProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n} as ComponentPropsForApp;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSAppPicker {...testExplicitDefinition} />\n <DSAppPicker {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* multiple auto inference works */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* works with partial defaults */}\n </>\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */\nimport { DSAppPicker } from '../index.js';\nimport type { DSAppPickerT } from '../index.js';\n\n// test we expose the namespace and the namespace follows our deliverable conventions\ntype ComponentPropsForApp = DSAppPickerT.Props;\ntype ComponentPropsInternals = DSAppPickerT.InternalProps;\ntype ComponentPropsDefaultProps = DSAppPickerT.DefaultProps;\ntype ComponentPropsOptionalProps = DSAppPickerT.OptionalProps;\ntype ComponentPropsRequiredProps = DSAppPickerT.RequiredProps;\n\nconst testOptionalProps: ComponentPropsOptionalProps = {};\nconst testRequiredProps: ComponentPropsRequiredProps = {};\n\n// difference Props and InternalProps is that InternalProps has all the default props filled in\n// Props allows for partial defaults\nconst testPartialDefaults: Partial<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testProps: ComponentPropsForApp = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testPartialDefaults,\n};\nconst testPropsAsSyntax = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testPartialDefaults,\n} as ComponentPropsForApp;\n// InternalProps requires all defaults to be filled in\nconst testCompleteDefaults: Required<ComponentPropsDefaultProps> = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\nconst testInternalProps: ComponentPropsInternals = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testCompleteDefaults,\n};\nconst testInternalPropsAsSyntax = {\n ...testOptionalProps,\n ...testRequiredProps,\n ...testCompleteDefaults,\n} as ComponentPropsInternals;\n\n// using the explicit type definition, if there is an error, it will be marked on the key that is wrong\nconst testExplicitDefinition: ComponentPropsForApp = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n};\n\n// using the \"as\" syntax, if there is an error, it will be marking the whole object as wrong because it is not compatible with the type\nconst testInferedTypeCompatibility = {\n apps: [],\n customApps: [],\n sectionTitle: '',\n customSectionTitle: '',\n icon: () => null,\n} as ComponentPropsForApp;\n\nconst ExampleUsageComponent = () => (\n <>\n {/* works with explicitly casted props, all syntaxes */}\n <DSAppPicker {...testExplicitDefinition} />\n <DSAppPicker {...testInferedTypeCompatibility} />\n {/* works with inline values */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* multiple auto inference works */}\n <DSAppPicker apps={[]} customApps={[]} sectionTitle=\"\" customSectionTitle=\"\" icon={() => null} />\n {/* works with partial defaults */}\n </>\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAuB;ACyErB;AAxEF,eAA4B;AAU5B,MAAM,oBAAiD,CAAC;AACxD,MAAM,oBAAiD,CAAC;AAIxD,MAAM,sBAA2D;AAAA,EAC/D,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,YAAkC;AAAA,EACtC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,oBAAoB;AAAA,EACxB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAEA,MAAM,uBAA6D;AAAA,EACjE,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,oBAA6C;AAAA,EACjD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AACA,MAAM,4BAA4B;AAAA,EAChC,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL;AAGA,MAAM,yBAA+C;AAAA,EACnD,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAGA,MAAM,+BAA+B;AAAA,EACnC,MAAM,CAAC;AAAA,EACP,YAAY,CAAC;AAAA,EACb,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,MAAM,MAAM;AACd;AAEA,MAAM,wBAAwB,MAC5B,4EAEE;AAAA,8CAAC,wBAAa,GAAG,wBAAwB;AAAA,EACzC,4CAAC,wBAAa,GAAG,8BAA8B;AAAA,EAE/C,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,EAE/F,4CAAC,wBAAY,MAAM,CAAC,GAAG,YAAY,CAAC,GAAG,cAAa,IAAG,oBAAmB,IAAG,MAAM,MAAM,MAAM;AAAA,GAEjG;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/DSAppPicker.js
CHANGED
|
@@ -1,153 +1,80 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect, useMemo, useRef, useCallback } from "react";
|
|
4
|
-
import { DSButtonV2 } from "@elliemae/ds-button-v2";
|
|
5
|
-
import { mergeRefs, styled } from "@elliemae/ds-system";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
3
|
import { describe } from "@elliemae/ds-props-helpers";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import { DSAppPickerName
|
|
4
|
+
import { PopoverArrow } from "@elliemae/ds-floating-context";
|
|
5
|
+
import { AppPanel } from "./parts/AppPanel.js";
|
|
6
|
+
import { DSAppPickerPropTypesSchema } from "./react-desc-prop-types.js";
|
|
7
|
+
import { DSAppPickerName } from "./constants/index.js";
|
|
11
8
|
import { useAppPicker } from "./config/useAppPicker.js";
|
|
12
|
-
|
|
9
|
+
import { useAppPickerBehavior } from "./config/useAppPickerBehavior.js";
|
|
10
|
+
import { DSAppPickerContext } from "./DSAppPickerCTX.js";
|
|
11
|
+
import { StyledAppPickerFloating } from "./parts/style.js";
|
|
12
|
+
import { Trigger } from "./parts/Trigger.js";
|
|
13
13
|
const DSAppPicker = (props) => {
|
|
14
|
-
const
|
|
15
|
-
const { getOwnerProps, getOwnerPropsArguments } = ownerPropsConfig;
|
|
14
|
+
const appPickerConfig = useAppPicker(props);
|
|
16
15
|
const {
|
|
17
|
-
|
|
18
|
-
customApps,
|
|
19
|
-
sectionTitle,
|
|
20
|
-
customSectionTitle,
|
|
21
|
-
icon: Icon,
|
|
16
|
+
Icon,
|
|
22
17
|
renderTrigger,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
triggerRef
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const parent = wrapperRef.current;
|
|
41
|
-
const buttons = [...parent.querySelectorAll("button")];
|
|
42
|
-
buttons[index].focus();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
actionRef.current.focusWrapper = () => {
|
|
46
|
-
wrapperRef.current?.focus();
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}, [actionRef, apps, customApps]);
|
|
50
|
-
useEffect(() => {
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
if (wrapperRef.current) {
|
|
53
|
-
const { scrollHeight, clientHeight } = wrapperRef.current;
|
|
54
|
-
if (scrollHeight > clientHeight) return setIsOverflow(true);
|
|
55
|
-
}
|
|
56
|
-
return setIsOverflow(false);
|
|
57
|
-
});
|
|
58
|
-
}, [isOpen, open]);
|
|
59
|
-
const handleOnClose = useCallback(() => {
|
|
60
|
-
setOpen(false);
|
|
61
|
-
onClose?.();
|
|
62
|
-
}, [onClose]);
|
|
63
|
-
const handleOnClickOutside = (e) => {
|
|
64
|
-
setOpen(false);
|
|
65
|
-
onClose?.();
|
|
66
|
-
onClickOutside?.(e);
|
|
67
|
-
};
|
|
68
|
-
const AppPickerContent = useCallback(
|
|
69
|
-
() => /* @__PURE__ */ jsx(
|
|
70
|
-
AppPickerImpl,
|
|
18
|
+
resolvedIsOpen,
|
|
19
|
+
floatingStyles,
|
|
20
|
+
arrowStyles,
|
|
21
|
+
floatingContext,
|
|
22
|
+
ownerPropsConfig,
|
|
23
|
+
defaultTriggerRef,
|
|
24
|
+
triggerRef,
|
|
25
|
+
wasOpenedByKeyboardRef,
|
|
26
|
+
handleClose,
|
|
27
|
+
handleTriggerRef,
|
|
28
|
+
handleTriggerClick,
|
|
29
|
+
floatingInnerRef,
|
|
30
|
+
focusTracker
|
|
31
|
+
} = useAppPickerBehavior(appPickerConfig);
|
|
32
|
+
return /* @__PURE__ */ jsxs(DSAppPickerContext.Provider, { value: focusTracker, children: [
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Trigger,
|
|
71
35
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
close: handleOnClose,
|
|
79
|
-
wrapperRef,
|
|
80
|
-
onKeyDown,
|
|
81
|
-
triggerRef: triggerRef || defaultTriggerRef,
|
|
82
|
-
actionRef,
|
|
83
|
-
triggerIsInternal: !renderTrigger,
|
|
84
|
-
wasOpenedByKeyboardRef,
|
|
85
|
-
isOverflow
|
|
36
|
+
Icon,
|
|
37
|
+
isOpen: resolvedIsOpen,
|
|
38
|
+
setRef: handleTriggerRef,
|
|
39
|
+
ownerProps: ownerPropsConfig,
|
|
40
|
+
onClick: handleTriggerClick,
|
|
41
|
+
renderTrigger
|
|
86
42
|
}
|
|
87
43
|
),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
apps,
|
|
91
|
-
customApps,
|
|
92
|
-
customSectionTitle,
|
|
93
|
-
handleOnClose,
|
|
94
|
-
isOverflow,
|
|
95
|
-
onKeyDown,
|
|
96
|
-
renderTrigger,
|
|
97
|
-
sectionTitle,
|
|
98
|
-
triggerRef,
|
|
99
|
-
getOwnerProps,
|
|
100
|
-
getOwnerPropsArguments
|
|
101
|
-
]
|
|
102
|
-
);
|
|
103
|
-
const RenderTrigger = useMemo(
|
|
104
|
-
() => renderTrigger || (({ ref }) => /* @__PURE__ */ jsx(
|
|
105
|
-
StyledButton,
|
|
44
|
+
/* @__PURE__ */ jsxs(
|
|
45
|
+
StyledAppPickerFloating,
|
|
106
46
|
{
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
content: /* @__PURE__ */ jsx(AppPickerContent, {}),
|
|
130
|
-
isOpen: typeof isOpen === "boolean" ? isOpen : open,
|
|
131
|
-
onClickOutside: handleOnClickOutside,
|
|
132
|
-
placement: "bottom",
|
|
133
|
-
interactionType: "click",
|
|
134
|
-
renderTrigger: RenderTrigger,
|
|
135
|
-
showArrow: true,
|
|
136
|
-
style: {
|
|
137
|
-
padding: "0",
|
|
138
|
-
maxWidth: "1000px",
|
|
139
|
-
width: "fit-content"
|
|
47
|
+
innerRef: floatingInnerRef,
|
|
48
|
+
isOpen: resolvedIsOpen,
|
|
49
|
+
floatingStyles,
|
|
50
|
+
context: floatingContext,
|
|
51
|
+
getOwnerProps: ownerPropsConfig.getOwnerProps,
|
|
52
|
+
getOwnerPropsArguments: ownerPropsConfig.getOwnerPropsArguments,
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
AppPanel,
|
|
56
|
+
{
|
|
57
|
+
...appPickerConfig.propsWithDefault,
|
|
58
|
+
ownerPropsConfig,
|
|
59
|
+
globalAttributes: appPickerConfig.globalAttributes,
|
|
60
|
+
xstyledProps: appPickerConfig.xstyledProps,
|
|
61
|
+
close: handleClose,
|
|
62
|
+
triggerRef: triggerRef || defaultTriggerRef,
|
|
63
|
+
triggerIsInternal: !renderTrigger,
|
|
64
|
+
wasOpenedByKeyboardRef
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
/* @__PURE__ */ jsx(PopoverArrow, { ...arrowStyles })
|
|
68
|
+
]
|
|
140
69
|
}
|
|
141
|
-
|
|
142
|
-
);
|
|
70
|
+
)
|
|
71
|
+
] });
|
|
143
72
|
};
|
|
144
73
|
DSAppPicker.displayName = DSAppPickerName;
|
|
145
74
|
const AppPickerWithSchema = describe(DSAppPicker);
|
|
146
|
-
AppPickerWithSchema.propTypes =
|
|
147
|
-
var DSAppPicker_default = DSAppPicker;
|
|
75
|
+
AppPickerWithSchema.propTypes = DSAppPickerPropTypesSchema;
|
|
148
76
|
export {
|
|
149
77
|
AppPickerWithSchema,
|
|
150
|
-
DSAppPicker
|
|
151
|
-
DSAppPicker_default as default
|
|
78
|
+
DSAppPicker
|
|
152
79
|
};
|
|
153
80
|
//# sourceMappingURL=DSAppPicker.js.map
|
|
@@ -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
|
|
5
|
-
"mappings": "AAAA,YAAY,WAAW;
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { PopoverArrow } from '@elliemae/ds-floating-context';\nimport { AppPanel } from './parts/AppPanel.js';\nimport type { DSAppPickerT } from './react-desc-prop-types.js';\nimport { DSAppPickerPropTypesSchema } from './react-desc-prop-types.js';\nimport { DSAppPickerName } from './constants/index.js';\nimport { useAppPicker } from './config/useAppPicker.js';\nimport { useAppPickerBehavior } from './config/useAppPickerBehavior.js';\nimport { DSAppPickerContext } from './DSAppPickerCTX.js';\nimport { StyledAppPickerFloating } from './parts/style.js';\nimport { Trigger } from './parts/Trigger.js';\n\nconst DSAppPicker: React.ComponentType<DSAppPickerT.Props> = (props) => {\n const appPickerConfig = useAppPicker(props);\n const {\n Icon,\n renderTrigger,\n resolvedIsOpen,\n floatingStyles,\n arrowStyles,\n floatingContext,\n ownerPropsConfig,\n defaultTriggerRef,\n triggerRef,\n wasOpenedByKeyboardRef,\n handleClose,\n handleTriggerRef,\n handleTriggerClick,\n floatingInnerRef,\n focusTracker,\n } = useAppPickerBehavior(appPickerConfig);\n\n return (\n <DSAppPickerContext.Provider value={focusTracker}>\n <Trigger\n Icon={Icon}\n isOpen={resolvedIsOpen}\n setRef={handleTriggerRef}\n ownerProps={ownerPropsConfig}\n onClick={handleTriggerClick}\n renderTrigger={renderTrigger}\n />\n <StyledAppPickerFloating\n innerRef={floatingInnerRef}\n isOpen={resolvedIsOpen}\n floatingStyles={floatingStyles}\n context={floatingContext}\n getOwnerProps={ownerPropsConfig.getOwnerProps}\n getOwnerPropsArguments={ownerPropsConfig.getOwnerPropsArguments}\n >\n <AppPanel\n {...appPickerConfig.propsWithDefault}\n ownerPropsConfig={ownerPropsConfig}\n globalAttributes={appPickerConfig.globalAttributes}\n xstyledProps={appPickerConfig.xstyledProps}\n close={handleClose}\n triggerRef={triggerRef || defaultTriggerRef}\n triggerIsInternal={!renderTrigger}\n wasOpenedByKeyboardRef={wasOpenedByKeyboardRef}\n />\n <PopoverArrow {...arrowStyles} />\n </StyledAppPickerFloating>\n </DSAppPickerContext.Provider>\n );\n};\n\nDSAppPicker.displayName = DSAppPickerName;\nconst AppPickerWithSchema = describe(DSAppPicker);\nAppPickerWithSchema.propTypes = DSAppPickerPropTypesSchema;\n\nexport { DSAppPicker, AppPickerWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;AC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
7
7
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
const defaultFocusContext = {
|
|
4
|
+
focusRegion: "",
|
|
5
|
+
firstFocusableRef: { current: null },
|
|
6
|
+
lastFocusableRef: { current: null },
|
|
7
|
+
registerChip: () => {
|
|
8
|
+
},
|
|
9
|
+
trackFocusChip: () => {
|
|
10
|
+
},
|
|
11
|
+
trackFocusRegionReset: () => {
|
|
12
|
+
},
|
|
13
|
+
trackFocusTrigger: () => {
|
|
14
|
+
},
|
|
15
|
+
trackFocusPanel: () => {
|
|
16
|
+
},
|
|
17
|
+
trackFocusSelectedItem: () => {
|
|
18
|
+
},
|
|
19
|
+
trackFocusFirstItem: () => {
|
|
20
|
+
},
|
|
21
|
+
trackFocusItemAtIndex: () => {
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const DSAppPickerContext = createContext(defaultFocusContext);
|
|
25
|
+
export {
|
|
26
|
+
DSAppPickerContext
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=DSAppPickerCTX.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../src/DSAppPickerCTX.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { createContext } from 'react';\nimport type { useFocusTracker } from './config/useFocusTracker.js';\n\nexport type AppPickerFocusCTX = ReturnType<typeof useFocusTracker>;\n\nconst defaultFocusContext: AppPickerFocusCTX = {\n focusRegion: '',\n firstFocusableRef: { current: null } as React.MutableRefObject<HTMLElement | null>,\n lastFocusableRef: { current: null } as React.MutableRefObject<HTMLElement | null>,\n registerChip: () => {},\n trackFocusChip: () => {},\n trackFocusRegionReset: () => {},\n trackFocusTrigger: () => {},\n trackFocusPanel: () => {},\n trackFocusSelectedItem: () => {},\n trackFocusFirstItem: () => {},\n trackFocusItemAtIndex: () => {},\n};\n\n/** Focus tracker context for chip-level focus management inside DSAppPicker. */\nexport const DSAppPickerContext = createContext<AppPickerFocusCTX>(defaultFocusContext);\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAgB,qBAAqB;AAKrC,MAAM,sBAAyC;AAAA,EAC7C,aAAa;AAAA,EACb,mBAAmB,EAAE,SAAS,KAAK;AAAA,EACnC,kBAAkB,EAAE,SAAS,KAAK;AAAA,EAClC,cAAc,MAAM;AAAA,EAAC;AAAA,EACrB,gBAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,uBAAuB,MAAM;AAAA,EAAC;AAAA,EAC9B,mBAAmB,MAAM;AAAA,EAAC;AAAA,EAC1B,iBAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,wBAAwB,MAAM;AAAA,EAAC;AAAA,EAC/B,qBAAqB,MAAM;AAAA,EAAC;AAAA,EAC5B,uBAAuB,MAAM;AAAA,EAAC;AAChC;AAGO,MAAM,qBAAqB,cAAiC,mBAAmB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -3,16 +3,15 @@ import React2 from "react";
|
|
|
3
3
|
import {
|
|
4
4
|
useMemoMergePropsWithDefault,
|
|
5
5
|
useOwnerProps,
|
|
6
|
-
useValidateTypescriptPropTypes,
|
|
7
6
|
getGlobalAttributes,
|
|
8
7
|
getXstyledProps
|
|
9
8
|
} from "@elliemae/ds-props-helpers";
|
|
10
|
-
import { defaultProps,
|
|
11
|
-
import {
|
|
9
|
+
import { defaultProps, DSAppPickerPropTypesSchema } from "../react-desc-prop-types.js";
|
|
10
|
+
import { useValidateProps } from "./useValidateProps.js";
|
|
12
11
|
const useAppPicker = (props) => {
|
|
13
12
|
const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
|
|
14
|
-
|
|
15
|
-
const ownerPropsConfig = useOwnerProps(propsWithDefault,
|
|
13
|
+
useValidateProps(propsWithDefault, DSAppPickerPropTypesSchema);
|
|
14
|
+
const ownerPropsConfig = useOwnerProps(propsWithDefault, propsWithDefault);
|
|
16
15
|
const globalAttributes = getGlobalAttributes(props);
|
|
17
16
|
const xstyledProps = getXstyledProps(props);
|
|
18
17
|
return React2.useMemo(
|