@clayui/tooltip 3.141.2-alpha.0 → 3.143.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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ import React from 'react';
6
+ export declare const ALIGN_POSITIONS: readonly ["top", "top-left", "top-right", "bottom", "bottom-left", "bottom-right", "left", "right"];
7
+ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * Position in which the tooltip will be aligned to the element.
10
+ */
11
+ alignPosition?: typeof ALIGN_POSITIONS[number];
12
+ /**
13
+ * Flag to indicate if tooltip is displayed.
14
+ */
15
+ show?: boolean;
16
+ }
17
+ export declare const Tooltip: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLElement>>;
18
+ export {};
@@ -0,0 +1,37 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ import { IPortalBaseProps } from '@clayui/shared';
6
+ import React from 'react';
7
+ declare type TContentRenderer = (props: {
8
+ targetNode?: HTMLElement | null;
9
+ title: string;
10
+ }) => React.ReactElement | React.ReactNode;
11
+ declare type Props = {
12
+ /**
13
+ * Flag to indicate if tooltip should automatically align based on the window
14
+ */
15
+ autoAlign?: boolean;
16
+ /**
17
+ * Props to add to the `<ClayPortal/>`.
18
+ */
19
+ containerProps?: IPortalBaseProps;
20
+ /**
21
+ * Custom function for rendering the contents of the tooltip
22
+ */
23
+ contentRenderer?: TContentRenderer;
24
+ /**
25
+ * Delay in miliseconds before showing tooltip
26
+ */
27
+ delay?: number;
28
+ children?: React.ReactElement;
29
+ /**
30
+ * CSS selector to scope provider to. All titles within this scope will be
31
+ * rendered in the tooltip. Titles outside of this scope will be styled
32
+ * as with the default browser.
33
+ */
34
+ scope?: string;
35
+ };
36
+ export declare const ClayTooltipProvider: ({ autoAlign, children, containerProps, contentRenderer, delay, scope, }: Props) => JSX.Element;
37
+ export {};
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ import { Tooltip } from './Tooltip';
6
+ import { ClayTooltipProvider } from './TooltipProvider';
7
+ export { Tooltip, ClayTooltipProvider };
8
+ export default Tooltip;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ import React from 'react';
6
+ declare const ALIGNMENTS: readonly ["top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left"];
7
+ export declare type Align = typeof ALIGNMENTS[number];
8
+ declare type Props = {
9
+ align: Align;
10
+ autoAlign: boolean;
11
+ floating: boolean;
12
+ isOpen: boolean;
13
+ onAlign: (align: Align) => void;
14
+ sourceElement: React.MutableRefObject<HTMLElement | null>;
15
+ targetElement: React.MutableRefObject<HTMLElement | null>;
16
+ title: string;
17
+ };
18
+ export declare function useAlign({ align, autoAlign, floating, isOpen, onAlign, sourceElement, targetElement, title, }: Props): void;
19
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ import React from 'react';
6
+ declare type Props = {
7
+ forceHide: () => void;
8
+ onHide: () => void;
9
+ onClick: () => void;
10
+ tooltipRef: React.MutableRefObject<HTMLElement | null>;
11
+ };
12
+ export declare function useClosestTitle(props: Props): {
13
+ forceHide: () => void;
14
+ getProps: (event: React.MouseEvent<HTMLElement, MouseEvent>, hideBrowserTitle: boolean) => {
15
+ align: string | null;
16
+ delay: string | null;
17
+ floating: boolean;
18
+ setAsHTML: boolean;
19
+ title: string;
20
+ } | undefined;
21
+ onHide: (event?: any) => null | undefined;
22
+ target: React.MutableRefObject<HTMLElement | null>;
23
+ titleNode: React.MutableRefObject<HTMLElement | null>;
24
+ };
25
+ export {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com>
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ */
5
+ declare type Props = {
6
+ delay?: number;
7
+ };
8
+ export declare function useTooltipState({ delay }: Props): {
9
+ close: () => void;
10
+ isOpen: boolean;
11
+ open: (immediate: boolean, customDelay?: number) => void;
12
+ };
13
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clayui/tooltip",
3
- "version": "3.141.2-alpha.0",
3
+ "version": "3.143.0",
4
4
  "description": "ClayTooltip component",
5
5
  "license": "BSD-3-Clause",
6
6
  "repository": "https://github.com/liferay/clay",
@@ -28,18 +28,18 @@
28
28
  "react"
29
29
  ],
30
30
  "dependencies": {
31
- "@clayui/shared": "^3.141.2-alpha.0",
31
+ "@clayui/shared": "^3.143.0",
32
32
  "classnames": "^2.2.6",
33
33
  "dom-align": "^1.12.2",
34
34
  "warning": "^4.0.3"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@clayui/css": "3.x",
38
- "react": "^16.12.0",
39
- "react-dom": "^16.12.0"
38
+ "react": "^18.2.0",
39
+ "react-dom": "^18.2.0"
40
40
  },
41
41
  "browserslist": [
42
42
  "extends browserslist-config-clay"
43
43
  ],
44
- "gitHead": "aea6ecdaee62ccc374009982f934e1b193785668"
44
+ "gitHead": "aacf20646cc7fb25c4d60e865ec77d2d503d23e9"
45
45
  }