@redis-ui/components 41.3.2 → 41.4.1
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/AppSelectionMenu/components/Item/Item.styles.d.ts +1 -1
- package/dist/Banner/components/Message/Message.style.d.ts +2 -1
- package/dist/Checkbox/components/Label/Label.style.d.ts +2 -1
- package/dist/ChipList/Components/ExtraItem.style.d.ts +2 -1
- package/dist/Drawer/components/Description/components/Text/Text.style.d.ts +2 -1
- package/dist/Drawer/components/Header/components/Title/Title.style.d.ts +2 -1
- package/dist/FormField/components/AdditionalText/AdditionalText.style.d.ts +2 -1
- package/dist/Inputs/Input/Input.d.ts +1 -1
- package/dist/Inputs/NumericInput/NumericInput.d.ts +1 -1
- package/dist/Inputs/QuantityCounter/QuantityCounter.d.ts +1 -1
- package/dist/Inputs/QuantityCounter/components/InputGroup/components/ValueLabel/ValueLabel.style.d.ts +2 -1
- package/dist/Inputs/TextArea/TextArea.d.ts +1 -1
- package/dist/Inputs/TextArea/components/Compose/Compose.style.d.ts +1 -1
- package/dist/Inputs/components/Compose/Compose.style.d.ts +2 -1
- package/dist/Inputs/components/InputTag/InputTag.style.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.style.js +1 -1
- package/dist/Label/components/Optional/Optional.style.d.ts +2 -1
- package/dist/Label/components/Required/Required.style.d.ts +2 -1
- package/dist/Label/components/Text/Text.style.d.ts +2 -1
- package/dist/Link/Link.style.d.ts +2 -1
- package/dist/Menu/components/Content/components/Item/Components/SubHead/SubHead.style.d.ts +2 -1
- package/dist/Menu/components/Content/components/Label/components/Text/Text.style.d.ts +2 -1
- package/dist/Modal/components/Content/components/Body/components/Text/Text.style.d.ts +2 -1
- package/dist/Modal/components/Content/components/Description/components/Text/Text.style.d.ts +2 -1
- package/dist/Modal/components/Content/components/Header/components/Title/Title.style.d.ts +2 -1
- package/dist/Pagination/Pagination.d.ts +3 -2
- package/dist/Popover/Popover.d.ts +2 -2
- package/dist/Popover/components/Content/Content.d.ts +1 -1
- package/dist/Popover/components/Content/components/Body/components/BodyText/BodyText.styles.d.ts +2 -1
- package/dist/Popover/components/Content/components/Header/components/HeaderTitle/HeaderTitle.styles.d.ts +2 -1
- package/dist/Popover/components/Content/components/Text/Text.styles.d.ts +2 -1
- package/dist/Popover/components/Content/components/WindowBar/WindowBar.d.ts +1 -1
- package/dist/Popover/components/Content/components/WindowBar/WindowBar.style.d.ts +2 -1
- package/dist/Popover/components/PopoverCard/PopoverCard.d.ts +1 -1
- package/dist/ProfileIcon/ProfileIcon.style.cjs +2 -2
- package/dist/ProfileIcon/ProfileIcon.style.js +2 -2
- package/dist/ProgressBar/ProgressBar.styles.d.ts +1 -1
- package/dist/Section/components/Header/components/CategoryValueList/CategoryValueList.style.d.ts +2 -1
- package/dist/Section/components/Header/components/CategoryValueList/components/CategoryValueChip/CategoryValueChip.style.d.ts +3 -2
- package/dist/Section/components/Header/components/Label/Label.style.d.ts +2 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.cjs +1 -1
- package/dist/Select/components/Trigger/components/Compose/Compose.style.js +1 -1
- package/dist/SideBar/components/Footer/components/Text/Text.style.d.ts +2 -1
- package/dist/SideBar/components/Item/components/Text/Text.style.d.ts +2 -1
- package/dist/Stepper/components/Step/components/Label/Label.style.d.ts +2 -1
- package/dist/Stepper/components/Step/components/Label/Label.types.d.ts +2 -3
- package/dist/Switch/components/Title/Title.style.d.ts +2 -1
- package/dist/Switch/components/Title/Title.types.d.ts +4 -4
- package/dist/TableHeading/TableHeading.style.cjs +1 -1
- package/dist/TableHeading/TableHeading.style.js +1 -1
- package/dist/Tabs/components/TabBar/utils/theme.utils.d.ts +3 -3
- package/dist/Toast/components/Content/components/Description/Description.style.d.ts +2 -1
- package/dist/Toast/components/Content/components/Message/Message.style.d.ts +2 -1
- package/dist/Tooltip/components/Content/components/Text/Text.styles.d.ts +2 -1
- package/dist/TreeView/components/TreeItem/components/Checkbox/Checkbox.style.d.ts +2 -1
- package/dist/Typography/Typography.cjs +3 -1
- package/dist/Typography/Typography.d.ts +5 -3
- package/dist/Typography/Typography.js +8 -6
- package/dist/Typography/components/Base/Base.cjs +18 -0
- package/dist/Typography/components/Base/Base.d.ts +4 -0
- package/dist/Typography/components/Base/Base.js +18 -0
- package/dist/Typography/components/Base/Base.style.cjs +16 -0
- package/dist/Typography/components/Base/Base.style.d.ts +3 -0
- package/dist/Typography/components/Base/Base.style.js +14 -0
- package/dist/Typography/components/Base/Base.types.d.ts +7 -0
- package/dist/Typography/components/Body/Body.cjs +11 -12
- package/dist/Typography/components/Body/Body.d.ts +3 -2
- package/dist/Typography/components/Body/Body.js +12 -13
- package/dist/Typography/components/Body/Body.style.cjs +5 -10
- package/dist/Typography/components/Body/Body.style.d.ts +2 -3
- package/dist/Typography/components/Body/Body.style.js +5 -10
- package/dist/Typography/components/Body/Body.types.d.ts +2 -5
- package/dist/Typography/components/Code/Code.cjs +11 -11
- package/dist/Typography/components/Code/Code.d.ts +3 -2
- package/dist/Typography/components/Code/Code.js +12 -12
- package/dist/Typography/components/Code/Code.style.cjs +5 -10
- package/dist/Typography/components/Code/Code.style.d.ts +1 -2
- package/dist/Typography/components/Code/Code.style.js +5 -10
- package/dist/Typography/components/Code/Code.types.d.ts +2 -5
- package/dist/Typography/components/Heading/Heading.cjs +11 -20
- package/dist/Typography/components/Heading/Heading.d.ts +3 -2
- package/dist/Typography/components/Heading/Heading.js +11 -20
- package/dist/Typography/components/Heading/Heading.style.cjs +4 -10
- package/dist/Typography/components/Heading/Heading.style.d.ts +2 -2
- package/dist/Typography/components/Heading/Heading.style.js +4 -10
- package/dist/Typography/components/Heading/Heading.types.d.ts +2 -5
- package/dist/Typography/components/Heading/Heading.utils.cjs +12 -0
- package/dist/Typography/components/Heading/Heading.utils.d.ts +2 -0
- package/dist/Typography/components/Heading/Heading.utils.js +12 -0
- package/dist/Typography/hooks/useEllipsisTooltip.cjs +7 -4
- package/dist/Typography/hooks/useEllipsisTooltip.d.ts +3 -8
- package/dist/Typography/hooks/useEllipsisTooltip.js +7 -4
- package/dist/Typography/index.d.ts +1 -0
- package/dist/packages/icons/dist/multicolor/LoaderLarge.cjs +1 -1
- package/dist/packages/icons/dist/multicolor/LoaderLarge.js +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from 'react';
|
|
2
|
-
import { EllipsisTooltipParams } from '../../hooks/useEllipsisTooltip';
|
|
3
1
|
import { TypographyColor } from '../../Typography.types';
|
|
2
|
+
import { TypographyBaseProps } from '../Base/Base.types';
|
|
4
3
|
export type TypographyHeadingSize = 'XXL' | 'XL' | 'L' | 'M' | 'S' | 'XS';
|
|
5
4
|
export type TypographyHeadingVariant = 'bold' | 'semiBold';
|
|
6
5
|
export type TypographyHeadingComponent = 'p' | 'span' | 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
7
|
-
export interface TypographyHeadingProps extends
|
|
6
|
+
export interface TypographyHeadingProps extends TypographyBaseProps {
|
|
8
7
|
size?: TypographyHeadingSize;
|
|
9
|
-
ellipsis?: boolean;
|
|
10
|
-
children: React.ReactNode;
|
|
11
8
|
color?: TypographyColor;
|
|
12
9
|
variant?: TypographyHeadingVariant;
|
|
13
10
|
component?: TypographyHeadingComponent;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const level = {
|
|
4
|
+
XXL: "1",
|
|
5
|
+
XL: "2",
|
|
6
|
+
L: "3",
|
|
7
|
+
M: "4",
|
|
8
|
+
S: "5",
|
|
9
|
+
XS: "6"
|
|
10
|
+
};
|
|
11
|
+
const getHeadingLevel = (size, component) => typeof component === "string" && !Number.isNaN(+component[1]) && +component[1] && component[1] || level[size];
|
|
12
|
+
exports.getHeadingLevel = getHeadingLevel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const level = {
|
|
2
|
+
XXL: "1",
|
|
3
|
+
XL: "2",
|
|
4
|
+
L: "3",
|
|
5
|
+
M: "4",
|
|
6
|
+
S: "5",
|
|
7
|
+
XS: "6"
|
|
8
|
+
};
|
|
9
|
+
const getHeadingLevel = (size, component) => typeof component === "string" && !Number.isNaN(+component[1]) && +component[1] && component[1] || level[size];
|
|
10
|
+
export {
|
|
11
|
+
getHeadingLevel
|
|
12
|
+
};
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const React = require("react");
|
|
4
|
+
const index = require("../../node_modules/@radix-ui/react-compose-refs/dist/index.cjs");
|
|
4
5
|
const useEllipsisTooltip = ({
|
|
5
6
|
tooltipOnEllipsis,
|
|
6
7
|
onMouseEnter,
|
|
7
8
|
onMouseLeave,
|
|
8
9
|
title
|
|
9
|
-
}) => {
|
|
10
|
+
}, ref) => {
|
|
10
11
|
const [tooltip, setTooltip] = React.useState();
|
|
11
|
-
const
|
|
12
|
+
const innerRef = React.useRef(null);
|
|
13
|
+
const comboRef = index.useComposedRefs(innerRef, ref);
|
|
12
14
|
const handleMouseEnter = React.useCallback((e) => {
|
|
13
15
|
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
14
|
-
const target =
|
|
16
|
+
const target = innerRef.current;
|
|
15
17
|
if (tooltipOnEllipsis && target && target.offsetWidth < target.scrollWidth) {
|
|
16
18
|
setTooltip(typeof tooltipOnEllipsis === "string" ? tooltipOnEllipsis : target.innerText);
|
|
17
19
|
}
|
|
@@ -21,11 +23,12 @@ const useEllipsisTooltip = ({
|
|
|
21
23
|
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
22
24
|
}, [onMouseLeave]);
|
|
23
25
|
return !tooltipOnEllipsis || title ? {
|
|
26
|
+
ref: comboRef,
|
|
24
27
|
title,
|
|
25
28
|
onMouseEnter,
|
|
26
29
|
onMouseLeave
|
|
27
30
|
} : {
|
|
28
|
-
ref,
|
|
31
|
+
ref: comboRef,
|
|
29
32
|
title: tooltip,
|
|
30
33
|
onMouseEnter: handleMouseEnter,
|
|
31
34
|
onMouseLeave: handleMouseLeave
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { HTMLAttributes, MouseEventHandler } from 'react';
|
|
1
|
+
import { HTMLAttributes, MouseEventHandler, Ref } from 'react';
|
|
2
2
|
export type EllipsisTooltipParams<T extends HTMLElement = HTMLElement> = {
|
|
3
3
|
tooltipOnEllipsis?: boolean | string | undefined;
|
|
4
4
|
} & Pick<HTMLAttributes<T>, 'onMouseEnter' | 'onMouseLeave' | 'title'>;
|
|
5
|
-
export declare const useEllipsisTooltip: <T extends HTMLElement = HTMLElement>({ tooltipOnEllipsis, onMouseEnter, onMouseLeave, title }: EllipsisTooltipParams<T>) => {
|
|
5
|
+
export declare const useEllipsisTooltip: <T extends HTMLElement = HTMLElement>({ tooltipOnEllipsis, onMouseEnter, onMouseLeave, title }: EllipsisTooltipParams<T>, ref?: Ref<T> | undefined) => {
|
|
6
|
+
readonly ref: (node: T) => void;
|
|
6
7
|
readonly title: string | undefined;
|
|
7
8
|
readonly onMouseEnter: MouseEventHandler<T> | undefined;
|
|
8
9
|
readonly onMouseLeave: MouseEventHandler<T> | undefined;
|
|
9
|
-
readonly ref?: undefined;
|
|
10
|
-
} | {
|
|
11
|
-
readonly ref: import("react").RefObject<T>;
|
|
12
|
-
readonly title: string | undefined;
|
|
13
|
-
readonly onMouseEnter: MouseEventHandler<T>;
|
|
14
|
-
readonly onMouseLeave: MouseEventHandler<T>;
|
|
15
10
|
};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { useState, useRef, useCallback } from "react";
|
|
2
|
+
import { useComposedRefs } from "../../node_modules/@radix-ui/react-compose-refs/dist/index.js";
|
|
2
3
|
const useEllipsisTooltip = ({
|
|
3
4
|
tooltipOnEllipsis,
|
|
4
5
|
onMouseEnter,
|
|
5
6
|
onMouseLeave,
|
|
6
7
|
title
|
|
7
|
-
}) => {
|
|
8
|
+
}, ref) => {
|
|
8
9
|
const [tooltip, setTooltip] = useState();
|
|
9
|
-
const
|
|
10
|
+
const innerRef = useRef(null);
|
|
11
|
+
const comboRef = useComposedRefs(innerRef, ref);
|
|
10
12
|
const handleMouseEnter = useCallback((e) => {
|
|
11
13
|
onMouseEnter == null ? void 0 : onMouseEnter(e);
|
|
12
|
-
const target =
|
|
14
|
+
const target = innerRef.current;
|
|
13
15
|
if (tooltipOnEllipsis && target && target.offsetWidth < target.scrollWidth) {
|
|
14
16
|
setTooltip(typeof tooltipOnEllipsis === "string" ? tooltipOnEllipsis : target.innerText);
|
|
15
17
|
}
|
|
@@ -19,11 +21,12 @@ const useEllipsisTooltip = ({
|
|
|
19
21
|
onMouseLeave == null ? void 0 : onMouseLeave(e);
|
|
20
22
|
}, [onMouseLeave]);
|
|
21
23
|
return !tooltipOnEllipsis || title ? {
|
|
24
|
+
ref: comboRef,
|
|
22
25
|
title,
|
|
23
26
|
onMouseEnter,
|
|
24
27
|
onMouseLeave
|
|
25
28
|
} : {
|
|
26
|
-
ref,
|
|
29
|
+
ref: comboRef,
|
|
27
30
|
title: tooltip,
|
|
28
31
|
onMouseEnter: handleMouseEnter,
|
|
29
32
|
onMouseLeave: handleMouseLeave
|
|
@@ -3,4 +3,5 @@ export * from './hooks/useEllipsisTooltip';
|
|
|
3
3
|
export * from './components/Body/Body.types';
|
|
4
4
|
export * from './components/Heading/Heading.types';
|
|
5
5
|
export * from './components/Code/Code.types';
|
|
6
|
+
export * from './components/Base/Base.types';
|
|
6
7
|
export * from './Typography.types';
|
|
@@ -13,7 +13,7 @@ const SvgLoaderLarge = (props) => {
|
|
|
13
13
|
const {
|
|
14
14
|
name: themeName
|
|
15
15
|
} = redisUiStyles.useTheme();
|
|
16
|
-
const Comp = icons[themeName] || icons.default;
|
|
16
|
+
const Comp = icons[themeName.replace(/-?[0-9]/, "")] || icons.default;
|
|
17
17
|
return jsxRuntime.j.jsx(Comp, {
|
|
18
18
|
...props
|
|
19
19
|
});
|
|
@@ -11,7 +11,7 @@ const SvgLoaderLarge = (props) => {
|
|
|
11
11
|
const {
|
|
12
12
|
name: themeName
|
|
13
13
|
} = useTheme();
|
|
14
|
-
const Comp = icons[themeName] || icons.default;
|
|
14
|
+
const Comp = icons[themeName.replace(/-?[0-9]/, "")] || icons.default;
|
|
15
15
|
return jsxRuntimeExports.jsx(Comp, {
|
|
16
16
|
...props
|
|
17
17
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis-ui/components",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "41.
|
|
4
|
+
"version": "41.4.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"publishConfig": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"test": "vitest"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@redis-ui/icons": "^6.
|
|
31
|
-
"@redis-ui/styles": "^13.
|
|
30
|
+
"@redis-ui/icons": "^6.4.0",
|
|
31
|
+
"@redis-ui/styles": "^13.3.2",
|
|
32
32
|
"react": "^17.0.0 || ^18.0.0",
|
|
33
33
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
34
34
|
"styled-components": "^5.0.0"
|