infinity-forge 3.2.7 → 3.3.0

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 (128) hide show
  1. package/LICENSE +20 -20
  2. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.d.ts +6 -0
  3. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.js +42 -0
  4. package/dist/sites/public/fonts/fonts.css +760 -760
  5. package/dist/system/presentation/components/data/menu/components/menu-item/index.js +80 -0
  6. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/index.js +44 -0
  7. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/styles.js +15 -0
  8. package/dist/system/presentation/components/data/menu/modes/opened/index.js +51 -0
  9. package/dist/system/presentation/components/data/menu/modes/opened/styles.js +15 -0
  10. package/dist/system/presentation/components/layout/header/components/menu-right/component.d.ts +6 -0
  11. package/dist/system/presentation/components/layout/header/components/menu-right/component.js +35 -0
  12. package/dist/system/presentation/components/layout/header/components/menu-right/index.d.ts +3 -0
  13. package/dist/system/presentation/components/layout/header/components/menu-right/index.js +3 -3
  14. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.d.ts +1 -1
  15. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.js +3 -3
  16. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/index.js +3 -3
  17. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/interfaces.d.ts +1 -1
  18. package/dist/system/presentation/components/layout/header/components/menu-right/messages/index.js +4 -4
  19. package/dist/system/presentation/components/layout/header/components/menu-right/profile/content/index.js +3 -3
  20. package/dist/system/presentation/components/layout/header/components/menu-right/profile/index.js +4 -4
  21. package/dist/system/presentation/components/layout/header/components/search-modal/index.js +4 -4
  22. package/dist/system/presentation/components/layout/header/components/search-modal/search-list/index.js +3 -3
  23. package/dist/system/presentation/components/layout/header/components/search-modal/trigger/index.js +2 -2
  24. package/dist/system/presentation/components/pages/menus/table/icon/index.js +1 -1
  25. package/dist/system/presentation/context/auth/components/login/form-login/index.js +2 -2
  26. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.d.ts +1 -1
  27. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.js +2 -2
  28. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.d.ts +1 -1
  29. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.js +4 -4
  30. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.d.ts +1 -1
  31. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.js +2 -2
  32. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.d.ts +1 -1
  33. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.js +3 -3
  34. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.d.ts +1 -1
  35. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.js +2 -2
  36. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.d.ts +1 -1
  37. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.js +3 -3
  38. package/dist/system/presentation/hooks/ui/use-table/components/table/index.d.ts +1 -1
  39. package/dist/system/presentation/hooks/ui/use-table/components/table/index.js +10 -10
  40. package/dist/system/presentation/hooks/ui/use-table/components/table/interfaces.d.ts +2 -2
  41. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.d.ts +1 -1
  42. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.js +3 -3
  43. package/dist/system/presentation/hooks/ui/use-table/components/table/skeleton-table/index.js +2 -2
  44. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.d.ts +1 -1
  45. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.js +2 -2
  46. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/interfaces.d.ts +1 -1
  47. package/dist/ui/components/carousel/carousel-lib/core/modules/observer/observer.js +2 -2
  48. package/dist/ui/components/carousel/carousel-lib/core/modules/resize/resize.js +1 -1
  49. package/dist/ui/components/carousel/carousel-lib/core/translate/translateTo.js +81 -0
  50. package/dist/ui/components/carousel/carousel-lib/core/update/index.d.ts +21 -0
  51. package/dist/ui/components/carousel/carousel-lib/core/update/index.js +26 -0
  52. package/dist/ui/components/carousel/carousel-lib/core/update/updateActiveIndex.js +125 -0
  53. package/dist/ui/components/carousel/carousel-lib/core/update/updateSize.js +45 -0
  54. package/dist/ui/components/carousel/carousel-lib/core/update/updateSlides.js +306 -0
  55. package/dist/ui/components/carousel/carousel-lib/core/update/updateSlidesClasses.js +69 -0
  56. package/dist/ui/components/form/handler/i18n/capture-i18n-errors/index.d.ts +6 -0
  57. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.d.ts +1 -1
  58. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.js +1 -1
  59. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.d.ts +3 -3
  60. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.js +3 -3
  61. package/dist/ui/components/form/input-cep/use-cep/providers/index.d.ts +1 -0
  62. package/dist/ui/components/form/input-cep/use-cep/providers/index.js +18 -0
  63. package/dist/ui/components/form/input-currency/components/utils/cleanValue.d.ts +8 -0
  64. package/dist/ui/components/form/input-currency/components/utils/cleanValue.js +62 -0
  65. package/dist/ui/components/form/input-currency/components/utils/formatValue.d.ts +49 -0
  66. package/dist/ui/components/form/input-currency/components/utils/formatValue.js +132 -0
  67. package/dist/ui/components/form/input-currency/components/utils/getLocaleConfig.d.ts +13 -0
  68. package/dist/ui/components/form/input-currency/components/utils/getSuffix.js +12 -0
  69. package/dist/ui/components/form/input-currency/components/utils/index.d.ts +8 -0
  70. package/dist/ui/components/form/input-currency/components/utils/index.js +25 -0
  71. package/dist/ui/components/form/input-currency/components/utils/parseAbbrValue.js +40 -0
  72. package/dist/ui/components/form/input-currency/components/utils/removeInvalidChars.js +14 -0
  73. package/dist/ui/components/form/input-currency/components/utils/removeSeparators.js +14 -0
  74. package/dist/ui/components/form/input-date-picker/calendar/calendar-header/index.d.ts +2 -0
  75. package/dist/ui/components/form/input-date-picker/calendar/calendar-header/index.js +62 -0
  76. package/dist/ui/components/form/input-date-picker/calendar/days/index.d.ts +2 -0
  77. package/dist/ui/components/form/input-date-picker/calendar/days/index.js +87 -0
  78. package/dist/ui/components/form/input-date-picker/calendar/months/index.d.ts +2 -0
  79. package/dist/ui/components/form/input-date-picker/calendar/months/index.js +66 -0
  80. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.d.ts +1 -1
  81. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.js +1 -1
  82. package/dist/ui/components/form/input-file/render-files/file-item/index.d.ts +3 -0
  83. package/dist/ui/components/form/input-file/render-files/file-item/index.js +49 -0
  84. package/dist/ui/components/form/input-mask/lib/core/errors/SyntheticChangeError.d.ts +1 -1
  85. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.d.ts +1 -1
  86. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.js +2 -2
  87. package/dist/ui/components/form/input-mask/lib/core/index.d.ts +5 -0
  88. package/dist/ui/components/form/input-mask/lib/core/index.js +15 -0
  89. package/dist/ui/components/form/input-mask/lib/core/utils/setInputAttributes.d.ts +1 -1
  90. package/dist/ui/components/form/input-mask/lib/mask/InputMask.d.ts +6 -0
  91. package/dist/ui/components/form/input-mask/lib/mask/InputMask.js +44 -0
  92. package/dist/ui/components/form/input-mask/lib/mask/index.d.ts +5 -0
  93. package/dist/ui/components/form/input-mask/lib/mask/index.js +26 -0
  94. package/dist/ui/components/form/input-mask/lib/mask/types.d.ts +61 -0
  95. package/dist/ui/components/form/input-mask/lib/mask/useMask.d.ts +3 -0
  96. package/dist/ui/components/form/input-mask/lib/mask/useMask.js +150 -0
  97. package/dist/ui/components/form/input-mask/lib/mask/utils/filter.d.ts +1 -1
  98. package/dist/ui/components/form/input-mask/lib/mask/utils/format.d.ts +1 -1
  99. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToParts.d.ts +1 -1
  100. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToReplacementObject.d.ts +1 -1
  101. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.d.ts +1 -1
  102. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.js +3 -3
  103. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveSelection.d.ts +2 -2
  104. package/dist/ui/components/form/input-mask/lib/mask/utils/unformat.d.ts +1 -1
  105. package/dist/ui/components/form/input-mask/lib/mask/utils/validate.d.ts +1 -1
  106. package/dist/ui/components/form/input-mask/lib/mask/utils.d.ts +63 -0
  107. package/dist/ui/components/form/input-mask/lib/mask/utils.js +114 -0
  108. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.d.ts +6 -0
  109. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.js +58 -0
  110. package/dist/ui/components/form/input-mask/lib/number-format/index.d.ts +4 -0
  111. package/dist/ui/components/form/input-mask/lib/number-format/index.js +11 -0
  112. package/dist/ui/components/form/input-mask/lib/number-format/types.d.ts +26 -0
  113. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.d.ts +3 -0
  114. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.js +208 -0
  115. package/dist/ui/components/form/input-mask/lib/number-format/utils/localizeValues.d.ts +1 -1
  116. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.d.ts +2 -2
  117. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.js +1 -1
  118. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveMinimumFractionDigits.d.ts +1 -1
  119. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveOptions.d.ts +1 -1
  120. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveSelection.d.ts +2 -2
  121. package/dist/ui/components/form/input-youtube/index.js +1 -1
  122. package/dist/ui/components/form/input-youtube/index.js.map +1 -1
  123. package/dist/ui/contexts/toast/styles.js +1 -1
  124. package/dist/ui/contexts/toast/styles.js.map +1 -1
  125. package/dist/ui/icons/render/mobile.js +1 -1
  126. package/dist/ui/icons/render/mobile.js.map +1 -1
  127. package/dist/ui/styles/reset.css +356 -356
  128. package/package.json +1 -1
