@faststore/ui 1.3.42 → 1.3.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,41 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.3.46 (2021-12-23)
7
+
8
+ **Note:** Version bump only for package @faststore/ui
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.3.45 (2021-12-21)
15
+
16
+ **Note:** Version bump only for package @faststore/ui
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.3.44 (2021-12-21)
23
+
24
+ **Note:** Version bump only for package @faststore/ui
25
+
26
+
27
+
28
+
29
+
30
+ ## 1.3.43 (2021-12-20)
31
+
32
+
33
+ ### Features
34
+
35
+ * QuantitySelector component ([#1083](https://github.com/vtex/faststore/issues/1083)) ([6ade6c0](https://github.com/vtex/faststore/commit/6ade6c02b06fdb74ba2cd2978d8ac4bda35672d2))
36
+
37
+
38
+
39
+
40
+
6
41
  ## 1.3.42 (2021-12-20)
7
42
 
8
43
  **Note:** Version bump only for package @faststore/ui
package/dist/index.d.ts CHANGED
@@ -64,6 +64,8 @@ export { default as Form } from './molecules/Form';
64
64
  export type { FormProps } from './molecules/Form';
65
65
  export { default as Alert } from './molecules/Alert';
66
66
  export type { AlertProps } from './molecules/Alert';
67
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
68
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector';
67
69
  export { default as Card, CardImage, CardContent, CardActions, } from './organisms/Card';
68
70
  export type { CardProps, CardImageProps, CardContentProps, CardActionsProps, } from './organisms/Card';
69
71
  export { default as useSlider } from './hooks/useSlider';
@@ -0,0 +1,30 @@
1
+ import type { InputHTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ import type { InputProps } from '../../atoms/Input';
4
+ import type { IconButtonProps } from '../IconButton';
5
+ export interface QuantitySelectorProps extends InputHTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * Sets the current value that should be displayed on the input at the center of the quantity selector.
8
+ */
9
+ quantity: number | string;
10
+ /**
11
+ * Object with properties that will be passed forward the inner IconButton atom at the left of the input.
12
+ */
13
+ leftButtonProps: IconButtonProps;
14
+ /**
15
+ * Object with properties that will be passed forward the inner Input atom between the two buttons.
16
+ */
17
+ inputProps: InputProps;
18
+ /**
19
+ * Object with properties that will be passed forward the inner IconButton atom at the right of the input.
20
+ */
21
+ rightButtonProps: IconButtonProps;
22
+ /**
23
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
24
+ *
25
+ * @default 'store-quantity-selector'
26
+ */
27
+ testId?: string;
28
+ }
29
+ declare const QuantitySelector: React.ForwardRefExoticComponent<QuantitySelectorProps & React.RefAttributes<HTMLDivElement>>;
30
+ export default QuantitySelector;
@@ -0,0 +1,2 @@
1
+ export { default } from './QuantitySelector';
2
+ export type { QuantitySelectorProps } from './QuantitySelector';
@@ -0,0 +1,5 @@
1
+ import type { Story } from '@storybook/react';
2
+ import type { QuantitySelectorProps } from '../QuantitySelector';
3
+ export declare const QuantitySelector: Story<QuantitySelectorProps>;
4
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
5
+ export default _default;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ declare type QuantitySelectorIconProps = {
3
+ color: string;
4
+ };
5
+ export declare function PlusIcon(props: QuantitySelectorIconProps): JSX.Element;
6
+ export declare function MinusIcon(props: QuantitySelectorIconProps): JSX.Element;
7
+ export {};
@@ -1,14 +1,10 @@
1
- import type { HTMLAttributes, AriaAttributes } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
2
  import React from 'react';
3
- export interface CardContentProps extends HTMLAttributes<HTMLDivElement> {
3
+ export interface CardContentProps extends HTMLAttributes<HTMLElement> {
4
4
  /**
5
5
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
6
  */
7
7
  testId?: string;
8
- /**
9
- * Defines a string value that labels the current element.
10
- */
11
- 'aria-label'?: AriaAttributes['aria-label'];
12
8
  }
13
- declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
9
+ declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLElement>>;
14
10
  export default CardContent;
@@ -1520,6 +1520,34 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert({
1520
1520
  }, otherProps), children);
1521
1521
  });
1522
1522
 
1523
+ const QuantitySelector = /*#__PURE__*/React.forwardRef(function QuantitySelector({
1524
+ quantity,
1525
+ testId = 'store-quantity-selector',
1526
+ leftButtonProps,
1527
+ inputProps,
1528
+ rightButtonProps,
1529
+ ...otherProps
1530
+ }, ref) {
1531
+ return React__default.createElement("div", Object.assign({
1532
+ "data-store-quantity-selector": true,
1533
+ "data-testid": testId,
1534
+ ref: ref
1535
+ }, otherProps), React__default.createElement(IconButton, Object.assign({
1536
+ "aria-controls": "quantity-selector-input",
1537
+ "aria-label": "Decrement Quantity",
1538
+ "data-quantity-selector-button": "left"
1539
+ }, leftButtonProps)), React__default.createElement(Input, Object.assign({
1540
+ "aria-label": "Quantity",
1541
+ "data-quantity-selector-input": true,
1542
+ id: "quantity-selector-input",
1543
+ value: quantity
1544
+ }, inputProps)), React__default.createElement(IconButton, Object.assign({
1545
+ "aria-controls": "quantity-selector-input",
1546
+ "aria-label": "Increment Quantity",
1547
+ "data-quantity-selector-button": "right"
1548
+ }, rightButtonProps)));
1549
+ });
1550
+
1523
1551
  const Card = /*#__PURE__*/React.forwardRef(function Card({
1524
1552
  testId = 'store-card',
1525
1553
  children,
@@ -1546,14 +1574,11 @@ const CardImage = /*#__PURE__*/React.forwardRef(function CardImage({
1546
1574
 
1547
1575
  const CardContent = /*#__PURE__*/React.forwardRef(function CardContent({
1548
1576
  testId = 'store-card-content',
1549
- 'aria-label': ariaLabel = 'Card content',
1550
1577
  children,
1551
1578
  ...otherProps
1552
1579
  }, ref) {
1553
- return React__default.createElement("div", Object.assign({
1580
+ return React__default.createElement("section", Object.assign({
1554
1581
  ref: ref,
1555
- role: "region",
1556
- "aria-label": ariaLabel,
1557
1582
  "data-store-card-content": true,
1558
1583
  "data-testid": testId
1559
1584
  }, otherProps), children);
@@ -1605,6 +1630,7 @@ exports.PaymentMethods = PaymentMethods;
1605
1630
  exports.Popover = Popover;
1606
1631
  exports.Price = Price;
1607
1632
  exports.PriceRange = PriceRange;
1633
+ exports.QuantitySelector = QuantitySelector;
1608
1634
  exports.Radio = Radio;
1609
1635
  exports.RadioGroup = RadioGroup;
1610
1636
  exports.RadioOption = RadioOption;