@faststore/ui 1.3.41 → 1.3.45

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.45 (2021-12-21)
7
+
8
+ **Note:** Version bump only for package @faststore/ui
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.3.44 (2021-12-21)
15
+
16
+ **Note:** Version bump only for package @faststore/ui
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.3.43 (2021-12-20)
23
+
24
+
25
+ ### Features
26
+
27
+ * QuantitySelector component ([#1083](https://github.com/vtex/faststore/issues/1083)) ([6ade6c0](https://github.com/vtex/faststore/commit/6ade6c02b06fdb74ba2cd2978d8ac4bda35672d2))
28
+
29
+
30
+
31
+
32
+
33
+ ## 1.3.42 (2021-12-20)
34
+
35
+ **Note:** Version bump only for package @faststore/ui
36
+
37
+
38
+
39
+
40
+
6
41
  ## 1.3.41 (2021-12-20)
7
42
 
8
43
 
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 {};
@@ -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,
@@ -1605,6 +1633,7 @@ exports.PaymentMethods = PaymentMethods;
1605
1633
  exports.Popover = Popover;
1606
1634
  exports.Price = Price;
1607
1635
  exports.PriceRange = PriceRange;
1636
+ exports.QuantitySelector = QuantitySelector;
1608
1637
  exports.Radio = Radio;
1609
1638
  exports.RadioGroup = RadioGroup;
1610
1639
  exports.RadioOption = RadioOption;