@sonic-equipment/ui 157.0.0 → 159.0.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.
Files changed (85) hide show
  1. package/dist/algolia/algolia-sort-by.js +1 -1
  2. package/dist/buttons/add-to-cart-button/add-to-cart-button.js +8 -11
  3. package/dist/buttons/add-to-cart-button/add-to-cart-button.module.css.js +1 -1
  4. package/dist/cards/orderline-card/orderline-card.js +1 -2
  5. package/dist/cards/product-card/connected-product-card.d.ts +2 -2
  6. package/dist/cards/product-card/product-card.js +1 -2
  7. package/dist/cards/product-card/product-card.module.css.js +1 -1
  8. package/dist/cart-totals/cart-totals.js +1 -1
  9. package/dist/country-select/country-select.d.ts +1 -0
  10. package/dist/country-select/country-select.js +3 -3
  11. package/dist/exports.d.ts +13 -1
  12. package/dist/filters/pagination/pagination.js +3 -1
  13. package/dist/forms/checkbox/checkbox.d.ts +13 -4
  14. package/dist/forms/checkbox/checkbox.js +6 -2
  15. package/dist/forms/checkbox/checkbox.module.css.js +1 -1
  16. package/dist/forms/checkbox-field/checkbox-field.d.ts +10 -0
  17. package/dist/forms/checkbox-field/checkbox-field.js +16 -0
  18. package/dist/forms/checkbox-field/checkbox-field.module.css.js +3 -0
  19. package/dist/forms/color-checkbox/color-checkbox.d.ts +5 -3
  20. package/dist/forms/color-checkbox/color-checkbox.js +7 -3
  21. package/dist/forms/form/form-field-layout.d.ts +10 -0
  22. package/dist/forms/form/form-field-layout.js +10 -0
  23. package/dist/forms/form/form-field-layout.module.css.js +3 -0
  24. package/dist/forms/form/form-segment-group.d.ts +6 -0
  25. package/dist/forms/form/form-segment-group.js +13 -0
  26. package/dist/forms/form/form-segment-group.module.css.js +3 -0
  27. package/dist/forms/form/form-segment.d.ts +6 -0
  28. package/dist/forms/form/form-segment.js +9 -0
  29. package/dist/forms/form/form-segment.module.css.js +3 -0
  30. package/dist/forms/form/form.d.ts +16 -0
  31. package/dist/forms/form/form.js +27 -0
  32. package/dist/forms/form/form.module.css.js +3 -0
  33. package/dist/forms/input/input.d.ts +2 -0
  34. package/dist/forms/input/input.js +2 -2
  35. package/dist/forms/label/label.js +1 -1
  36. package/dist/forms/number-field/number-field.d.ts +9 -9
  37. package/dist/forms/number-field/number-field.js +18 -14
  38. package/dist/forms/number-field/number-field.module.css.js +1 -1
  39. package/dist/forms/select/select.js +1 -1
  40. package/dist/forms/select-field/select-field.d.ts +27 -0
  41. package/dist/forms/select-field/select-field.js +31 -0
  42. package/dist/forms/select-field/select-field.module.css.js +3 -0
  43. package/dist/forms/switch/switch.d.ts +12 -4
  44. package/dist/forms/switch/switch.js +6 -2
  45. package/dist/forms/switch/switch.module.css.js +1 -1
  46. package/dist/forms/switch-field/switch-field.d.ts +10 -0
  47. package/dist/forms/switch-field/switch-field.js +18 -0
  48. package/dist/forms/switch-field/switch-field.module.css.js +3 -0
  49. package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.js +1 -1
  50. package/dist/forms/text-field/password-reveal-toggle/password-reveal-toggle.module.css.js +1 -1
  51. package/dist/forms/text-field/text-field.d.ts +32 -20
  52. package/dist/forms/text-field/text-field.js +13 -10
  53. package/dist/forms/text-field/text-field.module.css.js +1 -1
  54. package/dist/forms/textarea/textarea.d.ts +1 -0
  55. package/dist/index.js +14 -2
  56. package/dist/intl/translation-id.d.ts +1 -1
  57. package/dist/pages/account/components/create-account-form/create-account-form.d.ts +11 -0
  58. package/dist/pages/account/components/create-account-form/create-account-form.js +89 -0
  59. package/dist/pages/account/components/create-account-form/create-account-form.module.css.js +3 -0
  60. package/dist/{sign-in-form → pages/account/components/sign-in-form}/sign-in-form.d.ts +3 -3
  61. package/dist/pages/account/components/sign-in-form/sign-in-form.js +71 -0
  62. package/dist/pages/account/components/sign-in-form/sign-in-form.module.css.js +3 -0
  63. package/dist/pages/account/create-account-page/create-account-page.d.ts +3 -0
  64. package/dist/pages/account/create-account-page/create-account-page.js +45 -0
  65. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.d.ts +6 -0
  66. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-background-image.js +9 -0
  67. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.d.ts +1 -1
  68. package/dist/pages/account/layouts/sign-in-page-layout/sign-in-page-layout.js +2 -1
  69. package/dist/pages/account/sign-in-page/sign-in-page.js +3 -10
  70. package/dist/pages/checkout/order-confirmation-page/order-confirmation-page-content.js +1 -1
  71. package/dist/pages/checkout/payment-page/components/payment.js +1 -1
  72. package/dist/pages/checkout/shipping-page/shipping-page-content.js +1 -1
  73. package/dist/pages/checkout/shipping-page/shipping-page.js +1 -1
  74. package/dist/shared/api/storefront/hooks/authentication/use-create-account.d.ts +3 -0
  75. package/dist/shared/api/storefront/hooks/authentication/use-create-account.js +28 -0
  76. package/dist/shared/api/storefront/services/authentication-service.d.ts +23 -0
  77. package/dist/shared/api/storefront/services/authentication-service.js +40 -2
  78. package/dist/shared/hooks/use-script.d.ts +3 -3
  79. package/dist/shared/model/account.d.ts +19 -0
  80. package/dist/shared/model/account.js +4 -0
  81. package/dist/styles.css +844 -613
  82. package/dist/tooltip/tooltip.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/sign-in-form/sign-in-form.js +0 -59
  85. package/dist/sign-in-form/sign-in-form.module.css.js +0 -3
