@faststore/ui 2.0.49-alpha.0 → 2.0.52-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/components/molecules/SkuSelector/SkuSelector.js +1 -2
- package/dist/components/molecules/SkuSelector/SkuSelector.js.map +1 -1
- 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/Gift/styles.scss +92 -0
- package/src/components/molecules/SkuSelector/SkuSelector.tsx +1 -2
- package/src/index.ts +0 -20
- package/src/styles/components.scss +1 -0
- package/dist/components/molecules/Gift/Gift.d.ts +0 -15
- package/dist/components/molecules/Gift/Gift.js +0 -9
- package/dist/components/molecules/Gift/Gift.js.map +0 -1
- package/dist/components/molecules/Gift/GiftContent.d.ts +0 -10
- package/dist/components/molecules/Gift/GiftContent.js +0 -6
- package/dist/components/molecules/Gift/GiftContent.js.map +0 -1
- package/dist/components/molecules/Gift/GiftImage.d.ts +0 -10
- package/dist/components/molecules/Gift/GiftImage.js +0 -6
- package/dist/components/molecules/Gift/GiftImage.js.map +0 -1
- package/dist/components/molecules/Gift/index.d.ts +0 -6
- package/dist/components/molecules/Gift/index.js +0 -4
- package/dist/components/molecules/Gift/index.js.map +0 -1
- package/dist/components/molecules/RadioGroup/RadioGroup.d.ts +0 -5
- package/dist/components/molecules/RadioGroup/RadioGroup.js +0 -10
- package/dist/components/molecules/RadioGroup/RadioGroup.js.map +0 -1
- package/dist/components/molecules/RadioGroup/RadioOption.d.ts +0 -19
- package/dist/components/molecules/RadioGroup/RadioOption.js +0 -11
- package/dist/components/molecules/RadioGroup/RadioOption.js.map +0 -1
- package/dist/components/molecules/RadioGroup/index.d.ts +0 -4
- package/dist/components/molecules/RadioGroup/index.js +0 -3
- package/dist/components/molecules/RadioGroup/index.js.map +0 -1
- package/dist/components/molecules/RadioGroup/useRadioGroup.d.ts +0 -17
- package/dist/components/molecules/RadioGroup/useRadioGroup.js +0 -10
- package/dist/components/molecules/RadioGroup/useRadioGroup.js.map +0 -1
- package/src/components/molecules/Gift/Gift.tsx +0 -30
- package/src/components/molecules/Gift/GiftContent.tsx +0 -29
- package/src/components/molecules/Gift/GiftImage.tsx +0 -22
- package/src/components/molecules/Gift/index.tsx +0 -8
- package/src/components/molecules/RadioGroup/RadioGroup.tsx +0 -25
- package/src/components/molecules/RadioGroup/RadioOption.tsx +0 -49
- package/src/components/molecules/RadioGroup/index.tsx +0 -5
- package/src/components/molecules/RadioGroup/useRadioGroup.ts +0 -33
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Label } from '@faststore/components';
|
|
3
|
-
import RadioGroup from '../RadioGroup';
|
|
2
|
+
import { Label, RadioGroup } from '@faststore/components';
|
|
4
3
|
const SkuSelector = forwardRef(function SkuSelector({ id, label, variant, onChange, testId = 'store-sku-selector', activeValue, children, ...otherProps }, ref) {
|
|
5
4
|
const radioGroupId = id ? `-${id}` : '';
|
|
6
5
|
return (React.createElement("div", { ref: ref, "data-fs-sku-selector": true, "data-testid": testId, "data-fs-sku-selector-variant": variant, ...otherProps },
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export { default as Incentive } from './components/atoms/Incentive';
|
|
|
13
13
|
export type { IncentiveProps } from './components/atoms/Incentive';
|
|
14
14
|
export { default as SkuSelector } from './components/molecules/SkuSelector';
|
|
15
15
|
export type { SkuSelectorProps } from './components/molecules/SkuSelector';
|
|
16
|
-
export { default as Gift, GiftContent, GiftImage, } from './components/molecules/Gift';
|
|
17
|
-
export type { GiftProps, GiftContentProps, GiftImageProps, } from './components/molecules/Gift';
|
|
18
16
|
export { default as ProductTitle } from './components/molecules/ProductTitle';
|
|
19
17
|
export type { ProductTitleProps } from './components/molecules/ProductTitle';
|
|
20
18
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
@@ -43,8 +41,6 @@ export { default as LoadingButton } from './components/molecules/LoadingButton';
|
|
|
43
41
|
export type { LoadingButtonProps } from './components/molecules/LoadingButton';
|
|
44
42
|
export { default as PriceRange } from './components/molecules/PriceRange';
|
|
45
43
|
export type { PriceRangeProps } from './components/molecules/PriceRange';
|
|
46
|
-
export { default as RadioGroup, RadioOption, } from './components/molecules/RadioGroup';
|
|
47
|
-
export type { RadioGroupProps, RadioOptionProps, } from './components/molecules/RadioGroup';
|
|
48
44
|
export { default as Form } from './components/molecules/Form';
|
|
49
45
|
export type { FormProps } from './components/molecules/Form';
|
|
50
46
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,6 @@ export { default as Spinner } from './components/atoms/Spinner';
|
|
|
8
8
|
export { default as Incentive } from './components/atoms/Incentive';
|
|
9
9
|
// Molecules
|
|
10
10
|
export { default as SkuSelector } from './components/molecules/SkuSelector';
|
|
11
|
-
export { default as Gift, GiftContent, GiftImage, } from './components/molecules/Gift';
|
|
12
11
|
export { default as ProductTitle } from './components/molecules/ProductTitle';
|
|
13
12
|
export { default as OrderSummary } from './components/molecules/OrderSummary';
|
|
14
13
|
export { default as ProductCard, ProductCardImage, ProductCardContent, ProductCardActions, } from './components/molecules/ProductCard';
|
|
@@ -23,7 +22,6 @@ export { default as PaymentMethods } from './components/molecules/PaymentMethods
|
|
|
23
22
|
export { default as Breadcrumb } from './components/molecules/Breadcrumb';
|
|
24
23
|
export { default as LoadingButton } from './components/molecules/LoadingButton';
|
|
25
24
|
export { default as PriceRange } from './components/molecules/PriceRange';
|
|
26
|
-
export { default as RadioGroup, RadioOption, } from './components/molecules/RadioGroup';
|
|
27
25
|
export { default as Form } from './components/molecules/Form';
|
|
28
26
|
// Organisms
|
|
29
27
|
export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './components/organisms/OutOfStock';
|
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,
|
|
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,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,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.52-alpha.0",
|
|
4
4
|
"description": "A lightweight, framework agnostic component library for React",
|
|
5
5
|
"author": "emersonlaurentino",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"node": "16.18.0",
|
|
60
60
|
"yarn": "1.19.1"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "fe474595d374d91b69063e0b2ed6e56eee0c36d0"
|
|
63
63
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[data-fs-gift] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Gift
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
|
|
8
|
+
--fs-gift-height : var(--fs-spacing-12);
|
|
9
|
+
|
|
10
|
+
--fs-gift-border-width : var(--fs-border-width);
|
|
11
|
+
--fs-gift-border-color : var(--fs-border-color-light);
|
|
12
|
+
--fs-gift-border-radius : var(--fs-border-radius);
|
|
13
|
+
|
|
14
|
+
// Content
|
|
15
|
+
--fs-gift-content-padding : var(--fs-spacing-1) var(--fs-spacing-2);
|
|
16
|
+
--fs-gift-content-row-gap : var(--fs-spacing-0);
|
|
17
|
+
|
|
18
|
+
// Title
|
|
19
|
+
--fs-gift-title-line-height : 1.25;
|
|
20
|
+
--fs-gift-title-size : var(--fs-text-size-body);
|
|
21
|
+
--fs-gift-title-color : var(--fs-color-text);
|
|
22
|
+
|
|
23
|
+
// Icon
|
|
24
|
+
--fs-gift-icon-size : 1.75rem; // 28px
|
|
25
|
+
--fs-gift-icon-padding : var(--fs-spacing-0);
|
|
26
|
+
--fs-gift-icon-color : var(--fs-gift-title-color);
|
|
27
|
+
--fs-gift-icon-bkg-color : var(--fs-color-body-bkg);
|
|
28
|
+
|
|
29
|
+
// --------------------------------------------------------
|
|
30
|
+
// Structural Styles
|
|
31
|
+
// --------------------------------------------------------
|
|
32
|
+
|
|
33
|
+
position: relative;
|
|
34
|
+
|
|
35
|
+
[data-fs-gift-wrapper] {
|
|
36
|
+
display: grid;
|
|
37
|
+
grid-template-columns: var(--fs-gift-height) repeat(4, 1fr);
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
height: var(--fs-gift-height);
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
border: var(--fs-gift-border-width) solid var(--fs-gift-border-color);
|
|
42
|
+
border-radius: var(--fs-gift-border-radius);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
[data-fs-gift-image] {
|
|
46
|
+
height: 100%;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
|
|
49
|
+
img {
|
|
50
|
+
object-fit: cover;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
[data-fs-gift-content] {
|
|
57
|
+
display: grid;
|
|
58
|
+
grid-column: 2 / span 4;
|
|
59
|
+
row-gap: var(--fs-gift-content-row-gap);
|
|
60
|
+
padding: var(--fs-gift-content-padding);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-fs-gift-product-title] {
|
|
64
|
+
font-size: var(--fs-gift-title-size);
|
|
65
|
+
line-height: var(--fs-gift-title-line-height);
|
|
66
|
+
color: var(--fs-gift-title-color);
|
|
67
|
+
|
|
68
|
+
@include truncate-title;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-fs-gift-product-summary] {
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
|
|
75
|
+
[data-fs-badge] {
|
|
76
|
+
margin-left: var(--fs-spacing-1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[data-fs-gift-icon] {
|
|
81
|
+
position: absolute;
|
|
82
|
+
top: calc(-1 * var(--fs-gift-icon-size) / 2);
|
|
83
|
+
left: calc(-1 * var(--fs-gift-icon-size) / 2);
|
|
84
|
+
width: var(--fs-gift-icon-size);
|
|
85
|
+
height: var(--fs-gift-icon-size);
|
|
86
|
+
padding: var(--fs-gift-icon-padding);
|
|
87
|
+
color: var(--fs-gift-icon-color);
|
|
88
|
+
background-color: var(--fs-gift-icon-bkg-color);
|
|
89
|
+
border: var(--fs-gift-border-width) solid var(--fs-gift-border-color);
|
|
90
|
+
border-radius: var(--fs-border-radius-circle);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ChangeEventHandler, HTMLAttributes } from 'react'
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
|
-
import { Label } from '@faststore/components'
|
|
4
|
-
import RadioGroup from '../RadioGroup'
|
|
3
|
+
import { Label, RadioGroup } from '@faststore/components'
|
|
5
4
|
|
|
6
5
|
interface SkuProps {
|
|
7
6
|
/**
|
package/src/index.ts
CHANGED
|
@@ -23,17 +23,6 @@ export type { IncentiveProps } from './components/atoms/Incentive'
|
|
|
23
23
|
export { default as SkuSelector } from './components/molecules/SkuSelector'
|
|
24
24
|
export type { SkuSelectorProps } from './components/molecules/SkuSelector'
|
|
25
25
|
|
|
26
|
-
export {
|
|
27
|
-
default as Gift,
|
|
28
|
-
GiftContent,
|
|
29
|
-
GiftImage,
|
|
30
|
-
} from './components/molecules/Gift'
|
|
31
|
-
export type {
|
|
32
|
-
GiftProps,
|
|
33
|
-
GiftContentProps,
|
|
34
|
-
GiftImageProps,
|
|
35
|
-
} from './components/molecules/Gift'
|
|
36
|
-
|
|
37
26
|
export { default as ProductTitle } from './components/molecules/ProductTitle'
|
|
38
27
|
export type { ProductTitleProps } from './components/molecules/ProductTitle'
|
|
39
28
|
|
|
@@ -125,15 +114,6 @@ export type { LoadingButtonProps } from './components/molecules/LoadingButton'
|
|
|
125
114
|
export { default as PriceRange } from './components/molecules/PriceRange'
|
|
126
115
|
export type { PriceRangeProps } from './components/molecules/PriceRange'
|
|
127
116
|
|
|
128
|
-
export {
|
|
129
|
-
default as RadioGroup,
|
|
130
|
-
RadioOption,
|
|
131
|
-
} from './components/molecules/RadioGroup'
|
|
132
|
-
export type {
|
|
133
|
-
RadioGroupProps,
|
|
134
|
-
RadioOptionProps,
|
|
135
|
-
} from './components/molecules/RadioGroup'
|
|
136
|
-
|
|
137
117
|
export { default as Form } from './components/molecules/Form'
|
|
138
118
|
export type { FormProps } from './components/molecules/Form'
|
|
139
119
|
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
@import "../components/molecules/CheckboxField/styles";
|
|
20
20
|
@import "../components/molecules/DiscountBadge/styles";
|
|
21
21
|
@import "../components/molecules/Dropdown/styles";
|
|
22
|
+
@import "../components/molecules/Gift/styles";
|
|
22
23
|
@import "../components/molecules/InputField/styles";
|
|
23
24
|
@import "../components/molecules/LinkButton/styles";
|
|
24
25
|
@import "../components/molecules/QuantitySelector/styles";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface GiftProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
5
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
6
|
-
* testing-library, and jest).
|
|
7
|
-
*/
|
|
8
|
-
testId?: string;
|
|
9
|
-
/**
|
|
10
|
-
* A React component that will be rendered as an icon.
|
|
11
|
-
*/
|
|
12
|
-
icon?: ReactNode;
|
|
13
|
-
}
|
|
14
|
-
declare const Gift: React.ForwardRefExoticComponent<GiftProps & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
export default Gift;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Icon } from '@faststore/components';
|
|
3
|
-
const Gift = forwardRef(function Gift({ icon, testId = 'store-gift', children, ...otherProps }, ref) {
|
|
4
|
-
return (React.createElement("div", { ref: ref, "data-fs-gift": true, "data-testid": testId, ...otherProps },
|
|
5
|
-
icon && React.createElement(Icon, { component: icon, "data-fs-gift-icon": true }),
|
|
6
|
-
React.createElement("div", { "data-fs-gift-wrapper": true }, children)));
|
|
7
|
-
});
|
|
8
|
-
export default Gift;
|
|
9
|
-
//# sourceMappingURL=Gift.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Gift.js","sourceRoot":"","sources":["../../../../src/components/molecules/Gift/Gift.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAc5C,MAAM,IAAI,GAAG,UAAU,CAA4B,SAAS,IAAI,CAC9D,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACxD,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,uCAA4B,MAAM,KAAM,UAAU;QAC5D,IAAI,IAAI,oBAAC,IAAI,IAAC,SAAS,EAAE,IAAI,8BAAsB;QACpD,6DAA2B,QAAQ,CAAO,CACtC,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,IAAI,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface GiftContentProps extends HTMLAttributes<HTMLElement> {
|
|
4
|
-
/**
|
|
5
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
-
*/
|
|
7
|
-
testId?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const GiftContent: React.ForwardRefExoticComponent<GiftContentProps & React.RefAttributes<HTMLElement>>;
|
|
10
|
-
export default GiftContent;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
const GiftContent = forwardRef(function GiftContent({ testId = 'store-gift-content', children, ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("section", { ref: ref, "data-fs-gift-content": true, "data-testid": testId, ...otherProps }, children));
|
|
4
|
-
});
|
|
5
|
-
export default GiftContent;
|
|
6
|
-
//# sourceMappingURL=GiftContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GiftContent.js","sourceRoot":"","sources":["../../../../src/components/molecules/Gift/GiftContent.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EAAE,MAAM,GAAG,oBAAoB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EAC1D,GAAG;IAEH,OAAO,CACL,iCACE,GAAG,EAAE,GAAG,+CAEK,MAAM,KACf,UAAU,IAEb,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface GiftImageProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/**
|
|
5
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
6
|
-
*/
|
|
7
|
-
testId?: string;
|
|
8
|
-
}
|
|
9
|
-
declare const GiftImage: React.ForwardRefExoticComponent<GiftImageProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
-
export default GiftImage;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
const GiftImage = forwardRef(function GiftImage({ testId = 'store-gift-image', children, ...otherProps }, ref) {
|
|
3
|
-
return (React.createElement("div", { ref: ref, "data-fs-gift-image": true, "data-testid": testId, ...otherProps }, children));
|
|
4
|
-
});
|
|
5
|
-
export default GiftImage;
|
|
6
|
-
//# sourceMappingURL=GiftImage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GiftImage.js","sourceRoot":"","sources":["../../../../src/components/molecules/Gift/GiftImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CAC7E,EAAE,MAAM,GAAG,kBAAkB,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,EACxD,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,6CAAkC,MAAM,KAAM,UAAU,IAClE,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,SAAS,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default } from './Gift';
|
|
2
|
-
export type { GiftProps } from './Gift';
|
|
3
|
-
export { default as GiftContent } from './GiftContent';
|
|
4
|
-
export type { GiftContentProps } from './GiftContent';
|
|
5
|
-
export { default as GiftImage } from './GiftImage';
|
|
6
|
-
export type { GiftImageProps } from './GiftImage';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/Gift/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAGhC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA;AAGtD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react';
|
|
2
|
-
import { RadioGroupContext } from './useRadioGroup';
|
|
3
|
-
export type RadioGroupProps = PropsWithChildren<RadioGroupContext>;
|
|
4
|
-
declare const RadioGroup: ({ name, onChange, children, selectedValue, }: RadioGroupProps) => JSX.Element;
|
|
5
|
-
export default RadioGroup;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { RadioGroupContext } from './useRadioGroup';
|
|
3
|
-
const RadioGroup = ({ name, onChange, children, selectedValue, }) => {
|
|
4
|
-
const contextValues = React.useMemo(() => {
|
|
5
|
-
return { name, selectedValue, onChange };
|
|
6
|
-
}, [name, selectedValue, onChange]);
|
|
7
|
-
return (React.createElement(RadioGroupContext.Provider, { value: contextValues }, children));
|
|
8
|
-
};
|
|
9
|
-
export default RadioGroup;
|
|
10
|
-
//# sourceMappingURL=RadioGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.js","sourceRoot":"","sources":["../../../../src/components/molecules/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAInD,MAAM,UAAU,GAAG,CAAC,EAClB,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,aAAa,GACG,EAAE,EAAE;IACpB,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACvC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;IAC1C,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAA;IAEnC,OAAO,CACL,oBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,IAC7C,QAAQ,CACkB,CAC9B,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface RadioOptionProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
4
|
-
/**
|
|
5
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
6
|
-
* testing-library, and jest).
|
|
7
|
-
*/
|
|
8
|
-
testId?: string;
|
|
9
|
-
/**
|
|
10
|
-
* Attribute to set aria-label option as required.
|
|
11
|
-
*/
|
|
12
|
-
label: string;
|
|
13
|
-
/**
|
|
14
|
-
* Value to be emitted when radio is clicked.
|
|
15
|
-
*/
|
|
16
|
-
value: string | number;
|
|
17
|
-
}
|
|
18
|
-
declare const RadioOption: React.ForwardRefExoticComponent<RadioOptionProps & React.RefAttributes<HTMLInputElement>>;
|
|
19
|
-
export default RadioOption;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react';
|
|
2
|
-
import { Radio } from '@faststore/components';
|
|
3
|
-
import { useRadioGroup } from './useRadioGroup';
|
|
4
|
-
const RadioOption = forwardRef(function RadioOption({ label, value, children, testId = 'store-radio-option', ...otherProps }, ref) {
|
|
5
|
-
const { name, selectedValue, onChange } = useRadioGroup();
|
|
6
|
-
return (React.createElement("label", { "aria-label": label, "data-fs-radio-option": true },
|
|
7
|
-
React.createElement(Radio, { "data-fs-radio-option-item": true, ref: ref, name: name, checked: value === selectedValue, onChange: onChange, value: value, testId: testId, ...otherProps }),
|
|
8
|
-
children));
|
|
9
|
-
});
|
|
10
|
-
export default RadioOption;
|
|
11
|
-
//# sourceMappingURL=RadioOption.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RadioOption.js","sourceRoot":"","sources":["../../../../src/components/molecules/RadioGroup/RadioOption.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAmB/C,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,EAAE,GAAG,UAAU,EAAE,EACxE,GAAG;IAEH,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,CAAA;IAEzD,OAAO,CACL,6CAAmB,KAAK;QACtB,oBAAC,KAAK,uCAEJ,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,KAAK,KAAK,aAAa,EAChC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,KACV,UAAU,GACd;QACD,QAAQ,CACH,CACT,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/molecules/RadioGroup/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ChangeEventHandler } from 'react';
|
|
2
|
-
export interface RadioGroupContext {
|
|
3
|
-
/**
|
|
4
|
-
* Name to link children by context.
|
|
5
|
-
*/
|
|
6
|
-
name: string;
|
|
7
|
-
/**
|
|
8
|
-
* Value of checked child.
|
|
9
|
-
*/
|
|
10
|
-
selectedValue?: string | number;
|
|
11
|
-
/**
|
|
12
|
-
* Function that is triggered when any children is checked.
|
|
13
|
-
*/
|
|
14
|
-
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
15
|
-
}
|
|
16
|
-
export declare const RadioGroupContext: import("react").Context<RadioGroupContext | undefined>;
|
|
17
|
-
export declare function useRadioGroup(): RadioGroupContext;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
export const RadioGroupContext = createContext(undefined);
|
|
3
|
-
export function useRadioGroup() {
|
|
4
|
-
const context = useContext(RadioGroupContext);
|
|
5
|
-
if (!context) {
|
|
6
|
-
throw new Error(`useRadioOption hook cannot be used outside the RadioGroup context`);
|
|
7
|
-
}
|
|
8
|
-
return context;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=useRadioGroup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useRadioGroup.js","sourceRoot":"","sources":["../../../../src/components/molecules/RadioGroup/useRadioGroup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAiBjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAC5C,SAAS,CACV,CAAA;AAED,MAAM,UAAU,aAAa;IAC3B,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAE7C,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAA;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes, ReactNode } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Icon } from '@faststore/components'
|
|
5
|
-
|
|
6
|
-
export interface GiftProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
|
-
/**
|
|
8
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
9
|
-
* testing-library, and jest).
|
|
10
|
-
*/
|
|
11
|
-
testId?: string
|
|
12
|
-
/**
|
|
13
|
-
* A React component that will be rendered as an icon.
|
|
14
|
-
*/
|
|
15
|
-
icon?: ReactNode
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Gift = forwardRef<HTMLDivElement, GiftProps>(function Gift(
|
|
19
|
-
{ icon, testId = 'store-gift', children, ...otherProps },
|
|
20
|
-
ref
|
|
21
|
-
) {
|
|
22
|
-
return (
|
|
23
|
-
<div ref={ref} data-fs-gift data-testid={testId} {...otherProps}>
|
|
24
|
-
{icon && <Icon component={icon} data-fs-gift-icon />}
|
|
25
|
-
<div data-fs-gift-wrapper>{children}</div>
|
|
26
|
-
</div>
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
export default Gift
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface GiftContentProps extends HTMLAttributes<HTMLElement> {
|
|
5
|
-
/**
|
|
6
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
-
*/
|
|
8
|
-
testId?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const GiftContent = forwardRef<HTMLElement, GiftContentProps>(
|
|
12
|
-
function GiftContent(
|
|
13
|
-
{ testId = 'store-gift-content', children, ...otherProps },
|
|
14
|
-
ref
|
|
15
|
-
) {
|
|
16
|
-
return (
|
|
17
|
-
<section
|
|
18
|
-
ref={ref}
|
|
19
|
-
data-fs-gift-content
|
|
20
|
-
data-testid={testId}
|
|
21
|
-
{...otherProps}
|
|
22
|
-
>
|
|
23
|
-
{children}
|
|
24
|
-
</section>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
export default GiftContent
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { HTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface GiftImageProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
/**
|
|
6
|
-
* ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
|
|
7
|
-
*/
|
|
8
|
-
testId?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const GiftImage = forwardRef<HTMLDivElement, GiftImageProps>(function GiftImage(
|
|
12
|
-
{ testId = 'store-gift-image', children, ...otherProps },
|
|
13
|
-
ref
|
|
14
|
-
) {
|
|
15
|
-
return (
|
|
16
|
-
<div ref={ref} data-fs-gift-image data-testid={testId} {...otherProps}>
|
|
17
|
-
{children}
|
|
18
|
-
</div>
|
|
19
|
-
)
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
export default GiftImage
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default } from './Gift'
|
|
2
|
-
export type { GiftProps } from './Gift'
|
|
3
|
-
|
|
4
|
-
export { default as GiftContent } from './GiftContent'
|
|
5
|
-
export type { GiftContentProps } from './GiftContent'
|
|
6
|
-
|
|
7
|
-
export { default as GiftImage } from './GiftImage'
|
|
8
|
-
export type { GiftImageProps } from './GiftImage'
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
import { RadioGroupContext } from './useRadioGroup'
|
|
5
|
-
|
|
6
|
-
export type RadioGroupProps = PropsWithChildren<RadioGroupContext>
|
|
7
|
-
|
|
8
|
-
const RadioGroup = ({
|
|
9
|
-
name,
|
|
10
|
-
onChange,
|
|
11
|
-
children,
|
|
12
|
-
selectedValue,
|
|
13
|
-
}: RadioGroupProps) => {
|
|
14
|
-
const contextValues = React.useMemo(() => {
|
|
15
|
-
return { name, selectedValue, onChange }
|
|
16
|
-
}, [name, selectedValue, onChange])
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<RadioGroupContext.Provider value={contextValues}>
|
|
20
|
-
{children}
|
|
21
|
-
</RadioGroupContext.Provider>
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default RadioGroup
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { InputHTMLAttributes } from 'react'
|
|
2
|
-
import React, { forwardRef } from 'react'
|
|
3
|
-
|
|
4
|
-
import { Radio } from '@faststore/components'
|
|
5
|
-
import { useRadioGroup } from './useRadioGroup'
|
|
6
|
-
|
|
7
|
-
export interface RadioOptionProps
|
|
8
|
-
extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
9
|
-
/**
|
|
10
|
-
* ID to find this component in testing tools (e.g.: cypress,
|
|
11
|
-
* testing-library, and jest).
|
|
12
|
-
*/
|
|
13
|
-
testId?: string
|
|
14
|
-
/**
|
|
15
|
-
* Attribute to set aria-label option as required.
|
|
16
|
-
*/
|
|
17
|
-
label: string
|
|
18
|
-
/**
|
|
19
|
-
* Value to be emitted when radio is clicked.
|
|
20
|
-
*/
|
|
21
|
-
value: string | number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const RadioOption = forwardRef<HTMLInputElement, RadioOptionProps>(
|
|
25
|
-
function RadioOption(
|
|
26
|
-
{ label, value, children, testId = 'store-radio-option', ...otherProps },
|
|
27
|
-
ref
|
|
28
|
-
) {
|
|
29
|
-
const { name, selectedValue, onChange } = useRadioGroup()
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<label aria-label={label} data-fs-radio-option>
|
|
33
|
-
<Radio
|
|
34
|
-
data-fs-radio-option-item
|
|
35
|
-
ref={ref}
|
|
36
|
-
name={name}
|
|
37
|
-
checked={value === selectedValue}
|
|
38
|
-
onChange={onChange}
|
|
39
|
-
value={value}
|
|
40
|
-
testId={testId}
|
|
41
|
-
{...otherProps}
|
|
42
|
-
/>
|
|
43
|
-
{children}
|
|
44
|
-
</label>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
|
|
49
|
-
export default RadioOption
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ChangeEventHandler } from 'react'
|
|
2
|
-
import { createContext, useContext } from 'react'
|
|
3
|
-
|
|
4
|
-
export interface RadioGroupContext {
|
|
5
|
-
/**
|
|
6
|
-
* Name to link children by context.
|
|
7
|
-
*/
|
|
8
|
-
name: string
|
|
9
|
-
/**
|
|
10
|
-
* Value of checked child.
|
|
11
|
-
*/
|
|
12
|
-
selectedValue?: string | number
|
|
13
|
-
/**
|
|
14
|
-
* Function that is triggered when any children is checked.
|
|
15
|
-
*/
|
|
16
|
-
onChange?: ChangeEventHandler<HTMLInputElement>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const RadioGroupContext = createContext<RadioGroupContext | undefined>(
|
|
20
|
-
undefined
|
|
21
|
-
)
|
|
22
|
-
|
|
23
|
-
export function useRadioGroup() {
|
|
24
|
-
const context = useContext(RadioGroupContext)
|
|
25
|
-
|
|
26
|
-
if (!context) {
|
|
27
|
-
throw new Error(
|
|
28
|
-
`useRadioOption hook cannot be used outside the RadioGroup context`
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return context
|
|
33
|
-
}
|