@ozen-ui/kit 0.72.1 → 0.74.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/__inner__/cjs/components/Autocomplete/helper.d.ts +1 -1
- package/__inner__/cjs/components/AutocompleteBase/hooks/useAutocompleteBaseInputEvents/useAutocompleteBaseInputEvents.js +13 -0
- package/__inner__/cjs/components/AutocompleteBase/modules/AutocompleteBaseDropdown/constants.d.ts +1 -1
- package/__inner__/cjs/components/AutocompleteBase/modules/AutocompleteBaseInput/AutocompleteBaseInput.css +11 -14
- package/__inner__/cjs/components/AutocompleteBase/modules/AutocompleteBaseInput/components/AutocompleteBaseInputMultiple/AutocompleteBaseInputMultiple.js +4 -5
- package/__inner__/cjs/components/AutocompleteNext/Autocomplete.js +14 -0
- package/__inner__/cjs/components/AutocompleteNext/components/AutocompleteInput/AutocompleteInput.js +1 -1
- package/__inner__/cjs/components/AutocompleteNext/types.d.ts +7 -6
- package/__inner__/cjs/components/Card/types.d.ts +2 -1
- package/__inner__/cjs/components/DatePicker/components/DatePickerModeDateRange/DatePickerModeDateRange.js +5 -1
- package/__inner__/cjs/components/DatePicker/types.d.ts +1 -1
- package/__inner__/cjs/components/Grid/Grid.d.ts +2 -1
- package/__inner__/cjs/components/Grid/GridItem.d.ts +2 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/b-business-dark/color-b-business-dark.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/b-business-default/color-b-business-default.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/ozen-dark/color-ozen-dark.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/ozen-default/color-ozen-default.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/vip-dark/color-vip-dark.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/color/vip-default/color-vip-default.css +1 -1
- package/__inner__/cjs/components/OzenProvider/providers/theme/tokens/shadow/ozen-default/shadow-ozen-default.css +1 -1
- package/__inner__/cjs/components/Popover/types.d.ts +1 -1
- package/__inner__/cjs/components/SectionMessage/SectionMessage.css +6 -0
- package/__inner__/cjs/components/SectionMessage/SectionMessage.js +8 -5
- package/__inner__/cjs/components/SectionMessage/config.d.ts +2 -3
- package/__inner__/cjs/components/SectionMessage/config.js +6 -22
- package/__inner__/cjs/components/SectionMessage/constants.d.ts +3 -0
- package/__inner__/cjs/components/SectionMessage/constants.js +7 -1
- package/__inner__/cjs/components/SectionMessage/types.d.ts +6 -1
- package/__inner__/cjs/components/SectionMessage/types.js +1 -0
- package/__inner__/cjs/components/Table/Table.css +8 -0
- package/__inner__/cjs/components/Table/Table.js +2 -2
- package/__inner__/cjs/components/Table/components/TableBody/TableBody.js +2 -1
- package/__inner__/cjs/components/Table/components/TableContainer/types.d.ts +2 -1
- package/__inner__/cjs/components/Table/components/TableFoot/TableFoot.js +2 -1
- package/__inner__/cjs/components/Table/components/TableHead/TableHead.js +2 -1
- package/__inner__/cjs/components/Table/index.d.ts +1 -0
- package/__inner__/cjs/components/Table/index.js +1 -0
- package/__inner__/cjs/components/Table/types.d.ts +4 -0
- package/__inner__/cjs/components/Table/types.js +2 -1
- package/__inner__/cjs/components/TagNext/index.d.ts +1 -0
- package/__inner__/cjs/components/TagNext/index.js +1 -0
- package/__inner__/cjs/hooks/useBreakpointsNext/useBreakpoints.d.ts +1 -1
- package/__inner__/cjs/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/__inner__/cjs/hooks/useIntersectionObserver/index.js +5 -0
- package/__inner__/cjs/hooks/useIntersectionObserver/types.d.ts +29 -0
- package/__inner__/cjs/hooks/useIntersectionObserver/types.js +2 -0
- package/__inner__/cjs/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +6 -0
- package/__inner__/cjs/hooks/useIntersectionObserver/useIntersectionObserver.js +79 -0
- package/__inner__/cjs/types/index.d.ts +10 -0
- package/__inner__/cjs/types/index.js +13 -0
- package/__inner__/cjs/types/object/withRequired.d.ts +1 -3
- package/__inner__/cjs/utils/index.d.ts +30 -0
- package/__inner__/cjs/utils/index.js +33 -0
- package/__inner__/cjs/utils/react/extractRef.d.ts +2 -0
- package/__inner__/cjs/utils/react/extractRef.js +11 -0
- package/__inner__/cjs/utils/react/index.d.ts +1 -0
- package/__inner__/cjs/utils/react/index.js +1 -0
- package/__inner__/esm/components/Autocomplete/helper.d.ts +1 -1
- package/__inner__/esm/components/AutocompleteBase/hooks/useAutocompleteBaseInputEvents/useAutocompleteBaseInputEvents.js +13 -0
- package/__inner__/esm/components/AutocompleteBase/modules/AutocompleteBaseDropdown/constants.d.ts +1 -1
- package/__inner__/esm/components/AutocompleteBase/modules/AutocompleteBaseInput/AutocompleteBaseInput.css +11 -14
- package/__inner__/esm/components/AutocompleteBase/modules/AutocompleteBaseInput/components/AutocompleteBaseInputMultiple/AutocompleteBaseInputMultiple.js +4 -5
- package/__inner__/esm/components/AutocompleteNext/Autocomplete.js +14 -0
- package/__inner__/esm/components/AutocompleteNext/components/AutocompleteInput/AutocompleteInput.js +1 -1
- package/__inner__/esm/components/AutocompleteNext/types.d.ts +7 -6
- package/__inner__/esm/components/Card/types.d.ts +2 -1
- package/__inner__/esm/components/DatePicker/components/DatePickerModeDateRange/DatePickerModeDateRange.js +5 -1
- package/__inner__/esm/components/DatePicker/types.d.ts +1 -1
- package/__inner__/esm/components/Grid/Grid.d.ts +2 -1
- package/__inner__/esm/components/Grid/GridItem.d.ts +2 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/b-business-dark/color-b-business-dark.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/b-business-default/color-b-business-default.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/ozen-dark/color-ozen-dark.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/ozen-default/color-ozen-default.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/vip-dark/color-vip-dark.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/color/vip-default/color-vip-default.css +1 -1
- package/__inner__/esm/components/OzenProvider/providers/theme/tokens/shadow/ozen-default/shadow-ozen-default.css +1 -1
- package/__inner__/esm/components/Popover/types.d.ts +1 -1
- package/__inner__/esm/components/SectionMessage/SectionMessage.css +6 -0
- package/__inner__/esm/components/SectionMessage/SectionMessage.js +8 -5
- package/__inner__/esm/components/SectionMessage/config.d.ts +2 -3
- package/__inner__/esm/components/SectionMessage/config.js +6 -21
- package/__inner__/esm/components/SectionMessage/constants.d.ts +3 -0
- package/__inner__/esm/components/SectionMessage/constants.js +6 -0
- package/__inner__/esm/components/SectionMessage/types.d.ts +6 -1
- package/__inner__/esm/components/SectionMessage/types.js +1 -0
- package/__inner__/esm/components/Table/Table.css +8 -0
- package/__inner__/esm/components/Table/Table.js +2 -2
- package/__inner__/esm/components/Table/components/TableBody/TableBody.js +3 -2
- package/__inner__/esm/components/Table/components/TableContainer/types.d.ts +2 -1
- package/__inner__/esm/components/Table/components/TableFoot/TableFoot.js +3 -2
- package/__inner__/esm/components/Table/components/TableHead/TableHead.js +3 -2
- package/__inner__/esm/components/Table/index.d.ts +1 -0
- package/__inner__/esm/components/Table/index.js +1 -0
- package/__inner__/esm/components/Table/types.d.ts +4 -0
- package/__inner__/esm/components/Table/types.js +1 -0
- package/__inner__/esm/components/TagNext/index.d.ts +1 -0
- package/__inner__/esm/components/TagNext/index.js +1 -0
- package/__inner__/esm/hooks/useBreakpointsNext/useBreakpoints.d.ts +1 -1
- package/__inner__/esm/hooks/useIntersectionObserver/index.d.ts +2 -0
- package/__inner__/esm/hooks/useIntersectionObserver/index.js +2 -0
- package/__inner__/esm/hooks/useIntersectionObserver/types.d.ts +29 -0
- package/__inner__/esm/hooks/useIntersectionObserver/types.js +1 -0
- package/__inner__/esm/hooks/useIntersectionObserver/useIntersectionObserver.d.ts +6 -0
- package/__inner__/esm/hooks/useIntersectionObserver/useIntersectionObserver.js +76 -0
- package/__inner__/esm/types/index.d.ts +10 -0
- package/__inner__/esm/types/index.js +10 -0
- package/__inner__/esm/types/object/withRequired.d.ts +1 -3
- package/__inner__/esm/utils/index.d.ts +30 -0
- package/__inner__/esm/utils/index.js +30 -0
- package/__inner__/esm/utils/react/extractRef.d.ts +2 -0
- package/__inner__/esm/utils/react/extractRef.js +7 -0
- package/__inner__/esm/utils/react/index.d.ts +1 -0
- package/__inner__/esm/utils/react/index.js +1 -0
- package/package.json +4 -4
- package/types/package.json +5 -0
- package/useDevEffect/package.json +5 -0
- package/useIntersectionObserver/package.json +5 -0
- package/utils/package.json +5 -0
|
@@ -1,24 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { CheckCircleOutlineIcon, InfoCircleOutlineIcon, WarningCircleOutlineIcon, WarningTriangleOutlineIcon, } from '@ozen-ui/icons';
|
|
3
2
|
export var SECTION_MESSAGE_ICON_BY_STATUS = {
|
|
4
|
-
neutral:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
s: React.createElement(InfoCircleOutlineIcon, { size: "s" }),
|
|
11
|
-
},
|
|
12
|
-
warning: {
|
|
13
|
-
m: React.createElement(WarningTriangleOutlineIcon, { size: "m" }),
|
|
14
|
-
s: React.createElement(WarningTriangleOutlineIcon, { size: "s" }),
|
|
15
|
-
},
|
|
16
|
-
success: {
|
|
17
|
-
m: React.createElement(CheckCircleOutlineIcon, { size: "m" }),
|
|
18
|
-
s: React.createElement(CheckCircleOutlineIcon, { size: "s" }),
|
|
19
|
-
},
|
|
20
|
-
error: {
|
|
21
|
-
m: React.createElement(WarningCircleOutlineIcon, { size: "m" }),
|
|
22
|
-
s: React.createElement(WarningCircleOutlineIcon, { size: "s" }),
|
|
23
|
-
},
|
|
3
|
+
neutral: InfoCircleOutlineIcon,
|
|
4
|
+
info: InfoCircleOutlineIcon,
|
|
5
|
+
warning: WarningTriangleOutlineIcon,
|
|
6
|
+
success: CheckCircleOutlineIcon,
|
|
7
|
+
error: WarningCircleOutlineIcon,
|
|
8
|
+
action: InfoCircleOutlineIcon,
|
|
24
9
|
};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import type { IconSize } from '@ozen-ui/icons';
|
|
2
|
+
import type { SectionMessageSizeVariant } from './types';
|
|
1
3
|
export declare const SECTION_MESSAGE_DEFAULT_STATUS = "info";
|
|
2
4
|
export declare const SECTION_MESSAGE_DEFAULT_SIZE = "m";
|
|
5
|
+
export declare const SECTION_MESSAGE_SIZE_TO_ICON_SIZE: Readonly<Record<SectionMessageSizeVariant, IconSize>>;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { ComponentRef, ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { IconProps } from '@ozen-ui/icons';
|
|
2
3
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
4
|
+
import type { RenderContentType } from '../../utils';
|
|
3
5
|
import type { ButtonProps } from '../ButtonNext';
|
|
4
|
-
export declare const sectionMessageStatusVariant: readonly ["success", "error", "warning", "info", "neutral"];
|
|
6
|
+
export declare const sectionMessageStatusVariant: readonly ["success", "error", "warning", "info", "neutral", "action"];
|
|
5
7
|
export type SectionMessageStatusVariant = (typeof sectionMessageStatusVariant)[number];
|
|
6
8
|
export declare const sectionMessageSizeVariant: readonly ["xs", "s", "m", "l"];
|
|
7
9
|
export type SectionMessageSizeVariant = (typeof sectionMessageSizeVariant)[number];
|
|
10
|
+
export type SectionMessageIconType = RenderContentType<IconProps>['content'];
|
|
8
11
|
export type SectionMessageRef = ComponentRef<'div'>;
|
|
9
12
|
export type SectionMessageProps = ExtendableComponentPropsWithRef<{
|
|
10
13
|
/**
|
|
@@ -17,6 +20,8 @@ export type SectionMessageProps = ExtendableComponentPropsWithRef<{
|
|
|
17
20
|
* @default true
|
|
18
21
|
*/
|
|
19
22
|
showIcon?: boolean;
|
|
23
|
+
/** Кастомная иконка */
|
|
24
|
+
icon?: SectionMessageIconType;
|
|
20
25
|
/**
|
|
21
26
|
* Размер
|
|
22
27
|
* @default m
|
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
inline-size: 100%;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
.Table_layout_auto {
|
|
12
|
+
table-layout: auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.Table_layout_fixed {
|
|
16
|
+
table-layout: fixed;
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
.Table_size_xs {
|
|
12
20
|
--table-header-cell-text: var(--typography-text-3xs-font);
|
|
13
21
|
--table-header-cell-padding: 16px 12px 8px;
|
|
@@ -6,7 +6,7 @@ import './Table.css';
|
|
|
6
6
|
import { TABLE_DEFAULT_COMPRESSED, TABLE_DEFAULT_DIVIDER, TABLE_DEFAULT_FULL_WIDTH, TABLE_DEFAULT_SIZE, TABLE_DEFAULT_STICKY_HEADER, TABLE_DEFAULT_STRIPED, } from './constants';
|
|
7
7
|
export var cnTable = cn('Table');
|
|
8
8
|
export var Table = forwardRef(function (inProps, ref) {
|
|
9
|
-
var _a = useThemeProps({ name: 'Table', props: inProps }), _b = _a.size, size = _b === void 0 ? TABLE_DEFAULT_SIZE : _b, _c = _a.divider, divider = _c === void 0 ? TABLE_DEFAULT_DIVIDER : _c, _d = _a.fullWidth, fullWidth = _d === void 0 ? TABLE_DEFAULT_FULL_WIDTH : _d, _e = _a.stickyHeader, stickyHeader = _e === void 0 ? TABLE_DEFAULT_STICKY_HEADER : _e, _f = _a.compressed, compressed = _f === void 0 ? TABLE_DEFAULT_COMPRESSED : _f, _g = _a.striped, striped = _g === void 0 ? TABLE_DEFAULT_STRIPED : _g, children = _a.children, className = _a.className, other = __rest(_a, ["size", "divider", "fullWidth", "stickyHeader", "compressed", "striped", "children", "className"]);
|
|
10
|
-
return (React.createElement("table", __assign({ className: cnTable({ compressed: compressed, size: size, stickyHeader: stickyHeader, fullWidth: fullWidth, divider: divider, striped: striped }, [className]) }, other, { ref: ref }), children));
|
|
9
|
+
var _a = useThemeProps({ name: 'Table', props: inProps }), _b = _a.size, size = _b === void 0 ? TABLE_DEFAULT_SIZE : _b, _c = _a.divider, divider = _c === void 0 ? TABLE_DEFAULT_DIVIDER : _c, _d = _a.fullWidth, fullWidth = _d === void 0 ? TABLE_DEFAULT_FULL_WIDTH : _d, _e = _a.stickyHeader, stickyHeader = _e === void 0 ? TABLE_DEFAULT_STICKY_HEADER : _e, _f = _a.compressed, compressed = _f === void 0 ? TABLE_DEFAULT_COMPRESSED : _f, _g = _a.striped, striped = _g === void 0 ? TABLE_DEFAULT_STRIPED : _g, layout = _a.layout, children = _a.children, className = _a.className, other = __rest(_a, ["size", "divider", "fullWidth", "stickyHeader", "compressed", "striped", "layout", "children", "className"]);
|
|
10
|
+
return (React.createElement("table", __assign({ className: cnTable({ compressed: compressed, size: size, stickyHeader: stickyHeader, fullWidth: fullWidth, divider: divider, striped: striped, layout: layout }, [className]) }, other, { ref: ref }), children));
|
|
11
11
|
});
|
|
12
12
|
Table.displayName = 'Table';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { cn } from '../../../../utils/classname';
|
|
4
4
|
import { TableContext } from '../../TableContext';
|
|
5
5
|
export var cnTableBody = cn('TableBody');
|
|
6
6
|
export var TableBody = forwardRef(function (_a, ref) {
|
|
7
7
|
var children = _a.children, className = _a.className, other = __rest(_a, ["children", "className"]);
|
|
8
|
-
|
|
8
|
+
var memoizedContext = useMemo(function () { return ({ variant: 'body' }); }, []);
|
|
9
|
+
return (React.createElement(TableContext.Provider, { value: memoizedContext },
|
|
9
10
|
React.createElement("tbody", __assign({ className: cnTableBody('', [className]) }, other, { ref: ref }), children)));
|
|
10
11
|
});
|
|
11
12
|
TableBody.displayName = 'TableBody';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, ElementType, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentRef, CSSProperties, ElementType, ReactNode } from 'react';
|
|
2
2
|
import type { PolymorphicComponentPropsWithoutRef } from '../../../../utils/polymorphicComponentWithRef';
|
|
3
3
|
import type { TABLE_CONTAINER_DEFAULT_TAG } from './constants';
|
|
4
4
|
export type TableContainerBaseProps = {
|
|
@@ -16,3 +16,4 @@ export type TableContainerBaseProps = {
|
|
|
16
16
|
'data-testid'?: string;
|
|
17
17
|
};
|
|
18
18
|
export type TableContainerProps<As extends ElementType = typeof TABLE_CONTAINER_DEFAULT_TAG> = PolymorphicComponentPropsWithoutRef<TableContainerBaseProps, As>;
|
|
19
|
+
export type TableContainerRef<As extends ElementType = typeof TABLE_CONTAINER_DEFAULT_TAG> = ComponentRef<As>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { cn } from '../../../../utils/classname';
|
|
4
4
|
import { TableContext } from '../../TableContext';
|
|
5
5
|
export var cnTableFoot = cn('TableFoot');
|
|
6
6
|
export var TableFoot = forwardRef(function (_a, ref) {
|
|
7
7
|
var children = _a.children, className = _a.className, other = __rest(_a, ["children", "className"]);
|
|
8
|
-
|
|
8
|
+
var memoizedContext = useMemo(function () { return ({ variant: 'foot' }); }, []);
|
|
9
|
+
return (React.createElement(TableContext.Provider, { value: memoizedContext },
|
|
9
10
|
React.createElement("tfoot", __assign({ className: cnTableFoot({}, [className]) }, other, { ref: ref }), children)));
|
|
10
11
|
});
|
|
11
12
|
TableFoot.displayName = 'TableFoot';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
|
-
import React, { forwardRef } from 'react';
|
|
2
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
3
3
|
import { cn } from '../../../../utils/classname';
|
|
4
4
|
import { TableContext } from '../../TableContext';
|
|
5
5
|
export var cnTableHead = cn('TableHead');
|
|
6
6
|
export var TableHead = forwardRef(function (_a, ref) {
|
|
7
7
|
var children = _a.children, className = _a.className, other = __rest(_a, ["children", "className"]);
|
|
8
|
-
|
|
8
|
+
var memoizedContext = useMemo(function () { return ({ variant: 'head' }); }, []);
|
|
9
|
+
return (React.createElement(TableContext.Provider, { value: memoizedContext },
|
|
9
10
|
React.createElement("thead", __assign({ className: cnTableHead({}, [className]) }, other, { ref: ref }), children)));
|
|
10
11
|
});
|
|
11
12
|
TableHead.displayName = 'TableHead';
|
|
@@ -2,14 +2,18 @@ import type { ComponentRef, ReactNode } from 'react';
|
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '../../types/ExtendableComponentPropsWithRef';
|
|
3
3
|
export declare const tableSizeVariant: readonly ["xs", "s", "m", "l"];
|
|
4
4
|
export declare const tableDividerVariant: readonly ["row", "column", "all"];
|
|
5
|
+
export declare const tableLayoutVariant: readonly ["auto", "fixed"];
|
|
5
6
|
export type TableSizeVariant = (typeof tableSizeVariant)[number];
|
|
6
7
|
export type TableDividerVariant = (typeof tableDividerVariant)[number];
|
|
8
|
+
export type TableLayoutVariant = (typeof tableLayoutVariant)[number];
|
|
7
9
|
export type TableRef = ComponentRef<'table'>;
|
|
8
10
|
export type TableProps = ExtendableComponentPropsWithRef<{
|
|
9
11
|
/** Устанавливает размер типографики и отступов в таблице */
|
|
10
12
|
size?: TableSizeVariant;
|
|
11
13
|
/** Признак, по которому таблица растет по всей ширине своего контейнера */
|
|
12
14
|
fullWidth?: boolean;
|
|
15
|
+
/** Вариант layout-таблицы */
|
|
16
|
+
layout?: TableLayoutVariant;
|
|
13
17
|
/** Тип разделителей в таблице */
|
|
14
18
|
divider?: TableDividerVariant;
|
|
15
19
|
/** Признак фиксированного заголовка в таблице */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useBreakpoints(): import("../../types
|
|
1
|
+
export declare function useBreakpoints(): import("../../types").BreakpointMatches;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { StoredValue } from '../useStoredValue';
|
|
3
|
+
export type UseIntersectionObserverElement = RefObject<Element | null | undefined> | Element | undefined | null;
|
|
4
|
+
export type UseIntersectionObserverOnEntryChange = (entry: IntersectionObserverEntry | null) => void;
|
|
5
|
+
export type UseIntersectionObserverOnViewChange = (inView: boolean) => void;
|
|
6
|
+
export type UseIntersectionObserverOnShow = () => void;
|
|
7
|
+
export type UseIntersectionObserverOnHidden = () => void;
|
|
8
|
+
export type UseIntersectionObserverOptions = Omit<IntersectionObserverInit, 'root'> & {
|
|
9
|
+
/** Вызывается при изменении entry наблюдателя */
|
|
10
|
+
onEntryChange?: UseIntersectionObserverOnEntryChange;
|
|
11
|
+
/** Вызывается при входе/выходе элемента из viewport */
|
|
12
|
+
onViewChange?: UseIntersectionObserverOnViewChange;
|
|
13
|
+
/** Вызывается при входе элемента во viewport */
|
|
14
|
+
onShow?: UseIntersectionObserverOnShow;
|
|
15
|
+
/** Вызывается при выходе элемента из viewport */
|
|
16
|
+
onHidden?: UseIntersectionObserverOnHidden;
|
|
17
|
+
/** Если `true`, то включен */
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
/** Root наблюдателя */
|
|
20
|
+
root?: UseIntersectionObserverElement;
|
|
21
|
+
};
|
|
22
|
+
export type UseIntersectionObserverReturn = {
|
|
23
|
+
/** Entry наблюдателя */
|
|
24
|
+
entry: StoredValue<IntersectionObserverEntry | undefined>;
|
|
25
|
+
/** Если `true`, то элемент находится во viewport */
|
|
26
|
+
inView: StoredValue<boolean>;
|
|
27
|
+
/** Функция для переподключения к наблюдателю */
|
|
28
|
+
reconnect: () => void;
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UseIntersectionObserverElement, UseIntersectionObserverOptions, UseIntersectionObserverReturn } from './types';
|
|
2
|
+
export declare function useIntersectionObserver(
|
|
3
|
+
/** Отслеживаемый компонент */
|
|
4
|
+
target: UseIntersectionObserverElement,
|
|
5
|
+
/** Параметры отслеживания */
|
|
6
|
+
options?: UseIntersectionObserverOptions): UseIntersectionObserverReturn;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { __assign, __read } from "tslib";
|
|
2
|
+
import { useCallback, useEffect } from 'react';
|
|
3
|
+
import { isRef } from '../../utils';
|
|
4
|
+
import { useMutableRef } from '../useMutableRef';
|
|
5
|
+
import { useStoredValue } from '../useStoredValue';
|
|
6
|
+
export function useIntersectionObserver(
|
|
7
|
+
/** Отслеживаемый компонент */
|
|
8
|
+
target,
|
|
9
|
+
/** Параметры отслеживания */
|
|
10
|
+
options) {
|
|
11
|
+
var _a;
|
|
12
|
+
var isEnabled = (_a = options === null || options === void 0 ? void 0 : options.enabled) !== null && _a !== void 0 ? _a : true;
|
|
13
|
+
var savedOnEntryChange = useMutableRef(options === null || options === void 0 ? void 0 : options.onEntryChange);
|
|
14
|
+
var savedOnViewChange = useMutableRef(options === null || options === void 0 ? void 0 : options.onViewChange);
|
|
15
|
+
var savedOnShow = useMutableRef(options === null || options === void 0 ? void 0 : options.onShow);
|
|
16
|
+
var savedOnHidden = useMutableRef(options === null || options === void 0 ? void 0 : options.onHidden);
|
|
17
|
+
var entry = useStoredValue(undefined);
|
|
18
|
+
var inView = useStoredValue(false);
|
|
19
|
+
var observer = useStoredValue(function () { return new IntersectionObserver(function () { }); });
|
|
20
|
+
var connect = useCallback(function () {
|
|
21
|
+
if (!isEnabled) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var element = isRef(target) ? target.current : target;
|
|
25
|
+
if (!element) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
var root = (function () {
|
|
29
|
+
var root = options === null || options === void 0 ? void 0 : options.root;
|
|
30
|
+
if (!root) {
|
|
31
|
+
return document;
|
|
32
|
+
}
|
|
33
|
+
return isRef(options.root) ? options.root.current : options.root;
|
|
34
|
+
})();
|
|
35
|
+
observer.current = new IntersectionObserver(function (_a) {
|
|
36
|
+
var _b, _c, _d, _e, _f;
|
|
37
|
+
var _g = __read(_a, 1), newEntry = _g[0];
|
|
38
|
+
var previousInView = !!((_b = entry.current) === null || _b === void 0 ? void 0 : _b.isIntersecting);
|
|
39
|
+
var currentInView = !!(newEntry === null || newEntry === void 0 ? void 0 : newEntry.isIntersecting);
|
|
40
|
+
entry.current = newEntry;
|
|
41
|
+
inView.current = currentInView;
|
|
42
|
+
(_c = savedOnEntryChange.current) === null || _c === void 0 ? void 0 : _c.call(savedOnEntryChange, newEntry !== null && newEntry !== void 0 ? newEntry : null);
|
|
43
|
+
if (previousInView === currentInView) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
(_d = savedOnViewChange.current) === null || _d === void 0 ? void 0 : _d.call(savedOnViewChange, currentInView);
|
|
47
|
+
if (currentInView) {
|
|
48
|
+
(_e = savedOnShow.current) === null || _e === void 0 ? void 0 : _e.call(savedOnShow);
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
(_f = savedOnHidden.current) === null || _f === void 0 ? void 0 : _f.call(savedOnHidden);
|
|
52
|
+
}
|
|
53
|
+
}, __assign(__assign({}, options), { root: root }));
|
|
54
|
+
observer.current.observe(element);
|
|
55
|
+
}, [
|
|
56
|
+
isRef(target) ? target.current : target,
|
|
57
|
+
options === null || options === void 0 ? void 0 : options.rootMargin,
|
|
58
|
+
options === null || options === void 0 ? void 0 : options.threshold,
|
|
59
|
+
options === null || options === void 0 ? void 0 : options.root,
|
|
60
|
+
isEnabled,
|
|
61
|
+
]);
|
|
62
|
+
var disconnect = useCallback(function () {
|
|
63
|
+
observer.current.disconnect();
|
|
64
|
+
}, [observer]);
|
|
65
|
+
var reconnect = useCallback(function () {
|
|
66
|
+
disconnect();
|
|
67
|
+
connect();
|
|
68
|
+
}, [disconnect, connect]);
|
|
69
|
+
useEffect(function () {
|
|
70
|
+
reconnect();
|
|
71
|
+
}, [connect]);
|
|
72
|
+
useEffect(function () { return function () {
|
|
73
|
+
disconnect();
|
|
74
|
+
}; }, []);
|
|
75
|
+
return { entry: entry, inView: inView, reconnect: reconnect };
|
|
76
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './css';
|
|
2
|
+
export * from './function';
|
|
3
|
+
export * from './object';
|
|
4
|
+
export * from './react';
|
|
5
|
+
export * from './Breakpoints';
|
|
6
|
+
export * from './ExtendableComponentPropsWithRef';
|
|
7
|
+
export * from './ExtendableProps';
|
|
8
|
+
export * from './FormElementSizeVariant';
|
|
9
|
+
export * from './KeyCode';
|
|
10
|
+
export * from './ResponsiveValue';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './css';
|
|
2
|
+
export * from './function';
|
|
3
|
+
export * from './object';
|
|
4
|
+
export * from './react';
|
|
5
|
+
export * from './Breakpoints';
|
|
6
|
+
export * from './ExtendableComponentPropsWithRef';
|
|
7
|
+
export * from './ExtendableProps';
|
|
8
|
+
export * from './FormElementSizeVariant';
|
|
9
|
+
export * from './KeyCode';
|
|
10
|
+
export * from './ResponsiveValue';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from './array';
|
|
2
|
+
export * from './breakpoint';
|
|
3
|
+
export * from './capitalizeFirstLetter';
|
|
4
|
+
export * from './css';
|
|
5
|
+
export * from './date';
|
|
6
|
+
export * from './generateUniqKey';
|
|
7
|
+
export * from './getByMap';
|
|
8
|
+
export * from './getScrollBarSize';
|
|
9
|
+
export * from './math';
|
|
10
|
+
export * from './number';
|
|
11
|
+
export * from './object';
|
|
12
|
+
export * from './react';
|
|
13
|
+
export * from './renderContent';
|
|
14
|
+
export * from './shallowEqual';
|
|
15
|
+
export * from './string';
|
|
16
|
+
export * from './animateProperty';
|
|
17
|
+
export * from './classname';
|
|
18
|
+
export * from './getFocusableElements';
|
|
19
|
+
export * from './getIconSizeToFormElement';
|
|
20
|
+
export * from './getNextIndex';
|
|
21
|
+
export * from './getPaperSizeToFormElement';
|
|
22
|
+
export * from './getPrevIndex';
|
|
23
|
+
export * from './isFunction';
|
|
24
|
+
export * from './isKey';
|
|
25
|
+
export * from './isKeys';
|
|
26
|
+
export * from './isNotNil';
|
|
27
|
+
export * from './isString';
|
|
28
|
+
export * from './polymorphicComponentWithRef';
|
|
29
|
+
export * from './scrollContainerToElement';
|
|
30
|
+
export * from './setRef';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * from './array';
|
|
2
|
+
export * from './breakpoint';
|
|
3
|
+
export * from './capitalizeFirstLetter';
|
|
4
|
+
export * from './css';
|
|
5
|
+
export * from './date';
|
|
6
|
+
export * from './generateUniqKey';
|
|
7
|
+
export * from './getByMap';
|
|
8
|
+
export * from './getScrollBarSize';
|
|
9
|
+
export * from './math';
|
|
10
|
+
export * from './number';
|
|
11
|
+
export * from './object';
|
|
12
|
+
export * from './react';
|
|
13
|
+
export * from './renderContent';
|
|
14
|
+
export * from './shallowEqual';
|
|
15
|
+
export * from './string';
|
|
16
|
+
export * from './animateProperty';
|
|
17
|
+
export * from './classname';
|
|
18
|
+
export * from './getFocusableElements';
|
|
19
|
+
export * from './getIconSizeToFormElement';
|
|
20
|
+
export * from './getNextIndex';
|
|
21
|
+
export * from './getPaperSizeToFormElement';
|
|
22
|
+
export * from './getPrevIndex';
|
|
23
|
+
export * from './isFunction';
|
|
24
|
+
export * from './isKey';
|
|
25
|
+
export * from './isKeys';
|
|
26
|
+
export * from './isNotNil';
|
|
27
|
+
export * from './isString';
|
|
28
|
+
export * from './polymorphicComponentWithRef';
|
|
29
|
+
export * from './scrollContainerToElement';
|
|
30
|
+
export * from './setRef';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ozen-ui/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.74.0",
|
|
4
4
|
"description": "React component library",
|
|
5
5
|
"files": [
|
|
6
6
|
"*"
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"react-popper": "^2.3.0",
|
|
30
30
|
"react-transition-group": "^4.4.5",
|
|
31
31
|
"tslib": "^2.6.3",
|
|
32
|
-
"@ozen-ui/
|
|
33
|
-
"@ozen-ui/
|
|
34
|
-
"@ozen-ui/logger": "0.
|
|
32
|
+
"@ozen-ui/icons": "0.74.0",
|
|
33
|
+
"@ozen-ui/fonts": "0.74.0",
|
|
34
|
+
"@ozen-ui/logger": "0.74.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/lodash.isequal": "^4.5.0"
|