@bonlineza/luxity-lib 2.39.6 → 2.39.8

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 (92) hide show
  1. package/Accordion.js +352 -342
  2. package/AddInterest.js +3179 -3136
  3. package/AddProductInterest.js +7584 -1011
  4. package/BrandSelector.js +861 -854
  5. package/Checkbox.js +250 -240
  6. package/CheckboxButton.js +236 -229
  7. package/CommunicationPreferenceOptionsRenderer.js +568 -560
  8. package/CommunicationPreferenceSection.js +659 -651
  9. package/CommunicationPreferences.js +2402 -2394
  10. package/ConditionSelector.js +859 -852
  11. package/CountryCodeSelect.js +6650 -79
  12. package/CurrencyInputFormatter.js +96 -86
  13. package/CurrencySelect.js +227 -219
  14. package/DropdownSelector.js +6820 -211
  15. package/GALink.js +51 -43
  16. package/GenderSelector.js +362 -355
  17. package/GraphQLDropdownSelector.js +11914 -5307
  18. package/GraphQLMultiSelector.js +601 -593
  19. package/IconHeader.js +126 -118
  20. package/IconWrapper.js +25 -17
  21. package/InterestCatSelector.js +432 -424
  22. package/InterestItem.js +470 -462
  23. package/Interests.js +11324 -4717
  24. package/InterestsSubheading.js +41 -33
  25. package/InvertedTextButton.js +175 -167
  26. package/LuxityAppSideNav.js +189 -181
  27. package/LuxityDesktopHeader.js +1363 -1355
  28. package/LuxityFooter.js +2236 -2228
  29. package/LuxityGraphQLDropdownSelector.js +11999 -5392
  30. package/LuxityGraphQLMultiselector.js +785 -778
  31. package/LuxityMobileHeader.js +1794 -1786
  32. package/LuxityPageReady.js +209 -199
  33. package/LuxityProductInterestItem.js +367 -359
  34. package/LuxitySideNav.js +673 -665
  35. package/MaterialSelector.js +12029 -5422
  36. package/ModelSelector.js +12029 -5422
  37. package/NotificationDropDown.js +7029 -459
  38. package/Notify.js +32 -20
  39. package/OutlinePrimaryButton.js +142 -134
  40. package/PriceRangeSelector.js +1277 -1264
  41. package/PrimaryButton.js +137 -129
  42. package/RadioButtons.js +318 -308
  43. package/RangeSlider.js +1039 -1033
  44. package/RareStepFooter.js +264 -257
  45. package/RareStepHeader.js +808 -801
  46. package/ReactSelectWrapper.js +6604 -33
  47. package/SecondaryButton.js +152 -144
  48. package/ShoeSizeRangeSelector.js +1153 -1147
  49. package/ShoeSizeSelector.js +1198 -1146
  50. package/SimpleErrorBoundary.js +138 -130
  51. package/StyleSelector.js +861 -854
  52. package/TextButton.js +143 -135
  53. package/Tooltip.js +184 -176
  54. package/Tracking.js +25 -15
  55. package/WrapperButton.js +58 -50
  56. package/build/bundle.css +1 -1
  57. package/build/bundle.js +17272 -10631
  58. package/build/constants.js +45 -32
  59. package/package.json +3 -2
  60. package/svg/Accessories.js +42 -34
  61. package/svg/Account.js +38 -30
  62. package/svg/Add.js +39 -31
  63. package/svg/ArrowRight.js +36 -28
  64. package/svg/Bags.js +48 -40
  65. package/svg/BurgerMenu.js +32 -24
  66. package/svg/Calendar.js +106 -98
  67. package/svg/CalendarCircled.js +108 -100
  68. package/svg/CheckCircled.js +40 -32
  69. package/svg/Close.js +37 -29
  70. package/svg/Clothing.js +44 -36
  71. package/svg/Dot.js +40 -32
  72. package/svg/Edit.js +35 -27
  73. package/svg/Eye.js +36 -28
  74. package/svg/FileAttach.js +36 -28
  75. package/svg/FileAttachCircled.js +38 -30
  76. package/svg/Jewellery.js +57 -49
  77. package/svg/LightBulb.js +66 -58
  78. package/svg/Logo.js +140 -132
  79. package/svg/LuxityMenu.js +36 -28
  80. package/svg/Minus.js +37 -29
  81. package/svg/MobileAvatar.js +36 -28
  82. package/svg/MyOrder.js +44 -36
  83. package/svg/MyPayment.js +44 -36
  84. package/svg/MyProfile.js +52 -44
  85. package/svg/MySale.js +39 -31
  86. package/svg/Notification.js +38 -30
  87. package/svg/PointerDown.js +36 -28
  88. package/svg/Search.js +35 -27
  89. package/svg/Shoes.js +45 -37
  90. package/svg/SvgWrapper.js +21 -13
  91. package/svg/Trash.js +40 -32
  92. package/svg/Watches.js +55 -47
