@fluentui/react-button 9.0.0-beta.1 → 9.0.0-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +275 -1
- package/CHANGELOG.md +67 -2
- package/dist/react-button.d.ts +15 -2
- package/lib/common/isConformant.js +1 -1
- package/lib/common/isConformant.js.map +1 -1
- package/lib/components/Button/Button.js +2 -2
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.d.ts +1 -1
- package/lib/components/Button/index.d.ts +1 -1
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +10 -9
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +20 -24
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.d.ts +1 -0
- package/lib/components/Button/useButtonStyles.js +27 -24
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js +2 -2
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/index.d.ts +1 -1
- package/lib/components/CompoundButton/index.js +1 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js +10 -9
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +8 -8
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +40 -37
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +2 -2
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.d.ts +5 -1
- package/lib/components/MenuButton/index.d.ts +1 -1
- package/lib/components/MenuButton/index.js +1 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +10 -9
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +8 -8
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.js +5 -3
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +2 -2
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/index.d.ts +1 -1
- package/lib/components/SplitButton/index.js +1 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js +6 -7
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +41 -45
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +36 -33
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +2 -2
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/index.d.ts +1 -1
- package/lib/components/ToggleButton/index.js +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +27 -29
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.js +13 -10
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/Button.js +1 -1
- package/lib-commonjs/CompoundButton.js +1 -1
- package/lib-commonjs/MenuButton.js +1 -1
- package/lib-commonjs/SplitButton.js +1 -1
- package/lib-commonjs/ToggleButton.js +1 -1
- package/lib-commonjs/common/isConformant.js +3 -3
- package/lib-commonjs/common/isConformant.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js +6 -6
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.d.ts +1 -1
- package/lib-commonjs/components/Button/index.d.ts +1 -1
- package/lib-commonjs/components/Button/index.js +8 -2
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js +12 -12
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +22 -26
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +1 -0
- package/lib-commonjs/components/Button/useButtonStyles.js +29 -26
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +6 -6
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.d.ts +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +8 -2
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +12 -12
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +10 -11
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +43 -40
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +6 -6
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +5 -1
- package/lib-commonjs/components/MenuButton/index.d.ts +1 -1
- package/lib-commonjs/components/MenuButton/index.js +8 -2
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +12 -12
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +12 -13
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +9 -6
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +6 -6
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.d.ts +1 -1
- package/lib-commonjs/components/SplitButton/index.js +8 -2
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +8 -10
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +44 -49
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +39 -36
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +6 -6
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.d.ts +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +8 -2
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +31 -34
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +17 -13
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/package.json +9 -11
@@ -1,8 +1,9 @@
|
|
1
1
|
import { __styles, mergeClasses } from '@fluentui/react-make-styles';
|
2
|
-
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
2
|
+
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
3
|
+
export const buttonClassName = 'fui-Button'; // TODO: These are named in design specs but not hoisted to global/alias yet.
|
3
4
|
// We're tracking these here to determine how we can hoist them.
|
4
5
|
|
5
|
-
export
|
6
|
+
export const buttonSpacing = {
|
6
7
|
smallest: '2px',
|
7
8
|
smaller: '4px',
|
8
9
|
small: '6px',
|
@@ -11,7 +12,7 @@ export var buttonSpacing = {
|
|
11
12
|
larger: '16px'
|
12
13
|
};
|
13
14
|
|
14
|
-
|
15
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
15
16
|
"base": {
|
16
17
|
"Bt984gj": "f122n59",
|
17
18
|
"mc9l5x": "ftuwxu6",
|
@@ -177,7 +178,7 @@ var useRootStyles = /*#__PURE__*/__styles({
|
|
177
178
|
"a": [".fzgy25m:active{background:var(--colorNeutralBackground1Pressed);}", ".fvs00aa:active{border-top-color:var(--colorNeutralStroke1Pressed);}", ".f1assf6x:active{border-right-color:var(--colorNeutralStroke1Pressed);}", ".f4ruux4:active{border-left-color:var(--colorNeutralStroke1Pressed);}", ".fumykes:active{border-bottom-color:var(--colorNeutralStroke1Pressed);}", ".f1r2dosr:active{color:var(--colorNeutralForeground1);}", ".fb0xa7e:active{outline-style:none;}", ".flt377r:active{background:var(--colorTransparentBackgroundPressed);}", ".f4ihffn:active{background:var(--colorBrandBackgroundPressed);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f18otbis:active{color:var(--colorNeutralForegroundOnBrand);}", ".f1be4e1d:active{background:var(--colorSubtleBackgroundPressed);}", ".f19au66r:active{color:var(--colorNeutralForeground2BrandPressed);}"]
|
178
179
|
});
|
179
180
|
|
180
|
-
|
181
|
+
const useRootDisabledStyles = /*#__PURE__*/__styles({
|
181
182
|
"base": {
|
182
183
|
"ayd6f0": "fqst6tg",
|
183
184
|
"g2u3we": "f1jj8ep1",
|
@@ -260,7 +261,7 @@ var useRootDisabledStyles = /*#__PURE__*/__styles({
|
|
260
261
|
"a": [".fkqx3al:active{background:var(--colorNeutralBackgroundDisabled);}", ".fdi4vxw:active{border-top-color:var(--colorNeutralStrokeDisabled);}", ".f4ryxzl:active{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fkdgpbx:active{border-left-color:var(--colorNeutralStrokeDisabled);}", ".fcmhn06:active{border-bottom-color:var(--colorNeutralStrokeDisabled);}", ".f19wldhg:active{color:var(--colorNeutralForegroundDisabled);}", ".fq67hom:active{cursor:not-allowed;}", ".flt377r:active{background:var(--colorTransparentBackgroundPressed);}", ".ff472gp:active{border-top-color:transparent;}", ".f4yyc7m:active{border-right-color:transparent;}", ".ft2aflc:active{border-left-color:transparent;}", ".fggejwh:active{border-bottom-color:transparent;}", ".f17oliv9:active{background:none;}"]
|
261
262
|
});
|
262
263
|
|
263
|
-
|
264
|
+
const useRootFocusStyles = /*#__PURE__*/__styles({
|
264
265
|
"base": {
|
265
266
|
"B486eqv": "f2hkw1w",
|
266
267
|
"Bnmjwt4": "flfsvnh",
|
@@ -270,7 +271,7 @@ var useRootFocusStyles = /*#__PURE__*/__styles({
|
|
270
271
|
"B32s92o": "f4mghqd",
|
271
272
|
"B5hngm5": "fhcq1yo",
|
272
273
|
"Bh48x57": "f19j8a82",
|
273
|
-
"D4py6b":
|
274
|
+
"D4py6b": "f9ycirn",
|
274
275
|
"Bgwpjed": "fpt6wn7"
|
275
276
|
},
|
276
277
|
"circular": {
|
@@ -284,7 +285,7 @@ var useRootFocusStyles = /*#__PURE__*/__styles({
|
|
284
285
|
"Jopkrh": ["fhoxsto", "f19qf7vm"],
|
285
286
|
"hhrs2v": "f1tl0rof",
|
286
287
|
"B7jbng7": ["f19qf7vm", "fhoxsto"],
|
287
|
-
"D4py6b":
|
288
|
+
"D4py6b": "f15m8qn2"
|
288
289
|
},
|
289
290
|
"square": {
|
290
291
|
"B486eqv": "f2hkw1w",
|
@@ -304,10 +305,10 @@ var useRootFocusStyles = /*#__PURE__*/__styles({
|
|
304
305
|
}
|
305
306
|
}, {
|
306
307
|
"i": [".f2hkw1w:focus-visible{outline-style:none;}"],
|
307
|
-
"d": ["[data-keyboard-nav] .flfsvnh:focus{border-top-color:transparent;}", "[data-keyboard-nav] .f1781m5e:focus{border-right-color:transparent;}", "[data-keyboard-nav] .flvaaa9:focus{border-left-color:transparent;}", "[data-keyboard-nav] .f50u1b5:focus{border-bottom-color:transparent;}", "[data-keyboard-nav] .f4mghqd:focus{outline-width:2px;}", "[data-keyboard-nav] .fhcq1yo:focus{outline-style:solid;}", "[data-keyboard-nav] .f19j8a82:focus{outline-color:transparent;}", "[data-keyboard-nav] .f9ycirn:focus{box-shadow:var(--shadow4),0 0 0 2px var(--colorStrokeFocus2);}", "[data-keyboard-nav] .
|
308
|
+
"d": ["[data-keyboard-nav] .flfsvnh:focus{border-top-color:transparent;}", "[data-keyboard-nav] .f1781m5e:focus{border-right-color:transparent;}", "[data-keyboard-nav] .flvaaa9:focus{border-left-color:transparent;}", "[data-keyboard-nav] .f50u1b5:focus{border-bottom-color:transparent;}", "[data-keyboard-nav] .f4mghqd:focus{outline-width:2px;}", "[data-keyboard-nav] .fhcq1yo:focus{outline-style:solid;}", "[data-keyboard-nav] .f19j8a82:focus{outline-color:transparent;}", "[data-keyboard-nav] .f9ycirn:focus{box-shadow:var(--shadow4),0 0 0 2px var(--colorStrokeFocus2);}", "[data-keyboard-nav] .fpt6wn7:focus{z-index:1;}", "[data-keyboard-nav] .f6dohij:focus{border-radius:var(--borderRadiusCircular);}", "[data-keyboard-nav] .fbugrqt:focus{border-top-color:var(--colorNeutralForegroundOnBrand);}", "[data-keyboard-nav] .fhoxsto:focus{border-right-color:var(--colorNeutralForegroundOnBrand);}", "[data-keyboard-nav] .f19qf7vm:focus{border-left-color:var(--colorNeutralForegroundOnBrand);}", "[data-keyboard-nav] .f1tl0rof:focus{border-bottom-color:var(--colorNeutralForegroundOnBrand);}", "[data-keyboard-nav] .f15m8qn2:focus{box-shadow:var(--shadow2),0 0 0 2px var(--colorStrokeFocus2);}", "[data-keyboard-nav] .f1x6jsgk:focus{border-radius:var(--borderRadiusNone);}", "[data-keyboard-nav] .f1cqgkc0:focus{border-radius:var(--borderRadiusSmall);}", "[data-keyboard-nav] .fhf9ij9:focus{border-radius:var(--borderRadiusMedium);}", "[data-keyboard-nav] .fnsjjqm:focus{border-radius:var(--borderRadiusLarge);}"]
|
308
309
|
});
|
309
310
|
|
310
|
-
|
311
|
+
const useRootIconOnlyStyles = /*#__PURE__*/__styles({
|
311
312
|
"small": {
|
312
313
|
"z8tnut": "f10ra9hq",
|
313
314
|
"z189sj": ["f8wuabp", "fycuoez"],
|
@@ -336,7 +337,7 @@ var useRootIconOnlyStyles = /*#__PURE__*/__styles({
|
|
336
337
|
"d": [".f10ra9hq{padding-top:4px;}", ".f8wuabp{padding-right:4px;}", ".fycuoez{padding-left:4px;}", ".f1y2xyjm{padding-bottom:4px;}", ".f107v6xj{min-width:28px;}", ".f17iyk3w{max-width:28px;}", ".fwbmr0d{min-width:32px;}", ".f44c6la{max-width:32px;}", ".f1xp5gbu{padding-top:6px;}", ".f1sgzk6v{padding-right:6px;}", ".f1bg5zqg{padding-left:6px;}", ".f1d7kygh{padding-bottom:6px;}", ".f12clzc2{min-width:40px;}", ".fjy1crr{max-width:40px;}"]
|
337
338
|
});
|
338
339
|
|
339
|
-
|
340
|
+
const useIconStyles = /*#__PURE__*/__styles({
|
340
341
|
"base": {
|
341
342
|
"Bt984gj": "f122n59",
|
342
343
|
"mc9l5x": "ftuwxu6",
|
@@ -361,20 +362,22 @@ var useIconStyles = /*#__PURE__*/__styles({
|
|
361
362
|
"d": [".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".fe5j1ua{font-size:20px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}", ".f1rt2boy{font-size:24px;}", ".frvgh55{height:24px;}", ".fq4mcun{width:24px;}"]
|
362
363
|
});
|
363
364
|
|
364
|
-
export
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
365
|
+
export const useButtonStyles = state => {
|
366
|
+
const rootStyles = useRootStyles();
|
367
|
+
const rootDisabledStyles = useRootDisabledStyles();
|
368
|
+
const rootFocusStyles = useRootFocusStyles();
|
369
|
+
const rootIconOnlyStyles = useRootIconOnlyStyles();
|
370
|
+
const iconStyles = useIconStyles();
|
371
|
+
const {
|
372
|
+
appearance,
|
373
|
+
block,
|
374
|
+
disabled,
|
375
|
+
disabledFocusable,
|
376
|
+
iconOnly,
|
377
|
+
shape,
|
378
|
+
size
|
379
|
+
} = state;
|
380
|
+
state.root.className = mergeClasses(buttonClassName, // Root styles
|
378
381
|
rootStyles.base, block && rootStyles.block, appearance && rootStyles[appearance], rootStyles[size], rootStyles[shape], // Disabled styles
|
379
382
|
(disabled || disabledFocusable) && rootDisabledStyles.base, appearance && (disabled || disabledFocusable) && rootDisabledStyles[appearance], // Focus styles
|
380
383
|
rootFocusStyles.base, appearance === 'primary' && rootFocusStyles.primary, rootFocusStyles[size], rootFocusStyles[shape], // Icon-only styles
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/Button/useButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,+BAAT,QAAgD,yBAAhD,C,
|
1
|
+
{"version":3,"s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;AA2BA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,UAAU,CAAC,IAAD,CAA5B,EAAoC,KAAK,CAAC,IAAN,CAAW,SAA/C,CAAnC;AACD;;AAED,SAAO,KAAP;AACD,CAzCM","sourceRoot":""}
|
@@ -6,8 +6,8 @@ import { useCompoundButtonStyles } from './useCompoundButtonStyles';
|
|
6
6
|
* CompoundButtons are buttons that can have secondary content that adds extra information to the user.
|
7
7
|
*/
|
8
8
|
|
9
|
-
export
|
10
|
-
|
9
|
+
export const CompoundButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useCompoundButton(props, ref);
|
11
11
|
useCompoundButtonStyles(state);
|
12
12
|
return renderCompoundButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
13
13
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/CompoundButton/CompoundButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B,CALsG,CAMtG;AACD,CAPuE,CAAjE;AASP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
|
@@ -2,4 +2,4 @@ export * from './CompoundButton';
|
|
2
2
|
export * from './CompoundButton.types';
|
3
3
|
export * from './renderCompoundButton';
|
4
4
|
export * from './useCompoundButton';
|
5
|
-
export { useCompoundButtonStyles } from './useCompoundButtonStyles';
|
5
|
+
export { compoundButtonClassName, useCompoundButtonStyles } from './useCompoundButtonStyles';
|
@@ -2,5 +2,5 @@ export * from './CompoundButton';
|
|
2
2
|
export * from './CompoundButton.types';
|
3
3
|
export * from './renderCompoundButton';
|
4
4
|
export * from './useCompoundButton';
|
5
|
-
export { useCompoundButtonStyles } from './useCompoundButtonStyles';
|
5
|
+
export { compoundButtonClassName, useCompoundButtonStyles } from './useCompoundButtonStyles';
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CompoundButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CompoundButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
|
@@ -1,17 +1,18 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
/**
|
5
4
|
* Renders a CompoundButton component by passing the state defined props to the appropriate slots.
|
6
5
|
*/
|
7
6
|
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
export const renderCompoundButton = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state, ['root', 'contentContainer', 'icon', 'secondaryContent']);
|
12
|
+
const {
|
13
|
+
iconOnly,
|
14
|
+
iconPosition
|
15
|
+
} = state;
|
16
|
+
return /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root), iconPosition !== 'after' && /*#__PURE__*/React.createElement(slots.icon, Object.assign({}, slotProps.icon)), !iconOnly && /*#__PURE__*/React.createElement(slots.contentContainer, Object.assign({}, slotProps.contentContainer), slotProps.root.children, /*#__PURE__*/React.createElement(slots.secondaryContent, Object.assign({}, slotProps.secondaryContent))), iconPosition === 'after' && /*#__PURE__*/React.createElement(slots.icon, Object.assign({}, slotProps.icon)));
|
16
17
|
};
|
17
18
|
//# sourceMappingURL=renderCompoundButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/CompoundButton/renderCompoundButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA+B;AACjE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,EAA6B,CAChE,MADgE,EAEhE,kBAFgE,EAGhE,MAHgE,EAIhE,kBAJgE,CAA7B,CAArC;AAMA,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA;AAAZ,MAA6B,KAAnC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAD/B,EAEG,CAAC,QAAD,iBACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,EACG,SAAS,CAAC,IAAV,CAAe,QADlB,eAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,gBAAP,EAAuB,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,gBAAf,CAAvB,CAFF,CAHJ,EAQG,YAAY,KAAK,OAAjB,iBAA4B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CAR/B,CADF;AAYD,CArBM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
2
1
|
import { resolveShorthand } from '@fluentui/react-utilities';
|
3
2
|
import { useButton } from '../Button/index';
|
4
3
|
/**
|
@@ -7,12 +6,13 @@ import { useButton } from '../Button/index';
|
|
7
6
|
* @param ref - User provided ref to be passed to the CompoundButton component.
|
8
7
|
*/
|
9
8
|
|
10
|
-
export
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
return
|
9
|
+
export const useCompoundButton = ({
|
10
|
+
contentContainer,
|
11
|
+
secondaryContent,
|
12
|
+
...props
|
13
|
+
}, ref) => {
|
14
|
+
return { // Button state
|
15
|
+
...useButton(props, ref),
|
16
16
|
// Slots definition
|
17
17
|
components: {
|
18
18
|
root: 'button',
|
@@ -24,6 +24,6 @@ export var useCompoundButton = function (_a, ref) {
|
|
24
24
|
required: true
|
25
25
|
}),
|
26
26
|
secondaryContent: resolveShorthand(secondaryContent)
|
27
|
-
}
|
27
|
+
};
|
28
28
|
};
|
29
29
|
//# sourceMappingURL=useCompoundButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/CompoundButton/useCompoundButton.ts"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,2BAAjC;AAEA,SAAS,SAAT,QAA0B,iBAA1B;AAEA;;;;AAIG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAC/B;AAAE,EAAA,gBAAF;AAAoB,EAAA,gBAApB;AAAsC,KAAG;AAAzC,CAD+B,EAE/B,GAF+B,KAGR;AACvB,SAAO,EACL;AACA,OAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,CAFP;AAIL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE,MAFI;AAGV,MAAA,gBAAgB,EAAE,MAHR;AAIV,MAAA,gBAAgB,EAAE;AAJR,KALP;AAWL,IAAA,gBAAgB,EAAE,gBAAgB,CAAC,gBAAD,EAAmB;AAAE,MAAA,QAAQ,EAAE;AAAZ,KAAnB,CAX7B;AAYL,IAAA,gBAAgB,EAAE,gBAAgB,CAAC,gBAAD;AAZ7B,GAAP;AAcD,CAlBM","sourceRoot":""}
|
@@ -1,32 +1,33 @@
|
|
1
1
|
import { mergeClasses, __styles } from '@fluentui/react-make-styles';
|
2
2
|
import { buttonSpacing, useButtonStyles } from '../Button/useButtonStyles';
|
3
|
-
|
4
|
-
|
3
|
+
export const compoundButtonClassName = 'fui-CompoundButton';
|
4
|
+
const CompoundButtonClassNames = {
|
5
|
+
secondaryContent: `${compoundButtonClassName}-secondaryContent`
|
5
6
|
};
|
6
7
|
|
7
|
-
|
8
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
8
9
|
"base": {
|
9
10
|
"rmohyg": "fsbu5mz",
|
10
11
|
"Bqenvij": "f11ysow2",
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
12
|
+
"Bma4kx5": "f900oq5",
|
13
|
+
"l15nfm": "f8rpug0",
|
14
|
+
"n4n7rj": "fre7xro"
|
14
15
|
},
|
15
16
|
"outline": {},
|
16
17
|
"primary": {
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"
|
18
|
+
"Bma4kx5": "f1ur7rb7",
|
19
|
+
"l15nfm": "f1itoici",
|
20
|
+
"n4n7rj": "f1uen3ov"
|
20
21
|
},
|
21
22
|
"subtle": {
|
22
|
-
"
|
23
|
-
"
|
24
|
-
"
|
23
|
+
"Bma4kx5": "f900oq5",
|
24
|
+
"l15nfm": "f1l9nom2",
|
25
|
+
"n4n7rj": "fvjq8kx"
|
25
26
|
},
|
26
27
|
"transparent": {
|
27
|
-
"
|
28
|
-
"
|
29
|
-
"
|
28
|
+
"Bma4kx5": "f900oq5",
|
29
|
+
"l15nfm": "f1l9nom2",
|
30
|
+
"n4n7rj": "fvjq8kx"
|
30
31
|
},
|
31
32
|
"small": {
|
32
33
|
"z8tnut": "fp9bwmr",
|
@@ -53,17 +54,17 @@ var useRootStyles = /*#__PURE__*/__styles({
|
|
53
54
|
"Bg96gwp": "faaz57k"
|
54
55
|
},
|
55
56
|
"disabled": {
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
57
|
+
"Bma4kx5": "fj9njph",
|
58
|
+
"l15nfm": "fr13fpv",
|
59
|
+
"n4n7rj": "f1xrf5v0"
|
59
60
|
}
|
60
61
|
}, {
|
61
|
-
"d": [".fsbu5mz{gap:12px;}", ".f11ysow2{height:auto;}", ".
|
62
|
-
"h": [".
|
63
|
-
"a": [".
|
62
|
+
"d": [".fsbu5mz{gap:12px;}", ".f11ysow2{height:auto;}", ".f900oq5 .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForeground2);}", ".f1ur7rb7 .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundOnBrand);}", ".fp9bwmr{padding-top:8px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f150uoa4{padding-bottom:8px;}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fod5ikn{font-size:var(--fontSizeBase400);}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".fj9njph .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundDisabled);}"],
|
63
|
+
"h": [".f8rpug0:hover .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForeground2Hover);}", ".f1itoici:hover .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundOnBrand);}", ".f1l9nom2:hover .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForeground2BrandHover);}", ".fr13fpv:hover .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundDisabled);}"],
|
64
|
+
"a": [".fre7xro:active .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForeground2Pressed);}", ".f1uen3ov:active .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundOnBrand);}", ".fvjq8kx:active .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForeground2BrandPressed);}", ".f1xrf5v0:active .fui-CompoundButton-secondaryContent{color:var(--colorNeutralForegroundDisabled);}"]
|
64
65
|
});
|
65
66
|
|
66
|
-
|
67
|
+
const useRootIconOnlyStyles = /*#__PURE__*/__styles({
|
67
68
|
"small": {
|
68
69
|
"z8tnut": "f10ra9hq",
|
69
70
|
"z189sj": ["f8wuabp", "fycuoez"],
|
@@ -92,7 +93,7 @@ var useRootIconOnlyStyles = /*#__PURE__*/__styles({
|
|
92
93
|
"d": [".f10ra9hq{padding-top:4px;}", ".f8wuabp{padding-right:4px;}", ".fycuoez{padding-left:4px;}", ".f1y2xyjm{padding-bottom:4px;}", ".ft5vyj6{max-width:48px;}", ".f17suaiq{min-width:48px;}", ".f1xp5gbu{padding-top:6px;}", ".f1sgzk6v{padding-right:6px;}", ".f1bg5zqg{padding-left:6px;}", ".f1d7kygh{padding-bottom:6px;}", ".fdczgix{max-width:52px;}", ".fjdcg9m{min-width:52px;}", ".fp9bwmr{padding-top:8px;}", ".f19lj068{padding-right:8px;}", ".f177v4lu{padding-left:8px;}", ".f150uoa4{padding-bottom:8px;}", ".fww51uw{max-width:56px;}", ".f1qhsl2h{min-width:56px;}"]
|
93
94
|
});
|
94
95
|
|
95
|
-
|
96
|
+
const useIconStyles = /*#__PURE__*/__styles({
|
96
97
|
"base": {
|
97
98
|
"Be2twd7": "fndrnj9",
|
98
99
|
"Bqenvij": "fbhnoac",
|
@@ -102,7 +103,7 @@ var useIconStyles = /*#__PURE__*/__styles({
|
|
102
103
|
"d": [".fndrnj9{font-size:40px;}", ".fbhnoac{height:40px;}", ".feqmc2u{width:40px;}"]
|
103
104
|
});
|
104
105
|
|
105
|
-
|
106
|
+
const useContentContainerStyles = /*#__PURE__*/__styles({
|
106
107
|
"base": {
|
107
108
|
"mc9l5x": "f22iagw",
|
108
109
|
"Beiy3e4": "f1vx9l62",
|
@@ -112,7 +113,7 @@ var useContentContainerStyles = /*#__PURE__*/__styles({
|
|
112
113
|
"d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f1o700av{text-align:left;}", ".fes3tcz{text-align:right;}"]
|
113
114
|
});
|
114
115
|
|
115
|
-
|
116
|
+
const useSecondaryContentStyles = /*#__PURE__*/__styles({
|
116
117
|
"base": {
|
117
118
|
"Bg96gwp": "flkuc6h",
|
118
119
|
"B6of3ja": "fvjh0tl",
|
@@ -131,18 +132,20 @@ var useSecondaryContentStyles = /*#__PURE__*/__styles({
|
|
131
132
|
"d": [".flkuc6h{line-height:100%;}", ".fvjh0tl{margin-top:4px;}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fkhj508{font-size:var(--fontSizeBase300);}"]
|
132
133
|
});
|
133
134
|
|
134
|
-
export
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
135
|
+
export const useCompoundButtonStyles = state => {
|
136
|
+
const rootStyles = useRootStyles();
|
137
|
+
const rootIconOnlyStyles = useRootIconOnlyStyles();
|
138
|
+
const iconStyles = useIconStyles();
|
139
|
+
const contentContainerStyles = useContentContainerStyles();
|
140
|
+
const secondaryContentStyles = useSecondaryContentStyles();
|
141
|
+
const {
|
142
|
+
appearance,
|
143
|
+
disabled,
|
144
|
+
disabledFocusable,
|
145
|
+
iconOnly,
|
146
|
+
size
|
147
|
+
} = state;
|
148
|
+
state.root.className = mergeClasses(compoundButtonClassName, // Root styles
|
146
149
|
rootStyles.base, appearance && rootStyles[appearance], rootStyles[size], // Disabled styles
|
147
150
|
(disabled || disabledFocusable) && rootStyles.disabled, // Icon-only styles
|
148
151
|
iconOnly && rootIconOnlyStyles[size], // User provided class name
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AACA,SAAS,aAAT,EAAwB,eAAxB,QAA+C,2BAA/C;AAGA,
|
1
|
+
{"version":3,"sources":["../../../src/components/CompoundButton/useCompoundButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AACA,SAAS,aAAT,EAAwB,eAAxB,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BAAsB,GAAG,yBAAyB,EAAxD;AAEA,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,QAAd;AAAwB,IAAA,iBAAxB;AAA2C,IAAA,QAA3C;AAAqD,IAAA;AAArD,MAA8D,KAApE;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,uBADiC,EAGjC;AACA,EAAA,UAAU,CAAC,IAJsB,EAKjC,UAAU,IAAI,UAAU,CAAC,UAAD,CALS,EAMjC,UAAU,CAAC,IAAD,CANuB,EAQjC;AACA,GAAC,QAAQ,IAAI,iBAAb,KAAmC,UAAU,CAAC,QATb,EAWjC;AACA,EAAA,QAAQ,IAAI,kBAAkB,CAAC,IAAD,CAZG,EAcjC;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAfsB,CAAnC;;AAkBA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,UAAU,CAAC,IAAZ,EAAkB,KAAK,CAAC,IAAN,CAAW,SAA7B,CAAnC;AACD;;AAED,EAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAAC,sBAAsB,CAAC,IAAxB,EAA8B,KAAK,CAAC,gBAAN,CAAuB,SAArD,CAA/C;;AAEA,MAAI,KAAK,CAAC,gBAAV,EAA4B;AAC1B,IAAA,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,wBAAwB,CAAC,gBADoB,EAE7C,sBAAsB,CAAC,IAFsB,EAG7C,sBAAsB,CAAC,IAAD,CAHuB,EAI7C,KAAK,CAAC,gBAAN,CAAuB,SAJsB,CAA/C;AAMD;;AAED,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CA7CM","sourceRoot":""}
|
@@ -6,8 +6,8 @@ import { useMenuButtonStyles } from './useMenuButtonStyles';
|
|
6
6
|
* MenuButtons are buttons that handle opening and closing a menu when they are triggered.
|
7
7
|
*/
|
8
8
|
|
9
|
-
export
|
10
|
-
|
9
|
+
export const MenuButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useMenuButton(props, ref);
|
11
11
|
useMenuButtonStyles(state);
|
12
12
|
return renderMenuButton(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
13
13
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AACA,SAAS,aAAT,QAA8B,iBAA9B;AACA,SAAS,mBAAT,QAAoC,uBAApC;AAIA;;AAEG;;AACH,OAAO,
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/MenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,oBAAjC;AACA,SAAS,aAAT,QAA8B,iBAA9B;AACA,SAAS,mBAAT,QAAoC,uBAApC;AAIA;;AAEG;;AACH,OAAO,MAAM,UAAU,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC9F,QAAM,KAAK,GAAG,aAAa,CAAC,KAAD,EAAQ,GAAR,CAA3B;AAEA,EAAA,mBAAmB,CAAC,KAAD,CAAnB;AAEA,SAAO,gBAAgB,CAAC,KAAD,CAAvB,CAL8F,CAM9F;AACD,CAP+D,CAAzD;AASP,UAAU,CAAC,WAAX,GAAyB,YAAzB","sourceRoot":""}
|
@@ -1,6 +1,9 @@
|
|
1
|
-
import
|
1
|
+
import * as React from 'react';
|
2
2
|
import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
|
3
3
|
import type { ButtonCommons, ButtonSlots, ButtonState } from '../Button/Button.types';
|
4
|
+
declare type MenuTriggerChildProps = Pick<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'aria-expanded' | 'id'> & {
|
5
|
+
ref?: React.Ref<never>;
|
6
|
+
};
|
4
7
|
export declare type MenuButtonSlots = ButtonSlots & {
|
5
8
|
/**
|
6
9
|
* Menu icon that indicates that this button has a menu that can be expanded.
|
@@ -9,3 +12,4 @@ export declare type MenuButtonSlots = ButtonSlots & {
|
|
9
12
|
};
|
10
13
|
export declare type MenuButtonProps = ComponentProps<MenuButtonSlots> & Partial<Omit<ButtonCommons, 'iconPosition'>> & Partial<MenuTriggerChildProps>;
|
11
14
|
export declare type MenuButtonState = ComponentState<MenuButtonSlots> & Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;
|
15
|
+
export {};
|
@@ -2,4 +2,4 @@ export * from './MenuButton.types';
|
|
2
2
|
export * from './MenuButton';
|
3
3
|
export * from './renderMenuButton';
|
4
4
|
export * from './useMenuButton';
|
5
|
-
export { useMenuButtonStyles } from './useMenuButtonStyles';
|
5
|
+
export { menuButtonClassName, useMenuButtonStyles } from './useMenuButtonStyles';
|
@@ -2,5 +2,5 @@ export * from './MenuButton.types';
|
|
2
2
|
export * from './MenuButton';
|
3
3
|
export * from './renderMenuButton';
|
4
4
|
export * from './useMenuButton';
|
5
|
-
export { useMenuButtonStyles } from './useMenuButtonStyles';
|
5
|
+
export { menuButtonClassName, useMenuButtonStyles } from './useMenuButtonStyles';
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MenuButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MenuButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC"}
|
@@ -1,17 +1,18 @@
|
|
1
|
-
import { __assign } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { getSlots } from '@fluentui/react-utilities';
|
4
3
|
/**
|
5
4
|
* Renders a MenuButton component by passing the state defined props to the appropriate slots.
|
6
5
|
*/
|
7
6
|
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
7
|
+
export const renderMenuButton = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state, ['root', 'icon', 'menuIcon']);
|
12
|
+
const {
|
13
|
+
icon,
|
14
|
+
iconOnly
|
15
|
+
} = state;
|
16
|
+
return /*#__PURE__*/React.createElement(slots.root, Object.assign({}, slotProps.root), /*#__PURE__*/React.createElement(slots.icon, Object.assign({}, slotProps.icon)), !iconOnly && slotProps.root.children, (!iconOnly || !(icon === null || icon === void 0 ? void 0 : icon.children)) && /*#__PURE__*/React.createElement(slots.menuIcon, Object.assign({}, slotProps.menuIcon)));
|
16
17
|
};
|
17
18
|
//# sourceMappingURL=renderMenuButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,gBAAgB,GAAI,KAAD,IAA2B;AACzD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAkB,KAAlB,EAAyB,CAAC,MAAD,EAAS,MAAT,EAAiB,UAAjB,CAAzB,CAArC;AACA,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA;AAAR,MAAqB,KAA3B;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,EAEG,CAAC,QAAD,IAAa,SAAS,CAAC,IAAV,CAAe,QAF/B,EAGG,CAAC,CAAC,QAAD,IAAa,EAAC,IAAI,KAAA,IAAJ,IAAA,IAAI,KAAA,KAAA,CAAJ,GAAI,KAAA,CAAJ,GAAA,IAAI,CAAE,QAAP,CAAd,kBAAkC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAHrC,CADF;AAOD,CAXM","sourceRoot":""}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
2
|
import { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';
|
4
3
|
import { resolveShorthand } from '@fluentui/react-utilities';
|
@@ -7,12 +6,13 @@ import { useButton } from '../Button/index';
|
|
7
6
|
* Given user props, returns the final state for a MenuButton.
|
8
7
|
*/
|
9
8
|
|
10
|
-
export
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
return
|
9
|
+
export const useMenuButton = ({
|
10
|
+
menuIcon,
|
11
|
+
...props
|
12
|
+
}, ref) => {
|
13
|
+
const buttonState = useButton(props, ref);
|
14
|
+
return { // Button state
|
15
|
+
...buttonState,
|
16
16
|
// State calculated from a set of props
|
17
17
|
iconOnly: Boolean(!props.children),
|
18
18
|
// Slots definition
|
@@ -27,6 +27,6 @@ export var useMenuButton = function (_a, ref) {
|
|
27
27
|
},
|
28
28
|
required: true
|
29
29
|
})
|
30
|
-
}
|
30
|
+
};
|
31
31
|
};
|
32
32
|
//# sourceMappingURL=useMenuButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButton.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,EAA+B,oBAA/B,QAA2D,uBAA3D;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,SAAT,QAA0B,iBAA1B;AAGA;;AAEG;;AACH,OAAO,MAAM,aAAa,GAAG,CAC3B;AAAE,EAAA,QAAF;AAAY,KAAG;AAAf,CAD2B,EAE3B,GAF2B,KAGR;AACnB,QAAM,WAAW,GAAG,SAAS,CAAC,KAAD,EAAQ,GAAR,CAA7B;AACA,SAAO,EACL;AACA,OAAG,WAFE;AAIL;AACA,IAAA,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,QAAR,CALZ;AAOL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,QADI;AAEV,MAAA,IAAI,EAAE,MAFI;AAGV,MAAA,QAAQ,EAAE;AAHA,KARP;AAcL,IAAA,QAAQ,EAAE,gBAAgB,CAAC,QAAD,EAAW;AACnC,MAAA,YAAY,EAAE;AACZ,QAAA,QAAQ,EAAE,WAAW,CAAC,IAAZ,KAAqB,OAArB,gBAA+B,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB,CAA/B,gBAA0D,KAAA,CAAA,aAAA,CAAC,oBAAD,EAAqB,IAArB;AADxD,OADqB;AAInC,MAAA,QAAQ,EAAE;AAJyB,KAAX;AAdrB,GAAP;AAqBD,CA1BM","sourceRoot":""}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { mergeClasses, __styles } from '@fluentui/react-make-styles';
|
2
2
|
import { useButtonStyles } from '../Button/useButtonStyles';
|
3
|
+
export const menuButtonClassName = 'fui-MenuButton';
|
3
4
|
|
4
|
-
|
5
|
+
const useMenuIconStyles = /*#__PURE__*/__styles({
|
5
6
|
"small": {
|
6
7
|
"Be2twd7": "fe5j1ua",
|
7
8
|
"Bqenvij": "fjamq6b",
|
@@ -21,8 +22,9 @@ var useMenuIconStyles = /*#__PURE__*/__styles({
|
|
21
22
|
"d": [".fe5j1ua{font-size:20px;}", ".fjamq6b{height:20px;}", ".f64fuq3{width:20px;}", ".f1rt2boy{font-size:24px;}", ".frvgh55{height:24px;}", ".fq4mcun{width:24px;}"]
|
22
23
|
});
|
23
24
|
|
24
|
-
export
|
25
|
-
|
25
|
+
export const useMenuButtonStyles = state => {
|
26
|
+
const menuIconStyles = useMenuIconStyles();
|
27
|
+
state.root.className = mergeClasses(menuButtonClassName, state.root.className);
|
26
28
|
|
27
29
|
if (state.menuIcon) {
|
28
30
|
state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AAEA,SAAS,eAAT,QAAgC,2BAAhC
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,6BAAzC;AAEA,SAAS,eAAT,QAAgC,2BAAhC;AAGA,OAAO,MAAM,mBAAmB,GAAG,gBAA5B;;AAEP,MAAM,iBAAiB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAmBA,OAAO,MAAM,mBAAmB,GAAI,KAAD,IAA4C;AAC7E,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,mBAAD,EAAsB,KAAK,CAAC,IAAN,CAAW,SAAjC,CAAnC;;AAEA,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,IAAP,CAAf,EAA6B,KAAK,CAAC,QAAN,CAAe,SAA5C,CAAvC;AACD;;AAED,EAAA,eAAe,CAAC,KAAD,CAAf;AAEA,SAAO,KAAP;AACD,CAZM","sourceRoot":""}
|