@fluentui/react-tooltip 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.4

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.
Files changed (58) hide show
  1. package/CHANGELOG.json +457 -24
  2. package/CHANGELOG.md +113 -14
  3. package/MIGRATION.md +51 -43
  4. package/Spec.md +201 -337
  5. package/dist/react-tooltip.d.ts +40 -48
  6. package/lib/Tooltip.js.map +1 -1
  7. package/lib/components/Tooltip/Tooltip.d.ts +3 -2
  8. package/lib/components/Tooltip/Tooltip.js +9 -9
  9. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  10. package/lib/components/Tooltip/Tooltip.types.d.ts +32 -39
  11. package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
  12. package/lib/components/Tooltip/index.d.ts +1 -1
  13. package/lib/components/Tooltip/index.js +1 -1
  14. package/lib/components/Tooltip/index.js.map +1 -1
  15. package/lib/components/Tooltip/private/constants.d.ts +12 -0
  16. package/lib/components/Tooltip/private/constants.js +14 -0
  17. package/lib/components/Tooltip/private/constants.js.map +1 -0
  18. package/lib/components/Tooltip/renderTooltip.d.ts +1 -1
  19. package/lib/components/Tooltip/renderTooltip.js +8 -8
  20. package/lib/components/Tooltip/renderTooltip.js.map +1 -1
  21. package/lib/components/Tooltip/useTooltip.d.ts +3 -6
  22. package/lib/components/Tooltip/useTooltip.js +96 -127
  23. package/lib/components/Tooltip/useTooltip.js.map +1 -1
  24. package/lib/components/Tooltip/useTooltipStyles.d.ts +2 -1
  25. package/lib/components/Tooltip/useTooltipStyles.js +50 -23
  26. package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
  27. package/lib/index.js.map +1 -1
  28. package/lib-commonjs/Tooltip.js +1 -1
  29. package/lib-commonjs/Tooltip.js.map +1 -1
  30. package/lib-commonjs/components/Tooltip/Tooltip.d.ts +3 -2
  31. package/lib-commonjs/components/Tooltip/Tooltip.js +11 -10
  32. package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
  33. package/lib-commonjs/components/Tooltip/Tooltip.types.d.ts +32 -39
  34. package/lib-commonjs/components/Tooltip/Tooltip.types.js.map +1 -1
  35. package/lib-commonjs/components/Tooltip/index.d.ts +1 -1
  36. package/lib-commonjs/components/Tooltip/index.js +2 -10
  37. package/lib-commonjs/components/Tooltip/index.js.map +1 -1
  38. package/lib-commonjs/components/Tooltip/private/constants.d.ts +12 -0
  39. package/lib-commonjs/components/Tooltip/private/constants.js +21 -0
  40. package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -0
  41. package/lib-commonjs/components/Tooltip/renderTooltip.d.ts +1 -1
  42. package/lib-commonjs/components/Tooltip/renderTooltip.js +13 -14
  43. package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
  44. package/lib-commonjs/components/Tooltip/useTooltip.d.ts +3 -6
  45. package/lib-commonjs/components/Tooltip/useTooltip.js +104 -135
  46. package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
  47. package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +2 -1
  48. package/lib-commonjs/components/Tooltip/useTooltipStyles.js +56 -26
  49. package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
  50. package/lib-commonjs/index.js +1 -1
  51. package/lib-commonjs/index.js.map +1 -1
  52. package/package.json +12 -14
  53. package/lib/common/isConformant.d.ts +0 -4
  54. package/lib/common/isConformant.js +0 -11
  55. package/lib/common/isConformant.js.map +0 -1
  56. package/lib-commonjs/common/isConformant.d.ts +0 -4
  57. package/lib-commonjs/common/isConformant.js +0 -22
  58. package/lib-commonjs/common/isConformant.js.map +0 -1
@@ -1,9 +1,9 @@
1
1
  import type { ComponentProps } from '@fluentui/react-utilities';
