@faststore/ui 1.3.26 → 1.3.30

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.30 (2021-12-10)
7
+
8
+ **Note:** Version bump only for package @faststore/ui
9
+
10
+
11
+
12
+
13
+
14
+ ## 1.3.29 (2021-12-10)
15
+
16
+ **Note:** Version bump only for package @faststore/ui
17
+
18
+
19
+
20
+
21
+
22
+ ## 1.3.28 (2021-12-10)
23
+
24
+ **Note:** Version bump only for package @faststore/ui
25
+
26
+
27
+
28
+
29
+
30
+ ## 1.3.27 (2021-12-10)
31
+
32
+
33
+ ### Bug Fixes
34
+
35
+ * Add Banner Components exportation ([#1072](https://github.com/vtex/faststore/issues/1072)) ([4024104](https://github.com/vtex/faststore/commit/4024104f9804c8762037f03d986a4334af819b3c))
36
+
37
+
38
+
39
+
40
+
6
41
  ## 1.3.26 (2021-12-09)
7
42
 
8
43
  **Note:** Version bump only for package @faststore/ui
@@ -1,17 +1,12 @@
1
- import type { ElementType, ReactElement, FC } from 'react';
2
- import type { PolymorphicComponentPropsWithRef } from '../../typings';
3
- export declare type ListVariant = 'description' | 'ordered' | 'unordered';
4
- interface Props {
1
+ import React from 'react';
2
+ import type { ElementType, HTMLAttributes } from 'react';
3
+ export interface ListProps<T = HTMLElement> extends HTMLAttributes<T> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
5
7
  testId?: string;
6
- variant?: ListVariant;
8
+ variant?: 'description' | 'ordered' | 'unordered';
9
+ as?: ElementType;
7
10
  }
8
- export declare type ListProps<C extends ElementType> = PolymorphicComponentPropsWithRef<C, Props>;
9
- declare type ListComponent = <C extends ElementType = 'ul'>(props: ListProps<C>) => ReactElement | null;
10
- declare const List: ListComponent;
11
- /**
12
- * This is only being exported to make it easier to use in Storybook.
13
- * **DON'T** import this directly to use this component, use the default export
14
- * instead.
15
- */
16
- export declare const StorybookList: FC<Props>;
11
+ declare const List: React.ForwardRefExoticComponent<ListProps<HTMLElement> & React.RefAttributes<HTMLUListElement>>;
17
12
  export default List;
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { ComponentArgTypes } from '../../../typings/utils';
3
3
  import type { ListProps } from '../List';
4
- declare type ListStoryProps = ListProps<'ul'> & {
4
+ declare type ListStoryProps = ListProps & {
5
5
  options: string[];
6
6
  };
7
- declare type DescriptionListStoryProps = ListProps<'dl'> & {
7
+ declare type DescriptionListStoryProps = ListProps & {
8
8
  options: string[][];
9
9
  };
10
10
  export declare const UnorderedList: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ListStoryProps>;
package/dist/index.d.ts CHANGED
@@ -40,8 +40,8 @@ export { default as IconButton } from './molecules/IconButton';
40
40
  export type { IconButtonProps } from './molecules/IconButton';
41
41
  export { default as Modal } from './molecules/Modal';
42
42
  export type { ModalProps } from './molecules/Modal';
43
- export { default as Banner } from './molecules/Banner';
44
- export type { BannerProps } from './molecules/Banner';
43
+ export { default as Banner, BannerContent, BannerImage, BannerLink, } from './molecules/Banner';
44
+ export type { BannerProps, BannerContentProps, BannerImageProps, BannerLinkProps, } from './molecules/Banner';
45
45
  export { default as PaymentMethods } from './molecules/PaymentMethods';
46
46
  export type { PaymentMethodsProps } from './molecules/PaymentMethods';
47
47
  export { default as Breadcrumb } from './molecules/Breadcrumb';
@@ -243,37 +243,28 @@ const Slider = ({
243
243
  }));
244
244
  };
245
245
 
246
- const variantToType = variant => {
247
- switch (variant) {
248
- case 'description':
249
- return 'dl';
250
-
251
- case 'unordered':
252
- return 'ul';
253
-
254
- case 'ordered':
255
- return 'ol';
256
-
257
- default:
258
- return 'ul';
259
- }
246
+ const variantToElement = {
247
+ description: 'dl',
248
+ unordered: 'ul',
249
+ ordered: 'ol'
260
250
  };
261
-
262
251
  const List = /*#__PURE__*/React.forwardRef(function List({
263
252
  testId = 'store-list',
264
253
  variant = 'unordered',
265
- as,
266
- ...rawProps
254
+ as: MaybeComponent,
255
+ ...otherProps
267
256
  }, ref) {
257
+ var _ref;
258
+
268
259
  const dataAttributes = {
269
260
  'data-testid': testId,
270
261
  'data-store-list': true,
271
262
  [`data-${variant}`]: true
272
263
  };
273
- const Component = as != null ? as : variantToType(variant);
264
+ const Component = (_ref = MaybeComponent != null ? MaybeComponent : variantToElement[variant]) != null ? _ref : 'ul';
274
265
  return React__default.createElement(Component, Object.assign({
275
266
  ref: ref
276
- }, dataAttributes, rawProps));
267
+ }, dataAttributes, otherProps));
277
268
  });
