@web-site-utilities/feedback 0.0.11 → 0.0.14
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/common/components/Checkbox.d.ts +4 -3
- package/dist/common/hooks/useStepper.d.ts +1 -0
- package/dist/fields/Field/Field.d.ts +3 -2
- package/dist/form/App.d.ts +1 -1
- package/dist/form/features/InPlaceForm/InPlaceForm.d.ts +2 -2
- package/dist/index.cjs.js +101 -84
- package/dist/index.es.js +101 -84
- package/dist/index.iife.js +101 -84
- package/package.json +1 -1
|
@@ -2,20 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import { Variants } from '../theme/ThemeProvider';
|
|
3
3
|
import { CommonFieldProps } from '../types/CommonFieldProps';
|
|
4
4
|
import { Options } from '../types/Option';
|
|
5
|
+
import { Nullable } from "../types/Nullable";
|
|
5
6
|
type CheckboxProps = {
|
|
6
7
|
label: string;
|
|
7
8
|
onSelect: (value: Array<string>) => void;
|
|
8
|
-
value: Array<string
|
|
9
|
+
value: Nullable<Array<string>>;
|
|
9
10
|
id: string;
|
|
10
11
|
colorVariant?: Variants | undefined;
|
|
11
12
|
name: string;
|
|
12
13
|
};
|
|
13
14
|
export declare const Checkbox: (props: CheckboxProps) => React.DOMElement<{
|
|
14
|
-
selected: boolean;
|
|
15
|
+
selected: boolean | undefined;
|
|
15
16
|
children: (React.DOMElement<{
|
|
16
17
|
id: string;
|
|
17
18
|
type: string;
|
|
18
|
-
selected: boolean;
|
|
19
|
+
selected: boolean | undefined;
|
|
19
20
|
colorVariant: Variants | undefined;
|
|
20
21
|
onChange: () => void;
|
|
21
22
|
name: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AllFields } from
|
|
2
|
+
import { AllFields } from "@web-site-utilities/common/types/FormConfig";
|
|
3
3
|
import { FormError } from '@web-site-utilities/common/types/FormError';
|
|
4
4
|
import { Nullable } from '@web-site-utilities/common/types/Nullable';
|
|
5
|
+
import { SelectProps } from "@web-site-utilities/common/components/Select";
|
|
5
6
|
type Props = {
|
|
6
7
|
type: AllFields['type'];
|
|
7
8
|
fieldProps: AllFields;
|
|
@@ -13,6 +14,6 @@ type Props = {
|
|
|
13
14
|
dataField: Nullable<string>;
|
|
14
15
|
};
|
|
15
16
|
export declare const Field: (props: Props) => React.DOMElement<{
|
|
16
|
-
children: React.FunctionComponentElement<import("@web-site-utilities/common/components/QuestionMatrix").QuestionMatrixProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Radio").RadioGroupProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Checkbox").CheckboxGroupProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/RangeSlide").RangeSlideProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Rating").RatingProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Textarea").TextareaProps> | null;
|
|
17
|
+
children: React.FunctionComponentElement<import("@web-site-utilities/common/components/QuestionMatrix").QuestionMatrixProps> | React.FunctionComponentElement<SelectProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Radio").RadioGroupProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Checkbox").CheckboxGroupProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/RangeSlide").RangeSlideProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Rating").RatingProps> | React.FunctionComponentElement<import("@web-site-utilities/common/components/Textarea").TextareaProps> | null;
|
|
17
18
|
}, Element>;
|
|
18
19
|
export {};
|
package/dist/form/App.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare const App: (props: AppProps) => string | React.FunctionComponentE
|
|
|
8
8
|
theme: typeof import("@web-site-utilities/common/theme/ThemeProvider").theme;
|
|
9
9
|
selectedVariant?: import("@web-site-utilities/common/theme/ThemeProvider").Variants;
|
|
10
10
|
children: React.ReactNode;
|
|
11
|
-
}
|
|
11
|
+
}> | null;
|
|
12
12
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FormConfigTheme, InlineForm } from
|
|
3
|
-
import { Nullable } from
|
|
2
|
+
import { FormConfigTheme, InlineForm } from "@web-site-utilities/common/types/FormConfig";
|
|
3
|
+
import { Nullable } from "@web-site-utilities/common/types/Nullable";
|
|
4
4
|
export type InPlaceFormProps = {
|
|
5
5
|
formId: string;
|
|
6
6
|
domainId: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -2934,6 +2934,7 @@ const useStepper = (props) => {
|
|
|
2934
2934
|
return {
|
|
2935
2935
|
step,
|
|
2936
2936
|
errors,
|
|
2937
|
+
isLastStep: step === props.stepsCount,
|
|
2937
2938
|
onContinue,
|
|
2938
2939
|
onBack
|
|
2939
2940
|
};
|
|
@@ -2995,16 +2996,18 @@ const CheckboxRow = dt.label((props) => ({
|
|
|
2995
2996
|
gap: "calc(var(--spacing) * 2)"
|
|
2996
2997
|
}));
|
|
2997
2998
|
const Checkbox = (props) => {
|
|
2999
|
+
var _a;
|
|
2998
3000
|
const id = React.useMemo(
|
|
2999
3001
|
() => `${props.id}-${props.label.replace(/\s/g, "-").toLowerCase()}`,
|
|
3000
3002
|
[]
|
|
3001
3003
|
);
|
|
3002
3004
|
const onSelect = (value) => {
|
|
3005
|
+
var _a2;
|
|
3003
3006
|
props.onSelect(
|
|
3004
|
-
props.value.includes(value) ? props.value.filter((v2) => v2 !== value) : [...props.value, value]
|
|
3007
|
+
((_a2 = props.value) == null ? void 0 : _a2.includes(value)) ? props.value.filter((v2) => v2 !== value) : [...props.value ?? [], value]
|
|
3005
3008
|
);
|
|
3006
3009
|
};
|
|
3007
|
-
const isSelected = props.value.includes(id);
|
|
3010
|
+
const isSelected = (_a = props.value) == null ? void 0 : _a.includes(id);
|
|
3008
3011
|
return React.createElement(CheckboxRow, {
|
|
3009
3012
|
selected: isSelected,
|
|
3010
3013
|
children: [
|
|
@@ -3555,6 +3558,79 @@ const Textarea = (props) => {
|
|
|
3555
3558
|
]
|
|
3556
3559
|
});
|
|
3557
3560
|
};
|
|
3561
|
+
const StyledOption = dt.option(() => {
|
|
3562
|
+
return {
|
|
3563
|
+
borderRadius: "var(--radius-field)",
|
|
3564
|
+
whiteSpace: "normal",
|
|
3565
|
+
paddingBlock: ".375rem",
|
|
3566
|
+
paddingInline: ".75rem",
|
|
3567
|
+
transitionProperty: "color,background-color",
|
|
3568
|
+
transitionDuration: ".2s",
|
|
3569
|
+
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
3570
|
+
};
|
|
3571
|
+
});
|
|
3572
|
+
const SelectStyled = dt.select((props) => {
|
|
3573
|
+
const color = useDefaultVariantColor(props.colorVariant);
|
|
3574
|
+
return {
|
|
3575
|
+
border: `var(--border-width)solid ${color}`,
|
|
3576
|
+
backgroundColor: "var(--color-base-100)",
|
|
3577
|
+
verticalAlign: "middle",
|
|
3578
|
+
width: "clamp(3rem,30rem,100%)",
|
|
3579
|
+
height: "calc(var(--size-field,.25rem)*10)",
|
|
3580
|
+
touchAction: "manipulation",
|
|
3581
|
+
whiteSpace: "nowrap",
|
|
3582
|
+
textOverflow: "ellipsis",
|
|
3583
|
+
borderStartStartRadius: "var(--radius-field)",
|
|
3584
|
+
borderStartEndRadius: "var(--radius-field)",
|
|
3585
|
+
borderEndEndRadius: "var(--radius-field)",
|
|
3586
|
+
borderEndStartRadius: "var(--radius-field)",
|
|
3587
|
+
flexShrink: "1",
|
|
3588
|
+
alignItems: "center",
|
|
3589
|
+
gap: ".375rem",
|
|
3590
|
+
paddingInline: ".75rem 1.75rem",
|
|
3591
|
+
fontSize: ".875rem",
|
|
3592
|
+
display: "inline-flex",
|
|
3593
|
+
position: "relative",
|
|
3594
|
+
overflow: "hidden"
|
|
3595
|
+
};
|
|
3596
|
+
});
|
|
3597
|
+
const Select = (props) => {
|
|
3598
|
+
const onChange = (e) => props.onChange(e.target.value);
|
|
3599
|
+
return React.createElement("div", {
|
|
3600
|
+
children: [
|
|
3601
|
+
React.createElement(Typography, {
|
|
3602
|
+
children: props.label,
|
|
3603
|
+
variant: "section"
|
|
3604
|
+
}),
|
|
3605
|
+
React.createElement(SelectStyled, {
|
|
3606
|
+
colorVariant: props.colorVariant,
|
|
3607
|
+
value: props.value ?? null,
|
|
3608
|
+
defaultChecked: false,
|
|
3609
|
+
defaultValue: null,
|
|
3610
|
+
onChange,
|
|
3611
|
+
children: [
|
|
3612
|
+
React.createElement(StyledOption, {
|
|
3613
|
+
value: "",
|
|
3614
|
+
selected: !props.value,
|
|
3615
|
+
children: "Select an option",
|
|
3616
|
+
key: ""
|
|
3617
|
+
}),
|
|
3618
|
+
props.options.map(
|
|
3619
|
+
(o) => React.createElement(StyledOption, {
|
|
3620
|
+
value: o.id,
|
|
3621
|
+
selected: o.id === props.value,
|
|
3622
|
+
children: o.label,
|
|
3623
|
+
key: o.id
|
|
3624
|
+
})
|
|
3625
|
+
)
|
|
3626
|
+
]
|
|
3627
|
+
}),
|
|
3628
|
+
React.createElement(ErrorMessage, {
|
|
3629
|
+
errors: props.errors
|
|
3630
|
+
})
|
|
3631
|
+
]
|
|
3632
|
+
});
|
|
3633
|
+
};
|
|
3558
3634
|
const Div$1 = dt.div`
|
|
3559
3635
|
width: 100%;
|
|
3560
3636
|
`;
|
|
@@ -3614,6 +3690,13 @@ const Field = (props) => {
|
|
|
3614
3690
|
max: 10
|
|
3615
3691
|
});
|
|
3616
3692
|
}
|
|
3693
|
+
case "select": {
|
|
3694
|
+
const fieldProps = props.fieldProps;
|
|
3695
|
+
return React.createElement(Select, {
|
|
3696
|
+
...fieldProps,
|
|
3697
|
+
...commonFields
|
|
3698
|
+
});
|
|
3699
|
+
}
|
|
3617
3700
|
case "radio-group": {
|
|
3618
3701
|
const fieldProps = props.fieldProps;
|
|
3619
3702
|
return React.createElement(RadioGroup, {
|
|
@@ -3632,7 +3715,8 @@ const Field = (props) => {
|
|
|
3632
3715
|
const fieldProps = props.fieldProps;
|
|
3633
3716
|
return React.createElement(RangeSlide, {
|
|
3634
3717
|
...fieldProps,
|
|
3635
|
-
...commonFields
|
|
3718
|
+
...commonFields,
|
|
3719
|
+
initialValue: fieldProps.defaultValue ?? 0
|
|
3636
3720
|
});
|
|
3637
3721
|
}
|
|
3638
3722
|
case "rating": {
|
|
@@ -3673,12 +3757,15 @@ const InPlaceForm = (props) => {
|
|
|
3673
3757
|
[]
|
|
3674
3758
|
);
|
|
3675
3759
|
const [maxHeight, setMaxHeight] = React.useState(null);
|
|
3676
|
-
const onSetMaxHeight = React.useCallback(
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3760
|
+
const onSetMaxHeight = React.useCallback(
|
|
3761
|
+
(h) => {
|
|
3762
|
+
setMaxHeight((stateHeight) => {
|
|
3763
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3764
|
+
return stateHeight;
|
|
3765
|
+
});
|
|
3766
|
+
},
|
|
3767
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3768
|
+
);
|
|
3682
3769
|
const populatedForm = useForm({
|
|
3683
3770
|
form: props.inlineForm.form,
|
|
3684
3771
|
formId: props.formId,
|
|
@@ -3724,7 +3811,7 @@ const InPlaceForm = (props) => {
|
|
|
3724
3811
|
React.createElement(Footer$1, {
|
|
3725
3812
|
children: [
|
|
3726
3813
|
React.createElement(Button, {
|
|
3727
|
-
children:
|
|
3814
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3728
3815
|
disabled: stepper.step === 0,
|
|
3729
3816
|
onClick: stepper.onBack
|
|
3730
3817
|
}),
|
|
@@ -3733,7 +3820,7 @@ const InPlaceForm = (props) => {
|
|
|
3733
3820
|
currentStepIndex: stepper.step
|
|
3734
3821
|
}),
|
|
3735
3822
|
React.createElement(Button, {
|
|
3736
|
-
children:
|
|
3823
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3737
3824
|
onClick: stepper.onContinue
|
|
3738
3825
|
})
|
|
3739
3826
|
]
|
|
@@ -3971,12 +4058,14 @@ const PopupForm = (props) => {
|
|
|
3971
4058
|
});
|
|
3972
4059
|
};
|
|
3973
4060
|
const App = (props) => {
|
|
4061
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
3974
4062
|
props.locale ?? "en-US";
|
|
3975
4063
|
let { data, loading, error } = useRequest(
|
|
3976
4064
|
() => getFormConfigMock({
|
|
3977
4065
|
formId: props.formId
|
|
3978
4066
|
})
|
|
3979
4067
|
);
|
|
4068
|
+
React.useEffect(() => setIsClient(true), []);
|
|
3980
4069
|
const inPlaceForm = React.useMemo(() => {
|
|
3981
4070
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
3982
4071
|
return React.createElement(InPlaceForm, {
|
|
@@ -3997,6 +4086,7 @@ const App = (props) => {
|
|
|
3997
4086
|
popupForm: data.popupForm
|
|
3998
4087
|
});
|
|
3999
4088
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4089
|
+
if (!isClient) return null;
|
|
4000
4090
|
if (!data && loading) return "Loading...";
|
|
4001
4091
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4002
4092
|
return React.createElement(ThemeProvider, {
|
|
@@ -4005,79 +4095,6 @@ const App = (props) => {
|
|
|
4005
4095
|
children: [inPlaceForm, popupForm]
|
|
4006
4096
|
});
|
|
4007
4097
|
};
|
|
4008
|
-
const StyledOption = dt.option(() => {
|
|
4009
|
-
return {
|
|
4010
|
-
borderRadius: "var(--radius-field)",
|
|
4011
|
-
whiteSpace: "normal",
|
|
4012
|
-
paddingBlock: ".375rem",
|
|
4013
|
-
paddingInline: ".75rem",
|
|
4014
|
-
transitionProperty: "color,background-color",
|
|
4015
|
-
transitionDuration: ".2s",
|
|
4016
|
-
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
4017
|
-
};
|
|
4018
|
-
});
|
|
4019
|
-
const SelectStyled = dt.select((props) => {
|
|
4020
|
-
const color = useDefaultVariantColor(props.colorVariant);
|
|
4021
|
-
return {
|
|
4022
|
-
border: `var(--border-width)solid ${color}`,
|
|
4023
|
-
backgroundColor: "var(--color-base-100)",
|
|
4024
|
-
verticalAlign: "middle",
|
|
4025
|
-
width: "clamp(3rem,30rem,100%)",
|
|
4026
|
-
height: "calc(var(--size-field,.25rem)*10)",
|
|
4027
|
-
touchAction: "manipulation",
|
|
4028
|
-
whiteSpace: "nowrap",
|
|
4029
|
-
textOverflow: "ellipsis",
|
|
4030
|
-
borderStartStartRadius: "var(--radius-field)",
|
|
4031
|
-
borderStartEndRadius: "var(--radius-field)",
|
|
4032
|
-
borderEndEndRadius: "var(--radius-field)",
|
|
4033
|
-
borderEndStartRadius: "var(--radius-field)",
|
|
4034
|
-
flexShrink: "1",
|
|
4035
|
-
alignItems: "center",
|
|
4036
|
-
gap: ".375rem",
|
|
4037
|
-
paddingInline: ".75rem 1.75rem",
|
|
4038
|
-
fontSize: ".875rem",
|
|
4039
|
-
display: "inline-flex",
|
|
4040
|
-
position: "relative",
|
|
4041
|
-
overflow: "hidden"
|
|
4042
|
-
};
|
|
4043
|
-
});
|
|
4044
|
-
const Select = (props) => {
|
|
4045
|
-
const onChange = (e) => props.onChange(e.target.value);
|
|
4046
|
-
return React.createElement("div", {
|
|
4047
|
-
children: [
|
|
4048
|
-
React.createElement(Typography, {
|
|
4049
|
-
children: props.label,
|
|
4050
|
-
variant: "section"
|
|
4051
|
-
}),
|
|
4052
|
-
React.createElement(SelectStyled, {
|
|
4053
|
-
colorVariant: props.colorVariant,
|
|
4054
|
-
value: props.value ?? null,
|
|
4055
|
-
defaultChecked: false,
|
|
4056
|
-
defaultValue: null,
|
|
4057
|
-
onChange,
|
|
4058
|
-
children: [
|
|
4059
|
-
React.createElement(StyledOption, {
|
|
4060
|
-
value: "",
|
|
4061
|
-
selected: !props.value,
|
|
4062
|
-
children: "Select an option",
|
|
4063
|
-
key: ""
|
|
4064
|
-
}),
|
|
4065
|
-
props.options.map(
|
|
4066
|
-
(o) => React.createElement(StyledOption, {
|
|
4067
|
-
value: o.id,
|
|
4068
|
-
selected: o.id === props.value,
|
|
4069
|
-
children: o.label,
|
|
4070
|
-
key: o.id
|
|
4071
|
-
})
|
|
4072
|
-
)
|
|
4073
|
-
]
|
|
4074
|
-
}),
|
|
4075
|
-
React.createElement(ErrorMessage, {
|
|
4076
|
-
errors: props.errors
|
|
4077
|
-
})
|
|
4078
|
-
]
|
|
4079
|
-
});
|
|
4080
|
-
};
|
|
4081
4098
|
const initiateFeedbackModule = (options) => {
|
|
4082
4099
|
if (!options) {
|
|
4083
4100
|
console.error("options must be provided. Feedback module deactivated");
|
package/dist/index.es.js
CHANGED
|
@@ -2932,6 +2932,7 @@ const useStepper = (props) => {
|
|
|
2932
2932
|
return {
|
|
2933
2933
|
step,
|
|
2934
2934
|
errors,
|
|
2935
|
+
isLastStep: step === props.stepsCount,
|
|
2935
2936
|
onContinue,
|
|
2936
2937
|
onBack
|
|
2937
2938
|
};
|
|
@@ -2993,16 +2994,18 @@ const CheckboxRow = dt.label((props) => ({
|
|
|
2993
2994
|
gap: "calc(var(--spacing) * 2)"
|
|
2994
2995
|
}));
|
|
2995
2996
|
const Checkbox = (props) => {
|
|
2997
|
+
var _a;
|
|
2996
2998
|
const id = useMemo(
|
|
2997
2999
|
() => `${props.id}-${props.label.replace(/\s/g, "-").toLowerCase()}`,
|
|
2998
3000
|
[]
|
|
2999
3001
|
);
|
|
3000
3002
|
const onSelect = (value) => {
|
|
3003
|
+
var _a2;
|
|
3001
3004
|
props.onSelect(
|
|
3002
|
-
props.value.includes(value) ? props.value.filter((v2) => v2 !== value) : [...props.value, value]
|
|
3005
|
+
((_a2 = props.value) == null ? void 0 : _a2.includes(value)) ? props.value.filter((v2) => v2 !== value) : [...props.value ?? [], value]
|
|
3003
3006
|
);
|
|
3004
3007
|
};
|
|
3005
|
-
const isSelected = props.value.includes(id);
|
|
3008
|
+
const isSelected = (_a = props.value) == null ? void 0 : _a.includes(id);
|
|
3006
3009
|
return React.createElement(CheckboxRow, {
|
|
3007
3010
|
selected: isSelected,
|
|
3008
3011
|
children: [
|
|
@@ -3553,6 +3556,79 @@ const Textarea = (props) => {
|
|
|
3553
3556
|
]
|
|
3554
3557
|
});
|
|
3555
3558
|
};
|
|
3559
|
+
const StyledOption = dt.option(() => {
|
|
3560
|
+
return {
|
|
3561
|
+
borderRadius: "var(--radius-field)",
|
|
3562
|
+
whiteSpace: "normal",
|
|
3563
|
+
paddingBlock: ".375rem",
|
|
3564
|
+
paddingInline: ".75rem",
|
|
3565
|
+
transitionProperty: "color,background-color",
|
|
3566
|
+
transitionDuration: ".2s",
|
|
3567
|
+
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
3568
|
+
};
|
|
3569
|
+
});
|
|
3570
|
+
const SelectStyled = dt.select((props) => {
|
|
3571
|
+
const color = useDefaultVariantColor(props.colorVariant);
|
|
3572
|
+
return {
|
|
3573
|
+
border: `var(--border-width)solid ${color}`,
|
|
3574
|
+
backgroundColor: "var(--color-base-100)",
|
|
3575
|
+
verticalAlign: "middle",
|
|
3576
|
+
width: "clamp(3rem,30rem,100%)",
|
|
3577
|
+
height: "calc(var(--size-field,.25rem)*10)",
|
|
3578
|
+
touchAction: "manipulation",
|
|
3579
|
+
whiteSpace: "nowrap",
|
|
3580
|
+
textOverflow: "ellipsis",
|
|
3581
|
+
borderStartStartRadius: "var(--radius-field)",
|
|
3582
|
+
borderStartEndRadius: "var(--radius-field)",
|
|
3583
|
+
borderEndEndRadius: "var(--radius-field)",
|
|
3584
|
+
borderEndStartRadius: "var(--radius-field)",
|
|
3585
|
+
flexShrink: "1",
|
|
3586
|
+
alignItems: "center",
|
|
3587
|
+
gap: ".375rem",
|
|
3588
|
+
paddingInline: ".75rem 1.75rem",
|
|
3589
|
+
fontSize: ".875rem",
|
|
3590
|
+
display: "inline-flex",
|
|
3591
|
+
position: "relative",
|
|
3592
|
+
overflow: "hidden"
|
|
3593
|
+
};
|
|
3594
|
+
});
|
|
3595
|
+
const Select = (props) => {
|
|
3596
|
+
const onChange = (e) => props.onChange(e.target.value);
|
|
3597
|
+
return React.createElement("div", {
|
|
3598
|
+
children: [
|
|
3599
|
+
React.createElement(Typography, {
|
|
3600
|
+
children: props.label,
|
|
3601
|
+
variant: "section"
|
|
3602
|
+
}),
|
|
3603
|
+
React.createElement(SelectStyled, {
|
|
3604
|
+
colorVariant: props.colorVariant,
|
|
3605
|
+
value: props.value ?? null,
|
|
3606
|
+
defaultChecked: false,
|
|
3607
|
+
defaultValue: null,
|
|
3608
|
+
onChange,
|
|
3609
|
+
children: [
|
|
3610
|
+
React.createElement(StyledOption, {
|
|
3611
|
+
value: "",
|
|
3612
|
+
selected: !props.value,
|
|
3613
|
+
children: "Select an option",
|
|
3614
|
+
key: ""
|
|
3615
|
+
}),
|
|
3616
|
+
props.options.map(
|
|
3617
|
+
(o) => React.createElement(StyledOption, {
|
|
3618
|
+
value: o.id,
|
|
3619
|
+
selected: o.id === props.value,
|
|
3620
|
+
children: o.label,
|
|
3621
|
+
key: o.id
|
|
3622
|
+
})
|
|
3623
|
+
)
|
|
3624
|
+
]
|
|
3625
|
+
}),
|
|
3626
|
+
React.createElement(ErrorMessage, {
|
|
3627
|
+
errors: props.errors
|
|
3628
|
+
})
|
|
3629
|
+
]
|
|
3630
|
+
});
|
|
3631
|
+
};
|
|
3556
3632
|
const Div$1 = dt.div`
|
|
3557
3633
|
width: 100%;
|
|
3558
3634
|
`;
|
|
@@ -3612,6 +3688,13 @@ const Field = (props) => {
|
|
|
3612
3688
|
max: 10
|
|
3613
3689
|
});
|
|
3614
3690
|
}
|
|
3691
|
+
case "select": {
|
|
3692
|
+
const fieldProps = props.fieldProps;
|
|
3693
|
+
return React.createElement(Select, {
|
|
3694
|
+
...fieldProps,
|
|
3695
|
+
...commonFields
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3615
3698
|
case "radio-group": {
|
|
3616
3699
|
const fieldProps = props.fieldProps;
|
|
3617
3700
|
return React.createElement(RadioGroup, {
|
|
@@ -3630,7 +3713,8 @@ const Field = (props) => {
|
|
|
3630
3713
|
const fieldProps = props.fieldProps;
|
|
3631
3714
|
return React.createElement(RangeSlide, {
|
|
3632
3715
|
...fieldProps,
|
|
3633
|
-
...commonFields
|
|
3716
|
+
...commonFields,
|
|
3717
|
+
initialValue: fieldProps.defaultValue ?? 0
|
|
3634
3718
|
});
|
|
3635
3719
|
}
|
|
3636
3720
|
case "rating": {
|
|
@@ -3671,12 +3755,15 @@ const InPlaceForm = (props) => {
|
|
|
3671
3755
|
[]
|
|
3672
3756
|
);
|
|
3673
3757
|
const [maxHeight, setMaxHeight] = React.useState(null);
|
|
3674
|
-
const onSetMaxHeight = useCallback(
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3758
|
+
const onSetMaxHeight = useCallback(
|
|
3759
|
+
(h) => {
|
|
3760
|
+
setMaxHeight((stateHeight) => {
|
|
3761
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3762
|
+
return stateHeight;
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3766
|
+
);
|
|
3680
3767
|
const populatedForm = useForm({
|
|
3681
3768
|
form: props.inlineForm.form,
|
|
3682
3769
|
formId: props.formId,
|
|
@@ -3722,7 +3809,7 @@ const InPlaceForm = (props) => {
|
|
|
3722
3809
|
React.createElement(Footer$1, {
|
|
3723
3810
|
children: [
|
|
3724
3811
|
React.createElement(Button, {
|
|
3725
|
-
children:
|
|
3812
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3726
3813
|
disabled: stepper.step === 0,
|
|
3727
3814
|
onClick: stepper.onBack
|
|
3728
3815
|
}),
|
|
@@ -3731,7 +3818,7 @@ const InPlaceForm = (props) => {
|
|
|
3731
3818
|
currentStepIndex: stepper.step
|
|
3732
3819
|
}),
|
|
3733
3820
|
React.createElement(Button, {
|
|
3734
|
-
children:
|
|
3821
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3735
3822
|
onClick: stepper.onContinue
|
|
3736
3823
|
})
|
|
3737
3824
|
]
|
|
@@ -3969,12 +4056,14 @@ const PopupForm = (props) => {
|
|
|
3969
4056
|
});
|
|
3970
4057
|
};
|
|
3971
4058
|
const App = (props) => {
|
|
4059
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
3972
4060
|
props.locale ?? "en-US";
|
|
3973
4061
|
let { data, loading, error } = useRequest(
|
|
3974
4062
|
() => getFormConfigMock({
|
|
3975
4063
|
formId: props.formId
|
|
3976
4064
|
})
|
|
3977
4065
|
);
|
|
4066
|
+
React.useEffect(() => setIsClient(true), []);
|
|
3978
4067
|
const inPlaceForm = useMemo(() => {
|
|
3979
4068
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
3980
4069
|
return React.createElement(InPlaceForm, {
|
|
@@ -3995,6 +4084,7 @@ const App = (props) => {
|
|
|
3995
4084
|
popupForm: data.popupForm
|
|
3996
4085
|
});
|
|
3997
4086
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4087
|
+
if (!isClient) return null;
|
|
3998
4088
|
if (!data && loading) return "Loading...";
|
|
3999
4089
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4000
4090
|
return React.createElement(ThemeProvider, {
|
|
@@ -4003,79 +4093,6 @@ const App = (props) => {
|
|
|
4003
4093
|
children: [inPlaceForm, popupForm]
|
|
4004
4094
|
});
|
|
4005
4095
|
};
|
|
4006
|
-
const StyledOption = dt.option(() => {
|
|
4007
|
-
return {
|
|
4008
|
-
borderRadius: "var(--radius-field)",
|
|
4009
|
-
whiteSpace: "normal",
|
|
4010
|
-
paddingBlock: ".375rem",
|
|
4011
|
-
paddingInline: ".75rem",
|
|
4012
|
-
transitionProperty: "color,background-color",
|
|
4013
|
-
transitionDuration: ".2s",
|
|
4014
|
-
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
4015
|
-
};
|
|
4016
|
-
});
|
|
4017
|
-
const SelectStyled = dt.select((props) => {
|
|
4018
|
-
const color = useDefaultVariantColor(props.colorVariant);
|
|
4019
|
-
return {
|
|
4020
|
-
border: `var(--border-width)solid ${color}`,
|
|
4021
|
-
backgroundColor: "var(--color-base-100)",
|
|
4022
|
-
verticalAlign: "middle",
|
|
4023
|
-
width: "clamp(3rem,30rem,100%)",
|
|
4024
|
-
height: "calc(var(--size-field,.25rem)*10)",
|
|
4025
|
-
touchAction: "manipulation",
|
|
4026
|
-
whiteSpace: "nowrap",
|
|
4027
|
-
textOverflow: "ellipsis",
|
|
4028
|
-
borderStartStartRadius: "var(--radius-field)",
|
|
4029
|
-
borderStartEndRadius: "var(--radius-field)",
|
|
4030
|
-
borderEndEndRadius: "var(--radius-field)",
|
|
4031
|
-
borderEndStartRadius: "var(--radius-field)",
|
|
4032
|
-
flexShrink: "1",
|
|
4033
|
-
alignItems: "center",
|
|
4034
|
-
gap: ".375rem",
|
|
4035
|
-
paddingInline: ".75rem 1.75rem",
|
|
4036
|
-
fontSize: ".875rem",
|
|
4037
|
-
display: "inline-flex",
|
|
4038
|
-
position: "relative",
|
|
4039
|
-
overflow: "hidden"
|
|
4040
|
-
};
|
|
4041
|
-
});
|
|
4042
|
-
const Select = (props) => {
|
|
4043
|
-
const onChange = (e) => props.onChange(e.target.value);
|
|
4044
|
-
return React.createElement("div", {
|
|
4045
|
-
children: [
|
|
4046
|
-
React.createElement(Typography, {
|
|
4047
|
-
children: props.label,
|
|
4048
|
-
variant: "section"
|
|
4049
|
-
}),
|
|
4050
|
-
React.createElement(SelectStyled, {
|
|
4051
|
-
colorVariant: props.colorVariant,
|
|
4052
|
-
value: props.value ?? null,
|
|
4053
|
-
defaultChecked: false,
|
|
4054
|
-
defaultValue: null,
|
|
4055
|
-
onChange,
|
|
4056
|
-
children: [
|
|
4057
|
-
React.createElement(StyledOption, {
|
|
4058
|
-
value: "",
|
|
4059
|
-
selected: !props.value,
|
|
4060
|
-
children: "Select an option",
|
|
4061
|
-
key: ""
|
|
4062
|
-
}),
|
|
4063
|
-
props.options.map(
|
|
4064
|
-
(o) => React.createElement(StyledOption, {
|
|
4065
|
-
value: o.id,
|
|
4066
|
-
selected: o.id === props.value,
|
|
4067
|
-
children: o.label,
|
|
4068
|
-
key: o.id
|
|
4069
|
-
})
|
|
4070
|
-
)
|
|
4071
|
-
]
|
|
4072
|
-
}),
|
|
4073
|
-
React.createElement(ErrorMessage, {
|
|
4074
|
-
errors: props.errors
|
|
4075
|
-
})
|
|
4076
|
-
]
|
|
4077
|
-
});
|
|
4078
|
-
};
|
|
4079
4096
|
const initiateFeedbackModule = (options) => {
|
|
4080
4097
|
if (!options) {
|
|
4081
4098
|
console.error("options must be provided. Feedback module deactivated");
|
package/dist/index.iife.js
CHANGED
|
@@ -2932,6 +2932,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
2932
2932
|
return {
|
|
2933
2933
|
step,
|
|
2934
2934
|
errors,
|
|
2935
|
+
isLastStep: step === props.stepsCount,
|
|
2935
2936
|
onContinue,
|
|
2936
2937
|
onBack
|
|
2937
2938
|
};
|
|
@@ -2993,16 +2994,18 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
2993
2994
|
gap: "calc(var(--spacing) * 2)"
|
|
2994
2995
|
}));
|
|
2995
2996
|
const Checkbox = (props) => {
|
|
2997
|
+
var _a;
|
|
2996
2998
|
const id = React2.useMemo(
|
|
2997
2999
|
() => `${props.id}-${props.label.replace(/\s/g, "-").toLowerCase()}`,
|
|
2998
3000
|
[]
|
|
2999
3001
|
);
|
|
3000
3002
|
const onSelect = (value) => {
|
|
3003
|
+
var _a2;
|
|
3001
3004
|
props.onSelect(
|
|
3002
|
-
props.value.includes(value) ? props.value.filter((v2) => v2 !== value) : [...props.value, value]
|
|
3005
|
+
((_a2 = props.value) == null ? void 0 : _a2.includes(value)) ? props.value.filter((v2) => v2 !== value) : [...props.value ?? [], value]
|
|
3003
3006
|
);
|
|
3004
3007
|
};
|
|
3005
|
-
const isSelected = props.value.includes(id);
|
|
3008
|
+
const isSelected = (_a = props.value) == null ? void 0 : _a.includes(id);
|
|
3006
3009
|
return React2.createElement(CheckboxRow, {
|
|
3007
3010
|
selected: isSelected,
|
|
3008
3011
|
children: [
|
|
@@ -3553,6 +3556,79 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3553
3556
|
]
|
|
3554
3557
|
});
|
|
3555
3558
|
};
|
|
3559
|
+
const StyledOption = dt.option(() => {
|
|
3560
|
+
return {
|
|
3561
|
+
borderRadius: "var(--radius-field)",
|
|
3562
|
+
whiteSpace: "normal",
|
|
3563
|
+
paddingBlock: ".375rem",
|
|
3564
|
+
paddingInline: ".75rem",
|
|
3565
|
+
transitionProperty: "color,background-color",
|
|
3566
|
+
transitionDuration: ".2s",
|
|
3567
|
+
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
3568
|
+
};
|
|
3569
|
+
});
|
|
3570
|
+
const SelectStyled = dt.select((props) => {
|
|
3571
|
+
const color = useDefaultVariantColor(props.colorVariant);
|
|
3572
|
+
return {
|
|
3573
|
+
border: `var(--border-width)solid ${color}`,
|
|
3574
|
+
backgroundColor: "var(--color-base-100)",
|
|
3575
|
+
verticalAlign: "middle",
|
|
3576
|
+
width: "clamp(3rem,30rem,100%)",
|
|
3577
|
+
height: "calc(var(--size-field,.25rem)*10)",
|
|
3578
|
+
touchAction: "manipulation",
|
|
3579
|
+
whiteSpace: "nowrap",
|
|
3580
|
+
textOverflow: "ellipsis",
|
|
3581
|
+
borderStartStartRadius: "var(--radius-field)",
|
|
3582
|
+
borderStartEndRadius: "var(--radius-field)",
|
|
3583
|
+
borderEndEndRadius: "var(--radius-field)",
|
|
3584
|
+
borderEndStartRadius: "var(--radius-field)",
|
|
3585
|
+
flexShrink: "1",
|
|
3586
|
+
alignItems: "center",
|
|
3587
|
+
gap: ".375rem",
|
|
3588
|
+
paddingInline: ".75rem 1.75rem",
|
|
3589
|
+
fontSize: ".875rem",
|
|
3590
|
+
display: "inline-flex",
|
|
3591
|
+
position: "relative",
|
|
3592
|
+
overflow: "hidden"
|
|
3593
|
+
};
|
|
3594
|
+
});
|
|
3595
|
+
const Select = (props) => {
|
|
3596
|
+
const onChange = (e) => props.onChange(e.target.value);
|
|
3597
|
+
return React2.createElement("div", {
|
|
3598
|
+
children: [
|
|
3599
|
+
React2.createElement(Typography, {
|
|
3600
|
+
children: props.label,
|
|
3601
|
+
variant: "section"
|
|
3602
|
+
}),
|
|
3603
|
+
React2.createElement(SelectStyled, {
|
|
3604
|
+
colorVariant: props.colorVariant,
|
|
3605
|
+
value: props.value ?? null,
|
|
3606
|
+
defaultChecked: false,
|
|
3607
|
+
defaultValue: null,
|
|
3608
|
+
onChange,
|
|
3609
|
+
children: [
|
|
3610
|
+
React2.createElement(StyledOption, {
|
|
3611
|
+
value: "",
|
|
3612
|
+
selected: !props.value,
|
|
3613
|
+
children: "Select an option",
|
|
3614
|
+
key: ""
|
|
3615
|
+
}),
|
|
3616
|
+
props.options.map(
|
|
3617
|
+
(o) => React2.createElement(StyledOption, {
|
|
3618
|
+
value: o.id,
|
|
3619
|
+
selected: o.id === props.value,
|
|
3620
|
+
children: o.label,
|
|
3621
|
+
key: o.id
|
|
3622
|
+
})
|
|
3623
|
+
)
|
|
3624
|
+
]
|
|
3625
|
+
}),
|
|
3626
|
+
React2.createElement(ErrorMessage, {
|
|
3627
|
+
errors: props.errors
|
|
3628
|
+
})
|
|
3629
|
+
]
|
|
3630
|
+
});
|
|
3631
|
+
};
|
|
3556
3632
|
const Div$1 = dt.div`
|
|
3557
3633
|
width: 100%;
|
|
3558
3634
|
`;
|
|
@@ -3612,6 +3688,13 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3612
3688
|
max: 10
|
|
3613
3689
|
});
|
|
3614
3690
|
}
|
|
3691
|
+
case "select": {
|
|
3692
|
+
const fieldProps = props.fieldProps;
|
|
3693
|
+
return React2.createElement(Select, {
|
|
3694
|
+
...fieldProps,
|
|
3695
|
+
...commonFields
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3615
3698
|
case "radio-group": {
|
|
3616
3699
|
const fieldProps = props.fieldProps;
|
|
3617
3700
|
return React2.createElement(RadioGroup, {
|
|
@@ -3630,7 +3713,8 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3630
3713
|
const fieldProps = props.fieldProps;
|
|
3631
3714
|
return React2.createElement(RangeSlide, {
|
|
3632
3715
|
...fieldProps,
|
|
3633
|
-
...commonFields
|
|
3716
|
+
...commonFields,
|
|
3717
|
+
initialValue: fieldProps.defaultValue ?? 0
|
|
3634
3718
|
});
|
|
3635
3719
|
}
|
|
3636
3720
|
case "rating": {
|
|
@@ -3671,12 +3755,15 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3671
3755
|
[]
|
|
3672
3756
|
);
|
|
3673
3757
|
const [maxHeight, setMaxHeight] = React2.useState(null);
|
|
3674
|
-
const onSetMaxHeight = React2.useCallback(
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3758
|
+
const onSetMaxHeight = React2.useCallback(
|
|
3759
|
+
(h) => {
|
|
3760
|
+
setMaxHeight((stateHeight) => {
|
|
3761
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3762
|
+
return stateHeight;
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3766
|
+
);
|
|
3680
3767
|
const populatedForm = useForm({
|
|
3681
3768
|
form: props.inlineForm.form,
|
|
3682
3769
|
formId: props.formId,
|
|
@@ -3722,7 +3809,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3722
3809
|
React2.createElement(Footer$1, {
|
|
3723
3810
|
children: [
|
|
3724
3811
|
React2.createElement(Button, {
|
|
3725
|
-
children:
|
|
3812
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3726
3813
|
disabled: stepper.step === 0,
|
|
3727
3814
|
onClick: stepper.onBack
|
|
3728
3815
|
}),
|
|
@@ -3731,7 +3818,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3731
3818
|
currentStepIndex: stepper.step
|
|
3732
3819
|
}),
|
|
3733
3820
|
React2.createElement(Button, {
|
|
3734
|
-
children:
|
|
3821
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3735
3822
|
onClick: stepper.onContinue
|
|
3736
3823
|
})
|
|
3737
3824
|
]
|
|
@@ -3969,12 +4056,14 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3969
4056
|
});
|
|
3970
4057
|
};
|
|
3971
4058
|
const App = (props) => {
|
|
4059
|
+
const [isClient, setIsClient] = React2.useState(false);
|
|
3972
4060
|
props.locale ?? "en-US";
|
|
3973
4061
|
let { data, loading, error } = useRequest(
|
|
3974
4062
|
() => getFormConfigMock({
|
|
3975
4063
|
formId: props.formId
|
|
3976
4064
|
})
|
|
3977
4065
|
);
|
|
4066
|
+
React2.useEffect(() => setIsClient(true), []);
|
|
3978
4067
|
const inPlaceForm = React2.useMemo(() => {
|
|
3979
4068
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
3980
4069
|
return React2.createElement(InPlaceForm, {
|
|
@@ -3995,6 +4084,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3995
4084
|
popupForm: data.popupForm
|
|
3996
4085
|
});
|
|
3997
4086
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4087
|
+
if (!isClient) return null;
|
|
3998
4088
|
if (!data && loading) return "Loading...";
|
|
3999
4089
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4000
4090
|
return React2.createElement(ThemeProvider, {
|
|
@@ -4003,79 +4093,6 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
4003
4093
|
children: [inPlaceForm, popupForm]
|
|
4004
4094
|
});
|
|
4005
4095
|
};
|
|
4006
|
-
const StyledOption = dt.option(() => {
|
|
4007
|
-
return {
|
|
4008
|
-
borderRadius: "var(--radius-field)",
|
|
4009
|
-
whiteSpace: "normal",
|
|
4010
|
-
paddingBlock: ".375rem",
|
|
4011
|
-
paddingInline: ".75rem",
|
|
4012
|
-
transitionProperty: "color,background-color",
|
|
4013
|
-
transitionDuration: ".2s",
|
|
4014
|
-
transitionTimingFunction: "cubic-bezier(0,0,.2,1)"
|
|
4015
|
-
};
|
|
4016
|
-
});
|
|
4017
|
-
const SelectStyled = dt.select((props) => {
|
|
4018
|
-
const color = useDefaultVariantColor(props.colorVariant);
|
|
4019
|
-
return {
|
|
4020
|
-
border: `var(--border-width)solid ${color}`,
|
|
4021
|
-
backgroundColor: "var(--color-base-100)",
|
|
4022
|
-
verticalAlign: "middle",
|
|
4023
|
-
width: "clamp(3rem,30rem,100%)",
|
|
4024
|
-
height: "calc(var(--size-field,.25rem)*10)",
|
|
4025
|
-
touchAction: "manipulation",
|
|
4026
|
-
whiteSpace: "nowrap",
|
|
4027
|
-
textOverflow: "ellipsis",
|
|
4028
|
-
borderStartStartRadius: "var(--radius-field)",
|
|
4029
|
-
borderStartEndRadius: "var(--radius-field)",
|
|
4030
|
-
borderEndEndRadius: "var(--radius-field)",
|
|
4031
|
-
borderEndStartRadius: "var(--radius-field)",
|
|
4032
|
-
flexShrink: "1",
|
|
4033
|
-
alignItems: "center",
|
|
4034
|
-
gap: ".375rem",
|
|
4035
|
-
paddingInline: ".75rem 1.75rem",
|
|
4036
|
-
fontSize: ".875rem",
|
|
4037
|
-
display: "inline-flex",
|
|
4038
|
-
position: "relative",
|
|
4039
|
-
overflow: "hidden"
|
|
4040
|
-
};
|
|
4041
|
-
});
|
|
4042
|
-
const Select = (props) => {
|
|
4043
|
-
const onChange = (e) => props.onChange(e.target.value);
|
|
4044
|
-
return React2.createElement("div", {
|
|
4045
|
-
children: [
|
|
4046
|
-
React2.createElement(Typography, {
|
|
4047
|
-
children: props.label,
|
|
4048
|
-
variant: "section"
|
|
4049
|
-
}),
|
|
4050
|
-
React2.createElement(SelectStyled, {
|
|
4051
|
-
colorVariant: props.colorVariant,
|
|
4052
|
-
value: props.value ?? null,
|
|
4053
|
-
defaultChecked: false,
|
|
4054
|
-
defaultValue: null,
|
|
4055
|
-
onChange,
|
|
4056
|
-
children: [
|
|
4057
|
-
React2.createElement(StyledOption, {
|
|
4058
|
-
value: "",
|
|
4059
|
-
selected: !props.value,
|
|
4060
|
-
children: "Select an option",
|
|
4061
|
-
key: ""
|
|
4062
|
-
}),
|
|
4063
|
-
props.options.map(
|
|
4064
|
-
(o) => React2.createElement(StyledOption, {
|
|
4065
|
-
value: o.id,
|
|
4066
|
-
selected: o.id === props.value,
|
|
4067
|
-
children: o.label,
|
|
4068
|
-
key: o.id
|
|
4069
|
-
})
|
|
4070
|
-
)
|
|
4071
|
-
]
|
|
4072
|
-
}),
|
|
4073
|
-
React2.createElement(ErrorMessage, {
|
|
4074
|
-
errors: props.errors
|
|
4075
|
-
})
|
|
4076
|
-
]
|
|
4077
|
-
});
|
|
4078
|
-
};
|
|
4079
4096
|
const initiateFeedbackModule = (options) => {
|
|
4080
4097
|
if (!options) {
|
|
4081
4098
|
console.error("options must be provided. Feedback module deactivated");
|