@porsche-design-system/components-react 3.22.1 → 3.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -2
- package/package.json +2 -2
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +21 -7
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.cjs +2 -6
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.cjs +7 -2
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +21 -7
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs +2 -6
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.mjs +7 -2
- package/ssr/esm/lib/dsr-components/select.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -14,14 +14,29 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
|
|
|
14
14
|
|
|
15
15
|
### [Unreleased]
|
|
16
16
|
|
|
17
|
+
### [3.23.0] - 2024-12-12
|
|
18
|
+
|
|
19
|
+
### [3.23.0-rc.0] - 2024-12-12
|
|
20
|
+
|
|
21
|
+
#### Changed
|
|
22
|
+
|
|
23
|
+
- `Select`: Slotted image of selected option now visible in combobox
|
|
24
|
+
([#3651](https://github.com/porsche-design-system/porsche-design-system/pull/3651))
|
|
25
|
+
|
|
26
|
+
#### Fixed
|
|
27
|
+
|
|
28
|
+
- `Flyout`: transition bug in Safari ([3674](https://github.com/porsche-design-system/porsche-design-system/pull/3674))
|
|
29
|
+
- `Styles`: dart sass deprecation warnings in `SCSS` variant
|
|
30
|
+
([3664](https://github.com/porsche-design-system/porsche-design-system/pull/3664))
|
|
31
|
+
|
|
17
32
|
### [3.22.1] - 2024-12-09
|
|
18
33
|
|
|
19
34
|
### [3.22.1-rc.0] - 2024-12-09
|
|
20
35
|
|
|
21
36
|
#### Fixed
|
|
22
37
|
|
|
23
|
-
`Flyout Multilevel`: Secondary scroll area not shown in iOS Safari (iPhone only)
|
|
24
|
-
([3663](https://github.com/porsche-design-system/porsche-design-system/pull/3663))
|
|
38
|
+
- `Flyout Multilevel`: Secondary scroll area not shown in iOS Safari (iPhone only)
|
|
39
|
+
([3663](https://github.com/porsche-design-system/porsche-design-system/pull/3663))
|
|
25
40
|
|
|
26
41
|
### [3.22.0] - 2024-12-06
|
|
27
42
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porsche-design-system/components-react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"description": "Porsche Design System is a component library designed to help developers create the best experience for software or services distributed by Dr. Ing. h.c. F. Porsche AG.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"porsche",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "SEE LICENSE IN LICENSE",
|
|
18
18
|
"homepage": "https://designsystem.porsche.com",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@porsche-design-system/components-js": "3.
|
|
20
|
+
"@porsche-design-system/components-js": "3.23.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"ag-grid-community": ">= 32.0.0 <33.0.0",
|
|
@@ -8519,7 +8519,6 @@ const getOptionStyles = (theme) => {
|
|
|
8519
8519
|
gap: '12px',
|
|
8520
8520
|
padding: `${spacingStaticSmall} 12px`,
|
|
8521
8521
|
paddingInlineStart: `var(${cssVariableSelectPaddingInlineStart}, 12px)`,
|
|
8522
|
-
flex: `1 0 calc(${fontLineHeight} + ${spacingStaticSmall} * 2)`,
|
|
8523
8522
|
minHeight: `calc(${fontLineHeight} + ${spacingStaticSmall} * 2)`, // TODO: Added this line to preserve height for empty option
|
|
8524
8523
|
color: contrastHighColor,
|
|
8525
8524
|
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
@@ -9747,7 +9746,7 @@ const cssVarBorderColor = '--p-select-border-color';
|
|
|
9747
9746
|
const cssVarIconFilter = '--p-select-icon-filter';
|
|
9748
9747
|
const cssVarBackgroundColorFocus = '--p-select-focus-background-color';
|
|
9749
9748
|
const cssVarBorderColorFocus = '--p-select-focus-border-color';
|
|
9750
|
-
const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNativePopoverCase, theme) => {
|
|
9749
|
+
const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNativePopoverCase, theme, hasSlottedImage) => {
|
|
9751
9750
|
return getCss({
|
|
9752
9751
|
'@global': {
|
|
9753
9752
|
':host': {
|
|
@@ -9759,7 +9758,7 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNa
|
|
|
9759
9758
|
},
|
|
9760
9759
|
...preventFoucOfNestedElementsStyles,
|
|
9761
9760
|
// TODO: re-use select-wrapper-style
|
|
9762
|
-
button: getButtonStyles(isDisabled, direction, isOpen, state, theme),
|
|
9761
|
+
button: getButtonStyles(isDisabled, direction, isOpen, state, theme, hasSlottedImage),
|
|
9763
9762
|
},
|
|
9764
9763
|
root: {
|
|
9765
9764
|
display: 'grid',
|
|
@@ -9801,7 +9800,7 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNa
|
|
|
9801
9800
|
};
|
|
9802
9801
|
// TODO: Rename to JSSStyles
|
|
9803
9802
|
// TODO: use getSlottedTextFieldTextareaSelectStyles() instead an manipulate selectors like done with PIN Code or even better make it configurable as parameter
|
|
9804
|
-
const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
9803
|
+
const getButtonStyles = (isDisabled, direction, isOpen, state, theme, hasSlottedImage) => {
|
|
9805
9804
|
const { primaryColor, disabledColor, backgroundColor, contrastMediumColor } = getThemedColors(theme);
|
|
9806
9805
|
const { primaryColor: primaryColorDark, disabledColor: disabledColorDark, backgroundColor: backgroundColorDark, contrastMediumColor: contrastMediumColorDark, } = getThemedColors('dark');
|
|
9807
9806
|
const { formStateColor, formStateHoverColor } = getThemedFormStateColors(theme, state);
|
|
@@ -9811,7 +9810,6 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
|
9811
9810
|
overflowX: 'hidden', // TODO: Newly added (rest is copied from select-wrapper-dropdown), share rest for both components
|
|
9812
9811
|
whiteSpace: 'nowrap', // TODO: Newly added (rest is copied from select-wrapper-dropdown), share rest for both components
|
|
9813
9812
|
gridArea: '1/1/1/-1',
|
|
9814
|
-
flex: 1,
|
|
9815
9813
|
minWidth: 0,
|
|
9816
9814
|
// TODO: abstract and re-use for multi-select, select-wrapper and text-field-wrapper
|
|
9817
9815
|
height: `calc(${fontLineHeight} + 10px + ${borderWidthBase} * 2 + ${spacingStaticSmall} * 2)`, // we need 10px additionally so input height becomes 54px, // we need 6px additionally so input height becomes 50px
|
|
@@ -9841,9 +9839,25 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
|
9841
9839
|
}),
|
|
9842
9840
|
...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({
|
|
9843
9841
|
color: `var(${cssVarTextColor}, ${primaryColorDark})`,
|
|
9844
|
-
opacity: 1,
|
|
9842
|
+
opacity: 1, // Opacity fixes placeholder being shown lighter in firefox
|
|
9845
9843
|
})),
|
|
9846
|
-
},
|
|
9844
|
+
},
|
|
9845
|
+
...(hasSlottedImage && {
|
|
9846
|
+
'& > span': {
|
|
9847
|
+
display: 'flex',
|
|
9848
|
+
gap: '12px',
|
|
9849
|
+
alignItems: 'center',
|
|
9850
|
+
},
|
|
9851
|
+
'& > span > span': {
|
|
9852
|
+
textOverflow: 'ellipsis',
|
|
9853
|
+
overflow: 'hidden',
|
|
9854
|
+
},
|
|
9855
|
+
'& img': {
|
|
9856
|
+
height: fontLineHeight,
|
|
9857
|
+
borderRadius: borderRadiusSmall,
|
|
9858
|
+
width: 'auto',
|
|
9859
|
+
},
|
|
9860
|
+
}),
|
|
9847
9861
|
...hoverMediaQuery({
|
|
9848
9862
|
'&:hover:not(:disabled):not(:focus-visible),label:hover~.wrapper &:not(:disabled):not(:focus-visible)': {
|
|
9849
9863
|
borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateHoverColor || primaryColor})`,
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.cjs
CHANGED
|
@@ -37,13 +37,9 @@ class DSRFlyout extends react.Component {
|
|
|
37
37
|
const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
|
|
38
38
|
const hasSubFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sub-footer').length > 0;
|
|
39
39
|
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getFlyoutCss(this.props.open, (positionDeprecationMap[this.props.position] || this.props.position), hasHeader, hasFooter, hasSubFooter, this.props.footerBehavior, this.props.theme)));
|
|
40
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx("dialog", {
|
|
41
|
-
// "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
|
|
42
|
-
// eslint-disable-next-line
|
|
43
|
-
/* @ts-ignore */
|
|
44
|
-
inert: this.props.open ? null : '', tabIndex: -1, ...utilsEntry.parseAndGetAriaAttributes({
|
|
40
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsx("dialog", { tabIndex: -1, ...utilsEntry.parseAndGetAriaAttributes({
|
|
45
41
|
'aria-modal': true,
|
|
46
|
-
...
|
|
42
|
+
...{ 'aria-label': hasHeader ? namedSlotChildren.find(({ props: { slot } }) => slot === 'header')?.props.children : 'Flyout' },
|
|
47
43
|
...utilsEntry.parseAndGetAriaAttributes(this.props.aria),
|
|
48
44
|
}), children: jsxRuntime.jsx("div", { className: "scroller", children: jsxRuntime.jsxs("div", { className: "flyout", children: [jsxRuntime.jsx(button_wrapper.PButton, { variant: "ghost", className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss flyout" }), hasHeader && jsxRuntime.jsx("slot", { name: "header" }), jsxRuntime.jsx("slot", {}), hasFooter && jsxRuntime.jsx("slot", { name: "footer" }), hasSubFooter && jsxRuntime.jsx("slot", { name: "sub-footer" })] }) }) })] }), this.props.children] }));
|
|
49
45
|
}
|
package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.cjs
CHANGED
|
@@ -39,6 +39,7 @@ class DSRSelect extends react.Component {
|
|
|
39
39
|
isNativePopoverCase = false;
|
|
40
40
|
parentTableElement;
|
|
41
41
|
popoverElement;
|
|
42
|
+
slottedImagePath = '';
|
|
42
43
|
formDisabledCallback() {
|
|
43
44
|
}
|
|
44
45
|
formStateRestoreCallback() {
|
|
@@ -54,8 +55,8 @@ class DSRSelect extends react.Component {
|
|
|
54
55
|
const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? stateMessage.messageId : undefined;
|
|
55
56
|
const initialStatusId = 'initial-status';
|
|
56
57
|
const ariaDescribedBy = [descriptionId, selectMessageId, initialStatusId].filter(Boolean).join(' ');
|
|
57
|
-
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getSelectCss('down', this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.isNativePopoverCase, this.props.theme)));
|
|
58
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsxRuntime.jsx("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, label.labelId, ariaDescribedBy, dropdownId), disabled: this.props.disabled, children: utilsEntry.getSelectedOptionString(otherChildren) }), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" }), jsxRuntime.jsx("div", { ...(this.props.isNativePopoverCase && {
|
|
58
|
+
const style = minifyCss.minifyCss(stripFocusAndHoverStyles.stripFocusAndHoverStyles(stylesEntry.getSelectCss('down', this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.isNativePopoverCase, this.props.theme, !!this.props.slottedImagePath)));
|
|
59
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxRuntime.jsxs("div", { className: "root", children: [jsxRuntime.jsx(label.Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxRuntime.jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsxRuntime.jsx("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...utilsEntry.getComboboxAriaAttributes(this.props.isOpen, this.props.required, label.labelId, ariaDescribedBy, dropdownId), disabled: this.props.disabled, children: this.props.slottedImagePath ? (jsxRuntime.jsxs("span", { children: [jsxRuntime.jsx("img", { src: this.props.slottedImagePath, alt: "" }), jsxRuntime.jsx("span", { children: utilsEntry.getSelectedOptionString(otherChildren) })] })) : (utilsEntry.getSelectedOptionString(otherChildren)) }), jsxRuntime.jsx(icon_wrapper.PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" }), jsxRuntime.jsx("div", { ...(this.props.isNativePopoverCase && {
|
|
59
60
|
popover: 'auto',
|
|
60
61
|
className: 'popover',
|
|
61
62
|
...(this.props.popoverElement?.matches(':popover-open') && {
|
|
@@ -63,6 +64,10 @@ class DSRSelect extends react.Component {
|
|
|
63
64
|
}),
|
|
64
65
|
}), children: jsxRuntime.jsx("div", { id: dropdownId, className: "listbox", ...utilsEntry.getListAriaAttributes(this.props.label, this.props.required, false, this.props.isOpen), children: jsxRuntime.jsx("slot", {}) }) })] }), jsxRuntime.jsx(stateMessage.StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null }), jsxRuntime.jsx("span", { className: "sr-only", role: "status", "aria-live": "assertive", "aria-relevant": "additions text", children: this.props.srHighlightedOptionText })] })] }), this.props.children] }));
|
|
65
66
|
}
|
|
67
|
+
getSelectedOptionImagePath = (options) => options
|
|
68
|
+
.find((option) => option.selected)
|
|
69
|
+
?.querySelector('img')
|
|
70
|
+
?.getAttribute('src') ?? '';
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
exports.DSRSelect = DSRSelect;
|
|
@@ -8517,7 +8517,6 @@ const getOptionStyles = (theme) => {
|
|
|
8517
8517
|
gap: '12px',
|
|
8518
8518
|
padding: `${spacingStaticSmall} 12px`,
|
|
8519
8519
|
paddingInlineStart: `var(${cssVariableSelectPaddingInlineStart}, 12px)`,
|
|
8520
|
-
flex: `1 0 calc(${fontLineHeight} + ${spacingStaticSmall} * 2)`,
|
|
8521
8520
|
minHeight: `calc(${fontLineHeight} + ${spacingStaticSmall} * 2)`, // TODO: Added this line to preserve height for empty option
|
|
8522
8521
|
color: contrastHighColor,
|
|
8523
8522
|
...prefersColorSchemeDarkMediaQuery(theme, {
|
|
@@ -9745,7 +9744,7 @@ const cssVarBorderColor = '--p-select-border-color';
|
|
|
9745
9744
|
const cssVarIconFilter = '--p-select-icon-filter';
|
|
9746
9745
|
const cssVarBackgroundColorFocus = '--p-select-focus-background-color';
|
|
9747
9746
|
const cssVarBorderColorFocus = '--p-select-focus-border-color';
|
|
9748
|
-
const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNativePopoverCase, theme) => {
|
|
9747
|
+
const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNativePopoverCase, theme, hasSlottedImage) => {
|
|
9749
9748
|
return getCss({
|
|
9750
9749
|
'@global': {
|
|
9751
9750
|
':host': {
|
|
@@ -9757,7 +9756,7 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNa
|
|
|
9757
9756
|
},
|
|
9758
9757
|
...preventFoucOfNestedElementsStyles,
|
|
9759
9758
|
// TODO: re-use select-wrapper-style
|
|
9760
|
-
button: getButtonStyles(isDisabled, direction, isOpen, state, theme),
|
|
9759
|
+
button: getButtonStyles(isDisabled, direction, isOpen, state, theme, hasSlottedImage),
|
|
9761
9760
|
},
|
|
9762
9761
|
root: {
|
|
9763
9762
|
display: 'grid',
|
|
@@ -9799,7 +9798,7 @@ const getComponentCss$p = (direction, isOpen, isDisabled, hideLabel, state, isNa
|
|
|
9799
9798
|
};
|
|
9800
9799
|
// TODO: Rename to JSSStyles
|
|
9801
9800
|
// TODO: use getSlottedTextFieldTextareaSelectStyles() instead an manipulate selectors like done with PIN Code or even better make it configurable as parameter
|
|
9802
|
-
const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
9801
|
+
const getButtonStyles = (isDisabled, direction, isOpen, state, theme, hasSlottedImage) => {
|
|
9803
9802
|
const { primaryColor, disabledColor, backgroundColor, contrastMediumColor } = getThemedColors(theme);
|
|
9804
9803
|
const { primaryColor: primaryColorDark, disabledColor: disabledColorDark, backgroundColor: backgroundColorDark, contrastMediumColor: contrastMediumColorDark, } = getThemedColors('dark');
|
|
9805
9804
|
const { formStateColor, formStateHoverColor } = getThemedFormStateColors(theme, state);
|
|
@@ -9809,7 +9808,6 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
|
9809
9808
|
overflowX: 'hidden', // TODO: Newly added (rest is copied from select-wrapper-dropdown), share rest for both components
|
|
9810
9809
|
whiteSpace: 'nowrap', // TODO: Newly added (rest is copied from select-wrapper-dropdown), share rest for both components
|
|
9811
9810
|
gridArea: '1/1/1/-1',
|
|
9812
|
-
flex: 1,
|
|
9813
9811
|
minWidth: 0,
|
|
9814
9812
|
// TODO: abstract and re-use for multi-select, select-wrapper and text-field-wrapper
|
|
9815
9813
|
height: `calc(${fontLineHeight} + 10px + ${borderWidthBase} * 2 + ${spacingStaticSmall} * 2)`, // we need 10px additionally so input height becomes 54px, // we need 6px additionally so input height becomes 50px
|
|
@@ -9839,9 +9837,25 @@ const getButtonStyles = (isDisabled, direction, isOpen, state, theme) => {
|
|
|
9839
9837
|
}),
|
|
9840
9838
|
...prefersColorSchemeDarkMediaQuery(theme, getPlaceholderJssStyle({
|
|
9841
9839
|
color: `var(${cssVarTextColor}, ${primaryColorDark})`,
|
|
9842
|
-
opacity: 1,
|
|
9840
|
+
opacity: 1, // Opacity fixes placeholder being shown lighter in firefox
|
|
9843
9841
|
})),
|
|
9844
|
-
},
|
|
9842
|
+
},
|
|
9843
|
+
...(hasSlottedImage && {
|
|
9844
|
+
'& > span': {
|
|
9845
|
+
display: 'flex',
|
|
9846
|
+
gap: '12px',
|
|
9847
|
+
alignItems: 'center',
|
|
9848
|
+
},
|
|
9849
|
+
'& > span > span': {
|
|
9850
|
+
textOverflow: 'ellipsis',
|
|
9851
|
+
overflow: 'hidden',
|
|
9852
|
+
},
|
|
9853
|
+
'& img': {
|
|
9854
|
+
height: fontLineHeight,
|
|
9855
|
+
borderRadius: borderRadiusSmall,
|
|
9856
|
+
width: 'auto',
|
|
9857
|
+
},
|
|
9858
|
+
}),
|
|
9845
9859
|
...hoverMediaQuery({
|
|
9846
9860
|
'&:hover:not(:disabled):not(:focus-visible),label:hover~.wrapper &:not(:disabled):not(:focus-visible)': {
|
|
9847
9861
|
borderColor: `var(${cssVarBorderColor}, ${isOpen ? primaryColor : formStateHoverColor || primaryColor})`,
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/flyout.mjs
CHANGED
|
@@ -35,13 +35,9 @@ class DSRFlyout extends Component {
|
|
|
35
35
|
const hasFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'footer').length > 0;
|
|
36
36
|
const hasSubFooter = namedSlotChildren.filter(({ props: { slot } }) => slot === 'sub-footer').length > 0;
|
|
37
37
|
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$R(this.props.open, (positionDeprecationMap[this.props.position] || this.props.position), hasHeader, hasFooter, hasSubFooter, this.props.footerBehavior, this.props.theme)));
|
|
38
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("dialog", {
|
|
39
|
-
// "inert" will be known from React 19 onwards, see https://github.com/facebook/react/pull/24730
|
|
40
|
-
// eslint-disable-next-line
|
|
41
|
-
/* @ts-ignore */
|
|
42
|
-
inert: this.props.open ? null : '', tabIndex: -1, ...parseAndGetAriaAttributes({
|
|
38
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx("dialog", { tabIndex: -1, ...parseAndGetAriaAttributes({
|
|
43
39
|
'aria-modal': true,
|
|
44
|
-
...
|
|
40
|
+
...{ 'aria-label': hasHeader ? namedSlotChildren.find(({ props: { slot } }) => slot === 'header')?.props.children : 'Flyout' },
|
|
45
41
|
...parseAndGetAriaAttributes(this.props.aria),
|
|
46
42
|
}), children: jsx("div", { className: "scroller", children: jsxs("div", { className: "flyout", children: [jsx(PButton, { variant: "ghost", className: "dismiss", type: "button", hideLabel: true, icon: "close", theme: this.props.theme, children: "Dismiss flyout" }), hasHeader && jsx("slot", { name: "header" }), jsx("slot", {}), hasFooter && jsx("slot", { name: "footer" }), hasSubFooter && jsx("slot", { name: "sub-footer" })] }) }) })] }), this.props.children] }));
|
|
47
43
|
}
|
package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/select.mjs
CHANGED
|
@@ -37,6 +37,7 @@ class DSRSelect extends Component {
|
|
|
37
37
|
isNativePopoverCase = false;
|
|
38
38
|
parentTableElement;
|
|
39
39
|
popoverElement;
|
|
40
|
+
slottedImagePath = '';
|
|
40
41
|
formDisabledCallback() {
|
|
41
42
|
}
|
|
42
43
|
formStateRestoreCallback() {
|
|
@@ -52,8 +53,8 @@ class DSRSelect extends Component {
|
|
|
52
53
|
const selectMessageId = (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state) ? messageId : undefined;
|
|
53
54
|
const initialStatusId = 'initial-status';
|
|
54
55
|
const ariaDescribedBy = [descriptionId, selectMessageId, initialStatusId].filter(Boolean).join(' ');
|
|
55
|
-
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$p('down', this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.isNativePopoverCase, this.props.theme)));
|
|
56
|
-
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx(Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsx("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...getComboboxAriaAttributes(this.props.isOpen, this.props.required, labelId, ariaDescribedBy, dropdownId), disabled: this.props.disabled, children: getSelectedOptionString(otherChildren) }), jsx(PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" }), jsx("div", { ...(this.props.isNativePopoverCase && {
|
|
56
|
+
const style = minifyCss(stripFocusAndHoverStyles(getComponentCss$p('down', this.props.isOpen, this.props.disabled, this.props.hideLabel, this.props.state, this.props.isNativePopoverCase, this.props.theme, !!this.props.slottedImagePath)));
|
|
57
|
+
return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx(Label, { hasLabel: this.props.label || namedSlotChildren.filter(({ props: { slot } }) => slot === 'label').length > 0, hasDescription: this.props.description || namedSlotChildren.filter(({ props: { slot } }) => slot === 'description').length > 0, host: null, label: this.props.label, description: this.props.description, htmlFor: buttonId, isRequired: this.props.required, isDisabled: this.props.disabled }), jsxs("div", { className: `wrapper${this.props.disabled ? ' disabled' : ''}`, children: [jsx("button", { "aria-invalid": this.props.state === 'error' ? 'true' : null, type: "button", role: "combobox", id: buttonId, ...getComboboxAriaAttributes(this.props.isOpen, this.props.required, labelId, ariaDescribedBy, dropdownId), disabled: this.props.disabled, children: this.props.slottedImagePath ? (jsxs("span", { children: [jsx("img", { src: this.props.slottedImagePath, alt: "" }), jsx("span", { children: getSelectedOptionString(otherChildren) })] })) : (getSelectedOptionString(otherChildren)) }), jsx(PIcon, { className: "icon", name: "arrow-head-down", theme: this.props.theme, color: this.props.disabled ? 'state-disabled' : 'primary', "aria-hidden": "true" }), jsx("div", { ...(this.props.isNativePopoverCase && {
|
|
57
58
|
popover: 'auto',
|
|
58
59
|
className: 'popover',
|
|
59
60
|
...(this.props.popoverElement?.matches(':popover-open') && {
|
|
@@ -61,6 +62,10 @@ class DSRSelect extends Component {
|
|
|
61
62
|
}),
|
|
62
63
|
}), children: jsx("div", { id: dropdownId, className: "listbox", ...getListAriaAttributes(this.props.label, this.props.required, false, this.props.isOpen), children: jsx("slot", {}) }) })] }), jsx(StateMessage, { hasMessage: (this.props.message || namedSlotChildren.filter(({ props: { slot } }) => slot === 'message').length > 0) && ['success', 'error'].includes(this.props.state), state: this.props.state, message: this.props.message, theme: this.props.theme, host: null }), jsx("span", { className: "sr-only", role: "status", "aria-live": "assertive", "aria-relevant": "additions text", children: this.props.srHighlightedOptionText })] })] }), this.props.children] }));
|
|
63
64
|
}
|
|
65
|
+
getSelectedOptionImagePath = (options) => options
|
|
66
|
+
.find((option) => option.selected)
|
|
67
|
+
?.querySelector('img')
|
|
68
|
+
?.getAttribute('src') ?? '';
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
export { DSRSelect };
|
|
@@ -24,8 +24,10 @@ export declare class DSRSelect extends Component<any> {
|
|
|
24
24
|
private isNativePopoverCase;
|
|
25
25
|
private parentTableElement;
|
|
26
26
|
private popoverElement;
|
|
27
|
+
private slottedImagePath;
|
|
27
28
|
formDisabledCallback(): void;
|
|
28
29
|
formStateRestoreCallback(): void;
|
|
29
30
|
formResetCallback(): void;
|
|
30
31
|
render(): JSX.Element;
|
|
32
|
+
private getSelectedOptionImagePath;
|
|
31
33
|
}
|