@fluentui/react-infobutton 9.0.0-beta.9 → 9.0.0-beta.90
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/CHANGELOG.md +991 -3
- package/README.md +3 -24
- package/dist/index.d.ts +109 -5
- package/lib/InfoButton.js +0 -1
- package/lib/InfoButton.js.map +1 -1
- package/lib/InfoLabel.js +1 -0
- package/lib/InfoLabel.js.map +1 -0
- package/lib/components/InfoButton/DefaultInfoButtonIcons.js +3 -4
- package/lib/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
- package/lib/components/InfoButton/InfoButton.js +8 -8
- package/lib/components/InfoButton/InfoButton.js.map +1 -1
- package/lib/components/InfoButton/InfoButton.types.js +1 -2
- package/lib/components/InfoButton/InfoButton.types.js.map +1 -1
- package/lib/components/InfoButton/index.js +1 -2
- package/lib/components/InfoButton/index.js.map +1 -1
- package/lib/components/InfoButton/renderInfoButton.js +14 -16
- package/lib/components/InfoButton/renderInfoButton.js.map +1 -1
- package/lib/components/InfoButton/useInfoButton.js +71 -51
- package/lib/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib/components/InfoButton/useInfoButtonStyles.styles.js +169 -0
- package/lib/components/InfoButton/useInfoButtonStyles.styles.js.map +1 -0
- package/lib/components/InfoLabel/InfoLabel.js +14 -0
- package/lib/components/InfoLabel/InfoLabel.js.map +1 -0
- package/lib/components/InfoLabel/InfoLabel.types.js +1 -0
- package/lib/components/InfoLabel/InfoLabel.types.js.map +1 -0
- package/lib/components/InfoLabel/index.js +5 -0
- package/lib/components/InfoLabel/index.js.map +1 -0
- package/lib/components/InfoLabel/renderInfoLabel.js +15 -0
- package/lib/components/InfoLabel/renderInfoLabel.js.map +1 -0
- package/lib/components/InfoLabel/useInfoLabel.js +79 -0
- package/lib/components/InfoLabel/useInfoLabel.js.map +1 -0
- package/lib/components/InfoLabel/useInfoLabelStyles.styles.js +48 -0
- package/lib/components/InfoLabel/useInfoLabelStyles.styles.js.map +1 -0
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/InfoButton.js +3 -5
- package/lib-commonjs/InfoButton.js.map +1 -1
- package/lib-commonjs/InfoLabel.js +6 -0
- package/lib-commonjs/InfoLabel.js.map +1 -0
- package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js +22 -8
- package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
- package/lib-commonjs/components/InfoButton/InfoButton.js +18 -17
- package/lib-commonjs/components/InfoButton/InfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/InfoButton.types.js +2 -4
- package/lib-commonjs/components/InfoButton/InfoButton.types.js.map +1 -1
- package/lib-commonjs/components/InfoButton/index.js +7 -9
- package/lib-commonjs/components/InfoButton/index.js.map +1 -1
- package/lib-commonjs/components/InfoButton/renderInfoButton.js +21 -24
- package/lib-commonjs/components/InfoButton/renderInfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/useInfoButton.js +80 -66
- package/lib-commonjs/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.styles.js +376 -0
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/InfoLabel.js +21 -0
- package/lib-commonjs/components/InfoLabel/InfoLabel.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/InfoLabel.types.js +4 -0
- package/lib-commonjs/components/InfoLabel/InfoLabel.types.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/index.js +10 -0
- package/lib-commonjs/components/InfoLabel/index.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/renderInfoLabel.js +21 -0
- package/lib-commonjs/components/InfoLabel/renderInfoLabel.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/useInfoLabel.js +80 -0
- package/lib-commonjs/components/InfoLabel/useInfoLabel.js.map +1 -0
- package/lib-commonjs/components/InfoLabel/useInfoLabelStyles.styles.js +66 -0
- package/lib-commonjs/components/InfoLabel/useInfoLabelStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +41 -35
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +29 -17
- package/CHANGELOG.json +0 -288
- package/lib/components/InfoButton/useInfoButtonStyles.js +0 -153
- package/lib/components/InfoButton/useInfoButtonStyles.js.map +0 -1
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js +0 -160
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,28 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**React Infobutton components for [Fluent UI React](https://react.fluentui.dev/)**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# STATUS: Deprecated 🚧
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
To import InfoButton:
|
|
12
|
-
|
|
13
|
-
```js
|
|
14
|
-
import { InfoButton } from '@fluentui/react-infobutton';
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Once the InfoButton component graduates to a production release, the component will be available at:
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
import { InfoButton } from '@fluentui/react-components';
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Examples
|
|
24
|
-
|
|
25
|
-
```jsx
|
|
26
|
-
const InfoButtonExample = () => {
|
|
27
|
-
return <InfoButton content="This is an InfoButton's content." />;
|
|
28
|
-
};
|
|
29
|
-
```
|
|
7
|
+
This package has been deprecated and must no longer be used. We now provide an InfoLabel component in `@fluentui/react-components` and in `@fluentui/react-infolabel`.
|
|
8
|
+
Please refer to these packages if the component is needed.
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
4
4
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
5
5
|
import { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
6
|
+
import { Label } from '@fluentui/react-label';
|
|
6
7
|
import type { PopoverProps } from '@fluentui/react-popover';
|
|
7
8
|
import type { PopoverSurface } from '@fluentui/react-popover';
|
|
8
9
|
import * as React_2 from 'react';
|
|
@@ -11,13 +12,20 @@ import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* InfoButtons provide a way to display additional information about a form field or an area in the UI.
|
|
15
|
+
*
|
|
16
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
14
17
|
*/
|
|
15
18
|
export declare const InfoButton: ForwardRefComponent<InfoButtonProps>;
|
|
16
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
22
|
+
*/
|
|
17
23
|
export declare const infoButtonClassNames: SlotClassNames<InfoButtonSlots>;
|
|
18
24
|
|
|
19
25
|
/**
|
|
20
26
|
* InfoButton Props
|
|
27
|
+
*
|
|
28
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
21
29
|
*/
|
|
22
30
|
export declare type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'disabled'> & {
|
|
23
31
|
/**
|
|
@@ -26,30 +34,104 @@ export declare type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlot
|
|
|
26
34
|
* @default medium
|
|
27
35
|
*/
|
|
28
36
|
size?: 'small' | 'medium' | 'large';
|
|
37
|
+
/**
|
|
38
|
+
* Whether the InfoButton should be rendered inline or on a Portal.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
inline?: boolean;
|
|
29
43
|
};
|
|
30
44
|
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
47
|
+
*/
|
|
31
48
|
export declare type InfoButtonSlots = {
|
|
32
49
|
root: NonNullable<Slot<'button'>>;
|
|
33
50
|
/**
|
|
34
|
-
* The Popover element that wraps the
|
|
51
|
+
* The Popover element that wraps the info and root slots. Use this slot to pass props to the Popover.
|
|
35
52
|
*/
|
|
36
|
-
popover: NonNullable<Slot<Partial<PopoverProps
|
|
53
|
+
popover: NonNullable<Slot<Partial<Omit<PopoverProps, 'openOnHover'>>>>;
|
|
37
54
|
/**
|
|
38
|
-
* The
|
|
55
|
+
* The information to be displayed in the PopoverSurface when the button is pressed.
|
|
39
56
|
*/
|
|
40
|
-
|
|
57
|
+
info: NonNullable<Slot<typeof PopoverSurface>>;
|
|
41
58
|
};
|
|
42
59
|
|
|
43
60
|
/**
|
|
44
61
|
* State used in rendering InfoButton
|
|
62
|
+
*
|
|
63
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
64
|
+
*/
|
|
65
|
+
export declare type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* InfoLabel component
|
|
69
|
+
*
|
|
70
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
45
71
|
*/
|
|
46
|
-
export declare
|
|
72
|
+
export declare const InfoLabel: ForwardRefComponent<InfoLabelProps>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
76
|
+
*/
|
|
77
|
+
export declare const infoLabelClassNames: SlotClassNames<InfoLabelSlots>;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* InfoLabel Props
|
|
81
|
+
*
|
|
82
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
83
|
+
*/
|
|
84
|
+
export declare type InfoLabelProps = ComponentProps<Partial<InfoLabelSlots>, 'label'> & {
|
|
85
|
+
/**
|
|
86
|
+
* The content of the InfoButton's popover.
|
|
87
|
+
*/
|
|
88
|
+
info?: InfoButtonProps['info'];
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
93
|
+
*/
|
|
94
|
+
export declare type InfoLabelSlots = {
|
|
95
|
+
root: NonNullable<Slot<'span'>>;
|
|
96
|
+
/**
|
|
97
|
+
* The Label component.
|
|
98
|
+
*
|
|
99
|
+
* It is not typically necessary to use this prop. The label text is the child of the `<InfoLabel>`, and other props
|
|
100
|
+
* such as `size` and `required` should be set directly on the `InfoLabel`.
|
|
101
|
+
*
|
|
102
|
+
* This is the PRIMARY slot: all native properties specified directly on `<InfoLabel>` will be applied to this slot,
|
|
103
|
+
* except `className` and `style`, which remain on the root slot.
|
|
104
|
+
*/
|
|
105
|
+
label: NonNullable<Slot<typeof Label>>;
|
|
106
|
+
/**
|
|
107
|
+
* The InfoButton component.
|
|
108
|
+
*
|
|
109
|
+
* It is not typically necessary to use this prop. The content can be set using the `info` prop of the InfoLabel.
|
|
110
|
+
*/
|
|
111
|
+
infoButton: Slot<typeof InfoButton>;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* State used in rendering InfoLabel
|
|
116
|
+
*
|
|
117
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
118
|
+
*/
|
|
119
|
+
export declare type InfoLabelState = ComponentState<InfoLabelSlots> & Pick<InfoLabelProps, 'size'>;
|
|
47
120
|
|
|
48
121
|
/**
|
|
49
122
|
* Render the final JSX of InfoButton
|
|
123
|
+
*
|
|
124
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
50
125
|
*/
|
|
51
126
|
export declare const renderInfoButton_unstable: (state: InfoButtonState) => JSX.Element;
|
|
52
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Render the final JSX of InfoLabel
|
|
130
|
+
*
|
|
131
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
132
|
+
*/
|
|
133
|
+
export declare const renderInfoLabel_unstable: (state: InfoLabelState) => JSX.Element;
|
|
134
|
+
|
|
53
135
|
/**
|
|
54
136
|
* Create the state required to render InfoButton.
|
|
55
137
|
*
|
|
@@ -58,6 +140,8 @@ export declare const renderInfoButton_unstable: (state: InfoButtonState) => JSX.
|
|
|
58
140
|
*
|
|
59
141
|
* @param props - props from this instance of InfoButton
|
|
60
142
|
* @param ref - reference to root HTMLElement of InfoButton
|
|
143
|
+
*
|
|
144
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
61
145
|
*/
|
|
62
146
|
export declare const useInfoButton_unstable: (props: InfoButtonProps, ref: React_2.Ref<HTMLElement>) => InfoButtonState;
|
|
63
147
|
|
|
@@ -66,4 +150,24 @@ export declare const useInfoButton_unstable: (props: InfoButtonProps, ref: React
|
|
|
66
150
|
*/
|
|
67
151
|
export declare const useInfoButtonStyles_unstable: (state: InfoButtonState) => InfoButtonState;
|
|
68
152
|
|
|
153
|
+
/**
|
|
154
|
+
* Create the state required to render InfoLabel.
|
|
155
|
+
*
|
|
156
|
+
* The returned state can be modified with hooks such as useInfoLabelStyles_unstable,
|
|
157
|
+
* before being passed to renderInfoLabel_unstable.
|
|
158
|
+
*
|
|
159
|
+
* @param props - props from this instance of InfoLabel
|
|
160
|
+
* @param ref - reference to label element of InfoLabel
|
|
161
|
+
*
|
|
162
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
163
|
+
*/
|
|
164
|
+
export declare const useInfoLabel_unstable: (props: InfoLabelProps, ref: React_2.Ref<HTMLLabelElement>) => InfoLabelState;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Apply styling to the InfoLabel slots based on the state
|
|
168
|
+
*
|
|
169
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
170
|
+
*/
|
|
171
|
+
export declare const useInfoLabelStyles_unstable: (state: InfoLabelState) => InfoLabelState;
|
|
172
|
+
|
|
69
173
|
export { }
|
package/lib/InfoButton.js
CHANGED
package/lib/InfoButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["InfoButton.ts"],"sourcesContent":["export * from './components/InfoButton/index';\n"],"names":[],"mappings":"AAAA,cAAc,gCAAgC"}
|
package/lib/InfoLabel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/InfoLabel/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InfoLabel.ts"],"sourcesContent":["export * from './components/InfoLabel/index';\n"],"names":[],"mappings":"AAAA,cAAc,+BAA+B"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Info12Regular, Info12Filled, Info16Regular, Info16Filled, Info20Regular, Info20Filled, bundleIcon } from '@fluentui/react-icons';
|
|
2
|
-
export const DefaultInfoButtonIcon12 =
|
|
3
|
-
export const DefaultInfoButtonIcon16 =
|
|
4
|
-
export const DefaultInfoButtonIcon20 =
|
|
5
|
-
//# sourceMappingURL=DefaultInfoButtonIcons.js.map
|
|
2
|
+
export const DefaultInfoButtonIcon12 = bundleIcon(Info12Filled, Info12Regular);
|
|
3
|
+
export const DefaultInfoButtonIcon16 = bundleIcon(Info16Filled, Info16Regular);
|
|
4
|
+
export const DefaultInfoButtonIcon20 = bundleIcon(Info20Filled, Info20Regular);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["DefaultInfoButtonIcons.tsx"],"sourcesContent":["import {\n Info12Regular,\n Info12Filled,\n Info16Regular,\n Info16Filled,\n Info20Regular,\n Info20Filled,\n bundleIcon,\n} from '@fluentui/react-icons';\n\nexport const DefaultInfoButtonIcon12 = bundleIcon(Info12Filled, Info12Regular);\nexport const DefaultInfoButtonIcon16 = bundleIcon(Info16Filled, Info16Regular);\nexport const DefaultInfoButtonIcon20 = bundleIcon(Info20Filled, Info20Regular);\n"],"names":["Info12Regular","Info12Filled","Info16Regular","Info16Filled","Info20Regular","Info20Filled","bundleIcon","DefaultInfoButtonIcon12","DefaultInfoButtonIcon16","DefaultInfoButtonIcon20"],"mappings":"AAAA,SACEA,aAAa,EACbC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,UAAU,QACL,wBAAwB;AAE/B,OAAO,MAAMC,0BAA0BD,WAAWL,cAAcD,eAAe;AAC/E,OAAO,MAAMQ,0BAA0BF,WAAWH,cAAcD,eAAe;AAC/E,OAAO,MAAMO,0BAA0BH,WAAWD,cAAcD,eAAe"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
/* eslint-disable deprecation/deprecation */ import * as React from 'react';
|
|
2
2
|
import { renderInfoButton_unstable } from './renderInfoButton';
|
|
3
3
|
import { useInfoButton_unstable } from './useInfoButton';
|
|
4
|
-
import { useInfoButtonStyles_unstable } from './useInfoButtonStyles';
|
|
4
|
+
import { useInfoButtonStyles_unstable } from './useInfoButtonStyles.styles';
|
|
5
5
|
/**
|
|
6
6
|
* InfoButtons provide a way to display additional information about a form field or an area in the UI.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
*
|
|
8
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
9
|
+
*/ export const InfoButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
10
|
+
const state = useInfoButton_unstable(props, ref);
|
|
11
|
+
useInfoButtonStyles_unstable(state);
|
|
12
|
+
return renderInfoButton_unstable(state);
|
|
12
13
|
});
|
|
13
14
|
InfoButton.displayName = 'InfoButton';
|
|
14
|
-
//# sourceMappingURL=InfoButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["InfoButton.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport * as React from 'react';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderInfoButton_unstable } from './renderInfoButton';\nimport { useInfoButton_unstable } from './useInfoButton';\nimport { useInfoButtonStyles_unstable } from './useInfoButtonStyles.styles';\nimport type { InfoButtonProps } from './InfoButton.types';\n\n/**\n * InfoButtons provide a way to display additional information about a form field or an area in the UI.\n *\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport const InfoButton: ForwardRefComponent<InfoButtonProps> = React.forwardRef((props, ref) => {\n const state = useInfoButton_unstable(props, ref);\n\n useInfoButtonStyles_unstable(state);\n return renderInfoButton_unstable(state);\n});\n\nInfoButton.displayName = 'InfoButton';\n"],"names":["React","renderInfoButton_unstable","useInfoButton_unstable","useInfoButtonStyles_unstable","InfoButton","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,0CAA0C,GAC1C,YAAYA,WAAW,QAAQ;AAE/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,4BAA4B,QAAQ,+BAA+B;AAG5E;;;;CAIC,GACD,OAAO,MAAMC,2BAAmDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACvF,MAAMC,QAAQN,uBAAuBI,OAAOC;IAE5CJ,6BAA6BK;IAC7B,OAAOP,0BAA0BO;AACnC,GAAG;AAEHJ,WAAWK,WAAW,GAAG"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export {};
|
|
2
|
-
//# sourceMappingURL=InfoButton.types.js.map
|
|
1
|
+
/* eslint-disable deprecation/deprecation */ export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["InfoButton.types.ts"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';\n\n/**\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport type InfoButtonSlots = {\n root: NonNullable<Slot<'button'>>;\n\n /**\n * The Popover element that wraps the info and root slots. Use this slot to pass props to the Popover.\n */\n popover: NonNullable<Slot<Partial<Omit<PopoverProps, 'openOnHover'>>>>;\n\n /**\n * The information to be displayed in the PopoverSurface when the button is pressed.\n */\n info: NonNullable<Slot<typeof PopoverSurface>>;\n};\n\n/**\n * InfoButton Props\n *\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'disabled'> & {\n /**\n * Size of the InfoButton.\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Whether the InfoButton should be rendered inline or on a Portal.\n *\n * @default true\n */\n inline?: boolean;\n};\n\n/**\n * State used in rendering InfoButton\n *\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;\n"],"names":[],"mappings":"AAAA,0CAA0C,GAC1C,WA8CmH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './InfoButton';\nexport * from './InfoButton.types';\nexport * from './renderInfoButton';\nexport * from './useInfoButton';\nexport * from './useInfoButtonStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,eAAe;AAC7B,cAAc,qBAAqB;AACnC,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,+BAA+B"}
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
/* eslint-disable deprecation/deprecation */ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
3
|
import { PopoverTrigger } from '@fluentui/react-popover';
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of InfoButton
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}));
|
|
6
|
+
*
|
|
7
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
8
|
+
*/ export const renderInfoButton_unstable = (state)=>{
|
|
9
|
+
assertSlots(state);
|
|
10
|
+
return /*#__PURE__*/ _jsxs(state.popover, {
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ _jsx(PopoverTrigger, {
|
|
13
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ _jsx(state.info, {})
|
|
16
|
+
]
|
|
17
|
+
});
|
|
19
18
|
};
|
|
20
|
-
//# sourceMappingURL=renderInfoButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["renderInfoButton.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\n/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { PopoverTrigger } from '@fluentui/react-popover';\nimport type { InfoButtonState, InfoButtonSlots } from './InfoButton.types';\n\n/**\n * Render the final JSX of InfoButton\n *\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport const renderInfoButton_unstable = (state: InfoButtonState) => {\n assertSlots<InfoButtonSlots>(state);\n\n return (\n <state.popover>\n <PopoverTrigger>\n <state.root />\n </PopoverTrigger>\n <state.info />\n </state.popover>\n );\n};\n"],"names":["assertSlots","PopoverTrigger","renderInfoButton_unstable","state","popover","root","info"],"mappings":"AAAA,0CAA0C,GAC1C,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AACxD,SAASC,cAAc,QAAQ,0BAA0B;AAGzD;;;;CAIC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCH,YAA6BG;IAE7B,qBACE,MAACA,MAAMC,OAAO;;0BACZ,KAACH;0BACC,cAAA,KAACE,MAAME,IAAI;;0BAEb,KAACF,MAAMG,IAAI;;;AAGjB,EAAE"}
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
/* eslint-disable deprecation/deprecation */ import * as React from 'react';
|
|
2
2
|
import { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';
|
|
3
|
-
import {
|
|
3
|
+
import { getIntrinsicElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs, isHTMLElement, elementContains } from '@fluentui/react-utilities';
|
|
4
4
|
import { Popover, PopoverSurface } from '@fluentui/react-popover';
|
|
5
|
-
import { useControllableState } from '@fluentui/react-utilities';
|
|
6
5
|
const infoButtonIconMap = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
small: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon12, null),
|
|
7
|
+
medium: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon16, null),
|
|
8
|
+
large: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon20, null)
|
|
10
9
|
};
|
|
11
10
|
const popoverSizeMap = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
small: 'small',
|
|
12
|
+
medium: 'small',
|
|
13
|
+
large: 'medium'
|
|
15
14
|
};
|
|
16
15
|
/**
|
|
17
16
|
* Create the state required to render InfoButton.
|
|
@@ -21,46 +20,67 @@ const popoverSizeMap = {
|
|
|
21
20
|
*
|
|
22
21
|
* @param props - props from this instance of InfoButton
|
|
23
22
|
* @param ref - reference to root HTMLElement of InfoButton
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
size = 'medium'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
23
|
+
*
|
|
24
|
+
* @deprecated use {@link @fluentui/react-components#InfoLabel} from `\@fluentui/react-components` or `\@fluentui/react-infolabel` instead
|
|
25
|
+
*/ export const useInfoButton_unstable = (props, ref)=>{
|
|
26
|
+
const { size = 'medium', inline = true } = props;
|
|
27
|
+
const state = {
|
|
28
|
+
inline,
|
|
29
|
+
size,
|
|
30
|
+
components: {
|
|
31
|
+
root: 'button',
|
|
32
|
+
popover: Popover,
|
|
33
|
+
info: PopoverSurface
|
|
34
|
+
},
|
|
35
|
+
root: slot.always(getIntrinsicElementProps('button', {
|
|
36
|
+
children: infoButtonIconMap[size],
|
|
37
|
+
type: 'button',
|
|
38
|
+
'aria-label': 'information',
|
|
39
|
+
...props,
|
|
40
|
+
// FIXME:
|
|
41
|
+
// `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLButtonElement`
|
|
42
|
+
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
|
|
43
|
+
ref: ref
|
|
44
|
+
}), {
|
|
45
|
+
elementType: 'button'
|
|
46
|
+
}),
|
|
47
|
+
popover: slot.always(props.popover, {
|
|
48
|
+
defaultProps: {
|
|
49
|
+
inline,
|
|
50
|
+
positioning: 'above-start',
|
|
51
|
+
size: popoverSizeMap[size],
|
|
52
|
+
withArrow: true
|
|
53
|
+
},
|
|
54
|
+
elementType: Popover
|
|
55
|
+
}),
|
|
56
|
+
info: slot.always(props.info, {
|
|
57
|
+
defaultProps: {
|
|
58
|
+
role: 'note',
|
|
59
|
+
tabIndex: -1
|
|
60
|
+
},
|
|
61
|
+
elementType: PopoverSurface
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
const [popoverOpen, setPopoverOpen] = useControllableState({
|
|
65
|
+
state: state.popover.open,
|
|
66
|
+
defaultState: state.popover.defaultOpen,
|
|
67
|
+
initialState: false
|
|
68
|
+
});
|
|
69
|
+
state.popover.open = popoverOpen;
|
|
70
|
+
state.popover.onOpenChange = mergeCallbacks(state.popover.onOpenChange, (e, data)=>setPopoverOpen(data.open));
|
|
71
|
+
const focusOutRef = React.useCallback((el)=>{
|
|
72
|
+
if (!el) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
el.addEventListener('focusout', (e)=>{
|
|
76
|
+
const nextFocused = e.relatedTarget;
|
|
77
|
+
if (isHTMLElement(nextFocused) && !elementContains(el, nextFocused)) {
|
|
78
|
+
setPopoverOpen(false);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}, [
|
|
82
|
+
setPopoverOpen
|
|
83
|
+
]);
|
|
84
|
+
state.info.ref = useMergedRefs(state.info.ref, focusOutRef);
|
|
85
|
+
return state;
|
|
65
86
|
};
|
|
66
|
-
//# sourceMappingURL=useInfoButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["useInfoButton.tsx"],"sourcesContent":["/* eslint-disable deprecation/deprecation */\nimport * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n useControllableState,\n slot,\n useMergedRefs,\n isHTMLElement,\n elementContains,\n} from '@fluentui/react-utilities';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nimport type { InfoButtonProps, InfoButtonState } from './InfoButton.types';\nimport type { PopoverProps } from '@fluentui/react-popover';\n\nconst infoButtonIconMap = {\n small: <DefaultInfoButtonIcon12 />,\n medium: <DefaultInfoButtonIcon16 />,\n large: <DefaultInfoButtonIcon20 />,\n} as const;\n\nconst popoverSizeMap = {\n small: 'small',\n medium: 'small',\n large: 'medium',\n} as const;\n\n/**\n * Create the state required to render InfoButton.\n *\n * The returned state can be modified with hooks such as useInfoButtonStyles_unstable,\n * before being passed to renderInfoButton_unstable.\n *\n * @param props - props from this instance of InfoButton\n * @param ref - reference to root HTMLElement of InfoButton\n *\n * @deprecated use {@link @fluentui/react-components#InfoLabel} from `\\@fluentui/react-components` or `\\@fluentui/react-infolabel` instead\n */\nexport const useInfoButton_unstable = (props: InfoButtonProps, ref: React.Ref<HTMLElement>): InfoButtonState => {\n const { size = 'medium', inline = true } = props;\n\n const state: InfoButtonState = {\n inline,\n size,\n\n components: {\n root: 'button',\n popover: Popover as React.FC<Partial<PopoverProps>>,\n info: PopoverSurface,\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n children: infoButtonIconMap[size],\n type: 'button',\n 'aria-label': 'information',\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLButtonElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLButtonElement>,\n }),\n { elementType: 'button' },\n ),\n popover: slot.always(props.popover, {\n defaultProps: {\n inline,\n positioning: 'above-start',\n size: popoverSizeMap[size],\n withArrow: true,\n },\n elementType: Popover as React.FC<Partial<Omit<PopoverProps, 'openOnHover'>>>,\n }),\n info: slot.always(props.info, {\n defaultProps: {\n role: 'note',\n tabIndex: -1,\n },\n elementType: PopoverSurface,\n }),\n };\n\n const [popoverOpen, setPopoverOpen] = useControllableState({\n state: state.popover.open,\n defaultState: state.popover.defaultOpen,\n initialState: false,\n });\n\n state.popover.open = popoverOpen;\n state.popover.onOpenChange = mergeCallbacks(state.popover.onOpenChange, (e, data) => setPopoverOpen(data.open));\n\n const focusOutRef = React.useCallback(\n (el: HTMLDivElement) => {\n if (!el) {\n return;\n }\n\n el.addEventListener('focusout', e => {\n const nextFocused = e.relatedTarget;\n\n if (isHTMLElement(nextFocused) && !elementContains(el, nextFocused)) {\n setPopoverOpen(false);\n }\n });\n },\n [setPopoverOpen],\n );\n\n state.info.ref = useMergedRefs(state.info.ref, focusOutRef);\n\n return state;\n};\n"],"names":["React","DefaultInfoButtonIcon12","DefaultInfoButtonIcon16","DefaultInfoButtonIcon20","getIntrinsicElementProps","mergeCallbacks","useControllableState","slot","useMergedRefs","isHTMLElement","elementContains","Popover","PopoverSurface","infoButtonIconMap","small","medium","large","popoverSizeMap","useInfoButton_unstable","props","ref","size","inline","state","components","root","popover","info","always","children","type","elementType","defaultProps","positioning","withArrow","role","tabIndex","popoverOpen","setPopoverOpen","open","defaultState","defaultOpen","initialState","onOpenChange","e","data","focusOutRef","useCallback","el","addEventListener","nextFocused","relatedTarget"],"mappings":"AAAA,0CAA0C,GAC1C,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,EAAEC,uBAAuB,EAAEC,uBAAuB,QAAQ,2BAA2B;AACrH,SACEC,wBAAwB,EACxBC,cAAc,EACdC,oBAAoB,EACpBC,IAAI,EACJC,aAAa,EACbC,aAAa,EACbC,eAAe,QACV,4BAA4B;AACnC,SAASC,OAAO,EAAEC,cAAc,QAAQ,0BAA0B;AAIlE,MAAMC,oBAAoB;IACxBC,qBAAO,oBAACb;IACRc,sBAAQ,oBAACb;IACTc,qBAAO,oBAACb;AACV;AAEA,MAAMc,iBAAiB;IACrBH,OAAO;IACPC,QAAQ;IACRC,OAAO;AACT;AAEA;;;;;;;;;;CAUC,GACD,OAAO,MAAME,yBAAyB,CAACC,OAAwBC;IAC7D,MAAM,EAAEC,OAAO,QAAQ,EAAEC,SAAS,IAAI,EAAE,GAAGH;IAE3C,MAAMI,QAAyB;QAC7BD;QACAD;QAEAG,YAAY;YACVC,MAAM;YACNC,SAASf;YACTgB,MAAMf;QACR;QAEAa,MAAMlB,KAAKqB,MAAM,CACfxB,yBAAyB,UAAU;YACjCyB,UAAUhB,iBAAiB,CAACQ,KAAK;YACjCS,MAAM;YACN,cAAc;YACd,GAAGX,KAAK;YACR,SAAS;YACT,+EAA+E;YAC/E,4FAA4F;YAC5FC,KAAKA;QACP,IACA;YAAEW,aAAa;QAAS;QAE1BL,SAASnB,KAAKqB,MAAM,CAACT,MAAMO,OAAO,EAAE;YAClCM,cAAc;gBACZV;gBACAW,aAAa;gBACbZ,MAAMJ,cAAc,CAACI,KAAK;gBAC1Ba,WAAW;YACb;YACAH,aAAapB;QACf;QACAgB,MAAMpB,KAAKqB,MAAM,CAACT,MAAMQ,IAAI,EAAE;YAC5BK,cAAc;gBACZG,MAAM;gBACNC,UAAU,CAAC;YACb;YACAL,aAAanB;QACf;IACF;IAEA,MAAM,CAACyB,aAAaC,eAAe,GAAGhC,qBAAqB;QACzDiB,OAAOA,MAAMG,OAAO,CAACa,IAAI;QACzBC,cAAcjB,MAAMG,OAAO,CAACe,WAAW;QACvCC,cAAc;IAChB;IAEAnB,MAAMG,OAAO,CAACa,IAAI,GAAGF;IACrBd,MAAMG,OAAO,CAACiB,YAAY,GAAGtC,eAAekB,MAAMG,OAAO,CAACiB,YAAY,EAAE,CAACC,GAAGC,OAASP,eAAeO,KAAKN,IAAI;IAE7G,MAAMO,cAAc9C,MAAM+C,WAAW,CACnC,CAACC;QACC,IAAI,CAACA,IAAI;YACP;QACF;QAEAA,GAAGC,gBAAgB,CAAC,YAAYL,CAAAA;YAC9B,MAAMM,cAAcN,EAAEO,aAAa;YAEnC,IAAI1C,cAAcyC,gBAAgB,CAACxC,gBAAgBsC,IAAIE,cAAc;gBACnEZ,eAAe;YACjB;QACF;IACF,GACA;QAACA;KAAe;IAGlBf,MAAMI,IAAI,CAACP,GAAG,GAAGZ,cAAce,MAAMI,IAAI,CAACP,GAAG,EAAE0B;IAE/C,OAAOvB;AACT,EAAE"}
|