@porsche-design-system/components-react
Version:
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.
39 lines (36 loc) • 1.41 kB
JavaScript
"use client";
import { jsx } from 'react/jsx-runtime';
import { forwardRef, useRef } from 'react';
import { usePrefix, useBrowserLayoutEffect, useMergedClass } from '../../hooks.mjs';
import { syncRef } from '../../utils.mjs';
import { DSRStepperHorizontalItem } from '../dsr-components/stepper-horizontal-item.mjs';
const PStepperHorizontalItem = /*#__PURE__*/ forwardRef((
// @ts-ignore
{ disabled = false, state, className, children, theme = 'light', ...rest }, ref) => {
const elementRef = useRef(undefined);
const WebComponentTag = usePrefix('p-stepper-horizontal-item');
const propsToSync = [disabled, state];
useBrowserLayoutEffect(() => {
const { current } = elementRef;
['disabled', 'state'].forEach((propName, i) => (current[propName] = propsToSync[i]));
}, propsToSync);
const props = {
...rest,
// @ts-ignore
...(!process.browser
? {
...{ "role": "listitem" },
children: (jsx(DSRStepperHorizontalItem, { disabled, state, theme, children })),
}
: {
children,
suppressHydrationWarning: true,
}),
'data-ssr': '',
class: useMergedClass(elementRef, className),
ref: syncRef(elementRef, ref)
};
// @ts-ignore
return jsx(WebComponentTag, { ...props });
});
export { PStepperHorizontalItem };