infinity-forge 3.4.0 → 3.4.2

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 (125) hide show
  1. package/LICENSE +20 -20
  2. package/dist/infinity-forge.css +3 -0
  3. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.d.ts +6 -0
  4. package/dist/sites/components/default-pages/blog/components/featured-blog/featured-blog-item/index.js +42 -0
  5. package/dist/sites/public/fonts/fonts.css +760 -760
  6. package/dist/system/container/admin/auth/container.js +2 -2
  7. package/dist/system/container/admin/menu/container.js +2 -2
  8. package/dist/system/presentation/components/data/menu/components/menu-item/index.js +80 -0
  9. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/index.js +44 -0
  10. package/dist/system/presentation/components/data/menu/modes/collapsed-menu/styles.js +15 -0
  11. package/dist/system/presentation/components/data/menu/modes/opened/index.js +51 -0
  12. package/dist/system/presentation/components/data/menu/modes/opened/styles.js +15 -0
  13. package/dist/system/presentation/components/layout/header/components/menu-right/component.d.ts +6 -0
  14. package/dist/system/presentation/components/layout/header/components/menu-right/component.js +35 -0
  15. package/dist/system/presentation/components/layout/header/components/menu-right/index.d.ts +3 -0
  16. package/dist/system/presentation/components/layout/header/components/menu-right/index.js +20 -0
  17. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.d.ts +1 -1
  18. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/card/index.js +3 -3
  19. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/index.js +3 -3
  20. package/dist/system/presentation/components/layout/header/components/menu-right/messages/content/interfaces.d.ts +1 -1
  21. package/dist/system/presentation/components/layout/header/components/menu-right/messages/index.js +4 -4
  22. package/dist/system/presentation/components/layout/header/components/menu-right/profile/content/index.js +3 -3
  23. package/dist/system/presentation/components/layout/header/components/menu-right/profile/index.js +4 -4
  24. package/dist/system/presentation/components/layout/header/components/search-modal/index.js +40 -0
  25. package/dist/system/presentation/components/layout/header/components/search-modal/search-list/index.js +3 -3
  26. package/dist/system/presentation/components/layout/header/components/search-modal/trigger/index.js +2 -2
  27. package/dist/system/presentation/components/pages/menus/table/icon/index.js +34 -0
  28. package/dist/system/presentation/context/auth/components/login/form-login/index.js +2 -2
  29. package/dist/system/presentation/hooks/locales/ibge/index.d.ts +0 -1
  30. package/dist/system/presentation/hooks/locales/ibge/index.js +0 -1
  31. package/dist/system/presentation/hooks/locales/ibge/index.js.map +1 -1
  32. package/dist/system/presentation/hooks/locales/ibge/use-load-cities-by-uf/index.d.ts +1 -1
  33. package/dist/system/presentation/hooks/locales/ibge/use-load-cities-by-uf/index.js +8 -18
  34. package/dist/system/presentation/hooks/locales/ibge/use-load-cities-by-uf/index.js.map +1 -1
  35. package/dist/system/presentation/hooks/locales/index.d.ts +1 -0
  36. package/dist/system/presentation/hooks/locales/index.js +1 -0
  37. package/dist/system/presentation/hooks/locales/index.js.map +1 -1
  38. package/dist/system/presentation/hooks/locales/use-load-cities/index.d.ts +4 -0
  39. package/dist/system/presentation/hooks/locales/use-load-cities/index.js +164 -0
  40. package/dist/system/presentation/hooks/locales/use-load-cities/index.js.map +1 -0
  41. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.d.ts +1 -1
  42. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/delete/index.js +2 -2
  43. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.d.ts +1 -1
  44. package/dist/system/presentation/hooks/ui/use-table/components/table/actions/index.js +4 -4
  45. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.d.ts +1 -1
  46. package/dist/system/presentation/hooks/ui/use-table/components/table/active-filters/index.js +2 -2
  47. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.d.ts +1 -1
  48. package/dist/system/presentation/hooks/ui/use-table/components/table/create/index.js +3 -3
  49. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.d.ts +1 -1
  50. package/dist/system/presentation/hooks/ui/use-table/components/table/export/index.js +2 -2
  51. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.d.ts +1 -1
  52. package/dist/system/presentation/hooks/ui/use-table/components/table/filters/index.js +3 -3
  53. package/dist/system/presentation/hooks/ui/use-table/components/table/index.d.ts +1 -1
  54. package/dist/system/presentation/hooks/ui/use-table/components/table/index.js +10 -10
  55. package/dist/system/presentation/hooks/ui/use-table/components/table/interfaces.d.ts +2 -2
  56. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.d.ts +1 -1
  57. package/dist/system/presentation/hooks/ui/use-table/components/table/pagination/index.js +3 -3
  58. package/dist/system/presentation/hooks/ui/use-table/components/table/skeleton-table/index.js +2 -2
  59. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.d.ts +1 -1
  60. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/index.js +2 -2
  61. package/dist/system/presentation/hooks/ui/use-table/components/table/thead-item/interfaces.d.ts +1 -1
  62. package/dist/ui/components/carousel/carousel-lib/core/modules/observer/observer.js +2 -2
  63. package/dist/ui/components/carousel/carousel-lib/core/modules/resize/resize.js +1 -1
  64. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.d.ts +1 -1
  65. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/hook.js +1 -1
  66. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.d.ts +3 -3
  67. package/dist/ui/components/form/input-cep/use-cep/providers/ibge/index.js +3 -3
  68. package/dist/ui/components/form/input-date-picker/calendar/calendar-header/index.d.ts +2 -0
  69. package/dist/ui/components/form/input-date-picker/calendar/calendar-header/index.js +62 -0
  70. package/dist/ui/components/form/input-date-picker/calendar/days/index.d.ts +2 -0
  71. package/dist/ui/components/form/input-date-picker/calendar/days/index.js +87 -0
  72. package/dist/ui/components/form/input-date-picker/calendar/months/index.d.ts +2 -0
  73. package/dist/ui/components/form/input-date-picker/calendar/months/index.js +66 -0
  74. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.d.ts +1 -1
  75. package/dist/ui/components/form/input-file/render-files/file-item/button-upload-image-mobile/index.js +1 -1
  76. package/dist/ui/components/form/input-file/render-files/file-item/index.d.ts +3 -0
  77. package/dist/ui/components/form/input-file/render-files/file-item/index.js +49 -0
  78. package/dist/ui/components/form/input-mask/lib/core/errors/SyntheticChangeError.d.ts +1 -1
  79. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.d.ts +1 -1
  80. package/dist/ui/components/form/input-mask/lib/core/hooks/useInput.js +2 -2
  81. package/dist/ui/components/form/input-mask/lib/core/index.d.ts +5 -0
  82. package/dist/ui/components/form/input-mask/lib/core/index.js +15 -0
  83. package/dist/ui/components/form/input-mask/lib/core/utils/setInputAttributes.d.ts +1 -1
  84. package/dist/ui/components/form/input-mask/lib/mask/InputMask.d.ts +6 -0
  85. package/dist/ui/components/form/input-mask/lib/mask/InputMask.js +44 -0
  86. package/dist/ui/components/form/input-mask/lib/mask/index.d.ts +5 -0
  87. package/dist/ui/components/form/input-mask/lib/mask/index.js +26 -0
  88. package/dist/ui/components/form/input-mask/lib/mask/types.d.ts +61 -0
  89. package/dist/ui/components/form/input-mask/lib/mask/useMask.d.ts +3 -0
  90. package/dist/ui/components/form/input-mask/lib/mask/useMask.js +150 -0
  91. package/dist/ui/components/form/input-mask/lib/mask/utils/filter.d.ts +1 -1
  92. package/dist/ui/components/form/input-mask/lib/mask/utils/format.d.ts +1 -1
  93. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToParts.d.ts +1 -1
  94. package/dist/ui/components/form/input-mask/lib/mask/utils/formatToReplacementObject.d.ts +1 -1
  95. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.d.ts +1 -1
  96. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveDetail.js +3 -3
  97. package/dist/ui/components/form/input-mask/lib/mask/utils/resolveSelection.d.ts +2 -2
  98. package/dist/ui/components/form/input-mask/lib/mask/utils/unformat.d.ts +1 -1
  99. package/dist/ui/components/form/input-mask/lib/mask/utils/validate.d.ts +1 -1
  100. package/dist/ui/components/form/input-mask/lib/mask/utils.d.ts +63 -0
  101. package/dist/ui/components/form/input-mask/lib/mask/utils.js +114 -0
  102. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.d.ts +6 -0
  103. package/dist/ui/components/form/input-mask/lib/number-format/InputNumberFormat.js +58 -0
  104. package/dist/ui/components/form/input-mask/lib/number-format/index.d.ts +4 -0
  105. package/dist/ui/components/form/input-mask/lib/number-format/index.js +11 -0
  106. package/dist/ui/components/form/input-mask/lib/number-format/types.d.ts +26 -0
  107. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.d.ts +3 -0
  108. package/dist/ui/components/form/input-mask/lib/number-format/useNumberFormat.js +208 -0
  109. package/dist/ui/components/form/input-mask/lib/number-format/utils/localizeValues.d.ts +1 -1
  110. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.d.ts +2 -2
  111. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveDetail.js +1 -1
  112. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveMinimumFractionDigits.d.ts +1 -1
  113. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveOptions.d.ts +1 -1
  114. package/dist/ui/components/form/input-mask/lib/number-format/utils/resolveSelection.d.ts +2 -2
  115. package/dist/ui/components/form/input-youtube/index.js +1 -1
  116. package/dist/ui/components/form/input-youtube/index.js.map +1 -1
  117. package/dist/ui/hooks/use-query/hook.js +2 -2
  118. package/dist/ui/hooks/use-query/hook.js.map +1 -1
  119. package/dist/ui/icons/render/mobile.js +1 -1
  120. package/dist/ui/icons/render/mobile.js.map +1 -1
  121. package/dist/ui/styles/reset.css +356 -356
  122. package/package.json +1 -1
  123. package/dist/system/presentation/hooks/locales/ibge/use-load-cities/index.d.ts +0 -1
  124. package/dist/system/presentation/hooks/locales/ibge/use-load-cities/index.js +0 -66
  125. package/dist/system/presentation/hooks/locales/ibge/use-load-cities/index.js.map +0 -1