@@ -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,4 +1,4 @@
1
- import type { Replacement } from '../types';
1
+ import type { Replacement } from '../types.js';
2
2
  interface Options {
3
3
  replacementChars: string;
4
4
  replacement: Replacement;
@@ -1,4 +1,4 @@
1
- import type { Replacement } from '../types';
1
+ import type { Replacement } from '../types.js';
2
2
  interface Options {
3
3
  mask: string;
4
4
  replacement: Replacement;
@@ -1,4 +1,4 @@
1
- import type { MaskPart, Replacement } from '../types';
1
+ import type { MaskPart, Replacement } from '../types.js';
2
2
  interface Options {
3
3
  mask: string;
4
4
  replacement: Replacement;
@@ -1,2 +1,2 @@
1
- import type { Replacement } from '../types';
1
+ import type { Replacement } from '../types.js';
2
2
  export default function formatToReplacementObject(replacement: string): Replacement;
@@ -1,4 +1,4 @@
1
- import type { MaskEventDetail, Replacement } from '../types';
1
+ import type { MaskEventDetail, Replacement } from '../types.js';
2
2
  interface Options {
3
3
  mask: string;
4
4
  replacement: Replacement;
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
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"));
6
+ var utils_1 = require("../utils.js");
7
+ var format_1 = __importDefault(require("./format.js"));
8
+ var formatToParts_1 = __importDefault(require("./formatToParts.js"));
9
9
  /**
10
10
  * Формирует данные маскированного значения возвращая
11
11
  * @param input пользовательские символы без учета символов маски
@@ -1,5 +1,5 @@
1
- import type { MaskPart, Replacement } from '../types';
2
- import type { InputType } from '../../core';
1
+ import type { MaskPart, Replacement } from '../types.js';
2
+ import type { InputType } from '../../core/index.js';
3
3
  interface ResolveSelectionParam {
4
4
  inputType: InputType;
5
5
  value: string;
@@ -1,4 +1,4 @@
1
- import type { Replacement } from '../types';
1
+ import type { Replacement } from '../types.js';
2
2
  interface Options {
3
3
  start?: number;
4
4
  end?: number;
@@ -1,4 +1,4 @@
1
- import type { Replacement } from '../types';
1
+ import type { Replacement } from '../types.js';
2
2
  interface ValidateParam {
3
3
  initialValue: string;
4
4
  mask: string;
@@ -0,0 +1,63 @@
1
+ import type { MaskPart, Replacement } from './types.js';
2
+ interface Options {
3
+ mask: string;
4
+ replacement: string | Replacement;
5
+ }
6
+ /**
7
+ * Masks a value using the specified mask (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#format)»).
8
+ *
9
+ * The result fully corresponds to the value obtained when entering.
10
+ * Useful when you need to get a masked value without calling an input event.
11
+ *
12
+ * Since the principle of operation of `InputMask` is fully consistent with the operation
13
+ * of the `input` element, `InputMask` will not change the value outside the input event, so
14
+ * you may find yourself in a situation where the `input` element will have a value that does not
15
+ * correspond to the mask, for example when initializing the value of the received from the backend.
16
+ *
17
+ * `format('1', { mask: '+__', replacement: { _: /\d/ } })` → "+1"
18
+ */
19
+ export declare function format(value: string, { mask, replacement }: Options): string;
20
+ /**
21
+ * Unmasks the value using the specified mask (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#unformat)»).
22
+ *
23
+ * Returns all characters entered by the user. Essentially does the opposite of the `format` utility.
24
+ *
25
+ * `unformat('+1_', { mask: '+__', replacement: { _: /\d/ } })` → "1"
26
+ */
27
+ export declare function unformat(formattedValue: string, { mask, replacement }: Options): string;
28
+ /**
29
+ * Specifies the parts of the masked value (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#formattoparts)»).
30
+ *
31
+ * The masked value parts are an array of objects, where each object contains the
32
+ * necessary information about each character of the value. Parts of the masked value
33
+ * are used to manipulate a character or group of characters in a point-by-point manner.
34
+ *
35
+ * Parts of the masked value, where each object contains the character type:
36
+ * - `replacement` - the replacement character;
37
+ * - `mask` - the mask character;
38
+ * - `input` - the character entered by the user.
39
+ *
40
+ * `formatToParts('1', { mask: '+__', replacement: { _: /\d/ } })` →
41
+ * ```
42
+ * [
43
+ * { index: 0, value: '+', type: 'mask' },
44
+ * { index: 1, value: '1', type: 'input' },
45
+ * { index: 2, value: '_', type: 'replacement' },
46
+ * ]
47
+ * ```
48
+ */
49
+ export declare function formatToParts(value: string, { mask, replacement }: Options): MaskPart[];
50
+ /**
51
+ * Generates a regular expression to match a masked value (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#generatepattern)»).
52
+ *
53
+ * If `takeReplacementKey: true`, then the regular expression search will not take into account the
54
+ * `replacement` parameter key, that is, the character at the index of the replacement character in the
55
+ * value can be any character corresponding to the `replacement` value except the `replacement` key itself.
56
+ *
57
+ * So, if `mask: '_'` and `replacement: { _: /\D/ }` then:
58
+ * - if `takeReplacementKey: false`, the regular expression (pattern) will match `/^(\D)$/` and `RegExp(pattern).test(mask)` will return `true`;
59
+ * - if `takeReplacementKey: true`, the regular expression (pattern) will match `/^(?!_)(\D)$/` and `RegExp(pattern).test(mask)` will return `false`,
60
+ * but any a valid character, in addition to the replacement character, will contribute to the return of `true`.
61
+ */
62
+ export declare function generatePattern({ mask, replacement }: Options, takeReplacementKey?: boolean): string;
63
+ export {};
@@ -0,0 +1,114 @@
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.generatePattern = exports.formatToParts = exports.unformat = exports.format = void 0;
7
+ var filter_1 = __importDefault(require("./utils/filter.js"));
8
+ var format_1 = __importDefault(require("./utils/format.js"));
9
+ var formatToParts_1 = __importDefault(require("./utils/formatToParts.js"));
10
+ var formatToReplacementObject_1 = __importDefault(require("./utils/formatToReplacementObject.js"));
11
+ var unformat_1 = __importDefault(require("./utils/unformat.js"));
12
+ /**
13
+ * Masks a value using the specified mask (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#format)»).
14
+ *
15
+ * The result fully corresponds to the value obtained when entering.
16
+ * Useful when you need to get a masked value without calling an input event.
17
+ *
18
+ * Since the principle of operation of `InputMask` is fully consistent with the operation
19
+ * of the `input` element, `InputMask` will not change the value outside the input event, so
20
+ * you may find yourself in a situation where the `input` element will have a value that does not
21
+ * correspond to the mask, for example when initializing the value of the received from the backend.
22
+ *
23
+ * `format('1', { mask: '+__', replacement: { _: /\d/ } })` → "+1"
24
+ */
25
+ function format(value, _a) {
26
+ var mask = _a.mask, replacement = _a.replacement;
27
+ var replacementObject = typeof replacement === 'string' ? (0, formatToReplacementObject_1.default)(replacement) : replacement;
28
+ var regExp$1 = RegExp("[^".concat(Object.keys(replacementObject).join(''), "]"), 'g');
29
+ var replacementChars = mask.replace(regExp$1, '');
30
+ var input = (0, filter_1.default)(value, { replacementChars: replacementChars, replacement: replacementObject, separate: false });
31
+ return (0, format_1.default)(input, { mask: mask, replacement: replacementObject, showMask: false });
32
+ }
33
+ exports.format = format;
34
+ /**
35
+ * Unmasks the value using the specified mask (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#unformat)»).
36
+ *
37
+ * Returns all characters entered by the user. Essentially does the opposite of the `format` utility.
38
+ *
39
+ * `unformat('+1_', { mask: '+__', replacement: { _: /\d/ } })` → "1"
40
+ */
41
+ function unformat(formattedValue, _a) {
42
+ var mask = _a.mask, replacement = _a.replacement;
43
+ var replacementObject = typeof replacement === 'string' ? (0, formatToReplacementObject_1.default)(replacement) : replacement;
44
+ var value = (0, unformat_1.default)(formattedValue, { mask: mask, replacement: replacementObject, separate: false });
45
+ var regExp$1 = RegExp("[^".concat(Object.keys(replacementObject).join(''), "]"), 'g');
46
+ var replacementChars = mask.replace(regExp$1, '');
47
+ return (0, filter_1.default)(value, { replacementChars: replacementChars, replacement: replacementObject, separate: false });
48
+ }
49
+ exports.unformat = unformat;
50
+ /**
51
+ * Specifies the parts of the masked value (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#formattoparts)»).
52
+ *
53
+ * The masked value parts are an array of objects, where each object contains the
54
+ * necessary information about each character of the value. Parts of the masked value
55
+ * are used to manipulate a character or group of characters in a point-by-point manner.
56
+ *
57
+ * Parts of the masked value, where each object contains the character type:
58
+ * - `replacement` - the replacement character;
59
+ * - `mask` - the mask character;
60
+ * - `input` - the character entered by the user.
61
+ *
62
+ * `formatToParts('1', { mask: '+__', replacement: { _: /\d/ } })` →
63
+ * ```
64
+ * [
65
+ * { index: 0, value: '+', type: 'mask' },
66
+ * { index: 1, value: '1', type: 'input' },
67
+ * { index: 2, value: '_', type: 'replacement' },
68
+ * ]
69
+ * ```
70
+ */
71
+ function formatToParts(value, _a) {
72
+ var mask = _a.mask, replacement = _a.replacement;
73
+ var replacementObject = typeof replacement === 'string' ? (0, formatToReplacementObject_1.default)(replacement) : replacement;
74
+ var formattedValue = format(value, { mask: mask, replacement: replacementObject });
75
+ return (0, formatToParts_1.default)(formattedValue, { mask: mask, replacement: replacementObject });
76
+ }
77
+ exports.formatToParts = formatToParts;
78
+ /**
79
+ * Generates a regular expression to match a masked value (see «[Utils](https://github.com/GoncharukBro/react-input/tree/main/packages/mask#generatepattern)»).
80
+ *
81
+ * If `takeReplacementKey: true`, then the regular expression search will not take into account the
82
+ * `replacement` parameter key, that is, the character at the index of the replacement character in the
83
+ * value can be any character corresponding to the `replacement` value except the `replacement` key itself.
84
+ *
85
+ * So, if `mask: '_'` and `replacement: { _: /\D/ }` then:
86
+ * - if `takeReplacementKey: false`, the regular expression (pattern) will match `/^(\D)$/` and `RegExp(pattern).test(mask)` will return `true`;
87
+ * - if `takeReplacementKey: true`, the regular expression (pattern) will match `/^(?!_)(\D)$/` and `RegExp(pattern).test(mask)` will return `false`,
88
+ * but any a valid character, in addition to the replacement character, will contribute to the return of `true`.
89
+ */
90
+ function generatePattern(_a, takeReplacementKey) {
91
+ var mask = _a.mask, replacement = _a.replacement;
92
+ if (takeReplacementKey === void 0) { takeReplacementKey = false; }
93
+ var replacementObject = typeof replacement === 'string' ? (0, formatToReplacementObject_1.default)(replacement) : replacement;
94
+ var special = ['[', ']', '\\', '/', '^', '$', '.', '|', '?', '*', '+', '(', ')', '{', '}'];
95
+ var pattern = '';
96
+ for (var i = 0; i < mask.length; i++) {
97
+ var isReplacementKey = Object.prototype.hasOwnProperty.call(replacementObject, mask[i]);
98
+ var lookahead = takeReplacementKey ? "(?!".concat(mask[i], ")") : '';
99
+ if (i === 0) {
100
+ pattern += '^';
101
+ }
102
+ pattern += isReplacementKey
103
+ ? "".concat(lookahead, "(").concat(replacementObject[mask[i]].toString().slice(1, -1), ")")
104
+ : special.includes(mask[i])
105
+ ? "\\".concat(mask[i])
106
+ : mask[i];
107
+ if (i === mask.length - 1) {
108
+ pattern += '$';
109
+ }
110
+ }
111
+ return pattern;
112
+ }
113
+ exports.generatePattern = generatePattern;
114
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import type { NumberFormatProps } from './types.js';
3
+ import type { InputComponent, InputComponentProps } from '../core/index.js';
4
+ export type InputNumberFormatProps<C extends React.ComponentType | undefined = undefined> = NumberFormatProps & InputComponentProps<C>;
5
+ declare const InputNumberFormat: InputComponent<NumberFormatProps>;
6
+ export default InputNumberFormat;
@@ -0,0 +1,58 @@
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 useNumberFormat_1 = __importDefault(require("./useNumberFormat.js"));
32
+ function ForwardedInputNumberFormat(_a, forwardedInputRef) {
33
+ var Component = _a.component, locales = _a.locales, format = _a.format, currency = _a.currency, currencyDisplay = _a.currencyDisplay, unit = _a.unit, unitDisplay = _a.unitDisplay, signDisplay = _a.signDisplay, groupDisplay = _a.groupDisplay, minimumIntegerDigits = _a.minimumIntegerDigits, maximumIntegerDigits = _a.maximumIntegerDigits, minimumFractionDigits = _a.minimumFractionDigits, maximumFractionDigits = _a.maximumFractionDigits, onNumberFormat = _a.onNumberFormat, props = __rest(_a, ["component", "locales", "format", "currency", "currencyDisplay", "unit", "unitDisplay", "signDisplay", "groupDisplay", "minimumIntegerDigits", "maximumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits", "onNumberFormat"]);
34
+ var inputRef = (0, useNumberFormat_1.default)({
35
+ locales: locales,
36
+ format: format,
37
+ currency: currency,
38
+ currencyDisplay: currencyDisplay,
39
+ unit: unit,
40
+ unitDisplay: unitDisplay,
41
+ signDisplay: signDisplay,
42
+ groupDisplay: groupDisplay,
43
+ minimumIntegerDigits: minimumIntegerDigits,
44
+ maximumIntegerDigits: maximumIntegerDigits,
45
+ minimumFractionDigits: minimumFractionDigits,
46
+ maximumFractionDigits: maximumFractionDigits,
47
+ onNumberFormat: onNumberFormat,
48
+ });
49
+ var connectedInputRef = (0, core_1.useConnectedInputRef)(inputRef, forwardedInputRef);
50
+ if (Component) {
51
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ return (0, jsx_runtime_1.jsx)(Component, __assign({ ref: connectedInputRef }, props));
53
+ }
54
+ return (0, jsx_runtime_1.jsx)("input", __assign({ ref: connectedInputRef }, props));
55
+ }
56
+ var InputNumberFormat = (0, react_1.forwardRef)(ForwardedInputNumberFormat);
57
+ exports.default = InputNumberFormat;
58
+ //# sourceMappingURL=InputNumberFormat.js.map
@@ -0,0 +1,4 @@
1
+ export { default as InputNumberFormat } from './InputNumberFormat.js';
2
+ export { default as useNumberFormat } from './useNumberFormat.js';
3
+ export type { InputNumberFormatProps } from './InputNumberFormat.js';
4
+ export type { NumberFormatProps, NumberFormatEvent, NumberFormatEventDetail, NumberFormatEventHandler } from './types.js';
@@ -0,0 +1,11 @@
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.useNumberFormat = exports.InputNumberFormat = void 0;
7
+ var InputNumberFormat_1 = require("./InputNumberFormat.js");
8
+ Object.defineProperty(exports, "InputNumberFormat", { enumerable: true, get: function () { return __importDefault(InputNumberFormat_1).default; } });
9
+ var useNumberFormat_1 = require("./useNumberFormat.js");
10
+ Object.defineProperty(exports, "useNumberFormat", { enumerable: true, get: function () { return __importDefault(useNumberFormat_1).default; } });
11
+ //# sourceMappingURL=index.js.map