2
2
  import type { ComponentState } from '@fluentui/react-utilities';
3
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
- import type { IntrinsicShorthandProps } from '@fluentui/react-utilities';
3
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
5
4
  import type { PositioningShorthand } from '@fluentui/react-positioning';
6
5
  import * as React_2 from 'react';
6
+ import type { Slot } from '@fluentui/react-utilities';
7
7
 
8
8
  /**
9
9
  * Data for the Tooltip's onVisibleChange event.
@@ -15,32 +15,37 @@ export declare type OnVisibleChangeData = {
15
15
  /**
16
16
  * Render the final JSX of Tooltip
17
17
  */
18
- export declare const renderTooltip: (state: TooltipState) => JSX.Element;
18
+ export declare const renderTooltip_unstable: (state: TooltipState) => JSX.Element;
19
19
 
20
20
  /**
21
21
  * A tooltip provides light weight contextual information on top of its target element.
22
22
  */
23
- export declare const Tooltip: ForwardRefComponent<TooltipProps>;
23
+ export declare const Tooltip: React_2.FC<TooltipProps> & FluentTriggerComponent;
24
+
25
+ export declare const tooltipClassName = "fui-Tooltip";
24
26
 
25
27
  /**
26
28
  * Properties and state for Tooltip
27
29
  */
