@dreamcommerce/aurora 3.1.52-1 → 3.1.52

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 (108) hide show
  1. package/build/cjs/packages/aurora/src/components/calendar/styled_day_picker/styled_day_picker.js +1 -1
  2. package/build/cjs/packages/aurora/src/components/color_picker/components/pure_color_picker.js +1 -0
  3. package/build/cjs/packages/aurora/src/components/color_picker/components/pure_color_picker.js.map +1 -1
  4. package/build/cjs/packages/aurora/src/components/controls/values_syncer_control/values_syncer_control.js +3 -5
  5. package/build/cjs/packages/aurora/src/components/controls/values_syncer_control/values_syncer_control.js.map +1 -1
  6. package/build/cjs/packages/aurora/src/components/date_and_time_picker/date_time_picker.js +27 -16
  7. package/build/cjs/packages/aurora/src/components/date_and_time_picker/date_time_picker.js.map +1 -1
  8. package/build/cjs/packages/aurora/src/components/date_picker/components/date_picker_input.js +11 -43
  9. package/build/cjs/packages/aurora/src/components/date_picker/components/date_picker_input.js.map +1 -1
  10. package/build/cjs/packages/aurora/src/components/date_picker/date_picker.js +13 -83
  11. package/build/cjs/packages/aurora/src/components/date_picker/date_picker.js.map +1 -1
  12. package/build/cjs/packages/aurora/src/components/date_picker/date_picker_utils.js +4 -203
  13. package/build/cjs/packages/aurora/src/components/date_picker/date_picker_utils.js.map +1 -1
  14. package/build/cjs/packages/aurora/src/components/time_picker/components/time_picker_input.js +10 -30
  15. package/build/cjs/packages/aurora/src/components/time_picker/components/time_picker_input.js.map +1 -1
  16. package/build/cjs/packages/aurora/src/components/time_picker/time_picker.js +50 -85
  17. package/build/cjs/packages/aurora/src/components/time_picker/time_picker.js.map +1 -1
  18. package/build/cjs/packages/aurora/src/components/time_picker/time_picker_utils.js +1 -62
  19. package/build/cjs/packages/aurora/src/components/time_picker/time_picker_utils.js.map +1 -1
  20. package/build/cjs/packages/aurora/src/index.js +0 -2
  21. package/build/cjs/packages/aurora/src/index.js.map +1 -1
  22. package/build/cjs/packages/aurora/src/translations/en.json.js +1 -4
  23. package/build/cjs/packages/aurora/src/translations/en.json.js.map +1 -1
  24. package/build/cjs/packages/aurora/src/translations/pl.json.js +1 -4
  25. package/build/cjs/packages/aurora/src/translations/pl.json.js.map +1 -1
  26. package/build/esm/packages/aurora/src/components/calendar/styled_day_picker/styled_day_picker.js +1 -1
  27. package/build/esm/packages/aurora/src/components/color_picker/components/pure_color_picker.js +1 -0
  28. package/build/esm/packages/aurora/src/components/color_picker/components/pure_color_picker.js.map +1 -1
  29. package/build/esm/packages/aurora/src/components/controls/values_syncer_control/values_syncer_control.js +3 -5
  30. package/build/esm/packages/aurora/src/components/controls/values_syncer_control/values_syncer_control.js.map +1 -1
  31. package/build/esm/packages/aurora/src/components/date_and_time_picker/date_time_picker.js +27 -16
  32. package/build/esm/packages/aurora/src/components/date_and_time_picker/date_time_picker.js.map +1 -1
  33. package/build/esm/packages/aurora/src/components/date_picker/components/date_picker_input.d.ts +1 -4
  34. package/build/esm/packages/aurora/src/components/date_picker/components/date_picker_input.js +11 -43
  35. package/build/esm/packages/aurora/src/components/date_picker/components/date_picker_input.js.map +1 -1
  36. package/build/esm/packages/aurora/src/components/date_picker/date_picker.d.ts +1 -1
  37. package/build/esm/packages/aurora/src/components/date_picker/date_picker.js +14 -84
  38. package/build/esm/packages/aurora/src/components/date_picker/date_picker.js.map +1 -1
  39. package/build/esm/packages/aurora/src/components/date_picker/date_picker_types.d.ts +1 -1
  40. package/build/esm/packages/aurora/src/components/date_picker/date_picker_utils.d.ts +1 -18
  41. package/build/esm/packages/aurora/src/components/date_picker/date_picker_utils.js +4 -203
  42. package/build/esm/packages/aurora/src/components/date_picker/date_picker_utils.js.map +1 -1
  43. package/build/esm/packages/aurora/src/components/time_picker/components/time_picker_input.d.ts +1 -2
  44. package/build/esm/packages/aurora/src/components/time_picker/components/time_picker_input.js +10 -30
  45. package/build/esm/packages/aurora/src/components/time_picker/components/time_picker_input.js.map +1 -1
  46. package/build/esm/packages/aurora/src/components/time_picker/time_picker.js +52 -87
  47. package/build/esm/packages/aurora/src/components/time_picker/time_picker.js.map +1 -1
  48. package/build/esm/packages/aurora/src/components/time_picker/time_picker_utils.d.ts +0 -11
  49. package/build/esm/packages/aurora/src/components/time_picker/time_picker_utils.js +1 -62
  50. package/build/esm/packages/aurora/src/components/time_picker/time_picker_utils.js.map +1 -1
  51. package/build/esm/packages/aurora/src/index.d.ts +0 -2
  52. package/build/esm/packages/aurora/src/index.js +0 -1
  53. package/build/esm/packages/aurora/src/index.js.map +1 -1
  54. package/build/esm/packages/aurora/src/translations/en.json +1 -4
  55. package/build/esm/packages/aurora/src/translations/en.json.js +1 -4
  56. package/build/esm/packages/aurora/src/translations/en.json.js.map +1 -1
  57. package/build/esm/packages/aurora/src/translations/pl.json +1 -4
  58. package/build/esm/packages/aurora/src/translations/pl.json.js +1 -4
  59. package/build/esm/packages/aurora/src/translations/pl.json.js.map +1 -1
  60. package/package.json +1 -1
  61. package/build/cjs/packages/aurora/src/components/input_mask/hooks/hooks.js +0 -196
  62. package/build/cjs/packages/aurora/src/components/input_mask/hooks/hooks.js.map +0 -1
  63. package/build/cjs/packages/aurora/src/components/input_mask/input-mask-constants.js +0 -14
  64. package/build/cjs/packages/aurora/src/components/input_mask/input-mask-constants.js.map +0 -1
  65. package/build/cjs/packages/aurora/src/components/input_mask/input_mask.js +0 -360
  66. package/build/cjs/packages/aurora/src/components/input_mask/input_mask.js.map +0 -1
  67. package/build/cjs/packages/aurora/src/components/input_mask/utils/defer.js +0 -16
  68. package/build/cjs/packages/aurora/src/components/input_mask/utils/defer.js.map +0 -1
  69. package/build/cjs/packages/aurora/src/components/input_mask/utils/helpers.js +0 -50
  70. package/build/cjs/packages/aurora/src/components/input_mask/utils/helpers.js.map +0 -1
  71. package/build/cjs/packages/aurora/src/components/input_mask/utils/input.js +0 -33
  72. package/build/cjs/packages/aurora/src/components/input_mask/utils/input.js.map +0 -1
  73. package/build/cjs/packages/aurora/src/components/input_mask/utils/mask.js +0 -371
  74. package/build/cjs/packages/aurora/src/components/input_mask/utils/mask.js.map +0 -1
  75. package/build/cjs/packages/aurora/src/components/input_mask/utils/parse-mask.js +0 -94
  76. package/build/cjs/packages/aurora/src/components/input_mask/utils/parse-mask.js.map +0 -1
  77. package/build/cjs/packages/aurora/src/components/input_mask/utils/validate-props.js +0 -37
  78. package/build/cjs/packages/aurora/src/components/input_mask/utils/validate-props.js.map +0 -1
  79. package/build/esm/packages/aurora/src/components/input_mask/hooks/hooks.d.ts +0 -10
  80. package/build/esm/packages/aurora/src/components/input_mask/hooks/hooks.js +0 -190
  81. package/build/esm/packages/aurora/src/components/input_mask/hooks/hooks.js.map +0 -1
  82. package/build/esm/packages/aurora/src/components/input_mask/input-mask-constants.d.ts +0 -6
  83. package/build/esm/packages/aurora/src/components/input_mask/input-mask-constants.js +0 -9
  84. package/build/esm/packages/aurora/src/components/input_mask/input-mask-constants.js.map +0 -1
  85. package/build/esm/packages/aurora/src/components/input_mask/input_mask.d.ts +0 -4
  86. package/build/esm/packages/aurora/src/components/input_mask/input_mask.js +0 -352
  87. package/build/esm/packages/aurora/src/components/input_mask/input_mask.js.map +0 -1
  88. package/build/esm/packages/aurora/src/components/input_mask/input_mask_types.d.ts +0 -39
  89. package/build/esm/packages/aurora/src/components/input_mask/input_mask_types.js +0 -2
  90. package/build/esm/packages/aurora/src/components/input_mask/input_mask_types.js.map +0 -1
  91. package/build/esm/packages/aurora/src/components/input_mask/utils/defer.d.ts +0 -2
  92. package/build/esm/packages/aurora/src/components/input_mask/utils/defer.js +0 -11
  93. package/build/esm/packages/aurora/src/components/input_mask/utils/defer.js.map +0 -1
  94. package/build/esm/packages/aurora/src/components/input_mask/utils/helpers.d.ts +0 -7
  95. package/build/esm/packages/aurora/src/components/input_mask/utils/helpers.js +0 -40
  96. package/build/esm/packages/aurora/src/components/input_mask/utils/helpers.js.map +0 -1
  97. package/build/esm/packages/aurora/src/components/input_mask/utils/input.d.ts +0 -9
  98. package/build/esm/packages/aurora/src/components/input_mask/utils/input.js +0 -29
  99. package/build/esm/packages/aurora/src/components/input_mask/utils/input.js.map +0 -1
  100. package/build/esm/packages/aurora/src/components/input_mask/utils/mask.d.ts +0 -63
  101. package/build/esm/packages/aurora/src/components/input_mask/utils/mask.js +0 -367
  102. package/build/esm/packages/aurora/src/components/input_mask/utils/mask.js.map +0 -1
  103. package/build/esm/packages/aurora/src/components/input_mask/utils/parse-mask.d.ts +0 -7
  104. package/build/esm/packages/aurora/src/components/input_mask/utils/parse-mask.js +0 -90
  105. package/build/esm/packages/aurora/src/components/input_mask/utils/parse-mask.js.map +0 -1
  106. package/build/esm/packages/aurora/src/components/input_mask/utils/validate-props.d.ts +0 -4
  107. package/build/esm/packages/aurora/src/components/input_mask/utils/validate-props.js +0 -31
  108. package/build/esm/packages/aurora/src/components/input_mask/utils/validate-props.js.map +0 -1
