@fluentui/react-button 9.0.0-alpha.84 → 9.0.0-alpha.88
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +87 -1
- package/CHANGELOG.md +41 -2
- package/dist/react-button.d.ts +73 -7
- package/lib/SplitButton.d.ts +1 -0
- package/lib/SplitButton.js +2 -0
- package/lib/SplitButton.js.map +1 -0
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.d.ts +3 -1
- package/lib/components/Button/useButton.js +3 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonState.d.ts +2 -2
- package/lib/components/Button/useButtonState.js +2 -2
- package/lib/components/Button/useButtonState.js.map +1 -1
- package/lib/components/Button/useButtonStyles.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.d.ts +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +2 -1
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib/components/MenuButton/useMenuButton.js +3 -3
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib/components/SplitButton/SplitButton.js +25 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib/components/SplitButton/SplitButton.types.js +2 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib/components/SplitButton/index.d.ts +5 -0
- package/lib/components/SplitButton/index.js +6 -0
- package/lib/components/SplitButton/index.js.map +1 -0
- package/lib/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib/components/SplitButton/renderSplitButton.js +16 -0
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib/components/SplitButton/useSplitButton.js +72 -0
- package/lib/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js +61 -0
- package/lib/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib/components/ToggleButton/useToggleButton.js +4 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib-amd/SplitButton.d.ts +1 -0
- package/lib-amd/SplitButton.js +6 -0
- package/lib-amd/SplitButton.js.map +1 -0
- package/lib-amd/components/Button/renderButton.js.map +1 -1
- package/lib-amd/components/Button/useButton.d.ts +3 -1
- package/lib-amd/components/Button/useButton.js +3 -1
- package/lib-amd/components/Button/useButton.js.map +1 -1
- package/lib-amd/components/Button/useButtonState.d.ts +2 -2
- package/lib-amd/components/Button/useButtonState.js +2 -2
- package/lib-amd/components/Button/useButtonState.js.map +1 -1
- package/lib-amd/components/Button/useButtonStyles.js +1 -0
- package/lib-amd/components/Button/useButtonStyles.js.map +1 -1
- package/lib-amd/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-amd/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-amd/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-amd/components/MenuButton/MenuButton.types.d.ts +1 -1
- package/lib-amd/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-amd/components/MenuButton/renderMenuButton.js +2 -2
- package/lib-amd/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-amd/components/MenuButton/useMenuButton.js +3 -3
- package/lib-amd/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-amd/components/MenuButton/useMenuButtonState.js +7 -1
- package/lib-amd/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-amd/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-amd/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-amd/components/SplitButton/SplitButton.js +19 -0
- package/lib-amd/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js +5 -0
- package/lib-amd/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-amd/components/SplitButton/index.d.ts +5 -0
- package/lib-amd/components/SplitButton/index.js +11 -0
- package/lib-amd/components/SplitButton/index.js.map +1 -0
- package/lib-amd/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js +16 -0
- package/lib-amd/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-amd/components/SplitButton/useSplitButton.js +55 -0
- package/lib-amd/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js +123 -0
- package/lib-amd/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-amd/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-amd/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-amd/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-amd/index.d.ts +1 -0
- package/lib-amd/index.js +2 -1
- package/lib-amd/index.js.map +1 -1
- package/lib-commonjs/SplitButton.d.ts +1 -0
- package/lib-commonjs/SplitButton.js +10 -0
- package/lib-commonjs/SplitButton.js.map +1 -0
- package/lib-commonjs/components/Button/renderButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.d.ts +3 -1
- package/lib-commonjs/components/Button/useButton.js +3 -1
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonState.d.ts +2 -2
- package/lib-commonjs/components/Button/useButtonState.js +2 -2
- package/lib-commonjs/components/Button/useButtonState.js.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.d.ts +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.d.ts +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js +2 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.d.ts +3 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.d.ts +5 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js +9 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonState.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.d.ts +7 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js +38 -0
- package/lib-commonjs/components/SplitButton/SplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.d.ts +30 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js +6 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -0
- package/lib-commonjs/components/SplitButton/index.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/index.js +26 -0
- package/lib-commonjs/components/SplitButton/index.js.map +1 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.d.ts +5 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js +29 -0
- package/lib-commonjs/components/SplitButton/renderSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.d.ts +9 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js +83 -0
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.d.ts +2 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js +71 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.js.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButton.d.ts +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +4 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.js.map +1 -1
- package/lib-commonjs/index.d.ts +1 -0
- package/lib-commonjs/index.js +2 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -10
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/renderMenuButton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AA,EAAK,SAAS,CAAC,IAAf,CAAX,CADF,EAEG,CAAC,QAAD,IAAa,QAFhB,EAGG,CAAC,CAAC,QAAD,IAAa,CAAC,IAAI,CAAC,QAApB,KAAiC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,QAAf,CAAf,CAHpC,CADF;AAOD,CAXM;;AAAM,OAAA,CAAA,gBAAA,GAAgB,gBAAhB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { menuButtonShorthandPropsCompat } from './useMenuButton';\nimport type { 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 = (state: MenuButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, menuButtonShorthandPropsCompat);\n const { children, icon, iconOnly } = state;\n\n return (\n <slots.root {...slotProps.root}>\n <slots.icon {...slotProps.icon} />\n {!iconOnly && children}\n {(!iconOnly || !icon.children) && <slots.menuIcon {...slotProps.menuIcon} />}\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -5,6 +5,8 @@ import type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState }
|
|
5
5
|
*/
|
6
6
|
export declare const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[];
|
7
7
|
/**
|
8
|
-
* Given user props,
|
8
|
+
* Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
|
9
|
+
* @param props - User provided props to the MenuButton component.
|
10
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
9
11
|
*/
|
10
12
|
export declare const useMenuButton: (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps | undefined) => MenuButtonState;
|
@@ -18,12 +18,12 @@ var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
|
18
18
|
deepMerge: exports.menuButtonShorthandPropsCompat
|
19
19
|
});
|
20
20
|
/**
|
21
|
-
* Given user props,
|
21
|
+
* Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.
|
22
|
+
* @param props - User provided props to the MenuButton component.
|
23
|
+
* @param ref - User provided ref to be passed to the MenuButton component.
|
22
24
|
*/
|
23
25
|
|
24
26
|
var useMenuButton = function (props, ref, defaultProps) {
|
25
|
-
// Note: because menu button's template and slots are different, we can't reuse
|
26
|
-
// those, but the useMenuButtonState hook can reuse useButtonState.
|
27
27
|
var state = mergeProps({
|
28
28
|
ref: ref,
|
29
29
|
as: 'button',
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,8BAAA,GAAmE,CAAC,MAAD,EAAS,UAAT,CAAnE;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAgC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAhC,CAAnB;AAEA;;
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,oBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,8BAAA,GAAmE,CAAC,MAAD,EAAS,UAAT,CAAnE;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAgC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAhC,CAAnB;AAEA;;;;AAIG;;AACI,IAAM,aAAa,GAAG,UAAC,KAAD,EAAyB,GAAzB,EAAsD,YAAtD,EAAoF;AAC/G,MAAM,KAAK,GAAG,UAAU,CACtB;AACE,IAAA,GAAG,EAAA,GADL;AAEE,IAAA,EAAE,EAAE,QAFN;AAGE;AACA,IAAA,IAAI,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KAJR;AAKE;AACA,IAAA,QAAQ,EAAE;AAAE,MAAA,EAAE,EAAE;AAAN,KANZ;AAOE;AACA,IAAA,IAAI,EAAE,QARR;AASE,IAAA,IAAI,EAAE;AATR,GADsB,EAYtB,YAAY,IAAI,iBAAA,CAAA,qBAAA,CAAsB,YAAtB,EAAoC,OAAA,CAAA,8BAApC,CAZM,EAatB,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,8BAA7B,CAbsB,CAAxB;AAgBA,EAAA,oBAAA,CAAA,kBAAA,CAAmB,KAAnB;AAEA,SAAO,KAAP;AACD,CApBM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport { useMenuButtonState } from './useMenuButtonState';\nimport type { MenuButtonProps, MenuButtonShorthandPropsCompat, MenuButtonState } from './MenuButton.types';\n\n/**\n * Consts listing which props are shorthand props.\n */\nexport const menuButtonShorthandPropsCompat: MenuButtonShorthandPropsCompat[] = ['icon', 'menuIcon'];\n\nconst mergeProps = makeMergeProps<MenuButtonState>({ deepMerge: menuButtonShorthandPropsCompat });\n\n/**\n * Given user props, defines default props for the MenuButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the MenuButton component.\n * @param ref - User provided ref to be passed to the MenuButton component.\n */\nexport const useMenuButton = (props: MenuButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: MenuButtonProps) => {\n const state = mergeProps(\n {\n ref,\n as: 'button',\n // Button slots\n icon: { as: 'span' },\n // MenuButton slots\n menuIcon: { as: 'span' },\n // Non-slot props\n size: 'medium',\n type: 'button', // This is added because the default for type is 'submit'\n },\n defaultProps && resolveShorthandProps(defaultProps, menuButtonShorthandPropsCompat),\n resolveShorthandProps(props, menuButtonShorthandPropsCompat),\n );\n\n useMenuButtonState(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,2 +1,7 @@
|
|
1
1
|
import type { MenuButtonState } from './MenuButton.types';
|
2
|
+
/**
|
3
|
+
* The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
|
4
|
+
* additional MenuButton specific processing.
|
5
|
+
* @param state - MenuButtonButton state to mutate.
|
6
|
+
*/
|
2
7
|
export declare const useMenuButtonState: (state: MenuButtonState) => MenuButtonState;
|
@@ -10,12 +10,20 @@ var React = /*#__PURE__*/require("react");
|
|
10
10
|
var react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
|
11
11
|
|
12
12
|
var useButtonState_1 = /*#__PURE__*/require("../Button/useButtonState");
|
13
|
+
/**
|
14
|
+
* The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any
|
15
|
+
* additional MenuButton specific processing.
|
16
|
+
* @param state - MenuButtonButton state to mutate.
|
17
|
+
*/
|
18
|
+
|
13
19
|
|
14
20
|
var useMenuButtonState = function (state) {
|
15
21
|
// It behaves like a button.
|
16
22
|
useButtonState_1.useButtonState(state);
|
17
|
-
var
|
23
|
+
var children = state.children,
|
24
|
+
menuIcon = state.menuIcon,
|
18
25
|
size = state.size;
|
26
|
+
state.iconOnly = !children;
|
19
27
|
|
20
28
|
if (!menuIcon.children) {
|
21
29
|
if (size === 'large') {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonState.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;AAGA;;;;AAIG;;;AACI,IAAM,kBAAkB,GAAG,UAAC,KAAD,EAAuB;AACvD;AACA,EAAA,gBAAA,CAAA,cAAA,CAAe,KAAf;AAEQ,MAAA,QAAQ,GAAqB,KAAK,CAA1B,QAAR;AAAA,MAAU,QAAQ,GAAW,KAAK,CAAhB,QAAlB;AAAA,MAAoB,IAAI,GAAK,KAAK,CAAV,IAAxB;AACR,EAAA,KAAK,CAAC,QAAN,GAAiB,CAAC,QAAlB;;AACA,MAAI,CAAC,QAAQ,CAAC,QAAd,EAAwB;AACtB,QAAI,IAAI,KAAK,OAAb,EAAsB;AACpB,MAAA,QAAQ,CAAC,QAAT,GAAoB,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,oBAAD,EAAqB,IAArB,CAApB;AACD,KAFD,MAEO;AACL,MAAA,QAAQ,CAAC,QAAT,GAAoB,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,oBAAD,EAAqB,IAArB,CAApB;AACD;AACF;;AAED,SAAO,KAAP;AACD,CAfM;;AAAM,OAAA,CAAA,kBAAA,GAAkB,kBAAlB","sourcesContent":["import * as React from 'react';\nimport { ChevronDown20Regular, ChevronDown24Regular } from '@fluentui/react-icons';\nimport { useButtonState } from '../Button/useButtonState';\nimport type { MenuButtonState } from './MenuButton.types';\n\n/**\n * The useMenuButtonState hook processes the MenuButton state, first calling useButtonState, and then adding any\n * additional MenuButton specific processing.\n * @param state - MenuButtonButton state to mutate.\n */\nexport const useMenuButtonState = (state: MenuButtonState): MenuButtonState => {\n // It behaves like a button.\n useButtonState(state);\n\n const { children, menuIcon, size } = state;\n state.iconOnly = !children;\n if (!menuIcon.children) {\n if (size === 'large') {\n menuIcon.children = <ChevronDown24Regular />;\n } else {\n menuIcon.children = <ChevronDown20Regular />;\n }\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,cAAc,CAAC,KAAK,CAAC,IAAP,CAA3B,EAAyC,KAAK,CAAC,QAAN,CAAe,SAAxD,CAA3B;AAEA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["components/MenuButton/useMenuButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,iBAAiB,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAA1B;;AAkBO,IAAM,mBAAmB,GAAG,UAAC,KAAD,EAAuB;AACxD,MAAM,cAAc,GAAG,iBAAiB,EAAxC;AAEA,EAAA,KAAK,CAAC,QAAN,CAAe,SAAf,GAA2B,mBAAA,CAAA,YAAA,CAAa,cAAc,CAAC,KAAK,CAAC,IAAP,CAA3B,EAAyC,KAAK,CAAC,QAAN,CAAe,SAAxD,CAA3B;AAEA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CARM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { MenuButtonState } from './MenuButton.types';\n\nconst useMenuIconStyles = makeStyles({\n small: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n medium: {\n fontSize: '20px',\n height: '20px',\n width: '20px',\n },\n large: {\n fontSize: '24px',\n height: '24px',\n width: '24px',\n },\n});\n\nexport const useMenuButtonStyles = (state: MenuButtonState): MenuButtonState => {\n const menuIconStyles = useMenuIconStyles();\n\n state.menuIcon.className = mergeClasses(menuIconStyles[state.size], state.menuIcon.className);\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { SplitButtonProps } from './SplitButton.types';
|
3
|
+
/**
|
4
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
5
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
6
|
+
*/
|
7
|
+
export declare const SplitButton: React.ForwardRefExoticComponent<SplitButtonProps & React.RefAttributes<HTMLElement>>;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.SplitButton = void 0;
|
7
|
+
|
8
|
+
var React = /*#__PURE__*/require("react");
|
9
|
+
|
10
|
+
var index_1 = /*#__PURE__*/require("../Button/index");
|
11
|
+
|
12
|
+
var index_2 = /*#__PURE__*/require("../MenuButton/index");
|
13
|
+
|
14
|
+
var renderSplitButton_1 = /*#__PURE__*/require("./renderSplitButton");
|
15
|
+
|
16
|
+
var useSplitButton_1 = /*#__PURE__*/require("./useSplitButton");
|
17
|
+
|
18
|
+
var useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
19
|
+
/**
|
20
|
+
* SplitButtons are a grouping of two interactive surfaces where the interacting with the first one triggers a primary
|
21
|
+
* action, while interacting with the second one opens a menu with secondary actions.
|
22
|
+
*/
|
23
|
+
|
24
|
+
|
25
|
+
exports.SplitButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
26
|
+
var state = useSplitButton_1.useSplitButton(props, ref, {
|
27
|
+
button: {
|
28
|
+
as: index_1.Button
|
29
|
+
},
|
30
|
+
menuButton: {
|
31
|
+
as: index_2.MenuButton
|
32
|
+
}
|
33
|
+
});
|
34
|
+
useSplitButtonStyles_1.useSplitButtonStyles(state);
|
35
|
+
return renderSplitButton_1.renderSplitButton(state);
|
36
|
+
});
|
37
|
+
exports.SplitButton.displayName = 'SplitButton';
|
38
|
+
//# sourceMappingURL=SplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/SplitButton.tsx"],"names":[],"mappings":";;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,IAAA,OAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;;AACA,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;;AAGG;;;AACU,OAAA,CAAA,WAAA,gBAAc,KAAK,CAAC,UAAN,CAAgD,UAAC,KAAD,EAAQ,GAAR,EAAW;AACpF,MAAM,KAAK,GAAG,gBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,GAAtB,EAA2B;AACvC,IAAA,MAAM,EAAE;AAAE,MAAA,EAAE,EAAE,OAAA,CAAA;AAAN,KAD+B;AAEvC,IAAA,UAAU,EAAE;AAAE,MAAA,EAAE,EAAE,OAAA,CAAA;AAAN;AAF2B,GAA3B,CAAd;AAKA,EAAA,sBAAA,CAAA,oBAAA,CAAqB,KAArB;AAEA,SAAO,mBAAA,CAAA,iBAAA,CAAkB,KAAlB,CAAP;AACD,CAT0B,CAAd;AAWb,OAAA,CAAA,WAAA,CAAY,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { Button } from '../Button/index';\nimport { MenuButton } from '../MenuButton/index';\nimport { renderSplitButton } from './renderSplitButton';\nimport { useSplitButton } from './useSplitButton';\nimport { useSplitButtonStyles } from './useSplitButtonStyles';\nimport type { SplitButtonProps } from './SplitButton.types';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where the 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 = React.forwardRef<HTMLElement, SplitButtonProps>((props, ref) => {\n const state = useSplitButton(props, ref, {\n button: { as: Button },\n menuButton: { as: MenuButton },\n });\n\n useSplitButtonStyles(state);\n\n return renderSplitButton(state);\n});\n\nSplitButton.displayName = 'SplitButton';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { ComponentStateCompat, ShorthandPropsCompat } from '@fluentui/react-utilities';
|
3
|
+
import type { ButtonProps, ButtonShorthandPropsCompat } from '../Button/Button.types';
|
4
|
+
import type { MenuButtonProps } from '../MenuButton/MenuButton.types';
|
5
|
+
export interface SplitButtonProps extends Omit<ButtonProps, ButtonShorthandPropsCompat>, MenuButtonProps {
|
6
|
+
/**
|
7
|
+
* Button to perform primary action in SplitButton.
|
8
|
+
*/
|
9
|
+
button?: ShorthandPropsCompat<ButtonProps>;
|
10
|
+
/**
|
11
|
+
* Button that opens menu with secondary actions in SplitButton.
|
12
|
+
*/
|
13
|
+
menuButton?: ShorthandPropsCompat<MenuButtonProps>;
|
14
|
+
/**
|
15
|
+
* Ref to the Button element.
|
16
|
+
*/
|
17
|
+
buttonRef?: React.Ref<HTMLElement>;
|
18
|
+
/**
|
19
|
+
* Ref to the MenuButton element.
|
20
|
+
*/
|
21
|
+
menuButtonRef?: React.Ref<HTMLElement>;
|
22
|
+
}
|
23
|
+
export declare type SplitButtonShorthandPropsCompat = 'button' | 'menuButton';
|
24
|
+
export declare type SplitButtonDefaultedProps = 'size';
|
25
|
+
export interface SplitButtonState extends ComponentStateCompat<SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonDefaultedProps> {
|
26
|
+
/**
|
27
|
+
* Ref to the root element
|
28
|
+
*/
|
29
|
+
ref: React.Ref<HTMLElement>;
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButtonStyles = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
tslib_1.__exportStar(require("./SplitButton"), exports);
|
11
|
+
|
12
|
+
tslib_1.__exportStar(require("./SplitButton.types"), exports);
|
13
|
+
|
14
|
+
tslib_1.__exportStar(require("./renderSplitButton"), exports);
|
15
|
+
|
16
|
+
tslib_1.__exportStar(require("./useSplitButton"), exports);
|
17
|
+
|
18
|
+
var useSplitButtonStyles_1 = /*#__PURE__*/require("./useSplitButtonStyles");
|
19
|
+
|
20
|
+
Object.defineProperty(exports, "useSplitButtonStyles", {
|
21
|
+
enumerable: true,
|
22
|
+
get: function () {
|
23
|
+
return useSplitButtonStyles_1.useSplitButtonStyles;
|
24
|
+
}
|
25
|
+
});
|
26
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,IAAA,sBAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,sBAAA,EAAA;AAAA,EAAA,UAAA,EAAA,IAAA;AAAA,EAAA,GAAA,EAAA,YAAA;AAAA,WAAA,sBAAA,CAAA,oBAAA;AAAoB;AAApB,CAAA","sourcesContent":["export * from './SplitButton';\nexport * from './SplitButton.types';\nexport * from './renderSplitButton';\nexport * from './useSplitButton';\nexport { useSplitButtonStyles } from './useSplitButtonStyles';\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.renderSplitButton = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var React = /*#__PURE__*/require("react");
|
11
|
+
|
12
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
13
|
+
|
14
|
+
var useSplitButton_1 = /*#__PURE__*/require("./useSplitButton");
|
15
|
+
/**
|
16
|
+
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
var renderSplitButton = function (state) {
|
21
|
+
var _a = react_utilities_1.getSlotsCompat(state, useSplitButton_1.splitButtonShorthandProps),
|
22
|
+
slots = _a.slots,
|
23
|
+
slotProps = _a.slotProps;
|
24
|
+
|
25
|
+
return React.createElement(slots.root, tslib_1.__assign({}, slotProps.root), React.createElement(slots.button, tslib_1.__assign({}, slotProps.button)), React.createElement(slots.menuButton, tslib_1.__assign({}, slotProps.menuButton)));
|
26
|
+
};
|
27
|
+
|
28
|
+
exports.renderSplitButton = renderSplitButton;
|
29
|
+
//# sourceMappingURL=renderSplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/renderSplitButton.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,IAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,IAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAGA;;AAEG;;;AACI,IAAM,iBAAiB,GAAG,UAAC,KAAD,EAAwB;AACjD,MAAA,EAAA,GAAuB,iBAAA,CAAA,cAAA,CAAe,KAAf,EAAsB,gBAAA,CAAA,yBAAtB,CAAvB;AAAA,MAAE,KAAK,GAAA,EAAA,CAAA,KAAP;AAAA,MAAS,SAAS,GAAA,EAAA,CAAA,SAAlB;;AAEN,SACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,MAAP,EAAa,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,MAAf,CAAb,CADF,EAEE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,UAAP,EAAiB,OAAA,CAAA,QAAA,CAAA,EAAA,EAAK,SAAS,CAAC,UAAf,CAAjB,CAFF,CADF;AAMD,CATM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { getSlotsCompat } from '@fluentui/react-utilities';\nimport { splitButtonShorthandProps } from './useSplitButton';\nimport type { 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 = (state: SplitButtonState) => {\n const { slots, slotProps } = getSlotsCompat(state, splitButtonShorthandProps);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.button {...slotProps.button} />\n <slots.menuButton {...slotProps.menuButton} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';
|
3
|
+
export declare const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[];
|
4
|
+
/**
|
5
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
6
|
+
* @param props - User provided props to the SplitButton component.
|
7
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
8
|
+
*/
|
9
|
+
export declare const useSplitButton: (props: SplitButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: SplitButtonProps | undefined) => SplitButtonState;
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButton = exports.splitButtonShorthandProps = void 0;
|
7
|
+
|
8
|
+
var tslib_1 = /*#__PURE__*/require("tslib");
|
9
|
+
|
10
|
+
var react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
|
11
|
+
|
12
|
+
exports.splitButtonShorthandProps = ['button', 'menuButton'];
|
13
|
+
var mergeProps = /*#__PURE__*/react_utilities_1.makeMergeProps({
|
14
|
+
deepMerge: exports.splitButtonShorthandProps
|
15
|
+
});
|
16
|
+
/**
|
17
|
+
* Given user props, defines default props for the SplitButton and returns processed state.
|
18
|
+
* @param props - User provided props to the SplitButton component.
|
19
|
+
* @param ref - User provided ref to be passed to the SplitButton component.
|
20
|
+
*/
|
21
|
+
|
22
|
+
var useSplitButton = function (props, ref, defaultProps) {
|
23
|
+
var resolvedShorthandProps = react_utilities_1.resolveShorthandProps(props, exports.splitButtonShorthandProps);
|
24
|
+
var className = props.className;
|
25
|
+
|
26
|
+
var button = resolvedShorthandProps.button,
|
27
|
+
buttonRef = resolvedShorthandProps.buttonRef,
|
28
|
+
circular = resolvedShorthandProps.circular,
|
29
|
+
disabled = resolvedShorthandProps.disabled,
|
30
|
+
disabledFocusable = resolvedShorthandProps.disabledFocusable,
|
31
|
+
menuButton = resolvedShorthandProps.menuButton,
|
32
|
+
menuButtonRef = resolvedShorthandProps.menuButtonRef,
|
33
|
+
outline = resolvedShorthandProps.outline,
|
34
|
+
primary = resolvedShorthandProps.primary,
|
35
|
+
_a = resolvedShorthandProps.size,
|
36
|
+
size = _a === void 0 ? 'medium' : _a,
|
37
|
+
subtle = resolvedShorthandProps.subtle,
|
38
|
+
transparent = resolvedShorthandProps.transparent,
|
39
|
+
userProps = tslib_1.__rest(resolvedShorthandProps, ["button", "buttonRef", "circular", "disabled", "disabledFocusable", "menuButton", "menuButtonRef", "outline", "primary", "size", "subtle", "transparent"]); // TODO: To be resolved when moving to simplified prop merging
|
40
|
+
// const buttonInternalRef = React.useRef<HTMLElement | null>(null);
|
41
|
+
// const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);
|
42
|
+
|
43
|
+
|
44
|
+
var state = mergeProps({
|
45
|
+
'aria-disabled': disabled,
|
46
|
+
as: 'div',
|
47
|
+
className: className,
|
48
|
+
ref: ref,
|
49
|
+
size: size,
|
50
|
+
button: tslib_1.__assign(tslib_1.__assign({
|
51
|
+
as: 'button',
|
52
|
+
// TODO: To be resolved when moving to simplified prop merging
|
53
|
+
// ref: useMergedRefs(buttonRef, buttonInternalRef),
|
54
|
+
circular: circular,
|
55
|
+
disabled: disabled,
|
56
|
+
disabledFocusable: disabledFocusable,
|
57
|
+
outline: outline,
|
58
|
+
primary: primary,
|
59
|
+
size: size,
|
60
|
+
subtle: subtle,
|
61
|
+
transparent: transparent
|
62
|
+
}, userProps), button),
|
63
|
+
menuButton: tslib_1.__assign({
|
64
|
+
as: 'button',
|
65
|
+
// TODO: To be resolved when moving to simplified prop merging
|
66
|
+
// ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),
|
67
|
+
circular: circular,
|
68
|
+
disabled: disabled,
|
69
|
+
disabledFocusable: disabledFocusable,
|
70
|
+
outline: outline,
|
71
|
+
primary: primary,
|
72
|
+
size: size,
|
73
|
+
subtle: subtle,
|
74
|
+
transparent: transparent
|
75
|
+
}, menuButton)
|
76
|
+
}, // TODO: To be resolved when moving to simplified prop merging
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
78
|
+
defaultProps, resolvedShorthandProps);
|
79
|
+
return state;
|
80
|
+
};
|
81
|
+
|
82
|
+
exports.useSplitButton = useSplitButton;
|
83
|
+
//# sourceMappingURL=useSplitButton.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButton.ts"],"names":[],"mappings":";;;;;;;;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGa,OAAA,CAAA,yBAAA,GAA+D,CAAC,QAAD,EAAW,YAAX,CAA/D;AAEb,IAAM,UAAU,gBAAG,iBAAA,CAAA,cAAA,CAAiC;AAAE,EAAA,SAAS,EAAE,OAAA,CAAA;AAAb,CAAjC,CAAnB;AAEA;;;;AAIG;;AACI,IAAM,cAAc,GAAG,UAC5B,KAD4B,EAE5B,GAF4B,EAG5B,YAH4B,EAGG;AAE/B,MAAM,sBAAsB,GAAG,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,OAAA,CAAA,yBAA7B,CAA/B;AACQ,MAAA,SAAS,GAAK,KAAK,CAAV,SAAT;;AAEN,MAAA,MAAM,GAaJ,sBAAsB,CAblB,MAAN;AAAA,MACA,SAAS,GAYP,sBAAsB,CAZf,SADT;A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ATA;AAUJ,MAAA,MAAM,EAAA,MAVF;AAWJ,MAAA,WAAW,EAAA;AAXP,KAAA,EAYD,SAZC,CAAA,EAaD,MAbC,CAPR;AAuBE,IAAA,UAAU,EAAA,OAAA,CAAA,QAAA,CAAA;AACR,MAAA,EAAE,EAAE,QADI;AAER;AACA;AACA,MAAA,QAAQ,EAAA,QAJA;AAKR,MAAA,QAAQ,EAAA,QALA;AAMR,MAAA,iBAAiB,EAAA,iBANT;AAOR,MAAA,OAAO,EAAA,OAPC;AAQR,MAAA,OAAO,EAAA,OARC;AASR,MAAA,IAAI,EAAA,IATI;AAUR,MAAA,MAAM,EAAA,MAVE;AAWR,MAAA,WAAW,EAAA;AAXH,KAAA,EAYL,UAZK;AAvBZ,GADsB,EAuCtB;AACA;AACA,EAAA,YAzCsB,EA0CtB,sBA1CsB,CAAxB;AA6CA,SAAO,KAAP;AACD,CAzEM;;AAAM,OAAA,CAAA,cAAA,GAAc,cAAd","sourcesContent":["import * as React from 'react';\nimport { makeMergeProps, resolveShorthandProps } from '@fluentui/react-utilities';\nimport type { SplitButtonProps, SplitButtonShorthandPropsCompat, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonShorthandProps: SplitButtonShorthandPropsCompat[] = ['button', 'menuButton'];\n\nconst mergeProps = makeMergeProps<SplitButtonState>({ deepMerge: splitButtonShorthandProps });\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 = (\n props: SplitButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: SplitButtonProps,\n): SplitButtonState => {\n const resolvedShorthandProps = resolveShorthandProps(props, splitButtonShorthandProps);\n const { className } = props;\n const {\n button,\n buttonRef,\n circular,\n disabled,\n disabledFocusable,\n menuButton,\n menuButtonRef,\n outline,\n primary,\n size = 'medium',\n subtle,\n transparent,\n ...userProps\n } = resolvedShorthandProps;\n\n // TODO: To be resolved when moving to simplified prop merging\n // const buttonInternalRef = React.useRef<HTMLElement | null>(null);\n // const menuButtonInternalRef = React.useRef<HTMLElement | null>(null);\n\n const state = mergeProps(\n {\n 'aria-disabled': disabled,\n as: 'div',\n className,\n ref,\n size,\n\n button: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(buttonRef, buttonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...userProps,\n ...button,\n },\n\n menuButton: {\n as: 'button',\n // TODO: To be resolved when moving to simplified prop merging\n // ref: useMergedRefs(menuButtonRef, menuButtonInternalRef),\n circular,\n disabled,\n disabledFocusable,\n outline,\n primary,\n size,\n subtle,\n transparent,\n ...menuButton,\n },\n },\n // TODO: To be resolved when moving to simplified prop merging\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any,\n resolvedShorthandProps,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.useSplitButtonStyles = void 0;
|
7
|
+
|
8
|
+
var react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
|
9
|
+
|
10
|
+
var SplitButtonClassNames = {
|
11
|
+
button: 'SplitButton-button',
|
12
|
+
menuButton: 'SplitButton-menuButton'
|
13
|
+
};
|
14
|
+
|
15
|
+
var useStyles = /*#__PURE__*/react_make_styles_1.__styles({
|
16
|
+
"root": {
|
17
|
+
"mc9l5x": "ftuwxu6",
|
18
|
+
"Brf1p80": "fsxf2b5",
|
19
|
+
"qhf8xq": "f10pi13n",
|
20
|
+
"x85veo": ["f1ne4dir", "f1ybi2by"],
|
21
|
+
"Btvcf1s": ["f1breevy", "f1tvski9"],
|
22
|
+
"bajz6s": ["fnux5s6", "f5nfhee"],
|
23
|
+
"Bzqncq": ["f19wc9x7", "f5bevrs"],
|
24
|
+
"Flt4rd": ["f1wefiyg", "f1leuqsa"]
|
25
|
+
},
|
26
|
+
"rootBlock": {
|
27
|
+
"a9b677": "fly5x3f"
|
28
|
+
},
|
29
|
+
"rootPrimary": {
|
30
|
+
"hr16oo": ["f1l8fiow", "f1lkg7w5"],
|
31
|
+
"B5d1tlv": ["f1pm7n2k", "f1xkm9yf"],
|
32
|
+
"Bqs20fh": ["f1lzlrrr", "fhewniv"]
|
33
|
+
},
|
34
|
+
"rootSubtle": {
|
35
|
+
"hr16oo": ["ffnz80u", "fubjfjv"],
|
36
|
+
"B5d1tlv": ["f1ev4hyt", "fgg37q7"],
|
37
|
+
"Bqs20fh": ["f12yns5v", "fo742o6"]
|
38
|
+
},
|
39
|
+
"rootTransparent": {
|
40
|
+
"hr16oo": ["ffnz80u", "fubjfjv"],
|
41
|
+
"B5d1tlv": ["f1ev4hyt", "fgg37q7"],
|
42
|
+
"Bqs20fh": ["f12yns5v", "fo742o6"]
|
43
|
+
},
|
44
|
+
"rootDisabled": {
|
45
|
+
"hr16oo": ["f11d5dl6", "fdl3b3o"],
|
46
|
+
"B5d1tlv": ["f2uuk1a", "f13ik0bv"],
|
47
|
+
"Bqs20fh": ["f47hzam", "f1ui3wts"]
|
48
|
+
}
|
49
|
+
}, {
|
50
|
+
"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;}", ".f1ne4dir .SplitButton-button{border-top-right-radius:0;}", ".f1ybi2by .SplitButton-button{border-top-left-radius:0;}", ".f1breevy .SplitButton-button{border-bottom-right-radius:0;}", ".f1tvski9 .SplitButton-button{border-bottom-left-radius:0;}", ".fnux5s6 .SplitButton-menuButton{border-left-width:0;}", ".f5nfhee .SplitButton-menuButton{border-right-width:0;}", ".f19wc9x7 .SplitButton-menuButton{border-top-left-radius:0;}", ".f5bevrs .SplitButton-menuButton{border-top-right-radius:0;}", ".f1wefiyg .SplitButton-menuButton{border-bottom-left-radius:0;}", ".f1leuqsa .SplitButton-menuButton{border-bottom-right-radius:0;}", ".fly5x3f{width:100%;}", ".f1l8fiow .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1lkg7w5 .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".ffnz80u .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fubjfjv .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f11d5dl6 .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".fdl3b3o .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
|
51
|
+
"h": [".f1pm7n2k:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1xkm9yf:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f1ev4hyt:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fgg37q7:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f2uuk1a:hover .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f13ik0bv:hover .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"],
|
52
|
+
"a": [".f1lzlrrr:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".fhewniv:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralForegroundInverted);}", ".f12yns5v:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".fo742o6:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStroke1Hover);}", ".f47hzam:active .SplitButton-button{border-right-color:var(--alias-color-neutral-neutralStrokeDisabled);}", ".f1ui3wts:active .SplitButton-button{border-left-color:var(--alias-color-neutral-neutralStrokeDisabled);}"]
|
53
|
+
});
|
54
|
+
|
55
|
+
var useSplitButtonStyles = function (state) {
|
56
|
+
var styles = useStyles();
|
57
|
+
state.className = react_make_styles_1.mergeClasses(styles.root, state.block && styles.rootBlock, state.primary && styles.rootPrimary, state.subtle && styles.rootSubtle, state.transparent && styles.rootTransparent, state.disabled && styles.rootDisabled, state.className);
|
58
|
+
|
59
|
+
if (state.button) {
|
60
|
+
state.button.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.button, state.button.className);
|
61
|
+
}
|
62
|
+
|
63
|
+
if (state.menuButton) {
|
64
|
+
state.menuButton.className = react_make_styles_1.mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);
|
65
|
+
}
|
66
|
+
|
67
|
+
return state;
|
68
|
+
};
|
69
|
+
|
70
|
+
exports.useSplitButtonStyles = useSplitButtonStyles;
|
71
|
+
//# sourceMappingURL=useSplitButtonStyles.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["components/SplitButton/useSplitButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AAGA,IAAM,qBAAqB,GAAG;AAC5B,EAAA,MAAM,EAAE,oBADoB;AAE5B,EAAA,UAAU,EAAE;AAFgB,CAA9B;;AAKA,IAAM,SAAS,gBAAG,mBAAA,SAAA;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,EAAlB;;AAgGO,IAAM,oBAAoB,GAAG,UAAC,KAAD,EAAwB;AAC1D,MAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,SAAN,GAAkB,mBAAA,CAAA,YAAA,CAChB,MAAM,CAAC,IADS,EAEhB,KAAK,CAAC,KAAN,IAAe,MAAM,CAAC,SAFN,EAGhB,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,WAHR,EAIhB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,UAJP,EAKhB,KAAK,CAAC,WAAN,IAAqB,MAAM,CAAC,eALZ,EAMhB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,YANT,EAOhB,KAAK,CAAC,SAPU,CAAlB;;AAUA,MAAI,KAAK,CAAC,MAAV,EAAkB;AAChB,IAAA,KAAK,CAAC,MAAN,CAAa,SAAb,GAAyB,mBAAA,CAAA,YAAA,CAAa,qBAAqB,CAAC,MAAnC,EAA2C,KAAK,CAAC,MAAN,CAAa,SAAxD,CAAzB;AACD;;AAED,MAAI,KAAK,CAAC,UAAV,EAAsB;AACpB,IAAA,KAAK,CAAC,UAAN,CAAiB,SAAjB,GAA6B,mBAAA,CAAA,YAAA,CAAa,qBAAqB,CAAC,UAAnC,EAA+C,KAAK,CAAC,UAAN,CAAiB,SAAhE,CAA7B;AACD;;AAED,SAAO,KAAP;AACD,CAtBM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport type { SplitButtonState } from './SplitButton.types';\n\nconst SplitButtonClassNames = {\n button: 'SplitButton-button',\n menuButton: 'SplitButton-menuButton',\n};\n\nconst useStyles = makeStyles({\n root: theme => ({\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n },\n }),\n rootBlock: {\n width: '100%',\n },\n rootPrimary: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralForegroundInverted,\n },\n },\n }),\n rootSubtle: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootTransparent: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStroke1Hover,\n },\n },\n }),\n rootDisabled: theme => ({\n // Use classnames to increase specificy of styles and avoid collisions.\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n\n ':active': {\n [`& .${SplitButtonClassNames.button}`]: {\n borderRightColor: theme.alias.color.neutral.neutralStrokeDisabled,\n },\n },\n }),\n});\n\nexport const useSplitButtonStyles = (state: SplitButtonState): SplitButtonState => {\n const styles = useStyles();\n\n state.className = mergeClasses(\n styles.root,\n state.block && styles.rootBlock,\n state.primary && styles.rootPrimary,\n state.subtle && styles.rootSubtle,\n state.transparent && styles.rootTransparent,\n state.disabled && styles.rootDisabled,\n state.className,\n );\n\n if (state.button) {\n state.button.className = mergeClasses(SplitButtonClassNames.button, state.button.className);\n }\n\n if (state.menuButton) {\n state.menuButton.className = mergeClasses(SplitButtonClassNames.menuButton, state.menuButton.className);\n }\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';
|
3
3
|
/**
|
4
|
-
* Given user props,
|
4
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
5
|
+
* processed state.
|
6
|
+
* @param props - User provided props to the ToggleButton component.
|
7
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
5
8
|
*/
|
6
9
|
export declare const useToggleButton: (props: ToggleButtonProps, ref: React.Ref<HTMLElement>, defaultProps?: ToggleButtonProps | undefined) => ToggleButtonState;
|
@@ -9,7 +9,10 @@ var useButton_1 = /*#__PURE__*/require("../Button/useButton");
|
|
9
9
|
|
10
10
|
var useChecked_1 = /*#__PURE__*/require("./useChecked");
|
11
11
|
/**
|
12
|
-
* Given user props,
|
12
|
+
* Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns
|
13
|
+
* processed state.
|
14
|
+
* @param props - User provided props to the ToggleButton component.
|
15
|
+
* @param ref - User provided ref to be passed to the ToggleButton component.
|
13
16
|
*/
|
14
17
|
|
15
18
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAGA
|
1
|
+
{"version":3,"sources":["components/ToggleButton/useToggleButton.ts"],"names":[],"mappings":";;;;;;;AACA,IAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AACA,IAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;AAGA;;;;;AAKG;;;AACI,IAAM,eAAe,GAAG,UAC7B,KAD6B,EAE7B,GAF6B,EAG7B,YAH6B,EAGG;AAEhC,MAAM,KAAK,GAAG,WAAA,CAAA,SAAA,CAAU,KAAV,EAAiB,GAAjB,EAAsB,YAAtB,CAAd;AAEA,EAAA,YAAA,CAAA,UAAA,CAAW,KAAX;AAEA,SAAO,KAAP;AACD,CAVM;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { useButton } from '../Button/useButton';\nimport { useChecked } from './useChecked';\nimport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton.types';\n\n/**\n * Given user props, defines default props for the ToggleButton, calls useButtonState and useChecked, and returns\n * processed state.\n * @param props - User provided props to the ToggleButton component.\n * @param ref - User provided ref to be passed to the ToggleButton component.\n */\nexport const useToggleButton = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLElement>,\n defaultProps?: ToggleButtonProps,\n) => {\n const state = useButton(props, ref, defaultProps);\n\n useChecked(state as ToggleButtonProps);\n\n return state as ToggleButtonState;\n};\n"],"sourceRoot":"../src/"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/ToggleButton/useToggleButtonStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,IAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,IAAM,aAAa,gBAAG,mBAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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,KAAK,CAAC,iBAAzB,KAA+C,UAAU,CAAC,QAN1C,EAOhB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,OAArD,IAAgE,UAAU,CAAC,eAP3D,EAQhB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,MAArD,IAA+D,UAAU,CAAC,cAR1D,EAShB,CAAC,KAAK,CAAC,QAAN,IAAkB,KAAK,CAAC,iBAAzB,KAA+C,KAAK,CAAC,WAArD,IAAoE,UAAU,CAAC,mBAT/D,EAUhB,KAAK,CAAC,SAVU,CAAlB;AAaA,EAAA,iBAAA,CAAA,eAAA,CAAgB,KAAhB;AAEA,SAAO,KAAP;AACD,CAnBM;;AAAM,OAAA,CAAA,qBAAA,GAAqB,qBAArB","sourcesContent":["import { makeStyles, mergeClasses } from '@fluentui/react-make-styles';\nimport { useButtonStyles } from '../Button/useButtonStyles';\nimport type { ToggleButtonState } from './ToggleButton.types';\n\nconst useRootStyles = makeStyles({\n checked: theme => ({\n background: theme.alias.color.neutral.neutralBackground1Selected,\n borderColor: theme.alias.color.neutral.neutralStroke1,\n color: theme.alias.color.neutral.neutralForeground1,\n\n borderWidth: theme.global.strokeWidth.thin,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackground1Hover,\n borderColor: theme.alias.color.neutral.neutralStroke1Hover,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackground1Pressed,\n borderColor: theme.alias.color.neutral.neutralStroke1Pressed,\n color: theme.alias.color.neutral.neutralForeground1,\n },\n }),\n checkedOutline: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n },\n }),\n checkedPrimary: theme => ({\n background: theme.alias.color.neutral.brandBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n\n ':hover': {\n background: theme.alias.color.neutral.brandBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n\n ':active': {\n background: theme.alias.color.neutral.brandBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForegroundOnBrand,\n },\n }),\n checkedSubtle: theme => ({\n background: theme.alias.color.neutral.subtleBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.subtleBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.subtleBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n checkedTransparent: theme => ({\n background: theme.alias.color.neutral.transparentBackgroundSelected,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandSelected,\n\n ':hover': {\n background: theme.alias.color.neutral.transparentBackgroundHover,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandHover,\n },\n\n ':active': {\n background: theme.alias.color.neutral.transparentBackgroundPressed,\n borderColor: 'transparent',\n color: theme.alias.color.neutral.neutralForeground2BrandPressed,\n },\n }),\n disabled: theme => ({\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n\n ':hover': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n\n ':active': {\n background: theme.alias.color.neutral.neutralBackgroundDisabled,\n borderColor: theme.alias.color.neutral.neutralStrokeDisabled,\n color: theme.alias.color.neutral.neutralForegroundDisabled,\n },\n }),\n disabledPrimary: {\n borderColor: 'transparent',\n\n ':hover': {\n borderColor: 'transparent',\n },\n\n ':active': {\n borderColor: 'transparent',\n },\n },\n disabledSubtle: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n disabledTransparent: {\n background: 'none',\n borderColor: 'transparent',\n\n ':hover': {\n background: 'none',\n borderColor: 'transparent',\n },\n\n ':active': {\n background: 'none',\n borderColor: 'transparent',\n },\n },\n});\n\nexport const useToggleButtonStyles = (state: ToggleButtonState): ToggleButtonState => {\n const rootStyles = useRootStyles();\n\n state.className = mergeClasses(\n state.checked && rootStyles.checked,\n state.checked && state.outline && rootStyles.checkedOutline,\n state.checked && state.primary && rootStyles.checkedPrimary,\n state.checked && state.subtle && rootStyles.checkedSubtle,\n state.checked && state.transparent && rootStyles.checkedTransparent,\n (state.disabled || state.disabledFocusable) && rootStyles.disabled,\n (state.disabled || state.disabledFocusable) && state.primary && rootStyles.disabledPrimary,\n (state.disabled || state.disabledFocusable) && state.subtle && rootStyles.disabledSubtle,\n (state.disabled || state.disabledFocusable) && state.transparent && rootStyles.disabledTransparent,\n state.className,\n );\n\n useButtonStyles(state);\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.d.ts
CHANGED
package/lib-commonjs/index.js
CHANGED
@@ -12,5 +12,7 @@ tslib_1.__exportStar(require("./CompoundButton"), exports);
|
|
12
12
|
|
13
13
|
tslib_1.__exportStar(require("./MenuButton"), exports);
|
14
14
|
|
15
|
+
tslib_1.__exportStar(require("./SplitButton"), exports);
|
16
|
+
|
15
17
|
tslib_1.__exportStar(require("./ToggleButton"), exports);
|
16
18
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './ToggleButton';\n"],"sourceRoot":"../src/"}
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,UAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Button';\nexport * from './CompoundButton';\nexport * from './MenuButton';\nexport * from './SplitButton';\nexport * from './ToggleButton';\n"],"sourceRoot":"../src/"}
|