@fluentui/react-button 9.0.0-alpha.85 → 9.0.0-alpha.89
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 +123 -1
- package/CHANGELOG.md +47 -2
- package/dist/react-button.d.ts +118 -25
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/components/Button/Button.types.d.ts +2 -2
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +3 -1
- package/lib/components/Button/useButton.js +3 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonState.d.ts +2 -2
- package/lib/components/Button/useButtonState.js +2 -2
- package/lib/components/Button/useButtonState.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +2 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib/components/MenuButton/useMenuButton.js +3 -3
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +25 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +16 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib/components/SplitButton/useSplitButton.js +72 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib/components/ToggleButton/useChecked.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib/components/ToggleButton/useToggleButton.js +4 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-amd/SplitButton.d.ts +1 -0
- package/lib-amd/SplitButton.js +6 -0
- package/lib-amd/SplitButton.js.map +1 -0
- package/lib-amd/components/Button/Button.types.d.ts +2 -2
- package/lib-amd/components/Button/Button.types.js.map +1 -1
- package/lib-amd/components/Button/renderButton.js.map +1 -1
- package/lib-amd/components/Button/useButton.d.ts +3 -1
- package/lib-amd/components/Button/useButton.js +3 -1
- package/lib-amd/components/Button/useButton.js.map +1 -1
- package/lib-amd/components/Button/useButtonState.d.ts +2 -2
- package/lib-amd/components/Button/useButtonState.js +2 -2
- package/lib-amd/components/Button/useButtonState.js.map +1 -1
- package/lib-amd/components/Button/useButtonStyles.js +1 -0
- package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
- package/lib-amd/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib-amd/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib-amd/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-amd/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
- package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
- package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-amd/components/SplitButton/SplitButton.js +19 -0
- package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-amd/components/SplitButton/index.d.ts +5 -0
- package/lib-amd/components/SplitButton/index.js +11 -0
- package/lib-amd/components/SplitButton/index.js.map +1 -0
- package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
- package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-amd/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib-amd/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib-amd/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-amd/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib-amd/components/ToggleButton/useChecked.js.map +1 -1
- package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +2 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/components/Button/Button.types.d.ts +2 -2
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +3 -1
- package/lib-commonjs/components/Button/useButton.js +3 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
- package/lib-commonjs/components/Button/useButtonState.js +2 -2
- package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +16 -2
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +3 -4
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +2 -3
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +16 -2
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +3 -4
- package/lib-commonjs/components/ToggleButton/useChecked.d.ts +2 -2
- package/lib-commonjs/components/ToggleButton/useChecked.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,129 @@
|
|
|
2
2
|
"name": "@fluentui/react-button",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Tue,
|
|
5
|
+
"date": "Tue, 21 Sep 2021 07:40:35 GMT",
|
|
6
|
+
"tag": "@fluentui/react-button_v9.0.0-alpha.89",
|
|
7
|
+
"version": "9.0.0-alpha.89",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "gcox@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-button",
|
|
13
|
+
"comment": "Updating to types over interfaces",
|
|
14
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-button",
|
|
19
|
+
"comment": "Bump @fluentui/react-make-styles to v9.0.0-alpha.69",
|
|
20
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-button",
|
|
25
|
+
"comment": "Bump @fluentui/react-tabster to v9.0.0-alpha.63",
|
|
26
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-button",
|
|
31
|
+
"comment": "Bump @fluentui/babel-make-styles to v9.0.0-alpha.51",
|
|
32
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-button",
|
|
37
|
+
"comment": "Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.44",
|
|
38
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-button",
|
|
43
|
+
"comment": "Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.13",
|
|
44
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-button",
|
|
49
|
+
"comment": "Bump @fluentui/react-menu to v9.0.0-alpha.80",
|
|
50
|
+
"commit": "7ac237dbe5b9a3e452581f7478f811f43bba9f19"
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"date": "Mon, 20 Sep 2021 07:36:26 GMT",
|
|
57
|
+
"tag": "@fluentui/react-button_v9.0.0-alpha.88",
|
|
58
|
+
"version": "9.0.0-alpha.88",
|
|
59
|
+
"comments": {
|
|
60
|
+
"prerelease": [
|
|
61
|
+
{
|
|
62
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
63
|
+
"package": "@fluentui/react-button",
|
|
64
|
+
"comment": "SplitButton: Re-introducing SplitButton using the latest version of makeStyles.",
|
|
65
|
+
"commit": "b8a304770f77c0353553a152dad34421070400a6"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"author": "lingfangao@hotmail.com",
|
|
69
|
+
"package": "@fluentui/react-button",
|
|
70
|
+
"commit": "b8a304770f77c0353553a152dad34421070400a6",
|
|
71
|
+
"comment": "Bump @fluentui/react-button to v9.0.0-alpha.88"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"none": [
|
|
75
|
+
{
|
|
76
|
+
"author": "lingfangao@hotmail.com",
|
|
77
|
+
"package": "@fluentui/react-button",
|
|
78
|
+
"comment": "chore: use versioon eslint-plugin and react-conformance in dev dependencies",
|
|
79
|
+
"commit": "b8a304770f77c0353553a152dad34421070400a6"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"date": "Fri, 17 Sep 2021 07:35:26 GMT",
|
|
86
|
+
"tag": "@fluentui/react-button_v9.0.0-alpha.87",
|
|
87
|
+
"version": "9.0.0-alpha.87",
|
|
88
|
+
"comments": {
|
|
89
|
+
"prerelease": [
|
|
90
|
+
{
|
|
91
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
92
|
+
"package": "@fluentui/react-button",
|
|
93
|
+
"comment": "Modifying MenuButton to adhere to MenuTrigger changes.",
|
|
94
|
+
"commit": "90d71a0914acbb73a0365d60a85237e3d58ef575"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
98
|
+
"package": "@fluentui/react-button",
|
|
99
|
+
"comment": "Updating API comments to be more descriptive.",
|
|
100
|
+
"commit": "90d71a0914acbb73a0365d60a85237e3d58ef575"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
104
|
+
"package": "@fluentui/react-button",
|
|
105
|
+
"commit": "90d71a0914acbb73a0365d60a85237e3d58ef575",
|
|
106
|
+
"comment": "Bump @fluentui/react-button to v9.0.0-alpha.87"
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"date": "Thu, 16 Sep 2021 07:38:39 GMT",
|
|
113
|
+
"tag": "@fluentui/react-button_v9.0.0-alpha.86",
|
|
114
|
+
"version": "9.0.0-alpha.86",
|
|
115
|
+
"comments": {
|
|
116
|
+
"prerelease": [
|
|
117
|
+
{
|
|
118
|
+
"author": "behowell@microsoft.com",
|
|
119
|
+
"package": "@fluentui/react-button",
|
|
120
|
+
"commit": "fbe41e2877a20ce0f3c01b5188e17c12f941cc4c",
|
|
121
|
+
"comment": "Bump @fluentui/react-button to v9.0.0-alpha.86"
|
|
122
|
+
}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"date": "Tue, 14 Sep 2021 20:09:02 GMT",
|
|
6
128
|
"tag": "@fluentui/react-button_v9.0.0-alpha.85",
|
|
7
129
|
"version": "9.0.0-alpha.85",
|
|
8
130
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,57 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-button
|
|
2
2
|
|
|
3
|
-
This log was last generated on Tue,
|
|
3
|
+
This log was last generated on Tue, 21 Sep 2021 07:40:35 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-alpha.89](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.0-alpha.89)
|
|
8
|
+
|
|
9
|
+
Tue, 21 Sep 2021 07:40:35 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.0-alpha.88..@fluentui/react-button_v9.0.0-alpha.89)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- Updating to types over interfaces ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by gcox@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-make-styles to v9.0.0-alpha.69 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
16
|
+
- Bump @fluentui/react-tabster to v9.0.0-alpha.63 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
17
|
+
- Bump @fluentui/babel-make-styles to v9.0.0-alpha.51 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
18
|
+
- Bump @fluentui/jest-serializer-make-styles to v9.0.0-alpha.44 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
19
|
+
- Bump @fluentui/react-conformance-make-styles to v9.0.0-alpha.13 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
20
|
+
- Bump @fluentui/react-menu to v9.0.0-alpha.80 ([PR #19880](https://github.com/microsoft/fluentui/pull/19880) by beachball)
|
|
21
|
+
|
|
22
|
+
## [9.0.0-alpha.88](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.0-alpha.88)
|
|
23
|
+
|
|
24
|
+
Mon, 20 Sep 2021 07:36:26 GMT
|
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.0-alpha.87..@fluentui/react-button_v9.0.0-alpha.88)
|
|
26
|
+
|
|
27
|
+
### Changes
|
|
28
|
+
|
|
29
|
+
- SplitButton: Re-introducing SplitButton using the latest version of makeStyles. ([PR #19844](https://github.com/microsoft/fluentui/pull/19844) by Humberto.Morimoto@microsoft.com)
|
|
30
|
+
- Bump @fluentui/react-button to v9.0.0-alpha.88 ([PR #19844](https://github.com/microsoft/fluentui/pull/19844) by lingfangao@hotmail.com)
|
|
31
|
+
|
|
32
|
+
## [9.0.0-alpha.87](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.0-alpha.87)
|
|
33
|
+
|
|
34
|
+
Fri, 17 Sep 2021 07:35:26 GMT
|
|
35
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.0-alpha.86..@fluentui/react-button_v9.0.0-alpha.87)
|
|
36
|
+
|
|
37
|
+
### Changes
|
|
38
|
+
|
|
39
|
+
- Modifying MenuButton to adhere to MenuTrigger changes. ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
|
|
40
|
+
- Updating API comments to be more descriptive. ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
|
|
41
|
+
- Bump @fluentui/react-button to v9.0.0-alpha.87 ([PR #19840](https://github.com/microsoft/fluentui/pull/19840) by Humberto.Morimoto@microsoft.com)
|
|
42
|
+
|
|
43
|
+
## [9.0.0-alpha.86](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.0-alpha.86)
|
|
44
|
+
|
|
45
|
+
Thu, 16 Sep 2021 07:38:39 GMT
|
|
46
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.0-alpha.85..@fluentui/react-button_v9.0.0-alpha.86)
|
|
47
|
+
|
|
48
|
+
### Changes
|
|
49
|
+
|
|
50
|
+
- Bump @fluentui/react-button to v9.0.0-alpha.86 ([PR #19815](https://github.com/microsoft/fluentui/pull/19815) by behowell@microsoft.com)
|
|
51
|
+
|
|
7
52
|
## [9.0.0-alpha.85](https://github.com/microsoft/fluentui/tree/@fluentui/react-button_v9.0.0-alpha.85)
|
|
8
53
|
|
|
9
|
-
Tue, 14 Sep 2021 20:
|
|
54
|
+
Tue, 14 Sep 2021 20:09:02 GMT
|
|
10
55
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-button_v9.0.0-alpha.84..@fluentui/react-button_v9.0.0-alpha.85)
|
|
11
56
|
|
|
12
57
|
### Changes
|
package/dist/react-button.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComponentPropsCompat } from '@fluentui/react-utilities';
|
|
2
2
|
import type { ComponentStateCompat } from '@fluentui/react-utilities';
|
|
3
3
|
import type { MenuTriggerChildProps } from '@fluentui/react-menu';
|
|
4
4
|
import * as React_2 from 'react';
|
|
5
|
-
import
|
|
5
|
+
import { ShorthandPropsCompat } from '@fluentui/react-utilities';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Buttons give people a way to trigger an action.
|
|
@@ -84,7 +84,7 @@ export declare type ButtonShorthandPropsCompat = 'icon';
|
|
|
84
84
|
*/
|
|
85
85
|
export declare const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[];
|
|
86
86
|
|
|
87
|
-
export declare
|
|
87
|
+
export declare type ButtonState = ComponentStateCompat<ButtonProps, ButtonShorthandPropsCompat, ButtonDefaultedProps> & {
|
|
88
88
|
/**
|
|
89
89
|
* A button can contain only an icon.
|
|
90
90
|
* @default false
|
|
@@ -94,25 +94,40 @@ export declare interface ButtonState extends ComponentStateCompat<ButtonProps, B
|
|
|
94
94
|
* Ref to the root element
|
|
95
95
|
*/
|
|
96
96
|
ref: React_2.Ref<HTMLElement>;
|
|
97
|
-
}
|
|
97
|
+
};
|
|
98
98
|
|
|
99
|
-
export declare
|
|
99
|
+
export declare type CheckedState = {
|
|
100
100
|
checked?: boolean;
|
|
101
101
|
defaultChecked?: boolean;
|
|
102
102
|
onClick?: React_2.DOMAttributes<HTMLElement>['onClick'];
|
|
103
103
|
role?: string;
|
|
104
104
|
'aria-checked'?: React_2.AriaAttributes['aria-pressed'];
|
|
105
105
|
'aria-pressed'?: React_2.AriaAttributes['aria-pressed'];
|
|
106
|
-
}
|
|
106
|
+
};
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* CompoundButtons are buttons that can have secondary content that adds extra information to the user.
|
|
110
110
|
*/
|
|
111
|
-
export declare const CompoundButton: React_2.ForwardRefExoticComponent<
|
|
111
|
+
export declare const CompoundButton: React_2.ForwardRefExoticComponent<ComponentPropsCompat & React_2.ButtonHTMLAttributes<HTMLElement> & {
|
|
112
|
+
icon?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>;
|
|
113
|
+
block?: boolean | undefined;
|
|
114
|
+
circular?: boolean | undefined;
|
|
115
|
+
disabled?: boolean | undefined;
|
|
116
|
+
disabledFocusable?: boolean | undefined;
|
|
117
|
+
iconPosition?: "before" | "after" | undefined;
|
|
118
|
+
outline?: boolean | undefined;
|
|
119
|
+
primary?: boolean | undefined;
|
|
120
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
121
|
+
subtle?: boolean | undefined;
|
|
122
|
+
transparent?: boolean | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
secondaryContent?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>;
|
|
125
|
+
contentContainer?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>;
|
|
126
|
+
} & React_2.RefAttributes<HTMLElement>>;
|
|
112
127
|
|
|
113
128
|
export declare type CompoundButtonDefaultedProps = ButtonDefaultedProps | 'contentContainer' | 'secondaryContent';
|
|
114
129
|
|
|
115
|
-
export declare
|
|
130
|
+
export declare type CompoundButtonProps = ButtonProps & {
|
|
116
131
|
/**
|
|
117
132
|
* Second line of text that describes the action this button takes.
|
|
118
133
|
*/
|
|
@@ -121,7 +136,7 @@ export declare interface CompoundButtonProps extends ButtonProps {
|
|
|
121
136
|
* Container that wraps the children and secondaryContent slots.
|
|
122
137
|
*/
|
|
123
138
|
contentContainer?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>;
|
|
124
|
-
}
|
|
139
|
+
};
|
|
125
140
|
|
|
126
141
|
export declare type CompoundButtonShorthandPropsCompat = ButtonShorthandPropsCompat | 'contentContainer' | 'secondaryContent';
|
|
127
142
|
|
|
@@ -130,8 +145,7 @@ export declare type CompoundButtonShorthandPropsCompat = ButtonShorthandPropsCom
|
|
|
130
145
|
*/
|
|
131
146
|
export declare const compoundButtonShorthandPropsCompat: CompoundButtonShorthandPropsCompat[];
|
|
132
147
|
|
|
133
|
-
export declare
|
|
134
|
-
}
|
|
148
|
+
export declare type CompoundButtonState = ButtonState & ComponentStateCompat<CompoundButtonProps, CompoundButtonShorthandPropsCompat, CompoundButtonDefaultedProps>;
|
|
135
149
|
|
|
136
150
|
/**
|
|
137
151
|
* MenuButtons are buttons that handle opening and closing a menu when they are triggered.
|
|
@@ -140,7 +154,7 @@ export declare const MenuButton: React_2.FunctionComponent<MenuButtonProps & Rea
|
|
|
140
154
|
|
|
141
155
|
export declare type MenuButtonDefaultedProps = ButtonDefaultedProps | 'menuIcon';
|
|
142
156
|
|
|
143
|
-
export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<MenuTriggerChildProps
|
|
157
|
+
export declare type MenuButtonProps = Omit<ButtonProps, 'iconPosition'> & Partial<Omit<MenuTriggerChildProps, 'ref'>> & {
|
|
144
158
|
/**
|
|
145
159
|
* Menu icon that indicates that this button has a menu that can be expanded.
|
|
146
160
|
*/
|
|
@@ -154,8 +168,7 @@ export declare type MenuButtonShorthandPropsCompat = ButtonShorthandPropsCompat
|
|
|
154
168
|
*/
|
|
155
169
|
export declare const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[];
|
|
156
170
|
|
|
157
|
-
export declare
|
|
158
|
-
}
|
|
171
|
+
export declare type MenuButtonState = Omit<ButtonState, 'iconPosition'> & ComponentStateCompat<MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonDefaultedProps>;
|
|
159
172
|
|
|
160
173
|
/**
|
|
161
174
|
* Renders a Button component by passing the state defined props to the appropriate slots.
|
|
@@ -174,14 +187,72 @@ export declare const renderCompoundButton: (state: CompoundButtonState) => JSX.E
|
|
|
174
187
|
*/
|
|
175
188
|
export declare const renderMenuButton: (state: MenuButtonState) => JSX.Element;
|
|
176
189
|
|
|
190
|
+
/**
|
|
191
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
|
192
|
+
*/
|
|
193
|
+
export declare const renderSplitButton: (state: SplitButtonState) => JSX.Element;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
|
197
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
|
198
|
+
*/
|
|
199
|
+
export declare const SplitButton: React_2.ForwardRefExoticComponent<SplitButtonProps & React_2.RefAttributes<HTMLElement>>;
|
|
200
|
+
|
|
201
|
+
export declare type SplitButtonDefaultedProps = 'size';
|
|
202
|
+
|
|
203
|
+
export declare interface SplitButtonProps extends Omit<ButtonProps, ButtonShorthandPropsCompat>, MenuButtonProps {
|
|
204
|
+
/**
|
|
205
|
+
* Button to perform primary action in SplitButton.
|
|
206
|
+
*/
|
|
207
|
+
button?: ShorthandPropsCompat<ButtonProps>;
|
|
208
|
+
/**
|
|
209
|
+
* Button that opens menu with secondary actions in SplitButton.
|
|
210
|
+
*/
|
|
211
|
+
menuButton?: ShorthandPropsCompat<MenuButtonProps>;
|
|
212
|
+
/**
|
|
213
|
+
* Ref to the Button element.
|
|
214
|
+
*/
|
|
215
|
+
buttonRef?: React_2.Ref<HTMLElement>;
|
|
216
|
+
/**
|
|
217
|
+
* Ref to the MenuButton element.
|
|
218
|
+
*/
|
|
219
|
+
menuButtonRef?: React_2.Ref<HTMLElement>;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export declare const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[];
|
|
223
|
+
|
|
224
|
+
export declare type SplitButtonShorthandPropsCompat = 'button' | 'menuButton';
|
|
225
|
+
|
|
226
|
+
export declare interface SplitButtonState extends ComponentStateCompat<SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonDefaultedProps> {
|
|
227
|
+
/**
|
|
228
|
+
* Ref to the root element
|
|
229
|
+
*/
|
|
230
|
+
ref: React_2.Ref<HTMLElement>;
|
|
231
|
+
}
|
|
232
|
+
|
|
177
233
|
/**
|
|
178
234
|
* ToggleButtons are buttons that toggle between two defined states when triggered.
|
|
179
235
|
*/
|
|
180
|
-
export declare const ToggleButton: React_2.ForwardRefExoticComponent<
|
|
236
|
+
export declare const ToggleButton: React_2.ForwardRefExoticComponent<ComponentPropsCompat & React_2.ButtonHTMLAttributes<HTMLElement> & {
|
|
237
|
+
icon?: ShorthandPropsCompat<React_2.HTMLAttributes<HTMLElement>>;
|
|
238
|
+
block?: boolean | undefined;
|
|
239
|
+
circular?: boolean | undefined;
|
|
240
|
+
disabled?: boolean | undefined;
|
|
241
|
+
disabledFocusable?: boolean | undefined;
|
|
242
|
+
iconPosition?: "before" | "after" | undefined;
|
|
243
|
+
outline?: boolean | undefined;
|
|
244
|
+
primary?: boolean | undefined;
|
|
245
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
246
|
+
subtle?: boolean | undefined;
|
|
247
|
+
transparent?: boolean | undefined;
|
|
248
|
+
} & {
|
|
249
|
+
checked?: boolean | undefined;
|
|
250
|
+
defaultChecked?: boolean | undefined;
|
|
251
|
+
} & React_2.RefAttributes<HTMLElement>>;
|
|
181
252
|
|
|
182
253
|
export declare type ToggleButtonDefaultedProps = ButtonDefaultedProps;
|
|
183
254
|
|
|
184
|
-
export declare
|
|
255
|
+
export declare type ToggleButtonProps = ButtonProps & {
|
|
185
256
|
/**
|
|
186
257
|
* Defines the controlled checked state of the `ToggleButton`.
|
|
187
258
|
* Mutually exclusive to `defaultChecked`.
|
|
@@ -196,21 +267,22 @@ export declare interface ToggleButtonProps extends ButtonProps {
|
|
|
196
267
|
* @default false
|
|
197
268
|
*/
|
|
198
269
|
defaultChecked?: boolean;
|
|
199
|
-
}
|
|
270
|
+
};
|
|
200
271
|
|
|
201
272
|
export declare type ToggleButtonShorthandPropsCompat = ButtonShorthandPropsCompat;
|
|
202
273
|
|
|
203
|
-
export declare
|
|
204
|
-
}
|
|
274
|
+
export declare type ToggleButtonState = ButtonState & ComponentStateCompat<ToggleButtonProps, ToggleButtonShorthandPropsCompat, ToggleButtonDefaultedProps>;
|
|
205
275
|
|
|
206
276
|
/**
|
|
207
|
-
* Given user props,
|
|
277
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
|
278
|
+
* @param props - User provided props to the Button component.
|
|
279
|
+
* @param ref - User provided ref to be passed to the Button component.
|
|
208
280
|
*/
|
|
209
281
|
export declare const useButton: (props: ButtonProps, ref: React_2.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
|
|
210
282
|
|
|
211
283
|
/**
|
|
212
|
-
* The useButton hook processes the Button
|
|
213
|
-
* @param state - Button
|
|
284
|
+
* The useButton hook processes the Button state.
|
|
285
|
+
* @param state - Button state to mutate.
|
|
214
286
|
*/
|
|
215
287
|
export declare const useButtonState: (state: ButtonState) => ButtonState;
|
|
216
288
|
|
|
@@ -223,23 +295,44 @@ export declare const useButtonStyles: (state: ButtonState) => ButtonState;
|
|
|
223
295
|
export declare const useChecked: <TState extends CheckedState>(state: TState) => void;
|
|
224
296
|
|
|
225
297
|
/**
|
|
226
|
-
* Given user props,
|
|
298
|
+
* Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.
|
|
299
|
+
* @param props - User provided props to the CompoundButton component.
|
|
300
|
+
* @param ref - User provided ref to be passed to the CompoundButton component.
|
|
227
301
|
*/
|
|
228
302
|
export declare const useCompoundButton: (props: CompoundButtonProps, ref: React_2.Ref<HTMLElement>, defaultProps?: CompoundButtonProps | undefined) => CompoundButtonState;
|
|
229
303
|
|
|
230
304
|
export declare const useCompoundButtonStyles: (state: CompoundButtonState) => CompoundButtonState;
|
|
231
305
|
|
|
232
306
|
/**
|
|
233
|
-
* Given user props,
|
|
307
|
+
* Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
|
|
308
|
+
* @param props - User provided props to the MenuButton component.
|
|
309
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
|
234
310
|
*/
|
|
235
311
|
export declare const useMenuButton: (props: MenuButtonProps, ref: React_2.Ref<HTMLElement>, defaultProps?: MenuButtonProps | undefined) => MenuButtonState;
|
|
236
312
|
|
|
313
|
+
/**
|
|
314
|
+
* The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
|
|
315
|
+
* additional MenuButton specific processing.
|
|
316
|
+
* @param state - MenuButtonButton state to mutate.
|
|
317
|
+
*/
|
|
237
318
|
export declare const useMenuButtonState: (state: MenuButtonState) => MenuButtonState;
|
|
238
319
|
|
|
239
320
|
export declare const useMenuButtonStyles: (state: MenuButtonState) => MenuButtonState;
|
|
240
321
|
|
|
241
322
|
/**
|
|
242
|
-
* Given user props,
|
|
323
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
|
324
|
+
* @param props - User provided props to the SplitButton component.
|
|
325
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
|
326
|
+
*/
|
|
327
|
+
export declare const useSplitButton: (props: SplitButtonProps, ref: React_2.Ref<HTMLElement>, defaultProps?: SplitButtonProps | undefined) => SplitButtonState;
|
|
328
|
+
|
|
329
|
+
export declare const useSplitButtonStyles: (state: SplitButtonState) => SplitButtonState;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
|
333
|
+
* processed state.
|
|
334
|
+
* @param props - User provided props to the ToggleButton component.
|
|
335
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
|
243
336
|
*/
|
|
244
337
|
export declare const useToggleButton: (props: ToggleButtonProps, ref: React_2.Ref<HTMLElement>, defaultProps?: ToggleButtonProps | undefined) => ToggleButtonState;
|
|
245
338
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/SplitButton/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitButton.js","sourceRoot":"../src/","sources":["SplitButton.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './components/SplitButton/index';\n"]}
|
|
@@ -67,7 +67,7 @@ export declare type ButtonProps = ComponentPropsCompat & React.ButtonHTMLAttribu
|
|
|
67
67
|
};
|
|
68
68
|
export declare type ButtonShorthandPropsCompat = 'icon';
|
|
69
69
|
export declare type ButtonDefaultedProps = 'icon' | 'size';
|
|
70
|
-
export
|
|
70
|
+
export declare type ButtonState = ComponentStateCompat<ButtonProps, ButtonShorthandPropsCompat, ButtonDefaultedProps> & {
|
|
71
71
|
/**
|
|
72
72
|
* A button can contain only an icon.
|
|
73
73
|
* @default false
|
|
@@ -77,4 +77,4 @@ export interface ButtonState extends ComponentStateCompat<ButtonProps, ButtonSho
|
|
|
77
77
|
* Ref to the root element
|
|
78
78
|
*/
|
|
79
79
|
ref: React.Ref<HTMLElement>;
|
|
80
|
-
}
|
|
80
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentPropsCompat, ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\n\nexport type ButtonProps = ComponentPropsCompat &\n React.ButtonHTMLAttributes<HTMLElement> & {\n /**\n * Icon slot that, if specified, renders an icon either before or after the `children` as specified by the\n * `iconPosition` prop.\n */\n icon?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n\n // /**\n // * Loader slot that, if specified, renders a `loader` before the `icon` and `children` while the `loading` flag\n // * is set to `true`.\n // */\n // loader?: ShorthandPropsCompat<React.HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * A button can fill the width of its container.\n * @default false\n */\n block?: boolean;\n\n /**\n * A button can have completely rounded corners.\n * @default false\n */\n circular?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n // /**\n // * A button can show a loading indicator if it is waiting for another action to happen before allowing itself to\n // * be interacted with.\n // * @default false\n // */\n // loading?: boolean;\n\n /**\n * A button can be styled such that it has no background styling and is just emphasized through the styling of\n * its content and borders.\n * Mutually exclusive with `primary`, `subtle` and `transparent`.\n * @default false\n */\n outline?: boolean;\n\n /**\n * A button can be styled to emphasize that it represents the primary action.\n * Mutually exclusive with `outline`, `subtle` and `transparent`.\n * @default false\n */\n primary?: boolean;\n\n /**\n * A button supports different sizes.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * A button can be styled to blend into its background and become less emphasized.\n * @default false\n * Mutually exclusive with `outline`, `primary` and `transparent`.\n */\n subtle?: boolean;\n\n /**\n * A button can be styled such that it has no background or border styling and is just emphasized through its\n * content styling.\n * Mutually exclusive with `outline`, `primary` and `subtle`.\n * @default false\n */\n transparent?: boolean;\n };\n\nexport type ButtonShorthandPropsCompat = 'icon';\n\nexport type ButtonDefaultedProps = 'icon' | 'size';\n\nexport
|
|
1
|
+
{"version":3,"file":"Button.types.js","sourceRoot":"../src/","sources":["components/Button/Button.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentPropsCompat, ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';\n\nexport type ButtonProps = ComponentPropsCompat &\n React.ButtonHTMLAttributes<HTMLElement> & {\n /**\n * Icon slot that, if specified, renders an icon either before or after the `children` as specified by the\n * `iconPosition` prop.\n */\n icon?: ShorthandPropsCompat<React.HTMLAttributes<HTMLElement>>;\n\n // /**\n // * Loader slot that, if specified, renders a `loader` before the `icon` and `children` while the `loading` flag\n // * is set to `true`.\n // */\n // loader?: ShorthandPropsCompat<React.HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * A button can fill the width of its container.\n * @default false\n */\n block?: boolean;\n\n /**\n * A button can have completely rounded corners.\n * @default false\n */\n circular?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n // /**\n // * A button can show a loading indicator if it is waiting for another action to happen before allowing itself to\n // * be interacted with.\n // * @default false\n // */\n // loading?: boolean;\n\n /**\n * A button can be styled such that it has no background styling and is just emphasized through the styling of\n * its content and borders.\n * Mutually exclusive with `primary`, `subtle` and `transparent`.\n * @default false\n */\n outline?: boolean;\n\n /**\n * A button can be styled to emphasize that it represents the primary action.\n * Mutually exclusive with `outline`, `subtle` and `transparent`.\n * @default false\n */\n primary?: boolean;\n\n /**\n * A button supports different sizes.\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * A button can be styled to blend into its background and become less emphasized.\n * @default false\n * Mutually exclusive with `outline`, `primary` and `transparent`.\n */\n subtle?: boolean;\n\n /**\n * A button can be styled such that it has no background or border styling and is just emphasized through its\n * content styling.\n * Mutually exclusive with `outline`, `primary` and `subtle`.\n * @default false\n */\n transparent?: boolean;\n };\n\nexport type ButtonShorthandPropsCompat = 'icon';\n\nexport type ButtonDefaultedProps = 'icon' | 'size';\n\nexport type ButtonState = ComponentStateCompat<ButtonProps, ButtonShorthandPropsCompat, ButtonDefaultedProps> & {\n /**\n * A button can contain only an icon.\n * @default false\n */\n iconOnly?: boolean;\n\n /**\n * Ref to the root element\n */\n ref: React.Ref<HTMLElement>;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,0BAAT,QAA2C,aAA3C;AAGA;;AAEG;;AACH,OAAO,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,0BAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,
|
|
1
|
+
{"version":3,"sources":["components/Button/renderButton.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,cAAT,QAA+B,2BAA/B;AACA,SAAS,0BAAT,QAA2C,aAA3C;AAGA;;AAEG;;AACH,OAAO,IAAM,YAAY,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAA,GAAuB,cAAc,CAAC,KAAD,EAAQ,0BAAR,CAArC;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AACE,MAAA,QAAQ,GAA6B,KAAK,CAAlC,QAAR;AAAA,MAAU,QAAQ,GAAmB,KAAK,CAAxB,QAAlB;AAAA,MAAoB,YAAY,GAAK,KAAK,CAAV,YAAhC;AAER,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAH/B,CADF;AAOD,CAXM","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { buttonShorthandPropsCompat } from './useButton';\nimport type { ButtonState } from './Button.types';\n\n/**\n * Renders a Button component by passing the state defined props to the appropriate slots.\n */\nexport const renderButton = (state: ButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, buttonShorthandPropsCompat);\n const { children, iconOnly, iconPosition } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {iconPosition !== 'after' && <slots.icon {...slotProps.icon} />}\n {!iconOnly && children}\n {iconPosition === 'after' && <slots.icon {...slotProps.icon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -5,6 +5,8 @@ import type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './But
|
|
|
5
5
|
*/
|
|
6
6
|
export declare const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[];
|
|
7
7
|
/**
|
|
8
|
-
* Given user props,
|
|
8
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
|
9
|
+
* @param props - User provided props to the Button component.
|
|
10
|
+
* @param ref - User provided ref to be passed to the Button component.
|
|
9
11
|
*/
|
|
10
12
|
export declare const useButton: (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps | undefined) => ButtonState;
|
|
@@ -9,7 +9,9 @@ var mergeProps = /*#__PURE__*/makeMergeProps({
|
|
|
9
9
|
deepMerge: buttonShorthandPropsCompat
|
|
10
10
|
});
|
|
11
11
|
/**
|
|
12
|
-
* Given user props,
|
|
12
|
+
* Given user props, defines default props for the Button, calls useButtonState, and returns processed state.
|
|
13
|
+
* @param props - User provided props to the Button component.
|
|
14
|
+
* @param ref - User provided ref to be passed to the Button component.
|
|
13
15
|
*/
|
|
14
16
|
|
|
15
17
|
export var useButton = function (props, ref, defaultProps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAGA;;AAEG;;AACH,OAAO,IAAM,0BAA0B,GAAiC,CAAC,MAAD,CAAjE;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAc;AAAE,EAAA,SAAS,EAAE;AAAb,CAAd,CAAjC;AAEA;;
|
|
1
|
+
{"version":3,"sources":["components/Button/useButton.ts"],"names":[],"mappings":"AACA,SAAS,cAAT,EAAyB,qBAAzB,QAAsD,2BAAtD;AACA,SAAS,cAAT,QAA+B,kBAA/B;AAGA;;AAEG;;AACH,OAAO,IAAM,0BAA0B,GAAiC,CAAC,MAAD,CAAjE;AAEP,IAAM,UAAU,gBAAG,cAAc,CAAc;AAAE,EAAA,SAAS,EAAE;AAAb,CAAd,CAAjC;AAEA;;;;AAIG;;AACH,OAAO,IAAM,SAAS,GAAG,UAAC,KAAD,EAAqB,GAArB,EAAkD,YAAlD,EAA4E;AACnG,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,IAAI,EAAE,QANR;AAOE,IAAA,IAAI,EAAE;AAPR,GADsB,EAUtB,YAAY,IAAI,qBAAqB,CAAC,YAAD,EAAe,0BAAf,CAVf,EAWtB,qBAAqB,CAAC,KAAD,EAAQ,0BAAR,CAXC,CAAxB;AAcA,EAAA,cAAc,CAAC,KAAD,CAAd;AAEA,SAAO,KAAP;AACD,CAlBM","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useButtonState } from './useButtonState';\nimport type { ButtonProps, ButtonShorthandPropsCompat, ButtonState } from './Button.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const buttonShorthandPropsCompat: ButtonShorthandPropsCompat[] = ['icon'];\n\nconst mergeProps = makeMergeProps<ButtonState>({ deepMerge: buttonShorthandPropsCompat });\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton = (props: ButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ButtonProps): ButtonState => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Slots\n icon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, buttonShorthandPropsCompat),\n resolveShorthandProps(props, buttonShorthandPropsCompat),\n );\n\n useButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ButtonState } from './Button.types';
|
|
2
2
|
/**
|
|
3
|
-
* The useButton hook processes the Button
|
|
4
|
-
* @param state - Button
|
|
3
|
+
* The useButton hook processes the Button state.
|
|
4
|
+
* @param state - Button state to mutate.
|
|
5
5
|
*/
|
|
6
6
|
export declare const useButtonState: (state: ButtonState) => ButtonState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Enter, Space } from '@fluentui/keyboard-keys';
|
|
2
2
|
/**
|
|
3
|
-
* The useButton hook processes the Button
|
|
4
|
-
* @param state - Button
|
|
3
|
+
* The useButton hook processes the Button state.
|
|
4
|
+
* @param state - Button state to mutate.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export var useButtonState = function (state) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Button/useButtonState.ts"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button
|
|
1
|
+
{"version":3,"sources":["components/Button/useButtonState.ts"],"names":[],"mappings":"AACA,SAAS,KAAT,EAAgB,KAAhB,QAA6B,yBAA7B;AAGA;;;AAGG;;AACH,OAAO,IAAM,cAAc,GAAG,UAAC,KAAD,EAAmB;AACvC,MAAA,EAAE,GAAyF,KAAK,CAA9F,EAAF;AAAA,MAAI,QAAQ,GAA+E,KAAK,CAApF,QAAZ;AAAA,MAAc,QAAQ,GAAqE,KAAK,CAA1E,QAAtB;AAAA,MAAwB,iBAAiB,GAAkD,KAAK,CAAvD,iBAAzC;AAAA,MAA2C,IAAI,GAA4C,KAAK,CAAjD,IAA/C;AAAA,MAAiD,OAAO,GAAmC,KAAK,CAAxC,OAAxD;AAAA,MAAqE,iBAAiB,GAAK,KAAK,CAAV,SAAtF;AAER,MAAM,gBAAgB,GAAG,CAAC,CAAC,QAA3B;AACA,MAAM,YAAY,GAAG,CAAC,EAAC,IAAI,KAAA,IAAJ,IAAA,IAAI,KAAA,KAAA,CAAJ,GAAI,KAAA,CAAJ,GAAA,IAAI,CAAE,QAAP,CAAtB;AACA,EAAA,KAAK,CAAC,QAAN,GAAiB,YAAY,IAAI,CAAC,gBAAlC;;AAEA,MAAM,0BAA0B,GAAG,UAAC,EAAD,EAAqC;AACtE,IAAA,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,EAAH,CAAjB;AAEA,QAAM,GAAG,GAAG,EAAE,CAAC,GAAf;;AACA,QAAI,CAAC,EAAE,CAAC,gBAAJ,IAAwB,OAAxB,KAAoC,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA7D,CAAJ,EAAyE;AACvE;AACA,MAAA,EAAE,CAAC,cAAH;AACA,MAAA,EAAE,CAAC,eAAH;AAEA,MAAA,OAAO,CAAE,EAAF,CAAP;AACD;AACF,GAXD,CAP+C,CAoB/C;;;AACA,MAAI,OAAO,EAAP,KAAc,QAAlB,EAA4B;AAC1B;AACA,QAAI,EAAE,KAAK,QAAX,EAAqB;AACnB,MAAA,KAAK,CAAC,IAAN,GAAa,QAAb;AACA,MAAA,KAAK,CAAC,QAAN,GAAiB,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,CAA9D,CAFmB,CAInB;;AACA,UAAI,EAAE,KAAK,GAAX,EAAgB;AACd,QAAA,KAAK,CAAC,SAAN,GAAkB,0BAAlB;AACD;AACF;AACF,GAXD,CAYA;AAZA,OAaK;AACH,IAAA,KAAK,CAAC,SAAN,GAAkB,0BAAlB;AACA,IAAA,KAAK,CAAC,IAAN,GAAa,QAAb;AACA,IAAA,KAAK,CAAC,QAAN,GAAiB,QAAQ,IAAI,CAAC,iBAAb,GAAiC,SAAjC,GAA6C,CAA9D;AACD,GAtC8C,CAwC/C;;;AACA,EAAA,KAAK,CAAC,OAAN,GAAgB,UAAC,EAAD,EAAkC;AAChD,QAAI,QAAQ,IAAI,iBAAhB,EAAmC;AACjC,MAAA,EAAE,CAAC,cAAH;AACD,KAFD,MAEO;AACL,MAAA,OAAO,KAAA,IAAP,IAAA,OAAO,KAAA,KAAA,CAAP,GAAO,KAAA,CAAP,GAAA,OAAO,CAAG,EAAH,CAAP;AACD;AACF,GAND,CAzC+C,CAiD/C;;;AACQ,MAAA,SAAS,GAAK,KAAK,CAAV,SAAT;;AACR,EAAA,KAAK,CAAC,SAAN,GAAkB,UAAC,EAAD,EAAqC;AACrD,QAAM,GAAG,GAAG,EAAE,CAAC,GAAf;;AACA,QAAI,CAAC,QAAQ,IAAI,iBAAb,MAAoC,GAAG,KAAK,KAAR,IAAiB,GAAG,KAAK,KAA7D,CAAJ,EAAyE;AACvE,MAAA,EAAE,CAAC,cAAH;AACA,MAAA,EAAE,CAAC,eAAH;AACD,KAHD,MAGO;AACL,MAAA,SAAS,KAAA,IAAT,IAAA,SAAS,KAAA,KAAA,CAAT,GAAS,KAAA,CAAT,GAAA,SAAS,CAAG,EAAH,CAAT;AACD;AACF,GARD,CAnD+C,CA6D/C;;;AACA,EAAA,KAAK,CAAC,QAAN,GAAiB,EAAE,KAAK,QAAP,GAAkB,QAAQ,IAAI,CAAC,iBAA/B,GAAmD,SAApE;AACA,EAAA,KAAK,CAAC,eAAD,CAAL,GAAyB,QAAQ,IAAI,CAAC,KAAK,CAAC,QAA5C;AAEA,SAAO,KAAP;AACD,CAlEM","sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport type { ButtonState } from './Button.types';\n\n/**\n * The useButton hook processes the Button state.\n * @param state - Button state to mutate.\n */\nexport const useButtonState = (state: ButtonState): ButtonState => {\n const { as, children, disabled, disabledFocusable, icon, onClick, onKeyDown: onKeyDownCallback } = state;\n\n const receivedChildren = !!children;\n const receivedIcon = !!icon?.children;\n state.iconOnly = receivedIcon && !receivedChildren;\n\n const onNonAnchorOrButtonKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n onKeyDownCallback?.(ev);\n\n const key = ev.key;\n if (!ev.defaultPrevented && onClick && (key === Enter || key === Space)) {\n // Translate the keydown enter/space to a click.\n ev.preventDefault();\n ev.stopPropagation();\n\n onClick((ev as unknown) as React.MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLElement>);\n }\n };\n\n // Adjust props depending on the root type.\n if (typeof as === 'string') {\n // Add 'role=button' and 'tabIndex=0' for all non-button elements.\n if (as !== 'button') {\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n\n // Add keydown event handler for all other non-anchor elements.\n if (as !== 'a') {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n }\n }\n }\n // Add keydown event handler, 'role=button' and 'tabIndex=0' for all other elements.\n else {\n state.onKeyDown = onNonAnchorOrButtonKeyDown;\n state.role = 'button';\n state.tabIndex = disabled && !disabledFocusable ? undefined : 0;\n }\n\n // Disallow click event when component is disabled and eat events when disabledFocusable is set to true.\n state.onClick = (ev: React.MouseEvent<HTMLElement>) => {\n if (disabled || disabledFocusable) {\n ev.preventDefault();\n } else {\n onClick?.(ev);\n }\n };\n\n // Disallow keydown event when component is disabled and eat events when disabledFocusable is set to true.\n const { onKeyDown } = state;\n state.onKeyDown = (ev: React.KeyboardEvent<HTMLElement>) => {\n const key = ev.key;\n if ((disabled || disabledFocusable) && (key === Enter || key === Space)) {\n ev.preventDefault();\n ev.stopPropagation();\n } else {\n onKeyDown?.(ev);\n }\n };\n\n // Set the aria-disabled and disabled props correctly.\n state.disabled = as === 'button' ? disabled && !disabledFocusable : undefined;\n state['aria-disabled'] = disabled && !state.disabled;\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|