28
- export declare type TooltipCommons = {
29
- /**
30
- * A tooltip can appear with the default appearance or inverted.
31
- * When not specified, the default appearance is used.
32
- */
33
- appearance?: 'inverted';
30
+ declare type TooltipCommons = {
34
31
  /**
35
- * The content displayed inside the tooltip.
32
+ * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.
33
+ *
34
+ * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons
35
+ * displaying only an icon, for example.
36
+ * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.
37
+ * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to
38
+ * screen readers, and should only be used if the tooltip's text is available by some other means.
36
39
  */
37
- content: React_2.ReactNode;
40
+ relationship: 'label' | 'description' | 'inaccessible';
38
41
  /**
39
- * Color variant with inverted colors
42
+ * The tooltip's visual appearance.
43
+ * * `normal` - Uses the theme's background and text colors.
44
+ * * `inverted` - Higher contrast variant that uses the theme's inverted colors.
40
45
  *
41
- * @defaultvalue false
46
+ * @defaultvalue normal
42
47
  */
43
- inverted?: boolean;
48
+ appearance?: 'normal' | 'inverted';
44
49
  /**
45
50
  * Render an arrow pointing to the target element
46
51
  *
@@ -66,16 +71,6 @@ export declare type TooltipCommons = {
66
71
  * Notification when the visibility of the tooltip is changing
67
72
  */
68
73
  onVisibleChange?: (event: React_2.PointerEvent<HTMLElement> | React_2.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
69
- /**
70
- * Specifies which aria attribute to set on the trigger element.
71
- * * `label` - Set aria-label to the tooltip's content. Requires content to be a string; if not, uses `labelledby`.
72
- * * `labelledby` - Set aria-labelledby to the tooltip's id. The id is generated if not provided.
73
- * * `describedby` - Set aria-describedby to the tooltip's id. The id is generated if not provided.
74
- * * null - Do not set any aria attributes on the trigger element.
75
- *
76
- * @defaultvalue label
77
- */
78
- triggerAriaAttribute: 'label' | 'labelledby' | 'describedby' | null;
79
74
  /**
80
75
  * Delay before the tooltip is shown, in milliseconds.
81
76
  *
@@ -93,36 +88,35 @@ export declare type TooltipCommons = {
93
88
  /**
94
89
  * Properties for Tooltip
95
90
  */
96
- export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'content'>> & Pick<TooltipCommons, 'content'>;
91
+ export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'relationship'>> & Pick<TooltipCommons, 'relationship'> & {
92
+ /**
93
+ * The tooltip can have a single JSX child, or a render function that accepts TooltipTriggerProps.
94
+ *
95
+ * If no child is provided, the tooltip's target must be set with the `positioning` prop, and its
96
+ * visibility must be controlled with the `visible` prop.
97
+ */
98
+ children?: (React_2.ReactElement & {
99
+ ref?: React_2.Ref<unknown>;
100
+ }) | ((props: TooltipTriggerProps) => React_2.ReactElement | null) | null;
101
+ };
97
102
 
98
103
  /**
99
104
  * Slot properties for Tooltip
100
105
  */
101
106
  export declare type TooltipSlots = {
102
- root: Omit<IntrinsicShorthandProps<'div'>, 'children'> & {
103
- /**
104
- * The child is the element that triggers the Tooltip. It will have additional properties added,
105
- * including events and aria properties.
106
- * Alternatively, children can be a render function that takes the props and adds
107
- * them to the appropriate elements.
108
- */
109
- children?: (React_2.ReactElement<React_2.HTMLAttributes<HTMLElement>> & {
110
- ref?: React_2.Ref<unknown>;
111
- }) | ((props: TooltipTriggerProps) => React_2.ReactNode) | null;
112
- };
107
+ /**
108
+ * The text or JSX content of the tooltip.
109
+ */
110
+ content: NonNullable<Slot<'div'>>;
113
111
  };
114
112
 
115
113
  /**
116
114
  * State used in rendering Tooltip
117
115
  */
118
116
  export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
117
+ children?: React_2.ReactElement | null;
119
118
  /**
120
119
  * Whether the tooltip should be rendered to the DOM.
121
- *
122
- * Normally the tooltip will only be rendered when visible. However, if
123
- * triggerAriaAttribute is labelledby or describedby, the tooltip will
124
- * always be rendered even when hidden so that those aria attributes
125
- * to always refer to a valid DOM element.
126
120
  */
127
121
  shouldRenderTooltip?: boolean;
128
122
  /**
@@ -145,18 +139,16 @@ export declare type TooltipTriggerProps = {
145
139
  /**
146
140
  * Create the state required to render Tooltip.
147
141
  *
148
- * The returned state can be modified with hooks such as useTooltipStyles,
149
- * before being passed to renderTooltip.
142
+ * The returned state can be modified with hooks such as useTooltipStyles_unstable,
143
+ * before being passed to renderTooltip_unstable.
150
144
  *
151
145
  * @param props - props from this instance of Tooltip
152
- * @param ref - reference to root HTMLElement of Tooltip
153
- * @param defaultProps - (optional) default prop values provided by the implementing type
154
146
  */
155
- export declare const useTooltip: (props: TooltipProps, ref: React_2.Ref<HTMLDivElement>) => TooltipState;
147
+ export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;
156
148
 
157
149
  /**
158
150
  * Apply styling to the Tooltip slots based on the state
159
151
  */
160
- export declare const useTooltipStyles: (state: TooltipState) => TooltipState;
152
+ export declare const useTooltipStyles_unstable: (state: TooltipState) => TooltipState;
161
153
 
162
154
  export { }
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../src/Tooltip.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"../src/","sources":["Tooltip.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Tooltip/index';\n"]}
@@ -1,6 +1,7 @@
1
+ import * as React from 'react';
1
2
  import type { TooltipProps } from './Tooltip.types';
2
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
3
4
  /**
4
5
  * A tooltip provides light weight contextual information on top of its target element.
5
6
  */
6
- export declare const Tooltip: ForwardRefComponent<TooltipProps>;
7
+ export declare const Tooltip: React.FC<TooltipProps> & FluentTriggerComponent;
@@ -1,15 +1,15 @@
1
- import * as React from 'react';
2
- import { useTooltip } from './useTooltip';
3
- import { renderTooltip } from './renderTooltip';
4
- import { useTooltipStyles } from './useTooltipStyles';
1
+ import { useTooltip_unstable } from './useTooltip';
2
+ import { renderTooltip_unstable } from './renderTooltip';
3
+ import { useTooltipStyles_unstable } from './useTooltipStyles';
5
4
  /**
6
5
  * A tooltip provides light weight contextual information on top of its target element.
7
6
  */
8
7
 
9
- export var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
- var state = useTooltip(props, ref);
11
- useTooltipStyles(state);
12
- return renderTooltip(state);
13
- });
8
+ export const Tooltip = props => {
9
+ const state = useTooltip_unstable(props);
10
+ useTooltipStyles_unstable(state);
11
+ return renderTooltip_unstable(state);
12
+ };
14
13
  Tooltip.displayName = 'Tooltip';
