infinity-forge 3.4.7 → 3.4.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 (133) hide show
  1. package/dist/sites/components/default-pages/blog/components/blog-item/index.d.ts +1 -1
  2. package/dist/sites/components/default-pages/blog/components/blog-item/index.js +1 -1
  3. package/dist/sites/components/default-pages/blog/components/categorias/index.js +1 -1
  4. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.d.ts +4 -0
  5. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.js +42 -0
  6. package/dist/sites/components/default-pages/blog/components/featured-blog/index.js +1 -1
  7. package/dist/sites/components/default-pages/blog/components/side-box-newsletter/index.js +1 -1
  8. package/dist/sites/components/default-pages/blog/components/side-box-search/index.js +1 -1
  9. package/dist/sites/components/default-pages/blog/components/title-blog/index.js +1 -1
  10. package/dist/system/presentation/components/data/buttons/sidebar-button/index.js +1 -1
  11. package/dist/system/presentation/components/data/chat/card-message/index.d.ts +1 -1
  12. package/dist/system/presentation/components/data/chat/card-message/index.js +1 -1
  13. package/dist/system/presentation/components/data/chat/loader/index.js +1 -1
  14. package/dist/system/presentation/components/data/menu/components/menu-item/index.js +78 -0
  15. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/index.js +43 -0
  16. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/styles.js +15 -0
  17. package/dist/system/presentation/components/data/menu/modes/opened/index.js +50 -0
  18. package/dist/system/presentation/components/data/menu/modes/opened/styles.js +15 -0
  19. package/dist/system/presentation/components/data/notifications/card/index.d.ts +1 -1
  20. package/dist/system/presentation/components/data/notifications/card/index.js +1 -1
  21. package/dist/system/presentation/components/data/profile-infos/profile/index.js +1 -1
  22. package/dist/system/presentation/components/data/tab/tab-item/index.js +1 -1
  23. package/dist/system/presentation/components/layout/header/components/menu-right/component.d.ts +5 -0
  24. package/dist/system/presentation/components/layout/header/components/menu-right/component.js +34 -0
  25. package/dist/system/presentation/components/layout/header/components/menu-right/index.d.ts +3 -0
  26. package/dist/system/presentation/components/layout/header/components/menu-right/index.js +20 -0
  27. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.d.ts +0 -2
  28. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.js +0 -47
  29. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/index.js +0 -92
  30. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/interfaces.d.ts +0 -6
  31. package/dist/system/presentation/components/layout/header/components/menu-right/messages/index.js +0 -36
  32. package/dist/system/presentation/components/layout/header/components/menu-right/profile/content/index.js +0 -36
  33. package/dist/system/presentation/components/layout/header/components/menu-right/profile/index.js +0 -38
  34. package/dist/system/presentation/components/layout/header/components/search-modal/index.js +40 -0
  35. package/dist/system/presentation/components/layout/header/components/search-modal/search-list/index.js +0 -52
  36. package/dist/system/presentation/components/layout/header/components/search-modal/trigger/index.js +0 -45
  37. package/dist/system/presentation/components/layout/header/version-01/index.js +1 -1
  38. package/dist/system/presentation/components/pages/menus/table/columns.d.ts +1 -1
  39. package/dist/system/presentation/components/pages/menus/table/create.d.ts +1 -1
  40. package/dist/system/presentation/components/pages/menus/table/create.js +1 -1
  41. package/dist/system/presentation/components/pages/menus/table/delete.js +1 -1
  42. package/dist/system/presentation/components/pages/menus/table/edit.d.ts +1 -1
  43. package/dist/system/presentation/components/pages/menus/table/edit.js +1 -0
  44. package/dist/system/presentation/components/pages/menus/table/icon/index.js +34 -0
  45. package/dist/system/presentation/components/pages/users/table/columns.d.ts +1 -1
  46. package/dist/system/presentation/components/pages/users/table/create.d.ts +1 -1
  47. package/dist/system/presentation/components/pages/users/table/create.js +1 -1
  48. package/dist/system/presentation/components/pages/users/table/delete.js +1 -1
  49. package/dist/system/presentation/components/pages/users/table/edit.d.ts +1 -1
  50. package/dist/system/presentation/components/pages/users/table/edit.js +1 -0
  51. package/dist/system/presentation/context/auth/components/login/form-login/index.js +12 -0
  52. package/dist/system/presentation/context/auth/components/login/index.js +1 -1
  53. package/dist/system/presentation/context/auth/components/private-page/index.js +1 -1
  54. package/dist/system/presentation/hooks/locales/ibge/use-load-cities-by-uf/index.d.ts +1 -1
  55. package/dist/system/presentation/hooks/locales/ibge/use-load-cities-by-uf/index.js +1 -1
  56. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.d.ts +0 -5
  57. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.js +0 -80
  58. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.d.ts +0 -5
  59. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.js +0 -111
  60. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.d.ts +0 -2
  61. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.js +0 -78
  62. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.d.ts +0 -4
  63. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.js +0 -60
  64. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.d.ts +0 -4
  65. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.js +0 -35
  66. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.d.ts +0 -2
  67. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.js +0 -144
  68. package/dist/system/presentation/hooks/ui/use-table/components/table/index.d.ts +2 -0
  69. package/dist/system/presentation/hooks/ui/use-table/components/table/index.js +105 -0
  70. package/dist/system/presentation/hooks/ui/use-table/components/table/interfaces.d.ts +14 -0
  71. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.d.ts +0 -2
  72. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.js +0 -56
  73. package/dist/system/presentation/hooks/ui/use-table/components/table/skeleton-table/index.js +0 -34
  74. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.d.ts +0 -2
  75. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.js +0 -50
  76. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/interfaces.d.ts +0 -6
  77. package/dist/system/presentation/hooks/ui/use-table/query/hook.js +1 -1
  78. package/dist/ui/components/carousel/carousel-lib/core/modules/observer/observer.js +2 -2
  79. package/dist/ui/components/carousel/carousel-lib/core/modules/resize/resize.js +1 -1
  80. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.d.ts +1 -1
  81. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.js +1 -1
  82. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.d.ts +3 -3
  83. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.js +3 -3
  84. package/dist/ui/components/form/input-date-picker/calendar/calendar-header/index.js +62 -0
  85. package/dist/ui/components/form/input-date-picker/calendar/days/index.d.ts +2 -0
  86. package/dist/ui/components/form/input-date-picker/calendar/days/index.js +87 -0
  87. package/dist/ui/components/form/input-date-picker/calendar/months/index.d.ts +2 -0
  88. package/dist/ui/components/form/input-date-picker/calendar/months/index.js +66 -0
  89. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.d.ts +0 -13
  90. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.js +0 -18
  91. package/dist/ui/components/form/input-file/render-files/file-item/index.d.ts +3 -0
  92. package/dist/ui/components/form/input-file/render-files/file-item/index.js +49 -0
  93. package/dist/ui/components/form/input-mask/lib/core/errors/SyntheticChangeError.d.ts +0 -14
  94. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.d.ts +0 -10
  95. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.js +0 -204
  96. package/dist/ui/components/form/input-mask/lib/core/index.d.ts +5 -0
  97. package/dist/ui/components/form/input-mask/lib/core/index.js +15 -0
  98. package/dist/ui/components/form/input-mask/lib/core/utils/setInputAttributes.d.ts +0 -2
  99. package/dist/ui/components/form/input-mask/lib/mask/InputMask.d.ts +6 -0
  100. package/dist/ui/components/form/input-mask/lib/mask/InputMask.js +44 -0
  101. package/dist/ui/components/form/input-mask/lib/mask/index.d.ts +5 -0
  102. package/dist/ui/components/form/input-mask/lib/mask/index.js +26 -0
  103. package/dist/ui/components/form/input-mask/lib/mask/types.d.ts +61 -0
  104. package/dist/ui/components/form/input-mask/lib/mask/useMask.d.ts +3 -0
  105. package/dist/ui/components/form/input-mask/lib/mask/useMask.js +150 -0
  106. package/dist/ui/components/form/input-mask/lib/mask/utils/filter.d.ts +0 -14
  107. package/dist/ui/components/form/input-mask/lib/mask/utils/format.d.ts +0 -14
  108. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToParts.d.ts +0 -17
  109. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToReplacementObject.d.ts +0 -2
  110. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.d.ts +0 -14
  111. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.js +0 -25
  112. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveSelection.d.ts +0 -18
  113. package/dist/ui/components/form/input-mask/lib/mask/utils/unformat.d.ts +0 -16
  114. package/dist/ui/components/form/input-mask/lib/mask/utils/validate.d.ts +0 -13
  115. package/dist/ui/components/form/input-mask/lib/mask/utils.d.ts +63 -0
  116. package/dist/ui/components/form/input-mask/lib/mask/utils.js +114 -0
  117. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.d.ts +6 -0
  118. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.js +58 -0
  119. package/dist/ui/components/form/input-mask/lib/number-format/index.d.ts +4 -0
  120. package/dist/ui/components/form/input-mask/lib/number-format/index.js +11 -0
  121. package/dist/ui/components/form/input-mask/lib/number-format/types.d.ts +26 -0
  122. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.d.ts +3 -0
  123. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.js +208 -0
  124. package/dist/ui/components/form/input-mask/lib/number-format/utils/localizeValues.d.ts +0 -7
  125. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.d.ts +0 -20
  126. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.js +0 -123
  127. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveMinimumFractionDigits.d.ts +0 -11
  128. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveOptions.d.ts +0 -5
  129. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveSelection.d.ts +0 -24
  130. package/dist/ui/components/form/input-seo/input-meta-image/index.d.ts +1 -1
  131. package/dist/ui/components/form/input-seo/input-meta-image/index.js +1 -1
  132. package/dist/ui/components/menu-mobile/components/nav-links/index.js +1 -1
  133. package/package.json +1 -1
