@fluentui/react-toolbar 9.0.0-beta.11 → 9.0.0-beta.13
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 +170 -1
- package/CHANGELOG.md +36 -2
- 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 +49 -11
- 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 +38 -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 +49 -11
- 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 +50 -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 +19 -11
- 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,176 @@
|
|
|
2
2
|
"name": "@fluentui/react-toolbar",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 11 Nov 2022 14:53:34 GMT",
|
|
6
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.13",
|
|
7
|
+
"version": "9.0.0-beta.13",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "martinhochel@microsoft.com",
|
|
12
|
+
"package": "@fluentui/react-toolbar",
|
|
13
|
+
"commit": "b3907043bd8d7b650c55e8e7c3119b14f2606c38",
|
|
14
|
+
"comment": "fix: create valid export maps"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui/react-toolbar",
|
|
19
|
+
"comment": "Bump @fluentui/react-button to v9.1.8",
|
|
20
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui/react-toolbar",
|
|
25
|
+
"comment": "Bump @fluentui/react-divider to v9.1.4",
|
|
26
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui/react-toolbar",
|
|
31
|
+
"comment": "Bump @fluentui/react-theme to v9.1.2",
|
|
32
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui/react-toolbar",
|
|
37
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.1",
|
|
38
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-toolbar",
|
|
43
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.1",
|
|
44
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"author": "beachball",
|
|
48
|
+
"package": "@fluentui/react-toolbar",
|
|
49
|
+
"comment": "Bump @fluentui/react-radio to v9.0.11",
|
|
50
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "beachball",
|
|
54
|
+
"package": "@fluentui/react-toolbar",
|
|
55
|
+
"comment": "Bump @fluentui/react-tabster to v9.3.0",
|
|
56
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "beachball",
|
|
60
|
+
"package": "@fluentui/react-toolbar",
|
|
61
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18",
|
|
62
|
+
"commit": "b4c9a0ae8d7444bf746f1307ab01e2dc16310720"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"none": [
|
|
66
|
+
{
|
|
67
|
+
"author": "chassunc@microsoft.com",
|
|
68
|
+
"package": "@fluentui/react-toolbar",
|
|
69
|
+
"commit": "65768ac4e7c6d8bc233535ab8726d3c8f3f224bc",
|
|
70
|
+
"comment": "chore: update toolbar stories examples"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"author": "chassunc@microsoft.com",
|
|
74
|
+
"package": "@fluentui/react-toolbar",
|
|
75
|
+
"commit": "169e9b94b0cf741102596f106ed726d9402145cc",
|
|
76
|
+
"comment": "fix: ToolbarRadio example and click"
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"date": "Wed, 02 Nov 2022 11:58:05 GMT",
|
|
83
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.12",
|
|
84
|
+
"version": "9.0.0-beta.12",
|
|
85
|
+
"comments": {
|
|
86
|
+
"prerelease": [
|
|
87
|
+
{
|
|
88
|
+
"author": "olfedias@microsoft.com",
|
|
89
|
+
"package": "@fluentui/react-toolbar",
|
|
90
|
+
"commit": "c619ba066f11a8654e95375314824ba6b81b003e",
|
|
91
|
+
"comment": "chore: Update Griffel to latest version"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"author": "olfedias@microsoft.com",
|
|
95
|
+
"package": "@fluentui/react-toolbar",
|
|
96
|
+
"commit": "78d042e6d3053da0902ef75330249dbaedc2493c",
|
|
97
|
+
"comment": "chore: remove dependencies on Fluent UI v8"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"author": "beachball",
|
|
101
|
+
"package": "@fluentui/react-toolbar",
|
|
102
|
+
"comment": "Bump @fluentui/react-button to v9.1.7",
|
|
103
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"author": "beachball",
|
|
107
|
+
"package": "@fluentui/react-toolbar",
|
|
108
|
+
"comment": "Bump @fluentui/react-divider to v9.1.3",
|
|
109
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"author": "beachball",
|
|
113
|
+
"package": "@fluentui/react-toolbar",
|
|
114
|
+
"comment": "Bump @fluentui/react-utilities to v9.2.0",
|
|
115
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"author": "beachball",
|
|
119
|
+
"package": "@fluentui/react-toolbar",
|
|
120
|
+
"comment": "Bump @fluentui/react-context-selector to v9.1.0",
|
|
121
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"author": "beachball",
|
|
125
|
+
"package": "@fluentui/react-toolbar",
|
|
126
|
+
"comment": "Bump @fluentui/react-radio to v9.0.10",
|
|
127
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"author": "beachball",
|
|
131
|
+
"package": "@fluentui/react-toolbar",
|
|
132
|
+
"comment": "Bump @fluentui/react-tabster to v9.2.1",
|
|
133
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"author": "beachball",
|
|
137
|
+
"package": "@fluentui/react-toolbar",
|
|
138
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.17",
|
|
139
|
+
"commit": "393a7b169155997a97a6ce1ad36ee3eafc6f461b"
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"none": [
|
|
143
|
+
{
|
|
144
|
+
"author": "chassunc@microsoft.com",
|
|
145
|
+
"package": "@fluentui/react-toolbar",
|
|
146
|
+
"commit": "abfb64d82916efdb0e5129cf41081a13e4e9d9ff",
|
|
147
|
+
"comment": "chore: add few small toolbar improvements"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"date": "Tue, 25 Oct 2022 22:09:49 GMT",
|
|
154
|
+
"tag": "@fluentui/react-toolbar_v9.0.0-beta.11",
|
|
155
|
+
"version": "9.0.0-beta.11",
|
|
156
|
+
"comments": {
|
|
157
|
+
"none": [
|
|
158
|
+
{
|
|
159
|
+
"author": "chassunc@microsoft.com",
|
|
160
|
+
"package": "@fluentui/react-toolbar",
|
|
161
|
+
"commit": "dba7e9c342ca32d05d49d341b3912cd79652f238",
|
|
162
|
+
"comment": "chore: remove best practices"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"author": "chassunc@microsoft.com",
|
|
166
|
+
"package": "@fluentui/react-toolbar",
|
|
167
|
+
"commit": "9bde21168a1032d2a429939b9b2d7d3ba590726f",
|
|
168
|
+
"comment": "feat: replace ToolbarRadio implementation by usage of toggle button as radio"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"date": "Tue, 25 Oct 2022 00:35:39 GMT",
|
|
6
175
|
"tag": "@fluentui/react-toolbar_v9.0.0-beta.11",
|
|
7
176
|
"version": "9.0.0-beta.11",
|
|
8
177
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,46 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-toolbar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 11 Nov 2022 14:53:34 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0-beta.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.13)
|
|
8
|
+
|
|
9
|
+
Fri, 11 Nov 2022 14:53:34 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.12..@fluentui/react-toolbar_v9.0.0-beta.13)
|
|
11
|
+
|
|
12
|
+
### Changes
|
|
13
|
+
|
|
14
|
+
- fix: create valid export maps ([PR #25558](https://github.com/microsoft/fluentui/pull/25558) by martinhochel@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-button to v9.1.8 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
16
|
+
- Bump @fluentui/react-divider to v9.1.4 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
17
|
+
- Bump @fluentui/react-theme to v9.1.2 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
18
|
+
- Bump @fluentui/react-utilities to v9.2.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
19
|
+
- Bump @fluentui/react-context-selector to v9.1.1 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
20
|
+
- Bump @fluentui/react-radio to v9.0.11 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tabster to v9.3.0 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
22
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.18 ([PR #25615](https://github.com/microsoft/fluentui/pull/25615) by beachball)
|
|
23
|
+
|
|
24
|
+
## [9.0.0-beta.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.12)
|
|
25
|
+
|
|
26
|
+
Wed, 02 Nov 2022 11:58:05 GMT
|
|
27
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.11..@fluentui/react-toolbar_v9.0.0-beta.12)
|
|
28
|
+
|
|
29
|
+
### Changes
|
|
30
|
+
|
|
31
|
+
- chore: Update Griffel to latest version ([PR #25412](https://github.com/microsoft/fluentui/pull/25412) by olfedias@microsoft.com)
|
|
32
|
+
- chore: remove dependencies on Fluent UI v8 ([PR #25466](https://github.com/microsoft/fluentui/pull/25466) by olfedias@microsoft.com)
|
|
33
|
+
- Bump @fluentui/react-button to v9.1.7 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
34
|
+
- Bump @fluentui/react-divider to v9.1.3 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
35
|
+
- Bump @fluentui/react-utilities to v9.2.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
36
|
+
- Bump @fluentui/react-context-selector to v9.1.0 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
37
|
+
- Bump @fluentui/react-radio to v9.0.10 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
38
|
+
- Bump @fluentui/react-tabster to v9.2.1 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
39
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0-beta.17 ([PR #25456](https://github.com/microsoft/fluentui/pull/25456) by beachball)
|
|
40
|
+
|
|
7
41
|
## [9.0.0-beta.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-toolbar_v9.0.0-beta.11)
|
|
8
42
|
|
|
9
|
-
Tue, 25 Oct 2022 00:
|
|
43
|
+
Tue, 25 Oct 2022 00:35:39 GMT
|
|
10
44
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-toolbar_v9.0.0-beta.10..@fluentui/react-toolbar_v9.0.0-beta.11)
|
|
11
45
|
|
|
12
46
|
### Changes
|
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/"}
|
|
@@ -18,7 +18,7 @@ export const useToolbar_unstable = (props, ref) => {
|
|
|
18
18
|
} = props;
|
|
19
19
|
const arrowNavigationProps = useArrowNavigationGroup({
|
|
20
20
|
circular: true,
|
|
21
|
-
axis: '
|
|
21
|
+
axis: 'both'
|
|
22
22
|
});
|
|
23
23
|
const initialState = {
|
|
24
24
|
size,
|
|
@@ -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: [value]
|
|
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;IACA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;MACjC,IAAI,EAAE,SAD2B;MAEjC,GAFiC;MAGjC,GAAG,oBAH8B;MAIjC,GAAG;IAJ8B,CAAR;EAVmB,CAAhD;EAkBA,MAAM,CAAC,aAAD,EAAgB,
|
|
1
|
+
{"version":3,"sources":["components/Toolbar/useToolbar.ts"],"names":[],"mappings":"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","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: 'both',\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: [value],\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,38 @@
|
|
|
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
|
+
handleRadio === null || handleRadio === void 0 ? void 0 : handleRadio(e, state.name, state.value, state.checked);
|
|
33
|
+
onClickOriginal === null || onClickOriginal === void 0 ? void 0 : onClickOriginal(e);
|
|
34
|
+
});
|
|
35
|
+
state.root.onClick = handleOnClick;
|
|
36
|
+
return state;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useToolbarRadioButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/ToolbarRadioButton/useToolbarRadioButton.ts"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,wBAAT,QAAyC,wBAAzC;AACA,SAAS,0BAAT,QAA2C,2BAA3C;AAGA;;;;;AAKG;;AACH,OAAO,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;EAC3B,MAAM,WAAW,GAAG,0BAA0B,CAAC,GAAG,IAAI,GAAG,CAAC,WAAZ,CAA9C;EACA,MAAM,OAAO,GAAG,0BAA0B,CAAC,GAAG,IAAG;IAAA,IAAA,EAAA;;IAAC,OAAA,CAAC,EAAC,CAAA,EAAA,GAAA,GAAG,CAAC,aAAJ,CAAkB,KAAK,CAAC,IAAxB,CAAA,MAA6B,IAA7B,IAA6B,EAAA,KAAA,KAAA,CAA7B,GAA6B,KAAA,CAA7B,GAA6B,EAAA,CAAE,QAAF,CAAW,KAAK,CAAC,KAAjB,CAA9B,CAAD;EAAsD,CAA9D,CAA1C;EACA,MAAM,IAAI,GAAG,0BAA0B,CAAC,GAAG,IAAI,GAAG,CAAC,IAAZ,CAAvC;EAEA,MAAM;IAAE,OAAO,EAAE;EAAX,IAA+B,KAArC;EACA,MAAM,iBAAiB,GAAG,wBAAwB,CAAC;IAAE,IAAF;IAAQ,OAAR;IAAiB,GAAG;EAApB,CAAD,EAA8B,GAA9B,CAAlD;EACA,MAAM,KAAK,GAA4B,EACrC,GAAG,iBADkC;IAErC,IAAI,EAAE,KAAK,CAAC,IAFyB;IAGrC,KAAK,EAAE,KAAK,CAAC;EAHwB,CAAvC;EAMA,MAAM,aAAa,GAAG,gBAAgB,CACnC,CAAD,IAAyG;IACvG,WAAW,KAAA,IAAX,IAAA,WAAW,KAAA,KAAA,CAAX,GAAW,KAAA,CAAX,GAAA,WAAW,CAAG,CAAH,EAAM,KAAK,CAAC,IAAZ,EAAkB,KAAK,CAAC,KAAxB,EAA+B,KAAK,CAAC,OAArC,CAAX;IACA,eAAe,KAAA,IAAf,IAAA,eAAe,KAAA,KAAA,CAAf,GAAe,KAAA,CAAf,GAAA,eAAe,CAAG,CAAH,CAAf;EACD,CAJmC,CAAtC;EAOA,KAAK,CAAC,IAAN,CAAW,OAAX,GAAqB,aAArB;EACA,OAAO,KAAP;AACD,CAzBM","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 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/"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tokens } from '@fluentui/react-theme';
|
|
2
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
|
3
|
+
import { useToggleButtonStyles_unstable } from '@fluentui/react-button';
|
|
4
|
+
|
|
5
|
+
const useBaseStyles = /*#__PURE__*/__styles({
|
|
6
|
+
"selected": {
|
|
7
|
+
"sj55zd": "f16muhyy"
|
|
8
|
+
}
|
|
9
|
+
}, {
|
|
10
|
+
"d": [".f16muhyy{color:var(--colorBrandForeground1);}"]
|
|
11
|
+
});
|
|
12
|
+
/**
|
|
13
|
+
* Apply styling to the ToolbarRadioButton slots based on the state
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export const useToolbarRadioButtonStyles_unstable = state => {
|
|
18
|
+
useToggleButtonStyles_unstable(state);
|
|
19
|
+
const toggleButtonStyles = useBaseStyles();
|
|
20
|
+
state.root.className = mergeClasses(state.root.className, state.checked && toggleButtonStyles.selected);
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=useToolbarRadioButtonStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["components/ToolbarRadioButton/useToolbarRadioButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,QAAuB,uBAAvB;AACA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,8BAAT,QAA+C,wBAA/C;;AAGA,MAAM,aAAa,gBAAG;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;AAMA;;AAEG;;;AACH,OAAO,MAAM,oCAAoC,GAAI,KAAD,IAAmC;EACrF,8BAA8B,CAAC,KAAD,CAA9B;EACA,MAAM,kBAAkB,GAAG,aAAa,EAAxC;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,KAAK,CAAC,IAAN,CAAW,SAAZ,EAAuB,KAAK,CAAC,OAAN,IAAiB,kBAAkB,CAAC,QAA3D,CAAnC;AACD,CALM","sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { useToggleButtonStyles_unstable } from '@fluentui/react-button';\nimport { ToolbarRadioButtonState } from './ToolbarRadioButton.types';\n\nconst useBaseStyles = makeStyles({\n selected: {\n color: tokens.colorBrandForeground1,\n },\n});\n\n/**\n * Apply styling to the ToolbarRadioButton slots based on the state\n */\nexport const useToolbarRadioButtonStyles_unstable = (state: ToolbarRadioButtonState) => {\n useToggleButtonStyles_unstable(state);\n const toggleButtonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.root.className, state.checked && toggleButtonStyles.selected);\n};\n"],"sourceRoot":"../src/"}
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,5 @@ export { Toolbar, renderToolbar_unstable, toolbarClassNames, useToolbarStyles_un
|
|
|
2
2
|
export { ToolbarButton } from './ToolbarButton';
|
|
3
3
|
export { ToolbarDivider, useToolbarDividerStyles_unstable } from './ToolbarDivider';
|
|
4
4
|
export { ToolbarToggleButton } from './ToolbarToggleButton';
|
|
5
|
-
export {
|
|
6
|
-
export { ToolbarRadioGroup } from './ToolbarRadioGroup';
|
|
5
|
+
export { ToolbarRadioButton } from './ToolbarRadioButton';
|
|
7
6
|
//# sourceMappingURL=index.js.map
|