@faststore/ui 1.3.39 → 1.3.43

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 (41) hide show
  1. package/CHANGELOG.md +41 -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/atoms/Link/Link.d.ts +19 -0
  7. package/dist/atoms/Link/index.d.ts +2 -0
  8. package/dist/index.d.ts +6 -0
  9. package/dist/molecules/QuantitySelector/QuantitySelector.d.ts +30 -0
  10. package/dist/molecules/QuantitySelector/index.d.ts +2 -0
  11. package/dist/molecules/QuantitySelector/stories/QuantitySelector.stories.d.ts +5 -0
  12. package/dist/molecules/QuantitySelector/stories/assets/Icons.d.ts +7 -0
  13. package/dist/typings/PolymorphicGenerics.d.ts +1 -0
  14. package/dist/typings/index.d.ts +1 -1
  15. package/dist/ui.cjs.development.js +57 -0
  16. package/dist/ui.cjs.development.js.map +1 -1
  17. package/dist/ui.cjs.production.min.js +1 -1
  18. package/dist/ui.cjs.production.min.js.map +1 -1
  19. package/dist/ui.esm.js +55 -1
  20. package/dist/ui.esm.js.map +1 -1
  21. package/package.json +3 -3
  22. package/src/atoms/Incentive/Incentive.test.tsx +36 -0
  23. package/src/atoms/Incentive/Incentive.tsx +23 -0
  24. package/src/atoms/Incentive/index.tsx +2 -0
  25. package/src/atoms/Incentive/stories/Incentive.mdx +24 -0
  26. package/src/atoms/Incentive/stories/Incentive.stories.tsx +26 -0
  27. package/src/atoms/Incentive/stories/assets/Icons.tsx +14 -0
  28. package/src/atoms/Link/Link.test.tsx +53 -0
  29. package/src/atoms/Link/Link.tsx +47 -0
  30. package/src/atoms/Link/index.tsx +2 -0
  31. package/src/atoms/Link/stories/Link.mdx +35 -0
  32. package/src/atoms/Link/stories/Link.stories.tsx +30 -0
  33. package/src/index.ts +9 -0
  34. package/src/molecules/QuantitySelector/QuantitySelector.test.tsx +93 -0
  35. package/src/molecules/QuantitySelector/QuantitySelector.tsx +82 -0
  36. package/src/molecules/QuantitySelector/index.ts +2 -0
  37. package/src/molecules/QuantitySelector/stories/QuantitySelector.mdx +26 -0
  38. package/src/molecules/QuantitySelector/stories/QuantitySelector.stories.tsx +77 -0
  39. package/src/molecules/QuantitySelector/stories/assets/Icons.tsx +52 -0
  40. package/src/typings/PolymorphicGenerics.ts +5 -0
  41. package/src/typings/index.ts +1 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
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.43 (2021-12-20)
7
+
8
+
9
+ ### Features
10
+
11
+ * QuantitySelector component ([#1083](https://github.com/vtex/faststore/issues/1083)) ([6ade6c0](https://github.com/vtex/faststore/commit/6ade6c02b06fdb74ba2cd2978d8ac4bda35672d2))
12
+
13
+
14
+
15
+
16
+
17
+ ## 1.3.42 (2021-12-20)
18
+
19
+ **Note:** Version bump only for package @faststore/ui
20
+
21
+
22
+
23
+
24
+
25
+ ## 1.3.41 (2021-12-20)
26
+
27
+
28
+ ### Features
29
+
30
+ * **ui:** Incentive atom ([#1064](https://github.com/vtex/faststore/issues/1064)) ([1b136c7](https://github.com/vtex/faststore/commit/1b136c7d7fc8f2b99259ef1908286713697e03da))
31
+
32
+
33
+
34
+
35
+
36
+ ## 1.3.40 (2021-12-18)
37
+
38
+
39
+ ### Features
40
+
41
+ * **ui:** Link atom ([#1067](https://github.com/vtex/faststore/issues/1067)) ([c49b2dd](https://github.com/vtex/faststore/commit/c49b2ddc31ba4184bed19a8934fbf4d5f0b47a5f))
42
+
43
+
44
+
45
+
46
+
6
47
  ## 1.3.39 (2021-12-17)
7
48
 
8
49
  **Note:** Version bump only for package @faststore/ui
@@ -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;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { ElementType, ReactElement } from 'react';
3
+ import type { PolymorphicComponentPropsWithRef } from '../../typings';
4
+ interface Props {
5
+ /**
6
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
7
+ */
8
+ testId?: string;
9
+ }
10
+ export declare type LinkProps<C extends ElementType> = PolymorphicComponentPropsWithRef<C, Props>;
11
+ declare type LinkComponent = <C extends ElementType = 'a'>(props: LinkProps<C>) => ReactElement | null;
12
+ declare const Link: LinkComponent;
13
+ /**
14
+ * This is only being exported to make it easier to use in Storybook.
15
+ * **DON'T** import this directly to use this component, use the default export
16
+ * instead.
17
+ */
18
+ export declare const StorybookLink: React.FC<Props>;
19
+ export default Link;
@@ -0,0 +1,2 @@
1
+ export { default } from './Link';
2
+ export type { LinkProps } from './Link';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { default as Link } from './atoms/Link';
2
+ export type { LinkProps } from './atoms/Link';
1
3
  export { default as Button } from './atoms/Button';
2
4
  export type { ButtonProps } from './atoms/Button';
3
5
  export { default as Input } from './atoms/Input';
@@ -30,6 +32,8 @@ export { default as Spinner } from './atoms/Spinner';
30
32
  export type { SpinnerProps } from './atoms/Spinner';
31
33
  export { default as Label } from './atoms/Label';
32
34
  export type { LabelProps } from './atoms/Label';
35
+ export { default as Incentive } from './atoms/Incentive';
36
+ export type { IncentiveProps } from './atoms/Incentive';
33
37
  export { default as Bullets } from './molecules/Bullets';
34
38
  export type { BulletsProps } from './molecules/Bullets';
35
39
  export { default as SearchInput } from './molecules/SearchInput';
@@ -60,6 +64,8 @@ export { default as Form } from './molecules/Form';
60
64
  export type { FormProps } from './molecules/Form';
61
65
  export { default as Alert } from './molecules/Alert';
62
66
  export type { AlertProps } from './molecules/Alert';
67
+ export { default as QuantitySelector } from './molecules/QuantitySelector';
68
+ export type { QuantitySelectorProps } from './molecules/QuantitySelector';
63
69
  export { default as Card, CardImage, CardContent, CardActions, } from './organisms/Card';
64
70
  export type { CardProps, CardImageProps, CardContentProps, CardActionsProps, } from './organisms/Card';
65
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 {};
@@ -24,4 +24,5 @@ export declare type PolymorphicComponentProps<C extends ElementType, Props = Rec
24
24
  export declare type PolymorphicComponentPropsWithRef<C extends ElementType, P = Record<string, never>> = PolymorphicComponentProps<C, P> & {
25
25
  ref?: ComponentPropsWithRef<C>['ref'];
26
26
  };
27
+ export declare type PolymorphicRef<C extends ElementType> = PolymorphicComponentPropsWithRef<C>['ref'];
27
28
  export {};
@@ -1 +1 @@
1
- export type { PolymorphicComponentProps, PolymorphicComponentPropsWithRef, } from './PolymorphicGenerics';
1
+ export type { PolymorphicComponentProps, PolymorphicComponentPropsWithRef, PolymorphicRef, } from './PolymorphicGenerics';
@@ -12,6 +12,20 @@ var reactSwipeable = require('react-swipeable');
12
12
  var reactDom = require('react-dom');
13
13
  var tabbable = require('tabbable');
14
14
 
15
+ const Link = /*#__PURE__*/React.forwardRef(function Link({
16
+ as,
17
+ children,
18
+ testId = 'store-link',
19
+ ...otherProps
20
+ }, ref) {
21
+ const Component = as != null ? as : 'a';
22
+ return React__default.createElement(Component, Object.assign({
23
+ ref: ref,
24
+ "data-store-link": true,
25
+ "data-testid": testId
26
+ }, otherProps), children);
27
+ });
28
+
15
29
  const Button = /*#__PURE__*/React.forwardRef(function Button({
16
30
  children,
17
31
  testId = 'store-button',
@@ -303,6 +317,18 @@ const Label = /*#__PURE__*/React.forwardRef(function Label({
303
317
  }, otherProps), children);
304
318
  });
305
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
+
306
332
  const defaultAriaLabel = (idx, isActive) => isActive ? 'Current page' : `Go to page ${idx + 1}`;
307
333
 
308
334
  const Bullets = /*#__PURE__*/React.forwardRef(function Bullets({
@@ -1494,6 +1520,34 @@ const Alert = /*#__PURE__*/React.forwardRef(function Alert({
1494
1520
  }, otherProps), children);
1495
1521
  });
1496
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
+
1497
1551
  const Card = /*#__PURE__*/React.forwardRef(function Card({
1498
1552
  testId = 'store-card',
1499
1553
  children,
@@ -1567,8 +1621,10 @@ exports.Checkbox = Checkbox;
1567
1621
  exports.Form = Form;
1568
1622
  exports.Icon = Icon;
1569
1623
  exports.IconButton = IconButton;
1624
+ exports.Incentive = Incentive;
1570
1625
  exports.Input = Input;
1571
1626
  exports.Label = Label;
1627
+ exports.Link = Link;
1572
1628
  exports.List = List;
1573
1629
  exports.LoadingButton = LoadingButton;
1574
1630
  exports.Modal = Modal;
@@ -1577,6 +1633,7 @@ exports.PaymentMethods = PaymentMethods;
1577
1633
  exports.Popover = Popover;
1578
1634
  exports.Price = Price;
1579
1635
  exports.PriceRange = PriceRange;
1636
+ exports.QuantitySelector = QuantitySelector;
1580
1637
  exports.Radio = Radio;
1581
1638
  exports.RadioGroup = RadioGroup;
1582
1639
  exports.RadioOption = RadioOption;