@arquimedes.co/eureka-forms 3.0.62 → 3.0.63

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.
Files changed (105) hide show
  1. package/README +33 -1
  2. package/dist/@Types/AvailabilityFormStep.d.ts +48 -0
  3. package/dist/@Types/AvailabilityFormStep.js +24 -0
  4. package/dist/@Types/BankAccountFormStep.d.ts +67 -0
  5. package/dist/@Types/BankAccountFormStep.js +14 -0
  6. package/dist/@Types/BookingFormStep.d.ts +187 -0
  7. package/dist/@Types/BookingFormStep.js +44 -0
  8. package/dist/@Types/CalendarFormStep.d.ts +209 -0
  9. package/dist/@Types/CalendarFormStep.js +55 -0
  10. package/dist/@Types/CommunicationChannelFormStep.d.ts +51 -0
  11. package/dist/@Types/CommunicationChannelFormStep.js +15 -0
  12. package/dist/@Types/ConsentFormStep.d.ts +36 -0
  13. package/dist/@Types/ConsentFormStep.js +8 -0
  14. package/dist/@Types/EntityFormFormStep.d.ts +66 -0
  15. package/dist/@Types/EntityFormFormStep.js +20 -0
  16. package/dist/@Types/EventFormStep.d.ts +52 -0
  17. package/dist/@Types/EventFormStep.js +13 -0
  18. package/dist/@Types/ExternalReferenceFormStep.d.ts +74 -0
  19. package/dist/@Types/ExternalReferenceFormStep.js +20 -0
  20. package/dist/@Types/FormStep.d.ts +7 -2
  21. package/dist/@Types/FormStep.js +2 -1
  22. package/dist/@Types/LocationFormStep.d.ts +159 -0
  23. package/dist/@Types/LocationFormStep.js +46 -0
  24. package/dist/@Types/NumericFormSteps.d.ts +108 -0
  25. package/dist/@Types/NumericFormSteps.js +20 -0
  26. package/dist/@Types/PredefinedSelectorFormStep.d.ts +51 -0
  27. package/dist/@Types/PredefinedSelectorFormStep.js +39 -0
  28. package/dist/@Types/StepRef.d.ts +135 -0
  29. package/dist/@Types/StepRef.js +49 -0
  30. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +7 -0
  31. package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +14 -0
  32. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +8 -0
  33. package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +32 -0
  34. package/dist/FormSteps/BookingStep/BookingStep.d.ts +17 -0
  35. package/dist/FormSteps/BookingStep/BookingStep.js +14 -0
  36. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +7 -0
  37. package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +32 -0
  38. package/dist/FormSteps/LocationStep/LocationStep.d.ts +10 -0
  39. package/dist/FormSteps/LocationStep/LocationStep.js +14 -0
  40. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +3 -0
  41. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +54 -0
  42. package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +18 -0
  43. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +3 -0
  44. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +170 -0
  45. package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +96 -0
  46. package/dist/FormSteps/NumberStep/NumberStep.d.ts +10 -0
  47. package/dist/FormSteps/NumberStep/NumberStep.js +14 -0
  48. package/dist/FormSteps/Step.js +16 -0
  49. package/dist/FormSteps/StepFunctions.js +14 -0
  50. package/dist/FormSteps/StepFunctions.test.js +54 -0
  51. package/dist/Icons/AddIcon.d.ts +3 -0
  52. package/dist/Icons/AddIcon.js +7 -0
  53. package/dist/Icons/EditIcon.d.ts +3 -0
  54. package/dist/Icons/EditIcon.js +7 -0
  55. package/dist/Icons/RemoveIcon.d.ts +3 -0
  56. package/dist/Icons/RemoveIcon.js +7 -0
  57. package/dist/Icons/ViewDayIcon.d.ts +3 -0
  58. package/dist/Icons/ViewDayIcon.js +7 -0
  59. package/dist/Icons/ViewWeekIcon.d.ts +3 -0
  60. package/dist/Icons/ViewWeekIcon.js +7 -0
  61. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +19 -0
  62. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +80 -0
  63. package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +88 -0
  64. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +29 -0
  65. package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +139 -0
  66. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +25 -0
  67. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +112 -0
  68. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +88 -0
  69. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts +1 -0
  70. package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +73 -0
  71. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +31 -0
  72. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +228 -0
  73. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +608 -0
  74. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +28 -0
  75. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +117 -0
  76. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts +1 -0
  77. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +49 -0
  78. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +1 -0
  79. package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +107 -0
  80. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +1 -3
  81. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +2 -3
  82. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +1 -2
  83. package/dist/Shared/ErkIconButton/ErkIconButton.d.ts +17 -0
  84. package/dist/Shared/ErkIconButton/ErkIconButton.js +11 -0
  85. package/dist/Shared/ErkIconButton/ErkIconButton.module.css +41 -0
  86. package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +24 -0
  87. package/dist/Shared/ErkLocationField/ErkLocationField.js +128 -0
  88. package/dist/Shared/ErkLocationField/ErkLocationField.module.css +164 -0
  89. package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +1 -0
  90. package/dist/Shared/ErkLocationField/ErkLocationField.test.js +82 -0
  91. package/dist/Shared/ErkLocationField/addressFields.d.ts +12 -0
  92. package/dist/Shared/ErkLocationField/addressFields.js +34 -0
  93. package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +6 -0
  94. package/dist/Shared/ErkLocationField/locationRestrictions.js +51 -0
  95. package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +15 -0
  96. package/dist/Shared/ErkLocationInput/ErkLocationInput.js +502 -0
  97. package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +128 -0
  98. package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +42 -0
  99. package/dist/Shared/ErkNumberField/ErkNumberField.js +169 -0
  100. package/dist/Utils/AxiosWidget.js +9 -1
  101. package/dist/constants/FormStepTypes.d.ts +5 -1
  102. package/dist/constants/FormStepTypes.js +4 -0
  103. package/dist/index.lib.d.ts +4 -2
  104. package/dist/index.lib.js +3 -1
  105. package/package.json +2 -1
