@faststore/ui 2.0.47-alpha.0 → 2.0.49-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.
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import type { HTMLAttributes } from 'react';
3
- export interface AggregateRatingProps extends HTMLAttributes<HTMLUListElement> {
4
- /**
5
- * The current value of the rating, based on the quantity of child elements.
6
- */
7
- value: number;
8
- /**
9
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
- */
11
- testId?: string;
12
- }
13
- export interface RatingItemProps {
14
- 'data-fs-aggregate-rating-item'?: 'full' | 'partial' | 'empty';
15
- 'data-testid'?: string;
16
- }
17
- declare const AggregateRating: React.ForwardRefExoticComponent<AggregateRatingProps & React.RefAttributes<HTMLUListElement>>;
18
- export default AggregateRating;
@@ -1,26 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import { List } from '@faststore/components';
3
- const RatingItem = ({ children, ...otherProps }) => {
4
- if (!React.isValidElement(children)) {
5
- return React.createElement("li", { ...otherProps }, children);
6
- }
7
- return React.createElement("li", null, React.cloneElement(children, otherProps));
8
- };
9
- const AggregateRating = forwardRef(function AggregateRating({ children, testId = 'store-aggregate-rating', value, ...otherProps }, ref) {
10
- const fillCheck = (itemValue) => {
11
- if (itemValue >= 1) {
12
- return 'full';
13
- }
14
- if (0 < itemValue && itemValue < 1) {
15
- return 'partial';
16
- }
17
- return 'empty';
18
- };
19
- return (React.createElement(List, { "data-fs-aggregate-rating": true, ref: ref, "data-testid": testId, ...otherProps }, React.Children.map(children, (child, index) => {
20
- const currentItemNumber = index;
21
- const fill = fillCheck(value - currentItemNumber);
22
- return (React.createElement(RatingItem, { key: `aggregate-rating-${index}`, "data-fs-aggregate-rating-item": fill, "data-testid": `${testId}-item` }, child));
23
- })));
24
- });
25
- export default AggregateRating;
26
- //# sourceMappingURL=AggregateRating.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AggregateRating.js","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G,MAAM,OAAO,IAE5B,KAAK,CACK,CACd,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './AggregateRating';
2
- export type { AggregateRatingProps } from './AggregateRating';
@@ -1,2 +0,0 @@
1
- export { default } from './AggregateRating';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/AggregateRating/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA"}
@@ -1,11 +0,0 @@
1
- import type { HTMLAttributes } from 'react';
2
- import React from 'react';
3
- export interface AlertProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
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 Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
11
- export default Alert;
@@ -1,6 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- const Alert = forwardRef(function Alert({ testId = 'store-alert', children, ...otherProps }, ref) {
3
- return (React.createElement("div", { ref: ref, role: "alert", "data-fs-alert": true, "data-testid": testId, ...otherProps }, children));
4
- });
5
- export default Alert;
6
- //# sourceMappingURL=Alert.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/molecules/Alert/Alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAWzC,MAAM,KAAK,GAAG,UAAU,CAA6B,SAAS,KAAK,CACjE,EAAE,MAAM,GAAG,aAAa,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACnD,GAAG;IAEH,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,OAAO,wCAEC,MAAM,KACf,UAAU,IAEb,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,KAAK,CAAA"}
@@ -1,2 +0,0 @@
1
- export { default } from './Alert';
2
- export type { AlertProps } from './Alert';
@@ -1,2 +0,0 @@
1
- export { default } from './Alert';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/Alert/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA"}
@@ -1,76 +0,0 @@
1
- import React, { forwardRef } from 'react'
2
- import type { FC, PropsWithChildren, HTMLAttributes } from 'react'
3
-
4
- import { List } from '@faststore/components'
5
-
6
- export interface AggregateRatingProps extends HTMLAttributes<HTMLUListElement> {
7
- /**
8
- * The current value of the rating, based on the quantity of child elements.
9
- */
10
- value: number
11
- /**
12
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
13
- */
14
- testId?: string
15
- }
16
-
17
- export interface RatingItemProps {
18
- 'data-fs-aggregate-rating-item'?: 'full' | 'partial' | 'empty'
19
- 'data-testid'?: string
20
- }
21
-
22
- const RatingItem: FC<PropsWithChildren<RatingItemProps>> = ({
23
- children,
24
- ...otherProps
25
- }) => {
26
- if (!React.isValidElement(children)) {
27
- return <li {...otherProps}>{children}</li>
28
- }
29
-
30
- return <li>{React.cloneElement(children, otherProps)}</li>
31
- }
32
-
33
- const AggregateRating = forwardRef<HTMLUListElement, AggregateRatingProps>(
34
- function AggregateRating(
35
- { children, testId = 'store-aggregate-rating', value, ...otherProps },
36
- ref
37
- ) {
38
- const fillCheck = (itemValue: number) => {
39
- if (itemValue >= 1) {
40
- return 'full'
41
- }
42
-
43
- if (0 < itemValue && itemValue < 1) {
44
- return 'partial'
45
- }
46
-
47
- return 'empty'
48
- }
49
-
50
- return (
51
- <List
52
- data-fs-aggregate-rating
53
- ref={ref}
54
- data-testid={testId}
55
- {...otherProps}
56
- >
57
- {React.Children.map(children, (child, index: number) => {
58
- const currentItemNumber = index
59
- const fill = fillCheck(value - currentItemNumber)
60
-
61
- return (
62
- <RatingItem
63
- key={`aggregate-rating-${index}`}
64
- data-fs-aggregate-rating-item={fill}
65
- data-testid={`${testId}-item`}
66
- >
67
- {child}
68
- </RatingItem>
69
- )
70
- })}
71
- </List>
72
- )
73
- }
74
- )
75
-
76
- export default AggregateRating
@@ -1,2 +0,0 @@
1
- export { default } from './AggregateRating'
2
- export type { AggregateRatingProps } from './AggregateRating'
@@ -1,30 +0,0 @@
1
- import type { HTMLAttributes } from 'react'
2
- import React, { forwardRef } from 'react'
3
-
4
- export interface AlertProps
5
- extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
6
- /**
7
- * ID to find this component in testing tools (e.g.: cypress,
8
- * testing-library, and jest).
9
- */
10
- testId?: string
11
- }
12
-
13
- const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert(
14
- { testId = 'store-alert', children, ...otherProps },
15
- ref
16
- ) {
17
- return (
18
- <div
19
- ref={ref}
20
- role="alert"
21
- data-fs-alert
22
- data-testid={testId}
23
- {...otherProps}
24
- >
25
- {children}
26
- </div>
27
- )
28
- })
29
-
30
- export default Alert
@@ -1,2 +0,0 @@
1
- export { default } from './Alert'
2
- export type { AlertProps } from './Alert'