@koobiq/react-components 0.0.1-beta.28 → 0.0.1-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/Badge.js +24 -15
- package/dist/components/Badge/types.d.ts +11 -4
- package/dist/components/Tooltip/Tooltip.d.ts +5 -2
- package/dist/components/Tooltip/Tooltip.js +22 -7
- package/dist/components/Tooltip/types.d.ts +23 -5
- package/package.json +5 -5
- package/dist/components/FieldComponents/FieldNumberControl/FieldNumberControl.d.ts +0 -10
- package/dist/components/FieldComponents/FieldNumberControl/index.d.ts +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { deprecate } from "@koobiq/logger";
|
|
3
|
+
import { polymorphicForwardRef, isNotNil, clsx } from "@koobiq/react-core";
|
|
3
4
|
import s from "./Badge.module.css.js";
|
|
4
5
|
const Badge = polymorphicForwardRef(
|
|
5
6
|
({
|
|
@@ -10,22 +11,30 @@ const Badge = polymorphicForwardRef(
|
|
|
10
11
|
startIcon,
|
|
11
12
|
endIcon,
|
|
12
13
|
label,
|
|
14
|
+
children,
|
|
13
15
|
...other
|
|
14
|
-
}, ref) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
...other,
|
|
20
|
-
ref,
|
|
21
|
-
className: clsx(s.base, s[size], s[variant], className),
|
|
22
|
-
children: [
|
|
23
|
-
startIcon,
|
|
24
|
-
/* @__PURE__ */ jsx("span", { className: s.label, children: label }),
|
|
25
|
-
endIcon
|
|
26
|
-
]
|
|
16
|
+
}, ref) => {
|
|
17
|
+
if (process.env.NODE_ENV !== "production" && isNotNil(label)) {
|
|
18
|
+
deprecate(
|
|
19
|
+
'Badge. The "label" prop is deprecated. Use "children" prop to replace it.'
|
|
20
|
+
);
|
|
27
21
|
}
|
|
28
|
-
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
Tag,
|
|
24
|
+
{
|
|
25
|
+
"data-variant": variant,
|
|
26
|
+
"data-size": size,
|
|
27
|
+
...other,
|
|
28
|
+
ref,
|
|
29
|
+
className: clsx(s.base, s[size], s[variant], className),
|
|
30
|
+
children: [
|
|
31
|
+
startIcon,
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: s.label, children: children ?? label }),
|
|
33
|
+
endIcon
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
29
38
|
);
|
|
30
39
|
export {
|
|
31
40
|
Badge
|
|
@@ -3,18 +3,25 @@ export declare const badgePropSize: readonly ["compact", "normal"];
|
|
|
3
3
|
export type BadgePropSize = (typeof badgePropSize)[number];
|
|
4
4
|
export declare const badgePropVariant: readonly ["theme", "fade-theme", "outline-fade-theme", "error", "fade-error", "outline-fade-error", "warning", "fade-warning", "outline-fade-warning", "success", "fade-success", "outline-fade-success", "contrast", "fade-contrast", "outline-fade-contrast"];
|
|
5
5
|
export type BadgePropVariant = (typeof badgePropVariant)[number];
|
|
6
|
+
type BadgeBaseDeprecatedProps = {
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
* The "label" prop is deprecated. Use "children" prop to replace it.
|
|
10
|
+
* The label of the component. */
|
|
11
|
+
label?: ReactNode;
|
|
12
|
+
};
|
|
6
13
|
export type BadgeBaseProps = {
|
|
7
14
|
/** The variant to use. */
|
|
8
15
|
variant?: BadgePropVariant;
|
|
9
16
|
/** The size of the component. */
|
|
10
17
|
size?: BadgePropSize;
|
|
11
|
-
/** The
|
|
12
|
-
|
|
18
|
+
/** The content of the component. */
|
|
19
|
+
children?: ReactNode;
|
|
13
20
|
/** Icon placed before the children. */
|
|
14
21
|
startIcon?: ReactNode;
|
|
15
22
|
/** Icon placed after the children. */
|
|
16
23
|
endIcon?: ReactNode;
|
|
17
24
|
/** Additional CSS-classes. */
|
|
18
25
|
className?: string;
|
|
19
|
-
|
|
20
|
-
};
|
|
26
|
+
} & BadgeBaseDeprecatedProps;
|
|
27
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export declare const Tooltip: import("react").ForwardRefExoticComponent<{
|
|
2
2
|
variant?: import("./types").TooltipPropVariant;
|
|
3
|
-
|
|
3
|
+
isOpen?: boolean;
|
|
4
4
|
defaultOpen?: boolean;
|
|
5
5
|
onOpenChange?(open: boolean): void;
|
|
6
|
-
|
|
6
|
+
isDisabled?: boolean;
|
|
7
7
|
children?: import("react").ReactNode;
|
|
8
8
|
control?: import("./types").TooltipPropControl;
|
|
9
9
|
placement?: import("./types").TooltipPropPlacement;
|
|
@@ -18,4 +18,7 @@ export declare const Tooltip: import("react").ForwardRefExoticComponent<{
|
|
|
18
18
|
id?: string;
|
|
19
19
|
className?: string;
|
|
20
20
|
portalContainer?: Element;
|
|
21
|
+
} & {
|
|
22
|
+
open?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
21
24
|
} & import("@koobiq/react-core").DataAttributeProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useRef } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { deprecate } from "@koobiq/logger";
|
|
5
|
+
import { isNotNil, useDOMRef, useMultiRef, useBoolean, mergeProps, clsx, FocusableProvider } from "@koobiq/react-core";
|
|
5
6
|
import { useTooltipTriggerState, useTooltipTrigger, useOverlayPosition, useTooltip, Overlay } from "@koobiq/react-primitives";
|
|
6
7
|
import { Transition } from "react-transition-group";
|
|
7
8
|
import { utilClasses } from "../../styles/utility.js";
|
|
@@ -9,7 +10,10 @@ import s from "./Tooltip.module.css.js";
|
|
|
9
10
|
const Tooltip = forwardRef((props, ref) => {
|
|
10
11
|
const {
|
|
11
12
|
delay = 120,
|
|
12
|
-
disabled
|
|
13
|
+
disabled,
|
|
14
|
+
open,
|
|
15
|
+
isDisabled: isDisabledProp,
|
|
16
|
+
isOpen: isOpenProp,
|
|
13
17
|
closeDelay = 120,
|
|
14
18
|
hideArrow = false,
|
|
15
19
|
variant = "contrast",
|
|
@@ -20,12 +24,23 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
20
24
|
crossOffset,
|
|
21
25
|
defaultOpen,
|
|
22
26
|
onOpenChange,
|
|
23
|
-
open: openProp,
|
|
24
27
|
portalContainer,
|
|
25
28
|
offset: offsetProp,
|
|
26
29
|
arrowBoundaryOffset,
|
|
27
30
|
...other
|
|
28
31
|
} = props;
|
|
32
|
+
const isOpen = isOpenProp ?? open;
|
|
33
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
34
|
+
if (process.env.NODE_ENV !== "production" && isNotNil(open)) {
|
|
35
|
+
deprecate(
|
|
36
|
+
'Tooltip. The "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (process.env.NODE_ENV !== "production" && isNotNil(disabled)) {
|
|
40
|
+
deprecate(
|
|
41
|
+
'Tooltip. The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
|
|
42
|
+
);
|
|
43
|
+
}
|
|
29
44
|
const showArrow = !hideArrow;
|
|
30
45
|
const offset = showArrow ? offsetProp : offsetProp || 4;
|
|
31
46
|
const state = useTooltipTriggerState({
|
|
@@ -33,8 +48,8 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
33
48
|
closeDelay,
|
|
34
49
|
defaultOpen,
|
|
35
50
|
onOpenChange,
|
|
36
|
-
isOpen
|
|
37
|
-
isDisabled
|
|
51
|
+
isOpen,
|
|
52
|
+
isDisabled,
|
|
38
53
|
...other
|
|
39
54
|
});
|
|
40
55
|
const domRef = useDOMRef(ref);
|
|
@@ -43,11 +58,11 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
43
58
|
const { triggerProps, tooltipProps: tooltipTriggerProps } = useTooltipTrigger(
|
|
44
59
|
{
|
|
45
60
|
delay,
|
|
61
|
+
isOpen,
|
|
62
|
+
isDisabled,
|
|
46
63
|
closeDelay,
|
|
47
64
|
defaultOpen,
|
|
48
65
|
onOpenChange,
|
|
49
|
-
isOpen: openProp,
|
|
50
|
-
isDisabled: disabled,
|
|
51
66
|
...other
|
|
52
67
|
},
|
|
53
68
|
state,
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import type { ReactNode, RefObject, ComponentRef, ReactElement, DOMAttributes } from 'react';
|
|
2
2
|
import type { DataAttributeProps } from '@koobiq/react-core';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { FocusableElement } from '@koobiq/react-primitives';
|
|
4
|
+
export type TooltipPropControl = (props: DOMAttributes<FocusableElement | null> & {
|
|
5
|
+
ref: ((node: FocusableElement | null) => void) | null;
|
|
5
6
|
}) => ReactElement;
|
|
6
7
|
export declare const tooltipPropPlacement: readonly ["bottom", "bottom start", "bottom end", "top", "top start", "top end", "start", "start top", "start bottom", "end", "end top", "end bottom"];
|
|
7
8
|
export declare const tooltipPropVariant: readonly ["contrast", "contrast-fade", "error", "warning", "theme"];
|
|
8
9
|
export type TooltipPropVariant = (typeof tooltipPropVariant)[number];
|
|
9
10
|
export type TooltipPropPlacement = (typeof tooltipPropPlacement)[number];
|
|
11
|
+
type TooltipDeprecatedProps = {
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
* The "open" prop is deprecated. Use "isOpen" prop to replace it.
|
|
15
|
+
* If `true`, the component is shown.
|
|
16
|
+
* @default false
|
|
17
|
+
* */
|
|
18
|
+
open?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated
|
|
21
|
+
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
22
|
+
* If `true`, the component is disabled.
|
|
23
|
+
* @default false
|
|
24
|
+
* */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
};
|
|
10
27
|
export type TooltipProps = {
|
|
11
28
|
/**
|
|
12
29
|
* The variant to use.
|
|
@@ -14,7 +31,7 @@ export type TooltipProps = {
|
|
|
14
31
|
* */
|
|
15
32
|
variant?: TooltipPropVariant;
|
|
16
33
|
/** If `true`, the component is shown. */
|
|
17
|
-
|
|
34
|
+
isOpen?: boolean;
|
|
18
35
|
/** The default open state. Use when the component is not controlled. */
|
|
19
36
|
defaultOpen?: boolean;
|
|
20
37
|
/** Handler that is called when the overlay's open state changes. */
|
|
@@ -23,7 +40,7 @@ export type TooltipProps = {
|
|
|
23
40
|
* If `true`, the tooltip should be disabled, independent of the trigger.
|
|
24
41
|
* @default false
|
|
25
42
|
* */
|
|
26
|
-
|
|
43
|
+
isDisabled?: boolean;
|
|
27
44
|
/** The content of the component. */
|
|
28
45
|
children?: ReactNode;
|
|
29
46
|
/** The render function of the control for displaying the tooltip. */
|
|
@@ -82,5 +99,6 @@ export type TooltipProps = {
|
|
|
82
99
|
* @default document.body
|
|
83
100
|
*/
|
|
84
101
|
portalContainer?: Element;
|
|
85
|
-
} & DataAttributeProps;
|
|
102
|
+
} & TooltipDeprecatedProps & DataAttributeProps;
|
|
86
103
|
export type TooltipRef = ComponentRef<'div'>;
|
|
104
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koobiq/react-components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.29",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"@koobiq/design-tokens": "^3.12.1",
|
|
28
28
|
"@types/react-transition-group": "^4.4.12",
|
|
29
29
|
"react-transition-group": "^4.4.5",
|
|
30
|
-
"@koobiq/logger": "0.0.1-beta.
|
|
31
|
-
"@koobiq/react-core": "0.0.1-beta.
|
|
32
|
-
"@koobiq/react-
|
|
33
|
-
"@koobiq/react-
|
|
30
|
+
"@koobiq/logger": "0.0.1-beta.29",
|
|
31
|
+
"@koobiq/react-core": "0.0.1-beta.29",
|
|
32
|
+
"@koobiq/react-primitives": "0.0.1-beta.29",
|
|
33
|
+
"@koobiq/react-icons": "0.0.1-beta.29"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@koobiq/design-tokens": "^3.11.2",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { type NumberFieldProps, type NumberFieldRef } from '@koobiq/react-primitives';
|
|
2
|
-
export type FieldNumberControlProps = NumberFieldProps & {
|
|
3
|
-
fullWidth?: boolean;
|
|
4
|
-
className?: string;
|
|
5
|
-
};
|
|
6
|
-
export type FieldNumberControlRef = NumberFieldRef;
|
|
7
|
-
export declare const FieldNumberControl: import("react").ForwardRefExoticComponent<Omit<import("@koobiq/react-primitives").UseNumberFieldProps, keyof import("@koobiq/react-primitives").RenderProps<import("@koobiq/react-primitives").NumberFieldRenderProps>> & import("@koobiq/react-primitives").RenderProps<import("@koobiq/react-primitives").NumberFieldRenderProps> & {
|
|
8
|
-
fullWidth?: boolean;
|
|
9
|
-
className?: string;
|
|
10
|
-
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './FieldNumberControl';
|