@porsche-design-system/components-react 4.10.1 → 4.11.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 +104 -9
- package/cjs/lib/components/link.wrapper.cjs +3 -3
- package/cjs/lib/components/popover.wrapper.cjs +3 -3
- package/cjs/lib/components/sheet.wrapper.cjs +3 -3
- package/esm/lib/components/input-search.wrapper.d.ts +2 -2
- package/esm/lib/components/link.wrapper.d.ts +10 -0
- package/esm/lib/components/link.wrapper.mjs +3 -3
- package/esm/lib/components/popover.wrapper.d.ts +10 -0
- package/esm/lib/components/popover.wrapper.mjs +3 -3
- package/esm/lib/components/sheet.wrapper.d.ts +12 -2
- package/esm/lib/components/sheet.wrapper.mjs +3 -3
- package/esm/lib/types.d.ts +7 -3
- package/package.json +2 -2
- package/skills/pds-audit-deprecations-react/SKILL.md +2 -2
- package/skills/pds-knowledge-react/SKILL.md +8 -7
- package/skills/pds-knowledge-react/references/components/p-accordion/examples/Default.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-accordion/examples/InteractiveElementsInSummary.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-accordion/examples/StickySummary.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-ai-tag/examples/WithinRadioGroup.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-ai-tag/examples/WithinTable.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-banner/examples/Customization.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-banner/p-banner.md +2 -2
- package/skills/pds-knowledge-react/references/components/p-button-pure/p-button-pure.md +9 -0
- package/skills/pds-knowledge-react/references/components/p-carousel/p-carousel.md +1 -1
- package/skills/pds-knowledge-react/references/components/p-fieldset/p-fieldset.md +7 -9
- package/skills/pds-knowledge-react/references/components/p-flyout/examples/CustomStyling.tsx +3 -3
- package/skills/pds-knowledge-react/references/components/p-flyout/examples/Default.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-flyout/examples/StickyTop.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-inline-notification/p-inline-notification.md +1 -1
- package/skills/pds-knowledge-react/references/components/p-input-search/p-input-search.md +26 -8
- package/skills/pds-knowledge-react/references/components/p-link/examples/Cover.tsx +20 -0
- package/skills/pds-knowledge-react/references/components/p-link/p-link.md +3 -0
- package/skills/pds-knowledge-react/references/components/p-link-pure/p-link-pure.md +39 -1
- package/skills/pds-knowledge-react/references/components/p-modal/examples/AlertDialog.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-modal/examples/Default.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-modal/examples/Scrollable.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-popover/p-popover.md +4 -2
- package/skills/pds-knowledge-react/references/components/p-sheet/examples/Default.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-sheet/p-sheet.md +6 -3
- package/skills/pds-knowledge-react/references/components/p-table/examples/CaptionSlot.tsx +1 -1
- package/skills/pds-knowledge-react/references/components/p-toast/p-toast.md +2 -2
- package/skills/pds-knowledge-react/references/deprecations.md +4 -4
- package/skills/pds-knowledge-react/references/examples/patterns/feedback/dialog.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/feedback/inline.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/{footer.md → footer/extended.md} +9 -8
- package/skills/pds-knowledge-react/references/examples/patterns/footer/simple.md +75 -0
- package/skills/pds-knowledge-react/references/examples/patterns/forms/booking.md +479 -0
- package/skills/pds-knowledge-react/references/examples/patterns/forms/contact.md +211 -0
- package/skills/pds-knowledge-react/references/examples/patterns/forms/personal-details.md +253 -0
- package/skills/pds-knowledge-react/references/examples/patterns/forms/search-combobox-link-list.md +363 -0
- package/skills/pds-knowledge-react/references/examples/patterns/forms/search-combobox-option-list.md +499 -0
- package/skills/pds-knowledge-react/references/examples/patterns/header/overlay.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/header/stacked.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/popover/feature-tour.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/popover/local-market-switch.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/popover/priority-navigation.md +2 -1
- package/skills/pds-knowledge-react/references/examples/patterns/tile/call-to-action.md +71 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/category.md +60 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/disclosure.md +84 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/equipment-stacked.md +54 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/equipment.md +69 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/image.md +64 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/model-navigation.md +52 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/model-selection.md +66 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/model-teaser.md +78 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/product.md +92 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/vehicle-listing.md +107 -0
- package/skills/pds-knowledge-react/references/examples/patterns/tile/video.md +114 -0
- package/skills/pds-knowledge-react/references/examples/templates/admin-panel.md +1 -0
- package/skills/pds-knowledge-react/references/examples/templates/landing-page.md +4 -3
- package/skills/pds-knowledge-react/references/examples/templates/personalized-mailing/no-video.md +1166 -0
- package/skills/pds-knowledge-react/references/examples/templates/personalized-mailing/video.md +1252 -0
- package/skills/pds-knowledge-react/references/examples.md +50 -1
- package/ssr/cjs/components/dist/styles/esm/styles-entry.cjs +239 -70
- package/ssr/cjs/components/dist/utils/esm/utils-entry.cjs +424 -6
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/link.wrapper.cjs +4 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/popover.wrapper.cjs +4 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/components/sheet.wrapper.cjs +4 -4
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.cjs +2 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/dialog-base.cjs +2 -2
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/link.cjs +4 -2
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.cjs +1 -1
- package/ssr/cjs/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.cjs +14 -3
- package/ssr/esm/components/dist/styles/esm/styles-entry.mjs +239 -70
- package/ssr/esm/components/dist/utils/esm/utils-entry.mjs +411 -7
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/link.wrapper.mjs +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/popover.wrapper.mjs +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/components/sheet.wrapper.mjs +4 -4
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/accordion.mjs +2 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/dialog-base.mjs +2 -2
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/input-base.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/link.mjs +5 -3
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/popover.mjs +1 -1
- package/ssr/esm/components-react/projects/react-ssr-wrapper/src/lib/dsr-components/sheet.mjs +15 -4
- package/ssr/esm/public-api.d.ts +8696 -5
- package/skills/pds-knowledge-react/references/components/p-input-search/examples/AriaCombobox.tsx +0 -35
- package/ssr/esm/BaseProps.d.ts +0 -2
- package/ssr/esm/getCachedMinifiedCss.d.ts +0 -23
- package/ssr/esm/hooks.d.ts +0 -15
- package/ssr/esm/lib/components/accordion.wrapper.d.ts +0 -98
- package/ssr/esm/lib/components/ai-tag.wrapper.d.ts +0 -26
- package/ssr/esm/lib/components/banner.wrapper.d.ts +0 -86
- package/ssr/esm/lib/components/button-pure.wrapper.d.ts +0 -158
- package/ssr/esm/lib/components/button-tile.wrapper.d.ts +0 -140
- package/ssr/esm/lib/components/button.wrapper.d.ts +0 -118
- package/ssr/esm/lib/components/canvas.wrapper.d.ts +0 -54
- package/ssr/esm/lib/components/carousel.wrapper.d.ts +0 -166
- package/ssr/esm/lib/components/checkbox.wrapper.d.ts +0 -160
- package/ssr/esm/lib/components/crest.wrapper.d.ts +0 -32
- package/ssr/esm/lib/components/display.wrapper.d.ts +0 -57
- package/ssr/esm/lib/components/divider.wrapper.d.ts +0 -26
- package/ssr/esm/lib/components/drilldown-item.wrapper.d.ts +0 -53
- package/ssr/esm/lib/components/drilldown-link.wrapper.d.ts +0 -60
- package/ssr/esm/lib/components/drilldown.wrapper.d.ts +0 -50
- package/ssr/esm/lib/components/fieldset.wrapper.d.ts +0 -66
- package/ssr/esm/lib/components/flag.wrapper.d.ts +0 -34
- package/ssr/esm/lib/components/flyout.wrapper.d.ts +0 -110
- package/ssr/esm/lib/components/heading.wrapper.d.ts +0 -76
- package/ssr/esm/lib/components/icon.wrapper.d.ts +0 -52
- package/ssr/esm/lib/components/index.d.ts +0 -74
- package/ssr/esm/lib/components/inline-notification.wrapper.d.ts +0 -102
- package/ssr/esm/lib/components/input-date.wrapper.d.ts +0 -200
- package/ssr/esm/lib/components/input-email.wrapper.d.ts +0 -228
- package/ssr/esm/lib/components/input-month.wrapper.d.ts +0 -200
- package/ssr/esm/lib/components/input-number.wrapper.d.ts +0 -220
- package/ssr/esm/lib/components/input-password.wrapper.d.ts +0 -210
- package/ssr/esm/lib/components/input-search.wrapper.d.ts +0 -220
- package/ssr/esm/lib/components/input-tel.wrapper.d.ts +0 -218
- package/ssr/esm/lib/components/input-text.wrapper.d.ts +0 -218
- package/ssr/esm/lib/components/input-time.wrapper.d.ts +0 -200
- package/ssr/esm/lib/components/input-url.wrapper.d.ts +0 -218
- package/ssr/esm/lib/components/input-week.wrapper.d.ts +0 -200
- package/ssr/esm/lib/components/link-pure.wrapper.d.ts +0 -138
- package/ssr/esm/lib/components/link-tile-product.wrapper.d.ts +0 -104
- package/ssr/esm/lib/components/link-tile.wrapper.d.ts +0 -126
- package/ssr/esm/lib/components/link.wrapper.d.ts +0 -98
- package/ssr/esm/lib/components/modal.wrapper.d.ts +0 -100
- package/ssr/esm/lib/components/model-signature.wrapper.d.ts +0 -68
- package/ssr/esm/lib/components/multi-select-option.wrapper.d.ts +0 -25
- package/ssr/esm/lib/components/multi-select.wrapper.d.ts +0 -156
- package/ssr/esm/lib/components/optgroup.wrapper.d.ts +0 -25
- package/ssr/esm/lib/components/pagination.wrapper.d.ts +0 -64
- package/ssr/esm/lib/components/pin-code.wrapper.d.ts +0 -160
- package/ssr/esm/lib/components/popover.wrapper.d.ts +0 -58
- package/ssr/esm/lib/components/radio-group-option.wrapper.d.ts +0 -43
- package/ssr/esm/lib/components/radio-group.wrapper.d.ts +0 -148
- package/ssr/esm/lib/components/scroller.wrapper.d.ts +0 -62
- package/ssr/esm/lib/components/segmented-control-item.wrapper.d.ts +0 -58
- package/ssr/esm/lib/components/segmented-control.wrapper.d.ts +0 -148
- package/ssr/esm/lib/components/select-option.wrapper.d.ts +0 -25
- package/ssr/esm/lib/components/select.wrapper.d.ts +0 -164
- package/ssr/esm/lib/components/sheet.wrapper.d.ts +0 -80
- package/ssr/esm/lib/components/spinner.wrapper.d.ts +0 -34
- package/ssr/esm/lib/components/stepper-horizontal-item.wrapper.d.ts +0 -26
- package/ssr/esm/lib/components/stepper-horizontal.wrapper.d.ts +0 -26
- package/ssr/esm/lib/components/switch.wrapper.d.ts +0 -94
- package/ssr/esm/lib/components/table-body.wrapper.d.ts +0 -5
- package/ssr/esm/lib/components/table-cell.wrapper.d.ts +0 -17
- package/ssr/esm/lib/components/table-head-cell.wrapper.d.ts +0 -36
- package/ssr/esm/lib/components/table-head-row.wrapper.d.ts +0 -5
- package/ssr/esm/lib/components/table-head.wrapper.d.ts +0 -5
- package/ssr/esm/lib/components/table-row.wrapper.d.ts +0 -5
- package/ssr/esm/lib/components/table.wrapper.d.ts +0 -54
- package/ssr/esm/lib/components/tabs-bar.wrapper.d.ts +0 -70
- package/ssr/esm/lib/components/tabs-item.wrapper.d.ts +0 -15
- package/ssr/esm/lib/components/tabs.wrapper.d.ts +0 -72
- package/ssr/esm/lib/components/tag-dismissible.wrapper.d.ts +0 -34
- package/ssr/esm/lib/components/tag.wrapper.d.ts +0 -46
- package/ssr/esm/lib/components/text-list-item.wrapper.d.ts +0 -5
- package/ssr/esm/lib/components/text-list.wrapper.d.ts +0 -18
- package/ssr/esm/lib/components/text.wrapper.d.ts +0 -78
- package/ssr/esm/lib/components/textarea.wrapper.d.ts +0 -238
- package/ssr/esm/lib/components/toast.wrapper.d.ts +0 -3
- package/ssr/esm/lib/components/wordmark.wrapper.d.ts +0 -42
- package/ssr/esm/lib/dsr-components/accordion.d.ts +0 -18
- package/ssr/esm/lib/dsr-components/ai-tag.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/banner.d.ts +0 -20
- package/ssr/esm/lib/dsr-components/button-pure.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/button-tile.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/button.d.ts +0 -19
- package/ssr/esm/lib/dsr-components/canvas.d.ts +0 -23
- package/ssr/esm/lib/dsr-components/carousel.d.ts +0 -27
- package/ssr/esm/lib/dsr-components/checkbox.d.ts +0 -19
- package/ssr/esm/lib/dsr-components/crest.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/dialog-base.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/display.d.ts +0 -11
- package/ssr/esm/lib/dsr-components/divider.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/drilldown-item.d.ts +0 -15
- package/ssr/esm/lib/dsr-components/drilldown-link.d.ts +0 -11
- package/ssr/esm/lib/dsr-components/drilldown.d.ts +0 -23
- package/ssr/esm/lib/dsr-components/fc-dismiss-button.d.ts +0 -16
- package/ssr/esm/lib/dsr-components/fieldset.d.ts +0 -11
- package/ssr/esm/lib/dsr-components/filter-status-announcer.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/flag.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/flyout.d.ts +0 -26
- package/ssr/esm/lib/dsr-components/heading.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/icon.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/inline-notification.d.ts +0 -11
- package/ssr/esm/lib/dsr-components/input-base.d.ts +0 -38
- package/ssr/esm/lib/dsr-components/input-date.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-email.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-month.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-number.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-password.d.ts +0 -23
- package/ssr/esm/lib/dsr-components/input-search.d.ts +0 -23
- package/ssr/esm/lib/dsr-components/input-tel.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-text.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-time.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-url.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/input-week.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/label.d.ts +0 -24
- package/ssr/esm/lib/dsr-components/link-pure.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/link-tile-product.d.ts +0 -15
- package/ssr/esm/lib/dsr-components/link-tile.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/link.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/loading-message.d.ts +0 -8
- package/ssr/esm/lib/dsr-components/modal.d.ts +0 -23
- package/ssr/esm/lib/dsr-components/model-signature.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/multi-select-option.d.ts +0 -10
- package/ssr/esm/lib/dsr-components/multi-select.d.ts +0 -40
- package/ssr/esm/lib/dsr-components/no-results-option.d.ts +0 -2
- package/ssr/esm/lib/dsr-components/notification-base.d.ts +0 -14
- package/ssr/esm/lib/dsr-components/optgroup.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/pagination.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/pin-code.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/popover.d.ts +0 -27
- package/ssr/esm/lib/dsr-components/radio-group-option.d.ts +0 -13
- package/ssr/esm/lib/dsr-components/radio-group.d.ts +0 -22
- package/ssr/esm/lib/dsr-components/required.d.ts +0 -2
- package/ssr/esm/lib/dsr-components/scroller.d.ts +0 -15
- package/ssr/esm/lib/dsr-components/segmented-control-item.d.ts +0 -10
- package/ssr/esm/lib/dsr-components/segmented-control.d.ts +0 -21
- package/ssr/esm/lib/dsr-components/select-option.d.ts +0 -10
- package/ssr/esm/lib/dsr-components/select.d.ts +0 -41
- package/ssr/esm/lib/dsr-components/sheet.d.ts +0 -20
- package/ssr/esm/lib/dsr-components/spinner.d.ts +0 -6
- package/ssr/esm/lib/dsr-components/state-message.d.ts +0 -10
- package/ssr/esm/lib/dsr-components/stepper-horizontal-item.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/stepper-horizontal.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/switch.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/table-body.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table-cell.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table-head-cell.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table-head-row.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table-head.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table-row.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/table.d.ts +0 -10
- package/ssr/esm/lib/dsr-components/tabs-bar.d.ts +0 -17
- package/ssr/esm/lib/dsr-components/tabs-item.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/tabs.d.ts +0 -12
- package/ssr/esm/lib/dsr-components/tag-dismissible.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/tag.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/text-list-item.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/text-list.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/text.d.ts +0 -9
- package/ssr/esm/lib/dsr-components/textarea.d.ts +0 -19
- package/ssr/esm/lib/dsr-components/toast.d.ts +0 -7
- package/ssr/esm/lib/dsr-components/wordmark.d.ts +0 -6
- package/ssr/esm/lib/types.d.ts +0 -1862
- package/ssr/esm/minifyCss.d.ts +0 -1
- package/ssr/esm/provider.d.ts +0 -10
- package/ssr/esm/splitChildren.d.ts +0 -17
- package/ssr/esm/utils.d.ts +0 -4
package/skills/pds-knowledge-react/references/examples/patterns/forms/search-combobox-option-list.md
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
# Search: Combobox option list
|
|
2
|
+
|
|
3
|
+
A search field filters a list of selectable options inside a popover. Focus stays in the field: the arrow keys move a highlight through the matches, and Enter or a click writes the highlighted option into the field. Searching for a dealer by city is used here as an integration example, and the pattern applies to any searchable option list.
|
|
4
|
+
|
|
5
|
+
- **Type:** Pattern
|
|
6
|
+
- **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-icon`](../../../components/p-icon/p-icon.md), [`p-input-search`](../../../components/p-input-search/p-input-search.md), [`p-popover`](../../../components/p-popover/p-popover.md), [`p-text`](../../../components/p-text/p-text.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
8
|
+
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
9
|
+
|
|
10
|
+
## Markup
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<html lang="en">
|
|
14
|
+
<body class="bg-canvas">
|
|
15
|
+
<main id="main" class="grid-template gap-y-fluid-md py-fluid-lg">
|
|
16
|
+
<div class="col-extended justify-self-center w-full max-w-sm grid gap-static-md">
|
|
17
|
+
<p-heading tag="h1" size="lg">Find a dealer</p-heading>
|
|
18
|
+
<p-text>
|
|
19
|
+
Type a city. The arrow keys move through the matches, and Enter writes the highlighted choice into the field.
|
|
20
|
+
</p-text>
|
|
21
|
+
<p-popover
|
|
22
|
+
id="dealer-search-popover"
|
|
23
|
+
class="[--p-popover-px:var(--spacing-static-sm)] [--p-popover-py:var(--spacing-static-sm)]"
|
|
24
|
+
arrow="false"
|
|
25
|
+
>
|
|
26
|
+
<form id="dealer-search-form" slot="button" class="w-full" aria-label="Find a dealer">
|
|
27
|
+
<p-input-search
|
|
28
|
+
id="dealer-search"
|
|
29
|
+
name="dealer"
|
|
30
|
+
label="City"
|
|
31
|
+
description="Type a city name to find a dealer nearby."
|
|
32
|
+
hide-label="true"
|
|
33
|
+
placeholder="e.g. Stuttgart"
|
|
34
|
+
auto-complete="off"
|
|
35
|
+
clear
|
|
36
|
+
indicator
|
|
37
|
+
>
|
|
38
|
+
<p-popover
|
|
39
|
+
id="dealer-search-popover-button"
|
|
40
|
+
slot="end"
|
|
41
|
+
description="Select a city from the list to search first."
|
|
42
|
+
class="[--p-popover-w:fit-content]"
|
|
43
|
+
>
|
|
44
|
+
<p-button
|
|
45
|
+
id="dealer-search-submit"
|
|
46
|
+
slot="button"
|
|
47
|
+
type="submit"
|
|
48
|
+
variant="secondary"
|
|
49
|
+
form="dealer-search-form"
|
|
50
|
+
icon="arrow-right"
|
|
51
|
+
hide-label="true"
|
|
52
|
+
compact
|
|
53
|
+
disabled
|
|
54
|
+
aria="{ 'aria-description': 'Select a city from the list to search first.' }"
|
|
55
|
+
>
|
|
56
|
+
Search
|
|
57
|
+
</p-button>
|
|
58
|
+
</p-popover>
|
|
59
|
+
</p-input-search>
|
|
60
|
+
</form>
|
|
61
|
+
<p
|
|
62
|
+
id="dealer-search-empty"
|
|
63
|
+
class="m-0 min-h-[var(--leading-normal)] px-[12px] py-static-sm text-start text-sm text-contrast-medium"
|
|
64
|
+
hidden
|
|
65
|
+
>
|
|
66
|
+
No results found
|
|
67
|
+
</p>
|
|
68
|
+
<div id="dealer-search-results" role="listbox" aria-label="City" class="grid gap-static-sm">
|
|
69
|
+
<div
|
|
70
|
+
id="dealer-search-result-berlin"
|
|
71
|
+
role="option"
|
|
72
|
+
aria-selected="false"
|
|
73
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
74
|
+
>
|
|
75
|
+
Berlin
|
|
76
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
77
|
+
</div>
|
|
78
|
+
<div
|
|
79
|
+
id="dealer-search-result-berlin-brandenburg"
|
|
80
|
+
role="option"
|
|
81
|
+
aria-selected="false"
|
|
82
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
83
|
+
>
|
|
84
|
+
Berlin Brandenburg
|
|
85
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
86
|
+
</div>
|
|
87
|
+
<div
|
|
88
|
+
id="dealer-search-result-bochum"
|
|
89
|
+
role="option"
|
|
90
|
+
aria-selected="false"
|
|
91
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
92
|
+
>
|
|
93
|
+
Bochum
|
|
94
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
95
|
+
</div>
|
|
96
|
+
<div
|
|
97
|
+
id="dealer-search-result-bonn"
|
|
98
|
+
role="option"
|
|
99
|
+
aria-selected="false"
|
|
100
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
101
|
+
>
|
|
102
|
+
Bonn
|
|
103
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
104
|
+
</div>
|
|
105
|
+
<div
|
|
106
|
+
id="dealer-search-result-dortmund"
|
|
107
|
+
role="option"
|
|
108
|
+
aria-selected="false"
|
|
109
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
110
|
+
>
|
|
111
|
+
Dortmund
|
|
112
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
113
|
+
</div>
|
|
114
|
+
<div
|
|
115
|
+
id="dealer-search-result-dresden"
|
|
116
|
+
role="option"
|
|
117
|
+
aria-selected="false"
|
|
118
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
119
|
+
>
|
|
120
|
+
Dresden
|
|
121
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
122
|
+
</div>
|
|
123
|
+
<div
|
|
124
|
+
id="dealer-search-result-duisburg"
|
|
125
|
+
role="option"
|
|
126
|
+
aria-selected="false"
|
|
127
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
128
|
+
>
|
|
129
|
+
Duisburg
|
|
130
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
131
|
+
</div>
|
|
132
|
+
<div
|
|
133
|
+
id="dealer-search-result-essen"
|
|
134
|
+
role="option"
|
|
135
|
+
aria-selected="false"
|
|
136
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
137
|
+
>
|
|
138
|
+
Essen
|
|
139
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
140
|
+
</div>
|
|
141
|
+
<div
|
|
142
|
+
id="dealer-search-result-frankfurt"
|
|
143
|
+
role="option"
|
|
144
|
+
aria-selected="false"
|
|
145
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
146
|
+
>
|
|
147
|
+
Frankfurt
|
|
148
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
149
|
+
</div>
|
|
150
|
+
<div
|
|
151
|
+
id="dealer-search-result-frankfurt-airport"
|
|
152
|
+
role="option"
|
|
153
|
+
aria-selected="false"
|
|
154
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
155
|
+
>
|
|
156
|
+
Frankfurt Airport
|
|
157
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
158
|
+
</div>
|
|
159
|
+
<div
|
|
160
|
+
id="dealer-search-result-hamburg"
|
|
161
|
+
role="option"
|
|
162
|
+
aria-selected="false"
|
|
163
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
164
|
+
>
|
|
165
|
+
Hamburg
|
|
166
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
167
|
+
</div>
|
|
168
|
+
<div
|
|
169
|
+
id="dealer-search-result-hamburg-airport"
|
|
170
|
+
role="option"
|
|
171
|
+
aria-selected="false"
|
|
172
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
173
|
+
>
|
|
174
|
+
Hamburg Airport
|
|
175
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
176
|
+
</div>
|
|
177
|
+
<div
|
|
178
|
+
id="dealer-search-result-köln"
|
|
179
|
+
role="option"
|
|
180
|
+
aria-selected="false"
|
|
181
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
182
|
+
>
|
|
183
|
+
Köln
|
|
184
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
185
|
+
</div>
|
|
186
|
+
<div
|
|
187
|
+
id="dealer-search-result-leipzig"
|
|
188
|
+
role="option"
|
|
189
|
+
aria-selected="false"
|
|
190
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
191
|
+
>
|
|
192
|
+
Leipzig
|
|
193
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
194
|
+
</div>
|
|
195
|
+
<div
|
|
196
|
+
id="dealer-search-result-munich"
|
|
197
|
+
role="option"
|
|
198
|
+
aria-selected="false"
|
|
199
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
200
|
+
>
|
|
201
|
+
Munich
|
|
202
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
203
|
+
</div>
|
|
204
|
+
<div
|
|
205
|
+
id="dealer-search-result-münster"
|
|
206
|
+
role="option"
|
|
207
|
+
aria-selected="false"
|
|
208
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
209
|
+
>
|
|
210
|
+
Münster
|
|
211
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
212
|
+
</div>
|
|
213
|
+
<div
|
|
214
|
+
id="dealer-search-result-stuttgart"
|
|
215
|
+
role="option"
|
|
216
|
+
aria-selected="false"
|
|
217
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
218
|
+
>
|
|
219
|
+
Stuttgart
|
|
220
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
221
|
+
</div>
|
|
222
|
+
<div
|
|
223
|
+
id="dealer-search-result-stuttgart-airport"
|
|
224
|
+
role="option"
|
|
225
|
+
aria-selected="false"
|
|
226
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
227
|
+
>
|
|
228
|
+
Stuttgart Airport
|
|
229
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
230
|
+
</div>
|
|
231
|
+
<div
|
|
232
|
+
id="dealer-search-result-wuppertal"
|
|
233
|
+
role="option"
|
|
234
|
+
aria-selected="false"
|
|
235
|
+
class="flex w-full min-h-[var(--leading-normal)] cursor-pointer gap-static-sm rounded-sm px-[12px] py-static-sm text-start text-sm font-normal leading-normal break-words text-contrast-high transition-colors hover:bg-frosted hover:text-primary active:bg-frosted active:text-primary"
|
|
236
|
+
>
|
|
237
|
+
Wuppertal
|
|
238
|
+
<p-icon name="check" color="primary" class="ms-auto shrink-0" hidden></p-icon>
|
|
239
|
+
</div>
|
|
240
|
+
</div>
|
|
241
|
+
</p-popover>
|
|
242
|
+
<p id="dealer-search-status" class="sr-only" role="status"></p>
|
|
243
|
+
</div>
|
|
244
|
+
</main>
|
|
245
|
+
<script type="module" src="main.js"></script>
|
|
246
|
+
</body>
|
|
247
|
+
</html>
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Script
|
|
251
|
+
|
|
252
|
+
```js
|
|
253
|
+
// DO NOT USE IN PRODUCTION!
|
|
254
|
+
// EXAMPLE CODE FOR DEMONSTRATION PURPOSE ONLY.
|
|
255
|
+
|
|
256
|
+
// Shows matching dealer choices in the popover and writes the highlighted one into the field.
|
|
257
|
+
Promise.all([customElements.whenDefined('p-popover'), customElements.whenDefined('p-input-search')])
|
|
258
|
+
.then(() => document.getElementById('dealer-search').componentOnReady())
|
|
259
|
+
.then(() => {
|
|
260
|
+
const popover = document.getElementById('dealer-search-popover');
|
|
261
|
+
const submitPopover = document.getElementById('dealer-search-popover-button');
|
|
262
|
+
const submitButton = document.getElementById('dealer-search-submit');
|
|
263
|
+
const form = document.getElementById('dealer-search-form');
|
|
264
|
+
const search = document.getElementById('dealer-search');
|
|
265
|
+
const list = document.getElementById('dealer-search-results');
|
|
266
|
+
const empty = document.getElementById('dealer-search-empty');
|
|
267
|
+
const status = document.getElementById('dealer-search-status');
|
|
268
|
+
if (!popover || !submitPopover || !submitButton || !form || !search || !list || !empty || !status) {
|
|
269
|
+
throw new Error('Dealer search markup is incomplete');
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const activeClasses = [
|
|
273
|
+
'bg-frosted',
|
|
274
|
+
'text-primary',
|
|
275
|
+
'forced-colors:outline',
|
|
276
|
+
'forced-colors:outline-2',
|
|
277
|
+
'forced-colors:-outline-offset-2',
|
|
278
|
+
'forced-colors:outline-[Highlight]',
|
|
279
|
+
];
|
|
280
|
+
let activeIndex = -1;
|
|
281
|
+
let selectedOption = null;
|
|
282
|
+
let dismissed = false;
|
|
283
|
+
// Tracked separately from popover.open: when a query has 0 matches the popover stays open for the empty
|
|
284
|
+
// message while the controlled listbox is hidden, so aria-expanded must be false.
|
|
285
|
+
let expanded = false;
|
|
286
|
+
|
|
287
|
+
const options = () => Array.from(list.querySelectorAll('[role="option"]'));
|
|
288
|
+
|
|
289
|
+
const visibleOptions = () => options().filter((option) => !option.hidden);
|
|
290
|
+
|
|
291
|
+
const setSelected = (next) => {
|
|
292
|
+
selectedOption = next;
|
|
293
|
+
const hasSelection = selectedOption !== null;
|
|
294
|
+
submitButton.disabled = !hasSelection;
|
|
295
|
+
submitButton.aria = hasSelection ? {} : { 'aria-description': 'Select a city from the list to search first.' };
|
|
296
|
+
if (hasSelection) {
|
|
297
|
+
submitPopover.open = false;
|
|
298
|
+
}
|
|
299
|
+
for (const option of options()) {
|
|
300
|
+
const isSelected = option === selectedOption;
|
|
301
|
+
option.setAttribute('aria-selected', isSelected ? 'true' : 'false');
|
|
302
|
+
option.querySelector('p-icon').hidden = !isSelected;
|
|
303
|
+
option.classList.toggle('text-primary', isSelected || option.classList.contains('bg-frosted'));
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const setActive = (index) => {
|
|
308
|
+
const items = visibleOptions();
|
|
309
|
+
activeIndex = index;
|
|
310
|
+
const active = index >= 0 ? items[index] : null;
|
|
311
|
+
for (const option of options()) {
|
|
312
|
+
option.classList.remove(...activeClasses);
|
|
313
|
+
if (option === selectedOption) {
|
|
314
|
+
option.classList.add('text-primary');
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (active) {
|
|
318
|
+
active.classList.add(...activeClasses);
|
|
319
|
+
active.scrollIntoView({ block: 'nearest' });
|
|
320
|
+
}
|
|
321
|
+
search.aria = {
|
|
322
|
+
role: 'combobox',
|
|
323
|
+
'aria-autocomplete': 'list',
|
|
324
|
+
'aria-haspopup': 'listbox',
|
|
325
|
+
'aria-expanded': expanded,
|
|
326
|
+
'aria-controls': list,
|
|
327
|
+
'aria-activedescendant': active,
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const setOpen = (open, nextExpanded = open) => {
|
|
332
|
+
popover.open = open;
|
|
333
|
+
expanded = nextExpanded;
|
|
334
|
+
if (!open) {
|
|
335
|
+
status.textContent = '';
|
|
336
|
+
}
|
|
337
|
+
setActive(-1);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
const choose = (option) => {
|
|
341
|
+
setSelected(option);
|
|
342
|
+
search.value = option.textContent.trim();
|
|
343
|
+
dismissed = true;
|
|
344
|
+
setOpen(false);
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
const queryOf = () =>
|
|
348
|
+
String(search.value ?? '')
|
|
349
|
+
.trim()
|
|
350
|
+
.toLowerCase();
|
|
351
|
+
|
|
352
|
+
const renderResults = () => {
|
|
353
|
+
const query = queryOf();
|
|
354
|
+
if (selectedOption && selectedOption.textContent.trim().toLowerCase() !== query) {
|
|
355
|
+
setSelected(null);
|
|
356
|
+
}
|
|
357
|
+
let visible = 0;
|
|
358
|
+
for (const option of options()) {
|
|
359
|
+
const match = query.length > 0 && option.textContent.toLowerCase().includes(query);
|
|
360
|
+
option.hidden = !match;
|
|
361
|
+
if (match) {
|
|
362
|
+
visible += 1;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
list.hidden = visible === 0;
|
|
366
|
+
empty.hidden = !query || visible > 0;
|
|
367
|
+
status.textContent = !query
|
|
368
|
+
? ''
|
|
369
|
+
: visible === 0
|
|
370
|
+
? 'No results found'
|
|
371
|
+
: visible === 1
|
|
372
|
+
? '1 result available'
|
|
373
|
+
: visible + ' results available';
|
|
374
|
+
setOpen(query.length > 0, visible > 0);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
new ResizeObserver(() => {
|
|
378
|
+
const width = Math.round(search.getBoundingClientRect().width) + 'px';
|
|
379
|
+
popover.style.setProperty('--p-popover-w', width);
|
|
380
|
+
popover.style.setProperty('--p-popover-max-w', width);
|
|
381
|
+
}).observe(search);
|
|
382
|
+
|
|
383
|
+
setOpen(false);
|
|
384
|
+
submitPopover.open = false;
|
|
385
|
+
|
|
386
|
+
let isSubmitHovered = false;
|
|
387
|
+
let isSubmitFocused = false;
|
|
388
|
+
const syncSubmitPopover = () => {
|
|
389
|
+
submitPopover.open = submitButton.disabled && (isSubmitHovered || isSubmitFocused);
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
for (const target of [submitPopover, submitButton]) {
|
|
393
|
+
target.addEventListener('mouseenter', () => {
|
|
394
|
+
isSubmitHovered = true;
|
|
395
|
+
syncSubmitPopover();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
target.addEventListener('mouseleave', (event) => {
|
|
399
|
+
if (submitPopover.contains(event.relatedTarget)) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
isSubmitHovered = false;
|
|
403
|
+
syncSubmitPopover();
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
submitButton.addEventListener('focusin', () => {
|
|
408
|
+
isSubmitFocused = true;
|
|
409
|
+
syncSubmitPopover();
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
submitButton.addEventListener('focusout', () => {
|
|
413
|
+
isSubmitFocused = false;
|
|
414
|
+
syncSubmitPopover();
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
submitPopover.addEventListener('dismiss', () => {
|
|
418
|
+
submitPopover.open = false;
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
form.addEventListener('submit', (event) => {
|
|
422
|
+
event.preventDefault();
|
|
423
|
+
const items = visibleOptions();
|
|
424
|
+
if (popover.open && activeIndex >= 0 && items[activeIndex]) {
|
|
425
|
+
choose(items[activeIndex]);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
dismissed = true;
|
|
429
|
+
setOpen(false);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
search.addEventListener('input', () => {
|
|
433
|
+
dismissed = false;
|
|
434
|
+
renderResults();
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
search.addEventListener('focusin', (event) => {
|
|
438
|
+
if (dismissed || search.contains(event.relatedTarget)) {
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
renderResults();
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
popover.addEventListener('dismiss', (event) => {
|
|
445
|
+
setOpen(false);
|
|
446
|
+
if (event.detail && event.detail.reason === 'escape') {
|
|
447
|
+
dismissed = true;
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
list.addEventListener('mousedown', (event) => {
|
|
452
|
+
event.preventDefault();
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
list.addEventListener('click', (event) => {
|
|
456
|
+
const option = event.target.closest('[role="option"]');
|
|
457
|
+
if (!option || option.hidden) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
choose(option);
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
search.addEventListener('keydown', (event) => {
|
|
464
|
+
if (event.isComposing || event.keyCode === 229 || event.target !== search) {
|
|
465
|
+
return;
|
|
466
|
+
}
|
|
467
|
+
if (event.key === 'Escape' && popover.open) {
|
|
468
|
+
// The popover closes on Escape; without this the native search field would also clear the query.
|
|
469
|
+
event.preventDefault();
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (event.key === 'Enter') {
|
|
473
|
+
const items = visibleOptions();
|
|
474
|
+
if (popover.open && activeIndex >= 0 && items[activeIndex]) {
|
|
475
|
+
event.preventDefault();
|
|
476
|
+
choose(items[activeIndex]);
|
|
477
|
+
}
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (event.key === 'ArrowDown') {
|
|
481
|
+
if (!popover.open && queryOf()) {
|
|
482
|
+
dismissed = false;
|
|
483
|
+
renderResults();
|
|
484
|
+
}
|
|
485
|
+
const items = visibleOptions();
|
|
486
|
+
if (!popover.open || !items.length) {
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
event.preventDefault();
|
|
490
|
+
setActive(Math.min(activeIndex + 1, items.length - 1));
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (event.key === 'ArrowUp' && popover.open && activeIndex >= 0) {
|
|
494
|
+
event.preventDefault();
|
|
495
|
+
setActive(activeIndex - 1);
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
});
|
|
499
|
+
```
|
|
@@ -4,13 +4,14 @@ The header lies on top of the content, typically a full-bleed hero image or vide
|
|
|
4
4
|
|
|
5
5
|
- **Type:** Pattern
|
|
6
6
|
- **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-button-pure`](../../../components/p-button-pure/p-button-pure.md), [`p-crest`](../../../components/p-crest/p-crest.md), [`p-drilldown`](../../../components/p-drilldown/p-drilldown.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-wordmark`](../../../components/p-wordmark/p-wordmark.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
7
8
|
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
8
9
|
|
|
9
10
|
## Markup
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
13
|
<html lang="en">
|
|
13
|
-
<body>
|
|
14
|
+
<body class="bg-canvas">
|
|
14
15
|
<header
|
|
15
16
|
class="z-1 grid-template absolute inset-x-0 before:absolute before:inset-[0_0_-60px_0] before:-z-1 before:pointer-events-none before:bg-fade-to-b"
|
|
16
17
|
>
|
|
@@ -4,13 +4,14 @@ The header sits above the content instead of lying on top of it: a note on top,
|
|
|
4
4
|
|
|
5
5
|
- **Type:** Pattern
|
|
6
6
|
- **Components:** [`p-button-pure`](../../../components/p-button-pure/p-button-pure.md), [`p-crest`](../../../components/p-crest/p-crest.md), [`p-drilldown`](../../../components/p-drilldown/p-drilldown.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-link-pure`](../../../components/p-link-pure/p-link-pure.md), [`p-tabs-bar`](../../../components/p-tabs-bar/p-tabs-bar.md), [`p-text`](../../../components/p-text/p-text.md), [`p-wordmark`](../../../components/p-wordmark/p-wordmark.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
7
8
|
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
8
9
|
|
|
9
10
|
## Markup
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
13
|
<html lang="en">
|
|
13
|
-
<body>
|
|
14
|
+
<body class="bg-canvas">
|
|
14
15
|
<header class="grid-template gap-y-0">
|
|
15
16
|
<div class="scheme-dark col-full flex justify-center py-static-xs px-static-md bg-surface">
|
|
16
17
|
<p-text size="xs">All sizes shown for Porsche Lifestyle products are EU sizes</p-text>
|
|
@@ -4,13 +4,14 @@ On first visit, a sequence of popovers guides the user through the key areas of
|
|
|
4
4
|
|
|
5
5
|
- **Type:** Pattern
|
|
6
6
|
- **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-button-pure`](../../../components/p-button-pure/p-button-pure.md), [`p-crest`](../../../components/p-crest/p-crest.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-popover`](../../../components/p-popover/p-popover.md), [`p-text`](../../../components/p-text/p-text.md), [`p-wordmark`](../../../components/p-wordmark/p-wordmark.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
7
8
|
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
8
9
|
|
|
9
10
|
## Markup
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
13
|
<html lang="en">
|
|
13
|
-
<body>
|
|
14
|
+
<body class="bg-canvas">
|
|
14
15
|
<header class="grid-template border-b border-contrast-lower">
|
|
15
16
|
<div class="col-wide grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] gap-fluid-md items-center min-h-[80px]">
|
|
16
17
|
<div class="flex flex-wrap gap-static-md items-center justify-start">
|
package/skills/pds-knowledge-react/references/examples/patterns/popover/local-market-switch.md
CHANGED
|
@@ -4,13 +4,14 @@ On entering the site, a popover anchored to the globe icon in the header suggest
|
|
|
4
4
|
|
|
5
5
|
- **Type:** Pattern
|
|
6
6
|
- **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-button-pure`](../../../components/p-button-pure/p-button-pure.md), [`p-crest`](../../../components/p-crest/p-crest.md), [`p-drilldown`](../../../components/p-drilldown/p-drilldown.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-link-pure`](../../../components/p-link-pure/p-link-pure.md), [`p-popover`](../../../components/p-popover/p-popover.md), [`p-sheet`](../../../components/p-sheet/p-sheet.md), [`p-tag`](../../../components/p-tag/p-tag.md), [`p-text`](../../../components/p-text/p-text.md), [`p-wordmark`](../../../components/p-wordmark/p-wordmark.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
7
8
|
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
8
9
|
|
|
9
10
|
## Markup
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
13
|
<html lang="en">
|
|
13
|
-
<body>
|
|
14
|
+
<body class="bg-canvas">
|
|
14
15
|
<header
|
|
15
16
|
class="z-1 grid-template absolute inset-x-0 before:absolute before:inset-[0_0_-60px_0] before:-z-1 before:pointer-events-none before:bg-fade-to-b"
|
|
16
17
|
>
|
package/skills/pds-knowledge-react/references/examples/patterns/popover/priority-navigation.md
CHANGED
|
@@ -4,13 +4,14 @@ When horizontal space is limited, navigation items that no longer fit are collap
|
|
|
4
4
|
|
|
5
5
|
- **Type:** Pattern
|
|
6
6
|
- **Components:** [`p-button`](../../../components/p-button/p-button.md), [`p-heading`](../../../components/p-heading/p-heading.md), [`p-link-pure`](../../../components/p-link-pure/p-link-pure.md), [`p-popover`](../../../components/p-popover/p-popover.md), [`p-tag`](../../../components/p-tag/p-tag.md), [`p-text`](../../../components/p-text/p-text.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
7
8
|
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
8
9
|
|
|
9
10
|
## Markup
|
|
10
11
|
|
|
11
12
|
```html
|
|
12
13
|
<html lang="en">
|
|
13
|
-
<body>
|
|
14
|
+
<body class="bg-canvas">
|
|
14
15
|
<main id="main" class="grid-template">
|
|
15
16
|
<section class="col-wide py-fluid-lg grid gap-fluid-md">
|
|
16
17
|
<p-heading tag="h1" size="xl">Priority navigation</p-heading>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Tile: Call to Action
|
|
2
|
+
|
|
3
|
+
A call to action tile promotes a service with a mood image and a link to it, e.g. Porsche Connect on porsche.com. Heading and text are limited to a readable line length and stacked with the link at the start of the tile, on a dark gradient that follows the height of the text and ensures its legibility on any image. The link stretches its clickable area over the tile, and on hover the image zooms in, unless the user prefers reduced motion. When the text needs more space than the aspect ratio provides, the tile grows beyond it.
|
|
4
|
+
|
|
5
|
+
- **Type:** Pattern
|
|
6
|
+
- **Components:** [`p-heading`](../../../components/p-heading/p-heading.md), [`p-link`](../../../components/p-link/p-link.md), [`p-text`](../../../components/p-text/p-text.md)
|
|
7
|
+
- **Color schemes:** light and dark – see Conventions
|
|
8
|
+
- **Conventions and stylesheet:** shared by all examples, see [examples.md](../../../examples.md)
|
|
9
|
+
|
|
10
|
+
## Markup
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<html lang="en">
|
|
14
|
+
<body class="bg-canvas grid content-center min-h-dvh">
|
|
15
|
+
<main id="main" class="grid-template py-fluid-lg">
|
|
16
|
+
<!-- The tile follows the width of this wrapper rather than of the window, so it fits any column. -->
|
|
17
|
+
<div class="col-extended @container">
|
|
18
|
+
<!--
|
|
19
|
+
- Positioned, so that its covering link spans it. The cover radius variable gives the focus indicator of that
|
|
20
|
+
link the corners of the tile.
|
|
21
|
+
- Light text on dark media, whatever the color scheme of the page.
|
|
22
|
+
- Upright in a narrow column, where the text needs the height. Longer text extends the tile beyond its aspect
|
|
23
|
+
ratio.
|
|
24
|
+
-->
|
|
25
|
+
<div
|
|
26
|
+
class="group relative isolate grid grid-rows-[minmax(0,1fr)_auto] aspect-3/4 @lg:aspect-16/9 rounded-3xl scheme-only-dark [--p-link-cover-radius:var(--radius-3xl)]"
|
|
27
|
+
>
|
|
28
|
+
<!--
|
|
29
|
+
- Clips the zooming media to the corners, which the tile cannot do without cutting off the focus indicator
|
|
30
|
+
of its link.
|
|
31
|
+
- Adopts the two rows of the tile, the lower one as high as the text. Its gradient is twice as high as that
|
|
32
|
+
row, so the text lies in the dark half and stays legible on any image.
|
|
33
|
+
-->
|
|
34
|
+
<div
|
|
35
|
+
class="relative -z-1 col-start-1 row-start-1 row-span-2 grid grid-rows-subgrid overflow-clip rounded-[inherit] after:absolute after:row-start-2 after:inset-x-0 after:bottom-0 after:h-[200%] after:bg-fade-to-t"
|
|
36
|
+
>
|
|
37
|
+
<!--
|
|
38
|
+
- Decorative: it sets the mood and adds nothing to the text.
|
|
39
|
+
- Zooms in while the tile is hovered, unless the user prefers reduced motion.
|
|
40
|
+
-->
|
|
41
|
+
<img
|
|
42
|
+
class="absolute inset-0 size-full object-cover motion-safe:transition-[scale] duration-md ease-in-out motion-safe:group-hover:scale-105"
|
|
43
|
+
src="/examples/media/gipfeltreffen.webp"
|
|
44
|
+
alt
|
|
45
|
+
width="2000"
|
|
46
|
+
height="1125"
|
|
47
|
+
/>
|
|
48
|
+
</div>
|
|
49
|
+
<div class="col-start-1 row-start-2 grid justify-items-start gap-fluid-md p-fluid-lg">
|
|
50
|
+
<!-- Keeps the lines at a readable length, however wide the tile is. -->
|
|
51
|
+
<div class="grid gap-fluid-sm max-w-[40ch]">
|
|
52
|
+
<p-heading tag="h2" size="lg">Porsche Connect.</p-heading>
|
|
53
|
+
<p-text>
|
|
54
|
+
Porsche Connect enhances the driving experience with a wide range of music and video streaming services,
|
|
55
|
+
the integrated Voice Pilot and remote services via the My Porsche app.
|
|
56
|
+
</p-text>
|
|
57
|
+
</div>
|
|
58
|
+
<!-- Covers the whole tile, so a single link names and opens it. -->
|
|
59
|
+
<p-link variant="secondary" cover><a href="#">Discover Porsche Connect</a></p-link>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
</main>
|
|
64
|
+
<script type="module" src="main.js"></script>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Script
|
|
70
|
+
|
|
71
|
+
None – the components cover all of the behaviour.
|