@fluentui/react-infobutton 9.0.0-beta.4 → 9.0.0-beta.6
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.json +87 -1
- package/CHANGELOG.md +27 -2
- package/lib/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
- package/lib/components/InfoButton/InfoButton.js +0 -1
- package/lib/components/InfoButton/InfoButton.js.map +1 -1
- package/lib/components/InfoButton/renderInfoButton.js +6 -4
- package/lib/components/InfoButton/renderInfoButton.js.map +1 -1
- package/lib/components/InfoButton/useInfoButton.js +0 -1
- package/lib/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib/components/InfoButton/useInfoButtonStyles.js +122 -126
- package/lib/components/InfoButton/useInfoButtonStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/InfoButton.js +0 -2
- package/lib-commonjs/InfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js +0 -2
- package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
- package/lib-commonjs/components/InfoButton/InfoButton.js +0 -6
- package/lib-commonjs/components/InfoButton/InfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/InfoButton.types.js.map +1 -1
- package/lib-commonjs/components/InfoButton/index.js +0 -6
- package/lib-commonjs/components/InfoButton/index.js.map +1 -1
- package/lib-commonjs/components/InfoButton/renderInfoButton.js +6 -9
- package/lib-commonjs/components/InfoButton/renderInfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/useInfoButton.js +0 -8
- package/lib-commonjs/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js +122 -132
- package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js +0 -2
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -7
- package/Spec.md +0 -143
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-infobutton",
|
|
3
|
-
"version": "9.0.0-beta.
|
|
3
|
+
"version": "9.0.0-beta.6",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@fluentui/eslint-plugin": "*",
|
|
29
29
|
"@fluentui/react-conformance": "*",
|
|
30
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
|
31
|
-
"@fluentui/scripts": "
|
|
30
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.19",
|
|
31
|
+
"@fluentui/scripts": "*"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@fluentui/react-icons": "^2.0.175",
|
|
35
|
-
"@fluentui/react-popover": "^9.
|
|
36
|
-
"@fluentui/react-tabster": "^9.3.
|
|
35
|
+
"@fluentui/react-popover": "^9.4.0",
|
|
36
|
+
"@fluentui/react-tabster": "^9.3.6",
|
|
37
37
|
"@fluentui/react-theme": "^9.1.5",
|
|
38
|
-
"@fluentui/react-utilities": "^9.
|
|
39
|
-
"@griffel/react": "^1.
|
|
38
|
+
"@fluentui/react-utilities": "^9.4.0",
|
|
39
|
+
"@griffel/react": "^1.5.2",
|
|
40
40
|
"tslib": "^2.1.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
package/Spec.md
DELETED
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
# @fluentui/react-infobutton Spec
|
|
2
|
-
|
|
3
|
-
Convergence epic issue: [#25062](https://github.com/microsoft/fluentui/issues/25062)
|
|
4
|
-
|
|
5
|
-
## Background
|
|
6
|
-
|
|
7
|
-
An InfoButton provides a way for users to get more information about a particular UI element. It is a button containing an icon that, when clicked, displays a Popover with the additional information. InfoButton may contain focusable items inside the Popover.
|
|
8
|
-
|
|
9
|
-
Because the Popover isn't always visible, it should not contain information that people must know in order to complete the field.
|
|
10
|
-
|
|
11
|
-
### Anatomy
|
|
12
|
-
|
|
13
|
-

|
|
14
|
-
|
|
15
|
-
## Prior Art
|
|
16
|
-
|
|
17
|
-
| Name | library | Notes |
|
|
18
|
-
| --------------------------------------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
|
|
19
|
-
| IconButtonTooltip | [Carbon Design System](https://www.carbondesignsystem.com/components/tooltip/usage) | This is an example within the tooltip component. |
|
|
20
|
-
| Tooltip with card appearance and general tooltip | [EverGreen](https://evergreen.segment.com/components/tooltip) | This are examples within the tooltip component. This library doesn't use a button, instead just an icon. |
|
|
21
|
-
| Input and guidance to add info button | [Salesforce](https://www.lightningdesignsystem.com/components/input/) | This component lives within Input and shows how to build an info button instead. |
|
|
22
|
-
| TextField with example on how to add an info button | [v8](https://developer.microsoft.com/en-us/fluentui#/controls/web/textfield) | This is just an example and on how to implement it. |
|
|
23
|
-
| ContextualHelp | [React Spectrum](https://react-spectrum.adobe.com/react-spectrum/ContextualHelp.html) | It's a full component and uses a Popover instead of tooltip. |
|
|
24
|
-
|
|
25
|
-
#### Comparison with v0 and v8
|
|
26
|
-
|
|
27
|
-
- v0 does not have an InfoButton component.
|
|
28
|
-
- v8 does not have an InfoButton component, but does have a TextField component that has an example of how to add an info button to a TextField, see "Prior Art" section above for more details.
|
|
29
|
-
|
|
30
|
-
## Sample Code
|
|
31
|
-
|
|
32
|
-
```jsx
|
|
33
|
-
<InfoButton content="This is some additional information." />
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## API
|
|
37
|
-
|
|
38
|
-
#### Props
|
|
39
|
-
|
|
40
|
-
```ts
|
|
41
|
-
export type InfoButtonSlots = {
|
|
42
|
-
root: NonNullable<Slot<'button'>>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The Popover element that wraps the content and root. Use this slot to pass props to the Popover.
|
|
46
|
-
*/
|
|
47
|
-
popover: NonNullable<Slot<PopoverProps>>;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* The content to be displayed in the PopoverSurface when the button is pressed.
|
|
51
|
-
*/
|
|
52
|
-
content: NonNullable<Slot<typeof PopoverSurface>>;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* InfoButton Props
|
|
57
|
-
*/
|
|
58
|
-
export type InfoButtonProps = ComponentProps<Partial<InfoButtonSlots>>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* State used in rendering InfoButton
|
|
62
|
-
*/
|
|
63
|
-
export type InfoButtonState = ComponentState<InfoButtonSlots>;
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Structure
|
|
67
|
-
|
|
68
|
-
_**Public**_
|
|
69
|
-
|
|
70
|
-
```jsx
|
|
71
|
-
<InfoButton
|
|
72
|
-
content={
|
|
73
|
-
<>
|
|
74
|
-
Popover above-start lorem ipsum dolor sit amet consectetur.
|
|
75
|
-
<Link href="https://react.fluentui.dev">Learn more</Link>
|
|
76
|
-
</>
|
|
77
|
-
}
|
|
78
|
-
/>
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
_**Internal**_
|
|
82
|
-
|
|
83
|
-
```jsx
|
|
84
|
-
return (
|
|
85
|
-
<slots.popover {...(slotProps.popover as PopoverProps)}>
|
|
86
|
-
<PopoverTrigger>
|
|
87
|
-
<slots.root {...slotProps.root} />
|
|
88
|
-
</PopoverTrigger>
|
|
89
|
-
<slots.content {...slotProps.content} />
|
|
90
|
-
</slots.popover>
|
|
91
|
-
);
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
_**DOM**_
|
|
95
|
-
|
|
96
|
-
```html
|
|
97
|
-
<button type="button" class="fui-Button fui-InfoButton__button">
|
|
98
|
-
<!-- icon -->
|
|
99
|
-
</button>
|
|
100
|
-
|
|
101
|
-
<!-- on document.body -->
|
|
102
|
-
<div role="tooltip" class="fui-PopoverSurface fui-InfoButton__content">
|
|
103
|
-
Popover above-start lorem ipsum dolor sit amet consectetur.
|
|
104
|
-
<a href="https://react.fluentui.dev">Learn more</a>
|
|
105
|
-
</div>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Migration
|
|
109
|
-
|
|
110
|
-
There's no migration guide as `v0` and `v8` do not have an InfoButton component.
|
|
111
|
-
|
|
112
|
-
## Behaviors
|
|
113
|
-
|
|
114
|
-
> Note: The behavior will change when used in conjunction with the `Field` component. It is mentioned that when a form has many InfoButtons, it may be better to not make a full tab stop in the button. The idea is to have each field have a "shortcut" that will let you focus on the infobutton. This will be implemented by Field if needed.
|
|
115
|
-
|
|
116
|
-
- _Component States_
|
|
117
|
-
- Popover open: The Popover is open and content visible.
|
|
118
|
-
- _Interaction_
|
|
119
|
-
- _Keyboard_
|
|
120
|
-
- `Enter` or `Space` key: Opens the Popover.
|
|
121
|
-
- Focusable items in Popover: Item should trap focus within the Popover.
|
|
122
|
-
- No focusable items in Popover: Focus should stay on the button.
|
|
123
|
-
- `Escape` key: Closes the Popover.
|
|
124
|
-
- _Cursor_
|
|
125
|
-
- `Click`: Opens the Popover.
|
|
126
|
-
- `Click` outside of Popover: Closes the Popover.
|
|
127
|
-
- _Touch_
|
|
128
|
-
- `Tap`: Opens the Popover.
|
|
129
|
-
- `Tap` outside of Popover: Closes the Popover.
|
|
130
|
-
- _Screen readers_
|
|
131
|
-
- When screen reader is on the button, it should announce that it is a button, that it can be used to open a Popover, and read out the aria-label of the button.
|
|
132
|
-
- When screen reader is on the Popover, it should announce that it is a dialog, and read out the content of the Popover.
|
|
133
|
-
|
|
134
|
-
## Accessibility
|
|
135
|
-
|
|
136
|
-
- `role="tooltip"` is used on the PopoverSurface.
|
|
137
|
-
- Tab order
|
|
138
|
-
- When tabbing through the page, the button should be a tab stop.
|
|
139
|
-
- When focused on the button, pressing `Enter` or `Space` should open the Popover.
|
|
140
|
-
- If the popover does not contain any focusable items, focus should stay on the button.
|
|
141
|
-
- When focused on the button, pressing `Escape` should close the Popover.
|
|
142
|
-
- When the Popover is open and it has focusable items, tabbing should move to the next focusable item.
|
|
143
|
-
- When focused on an item inside the Popover, pressing `Escape` should close the Popover and return to the button.
|