@astral/ui 4.34.1 → 4.35.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.
- package/components/Badge/styles.js +5 -0
- package/components/Badge/types.d.ts +1 -1
- package/components/Chip/Chip.js +3 -3
- package/components/Chip/ChipProvider/ChipProvider.d.ts +26 -0
- package/components/Chip/ChipProvider/ChipProvider.js +13 -0
- package/components/Chip/ChipProvider/index.d.ts +1 -0
- package/components/Chip/ChipProvider/index.js +1 -0
- package/components/Chip/index.d.ts +2 -1
- package/components/Chip/index.js +1 -0
- package/components/Chip/public.d.ts +2 -1
- package/components/Chip/public.js +1 -0
- package/components/Chip/styles.d.ts +7 -3
- package/components/Chip/styles.js +26 -2
- package/components/Chip/types.d.ts +21 -1
- package/components/Chip/useLogic/useLogic.d.ts +5 -4
- package/components/Chip/useLogic/useLogic.js +11 -3
- package/components/Counter/Counter.d.ts +5 -1
- package/components/Counter/Counter.js +1 -1
- package/components/Counter/types.d.ts +1 -1
- package/components/DashboardSidebarCounter/styles.d.ts +1 -0
- package/components/PageHeader/HeaderContent/FormFiltersProvider/FormFiltersProvider.d.ts +15 -0
- package/components/PageHeader/HeaderContent/FormFiltersProvider/FormFiltersProvider.js +8 -0
- package/components/PageHeader/HeaderContent/FormFiltersProvider/index.d.ts +1 -0
- package/components/PageHeader/HeaderContent/FormFiltersProvider/index.js +1 -0
- package/components/PageHeader/HeaderContent/HeaderContent.js +3 -2
- package/components/PageHeader/HeaderContent/index.d.ts +1 -0
- package/components/PageHeader/HeaderContent/index.js +1 -0
- package/components/PageHeader/HeaderContent/styles.d.ts +0 -4
- package/components/PageHeader/HeaderContent/styles.js +1 -10
- package/components/PageHeader/PageActions/PageActions.js +1 -1
- package/components/PageHeader/constants.d.ts +2 -0
- package/components/PageHeader/constants.js +2 -0
- package/components/PageHeader/index.d.ts +1 -0
- package/components/PageHeader/index.js +1 -0
- package/components/PageHeader/styles.js +25 -0
- package/components/TagBadge/styles.js +2 -1
- package/hook-form/FormFilters/AllFiltersButton/styles.d.ts +1 -0
- package/hook-form/FormFilters/AllFiltersButton/types.d.ts +1 -0
- package/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.d.ts +1 -1
- package/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.js +21 -5
- package/hook-form/FormFilters/FormFilters.js +7 -4
- package/hook-form/FormFilters/FormFiltersDialog/FormFiltersDialog.js +4 -4
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/ResetButton.d.ts +6 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/ResetButton.js +11 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/index.d.ts +1 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/index.js +1 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/styles.d.ts +14 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/styles.js +14 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/index.d.ts +1 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/index.js +1 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/useLogic.d.ts +6 -0
- package/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/useLogic.js +11 -0
- package/hook-form/FormFilters/FormFiltersDialog/styles.d.ts +1 -10
- package/hook-form/FormFilters/FormFiltersDialog/styles.js +1 -9
- package/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.d.ts +4 -2
- package/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.js +4 -5
- package/hook-form/FormFilters/FormFiltersSkeleton/FormFiltersSkeleton.js +4 -1
- package/hook-form/FormFilters/styles.d.ts +4 -0
- package/hook-form/FormFilters/styles.js +11 -2
- package/hook-form/FormFilters/types.d.ts +24 -4
- package/hook-form/FormFilters/useLogic/useLogic.d.ts +2 -1
- package/hook-form/FormFilters/useLogic/useLogic.js +13 -2
- package/hook-form/FormFilters/utils/checkIsFilledValue/checkIsFilledValue.d.ts +1 -0
- package/hook-form/FormFilters/utils/checkIsFilledValue/checkIsFilledValue.js +18 -0
- package/hook-form/FormFilters/utils/checkIsFilledValue/index.d.ts +1 -0
- package/hook-form/FormFilters/utils/checkIsFilledValue/index.js +1 -0
- package/hook-form/FormFilters/utils/getFilledCount/getFilledCount.d.ts +1 -0
- package/hook-form/FormFilters/utils/getFilledCount/getFilledCount.js +4 -0
- package/hook-form/FormFilters/utils/getFilledCount/index.d.ts +1 -0
- package/hook-form/FormFilters/utils/getFilledCount/index.js +1 -0
- package/hook-form/FormFilters/utils/index.d.ts +2 -0
- package/hook-form/FormFilters/utils/index.js +2 -0
- package/hook-form/FormQuickFilters/FormQuickFilters.d.ts +26 -0
- package/hook-form/FormQuickFilters/FormQuickFilters.js +46 -0
- package/hook-form/FormQuickFilters/constants.d.ts +6 -0
- package/hook-form/FormQuickFilters/constants.js +6 -0
- package/hook-form/FormQuickFilters/index.d.ts +2 -0
- package/hook-form/FormQuickFilters/index.js +1 -0
- package/hook-form/FormQuickFilters/public.d.ts +2 -0
- package/hook-form/FormQuickFilters/public.js +1 -0
- package/hook-form/FormQuickFilters/styles.d.ts +9 -0
- package/hook-form/FormQuickFilters/styles.js +16 -0
- package/hook-form/FormQuickFilters/types.d.ts +62 -0
- package/hook-form/FormQuickFilters/types.js +1 -0
- package/hook-form/FormQuickFilters/useLogic/useLogic.d.ts +18 -0
- package/hook-form/FormQuickFilters/useLogic/useLogic.js +59 -0
- package/hook-form/FormWizard/Footer/Footer.js +1 -1
- package/node/components/Badge/styles.js +5 -0
- package/node/components/Badge/types.d.ts +1 -1
- package/node/components/Chip/Chip.js +2 -2
- package/node/components/Chip/ChipProvider/ChipProvider.d.ts +26 -0
- package/node/components/Chip/ChipProvider/ChipProvider.js +17 -0
- package/node/components/Chip/ChipProvider/index.d.ts +1 -0
- package/node/components/Chip/ChipProvider/index.js +17 -0
- package/node/components/Chip/index.d.ts +2 -1
- package/node/components/Chip/index.js +3 -1
- package/node/components/Chip/public.d.ts +2 -1
- package/node/components/Chip/public.js +3 -1
- package/node/components/Chip/styles.d.ts +7 -3
- package/node/components/Chip/styles.js +27 -3
- package/node/components/Chip/types.d.ts +21 -1
- package/node/components/Chip/useLogic/useLogic.d.ts +5 -4
- package/node/components/Chip/useLogic/useLogic.js +10 -2
- package/node/components/Counter/Counter.d.ts +5 -1
- package/node/components/Counter/Counter.js +1 -1
- package/node/components/Counter/types.d.ts +1 -1
- package/node/components/DashboardSidebarCounter/styles.d.ts +1 -0
- package/node/components/PageHeader/HeaderContent/FormFiltersProvider/FormFiltersProvider.d.ts +15 -0
- package/node/components/PageHeader/HeaderContent/FormFiltersProvider/FormFiltersProvider.js +12 -0
- package/node/components/PageHeader/HeaderContent/FormFiltersProvider/index.d.ts +1 -0
- package/node/components/PageHeader/HeaderContent/FormFiltersProvider/index.js +6 -0
- package/node/components/PageHeader/HeaderContent/HeaderContent.js +2 -1
- package/node/components/PageHeader/HeaderContent/index.d.ts +1 -0
- package/node/components/PageHeader/HeaderContent/index.js +1 -0
- package/node/components/PageHeader/HeaderContent/styles.d.ts +0 -4
- package/node/components/PageHeader/HeaderContent/styles.js +2 -11
- package/node/components/PageHeader/PageActions/PageActions.js +1 -1
- package/node/components/PageHeader/constants.d.ts +2 -0
- package/node/components/PageHeader/constants.js +2 -0
- package/node/components/PageHeader/index.d.ts +1 -0
- package/node/components/PageHeader/index.js +3 -1
- package/node/components/PageHeader/styles.js +25 -0
- package/node/components/TagBadge/styles.js +2 -1
- package/node/hook-form/FormFilters/AllFiltersButton/styles.d.ts +1 -0
- package/node/hook-form/FormFilters/AllFiltersButton/types.d.ts +1 -0
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.d.ts +1 -1
- package/node/hook-form/FormFilters/AllFiltersButton/useLogic/useLogic.js +27 -11
- package/node/hook-form/FormFilters/FormFilters.js +5 -2
- package/node/hook-form/FormFilters/FormFiltersDialog/FormFiltersDialog.js +3 -3
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/ResetButton.d.ts +6 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/ResetButton.js +15 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/index.d.ts +1 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/index.js +17 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/styles.d.ts +14 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/styles.js +17 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/index.d.ts +1 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/index.js +17 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/useLogic.d.ts +6 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/ResetButton/useLogic/useLogic.js +15 -0
- package/node/hook-form/FormFilters/FormFiltersDialog/styles.d.ts +1 -10
- package/node/hook-form/FormFilters/FormFiltersDialog/styles.js +2 -10
- package/node/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.d.ts +4 -2
- package/node/hook-form/FormFilters/FormFiltersDialog/useLogic/useLogic.js +4 -5
- package/node/hook-form/FormFilters/FormFiltersSkeleton/FormFiltersSkeleton.js +4 -1
- package/node/hook-form/FormFilters/styles.d.ts +4 -0
- package/node/hook-form/FormFilters/styles.js +12 -3
- package/node/hook-form/FormFilters/types.d.ts +24 -4
- package/node/hook-form/FormFilters/useLogic/useLogic.d.ts +2 -1
- package/node/hook-form/FormFilters/useLogic/useLogic.js +12 -1
- package/node/hook-form/FormFilters/utils/checkIsFilledValue/checkIsFilledValue.d.ts +1 -0
- package/node/hook-form/FormFilters/utils/checkIsFilledValue/checkIsFilledValue.js +22 -0
- package/node/hook-form/FormFilters/utils/checkIsFilledValue/index.d.ts +1 -0
- package/node/hook-form/FormFilters/utils/checkIsFilledValue/index.js +5 -0
- package/node/hook-form/FormFilters/utils/getFilledCount/getFilledCount.d.ts +1 -0
- package/node/hook-form/FormFilters/utils/getFilledCount/getFilledCount.js +8 -0
- package/node/hook-form/FormFilters/utils/getFilledCount/index.d.ts +1 -0
- package/node/hook-form/FormFilters/utils/getFilledCount/index.js +5 -0
- package/node/hook-form/FormFilters/utils/index.d.ts +2 -0
- package/node/hook-form/FormFilters/utils/index.js +7 -0
- package/node/hook-form/FormQuickFilters/FormQuickFilters.d.ts +26 -0
- package/node/hook-form/FormQuickFilters/FormQuickFilters.js +50 -0
- package/node/hook-form/FormQuickFilters/constants.d.ts +6 -0
- package/node/hook-form/FormQuickFilters/constants.js +9 -0
- package/node/hook-form/FormQuickFilters/index.d.ts +2 -0
- package/node/hook-form/FormQuickFilters/index.js +5 -0
- package/node/hook-form/FormQuickFilters/public.d.ts +2 -0
- package/node/hook-form/FormQuickFilters/public.js +5 -0
- package/node/hook-form/FormQuickFilters/styles.d.ts +9 -0
- package/node/hook-form/FormQuickFilters/styles.js +19 -0
- package/node/hook-form/FormQuickFilters/types.d.ts +62 -0
- package/node/hook-form/FormQuickFilters/types.js +2 -0
- package/node/hook-form/FormQuickFilters/useLogic/useLogic.d.ts +18 -0
- package/node/hook-form/FormQuickFilters/useLogic/useLogic.js +63 -0
- package/node/hook-form/FormWizard/Footer/Footer.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DesktopTitleWrapper = exports.
|
|
3
|
+
exports.DesktopTitleWrapper = exports.PageSubheader = exports.BreadcrumbsWrapper = void 0;
|
|
4
4
|
const styled_1 = require("../../styled");
|
|
5
5
|
exports.BreadcrumbsWrapper = styled_1.styled.div `
|
|
6
6
|
grid-column: 2;
|
|
@@ -14,7 +14,7 @@ exports.BreadcrumbsWrapper = styled_1.styled.div `
|
|
|
14
14
|
`;
|
|
15
15
|
exports.PageSubheader = styled_1.styled.div `
|
|
16
16
|
grid-column: 1 / -1;
|
|
17
|
-
grid-row:
|
|
17
|
+
grid-row: 6;
|
|
18
18
|
|
|
19
19
|
padding-top: ${({ theme }) => theme.spacing(4)};
|
|
20
20
|
|
|
@@ -22,15 +22,6 @@ exports.PageSubheader = styled_1.styled.div `
|
|
|
22
22
|
padding: ${({ theme }) => theme.spacing(0, 4, 4, 4)};
|
|
23
23
|
}
|
|
24
24
|
`;
|
|
25
|
-
exports.PageFilters = styled_1.styled.div `
|
|
26
|
-
grid-column: 1 / -1;
|
|
27
|
-
grid-row: 4;
|
|
28
|
-
|
|
29
|
-
${({ theme }) => theme.breakpoints.down('laptop')} {
|
|
30
|
-
grid-column: 3;
|
|
31
|
-
grid-row: 1 / 4;
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
25
|
exports.DesktopTitleWrapper = styled_1.styled.div `
|
|
35
26
|
display: contents;
|
|
36
27
|
|
|
@@ -18,6 +18,6 @@ const PageActionsInner = (props, ref) => {
|
|
|
18
18
|
if (isLoading) {
|
|
19
19
|
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { children: (0, jsx_runtime_1.jsx)(PageActionSkeleton_1.PageActionSkeleton, { size: size }) }));
|
|
20
20
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, ref: ref, children: (0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { "$spacing": spacing, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: (0, jsx_runtime_1.jsx)(styles_1.FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? (0, jsx_runtime_1.jsx)(MinimizeOutlineMd_1.MinimizeOutlineMd, {}) : (0, jsx_runtime_1.jsx)(FullSizeOutlineMd_1.FullSizeOutlineMd, {}) }) }), (0, jsx_runtime_1.jsx)(styles_1.MainActionsWrapper, { "$spacing": spacing, className: classnames, children: (0, jsx_runtime_1.jsx)(MainActions_1.MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing }) }), (0, jsx_runtime_1.jsxs)(styles_1.SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(SecondaryVisibleActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: size })), secondary && ((0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] }), collapsedActions.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.CollapsedActionsWrapper, { className: classnames, children: (0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.Wrapper, { className: className, ref: ref, children: (0, jsx_runtime_1.jsxs)(styles_1.ActionWrapper, { "$spacing": spacing, children: [(0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { title: tooltipTitle, enterDelay: 400, enterNextDelay: 400, placement: "bottom-end", children: (0, jsx_runtime_1.jsx)(styles_1.FocusModeButton, { className: buttonClassnames, variant: "outlined", onClick: handleClick, "aria-label": tooltipTitle, color: "grey", children: isFocusedMode ? (0, jsx_runtime_1.jsx)(MinimizeOutlineMd_1.MinimizeOutlineMd, {}) : (0, jsx_runtime_1.jsx)(FullSizeOutlineMd_1.FullSizeOutlineMd, {}) }) }), (0, jsx_runtime_1.jsx)(styles_1.MainActionsWrapper, { "$spacing": spacing, className: classnames, children: (0, jsx_runtime_1.jsx)(MainActions_1.MainActions, { isDisabled: disabledAction, actions: main, size: size, spacing: spacing }) }), (secondaryVisible || secondary) && ((0, jsx_runtime_1.jsxs)(styles_1.SecondaryVisibleWrapper, { "$spacing": spacing, className: classnames, children: [secondaryVisible && ((0, jsx_runtime_1.jsx)(SecondaryVisibleActions_1.SecondaryVisibleActions, { actions: secondaryVisible, size: size })), secondary && ((0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: secondary, size: size }))] })), collapsedActions.length > 0 && ((0, jsx_runtime_1.jsx)(styles_1.CollapsedActionsWrapper, { className: classnames, children: (0, jsx_runtime_1.jsx)(SecondaryActions_1.SecondaryActions, { isDisabled: disabledAction, actions: collapsedActions, size: size }) }))] }) }));
|
|
22
22
|
};
|
|
23
23
|
exports.PageActions = (0, forwardRefWithGeneric_1.forwardRefWithGeneric)(PageActionsInner);
|
|
@@ -7,5 +7,7 @@ exports.pageHeaderClassnames = {
|
|
|
7
7
|
pageHeaderActions: (0, createUIKitClassname_1.createUIKitClassname)('page-header__actions'),
|
|
8
8
|
hasBackButton: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-back-button'),
|
|
9
9
|
hasTitle: (0, createUIKitClassname_1.createUIKitClassname)('page-header_has-title'),
|
|
10
|
+
filters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__filters'),
|
|
11
|
+
quickFilters: (0, createUIKitClassname_1.createUIKitClassname)('page-header__quick-filters'),
|
|
10
12
|
};
|
|
11
13
|
exports.PAGE_HEADER_HEIGHT_MOBILE = '48px';
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.PageActions = exports.PageActionSkeleton = exports.pageHeaderClassnames = void 0;
|
|
17
|
+
exports.FormFiltersLayoutContext = exports.PageActions = exports.PageActionSkeleton = exports.pageHeaderClassnames = void 0;
|
|
18
18
|
var constants_1 = require("./constants");
|
|
19
19
|
Object.defineProperty(exports, "pageHeaderClassnames", { enumerable: true, get: function () { return constants_1.pageHeaderClassnames; } });
|
|
20
20
|
var PageActions_1 = require("./PageActions");
|
|
@@ -22,3 +22,5 @@ Object.defineProperty(exports, "PageActionSkeleton", { enumerable: true, get: fu
|
|
|
22
22
|
Object.defineProperty(exports, "PageActions", { enumerable: true, get: function () { return PageActions_1.PageActions; } });
|
|
23
23
|
__exportStar(require("./PageHeader"), exports);
|
|
24
24
|
__exportStar(require("./types"), exports);
|
|
25
|
+
var HeaderContent_1 = require("./HeaderContent");
|
|
26
|
+
Object.defineProperty(exports, "FormFiltersLayoutContext", { enumerable: true, get: function () { return HeaderContent_1.FormFiltersLayoutContext; } });
|
|
@@ -25,6 +25,31 @@ exports.Wrapper = styled_1.styled.header `
|
|
|
25
25
|
|
|
26
26
|
background-color: ${({ theme }) => theme.palette.background.default};
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
.${constants_1.pageHeaderClassnames.filters} {
|
|
30
|
+
grid-column: 1 / -1;
|
|
31
|
+
grid-row: 4;
|
|
32
|
+
|
|
33
|
+
${({ theme }) => theme.breakpoints.down('laptop')} {
|
|
34
|
+
grid-column: 3;
|
|
35
|
+
grid-row: 1 / -1;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.${constants_1.pageHeaderClassnames.quickFilters} {
|
|
40
|
+
grid-column: 1 / -1;
|
|
41
|
+
grid-row: 5;
|
|
42
|
+
|
|
43
|
+
margin-top: ${({ theme }) => theme.spacing(4)};
|
|
44
|
+
|
|
45
|
+
${({ theme }) => theme.breakpoints.down('laptop')} {
|
|
46
|
+
margin-top: ${({ theme }) => theme.spacing(3)};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
50
|
+
display: none;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
28
53
|
`;
|
|
29
54
|
exports.MobileTitleWrapper = styled_1.styled.div `
|
|
30
55
|
display: none;
|
|
@@ -14,6 +14,7 @@ const getBadgeBgColor = ({ color, theme, variant, }) => {
|
|
|
14
14
|
warning: theme.palette.warning[800],
|
|
15
15
|
error: theme.palette.error[800],
|
|
16
16
|
white: theme.palette.grey[300],
|
|
17
|
+
transparent: 'transparent',
|
|
17
18
|
};
|
|
18
19
|
return bgColor[color];
|
|
19
20
|
};
|
|
@@ -27,7 +28,7 @@ const getBadgeColor = ({ color, theme, variant, isChecked, isDisabled, }) => {
|
|
|
27
28
|
if (color === 'white') {
|
|
28
29
|
return theme.palette.grey[900];
|
|
29
30
|
}
|
|
30
|
-
if (color === 'grey') {
|
|
31
|
+
if (color === 'grey' || color === 'transparent') {
|
|
31
32
|
return variant === 'text'
|
|
32
33
|
? theme.palette.primary.contrastText
|
|
33
34
|
: theme.palette.grey[900];
|
|
@@ -17,6 +17,7 @@ export declare const StyledCounter: import("@emotion/styled/dist/declarations/sr
|
|
|
17
17
|
color: import("../../../components/Counter/types").CounterColor;
|
|
18
18
|
variant?: import("../../../components/Counter/types").CounterVariants | undefined;
|
|
19
19
|
content?: number | undefined;
|
|
20
|
+
withBorder?: boolean | undefined;
|
|
20
21
|
} & {
|
|
21
22
|
theme?: import("@emotion/react").Theme | undefined;
|
|
22
23
|
}, {}, {}>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AllFiltersButtonProps } from '../types';
|
|
2
|
-
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({ form, onOpenModal, hasMainFilters, hasSecondaryFilters, hasSearch, }: AllFiltersButtonProps<TFieldValues>) => {
|
|
2
|
+
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({ form, onOpenModal, hasMainFilters, hasSecondaryFilters, hasSearch, hasQuickFilters, }: AllFiltersButtonProps<TFieldValues>) => {
|
|
3
3
|
allFiltersButtonClassName: string;
|
|
4
4
|
counter: number;
|
|
5
5
|
onOpenModal: () => void;
|
|
@@ -3,35 +3,51 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
+
const useViewportType_1 = require("../../../../components/useViewportType");
|
|
6
7
|
const classNames_1 = require("../../../../components/utils/classNames");
|
|
7
8
|
const constants_1 = require("../../../FormFiltersSearchField/constants");
|
|
8
|
-
const constants_2 = require("
|
|
9
|
-
const
|
|
9
|
+
const constants_2 = require("../../../FormQuickFilters/constants");
|
|
10
|
+
const constants_3 = require("../../constants");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const useLogic = ({ form, onOpenModal, hasMainFilters, hasSecondaryFilters, hasSearch, hasQuickFilters, }) => {
|
|
13
|
+
const { isMobile } = (0, useViewportType_1.useViewportType)();
|
|
10
14
|
const formValues = (0, react_hook_form_1.useWatch)({
|
|
11
15
|
control: form.control,
|
|
12
16
|
});
|
|
13
17
|
const [searchName, setSearchName] = (0, react_1.useState)('');
|
|
18
|
+
const [quickFiltersName, setQuickFiltersName] = (0, react_1.useState)('');
|
|
14
19
|
(0, react_1.useEffect)(() => {
|
|
15
20
|
const searchFieldName = document
|
|
16
21
|
.getElementById(constants_1.FORM_FILTERS_SEARCH_FIELD_ID)
|
|
17
22
|
?.getAttribute('name') || '';
|
|
18
23
|
setSearchName(searchFieldName);
|
|
19
24
|
}, [hasSearch]);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
const quickFiltersFieldName = document
|
|
27
|
+
.getElementById(constants_2.FORM_FILTERS_QUICK_FILTERS_ID)
|
|
28
|
+
?.getAttribute('name') || '';
|
|
29
|
+
setQuickFiltersName(quickFiltersFieldName);
|
|
30
|
+
}, [hasQuickFilters]);
|
|
31
|
+
const getCounter = () => {
|
|
32
|
+
const filledValuesCount = (0, utils_1.getFilledCount)(formValues);
|
|
33
|
+
// Исключаем поиск и quickFilters из счётчика — они видны на странице
|
|
34
|
+
// quickFilters учитывается только на мобильных устройствах
|
|
35
|
+
const searchValue = formValues?.[searchName];
|
|
36
|
+
const quickFiltersValue = !isMobile && (0, utils_1.checkIsFilledValue)(formValues?.[quickFiltersName]);
|
|
37
|
+
return (filledValuesCount - (searchValue ? 1 : 0) - (quickFiltersValue ? 1 : 0));
|
|
38
|
+
};
|
|
23
39
|
const allFiltersButtonClassName = (0, react_1.useMemo)(() => {
|
|
24
40
|
return (0, classNames_1.classNames)({
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[
|
|
41
|
+
[constants_3.formFiltersClassnames.showAllFiltersButtonOnDesktop]: hasSecondaryFilters,
|
|
42
|
+
[constants_3.formFiltersClassnames.showAllFiltersButtonOnLaptop]: hasMainFilters || hasSecondaryFilters,
|
|
43
|
+
[constants_3.formFiltersClassnames.showAllFiltersButtonOnMobile]: hasMainFilters || hasSecondaryFilters,
|
|
44
|
+
[constants_3.formFiltersClassnames.withSearch]: hasSearch,
|
|
45
|
+
[constants_3.formFiltersClassnames.withoutSearch]: !hasSearch,
|
|
30
46
|
});
|
|
31
47
|
}, [hasMainFilters, hasSecondaryFilters, hasSearch]);
|
|
32
48
|
return {
|
|
33
49
|
allFiltersButtonClassName,
|
|
34
|
-
counter,
|
|
50
|
+
counter: getCounter(),
|
|
35
51
|
onOpenModal,
|
|
36
52
|
};
|
|
37
53
|
};
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormFilters = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const PageHeader_1 = require("../../components/PageHeader");
|
|
5
7
|
const Form_1 = require("../Form");
|
|
6
8
|
const FormControlProvider_1 = require("../FormControlProvider");
|
|
7
9
|
const AllFiltersButton_1 = require("./AllFiltersButton");
|
|
@@ -14,10 +16,11 @@ const useLogic_1 = require("./useLogic");
|
|
|
14
16
|
* Компонент для отображения фильтров формы
|
|
15
17
|
*/
|
|
16
18
|
const FormFilters = (props) => {
|
|
17
|
-
const { form, onSubmit, searchField: SearchField, mainFilters: MainFilters, submitButton: SubmitButton, secondaryFilters: SecondaryFilters, onOpenModal, dialogProps, mainFiltersColumns, isLoading, } = (0, useLogic_1.useLogic)(props);
|
|
19
|
+
const { form, onSubmit, searchField: SearchField, mainFilters: MainFilters, quickFilters: QuickFilters, submitButton: SubmitButton, secondaryFilters: SecondaryFilters, onOpenModal, dialogProps, mainFiltersColumns, isLoading, } = (0, useLogic_1.useLogic)(props);
|
|
20
|
+
const { filtersClassName, quickFiltersClassName } = (0, react_1.useContext)(PageHeader_1.FormFiltersLayoutContext) ?? {};
|
|
18
21
|
if (isLoading) {
|
|
19
22
|
return (0, jsx_runtime_1.jsx)(FormFiltersSkeleton_1.FormFiltersSkeleton, {});
|
|
20
23
|
}
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)(Form_1.Form, { name: "form", form: form, onSubmit: form.handleSubmit(onSubmit || (() => undefined)),
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FormControlProvider_1.FormControlProvider, { size: "small", hideHelperText: true, children: (0, jsx_runtime_1.jsx)(Form_1.Form, { name: "astral-ui-form-filters", form: form, onSubmit: form.handleSubmit(onSubmit || (() => undefined)), className: filtersClassName, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { children: [SearchField && (0, jsx_runtime_1.jsx)(SearchField, { control: form.control }), (0, jsx_runtime_1.jsx)(AllFiltersButton_1.AllFiltersButton, { form: form, onOpenModal: onOpenModal, hasMainFilters: Boolean(MainFilters), hasSecondaryFilters: Boolean(SecondaryFilters), hasSearch: Boolean(SearchField), hasQuickFilters: Boolean(QuickFilters) }), (0, jsx_runtime_1.jsx)(styles_1.MainFiltersWrapper, { columns: mainFiltersColumns, children: MainFilters && ((0, jsx_runtime_1.jsx)(MainFilters, { control: form.control, isModal: false })) }), SubmitButton && ((0, jsx_runtime_1.jsx)(styles_1.SubmitButtonWrapper, { children: (0, jsx_runtime_1.jsx)(SubmitButton, { size: "medium", className: constants_1.formFiltersClassnames.submitButton }) }))] }) }) }), QuickFilters && ((0, jsx_runtime_1.jsx)(styles_1.QuickFiltersWrapper, { className: quickFiltersClassName, children: (0, jsx_runtime_1.jsx)(QuickFilters, { control: form.control }) })), (0, jsx_runtime_1.jsx)(FormFiltersDialog_1.FormFiltersDialog, { ...dialogProps })] }));
|
|
22
25
|
};
|
|
23
26
|
exports.FormFilters = FormFilters;
|
|
@@ -6,14 +6,14 @@ const Button_1 = require("../../../components/Button");
|
|
|
6
6
|
const DialogContent_1 = require("../../../components/DialogContent");
|
|
7
7
|
const Form_1 = require("../../Form");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
|
+
const ResetButton_1 = require("./ResetButton");
|
|
9
10
|
const styles_1 = require("./styles");
|
|
10
11
|
const useLogic_1 = require("./useLogic");
|
|
11
12
|
/**
|
|
12
13
|
* Компонент для отображения фильтров формы
|
|
13
14
|
*/
|
|
14
15
|
const FormFiltersDialog = (props) => {
|
|
15
|
-
const { modalForm, onCloseModal, onResetModal, onSubmitModal, mainFilters: MainFilters, secondaryFilters: SecondaryFilters, isModalOpen,
|
|
16
|
-
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(styles_1.StyledDialog, { open: isModalOpen, onClose: onCloseModal, title: "\u0424\u0438\u043B\u044C\u0442\u0440\u044B", size: "md", headerContent: headerContent, children: (0, jsx_runtime_1.jsxs)(Form_1.Form, { form: modalForm, onSubmit: modalForm.handleSubmit(onSubmitModal), children: [(0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)(styles_1.FiltersModalContent, { className: constants_1.formFiltersClassnames.modalFilters, children: [MainFilters && ((0, jsx_runtime_1.jsx)(MainFilters, { control: modalForm.control, isModal: true })), SecondaryFilters && ((0, jsx_runtime_1.jsx)(SecondaryFilters, { control: modalForm.control }))] }) }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { children: [(0, jsx_runtime_1.jsx)(styles_1.DesktopResetButton, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", onClick: onResetModal, size: "large", disabled: isResetButtonDisabled, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C" }) }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", onClick: onCloseModal, size: "large", children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "submit", variant: "contained", size: "large", children: "\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C" })] })] }) }));
|
|
16
|
+
const { modalForm, onCloseModal, onResetModal, onSubmitModal, mainFilters: MainFilters, quickFilters: QuickFilters, secondaryFilters: SecondaryFilters, isModalOpen, } = (0, useLogic_1.useLogic)(props);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.StyledDialog, { open: isModalOpen, onClose: onCloseModal, title: "\u0424\u0438\u043B\u044C\u0442\u0440\u044B", size: "md", headerContent: (0, jsx_runtime_1.jsx)(ResetButton_1.ResetButton, { onResetModal: onResetModal, modalForm: modalForm, isMobile: true }), children: (0, jsx_runtime_1.jsxs)(Form_1.Form, { form: modalForm, onSubmit: modalForm.handleSubmit(onSubmitModal), children: [(0, jsx_runtime_1.jsx)(DialogContent_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)(styles_1.FiltersModalContent, { className: constants_1.formFiltersClassnames.modalFilters, children: [MainFilters && ((0, jsx_runtime_1.jsx)(MainFilters, { control: modalForm.control, isModal: true })), SecondaryFilters && ((0, jsx_runtime_1.jsx)(SecondaryFilters, { control: modalForm.control })), QuickFilters && ((0, jsx_runtime_1.jsx)(styles_1.QuickFiltersWrapper, { children: (0, jsx_runtime_1.jsx)(QuickFilters, { control: modalForm.control }) }))] }) }), (0, jsx_runtime_1.jsxs)(styles_1.StyledDialogContent, { children: [(0, jsx_runtime_1.jsx)(ResetButton_1.ResetButton, { onResetModal: onResetModal, modalForm: modalForm }), (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", onClick: onCloseModal, size: "large", children: "\u041E\u0442\u043C\u0435\u043D\u0430" }), (0, jsx_runtime_1.jsx)(Button_1.Button, { type: "submit", variant: "contained", size: "large", children: "\u041F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C" })] })] }) }));
|
|
18
18
|
};
|
|
19
19
|
exports.FormFiltersDialog = FormFiltersDialog;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type UseFormReturn } from 'react-hook-form';
|
|
2
|
+
export declare const ResetButton: <TFieldValues extends Record<string, unknown>>({ onResetModal, modalForm, isMobile, }: {
|
|
3
|
+
onResetModal: () => void;
|
|
4
|
+
modalForm: UseFormReturn<TFieldValues>;
|
|
5
|
+
isMobile?: boolean | undefined;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ResetButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Button_1 = require("../../../../components/Button");
|
|
6
|
+
const styles_1 = require("./styles");
|
|
7
|
+
const useLogic_1 = require("./useLogic");
|
|
8
|
+
const ResetButton = ({ onResetModal, modalForm, isMobile = false, }) => {
|
|
9
|
+
const { isResetButtonDisabled } = (0, useLogic_1.useLogic)({ modalForm });
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.MobileResetButtonWrapper, { variant: "text", onClick: onResetModal, size: "large", disabled: isResetButtonDisabled, children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C" }));
|
|
12
|
+
}
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.DesktopResetButtonWrapper, { children: (0, jsx_runtime_1.jsx)(Button_1.Button, { variant: "text", onClick: onResetModal, size: "large", disabled: isResetButtonDisabled, color: "error", children: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C" }) }));
|
|
14
|
+
};
|
|
15
|
+
exports.ResetButton = ResetButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ResetButton';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ResetButton"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const MobileResetButtonWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<Omit<import("../../../..").WithoutEmotionSpecific<import("@mui/material").ButtonProps>, "color" | "component" | "variant" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple"> & {
|
|
3
|
+
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
4
|
+
loading?: boolean | undefined;
|
|
5
|
+
color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
|
|
6
|
+
component?: import("react").ElementType | undefined;
|
|
7
|
+
selected?: boolean | undefined;
|
|
8
|
+
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
9
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
10
|
+
}, {}, {}>;
|
|
11
|
+
export declare const DesktopResetButtonWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
12
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
13
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
14
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DesktopResetButtonWrapper = exports.MobileResetButtonWrapper = void 0;
|
|
4
|
+
const Button_1 = require("../../../../components/Button");
|
|
5
|
+
const styled_1 = require("../../../../components/styled");
|
|
6
|
+
exports.MobileResetButtonWrapper = (0, styled_1.styled)(Button_1.Button) `
|
|
7
|
+
margin-left: auto;
|
|
8
|
+
|
|
9
|
+
${({ theme }) => theme.breakpoints.up('sm')} {
|
|
10
|
+
display: none;
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
exports.DesktopResetButtonWrapper = styled_1.styled.div `
|
|
14
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
15
|
+
display: none;
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useLogic"), exports);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLogic = void 0;
|
|
4
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
5
|
+
const utils_1 = require("../../../utils");
|
|
6
|
+
const useLogic = ({ modalForm, }) => {
|
|
7
|
+
const formValues = (0, react_hook_form_1.useWatch)({
|
|
8
|
+
control: modalForm.control,
|
|
9
|
+
});
|
|
10
|
+
const isResetButtonDisabled = (0, utils_1.getFilledCount)(formValues) === 0;
|
|
11
|
+
return {
|
|
12
|
+
isResetButtonDisabled,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.useLogic = useLogic;
|
|
@@ -3,16 +3,7 @@ export declare const FiltersModalContent: import("@emotion/styled/dist/declarati
|
|
|
3
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
4
4
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
5
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
6
|
-
export declare const
|
|
7
|
-
variant?: "light" | "link" | "text" | "contained" | "outlined" | undefined;
|
|
8
|
-
loading?: boolean | undefined;
|
|
9
|
-
color?: "primary" | "success" | "warning" | "error" | "grey" | undefined;
|
|
10
|
-
component?: import("react").ElementType | undefined;
|
|
11
|
-
selected?: boolean | undefined;
|
|
12
|
-
} & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, ""> & import("react").RefAttributes<HTMLButtonElement> & {
|
|
13
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
14
|
-
}, {}, {}>;
|
|
15
|
-
export declare const DesktopResetButton: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
6
|
+
export declare const QuickFiltersWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
16
7
|
theme?: import("@emotion/react").Theme | undefined;
|
|
17
8
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
18
9
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StyledDialogContent = exports.StyledDialog = exports.
|
|
3
|
+
exports.StyledDialogContent = exports.StyledDialog = exports.QuickFiltersWrapper = exports.FiltersModalContent = void 0;
|
|
4
4
|
const Dialog_1 = require("@mui/material/Dialog");
|
|
5
|
-
const Button_1 = require("../../../components/Button");
|
|
6
5
|
const Dialog_2 = require("../../../components/Dialog");
|
|
7
6
|
const DialogActions_1 = require("../../../components/DialogActions");
|
|
8
7
|
const styled_1 = require("../../../components/styled");
|
|
9
8
|
exports.FiltersModalContent = styled_1.styled.div `
|
|
10
9
|
display: grid;
|
|
11
10
|
`;
|
|
12
|
-
exports.
|
|
13
|
-
margin-left: auto;
|
|
14
|
-
|
|
11
|
+
exports.QuickFiltersWrapper = styled_1.styled.div `
|
|
15
12
|
${({ theme }) => theme.breakpoints.up('sm')} {
|
|
16
13
|
display: none;
|
|
17
14
|
}
|
|
18
15
|
`;
|
|
19
|
-
exports.DesktopResetButton = styled_1.styled.div `
|
|
20
|
-
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
21
|
-
display: none;
|
|
22
|
-
}
|
|
23
|
-
`;
|
|
24
16
|
exports.StyledDialog = (0, styled_1.styled)(Dialog_2.Dialog) `
|
|
25
17
|
.${Dialog_1.dialogClasses.paper} {
|
|
26
18
|
min-width: 500px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { type FormFiltersDialogProps } from '../types';
|
|
3
|
-
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({ validationSchema, mainFilters, secondaryFilters, isModalOpen, setIsModalOpen, onSubmit, form, }: FormFiltersDialogProps<TFieldValues>) => {
|
|
3
|
+
export declare const useLogic: <TFieldValues extends Record<string, unknown>>({ validationSchema, defaultValues, mainFilters, quickFilters, secondaryFilters, isModalOpen, setIsModalOpen, onSubmit, form, }: FormFiltersDialogProps<TFieldValues>) => {
|
|
4
4
|
modalForm: import("react-hook-form").UseFormReturn<TFieldValues, any>;
|
|
5
5
|
onCloseModal: () => void;
|
|
6
6
|
onResetModal: () => void;
|
|
@@ -10,9 +10,11 @@ export declare const useLogic: <TFieldValues extends Record<string, unknown>>({
|
|
|
10
10
|
} & {
|
|
11
11
|
isModal?: boolean | undefined;
|
|
12
12
|
}) => import("react").ReactNode) | undefined;
|
|
13
|
+
quickFilters: ((props: Pick<{
|
|
14
|
+
control: import("react-hook-form").Control<TFieldValues>;
|
|
15
|
+
}, "control">) => import("react").ReactNode) | undefined;
|
|
13
16
|
secondaryFilters: ((props: {
|
|
14
17
|
control: import("react-hook-form").Control<TFieldValues>;
|
|
15
18
|
}) => import("react").ReactNode) | undefined;
|
|
16
19
|
isModalOpen: boolean;
|
|
17
|
-
isResetButtonDisabled: boolean;
|
|
18
20
|
};
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLogic = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const useForm_1 = require("../../../useForm");
|
|
6
|
-
const useLogic = ({ validationSchema, mainFilters, secondaryFilters, isModalOpen, setIsModalOpen, onSubmit, form, }) => {
|
|
6
|
+
const useLogic = ({ validationSchema, defaultValues, mainFilters, quickFilters, secondaryFilters, isModalOpen, setIsModalOpen, onSubmit, form, }) => {
|
|
7
7
|
const modalForm = (0, useForm_1.useForm)({
|
|
8
8
|
validationSchema,
|
|
9
9
|
defaultValues: form.getValues(),
|
|
@@ -13,16 +13,15 @@ const useLogic = ({ validationSchema, mainFilters, secondaryFilters, isModalOpen
|
|
|
13
13
|
modalForm.reset();
|
|
14
14
|
};
|
|
15
15
|
const onResetModal = () => {
|
|
16
|
-
modalForm.reset(
|
|
16
|
+
modalForm.reset(defaultValues);
|
|
17
17
|
};
|
|
18
18
|
const onSubmitModal = (submittedValues) => {
|
|
19
19
|
onSubmit(submittedValues);
|
|
20
20
|
setIsModalOpen(false);
|
|
21
21
|
};
|
|
22
|
-
const isResetButtonDisabled = !modalForm.formState.isDirty;
|
|
23
22
|
(0, react_1.useEffect)(() => {
|
|
24
23
|
if (isModalOpen) {
|
|
25
|
-
|
|
24
|
+
modalForm.reset(form.getValues());
|
|
26
25
|
}
|
|
27
26
|
}, [isModalOpen]);
|
|
28
27
|
return {
|
|
@@ -31,9 +30,9 @@ const useLogic = ({ validationSchema, mainFilters, secondaryFilters, isModalOpen
|
|
|
31
30
|
onResetModal,
|
|
32
31
|
onSubmitModal,
|
|
33
32
|
mainFilters,
|
|
33
|
+
quickFilters,
|
|
34
34
|
secondaryFilters,
|
|
35
35
|
isModalOpen,
|
|
36
|
-
isResetButtonDisabled,
|
|
37
36
|
};
|
|
38
37
|
};
|
|
39
38
|
exports.useLogic = useLogic;
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FormFiltersSkeleton = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const PageHeader_1 = require("../../../components/PageHeader");
|
|
5
7
|
const Skeleton_1 = require("../../../components/Skeleton");
|
|
6
8
|
const styles_1 = require("./styles");
|
|
7
9
|
const FormFiltersSkeleton = () => {
|
|
8
|
-
|
|
10
|
+
const { filtersClassName } = (0, react_1.useContext)(PageHeader_1.FormFiltersLayoutContext) ?? {};
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.SkeletonWrapper, { className: filtersClassName, children: [(0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { variant: "rounded" }), (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { variant: "rounded" }), (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { variant: "rounded" }), (0, jsx_runtime_1.jsx)(Skeleton_1.Skeleton, { variant: "rounded" })] }));
|
|
9
12
|
};
|
|
10
13
|
exports.FormFiltersSkeleton = FormFiltersSkeleton;
|
|
@@ -13,3 +13,7 @@ export declare const SubmitButtonWrapper: import("@emotion/styled/dist/declarati
|
|
|
13
13
|
theme?: import("@emotion/react").Theme | undefined;
|
|
14
14
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
15
15
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
16
|
+
export declare const QuickFiltersWrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
17
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
18
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
19
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SubmitButtonWrapper = exports.MainFiltersWrapper = exports.Wrapper = void 0;
|
|
3
|
+
exports.QuickFiltersWrapper = exports.SubmitButtonWrapper = exports.MainFiltersWrapper = exports.Wrapper = void 0;
|
|
4
4
|
const FormLabel_1 = require("@mui/material/FormLabel");
|
|
5
5
|
const InputBase_1 = require("@mui/material/InputBase");
|
|
6
6
|
const styled_1 = require("../../components/styled");
|
|
@@ -10,13 +10,13 @@ exports.Wrapper = styled_1.styled.div `
|
|
|
10
10
|
gap: ${({ theme }) => theme.spacing(2)};
|
|
11
11
|
justify-content: space-between;
|
|
12
12
|
|
|
13
|
-
width: 100%;
|
|
13
|
+
width: 100%;
|
|
14
14
|
margin-top: ${({ theme }) => theme.spacing(4)};
|
|
15
15
|
|
|
16
16
|
.${FormLabel_1.formLabelClasses.root} {
|
|
17
17
|
display: none;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
|
|
20
20
|
${({ theme }) => theme.breakpoints.down('laptop')} {
|
|
21
21
|
margin-top: 0;
|
|
22
22
|
padding-right: ${({ theme }) => theme.spacing(2)};
|
|
@@ -55,3 +55,12 @@ exports.SubmitButtonWrapper = styled_1.styled.div `
|
|
|
55
55
|
display: none;
|
|
56
56
|
}
|
|
57
57
|
`;
|
|
58
|
+
exports.QuickFiltersWrapper = styled_1.styled.div `
|
|
59
|
+
display: flex;
|
|
60
|
+
|
|
61
|
+
width: 100%;
|
|
62
|
+
|
|
63
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
64
|
+
display: none;
|
|
65
|
+
}
|
|
66
|
+
`;
|