@faststore/ui 1.3.27 → 1.3.31
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 +32 -0
- package/dist/atoms/List/List.d.ts +9 -14
- package/dist/atoms/List/stories/List.stories.d.ts +2 -2
- package/dist/ui.cjs.development.js +10 -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 +10 -19
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,38 @@
|
|
|
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.31 (2021-12-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @faststore/ui
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 1.3.30 (2021-12-10)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @faststore/ui
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 1.3.29 (2021-12-10)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @faststore/ui
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## 1.3.28 (2021-12-10)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @faststore/ui
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
6
38
|
## 1.3.27 (2021-12-10)
|
|
7
39
|
|
|
8
40
|
|
|
@@ -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>;
|
|
@@ -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({
|