@fluentui/react-toolbar 9.0.0-beta.9 → 9.0.0-rc.2

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.
Files changed (168) hide show
  1. package/CHANGELOG.json +498 -1
  2. package/CHANGELOG.md +119 -2
  3. package/README.md +1 -1
  4. package/dist/index.d.ts +36 -38
  5. package/lib/Toolbar.js.map +1 -1
  6. package/lib/ToolbarButton.js.map +1 -1
  7. package/lib/ToolbarDivider.js.map +1 -1
  8. package/lib/ToolbarGroup.js +2 -0
  9. package/lib/ToolbarGroup.js.map +1 -0
  10. package/lib/ToolbarRadioButton.js +2 -0
  11. package/lib/ToolbarRadioButton.js.map +1 -0
  12. package/lib/ToolbarToggleButton.js.map +1 -1
  13. package/lib/components/Toolbar/Toolbar.js.map +1 -1
  14. package/lib/components/Toolbar/Toolbar.types.js.map +1 -1
  15. package/lib/components/Toolbar/ToolbarContext.js +1 -0
  16. package/lib/components/Toolbar/ToolbarContext.js.map +1 -1
  17. package/lib/components/Toolbar/index.js.map +1 -1
  18. package/lib/components/Toolbar/renderToolbar.js.map +1 -1
  19. package/lib/components/Toolbar/useToolbar.js +49 -11
  20. package/lib/components/Toolbar/useToolbar.js.map +1 -1
  21. package/lib/components/Toolbar/useToolbarContextValues.js +3 -1
  22. package/lib/components/Toolbar/useToolbarContextValues.js.map +1 -1
  23. package/lib/components/Toolbar/useToolbarStyles.js +14 -3
  24. package/lib/components/Toolbar/useToolbarStyles.js.map +1 -1
  25. package/lib/components/ToolbarButton/ToolbarButton.js +5 -9
  26. package/lib/components/ToolbarButton/ToolbarButton.js.map +1 -1
  27. package/lib/components/ToolbarButton/ToolbarButton.types.js.map +1 -1
  28. package/lib/components/ToolbarButton/index.js.map +1 -1
  29. package/lib/components/ToolbarButton/useToolbarButton.js +23 -0
  30. package/lib/components/ToolbarButton/useToolbarButton.js.map +1 -0
  31. package/lib/components/ToolbarButton/useToolbarButtonStyles.js +28 -0
  32. package/lib/components/ToolbarButton/useToolbarButtonStyles.js.map +1 -0
  33. package/lib/components/ToolbarDivider/ToolbarDivider.js.map +1 -1
  34. package/lib/components/ToolbarDivider/ToolbarDivider.types.js.map +1 -1
  35. package/lib/components/ToolbarDivider/index.js.map +1 -1
  36. package/lib/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
  37. package/lib/components/ToolbarDivider/useToolbarDividerStyles.js.map +1 -1
  38. package/lib/components/ToolbarGroup/ToolbarGroup.js +16 -0
  39. package/lib/components/ToolbarGroup/ToolbarGroup.js.map +1 -0
  40. package/lib/components/ToolbarGroup/ToolbarGroup.types.js +2 -0
  41. package/lib/components/ToolbarGroup/ToolbarGroup.types.js.map +1 -0
  42. package/lib/components/ToolbarGroup/index.js +3 -0
  43. package/lib/components/ToolbarGroup/index.js.map +1 -0
  44. package/lib/components/ToolbarGroup/renderToolbarGroup.js +15 -0
  45. package/lib/components/ToolbarGroup/renderToolbarGroup.js.map +1 -0
  46. package/lib/components/ToolbarGroup/useToolbarGroup.js +20 -0
  47. package/lib/components/ToolbarGroup/useToolbarGroup.js.map +1 -0
  48. package/lib/components/ToolbarGroup/useToolbarGroupStyles.js +28 -0
  49. package/lib/components/ToolbarGroup/useToolbarGroupStyles.js.map +1 -0
  50. package/lib/components/ToolbarRadioButton/ToolbarRadioButton.js +15 -0
  51. package/lib/components/ToolbarRadioButton/ToolbarRadioButton.js.map +1 -0
  52. package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js +2 -0
  53. package/lib/components/ToolbarRadioButton/ToolbarRadioButton.types.js.map +1 -0
  54. package/lib/components/ToolbarRadioButton/index.js +3 -0
  55. package/lib/components/ToolbarRadioButton/index.js.map +1 -0
  56. package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js +38 -0
  57. package/lib/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -0
  58. package/lib/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js +22 -0
  59. package/lib/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js.map +1 -0
  60. package/lib/components/ToolbarToggleButton/ToolbarToggleButton.js +3 -2
  61. package/lib/components/ToolbarToggleButton/ToolbarToggleButton.js.map +1 -1
  62. package/lib/components/ToolbarToggleButton/ToolbarToggleButton.types.js.map +1 -1
  63. package/lib/components/ToolbarToggleButton/index.js.map +1 -1
  64. package/lib/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
  65. package/lib/components/ToolbarToggleButton/useToolbarToggleButtonStyles.js +22 -0
  66. package/lib/components/ToolbarToggleButton/useToolbarToggleButtonStyles.js.map +1 -0
  67. package/lib/index.js +2 -2
  68. package/lib/index.js.map +1 -1
  69. package/lib-commonjs/Toolbar.js.map +1 -1
  70. package/lib-commonjs/ToolbarButton.js.map +1 -1
  71. package/lib-commonjs/ToolbarDivider.js.map +1 -1
  72. package/lib-commonjs/{ToolbarRadio.js → ToolbarGroup.js} +2 -2
  73. package/lib-commonjs/ToolbarGroup.js.map +1 -0
  74. package/lib-commonjs/{ToolbarRadioGroup.js → ToolbarRadioButton.js} +2 -2
  75. package/lib-commonjs/ToolbarRadioButton.js.map +1 -0
  76. package/lib-commonjs/ToolbarToggleButton.js.map +1 -1
  77. package/lib-commonjs/components/Toolbar/Toolbar.js.map +1 -1
  78. package/lib-commonjs/components/Toolbar/ToolbarContext.js +1 -0
  79. package/lib-commonjs/components/Toolbar/ToolbarContext.js.map +1 -1
  80. package/lib-commonjs/components/Toolbar/index.js.map +1 -1
  81. package/lib-commonjs/components/Toolbar/renderToolbar.js.map +1 -1
  82. package/lib-commonjs/components/Toolbar/useToolbar.js +49 -11
  83. package/lib-commonjs/components/Toolbar/useToolbar.js.map +1 -1
  84. package/lib-commonjs/components/Toolbar/useToolbarContextValues.js +3 -1
  85. package/lib-commonjs/components/Toolbar/useToolbarContextValues.js.map +1 -1
  86. package/lib-commonjs/components/Toolbar/useToolbarStyles.js +14 -3
  87. package/lib-commonjs/components/Toolbar/useToolbarStyles.js.map +1 -1
  88. package/lib-commonjs/components/ToolbarButton/ToolbarButton.js +5 -8
  89. package/lib-commonjs/components/ToolbarButton/ToolbarButton.js.map +1 -1
  90. package/lib-commonjs/components/ToolbarButton/index.js.map +1 -1
  91. package/lib-commonjs/components/ToolbarButton/useToolbarButton.js +33 -0
  92. package/lib-commonjs/components/ToolbarButton/useToolbarButton.js.map +1 -0
  93. package/lib-commonjs/components/ToolbarButton/useToolbarButtonStyles.js +38 -0
  94. package/lib-commonjs/components/ToolbarButton/useToolbarButtonStyles.js.map +1 -0
  95. package/lib-commonjs/components/ToolbarDivider/ToolbarDivider.js.map +1 -1
  96. package/lib-commonjs/components/ToolbarDivider/index.js.map +1 -1
  97. package/lib-commonjs/components/ToolbarDivider/useToolbarDivider.js.map +1 -1
  98. package/lib-commonjs/components/ToolbarDivider/useToolbarDividerStyles.js.map +1 -1
  99. package/lib-commonjs/components/ToolbarGroup/ToolbarGroup.js +27 -0
  100. package/lib-commonjs/components/ToolbarGroup/ToolbarGroup.js.map +1 -0
  101. package/lib-commonjs/components/{ToolbarRadio/ToolbarRadio.types.js → ToolbarGroup/ToolbarGroup.types.js} +1 -1
  102. package/lib-commonjs/components/{ToolbarRadio/ToolbarRadio.types.js.map → ToolbarGroup/ToolbarGroup.types.js.map} +0 -0
  103. package/lib-commonjs/components/ToolbarGroup/index.js +12 -0
  104. package/lib-commonjs/components/ToolbarGroup/index.js.map +1 -0
  105. package/lib-commonjs/components/ToolbarGroup/renderToolbarGroup.js +26 -0
  106. package/lib-commonjs/components/ToolbarGroup/renderToolbarGroup.js.map +1 -0
  107. package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js +30 -0
  108. package/lib-commonjs/components/ToolbarGroup/useToolbarGroup.js.map +1 -0
  109. package/lib-commonjs/components/ToolbarGroup/useToolbarGroupStyles.js +38 -0
  110. package/lib-commonjs/components/ToolbarGroup/useToolbarGroupStyles.js.map +1 -0
  111. package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.js +26 -0
  112. package/lib-commonjs/components/ToolbarRadioButton/ToolbarRadioButton.js.map +1 -0
  113. package/lib-commonjs/components/{ToolbarRadioGroup/ToolbarRadioGroup.types.js → ToolbarRadioButton/ToolbarRadioButton.types.js} +1 -1
  114. package/lib-commonjs/components/{ToolbarRadioGroup/ToolbarRadioGroup.types.js.map → ToolbarRadioButton/ToolbarRadioButton.types.js.map} +0 -0
  115. package/lib-commonjs/components/ToolbarRadioButton/index.js +12 -0
  116. package/lib-commonjs/components/ToolbarRadioButton/index.js.map +1 -0
  117. package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js +50 -0
  118. package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButton.js.map +1 -0
  119. package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js +33 -0
  120. package/lib-commonjs/components/ToolbarRadioButton/useToolbarRadioButtonStyles.js.map +1 -0
  121. package/lib-commonjs/components/ToolbarToggleButton/ToolbarToggleButton.js +3 -1
  122. package/lib-commonjs/components/ToolbarToggleButton/ToolbarToggleButton.js.map +1 -1
  123. package/lib-commonjs/components/ToolbarToggleButton/index.js.map +1 -1
  124. package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButton.js.map +1 -1
  125. package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButtonStyles.js +33 -0
  126. package/lib-commonjs/components/ToolbarToggleButton/useToolbarToggleButtonStyles.js.map +1 -0
  127. package/lib-commonjs/index.js +7 -7
  128. package/lib-commonjs/index.js.map +1 -1
  129. package/package.json +27 -20
  130. package/Spec.md +0 -140
  131. package/lib/ToolbarRadio.js +0 -2
  132. package/lib/ToolbarRadio.js.map +0 -1
  133. package/lib/ToolbarRadioGroup.js +0 -2
  134. package/lib/ToolbarRadioGroup.js.map +0 -1
  135. package/lib/components/ToolbarRadio/ToolbarRadio.js +0 -19
  136. package/lib/components/ToolbarRadio/ToolbarRadio.js.map +0 -1
  137. package/lib/components/ToolbarRadio/ToolbarRadio.types.js +0 -2
  138. package/lib/components/ToolbarRadio/ToolbarRadio.types.js.map +0 -1
  139. package/lib/components/ToolbarRadio/index.js +0 -3
  140. package/lib/components/ToolbarRadio/index.js.map +0 -1
  141. package/lib/components/ToolbarRadio/useToolbarRadioStyles.js +0 -41
  142. package/lib/components/ToolbarRadio/useToolbarRadioStyles.js.map +0 -1
  143. package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.js +0 -20
  144. package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.js.map +0 -1
  145. package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js +0 -2
  146. package/lib/components/ToolbarRadioGroup/ToolbarRadioGroup.types.js.map +0 -1
  147. package/lib/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js +0 -22
  148. package/lib/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js.map +0 -1
  149. package/lib/components/ToolbarRadioGroup/index.js +0 -3
  150. package/lib/components/ToolbarRadioGroup/index.js.map +0 -1
  151. package/lib/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js +0 -29
  152. package/lib/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js.map +0 -1
  153. package/lib-commonjs/ToolbarRadio.js.map +0 -1
  154. package/lib-commonjs/ToolbarRadioGroup.js.map +0 -1
  155. package/lib-commonjs/components/ToolbarRadio/ToolbarRadio.js +0 -30
  156. package/lib-commonjs/components/ToolbarRadio/ToolbarRadio.js.map +0 -1
  157. package/lib-commonjs/components/ToolbarRadio/index.js +0 -12
  158. package/lib-commonjs/components/ToolbarRadio/index.js.map +0 -1
  159. package/lib-commonjs/components/ToolbarRadio/useToolbarRadioStyles.js +0 -51
  160. package/lib-commonjs/components/ToolbarRadio/useToolbarRadioStyles.js.map +0 -1
  161. package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.js +0 -31
  162. package/lib-commonjs/components/ToolbarRadioGroup/ToolbarRadioGroup.js.map +0 -1
  163. package/lib-commonjs/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js +0 -31
  164. package/lib-commonjs/components/ToolbarRadioGroup/contexts/useRadioGroupContextValues.js.map +0 -1
  165. package/lib-commonjs/components/ToolbarRadioGroup/index.js +0 -12
  166. package/lib-commonjs/components/ToolbarRadioGroup/index.js.map +0 -1
  167. package/lib-commonjs/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js +0 -39
  168. package/lib-commonjs/components/ToolbarRadioGroup/useToolbarRadioGroupStyles.js.map +0 -1
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?: string, value?: string, checked?: boolean) => void;
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
@@ -47,12 +37,14 @@ export declare const ToolbarButton: ForwardRefComponent<ToolbarButtonProps>;
47
37
  */