@@ -1,371 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
6
- var helpers = require('./helpers.js');
7
- var parseMask = require('./parse-mask.js');
8
-
9
- var MaskUtils = /*#__PURE__*/_rollupPluginBabelHelpers.createClass(function MaskUtils(options) {
10
- var _this = this;
11
- _rollupPluginBabelHelpers.classCallCheck(this, MaskUtils);
12
- _rollupPluginBabelHelpers.defineProperty(this, "maskOptions", void 0);
13
- _rollupPluginBabelHelpers.defineProperty(this, "isCharacterAllowedAtPosition", function (character, position) {
14
- var maskPlaceholder = _this.maskOptions.maskPlaceholder;
15
- if (_this.isCharacterFillingPosition(character, position)) {
16
- return true;
17
- }
18
- if (!maskPlaceholder) {
19
- return false;
20
- }
21
- return maskPlaceholder[position] === character;
22
- });
23
- _rollupPluginBabelHelpers.defineProperty(this, "isCharacterFillingPosition", function (character, position) {
24
- var mask = _this.maskOptions.mask;
25
- if (!character || !mask || position >= mask.length) {
26
- return false;
27
- }
28
- if (!_this.isPositionEditable(position)) {
29
- return mask[position] === character;
30
- }
31
- var charRule = mask[position];
32
- if (typeof charRule === 'string') {
33
- return charRule === character;
34
- }
35
- return charRule.test(character);
36
- });
37
- _rollupPluginBabelHelpers.defineProperty(this, "isPositionEditable", function (position) {
38
- var _this$maskOptions = _this.maskOptions,
39
- mask = _this$maskOptions.mask,
40
- permanents = _this$maskOptions.permanents;
41
- if (!mask) return false;
42
- return position < mask.length && permanents.indexOf(position) === -1;
43
- });
44
- _rollupPluginBabelHelpers.defineProperty(this, "isValueEmpty", function (value) {
45
- return value.split('').every(function (character, position) {
46
- return !_this.isPositionEditable(position) || !_this.isCharacterFillingPosition(character, position);
47
- });
48
- });
49
- _rollupPluginBabelHelpers.defineProperty(this, "isValueFilled", function (value) {
50
- var lastEditablePosition = _this.maskOptions.lastEditablePosition;
51
- if (lastEditablePosition === null) return false;
52
- return _this.getFilledLength(value) === lastEditablePosition + 1;
53
- });
54
- _rollupPluginBabelHelpers.defineProperty(this, "getDefaultSelectionForValue", function (value) {
55
- var _this$getRightEditabl;
56
- var filledLength = _this.getFilledLength(value);
57
- var cursorPosition = (_this$getRightEditabl = _this.getRightEditablePosition(filledLength)) !== null && _this$getRightEditabl !== void 0 ? _this$getRightEditabl : 0;
58
- return {
59
- start: cursorPosition,
60
- end: cursorPosition
61
- };
62
- });
63
- _rollupPluginBabelHelpers.defineProperty(this, "getFilledLength", function (value) {
64
- var characters = value.split('');
65
- var lastFilledIndex = helpers.findLastIndex(characters, function (character, position) {
66
- return _this.isPositionEditable(position) && _this.isCharacterFillingPosition(character, position);
67
- });
68
- return lastFilledIndex + 1;
69
- });
70
- _rollupPluginBabelHelpers.defineProperty(this, "getStringFillingLengthAtPosition", function (string, position) {
71
- var characters = string.split('');
72
- var insertedValue = characters.reduce(function (value, character) {
73
- return _this.insertCharacterAtPosition(value, character, value.length);
74
- }, helpers.repeat(' ', position));
75
- return insertedValue.length - position;
76
- });
77
- _rollupPluginBabelHelpers.defineProperty(this, "getLeftEditablePosition", function (position) {
78
- for (var i = position; i >= 0; i--) {
79
- if (_this.isPositionEditable(i)) {
80
- return i;
81
- }
82
- }
83
- return null;
84
- });
85
- _rollupPluginBabelHelpers.defineProperty(this, "getRightEditablePosition", function (position) {
86
- var mask = _this.maskOptions.mask;
87
- if (!mask) return null;
88
- for (var i = position; i < mask.length; i++) {
89
- if (_this.isPositionEditable(i)) {
90
- return i;
91
- }
92
- }
93
- return null;
94
- });
95
- _rollupPluginBabelHelpers.defineProperty(this, "getFirstEditablePosition", function () {
96
- return _this.getRightEditablePosition(0);
97
- });
98
- _rollupPluginBabelHelpers.defineProperty(this, "getLastEditablePosition", function () {
99
- return _this.maskOptions.lastEditablePosition;
100
- });
101
- /**
102
- * Gets all sections (groups of consecutive editable positions separated by permanents)
103
- * Returns an array of sections, where each section is an array of editable positions
104
- */
105
- _rollupPluginBabelHelpers.defineProperty(this, "getSections", function () {
106
- var mask = _this.maskOptions.mask;
107
- if (!mask) return [];
108
- var sections = [];
109
- var currentSection = [];
110
- for (var i = 0; i < mask.length; i++) {
111
- if (_this.isPositionEditable(i)) {
112
- currentSection.push(i);
113
- } else {
114
- // Permanent character - end current section and start new one
115
- if (currentSection.length > 0) {
116
- sections.push(currentSection);
117
- currentSection = [];
118
- }
119
- }
120
- }
121
- // Add the last section if it exists
122
- if (currentSection.length > 0) {
123
- sections.push(currentSection);
124
- }
125
- return sections;
126
- });
127
- /**
128
- * Finds which section a position belongs to
129
- * Returns the section index, or -1 if not found
130
- * @param position - The position to find the section for
131
- * @param sections - Optional pre-computed sections array to avoid recalculation
132
- */
133
- _rollupPluginBabelHelpers.defineProperty(this, "getSectionIndexForPosition", function (position, sections) {
134
- var sectionsToUse = sections !== null && sections !== void 0 ? sections : _this.getSections();
135
- for (var i = 0; i < sectionsToUse.length; i++) {
136
- if (sectionsToUse[i].includes(position)) {
137
- return i;
138
- }
139
- }
140
- return -1;
141
- });
142
- /**
143
- * Gets the first editable position of the next section
144
- * Returns null if already at the last section
145
- * If position is not in any section (e.g., at a permanent character), finds the next section after the position
146
- */
147
- _rollupPluginBabelHelpers.defineProperty(this, "getNextSectionFirstPosition", function (position) {
148
- var sections = _this.getSections();
149
- var sectionIndex = _this.getSectionIndexForPosition(position);
150
- // If position is not in any section (e.g., at a permanent character),
151
- // find the first section that starts after this position
152
- if (sectionIndex === -1) {
153
- for (var i = 0; i < sections.length; i++) {
154
- if (sections[i].length > 0 && sections[i][0] > position) {
155
- return sections[i][0];
156
- }
157
- }
158
- return null; // No section after this position
159
- }
160
- if (sectionIndex >= sections.length - 1) return null;
161
- var nextSection = sections[sectionIndex + 1];
162
- return nextSection.length > 0 ? nextSection[0] : null;
163
- });
164
- /**
165
- * Gets the first editable position of the previous section
166
- * Returns null if already at the first section
167
- * If position is not in any section (e.g., at a permanent character), finds the previous section before the position
168
- */
169
- _rollupPluginBabelHelpers.defineProperty(this, "getPreviousSectionFirstPosition", function (position) {
170
- var sections = _this.getSections();
171
- var sectionIndex = _this.getSectionIndexForPosition(position);
172
- // If position is not in any section (e.g., at a permanent character),
173
- // find the last section that ends before this position
174
- if (sectionIndex === -1) {
175
- for (var i = sections.length - 1; i >= 0; i--) {
176
- if (sections[i].length > 0 && sections[i][sections[i].length - 1] < position) {
177
- return sections[i][0];
178
- }
179
- }
180
- return null; // No section before this position
181
- }
182
- if (sectionIndex <= 0) return null;
183
- var previousSection = sections[sectionIndex - 1];
184
- return previousSection.length > 0 ? previousSection[0] : null;
185
- });
186
- /**
187
- * Gets the range (first and last positions) of a section
188
- * Returns null if position is not in any section
189
- * @param position - The position to find the section range for
190
- * @param sections - Optional pre-computed sections array to avoid recalculation
191
- */
192
- _rollupPluginBabelHelpers.defineProperty(this, "getSectionRange", function (position, sections) {
193
- var sectionsToUse = sections !== null && sections !== void 0 ? sections : _this.getSections();
194
- var sectionIndex = _this.getSectionIndexForPosition(position, sectionsToUse);
195
- if (sectionIndex === -1) return null;
196
- var section = sectionsToUse[sectionIndex];
197
- if (section.length === 0) return null;
198
- return {
199
- start: section[0],
200
- end: section[section.length - 1]
201
- };
202
- });
203
- _rollupPluginBabelHelpers.defineProperty(this, "formatValue", function (value) {
204
- var _this$maskOptions2 = _this.maskOptions,
205
- maskPlaceholder = _this$maskOptions2.maskPlaceholder,
206
- mask = _this$maskOptions2.mask;
207
- if (!mask) return value;
208
- if (!maskPlaceholder) {
209
- value = _this.insertStringAtPosition('', value, 0);
210
- while (value.length < mask.length && !_this.isPositionEditable(value.length)) {
211
- var char = mask[value.length];
212
- value += typeof char === 'string' ? char : '';
213
- }
214
- return value;
215
- }
216
- return _this.insertStringAtPosition(maskPlaceholder, value, 0);
217
- });
218
- _rollupPluginBabelHelpers.defineProperty(this, "clearRange", function (value, start, len) {
219
- if (!len) {
220
- return value;
221
- }
222
- var end = start + len;
223
- var _this$maskOptions3 = _this.maskOptions,
224
- maskPlaceholder = _this$maskOptions3.maskPlaceholder,
225
- mask = _this$maskOptions3.mask;
226
- if (!mask) return value;
227
- var clearedValue = value.split('').map(function (character, i) {
228
- var isEditable = _this.isPositionEditable(i);
229
- if (!maskPlaceholder && i >= end && !isEditable) {
230
- return '';
231
- }
232
- if (i < start || i >= end) {
233
- return character;
234
- }
235
- if (!isEditable) {
236
- var char = mask[i];
237
- return typeof char === 'string' ? char : '';
238
- }
239
- if (maskPlaceholder) {
240
- return maskPlaceholder[i];
241
- }
242
- return '';
243
- }).join('');
244
- return _this.formatValue(clearedValue);
245
- });
246
- _rollupPluginBabelHelpers.defineProperty(this, "insertCharacterAtPosition", function (value, character, position) {
247
- var _this$maskOptions4 = _this.maskOptions,
248
- mask = _this$maskOptions4.mask,
249
- maskPlaceholder = _this$maskOptions4.maskPlaceholder;
250
- if (!mask || position >= mask.length) {
251
- return value;
252
- }
253
- var isAllowed = _this.isCharacterAllowedAtPosition(character, position);
254
- var isEditable = _this.isPositionEditable(position);
255
- var nextEditablePosition = _this.getRightEditablePosition(position);
256
- var isNextPlaceholder = maskPlaceholder && nextEditablePosition !== null ? character === maskPlaceholder[nextEditablePosition] : null;
257
- var valueBefore = value.slice(0, position);
258
- if (isAllowed || !isEditable) {
259
- var insertedCharacter = isAllowed ? character : mask[position] && typeof mask[position] === 'string' ? mask[position] : '';
260
- value = valueBefore + insertedCharacter;
261
- }
262
- if (!isAllowed && !isEditable && !isNextPlaceholder) {
263
- value = _this.insertCharacterAtPosition(value, character, position + 1);
264
- }
265
- return value;
266
- });
267
- _rollupPluginBabelHelpers.defineProperty(this, "insertStringAtPosition", function (value, string, position) {
268
- var _this$maskOptions5 = _this.maskOptions,
269
- mask = _this$maskOptions5.mask,
270
- maskPlaceholder = _this$maskOptions5.maskPlaceholder;
271
- if (!mask || !string || position >= mask.length) {
272
- return value;
273
- }
274
- var characters = string.split('');
275
- var isFixedLength = _this.isValueFilled(value) || !!maskPlaceholder;
276
- var valueAfter = value.slice(position);
277
- value = characters.reduce(function (value, character) {
278
- return _this.insertCharacterAtPosition(value, character, value.length);
279
- }, value.slice(0, position));
280
- if (isFixedLength) {
281
- value += valueAfter.slice(value.length - position);
282
- } else if (_this.isValueFilled(value)) {
283
- var remainingMask = mask.slice(value.length).map(function (char) {
284
- return typeof char === 'string' ? char : '';
285
- }).join('');
286
- value += remainingMask;
287
- } else {
288
- var editableCharactersAfter = valueAfter.split('').filter(function (character, i) {
289
- return _this.isPositionEditable(position + i);
290
- });
291
- value = editableCharactersAfter.reduce(function (value, character) {
292
- var nextEditablePosition = _this.getRightEditablePosition(value.length);
293
- if (nextEditablePosition === null) {
294
- return value;
295
- }
296
- if (!_this.isPositionEditable(value.length)) {
297
- var maskSlice = mask.slice(value.length, nextEditablePosition).map(function (char) {
298
- return typeof char === 'string' ? char : '';
299
- }).join('');
300
- value += maskSlice;
301
- }
302
- return _this.insertCharacterAtPosition(value, character, value.length);
303
- }, value);
304
- }
305
- return value;
306
- });
307
- _rollupPluginBabelHelpers.defineProperty(this, "processChange", function (currentState, previousState) {
308
- var _previousSelection$st, _selection$start, _selection$end, _previousSelection$st2, _prefix$length;
309
- var _this$maskOptions6 = _this.maskOptions,
310
- mask = _this$maskOptions6.mask,
311
- prefix = _this$maskOptions6.prefix,
312
- lastEditablePosition = _this$maskOptions6.lastEditablePosition;
313
- if (!mask) return currentState;
314
- var value = currentState.value,
315
- selection = currentState.selection;
316
- var previousValue = previousState.value;
317
- var previousSelection = previousState.selection;
318
- var newValue = value;
319
- var enteredString = '';
320
- var formattedEnteredStringLength = 0;
321
- var removedLength = 0;
322
- var cursorPosition = Math.min((_previousSelection$st = previousSelection.start) !== null && _previousSelection$st !== void 0 ? _previousSelection$st : 0, (_selection$start = selection.start) !== null && _selection$start !== void 0 ? _selection$start : 0);
323
- if (((_selection$end = selection.end) !== null && _selection$end !== void 0 ? _selection$end : 0) > ((_previousSelection$st2 = previousSelection.start) !== null && _previousSelection$st2 !== void 0 ? _previousSelection$st2 : 0)) {
324
- var _previousSelection$st3, _selection$end2;
325
- enteredString = newValue.slice((_previousSelection$st3 = previousSelection.start) !== null && _previousSelection$st3 !== void 0 ? _previousSelection$st3 : 0, (_selection$end2 = selection.end) !== null && _selection$end2 !== void 0 ? _selection$end2 : 0);
326
- formattedEnteredStringLength = _this.getStringFillingLengthAtPosition(enteredString, cursorPosition);
327
- if (!formattedEnteredStringLength) {
328
- removedLength = 0;
329
- } else {
330
- var _previousSelection$en, _previousSelection$st4;
331
- removedLength = ((_previousSelection$en = previousSelection.end) !== null && _previousSelection$en !== void 0 ? _previousSelection$en : 0) - ((_previousSelection$st4 = previousSelection.start) !== null && _previousSelection$st4 !== void 0 ? _previousSelection$st4 : 0);
332
- }
333
- } else if (newValue.length < previousValue.length) {
334
- removedLength = previousValue.length - newValue.length;
335
- }
336
- newValue = previousValue;
337
- if (removedLength) {
338
- if (removedLength === 1 && !(previousSelection.end && previousSelection.start && previousSelection.end > previousSelection.start)) {
339
- var _previousSelection$st5, _selection$start2, _ref, _this$getRightEditabl2, _selection$start3, _ref2, _this$getLeftEditable, _selection$start4;
340
- var deleteFromRight = ((_previousSelection$st5 = previousSelection.start) !== null && _previousSelection$st5 !== void 0 ? _previousSelection$st5 : 0) === ((_selection$start2 = selection.start) !== null && _selection$start2 !== void 0 ? _selection$start2 : 0);
341
- cursorPosition = deleteFromRight ? (_ref = (_this$getRightEditabl2 = _this.getRightEditablePosition((_selection$start3 = selection.start) !== null && _selection$start3 !== void 0 ? _selection$start3 : 0)) !== null && _this$getRightEditabl2 !== void 0 ? _this$getRightEditabl2 : selection.start) !== null && _ref !== void 0 ? _ref : 0 : (_ref2 = (_this$getLeftEditable = _this.getLeftEditablePosition((_selection$start4 = selection.start) !== null && _selection$start4 !== void 0 ? _selection$start4 : 0)) !== null && _this$getLeftEditable !== void 0 ? _this$getLeftEditable : selection.start) !== null && _ref2 !== void 0 ? _ref2 : 0;
342
- }
343
- newValue = _this.clearRange(newValue, cursorPosition, removedLength);
344
- }
345
- newValue = _this.insertStringAtPosition(newValue, enteredString, cursorPosition);
346
- cursorPosition += formattedEnteredStringLength;
347
- if (cursorPosition >= mask.length) {
348
- cursorPosition = mask.length;
349
- } else if (prefix && cursorPosition < prefix.length && !formattedEnteredStringLength) {
350
- cursorPosition = prefix.length;
351
- } else if (lastEditablePosition !== null && cursorPosition >= ((_prefix$length = prefix === null || prefix === void 0 ? void 0 : prefix.length) !== null && _prefix$length !== void 0 ? _prefix$length : 0) && cursorPosition < lastEditablePosition && formattedEnteredStringLength) {
352
- var rightPos = _this.getRightEditablePosition(cursorPosition);
353
- if (rightPos !== null) {
354
- cursorPosition = rightPos;
355
- }
356
- }
357
- newValue = _this.formatValue(newValue);
358
- return {
359
- value: newValue,
360
- enteredString: enteredString,
361
- selection: {
362
- start: cursorPosition,
363
- end: cursorPosition
364
- }
365
- };
366
- });
367
- this.maskOptions = parseMask.parseMask(options);
368
- });
369
-
370
- exports.default = MaskUtils;
371
- //# sourceMappingURL=mask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,94 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../../../../../../_virtual/_rollupPluginBabelHelpers.js');
6
- var inputMaskConstants = require('../input-mask-constants.js');
7
-
8
- var parseMask = function parseMask(_ref) {
9
- var mask = _ref.mask,
10
- maskPlaceholder = _ref.maskPlaceholder,
11
- formatChars = _ref.formatChars;
12
- var permanents = [];
13
- var activeFormatChars = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, inputMaskConstants.defaultFormatChars), formatChars);
14
- if (!mask) {
15
- return {
16
- maskPlaceholder: null,
17
- mask: null,
18
- prefix: null,
19
- lastEditablePosition: null,
20
- permanents: []
21
- };
22
- }
23
- var parsedMask;
24
- if (typeof mask === 'string') {
25
- var isPermanent = false;
26
- var parsedMaskString = '';
27
- mask.split('').forEach(function (character) {
28
- if (!isPermanent && character === '\\') {
29
- isPermanent = true;
30
- } else {
31
- if (isPermanent || !activeFormatChars[character]) {
32
- permanents.push(parsedMaskString.length);
33
- }
34
- parsedMaskString += character;
35
- isPermanent = false;
36
- }
37
- });
38
- parsedMask = parsedMaskString.split('').map(function (character, index) {
39
- if (permanents.indexOf(index) === -1) {
40
- return activeFormatChars[character] || character;
41
- }
42
- return character;
43
- });
44
- } else {
45
- parsedMask = mask;
46
- mask.forEach(function (character, index) {
47
- if (typeof character === 'string') {
48
- permanents.push(index);
49
- }
50
- });
51
- }
52
- var processedMaskPlaceholder = null;
53
- if (maskPlaceholder) {
54
- if (maskPlaceholder.length === 1) {
55
- processedMaskPlaceholder = parsedMask.map(function (character, index) {
56
- if (permanents.indexOf(index) !== -1) {
57
- return typeof character === 'string' ? character : '';
58
- }
59
- return maskPlaceholder;
60
- }).join('');
61
- } else {
62
- processedMaskPlaceholder = maskPlaceholder;
63
- }
64
- var placeholderChars = processedMaskPlaceholder.split('');
65
- permanents.forEach(function (position) {
66
- var maskChar = parsedMask[position];
67
- if (typeof maskChar === 'string') {
68
- placeholderChars[position] = maskChar;
69
- }
70
- });
71
- processedMaskPlaceholder = placeholderChars.join('');
72
- }
73
- var prefix = permanents.filter(function (position, index) {
74
- return position === index;
75
- }).map(function (position) {
76
- var char = parsedMask[position];
77
- return typeof char === 'string' ? char : '';
78
- }).join('');
79
- var lastEditablePosition = parsedMask.length - 1;
80
- while (permanents.indexOf(lastEditablePosition) !== -1) {
81
- lastEditablePosition--;
82
- }
83
- return {
84
- maskPlaceholder: processedMaskPlaceholder,
85
- prefix: prefix,
86
- mask: parsedMask,
87
- lastEditablePosition: lastEditablePosition,
88
- permanents: permanents
89
- };
90
- };
91
-
92
- exports.default = parseMask;
93
- exports.parseMask = parseMask;
94
- //# sourceMappingURL=parse-mask.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,37 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var inputMaskConstants = require('../input-mask-constants.js');
6
-
7
- var validateMaxLength = function validateMaxLength(props) {
8
- if (process.env.NODE_ENV !== 'production') {
9
- if (props.maxLength && props.mask) {
10
- console.warn("maxLength property shouldn't be passed to the masked input. It breaks masking and unnecessary because length is limited by the mask length.");
11
- }
12
- }
13
- };
14
- var validateMaskPlaceholder = function validateMaskPlaceholder(props) {
15
- var mask = props.mask,
16
- maskPlaceholder = props.maskPlaceholder;
17
- if (!mask || !maskPlaceholder) {
18
- return;
19
- }
20
- var maskLength = typeof mask === 'string' ? mask.length : mask.length;
21
- if (maskPlaceholder.length !== 1 && maskPlaceholder.length !== maskLength) {
22
- throw new Error("maskPlaceholder should either be a single character or have the same length as the mask:\n" + "mask: ".concat(mask, "\n") + "maskPlaceholder: ".concat(maskPlaceholder));
23
- }
24
- };
25
- var validateChildren = function validateChildren(props, inputElement) {
26
- var conflictProps = inputMaskConstants.CONTROLLED_PROPS.filter(function (propId) {
27
- return inputElement.props[propId] != null && inputElement.props[propId] !== props[propId];
28
- });
29
- if (conflictProps.length) {
30
- throw new Error("the following props should be passed to the InputMask component, not to children: ".concat(conflictProps.join(', ')));
31
- }
32
- };
33
-
34
- exports.validateChildren = validateChildren;
35
- exports.validateMaskPlaceholder = validateMaskPlaceholder;
36
- exports.validateMaxLength = validateMaxLength;
37
- //# sourceMappingURL=validate-props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":null,"sources":[null],"sourcesContent":[null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;"}
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { InputState } from '../input_mask_types';
3
- export declare function useInputElement(inputRef: React.RefObject<HTMLElement | null>): () => HTMLInputElement | null;
4
- export declare function useInputState(initialValue: string, isMasked: boolean): {
5
- inputRef: import("react").MutableRefObject<HTMLElement | null>;
6
- getInputState: () => InputState;
7
- getLastInputState: () => InputState;
8
- setInputState: ({ value, selection }: InputState) => void;
9
- };
10
- export declare function usePrevious<T>(value: T): T | undefined;