@porsche-design-system/components-angular 4.5.0-rc.1 → 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 +10 -0
- package/bin/pds-skill.js +259 -0
- package/fesm2022/porsche-design-system-components-angular.mjs.map +1 -1
- package/package.json +5 -2
- package/skill/SKILL.md +124 -0
- package/skill/references/components/p-accordion/examples/Default.ts +26 -0
- package/skill/references/components/p-accordion/examples/InteractiveElementsInSummary.ts +30 -0
- package/skill/references/components/p-accordion/examples/StickySummary.ts +26 -0
- package/skill/references/components/p-accordion/p-accordion.md +95 -0
- package/skill/references/components/p-ai-tag/examples/Default.ts +13 -0
- package/skill/references/components/p-ai-tag/examples/WithinCheckbox.ts +33 -0
- package/skill/references/components/p-ai-tag/examples/WithinFormLabel.ts +40 -0
- package/skill/references/components/p-ai-tag/examples/WithinImage.ts +16 -0
- package/skill/references/components/p-ai-tag/examples/WithinInputSearch.ts +15 -0
- package/skill/references/components/p-ai-tag/examples/WithinRadioGroup.ts +32 -0
- package/skill/references/components/p-ai-tag/examples/WithinTable.ts +94 -0
- package/skill/references/components/p-ai-tag/examples/WithinText.ts +17 -0
- package/skill/references/components/p-ai-tag/p-ai-tag.md +47 -0
- package/skill/references/components/p-banner/examples/Customization.ts +37 -0
- package/skill/references/components/p-banner/examples/Default.ts +26 -0
- package/skill/references/components/p-banner/p-banner.md +92 -0
- package/skill/references/components/p-button/examples/Default.ts +15 -0
- package/skill/references/components/p-button/examples/Form.ts +26 -0
- package/skill/references/components/p-button/examples/FormAttribute.ts +30 -0
- package/skill/references/components/p-button/p-button.md +118 -0
- package/skill/references/components/p-button-pure/examples/CustomClickableArea.ts +15 -0
- package/skill/references/components/p-button-pure/examples/Default.ts +15 -0
- package/skill/references/components/p-button-pure/examples/Form.ts +26 -0
- package/skill/references/components/p-button-pure/examples/FormAttribute.ts +30 -0
- package/skill/references/components/p-button-pure/p-button-pure.md +118 -0
- package/skill/references/components/p-button-tile/examples/ColorScheme.ts +18 -0
- package/skill/references/components/p-button-tile/examples/Default.ts +21 -0
- package/skill/references/components/p-button-tile/examples/FooterSlot.ts +32 -0
- package/skill/references/components/p-button-tile/examples/Hyphens.ts +38 -0
- package/skill/references/components/p-button-tile/examples/UiBehaviour.ts +44 -0
- package/skill/references/components/p-button-tile/p-button-tile.md +115 -0
- package/skill/references/components/p-canvas/examples/Default.ts +13 -0
- package/skill/references/components/p-canvas/p-canvas.md +91 -0
- package/skill/references/components/p-carousel/examples/Default.ts +26 -0
- package/skill/references/components/p-carousel/examples/DynamicSlides.ts +37 -0
- package/skill/references/components/p-carousel/examples/FlexibleWidths.ts +32 -0
- package/skill/references/components/p-carousel/examples/FocusOnCenterSlide.ts +65 -0
- package/skill/references/components/p-carousel/examples/Intl.ts +23 -0
- package/skill/references/components/p-carousel/examples/JumpToSlide.ts +50 -0
- package/skill/references/components/p-carousel/p-carousel.md +142 -0
- package/skill/references/components/p-checkbox/examples/Default.ts +13 -0
- package/skill/references/components/p-checkbox/examples/Form.ts +31 -0
- package/skill/references/components/p-checkbox/examples/Indeterminate.ts +16 -0
- package/skill/references/components/p-checkbox/examples/Slots.ts +57 -0
- package/skill/references/components/p-checkbox/examples/WrappedLabel.ts +27 -0
- package/skill/references/components/p-checkbox/p-checkbox.md +122 -0
- package/skill/references/components/p-crest/examples/CustomClickableArea.ts +13 -0
- package/skill/references/components/p-crest/examples/Default.ts +13 -0
- package/skill/references/components/p-crest/examples/Link.ts +13 -0
- package/skill/references/components/p-crest/p-crest.md +65 -0
- package/skill/references/components/p-display/examples/Color.ts +15 -0
- package/skill/references/components/p-display/examples/Default.ts +15 -0
- package/skill/references/components/p-display/examples/Semantics.ts +21 -0
- package/skill/references/components/p-display/examples/Size.ts +15 -0
- package/skill/references/components/p-display/examples/SizeResponsive.ts +15 -0
- package/skill/references/components/p-display/p-display.md +78 -0
- package/skill/references/components/p-divider/examples/Default.ts +13 -0
- package/skill/references/components/p-divider/examples/Responsive.ts +15 -0
- package/skill/references/components/p-divider/examples/Vertical.ts +15 -0
- package/skill/references/components/p-divider/p-divider.md +49 -0
- package/skill/references/components/p-drilldown/examples/CustomContent.ts +166 -0
- package/skill/references/components/p-drilldown/examples/Default.ts +119 -0
- package/skill/references/components/p-drilldown/p-drilldown.md +168 -0
- package/skill/references/components/p-fieldset/examples/Default.ts +15 -0
- package/skill/references/components/p-fieldset/examples/Required.ts +16 -0
- package/skill/references/components/p-fieldset/examples/SlottedLabel.ts +18 -0
- package/skill/references/components/p-fieldset/examples/SlottedMessage.ts +18 -0
- package/skill/references/components/p-fieldset/p-fieldset.md +88 -0
- package/skill/references/components/p-flag/examples/Default.ts +13 -0
- package/skill/references/components/p-flag/examples/ResponsiveSize.ts +13 -0
- package/skill/references/components/p-flag/examples/Size.ts +16 -0
- package/skill/references/components/p-flag/examples/SizeCssVar.ts +13 -0
- package/skill/references/components/p-flag/p-flag.md +68 -0
- package/skill/references/components/p-flyout/examples/CustomStyling.ts +47 -0
- package/skill/references/components/p-flyout/examples/Default.ts +44 -0
- package/skill/references/components/p-flyout/examples/Form.ts +47 -0
- package/skill/references/components/p-flyout/examples/StickyTop.ts +44 -0
- package/skill/references/components/p-flyout/p-flyout.md +128 -0
- package/skill/references/components/p-heading/examples/Color.ts +15 -0
- package/skill/references/components/p-heading/examples/Default.ts +15 -0
- package/skill/references/components/p-heading/examples/Semantics.ts +21 -0
- package/skill/references/components/p-heading/p-heading.md +78 -0
- package/skill/references/components/p-icon/examples/Color.ts +16 -0
- package/skill/references/components/p-icon/examples/ColorCssVar.ts +13 -0
- package/skill/references/components/p-icon/examples/Custom.ts +13 -0
- package/skill/references/components/p-icon/examples/Default.ts +13 -0
- package/skill/references/components/p-icon/examples/Overview.ts +591 -0
- package/skill/references/components/p-icon/examples/ResponsiveSize.ts +13 -0
- package/skill/references/components/p-icon/examples/Size.ts +16 -0
- package/skill/references/components/p-icon/examples/SizeCssVar.ts +13 -0
- package/skill/references/components/p-icon/p-icon.md +88 -0
- package/skill/references/components/p-inline-notification/examples/ActionButton.ts +29 -0
- package/skill/references/components/p-inline-notification/examples/Default.ts +13 -0
- package/skill/references/components/p-inline-notification/examples/EventHandling.ts +31 -0
- package/skill/references/components/p-inline-notification/p-inline-notification.md +74 -0
- package/skill/references/components/p-input-date/examples/Default.ts +13 -0
- package/skill/references/components/p-input-date/examples/Form.ts +31 -0
- package/skill/references/components/p-input-date/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-date/p-input-date.md +138 -0
- package/skill/references/components/p-input-email/examples/Default.ts +13 -0
- package/skill/references/components/p-input-email/examples/Form.ts +31 -0
- package/skill/references/components/p-input-email/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-email/p-input-email.md +142 -0
- package/skill/references/components/p-input-month/examples/Default.ts +13 -0
- package/skill/references/components/p-input-month/examples/Form.ts +31 -0
- package/skill/references/components/p-input-month/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-month/p-input-month.md +138 -0
- package/skill/references/components/p-input-number/examples/Default.ts +13 -0
- package/skill/references/components/p-input-number/examples/Form.ts +31 -0
- package/skill/references/components/p-input-number/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-number/p-input-number.md +146 -0
- package/skill/references/components/p-input-password/examples/Default.ts +13 -0
- package/skill/references/components/p-input-password/examples/Form.ts +31 -0
- package/skill/references/components/p-input-password/examples/Slots.ts +42 -0
- package/skill/references/components/p-input-password/examples/Toggle.ts +13 -0
- package/skill/references/components/p-input-password/p-input-password.md +141 -0
- package/skill/references/components/p-input-search/examples/AriaCombobox.ts +38 -0
- package/skill/references/components/p-input-search/examples/Default.ts +13 -0
- package/skill/references/components/p-input-search/examples/Form.ts +31 -0
- package/skill/references/components/p-input-search/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-search/p-input-search.md +178 -0
- package/skill/references/components/p-input-tel/examples/Default.ts +13 -0
- package/skill/references/components/p-input-tel/examples/Form.ts +31 -0
- package/skill/references/components/p-input-tel/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-tel/p-input-tel.md +141 -0
- package/skill/references/components/p-input-text/examples/Controlled.ts +36 -0
- package/skill/references/components/p-input-text/examples/Default.ts +13 -0
- package/skill/references/components/p-input-text/examples/Form.ts +31 -0
- package/skill/references/components/p-input-text/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-text/p-input-text.md +146 -0
- package/skill/references/components/p-input-time/examples/Default.ts +13 -0
- package/skill/references/components/p-input-time/examples/Form.ts +31 -0
- package/skill/references/components/p-input-time/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-time/p-input-time.md +140 -0
- package/skill/references/components/p-input-url/examples/Default.ts +13 -0
- package/skill/references/components/p-input-url/examples/Form.ts +31 -0
- package/skill/references/components/p-input-url/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-url/p-input-url.md +141 -0
- package/skill/references/components/p-input-week/examples/Default.ts +13 -0
- package/skill/references/components/p-input-week/examples/Form.ts +31 -0
- package/skill/references/components/p-input-week/examples/Slots.ts +44 -0
- package/skill/references/components/p-input-week/p-input-week.md +138 -0
- package/skill/references/components/p-link/examples/Default.ts +15 -0
- package/skill/references/components/p-link/examples/FrameworkRouting.ts +17 -0
- package/skill/references/components/p-link/examples/Icon.ts +20 -0
- package/skill/references/components/p-link/p-link.md +101 -0
- package/skill/references/components/p-link-pure/examples/CustomClickableArea.ts +15 -0
- package/skill/references/components/p-link-pure/examples/Default.ts +15 -0
- package/skill/references/components/p-link-pure/examples/FrameworkRouting.ts +17 -0
- package/skill/references/components/p-link-pure/examples/Icon.ts +20 -0
- package/skill/references/components/p-link-pure/p-link-pure.md +110 -0
- package/skill/references/components/p-link-tile/examples/ColorScheme.ts +18 -0
- package/skill/references/components/p-link-tile/examples/Default.ts +21 -0
- package/skill/references/components/p-link-tile/examples/FooterSlot.ts +32 -0
- package/skill/references/components/p-link-tile/examples/Hyphens.ts +39 -0
- package/skill/references/components/p-link-tile/examples/UiBehaviour.ts +44 -0
- package/skill/references/components/p-link-tile/examples/WithVideo.ts +18 -0
- package/skill/references/components/p-link-tile/p-link-tile.md +105 -0
- package/skill/references/components/p-link-tile-product/examples/Default.ts +24 -0
- package/skill/references/components/p-link-tile-product/examples/FrameworkRouting.ts +27 -0
- package/skill/references/components/p-link-tile-product/p-link-tile-product.md +93 -0
- package/skill/references/components/p-modal/examples/AlertDialog.ts +41 -0
- package/skill/references/components/p-modal/examples/CustomStyling.ts +28 -0
- package/skill/references/components/p-modal/examples/Default.ts +41 -0
- package/skill/references/components/p-modal/examples/Scrollable.ts +45 -0
- package/skill/references/components/p-modal/p-modal.md +135 -0
- package/skill/references/components/p-model-signature/examples/CustomStyling.ts +17 -0
- package/skill/references/components/p-model-signature/examples/Default.ts +13 -0
- package/skill/references/components/p-model-signature/examples/MaskBlendMode.ts +35 -0
- package/skill/references/components/p-model-signature/examples/MaskImage.ts +15 -0
- package/skill/references/components/p-model-signature/examples/MaskVideo.ts +15 -0
- package/skill/references/components/p-model-signature/examples/SafeZone.ts +63 -0
- package/skill/references/components/p-model-signature/p-model-signature.md +62 -0
- package/skill/references/components/p-multi-select/examples/AsyncFilter.ts +149 -0
- package/skill/references/components/p-multi-select/examples/Default.ts +32 -0
- package/skill/references/components/p-multi-select/examples/Form.ts +38 -0
- package/skill/references/components/p-multi-select/examples/Optgroups.ts +45 -0
- package/skill/references/components/p-multi-select/examples/SelectedSlot.ts +103 -0
- package/skill/references/components/p-multi-select/examples/SetValue.ts +76 -0
- package/skill/references/components/p-multi-select/examples/Slots.ts +51 -0
- package/skill/references/components/p-multi-select/p-multi-select.md +197 -0
- package/skill/references/components/p-pagination/examples/Default.ts +13 -0
- package/skill/references/components/p-pagination/p-pagination.md +83 -0
- package/skill/references/components/p-pin-code/examples/CopyPaste.ts +13 -0
- package/skill/references/components/p-pin-code/examples/Default.ts +13 -0
- package/skill/references/components/p-pin-code/examples/Form.ts +31 -0
- package/skill/references/components/p-pin-code/examples/Slots.ts +42 -0
- package/skill/references/components/p-pin-code/p-pin-code.md +109 -0
- package/skill/references/components/p-popover/examples/Default.ts +17 -0
- package/skill/references/components/p-popover/examples/SlottedButton.ts +18 -0
- package/skill/references/components/p-popover/p-popover.md +116 -0
- package/skill/references/components/p-radio-group/examples/Default.ts +20 -0
- package/skill/references/components/p-radio-group/examples/Form.ts +38 -0
- package/skill/references/components/p-radio-group/examples/Slots.ts +72 -0
- package/skill/references/components/p-radio-group/p-radio-group.md +157 -0
- package/skill/references/components/p-scroller/examples/Default.ts +54 -0
- package/skill/references/components/p-scroller/examples/Height.ts +29 -0
- package/skill/references/components/p-scroller/examples/ScrollToPosition.ts +43 -0
- package/skill/references/components/p-scroller/p-scroller.md +93 -0
- package/skill/references/components/p-segmented-control/examples/Default.ts +29 -0
- package/skill/references/components/p-segmented-control/examples/Form.ts +37 -0
- package/skill/references/components/p-segmented-control/examples/Slots.ts +57 -0
- package/skill/references/components/p-segmented-control/examples/WithLabels.ts +29 -0
- package/skill/references/components/p-segmented-control/p-segmented-control.md +162 -0
- package/skill/references/components/p-select/examples/AsyncFilter.ts +149 -0
- package/skill/references/components/p-select/examples/Default.ts +32 -0
- package/skill/references/components/p-select/examples/Form.ts +38 -0
- package/skill/references/components/p-select/examples/Optgroups.ts +45 -0
- package/skill/references/components/p-select/examples/Required.ts +48 -0
- package/skill/references/components/p-select/examples/SelectedSlot.ts +130 -0
- package/skill/references/components/p-select/examples/SetValue.ts +71 -0
- package/skill/references/components/p-select/examples/Slots.ts +51 -0
- package/skill/references/components/p-select/examples/SlottedImages.ts +38 -0
- package/skill/references/components/p-select/p-select.md +194 -0
- package/skill/references/components/p-sheet/examples/Default.ts +33 -0
- package/skill/references/components/p-sheet/p-sheet.md +121 -0
- package/skill/references/components/p-spinner/examples/Color.ts +16 -0
- package/skill/references/components/p-spinner/examples/ColorCssVar.ts +13 -0
- package/skill/references/components/p-spinner/examples/Default.ts +13 -0
- package/skill/references/components/p-spinner/examples/ResponsiveSize.ts +13 -0
- package/skill/references/components/p-spinner/examples/Size.ts +16 -0
- package/skill/references/components/p-spinner/examples/SizeCssVar.ts +13 -0
- package/skill/references/components/p-spinner/p-spinner.md +96 -0
- package/skill/references/components/p-stepper-horizontal/examples/Default.ts +26 -0
- package/skill/references/components/p-stepper-horizontal/examples/FrameworkImplementation.ts +107 -0
- package/skill/references/components/p-stepper-horizontal/p-stepper-horizontal.md +109 -0
- package/skill/references/components/p-switch/examples/Default.ts +21 -0
- package/skill/references/components/p-switch/p-switch.md +103 -0
- package/skill/references/components/p-table/examples/Advanced.ts +162 -0
- package/skill/references/components/p-table/examples/CaptionProperty.ts +40 -0
- package/skill/references/components/p-table/examples/CaptionSlot.ts +43 -0
- package/skill/references/components/p-table/examples/Default.ts +120 -0
- package/skill/references/components/p-table/examples/HideLabel.ts +40 -0
- package/skill/references/components/p-table/examples/LayoutFixed.ts +53 -0
- package/skill/references/components/p-table/examples/Sorting.ts +79 -0
- package/skill/references/components/p-table/p-table.md +189 -0
- package/skill/references/components/p-tabs/examples/ActiveTab.ts +29 -0
- package/skill/references/components/p-tabs/examples/Default.ts +29 -0
- package/skill/references/components/p-tabs/examples/Gradient.ts +114 -0
- package/skill/references/components/p-tabs/examples/Labelling.ts +29 -0
- package/skill/references/components/p-tabs/p-tabs.md +136 -0
- package/skill/references/components/p-tabs-bar/examples/Default.ts +29 -0
- package/skill/references/components/p-tabs-bar/examples/Gradient.ts +80 -0
- package/skill/references/components/p-tabs-bar/examples/Labelling.ts +29 -0
- package/skill/references/components/p-tabs-bar/examples/Links.ts +23 -0
- package/skill/references/components/p-tabs-bar/p-tabs-bar.md +181 -0
- package/skill/references/components/p-tag/examples/Default.ts +15 -0
- package/skill/references/components/p-tag/examples/Multiline.ts +17 -0
- package/skill/references/components/p-tag/examples/SlottedButton.ts +44 -0
- package/skill/references/components/p-tag/examples/SlottedLink.ts +44 -0
- package/skill/references/components/p-tag/p-tag.md +66 -0
- package/skill/references/components/p-tag-dismissible/examples/Default.ts +15 -0
- package/skill/references/components/p-tag-dismissible/p-tag-dismissible.md +75 -0
- package/skill/references/components/p-text/examples/Default.ts +15 -0
- package/skill/references/components/p-text/examples/Semantics.ts +21 -0
- package/skill/references/components/p-text/examples/Size.ts +15 -0
- package/skill/references/components/p-text/examples/SizeResponsive.ts +15 -0
- package/skill/references/components/p-text/p-text.md +68 -0
- package/skill/references/components/p-text-list/examples/Default.ts +31 -0
- package/skill/references/components/p-text-list/p-text-list.md +68 -0
- package/skill/references/components/p-textarea/examples/Default.ts +13 -0
- package/skill/references/components/p-textarea/examples/Form.ts +31 -0
- package/skill/references/components/p-textarea/examples/Slots.ts +42 -0
- package/skill/references/components/p-textarea/p-textarea.md +122 -0
- package/skill/references/components/p-toast/examples/Default.ts +23 -0
- package/skill/references/components/p-toast/p-toast.md +61 -0
- package/skill/references/components/p-wordmark/examples/CustomClickableArea.ts +13 -0
- package/skill/references/components/p-wordmark/examples/Default.ts +13 -0
- package/skill/references/components/p-wordmark/examples/Size.ts +13 -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/types/porsche-design-system-components-angular.d.ts +2 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'porsche-design-system-app',
|
|
7
|
+
template: `
|
|
8
|
+
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="flex flex-col gap-fluid-sm">
|
|
9
|
+
<p-pin-code formControlName="myPinCode" [label]="'Some Label'" />
|
|
10
|
+
<div class="flex gap-fluid-sm">
|
|
11
|
+
<p-button type="submit">Submit</p-button>
|
|
12
|
+
<p-button type="reset">Reset</p-button>
|
|
13
|
+
</div>
|
|
14
|
+
<p-text>Last submitted data: {{ submittedValue }}</p-text>
|
|
15
|
+
</form>
|
|
16
|
+
`,
|
|
17
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [PorscheDesignSystemModule, FormsModule, ReactiveFormsModule], // <-- PDS module is imported here
|
|
20
|
+
})
|
|
21
|
+
export class ExampleComponent {
|
|
22
|
+
form = new FormGroup({
|
|
23
|
+
myPinCode: new FormControl<string>(''),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
submittedValue: any = undefined;
|
|
27
|
+
|
|
28
|
+
onSubmit(): void {
|
|
29
|
+
this.submittedValue = JSON.stringify(this.form.value);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'porsche-design-system-app',
|
|
6
|
+
template: `
|
|
7
|
+
<p-pin-code state="error">
|
|
8
|
+
<span slot="label" id="some-label-id">
|
|
9
|
+
Some label with a
|
|
10
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
11
|
+
link
|
|
12
|
+
</a>
|
|
13
|
+
and a "label-after" slot.
|
|
14
|
+
</span>
|
|
15
|
+
<p-popover slot="label-after">
|
|
16
|
+
Some Popover content with a
|
|
17
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
18
|
+
link
|
|
19
|
+
</a>
|
|
20
|
+
.
|
|
21
|
+
</p-popover>
|
|
22
|
+
<span slot="description" id="some-description-id">
|
|
23
|
+
Some description with a
|
|
24
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
25
|
+
link
|
|
26
|
+
</a>
|
|
27
|
+
.
|
|
28
|
+
</span>
|
|
29
|
+
<span slot="message" id="some-message-id">
|
|
30
|
+
Some error message with a
|
|
31
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
32
|
+
link
|
|
33
|
+
</a>
|
|
34
|
+
.
|
|
35
|
+
</span>
|
|
36
|
+
</p-pin-code>
|
|
37
|
+
`,
|
|
38
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [PorscheDesignSystemModule], // <-- PDS module is imported here
|
|
41
|
+
})
|
|
42
|
+
export class ExampleComponent {}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# p-pin-code
|
|
2
|
+
|
|
3
|
+
The `p-pin-code` component is optimized for entering sequences of digits. The most common use case is for entering one-time-passwords (OTP) or pin codes. The input fields allow only one digit at a time. When a digit is entered, the focus shifts automatically to the next input, until every input is filled.
|
|
4
|
+
|
|
5
|
+
A few things to note:
|
|
6
|
+
|
|
7
|
+
- Only digits can be entered.
|
|
8
|
+
- Only one digit can be entered per input.
|
|
9
|
+
- Pressing `Delete` or `Backspace`: If the focussed input is blank and `Delete`/`Backspace` is pressed the focus transfers to the next/previous input, and clears the value of the next/previous input (if any). This avoids the need to explicitly `Shift+Tab & Delete`/ `Tab & Backspace`.
|
|
10
|
+
|
|
11
|
+
A `label` is a caption which informs the user what information a particular form field is asking for. The `p-pin-code` 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 best practice to provide a descriptive label text for screen readers.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Do:
|
|
16
|
+
|
|
17
|
+
- Use description text to explain the purpose or context of the `p-pin-code` component.
|
|
18
|
+
- Use either 4 or 6 fields in the `p-pin-code` component based on your specific use case and security requirements.
|
|
19
|
+
- Since only digits can be entered, use for digit codes only.
|
|
20
|
+
- Use type `number` for numeric input or `password` for secure input depending on your application's needs.
|
|
21
|
+
- Use the component's built-in support for inline validation.
|
|
22
|
+
- Use consideration when implementing the component's behavior in a loading state to ensure it remains usable and responsive during data retrieval or processing.
|
|
23
|
+
- If the `p-pin-code` component is isolated e.g. used with only one button use the loading state on the button. This ensures a consistent and intuitive user experience.
|
|
24
|
+
|
|
25
|
+
### Don't:
|
|
26
|
+
|
|
27
|
+
- Don't make the description text overly complex. Keep it concise and focused on clarifying the component's purpose.
|
|
28
|
+
- Don't use the wrong field type for your use case. Ensure that type `number` or `password` aligns with the kind of input expected from users.
|
|
29
|
+
|
|
30
|
+
## Accessibility support
|
|
31
|
+
|
|
32
|
+
### Keyboard
|
|
33
|
+
|
|
34
|
+
| Key / state | Function |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
37
|
+
|
|
38
|
+
### ARIA enhancements
|
|
39
|
+
|
|
40
|
+
#### Internal **ARIA** that is managed by the component:
|
|
41
|
+
|
|
42
|
+
| ARIA | Usage |
|
|
43
|
+
| --- | --- |
|
|
44
|
+
| `aria-label="STRING"` | References the current position of the input group. |
|
|
45
|
+
| `aria-describedby="IDREF"` | References the accessible description and status messages. |
|
|
46
|
+
| `role="status"`, `role="alert"` | When `message` and `state` or `loading` prop change, the status message is announced. |
|
|
47
|
+
|
|
48
|
+
## Development considerations
|
|
49
|
+
|
|
50
|
+
### Disabled state
|
|
51
|
+
|
|
52
|
+
In general, avoid using the `disabled="true"` 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.
|
|
53
|
+
|
|
54
|
+
### Common do's and don'ts
|
|
55
|
+
|
|
56
|
+
- **Do** provide a clear `label` that describes what the code is for.
|
|
57
|
+
- **Do** use `description` to explain where users can find the code.
|
|
58
|
+
- **Do** use the component state/message API so validation and status changes are announced.
|
|
59
|
+
- **Don't** use `hide-label` without an accessible name.
|
|
60
|
+
|
|
61
|
+
## API
|
|
62
|
+
|
|
63
|
+
### Properties
|
|
64
|
+
|
|
65
|
+
| Property | Type | Default | Description |
|
|
66
|
+
| --- | --- | --- | --- |
|
|
67
|
+
| `compact` | `boolean` | `false` | Reduces the pin code field height and spacing for use in dense layouts where vertical space is limited. |
|
|
68
|
+
| `description` | `string` | `''` | Sets a supplementary description displayed below the label to give users additional guidance about the pin code. |
|
|
69
|
+
| `disabled` | `boolean` | `false` | Prevents user interaction with all pin code fields and blocks events while the component is disabled. |
|
|
70
|
+
| `form` | `string` | `undefined` | Associates the pin code with a form element by its ID when it is not a direct descendant of that form. |
|
|
71
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label and description while keeping them accessible to screen readers. Supports responsive breakpoint values. |
|
|
72
|
+
| `label` | `string` | `''` | Sets the visible label text displayed above the pin code fields to identify their purpose. |
|
|
73
|
+
| `length` | `1` `2` `3` `4` `5` `6` | `4` | Sets the number of individual input fields rendered, determining how many characters the pin code consists of. |
|
|
74
|
+
| `loading` | `boolean` | `false` | Disables the pin code fields and shows a loading spinner to indicate an ongoing background operation. |
|
|
75
|
+
| `message` | `string` | `''` | Sets the validation feedback message displayed below the pin code when `state` is `success` or `error`. |
|
|
76
|
+
| `name` | `string` | `undefined` | Sets the name of the control submitted with the form data to identify the pin code value on the server. |
|
|
77
|
+
| `required` | `boolean` | `false` | Marks the pin code as required so the form cannot be submitted until all fields are filled. |
|
|
78
|
+
| `state` | `'none'` `'error'` `'success'` | `'none'` | Sets the validation state of the pin code, which controls its visual appearance and feedback message style (`none`, `success`, `error`). |
|
|
79
|
+
| `type` | `'number'` `'password'` | `'number'` | Controls whether the individual input fields mask their content as password dots (`password`) or show digits (`number`). |
|
|
80
|
+
| `value` | `string` | `''` | Sets the current concatenated value of all pin code fields and allows setting the initial value. |
|
|
81
|
+
|
|
82
|
+
### Events
|
|
83
|
+
|
|
84
|
+
| Event | Type | Description |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| `blur` | `CustomEvent<void>` | Emitted when the pin code component loses focus after the user finishes entering characters. |
|
|
87
|
+
| `change` | `CustomEvent<PinCodeChangeEventDetail>`<br>`{ value: string; isComplete: boolean }` | Emitted when the pin code value changes as the user types, carrying the new concatenated value in the event detail. |
|
|
88
|
+
|
|
89
|
+
### Controlled properties
|
|
90
|
+
|
|
91
|
+
- `value` — a controlled prop, but the component also updates it internally. Listen for the `change` event to observe changes; you do not have to write the value back.
|
|
92
|
+
|
|
93
|
+
### Slots
|
|
94
|
+
|
|
95
|
+
| Slot | Required | Allowed tag names | Description |
|
|
96
|
+
| --- | --- | --- | --- |
|
|
97
|
+
| `label` | no | — | Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
98
|
+
| `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`). |
|
|
99
|
+
| `description` | no | — | Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
100
|
+
| `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. |
|
|
101
|
+
|
|
102
|
+
## Examples
|
|
103
|
+
|
|
104
|
+
| Example | When to use | File |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| Default | Minimal default configuration. | [./examples/Default.ts](./examples/Default.ts) |
|
|
107
|
+
| Form | The `p-pin-code` can be integrated into a form in two ways: **controlled** or **uncontrolled**, depending on your needs. | [./examples/Form.ts](./examples/Form.ts) |
|
|
108
|
+
| Copy+Paste and autocomplete | By default, only one input can be changed at a time. | [./examples/CopyPaste.ts](./examples/CopyPaste.ts) |
|
|
109
|
+
| Slots | Use named slots when `label`, `description` or `message` need markup such as a link. | [./examples/Slots.ts](./examples/Slots.ts) |
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'porsche-design-system-app',
|
|
6
|
+
template: `
|
|
7
|
+
<p-popover>
|
|
8
|
+
<p-text>
|
|
9
|
+
Some additional content.
|
|
10
|
+
</p-text>
|
|
11
|
+
</p-popover>
|
|
12
|
+
`,
|
|
13
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
14
|
+
standalone: true,
|
|
15
|
+
imports: [PorscheDesignSystemModule], // <-- PDS module is imported here
|
|
16
|
+
})
|
|
17
|
+
export class ExampleComponent {}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'porsche-design-system-app',
|
|
6
|
+
template: `
|
|
7
|
+
<p-popover>
|
|
8
|
+
<p-button slot="button">
|
|
9
|
+
More information
|
|
10
|
+
</p-button>
|
|
11
|
+
Some additional content.
|
|
12
|
+
</p-popover>
|
|
13
|
+
`,
|
|
14
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
15
|
+
standalone: true,
|
|
16
|
+
imports: [PorscheDesignSystemModule], // <-- PDS module is imported here
|
|
17
|
+
})
|
|
18
|
+
export class ExampleComponent {}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# p-popover
|
|
2
|
+
|
|
3
|
+
The `p-popover` component displays additional contextual content in an overlay and should be used when users need optional details without leaving their current context. It is triggered by a button and renders its own info button by default, or you can provide a custom trigger via the `button` slot.
|
|
4
|
+
|
|
5
|
+
By default, the Popover works **uncontrolled**: it manages its own visibility and toggles open or closed when its info button (or a slotted trigger) is clicked. It is dismissed on outside click, on `Escape`, or when keyboard focus leaves the Popover.
|
|
6
|
+
|
|
7
|
+
Alternatively, the Popover can be used in a **controlled** mode by setting the `open` prop together with a slotted `button` (the default info button does not toggle in this mode). In this mode you own the open state: the Popover only emits the `dismiss` event when the user requests to close it (via `Escape`, an outside click or when keyboard focus leaves the Popover), and you decide whether to update `open` in response.
|
|
8
|
+
|
|
9
|
+
**Hint:** The `p-popover` utilizes the [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) and gets rendered on the `#top-layer` which enables it to be shown correctly even when used e.g. within a scroll container.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Do:
|
|
14
|
+
|
|
15
|
+
- Use it to display additional information that is not necessary for task completion or to provide further explanation about a workflow.
|
|
16
|
+
- Position popovers in a way that they do not block related content.
|
|
17
|
+
- Choose a preferred direction in which the popover should open, or it will automatically open in the direction with the most available space.
|
|
18
|
+
- Use it consistently throughout your site.
|
|
19
|
+
|
|
20
|
+
### Don't:
|
|
21
|
+
|
|
22
|
+
- Don't use for content that can be displayed directly.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## References
|
|
27
|
+
|
|
28
|
+
Nielsen Norman Group [Tooltip Guidelines](https://nngroup.com/articles/tooltip-guidelines)
|
|
29
|
+
|
|
30
|
+
## Accessibility support
|
|
31
|
+
|
|
32
|
+
### Keyboard
|
|
33
|
+
|
|
34
|
+
| Key / state | Function |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
37
|
+
| `Enter`, `Space` | - Opens/closes the popover. |
|
|
38
|
+
|
|
39
|
+
### ARIA enhancements
|
|
40
|
+
|
|
41
|
+
#### External **ARIA** provided by the `aria` property:
|
|
42
|
+
|
|
43
|
+
| ARIA | Usage |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `aria-label` | Defines a string value that labels the interactive element. |
|
|
46
|
+
|
|
47
|
+
#### Internal **ARIA** that is managed by the component:
|
|
48
|
+
|
|
49
|
+
| ARIA | Usage |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `aria-expanded="BOOLEAN"` | Indicates that the popover element is displayed/hidden. |
|
|
52
|
+
| `aria-details="IDREF"` | References the element that provides additional information about the popover. |
|
|
53
|
+
|
|
54
|
+
## Development considerations
|
|
55
|
+
|
|
56
|
+
In **uncontrolled** mode the `p-popover` component does not manage `aria-expanded` on a custom slotted button, because it does not expose its internal `open` state publicly. In this case the default info button (which the component fully controls) already exposes `aria-expanded` for you.
|
|
57
|
+
|
|
58
|
+
In **controlled** mode the consumer owns the `open` state, so the slotted trigger *can* (and should) expose `aria-expanded` to match the default button's semantics. Bind it to your `open` state via the trigger's `aria` property, e.g. `aria={{ 'aria-expanded': open ? 'true' : 'false' }}`, so it stays in sync as the popover opens and closes.
|
|
59
|
+
|
|
60
|
+
### Common do's and don'ts
|
|
61
|
+
|
|
62
|
+
- **Do** prefer the built-in popover trigger when possible so `aria-expanded` is managed internally.
|
|
63
|
+
- **Do** provide an accessible name on a custom slotted button when you cannot use the default trigger.
|
|
64
|
+
- **Do** pass additional ARIA via the `aria` prop when the default labeling is not sufficient.
|
|
65
|
+
- **Don't** use an unnamed custom slotted trigger button.
|
|
66
|
+
- **Don't** add native `aria-*` attributes directly on the component host.
|
|
67
|
+
|
|
68
|
+
## API
|
|
69
|
+
|
|
70
|
+
### Properties
|
|
71
|
+
|
|
72
|
+
| Property | Type | Default | Description |
|
|
73
|
+
| --- | --- | --- | --- |
|
|
74
|
+
| `aria` | `PopoverAriaAttribute` | `undefined` | Sets ARIA attributes on the popover panel to improve accessibility for screen readers. |
|
|
75
|
+
| `compact` | `boolean` | `undefined` | Reduces padding and spacing for a more compact layout, useful in space-constrained interfaces. |
|
|
76
|
+
| `description` | `string` | `undefined` | Sets the text content displayed inside the popover panel when it is open, providing contextual help or information. Takes precedence over the default slot when both are provided. |
|
|
77
|
+
| `direction` | `'top'` `'right'` `'bottom'` `'left'` | `'bottom'` | Sets the preferred direction for the popover to open relative to its trigger button. Falls back to the direction with the most available viewport space. |
|
|
78
|
+
| `open` | `boolean` | `undefined` | Controls whether the popover is visible. When set (controlled mode), visibility follows this prop and the consumer owns the open state via a slotted `button`. When omitted (uncontrolled mode), the component manages visibility itself. |
|
|
79
|
+
|
|
80
|
+
### Events
|
|
81
|
+
|
|
82
|
+
| Event | Type | Description |
|
|
83
|
+
| --- | --- | --- |
|
|
84
|
+
| `dismiss` | `CustomEvent<void>` | Emitted in controlled mode when the user requests to close the popover via the Escape key, an outside click, or when keyboard focus leaves the popover (Tab / Shift+Tab). |
|
|
85
|
+
|
|
86
|
+
### Controlled properties
|
|
87
|
+
|
|
88
|
+
- `open` — a controlled prop: the component does **not** update it itself. Handle the `dismiss` event and assign the new value to `open` yourself, or the change will not take effect.
|
|
89
|
+
|
|
90
|
+
### Slots
|
|
91
|
+
|
|
92
|
+
| Slot | Required | Allowed tag names | Description |
|
|
93
|
+
| --- | --- | --- | --- |
|
|
94
|
+
| _(default)_ | no | — | Default slot for the popover content. Ignored when the `description` prop is set, which takes precedence. |
|
|
95
|
+
| `button` | no | — | Renders a custom trigger button. When used, the default info button is replaced. |
|
|
96
|
+
|
|
97
|
+
### CSS Variables
|
|
98
|
+
|
|
99
|
+
| CSS Variable | Default | Description |
|
|
100
|
+
| --- | --- | --- |
|
|
101
|
+
| `--p-popover-w` | `max-content` | Width of the popover. |
|
|
102
|
+
| `--p-popover-h` | `auto` | Height of the popover. |
|
|
103
|
+
| `--p-popover-min-w` | `0px` | Min width of the popover. |
|
|
104
|
+
| `--p-popover-min-h` | `auto` | Min height of the popover. |
|
|
105
|
+
| `--p-popover-max-w` | `min(calc(100dvw - 16px), 48ch)` | Max width of the popover. |
|
|
106
|
+
| `--p-popover-max-h` | `calc(100dvh - 16px)` | Max height of the popover. |
|
|
107
|
+
| `--p-popover-px` | `16px` | Horizontal padding of the popover. It is recommended to apply an existing Porsche Design System spacing token, e.g. the CSS declaration `--p-popover-px: var(--p-spacing-static-md)`, the Tailwind CSS arbitrary property `[--p-popover-px:var(--spacing-static-md)]` or the equivalent SCSS/JS token. |
|
|
108
|
+
| `--p-popover-py` | `16px` | Vertical padding of the popover. It is recommended to apply an existing Porsche Design System spacing token, e.g. the CSS declaration `--p-popover-py: var(--p-spacing-static-sm)`, the Tailwind CSS arbitrary property `[--p-popover-py:var(--spacing-static-sm)]` or the equivalent SCSS/JS token. |
|
|
109
|
+
| `--p-popover-radius` | `12px` | Border radius of the popover. It is recommended to apply an existing Porsche Design System border-radius token, e.g. the CSS declaration `--p-popover-radius: var(--p-radius-lg)`, the Tailwind CSS arbitrary property `[--p-popover-radius:var(--radius-lg)]` or the equivalent SCSS/JS token. |
|
|
110
|
+
|
|
111
|
+
## Examples
|
|
112
|
+
|
|
113
|
+
| Example | When to use | File |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| Default | Minimal default configuration. | [./examples/Default.ts](./examples/Default.ts) |
|
|
116
|
+
| Slotted button | The `p-popover` component can also be used with a **slotted button** via the `button` slot, allowing you to provide a custom button element. | [./examples/SlottedButton.ts](./examples/SlottedButton.ts) |
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'porsche-design-system-app',
|
|
6
|
+
template: `
|
|
7
|
+
<p-radio-group name="options" label="Some Label" description="Some description">
|
|
8
|
+
<p-radio-group-option value="a" label="Option A"></p-radio-group-option>
|
|
9
|
+
<p-radio-group-option value="b" label="Option B"></p-radio-group-option>
|
|
10
|
+
<p-radio-group-option value="c" label="Option C"></p-radio-group-option>
|
|
11
|
+
<p-radio-group-option value="d" label="Option D"></p-radio-group-option>
|
|
12
|
+
<p-radio-group-option value="e" label="Option E"></p-radio-group-option>
|
|
13
|
+
<p-radio-group-option value="f" label="Option F"></p-radio-group-option>
|
|
14
|
+
</p-radio-group>
|
|
15
|
+
`,
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
standalone: true,
|
|
18
|
+
imports: [PorscheDesignSystemModule], // <-- PDS module is imported here
|
|
19
|
+
})
|
|
20
|
+
export class ExampleComponent {}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'porsche-design-system-app',
|
|
7
|
+
template: `
|
|
8
|
+
<form [formGroup]="form" (ngSubmit)="onSubmit()" class="flex flex-col gap-fluid-sm">
|
|
9
|
+
<p-radio-group formControlName="myRadioGroup" [label]="'Some Label'">
|
|
10
|
+
<p-radio-group-option label="Option A" value="a"></p-radio-group-option>
|
|
11
|
+
<p-radio-group-option label="Option B" value="b"></p-radio-group-option>
|
|
12
|
+
<p-radio-group-option label="Option C" value="c"></p-radio-group-option>
|
|
13
|
+
<p-radio-group-option label="Option D" value="d"></p-radio-group-option>
|
|
14
|
+
<p-radio-group-option label="Option E" value="e"></p-radio-group-option>
|
|
15
|
+
<p-radio-group-option label="Option F" value="f"></p-radio-group-option>
|
|
16
|
+
</p-radio-group>
|
|
17
|
+
<div class="flex gap-fluid-sm">
|
|
18
|
+
<p-button type="submit">Submit</p-button>
|
|
19
|
+
<p-button type="reset">Reset</p-button>
|
|
20
|
+
</div>
|
|
21
|
+
<p-text>Last submitted data: {{ submittedValue }}</p-text>
|
|
22
|
+
</form>
|
|
23
|
+
`,
|
|
24
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
+
standalone: true,
|
|
26
|
+
imports: [PorscheDesignSystemModule, FormsModule, ReactiveFormsModule], // <-- PDS module is imported here
|
|
27
|
+
})
|
|
28
|
+
export class ExampleComponent {
|
|
29
|
+
form = new FormGroup({
|
|
30
|
+
myRadioGroup: new FormControl<string>(''),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
submittedValue: any = undefined;
|
|
34
|
+
|
|
35
|
+
onSubmit(): void {
|
|
36
|
+
this.submittedValue = JSON.stringify(this.form.value);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
2
|
+
import { PorscheDesignSystemModule } from '@porsche-design-system/components-angular';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'porsche-design-system-app',
|
|
6
|
+
template: `
|
|
7
|
+
<p-radio-group state="error" value="a">
|
|
8
|
+
<span slot="label">
|
|
9
|
+
Some slotted label with a
|
|
10
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
11
|
+
link
|
|
12
|
+
</a>
|
|
13
|
+
text and a "label-after" slot.
|
|
14
|
+
</span>
|
|
15
|
+
<p-popover slot="label-after">
|
|
16
|
+
Some Popover description
|
|
17
|
+
</p-popover>
|
|
18
|
+
<span slot="description">
|
|
19
|
+
Some slotted description with a
|
|
20
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
21
|
+
link
|
|
22
|
+
</a>
|
|
23
|
+
.
|
|
24
|
+
</span>
|
|
25
|
+
<span slot="message">
|
|
26
|
+
Some slotted error message with a
|
|
27
|
+
<a href="https://designsystem.porsche.com" class="underline">
|
|
28
|
+
link
|
|
29
|
+
</a>
|
|
30
|
+
.
|
|
31
|
+
</span>
|
|
32
|
+
<p-radio-group-option value="a">
|
|
33
|
+
<span slot="label">
|
|
34
|
+
<img src="assets/911.png" alt="" class="object-contain inline-block align-middle -mt-2 me-static-sm w-[70px]" />
|
|
35
|
+
Some slotted label with custom content and a "label-after" slot
|
|
36
|
+
</span>
|
|
37
|
+
<p-popover slot="label-after">
|
|
38
|
+
Option A with slotted label and a popover
|
|
39
|
+
</p-popover>
|
|
40
|
+
</p-radio-group-option>
|
|
41
|
+
<p-radio-group-option value="b">
|
|
42
|
+
<span slot="label">
|
|
43
|
+
Option B with slotted label
|
|
44
|
+
</span>
|
|
45
|
+
</p-radio-group-option>
|
|
46
|
+
<p-radio-group-option value="c" disabled="true">
|
|
47
|
+
<span slot="label">
|
|
48
|
+
Disabled Option C with slotted label, a nested
|
|
49
|
+
<a href="https://www.porsche.com" class="underline">
|
|
50
|
+
link
|
|
51
|
+
</a>
|
|
52
|
+
and a label-after slot.
|
|
53
|
+
</span>
|
|
54
|
+
<p-popover slot="label-after">
|
|
55
|
+
Some information about the disabled state.
|
|
56
|
+
</p-popover>
|
|
57
|
+
</p-radio-group-option>
|
|
58
|
+
<p-radio-group-option value="d">
|
|
59
|
+
<span slot="label">
|
|
60
|
+
Option C with slotted label and a nested
|
|
61
|
+
<a href="https://www.porsche.com" class="underline">
|
|
62
|
+
link
|
|
63
|
+
</a>
|
|
64
|
+
</span>
|
|
65
|
+
</p-radio-group-option>
|
|
66
|
+
</p-radio-group>
|
|
67
|
+
`,
|
|
68
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
69
|
+
standalone: true,
|
|
70
|
+
imports: [PorscheDesignSystemModule], // <-- PDS module is imported here
|
|
71
|
+
})
|
|
72
|
+
export class ExampleComponent {}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# p-radio-group
|
|
2
|
+
|
|
3
|
+
The `p-radio-group` component is a versatile custom form element that enables the selection of a single option.
|
|
4
|
+
|
|
5
|
+
> **Attention**
|
|
6
|
+
>
|
|
7
|
+
> The `blur` event is emitted whenever the focused `p-radio-group-option` changes — not only when the entire `p-radio-group` loses focus. This means that switching between options within the same group will also trigger a `blur` event for the previously focused option.
|
|
8
|
+
|
|
9
|
+
Options are slotted using the `p-radio-group-option` component. Each option needs to have an assigned value, which can be passed via an attribute or property and needs to be of type string. Initial selection states can only be achieved using the value property on the `p-radio-group` component. If an option should be visible but not selectable, it can be disabled by using the `disabled` attribute.
|
|
10
|
+
|
|
11
|
+
A `label` is a caption which informs the user what information a particular form field is asking for. The `p-radio-group` 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 best practice to provide a descriptive label text for screen readers.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Do:
|
|
16
|
+
|
|
17
|
+
- Use to enable a user to select one value from a predefined list. Use as soon as two options are mutually exclusive.
|
|
18
|
+
- Use [Checkbox](../p-checkbox/p-checkbox.md) instead if there is only one option.
|
|
19
|
+
- Use when the user should see all available options.
|
|
20
|
+
- Consider using the [Segmented Control](../p-segmented-control/p-segmented-control.md) for 5 options or fewer.
|
|
21
|
+
- Keep the label text short and descriptive (one or two words).
|
|
22
|
+
- Select one option by default in a group of radio buttons, except for cases where a pre-selection can lead to wrong assumptions.
|
|
23
|
+
- Align radio buttons with more than 2 items vertically left-aligned.
|
|
24
|
+
|
|
25
|
+
### Don't:
|
|
26
|
+
|
|
27
|
+
- Don't use a radio Button for a large number of items (≥ 7), use the [Select](../p-select/p-select.md) or [Segmented Control](../p-segmented-control/p-segmented-control.md) component instead.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Related Components
|
|
32
|
+
|
|
33
|
+
- [Checkbox](../p-checkbox/p-checkbox.md)
|
|
34
|
+
- [Segmented Control](../p-segmented-control/p-segmented-control.md)
|
|
35
|
+
- [Select](../p-select/p-select.md)
|
|
36
|
+
|
|
37
|
+
## Accessibility support
|
|
38
|
+
|
|
39
|
+
### Keyboard
|
|
40
|
+
|
|
41
|
+
| Key / state | Function |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `Tab`, `Shift-Tab` | Moves focus to the next (or previous) focusable element. |
|
|
44
|
+
| `Arrow left`, `Arrow right`, `Down Arrow` `Up Arrow` | Activates and moves focus to the next/prev radio button in a group. |
|
|
45
|
+
|
|
46
|
+
### ARIA enhancements
|
|
47
|
+
|
|
48
|
+
#### Internal **ARIA** that is managed by the component:
|
|
49
|
+
|
|
50
|
+
| ARIA | Usage |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `aria-labelledby="IDREF"` | Defines the accessible name. |
|
|
53
|
+
| `aria-describedby="IDREF"` | Defines the accessible description combined with the status message. |
|
|
54
|
+
| `role="status"`, `role="alert"` | When `message` and `state` or `loading` prop change, the status message is announced. |
|
|
55
|
+
| `aria-hidden="true"` | If `required` attribute is set, the visible asterisk indicator is hidden from assistive technologies. |
|
|
56
|
+
| `aria-invalid="true"` | If `error` state is set. |
|
|
57
|
+
| `aria-required="true"` | Indicates if the element is required. |
|
|
58
|
+
|
|
59
|
+
## Development considerations
|
|
60
|
+
|
|
61
|
+
### Disabled state
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
### Common do's and don'ts
|
|
66
|
+
|
|
67
|
+
- **Do** provide a clear group `label` that describes the choice being made.
|
|
68
|
+
- **Do** use meaningful option labels so each choice is understandable out of context.
|
|
69
|
+
- **Do** use the component state/message API so validation and status changes are announced.
|
|
70
|
+
- **Don't** rely on adjacent text instead of the group `label` prop.
|
|
71
|
+
- **Don't** use `hide-label` without an accessible name.
|
|
72
|
+
|
|
73
|
+
## Tests
|
|
74
|
+
|
|
75
|
+
### Automated
|
|
76
|
+
|
|
77
|
+
| Technology | Support |
|
|
78
|
+
| --- | --- |
|
|
79
|
+
| AXE-Core (WCAG 2.2 AA, Best-Practice) | ✅ |
|
|
80
|
+
| High-Contrast Mode (light/dark) | ✅ |
|
|
81
|
+
| Text-Zoom (200%) | ✅ |
|
|
82
|
+
|
|
83
|
+
### Manual
|
|
84
|
+
|
|
85
|
+
| Technology | Support |
|
|
86
|
+
| --- | --- |
|
|
87
|
+
| Keyboard | ✅ |
|
|
88
|
+
| Screen reader (VoiceOver, NVDA) | ⚠️(Note: VoiceOver/NVDA do not announce the number of options correctly when used with Safari or Chrome) |
|
|
89
|
+
|
|
90
|
+
## API
|
|
91
|
+
|
|
92
|
+
### Properties
|
|
93
|
+
|
|
94
|
+
| Property | Type | Default | Description |
|
|
95
|
+
| --- | --- | --- | --- |
|
|
96
|
+
| `compact` | `boolean` | `false` | Reduces the spacing between radio options for use in dense layouts where vertical space is limited. |
|
|
97
|
+
| `description` | `string` | `''` | Sets a supplementary description displayed below the label to give users additional guidance about the radio group. |
|
|
98
|
+
| `direction` | `'row'` `'column'`<br>`BreakpointCustomizable<RadioGroupDirection>` | `'column'` | Sets the layout direction of the radio options. Use `column` to stack them vertically or `row` to arrange them horizontally. Supports responsive breakpoint values. |
|
|
99
|
+
| `disabled` | `boolean` | `false` | Disables all radio options in the group, preventing selection and excluding the value from form submissions. |
|
|
100
|
+
| `form` | `string` | `undefined` | Associates the radio group with a form element by its ID when the group is not a direct descendant of that form. |
|
|
101
|
+
| `hideLabel` | `boolean`<br>`BreakpointCustomizable<boolean>` | `false` | Hides the visible label while keeping it accessible to screen readers. Supports responsive breakpoint values. |
|
|
102
|
+
| `label` | `string` | `''` | Sets the visible label text displayed above the radio group to identify the group's purpose. |
|
|
103
|
+
| `loading` _(experimental)_ | `boolean` | `false` | @experimental Disables all radio options and shows a spinner to indicate a background loading operation. |
|
|
104
|
+
| `message` | `string` | `''` | Sets the validation feedback message displayed below the radio group when `state` is `success` or `error`. |
|
|
105
|
+
| `name` _(required)_ | `string` | `undefined` | Sets the shared name attribute for all radio buttons in the group, grouping them for mutually exclusive selection. |
|
|
106
|
+
| `required` | `boolean` | `false` | Marks the radio group as required so the form cannot be submitted until one option is selected. |
|
|
107
|
+
| `state` | `'none'` `'error'` `'success'` | `'none'` | Sets the validation state of the radio group, controlling its visual appearance and feedback message style (`none`, `success`, `error`). |
|
|
108
|
+
| `value` | `string` | `''` | Sets the currently selected value that pre-selects the matching radio option and reflects user changes. |
|
|
109
|
+
|
|
110
|
+
### Events
|
|
111
|
+
|
|
112
|
+
| Event | Type | Description |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| `blur` | `CustomEvent<void>` | Emitted when the radio group loses focus after the user interacts with it, useful for triggering validation on blur. |
|
|
115
|
+
| `change` | `CustomEvent<RadioGroupChangeEventDetail>`<br>`Event` | Emitted when the user selects a different option, carrying the new value and the native event in the event detail. |
|
|
116
|
+
|
|
117
|
+
### Slots
|
|
118
|
+
|
|
119
|
+
| Slot | Required | Allowed tag names | Description |
|
|
120
|
+
| --- | --- | --- | --- |
|
|
121
|
+
| `label` | no | — | Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
122
|
+
| `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`). |
|
|
123
|
+
| `description` | no | — | Shows a description. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
124
|
+
| _(default)_ | no | — | Default slot for the p-radio-group-option tags. |
|
|
125
|
+
| `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. |
|
|
126
|
+
|
|
127
|
+
## Sub-components
|
|
128
|
+
|
|
129
|
+
These tags are only valid inside the parent(s) listed under each one — often this component, but some are shared and list a different parent (e.g. a tag documented here via a common ancestor). Their APIs come from the same authoritative `component-meta` as the parent above.
|
|
130
|
+
|
|
131
|
+
### `p-radio-group-option`
|
|
132
|
+
|
|
133
|
+
Allowed parent: `p-radio-group`.
|
|
134
|
+
|
|
135
|
+
#### Properties
|
|
136
|
+
|
|
137
|
+
| Property | Type | Default | Description |
|
|
138
|
+
| --- | --- | --- | --- |
|
|
139
|
+
| `disabled` | `boolean` | `false` | Prevents this option from being selected and excludes its value from form submissions while it is disabled. |
|
|
140
|
+
| `label` | `string` | `undefined` | Sets the visible label text displayed next to the radio button that the user reads to identify the option. |
|
|
141
|
+
| `loading` _(experimental)_ | `boolean` | `false` | @experimental Disables this option and shows a spinner to indicate that this particular option is in a loading state. |
|
|
142
|
+
| `value` | `string` | `undefined` | Sets the value submitted with the form data when this radio option is selected within its parent group. |
|
|
143
|
+
|
|
144
|
+
#### Slots
|
|
145
|
+
|
|
146
|
+
| Slot | Required | Allowed tag names | Description |
|
|
147
|
+
| --- | --- | --- | --- |
|
|
148
|
+
| `label` | no | — | Shows a label. Only [phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content) is allowed. |
|
|
149
|
+
| `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`). |
|
|
150
|
+
|
|
151
|
+
## Examples
|
|
152
|
+
|
|
153
|
+
| Example | When to use | File |
|
|
154
|
+
| --- | --- | --- |
|
|
155
|
+
| Default | Minimal default configuration. | [./examples/Default.ts](./examples/Default.ts) |
|
|
156
|
+
| Form | The `p-radio-group` can be integrated into a form in two ways: **controlled** or **uncontrolled**, depending on your needs. | [./examples/Form.ts](./examples/Form.ts) |
|
|
157
|
+
| Slots | Use named slots when `label` or `message` need markup such as a link. | [./examples/Slots.ts](./examples/Slots.ts) |
|