@fluentui/react-toolbar 9.0.0-beta.10 → 9.0.0-beta.12
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 +124 -9
- package/CHANGELOG.md +36 -10
- package/README.md +1 -1
- package/dist/index.d.ts +12 -36
- package/lib/ToolbarRadioButton.js +2 -0
- package/lib/ToolbarRadioButton.js.map +1 -0
- package/lib/components/Toolbar/Toolbar.types.js.map +1 -1
- package/lib/components/Toolbar/ToolbarContext.js +1 -0
- package/lib/components/Toolbar/ToolbarContext.js.map +1 -1
- package/lib/components/Toolbar/useToolbar.js +48 -10
- package/lib/components/Toolbar/useToolbar.js.map +1 -1
- package/lib/components/Toolbar/useToolbarContextValues.js +3 -1
- package/lib/components/Toolbar/useToolbarContextValues.js.map +1 -1
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.js +15 -0
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.js.map +1 -0
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js +2 -0
- package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -0
- package/lib/components/ToolbarRadioButton/index.js +3 -0
- package/lib/components/ToolbarRadioButton/index.js.map +1 -0
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js +41 -0
- package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -0
- package/lib/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js +22 -0
- package/lib/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js.map +1 -0
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/{ToolbarRadio.js → ToolbarRadioButton.js} +2 -2
- package/lib-commonjs/ToolbarRadioButton.js.map +1 -0
- package/lib-commonjs/components/Toolbar/ToolbarContext.js +1 -0
- package/lib-commonjs/components/Toolbar/ToolbarContext.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbar.js +48 -10
- package/lib-commonjs/components/Toolbar/useToolbar.js.map +1 -1
- package/lib-commonjs/components/Toolbar/useToolbarContextValues.js +3 -1
- package/lib-commonjs/components/Toolbar/useToolbarContextValues.js.map +1 -1
- package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.js +26 -0
- package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.js.map +1 -0
- package/lib-commonjs/components/{ToolbarRadio/ToolbarRadio.types.js → ToolbarRadioButton/ToolbarRadioButton.types.js} +1 -1
- package/lib-commonjs/components/{ToolbarRadio/ToolbarRadio.types.js.map → ToolbarRadioButton/ToolbarRadioButton.types.js.map} +0 -0
- package/lib-commonjs/components/ToolbarRadioButton/index.js +12 -0
- package/lib-commonjs/components/ToolbarRadioButton/index.js.map +1 -0
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js +53 -0
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -0
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js +33 -0
- package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js.map +1 -0
- package/lib-commonjs/index.js +4 -13
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +9 -9
- package/lib/ToolbarRadio.js +0 -2
- package/lib/ToolbarRadio.js.map +0 -1
- package/lib/ToolbarRadioGroup.js +0 -2
- package/lib/ToolbarRadioGroup.js.map +0 -1
- package/lib/components/ToolbarRadio/ToolbarRadio.js +0 -19
- package/lib/components/ToolbarRadio/ToolbarRadio.js.map +0 -1
- package/lib/components/ToolbarRadio/ToolbarRadio.types.js +0 -2
- package/lib/components/ToolbarRadio/ToolbarRadio.types.js.map +0 -1
- package/lib/components/ToolbarRadio/index.js +0 -3
- package/lib/components/ToolbarRadio/index.js.map +0 -1
- package/lib/components/ToolbarRadio/useToolbarRadioStyles.js +0 -41
- package/lib/components/ToolbarRadio/useToolbarRadioStyles.js.map +0 -1
- package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.js +0 -20
- package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.js.map +0 -1
- package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js +0 -2
- package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js.map +0 -1
- package/lib/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js +0 -22
- package/lib/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js.map +0 -1
- package/lib/components/ToolbarRadioGroup/index.js +0 -3
- package/lib/components/ToolbarRadioGroup/index.js.map +0 -1
- package/lib/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js +0 -29
- package/lib/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js.map +0 -1
- package/lib-commonjs/ToolbarRadio.js.map +0 -1
- package/lib-commonjs/ToolbarRadioGroup.js +0 -10
- package/lib-commonjs/ToolbarRadioGroup.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadio/ToolbarRadio.js +0 -30
- package/lib-commonjs/components/ToolbarRadio/ToolbarRadio.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadio/index.js +0 -12
- package/lib-commonjs/components/ToolbarRadio/index.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadio/useToolbarRadioStyles.js +0 -51
- package/lib-commonjs/components/ToolbarRadio/useToolbarRadioStyles.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.js +0 -31
- package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js +0 -6
- package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js +0 -31
- package/lib-commonjs/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadioGroup/index.js +0 -12
- package/lib-commonjs/components/ToolbarRadioGroup/index.js.map +0 -1
- package/lib-commonjs/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js +0 -39
- package/lib-commonjs/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,122 @@
|
|
|
2
2
|
"name": "@fluentui/react-toolbar",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Wed, 02 Nov 2022 11:55:06 GMT",
|
|
6
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.12",
|
|
7
|
+
"version": "9.0.0-beta.12",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "olfedias@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-toolbar",
|
|
13
|
+
"commit": "c619ba066f11a8654e95375314824ba6b81b003e",
|
|
14
|
+
"comment": "chore: Update Griffel to latest version"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "olfedias@microsoft.com",
|
|
18
|
+
"package": "@fluentui/react-toolbar",
|
|
19
|
+
"commit": "78d042e6d3053da0902ef75330249dbaedc2493c",
|
|
20
|
+
"comment": "chore: remove dependencies on Fluent UI v8"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-toolbar",
|
|
25
|
+
"comment": "Bump @fluentui/react-button to v9.1.7",
|
|
26
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-toolbar",
|
|
31
|
+
"comment": "Bump @fluentui/react-divider to v9.1.3",
|
|
32
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-toolbar",
|
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.0",
|
|
38
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-toolbar",
|
|
43
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.0",
|
|
44
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-toolbar",
|
|
49
|
+
"comment": "Bump @fluentui/react-radio to v9.0.10",
|
|
50
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-toolbar",
|
|
55
|
+
"comment": "Bump @fluentui/react-tabster to v9.2.1",
|
|
56
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "beachball",
|
|
60
|
+
"package": "@fluentui/react-toolbar",
|
|
61
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.17",
|
|
62
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"none": [
|
|
66
|
+
{
|
|
67
|
+
"author": "chassunc@microsoft.com",
|
|
68
|
+
"package": "@fluentui/react-toolbar",
|
|
69
|
+
"commit": "abfb64d82916efdb0e5129cf41081a13e4e9d9ff",
|
|
70
|
+
"comment": "chore: add few small toolbar improvements"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"date": "Tue, 25 Oct 2022 22:09:49 GMT",
|
|
77
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.11",
|
|
78
|
+
"version": "9.0.0-beta.11",
|
|
79
|
+
"comments": {
|
|
80
|
+
"none": [
|
|
81
|
+
{
|
|
82
|
+
"author": "chassunc@microsoft.com",
|
|
83
|
+
"package": "@fluentui/react-toolbar",
|
|
84
|
+
"commit": "dba7e9c342ca32d05d49d341b3912cd79652f238",
|
|
85
|
+
"comment": "chore: remove best practices"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"author": "chassunc@microsoft.com",
|
|
89
|
+
"package": "@fluentui/react-toolbar",
|
|
90
|
+
"commit": "9bde21168a1032d2a429939b9b2d7d3ba590726f",
|
|
91
|
+
"comment": "feat: replace ToolbarRadio implementation by usage of toggle button as radio"
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"date": "Tue, 25 Oct 2022 00:35:39 GMT",
|
|
98
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.11",
|
|
99
|
+
"version": "9.0.0-beta.11",
|
|
100
|
+
"comments": {
|
|
101
|
+
"none": [
|
|
102
|
+
{
|
|
103
|
+
"author": "miroslav.stastny@microsoft.com",
|
|
104
|
+
"package": "@fluentui/react-toolbar",
|
|
105
|
+
"commit": "6ced976a8d0e6a0e2e207da8fe0eb810e2bd19bc",
|
|
106
|
+
"comment": "Update package readme"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"prerelease": [
|
|
110
|
+
{
|
|
111
|
+
"author": "beachball",
|
|
112
|
+
"package": "@fluentui/react-toolbar",
|
|
113
|
+
"comment": "Bump @fluentui/react-button to v9.1.6",
|
|
114
|
+
"commit": "eef12b9ae58b64ff68576dc2d865b601e46c85b9"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"date": "Thu, 20 Oct 2022 08:39:54 GMT",
|
|
6
121
|
"tag": "@fluentui/react-toolbar_v9.0.0-beta.10",
|
|
7
122
|
"version": "9.0.0-beta.10",
|
|
8
123
|
"comments": {
|
|
@@ -31,49 +146,49 @@
|
|
|
31
146
|
"author": "beachball",
|
|
32
147
|
"package": "@fluentui/react-toolbar",
|
|
33
148
|
"comment": "Bump @fluentui/react-button to v9.1.5",
|
|
34
|
-
"commit": "
|
|
149
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
35
150
|
},
|
|
36
151
|
{
|
|
37
152
|
"author": "beachball",
|
|
38
153
|
"package": "@fluentui/react-toolbar",
|
|
39
154
|
"comment": "Bump @fluentui/react-divider to v9.1.2",
|
|
40
|
-
"commit": "
|
|
155
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
41
156
|
},
|
|
42
157
|
{
|
|
43
158
|
"author": "beachball",
|
|
44
159
|
"package": "@fluentui/react-toolbar",
|
|
45
160
|
"comment": "Bump @fluentui/react-theme to v9.1.1",
|
|
46
|
-
"commit": "
|
|
161
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
47
162
|
},
|
|
48
163
|
{
|
|
49
164
|
"author": "beachball",
|
|
50
165
|
"package": "@fluentui/react-toolbar",
|
|
51
166
|
"comment": "Bump @fluentui/react-utilities to v9.1.2",
|
|
52
|
-
"commit": "
|
|
167
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
53
168
|
},
|
|
54
169
|
{
|
|
55
170
|
"author": "beachball",
|
|
56
171
|
"package": "@fluentui/react-toolbar",
|
|
57
172
|
"comment": "Bump @fluentui/react-context-selector to v9.0.5",
|
|
58
|
-
"commit": "
|
|
173
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
59
174
|
},
|
|
60
175
|
{
|
|
61
176
|
"author": "beachball",
|
|
62
177
|
"package": "@fluentui/react-toolbar",
|
|
63
178
|
"comment": "Bump @fluentui/react-radio to v9.0.9",
|
|
64
|
-
"commit": "
|
|
179
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
65
180
|
},
|
|
66
181
|
{
|
|
67
182
|
"author": "beachball",
|
|
68
183
|
"package": "@fluentui/react-toolbar",
|
|
69
184
|
"comment": "Bump @fluentui/react-tabster to v9.2.0",
|
|
70
|
-
"commit": "
|
|
185
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
71
186
|
},
|
|
72
187
|
{
|
|
73
188
|
"author": "beachball",
|
|
74
189
|
"package": "@fluentui/react-toolbar",
|
|
75
190
|
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16",
|
|
76
|
-
"commit": "
|
|
191
|
+
"commit": "5ea1372675d910d76cf1b9cbd74d05b7c4e8fcbc"
|
|
77
192
|
}
|
|
78
193
|
]
|
|
79
194
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,26 +1,52 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-toolbar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 02 Nov 2022 11:55:06 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.12)
|
|
8
|
+
|
|
9
|
+
Wed, 02 Nov 2022 11:55:06 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.11..@fluentui/react-toolbar_v9.0.0-beta.12)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- chore: Update Griffel to latest version ([PR #25412](https://github.com/microsoft/fluentui/pull/25412) by olfedias@microsoft.com)
|
|
15
|
+
- chore: remove dependencies on Fluent UI v8 ([PR #25466](https://github.com/microsoft/fluentui/pull/25466) by olfedias@microsoft.com)
|
|
16
|
+
- Bump @fluentui/react-button to v9.1.7 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
17
|
+
- Bump @fluentui/react-divider to v9.1.3 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
18
|
+
- Bump @fluentui/react-utilities to v9.2.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
19
|
+
- Bump @fluentui/react-context-selector to v9.1.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
20
|
+
- Bump @fluentui/react-radio to v9.0.10 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tabster to v9.2.1 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
22
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.17 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
23
|
+
|
|
24
|
+
## [9.0.0-beta.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.11)
|
|
25
|
+
|
|
26
|
+
Tue, 25 Oct 2022 00:35:39 GMT
|
|
27
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.10..@fluentui/react-toolbar_v9.0.0-beta.11)
|
|
28
|
+
|
|
29
|
+
### Changes
|
|
30
|
+
|
|
31
|
+
- Bump @fluentui/react-button to v9.1.6 ([PR #25363](https://github.com/microsoft/fluentui/pull/25363) by beachball)
|
|
32
|
+
|
|
7
33
|
## [9.0.0-beta.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.10)
|
|
8
34
|
|
|
9
|
-
Thu, 20 Oct 2022 08:
|
|
35
|
+
Thu, 20 Oct 2022 08:39:54 GMT
|
|
10
36
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.9..@fluentui/react-toolbar_v9.0.0-beta.10)
|
|
11
37
|
|
|
12
38
|
### Changes
|
|
13
39
|
|
|
14
40
|
- chore: Update Griffel to latest version ([PR #25212](https://github.com/microsoft/fluentui/pull/25212) by olfedias@microsoft.com)
|
|
15
41
|
- chore: Bump peer deps to support React 18 ([PR #24972](https://github.com/microsoft/fluentui/pull/24972) by mgodbolt@microsoft.com)
|
|
16
|
-
- Bump @fluentui/react-button to v9.1.5 ([
|
|
17
|
-
- Bump @fluentui/react-divider to v9.1.2 ([
|
|
18
|
-
- Bump @fluentui/react-theme to v9.1.1 ([
|
|
19
|
-
- Bump @fluentui/react-utilities to v9.1.2 ([
|
|
20
|
-
- Bump @fluentui/react-context-selector to v9.0.5 ([
|
|
21
|
-
- Bump @fluentui/react-radio to v9.0.9 ([
|
|
22
|
-
- Bump @fluentui/react-tabster to v9.2.0 ([
|
|
23
|
-
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16 ([
|
|
42
|
+
- Bump @fluentui/react-button to v9.1.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
43
|
+
- Bump @fluentui/react-divider to v9.1.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
44
|
+
- Bump @fluentui/react-theme to v9.1.1 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
45
|
+
- Bump @fluentui/react-utilities to v9.1.2 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
46
|
+
- Bump @fluentui/react-context-selector to v9.0.5 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
47
|
+
- Bump @fluentui/react-radio to v9.0.9 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
48
|
+
- Bump @fluentui/react-tabster to v9.2.0 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
49
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.16 ([PR #25265](https://github.com/microsoft/fluentui/pull/25265) by beachball)
|
|
24
50
|
|
|
25
51
|
## [9.0.0-beta.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.9)
|
|
26
52
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## WIP
|
|
4
4
|
|
|
5
|
-
**React Toolbar components for [Fluent UI React](https://
|
|
5
|
+
**React Toolbar components for [Fluent UI React](https://react.fluentui.dev)**
|
|
6
6
|
|
|
7
7
|
These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
|
package/dist/index.d.ts
CHANGED
|
@@ -8,28 +8,18 @@ import type { ComponentState } from '@fluentui/react-utilities';
|
|
|
8
8
|
import { DividerSlots } from '@fluentui/react-divider';
|
|
9
9
|
import { DividerState } from '@fluentui/react-divider';
|
|
10
10
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
11
|
-
import { RadioGroupProps } from '@fluentui/react-radio';
|
|
12
|
-
import { RadioGroupState } from '@fluentui/react-radio';
|
|
13
|
-
import { RadioProps } from '@fluentui/react-radio';
|
|
14
|
-
import { RadioState } from '@fluentui/react-radio';
|
|
15
11
|
import * as React_2 from 'react';
|
|
16
12
|
import type { Slot } from '@fluentui/react-utilities';
|
|
17
13
|
import { SlotClassNames } from '@fluentui/react-utilities';
|
|
18
14
|
import { ToggleButtonProps } from '@fluentui/react-button';
|
|
19
15
|
import { ToggleButtonState } from '@fluentui/react-button';
|
|
20
16
|
|
|
21
|
-
export declare type RadioGroupContextValue = Pick<RadioGroupProps, 'name' | 'value' | 'defaultValue' | 'disabled' | 'layout' | 'required'>;
|
|
22
|
-
|
|
23
|
-
export declare type RadioGroupContextValues = {
|
|
24
|
-
radioGroup: RadioGroupContextValue;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
17
|
/**
|
|
28
18
|
* Render the final JSX of Toolbar
|
|
29
19
|
*/
|
|
30
20
|
export declare const renderToolbar_unstable: (state: ToolbarState, contextValues: ToolbarContextValues) => JSX.Element;
|
|
31
21
|
|
|
32
|
-
declare type ToggableHandler = (e: React_2.MouseEvent | React_2.KeyboardEvent, name
|
|
22
|
+
declare type ToggableHandler = (e: React_2.MouseEvent | React_2.KeyboardEvent, name: string, value: string, checked?: boolean) => void;
|
|
33
23
|
|
|
34
24
|
/**
|
|
35
25
|
* Toolbar component
|
|
@@ -67,6 +57,7 @@ export declare const toolbarClassNames: SlotClassNames<ToolbarSlots>;
|
|
|
67
57
|
|
|
68
58
|
export declare type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {
|
|
69
59
|
handleToggleButton?: ToggableHandler;
|
|
60
|
+
handleRadio?: ToggableHandler;
|
|
70
61
|
};
|
|
71
62
|
|
|
72
63
|
export declare type ToolbarContextValues = {
|
|
@@ -128,39 +119,23 @@ export declare type ToolbarProps = ComponentProps<ToolbarSlots> & {
|
|
|
128
119
|
};
|
|
129
120
|
|
|
130
121
|
/**
|
|
131
|
-
*
|
|
132
|
-
*/
|
|
133
|
-
export declare const ToolbarRadio: ForwardRefComponent<ToolbarRadioProps>;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* ToolbarRadioGroup component is a RadioGroup to be used inside Toolbar
|
|
137
|
-
* which will keep always horizontal layout
|
|
138
|
-
*/
|
|
139
|
-
export declare const ToolbarRadioGroup: ForwardRefComponent<ToolbarRadioGroupProps>;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* ToolbarRadioGroup Props
|
|
122
|
+
* ToolbarRadioButton component
|
|
143
123
|
*/
|
|
144
|
-
export declare
|
|
124
|
+
export declare const ToolbarRadioButton: ForwardRefComponent<ToolbarRadioButtonProps>;
|
|
145
125
|
|
|
146
126
|
/**
|
|
147
|
-
*
|
|
127
|
+
* ToolbarRadioButton Props
|
|
148
128
|
*/
|
|
149
|
-
export declare type
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
*/
|
|
154
|
-
export declare type ToolbarRadioProps = RadioProps & {
|
|
155
|
-
size?: 'small' | 'medium';
|
|
129
|
+
export declare type ToolbarRadioButtonProps = ComponentProps<ButtonSlots> & Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {
|
|
130
|
+
appearance?: 'primary' | 'subtle';
|
|
131
|
+
name: string;
|
|
132
|
+
value: string;
|
|
156
133
|
};
|
|
157
134
|
|
|
158
135
|
/**
|
|
159
|
-
* State used in rendering
|
|
136
|
+
* State used in rendering ToolbarRadioButton
|
|
160
137
|
*/
|
|
161
|
-
export declare type
|
|
162
|
-
size?: 'small' | 'medium';
|
|
163
|
-
};
|
|
138
|
+
export declare type ToolbarRadioButtonState = ComponentState<Partial<ButtonSlots>> & ToggleButtonState & Required<Pick<ToggleButtonProps, 'checked'>> & Pick<ToolbarRadioButtonProps, 'name' | 'value'>;
|
|
164
139
|
|
|
165
140
|
export declare type ToolbarSlots = {
|
|
166
141
|
root: Slot<'div'>;
|
|
@@ -171,6 +146,7 @@ export declare type ToolbarSlots = {
|
|
|
171
146
|
*/
|
|
172
147
|
export declare type ToolbarState = ComponentState<ToolbarSlots> & Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> & Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {
|
|
173
148
|
handleToggleButton: ToggableHandler;
|
|
149
|
+
handleRadio: ToggableHandler;
|
|
174
150
|
};
|
|
175
151
|
|
|
176
152
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarRadioButton.js","sourceRoot":"../src/","sources":["ToolbarRadioButton.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './components/ToolbarRadioButton/index';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.types.js","sourceRoot":"../src/","sources":["components/Toolbar/Toolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n };\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<ToolbarState, 'checkedValues' | 'handleToggleButton'> &\n Partial<Pick<ToolbarState, 'checkedValues'>>;\n\nexport type ToggableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name
|
|
1
|
+
{"version":3,"file":"Toolbar.types.js","sourceRoot":"../src/","sources":["components/Toolbar/Toolbar.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type ToolbarSlots = {\n root: Slot<'div'>;\n};\n\nexport type ToolbarCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type ToolbarCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\n/**\n * Toolbar Props\n */\nexport type ToolbarProps = ComponentProps<ToolbarSlots> & {\n /**\n * Toolbar can have small or medium size\n *\n * @default medium\n */\n size?: 'small' | 'medium';\n\n /**\n * Toolbar can be vertical styled\n * @default false\n */\n vertical?: boolean;\n\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n onCheckedValueChange?: (e: ToolbarCheckedValueChangeEvent, data: ToolbarCheckedValueChangeData) => void;\n};\n\n/**\n * State used in rendering Toolbar\n */\nexport type ToolbarState = ComponentState<ToolbarSlots> &\n Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> &\n Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /*\n * Toggles the state of a ToggleButton item\n */\n handleToggleButton: ToggableHandler;\n /*\n * Toggles the state of a ToggleButton item\n */\n handleRadio: ToggableHandler;\n };\n\nexport type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {\n handleToggleButton?: ToggableHandler;\n handleRadio?: ToggableHandler;\n};\n\nexport type ToolbarContextValues = {\n toolbar: ToolbarContextValue;\n};\n\nexport type UninitializedToolbarState = Omit<ToolbarState, 'checkedValues' | 'handleToggleButton' | 'handleRadio'> &\n Partial<Pick<ToolbarState, 'checkedValues'>>;\n\nexport type ToggableHandler = (\n e: React.MouseEvent | React.KeyboardEvent,\n name: string,\n value: string,\n checked?: boolean,\n) => void;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Toolbar/ToolbarContext.ts"],"names":[],"mappings":"AAAA,SAA0B,aAA1B,EAAyC,kBAAzC,QAAmE,kCAAnE;AAIA,OAAO,MAAM,cAAc,gBAAG,aAAa,CAAkC,SAAlC,CAApC;AAEP,MAAM,0BAA0B,GAAwB;EACtD,IAAI,EAAE,QADgD;EAEtD,kBAAkB,EAAE,MAAM,IAF4B;EAGtD,
|
|
1
|
+
{"version":3,"sources":["components/Toolbar/ToolbarContext.ts"],"names":[],"mappings":"AAAA,SAA0B,aAA1B,EAAyC,kBAAzC,QAAmE,kCAAnE;AAIA,OAAO,MAAM,cAAc,gBAAG,aAAa,CAAkC,SAAlC,CAApC;AAEP,MAAM,0BAA0B,GAAwB;EACtD,IAAI,EAAE,QADgD;EAEtD,kBAAkB,EAAE,MAAM,IAF4B;EAGtD,WAAW,EAAE,MAAM,IAHmC;EAItD,QAAQ,EAAE,KAJ4C;EAKtD,aAAa,EAAE;AALuC,CAAxD;AAQA,OAAO,MAAM,0BAA0B,GAAO,QAAJ,IACxC,kBAAkB,CAAC,cAAD,EAAiB,CAAC,GAAG,GAAG,0BAAP,KAAsC,QAAQ,CAAC,GAAD,CAA/D,CADb","sourcesContent":["import { ContextSelector, createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context } from '@fluentui/react-context-selector';\nimport type { ToolbarContextValue } from './Toolbar.types';\n\nexport const ToolbarContext = createContext<ToolbarContextValue | undefined>(undefined) as Context<ToolbarContextValue>;\n\nconst toolbarContextDefaultValue: ToolbarContextValue = {\n size: 'medium' as 'medium',\n handleToggleButton: () => null,\n handleRadio: () => null,\n vertical: false,\n checkedValues: {},\n};\n\nexport const useToolbarContext_unstable = <T>(selector: ContextSelector<ToolbarContextValue, T>): T =>\n useContextSelector(ToolbarContext, (ctx = toolbarContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
|
|
@@ -37,14 +37,11 @@ export const useToolbar_unstable = (props, ref) => {
|
|
|
37
37
|
...props
|
|
38
38
|
})
|
|
39
39
|
};
|
|
40
|
-
const [checkedValues,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const [checkedValues, onCheckedValueChange] = useToolbarSelectableState({
|
|
41
|
+
checkedValues: props.checkedValues,
|
|
42
|
+
defaultCheckedValues: props.defaultCheckedValues,
|
|
43
|
+
onCheckedValueChange: props.onCheckedValueChange
|
|
44
44
|
});
|
|
45
|
-
const {
|
|
46
|
-
onCheckedValueChange
|
|
47
|
-
} = initialState;
|
|
48
45
|
const handleToggleButton = useEventCallback((e, name, value, checked) => {
|
|
49
46
|
if (name && value) {
|
|
50
47
|
const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
|
|
@@ -60,14 +57,55 @@ export const useToolbar_unstable = (props, ref) => {
|
|
|
60
57
|
name,
|
|
61
58
|
checkedItems: newCheckedItems
|
|
62
59
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const handleRadio = useEventCallback((e, name, value, checked) => {
|
|
63
|
+
if (name && value) {
|
|
64
|
+
onCheckedValueChange === null || onCheckedValueChange === void 0 ? void 0 : onCheckedValueChange(e, {
|
|
65
|
+
name,
|
|
66
|
+
checkedItems: checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]
|
|
67
|
+
});
|
|
66
68
|
}
|
|
67
69
|
});
|
|
68
70
|
return { ...initialState,
|
|
69
71
|
handleToggleButton,
|
|
72
|
+
handleRadio,
|
|
70
73
|
checkedValues: checkedValues !== null && checkedValues !== void 0 ? checkedValues : {}
|
|
71
74
|
};
|
|
72
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Adds appropriate state values and handlers for selectable items
|
|
78
|
+
* i.e checkboxes and radios
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
const useToolbarSelectableState = state => {
|
|
82
|
+
const [checkedValues, setCheckedValues] = useControllableState({
|
|
83
|
+
state: state.checkedValues,
|
|
84
|
+
defaultState: state.defaultCheckedValues,
|
|
85
|
+
initialState: {}
|
|
86
|
+
});
|
|
87
|
+
const {
|
|
88
|
+
onCheckedValueChange: onCheckedValueChangeOriginal
|
|
89
|
+
} = state;
|
|
90
|
+
const onCheckedValueChange = useEventCallback((e, {
|
|
91
|
+
name,
|
|
92
|
+
checkedItems
|
|
93
|
+
}) => {
|
|
94
|
+
if (onCheckedValueChangeOriginal) {
|
|
95
|
+
onCheckedValueChangeOriginal(e, {
|
|
96
|
+
name,
|
|
97
|
+
checkedItems
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
setCheckedValues(s => {
|
|
102
|
+
return s ? { ...s,
|
|
103
|
+
[name]: checkedItems
|
|
104
|
+
} : {
|
|
105
|
+
[name]: checkedItems
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
return [checkedValues, onCheckedValueChange];
|
|
110
|
+
};
|
|
73
111
|
//# sourceMappingURL=useToolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Toolbar/useToolbar.ts"],"names":[],"mappings":"AACA,SAAS,gBAAT,EAA2B,oBAA3B,QAAuD,2BAAvD;AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAEA,SAAS,uBAAT,QAAwC,yBAAxC;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAmE;EACpG,MAAM;IAAE,IAAI,GAAG,QAAT;IAAmB,QAAQ,GAAG;EAA9B,IAAwC,KAA9C;EAEA,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;IACnD,QAAQ,EAAE,IADyC;IAEnD,IAAI,EAAE;EAF6C,CAAD,CAApD;EAKA,MAAM,YAAY,GAA8B;IAC9C,IAD8C;IAE9C,QAF8C;IAG9C;IACA,UAAU,EAAE;MACV;MACA,IAAI,EAAE;IAFI,CAJkC;IAQ9C;IACA;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IAAoC,oBAAoB,CAAC;IAC7D,KAAK,EAAE,KAAK,CAAC,aADgD;IAE7D,YAAY,EAAE,KAAK,CAAC,oBAFyC;IAG7D,YAAY,EAAE;EAH+C,CAAD,CAA9D;EAKA,MAAM;IAAE,oBAAoB,EAAE;EAAxB,IAAyD,KAA/D;EACA,MAAM,oBAAoB,GAAyC,gBAAgB,CAAC,CAAC,CAAD,EAAI;IAAE,IAAF;IAAQ;EAAR,CAAJ,KAA8B;IAChH,IAAI,4BAAJ,EAAkC;MAChC,4BAA4B,CAAC,CAAD,EAAI;QAAE,IAAF;QAAQ;MAAR,CAAJ,CAA5B;IACD;;IAED,gBAAgB,CAAC,CAAC,IAAG;MACnB,OAAO,CAAC,GAAG,EAAE,GAAG,CAAL;QAAQ,CAAC,IAAD,GAAQ;MAAhB,CAAH,GAAoC;QAAE,CAAC,IAAD,GAAQ;MAAV,CAA5C;IACD,CAFe,CAAhB;EAGD,CARkF,CAAnF;EAUA,OAAO,CAAC,aAAD,EAAgB,oBAAhB,CAAP;AACD,CApBD","sourcesContent":["import * as React from 'react';\nimport { useEventCallback, useControllableState } from '@fluentui/react-utilities';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { ToggableHandler, ToolbarProps, ToolbarState, UninitializedToolbarState } from './Toolbar.types';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\n\n/**\n * Create the state required to render Toolbar.\n *\n * The returned state can be modified with hooks such as useToolbarStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of Toolbar\n * @param ref - reference to root HTMLElement of Toolbar\n */\nexport const useToolbar_unstable = (props: ToolbarProps, ref: React.Ref<HTMLElement>): ToolbarState => {\n const { size = 'medium', vertical = false } = props;\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'horizontal',\n });\n\n const initialState: UninitializedToolbarState = {\n size,\n vertical,\n // TODO add appropriate props/defaults\n components: {\n // TODO add each slot's element type or component\n root: 'div',\n },\n // TODO add appropriate slots, for example:\n // mySlot: resolveShorthand(props.mySlot),\n root: getNativeElementProps('div', {\n role: 'toolbar',\n ref,\n ...arrowNavigationProps,\n ...props,\n }),\n };\n\n const [checkedValues, onCheckedValueChange] = useToolbarSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues: props.defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n const handleToggleButton: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n onCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n }\n },\n );\n\n const handleRadio: ToggableHandler = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked?: boolean) => {\n if (name && value) {\n onCheckedValueChange?.(e, {\n name,\n checkedItems: checkedValues?.[name],\n });\n }\n },\n );\n\n return {\n ...initialState,\n handleToggleButton,\n handleRadio,\n checkedValues: checkedValues ?? {},\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useToolbarSelectableState = (\n state: Pick<ToolbarProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: state.checkedValues,\n defaultState: state.defaultCheckedValues,\n initialState: {},\n });\n const { onCheckedValueChange: onCheckedValueChangeOriginal } = state;\n const onCheckedValueChange: ToolbarState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n if (onCheckedValueChangeOriginal) {\n onCheckedValueChangeOriginal(e, { name, checkedItems });\n }\n\n setCheckedValues(s => {\n return s ? { ...s, [name]: checkedItems } : { [name]: checkedItems };\n });\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n"],"sourceRoot":"../src/"}
|
|
@@ -3,13 +3,15 @@ export function useToolbarContextValues_unstable(state) {
|
|
|
3
3
|
size,
|
|
4
4
|
handleToggleButton,
|
|
5
5
|
vertical,
|
|
6
|
-
checkedValues
|
|
6
|
+
checkedValues,
|
|
7
|
+
handleRadio
|
|
7
8
|
} = state; // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
|
|
8
9
|
|
|
9
10
|
const toolbar = {
|
|
10
11
|
size,
|
|
11
12
|
vertical,
|
|
12
13
|
handleToggleButton,
|
|
14
|
+
handleRadio,
|
|
13
15
|
checkedValues
|
|
14
16
|
};
|
|
15
17
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["components/Toolbar/useToolbarContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,gCAAV,CAA2C,KAA3C,EAA8D;EAClE,MAAM;IAAE,IAAF;IAAQ,kBAAR;IAA4B,QAA5B;IAAsC;
|
|
1
|
+
{"version":3,"sources":["components/Toolbar/useToolbarContextValues.tsx"],"names":[],"mappings":"AAEA,OAAM,SAAU,gCAAV,CAA2C,KAA3C,EAA8D;EAClE,MAAM;IAAE,IAAF;IAAQ,kBAAR;IAA4B,QAA5B;IAAsC,aAAtC;IAAqD;EAArD,IAAqE,KAA3E,CADkE,CAElE;;EACA,MAAM,OAAO,GAAwB;IACnC,IADmC;IAEnC,QAFmC;IAGnC,kBAHmC;IAInC,WAJmC;IAKnC;EALmC,CAArC;EAQA,OAAO;IAAE;EAAF,CAAP;AACD","sourcesContent":["import type { ToolbarContextValue, ToolbarContextValues, ToolbarState } from './Toolbar.types';\n\nexport function useToolbarContextValues_unstable(state: ToolbarState): ToolbarContextValues {\n const { size, handleToggleButton, vertical, checkedValues, handleRadio } = state;\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const toolbar: ToolbarContextValue = {\n size,\n vertical,\n handleToggleButton,\n handleRadio,\n checkedValues,\n };\n\n return { toolbar };\n}\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { renderToggleButton_unstable } from '@fluentui/react-button';
|
|
3
|
+
import { useToolbarRadioButton_unstable } from './useToolbarRadioButton';
|
|
4
|
+
import { useToolbarRadioButtonStyles_unstable } from './useToolbarRadioButtonStyles';
|
|
5
|
+
/**
|
|
6
|
+
* ToolbarRadioButton component
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export const ToolbarRadioButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
10
|
+
const state = useToolbarRadioButton_unstable(props, ref);
|
|
11
|
+
useToolbarRadioButtonStyles_unstable(state);
|
|
12
|
+
return renderToggleButton_unstable(state);
|
|
13
|
+
});
|
|
14
|
+
ToolbarRadioButton.displayName = 'ToolbarRadioButton';
|
|
15
|
+
//# sourceMappingURL=ToolbarRadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/ToolbarRadioButton/ToolbarRadioButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,2BAAT,QAA4C,wBAA5C;AACA,SAAS,8BAAT,QAA+C,yBAA/C;AACA,SAAS,oCAAT,QAAqD,+BAArD;AAEA;;AAEG;;AACH,OAAO,MAAM,kBAAkB,gBAAiD,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC9G,MAAM,KAAK,GAAG,8BAA8B,CAAC,KAAD,EAAQ,GAAR,CAA5C;EAEA,oCAAoC,CAAC,KAAD,CAApC;EACA,OAAO,2BAA2B,CAAC,KAAD,CAAlC;AACD,CAL+E,CAAzE;AAOP,kBAAkB,CAAC,WAAnB,GAAiC,oBAAjC","sourcesContent":["import * as React from 'react';\nimport type { ToolbarRadioButtonProps } from './ToolbarRadioButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarRadioButton_unstable } from './useToolbarRadioButton';\nimport { useToolbarRadioButtonStyles_unstable } from './useToolbarRadioButtonStyles';\n\n/**\n * ToolbarRadioButton component\n */\nexport const ToolbarRadioButton: ForwardRefComponent<ToolbarRadioButtonProps> = React.forwardRef((props, ref) => {\n const state = useToolbarRadioButton_unstable(props, ref);\n\n useToolbarRadioButtonStyles_unstable(state);\n return renderToggleButton_unstable(state);\n}) as ForwardRefComponent<ToolbarRadioButtonProps>;\n\nToolbarRadioButton.displayName = 'ToolbarRadioButton';\n"],"sourceRoot":"../src/"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarRadioButton.types.js","sourceRoot":"../src/","sources":["components/ToolbarRadioButton/ToolbarRadioButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { ToggleButtonProps, ButtonSlots, ToggleButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarRadioButton Props\n */\nexport type ToolbarRadioButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {\n appearance?: 'primary' | 'subtle';\n name: string;\n value: string;\n };\n\n/**\n * State used in rendering ToolbarRadioButton\n */\nexport type ToolbarRadioButtonState = ComponentState<Partial<ButtonSlots>> &\n ToggleButtonState &\n Required<Pick<ToggleButtonProps, 'checked'>> &\n Pick<ToolbarRadioButtonProps, 'name' | 'value'>;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/ToolbarRadioButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './ToolbarRadioButton';\nexport * from './ToolbarRadioButton.types';\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEventCallback } from '@fluentui/react-utilities';
|
|
2
|
+
import { useToggleButton_unstable } from '@fluentui/react-button';
|
|
3
|
+
import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
|
|
4
|
+
/**
|
|
5
|
+
* Given user props, defines default props for the RadioButton, calls useButtonState and useChecked, and returns
|
|
6
|
+
* processed state.
|
|
7
|
+
* @param props - User provided props to the RadioButton component.
|
|
8
|
+
* @param ref - User provided ref to be passed to the RadioButton component.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const useToolbarRadioButton_unstable = (props, ref) => {
|
|
12
|
+
const handleRadio = useToolbarContext_unstable(ctx => ctx.handleRadio);
|
|
13
|
+
const checked = useToolbarContext_unstable(ctx => {
|
|
14
|
+
var _a;
|
|
15
|
+
|
|
16
|
+
return !!((_a = ctx.checkedValues[props.name]) === null || _a === void 0 ? void 0 : _a.includes(props.value));
|
|
17
|
+
});
|
|
18
|
+
const size = useToolbarContext_unstable(ctx => ctx.size);
|
|
19
|
+
const {
|
|
20
|
+
onClick: onClickOriginal
|
|
21
|
+
} = props;
|
|
22
|
+
const toggleButtonState = useToggleButton_unstable({
|
|
23
|
+
size,
|
|
24
|
+
checked,
|
|
25
|
+
...props
|
|
26
|
+
}, ref);
|
|
27
|
+
const state = { ...toggleButtonState,
|
|
28
|
+
name: props.name,
|
|
29
|
+
value: props.value
|
|
30
|
+
};
|
|
31
|
+
const handleOnClick = useEventCallback(e => {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
e.stopPropagation();
|
|
34
|
+
return;
|
|
35
|
+
handleRadio === null || handleRadio === void 0 ? void 0 : handleRadio(e, state.name, state.value, state.checked);
|
|
36
|
+
onClickOriginal === null || onClickOriginal === void 0 ? void 0 : onClickOriginal(e);
|
|
37
|
+
});
|
|
38
|
+
state.root.onClick = handleOnClick;
|
|
39
|
+
return state;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=useToolbarRadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/ToolbarRadioButton/useToolbarRadioButton.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OAArC,CAAX;IACA,eAAe,KAAA,IAAf,IAAA,eAAe,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAA,eAAe,CAAG,CAAH,CAAf;EACD,CARmC,CAAtC;EAWA,KAAK,CAAC,IAAN,CAAW,OAAX,GAAqB,aAArB;EACA,OAAO,KAAP;AACD,CA7BM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { useToggleButton_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\nimport { ToolbarRadioButtonProps, ToolbarRadioButtonState } from './ToolbarRadioButton.types';\n\n/**\n * Given user props, defines default props for the RadioButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the RadioButton component.\n * @param ref - User provided ref to be passed to the RadioButton component.\n */\nexport const useToolbarRadioButton_unstable = (\n props: ToolbarRadioButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarRadioButtonState => {\n const handleRadio = useToolbarContext_unstable(ctx => ctx.handleRadio);\n const checked = useToolbarContext_unstable(ctx => !!ctx.checkedValues[props.name]?.includes(props.value));\n const size = useToolbarContext_unstable(ctx => ctx.size);\n\n const { onClick: onClickOriginal } = props;\n const toggleButtonState = useToggleButton_unstable({ size, checked, ...props }, ref);\n const state: ToolbarRadioButtonState = {\n ...toggleButtonState,\n name: props.name,\n value: props.value,\n };\n\n const handleOnClick = useEventCallback(\n (e: React.MouseEvent<HTMLButtonElement, MouseEvent> & React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n e.preventDefault();\n e.stopPropagation();\n return;\n\n handleRadio?.(e, state.name, state.value, state.checked);\n onClickOriginal?.(e);\n },\n );\n\n state.root.onClick = handleOnClick;\n return state;\n};\n"],"sourceRoot":"../src/"}
|