@@ -1,592 +1,600 @@
1
- import React, { useEffect } from 'react';
2
- import styled from 'styled-components';
3
-
4
- function _extends() {
5
- _extends = Object.assign ? Object.assign.bind() : function (target) {
6
- for (var i = 1; i < arguments.length; i++) {
7
- var source = arguments[i];
8
-
9
- for (var key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('styled-components')) :
3
+ typeof define === 'function' && define.amd ? define(['react', 'styled-components'], factory) :
4
+ (global = global || self, global.CommunicationPreferenceOptionsRenderer = factory(global.React, global.styled));
5
+ }(this, (function (React, styled) { 'use strict';
6
+
7
+ var React__default = 'default' in React ? React['default'] : React;
8
+ styled = styled && Object.prototype.hasOwnProperty.call(styled, 'default') ? styled['default'] : styled;
9
+
10
+ function _extends() {
11
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
12
+ for (var i = 1; i < arguments.length; i++) {
13
+ var source = arguments[i];
14
+
15
+ for (var key in source) {
16
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
17
+ target[key] = source[key];
18
+ }
12
19
  }
13
20
  }
21
+
22
+ return target;
23
+ };
24
+ return _extends.apply(this, arguments);
25
+ }
26
+
27
+ function _objectWithoutPropertiesLoose(source, excluded) {
28
+ if (source == null) return {};
29
+ var target = {};
30
+ var sourceKeys = Object.keys(source);
31
+ var key, i;
32
+
33
+ for (i = 0; i < sourceKeys.length; i++) {
34
+ key = sourceKeys[i];
35
+ if (excluded.indexOf(key) >= 0) continue;
36
+ target[key] = source[key];
14
37
  }
15
38
 
16
39
  return target;
17
- };
18
- return _extends.apply(this, arguments);
19
- }
20
-
21
- function _objectWithoutPropertiesLoose(source, excluded) {
22
- if (source == null) return {};
23
- var target = {};
24
- var sourceKeys = Object.keys(source);
25
- var key, i;
26
-
27
- for (i = 0; i < sourceKeys.length; i++) {
28
- key = sourceKeys[i];
29
- if (excluded.indexOf(key) >= 0) continue;
30
- target[key] = source[key];
31
40
  }
32
41
 
33
- return target;
34
- }
42
+ function _objectWithoutProperties(source, excluded) {
43
+ if (source == null) return {};
35
44
 
36
- function _objectWithoutProperties(source, excluded) {
37
- if (source == null) return {};
45
+ var target = _objectWithoutPropertiesLoose(source, excluded);
38
46
 
39
- var target = _objectWithoutPropertiesLoose(source, excluded);
47
+ var key, i;
40
48
 
41
- var key, i;
49
+ if (Object.getOwnPropertySymbols) {
50
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
42
51
 
43
- if (Object.getOwnPropertySymbols) {
44
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
52
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
53
+ key = sourceSymbolKeys[i];
54
+ if (excluded.indexOf(key) >= 0) continue;
55
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
56
+ target[key] = source[key];
57
+ }
58
+ }
45
59
 
46
- for (i = 0; i < sourceSymbolKeys.length; i++) {
47
- key = sourceSymbolKeys[i];
48
- if (excluded.indexOf(key) >= 0) continue;
49
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
50
- target[key] = source[key];
60
+ return target;
61
+ }
62
+
63
+ function _taggedTemplateLiteral(strings, raw) {
64
+ if (!raw) {
65
+ raw = strings.slice(0);
51
66
  }
67
+
68
+ return Object.freeze(Object.defineProperties(strings, {
69
+ raw: {
70
+ value: Object.freeze(raw)
71
+ }
72
+ }));
52
73
  }
53
74
 
54
- return target;
55
- }
75
+ var isCheckBoxInput = (element) => element.type === 'checkbox';
56
76
 
57
- function _taggedTemplateLiteral(strings, raw) {
58
- if (!raw) {
59
- raw = strings.slice(0);
77
+ var isDateObject = (value) => value instanceof Date;
78
+
79
+ var isNullOrUndefined = (value) => value == null;
80
+
81
+ const isObjectType = (value) => typeof value === 'object';
82
+ var isObject = (value) => !isNullOrUndefined(value) &&
83
+ !Array.isArray(value) &&
84
+ isObjectType(value) &&
85
+ !isDateObject(value);
86
+
87
+ var getEventValue = (event) => isObject(event) && event.target
88
+ ? isCheckBoxInput(event.target)
89
+ ? event.target.checked
90
+ : event.target.value
91
+ : event;
92
+
93
+ var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
94
+
95
+ var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
96
+
97
+ var isPlainObject = (tempObject) => {
98
+ const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
99
+ return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
100
+ };
101
+
102
+ var isWeb = typeof window !== 'undefined' &&
103
+ typeof window.HTMLElement !== 'undefined' &&
104
+ typeof document !== 'undefined';
105
+
106
+ function cloneObject(data) {
107
+ let copy;
108
+ const isArray = Array.isArray(data);
109
+ if (data instanceof Date) {
110
+ copy = new Date(data);
111
+ }
112
+ else if (data instanceof Set) {
113
+ copy = new Set(data);
114
+ }
115
+ else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
116
+ (isArray || isObject(data))) {
117
+ copy = isArray ? [] : {};
118
+ if (!isArray && !isPlainObject(data)) {
119
+ copy = data;
120
+ }
121
+ else {
122
+ for (const key in data) {
123
+ if (data.hasOwnProperty(key)) {
124
+ copy[key] = cloneObject(data[key]);
125
+ }
126
+ }
127
+ }
128
+ }
129
+ else {
130
+ return data;
131
+ }
132
+ return copy;
60
133
  }
61
134
 
62
- return Object.freeze(Object.defineProperties(strings, {
63
- raw: {
64
- value: Object.freeze(raw)
65
- }
66
- }));
67
- }
135
+ var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
136
+
137
+ var isUndefined = (val) => val === undefined;
138
+
139
+ var get = (obj, path, defaultValue) => {
140
+ if (!path || !isObject(obj)) {
141
+ return defaultValue;
142
+ }
143
+ const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
144
+ return isUndefined(result) || result === obj
145
+ ? isUndefined(obj[path])
146
+ ? defaultValue
147
+ : obj[path]
148
+ : result;
149
+ };
150
+
151
+ const EVENTS = {
152
+ BLUR: 'blur',
153
+ FOCUS_OUT: 'focusout',
154
+ CHANGE: 'change',
155
+ };
156
+ const VALIDATION_MODE = {
157
+ onBlur: 'onBlur',
158
+ onChange: 'onChange',
159
+ onSubmit: 'onSubmit',
160
+ onTouched: 'onTouched',
161
+ all: 'all',
162
+ };
68
163
 
69
- var isCheckBoxInput = (element) => element.type === 'checkbox';
164
+ const HookFormContext = React__default.createContext(null);
165
+ /**
166
+ * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
167
+ *
168
+ * @remarks
169
+ * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
170
+ *
171
+ * @returns return all useForm methods
172
+ *
173
+ * @example
174
+ * ```tsx
175
+ * function App() {
176
+ * const methods = useForm();
177
+ * const onSubmit = data => console.log(data);
178
+ *
179
+ * return (
180
+ * <FormProvider {...methods} >
181
+ * <form onSubmit={methods.handleSubmit(onSubmit)}>
182
+ * <NestedInput />
183
+ * <input type="submit" />
184
+ * </form>
185
+ * </FormProvider>
186
+ * );
187
+ * }
188
+ *
189
+ * function NestedInput() {
190
+ * const { register } = useFormContext(); // retrieve all hook methods
191
+ * return <input {...register("test")} />;
192
+ * }
193
+ * ```
194
+ */
195
+ const useFormContext = () => React__default.useContext(HookFormContext);
196
+
197
+ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
198
+ const result = {
199
+ defaultValues: control._defaultValues,
200
+ };
201
+ for (const key in formState) {
202
+ Object.defineProperty(result, key, {
203
+ get: () => {
204
+ const _key = key;
205
+ if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
206
+ control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
207
+ }
208
+ localProxyFormState && (localProxyFormState[_key] = true);
209
+ return formState[_key];
210
+ },
211
+ });
212
+ }
213
+ return result;
214
+ };
70
215
 
71
- var isDateObject = (value) => value instanceof Date;
216
+ var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
72
217
 
73
- var isNullOrUndefined = (value) => value == null;
218
+ var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
219
+ updateFormState(formStateData);
220
+ const { name, ...formState } = formStateData;
221
+ return (isEmptyObject(formState) ||
222
+ Object.keys(formState).length >= Object.keys(_proxyFormState).length ||
223
+ Object.keys(formState).find((key) => _proxyFormState[key] ===
224
+ (!isRoot || VALIDATION_MODE.all)));
225
+ };
74
226
 