278
269
 
279
270
  const Skeleton = /*#__PURE__*/React.forwardRef(function Skeleton({
@@ -1021,6 +1012,43 @@ const Banner = ({
1021
1012
  }, children);
1022
1013
  };
1023
1014
 
1015
+ const BannerImage = /*#__PURE__*/React.forwardRef(function BannerImage({
1016
+ testId = 'store-banner-image',
1017
+ children,
1018
+ ...otherProps
1019
+ }, ref) {
1020
+ return React__default.createElement("div", Object.assign({
1021
+ ref: ref,
1022
+ "data-store-banner-image": true,
1023
+ "data-testid": testId
1024
+ }, otherProps), children);
1025
+ });
1026
+
1027
+ const BannerContent = /*#__PURE__*/React.forwardRef(function BannerContent({
1028
+ testId = 'store-banner-content',
1029
+ children,
1030
+ ...otherProps
1031
+ }, ref) {
1032
+ return React__default.createElement("div", Object.assign({
1033
+ ref: ref,
1034
+ role: "region",
1035
+ "data-store-banner-content": true,
1036
+ "data-testid": testId
1037
+ }, otherProps), children);
1038
+ });
1039
+
1040
+ const BannerLink = /*#__PURE__*/React.forwardRef(function BannerLink({
1041
+ testId = 'store-banner-link',
1042
+ children,
1043
+ ...otherProps
1044
+ }, ref) {
1045
+ return React__default.createElement("div", Object.assign({
1046
+ ref: ref,
1047
+ "data-store-banner-link": true,
1048
+ "data-testid": testId
1049
+ }, otherProps), children);
1050
+ });
1051
+
1024
1052
  const PaymentMethods = /*#__PURE__*/React.forwardRef(function PaymentMethods({
1025
1053
  testId = 'store-payment-methods',
1026
1054
  title,
@@ -1472,6 +1500,9 @@ exports.AccordionPanel = AccordionPanel;
1472
1500
  exports.Alert = Alert;
1473
1501
  exports.Badge = Badge;
1474
1502
  exports.Banner = Banner;
1503
+ exports.BannerContent = BannerContent;
1504
+ exports.BannerImage = BannerImage;
1505
+ exports.BannerLink = BannerLink;
1475
1506
  exports.Breadcrumb = Breadcrumb;
1476
1507
  exports.Bullets = Bullets;
1477
1508
  exports.Button = Button;