@faststore/ui 2.0.44-alpha.0 → 2.0.48-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 +23 -0
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/molecules/Alert/styles.scss +108 -0
- package/src/components/molecules/QuantitySelector/styles.scss +154 -0
- package/src/components/molecules/Rating/styles.scss +69 -0
- package/src/index.ts +0 -9
- package/src/styles/components.scss +3 -0
- package/dist/components/molecules/AggregateRating/AggregateRating.d.ts +0 -18
- package/dist/components/molecules/AggregateRating/AggregateRating.js +0 -26
- package/dist/components/molecules/AggregateRating/AggregateRating.js.map +0 -1
- package/dist/components/molecules/AggregateRating/index.d.ts +0 -2
- package/dist/components/molecules/AggregateRating/index.js +0 -2
- package/dist/components/molecules/AggregateRating/index.js.map +0 -1
- package/dist/components/molecules/Alert/Alert.d.ts +0 -11
- package/dist/components/molecules/Alert/Alert.js +0 -6
- package/dist/components/molecules/Alert/Alert.js.map +0 -1
- package/dist/components/molecules/Alert/index.d.ts +0 -2
- package/dist/components/molecules/Alert/index.js +0 -2
- package/dist/components/molecules/Alert/index.js.map +0 -1
- package/dist/components/molecules/QuantitySelector/QuantitySelector.d.ts +0 -29
- package/dist/components/molecules/QuantitySelector/QuantitySelector.js +0 -10
- package/dist/components/molecules/QuantitySelector/QuantitySelector.js.map +0 -1
- package/dist/components/molecules/QuantitySelector/index.d.ts +0 -2
- package/dist/components/molecules/QuantitySelector/index.js +0 -2
- package/dist/components/molecules/QuantitySelector/index.js.map +0 -1
- package/src/components/molecules/AggregateRating/AggregateRating.tsx +0 -76
- package/src/components/molecules/AggregateRating/index.ts +0 -2
- package/src/components/molecules/Alert/Alert.tsx +0 -30
- package/src/components/molecules/Alert/index.ts +0 -2
- package/src/components/molecules/QuantitySelector/QuantitySelector.tsx +0 -80
- package/src/components/molecules/QuantitySelector/index.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.48-alpha.0 (2023-01-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Adds `Alert` Component ([#1590](https://github.com/vtex/faststore/issues/1590)) ([6e1cc00](https://github.com/vtex/faststore/commit/6e1cc004a5f3ae8674798fe6a36fd2a5d1451d7c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* ui size limit ([#1608](https://github.com/vtex/faststore/issues/1608)) ([c19360f](https://github.com/vtex/faststore/commit/c19360f4eb0e1d1f53e578e8429daa1a716d881d))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [2.0.47-alpha.0](https://github.com/vtex/faststore/compare/v2.0.46-alpha.0...v2.0.47-alpha.0) (2023-01-13)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* Adds `QuantitySelector` component ([#1597](https://github.com/vtex/faststore/issues/1597)) ([a587155](https://github.com/vtex/faststore/commit/a5871559a4a28754dd9868b7f85c92a5bde52917))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [2.0.44-alpha.0](https://github.com/vtex/faststore/compare/v2.0.43-alpha.0...v2.0.44-alpha.0) (2023-01-11)
|
|
7
30
|
|
|
8
31
|
**Note:** Version bump only for package @faststore/ui
|
package/dist/index.d.ts
CHANGED
|
@@ -19,8 +19,6 @@ export { default as ProductTitle } from './components/molecules/ProductTitle';
|
|
|
19
19
|
export type { ProductTitleProps } from './components/molecules/ProductTitle';
|
|
20
20
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
21
21
|
export type { OrderSummaryProps } from './components/molecules/OrderSummary';
|
|
22
|
-
export { default as AggregateRating } from './components/molecules/AggregateRating';
|
|
23
|
-
export type { AggregateRatingProps } from './components/molecules/AggregateRating';
|
|
24
22
|
export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './components/molecules/ProductCard';
|
|
25
23
|
export type { ProductCardProps, ProductCardImageProps, ProductCardContentProps, ProductCardActionsProps, } from './components/molecules/ProductCard';
|
|
26
24
|
export { default as Card, CardImage, CardContent, CardActions, } from './components/molecules/Card';
|
|
@@ -49,10 +47,6 @@ export { default as RadioGroup, RadioOption, } from './components/molecules/Radi
|
|
|
49
47
|
export type { RadioGroupProps, RadioOptionProps, } from './components/molecules/RadioGroup';
|
|
50
48
|
export { default as Form } from './components/molecules/Form';
|
|
51
49
|
export type { FormProps } from './components/molecules/Form';
|
|
52
|
-
export { default as Alert } from './components/molecules/Alert';
|
|
53
|
-
export type { AlertProps } from './components/molecules/Alert';
|
|
54
|
-
export { default as QuantitySelector } from './components/molecules/QuantitySelector';
|
|
55
|
-
export type { QuantitySelectorProps } from './components/molecules/QuantitySelector';
|
|
56
50
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
|
57
51
|
export type { OutOfStockProps, OutOfStockMessageProps, OutOfStockTitleProps, } from './components/organisms/OutOfStock';
|
|
58
52
|
export { Tiles, Tile } from './components/organisms/Tiles';
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,6 @@ export { default as SkuSelector } from './components/molecules/SkuSelector';
|
|
|
11
11
|
export { default as Gift, GiftContent, GiftImage, } from './components/molecules/Gift';
|
|
12
12
|
export { default as ProductTitle } from './components/molecules/ProductTitle';
|
|
13
13
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
14
|
-
export { default as AggregateRating } from './components/molecules/AggregateRating';
|
|
15
14
|
export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './components/molecules/ProductCard';
|
|
16
15
|
export { default as Card, CardImage, CardContent, CardActions, } from './components/molecules/Card';
|
|
17
16
|
export { default as CartItem, CartItemActions, CartItemContent, CartItemImage, CartItemPrices, CartItemSummary, CartItemTitle, } from './components/molecules/CartItem';
|
|
@@ -26,8 +25,6 @@ export { default as LoadingButton } from './components/molecules/LoadingButton';
|
|
|
26
25
|
export { default as PriceRange } from './components/molecules/PriceRange';
|
|
27
26
|
export { default as RadioGroup, RadioOption, } from './components/molecules/RadioGroup';
|
|
28
27
|
export { default as Form } from './components/molecules/Form';
|
|
29
|
-
export { default as Alert } from './components/molecules/Alert';
|
|
30
|
-
export { default as QuantitySelector } from './components/molecules/QuantitySelector';
|
|
31
28
|
// Organisms
|
|
32
29
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
|
33
30
|
export { Tiles, Tile } from './components/organisms/Tiles';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AAErC,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAG7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGnE,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAG3E,OAAO,EACL,OAAO,IAAI,IAAI,EACf,WAAW,EACX,SAAS,GACV,MAAM,6BAA6B,CAAA;AAOpC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AAErC,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAG7D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAG/D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGnE,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAG3E,OAAO,EACL,OAAO,IAAI,IAAI,EACf,WAAW,EACX,SAAS,GACV,MAAM,6BAA6B,CAAA;AAOpC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EACL,OAAO,IAAI,WAAW,EACtB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,oCAAoC,CAAA;AAQ3C,OAAO,EACL,OAAO,IAAI,IAAI,EACf,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,6BAA6B,CAAA;AAQpC,OAAO,EACL,OAAO,IAAI,QAAQ,EACnB,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,iCAAiC,CAAA;AAWxC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oCAAoC,CAAA;AAM3E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAG/D,OAAO,EACL,OAAO,IAAI,MAAM,EACjB,aAAa,EACb,WAAW,EACX,UAAU,GACX,MAAM,+BAA+B,CAAA;AAQtC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAGjF,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGzE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,sCAAsC,CAAA;AAG/E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAGzE,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,WAAW,GACZ,MAAM,mCAAmC,CAAA;AAM1C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,6BAA6B,CAAA;AAG7D,YAAY;AACZ,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,eAAe,EACf,iBAAiB,GAClB,MAAM,mCAAmC,CAAA;AAO1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAA;AAG1D,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@faststore/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.48-alpha.0",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"size-limit": [
|
|
31
31
|
{
|
|
32
32
|
"path": "dist/index.js",
|
|
33
|
-
"limit": "
|
|
33
|
+
"limit": "30 KB"
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react-dom": "^18.2.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@faststore/eslint-config": "^2.0.
|
|
50
|
-
"@faststore/shared": "^2.0.
|
|
49
|
+
"@faststore/eslint-config": "^2.0.48-alpha.0",
|
|
50
|
+
"@faststore/shared": "^2.0.48-alpha.0",
|
|
51
51
|
"@size-limit/preset-small-lib": "^7.0.8",
|
|
52
52
|
"@types/tabbable": "^3.1.1",
|
|
53
53
|
"babel-loader": "^8.2.5",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"node": "16.18.0",
|
|
60
60
|
"yarn": "1.19.1"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "13071d1410c4d42df70946ba27631549d2544d85"
|
|
63
63
|
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
[data-fs-alert] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Alert
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-alert-height : var(--fs-spacing-7);
|
|
8
|
+
--fs-alert-padding-left : var(--fs-spacing-3);
|
|
9
|
+
--fs-alert-padding-right : var(--fs-alert-padding-left);
|
|
10
|
+
|
|
11
|
+
--fs-alert-bkg-color : var(--fs-color-highlighted-bkg);
|
|
12
|
+
|
|
13
|
+
--fs-alert-text-color : var(--fs-color-highlighted-text);
|
|
14
|
+
--fs-alert-text-size : var(--fs-text-size-1);
|
|
15
|
+
|
|
16
|
+
// Icon
|
|
17
|
+
--fs-alert-icon-width : var(--fs-spacing-4);
|
|
18
|
+
--fs-alert-icon-height : var(--fs-alert-icon-width);
|
|
19
|
+
--fs-alert-icon-margin-right : var(--fs-spacing-1);
|
|
20
|
+
--fs-alert-icon-color : var(--fs-alert-text-color);
|
|
21
|
+
|
|
22
|
+
// Link
|
|
23
|
+
--fs-alert-link-color : var(--fs-alert-text-color);
|
|
24
|
+
--fs-alert-link-color-visited : var(--fs-alert-text-color);
|
|
25
|
+
|
|
26
|
+
// Dismissible Button
|
|
27
|
+
--fs-alert-button-text-color : var(--fs-alert-text-color);
|
|
28
|
+
--fs-alert-button-bkg-color : var(--fs-alert-bkg-color);
|
|
29
|
+
--fs-alert-button-border-radius : var(--fs-border-radius);
|
|
30
|
+
|
|
31
|
+
// --------------------------------------------------------
|
|
32
|
+
// Structural Styles
|
|
33
|
+
// --------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
width: 100%;
|
|
38
|
+
height: var(--fs-alert-height);
|
|
39
|
+
padding-right: var(--fs-alert-padding-right);
|
|
40
|
+
padding-left: var(--fs-alert-padding-left);
|
|
41
|
+
font-size: var(--fs-alert-text-size);
|
|
42
|
+
color: var(--fs-alert-text-color);
|
|
43
|
+
background-color: var(--fs-alert-bkg-color);
|
|
44
|
+
|
|
45
|
+
> [data-fs-icon] {
|
|
46
|
+
width: var(--fs-alert-icon-width);
|
|
47
|
+
height: var(--fs-alert-icon-height);
|
|
48
|
+
margin-right: var(--fs-alert-icon-margin-right);
|
|
49
|
+
color: var(--fs-alert-icon-color);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[data-fs-alert-content] {
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
text-overflow: ellipsis;
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
span {
|
|
59
|
+
font-weight: var(--fs-text-weight-bold);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[data-fs-alert-link] {
|
|
63
|
+
min-width: 0;
|
|
64
|
+
height: var(--fs-alert-height);
|
|
65
|
+
padding: 0 var(--fs-spacing-1);
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
font-weight: var(--fs-text-weight-bold);
|
|
68
|
+
line-height: var(--fs-alert-height);
|
|
69
|
+
color: var(--fs-alert-link-color);
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
white-space: nowrap;
|
|
72
|
+
|
|
73
|
+
&:visited {
|
|
74
|
+
color: var(--fs-alert-link-color-visited);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
[data-fs-alert-button] {
|
|
79
|
+
min-width: var(--fs-control-tap-size);
|
|
80
|
+
height: 100%;
|
|
81
|
+
padding: var(--fs-spacing-0);
|
|
82
|
+
margin-left: auto;
|
|
83
|
+
color: var(--fs-alert-button-text-color);
|
|
84
|
+
background-color: var(--fs-alert-button-bkg-color);
|
|
85
|
+
|
|
86
|
+
> span {
|
|
87
|
+
display: flex;
|
|
88
|
+
align-items: center;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
width: 100%;
|
|
91
|
+
height: 100%;
|
|
92
|
+
background-color: var(--fs-alert-button-bkg-color);
|
|
93
|
+
border-radius: var(--fs-alert-button-border-radius);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:hover span {
|
|
97
|
+
filter: brightness(0.95);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// --------------------------------------------------------
|
|
102
|
+
// Variants Styles
|
|
103
|
+
// --------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
&[data-fs-alert-dismissible="true"] {
|
|
106
|
+
padding-right: 0;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
[data-fs-quantity-selector] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Quantity Selector
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-qty-selector-width : calc(var(--fs-control-tap-size) * 2.7);
|
|
8
|
+
--fs-qty-selector-height : calc(var(--fs-control-tap-size) + (var(--fs-qty-selector-border-width) * 2));
|
|
9
|
+
|
|
10
|
+
--fs-qty-selector-shadow : none;
|
|
11
|
+
--fs-qty-selector-shadow-hover : 0 0 0 var(--fs-border-width) var(--fs-border-color-active);
|
|
12
|
+
|
|
13
|
+
--fs-qty-selector-bkg-color : var(--fs-color-body-bkg);
|
|
14
|
+
--fs-qty-selector-bkg-color-hover : var(--fs-qty-selector-bkg-color);
|
|
15
|
+
|
|
16
|
+
--fs-qty-selector-border-radius : var(--fs-border-radius);
|
|
17
|
+
--fs-qty-selector-border-width : var(--fs-border-width);
|
|
18
|
+
--fs-qty-selector-border-width-hover : var(--fs-border-width);
|
|
19
|
+
--fs-qty-selector-border-color : var(--fs-border-color);
|
|
20
|
+
--fs-qty-selector-border-color-hover : var(--fs-border-color-active);
|
|
21
|
+
|
|
22
|
+
// Text
|
|
23
|
+
--fs-qty-selector-text-size : var(--fs-text-size-base);
|
|
24
|
+
--fs-qty-selector-text-color : var(--fs-color-text);
|
|
25
|
+
--fs-qty-selector-text-color-hover : var(--fs-qty-selector-text-color);
|
|
26
|
+
|
|
27
|
+
// Icon
|
|
28
|
+
--fs-qty-selector-icon-color : var(--fs-color-link);
|
|
29
|
+
|
|
30
|
+
// Button
|
|
31
|
+
--fs-qty-selector-button-shadow : none;
|
|
32
|
+
--fs-qty-selector-button-shadow-hover : none;
|
|
33
|
+
--fs-qty-selector-button-bkg-color : transparent;
|
|
34
|
+
--fs-qty-selector-button-bkg-color-hover : var(--fs-color-primary-bkg-light);
|
|
35
|
+
--fs-qty-selector-button-bkg-color-focus : var(--fs-qty-selector-button-bkg-color-hover);
|
|
36
|
+
--fs-qty-selector-button-border-radius : var(--fs-qty-selector-border-radius);
|
|
37
|
+
|
|
38
|
+
// Disabled
|
|
39
|
+
--fs-qty-selector-disabled-bkg-color : var(--fs-color-disabled-bkg);
|
|
40
|
+
--fs-qty-selector-disabled-text-color : var(--fs-color-disabled-text);
|
|
41
|
+
--fs-qty-selector-disabled-icon-color : var(--fs-border-color-light-disabled);
|
|
42
|
+
--fs-qty-selector-disabled-border-color : var(--fs-qty-selector-disabled-bkg-color);
|
|
43
|
+
--fs-qty-selector-disabled-button-bkg-color : var(--fs-qty-selector-button-bkg-color-hover);
|
|
44
|
+
|
|
45
|
+
// --------------------------------------------------------
|
|
46
|
+
// Structural Styles
|
|
47
|
+
// --------------------------------------------------------
|
|
48
|
+
|
|
49
|
+
position: relative;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: var(--fs-qty-selector-width);
|
|
55
|
+
height: var(--fs-qty-selector-height);
|
|
56
|
+
border-radius: var(--fs-qty-selector-border-radius);
|
|
57
|
+
box-shadow: var(--fs-qty-selector-shadow);
|
|
58
|
+
|
|
59
|
+
[data-fs-icon] {
|
|
60
|
+
margin: 0;
|
|
61
|
+
line-height: 0;
|
|
62
|
+
color: var(--fs-qty-selector-icon-color);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-quantity-selector-input] {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100%;
|
|
68
|
+
padding: 0;
|
|
69
|
+
font-size: var(--fs-qty-selector-text-size);
|
|
70
|
+
color: var(--fs-qty-selector-text-color);
|
|
71
|
+
text-align: center;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-quantity-selector-button] {
|
|
75
|
+
position: absolute;
|
|
76
|
+
background-color: var(--fs-qty-selector-button-bkg-color);
|
|
77
|
+
|
|
78
|
+
[data-fs-icon] {
|
|
79
|
+
width: 100%;
|
|
80
|
+
height: 100%;
|
|
81
|
+
border-radius: var(--fs-qty-selector-button-border-radius);
|
|
82
|
+
box-shadow: var(--fs-qty-selector-button-shadow);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&[data-fs-icon-button] {
|
|
86
|
+
padding: var(--fs-spacing-1);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:first-of-type { left: 0; }
|
|
90
|
+
|
|
91
|
+
&:last-of-type { right: 0; }
|
|
92
|
+
|
|
93
|
+
&:hover:not(:disabled) [data-fs-icon] {
|
|
94
|
+
background-color: var(--fs-qty-selector-button-bkg-color-hover);
|
|
95
|
+
box-shadow: var(--fs-qty-selector-button-shadow-hover);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&:disabled {
|
|
99
|
+
cursor: not-allowed;
|
|
100
|
+
background-color: var(--fs-qty-selector-button-bkg-color);
|
|
101
|
+
|
|
102
|
+
&:hover, &:focus-visible {
|
|
103
|
+
background-color: var(--fs-qty-selector-button-bkg-color);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
[data-fs-icon] {
|
|
107
|
+
color: var(--fs-qty-selector-disabled-icon-color);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
&:hover:not(:disabled) {
|
|
112
|
+
background-color: transparent;
|
|
113
|
+
box-shadow: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&:focus:not(:disabled) {
|
|
117
|
+
background-color: transparent;
|
|
118
|
+
box-shadow: none;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&:focus-visible {
|
|
122
|
+
background-color: var(--fs-qty-selector-button-bkg-color);
|
|
123
|
+
outline: none;
|
|
124
|
+
box-shadow: none;
|
|
125
|
+
|
|
126
|
+
[data-fs-icon] {
|
|
127
|
+
@include focus-ring;
|
|
128
|
+
|
|
129
|
+
background-color: var(--fs-qty-selector-button-bkg-color-focus);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&:hover {
|
|
135
|
+
[data-quantity-selector-input]:not(:disabled):not(:focus) {
|
|
136
|
+
color: var(--fs-qty-selector-text-color-hover);
|
|
137
|
+
background-color: var(--fs-qty-selector-bkg-color-hover);
|
|
138
|
+
border-color: var(--fs-qty-selector-border-color-hover);
|
|
139
|
+
border-width: var(--fs-qty-selector-border-width-hover);
|
|
140
|
+
box-shadow: var(--fs-qty-selector-shadow-hover);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// --------------------------------------------------------
|
|
145
|
+
// Variants Styles
|
|
146
|
+
// --------------------------------------------------------
|
|
147
|
+
|
|
148
|
+
&[data-fs-quantity-selector="disabled"] {
|
|
149
|
+
[data-quantity-selector-input] {
|
|
150
|
+
border-color: var(--fs-qty-selector-disabled-border-color);
|
|
151
|
+
}
|
|
152
|
+
[data-quantity-selector-button]:hover [data-fs-icon] { background-color: transparent; }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
[data-fs-rating] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Rating
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-rating-gap : var(--fs-spacing-3);
|
|
8
|
+
--fs-rating-color : var(--fs-color-text);
|
|
9
|
+
|
|
10
|
+
// Icon
|
|
11
|
+
--fs-rating-icon-width : var(--fs-spacing-3);
|
|
12
|
+
--fs-rating-icon-height : var(--fs-rating-icon-width);
|
|
13
|
+
|
|
14
|
+
// Actionable
|
|
15
|
+
--fs-rating-actionable-gap : 0;
|
|
16
|
+
|
|
17
|
+
// --------------------------------------------------------
|
|
18
|
+
// Structural Styles
|
|
19
|
+
// --------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
display: flex;
|
|
22
|
+
|
|
23
|
+
[data-fs-icon] {
|
|
24
|
+
color: var(--fs-rating-color);
|
|
25
|
+
width: var(--fs-rating-icon-width);
|
|
26
|
+
height: var(--fs-rating-icon-height);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-fs-rating-button] {
|
|
30
|
+
color: unset;
|
|
31
|
+
&[data-fs-button-variant=tertiary]:hover,
|
|
32
|
+
&[data-fs-button-variant=tertiary]:focus,
|
|
33
|
+
&[data-fs-button-variant=tertiary]:active { color: unset; }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
[data-fs-rating-icon-wrapper] {
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: 0;
|
|
39
|
+
left: 0;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-fs-rating-icon-outline] {
|
|
44
|
+
svg { fill: none; }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-fs-rating-item] { position: relative; }
|
|
48
|
+
|
|
49
|
+
// --------------------------------------------------------
|
|
50
|
+
// Variants Styles
|
|
51
|
+
// --------------------------------------------------------
|
|
52
|
+
|
|
53
|
+
[data-fs-rating-item="empty"] [data-fs-icon] svg {
|
|
54
|
+
fill: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
[data-fs-rating-item="partial"] [data-fs-rating-icon-wrapper] {
|
|
58
|
+
width: calc(var(--fs-rating-icon-width) / 2);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:not([data-fs-rating-actionable="true"]) {
|
|
62
|
+
column-gap: var(--fs-rating-gap);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
[data-fs-rating-actionable="true"] {
|
|
66
|
+
column-gap: var(--fs-rating-actionable-gap);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -40,9 +40,6 @@ export type { ProductTitleProps } from './components/molecules/ProductTitle'
|
|
|
40
40
|
export { default as OrderSummary } from './components/molecules/OrderSummary'
|
|
41
41
|
export type { OrderSummaryProps } from './components/molecules/OrderSummary'
|
|
42
42
|
|
|
43
|
-
export { default as AggregateRating } from './components/molecules/AggregateRating'
|
|
44
|
-
export type { AggregateRatingProps } from './components/molecules/AggregateRating'
|
|
45
|
-
|
|
46
43
|
export {
|
|
47
44
|
default as ProductCard,
|
|
48
45
|
ProductCardImage,
|
|
@@ -140,12 +137,6 @@ export type {
|
|
|
140
137
|
export { default as Form } from './components/molecules/Form'
|
|
141
138
|
export type { FormProps } from './components/molecules/Form'
|
|
142
139
|
|
|
143
|
-
export { default as Alert } from './components/molecules/Alert'
|
|
144
|
-
export type { AlertProps } from './components/molecules/Alert'
|
|
145
|
-
|
|
146
|
-
export { default as QuantitySelector } from './components/molecules/QuantitySelector'
|
|
147
|
-
export type { QuantitySelectorProps } from './components/molecules/QuantitySelector'
|
|
148
|
-
|
|
149
140
|
// Organisms
|
|
150
141
|
export {
|
|
151
142
|
default as OutOfStock,
|
|
@@ -14,13 +14,16 @@
|
|
|
14
14
|
|
|
15
15
|
// Molecules
|
|
16
16
|
@import "../components/molecules/Accordion/styles";
|
|
17
|
+
@import "../components/molecules/Alert/styles";
|
|
17
18
|
@import "../components/molecules/BuyButton/styles";
|
|
18
19
|
@import "../components/molecules/CheckboxField/styles";
|
|
19
20
|
@import "../components/molecules/DiscountBadge/styles";
|
|
20
21
|
@import "../components/molecules/Dropdown/styles";
|
|
21
22
|
@import "../components/molecules/InputField/styles";
|
|
22
23
|
@import "../components/molecules/LinkButton/styles";
|
|
24
|
+
@import "../components/molecules/QuantitySelector/styles";
|
|
23
25
|
@import "../components/molecules/RadioField/styles";
|
|
26
|
+
@import "../components/molecules/Rating/styles";
|
|
24
27
|
@import "../components/molecules/SelectField/styles";
|
|
25
28
|
@import "../components/molecules/Table/styles";
|
|
26
29
|
@import "../components/molecules/Tag/styles";
|
|
@@ -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","sourceRoot":"","sources":["../../../../src/components/molecules/AggregateRating/AggregateRating.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAkB5C,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,GAAG,UAAU,EACd,EAAE,EAAE;IACH,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE;QACnC,OAAO,+BAAQ,UAAU,IAAG,QAAQ,CAAM,CAAA;KAC3C;IAED,OAAO,gCAAK,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAM,CAAA;AAC5D,CAAC,CAAA;AAED,MAAM,eAAe,GAAG,UAAU,CAChC,SAAS,eAAe,CACtB,EAAE,QAAQ,EAAE,MAAM,GAAG,wBAAwB,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,EACrE,GAAG;IAEH,MAAM,SAAS,GAAG,CAAC,SAAiB,EAAE,EAAE;QACtC,IAAI,SAAS,IAAI,CAAC,EAAE;YAClB,OAAO,MAAM,CAAA;SACd;QAED,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,GAAG,CAAC,EAAE;YAClC,OAAO,SAAS,CAAA;SACjB;QAED,OAAO,OAAO,CAAA;IAChB,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,IAAI,sCAEH,GAAG,EAAE,GAAG,iBACK,MAAM,KACf,UAAU,IAEb,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAa,EAAE,EAAE;QACrD,MAAM,iBAAiB,GAAG,KAAK,CAAA;QAC/B,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,GAAG,iBAAiB,CAAC,CAAA;QAEjD,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,oBAAoB,KAAK,EAAE,mCACD,IAAI,iBACtB,GAAG,MAAM,OAAO,IAE5B,KAAK,CACK,CACd,CAAA;IACH,CAAC,CAAC,CACG,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,eAAe,CAAA"}
|
|
@@ -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 +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,29 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { IconButtonProps, InputProps } from '@faststore/components';
|
|
4
|
-
export interface QuantitySelectorProps extends InputHTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
6
|
-
* Sets the current value that should be displayed on the input at the center of the quantity selector.
|
|
7
|
-
*/
|
|
8
|
-
quantity: number | string;
|
|
9
|
-
/**
|
|
10
|
-
* Object with properties that will be passed forward the inner IconButton atom at the left of the input.
|
|
11
|
-
*/
|
|
12
|
-
leftButtonProps: Omit<IconButtonProps, 'aria-label'>;
|
|
13
|
-
/**
|
|
14
|
-
* Object with properties that will be passed forward the inner Input atom between the two buttons.
|
|
15
|
-
*/
|
|
16
|
-
inputProps: InputProps;
|
|
17
|
-
/**
|
|
18
|
-
* Object with properties that will be passed forward the inner IconButton atom at the right of the input.
|
|
19
|
-
*/
|
|
20
|
-
rightButtonProps: Omit<IconButtonProps, 'aria-label'>;
|
|
21
|
-
/**
|
|
22
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
23
|
-
*
|
|
24
|
-
* @default 'store-quantity-selector'
|
|
25
|
-
*/
|
|
26
|
-
testId?: string;
|
|
27
|
-
}
|
|
28
|
-
declare const QuantitySelector: React.ForwardRefExoticComponent<QuantitySelectorProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
-
export default QuantitySelector;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { IconButton, Input } from '@faststore/components';
|
|
3
|
-
const QuantitySelector = forwardRef(function QuantitySelector({ quantity, testId = 'store-quantity-selector', leftButtonProps, inputProps, rightButtonProps, ...otherProps }, ref) {
|
|
4
|
-
return (React.createElement("div", { "data-fs-quantity-selector": true, "data-testid": testId, ref: ref, ...otherProps },
|
|
5
|
-
React.createElement(IconButton, { "aria-controls": "quantity-selector-input", "aria-label": "Decrement Quantity", "data-quantity-selector-button": "left", ...leftButtonProps }),
|
|
6
|
-
React.createElement(Input, { "aria-label": "Quantity", "data-quantity-selector-input": true, id: "quantity-selector-input", value: quantity, ...inputProps }),
|
|
7
|
-
React.createElement(IconButton, { "aria-controls": "quantity-selector-input", "aria-label": "Increment Quantity", "data-quantity-selector-button": "right", ...rightButtonProps })));
|
|
8
|
-
});
|
|
9
|
-
export default QuantitySelector;
|
|
10
|
-
//# sourceMappingURL=QuantitySelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"QuantitySelector.js","sourceRoot":"","sources":["../../../../src/components/molecules/QuantitySelector/QuantitySelector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAgCzD,MAAM,gBAAgB,GAAG,UAAU,CACjC,SAAS,gBAAgB,CACvB,EACE,QAAQ,EACR,MAAM,GAAG,yBAAyB,EAClC,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,GAAG,UAAU,EACS,EACxB,GAAG;IAEH,OAAO,CACL,+EAEe,MAAM,EACnB,GAAG,EAAE,GAAG,KACJ,UAAU;QAEd,oBAAC,UAAU,qBACK,yBAAyB,gBAC5B,oBAAoB,mCACD,MAAM,KAChC,eAAe,GACnB;QACF,oBAAC,KAAK,kBACO,UAAU,wCAErB,EAAE,EAAC,yBAAyB,EAC5B,KAAK,EAAE,QAAQ,KACX,UAAU,GACd;QACF,oBAAC,UAAU,qBACK,yBAAyB,gBAC5B,oBAAoB,mCACD,OAAO,KACjC,gBAAgB,GACpB,CACE,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/QuantitySelector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,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,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,80 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
|
|
4
|
-
import type { IconButtonProps, InputProps } from '@faststore/components'
|
|
5
|
-
import { IconButton, Input } from '@faststore/components'
|
|
6
|
-
|
|
7
|
-
export interface QuantitySelectorProps
|
|
8
|
-
extends InputHTMLAttributes<HTMLDivElement> {
|
|
9
|
-
/**
|
|
10
|
-
* Sets the current value that should be displayed on the input at the center of the quantity selector.
|
|
11
|
-
*/
|
|
12
|
-
quantity: number | string
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Object with properties that will be passed forward the inner IconButton atom at the left of the input.
|
|
16
|
-
*/
|
|
17
|
-
leftButtonProps: Omit<IconButtonProps, 'aria-label'>
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Object with properties that will be passed forward the inner Input atom between the two buttons.
|
|
21
|
-
*/
|
|
22
|
-
inputProps: InputProps
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Object with properties that will be passed forward the inner IconButton atom at the right of the input.
|
|
26
|
-
*/
|
|
27
|
-
rightButtonProps: Omit<IconButtonProps, 'aria-label'>
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
31
|
-
*
|
|
32
|
-
* @default 'store-quantity-selector'
|
|
33
|
-
*/
|
|
34
|
-
testId?: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const QuantitySelector = forwardRef<HTMLDivElement, QuantitySelectorProps>(
|
|
38
|
-
function QuantitySelector(
|
|
39
|
-
{
|
|
40
|
-
quantity,
|
|
41
|
-
testId = 'store-quantity-selector',
|
|
42
|
-
leftButtonProps,
|
|
43
|
-
inputProps,
|
|
44
|
-
rightButtonProps,
|
|
45
|
-
...otherProps
|
|
46
|
-
}: QuantitySelectorProps,
|
|
47
|
-
ref
|
|
48
|
-
) {
|
|
49
|
-
return (
|
|
50
|
-
<div
|
|
51
|
-
data-fs-quantity-selector
|
|
52
|
-
data-testid={testId}
|
|
53
|
-
ref={ref}
|
|
54
|
-
{...otherProps}
|
|
55
|
-
>
|
|
56
|
-
<IconButton
|
|
57
|
-
aria-controls="quantity-selector-input"
|
|
58
|
-
aria-label="Decrement Quantity"
|
|
59
|
-
data-quantity-selector-button="left"
|
|
60
|
-
{...leftButtonProps}
|
|
61
|
-
/>
|
|
62
|
-
<Input
|
|
63
|
-
aria-label="Quantity"
|
|
64
|
-
data-quantity-selector-input
|
|
65
|
-
id="quantity-selector-input"
|
|
66
|
-
value={quantity}
|
|
67
|
-
{...inputProps}
|
|
68
|
-
/>
|
|
69
|
-
<IconButton
|
|
70
|
-
aria-controls="quantity-selector-input"
|
|
71
|
-
aria-label="Increment Quantity"
|
|
72
|
-
data-quantity-selector-button="right"
|
|
73
|
-
{...rightButtonProps}
|
|
74
|
-
/>
|
|
75
|
-
</div>
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
export default QuantitySelector
|