75
- const isObjectType = (value) => typeof value === 'object';
76
- var isObject = (value) => !isNullOrUndefined(value) &&
77
- !Array.isArray(value) &&
78
- isObjectType(value) &&
79
- !isDateObject(value);
227
+ var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
228
+
229
+ var shouldSubscribeByName = (name, signalName, exact) => exact && signalName
230
+ ? name === signalName ||
231
+ (Array.isArray(name) &&
232
+ name.some((currentName) => currentName && exact && currentName === signalName))
233
+ : !name ||
234
+ !signalName ||
235
+ name === signalName ||
236
+ convertToArrayPayload(name).some((currentName) => currentName &&
237
+ (currentName.startsWith(signalName) ||
238
+ signalName.startsWith(currentName)));
239
+
240
+ function useSubscribe(props) {
241
+ const _props = React__default.useRef(props);
242
+ _props.current = props;
243
+ React__default.useEffect(() => {
244
+ const subscription = !props.disabled &&
245
+ _props.current.subject &&
246
+ _props.current.subject.subscribe({
247
+ next: _props.current.next,
248
+ });
249
+ return () => {
250
+ subscription && subscription.unsubscribe();
251
+ };
252
+ }, [props.disabled]);
253
+ }
80
254
 
81
- var getEventValue = (event) => isObject(event) && event.target
82
- ? isCheckBoxInput(event.target)
83
- ? event.target.checked
84
- : event.target.value
85
- : event;
255
+ /**
256
+ * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
257
+ *
258
+ * @remarks
259
+ * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)
260
+ *
261
+ * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}
262
+ *
263
+ * @example
264
+ * ```tsx
265
+ * function App() {
266
+ * const { register, handleSubmit, control } = useForm({
267
+ * defaultValues: {
268
+ * firstName: "firstName"
269
+ * }});
270
+ * const { dirtyFields } = useFormState({
271
+ * control
272
+ * });
273
+ * const onSubmit = (data) => console.log(data);
274
+ *
275
+ * return (
276
+ * <form onSubmit={handleSubmit(onSubmit)}>
277
+ * <input {...register("firstName")} placeholder="First Name" />
278
+ * {dirtyFields.firstName && <p>Field is dirty.</p>}
279
+ * <input type="submit" />
280
+ * </form>
281
+ * );
282
+ * }
283
+ * ```
284
+ */
285
+ function useFormState(props) {
286
+ const methods = useFormContext();
287
+ const { control = methods.control, disabled, name, exact } = props || {};
288
+ const [formState, updateFormState] = React__default.useState(control._formState);
289
+ const _mounted = React__default.useRef(true);
290
+ const _localProxyFormState = React__default.useRef({
291
+ isDirty: false,
292
+ isLoading: false,
293
+ dirtyFields: false,
294
+ touchedFields: false,
295
+ isValidating: false,
296
+ isValid: false,
297
+ errors: false,
298
+ });
299
+ const _name = React__default.useRef(name);
300
+ _name.current = name;
301
+ useSubscribe({
302
+ disabled,
303
+ next: (value) => _mounted.current &&
304
+ shouldSubscribeByName(_name.current, value.name, exact) &&
305
+ shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) &&
306
+ updateFormState({
307
+ ...control._formState,
308
+ ...value,
309
+ }),
310
+ subject: control._subjects.state,
311
+ });
312
+ React__default.useEffect(() => {
313
+ _mounted.current = true;
314
+ _localProxyFormState.current.isValid && control._updateValid(true);
315
+ return () => {
316
+ _mounted.current = false;
317
+ };
318
+ }, [control]);
319
+ return getProxyFormState(formState, control, _localProxyFormState.current, false);
320
+ }
86
321
 