@@ -0,0 +1,169 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { NumberField as BaseNumberField } from '@base-ui/react/number-field';
4
+ import { FormControl, FormHelperText, InputAdornment, InputLabel, OutlinedInput, styled, useTheme, } from '@mui/material';
5
+ import { alpha } from '@mui/material/styles';
6
+ import AddIcon from '../../Icons/AddIcon';
7
+ import RemoveIcon from '../../Icons/RemoveIcon';
8
+ // ---------------------------------------------------------------------------
9
+ // Styled FormControl shell — same conventions as ErkTextField / ErkSelect
10
+ // ---------------------------------------------------------------------------
11
+ const StyledFormControl = styled(FormControl)(({ theme, size }) => ({
12
+ '& .Erk-MuiOutlinedInput-root': {
13
+ borderRadius: 10,
14
+ backgroundColor: theme.palette.stepBackgroundColor.default,
15
+ minHeight: size === 'small' ? 31 : size === 'medium' ? 40 : undefined,
16
+ '&.Mui-focused .Erk-MuiOutlinedInput-notchedOutline': {
17
+ borderColor: theme.palette.primary.main,
18
+ borderWidth: 2,
19
+ },
20
+ // ErkNF-readOnly is set manually via className — Mui-readOnly is unreliable here
21
+ '&:hover:not(.ErkNF-readOnly) .Erk-MuiOutlinedInput-notchedOutline': {
22
+ borderColor: theme.palette.primary.main,
23
+ },
24
+ '&.ErkNF-readOnly.Mui-focused .Erk-MuiOutlinedInput-notchedOutline': {
25
+ borderColor: theme.palette.outline.main,
26
+ borderWidth: 1,
27
+ },
28
+ '&.ErkNF-readOnly': {
29
+ cursor: 'default',
30
+ '& input': { cursor: 'default' },
31
+ },
32
+ '& .Erk-MuiOutlinedInput-notchedOutline': {
33
+ borderRadius: 10,
34
+ borderColor: theme.palette.outline.main,
35
+ '& legend': { fontSize: '0.75rem' },
36
+ },
37
+ },
38
+ '& .Erk-MuiOutlinedInput-root.Mui-error .Erk-MuiOutlinedInput-notchedOutline': {
39
+ borderColor: theme.palette.error.main,
40
+ },
41
+ '& .Erk-MuiOutlinedInput-root.Mui-error.Mui-focused .Erk-MuiOutlinedInput-notchedOutline': {
42
+ borderWidth: 2,
43
+ },
44
+ '& .Erk-MuiFormLabel-root': {
45
+ color: alpha(theme.palette.text.primary, 0.54),
46
+ },
47
+ '& label.Mui-focused': { color: theme.palette.primary.main },
48
+ '& label.Mui-error': { color: theme.palette.error.main },
49
+ '& .Erk-MuiFormLabel-root:not(.Erk-MuiInputLabel-shrink)': {
50
+ fontSize: '1rem',
51
+ transform: `translate(12px, ${size === 'small' ? 5 : 9}px) scale(1)`,
52
+ },
53
+ '& .Erk-MuiFormHelperText-root': {
54
+ color: theme.palette.helperText.primary,
55
+ minHeight: 20,
56
+ overflow: 'hidden',
57
+ textOverflow: 'ellipsis',
58
+ },
59
+ '& .Erk-MuiFormHelperText-root.Mui-error': { color: theme.palette.error.main },
60
+ '& input': {
61
+ fontSize: '1rem',
62
+ padding: '6px 12px',
63
+ lineHeight: size === 'small' ? '1.188em' : '1.75em',
64
+ height: size === 'small' ? '1.188em' : '1.75em',
65
+ color: theme.palette.text.primary,
66
+ MozAppearance: 'textfield',
67
+ '&::-webkit-outer-spin-button, &::-webkit-inner-spin-button': {
68
+ WebkitAppearance: 'none',
69
+ margin: 0,
70
+ },
71
+ },
72
+ }));
73
+ // ---------------------------------------------------------------------------
74
+ // SSR label-shrink hint — muiName='Input' lets FormControl know an input
75
+ // exists so it can compute the initial shrink state before hydration.
76
+ // ---------------------------------------------------------------------------
77
+ function SSRInitialFilled(_props) {
78
+ return null;
79
+ }
80
+ SSRInitialFilled.muiName = 'Input';
81
+ function SpinnerBtn({ children, style, ...rest }) {
82
+ const theme = useTheme();
83
+ const [hovered, setHovered] = React.useState(false);
84
+ const [active, setActive] = React.useState(false);
85
+ return (_jsx("button", { type: "button", tabIndex: -1, ...rest, onMouseEnter: (e) => {
86
+ setHovered(true);
87
+ rest.onMouseEnter?.(e);
88
+ }, onMouseLeave: (e) => {
89
+ setHovered(false);
90
+ setActive(false);
91
+ rest.onMouseLeave?.(e);
92
+ }, onMouseDown: (e) => {
93
+ setActive(true);
94
+ rest.onMouseDown?.(e);
95
+ }, onMouseUp: (e) => {
96
+ setActive(false);
97
+ rest.onMouseUp?.(e);
98
+ }, style: {
99
+ display: 'inline-flex',
100
+ alignItems: 'center',
101
+ justifyContent: 'center',
102
+ width: 22,
103
+ height: 22,
104
+ minWidth: 22,
105
+ padding: 0,
106
+ border: 'none',
107
+ borderRadius: 4,
108
+ background: active
109
+ ? alpha(theme.palette.primary.main, 0.16)
110
+ : hovered
111
+ ? alpha(theme.palette.primary.main, 0.08)
112
+ : 'transparent',
113
+ cursor: rest.disabled ? 'default' : 'pointer',
114
+ color: hovered && !rest.disabled ? theme.palette.primary.main : alpha(theme.palette.text.primary, 0.6),
115
+ flexShrink: 0,
116
+ transition: 'color 0.15s, background-color 0.15s',
117
+ opacity: rest.disabled ? 0.35 : 1,
118
+ pointerEvents: rest.disabled ? 'none' : undefined,
119
+ ...style,
120
+ }, children: children }));
121
+ }
122
+ // ---------------------------------------------------------------------------
123
+ // Implementation
124
+ // ---------------------------------------------------------------------------
125
+ function CustomErkNumberField({ value, onChange, label, min, max, step = 1, decimals, required, error, errorBorder, helperText, disabled, readOnly, placeholder, size = 'small', fullWidth = true, suffix, spinner = true, inputRef, }) {
126
+ const theme = useTheme();
127
+ const id = React.useId();
128
+ // Rounds to max decimals on spinner click / arrow key / wheel scrub.
129
+ // Typing restriction is handled separately inside slotProps.input.onChange.
130
+ const handleValueChange = (num) => {
131
+ if (num === null || decimals === undefined) {
132
+ onChange?.(num);
133
+ return;
134
+ }
135
+ const factor = Math.pow(10, decimals);
136
+ onChange?.(Math.round(num * factor) / factor);
137
+ };
138
+ return (_jsxs(BaseNumberField.Root, { value: value ?? null, onValueChange: handleValueChange, min: min, max: max, step: step, format: decimals !== undefined ? { minimumFractionDigits: 0, maximumFractionDigits: decimals } : undefined, disabled: disabled, readOnly: readOnly, ref: inputRef, render: (rootProps, rootState) => (_jsx(StyledFormControl, { ref: rootProps.ref, size: size, disabled: rootState.disabled, required: required, error: error && !!errorBorder, variant: "outlined", fullWidth: fullWidth, children: rootProps.children })), children: [_jsx(SSRInitialFilled, { value: value ?? undefined }), label && (_jsx(InputLabel, { htmlFor: id, size: size === 'small' ? 'small' : undefined, disabled: disabled, children: label })), _jsx(BaseNumberField.Input, { id: id, render: (inputProps, inputState) => {
139
+ return (_jsx(OutlinedInput, { label: label, className: readOnly ? 'ErkNF-readOnly' : undefined, inputRef: inputProps.ref, value: inputState.inputValue, onBlur: inputProps.onBlur, onChange: inputProps.onChange, onKeyUp: inputProps.onKeyUp, onKeyDown: inputProps.onKeyDown, onFocus: inputProps.onFocus, placeholder: placeholder, slotProps: {
140
+ input: {
141
+ ...inputProps, // Base UI handlers + ref + aria attrs
142
+ },
143
+ }, endAdornment: suffix || spinner ? (_jsxs(InputAdornment, { position: "end", sx: { gap: '2px', mr: '2px', alignItems: 'center' }, children: [suffix && (_jsx("span", { style: {
144
+ fontSize: 13,
145
+ fontWeight: 600,
146
+ color: theme.palette.primary.main,
147
+ userSelect: 'none',
148
+ whiteSpace: 'nowrap',
149
+ marginRight: spinner ? 2 : 4,
150
+ }, children: suffix })), spinner && (_jsxs(_Fragment, { children: [_jsx(BaseNumberField.Decrement, { render: (decProps) => {
151
+ const { disabled: baseDisabled, ...restDec } = decProps;
152
+ return (_jsx(SpinnerBtn, { ...restDec, disabled: !!readOnly || !!baseDisabled, children: _jsx(RemoveIcon, { size: 14 }) }));
153
+ } }), _jsx(BaseNumberField.Increment, { render: (incProps) => {
154
+ const { disabled: baseDisabled, ...restInc } = incProps;
155
+ return (_jsx(SpinnerBtn, { ...restInc, disabled: !!readOnly || !!baseDisabled, children: _jsx(AddIcon, { size: 14 }) }));
156
+ } })] }))] })) : undefined, sx: { pr: suffix || spinner ? 0 : undefined } }));
157
+ } }), helperText && _jsx(FormHelperText, { error: error && !!errorBorder, children: helperText })] }));
158
+ }
159
+ /**
160
+ * Pure number input built on Base UI NumberField + MUI styling.
161
+ * No form-step system dependency.
162
+ * Class wrapper for react-hook-form ref compatibility.
163
+ */
164
+ class ErkNumberField extends React.Component {
165
+ render() {
166
+ return _jsx(CustomErkNumberField, { ...this.props });
167
+ }
168
+ }
169
+ export default ErkNumberField;
@@ -1,7 +1,15 @@
1
1
  import axios from 'axios';
