@arquimedes.co/eureka-forms 3.0.45-mui9 → 3.0.45-next-fix
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/@Types/FormStep.d.ts +2 -4
- package/dist/@Types/GenericFormSteps.d.ts +1 -1
- package/dist/App/AppHooks.js +13 -13
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +5 -7
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +3 -5
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +5 -7
- package/dist/FormSteps/AYFStepMapper.js +2 -2
- package/dist/FormSteps/DatePickerRangeStep/MaterialDatePickerRangeStep/MaterialDatePickerRangeStep.js +3 -3
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +5 -7
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +1 -1
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +1 -1
- package/dist/FormSteps/StepFunctions.js +1 -1
- package/dist/Shared/ErkButton/ErkButton.stories.d.ts +16 -0
- package/dist/Shared/ErkButton/ErkButton.stories.js +28 -0
- package/dist/Shared/ErkCheckbox/ErkCheckBox.d.ts +0 -1
- package/dist/Shared/ErkCheckbox/ErkCheckBox.js +2 -2
- package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.d.ts +13 -0
- package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +34 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +33 -44
- package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.d.ts +23 -0
- package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.js +98 -0
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +1 -4
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +23 -40
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.stories.d.ts +36 -0
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.stories.js +274 -0
- package/dist/Shared/ErkMenuItem.d.ts +1 -1
- package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
- package/dist/Shared/ErkSelect/ErkSelect.stories.d.ts +21 -0
- package/dist/Shared/ErkSelect/ErkSelect.stories.js +87 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.d.ts +26 -0
- package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.js +159 -0
- package/dist/Shared/ErkTextField/ErkTextField.d.ts +2 -17
- package/dist/Shared/ErkTextField/ErkTextField.js +3 -3
- package/dist/Shared/ErkTextField/ErkTextField.stories.d.ts +24 -0
- package/dist/Shared/ErkTextField/ErkTextField.stories.js +99 -0
- package/dist/Shared/ErkTimePicker/ErkTimePicker.js +1 -1
- package/dist/Shared/Navbar/Navbar.stories.d.ts +13 -0
- package/dist/Shared/Navbar/Navbar.stories.js +13 -0
- package/dist/Shared/Rating/Rating.stories.d.ts +15 -0
- package/dist/Shared/Rating/Rating.stories.js +47 -0
- package/dist/Shared/Rating/Ratings/ScaleRating.js +1 -1
- package/dist/States/GlobalSlice.d.ts +26 -8
- package/dist/States/GlobalSlice.js +2 -3
- package/dist/States/SiteSlice.d.ts +33 -8
- package/dist/States/SiteSlice.js +9 -11
- package/dist/States/WidthStatsSlice.d.ts +1 -5
- package/dist/Utils/DraftFunctions.js +1 -1
- package/dist/index.css +0 -7
- package/dist/main.d.ts +1 -1
- package/dist/main.js +1 -1
- package/package.json +33 -34
- package/dist/FormSteps/@StoryDecorators/FormStepDecorator.d.ts +0 -9
- package/dist/FormSteps/@StoryDecorators/FormStepDecorator.js +0 -86
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ErkSmartSelect from './ErkSmartSelect';
|
|
3
|
+
import { useArgs } from 'storybook/internal/preview-api';
|
|
4
|
+
const meta = {
|
|
5
|
+
component: ErkSmartSelect,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
args: {
|
|
8
|
+
searchable: false,
|
|
9
|
+
readOnly: false,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Empty = {
|
|
14
|
+
args: {
|
|
15
|
+
label: 'Label',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const Default = {
|
|
19
|
+
args: {
|
|
20
|
+
label: 'Label',
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
label: 'Option',
|
|
24
|
+
value: 'option',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
play: async ({ canvas, userEvent }) => {
|
|
29
|
+
const selector = canvas.getByTestId('smart-select');
|
|
30
|
+
await userEvent.click(selector);
|
|
31
|
+
const option = canvas.getByTestId('smart-select-option');
|
|
32
|
+
await userEvent.click(option);
|
|
33
|
+
},
|
|
34
|
+
render: function Component(args) {
|
|
35
|
+
const [, setArgs] = useArgs();
|
|
36
|
+
const onValueChange = (value) => {
|
|
37
|
+
args.onChange?.(value);
|
|
38
|
+
setArgs({ value });
|
|
39
|
+
};
|
|
40
|
+
return _jsx(ErkSmartSelect, { ...args, onChange: onValueChange });
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export const Focused = {
|
|
44
|
+
args: {
|
|
45
|
+
label: 'Label',
|
|
46
|
+
},
|
|
47
|
+
play: async ({ canvas, userEvent }) => {
|
|
48
|
+
const selector = canvas.getByTestId('smart-select');
|
|
49
|
+
await userEvent.click(selector);
|
|
50
|
+
const option = canvas.getByTestId('smart-select-empty');
|
|
51
|
+
await userEvent.click(option);
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
export const FocusedSearchable = {
|
|
55
|
+
args: {
|
|
56
|
+
label: 'Label',
|
|
57
|
+
searchable: true,
|
|
58
|
+
},
|
|
59
|
+
play: async ({ canvas, userEvent }) => {
|
|
60
|
+
const selector = canvas.getByTestId('smart-select');
|
|
61
|
+
await userEvent.click(selector);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const SearchableWithOptions = {
|
|
65
|
+
args: {
|
|
66
|
+
label: 'Label',
|
|
67
|
+
searchable: true,
|
|
68
|
+
options: [
|
|
69
|
+
{
|
|
70
|
+
label: 'Option',
|
|
71
|
+
value: 'option',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
play: async ({ canvas, userEvent }) => {
|
|
76
|
+
const selector = canvas.getByTestId('smart-select');
|
|
77
|
+
await userEvent.click(selector);
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
export const SearchableWithSearchAndOptions = {
|
|
81
|
+
args: {
|
|
82
|
+
label: 'Label',
|
|
83
|
+
searchable: true,
|
|
84
|
+
value: 'Opt',
|
|
85
|
+
options: [
|
|
86
|
+
{
|
|
87
|
+
label: 'Option',
|
|
88
|
+
value: 'option',
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
play: async ({ canvas, userEvent }) => {
|
|
93
|
+
const selector = canvas.getByTestId('smart-select');
|
|
94
|
+
await userEvent.click(selector);
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
export const Loading = {
|
|
98
|
+
args: {
|
|
99
|
+
label: 'Label',
|
|
100
|
+
loading: true,
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
export const LoadingOpened = {
|
|
104
|
+
args: {
|
|
105
|
+
label: 'Label',
|
|
106
|
+
loading: true,
|
|
107
|
+
},
|
|
108
|
+
play: async ({ canvas, userEvent }) => {
|
|
109
|
+
const selector = canvas.getByTestId('smart-select');
|
|
110
|
+
await userEvent.click(selector);
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
export const SearchableLoadingOpened = {
|
|
114
|
+
args: {
|
|
115
|
+
label: 'Label',
|
|
116
|
+
searchable: true,
|
|
117
|
+
loading: true,
|
|
118
|
+
},
|
|
119
|
+
play: async ({ canvas, userEvent }) => {
|
|
120
|
+
const selector = canvas.getByTestId('smart-select');
|
|
121
|
+
await userEvent.click(selector);
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
export const WithValueandLabel = {
|
|
125
|
+
args: {
|
|
126
|
+
label: 'Label',
|
|
127
|
+
value: 'Textinput Value',
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
export const Full = {
|
|
131
|
+
args: {
|
|
132
|
+
label: 'Label',
|
|
133
|
+
value: 'Value',
|
|
134
|
+
helperText: 'Helper text',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
export const Error = {
|
|
138
|
+
args: {
|
|
139
|
+
label: 'Label',
|
|
140
|
+
value: 'Value',
|
|
141
|
+
helperText: 'Helper text',
|
|
142
|
+
error: true,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
export const ErrorColor = {
|
|
146
|
+
args: {
|
|
147
|
+
label: 'Label',
|
|
148
|
+
value: 'Value',
|
|
149
|
+
helperText: 'Helper text',
|
|
150
|
+
error: true,
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
export const DifferentColors = {
|
|
154
|
+
args: {
|
|
155
|
+
label: 'Label',
|
|
156
|
+
value: 'Value',
|
|
157
|
+
helperText: 'Helper text',
|
|
158
|
+
},
|
|
159
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OutlinedTextFieldProps as MuiTextFieldProps } from '@mui/material';
|
|
2
2
|
import React, { CSSProperties } from 'react';
|
|
3
3
|
interface StyleProps extends Pick<CSSProperties, 'textAlign' | 'fontSize' | 'padding' | 'fontWeight' | 'backgroundColor' | 'borderRadius'> {
|
|
4
4
|
readOnly?: boolean;
|
|
@@ -11,20 +11,7 @@ declare module '@mui/material/TextField' {
|
|
|
11
11
|
export declare const StyledTextField: import("@emotion/styled").StyledComponent<{
|
|
12
12
|
variant?: import("@mui/material").TextFieldVariants | undefined;
|
|
13
13
|
} & Omit<import("@mui/material").FilledTextFieldProps | MuiTextFieldProps | import("@mui/material").StandardTextFieldProps, "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & Omit<ErkTextFieldProps, "onChange"> & StyleProps, {}, {}>;
|
|
14
|
-
|
|
15
|
-
export interface ErkTextFieldSlotProps {
|
|
16
|
-
size?: 'small' | 'medium';
|
|
17
|
-
error?: boolean;
|
|
18
|
-
disabled?: boolean;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
helperText?: React.ReactNode;
|
|
21
|
-
labelMargin?: number;
|
|
22
|
-
fullWidth?: boolean;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
InputProps?: {
|
|
25
|
-
readOnly?: boolean;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
14
|
+
export type ErkTextFieldSlotProps = Omit<ErkTextFieldProps, 'value' | 'onChange' | 'fullWidth'>;
|
|
28
15
|
export interface ErkTextFieldProps extends Omit<MuiTextFieldProps, 'variant' | 'onChange' | 'ref'>, StyleProps {
|
|
29
16
|
/** The value of the textfield */
|
|
30
17
|
value?: string | number;
|
|
@@ -37,8 +24,6 @@ export interface ErkTextFieldProps extends Omit<MuiTextFieldProps, 'variant' | '
|
|
|
37
24
|
errorBorder?: boolean;
|
|
38
25
|
/** labelMargin */
|
|
39
26
|
labelMargin?: number;
|
|
40
|
-
/** Props applied to the Input component (for passing min, max, etc.) */
|
|
41
|
-
inputProps?: Partial<InputProps>;
|
|
42
27
|
}
|
|
43
28
|
/**
|
|
44
29
|
* Generic textfield with apps designs. Is class due to the use in the react-hook-forms library
|
|
@@ -94,7 +94,7 @@ export const StyledTextField = styled(MuiTextField, {
|
|
|
94
94
|
color: theme.palette.text.primary + 'a0',
|
|
95
95
|
},
|
|
96
96
|
}));
|
|
97
|
-
function CustomTextfield({ onChange, value = '', IconComponent, size = 'small', fullWidth = true,
|
|
97
|
+
function CustomTextfield({ onChange, value = '', IconComponent, size = 'small', fullWidth = true, ...others }) {
|
|
98
98
|
const { readOnly, disabled, maxLength } = others;
|
|
99
99
|
const { palette } = useTheme();
|
|
100
100
|
const handleChange = useCallback((event) => {
|
|
@@ -102,7 +102,7 @@ function CustomTextfield({ onChange, value = '', IconComponent, size = 'small',
|
|
|
102
102
|
}, [onChange]);
|
|
103
103
|
const inputProps = useMemo(() => {
|
|
104
104
|
const mergedInputProps = {
|
|
105
|
-
...
|
|
105
|
+
...others.inputProps,
|
|
106
106
|
spellCheck: true,
|
|
107
107
|
endAdornment: IconComponent,
|
|
108
108
|
readOnly: !!readOnly,
|
|
@@ -112,7 +112,7 @@ function CustomTextfield({ onChange, value = '', IconComponent, size = 'small',
|
|
|
112
112
|
mergedInputProps.inputProps = { maxLength };
|
|
113
113
|
}
|
|
114
114
|
return mergedInputProps;
|
|
115
|
-
}, [
|
|
115
|
+
}, [others.inputProps, IconComponent, readOnly, disabled, maxLength]);
|
|
116
116
|
const length = maxLength ? value.toString()?.length : null;
|
|
117
117
|
const helperText = others.helperText ?? (others.error === false && !others.readOnly ? ' ' : undefined);
|
|
118
118
|
return (_jsxs("div", { style: {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import ErkTextField from './ErkTextField';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: typeof ErkTextField;
|
|
5
|
+
tags: string[];
|
|
6
|
+
args: {
|
|
7
|
+
disabled: false;
|
|
8
|
+
multiline: false;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Empty: Story;
|
|
14
|
+
export declare const EmptyLabel: Story;
|
|
15
|
+
export declare const Default: Story;
|
|
16
|
+
export declare const Focused: Story;
|
|
17
|
+
export declare const FocusedNoLabel: Story;
|
|
18
|
+
export declare const WithValue: Story;
|
|
19
|
+
export declare const Multiline: Story;
|
|
20
|
+
export declare const WithHelperText: Story;
|
|
21
|
+
export declare const WithValueandLabel: Story;
|
|
22
|
+
export declare const WithMaxLength: Story;
|
|
23
|
+
export declare const Full: Story;
|
|
24
|
+
export declare const Error: Story;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import ErkTextField from './ErkTextField';
|
|
3
|
+
import { useArgs } from 'storybook/internal/preview-api';
|
|
4
|
+
const meta = {
|
|
5
|
+
component: ErkTextField,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
args: {
|
|
8
|
+
disabled: false,
|
|
9
|
+
multiline: false,
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
export const Empty = {
|
|
14
|
+
args: {},
|
|
15
|
+
};
|
|
16
|
+
export const EmptyLabel = {
|
|
17
|
+
args: {
|
|
18
|
+
label: 'Label',
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
export const Default = {
|
|
22
|
+
args: {
|
|
23
|
+
label: 'Label',
|
|
24
|
+
},
|
|
25
|
+
play: async ({ canvas, userEvent }) => {
|
|
26
|
+
const emailInput = canvas.getByRole('textbox');
|
|
27
|
+
await userEvent.click(emailInput);
|
|
28
|
+
await userEvent.type(emailInput, 'example-email@email.com', { initialSelectionStart: 100 });
|
|
29
|
+
},
|
|
30
|
+
render: function Component(args) {
|
|
31
|
+
const [, setArgs] = useArgs();
|
|
32
|
+
const onValueChange = (value) => {
|
|
33
|
+
args.onChange?.(value);
|
|
34
|
+
setArgs({ value });
|
|
35
|
+
};
|
|
36
|
+
return _jsx(ErkTextField, { ...args, ref: undefined, onChange: onValueChange });
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export const Focused = {
|
|
40
|
+
args: {
|
|
41
|
+
label: 'Label',
|
|
42
|
+
},
|
|
43
|
+
play: async ({ canvas, userEvent }) => {
|
|
44
|
+
const emailInput = canvas.getByRole('textbox');
|
|
45
|
+
await userEvent.click(emailInput);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const FocusedNoLabel = {
|
|
49
|
+
args: {},
|
|
50
|
+
play: async ({ canvas, userEvent }) => {
|
|
51
|
+
const emailInput = canvas.getByRole('textbox');
|
|
52
|
+
await userEvent.click(emailInput);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export const WithValue = {
|
|
56
|
+
args: {
|
|
57
|
+
value: 'Textinput Value',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
export const Multiline = {
|
|
61
|
+
args: {
|
|
62
|
+
value: 'TextArea Value',
|
|
63
|
+
multiline: true,
|
|
64
|
+
minRows: 4,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
export const WithHelperText = {
|
|
68
|
+
args: {
|
|
69
|
+
helperText: 'Helper text',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
export const WithValueandLabel = {
|
|
73
|
+
args: {
|
|
74
|
+
label: 'Label',
|
|
75
|
+
value: 'Textinput Value',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
export const WithMaxLength = {
|
|
79
|
+
args: {
|
|
80
|
+
value: 'Value',
|
|
81
|
+
maxLength: 10,
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const Full = {
|
|
85
|
+
args: {
|
|
86
|
+
label: 'Label',
|
|
87
|
+
value: 'Value',
|
|
88
|
+
helperText: 'Helper text',
|
|
89
|
+
maxLength: 10,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export const Error = {
|
|
93
|
+
args: {
|
|
94
|
+
label: 'Label',
|
|
95
|
+
value: 'Value',
|
|
96
|
+
helperText: 'Helper text',
|
|
97
|
+
error: true,
|
|
98
|
+
},
|
|
99
|
+
};
|
|
@@ -48,7 +48,7 @@ function CustomSelect({ value, onChange, label, error, required, pickDays, helpe
|
|
|
48
48
|
paddingTop: error && helperText ? '0px' : '30px',
|
|
49
49
|
}, children: [error && helperText && (_jsx("div", { className: styles.errorMessage, style: {
|
|
50
50
|
color: palette.error.main,
|
|
51
|
-
}, children: helperText })), pickDays && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { label: "D\u00EDas", type: "number", labelMargin: 0, value: (value?.days ?? minDays) + '', onChange: (event) => handleChange({ ...value, days: parseInt(event.target.value) }),
|
|
51
|
+
}, children: helperText })), pickDays && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { label: "D\u00EDas", type: "number", labelMargin: 0, value: (value?.days ?? minDays) + '', onChange: (event) => handleChange({ ...value, days: parseInt(event.target.value) }), inputProps: { min: minDays, max: maxDays } }) })), pickHours && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { label: "Horas", type: "number", labelMargin: 0, value: (value?.hours ?? minHours) + '', onChange: (event) => handleChange({ ...value, hours: parseInt(event.target.value) }), inputProps: { min: minHours, max: maxHours } }) })), pickMinutes && (_jsx("div", { className: styles.numberPickerContainer, children: _jsx(StyledTextField, { type: "number", label: "Minutos", labelMargin: 0, inputProps: { min: minMinutes, max: maxMinutes }, value: (value?.minutes ?? minMinutes) + '', onChange: (event) => handleChange({ ...value, minutes: parseInt(event.target.value) }) }) })), working === undefined && (_jsxs("div", { className: styles.workingContainer, children: ["H\u00E1biles:", _jsx(ErkToggle, { checked: !!value?.working, disabled: working !== undefined, onChange: (working) => {
|
|
52
52
|
handleChange({
|
|
53
53
|
...value,
|
|
54
54
|
working,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import Navbar from './Navbar';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: typeof Navbar;
|
|
5
|
+
tags: string[];
|
|
6
|
+
args: {
|
|
7
|
+
logo: string;
|
|
8
|
+
color: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Navbar from './Navbar';
|
|
2
|
+
const meta = {
|
|
3
|
+
component: Navbar,
|
|
4
|
+
tags: ['autodocs'],
|
|
5
|
+
args: {
|
|
6
|
+
logo: 'https://content.capta.co/Capta/CaptaWhite.svg',
|
|
7
|
+
color: '#3d5a7f',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
export const Default = {
|
|
12
|
+
args: {},
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import Rating from './Rating';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: typeof Rating;
|
|
5
|
+
tags: string[];
|
|
6
|
+
args: {};
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof meta>;
|
|
10
|
+
export declare const ScaleRating: Story;
|
|
11
|
+
export declare const ScaleRatingWidthValue: Story;
|
|
12
|
+
export declare const LikeRating: Story;
|
|
13
|
+
export declare const LikeRatingWithValue: Story;
|
|
14
|
+
export declare const SatisfactionRating: Story;
|
|
15
|
+
export declare const SatisfactionRatingWidthValue: Story;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Rating from './Rating';
|
|
2
|
+
import { RatingTypes } from '../../constants/FormStepTypes';
|
|
3
|
+
const meta = {
|
|
4
|
+
component: Rating,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
args: {},
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
export const ScaleRating = {
|
|
10
|
+
args: {
|
|
11
|
+
type: RatingTypes.SCALE,
|
|
12
|
+
onChange: () => { },
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const ScaleRatingWidthValue = {
|
|
16
|
+
args: {
|
|
17
|
+
type: RatingTypes.SCALE,
|
|
18
|
+
onChange: () => { },
|
|
19
|
+
value: 4,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const LikeRating = {
|
|
23
|
+
args: {
|
|
24
|
+
type: RatingTypes.LIKE,
|
|
25
|
+
onChange: () => { },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export const LikeRatingWithValue = {
|
|
29
|
+
args: {
|
|
30
|
+
type: RatingTypes.LIKE,
|
|
31
|
+
onChange: () => { },
|
|
32
|
+
value: 1,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
export const SatisfactionRating = {
|
|
36
|
+
args: {
|
|
37
|
+
type: RatingTypes.SATISFACTION,
|
|
38
|
+
onChange: () => { },
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const SatisfactionRatingWidthValue = {
|
|
42
|
+
args: {
|
|
43
|
+
type: RatingTypes.SATISFACTION,
|
|
44
|
+
onChange: () => { },
|
|
45
|
+
value: 3,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
@@ -20,7 +20,7 @@ function ScaleRating({ value, inputRef, disabled, onChange, isMobile }) {
|
|
|
20
20
|
return (_jsxs(React.Fragment, { children: [_jsx("input", { ref: inputRef, className: 'hidden-input' }), _jsx(StyledRating, { value: value, onChange: (_event, newValue) => {
|
|
21
21
|
if (!disabled)
|
|
22
22
|
onChange(newValue);
|
|
23
|
-
}, disabled: disabled, size: "large", defaultValue: 0, getLabelText: (value) => value + '/5', max: 5,
|
|
23
|
+
}, disabled: disabled, size: "large", defaultValue: 0, getLabelText: (value) => value + '/5', max: 5, IconContainerComponent: isMobile ? SmallIconContainer : IconContainer })] }));
|
|
24
24
|
}
|
|
25
25
|
function IconContainer({ value, ...other }) {
|
|
26
26
|
return (_jsx("span", { className: 'icon' + value, ...other, children: _jsx(StarIcon, { style: { fontSize: 60 } }) }));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormStyle } from '../@Types/Form';
|
|
2
|
-
import {
|
|
2
|
+
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
3
3
|
import { SiteState } from './SiteSlice';
|
|
4
4
|
import { EurekaDraft } from '../@Types/Draft/Draft';
|
|
5
5
|
import { CountryCode } from 'libphonenumber-js';
|
|
@@ -21,12 +21,30 @@ export interface GlobalState {
|
|
|
21
21
|
internal: boolean;
|
|
22
22
|
loaded: boolean;
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
export declare const GlobalSlice: import("@reduxjs/toolkit").Slice<GlobalState, {
|
|
25
|
+
reset: (state: import("immer").WritableDraft<GlobalState>, action: PayloadAction<Omit<GlobalState, "loaded"> & SiteState>) => {
|
|
26
|
+
loaded: true;
|
|
27
|
+
editable: boolean;
|
|
28
|
+
partial: boolean;
|
|
29
|
+
formStyle: FormStyle;
|
|
30
|
+
postview: boolean;
|
|
31
|
+
preview: boolean;
|
|
32
|
+
idOrganization: string;
|
|
33
|
+
idCurrentAgent?: string;
|
|
34
|
+
apiKey?: string;
|
|
35
|
+
countryCode: CountryCode;
|
|
36
|
+
confirmation: {
|
|
37
|
+
confirmationMessage: EurekaDraft;
|
|
38
|
+
showLink: boolean;
|
|
39
|
+
};
|
|
40
|
+
internal: boolean;
|
|
41
|
+
dependencies: import("../Form/Form").DependencyStore;
|
|
42
|
+
values: import("./SiteSlice").ValuesStore;
|
|
43
|
+
idCurrentSection: string | null;
|
|
44
|
+
previousSections: string[];
|
|
45
|
+
nextSections: string[];
|
|
46
|
+
focusStep?: string;
|
|
47
|
+
};
|
|
48
|
+
}, "global", "global", import("@reduxjs/toolkit").SliceSelectors<GlobalState>>;
|
|
30
49
|
export declare const reset: import("@reduxjs/toolkit").ActionCreatorWithPayload<Omit<GlobalState, "loaded"> & SiteState, "global/reset">;
|
|
31
|
-
export declare const GlobalSlice: GlobalSliceAPI;
|
|
32
50
|
export default GlobalSlice;
|
|
@@ -16,7 +16,7 @@ const initialState = {
|
|
|
16
16
|
internal: false,
|
|
17
17
|
loaded: false,
|
|
18
18
|
};
|
|
19
|
-
const
|
|
19
|
+
export const GlobalSlice = createSlice({
|
|
20
20
|
name: 'global',
|
|
21
21
|
initialState,
|
|
22
22
|
reducers: {
|
|
@@ -25,6 +25,5 @@ const _GlobalSlice = createSlice({
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
|
-
export const { reset } =
|
|
29
|
-
export const GlobalSlice = _GlobalSlice;
|
|
28
|
+
export const { reset } = GlobalSlice.actions;
|
|
30
29
|
export default GlobalSlice;
|
|
@@ -3,7 +3,7 @@ import { GBaseStep } from '../@Types/GenericFormSteps';
|
|
|
3
3
|
import { FormStep } from '../@Types/FormStep';
|
|
4
4
|
import { CustomStep } from '../FormSteps/CustomStep';
|
|
5
5
|
import { CBRFormStep } from '../@Types/CBRFormStep';
|
|
6
|
-
import {
|
|
6
|
+
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
7
7
|
import { FieldValues } from 'react-hook-form';
|
|
8
8
|
import { Form } from '../@Types';
|
|
9
9
|
export interface SiteState {
|
|
@@ -14,16 +14,42 @@ export interface SiteState {
|
|
|
14
14
|
nextSections: string[];
|
|
15
15
|
focusStep?: string;
|
|
16
16
|
}
|
|
17
|
-
interface SiteSliceAPI {
|
|
18
|
-
reducer: Reducer<SiteState>;
|
|
19
|
-
getInitialState(): SiteState;
|
|
20
|
-
name: string;
|
|
21
|
-
reducerPath: string;
|
|
22
|
-
}
|
|
23
17
|
export interface ValuesStore {
|
|
24
18
|
global: Record<string, any>;
|
|
25
19
|
sections: Record<string, Record<string, any>>;
|
|
26
20
|
}
|
|
21
|
+
export declare const SiteSlice: import("@reduxjs/toolkit").Slice<SiteState, {
|
|
22
|
+
setStepDependency: (state: import("immer").WritableDraft<SiteState>, { payload: { step: { id, type, idSection }, value, }, }: PayloadAction<{
|
|
23
|
+
step: GBaseStep;
|
|
24
|
+
value: StepDependency["value"];
|
|
25
|
+
}>) => void;
|
|
26
|
+
clearDependency: (state: import("immer").WritableDraft<SiteState>, { payload: { id, idSection } }: PayloadAction<GBaseStep>) => void;
|
|
27
|
+
setEmptyDependency: (state: import("immer").WritableDraft<SiteState>, { payload: { step: { id }, empty, }, }: PayloadAction<{
|
|
28
|
+
step: GBaseStep;
|
|
29
|
+
empty: StepDependency["empty"];
|
|
30
|
+
}>) => void;
|
|
31
|
+
addStepsDependencies: (state: import("immer").WritableDraft<SiteState>, { payload: { steps, customSteps, allSteps }, }: PayloadAction<{
|
|
32
|
+
steps: Record<string, FormStep | CBRFormStep>;
|
|
33
|
+
customSteps: Record<string, CustomStep>;
|
|
34
|
+
allSteps: Record<string, FormStep | CBRFormStep>;
|
|
35
|
+
}>) => void;
|
|
36
|
+
handlePrevious: (state: import("immer").WritableDraft<SiteState>, { payload: { values, form } }: PayloadAction<{
|
|
37
|
+
values: Record<string, any>;
|
|
38
|
+
form: Form;
|
|
39
|
+
}>) => void;
|
|
40
|
+
handleNext: (state: import("immer").WritableDraft<SiteState>, { payload: { values, form } }: PayloadAction<{
|
|
41
|
+
values: Record<string, any>;
|
|
42
|
+
form: Form;
|
|
43
|
+
}>) => void;
|
|
44
|
+
updateNestedValues: (state: import("immer").WritableDraft<SiteState>, { payload: { key, values } }: PayloadAction<{
|
|
45
|
+
key: string;
|
|
46
|
+
values: Record<string, any>;
|
|
47
|
+
}>) => void;
|
|
48
|
+
focusStep: (state: import("immer").WritableDraft<SiteState>, { payload }: PayloadAction<{
|
|
49
|
+
step: FormStep;
|
|
50
|
+
values: FieldValues;
|
|
51
|
+
} | undefined>) => void;
|
|
52
|
+
}, "site", "site", import("@reduxjs/toolkit").SliceSelectors<SiteState>>;
|
|
27
53
|
export declare const focusStep: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<{
|
|
28
54
|
step: FormStep;
|
|
29
55
|
values: FieldValues;
|
|
@@ -47,6 +73,5 @@ export declare const focusStep: import("@reduxjs/toolkit").ActionCreatorWithOpti
|
|
|
47
73
|
key: string;
|
|
48
74
|
values: Record<string, any>;
|
|
49
75
|
}, "site/updateNestedValues">;
|
|
50
|
-
export declare const SiteSlice: SiteSliceAPI;
|
|
51
76
|
export default SiteSlice;
|
|
52
77
|
export declare function addPagedValues(steps: Record<string, FormStep>, values: Record<string, any>, original: Record<string, any>, path?: string): void;
|
package/dist/States/SiteSlice.js
CHANGED
|
@@ -13,12 +13,13 @@ const initialState = {
|
|
|
13
13
|
previousSections: [],
|
|
14
14
|
nextSections: [],
|
|
15
15
|
};
|
|
16
|
-
const
|
|
16
|
+
export const SiteSlice = createSlice({
|
|
17
17
|
name: 'site',
|
|
18
18
|
initialState,
|
|
19
19
|
reducers: {
|
|
20
20
|
setStepDependency: (state, { payload: { step: { id, type, idSection }, value, }, }) => {
|
|
21
21
|
const old = state.dependencies[id];
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
|
|
22
23
|
if (old && (old.type !== type || old.value !== value)) {
|
|
23
24
|
state.dependencies[id] = {
|
|
24
25
|
...state.dependencies[id],
|
|
@@ -117,20 +118,17 @@ const _SiteSlice = createSlice({
|
|
|
117
118
|
},
|
|
118
119
|
},
|
|
119
120
|
extraReducers: (builder) => {
|
|
120
|
-
builder.addCase(reset, (
|
|
121
|
+
builder.addCase(reset, (state, action) => {
|
|
121
122
|
const payload = action.payload;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
dependencies: payload.dependencies,
|
|
128
|
-
};
|
|
123
|
+
state.previousSections = payload.previousSections;
|
|
124
|
+
state.idCurrentSection = payload.idCurrentSection;
|
|
125
|
+
state.nextSections = payload.nextSections;
|
|
126
|
+
state.values = payload.values;
|
|
127
|
+
state.dependencies = payload.dependencies;
|
|
129
128
|
});
|
|
130
129
|
},
|
|
131
130
|
});
|
|
132
|
-
export const { focusStep, clearDependency, setStepDependency, addStepsDependencies, setEmptyDependency, handlePrevious, handleNext, updateNestedValues, } =
|
|
133
|
-
export const SiteSlice = _SiteSlice;
|
|
131
|
+
export const { focusStep, clearDependency, setStepDependency, addStepsDependencies, setEmptyDependency, handlePrevious, handleNext, updateNestedValues, } = SiteSlice.actions;
|
|
134
132
|
export default SiteSlice;
|
|
135
133
|
export function addPagedValues(steps, values, original, path = '') {
|
|
136
134
|
for (const step of Object.values(steps)) {
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { WidthStats } from '../Form/Form';
|
|
2
2
|
import type { PayloadAction } from '@reduxjs/toolkit';
|
|
3
3
|
export declare const WidthStatsSlice: import("@reduxjs/toolkit").Slice<WidthStats, {
|
|
4
|
-
updateWidthStats: (state: {
|
|
5
|
-
currentBreakPoint: number;
|
|
6
|
-
isResponsive: boolean;
|
|
7
|
-
isMobile: boolean;
|
|
8
|
-
}, { payload }: PayloadAction<WidthStats>) => WidthStats;
|
|
4
|
+
updateWidthStats: (state: import("immer").WritableDraft<WidthStats>, { payload }: PayloadAction<WidthStats>) => WidthStats;
|
|
9
5
|
}, "widthStats", "widthStats", import("@reduxjs/toolkit").SliceSelectors<WidthStats>>;
|
|
10
6
|
export declare const updateWidthStats: import("@reduxjs/toolkit").ActionCreatorWithPayload<WidthStats, "widthStats/updateWidthStats">;
|
|
11
7
|
export default WidthStatsSlice;
|
|
@@ -319,7 +319,7 @@ export function isList(blockType) {
|
|
|
319
319
|
*/
|
|
320
320
|
export function getEntityText(entityMap, entityKey, blockText) {
|
|
321
321
|
const entity = entityMap[entityKey];
|
|
322
|
-
if (entity
|
|
322
|
+
if (entity && entity.type === DraftEntityTypes.EUREKA) {
|
|
323
323
|
return blockText;
|
|
324
324
|
}
|
|
325
325
|
return '';
|