@fluentui/react-button 9.8.0 → 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 +13 -2
- package/dist/index.d.ts +1 -1
- package/lib/CompoundButton.js +1 -1
- package/lib/CompoundButton.js.map +1 -1
- package/lib/MenuButton.js +1 -1
- package/lib/MenuButton.js.map +1 -1
- package/lib/SplitButton.js +1 -1
- package/lib/SplitButton.js.map +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 -2
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/useButton.js +34 -4
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js +0 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js +23 -10
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js +0 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js +24 -14
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js +0 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js +53 -16
- 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 -2
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js +16 -13
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/lib-commonjs/CompoundButton.js +0 -3
- package/lib-commonjs/CompoundButton.js.map +1 -1
- package/lib-commonjs/MenuButton.js +0 -3
- package/lib-commonjs/MenuButton.js.map +1 -1
- package/lib-commonjs/SplitButton.js +0 -3
- package/lib-commonjs/SplitButton.js.map +1 -1
- 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 +1 -2
- package/lib-commonjs/components/Button/index.js.map +1 -1
- package/lib-commonjs/components/Button/useButton.js +40 -7
- package/lib-commonjs/components/Button/useButton.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.js +0 -4
- package/lib-commonjs/components/CompoundButton/index.js.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js +23 -10
- package/lib-commonjs/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib-commonjs/components/MenuButton/index.js +0 -4
- package/lib-commonjs/components/MenuButton/index.js.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.js +24 -14
- package/lib-commonjs/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib-commonjs/components/SplitButton/index.js +0 -4
- package/lib-commonjs/components/SplitButton/index.js.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.js +53 -16
- 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 +1 -2
- package/lib-commonjs/components/ToggleButton/index.js.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.js +21 -15
- package/lib-commonjs/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib-commonjs/index.js +0 -6
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +3 -3
- package/lib/components/Button/useButtonBase.js +0 -34
- package/lib/components/Button/useButtonBase.js.map +0 -1
- package/lib/components/CompoundButton/useCompoundButtonBase.js +0 -31
- package/lib/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
- package/lib/components/MenuButton/useMenuButtonBase.js +0 -27
- package/lib/components/MenuButton/useMenuButtonBase.js.map +0 -1
- package/lib/components/SplitButton/useSplitButtonBase.js +0 -57
- package/lib/components/SplitButton/useSplitButtonBase.js.map +0 -1
- package/lib/components/ToggleButton/useToggleButtonBase.js +0 -13
- package/lib/components/ToggleButton/useToggleButtonBase.js.map +0 -1
- package/lib-commonjs/components/Button/useButtonBase.js +0 -41
- package/lib-commonjs/components/Button/useButtonBase.js.map +0 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonBase.js +0 -38
- package/lib-commonjs/components/CompoundButton/useCompoundButtonBase.js.map +0 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonBase.js +0 -36
- package/lib-commonjs/components/MenuButton/useMenuButtonBase.js.map +0 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonBase.js +0 -64
- package/lib-commonjs/components/SplitButton/useSplitButtonBase.js.map +0 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js +0 -19
- package/lib-commonjs/components/ToggleButton/useToggleButtonBase.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -8,11 +8,5 @@ export { ButtonContextProvider, useButtonContext } from './contexts/index';
|
|
|
8
8
|
// Experimental APIs - will be uncommented in the experimental release branch
|
|
9
9
|
// export { useButtonBase_unstable } from './Button';
|
|
10
10
|
// export type { ButtonBaseProps, ButtonBaseState } from './Button';
|
|
11
|
-
// export { useCompoundButtonBase_unstable } from './CompoundButton';
|
|
12
|
-
// export type { CompoundButtonBaseProps, CompoundButtonBaseState } from './CompoundButton';
|
|
13
|
-
// export { useMenuButtonBase_unstable } from './MenuButton';
|
|
14
|
-
// export type { MenuButtonBaseProps, MenuButtonBaseState } from './MenuButton';
|
|
15
|
-
// export { useSplitButtonBase_unstable } from './SplitButton';
|
|
16
|
-
// export type { SplitButtonBaseProps, SplitButtonBaseState } from './SplitButton';
|
|
17
11
|
// export { useToggleButtonBase_unstable } from './ToggleButton';
|
|
18
12
|
// export type { ToggleButtonBaseProps, ToggleButtonBaseState } from './ToggleButton';
|
package/lib/index.js.map
CHANGED
|
@@ -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\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 {
|
|
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":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW;AAElB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,mBAAmB;AAE1B,SACEC,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SACEC,WAAW,EACXC,0BAA0B,EAC1BC,qBAAqB,EACrBC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAEvB,SACEC,YAAY,EACZC,2BAA2B,EAC3BC,sBAAsB,EACtBC,8BAA8B,EAC9BC,wBAAwB,QACnB,iBAAiB;AAGxB,SAASC,cAAc,QAAQ,gBAAgB;AAE/C,SAASC,qBAAqB,EAAEC,gBAAgB,QAAQ,mBAAmB;CAG3E,6EAA6E;CAC7E,qDAAqD;CACrD,oEAAoE;CACpE,iEAAiE;CACjE,sFAAsF"}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
renderCompoundButton_unstable: function() {
|
|
19
19
|
return _index.renderCompoundButton_unstable;
|
|
20
20
|
},
|
|
21
|
-
useCompoundButtonBase_unstable: function() {
|
|
22
|
-
return _index.useCompoundButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useCompoundButtonStyles_unstable: function() {
|
|
25
22
|
return _index.useCompoundButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/CompoundButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/CompoundButton.ts"],"sourcesContent":["export type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './components/CompoundButton/index';\nexport {\n CompoundButton,\n compoundButtonClassNames,\n renderCompoundButton_unstable,\n useCompoundButtonStyles_unstable,\n useCompoundButton_unstable,\n} from './components/CompoundButton/index';\n"],"names":["CompoundButton","compoundButtonClassNames","renderCompoundButton_unstable","useCompoundButtonStyles_unstable","useCompoundButton_unstable"],"mappings":";;;;;;;;;;;;eAEEA,qBAAc;;;eACdC,+BAAwB;;;eACxBC,oCAA6B;;;eAC7BC,uCAAgC;;;eAChCC,iCAA0B;;;uBACrB,oCAAoC"}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
renderMenuButton_unstable: function() {
|
|
19
19
|
return _index.renderMenuButton_unstable;
|
|
20
20
|
},
|
|
21
|
-
useMenuButtonBase_unstable: function() {
|
|
22
|
-
return _index.useMenuButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useMenuButtonStyles_unstable: function() {
|
|
25
22
|
return _index.useMenuButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/MenuButton.ts"],"sourcesContent":["export type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './components/MenuButton/index';\nexport {\n MenuButton,\n menuButtonClassNames,\n renderMenuButton_unstable,\n useMenuButtonStyles_unstable,\n useMenuButton_unstable,\n} from './components/MenuButton/index';\n"],"names":["MenuButton","menuButtonClassNames","renderMenuButton_unstable","useMenuButtonStyles_unstable","useMenuButton_unstable"],"mappings":";;;;;;;;;;;;eAEEA,iBAAU;;;eACVC,2BAAoB;;;eACpBC,gCAAyB;;;eACzBC,mCAA4B;;;eAC5BC,6BAAsB;;;uBACjB,gCAAgC"}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
splitButtonClassNames: function() {
|
|
19
19
|
return _index.splitButtonClassNames;
|
|
20
20
|
},
|
|
21
|
-
useSplitButtonBase_unstable: function() {
|
|
22
|
-
return _index.useSplitButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useSplitButtonStyles_unstable: function() {
|
|
25
22
|
return _index.useSplitButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SplitButton.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/SplitButton.ts"],"sourcesContent":["export type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './components/SplitButton/index';\nexport {\n SplitButton,\n renderSplitButton_unstable,\n splitButtonClassNames,\n useSplitButtonStyles_unstable,\n useSplitButton_unstable,\n} from './components/SplitButton/index';\n"],"names":["SplitButton","renderSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable","useSplitButton_unstable"],"mappings":";;;;;;;;;;;;eAEEA,kBAAW;;;eACXC,iCAA0B;;;eAC1BC,4BAAqB;;;eACrBC,oCAA6B;;;eAC7BC,8BAAuB;;;uBAClB,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n
|
|
1
|
+
{"version":3,"sources":["../src/ToggleButton.ts"],"sourcesContent":["export type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n ToggleButtonState,\n ToggleButtonBaseState,\n} from './components/ToggleButton/index';\nexport {\n ToggleButton,\n renderToggleButton_unstable,\n toggleButtonClassNames,\n useToggleButtonStyles_unstable,\n useToggleButton_unstable,\n useToggleButtonBase_unstable,\n} from './components/ToggleButton/index';\n"],"names":["ToggleButton","renderToggleButton_unstable","toggleButtonClassNames","useToggleButtonStyles_unstable","useToggleButton_unstable","useToggleButtonBase_unstable"],"mappings":";;;;;;;;;;;;eAOEA,mBAAY;;;eACZC,kCAA2B;;;eAC3BC,6BAAsB;;;eAGtBG,mCAA4B;;;eAF5BF,qCAA8B;;;eAC9BC,+BAAwB;;;uBAEnB,kCAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: ButtonSize;\n};\n\
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/Button.types.ts"],"sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, DistributiveOmit, Slot } from '@fluentui/react-utilities';\n\nexport type ButtonSlots = {\n /**\n * Root of the component that renders as either a `<button>` tag or an `<a>` tag.\n */\n root: NonNullable<Slot<ARIAButtonSlotProps<'a'>>>;\n\n /**\n * Icon that renders either before or after the `children` as specified by the `iconPosition` prop.\n */\n icon?: Slot<'span'>;\n};\n\n/**\n * A button supports different sizes.\n */\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport type ButtonProps = ComponentProps<ButtonSlots> & {\n /**\n * A button can have its content and borders styled for greater emphasis or to be subtle.\n * - 'secondary' (default): Gives emphasis to the button in such a way that it indicates a secondary action.\n * - 'primary': Emphasizes the button as a primary action.\n * - 'outline': Removes background styling.\n * - 'subtle': Minimizes emphasis to blend into the background until hovered or focused.\n * - 'transparent': Removes background and border styling.\n *\n * @default 'secondary'\n */\n appearance?: 'secondary' | 'primary' | 'outline' | 'subtle' | 'transparent';\n\n /**\n * When set, allows the button to be focusable even when it has been disabled. This is used in scenarios where it\n * is important to keep a consistent tab order for screen reader and keyboard users. The primary example of this\n * pattern is when the disabled button is in a menu or a commandbar and is seldom used for standalone buttons.\n *\n * @default false\n */\n disabledFocusable?: boolean;\n\n /**\n * A button can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * A button can format its icon to appear before or after its content.\n *\n * @default 'before'\n */\n iconPosition?: 'before' | 'after';\n\n /**\n * A button can be rounded, circular, or square.\n *\n * @default 'rounded'\n */\n shape?: 'rounded' | 'circular' | 'square';\n\n /**\n * A button supports different sizes.\n *\n * @default 'medium'\n */\n size?: ButtonSize;\n};\n\nexport type ButtonBaseProps = DistributiveOmit<ButtonProps, 'appearance' | 'size' | 'shape'>;\n\nexport type ButtonState = ComponentState<ButtonSlots> &\n Required<Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>> & {\n /**\n * A button can contain only an icon.\n *\n * @default false\n */\n iconOnly: boolean;\n };\n\nexport type ButtonBaseState = DistributiveOmit<ButtonState, 'appearance' | 'size' | 'shape'>;\n"],"names":[],"mappings":""}
|
|
@@ -19,7 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return _renderButton.renderButton_unstable;
|
|
20
20
|
},
|
|
21
21
|
useButtonBase_unstable: function() {
|
|
22
|
-
return
|
|
22
|
+
return _useButton.useButtonBase_unstable;
|
|
23
23
|
},
|
|
24
24
|
useButtonStyles_unstable: function() {
|
|
25
25
|
return _useButtonStylesstyles.useButtonStyles_unstable;
|
|
@@ -31,5 +31,4 @@ _export(exports, {
|
|
|
31
31
|
const _Button = require("./Button");
|
|
32
32
|
const _renderButton = require("./renderButton");
|
|
33
33
|
const _useButton = require("./useButton");
|
|
34
|
-
const _useButtonBase = require("./useButtonBase");
|
|
35
34
|
const _useButtonStylesstyles = require("./useButtonStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonBaseProps, ButtonProps, ButtonSlots, ButtonBaseState, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable
|
|
1
|
+
{"version":3,"sources":["../src/components/Button/index.ts"],"sourcesContent":["export { Button } from './Button';\n// Explicit exports to omit ButtonCommons\nexport type { ButtonBaseProps, ButtonProps, ButtonSlots, ButtonBaseState, ButtonState } from './Button.types';\nexport { renderButton_unstable } from './renderButton';\nexport { useButton_unstable, useButtonBase_unstable } from './useButton';\nexport { buttonClassNames, useButtonStyles_unstable } from './useButtonStyles.styles';\n"],"names":["Button","renderButton_unstable","useButton_unstable","useButtonBase_unstable","buttonClassNames","useButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,cAAM;;;eAKNI,uCAAgB;;;eAFhBH,mCAAqB;;;eACDE,iCAAsB;;;eACxBE,+CAAwB;;;eAD1CH,6BAAkB;;;wBAJJ,WAAW;8BAGI,iBAAiB;2BACI,cAAc;uCACd,2BAA2B"}
|
|
@@ -3,25 +3,58 @@
|
|
|
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
|
+
useButtonBase_unstable: function() {
|
|
14
|
+
return useButtonBase_unstable;
|
|
15
|
+
},
|
|
16
|
+
useButton_unstable: function() {
|
|
9
17
|
return useButton_unstable;
|
|
10
18
|
}
|
|
11
19
|
});
|
|
12
20
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
21
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
22
|
const _ButtonContext = require("../../contexts/ButtonContext");
|
|
15
|
-
const
|
|
23
|
+
const _reactaria = require("@fluentui/react-aria");
|
|
24
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
16
25
|
const useButton_unstable = (props, ref)=>{
|
|
17
26
|
const { size: contextSize } = (0, _ButtonContext.useButtonContext)();
|
|
18
|
-
const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' } = props;
|
|
19
|
-
const state =
|
|
27
|
+
const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium', ...buttonProps } = props;
|
|
28
|
+
const state = useButtonBase_unstable(buttonProps, ref);
|
|
20
29
|
return {
|
|
21
|
-
// Props passed at the top-level
|
|
22
30
|
appearance,
|
|
23
31
|
shape,
|
|
24
32
|
size,
|
|
25
33
|
...state
|
|
26
34
|
};
|
|
27
35
|
};
|
|
36
|
+
const useButtonBase_unstable = (props, ref)=>{
|
|
37
|
+
const { icon, iconPosition = 'before', ...buttonProps } = props;
|
|
38
|
+
const iconShorthand = _reactutilities.slot.optional(icon, {
|
|
39
|
+
elementType: 'span'
|
|
40
|
+
});
|
|
41
|
+
var _props_disabled, _props_disabledFocusable;
|
|
42
|
+
return {
|
|
43
|
+
disabled: (_props_disabled = props.disabled) !== null && _props_disabled !== void 0 ? _props_disabled : false,
|
|
44
|
+
disabledFocusable: (_props_disabledFocusable = props.disabledFocusable) !== null && _props_disabledFocusable !== void 0 ? _props_disabledFocusable : false,
|
|
45
|
+
iconPosition,
|
|
46
|
+
iconOnly: Boolean((iconShorthand === null || iconShorthand === void 0 ? void 0 : iconShorthand.children) && !props.children),
|
|
47
|
+
components: {
|
|
48
|
+
root: 'button',
|
|
49
|
+
icon: 'span'
|
|
50
|
+
},
|
|
51
|
+
root: _reactutilities.slot.always((0, _reactaria.useARIAButtonProps)(buttonProps.as, buttonProps), {
|
|
52
|
+
elementType: 'button',
|
|
53
|
+
defaultProps: {
|
|
54
|
+
ref: ref,
|
|
55
|
+
type: props.as !== 'a' ? 'button' : undefined
|
|
56
|
+
}
|
|
57
|
+
}),
|
|
58
|
+
icon: iconShorthand
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Button/useButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useButtonContext } from '../../contexts/ButtonContext';\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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/CompoundButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState,
|
|
1
|
+
{"version":3,"sources":["../src/components/CompoundButton/CompoundButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonSlots, ButtonState } from '../Button/Button.types';\n\nexport type CompoundButtonSlots = ButtonSlots & {\n /**\n * Second line of text that describes the action this button takes.\n */\n secondaryContent?: Slot<'span'>;\n\n /**\n * Container that wraps the children and the secondaryContent slot.\n */\n contentContainer: NonNullable<Slot<'span'>>;\n};\n\nexport type CompoundButtonProps = ComponentProps<Partial<CompoundButtonSlots>> &\n Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'iconPosition' | 'shape' | 'size'>;\n\nexport type CompoundButtonState = ComponentState<CompoundButtonSlots> &\n Omit<ButtonState, keyof ButtonSlots | 'components'>;\n"],"names":[],"mappings":""}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
renderCompoundButton_unstable: function() {
|
|
19
19
|
return _renderCompoundButton.renderCompoundButton_unstable;
|
|
20
20
|
},
|
|
21
|
-
useCompoundButtonBase_unstable: function() {
|
|
22
|
-
return _useCompoundButtonBase.useCompoundButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useCompoundButtonStyles_unstable: function() {
|
|
25
22
|
return _useCompoundButtonStylesstyles.useCompoundButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -31,5 +28,4 @@ _export(exports, {
|
|
|
31
28
|
const _CompoundButton = require("./CompoundButton");
|
|
32
29
|
const _renderCompoundButton = require("./renderCompoundButton");
|
|
33
30
|
const _useCompoundButton = require("./useCompoundButton");
|
|
34
|
-
const _useCompoundButtonBase = require("./useCompoundButtonBase");
|
|
35
31
|
const _useCompoundButtonStylesstyles = require("./useCompoundButtonStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/index.ts"],"sourcesContent":["export { CompoundButton } from './CompoundButton';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/CompoundButton/index.ts"],"sourcesContent":["export { CompoundButton } from './CompoundButton';\nexport type { CompoundButtonProps, CompoundButtonSlots, CompoundButtonState } from './CompoundButton.types';\nexport { renderCompoundButton_unstable } from './renderCompoundButton';\nexport { useCompoundButton_unstable } from './useCompoundButton';\nexport { compoundButtonClassNames, useCompoundButtonStyles_unstable } from './useCompoundButtonStyles.styles';\n"],"names":["CompoundButton","renderCompoundButton_unstable","useCompoundButton_unstable","compoundButtonClassNames","useCompoundButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,8BAAc;;;eAIdG,uDAAwB;;;eAFxBF,mDAA6B;;;eAEHG,+DAAgC;;;eAD1DF,6CAA0B;;;gCAHJ,mBAAmB;sCAEJ,yBAAyB;mCAC5B,sBAAsB;+CACU,mCAAmC"}
|
|
@@ -11,16 +11,29 @@ Object.defineProperty(exports, "useCompoundButton_unstable", {
|
|
|
11
11
|
});
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const
|
|
15
|
-
const
|
|
14
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
15
|
+
const _index = require("../Button/index");
|
|
16
16
|
const useCompoundButton_unstable = (props, ref)=>{
|
|
17
|
-
|
|
18
|
-
const {
|
|
19
|
-
const state =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
var _state_icon, _state_secondaryContent;
|
|
18
|
+
const { contentContainer, secondaryContent, ...buttonProps } = props;
|
|
19
|
+
const state = {
|
|
20
|
+
// Button state
|
|
21
|
+
...(0, _index.useButton_unstable)(buttonProps, ref),
|
|
22
|
+
// Slots definition
|
|
23
|
+
components: {
|
|
24
|
+
root: 'button',
|
|
25
|
+
icon: 'span',
|
|
26
|
+
contentContainer: 'span',
|
|
27
|
+
secondaryContent: 'span'
|
|
28
|
+
},
|
|
29
|
+
contentContainer: _reactutilities.slot.always(contentContainer, {
|
|
30
|
+
elementType: 'span'
|
|
31
|
+
}),
|
|
32
|
+
secondaryContent: _reactutilities.slot.optional(secondaryContent, {
|
|
33
|
+
elementType: 'span'
|
|
34
|
+
})
|
|
25
35
|
};
|
|
36
|
+
// Recalculate iconOnly to take into account secondaryContent.
|
|
37
|
+
state.iconOnly = Boolean(((_state_icon = state.icon) === null || _state_icon === void 0 ? void 0 : _state_icon.children) && !props.children && !((_state_secondaryContent = state.secondaryContent) === null || _state_secondaryContent === void 0 ? void 0 : _state_secondaryContent.children));
|
|
38
|
+
return state;
|
|
26
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/CompoundButton/useCompoundButton.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/MenuButton/MenuButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState,
|
|
1
|
+
{"version":3,"sources":["../src/components/MenuButton/MenuButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonSlots, ButtonState } from '../Button/Button.types';\n\nexport type MenuButtonSlots = ButtonSlots & {\n /**\n * Menu icon that indicates that this button has a menu that can be expanded.\n */\n menuIcon?: Slot<'span'>;\n};\n\nexport type MenuButtonProps = ComponentProps<MenuButtonSlots> &\n Pick<ButtonProps, 'appearance' | 'disabledFocusable' | 'disabled' | 'shape' | 'size'>;\n\nexport type MenuButtonState = ComponentState<MenuButtonSlots> &\n Omit<ButtonState, keyof ButtonSlots | 'components' | 'iconPosition'>;\n"],"names":[],"mappings":""}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
renderMenuButton_unstable: function() {
|
|
19
19
|
return _renderMenuButton.renderMenuButton_unstable;
|
|
20
20
|
},
|
|
21
|
-
useMenuButtonBase_unstable: function() {
|
|
22
|
-
return _useMenuButtonBase.useMenuButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useMenuButtonStyles_unstable: function() {
|
|
25
22
|
return _useMenuButtonStylesstyles.useMenuButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -31,5 +28,4 @@ _export(exports, {
|
|
|
31
28
|
const _MenuButton = require("./MenuButton");
|
|
32
29
|
const _renderMenuButton = require("./renderMenuButton");
|
|
33
30
|
const _useMenuButton = require("./useMenuButton");
|
|
34
|
-
const _useMenuButtonBase = require("./useMenuButtonBase");
|
|
35
31
|
const _useMenuButtonStylesstyles = require("./useMenuButtonStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/MenuButton/index.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../src/components/MenuButton/index.ts"],"sourcesContent":["export type { MenuButtonProps, MenuButtonSlots, MenuButtonState } from './MenuButton.types';\nexport { MenuButton } from './MenuButton';\nexport { renderMenuButton_unstable } from './renderMenuButton';\nexport { useMenuButton_unstable } from './useMenuButton';\nexport { menuButtonClassNames, useMenuButtonStyles_unstable } from './useMenuButtonStyles.styles';\n"],"names":["MenuButton","renderMenuButton_unstable","useMenuButton_unstable","menuButtonClassNames","useMenuButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eACSA,sBAAU;;;eAGVG,+CAAoB;;;eAFpBF,2CAAyB;;;eAEHG,uDAA4B;;;eADlDF,qCAAsB;;;4BAFJ,eAAe;kCACA,qBAAqB;+BACxB,kBAAkB;2CACU,+BAA+B"}
|
|
@@ -12,21 +12,31 @@ Object.defineProperty(exports, "useMenuButton_unstable", {
|
|
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
13
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
14
|
const _reacticons = require("@fluentui/react-icons");
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
16
|
+
const _index = require("../Button/index");
|
|
17
17
|
const useMenuButton_unstable = (props, ref)=>{
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const { appearance = 'secondary', shape = 'rounded', size = contextSize !== null && contextSize !== void 0 ? contextSize : 'medium' } = props;
|
|
21
|
-
const state = (0, _useMenuButtonBase.useMenuButtonBase_unstable)(props, ref);
|
|
18
|
+
const { menuIcon, ...buttonProps } = props;
|
|
19
|
+
const buttonState = (0, _index.useButton_unstable)(buttonProps, ref);
|
|
22
20
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
21
|
+
...buttonState,
|
|
22
|
+
iconOnly: Boolean(!props.children),
|
|
23
|
+
// Slots definition
|
|
24
|
+
components: {
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
26
|
+
...buttonState.components,
|
|
27
|
+
menuIcon: 'span'
|
|
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
|
+
},
|
|
34
|
+
menuIcon: _reactutilities.slot.optional(menuIcon, {
|
|
35
|
+
defaultProps: {
|
|
36
|
+
children: /*#__PURE__*/ _react.createElement(_reacticons.ChevronDownRegular, null)
|
|
37
|
+
},
|
|
38
|
+
renderByDefault: true,
|
|
39
|
+
elementType: 'span'
|
|
40
|
+
})
|
|
31
41
|
};
|
|
32
42
|
};
|
|
@@ -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
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SplitButton/SplitButton.types.ts"],"sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState,
|
|
1
|
+
{"version":3,"sources":["../src/components/SplitButton/SplitButton.types.ts"],"sourcesContent":["import { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonProps, MenuButtonState } from '../MenuButton/MenuButton.types';\n\nexport type SplitButtonSlots = {\n /**\n * Root of the component that wraps the primary action button and menu button.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Button that opens menu with secondary actions in SplitButton.\n */\n menuButton?: Slot<typeof MenuButton>;\n /**\n * Button to perform primary action in SplitButton.\n */\n primaryActionButton?: Slot<typeof Button>;\n};\n\nexport type SplitButtonProps = ComponentProps<SplitButtonSlots> &\n Omit<ButtonProps, 'root' | 'as'> &\n Omit<MenuButtonProps, 'root' | 'as'>;\n\nexport type SplitButtonState = ComponentState<SplitButtonSlots> &\n Omit<ButtonState, 'components' | 'iconOnly' | 'root'> &\n Omit<MenuButtonState, 'components' | 'iconOnly' | 'root'>;\n"],"names":[],"mappings":""}
|
|
@@ -18,9 +18,6 @@ _export(exports, {
|
|
|
18
18
|
splitButtonClassNames: function() {
|
|
19
19
|
return _useSplitButtonStylesstyles.splitButtonClassNames;
|
|
20
20
|
},
|
|
21
|
-
useSplitButtonBase_unstable: function() {
|
|
22
|
-
return _useSplitButtonBase.useSplitButtonBase_unstable;
|
|
23
|
-
},
|
|
24
21
|
useSplitButtonStyles_unstable: function() {
|
|
25
22
|
return _useSplitButtonStylesstyles.useSplitButtonStyles_unstable;
|
|
26
23
|
},
|
|
@@ -31,5 +28,4 @@ _export(exports, {
|
|
|
31
28
|
const _SplitButton = require("./SplitButton");
|
|
32
29
|
const _renderSplitButton = require("./renderSplitButton");
|
|
33
30
|
const _useSplitButton = require("./useSplitButton");
|
|
34
|
-
const _useSplitButtonBase = require("./useSplitButtonBase");
|
|
35
31
|
const _useSplitButtonStylesstyles = require("./useSplitButtonStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SplitButton/index.ts"],"sourcesContent":["export { SplitButton } from './SplitButton';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/SplitButton/index.ts"],"sourcesContent":["export { SplitButton } from './SplitButton';\nexport type { SplitButtonProps, SplitButtonSlots, SplitButtonState } from './SplitButton.types';\nexport { renderSplitButton_unstable } from './renderSplitButton';\nexport { useSplitButton_unstable } from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles.styles';\n"],"names":["SplitButton","renderSplitButton_unstable","useSplitButton_unstable","splitButtonClassNames","useSplitButtonStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,wBAAW;;;eAEXC,6CAA0B;;;eAE1BE,iDAAqB;;;eAAEC,yDAA6B;;;eADpDF,uCAAuB;;;6BAHJ,gBAAgB;mCAED,sBAAsB;gCACzB,mBAAmB;4CACU,gCAAgC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
'use client';
|
|
2
1
|
"use strict";
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
3
|
value: true
|
|
@@ -11,26 +10,64 @@ Object.defineProperty(exports, "useSplitButton_unstable", {
|
|
|
11
10
|
});
|
|
12
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
13
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
14
|
-
const
|
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
14
|
+
const _Button = require("../Button/Button");
|
|
15
|
+
const _MenuButton = require("../MenuButton/MenuButton");
|
|
15
16
|
const useSplitButton_unstable = (props, ref)=>{
|
|
16
|
-
const { appearance = 'secondary', shape = 'rounded', size = 'medium' } = props;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
shape,
|
|
21
|
-
size,
|
|
22
|
-
...state,
|
|
23
|
-
menuButton: {
|
|
17
|
+
const { appearance = 'secondary', children, disabled = false, disabledFocusable = false, icon, iconPosition = 'before', menuButton, menuIcon, primaryActionButton, shape = 'rounded', size = 'medium', ...rest } = props;
|
|
18
|
+
const baseId = (0, _reactutilities.useId)('splitButton-');
|
|
19
|
+
const menuButtonShorthand = _reactutilities.slot.optional(menuButton, {
|
|
20
|
+
defaultProps: {
|
|
24
21
|
appearance,
|
|
22
|
+
disabled,
|
|
23
|
+
disabledFocusable,
|
|
24
|
+
menuIcon,
|
|
25
25
|
shape,
|
|
26
|
-
size
|
|
27
|
-
...state.menuButton
|
|
26
|
+
size
|
|
28
27
|
},
|
|
29
|
-
|
|
28
|
+
renderByDefault: true,
|
|
29
|
+
elementType: _MenuButton.MenuButton
|
|
30
|
+
});
|
|
31
|
+
const primaryActionButtonShorthand = _reactutilities.slot.optional(primaryActionButton, {
|
|
32
|
+
defaultProps: {
|
|
30
33
|
appearance,
|
|
34
|
+
children,
|
|
35
|
+
disabled,
|
|
36
|
+
disabledFocusable,
|
|
37
|
+
icon,
|
|
38
|
+
iconPosition,
|
|
39
|
+
id: baseId + '__primaryActionButton',
|
|
31
40
|
shape,
|
|
32
|
-
size
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
size
|
|
42
|
+
},
|
|
43
|
+
renderByDefault: true,
|
|
44
|
+
elementType: _Button.Button
|
|
45
|
+
});
|
|
46
|
+
// Resolve menu button's aria-labelledby to be labelled by the primary action button if no label was provided by the
|
|
47
|
+
// user.
|
|
48
|
+
if (menuButtonShorthand && primaryActionButtonShorthand && !menuButtonShorthand['aria-label'] && !menuButtonShorthand['aria-labelledby']) {
|
|
49
|
+
menuButtonShorthand['aria-labelledby'] = primaryActionButtonShorthand.id;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
// Props passed at the top-level
|
|
53
|
+
appearance,
|
|
54
|
+
disabled,
|
|
55
|
+
disabledFocusable,
|
|
56
|
+
iconPosition,
|
|
57
|
+
shape,
|
|
58
|
+
size,
|
|
59
|
+
components: {
|
|
60
|
+
root: 'div',
|
|
61
|
+
menuButton: _MenuButton.MenuButton,
|
|
62
|
+
primaryActionButton: _Button.Button
|
|
63
|
+
},
|
|
64
|
+
root: _reactutilities.slot.always({
|
|
65
|
+
ref: ref,
|
|
66
|
+
...rest
|
|
67
|
+
}, {
|
|
68
|
+
elementType: 'div'
|
|
69
|
+
}),
|
|
70
|
+
menuButton: menuButtonShorthand,
|
|
71
|
+
primaryActionButton: primaryActionButtonShorthand
|
|
35
72
|
};
|
|
36
73
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SplitButton/useSplitButton.ts"],"sourcesContent":["
|
|
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 {
|
|
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":""}
|
|
@@ -19,7 +19,7 @@ _export(exports, {
|
|
|
19
19
|
return _useToggleButtonStylesstyles.toggleButtonClassNames;
|
|
20
20
|
},
|
|
21
21
|
useToggleButtonBase_unstable: function() {
|
|
22
|
-
return
|
|
22
|
+
return _useToggleButton.useToggleButtonBase_unstable;
|
|
23
23
|
},
|
|
24
24
|
useToggleButtonStyles_unstable: function() {
|
|
25
25
|
return _useToggleButtonStylesstyles.useToggleButtonStyles_unstable;
|
|
@@ -31,5 +31,4 @@ _export(exports, {
|
|
|
31
31
|
const _ToggleButton = require("./ToggleButton");
|
|
32
32
|
const _renderToggleButton = require("./renderToggleButton");
|
|
33
33
|
const _useToggleButton = require("./useToggleButton");
|
|
34
|
-
const _useToggleButtonBase = require("./useToggleButtonBase");
|
|
35
34
|
const _useToggleButtonStylesstyles = require("./useToggleButtonStyles.styles");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/ToggleButton/index.ts"],"sourcesContent":["export { ToggleButton } from './ToggleButton';\nexport type {\n ToggleButtonBaseProps,\n ToggleButtonProps,\n
|
|
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"}
|