48
38
  export declare type ToolbarButtonProps = ComponentProps<ButtonSlots> & Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {
49
39
  appearance?: 'primary' | 'subtle';
40
+ } & {
41
+ vertical?: boolean;
50
42
  };
51
43
 
52
44
  /**
53
45
  * State used in rendering ToolbarButton
54
46
  */
55
- export declare type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> & ButtonState;
47
+ export declare type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> & ButtonState & Required<Pick<ToolbarButtonProps, 'vertical'>>;
56
48
 
57
49
  declare type ToolbarCheckedValueChangeData = {
58
50
  /** The items for this value that are checked */
@@ -67,6 +59,7 @@ export declare const toolbarClassNames: SlotClassNames<ToolbarSlots>;
67
59
 
68
60
  export declare type ToolbarContextValue = Pick<ToolbarState, 'size' | 'vertical' | 'checkedValues'> & {
69
61
  handleToggleButton?: ToggableHandler;
62
+ handleRadio?: ToggableHandler;
70
63
  };
71
64
 
72
65
  export declare type ToolbarContextValues = {
@@ -95,6 +88,26 @@ export declare type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>>
95
88
  */
96
89
  export declare type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;
97
90
 
91
+ /**
92
+ * ToolbarGroup component is a Button to be used inside Toolbar
93
+ * which will respect toolbar props such as `size`
94
+ */
95
+ export declare const ToolbarGroup: ForwardRefComponent<ToolbarGroupProps>;
96
+
97
+ /**
98
+ * ToolbarButton Props
99
+ */
100
+ export declare type ToolbarGroupProps = ComponentProps<ToolbarGroupSlots>;
101
+
102
+ declare type ToolbarGroupSlots = {
103
+ root: Slot<'div'>;
104
+ };
105
+
106
+ /**
107
+ * State used in rendering ToolbarButton
108
+ */
109
+ export declare type ToolbarGroupState = ComponentState<ToolbarGroupSlots>;
110
+
98
111
  /**
99
112
  * Toolbar Props
100
113
  */
@@ -104,7 +117,7 @@ export declare type ToolbarProps = ComponentProps<ToolbarSlots> & {
104
117
  *
105
118
  * @default medium
106
119
  */
107
- size?: 'small' | 'medium';
120
+ size?: 'small' | 'medium' | 'large';
108
121
  /**
109
122
  * Toolbar can be vertical styled
110
123
  * @default false
@@ -128,39 +141,23 @@ export declare type ToolbarProps = ComponentProps<ToolbarSlots> & {
128
141
  };
129
142
 
130
143
  /**
131
- * ToolbarRadio component is a Radio to be used inside Toolbar
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
143
- */
144
- export declare type ToolbarRadioGroupProps = RadioGroupProps;
145
-
146
- /**
147
- * State used in rendering ToolbarRadioGroup
144
+ * ToolbarRadioButton component
148
145
  */
149
- export declare type ToolbarRadioGroupState = RadioGroupState;
146
+ export declare const ToolbarRadioButton: ForwardRefComponent<ToolbarRadioButtonProps>;
150
147
 
151
148
  /**
152
- * ToolbarRadio Props
149
+ * ToolbarRadioButton Props
153
150
  */
154
- export declare type ToolbarRadioProps = RadioProps & {
155
- size?: 'small' | 'medium';
151
+ export declare type ToolbarRadioButtonProps = ComponentProps<ButtonSlots> & Partial<Pick<ToggleButtonProps, 'disabled' | 'disabledFocusable' | 'size'>> & {
152
+ appearance?: 'primary' | 'subtle';
153
+ name: string;
154
+ value: string;
156
155
  };
157
156
 
158
157
  /**
159
- * State used in rendering ToolbarRadio
158
+ * State used in rendering ToolbarRadioButton
160
159
  */
161
- export declare type ToolbarRadioState = RadioState & {
162
- size?: 'small' | 'medium';
163
- };
160
+ export declare type ToolbarRadioButtonState = ComponentState<Partial<ButtonSlots>> & ToggleButtonState & Required<Pick<ToggleButtonProps, 'checked'>> & Pick<ToolbarRadioButtonProps, 'name' | 'value'>;
164
161
 
165
162
  export declare type ToolbarSlots = {
166
163
  root: Slot<'div'>;
@@ -171,6 +168,7 @@ export declare type ToolbarSlots = {
171
168
  */
172
169
  export declare type ToolbarState = ComponentState<ToolbarSlots> & Required<Pick<ToolbarProps, 'size' | 'checkedValues' | 'vertical'>> & Pick<ToolbarProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {
173
170
  handleToggleButton: ToggableHandler;
171
+ handleRadio: ToggableHandler;
174
172
  };
175
173
 
176
174
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Toolbar.js","sourceRoot":"../src/","sources":["Toolbar.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Toolbar/index';\n"]}
1
+ {"version":3,"file":"Toolbar.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/Toolbar.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Toolbar/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarButton.js","sourceRoot":"../src/","sources":["ToolbarButton.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './components/ToolbarButton/index';\n"]}
1
+ {"version":3,"file":"ToolbarButton.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/ToolbarButton.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC","sourcesContent":["export * from './components/ToolbarButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarDivider.js","sourceRoot":"../src/","sources":["ToolbarDivider.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/ToolbarDivider/index';\n"]}
1
+ {"version":3,"file":"ToolbarDivider.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/ToolbarDivider.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAC","sourcesContent":["export * from './components/ToolbarDivider/index';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components/ToolbarGroup/index';
2
+ //# sourceMappingURL=ToolbarGroup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarGroup.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/ToolbarGroup.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC","sourcesContent":["export * from './components/ToolbarGroup/index';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from './components/ToolbarRadioButton/index';
2
+ //# sourceMappingURL=ToolbarRadioButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToolbarRadioButton.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/ToolbarRadioButton.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC","sourcesContent":["export * from './components/ToolbarRadioButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarToggleButton.js","sourceRoot":"../src/","sources":["ToolbarToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC","sourcesContent":["export * from './components/ToolbarToggleButton/index';\n"]}
1
+ {"version":3,"file":"ToolbarToggleButton.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/ToolbarToggleButton.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC","sourcesContent":["export * from './components/ToolbarToggleButton/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAGA,SAAS,gCAAT,QAAiD,2BAAjD;AAEA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;EACA,MAAM,aAAa,GAAG,gCAAgC,CAAC,KAAD,CAAtD;EACA,yBAAyB,CAAC,KAAD,CAAzB;EACA,OAAO,sBAAsB,CAAC,KAAD,EAAQ,aAAR,CAA7B;AACD,CALyD,CAAnD;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { useToolbar_unstable } from './useToolbar';\nimport { renderToolbar_unstable } from './renderToolbar';\nimport { useToolbarStyles_unstable } from './useToolbarStyles';\nimport type { ToolbarProps } from './Toolbar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToolbarContextValues_unstable } from './useToolbarContextValues';\n\n/**\n * Toolbar component\n */\nexport const Toolbar: ForwardRefComponent<ToolbarProps> = React.forwardRef((props, ref) => {\n const state = useToolbar_unstable(props, ref);\n const contextValues = useToolbarContextValues_unstable(state);\n useToolbarStyles_unstable(state);\n return renderToolbar_unstable(state, contextValues);\n});\n\nToolbar.displayName = 'Toolbar';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,mBAAT,QAAoC,cAApC;AACA,SAAS,sBAAT,QAAuC,iBAAvC;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAGA,SAAS,gCAAT,QAAiD,2BAAjD;AAEA;;AAEG;;AACH,OAAO,MAAM,OAAO,gBAAsC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACxF,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAD,EAAQ,GAAR,CAAjC;EACA,MAAM,aAAa,GAAG,gCAAgC,CAAC,KAAD,CAAtD;EACA,yBAAyB,CAAC,KAAD,CAAzB;EACA,OAAO,sBAAsB,CAAC,KAAD,EAAQ,aAAR,CAA7B;AACD,CALyD,CAAnD;AAOP,OAAO,CAAC,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { useToolbar_unstable } from './useToolbar';\nimport { renderToolbar_unstable } from './renderToolbar';\nimport { useToolbarStyles_unstable } from './useToolbarStyles';\nimport type { ToolbarProps } from './Toolbar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useToolbarContextValues_unstable } from './useToolbarContextValues';\n\n/**\n * Toolbar component\n */\nexport const Toolbar: ForwardRefComponent<ToolbarProps> = React.forwardRef((props, ref) => {\n const state = useToolbar_unstable(props, ref);\n const contextValues = useToolbarContextValues_unstable(state);\n useToolbarStyles_unstable(state);\n return renderToolbar_unstable(state, contextValues);\n});\n\nToolbar.displayName = 'Toolbar';\n"],"sourceRoot":"../src/"}
@@ -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?: string,\n value?: string,\n checked?: boolean,\n) => void;\n"]}
1
+ {"version":3,"file":"Toolbar.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/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' | 'large';\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"]}
@@ -3,6 +3,7 @@ export const ToolbarContext = /*#__PURE__*/createContext(undefined);
3
3
  const toolbarContextDefaultValue = {
4
4
  size: 'medium',
5
5
  handleToggleButton: () => null,
6
+ handleRadio: () => null,
6
7
  vertical: false,
7
8
  checkedValues: {}
8
9
  };
@@ -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,QAAQ,EAAE,KAH4C;EAItD,aAAa,EAAE;AAJuC,CAAxD;AAOA,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 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/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/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/"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Toolbar/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Toolbar';\nexport * from './Toolbar.types';\nexport * from './renderToolbar';\nexport * from './useToolbar';\nexport * from './useToolbarStyles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/components/Toolbar/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Toolbar';\nexport * from './Toolbar.types';\nexport * from './renderToolbar';\nexport * from './useToolbar';\nexport * from './useToolbarStyles';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Toolbar/renderToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,cAAT,QAA+B,kBAA/B;AAEA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAsB,aAAtB,KAA6D;EACjG,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAe,KAAf,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAxB,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EAAiC,SAAS,CAAC,IAAV,CAAe,QAAhD,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ToolbarState, ToolbarSlots, ToolbarContextValues } from './Toolbar.types';\nimport { ToolbarContext } from './ToolbarContext';\n\n/**\n * Render the final JSX of Toolbar\n */\nexport const renderToolbar_unstable = (state: ToolbarState, contextValues: ToolbarContextValues) => {\n const { slots, slotProps } = getSlots<ToolbarSlots>(state);\n\n return (\n <ToolbarContext.Provider value={contextValues.toolbar}>\n <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>\n </ToolbarContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/Toolbar/renderToolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,cAAT,QAA+B,kBAA/B;AAEA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CAAC,KAAD,EAAsB,aAAtB,KAA6D;EACjG,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAe,KAAf,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,cAAc,CAAC,QAAhB,EAAwB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAxB,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EAAiC,SAAS,CAAC,IAAV,CAAe,QAAhD,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { ToolbarState, ToolbarSlots, ToolbarContextValues } from './Toolbar.types';\nimport { ToolbarContext } from './ToolbarContext';\n\n/**\n * Render the final JSX of Toolbar\n */\nexport const renderToolbar_unstable = (state: ToolbarState, contextValues: ToolbarContextValues) => {\n const { slots, slotProps } = getSlots<ToolbarSlots>(state);\n\n return (\n <ToolbarContext.Provider value={contextValues.toolbar}>\n <slots.root {...slotProps.root}>{slotProps.root.children}</slots.root>\n </ToolbarContext.Provider>\n );\n};\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: 'horizontal'
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, setCheckedValues] = useControllableState({
41
- state: initialState.checkedValues,
42
- defaultState: initialState.defaultCheckedValues,
43
- initialState: {}
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
- setCheckedValues(s => ({ ...s,
64
- [name]: newCheckedItems
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,gBAAhB,IAAoC,oBAAoB,CAAC;IAC7D,KAAK,EAAE,YAAY,CAAC,aADyC;IAE7D,YAAY,EAAE,YAAY,CAAC,oBAFkC;IAG7D,YAAY,EAAE;EAH+C,CAAD,CAA9D;EAMA,MAAM;IAAE;EAAF,IAA2B,YAAjC;EAEA,MAAM,kBAAkB,GAAoB,gBAAgB,CAC1D,CAAC,CAAD,EAA4C,IAA5C,EAA2D,KAA3D,EAA2E,OAA3E,KAAgG;IAC9F,IAAI,IAAI,IAAI,KAAZ,EAAmB;MACjB,MAAM,YAAY,GAAG,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAG,IAAH,CAAb,KAAyB,EAA9C;MACA,MAAM,eAAe,GAAG,CAAC,GAAG,YAAJ,CAAxB;;MACA,IAAI,OAAJ,EAAa;QACX,eAAe,CAAC,MAAhB,CAAuB,eAAe,CAAC,OAAhB,CAAwB,KAAxB,CAAvB,EAAuD,CAAvD;MACD,CAFD,MAEO;QACL,eAAe,CAAC,IAAhB,CAAqB,KAArB;MACD;;MAED,oBAAoB,KAAA,IAApB,IAAA,oBAAoB,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,EAAM;QAAE,IAAF;QAAQ,YAAY,EAAE;MAAtB,CAAN,CAApB;MACA,gBAAgB,CAAC,CAAC,KAAK,EAAE,GAAG,CAAL;QAAQ,CAAC,IAAD,GAAQ;MAAhB,CAAL,CAAF,CAAhB;IACD;EACF,CAdyD,CAA5D;EAiBA,OAAO,EACL,GAAG,YADE;IAEL,kBAFK;IAGL,aAAa,EAAE,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAA,aAAA,GAAiB;EAH3B,CAAP;AAKD,CAxDM","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, setCheckedValues] = useControllableState({\n state: initialState.checkedValues,\n defaultState: initialState.defaultCheckedValues,\n initialState: {},\n });\n\n const { onCheckedValueChange } = initialState;\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\n onCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n }\n },\n );\n\n return {\n ...initialState,\n handleToggleButton,\n checkedValues: checkedValues ?? {},\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/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,oBAAhB,IAAwC,yBAAyB,CAAC;IACtE,aAAa,EAAE,KAAK,CAAC,aADiD;IAEtE,oBAAoB,EAAE,KAAK,CAAC,oBAF0C;IAGtE,oBAAoB,EAAE,KAAK,CAAC;EAH0C,CAAD,CAAvE;EAMA,MAAM,kBAAkB,GAAoB,gBAAgB,CAC1D,CAAC,CAAD,EAA4C,IAA5C,EAA0D,KAA1D,EAAyE,OAAzE,KAA8F;IAC5F,IAAI,IAAI,IAAI,KAAZ,EAAmB;MACjB,MAAM,YAAY,GAAG,CAAA,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAG,IAAH,CAAb,KAAyB,EAA9C;MACA,MAAM,eAAe,GAAG,CAAC,GAAG,YAAJ,CAAxB;;MACA,IAAI,OAAJ,EAAa;QACX,eAAe,CAAC,MAAhB,CAAuB,eAAe,CAAC,OAAhB,CAAwB,KAAxB,CAAvB,EAAuD,CAAvD;MACD,CAFD,MAEO;QACL,eAAe,CAAC,IAAhB,CAAqB,KAArB;MACD;;MACD,oBAAoB,KAAA,IAApB,IAAA,oBAAoB,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,EAAM;QAAE,IAAF;QAAQ,YAAY,EAAE;MAAtB,CAAN,CAApB;IACD;EACF,CAZyD,CAA5D;EAeA,MAAM,WAAW,GAAoB,gBAAgB,CACnD,CAAC,CAAD,EAA4C,IAA5C,EAA0D,KAA1D,EAAyE,OAAzE,KAA8F;IAC5F,IAAI,IAAI,IAAI,KAAZ,EAAmB;MACjB,oBAAoB,KAAA,IAApB,IAAA,oBAAoB,KAAA,KAAA,CAApB,GAAoB,KAAA,CAApB,GAAA,oBAAoB,CAAG,CAAH,EAAM;QACxB,IADwB;QAExB,YAAY,EAAE,CAAC,KAAD;MAFU,CAAN,CAApB;IAID;EACF,CARkD,CAArD;EAWA,OAAO,EACL,GAAG,YADE;IAEL,kBAFK;IAGL,WAHK;IAIL,aAAa,EAAE,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAA,aAAA,GAAiB;EAJ3B,CAAP;AAMD,CAhEM;AAkEP;;;AAGG;;AACH,MAAM,yBAAyB,GAC7B,KADgC,IAE9B;EACF,MAAM,CAAC,aAAD,EAAgB,gBAAhB,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: '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;EAAtC,IAAwD,KAA9D,CADkE,CAElE;;EACA,MAAM,OAAO,GAAwB;IACnC,IADmC;IAEnC,QAFmC;IAGnC,kBAHmC;IAInC;EAJmC,CAArC;EAOA,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 } = 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 checkedValues,\n };\n\n return { toolbar };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/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/"}
@@ -9,6 +9,7 @@ export const toolbarClassNames = {
9
9
  const useStyles = /*#__PURE__*/__styles({
10
10
  "root": {
11
11
  "mc9l5x": "f22iagw",
12
+ "Bt984gj": "f122n59",
12
13
  "z8tnut": "f10ra9hq",
13
14
  "z189sj": ["f19lj068", "f177v4lu"],
14
15
  "Byoj8tv": "f1y2xyjm",
@@ -19,9 +20,18 @@ const useStyles = /*#__PURE__*/__styles({
19
20
  "vertical": {
20
21
  "Beiy3e4": "f1vx9l62",
21
22
  "a9b677": "f1acs6jw"
23
+ },
24
+ "small": {
25
+ "Bqenvij": "f1d2rq10"
26
+ },
27
+ "medium": {
28
+ "Bqenvij": "fbhnoac"
29
+ },
30
+ "large": {
31
+ "Bqenvij": "ff2sm71"
22
32
  }
23
33
  }, {
24
- "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f10ra9hq{padding-top:4px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f1y2xyjm{padding-bottom:4px;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".fn67r4l{row-gap:8px;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f1acs6jw{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;}"]
34
+ "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f10ra9hq{padding-top:4px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f1y2xyjm{padding-bottom:4px;}", ".f4px1ci{-webkit-column-gap:8px;column-gap:8px;}", ".fn67r4l{row-gap:8px;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f1acs6jw{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;}", ".f1d2rq10{height:32px;}", ".fbhnoac{height:40px;}", ".ff2sm71{height:48px;}"]
25
35
  });
26
36
  /**
27
37
  * Apply styling to the Toolbar slots based on the state
@@ -31,9 +41,10 @@ const useStyles = /*#__PURE__*/__styles({
31
41
  export const useToolbarStyles_unstable = state => {
32
42
  const styles = useStyles();
33
43
  const {
34
- vertical
44
+ vertical,
45
+ size
35
46
  } = state;
36
- state.root.className = mergeClasses(toolbarClassNames.root, styles.root, vertical && styles.vertical, state.root.className);
47
+ state.root.className = mergeClasses(toolbarClassNames.root, styles.root, vertical && styles.vertical, size === 'small' && !vertical && styles.small, size === 'medium' && !vertical && styles.medium, size === 'large' && !vertical && styles.large, state.root.className);
37
48
  return state;
38
49
  };
39
50
  //# sourceMappingURL=useToolbarStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Toolbar/useToolbarStyles.ts"],"names":[],"mappings":"AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAGA,OAAO,MAAM,iBAAiB,GAAiC;EAC7D,IAAI,EAAE;AADuD,CAAxD;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAYA;;AAEG;;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAsC;EAC7E,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM;IAAE;EAAF,IAAe,KAArB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,iBAAiB,CAAC,IADe,EAEjC,MAAM,CAAC,IAF0B,EAGjC,QAAQ,IAAI,MAAM,CAAC,QAHc,EAIjC,KAAK,CAAC,IAAN,CAAW,SAJsB,CAAnC;EAOA,OAAO,KAAP;AACD,CAXM","sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { ToolbarSlots, ToolbarState } from './Toolbar.types';\n\nexport const toolbarClassNames: SlotClassNames<ToolbarSlots> = {\n root: 'fui-Toolbar',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.padding('4px', '8px', '4px', '8px'),\n ...shorthands.gap('8px'),\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarStyles_unstable = (state: ToolbarState): ToolbarState => {\n const styles = useStyles();\n const { vertical } = state;\n state.root.className = mergeClasses(\n toolbarClassNames.root,\n styles.root,\n vertical && styles.vertical,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/Toolbar/useToolbarStyles.ts"],"names":[],"mappings":"AACA,mBAAqB,YAArB,EAAmC,UAAnC,QAAqD,gBAArD;AAGA,OAAO,MAAM,iBAAiB,GAAiC;EAC7D,IAAI,EAAE;AADuD,CAAxD;AAIP;;AAEG;;AACH,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAsBA;;AAEG;;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAsC;EAC7E,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM;IAAE,QAAF;IAAY;EAAZ,IAAqB,KAA3B;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,iBAAiB,CAAC,IADe,EAEjC,MAAM,CAAC,IAF0B,EAGjC,QAAQ,IAAI,MAAM,CAAC,QAHc,EAIjC,IAAI,KAAK,OAAT,IAAoB,CAAC,QAArB,IAAiC,MAAM,CAAC,KAJP,EAKjC,IAAI,KAAK,QAAT,IAAqB,CAAC,QAAtB,IAAkC,MAAM,CAAC,MALR,EAMjC,IAAI,KAAK,OAAT,IAAoB,CAAC,QAArB,IAAiC,MAAM,CAAC,KANP,EAOjC,KAAK,CAAC,IAAN,CAAW,SAPsB,CAAnC;EAUA,OAAO,KAAP;AACD,CAdM","sourcesContent":["import { SlotClassNames } from '@fluentui/react-utilities';\nimport { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { ToolbarSlots, ToolbarState } from './Toolbar.types';\n\nexport const toolbarClassNames: SlotClassNames<ToolbarSlots> = {\n root: 'fui-Toolbar',\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n alignItems: 'center',\n ...shorthands.padding('4px', '8px', '4px', '8px'),\n ...shorthands.gap('8px'),\n },\n vertical: {\n flexDirection: 'column',\n width: 'fit-content',\n },\n small: {\n height: '32px',\n },\n medium: {\n height: '40px',\n },\n large: {\n height: '48px',\n },\n});\n\n/**\n * Apply styling to the Toolbar slots based on the state\n */\nexport const useToolbarStyles_unstable = (state: ToolbarState): ToolbarState => {\n const styles = useStyles();\n const { vertical, size } = state;\n state.root.className = mergeClasses(\n toolbarClassNames.root,\n styles.root,\n vertical && styles.vertical,\n size === 'small' && !vertical && styles.small,\n size === 'medium' && !vertical && styles.medium,\n size === 'large' && !vertical && styles.large,\n state.root.className,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,19 +1,15 @@
1
1
  import * as React from 'react';
2
- import { renderButton_unstable, useButtonStyles_unstable, useButton_unstable } from '@fluentui/react-button';
3
- import { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';
2
+ import { renderButton_unstable } from '@fluentui/react-button';
3
+ import { useToolbarButtonStyles_unstable } from './useToolbarButtonStyles';
4
+ import { useToolbarButton_unstable } from './useToolbarButton';
4
5
  /**
5
6
  * ToolbarButton component is a Button to be used inside Toolbar
6
7
  * which will respect toolbar props such as `size`
7
8
  */
8
9
 
9
10
  export const ToolbarButton = /*#__PURE__*/React.forwardRef((props, ref) => {
10
- const size = useToolbarContext_unstable(ctx => ctx.size);
11
- const state = useButton_unstable({
12
- size,
13
- appearance: 'transparent',
14
- ...props
15
- }, ref);
16
- useButtonStyles_unstable(state);
11
+ const state = useToolbarButton_unstable(props, ref);
12
+ useToolbarButtonStyles_unstable(state);
17
13
  return renderButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
18
14
  });
19
15
  ToolbarButton.displayName = 'ToolbarButton';
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToolbarButton/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,qBAAT,EAAgC,wBAAhC,EAA0D,kBAA1D,QAAoF,wBAApF;AACA,SAAS,0BAAT,QAA2C,2BAA3C;AAEA;;;AAGG;;AACH,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,IAAI,GAAG,0BAA0B,CAAC,GAAG,IAAI,GAAG,CAAC,IAAZ,CAAvC;EACA,MAAM,KAAK,GAAG,kBAAkB,CAAC;IAAE,IAAF;IAAQ,UAAU,EAAE,aAApB;IAAmC,GAAG;EAAtC,CAAD,EAAgD,GAAhD,CAAhC;EACA,wBAAwB,CAAC,KAAD,CAAxB;EACA,OAAO,qBAAqB,CAAC,KAAD,CAA5B,CAJoG,CAKpG;AACD,CANqE,CAA/D;AAQP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport type { ToolbarButtonProps } from './ToolbarButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderButton_unstable, useButtonStyles_unstable, useButton_unstable } from '@fluentui/react-button';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * ToolbarButton component is a Button to be used inside Toolbar\n * which will respect toolbar props such as `size`\n */\nexport const ToolbarButton: ForwardRefComponent<ToolbarButtonProps> = React.forwardRef((props, ref) => {\n const size = useToolbarContext_unstable(ctx => ctx.size);\n const state = useButton_unstable({ size, appearance: 'transparent', ...props }, ref);\n useButtonStyles_unstable(state);\n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ToolbarButtonProps>;\n\nToolbarButton.displayName = 'ToolbarButton';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarButton/ToolbarButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAGA,SAAS,qBAAT,QAAsC,wBAAtC;AACA,SAAS,+BAAT,QAAgD,0BAAhD;AACA,SAAS,yBAAT,QAA0C,oBAA1C;AAEA;;;AAGG;;AACH,OAAO,MAAM,aAAa,gBAA4C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACpG,MAAM,KAAK,GAAG,yBAAyB,CAAC,KAAD,EAAQ,GAAR,CAAvC;EACA,+BAA+B,CAAC,KAAD,CAA/B;EAEA,OAAO,qBAAqB,CAAC,KAAD,CAA5B,CAJoG,CAKpG;AACD,CANqE,CAA/D;AAQP,aAAa,CAAC,WAAd,GAA4B,eAA5B","sourcesContent":["import * as React from 'react';\nimport type { ToolbarButtonProps } from './ToolbarButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderButton_unstable } from '@fluentui/react-button';\nimport { useToolbarButtonStyles_unstable } from './useToolbarButtonStyles';\nimport { useToolbarButton_unstable } from './useToolbarButton';\n\n/**\n * ToolbarButton component is a Button to be used inside Toolbar\n * which will respect toolbar props such as `size`\n */\nexport const ToolbarButton: ForwardRefComponent<ToolbarButtonProps> = React.forwardRef((props, ref) => {\n const state = useToolbarButton_unstable(props, ref);\n useToolbarButtonStyles_unstable(state);\n \n return renderButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ToolbarButtonProps>;\n\nToolbarButton.displayName = 'ToolbarButton';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarButton.types.js","sourceRoot":"../src/","sources":["components/ToolbarButton/ToolbarButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle';\n };\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> & ButtonState;\n"]}
1
+ {"version":3,"file":"ToolbarButton.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/components/ToolbarButton/ToolbarButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { ButtonProps, ButtonSlots, ButtonState } from '@fluentui/react-button';\n\n/**\n * ToolbarButton Props\n */\nexport type ToolbarButtonProps = ComponentProps<ButtonSlots> &\n Partial<Pick<ButtonProps, 'disabled' | 'disabledFocusable'>> & {\n appearance?: 'primary' | 'subtle';\n } & {\n vertical?: boolean;\n };\n\n/**\n * State used in rendering ToolbarButton\n */\nexport type ToolbarButtonState = ComponentState<Partial<ButtonSlots>> &\n ButtonState &\n Required<Pick<ToolbarButtonProps, 'vertical'>>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/ToolbarButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './ToolbarButton';\nexport * from './ToolbarButton.types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/components/ToolbarButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC","sourcesContent":["export * from './ToolbarButton';\nexport * from './ToolbarButton.types';\n"]}
@@ -0,0 +1,23 @@
1
+ import { useButton_unstable } from '@fluentui/react-button';
2
+ /**
3
+ * Given user props, defines default props for the Button, calls useButtonState and useChecked, and returns
4
+ * processed state.
5
+ * @param props - User provided props to the Button component.
6
+ * @param ref - User provided ref to be passed to the Button component.
7
+ */
8
+
9
+ export const useToolbarButton_unstable = (props, ref) => {
10
+ const {
11
+ vertical = false,
12
+ ...buttonProps
13
+ } = props;
14
+ const state = useButton_unstable({
15
+ appearance: 'subtle',
16
+ ...buttonProps
17
+ }, ref);
18
+ return {
19
+ vertical,
20
+ ...state
21
+ };
22
+ };
23
+ //# sourceMappingURL=useToolbarButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarButton/useToolbarButton.ts"],"names":[],"mappings":"AACA,SAAS,kBAAT,QAAmC,wBAAnC;AAGA;;;;;AAKG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;EACtB,MAAM;IAAE,QAAQ,GAAG,KAAb;IAAoB,GAAG;EAAvB,IAAuC,KAA7C;EACA,MAAM,KAAK,GAAG,kBAAkB,CAAC;IAAE,UAAU,EAAE,QAAd;IAAwB,GAAG;EAA3B,CAAD,EAA2C,GAA3C,CAAhC;EACA,OAAO;IACL,QADK;IAEL,GAAG;EAFE,CAAP;AAID,CAVM","sourcesContent":["import * as React from 'react';\nimport { useButton_unstable } from '@fluentui/react-button';\nimport { ToolbarButtonProps, ToolbarButtonState } from './ToolbarButton.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useToolbarButton_unstable = (\n props: ToolbarButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToolbarButtonState => {\n const { vertical = false, ...buttonProps } = props;\n const state = useButton_unstable({ appearance: 'subtle', ...buttonProps }, ref);\n return {\n vertical,\n ...state,\n };\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,28 @@
1
+ import { __styles, mergeClasses } from '@griffel/react';
2
+ import { useButtonStyles_unstable } from '@fluentui/react-button';
3
+
4
+ const useBaseStyles = /*#__PURE__*/__styles({
5
+ "vertical": {
6
+ "Beiy3e4": "f1vx9l62"
7
+ },
8
+ "verticalIcon": {
9
+ "Be2twd7": "f1rt2boy"
10
+ }
11
+ }, {
12
+ "d": [".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f1rt2boy{font-size:24px;}"]
13
+ });
14
+ /**
15
+ * Apply styling to the ToolbarButton slots based on the state
16
+ */
17
+
18
+
19
+ export const useToolbarButtonStyles_unstable = state => {
20
+ useButtonStyles_unstable(state);
21
+ const buttonStyles = useBaseStyles();
22
+ state.root.className = mergeClasses(state.root.className, state.vertical && buttonStyles.vertical);
23
+
24
+ if (state.icon) {
25
+ state.icon.className = mergeClasses(state.icon.className, state.vertical && buttonStyles.verticalIcon);
26
+ }
27
+ };
28
+ //# sourceMappingURL=useToolbarButtonStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarButton/useToolbarButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,wBAAT,QAAyC,wBAAzC;;AAGA,MAAM,aAAa,gBAAG;EAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;AASA;;AAEG;;;AACH,OAAO,MAAM,+BAA+B,GAAI,KAAD,IAA8B;EAC3E,wBAAwB,CAAC,KAAD,CAAxB;EACA,MAAM,YAAY,GAAG,aAAa,EAAlC;EAEA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,KAAK,CAAC,IAAN,CAAW,SAAZ,EAAuB,KAAK,CAAC,QAAN,IAAkB,YAAY,CAAC,QAAtD,CAAnC;;EACA,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,KAAK,CAAC,IAAN,CAAW,SAAZ,EAAuB,KAAK,CAAC,QAAN,IAAkB,YAAY,CAAC,YAAtD,CAAnC;EACD;AACF,CARM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { useButtonStyles_unstable } from '@fluentui/react-button';\nimport { ToolbarButtonState } from './ToolbarButton.types';\n\nconst useBaseStyles = makeStyles({\n vertical: {\n flexDirection: 'column',\n },\n verticalIcon: {\n fontSize: '24px',\n },\n});\n\n/**\n * Apply styling to the ToolbarButton slots based on the state\n */\nexport const useToolbarButtonStyles_unstable = (state: ToolbarButtonState) => {\n useButtonStyles_unstable(state);\n const buttonStyles = useBaseStyles();\n\n state.root.className = mergeClasses(state.root.className, state.vertical && buttonStyles.vertical);\n if (state.icon) {\n state.icon.className = mergeClasses(state.icon.className, state.vertical && buttonStyles.verticalIcon);\n }\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToolbarDivider/ToolbarDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAGA,SAAS,sBAAT,QAAuC,yBAAvC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAEA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtG,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;EACA,gCAAgC,CAAC,KAAD,CAAhC;EACA,OAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CAJuE,CAAjE;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourcesContent":["import * as React from 'react';\nimport { useToolbarDividerStyles_unstable } from './useToolbarDividerStyles';\nimport type { ToolbarDividerProps } from './ToolbarDivider.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderDivider_unstable } from '@fluentui/react-divider';\nimport { useToolbarDivider_unstable } from './useToolbarDivider';\n\n/**\n * ToolbarDivider component\n */\nexport const ToolbarDivider: ForwardRefComponent<ToolbarDividerProps> = React.forwardRef((props, ref) => {\n const state = useToolbarDivider_unstable(props, ref);\n useToolbarDividerStyles_unstable(state);\n return renderDivider_unstable(state);\n});\n\nToolbarDivider.displayName = 'ToolbarDivider';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarDivider/ToolbarDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAGA,SAAS,sBAAT,QAAuC,yBAAvC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAEA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtG,MAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;EACA,gCAAgC,CAAC,KAAD,CAAhC;EACA,OAAO,sBAAsB,CAAC,KAAD,CAA7B;AACD,CAJuE,CAAjE;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourcesContent":["import * as React from 'react';\nimport { useToolbarDividerStyles_unstable } from './useToolbarDividerStyles';\nimport type { ToolbarDividerProps } from './ToolbarDivider.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderDivider_unstable } from '@fluentui/react-divider';\nimport { useToolbarDivider_unstable } from './useToolbarDivider';\n\n/**\n * ToolbarDivider component\n */\nexport const ToolbarDivider: ForwardRefComponent<ToolbarDividerProps> = React.forwardRef((props, ref) => {\n const state = useToolbarDivider_unstable(props, ref);\n useToolbarDividerStyles_unstable(state);\n return renderDivider_unstable(state);\n});\n\nToolbarDivider.displayName = 'ToolbarDivider';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarDivider.types.js","sourceRoot":"../src/","sources":["components/ToolbarDivider/ToolbarDivider.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { DividerSlots, DividerState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n"]}
1
+ {"version":3,"file":"ToolbarDivider.types.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/components/ToolbarDivider/ToolbarDivider.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { DividerSlots, DividerState } from '@fluentui/react-divider';\n\n/**\n * ToolbarDivider Props\n */\nexport type ToolbarDividerProps = ComponentProps<Partial<DividerSlots>> & {\n /**\n * A divider can be horizontal or vertical (default).\n *\n * @default true\n */\n vertical?: boolean;\n};\n\n/**\n * State used in rendering ToolbarDivider\n */\nexport type ToolbarDividerState = ComponentState<Partial<DividerSlots>> & DividerState;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/ToolbarDivider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './ToolbarDivider';\nexport * from './ToolbarDivider.types';\nexport * from './useToolbarDividerStyles';\nexport * from './useToolbarDivider';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["packages/react-components/react-toolbar/src/components/ToolbarDivider/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './ToolbarDivider';\nexport * from './ToolbarDivider.types';\nexport * from './useToolbarDividerStyles';\nexport * from './useToolbarDivider';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToolbarDivider/useToolbarDivider.ts"],"names":[],"mappings":"AAEA,SAAS,mBAAT,QAAoC,yBAApC;AACA,SAAS,0BAAT,QAA2C,2BAA3C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,0BAA0B,GAAG,CACxC,KADwC,EAExC,GAFwC,KAGjB;EACvB,MAAM,QAAQ,GAAG,0BAA0B,CAAC,GAAG,IAAI,GAAG,CAAC,QAAZ,CAA3C;EACA,OAAO,mBAAmB,CAAC;IAAE,QAAQ,EAAE,CAAC,QAAb;IAAuB,GAAG;EAA1B,CAAD,EAAoC,GAApC,CAA1B;AACD,CANM","sourcesContent":["import * as React from 'react';\nimport { ToolbarDividerProps, ToolbarDividerState } from './ToolbarDivider.types';\nimport { useDivider_unstable } from '@fluentui/react-divider';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Create the state required to render ToolbarDivider.\n *\n * The returned state can be modified with hooks such as useToolbarDividerStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDivider_unstable = (\n props: ToolbarDividerProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n return useDivider_unstable({ vertical: !vertical, ...props }, ref);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarDivider/useToolbarDivider.ts"],"names":[],"mappings":"AAEA,SAAS,mBAAT,QAAoC,yBAApC;AACA,SAAS,0BAAT,QAA2C,2BAA3C;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,0BAA0B,GAAG,CACxC,KADwC,EAExC,GAFwC,KAGjB;EACvB,MAAM,QAAQ,GAAG,0BAA0B,CAAC,GAAG,IAAI,GAAG,CAAC,QAAZ,CAA3C;EACA,OAAO,mBAAmB,CAAC;IAAE,QAAQ,EAAE,CAAC,QAAb;IAAuB,GAAG;EAA1B,CAAD,EAAoC,GAApC,CAA1B;AACD,CANM","sourcesContent":["import * as React from 'react';\nimport { ToolbarDividerProps, ToolbarDividerState } from './ToolbarDivider.types';\nimport { useDivider_unstable } from '@fluentui/react-divider';\nimport { useToolbarContext_unstable } from '../Toolbar/ToolbarContext';\n\n/**\n * Create the state required to render ToolbarDivider.\n *\n * The returned state can be modified with hooks such as useToolbarDividerStyles_unstable,\n * before being passed to renderToolbar_unstable.\n *\n * @param props - props from this instance of ToolbarDivider\n * @param ref - reference to root HTMLElement of ToolbarDivider\n */\nexport const useToolbarDivider_unstable = (\n props: ToolbarDividerProps,\n ref: React.Ref<HTMLElement>,\n): ToolbarDividerState => {\n const vertical = useToolbarContext_unstable(ctx => ctx.vertical);\n return useDivider_unstable({ vertical: !vertical, ...props }, ref);\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/ToolbarDivider/useToolbarDividerStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,yBAAT,QAA0C,yBAA1C;;AAGA,MAAM,aAAa,gBAAG;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;AAWA;;AAEG;;;AACH,OAAO,MAAM,gCAAgC,GAAI,KAAD,IAAoD;EAClG,yBAAyB,CAAC,KAAD,CAAzB;EACA,MAAM;IAAE;EAAF,IAAe,KAArB;EACA,MAAM,oBAAoB,GAAG,aAAa,EAA1C;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,KAAK,CAAC,IAAN,CAAW,SADsB,EAEjC,oBAAoB,CAAC,IAFY,EAGjC,CAAC,QAAD,IAAa,oBAAoB,CAAC,QAHD,CAAnC;EAKA,OAAO,KAAP;AACD,CAVM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { useDividerStyles_unstable } from '@fluentui/react-divider';\nimport type { ToolbarDividerState } from './ToolbarDivider.types';\n\nconst useBaseStyles = makeStyles({\n // Base styles\n root: {\n display: 'inline-flex',\n maxWidth: '1px',\n },\n vertical: {\n maxWidth: 'initial',\n },\n});\n\n/**\n * Apply styling to the ToolbarDivider slots based on the state\n */\nexport const useToolbarDividerStyles_unstable = (state: ToolbarDividerState): ToolbarDividerState => {\n useDividerStyles_unstable(state);\n const { vertical } = state;\n const toolbarDividerStyles = useBaseStyles();\n state.root.className = mergeClasses(\n state.root.className,\n toolbarDividerStyles.root,\n !vertical && toolbarDividerStyles.vertical,\n );\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-toolbar/src/components/ToolbarDivider/useToolbarDividerStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,yBAAT,QAA0C,yBAA1C;;AAGA,MAAM,aAAa,gBAAG;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAtB;AAWA;;AAEG;;;AACH,OAAO,MAAM,gCAAgC,GAAI,KAAD,IAAoD;EAClG,yBAAyB,CAAC,KAAD,CAAzB;EACA,MAAM;IAAE;EAAF,IAAe,KAArB;EACA,MAAM,oBAAoB,GAAG,aAAa,EAA1C;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,KAAK,CAAC,IAAN,CAAW,SADsB,EAEjC,oBAAoB,CAAC,IAFY,EAGjC,CAAC,QAAD,IAAa,oBAAoB,CAAC,QAHD,CAAnC;EAKA,OAAO,KAAP;AACD,CAVM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { useDividerStyles_unstable } from '@fluentui/react-divider';\nimport type { ToolbarDividerState } from './ToolbarDivider.types';\n\nconst useBaseStyles = makeStyles({\n // Base styles\n root: {\n display: 'inline-flex',\n maxWidth: '1px',\n },\n vertical: {\n maxWidth: 'initial',\n },\n});\n\n/**\n * Apply styling to the ToolbarDivider slots based on the state\n */\nexport const useToolbarDividerStyles_unstable = (state: ToolbarDividerState): ToolbarDividerState => {\n useDividerStyles_unstable(state);\n const { vertical } = state;\n const toolbarDividerStyles = useBaseStyles();\n state.root.className = mergeClasses(\n state.root.className,\n toolbarDividerStyles.root,\n !vertical && toolbarDividerStyles.vertical,\n );\n return state;\n};\n"],"sourceRoot":"../src/"}