@porsche-design-system/components-react 4.5.0 → 4.6.0-rc.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 +8 -0
- package/bin/pds-skill.js +259 -0
- package/esm/lib/components/button.wrapper.d.ts +2 -2
- package/esm/lib/components/link.wrapper.d.ts +2 -2
- package/package.json +4 -3
- package/skill/SKILL.md +136 -0
- package/skill/references/components/p-accordion/examples/Default.tsx +24 -0
- package/skill/references/components/p-accordion/examples/InteractiveElementsInSummary.tsx +28 -0
- package/skill/references/components/p-accordion/examples/StickySummary.tsx +24 -0
- package/skill/references/components/p-accordion/p-accordion.md +95 -0
- package/skill/references/components/p-ai-tag/examples/Default.tsx +10 -0
- package/skill/references/components/p-ai-tag/examples/WithinCheckbox.tsx +30 -0
- package/skill/references/components/p-ai-tag/examples/WithinFormLabel.tsx +37 -0
- package/skill/references/components/p-ai-tag/examples/WithinImage.tsx +13 -0
- package/skill/references/components/p-ai-tag/examples/WithinInputSearch.tsx +12 -0
- package/skill/references/components/p-ai-tag/examples/WithinRadioGroup.tsx +29 -0
- package/skill/references/components/p-ai-tag/examples/WithinTable.tsx +91 -0
- package/skill/references/components/p-ai-tag/examples/WithinText.tsx +14 -0
- package/skill/references/components/p-ai-tag/p-ai-tag.md +47 -0
- package/skill/references/components/p-banner/examples/Customization.tsx +35 -0
- package/skill/references/components/p-banner/examples/Default.tsx +24 -0
- package/skill/references/components/p-banner/p-banner.md +92 -0
- package/skill/references/components/p-button/examples/Default.tsx +12 -0
- package/skill/references/components/p-button/examples/Form.tsx +28 -0
- package/skill/references/components/p-button/examples/FormAttribute.tsx +31 -0
- package/skill/references/components/p-button/p-button.md +118 -0
- package/skill/references/components/p-button-pure/examples/CustomClickableArea.tsx +12 -0
- package/skill/references/components/p-button-pure/examples/Default.tsx +12 -0
- package/skill/references/components/p-button-pure/examples/Form.tsx +28 -0
- package/skill/references/components/p-button-pure/examples/FormAttribute.tsx +32 -0
- package/skill/references/components/p-button-pure/p-button-pure.md +118 -0
- package/skill/references/components/p-button-tile/examples/ColorScheme.tsx +15 -0
- package/skill/references/components/p-button-tile/examples/Default.tsx +18 -0
- package/skill/references/components/p-button-tile/examples/FooterSlot.tsx +29 -0
- package/skill/references/components/p-button-tile/examples/Hyphens.tsx +33 -0
- package/skill/references/components/p-button-tile/examples/UiBehaviour.tsx +41 -0
- package/skill/references/components/p-button-tile/p-button-tile.md +115 -0
- package/skill/references/components/p-canvas/examples/Default.tsx +10 -0
- package/skill/references/components/p-canvas/p-canvas.md +91 -0
- package/skill/references/components/p-carousel/examples/Default.tsx +23 -0
- package/skill/references/components/p-carousel/examples/DynamicSlides.tsx +32 -0
- package/skill/references/components/p-carousel/examples/FlexibleWidths.tsx +29 -0
- package/skill/references/components/p-carousel/examples/FocusOnCenterSlide.tsx +56 -0
- package/skill/references/components/p-carousel/examples/Intl.tsx +20 -0
- package/skill/references/components/p-carousel/examples/JumpToSlide.tsx +42 -0
- package/skill/references/components/p-carousel/p-carousel.md +142 -0
- package/skill/references/components/p-checkbox/examples/Default.tsx +10 -0
- package/skill/references/components/p-checkbox/examples/Form.tsx +45 -0
- package/skill/references/components/p-checkbox/examples/Indeterminate.tsx +13 -0
- package/skill/references/components/p-checkbox/examples/Slots.tsx +54 -0
- package/skill/references/components/p-checkbox/examples/WrappedLabel.tsx +24 -0
- package/skill/references/components/p-checkbox/p-checkbox.md +122 -0
- package/skill/references/components/p-crest/examples/CustomClickableArea.tsx +10 -0
- package/skill/references/components/p-crest/examples/Default.tsx +10 -0
- package/skill/references/components/p-crest/examples/Link.tsx +10 -0
- package/skill/references/components/p-crest/p-crest.md +65 -0
- package/skill/references/components/p-display/examples/Color.tsx +12 -0
- package/skill/references/components/p-display/examples/Default.tsx +12 -0
- package/skill/references/components/p-display/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-display/examples/Size.tsx +12 -0
- package/skill/references/components/p-display/examples/SizeResponsive.tsx +12 -0
- package/skill/references/components/p-display/p-display.md +78 -0
- package/skill/references/components/p-divider/examples/Default.tsx +10 -0
- package/skill/references/components/p-divider/examples/Responsive.tsx +12 -0
- package/skill/references/components/p-divider/examples/Vertical.tsx +12 -0
- package/skill/references/components/p-divider/p-divider.md +49 -0
- package/skill/references/components/p-drilldown/examples/CustomContent.tsx +164 -0
- package/skill/references/components/p-drilldown/examples/Default.tsx +117 -0
- package/skill/references/components/p-drilldown/p-drilldown.md +168 -0
- package/skill/references/components/p-fieldset/examples/Default.tsx +12 -0
- package/skill/references/components/p-fieldset/examples/Required.tsx +13 -0
- package/skill/references/components/p-fieldset/examples/SlottedLabel.tsx +15 -0
- package/skill/references/components/p-fieldset/examples/SlottedMessage.tsx +15 -0
- package/skill/references/components/p-fieldset/p-fieldset.md +88 -0
- package/skill/references/components/p-flag/examples/Default.tsx +10 -0
- package/skill/references/components/p-flag/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-flag/examples/Size.tsx +13 -0
- package/skill/references/components/p-flag/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-flag/p-flag.md +68 -0
- package/skill/references/components/p-flyout/examples/CustomStyling.tsx +45 -0
- package/skill/references/components/p-flyout/examples/Default.tsx +42 -0
- package/skill/references/components/p-flyout/examples/Form.tsx +54 -0
- package/skill/references/components/p-flyout/examples/StickyTop.tsx +42 -0
- package/skill/references/components/p-flyout/p-flyout.md +128 -0
- package/skill/references/components/p-heading/examples/Color.tsx +12 -0
- package/skill/references/components/p-heading/examples/Default.tsx +12 -0
- package/skill/references/components/p-heading/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-heading/p-heading.md +78 -0
- package/skill/references/components/p-icon/examples/Color.tsx +13 -0
- package/skill/references/components/p-icon/examples/ColorCssVar.tsx +10 -0
- package/skill/references/components/p-icon/examples/Custom.tsx +10 -0
- package/skill/references/components/p-icon/examples/Default.tsx +10 -0
- package/skill/references/components/p-icon/examples/Overview.tsx +588 -0
- package/skill/references/components/p-icon/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-icon/examples/Size.tsx +13 -0
- package/skill/references/components/p-icon/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-icon/p-icon.md +88 -0
- package/skill/references/components/p-inline-notification/examples/ActionButton.tsx +25 -0
- package/skill/references/components/p-inline-notification/examples/Default.tsx +10 -0
- package/skill/references/components/p-inline-notification/examples/EventHandling.tsx +25 -0
- package/skill/references/components/p-inline-notification/p-inline-notification.md +74 -0
- package/skill/references/components/p-input-date/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-date/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-date/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-date/p-input-date.md +142 -0
- package/skill/references/components/p-input-email/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-email/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-email/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-email/p-input-email.md +146 -0
- package/skill/references/components/p-input-month/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-month/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-month/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-month/p-input-month.md +142 -0
- package/skill/references/components/p-input-number/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-number/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-number/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-number/p-input-number.md +150 -0
- package/skill/references/components/p-input-password/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-password/examples/Form.tsx +51 -0
- package/skill/references/components/p-input-password/examples/Slots.tsx +39 -0
- package/skill/references/components/p-input-password/examples/Toggle.tsx +10 -0
- package/skill/references/components/p-input-password/p-input-password.md +145 -0
- package/skill/references/components/p-input-search/examples/AriaCombobox.tsx +35 -0
- package/skill/references/components/p-input-search/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-search/examples/Form.tsx +52 -0
- package/skill/references/components/p-input-search/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-search/p-input-search.md +182 -0
- package/skill/references/components/p-input-tel/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-tel/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-tel/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-tel/p-input-tel.md +145 -0
- package/skill/references/components/p-input-text/examples/Controlled.tsx +36 -0
- package/skill/references/components/p-input-text/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-text/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-text/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-text/p-input-text.md +150 -0
- package/skill/references/components/p-input-time/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-time/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-time/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-time/p-input-time.md +144 -0
- package/skill/references/components/p-input-url/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-url/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-url/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-url/p-input-url.md +145 -0
- package/skill/references/components/p-input-week/examples/Default.tsx +10 -0
- package/skill/references/components/p-input-week/examples/Form.tsx +45 -0
- package/skill/references/components/p-input-week/examples/Slots.tsx +41 -0
- package/skill/references/components/p-input-week/p-input-week.md +142 -0
- package/skill/references/components/p-link/examples/Default.tsx +12 -0
- package/skill/references/components/p-link/examples/FrameworkRouting.tsx +14 -0
- package/skill/references/components/p-link/examples/Icon.tsx +17 -0
- package/skill/references/components/p-link/p-link.md +101 -0
- package/skill/references/components/p-link-pure/examples/CustomClickableArea.tsx +12 -0
- package/skill/references/components/p-link-pure/examples/Default.tsx +12 -0
- package/skill/references/components/p-link-pure/examples/FrameworkRouting.tsx +14 -0
- package/skill/references/components/p-link-pure/examples/Icon.tsx +17 -0
- package/skill/references/components/p-link-pure/p-link-pure.md +110 -0
- package/skill/references/components/p-link-tile/examples/ColorScheme.tsx +15 -0
- package/skill/references/components/p-link-tile/examples/Default.tsx +18 -0
- package/skill/references/components/p-link-tile/examples/FooterSlot.tsx +29 -0
- package/skill/references/components/p-link-tile/examples/Hyphens.tsx +34 -0
- package/skill/references/components/p-link-tile/examples/UiBehaviour.tsx +41 -0
- package/skill/references/components/p-link-tile/examples/WithVideo.tsx +15 -0
- package/skill/references/components/p-link-tile/p-link-tile.md +105 -0
- package/skill/references/components/p-link-tile-product/examples/Default.tsx +22 -0
- package/skill/references/components/p-link-tile-product/examples/FrameworkRouting.tsx +25 -0
- package/skill/references/components/p-link-tile-product/p-link-tile-product.md +93 -0
- package/skill/references/components/p-modal/examples/AlertDialog.tsx +39 -0
- package/skill/references/components/p-modal/examples/CustomStyling.tsx +26 -0
- package/skill/references/components/p-modal/examples/Default.tsx +39 -0
- package/skill/references/components/p-modal/examples/Scrollable.tsx +43 -0
- package/skill/references/components/p-modal/p-modal.md +135 -0
- package/skill/references/components/p-model-signature/examples/CustomStyling.tsx +14 -0
- package/skill/references/components/p-model-signature/examples/Default.tsx +10 -0
- package/skill/references/components/p-model-signature/examples/MaskBlendMode.tsx +32 -0
- package/skill/references/components/p-model-signature/examples/MaskImage.tsx +12 -0
- package/skill/references/components/p-model-signature/examples/MaskVideo.tsx +12 -0
- package/skill/references/components/p-model-signature/examples/SafeZone.tsx +60 -0
- package/skill/references/components/p-model-signature/p-model-signature.md +62 -0
- package/skill/references/components/p-multi-select/examples/AsyncFilter.tsx +136 -0
- package/skill/references/components/p-multi-select/examples/Default.tsx +29 -0
- package/skill/references/components/p-multi-select/examples/Form.tsx +53 -0
- package/skill/references/components/p-multi-select/examples/Optgroups.tsx +42 -0
- package/skill/references/components/p-multi-select/examples/SelectedSlot.tsx +94 -0
- package/skill/references/components/p-multi-select/examples/SetValue.tsx +80 -0
- package/skill/references/components/p-multi-select/examples/Slots.tsx +48 -0
- package/skill/references/components/p-multi-select/p-multi-select.md +197 -0
- package/skill/references/components/p-pagination/examples/Default.tsx +10 -0
- package/skill/references/components/p-pagination/p-pagination.md +83 -0
- package/skill/references/components/p-pin-code/examples/CopyPaste.tsx +10 -0
- package/skill/references/components/p-pin-code/examples/Default.tsx +10 -0
- package/skill/references/components/p-pin-code/examples/Form.tsx +45 -0
- package/skill/references/components/p-pin-code/examples/Slots.tsx +39 -0
- package/skill/references/components/p-pin-code/p-pin-code.md +109 -0
- package/skill/references/components/p-popover/examples/Default.tsx +14 -0
- package/skill/references/components/p-popover/examples/SlottedButton.tsx +15 -0
- package/skill/references/components/p-popover/p-popover.md +116 -0
- package/skill/references/components/p-radio-group/examples/Default.tsx +17 -0
- package/skill/references/components/p-radio-group/examples/Form.tsx +53 -0
- package/skill/references/components/p-radio-group/examples/Slots.tsx +69 -0
- package/skill/references/components/p-radio-group/p-radio-group.md +157 -0
- package/skill/references/components/p-scroller/examples/Default.tsx +51 -0
- package/skill/references/components/p-scroller/examples/Height.tsx +26 -0
- package/skill/references/components/p-scroller/examples/ScrollToPosition.tsx +58 -0
- package/skill/references/components/p-scroller/p-scroller.md +93 -0
- package/skill/references/components/p-segmented-control/examples/Default.tsx +26 -0
- package/skill/references/components/p-segmented-control/examples/Form.tsx +52 -0
- package/skill/references/components/p-segmented-control/examples/Slots.tsx +54 -0
- package/skill/references/components/p-segmented-control/examples/WithLabels.tsx +26 -0
- package/skill/references/components/p-segmented-control/p-segmented-control.md +162 -0
- package/skill/references/components/p-select/examples/AsyncFilter.tsx +136 -0
- package/skill/references/components/p-select/examples/Default.tsx +29 -0
- package/skill/references/components/p-select/examples/Form.tsx +53 -0
- package/skill/references/components/p-select/examples/Optgroups.tsx +42 -0
- package/skill/references/components/p-select/examples/Required.tsx +48 -0
- package/skill/references/components/p-select/examples/SelectedSlot.tsx +124 -0
- package/skill/references/components/p-select/examples/SetValue.tsx +80 -0
- package/skill/references/components/p-select/examples/Slots.tsx +48 -0
- package/skill/references/components/p-select/examples/SlottedImages.tsx +35 -0
- package/skill/references/components/p-select/p-select.md +194 -0
- package/skill/references/components/p-sheet/examples/Default.tsx +31 -0
- package/skill/references/components/p-sheet/p-sheet.md +121 -0
- package/skill/references/components/p-spinner/examples/Color.tsx +13 -0
- package/skill/references/components/p-spinner/examples/ColorCssVar.tsx +10 -0
- package/skill/references/components/p-spinner/examples/Default.tsx +10 -0
- package/skill/references/components/p-spinner/examples/ResponsiveSize.tsx +10 -0
- package/skill/references/components/p-spinner/examples/Size.tsx +13 -0
- package/skill/references/components/p-spinner/examples/SizeCssVar.tsx +10 -0
- package/skill/references/components/p-spinner/p-spinner.md +96 -0
- package/skill/references/components/p-stepper-horizontal/examples/Default.tsx +23 -0
- package/skill/references/components/p-stepper-horizontal/examples/FrameworkImplementation.tsx +100 -0
- package/skill/references/components/p-stepper-horizontal/p-stepper-horizontal.md +109 -0
- package/skill/references/components/p-switch/examples/Default.tsx +19 -0
- package/skill/references/components/p-switch/p-switch.md +103 -0
- package/skill/references/components/p-table/examples/Advanced.tsx +186 -0
- package/skill/references/components/p-table/examples/CaptionProperty.tsx +37 -0
- package/skill/references/components/p-table/examples/CaptionSlot.tsx +40 -0
- package/skill/references/components/p-table/examples/Default.tsx +117 -0
- package/skill/references/components/p-table/examples/HideLabel.tsx +37 -0
- package/skill/references/components/p-table/examples/LayoutFixed.tsx +50 -0
- package/skill/references/components/p-table/examples/Sorting.tsx +86 -0
- package/skill/references/components/p-table/p-table.md +189 -0
- package/skill/references/components/p-tabs/examples/ActiveTab.tsx +26 -0
- package/skill/references/components/p-tabs/examples/Default.tsx +26 -0
- package/skill/references/components/p-tabs/examples/Gradient.tsx +111 -0
- package/skill/references/components/p-tabs/examples/Labelling.tsx +26 -0
- package/skill/references/components/p-tabs/p-tabs.md +136 -0
- package/skill/references/components/p-tabs-bar/examples/Default.tsx +27 -0
- package/skill/references/components/p-tabs-bar/examples/Gradient.tsx +78 -0
- package/skill/references/components/p-tabs-bar/examples/Labelling.tsx +27 -0
- package/skill/references/components/p-tabs-bar/examples/Links.tsx +20 -0
- package/skill/references/components/p-tabs-bar/p-tabs-bar.md +181 -0
- package/skill/references/components/p-tag/examples/Default.tsx +12 -0
- package/skill/references/components/p-tag/examples/Multiline.tsx +14 -0
- package/skill/references/components/p-tag/examples/SlottedButton.tsx +41 -0
- package/skill/references/components/p-tag/examples/SlottedLink.tsx +41 -0
- package/skill/references/components/p-tag/p-tag.md +66 -0
- package/skill/references/components/p-tag-dismissible/examples/Default.tsx +12 -0
- package/skill/references/components/p-tag-dismissible/p-tag-dismissible.md +75 -0
- package/skill/references/components/p-text/examples/Default.tsx +12 -0
- package/skill/references/components/p-text/examples/Semantics.tsx +18 -0
- package/skill/references/components/p-text/examples/Size.tsx +12 -0
- package/skill/references/components/p-text/examples/SizeResponsive.tsx +12 -0
- package/skill/references/components/p-text/p-text.md +68 -0
- package/skill/references/components/p-text-list/examples/Default.tsx +28 -0
- package/skill/references/components/p-text-list/p-text-list.md +68 -0
- package/skill/references/components/p-textarea/examples/Default.tsx +10 -0
- package/skill/references/components/p-textarea/examples/Form.tsx +45 -0
- package/skill/references/components/p-textarea/examples/Slots.tsx +39 -0
- package/skill/references/components/p-textarea/p-textarea.md +122 -0
- package/skill/references/components/p-toast/examples/Default.tsx +22 -0
- package/skill/references/components/p-toast/p-toast.md +61 -0
- package/skill/references/components/p-wordmark/examples/CustomClickableArea.tsx +10 -0
- package/skill/references/components/p-wordmark/examples/Default.tsx +10 -0
- package/skill/references/components/p-wordmark/examples/Size.tsx +10 -0
- package/skill/references/components/p-wordmark/p-wordmark.md +66 -0
- package/skill/references/icons.md +5 -0
- package/skill/references/styles/emotion.md +439 -0
- package/skill/references/styles/scss.md +402 -0
- package/skill/references/styles/tailwindcss.md +356 -0
- package/skill/references/styles/vanilla-extract.md +444 -0
- package/skill/references/stylesheets.md +331 -0
- package/skill/references/tokens.md +323 -0
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +1 -1
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +1 -1
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +1 -1
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +1 -1
- package/ssr/esm/lib/components/button.wrapper.d.ts +2 -2
- package/ssr/esm/lib/components/link.wrapper.d.ts +2 -2
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonPure, PIcon, PInputTel, PPopover } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PInputTel state="error">
|
|
8
|
+
<span slot="label">
|
|
9
|
+
Some label with a
|
|
10
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
11
|
+
link
|
|
12
|
+
</a>
|
|
13
|
+
and a "label-after" slot.
|
|
14
|
+
</span>
|
|
15
|
+
<PPopover slot="label-after">
|
|
16
|
+
Some Popover content with a
|
|
17
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
18
|
+
link
|
|
19
|
+
</a>
|
|
20
|
+
.
|
|
21
|
+
</PPopover>
|
|
22
|
+
<span slot="description">
|
|
23
|
+
Some description with a
|
|
24
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
25
|
+
link
|
|
26
|
+
</a>
|
|
27
|
+
.
|
|
28
|
+
</span>
|
|
29
|
+
<PIcon slot="start" name="home" color="contrast-medium" aria-hidden={true}></PIcon>
|
|
30
|
+
<PButtonPure slot="end" icon="delete" hideLabel={true} className="p-(--ref-p-input-slotted-padding) m-(--ref-p-input-slotted-margin)" aria={{'aria-label': 'Delete'}}></PButtonPure>
|
|
31
|
+
<span slot="message">
|
|
32
|
+
Some error message with a
|
|
33
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
34
|
+
link
|
|
35
|
+
</a>
|
|
36
|
+
.
|
|
37
|
+
</span>
|
|
38
|
+
</PInputTel>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# p-input-tel
|
|
2
|
+
|
|
3
|
+
The `p-input-tel` component provides a user-friendly, accessible interface for entering valid telephone numbers. It leverages native HTML5 telephone validation and ensures appropriate keyboard behavior on mobile devices. It includes `start` and `end` slots to flexibly incorporate icons, buttons, or other elements within the input field.
|
|
4
|
+
|
|
5
|
+
A `label` is a caption which informs the user what information a particular form field is asking for. The `p-input-tel` component can be used with or without a label, but it's recommended to keep the label visible for better accessibility whenever possible. When used without a label, it's mandatory to provide a descriptive label text for screen readers.
|
|
6
|
+
|
|
7
|
+
While a `placeholder` is optional but recommended to be set whenever bits of example content or hints shall be shown to give the user visual cues to fill out the form.
|
|
8
|
+
|
|
9
|
+
> **Input Event Handling**
|
|
10
|
+
>
|
|
11
|
+
> React's `onChange` behaves like the native `onInput` (fires on every keystroke). However, our web components follow standard browser behavior, where `onChange` only fires when the input loses focus. To get real-time updates on each keystroke, use `onInput` instead.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
The `p-input-tel` component is specifically designed for collecting telephone numbers. It leverages built-in browser validation to ensure that input follows the correct phone number format. This makes it a better choice than a generic text input when phone number validation, proper keyboard behavior on mobile devices, and accessibility are important. For further guidance, see the [MDN documentation on tel inputs](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/tel#using_tel_inputs).
|
|
16
|
+
|
|
17
|
+
### Do:
|
|
18
|
+
|
|
19
|
+
- Use when requesting a telephone number from the user.
|
|
20
|
+
- Use without a label only when the context is clear.
|
|
21
|
+
- Use for validation and error of input.
|
|
22
|
+
- Use asterisk for required fields.
|
|
23
|
+
|
|
24
|
+
### Don't:
|
|
25
|
+
|
|
26
|
+
- Don't use labels with more than two words whenever possible (keep it short and descriptive).
|
|
27
|
+
- Don't use an instructional or description text for the label.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Related Components
|
|
32
|
+
|
|
33
|
+
- [Input Date](../p-input-date/p-input-date.md)
|
|
34
|
+
- [Input Email](../p-input-email/p-input-email.md)
|
|
35
|
+
- [Input Month](../p-input-month/p-input-month.md)
|
|
36
|
+
- [Input Number](../p-input-number/p-input-number.md)
|
|
37
|
+
- [Input Password](../p-input-password/p-input-password.md)
|
|
38
|
+
- [Input Search](../p-input-search/p-input-search.md)
|
|
39
|
+
- [Input Text](../p-input-text/p-input-text.md)
|
|
40
|
+
- [Input Time](../p-input-time/p-input-time.md)
|
|
41
|
+
- [Input Url](../p-input-url/p-input-url.md)
|
|
42
|
+
- [Input Week](../p-input-week/p-input-week.md)
|
|
43
|
+
|
|
44
|
+
## Accessibility support
|
|
45
|
+
|
|
46
|
+
### Keyboard
|
|
47
|
+
|
|
48
|
+
| Key / state | Function |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
51
|
+
|
|
52
|
+
### ARIA enhancements
|
|
53
|
+
|
|
54
|
+
#### Internal **ARIA** that is managed by the component:
|
|
55
|
+
|
|
56
|
+
| ARIA | Usage |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `aria-describedby="IDREF"` | Defines the accessible description combined with the status message. |
|
|
59
|
+
| `role="status"`, `role="alert"` | When `message` and `state` or `loading` prop change, the status message is announced. |
|
|
60
|
+
| `aria-hidden="true"` | If `required` attribute is set, the visible asterisk indicator is hidden from assistive technologies. |
|
|
61
|
+
| `aria-invalid="true"` | If `error` state is set. |
|
|
62
|
+
| `aria-live="polite"` | If the `maxlength` attribute is present, the counter is announced via ARIA live region. |
|
|
63
|
+
|
|
64
|
+
## Development considerations
|
|
65
|
+
|
|
66
|
+
### Disabled state
|
|
67
|
+
|
|
68
|
+
In general, avoid using the `disabled` state. Disabled elements are no longer focusable and may be missed by screen reader users. They can also confuse sighted users if the reason they are disabled is not made clear.
|
|
69
|
+
|
|
70
|
+
### Common do's and don'ts
|
|
71
|
+
|
|
72
|
+
- **Do** keep a persistent label and use helper/description text when additional context is required.
|
|
73
|
+
- **Do** use the component state/message API so validation and status changes are announced.
|
|
74
|
+
- **Do** use clear error wording that helps users recover.
|
|
75
|
+
- **Don't** rely on placeholder text as the only label.
|
|
76
|
+
- **Don't** use `hide-label` without an accessible name.
|
|
77
|
+
|
|
78
|
+
## Limitations
|
|
79
|
+
|
|
80
|
+
Due to the nature of **Web Components** and **shadow DOM**, there are limitations when using some **ARIA** attributes to define relationships between elements across different shadow DOMs or shadow DOM/light DOM combinations.
|
|
81
|
+
|
|
82
|
+
| ARIA | Support |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `aria-labelledby` | 🚫 |
|
|
85
|
+
| `aria-describedby` | 🚫 |
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### Properties
|
|
90
|
+
|
|
91
|
+
| Property | Type | Default | Description |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| `autoComplete` | `string` | `undefined` | Provides the browser with a phone number autofill hint (e.g. `autocomplete='tel'`). |
|
|
94
|
+
| `compact` | `boolean` | `false` | Reduces the input height and padding for a more compact layout. |
|
|
95
|
+
| `description` | `string` | `''` | Sets a supplementary description displayed below the label to provide additional context. |
|
|
96
|
+
| `disabled` | `boolean` | `false` | Disables the field, preventing all input. The value is not submitted with the form. |
|
|
97
|
+
| `form` | `string` | `undefined` | Associates the field with a form element by its ID when the field is not nested directly inside it. |
|
|
98
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. |
|
|
99
|
+
| `indicator` | `boolean` | `false` | Shows a phone icon at the start of the field as a visual indicator for telephone input. |
|
|
100
|
+
| `label` | `string` | `''` | Sets the visible label text displayed above the input field. |
|
|
101
|
+
| `loading` _(experimental)_ | `boolean` | `false` | @experimental Disables the field and displays a loading spinner to indicate an ongoing operation. |
|
|
102
|
+
| `maxLength` | `number` | `undefined` | Sets the maximum number of characters the user can enter. |
|
|
103
|
+
| `message` | `string` | `''` | Sets the validation feedback message displayed below the field when `state` is `success` or `error`. |
|
|
104
|
+
| `minLength` | `number` | `undefined` | Sets the minimum number of characters required for the field to be considered valid. |
|
|
105
|
+
| `name` _(required)_ | `string` | `undefined` | Sets the name submitted with the form data to identify this field's value on the server. |
|
|
106
|
+
| `pattern` | `string` | `undefined` | Sets a regular expression the entered value must match to be valid. Overrides the browser's default telephone validation. |
|
|
107
|
+
| `placeholder` | `string` | `''` | Sets placeholder text shown inside the field when it is empty, such as an example phone number format. |
|
|
108
|
+
| `readOnly` | `boolean` | `false` | Makes the field read-only — the value is displayed but cannot be edited. The value is still submitted with the form. |
|
|
109
|
+
| `required` | `boolean` | `false` | Marks the field as required — form submission is blocked while this field is empty. |
|
|
110
|
+
| `state` | `'none'` `'error'` `'success'` | `'none'` | Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`). |
|
|
111
|
+
| `value` | `string | null` | `''` | Sets the current telephone number value of the field. |
|
|
112
|
+
|
|
113
|
+
### Events
|
|
114
|
+
|
|
115
|
+
| Event | Type | Description |
|
|
116
|
+
| --- | --- | --- |
|
|
117
|
+
| `blur` | `CustomEvent<InputTelBlurEventDetail>`<br>`Event` | Emitted when the input loses focus, regardless of whether the value changed. |
|
|
118
|
+
| `change` | `CustomEvent<InputTelChangeEventDetail>`<br>`Event` | Emitted when the input loses focus after its value was changed. |
|
|
119
|
+
| `input` | `CustomEvent<InputTelInputEventDetail>`<br>`InputEvent` | Emitted on every value change as the user types. |
|
|
120
|
+
|
|
121
|
+
### Slots
|
|
122
|
+
|
|
123
|
+
| Slot | Required | Allowed tag names | Description |
|
|
124
|
+
| --- | --- | --- | --- |
|
|
125
|
+
| `label` | no | — | Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
126
|
+
| `label-after` | no | — | Places additional content after the label text (for content that should not be part of the label, e.g. external links or `p-popover`). |
|
|
127
|
+
| `description` | no | — | Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
128
|
+
| `message` | no | — | Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
129
|
+
| `start` | no | — | Shows content at the start of the input (e.g. unit prefix). |
|
|
130
|
+
| `end` | no | — | Shows content at the end of the input (e.g. toggle button, unit suffix). |
|
|
131
|
+
|
|
132
|
+
### CSS Variables
|
|
133
|
+
|
|
134
|
+
| CSS Variable | Default | Description |
|
|
135
|
+
| --- | --- | --- |
|
|
136
|
+
| `--ref-p-input-slotted-padding` | — | When slotting a `p-button-pure` or `p-link-pure` this variable needs to be set as `padding` in oder to adjust the alignment correctly. |
|
|
137
|
+
| `--ref-p-input-slotted-margin` | — | When slotting a `p-button-pure` or `p-link-pure` this variable needs to be set as `margin` in oder to adjust the spacings correctly. |
|
|
138
|
+
|
|
139
|
+
## Examples
|
|
140
|
+
|
|
141
|
+
| Example | When to use | File |
|
|
142
|
+
| --- | --- | --- |
|
|
143
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
144
|
+
| Form | The `p-input-tel` can be integrated into a form in two ways: **controlled** or **uncontrolled**, depending on your needs. | [./examples/Form.tsx](./examples/Form.tsx) |
|
|
145
|
+
| Slots | Use named slots when `label`, `description` or `message` need markup such as a link. | [./examples/Slots.tsx](./examples/Slots.tsx) |
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
type InputTextInputEventDetail,
|
|
4
|
+
PInputText,
|
|
5
|
+
type PInputTextProps,
|
|
6
|
+
PText,
|
|
7
|
+
} from '@porsche-design-system/components-react';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
|
|
10
|
+
export const Example = () => {
|
|
11
|
+
const [value, setValue] = useState<PInputTextProps['value']>('');
|
|
12
|
+
|
|
13
|
+
const onInput = (e: CustomEvent<InputTextInputEventDetail>) => {
|
|
14
|
+
const target = e.target as HTMLElement & { value: string };
|
|
15
|
+
|
|
16
|
+
if (target.value.length > 3) {
|
|
17
|
+
const newValue = target.value.slice(0, 3);
|
|
18
|
+
setValue(newValue);
|
|
19
|
+
// The web component doesn't prevent native input, so we must manually reset the input element's value.
|
|
20
|
+
// React won't re-render since setState with the truncated value doesn't trigger a change when it's already set.
|
|
21
|
+
target.value = newValue;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<PInputText
|
|
28
|
+
name="some-name"
|
|
29
|
+
label="Some Label"
|
|
30
|
+
value={value}
|
|
31
|
+
onInput={(e) => onInput(e as CustomEvent<InputTextInputEventDetail>)}
|
|
32
|
+
/>
|
|
33
|
+
<PText>PInputText Value: {value}</PText>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
type InputTextInputEventDetail,
|
|
4
|
+
PButton,
|
|
5
|
+
PInputText,
|
|
6
|
+
type PInputTextProps,
|
|
7
|
+
PText,
|
|
8
|
+
} from '@porsche-design-system/components-react';
|
|
9
|
+
import { FormEvent, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
export const Example = () => {
|
|
12
|
+
const [form, setForm] = useState({ myInputText: '' });
|
|
13
|
+
const [lastSubmittedData, setLastSubmittedData] = useState<any>();
|
|
14
|
+
|
|
15
|
+
const onInput = (e: CustomEvent<InputTextInputEventDetail>) => {
|
|
16
|
+
const { name, value } = e.target as HTMLElement & PInputTextProps;
|
|
17
|
+
setForm((prev) => ({
|
|
18
|
+
...prev,
|
|
19
|
+
[name]: value,
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const onSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
setLastSubmittedData(JSON.stringify(form));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onReset = (e: FormEvent<HTMLFormElement>) => {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
setForm({ myInputText: '' });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<form onSubmit={onSubmit} onReset={onReset} className="flex flex-col gap-fluid-sm">
|
|
36
|
+
<PInputText name="myInputText" label="Some Label" value={form.myInputText} onInput={onInput} />
|
|
37
|
+
<div className="flex gap-fluid-sm">
|
|
38
|
+
<PButton type="submit">Submit</PButton>
|
|
39
|
+
<PButton type="reset">Reset</PButton>
|
|
40
|
+
</div>
|
|
41
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
42
|
+
</form>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonPure, PIcon, PInputText, PPopover } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PInputText state="error">
|
|
8
|
+
<span slot="label">
|
|
9
|
+
Some label with a
|
|
10
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
11
|
+
link
|
|
12
|
+
</a>
|
|
13
|
+
and a "label-after" slot.
|
|
14
|
+
</span>
|
|
15
|
+
<PPopover slot="label-after">
|
|
16
|
+
Some Popover content with a
|
|
17
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
18
|
+
link
|
|
19
|
+
</a>
|
|
20
|
+
.
|
|
21
|
+
</PPopover>
|
|
22
|
+
<span slot="description">
|
|
23
|
+
Some description with a
|
|
24
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
25
|
+
link
|
|
26
|
+
</a>
|
|
27
|
+
.
|
|
28
|
+
</span>
|
|
29
|
+
<PIcon slot="start" name="shopping-cart" color="contrast-medium" aria-hidden={true}></PIcon>
|
|
30
|
+
<PButtonPure slot="end" icon="delete" hideLabel={true} className="p-(--ref-p-input-slotted-padding) m-(--ref-p-input-slotted-margin)" aria={{'aria-label': 'Delete'}}></PButtonPure>
|
|
31
|
+
<span slot="message">
|
|
32
|
+
Some error message with a
|
|
33
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
34
|
+
link
|
|
35
|
+
</a>
|
|
36
|
+
.
|
|
37
|
+
</span>
|
|
38
|
+
</PInputText>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# p-input-text
|
|
2
|
+
|
|
3
|
+
The `p-input-text` component provides a versatile, user‑friendly interface for entering freeform text. It supports direct keyboard input and includes `start` and `end` slots to allow flexible integration of icons, buttons, or other content within the input field.
|
|
4
|
+
|
|
5
|
+
A `label` is a caption which informs the user what information a particular form field is asking for. The `p-input-text` component can be used with or without a label, but it's recommended to keep the label visible for better accessibility whenever possible. When used without a label, it's mandatory to provide a descriptive label text for screen readers.
|
|
6
|
+
|
|
7
|
+
While a `placeholder` is optional but recommended to be set whenever bits of example content or hints shall be shown to give the user visual cues to fill out the form.
|
|
8
|
+
|
|
9
|
+
> **Input Event Handling**
|
|
10
|
+
>
|
|
11
|
+
> React's `onChange` behaves like the native `onInput` (fires on every keystroke). However, our web components follow standard browser behavior, where `onChange` only fires when the input loses focus. To get real-time updates on each keystroke, use `onInput` instead.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
`p-input-text` is intended for freeform text input scenarios. It is suitable for entering names, addresses, or any other non-restricted textual content. It should not be used where semantic or functional input types like numbers, emails, or dates are more appropriate. In such cases, consider using a more specific input type or component optimized for that data. For further guidance, see the [MDN documentation on text inputs](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/text#using_text_inputs).
|
|
16
|
+
|
|
17
|
+
### Do:
|
|
18
|
+
|
|
19
|
+
- Use when freeform text input is required or optional.
|
|
20
|
+
- Use without a label only when the context is clear.
|
|
21
|
+
- Use for validation and error of input.
|
|
22
|
+
- Use asterisk for required fields.
|
|
23
|
+
|
|
24
|
+
### Don't:
|
|
25
|
+
|
|
26
|
+
- Don't use labels with more than two words whenever possible (keep it short and descriptive).
|
|
27
|
+
- Don't use an instructional or description text for the label.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Related Components
|
|
32
|
+
|
|
33
|
+
- [Input Date](../p-input-date/p-input-date.md)
|
|
34
|
+
- [Input Email](../p-input-email/p-input-email.md)
|
|
35
|
+
- [Input Month](../p-input-month/p-input-month.md)
|
|
36
|
+
- [Input Number](../p-input-number/p-input-number.md)
|
|
37
|
+
- [Input Password](../p-input-password/p-input-password.md)
|
|
38
|
+
- [Input Search](../p-input-search/p-input-search.md)
|
|
39
|
+
- [Input Tel](../p-input-tel/p-input-tel.md)
|
|
40
|
+
- [Input Time](../p-input-time/p-input-time.md)
|
|
41
|
+
- [Input Url](../p-input-url/p-input-url.md)
|
|
42
|
+
- [Input Week](../p-input-week/p-input-week.md)
|
|
43
|
+
|
|
44
|
+
## Accessibility support
|
|
45
|
+
|
|
46
|
+
### Keyboard
|
|
47
|
+
|
|
48
|
+
| Key / state | Function |
|
|
49
|
+
| --- | --- |
|
|
50
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
51
|
+
|
|
52
|
+
### ARIA enhancements
|
|
53
|
+
|
|
54
|
+
#### Internal **ARIA** that is managed by the component:
|
|
55
|
+
|
|
56
|
+
| ARIA | Usage |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| `aria-describedby="IDREF"` | Defines the accessible description combined with the status message. |
|
|
59
|
+
| `role="status"`, `role="alert"` | When `message` and `state` or `loading` prop change, the status message is announced. |
|
|
60
|
+
| `aria-hidden="true"` | If `required` attribute is set, the visible asterisk indicator is hidden from assistive technologies. |
|
|
61
|
+
| `aria-invalid="true"` | If `error` state is set. |
|
|
62
|
+
| `aria-live="polite"` | If the `maxlength` attribute is present, the counter is announced via ARIA live region. |
|
|
63
|
+
|
|
64
|
+
## Development considerations
|
|
65
|
+
|
|
66
|
+
### Exposing the `unit` prop
|
|
67
|
+
|
|
68
|
+
The `unit` prop is not exposed to assistive technologies by default. If you provide a `unit` abbreviation, you need to dissolve it in real text through the `description` prop. For example, if you use `kmh`, you can set the `description` prop to `kilometers per hour`. This way, the screen reader will read out the full text.
|
|
69
|
+
|
|
70
|
+
### Disabled state
|
|
71
|
+
|
|
72
|
+
In general, avoid using the `disabled` state. Disabled elements are no longer focusable and may be missed by screen reader users. They can also confuse sighted users if the reason they are disabled is not made clear.
|
|
73
|
+
|
|
74
|
+
### Common do's and don'ts
|
|
75
|
+
|
|
76
|
+
- **Do** keep a persistent label and use helper/description text when additional context is required.
|
|
77
|
+
- **Do** use the component state/message API so validation and status changes are announced.
|
|
78
|
+
- **Do** use clear error wording that helps users recover.
|
|
79
|
+
- **Don't** rely on placeholder text as the only label.
|
|
80
|
+
- **Don't** use `hide-label` without an accessible name.
|
|
81
|
+
|
|
82
|
+
## Limitations
|
|
83
|
+
|
|
84
|
+
Due to the nature of **Web Components** and **shadow DOM**, there are limitations when using some **ARIA** attributes to define relationships between elements across different shadow DOMs or shadow DOM/light DOM combinations.
|
|
85
|
+
|
|
86
|
+
| ARIA | Support |
|
|
87
|
+
| --- | --- |
|
|
88
|
+
| `aria-labelledby` | 🚫 |
|
|
89
|
+
| `aria-describedby` | 🚫 |
|
|
90
|
+
|
|
91
|
+
## API
|
|
92
|
+
|
|
93
|
+
### Properties
|
|
94
|
+
|
|
95
|
+
| Property | Type | Default | Description |
|
|
96
|
+
| --- | --- | --- | --- |
|
|
97
|
+
| `autoComplete` | `string` | `undefined` | Provides the browser with a data type hint to enable relevant autofill suggestions (e.g. `autocomplete='name'`). |
|
|
98
|
+
| `compact` | `boolean` | `false` | Reduces the input height and padding for a more compact layout. |
|
|
99
|
+
| `counter` | `boolean` | `false` | Shows a live character counter below the field indicating how many characters have been entered relative to `maxLength`. |
|
|
100
|
+
| `description` | `string` | `''` | Sets a supplementary description displayed below the label to provide additional context. |
|
|
101
|
+
| `disabled` | `boolean` | `false` | Disables the field, preventing all input. The value is not submitted with the form. |
|
|
102
|
+
| `form` | `string` | `undefined` | Associates the field with a form element by its ID when the field is not nested directly inside it. |
|
|
103
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. |
|
|
104
|
+
| `label` | `string` | `''` | Sets the visible label text displayed above the input field. |
|
|
105
|
+
| `loading` _(experimental)_ | `boolean` | `false` | @experimental Disables the field and displays a loading spinner to indicate an ongoing operation. |
|
|
106
|
+
| `maxLength` | `number` | `undefined` | Sets the maximum number of characters the user can enter. |
|
|
107
|
+
| `message` | `string` | `''` | Sets the validation feedback message displayed below the field when `state` is `success` or `error`. |
|
|
108
|
+
| `minLength` | `number` | `undefined` | Sets the minimum number of characters required for the field to be considered valid. |
|
|
109
|
+
| `name` _(required)_ | `string` | `undefined` | Sets the name submitted with the form data to identify this field's value on the server. |
|
|
110
|
+
| `placeholder` | `string` | `''` | Sets placeholder text shown inside the field when it is empty, to hint at the expected format. |
|
|
111
|
+
| `readOnly` | `boolean` | `false` | Makes the field read-only — the value is displayed but cannot be edited by the user. The value is still submitted with the form. |
|
|
112
|
+
| `required` | `boolean` | `false` | Marks the field as required — form submission is blocked while this field is empty. |
|
|
113
|
+
| `spellCheck` | `boolean` | `undefined` | Controls whether the browser's built-in spell-checking is enabled for this field. |
|
|
114
|
+
| `state` | `'none'` `'error'` `'success'` | `'none'` | Sets the validation state, controlling the visual appearance and style of the feedback message (`none`, `success`, `error`). |
|
|
115
|
+
| `value` | `string | number | null` | `''` | Sets the current text value of the input field. |
|
|
116
|
+
|
|
117
|
+
### Events
|
|
118
|
+
|
|
119
|
+
| Event | Type | Description |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| `blur` | `CustomEvent<InputTextBlurEventDetail>`<br>`Event` | Emitted when the input loses focus, regardless of whether the value changed. |
|
|
122
|
+
| `change` | `CustomEvent<InputTextChangeEventDetail>`<br>`Event` | Emitted when the input loses focus after its value was changed. |
|
|
123
|
+
| `input` | `CustomEvent<InputTextInputEventDetail>`<br>`InputEvent` | Emitted on every value change as the user types. |
|
|
124
|
+
|
|
125
|
+
### Slots
|
|
126
|
+
|
|
127
|
+
| Slot | Required | Allowed tag names | Description |
|
|
128
|
+
| --- | --- | --- | --- |
|
|
129
|
+
| `label` | no | — | Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
130
|
+
| `label-after` | no | — | Places additional content after the label text (for content that should not be part of the label, e.g. external links or `p-popover`). |
|
|
131
|
+
| `description` | no | — | Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
132
|
+
| `message` | no | — | Shows a state message. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
133
|
+
| `start` | no | — | Shows content at the start of the input (e.g. unit prefix). |
|
|
134
|
+
| `end` | no | — | Shows content at the end of the input (e.g. toggle button, unit suffix). |
|
|
135
|
+
|
|
136
|
+
### CSS Variables
|
|
137
|
+
|
|
138
|
+
| CSS Variable | Default | Description |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| `--ref-p-input-slotted-padding` | — | When slotting a `p-button-pure` or `p-link-pure` this variable needs to be set as `padding` in oder to adjust the alignment correctly. |
|
|
141
|
+
| `--ref-p-input-slotted-margin` | — | When slotting a `p-button-pure` or `p-link-pure` this variable needs to be set as `margin` in oder to adjust the spacings correctly. |
|
|
142
|
+
|
|
143
|
+
## Examples
|
|
144
|
+
|
|
145
|
+
| Example | When to use | File |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| Default | Minimal default configuration. | [./examples/Default.tsx](./examples/Default.tsx) |
|
|
148
|
+
| Form | The `p-input-text` can be integrated into a form in two ways: **controlled** or **uncontrolled**, depending on your needs. | [./examples/Form.tsx](./examples/Form.tsx) |
|
|
149
|
+
| Controlled Input (Preventing User Input) | In some cases you may want to fully control the input value (for example to limit or validate user input). | [./examples/Controlled.tsx](./examples/Controlled.tsx) |
|
|
150
|
+
| Slots | Use named slots when `label`, `description` or `message` need markup such as a link. | [./examples/Slots.tsx](./examples/Slots.tsx) |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
type InputTimeInputEventDetail,
|
|
4
|
+
PButton,
|
|
5
|
+
PInputTime,
|
|
6
|
+
type PInputTimeProps,
|
|
7
|
+
PText,
|
|
8
|
+
} from '@porsche-design-system/components-react';
|
|
9
|
+
import { FormEvent, useState } from 'react';
|
|
10
|
+
|
|
11
|
+
export const Example = () => {
|
|
12
|
+
const [form, setForm] = useState({ myInputTime: '' });
|
|
13
|
+
const [lastSubmittedData, setLastSubmittedData] = useState<any>();
|
|
14
|
+
|
|
15
|
+
const onInput = (e: CustomEvent<InputTimeInputEventDetail>) => {
|
|
16
|
+
const { name, value } = e.target as HTMLElement & PInputTimeProps;
|
|
17
|
+
setForm((prev) => ({
|
|
18
|
+
...prev,
|
|
19
|
+
[name]: value,
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const onSubmit = (e: FormEvent<HTMLFormElement>) => {
|
|
24
|
+
e.preventDefault();
|
|
25
|
+
setLastSubmittedData(JSON.stringify(form));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const onReset = (e: FormEvent<HTMLFormElement>) => {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
setForm({ myInputTime: '' });
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<form onSubmit={onSubmit} onReset={onReset} className="flex flex-col gap-fluid-sm">
|
|
36
|
+
<PInputTime name="myInputTime" label="Some Label" value={form.myInputTime} onInput={onInput} />
|
|
37
|
+
<div className="flex gap-fluid-sm">
|
|
38
|
+
<PButton type="submit">Submit</PButton>
|
|
39
|
+
<PButton type="reset">Reset</PButton>
|
|
40
|
+
</div>
|
|
41
|
+
<PText>Last submitted data: {lastSubmittedData}</PText>
|
|
42
|
+
</form>
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PButtonPure, PIcon, PInputTime, PPopover } from '@porsche-design-system/components-react';
|
|
3
|
+
|
|
4
|
+
export const Example = () => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<PInputTime state="error">
|
|
8
|
+
<span slot="label">
|
|
9
|
+
Some label with a
|
|
10
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
11
|
+
link
|
|
12
|
+
</a>
|
|
13
|
+
and a "label-after" slot.
|
|
14
|
+
</span>
|
|
15
|
+
<PPopover slot="label-after">
|
|
16
|
+
Some Popover content with a
|
|
17
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
18
|
+
link
|
|
19
|
+
</a>
|
|
20
|
+
.
|
|
21
|
+
</PPopover>
|
|
22
|
+
<span slot="description">
|
|
23
|
+
Some description with a
|
|
24
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
25
|
+
link
|
|
26
|
+
</a>
|
|
27
|
+
.
|
|
28
|
+
</span>
|
|
29
|
+
<PIcon slot="start" name="shopping-cart" color="contrast-medium" aria-hidden={true}></PIcon>
|
|
30
|
+
<PButtonPure slot="end" icon="delete" hideLabel={true} className="p-(--ref-p-input-slotted-padding) m-(--ref-p-input-slotted-margin)" aria={{'aria-label': 'Delete'}}></PButtonPure>
|
|
31
|
+
<span slot="message">
|
|
32
|
+
Some error message with a
|
|
33
|
+
<a href="https://designsystem.porsche.com" className="underline">
|
|
34
|
+
link
|
|
35
|
+
</a>
|
|
36
|
+
.
|
|
37
|
+
</span>
|
|
38
|
+
</PInputTime>
|
|
39
|
+
</>
|
|
40
|
+
)
|
|
41
|
+
}
|