14
+ Tooltip.isFluentTriggerComponent = true;
15
15
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,UAAT,QAA2B,cAA3B;AACA,SAAS,aAAT,QAA8B,iBAA9B;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AAIA;;AAEG;;AACH,OAAO,IAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,UAAC,KAAD,EAAQ,GAAR,EAAW;AACpF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAD,EAAQ,GAAR,CAAxB;AAEA,EAAA,gBAAgB,CAAC,KAAD,CAAhB;AACA,SAAO,aAAa,CAAC,KAAD,CAApB;AACD,CALyD,CAAnD;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAIA;;AAEG;;AACH,OAAO,MAAM,OAAO,GAAoD,KAAK,IAAG;AAC9E,QAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,CAAjC;AAEA,EAAA,yBAAyB,CAAC,KAAD,CAAzB;AACA,SAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CALM;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB;AACA,OAAO,CAAC,wBAAR,GAAmC,IAAnC","sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useTooltipStyles_unstable } from './useTooltipStyles';\nimport type { TooltipProps } from './Tooltip.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A tooltip provides light weight contextual information on top of its target element.\n */\nexport const Tooltip: React.FC<TooltipProps> & FluentTriggerComponent = props => {\n const state = useTooltip_unstable(props);\n\n useTooltipStyles_unstable(state);\n return renderTooltip_unstable(state);\n};\n\nTooltip.displayName = 'Tooltip';\nTooltip.isFluentTriggerComponent = true;\n"],"sourceRoot":"../src/"}
@@ -1,41 +1,37 @@
1
1
  import * as React from 'react';
2
2
  import type { PositioningShorthand } from '@fluentui/react-positioning';
3
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
3
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
4
4
  /**
5
5
  * Slot properties for Tooltip
6
6
  */
7
7
  export declare type TooltipSlots = {
8
- root: Omit<IntrinsicShorthandProps<'div'>, 'children'> & {
9
- /**
10
- * The child is the element that triggers the Tooltip. It will have additional properties added,
11
- * including events and aria properties.
12
- * Alternatively, children can be a render function that takes the props and adds
13
- * them to the appropriate elements.
14
- */
15
- children?: (React.ReactElement<React.HTMLAttributes<HTMLElement>> & {
16
- ref?: React.Ref<unknown>;
17
- }) | ((props: TooltipTriggerProps) => React.ReactNode) | null;
18
- };
8
+ /**
9
+ * The text or JSX content of the tooltip.
10
+ */
11
+ content: NonNullable<Slot<'div'>>;
19
12
  };
20
13
  /**
21
14
  * Properties and state for Tooltip
22
15
  */
