@vtex/faststore 0.0.4 → 0.0.6
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 +67 -0
- package/dist/actions.json +181 -0
- package/dist/catalog.json +1595 -481
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -1
- package/dist/components.d.ts +31 -7
- package/dist/components.js +35 -13
- package/dist/content-types.json +73 -0
- package/dist/docs/access-code-sign-in.md +1 -1
- package/dist/docs/account-access-gate.md +153 -0
- package/dist/docs/account-entry-point.md +1 -2
- package/dist/docs/account-menu.md +164 -0
- package/dist/docs/address-summary.md +24 -3
- package/dist/docs/alert-dialog.md +204 -0
- package/dist/docs/billing-address.md +284 -0
- package/dist/docs/buy-button.md +1 -1
- package/dist/docs/card-entry.md +250 -0
- package/dist/docs/cardholder-document.md +142 -0
- package/dist/docs/cart.md +1 -1
- package/dist/docs/client-preferences-fieldset.md +148 -0
- package/dist/docs/client-preferences.md +2 -1
- package/dist/docs/client-profile-fieldset.md +184 -0
- package/dist/docs/client-profile.md +1 -1
- package/dist/docs/document-field.md +58 -4
- package/dist/docs/field.md +317 -0
- package/dist/docs/form.md +307 -0
- package/dist/docs/identity-edit.md +6 -6
- package/dist/docs/identity-summary.md +5 -5
- package/dist/docs/installments.md +248 -0
- package/dist/docs/my-account-profile.md +1 -0
- package/dist/docs/order-placed-payment-summary.md +138 -0
- package/dist/docs/payment-method-badges.md +232 -0
- package/dist/docs/payment-methods.md +1 -0
- package/dist/docs/payment.md +218 -0
- package/dist/docs/phone-field.md +58 -4
- package/dist/docs/place-order.md +157 -0
- package/dist/docs/save-card.md +186 -0
- package/dist/docs/saved-cards.md +218 -0
- package/dist/docs/select.md +465 -0
- package/dist/docs/session.md +1 -1
- package/dist/docs/shipping-address.md +110 -258
- package/dist/docs/sign-in-redirect.md +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/internal/client.d.ts +3 -1
- package/dist/internal/client.js +3 -1
- package/dist/matter/access-code-sign-in/access-code-sign-in.js +9 -8
- package/dist/matter/access-code-sign-in/access-code-sign-in.js.map +1 -1
- package/dist/matter/account-access-gate/account-access-gate.d.ts +86 -0
- package/dist/matter/account-access-gate/account-access-gate.js +283 -0
- package/dist/matter/account-access-gate/account-access-gate.js.map +1 -0
- package/dist/matter/account-access-gate/sign-out-intent.d.ts +17 -0
- package/dist/matter/account-access-gate/sign-out-intent.js +62 -0
- package/dist/matter/account-access-gate/sign-out-intent.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.js +2 -2
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +88 -0
- package/dist/matter/account-menu/account-menu.js +246 -0
- package/dist/matter/account-menu/account-menu.js.map +1 -0
- package/dist/matter/billing-address/billing-address.d.ts +165 -0
- package/dist/matter/billing-address/billing-address.js +408 -0
- package/dist/matter/billing-address/billing-address.js.map +1 -0
- package/dist/matter/card-entry/card-capture.d.ts +25 -0
- package/dist/matter/card-entry/card-capture.js +25 -0
- package/dist/matter/card-entry/card-capture.js.map +1 -0
- package/dist/matter/card-entry/card-entry.d.ts +120 -0
- package/dist/matter/card-entry/card-entry.js +832 -0
- package/dist/matter/card-entry/card-entry.js.map +1 -0
- package/dist/matter/cardholder-document/cardholder-document.d.ts +45 -0
- package/dist/matter/cardholder-document/cardholder-document.js +70 -0
- package/dist/matter/cardholder-document/cardholder-document.js.map +1 -0
- package/dist/matter/cart/cart.d.ts +1 -1
- package/dist/matter/cart/cart.js +2 -2
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/client-preferences/client-preferences-fieldset.d.ts +77 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.js +299 -0
- package/dist/matter/client-preferences/client-preferences-fieldset.js.map +1 -0
- package/dist/matter/client-preferences/client-preferences.d.ts +3 -5
- package/dist/matter/client-preferences/client-preferences.js +6 -6
- package/dist/matter/client-preferences/client-preferences.js.map +1 -1
- package/dist/matter/client-profile/client-profile.d.ts +4 -6
- package/dist/matter/client-profile/client-profile.js +9 -6
- package/dist/matter/client-profile/client-profile.js.map +1 -1
- package/dist/matter/client-profile-form/client-profile-fieldset.d.ts +119 -0
- package/dist/matter/client-profile-form/client-profile-fieldset.js +488 -0
- package/dist/matter/client-profile-form/client-profile-fieldset.js.map +1 -0
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/identity-edit/identity-edit.js +2 -2
- package/dist/matter/identity-edit/identity-edit.js.map +1 -1
- package/dist/matter/identity-summary/identity-summary.js +2 -2
- package/dist/matter/identity-summary/identity-summary.js.map +1 -1
- package/dist/matter/installments/installments-select.d.ts +42 -0
- package/dist/matter/installments/installments-select.js +167 -0
- package/dist/matter/installments/installments-select.js.map +1 -0
- package/dist/matter/installments/installments.d.ts +58 -0
- package/dist/matter/installments/installments.js +176 -0
- package/dist/matter/installments/installments.js.map +1 -0
- package/dist/matter/installments/use-installments-selection.d.ts +29 -0
- package/dist/matter/installments/use-installments-selection.js +95 -0
- package/dist/matter/installments/use-installments-selection.js.map +1 -0
- package/dist/matter/my-account-profile/my-account-profile.js +5 -5
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -1
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.d.ts +63 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js +305 -0
- package/dist/matter/order-placed-payment-summary/order-placed-payment-summary.js.map +1 -0
- package/dist/matter/payment/payment-card-capture.d.ts +19 -0
- package/dist/matter/payment/payment-card-capture.js +129 -0
- package/dist/matter/payment/payment-card-capture.js.map +1 -0
- package/dist/matter/payment/payment-controller.d.ts +24 -0
- package/dist/matter/payment/payment-controller.js +107 -0
- package/dist/matter/payment/payment-controller.js.map +1 -0
- package/dist/matter/payment/payment-method-badges.d.ts +57 -0
- package/dist/matter/payment/payment-method-badges.js +192 -0
- package/dist/matter/payment/payment-method-badges.js.map +1 -0
- package/dist/matter/payment/payment.d.ts +89 -0
- package/dist/matter/payment/payment.js +263 -0
- package/dist/matter/payment/payment.js.map +1 -0
- package/dist/matter/payment/use-payment-method-selection.d.ts +302 -0
- package/dist/matter/payment/use-payment-method-selection.js +458 -0
- package/dist/matter/payment/use-payment-method-selection.js.map +1 -0
- package/dist/matter/payment/use-payment-submit-gate.d.ts +111 -0
- package/dist/matter/payment/use-payment-submit-gate.js +144 -0
- package/dist/matter/payment/use-payment-submit-gate.js.map +1 -0
- package/dist/matter/place-order/place-order.d.ts +74 -0
- package/dist/matter/place-order/place-order.js +379 -0
- package/dist/matter/place-order/place-order.js.map +1 -0
- package/dist/matter/product-list/product-list.d.ts +1 -0
- package/dist/matter/product-list/product-list.js.map +1 -1
- package/dist/matter/product-shelf/product-shelf.d.ts +1 -0
- package/dist/matter/product-shelf/product-shelf.js +2 -0
- package/dist/matter/product-shelf/product-shelf.js.map +1 -1
- package/dist/matter/region/region.js +1 -1
- package/dist/matter/region/region.js.map +1 -1
- package/dist/matter/save-card/save-card.d.ts +49 -0
- package/dist/matter/save-card/save-card.js +188 -0
- package/dist/matter/save-card/save-card.js.map +1 -0
- package/dist/matter/saved-cards/saved-cards.d.ts +79 -0
- package/dist/matter/saved-cards/saved-cards.js +387 -0
- package/dist/matter/saved-cards/saved-cards.js.map +1 -0
- package/dist/matter/shipping-address/country-descriptors.js +20 -10
- package/dist/matter/shipping-address/country-descriptors.js.map +1 -1
- package/dist/matter/shipping-address/shipping-address.d.ts +113 -174
- package/dist/matter/shipping-address/shipping-address.js +481 -792
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/matter/variant-selector/variant-selector.js +1 -1
- package/dist/particles/address-summary/address-summary.d.ts +24 -0
- package/dist/particles/address-summary/address-summary.js +83 -2
- package/dist/particles/address-summary/address-summary.js.map +1 -1
- package/dist/particles/alert-dialog/alert-dialog.d.ts +68 -0
- package/dist/particles/alert-dialog/alert-dialog.js +187 -0
- package/dist/particles/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/particles/checkbox/checkbox.d.ts +7 -3
- package/dist/particles/checkbox/checkbox.js +4 -1
- package/dist/particles/checkbox/checkbox.js.map +1 -1
- package/dist/particles/document-field/document-field.d.ts +48 -5
- package/dist/particles/document-field/document-field.js +189 -32
- package/dist/particles/document-field/document-field.js.map +1 -1
- package/dist/particles/field/bound-field-registry.js +52 -0
- package/dist/particles/field/bound-field-registry.js.map +1 -0
- package/dist/particles/field/field.d.ts +116 -0
- package/dist/particles/field/field.js +497 -6
- package/dist/particles/field/field.js.map +1 -1
- package/dist/particles/fieldset/fieldset.js +2 -2
- package/dist/particles/fieldset/fieldset.js.map +1 -1
- package/dist/particles/footer-social/footer-social.js +1 -1
- package/dist/particles/form/form.d.ts +104 -0
- package/dist/particles/form/form.js +485 -0
- package/dist/particles/form/form.js.map +1 -0
- package/dist/particles/incentives/incentives.js +1 -1
- package/dist/particles/phone-field/phone-field.d.ts +38 -10
- package/dist/particles/phone-field/phone-field.js +183 -39
- package/dist/particles/phone-field/phone-field.js.map +1 -1
- package/dist/particles/postal-code-field/postal-code-field.js +2 -2
- package/dist/particles/postal-code-field/postal-code-field.js.map +1 -1
- package/dist/particles/select/field-select.d.ts +43 -0
- package/dist/particles/select/field-select.js +150 -0
- package/dist/particles/select/field-select.js.map +1 -0
- package/dist/particles/select/select.d.ts +2 -0
- package/dist/particles/select/select.js.map +1 -1
- package/dist/particles/shared/compose-refs.js +21 -0
- package/dist/particles/shared/compose-refs.js.map +1 -0
- package/dist/schema.graphql +701 -2
- package/dist/sdk/actions/analytics-action-provider.d.ts +15 -0
- package/dist/sdk/actions/analytics-action-provider.js +19 -0
- package/dist/sdk/actions/analytics-action-provider.js.map +1 -0
- package/dist/sdk/actions/cart-action-provider.d.ts +1 -1
- package/dist/sdk/actions/cart-action-provider.js +1 -1
- package/dist/sdk/actions/cart-action-provider.js.map +1 -1
- package/dist/sdk/actions/index.d.ts +3 -1
- package/dist/sdk/actions/index.js +3 -1
- package/dist/sdk/actions/payment-action-provider.d.ts +22 -0
- package/dist/sdk/actions/payment-action-provider.js +26 -0
- package/dist/sdk/actions/payment-action-provider.js.map +1 -0
- package/dist/sdk/actions/session-action-provider.d.ts +1 -1
- package/dist/sdk/actions/session-action-provider.js +1 -1
- package/dist/sdk/actions/session-action-provider.js.map +1 -1
- package/dist/sdk/actions/shipping-action-provider.d.ts +1 -1
- package/dist/sdk/actions/shipping-action-provider.js +1 -1
- package/dist/sdk/actions/shipping-action-provider.js.map +1 -1
- package/dist/sdk/actions/types.d.ts +6 -2
- package/dist/sdk/analytics/analytics-destination.d.ts +43 -0
- package/dist/sdk/analytics/analytics-destination.js +90 -0
- package/dist/sdk/analytics/analytics-destination.js.map +1 -0
- package/dist/sdk/analytics/use-analytics-actions.d.ts +57 -0
- package/dist/sdk/analytics/use-analytics-actions.js +108 -0
- package/dist/sdk/analytics/use-analytics-actions.js.map +1 -0
- package/dist/sdk/cache/storefront-cache.js +1 -1
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/operations.d.ts +4 -4
- package/dist/sdk/cart/operations.js +1 -1
- package/dist/sdk/cart/operations.js.map +1 -1
- package/dist/sdk/cart/optimistic.js +1 -1
- package/dist/sdk/cart/optimistic.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.d.ts +1 -1
- package/dist/sdk/cart/use-cart-actions.js +4 -4
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
- package/dist/sdk/cart/write-gate.js +1 -1
- package/dist/sdk/cart/write-gate.js.map +1 -1
- package/dist/sdk/data/entity-resolution-context.js +31 -0
- package/dist/sdk/data/entity-resolution-context.js.map +1 -0
- package/dist/sdk/data/entity-subscriber.js +18 -8
- package/dist/sdk/data/entity-subscriber.js.map +1 -1
- package/dist/sdk/data/index.js +1 -0
- package/dist/sdk/data/page-reactive-data-root.d.ts +38 -2
- package/dist/sdk/data/page-reactive-data-root.js +4 -2
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/reactive-data-provider.d.ts +1 -1
- package/dist/sdk/data/reactive-data-provider.js +8 -4
- package/dist/sdk/data/reactive-data-provider.js.map +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.d.ts +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.js +13 -5
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -1
- package/dist/sdk/data/use-reactive-data-settled.js +39 -0
- package/dist/sdk/data/use-reactive-data-settled.js.map +1 -0
- package/dist/sdk/data/use-reactive-entity.js +6 -2
- package/dist/sdk/data/use-reactive-entity.js.map +1 -1
- package/dist/sdk/generated/fragment-types.js +2 -0
- package/dist/sdk/generated/fragment-types.js.map +1 -1
- package/dist/sdk/generated/gql.js +2 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.js +85 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/i18n/messages/en-US.js +3 -0
- package/dist/sdk/i18n/messages/en-US.json +3 -0
- package/dist/sdk/i18n/messages/en-US.json.d.ts +3 -0
- package/dist/sdk/i18n/messages/es-ES.js +3 -0
- package/dist/sdk/i18n/messages/es-ES.json +3 -0
- package/dist/sdk/i18n/messages/pt-BR.js +3 -0
- package/dist/sdk/i18n/messages/pt-BR.json +3 -0
- package/dist/sdk/identity/operations.js.map +1 -1
- package/dist/sdk/identity/use-identity-actions.d.ts +1 -1
- package/dist/sdk/identity/use-identity-actions.js +3 -2
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/payment/gateway-origin.js +35 -0
- package/dist/sdk/payment/gateway-origin.js.map +1 -0
- package/dist/sdk/payment/gateway.d.ts +85 -0
- package/dist/sdk/payment/gateway.js +183 -0
- package/dist/sdk/payment/gateway.js.map +1 -0
- package/dist/sdk/payment/operations.d.ts +52 -0
- package/dist/sdk/payment/operations.js +223 -0
- package/dist/sdk/payment/operations.js.map +1 -0
- package/dist/sdk/payment/security-code-mask.js +71 -0
- package/dist/sdk/payment/security-code-mask.js.map +1 -0
- package/dist/sdk/payment/submission-registry.d.ts +33 -0
- package/dist/sdk/payment/submission-registry.js +58 -0
- package/dist/sdk/payment/submission-registry.js.map +1 -0
- package/dist/sdk/payment/use-payment-actions.d.ts +78 -0
- package/dist/sdk/payment/use-payment-actions.js +276 -0
- package/dist/sdk/payment/use-payment-actions.js.map +1 -0
- package/dist/sdk/payment/use-place-order.d.ts +65 -0
- package/dist/sdk/payment/use-place-order.js +640 -0
- package/dist/sdk/payment/use-place-order.js.map +1 -0
- package/dist/sdk/session/auth-operations.d.ts +1 -1
- package/dist/sdk/session/auth-operations.js.map +1 -1
- package/dist/sdk/session/use-session-actions.d.ts +1 -1
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/session/use-session-revalidation.js +65 -0
- package/dist/sdk/session/use-session-revalidation.js.map +1 -0
- package/dist/sdk/shipping/option-select-operations.d.ts +1 -1
- package/dist/sdk/shipping/option-select-operations.js.map +1 -1
- package/dist/sdk/shipping/request-timeout.js +1 -1
- package/dist/sdk/shipping/request-timeout.js.map +1 -1
- package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
- package/dist/sdk/shipping/shipping-operations.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.d.ts +2 -2
- package/dist/sdk/shipping/use-shipping-actions.js +1 -1
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/state/cart.d.ts +3 -4
- package/dist/sdk/state/cart.js +6 -7
- package/dist/sdk/state/cart.js.map +1 -1
- package/dist/utils/loggable-error-name.js +49 -0
- package/dist/utils/loggable-error-name.js.map +1 -0
- package/dist/utils/resolve-authored-copy.js +18 -0
- package/dist/utils/resolve-authored-copy.js.map +1 -0
- package/dist/utils/safe-href.js +3 -3
- package/dist/utils/safe-href.js.map +1 -1
- package/dist/utils/substitute-template.js +33 -0
- package/dist/utils/substitute-template.js.map +1 -0
- package/package.json +2 -1
- package/src/styles/tailwind.css +34 -0
- package/dist/docs/client-profile-form.md +0 -192
- package/dist/matter/client-profile-form/client-profile-form.d.ts +0 -126
- package/dist/matter/client-profile-form/client-profile-form.js +0 -662
- package/dist/matter/client-profile-form/client-profile-form.js.map +0 -1
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# AccountMenu
|
|
2
|
+
|
|
3
|
+
**Category:** navigation
|
|
4
|
+
**Purpose:** The account's section list — a navigation landmark listing the sections a merchant configured, with the one the shopper is reading announced.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Visual cues (how to identify in an image)
|
|
9
|
+
|
|
10
|
+
- A column of text links down the left of an account page, beside the section's own content.
|
|
11
|
+
- One entry stands out — heavier weight, a filled row, a rule down one edge — and it is the section the page is showing.
|
|
12
|
+
- On a narrow screen the same entries read as a single horizontal row of pills above the content, scrolling sideways rather than collapsing behind a control.
|
|
13
|
+
- Five entries is the untouched default; a different count or a different order is the merchant's configuration, not a different component.
|
|
14
|
+
|
|
15
|
+
The image is the source of truth for layout.
|
|
16
|
+
|
|
17
|
+
## When to use
|
|
18
|
+
|
|
19
|
+
- For the account's persistent section navigation, composed once in the `my-account` layout.
|
|
20
|
+
|
|
21
|
+
## When NOT to use
|
|
22
|
+
|
|
23
|
+
- For a general navigation list with no current-section marking → use [[navigation-link-list]].
|
|
24
|
+
- For the trail down to a deep page → use `BreadcrumbRoot`, which keeps the "current page" claim.
|
|
25
|
+
- For the header's sign-in / account control → use [[account-entry-point]].
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Composition
|
|
30
|
+
|
|
31
|
+
Two parts, and the split is the point. `AccountMenuRoot` is the provider and `AccountMenuList` is the landmark.
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
AccountMenuRoot
|
|
35
|
+
├── AccountMenuList
|
|
36
|
+
└── Slot ← the section's own page
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**The Root wraps the section's content; the landmark does not.** The Root's context has to reach consumers that live inside the slot — the account root's redirect, the sibling breadcrumb — and a context reaches only its descendants. A `<nav>` stretched that far would put every section's content inside a navigation region: a screen reader would announce the page as navigation and "skip to navigation" would skip nothing. So the Root wraps, and the `<nav>` stays around the items alone.
|
|
40
|
+
|
|
41
|
+
The sidebar still renders visually beside the section. That is the swatches' business, not the tree's.
|
|
42
|
+
|
|
43
|
+
## Components
|
|
44
|
+
|
|
45
|
+
### AccountMenuRoot
|
|
46
|
+
|
|
47
|
+
| Prop | Type | Default | Notes |
|
|
48
|
+
|------|------|---------|-------|
|
|
49
|
+
| `items` | `{ label, href, external? }[]` | the library's five | Authored fallback, used when no CMS entry supplies a list. |
|
|
50
|
+
| `children` | ReactNode | — | The landmark and the section's slot. |
|
|
51
|
+
|
|
52
|
+
Content model (`account-menu`) fields, edited in the CMS:
|
|
53
|
+
|
|
54
|
+
| Field | Type | Required | Notes |
|
|
55
|
+
|-------|------|----------|-------|
|
|
56
|
+
| `items` | array | no | One entry per section, in the order they should appear |
|
|
57
|
+
| `items[].label` | string | yes | The section's name |
|
|
58
|
+
| `items[].href` | string | yes | Its destination; `http(s)`, `mailto:`, `tel:`, or a site-relative path |
|
|
59
|
+
| `items[].external` | boolean | no | The entry leaves the account; it is never marked current |
|
|
60
|
+
|
|
61
|
+
**The list comes from three channels, in order: a published entry, the authored `items` prop, then the library's five.** The default is Profile, Orders, Address, Payments, and Security, at `/account/profile` and its siblings — the set the PRD names. Presence decides, not emptiness: a channel supplying an empty list resolves to empty rather than falling through, because a merchant who cleared the list cleared it and the defaults must not override a deliberate publication.
|
|
62
|
+
|
|
63
|
+
**The current section is derived, never authored.** The component reads the current path and matches each entry's destination on segment boundaries. At most one entry is current: among the matches, the one with the longest destination wins, which makes an exact match beat every ancestor without a second rule. `/account/order` is not a match for `/account/orders` — a prefix that does not land on a segment boundary is not a match at all.
|
|
64
|
+
|
|
65
|
+
**An exact match announces `aria-current="page"`; an ancestor match announces `aria-current="true"`.** Inside `/account/orders/123`, Orders is the current item of its set but not the current page. That claim belongs to the breadcrumb's deep entry, and two surfaces announcing "current page" for two different things is worse than the menu claiming only its set.
|
|
66
|
+
|
|
67
|
+
Two kinds of entry are excluded from the match entirely: one marked `external`, and one whose destination is not site-relative. A destination of `/` is excluded from ancestor matching alone — a root destination is an ancestor of every account path, so a merchant listing the storefront's home beside the sections would otherwise see it current on every page. It still matches the path `/` exactly.
|
|
68
|
+
|
|
69
|
+
**V0 assumes the store's public paths carry no binding prefix.** The generated tree lives under a binding segment and a rewrite carries the unprefixed path inward, so the path the component reads matches the destination the merchant published. A store whose public base path *is* its binding id makes the prefixed URL canonical, and then no entry meets a segment boundary and nothing is current. The shipped `AccountEntryPoint` has the same exposure, so this is pre-existing rather than introduced here.
|
|
70
|
+
|
|
71
|
+
### AccountMenuList
|
|
72
|
+
|
|
73
|
+
| Prop | Type | Default | Notes |
|
|
74
|
+
|------|------|---------|-------|
|
|
75
|
+
| `label` | string | `'Account'` | Accessible name of the navigation landmark. |
|
|
76
|
+
|
|
77
|
+
It takes no children: one `<li>` per resolved section is what it renders. With no sections to render it renders nothing at all, rather than an empty landmark for a screen-reader user to land in.
|
|
78
|
+
|
|
79
|
+
**The current item is brought into view when the list scrolls.** A horizontally scrolling row can start with the current item outside the viewport — the fifth section of five leaves the shopper opening the page with no idea which one they are in. So on mount and on every route change, a current item in an overflowing list is scrolled into view. It is a no-op when the item is already visible, and it does not run at all when the list fits, since an unconditional scroll would move the page instead.
|
|
80
|
+
|
|
81
|
+
A refused destination keeps its label and loses its anchor, rendering as text under `data-fs-account-menu-text`. A blank label drops the entry outright: an anchor with no accessible name is a WCAG failure.
|
|
82
|
+
|
|
83
|
+
### useAccountMenu()
|
|
84
|
+
|
|
85
|
+
Returns `{ items, current }` — the resolved sections and the current one as `{ index, match }`. It throws outside an `AccountMenuRoot`. This is the contract the account root's redirect and the sibling breadcrumb read, so the two surfaces cannot disagree about which section is current.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Canonical schema example
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"account-menu": {
|
|
94
|
+
"type": "AccountMenuRoot",
|
|
95
|
+
"children": ["account-menu-list", "account-slot"],
|
|
96
|
+
"style": ["$account-menu"]
|
|
97
|
+
},
|
|
98
|
+
"account-menu-list": {
|
|
99
|
+
"type": "AccountMenuList",
|
|
100
|
+
"props": { "label": "Minha conta" },
|
|
101
|
+
"style": ["$account-menu-list"]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Bound to a CMS entry, the Root authors no `items` at all — the entry supplies the whole list.
|
|
107
|
+
|
|
108
|
+
## Common mistakes
|
|
109
|
+
|
|
110
|
+
- **Placing the Root beside the slot instead of around it.** The layout's own consumers would be satisfied and the page's would not: a context reaches only descendants. Context-constraint validation reports it as a build error rather than as an empty menu at runtime.
|
|
111
|
+
- **Putting the `<nav>` around the section's content.** That is what the two-part split exists to prevent; do not wrap the slot in `AccountMenuList`.
|
|
112
|
+
- **Leaving `label` unauthored.** The default is `Account`; a store with its own wording should say so, because a landmark's name is how a screen-reader user tells it from every other one.
|
|
113
|
+
- **Styling the current item and nothing else.** The hook exists beside `aria-current`, never instead of it. Removing the programmatic signal leaves position conveyed by appearance alone.
|
|
114
|
+
- **Publishing an empty list and expecting the defaults.** Empty is a configuration, not an absence. The account's root then has no section to open.
|
|
115
|
+
- **Authoring `$content` in the schema.** `$content` is compiler-injected from the page's or layout's content entry; naming it in `props` fails the build.
|
|
116
|
+
- **Expecting the default five to resolve.** Their routes exist only in a store that authored the account's route family; until then the default is correct in the example store alone.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Styling
|
|
121
|
+
|
|
122
|
+
| Component | What you style | Plausible classes |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| `AccountMenuRoot` | `data-fs-account-menu` is the wrapper holding the sidebar and the section side by side | `flex gap-8 md:flex-row flex-col` |
|
|
125
|
+
| `AccountMenuList` | `data-fs-account-menu-list` is the landmark; size the sidebar here | `w-56 shrink-0` |
|
|
126
|
+
| Items | `data-fs-account-menu-items` is the `<ul>`, and the scroll container at narrow viewports | `flex flex-col gap-1` |
|
|
127
|
+
| Item | `data-fs-account-menu-item` is one row | `list-none` |
|
|
128
|
+
| Current item | `data-fs-account-menu-item-current` marks the current row | `font-semibold` |
|
|
129
|
+
| Link | `data-fs-account-menu-link` is the anchor | `block rounded-md px-3 py-2 text-sm` |
|
|
130
|
+
| Refused text | `data-fs-account-menu-text` replaces the anchor for a refused destination | `block px-3 py-2 text-gray-400` |
|
|
131
|
+
|
|
132
|
+
The vertical-to-horizontal switch and the scroll affordance are one DOM styled two ways, authored as the `AccountMenu` swatch set in `global.json → styles`:
|
|
133
|
+
|
|
134
|
+
```json
|
|
135
|
+
{
|
|
136
|
+
"AccountMenuRoot": {
|
|
137
|
+
"account-menu": [
|
|
138
|
+
"flex",
|
|
139
|
+
"flex-col",
|
|
140
|
+
"gap-6",
|
|
141
|
+
"md:flex-row",
|
|
142
|
+
"md:gap-8",
|
|
143
|
+
"[&_[data-fs-account-menu-items]]:flex",
|
|
144
|
+
"[&_[data-fs-account-menu-items]]:gap-2",
|
|
145
|
+
"[&_[data-fs-account-menu-items]]:overflow-x-auto",
|
|
146
|
+
"md:[&_[data-fs-account-menu-items]]:flex-col",
|
|
147
|
+
"md:[&_[data-fs-account-menu-items]]:overflow-visible",
|
|
148
|
+
"[&_[data-fs-account-menu-item-current]_[data-fs-account-menu-link]]:bg-gray-100",
|
|
149
|
+
"[&_[data-fs-account-menu-item-current]_[data-fs-account-menu-link]]:font-semibold"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
The current-item look reaches the anchor through the row, since the hook is on the `<li>` and the anchor is its child.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Related
|
|
160
|
+
|
|
161
|
+
- [[account-entry-point]] — the header control that links into the account.
|
|
162
|
+
- [[navigation-link]] — the client-side link each item composes.
|
|
163
|
+
- [[navigation-link-list]] — the general-purpose CMS-driven list this one is patterned on.
|
|
164
|
+
- `BreadcrumbRoot` — the sibling trail that keeps the "current page" claim for the deep page.
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
|-----------|-------|-------|
|
|
18
18
|
| `AddressSummaryRoot` | `address: AddressSummaryFields` (required), `children?: ReactNode` | Provides the address to descendant components via context (no business coupling). Must wrap `AddressSummary` or another presentation component. |
|
|
19
19
|
| `AddressSummary` | `className?: string`, `children?: ReactNode` | Read-only formatted display: recipient name, street/number/complement, neighborhood/city/state/postal code. Lines with no content are omitted. Composed `children` render inside the container in place of the default lines. Must be a descendant of `AddressSummaryRoot`. |
|
|
20
|
+
| `AddressSummaryName` | `className?: string` | The shopper's own label for the address, or nothing when there is none. Not part of the default composition. Must be a descendant of `AddressSummaryRoot`. |
|
|
21
|
+
| `AddressSummaryCountry` | `className?: string` | The address's country, shown exactly as provided, or nothing when there is none. Not part of the default composition. Must be a descendant of `AddressSummaryRoot`. |
|
|
22
|
+
| `AddressSummaryField` | `field: AddressSummaryFieldKey` (required), `className?: string` | One address field, rendered inline (`<span>`), or nothing when it is empty. `field` is one of `recipientName`, `name`, `street`, `number`, `complement`, `neighborhood`, `city`, `state`, `postalCode`, `country`, `reference`. Compose several to build a line in a country's own order, e.g. number before street. Not part of the default composition. Must be a descendant of `AddressSummaryRoot`. |
|
|
20
23
|
|
|
21
24
|
---
|
|
22
25
|
|
|
@@ -32,6 +35,21 @@ or only one of them, composes the leaves instead:
|
|
|
32
35
|
| `AddressSummaryStreet` | street, number, complement | all three absent |
|
|
33
36
|
| `AddressSummaryLocality` | neighborhood, city, state, postal code | all absent |
|
|
34
37
|
|
|
38
|
+
Three more parts compose beside these, none of which join the default: `AddressSummaryName` and
|
|
39
|
+
`AddressSummaryCountry` are whole lines like the leaves above, and `AddressSummaryField` renders a single
|
|
40
|
+
field inline so a consumer can assemble a line in another order — a United States address writes its number
|
|
41
|
+
before its street, which no whole-line part can produce.
|
|
42
|
+
|
|
43
|
+
| Part | Renders | Nothing when |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `AddressSummaryName` | the shopper's own label for the address | no name |
|
|
46
|
+
| `AddressSummaryCountry` | the country, exactly as provided | no country |
|
|
47
|
+
| `AddressSummaryField` | one field, inline (`<span data-fs-address-summary-field="<key>">`) | that field is absent |
|
|
48
|
+
|
|
49
|
+
`AddressSummaryCountry` shows whatever value it is given. The checkout's address stores an ISO alpha-3 code
|
|
50
|
+
(e.g. `BRA`), and `Intl.DisplayNames` rejects alpha-3 codes, so a consumer that wants a country name rather
|
|
51
|
+
than a code converts it before providing the address — this particle has no locale dependency of its own.
|
|
52
|
+
|
|
35
53
|
## Known gaps
|
|
36
54
|
|
|
37
55
|
Found by review and deliberately left for the dedicated revision of these components.
|
|
@@ -41,9 +59,12 @@ Found by review and deliberately left for the dedicated revision of these compon
|
|
|
41
59
|
outside an `AddressSummaryRoot` renders an empty styled block instead of failing loudly, while the
|
|
42
60
|
definition still declares `requiresContext: 'address-summary'` — the declared contract and the runtime
|
|
43
61
|
check no longer agree.
|
|
44
|
-
- **`AddressSummaryRecipient`, `AddressSummaryStreet
|
|
45
|
-
|
|
46
|
-
`
|
|
62
|
+
- **`AddressSummaryRecipient`, `AddressSummaryStreet`, `AddressSummaryLocality`, `AddressSummaryName`,
|
|
63
|
+
`AddressSummaryCountry` and `AddressSummaryField` have no story of their own.** Each is registered in the
|
|
64
|
+
catalog and covered by `address-summary.test.tsx` (the first three also indirectly through
|
|
65
|
+
`shipping-address.test.tsx`), and the three new ones also appear inside `NamedWithCountry` and
|
|
66
|
+
`UsFieldOrder`, but none has the isolated, one-component-per-story coverage the `create-base-component`
|
|
67
|
+
contract asks for.
|
|
47
68
|
|
|
48
69
|
## Extensibility
|
|
49
70
|
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# AlertDialog
|
|
2
|
+
|
|
3
|
+
**Category:** layout
|
|
4
|
+
**Purpose:** Confirmation prompt for an irreversible action. Wraps Base UI's Alert Dialog to give an overlay with the `alertdialog` role that is always modal and never closes on an outside click, so a stray click cannot answer the question. Composed like `Dialog`; the confirm control is a separate `Button`.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Visual cues (how to identify in an image)
|
|
9
|
+
|
|
10
|
+
An AlertDialog is present only when the image shows a **prompt that is already open**: the page behind it is **dimmed**, and a **small centered card** sits over it holding a **question as its heading** (for example "Delete this address?"), **one sentence of consequence**, and **two buttons** side by side, a plain **Cancel** and a **destructive confirm** that is often red.
|
|
11
|
+
|
|
12
|
+
It is an overlay that appears after a click, not a region of the page. A static screenshot of a page rarely contains one, so do not add it "just in case". Compose it only when the image shows the open prompt, or when a design note names a confirmation step.
|
|
13
|
+
|
|
14
|
+
Tell it apart from a `Dialog` by the question: an AlertDialog asks for an answer about something that cannot be undone, and offers no close icon in the corner and no way out except its own buttons. The image is the source of truth for layout.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## When to use
|
|
19
|
+
|
|
20
|
+
- Confirming an **irreversible or destructive** action: deleting a saved address, removing a saved payment method, cancelling an order.
|
|
21
|
+
- Any prompt where **accidentally dismissing it must not count as an answer**: the shopper has to choose Cancel or Confirm, or press Escape on purpose.
|
|
22
|
+
|
|
23
|
+
## When NOT to use
|
|
24
|
+
|
|
25
|
+
- **An informational overlay, a form, or a prompt that a click outside may safely close** — use `Dialog`.
|
|
26
|
+
- **A side panel such as the mini-cart or the mobile menu** — use `Drawer`.
|
|
27
|
+
- **A reversible action** — apply it and offer undo; a confirmation for something that can be undone is friction.
|
|
28
|
+
- **A non-blocking tip or a small anchored panel** — use `Popover` or a non-modal `Dialog`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Composition
|
|
33
|
+
|
|
34
|
+
`AlertDialogRoot` provides the open state to its descendants. The trigger and the portal are its two children; everything visible lives under the portal.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
AlertDialogRoot
|
|
38
|
+
├── AlertDialogTrigger (sibling of the portal, not inside it)
|
|
39
|
+
└── AlertDialogPortal (teleports its children to <body>)
|
|
40
|
+
├── AlertDialogBackdrop (before the viewport)
|
|
41
|
+
└── AlertDialogViewport (positions the popup)
|
|
42
|
+
└── AlertDialogPopup (the visible prompt, role alertdialog)
|
|
43
|
+
├── AlertDialogTitle (required)
|
|
44
|
+
├── AlertDialogDescription (the consequence)
|
|
45
|
+
├── AlertDialogClose (Cancel)
|
|
46
|
+
└── Button (the confirm control)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Composition rules:**
|
|
50
|
+
|
|
51
|
+
- `AlertDialogBackdrop` comes before `AlertDialogViewport`, both as direct children of the portal.
|
|
52
|
+
- `AlertDialogTitle` is required: it is the prompt's accessible name.
|
|
53
|
+
- **Focus starts on the first focusable element in the popup, except on touch.** Put the Cancel control first among the popup's children so the safe action is the default for a mouse or the keyboard. When the prompt is opened by touch, Base UI focuses the popup itself instead, which keeps the virtual keyboard from opening on Android. Cancel is not focused there, and neither is a destructive control. A schema cannot change that: only code can pass `initialFocus`, which gives Cancel the focus for every kind of interaction. Focus order follows the children order; the layout classes decide where each button appears.
|
|
54
|
+
- The confirm control is a plain `Button`. The particle has no confirm part and runs no action: whatever the confirmation does is wired by the component that owns the prompt, not by the schema.
|
|
55
|
+
- Child order reflects visual order, apart from the focus rule above.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Components
|
|
60
|
+
|
|
61
|
+
### AlertDialogRoot
|
|
62
|
+
|
|
63
|
+
Provides the open state. Context-only: it renders no element of its own and takes no `className`, so it has no styling surface.
|
|
64
|
+
|
|
65
|
+
No schema props. Components that open the prompt from code can control it with `open`, `defaultOpen`, and `onOpenChange` (the same signature as `Dialog`). There is **no `modal` prop**: an alert dialog is always modal.
|
|
66
|
+
|
|
67
|
+
### AlertDialogTrigger
|
|
68
|
+
|
|
69
|
+
The button that opens the prompt. Direct child of `AlertDialogRoot`. Accepts any children.
|
|
70
|
+
|
|
71
|
+
No props.
|
|
72
|
+
|
|
73
|
+
### AlertDialogPortal
|
|
74
|
+
|
|
75
|
+
Teleports its children to `<body>`. Context-only: no element of its own and no `className`.
|
|
76
|
+
|
|
77
|
+
No props.
|
|
78
|
+
|
|
79
|
+
### AlertDialogBackdrop
|
|
80
|
+
|
|
81
|
+
The dimmed layer behind the popup. Clicking it does **not** close the prompt.
|
|
82
|
+
|
|
83
|
+
No props.
|
|
84
|
+
|
|
85
|
+
### AlertDialogViewport
|
|
86
|
+
|
|
87
|
+
A positioning container for the popup. Where the fixed positioning and centering go.
|
|
88
|
+
|
|
89
|
+
No props.
|
|
90
|
+
|
|
91
|
+
### AlertDialogPopup
|
|
92
|
+
|
|
93
|
+
The visible prompt, with `role="alertdialog"`. Holds the title, the description, the cancel control, and the confirm control.
|
|
94
|
+
|
|
95
|
+
No schema props. Code can pass `initialFocus` and `finalFocus` (a ref, a boolean, or a function) to choose where focus lands on open and on close. `initialFocus` is the only way to put focus on Cancel when the prompt is opened by touch, since the default there is the popup itself. Both take a ref, so a schema cannot express them: put Cancel first among the children, which covers a mouse and the keyboard.
|
|
96
|
+
|
|
97
|
+
### AlertDialogTitle
|
|
98
|
+
|
|
99
|
+
The prompt's heading, an `<h2>`. Required for the accessible name. State the question.
|
|
100
|
+
|
|
101
|
+
No props.
|
|
102
|
+
|
|
103
|
+
### AlertDialogDescription
|
|
104
|
+
|
|
105
|
+
A paragraph read out with the prompt. State the consequence of confirming.
|
|
106
|
+
|
|
107
|
+
No props.
|
|
108
|
+
|
|
109
|
+
### AlertDialogClose
|
|
110
|
+
|
|
111
|
+
Closes the prompt. Use it for the Cancel control. Several can appear.
|
|
112
|
+
|
|
113
|
+
No props.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Canonical schema example
|
|
118
|
+
|
|
119
|
+
A delete-address confirmation. The confirm `Button` is inert here: in a store, the matter that owns the destructive action wires it.
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"delete-prompt": { "type": "AlertDialogRoot", "children": ["delete-trigger", "delete-portal"] },
|
|
124
|
+
"delete-trigger": {
|
|
125
|
+
"type": "AlertDialogTrigger",
|
|
126
|
+
"props": { "children": "Delete address" },
|
|
127
|
+
"style": ["px-[16px]", "py-[8px]", "text-[14px]", "font-medium", "text-[#B42318]", "border", "border-[#FDA29B]", "rounded-[6px]"]
|
|
128
|
+
},
|
|
129
|
+
"delete-portal": { "type": "AlertDialogPortal", "children": ["delete-backdrop", "delete-viewport"] },
|
|
130
|
+
"delete-backdrop": { "type": "AlertDialogBackdrop", "style": ["fixed", "inset-0", "bg-black/40"] },
|
|
131
|
+
"delete-viewport": {
|
|
132
|
+
"type": "AlertDialogViewport",
|
|
133
|
+
"style": ["fixed", "inset-0", "flex", "items-center", "justify-center", "p-[16px]"],
|
|
134
|
+
"children": ["delete-popup"]
|
|
135
|
+
},
|
|
136
|
+
"delete-popup": {
|
|
137
|
+
"type": "AlertDialogPopup",
|
|
138
|
+
"style": ["flex", "flex-col", "gap-[8px]", "w-full", "max-w-[448px]", "p-[24px]", "bg-white", "rounded-[12px]", "shadow-xl"],
|
|
139
|
+
"children": ["delete-title", "delete-description", "delete-actions"]
|
|
140
|
+
},
|
|
141
|
+
"delete-title": {
|
|
142
|
+
"type": "AlertDialogTitle",
|
|
143
|
+
"props": { "children": "Delete this address?" },
|
|
144
|
+
"style": ["text-[18px]", "font-semibold", "text-[#101828]"]
|
|
145
|
+
},
|
|
146
|
+
"delete-description": {
|
|
147
|
+
"type": "AlertDialogDescription",
|
|
148
|
+
"props": { "children": "It stops being offered at checkout. This cannot be undone." },
|
|
149
|
+
"style": ["text-[14px]", "text-[#667085]"]
|
|
150
|
+
},
|
|
151
|
+
"delete-actions": {
|
|
152
|
+
"type": "Container",
|
|
153
|
+
"style": ["flex", "justify-end", "gap-[12px]", "mt-[16px]"],
|
|
154
|
+
"children": ["delete-cancel", "delete-confirm"]
|
|
155
|
+
},
|
|
156
|
+
"delete-cancel": {
|
|
157
|
+
"type": "AlertDialogClose",
|
|
158
|
+
"props": { "children": "Cancel" },
|
|
159
|
+
"style": ["px-[16px]", "py-[8px]", "text-[14px]", "font-medium", "text-[#344054]", "border", "border-[#D0D5DD]", "rounded-[6px]"]
|
|
160
|
+
},
|
|
161
|
+
"delete-confirm": {
|
|
162
|
+
"type": "Button",
|
|
163
|
+
"props": { "children": "Delete" },
|
|
164
|
+
"style": ["px-[16px]", "py-[8px]", "text-[14px]", "font-medium", "text-white", "bg-[#D92D20]", "rounded-[6px]"]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Common mistakes
|
|
172
|
+
|
|
173
|
+
- **`AlertDialogContent`, `AlertDialogHeader`, `AlertDialogFooter`, `AlertDialogAction`, or `AlertDialogCancel`.** None exist. The prompt is `AlertDialogPopup`, Cancel is `AlertDialogClose`, and the confirm control is a plain `Button`.
|
|
174
|
+
- **Looking for a `modal` prop, or a way to close on a backdrop click.** An alert dialog is always modal and ignores outside clicks. Use `Dialog` if the overlay should close on one.
|
|
175
|
+
- **Leaving out `AlertDialogTitle`.** The prompt then has no accessible name.
|
|
176
|
+
- **Putting the confirm `Button` first.** With a mouse or the keyboard, focus starts on the first focusable element, so a destructive control first makes Delete the default. Put Cancel first. On touch, focus starts on the popup itself either way.
|
|
177
|
+
- **Putting `AlertDialogTrigger` inside `AlertDialogPortal`.** The trigger is a child of the root, beside the portal.
|
|
178
|
+
- **Styling `AlertDialogRoot` or `AlertDialogPortal`.** They render no element and take no `style`. Style the backdrop, the viewport, and the popup.
|
|
179
|
+
- **Expecting the schema to run the deletion.** A `Button` in a schema is inert; the owning component wires the confirm action.
|
|
180
|
+
- **Using it for anything reversible or merely informational.** That is a `Dialog`.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Styling
|
|
185
|
+
|
|
186
|
+
| Component | What you style | Plausible classes |
|
|
187
|
+
|---|---|---|
|
|
188
|
+
| `AlertDialogTrigger` | The button that opens the prompt | `px-[16px] py-[8px] text-[14px] font-medium text-[#B42318] border border-[#FDA29B] rounded-[6px]` |
|
|
189
|
+
| `AlertDialogBackdrop` | The dimmed layer over the page | `fixed inset-0 bg-black/40` |
|
|
190
|
+
| `AlertDialogViewport` | Fixed positioning and centering of the popup | `fixed inset-0 flex items-center justify-center p-[16px]` |
|
|
191
|
+
| `AlertDialogPopup` | The card: layout, background, radius, shadow, and its enter and exit | `flex flex-col gap-[8px] w-full max-w-[448px] p-[24px] bg-white rounded-[12px] shadow-xl data-[starting-style]:opacity-0 data-[ending-style]:opacity-0` |
|
|
192
|
+
| `AlertDialogTitle` | The question | `text-[18px] font-semibold text-[#101828]` |
|
|
193
|
+
| `AlertDialogDescription` | The consequence line | `text-[14px] text-[#667085]` |
|
|
194
|
+
| `AlertDialogClose` | The Cancel control | `px-[16px] py-[8px] text-[14px] font-medium text-[#344054] border border-[#D0D5DD] rounded-[6px]` |
|
|
195
|
+
|
|
196
|
+
`AlertDialogRoot` and `AlertDialogPortal` have no styling surface. Base UI sets `data-open`, `data-closed`, `data-starting-style`, and `data-ending-style` on the popup and the backdrop, so enter and exit animations key on those attributes.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Related
|
|
201
|
+
|
|
202
|
+
- `Dialog` — the general overlay, which a click outside may close. Use it for forms and information; use AlertDialog when the answer matters.
|
|
203
|
+
- `Drawer` — a side panel for the mini-cart and the mobile menu, not a confirmation.
|
|
204
|
+
- `Button` — the confirm control inside the popup.
|