2
2
  const headers = {};
3
+ /**
4
+ * Embedded mode calls the API by absolute URL, because the form runs inside a page that is not ours.
5
+ * Against local lambdas there is no such host: the dev server proxies `/api`, so the request has to come
6
+ * back through it — same-origin, with no CORS allowlist to satisfy.
7
+ */
8
+ const baseURL = import.meta.env.VITE_LOCAL_LAMBDAS
9
+ ? '/api'
10
+ : `https://api.forms.${import.meta.env.VITE_REACT_APP_DOMAIN}/api`;
3
11
  const widgetInstance = axios.create({
4
- baseURL: `https://api.forms.${import.meta.env.VITE_REACT_APP_DOMAIN}/api`,
12
+ baseURL,
5
13
  timeout: 30000,
6
14
  headers,
7
15
  });
@@ -21,7 +21,11 @@ export declare enum FormStepTypes {
21
21
  COLLAPSIBLE = "COLLAPSIBLE",
22
22
  MAPPER = "MAPPER",
23
23
  ENTITYVALUEPICKER = "ENTITYVALUEPICKER",
24
- API_SELECTOR = "API_SELECTOR"
24
+ API_SELECTOR = "API_SELECTOR",
25
+ LOCATION = "LOCATION",
26
+ NUMBER = "NUMBER",
27
+ AVAILABILITY = "AVAILABILITY",
28
+ BOOKING = "BOOKING"
25
29
  }
