@sonic-equipment/ui 0.0.17 → 0.0.19

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.
@@ -11,7 +11,7 @@ declare const meta: {
11
11
  src: string;
12
12
  title: string;
13
13
  };
14
- onClick: import("@vitest/spy").Mock<[event: import("react").MouseEvent<HTMLDivElement, MouseEvent>], void>;
14
+ onClick: import("@vitest/spy").Mock<[event: React.MouseEvent<HTMLDivElement, MouseEvent>], void>;
15
15
  sku: string;
16
16
  tag: "new";
17
17
  };
@@ -0,0 +1,11 @@
1
+ import { ReactNode } from 'react';
2
+ export interface AccordionItemProps {
3
+ _pseudo?: 'none' | 'focus' | 'hover' | 'active';
4
+ children: ReactNode;
5
+ id: string;
6
+ isDisabled?: boolean;
7
+ isOpen?: boolean;
8
+ size?: 'md' | 'lg';
9
+ title: string;
10
+ }
11
+ export declare function AccordionItem({ _pseudo, children, id, isDisabled, isOpen: isOpenProp, size, title, }: AccordionItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ import { AccordionItemProps } from './accordion-item';
3
+ interface AccordionProps {
4
+ children?: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];
5
+ color?: 'white' | 'black';
6
+ hasLineSeparator?: boolean;
7
+ size?: 'md' | 'lg';
8
+ }
9
+ export declare function Accordion({ children, color, hasLineSeparator, size, }: AccordionProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,17 @@
1
+ import { StoryObj } from '@storybook/react';
2
+ import { Accordion } from './accordion';
3
+ declare const meta: {
4
+ component: typeof Accordion;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ title: string;
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const Default: Story;
14
+ export declare const Disabled: Story;
15
+ export declare const Focus: Story;
16
+ export declare const Active: Story;
17
+ export declare const Large: Story;
@@ -0,0 +1,5 @@
1
+ import { CheckboxProps } from 'forms/checkbox/checkbox';
2
+ export interface ColorCheckboxProps extends CheckboxProps {
3
+ color: string;
4
+ }
5
+ export declare function ColorCheckbox({ _pseudo, children, className, color, isDisabled, isSelected, onChange, value, }: ColorCheckboxProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import { ColorCheckbox } from './color-checkbox';
3
+ declare const meta: {
4
+ args: {
5
+ onChange: import("@vitest/spy").Mock<[isSelected: boolean], void>;
6
+ };
7
+ component: typeof ColorCheckbox;
8
+ parameters: {
9
+ layout: string;
10
+ };
11
+ tags: string[];
12
+ title: string;
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof ColorCheckbox>;
16
+ export declare const Checked: Story;
17
+ export declare const Unchecked: Story;
18
+ export declare const CheckedFocus: Story;
@@ -12,7 +12,7 @@ declare const meta: {
12
12
  args: {
13
13
  size: "lg";
14
14
  };
15
- component: import("react").FC<import("./input").InputProps>;
15
+ component: React.FC<import("./input").InputProps>;
16
16
  parameters: {
17
17
  layout: string;
18
18
  };
@@ -0,0 +1,9 @@
1
+ export interface SelectProps {
2
+ disabled?: boolean;
3
+ label: string;
4
+ onChange: (value: string) => void;
5
+ options: Record<string, string>;
6
+ selectedOption?: string;
7
+ showLabel?: boolean;
8
+ }
9
+ export declare const Select: ({ disabled, label, onChange, options, selectedOption, showLabel, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import { Select } from './select';
3
+ declare const meta: {
4
+ args: {
5
+ onChange: import("@vitest/spy").Mock<[value: string], void>;
6
+ };
7
+ component: ({ disabled, label, onChange, options, selectedOption, showLabel, }: import("./select").SelectProps) => import("react/jsx-runtime").JSX.Element;
8
+ parameters: {
9
+ layout: string;
10
+ };
11
+ tags: string[];
12
+ title: string;
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof Select>;
16
+ export declare const WithLabel: Story;
17
+ export declare const WithoutLabel: Story;
18
+ export declare const DefaultSelected: Story;
19
+ export declare const Disabled: Story;
@@ -2,7 +2,7 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  import { TextArea } from './textarea';
4
4
  declare const meta: {
5
- component: import("react").FC<import("./textarea").TextAreaProps>;
5
+ component: React.FC<import("./textarea").TextAreaProps>;
6
6
  parameters: {
7
7
  layout: string;
8
8
  };
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ChevronDownBold(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function ChevronDownSlim(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
+ /// <reference types="react" />
2
3
  export declare function RightArrowFilledIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function CheckmarkFilledIcon(props: React.SVGProps<SVGSVGElement>): import("react/jsx-runtime").JSX.Element;
package/dist/index.d.ts CHANGED
@@ -82,6 +82,24 @@ interface ProductCardProps {
82
82
  }
83
83
  declare function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, image: { alt, fit, src, title: imageTitle }, onClick, price, sku, tag, title, }: ProductCardProps): react_jsx_runtime.JSX.Element;
84
84
 
85
+ interface AccordionItemProps {
86
+ _pseudo?: 'none' | 'focus' | 'hover' | 'active';
87
+ children: ReactNode;
88
+ id: string;
89
+ isDisabled?: boolean;
90
+ isOpen?: boolean;
91
+ size?: 'md' | 'lg';
92
+ title: string;
93
+ }
94
+
95
+ interface AccordionProps {
96
+ children?: ReactElement<AccordionItemProps> | ReactElement<AccordionItemProps>[];
97
+ color?: 'white' | 'black';
98
+ hasLineSeparator?: boolean;
99
+ size?: 'md' | 'lg';
100
+ }
101
+ declare function Accordion({ children, color, hasLineSeparator, size, }: AccordionProps): react_jsx_runtime.JSX.Element;
102
+
85
103
  interface ProductPriceProps {
86
104
  className?: string;
87
105
  current: number;
@@ -95,7 +113,7 @@ interface ProductSkuProps {
95
113
  }
96
114
  declare function ProductSku({ sku }: ProductSkuProps): react_jsx_runtime.JSX.Element;
97
115
 
98
- interface CheckboxProps {
116
+ interface CheckboxProps$1 {
99
117
  _pseudo?: 'none' | 'focus' | 'hover' | 'active';
100
118
  children: ReactNode;
101
119
  className?: string;
@@ -104,7 +122,22 @@ interface CheckboxProps {
104
122
  onChange?: (isSelected: boolean) => void;
105
123
  value?: string;
106
124
  }
107
- declare function Checkbox({ _pseudo, children, className, isDisabled, isSelected, onChange, value, }: CheckboxProps): react_jsx_runtime.JSX.Element;
125
+ declare function Checkbox({ _pseudo, children, className, isDisabled, isSelected, onChange, value, }: CheckboxProps$1): react_jsx_runtime.JSX.Element;
126
+
127
+ interface CheckboxProps {
128
+ _pseudo?: 'none' | 'focus' | 'hover' | 'active'
129
+ children: ReactNode
130
+ className?: string
131
+ isDisabled?: boolean
132
+ isSelected?: boolean
133
+ onChange?: (isSelected: boolean) => void
134
+ value?: string
135
+ }
136
+
137
+ interface ColorCheckboxProps extends CheckboxProps {
138
+ color: string;
139
+ }
140
+ declare function ColorCheckbox({ _pseudo, children, className, color, isDisabled, isSelected, onChange, value, }: ColorCheckboxProps): react_jsx_runtime.JSX.Element;
108
141
 
109
142
  type NumberFieldSize = 'md' | 'lg';
110
143
  interface NumberFieldProps {
@@ -136,6 +169,16 @@ interface NumberFieldProps {
136
169
  */
137
170
  declare function NumberField({ autoFocus, autoGrow, defaultValue, formatOptions, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel, size, value, withButtons, }: NumberFieldProps): react_jsx_runtime.JSX.Element;
138
171
 
172
+ interface SelectProps {
173
+ disabled?: boolean;
174
+ label: string;
175
+ onChange: (value: string) => void;
176
+ options: Record<string, string>;
177
+ selectedOption?: string;
178
+ showLabel?: boolean;
179
+ }
180
+ declare const Select: ({ disabled, label, onChange, options, selectedOption, showLabel, }: SelectProps) => react_jsx_runtime.JSX.Element;
181
+
139
182
  interface TextFieldProps {
140
183
  autoFocus?: boolean;
141
184
  autoGrow?: boolean;
@@ -177,6 +220,29 @@ declare function FavoriteOutlinedIcon(props: React.SVGProps<SVGSVGElement>): rea
177
220
 
178
221
  declare function HashedOutlinedIcon(props: React.SVGProps<SVGSVGElement>): react_jsx_runtime.JSX.Element;
179
222
 
223
+ interface Translations {
224
+ 'Excl. VAT': string;
225
+ 'Incl. VAT': string;
226
+ }
227
+ type TranslationId = keyof Translations;
228
+
229
+ interface FormattedMessageProps {
230
+ id: TranslationId;
231
+ replacementValues?: Record<string, string>;
232
+ }
233
+ declare const FormattedMessage: ComponentType<FormattedMessageProps>;
234
+
235
+ type FormatMessageFunction = (id: string, ...replacementValues: readonly string[]) => string;
236
+
237
+ interface IntlProviderProps {
238
+ children: React.ReactNode;
239
+ formatMessage: FormatMessageFunction;
240
+ }
241
+ declare function IntlProvider({ children, formatMessage }: IntlProviderProps): react_jsx_runtime.JSX.Element;
242
+
243
+ type FormattedMessageFunction = (key: TranslationId, replacementValues?: Record<string, string>) => string;
244
+ declare const useFormattedMessage: () => FormattedMessageFunction;
245
+
180
246
  interface ProductOverviewGridProps {
181
247
  children?: ReactNode;
182
248
  }
@@ -257,4 +323,4 @@ declare function parseProductListingSearchParams(params: URLSearchParams): {
257
323
  };
258
324
  };
259
325
 
260
- export { type ActiveFilters, AddToCartButton, Button, type ButtonProps, CartFilledIcon, CartOutlinedIcon, Checkbox, type CheckboxProps, DehashedOutlinedIcon, FavoriteButton, type FavoriteButtonProps, FavoriteFilledIcon, FavoriteOutlinedIcon, type Filters, HashedOutlinedIcon, IconButton, type IconButtonProps, Image, type ImageProps, NumberField, type NumberFieldSize, ProductCard, type ProductCardProps, ProductListing, type ProductListingProps, ProductOverviewGrid, type ProductOverviewGridProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, RightArrowFilledIcon, type Sort, TextField, createProductListingSearchParams, parseProductListingSearchParams };
326
+ export { Accordion, type ActiveFilters, AddToCartButton, Button, type ButtonProps, CartFilledIcon, CartOutlinedIcon, Checkbox, type CheckboxProps$1 as CheckboxProps, ColorCheckbox, type ColorCheckboxProps, DehashedOutlinedIcon, FavoriteButton, type FavoriteButtonProps, FavoriteFilledIcon, FavoriteOutlinedIcon, type Filters, FormattedMessage, type FormattedMessageFunction, type FormattedMessageProps, HashedOutlinedIcon, IconButton, type IconButtonProps, Image, type ImageProps, IntlProvider, NumberField, type NumberFieldSize, ProductCard, type ProductCardProps, ProductListing, type ProductListingProps, ProductOverviewGrid, type ProductOverviewGridProps, ProductPrice, type ProductPriceProps, ProductSku, type ProductSkuProps, RightArrowFilledIcon, Select, type SelectProps, type Sort, TextField, createProductListingSearchParams, parseProductListingSearchParams, useFormattedMessage };
package/dist/index.js CHANGED
@@ -1,27 +1,27 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import { forwardRef, useState, useEffect, useRef, useCallback, Children } from 'react';
3
- import { Button as Button$1, FieldError as FieldError$1, useContextProps, InputContext, Input as Input$1, Label as Label$1, NumberField as NumberField$1, Checkbox as Checkbox$1, TextAreaContext, TextArea as TextArea$1, TextField as TextField$1 } from 'react-aria-components';
2
+ import { forwardRef, useState, useEffect, createContext, useContext, Children, cloneElement, useRef, useCallback } from 'react';
3
+ import { Button as Button$1, FieldError as FieldError$1, useContextProps, InputContext, Input as Input$1, Label as Label$1, NumberField as NumberField$1, Checkbox as Checkbox$1, Select as Select$1, SelectValue, Popover, ListBox, ListBoxItem, TextAreaContext, TextArea as TextArea$1, TextField as TextField$1 } from 'react-aria-components';
4
4
  import clsx from 'clsx';
5
5
 
6
6
  function RightArrowFilledIcon(props) {
7
7
  return (jsx("svg", { height: "11", viewBox: "0 0 6 11", width: "6", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M.267 11a.263.263 0 0 1-.226-.402l3.463-5.467a1.2 1.2 0 0 0-.103-1.43L.602.432A.262.262 0 0 1 .805 0h2.181c.078 0 .153.034.203.093l2.081 2.43a3 3 0 0 1 .259 3.575L2.5 10.877a.267.267 0 0 1-.225.123H.266z", fill: "currentColor", fillRule: "evenodd" }) }));
8
8
  }
9
9
 
10
- var styles$g = {"button":"button-module-V4meK","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","primary":"button-module-tmyk8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe","right-arrow-icon":"button-module-ydQAo","secondary":"button-module--1bCH"};
10
+ var styles$i = {"button":"button-module-V4meK","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","primary":"button-module-tmyk8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe","right-arrow-icon":"button-module-ydQAo","secondary":"button-module--1bCH"};
11
11
 
12
12
  function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, icon, isDisabled, onPress, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
13
13
  if (children && icon)
14
14
  console.warn('Button should not have both children and icon. Icon has precedence.');
15
- return (jsx(Button$1, { className: clsx(className, styles$g.button, styles$g[variant], styles$g[size], styles$g[color], { [styles$g.condensed]: condensed }, { [styles$g.icon]: icon }, styles$g[_pseudo]), isDisabled: isDisabled, onPress: onPress, type: type, children: icon ? (icon) : (jsxs(Fragment, { children: [children, withArrow && (jsx(RightArrowFilledIcon, { className: styles$g['right-arrow-icon'] }))] })) }));
15
+ return (jsx(Button$1, { className: clsx(className, styles$i.button, styles$i[variant], styles$i[size], styles$i[color], { [styles$i.condensed]: condensed }, { [styles$i.icon]: icon }, styles$i[_pseudo]), isDisabled: isDisabled, onPress: onPress, type: type, children: icon ? (icon) : (jsxs(Fragment, { children: [children, withArrow && (jsx(RightArrowFilledIcon, { className: styles$i['right-arrow-icon'] }))] })) }));
16
16
  }
17
17
 
18
- var styles$f = {"field-error":"field-error-module-FXnIg"};
18
+ var styles$h = {"field-error":"field-error-module-FXnIg"};
19
19
 
20
20
  function FieldError({ children }) {
21
- return (jsx(FieldError$1, { className: styles$f['field-error'], children: children }));
21
+ return (jsx(FieldError$1, { className: styles$h['field-error'], children: children }));
22
22
  }
23
23
 
24
- var styles$e = {"input-container":"input-module-2woJR","shadow-input":"input-module-pNKEt","lg":"input-module-Dx2qC","md":"input-module-sH6e7","focus":"input-module-hEEuy","growing-input":"input-module-6HwY4"};
24
+ var styles$g = {"input-container":"input-module-2woJR","shadow-input":"input-module-pNKEt","lg":"input-module-Dx2qC","md":"input-module-sH6e7","focus":"input-module-hEEuy","growing-input":"input-module-6HwY4"};
25
25
 
26
26
  /**
27
27
  * This component is used to create an input that grows as the user types.
@@ -36,33 +36,33 @@ const Input = forwardRef(({ _pseudo = 'none', autoGrow, size = 'lg', ...inputPro
36
36
  const handleChange = (event) => isControlled
37
37
  ? onChange?.(event)
38
38
  : setUncontrolledValue(event.target.value);
39
- return (jsx("div", { className: clsx(styles$e['input-container'], styles$e[size], styles$e[_pseudo]), children: jsxs("div", { className: clsx({ [styles$e['growing-input']]: autoGrow }), children: [jsx(Input$1, { size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange }), autoGrow && jsx("span", { className: styles$e['shadow-input'], children: value })] }) }));
39
+ return (jsx("div", { className: clsx(styles$g['input-container'], styles$g[size], styles$g[_pseudo]), children: jsxs("div", { className: clsx({ [styles$g['growing-input']]: autoGrow }), children: [jsx(Input$1, { size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange }), autoGrow && jsx("span", { className: styles$g['shadow-input'], children: value })] }) }));
40
40
  });
41
41
  Input.displayName = 'Input';
42
42
 
43
- var styles$d = {"label":"label-module-LGfJt","required":"label-module-oTWaS"};
43
+ var styles$f = {"label":"label-module-LGfJt","required":"label-module-oTWaS"};
44
44
 
45
45
  function Label({ children, isRequired }) {
46
46
  if (!children)
47
47
  return null;
48
- return (jsxs(Label$1, { className: styles$d.label, children: [children, isRequired && jsx("span", { className: styles$d.required, children: "*" })] }));
48
+ return (jsxs(Label$1, { className: styles$f.label, children: [children, isRequired && jsx("span", { className: styles$f.required, children: "*" })] }));
49
49
  }
50
50
 
51
- var styles$c = {"field":"number-field-module-gmnog","button-input-container":"number-field-module-8Lvgh"};
51
+ var styles$e = {"field":"number-field-module-gmnog","button-input-container":"number-field-module-8Lvgh"};
52
52
 
53
53
  /**
54
54
  * This component is used to create a number field.
55
55
  * This field can also grow when a user types in text.
56
56
  */
57
57
  function NumberField({ autoFocus, autoGrow, defaultValue, formatOptions = { style: 'decimal', useGrouping: false }, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel = true, size = 'lg', value, withButtons, }) {
58
- return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$c.field, styles$c[size]), defaultValue: defaultValue, formatOptions: formatOptions, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: onChange, onInput: onInput, onKeyUp: e => onKeyUp?.(e), value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs("div", { className: styles$c['button-input-container'], children: [withButtons && jsx(Button$1, { slot: "decrement", children: "-" }), jsx(Input, { autoGrow: autoGrow, maxLength: maxLength, placeholder: placeholder, size: size }), withButtons && jsx(Button$1, { slot: "increment", children: "+" })] }), jsx(FieldError, {})] }));
58
+ return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$e.field, styles$e[size]), defaultValue: defaultValue, formatOptions: formatOptions, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: onChange, onInput: onInput, onKeyUp: e => onKeyUp?.(e), value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs("div", { className: styles$e['button-input-container'], children: [withButtons && jsx(Button$1, { slot: "decrement", children: "-" }), jsx(Input, { autoGrow: autoGrow, maxLength: maxLength, placeholder: placeholder, size: size }), withButtons && jsx(Button$1, { slot: "increment", children: "+" })] }), jsx(FieldError, {})] }));
59
59
  }
60
60
 
61
61
  function CartFilledIcon(props) {
62
62
  return (jsx("svg", { height: "24", viewBox: "0 0 24 24", width: "24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M7.896 16.666a2.603 2.603 0 1 1 0 5.207 2.603 2.603 0 0 1 0-5.207zm8.925 0a2.603 2.603 0 1 1 0 5.207 2.603 2.603 0 0 1 0-5.207zM7.896 18.1c-.645 0-1.17.524-1.17 1.169s.525 1.17 1.17 1.17a1.171 1.171 0 0 0 0-2.34zm8.925 0c-.645 0-1.17.524-1.17 1.169s.525 1.17 1.17 1.17a1.171 1.171 0 0 0 0-2.34zM4.589 3c.016 0 .032.004.048.005a.714.714 0 0 1 .146.025l.05.016a.7.7 0 0 1 .083.037l.04.021a.712.712 0 0 1 .076.053l.035.03a.699.699 0 0 1 .168.223.703.703 0 0 1 .061.209c.002.014.007.027.008.042l.207 2.646h15.776c.027.001.05.006.073.008.026.003.052.004.077.01.022.004.036.011.05.016.03.008.058.016.085.028.02.009.037.02.056.03.022.012.044.024.065.038.019.013.035.029.053.044.017.015.036.029.052.046.015.016.028.034.042.051.015.019.03.037.044.057.011.018.02.038.03.057.012.021.024.042.033.065.009.022.014.044.021.067.006.022.014.043.018.066.006.027.007.054.009.081.001.018.005.035.005.053-.001.031-.005.054-.008.077-.003.026-.004.052-.01.077l-1.39 6.054-.004.017a.698.698 0 0 1-.033.1l-.008.024a.716.716 0 0 1-.06.11l-.024.03a.707.707 0 0 1-.057.07l-.035.033a.695.695 0 0 1-.175.117l-.048.022a.723.723 0 0 1-.083.026c-.014.003-.027.008-.041.01a.707.707 0 0 1-.134.014H6.096l.112 1.427H19.41a.717.717 0 0 1 0 1.434H5.544a.714.714 0 0 1-.14-.015c-.015-.003-.03-.008-.044-.012-.03-.008-.06-.016-.087-.027-.018-.008-.034-.017-.05-.026-.024-.012-.048-.023-.07-.037-.016-.011-.03-.024-.046-.036-.02-.016-.04-.03-.058-.048-.015-.014-.027-.03-.04-.044-.017-.02-.033-.038-.048-.058-.012-.017-.021-.034-.032-.052a.678.678 0 0 1-.035-.065c-.009-.02-.016-.04-.023-.06a.715.715 0 0 1-.033-.136l-.008-.045-.904-11.571H2.717a.717.717 0 1 1 0-1.434z", fill: "currentColor", fillRule: "evenodd" }) }));
63
63
  }
64
64
 
65
- var styles$b = {"manual-input-container":"add-to-cart-button-module-AWFvQ","left-button-spacer":"add-to-cart-button-module-SS7WM"};
65
+ var styles$d = {"manual-input-container":"add-to-cart-button-module-AWFvQ","left-button-spacer":"add-to-cart-button-module-SS7WM"};
66
66
 
67
67
  function AddToCartButton({ initialState = 'initial', onChange, quantity, }) {
68
68
  const [currentState, setState] = useState(initialState);
@@ -124,17 +124,17 @@ function ManualInputState({ onCancel, onConfirm, quantity, }) {
124
124
  e.key === 'Enter' && onConfirm(updatedQuantity);
125
125
  e.key === 'Escape' && onCancel();
126
126
  };
127
- return (jsxs("div", { className: styles$b['manual-input-container'], children: [jsx("div", { className: styles$b['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, defaultValue: quantity, formatOptions: {
127
+ return (jsxs("div", { className: styles$d['manual-input-container'], children: [jsx("div", { className: styles$d['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, defaultValue: quantity, formatOptions: {
128
128
  maximumFractionDigits: 0,
129
129
  style: 'decimal',
130
130
  useGrouping: false,
131
131
  }, label: "Quantity", maxLength: 4, maxValue: 9999, minValue: 0, name: "quantity", onChange: setQuantity, onKeyUp: onKeyUp, showLabel: false, size: "md" }), jsx(Button, { condensed: true, onPress: () => onConfirm(updatedQuantity), size: "md", children: "OK" })] }));
132
132
  }
133
133
 
134
- var styles$a = {"icon-button":"icon-button-module-4PDK-","md":"icon-button-module-k3s9J","lg":"icon-button-module-agk6Y","primary":"icon-button-module-fTeP4","secondary":"icon-button-module-dM0eo"};
134
+ var styles$c = {"icon-button":"icon-button-module-4PDK-","md":"icon-button-module-k3s9J","lg":"icon-button-module-agk6Y","primary":"icon-button-module-fTeP4","secondary":"icon-button-module-dM0eo"};
135
135
 
136
136
  function IconButton({ children, className, color = 'primary', onPress, size = 'md', }) {
137
- return (jsx(Button$1, { className: clsx(styles$a['icon-button'], styles$a[size], styles$a[color], className), onPress: onPress, children: children }));
137
+ return (jsx(Button$1, { className: clsx(styles$c['icon-button'], styles$c[size], styles$c[color], className), onPress: onPress, children: children }));
138
138
  }
139
139
 
140
140
  function FavoriteFilledIcon(props) {
@@ -145,23 +145,46 @@ function FavoriteOutlinedIcon(props) {
145
145
  return (jsx("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M7.333 3.33c-2.206 0-4 1.793-4 3.997 0 .857.316 1.71.967 2.604L12 20.223l7.705-10.299c.646-.888.962-1.74.962-2.597a4.003 4.003 0 0 0-4-3.996c-1.813 0-3.545 1.232-4.028 2.865a.666.666 0 0 1-1.278 0C10.878 4.563 9.146 3.33 7.333 3.33M12 22c-.21 0-.408-.1-.534-.267L3.227 10.72C2.411 9.599 2 8.46 2 7.327A5.336 5.336 0 0 1 7.333 2c1.892 0 3.669.982 4.667 2.468C12.998 2.982 14.775 2 16.667 2 19.607 2 22 4.39 22 7.327c0 1.133-.411 2.272-1.222 3.387l-8.245 11.019A.667.667 0 0 1 12 22", fill: "currentColor", fillRule: "evenodd" }) }));
146
146
  }
147
147
 
148
- var styles$9 = {"favorite-button":"favorite-button-module-tXSS3","is-favorite":"favorite-button-module-l557q"};
148
+ var styles$b = {"favorite-button":"favorite-button-module-tXSS3","is-favorite":"favorite-button-module-l557q"};
149
149
 
150
150
  function FavoriteButton({ isFavorite, onPress }) {
151
- return (jsx(IconButton, { className: clsx(styles$9['favorite-button'], {
152
- [styles$9['is-favorite']]: isFavorite,
151
+ return (jsx(IconButton, { className: clsx(styles$b['favorite-button'], {
152
+ [styles$b['is-favorite']]: isFavorite,
153
153
  }), color: "secondary", onPress: onPress, children: isFavorite ? jsx(FavoriteFilledIcon, {}) : jsx(FavoriteOutlinedIcon, {}) }));
154
154
  }
155
155
 
156
- var styles$8 = {"tag":"tag-module-B7r15","body":"tag-module-4cfCf","shape":"tag-module-c7CRb"};
156
+ var styles$a = {"tag":"tag-module-B7r15","body":"tag-module-4cfCf","shape":"tag-module-c7CRb"};
157
157
 
158
158
  function Tag({ children }) {
159
159
  if (!children)
160
160
  return null;
161
- return (jsxs("div", { className: styles$8.tag, children: [jsx("div", { className: styles$8.body, children: children }), jsx("svg", { className: styles$8.shape, height: "16", viewBox: "0 0 8 16", width: "8", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M.925 0H0v16h5.412l2.463-8.429c.362-1.238-.08-2.576-1.094-3.315L.925 0z", fill: "currentColor", fillRule: "nonzero" }) })] }));
161
+ return (jsxs("div", { className: styles$a.tag, children: [jsx("div", { className: styles$a.body, children: children }), jsx("svg", { className: styles$a.shape, height: "16", viewBox: "0 0 8 16", width: "8", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M.925 0H0v16h5.412l2.463-8.429c.362-1.238-.08-2.576-1.094-3.315L.925 0z", fill: "currentColor", fillRule: "nonzero" }) })] }));
162
162
  }
163
163
 
164
- var styles$7 = {"product-price":"product-price-module-oIU1K","original-price":"product-price-module-til0s","current-price-wrapper":"product-price-module-FfVhl","current-price":"product-price-module-pvy2w","wholes":"product-price-module-GCw07","dot":"product-price-module-N56iV","decimals":"product-price-module-eWOOF","vat":"product-price-module-96DoG"};
164
+ const IntlContext = createContext({
165
+ formatMessage: text => text,
166
+ });
167
+
168
+ const useFormattedMessage = () => {
169
+ const { formatMessage } = useContext(IntlContext);
170
+ return (id, replacementValues) => formatMessage(id,
171
+ /* The following code converts replacementValues from an object to an array.
172
+ * This is to keep the external API compatible with react-intls version
173
+ * and internally compatible with the Spire implementation of translate. */
174
+ ...(replacementValues
175
+ ? Object.keys(replacementValues)
176
+ .map(parseFloat)
177
+ .filter(index => !Number.isNaN(index))
178
+ .reduce((acc, index) => {
179
+ acc[index] = replacementValues[index];
180
+ return acc;
181
+ }, [])
182
+ : []));
183
+ };
184
+
185
+ const FormattedMessage = ({ id, replacementValues, }) => useFormattedMessage()(id, replacementValues);
186
+
187
+ var styles$9 = {"product-price":"product-price-module-oIU1K","original-price":"product-price-module-til0s","current-price-wrapper":"product-price-module-FfVhl","current-price":"product-price-module-pvy2w","wholes":"product-price-module-GCw07","dot":"product-price-module-N56iV","decimals":"product-price-module-eWOOF","vat":"product-price-module-96DoG"};
165
188
 
166
189
  const formatPrice = (price) => new Intl.NumberFormat('en-US', {
167
190
  maximumFractionDigits: 2,
@@ -173,16 +196,16 @@ function ProductPrice({ className, current, includeVat, original, }) {
173
196
  const originalPriceCurrency = original ? formatPrice(original) : null;
174
197
  const currentPriceCurrency = formatPrice(current);
175
198
  const [wholes, decimals] = currentPriceCurrency.split('.');
176
- return (jsxs("div", { className: clsx(className, styles$7['product-price']), children: [!!original && (jsx("span", { className: styles$7['original-price'], children: originalPriceCurrency })), jsxs("div", { className: styles$7['current-price-wrapper'], children: [jsxs("div", { className: styles$7['current-price'], children: [jsx("span", { className: styles$7.wholes, children: wholes }), jsx("span", { className: styles$7.dot, children: "." }), jsx("span", { className: styles$7.decimals, children: decimals })] }), jsx("span", { className: styles$7.vat, children: includeVat ? 'incl. tax' : 'excl. tax' })] })] }));
199
+ return (jsxs("div", { className: clsx(className, styles$9['product-price']), children: [!!original && (jsx("span", { className: styles$9['original-price'], children: originalPriceCurrency })), jsxs("div", { className: styles$9['current-price-wrapper'], children: [jsxs("div", { className: styles$9['current-price'], children: [jsx("span", { className: styles$9.wholes, children: wholes }), jsx("span", { className: styles$9.dot, children: "." }), jsx("span", { className: styles$9.decimals, children: decimals })] }), jsx("span", { className: styles$9.vat, children: includeVat ? (jsx(FormattedMessage, { id: "Incl. VAT" })) : (jsx(FormattedMessage, { id: "Excl. VAT" })) })] })] }));
177
200
  }
178
201
 
179
- var styles$6 = {"product-sku":"product-sku-module-ITb8x"};
202
+ var styles$8 = {"product-sku":"product-sku-module-ITb8x"};
180
203
 
181
204
  function ProductSku({ sku }) {
182
- return jsx("p", { className: styles$6['product-sku'], children: sku });
205
+ return jsx("p", { className: styles$8['product-sku'], children: sku });
183
206
  }
184
207
 
185
- var styles$5 = {"image":"image-module-lg7Kj","contain":"image-module-KFEgG","cover":"image-module-tVKFe"};
208
+ var styles$7 = {"image":"image-module-lg7Kj","contain":"image-module-KFEgG","cover":"image-module-tVKFe"};
186
209
 
187
210
  const breakpointToWidth = {
188
211
  lg: 1440,
@@ -207,21 +230,62 @@ function Image({ alt, className, fallbackSrc = '/images/fallback.svg', fit = 'co
207
230
  const handleError = () => {
208
231
  setCurrentSrc(fallbackSrc);
209
232
  };
210
- return (jsx("img", { alt: alt, className: clsx(styles$5.image, styles$5[fit], className), height: height, loading: loading, onError: handleError, sizes: sizes, src: currentSrc, srcSet: srcSet, title: title, width: width }));
233
+ return (jsx("img", { alt: alt, className: clsx(styles$7.image, styles$7[fit], className), height: height, loading: loading, onError: handleError, sizes: sizes, src: currentSrc, srcSet: srcSet, title: title, width: width }));
211
234
  }
212
235
 
213
- var styles$4 = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
236
+ var styles$6 = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
214
237
 
215
238
  function ProductCard({ addToCartButton: AddToCartButton, favoriteButton: FavoriteButton, image: { alt, fit, src, title: imageTitle }, onClick, price, sku, tag, title, }) {
216
- return (jsxs("div", { className: styles$4['product-card'], onClick: onClick, children: [jsx("div", { className: styles$4.image, children: jsx(Image, { alt: alt, fit: fit, src: src, title: imageTitle }) }), jsx("div", { className: styles$4['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$4.content, children: [jsxs("div", { className: styles$4.top, children: [jsx("div", { className: styles$4.tag, children: tag && jsx(Tag, { children: tag }) }), jsx("h2", { className: styles$4.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$4.bottom, children: [jsx("div", { className: styles$4.price, children: jsx(ProductPrice, { current: price.current, includeVat: price.includeVat, original: price.original }) }), jsx("div", { className: styles$4['add-to-cart-button'], children: AddToCartButton })] })] })] }));
239
+ return (jsxs("div", { className: styles$6['product-card'], onClick: onClick, children: [jsx("div", { className: styles$6.image, children: jsx(Image, { alt: alt, fit: fit, src: src, title: imageTitle }) }), jsx("div", { className: styles$6['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$6.content, children: [jsxs("div", { className: styles$6.top, children: [jsx("div", { className: styles$6.tag, children: tag && jsx(Tag, { children: tag }) }), jsx("h2", { className: styles$6.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$6.bottom, children: [jsx("div", { className: styles$6.price, children: jsx(ProductPrice, { current: price.current, includeVat: price.includeVat, original: price.original }) }), jsx("div", { className: styles$6['add-to-cart-button'], children: AddToCartButton })] })] })] }));
217
240
  }
218
241
 
219
- var styles$3 = {"checkbox":"checkbox-module-YNVdd","box":"checkbox-module-UKoyf","checkmark":"checkbox-module-pHIwh","focus":"checkbox-module-v23jy","active":"checkbox-module-7UG-b"};
242
+ var styles$5 = {"accordion":"accordion-module-9WvAH","white":"accordion-module-CaVdG","accordion-item":"accordion-module-lf9d-","lg":"accordion-module-0qnae","with-seperators":"accordion-module-yOLrW","button":"accordion-module--Rwpb","icon":"accordion-module-Y50uq","focus":"accordion-module-M4BZs","panel":"accordion-module-KZjMo","content":"accordion-module-ejMH3","is-open":"accordion-module-W0F1z"};
243
+
244
+ function Accordion({ children, color = 'black', hasLineSeparator = true, size = 'md', }) {
245
+ return (jsx("div", { className: clsx(styles$5.accordion, styles$5[color], styles$5[size], hasLineSeparator && styles$5['with-seperators']), children: children &&
246
+ Children.map(children, child => {
247
+ return cloneElement(child, { size });
248
+ }) }));
249
+ }
250
+
251
+ var styles$4 = {"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"};
220
252
 
221
253
  function Checkbox({ _pseudo = 'none', children, className, isDisabled, isSelected, onChange, value, }) {
222
- return (jsxs(Checkbox$1, { className: clsx(className, styles$3.checkbox, styles$3[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles$3.box, children: jsx("svg", { "aria-hidden": "true", className: styles$3.checkmark, viewBox: "0 0 18 18", children: jsx("polyline", { points: "1 9 7 14 15 4" }) }) }), children] }));
254
+ return (jsxs(Checkbox$1, { className: clsx(className, styles$4.checkbox, styles$4[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles$4.box, children: jsx("svg", { "aria-hidden": "true", className: styles$4.checkmark, viewBox: "0 0 18 18", children: jsx("polyline", { points: "1 9 7 14 15 4" }) }) }), children] }));
255
+ }
256
+
257
+ function ColorCheckbox({ _pseudo = 'none', children, className, color, isDisabled, isSelected, onChange, value, }) {
258
+ return (jsxs(Checkbox$1, { className: clsx(className, styles$4.checkbox, styles$4['color-checkbox'], styles$4[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, style: {
259
+ '--selected-color': color,
260
+ }, value: value, children: [jsx("div", { className: styles$4.box }), children] }));
223
261
  }
224
262
 
263
+ function ChevronDownSlim(props) {
264
+ return (jsx("svg", { viewBox: "0 0 16 17", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "m8 12.648-6.667-6.7a3.11 3.11 0 0 1 .466-.75c.202-.245.444-.477.726-.698l5.459 5.546L13.328 4.5c.288.226.543.459.764.699.222.24.413.489.575.75L8 12.648z", fill: "currentColor", fillRule: "evenodd" }) }));
265
+ }
266
+
267
+ function CheckmarkFilledIcon(props) {
268
+ return (jsx("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M10.864 17c-.2 0-.378-.045-.534-.135a1.588 1.588 0 0 1-.446-.407L6.278 12.22c-.185-.233-.278-.474-.278-.722 0-.264.087-.488.262-.672a.86.86 0 0 1 .651-.276c.156 0 .299.033.429.101s.258.188.384.361l3.094 3.71 5.42-8.19c.216-.354.483-.531.802-.531.245 0 .466.08.663.243A.785.785 0 0 1 18 6.88c0 .12-.028.243-.084.367a2.53 2.53 0 0 1-.194.356l-5.934 8.844c-.23.369-.538.553-.924.553z", fill: "currentColor", fillRule: "evenodd" }) }));
269
+ }
270
+
271
+ var styles$3 = {"select":"select-module-ui-Wc","button":"select-module-aMQIQ","chevron":"select-module-00uRU","focus":"select-module-XMc0P","popover":"select-module-z8cWq","listbox":"select-module-S21ba","item":"select-module-LgEJO","check":"select-module-lQFw3"};
272
+
273
+ const Select = ({ disabled = false, label, onChange, options, selectedOption, showLabel = true, }) => {
274
+ const selectRef = useRef(null);
275
+ useEffect(() => {
276
+ const updateWidth = () => {
277
+ if (!selectRef.current)
278
+ return;
279
+ const width = selectRef.current.getBoundingClientRect().width;
280
+ selectRef.current.style.setProperty('--trigger-width', `${width}px`);
281
+ };
282
+ updateWidth();
283
+ window.addEventListener('resize', updateWidth);
284
+ return () => window.removeEventListener('resize', updateWidth);
285
+ }, []);
286
+ return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: styles$3.select, isDisabled: disabled, onSelectionChange: selected => onChange(String(selected)), selectedKey: selectedOption, children: [showLabel && jsx(Label, { children: label }), jsxs(Button$1, { className: styles$3.button, children: [jsx(SelectValue, {}), jsx(ChevronDownSlim, { "aria-hidden": "true", className: styles$3.chevron })] }), jsx(Popover, { className: styles$3.popover, placement: "bottom left", triggerRef: selectRef, children: jsx(ListBox, { className: styles$3.listbox, children: Object.entries(options).map(([key, value]) => (jsxs(ListBoxItem, { "aria-label": value, className: styles$3.item, id: key, textValue: value, children: [selectedOption === key && (jsx("span", { slot: "description", children: jsx(CheckmarkFilledIcon, { className: styles$3.check }) })), jsx("span", { slot: "label", children: value })] }, key))) }) })] }));
287
+ };
288
+
225
289
  var styles$2 = {"input-container":"textarea-module-C6Xr1","lg":"textarea-module-vksG-","md":"textarea-module-6JrQJ"};
226
290
 
227
291
  /**
@@ -293,6 +357,10 @@ function HashedOutlinedIcon(props) {
293
357
  return (jsx("svg", { height: "24", viewBox: "0 0 24 24", width: "24", xmlns: "http://www.w3.org/2000/svg", ...props, children: jsx("path", { d: "M12 7.666C9.54 7.666 7.538 9.61 7.538 12c0 2.39 2.001 4.334 4.462 4.334 2.46 0 4.462-1.944 4.462-4.334 0-2.39-2.001-4.334-4.462-4.334M12 5c5.514 0 10 3.14 10 7s-4.486 7-10 7-10-3.14-10-7 4.486-7 10-7zm0 1.292c-2.39 0-4.624.642-6.29 1.809C4.175 9.175 3.33 10.56 3.33 12s.845 2.825 2.38 3.9c1.666 1.166 3.9 1.808 6.29 1.808s4.624-.642 6.29-1.809c1.535-1.074 2.38-2.459 2.38-3.9 0-1.44-.845-2.824-2.38-3.898-1.666-1.167-3.9-1.81-6.29-1.81zm0 3.958c.994 0 1.802.785 1.802 1.75s-.808 1.75-1.802 1.75-1.802-.785-1.802-1.75.808-1.75 1.802-1.75z", fill: "currentColor", fillRule: "evenodd" }) }));
294
358
  }
295
359
 
360
+ function IntlProvider({ children, formatMessage }) {
361
+ return (jsx(IntlContext.Provider, { value: { formatMessage }, children: children }));
362
+ }
363
+
296
364
  var styles = {"product-grid":"product-overview-grid-module-bzys-","grid-item":"product-overview-grid-module-MlUVA"};
297
365
 
298
366
  function ProductOverviewGrid({ children }) {
@@ -332,4 +400,4 @@ function parseProductListingSearchParams(params) {
332
400
  };
333
401
  }
334
402
 
335
- export { AddToCartButton, Button, CartFilledIcon, CartOutlinedIcon, Checkbox, DehashedOutlinedIcon, FavoriteButton, FavoriteFilledIcon, FavoriteOutlinedIcon, HashedOutlinedIcon, IconButton, Image, NumberField, ProductCard, ProductListing, ProductOverviewGrid, ProductPrice, ProductSku, RightArrowFilledIcon, TextField, createProductListingSearchParams, parseProductListingSearchParams };
403
+ export { Accordion, AddToCartButton, Button, CartFilledIcon, CartOutlinedIcon, Checkbox, ColorCheckbox, DehashedOutlinedIcon, FavoriteButton, FavoriteFilledIcon, FavoriteOutlinedIcon, FormattedMessage, HashedOutlinedIcon, IconButton, Image, IntlProvider, NumberField, ProductCard, ProductListing, ProductOverviewGrid, ProductPrice, ProductSku, RightArrowFilledIcon, Select, TextField, createProductListingSearchParams, parseProductListingSearchParams, useFormattedMessage };
@@ -0,0 +1,7 @@
1
+ import { ComponentType } from 'react';
2
+ import { TranslationId } from './translation-id';
3
+ export interface FormattedMessageProps {
4
+ id: TranslationId;
5
+ replacementValues?: Record<string, string>;
6
+ }
7
+ export declare const FormattedMessage: ComponentType<FormattedMessageProps>;
@@ -0,0 +1,16 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { FormattedMessageProps } from './formatted-message';
3
+ declare const translations: {
4
+ readonly 'Excl. VAT': "Excl. VAT";
5
+ readonly 'Incl. VAT': "Incl. VAT";
6
+ readonly 'Replacement Value Test': "Replacement Test: Value1=${1}, Value0=${0}, Value1=${1}, Value0=${0}";
7
+ };
8
+ type Translations = typeof translations;
9
+ type Props = Omit<FormattedMessageProps, 'id'> & {
10
+ id: keyof Translations;
11
+ };
12
+ declare const meta: Meta<Props>;
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+ export declare const SimpleFormattedMessage: Story;
16
+ export declare const FormattedMessageWithReplacementValue: Story;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { FormatMessageFunction } from './types';
3
+ interface IntlContextType {
4
+ formatMessage: FormatMessageFunction;
5
+ }
6
+ export declare const IntlContext: React.Context<IntlContextType>;
7
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { FormatMessageFunction } from './types';
3
+ interface IntlProviderProps {
4
+ children: React.ReactNode;
5
+ formatMessage: FormatMessageFunction;
6
+ }
7
+ export declare function IntlProvider({ children, formatMessage }: IntlProviderProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface Translations {
2
+ 'Excl. VAT': string;
3
+ 'Incl. VAT': string;
4
+ }
5
+ export type TranslationId = keyof Translations;
@@ -0,0 +1 @@
1
+ export type FormatMessageFunction = (id: string, ...replacementValues: readonly string[]) => string;
@@ -0,0 +1,3 @@
1
+ import { TranslationId } from './translation-id';
2
+ export type FormattedMessageFunction = (key: TranslationId, replacementValues?: Record<string, string>) => string;
3
+ export declare const useFormattedMessage: () => FormattedMessageFunction;
package/dist/styles.css CHANGED
@@ -206,9 +206,13 @@
206
206
  --border-width-3: 4px;
207
207
  }
208
208
  :root {
209
+ /* Outlines */
209
210
  --shadow-focus-outline: 0 0 1px 2px rgb(227 6 19 / 40%);
210
211
  --shadow-focus-outline-padded: 0 0 1px 4px rgb(227 6 19 / 40%);
211
- --box-shadow: 0 0 96px 0 rgb(0 0 0 / 30%);
212
+
213
+ /* Box shadows */
214
+ --box-shadow-96: 0 0 96px 0 rgb(0 0 0 / 30%);
215
+ --box-shadow-8: 0 0 8px 0 rgb(0 0 0 / 30%);
212
216
  }
213
217
 
214
218
  .button-module-V4meK {
@@ -555,6 +559,7 @@
555
559
 
556
560
  display: flex;
557
561
  flex-direction: column;
562
+ line-height: 1;
558
563
  }
559
564
 
560
565
  .product-price-module-oIU1K .product-price-module-til0s {
@@ -580,13 +585,8 @@
580
585
  font-size: var(--font-size-36);
581
586
  font-style: var(--current-price-font-style);
582
587
  font-weight: var(--font-weight-black);
583
- line-height: 1;
584
588
  }
585
589
 
586
- .product-price-module-oIU1K .product-price-module-pvy2w > * {
587
- line-height: 1;
588
- }
589
-
590
590
  .product-price-module-oIU1K .product-price-module-pvy2w .product-price-module-GCw07,
591
591
  .product-price-module-oIU1K .product-price-module-pvy2w .product-price-module-N56iV {
592
592
  font-size: var(--font-size-wholes);
@@ -681,6 +681,7 @@
681
681
  margin-bottom: var(--space-8);
682
682
  -webkit-box-orient: vertical;
683
683
  font-size: var(--title-font-size);
684
+ font-weight: var(--font-weight-bold);
684
685
  -webkit-line-clamp: 4;
685
686
  line-height: 1;
686
687
  text-wrap: balance;
@@ -694,9 +695,11 @@
694
695
  }
695
696
 
696
697
  .product-card-module-pLaiB .product-card-module-p-zoi {
698
+ display: grid;
697
699
  width: var(--image-width);
698
700
  aspect-ratio: 1 / 1;
699
701
  margin-inline: auto;
702
+ place-items: center;
700
703
  }
701
704
 
702
705
  .product-card-module-pLaiB .product-card-module-p-zoi img {
@@ -718,7 +721,7 @@
718
721
 
719
722
  @media (hover: hover) {
720
723
  .product-card-module-pLaiB:hover {
721
- box-shadow: var(--box-shadow);
724
+ box-shadow: var(--box-shadow-96);
722
725
  scale: 1.04;
723
726
  }
724
727
  }
@@ -753,6 +756,112 @@
753
756
  }
754
757
  }
755
758
 
759
+ .accordion-module-9WvAH {
760
+ --color: var(--color-black);
761
+ --button-font-size: var(--font-size-16);
762
+ --seperator-color: transparent;
763
+ }
764
+
765
+ .accordion-module-9WvAH.accordion-module-CaVdG {
766
+ --color: var(--color-white);
767
+ }
768
+
769
+ .accordion-module-9WvAH.accordion-module-CaVdG .accordion-module-lf9d- button[aria-expanded='true'] {
770
+ background-color: initial;
771
+ }
772
+
773
+ .accordion-module-9WvAH.accordion-module-0qnae {
774
+ --button-font-size: var(--font-size-20);
775
+ }
776
+
777
+ .accordion-module-9WvAH.accordion-module-yOLrW {
778
+ --seperator-color: var(--color-gray-500);
779
+ }
780
+
781
+ .accordion-module-9WvAH.accordion-module-yOLrW.accordion-module-CaVdG {
782
+ --seperator-color: var(--color-white);
783
+ }
784
+
785
+ .accordion-module-lf9d- {
786
+ --padding: var(--space-16);
787
+ --transition-duration: 0.2s;
788
+
789
+ border-bottom: 1px solid var(--seperator-color);
790
+ }
791
+
792
+ .accordion-module-lf9d- h3 {
793
+ margin: 0;
794
+ }
795
+
796
+ .accordion-module-lf9d- .accordion-module--Rwpb {
797
+ position: relative;
798
+ display: block;
799
+ width: 100%;
800
+ padding: var(--padding);
801
+ padding-right: calc(var(--padding) * 2);
802
+ border: none;
803
+ background: none;
804
+ color: var(--color);
805
+ cursor: pointer;
806
+ font: inherit;
807
+ font-size: var(--button-font-size);
808
+ font-weight: var(--font-weight-bold);
809
+ line-height: 1;
810
+ text-align: left;
811
+ }
812
+
813
+ .accordion-module-lf9d- .accordion-module--Rwpb .accordion-module-Y50uq svg {
814
+ position: absolute;
815
+ display: block;
816
+ width: 16px;
817
+ height: 16px;
818
+ inset: 0 12px 0 auto;
819
+ margin-block: auto;
820
+ transform: rotate(0deg);
821
+ transition: transform var(--transition-duration) ease;
822
+ }
823
+
824
+ .accordion-module-lf9d- .accordion-module--Rwpb:focus-visible,
825
+ .accordion-module-lf9d- .accordion-module--Rwpb.accordion-module-M4BZs {
826
+ box-shadow: var(--shadow-focus-outline-padded);
827
+ outline: none;
828
+ }
829
+
830
+ .accordion-module-lf9d- .accordion-module--Rwpb[aria-expanded='true'] {
831
+ background-color: var(--color-gray-100);
832
+ }
833
+
834
+ .accordion-module-lf9d- .accordion-module--Rwpb[disabled] {
835
+ --color: var(--color-gray-100);
836
+ }
837
+
838
+ .accordion-module-lf9d- .accordion-module-KZjMo {
839
+ display: grid;
840
+ grid-template-rows: 0fr;
841
+ padding-inline: var(--padding);
842
+ transition:
843
+ grid-template-rows var(--transition-duration) linear,
844
+ padding-block var(--transition-duration) linear;
845
+ }
846
+
847
+ .accordion-module-lf9d- .accordion-module-KZjMo .accordion-module-ejMH3 {
848
+ overflow: hidden;
849
+ color: var(--color);
850
+ }
851
+
852
+ .accordion-module-lf9d-.accordion-module-W0F1z .accordion-module-Y50uq svg {
853
+ transform: rotate(-180deg);
854
+ }
855
+
856
+ .accordion-module-lf9d-.accordion-module-W0F1z .accordion-module-KZjMo {
857
+ grid-template-rows: 1fr;
858
+ padding-block: 0.5rem;
859
+ }
860
+
861
+ .accordion-module-lf9d-:has(.accordion-module--Rwpb[disabled]) {
862
+ border-color: var(--color-gray-100);
863
+ }
864
+
756
865
  .checkbox-module-YNVdd {
757
866
  --selected-color: var(--color-brand-red);
758
867
  --selected-color-pressed: var(--color-brand-dark-red);
@@ -769,6 +878,7 @@
769
878
  box-sizing: border-box;
770
879
  align-items: center;
771
880
  color: var(--color-brand-black);
881
+ cursor: pointer;
772
882
  forced-color-adjust: none;
773
883
  gap: 4px;
774
884
  }
@@ -833,6 +943,114 @@
833
943
  stroke: none;
834
944
  }
835
945
 
946
+ /* stylelint-disable-next-line no-descending-specificity */
947
+
948
+ .checkbox-module-YNVdd.checkbox-module-nEhvW .checkbox-module-UKoyf {
949
+ border: none;
950
+ background: var(--selected-color);
951
+ background-size: 16px 16px;
952
+ transition: none;
953
+ }
954
+
955
+ .checkbox-module-YNVdd.checkbox-module-nEhvW[data-selected] .checkbox-module-UKoyf, .checkbox-module-YNVdd.checkbox-module-nEhvW[data-indeterminate] .checkbox-module-UKoyf {
956
+ border: 1px solid var(--color-brand-red);
957
+ background: unset;
958
+ background-image: linear-gradient(
959
+ var(--selected-color),
960
+ var(--selected-color)
961
+ ),
962
+ linear-gradient(var(--selected-color), var(--selected-color));
963
+ background-position:
964
+ 2px 2px,
965
+ 14px 14px;
966
+ background-repeat: no-repeat;
967
+ background-size: 10px 10px;
968
+ }
969
+
970
+ .select-module-ui-Wc {
971
+ --trigger-width: initial;
972
+
973
+ all: unset;
974
+ position: relative;
975
+ display: grid;
976
+ width: 100%;
977
+ gap: var(--space-4);
978
+ }
979
+
980
+ .select-module-aMQIQ {
981
+ all: unset;
982
+ position: relative;
983
+ display: flex;
984
+ width: 100%;
985
+ height: var(--space-44);
986
+ box-sizing: border-box;
987
+ align-items: center;
988
+ padding: 10px 32px 10px 16px;
989
+ border: 1px solid var(--color-brand-medium-gray);
990
+ border-radius: var(--border-radius-8);
991
+ font: inherit;
992
+ gap: var(--space-16);
993
+ outline: none;
994
+ }
995
+
996
+ .select-module-aMQIQ .select-module-00uRU {
997
+ position: absolute;
998
+ display: block;
999
+ width: var(--space-12);
1000
+ height: var(--space-12);
1001
+ inset-block: 0;
1002
+ inset-inline-end: 14px;
1003
+ margin-block: auto;
1004
+ }
1005
+
1006
+ .select-module-aMQIQ [slot='description'] {
1007
+ display: none;
1008
+ }
1009
+
1010
+ .select-module-aMQIQ.select-module-XMc0P,
1011
+ .select-module-aMQIQ:focus,
1012
+ .select-module-aMQIQ:has([data-focused]) {
1013
+ border-color: transparent;
1014
+ box-shadow: var(--shadow-focus-outline);
1015
+ outline: none;
1016
+ }
1017
+
1018
+ .select-module-aMQIQ[disabled] {
1019
+ border: 1px solid var(--color-brand-light-gray);
1020
+ }
1021
+
1022
+ .select-module-z8cWq {
1023
+ width: var(--trigger-width);
1024
+ background-color: var(--color-white);
1025
+ box-shadow: var(--box-shadow-8);
1026
+ }
1027
+
1028
+ .select-module-S21ba {
1029
+ outline: none;
1030
+ }
1031
+
1032
+ .select-module-LgEJO {
1033
+ position: relative;
1034
+ padding: var(--space-8) var(--space-24);
1035
+ cursor: pointer;
1036
+ outline: none;
1037
+ word-break: break-word;
1038
+ }
1039
+
1040
+ .select-module-LgEJO .select-module-lQFw3 {
1041
+ position: absolute;
1042
+ width: var(--space-24);
1043
+ height: var(--space-24);
1044
+ inset: 0;
1045
+ margin-block: auto;
1046
+ }
1047
+
1048
+ .select-module-LgEJO:hover,
1049
+ .select-module-LgEJO:focus {
1050
+ background-color: var(--color-brand-red);
1051
+ color: var(--color-white);
1052
+ }
1053
+
836
1054
  .textarea-module-C6Xr1 {
837
1055
  position: relative;
838
1056
  display: inline-block;
@@ -11,7 +11,7 @@ interface HeadingProps {
11
11
  tag?: Tag;
12
12
  uppercase?: boolean;
13
13
  }
14
- export declare function Heading({ children, className, italic, size, tag, uppercase, }: HeadingProps): import("react").ReactElement<{
14
+ export declare function Heading({ children, className, italic, size, tag, uppercase, }: HeadingProps): React.ReactElement<{
15
15
  className: string;
16
- }, string | import("react").JSXElementConstructor<any>>;
16
+ }, string | React.JSXElementConstructor<any>>;
17
17
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -28,8 +28,9 @@
28
28
  "lint:fix": "eslint . --fix --ext ts,tsx,cjs,js,mdx --report-unused-disable-directives --max-warnings 0 --cache --cache-location node_modules/.cache/.eslintcache",
29
29
  "prepare": "husky",
30
30
  "start": "http-server ./storybook-static",
31
- "stylelint": "stylelint --config .stylelintrc.cjs \"src/**/*.css\" --formatter verbose",
31
+ "stylelint": "stylelint --config .stylelintrc.cjs \"src/**/*.css\"",
32
32
  "stylelint:fix": "stylelint --config .stylelintrc.cjs \"src/**/*.css\" --formatter verbose --fix",
33
+ "test:all": "npx concurrently -g --names \"TSC,ESLINT,STYLELINT\" -c auto --kill-others-on-fail \"pnpm test:types\" \"pnpm lint\" \"pnpm stylelint\"",
33
34
  "test:types": "tsc --noEmit --pretty false",
34
35
  "update-packages": "npx npm-check-updates -u"
35
36
  },
@@ -40,14 +41,15 @@
40
41
  "devDependencies": {
41
42
  "@chromatic-com/storybook": "^1.3.3",
42
43
  "@csstools/postcss-global-data": "^2.1.1",
44
+ "@rollup/plugin-alias": "^5.1.0",
43
45
  "@rollup/plugin-commonjs": "^25.0.7",
44
46
  "@rollup/plugin-node-resolve": "^15.2.3",
45
47
  "@rollup/plugin-typescript": "^11.1.6",
46
- "@storybook/addon-viewport": "^8.0.9",
47
48
  "@storybook/addon-docs": "^8.0.9",
48
49
  "@storybook/addon-essentials": "^8.0.9",
49
50
  "@storybook/addon-interactions": "^8.0.9",
50
51
  "@storybook/addon-links": "^8.0.9",
52
+ "@storybook/addon-viewport": "^8.0.9",
51
53
  "@storybook/blocks": "^8.0.9",
52
54
  "@storybook/preview-api": "^8.0.9",
53
55
  "@storybook/react": "^8.0.9",
@@ -59,6 +61,7 @@
59
61
  "@typescript-eslint/parser": "^7.7.1",
60
62
  "@vitejs/plugin-react": "^4.2.1",
61
63
  "autoprefixer": "^10.4.19",
64
+ "concurrently": "^8.2.2",
62
65
  "eslint": "^8.57.0",
63
66
  "eslint-config-prettier": "^9.1.0",
64
67
  "eslint-import-resolver-typescript": "^3.6.1",
@@ -76,7 +79,6 @@
76
79
  "eslint-plugin-unused-imports": "^3.1.0",
77
80
  "http-server": "^14.1.1",
78
81
  "husky": "^9.0.11",
79
- "lint-staged": "^15.2.2",
80
82
  "postcss": "^8.4.38",
81
83
  "postcss-custom-media": "^10.0.4",
82
84
  "postcss-import": "^16.1.0",
@@ -101,10 +103,6 @@
101
103
  "clsx": "^2.1.1",
102
104
  "react-aria-components": "^1.1.1"
103
105
  },
104
- "lint-staged": {
105
- "src/**/*.css": "pnpm stylelint",
106
- "src/**/*.{ts,tsx}": "pnpm lint"
107
- },
108
106
  "publishConfig": {
109
107
  "access": "public"
110
108
  }