@@ -1,204 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = require("react");
7
- var react_dom_1 = require("react-dom");
8
- var SyntheticChangeError_1 = __importDefault(require("../errors/SyntheticChangeError"));
9
- var setInputAttributes_1 = __importDefault(require("../utils/setInputAttributes"));
10
- var TYPES = ['text', 'email', 'tel', 'search', 'url'];
11
- function proxy(inputRef, init, _a) {
12
- var onFocus = _a.onFocus, onBlur = _a.onBlur, onInput = _a.onInput;
13
- return new Proxy(inputRef, {
14
- set: function (target, property, inputElement) {
15
- var _a;
16
- if (property !== 'current') {
17
- return false;
18
- }
19
- var isValidType = inputElement !== null && TYPES.includes(inputElement.type);
20
- if (process.env.NODE_ENV !== 'production' && inputElement !== null && !isValidType) {
21
- console.warn("Warn: The input element type does not match one of the types: ".concat(TYPES.join(', '), "."));
22
- }
23
- if (inputElement !== inputRef.current) {
24
- if (inputRef.current !== null) {
25
- inputRef.current.removeEventListener('focus', onFocus);
26
- inputRef.current.removeEventListener('blur', onBlur);
27
- inputRef.current.removeEventListener('input', onInput);
28
- }
29
- if (inputElement !== null && isValidType) {
30
- var _b = (_a = inputElement._wrapperState) !== null && _a !== void 0 ? _a : {}, _c = _b.controlled, controlled = _c === void 0 ? false : _c, _d = _b.initialValue, initialValue = _d === void 0 ? '' : _d;
31
- var initResult = init({ controlled: controlled, initialValue: inputElement.value || initialValue });
32
- (0, setInputAttributes_1.default)(inputElement, { value: initResult.value });
33
- if (document.activeElement === inputElement) {
34
- onFocus();
35
- }
36
- inputElement.addEventListener('focus', onFocus);
37
- inputElement.addEventListener('blur', onBlur);
38
- inputElement.addEventListener('input', onInput);
39
- }
40
- }
41
- target[property] = inputElement;
42
- return true;
43
- },
44
- });
45
- }
46
- function useInput(_a) {
47
- var init = _a.init, tracking = _a.tracking, eventType = _a.eventType, eventHandler = _a.eventHandler;
48
- var selection = (0, react_1.useRef)({
49
- timeoutId: -1,
50
- fallbackTimeoutId: -1,
51
- cachedTimeoutId: -1,
52
- start: 0,
53
- end: 0,
54
- });
55
- var dispatchedCustomInputEvent = (0, react_1.useRef)(true);
56
- var inputRef = (0, react_1.useRef)(null);
57
- var props = (0, react_1.useRef)({
58
- init: init,
59
- tracking: tracking,
60
- eventType: eventType,
61
- eventHandler: eventHandler,
62
- });
63
- props.current.init = init;
64
- props.current.tracking = tracking;
65
- props.current.eventType = eventType;
66
- props.current.eventHandler = eventHandler;
67
- return (0, react_1.useMemo)(function () {
68
- return proxy(inputRef, props.current.init, {
69
- onFocus: function () {
70
- var setSelection = function () {
71
- var _a, _b, _c, _d;
72
- if (dispatchedCustomInputEvent.current) {
73
- selection.current.start = (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.selectionStart) !== null && _b !== void 0 ? _b : 0;
74
- selection.current.end = (_d = (_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.selectionEnd) !== null && _d !== void 0 ? _d : 0;
75
- selection.current.timeoutId = window.setTimeout(setSelection);
76
- }
77
- else {
78
- selection.current.fallbackTimeoutId = window.setTimeout(setSelection);
79
- }
80
- };
81
- selection.current.timeoutId = window.setTimeout(setSelection);
82
- },
83
- onBlur: function () {
84
- window.clearTimeout(selection.current.timeoutId);
85
- window.clearTimeout(selection.current.fallbackTimeoutId);
86
- selection.current.timeoutId = -1;
87
- selection.current.fallbackTimeoutId = -1;
88
- selection.current.cachedTimeoutId = -1;
89
- },
90
- onInput: function (event) {
91
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
92
- var inputElement = inputRef.current;
93
- if (inputElement === null) {
94
- return;
95
- }
96
- try {
97
- if (selection.current.cachedTimeoutId === selection.current.timeoutId) {
98
- throw new SyntheticChangeError_1.default('The input selection has not been updated.');
99
- }
100
- selection.current.cachedTimeoutId = selection.current.timeoutId;
101
- var value = inputElement.value, selectionStart = inputElement.selectionStart, selectionEnd = inputElement.selectionEnd;
102
- if (selectionStart === null || selectionEnd === null) {
103
- throw new SyntheticChangeError_1.default('The selection attributes have not been initialized.');
104
- }
105
- var previousValue = (_c = (_b = (_a = inputElement._valueTracker) === null || _a === void 0 ? void 0 : _a.getValue) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : '';
106
- var inputType = void 0;
107
- if (selectionStart > selection.current.start) {
108
- inputType = 'insert';
109
- }
110
- else if (selectionStart <= selection.current.start && selectionStart < selection.current.end) {
111
- inputType = 'deleteBackward';
112
- }
113
- else if (selectionStart === selection.current.end && value.length < previousValue.length) {
114
- inputType = 'deleteForward';
115
- }
116
- if (inputType === undefined ||
117
- ((inputType === 'deleteBackward' || inputType === 'deleteForward') && value.length > previousValue.length)) {
118
- throw new SyntheticChangeError_1.default('Input type detection error.');
119
- }
120
- var addedValue = '';
121
- var deletedValue = '';
122
- var changeStart = selection.current.start;
123
- var changeEnd = selection.current.end;
124
- if (inputType === 'insert') {
125
- addedValue = value.slice(selection.current.start, selectionStart);
126
- }
127
- else {
128
- var countDeleted = previousValue.length - value.length;
129
- changeStart = selectionStart;
130
- changeEnd = selectionStart + countDeleted;
131
- deletedValue = previousValue.slice(changeStart, changeEnd);
132
- }
133
- var trackingResult_1 = props.current.tracking({
134
- inputType: inputType,
135
- previousValue: previousValue,
136
- value: value,
137
- addedValue: addedValue,
138
- deletedValue: deletedValue,
139
- changeStart: changeStart,
140
- changeEnd: changeEnd,
141
- selectionStart: selectionStart,
142
- selectionEnd: selectionEnd,
143
- });
144
- (0, setInputAttributes_1.default)(inputElement, {
145
- value: trackingResult_1.value,
146
- selectionStart: trackingResult_1.selectionStart,
147
- selectionEnd: trackingResult_1.selectionEnd,
148
- });
149
- var customEventType_1 = props.current.eventType;
150
- var customEventHandler_1 = props.current.eventHandler;
151
- if (typeof customEventType_1 === 'string' && customEventHandler_1) {
152
- var value_1 = inputElement.value, selectionStart_1 = inputElement.selectionStart, selectionEnd_1 = inputElement.selectionEnd;
153
- dispatchedCustomInputEvent.current = false;
154
- requestAnimationFrame(function () {
155
- (0, setInputAttributes_1.default)(inputElement, {
156
- value: value_1,
157
- selectionStart: selectionStart_1 !== null && selectionStart_1 !== void 0 ? selectionStart_1 : value_1.length,
158
- selectionEnd: selectionEnd_1 !== null && selectionEnd_1 !== void 0 ? selectionEnd_1 : value_1.length,
159
- });
160
- var customInputEvent = new CustomEvent(customEventType_1, {
161
- bubbles: true,
162
- cancelable: false,
163
- composed: true,
164
- detail: trackingResult_1.__detail,
165
- });
166
- inputElement.dispatchEvent(customInputEvent);
167
- if (react_dom_1.unstable_batchedUpdates) {
168
- (0, react_dom_1.unstable_batchedUpdates)(customEventHandler_1, customInputEvent);
169
- }
170
- else {
171
- customEventHandler_1(customInputEvent);
172
- }
173
- dispatchedCustomInputEvent.current = true;
174
- });
175
- }
176
- (_e = (_d = inputElement._valueTracker) === null || _d === void 0 ? void 0 : _d.setValue) === null || _e === void 0 ? void 0 : _e.call(_d, previousValue);
177
- selection.current.start = trackingResult_1.selectionStart;
178
- selection.current.end = trackingResult_1.selectionEnd;
179
- }
180
- catch (error) {
181
- var _s = error, name_1 = _s.name, cause = _s.cause;
182
- (0, setInputAttributes_1.default)(inputElement, {
183
- value: (_k = (_g = (_f = cause === null || cause === void 0 ? void 0 : cause.__attributes) === null || _f === void 0 ? void 0 : _f.value) !== null && _g !== void 0 ? _g : (_j = (_h = inputElement._valueTracker) === null || _h === void 0 ? void 0 : _h.getValue) === null || _j === void 0 ? void 0 : _j.call(_h)) !== null && _k !== void 0 ? _k : '',
184
- selectionStart: (_m = (_l = cause === null || cause === void 0 ? void 0 : cause.__attributes) === null || _l === void 0 ? void 0 : _l.selectionStart) !== null && _m !== void 0 ? _m : selection.current.start,
185
- selectionEnd: (_p = (_o = cause === null || cause === void 0 ? void 0 : cause.__attributes) === null || _o === void 0 ? void 0 : _o.selectionEnd) !== null && _p !== void 0 ? _p : selection.current.end,
186
- });
187
- if (((_q = cause === null || cause === void 0 ? void 0 : cause.__attributes) === null || _q === void 0 ? void 0 : _q.selectionStart) !== undefined) {
188
- selection.current.start = cause.__attributes.selectionStart;
189
- }
190
- if (((_r = cause === null || cause === void 0 ? void 0 : cause.__attributes) === null || _r === void 0 ? void 0 : _r.selectionEnd) !== undefined) {
191
- selection.current.end = cause.__attributes.selectionEnd;
192
- }
193
- event.preventDefault();
194
- event.stopPropagation();
195
- if (name_1 !== 'SyntheticChangeError') {
196
- throw error;
197
- }
198
- }
199
- },
200
- });
201
- }, []);
202
- }
203
- exports.default = useInput;
204
- //# sourceMappingURL=useInput.js.map
@@ -0,0 +1,5 @@
1
+ export { default as SyntheticChangeError } from './errors/SyntheticChangeError.js';
2
+ export { default as useConnectedInputRef } from './hooks/useConnectedInputRef.js';
3
+ export { default as useInput } from './hooks/useInput.js';
4
+ export { default as setInputAttributes } from './utils/setInputAttributes.js';
5
+ export type * from './types.js';
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.setInputAttributes = exports.useInput = exports.useConnectedInputRef = exports.SyntheticChangeError = void 0;
7
+ var SyntheticChangeError_1 = require("./errors/SyntheticChangeError.js");
8
+ Object.defineProperty(exports, "SyntheticChangeError", { enumerable: true, get: function () { return __importDefault(SyntheticChangeError_1).default; } });
9
+ var useConnectedInputRef_1 = require("./hooks/useConnectedInputRef.js");
10
+ Object.defineProperty(exports, "useConnectedInputRef", { enumerable: true, get: function () { return __importDefault(useConnectedInputRef_1).default; } });
11
+ var useInput_1 = require("./hooks/useInput.js");
12
+ Object.defineProperty(exports, "useInput", { enumerable: true, get: function () { return __importDefault(useInput_1).default; } });
13
+ var setInputAttributes_1 = require("./utils/setInputAttributes.js");
14
+ Object.defineProperty(exports, "setInputAttributes", { enumerable: true, get: function () { return __importDefault(setInputAttributes_1).default; } });
15
+ //# sourceMappingURL=index.js.map
@@ -1,2 +0,0 @@
1
- import type { InputAttributes } from '../types';
2
- export default function setInputAttributes(inputElement: HTMLInputElement, { value, selectionStart, selectionEnd }: Partial<InputAttributes>): void;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { MaskProps } from './types.js';
3
+ import type { InputComponent, InputComponentProps } from '../core/index.js';
4
+ export type InputMaskProps<C extends React.ComponentType | undefined = undefined> = MaskProps & InputComponentProps<C>;
5
+ declare const InputMask: InputComponent<MaskProps>;
6
+ export default InputMask;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var jsx_runtime_1 = require("react/jsx-runtime");
29
+ var react_1 = require("react");
30
+ var core_1 = require("../core/index.js");
31
+ var useMask_1 = __importDefault(require("./useMask.js"));
32
+ function ForwardedInputMask(_a, forwardedInputRef) {
33
+ var Component = _a.component, mask = _a.mask, replacement = _a.replacement, showMask = _a.showMask, separate = _a.separate, track = _a.track, modify = _a.modify, onMask = _a.onMask, props = __rest(_a, ["component", "mask", "replacement", "showMask", "separate", "track", "modify", "onMask"]);
34
+ var inputRef = (0, useMask_1.default)({ mask: mask, replacement: replacement, showMask: showMask, separate: separate, track: track, modify: modify, onMask: onMask });
35
+ var connectedInputRef = (0, core_1.useConnectedInputRef)(inputRef, forwardedInputRef);
36
+ if (Component) {
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ return (0, jsx_runtime_1.jsx)(Component, __assign({ ref: connectedInputRef }, props));
39
+ }
40
+ return (0, jsx_runtime_1.jsx)("input", __assign({ ref: connectedInputRef }, props));
41
+ }
42
+ var InputMask = (0, react_1.forwardRef)(ForwardedInputMask);
43
+ exports.default = InputMask;
44
+ //# sourceMappingURL=InputMask.js.map
@@ -0,0 +1,5 @@
1
+ export { default as InputMask } from './InputMask.js';
2
+ export { default as useMask } from './useMask.js';
3
+ export * from './utils.js';
4
+ export type { InputMaskProps } from './InputMask.js';
5
+ export type { MaskProps, Replacement, TrackParam, Track, ModifiedData, Modify, MaskEvent, MaskEventDetail, MaskEventHandler, } from './types.js';
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.useMask = exports.InputMask = void 0;
21
+ var InputMask_1 = require("./InputMask.js");
22
+ Object.defineProperty(exports, "InputMask", { enumerable: true, get: function () { return __importDefault(InputMask_1).default; } });
23
+ var useMask_1 = require("./useMask.js");
24
+ Object.defineProperty(exports, "useMask", { enumerable: true, get: function () { return __importDefault(useMask_1).default; } });
25
+ __exportStar(require("./utils.js"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,61 @@
1
+ import type { CustomInputEvent, CustomInputEventHandler } from '../core/index.js';
2
+ export interface MaskPart {
3
+ type: 'replacement' | 'mask' | 'input';
4
+ value: string;
5
+ index: number;
6
+ }
7
+ export interface MaskEventDetail {
8
+ /** Masked value (same as `event.target.value`). */
9
+ value: string;
10
+ /** Value without mask characters. */
11
+ input: string;
12
+ /**
13
+ * Parts of the masked value, where each object contains the character type:
14
+ * - `replacement` - the replacement character;
15
+ * - `mask` - the mask character;
16
+ * - `input` - the character entered by the user.
17
+ */
18
+ parts: MaskPart[];
19
+ /** A regular expression of type `string` that the masked value must match. */
20
+ pattern: string;
21
+ /** `true` if the mask is full and matches the pattern value. */
22
+ isValid: boolean;
23
+ }
24
+ export type MaskEvent = CustomInputEvent<MaskEventDetail>;
25
+ export type MaskEventHandler = CustomInputEventHandler<MaskEvent>;
26
+ export type Replacement = Record<string, RegExp>;
27
+ export type TrackParam = ({
28
+ inputType: 'insert';
29
+ data: string;
30
+ } | {
31
+ inputType: 'deleteBackward' | 'deleteForward';
32
+ data: null;
33
+ }) & {
34
+ value: string;
35
+ selectionStart: number;
36
+ selectionEnd: number;
37
+ };
38
+ export type Track = (param: TrackParam) => string | boolean | null | undefined;
39
+ export interface ModifiedData {
40
+ mask?: string;
41
+ replacement?: string | Replacement;
42
+ showMask?: boolean;
43
+ separate?: boolean;
44
+ }
45
+ export type Modify = (input: string) => ModifiedData | undefined;
46
+ export interface MaskProps {
47
+ /** Input mask, `replacement` is used to replace characters. */
48
+ mask?: string;
49
+ /** Sets the characters replaced in the mask, where "key" is the replaced character, "value" is the regular expression to which the input character must match (see «[Replacement](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#replacement)»). It is possible to pass the replacement character as a string, then `replacement="_"` will default to `replacement={{ _: /./ }}`. Keys are ignored as you type. */
50
+ replacement?: string | Replacement;
51
+ /** Controls the display of the mask, for example, `+0 (123) ___-__-__` instead of `+0 (123`. */
52
+ showMask?: boolean;
53
+ /** Stores the position of the entered characters. By default, input characters are non-breaking, which means that if you remove characters in the middle of the value, the characters are shifted to the left, forming a non-breaking value, which is the behavior of `input`. For example, with `true`, the possible value is `+0 (123) ___-45-__`, with `false` - `+0 (123) 45_-__-__`. */
54
+ separate?: boolean;
55
+ /** The function is activated before masking. Allows you to conditionally change the entered value (see «[Track](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#track)»). */
56
+ track?: Track;
57
+ /** Function triggered before masking. Allows you conditionally change the properties of the component that affect masking. Valid values for modification are `mask`, `replacement`, `showMask` and `separate`. This is useful when you need conditionally tweak the displayed value to improve UX (see «[Modify](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#modify)»). */
58
+ modify?: Modify;
59
+ /** Handler for the custom event `input-mask`. Called asynchronously after the `change` event, accessing the `detail` property containing additional useful information about the value. (see «[Mask event](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#mask-event)»). */
60
+ onMask?: MaskEventHandler;
61
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { MaskProps } from './types.js';
3
+ export default function useMask({ mask, replacement, showMask, separate, track, modify, onMask, }?: MaskProps): React.MutableRefObject<HTMLInputElement | null>;
@@ -0,0 +1,150 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var react_1 = require("react");
18
+ var core_1 = require("../core/index.js");
19
+ var filter_1 = __importDefault(require("./utils/filter.js"));
20
+ var formatToReplacementObject_1 = __importDefault(require("./utils/formatToReplacementObject.js"));
21
+ var resolveDetail_1 = __importDefault(require("./utils/resolveDetail.js"));
22
+ var resolveSelection_1 = __importDefault(require("./utils/resolveSelection.js"));
23
+ var unformat_1 = __importDefault(require("./utils/unformat.js"));
24
+ var validate_1 = __importDefault(require("./utils/validate.js"));
25
+ function useMask(_a) {
26
+ var _b = _a === void 0 ? {} : _a, _c = _b.mask, mask = _c === void 0 ? '' : _c, _d = _b.replacement, replacement = _d === void 0 ? {} : _d, _e = _b.showMask, showMask = _e === void 0 ? false : _e, _f = _b.separate, separate = _f === void 0 ? false : _f, track = _b.track, modify = _b.modify, onMask = _b.onMask;
27
+ var replacementObject = typeof replacement === 'string' ? (0, formatToReplacementObject_1.default)(replacement) : replacement;
28
+ var cache = (0, react_1.useRef)(null);
29
+ var init = function (_a) {
30
+ var controlled = _a.controlled, initialValue = _a.initialValue;
31
+ if (process.env.NODE_ENV !== 'production') {
32
+ (0, validate_1.default)({ initialValue: initialValue, mask: mask, replacement: replacementObject });
33
+ }
34
+ initialValue = controlled || initialValue ? initialValue : showMask ? mask : '';
35
+ var cachedProps = { mask: mask, replacement: replacementObject, showMask: showMask, separate: separate };
36
+ cache.current = { value: initialValue, props: cachedProps, fallbackProps: cachedProps };
37
+ return { value: initialValue };
38
+ };
39
+ var tracking = function (_a) {
40
+ var _b;
41
+ var inputType = _a.inputType, previousValue = _a.previousValue, addedValue = _a.addedValue, changeStart = _a.changeStart, changeEnd = _a.changeEnd;
42
+ if (cache.current === null) {
43
+ throw new core_1.SyntheticChangeError('The state has not been initialized.');
44
+ }
45
+ if (cache.current.value !== previousValue) {
46
+ cache.current.props = cache.current.fallbackProps;
47
+ }
48
+ else {
49
+ cache.current.fallbackProps = cache.current.props;
50
+ }
51
+ var beforeChangeValue = (0, unformat_1.default)(previousValue, {
52
+ end: changeStart,
53
+ mask: cache.current.props.mask,
54
+ replacement: cache.current.props.replacement,
55
+ separate: cache.current.props.separate,
56
+ });
57
+ var regExp$1 = RegExp("[^".concat(Object.keys(cache.current.props.replacement).join(''), "]"), 'g');
58
+ var replacementChars = cache.current.props.mask.replace(regExp$1, '');
59
+ if (beforeChangeValue) {
60
+ beforeChangeValue = (0, filter_1.default)(beforeChangeValue, {
61
+ replacementChars: replacementChars,
62
+ replacement: cache.current.props.replacement,
63
+ separate: cache.current.props.separate,
64
+ });
65
+ }
66
+ var _addedValue = track === null || track === void 0 ? void 0 : track(__assign(__assign({}, (inputType === 'insert' ? { inputType: inputType, data: addedValue } : { inputType: inputType, data: null })), { value: previousValue, selectionStart: changeStart, selectionEnd: changeEnd }));
67
+ if (_addedValue === false) {
68
+ throw new core_1.SyntheticChangeError('Custom trekking stop.');
69
+ }
70
+ else if (_addedValue === null) {
71
+ addedValue = '';
72
+ }
73
+ else if (_addedValue !== true && _addedValue !== undefined) {
74
+ addedValue = _addedValue;
75
+ }
76
+ if (addedValue) {
77
+ addedValue = (0, filter_1.default)(addedValue, {
78
+ replacementChars: replacementChars.slice(beforeChangeValue.length),
79
+ replacement: cache.current.props.replacement,
80
+ separate: false,
81
+ });
82
+ }
83
+ if (inputType === 'insert' && addedValue === '') {
84
+ throw new core_1.SyntheticChangeError('The character does not match the key value of the `replacement` object.');
85
+ }
86
+ var afterChangeValue = (0, unformat_1.default)(previousValue, {
87
+ start: changeEnd,
88
+ mask: cache.current.props.mask,
89
+ replacement: cache.current.props.replacement,
90
+ separate: cache.current.props.separate,
91
+ });
92
+ if (cache.current.props.separate) {
93
+ var separateChars = cache.current.props.mask.slice(changeStart, changeEnd).replace(regExp$1, '');
94
+ var countSeparateChars = separateChars.length - addedValue.length;
95
+ if (countSeparateChars < 0) {
96
+ afterChangeValue = afterChangeValue.slice(-countSeparateChars);
97
+ }
98
+ else if (countSeparateChars > 0) {
99
+ afterChangeValue = separateChars.slice(-countSeparateChars) + afterChangeValue;
100
+ }
101
+ }
102
+ if (afterChangeValue) {
103
+ afterChangeValue = (0, filter_1.default)(afterChangeValue, {
104
+ replacementChars: replacementChars.slice(beforeChangeValue.length + addedValue.length),
105
+ replacement: cache.current.props.replacement,
106
+ separate: cache.current.props.separate,
107
+ });
108
+ }
109
+ var input = beforeChangeValue + addedValue + afterChangeValue;
110
+ var _c = (_b = modify === null || modify === void 0 ? void 0 : modify(input)) !== null && _b !== void 0 ? _b : {}, _d = _c.mask, modifiedMask = _d === void 0 ? mask : _d, _e = _c.replacement, modifiedReplacement = _e === void 0 ? replacementObject : _e, _f = _c.showMask, modifiedShowMask = _f === void 0 ? showMask : _f, _g = _c.separate, modifiedSeparate = _g === void 0 ? separate : _g;
111
+ if (typeof modifiedReplacement === 'string') {
112
+ modifiedReplacement = (0, formatToReplacementObject_1.default)(modifiedReplacement);
113
+ }
114
+ var detail = (0, resolveDetail_1.default)(input, {
115
+ mask: modifiedMask,
116
+ replacement: modifiedReplacement,
117
+ showMask: modifiedShowMask,
118
+ });
119
+ var selection = (0, resolveSelection_1.default)({
120
+ inputType: inputType,
121
+ value: detail.value,
122
+ addedValue: addedValue,
123
+ beforeChangeValue: beforeChangeValue,
124
+ parts: detail.parts,
125
+ replacement: modifiedReplacement,
126
+ separate: modifiedSeparate,
127
+ });
128
+ cache.current.value = detail.value;
129
+ cache.current.props = {
130
+ mask: modifiedMask,
131
+ replacement: modifiedReplacement,
132
+ showMask: modifiedShowMask,
133
+ separate: modifiedSeparate,
134
+ };
135
+ return {
136
+ value: detail.value,
137
+ selectionStart: selection,
138
+ selectionEnd: selection,
139
+ __detail: detail,
140
+ };
141
+ };
142
+ return (0, core_1.useInput)({
143
+ init: init,
144
+ tracking: tracking,
145
+ eventType: 'input-mask',
146
+ eventHandler: onMask,
147
+ });
148
+ }
149
+ exports.default = useMask;
150
+ //# sourceMappingURL=useMask.js.map
@@ -1,14 +0,0 @@
1
- import type { Replacement } from '../types';
2
- interface Options {
3
- replacementChars: string;
4
- replacement: Replacement;
5
- separate: boolean;
6
- }
7
- /**
8
- * Фильтрует символы для соответствия значениям `replacement`
9
- * @param value
10
- * @param options
11
- * @returns
12
- */
13
- export default function filter(value: string, { replacementChars, replacement, separate }: Options): string;
14
- export {};
@@ -1,14 +0,0 @@
1
- import type { Replacement } from '../types';
2
- interface Options {
3
- mask: string;
4
- replacement: Replacement;
5
- showMask: boolean;
6
- }
7
- /**
8
- * Форматирует значение по заданной маске
9
- * @param input
10
- * @param options
11
- * @returns
12
- */
13
- export default function format(input: string, { mask, replacement, showMask }: Options): string;
14
- export {};
@@ -1,17 +0,0 @@
1
- import type { MaskPart, Replacement } from '../types';
2
- interface Options {
3
- mask: string;
4
- replacement: Replacement;
5
- }
6
- /**
7
- * Форматирует значение по заданной маске возвращая массив объектов,
8
- * где каждый объект представляет собой информацию о символе:
9
- * - `replacement` - символ замены;
10
- * - `mask` - символ маски;
11
- * - `input` - символ, введенный пользователем.
12
- * @param formattedValue
13
- * @param options
14
- * @returns
15
- */
16
- export default function formatToParts(formattedValue: string, { mask, replacement }: Options): MaskPart[];
17
- export {};
@@ -1,2 +0,0 @@
1
- import type { Replacement } from '../types';
2
- export default function formatToReplacementObject(replacement: string): Replacement;
@@ -1,14 +0,0 @@
1
- import type { MaskEventDetail, Replacement } from '../types';
2
- interface Options {
3
- mask: string;
4
- replacement: Replacement;
5
- showMask: boolean;
6
- }
7
- /**
8
- * Формирует данные маскированного значения возвращая
9
- * @param input пользовательские символы без учета символов маски
10
- * @param options
11
- * @returns
12
- */
13
- export default function resolveDetail(input: string, { mask, replacement, showMask }: Options): MaskEventDetail;
14
- export {};
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var utils_1 = require("../utils");
7
- var format_1 = __importDefault(require("./format"));
8
- var formatToParts_1 = __importDefault(require("./formatToParts"));
9
- /**
10
- * Формирует данные маскированного значения возвращая
11
- * @param input пользовательские символы без учета символов маски
12
- * @param options
13
- * @returns
14
- */
15
- function resolveDetail(input, _a) {
16
- var mask = _a.mask, replacement = _a.replacement, showMask = _a.showMask;
17
- var formattedValue = (0, format_1.default)(input, { mask: mask, replacement: replacement, showMask: showMask });
18
- var parts = (0, formatToParts_1.default)(formattedValue, { mask: mask, replacement: replacement });
19
- var pattern = (0, utils_1.generatePattern)({ mask: mask, replacement: replacement });
20
- var patternWithDisableReplacementKey = (0, utils_1.generatePattern)({ mask: mask, replacement: replacement }, true);
21
- var isValid = RegExp(patternWithDisableReplacementKey).test(formattedValue);
22
- return { value: formattedValue, input: input, parts: parts, pattern: pattern, isValid: isValid };
23
- }
24
- exports.default = resolveDetail;
25
- //# sourceMappingURL=resolveDetail.js.map
@@ -1,18 +0,0 @@
1
- import type { MaskPart, Replacement } from '../types';
2
- import type { InputType } from '../../core';
3
- interface ResolveSelectionParam {
4
- inputType: InputType;
5
- value: string;
6
- addedValue: string;
7
- beforeChangeValue: string;
8
- parts: MaskPart[];
9
- replacement: Replacement;
10
- separate: boolean;
11
- }
12
- /**
13
- * Определяет позицию курсора для последующей установки
14
- * @param param
15
- * @returns
16
- */
17
- export default function resolveSelection({ inputType, value, addedValue, beforeChangeValue, parts, replacement, separate, }: ResolveSelectionParam): number;
18
- export {};