@porsche-design-system/components-react 4.2.0 → 4.3.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.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/cjs/lib/components/tabs-bar.wrapper.cjs +3 -3
  3. package/cjs/lib/components/tabs.wrapper.cjs +3 -3
  4. package/esm/lib/components/scroller.wrapper.d.ts +2 -2
  5. package/esm/lib/components/tabs-bar.wrapper.d.ts +9 -1
  6. package/esm/lib/components/tabs-bar.wrapper.mjs +3 -3
  7. package/esm/lib/components/tabs.wrapper.d.ts +9 -1
  8. package/esm/lib/components/tabs.wrapper.mjs +3 -3
  9. package/esm/lib/types.d.ts +13 -1
  10. package/package.json +2 -2
  11. package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +121 -121
  12. package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +1 -1
  13. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/tabs-bar.wrapper.cjs +4 -4
  14. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/tabs.wrapper.cjs +4 -4
  15. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/scroller.cjs +1 -1
  16. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs-bar.cjs +6 -1
  17. package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs.cjs +1 -1
  18. package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +121 -121
  19. package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -1
  20. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/tabs-bar.wrapper.mjs +4 -4
  21. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/tabs.wrapper.mjs +4 -4
  22. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/scroller.mjs +1 -1
  23. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs-bar.mjs +7 -2
  24. package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/tabs.mjs +1 -1
  25. package/ssr/esm/lib/components/scroller.wrapper.d.ts +2 -2
  26. package/ssr/esm/lib/components/tabs-bar.wrapper.d.ts +9 -1
  27. package/ssr/esm/lib/components/tabs.wrapper.d.ts +9 -1
  28. package/ssr/esm/lib/types.d.ts +13 -1
@@ -5,21 +5,21 @@ import { useEventCallback, usePrefix, useBrowserLayoutEffect, useMergedClass } f
5
5
  import { syncRef } from '../../utils.mjs';
6
6
  import { DSRTabs } from '../dsr-components/tabs.mjs';
7
7
 
8
- const PTabs = /*#__PURE__*/ forwardRef(({ activeTabIndex = 0, background = 'none', compact, onUpdate, size = 'small', weight = 'regular', className, children, ...rest }, ref) => {
8
+ const PTabs = /*#__PURE__*/ forwardRef(({ activeTabIndex = 0, aria, background = 'none', compact, onUpdate, size = 'small', weight = 'regular', className, children, ...rest }, ref) => {
9
9
  const elementRef = useRef(undefined);
10
10
  useEventCallback(elementRef, 'update', onUpdate);
11
11
  const WebComponentTag = usePrefix('p-tabs');
12
- const propsToSync = [activeTabIndex, background, compact, size, weight];
12
+ const propsToSync = [activeTabIndex, aria, background, compact, size, weight];
13
13
  useBrowserLayoutEffect(() => {
14
14
  const { current } = elementRef;
15
- ['activeTabIndex', 'background', 'compact', 'size', 'weight'].forEach((propName, i) => (current[propName] = propsToSync[i]));
15
+ ['activeTabIndex', 'aria', 'background', 'compact', 'size', 'weight'].forEach((propName, i) => (current[propName] = propsToSync[i]));
16
16
  }, propsToSync);
17
17
  const props = {
18
18
  ...rest,
19
19
  // @ts-ignore
20
20
  ...(!process.browser
21
21
  ? {
22
- children: (jsx(DSRTabs, { activeTabIndex, background, compact, size, weight, children })),
22
+ children: (jsx(DSRTabs, { activeTabIndex, aria, background, compact, size, weight, children })),
23
23
  }
24
24
  : {
25
25
  children,
@@ -19,7 +19,7 @@ class DSRScroller extends Component {
19
19
  render() {
20
20
  splitChildren(this.props.children);
21
21
  const style = minifyCss(getComponentCss$s(this.props.isIndicatorPrevVisible, this.props.isIndicatorNextVisible, this.props.sticky, this.props.scrollbar, this.props.compact));
22
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx("span", { className: "prev" }), jsx("span", { className: "next" }), jsxs("div", { className: "scroll", role: parseAndGetAriaAttributes(this.props.aria)?.role || null, tabIndex: this.props.isIndicatorPrevVisible || this.props.isIndicatorNextVisible ? 0 : null, children: [jsx("span", { className: "sentinel" }), jsx("slot", {}), jsx("span", { className: "sentinel" })] })] })] }), this.props.children] }));
22
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs("div", { className: "root", children: [jsx("span", { className: "prev" }), jsx("span", { className: "next" }), jsxs("div", { className: "scroll", ...parseAndGetAriaAttributes(this.props.aria), tabIndex: this.props.isIndicatorPrevVisible || this.props.isIndicatorNextVisible ? 0 : null, children: [jsx("span", { className: "sentinel" }), jsx("slot", {}), jsx("span", { className: "sentinel" })] })] })] }), this.props.children] }));
23
23
  }