@@ -23,7 +23,7 @@ function AlgoliaSortBy() {
23
23
  acc[option.value] = option.label;
24
24
  return acc;
25
25
  }, {});
26
- return (jsx(Select, { label: t('Sort by'), onChange: value => refine(String(value)), options: options, selectedOption: currentRefinement, showLabel: false, size: "sm" }));
26
+ return (jsx(Select, { label: t('Sort by'), onChange: value => refine(String(value)), options: options, selectedOption: currentRefinement, size: "sm" }));
27
27
  }
28
28
 
29
29
  export { AlgoliaSortBy };
@@ -3,6 +3,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useState, useCallback, useRef, useEffect } from 'react';
4
4
  import { NumberField } from '../../forms/number-field/number-field.js';
5
5
  import { SolidCartIcon } from '../../icons/solid/solid-cart-icon.js';
6
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
6
7
  import { useDebouncedCallback } from '../../shared/hooks/use-debounced-callback.js';
7
8
  import { ensureNumber } from '../../shared/utils/number.js';
8
9
  import { Button } from '../button/button.js';
@@ -38,11 +39,7 @@ function InternalAddToCartButton({ initialState = 'initial', isDisabled = false,
38
39
  }, quantity: quantity }, quantity)), currentState === 'manual-input' && (jsx(ManualInputState, { isDisabled: isDisabled, onCancel: () => setState('spinner'), onConfirm: onChange, quantity: manualInputQuantity || '' }))] }));
39
40
  }
40
41
  function InitialState({ isDisabled, onAddToCart, }) {
41
- return (jsx(Button, { condensed: true, icon: jsx(SolidCartIcon, {}), isDisabled: isDisabled, onClick: e => {
42
- e.preventDefault();
43
- e.stopPropagation();
44
- onAddToCart();
45
- }, size: "md" }));
42
+ return (jsx(Button, { condensed: true, icon: jsx(SolidCartIcon, {}), isDisabled: isDisabled, onClick: onAddToCart, size: "md" }));
46
43
  }
47
44
  function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
48
45
  const [internalQuantity, setInternalQuantity] = useState(quantity);
@@ -59,11 +56,12 @@ function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
59
56
  mounted.current = false;
60
57
  };
61
58
  }, []);
59
+ const t = useFormattedMessage();
62
60
  return (jsx(NumberField, { withButtons: true, autoGrow: true, "data-test-selector": "quantity", formatOptions: {
63
61
  maximumFractionDigits: 0,
64
62
  style: 'decimal',
65
63
  useGrouping: false,
66
- }, isDisabled: isDisabled, label: "Quantity", maxLength: 4, maxValue: 9999, minValue: 0, onChange: quantity => {
64
+ }, isDisabled: isDisabled, label: t('Quantity'), maxLength: 4, maxValue: 9999, minValue: 0, onChange: quantity => {
67
65
  setInternalQuantity(quantity);
68
66
  if (quantity === 0) {
69
67
  mounted.current = false;
@@ -72,7 +70,7 @@ function SpinnerState({ isDisabled, onChange, onManualInput, quantity, }) {
72
70
  onDebouncedChange(quantity);
73
71
  }, onInput: e => {
74
72
  onManualInput(e.target.value);
75
- }, showLabel: false, size: "md", value: internalQuantity }));
73
+ }, size: "md", value: internalQuantity }));
76
74
  }