23
- export declare type TooltipCommons = {
24
- /**
25
- * A tooltip can appear with the default appearance or inverted.
26
- * When not specified, the default appearance is used.
27
- */
28
- appearance?: 'inverted';
16
+ declare type TooltipCommons = {
29
17
  /**
30
- * The content displayed inside the tooltip.
18
+ * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.
19
+ *
20
+ * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons
21
+ * displaying only an icon, for example.
22
+ * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.
23
+ * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to
24
+ * screen readers, and should only be used if the tooltip's text is available by some other means.
31
25
  */
32
- content: React.ReactNode;
26
+ relationship: 'label' | 'description' | 'inaccessible';
33
27
  /**
34
- * Color variant with inverted colors
28
+ * The tooltip's visual appearance.
29
+ * * `normal` - Uses the theme's background and text colors.
30
+ * * `inverted` - Higher contrast variant that uses the theme's inverted colors.
35
31
  *
36
- * @defaultvalue false
32
+ * @defaultvalue normal
37
33
  */
38
- inverted?: boolean;
34
+ appearance?: 'normal' | 'inverted';
39
35
  /**
40
36
  * Render an arrow pointing to the target element
41
37
  *
@@ -61,16 +57,6 @@ export declare type TooltipCommons = {
61
57
  * Notification when the visibility of the tooltip is changing
62
58
  */
63
59
  onVisibleChange?: (event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
64
- /**
65
- * Specifies which aria attribute to set on the trigger element.
66
- * * `label` - Set aria-label to the tooltip's content. Requires content to be a string; if not, uses `labelledby`.
67
- * * `labelledby` - Set aria-labelledby to the tooltip's id. The id is generated if not provided.
68
- * * `describedby` - Set aria-describedby to the tooltip's id. The id is generated if not provided.
69
- * * null - Do not set any aria attributes on the trigger element.
70
- *
71
- * @defaultvalue label
72
- */
73
- triggerAriaAttribute: 'label' | 'labelledby' | 'describedby' | null;
74
60
  /**
75
61
  * Delay before the tooltip is shown, in milliseconds.
76
62
  *
@@ -99,18 +85,24 @@ export declare type OnVisibleChangeData = {
99
85
  /**
100
86
  * Properties for Tooltip
101
87
  */
102
- export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'content'>> & Pick<TooltipCommons, 'content'>;
88
+ export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'relationship'>> & Pick<TooltipCommons, 'relationship'> & {
89
+ /**
90
+ * The tooltip can have a single JSX child, or a render function that accepts TooltipTriggerProps.
91
+ *
92
+ * If no child is provided, the tooltip's target must be set with the `positioning` prop, and its
93
+ * visibility must be controlled with the `visible` prop.
94
+ */
95
+ children?: (React.ReactElement & {
96
+ ref?: React.Ref<unknown>;
97
+ }) | ((props: TooltipTriggerProps) => React.ReactElement | null) | null;
98
+ };
103
99
  /**
104
100
  * State used in rendering Tooltip
105
101
  */
106
102
  export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
103
+ children?: React.ReactElement | null;
107
104
  /**
108
105
  * Whether the tooltip should be rendered to the DOM.
109
- *
110
- * Normally the tooltip will only be rendered when visible. However, if
111
- * triggerAriaAttribute is labelledby or describedby, the tooltip will
112
- * always be rendered even when hidden so that those aria attributes
113
- * to always refer to a valid DOM element.
114
106
  */
115
107
  shouldRenderTooltip?: boolean;
116
108
  /**
@@ -122,3 +114,4 @@ export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons
122
114
  */
123
115
  arrowClassName?: string;
124
116
  };
117
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.types.js","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"Tooltip.types.js","sourceRoot":"../src/","sources":["components/Tooltip/Tooltip.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Slot properties for Tooltip\n */\nexport type TooltipSlots = {\n /**\n * The text or JSX content of the tooltip.\n */\n content: NonNullable<Slot<'div'>>;\n};\n\n/**\n * Properties and state for Tooltip\n */\ntype TooltipCommons = {\n /**\n * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.\n *\n * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons\n * displaying only an icon, for example.\n * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.\n * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to\n * screen readers, and should only be used if the tooltip's text is available by some other means.\n */\n relationship: 'label' | 'description' | 'inaccessible';\n\n /**\n * The tooltip's visual appearance.\n * * `normal` - Uses the theme's background and text colors.\n * * `inverted` - Higher contrast variant that uses the theme's inverted colors.\n *\n * @defaultvalue normal\n */\n appearance?: 'normal' | 'inverted';\n\n /**\n * Render an arrow pointing to the target element\n *\n * @defaultvalue false\n */\n withArrow?: boolean;\n\n /**\n * Configure the positioning of the tooltip\n *\n * @defaultvalue above\n */\n positioning?: PositioningShorthand;\n\n /**\n * Control the tooltip's visibility programatically.\n *\n * This can be used in conjunction with onVisibleChange to modify the tooltip's show and hide behavior.\n *\n * If not provided, the visibility will be controlled by the tooltip itself, based on hover and focus events on the\n * trigger (child) element.\n */\n visible?: boolean;\n\n /**\n * Notification when the visibility of the tooltip is changing\n */\n onVisibleChange?: (\n event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined,\n data: OnVisibleChangeData,\n ) => void;\n\n /**\n * Delay before the tooltip is shown, in milliseconds.\n *\n * @defaultvalue 250\n */\n showDelay: number;\n\n /**\n * Delay before the tooltip is hidden, in milliseconds.\n *\n * @defaultvalue 250\n */\n hideDelay: number;\n};\n\n/**\n * The properties that are added to the trigger of the Tooltip\n */\nexport type TooltipTriggerProps = {\n ref?: React.Ref<never>;\n} & Pick<\n React.HTMLAttributes<HTMLElement>,\n 'onPointerEnter' | 'onPointerLeave' | 'onFocus' | 'onBlur' | 'aria-describedby' | 'aria-labelledby' | 'aria-label'\n>;\n\n/**\n * Data for the Tooltip's onVisibleChange event.\n */\nexport type OnVisibleChangeData = {\n visible: boolean;\n};\n\n/**\n * Properties for Tooltip\n */\nexport type TooltipProps = ComponentProps<TooltipSlots> &\n Partial<Omit<TooltipCommons, 'relationship'>> &\n Pick<TooltipCommons, 'relationship'> & {\n /**\n * The tooltip can have a single JSX child, or a render function that accepts TooltipTriggerProps.\n *\n * If no child is provided, the tooltip's target must be set with the `positioning` prop, and its\n * visibility must be controlled with the `visible` prop.\n */\n children?:\n | (React.ReactElement & { ref?: React.Ref<unknown> })\n | ((props: TooltipTriggerProps) => React.ReactElement | null)\n | null;\n };\n\n/**\n * State used in rendering Tooltip\n */\nexport type TooltipState = ComponentState<TooltipSlots> &\n TooltipCommons & {\n children?: React.ReactElement | null;\n\n /**\n * Whether the tooltip should be rendered to the DOM.\n */\n shouldRenderTooltip?: boolean;\n\n /**\n * Ref to the arrow element\n */\n arrowRef?: React.Ref<HTMLDivElement>;\n\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n"]}
@@ -2,4 +2,4 @@ export * from './Tooltip';
2
2
  export * from './Tooltip.types';
3
3
  export * from './renderTooltip';
4
4
  export * from './useTooltip';
5
- export { useTooltipStyles } from './useTooltipStyles';
5
+ export * from './useTooltipStyles';
@@ -2,5 +2,5 @@ export * from './Tooltip';
2
2
  export * from './Tooltip.types';
3
3
  export * from './renderTooltip';
4
4
  export * from './useTooltip';
5
- export { useTooltipStyles } from './useTooltipStyles';
5
+ export * from './useTooltipStyles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Tooltip';\nexport * from './Tooltip.types';\nexport * from './renderTooltip';\nexport * from './useTooltip';\nexport * from './useTooltipStyles';\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The height of the tooltip's arrow in pixels.
3
+ */
4
+ export declare const arrowHeight = 6;
5
+ /**
6
+ * The default value of the tooltip's border radius (borderRadiusMedium).
7
+ *
8
+ * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
9
+ * While we could use getComputedStyle, that adds a performance penalty for something that
10
+ * will likely never change.
11
+ */
12
+ export declare const tooltipBorderRadius = 4;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The height of the tooltip's arrow in pixels.
3
+ */
4
+ export const arrowHeight = 6;
5
+ /**
6
+ * The default value of the tooltip's border radius (borderRadiusMedium).
7
+ *
8
+ * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
9
+ * While we could use getComputedStyle, that adds a performance penalty for something that
10
+ * will likely never change.
11
+ */
12
+
13
+ export const tooltipBorderRadius = 4;
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Tooltip/private/constants.ts"],"names":[],"mappings":"AAAA;;AAEG;AACH,OAAO,MAAM,WAAW,GAAG,CAApB;AAEP;;;;;;AAMG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAA5B","sourcesContent":["/**\n * The height of the tooltip's arrow in pixels.\n */\nexport const arrowHeight = 6;\n\n/**\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const tooltipBorderRadius = 4;\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { TooltipState } from './Tooltip.types';
2
2
  /**
3
3
  * Render the final JSX of Tooltip
4
4
  */
5
- export declare const renderTooltip: (state: TooltipState) => JSX.Element;
5
+ export declare const renderTooltip_unstable: (state: TooltipState) => JSX.Element;
@@ -1,4 +1,3 @@
1
- import { __assign } from "tslib";
2
1
  import * as React from 'react';
3
2
  import { Portal } from '@fluentui/react-portal';
4
3
  import { getSlots } from '@fluentui/react-utilities';
@@ -6,14 +5,15 @@ import { getSlots } from '@fluentui/react-utilities';
6
5
  * Render the final JSX of Tooltip
7
6
  */
8
7
 
9
- export var renderTooltip = function (state) {
10
- var _a = getSlots(state, ['root']),
11
- slots = _a.slots,
12
- slotProps = _a.slotProps;
13
-
14
- return /*#__PURE__*/React.createElement(React.Fragment, null, state.root.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root, __assign({}, slotProps.root), state.withArrow && /*#__PURE__*/React.createElement("div", {
8
+ export const renderTooltip_unstable = state => {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = getSlots(state);
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
14
+ }, state.withArrow && /*#__PURE__*/React.createElement("div", {
15
15
  ref: state.arrowRef,
16
16
  className: state.arrowClassName
17
- }), state.content)));
17
+ }), state.content.children)));
18
18
  };
