@invoicebox/ui 0.1.0-alpha.325 → 0.1.0-alpha.327
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.
- package/dist/components/common/AdaptiveModalDrawer/index.d.ts +11 -0
- package/dist/components/common/AdaptiveModalDrawer/index.js +31 -0
- package/dist/components/common/AdaptiveModalDrawer/index.stories.d.ts +5 -0
- package/dist/components/common/AdaptiveModalDrawer/index.stories.js +44 -0
- package/dist/components/common/AppCardLink/index.js +1 -2
- package/dist/components/common/BgCard/index.js +1 -2
- package/dist/components/common/BgCard/styles.js +1 -2
- package/dist/components/common/Calendar/index.js +1 -2
- package/dist/components/common/Calendar/index.stories.js +1 -2
- package/dist/components/common/Calendar/styles.js +1 -2
- package/dist/components/common/Divider/index.js +1 -2
- package/dist/components/common/Drawer/index.js +1 -2
- package/dist/components/common/Drawer/index.stories.js +1 -2
- package/dist/components/common/Drawer/styles.js +1 -2
- package/dist/components/common/Dropdown/index.js +1 -2
- package/dist/components/common/Dropdown/styles.js +8 -9
- package/dist/components/common/EntityAutocompleteOptionsDrawer/index.js +1 -2
- package/dist/components/common/EntityAutocompleteOptionsDrawer/index.stories.js +1 -2
- package/dist/components/common/Flag/index.js +1 -2
- package/dist/components/common/Flag/styles.js +1 -2
- package/dist/components/common/InvoiceboxSpinner/index.js +1 -2
- package/dist/components/common/InvoiceboxSpinner/styles.js +1 -2
- package/dist/components/common/Modal/assets/CollapseIcon.d.ts +1 -0
- package/dist/components/common/Modal/assets/CollapseIcon.js +42 -0
- package/dist/components/common/Modal/assets/ExpandIcon.d.ts +1 -0
- package/dist/components/common/Modal/assets/ExpandIcon.js +42 -0
- package/dist/components/common/Modal/context.d.ts +9 -0
- package/dist/components/common/Modal/context.js +14 -0
- package/dist/components/common/Modal/index.d.ts +15 -0
- package/dist/components/common/Modal/index.js +165 -0
- package/dist/components/common/Modal/index.stories.d.ts +6 -0
- package/dist/components/common/Modal/index.stories.js +76 -0
- package/dist/components/common/Modal/palette.d.ts +9 -0
- package/dist/components/common/Modal/palette.js +23 -0
- package/dist/components/common/Modal/styles.d.ts +25 -0
- package/dist/components/common/Modal/styles.js +69 -0
- package/dist/components/common/PointsLoader/index.js +1 -2
- package/dist/components/common/QRCode/index.js +2 -2
- package/dist/components/common/ReadOnlyLabelValueField/index.js +1 -2
- package/dist/components/common/Scrollbar/index.js +1 -2
- package/dist/components/common/Scrollbar/styles.js +1 -2
- package/dist/components/common/SecondaryButton/index.js +3 -4
- package/dist/components/common/SecondaryButton/styles.js +1 -2
- package/dist/components/common/Skeleton/index.js +1 -2
- package/dist/components/common/Skeleton/styles.js +1 -2
- package/dist/components/common/Toast/index.js +1 -2
- package/dist/components/common/Tooltip/index.js +1 -2
- package/dist/components/common/Typography/index.js +3 -4
- package/dist/components/common/WarningIcon/index.js +1 -2
- package/dist/components/common/WentWrongModal/assets/icons.d.ts +3 -0
- package/dist/components/common/WentWrongModal/assets/icons.js +84 -0
- package/dist/components/common/WentWrongModal/assets/racoonImage.d.ts +1 -0
- package/dist/components/common/WentWrongModal/assets/racoonImage.js +9 -0
- package/dist/components/common/WentWrongModal/index.d.ts +23 -0
- package/dist/components/common/WentWrongModal/index.js +193 -0
- package/dist/components/common/WentWrongModal/index.stories.d.ts +6 -0
- package/dist/components/common/WentWrongModal/index.stories.js +60 -0
- package/dist/components/common/WentWrongModal/index.test.d.ts +1 -0
- package/dist/components/common/WentWrongModal/index.test.js +209 -0
- package/dist/components/common/WentWrongModal/palette.d.ts +11 -0
- package/dist/components/common/WentWrongModal/palette.js +22 -0
- package/dist/components/common/WentWrongModal/styles.d.ts +24 -0
- package/dist/components/common/WentWrongModal/styles.js +88 -0
- package/dist/components/form/Autocomplete/components/Autocomplete/index.js +1 -2
- package/dist/components/form/Autocomplete/components/Autocomplete/index.stories.js +1 -2
- package/dist/components/form/Autocomplete/components/OrganizationAutocompleteItem/index.js +1 -2
- package/dist/components/form/Checkbox/index.js +3 -4
- package/dist/components/form/Checkbox/index.stories.js +1 -2
- package/dist/components/form/CodeInput/index.js +1 -2
- package/dist/components/form/CodeInput/index.stories.js +1 -2
- package/dist/components/form/CountrySelect/components/CountryItem/index.js +1 -2
- package/dist/components/form/CountrySelect/index.js +3 -4
- package/dist/components/form/CurrencyInput/CoreCurrencyInput/index.js +1 -2
- package/dist/components/form/CurrencyInput/CoreCurrencyInput/index.stories.js +1 -2
- package/dist/components/form/CurrencyInput/CurrencyInputNumber/index.js +2 -2
- package/dist/components/form/CurrencyInput/CurrencyInputNumber/index.stories.js +1 -2
- package/dist/components/form/CurrencyInput/CurrencyInputString/index.js +2 -2
- package/dist/components/form/CurrencyInput/CurrencyInputString/index.stories.js +1 -2
- package/dist/components/form/DateInput/components/CalendarIcon/index.js +1 -2
- package/dist/components/form/DateInput/components/MobileDrawerDateCalendar/index.js +1 -2
- package/dist/components/form/DateInput/components/MobileDrawerDateCalendar/index.stories.js +1 -2
- package/dist/components/form/DateInput/index.js +1 -2
- package/dist/components/form/DateInput/index.stories.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileDatePicker/index.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileDatePicker/index.stories.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileDrawerDateTimeCalendar/index.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileDrawerDateTimeCalendar/index.stories.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileWheelPicker/components/WheelColumn/index.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileWheelPicker/index.js +1 -2
- package/dist/components/form/DateTimeInput/components/MobileWheelPicker/index.stories.js +1 -2
- package/dist/components/form/DateTimeInput/components/TimePicker/index.js +1 -2
- package/dist/components/form/DateTimeInput/components/TimePicker/index.stories.js +1 -2
- package/dist/components/form/DateTimeInput/index.js +1 -2
- package/dist/components/form/DateTimeInput/index.stories.js +1 -2
- package/dist/components/form/InputLabel/index.js +1 -2
- package/dist/components/form/InputLabel/styles.js +1 -2
- package/dist/components/form/ModernPlaceholder/index.js +1 -2
- package/dist/components/form/PhoneInput/index.js +1 -2
- package/dist/components/form/PhoneInput/index.stories.js +1 -2
- package/dist/components/form/PositiveIntegerInput/index.js +1 -2
- package/dist/components/form/PositiveIntegerInput/index.stories.js +1 -2
- package/dist/components/form/PureInput/index.js +3 -4
- package/dist/components/form/PureInput/styles.js +2 -2
- package/dist/components/form/ResetButton/index.js +1 -2
- package/dist/components/form/SearchInput/index.js +1 -2
- package/dist/components/form/SearchInput/index.stories.js +1 -2
- package/dist/components/form/Select/components/Input/index.js +1 -2
- package/dist/components/form/Select/components/Loader/index.js +1 -2
- package/dist/components/form/Select/components/MultipleValue/index.js +1 -2
- package/dist/components/form/Select/components/MultipleValue/styles.js +1 -2
- package/dist/components/form/Select/index.js +1 -2
- package/dist/components/form/Select/index.stories.js +1 -2
- package/dist/components/form/Select/styles.js +1 -2
- package/dist/components/form/TagsInput/index.js +1 -2
- package/dist/components/form/TagsInput/index.stories.js +1 -2
- package/dist/components/form/TagsInput/styles.js +2 -2
- package/dist/components/form/TextInput/index.js +1 -2
- package/dist/components/form/TextInput/index.stories.js +1 -2
- package/dist/components/form/Toggle/index.js +3 -4
- package/dist/components/form/Toggle/index.stories.js +1 -2
- package/dist/components/form/Toggle/styles.js +10 -10
- package/dist/components/form/_hooks/useInputStyles.js +1 -2
- package/dist/components/form/common/DrawerHeader/index.js +1 -2
- package/dist/esm/components/common/AdaptiveModalDrawer/index.js +24 -0
- package/dist/esm/components/common/AdaptiveModalDrawer/index.stories.js +37 -0
- package/dist/esm/components/common/Dropdown/styles.js +7 -7
- package/dist/esm/components/common/Modal/assets/CollapseIcon.js +35 -0
- package/dist/esm/components/common/Modal/assets/ExpandIcon.js +35 -0
- package/dist/esm/components/common/Modal/context.js +8 -0
- package/dist/esm/components/common/Modal/index.js +147 -0
- package/dist/esm/components/common/Modal/index.stories.js +69 -0
- package/dist/esm/components/common/Modal/palette.js +16 -0
- package/dist/esm/components/common/Modal/styles.js +61 -0
- package/dist/esm/components/common/QRCode/index.js +2 -2
- package/dist/esm/components/common/SecondaryButton/index.js +2 -2
- package/dist/esm/components/common/Typography/index.js +2 -2
- package/dist/esm/components/common/WentWrongModal/assets/icons.js +77 -0
- package/dist/esm/components/common/WentWrongModal/assets/racoonImage.js +3 -0
- package/dist/esm/components/common/WentWrongModal/index.js +186 -0
- package/dist/esm/components/common/WentWrongModal/index.stories.js +53 -0
- package/dist/esm/components/common/WentWrongModal/index.test.js +208 -0
- package/dist/esm/components/common/WentWrongModal/palette.js +15 -0
- package/dist/esm/components/common/WentWrongModal/styles.js +81 -0
- package/dist/esm/components/form/Checkbox/index.js +2 -2
- package/dist/esm/components/form/CountrySelect/index.js +2 -2
- package/dist/esm/components/form/CurrencyInput/CurrencyInputNumber/index.js +2 -2
- package/dist/esm/components/form/CurrencyInput/CurrencyInputString/index.js +2 -2
- package/dist/esm/components/form/PureInput/index.js +2 -2
- package/dist/esm/components/form/PureInput/styles.js +2 -2
- package/dist/esm/components/form/TagsInput/styles.js +2 -2
- package/dist/esm/components/form/Toggle/index.js +2 -2
- package/dist/esm/components/form/Toggle/styles.js +10 -10
- package/dist/esm/hooks/useQueryFilter/context.js +40 -0
- package/dist/esm/hooks/useQueryFilter/helpers.js +58 -0
- package/dist/esm/hooks/useQueryFilter/index.js +123 -0
- package/dist/esm/hooks/useQueryFilter/index.stories.js +71 -0
- package/dist/esm/hooks/useQueryFilter/index.test.js +180 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/palette/context.js +5 -1
- package/dist/esm/palette/provider.js +5 -1
- package/dist/hooks/useQueryFilter/context.d.ts +35 -0
- package/dist/hooks/useQueryFilter/context.js +48 -0
- package/dist/hooks/useQueryFilter/helpers.d.ts +17 -0
- package/dist/hooks/useQueryFilter/helpers.js +64 -0
- package/dist/hooks/useQueryFilter/index.d.ts +19 -0
- package/dist/hooks/useQueryFilter/index.js +163 -0
- package/dist/hooks/useQueryFilter/index.stories.d.ts +4 -0
- package/dist/hooks/useQueryFilter/index.stories.js +75 -0
- package/dist/hooks/useQueryFilter/index.test.d.ts +1 -0
- package/dist/hooks/useQueryFilter/index.test.js +183 -0
- package/dist/hooks/useUnupdatableHandler/index.stories.js +1 -2
- package/dist/index.d.ts +8 -0
- package/dist/index.js +136 -0
- package/dist/palette/context.d.ts +4 -0
- package/dist/palette/context.js +52 -48
- package/dist/palette/provider.js +53 -50
- package/dist/palette/usePalette.d.ts +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
useQueryFilter: true,
|
|
8
|
+
QueryFilterProvider: true,
|
|
9
|
+
DEFAULT_PAGE_PARAM_NAME: true,
|
|
10
|
+
DEFAULT_FIRST_PAGE: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "DEFAULT_FIRST_PAGE", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _context.DEFAULT_FIRST_PAGE;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "DEFAULT_PAGE_PARAM_NAME", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _context.DEFAULT_PAGE_PARAM_NAME;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "QueryFilterProvider", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function get() {
|
|
27
|
+
return _context.QueryFilterProvider;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
exports.useQueryFilter = void 0;
|
|
31
|
+
var _react = require("react");
|
|
32
|
+
var _context = require("./context");
|
|
33
|
+
var _helpers = require("./helpers");
|
|
34
|
+
Object.keys(_helpers).forEach(function (key) {
|
|
35
|
+
if (key === "default" || key === "__esModule") return;
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
37
|
+
if (key in exports && exports[key] === _helpers[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function get() {
|
|
41
|
+
return _helpers[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
46
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
47
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
48
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
49
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
50
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
51
|
+
var getIsEmptyValue = function getIsEmptyValue(value) {
|
|
52
|
+
return value === '' || value === undefined || value === null || Array.isArray(value) && value.length === 0;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Значение фильтра, которое живёт в строке запроса.
|
|
57
|
+
*
|
|
58
|
+
* - `initialValue` записывается в адрес при монтировании, если параметра там ещё нет;
|
|
59
|
+
* пустое значение (`''`, `null`, `undefined`, `[]`) удаляет параметр.
|
|
60
|
+
* - Смена значения сбрасывает номер страницы на первую (`isResetPageWhenChanged`).
|
|
61
|
+
* - Начальное значение можно передавать выражением (`new Date()`, `[]`): хук сравнивает его
|
|
62
|
+
* по строке, которую оно даёт в адресе, а не по ссылке.
|
|
63
|
+
*
|
|
64
|
+
* Нужен `QueryFilterProvider` выше по дереву.
|
|
65
|
+
*/
|
|
66
|
+
var useQueryFilter = exports.useQueryFilter = function useQueryFilter(name, initialValue, fromString, toString) {
|
|
67
|
+
var _searchParams$get;
|
|
68
|
+
var isResetPageWhenChanged = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
|
69
|
+
var _useQueryFilterContex = (0, _context.useQueryFilterContext)(),
|
|
70
|
+
searchParams = _useQueryFilterContex.searchParams,
|
|
71
|
+
setSearchParams = _useQueryFilterContex.setSearchParams,
|
|
72
|
+
pageParamName = _useQueryFilterContex.pageParamName,
|
|
73
|
+
firstPage = _useQueryFilterContex.firstPage;
|
|
74
|
+
|
|
75
|
+
// для тех случаев когда если initialValue и в случае когда он не успел вставить в квери параметры - возвращать его
|
|
76
|
+
var _useState = (0, _react.useState)(false),
|
|
77
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
78
|
+
acceptInitialValueDone = _useState2[0],
|
|
79
|
+
setAcceptInitialValueDone = _useState2[1];
|
|
80
|
+
var serialize = (0, _react.useCallback)(function (value) {
|
|
81
|
+
if (getIsEmptyValue(value)) return '';
|
|
82
|
+
return toString ? toString(value) : String(value);
|
|
83
|
+
}, [toString]);
|
|
84
|
+
var removeAttribute = (0, _react.useCallback)(function (isResetPage) {
|
|
85
|
+
if (searchParams.has(name)) {
|
|
86
|
+
searchParams["delete"](name);
|
|
87
|
+
if (isResetPage) {
|
|
88
|
+
searchParams.set(pageParamName, String(firstPage));
|
|
89
|
+
}
|
|
90
|
+
setSearchParams(searchParams);
|
|
91
|
+
}
|
|
92
|
+
}, [firstPage, name, pageParamName, searchParams, setSearchParams]);
|
|
93
|
+
var handleQueryChange = (0, _react.useCallback)(function (newValue) {
|
|
94
|
+
if (getIsEmptyValue(newValue)) {
|
|
95
|
+
removeAttribute(isResetPageWhenChanged);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
searchParams.set(name, serialize(newValue));
|
|
99
|
+
if (isResetPageWhenChanged) {
|
|
100
|
+
searchParams.set(pageParamName, String(firstPage));
|
|
101
|
+
}
|
|
102
|
+
setSearchParams(searchParams);
|
|
103
|
+
}, [firstPage, isResetPageWhenChanged, name, pageParamName, removeAttribute, searchParams, serialize, setSearchParams]);
|
|
104
|
+
var acceptInitialValue = (0, _react.useCallback)(function (initial) {
|
|
105
|
+
if (!searchParams.has(name)) {
|
|
106
|
+
if (getIsEmptyValue(initial)) {
|
|
107
|
+
removeAttribute(true);
|
|
108
|
+
setAcceptInitialValueDone(true);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
searchParams.set(name, serialize(initial));
|
|
112
|
+
setSearchParams(searchParams);
|
|
113
|
+
}
|
|
114
|
+
setAcceptInitialValueDone(true);
|
|
115
|
+
}, [name, removeAttribute, searchParams, serialize, setSearchParams]);
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Начальное значение, стабилизированное по его строковому представлению.
|
|
119
|
+
*
|
|
120
|
+
* Вызывающие часто передают начальное значение выражением (`monthStart()`, `[]`,
|
|
121
|
+
* `new Date()`), то есть новым объектом на каждый рендер. Если зависеть от самой
|
|
122
|
+
* ссылки, эффект ниже срабатывает на каждом рендере (и возвращает в адрес значение
|
|
123
|
+
* по умолчанию, которое пользователь только что сбросил), а значение фильтра каждый
|
|
124
|
+
* раз получает новую ссылку — эффект с запросом перезапускается без конца. Поэтому
|
|
125
|
+
* ссылка меняется только когда меняется строка, которую значение даёт в адресе.
|
|
126
|
+
*/
|
|
127
|
+
var initialKey = serialize(initialValue);
|
|
128
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
129
|
+
var stableInitialValue = (0, _react.useMemo)(function () {
|
|
130
|
+
return initialValue;
|
|
131
|
+
}, [initialKey]);
|
|
132
|
+
(0, _react.useEffect)(function () {
|
|
133
|
+
acceptInitialValue(stableInitialValue);
|
|
134
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
+
}, [stableInitialValue]);
|
|
136
|
+
var handleGetValueFromString = (0, _react.useCallback)(function (queryValue) {
|
|
137
|
+
if (fromString) {
|
|
138
|
+
return fromString(queryValue);
|
|
139
|
+
}
|
|
140
|
+
return queryValue || '';
|
|
141
|
+
}, [fromString]);
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Строку читаем на каждом рендере, а не кешируем по объекту `searchParams`: эффект
|
|
145
|
+
* начального значения дописывает параметр прямо в текущий объект, а навигация
|
|
146
|
+
* (react-router 7 — переходом с низким приоритетом) приходит позже. Между ними есть
|
|
147
|
+
* рендер, где объект прежний, но строка в нём уже новая, — по ней и надо считать,
|
|
148
|
+
* иначе фильтр на один рендер «пустеет» и уходит лишний запрос.
|
|
149
|
+
*
|
|
150
|
+
* Пока строка в адресе совпадает с начальной, отдаём сам `stableInitialValue`, а не
|
|
151
|
+
* результат разбора: иначе `new Date(...)` из разборщика дал бы новую ссылку при тех
|
|
152
|
+
* же данных и эффект с запросом сработал бы ещё раз.
|
|
153
|
+
*/
|
|
154
|
+
var rawQueryValue = (_searchParams$get = searchParams.get(name)) !== null && _searchParams$get !== void 0 ? _searchParams$get : '';
|
|
155
|
+
var isInitialNotAppliedYet = !acceptInitialValueDone && !searchParams.has(name);
|
|
156
|
+
var formattedValue = (0, _react.useMemo)(function () {
|
|
157
|
+
if (isInitialNotAppliedYet || rawQueryValue === initialKey) {
|
|
158
|
+
return stableInitialValue;
|
|
159
|
+
}
|
|
160
|
+
return handleGetValueFromString(rawQueryValue || null);
|
|
161
|
+
}, [handleGetValueFromString, initialKey, isInitialNotAppliedYet, rawQueryValue, stableInitialValue]);
|
|
162
|
+
return [formattedValue, handleQueryChange];
|
|
163
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.Default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _ = require(".");
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
11
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable react-hooks/rules-of-hooks */
|
|
17
|
+
var meta = {
|
|
18
|
+
title: 'hooks/useQueryFilter',
|
|
19
|
+
tags: ['autodocs']
|
|
20
|
+
};
|
|
21
|
+
var _default = exports["default"] = meta; // В приложении сюда передают useSearchParams() роутера; в истории адрес живёт в состоянии
|
|
22
|
+
var InMemoryRouter = function InMemoryRouter(_ref) {
|
|
23
|
+
var children = _ref.children;
|
|
24
|
+
var _useState = (0, _react.useState)(function () {
|
|
25
|
+
return new URLSearchParams();
|
|
26
|
+
}),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
searchParams = _useState2[0],
|
|
29
|
+
setSearchParamsState = _useState2[1];
|
|
30
|
+
var setSearchParams = (0, _react.useCallback)(function (next) {
|
|
31
|
+
return setSearchParamsState(new URLSearchParams(next.toString()));
|
|
32
|
+
}, []);
|
|
33
|
+
return /*#__PURE__*/_react["default"].createElement(_.QueryFilterProvider, {
|
|
34
|
+
searchParams: searchParams,
|
|
35
|
+
setSearchParams: setSearchParams
|
|
36
|
+
}, children(searchParams.toString()));
|
|
37
|
+
};
|
|
38
|
+
var Filters = function Filters() {
|
|
39
|
+
var _useQueryFilter = (0, _.useQueryFilter)('status', 'pending'),
|
|
40
|
+
_useQueryFilter2 = _slicedToArray(_useQueryFilter, 2),
|
|
41
|
+
status = _useQueryFilter2[0],
|
|
42
|
+
setStatus = _useQueryFilter2[1];
|
|
43
|
+
var _useQueryFilter3 = (0, _.useQueryFilter)('from', null, _.getDateOrNullFromQueryString, _.getQueryStringFromDateOrNull),
|
|
44
|
+
_useQueryFilter4 = _slicedToArray(_useQueryFilter3, 2),
|
|
45
|
+
from = _useQueryFilter4[0],
|
|
46
|
+
setFrom = _useQueryFilter4[1];
|
|
47
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", null, "status: ", status || '—'), /*#__PURE__*/_react["default"].createElement("button", {
|
|
48
|
+
type: 'button',
|
|
49
|
+
onClick: function onClick() {
|
|
50
|
+
return setStatus('approved');
|
|
51
|
+
}
|
|
52
|
+
}, "status = approved"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
53
|
+
type: 'button',
|
|
54
|
+
onClick: function onClick() {
|
|
55
|
+
return setStatus('');
|
|
56
|
+
}
|
|
57
|
+
}, "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C status"), /*#__PURE__*/_react["default"].createElement("p", null, "from: ", from ? from.toLocaleString() : '—'), /*#__PURE__*/_react["default"].createElement("button", {
|
|
58
|
+
type: 'button',
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
return setFrom(new Date());
|
|
61
|
+
}
|
|
62
|
+
}, "from = \u0441\u0435\u0439\u0447\u0430\u0441"), /*#__PURE__*/_react["default"].createElement("button", {
|
|
63
|
+
type: 'button',
|
|
64
|
+
onClick: function onClick() {
|
|
65
|
+
return setFrom(null);
|
|
66
|
+
}
|
|
67
|
+
}, "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C from"));
|
|
68
|
+
};
|
|
69
|
+
var Default = exports.Default = {
|
|
70
|
+
render: function render() {
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(InMemoryRouter, null, function (search) {
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", null, "\u0410\u0434\u0440\u0435\u0441: ", /*#__PURE__*/_react["default"].createElement("code", null, "?", search)), /*#__PURE__*/_react["default"].createElement(Filters, null));
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
5
|
+
var _client = require("react-dom/client");
|
|
6
|
+
var _ = require(".");
|
|
7
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
8
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
13
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /**
|
|
14
|
+
* @jest-environment jsdom
|
|
15
|
+
*/
|
|
16
|
+
globalThis.IS_REACT_ACT_ENVIRONMENT = true;
|
|
17
|
+
var url = '';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Роутер в памяти, ведущий себя как react-router 7: запись адреса идёт переходом с низким
|
|
21
|
+
* приоритетом, а в следующем рендере приходит новый объект URLSearchParams.
|
|
22
|
+
*/
|
|
23
|
+
var MemoryRouter = function MemoryRouter(_ref) {
|
|
24
|
+
var _ref$initial = _ref.initial,
|
|
25
|
+
initial = _ref$initial === void 0 ? '' : _ref$initial,
|
|
26
|
+
children = _ref.children;
|
|
27
|
+
var _useState = (0, _react.useState)(function () {
|
|
28
|
+
return new URLSearchParams(initial);
|
|
29
|
+
}),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
searchParams = _useState2[0],
|
|
32
|
+
setSearchParamsState = _useState2[1];
|
|
33
|
+
var setSearchParams = (0, _react.useCallback)(function (next) {
|
|
34
|
+
var nextString = next.toString();
|
|
35
|
+
url = nextString;
|
|
36
|
+
(0, _react.startTransition)(function () {
|
|
37
|
+
return setSearchParamsState(new URLSearchParams(nextString));
|
|
38
|
+
});
|
|
39
|
+
}, []);
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_.QueryFilterProvider, {
|
|
41
|
+
searchParams: searchParams,
|
|
42
|
+
setSearchParams: setSearchParams
|
|
43
|
+
}, children);
|
|
44
|
+
};
|
|
45
|
+
var container;
|
|
46
|
+
var root;
|
|
47
|
+
beforeEach(function () {
|
|
48
|
+
url = '';
|
|
49
|
+
container = document.createElement('div');
|
|
50
|
+
root = (0, _client.createRoot)(container);
|
|
51
|
+
});
|
|
52
|
+
afterEach(function () {
|
|
53
|
+
(0, _react.act)(function () {
|
|
54
|
+
return root.unmount();
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
var render = function render(node) {
|
|
58
|
+
return (0, _react.act)(function () {
|
|
59
|
+
return root.render(node);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
describe('useQueryFilter', function () {
|
|
63
|
+
test('строковое значение по умолчанию: попадает в адрес, запрос один', function () {
|
|
64
|
+
var requests = [];
|
|
65
|
+
var setter = function setter() {
|
|
66
|
+
return undefined;
|
|
67
|
+
};
|
|
68
|
+
var List = function List() {
|
|
69
|
+
var _useQueryFilter = (0, _.useQueryFilter)('status', 'pending'),
|
|
70
|
+
_useQueryFilter2 = _slicedToArray(_useQueryFilter, 2),
|
|
71
|
+
status = _useQueryFilter2[0],
|
|
72
|
+
setStatus = _useQueryFilter2[1];
|
|
73
|
+
setter = setStatus;
|
|
74
|
+
(0, _react.useEffect)(function () {
|
|
75
|
+
requests.push(status);
|
|
76
|
+
}, [status]);
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
render(/*#__PURE__*/_react["default"].createElement(MemoryRouter, null, /*#__PURE__*/_react["default"].createElement(List, null)));
|
|
80
|
+
expect(url).toBe('status=pending');
|
|
81
|
+
expect(requests).toEqual(['pending']);
|
|
82
|
+
(0, _react.act)(function () {
|
|
83
|
+
return setter('approved');
|
|
84
|
+
});
|
|
85
|
+
expect(url).toBe('status=approved&page=1');
|
|
86
|
+
expect(requests).toEqual(['pending', 'approved']);
|
|
87
|
+
});
|
|
88
|
+
test('дата по умолчанию выражением: ни лишнего запроса, ни цикла', function () {
|
|
89
|
+
var requests = [];
|
|
90
|
+
var from = new Date(2026, 9, 1, 12, 30, 15);
|
|
91
|
+
var List = function List() {
|
|
92
|
+
// новый объект на каждом рендере — так вызывающие и пишут
|
|
93
|
+
var _useQueryFilter3 = (0, _.useQueryFilter)('from', new Date(from.getTime()), _.getDateOrNullFromQueryString, _.getQueryStringFromDateOrNull),
|
|
94
|
+
_useQueryFilter4 = _slicedToArray(_useQueryFilter3, 1),
|
|
95
|
+
dateFrom = _useQueryFilter4[0];
|
|
96
|
+
(0, _react.useEffect)(function () {
|
|
97
|
+
requests.push(String(dateFrom === null || dateFrom === void 0 ? void 0 : dateFrom.getTime()));
|
|
98
|
+
}, [dateFrom]);
|
|
99
|
+
return null;
|
|
100
|
+
};
|
|
101
|
+
render(/*#__PURE__*/_react["default"].createElement(MemoryRouter, null, /*#__PURE__*/_react["default"].createElement(List, null)));
|
|
102
|
+
expect(new URLSearchParams(url).get('from')).toBe((0, _.formatDateForQuery)(from));
|
|
103
|
+
expect(requests).toEqual([String(from.getTime())]);
|
|
104
|
+
});
|
|
105
|
+
test('значение из адреса важнее значения по умолчанию', function () {
|
|
106
|
+
var value = '';
|
|
107
|
+
var List = function List() {
|
|
108
|
+
var _useQueryFilter5 = (0, _.useQueryFilter)('status', 'pending');
|
|
109
|
+
var _useQueryFilter6 = _slicedToArray(_useQueryFilter5, 1);
|
|
110
|
+
value = _useQueryFilter6[0];
|
|
111
|
+
return null;
|
|
112
|
+
};
|
|
113
|
+
render(/*#__PURE__*/_react["default"].createElement(MemoryRouter, {
|
|
114
|
+
initial: "status=rejected&page=3"
|
|
115
|
+
}, /*#__PURE__*/_react["default"].createElement(List, null)));
|
|
116
|
+
expect(value).toBe('rejected');
|
|
117
|
+
expect(url).toBe('');
|
|
118
|
+
});
|
|
119
|
+
test('сброс фильтра с непустым значением по умолчанию не возвращает его обратно', function () {
|
|
120
|
+
var value;
|
|
121
|
+
var setter = function setter() {
|
|
122
|
+
return undefined;
|
|
123
|
+
};
|
|
124
|
+
var List = function List() {
|
|
125
|
+
var _useQueryFilter7 = (0, _.useQueryFilter)('ids', ['a', 'b'], function (raw) {
|
|
126
|
+
return raw ? raw.split(',') : undefined;
|
|
127
|
+
}, function (next) {
|
|
128
|
+
return next ? next.join(',') : '';
|
|
129
|
+
});
|
|
130
|
+
var _useQueryFilter8 = _slicedToArray(_useQueryFilter7, 2);
|
|
131
|
+
value = _useQueryFilter8[0];
|
|
132
|
+
setter = _useQueryFilter8[1];
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
135
|
+
render(/*#__PURE__*/_react["default"].createElement(MemoryRouter, null, /*#__PURE__*/_react["default"].createElement(List, null)));
|
|
136
|
+
expect(value).toEqual(['a', 'b']);
|
|
137
|
+
(0, _react.act)(function () {
|
|
138
|
+
return setter(undefined);
|
|
139
|
+
});
|
|
140
|
+
expect(url).toBe('page=1');
|
|
141
|
+
expect(value).toBeUndefined();
|
|
142
|
+
});
|
|
143
|
+
test('isResetPageWhenChanged=false не трогает страницу', function () {
|
|
144
|
+
var setter = function setter() {
|
|
145
|
+
return undefined;
|
|
146
|
+
};
|
|
147
|
+
var List = function List() {
|
|
148
|
+
var _useQueryFilter9 = (0, _.useQueryFilter)('q', '', undefined, undefined, false);
|
|
149
|
+
var _useQueryFilter0 = _slicedToArray(_useQueryFilter9, 2);
|
|
150
|
+
setter = _useQueryFilter0[1];
|
|
151
|
+
return null;
|
|
152
|
+
};
|
|
153
|
+
render(/*#__PURE__*/_react["default"].createElement(MemoryRouter, {
|
|
154
|
+
initial: "page=4"
|
|
155
|
+
}, /*#__PURE__*/_react["default"].createElement(List, null)));
|
|
156
|
+
(0, _react.act)(function () {
|
|
157
|
+
return setter('abc');
|
|
158
|
+
});
|
|
159
|
+
expect(url).toBe('page=4&q=abc');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('formatDateForQuery', function () {
|
|
163
|
+
test('локальное время со смещением, без миллисекунд', function () {
|
|
164
|
+
var date = new Date(2026, 0, 2, 3, 4, 5, 678);
|
|
165
|
+
var formatted = (0, _.formatDateForQuery)(date);
|
|
166
|
+
expect(formatted).toMatch(/^2026-01-02T03:04:05[+-]\d{2}:\d{2}$/);
|
|
167
|
+
expect(new Date(formatted).getTime()).toBe(new Date(2026, 0, 2, 3, 4, 5).getTime());
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe('разборщики', function () {
|
|
171
|
+
test('диапазон дат пишется без времени и читается обратно', function () {
|
|
172
|
+
var range = [new Date(2026, 9, 1, 15, 0), new Date(2026, 9, 31, 9, 0)];
|
|
173
|
+
var query = (0, _.getQueryStringFromDateArrOrNull)(range);
|
|
174
|
+
expect(query).toBe('2026-10-01!!!2026-10-31');
|
|
175
|
+
expect((0, _.getDateArrOrNullFromQueryString)(query)).toHaveLength(2);
|
|
176
|
+
expect((0, _.getDateArrOrNullFromQueryString)(null)).toBeNull();
|
|
177
|
+
});
|
|
178
|
+
test('булевы значения', function () {
|
|
179
|
+
expect((0, _.booleanFromString)('true')).toBe(true);
|
|
180
|
+
expect((0, _.booleanFromString)('false')).toBe(false);
|
|
181
|
+
expect((0, _.booleanFromString)(null)).toBeNull();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
@@ -8,8 +8,7 @@ exports["default"] = exports.Default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _addonActions = require("@storybook/addon-actions");
|
|
10
10
|
var _ = require(".");
|
|
11
|
-
function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
12
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
14
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
15
14
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ export { ToastContainer, toast } from './components/common/Toast';
|
|
|
32
32
|
export { AppCardLink } from './components/common/AppCardLink';
|
|
33
33
|
export { InvoiceboxLogo } from './components/common/InvoiceboxLogo';
|
|
34
34
|
export { QRCode } from './components/common/QRCode';
|
|
35
|
+
export { Modal, useModalExpansion, modalExpansionFlexItem } from './components/common/Modal';
|
|
36
|
+
export type { TProps as TModalProps, TModalExpansion } from './components/common/Modal';
|
|
37
|
+
export { AdaptiveModalDrawer } from './components/common/AdaptiveModalDrawer';
|
|
38
|
+
export type { TProps as TAdaptiveModalDrawerProps } from './components/common/AdaptiveModalDrawer';
|
|
39
|
+
export { WentWrongModal, WENT_WRONG_MODAL_DEFAULT_CONTACTS } from './components/common/WentWrongModal';
|
|
40
|
+
export type { TProps as TWentWrongModalProps, TWentWrongModalContact, } from './components/common/WentWrongModal';
|
|
35
41
|
export { InputLabel } from './components/form/InputLabel';
|
|
36
42
|
export { PureInput } from './components/form/PureInput';
|
|
37
43
|
export { PositiveIntegerInput } from './components/form/PositiveIntegerInput';
|
|
@@ -73,5 +79,7 @@ export { useLoadingSubmit } from './hooks/useLoadingSubmit';
|
|
|
73
79
|
export { breakpoints } from './breakpoints';
|
|
74
80
|
export { useMobile, useTablet, useLargeTablet, useMiniLaptop } from './hooks/useMedia';
|
|
75
81
|
export { useModal } from './hooks/useModal';
|
|
82
|
+
export { useQueryFilter, QueryFilterProvider, DEFAULT_PAGE_PARAM_NAME, DEFAULT_FIRST_PAGE, DATA_SPLITTER, formatDateForQuery, formatDateOnlyForQuery, getDateOrNullFromQueryString, getQueryStringFromDateOrNull, getDateArrOrNullFromQueryString, getQueryStringFromDateArrOrNull, getNumberOrNullFromQueryString, getQueryStringFromNumberOrNull, getQueryStringFromArrayString, getArrayStringsFromQueryString, booleanFromString, } from './hooks/useQueryFilter';
|
|
83
|
+
export type { TUseQueryArgumentType, TQueryFilterProviderProps } from './hooks/useQueryFilter';
|
|
76
84
|
export { LENGTH_VAT_NUMBER } from './validate/utils/vatNumberValidateHelpers';
|
|
77
85
|
export { Validate } from './validate';
|