UNPKG

@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.

45 lines (42 loc) 3.61 kB
import { jsxs, Fragment, jsx } from 'react/jsx-runtime'; import { Component } from 'react'; import '../../provider.mjs'; import { splitChildren } from '../../splitChildren.mjs'; import { minifyCss } from '../../minifyCss.mjs'; import { getInputMonthCss as getComponentCss$W } from '../../../../../../components/dist/styles/esm/styles-entry.mjs'; import { hasShowPickerSupport } from '../../../../../../components/dist/utils/esm/utils-entry.mjs'; import { PButtonPure } from '../components/button-pure.wrapper.mjs'; import { InputBase } from './input-base.mjs'; /** * @slot {"name": "label", "description": "Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."} * @slot {"name": "label-after", "description": "Places additional content after the label text (for content that should not be part of the label, e.g. external links or `p-popover`)."} * @slot {"name": "description", "description": "Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."} * @slot {"name": "message", "description": "Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed."} * @slot {"name": "start", "description": "Shows content at the start of the input (e.g. unit prefix)."} * @slot {"name": "end", "description": "Shows content at the end of the input (e.g. toggle button, unit suffix)."} */ class DSRInputMonth extends Component { host; // The "name" property is reflected as an attribute to ensure compatibility with native form submission. // In the React wrapper, all props are synced as properties on the element ref, so reflecting "name" as an attribute ensures it is properly handled in the form submission process. internals; initialLoading = false; inputElement; defaultValue; formResetCallback() { // triggers value watcher } formDisabledCallback() { // Called when a parent fieldset is disabled or enabled } formStateRestoreCallback() { } render() { splitChildren(this.props.children); const style = minifyCss(getComponentCss$W(this.props.disabled, this.props.loading, this.props.hideLabel, this.props.state, this.props.compact, this.props.readOnly, this.props.theme)); return (jsxs(Fragment, { children: [jsxs("template", { shadowroot: "open", shadowrootmode: "open", shadowrootdelegatesfocus: "true", children: [jsx("style", { dangerouslySetInnerHTML: { __html: style } }), jsx(InputBase, { children: this.props.children, host: null, label: this.props.label, description: this.props.description, id: "input-month", name: this.props.name, form: this.props.form, type: "month", required: this.props.required, max: this.props.max, min: this.props.min, value: this.props.value, readOnly: this.props.readOnly, autoComplete: this.props.autoComplete, disabled: this.props.disabled, state: this.props.state, message: this.props.message, theme: this.props.theme, step: this.props.step, loading: this.props.loading, initialLoading: this.props.initialLoading, ...(hasShowPickerSupport() && { end: (jsx(PButtonPure, { hideLabel: true, theme: this.props.theme, className: "button", type: "button", icon: "calendar", disabled: this.props.disabled || this.props.readOnly, children: "Open date picker" })), }) })] }), this.props.children] })); } } export { DSRInputMonth };