19
19
  //# sourceMappingURL=renderTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,IAAM,aAAa,GAAG,UAAC,KAAD,EAAoB;AACzC,MAAA,EAAA,GAAuB,QAAQ,CAAe,KAAf,EAAsB,CAAC,MAAD,CAAtB,CAA/B;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,sBACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEG,KAAK,CAAC,mBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,SAAN,iBAAmB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADtB,EAEG,KAAK,CAAC,OAFT,CADF,CAHJ,CADF;AAaD,CAhBM","sourceRoot":""}
1
+ {"version":3,"sources":["components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,mBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,EACG,KAAK,CAAC,SAAN,iBAAmB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADtB,EAEG,KAAK,CAAC,OAAN,CAAc,QAFjB,CADF,CAHJ,CADF;AAaD,CAhBM","sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipState) => {\n const { slots, slotProps } = getSlots<TooltipSlots>(state);\n\n return (\n <>\n {state.children}\n {state.shouldRenderTooltip && (\n <Portal>\n <slots.content {...slotProps.content}>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.content.children}\n </slots.content>\n </Portal>\n )}\n </>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,13 +1,10 @@
1
- import * as React from 'react';
2
1
  import type { TooltipProps, TooltipState } from './Tooltip.types';
3
2
  /**
4
3
  * Create the state required to render Tooltip.
5
4
  *
6
- * The returned state can be modified with hooks such as useTooltipStyles,
7
- * before being passed to renderTooltip.
5
+ * The returned state can be modified with hooks such as useTooltipStyles_unstable,
6
+ * before being passed to renderTooltip_unstable.
8
7
  *
9
8
  * @param props - props from this instance of Tooltip
10
- * @param ref - reference to root HTMLElement of Tooltip
11
- * @param defaultProps - (optional) default prop values provided by the implementing type
12
9
  */
13
- export declare const useTooltip: (props: TooltipProps, ref: React.Ref<HTMLDivElement>) => TooltipState;
10
+ export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;