87
- var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
322
+ var isString = (value) => typeof value === 'string';
88
323
 
89
- var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
324
+ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
325
+ if (isString(names)) {
326
+ isGlobal && _names.watch.add(names);
327
+ return get(formValues, names, defaultValue);
328
+ }
329
+ if (Array.isArray(names)) {
330
+ return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
331
+ }
332
+ isGlobal && (_names.watchAll = true);
333
+ return formValues;
334
+ };
90
335
 
91
- var isPlainObject = (tempObject) => {
92
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
93
- return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
94
- };
336
+ /**
337
+ * Custom hook to subscribe to field change and isolate re-rendering at the component level.
338
+ *
339
+ * @remarks
340
+ *
341
+ * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
342
+ *
343
+ * @example
344
+ * ```tsx
345
+ * const { watch } = useForm();
346
+ * const values = useWatch({
347
+ * name: "fieldName"
348
+ * control,
349
+ * })
350
+ * ```
351
+ */
352
+ function useWatch(props) {
353
+ const methods = useFormContext();
354
+ const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
355
+ const _name = React__default.useRef(name);
356
+ _name.current = name;
357
+ useSubscribe({
358
+ disabled,
359
+ subject: control._subjects.values,
360
+ next: (formState) => {
361
+ if (shouldSubscribeByName(_name.current, formState.name, exact)) {
362
+ updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
363
+ }
364
+ },
365
+ });
366
+ const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
367
+ React__default.useEffect(() => control._removeUnmounted());
368
+ return value;
369
+ }
95
370
 
96
- var isWeb = typeof window !== 'undefined' &&
97
- typeof window.HTMLElement !== 'undefined' &&
98
- typeof document !== 'undefined';
371
+ var isKey = (value) => /^\w*$/.test(value);
372
+
373
+ var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
374
+
375
+ function set(object, path, value) {
376
+ let index = -1;
377
+ const tempPath = isKey(path) ? [path] : stringToPath(path);
378
+ const length = tempPath.length;
379
+ const lastIndex = length - 1;
380
+ while (++index < length) {
381
+ const key = tempPath[index];
382
+ let newValue = value;
383
+ if (index !== lastIndex) {
384
+ const objValue = object[key];
385
+ newValue =
386
+ isObject(objValue) || Array.isArray(objValue)
387
+ ? objValue
388
+ : !isNaN(+tempPath[index + 1])
389
+ ? []
390
+ : {};
391
+ }
392
+ object[key] = newValue;
393
+ object = object[key];
394
+ }
395
+ return object;
396
+ }
99
397
 
