@faststore/ui 2.0.85-alpha.0 → 2.0.88-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/dist/index.d.ts +0 -4
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/molecules/SearchDropdown/styles.scss +65 -0
- package/src/components/molecules/SearchInputField/styles.scss +68 -0
- package/src/components/molecules/SkuSelector/styles.scss +204 -0
- package/src/components/organisms/SearchInput/styles.scss +28 -0
- package/src/index.ts +0 -8
- package/src/styles/components.scss +4 -0
- package/dist/components/molecules/SearchInput/SearchInput.d.ts +0 -28
- package/dist/components/molecules/SearchInput/SearchInput.js +0 -26
- package/dist/components/molecules/SearchInput/SearchInput.js.map +0 -1
- package/dist/components/molecules/SearchInput/index.d.ts +0 -2
- package/dist/components/molecules/SearchInput/index.js +0 -2
- package/dist/components/molecules/SearchInput/index.js.map +0 -1
- package/dist/components/molecules/SkuSelector/SkuSelector.d.ts +0 -58
- package/dist/components/molecules/SkuSelector/SkuSelector.js +0 -15
- package/dist/components/molecules/SkuSelector/SkuSelector.js.map +0 -1
- package/dist/components/molecules/SkuSelector/index.d.ts +0 -2
- package/dist/components/molecules/SkuSelector/index.js +0 -2
- package/dist/components/molecules/SkuSelector/index.js.map +0 -1
- package/src/components/molecules/SearchInput/SearchInput.tsx +0 -100
- package/src/components/molecules/SearchInput/index.ts +0 -2
- package/src/components/molecules/SkuSelector/SkuSelector.tsx +0 -106
- package/src/components/molecules/SkuSelector/index.tsx +0 -2
package/dist/index.d.ts
CHANGED
|
@@ -3,14 +3,10 @@ export { default as TextArea } from './components/atoms/TextArea';
|
|
|
3
3
|
export type { TextAreaProps } from './components/atoms/TextArea';
|
|
4
4
|
export { default as Incentive } from './components/atoms/Incentive';
|
|
5
5
|
export type { IncentiveProps } from './components/atoms/Incentive';
|
|
6
|
-
export { default as SkuSelector } from './components/molecules/SkuSelector';
|
|
7
|
-
export type { SkuSelectorProps } from './components/molecules/SkuSelector';
|
|
8
6
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
9
7
|
export type { OrderSummaryProps } from './components/molecules/OrderSummary';
|
|
10
8
|
export { default as Bullets } from './components/molecules/Bullets';
|
|
11
9
|
export type { BulletsProps } from './components/molecules/Bullets';
|
|
12
|
-
export { default as SearchInput } from './components/molecules/SearchInput';
|
|
13
|
-
export type { SearchInputProps, SearchInputRef, } from './components/molecules/SearchInput';
|
|
14
10
|
export { default as Carousel } from './components/molecules/Carousel';
|
|
15
11
|
export type { CarouselProps } from './components/molecules/Carousel';
|
|
16
12
|
export { default as Banner, BannerContent, BannerImage, BannerLink, } from './components/molecules/Banner';
|
package/dist/index.js
CHANGED
|
@@ -3,10 +3,8 @@ export * from '@faststore/components';
|
|
|
3
3
|
export { default as TextArea } from './components/atoms/TextArea';
|
|
4
4
|
export { default as Incentive } from './components/atoms/Incentive';
|
|
5
5
|
// Molecules
|
|
6
|
-
export { default as SkuSelector } from './components/molecules/SkuSelector';
|
|
7
6
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
8
7
|
export { default as Bullets } from './components/molecules/Bullets';
|
|
9
|
-
export { default as SearchInput } from './components/molecules/SearchInput';
|
|
10
8
|
export { default as Carousel } from './components/molecules/Carousel';
|
|
11
9
|
export { default as Banner, BannerContent, BannerImage, BannerLink, } from './components/molecules/Banner';
|
|
12
10
|
export { default as Form } from './components/molecules/Form';
|
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,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGnE,YAAY;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AAErC,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGjE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAGnE,YAAY;AAEZ,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAG7E,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AAGrE,OAAO,EACL,OAAO,IAAI,MAAM,EACjB,aAAa,EACb,WAAW,EACX,UAAU,GACX,MAAM,+BAA+B,CAAA;AAQtC,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.88-alpha.0",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"node": "16.18.0",
|
|
59
59
|
"yarn": "1.19.1"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "a9aa7a6572c08e0bd26e384bb66464e633f1ad84"
|
|
62
62
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[data-fs-search-dropdown] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Search Dropdown
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-search-input-height-desktop : var(--fs-spacing-6);
|
|
8
|
+
--fs-search-dropdown-bkg-color : var(--fs-color-neutral-0);
|
|
9
|
+
--fs-search-dropdown-box-shadow : var(--fs-shadow);
|
|
10
|
+
|
|
11
|
+
--fs-search-dropdown-width-mobile : 100vw;
|
|
12
|
+
--fs-search-dropdown-width-desktop : 100%;
|
|
13
|
+
|
|
14
|
+
--fs-search-dropdown-border-width : var(--fs-border-width);
|
|
15
|
+
--fs-search-dropdown-border-color : var(--fs-border-color);
|
|
16
|
+
--fs-search-dropdown-border-radius : 0 0 var(--fs-border-radius) var(--fs-border-radius);
|
|
17
|
+
|
|
18
|
+
--fs-search-dropdown-position-left-mobile : calc(-1 * var(--fs-control-tap-size));
|
|
19
|
+
--fs-search-dropdown-position-left-tablet : calc(var(--fs-search-dropdown-position-left-mobile) - var(--fs-spacing-1));
|
|
20
|
+
--fs-search-dropdown-position-top-mobile : calc(var(--fs-search-dropdown-position-top-tablet) + 1px);
|
|
21
|
+
--fs-search-dropdown-position-top-tablet : calc(var(--fs-control-tap-size) + var(--fs-spacing-2) + var(--fs-border-width));
|
|
22
|
+
--fs-search-dropdown-position-top-desktop : var(--fs-search-input-height-desktop);
|
|
23
|
+
|
|
24
|
+
--fs-search-dropdown-section-border-color : var(--fs-border-color-light);
|
|
25
|
+
|
|
26
|
+
// --------------------------------------------------------
|
|
27
|
+
// Structural Styles
|
|
28
|
+
// --------------------------------------------------------
|
|
29
|
+
|
|
30
|
+
position: absolute;
|
|
31
|
+
top: var(--fs-search-dropdown-position-top-mobile);
|
|
32
|
+
left: var(--fs-search-dropdown-position-left-mobile);
|
|
33
|
+
z-index: 1;
|
|
34
|
+
width: var(--fs-search-dropdown-width-mobile);
|
|
35
|
+
padding-top: 0;
|
|
36
|
+
background-color: var(--fs-search-dropdown-bkg-color);
|
|
37
|
+
|
|
38
|
+
&:empty { display: none; }
|
|
39
|
+
|
|
40
|
+
@include media(">=tablet") {
|
|
41
|
+
top: var(--fs-search-dropdown-position-top-tablet);
|
|
42
|
+
left: var(--fs-search-dropdown-position-left-tablet);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@include media(">=notebook") {
|
|
46
|
+
top: var(--fs-search-dropdown-position-top-desktop);
|
|
47
|
+
left: 0;
|
|
48
|
+
width: var(--fs-search-dropdown-width-desktop);
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
border: var(--fs-search-dropdown-border-width) solid var(--fs-search-dropdown-border-color);
|
|
51
|
+
border-top: none;
|
|
52
|
+
border-radius: var(--fs-search-dropdown-border-radius);
|
|
53
|
+
box-shadow: var(--fs-search-dropdown-box-shadow);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[data-fs-search-dropdown-loading-text] { padding: var(--fs-spacing-3); }
|
|
57
|
+
|
|
58
|
+
section, [data-fs-search-section] {
|
|
59
|
+
border-bottom: var(--fs-search-dropdown-border-width) solid var(--fs-search-dropdown-section-border-color);
|
|
60
|
+
|
|
61
|
+
&:last-child {
|
|
62
|
+
border-bottom-width: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[data-fs-search-input-field] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Search Input Field
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
// Default properties
|
|
6
|
+
--fs-search-input-height-desktop : var(--fs-spacing-6);
|
|
7
|
+
|
|
8
|
+
--fs-search-input-field-height-mobile : var(--fs-control-tap-size);
|
|
9
|
+
--fs-search-input-field-height-desktop : var(--fs-spacing-6);
|
|
10
|
+
|
|
11
|
+
--fs-search-input-field-transition-timing : var(--fs-transition-timing);
|
|
12
|
+
--fs-search-input-field-transition-function : ease;
|
|
13
|
+
|
|
14
|
+
// Button
|
|
15
|
+
--fs-search-input-field-button-width : var(--fs-spacing-7);
|
|
16
|
+
--fs-search-input-field-button-min-height : var(--fs-search-input-height-desktop);
|
|
17
|
+
--fs-search-input-field-button-bkg-color : transparent;
|
|
18
|
+
|
|
19
|
+
--fs-search-input-field-button-height-mobile : var(--fs-search-input-field-button-width);
|
|
20
|
+
--fs-search-input-field-button-height-desktop : var(--fs-search-input-field-height-desktop);
|
|
21
|
+
|
|
22
|
+
// Input
|
|
23
|
+
--fs-search-input-field-input-padding-right : var(--fs-search-input-field-button-width);
|
|
24
|
+
--fs-search-input-field-input-bkg-color : var(--fs-color-body-bkg);
|
|
25
|
+
|
|
26
|
+
// Icon
|
|
27
|
+
--fs-search-input-field-icon-width : var(--fs-spacing-4);
|
|
28
|
+
--fs-search-input-field-icon-height : var(--fs-search-input-field-icon-width);
|
|
29
|
+
|
|
30
|
+
// --------------------------------------------------------
|
|
31
|
+
// Structural Styles
|
|
32
|
+
// --------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
position: relative;
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
width: 100%;
|
|
37
|
+
height: var(--fs-search-input-field-height-mobile);
|
|
38
|
+
|
|
39
|
+
@include input-focus-ring;
|
|
40
|
+
|
|
41
|
+
@include media(">=notebook") { height: var(--fs-search-input-field-height-desktop); }
|
|
42
|
+
|
|
43
|
+
[data-fs-icon-button][data-fs-button-variant] {
|
|
44
|
+
position: absolute;
|
|
45
|
+
right: var(--fs-spacing-0);
|
|
46
|
+
width: var(--fs-search-input-field-button-width);
|
|
47
|
+
height: var(--fs-search-input-field-button-height-mobile);
|
|
48
|
+
padding: 0;
|
|
49
|
+
background-color: var(--fs-search-input-field-button-bkg-color);
|
|
50
|
+
border: 0;
|
|
51
|
+
@include media(">=notebook") {
|
|
52
|
+
height: var(--fs-search-input-field-button-height-desktop);
|
|
53
|
+
min-height: var(--fs-search-input-field-button-min-height);
|
|
54
|
+
}
|
|
55
|
+
svg {
|
|
56
|
+
width: var(--fs-search-input-field-icon-width);
|
|
57
|
+
height: var(--fs-search-input-field-icon-height);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
[data-fs-search-input-field-input] {
|
|
62
|
+
height: auto;
|
|
63
|
+
padding-right: var(--fs-search-input-field-input-padding-right);
|
|
64
|
+
background-color: var(--fs-search-input-field-input-bkg-color);
|
|
65
|
+
transition: box-shadow var(--fs-search-input-field-transition-timing) var(--fs-search-input-field-transition-timing), border var(--fs-search-input-field-transition-timing) var(--fs-search-input-field-transition-function);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
@mixin sku-selector-focus-ring {
|
|
2
|
+
@media not all and (min-resolution: .001dpcm) { // Target only Safari browsers
|
|
3
|
+
@supports (-webkit-appearance:none) {
|
|
4
|
+
// Use `focus` instead of `focus-visible` due to Safari's lack of support
|
|
5
|
+
&:focus > span {
|
|
6
|
+
border-color: var(--fs-border-color-active);
|
|
7
|
+
border-width: var(--fs-border-width-thick);
|
|
8
|
+
|
|
9
|
+
@include focus-ring;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&:focus-visible > span {
|
|
15
|
+
border-color: var(--fs-border-color-active);
|
|
16
|
+
border-width: var(--fs-border-width-thick);
|
|
17
|
+
|
|
18
|
+
@include focus-ring;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-fs-sku-selector] {
|
|
23
|
+
// --------------------------------------------------------
|
|
24
|
+
// Design Tokens for Sku Selector
|
|
25
|
+
// --------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
// Default properties
|
|
28
|
+
--fs-sku-selector-row-gap : var(--fs-spacing-2);
|
|
29
|
+
--fs-sku-selector-column-gap : var(--fs-sku-selector-row-gap);
|
|
30
|
+
--fs-sku-selector-text-size : var(--fs-text-size-1);
|
|
31
|
+
|
|
32
|
+
// Option
|
|
33
|
+
--fs-sku-selector-option-width : var(--fs-spacing-7);
|
|
34
|
+
--fs-sku-selector-option-height : var(--fs-sku-selector-option-width);
|
|
35
|
+
--fs-sku-selector-option-bkg-color-hover : var(--fs-color-primary-bkg-light);
|
|
36
|
+
|
|
37
|
+
--fs-sku-selector-option-border-width : var(--fs-border-width-thick);
|
|
38
|
+
--fs-sku-selector-option-border-color : var(--fs-color-neutral-7);
|
|
39
|
+
--fs-sku-selector-option-border-radius : var(--fs-border-radius);
|
|
40
|
+
--fs-sku-selector-option-border-color-hover : var(--fs-border-color-active);
|
|
41
|
+
|
|
42
|
+
--fs-sku-selector-option-checked-border-width : var(--fs-sku-selector-option-border-width);
|
|
43
|
+
--fs-sku-selector-option-checked-border-color : var(--fs-sku-selector-option-border-color-hover);
|
|
44
|
+
--fs-sku-selector-option-checked-box-shadow : 0 0 0 var(--fs-border-width-thickest) var(--fs-color-focus-ring-outline);
|
|
45
|
+
--fs-sku-selector-option-checked-bkg-color : var(--fs-sku-selector-option-bkg-color-hover);
|
|
46
|
+
|
|
47
|
+
--fs-sku-selector-option-disabled-width : var(--fs-border-width);
|
|
48
|
+
--fs-sku-selector-option-disabled-color : var(--fs-color-disabled-text);
|
|
49
|
+
--fs-sku-selector-option-disabled-border-color : var(--fs-border-color-disabled);
|
|
50
|
+
--fs-sku-selector-option-disabled-bkg-color : var(--fs-sku-selector-option-disabled-border-color);
|
|
51
|
+
|
|
52
|
+
--fs-sku-selector-option-transition-timing : var(--fs-transition-timing);
|
|
53
|
+
--fs-sku-selector-option-transition-function : ease;
|
|
54
|
+
|
|
55
|
+
// Image
|
|
56
|
+
--fs-sku-selector-image-width : var(--fs-spacing-6);
|
|
57
|
+
--fs-sku-selector-image-height : var(--fs-sku-selector-image-width);
|
|
58
|
+
--fs-sku-selector-image-border-radius : var(--fs-border-radius-small);
|
|
59
|
+
|
|
60
|
+
// Color
|
|
61
|
+
--fs-sku-selector-color-width : var(--fs-sku-selector-image-width);
|
|
62
|
+
--fs-sku-selector-color-height : var(--fs-sku-selector-color-width);
|
|
63
|
+
--fs-sku-selector-color-border-radius : var(--fs-sku-selector-image-border-radius);
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
// --------------------------------------------------------
|
|
67
|
+
// Structural Styles
|
|
68
|
+
// --------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
display: flex;
|
|
71
|
+
flex-wrap: wrap;
|
|
72
|
+
row-gap: var(--fs-sku-selector-row-gap);
|
|
73
|
+
column-gap: var(--fs-sku-selector-column-gap);
|
|
74
|
+
font-size: var(--fs-sku-selector-text-size);
|
|
75
|
+
|
|
76
|
+
[data-fs-sku-selector-title] {
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[data-fs-sku-selector-list] {
|
|
81
|
+
display: flex;
|
|
82
|
+
column-gap: var(--fs-spacing-1);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[data-fs-sku-selector-option] {
|
|
86
|
+
position: relative;
|
|
87
|
+
width: var(--fs-sku-selector-option-width);
|
|
88
|
+
height: var(--fs-sku-selector-option-height);
|
|
89
|
+
|
|
90
|
+
[data-fs-sku-selector-option-link] {
|
|
91
|
+
position: absolute;
|
|
92
|
+
width: 100%;
|
|
93
|
+
height: 100%;
|
|
94
|
+
z-index: 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
span {
|
|
98
|
+
position: relative;
|
|
99
|
+
display: flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
overflow: hidden;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
border: var(--fs-border-width) solid var(--fs-sku-selector-option-border-color);
|
|
106
|
+
border-radius: var(--fs-sku-selector-option-border-radius);
|
|
107
|
+
box-shadow: 0;
|
|
108
|
+
transition: box-shadow var(--fs-sku-selector-option-transition-timing) var(--fs-sku-selector-option-transition-function), background-color var(--fs-sku-selector-option-transition-timing) var(--fs-sku-selector-option-transition-function);
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@include sku-selector-focus-ring;
|
|
113
|
+
|
|
114
|
+
&:hover:not([data-fs-sku-selector-disabled="true"]):not([data-fs-sku-selector-checked="true"]) > span {
|
|
115
|
+
border-color: var(--fs-sku-selector-option-border-color-hover);
|
|
116
|
+
border-width: var(--fs-sku-selector-option-border-width);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&[data-fs-sku-selector-checked="true"] > span {
|
|
120
|
+
border-color: var(--fs-sku-selector-option-checked-border-color);
|
|
121
|
+
border-width: var(--fs-sku-selector-option-checked-border-width);
|
|
122
|
+
box-shadow: var(--fs-sku-selector-option-checked-box-shadow);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&[data-fs-sku-selector-disabled="true"] {
|
|
126
|
+
cursor: not-allowed;
|
|
127
|
+
|
|
128
|
+
[data-fs-sku-selector-option-link] {
|
|
129
|
+
display: none;
|
|
130
|
+
pointer-events: none;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
> span {
|
|
134
|
+
overflow: hidden;
|
|
135
|
+
color: var(--fs-sku-selector-option-disabled-color);
|
|
136
|
+
border-color: var(--fs-sku-selector-option-disabled-border-color);
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
|
|
139
|
+
[data-fs-sku-selector-option-image] { opacity: .7; }
|
|
140
|
+
|
|
141
|
+
&::after {
|
|
142
|
+
position: absolute;
|
|
143
|
+
width: var(--fs-sku-selector-option-disabled-width);
|
|
144
|
+
height: 160%;
|
|
145
|
+
content: "";
|
|
146
|
+
background-color: var(--fs-sku-selector-option-disabled-bkg-color);
|
|
147
|
+
transform: rotate(45deg);
|
|
148
|
+
transform-origin: center;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// --------------------------------------------------------
|
|
155
|
+
// Variants Styles
|
|
156
|
+
// --------------------------------------------------------
|
|
157
|
+
|
|
158
|
+
&[data-fs-sku-selector-variant="color"] {
|
|
159
|
+
[data-fs-sku-selector-option-color] {
|
|
160
|
+
width: var(--fs-sku-selector-color-width);
|
|
161
|
+
height: var(--fs-sku-selector-color-height);
|
|
162
|
+
border-radius: var(--fs-sku-selector-color-border-radius);
|
|
163
|
+
transition: transform var(--fs-sku-selector-option-transition-timing) var(--fs-sku-selector-option-transition-function);
|
|
164
|
+
transform-origin: center center;
|
|
165
|
+
background-color: var(--data-fs-sku-selector-option-color-bkg-color);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
[data-fs-sku-selector-option] {
|
|
169
|
+
&:hover:not([data-fs-sku-selector-disabled="true"]):not([data-fs-sku-selector-checked="true"]) > span [data-fs-sku-selector-option-color] {
|
|
170
|
+
transform: scale(.95);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
&[data-fs-sku-selector-checked="true"] > span [data-fs-sku-selector-option-color] {
|
|
174
|
+
transform: scale(.85);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
&[data-fs-sku-selector-variant="label"] [data-fs-sku-selector-option] {
|
|
180
|
+
&:hover:not([data-fs-sku-selector-disabled="true"]) > span { background-color: var(--fs-sku-selector-option-bkg-color-hover); }
|
|
181
|
+
|
|
182
|
+
&[data-fs-sku-selector-checked="true"] > span { background-color: var(--fs-sku-selector-option-checked-bkg-color); }
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&[data-fs-sku-selector-variant="image"] {
|
|
186
|
+
[data-fs-sku-selector-option-image] {
|
|
187
|
+
width: var(--fs-sku-selector-image-width);
|
|
188
|
+
height: var(--fs-sku-selector-image-height);
|
|
189
|
+
border-radius: var(--fs-sku-selector-image-border-radius);
|
|
190
|
+
transition: transform var(--fs-sku-selector-option-transition-timing) var(--fs-sku-selector-option-transition-function);
|
|
191
|
+
transform-origin: center center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
[data-fs-sku-selector-option] {
|
|
195
|
+
&:hover:not([data-fs-sku-selector-disabled="true"]):not([data-fs-sku-selector-checked="true"]) > span [data-fs-sku-selector-option-image] {
|
|
196
|
+
transform: scale(.95);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
&[data-fs-sku-selector-checked="true"] > span [data-fs-sku-selector-option-image] {
|
|
200
|
+
transform: scale(.85);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[data-fs-search-input] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Search Input
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-search-input-height-desktop : var(--fs-spacing-6);
|
|
8
|
+
|
|
9
|
+
// --------------------------------------------------------
|
|
10
|
+
// Structural Styles
|
|
11
|
+
// --------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
&[data-fs-search-input-dropdown-visible="true"] [data-fs-search-input-field-input] {
|
|
16
|
+
@include media(">=notebook") {
|
|
17
|
+
border-bottom-right-radius: 0;
|
|
18
|
+
border-bottom-left-radius: 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[data-fs-search-product-card-link] {
|
|
23
|
+
color: var(--fs-color-neutral-7);
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
|
|
26
|
+
&:hover { text-decoration: none; }
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -8,8 +8,6 @@ export { default as Incentive } from './components/atoms/Incentive'
|
|
|
8
8
|
export type { IncentiveProps } from './components/atoms/Incentive'
|
|
9
9
|
|
|
10
10
|
// Molecules
|
|
11
|
-
export { default as SkuSelector } from './components/molecules/SkuSelector'
|
|
12
|
-
export type { SkuSelectorProps } from './components/molecules/SkuSelector'
|
|
13
11
|
|
|
14
12
|
export { default as OrderSummary } from './components/molecules/OrderSummary'
|
|
15
13
|
export type { OrderSummaryProps } from './components/molecules/OrderSummary'
|
|
@@ -17,12 +15,6 @@ export type { OrderSummaryProps } from './components/molecules/OrderSummary'
|
|
|
17
15
|
export { default as Bullets } from './components/molecules/Bullets'
|
|
18
16
|
export type { BulletsProps } from './components/molecules/Bullets'
|
|
19
17
|
|
|
20
|
-
export { default as SearchInput } from './components/molecules/SearchInput'
|
|
21
|
-
export type {
|
|
22
|
-
SearchInputProps,
|
|
23
|
-
SearchInputRef,
|
|
24
|
-
} from './components/molecules/SearchInput'
|
|
25
|
-
|
|
26
18
|
export { default as Carousel } from './components/molecules/Carousel'
|
|
27
19
|
export type { CarouselProps } from './components/molecules/Carousel'
|
|
28
20
|
|
|
@@ -34,10 +34,13 @@
|
|
|
34
34
|
@import "../components/molecules/RadioField/styles";
|
|
35
35
|
@import "../components/molecules/Rating/styles";
|
|
36
36
|
@import "../components/molecules/SearchAutoComplete/styles";
|
|
37
|
+
@import "../components/molecules/SearchDropdown/styles";
|
|
37
38
|
@import "../components/molecules/SearchHistory/styles";
|
|
39
|
+
@import "../components/molecules/SearchInputField/styles";
|
|
38
40
|
@import "../components/molecules/SearchProducts/styles";
|
|
39
41
|
@import "../components/molecules/SearchTop/styles";
|
|
40
42
|
@import "../components/molecules/SelectField/styles";
|
|
43
|
+
@import "../components/molecules/SkuSelector/styles";
|
|
41
44
|
@import "../components/molecules/Table/styles";
|
|
42
45
|
@import "../components/molecules/Tag/styles";
|
|
43
46
|
@import "../components/molecules/Toast/styles";
|
|
@@ -48,4 +51,5 @@
|
|
|
48
51
|
@import "../components/organisms/Hero/styles";
|
|
49
52
|
@import "../components/organisms/PaymentMethods/styles";
|
|
50
53
|
@import "../components/organisms/PriceRange/styles";
|
|
54
|
+
@import "../components/organisms/SearchInput/styles";
|
|
51
55
|
@import "../components/organisms/SlideOver/styles";
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { AriaAttributes, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onSubmit'>;
|
|
4
|
-
export interface SearchInputProps extends InputProps {
|
|
5
|
-
/**
|
|
6
|
-
* Callback function when submitted.
|
|
7
|
-
*/
|
|
8
|
-
onSubmit: (value: string) => void;
|
|
9
|
-
/**
|
|
10
|
-
* Custom icon inside the submit button.
|
|
11
|
-
*/
|
|
12
|
-
icon?: ReactNode;
|
|
13
|
-
/**
|
|
14
|
-
* Custom aria-label for input and button.
|
|
15
|
-
*/
|
|
16
|
-
'aria-label'?: AriaAttributes['aria-label'];
|
|
17
|
-
/**
|
|
18
|
-
/**
|
|
19
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
20
|
-
*/
|
|
21
|
-
testId?: string;
|
|
22
|
-
}
|
|
23
|
-
export interface SearchInputRef {
|
|
24
|
-
inputRef?: HTMLInputElement | null;
|
|
25
|
-
formRef?: HTMLFormElement | null;
|
|
26
|
-
}
|
|
27
|
-
declare const SearchInput: React.ForwardRefExoticComponent<SearchInputProps & React.RefAttributes<SearchInputRef | null>>;
|
|
28
|
-
export default SearchInput;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { Icon, Button, Input } from '@faststore/components';
|
|
3
|
-
import Form from '../Form';
|
|
4
|
-
const SearchIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
|
|
5
|
-
React.createElement("circle", { cx: "11", cy: "11", r: "8" }),
|
|
6
|
-
React.createElement("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })));
|
|
7
|
-
const SearchInput = forwardRef(function SearchInput({ onSubmit, icon, 'aria-label': ariaLabel = 'search', testId = 'store-search-input', ...otherProps }, ref) {
|
|
8
|
-
const inputRef = useRef(null);
|
|
9
|
-
const formRef = useRef(null);
|
|
10
|
-
const handleSubmit = (event) => {
|
|
11
|
-
event.preventDefault();
|
|
12
|
-
if (inputRef.current?.value !== '') {
|
|
13
|
-
onSubmit(inputRef.current.value);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
useImperativeHandle(ref, () => ({
|
|
17
|
-
inputRef: inputRef.current,
|
|
18
|
-
formRef: formRef.current,
|
|
19
|
-
}));
|
|
20
|
-
return (React.createElement(Form, { ref: formRef, "data-fs-search-input-form": true, "data-testid": testId, onSubmit: handleSubmit, role: "search" },
|
|
21
|
-
React.createElement(Input, { ref: inputRef, "aria-label": ariaLabel, ...otherProps }),
|
|
22
|
-
React.createElement(Button, { type: "submit", "aria-label": "Submit Search" },
|
|
23
|
-
React.createElement(Icon, { component: icon ?? React.createElement(SearchIcon, null) }))));
|
|
24
|
-
});
|
|
25
|
-
export default SearchInput;
|
|
26
|
-
//# sourceMappingURL=SearchInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../../../src/components/molecules/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,CACvB,6BACE,KAAK,EAAC,4BAA4B,EAClC,KAAK,EAAC,KAAK,EACX,MAAM,EAAC,KAAK,EACZ,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EACf,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO;IAEtB,gCAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,CAAC,EAAC,GAAG,GAAG;IAChC,8BAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,OAAO,EAAC,EAAE,EAAC,OAAO,GAAG,CAC1C,CACP,CAAA;AA6BD,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EACE,QAAQ,EACR,IAAI,EACJ,YAAY,EAAE,SAAS,GAAG,QAAQ,EAClC,MAAM,GAAG,oBAAoB,EAC7B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAA;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAA;IAE7C,MAAM,YAAY,GAAG,CAAC,KAAgB,EAAE,EAAE;QACxC,KAAK,CAAC,cAAc,EAAE,CAAA;QAEtB,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,KAAK,EAAE,EAAE;YAClC,QAAQ,CAAC,QAAQ,CAAC,OAAQ,CAAC,KAAK,CAAC,CAAA;SAClC;IACH,CAAC,CAAA;IAED,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;QAC9B,QAAQ,EAAE,QAAQ,CAAC,OAAO;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC,CAAA;IAEH,OAAO,CACL,oBAAC,IAAI,IACH,GAAG,EAAE,OAAO,oDAEC,MAAM,EACnB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAC,QAAQ;QAEb,oBAAC,KAAK,IAAC,GAAG,EAAE,QAAQ,gBAAc,SAAS,KAAM,UAAU,GAAI;QAC/D,oBAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,gBAAY,eAAe;YAC9C,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,IAAI,oBAAC,UAAU,OAAG,GAAI,CACpC,CACJ,CACR,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/SearchInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { ChangeEventHandler, HTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
interface SkuProps {
|
|
4
|
-
/**
|
|
5
|
-
* Alternative text description of the image.
|
|
6
|
-
*/
|
|
7
|
-
alt?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Image URL.
|
|
10
|
-
*/
|
|
11
|
-
src?: string;
|
|
12
|
-
/**
|
|
13
|
-
* Label to describe the option when selected.
|
|
14
|
-
*/
|
|
15
|
-
label: string;
|
|
16
|
-
/**
|
|
17
|
-
* Current value for this option.
|
|
18
|
-
*/
|
|
19
|
-
value: string;
|
|
20
|
-
/**
|
|
21
|
-
* Specifies that this option should be disabled.
|
|
22
|
-
*/
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
}
|
|
25
|
-
type Variant = 'label' | 'image';
|
|
26
|
-
export interface SkuSelectorProps extends HTMLAttributes<HTMLDivElement> {
|
|
27
|
-
/**
|
|
28
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
29
|
-
* testing-library, and jest).
|
|
30
|
-
*/
|
|
31
|
-
testId?: string;
|
|
32
|
-
/**
|
|
33
|
-
* ID of the current instance of the component.
|
|
34
|
-
*/
|
|
35
|
-
id?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Specify which variant the component should handle.
|
|
38
|
-
*/
|
|
39
|
-
variant: Variant;
|
|
40
|
-
/**
|
|
41
|
-
* SKU options that should be rendered.
|
|
42
|
-
*/
|
|
43
|
-
options: SkuProps[];
|
|
44
|
-
/**
|
|
45
|
-
* Section label for the SKU selector.
|
|
46
|
-
*/
|
|
47
|
-
label?: string;
|
|
48
|
-
/**
|
|
49
|
-
* Currently active variation's value.
|
|
50
|
-
*/
|
|
51
|
-
activeValue: string;
|
|
52
|
-
/**
|
|
53
|
-
* Function to be triggered when SKU option change.
|
|
54
|
-
*/
|
|
55
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
56
|
-
}
|
|
57
|
-
declare const SkuSelector: React.ForwardRefExoticComponent<SkuSelectorProps & React.RefAttributes<HTMLDivElement>>;
|
|
58
|
-
export default SkuSelector;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Label, RadioGroup } from '@faststore/components';
|
|
3
|
-
const SkuSelector = forwardRef(function SkuSelector({ id, label, variant, onChange, testId = 'store-sku-selector', activeValue, children, ...otherProps }, ref) {
|
|
4
|
-
const radioGroupId = id ? `-${id}` : '';
|
|
5
|
-
return (React.createElement("div", { ref: ref, "data-fs-sku-selector": true, "data-testid": testId, "data-fs-sku-selector-variant": variant, ...otherProps },
|
|
6
|
-
label && (React.createElement(Label, { "data-fs-sku-selector-title": true },
|
|
7
|
-
label,
|
|
8
|
-
": ",
|
|
9
|
-
React.createElement("strong", null, activeValue))),
|
|
10
|
-
React.createElement(RadioGroup, { selectedValue: activeValue, name: `sku-selector-${variant}${radioGroupId}`, onChange: (e) => {
|
|
11
|
-
onChange?.(e);
|
|
12
|
-
} }, children)));
|
|
13
|
-
});
|
|
14
|
-
export default SkuSelector;
|
|
15
|
-
//# sourceMappingURL=SkuSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SkuSelector.js","sourceRoot":"","sources":["../../../../src/components/molecules/SkuSelector/SkuSelector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AA4DzD,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EACE,EAAE,EACF,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,GAAG,oBAAoB,EAC7B,WAAW,EACX,QAAQ,EACR,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,YAAY,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;IAEvC,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,+CAEK,MAAM,kCACW,OAAO,KACjC,UAAU;QAEb,KAAK,IAAI,CACR,oBAAC,KAAK;YACH,KAAK;;YAAG,oCAAS,WAAW,CAAU,CACjC,CACT;QACD,oBAAC,UAAU,IACT,aAAa,EAAE,WAAW,EAC1B,IAAI,EAAE,gBAAgB,OAAO,GAAG,YAAY,EAAE,EAC9C,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;YACf,CAAC,IAEA,QAAQ,CACE,CACT,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/SkuSelector/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AriaAttributes,
|
|
3
|
-
FormEvent,
|
|
4
|
-
InputHTMLAttributes,
|
|
5
|
-
ReactNode,
|
|
6
|
-
} from 'react'
|
|
7
|
-
import React, { forwardRef, useImperativeHandle, useRef } from 'react'
|
|
8
|
-
|
|
9
|
-
import { Icon, Button, Input } from '@faststore/components'
|
|
10
|
-
import Form from '../Form'
|
|
11
|
-
|
|
12
|
-
const SearchIcon = () => (
|
|
13
|
-
<svg
|
|
14
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
-
width="1em"
|
|
16
|
-
height="1em"
|
|
17
|
-
viewBox="0 0 24 24"
|
|
18
|
-
fill="none"
|
|
19
|
-
stroke="currentColor"
|
|
20
|
-
strokeWidth="2"
|
|
21
|
-
strokeLinecap="round"
|
|
22
|
-
strokeLinejoin="round"
|
|
23
|
-
>
|
|
24
|
-
<circle cx="11" cy="11" r="8" />
|
|
25
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
26
|
-
</svg>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onSubmit'>
|
|
30
|
-
|
|
31
|
-
export interface SearchInputProps extends InputProps {
|
|
32
|
-
/**
|
|
33
|
-
* Callback function when submitted.
|
|
34
|
-
*/
|
|
35
|
-
onSubmit: (value: string) => void
|
|
36
|
-
/**
|
|
37
|
-
* Custom icon inside the submit button.
|
|
38
|
-
*/
|
|
39
|
-
icon?: ReactNode
|
|
40
|
-
/**
|
|
41
|
-
* Custom aria-label for input and button.
|
|
42
|
-
*/
|
|
43
|
-
'aria-label'?: AriaAttributes['aria-label']
|
|
44
|
-
/**
|
|
45
|
-
/**
|
|
46
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
47
|
-
*/
|
|
48
|
-
testId?: string
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface SearchInputRef {
|
|
52
|
-
inputRef?: HTMLInputElement | null
|
|
53
|
-
formRef?: HTMLFormElement | null
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const SearchInput = forwardRef<SearchInputRef | null, SearchInputProps>(
|
|
57
|
-
function SearchInput(
|
|
58
|
-
{
|
|
59
|
-
onSubmit,
|
|
60
|
-
icon,
|
|
61
|
-
'aria-label': ariaLabel = 'search',
|
|
62
|
-
testId = 'store-search-input',
|
|
63
|
-
...otherProps
|
|
64
|
-
},
|
|
65
|
-
ref
|
|
66
|
-
) {
|
|
67
|
-
const inputRef = useRef<HTMLInputElement>(null)
|
|
68
|
-
const formRef = useRef<HTMLFormElement>(null)
|
|
69
|
-
|
|
70
|
-
const handleSubmit = (event: FormEvent) => {
|
|
71
|
-
event.preventDefault()
|
|
72
|
-
|
|
73
|
-
if (inputRef.current?.value !== '') {
|
|
74
|
-
onSubmit(inputRef.current!.value)
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
useImperativeHandle(ref, () => ({
|
|
79
|
-
inputRef: inputRef.current,
|
|
80
|
-
formRef: formRef.current,
|
|
81
|
-
}))
|
|
82
|
-
|
|
83
|
-
return (
|
|
84
|
-
<Form
|
|
85
|
-
ref={formRef}
|
|
86
|
-
data-fs-search-input-form
|
|
87
|
-
data-testid={testId}
|
|
88
|
-
onSubmit={handleSubmit}
|
|
89
|
-
role="search"
|
|
90
|
-
>
|
|
91
|
-
<Input ref={inputRef} aria-label={ariaLabel} {...otherProps} />
|
|
92
|
-
<Button type="submit" aria-label="Submit Search">
|
|
93
|
-
<Icon component={icon ?? <SearchIcon />} />
|
|
94
|
-
</Button>
|
|
95
|
-
</Form>
|
|
96
|
-
)
|
|
97
|
-
}
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
export default SearchInput
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { ChangeEventHandler, HTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
import { Label, RadioGroup } from '@faststore/components'
|
|
4
|
-
|
|
5
|
-
interface SkuProps {
|
|
6
|
-
/**
|
|
7
|
-
* Alternative text description of the image.
|
|
8
|
-
*/
|
|
9
|
-
alt?: string
|
|
10
|
-
/**
|
|
11
|
-
* Image URL.
|
|
12
|
-
*/
|
|
13
|
-
src?: string
|
|
14
|
-
/**
|
|
15
|
-
* Label to describe the option when selected.
|
|
16
|
-
*/
|
|
17
|
-
label: string
|
|
18
|
-
/**
|
|
19
|
-
* Current value for this option.
|
|
20
|
-
*/
|
|
21
|
-
value: string
|
|
22
|
-
/**
|
|
23
|
-
* Specifies that this option should be disabled.
|
|
24
|
-
*/
|
|
25
|
-
disabled?: boolean
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// TODO: Add the 'color' variant back once the store supports naturally handling color SKUs.
|
|
29
|
-
type Variant = 'label' | 'image'
|
|
30
|
-
|
|
31
|
-
export interface SkuSelectorProps extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
-
/**
|
|
33
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
34
|
-
* testing-library, and jest).
|
|
35
|
-
*/
|
|
36
|
-
testId?: string
|
|
37
|
-
/**
|
|
38
|
-
* ID of the current instance of the component.
|
|
39
|
-
*/
|
|
40
|
-
id?: string
|
|
41
|
-
/**
|
|
42
|
-
* Specify which variant the component should handle.
|
|
43
|
-
*/
|
|
44
|
-
variant: Variant
|
|
45
|
-
/**
|
|
46
|
-
* SKU options that should be rendered.
|
|
47
|
-
*/
|
|
48
|
-
options: SkuProps[]
|
|
49
|
-
/**
|
|
50
|
-
* Section label for the SKU selector.
|
|
51
|
-
*/
|
|
52
|
-
label?: string
|
|
53
|
-
/**
|
|
54
|
-
* Currently active variation's value.
|
|
55
|
-
*/
|
|
56
|
-
activeValue: string
|
|
57
|
-
/**
|
|
58
|
-
* Function to be triggered when SKU option change.
|
|
59
|
-
*/
|
|
60
|
-
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const SkuSelector = forwardRef<HTMLDivElement, SkuSelectorProps>(
|
|
64
|
-
function SkuSelector(
|
|
65
|
-
{
|
|
66
|
-
id,
|
|
67
|
-
label,
|
|
68
|
-
variant,
|
|
69
|
-
onChange,
|
|
70
|
-
testId = 'store-sku-selector',
|
|
71
|
-
activeValue,
|
|
72
|
-
children,
|
|
73
|
-
...otherProps
|
|
74
|
-
},
|
|
75
|
-
ref
|
|
76
|
-
) {
|
|
77
|
-
const radioGroupId = id ? `-${id}` : ''
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<div
|
|
81
|
-
ref={ref}
|
|
82
|
-
data-fs-sku-selector
|
|
83
|
-
data-testid={testId}
|
|
84
|
-
data-fs-sku-selector-variant={variant}
|
|
85
|
-
{...otherProps}
|
|
86
|
-
>
|
|
87
|
-
{label && (
|
|
88
|
-
<Label data-fs-sku-selector-title>
|
|
89
|
-
{label}: <strong>{activeValue}</strong>
|
|
90
|
-
</Label>
|
|
91
|
-
)}
|
|
92
|
-
<RadioGroup
|
|
93
|
-
selectedValue={activeValue}
|
|
94
|
-
name={`sku-selector-${variant}${radioGroupId}`}
|
|
95
|
-
onChange={(e) => {
|
|
96
|
-
onChange?.(e)
|
|
97
|
-
}}
|
|
98
|
-
>
|
|
99
|
-
{children}
|
|
100
|
-
</RadioGroup>
|
|
101
|
-
</div>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
export default SkuSelector
|