@instructure/ui-tooltip 8.8.1-snapshot.3 → 8.9.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/src/index.ts CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  export { Tooltip } from './Tooltip'
25
- export type { TooltipProps } from './Tooltip/types'
25
+ export type { TooltipProps } from './Tooltip/props'
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { jsx } from '@instructure/emotion';
5
- import { TooltipProps } from './types';
4
+ import type { TooltipProps } from './props';
6
5
  /**
7
6
  ---
8
7
  category: components
@@ -10,93 +9,50 @@ category: components
10
9
  **/
11
10
  declare class Tooltip extends Component<TooltipProps> {
12
11
  static readonly componentId = "Tooltip";
13
- static propTypes: {
14
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
15
- styles: PropTypes.Requireable<object>;
16
- /**
17
- * @param {Object} renderProps
18
- * @param {Boolean} renderProps.focused - Is the Tooltip trigger focused?
19
- * @param {Function} renderProps.getTriggerProps - Props to be spread onto the trigger element
20
- */
21
- children: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
22
- /**
23
- * The content to render in the tooltip
24
- */
25
- renderTip: PropTypes.Validator<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
26
- /**
27
- * Whether or not the tooltip content is shown, when controlled
28
- */
29
- isShowingContent: PropTypes.Requireable<boolean>;
30
- /**
31
- * Whether or not to show the content by default, when uncontrolled
32
- */
33
- defaultIsShowingContent: PropTypes.Requireable<boolean>;
34
- /**
35
- * the element type to render as (assumes a single child if 'as' is undefined)
36
- */
37
- as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
38
- /**
39
- * The action that causes the Content to display (`click`, `hover`, `focus`)
40
- */
41
- on: PropTypes.Requireable<string | (string | null | undefined)[]>;
42
- /**
43
- * The color of the tooltip content
44
- */
45
- color: PropTypes.Requireable<string>;
46
- /**
47
- * Specifies where the Tooltip will be placed in relation to the target element.
48
- * Ex. placement="bottom" will render the Tooltip below the triggering element
49
- * (Note: if there is not room, it will position opposite. Ex. "top" will
50
- * automatically switch to "bottom")
51
- */
52
- placement: PropTypes.Requireable<string>;
53
- /**
54
- * An element or a function returning an element to use as the mount node
55
- * for the `<Tooltip />` (defaults to `document.body`)
56
- */
57
- mountNode: PropTypes.Requireable<Element | PropTypes.ReactElementLike | ((...args: any[]) => any)>;
58
- /**
59
- * The parent in which to constrain the tooltip.
60
- * One of: 'window', 'scroll-parent', 'parent', 'none', an element,
61
- * or a function returning an element
62
- */
63
- constrain: PropTypes.Requireable<string | Element | PropTypes.ReactElementLike | ((...args: any[]) => any)>;
64
- /**
65
- * The horizontal offset for the positioned content
66
- */
67
- offsetX: PropTypes.Requireable<string | number>;
68
- /**
69
- * The vertical offset for the positioned content
70
- */
71
- offsetY: PropTypes.Requireable<string | number>;
72
- /**
73
- * Target element for positioning the Tooltip (if it differs from children/trigger)
74
- */
75
- positionTarget: PropTypes.Requireable<Element | ((...args: any[]) => any) | PropTypes.ReactElementLike>;
76
- /**
77
- * Callback fired when content is shown. When controlled, this callback is
78
- * fired when the tooltip expects to be shown
79
- */
80
- onShowContent: PropTypes.Requireable<(...args: any[]) => any>;
81
- /**
82
- * Callback fired when content is hidden. When controlled, this callback is
83
- * fired when the tooltip expects to be hidden
84
- */
85
- onHideContent: PropTypes.Requireable<(...args: any[]) => any>;
86
- };
12
+ static allowedProps: readonly (keyof {
13
+ renderTip: import("react").ReactNode | ((...args: any[]) => any);
14
+ children: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
15
+ isShowingContent?: boolean | undefined;
16
+ defaultIsShowingContent?: boolean | undefined;
17
+ as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
18
+ on?: "click" | "hover" | "focus" | ("click" | "hover" | "focus")[] | undefined;
19
+ color?: "primary" | "primary-inverse" | undefined;
20
+ placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
21
+ mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
22
+ constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
23
+ positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
24
+ offsetX?: string | number | undefined;
25
+ offsetY?: string | number | undefined;
26
+ onShowContent?: ((...args: any[]) => any) | undefined;
27
+ onHideContent?: ((...args: any[]) => any) | undefined;
28
+ })[];
29
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
30
+ renderTip: import("react").ReactNode | ((...args: any[]) => any);
31
+ children: import("react").ReactNode | ((...args: any[]) => import("react").ReactNode);
32
+ isShowingContent?: boolean | undefined;
33
+ defaultIsShowingContent?: boolean | undefined;
34
+ as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
35
+ on?: "click" | "hover" | "focus" | ("click" | "hover" | "focus")[] | undefined;
36
+ color?: "primary" | "primary-inverse" | undefined;
37
+ placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
38
+ mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
39
+ constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
40
+ positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
41
+ offsetX?: string | number | undefined;
42
+ offsetY?: string | number | undefined;
43
+ onShowContent?: ((...args: any[]) => any) | undefined;
44
+ onHideContent?: ((...args: any[]) => any) | undefined;
45
+ }>;
87
46
  static defaultProps: {
88
- isShowingContent: undefined;
89
- defaultIsShowingContent: boolean;
90
- on: undefined;
91
- color: string;
92
- placement: string;
93
- mountNode: null;
94
- constrain: string;
95
- offsetX: number;
96
- offsetY: number;
97
- positionTarget: undefined;
98
- onShowContent: (event: any) => void;
99
- onHideContent: (event: any, { documentClick }: {
47
+ readonly defaultIsShowingContent: false;
48
+ readonly color: "primary";
49
+ readonly placement: "top";
50
+ readonly mountNode: null;
51
+ readonly constrain: "window";
52
+ readonly offsetX: 0;
53
+ readonly offsetY: 0;
54
+ readonly onShowContent: (event: any) => void;
55
+ readonly onHideContent: (event: any, { documentClick }: {
100
56
  documentClick: any;
101
57
  }) => void;
102
58
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,SAAS,MAAM,YAAY,CAAA;AAclC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,CAAC;IAC3C,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,SAAS;;;QAKd;;;;WAIG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAKH;;WAEG;;QAEH;;;;;WAKG;;QAEH;;;WAGG;;QAEH;;;;WAIG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;;WAGG;;QAEH;;;WAGG;;MAEJ;IAED,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;MAelB;IAED,GAAG,SAAiB;IACpB,KAAK;;MAAsB;IAE3B,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAMjD,WAAW,uBAEV;IAGD,UAAU,uBAET;IAED,aAAa;IA+Bb,MAAM;CA+CP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,CAAC;IAC3C,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;;;;;;MAYT;IAEV,GAAG,SAAiB;IACpB,KAAK;;MAAsB;IAE3B,iBAAiB;IAKjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,WAAW,uBAEV;IAGD,UAAU,uBAET;IAED,aAAa;IAgCb,MAAM;CA+CP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -1,10 +1,10 @@
1
- /// <reference types="react" />
2
- import { AsElementType } from '@instructure/shared-types';
1
+ import type { PropValidators, AsElementType } from '@instructure/shared-types';
3
2
  import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
4
- export declare type TooltipProps = {
5
- makeStyles?: (...args: any[]) => any;
6
- styles?: any;
3
+ import React from 'react';
4
+ import type { WithStyleProps } from '@instructure/emotion';
5
+ declare type TooltipOwnProps = {
7
6
  renderTip: React.ReactNode | ((...args: any[]) => any);
7
+ children: React.ReactNode | ((...args: any[]) => React.ReactNode);
8
8
  isShowingContent?: boolean;
9
9
  defaultIsShowingContent?: boolean;
10
10
  as?: AsElementType;
@@ -19,4 +19,11 @@ export declare type TooltipProps = {
19
19
  onShowContent?: (...args: any[]) => any;
20
20
  onHideContent?: (...args: any[]) => any;
21
21
  };
22
- //# sourceMappingURL=types.d.ts.map
22
+ declare type PropKeys = keyof TooltipOwnProps;
23
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
24
+ declare type TooltipProps = TooltipOwnProps & WithStyleProps;
25
+ declare const propTypes: PropValidators<PropKeys>;
26
+ declare const allowedProps: AllowedPropKeys;
27
+ export type { TooltipProps };
28
+ export { propTypes, allowedProps };
29
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Tooltip/props.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D,aAAK,eAAe,GAAG;IACrB,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAA;IACtD,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IACjE,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAA;IACpE,KAAK,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAA;IACrC,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,cAAc,CAAC,EAAE,iBAAiB,CAAA;IAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACvC,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACxC,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,eAAe,CAAA;AAErC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,YAAY,GAAG,eAAe,GAAG,cAAc,CAAA;AAEpD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CA0EvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAgBnB,CAAA;AAED,YAAY,EAAE,YAAY,EAAE,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { Tooltip } from './Tooltip';
2
- export type { TooltipProps } from './Tooltip/types';
2
+ export type { TooltipProps } from './Tooltip/props';
3
3
  //# sourceMappingURL=index.d.ts.map
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,49 +0,0 @@
1
- /*
2
- * The MIT License (MIT)
3
- *
4
- * Copyright (c) 2015 - present Instructure, Inc.
5
- *
6
- * Permission is hereby granted, free of charge, to any person obtaining a copy
7
- * of this software and associated documentation files (the "Software"), to deal
8
- * in the Software without restriction, including without limitation the rights
9
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- * copies of the Software, and to permit persons to whom the Software is
11
- * furnished to do so, subject to the following conditions:
12
- *
13
- * The above copyright notice and this permission notice shall be included in all
14
- * copies or substantial portions of the Software.
15
- *
16
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- * SOFTWARE.
23
- */
24
-
25
- import { AsElementType } from '@instructure/shared-types'
26
- import type {
27
- PlacementPropValues,
28
- PositionConstraint,
29
- PositionMountNode
30
- } from '@instructure/ui-position'
31
-
32
- export type TooltipProps = {
33
- makeStyles?: (...args: any[]) => any
34
- styles?: any
35
- renderTip: React.ReactNode | ((...args: any[]) => any)
36
- isShowingContent?: boolean
37
- defaultIsShowingContent?: boolean
38
- as?: AsElementType
39
- on?: ('click' | 'hover' | 'focus') | ('click' | 'hover' | 'focus')[]
40
- color?: 'primary' | 'primary-inverse'
41
- placement?: PlacementPropValues
42
- mountNode?: PositionMountNode
43
- constrain?: PositionConstraint
44
- positionTarget?: PositionMountNode
45
- offsetX?: string | number
46
- offsetY?: string | number
47
- onShowContent?: (...args: any[]) => any
48
- onHideContent?: (...args: any[]) => any
49
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Tooltip/types.ts"],"names":[],"mappings":";AAwBA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EACV,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,0BAA0B,CAAA;AAEjC,oBAAY,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,SAAS,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,EAAE,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC,EAAE,CAAA;IACpE,KAAK,CAAC,EAAE,SAAS,GAAG,iBAAiB,CAAA;IACrC,SAAS,CAAC,EAAE,mBAAmB,CAAA;IAC/B,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,SAAS,CAAC,EAAE,kBAAkB,CAAA;IAC9B,cAAc,CAAC,EAAE,iBAAiB,CAAA;IAClC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACzB,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACvC,aAAa,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;CACxC,CAAA"}