100
- function cloneObject(data) {
101
- let copy;
102
- const isArray = Array.isArray(data);
103
- if (data instanceof Date) {
104
- copy = new Date(data);
105
- }
106
- else if (data instanceof Set) {
107
- copy = new Set(data);
108
- }
109
- else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) &&
110
- (isArray || isObject(data))) {
111
- copy = isArray ? [] : {};
112
- if (!isArray && !isPlainObject(data)) {
113
- copy = data;
114
- }
115
- else {
116
- for (const key in data) {
117
- if (data.hasOwnProperty(key)) {
118
- copy[key] = cloneObject(data[key]);
119
- }
120
- }
121
- }
122
- }
123
- else {
124
- return data;
125
- }
126
- return copy;
127
- }
398
+ /**
399
+ * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
400
+ *
401
+ * @remarks
402
+ * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
403
+ *
404
+ * @param props - the path name to the form field value, and validation rules.
405
+ *
406
+ * @returns field properties, field and form state. {@link UseControllerReturn}
407
+ *
408
+ * @example
409
+ * ```tsx
410
+ * function Input(props) {
411
+ * const { field, fieldState, formState } = useController(props);
412
+ * return (
413
+ * <div>
414
+ * <input {...field} placeholder={props.name} />
415
+ * <p>{fieldState.isTouched && "Touched"}</p>
416
+ * <p>{formState.isSubmitted ? "submitted" : ""}</p>
417
+ * </div>
418
+ * );
419
+ * }
420
+ * ```
421
+ */
422
+ function useController(props) {
423
+ const methods = useFormContext();
424
+ const { name, disabled, control = methods.control, shouldUnregister } = props;
425
+ const isArrayField = isNameInFieldArray(control._names.array, name);
426
+ const value = useWatch({
427
+ control,
428
+ name,
429
+ defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
430
+ exact: true,
431
+ });
432
+ const formState = useFormState({
433
+ control,
434
+ name,
435
+ });
436
+ const _registerProps = React__default.useRef(control.register(name, {
437
+ ...props.rules,
438
+ value,
439
+ }));
440
+ _registerProps.current = control.register(name, props.rules);
441
+ React__default.useEffect(() => {
442
+ const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
443
+ const updateMounted = (name, value) => {
444
+ const field = get(control._fields, name);
445
+ if (field) {
446
+ field._f.mount = value;
447
+ }
448
+ };
449
+ updateMounted(name, true);
450
+ if (_shouldUnregisterField) {
451
+ const value = cloneObject(get(control._options.defaultValues, name));
452
+ set(control._defaultValues, name, value);
453
+ if (isUndefined(get(control._formValues, name))) {
454
+ set(control._formValues, name, value);
455
+ }
456
+ }
457
+ return () => {
458
+ (isArrayField
459
+ ? _shouldUnregisterField && !control._state.action
460
+ : _shouldUnregisterField)
461
+ ? control.unregister(name)
462
+ : updateMounted(name, false);
463
+ };
464
+ }, [name, control, isArrayField, shouldUnregister]);
465
+ React__default.useEffect(() => {
466
+ control._updateDisabledField({
467
+ disabled,
468
+ fields: control._fields,
469
+ name,
470
+ });
471
+ }, [disabled, name, control]);
472
+ return {
473
+ field: {
474
+ name,
475
+ value,
476
+ disabled,
477
+ onChange: React__default.useCallback((event) => _registerProps.current.onChange({
478
+ target: {
479
+ value: getEventValue(event),
480
+ name: name,
481
+ },
482
+ type: EVENTS.CHANGE,
483
+ }), [name]),
484
+ onBlur: React__default.useCallback(() => _registerProps.current.onBlur({
485
+ target: {
486
+ value: get(control._formValues, name),
487
+ name: name,
488
+ },
489
+ type: EVENTS.BLUR,
490
+ }), [name, control]),
491
+ ref: (elm) => {
492
+ const field = get(control._fields, name);
493
+ if (field && elm) {
494
+ field._f.ref = {
495
+ focus: () => elm.focus(),
496
+ select: () => elm.select(),
497
+ setCustomValidity: (message) => elm.setCustomValidity(message),
498
+ reportValidity: () => elm.reportValidity(),
499
+ };
500
+ }
501
+ },
502
+ },
503
+ formState,
504
+ fieldState: Object.defineProperties({}, {
505
+ invalid: {
506
+ enumerable: true,
507
+ get: () => !!get(formState.errors, name),
508
+ },
509
+ isDirty: {
510
+ enumerable: true,
511
+ get: () => !!get(formState.dirtyFields, name),
512
+ },
513
+ isTouched: {
514
+ enumerable: true,
515
+ get: () => !!get(formState.touchedFields, name),
516
+ },
517
+ error: {
518
+ enumerable: true,
519
+ get: () => get(formState.errors, name),
520
+ },
521
+ }),
522
+ };
523
+ }
128
524
 
129
- var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
525
+ var _templateObject;
526
+ var RadioButtonLabel = styled.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n"])), function (props) {
527
+ return props.theme.marginPaddings[0];
528
+ }, function (props) {
529
+ return props.theme.marginPaddings[0];
530
+ });
130
531
 
131
- var isUndefined = (val) => val === undefined;
532
+ var _templateObject$1;
533
+ var RadioButtonText = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
132
534
 
