@pega/cosmos-react-cs 3.0.0-dev.21.1 → 3.0.0-dev.23.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/lib/components/CallControlPanel/Call.d.ts.map +1 -1
- package/lib/components/CallControlPanel/Call.js +87 -72
- package/lib/components/CallControlPanel/Call.js.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.d.ts.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.js +20 -12
- package/lib/components/CallControlPanel/CallControlPanel.js.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts +2 -0
- package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.styles.js +8 -1
- package/lib/components/CallControlPanel/CallControlPanel.styles.js.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.types.d.ts +15 -29
- package/lib/components/CallControlPanel/CallControlPanel.types.d.ts.map +1 -1
- package/lib/components/CallControlPanel/CallControlPanel.types.js.map +1 -1
- package/lib/components/CallControlPanel/CallHandover/CallHandover.types.d.ts +15 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandover.types.d.ts.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandover.types.js +2 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandover.types.js.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverDialog.d.ts +13 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverDialog.d.ts.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverDialog.js +51 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverDialog.js.map +1 -0
- package/lib/components/CallControlPanel/{CallHandoverForm.d.ts → CallHandover/CallHandoverForm.d.ts} +7 -3
- package/lib/components/CallControlPanel/CallHandover/CallHandoverForm.d.ts.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverForm.js +46 -0
- package/lib/components/CallControlPanel/CallHandover/CallHandoverForm.js.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/index.d.ts +4 -0
- package/lib/components/CallControlPanel/CallHandover/index.d.ts.map +1 -0
- package/lib/components/CallControlPanel/CallHandover/index.js +4 -0
- package/lib/components/CallControlPanel/CallHandover/index.js.map +1 -0
- package/lib/components/CallControlPanel/{CalleePicker.d.ts → ContactList/CalleePicker.d.ts} +5 -7
- package/lib/components/CallControlPanel/ContactList/CalleePicker.d.ts.map +1 -0
- package/lib/components/CallControlPanel/ContactList/CalleePicker.js +52 -0
- package/lib/components/CallControlPanel/ContactList/CalleePicker.js.map +1 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.d.ts +10 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.d.ts.map +1 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.js +129 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.js.map +1 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.types.d.ts +30 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.types.d.ts.map +1 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.types.js +2 -0
- package/lib/components/CallControlPanel/ContactList/ContactList.types.js.map +1 -0
- package/lib/components/CallControlPanel/ContactList/index.d.ts +3 -0
- package/lib/components/CallControlPanel/ContactList/index.d.ts.map +1 -0
- package/lib/components/CallControlPanel/ContactList/index.js +2 -0
- package/lib/components/CallControlPanel/ContactList/index.js.map +1 -0
- package/lib/components/CallControlPanel/index.d.ts +2 -1
- package/lib/components/CallControlPanel/index.d.ts.map +1 -1
- package/lib/components/CallControlPanel/index.js.map +1 -1
- package/lib/components/DialPad/DialPad.js +1 -1
- package/lib/components/DialPad/DialPad.js.map +1 -1
- package/lib/components/DialPad/DialPadDialog.d.ts +10 -0
- package/lib/components/DialPad/DialPadDialog.d.ts.map +1 -0
- package/lib/components/DialPad/DialPadDialog.js +28 -0
- package/lib/components/DialPad/DialPadDialog.js.map +1 -0
- package/lib/components/DialPad/DialPadKeyboard.d.ts.map +1 -1
- package/lib/components/DialPad/DialPadKeyboard.js +1 -1
- package/lib/components/DialPad/DialPadKeyboard.js.map +1 -1
- package/lib/components/DialPad/index.d.ts +1 -0
- package/lib/components/DialPad/index.d.ts.map +1 -1
- package/lib/components/DialPad/index.js +1 -0
- package/lib/components/DialPad/index.js.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +3 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js +1 -1
- package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
- package/package.json +3 -3
- package/lib/components/CallControlPanel/CallHandoverForm.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallHandoverForm.js +0 -78
- package/lib/components/CallControlPanel/CallHandoverForm.js.map +0 -1
- package/lib/components/CallControlPanel/CalleePicker.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CalleePicker.js +0 -61
- package/lib/components/CallControlPanel/CalleePicker.js.map +0 -1
- package/lib/components/CallControlPanel/ContactsList.d.ts +0 -23
- package/lib/components/CallControlPanel/ContactsList.d.ts.map +0 -1
- package/lib/components/CallControlPanel/ContactsList.js +0 -88
- package/lib/components/CallControlPanel/ContactsList.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,4BAA4B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export {\n CallProps,\n CallParticipant,\n CallControlPanelProps,\n UserAvailabilityStatusOption\n} from './CallControlPanel.types';\nexport { default as ExternalCTI } from './ExternalCTI';\nexport { default } from './CallControlPanel';\nexport type { TransferData } from './CallHandover/CallHandover.types';\n"]}
|
|
@@ -27,7 +27,7 @@ const DialPad = forwardRef(({ onCallButtonClick, onDialButtonClick: onDialButton
|
|
|
27
27
|
});
|
|
28
28
|
onDialButtonClickProp?.(charCode);
|
|
29
29
|
}, [onDialButtonClickProp]);
|
|
30
|
-
return (_jsxs(StyledDialPad, { ref: ref, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'center', itemGap: 1 }, children: [_jsx(Input, { value: number, onChange: (e) => setNumber(e.target.value), "aria-label": t('dial_pad_phone_number_input_label'), readOnly: mode === 'DTMF' }), mode !== 'DTMF' && (_jsx(Button, { variant: 'primary', onClick: () => onCallButtonClick?.(number), "aria-label": t('dial_pad_call_button_label', [number]), disabled: number.length === 0, children: t('dial_pad_call_button_label') }))] }), _jsx(DialPadKeyboard, { onDialButtonClick: onDialButtonClick, mode: mode })] }));
|
|
30
|
+
return (_jsxs(StyledDialPad, { ref: ref, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'center', itemGap: 1 }, children: [_jsx(Input, { value: number, onChange: (e) => setNumber(e.target.value), "aria-label": t('dial_pad_phone_number_input_label'), readOnly: mode === 'DTMF' }), mode !== 'DTMF' && onCallButtonClick && (_jsx(Button, { variant: 'primary', onClick: () => onCallButtonClick?.(number), "aria-label": t('dial_pad_call_button_label', [number]), disabled: number.length === 0, children: t('dial_pad_call_button_label') }))] }), _jsx(DialPadKeyboard, { onDialButtonClick: onDialButtonClick, mode: mode })] }));
|
|
31
31
|
});
|
|
32
32
|
export default DialPad;
|
|
33
33
|
//# sourceMappingURL=DialPad.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialPad.js","sourceRoot":"","sources":["../../../src/components/DialPad/DialPad.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,WAAW,EACX,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAEL,gBAAgB,EAChB,KAAK,EACL,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,UAAU,EAEX,MAAM,yBAAyB,CAAC;AAEjC,OAAO,eAAyC,MAAM,mBAAmB,CAAC;AAa1E,MAAM,aAAa,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACvD,OAAO,GAAG,CAAA;MACN,UAAU;uBACO,IAAI,CAAC,OAAO;iBAClB,IAAI,CAAC,OAAO;;;MAGvB,UAAU,IAAI,UAAU;eACf,IAAI,CAAC,OAAO,CAAC,WAAW;;GAEpC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,aAAa,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9C,MAAM,OAAO,GAAmD,UAAU,CACxE,CACE,EACE,iBAAiB,EACjB,iBAAiB,EAAE,qBAAqB,EACxC,IAAI,EAC0B,EAChC,GAAwB,EACxB,E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,EAAE,CAAC,EAAE,aACtE,KAAC,KAAK,IACJ,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,gBAC7D,CAAC,CAAC,mCAAmC,CAAC,EAClD,QAAQ,EAAE,IAAI,KAAK,MAAM,GACzB,EACD,IAAI,KAAK,MAAM,IAAI,iBAAiB,IAAI,CACvC,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,gBAC9B,CAAC,CAAC,4BAA4B,EAAE,CAAC,MAAM,CAAC,CAAC,EACrD,QAAQ,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC,YAE5B,CAAC,CAAC,4BAA4B,CAAC,GACzB,CACV,IACI,EACP,KAAC,eAAe,IAAC,iBAAiB,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,GAAI,IACvD,CACjB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useCallback,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n ForwardProps,\n defaultThemeProp,\n Input,\n Button,\n useI18n,\n Flex,\n StyledIcon,\n StyledFlex,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nimport DialPadKeyboard, { DialPadKeyboardProps } from './DialPadKeyboard';\n\nexport interface DialPadProps extends NoChildrenProp {\n /** Callback fired on call button click */\n onCallButtonClick?: (phoneNumber: string) => void;\n /** On keypad button press callback */\n onDialButtonClick?: (charCode: number) => void;\n /** Keypad mode, regular or DTMF. */\n mode: DialPadKeyboardProps['mode'];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledDialPad = styled.div(({ theme: { base } }) => {\n return css`\n ${StyledFlex} {\n margin: 0 auto ${base.spacing} auto;\n padding: ${base.spacing} 0;\n }\n\n ${StyledFlex} ${StyledIcon} {\n color: ${base.palette.interactive};\n }\n `;\n});\n\nStyledDialPad.defaultProps = defaultThemeProp;\n\nconst DialPad: FunctionComponent<DialPadProps & ForwardProps> = forwardRef(\n (\n {\n onCallButtonClick,\n onDialButtonClick: onDialButtonClickProp,\n mode\n }: PropsWithoutRef<DialPadProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const t = useI18n();\n const [number, setNumber] = useState('');\n\n const onDialButtonClick = useCallback(\n (charCode: number) => {\n setNumber((prevNumber: string) => {\n if (charCode === 127) return prevNumber.slice(0, -1);\n return prevNumber + String.fromCharCode(charCode);\n });\n onDialButtonClickProp?.(charCode);\n },\n [onDialButtonClickProp]\n );\n\n return (\n <StyledDialPad ref={ref}>\n <Flex container={{ alignItems: 'center', justify: 'center', itemGap: 1 }}>\n <Input\n value={number}\n onChange={(e: ChangeEvent<HTMLInputElement>) => setNumber(e.target.value)}\n aria-label={t('dial_pad_phone_number_input_label')}\n readOnly={mode === 'DTMF'}\n />\n {mode !== 'DTMF' && onCallButtonClick && (\n <Button\n variant='primary'\n onClick={() => onCallButtonClick?.(number)}\n aria-label={t('dial_pad_call_button_label', [number])}\n disabled={number.length === 0}\n >\n {t('dial_pad_call_button_label')}\n </Button>\n )}\n </Flex>\n <DialPadKeyboard onDialButtonClick={onDialButtonClick} mode={mode} />\n </StyledDialPad>\n );\n }\n);\n\nexport default DialPad;\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionComponent } from 'react';
|
|
2
|
+
import { DialPadProps } from './DialPad';
|
|
3
|
+
interface DialPadDialogProps {
|
|
4
|
+
target: HTMLElement | null;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onDialButtonClick: DialPadProps['onDialButtonClick'];
|
|
7
|
+
}
|
|
8
|
+
declare const DialPadDialog: FunctionComponent<DialPadDialogProps>;
|
|
9
|
+
export default DialPadDialog;
|
|
10
|
+
//# sourceMappingURL=DialPadDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialPadDialog.d.ts","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,OAAO,CAAC;AAiB7D,OAAgB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAElD,UAAU,kBAAkB;IAC1B,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAC;CACtD;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAoDxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { Button, Card, CardContent, CardHeader, getFocusables, Icon, Popover, Text, useEscape, useFocusTrap, useI18n, useOuterEvent } from '@pega/cosmos-react-core';
|
|
4
|
+
import DialPad from './DialPad';
|
|
5
|
+
const DialPadDialog = ({ target, onClose: onCloseProp, onDialButtonClick }) => {
|
|
6
|
+
const t = useI18n();
|
|
7
|
+
const popoverRef = useRef(null);
|
|
8
|
+
const onClose = () => {
|
|
9
|
+
onCloseProp();
|
|
10
|
+
target?.focus();
|
|
11
|
+
};
|
|
12
|
+
useOuterEvent('mousedown', [popoverRef], onClose);
|
|
13
|
+
useEscape(onClose, popoverRef);
|
|
14
|
+
useFocusTrap(popoverRef);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
getFocusables(popoverRef)[0]?.focus();
|
|
17
|
+
}, []);
|
|
18
|
+
return (_jsx(Popover, { target: target, ref: popoverRef, placement: 'top-end', modifiers: [
|
|
19
|
+
{
|
|
20
|
+
name: 'flip',
|
|
21
|
+
options: {
|
|
22
|
+
fallbackPlacements: ['bottom-end', 'left', 'right']
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
], heading: t('call_panel_send_dtmf_heading'), children: _jsxs(Card, { children: [_jsx(CardHeader, { actions: _jsx(Button, { icon: true, variant: 'simple', "aria-label": t('close'), onClick: onClose, children: _jsx(Icon, { name: 'times' }) }), children: _jsx(Text, { variant: 'h3', children: t('call_panel_send_dtmf_heading') }) }), _jsx(CardContent, { children: _jsx(DialPad, { onDialButtonClick: onDialButtonClick, mode: 'DTMF' }) })] }) }));
|
|
26
|
+
};
|
|
27
|
+
export default DialPadDialog;
|
|
28
|
+
//# sourceMappingURL=DialPadDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialPadDialog.js","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,aAAa,EACb,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,OAAO,EACP,aAAa,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,OAAyB,MAAM,WAAW,CAAC;AAQlD,MAAM,aAAa,GAA0C,CAAC,EAC5D,MAAM,EACN,OAAO,EAAE,WAAW,EACpB,iBAAiB,EACE,EAAE,EAAE;IACvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAEhD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,WAAW,EAAE,CAAC;QACd,MAAM,EAAE,KAAK,EAAE,CAAC;IAClB,CAAC,CAAC;IAEF,aAAa,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;IAClD,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC/B,YAAY,CAAC,UAAU,CAAC,CAAC;IAEzB,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;IACxC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,OAAO,IACN,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,UAAU,EACf,SAAS,EAAC,SAAS,EACnB,SAAS,EAAE;YACT;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE;oBACP,kBAAkB,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC;iBACpD;aACF;SACF,EACD,OAAO,EAAE,CAAC,CAAC,8BAA8B,CAAC,YAE1C,MAAC,IAAI,eACH,KAAC,UAAU,IACT,OAAO,EACL,KAAC,MAAM,IAAC,IAAI,QAAC,OAAO,EAAC,QAAQ,gBAAa,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,YACpE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,YAGX,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,8BAA8B,CAAC,GAAQ,GAClD,EACb,KAAC,WAAW,cACV,KAAC,OAAO,IAAC,iBAAiB,EAAE,iBAAiB,EAAE,IAAI,EAAC,MAAM,GAAG,GACjD,IACT,GACC,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent, useRef, useEffect } from 'react';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n getFocusables,\n Icon,\n Popover,\n Text,\n useEscape,\n useFocusTrap,\n useI18n,\n useOuterEvent\n} from '@pega/cosmos-react-core';\n\nimport DialPad, { DialPadProps } from './DialPad';\n\ninterface DialPadDialogProps {\n target: HTMLElement | null;\n onClose: () => void;\n onDialButtonClick: DialPadProps['onDialButtonClick'];\n}\n\nconst DialPadDialog: FunctionComponent<DialPadDialogProps> = ({\n target,\n onClose: onCloseProp,\n onDialButtonClick\n}: DialPadDialogProps) => {\n const t = useI18n();\n const popoverRef = useRef<HTMLDivElement>(null);\n\n const onClose = () => {\n onCloseProp();\n target?.focus();\n };\n\n useOuterEvent('mousedown', [popoverRef], onClose);\n useEscape(onClose, popoverRef);\n useFocusTrap(popoverRef);\n\n useEffect(() => {\n getFocusables(popoverRef)[0]?.focus();\n }, []);\n\n return (\n <Popover\n target={target}\n ref={popoverRef}\n placement='top-end'\n modifiers={[\n {\n name: 'flip',\n options: {\n fallbackPlacements: ['bottom-end', 'left', 'right']\n }\n }\n ]}\n heading={t('call_panel_send_dtmf_heading')}\n >\n <Card>\n <CardHeader\n actions={\n <Button icon variant='simple' aria-label={t('close')} onClick={onClose}>\n <Icon name='times' />\n </Button>\n }\n >\n <Text variant='h3'>{t('call_panel_send_dtmf_heading')}</Text>\n </CardHeader>\n <CardContent>\n <DialPad onDialButtonClick={onDialButtonClick} mode='DTMF' />\n </CardContent>\n </Card>\n </Popover>\n );\n};\n\nexport default DialPadDialog;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialPadKeyboard.d.ts","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadKeyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAQ,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AAOpG,oBAAY,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,0CAA0C;IAC1C,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,6BAA6B;IAC7B,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"DialPadKeyboard.d.ts","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadKeyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,YAAY,EAAQ,cAAc,EAAyB,MAAM,yBAAyB,CAAC;AAOpG,oBAAY,mBAAmB,GAAG,SAAS,GAAG,MAAM,CAAC;AAErD,MAAM,WAAW,oBAAqB,SAAQ,cAAc;IAC1D,0CAA0C;IAC1C,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,6BAA6B;IAC7B,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,QAAA,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAiJ3E,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -78,7 +78,7 @@ const DialPadKeyboard = forwardRef(({ onDialButtonClick, mode = 'default' }, ref
|
|
|
78
78
|
if (mode === 'default' || (mode === 'DTMF' && index < 4)) {
|
|
79
79
|
return (
|
|
80
80
|
// eslint-disable-next-line react/no-array-index-key
|
|
81
|
-
_jsx("div", { role: 'row', children: row.map((dialButton) => dialButton.alt === '+' ? (_jsxs(StyledDialButton, { role: 'gridcell', tabIndex: -1, ref: dialButton.ref, value: dialButton.keyCode, ...zeroButtonLongPress, children: [dialButton.sign && _jsx("span", { children: dialButton.sign }), dialButton.alt && _jsx("span", { children: dialButton.alt })] }, dialButton.keyCode)) : (_jsxs(StyledDialButton, { role: 'gridcell', onClick: () => onDialButtonClick(dialButton.keyCode), onKeyDown: handleEnterEvent, tabIndex: dialButton.sign === '1' ? 0 : -1, "aria-label": dialButton.icon ? dialButton.icon : undefined, ref: dialButton.ref, value: dialButton.keyCode, children: [dialButton.sign && _jsx("span", { children: dialButton.sign }), dialButton.alt && _jsx("span", { children: dialButton.alt }), dialButton.special && _jsx(StyledSpecial, { children: dialButton.special }), dialButton.icon && _jsx(Icon, { name: dialButton.icon })] }, dialButton.keyCode))) }, `row-${index}`));
|
|
81
|
+
_jsx("div", { role: 'row', children: row.map((dialButton) => dialButton.alt === '+' ? (_jsxs(StyledDialButton, { role: 'gridcell', tabIndex: -1, ref: dialButton.ref, value: dialButton.keyCode, ...zeroButtonLongPress, children: [dialButton.sign && _jsx("span", { children: dialButton.sign }), dialButton.alt && _jsx("span", { children: dialButton.alt })] }, dialButton.keyCode)) : (_jsxs(StyledDialButton, { type: 'button', role: 'gridcell', onClick: () => onDialButtonClick(dialButton.keyCode), onKeyDown: handleEnterEvent, tabIndex: dialButton.sign === '1' ? 0 : -1, "aria-label": dialButton.icon ? dialButton.icon : undefined, ref: dialButton.ref, value: dialButton.keyCode, children: [dialButton.sign && _jsx("span", { children: dialButton.sign }), dialButton.alt && _jsx("span", { children: dialButton.alt }), dialButton.special && _jsx(StyledSpecial, { children: dialButton.special }), dialButton.icon && _jsx(Icon, { name: dialButton.icon })] }, dialButton.keyCode))) }, `row-${index}`));
|
|
82
82
|
}
|
|
83
83
|
return undefined;
|
|
84
84
|
}) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialPadKeyboard.js","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadKeyboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,EACV,MAAM,EACN,WAAW,EACZ,MAAM,OAAO,CAAC;AAEf,OAAO,EAAgB,IAAI,EAAkB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC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CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n KeyboardEvent,\n forwardRef,\n useRef,\n useCallback\n} from 'react';\n\nimport { ForwardProps, Icon, NoChildrenProp, useI18n, useLongPress } from '@pega/cosmos-react-core';\n\nimport { StyledDialButton, StyledDialPadKeyboard, StyledSpecial } from './DialPadKeyboard.styles';\nimport { dtmfGraph, defaultGraph, defaultButtonGrid, dtmfButtonGrid } from './KeyboardNavigation';\nimport { Index, NavigationGraphElement } from './DialPad.types';\nimport { getDialButtonIndex, isNavigationEvent } from './utils';\n\nexport type DialPadKeyboardMode = 'default' | 'DTMF';\n\nexport interface DialPadKeyboardProps extends NoChildrenProp {\n /** Callback fired on dial button click */\n onDialButtonClick: (charCode: number) => void;\n /** Dial Pad Keyboard mode */\n mode?: DialPadKeyboardMode;\n}\n\nconst DialPadKeyboard: FunctionComponent<DialPadKeyboardProps & ForwardProps> = forwardRef(\n (\n { onDialButtonClick, mode = 'default' }: PropsWithoutRef<DialPadKeyboardProps>,\n ref: Ref<HTMLElement>\n ) => {\n const buttonNavGraph = mode === 'DTMF' ? dtmfGraph : defaultGraph;\n const buttonGrid = mode === 'DTMF' ? dtmfButtonGrid : defaultButtonGrid;\n\n const t = useI18n();\n const zeroButtonLongPress = useLongPress<HTMLButtonElement>(\n () => onDialButtonClick(buttonNavGraph[10].altKeyCode || 43),\n () => onDialButtonClick(buttonNavGraph[10].keyCode)\n );\n // This is not a violation of the rules, as the array length is constant and order the always the same.\n buttonNavGraph.forEach(element => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n element.ref = useRef<HTMLButtonElement>(null);\n });\n\n const handleDialButtonEvent = (e: React.KeyboardEvent<HTMLButtonElement>, index: number) => {\n e.preventDefault();\n e.stopPropagation();\n const buttonEl = buttonNavGraph[index];\n if (!buttonEl || (mode === 'DTMF' && index === 12)) return;\n buttonEl.ref?.current?.focus();\n onDialButtonClick(buttonEl.keyCode);\n };\n\n const handlePlusDialButton = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n const buttonEl = buttonNavGraph[10];\n if (!buttonEl || !buttonEl.altKeyCode) return;\n buttonEl.ref?.current?.focus();\n onDialButtonClick(buttonEl.altKeyCode);\n };\n\n const handleEnterEvent = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n onDialButtonClick(Number((e.target as HTMLButtonElement).value));\n }\n },\n [onDialButtonClick]\n );\n\n const findButtonInGraph = (e: React.KeyboardEvent<HTMLElement>) => {\n return buttonNavGraph.find(\n el => el.keyCode === Number((e.target as HTMLButtonElement).value)\n );\n };\n\n const getTargetIndexOnNavigationEvent = (\n btnEl: NavigationGraphElement,\n e: React.KeyboardEvent<HTMLButtonElement>\n ): Index | undefined => {\n return {\n ArrowUp: btnEl.up,\n ArrowLeft: btnEl.left,\n ArrowDown: btnEl.down,\n ArrowRight: btnEl.right\n }[e.key];\n };\n\n const handleNavigationEvent = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n e.preventDefault();\n const btnEl = findButtonInGraph(e);\n if (!btnEl) return;\n const targetIndex = getTargetIndexOnNavigationEvent(btnEl, e);\n if (targetIndex !== undefined) buttonNavGraph[targetIndex].ref?.current?.focus();\n };\n\n const handleKeyboardNavigation = useCallback(\n (e: KeyboardEvent<HTMLButtonElement>) => {\n const index = getDialButtonIndex(e);\n if (index !== -1) {\n handleDialButtonEvent(e, index);\n } else if (e.key === '+') {\n handlePlusDialButton(e);\n } else if (isNavigationEvent(e)) {\n handleNavigationEvent(e);\n }\n },\n [onDialButtonClick]\n );\n\n return (\n <StyledDialPadKeyboard\n ref={ref}\n onKeyDown={handleKeyboardNavigation}\n dir='ltr'\n role='grid'\n aria-label={t('dial_pad_keyboard')}\n container={{\n cols: '1fr',\n rowGap: 1,\n justifyItems: 'center'\n }}\n >\n {buttonGrid.map((row: NavigationGraphElement[], index: number) => {\n if (mode === 'default' || (mode === 'DTMF' && index < 4)) {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <div role='row' key={`row-${index}`}>\n {row.map((dialButton: NavigationGraphElement) =>\n dialButton.alt === '+' ? (\n <StyledDialButton\n key={dialButton.keyCode}\n role='gridcell'\n tabIndex={-1}\n ref={dialButton.ref}\n value={dialButton.keyCode}\n {...zeroButtonLongPress}\n >\n {dialButton.sign && <span>{dialButton.sign}</span>}\n {dialButton.alt && <span>{dialButton.alt}</span>}\n </StyledDialButton>\n ) : (\n <StyledDialButton\n key={dialButton.keyCode}\n role='gridcell'\n onClick={() => onDialButtonClick(dialButton.keyCode)}\n onKeyDown={handleEnterEvent}\n tabIndex={dialButton.sign === '1' ? 0 : -1}\n aria-label={dialButton.icon ? dialButton.icon : undefined}\n ref={dialButton.ref}\n value={dialButton.keyCode}\n >\n {dialButton.sign && <span>{dialButton.sign}</span>}\n {dialButton.alt && <span>{dialButton.alt}</span>}\n {dialButton.special && <StyledSpecial>{dialButton.special}</StyledSpecial>}\n {dialButton.icon && <Icon name={dialButton.icon} />}\n </StyledDialButton>\n )\n )}\n </div>\n );\n }\n return undefined;\n })}\n </StyledDialPadKeyboard>\n );\n }\n);\n\nexport default DialPadKeyboard;\n"]}
|
|
1
|
+
{"version":3,"file":"DialPadKeyboard.js","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadKeyboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,EACV,MAAM,EACN,WAAW,EACZ,MAAM,OAAO,CAAC;AAEf,OAAO,EAAgB,IAAI,EAAkB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpG,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAElG,OAAO,EAAE,kBAAkB,EAAE,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SAAS,CAAC;QACnB,CAAC,CAAC,GACoB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import {\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n KeyboardEvent,\n forwardRef,\n useRef,\n useCallback\n} from 'react';\n\nimport { ForwardProps, Icon, NoChildrenProp, useI18n, useLongPress } from '@pega/cosmos-react-core';\n\nimport { StyledDialButton, StyledDialPadKeyboard, StyledSpecial } from './DialPadKeyboard.styles';\nimport { dtmfGraph, defaultGraph, defaultButtonGrid, dtmfButtonGrid } from './KeyboardNavigation';\nimport { Index, NavigationGraphElement } from './DialPad.types';\nimport { getDialButtonIndex, isNavigationEvent } from './utils';\n\nexport type DialPadKeyboardMode = 'default' | 'DTMF';\n\nexport interface DialPadKeyboardProps extends NoChildrenProp {\n /** Callback fired on dial button click */\n onDialButtonClick: (charCode: number) => void;\n /** Dial Pad Keyboard mode */\n mode?: DialPadKeyboardMode;\n}\n\nconst DialPadKeyboard: FunctionComponent<DialPadKeyboardProps & ForwardProps> = forwardRef(\n (\n { onDialButtonClick, mode = 'default' }: PropsWithoutRef<DialPadKeyboardProps>,\n ref: Ref<HTMLElement>\n ) => {\n const buttonNavGraph = mode === 'DTMF' ? dtmfGraph : defaultGraph;\n const buttonGrid = mode === 'DTMF' ? dtmfButtonGrid : defaultButtonGrid;\n\n const t = useI18n();\n const zeroButtonLongPress = useLongPress<HTMLButtonElement>(\n () => onDialButtonClick(buttonNavGraph[10].altKeyCode || 43),\n () => onDialButtonClick(buttonNavGraph[10].keyCode)\n );\n // This is not a violation of the rules, as the array length is constant and order the always the same.\n buttonNavGraph.forEach(element => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n element.ref = useRef<HTMLButtonElement>(null);\n });\n\n const handleDialButtonEvent = (e: React.KeyboardEvent<HTMLButtonElement>, index: number) => {\n e.preventDefault();\n e.stopPropagation();\n const buttonEl = buttonNavGraph[index];\n if (!buttonEl || (mode === 'DTMF' && index === 12)) return;\n buttonEl.ref?.current?.focus();\n onDialButtonClick(buttonEl.keyCode);\n };\n\n const handlePlusDialButton = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n e.preventDefault();\n e.stopPropagation();\n const buttonEl = buttonNavGraph[10];\n if (!buttonEl || !buttonEl.altKeyCode) return;\n buttonEl.ref?.current?.focus();\n onDialButtonClick(buttonEl.altKeyCode);\n };\n\n const handleEnterEvent = useCallback(\n (e: React.KeyboardEvent<HTMLButtonElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n onDialButtonClick(Number((e.target as HTMLButtonElement).value));\n }\n },\n [onDialButtonClick]\n );\n\n const findButtonInGraph = (e: React.KeyboardEvent<HTMLElement>) => {\n return buttonNavGraph.find(\n el => el.keyCode === Number((e.target as HTMLButtonElement).value)\n );\n };\n\n const getTargetIndexOnNavigationEvent = (\n btnEl: NavigationGraphElement,\n e: React.KeyboardEvent<HTMLButtonElement>\n ): Index | undefined => {\n return {\n ArrowUp: btnEl.up,\n ArrowLeft: btnEl.left,\n ArrowDown: btnEl.down,\n ArrowRight: btnEl.right\n }[e.key];\n };\n\n const handleNavigationEvent = (e: React.KeyboardEvent<HTMLButtonElement>) => {\n e.preventDefault();\n const btnEl = findButtonInGraph(e);\n if (!btnEl) return;\n const targetIndex = getTargetIndexOnNavigationEvent(btnEl, e);\n if (targetIndex !== undefined) buttonNavGraph[targetIndex].ref?.current?.focus();\n };\n\n const handleKeyboardNavigation = useCallback(\n (e: KeyboardEvent<HTMLButtonElement>) => {\n const index = getDialButtonIndex(e);\n if (index !== -1) {\n handleDialButtonEvent(e, index);\n } else if (e.key === '+') {\n handlePlusDialButton(e);\n } else if (isNavigationEvent(e)) {\n handleNavigationEvent(e);\n }\n },\n [onDialButtonClick]\n );\n\n return (\n <StyledDialPadKeyboard\n ref={ref}\n onKeyDown={handleKeyboardNavigation}\n dir='ltr'\n role='grid'\n aria-label={t('dial_pad_keyboard')}\n container={{\n cols: '1fr',\n rowGap: 1,\n justifyItems: 'center'\n }}\n >\n {buttonGrid.map((row: NavigationGraphElement[], index: number) => {\n if (mode === 'default' || (mode === 'DTMF' && index < 4)) {\n return (\n // eslint-disable-next-line react/no-array-index-key\n <div role='row' key={`row-${index}`}>\n {row.map((dialButton: NavigationGraphElement) =>\n dialButton.alt === '+' ? (\n <StyledDialButton\n key={dialButton.keyCode}\n role='gridcell'\n tabIndex={-1}\n ref={dialButton.ref}\n value={dialButton.keyCode}\n {...zeroButtonLongPress}\n >\n {dialButton.sign && <span>{dialButton.sign}</span>}\n {dialButton.alt && <span>{dialButton.alt}</span>}\n </StyledDialButton>\n ) : (\n <StyledDialButton\n key={dialButton.keyCode}\n type='button'\n role='gridcell'\n onClick={() => onDialButtonClick(dialButton.keyCode)}\n onKeyDown={handleEnterEvent}\n tabIndex={dialButton.sign === '1' ? 0 : -1}\n aria-label={dialButton.icon ? dialButton.icon : undefined}\n ref={dialButton.ref}\n value={dialButton.keyCode}\n >\n {dialButton.sign && <span>{dialButton.sign}</span>}\n {dialButton.alt && <span>{dialButton.alt}</span>}\n {dialButton.special && <StyledSpecial>{dialButton.special}</StyledSpecial>}\n {dialButton.icon && <Icon name={dialButton.icon} />}\n </StyledDialButton>\n )\n )}\n </div>\n );\n }\n return undefined;\n })}\n </StyledDialPadKeyboard>\n );\n }\n);\n\nexport default DialPadKeyboard;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DialPad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DialPad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DialPad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC","sourcesContent":["export { default } from './DialPad';\nexport { DialPadKeyboardProps } from './DialPadKeyboard';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DialPad/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["export { default } from './DialPad';\nexport { default as DialPadDialog } from './DialPadDialog';\nexport { DialPadKeyboardProps } from './DialPadKeyboard';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntelligentGuidance.styles.d.ts","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.styles.d.ts","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":";AAuBA,eAAO,MAAM,6BAA6B,2NA8ExC,CAAC;AAIH,eAAO,MAAM,+BAA+B,qOAiB1C,CAAC;AAaH,MAAM,WAAW,8BAA8B;IAC7C,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,yBAAyB,qIAgCrC,CAAC"}
|
|
@@ -4,7 +4,6 @@ import { Button, defaultThemeProp, StyledButton, StyledCard, StyledFlex, StyledI
|
|
|
4
4
|
import { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';
|
|
5
5
|
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
6
|
import { StyledSummaryListContent } from '@pega/cosmos-react-core/lib/components/SummaryList/SummaryList';
|
|
7
|
-
const navWidth = '4rem';
|
|
8
7
|
const itemIconSize = '2rem';
|
|
9
8
|
export const StyledIntelligentGuidanceList = styled(SummaryList)(({ theme }) => {
|
|
10
9
|
const borderColor = tryCatch(() => lighten(0.1, theme.components['app-shell'].nav['background-color']));
|
|
@@ -112,7 +111,9 @@ const slideIn = keyframes `
|
|
|
112
111
|
export const StyledIntelligentGuidance = styled.div(({ theme, isCollapsed }) => {
|
|
113
112
|
return css `
|
|
114
113
|
position: fixed;
|
|
115
|
-
inset-inline-start: calc(2 * ${theme.base.spacing} +
|
|
114
|
+
inset-inline-start: calc(2 * ${theme.base.spacing} + var(--appshell-horizontal-offset, 0rem));
|
|
115
|
+
transition: inset-inline-start ${theme.base.animation.speed}
|
|
116
|
+
${theme.base.animation.timing.ease};
|
|
116
117
|
bottom: ${isCollapsed ? `calc(2 * ${theme.base.spacing}) ` : 0};
|
|
117
118
|
@media (min-width: ${theme.base.breakpoints.md}) {
|
|
118
119
|
bottom: 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntelligentGuidance.styles.js","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAE1G,MAAM,
|
|
1
|
+
{"version":3,"file":"IntelligentGuidance.styles.js","sourceRoot":"","sources":["../../../src/components/IntelligentGuidance/IntelligentGuidance.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAE1G,MAAM,YAAY,GAAG,MAAM,CAAC;AAE5B,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAChC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CACpE,CAAC;IACF,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,EAAE,CAC/B,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CACrE,CAAC;IACF,OAAO,GAAG,CAAA;;;aAGC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;kBAEnB,KAAK,CAAC,IAAI,CAAC,MAAM,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,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css, keyframes } from 'styled-components';\nimport { lighten } from 'polished';\n\nimport {\n Button,\n defaultThemeProp,\n StyledButton,\n StyledCard,\n StyledFlex,\n StyledIcon,\n StyledEmptyState,\n SummaryList,\n StyledText,\n tryCatch,\n StyledSummaryItem,\n StyledVisual\n} from '@pega/cosmos-react-core';\nimport { StyledCount } from '@pega/cosmos-react-core/lib/components/Badges/Count';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledSummaryListContent } from '@pega/cosmos-react-core/lib/components/SummaryList/SummaryList';\n\nconst itemIconSize = '2rem';\n\nexport const StyledIntelligentGuidanceList = styled(SummaryList)(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n const hoverColor = tryCatch(() =>\n lighten(0.05, theme.components['app-shell'].nav['background-color'])\n );\n return css`\n min-width: 20rem;\n max-width: 20rem;\n color: ${theme.base.palette.light};\n overflow: hidden;\n box-shadow: ${theme.base.shadow.low};\n @media (min-width: ${theme.base.breakpoints.lg}) {\n min-width: 23rem;\n max-width: 23rem;\n }\n &:not(& &) {\n background-color: ${theme.components['app-shell'].nav['background-color']};\n }\n ${StyledCardHeader} {\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: ${theme.base.spacing};\n }\n ${StyledFlex} > ${StyledIcon} {\n width: ${itemIconSize};\n height: ${itemIconSize};\n padding: calc(0.75 * ${theme.base.spacing});\n border-radius: calc(3 * ${theme.base['border-radius']});\n background-color: ${theme.base.palette.success};\n }\n }\n ${StyledSummaryListContent} {\n &:not(${StyledCard} ${StyledCard} > &) {\n padding: 0;\n }\n }\n ${StyledButton}:enabled:focus {\n box-shadow: ${theme.base.shadow['focus-inverted']};\n }\n ${StyledSummaryItem} {\n padding: ${theme.base.spacing};\n border-top: ${theme.components.button['border-width']} solid ${borderColor};\n outline: none;\n ${StyledVisual} ${StyledIcon} {\n width: ${itemIconSize};\n height: ${itemIconSize};\n padding: calc(0.75 * ${theme.base.spacing});\n }\n ${StyledButton} {\n visibility: hidden;\n }\n &:not(:last-child) {\n border-bottom: none;\n }\n &:hover {\n background-color: ${hoverColor};\n cursor: pointer;\n }\n &:hover,\n &:focus,\n &:focus-within {\n ${StyledButton} {\n visibility: visible;\n }\n }\n &:enabled:focus,\n &:not([disabled]):focus {\n box-shadow: inset ${theme.base.shadow['focus-inverted']};\n }\n }\n ${StyledEmptyState} {\n padding-bottom: ${theme.base.spacing};\n ${StyledIcon}, ${StyledText} {\n color: ${theme.base.palette.light};\n }\n }\n `;\n});\n\nStyledIntelligentGuidanceList.defaultProps = defaultThemeProp;\n\nexport const StyledIntelligentGuidanceButton = styled(Button)(({ theme }) => {\n return css`\n box-shadow: ${theme.base.shadow.low};\n color: ${theme.base.palette.light};\n background-color: ${theme.base.palette.success};\n width: 4rem;\n height: 4rem;\n svg {\n width: 2.25rem;\n height: 2.25rem;\n }\n ${StyledCount} {\n position: absolute;\n right: 0;\n top: 0;\n }\n `;\n});\n\nStyledIntelligentGuidanceButton.defaultProps = defaultThemeProp;\n\nconst slideIn = keyframes`\n 0% {\n transform: translateY(100%);\n }\n 100% {\n transform: translateY(0);\n }\n`;\n\nexport interface StyledIntelligentGuidanceProps {\n isCollapsed: boolean;\n hasItems: boolean;\n}\n\nexport const StyledIntelligentGuidance = styled.div<StyledIntelligentGuidanceProps>(\n ({ theme, isCollapsed }) => {\n return css`\n position: fixed;\n inset-inline-start: calc(2 * ${theme.base.spacing} + var(--appshell-horizontal-offset, 0rem));\n transition: inset-inline-start ${theme.base.animation.speed}\n ${theme.base.animation.timing.ease};\n bottom: ${isCollapsed ? `calc(2 * ${theme.base.spacing}) ` : 0};\n @media (min-width: ${theme.base.breakpoints.md}) {\n bottom: 0;\n }\n z-index: ${theme.base['z-index'].popover};\n ${StyledIntelligentGuidanceList}:not(${StyledIntelligentGuidanceList} ${StyledIntelligentGuidanceList}) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n transition: transform calc(4 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n ${isCollapsed &&\n css`\n transform: translateY(calc(100% - var(--headerHeight)));\n `}\n ${StyledCardHeader} ${StyledButton} {\n transition: transform calc(2 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n transform: ${isCollapsed ? 'rotate(-180deg)' : 'rotate(0)'};\n }\n }\n ${StyledIntelligentGuidanceButton} {\n animation: ${slideIn} calc(4 * ${theme.base.animation.speed});\n }\n `;\n }\n);\n\nStyledIntelligentGuidance.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionNotification.d.ts","sourceRoot":"","sources":["../../../src/components/InteractionNotification/InteractionNotification.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAQL,WAAW,EACX,YAAY,EAWZ,mBAAmB,EAEnB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,4BAA6B,SAAQ,cAAc;IAClE,wBAAwB;IACxB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,MAAM,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,iFAAiF;IACjF,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAqED,QAAA,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,4BAA4B,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"InteractionNotification.d.ts","sourceRoot":"","sources":["../../../src/components/InteractionNotification/InteractionNotification.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAQL,WAAW,EACX,YAAY,EAWZ,mBAAmB,EAEnB,cAAc,EACf,MAAM,yBAAyB,CAAC;AAKjC,MAAM,WAAW,4BAA6B,SAAQ,cAAc;IAClE,wBAAwB;IACxB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oDAAoD;IACpD,MAAM,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1D,iFAAiF;IACjF,MAAM,CAAC,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACvC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAqED,QAAA,MAAM,uBAAuB,EAAE,iBAAiB,CAAC,4BAA4B,GAAG,YAAY,CA+CzF,CAAC;AAEJ,eAAe,uBAAuB,CAAC"}
|
|
@@ -72,7 +72,7 @@ const StyledInteractionNotification = styled(Card)(({ theme: { base } }) => {
|
|
|
72
72
|
StyledInteractionNotification.defaultProps = defaultThemeProp;
|
|
73
73
|
const InteractionNotification = forwardRef(({ icon, title, primaryText, secondaryText, status, fields, onAccept }, ref) => {
|
|
74
74
|
const t = useI18n();
|
|
75
|
-
return (_jsxs(StyledInteractionNotification, { ref: ref, children: [_jsx(CardHeader, { actions: _jsx(Button, { variant: 'primary', onClick: onAccept, children: t('accept') }), children: _jsx(SummaryItem, { visual: _jsx(Avatar, { shape: 'circle', size: 'm', name: title, icon: icon }), primary: title }) }), _jsx(CardContent, { children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'center', gap: 1 }, children: [_jsx(Text, { variant: 'h1', children: primaryText }), secondaryText && _jsx(Text, { variant: 'secondary', children: secondaryText }), _jsx(Status, { variant: status.variant, children: status.text })] }) }), fields && fields.length !== 0 && (_jsx(CardFooter, { children: _jsx(FieldValueList, { variant: 'inline', fields: fields }) }))] }));
|
|
75
|
+
return (_jsxs(StyledInteractionNotification, { ref: ref, children: [_jsx(CardHeader, { actions: onAccept ? (_jsx(Button, { variant: 'primary', onClick: onAccept, children: t('accept') })) : undefined, children: _jsx(SummaryItem, { visual: _jsx(Avatar, { shape: 'circle', size: 'm', name: title, icon: icon }), primary: title }) }), _jsx(CardContent, { children: _jsxs(Flex, { container: { direction: 'column', alignItems: 'center', gap: 1 }, children: [_jsx(Text, { variant: 'h1', children: primaryText }), secondaryText && _jsx(Text, { variant: 'secondary', children: secondaryText }), _jsx(Status, { variant: status.variant, children: status.text })] }) }), fields && fields.length !== 0 && (_jsx(CardFooter, { children: _jsx(FieldValueList, { variant: 'inline', fields: fields }) }))] }));
|
|
76
76
|
});
|
|
77
77
|
export default InteractionNotification;
|
|
78
78
|
//# sourceMappingURL=InteractionNotification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionNotification.js","sourceRoot":"","sources":["../../../src/components/InteractionNotification/InteractionNotification.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAA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AC,CAAC;AAEH,6BAA6B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE9D,MAAM,uBAAuB,GAC3B,UAAU,CACR,CACE,EACE,IAAI,EACJ,KAAK,EACL,WAAW,EACX,aAAa,EACb,MAAM,EACN,MAAM,EACN,QAAQ,EACsC,EAChD,GAAwC,EACxC,EAAE;IACF,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,MAAC,6BAA6B,IAAC,GAAG,EAAE,GAAG,aACrC,KAAC,UAAU,IACT,OAAO,EACL,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,QAAQ,YACxC,CAAC,CAAC,QAAQ,CAAC,GACL,
|
|
1
|
+
{"version":3,"file":"InteractionNotification.js","sourceRoot":"","sources":["../../../src/components/InteractionNotification/InteractionNotification.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC5E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,MAAM,EACN,IAAI,EACJ,WAAW,EAGX,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,MAAM,EACN,cAAc,EACd,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,YAAY,EACZ,OAAO,EAEP,YAAY,EAEb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAqB1F,MAAM,6BAA6B,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE;IACzE,MAAM,EAAE,GAAG,EAAE,GAAG,YAAY,EAAE,CA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M,EAAE,KAAC,MAAM,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,GAAG,EAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,EACnE,OAAO,EAAE,KAAK,GACd,GACS,EACb,KAAC,WAAW,cACV,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACpE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,WAAW,GAAQ,EACtC,aAAa,IAAI,KAAC,IAAI,IAAC,OAAO,EAAC,WAAW,YAAE,aAAa,GAAQ,EAClE,KAAC,MAAM,IAAC,OAAO,EAAE,MAAM,CAAC,OAAO,YAAG,MAAM,CAAC,IAAI,GAAU,IAClD,GACK,EACb,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAChC,KAAC,UAAU,cACT,KAAC,cAAc,IAAC,OAAO,EAAC,QAAQ,EAAC,MAAM,EAAE,MAAM,GAAI,GACxC,CACd,IAC6B,CACjC,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,uBAAuB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n Status,\n Text,\n SummaryItem,\n StatusProps,\n ForwardProps,\n defaultThemeProp,\n Flex,\n StyledText,\n Avatar,\n FieldValueList,\n StyledFieldName,\n CardFooter,\n StyledFieldValueList,\n StyledButton,\n useI18n,\n FieldValueListProps,\n useDirection,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';\n\nexport interface InteractionNotificationProps extends NoChildrenProp {\n /** Ref to Component. */\n ref?: Ref<HTMLDivElement>;\n /** Name of the icon used in header. */\n icon: string;\n /** Interaction title. */\n title: string;\n /** Primary information of the notification. For example caller name . */\n primaryText: string;\n /** Secondary information of the notification. For example phone number of the caller */\n secondaryText?: string;\n /** Represents the current status of interaction. */\n status: { variant: StatusProps['variant']; text: string };\n /** Information structured as field values to be displayed below main section. */\n fields?: FieldValueListProps['fields'];\n /** Callback when accept button is clicked. */\n onAccept?: () => void;\n}\n\nconst StyledInteractionNotification = styled(Card)(({ theme: { base } }) => {\n const { rtl } = useDirection();\n return css`\n position: fixed;\n inset-inline-end: 1rem;\n inset-block-start: 4rem;\n width: clamp(21.5rem, calc(100% - 2rem), 25rem);\n z-index: ${base['z-index'].modal};\n color: ${base.colors.white};\n animation: SlideIn calc(4 * ${base.animation.speed});\n padding: calc(0.75 * ${base.spacing}) 0;\n\n &:not(& &) {\n background-color: ${base.colors.slate['extra-dark']};\n }\n\n @keyframes SlideIn {\n 0% {\n ${rtl\n ? css`\n transform: translateX(calc(-100% - 1rem));\n `\n : css`\n transform: translateX(calc(100% + 1rem));\n `}\n }\n\n 100% {\n transform: translateX(0);\n }\n }\n\n ${StyledCardHeader} {\n ${StyledButton} {\n margin-inline-start: calc(2 * ${base.spacing});\n }\n }\n\n ${StyledCardContent} {\n margin: calc(2 * ${base.spacing}) 0;\n\n ${StyledText} {\n color: ${base.colors.white};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n width: 100%;\n text-align: center;\n }\n }\n\n ${StyledCardFooter} {\n ${StyledFieldValueList} {\n border-top: solid 0.0625rem ${base.colors.gray.medium};\n padding-top: calc(2 * ${base.spacing});\n color: ${base.colors.white};\n\n ${StyledFieldName} {\n color: ${base.colors.white};\n }\n }\n }\n `;\n});\n\nStyledInteractionNotification.defaultProps = defaultThemeProp;\n\nconst InteractionNotification: FunctionComponent<InteractionNotificationProps & ForwardProps> =\n forwardRef(\n (\n {\n icon,\n title,\n primaryText,\n secondaryText,\n status,\n fields,\n onAccept\n }: PropsWithoutRef<InteractionNotificationProps>,\n ref: InteractionNotificationProps['ref']\n ) => {\n const t = useI18n();\n\n return (\n <StyledInteractionNotification ref={ref}>\n <CardHeader\n actions={\n onAccept ? (\n <Button variant='primary' onClick={onAccept}>\n {t('accept')}\n </Button>\n ) : undefined\n }\n >\n <SummaryItem\n visual={<Avatar shape='circle' size='m' name={title} icon={icon} />}\n primary={title}\n />\n </CardHeader>\n <CardContent>\n <Flex container={{ direction: 'column', alignItems: 'center', gap: 1 }}>\n <Text variant='h1'>{primaryText}</Text>\n {secondaryText && <Text variant='secondary'>{secondaryText}</Text>}\n <Status variant={status.variant}>{status.text}</Status>\n </Flex>\n </CardContent>\n {fields && fields.length !== 0 && (\n <CardFooter>\n <FieldValueList variant='inline' fields={fields} />\n </CardFooter>\n )}\n </StyledInteractionNotification>\n );\n }\n );\n\nexport default InteractionNotification;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-cs",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.23.0",
|
|
4
4
|
"author": "Pegasystems",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"build": "tsc -b"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@pega/cosmos-react-core": "3.0.0-dev.
|
|
24
|
-
"@pega/cosmos-react-dnd": "3.0.0-dev.
|
|
23
|
+
"@pega/cosmos-react-core": "3.0.0-dev.23.0",
|
|
24
|
+
"@pega/cosmos-react-dnd": "3.0.0-dev.23.0",
|
|
25
25
|
"@types/react": "^16.14.24 || ^17.0.38",
|
|
26
26
|
"@types/react-dom": "^16.9.14 || ^17.0.11",
|
|
27
27
|
"@types/styled-components": "^5.1.7",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallHandoverForm.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallHandoverForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAkC,MAAM,OAAO,CAAC;AAmB3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAW,MAAM,0BAA0B,CAAC;AAK5F,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,EAAE,CAAC,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD,gDAAgD;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,+BAA+B;IAC/B,eAAe,EAAE,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAClD,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,oNAElC,CAAC;AAIF,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,CAkI9D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useState, useMemo } from 'react';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
import { Button, Icon, registerIcon, defaultThemeProp, useI18n, RadioButtonGroup, RadioButton, TextArea, ComboBox, Form, createStringMatcher } from '@pega/cosmos-react-core';
|
|
5
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
6
|
-
import { ContactsContext } from './CalleePicker';
|
|
7
|
-
registerIcon(timesIcon);
|
|
8
|
-
export const StyledCallHandoverForm = styled(Form) `
|
|
9
|
-
min-width: 50ch;
|
|
10
|
-
`;
|
|
11
|
-
StyledCallHandoverForm.defaultProps = defaultThemeProp;
|
|
12
|
-
const CallHandoverForm = ({ onCancel: onClose, onSubmit: onTransferCall, transferOptions }) => {
|
|
13
|
-
const t = useI18n();
|
|
14
|
-
const { contacts } = useContext(ContactsContext);
|
|
15
|
-
const [selectedReason, setSelectedReason] = useState();
|
|
16
|
-
const [selectedContact, setSelectedContact] = useState();
|
|
17
|
-
const [filterValue, setFilterValue] = useState('');
|
|
18
|
-
const [comments, setComments] = useState('');
|
|
19
|
-
const [interaction, setInteraction] = useState(true);
|
|
20
|
-
const contactsToRender = useMemo(() => {
|
|
21
|
-
let items = contacts;
|
|
22
|
-
if (filterValue) {
|
|
23
|
-
const matcher = createStringMatcher(filterValue, 'boundary');
|
|
24
|
-
items = items.filter(item => matcher.test(item.primary) || matcher.test(item.phoneNumber));
|
|
25
|
-
}
|
|
26
|
-
return items.map(({ phoneNumber, primary, secondary, favorite }) => ({
|
|
27
|
-
id: phoneNumber,
|
|
28
|
-
primary,
|
|
29
|
-
secondary: [secondary],
|
|
30
|
-
visual: _jsx(Icon, { name: favorite ? 'star-solid' : 'star' }),
|
|
31
|
-
selected: phoneNumber === selectedContact?.phoneNumber
|
|
32
|
-
}));
|
|
33
|
-
}, [filterValue, selectedContact, contacts]);
|
|
34
|
-
const clearSelection = () => {
|
|
35
|
-
setSelectedContact(undefined);
|
|
36
|
-
};
|
|
37
|
-
return (_jsxs(StyledCallHandoverForm, { actions: _jsxs(_Fragment, { children: [_jsx(Button, { variant: 'secondary', onClick: onClose, children: t('cancel') }), _jsx(Button, { variant: 'primary', disabled: !(selectedContact && (!interaction || (selectedReason && comments))), onClick: () => {
|
|
38
|
-
if (!selectedContact)
|
|
39
|
-
return;
|
|
40
|
-
onTransferCall({
|
|
41
|
-
reason: selectedReason?.id,
|
|
42
|
-
comments,
|
|
43
|
-
interaction,
|
|
44
|
-
phoneNumber: selectedContact.phoneNumber
|
|
45
|
-
});
|
|
46
|
-
}, children: t('submit') })] }), children: [_jsxs(RadioButtonGroup, { name: t('call_panel_handover_call_option_label'), children: [_jsx(RadioButton, { label: t('call_panel_handover_call_and_interaction_option'), defaultChecked: true, onChange: () => setInteraction(true) }), _jsx(RadioButton, { label: t('call_panel_handover_call_only_option'), onChange: () => setInteraction(false) })] }), _jsx(ComboBox, { label: t('call_panel_handover_reason_label'), required: interaction, disabled: !interaction, selected: {
|
|
47
|
-
items: selectedReason ? { id: selectedReason.id, text: selectedReason.label } : undefined
|
|
48
|
-
}, menu: {
|
|
49
|
-
items: transferOptions.map(({ id, label }) => ({
|
|
50
|
-
id,
|
|
51
|
-
primary: label,
|
|
52
|
-
selected: id === selectedReason?.id
|
|
53
|
-
})),
|
|
54
|
-
onItemClick: id => setSelectedReason(transferOptions.find(option => option.id === id))
|
|
55
|
-
} }), _jsx(TextArea, { name: 'comments', required: interaction, disabled: !interaction, label: t('call_panel_handover_comments_label'), displayCharCount: true, maxLength: 300, value: comments, onChange: (e) => setComments(e.target.value) }), _jsx(ComboBox, { label: t('call_panel_handover_to_label'), required: true, selected: selectedContact
|
|
56
|
-
? {
|
|
57
|
-
items: {
|
|
58
|
-
id: selectedContact.phoneNumber,
|
|
59
|
-
text: selectedContact.primary
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
: undefined, value: filterValue, onChange: (e) => {
|
|
63
|
-
if (!e.target.value)
|
|
64
|
-
clearSelection();
|
|
65
|
-
setFilterValue(e.target.value);
|
|
66
|
-
}, onBlur: () => {
|
|
67
|
-
setFilterValue('');
|
|
68
|
-
}, menu: {
|
|
69
|
-
items: contactsToRender,
|
|
70
|
-
onItemClick: phoneNumber => {
|
|
71
|
-
setFilterValue('');
|
|
72
|
-
setSelectedContact(contacts.find(contact => contact.phoneNumber === phoneNumber));
|
|
73
|
-
},
|
|
74
|
-
emptyText: t('no_items')
|
|
75
|
-
} })] }));
|
|
76
|
-
};
|
|
77
|
-
export default CallHandoverForm;
|
|
78
|
-
//# sourceMappingURL=CallHandoverForm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallHandoverForm.js","sourceRoot":"","sources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","sourcesContent":["import { useContext, FunctionComponent, Ref, useState, useMemo, ChangeEvent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Icon,\n registerIcon,\n defaultThemeProp,\n useI18n,\n RadioButtonGroup,\n RadioButton,\n TextArea,\n ComboBox,\n Form,\n createStringMatcher,\n MenuProps\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport type { TransferReasonOption, TransferData, Contact } from './CallControlPanel.types';\nimport { ContactsContext } from './CalleePicker';\n\nregisterIcon(timesIcon);\n\nexport interface CallHandoverFormProps {\n /**\n * Callback fired on handover submission.\n * @param transferParam the transfer parameters.\n */\n onSubmit: (transferParam: TransferData) => void;\n /** Callback fired on clicking Cancel button. */\n onCancel: () => void;\n /** Transfer reason options. */\n transferOptions: Readonly<TransferReasonOption[]>;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledCallHandoverForm = styled(Form)`\n min-width: 50ch;\n`;\n\nStyledCallHandoverForm.defaultProps = defaultThemeProp;\n\nconst CallHandoverForm: FunctionComponent<CallHandoverFormProps> = ({\n onCancel: onClose,\n onSubmit: onTransferCall,\n transferOptions\n}: CallHandoverFormProps) => {\n const t = useI18n();\n const { contacts } = useContext(ContactsContext);\n const [selectedReason, setSelectedReason] = useState<TransferReasonOption>();\n const [selectedContact, setSelectedContact] = useState<Contact>();\n const [filterValue, setFilterValue] = useState('');\n const [comments, setComments] = useState('');\n const [interaction, setInteraction] = useState(true);\n\n const contactsToRender = useMemo<MenuProps['items']>(() => {\n let items = contacts;\n if (filterValue) {\n const matcher = createStringMatcher(filterValue, 'boundary');\n items = items.filter(item => matcher.test(item.primary) || matcher.test(item.phoneNumber));\n }\n\n return items.map(({ phoneNumber, primary, secondary, favorite }) => ({\n id: phoneNumber,\n primary,\n secondary: [secondary],\n visual: <Icon name={favorite ? 'star-solid' : 'star'} />,\n selected: phoneNumber === selectedContact?.phoneNumber\n }));\n }, [filterValue, selectedContact, contacts]);\n\n const clearSelection = () => {\n setSelectedContact(undefined);\n };\n\n return (\n <StyledCallHandoverForm\n actions={\n <>\n <Button variant='secondary' onClick={onClose}>\n {t('cancel')}\n </Button>\n <Button\n variant='primary'\n disabled={!(selectedContact && (!interaction || (selectedReason && comments)))}\n onClick={() => {\n if (!selectedContact) return;\n onTransferCall({\n reason: selectedReason?.id,\n comments,\n interaction,\n phoneNumber: selectedContact.phoneNumber\n });\n }}\n >\n {t('submit')}\n </Button>\n </>\n }\n >\n <RadioButtonGroup name={t('call_panel_handover_call_option_label')}>\n <RadioButton\n label={t('call_panel_handover_call_and_interaction_option')}\n defaultChecked\n onChange={() => setInteraction(true)}\n />\n <RadioButton\n label={t('call_panel_handover_call_only_option')}\n onChange={() => setInteraction(false)}\n />\n </RadioButtonGroup>\n\n <ComboBox\n label={t('call_panel_handover_reason_label')}\n required={interaction}\n disabled={!interaction}\n selected={{\n items: selectedReason ? { id: selectedReason.id, text: selectedReason.label } : undefined\n }}\n menu={{\n items: transferOptions.map(({ id, label }) => ({\n id,\n primary: label,\n selected: id === selectedReason?.id\n })),\n onItemClick: id => setSelectedReason(transferOptions.find(option => option.id === id))\n }}\n />\n\n <TextArea\n name='comments'\n required={interaction}\n disabled={!interaction}\n label={t('call_panel_handover_comments_label')}\n displayCharCount\n maxLength={300}\n value={comments}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setComments(e.target.value)}\n />\n\n <ComboBox\n label={t('call_panel_handover_to_label')}\n required\n selected={\n selectedContact\n ? {\n items: {\n id: selectedContact.phoneNumber,\n text: selectedContact.primary\n }\n }\n : undefined\n }\n value={filterValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (!e.target.value) clearSelection();\n setFilterValue(e.target.value);\n }}\n onBlur={() => {\n setFilterValue('');\n }}\n menu={{\n items: contactsToRender,\n onItemClick: phoneNumber => {\n setFilterValue('');\n setSelectedContact(contacts.find(contact => contact.phoneNumber === phoneNumber));\n },\n emptyText: t('no_items')\n }}\n />\n </StyledCallHandoverForm>\n );\n};\n\nexport default CallHandoverForm;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalleePicker.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CalleePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAEjB,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAWL,YAAY,EAGb,MAAM,yBAAyB,CAAC;AAQjC,OAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIjE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,mFAK1B,CAAC;AAgBH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAsErE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, CardContent, CardHeader, Flex, Icon, registerIcon, Text, TabPanel, Tabs, Card, defaultThemeProp, useI18n } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
-
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
7
|
-
import { StyledTabPanel } from '@pega/cosmos-react-core/lib/components/Tabs/TabPanel';
|
|
8
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
9
|
-
import DialPad from '../DialPad/DialPad';
|
|
10
|
-
import ContactsList from './ContactsList';
|
|
11
|
-
registerIcon(timesIcon);
|
|
12
|
-
export const ContactsContext = createContext({
|
|
13
|
-
contacts: [],
|
|
14
|
-
onFavoriteToggle: () => { }
|
|
15
|
-
});
|
|
16
|
-
const StyledCalleePicker = styled(Card)(({ theme }) => {
|
|
17
|
-
return css `
|
|
18
|
-
${StyledCardHeader}, ${StyledCardContent} {
|
|
19
|
-
padding: calc(1.25 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${StyledTabPanel} {
|
|
23
|
-
height: 24rem;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
});
|
|
27
|
-
StyledCalleePicker.defaultProps = defaultThemeProp;
|
|
28
|
-
const CalleePicker = forwardRef(({ heading, onClose, onCall }, ref) => {
|
|
29
|
-
const t = useI18n();
|
|
30
|
-
const [currentTab, setCurrentTab] = useState('all');
|
|
31
|
-
const tabsRef = useRef(null);
|
|
32
|
-
const { contacts, onFavoriteToggle } = useContext(ContactsContext);
|
|
33
|
-
const favorites = contacts.filter(item => item.favorite);
|
|
34
|
-
const handleTabChange = (id) => {
|
|
35
|
-
setCurrentTab(id);
|
|
36
|
-
};
|
|
37
|
-
const tabsHeaders = [
|
|
38
|
-
{ id: 'all', name: t('call_panel_contacts_list_heading'), count: contacts.length },
|
|
39
|
-
{
|
|
40
|
-
id: 'favorites',
|
|
41
|
-
name: t('call_panel_contacts_favorites_heading'),
|
|
42
|
-
count: contacts.filter(item => item.favorite).length
|
|
43
|
-
},
|
|
44
|
-
{ id: 'dial-pad', name: t('call_panel_contacts_dial_pad_heading') }
|
|
45
|
-
];
|
|
46
|
-
const tabContent = (tabId) => {
|
|
47
|
-
if (tabId === 'dial-pad')
|
|
48
|
-
return _jsx(DialPad, { onCallButtonClick: onCall, mode: 'default' });
|
|
49
|
-
return (_jsx(ContactsList, { contacts: tabId === 'favorites' ? favorites : contacts, onFavoriteToggle: onFavoriteToggle, action: {
|
|
50
|
-
label: t('call_panel_contacts_call_button_label'),
|
|
51
|
-
icon: 'phone-solid',
|
|
52
|
-
callback: onCall
|
|
53
|
-
} }));
|
|
54
|
-
};
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
tabsRef.current?.firstChild.focus();
|
|
57
|
-
}, []);
|
|
58
|
-
return (_jsxs(StyledCalleePicker, { ref: ref, children: [_jsx(CardHeader, { actions: _jsx(Button, { icon: true, variant: 'simple', "aria-label": t('close'), onClick: onClose, children: _jsx(Icon, { name: 'times' }) }), children: _jsx(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: _jsx(Text, { variant: 'h3', children: heading }) }) }), _jsxs(CardContent, { container: { itemGap: 2 }, children: [_jsx(Tabs, { ref: tabsRef, tabs: tabsHeaders, type: 'horizontal', onTabClick: handleTabChange, currentTabId: currentTab }), _jsx(TabPanel, { tabId: currentTab, children: tabContent(currentTab) })] })] }));
|
|
59
|
-
});
|
|
60
|
-
export default CalleePicker;
|
|
61
|
-
//# sourceMappingURL=CalleePicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalleePicker.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CalleePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EAIV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EAEJ,gBAAgB,EAChB,OAAO,EACR,MAAM,yBAAyB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OAAO,EACL,KAAC,MAAM,IAAC,IAAI,QAAC,OAAO,EAAC,QAAQ,gBAAa,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,YACpE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,YAGX,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,YACnD,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,GAC9B,GACI,EACb,MAAC,WAAW,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,aACpC,KAAC,IAAI,IACH,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,WAAW,EACjB,IAAI,EAAC,YAAY,EACjB,UAAU,EAAE,eAAe,EAC3B,YAAY,EAAE,UAAU,GACxB,EACF,KAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAAG,UAAU,CAAC,UAAU,CAAC,GAAY,IACpD,IACK,CACtB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n createContext,\n useContext,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n CardContent,\n CardHeader,\n Flex,\n Icon,\n registerIcon,\n Text,\n TabPanel,\n Tabs,\n Card,\n ForwardProps,\n defaultThemeProp,\n useI18n\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledTabPanel } from '@pega/cosmos-react-core/lib/components/Tabs/TabPanel';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport DialPad from '../DialPad/DialPad';\n\nimport ContactsList, { ContactsListProps } from './ContactsList';\n\nregisterIcon(timesIcon);\n\nexport interface CalleePickerProps {\n /** Heading for the new call. */\n heading: string;\n /**\n * Callback fired on new call made by the user.\n * @param phoneNumber the number chosen.\n */\n onCall: (phoneNumber: string) => void;\n /** Callback fired on clicking close button. */\n onClose?: () => void;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ContactsContext = createContext<\n Pick<ContactsListProps, 'contacts' | 'onFavoriteToggle'>\n>({\n contacts: [],\n onFavoriteToggle: () => {}\n});\n\nconst StyledCalleePicker = styled(Card)(({ theme }) => {\n return css`\n ${StyledCardHeader}, ${StyledCardContent} {\n padding: calc(1.25 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);\n }\n\n ${StyledTabPanel} {\n height: 24rem;\n }\n `;\n});\n\nStyledCalleePicker.defaultProps = defaultThemeProp;\n\nconst CalleePicker: FunctionComponent<CalleePickerProps & ForwardProps> = forwardRef(\n (\n { heading, onClose, onCall }: PropsWithoutRef<CalleePickerProps>,\n ref: CalleePickerProps['ref']\n ) => {\n const t = useI18n();\n const [currentTab, setCurrentTab] = useState('all');\n const tabsRef = useRef<HTMLElement>(null);\n const { contacts, onFavoriteToggle } = useContext(ContactsContext);\n const favorites = contacts.filter(item => item.favorite);\n\n const handleTabChange = (id: string) => {\n setCurrentTab(id);\n };\n\n const tabsHeaders = [\n { id: 'all', name: t('call_panel_contacts_list_heading'), count: contacts.length },\n {\n id: 'favorites',\n name: t('call_panel_contacts_favorites_heading'),\n count: contacts.filter(item => item.favorite).length\n },\n { id: 'dial-pad', name: t('call_panel_contacts_dial_pad_heading') }\n ];\n\n const tabContent = (tabId: string) => {\n if (tabId === 'dial-pad') return <DialPad onCallButtonClick={onCall} mode='default' />;\n return (\n <ContactsList\n contacts={tabId === 'favorites' ? favorites : contacts}\n onFavoriteToggle={onFavoriteToggle}\n action={{\n label: t('call_panel_contacts_call_button_label'),\n icon: 'phone-solid',\n callback: onCall\n }}\n />\n );\n };\n\n useEffect(() => {\n (tabsRef.current?.firstChild as HTMLButtonElement).focus();\n }, []);\n\n return (\n <StyledCalleePicker ref={ref}>\n <CardHeader\n actions={\n <Button icon variant='simple' aria-label={t('close')} onClick={onClose}>\n <Icon name='times' />\n </Button>\n }\n >\n <Flex container={{ alignItems: 'center', itemGap: 1 }}>\n <Text variant='h3'>{heading}</Text>\n </Flex>\n </CardHeader>\n <CardContent container={{ itemGap: 2 }}>\n <Tabs\n ref={tabsRef}\n tabs={tabsHeaders}\n type='horizontal'\n onTabClick={handleTabChange}\n currentTabId={currentTab}\n />\n <TabPanel tabId={currentTab}>{tabContent(currentTab)}</TabPanel>\n </CardContent>\n </StyledCalleePicker>\n );\n }\n);\n\nexport default CalleePicker;\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, Ref } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { Contact } from './CallControlPanel.types';
|
|
4
|
-
export interface ContactsListProps {
|
|
5
|
-
/** An array of contacts objects. */
|
|
6
|
-
contacts: Contact[];
|
|
7
|
-
/**
|
|
8
|
-
* Primary action the user may select.
|
|
9
|
-
* @param phoneNumber the number chosen.
|
|
10
|
-
*/
|
|
11
|
-
action: {
|
|
12
|
-
label: string;
|
|
13
|
-
icon: string;
|
|
14
|
-
callback: (phoneNumber: string) => void;
|
|
15
|
-
};
|
|
16
|
-
/** Callback fired on adding/removing contact to/from favorites */
|
|
17
|
-
onFavoriteToggle: (phoneNumber: string, favorites: boolean) => void;
|
|
18
|
-
/** Reference to the root component. */
|
|
19
|
-
ref?: Ref<HTMLDivElement>;
|
|
20
|
-
}
|
|
21
|
-
declare const ContactsList: FunctionComponent<ContactsListProps & ForwardProps>;
|
|
22
|
-
export default ContactsList;
|
|
23
|
-
//# sourceMappingURL=ContactsList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsList.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ContactsList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,GAAG,EAGJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,YAAY,EAab,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;;OAGG;IACH,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KACzC,CAAC;IACF,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACpE,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAoCD,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAkFrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|