@faststore/ui 1.3.40 → 1.3.44

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 (30) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/atoms/Incentive/Incentive.d.ts +11 -0
  3. package/dist/atoms/Incentive/index.d.ts +2 -0
  4. package/dist/atoms/Incentive/stories/Incentive.stories.d.ts +4 -0
  5. package/dist/atoms/Incentive/stories/assets/Icons.d.ts +2 -0
  6. package/dist/index.d.ts +4 -0
  7. package/dist/molecules/QuantitySelector/QuantitySelector.d.ts +30 -0
  8. package/dist/molecules/QuantitySelector/index.d.ts +2 -0
  9. package/dist/molecules/QuantitySelector/stories/QuantitySelector.stories.d.ts +5 -0
  10. package/dist/molecules/QuantitySelector/stories/assets/Icons.d.ts +7 -0
  11. package/dist/ui.cjs.development.js +42 -0
  12. package/dist/ui.cjs.development.js.map +1 -1
  13. package/dist/ui.cjs.production.min.js +1 -1
  14. package/dist/ui.cjs.production.min.js.map +1 -1
  15. package/dist/ui.esm.js +41 -1
  16. package/dist/ui.esm.js.map +1 -1
  17. package/package.json +3 -3
  18. package/src/atoms/Incentive/Incentive.test.tsx +36 -0
  19. package/src/atoms/Incentive/Incentive.tsx +23 -0
  20. package/src/atoms/Incentive/index.tsx +2 -0
  21. package/src/atoms/Incentive/stories/Incentive.mdx +24 -0
  22. package/src/atoms/Incentive/stories/Incentive.stories.tsx +26 -0
  23. package/src/atoms/Incentive/stories/assets/Icons.tsx +14 -0
  24. package/src/index.ts +6 -0
  25. package/src/molecules/QuantitySelector/QuantitySelector.test.tsx +93 -0
  26. package/src/molecules/QuantitySelector/QuantitySelector.tsx +82 -0
  27. package/src/molecules/QuantitySelector/index.ts +2 -0
  28. package/src/molecules/QuantitySelector/stories/QuantitySelector.mdx +26 -0
  29. package/src/molecules/QuantitySelector/stories/QuantitySelector.stories.tsx +77 -0
  30. package/src/molecules/QuantitySelector/stories/assets/Icons.tsx +52 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
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.44 (2021-12-21)
7
+
8
+ **Note:** Version bump only for package @faststore/ui
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.3.43 (2021-12-20)
15
+
16
+
17
+ ### Features
18
+
19
+ * QuantitySelector component ([#1083](https://github.com/vtex/faststore/issues/1083)) ([6ade6c0](https://github.com/vtex/faststore/commit/6ade6c02b06fdb74ba2cd2978d8ac4bda35672d2))
20
+
21
+
22
+
23
+
24
+
25
+ ## 1.3.42 (2021-12-20)
26
+
27
+ **Note:** Version bump only for package @faststore/ui
28
+
29
+
30
+
31
+
32
+
33
+ ## 1.3.41 (2021-12-20)
34
+
35
+
36
+ ### Features
37
+
38
+ * **ui:** Incentive atom ([#1064](https://github.com/vtex/faststore/issues/1064)) ([1b136c7](https://github.com/vtex/faststore/commit/1b136c7d7fc8f2b99259ef1908286713697e03da))
39
+
40
+
41
+
42
+
43
+
6
44
  ## 1.3.40 (2021-12-18)
7
45
 
8
46
 
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import type { HTMLAttributes } from 'react';
3
+ export interface IncentiveProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress,
6
+ * testing-library, and jest).
7
+ */
8
+ testId?: string;
9
+ }
10
+ declare const Incentive: React.ForwardRefExoticComponent<IncentiveProps & React.RefAttributes<HTMLDivElement>>;
11
+ export default Incentive;
@@ -0,0 +1,2 @@
1
+ export { default } from './Incentive';
2
+ export type { IncentiveProps } from './Incentive';
@@ -0,0 +1,4 @@
1
+ import type { IncentiveProps } from '../Incentive';
2
+ export declare const Incentive: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, IncentiveProps>;
3
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
4
+ export default _default;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SafetyIcon(): JSX.Element;
package/dist/index.d.ts CHANGED
@@ -32,6 +32,8 @@ export { default as Spinner } from './atoms/Spinner';
32
32
  export type { SpinnerProps } from './atoms/Spinner';
33
33
  export { default as Label } from './atoms/Label';
34
34
  export type { LabelProps } from './atoms/Label';
35
+ export { default as Incentive } from './atoms/Incentive';
36
+ export type { IncentiveProps } from './atoms/Incentive';
35
37
  export { default as Bullets } from './molecules/Bullets';
36
38
  export type { BulletsProps } from './molecules/Bullets';
37
39
  export { default as SearchInput } from './molecules/SearchInput';
@@ -62,6 +64,8 @@ export { default as Form } from './molecules/Form';
62
64
  export type { FormProps } from './molecules/Form';
63
65
  export { default as Alert } from './molecules/Alert';
64
66
  export type { AlertProps } from './molecules/Alert';
67
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
68
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector';
65
69
  export { default as Card, CardImage, CardContent, CardActions, } from './organisms/Card';
66
70
  export type { CardProps, CardImageProps, CardContentProps, CardActionsProps, } from './organisms/Card';
67
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 {};
@@ -317,6 +317,18 @@ const Label = /*#__PURE__*/React.forwardRef(function Label({
317
317
  }, otherProps), children);
318
318
  });
319
319
 
320
+ const Incentive = /*#__PURE__*/React.forwardRef(function Incentive({
321
+ testId = 'store-incentive',
322
+ children,
323
+ ...otherProps
324
+ }, ref) {
325
+ return React__default.createElement("div", Object.assign({
326
+ ref: ref,
327
+ "data-store-incentive": true,
328
+ "data-testid": testId
329
+ }, otherProps), children);
330
+ });
331
+
320
332
  const defaultAriaLabel = (idx, isActive) => isActive ? 'Current page' : `Go to page ${idx + 1}`;
321
333
 
322
334
  const Bullets = /*#__PURE__*/React.forwardRef(function Bullets({
@@ -1508,6 +1520,34 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert({
1508
1520
  }, otherProps), children);
1509
1521
  });
1510
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
+
1511
1551
  const Card = /*#__PURE__*/React.forwardRef(function Card({
1512
1552
  testId = 'store-card',
1513
1553
  children,
@@ -1581,6 +1621,7 @@ exports.Checkbox = Checkbox;
1581
1621
  exports.Form = Form;
1582
1622
  exports.Icon = Icon;
1583
1623
  exports.IconButton = IconButton;
1624
+ exports.Incentive = Incentive;
1584
1625
  exports.Input = Input;
1585
1626
  exports.Label = Label;
1586
1627
  exports.Link = Link;
@@ -1592,6 +1633,7 @@ exports.PaymentMethods = PaymentMethods;
1592
1633
  exports.Popover = Popover;
1593
1634
  exports.Price = Price;
1594
1635
  exports.PriceRange = PriceRange;
1636
+ exports.QuantitySelector = QuantitySelector;
1595
1637
  exports.Radio = Radio;
1596
1638
  exports.RadioGroup = RadioGroup;
1597
1639
  exports.RadioOption = RadioOption;