133
- var get = (obj, path, defaultValue) => {
134
- if (!path || !isObject(obj)) {
135
- return defaultValue;
136
- }
137
- const result = compact(path.split(/[,[\].]+?/)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], obj);
138
- return isUndefined(result) || result === obj
139
- ? isUndefined(obj[path])
140
- ? defaultValue
141
- : obj[path]
142
- : result;
143
- };
144
-
145
- const EVENTS = {
146
- BLUR: 'blur',
147
- FOCUS_OUT: 'focusout',
148
- CHANGE: 'change',
149
- };
150
- const VALIDATION_MODE = {
151
- onBlur: 'onBlur',
152
- onChange: 'onChange',
153
- onSubmit: 'onSubmit',
154
- onTouched: 'onTouched',
155
- all: 'all',
156
- };
157
-
158
- const HookFormContext = React.createContext(null);
159
- /**
160
- * This custom hook allows you to access the form context. useFormContext is intended to be used in deeply nested structures, where it would become inconvenient to pass the context as a prop. To be used with {@link FormProvider}.
161
- *
162
- * @remarks
163
- * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
164
- *
165
- * @returns return all useForm methods
166
- *
167
- * @example
168
- * ```tsx
169
- * function App() {
170
- * const methods = useForm();
171
- * const onSubmit = data => console.log(data);
172
- *
173
- * return (
174
- * <FormProvider {...methods} >
175
- * <form onSubmit={methods.handleSubmit(onSubmit)}>
176
- * <NestedInput />
177
- * <input type="submit" />
178
- * </form>
179
- * </FormProvider>
180
- * );
181
- * }
182
- *
183
- * function NestedInput() {
184
- * const { register } = useFormContext(); // retrieve all hook methods
185
- * return <input {...register("test")} />;
186
- * }
187
- * ```
188
- */
189
- const useFormContext = () => React.useContext(HookFormContext);
190
-
191
- var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
192
- const result = {
193
- defaultValues: control._defaultValues,
194
- };
195
- for (const key in formState) {
196
- Object.defineProperty(result, key, {
197
- get: () => {
198
- const _key = key;
199
- if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
200
- control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
201
- }
202
- localProxyFormState && (localProxyFormState[_key] = true);
203
- return formState[_key];
204
- },
205
- });
206
- }
207
- return result;
208
- };
209
-
210
- var isEmptyObject = (value) => isObject(value) && !Object.keys(value).length;
211
-
212
- var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
213
- updateFormState(formStateData);
214
- const { name, ...formState } = formStateData;
215
- return (isEmptyObject(formState) ||
216
- Object.keys(formState).length >= Object.keys(_proxyFormState).length ||
217
- Object.keys(formState).find((key) => _proxyFormState[key] ===
218
- (!isRoot || VALIDATION_MODE.all)));
219
- };
220
-
221
- var convertToArrayPayload = (value) => (Array.isArray(value) ? value : [value]);
222
-
223
- var shouldSubscribeByName = (name, signalName, exact) => exact && signalName
224
- ? name === signalName ||
225
- (Array.isArray(name) &&
226
- name.some((currentName) => currentName && exact && currentName === signalName))
227
- : !name ||
228
- !signalName ||
229
- name === signalName ||
230
- convertToArrayPayload(name).some((currentName) => currentName &&
231
- (currentName.startsWith(signalName) ||
232
- signalName.startsWith(currentName)));
233
-
234
- function useSubscribe(props) {
235
- const _props = React.useRef(props);
236
- _props.current = props;
237
- React.useEffect(() => {
238
- const subscription = !props.disabled &&
239
- _props.current.subject &&
240
- _props.current.subject.subscribe({
241
- next: _props.current.next,
242
- });
243
- return () => {
244
- subscription && subscription.unsubscribe();
245
- };
246
- }, [props.disabled]);
247
- }
248
-
249
- /**
250
- * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
251
- *
252
- * @remarks
253
- * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)
254
- *
255
- * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}
256
- *
257
- * @example
258
- * ```tsx
259
- * function App() {
260
- * const { register, handleSubmit, control } = useForm({
261
- * defaultValues: {
262
- * firstName: "firstName"
263
- * }});
264
- * const { dirtyFields } = useFormState({
265
- * control
266
- * });
267
- * const onSubmit = (data) => console.log(data);
268
- *
269
- * return (
270
- * <form onSubmit={handleSubmit(onSubmit)}>
271
- * <input {...register("firstName")} placeholder="First Name" />
272
- * {dirtyFields.firstName && <p>Field is dirty.</p>}
273
- * <input type="submit" />
274
- * </form>
275
- * );
276
- * }
277
- * ```
278
- */
279
- function useFormState(props) {
280
- const methods = useFormContext();
281
- const { control = methods.control, disabled, name, exact } = props || {};
282
- const [formState, updateFormState] = React.useState(control._formState);
283
- const _mounted = React.useRef(true);
284
- const _localProxyFormState = React.useRef({
285
- isDirty: false,
286
- isLoading: false,
287
- dirtyFields: false,
288
- touchedFields: false,
289
- isValidating: false,
290
- isValid: false,
291
- errors: false,
292
- });
293
- const _name = React.useRef(name);
294
- _name.current = name;
295
- useSubscribe({
296
- disabled,
297
- next: (value) => _mounted.current &&
298
- shouldSubscribeByName(_name.current, value.name, exact) &&
299
- shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) &&
300
- updateFormState({
301
- ...control._formState,
302
- ...value,
303
- }),
304
- subject: control._subjects.state,
305
- });
306
- React.useEffect(() => {
307
- _mounted.current = true;
308
- _localProxyFormState.current.isValid && control._updateValid(true);
309
- return () => {
310
- _mounted.current = false;
311
- };
312
- }, [control]);
313
- return getProxyFormState(formState, control, _localProxyFormState.current, false);
314
- }
315
-
316
- var isString = (value) => typeof value === 'string';
317
-
318
- var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
319
- if (isString(names)) {
320
- isGlobal && _names.watch.add(names);
321
- return get(formValues, names, defaultValue);
322
- }
323
- if (Array.isArray(names)) {
324
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
325
- }
326
- isGlobal && (_names.watchAll = true);
327
- return formValues;
328
- };
329
-
330
- /**
331
- * Custom hook to subscribe to field change and isolate re-rendering at the component level.
332
- *
333
- * @remarks
334
- *
335
- * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
336
- *
337
- * @example
338
- * ```tsx
339
- * const { watch } = useForm();
340
- * const values = useWatch({
341
- * name: "fieldName"
342
- * control,
343
- * })
344
- * ```
345
- */
346
- function useWatch(props) {
347
- const methods = useFormContext();
348
- const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
349
- const _name = React.useRef(name);
350
- _name.current = name;
351
- useSubscribe({
352
- disabled,
353
- subject: control._subjects.values,
354
- next: (formState) => {
355
- if (shouldSubscribeByName(_name.current, formState.name, exact)) {
356
- updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
357
- }
358
- },
359
- });
360
- const [value, updateValue] = React.useState(control._getWatch(name, defaultValue));
361
- React.useEffect(() => control._removeUnmounted());
362
- return value;
363
- }
364
-
365
- var isKey = (value) => /^\w*$/.test(value);
366
-
367
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
368
-
369
- function set(object, path, value) {
370
- let index = -1;
371
- const tempPath = isKey(path) ? [path] : stringToPath(path);
372
- const length = tempPath.length;
373
- const lastIndex = length - 1;
374
- while (++index < length) {
375
- const key = tempPath[index];
376
- let newValue = value;
377
- if (index !== lastIndex) {
378
- const objValue = object[key];
379
- newValue =
380
- isObject(objValue) || Array.isArray(objValue)
381
- ? objValue
382
- : !isNaN(+tempPath[index + 1])
383
- ? []
384
- : {};
385
- }
386
- object[key] = newValue;
387
- object = object[key];
388
- }
389
- return object;
390
- }
391
-
392
- /**
393
- * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
394
- *
395
- * @remarks
396
- * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
397
- *
398
- * @param props - the path name to the form field value, and validation rules.
399
- *
400
- * @returns field properties, field and form state. {@link UseControllerReturn}
401
- *
402
- * @example
403
- * ```tsx
404
- * function Input(props) {
405
- * const { field, fieldState, formState } = useController(props);
406
- * return (
407
- * <div>
408
- * <input {...field} placeholder={props.name} />
409
- * <p>{fieldState.isTouched && "Touched"}</p>
410
- * <p>{formState.isSubmitted ? "submitted" : ""}</p>
411
- * </div>
412
- * );
413
- * }
414
- * ```
415
- */
416
- function useController(props) {
417
- const methods = useFormContext();
418
- const { name, disabled, control = methods.control, shouldUnregister } = props;
419
- const isArrayField = isNameInFieldArray(control._names.array, name);
420
- const value = useWatch({
421
- control,
422
- name,
423
- defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
424
- exact: true,
425
- });
426
- const formState = useFormState({
427
- control,
428
- name,
429
- });
430
- const _registerProps = React.useRef(control.register(name, {
431
- ...props.rules,
432
- value,
433
- }));
434
- _registerProps.current = control.register(name, props.rules);
435
- React.useEffect(() => {
436
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
437
- const updateMounted = (name, value) => {
438
- const field = get(control._fields, name);
439
- if (field) {
440
- field._f.mount = value;
441
- }
442
- };
443
- updateMounted(name, true);
444
- if (_shouldUnregisterField) {
445
- const value = cloneObject(get(control._options.defaultValues, name));
446
- set(control._defaultValues, name, value);
447
- if (isUndefined(get(control._formValues, name))) {
448
- set(control._formValues, name, value);
449
- }
450
- }
451
- return () => {
452
- (isArrayField
453
- ? _shouldUnregisterField && !control._state.action
454
- : _shouldUnregisterField)
455
- ? control.unregister(name)
456
- : updateMounted(name, false);
457
- };
458
- }, [name, control, isArrayField, shouldUnregister]);
459
- React.useEffect(() => {
460
- control._updateDisabledField({
461
- disabled,
462
- fields: control._fields,
463
- name,
464
- });
465
- }, [disabled, name, control]);
466
- return {
467
- field: {
468
- name,
469
- value,
470
- disabled,
471
- onChange: React.useCallback((event) => _registerProps.current.onChange({
472
- target: {
473
- value: getEventValue(event),
474
- name: name,
475
- },
476
- type: EVENTS.CHANGE,
477
- }), [name]),
478
- onBlur: React.useCallback(() => _registerProps.current.onBlur({
479
- target: {
480
- value: get(control._formValues, name),
481
- name: name,
482
- },
483
- type: EVENTS.BLUR,
484
- }), [name, control]),
485
- ref: (elm) => {
486
- const field = get(control._fields, name);
487
- if (field && elm) {
488
- field._f.ref = {
489
- focus: () => elm.focus(),
490
- select: () => elm.select(),
491
- setCustomValidity: (message) => elm.setCustomValidity(message),
492
- reportValidity: () => elm.reportValidity(),
493
- };
494
- }
495
- },
496
- },
497
- formState,
498
- fieldState: Object.defineProperties({}, {
499
- invalid: {
500
- enumerable: true,
501
- get: () => !!get(formState.errors, name),
502
- },
503
- isDirty: {
504
- enumerable: true,
505
- get: () => !!get(formState.dirtyFields, name),
506
- },
507
- isTouched: {
508
- enumerable: true,
509
- get: () => !!get(formState.touchedFields, name),
510
- },
511
- error: {
512
- enumerable: true,
513
- get: () => get(formState.errors, name),
514
- },
515
- }),
516
- };
517
- }
518
-
519
- var _templateObject;
520
- var RadioButtonLabel = styled.label(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-bottom: ", ";\n margin-right: ", ";\n"])), function (props) {
521
- return props.theme.marginPaddings[0];
522
- }, function (props) {
523
- return props.theme.marginPaddings[0];
524
- });
525
-
526
- var _templateObject$1;
527
- var RadioButtonText = styled.div(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n"])));
528
-
529
- var _templateObject$2;
530
- var RadioButtonCircle = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n height: 20px;\n width: 20px;\n border-radius: 50%;\n margin-right: 5px;\n border: 1px solid ", ";\n display: flex;\n"])), function (props) {
531
- return props.theme.colors.base;
532
- });
533
-
534
- var _templateObject$3;
535
- var RadioButtonCircleInner = styled.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n height: 8px;\n width: 8px;\n border-radius: 50%;\n margin: auto;\n"])));
536
-
537
- var _templateObject$4;
538
- var RadioButtonInput = styled.input(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n display: none;\n :checked ~ ", " {\n ", " {\n background-color: ", ";\n }\n }\n"])), RadioButtonCircle, RadioButtonCircleInner, function (props) {
539
- return props.theme.colors.base;
540
- });
541
-
542
- var _excluded = ["ref"];
543
-
544
- var _templateObject$5, _templateObject2;
545
- var OptionsRow = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
546
- var Options = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
547
-
548
- var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
549
- var control = _ref.control,
550
- name = _ref.name,
551
- isDisabled = _ref.isDisabled,
552
- options = _ref.options,
553
- defaultValue = _ref.defaultValue,
554
- setValue = _ref.setValue;
555
-
556
- var _useController = useController({
557
- name: name,
558
- control: control,
559
- defaultValue: defaultValue
560
- }),
561
- _useController$field = _useController.field,
562
- ref = _useController$field.ref,
563
- inputProps = _objectWithoutProperties(_useController$field, _excluded),
564
- _useController$fieldS = _useController.fieldState,
565
- invalid = _useController$fieldS.invalid,
566
- error = _useController$fieldS.error;
567
-
568
- useEffect(function () {
569
- if (defaultValue) {
570
- setValue(name, defaultValue);
571
- }
572
- }, [defaultValue, name, setValue]);
573
- return /*#__PURE__*/React.createElement(OptionsRow, null, /*#__PURE__*/React.createElement(Options, null, options.map(function (option) {
574
- return /*#__PURE__*/React.createElement(RadioButtonLabel, {
575
- key: option.value,
576
- htmlFor: option.value
577
- }, /*#__PURE__*/React.createElement(RadioButtonInput, _extends({
578
- id: option.value,
579
- ref: ref,
580
- type: "radio",
535
+ var _templateObject$2;
536
+ var RadioButtonCircle = styled.div(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteral(["\n height: 20px;\n width: 20px;\n border-radius: 50%;\n margin-right: 5px;\n border: 1px solid ", ";\n display: flex;\n"])), function (props) {
537
+ return props.theme.colors.base;
538
+ });
539
+
540
+ var _templateObject$3;
541
+ var RadioButtonCircleInner = styled.div(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteral(["\n height: 8px;\n width: 8px;\n border-radius: 50%;\n margin: auto;\n"])));
542
+
543
+ var _templateObject$4;
544
+ var RadioButtonInput = styled.input(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n display: none;\n :checked ~ ", " {\n ", " {\n background-color: ", ";\n }\n }\n"])), RadioButtonCircle, RadioButtonCircleInner, function (props) {
545
+ return props.theme.colors.base;
546
+ });
547
+
548
+ var _excluded = ["ref"];
549
+
550
+ var _templateObject$5, _templateObject2;
551
+ var OptionsRow = styled.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n"])));
552
+ var Options = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n flex-wrap: nowrap;\n flex-direction: row;\n flex-basis: 60%;\n"])));
553
+
554
+ var CommunicationPreferenceOptionsRenderer = function CommunicationPreferenceOptionsRenderer(_ref) {
555
+ var control = _ref.control,
556
+ name = _ref.name,
557
+ isDisabled = _ref.isDisabled,
558
+ options = _ref.options,
559
+ defaultValue = _ref.defaultValue,
560
+ setValue = _ref.setValue;
561
+
562
+ var _useController = useController({
581
563
  name: name,
582
- defaultChecked: inputProps.value === option.value.toString()
583
- }, inputProps, {
584
- disabled: isDisabled,
585
- value: option.value
586
- })), /*#__PURE__*/React.createElement(RadioButtonCircle, null, /*#__PURE__*/React.createElement(RadioButtonCircleInner, null)), /*#__PURE__*/React.createElement(RadioButtonText, null, option.label));
587
- })), invalid && /*#__PURE__*/React.createElement("span", {
588
- className: "form__error"
589
- }, error === null || error === void 0 ? void 0 : error.message));
590
- };
591
-
592
- export default CommunicationPreferenceOptionsRenderer;
564
+ control: control,
565
+ defaultValue: defaultValue
566
+ }),
567
+ _useController$field = _useController.field,
568
+ ref = _useController$field.ref,
569
+ inputProps = _objectWithoutProperties(_useController$field, _excluded),
570
+ _useController$fieldS = _useController.fieldState,
571
+ invalid = _useController$fieldS.invalid,
572
+ error = _useController$fieldS.error;
573
+
574
+ React.useEffect(function () {
575
+ if (defaultValue) {
576
+ setValue(name, defaultValue);
577
+ }
578
+ }, [defaultValue, name, setValue]);
579
+ return /*#__PURE__*/React__default.createElement(OptionsRow, null, /*#__PURE__*/React__default.createElement(Options, null, options.map(function (option) {
580
+ return /*#__PURE__*/React__default.createElement(RadioButtonLabel, {
581
+ key: option.value,
582
+ htmlFor: option.value
583
+ }, /*#__PURE__*/React__default.createElement(RadioButtonInput, _extends({
584
+ id: option.value,
585
+ ref: ref,
586
+ type: "radio",
587
+ name: name,
588
+ defaultChecked: inputProps.value === option.value.toString()
589
+ }, inputProps, {
590
+ disabled: isDisabled,
591
+ value: option.value
592
+ })), /*#__PURE__*/React__default.createElement(RadioButtonCircle, null, /*#__PURE__*/React__default.createElement(RadioButtonCircleInner, null)), /*#__PURE__*/React__default.createElement(RadioButtonText, null, option.label));
593
+ })), invalid && /*#__PURE__*/React__default.createElement("span", {
594
+ className: "form__error"
595
+ }, error === null || error === void 0 ? void 0 : error.message));
596
+ };
597
+
598
+ return CommunicationPreferenceOptionsRenderer;
599
+
600
+ })));