@@ -0,0 +1,66 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Months = void 0;
38
+ var jsx_runtime_1 = require("react/jsx-runtime");
39
+ var formik_1 = require("formik");
40
+ var mock_1 = require("../../mock/index.js");
41
+ var S = __importStar(require("./styles.js"));
42
+ function Months(_a) {
43
+ var language = _a.language, name = _a.name, mode = _a.mode, date = _a.date, dateSelected = _a.dateSelected, setStep = _a.setStep, handleToggle = _a.handleToggle, setDateSelected = _a.setDateSelected;
44
+ var _b = (0, formik_1.useFormikContext)(), values = _b.values, setFieldValue = _b.setFieldValue;
45
+ var months = mock_1.translations[language].months;
46
+ return ((0, jsx_runtime_1.jsx)(S.Months, { className: 'months-box', children: months.map(function (monthName, index) {
47
+ var monthDate = new Date(dateSelected.year, index, 1);
48
+ var isMonthInRange = ((date === null || date === void 0 ? void 0 : date.minDate) ? monthDate >= new Date(date === null || date === void 0 ? void 0 : date.minDate.getFullYear(), date === null || date === void 0 ? void 0 : date.minDate.getMonth(), 1) : true) &&
49
+ ((date === null || date === void 0 ? void 0 : date.maxDate) ? monthDate <= new Date(date === null || date === void 0 ? void 0 : date.maxDate.getFullYear(), date === null || date === void 0 ? void 0 : date.maxDate.getMonth(), 1) : true);
50
+ var isSelected = values[name].getMonth() === index &&
51
+ values[name].getMonth() === dateSelected.month &&
52
+ values[name].getFullYear() === dateSelected.year;
53
+ return ((0, jsx_runtime_1.jsx)("button", { type: 'button', className: "".concat(isSelected && 'selected', " ").concat(new Date().getMonth() === index && !isSelected && 'current', " ").concat(!isMonthInRange && 'disabled'), onClick: function () {
54
+ if (!isMonthInRange)
55
+ return;
56
+ setDateSelected(__assign(__assign({}, dateSelected), { month: index }));
57
+ if (mode === 'month') {
58
+ setFieldValue(name, new Date(dateSelected.year, index, 1));
59
+ handleToggle(false);
60
+ }
61
+ setStep(2);
62
+ }, disabled: !isMonthInRange, children: monthName.substring(0, 3) }, monthName));
63
+ }) }));
64
+ }
65
+ exports.Months = Months;
66
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { RenderFileProps } from '../../../../../../../ui';
1
+ import { RenderFileProps } from '../../../../../../../ui/index.js';
2
2
  export type ButtonUploadImageMobileProps = {
3
3
  mobile?: {
4
4
  id: string;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ButtonUploadImageMobile = void 0;
4
4
  var jsx_runtime_1 = require("react/jsx-runtime");
5
- var ui_1 = require("../../../../../../../ui");
5
+ var ui_1 = require("../../../../../../../ui/index.js");
6
6
  function ButtonUploadImageMobile(props) {
7
7
  var _a, _b;
8
8
  var _c = (0, ui_1.useFile)(props.mobile), InputFile = _c.InputFile, LabelFileArea = _c.LabelFileArea;
@@ -0,0 +1,3 @@
1
+ import { ButtonUploadImageMobileProps } from './button-upload-image-mobile/index.js';
2
+ import { RenderFileProps } from '../interfaces.js';
3
+ export declare function FileItem(props: RenderFileProps & ButtonUploadImageMobileProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,49 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.FileItem = void 0;
38
+ var jsx_runtime_1 = require("react/jsx-runtime");
39
+ var ui_1 = require("../../../../../../ui/index.js");
40
+ var button_upload_image_mobile_1 = require("./button-upload-image-mobile/index.js");
41
+ var S = __importStar(require("./styles.js"));
42
+ function FileItem(props) {
43
+ var _a;
44
+ var _b = (0, ui_1.useFile)(props), loading = _b.loading, InputFile = _b.InputFile;
45
+ var _c = (0, ui_1.useRenderedFile)(props), Image = _c.Image, fileName = _c.fileName, ShowDetailFileButton = _c.ShowDetailFileButton, DeleteFileButton = _c.DeleteFileButton, DownloadButton = _c.DownloadButton;
46
+ return ((0, jsx_runtime_1.jsxs)(S.FileItem, { children: [(0, jsx_runtime_1.jsx)("div", { style: { display: 'none' }, children: (0, jsx_runtime_1.jsx)(InputFile, {}) }), (0, jsx_runtime_1.jsx)("div", { className: 'image', children: loading ? (0, jsx_runtime_1.jsx)(ui_1.LoaderCircle, { size: 30, color: '#000' }) : (0, jsx_runtime_1.jsx)(Image, {}) }), (0, jsx_runtime_1.jsxs)("div", { className: 'text', children: [(0, jsx_runtime_1.jsxs)("h3", { children: [(0, jsx_runtime_1.jsxs)("div", { className: 'left', children: [props.enableMobileImage && ((0, jsx_runtime_1.jsx)("span", { className: 'font-13-regular type_size_file', children: props.isMobile ? 'Mobile' : 'Desktop' })), fileName && (0, jsx_runtime_1.jsx)("span", { className: 'font-13-regular file-name', children: fileName })] }), (props.sizeImageFile || props.sizeImageFileMobile) && ((0, jsx_runtime_1.jsxs)("span", { className: 'font-13-regular size', children: [!props.isMobile && ((0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(ui_1.Icon, { name: 'IconComputer' }), " ", props.sizeImageFile] })), !((_a = props === null || props === void 0 ? void 0 : props.mobile) === null || _a === void 0 ? void 0 : _a.mobileFilesAlredyExist) && props.enableMobileImage && ((0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(ui_1.Icon, { name: 'IconMobile' }), props.sizeImageFileMobile] }))] }))] }), (0, jsx_runtime_1.jsxs)("div", { className: 'actions', children: [(0, jsx_runtime_1.jsx)(ShowDetailFileButton, {}), (0, jsx_runtime_1.jsx)(DeleteFileButton, {}), (0, jsx_runtime_1.jsx)(DownloadButton, {}), (0, jsx_runtime_1.jsx)(button_upload_image_mobile_1.ButtonUploadImageMobile, __assign({}, props))] })] })] }));
47
+ }
48
+ exports.FileItem = FileItem;
49
+ //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { InputAttributes } from '../types';
1
+ import type { InputAttributes } from '../types.js';
2
2
  interface SyntheticChangeError {
3
3
  cause?: {
4
4
  __attributes?: Partial<InputAttributes>;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { CustomInputEvent, CustomInputEventHandler, Init, Tracking } from '../types';
2
+ import type { CustomInputEvent, CustomInputEventHandler, Init, Tracking } from '../types.js';
3
3
  interface UseInputParam<D> {
4
4
  init: Init;
5
5
  tracking: Tracking<D>;
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var react_1 = require("react");
7
7
  var react_dom_1 = require("react-dom");
8
- var SyntheticChangeError_1 = __importDefault(require("../errors/SyntheticChangeError"));
9
- var setInputAttributes_1 = __importDefault(require("../utils/setInputAttributes"));
8
+ var SyntheticChangeError_1 = __importDefault(require("../errors/SyntheticChangeError.js"));
9
+ var setInputAttributes_1 = __importDefault(require("../utils/setInputAttributes.js"));
10
10
  var TYPES = ['text', 'email', 'tel', 'search', 'url'];
11
11
  function proxy(inputRef, init, _a) {
12
12
  var onFocus = _a.onFocus, onBlur = _a.onBlur, onInput = _a.onInput;
@@ -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 +1,2 @@
1
- import type { InputAttributes } from '../types';
1
+ import type { InputAttributes } from '../types.js';
2
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,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;