24
24
  }
25
25
 
@@ -4,7 +4,7 @@ import '../../provider.mjs';
4
4
  import { splitChildren } from '../../splitChildren.mjs';
5
5
  import { minifyCss } from '../../minifyCss.mjs';
6
6
  import { getTabsBarCss as getComponentCss$b } from '../../../../../../components/dist/styles/esm/styles-entry.mjs';
7
- import { getSanitizedActiveTabIndex } from '../../../../../../components/dist/utils/esm/utils-entry.mjs';
7
+ import { getSanitizedActiveTabIndex, parseAndGetAriaAttributes } from '../../../../../../components/dist/utils/esm/utils-entry.mjs';
8
8
  import { PScroller } from '../components/scroller.wrapper.mjs';
9
9
 
10
10
  /**
@@ -24,7 +24,12 @@ class DSRTabsBar extends Component {
24
24
  render() {
25
25
  const { children} = splitChildren(this.props.children);
26
26
  const style = minifyCss(getComponentCss$b(this.props.background, this.props.size, this.props.compact, getSanitizedActiveTabIndex(this.props.activeTabIndex, children)));
27
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(PScroller, { className: "scroller", compact: this.props.compact, ...(this.props.isTabList && { aria: { role: 'tablist' } }), children: [jsx("slot", {}), jsx("span", { className: "bar" })] })] }), this.props.children] }));
27
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(PScroller, { className: "scroller", compact: this.props.compact, ...(this.props.isTabList && {
28
+ aria: {
29
+ role: 'tablist',
30
+ ...parseAndGetAriaAttributes(this.props.aria),
31
+ },
32
+ }), children: [jsx("slot", {}), jsx("span", { className: "bar" })] })] }), this.props.children] }));
28
33
  }
29
34
  }
30
35
 
@@ -21,7 +21,7 @@ class DSRTabs extends Component {
21
21
  ? { ...child, props: { ...child.props, theme: this.props.theme, hidden: this.props.activeTabIndex !== i ? true : null } }
22
22
  : child);
23
23
  const style = minifyCss(getComponentCss$9());
24
- return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(PTabsBar, { className: "root", size: this.props.size, background: this.props.background, compact: this.props.compact, activeTabIndex: this.props.activeTabIndex, children: otherChildren.map((tab, index) => (jsx("button", { type: "button", children: typeof tab === 'object' && 'props' in tab && tab.props.label }, index))) }), jsx("slot", {})] })] }), manipulatedChildren] }));
24
+ return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsxs(Fragment, { children: [jsx(PTabsBar, { className: "root", size: this.props.size, background: this.props.background, compact: this.props.compact, activeTabIndex: this.props.activeTabIndex, aria: this.props.aria, children: otherChildren.map((tab, index) => (jsx("button", { type: "button", children: typeof tab === 'object' && 'props' in tab && tab.props.label }, index))) }), jsx("slot", {})] })] }), manipulatedChildren] }));
25
25
  }
26
26
  }
27
27
 
@@ -7,7 +7,7 @@ export type PScrollerProps = BaseProps & {
7
7
  */
8
8
  alignScrollIndicator?: ScrollerAlignScrollIndicator;
9
9
  /**
10
- * Sets the ARIA `role` attribute on the scroller's scroll container, useful for list-based navigation patterns.
10
+ * Sets ARIA role and attributes on the scroller's scroll container, useful for tablist navigation patterns and additional accessibility context.
11
11
  */
12
12
  aria?: SelectedAriaAttributes<ScrollerAriaAttribute>;
13
13
  /**
@@ -36,7 +36,7 @@ export declare const PScroller: import("react").ForwardRefExoticComponent<Omit<i
36
36
  */
37
37
  alignScrollIndicator?: ScrollerAlignScrollIndicator;
38
38
  /**
39
- * Sets the ARIA `role` attribute on the scroller's scroll container, useful for list-based navigation patterns.
39
+ * Sets ARIA role and attributes on the scroller's scroll container, useful for tablist navigation patterns and additional accessibility context.
40
40
  */
41
41
  aria?: SelectedAriaAttributes<ScrollerAriaAttribute>;
42
42
  /**
@@ -1,10 +1,14 @@
1
1
  import type { BaseProps } from '../../BaseProps';
2
- import type { TabsBarBackground, TabsBarUpdateEventDetail, BreakpointCustomizable, TabsBarSize, TabsBarWeight } from '../types';
2
+ import type { SelectedAriaAttributes, TabsBarAriaAttribute, TabsBarBackground, TabsBarUpdateEventDetail, BreakpointCustomizable, TabsBarSize, TabsBarWeight } from '../types';
3
3
  export type PTabsBarProps = BaseProps & {
4
4
  /**
5
5
  * Sets the zero-based index of the currently active tab. Pass `undefined` to render all tabs in an unselected state.
6
6
  */
