@pega/cosmos-react-cs 10.0.0-build.1.9 → 10.0.0-build.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,7 +89,7 @@ const ContactList = forwardRef(function ContactList({ contacts: items, onItemCli
89
89
  onFavoriteToggle(phoneNumber, favorite);
90
90
  }, "aria-label": favorite
91
91
  ? t('call_panel_contacts_add_to_favorites')
92
- : t('call_panel_contacts_remove_from_favorites'), children: _jsx(Icon, { name: favorite ? 'star-solid' : 'star' }) })), [onFavoriteToggle]);
92
+ : t('call_panel_contacts_remove_from_favorites'), children: _jsx(Icon, { name: favorite ? 'star-solid' : 'star', emphasized: favorite }) })), [onFavoriteToggle]);
93
93
  const createList = (list) => {
94
94
  return list.map(item => {
95
95
  const commonOpts = {
@@ -1 +1 @@
1
- {"version":3,"file":"ContactList.js","sourceRoot":"","sources":["../../../../src/components/CallControlPanel/ContactList/ContactList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,wBAAwB,EACxB,aAAa,EACb,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,cAAc,MAAM,8D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AEnE,OAAO,CACL,KAAC,OAAO,IACN,EAAE,EAAE,iBAAiB,EACrB,GAAG,EAAE,YAAY,EACjB,KAAK,EACH,UAAU;YACR,CAAC,CAAC,UAAU,CACR,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;gBACnD,OAAO,CACL,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBACxD,SAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBAC1D,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAC7D,CAAC;YACJ,CAAC,CAAC,CACH;YACH,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAEvB,gBAAgB,EAAE,EAAE,cAAc,EAAE,GACpC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext, forwardRef, useCallback, useState } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n defaultThemeProp,\n Icon,\n registerIcon,\n Text,\n useI18n,\n ViewAll,\n StyledSummaryItemActions,\n StyledPrimary,\n StyledSecondary,\n useArrows,\n useConsolidatedRef,\n StyledCard,\n RadioButton,\n SummaryItem,\n StyledSummaryItem,\n StyledLabel\n} from '@pega/cosmos-react-core';\nimport type { RadioButtonProps, SummaryItemProps } from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';\nimport * as starSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star-solid.icon';\nimport { StyledRadioCheckCard } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';\nimport BareRoleButton from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\nimport type { BareRoleButtonProps } from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\n\nimport type { Contact, ContactListProps, SelectableContact } from './ContactList.types';\n\nregisterIcon(starIcon, starSolidIcon);\n\nconst StyledContactList = styled.div(({ theme: { base, components } }) => {\n return css`\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 0 calc(0.5 * ${base.spacing}) calc(0.5 * ${base.spacing});\n\n > ${StyledCard} > ${StyledCardContent} {\n padding: 0;\n gap: 0;\n }\n\n ul {\n list-style: none;\n }\n\n ${StyledRadioCheckCard} {\n background-color: transparent;\n border: 0;\n padding: 0 calc(0.5 * ${base.spacing});\n height: ${components.button.height};\n align-items: center;\n border-radius: 0;\n\n > ${StyledLabel} {\n max-width: 100%;\n width: 100%;\n margin: 0;\n }\n }\n\n li {\n padding: 0;\n height: calc(${components.button.height} + 0.125rem);\n\n :not(:last-child) {\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n }\n }\n\n ${StyledSummaryItem} {\n > ${StyledPrimary}, > ${StyledSecondary} {\n align-self: center;\n font-weight: ${base['font-weight'].normal};\n }\n }\n\n ${StyledSummaryItemActions} {\n color: ${base.palette.interactive};\n }\n\n @media (pointer: 'coarse') {\n li {\n height: ${components.button.touch.height};\n }\n }\n `;\n});\n\nStyledContactList.defaultProps = defaultThemeProp;\n\nexport const ContactsContext = createContext<{\n contacts: Contact[];\n onFavoriteToggle: ContactListProps['onFavoriteToggle'];\n}>({\n contacts: [],\n onFavoriteToggle: () => {}\n});\n\nconst SelectableContactItem = ({\n id,\n primary,\n secondary,\n checked,\n container,\n onChange\n}: SummaryItemProps & RadioButtonProps) => {\n return (\n <li key={id}>\n <RadioButton\n variant='card'\n label={\n <SummaryItem id={id} primary={primary} secondary={secondary} container={container} />\n }\n checked={checked}\n onChange={onChange}\n name={`${id}-contact`}\n />\n </li>\n );\n};\n\nconst CallableContactItem = ({\n visual,\n primary,\n secondary,\n onClick,\n container\n}: SummaryItemProps & { onClick: BareRoleButtonProps['onClick'] }) => {\n return (\n <li>\n <BareRoleButton onClick={onClick}>\n <SummaryItem\n visual={visual}\n primary={primary}\n secondary={secondary}\n container={container}\n actions={<Icon name='phone-solid' />}\n />\n </BareRoleButton>\n </li>\n );\n};\n\nconst ContactList = forwardRef(function ContactList(\n { contacts: items, onItemClick, onFavoriteToggle, variant }: PropsWithoutRef<ContactListProps>,\n ref: ContactListProps['ref']\n) {\n const t = useI18n();\n const [searchText, setSearchText] = useState('');\n const containerRef = useConsolidatedRef(ref);\n\n const onSearchChange = useCallback((value: string) => {\n setSearchText(value.trim());\n }, []);\n\n const favoriteButton = useCallback(\n (phoneNumber: string, favorite: boolean) => (\n <Button\n variant='simple'\n icon\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n onFavoriteToggle(phoneNumber, favorite);\n }}\n aria-label={\n favorite\n ? t('call_panel_contacts_add_to_favorites')\n : t('call_panel_contacts_remove_from_favorites')\n }\n >\n <Icon name={favorite ? 'star-solid' : 'star'} />\n </Button>\n ),\n [onFavoriteToggle]\n );\n\n const createList = (list: SelectableContact[]) => {\n return list.map(item => {\n const commonOpts = {\n id: item.phoneNumber,\n primary: item.primary,\n secondary: <Text variant='secondary'>{item.secondary}</Text>,\n container: {\n areas: '\"visual primary secondary actions\"',\n cols: 'auto minmax(0, 2fr) minmax(0, 2fr) auto'\n }\n };\n return variant === 'select'\n ? {\n ...commonOpts,\n as: SelectableContactItem,\n checked: item.selected,\n onChange: () => onItemClick(item.phoneNumber)\n }\n : {\n ...commonOpts,\n as: CallableContactItem,\n visual: favoriteButton(item.phoneNumber, item.favorite),\n onClick: () => onItemClick(item.phoneNumber)\n };\n });\n };\n\n useArrows(containerRef, { selector: ':scope ul [role=\"button\"]' });\n\n return (\n <ViewAll\n as={StyledContactList}\n ref={containerRef}\n items={\n searchText\n ? createList(\n items.filter(({ phoneNumber, primary, secondary }) => {\n return (\n primary.toLowerCase().includes(searchText.toLowerCase()) ||\n secondary.toLowerCase().includes(searchText.toLowerCase()) ||\n phoneNumber.toLowerCase().includes(searchText.toLowerCase())\n );\n })\n )\n : createList(items)\n }\n searchInputProps={{ onSearchChange }}\n />\n );\n});\n\nexport default ContactList;\n"]}
1
+ {"version":3,"file":"ContactList.js","sourceRoot":"","sources":["../../../../src/components/CallControlPanel/ContactList/ContactList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,OAAO,EACP,wBAAwB,EACxB,aAAa,EACb,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,WAAW,EACZ,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,KAAK,QAAQ,MAAM,6DAA6D,CAAC;AACxF,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,8DAA8D,CAAC;AACpG,OAAO,cAAc,MAAM,8DAA8D,CAAC;AAK1F,YAAY,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEtC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,EAAE;IACvE,OAAO,GAAG,CAAA;;;;4BAIgB,IAAI,CAAC,OAAO,gBAAgB,IAAI,CAAC,OAAO;;QAE5D,UAAU,MAAM,iBAAiB;;;;;;;;;MASnC,oBAAoB;;;8BAGI,IAAI,CAAC,OAAO;gBAC1B,UAAU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,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBAC1D,WAAW,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAC7D,CAAC;YACJ,CAAC,CAAC,CACH;YACH,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAEvB,gBAAgB,EAAE,EAAE,cAAc,EAAE,GACpC,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,WAAW,CAAC","sourcesContent":["import { createContext, forwardRef, useCallback, useState } from 'react';\nimport type { MouseEvent, PropsWithoutRef } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n defaultThemeProp,\n Icon,\n registerIcon,\n Text,\n useI18n,\n ViewAll,\n StyledSummaryItemActions,\n StyledPrimary,\n StyledSecondary,\n useArrows,\n useConsolidatedRef,\n StyledCard,\n RadioButton,\n SummaryItem,\n StyledSummaryItem,\n StyledLabel\n} from '@pega/cosmos-react-core';\nimport type { RadioButtonProps, SummaryItemProps } from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';\nimport * as starSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star-solid.icon';\nimport { StyledRadioCheckCard } from '@pega/cosmos-react-core/lib/components/RadioCheck/RadioCheck';\nimport BareRoleButton from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\nimport type { BareRoleButtonProps } from '@pega/cosmos-react-core/lib/components/Button/BareRoleButton';\n\nimport type { Contact, ContactListProps, SelectableContact } from './ContactList.types';\n\nregisterIcon(starIcon, starSolidIcon);\n\nconst StyledContactList = styled.div(({ theme: { base, components } }) => {\n return css`\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 0 calc(0.5 * ${base.spacing}) calc(0.5 * ${base.spacing});\n\n > ${StyledCard} > ${StyledCardContent} {\n padding: 0;\n gap: 0;\n }\n\n ul {\n list-style: none;\n }\n\n ${StyledRadioCheckCard} {\n background-color: transparent;\n border: 0;\n padding: 0 calc(0.5 * ${base.spacing});\n height: ${components.button.height};\n align-items: center;\n border-radius: 0;\n\n > ${StyledLabel} {\n max-width: 100%;\n width: 100%;\n margin: 0;\n }\n }\n\n li {\n padding: 0;\n height: calc(${components.button.height} + 0.125rem);\n\n :not(:last-child) {\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n }\n }\n\n ${StyledSummaryItem} {\n > ${StyledPrimary}, > ${StyledSecondary} {\n align-self: center;\n font-weight: ${base['font-weight'].normal};\n }\n }\n\n ${StyledSummaryItemActions} {\n color: ${base.palette.interactive};\n }\n\n @media (pointer: 'coarse') {\n li {\n height: ${components.button.touch.height};\n }\n }\n `;\n});\n\nStyledContactList.defaultProps = defaultThemeProp;\n\nexport const ContactsContext = createContext<{\n contacts: Contact[];\n onFavoriteToggle: ContactListProps['onFavoriteToggle'];\n}>({\n contacts: [],\n onFavoriteToggle: () => {}\n});\n\nconst SelectableContactItem = ({\n id,\n primary,\n secondary,\n checked,\n container,\n onChange\n}: SummaryItemProps & RadioButtonProps) => {\n return (\n <li key={id}>\n <RadioButton\n variant='card'\n label={\n <SummaryItem id={id} primary={primary} secondary={secondary} container={container} />\n }\n checked={checked}\n onChange={onChange}\n name={`${id}-contact`}\n />\n </li>\n );\n};\n\nconst CallableContactItem = ({\n visual,\n primary,\n secondary,\n onClick,\n container\n}: SummaryItemProps & { onClick: BareRoleButtonProps['onClick'] }) => {\n return (\n <li>\n <BareRoleButton onClick={onClick}>\n <SummaryItem\n visual={visual}\n primary={primary}\n secondary={secondary}\n container={container}\n actions={<Icon name='phone-solid' />}\n />\n </BareRoleButton>\n </li>\n );\n};\n\nconst ContactList = forwardRef(function ContactList(\n { contacts: items, onItemClick, onFavoriteToggle, variant }: PropsWithoutRef<ContactListProps>,\n ref: ContactListProps['ref']\n) {\n const t = useI18n();\n const [searchText, setSearchText] = useState('');\n const containerRef = useConsolidatedRef(ref);\n\n const onSearchChange = useCallback((value: string) => {\n setSearchText(value.trim());\n }, []);\n\n const favoriteButton = useCallback(\n (phoneNumber: string, favorite: boolean) => (\n <Button\n variant='simple'\n icon\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n onFavoriteToggle(phoneNumber, favorite);\n }}\n aria-label={\n favorite\n ? t('call_panel_contacts_add_to_favorites')\n : t('call_panel_contacts_remove_from_favorites')\n }\n >\n <Icon name={favorite ? 'star-solid' : 'star'} emphasized={favorite} />\n </Button>\n ),\n [onFavoriteToggle]\n );\n\n const createList = (list: SelectableContact[]) => {\n return list.map(item => {\n const commonOpts = {\n id: item.phoneNumber,\n primary: item.primary,\n secondary: <Text variant='secondary'>{item.secondary}</Text>,\n container: {\n areas: '\"visual primary secondary actions\"',\n cols: 'auto minmax(0, 2fr) minmax(0, 2fr) auto'\n }\n };\n return variant === 'select'\n ? {\n ...commonOpts,\n as: SelectableContactItem,\n checked: item.selected,\n onChange: () => onItemClick(item.phoneNumber)\n }\n : {\n ...commonOpts,\n as: CallableContactItem,\n visual: favoriteButton(item.phoneNumber, item.favorite),\n onClick: () => onItemClick(item.phoneNumber)\n };\n });\n };\n\n useArrows(containerRef, { selector: ':scope ul [role=\"button\"]' });\n\n return (\n <ViewAll\n as={StyledContactList}\n ref={containerRef}\n items={\n searchText\n ? createList(\n items.filter(({ phoneNumber, primary, secondary }) => {\n return (\n primary.toLowerCase().includes(searchText.toLowerCase()) ||\n secondary.toLowerCase().includes(searchText.toLowerCase()) ||\n phoneNumber.toLowerCase().includes(searchText.toLowerCase())\n );\n })\n )\n : createList(items)\n }\n searchInputProps={{ onSearchChange }}\n />\n );\n});\n\nexport default ContactList;\n"]}
@@ -78,9 +78,7 @@ const DialPadKeyboard = forwardRef(function DialPadKeyboard({ onDialButtonClick,
78
78
  justifyItems: 'center'
79
79
  }, children: buttonGrid.map((row, index) => {
80
80
  if (mode === 'default' || (mode === 'DTMF' && index < 4)) {
81
- return (
82
- // eslint-disable-next-line react/no-array-index-key
83
- _jsx("div", { role: 'row', children: row.map((dialButton) => dialButton.alt === '+' ? (_jsxs(StyledDialButton, { type: 'button', 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}`));
81
+ return (_jsx("div", { role: 'row', children: row.map((dialButton) => dialButton.alt === '+' ? (_jsxs(StyledDialButton, { type: 'button', 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}`));
84
82
  }
85
83
  return undefined;
86
84
  }) }));
@@ -1 +1 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C,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAC9B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACzD,GAAG,EAAE,UAAU,CAAC,GAAG,EACnB,KAAK,EAAE,UAAU,CAAC,OAAO,aAExB,UAAU,CAAC,IAAI,IAAI,yBAAO,UAAU,CAAC,IAAI,GAAQ,EACjD,UAAU,CAAC,GAAG,IAAI,yBAAO,UAAU,CAAC,GAAG,GAAQ,EAC/C,UAAU,CAAC,OAAO,IAAI,KAAC,aAAa,cAAE,UAAU,CAAC,OAAO,GAAiB,EACzE,UAAU,CAAC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAI,KAb9C,UAAU,CAAC,OAAO,CAcN,CACpB,CACF,IAjCkB,OAAO,KAAK,EAAE,CAkC7B,CACP,CAAC;YACJ,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,GACoB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, useRef, useCallback } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref, KeyboardEvent } from 'react';\n\nimport { Icon, registerIcon, useI18n, useLongPress } from '@pega/cosmos-react-core';\nimport type { ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport * as backspaceIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/backspace.icon';\n\nimport { StyledDialButton, StyledDialPadKeyboard, StyledSpecial } from './DialPadKeyboard.styles';\nimport { dtmfGraph, defaultGraph, defaultButtonGrid, dtmfButtonGrid } from './KeyboardNavigation';\nimport type { Index, NavigationGraphElement } from './DialPad.types';\nimport { getDialButtonIndex, isNavigationEvent } from './utils';\n\nregisterIcon(backspaceIcon);\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 function DialPadKeyboard(\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 type='button'\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
+ {"version":3,"file":"DialPadKeyboard.js","sourceRoot":"","sources":["../../../src/components/DialPad/DialPadKeyboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGxD,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,KAAK,aAAa,MAAM,kEAAkE,CAAC;AAElG,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;AAEhE,YAAY,CAAC,aAAa,CAAC,CAAC;AAW5B,MAAM,eAAe,GAA2D,UAAU,CACxF,SAAS,eAAe,CACtB,EAAE,iBAAiB,EAAE,IAAI,GAAG,SAAS,EAAyC,EAC9E,GAAqB;IAErB,MAAM,cAAc,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC;IAClE,MAAM,UAAU,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,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yBAAO,UAAU,CAAC,IAAI,GAAQ,EACjD,UAAU,CAAC,GAAG,IAAI,yBAAO,UAAU,CAAC,GAAG,GAAQ,KAT3C,UAAU,CAAC,OAAO,CAUN,CACpB,CAAC,CAAC,CAAC,CACF,MAAC,gBAAgB,IAEf,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,CAAC,EACpD,SAAS,EAAE,gBAAgB,EAC3B,QAAQ,EAAE,UAAU,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAC9B,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EACzD,GAAG,EAAE,UAAU,CAAC,GAAG,EACnB,KAAK,EAAE,UAAU,CAAC,OAAO,aAExB,UAAU,CAAC,IAAI,IAAI,yBAAO,UAAU,CAAC,IAAI,GAAQ,EACjD,UAAU,CAAC,GAAG,IAAI,yBAAO,UAAU,CAAC,GAAG,GAAQ,EAC/C,UAAU,CAAC,OAAO,IAAI,KAAC,aAAa,cAAE,UAAU,CAAC,OAAO,GAAiB,EACzE,UAAU,CAAC,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,CAAC,IAAI,GAAI,KAb9C,UAAU,CAAC,OAAO,CAcN,CACpB,CACF,IAjCkB,OAAO,KAAK,EAAE,CAkC7B,CACP,CAAC;YACJ,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,GACoB,CACzB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { forwardRef, useRef, useCallback } from 'react';\nimport type { FunctionComponent, PropsWithoutRef, Ref, KeyboardEvent } from 'react';\n\nimport { Icon, registerIcon, useI18n, useLongPress } from '@pega/cosmos-react-core';\nimport type { ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport * as backspaceIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/backspace.icon';\n\nimport { StyledDialButton, StyledDialPadKeyboard, StyledSpecial } from './DialPadKeyboard.styles';\nimport { dtmfGraph, defaultGraph, defaultButtonGrid, dtmfButtonGrid } from './KeyboardNavigation';\nimport type { Index, NavigationGraphElement } from './DialPad.types';\nimport { getDialButtonIndex, isNavigationEvent } from './utils';\n\nregisterIcon(backspaceIcon);\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 function DialPadKeyboard(\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 type='button'\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":"Picker.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/Picker.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,6NAetC,CAAC;AAIF,eAAO,MAAM,gBAAgB,6NAK5B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;2BA0D4gwF,CAAC;iDAzCziwF,CAAC;AAIH,eAAO,MAAM,mBAAmB,iOAW/B,CAAC;AAIF,eAAO,MAAM,WAAW;;;2BAtBH,CAAA;iDA8BnB,CAAC;AAIH,eAAO,MAAM,mBAAmB,6NAS/B,CAAC"}
1
+ {"version":3,"file":"Picker.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Picker/Picker.styles.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B,6NAetC,CAAC;AAIF,eAAO,MAAM,gBAAgB,6NAK5B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;2BA0D42uF,CAAC;iDAzCz4uF,CAAC;AAIH,eAAO,MAAM,mBAAmB,iOAW/B,CAAC;AAIF,eAAO,MAAM,WAAW;;;2BAtBH,CAAA;iDA8BnB,CAAC;AAIH,eAAO,MAAM,mBAAmB,6NAS/B,CAAC"}
@@ -15,23 +15,59 @@ export interface TaskPickerProps extends BaseProps, Pick<PickerProps, 'items'> {
15
15
  export declare const StyledSingleTaskDialog: typeof Dialog;
16
16
  export declare const StyledMultiTaskDialog: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<(Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
17
17
  onDismiss?: () => void;
18
- onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
19
18
  onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
19
+ } & {
20
+ compact?: boolean;
21
+ } & {
22
+ 'aria-label': string;
23
+ heading?: never;
24
+ additionalInfo?: never;
25
+ } & {
26
+ onAfterClose?: () => void;
27
+ onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction | undefined;
28
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo" | "onAfterClose">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
29
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
30
+ }) | (Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
31
+ onDismiss?: () => void;
32
+ onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
33
+ } & {
34
+ compact?: boolean;
35
+ } & {
36
+ 'aria-label': string;
37
+ heading?: never;
38
+ additionalInfo?: never;
39
+ } & {
40
+ onAfterClose: () => void;
41
+ onCancel?: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
42
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo" | "onAfterClose">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
43
+ ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
44
+ }) | (Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
45
+ onDismiss?: () => void;
46
+ onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
47
+ } & {
48
+ compact?: false;
20
49
  } & {
21
50
  heading: string;
22
51
  additionalInfo?: import("@pega/cosmos-react-core").AdditionalInfoProps;
23
52
  'aria-label'?: never;
24
- } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
53
+ } & {
54
+ onAfterClose?: () => void;
55
+ onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction | undefined;
56
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo" | "onAfterClose">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
25
57
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
26
58
  }) | (Omit<Omit<import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps & {
27
59
  onDismiss?: () => void;
28
- onCancel: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
29
60
  onSubmit: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
30
61
  } & {
31
- heading?: never;
32
- 'aria-label': string;
33
- additionalInfo?: never;
34
- } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
62
+ compact?: false;
63
+ } & {
64
+ heading: string;
65
+ additionalInfo?: import("@pega/cosmos-react-core").AdditionalInfoProps;
66
+ 'aria-label'?: never;
67
+ } & {
68
+ onAfterClose: () => void;
69
+ onCancel?: import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").FormAction;
70
+ } & Omit<import("@pega/cosmos-react-core").Attributes<"div">, "compact" | "aria-label" | "onSubmit" | "onCancel" | "heading" | keyof import("@pega/cosmos-react-core/lib/components/Dialog/Dialog.types").BaseDialogProps | "onDismiss" | "additionalInfo" | "onAfterClose">, "ref"> & import("react").RefAttributes<HTMLDivElement>, "ref"> & {
35
71
  ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
36
72
  }), import("styled-components/dist/types").BaseObject>> & string & Omit<import("react").ForwardRefExoticComponent<PropsWithoutRef<FormDialogProps> & import("react").RefAttributes<HTMLDivElement>>, keyof import("react").Component<any, {}, any>>;
37
73
  declare const TaskPicker: ForwardRefForwardPropsComponent<TaskPickerProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"TaskPicker.d.ts","sourceRoot":"","sources":["../../../src/components/TaskManager/TaskPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAkBlD,OAAO,KAAK,EACV,+BAA+B,EAC/B,aAAa,EACb,SAAS,EACT,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,MAAM,MAAM,sDAAsD,CAAC;AAG1E,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,wBAAwB,CAAC;AAG7E,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5E,0CAA0C;IAC1C,KAAK,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,2BAA2B;IAC3B,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAM1C,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;mPAuBhC,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CAiH/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"TaskPicker.d.ts","sourceRoot":"","sources":["../../../src/components/TaskManager/TaskPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAmBlD,OAAO,KAAK,EACV,+BAA+B,EAC/B,aAAa,EACb,SAAS,EACT,eAAe,EAChB,MAAM,yBAAyB,CAAC;AAMjC,OAAO,MAAM,MAAM,sDAAsD,CAAC;AAG1E,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,wBAAwB,CAAC;AAG7E,MAAM,WAAW,eAAgB,SAAQ,SAAS,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC;IAC5E,0CAA0C;IAC1C,KAAK,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC7C,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,2BAA2B;IAC3B,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,EAAE,OAAO,MAM1C,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mPAuBhC,CAAC;AAIH,QAAA,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CAkH/D,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
- import { useI18n, useConsolidatedRef, useElement, useUID, useOuterEvent, Flex, Button, Icon, Text, useFocusTrap, useEvent, FormDialog, defaultThemeProp } from '@pega/cosmos-react-core';
4
+ import { useI18n, useConsolidatedRef, useElement, useUID, useOuterEvent, Flex, Button, Icon, Text, useFocusTrap, useEvent, FormDialog, defaultThemeProp, getResolvedTarget } from '@pega/cosmos-react-core';
5
5
  import { StyledChildrenWrap, StyledDialogContent, StyledDialogHeader } from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.styles';
6
6
  import Dialog from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';
7
7
  import { StyledMenu } from '@pega/cosmos-react-core/lib/components/Menu/Menu.styles';
@@ -43,10 +43,11 @@ const TaskPicker = forwardRef(function TaskPicker({ items, onAdd, onCancel, targ
43
43
  const pickerRef = useConsolidatedRef(ref, setPickerEl);
44
44
  const initialRender = useRef(true);
45
45
  const toggleHandleRef = useRef(null);
46
+ const resolvedTarget = getResolvedTarget(target);
46
47
  const onSelectionChange = (selectedItems) => {
47
48
  setSelections(selectedItems);
48
49
  };
49
- useOuterEvent('mousedown', [target, pickerRef], () => {
50
+ useOuterEvent('mousedown', [resolvedTarget, pickerRef], () => {
50
51
  onCancel?.();
51
52
  });
52
53
  const onModeToggle = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"TaskPicker.js","sourceRoot":"","sources":["../../../src/components/TaskManager/TaskPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,aAAa,EACb,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,gBAAgB,EACjB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,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,aACnE,KAAC,IAAI,IAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAC,IAAI,YAC9B,CAAC,CAAC,uBAAuB,CAAC,GACtB,EACP,KAAC,MAAM,IACL,IAAI,QACJ,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,gBACL,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,YAEzD,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,IACJ,EACN,aAAa,IACT,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n useI18n,\n useConsolidatedRef,\n useElement,\n useUID,\n useOuterEvent,\n Flex,\n Button,\n Icon,\n Text,\n useFocusTrap,\n useEvent,\n FormDialog,\n defaultThemeProp\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n MenuItemProps,\n BaseProps,\n FormDialogProps\n} from '@pega/cosmos-react-core';\nimport {\n StyledChildrenWrap,\n StyledDialogContent,\n StyledDialogHeader\n} from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.styles';\nimport Dialog from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';\nimport { StyledMenu } from '@pega/cosmos-react-core/lib/components/Menu/Menu.styles';\n\nimport type { PickerProps, SwitchHandleValue } from '../Picker/Picker.types';\nimport Picker from '../Picker';\n\nexport interface TaskPickerProps extends BaseProps, Pick<PickerProps, 'items'> {\n /** Callback when add button is clicked */\n onAdd: (selections: MenuItemProps[]) => void;\n /** Callback when cancel button is clicked */\n onCancel: () => void;\n /** Target for the modal */\n target: FormDialogProps['target'];\n /** Picker reference . */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledSingleTaskDialog: typeof Dialog = styled(Dialog)(() => {\n return css`\n ${StyledMenu} {\n overflow: auto;\n }\n `;\n});\n\nexport const StyledMultiTaskDialog = styled(FormDialog)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n ${StyledDialogContent},\n ${StyledChildrenWrap} {\n display: flex;\n }\n\n ${StyledDialogHeader} {\n padding-inline: ${spacing};\n }\n\n ${StyledDialogContent} {\n padding-inline: 0;\n }\n\n ${StyledMenu} {\n overflow: auto;\n }\n `;\n});\n\nStyledMultiTaskDialog.defaultProps = defaultThemeProp;\n\nconst TaskPicker: ForwardRefForwardPropsComponent<TaskPickerProps> = forwardRef(function TaskPicker(\n { items, onAdd, onCancel, target, ...restProps }: PropsWithoutRef<TaskPickerProps>,\n ref: TaskPickerProps['ref']\n) {\n const t = useI18n();\n const headingId = useUID();\n const [selections, setSelections] = useState<MenuItemProps[]>([]);\n const [enableMultiSelect, setEnableMultiSelect] = useState(false);\n const [pickerEl, setPickerEl] = useElement<HTMLDivElement>();\n const pickerRef = useConsolidatedRef(ref, setPickerEl);\n const initialRender = useRef(true);\n const toggleHandleRef = useRef<SwitchHandleValue>(null);\n\n const onSelectionChange = (selectedItems: MenuItemProps[]) => {\n setSelections(selectedItems);\n };\n\n useOuterEvent('mousedown', [target, pickerRef], () => {\n onCancel?.();\n });\n\n const onModeToggle = () => {\n setSelections([]);\n setEnableMultiSelect(curr => !curr);\n };\n\n useEffect(() => {\n if (!enableMultiSelect && selections?.length) {\n onAdd(selections);\n }\n }, [selections, enableMultiSelect]);\n\n useEffect(() => {\n if (initialRender.current) {\n initialRender.current = false;\n } else {\n toggleHandleRef.current?.focusToggleSwitch();\n }\n }, [enableMultiSelect]);\n\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n const { key } = e;\n if (key === 'Escape') {\n onCancel?.();\n }\n },\n [onCancel]\n );\n\n useFocusTrap(pickerRef, false, [onCancel, pickerEl, enableMultiSelect]);\n\n useEvent('keydown', onKeydown, { dependencies: [pickerEl, enableMultiSelect] });\n\n const pickerContent = (\n <Picker\n {...restProps}\n contextualLabel={t('task_manager_cases').toLowerCase()}\n items={items}\n multiSelect={enableMultiSelect}\n onModeToggle={onModeToggle}\n reorderSelections\n selections={selections}\n onSelectionChange={onSelectionChange}\n handle={toggleHandleRef}\n />\n );\n\n return enableMultiSelect ? (\n <StyledMultiTaskDialog\n {...restProps}\n target={target}\n heading={t('add_cases')}\n ref={pickerRef}\n onCancel={() => {\n onCancel();\n }}\n onSubmit={{\n text: t('add'),\n disabled: !selections.length,\n handler: () => {\n onAdd(selections);\n }\n }}\n >\n {pickerContent}\n </StyledMultiTaskDialog>\n ) : (\n <Flex\n {...restProps}\n container={{ direction: 'column', gap: 1 }}\n as={StyledSingleTaskDialog}\n target={target}\n labelledbyId={headingId}\n ref={pickerRef}\n >\n <Flex container={{ justify: 'between', alignItems: 'center', pad: 1 }}>\n <Text id={headingId} variant='h2'>\n {t('task_manager_add_case')}\n </Text>\n <Button\n icon\n variant='simple'\n onClick={onCancel}\n label={t('close')}\n aria-label={t('close_noun', [t('task_manager_add_case')])}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n {pickerContent}\n </Flex>\n );\n});\n\nexport default TaskPicker;\n"]}
1
+ {"version":3,"file":"TaskPicker.js","sourceRoot":"","sources":["../../../src/components/TaskManager/TaskPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,MAAM,EACN,aAAa,EACb,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAC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EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aACnE,KAAC,IAAI,IAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAC,IAAI,YAC9B,CAAC,CAAC,uBAAuB,CAAC,GACtB,EACP,KAAC,MAAM,IACL,IAAI,QACJ,OAAO,EAAC,QAAQ,EAChB,OAAO,EAAE,QAAQ,EACjB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,gBACL,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,YAEzD,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,IACJ,EACN,aAAa,IACT,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n useI18n,\n useConsolidatedRef,\n useElement,\n useUID,\n useOuterEvent,\n Flex,\n Button,\n Icon,\n Text,\n useFocusTrap,\n useEvent,\n FormDialog,\n defaultThemeProp,\n getResolvedTarget\n} from '@pega/cosmos-react-core';\nimport type {\n ForwardRefForwardPropsComponent,\n MenuItemProps,\n BaseProps,\n FormDialogProps\n} from '@pega/cosmos-react-core';\nimport {\n StyledChildrenWrap,\n StyledDialogContent,\n StyledDialogHeader\n} from '@pega/cosmos-react-core/lib/components/Dialog/Dialog.styles';\nimport Dialog from '@pega/cosmos-react-core/lib/components/Dialog/Dialog';\nimport { StyledMenu } from '@pega/cosmos-react-core/lib/components/Menu/Menu.styles';\n\nimport type { PickerProps, SwitchHandleValue } from '../Picker/Picker.types';\nimport Picker from '../Picker';\n\nexport interface TaskPickerProps extends BaseProps, Pick<PickerProps, 'items'> {\n /** Callback when add button is clicked */\n onAdd: (selections: MenuItemProps[]) => void;\n /** Callback when cancel button is clicked */\n onCancel: () => void;\n /** Target for the modal */\n target: FormDialogProps['target'];\n /** Picker reference . */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledSingleTaskDialog: typeof Dialog = styled(Dialog)(() => {\n return css`\n ${StyledMenu} {\n overflow: auto;\n }\n `;\n});\n\nexport const StyledMultiTaskDialog = styled(FormDialog)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n ${StyledDialogContent},\n ${StyledChildrenWrap} {\n display: flex;\n }\n\n ${StyledDialogHeader} {\n padding-inline: ${spacing};\n }\n\n ${StyledDialogContent} {\n padding-inline: 0;\n }\n\n ${StyledMenu} {\n overflow: auto;\n }\n `;\n});\n\nStyledMultiTaskDialog.defaultProps = defaultThemeProp;\n\nconst TaskPicker: ForwardRefForwardPropsComponent<TaskPickerProps> = forwardRef(function TaskPicker(\n { items, onAdd, onCancel, target, ...restProps }: PropsWithoutRef<TaskPickerProps>,\n ref: TaskPickerProps['ref']\n) {\n const t = useI18n();\n const headingId = useUID();\n const [selections, setSelections] = useState<MenuItemProps[]>([]);\n const [enableMultiSelect, setEnableMultiSelect] = useState(false);\n const [pickerEl, setPickerEl] = useElement<HTMLDivElement>();\n const pickerRef = useConsolidatedRef(ref, setPickerEl);\n const initialRender = useRef(true);\n const toggleHandleRef = useRef<SwitchHandleValue>(null);\n const resolvedTarget = getResolvedTarget(target);\n\n const onSelectionChange = (selectedItems: MenuItemProps[]) => {\n setSelections(selectedItems);\n };\n\n useOuterEvent('mousedown', [resolvedTarget, pickerRef], () => {\n onCancel?.();\n });\n\n const onModeToggle = () => {\n setSelections([]);\n setEnableMultiSelect(curr => !curr);\n };\n\n useEffect(() => {\n if (!enableMultiSelect && selections?.length) {\n onAdd(selections);\n }\n }, [selections, enableMultiSelect]);\n\n useEffect(() => {\n if (initialRender.current) {\n initialRender.current = false;\n } else {\n toggleHandleRef.current?.focusToggleSwitch();\n }\n }, [enableMultiSelect]);\n\n const onKeydown = useCallback(\n (e: KeyboardEvent) => {\n const { key } = e;\n if (key === 'Escape') {\n onCancel?.();\n }\n },\n [onCancel]\n );\n\n useFocusTrap(pickerRef, false, [onCancel, pickerEl, enableMultiSelect]);\n\n useEvent('keydown', onKeydown, { dependencies: [pickerEl, enableMultiSelect] });\n\n const pickerContent = (\n <Picker\n {...restProps}\n contextualLabel={t('task_manager_cases').toLowerCase()}\n items={items}\n multiSelect={enableMultiSelect}\n onModeToggle={onModeToggle}\n reorderSelections\n selections={selections}\n onSelectionChange={onSelectionChange}\n handle={toggleHandleRef}\n />\n );\n\n return enableMultiSelect ? (\n <StyledMultiTaskDialog\n {...restProps}\n target={target}\n heading={t('add_cases')}\n ref={pickerRef}\n onCancel={() => {\n onCancel();\n }}\n onSubmit={{\n text: t('add'),\n disabled: !selections.length,\n handler: () => {\n onAdd(selections);\n }\n }}\n >\n {pickerContent}\n </StyledMultiTaskDialog>\n ) : (\n <Flex\n {...restProps}\n container={{ direction: 'column', gap: 1 }}\n as={StyledSingleTaskDialog}\n target={target}\n labelledbyId={headingId}\n ref={pickerRef}\n >\n <Flex container={{ justify: 'between', alignItems: 'center', pad: 1 }}>\n <Text id={headingId} variant='h2'>\n {t('task_manager_add_case')}\n </Text>\n <Button\n icon\n variant='simple'\n onClick={onCancel}\n label={t('close')}\n aria-label={t('close_noun', [t('task_manager_add_case')])}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n {pickerContent}\n </Flex>\n );\n});\n\nexport default TaskPicker;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-cs",
3
- "version": "10.0.0-build.1.9",
3
+ "version": "10.0.0-build.10.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "author": "Pegasystems",
6
6
  "sideEffects": false,
@@ -14,8 +14,8 @@
14
14
  "build": "tsc -b tsconfig.build.json"
15
15
  },
16
16
  "dependencies": {
17
- "@pega/cosmos-react-core": "10.0.0-build.1.9",
18
- "@pega/cosmos-react-dnd": "10.0.0-build.1.9",
17
+ "@pega/cosmos-react-core": "10.0.0-build.10.1",
18
+ "@pega/cosmos-react-dnd": "10.0.0-build.10.1",
19
19
  "@types/react": "^17.0.62 || ^18.3.3",
20
20
  "@types/react-dom": "^17.0.20 || ^18.3.0",
21
21
  "polished": "^4.1.0",
@@ -24,6 +24,6 @@
24
24
  "styled-components": "~6.3.11"
25
25
  },
26
26
  "devDependencies": {
27
- "typescript": "~5.9.3"
27
+ "typescript": "~6.0.3"
28
28
  }
29
29
  }