ingeniuscliq-core 0.4.25 → 0.4.27

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 (231) hide show
  1. package/dist/components/common/carousel/CustomCarousel.js +26 -0
  2. package/dist/components/common/carousel/CustomCarouselSection.js +41 -0
  3. package/dist/components/common/form/CustomFormField.js +29 -0
  4. package/dist/components/common/form/{FormCheckbox.tsx → FormCheckbox.js} +7 -7
  5. package/dist/components/common/form/{FormInput.tsx → FormInput.js} +5 -5
  6. package/dist/components/common/form/{FormSelect.tsx → FormSelect.js} +7 -7
  7. package/dist/components/common/form/{FormTextArea.tsx → FormTextArea.js} +5 -5
  8. package/dist/components/common/form/{FormWrapper.tsx → FormWrapper.js} +2 -2
  9. package/dist/components/common/logo/{Logo.tsx → Logo.js} +3 -3
  10. package/dist/components/common/pagination/{CustomPagination.tsx → CustomPagination.js} +6 -6
  11. package/dist/components/common/select/CustomSelect.js +27 -0
  12. package/dist/components/common/spinner/Spinner.js +32 -0
  13. package/dist/components/common/stepper/{Stepper.tsx → Stepper.js} +9 -9
  14. package/dist/components/layouts/CoreBaseLayout.js +19 -0
  15. package/dist/components/templates/CoreHomeLayout.js +8 -0
  16. package/dist/components/templates/{CorePreviewLayout.tsx → CorePreviewLayout.js} +3 -3
  17. package/dist/components/ui/accordion.js +44 -0
  18. package/dist/components/ui/{alert-dialog.tsx → alert-dialog.js} +28 -28
  19. package/dist/components/ui/{alert.tsx → alert.js} +5 -5
  20. package/dist/components/ui/{avatar.tsx → avatar.js} +11 -11
  21. package/dist/components/ui/{badge.tsx → badge.js} +3 -3
  22. package/dist/components/ui/{breadcrumb.tsx → breadcrumb.js} +13 -14
  23. package/dist/components/ui/{button.tsx → button.js} +4 -4
  24. package/dist/components/ui/{card.tsx → card.js} +8 -8
  25. package/dist/components/ui/{carousel.tsx → carousel.js} +14 -15
  26. package/dist/components/ui/{checkbox.tsx → checkbox.js} +9 -9
  27. package/dist/components/ui/{dialog.tsx → dialog.js} +26 -26
  28. package/dist/components/ui/{dropdown-menu.tsx → dropdown-menu.js} +37 -39
  29. package/dist/components/ui/{form.tsx → form.js} +10 -10
  30. package/dist/components/ui/{input.tsx → input.js} +2 -2
  31. package/dist/components/ui/{label.tsx → label.js} +6 -6
  32. package/dist/components/ui/{pagination.tsx → pagination.js} +16 -18
  33. package/dist/components/ui/{popover.tsx → popover.js} +8 -8
  34. package/dist/components/ui/radio-group.js +34 -0
  35. package/dist/components/ui/{select.tsx → select.js} +38 -40
  36. package/dist/components/ui/{separator.tsx → separator.js} +5 -5
  37. package/dist/components/ui/{sheet.tsx → sheet.js} +27 -27
  38. package/dist/components/ui/{skeleton.tsx → skeleton.js} +2 -2
  39. package/dist/components/ui/{slider.tsx → slider.js} +9 -9
  40. package/dist/components/ui/{stepper.tsx → stepper.js} +35 -35
  41. package/dist/components/ui/{switch.tsx → switch.js} +7 -7
  42. package/dist/components/ui/{table.tsx → table.js} +9 -9
  43. package/dist/components/ui/{tabs.tsx → tabs.js} +13 -13
  44. package/dist/components/ui/{textarea.tsx → textarea.js} +2 -2
  45. package/dist/components/ui/{tooltip.tsx → tooltip.js} +8 -8
  46. package/dist/helpers/axiosGlobal.js +1 -2
  47. package/dist/hooks/useNotification.js +1 -1
  48. package/dist/index.js +45 -45
  49. package/dist/lib/utils.js +2 -2
  50. package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
  51. package/dist/modules/CoreAuth/context/{AuthContext.tsx → AuthContext.js} +1 -1
  52. package/dist/modules/CoreAuth/index.js +2 -1
  53. package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
  54. package/dist/modules/CoreCustomization/index.js +1 -0
  55. package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
  56. package/dist/modules/CoreOrder/index.js +1 -0
  57. package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
  58. package/dist/modules/CorePayForm/index.js +1 -0
  59. package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
  60. package/dist/modules/CoreProduct/index.js +1 -0
  61. package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
  62. package/dist/modules/CoreShipment/index.js +1 -0
  63. package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
  64. package/package.json +2 -7
  65. package/dist/_virtual/index.js +0 -5
  66. package/dist/_virtual/index2.js +0 -3
  67. package/dist/_virtual/jsx-runtime.js +0 -5
  68. package/dist/_virtual/jsx-runtime2.js +0 -3
  69. package/dist/_virtual/react-jsx-runtime.development.js +0 -3
  70. package/dist/_virtual/react-jsx-runtime.production.js +0 -3
  71. package/dist/_virtual/use-sync-external-store-shim.development.js +0 -3
  72. package/dist/_virtual/use-sync-external-store-shim.production.js +0 -3
  73. package/dist/components/common/carousel/CustomCarousel.tsx +0 -26
  74. package/dist/components/common/carousel/CustomCarouselSection.tsx +0 -41
  75. package/dist/components/common/form/CustomFormField.tsx +0 -29
  76. package/dist/components/common/select/CustomSelect.tsx +0 -27
  77. package/dist/components/common/spinner/Spinner.tsx +0 -32
  78. package/dist/components/layouts/CoreBaseLayout.tsx +0 -19
  79. package/dist/components/templates/CoreHomeLayout.tsx +0 -8
  80. package/dist/components/ui/accordion.tsx +0 -44
  81. package/dist/components/ui/radio-group.tsx +0 -34
  82. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
  83. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
  84. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
  85. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
  86. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
  87. package/dist/node_modules/@radix-ui/number/dist/index.js +0 -6
  88. package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
  89. package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +0 -305
  90. package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -147
  91. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
  92. package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -118
  93. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -270
  94. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +0 -145
  95. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -70
  96. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
  97. package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
  98. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
  99. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -11
  100. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
  101. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -267
  102. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
  103. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
  104. package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
  105. package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -24
  106. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -834
  107. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -299
  108. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -283
  109. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
  110. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
  111. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
  112. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +0 -282
  113. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -223
  114. package/dist/node_modules/@radix-ui/react-select/dist/index.js +0 -1156
  115. package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -30
  116. package/dist/node_modules/@radix-ui/react-slider/dist/index.js +0 -554
  117. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -99
  118. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -152
  119. package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -187
  120. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -482
  121. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
  122. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
  123. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
  124. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
  125. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
  126. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -15
  127. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
  128. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -35
  129. package/dist/node_modules/@stepperize/core/dist/index.js +0 -3
  130. package/dist/node_modules/@stepperize/react/dist/index.js +0 -6
  131. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
  132. package/dist/node_modules/axios/index.js +0 -25
  133. package/dist/node_modules/axios/lib/adapters/adapters.js +0 -81
  134. package/dist/node_modules/axios/lib/adapters/fetch.js +0 -229
  135. package/dist/node_modules/axios/lib/adapters/xhr.js +0 -199
  136. package/dist/node_modules/axios/lib/axios.js +0 -86
  137. package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -133
  138. package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -23
  139. package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -5
  140. package/dist/node_modules/axios/lib/core/Axios.js +0 -238
  141. package/dist/node_modules/axios/lib/core/AxiosError.js +0 -101
  142. package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -312
  143. package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -69
  144. package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -22
  145. package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -81
  146. package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -106
  147. package/dist/node_modules/axios/lib/core/settle.js +0 -27
  148. package/dist/node_modules/axios/lib/core/transformData.js +0 -28
  149. package/dist/node_modules/axios/lib/defaults/index.js +0 -159
  150. package/dist/node_modules/axios/lib/defaults/transitional.js +0 -7
  151. package/dist/node_modules/axios/lib/env/data.js +0 -3
  152. package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
  153. package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
  154. package/dist/node_modules/axios/lib/helpers/bind.js +0 -7
  155. package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -69
  156. package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -15
  157. package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -48
  158. package/dist/node_modules/axios/lib/helpers/cookies.js +0 -43
  159. package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -93
  160. package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
  161. package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
  162. package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
  163. package/dist/node_modules/axios/lib/helpers/null.js +0 -4
  164. package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
  165. package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
  166. package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -46
  167. package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -58
  168. package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -53
  169. package/dist/node_modules/axios/lib/helpers/spread.js +0 -28
  170. package/dist/node_modules/axios/lib/helpers/throttle.js +0 -44
  171. package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -219
  172. package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
  173. package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -88
  174. package/dist/node_modules/axios/lib/helpers/validator.js +0 -99
  175. package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
  176. package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
  177. package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
  178. package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
  179. package/dist/node_modules/axios/lib/platform/common/utils.js +0 -45
  180. package/dist/node_modules/axios/lib/platform/index.js +0 -9
  181. package/dist/node_modules/axios/lib/utils.js +0 -780
  182. package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
  183. package/dist/node_modules/clsx/dist/clsx.js +0 -3
  184. package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
  185. package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
  186. package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
  187. package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
  188. package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -43
  189. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -30
  190. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -20
  191. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +0 -17
  192. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +0 -17
  193. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +0 -14
  194. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -14
  195. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -14
  196. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -14
  197. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -14
  198. package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +0 -14
  199. package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -18
  200. package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -17
  201. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -28
  202. package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -363
  203. package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -44
  204. package/dist/node_modules/react/jsx-runtime.js +0 -19
  205. package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -560
  206. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
  207. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
  208. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
  209. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
  210. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
  211. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
  212. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
  213. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
  214. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
  215. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
  216. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
  217. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
  218. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
  219. package/dist/node_modules/sonner/dist/index.js +0 -299
  220. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -3035
  221. package/dist/node_modules/tslib/tslib.es6.js +0 -56
  222. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
  223. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
  224. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
  225. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
  226. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
  227. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -106
  228. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
  229. package/dist/node_modules/use-sync-external-store/shim/index.js +0 -19
  230. package/dist/node_modules/zustand/esm/react.js +0 -22
  231. package/dist/node_modules/zustand/esm/vanilla.js +0 -24
