@faststore/ui 1.3.24 → 1.3.28
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 +35 -0
- package/README.md +49 -2
- package/dist/atoms/List/List.d.ts +9 -14
- package/dist/atoms/List/stories/List.stories.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/ui.cjs.development.js +50 -19
- package/dist/ui.cjs.development.js.map +1 -1
- package/dist/ui.cjs.production.min.js +1 -1
- package/dist/ui.cjs.production.min.js.map +1 -1
- package/dist/ui.esm.js +48 -20
- package/dist/ui.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/atoms/List/List.test.tsx +37 -0
- package/src/atoms/List/List.tsx +18 -51
- package/src/atoms/List/stories/List.mdx +2 -2
- package/src/atoms/List/stories/List.stories.tsx +2 -2
- package/src/index.ts +12 -2
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.28 (2021-12-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/ui
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.3.27 (2021-12-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* Add Banner Components exportation ([#1072](https://github.com/vtex/faststore/issues/1072)) ([4024104](https://github.com/vtex/faststore/commit/4024104f9804c8762037f03d986a4334af819b3c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## 1.3.26 (2021-12-09)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @faststore/ui
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## 1.3.25 (2021-12-09)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @faststore/ui
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
6
41
|
## 1.3.24 (2021-12-09)
|
|
7
42
|
|
|
8
43
|
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://faststore.dev">
|
|
3
|
+
<img alt="Faststore" src="./static/logo.png" width="60" />
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
<h1 align="center">
|
|
7
|
+
FastStore UI
|
|
8
|
+
</h1>
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>
|
|
11
|
+
Lightweight ecommerce component library
|
|
12
|
+
</strong>
|
|
13
|
+
</p>
|
|
2
14
|
|
|
3
|
-
|
|
15
|
+
<div style="display: flex; justify-content: center; width: 100%">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@faststore/ui" style="padding: 0px 2px 0px 0px">
|
|
17
|
+
<img src="https://badge.fury.io/js/%40faststore%2Fui.svg" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 2px 0px 2px">
|
|
20
|
+
<img src="https://badgen.net/bundlephobia/minzip/@faststore/ui" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 2px 0px 2px">
|
|
23
|
+
<img src="https://badgen.net/bundlephobia/tree-shaking/@faststore/ui" />
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://bundlephobia.com/package/@faststore/ui" style="padding: 0px 0px 0px 2px">
|
|
26
|
+
<img src="https://badgen.net/bundlephobia/dependency-count/@faststore/ui" />
|
|
27
|
+
</a>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
From the command line in your project directory, run yarn add `@faststore/ui`.
|
|
33
|
+
|
|
34
|
+
```cmd
|
|
35
|
+
yarn add @faststore/ui
|
|
36
|
+
```
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import React, { Component } from 'react'
|
|
41
|
+
|
|
42
|
+
import { Button } from '@faststore/ui'
|
|
43
|
+
|
|
44
|
+
function MyComponent {
|
|
45
|
+
return <Button>Click Me</Button>
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Docs
|
|
50
|
+
For more information, please refer to our documentation: https://faststore.dev/reference/ui/overview
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
|
|
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?:
|
|
8
|
+
variant?: 'description' | 'ordered' | 'unordered';
|
|
9
|
+
as?: ElementType;
|
|
7
10
|
}
|
|
8
|
-
|
|
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
|
|
4
|
+
declare type ListStoryProps = ListProps & {
|
|
5
5
|
options: string[];
|
|
6
6
|
};
|
|
7
|
-
declare type DescriptionListStoryProps = ListProps
|
|
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
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
...
|
|
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 =
|
|
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,
|
|
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;
|