@fluentui/react-button 9.0.0-nightly.f81b28ceb3.1 → 9.0.0-rc.11
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +914 -24
- package/CHANGELOG.md +388 -180
- package/README.md +80 -18
- package/dist/{react-button.d.ts → index.d.ts} +72 -59
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/Button.js.map +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js.map +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.js +7 -7
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js +1 -2
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +13 -9
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +20 -25
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js +240 -165
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js +7 -7
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +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 +15 -9
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +13 -8
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +96 -75
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +9 -8
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +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 +13 -9
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +11 -11
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +39 -17
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js +8 -8
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +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 +9 -7
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +54 -49
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.js +46 -39
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +7 -7
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +5 -41
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +110 -86
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.js +6 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/useToggleState.js +37 -0
- package/lib/utils/useToggleState.js.map +1 -0
- package/lib-commonjs/Button.js +1 -1
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/CompoundButton.js +1 -1
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js +1 -1
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js +1 -1
- package/lib-commonjs/SplitButton.js.map +1 -1
- package/lib-commonjs/ToggleButton.js +1 -1
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.js +8 -8
- package/lib-commonjs/components/Button/Button.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +10 -6
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/renderButton.js +17 -14
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +24 -29
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js +243 -166
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.js +8 -8
- package/lib-commonjs/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +10 -4
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js +19 -14
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +16 -12
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js +99 -77
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.js +10 -9
- package/lib-commonjs/components/MenuButton/MenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +10 -4
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +17 -14
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +15 -16
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js +43 -19
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.js +9 -9
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +10 -4
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +13 -12
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +58 -54
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +50 -42
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.js +8 -8
- package/lib-commonjs/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +10 -4
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js +3 -3
- package/lib-commonjs/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +7 -45
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js +114 -86
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.js +169 -6
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +10 -0
- package/lib-commonjs/utils/index.js.map +1 -0
- package/lib-commonjs/utils/useToggleState.js +48 -0
- package/lib-commonjs/utils/useToggleState.js.map +1 -0
- package/package.json +22 -27
- package/dist/demo/index.html +0 -71
- package/dist/demo/react-dom.development.js +0 -21413
- package/dist/demo/react.development.js +0 -3155
- package/lib/Button.d.ts +0 -1
- package/lib/CompoundButton.d.ts +0 -1
- package/lib/MenuButton.d.ts +0 -1
- package/lib/SplitButton.d.ts +0 -1
- package/lib/ToggleButton.d.ts +0 -1
- package/lib/common/isConformant.d.ts +0 -4
- package/lib/common/isConformant.js +0 -13
- package/lib/common/isConformant.js.map +0 -1
- package/lib/components/Button/Button.d.ts +0 -6
- package/lib/components/Button/Button.types.d.ts +0 -62
- package/lib/components/Button/index.d.ts +0 -5
- package/lib/components/Button/renderButton.d.ts +0 -5
- package/lib/components/Button/useButton.d.ts +0 -8
- package/lib/components/Button/useButtonStyles.d.ts +0 -10
- package/lib/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib/components/CompoundButton/index.d.ts +0 -5
- package/lib/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
- package/lib/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib/components/MenuButton/MenuButton.types.d.ts +0 -11
- package/lib/components/MenuButton/index.d.ts +0 -5
- package/lib/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
- package/lib/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib/components/SplitButton/SplitButton.types.d.ts +0 -19
- package/lib/components/SplitButton/index.d.ts +0 -5
- package/lib/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
- package/lib/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib/components/ToggleButton/ToggleButton.types.d.ts +0 -19
- package/lib/components/ToggleButton/index.d.ts +0 -5
- package/lib/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
- package/lib/index.d.ts +0 -5
- package/lib-commonjs/Button.d.ts +0 -1
- package/lib-commonjs/CompoundButton.d.ts +0 -1
- package/lib-commonjs/MenuButton.d.ts +0 -1
- package/lib-commonjs/SplitButton.d.ts +0 -1
- package/lib-commonjs/ToggleButton.d.ts +0 -1
- package/lib-commonjs/common/isConformant.d.ts +0 -4
- package/lib-commonjs/common/isConformant.js +0 -24
- package/lib-commonjs/common/isConformant.js.map +0 -1
- package/lib-commonjs/components/Button/Button.d.ts +0 -6
- package/lib-commonjs/components/Button/Button.types.d.ts +0 -62
- package/lib-commonjs/components/Button/index.d.ts +0 -5
- package/lib-commonjs/components/Button/renderButton.d.ts +0 -5
- package/lib-commonjs/components/Button/useButton.d.ts +0 -8
- package/lib-commonjs/components/Button/useButtonStyles.d.ts +0 -10
- package/lib-commonjs/components/CompoundButton/CompoundButton.d.ts +0 -6
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.d.ts +0 -14
- package/lib-commonjs/components/CompoundButton/index.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.d.ts +0 -5
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +0 -8
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/MenuButton/MenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +0 -11
- package/lib-commonjs/components/MenuButton/index.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/renderMenuButton.d.ts +0 -5
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +0 -6
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +0 -7
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +0 -19
- package/lib-commonjs/components/SplitButton/index.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +0 -5
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +0 -8
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +0 -2
- package/lib-commonjs/components/ToggleButton/ToggleButton.d.ts +0 -6
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.d.ts +0 -19
- package/lib-commonjs/components/ToggleButton/index.d.ts +0 -5
- package/lib-commonjs/components/ToggleButton/renderToggleButton.d.ts +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +0 -9
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.d.ts +0 -2
- package/lib-commonjs/index.d.ts +0 -5
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/MenuButton/renderMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAA2B;AAClE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAkB,KAAlB,CAArC;AACA,QAAM;AAAE,IAAA,IAAF;AAAQ,IAAA;AAAR,MAAqB,KAA3B;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,IAAN,iBAAc,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CADjB,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,KAAkC,KAAK,CAAC,QAAxC,iBAAoD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;AAAf,GAAf,CAHvD,CADF;AAOD,CAXM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton_unstable = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlots<MenuButtonSlots>(state);\n const { icon, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {!iconOnly && slotProps.root.children}\n {(!iconOnly || !icon?.children) && slots.menuIcon && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import { __assign, __rest } from "tslib";
|
2
1
|
import * as React from 'react';
|
3
|
-
import {
|
2
|
+
import { ChevronDownRegular } from '@fluentui/react-icons';
|
4
3
|
import { resolveShorthand } from '@fluentui/react-utilities';
|
5
|
-
import {
|
4
|
+
import { useButton_unstable } from '../Button/index';
|
6
5
|
/**
|
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_unstable = ({
|
10
|
+
menuIcon,
|
11
|
+
...props
|
12
|
+
}, ref) => {
|
13
|
+
const buttonState = useButton_unstable(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
|
@@ -23,10 +23,10 @@ export var useMenuButton = function (_a, ref) {
|
|
23
23
|
},
|
24
24
|
menuIcon: resolveShorthand(menuIcon, {
|
25
25
|
defaultProps: {
|
26
|
-
children:
|
26
|
+
children: /*#__PURE__*/React.createElement(ChevronDownRegular, null)
|
27
27
|
},
|
28
28
|
required: true
|
29
29
|
})
|
30
|
-
}
|
30
|
+
};
|
31
31
|
};
|
32
32
|
//# sourceMappingURL=useMenuButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,kBAAT,QAAmC,uBAAnC;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,kBAAT,QAAmC,iBAAnC;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAG,CACpC;AAAE,EAAA,QAAF;AAAY,KAAG;AAAf,CADoC,EAEpC,GAFoC,KAGjB;AACnB,QAAM,WAAW,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAtC;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,KAAA,CAAA,aAAA,CAAC,kBAAD,EAAmB,IAAnB;AADE,OADqB;AAInC,MAAA,QAAQ,EAAE;AAJyB,KAAX;AAdrB,GAAP;AAqBD,CA1BM","sourcesContent":["import * as React from 'react';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { useButton_unstable } from '../Button/index';\nimport type { MenuButtonProps, MenuButtonState } from './MenuButton.types';\n\n/**\n * Given user props, returns the final state for a MenuButton.\n */\nexport const useMenuButton_unstable = (\n { menuIcon, ...props }: MenuButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): MenuButtonState => {\n const buttonState = useButton_unstable(props, ref);\n return {\n // Button state\n ...buttonState,\n\n // State calculated from a set of props\n iconOnly: Boolean(!props.children),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n menuIcon: 'span',\n },\n\n menuIcon: resolveShorthand(menuIcon, {\n defaultProps: {\n children: <ChevronDownRegular />,\n },\n required: true,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,34 +1,56 @@
|
|
1
|
-
import { mergeClasses, __styles } from '@
|
2
|
-
import {
|
1
|
+
import { mergeClasses, __styles } from '@griffel/react';
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
3
|
+
import { useButtonStyles_unstable } from '../Button/useButtonStyles';
|
4
|
+
export const menuButtonClassNames = {
|
5
|
+
root: 'fui-MenuButton',
|
6
|
+
icon: 'fui-MenuButton__icon',
|
7
|
+
menuIcon: 'fui-MenuButton__menuIcon'
|
8
|
+
};
|
3
9
|
|
4
|
-
|
10
|
+
const useMenuIconStyles = /*#__PURE__*/__styles({
|
11
|
+
"base": {
|
12
|
+
"Bg96gwp": "fez10in"
|
13
|
+
},
|
5
14
|
"small": {
|
6
|
-
"Be2twd7": "
|
7
|
-
"Bqenvij": "
|
8
|
-
"
|
15
|
+
"Be2twd7": "f1ugzwwg",
|
16
|
+
"Bqenvij": "fvblgha",
|
17
|
+
"Bg96gwp": "fwrc4pm",
|
18
|
+
"a9b677": "frx94fk"
|
9
19
|
},
|
10
20
|
"medium": {
|
11
|
-
"Be2twd7": "
|
12
|
-
"Bqenvij": "
|
13
|
-
"
|
21
|
+
"Be2twd7": "f1ugzwwg",
|
22
|
+
"Bqenvij": "fvblgha",
|
23
|
+
"Bg96gwp": "fwrc4pm",
|
24
|
+
"a9b677": "frx94fk"
|
14
25
|
},
|
15
26
|
"large": {
|
16
|
-
"Be2twd7": "
|
17
|
-
"Bqenvij": "
|
18
|
-
"
|
27
|
+
"Be2twd7": "f4ybsrx",
|
28
|
+
"Bqenvij": "fd461yt",
|
29
|
+
"Bg96gwp": "faaz57k",
|
30
|
+
"a9b677": "fjw5fx7"
|
31
|
+
},
|
32
|
+
"notIconOnly": {
|
33
|
+
"Frg6f3": ["fbyavb5", "fm0x6gh"]
|
19
34
|
}
|
20
35
|
}, {
|
21
|
-
"d": [".
|
36
|
+
"d": [".fez10in{line-height:0;}", ".f1ugzwwg{font-size:12px;}", ".fvblgha{height:12px;}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".frx94fk{width:12px;}", ".f4ybsrx{font-size:16px;}", ".fd461yt{height:16px;}", ".faaz57k{line-height:var(--lineHeightBase400);}", ".fjw5fx7{width:16px;}", ".fbyavb5{margin-left:var(--spacingHorizontalXS);}", ".fm0x6gh{margin-right:var(--spacingHorizontalXS);}"]
|
22
37
|
});
|
23
38
|
|
24
|
-
export
|
25
|
-
|
39
|
+
export const useMenuButtonStyles_unstable = state => {
|
40
|
+
const menuIconStyles = useMenuIconStyles();
|
41
|
+
state.root.className = mergeClasses(menuButtonClassNames.root, state.root.className);
|
42
|
+
|
43
|
+
if (state.icon) {
|
44
|
+
state.icon.className = mergeClasses(menuButtonClassNames.icon, state.icon.className);
|
45
|
+
}
|
26
46
|
|
27
47
|
if (state.menuIcon) {
|
28
|
-
state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);
|
48
|
+
state.menuIcon.className = mergeClasses(menuButtonClassNames.menuIcon, menuIconStyles.base, menuIconStyles[state.size], !state.iconOnly && menuIconStyles.notIconOnly, state.menuIcon.className);
|
29
49
|
}
|
30
50
|
|
31
|
-
|
51
|
+
useButtonStyles_unstable({ ...state,
|
52
|
+
iconPosition: 'before'
|
53
|
+
});
|
32
54
|
return state;
|
33
55
|
};
|
34
56
|
//# sourceMappingURL=useMenuButtonStyles.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,gBAAzC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,wBAAT,QAAyC,2BAAzC;AAIA,OAAO,MAAM,oBAAoB,GAAoC;AACnE,EAAA,IAAI,EAAE,gBAD6D;AAEnE,EAAA,IAAI,EAAE,sBAF6D;AAGnE,EAAA,QAAQ,EAAE;AAHyD,CAA9D;;AAMP,MAAM,iBAAiB,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AA+BA,OAAO,MAAM,4BAA4B,GAAI,KAAD,IAA4C;AACtF,QAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAoB,CAAC,IAAtB,EAA4B,KAAK,CAAC,IAAN,CAAW,SAAvC,CAAnC;;AAEA,MAAI,KAAK,CAAC,IAAV,EAAgB;AACd,IAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAoB,CAAC,IAAtB,EAA4B,KAAK,CAAC,IAAN,CAAW,SAAvC,CAAnC;AACD;;AAED,MAAI,KAAK,CAAC,QAAV,EAAoB;AAClB,IAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,YAAY,CACrC,oBAAoB,CAAC,QADgB,EAErC,cAAc,CAAC,IAFsB,EAGrC,cAAc,CAAC,KAAK,CAAC,IAAP,CAHuB,EAIrC,CAAC,KAAK,CAAC,QAAP,IAAmB,cAAc,CAAC,WAJG,EAKrC,KAAK,CAAC,QAAN,CAAe,SALsB,CAAvC;AAOD;;AAED,EAAA,wBAAwB,CAAC,EAAE,GAAG,KAAL;AAAY,IAAA,YAAY,EAAE;AAA1B,GAAD,CAAxB;AAEA,SAAO,KAAP;AACD,CAtBM","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nconst useMenuIconStyles = makeStyles({\n base: {\n lineHeight: 0,\n },\n\n // Size appearance\n small: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n medium: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n large: {\n fontSize: '16px',\n height: '16px',\n lineHeight: tokens.lineHeightBase400,\n width: '16px',\n },\n\n // Not-icon only\n notIconOnly: {\n marginLeft: tokens.spacingHorizontalXS,\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.root.className = mergeClasses(menuButtonClassNames.root, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuButtonClassNames.icon, state.icon.className);\n }\n\n if (state.menuIcon) {\n state.menuIcon.className = mergeClasses(\n menuButtonClassNames.menuIcon,\n menuIconStyles.base,\n menuIconStyles[state.size],\n !state.iconOnly && menuIconStyles.notIconOnly,\n state.menuIcon.className,\n );\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { renderSplitButton_unstable } from './renderSplitButton';
|
3
|
+
import { useSplitButton_unstable } from './useSplitButton';
|
4
|
+
import { useSplitButtonStyles_unstable } from './useSplitButtonStyles';
|
5
5
|
/**
|
6
|
-
* SplitButtons are a grouping of two interactive surfaces where
|
6
|
+
* SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary
|
7
7
|
* action, while interacting with the second one opens a menu with secondary actions.
|
8
8
|
*/
|
9
9
|
|
10
|
-
export
|
11
|
-
|
12
|
-
|
13
|
-
return
|
10
|
+
export const SplitButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
11
|
+
const state = useSplitButton_unstable(props, ref);
|
12
|
+
useSplitButtonStyles_unstable(state);
|
13
|
+
return renderSplitButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
14
14
|
});
|
15
15
|
SplitButton.displayName = 'SplitButton';
|
16
16
|
//# sourceMappingURL=SplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AAIA;;;AAGG;;AACH,OAAO,MAAM,WAAW,gBAA0C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAChG,QAAM,KAAK,GAAG,uBAAuB,CAAC,KAAD,EAAQ,GAAR,CAArC;AAEA,EAAA,6BAA6B,CAAC,KAAD,CAA7B;AAEA,SAAO,0BAA0B,CAAC,KAAD,CAAjC,CALgG,CAMhG;AACD,CAPiE,CAA3D;AASP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { renderSplitButton_unstable } from './renderSplitButton';\nimport { useSplitButton_unstable } from './useSplitButton';\nimport { useSplitButtonStyles_unstable } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton: ForwardRefComponent<SplitButtonProps> = React.forwardRef((props, ref) => {\n const state = useSplitButton_unstable(props, ref);\n\n useSplitButtonStyles_unstable(state);\n\n return renderSplitButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<SplitButtonProps>;\n\nSplitButton.displayName = 'SplitButton';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SplitButton.types.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"SplitButton.types.js","sourceRoot":"../src/","sources":["components/SplitButton/SplitButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';\n\nexport type SplitButtonSlots = {\n /**\n * Root of the component that wraps the primary action button and menu button.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Button that opens menu with secondary actions in SplitButton.\n */\n menuButton?: Slot<typeof MenuButton>;\n /**\n * Button to perform primary action in SplitButton.\n */\n primaryActionButton?: Slot<typeof Button>;\n};\n\nexport type SplitButtonProps = ComponentProps<SplitButtonSlots> &\n Omit<ButtonProps, 'root'> &\n Omit<MenuButtonProps, 'root'>;\n\nexport type SplitButtonState = ComponentState<SplitButtonSlots> &\n Omit<ButtonState, 'components' | 'iconOnly' | 'root'> &\n Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;\n"]}
|
@@ -2,5 +2,5 @@ export * from './SplitButton';
|
|
2
2
|
export * from './SplitButton.types';
|
3
3
|
export * from './renderSplitButton';
|
4
4
|
export * from './useSplitButton';
|
5
|
-
export {
|
5
|
+
export { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';
|
6
6
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/SplitButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles';\n"]}
|
@@ -1,15 +1,17 @@
|
|
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 SplitButton component by passing the state defined props to the appropriate slots.
|
6
5
|
*/
|
7
6
|
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
return /*#__PURE__*/React.createElement(slots.root,
|
7
|
+
export const renderSplitButton_unstable = state => {
|
8
|
+
const {
|
9
|
+
slots,
|
10
|
+
slotProps
|
11
|
+
} = getSlots(state);
|
12
|
+
return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
|
13
|
+
}, slots.primaryActionButton && /*#__PURE__*/React.createElement(slots.primaryActionButton, { ...slotProps.primaryActionButton
|
14
|
+
}), slots.menuButton && /*#__PURE__*/React.createElement(slots.menuButton, { ...slotProps.menuButton
|
15
|
+
}));
|
14
16
|
};
|
15
17
|
//# sourceMappingURL=renderSplitButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAA4B;AACpE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAmB,KAAnB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,mBAAN,iBAA6B,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,mBAAP,EAA0B,EAAA,GAAK,SAAS,CAAC;AAAf,GAA1B,CADhC,EAEG,KAAK,CAAC,UAAN,iBAAoB,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,EAAA,GAAK,SAAS,CAAC;AAAf,GAAjB,CAFvB,CADF;AAMD,CATM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton_unstable = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlots<SplitButtonSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.primaryActionButton && <slots.primaryActionButton {...slotProps.primaryActionButton} />}\n {slots.menuButton && <slots.menuButton {...slotProps.menuButton} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { getNativeElementProps, resolveShorthand } from '@fluentui/react-utilities';
|
1
|
+
import { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';
|
3
2
|
import { Button } from '../Button/Button';
|
4
3
|
import { MenuButton } from '../MenuButton/MenuButton';
|
5
4
|
/**
|
@@ -8,64 +7,70 @@ import { MenuButton } from '../MenuButton/MenuButton';
|
|
8
7
|
* @param ref - User provided ref to be passed to the SplitButton component.
|
9
8
|
*/
|
10
9
|
|
11
|
-
export
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
_f = props.size,
|
28
|
-
size = _f === void 0 ? 'medium' : _f;
|
29
|
-
var menuButtonShorthand = resolveShorthand(menuButton, {
|
10
|
+
export const useSplitButton_unstable = (props, ref) => {
|
11
|
+
const {
|
12
|
+
appearance = 'secondary',
|
13
|
+
children,
|
14
|
+
disabled = false,
|
15
|
+
disabledFocusable = false,
|
16
|
+
icon,
|
17
|
+
iconPosition = 'before',
|
18
|
+
menuButton,
|
19
|
+
menuIcon,
|
20
|
+
primaryActionButton,
|
21
|
+
shape = 'rounded',
|
22
|
+
size = 'medium'
|
23
|
+
} = props;
|
24
|
+
const baseId = useId('splitButton-');
|
25
|
+
const menuButtonShorthand = resolveShorthand(menuButton, {
|
30
26
|
defaultProps: {
|
31
|
-
appearance
|
32
|
-
disabled
|
33
|
-
disabledFocusable
|
34
|
-
|
35
|
-
|
36
|
-
|
27
|
+
appearance,
|
28
|
+
disabled,
|
29
|
+
disabledFocusable,
|
30
|
+
menuIcon,
|
31
|
+
shape,
|
32
|
+
size
|
33
|
+
},
|
34
|
+
required: true
|
37
35
|
});
|
38
|
-
|
36
|
+
const primaryActionButtonShorthand = resolveShorthand(primaryActionButton, {
|
39
37
|
defaultProps: {
|
40
|
-
appearance
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
shape
|
48
|
-
size
|
49
|
-
}
|
50
|
-
|
38
|
+
appearance,
|
39
|
+
children,
|
40
|
+
disabled,
|
41
|
+
disabledFocusable,
|
42
|
+
icon,
|
43
|
+
iconPosition,
|
44
|
+
id: baseId + '__primaryActionButton',
|
45
|
+
shape,
|
46
|
+
size
|
47
|
+
},
|
48
|
+
required: true
|
49
|
+
}); // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided
|
50
|
+
// by the user.
|
51
|
+
|
52
|
+
if (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {
|
53
|
+
menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
|
54
|
+
}
|
55
|
+
|
51
56
|
return {
|
52
57
|
// Props passed at the top-level
|
53
|
-
appearance
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
size: size,
|
58
|
+
appearance,
|
59
|
+
disabled,
|
60
|
+
disabledFocusable,
|
61
|
+
iconPosition,
|
62
|
+
shape,
|
63
|
+
size,
|
60
64
|
// Slots definition
|
61
65
|
components: {
|
62
66
|
root: 'div',
|
63
67
|
menuButton: MenuButton,
|
64
68
|
primaryActionButton: Button
|
65
69
|
},
|
66
|
-
root: getNativeElementProps('div',
|
67
|
-
ref
|
68
|
-
|
70
|
+
root: getNativeElementProps('div', {
|
71
|
+
ref,
|
72
|
+
...props
|
73
|
+
}),
|
69
74
|
menuButton: menuButtonShorthand,
|
70
75
|
primaryActionButton: primaryActionButtonShorthand
|
71
76
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,KAAlD,QAA+D,2BAA/D;AACA,SAAS,MAAT,QAAuB,kBAAvB;AACA,SAAS,UAAT,QAA2B,0BAA3B;AAGA;;;;AAIG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CACrC,KADqC,EAErC,GAFqC,KAGjB;AACpB,QAAM;AACJ,IAAA,UAAU,GAAG,WADT;AAEJ,IAAA,QAFI;AAGJ,IAAA,QAAQ,GAAG,KAHP;AAIJ,IAAA,iBAAiB,GAAG,KAJhB;AAKJ,IAAA,IALI;AAMJ,IAAA,YAAY,GAAG,QANX;AAOJ,IAAA,UAPI;AAQJ,IAAA,QARI;AASJ,IAAA,mBATI;AAUJ,IAAA,KAAK,GAAG,SAVJ;AAWJ,IAAA,IAAI,GAAG;AAXH,MAYF,KAZJ;AAcA,QAAM,MAAM,GAAG,KAAK,CAAC,cAAD,CAApB;AAEA,QAAM,mBAAmB,GAAG,gBAAgB,CAAC,UAAD,EAAa;AACvD,IAAA,YAAY,EAAE;AACZ,MAAA,UADY;AAEZ,MAAA,QAFY;AAGZ,MAAA,iBAHY;AAIZ,MAAA,QAJY;AAKZ,MAAA,KALY;AAMZ,MAAA;AANY,KADyC;AASvD,IAAA,QAAQ,EAAE;AAT6C,GAAb,CAA5C;AAYA,QAAM,4BAA4B,GAAG,gBAAgB,CAAC,mBAAD,EAAsB;AACzE,IAAA,YAAY,EAAE;AACZ,MAAA,UADY;AAEZ,MAAA,QAFY;AAGZ,MAAA,QAHY;AAIZ,MAAA,iBAJY;AAKZ,MAAA,IALY;AAMZ,MAAA,YANY;AAOZ,MAAA,EAAE,EAAE,MAAM,GAAG,uBAPD;AAQZ,MAAA,KARY;AASZ,MAAA;AATY,KAD2D;AAYzE,IAAA,QAAQ,EAAE;AAZ+D,GAAtB,CAArD,CA7BoB,CA4CpB;AACA;;AACA,MACE,mBAAmB,IACnB,4BADA,IAEA,CAAC,mBAAmB,CAAC,YAAD,CAFpB,IAGA,CAAC,mBAAmB,CAAC,iBAAD,CAJtB,EAKE;AACA,IAAA,mBAAmB,CAAC,iBAAD,CAAnB,GAAyC,4BAA4B,CAAC,EAAtE;AACD;;AAED,SAAO;AACL;AACA,IAAA,UAFK;AAGL,IAAA,QAHK;AAIL,IAAA,iBAJK;AAKL,IAAA,YALK;AAML,IAAA,KANK;AAOL,IAAA,IAPK;AASL;AACA,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE,KADI;AAEV,MAAA,UAAU,EAAE,UAFF;AAGV,MAAA,mBAAmB,EAAE;AAHX,KAVP;AAgBL,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;AAAE,MAAA,GAAF;AAAO,SAAG;AAAV,KAAR,CAhBtB;AAiBL,IAAA,UAAU,EAAE,mBAjBP;AAkBL,IAAA,mBAAmB,EAAE;AAlBhB,GAAP;AAoBD,CA9EM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { SplitButtonProps, SplitButtonState } from './SplitButton.types';\n\n/**\n * Given user props, defines default props for the SplitButton and returns processed state.\n * @param props - User provided props to the SplitButton component.\n * @param ref - User provided ref to be passed to the SplitButton component.\n */\nexport const useSplitButton_unstable = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): SplitButtonState => {\n const {\n appearance = 'secondary',\n children,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n menuButton,\n menuIcon,\n primaryActionButton,\n shape = 'rounded',\n size = 'medium',\n } = props;\n\n const baseId = useId('splitButton-');\n\n const menuButtonShorthand = resolveShorthand(menuButton, {\n defaultProps: {\n appearance,\n disabled,\n disabledFocusable,\n menuIcon,\n shape,\n size,\n },\n required: true,\n });\n\n const primaryActionButtonShorthand = resolveShorthand(primaryActionButton, {\n defaultProps: {\n appearance,\n children,\n disabled,\n disabledFocusable,\n icon,\n iconPosition,\n id: baseId + '__primaryActionButton',\n shape,\n size,\n },\n required: true,\n });\n\n // Resolve menu button's aria-labelledby to be labelled by the primary action button if not a label was not provided\n // by the user.\n if (\n menuButtonShorthand &&\n primaryActionButtonShorthand &&\n !menuButtonShorthand['aria-label'] &&\n !menuButtonShorthand['aria-labelledby']\n ) {\n menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;\n }\n\n return {\n // Props passed at the top-level\n appearance,\n disabled,\n disabledFocusable,\n iconPosition,\n shape,\n size,\n\n // Slots definition\n components: {\n root: 'div',\n menuButton: MenuButton,\n primaryActionButton: Button,\n },\n\n root: getNativeElementProps('div', { ref, ...props }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,11 +1,13 @@
|
|
1
|
-
import { __styles, mergeClasses } from '@
|
1
|
+
import { __styles, mergeClasses } from '@griffel/react';
|
2
2
|
import { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
import { tokens } from '@fluentui/react-theme';
|
4
|
+
export const splitButtonClassNames = {
|
5
|
+
root: 'fui-SplitButton',
|
6
|
+
menuButton: 'fui-SplitButton__menuButton',
|
7
|
+
primaryActionButton: 'fui-SplitButton__primaryActionButton'
|
6
8
|
};
|
7
9
|
|
8
|
-
|
10
|
+
const useFocusStyles = /*#__PURE__*/__styles({
|
9
11
|
"primaryActionButton": {
|
10
12
|
"B486eqv": "f2hkw1w",
|
11
13
|
"Bmrpcm6": ["fub8a6s", "f1g41uvt"],
|
@@ -22,66 +24,71 @@ var useFocusStyles = /*#__PURE__*/__styles({
|
|
22
24
|
"d": ["[data-keyboard-nav] .fub8a6s:focus{border-top-right-radius:0;}", "[data-keyboard-nav] .f1g41uvt:focus{border-top-left-radius:0;}", "[data-keyboard-nav] .f58hr3h:focus{border-bottom-right-radius:0;}", "[data-keyboard-nav] .f1u1mnrj:focus{border-bottom-left-radius:0;}", "[data-keyboard-nav] .fy9hclh:focus{border-left-width:0;}", "[data-keyboard-nav] .f549e1y:focus{border-right-width:0;}"]
|
23
25
|
});
|
24
26
|
|
25
|
-
|
27
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
26
28
|
"base": {
|
27
29
|
"mc9l5x": "ftuwxu6",
|
28
30
|
"Brf1p80": "fsxf2b5",
|
29
31
|
"qhf8xq": "f10pi13n",
|
30
32
|
"ha4doy": "fmrv4ls",
|
31
|
-
"
|
32
|
-
"
|
33
|
-
"
|
34
|
-
"
|
35
|
-
"
|
36
|
-
|
37
|
-
"block": {
|
38
|
-
"a9b677": "fly5x3f"
|
33
|
+
"kn2xc0": ["f14uur2j", "fc1btbj"],
|
34
|
+
"Bs76p8a": ["fye5tvs", "fc597qq"],
|
35
|
+
"cuxpm9": ["f1e8brtx", "fr36rk3"],
|
36
|
+
"Biffepf": ["fxp12j1", "f1m6nt2y"],
|
37
|
+
"Defnvf": ["fr7y8no", "f1dn0c6m"],
|
38
|
+
"z0pv9t": "f1hvqvul"
|
39
39
|
},
|
40
40
|
"outline": {},
|
41
41
|
"primary": {
|
42
|
-
"
|
43
|
-
"
|
44
|
-
"
|
42
|
+
"B1l9wao": ["f12j1tfo", "f1ufkr8r"],
|
43
|
+
"lcnrd8": ["f17lyyco", "f151o42i"],
|
44
|
+
"Brbpp8k": ["f1nb07eg", "fg8a8qi"]
|
45
45
|
},
|
46
|
+
"secondary": {},
|
46
47
|
"subtle": {
|
47
|
-
"
|
48
|
-
"
|
49
|
-
"
|
48
|
+
"B1l9wao": ["f1ysqkm5", "f10nbrj"],
|
49
|
+
"lcnrd8": ["fn44ryq", "fwhhltr"],
|
50
|
+
"Brbpp8k": ["fg8lp5p", "f1p6hj0a"]
|
50
51
|
},
|
51
52
|
"transparent": {
|
52
|
-
"
|
53
|
-
"
|
54
|
-
"
|
53
|
+
"B1l9wao": ["f1ysqkm5", "f10nbrj"],
|
54
|
+
"lcnrd8": ["fn44ryq", "fwhhltr"],
|
55
|
+
"Brbpp8k": ["fg8lp5p", "f1p6hj0a"]
|
55
56
|
},
|
56
57
|
"circular": {},
|
57
58
|
"rounded": {},
|
58
59
|
"square": {},
|
59
60
|
"disabled": {
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
61
|
+
"B1l9wao": ["f10xrnr8", "f15nylwb"],
|
62
|
+
"lcnrd8": ["f11fwhjz", "f18vtcsx"],
|
63
|
+
"Brbpp8k": ["f31btwb", "fzgm9gq"]
|
64
|
+
},
|
65
|
+
"disabledHighContrast": {
|
66
|
+
"Bcsxniv": ["fj2q5vi", "f13tct40"],
|
67
|
+
"tl7e51": ["fb2mzc7", "f179dhpp"],
|
68
|
+
"mba178": ["f1ma39qa", "f1nzpdru"]
|
63
69
|
}
|
64
70
|
}, {
|
65
|
-
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fsxf2b5{-webkit-box-pack:stretch;-ms-flex-pack:stretch;-webkit-justify-content:stretch;justify-content:stretch;}", ".f10pi13n{position:relative;}", ".fmrv4ls{vertical-align:middle;}", ".
|
66
|
-
"h": [".
|
67
|
-
"
|
71
|
+
"d": [".ftuwxu6{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;}", ".fsxf2b5{-webkit-box-pack:stretch;-ms-flex-pack:stretch;-webkit-justify-content:stretch;justify-content:stretch;}", ".f10pi13n{position:relative;}", ".fmrv4ls{vertical-align:middle;}", ".f14uur2j .fui-SplitButton__primaryActionButton{border-top-right-radius:0;}", ".fc1btbj .fui-SplitButton__primaryActionButton{border-top-left-radius:0;}", ".fye5tvs .fui-SplitButton__primaryActionButton{border-bottom-right-radius:0;}", ".fc597qq .fui-SplitButton__primaryActionButton{border-bottom-left-radius:0;}", ".f1e8brtx .fui-SplitButton__menuButton{border-left-width:0;}", ".fr36rk3 .fui-SplitButton__menuButton{border-right-width:0;}", ".fxp12j1 .fui-SplitButton__menuButton{border-top-left-radius:0;}", ".f1m6nt2y .fui-SplitButton__menuButton{border-top-right-radius:0;}", ".fr7y8no .fui-SplitButton__menuButton{border-bottom-left-radius:0;}", ".f1dn0c6m .fui-SplitButton__menuButton{border-bottom-right-radius:0;}", ".f1hvqvul .fui-SplitButton__menuButton{min-width:0;}", ".f12j1tfo .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".f1ufkr8r .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".f1ysqkm5 .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".f10nbrj .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".f10xrnr8 .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f15nylwb .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}"],
|
72
|
+
"h": [".f17lyyco:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".f151o42i:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".f1nb07eg:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralForegroundInverted);}", ".fg8a8qi:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralForegroundInverted);}", ".fn44ryq:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".fwhhltr:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".fg8lp5p:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStroke1Hover);}", ".f1p6hj0a:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStroke1Hover);}", ".f11fwhjz:hover .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".f18vtcsx:hover .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}", ".f31btwb:hover:active .fui-SplitButton__primaryActionButton{border-right-color:var(--colorNeutralStrokeDisabled);}", ".fzgm9gq:hover:active .fui-SplitButton__primaryActionButton{border-left-color:var(--colorNeutralStrokeDisabled);}"],
|
73
|
+
"t": ["@media (forced-colors: active){.fj2q5vi .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f13tct40 .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}", "@media (forced-colors: active){.fb2mzc7:hover .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f179dhpp:hover .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}", "@media (forced-colors: active){.f1ma39qa:hover:active .fui-SplitButton__primaryActionButton{border-right-color:GrayText;}.f1nzpdru:hover:active .fui-SplitButton__primaryActionButton{border-left-color:GrayText;}}"]
|
68
74
|
});
|
69
75
|
|
70
|
-
export
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
export const useSplitButtonStyles_unstable = state => {
|
77
|
+
const rootStyles = useRootStyles();
|
78
|
+
const focusStyles = useFocusStyles();
|
79
|
+
const {
|
80
|
+
appearance,
|
81
|
+
disabled,
|
82
|
+
disabledFocusable
|
83
|
+
} = state;
|
84
|
+
state.root.className = mergeClasses(splitButtonClassNames.root, rootStyles.base, appearance && rootStyles[appearance], (disabled || disabledFocusable) && rootStyles.disabled, (disabled || disabledFocusable) && rootStyles.disabledHighContrast, state.root.className);
|
78
85
|
|
79
86
|
if (state.menuButton) {
|
80
|
-
state.menuButton.className = mergeClasses(
|
87
|
+
state.menuButton.className = mergeClasses(splitButtonClassNames.menuButton, focusStyles.menuButton, state.menuButton.className);
|
81
88
|
}
|
82
89
|
|
83
90
|
if (state.primaryActionButton) {
|
84
|
-
state.primaryActionButton.className = mergeClasses(
|
91
|
+
state.primaryActionButton.className = mergeClasses(splitButtonClassNames.primaryActionButton, focusStyles.primaryActionButton, state.primaryActionButton.className);
|
85
92
|
}
|
86
93
|
|
87
94
|
return state;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,+BAAT,QAAgD,yBAAhD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAIA,OAAO,MAAM,qBAAqB,GAAqC;AACrE,EAAA,IAAI,EAAE,iBAD+D;AAErE,EAAA,UAAU,EAAE,6BAFyD;AAGrE,EAAA,mBAAmB,EAAE;AAHgD,CAAhE;;AAMP,MAAM,cAAc,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAvB;;AAaA,MAAM,aAAa,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAtB;;AA8HA,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA8C;AACzF,QAAM,UAAU,GAAG,aAAa,EAAhC;AACA,QAAM,WAAW,GAAG,cAAc,EAAlC;AAEA,QAAM;AAAE,IAAA,UAAF;AAAc,IAAA,QAAd;AAAwB,IAAA;AAAxB,MAA8C,KAApD;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,qBAAqB,CAAC,IADW,EAEjC,UAAU,CAAC,IAFsB,EAGjC,UAAU,IAAI,UAAU,CAAC,UAAD,CAHS,EAIjC,CAAC,QAAQ,IAAI,iBAAb,KAAmC,UAAU,CAAC,QAJb,EAKjC,CAAC,QAAQ,IAAI,iBAAb,KAAmC,UAAU,CAAC,oBALb,EAMjC,KAAK,CAAC,IAAN,CAAW,SANsB,CAAnC;;AASA,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,IAAA,KAAK,CAAC,UAAN,CAAiB,SAAjB,GAA6B,YAAY,CACvC,qBAAqB,CAAC,UADiB,EAEvC,WAAW,CAAC,UAF2B,EAGvC,KAAK,CAAC,UAAN,CAAiB,SAHsB,CAAzC;AAKD;;AAED,MAAI,KAAK,CAAC,mBAAV,EAA+B;AAC7B,IAAA,KAAK,CAAC,mBAAN,CAA0B,SAA1B,GAAsC,YAAY,CAChD,qBAAqB,CAAC,mBAD0B,EAEhD,WAAW,CAAC,mBAFoC,EAGhD,KAAK,CAAC,mBAAN,CAA0B,SAHsB,CAAlD;AAKD;;AAED,SAAO,KAAP;AACD,CAhCM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\nconst useFocusStyles = makeStyles({\n primaryActionButton: createCustomFocusIndicatorStyle({\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n }),\n\n menuButton: createCustomFocusIndicatorStyle({\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }),\n});\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n [`& .${splitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n minWidth: 0,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralForegroundInverted,\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStroke1Hover,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled styles\n disabled: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n\n ':hover:active': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, disabled, disabledFocusable } = state;\n\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n state.root.className,\n );\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(\n splitButtonClassNames.menuButton,\n focusStyles.menuButton,\n state.menuButton.className,\n );\n }\n\n if (state.primaryActionButton) {\n state.primaryActionButton.className = mergeClasses(\n splitButtonClassNames.primaryActionButton,\n focusStyles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { renderToggleButton_unstable } from './renderToggleButton';
|
3
|
+
import { useToggleButton_unstable } from './useToggleButton';
|
4
|
+
import { useToggleButtonStyles_unstable } from './useToggleButtonStyles';
|
5
5
|
/**
|
6
6
|
* ToggleButtons are buttons that toggle between two defined states when triggered.
|
7
7
|
*/
|
8
8
|
|
9
|
-
export
|
10
|
-
|
11
|
-
|
12
|
-
return
|
9
|
+
export const ToggleButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
10
|
+
const state = useToggleButton_unstable(props, ref);
|
11
|
+
useToggleButtonStyles_unstable(state);
|
12
|
+
return renderToggleButton_unstable(state); // Casting is required due to lack of distributive union to support unions on @types/react
|
13
13
|
});
|
14
14
|
ToggleButton.displayName = 'ToggleButton';
|
15
15
|
//# sourceMappingURL=ToggleButton.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["
|
1
|
+
{"version":3,"sources":["components/ToggleButton/ToggleButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,2BAAT,QAA4C,sBAA5C;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AACA,SAAS,8BAAT,QAA+C,yBAA/C;AAIA;;AAEG;;AACH,OAAO,MAAM,YAAY,gBAA2C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAClG,QAAM,KAAK,GAAG,wBAAwB,CAAC,KAAD,EAAQ,GAAR,CAAtC;AAEA,EAAA,8BAA8B,CAAC,KAAD,CAA9B;AAEA,SAAO,2BAA2B,CAAC,KAAD,CAAlC,CALkG,CAMlG;AACD,CAPmE,CAA7D;AASP,YAAY,CAAC,WAAb,GAA2B,cAA3B","sourcesContent":["import * as React from 'react';\nimport { renderToggleButton_unstable } from './renderToggleButton';\nimport { useToggleButton_unstable } from './useToggleButton';\nimport { useToggleButtonStyles_unstable } from './useToggleButtonStyles';\nimport type { ToggleButtonProps } from './ToggleButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * ToggleButtons are buttons that toggle between two defined states when triggered.\n */\nexport const ToggleButton: ForwardRefComponent<ToggleButtonProps> = React.forwardRef((props, ref) => {\n const state = useToggleButton_unstable(props, ref);\n\n useToggleButtonStyles_unstable(state);\n\n return renderToggleButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ToggleButtonProps>;\n\nToggleButton.displayName = 'ToggleButton';\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ToggleButton.types.js","sourceRoot":"","sources":["
|
1
|
+
{"version":3,"file":"ToggleButton.types.js","sourceRoot":"../src/","sources":["components/ToggleButton/ToggleButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonProps, ButtonState } from '../Button/Button.types';\n\nexport type ToggleButtonProps = ButtonProps & {\n /**\n * Defines whether the `ToggleButton` is initially in a checked state or not when rendered.\n *\n * @default false\n */\n defaultChecked?: boolean;\n\n /**\n * Defines the controlled checked state of the `ToggleButton`.\n * If passed, `ToggleButton` ignores the `defaultChecked` property.\n * This should only be used if the checked state is to be controlled at a higher level and there is a plan to pass the\n * correct value based on handling `onClick` events and re-rendering.\n *\n * @default false\n */\n checked?: boolean;\n};\n\nexport type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;\n"]}
|