@@ -1,560 +0,0 @@
1
- import React__default from 'react';
2
-
3
- var isCheckBoxInput = (element) => element.type === 'checkbox';
4
-
5
- var isDateObject = (value) => value instanceof Date;
6
-
7
- var isNullOrUndefined = (value) => value == null;
8
-
9
- const isObjectType = (value) => typeof value === 'object';
10
- var isObject = (value) => !isNullOrUndefined(value) &&
11
- !Array.isArray(value) &&
12
- isObjectType(value) &&
13
- !isDateObject(value);
14
-
15
- var getEventValue = (event) => isObject(event) && event.target
16
- ? isCheckBoxInput(event.target)
17
- ? event.target.checked
18
- : event.target.value
19
- : event;
20
-
21
- var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
22
-
23
- var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
24
-
25
- var isPlainObject = (tempObject) => {
26
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
27
- return (isObject(prototypeCopy) && prototypeCopy.hasOwnProperty('isPrototypeOf'));
28
- };
29
-
30
- var isWeb = typeof window !== 'undefined' &&
31
- typeof window.HTMLElement !== 'undefined' &&
32
- typeof document !== 'undefined';
33
-
34
- function cloneObject(data) {
35
- let copy;
36
- const isArray = Array.isArray(data);
37
- const isFileListInstance = typeof FileList !== 'undefined' ? data instanceof FileList : false;
38
- if (data instanceof Date) {
39
- copy = new Date(data);
40
- }
41
- else if (!(isWeb && (data instanceof Blob || isFileListInstance)) &&
42
- (isArray || isObject(data))) {
43
- copy = isArray ? [] : Object.create(Object.getPrototypeOf(data));
44
- if (!isArray && !isPlainObject(data)) {
45
- copy = data;
46
- }
47
- else {
48
- for (const key in data) {
49
- if (data.hasOwnProperty(key)) {
50
- copy[key] = cloneObject(data[key]);
51
- }
52
- }
53
- }
54
- }
55
- else {
56
- return data;
57
- }
58
- return copy;
59
- }
60
-
61
- var isKey = (value) => /^\w*$/.test(value);
62
-
63
- var isUndefined = (val) => val === undefined;
64
-
65
- var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
66
-
67
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, '').split(/\.|\[/));
68
-
69
- var get = (object, path, defaultValue) => {
70
- if (!path || !isObject(object)) {
71
- return defaultValue;
72
- }
73
- const result = (isKey(path) ? [path] : stringToPath(path)).reduce((result, key) => isNullOrUndefined(result) ? result : result[key], object);
74
- return isUndefined(result) || result === object
75
- ? isUndefined(object[path])
76
- ? defaultValue
77
- : object[path]
78
- : result;
79
- };
80
-
81
- var isBoolean = (value) => typeof value === 'boolean';
82
-
83
- var set = (object, path, value) => {
84
- let index = -1;
85
- const tempPath = isKey(path) ? [path] : stringToPath(path);
86
- const length = tempPath.length;
87
- const lastIndex = length - 1;
88
- while (++index < length) {
89
- const key = tempPath[index];
90
- let newValue = value;
91
- if (index !== lastIndex) {
92
- const objValue = object[key];
93
- newValue =
94
- isObject(objValue) || Array.isArray(objValue)
95
- ? objValue
96
- : !isNaN(+tempPath[index + 1])
97
- ? []
98
- : {};
99
- }
100
- if (key === '__proto__' || key === 'constructor' || key === 'prototype') {
101
- return;
102
- }
103
- object[key] = newValue;
104
- object = object[key];
105
- }
106
- };
107
-
108
- const EVENTS = {
109
- BLUR: 'blur',
110
- CHANGE: 'change',
111
- };
112
- const VALIDATION_MODE = {
113
- all: 'all',
114
- };
115
-
116
- const HookFormContext = React__default.createContext(null);
117
- HookFormContext.displayName = 'HookFormContext';
118
- /**
119
- * 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}.
120
- *
121
- * @remarks
122
- * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
123
- *
124
- * @returns return all useForm methods
125
- *
126
- * @example
127
- * ```tsx
128
- * function App() {
129
- * const methods = useForm();
130
- * const onSubmit = data => console.log(data);
131
- *
132
- * return (
133
- * <FormProvider {...methods} >
134
- * <form onSubmit={methods.handleSubmit(onSubmit)}>
135
- * <NestedInput />
136
- * <input type="submit" />
137
- * </form>
138
- * </FormProvider>
139
- * );
140
- * }
141
- *
142
- * function NestedInput() {
143
- * const { register } = useFormContext(); // retrieve all hook methods
144
- * return <input {...register("test")} />;
145
- * }
146
- * ```
147
- */
148
- const useFormContext = () => React__default.useContext(HookFormContext);
149
- /**
150
- * A provider component that propagates the `useForm` methods to all children components via [React Context](https://reactjs.org/docs/context.html) API. To be used with {@link useFormContext}.
151
- *
152
- * @remarks
153
- * [API](https://react-hook-form.com/docs/useformcontext) • [Demo](https://codesandbox.io/s/react-hook-form-v7-form-context-ytudi)
154
- *
155
- * @param props - all useForm methods
156
- *
157
- * @example
158
- * ```tsx
159
- * function App() {
160
- * const methods = useForm();
161
- * const onSubmit = data => console.log(data);
162
- *
163
- * return (
164
- * <FormProvider {...methods} >
165
- * <form onSubmit={methods.handleSubmit(onSubmit)}>
166
- * <NestedInput />
167
- * <input type="submit" />
168
- * </form>
169
- * </FormProvider>
170
- * );
171
- * }
172
- *
173
- * function NestedInput() {
174
- * const { register } = useFormContext(); // retrieve all hook methods
175
- * return <input {...register("test")} />;
176
- * }
177
- * ```
178
- */
179
- const FormProvider = (props) => {
180
- const { children, ...data } = props;
181
- return (React__default.createElement(HookFormContext.Provider, { value: data }, children));
182
- };
183
-
184
- var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
185
- const result = {
186
- defaultValues: control._defaultValues,
187
- };
188
- for (const key in formState) {
189
- Object.defineProperty(result, key, {
190
- get: () => {
191
- const _key = key;
192
- if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
193
- control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
194
- }
195
- localProxyFormState && (localProxyFormState[_key] = true);
196
- return formState[_key];
197
- },
198
- });
199
- }
200
- return result;
201
- };
202
-
203
- const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? React__default.useLayoutEffect : React__default.useEffect;
204
-
205
- /**
206
- * 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.
207
- *
208
- * @remarks
209
- * [API](https://react-hook-form.com/docs/useformstate) • [Demo](https://codesandbox.io/s/useformstate-75xly)
210
- *
211
- * @param props - include options on specify fields to subscribe. {@link UseFormStateReturn}
212
- *
213
- * @example
214
- * ```tsx
215
- * function App() {
216
- * const { register, handleSubmit, control } = useForm({
217
- * defaultValues: {
218
- * firstName: "firstName"
219
- * }});
220
- * const { dirtyFields } = useFormState({
221
- * control
222
- * });
223
- * const onSubmit = (data) => console.log(data);
224
- *
225
- * return (
226
- * <form onSubmit={handleSubmit(onSubmit)}>
227
- * <input {...register("firstName")} placeholder="First Name" />
228
- * {dirtyFields.firstName && <p>Field is dirty.</p>}
229
- * <input type="submit" />
230
- * </form>
231
- * );
232
- * }
233
- * ```
234
- */
235
- function useFormState(props) {
236
- const methods = useFormContext();
237
- const { control = methods.control, disabled, name, exact } = props || {};
238
- const [formState, updateFormState] = React__default.useState(control._formState);
239
- const _localProxyFormState = React__default.useRef({
240
- isDirty: false,
241
- isLoading: false,
242
- dirtyFields: false,
243
- touchedFields: false,
244
- validatingFields: false,
245
- isValidating: false,
246
- isValid: false,
247
- errors: false,
248
- });
249
- useIsomorphicLayoutEffect(() => control._subscribe({
250
- name,
251
- formState: _localProxyFormState.current,
252
- exact,
253
- callback: (formState) => {
254
- !disabled &&
255
- updateFormState({
256
- ...control._formState,
257
- ...formState,
258
- });
259
- },
260
- }), [name, disabled, exact]);
261
- React__default.useEffect(() => {
262
- _localProxyFormState.current.isValid && control._setValid(true);
263
- }, [control]);
264
- return React__default.useMemo(() => getProxyFormState(formState, control, _localProxyFormState.current, false), [formState, control]);
265
- }
266
-
267
- var isString = (value) => typeof value === 'string';
268
-
269
- var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
270
- if (isString(names)) {
271
- return get(formValues, names, defaultValue);
272
- }
273
- if (Array.isArray(names)) {
274
- return names.map((fieldName) => (get(formValues, fieldName)));
275
- }
276
- return formValues;
277
- };
278
-
279
- var isPrimitive = (value) => isNullOrUndefined(value) || !isObjectType(value);
280
-
281
- function deepEqual(object1, object2, _internal_visited = new WeakSet()) {
282
- if (isPrimitive(object1) || isPrimitive(object2)) {
283
- return object1 === object2;
284
- }
285
- if (isDateObject(object1) && isDateObject(object2)) {
286
- return object1.getTime() === object2.getTime();
287
- }
288
- const keys1 = Object.keys(object1);
289
- const keys2 = Object.keys(object2);
290
- if (keys1.length !== keys2.length) {
291
- return false;
292
- }
293
- if (_internal_visited.has(object1) || _internal_visited.has(object2)) {
294
- return true;
295
- }
296
- _internal_visited.add(object1);
297
- _internal_visited.add(object2);
298
- for (const key of keys1) {
299
- const val1 = object1[key];
300
- if (!keys2.includes(key)) {
301
- return false;
302
- }
303
- if (key !== 'ref') {
304
- const val2 = object2[key];
305
- if ((isDateObject(val1) && isDateObject(val2)) ||
306
- (isObject(val1) && isObject(val2)) ||
307
- (Array.isArray(val1) && Array.isArray(val2))
308
- ? !deepEqual(val1, val2, _internal_visited)
309
- : val1 !== val2) {
310
- return false;
311
- }
312
- }
313
- }
314
- return true;
315
- }
316
-
317
- /**
318
- * Custom hook to subscribe to field change and isolate re-rendering at the component level.
319
- *
320
- * @remarks
321
- *
322
- * [API](https://react-hook-form.com/docs/usewatch) • [Demo](https://codesandbox.io/s/react-hook-form-v7-ts-usewatch-h9i5e)
323
- *
324
- * @example
325
- * ```tsx
326
- * const { control } = useForm();
327
- * const values = useWatch({
328
- * name: "fieldName"
329
- * control,
330
- * })
331
- * ```
332
- */
333
- function useWatch(props) {
334
- const methods = useFormContext();
335
- const { control = methods.control, name, defaultValue, disabled, exact, compute, } = props || {};
336
- const _defaultValue = React__default.useRef(defaultValue);
337
- const _compute = React__default.useRef(compute);
338
- const _computeFormValues = React__default.useRef(undefined);
339
- _compute.current = compute;
340
- const defaultValueMemo = React__default.useMemo(() => control._getWatch(name, _defaultValue.current), [control, name]);
341
- const [value, updateValue] = React__default.useState(_compute.current ? _compute.current(defaultValueMemo) : defaultValueMemo);
342
- useIsomorphicLayoutEffect(() => control._subscribe({
343
- name,
344
- formState: {
345
- values: true,
346
- },
347
- exact,
348
- callback: (formState) => {
349
- if (!disabled) {
350
- const formValues = generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current);
351
- if (_compute.current) {
352
- const computedFormValues = _compute.current(formValues);
353
- if (!deepEqual(computedFormValues, _computeFormValues.current)) {
354
- updateValue(computedFormValues);
355
- _computeFormValues.current = computedFormValues;
356
- }
357
- }
358
- else {
359
- updateValue(formValues);
360
- }
361
- }
362
- },
363
- }), [control, disabled, name, exact]);
364
- React__default.useEffect(() => control._removeUnmounted());
365
- return value;
366
- }
367
-
368
- /**
369
- * 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.
370
- *
371
- * @remarks
372
- * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
373
- *
374
- * @param props - the path name to the form field value, and validation rules.
375
- *
376
- * @returns field properties, field and form state. {@link UseControllerReturn}
377
- *
378
- * @example
379
- * ```tsx
380
- * function Input(props) {
381
- * const { field, fieldState, formState } = useController(props);
382
- * return (
383
- * <div>
384
- * <input {...field} placeholder={props.name} />
385
- * <p>{fieldState.isTouched && "Touched"}</p>
386
- * <p>{formState.isSubmitted ? "submitted" : ""}</p>
387
- * </div>
388
- * );
389
- * }
390
- * ```
391
- */
392
- function useController(props) {
393
- const methods = useFormContext();
394
- const { name, disabled, control = methods.control, shouldUnregister, defaultValue, } = props;
395
- const isArrayField = isNameInFieldArray(control._names.array, name);
396
- const defaultValueMemo = React__default.useMemo(() => get(control._formValues, name, get(control._defaultValues, name, defaultValue)), [control, name, defaultValue]);
397
- const value = useWatch({
398
- control,
399
- name,
400
- defaultValue: defaultValueMemo,
401
- exact: true,
402
- });
403
- const formState = useFormState({
404
- control,
405
- name,
406
- exact: true,
407
- });
408
- const _props = React__default.useRef(props);
409
- const _registerProps = React__default.useRef(control.register(name, {
410
- ...props.rules,
411
- value,
412
- ...(isBoolean(props.disabled) ? { disabled: props.disabled } : {}),
413
- }));
414
- _props.current = props;
415
- const fieldState = React__default.useMemo(() => Object.defineProperties({}, {
416
- invalid: {
417
- enumerable: true,
418
- get: () => !!get(formState.errors, name),
419
- },
420
- isDirty: {
421
- enumerable: true,
422
- get: () => !!get(formState.dirtyFields, name),
423
- },
424
- isTouched: {
425
- enumerable: true,
426
- get: () => !!get(formState.touchedFields, name),
427
- },
428
- isValidating: {
429
- enumerable: true,
430
- get: () => !!get(formState.validatingFields, name),
431
- },
432
- error: {
433
- enumerable: true,
434
- get: () => get(formState.errors, name),
435
- },
436
- }), [formState, name]);
437
- const onChange = React__default.useCallback((event) => _registerProps.current.onChange({
438
- target: {
439
- value: getEventValue(event),
440
- name: name,
441
- },
442
- type: EVENTS.CHANGE,
443
- }), [name]);
444
- const onBlur = React__default.useCallback(() => _registerProps.current.onBlur({
445
- target: {
446
- value: get(control._formValues, name),
447
- name: name,
448
- },
449
- type: EVENTS.BLUR,
450
- }), [name, control._formValues]);
451
- const ref = React__default.useCallback((elm) => {
452
- const field = get(control._fields, name);
453
- if (field && elm) {
454
- field._f.ref = {
455
- focus: () => elm.focus && elm.focus(),
456
- select: () => elm.select && elm.select(),
457
- setCustomValidity: (message) => elm.setCustomValidity(message),
458
- reportValidity: () => elm.reportValidity(),
459
- };
460
- }
461
- }, [control._fields, name]);
462
- const field = React__default.useMemo(() => ({
463
- name,
464
- value,
465
- ...(isBoolean(disabled) || formState.disabled
466
- ? { disabled: formState.disabled || disabled }
467
- : {}),
468
- onChange,
469
- onBlur,
470
- ref,
471
- }), [name, disabled, formState.disabled, onChange, onBlur, ref, value]);
472
- React__default.useEffect(() => {
473
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
474
- control.register(name, {
475
- ..._props.current.rules,
476
- ...(isBoolean(_props.current.disabled)
477
- ? { disabled: _props.current.disabled }
478
- : {}),
479
- });
480
- const updateMounted = (name, value) => {
481
- const field = get(control._fields, name);
482
- if (field && field._f) {
483
- field._f.mount = value;
484
- }
485
- };
486
- updateMounted(name, true);
487
- if (_shouldUnregisterField) {
488
- const value = cloneObject(get(control._options.defaultValues, name));
489
- set(control._defaultValues, name, value);
490
- if (isUndefined(get(control._formValues, name))) {
491
- set(control._formValues, name, value);
492
- }
493
- }
494
- !isArrayField && control.register(name);
495
- return () => {
496
- (isArrayField
497
- ? _shouldUnregisterField && !control._state.action
498
- : _shouldUnregisterField)
499
- ? control.unregister(name)
500
- : updateMounted(name, false);
501
- };
502
- }, [name, control, isArrayField, shouldUnregister]);
503
- React__default.useEffect(() => {
504
- control._setDisabledField({
505
- disabled,
506
- name,
507
- });
508
- }, [disabled, name, control]);
509
- return React__default.useMemo(() => ({
510
- field,
511
- formState,
512
- fieldState,
513
- }), [field, formState, fieldState]);
514
- }
515
-
516
- /**
517
- * Component based on `useController` hook to work with controlled component.
518
- *
519
- * @remarks
520
- * [API](https://react-hook-form.com/docs/usecontroller/controller) • [Demo](https://codesandbox.io/s/react-hook-form-v6-controller-ts-jwyzw) • [Video](https://www.youtube.com/watch?v=N2UNk_UCVyA)
521
- *
522
- * @param props - the path name to the form field value, and validation rules.
523
- *
524
- * @returns provide field handler functions, field and form state.
525
- *
526
- * @example
527
- * ```tsx
528
- * function App() {
529
- * const { control } = useForm<FormValues>({
530
- * defaultValues: {
531
- * test: ""
532
- * }
533
- * });
534
- *
535
- * return (
536
- * <form>
537
- * <Controller
538
- * control={control}
539
- * name="test"
540
- * render={({ field: { onChange, onBlur, value, ref }, formState, fieldState }) => (
541
- * <>
542
- * <input
543
- * onChange={onChange} // send value to hook form
544
- * onBlur={onBlur} // notify when input is touched
545
- * value={value} // return updated value
546
- * ref={ref} // set ref for focus management
547
- * />
548
- * <p>{formState.isSubmitted ? "submitted" : ""}</p>
549
- * <p>{fieldState.isTouched ? "touched" : ""}</p>
550
- * </>
551
- * )}
552
- * />
553
- * </form>
554
- * );
555
- * }
556
- * ```
557
- */
558
- const Controller = (props) => props.render(useController(props));
559
-
560
- export { Controller, FormProvider, get, set, useController, useFormContext, useFormState, useWatch };
@@ -1,9 +0,0 @@
1
- import { __assign } from '../../../tslib/tslib.es6.js';
2
- import * as React from 'react';
3
- import { RemoveScroll } from './UI.js';
4
- import SideCar from './sidecar.js';
5
-
6
- var ReactRemoveScroll = React.forwardRef(function (props, ref) { return (React.createElement(RemoveScroll, __assign({}, props, { ref: ref, sideCar: SideCar }))); });
7
- ReactRemoveScroll.classNames = RemoveScroll.classNames;
8
-
9
- export { ReactRemoveScroll as default };