@pega/cosmos-react-core 10.0.0-build.16.0 → 10.0.0-build.16.2
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/AppShell/AppShellSearch.styles.js +2 -2
- package/lib/components/AppShell/AppShellSearch.styles.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +4 -4
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -1
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.styles.js +1 -1
- package/lib/components/Dialog/Dialog.styles.js.map +1 -1
- package/lib/components/Dialog/FormDialog.js +1 -1
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/FormField/FormField.js +3 -3
- package/lib/components/FormField/FormField.js.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
- package/lib/components/ListToolbar/ListToolbar.js +3 -1
- package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +3 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts +2 -0
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +8 -5
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +6 -6
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/RadioButton/RadioButtonCard.d.ts.map +1 -1
- package/lib/components/RadioButton/RadioButtonCard.js +2 -2
- package/lib/components/RadioButton/RadioButtonCard.js.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
- package/lib/components/SearchInput/SearchInput.styles.js +2 -1
- package/lib/components/SearchInput/SearchInput.styles.js.map +1 -1
- package/lib/components/Tabs/TabPanel.js +1 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/theme/theme.d.ts +6 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +4 -0
- package/lib/theme/themeOverrides.schema.json +3 -0
- package/lib/theme/themes/aurigaDarkTheme.json +2 -1
- package/lib/theme/themes/aurigaTheme.json +2 -1
- package/lib/theme/themes/velaDarkTheme.json +2 -1
- package/lib/theme/themes/velaTheme.json +2 -1
- package/lib/utils/getFocusables.d.ts +5 -1
- package/lib/utils/getFocusables.d.ts.map +1 -1
- package/lib/utils/getFocusables.js +22 -3
- package/lib/utils/getFocusables.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.styles.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,e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from 'styled-components';\n\nimport MenuButton from '../MenuButton';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Button, { StyledButton } from '../Button';\nimport Input from '../Input';\nimport Icon from '../Icon';\n\nexport const StyledSearchButton = styled(Button)(({\n theme: {\n base: {\n spacing,\n 'border-radius': borderRadius,\n shadow: { 'focus-inset': focusShadow }\n },\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n}) => {\n return css`\n border: ${formControl['border-width']} solid ${formControl['border-color']};\n border-inline-start: unset;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n border-start-end-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-end-end-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n padding-inline: ${spacing} calc(1.25 * ${spacing});\n\n &:hover {\n border-color: ${formControl[':hover']['border-color']};\n }\n\n &:focus-visible:enabled {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStyledSearchButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchFiltersButton = styled(MenuButton)(({\n theme: {\n base: {\n 'border-radius': borderRadius,\n shadow: { 'focus-inset': focusShadow }\n },\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n}) => {\n return css`\n border: ${formControl['border-width']} solid ${formControl['border-color']};\n border-inline-end: unset;\n border-start-start-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-end-start-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n\n &:hover {\n border-color: ${formControl[':hover']['border-color']};\n }\n\n &:focus-visible:enabled {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStyledSearchFiltersButton.defaultProps = defaultThemeProp;\n\nexport const StyledClearButton = styled(Button)(({\n theme: {\n base: { 'hit-area': hitArea },\n components: { input }\n }\n}) => {\n return css`\n position: absolute;\n inset-block-start: calc((${input.height} - ${hitArea.compact}) / 2);\n\n && + ${StyledButton} {\n margin-inline-start: 0;\n }\n\n @media (pointer: coarse) {\n inset-block-start: calc((${hitArea['finger-min']} - ${hitArea.compact}) / 2);\n }\n `;\n});\n\nStyledClearButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchIcon = styled(Icon)(({\n theme: {\n base: { 'hit-area': hitArea, palette },\n components: { input }\n }\n}) => {\n const iconColor = tryCatch(() => transparentize(0.3, palette['foreground-color']));\n\n return css`\n position: absolute;\n pointer-events: none;\n color: ${iconColor};\n z-index: 1;\n /* stylelint-disable-next-line unit-allowed-list */\n inset-block-start: calc((${input.height} - max(1.125rem, 14px)) / 2);\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n inset-block-start: calc((${hitArea['finger-min']} - max(1.125rem, 14px)) / 2);\n }\n `;\n});\n\nStyledSearchIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSearchTextInput = styled(Input)(({ theme }) => {\n return css`\n flex: 1;\n background-color: transparent;\n border-radius: inherit;\n height: 100%;\n min-height: 100%;\n\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n display: none;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus-visible:not([disabled]) {\n box-shadow: ${theme.base.shadow['focus-inset']};\n border-color: ${theme.components['form-control']['border-color']};\n\n :hover {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n `;\n});\n\nStyledSearchTextInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchInput = styled.div<{ hasFilters: boolean; showSubmit: boolean }>(\n ({ hasFilters, showSubmit, theme }) => {\n const borderRadius = `calc(${theme.components['search-input']['border-radius']} * ${theme.base['border-radius']})`;\n\n return css`\n position: relative;\n background: ${theme.components['form-control']['background-color']};\n min-height: ${theme.components.input.height};\n height: ${theme.components.input.height};\n border-radius: ${borderRadius};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n --button-padding-inner: ${theme.base.spacing};\n --button-padding-outer: calc(${theme.base.spacing} * 1.25);\n /* stylelint-disable-next-line unit-allowed-list */\n --icon-size: max(1.125rem, 14px);\n --min-button-size: ${theme.base['hit-area']['mouse-min']};\n --search-button-size: max(\n var(--button-padding-inner) + var(--icon-size) + var(--button-padding-outer) +\n ${theme.components.button['border-width']},\n var(--min-button-size)\n );\n\n @media (pointer: coarse) {\n --min-button-size: ${theme.base['hit-area']['finger-min']};\n }\n\n ${showSubmit\n ? css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: 0rem;\n --search-icon-end-size: 0rem;\n --search-button-end-size: var(--search-button-size);\n /* stylelint-enable length-zero-no-unit */\n `\n : css`\n ${hasFilters\n ? css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: 0rem;\n --search-icon-end-size: calc(\n var(--search-button-size) - var(--button-padding-inner)\n );\n --search-button-end-size: 0rem;\n /* stylelint-enable length-zero-no-unit */\n `\n : css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: calc(\n var(--search-button-size) - var(--button-padding-inner)\n );\n --search-icon-end-size: 0rem;\n --search-button-end-size: 0rem;\n /* stylelint-enable length-zero-no-unit */\n `}\n `}\n ${StyledSearchTextInput} {\n ${showSubmit && !hasFilters\n ? css`\n padding-inline-start: max(\n ${theme.components.input.padding},\n calc(${theme.base.spacing} * 1.5)\n );\n `\n : css`\n padding-inline-start: calc(\n ${theme.components.input.padding} + var(--search-icon-start-size)\n );\n `}\n padding-inline-end: calc(\n ${theme.components.input.padding} + var(--clear-button-size-plus-gap) +\n var(--search-icon-end-size)\n );\n --clear-button-size-plus-gap: calc(\n max(${theme.base['hit-area'].compact}, ${theme.base['hit-area']['compact-min']}) +\n ${theme.components.input.padding}\n );\n\n &[value=''] {\n /* stylelint-disable-next-line length-zero-no-unit */\n --clear-button-size-plus-gap: 0rem;\n }\n\n ${showSubmit &&\n css`\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n `}\n\n ${hasFilters &&\n css`\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n `}\n }\n\n ${StyledClearButton} {\n inset-inline-end: calc(\n ${theme.components.input.padding} +\n max(var(--search-icon-end-size), var(--search-button-end-size))\n );\n }\n\n ${StyledSearchIcon} {\n --inset: calc(\n max(var(--button-padding-outer), calc((var(--min-button-size) - var(--icon-size)) / 2)) +\n ${theme.components.button['border-width']}\n );\n\n ${hasFilters\n ? css`\n inset-inline-end: var(--inset);\n `\n : css`\n inset-inline-start: var(--inset);\n `}\n }\n `;\n }\n);\n\nStyledSearchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchMenu = styled.div`\n header {\n border-bottom: none;\n }\n`;\n\nexport const StyledSearchResultsContainer = styled.div`\n padding-top: ${props => props.theme.base.spacing};\n`;\n\nStyledSearchResultsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFiltersPopover = styled.div``;\n\nexport const StyledResultsPopover = styled.div``;\n"]}
|
|
1
|
+
{"version":3,"file":"SearchInput.styles.js","sourceRoot":"","sources":["../../../src/components/SearchInput/SearchInput.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAE3B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAChD,KAAK,EAAE,EACL,IAAI,EAAE,EACJ,OAAO,EACP,eAAe,EAAE,YAAY,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styled-components';\n\nimport MenuButton from '../MenuButton';\nimport { StyledMenuHeader } from '../Menu/Menu.styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport Button, { StyledButton } from '../Button';\nimport Input from '../Input';\nimport Icon from '../Icon';\n\nexport const StyledSearchButton = styled(Button)(({\n theme: {\n base: {\n spacing,\n 'border-radius': borderRadius,\n shadow: { 'focus-inset': focusShadow }\n },\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n}) => {\n return css`\n border: ${formControl['border-width']} solid ${formControl['border-color']};\n border-inline-start: unset;\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n border-start-end-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-end-end-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n padding-inline: ${spacing} calc(1.25 * ${spacing});\n\n &:hover {\n border-color: ${formControl[':hover']['border-color']};\n }\n\n &:focus-visible:enabled {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStyledSearchButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchFiltersButton = styled(MenuButton)(({\n theme: {\n base: {\n 'border-radius': borderRadius,\n shadow: { 'focus-inset': focusShadow }\n },\n components: { 'search-input': searchInput, 'form-control': formControl }\n }\n}) => {\n return css`\n border: ${formControl['border-width']} solid ${formControl['border-color']};\n border-inline-end: unset;\n border-start-start-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-end-start-radius: calc(${borderRadius} * ${searchInput['border-radius']});\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n\n &:hover {\n border-color: ${formControl[':hover']['border-color']};\n }\n\n &:focus-visible:enabled {\n box-shadow: ${focusShadow};\n }\n `;\n});\n\nStyledSearchFiltersButton.defaultProps = defaultThemeProp;\n\nexport const StyledClearButton = styled(Button)(({\n theme: {\n base: { 'hit-area': hitArea },\n components: { input }\n }\n}) => {\n return css`\n position: absolute;\n inset-block-start: calc((${input.height} - ${hitArea.compact}) / 2);\n\n && + ${StyledButton} {\n margin-inline-start: 0;\n }\n\n @media (pointer: coarse) {\n inset-block-start: calc((${hitArea['finger-min']} - ${hitArea.compact}) / 2);\n }\n `;\n});\n\nStyledClearButton.defaultProps = defaultThemeProp;\n\nexport const StyledSearchIcon = styled(Icon)(({\n theme: {\n base: { 'hit-area': hitArea, palette },\n components: { input }\n }\n}) => {\n const iconColor = tryCatch(() => transparentize(0.3, palette['foreground-color']));\n\n return css`\n position: absolute;\n pointer-events: none;\n color: ${iconColor};\n z-index: 1;\n /* stylelint-disable-next-line unit-allowed-list */\n inset-block-start: calc((${input.height} - max(1.125rem, 14px)) / 2);\n\n @media (pointer: coarse) {\n /* stylelint-disable-next-line unit-allowed-list */\n inset-block-start: calc((${hitArea['finger-min']} - max(1.125rem, 14px)) / 2);\n }\n `;\n});\n\nStyledSearchIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSearchTextInput = styled(Input)(({ theme }) => {\n return css`\n flex: 1;\n background-color: transparent;\n border-radius: inherit;\n height: 100%;\n min-height: 100%;\n\n &::-ms-clear {\n display: none;\n }\n\n &::-webkit-search-cancel-button {\n display: none;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus-visible:not([disabled]) {\n box-shadow: ${theme.base.shadow['focus-inset']};\n border-color: ${theme.components['form-control']['border-color']};\n\n :hover {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n `;\n});\n\nStyledSearchTextInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchInput = styled.div<{ hasFilters: boolean; showSubmit: boolean }>(\n ({ hasFilters, showSubmit, theme }) => {\n const borderRadius = `calc(${theme.components['search-input']['border-radius']} * ${theme.base['border-radius']})`;\n\n return css`\n position: relative;\n background: ${theme.components['form-control']['background-color']};\n min-height: ${theme.components.input.height};\n height: ${theme.components.input.height};\n border-radius: ${borderRadius};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n --button-padding-inner: ${theme.base.spacing};\n --button-padding-outer: calc(${theme.base.spacing} * 1.25);\n /* stylelint-disable-next-line unit-allowed-list */\n --icon-size: max(1.125rem, 14px);\n --min-button-size: ${theme.base['hit-area']['mouse-min']};\n --search-button-size: max(\n var(--button-padding-inner) + var(--icon-size) + var(--button-padding-outer) +\n ${theme.components.button['border-width']},\n var(--min-button-size)\n );\n\n @media (pointer: coarse) {\n --min-button-size: ${theme.base['hit-area']['finger-min']};\n }\n\n ${showSubmit\n ? css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: 0rem;\n --search-icon-end-size: 0rem;\n --search-button-end-size: var(--search-button-size);\n /* stylelint-enable length-zero-no-unit */\n `\n : css`\n ${hasFilters\n ? css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: 0rem;\n --search-icon-end-size: calc(\n var(--search-button-size) - var(--button-padding-inner)\n );\n --search-button-end-size: 0rem;\n /* stylelint-enable length-zero-no-unit */\n `\n : css`\n /* stylelint-disable length-zero-no-unit */\n --search-icon-start-size: calc(\n var(--search-button-size) - var(--button-padding-inner)\n );\n --search-icon-end-size: 0rem;\n --search-button-end-size: 0rem;\n /* stylelint-enable length-zero-no-unit */\n `}\n `}\n ${StyledSearchTextInput} {\n ${showSubmit && !hasFilters\n ? css`\n padding-inline-start: max(\n ${theme.components.input.padding},\n calc(${theme.base.spacing} * 1.5)\n );\n `\n : css`\n padding-inline-start: calc(\n ${theme.components.input.padding} + var(--search-icon-start-size)\n );\n `}\n padding-inline-end: calc(\n ${theme.components.input.padding} + var(--clear-button-size-plus-gap) +\n var(--search-icon-end-size)\n );\n --clear-button-size-plus-gap: calc(\n max(${theme.base['hit-area'].compact}, ${theme.base['hit-area']['compact-min']}) +\n ${theme.components.input.padding}\n );\n\n &[value=''] {\n /* stylelint-disable-next-line length-zero-no-unit */\n --clear-button-size-plus-gap: 0rem;\n }\n\n ${showSubmit &&\n css`\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n `}\n\n ${hasFilters &&\n css`\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n `}\n }\n\n ${StyledClearButton} {\n inset-inline-end: calc(\n ${theme.components.input.padding} +\n max(var(--search-icon-end-size), var(--search-button-end-size))\n );\n }\n\n ${StyledSearchIcon} {\n --inset: calc(\n max(var(--button-padding-outer), calc((var(--min-button-size) - var(--icon-size)) / 2)) +\n ${theme.components.button['border-width']}\n );\n\n ${hasFilters\n ? css`\n inset-inline-end: var(--inset);\n `\n : css`\n inset-inline-start: var(--inset);\n `}\n }\n `;\n }\n);\n\nStyledSearchInput.defaultProps = defaultThemeProp;\n\nexport const StyledSearchMenu = styled.div`\n ${StyledMenuHeader} {\n border-bottom: none;\n }\n`;\n\nexport const StyledSearchResultsContainer = styled.div`\n padding-top: ${props => props.theme.base.spacing};\n`;\n\nStyledSearchResultsContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFiltersPopover = styled.div``;\n\nexport const StyledResultsPopover = styled.div``;\n"]}
|
|
@@ -205,7 +205,7 @@ const TabPanel = forwardRef(function TabPanel({ tabId, currentTabId, title, tabl
|
|
|
205
205
|
pad: level > 1 ? [1, 1.5] : [1, undefined, undefined]
|
|
206
206
|
})
|
|
207
207
|
}, item: { grow: 1 }, current: currentTab, inert: currentTab ? undefined : '', role: 'tabpanel', "aria-labelledby": `${tabId}`, id: `${tabId}-panel`, ref: tabPanelRef, tabIndex: 0, tablistType: tablistType, level: level, children: [title && _jsx(Text, { variant: `h${Math.min(2 + level, 6)}`, children: title }), children, tablistRef?.current && showReturnButton && (_jsx(StyledButton, { variant: 'link', onClick: () => {
|
|
208
|
-
getFocusables(tablistRef)
|
|
208
|
+
getFocusables(tablistRef).firstToFocus?.focus();
|
|
209
209
|
}, children: t('return_to_tab_list') }))] }) }));
|
|
210
210
|
});
|
|
211
211
|
TabPanel.defaultProps = defaultProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.ts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;oBAClC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,SAAS,CAAC;iBACtD,CAAC;aACH,EACD,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAClC,IAAI,EAAC,UAAU,qBACE,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,aAEX,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,EAAgB,YAAG,KAAK,GAAQ,EAClF,QAAQ,EACR,UAAU,EAAE,OAAO,IAAI,gBAAgB,IAAI,CAC1C,KAAC,YAAY,IACX,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;oBACxC,CAAC,YAEA,CAAC,CAAC,oBAAoB,CAAC,GACX,CAChB,IACc,GACI,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, useState, useCallback, useMemo, useContext } from 'react';\nimport type { ReactNode, Ref, PropsWithoutRef, RefObject } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useConsolidatedRef, useI18n, useFocusWithin, useEvent } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport type { ForwardRefForwardPropsComponent, HeadingTag } from '../../types';\nimport Button from '../Button';\nimport { getFocusables } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport { StyledCardContent } from '../Card/CardContent';\nimport { StyledCard } from '../Card/Card';\nimport { StyledCardHeader } from '../Card/CardHeader';\n\nimport { StyledTab } from './Tab';\nimport type { TabsProps } from './Tabs.types';\nimport TabsContext from './TabsContext';\nimport {\n StyledAllTabsWrapper,\n StyledAllTabsButton,\n StyledSeparator,\n StyledTabs\n} from './Tabs.styles';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n */\n currentTabId?: string;\n /** The title for the tab panel */\n title?: string;\n /** Content of the tab panel. */\n children: ReactNode;\n /** Ref to the tablist element. */\n tablistRef?: RefObject<HTMLElement>;\n /**\n * The tablist type indicates what direction the tabs are rendered in.\n * @default 'horizontal'\n */\n tablistType?: TabsProps['type'];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst defaultProps: Partial<TabPanelProps> = {\n tabId: ''\n};\n\nexport const StyledTabPanel = styled(Flex)<\n Pick<TabPanelProps, 'tablistType'> & {\n current: boolean;\n level: number;\n }\n>(({ current, tablistType, level, theme }) => {\n return css`\n min-width: 0;\n max-width: 100%;\n\n &:focus-visible {\n outline: none;\n box-shadow: ${tablistType === 'horizontal' && level > 1\n ? theme.base.shadow['focus-inset']\n : theme.base.shadow.focus};\n }\n\n ${!current &&\n css`\n display: none;\n `}\n\n ${tablistType === 'horizontal' &&\n css`\n @media (width < ${theme.base.breakpoints.sm}) {\n border: none;\n padding-block-start: ${theme.base.spacing};\n &:has(${StyledTabs}[aria-orientation='horizontal']) {\n padding-inline: 0;\n padding-block-end: 0;\n\n ${StyledTabs}[aria-orientation='horizontal'], ${StyledAllTabsWrapper}, ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] {\n border-radius: 0;\n }\n\n ${StyledAllTabsWrapper} ${StyledAllTabsButton} {\n border-radius: calc(\n ${theme.base['border-radius']} * ${theme.components.button['border-radius']}\n );\n }\n\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:first-child,\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledSeparator}:first-child + ${StyledTab},\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:first-child,\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledSeparator}:first-child + ${StyledTab} {\n border-start-start-radius: 0;\n\n &:focus-visible::after,\n &:not(:disabled):focus-visible::after {\n border-start-start-radius: calc(0.5rem * 0.5);\n }\n }\n\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:last-child,\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:last-child {\n border-start-end-radius: 0;\n\n &:focus-visible::after,\n &:not(:disabled):focus-visible::after {\n border-start-end-radius: calc(0.5rem * 0.5);\n }\n }\n }\n\n ${theme.components.tabs.detached &&\n css`\n /* Wrapper elements (e.g. from the UI designer) are single-child chains around the tab bar's container. */\n &:not(\n :has(\n > div > ${StyledTabs}[aria-orientation='horizontal'],\n > div > ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'],\n div:only-child > div:only-child > ${StyledTabs}[aria-orientation='horizontal'],\n div:only-child > div:only-child > ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal']\n )\n ) {\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block-end: ${theme.base.spacing};\n\n &&& div:only-child > ${StyledCard}:only-child {\n border: 0;\n padding: 0;\n }\n }\n `}\n }\n `}\n\n ${tablistType === 'horizontal' &&\n level > 1 &&\n css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: none;\n border-end-start-radius: calc(0.5rem * 0.5);\n border-end-end-radius: calc(0.5rem * 0.5);\n `}\n\n ${theme.components.tabs.detached &&\n tablistType === 'horizontal' &&\n css`\n background: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: none;\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-start-radius: 0;\n border-start-end-radius: 0;\n padding: calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n\n &&& ${StyledCardHeader}:not(${StyledCard} ${StyledCard} > ${StyledCardHeader}) {\n padding: 0;\n @media (width < ${theme.base.breakpoints.sm}) {\n padding: 0;\n }\n }\n\n &&& ${StyledCardContent} {\n padding: 0;\n\n ${StyledCard} {\n border: 0;\n padding: 0;\n }\n }\n\n &&& ${StyledCard} {\n padding: calc(2 * ${theme.base.spacing});\n padding-block-start: ${theme.base.spacing};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n background: ${theme.components.card.background};\n }\n\n &&& > ${StyledCard} {\n padding: 0;\n border: 0;\n }\n\n ${StyledAllTabsWrapper} {\n ${StyledTabs} {\n margin-block-end: 0;\n }\n }\n\n ${level > 1 &&\n css`\n :has(&) {\n ${StyledAllTabsWrapper} {\n ${StyledTabs} {\n margin: 0;\n }\n }\n }\n `}\n `}\n `;\n});\n\nStyledTabPanel.defaultProps = defaultThemeProp;\n\nconst StyledButton = styled(Button)(({ theme }) => {\n return css`\n padding-inline: calc(${theme.base.spacing});\n opacity: 0;\n\n &:focus {\n opacity: 1;\n }\n `;\n});\n\nStyledButton.defaultProps = defaultThemeProp;\n\nconst TabPanel: ForwardRefForwardPropsComponent<TabPanelProps> = forwardRef(function TabPanel(\n {\n tabId,\n currentTabId,\n title,\n tablistRef,\n tablistType = 'horizontal',\n children,\n ...restProps\n }: PropsWithoutRef<TabPanelProps>,\n ref: TabPanelProps['ref']\n) {\n const t = useI18n();\n const tabPanelRef = useConsolidatedRef(ref);\n const [showReturnButton, setShowReturnButton] = useState(false);\n const { level } = useContext(TabsContext);\n\n const onFocusChange = useCallback((isFocused: boolean) => {\n if (!isFocused) {\n setShowReturnButton(false);\n }\n }, []);\n\n useFocusWithin([tabPanelRef], onFocusChange);\n\n const contextValue = useMemo(\n () => ({ level: tablistType === 'horizontal' ? level + 1 : 1 }),\n [level, tablistType]\n );\n\n const onKeyUp = () => {\n if (tabPanelRef.current?.contains(document.activeElement)) {\n setShowReturnButton(true);\n }\n };\n useEvent('keyup', onKeyUp);\n\n const currentTab = currentTabId && tabId ? currentTabId === tabId : true;\n\n return (\n <TabsContext.Provider value={contextValue}>\n <StyledTabPanel\n {...restProps}\n container={{\n direction: 'column',\n rowGap: 1,\n ...(tablistType === 'horizontal' && {\n pad: level > 1 ? [1, 1.5] : [1, undefined, undefined]\n })\n }}\n item={{ grow: 1 }}\n current={currentTab}\n inert={currentTab ? undefined : ''}\n role='tabpanel'\n aria-labelledby={`${tabId}`}\n id={`${tabId}-panel`}\n ref={tabPanelRef}\n tabIndex={0}\n tablistType={tablistType}\n level={level}\n >\n {title && <Text variant={`h${Math.min(2 + level, 6)}` as HeadingTag}>{title}</Text>}\n {children}\n {tablistRef?.current && showReturnButton && (\n <StyledButton\n variant='link'\n onClick={() => {\n getFocusables(tablistRef)[0]?.focus();\n }}\n >\n {t('return_to_tab_list')}\n </StyledButton>\n )}\n </StyledTabPanel>\n </TabsContext.Provider>\n );\n});\n\nTabPanel.defaultProps = defaultProps;\n\nexport default TabPanel;\n"]}
|
|
1
|
+
{"version":3,"file":"TabPanel.js","sourceRoot":"","sources":["../../../src/components/Tabs/TabPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,aAAa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CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAClC,IAAI,EAAC,UAAU,qBACE,GAAG,KAAK,EAAE,EAC3B,EAAE,EAAE,GAAG,KAAK,QAAQ,EACpB,GAAG,EAAE,WAAW,EAChB,QAAQ,EAAE,CAAC,EACX,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,aAEX,KAAK,IAAI,KAAC,IAAI,IAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,EAAgB,YAAG,KAAK,GAAQ,EAClF,QAAQ,EACR,UAAU,EAAE,OAAO,IAAI,gBAAgB,IAAI,CAC1C,KAAC,YAAY,IACX,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,GAAG,EAAE;wBACZ,aAAa,CAAC,UAAU,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,CAAC;oBAClD,CAAC,YAEA,CAAC,CAAC,oBAAoB,CAAC,GACX,CAChB,IACc,GACI,CACxB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,YAAY,GAAG,YAAY,CAAC;AAErC,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, useState, useCallback, useMemo, useContext } from 'react';\nimport type { ReactNode, Ref, PropsWithoutRef, RefObject } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useConsolidatedRef, useI18n, useFocusWithin, useEvent } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport type { ForwardRefForwardPropsComponent, HeadingTag } from '../../types';\nimport Button from '../Button';\nimport { getFocusables } from '../../utils';\nimport Flex from '../Flex';\nimport Text from '../Text';\nimport { StyledCardContent } from '../Card/CardContent';\nimport { StyledCard } from '../Card/Card';\nimport { StyledCardHeader } from '../Card/CardHeader';\n\nimport { StyledTab } from './Tab';\nimport type { TabsProps } from './Tabs.types';\nimport TabsContext from './TabsContext';\nimport {\n StyledAllTabsWrapper,\n StyledAllTabsButton,\n StyledSeparator,\n StyledTabs\n} from './Tabs.styles';\n\ninterface TabPanelProps {\n /** The id of the Tab that the tab panel is related to. */\n tabId: string;\n /**\n * The current selected value of the tabs. Controls the visibility of the tab panel.\n * The tabsValue must match the tabId in order for the TabPanel to show itself.\n */\n currentTabId?: string;\n /** The title for the tab panel */\n title?: string;\n /** Content of the tab panel. */\n children: ReactNode;\n /** Ref to the tablist element. */\n tablistRef?: RefObject<HTMLElement>;\n /**\n * The tablist type indicates what direction the tabs are rendered in.\n * @default 'horizontal'\n */\n tablistType?: TabsProps['type'];\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst defaultProps: Partial<TabPanelProps> = {\n tabId: ''\n};\n\nexport const StyledTabPanel = styled(Flex)<\n Pick<TabPanelProps, 'tablistType'> & {\n current: boolean;\n level: number;\n }\n>(({ current, tablistType, level, theme }) => {\n return css`\n min-width: 0;\n max-width: 100%;\n\n &:focus-visible {\n outline: none;\n box-shadow: ${tablistType === 'horizontal' && level > 1\n ? theme.base.shadow['focus-inset']\n : theme.base.shadow.focus};\n }\n\n ${!current &&\n css`\n display: none;\n `}\n\n ${tablistType === 'horizontal' &&\n css`\n @media (width < ${theme.base.breakpoints.sm}) {\n border: none;\n padding-block-start: ${theme.base.spacing};\n &:has(${StyledTabs}[aria-orientation='horizontal']) {\n padding-inline: 0;\n padding-block-end: 0;\n\n ${StyledTabs}[aria-orientation='horizontal'], ${StyledAllTabsWrapper}, ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] {\n border-radius: 0;\n }\n\n ${StyledAllTabsWrapper} ${StyledAllTabsButton} {\n border-radius: calc(\n ${theme.base['border-radius']} * ${theme.components.button['border-radius']}\n );\n }\n\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:first-child,\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledSeparator}:first-child + ${StyledTab},\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:first-child,\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledSeparator}:first-child + ${StyledTab} {\n border-start-start-radius: 0;\n\n &:focus-visible::after,\n &:not(:disabled):focus-visible::after {\n border-start-start-radius: calc(0.5rem * 0.5);\n }\n }\n\n ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:last-child,\n ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'] > ${StyledTab}:last-child {\n border-start-end-radius: 0;\n\n &:focus-visible::after,\n &:not(:disabled):focus-visible::after {\n border-start-end-radius: calc(0.5rem * 0.5);\n }\n }\n }\n\n ${theme.components.tabs.detached &&\n css`\n /* Wrapper elements (e.g. from the UI designer) are single-child chains around the tab bar's container. */\n &:not(\n :has(\n > div > ${StyledTabs}[aria-orientation='horizontal'],\n > div > ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal'],\n div:only-child > div:only-child > ${StyledTabs}[aria-orientation='horizontal'],\n div:only-child > div:only-child > ${StyledAllTabsWrapper} ${StyledTabs}[aria-orientation='horizontal']\n )\n ) {\n padding-inline: calc(2 * ${theme.base.spacing});\n padding-block-end: ${theme.base.spacing};\n\n &&& div:only-child > ${StyledCard}:only-child {\n border: 0;\n padding: 0;\n }\n }\n `}\n }\n `}\n\n ${tablistType === 'horizontal' &&\n level > 1 &&\n css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: none;\n border-end-start-radius: calc(0.5rem * 0.5);\n border-end-end-radius: calc(0.5rem * 0.5);\n `}\n\n ${theme.components.tabs.detached &&\n tablistType === 'horizontal' &&\n css`\n background: ${theme.base.palette['primary-background']};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-block-start: none;\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n border-start-start-radius: 0;\n border-start-end-radius: 0;\n padding: calc(2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n\n &&& ${StyledCardHeader}:not(${StyledCard} ${StyledCard} > ${StyledCardHeader}) {\n padding: 0;\n @media (width < ${theme.base.breakpoints.sm}) {\n padding: 0;\n }\n }\n\n &&& ${StyledCardContent} {\n padding: 0;\n\n ${StyledCard} {\n border: 0;\n padding: 0;\n }\n }\n\n &&& ${StyledCard} {\n padding: calc(2 * ${theme.base.spacing});\n padding-block-start: ${theme.base.spacing};\n border: 0.0625rem solid ${theme.base.palette['border-line']};\n border-radius: var(--border-radius, ${theme.base['border-radius']});\n background: ${theme.components.card.background};\n }\n\n &&& > ${StyledCard} {\n padding: 0;\n border: 0;\n }\n\n ${StyledAllTabsWrapper} {\n ${StyledTabs} {\n margin-block-end: 0;\n }\n }\n\n ${level > 1 &&\n css`\n :has(&) {\n ${StyledAllTabsWrapper} {\n ${StyledTabs} {\n margin: 0;\n }\n }\n }\n `}\n `}\n `;\n});\n\nStyledTabPanel.defaultProps = defaultThemeProp;\n\nconst StyledButton = styled(Button)(({ theme }) => {\n return css`\n padding-inline: calc(${theme.base.spacing});\n opacity: 0;\n\n &:focus {\n opacity: 1;\n }\n `;\n});\n\nStyledButton.defaultProps = defaultThemeProp;\n\nconst TabPanel: ForwardRefForwardPropsComponent<TabPanelProps> = forwardRef(function TabPanel(\n {\n tabId,\n currentTabId,\n title,\n tablistRef,\n tablistType = 'horizontal',\n children,\n ...restProps\n }: PropsWithoutRef<TabPanelProps>,\n ref: TabPanelProps['ref']\n) {\n const t = useI18n();\n const tabPanelRef = useConsolidatedRef(ref);\n const [showReturnButton, setShowReturnButton] = useState(false);\n const { level } = useContext(TabsContext);\n\n const onFocusChange = useCallback((isFocused: boolean) => {\n if (!isFocused) {\n setShowReturnButton(false);\n }\n }, []);\n\n useFocusWithin([tabPanelRef], onFocusChange);\n\n const contextValue = useMemo(\n () => ({ level: tablistType === 'horizontal' ? level + 1 : 1 }),\n [level, tablistType]\n );\n\n const onKeyUp = () => {\n if (tabPanelRef.current?.contains(document.activeElement)) {\n setShowReturnButton(true);\n }\n };\n useEvent('keyup', onKeyUp);\n\n const currentTab = currentTabId && tabId ? currentTabId === tabId : true;\n\n return (\n <TabsContext.Provider value={contextValue}>\n <StyledTabPanel\n {...restProps}\n container={{\n direction: 'column',\n rowGap: 1,\n ...(tablistType === 'horizontal' && {\n pad: level > 1 ? [1, 1.5] : [1, undefined, undefined]\n })\n }}\n item={{ grow: 1 }}\n current={currentTab}\n inert={currentTab ? undefined : ''}\n role='tabpanel'\n aria-labelledby={`${tabId}`}\n id={`${tabId}-panel`}\n ref={tabPanelRef}\n tabIndex={0}\n tablistType={tablistType}\n level={level}\n >\n {title && <Text variant={`h${Math.min(2 + level, 6)}` as HeadingTag}>{title}</Text>}\n {children}\n {tablistRef?.current && showReturnButton && (\n <StyledButton\n variant='link'\n onClick={() => {\n getFocusables(tablistRef).firstToFocus?.focus();\n }}\n >\n {t('return_to_tab_list')}\n </StyledButton>\n )}\n </StyledTabPanel>\n </TabsContext.Provider>\n );\n});\n\nTabPanel.defaultProps = defaultProps;\n\nexport default TabPanel;\n"]}
|
package/lib/theme/theme.d.ts
CHANGED
|
@@ -668,6 +668,10 @@ export declare const BaseThemeMachine: ThemeMachine<{
|
|
|
668
668
|
$type: string;
|
|
669
669
|
$value: string;
|
|
670
670
|
};
|
|
671
|
+
divider: {
|
|
672
|
+
$type: string;
|
|
673
|
+
$value: boolean;
|
|
674
|
+
};
|
|
671
675
|
"search-input": {
|
|
672
676
|
"background-color": {
|
|
673
677
|
$type: string;
|
|
@@ -2366,6 +2370,7 @@ export declare const WorkTheme: {
|
|
|
2366
2370
|
readonly "foreground-color": string;
|
|
2367
2371
|
readonly "background-color": string;
|
|
2368
2372
|
readonly "border-color": string;
|
|
2373
|
+
readonly divider: boolean;
|
|
2369
2374
|
readonly "search-input": {
|
|
2370
2375
|
readonly "background-color": string;
|
|
2371
2376
|
readonly "foreground-color": string;
|
|
@@ -3165,6 +3170,7 @@ export declare const defaultThemeProp: Readonly<{
|
|
|
3165
3170
|
readonly "foreground-color": string;
|
|
3166
3171
|
readonly "background-color": string;
|
|
3167
3172
|
readonly "border-color": string;
|
|
3173
|
+
readonly divider: boolean;
|
|
3168
3174
|
readonly "search-input": {
|
|
3169
3175
|
readonly "background-color": string;
|
|
3170
3176
|
readonly "foreground-color": string;
|
package/lib/theme/theme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,YAAgC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,sBAAsB,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC;AAEnE,OAAO,EAAE,sBAAsB,IAAI,eAAe,EAAE,CAAC;AAErD,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,YAAgC,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,sBAAsB,MAAM,wBAAwB,CAAC;AAE5D,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC;AAEnE,OAAO,EAAE,sBAAsB,IAAI,eAAe,EAAE,CAAC;AAErD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAsC,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAGhF,OAAO,QAAQ,mBAAmB,CAAC;IACjC,UAAiB,YAAa,SAAQ,YAAY,CAAC,OAAO,sBAAsB,CAAC;KAAG;CACrF"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { RefObject } from 'react';
|
|
2
2
|
export declare const focusableSelector = "a[href], button, input, textarea, select, details, video[controls], audio[controls], [tabindex]";
|
|
3
|
+
export interface FocusableElements extends Array<HTMLElement> {
|
|
4
|
+
/** The first focusable element in DOM order, skipping unchecked radios in a group when a checked radio is available. */
|
|
5
|
+
readonly firstToFocus: HTMLElement | undefined;
|
|
6
|
+
}
|
|
3
7
|
/**
|
|
4
8
|
* Returns all valid focusable elements within a given ref.
|
|
5
9
|
* @param container The container element, or reference to the container element, to search for focusable elements within.
|
|
@@ -11,6 +15,6 @@ export declare const focusableSelector = "a[href], button, input, textarea, sele
|
|
|
11
15
|
declare const getFocusables: (container: RefObject<ParentNode> | ParentNode, { includeActiveEl, includeNegativeTabIndex }?: {
|
|
12
16
|
includeActiveEl?: boolean;
|
|
13
17
|
includeNegativeTabIndex?: boolean;
|
|
14
|
-
}) =>
|
|
18
|
+
}) => FocusableElements;
|
|
15
19
|
export default getFocusables;
|
|
16
20
|
//# sourceMappingURL=getFocusables.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFocusables.d.ts","sourceRoot":"","sources":["../../src/utils/getFocusables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,eAAO,MAAM,iBAAiB,oGACqE,CAAC;
|
|
1
|
+
{"version":3,"file":"getFocusables.d.ts","sourceRoot":"","sources":["../../src/utils/getFocusables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,eAAO,MAAM,iBAAiB,oGACqE,CAAC;AAQpG,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,WAAW,CAAC;IAC3D,wHAAwH;IACxH,QAAQ,CAAC,YAAY,EAAE,WAAW,GAAG,SAAS,CAAC;CAChD;AA2BD;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,GACjB,WAAW,SAAS,CAAC,UAAU,CAAC,GAAG,UAAU,EAC7C,+CAGG;IACD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAC;CAC9B,KACL,iBA6CF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -4,6 +4,25 @@ import createUID from './createUID';
|
|
|
4
4
|
import isInstance from './isInstance';
|
|
5
5
|
export const focusableSelector = 'a[href], button, input, textarea, select, details, video[controls], audio[controls], [tabindex]';
|
|
6
6
|
const isNamedRadio = (el) => isInstance(el, HTMLInputElement) && el.type === 'radio' && !!el.name;
|
|
7
|
+
const checkedRadioInGroupSelector = ':is(fieldset, [role="radiogroup"], fieldset:scope, [role="radiogroup"]:scope):not(:has(:is(fieldset, [role="radiogroup"]))) input[type="radio"]:checked';
|
|
8
|
+
const withFirst = (elements, containerEl) => {
|
|
9
|
+
const focusableElements = elements;
|
|
10
|
+
Object.defineProperty(focusableElements, 'firstToFocus', {
|
|
11
|
+
get() {
|
|
12
|
+
const checkedRadio = [
|
|
13
|
+
...(containerEl?.querySelectorAll(checkedRadioInGroupSelector) ?? [])
|
|
14
|
+
].find(isNamedRadio);
|
|
15
|
+
if (!checkedRadio || !focusableElements.includes(checkedRadio)) {
|
|
16
|
+
return focusableElements[0];
|
|
17
|
+
}
|
|
18
|
+
// Skip only the group's unchecked radios; other focusables (e.g. buttons) keep their DOM order.
|
|
19
|
+
const group = checkedRadio.closest('fieldset, [role="radiogroup"]');
|
|
20
|
+
const first = focusableElements.find(el => el === checkedRadio || !(group?.contains(el) && el.matches('input[type="radio"]')));
|
|
21
|
+
return first ?? focusableElements[0];
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return focusableElements;
|
|
25
|
+
};
|
|
7
26
|
/**
|
|
8
27
|
* Returns all valid focusable elements within a given ref.
|
|
9
28
|
* @param container The container element, or reference to the container element, to search for focusable elements within.
|
|
@@ -18,7 +37,7 @@ const getFocusables = (container, { includeActiveEl = false, includeNegativeTabI
|
|
|
18
37
|
let activeEl = null;
|
|
19
38
|
const containerEl = hasProp(container, 'current') ? container.current : container;
|
|
20
39
|
if (!containerEl)
|
|
21
|
-
return [];
|
|
40
|
+
return withFirst([], containerEl);
|
|
22
41
|
let selector = focusableSelector;
|
|
23
42
|
if (includeActiveEl) {
|
|
24
43
|
activeEl = getActiveElement();
|
|
@@ -38,14 +57,14 @@ const getFocusables = (container, { includeActiveEl = false, includeNegativeTabI
|
|
|
38
57
|
activeEl.removeAttribute('id');
|
|
39
58
|
}
|
|
40
59
|
const radios = focusableElements.filter(isNamedRadio);
|
|
41
|
-
return focusableElements.filter(el => {
|
|
60
|
+
return withFirst(focusableElements.filter(el => {
|
|
42
61
|
if (el === activeEl)
|
|
43
62
|
return true;
|
|
44
63
|
if (!isNamedRadio(el))
|
|
45
64
|
return true;
|
|
46
65
|
const group = radios.filter(radio => radio.name === el.name && radio.form === el.form);
|
|
47
66
|
return el === (group.find(radio => radio.checked) ?? group[0]);
|
|
48
|
-
});
|
|
67
|
+
}), containerEl);
|
|
49
68
|
};
|
|
50
69
|
export default getFocusables;
|
|
51
70
|
//# sourceMappingURL=getFocusables.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFocusables.js","sourceRoot":"","sources":["../../src/utils/getFocusables.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM,iBAAiB,GAC5B,iGAAiG,CAAC;AAEpG,MAAM,YAAY,GAAG,CAAC,EAAe,EAA0B,EAAE,CAC/D,UAAU,CAAC,EAAE,EAAE,gBAAgB,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC;AAEvE;;;;;;;GAOG;AACH,MAAM,aAAa,GAAG,CACpB,SAA6C,EAC7C,EACE,eAAe,GAAG,KAAK,EACvB,uBAAuB,GAAG,KAAK,KAI7B,EAAE,
|
|
1
|
+
{"version":3,"file":"getFocusables.js","sourceRoot":"","sources":["../../src/utils/getFocusables.ts"],"names":[],"mappings":"AAEA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,MAAM,CAAC,MAAM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Q,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEtD,OAAO,SAAS,CACd,iBAAiB,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;QAC5B,IAAI,EAAE,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QACjC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC;QACvF,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC,EACF,WAAW,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import type { RefObject } from 'react';\n\nimport hasProp from './hasProp';\nimport getActiveElement from './getActiveElement';\nimport createUID from './createUID';\nimport isInstance from './isInstance';\n\nexport const focusableSelector =\n 'a[href], button, input, textarea, select, details, video[controls], audio[controls], [tabindex]';\n\nconst isNamedRadio = (el: HTMLElement): el is HTMLInputElement =>\n isInstance(el, HTMLInputElement) && el.type === 'radio' && !!el.name;\n\nconst checkedRadioInGroupSelector =\n ':is(fieldset, [role=\"radiogroup\"], fieldset:scope, [role=\"radiogroup\"]:scope):not(:has(:is(fieldset, [role=\"radiogroup\"]))) input[type=\"radio\"]:checked';\n\nexport interface FocusableElements extends Array<HTMLElement> {\n /** The first focusable element in DOM order, skipping unchecked radios in a group when a checked radio is available. */\n readonly firstToFocus: HTMLElement | undefined;\n}\n\nconst withFirst = (elements: HTMLElement[], containerEl: ParentNode | null): FocusableElements => {\n const focusableElements = elements;\n\n Object.defineProperty(focusableElements, 'firstToFocus', {\n get(): HTMLElement | undefined {\n const checkedRadio = [\n ...(containerEl?.querySelectorAll<HTMLElement>(checkedRadioInGroupSelector) ?? [])\n ].find(isNamedRadio);\n if (!checkedRadio || !focusableElements.includes(checkedRadio)) {\n return focusableElements[0];\n }\n\n // Skip only the group's unchecked radios; other focusables (e.g. buttons) keep their DOM order.\n const group = checkedRadio.closest('fieldset, [role=\"radiogroup\"]');\n const first = focusableElements.find(\n el => el === checkedRadio || !(group?.contains(el) && el.matches('input[type=\"radio\"]'))\n );\n\n return first ?? focusableElements[0];\n }\n });\n\n return focusableElements as FocusableElements;\n};\n\n/**\n * Returns all valid focusable elements within a given ref.\n * @param container The container element, or reference to the container element, to search for focusable elements within.\n * @param options\n * @param options.includeActiveEl If true, the active element will be included in the list, even if it does not match focusable criteria.\n * @param options.includeNegativeTabIndex If true, elements with negative tabindex will be included in the list.\n * @returns A list of valid focusable elements within the given ref.\n */\nconst getFocusables = (\n container: RefObject<ParentNode> | ParentNode,\n {\n includeActiveEl = false,\n includeNegativeTabIndex = false\n }: {\n includeActiveEl?: boolean;\n includeNegativeTabIndex?: boolean;\n } = {}\n): FocusableElements => {\n const uid = createUID();\n let activeId = uid;\n let activeEl: ReturnType<typeof getActiveElement> = null;\n\n const containerEl = hasProp(container, 'current') ? container.current : container;\n if (!containerEl) return withFirst([], containerEl);\n\n let selector = focusableSelector;\n\n if (includeActiveEl) {\n activeEl = getActiveElement();\n if (activeEl) {\n activeId = activeEl.id || uid;\n activeEl.id = activeId;\n selector = `${selector}, [id=\"${activeId}\"]`;\n }\n }\n\n const focusableElements = ([...containerEl.querySelectorAll(selector)] as HTMLElement[]).filter(\n el => {\n const passesTabIndex = includeNegativeTabIndex || el.getAttribute('tabindex') !== '-1';\n return (\n isInstance(el, Element) &&\n (el.id === activeId ||\n (!el.hasAttribute('disabled') && !el.closest('[inert]') && passesTabIndex))\n );\n }\n );\n\n if (activeEl?.id === uid) {\n activeEl.removeAttribute('id');\n }\n\n const radios = focusableElements.filter(isNamedRadio);\n\n return withFirst(\n focusableElements.filter(el => {\n if (el === activeEl) return true;\n if (!isNamedRadio(el)) return true;\n const group = radios.filter(radio => radio.name === el.name && radio.form === el.form);\n return el === (group.find(radio => radio.checked) ?? group[0]);\n }),\n containerEl\n );\n};\n\nexport default getFocusables;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-core",
|
|
3
|
-
"version": "10.0.0-build.16.
|
|
3
|
+
"version": "10.0.0-build.16.2",
|
|
4
4
|
"description": "Cosmos is a visual design system and UI component collection. Its goal is to empower application developers in their pursuit to create engaging and rewarding user experiences.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Pegasystems",
|