@fluentui/react-button 9.7.1 → 9.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -2
- package/dist/index.d.ts +2 -2
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/ToggleButton.js +1 -1
- package/lib/ToggleButton.js.map +1 -1
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/useButton.js +23 -11
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +3 -2
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +10 -9
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +6 -6
- package/lib/components/SplitButton/useSplitButton.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/useToggleButton.js +13 -2
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Button.js +3 -0
- package/lib-commonjs/Button.js.map +1 -1
- package/lib-commonjs/ToggleButton.js +3 -0
- package/lib-commonjs/ToggleButton.js.map +1 -1
- package/lib-commonjs/components/Button/Button.types.js.map +1 -1
- package/lib-commonjs/components/Button/index.js +3 -0
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +28 -13
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +3 -2
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +10 -9
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +5 -5
- package/lib-commonjs/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.js +3 -0
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +18 -4
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/index.js +5 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +7 -14
- package/lib/components/Button/useButtonStyles.styles.headless.js +0 -36
- package/lib/components/Button/useButtonStyles.styles.headless.js.map +0 -1
- package/lib/components/Button/useButtonStyles.styles.raw.headless.js +0 -36
- package/lib/components/Button/useButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.headless.js +0 -49
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.headless.js.map +0 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.headless.js +0 -49
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.headless.js +0 -44
- package/lib/components/MenuButton/useMenuButtonStyles.styles.headless.js.map +0 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.headless.js +0 -44
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.headless.js +0 -39
- package/lib/components/SplitButton/useSplitButtonStyles.styles.headless.js.map +0 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.headless.js +0 -39
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.headless.js +0 -36
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.headless.js.map +0 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.headless.js +0 -36
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.headless.js +0 -52
- package/lib-commonjs/components/Button/useButtonStyles.styles.headless.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.headless.js +0 -52
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.headless.js +0 -64
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.headless.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.headless.js +0 -64
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.headless.js +0 -60
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.headless.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.headless.js +0 -60
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.headless.js +0 -55
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.headless.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.headless.js +0 -55
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.headless.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.headless.js +0 -52
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.headless.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.headless.js +0 -52
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.headless.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButtonContext } from '../../contexts/ButtonContext';\nimport { ARIAButtonSlotProps, useARIAButtonProps } from '@fluentui/react-aria';\nimport { slot } from '@fluentui/react-utilities';\nimport type { ButtonBaseProps, ButtonBaseState, ButtonProps, ButtonState } from './Button.types';\n\n/**\n * Given user props, defines default props for the Button, calls useButtonState, and returns processed state.\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButton_unstable = (\n props: ButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonState => {\n const { size: contextSize } = useButtonContext();\n const { appearance = 'secondary', shape = 'rounded', size = contextSize ?? 'medium', ...buttonProps } = props;\n const state = useButtonBase_unstable(buttonProps, ref);\n\n return {\n appearance,\n shape,\n size,\n ...state,\n };\n};\n\n/**\n * Base hook for Button component, which manages state related to slots structure and ARIA attributes.\n *\n * @param props - User provided props to the Button component.\n * @param ref - User provided ref to be passed to the Button component.\n */\nexport const useButtonBase_unstable = (\n props: ButtonBaseProps,\n ref?: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ButtonBaseState => {\n const { icon, iconPosition = 'before', ...buttonProps } = props;\n const iconShorthand = slot.optional(icon, { elementType: 'span' });\n\n return {\n disabled: props.disabled ?? false,\n disabledFocusable: props.disabledFocusable ?? false,\n iconPosition,\n iconOnly: Boolean(iconShorthand?.children && !props.children),\n components: { root: 'button', icon: 'span' },\n root: slot.always<ARIAButtonSlotProps<'a'>>(useARIAButtonProps(buttonProps.as, buttonProps), {\n elementType: 'button',\n defaultProps: {\n ref: ref as React.Ref<HTMLButtonElement & HTMLAnchorElement>,\n type: props.as !== 'a' ? 'button' : undefined,\n },\n }),\n icon: iconShorthand,\n };\n};\n"],"names":["React","useButtonContext","useARIAButtonProps","slot","useButton_unstable","props","ref","size","contextSize","appearance","shape","buttonProps","state","useButtonBase_unstable","icon","iconPosition","iconShorthand","optional","elementType","disabled","disabledFocusable","iconOnly","Boolean","children","components","root","always","as","defaultProps","type","undefined"],"mappings":"AAAA;;;;;;;;;;;;0BAmCaa;eAAAA;;sBAtBAT;;;;;iEAXU,QAAQ;+BACE,+BAA+B;2BACR,uBAAuB;gCAC1D,4BAA4B;AAQ1C,MAAMA,qBAAqB,CAChCC,OACAC;IAEA,MAAM,EAAEC,MAAMC,WAAW,EAAE,GAAGP,mCAAAA;IAC9B,MAAM,EAAEQ,aAAa,WAAW,EAAEC,QAAQ,SAAS,EAAEH,OAAOC,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,cAAe,QAAQ,EAAE,GAAGG,aAAa,GAAGN;IACxG,MAAMO,QAAQC,uBAAuBF,aAAaL;IAElD,OAAO;QACLG;QACAC;QACAH;QACA,GAAGK,KAAK;IACV;AACF,EAAE;AAQK,+BAA+B,CACpCP,OACAC;IAEA,MAAM,EAAEQ,IAAI,EAAEC,eAAe,QAAQ,EAAE,GAAGJ,aAAa,GAAGN;IAC1D,MAAMW,gBAAgBb,oBAAAA,CAAKc,QAAQ,CAACH,MAAM;QAAEI,aAAa;IAAO;QAGpDb,iBACSA;IAFrB,OAAO;QACLc,UAAUd,mBAAAA,MAAMc,QAAQ,AAARA,MAAQ,QAAdd,oBAAAA,KAAAA,IAAAA,kBAAkB;QAC5Be,mBAAmBf,CAAAA,2BAAAA,MAAMe,iBAAAA,AAAiB,MAAA,QAAvBf,6BAAAA,KAAAA,IAAAA,2BAA2B;QAC9CU;QACAM,UAAUC,QAAQN,CAAAA,kBAAAA,QAAAA,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAeO,QAAAA,AAAQ,KAAI,CAAClB,MAAMkB,QAAQ;QAC5DC,YAAY;YAAEC,MAAM;YAAUX,MAAM;QAAO;QAC3CW,MAAMtB,oBAAAA,CAAKuB,MAAM,KAA2BxB,6BAAAA,EAAmBS,YAAYgB,EAAE,EAAEhB,cAAc;YAC3FO,aAAa;YACbU,cAAc;gBACZtB,KAAKA;gBACLuB,MAAMxB,MAAMsB,EAAE,KAAK,MAAM,WAAWG;YACtC;QACF;QACAhB,MAAME;IACR;AACF,EAAE"}
|
|
@@ -13,11 +13,12 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
14
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
15
|
const _index = require("../Button/index");
|
|
16
|
-
const useCompoundButton_unstable = (
|
|
16
|
+
const useCompoundButton_unstable = (props, ref)=>{
|
|
17
17
|
var _state_icon, _state_secondaryContent;
|
|
18
|
+
const { contentContainer, secondaryContent, ...buttonProps } = props;
|
|
18
19
|
const state = {
|
|
19
20
|
// Button state
|
|
20
|
-
...(0, _index.useButton_unstable)(
|
|
21
|
+
...(0, _index.useButton_unstable)(buttonProps, ref),
|
|
21
22
|
// Slots definition
|
|
22
23
|
components: {
|
|
23
24
|
root: 'button',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/useCompoundButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { useButton_unstable } from '../Button/index';\nimport type { CompoundButtonProps, CompoundButtonState } from './CompoundButton.types';\n\n/**\n * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the CompoundButton component.\n * @param ref - User provided ref to be passed to the CompoundButton component.\n */\nexport const useCompoundButton_unstable = (\n
|
|
1
|
+
{"version":3,"sources":["../src/components/CompoundButton/useCompoundButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { slot } from '@fluentui/react-utilities';\nimport { useButton_unstable } from '../Button/index';\nimport type { CompoundButtonProps, CompoundButtonState } from './CompoundButton.types';\n\n/**\n * Given user props, defines default props for the CompoundButton, calls useButtonState, and returns processed state.\n * @param props - User provided props to the CompoundButton component.\n * @param ref - User provided ref to be passed to the CompoundButton component.\n */\nexport const useCompoundButton_unstable = (\n props: CompoundButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): CompoundButtonState => {\n const { contentContainer, secondaryContent, ...buttonProps } = props;\n\n const state: CompoundButtonState = {\n // Button state\n ...useButton_unstable(buttonProps, ref),\n\n // Slots definition\n components: {\n root: 'button',\n icon: 'span',\n contentContainer: 'span',\n secondaryContent: 'span',\n },\n contentContainer: slot.always(contentContainer, { elementType: 'span' }),\n secondaryContent: slot.optional(secondaryContent, { elementType: 'span' }),\n };\n\n // Recalculate iconOnly to take into account secondaryContent.\n state.iconOnly = Boolean(state.icon?.children && !props.children && !state.secondaryContent?.children);\n\n return state;\n};\n"],"names":["React","slot","useButton_unstable","useCompoundButton_unstable","props","ref","state","contentContainer","secondaryContent","buttonProps","components","root","icon","always","elementType","optional","iconOnly","Boolean","children"],"mappings":"AAAA;;;;;+BAYaG;;;;;;;iEAVU,QAAQ;gCACV,4BAA4B;uBACd,kBAAkB;AAQ9C,mCAAmC,CACxCC,OACAC;QAoByBC,aAA4CA;IAlBrE,MAAM,EAAEC,gBAAgB,EAAEC,gBAAgB,EAAE,GAAGC,aAAa,GAAGL;IAE/D,MAAME,QAA6B;QACjC,eAAe;QACf,OAAGJ,yBAAAA,EAAmBO,aAAaJ,IAAI;QAEvC,mBAAmB;QACnBK,YAAY;YACVC,MAAM;YACNC,MAAM;YACNL,kBAAkB;YAClBC,kBAAkB;QACpB;QACAD,kBAAkBN,oBAAAA,CAAKY,MAAM,CAACN,kBAAkB;YAAEO,aAAa;QAAO;QACtEN,kBAAkBP,oBAAAA,CAAKc,QAAQ,CAACP,kBAAkB;YAAEM,aAAa;QAAO;IAC1E;IAEA,8DAA8D;IAC9DR,MAAMU,QAAQ,GAAGC,QAAQX,CAAAA,CAAAA,cAAAA,MAAMM,IAAAA,AAAI,MAAA,QAAVN,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAYY,QAAAA,AAAQ,KAAI,CAACd,MAAMc,QAAQ,IAAI,CAAA,CAAA,CAACZ,0BAAAA,MAAME,gBAAAA,AAAgB,MAAA,QAAtBF,4BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,wBAAwBY,QAAAA,AAAQ;IAErG,OAAOZ;AACT,EAAE"}
|
|
@@ -14,22 +14,23 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
14
14
|
const _reacticons = require("@fluentui/react-icons");
|
|
15
15
|
const _reactutilities = require("@fluentui/react-utilities");
|
|
16
16
|
const _index = require("../Button/index");
|
|
17
|
-
const useMenuButton_unstable = (
|
|
18
|
-
|
|
19
|
-
const buttonState = (0, _index.useButton_unstable)(
|
|
20
|
-
// force aria-expanded to be a boolean, not a string
|
|
21
|
-
buttonState.root['aria-expanded'] = props['aria-expanded'] ? props['aria-expanded'] === 'true' || props['aria-expanded'] === true : false;
|
|
17
|
+
const useMenuButton_unstable = (props, ref)=>{
|
|
18
|
+
const { menuIcon, ...buttonProps } = props;
|
|
19
|
+
const buttonState = (0, _index.useButton_unstable)(buttonProps, ref);
|
|
22
20
|
return {
|
|
23
|
-
// Button state
|
|
24
21
|
...buttonState,
|
|
25
|
-
// State calculated from a set of props
|
|
26
22
|
iconOnly: Boolean(!props.children),
|
|
27
23
|
// Slots definition
|
|
28
24
|
components: {
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
26
|
+
...buttonState.components,
|
|
31
27
|
menuIcon: 'span'
|
|
32
28
|
},
|
|
29
|
+
root: {
|
|
30
|
+
...buttonState.root,
|
|
31
|
+
// force aria-expanded to be a boolean, not a string
|
|
32
|
+
'aria-expanded': props['aria-expanded'] ? props['aria-expanded'] === 'true' || props['aria-expanded'] === true : false
|
|
33
|
+
},
|
|
33
34
|
menuIcon: _reactutilities.slot.optional(menuIcon, {
|
|
34
35
|
defaultProps: {
|
|
35
36
|
children: /*#__PURE__*/ _react.createElement(_reacticons.ChevronDownRegular, null)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/MenuButton/useMenuButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport { slot } 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
|
|
1
|
+
{"version":3,"sources":["../src/components/MenuButton/useMenuButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ChevronDownRegular } from '@fluentui/react-icons';\nimport { slot } 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 props: MenuButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): MenuButtonState => {\n const { menuIcon, ...buttonProps } = props;\n const buttonState = useButton_unstable(buttonProps, ref);\n\n return {\n ...buttonState,\n iconOnly: Boolean(!props.children),\n\n // Slots definition\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...buttonState.components,\n menuIcon: 'span',\n },\n\n root: {\n ...buttonState.root,\n // force aria-expanded to be a boolean, not a string\n 'aria-expanded': props['aria-expanded']\n ? props['aria-expanded'] === 'true' || props['aria-expanded'] === true\n : false,\n },\n\n menuIcon: slot.optional(menuIcon, {\n defaultProps: {\n children: <ChevronDownRegular />,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","ChevronDownRegular","slot","useButton_unstable","useMenuButton_unstable","props","ref","menuIcon","buttonProps","buttonState","iconOnly","Boolean","children","components","root","optional","defaultProps","renderByDefault","elementType"],"mappings":"AAAA;;;;;+BAWaI;;;;;;;iEATU,QAAQ;4BACI,wBAAwB;gCACtC,4BAA4B;uBACd,kBAAkB;AAM9C,+BAA+B,CACpCC,OACAC;IAEA,MAAM,EAAEC,QAAQ,EAAE,GAAGC,aAAa,GAAGH;IACrC,MAAMI,kBAAcN,yBAAAA,EAAmBK,aAAaF;IAEpD,OAAO;QACL,GAAGG,WAAW;QACdC,UAAUC,QAAQ,CAACN,MAAMO,QAAQ;QAEjC,mBAAmB;QACnBC,YAAY;YACV,4DAA4D;YAC5D,GAAGJ,YAAYI,UAAU;YACzBN,UAAU;QACZ;QAEAO,MAAM;YACJ,GAAGL,YAAYK,IAAI;YACnB,oDAAoD;YACpD,iBAAiBT,KAAK,CAAC,gBAAgB,GACnCA,KAAK,CAAC,gBAAgB,KAAK,UAAUA,KAAK,CAAC,gBAAgB,KAAK,OAChE;QACN;QAEAE,UAAUL,oBAAAA,CAAKa,QAAQ,CAACR,UAAU;YAChCS,cAAc;gBACZJ,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACX,8BAAAA,EAAAA;YACb;YACAgB,iBAAiB;YACjBC,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -14,7 +14,7 @@ const _reactutilities = require("@fluentui/react-utilities");
|
|
|
14
14
|
const _Button = require("../Button/Button");
|
|
15
15
|
const _MenuButton = require("../MenuButton/MenuButton");
|
|
16
16
|
const useSplitButton_unstable = (props, ref)=>{
|
|
17
|
-
const { appearance = 'secondary', children, disabled = false, disabledFocusable = false, icon, iconPosition = 'before', menuButton, menuIcon, primaryActionButton, shape = 'rounded', size = 'medium' } = props;
|
|
17
|
+
const { appearance = 'secondary', children, disabled = false, disabledFocusable = false, icon, iconPosition = 'before', menuButton, menuIcon, primaryActionButton, shape = 'rounded', size = 'medium', ...rest } = props;
|
|
18
18
|
const baseId = (0, _reactutilities.useId)('splitButton-');
|
|
19
19
|
const menuButtonShorthand = _reactutilities.slot.optional(menuButton, {
|
|
20
20
|
defaultProps: {
|
|
@@ -61,10 +61,10 @@ const useSplitButton_unstable = (props, ref)=>{
|
|
|
61
61
|
menuButton: _MenuButton.MenuButton,
|
|
62
62
|
primaryActionButton: _Button.Button
|
|
63
63
|
},
|
|
64
|
-
root: _reactutilities.slot.always(
|
|
65
|
-
ref,
|
|
66
|
-
...
|
|
67
|
-
}
|
|
64
|
+
root: _reactutilities.slot.always({
|
|
65
|
+
ref: ref,
|
|
66
|
+
...rest
|
|
67
|
+
}, {
|
|
68
68
|
elementType: 'div'
|
|
69
69
|
}),
|
|
70
70
|
menuButton: menuButtonShorthand,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SplitButton/useSplitButton.ts"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../src/components/SplitButton/useSplitButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { useId, slot } 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 ...rest\n } = props;\n const baseId = useId('splitButton-');\n\n const menuButtonShorthand = slot.optional(menuButton, {\n defaultProps: {\n appearance,\n disabled,\n disabledFocusable,\n menuIcon,\n shape,\n size,\n },\n renderByDefault: true,\n elementType: MenuButton,\n });\n const primaryActionButtonShorthand = slot.optional(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 renderByDefault: true,\n elementType: Button,\n });\n\n // Resolve menu button's aria-labelledby to be labelled by the primary action button if no label was provided by the\n // 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, // Slots definition\n components: { root: 'div', menuButton: MenuButton, primaryActionButton: Button },\n root: slot.always({ ref: ref as React.Ref<HTMLDivElement>, ...rest }, { elementType: 'div' }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n"],"names":["React","useId","slot","Button","MenuButton","useSplitButton_unstable","props","ref","appearance","children","disabled","disabledFocusable","icon","iconPosition","menuButton","menuIcon","primaryActionButton","shape","size","rest","baseId","menuButtonShorthand","optional","defaultProps","renderByDefault","elementType","primaryActionButtonShorthand","id","components","root","always"],"mappings":";;;;+BAWaK;;;;;;;iEAXU,QAAQ;gCACH,4BAA4B;wBACjC,mBAAmB;4BACf,2BAA2B;AAQ/C,gCAAgC,CACrCC,OACAC;IAEA,MAAM,EACJC,aAAa,WAAW,EACxBC,QAAQ,EACRC,WAAW,KAAK,EAChBC,oBAAoB,KAAK,EACzBC,IAAI,EACJC,eAAe,QAAQ,EACvBC,UAAU,EACVC,QAAQ,EACRC,mBAAmB,EACnBC,QAAQ,SAAS,EACjBC,OAAO,QAAQ,EACf,GAAGC,MACJ,GAAGb;IACJ,MAAMc,aAASnB,qBAAAA,EAAM;IAErB,MAAMoB,sBAAsBnB,oBAAAA,CAAKoB,QAAQ,CAACR,YAAY;QACpDS,cAAc;YACZf;YACAE;YACAC;YACAI;YACAE;YACAC;QACF;QACAM,iBAAiB;QACjBC,aAAarB,sBAAAA;IACf;IACA,MAAMsB,+BAA+BxB,oBAAAA,CAAKoB,QAAQ,CAACN,qBAAqB;QACtEO,cAAc;YACZf;YACAC;YACAC;YACAC;YACAC;YACAC;YACAc,IAAIP,SAAS;YACbH;YACAC;QACF;QACAM,iBAAiB;QACjBC,aAAatB,cAAAA;IACf;IAEA,oHAAoH;IACpH,QAAQ;IACR,IACEkB,uBACAK,gCACA,CAACL,mBAAmB,CAAC,aAAa,IAClC,CAACA,mBAAmB,CAAC,kBAAkB,EACvC;QACAA,mBAAmB,CAAC,kBAAkB,GAAGK,6BAA6BC,EAAE;IAC1E;IAEA,OAAO;QACL,gCAAgC;QAChCnB;QACAE;QACAC;QACAE;QACAI;QACAC;QACAU,YAAY;YAAEC,MAAM;YAAOf,YAAYV,sBAAAA;YAAYY,qBAAqBb,cAAAA;QAAO;QAC/E0B,MAAM3B,oBAAAA,CAAK4B,MAAM,CAAC;YAAEvB,KAAKA;YAAkC,GAAGY,IAAI;QAAC,GAAG;YAAEM,aAAa;QAAM;QAC3FX,YAAYO;QACZL,qBAAqBU;IACvB;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToggleButton/ToggleButton.types.ts"],"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"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["../src/components/ToggleButton/ToggleButton.types.ts"],"sourcesContent":["import type { ButtonBaseProps, ButtonBaseState, 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 ToggleButtonBaseProps = ButtonBaseProps & Pick<ToggleButtonProps, 'defaultChecked' | 'checked'>;\n\nexport type ToggleButtonState = ButtonState & Required<Pick<ToggleButtonProps, 'checked'>>;\n\nexport type ToggleButtonBaseState = ButtonBaseState & Required<Pick<ToggleButtonProps, 'checked'>>;\n"],"names":[],"mappings":""}
|
|
@@ -18,6 +18,9 @@ _export(exports, {
|
|
|
18
18
|
toggleButtonClassNames: function() {
|
|
19
19
|
return _useToggleButtonStylesstyles.toggleButtonClassNames;
|
|
20
20
|
},
|
|
21
|
+
useToggleButtonBase_unstable: function() {
|
|
22
|
+
return _useToggleButton.useToggleButtonBase_unstable;
|
|
23
|
+
},
|
|
21
24
|
useToggleButtonStyles_unstable: function() {
|
|
22
25
|
return _useToggleButtonStylesstyles.useToggleButtonStyles_unstable;
|
|
23
26
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToggleButton/index.ts"],"sourcesContent":["export { ToggleButton } from './ToggleButton';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/ToggleButton/index.ts"],"sourcesContent":["export { ToggleButton } from './ToggleButton';\nexport type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n ToggleButtonState,\n ToggleButtonBaseState,\n} from './ToggleButton.types';\nexport { renderToggleButton_unstable } from './renderToggleButton';\nexport { useToggleButton_unstable, useToggleButtonBase_unstable } from './useToggleButton';\nexport { toggleButtonClassNames, useToggleButtonStyles_unstable } from './useToggleButtonStyles.styles';\n"],"names":["ToggleButton","renderToggleButton_unstable","useToggleButton_unstable","useToggleButtonBase_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,0BAAY;;;eAOZC,+CAA2B;;;eAE3BG,mDAAsB;;;eADID,6CAA4B;;;eAC9BE,2DAA8B;;;eADtDH,yCAAwB;;;8BARJ,iBAAiB;oCAOF,uBAAuB;iCACI,oBAAoB;6CACpB,iCAAiC"}
|
|
@@ -3,9 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function _export(target, all) {
|
|
7
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
useToggleButtonBase_unstable: function() {
|
|
14
|
+
return useToggleButtonBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useToggleButton_unstable: function() {
|
|
9
17
|
return useToggleButton_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
@@ -14,6 +22,12 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
|
14
22
|
const _useToggleState = require("../../utils/useToggleState");
|
|
15
23
|
const _useButton = require("../Button/useButton");
|
|
16
24
|
const useToggleButton_unstable = (props, ref)=>{
|
|
17
|
-
const
|
|
25
|
+
const { checked = false, defaultChecked = false, ...buttonProps } = props;
|
|
26
|
+
const buttonState = (0, _useButton.useButton_unstable)(buttonProps, ref);
|
|
27
|
+
return (0, _useToggleState.useToggleState)(props, buttonState);
|
|
28
|
+
};
|
|
29
|
+
const useToggleButtonBase_unstable = (props, ref)=>{
|
|
30
|
+
const { checked = false, defaultChecked = false, ...buttonProps } = props;
|
|
31
|
+
const buttonState = (0, _useButton.useButtonBase_unstable)(buttonProps, ref);
|
|
18
32
|
return (0, _useToggleState.useToggleState)(props, buttonState);
|
|
19
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToggleButton/useToggleButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useToggleState } from '../../utils/useToggleState';\nimport { useButton_unstable } from '../Button/useButton';\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_unstable = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n const buttonState = useButton_unstable(props, ref);\n\n return useToggleState(props, buttonState);\n};\n"],"names":["React","useToggleState","useButton_unstable","useToggleButton_unstable","props","ref","buttonState"],"mappings":"AAAA;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../src/components/ToggleButton/useToggleButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useToggleState } from '../../utils/useToggleState';\nimport { useButton_unstable, useButtonBase_unstable } from '../Button/useButton';\nimport type { ToggleButtonBaseState, 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_unstable = (\n props: ToggleButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonState => {\n const { checked = false, defaultChecked = false, ...buttonProps } = props;\n const buttonState = useButton_unstable(buttonProps, ref);\n\n return useToggleState(props, buttonState);\n};\n\n/**\n * Base hook for ToggleButton component, which manages state related to slots structure and ARIA attributes.\n *\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 useToggleButtonBase_unstable = (\n props: ToggleButtonProps,\n ref?: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ToggleButtonBaseState => {\n const { checked = false, defaultChecked = false, ...buttonProps } = props;\n const buttonState = useButtonBase_unstable(buttonProps, ref);\n\n return useToggleState(props, buttonState);\n};\n"],"names":["React","useToggleState","useButton_unstable","useButtonBase_unstable","useToggleButton_unstable","props","ref","checked","defaultChecked","buttonProps","buttonState","useToggleButtonBase_unstable"],"mappings":"AAAA;;;;;;;;;;;;IA6BaW,4BAAAA;;;4BAhBAP;;;;;iEAXU,QAAQ;gCACA,6BAA6B;2BACD,sBAAsB;AAS1E,MAAMA,2BAA2B,CACtCC,OACAC;IAEA,MAAM,EAAEC,UAAU,KAAK,EAAEC,iBAAiB,KAAK,EAAE,GAAGC,aAAa,GAAGJ;IACpE,MAAMK,kBAAcR,6BAAAA,EAAmBO,aAAaH;IAEpD,WAAOL,8BAAAA,EAAeI,OAAOK;AAC/B,EAAE;AAQK,qCAAqC,CAC1CL,OACAC;IAEA,MAAM,EAAEC,UAAU,KAAK,EAAEC,iBAAiB,KAAK,EAAE,GAAGC,aAAa,GAAGJ;IACpE,MAAMK,kBAAcP,iCAAAA,EAAuBM,aAAaH;IAExD,WAAOL,8BAAAA,EAAeI,OAAOK;AAC/B,EAAE"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -101,3 +101,8 @@ const _SplitButton = require("./SplitButton");
|
|
|
101
101
|
const _ToggleButton = require("./ToggleButton");
|
|
102
102
|
const _index = require("./utils/index");
|
|
103
103
|
const _index1 = require("./contexts/index");
|
|
104
|
+
// Experimental APIs - will be uncommented in the experimental release branch
|
|
105
|
+
// export { useButtonBase_unstable } from './Button';
|
|
106
|
+
// export type { ButtonBaseProps, ButtonBaseState } from './Button';
|
|
107
|
+
// export { useToggleButtonBase_unstable } from './ToggleButton';
|
|
108
|
+
// export type { ToggleButtonBaseProps, ToggleButtonBaseState } from './ToggleButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable","MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable","ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleState","ButtonContextProvider","useButtonContext"],"mappings":";;;;;;;;;;;IACEA,MAAM
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Button,\n buttonClassNames,\n renderButton_unstable,\n useButtonStyles_unstable,\n useButton_unstable,\n} from './Button';\nexport type { ButtonProps, ButtonSlots, ButtonState } from './Button';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './MenuButton';\nexport type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n} from './ToggleButton';\nexport type { ToggleButtonProps, ToggleButtonState } from './ToggleButton';\n\nexport { useToggleState } from './utils/index';\n\nexport { ButtonContextProvider, useButtonContext } from './contexts/index';\nexport type { ButtonContextValue } from './contexts/index';\n\n// Experimental APIs - will be uncommented in the experimental release branch\n// export { useButtonBase_unstable } from './Button';\n// export type { ButtonBaseProps, ButtonBaseState } from './Button';\n// export { useToggleButtonBase_unstable } from './ToggleButton';\n// export type { ToggleButtonBaseProps, ToggleButtonBaseState } from './ToggleButton';\n"],"names":["Button","buttonClassNames","renderButton_unstable","useButtonStyles_unstable","useButton_unstable","CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable","MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable","SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable","ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleState","ButtonContextProvider","useButtonContext"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;yBA0CsB;eAArB0B;;;eAlCPrB,8BAAc;;;eAQdK,sBAAU;;IAQVK;uCAAW;;IAQXK;yCAAY;;;eA/BZnB,wBAAgB;;;eAQhBK,wCAAwB;;IAQxBK,oBAAoB;;;;eAfpBT,6BAAqB;;;eAQrBK,6CAA6B;;;eAQ7BK,qCAAyB;;;eAOzBI,uCAA0B;;IAQ1BK;wDAA2B;;;eAP3BJ,kCAAqB;;;eAQrBK,oCAAsB;;;eAQQK,wBAAgB;;;eAvC9CxB,gCAAwB;;;eACxBC,0BAAkB;;IAOlBI;+DAAgC;;;eAChCC,0CAA0B;;;eAO1BI,wCAA4B;;;eAC5BC,kCAAsB;;;eAOtBI,0CAA6B;;;eAC7BC,oCAAuB;;;eAOvBI,4CAA8B;;IAC9BC;qDAAwB;;kBAIH;eAAdC;;;wBAnCF,WAAW;gCAQX,mBAAmB;4BAQnB,eAAe;6BAQf,gBAAgB;8BAQhB,iBAAiB;uBAGO,gBAAgB;wBAES,mBAAmB;CAG3E,6EAA6E;CAC7E,qDAAqD;CACrD,oEAAoE;CACpE,iEAAiE;CACjE,sFAAsF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-button",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"description": "Fluent UI React Button component.",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -11,22 +11,15 @@
|
|
|
11
11
|
"url": "https://github.com/microsoft/fluentui"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@fluentui/a11y-testing": "*",
|
|
16
|
-
"@fluentui/eslint-plugin": "*",
|
|
17
|
-
"@fluentui/react-conformance": "*",
|
|
18
|
-
"@fluentui/react-conformance-griffel": "*",
|
|
19
|
-
"@fluentui/scripts-api-extractor": "*"
|
|
20
|
-
},
|
|
21
14
|
"dependencies": {
|
|
22
15
|
"@fluentui/keyboard-keys": "^9.0.8",
|
|
23
|
-
"@fluentui/react-aria": "^9.17.
|
|
16
|
+
"@fluentui/react-aria": "^9.17.9",
|
|
24
17
|
"@fluentui/react-icons": "^2.0.245",
|
|
25
|
-
"@fluentui/react-jsx-runtime": "^9.
|
|
26
|
-
"@fluentui/react-shared-contexts": "^9.26.
|
|
27
|
-
"@fluentui/react-tabster": "^9.26.
|
|
28
|
-
"@fluentui/react-theme": "^9.2.
|
|
29
|
-
"@fluentui/react-utilities": "^9.26.
|
|
18
|
+
"@fluentui/react-jsx-runtime": "^9.4.0",
|
|
19
|
+
"@fluentui/react-shared-contexts": "^9.26.1",
|
|
20
|
+
"@fluentui/react-tabster": "^9.26.12",
|
|
21
|
+
"@fluentui/react-theme": "^9.2.1",
|
|
22
|
+
"@fluentui/react-utilities": "^9.26.1",
|
|
30
23
|
"@griffel/react": "^1.5.32",
|
|
31
24
|
"@swc/helpers": "^0.5.1"
|
|
32
25
|
},
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
export const buttonClassNames = {
|
|
3
|
-
root: 'fui-Button',
|
|
4
|
-
icon: 'fui-Button__icon'
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Attaches only semantic slot class names and state modifiers
|
|
8
|
-
*/ export const useButtonStyles_unstable = (state)=>{
|
|
9
|
-
'use no memo';
|
|
10
|
-
const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
|
|
11
|
-
state.root.className = [
|
|
12
|
-
buttonClassNames.root,
|
|
13
|
-
// Appearance
|
|
14
|
-
appearance && `${buttonClassNames.root}--${appearance}`,
|
|
15
|
-
// Size
|
|
16
|
-
`${buttonClassNames.root}--${size}`,
|
|
17
|
-
// Shape
|
|
18
|
-
`${buttonClassNames.root}--${shape}`,
|
|
19
|
-
// Disabled styles
|
|
20
|
-
disabled && `${buttonClassNames.root}--disabled`,
|
|
21
|
-
disabledFocusable && `${buttonClassNames.root}--disabledFocusable`,
|
|
22
|
-
// Icon styles
|
|
23
|
-
icon && iconPosition === 'before' && `${buttonClassNames.root}--iconBefore`,
|
|
24
|
-
icon && iconPosition === 'after' && `${buttonClassNames.root}--iconAfter`,
|
|
25
|
-
iconOnly && `${buttonClassNames.root}--iconOnly`,
|
|
26
|
-
// User provided class name
|
|
27
|
-
state.root.className
|
|
28
|
-
].filter(Boolean).join(' ');
|
|
29
|
-
if (state.icon) {
|
|
30
|
-
state.icon.className = [
|
|
31
|
-
buttonClassNames.icon,
|
|
32
|
-
state.icon.className
|
|
33
|
-
].filter(Boolean).join(' ');
|
|
34
|
-
}
|
|
35
|
-
return state;
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/useButtonStyles.styles.headless.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots, ButtonState } from './Button.types';\n\nexport const buttonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-Button',\n icon: 'fui-Button__icon',\n};\n\n/**\n * Attaches only semantic slot class names and state modifiers\n */\nexport const useButtonStyles_unstable = (state: ButtonState): ButtonState => {\n 'use no memo';\n\n const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;\n\n state.root.className = [\n buttonClassNames.root,\n\n // Appearance\n appearance && `${buttonClassNames.root}--${appearance}`,\n\n // Size\n `${buttonClassNames.root}--${size}`,\n\n // Shape\n `${buttonClassNames.root}--${shape}`,\n\n // Disabled styles\n disabled && `${buttonClassNames.root}--disabled`,\n disabledFocusable && `${buttonClassNames.root}--disabledFocusable`,\n\n // Icon styles\n icon && iconPosition === 'before' && `${buttonClassNames.root}--iconBefore`,\n icon && iconPosition === 'after' && `${buttonClassNames.root}--iconAfter`,\n iconOnly && `${buttonClassNames.root}--iconOnly`,\n\n // User provided class name\n state.root.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n if (state.icon) {\n state.icon.className = [buttonClassNames.icon, state.icon.className].filter(Boolean).join(' ');\n }\n\n return state;\n};\n"],"names":["buttonClassNames","root","icon","useButtonStyles_unstable","state","appearance","disabled","disabledFocusable","iconOnly","iconPosition","shape","size","className","filter","Boolean","join"],"mappings":"AAAA;AAKA,OAAO,MAAMA,mBAAgD;IAC3DC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvC;IAEA,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEL,IAAI,EAAEM,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP;IAE/FA,MAAMH,IAAI,CAACW,SAAS,GAAG;QACrBZ,iBAAiBC,IAAI;QAErB,aAAa;QACbI,cAAc,GAAGL,iBAAiBC,IAAI,CAAC,EAAE,EAAEI,YAAY;QAEvD,OAAO;QACP,GAAGL,iBAAiBC,IAAI,CAAC,EAAE,EAAEU,MAAM;QAEnC,QAAQ;QACR,GAAGX,iBAAiBC,IAAI,CAAC,EAAE,EAAES,OAAO;QAEpC,kBAAkB;QAClBJ,YAAY,GAAGN,iBAAiBC,IAAI,CAAC,UAAU,CAAC;QAChDM,qBAAqB,GAAGP,iBAAiBC,IAAI,CAAC,mBAAmB,CAAC;QAElE,cAAc;QACdC,QAAQO,iBAAiB,YAAY,GAAGT,iBAAiBC,IAAI,CAAC,YAAY,CAAC;QAC3EC,QAAQO,iBAAiB,WAAW,GAAGT,iBAAiBC,IAAI,CAAC,WAAW,CAAC;QACzEO,YAAY,GAAGR,iBAAiBC,IAAI,CAAC,UAAU,CAAC;QAEhD,2BAA2B;QAC3BG,MAAMH,IAAI,CAACW,SAAS;KACrB,CACEC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMF,IAAI,EAAE;QACdE,MAAMF,IAAI,CAACU,SAAS,GAAG;YAACZ,iBAAiBE,IAAI;YAAEE,MAAMF,IAAI,CAACU,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IAC5F;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
export const buttonClassNames = {
|
|
3
|
-
root: 'fui-Button',
|
|
4
|
-
icon: 'fui-Button__icon'
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Attaches only semantic slot class names and state modifiers
|
|
8
|
-
*/ export const useButtonStyles_unstable = (state)=>{
|
|
9
|
-
'use no memo';
|
|
10
|
-
const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
|
|
11
|
-
state.root.className = [
|
|
12
|
-
buttonClassNames.root,
|
|
13
|
-
// Appearance
|
|
14
|
-
appearance && `${buttonClassNames.root}--${appearance}`,
|
|
15
|
-
// Size
|
|
16
|
-
`${buttonClassNames.root}--${size}`,
|
|
17
|
-
// Shape
|
|
18
|
-
`${buttonClassNames.root}--${shape}`,
|
|
19
|
-
// Disabled styles
|
|
20
|
-
disabled && `${buttonClassNames.root}--disabled`,
|
|
21
|
-
disabledFocusable && `${buttonClassNames.root}--disabledFocusable`,
|
|
22
|
-
// Icon styles
|
|
23
|
-
icon && iconPosition === 'before' && `${buttonClassNames.root}--iconBefore`,
|
|
24
|
-
icon && iconPosition === 'after' && `${buttonClassNames.root}--iconAfter`,
|
|
25
|
-
iconOnly && `${buttonClassNames.root}--iconOnly`,
|
|
26
|
-
// User provided class name
|
|
27
|
-
state.root.className
|
|
28
|
-
].filter(Boolean).join(' ');
|
|
29
|
-
if (state.icon) {
|
|
30
|
-
state.icon.className = [
|
|
31
|
-
buttonClassNames.icon,
|
|
32
|
-
state.icon.className
|
|
33
|
-
].filter(Boolean).join(' ');
|
|
34
|
-
}
|
|
35
|
-
return state;
|
|
36
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/useButtonStyles.styles.headless.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { ButtonSlots, ButtonState } from './Button.types';\n\nexport const buttonClassNames: SlotClassNames<ButtonSlots> = {\n root: 'fui-Button',\n icon: 'fui-Button__icon',\n};\n\n/**\n * Attaches only semantic slot class names and state modifiers\n */\nexport const useButtonStyles_unstable = (state: ButtonState): ButtonState => {\n 'use no memo';\n\n const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;\n\n state.root.className = [\n buttonClassNames.root,\n\n // Appearance\n appearance && `${buttonClassNames.root}--${appearance}`,\n\n // Size\n `${buttonClassNames.root}--${size}`,\n\n // Shape\n `${buttonClassNames.root}--${shape}`,\n\n // Disabled styles\n disabled && `${buttonClassNames.root}--disabled`,\n disabledFocusable && `${buttonClassNames.root}--disabledFocusable`,\n\n // Icon styles\n icon && iconPosition === 'before' && `${buttonClassNames.root}--iconBefore`,\n icon && iconPosition === 'after' && `${buttonClassNames.root}--iconAfter`,\n iconOnly && `${buttonClassNames.root}--iconOnly`,\n\n // User provided class name\n state.root.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n if (state.icon) {\n state.icon.className = [buttonClassNames.icon, state.icon.className].filter(Boolean).join(' ');\n }\n\n return state;\n};\n"],"names":["buttonClassNames","root","icon","useButtonStyles_unstable","state","appearance","disabled","disabledFocusable","iconOnly","iconPosition","shape","size","className","filter","Boolean","join"],"mappings":"AAAA;AAKA,OAAO,MAAMA,mBAAgD;IAC3DC,MAAM;IACNC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvC;IAEA,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEL,IAAI,EAAEM,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP;IAE/FA,MAAMH,IAAI,CAACW,SAAS,GAAG;QACrBZ,iBAAiBC,IAAI;QAErB,aAAa;QACbI,cAAc,GAAGL,iBAAiBC,IAAI,CAAC,EAAE,EAAEI,YAAY;QAEvD,OAAO;QACP,GAAGL,iBAAiBC,IAAI,CAAC,EAAE,EAAEU,MAAM;QAEnC,QAAQ;QACR,GAAGX,iBAAiBC,IAAI,CAAC,EAAE,EAAES,OAAO;QAEpC,kBAAkB;QAClBJ,YAAY,GAAGN,iBAAiBC,IAAI,CAAC,UAAU,CAAC;QAChDM,qBAAqB,GAAGP,iBAAiBC,IAAI,CAAC,mBAAmB,CAAC;QAElE,cAAc;QACdC,QAAQO,iBAAiB,YAAY,GAAGT,iBAAiBC,IAAI,CAAC,YAAY,CAAC;QAC3EC,QAAQO,iBAAiB,WAAW,GAAGT,iBAAiBC,IAAI,CAAC,WAAW,CAAC;QACzEO,YAAY,GAAGR,iBAAiBC,IAAI,CAAC,UAAU,CAAC;QAEhD,2BAA2B;QAC3BG,MAAMH,IAAI,CAACW,SAAS;KACrB,CACEC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMF,IAAI,EAAE;QACdE,MAAMF,IAAI,CAACU,SAAS,GAAG;YAACZ,iBAAiBE,IAAI;YAAEE,MAAMF,IAAI,CAACU,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IAC5F;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
// Re-export the same slot class names mapping used by the griffel styles file
|
|
3
|
-
export const compoundButtonClassNames = {
|
|
4
|
-
root: 'fui-CompoundButton',
|
|
5
|
-
icon: 'fui-CompoundButton__icon',
|
|
6
|
-
contentContainer: 'fui-CompoundButton__contentContainer',
|
|
7
|
-
secondaryContent: 'fui-CompoundButton__secondaryContent'
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Attaches only semantic slot class names and state modifiers
|
|
11
|
-
*/ export const useCompoundButtonStyles_unstable = (state)=>{
|
|
12
|
-
'use no memo';
|
|
13
|
-
const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
|
|
14
|
-
state.root.className = [
|
|
15
|
-
compoundButtonClassNames.root,
|
|
16
|
-
// Appearance
|
|
17
|
-
appearance && `${compoundButtonClassNames.root}--${appearance}`,
|
|
18
|
-
// Size
|
|
19
|
-
size && `${compoundButtonClassNames.root}--${size}`,
|
|
20
|
-
// Shape
|
|
21
|
-
shape && `${compoundButtonClassNames.root}--${shape}`,
|
|
22
|
-
// Disabled styles
|
|
23
|
-
disabled && `${compoundButtonClassNames.root}--disabled`,
|
|
24
|
-
disabledFocusable && `${compoundButtonClassNames.root}--disabledFocusable`,
|
|
25
|
-
// Icon styles
|
|
26
|
-
icon && iconPosition === 'before' && `${compoundButtonClassNames.root}--iconBefore`,
|
|
27
|
-
icon && iconPosition === 'after' && `${compoundButtonClassNames.root}--iconAfter`,
|
|
28
|
-
icon && iconOnly && `${compoundButtonClassNames.root}--iconOnly`,
|
|
29
|
-
// User provided class name
|
|
30
|
-
state.root.className
|
|
31
|
-
].filter(Boolean).join(' ');
|
|
32
|
-
if (state.icon) {
|
|
33
|
-
state.icon.className = [
|
|
34
|
-
compoundButtonClassNames.icon,
|
|
35
|
-
state.icon.className
|
|
36
|
-
].filter(Boolean).join(' ');
|
|
37
|
-
}
|
|
38
|
-
state.contentContainer.className = [
|
|
39
|
-
compoundButtonClassNames.contentContainer,
|
|
40
|
-
state.contentContainer.className
|
|
41
|
-
].filter(Boolean).join(' ');
|
|
42
|
-
if (state.secondaryContent) {
|
|
43
|
-
state.secondaryContent.className = [
|
|
44
|
-
compoundButtonClassNames.secondaryContent,
|
|
45
|
-
state.secondaryContent.className
|
|
46
|
-
].filter(Boolean).join(' ');
|
|
47
|
-
}
|
|
48
|
-
return state;
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/useCompoundButtonStyles.styles.headless.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\n\n// Re-export the same slot class names mapping used by the griffel styles file\nexport const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots> = {\n root: 'fui-CompoundButton',\n icon: 'fui-CompoundButton__icon',\n contentContainer: 'fui-CompoundButton__contentContainer',\n secondaryContent: 'fui-CompoundButton__secondaryContent',\n};\n\n/**\n * Attaches only semantic slot class names and state modifiers\n */\nexport const useCompoundButtonStyles_unstable = (state: CompoundButtonState): CompoundButtonState => {\n 'use no memo';\n\n const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;\n\n state.root.className = [\n compoundButtonClassNames.root,\n\n // Appearance\n appearance && `${compoundButtonClassNames.root}--${appearance}`,\n\n // Size\n size && `${compoundButtonClassNames.root}--${size}`,\n\n // Shape\n shape && `${compoundButtonClassNames.root}--${shape}`,\n\n // Disabled styles\n disabled && `${compoundButtonClassNames.root}--disabled`,\n disabledFocusable && `${compoundButtonClassNames.root}--disabledFocusable`,\n\n // Icon styles\n icon && iconPosition === 'before' && `${compoundButtonClassNames.root}--iconBefore`,\n icon && iconPosition === 'after' && `${compoundButtonClassNames.root}--iconAfter`,\n icon && iconOnly && `${compoundButtonClassNames.root}--iconOnly`,\n\n // User provided class name\n state.root.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n if (state.icon) {\n state.icon.className = [compoundButtonClassNames.icon, state.icon.className].filter(Boolean).join(' ');\n }\n\n state.contentContainer.className = [compoundButtonClassNames.contentContainer, state.contentContainer.className]\n .filter(Boolean)\n .join(' ');\n\n if (state.secondaryContent) {\n state.secondaryContent.className = [compoundButtonClassNames.secondaryContent, state.secondaryContent.className]\n .filter(Boolean)\n .join(' ');\n }\n\n return state;\n};\n"],"names":["compoundButtonClassNames","root","icon","contentContainer","secondaryContent","useCompoundButtonStyles_unstable","state","appearance","disabled","disabledFocusable","iconOnly","iconPosition","shape","size","className","filter","Boolean","join"],"mappings":"AAAA;AAKA,8EAA8E;AAC9E,OAAO,MAAMA,2BAAgE;IAC3EC,MAAM;IACNC,MAAM;IACNC,kBAAkB;IAClBC,kBAAkB;AACpB,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEP,IAAI,EAAEQ,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP;IAE/FA,MAAML,IAAI,CAACa,SAAS,GAAG;QACrBd,yBAAyBC,IAAI;QAE7B,aAAa;QACbM,cAAc,GAAGP,yBAAyBC,IAAI,CAAC,EAAE,EAAEM,YAAY;QAE/D,OAAO;QACPM,QAAQ,GAAGb,yBAAyBC,IAAI,CAAC,EAAE,EAAEY,MAAM;QAEnD,QAAQ;QACRD,SAAS,GAAGZ,yBAAyBC,IAAI,CAAC,EAAE,EAAEW,OAAO;QAErD,kBAAkB;QAClBJ,YAAY,GAAGR,yBAAyBC,IAAI,CAAC,UAAU,CAAC;QACxDQ,qBAAqB,GAAGT,yBAAyBC,IAAI,CAAC,mBAAmB,CAAC;QAE1E,cAAc;QACdC,QAAQS,iBAAiB,YAAY,GAAGX,yBAAyBC,IAAI,CAAC,YAAY,CAAC;QACnFC,QAAQS,iBAAiB,WAAW,GAAGX,yBAAyBC,IAAI,CAAC,WAAW,CAAC;QACjFC,QAAQQ,YAAY,GAAGV,yBAAyBC,IAAI,CAAC,UAAU,CAAC;QAEhE,2BAA2B;QAC3BK,MAAML,IAAI,CAACa,SAAS;KACrB,CACEC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMJ,IAAI,EAAE;QACdI,MAAMJ,IAAI,CAACY,SAAS,GAAG;YAACd,yBAAyBE,IAAI;YAAEI,MAAMJ,IAAI,CAACY,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IACpG;IAEAX,MAAMH,gBAAgB,CAACW,SAAS,GAAG;QAACd,yBAAyBG,gBAAgB;QAAEG,MAAMH,gBAAgB,CAACW,SAAS;KAAC,CAC7GC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMF,gBAAgB,EAAE;QAC1BE,MAAMF,gBAAgB,CAACU,SAAS,GAAG;YAACd,yBAAyBI,gBAAgB;YAAEE,MAAMF,gBAAgB,CAACU,SAAS;SAAC,CAC7GC,MAAM,CAACC,SACPC,IAAI,CAAC;IACV;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
// Re-export the same slot class names mapping used by the griffel styles file
|
|
3
|
-
export const compoundButtonClassNames = {
|
|
4
|
-
root: 'fui-CompoundButton',
|
|
5
|
-
icon: 'fui-CompoundButton__icon',
|
|
6
|
-
contentContainer: 'fui-CompoundButton__contentContainer',
|
|
7
|
-
secondaryContent: 'fui-CompoundButton__secondaryContent'
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Attaches only semantic slot class names and state modifiers
|
|
11
|
-
*/ export const useCompoundButtonStyles_unstable = (state)=>{
|
|
12
|
-
'use no memo';
|
|
13
|
-
const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;
|
|
14
|
-
state.root.className = [
|
|
15
|
-
compoundButtonClassNames.root,
|
|
16
|
-
// Appearance
|
|
17
|
-
appearance && `${compoundButtonClassNames.root}--${appearance}`,
|
|
18
|
-
// Size
|
|
19
|
-
size && `${compoundButtonClassNames.root}--${size}`,
|
|
20
|
-
// Shape
|
|
21
|
-
shape && `${compoundButtonClassNames.root}--${shape}`,
|
|
22
|
-
// Disabled styles
|
|
23
|
-
disabled && `${compoundButtonClassNames.root}--disabled`,
|
|
24
|
-
disabledFocusable && `${compoundButtonClassNames.root}--disabledFocusable`,
|
|
25
|
-
// Icon styles
|
|
26
|
-
icon && iconPosition === 'before' && `${compoundButtonClassNames.root}--iconBefore`,
|
|
27
|
-
icon && iconPosition === 'after' && `${compoundButtonClassNames.root}--iconAfter`,
|
|
28
|
-
icon && iconOnly && `${compoundButtonClassNames.root}--iconOnly`,
|
|
29
|
-
// User provided class name
|
|
30
|
-
state.root.className
|
|
31
|
-
].filter(Boolean).join(' ');
|
|
32
|
-
if (state.icon) {
|
|
33
|
-
state.icon.className = [
|
|
34
|
-
compoundButtonClassNames.icon,
|
|
35
|
-
state.icon.className
|
|
36
|
-
].filter(Boolean).join(' ');
|
|
37
|
-
}
|
|
38
|
-
state.contentContainer.className = [
|
|
39
|
-
compoundButtonClassNames.contentContainer,
|
|
40
|
-
state.contentContainer.className
|
|
41
|
-
].filter(Boolean).join(' ');
|
|
42
|
-
if (state.secondaryContent) {
|
|
43
|
-
state.secondaryContent.className = [
|
|
44
|
-
compoundButtonClassNames.secondaryContent,
|
|
45
|
-
state.secondaryContent.className
|
|
46
|
-
].filter(Boolean).join(' ');
|
|
47
|
-
}
|
|
48
|
-
return state;
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/useCompoundButtonStyles.styles.headless.ts"],"sourcesContent":["'use client';\n\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\n\n// Re-export the same slot class names mapping used by the griffel styles file\nexport const compoundButtonClassNames: SlotClassNames<CompoundButtonSlots> = {\n root: 'fui-CompoundButton',\n icon: 'fui-CompoundButton__icon',\n contentContainer: 'fui-CompoundButton__contentContainer',\n secondaryContent: 'fui-CompoundButton__secondaryContent',\n};\n\n/**\n * Attaches only semantic slot class names and state modifiers\n */\nexport const useCompoundButtonStyles_unstable = (state: CompoundButtonState): CompoundButtonState => {\n 'use no memo';\n\n const { appearance, disabled, disabledFocusable, icon, iconOnly, iconPosition, shape, size } = state;\n\n state.root.className = [\n compoundButtonClassNames.root,\n\n // Appearance\n appearance && `${compoundButtonClassNames.root}--${appearance}`,\n\n // Size\n size && `${compoundButtonClassNames.root}--${size}`,\n\n // Shape\n shape && `${compoundButtonClassNames.root}--${shape}`,\n\n // Disabled styles\n disabled && `${compoundButtonClassNames.root}--disabled`,\n disabledFocusable && `${compoundButtonClassNames.root}--disabledFocusable`,\n\n // Icon styles\n icon && iconPosition === 'before' && `${compoundButtonClassNames.root}--iconBefore`,\n icon && iconPosition === 'after' && `${compoundButtonClassNames.root}--iconAfter`,\n icon && iconOnly && `${compoundButtonClassNames.root}--iconOnly`,\n\n // User provided class name\n state.root.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n if (state.icon) {\n state.icon.className = [compoundButtonClassNames.icon, state.icon.className].filter(Boolean).join(' ');\n }\n\n state.contentContainer.className = [compoundButtonClassNames.contentContainer, state.contentContainer.className]\n .filter(Boolean)\n .join(' ');\n\n if (state.secondaryContent) {\n state.secondaryContent.className = [compoundButtonClassNames.secondaryContent, state.secondaryContent.className]\n .filter(Boolean)\n .join(' ');\n }\n\n return state;\n};\n"],"names":["compoundButtonClassNames","root","icon","contentContainer","secondaryContent","useCompoundButtonStyles_unstable","state","appearance","disabled","disabledFocusable","iconOnly","iconPosition","shape","size","className","filter","Boolean","join"],"mappings":"AAAA;AAKA,8EAA8E;AAC9E,OAAO,MAAMA,2BAAgE;IAC3EC,MAAM;IACNC,MAAM;IACNC,kBAAkB;IAClBC,kBAAkB;AACpB,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEP,IAAI,EAAEQ,QAAQ,EAAEC,YAAY,EAAEC,KAAK,EAAEC,IAAI,EAAE,GAAGP;IAE/FA,MAAML,IAAI,CAACa,SAAS,GAAG;QACrBd,yBAAyBC,IAAI;QAE7B,aAAa;QACbM,cAAc,GAAGP,yBAAyBC,IAAI,CAAC,EAAE,EAAEM,YAAY;QAE/D,OAAO;QACPM,QAAQ,GAAGb,yBAAyBC,IAAI,CAAC,EAAE,EAAEY,MAAM;QAEnD,QAAQ;QACRD,SAAS,GAAGZ,yBAAyBC,IAAI,CAAC,EAAE,EAAEW,OAAO;QAErD,kBAAkB;QAClBJ,YAAY,GAAGR,yBAAyBC,IAAI,CAAC,UAAU,CAAC;QACxDQ,qBAAqB,GAAGT,yBAAyBC,IAAI,CAAC,mBAAmB,CAAC;QAE1E,cAAc;QACdC,QAAQS,iBAAiB,YAAY,GAAGX,yBAAyBC,IAAI,CAAC,YAAY,CAAC;QACnFC,QAAQS,iBAAiB,WAAW,GAAGX,yBAAyBC,IAAI,CAAC,WAAW,CAAC;QACjFC,QAAQQ,YAAY,GAAGV,yBAAyBC,IAAI,CAAC,UAAU,CAAC;QAEhE,2BAA2B;QAC3BK,MAAML,IAAI,CAACa,SAAS;KACrB,CACEC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMJ,IAAI,EAAE;QACdI,MAAMJ,IAAI,CAACY,SAAS,GAAG;YAACd,yBAAyBE,IAAI;YAAEI,MAAMJ,IAAI,CAACY,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IACpG;IAEAX,MAAMH,gBAAgB,CAACW,SAAS,GAAG;QAACd,yBAAyBG,gBAAgB;QAAEG,MAAMH,gBAAgB,CAACW,SAAS;KAAC,CAC7GC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMF,gBAAgB,EAAE;QAC1BE,MAAMF,gBAAgB,CAACU,SAAS,GAAG;YAACd,yBAAyBI,gBAAgB;YAAEE,MAAMF,gBAAgB,CAACU,SAAS;SAAC,CAC7GC,MAAM,CAACC,SACPC,IAAI,CAAC;IACV;IAEA,OAAOX;AACT,EAAE"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
export const menuButtonClassNames = {
|
|
3
|
-
root: 'fui-MenuButton',
|
|
4
|
-
icon: 'fui-MenuButton__icon',
|
|
5
|
-
menuIcon: 'fui-MenuButton__menuIcon'
|
|
6
|
-
};
|
|
7
|
-
/**
|
|
8
|
-
* Attaches only semantic slot class names and state modifiers
|
|
9
|
-
*/ export const useMenuButtonStyles_unstable = (state)=>{
|
|
10
|
-
'use no memo';
|
|
11
|
-
const { appearance, disabled, disabledFocusable, shape, size, icon, iconOnly } = state;
|
|
12
|
-
const expanded = !!state.root['aria-expanded'];
|
|
13
|
-
state.root.className = [
|
|
14
|
-
menuButtonClassNames.root,
|
|
15
|
-
// Appearance
|
|
16
|
-
appearance && `${menuButtonClassNames.root}--${appearance}`,
|
|
17
|
-
// Size
|
|
18
|
-
size && `${menuButtonClassNames.root}--${size}`,
|
|
19
|
-
// Shape
|
|
20
|
-
shape && `${menuButtonClassNames.root}--${shape}`,
|
|
21
|
-
// Disabled styles
|
|
22
|
-
disabled && `${menuButtonClassNames.root}--disabled`,
|
|
23
|
-
disabledFocusable && `${menuButtonClassNames.root}--disabledFocusable`,
|
|
24
|
-
// Expanded
|
|
25
|
-
expanded && `${menuButtonClassNames.root}--expanded`,
|
|
26
|
-
// Icons
|
|
27
|
-
icon && iconOnly && `${menuButtonClassNames.root}--iconOnly`,
|
|
28
|
-
// User provided class name
|
|
29
|
-
state.root.className
|
|
30
|
-
].filter(Boolean).join(' ');
|
|
31
|
-
if (state.icon) {
|
|
32
|
-
state.icon.className = [
|
|
33
|
-
menuButtonClassNames.icon,
|
|
34
|
-
state.icon.className
|
|
35
|
-
].filter(Boolean).join(' ');
|
|
36
|
-
}
|
|
37
|
-
if (state.menuIcon) {
|
|
38
|
-
state.menuIcon.className = [
|
|
39
|
-
menuButtonClassNames.menuIcon,
|
|
40
|
-
state.menuIcon.className
|
|
41
|
-
].filter(Boolean).join(' ');
|
|
42
|
-
}
|
|
43
|
-
return state;
|
|
44
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/MenuButton/useMenuButtonStyles.styles.headless.ts"],"sourcesContent":["'use client';\n\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\n/**\n * Attaches only semantic slot class names and state modifiers\n */\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n 'use no memo';\n\n const { appearance, disabled, disabledFocusable, shape, size, icon, iconOnly } = state;\n const expanded = !!state.root['aria-expanded'];\n\n state.root.className = [\n menuButtonClassNames.root,\n\n // Appearance\n appearance && `${menuButtonClassNames.root}--${appearance}`,\n\n // Size\n size && `${menuButtonClassNames.root}--${size}`,\n\n // Shape\n shape && `${menuButtonClassNames.root}--${shape}`,\n\n // Disabled styles\n disabled && `${menuButtonClassNames.root}--disabled`,\n disabledFocusable && `${menuButtonClassNames.root}--disabledFocusable`,\n\n // Expanded\n expanded && `${menuButtonClassNames.root}--expanded`,\n\n // Icons\n icon && iconOnly && `${menuButtonClassNames.root}--iconOnly`,\n\n // User provided class name\n state.root.className,\n ]\n .filter(Boolean)\n .join(' ');\n\n if (state.icon) {\n state.icon.className = [menuButtonClassNames.icon, state.icon.className].filter(Boolean).join(' ');\n }\n\n if (state.menuIcon) {\n state.menuIcon.className = [menuButtonClassNames.menuIcon, state.menuIcon.className].filter(Boolean).join(' ');\n }\n\n return state;\n};\n"],"names":["menuButtonClassNames","root","icon","menuIcon","useMenuButtonStyles_unstable","state","appearance","disabled","disabledFocusable","shape","size","iconOnly","expanded","className","filter","Boolean","join"],"mappings":"AAAA;AAKA,OAAO,MAAMA,uBAAwD;IACnEC,MAAM;IACNC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAACC;IAC3C;IAEA,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,iBAAiB,EAAEC,KAAK,EAAEC,IAAI,EAAER,IAAI,EAAES,QAAQ,EAAE,GAAGN;IACjF,MAAMO,WAAW,CAAC,CAACP,MAAMJ,IAAI,CAAC,gBAAgB;IAE9CI,MAAMJ,IAAI,CAACY,SAAS,GAAG;QACrBb,qBAAqBC,IAAI;QAEzB,aAAa;QACbK,cAAc,GAAGN,qBAAqBC,IAAI,CAAC,EAAE,EAAEK,YAAY;QAE3D,OAAO;QACPI,QAAQ,GAAGV,qBAAqBC,IAAI,CAAC,EAAE,EAAES,MAAM;QAE/C,QAAQ;QACRD,SAAS,GAAGT,qBAAqBC,IAAI,CAAC,EAAE,EAAEQ,OAAO;QAEjD,kBAAkB;QAClBF,YAAY,GAAGP,qBAAqBC,IAAI,CAAC,UAAU,CAAC;QACpDO,qBAAqB,GAAGR,qBAAqBC,IAAI,CAAC,mBAAmB,CAAC;QAEtE,WAAW;QACXW,YAAY,GAAGZ,qBAAqBC,IAAI,CAAC,UAAU,CAAC;QAEpD,QAAQ;QACRC,QAAQS,YAAY,GAAGX,qBAAqBC,IAAI,CAAC,UAAU,CAAC;QAE5D,2BAA2B;QAC3BI,MAAMJ,IAAI,CAACY,SAAS;KACrB,CACEC,MAAM,CAACC,SACPC,IAAI,CAAC;IAER,IAAIX,MAAMH,IAAI,EAAE;QACdG,MAAMH,IAAI,CAACW,SAAS,GAAG;YAACb,qBAAqBE,IAAI;YAAEG,MAAMH,IAAI,CAACW,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IAChG;IAEA,IAAIX,MAAMF,QAAQ,EAAE;QAClBE,MAAMF,QAAQ,CAACU,SAAS,GAAG;YAACb,qBAAqBG,QAAQ;YAAEE,MAAMF,QAAQ,CAACU,SAAS;SAAC,CAACC,MAAM,CAACC,SAASC,IAAI,CAAC;IAC5G;IAEA,OAAOX;AACT,EAAE"}
|