@faststore/components 2.0.14-alpha.0 → 2.0.15-alpha.0

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,15 @@
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
+ ## [2.0.15-alpha.0](https://github.com/vtex/faststore/compare/v2.0.14-alpha.0...v2.0.15-alpha.0) (2022-12-14)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds `List` component ([#1549](https://github.com/vtex/faststore/issues/1549)) ([55858fe](https://github.com/vtex/faststore/commit/55858fe39c254786e7c7a1e1dd3da96ed3be0d16))
12
+
13
+
14
+
6
15
  ## [2.0.14-alpha.0](https://github.com/vtex/faststore/compare/v2.0.13-alpha.0...v2.0.14-alpha.0) (2022-12-14)
7
16
 
8
17
 
@@ -0,0 +1,16 @@
1
+ import type { ElementType, ReactElement } from 'react';
2
+ import type { PolymorphicComponentPropsWithRef } from '../../typings';
3
+ interface BaseProps {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
7
+ testId?: string;
8
+ /**
9
+ * Specify whether or not this component should display the list's markers (bullets or numbers).
10
+ */
11
+ marker?: boolean;
12
+ }
13
+ export declare type ListProps<T extends ElementType> = PolymorphicComponentPropsWithRef<T, BaseProps>;
14
+ declare type ListComponent = <T extends ElementType = 'ul'>(props: ListProps<T>) => ReactElement | null;
15
+ declare const List: ListComponent;
16
+ export default List;
@@ -0,0 +1,7 @@
1
+ import React, { forwardRef } from 'react';
2
+ const List = forwardRef(function List({ as, marker, testId = 'fs-list', ...otherProps }, ref) {
3
+ const Component = as ?? 'ul';
4
+ return (React.createElement(Component, { ref: ref, "data-fs-list": true, "data-testid": testId, "data-fs-list-marker": marker, ...otherProps }));
5
+ });
6
+ export default List;
7
+ //# sourceMappingURL=List.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"List.js","sourceRoot":"","sources":["../../../src/atoms/List/List.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AA4BzC,MAAM,IAAI,GAAkB,UAAU,CAAC,SAAS,IAAI,CAGlD,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,UAAU,EAAgB,EAC/D,GAAsB;IAEtB,MAAM,SAAS,GAAG,EAAE,IAAI,IAAI,CAAA;IAE5B,OAAO,CACL,oBAAC,SAAS,IACR,GAAG,EAAE,GAAG,uCAEK,MAAM,yBACE,MAAM,KACvB,UAAU,GACd,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default } from './List';
2
+ export type { ListProps } from './List';
@@ -0,0 +1,2 @@
1
+ export { default } from './List';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/atoms/List/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA"}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,8 @@ export { default as Label } from './atoms/Label';
13
13
  export type { LabelProps } from './atoms/Label';
14
14
  export { default as Link } from './atoms/Link';
15
15
  export type { LinkProps, LinkElementType } from './atoms/Link';
16
+ export { default as List } from './atoms/List';
17
+ export type { ListProps } from './atoms/List';
16
18
  export { default as Overlay } from './atoms/Overlay';
17
19
  export type { OverlayProps } from './atoms/Overlay';
18
20
  export { default as Price } from './atoms/Price';
package/dist/index.js CHANGED
@@ -8,6 +8,7 @@ export { default as Icon } from './atoms/Icon';
8
8
  export { default as Input } from './atoms/Input';
9
9
  export { default as Label } from './atoms/Label';
10
10
  export { default as Link } from './atoms/Link';
11
+ export { default as List } from './atoms/List';
11
12
  export { default as Overlay } from './atoms/Overlay';
12
13
  export { default as Price } from './atoms/Price';
13
14
  export { default as Radio } from './atoms/Radio';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,cAAc,UAAU,CAAA;AAExB,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGlD,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,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EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAA"}
@@ -1 +1 @@
1
- export type { PolymorphicComponentProps, PolymorphicComponentPropsWithRef, PolymorphicRef, } from './PolymorphicGenerics';
1
+ export type { PolymorphicRef, PolymorphicComponentProps, PolymorphicComponentPropsWithRef, } from './PolymorphicGenerics';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.14-alpha.0",
3
+ "version": "2.0.15-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -28,5 +28,5 @@
28
28
  "node": "16.18.0",
29
29
  "yarn": "1.19.1"
30
30
  },
31
- "gitHead": "a8f4ca0ddc690e24df31abee9e4a4bbdb2d1a03b"
31
+ "gitHead": "9b72e9d993f45bf072144751654854a11e099d17"
32
32
  }
@@ -0,0 +1,48 @@
1
+ import React, { forwardRef } from 'react'
2
+ import type { ElementType, ReactElement } from 'react'
3
+
4
+ import type {
5
+ PolymorphicRef,
6
+ PolymorphicComponentPropsWithRef,
7
+ } from '../../typings'
8
+
9
+ interface BaseProps {
10
+ /**
11
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
12
+ */
13
+ testId?: string
14
+ /**
15
+ * Specify whether or not this component should display the list's markers (bullets or numbers).
16
+ */
17
+ marker?: boolean
18
+ }
19
+
20
+ export type ListProps<T extends ElementType> = PolymorphicComponentPropsWithRef<
21
+ T,
22
+ BaseProps
23
+ >
24
+
25
+ type ListComponent = <T extends ElementType = 'ul'>(
26
+ props: ListProps<T>
27
+ ) => ReactElement | null
28
+
29
+ const List: ListComponent = forwardRef(function List<
30
+ T extends ElementType = 'ul'
31
+ >(
32
+ { as, marker, testId = 'fs-list', ...otherProps }: ListProps<T>,
33
+ ref: PolymorphicRef<T>
34
+ ) {
35
+ const Component = as ?? 'ul'
36
+
37
+ return (
38
+ <Component
39
+ ref={ref}
40
+ data-fs-list
41
+ data-testid={testId}
42
+ data-fs-list-marker={marker}
43
+ {...otherProps}
44
+ />
45
+ )
46
+ })
47
+
48
+ export default List
@@ -0,0 +1,2 @@
1
+ export { default } from './List'
2
+ export type { ListProps } from './List'
package/src/index.ts CHANGED
@@ -16,6 +16,8 @@ export { default as Label } from './atoms/Label'
16
16
  export type { LabelProps } from './atoms/Label'
17
17
  export { default as Link } from './atoms/Link'
18
18
  export type { LinkProps, LinkElementType } from './atoms/Link'
19
+ export { default as List } from './atoms/List'
20
+ export type { ListProps } from './atoms/List'
19
21
  export { default as Overlay } from './atoms/Overlay'
20
22
  export type { OverlayProps } from './atoms/Overlay'
21
23
  export { default as Price } from './atoms/Price'
@@ -1,5 +1,5 @@
1
1
  export type {
2
+ PolymorphicRef,
2
3
  PolymorphicComponentProps,
3
4
  PolymorphicComponentPropsWithRef,
4
- PolymorphicRef,
5
5
  } from './PolymorphicGenerics'