7
7
  activeTabIndex?: number | undefined;
8
+ /**
9
+ * Sets ARIA attributes on the tablist, such as `aria-label` and `aria-description`.
10
+ */
11
+ aria?: SelectedAriaAttributes<TabsBarAriaAttribute>;
8
12
  /**
9
13
  * Sets the background color of the tabs bar. Use `frosted` only when placed on top of images, videos, or gradients.
10
14
  * @default 'none'
@@ -34,6 +38,10 @@ export declare const PTabsBar: import("react").ForwardRefExoticComponent<Omit<im
34
38
  * Sets the zero-based index of the currently active tab. Pass `undefined` to render all tabs in an unselected state.
35
39
  */
36
40
  activeTabIndex?: number | undefined;
41
+ /**
42
+ * Sets ARIA attributes on the tablist, such as `aria-label` and `aria-description`.
43
+ */
44
+ aria?: SelectedAriaAttributes<TabsBarAriaAttribute>;
37
45
  /**
38
46
  * Sets the background color of the tabs bar. Use `frosted` only when placed on top of images, videos, or gradients.
39
47
  * @default 'none'
@@ -1,11 +1,15 @@
1
1
  import type { BaseProps } from '../../BaseProps';
2
- import type { TabsBackground, TabsUpdateEventDetail, BreakpointCustomizable, TabsSize, TabsWeight } from '../types';
2
+ import type { SelectedAriaAttributes, TabsAriaAttribute, TabsBackground, TabsUpdateEventDetail, BreakpointCustomizable, TabsSize, TabsWeight } from '../types';
3
3
  export type PTabsProps = BaseProps & {
4
4
  /**
5
5
  * Sets the zero-based index of the currently active tab; update this prop to switch tabs programmatically.
6
6
  * @default 0
7
7
  */
8
8
  activeTabIndex?: number;
9
+ /**
10
+ * Sets ARIA attributes on the tablist, such as `aria-label` and `aria-description`.
11
+ */
12
+ aria?: SelectedAriaAttributes<TabsAriaAttribute>;
9
13
  /**
10
14
  * Sets the background color of the tabs bar. Use `frosted` only when placed on top of images, videos, or gradients.
11
15
  * @default 'none'
@@ -36,6 +40,10 @@ export declare const PTabs: import("react").ForwardRefExoticComponent<Omit<impor
36
40
  * @default 0
37
41
  */
38
42
  activeTabIndex?: number;
43
+ /**
44
+ * Sets ARIA attributes on the tablist, such as `aria-label` and `aria-description`.
45
+ */
46
+ aria?: SelectedAriaAttributes<TabsAriaAttribute>;
39
47
  /**
40
48
  * Sets the background color of the tabs bar. Use `frosted` only when placed on top of images, videos, or gradients.
41
49
  * @default 'none'
@@ -1583,7 +1583,9 @@ declare const SCROLLER_ALIGN_SCROLL_INDICATORS: readonly [
1583
1583
  /** @deprecated */
1584
1584
  export type ScrollerAlignScrollIndicator = (typeof SCROLLER_ALIGN_SCROLL_INDICATORS)[number];
1585
1585
  declare const SCROLLER_ARIA_ATTRIBUTES: readonly [
1586
- "role"
1586
+ "role",
1587
+ "aria-label",
1588
+ "aria-description"
1587
1589
  ];
1588
1590
  export type ScrollerAriaAttribute = (typeof SCROLLER_ARIA_ATTRIBUTES)[number];
1589
1591
  /** @deprecated */
@@ -1670,6 +1672,11 @@ export type TableHeadCellSort = {
1670
1672
  direction?: Direction;
1671
1673
  };
1672
1674
  export type TableUpdateEventDetail = TableHeadCellSort;
1675
+ declare const TABS_ARIA_ATTRIBUTES: readonly [
1676
+ "aria-label",
1677
+ "aria-description"
1678
+ ];
1679
+ export type TabsAriaAttribute = (typeof TABS_ARIA_ATTRIBUTES)[number];
1673
1680
  declare const TABS_SIZES: readonly [
1674
1681
  "small",
1675
1682
  "medium"
@@ -1691,6 +1698,11 @@ export type TabsWeight = (typeof TABS_WEIGHTS)[number];
1691
1698
  export type TabsUpdateEventDetail = {
1692
1699
  activeTabIndex: number;
1693
1700
  };
1701
+ declare const TABS_BAR_ARIA_ATTRIBUTES: readonly [
1702
+ "aria-label",
1703
+ "aria-description"
1704
+ ];
1705
+ export type TabsBarAriaAttribute = (typeof TABS_BAR_ARIA_ATTRIBUTES)[number];
1694
1706
  declare const TABS_BAR_BACKGROUNDS: readonly [
1695
1707
  "canvas",
1696
1708
  "surface",