26
30
  export declare enum OptionTypes {
27
31
  DEFAULT = "DEFAULT",
@@ -25,6 +25,10 @@ export var FormStepTypes;
25
25
  FormStepTypes["MAPPER"] = "MAPPER";
26
26
  FormStepTypes["ENTITYVALUEPICKER"] = "ENTITYVALUEPICKER";
27
27
  FormStepTypes["API_SELECTOR"] = "API_SELECTOR";
28
+ FormStepTypes["LOCATION"] = "LOCATION";
29
+ FormStepTypes["NUMBER"] = "NUMBER";
30
+ FormStepTypes["AVAILABILITY"] = "AVAILABILITY";
31
+ FormStepTypes["BOOKING"] = "BOOKING";
28
32
  })(FormStepTypes || (FormStepTypes = {}));
29
33
  export var OptionTypes;
30
34
  (function (OptionTypes) {
@@ -1,6 +1,8 @@
1
1
  import EurekaForm, { AppProps as EurekaFormProps } from './App/App';
2
2
  import { StepProps } from './FormSteps/Step';
3
3
  import * as StepFunctions from './FormSteps/StepFunctions';
4
- export type { StepProps, EurekaFormProps };
5
- export { EurekaForm, StepFunctions };
4
+ import ErkBookingPicker, { ErkBookingPickerProps } from './Shared/ErkBookingPicker/ErkBookingPicker';
5
+ import ErkAvailabilityPicker, { ErkAvailabilityPickerProps } from './Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
6
+ export type { StepProps, EurekaFormProps, ErkBookingPickerProps, ErkAvailabilityPickerProps };
7
+ export { EurekaForm, StepFunctions, ErkBookingPicker, ErkAvailabilityPicker };
6
8
  export default EurekaForm;
package/dist/index.lib.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import EurekaForm from './App/App';
2
2
  import * as StepFunctions from './FormSteps/StepFunctions';
3
- export { EurekaForm, StepFunctions };
3
+ import ErkBookingPicker from './Shared/ErkBookingPicker/ErkBookingPicker';
4
+ import ErkAvailabilityPicker from './Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
5
+ export { EurekaForm, StepFunctions, ErkBookingPicker, ErkAvailabilityPicker };
4
6
  export default EurekaForm;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "3.0.62",
4
+ "version": "3.0.63",
5
5
  "scripts": {
6
6
  "watch": "node node_modules/@typescript/native/bin/tsc --noEmit --watch --project tsconfig.app.json",
7
7
  "start": "vite",
@@ -17,6 +17,7 @@
17
17
  "format:check": "oxfmt --check ./src"
18
18
  },
19
19
  "dependencies": {
20
+ "@base-ui/react": "^1.6.0",
20
21
  "@reduxjs/toolkit": "2.11.2",
21
22
  "axios": "1.16.0",
22
23
  "date-fns": "4.1.0",