77
75
  function ManualInputState({ isDisabled, onCancel, onConfirm, quantity, }) {
78
76
  const [updatedQuantity, setQuantity] = useState(quantity);
@@ -82,13 +80,12 @@ function ManualInputState({ isDisabled, onCancel, onConfirm, quantity, }) {
82
80
  if (e.key === 'Escape')
83
81
  onCancel();
84
82
  };
85
- return (jsxs("div", { className: styles['manual-input-container'], children: [jsx("div", { className: styles['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, "data-test-selector": "quantity", defaultValue: quantity ? ensureNumber(quantity, 0) : undefined, formatOptions: {
83
+ const t = useFormattedMessage();
84
+ return (jsxs("div", { className: styles['manual-input-container'], children: [jsx(NumberField, { autoFocus: true, autoGrow: true, "data-test-selector": "quantity", defaultValue: quantity ? ensureNumber(quantity, 0) : undefined, formatOptions: {
86
85
  maximumFractionDigits: 0,
87
86
  style: 'decimal',
88
87
  useGrouping: false,
89
- }, isDisabled: isDisabled, label: "Quantity", maxLength: 4, maxValue: 9999, minValue: 0, name: "quantity", onChange: value => setQuantity(String(value)), onKeyUp: onKeyUp, showLabel: false, size: "md" }), jsx(Button, { condensed: true, "data-test-selector": "confirm", isDisabled: isDisabled, onClick: e => {
90
- e.preventDefault();
91
- e.stopPropagation();
88
+ }, isDisabled: isDisabled, label: t('Quantity'), maxLength: 4, maxValue: 9999, minValue: 0, name: "quantity", onChange: value => setQuantity(String(value)), onKeyUp: onKeyUp, size: "md" }), jsx(Button, { condensed: true, "data-test-selector": "confirm", isDisabled: isDisabled, onClick: () => {
92
89
  onConfirm(ensureNumber(updatedQuantity, 0));
93
90
  }, size: "md", children: "OK" })] }));
94
91
  }
@@ -1,3 +1,3 @@
1
- var styles = {"add-to-cart-button":"add-to-cart-button-module-GdrDp","manual-input-container":"add-to-cart-button-module-AWFvQ","left-button-spacer":"add-to-cart-button-module-SS7WM"};
1
+ var styles = {"add-to-cart-button":"add-to-cart-button-module-GdrDp","manual-input-container":"add-to-cart-button-module-AWFvQ"};
2
2
 
3
3
  export { styles as default };
@@ -7,12 +7,11 @@ import { ProductSku } from '../../display/product-sku/product-sku.js';
7
7
  import { FormattedMessage } from '../../intl/formatted-message.js';
8
8
  import { Image } from '../../media/image/image.js';
9
9
  import { RouteLink } from '../../shared/routing/route-link.js';
10
- import { Heading } from '../../typography/heading/heading.js';
11
10
  import styles from './orderline-card.module.css.js';
12
11
 
13
12
  function OrderLineCard(props) {
14
13
  const { deliveryDate, href, image, isReadonly, price, productId, sku, tags, title, } = props;
15
- return (jsxs(RouteLink, { className: clsx(styles['orderline-card'], isReadonly && styles.readonly), "data-test-selector": "orderLineListItem", href: href, id: productId, isDisabled: isReadonly, children: [jsx("div", { className: styles['image-container'], role: "presentation", children: jsx(Image, { "data-test-selector": "orderLineCardImage", ...image, fit: "contain" }) }), jsx(Heading, { className: styles.title, "data-test-selector": "orderLineCardTitle", size: "xxxs", tag: "h3", children: title }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), isReadonly ? (jsx("p", { className: styles.amount, children: jsx(FormattedMessage, { id: "Amount: {0}", replacementValues: { '0': props.quantity.toString() } }) })) : (jsx("div", { className: styles['add-to-cart-button'], children: props.addToCartButton })), jsx(Price, { className: styles.price, currencyCode: price.currencyCode, "data-test-selector": "orderLineCardPrice", originalPrice: price.originalTotalPrice, price: price.totalPrice, pricePerUnit: price.pricePerUnit, variant: "sonic" }), deliveryDate && (jsx(DeliveryTime, { className: styles.delivery, deliveryDate: deliveryDate })), !isReadonly && (jsx("div", { className: styles.remove, "data-test-selector": "orderLineCardRemove", children: props.removeButton }))] }));
14
+ return (jsxs("article", { "aria-labelledby": `title-${productId}`, className: clsx(styles['orderline-card'], isReadonly && styles.readonly), "data-disabled": isReadonly ? true : undefined, "data-product-id": sku, "data-test-selector": "orderLineListItem", id: productId, children: [isReadonly ? (jsx("div", { className: styles.title, "data-test-selector": "orderLineCardTitle", id: `title-${productId}`, children: title })) : (jsx(RouteLink, { className: styles.title, "data-test-selector": "orderLineCardTitle", href: href, id: `title-${productId}`, children: title })), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), jsx(Price, { className: styles.price, currencyCode: price.currencyCode, "data-test-selector": "orderLineCardPrice", originalPrice: price.originalTotalPrice, price: price.totalPrice, pricePerUnit: price.pricePerUnit, variant: "sonic" }), jsx("div", { className: styles['image-container'], role: "presentation", children: jsx(Image, { "data-test-selector": "orderLineCardImage", ...image, fit: "contain" }) }), isReadonly ? (jsx("p", { className: styles.amount, children: jsx(FormattedMessage, { id: "Amount: {0}", replacementValues: { '0': props.quantity.toString() } }) })) : (jsx("div", { className: styles['add-to-cart-button'], children: props.addToCartButton })), deliveryDate && (jsx(DeliveryTime, { className: styles.delivery, deliveryDate: deliveryDate })), !isReadonly && (jsx("div", { className: styles.remove, "data-test-selector": "orderLineCardRemove", children: props.removeButton }))] }));
16
15
  }
17
16
 
18
17
  export { OrderLineCard };
@@ -1,8 +1,8 @@
1
1
  import { AddToCartHandler } from '../../buttons/add-to-cart-button/connected-add-to-cart-button';
2
2
  import { ProductCardProps } from './product-card';
3
- export interface ConnectedProductCartProps extends Omit<ProductCardProps, 'addToCartButton' | 'favoriteButton'> {
3
+ export interface ConnectedProductCardProps extends Omit<ProductCardProps, 'addToCartButton' | 'favoriteButton'> {
4
4
  onAddToCart?: AddToCartHandler;
5
5
  onFavorited?: VoidFunction;
6
6
  onFavoriting?: VoidFunction;
7
7
  }
8
- export declare function ConnectedProductCard({ id, onAddToCart, onFavorited, onFavoriting, ...props }: ConnectedProductCartProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function ConnectedProductCard({ id, onAddToCart, onFavorited, onFavoriting, ...props }: ConnectedProductCardProps): import("react/jsx-runtime").JSX.Element;
@@ -6,11 +6,10 @@ import { ProductSku } from '../../display/product-sku/product-sku.js';
6
6
  import { FormattedMessage } from '../../intl/formatted-message.js';
7
7
  import { Image } from '../../media/image/image.js';
8
8
  import { RouteLink } from '../../shared/routing/route-link.js';
9
- import { Heading } from '../../typography/heading/heading.js';
10
9
  import styles from './product-card.module.css.js';
11
10
 
12
11
  function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, href, id, image, onClick, price, sku, tags, title, }) {
13
- return (jsx("div", { className: styles['product-card-container'], children: jsxs(RouteLink, { className: styles['product-card'], "data-product-id": sku, href: href, id: id, onClick: onClick, children: [jsx("div", { className: styles['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsx("div", { className: styles['favorite-button'], children: FavoriteButton && FavoriteButton }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(Heading, { className: styles.title, size: "xxxs", tag: "h2", children: title }), jsx(ProductSku, { className: styles.sku, sku: sku }), jsx(Price, { className: styles.price, currencyCode: price.currencyCode, isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price, variant: "sonic" }), jsx("div", { className: styles['add-to-cart-button'], children: AddToCartButton })] }) }));
12
+ return (jsx("div", { className: styles['product-card-container'], children: jsxs("article", { "aria-labelledby": `title-${id}`, className: styles['product-card'], "data-product-id": sku, id: id, children: [jsx(RouteLink, { className: styles.title, href: href, id: `title-${id}`, onClick: onClick, children: title }), tags && tags.length > 0 && (jsx("div", { className: styles.tags, children: tags.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) })), jsx(ProductSku, { className: styles.sku, sku: sku }), jsx(Price, { className: styles.price, currencyCode: price.currencyCode, isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price, variant: "sonic" }), jsx("div", { className: styles['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsx("div", { className: styles['add-to-cart-button'], children: AddToCartButton }), jsx("div", { className: styles['favorite-button'], children: FavoriteButton && FavoriteButton })] }) }));
14
13
  }
15
14
 
16
15
  export { ProductCard };
@@ -1,3 +1,3 @@
1
- var styles = {"product-card-container":"product-card-module-LepTy","product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","title":"product-card-module-CStNi","tags":"product-card-module-nL-hY","sku":"product-card-module-XzunM","image-container":"product-card-module-65ZVi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
1
+ var styles = {"product-card-container":"product-card-module-LepTy","product-card":"product-card-module-pLaiB","title":"product-card-module-CStNi","favorite-button":"product-card-module-tvEdz","tags":"product-card-module-nL-hY","sku":"product-card-module-XzunM","image-container":"product-card-module-65ZVi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
2
2
 
3
3
  export { styles as default };
@@ -8,7 +8,7 @@ import styles from './cart-totals.module.css.js';
8
8
  const formatDisplayPriceToSymbolSpaceValue = (displayPrice) => displayPrice.replace(/^(\D)([\d,.]*$)/, (_, symbol, value) => `${symbol} ${value}`);
9
9
  function CartTotals({ currencyCode, deliveryDate, fulfillmentMethod, isPayByInvoice, orderNumber, shippingCost, subtotal, tax, total, vatPercentage, }) {
10
10
  const t = useFormattedMessage();
11
- return (jsxs("div", { className: styles['cart-totals'], children: [orderNumber && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Order number" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "orderConfirmation_orderNumber", children: orderNumber }) }) })] })), deliveryDate !== undefined && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Delivery date" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "deliveryDate", children: deliveryDate || t('As soon as possible') }) }) })] })), fulfillmentMethod && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Fulfillment method" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "fulfillmentMethod", children: fulfillmentMethod }) }) })] })), isPayByInvoice && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Payment method" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "paymentMethod", children: jsx(FormattedMessage, { id: "Pay by invoice" }) }) }) })] })), jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Cost overview" }) }), jsxs("div", { children: [jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "Subtotal" }), ' ', jsx(FormattedMessage, { id: "Excl. VAT" })] }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "cartTotal_subTotal", price: subtotal })] }), jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Shipping and handling" }) }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "shippingCost", price: shippingCost })] }), jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "VAT" }), ' ', vatPercentage ? `${vatPercentage}%` : ''] }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "vatAmount", price: tax })] })] })] }), jsx("section", { className: styles.totals, children: jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Total" }) }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "cartTotal_orderGrandTotalDisplay", price: total })] }) })] }));
11
+ return (jsxs("div", { className: styles['cart-totals'], children: [orderNumber && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Order number" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "orderConfirmation_orderNumber", children: orderNumber }) }) })] })), deliveryDate !== undefined && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Delivery date" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "deliveryDate", children: deliveryDate || t('As soon as possible') }) }) })] })), fulfillmentMethod && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Fulfillment method" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "fulfillmentMethod", children: jsx(FormattedMessage, { id: `fulfillmentmethod.${fulfillmentMethod}` }) }) }) })] })), isPayByInvoice && (jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Payment method" }) }), jsx("div", { children: jsx("div", { className: styles.line, children: jsx("p", { className: styles.label, "data-test-selector": "paymentMethod", children: jsx(FormattedMessage, { id: "Pay by invoice" }) }) }) })] })), jsxs("section", { className: styles.section, children: [jsx(Heading, { className: styles['section-header'], size: "xxxs", tag: "h3", children: jsx(FormattedMessage, { id: "Cost overview" }) }), jsxs("div", { children: [jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "Subtotal" }), ' ', jsx(FormattedMessage, { id: "Excl. VAT" })] }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "cartTotal_subTotal", price: subtotal })] }), jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Shipping and handling" }) }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "shippingCost", price: shippingCost })] }), jsxs("div", { className: styles.line, children: [jsxs("p", { className: styles.label, children: [jsx(FormattedMessage, { id: "VAT" }), ' ', vatPercentage ? `${vatPercentage}%` : ''] }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "vatAmount", price: tax })] })] })] }), jsx("section", { className: styles.totals, children: jsxs("div", { className: styles.line, children: [jsx("p", { className: styles.label, children: jsx(FormattedMessage, { id: "Total" }) }), jsx(Price, { className: styles.value, currencyCode: currencyCode, "data-test-selector": "cartTotal_orderGrandTotalDisplay", price: total })] }) })] }));
12
12
  }
