@popsure/dirty-swan 0.41.14 → 0.41.16
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/cjs/index.js +9 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/input/radio/index.d.ts +2 -1
- package/dist/cjs/lib/components/input/radio/index.stories.d.ts +11 -7
- package/dist/cjs/lib/components/toast/index.d.ts +7 -1
- package/dist/cjs/lib/components/toast/index.stories.d.ts +12 -2
- package/dist/esm/components/input/radio/index.js +3 -3
- package/dist/esm/components/input/radio/index.js.map +1 -1
- package/dist/esm/components/input/radio/index.stories.js +32 -28
- package/dist/esm/components/input/radio/index.stories.js.map +1 -1
- package/dist/esm/components/input/radio/index.test.js +14 -0
- package/dist/esm/components/input/radio/index.test.js.map +1 -1
- package/dist/esm/components/toast/index.js +1 -1
- package/dist/esm/components/toast/index.stories.js +15 -5
- package/dist/esm/components/toast/index.stories.js.map +1 -1
- package/dist/esm/components/toast/index.test.js +1 -1
- package/dist/esm/{index-2c193605.js → index-d81b8748.js} +7 -4
- package/dist/esm/index-d81b8748.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/lib/components/input/radio/index.d.ts +2 -1
- package/dist/esm/lib/components/input/radio/index.stories.d.ts +11 -7
- package/dist/esm/lib/components/toast/index.d.ts +7 -1
- package/dist/esm/lib/components/toast/index.stories.d.ts +12 -2
- package/dist/index.css +8 -0
- package/dist/index.css.map +1 -1
- package/dist/lib/scss/private/components/_input.scss +12 -1
- package/package.json +1 -1
- package/src/lib/components/input/radio/index.stories.tsx +101 -76
- package/src/lib/components/input/radio/index.test.tsx +19 -0
- package/src/lib/components/input/radio/index.tsx +6 -3
- package/src/lib/components/toast/index.stories.tsx +23 -6
- package/src/lib/components/toast/index.tsx +10 -2
- package/src/lib/scss/private/components/_input.scss +12 -1
- package/dist/esm/index-2c193605.js.map +0 -1
|
@@ -18,5 +18,6 @@ export interface RadioProps<ValueType extends string> {
|
|
|
18
18
|
option?: string;
|
|
19
19
|
};
|
|
20
20
|
bordered?: boolean;
|
|
21
|
+
disabled?: boolean;
|
|
21
22
|
}
|
|
22
|
-
export declare const Radio: <ValueType extends string>({ options, value, onChange, wide, inlineLayout, inlineIcon, classNames: classNamesObj, bordered, }: RadioProps<ValueType>) => JSX.Element;
|
|
23
|
+
export declare const Radio: <ValueType extends string>({ options, value, onChange, wide, inlineLayout, inlineIcon, classNames: classNamesObj, bordered, disabled, }: RadioProps<ValueType>) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RadioProps } from '.';
|
|
2
2
|
declare const story: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: <ValueType extends string>({ options, value, onChange, wide, inlineLayout, inlineIcon, classNames: classNamesObj, bordered, }: RadioProps<ValueType>) => JSX.Element;
|
|
4
|
+
component: <ValueType extends string>({ options, value, onChange, wide, inlineLayout, inlineIcon, classNames: classNamesObj, bordered, disabled, }: RadioProps<ValueType>) => JSX.Element;
|
|
5
5
|
argTypes: {
|
|
6
6
|
options: {
|
|
7
7
|
description: string;
|
|
@@ -50,17 +50,21 @@ declare const story: {
|
|
|
50
50
|
description: string;
|
|
51
51
|
defaultValue: boolean;
|
|
52
52
|
};
|
|
53
|
+
disabled: {
|
|
54
|
+
description: string;
|
|
55
|
+
defaultValue: boolean;
|
|
56
|
+
};
|
|
53
57
|
};
|
|
54
58
|
};
|
|
55
59
|
export declare const RadioStory: {
|
|
56
|
-
({ onChange, options, wide, classNames, inlineLayout, bordered, }: RadioProps<string>): JSX.Element;
|
|
60
|
+
({ onChange, options, wide, classNames, inlineLayout, bordered, disabled, }: RadioProps<string>): JSX.Element;
|
|
57
61
|
storyName: string;
|
|
58
62
|
};
|
|
59
|
-
export declare const RadioWithCustomWrapperStyles: ({ onChange }: RadioProps<string>) => JSX.Element;
|
|
60
|
-
export declare const RadioWithCustomOptionStyles: ({ onChange }: RadioProps<string>) => JSX.Element;
|
|
61
|
-
export declare const RadioWithCustomLabelStyles: ({ onChange }: RadioProps<string>) => JSX.Element;
|
|
63
|
+
export declare const RadioWithCustomWrapperStyles: ({ onChange, }: RadioProps<string>) => JSX.Element;
|
|
64
|
+
export declare const RadioWithCustomOptionStyles: ({ onChange, }: RadioProps<string>) => JSX.Element;
|
|
65
|
+
export declare const RadioWithCustomLabelStyles: ({ onChange, }: RadioProps<string>) => JSX.Element;
|
|
62
66
|
export declare const RadioWithInlineLayout: ({ onChange }: RadioProps<string>) => JSX.Element;
|
|
63
|
-
export declare const RadioWithCustomLabel: ({ onChange, wide, classNames, inlineLayout }: RadioProps<string>) => JSX.Element;
|
|
64
|
-
export declare const RadioWithCustomLabelInline: ({ onChange, wide, classNames, inlineLayout }: RadioProps<string>) => JSX.Element;
|
|
67
|
+
export declare const RadioWithCustomLabel: ({ onChange, wide, classNames, inlineLayout, }: RadioProps<string>) => JSX.Element;
|
|
68
|
+
export declare const RadioWithCustomLabelInline: ({ onChange, wide, classNames, inlineLayout, }: RadioProps<string>) => JSX.Element;
|
|
65
69
|
export declare const RadioIconOnly: ({ onChange }: RadioProps<string>) => JSX.Element;
|
|
66
70
|
export default story;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
export interface ToasterProps {
|
|
3
|
+
classNames?: {
|
|
4
|
+
wrapper?: string;
|
|
5
|
+
toast?: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
2
8
|
export declare type ToastType = 'warning' | 'error' | 'success' | 'information';
|
|
3
9
|
export interface ToastOptions {
|
|
4
10
|
type?: ToastType;
|
|
@@ -13,7 +19,7 @@ export interface ToastProps extends ToastOptions {
|
|
|
13
19
|
onDismiss: () => void;
|
|
14
20
|
title: string;
|
|
15
21
|
}
|
|
16
|
-
declare const Toaster: () => JSX.Element;
|
|
22
|
+
declare const Toaster: ({ classNames: toasterClassNames }: ToasterProps) => JSX.Element;
|
|
17
23
|
declare const Toast: ({ action, description, onDismiss, title, type }: ToastProps) => JSX.Element;
|
|
18
24
|
declare const toast: (title: string, { duration, ...toastOptions }: ToastOptions) => string;
|
|
19
25
|
export { Toaster, Toast, toast };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToastProps } from '.';
|
|
1
|
+
import { ToasterProps, ToastProps } from '.';
|
|
2
2
|
declare const story: {
|
|
3
3
|
title: string;
|
|
4
4
|
component: ({ action, description, onDismiss, title, type }: ToastProps) => JSX.Element;
|
|
@@ -28,6 +28,12 @@ declare const story: {
|
|
|
28
28
|
disable: boolean;
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
+
classNames: {
|
|
32
|
+
description: string;
|
|
33
|
+
table: {
|
|
34
|
+
category: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
31
37
|
};
|
|
32
38
|
args: {
|
|
33
39
|
title: string;
|
|
@@ -38,10 +44,14 @@ declare const story: {
|
|
|
38
44
|
};
|
|
39
45
|
type: string;
|
|
40
46
|
duration: number;
|
|
47
|
+
classNames: {
|
|
48
|
+
toast: string;
|
|
49
|
+
wrapper: string;
|
|
50
|
+
};
|
|
41
51
|
};
|
|
42
52
|
};
|
|
43
53
|
export declare const ToastStory: {
|
|
44
|
-
({ title, description, action, type, duration }: ToastProps): JSX.Element;
|
|
54
|
+
({ title, description, action, type, duration, classNames: toasterClassNames }: ToastProps & ToasterProps): JSX.Element;
|
|
45
55
|
storyName: string;
|
|
46
56
|
};
|
|
47
57
|
export declare const ToastTypes: (props: ToastProps) => JSX.Element;
|
|
@@ -9,7 +9,7 @@ styleInject(css_248z);
|
|
|
9
9
|
|
|
10
10
|
var Radio = function (_a) {
|
|
11
11
|
var _b;
|
|
12
|
-
var options = _a.options, value = _a.value, onChange = _a.onChange, _c = _a.wide, wide = _c === void 0 ? false : _c, _d = _a.inlineLayout, inlineLayout = _d === void 0 ? false : _d, _e = _a.inlineIcon, inlineIcon = _e === void 0 ? false : _e, classNamesObj = _a.classNames, _f = _a.bordered, bordered = _f === void 0 ? true : _f;
|
|
12
|
+
var options = _a.options, value = _a.value, onChange = _a.onChange, _c = _a.wide, wide = _c === void 0 ? false : _c, _d = _a.inlineLayout, inlineLayout = _d === void 0 ? false : _d, _e = _a.inlineIcon, inlineIcon = _e === void 0 ? false : _e, classNamesObj = _a.classNames, _f = _a.bordered, bordered = _f === void 0 ? true : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g;
|
|
13
13
|
var entries = Object.entries(options);
|
|
14
14
|
return (jsx("div", __assign({ className: classNames(classNamesObj === null || classNamesObj === void 0 ? void 0 : classNamesObj.container, styles.container, 'd-flex gap8', (_b = {},
|
|
15
15
|
_b[styles.wide] = wide,
|
|
@@ -29,12 +29,12 @@ var Radio = function (_a) {
|
|
|
29
29
|
return (jsxs("div", __assign({ className: classNamesObj === null || classNamesObj === void 0 ? void 0 : classNamesObj.option }, { children: [jsx("input", { className: classNames('p-radio', {
|
|
30
30
|
'p-radio--no-icon': customIcon || hideIcon,
|
|
31
31
|
'p-radio--centered': !label,
|
|
32
|
-
}), id: currentValue, type: "radio", value: currentValue, onChange: function () { return onChange(currentValue); }, checked: checked, "data-testid": "radio-input-" + currentValue }, void 0),
|
|
32
|
+
}), id: currentValue, type: "radio", value: currentValue, onChange: function () { return onChange(currentValue); }, checked: checked, "data-testid": "radio-input-" + currentValue, disabled: disabled }, void 0),
|
|
33
33
|
jsxs("label", __assign({ htmlFor: currentValue, className: classNames(classNamesObj === null || classNamesObj === void 0 ? void 0 : classNamesObj.label, 'p-label', {
|
|
34
34
|
'jc-center': customIcon && !inlineIcon,
|
|
35
35
|
'fd-column': customIcon && !inlineIcon,
|
|
36
36
|
'p-label--bordered': bordered,
|
|
37
|
-
}), "data-cy": "radio-" + currentValue, "data-testid": "radio-" + currentValue }, { children: [customIcon && (jsx("div", __assign({ className: classNames(
|
|
37
|
+
}), "data-cy": "radio-" + currentValue, "data-testid": "radio-" + currentValue }, { children: [customIcon && (jsx("div", __assign({ className: classNames('d-inline-flex ai-center jc-center', inlineIcon ? 'mr8' : 'mt8') }, { children: customIcon === null || customIcon === void 0 ? void 0 : customIcon(checked) }), void 0)),
|
|
38
38
|
isRadioLabelObject(label) ? (jsxs("div", { children: [jsx("p", __assign({ className: "p-p" }, { children: label.title }), void 0),
|
|
39
39
|
jsx("span", __assign({ className: "d-block p-p p-p--small tc-grey-600" }, { children: label.description }), void 0)] }, void 0)) : (label)] }), void 0)] }), currentValue));
|
|
40
40
|
}) }), void 0));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/input/radio/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ReactNode } from 'react';\n\nimport styles from './styles.module.scss';\nexport interface RadioWithDescription {\n title: ReactNode;\n description?: string;\n icon?: (selected: boolean) => ReactNode;\n hideBox?: boolean;\n}\n\nexport interface RadioProps<ValueType extends string> {\n options: Record<ValueType, ReactNode | RadioWithDescription>;\n value?: ValueType;\n onChange: (value: ValueType) => void;\n wide?: boolean;\n inlineLayout?: boolean;\n inlineIcon?: boolean;\n classNames?: {\n container?: string;\n label?: string;\n option?: string;\n };\n bordered?: boolean;\n}\n\nexport const Radio = <ValueType extends string>({\n options,\n value,\n onChange,\n wide = false,\n inlineLayout = false,\n inlineIcon = false,\n classNames: classNamesObj,\n bordered = true,\n}: RadioProps<ValueType>) => {\n const entries = Object.entries(options) as [\n ValueType,\n ReactNode | RadioWithDescription\n ][];\n\n return (\n <div\n className={classNames(\n classNamesObj?.container,\n styles.container,\n 'd-flex gap8',\n {\n [styles.wide]: wide,\n [styles.narrow]: !wide,\n 'fd-row': inlineLayout,\n 'f-wrap': inlineLayout,\n 'fd-column': !inlineLayout,\n }\n )}\n >\n {entries.map(([currentValue, label]) => {\n const checked = value === currentValue;\n const customIcon = (label as RadioWithDescription)?.icon;\n const hideIcon = (label as RadioWithDescription)?.hideBox;\n\n const isRadioLabelObject = (\n label: ReactNode | RadioWithDescription\n ): label is RadioWithDescription => {\n return (label as RadioWithDescription).title !== undefined;\n };\n\n return (\n <div className={classNamesObj?.option} key={currentValue}>\n <input\n className={classNames('p-radio', {\n 'p-radio--no-icon': customIcon || hideIcon,\n 'p-radio--centered': !label,\n })}\n id={currentValue}\n type=\"radio\"\n value={currentValue}\n onChange={() => onChange(currentValue)}\n checked={checked}\n data-testid={`radio-input-${currentValue}`}\n />\n\n <label\n htmlFor={currentValue}\n className={classNames(classNamesObj?.label, 'p-label', {\n 'jc-center': customIcon && !inlineIcon,\n 'fd-column': customIcon && !inlineIcon,\n 'p-label--bordered': bordered,\n })}\n data-cy={`radio-${currentValue}`}\n data-testid={`radio-${currentValue}`}\n >\n {customIcon && (\n <div
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/input/radio/index.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport { ReactNode } from 'react';\n\nimport styles from './styles.module.scss';\nexport interface RadioWithDescription {\n title: ReactNode;\n description?: string;\n icon?: (selected: boolean) => ReactNode;\n hideBox?: boolean;\n}\n\nexport interface RadioProps<ValueType extends string> {\n options: Record<ValueType, ReactNode | RadioWithDescription>;\n value?: ValueType;\n onChange: (value: ValueType) => void;\n wide?: boolean;\n inlineLayout?: boolean;\n inlineIcon?: boolean;\n classNames?: {\n container?: string;\n label?: string;\n option?: string;\n };\n bordered?: boolean;\n disabled?: boolean;\n}\n\nexport const Radio = <ValueType extends string>({\n options,\n value,\n onChange,\n wide = false,\n inlineLayout = false,\n inlineIcon = false,\n classNames: classNamesObj,\n bordered = true,\n disabled = false,\n}: RadioProps<ValueType>) => {\n const entries = Object.entries(options) as [\n ValueType,\n ReactNode | RadioWithDescription\n ][];\n\n return (\n <div\n className={classNames(\n classNamesObj?.container,\n styles.container,\n 'd-flex gap8',\n {\n [styles.wide]: wide,\n [styles.narrow]: !wide,\n 'fd-row': inlineLayout,\n 'f-wrap': inlineLayout,\n 'fd-column': !inlineLayout,\n }\n )}\n >\n {entries.map(([currentValue, label]) => {\n const checked = value === currentValue;\n const customIcon = (label as RadioWithDescription)?.icon;\n const hideIcon = (label as RadioWithDescription)?.hideBox;\n\n const isRadioLabelObject = (\n label: ReactNode | RadioWithDescription\n ): label is RadioWithDescription => {\n return (label as RadioWithDescription).title !== undefined;\n };\n\n return (\n <div className={classNamesObj?.option} key={currentValue}>\n <input\n className={classNames('p-radio', {\n 'p-radio--no-icon': customIcon || hideIcon,\n 'p-radio--centered': !label,\n })}\n id={currentValue}\n type=\"radio\"\n value={currentValue}\n onChange={() => onChange(currentValue)}\n checked={checked}\n data-testid={`radio-input-${currentValue}`}\n disabled={disabled}\n />\n\n <label\n htmlFor={currentValue}\n className={classNames(classNamesObj?.label, 'p-label', {\n 'jc-center': customIcon && !inlineIcon,\n 'fd-column': customIcon && !inlineIcon,\n 'p-label--bordered': bordered,\n })}\n data-cy={`radio-${currentValue}`}\n data-testid={`radio-${currentValue}`}\n >\n {customIcon && (\n <div\n className={classNames(\n 'd-inline-flex ai-center jc-center',\n inlineIcon ? 'mr8' : 'mt8'\n )}\n >\n {customIcon?.(checked)}\n </div>\n )}\n\n {isRadioLabelObject(label) ? (\n <div>\n <p className=\"p-p\">{label.title}</p>\n <span className=\"d-block p-p p-p--small tc-grey-600\">\n {label.description}\n </span>\n </div>\n ) : (\n label\n )}\n </label>\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;IA2Ba,KAAK,GAAG,UAA2B,EAUxB;;QATtB,OAAO,aAAA,EACP,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,YAAY,EAAZ,IAAI,mBAAG,KAAK,KAAA,EACZ,oBAAoB,EAApB,YAAY,mBAAG,KAAK,KAAA,EACpB,kBAAkB,EAAlB,UAAU,mBAAG,KAAK,KAAA,EACN,aAAa,gBAAA,EACzB,gBAAe,EAAf,QAAQ,mBAAG,IAAI,KAAA,EACf,gBAAgB,EAAhB,QAAQ,mBAAG,KAAK,KAAA;IAEhB,IAAM,OAAO,GAAG,MAAM,C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S,EAAE;4BACrD,WAAW,EAAE,UAAU,IAAI,CAAC,UAAU;4BACtC,WAAW,EAAE,UAAU,IAAI,CAAC,UAAU;4BACtC,mBAAmB,EAAE,QAAQ;yBAC9B,CAAC,aACO,WAAS,YAAc,iBACnB,WAAS,YAAc,iBAEnC,UAAU,KACTD,sBACE,SAAS,EAAE,UAAU,CACnB,mCAAmC,EACnC,UAAU,GAAG,KAAK,GAAG,KAAK,CAC3B,gBAEA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,OAAO,CAAC,YAClB,CACP;4BAEA,kBAAkB,CAAC,KAAK,CAAC,IACxBC,yBACED,oBAAG,SAAS,EAAC,KAAK,gBAAE,KAAK,CAAC,KAAK,YAAK;oCACpCA,uBAAM,SAAS,EAAC,oCAAoC,gBACjD,KAAK,CAAC,WAAW,YACb,YACH,KAEN,KAAK,CACN,aACK,MA9CkC,YAAY,CA+ClD,EACN;SACH,CAAC,YACE,EACN;AACJ;;;;"}
|
|
@@ -15,17 +15,17 @@ var story = {
|
|
|
15
15
|
defaultValue: {
|
|
16
16
|
CAT: {
|
|
17
17
|
title: 'Cat',
|
|
18
|
-
description: 'At least 1'
|
|
18
|
+
description: 'At least 1',
|
|
19
19
|
},
|
|
20
20
|
DOG: {
|
|
21
21
|
title: 'Dog',
|
|
22
|
-
description: 'At least 2'
|
|
22
|
+
description: 'At least 2',
|
|
23
23
|
},
|
|
24
24
|
NONE: {
|
|
25
25
|
title: 'None',
|
|
26
|
-
description: 'No pets'
|
|
27
|
-
}
|
|
28
|
-
}
|
|
26
|
+
description: 'No pets',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
29
|
},
|
|
30
30
|
value: {
|
|
31
31
|
description: 'Current checked values.',
|
|
@@ -34,39 +34,43 @@ var story = {
|
|
|
34
34
|
description: 'Function called everytime a value changes.',
|
|
35
35
|
action: true,
|
|
36
36
|
table: {
|
|
37
|
-
category:
|
|
37
|
+
category: 'Callbacks',
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
40
|
wide: {
|
|
41
41
|
description: 'Property that defines if options should fill 100% of available horizontal space',
|
|
42
|
-
defaultValue: false
|
|
42
|
+
defaultValue: false,
|
|
43
43
|
},
|
|
44
44
|
inlineLayout: {
|
|
45
45
|
description: 'Property that defines if options should show inline instead of block. Check inline radio options story for examples.',
|
|
46
|
-
defaultValue: false
|
|
46
|
+
defaultValue: false,
|
|
47
47
|
},
|
|
48
48
|
classNames: {
|
|
49
49
|
description: 'ClassNames for custom styling',
|
|
50
50
|
defaultValue: {
|
|
51
51
|
container: '',
|
|
52
52
|
label: '',
|
|
53
|
-
option: ''
|
|
54
|
-
}
|
|
53
|
+
option: '',
|
|
54
|
+
},
|
|
55
55
|
},
|
|
56
56
|
bordered: {
|
|
57
57
|
description: 'Property that defines if option should show with border',
|
|
58
|
-
defaultValue: true
|
|
58
|
+
defaultValue: true,
|
|
59
59
|
},
|
|
60
|
-
|
|
60
|
+
disabled: {
|
|
61
|
+
description: 'Property that defines if the input and corresponding label are disabled and not clickable',
|
|
62
|
+
defaultValue: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
61
65
|
};
|
|
62
66
|
var RadioStory = function (_a) {
|
|
63
|
-
var onChange = _a.onChange, options = _a.options, wide = _a.wide, classNames = _a.classNames, inlineLayout = _a.inlineLayout, bordered = _a.bordered;
|
|
67
|
+
var onChange = _a.onChange, options = _a.options, wide = _a.wide, classNames = _a.classNames, inlineLayout = _a.inlineLayout, bordered = _a.bordered, disabled = _a.disabled;
|
|
64
68
|
var _b = useState(), checkedValues = _b[0], setCheckedValues = _b[1];
|
|
65
69
|
var handleOnChange = function (newValue) {
|
|
66
70
|
setCheckedValues(newValue);
|
|
67
71
|
onChange(newValue);
|
|
68
72
|
};
|
|
69
|
-
return (jsx(Radio, { wide: wide, options: options, onChange: handleOnChange, value: checkedValues, classNames: classNames, inlineLayout: inlineLayout, bordered: bordered }, void 0));
|
|
73
|
+
return (jsx(Radio, { wide: wide, options: options, onChange: handleOnChange, value: checkedValues, classNames: classNames, inlineLayout: inlineLayout, bordered: bordered, disabled: disabled }, void 0));
|
|
70
74
|
};
|
|
71
75
|
var RadioWithCustomWrapperStyles = function (_a) {
|
|
72
76
|
var onChange = _a.onChange;
|
|
@@ -78,7 +82,7 @@ var RadioWithCustomWrapperStyles = function (_a) {
|
|
|
78
82
|
return (jsx(Radio, { onChange: handleOnChange, value: checkedValues, options: {
|
|
79
83
|
CAT1: 'Cat',
|
|
80
84
|
DOG1: 'Dog',
|
|
81
|
-
}, classNames: { container:
|
|
85
|
+
}, classNames: { container: 'p32 bg-primary-300 br24 bs-lg' } }, void 0));
|
|
82
86
|
};
|
|
83
87
|
var RadioWithCustomOptionStyles = function (_a) {
|
|
84
88
|
var onChange = _a.onChange;
|
|
@@ -90,7 +94,7 @@ var RadioWithCustomOptionStyles = function (_a) {
|
|
|
90
94
|
return (jsx(Radio, { onChange: handleOnChange, value: checkedValues, options: {
|
|
91
95
|
CAT2: 'Cat',
|
|
92
96
|
DOG2: 'Dog',
|
|
93
|
-
}, classNames: { option:
|
|
97
|
+
}, classNames: { option: 'mb32 p24 bg-green-100 br12 bs-lg' } }, void 0));
|
|
94
98
|
};
|
|
95
99
|
var RadioWithCustomLabelStyles = function (_a) {
|
|
96
100
|
var onChange = _a.onChange;
|
|
@@ -102,7 +106,7 @@ var RadioWithCustomLabelStyles = function (_a) {
|
|
|
102
106
|
return (jsx(Radio, { onChange: handleOnChange, value: checkedValues, options: {
|
|
103
107
|
CAT3: 'Cat',
|
|
104
108
|
DOG3: 'Dog',
|
|
105
|
-
}, classNames: { label:
|
|
109
|
+
}, classNames: { label: 'bg-grey-900 tc-white' } }, void 0));
|
|
106
110
|
};
|
|
107
111
|
var RadioWithInlineLayout = function (_a) {
|
|
108
112
|
var onChange = _a.onChange;
|
|
@@ -118,7 +122,7 @@ var RadioWithInlineLayout = function (_a) {
|
|
|
118
122
|
RABBIT: 'Rabbit',
|
|
119
123
|
RAT: 'Rat',
|
|
120
124
|
ANOTHER: 'Other',
|
|
121
|
-
}, classNames: { option:
|
|
125
|
+
}, classNames: { option: 'w30' }, inlineLayout: true, wide: true }, void 0));
|
|
122
126
|
};
|
|
123
127
|
var RadioWithCustomLabel = function (_a) {
|
|
124
128
|
var onChange = _a.onChange; _a.wide; _a.classNames; _a.inlineLayout;
|
|
@@ -129,18 +133,18 @@ var RadioWithCustomLabel = function (_a) {
|
|
|
129
133
|
};
|
|
130
134
|
return (jsx(Radio, { options: {
|
|
131
135
|
BIGDOG: {
|
|
132
|
-
icon: function () { return jsx("img", { src: images.bigDog, alt:
|
|
136
|
+
icon: function () { return jsx("img", { src: images.bigDog, alt: "" }, void 0); },
|
|
133
137
|
title: 'Dog',
|
|
134
138
|
},
|
|
135
139
|
FISH: {
|
|
136
|
-
icon: function () { return jsx("img", { src: images.brokenAquarium, alt:
|
|
140
|
+
icon: function () { return jsx("img", { src: images.brokenAquarium, alt: "" }, void 0); },
|
|
137
141
|
title: 'Fish',
|
|
138
142
|
},
|
|
139
143
|
OTHER: {
|
|
140
|
-
icon: function () { return jsx("img", { src: images.brokenGlass, alt:
|
|
144
|
+
icon: function () { return jsx("img", { src: images.brokenGlass, alt: "" }, void 0); },
|
|
141
145
|
title: 'Other',
|
|
142
|
-
}
|
|
143
|
-
}, onChange: handleOnChange, value: checkedValues, classNames: { option:
|
|
146
|
+
},
|
|
147
|
+
}, onChange: handleOnChange, value: checkedValues, classNames: { option: 'w30' }, inlineLayout: true }, void 0));
|
|
144
148
|
};
|
|
145
149
|
var RadioWithCustomLabelInline = function (_a) {
|
|
146
150
|
var onChange = _a.onChange; _a.wide; _a.classNames; _a.inlineLayout;
|
|
@@ -151,18 +155,18 @@ var RadioWithCustomLabelInline = function (_a) {
|
|
|
151
155
|
};
|
|
152
156
|
return (jsx(Radio, { options: {
|
|
153
157
|
BIGDOG: {
|
|
154
|
-
icon: function () { return jsx("img", { src: images.bigDog, alt:
|
|
158
|
+
icon: function () { return jsx("img", { src: images.bigDog, alt: "" }, void 0); },
|
|
155
159
|
title: 'Dog',
|
|
156
160
|
},
|
|
157
161
|
FISH: {
|
|
158
|
-
icon: function () { return jsx("img", { src: images.brokenAquarium, alt:
|
|
162
|
+
icon: function () { return jsx("img", { src: images.brokenAquarium, alt: "" }, void 0); },
|
|
159
163
|
title: 'Fish',
|
|
160
164
|
},
|
|
161
165
|
OTHER: {
|
|
162
|
-
icon: function () { return jsx("img", { src: images.brokenGlass, alt:
|
|
166
|
+
icon: function () { return jsx("img", { src: images.brokenGlass, alt: "" }, void 0); },
|
|
163
167
|
title: 'Other',
|
|
164
|
-
}
|
|
165
|
-
}, onChange: handleOnChange, inlineIcon: true, value: checkedValues, classNames: { option:
|
|
168
|
+
},
|
|
169
|
+
}, onChange: handleOnChange, inlineIcon: true, value: checkedValues, classNames: { option: 'w30' }, inlineLayout: true }, void 0));
|
|
166
170
|
};
|
|
167
171
|
RadioStory.storyName = 'Radio';
|
|
168
172
|
var RadioIconOnly = function (_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../../src/lib/components/input/radio/index.stories.tsx"],"sourcesContent":["\nimport { useState } from 'react';\nimport { Radio, RadioProps } from '.';\nimport { images } from '../../../util/images';\n\nconst story = {\n title: 'JSX/Inputs/Radio',\n component: Radio,\n argTypes: {\n options: {\n description: 'Object that contains the possible options for rendering in the input.',\n defaultValue: {\n CAT:{\n title: 'Cat',\n description: 'At least 1'\n },\n DOG:{\n title: 'Dog',\n description: 'At least 2'\n },\n NONE:{\n title: 'None',\n description: 'No pets'\n }\n }\n },\n value: {\n description: 'Current checked values.',\n },\n onChange: {\n description: 'Function called everytime a value changes.',\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n wide: {\n description: 'Property that defines if options should fill 100% of available horizontal space',\n defaultValue: false\n },\n inlineLayout: {\n description: 'Property that defines if options should show inline instead of block. Check inline radio options story for examples.',\n defaultValue: false\n },\n classNames: {\n description: 'ClassNames for custom styling',\n defaultValue: {\n container: '',\n label: '',\n option: ''\n }\n },\n bordered: {\n description: 'Property that defines if option should show with border',\n defaultValue: true\n },\n }\n};\n\nexport const RadioStory = ({ \n onChange,\n options,\n wide,\n classNames,\n inlineLayout,\n bordered,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n wide={wide}\n options={options} \n onChange={handleOnChange}\n value={checkedValues}\n classNames={classNames}\n inlineLayout={inlineLayout}\n bordered={bordered}\n />\n );\n}\n\nexport const RadioWithCustomWrapperStyles = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT1: 'Cat',\n DOG1: 'Dog',\n }} \n classNames={{ container: \"p32 bg-primary-300 br24 bs-lg\" }}\n />\n );\n}\n\nexport const RadioWithCustomOptionStyles = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT2: 'Cat',\n DOG2: 'Dog',\n }} \n classNames={{ option: \"mb32 p24 bg-green-100 br12 bs-lg\" }}\n />\n );\n}\n\nexport const RadioWithCustomLabelStyles = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string ) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT3: 'Cat',\n DOG3: 'Dog',\n }} \n classNames={{ label: \"bg-grey-900 tc-white\" }}\n />\n );\n}\n\nexport const RadioWithInlineLayout = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT4: 'Cat',\n DOG4: 'Dog',\n FISHER: 'Fish',\n RABBIT: 'Rabbit',\n RAT: 'Rat',\n ANOTHER: 'Other',\n }} \n classNames={{ option: \"w30\" }}\n inlineLayout\n wide\n />\n );\n}\n\nexport const RadioWithCustomLabel = ({ onChange, wide, classNames, inlineLayout }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n options={{\n BIGDOG: {\n icon: () => <img src={images.bigDog} alt='' />,\n title: 'Dog',\n },\n FISH:{\n icon: () => <img src={images.brokenAquarium} alt='' />,\n title: 'Fish',\n },\n OTHER:{\n icon: () => <img src={images.brokenGlass} alt='' />,\n title: 'Other',\n }\n }} \n onChange={handleOnChange}\n value={checkedValues}\n classNames={{ option: \"w30\" }}\n inlineLayout\n />\n );\n}\n\nexport const RadioWithCustomLabelInline = ({ onChange, wide, classNames, inlineLayout }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n options={{\n BIGDOG: {\n icon: () => <img src={images.bigDog} alt='' />,\n title: 'Dog',\n },\n FISH:{\n icon: () => <img src={images.brokenAquarium} alt='' />,\n title: 'Fish',\n },\n OTHER:{\n icon: () => <img src={images.brokenGlass} alt='' />,\n title: 'Other',\n }\n }} \n onChange={handleOnChange}\n inlineIcon\n value={checkedValues}\n classNames={{ option: \"w30\" }}\n inlineLayout\n />\n );\n}\n\nRadioStory.storyName = 'Radio';\n\nexport const RadioIconOnly = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n }\n\n return (\n <Radio \n options={{ NOTHING: '' }} \n onChange={handleOnChange}\n classNames={{ label: 'jc-start' }}\n value={checkedValues}\n bordered={false}\n />\n );\n}\n\nRadioStory.storyName = 'Radio';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,WAAW,EAAE,uEAAuE;YACpF,YAAY,EAAE;gBACZ,GAAG,EAAC;oBACF,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,YAAY;iBAC1B;gBACD,GAAG,EAAC;oBACF,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,YAAY;iBAC1B;gBACD,IAAI,EAAC;oBACH,KAAK,EAAE,MAAM;oBACb,WAAW,EAAE,SAAS;iBACvB;aACF;SACF;QACD,KAAK,EAAE;YACL,WAAW,EAAE,yBAAyB;SACvC;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,4CAA4C;YACzD,MAAM,EAAE,IAAI;YACZ,KAAK,EAAE;gBACL,QAAQ,EAAE,WAAW;aACtB;SACF;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,iFAAiF;YAC9F,YAAY,EAAE,KAAK;SACpB;QACD,YAAY,EAAE;YACZ,WAAW,EAAE,sHAAsH;YACnI,YAAY,EAAE,KAAK;SACpB;QACD,UAAU,EAAE;YACV,WAAW,EAAE,+BAA+B;YAC5C,YAAY,EAAE;gBACZ,SAAS,EAAE,EAAE;gBACb,KAAK,EAAE,EAAE;gBACT,MAAM,EAAE,EAAE;aACX;SACF;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,yDAAyD;YACtE,YAAY,EAAE,IAAI;SACnB;KACF;EACD;IAEW,UAAU,GAAG,UAAC,EAON;QANnB,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,IAAI,UAAA,E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js","sources":["../../../../../../src/lib/components/input/radio/index.stories.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { Radio, RadioProps } from '.';\nimport { images } from '../../../util/images';\n\nconst story = {\n title: 'JSX/Inputs/Radio',\n component: Radio,\n argTypes: {\n options: {\n description:\n 'Object that contains the possible options for rendering in the input.',\n defaultValue: {\n CAT: {\n title: 'Cat',\n description: 'At least 1',\n },\n DOG: {\n title: 'Dog',\n description: 'At least 2',\n },\n NONE: {\n title: 'None',\n description: 'No pets',\n },\n },\n },\n value: {\n description: 'Current checked values.',\n },\n onChange: {\n description: 'Function called everytime a value changes.',\n action: true,\n table: {\n category: 'Callbacks',\n },\n },\n wide: {\n description:\n 'Property that defines if options should fill 100% of available horizontal space',\n defaultValue: false,\n },\n inlineLayout: {\n description:\n 'Property that defines if options should show inline instead of block. Check inline radio options story for examples.',\n defaultValue: false,\n },\n classNames: {\n description: 'ClassNames for custom styling',\n defaultValue: {\n container: '',\n label: '',\n option: '',\n },\n },\n bordered: {\n description: 'Property that defines if option should show with border',\n defaultValue: true,\n },\n disabled: {\n description:\n 'Property that defines if the input and corresponding label are disabled and not clickable',\n defaultValue: false,\n },\n },\n};\n\nexport const RadioStory = ({\n onChange,\n options,\n wide,\n classNames,\n inlineLayout,\n bordered,\n disabled,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n wide={wide}\n options={options}\n onChange={handleOnChange}\n value={checkedValues}\n classNames={classNames}\n inlineLayout={inlineLayout}\n bordered={bordered}\n disabled={disabled}\n />\n );\n};\n\nexport const RadioWithCustomWrapperStyles = ({\n onChange,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT1: 'Cat',\n DOG1: 'Dog',\n }}\n classNames={{ container: 'p32 bg-primary-300 br24 bs-lg' }}\n />\n );\n};\n\nexport const RadioWithCustomOptionStyles = ({\n onChange,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT2: 'Cat',\n DOG2: 'Dog',\n }}\n classNames={{ option: 'mb32 p24 bg-green-100 br12 bs-lg' }}\n />\n );\n};\n\nexport const RadioWithCustomLabelStyles = ({\n onChange,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT3: 'Cat',\n DOG3: 'Dog',\n }}\n classNames={{ label: 'bg-grey-900 tc-white' }}\n />\n );\n};\n\nexport const RadioWithInlineLayout = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n onChange={handleOnChange}\n value={checkedValues}\n options={{\n CAT4: 'Cat',\n DOG4: 'Dog',\n FISHER: 'Fish',\n RABBIT: 'Rabbit',\n RAT: 'Rat',\n ANOTHER: 'Other',\n }}\n classNames={{ option: 'w30' }}\n inlineLayout\n wide\n />\n );\n};\n\nexport const RadioWithCustomLabel = ({\n onChange,\n wide,\n classNames,\n inlineLayout,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n options={{\n BIGDOG: {\n icon: () => <img src={images.bigDog} alt=\"\" />,\n title: 'Dog',\n },\n FISH: {\n icon: () => <img src={images.brokenAquarium} alt=\"\" />,\n title: 'Fish',\n },\n OTHER: {\n icon: () => <img src={images.brokenGlass} alt=\"\" />,\n title: 'Other',\n },\n }}\n onChange={handleOnChange}\n value={checkedValues}\n classNames={{ option: 'w30' }}\n inlineLayout\n />\n );\n};\n\nexport const RadioWithCustomLabelInline = ({\n onChange,\n wide,\n classNames,\n inlineLayout,\n}: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n options={{\n BIGDOG: {\n icon: () => <img src={images.bigDog} alt=\"\" />,\n title: 'Dog',\n },\n FISH: {\n icon: () => <img src={images.brokenAquarium} alt=\"\" />,\n title: 'Fish',\n },\n OTHER: {\n icon: () => <img src={images.brokenGlass} alt=\"\" />,\n title: 'Other',\n },\n }}\n onChange={handleOnChange}\n inlineIcon\n value={checkedValues}\n classNames={{ option: 'w30' }}\n inlineLayout\n />\n );\n};\n\nRadioStory.storyName = 'Radio';\n\nexport const RadioIconOnly = ({ onChange }: RadioProps<string>) => {\n const [checkedValues, setCheckedValues] = useState<string>();\n\n const handleOnChange = (newValue: string) => {\n setCheckedValues(newValue);\n onChange(newValue);\n };\n\n return (\n <Radio\n options={{ NOTHING: '' }}\n onChange={handleOnChange}\n classNames={{ label: 'jc-start' }}\n value={checkedValues}\n bordered={false}\n />\n );\n};\n\nRadioStory.storyName = 'Radio';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;IAIM,KAAK,GAAG;IACZ,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,WAAW,EACT,uEAAuE;YACzE,YAAY,EAAE;gBACZ,GAAG,EAAE;oBACH,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,YAAY;iBAC1B;gBACD,GAAG,EAAE;oBACH,KAAK,EAAE,KAAK;oBACZ,WAAW,EAAE,YAAY;iBAC1B;g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AE,MAAM,CAAC,WAAW,EAAE,GAAG,EAAC,EAAE,WAAG,GAAA;gBACnD,KAAK,EAAE,OAAO;aACf;SACF,EACD,QAAQ,EAAE,cAAc,EACxB,UAAU,QACV,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAC7B,YAAY,iBACZ,EACF;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO,CAAC;IAElB,aAAa,GAAG,UAAC,EAAgC;QAA9B,QAAQ,cAAA;IAChC,IAAA,KAAoC,QAAQ,EAAU,EAArD,aAAa,QAAA,EAAE,gBAAgB,QAAsB,CAAC;IAE7D,IAAM,cAAc,GAAG,UAAC,QAAgB;QACtC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC3B,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACpB,CAAC;IAEF,QACEA,IAAC,KAAK,IACJ,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EACxB,QAAQ,EAAE,cAAc,EACxB,UAAU,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,EACjC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,KAAK,WACf,EACF;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO;;;;;"}
|
|
@@ -83,5 +83,19 @@ describe('Radio component', function () {
|
|
|
83
83
|
}, onChange: mockOnChange }, void 0)).getByText;
|
|
84
84
|
expect(getByText('Cat')).toBeInTheDocument();
|
|
85
85
|
});
|
|
86
|
+
it('Should disable the input', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
+
var getByTestId, radioInput;
|
|
88
|
+
return __generator(this, function (_a) {
|
|
89
|
+
getByTestId = customRender(jsx(Radio, { options: {
|
|
90
|
+
CAT: {
|
|
91
|
+
title: 'Cat',
|
|
92
|
+
description: 'Cat description',
|
|
93
|
+
},
|
|
94
|
+
}, onChange: mockOnChange, disabled: true }, void 0)).getByTestId;
|
|
95
|
+
radioInput = getByTestId('radio-input-CAT');
|
|
96
|
+
expect(radioInput).toBeDisabled();
|
|
97
|
+
return [2 /*return*/];
|
|
98
|
+
});
|
|
99
|
+
}); });
|
|
86
100
|
});
|
|
87
101
|
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sources":["../../../../../../src/lib/components/input/radio/index.test.tsx"],"sourcesContent":["import { render } from '../../../util/testUtils';\n\nimport { Radio, RadioProps } from '.';\n\nconst mockOnChange = jest.fn();\n\nconst setup = (onChange: RadioProps<string>['onChange'], value?: string) => {\n const utils = render(\n <Radio\n options={{\n CAT: 'Cat',\n DOG: 'Dog',\n NONE: 'None',\n }}\n onChange={onChange}\n value={value}\n />\n );\n\n return utils;\n};\n\ndescribe('Radio component', () => {\n it('Should render options', () => {\n const { getByText } = setup(mockOnChange);\n\n expect(getByText('Cat')).toBeInTheDocument();\n expect(getByText('Dog')).toBeInTheDocument();\n expect(getByText('None')).toBeInTheDocument();\n });\n\n it('Should call onchange on selecting an option', async () => {\n const { getByTestId, user } = setup(mockOnChange);\n\n await user.click(getByTestId('radio-DOG'));\n\n expect(mockOnChange).toBeCalledWith('DOG');\n });\n\n it('Should render checked items when value is passed', async () => {\n const { getByTestId } = setup(mockOnChange, 'CAT');\n\n expect(getByTestId('radio-input-CAT')).toBeChecked();\n });\n\n it('Should render custom description', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n description: 'Cat description',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('Cat description')).toBeInTheDocument();\n });\n\n it('Should render custom icon', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n icon: () => 'ICON',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('ICON')).toBeInTheDocument();\n });\n\n it('Should render custom icon with selected', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n icon: (selected) => (selected ? 'SELECTED-ICON' : 'ICON'),\n },\n }}\n onChange={mockOnChange}\n value={'CAT'}\n />\n );\n\n expect(getByText('SELECTED-ICON')).toBeInTheDocument();\n });\n\n it('Should render label text passed in HTML format', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: <p>Cat</p>,\n description: 'Cat description',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('Cat')).toBeInTheDocument();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;AAIA,IAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE/B,IAAM,KAAK,GAAG,UAAC,QAAwC,EAAE,KAAc;IACrE,IAAM,KAAK,GAAGA,YAAM,CAClBC,IAAC,KAAK,IACJ,OAAO,EAAE;YACP,GAAG,EAAE,KAAK;YACV,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,MAAM;SACb,EACD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,WACZ,CACH,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,EAAE,CAAC,uBAAuB,EAAE;QAClB,IAAA,SAAS,GAAK,KAAK,CAAC,YAAY,CAAC,UAAxB,CAAyB;QAE1C,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAC7C,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAC7C,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC/C,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE;;;;;oBAC1C,KAAwB,KAAK,CAAC,YAAY,CAAC,EAAzC,WAAW,iBAAA,EAAE,IAAI,UAAA,CAAyB;oBAElD,qBAAM,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,EA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ACD,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,KAAK,WACZ,CACH,UAXgB,CAWf;QAEF,MAAM,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KACxD,CAAC,CAAC;IAEH,EAAE,CAAC,gDAAgD,EAAE;QAC3C,IAAA,SAAS,GAAKD,YAAM,CAC1BC,IAAC,KAAK,IACJ,OAAO,EAAE;gBACP,GAAG,EAAE;oBACH,KAAK,EAAEA,qCAAU;oBACjB,WAAW,EAAE,iBAAiB;iBAC/B;aACF,EACD,QAAQ,EAAE,YAAY,WACtB,CACH,UAVgB,CAUf;QAEF,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.test.js","sources":["../../../../../../src/lib/components/input/radio/index.test.tsx"],"sourcesContent":["import { render } from '../../../util/testUtils';\n\nimport { Radio, RadioProps } from '.';\n\nconst mockOnChange = jest.fn();\n\nconst setup = (onChange: RadioProps<string>['onChange'], value?: string) => {\n const utils = render(\n <Radio\n options={{\n CAT: 'Cat',\n DOG: 'Dog',\n NONE: 'None',\n }}\n onChange={onChange}\n value={value}\n />\n );\n\n return utils;\n};\n\ndescribe('Radio component', () => {\n it('Should render options', () => {\n const { getByText } = setup(mockOnChange);\n\n expect(getByText('Cat')).toBeInTheDocument();\n expect(getByText('Dog')).toBeInTheDocument();\n expect(getByText('None')).toBeInTheDocument();\n });\n\n it('Should call onchange on selecting an option', async () => {\n const { getByTestId, user } = setup(mockOnChange);\n\n await user.click(getByTestId('radio-DOG'));\n\n expect(mockOnChange).toBeCalledWith('DOG');\n });\n\n it('Should render checked items when value is passed', async () => {\n const { getByTestId } = setup(mockOnChange, 'CAT');\n\n expect(getByTestId('radio-input-CAT')).toBeChecked();\n });\n\n it('Should render custom description', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n description: 'Cat description',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('Cat description')).toBeInTheDocument();\n });\n\n it('Should render custom icon', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n icon: () => 'ICON',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('ICON')).toBeInTheDocument();\n });\n\n it('Should render custom icon with selected', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n icon: (selected) => (selected ? 'SELECTED-ICON' : 'ICON'),\n },\n }}\n onChange={mockOnChange}\n value={'CAT'}\n />\n );\n\n expect(getByText('SELECTED-ICON')).toBeInTheDocument();\n });\n\n it('Should render label text passed in HTML format', () => {\n const { getByText } = render(\n <Radio\n options={{\n CAT: {\n title: <p>Cat</p>,\n description: 'Cat description',\n },\n }}\n onChange={mockOnChange}\n />\n );\n\n expect(getByText('Cat')).toBeInTheDocument();\n });\n\n it('Should disable the input', async () => {\n const { getByTestId } = render(\n <Radio\n options={{\n CAT: {\n title: 'Cat',\n description: 'Cat description',\n },\n }}\n onChange={mockOnChange}\n disabled\n />\n );\n\n const radioInput = getByTestId('radio-input-CAT');\n\n expect(radioInput).toBeDisabled();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;AAIA,IAAM,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE/B,IAAM,KAAK,GAAG,UAAC,QAAwC,EAAE,KAAc;IACrE,IAAM,KAAK,GAAGA,YAAM,CAClBC,IAAC,KAAK,IACJ,OAAO,EAAE;YACP,GAAG,EAAE,KAAK;YACV,GAAG,EAAE,KAAK;YACV,IAAI,EAAE,MAAM;SACb,EACD,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,WACZ,CACH,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,QAAQ,CAAC,iBAAiB,EAAE;IAC1B,EAAE,CAAC,uBAAuB,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H,YAXkB,CAWjB;YAEI,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;YAElD,MAAM,CAAC,UAAU,CAAC,CAAC,YAAY,EAAE,CAAC;;;SACnC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import '../../tslib.es6-5bc94358.js';
|
|
2
2
|
import 'react/jsx-runtime';
|
|
3
3
|
import '../../index-6ea95111.js';
|
|
4
|
-
export { T as Toast, a as Toaster, t as toast } from '../../index-
|
|
4
|
+
export { T as Toast, a as Toaster, t as toast } from '../../index-d81b8748.js';
|
|
5
5
|
import '../icon/icons/X.js';
|
|
6
6
|
import '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
import 'react';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { _ as __assign } from '../../tslib.es6-5bc94358.js';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
4
|
-
import { T as Toast, a as Toaster, s as styles, t as toast } from '../../index-2c193605.js';
|
|
3
|
+
import { T as Toast, a as Toaster, s as styles, t as toast } from '../../index-d81b8748.js';
|
|
5
4
|
import { Button } from '../button/index.js';
|
|
5
|
+
import { c as classNames } from '../../index-6ea95111.js';
|
|
6
6
|
import '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
import 'react';
|
|
8
8
|
import '../../_commonjsHelpers-e7f67fd8.js';
|
|
@@ -36,7 +36,13 @@ var story = {
|
|
|
36
36
|
table: {
|
|
37
37
|
disable: true,
|
|
38
38
|
},
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
classNames: {
|
|
41
|
+
description: 'Allows customization of toast and toast wrapper (named as Toaster)',
|
|
42
|
+
table: {
|
|
43
|
+
category: 'Toaster props',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
40
46
|
},
|
|
41
47
|
args: {
|
|
42
48
|
title: 'We couldn’t open the chat',
|
|
@@ -47,6 +53,10 @@ var story = {
|
|
|
47
53
|
},
|
|
48
54
|
type: 'success',
|
|
49
55
|
duration: 3000,
|
|
56
|
+
classNames: {
|
|
57
|
+
toast: "",
|
|
58
|
+
wrapper: ""
|
|
59
|
+
}
|
|
50
60
|
},
|
|
51
61
|
};
|
|
52
62
|
var FakeInlineToast = function (_a) {
|
|
@@ -56,7 +66,7 @@ var FakeInlineToast = function (_a) {
|
|
|
56
66
|
} }, { children: jsx(Toast, { title: title, onDismiss: function () { }, description: description, action: action, type: type }, void 0) }), void 0) }), void 0));
|
|
57
67
|
};
|
|
58
68
|
var ToastStory = function (_a) {
|
|
59
|
-
var title = _a.title, description = _a.description, action = _a.action, type = _a.type, duration = _a.duration;
|
|
69
|
+
var title = _a.title, description = _a.description, action = _a.action, type = _a.type, duration = _a.duration, toasterClassNames = _a.classNames;
|
|
60
70
|
var showToast = function () { return toast(title, {
|
|
61
71
|
description: description,
|
|
62
72
|
duration: duration,
|
|
@@ -65,7 +75,7 @@ var ToastStory = function (_a) {
|
|
|
65
75
|
}); };
|
|
66
76
|
return (jsxs(Fragment, { children: [jsxs("div", __assign({ className: 'mb16' }, { children: [jsx("div", { children: "Show a toast using the following code:" }, void 0),
|
|
67
77
|
jsx("pre", __assign({ className: 'bg-grey-300 br4 d-inline-flex p8 mt8' }, { children: "() => toast(title, { description, type, action })" }), void 0)] }), void 0),
|
|
68
|
-
jsx(Toaster, {}, void 0),
|
|
78
|
+
jsx(Toaster, { classNames: toasterClassNames }, void 0),
|
|
69
79
|
jsx(Button, __assign({ onClick: showToast }, { children: "Click here to trigger toast" }), void 0)] }, void 0));
|
|
70
80
|
};
|
|
71
81
|
ToastStory.storyName = "Toast";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/toast/index.stories.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"index.stories.js","sources":["../../../../../src/lib/components/toast/index.stories.tsx"],"sourcesContent":["import { ToasterProps, Toast, ToastProps, ToastType, Toaster, toast } from '.';\nimport { Button } from '../button';\nimport styles from './style.module.scss';\nimport classNames from 'classnames';\n\nconst toastTypes: ToastType[] = ['success', 'warning', 'error', 'information'];\n\nconst story = {\n title: 'JSX/Toast',\n component: Toast,\n argTypes: {\n title: {\n description: 'Title of the toast.',\n },\n description: {\n description: 'Additional description content to be displayed inside the toast.',\n },\n type: {\n description: 'Type of toast to display. This changes the styles/colors of the toast.',\n },\n action: {\n description: 'Object containing a possible action button inside the toast.',\n },\n duration: {\n description: 'Duration in ms that the toast should be displayed.',\n table: {\n defaultValue: { summary: 3000 },\n }\n },\n onDismiss: {\n table: {\n disable: true,\n },\n },\n classNames: {\n description: 'Allows customization of toast and toast wrapper (named as Toaster)',\n table: {\n category: 'Toaster props',\n },\n },\n },\n args: {\n title: 'We couldn’t open the chat',\n description: \"We couldn't open the chat description. We couldn't open the chat description.\",\n action: {\n title: 'Send an email',\n onClick: () => {}\n },\n type: 'success',\n duration: 3000,\n classNames: {\n toast: \"\",\n wrapper: \"\"\n }\n },\n};\n\nconst FakeInlineToast = ({ \n title, \n description, \n action, \n type,\n}: Omit<ToastProps, 'onDismiss'>) => (\n <div className='mb32'>\n <div\n className={classNames(styles.toast, 'br8 bs-lg d-inline-flex')}\n style={{\n padding: \"12px 20px\"\n }}\n >\n <Toast \n title={title}\n onDismiss={() => {}}\n description={description}\n action={action}\n type={type}\n />\n </div>\n </div>\n);\n\nexport const ToastStory = ({ \n title, \n description, \n action, \n type, \n duration, \n classNames: toasterClassNames \n}: ToastProps & ToasterProps) => {\n const showToast = () => toast(\n title, \n {\n description,\n duration,\n type,\n action\n }\n );\n\n return (\n <>\n <div className='mb16'>\n <div>\n Show a toast using the following code:\n </div>\n <pre className='bg-grey-300 br4 d-inline-flex p8 mt8'>\n {\"() => toast(title, { description, type, action })\"}\n </pre>\n </div>\n <Toaster classNames={toasterClassNames} />\n\n <Button onClick={showToast}>Click here to trigger toast</Button>\n </>\n );\n};\n\nToastStory.storyName = \"Toast\";\n\nexport const ToastTypes = (props: ToastProps) => {\n return (\n <>\n {toastTypes.map((toastType) => (\n <div key={toastType} className='d-flex fd-column'>\n <h3 className='p-h3 mb16'>{toastType}</h3>\n <FakeInlineToast {...props} type={toastType} />\n </div>\n ))}\n </>\n );\n};\n\nexport const ToastContent = ({ title, description, action }: ToastProps) => {\n return (\n <div className='d-flex fd-column'>\n <FakeInlineToast title={title} />\n <FakeInlineToast title={title} description={description} />\n <FakeInlineToast title={title} description={description} action={action} />\n <FakeInlineToast title={title} action={action} />\n </div>\n );\n};\n\nexport default story;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AAKA,IAAM,UAAU,GAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAEzE,KAAK,GAAG;IACZ,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,WAAW,EAAE,qBAAqB;SACnC;QACD,WAAW,EAAE;YACX,WAAW,EAAE,kEAAkE;SAChF;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,wEAAwE;SACtF;QACD,MAAM,EAAE;YACN,WAAW,EAAE,8DAA8D;SAC5E;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,oDAAoD;YACjE,KAAK,EAAE;gBACL,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;aAChC;SACF;QACD,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI;aACd;SACF;QACD,UAAU,EAAE;YACV,WAAW,EAAE,oEAAoE;YACjF,KAAK,EAAE;gBACL,QAAQ,EAAE,eAAe;aAC1B;SACF;KACF;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,+EAA+E;QAC5F,MAAM,EAAE;YACN,KAAK,EAAE,eAAe;YACtB,OAAO,EAAE,eAAQ;SAClB;QACD,IAAI,EAAE,SAAS;QACf,Q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C,uBAAqB,SAAS,EAAC,kBAAkB,iBAC/CD,qBAAI,SAAS,EAAC,WAAW,gBAAE,SAAS,YAAM;gBAC1CA,IAAC,eAAe,eAAK,KAAK,IAAE,IAAI,EAAE,SAAS,YAAI,MAFvC,SAAS,CAGb,IACP,CAAC,WACD,EACH;AACJ,EAAE;IAEW,YAAY,GAAG,UAAC,EAA0C;QAAxC,KAAK,WAAA,EAAE,WAAW,iBAAA,EAAE,MAAM,YAAA;IACvD,QACEC,uBAAK,SAAS,EAAC,kBAAkB,iBAC/BD,IAAC,eAAe,IAAC,KAAK,EAAE,KAAK,WAAI;YACjCA,IAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,WAAI;YAC3DA,IAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,WAAI;YAC3EA,IAAC,eAAe,IAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAI,aAC7C,EACN;AACJ;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { b as __awaiter, c as __generator } from '../../tslib.es6-5bc94358.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender, s as screen } from '../../customRender-9fd06f5b.js';
|
|
4
|
-
import { T as Toast } from '../../index-
|
|
4
|
+
import { T as Toast } from '../../index-d81b8748.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../_commonjsHelpers-e7f67fd8.js';
|
|
@@ -202,9 +202,12 @@ to {
|
|
|
202
202
|
}
|
|
203
203
|
`,L=16,J=({reverseOrder:e,position:t="top-center",toastOptions:o,gutter:s,children:r,containerStyle:a,containerClassName:c})=>{let{toasts:i,handlers:d}=V(o);return f.createElement("div",{style:{position:"fixed",zIndex:9999,top:L,left:L,right:L,bottom:L,pointerEvents:"none",...a},className:c,onMouseEnter:d.startPause,onMouseLeave:d.endPause},i.map(p=>{let g=p.position||t,z=d.calculateOffset(p,{reverseOrder:e,gutter:s,defaultPosition:t}),O=De(g,z);return f.createElement(Ie,{id:p.id,key:p.id,onHeightUpdate:d.updateHeight,className:p.visible?ke:"",style:O},p.type==="custom"?u(p.message,p):r?r(p):f.createElement($,{toast:p,position:g}))}))};var _e=n;
|
|
204
204
|
|
|
205
|
-
var Toaster = function () {
|
|
206
|
-
|
|
207
|
-
|
|
205
|
+
var Toaster = function (_a) {
|
|
206
|
+
var toasterClassNames = _a.classNames;
|
|
207
|
+
return (jsx(dist.Toaster, { containerClassName: toasterClassNames === null || toasterClassNames === void 0 ? void 0 : toasterClassNames.wrapper, toastOptions: {
|
|
208
|
+
className: classNames(styles.toast, 'bs-lg', toasterClassNames === null || toasterClassNames === void 0 ? void 0 : toasterClassNames.toast),
|
|
209
|
+
} }, void 0));
|
|
210
|
+
};
|
|
208
211
|
var Toast = function (_a) {
|
|
209
212
|
var action = _a.action, description = _a.description, onDismiss = _a.onDismiss, title = _a.title, _b = _a.type, type = _b === void 0 ? "success" : _b;
|
|
210
213
|
return (jsxs("div", __assign({ className: classNames(styles.toastContent, 'd-flex jc-between w100') }, { children: [jsx("div", { className: classNames(styles.toastSidebar, styles["toastSidebar--" + type]) }, void 0),
|
|
@@ -222,4 +225,4 @@ var toast = function (title, _a) {
|
|
|
222
225
|
};
|
|
223
226
|
|
|
224
227
|
export { Toast as T, Toaster as a, styles as s, toast as t };
|
|
225
|
-
//# sourceMappingURL=index-
|
|
228
|
+
//# sourceMappingURL=index-d81b8748.js.map
|