13
13
 
14
14
  export { CartTotals, formatDisplayPriceToSymbolSpaceValue };
@@ -4,6 +4,7 @@ interface CountrySelectProps<T extends Country> {
4
4
  countryNameInLanguageOfCountry?: boolean;
5
5
  'data-test-selector'?: string;
6
6
  isDisabled?: boolean;
7
+ isLoading?: boolean;
7
8
  isRequired?: boolean;
8
9
  name?: string;
9
10
  showLabel?: boolean;
@@ -1,9 +1,9 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
2
  import { useMemo } from 'react';
3
- import { Select } from '../forms/select/select.js';
3
+ import { SelectField } from '../forms/select-field/select-field.js';
4
4
  import { useFormattedMessage } from '../intl/use-formatted-message.js';
5
5
 
6
- function CountrySelect({ countries, countryNameInLanguageOfCountry = false, 'data-test-selector': dataTestSelector, defaultSelectedCountry, isDisabled, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
6
+ function CountrySelect({ countries, countryNameInLanguageOfCountry = false, 'data-test-selector': dataTestSelector, defaultSelectedCountry, isDisabled, isLoading, isRequired, name, onCountryChange, selectedCountry, showLabel = true, }) {
7
7
  const t = useFormattedMessage();
8
8
  const translationPrefix = countryNameInLanguageOfCountry
9
9
  ? 'clSelector'
@@ -20,7 +20,7 @@ function CountrySelect({ countries, countryNameInLanguageOfCountry = false, 'dat
20
20
  }), {}),
21
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
22
22
  [countries]);
23
- return (jsx(Select, { "data-key": selectedCountry?.id, "data-test-selector": dataTestSelector, defaultSelectedOption: defaultSelectedCountry?.id, isDisabled: isDisabled, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
23
+ return (jsx(SelectField, { "data-key": selectedCountry?.id, "data-test-selector": dataTestSelector, defaultSelectedOption: defaultSelectedCountry?.id, isDisabled: isDisabled, isLoading: isLoading, isRequired: isRequired, label: t('Country'), name: name, onChange: value => onCountryChange?.(countries.find(country => country.id === value)), options: countryOptions, selectedOption: selectedCountry?.id, showLabel: showLabel, showPlaceholder: false, variant: "solid" }));
24
24
  }
25
25
 
26
26
  export { CountrySelect };
package/dist/exports.d.ts CHANGED
@@ -74,13 +74,20 @@ export * from './filters/active-filters/active-filters';
74
74
  export * from './filters/multi-select/multi-select';
75
75
  export * from './filters/pagination/pagination';
76
76
  export * from './footer/footer';
77
+ export * from './forms/checkbox-field/checkbox-field';
77
78
  export * from './forms/checkbox/checkbox';
78
79
  export * from './forms/color-checkbox/color-checkbox';
79
80
  export * from './forms/field-error/field-error';
81
+ export * from './forms/form/form';
82
+ export * from './forms/form/form-field-layout';
83
+ export * from './forms/form/form-segment';
84
+ export * from './forms/form/form-segment-group';
80
85
  export * from './forms/input/input';
81
86
  export * from './forms/label/label';
82
87
  export * from './forms/number-field/number-field';
88
+ export * from './forms/select-field/select-field';
83
89
  export * from './forms/select/select';
90
+ export * from './forms/switch-field/switch-field';
84
91
  export * from './forms/switch/switch';
85
92
  export * from './forms/text-field/password-reveal-toggle/password-reveal-toggle';
86
93
  export * from './forms/text-field/text-field';
@@ -154,6 +161,10 @@ export * from './notifications/announcements/announcement';
154
161
  export * from './notifications/announcements/announcement-provider';
155
162
  export * from './notifications/announcements/connected-announcement';
156
163
  export * from './observers/intersection-observer';
164
+ export * from './pages/account/components/create-account-form/create-account-form';
165
+ export * from './pages/account/components/sign-in-form/sign-in-form';
166
+ export * from './pages/account/create-account-page/create-account-page';
167
+ export * from './pages/account/layouts/sign-in-page-layout/sign-in-page-background-image';
157
168
  export * from './pages/account/layouts/sign-in-page-layout/sign-in-page-layout';
158
169
  export * from './pages/account/sign-in-page/sign-in-page';
159
170
  export * from './pages/checkout/cart-page/cart-page';
@@ -212,6 +223,7 @@ export * from './shared/api/bff/hooks/use-fetch-product-details-page-data';
212
223
  export * from './shared/api/bff/hooks/use-fetch-product-listing-page-data';
213
224
  export * from './shared/api/bff/services/bff-service';
214
225
  export * from './shared/api/shared/hooks/use-awaitable-mutation';
226
+ export * from './shared/api/storefront/hooks/authentication/use-create-account';
215
227
  export * from './shared/api/storefront/hooks/authentication/use-create-guest-account';
216
228
  export * from './shared/api/storefront/hooks/authentication/use-fetch-session';
217
229
  export * from './shared/api/storefront/hooks/authentication/use-invalidate-session';
@@ -288,6 +300,7 @@ export * from './shared/hooks/use-scroll-lock';
288
300
  export * from './shared/hooks/use-scroll-to';
289
301
  export * from './shared/hooks/use-session-storage';
290
302
  export * from './shared/hooks/use-watch-css-property';
303
+ export * from './shared/model/account';
291
304
  export * from './shared/model/address';
292
305
  export * from './shared/model/announcement';
293
306
  export * from './shared/model/category';
@@ -331,7 +344,6 @@ export * from './sidebar/sidebar-provider';
331
344
  export * from './sidebar/toggle-sidebar-button';
332
345
  export * from './sidebar/types';
333
346
  export * from './sidebar/use-sidebar';
334
- export * from './sign-in-form/sign-in-form';
335
347
  export * from './toast/toast';
336
348
  export * from './toast/toast-provider';
337
349
  export * from './toast/types';
@@ -5,10 +5,12 @@ import { NumberField } from '../../forms/number-field/number-field.js';
5
5
  import { GlyphsChevronsSlimLeftIcon } from '../../icons/glyph/glyphs-chevrons-slim-left-icon.js';
6
6
  import { GlyphsChevronsSlimRightIcon } from '../../icons/glyph/glyphs-chevrons-slim-right-icon.js';
7
7
  import { FormattedMessage } from '../../intl/formatted-message.js';
8
+ import { useFormattedMessage } from '../../intl/use-formatted-message.js';
8
9
  import styles from './pagination.module.css.js';
9
10
 
10
11
  function Pagination({ currentPage, onChange, totalPages, }) {
11
- return (jsxs("div", { className: styles.pagination, children: [jsx(IconButton, { isDisabled: currentPage === 1, onClick: () => onChange(currentPage - 1), children: jsx(GlyphsChevronsSlimLeftIcon, {}) }), jsxs("div", { className: styles['page-number-container'], children: [jsx(NumberField, { autoGrow: true, label: "current-page", maxValue: totalPages, minValue: 1, onChange: onChange, value: currentPage }), jsx(FormattedMessage, { id: "of" }), jsx("div", { children: totalPages })] }), jsx(IconButton, { isDisabled: currentPage >= totalPages, onClick: () => onChange(currentPage + 1), children: jsx(GlyphsChevronsSlimRightIcon, {}) })] }));
12
+ const t = useFormattedMessage();
13
+ return (jsxs("div", { className: styles.pagination, children: [jsx(IconButton, { isDisabled: currentPage === 1, onClick: () => onChange(currentPage - 1), children: jsx(GlyphsChevronsSlimLeftIcon, {}) }), jsxs("div", { className: styles['page-number-container'], children: [jsx(NumberField, { autoGrow: true, label: t('Current page'), maxValue: totalPages, minValue: 1, onChange: onChange, value: currentPage }), jsx(FormattedMessage, { id: "of" }), jsx("div", { children: totalPages })] }), jsx(IconButton, { isDisabled: currentPage >= totalPages, onClick: () => onChange(currentPage + 1), children: jsx(GlyphsChevronsSlimRightIcon, {}) })] }));
12
14
  }
13
15
 
14
16
  export { Pagination };
@@ -1,13 +1,22 @@
1
1
  import { ReactNode } from 'react';
2
- export interface CheckboxProps {
3
- _pseudo?: 'none' | 'focus' | 'hover' | 'active';
4
- children?: ReactNode;
2
+ export interface CheckboxPropsBase {
3
+ autoFocus?: boolean;
5
4
  className?: string;
6
5
  'data-test-selector'?: string;
7
6
  defaultSelected?: boolean;
8
7
  isDisabled?: boolean;
8
+ isReadOnly?: boolean;
9
+ isRequired?: boolean;
9
10
  isSelected?: boolean;
11
+ name?: string;
10
12
  onChange?: (isSelected: boolean) => void;
11
13
  value?: string;
12
14
  }
13
- export declare function Checkbox({ _pseudo, children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
15
+ export interface CheckboxWithLabelProps extends CheckboxPropsBase {
16
+ 'aria-label': string;
17
+ }
18
+ export interface CheckboxWithChildrenProps extends CheckboxPropsBase {
19
+ children: ReactNode;
20
+ }
21
+ export type CheckboxProps = CheckboxWithLabelProps | CheckboxWithChildrenProps;
22
+ export declare function Checkbox(props: CheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -2,10 +2,14 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { Checkbox as Checkbox$1 } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
+ import { Label } from '../label/label.js';
5
6
  import styles from './checkbox.module.css.js';
6
7
 
7
- function Checkbox({ _pseudo = 'none', children, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isSelected, onChange, value, }) {
8
- return (jsxs(Checkbox$1, { className: clsx(className, styles.checkbox, styles[_pseudo]), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0 10 7", children: jsx("path", { d: "m1 2.845 3 3L8.845 1" }) }) }), children] }));
8
+ function Checkbox(props) {
9
+ const { autoFocus, className, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isReadOnly, isRequired, isSelected, name, onChange, value, } = props;
10
+ const ariaLabel = 'aria-label' in props ? props['aria-label'] : undefined;
11
+ const children = 'children' in props ? props.children : undefined;
12
+ return (jsxs(Checkbox$1, { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx(styles.checkbox, className), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isSelected: isSelected, name: name, onChange: onChange, value: value, children: [jsx("div", { className: styles.box, children: jsx("svg", { "aria-hidden": "true", className: styles.checkmark, viewBox: "0 0 10 7", children: jsx("path", { d: "m1 2.845 3 3L8.845 1" }) }) }), children && (jsx(Label, { className: styles.label, isRequired: isRequired, children: children }))] }));
9
13
  }
10
14
 
11
15
  export { Checkbox };
@@ -1,3 +1,3 @@
1
- var styles = {"checkbox":"checkbox-module-YNVdd","box":"checkbox-module-UKoyf","checkmark":"checkbox-module-pHIwh","focus":"checkbox-module-v23jy","active":"checkbox-module-7UG-b","color-checkbox":"checkbox-module-nEhvW"};
1
+ var styles = {"checkbox":"checkbox-module-YNVdd","box":"checkbox-module-UKoyf","checkmark":"checkbox-module-pHIwh","color-checkbox":"checkbox-module-nEhvW","label":"checkbox-module-ITd8W"};
2
2
 
3
3
  export { styles as default };
@@ -0,0 +1,10 @@
1
+ import { CheckboxProps, CheckboxPropsBase } from '../checkbox/checkbox';
2
+ import { ValidateFunction } from '../field-error/field-error';
3
+ export interface CheckboxFieldPropsBase extends CheckboxPropsBase {
4
+ errorMessage?: string;
5
+ info?: string;
6
+ isInvalid?: boolean;
7
+ validate?: ValidateFunction<boolean>;
8
+ }
9
+ export type CheckboxFieldProps = CheckboxFieldPropsBase & CheckboxProps;
10
+ export declare function CheckboxField(props: CheckboxFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { CheckboxGroup } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { InfoIconTooltip } from '../../info-icon-tooltip/info-icon-tooltip.js';
6
+ import { Checkbox } from '../checkbox/checkbox.js';
7
+ import { FieldError } from '../field-error/field-error.js';
8
+ import { FormFieldLayout } from '../form/form-field-layout.js';
9
+ import styles from './checkbox-field.module.css.js';
10
+
11
+ function CheckboxField(props) {
12
+ const { className, defaultSelected, info, isDisabled, isInvalid, isReadOnly, isRequired, isSelected, validate, value = 'true', } = props;
13
+ return (jsx(CheckboxGroup, { className: clsx(styles['checkbox-field'], className), defaultValue: defaultSelected ? [value] : undefined, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, validate: values => validate?.(values.every(Boolean)), value: isSelected ? [value] : undefined, children: jsx(FormFieldLayout, { errorSlot: jsx(FieldError, {}), infoSlot: info && jsx(InfoIconTooltip, { children: info }), children: jsx(Checkbox, { ...props }) }) }));
14
+ }
15
+
16
+ export { CheckboxField };
@@ -0,0 +1,3 @@
1
+ var styles = {"checkbox-field":"checkbox-field-module-fdQEa"};
2
+
3
+ export { styles as default };
@@ -1,5 +1,7 @@
1
- import { CheckboxProps } from '../checkbox/checkbox';
2
- export interface ColorCheckboxProps extends CheckboxProps {
1
+ import { CheckboxProps, CheckboxPropsBase } from '../checkbox/checkbox';
2
+ interface ColorCheckboxPropsBase extends CheckboxPropsBase {
3
3
  color: string;
4
4
  }
5
- export declare function ColorCheckbox({ _pseudo, children, className, color, isDisabled, isSelected, onChange, value, }: ColorCheckboxProps): import("react/jsx-runtime").JSX.Element;
5
+ export type ColorCheckboxProps = ColorCheckboxPropsBase & CheckboxProps;
6
+ export declare function ColorCheckbox(props: ColorCheckboxProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -2,12 +2,16 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { Checkbox } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
+ import { Label } from '../label/label.js';
5
6
  import styles from '../checkbox/checkbox.module.css.js';
6
7
 
7
- function ColorCheckbox({ _pseudo = 'none', children, className, color, isDisabled, isSelected, onChange, value, }) {
8
- return (jsxs(Checkbox, { className: clsx(className, styles.checkbox, styles['color-checkbox'], styles[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, style: {
8
+ function ColorCheckbox(props) {
9
+ const { autoFocus, className, color, 'data-test-selector': dataTestSelector, defaultSelected, isDisabled, isReadOnly, isRequired, isSelected, name, onChange, value, } = props;
10
+ const ariaLabel = 'aria-label' in props ? props['aria-label'] : undefined;
11
+ const children = 'children' in props ? props.children : undefined;
12
+ return (jsxs(Checkbox, { "aria-label": ariaLabel, autoFocus: autoFocus, className: clsx(styles.checkbox, styles['color-checkbox'], className), "data-test-selector": dataTestSelector, defaultSelected: defaultSelected, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, isSelected: isSelected, name: name, onChange: onChange, style: {
9
13
  '--selected-color': color,
10
- }, value: value, children: [jsx("div", { className: styles.box }), children] }));
14
+ }, value: value, children: [jsx("div", { className: styles.box }), jsx(Label, { className: styles.label, isRequired: isRequired, children: children })] }));
11
15
  }
12
16
 
13
17
  export { ColorCheckbox };
@@ -0,0 +1,10 @@
1
+ import { ReactNode } from 'react';
2
+ interface FormFieldLayoutProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ errorSlot?: ReactNode;
6
+ infoSlot?: ReactNode;
7
+ labelSlot?: ReactNode;
8
+ }
9
+ export declare function FormFieldLayout({ children, className, errorSlot, infoSlot, labelSlot, }: FormFieldLayoutProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,10 @@
1
+ "use client";
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+ import clsx from 'clsx';
4
+ import styles from './form-field-layout.module.css.js';
5
+
6
+ function FormFieldLayout({ children, className, errorSlot, infoSlot, labelSlot, }) {
7
+ return (jsxs("div", { className: clsx(styles['form-field-layout'], className), children: [labelSlot && jsx("div", { className: styles['label'], children: labelSlot }), jsx("div", { className: styles['input'], children: children }), infoSlot && jsx("div", { className: styles['info'], children: infoSlot }), errorSlot && jsx("div", { className: styles['error'], children: errorSlot })] }));
8
+ }
9
+
10
+ export { FormFieldLayout };
@@ -0,0 +1,3 @@
1
+ var styles = {"form-field-layout":"form-field-layout-module-ATB1W","label":"form-field-layout-module-3tbc7","input":"form-field-layout-module-vT6Gy","info":"form-field-layout-module-UcHO-","error":"form-field-layout-module-Pfatk"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,6 @@
1
+ export interface FormSegmentGroupProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ title?: string;
5
+ }
6
+ export declare function FormSegmentGroup({ children, className, title, }: FormSegmentGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import styles from './form-segment-group.module.css.js';
4
+
5
+ function FormSegmentGroup({ children, className,
6
+ // columns,
7
+ title, }) {
8
+ return (jsx("fieldset", { "aria-label": title, className: clsx(styles['form-segment-group'],
9
+ // columns && styles['columns'],
10
+ className), children: children }));
11
+ }
12
+
13
+ export { FormSegmentGroup };
@@ -0,0 +1,3 @@
1
+ var styles = {"form-segment-group":"form-segment-group-module-P3YjC"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,6 @@
1
+ export interface FormSegmentProps {
2
+ children: React.ReactNode;
3
+ className?: string;
4
+ isFloating?: boolean;
5
+ }
6
+ export declare function FormSegment({ children, className, isFloating, }: FormSegmentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import styles from './form-segment.module.css.js';
4
+
5
+ function FormSegment({ children, className, isFloating, }) {
6
+ return (jsx("div", { className: clsx(styles['form-segment'], isFloating && styles['floating'], className), children: children }));
7
+ }
8
+
9
+ export { FormSegment };
@@ -0,0 +1,3 @@
1
+ var styles = {"form-segment":"form-segment-module-JLPcG","floating":"form-segment-module-98g3i"};
2
+
3
+ export { styles as default };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from 'react';
2
+ export interface OnSubmitParams {
3
+ formData: FormData;
4
+ submitter?: HTMLButtonElement;
5
+ }
6
+ export interface FormProps {
7
+ autoComplete?: boolean;
8
+ children: ReactNode;
9
+ className?: string;
10
+ errorMessage?: string;
11
+ footer?: ReactNode;
12
+ header?: ReactNode;
13
+ onSubmit?: ({ formData, submitter }: OnSubmitParams) => void;
14
+ title?: string;
15
+ }
16
+ export declare function Form({ autoComplete, children, className, errorMessage, footer, header, onSubmit, title, }: FormProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import { useEffect } from 'react';
3
+ import { Form as Form$1 } from 'react-aria-components';
4
+ import clsx from 'clsx';
5
+ import { Message } from '../../message/message.js';
6
+ import { scrollToTop } from '../../shared/hooks/use-scroll-to.js';
7
+ import styles from './form.module.css.js';
8
+
9
+ function Form({ autoComplete = false, children, className, errorMessage, footer, header, onSubmit, title, }) {
10
+ const handleSubmit = (event) => {
11
+ if (onSubmit) {
12
+ event.preventDefault();
13
+ const form = event.currentTarget;
14
+ const formData = new FormData(form);
15
+ const submitter = event.nativeEvent.submitter;
16
+ onSubmit({ formData, submitter });
17
+ }
18
+ };
19
+ useEffect(() => {
20
+ if (errorMessage) {
21
+ scrollToTop();
22
+ }
23
+ }, [errorMessage]);
24
+ return (jsxs(Form$1, { "aria-label": title, autoComplete: autoComplete ? 'on' : 'off', className: clsx(styles['form'], className), onSubmit: handleSubmit, validationBehavior: "native", children: [jsx("header", { className: styles['form-header'], children: header }), errorMessage && (jsx("section", { className: styles['error-messages'], children: jsx(Message, { type: "danger", children: errorMessage }) })), children, jsx("footer", { className: styles['form-footer'], children: footer })] }));
25
+ }
26
+
27
+ export { Form };
@@ -0,0 +1,3 @@
1
+ var styles = {"form":"form-module-xD1fv","error-messages":"form-module-Hy5TM","form-header":"form-module-jDAR6","form-footer":"form-module-wcAbi"};
2
+
3
+ export { styles as default };
@@ -2,8 +2,10 @@ import { ComponentProps, FC } from 'react';
2
2
  import { Input as AriaInput } from 'react-aria-components';
3
3
  export interface InputProps extends Omit<ComponentProps<typeof AriaInput>, 'size'> {
4
4
  _pseudo?: 'focus' | 'none';
5
+ autoComplete?: string;
5
6
  autoGrow?: boolean;
6
7
  className?: string;
8
+ 'data-test-selector'?: string;
7
9
  inlineElement?: React.ReactNode;
8
10
  label: string;
9
11
  size?: 'md' | 'lg';
@@ -9,7 +9,7 @@ import styles from './input.module.css.js';
9
9
  * This component is used to create an input that grows as the user types.
10
10
  * It uses a shadow input to calculate the width of the input.
11
11
  */
12
- const Input = forwardRef(({ _pseudo = 'none', autoGrow, className, inlineElement, label, size = 'lg', ...inputProps }, inputRef) => {
12
+ const Input = forwardRef(({ _pseudo = 'none', autoComplete, autoGrow, className, inlineElement, label, size = 'lg', ...inputProps }, inputRef) => {
13
13
  const [props, ref] = useContextProps(inputProps, inputRef, InputContext);
14
14
  const { defaultValue, onChange, value: controlledValue } = props;
15
15
  const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
@@ -20,7 +20,7 @@ const Input = forwardRef(({ _pseudo = 'none', autoGrow, className, inlineElement
20
20
  : setUncontrolledValue(event.target.value);
21
21
  return (jsx("div", { className: clsx(className, styles['input-container'], styles[size], styles[_pseudo]), children: jsxs("div", { className: clsx(styles.input, {
22
22
  [styles['growing-input']]: autoGrow,
23
- }), children: [jsx(Input$1, { "aria-label": label, size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange, onClick: e => {
23
+ }), children: [jsx(Input$1, { "aria-label": label, "auto-complete": autoComplete, size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange, onClick: e => {
24
24
  e.preventDefault();
25
25
  e.stopPropagation();
26
26
  e.target.focus();
@@ -7,7 +7,7 @@ import styles from './label.module.css.js';
7
7
  function Label({ children, className, 'data-test-selector': dataTestSelector, isRequired, }) {
8
8
  if (!children)
9
9
  return null;
10
- return (jsxs(Label$1, { className: clsx(className, styles.label), "data-test-selector": dataTestSelector, children: [children, isRequired && jsx("span", { className: styles.required, children: "*" })] }));
10
+ return (jsxs(Label$1, { className: clsx(styles.label, className), "data-test-selector": dataTestSelector, children: [children, isRequired && jsx("span", { className: styles.required, children: "*" })] }));
11
11
  }
12
12
 
13
13
  export { Label };