@fluentui/react-button 9.74.7-experimental.cli-api.20261006-ccaa611d58.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.0
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 +46 -12
- package/README.md +22 -0
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/Button/Button.module.css +401 -0
- package/lib/components/Button/Button.types.js.map +1 -1
- package/lib/components/Button/index.js.map +1 -1
- package/lib/components/Button/renderButton.js +2 -2
- package/lib/components/Button/renderButton.js.map +1 -1
- package/lib/components/Button/useButton.js +1 -1
- package/lib/components/Button/useButton.js.map +1 -1
- package/lib/components/Button/useButtonStyles.styles.css.js +14 -0
- package/lib/components/Button/useButtonStyles.styles.css.js.map +1 -0
- package/lib/components/Button/useButtonStyles.styles.raw.css.js +14 -0
- package/lib/components/Button/useButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Button/useButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/CompoundButton.module.css +143 -0
- package/lib/components/CompoundButton/CompoundButton.types.js.map +1 -1
- package/lib/components/CompoundButton/index.js.map +1 -1
- package/lib/components/CompoundButton/renderCompoundButton.js +2 -2
- package/lib/components/CompoundButton/renderCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButton.js.map +1 -1
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.css.js +27 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.css.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.css.js +27 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/CompoundButton/useCompoundButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.module.css +75 -0
- package/lib/components/MenuButton/MenuButton.types.js.map +1 -1
- package/lib/components/MenuButton/index.js.map +1 -1
- package/lib/components/MenuButton/renderMenuButton.js +2 -2
- package/lib/components/MenuButton/renderMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButton.js.map +1 -1
- package/lib/components/MenuButton/useMenuButtonStyles.styles.css.js +26 -0
- package/lib/components/MenuButton/useMenuButtonStyles.styles.css.js.map +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.css.js +26 -0
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/MenuButton/useMenuButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.js.map +1 -1
- package/lib/components/SplitButton/SplitButton.module.css +73 -0
- package/lib/components/SplitButton/SplitButton.types.js.map +1 -1
- package/lib/components/SplitButton/index.js.map +1 -1
- package/lib/components/SplitButton/renderSplitButton.js +2 -2
- package/lib/components/SplitButton/renderSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButton.js.map +1 -1
- package/lib/components/SplitButton/useSplitButtonStyles.styles.css.js +17 -0
- package/lib/components/SplitButton/useSplitButtonStyles.styles.css.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.css.js +17 -0
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/SplitButton/useSplitButtonStyles.styles.raw.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.module.css +234 -0
- package/lib/components/ToggleButton/ToggleButton.types.js.map +1 -1
- package/lib/components/ToggleButton/index.js.map +1 -1
- package/lib/components/ToggleButton/renderToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButton.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.css.js +18 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.css.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.js +12 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.js.map +1 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.css.js +18 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.css.js.map +1 -0
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js +11 -1
- package/lib/components/ToggleButton/useToggleButtonStyles.styles.raw.js.map +1 -1
- package/lib/contexts/ButtonContext.js.map +1 -1
- package/lib/contexts/index.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/useToggleState.js.map +1 -1
- package/lib-commonjs/Button.cjs +7 -7
- package/lib-commonjs/CompoundButton.cjs +7 -7
- package/lib-commonjs/MenuButton.cjs +7 -7
- package/lib-commonjs/SplitButton.cjs +7 -7
- package/lib-commonjs/ToggleButton.cjs +7 -7
- package/lib-commonjs/components/Button/Button.cjs.map +1 -1
- package/lib-commonjs/components/Button/Button.module.css +401 -0
- package/lib-commonjs/components/Button/Button.types.cjs.map +1 -1
- package/lib-commonjs/components/Button/index.cjs +7 -7
- package/lib-commonjs/components/Button/index.cjs.map +1 -1
- package/lib-commonjs/components/Button/renderButton.cjs.map +1 -1
- package/lib-commonjs/components/Button/useButton.cjs +4 -4
- package/lib-commonjs/components/Button/useButton.cjs.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Button/useButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.css.cjs +33 -0
- package/lib-commonjs/components/Button/useButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.css.cjs +33 -0
- package/lib-commonjs/components/Button/useButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/CompoundButton.module.css +143 -0
- package/lib-commonjs/components/CompoundButton/CompoundButton.types.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/index.cjs +7 -7
- package/lib-commonjs/components/CompoundButton/index.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/renderCompoundButton.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButton.cjs +3 -3
- package/lib-commonjs/components/CompoundButton/useCompoundButton.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.cjs +3 -3
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.css.cjs +46 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.css.cjs +46 -0
- package/lib-commonjs/components/CompoundButton/useCompoundButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/MenuButton.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/MenuButton.module.css +75 -0
- package/lib-commonjs/components/MenuButton/MenuButton.types.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/index.cjs +7 -7
- package/lib-commonjs/components/MenuButton/index.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/renderMenuButton.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButton.cjs +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButton.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.cjs +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.css.cjs +45 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.css.cjs +45 -0
- package/lib-commonjs/components/MenuButton/useMenuButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/SplitButton.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/SplitButton.module.css +73 -0
- package/lib-commonjs/components/SplitButton/SplitButton.types.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/index.cjs +7 -7
- package/lib-commonjs/components/SplitButton/index.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/renderSplitButton.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButton.cjs +3 -3
- package/lib-commonjs/components/SplitButton/useSplitButton.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.cjs +3 -3
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.css.cjs +36 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.css.cjs +36 -0
- package/lib-commonjs/components/SplitButton/useSplitButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/ToggleButton.module.css +234 -0
- package/lib-commonjs/components/ToggleButton/ToggleButton.types.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/index.cjs +7 -7
- package/lib-commonjs/components/ToggleButton/index.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/renderToggleButton.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButton.cjs +3 -3
- package/lib-commonjs/components/ToggleButton/useToggleButton.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.cjs +27 -4
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.css.cjs +37 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.cjs +14 -4
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.css.cjs +37 -0
- package/lib-commonjs/components/ToggleButton/useToggleButtonStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/contexts/ButtonContext.cjs +3 -3
- package/lib-commonjs/contexts/ButtonContext.cjs.map +1 -1
- package/lib-commonjs/contexts/index.cjs +3 -3
- package/lib-commonjs/contexts/index.cjs.map +1 -1
- package/lib-commonjs/index.cjs +34 -34
- package/lib-commonjs/index.cjs.map +1 -1
- package/lib-commonjs/utils/index.cjs.map +1 -1
- package/lib-commonjs/utils/useToggleState.cjs.map +1 -1
- package/package.json +15 -15
- package/dist/metadata/api/api-root.json +0 -1
- package/dist/metadata/index.json +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.expanded {
|
|
3
|
+
:global(.fui-Icon-filled) {
|
|
4
|
+
display: inline;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:global(.fui-Icon-regular) {
|
|
8
|
+
display: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&:where(.outline) {
|
|
12
|
+
border-width: var(--strokeWidthThicker);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:where(.subtle) {
|
|
16
|
+
background-color: var(--colorSubtleBackgroundSelected);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (forced-colors: none) {
|
|
20
|
+
&:where(.outline) {
|
|
21
|
+
border-color: var(--colorNeutralStroke1Selected);
|
|
22
|
+
color: var(--colorNeutralForeground1Selected);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&:where(.primary) {
|
|
26
|
+
background-color: var(--colorBrandBackgroundSelected);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:where(.secondary) {
|
|
30
|
+
background-color: var(--colorNeutralBackground1Selected);
|
|
31
|
+
border-color: var(--colorNeutralStroke1Selected);
|
|
32
|
+
color: var(--colorNeutralForeground1Selected);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&:where(.subtle) {
|
|
36
|
+
color: var(--colorNeutralForeground2Selected);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:where(.transparent) {
|
|
40
|
+
background-color: var(--colorTransparentBackgroundSelected);
|
|
41
|
+
color: var(--colorNeutralForeground2BrandSelected);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.root .menuIcon {
|
|
47
|
+
line-height: 0;
|
|
48
|
+
margin-inline-start: var(--spacingHorizontalXS);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.iconOnly .menuIcon {
|
|
52
|
+
margin-inline-start: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.small .menuIcon,
|
|
56
|
+
.medium .menuIcon {
|
|
57
|
+
font-size: var(--fontSizeBase200);
|
|
58
|
+
height: var(--fontSizeBase200);
|
|
59
|
+
line-height: var(--lineHeightBase200);
|
|
60
|
+
width: var(--fontSizeBase200);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.large .menuIcon {
|
|
64
|
+
font-size: var(--fontSizeBase400);
|
|
65
|
+
height: var(--fontSizeBase400);
|
|
66
|
+
line-height: var(--lineHeightBase400);
|
|
67
|
+
width: var(--fontSizeBase400);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (forced-colors: active) {
|
|
71
|
+
:where(.expanded):where(.outline, .secondary, .subtle, .transparent) .icon:hover {
|
|
72
|
+
color: Highlight;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/MenuButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonBaseProps, ButtonBaseState, 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\n/**\n * MenuButton Props without the `appearance`/`size`/`shape` styling props, for headless usage.\n */\nexport type MenuButtonBaseProps = ComponentProps<MenuButtonSlots> &\n Pick<ButtonBaseProps, 'disabled' | 'disabledFocusable'>;\n\n/**\n * MenuButton State without the `appearance`/`size`/`shape` styling props, for headless usage.\n */\nexport type MenuButtonBaseState = ComponentState<MenuButtonSlots> &\n Omit<ButtonBaseState, keyof ButtonSlots | 'components' | 'iconPosition'>;\n"],"names":[],"mappings":"AAsBA;;CAEC,GACD,WAC2E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/index.ts"],"sourcesContent":["export type {\n MenuButtonBaseProps,\n MenuButtonBaseState,\n MenuButtonProps,\n MenuButtonSlots,\n MenuButtonState,\n} from './MenuButton.types';\nexport { MenuButton } from './MenuButton';\nexport { renderMenuButton_unstable } from './renderMenuButton';\nexport { useMenuButton_unstable, useMenuButtonBase_unstable } from './useMenuButton';\nexport { menuButtonClassNames, useMenuButtonStyles_unstable } from './useMenuButtonStyles.styles';\n"],"names":["MenuButton","renderMenuButton_unstable","useMenuButton_unstable","useMenuButtonBase_unstable","menuButtonClassNames","useMenuButtonStyles_unstable"],"mappings":"AAOA,SAASA,UAAU,QAAQ,kBAAe;AAC1C,SAASC,yBAAyB,QAAQ,wBAAqB;AAC/D,SAASC,sBAAsB,EAAEC,0BAA0B,QAAQ,qBAAkB;AACrF,SAASC,oBAAoB,EAAEC,4BAA4B,QAAQ,kCAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Renders a MenuButton component by passing the state defined props to the appropriate slots.
|
|
5
5
|
*/ export const renderMenuButton_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/renderMenuButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { MenuButtonSlots, MenuButtonBaseState } from './MenuButton.types';\n\n/**\n * Renders a MenuButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderMenuButton_unstable = (state: MenuButtonBaseState): JSXElement => {\n assertSlots<MenuButtonSlots>(state);\n const { icon, iconOnly } = state;\n\n return (\n <state.root>\n {state.icon && <state.icon />}\n {!iconOnly && state.root.children}\n {(!iconOnly || !icon?.children) && state.menuIcon && <state.menuIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderMenuButton_unstable","state","icon","iconOnly","root","children","menuIcon"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD;;CAEC,GACD,OAAO,MAAMC,4BAA4B,CAACC;IACxCF,YAA6BE;IAC7B,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGF;IAE3B,qBACE,MAACA,MAAMG,IAAI;;YACRH,MAAMC,IAAI,kBAAI,KAACD,MAAMC,IAAI;YACzB,CAACC,YAAYF,MAAMG,IAAI,CAACC,QAAQ;YAC/B,CAAA,CAACF,YAAY,EAACD,iBAAAA,2BAAAA,KAAMG,QAAQ,CAAD,KAAMJ,MAAMK,QAAQ,kBAAI,KAACL,MAAMK,QAAQ;;;AAG1E,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
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 { useButtonContext } from '../../contexts/ButtonContext';\nimport { useButtonBase_unstable } from '../Button/index';\nimport type { MenuButtonBaseProps, MenuButtonBaseState, MenuButtonProps, MenuButtonState } from './MenuButton.types';\n\n/**\n * Base hook for MenuButton.\n *\n * The `menuIcon` slot ships no icon of its own and only renders when a consumer\n * provides one, so headless consumers can supply their own visuals. The styled\n * `useMenuButton_unstable` adds the default chevron on top of this.\n *\n * @param props - User provided props to the MenuButton component.\n * @param ref - User provided ref to be passed to the MenuButton component.\n */\nexport const useMenuButtonBase_unstable = (\n props: MenuButtonBaseProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): MenuButtonBaseState => {\n const { menuIcon, ...buttonProps } = props;\n const buttonState = useButtonBase_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 elementType: 'span',\n }),\n };\n};\n\n/**\n * Given user props, returns the final state for a MenuButton by adding the\n * `appearance`/`size`/`shape` styling props on top of the base state.\n *\n * @param props - User provided props to the MenuButton component.\n * @param ref - User provided ref to be passed to the MenuButton component.\n */\nexport const useMenuButton_unstable = (\n props: MenuButtonProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): MenuButtonState => {\n const { size: contextSize } = useButtonContext();\n const { appearance = 'secondary', menuIcon, shape = 'rounded', size = contextSize ?? 'medium', ...baseProps } = props;\n const baseState = useMenuButtonBase_unstable(baseProps, ref);\n\n return {\n ...baseState,\n menuIcon: slot.optional(menuIcon, {\n defaultProps: {\n children: <ChevronDownRegular />,\n },\n renderByDefault: true,\n elementType: 'span',\n }),\n appearance,\n shape,\n size,\n };\n};\n"],"names":["React","ChevronDownRegular","slot","useButtonContext","useButtonBase_unstable","useMenuButtonBase_unstable","props","ref","menuIcon","buttonProps","buttonState","iconOnly","Boolean","children","components","root","optional","elementType","useMenuButton_unstable","size","contextSize","appearance","shape","baseProps","baseState","defaultProps","renderByDefault"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,wBAAwB;AAC3D,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SAASC,sBAAsB,QAAQ,qBAAkB;AAGzD;;;;;;;;;CASC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAM,EAAEC,QAAQ,EAAE,GAAGC,aAAa,GAAGH;IACrC,MAAMI,cAAcN,uBAAuBK,aAAaF;IAExD,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,UAAUN,KAAKc,QAAQ,CAACR,UAAU;YAChCS,aAAa;QACf;IACF;AACF,EAAE;AAEF;;;;;;CAMC,GACD,OAAO,MAAMC,yBAAyB,CACpCZ,OACAC;IAEA,MAAM,EAAEY,MAAMC,WAAW,EAAE,GAAGjB;IAC9B,MAAM,EAAEkB,aAAa,WAAW,EAAEb,QAAQ,EAAEc,QAAQ,SAAS,EAAEH,OAAOC,wBAAAA,yBAAAA,cAAe,QAAQ,EAAE,GAAGG,WAAW,GAAGjB;IAChH,MAAMkB,YAAYnB,2BAA2BkB,WAAWhB;IAExD,OAAO;QACL,GAAGiB,SAAS;QACZhB,UAAUN,KAAKc,QAAQ,CAACR,UAAU;YAChCiB,cAAc;gBACZZ,wBAAU,oBAACZ;YACb;YACAyB,iBAAiB;YACjBT,aAAa;QACf;QACAI;QACAC;QACAH;IACF;AACF,EAAE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { useButtonStyles_unstable } from "../Button/useButtonStyles.styles.css.js";
|
|
4
|
+
import styles from "./MenuButton.module.css";
|
|
5
|
+
export const menuButtonClassNames = {
|
|
6
|
+
root: 'fui-MenuButton',
|
|
7
|
+
icon: 'fui-MenuButton__icon',
|
|
8
|
+
menuIcon: 'fui-MenuButton__menuIcon'
|
|
9
|
+
};
|
|
10
|
+
export const useMenuButtonStyles_unstable = (state)=>{
|
|
11
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
12
|
+
state.root.className = clsx(menuButtonClassNames.root, styles.root, styles[state.appearance], styles[state.size], state.root['aria-expanded'] && styles.expanded, state.iconOnly && styles.iconOnly, state.root.className);
|
|
13
|
+
if (state.icon) {
|
|
14
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
15
|
+
state.icon.className = clsx(menuButtonClassNames.icon, styles.icon, state.icon.className);
|
|
16
|
+
}
|
|
17
|
+
if (state.menuIcon) {
|
|
18
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
19
|
+
state.menuIcon.className = clsx(menuButtonClassNames.menuIcon, styles.menuIcon, state.menuIcon.className);
|
|
20
|
+
}
|
|
21
|
+
useButtonStyles_unstable({
|
|
22
|
+
...state,
|
|
23
|
+
iconPosition: 'before'
|
|
24
|
+
});
|
|
25
|
+
return state;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.styles.css.ts"],"sourcesContent":["'use client';\n\nimport { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles.css';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\nimport styles from './MenuButton.module.css';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = clsx(\n menuButtonClassNames.root,\n styles.root,\n styles[state.appearance],\n styles[state.size],\n state.root['aria-expanded'] && styles.expanded,\n state.iconOnly && styles.iconOnly,\n state.root.className,\n );\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = clsx(menuButtonClassNames.icon, styles.icon, state.icon.className);\n }\n if (state.menuIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.menuIcon.className = clsx(menuButtonClassNames.menuIcon, styles.menuIcon, state.menuIcon.className);\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n return state;\n};\n"],"names":["clsx","useButtonStyles_unstable","styles","menuButtonClassNames","root","icon","menuIcon","useMenuButtonStyles_unstable","state","className","appearance","size","expanded","iconOnly","iconPosition"],"mappings":"AAAA;AAEA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,wBAAwB,QAAQ,0CAAuC;AAEhF,OAAOC,YAAY,0BAA0B;AAE7C,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,+BAA+B,CAACC;IAC3C,oDAAoD;IACpDA,MAAMJ,IAAI,CAACK,SAAS,GAAGT,KACrBG,qBAAqBC,IAAI,EACzBF,OAAOE,IAAI,EACXF,MAAM,CAACM,MAAME,UAAU,CAAC,EACxBR,MAAM,CAACM,MAAMG,IAAI,CAAC,EAClBH,MAAMJ,IAAI,CAAC,gBAAgB,IAAIF,OAAOU,QAAQ,EAC9CJ,MAAMK,QAAQ,IAAIX,OAAOW,QAAQ,EACjCL,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMH,IAAI,EAAE;QACd,oDAAoD;QACpDG,MAAMH,IAAI,CAACI,SAAS,GAAGT,KAAKG,qBAAqBE,IAAI,EAAEH,OAAOG,IAAI,EAAEG,MAAMH,IAAI,CAACI,SAAS;IAC1F;IACA,IAAID,MAAMF,QAAQ,EAAE;QAClB,oDAAoD;QACpDE,MAAMF,QAAQ,CAACG,SAAS,GAAGT,KAAKG,qBAAqBG,QAAQ,EAAEJ,OAAOI,QAAQ,EAAEE,MAAMF,QAAQ,CAACG,SAAS;IAC1G;IAEAR,yBAAyB;QAAE,GAAGO,KAAK;QAAEM,cAAc;IAAS;IAC5D,OAAON;AACT,EAAE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { clsx } from "clsx";
|
|
3
|
+
import { useButtonStyles_unstable } from "../Button/useButtonStyles.styles.css.js";
|
|
4
|
+
import styles from "./MenuButton.module.css";
|
|
5
|
+
export const menuButtonClassNames = {
|
|
6
|
+
root: 'fui-MenuButton',
|
|
7
|
+
icon: 'fui-MenuButton__icon',
|
|
8
|
+
menuIcon: 'fui-MenuButton__menuIcon'
|
|
9
|
+
};
|
|
10
|
+
export const useMenuButtonStyles_unstable = (state)=>{
|
|
11
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
12
|
+
state.root.className = clsx(menuButtonClassNames.root, styles.root, styles[state.appearance], styles[state.size], state.root['aria-expanded'] && styles.expanded, state.iconOnly && styles.iconOnly, state.root.className);
|
|
13
|
+
if (state.icon) {
|
|
14
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
15
|
+
state.icon.className = clsx(menuButtonClassNames.icon, styles.icon, state.icon.className);
|
|
16
|
+
}
|
|
17
|
+
if (state.menuIcon) {
|
|
18
|
+
// eslint-disable-next-line react-hooks/immutability
|
|
19
|
+
state.menuIcon.className = clsx(menuButtonClassNames.menuIcon, styles.menuIcon, state.menuIcon.className);
|
|
20
|
+
}
|
|
21
|
+
useButtonStyles_unstable({
|
|
22
|
+
...state,
|
|
23
|
+
iconPosition: 'before'
|
|
24
|
+
});
|
|
25
|
+
return state;
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.styles.css.ts"],"sourcesContent":["'use client';\n\nimport { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles.css';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\nimport styles from './MenuButton.module.css';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = clsx(\n menuButtonClassNames.root,\n styles.root,\n styles[state.appearance],\n styles[state.size],\n state.root['aria-expanded'] && styles.expanded,\n state.iconOnly && styles.iconOnly,\n state.root.className,\n );\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = clsx(menuButtonClassNames.icon, styles.icon, state.icon.className);\n }\n if (state.menuIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.menuIcon.className = clsx(menuButtonClassNames.menuIcon, styles.menuIcon, state.menuIcon.className);\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n return state;\n};\n"],"names":["clsx","useButtonStyles_unstable","styles","menuButtonClassNames","root","icon","menuIcon","useMenuButtonStyles_unstable","state","className","appearance","size","expanded","iconOnly","iconPosition"],"mappings":"AAAA;AAEA,SAASA,IAAI,QAAQ,OAAO;AAE5B,SAASC,wBAAwB,QAAQ,0CAAuC;AAEhF,OAAOC,YAAY,0BAA0B;AAE7C,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,+BAA+B,CAACC;IAC3C,oDAAoD;IACpDA,MAAMJ,IAAI,CAACK,SAAS,GAAGT,KACrBG,qBAAqBC,IAAI,EACzBF,OAAOE,IAAI,EACXF,MAAM,CAACM,MAAME,UAAU,CAAC,EACxBR,MAAM,CAACM,MAAMG,IAAI,CAAC,EAClBH,MAAMJ,IAAI,CAAC,gBAAgB,IAAIF,OAAOU,QAAQ,EAC9CJ,MAAMK,QAAQ,IAAIX,OAAOW,QAAQ,EACjCL,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMH,IAAI,EAAE;QACd,oDAAoD;QACpDG,MAAMH,IAAI,CAACI,SAAS,GAAGT,KAAKG,qBAAqBE,IAAI,EAAEH,OAAOG,IAAI,EAAEG,MAAMH,IAAI,CAACI,SAAS;IAC1F;IACA,IAAID,MAAMF,QAAQ,EAAE;QAClB,oDAAoD;QACpDE,MAAMF,QAAQ,CAACG,SAAS,GAAGT,KAAKG,qBAAqBG,QAAQ,EAAEJ,OAAOI,QAAQ,EAAEE,MAAMF,QAAQ,CAACG,SAAS;IAC1G;IAEAR,yBAAyB;QAAE,GAAGO,KAAK;QAAEM,cAAc;IAAS;IAC5D,OAAON;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/MenuButton/useMenuButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { iconFilledClassName, iconRegularClassName } from '@fluentui/react-icons';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport { useButtonStyles_unstable } from '../Button/useButtonStyles.styles';\nimport type { MenuButtonSlots, MenuButtonState } from './MenuButton.types';\n\nexport const menuButtonClassNames: SlotClassNames<MenuButtonSlots> = {\n root: 'fui-MenuButton',\n icon: 'fui-MenuButton__icon',\n menuIcon: 'fui-MenuButton__menuIcon',\n};\n\nconst useRootExpandedStyles = makeStyles({\n base: {\n [`& .${iconFilledClassName}`]: {\n display: 'inline',\n },\n [`& .${iconRegularClassName}`]: {\n display: 'none',\n },\n },\n\n // Appearance variations\n outline: {\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n ...shorthands.borderWidth(tokens.strokeWidthThicker),\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n backgroundColor: tokens.colorBrandBackgroundSelected,\n },\n secondary: {\n backgroundColor: tokens.colorNeutralBackground1Selected,\n ...shorthands.borderColor(tokens.colorNeutralStroke1Selected),\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n backgroundColor: tokens.colorSubtleBackgroundSelected,\n color: tokens.colorNeutralForeground2Selected,\n },\n transparent: {\n backgroundColor: tokens.colorTransparentBackgroundSelected,\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n});\n\nconst useIconExpandedStyles = makeStyles({\n // Appearance variations\n outline: {\n color: tokens.colorNeutralForeground1Selected,\n },\n primary: {\n /* The primary styles are exactly the same as the base styles. */\n },\n secondary: {\n color: tokens.colorNeutralForeground1Selected,\n },\n subtle: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n transparent: {\n color: tokens.colorNeutralForeground2BrandSelected,\n },\n highContrast: {\n // High contrast styles\n '@media (forced-colors: active)': {\n ':hover': {\n color: 'Highlight',\n },\n },\n },\n});\n\nconst useMenuIconStyles = makeStyles({\n base: {\n lineHeight: 0,\n },\n\n // Size appearance\n small: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n medium: {\n fontSize: '12px',\n height: '12px',\n lineHeight: tokens.lineHeightBase200,\n width: '12px',\n },\n large: {\n fontSize: '16px',\n height: '16px',\n lineHeight: tokens.lineHeightBase400,\n width: '16px',\n },\n\n // Not-icon only\n notIconOnly: {\n marginLeft: tokens.spacingHorizontalXS,\n },\n});\n\nexport const useMenuButtonStyles_unstable = (state: MenuButtonState): MenuButtonState => {\n const rootExpandedStyles = useRootExpandedStyles();\n const iconExpandedStyles = useIconExpandedStyles();\n const menuIconStyles = useMenuIconStyles();\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n menuButtonClassNames.root,\n state.root['aria-expanded'] && rootExpandedStyles.base,\n state.root['aria-expanded'] && rootExpandedStyles[state.appearance],\n state.root.className,\n );\n\n if (state.icon) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.className = mergeClasses(\n menuButtonClassNames.icon,\n state.root['aria-expanded'] && iconExpandedStyles[state.appearance] && iconExpandedStyles.highContrast,\n state.icon.className,\n );\n }\n\n if (state.menuIcon) {\n // eslint-disable-next-line react-hooks/immutability\n state.menuIcon.className = mergeClasses(\n menuButtonClassNames.menuIcon,\n menuIconStyles.base,\n menuIconStyles[state.size],\n !state.iconOnly && menuIconStyles.notIconOnly,\n state.menuIcon.className,\n );\n }\n\n useButtonStyles_unstable({ ...state, iconPosition: 'before' });\n\n return state;\n};\n"],"names":["iconFilledClassName","iconRegularClassName","tokens","mergeClasses","makeStyles","shorthands","useButtonStyles_unstable","menuButtonClassNames","root","icon","menuIcon","useRootExpandedStyles","base","display","outline","borderColor","colorNeutralStroke1Selected","borderWidth","strokeWidthThicker","color","colorNeutralForeground1Selected","primary","backgroundColor","colorBrandBackgroundSelected","secondary","colorNeutralBackground1Selected","subtle","colorSubtleBackgroundSelected","colorNeutralForeground2Selected","transparent","colorTransparentBackgroundSelected","colorNeutralForeground2BrandSelected","useIconExpandedStyles","highContrast","useMenuIconStyles","lineHeight","small","fontSize","height","lineHeightBase200","width","medium","large","lineHeightBase400","notIconOnly","marginLeft","spacingHorizontalXS","useMenuButtonStyles_unstable","state","rootExpandedStyles","iconExpandedStyles","menuIconStyles","className","appearance","size","iconOnly","iconPosition"],"mappings":"AAAA;AAEA,SAASA,mBAAmB,EAAEC,oBAAoB,QAAQ,wBAAwB;AAClF,SAASC,MAAM,QAAQ,wBAAwB;AAE/C,SAASC,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAQ,iBAAiB;AACtE,SAASC,wBAAwB,QAAQ,sCAAmC;AAG5E,OAAO,MAAMC,uBAAwD;IACnEC,MAAM;IACNC,MAAM;IACNC,UAAU;AACZ,EAAE;AAEF,MAAMC,wBAAwBP,WAAW;IACvCQ,MAAM;QACJ,CAAC,CAAC,GAAG,EAAEZ,qBAAqB,CAAC,EAAE;YAC7Ba,SAAS;QACX;QACA,CAAC,CAAC,GAAG,EAAEZ,sBAAsB,CAAC,EAAE;YAC9BY,SAAS;QACX;IACF;IAEA,wB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EA,gBAAgB;IAChBI,aAAa;QACXC,YAAY3C,OAAO4C,mBAAmB;IACxC;AACF;AAEA,OAAO,MAAMC,+BAA+B,CAACC;IAC3C,MAAMC,qBAAqBtC;IAC3B,MAAMuC,qBAAqBlB;IAC3B,MAAMmB,iBAAiBjB;IAEvB,oDAAoD;IACpDc,MAAMxC,IAAI,CAAC4C,SAAS,GAAGjD,aACrBI,qBAAqBC,IAAI,EACzBwC,MAAMxC,IAAI,CAAC,gBAAgB,IAAIyC,mBAAmBrC,IAAI,EACtDoC,MAAMxC,IAAI,CAAC,gBAAgB,IAAIyC,kBAAkB,CAACD,MAAMK,UAAU,CAAC,EACnEL,MAAMxC,IAAI,CAAC4C,SAAS;IAGtB,IAAIJ,MAAMvC,IAAI,EAAE;QACd,oDAAoD;QACpDuC,MAAMvC,IAAI,CAAC2C,SAAS,GAAGjD,aACrBI,qBAAqBE,IAAI,EACzBuC,MAAMxC,IAAI,CAAC,gBAAgB,IAAI0C,kBAAkB,CAACF,MAAMK,UAAU,CAAC,IAAIH,mBAAmBjB,YAAY,EACtGe,MAAMvC,IAAI,CAAC2C,SAAS;IAExB;IAEA,IAAIJ,MAAMtC,QAAQ,EAAE;QAClB,oDAAoD;QACpDsC,MAAMtC,QAAQ,CAAC0C,SAAS,GAAGjD,aACzBI,qBAAqBG,QAAQ,EAC7ByC,eAAevC,IAAI,EACnBuC,cAAc,CAACH,MAAMM,IAAI,CAAC,EAC1B,CAACN,MAAMO,QAAQ,IAAIJ,eAAeP,WAAW,EAC7CI,MAAMtC,QAAQ,CAAC0C,SAAS;IAE5B;IAEA9C,yBAAyB;QAAE,GAAG0C,KAAK;QAAEQ,cAAc;IAAS;IAE5D,OAAOR;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/SplitButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderSplitButton_unstable } from './renderSplitButton';\nimport { useSplitButton_unstable } from './useSplitButton';\nimport { useSplitButtonStyles_unstable } from './useSplitButtonStyles.styles';\nimport type { SplitButtonProps } from './SplitButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * SplitButtons are a grouping of two interactive surfaces where interacting with the first one triggers a primary\n * action, while interacting with the second one opens a menu with secondary actions.\n */\nexport const SplitButton: ForwardRefComponent<SplitButtonProps> = React.forwardRef<HTMLDivElement, SplitButtonProps>(\n (props, ref) => {\n const state = useSplitButton_unstable(props, ref);\n\n useSplitButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useSplitButtonStyles_unstable')(state);\n\n return renderSplitButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n },\n) as ForwardRefComponent<SplitButtonProps>;\n\nSplitButton.displayName = 'SplitButton';\n"],"names":["React","renderSplitButton_unstable","useSplitButton_unstable","useSplitButtonStyles_unstable","useCustomStyleHook_unstable","SplitButton","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,6BAA6B,QAAQ,mCAAgC;AAG9E,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAChF,CAACC,OAAOC;IACN,MAAMC,QAAQP,wBAAwBK,OAAOC;IAE7CL,8BAA8BM;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAOR,2BAA2BQ;AAClC,0FAA0F;AAC5F,GACyC;AAE3CJ,YAAYK,WAAW,GAAG"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.root:where(.outline, .primary, .secondary, .subtle, .transparent) {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
justify-content: stretch;
|
|
5
|
+
position: relative;
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.root .primaryActionButton,
|
|
10
|
+
.primaryActionButton[data-fui-focus-visible] {
|
|
11
|
+
border-start-end-radius: 0;
|
|
12
|
+
border-end-end-radius: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.root .menuButton,
|
|
16
|
+
.menuButton[data-fui-focus-visible] {
|
|
17
|
+
/* Keep the shared edge borderless even when an unlayered custom style hook sets all border widths. */
|
|
18
|
+
border-inline-start-width: 0 !important;
|
|
19
|
+
border-start-start-radius: 0;
|
|
20
|
+
border-end-start-radius: 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.root .menuButton {
|
|
24
|
+
/* WCAG's minimum adjacent pointer target is 24 CSS pixels, independent of theme spacing. */
|
|
25
|
+
min-width: 24px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.primary .primaryActionButton,
|
|
29
|
+
.primary:hover .primaryActionButton,
|
|
30
|
+
.primary:hover:active .primaryActionButton,
|
|
31
|
+
.primary:active:focus-visible .primaryActionButton {
|
|
32
|
+
border-inline-end-color: var(--colorNeutralStrokeOnBrand);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.root:where(.subtle, .transparent) .primaryActionButton {
|
|
36
|
+
border-inline-end-color: var(--colorTransparentBackground);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.root:where(.subtle, .transparent):hover .primaryActionButton {
|
|
40
|
+
border-inline-end-color: var(--colorTransparentBackgroundHover);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.root:where(.subtle, .transparent):hover:active .primaryActionButton,
|
|
44
|
+
.root:where(.subtle, .transparent):active:focus-visible .primaryActionButton {
|
|
45
|
+
border-inline-end-color: var(--colorTransparentBackgroundPressed);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.disabled .primaryActionButton,
|
|
49
|
+
.disabled:hover .primaryActionButton,
|
|
50
|
+
.disabled:hover:active .primaryActionButton,
|
|
51
|
+
.disabled:active:focus-visible .primaryActionButton {
|
|
52
|
+
border-inline-end-color: var(--colorNeutralStrokeDisabled);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@media (forced-colors: active) {
|
|
56
|
+
.primary .primaryActionButton {
|
|
57
|
+
border-inline-end-color: HighlightText;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.primary:hover .primaryActionButton,
|
|
61
|
+
.primary:hover:active .primaryActionButton,
|
|
62
|
+
.primary:active:focus-visible .primaryActionButton {
|
|
63
|
+
border-inline-end-color: Highlight;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.disabled .primaryActionButton,
|
|
67
|
+
.disabled:hover .primaryActionButton,
|
|
68
|
+
.disabled:hover:active .primaryActionButton,
|
|
69
|
+
.disabled:active:focus-visible .primaryActionButton {
|
|
70
|
+
border-inline-end-color: GrayText;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/SplitButton.types.ts"],"sourcesContent":["import type { Button } from '../Button/Button';\nimport type { MenuButton } from '../MenuButton/MenuButton';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { ButtonBaseProps, ButtonProps, ButtonState } from '../Button/Button.types';\nimport type { MenuButtonBaseProps, 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\nexport type SplitButtonBaseSlots = {\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<MenuButtonBaseProps>;\n /**\n * Button to perform primary action in SplitButton.\n */\n primaryActionButton?: Slot<ButtonBaseProps>;\n};\n\n/**\n * SplitButton props without the `appearance`/`size`/`shape` styling props, for headless usage.\n */\nexport type SplitButtonBaseProps = ComponentProps<SplitButtonBaseSlots> &\n Pick<ButtonBaseProps, 'disabled' | 'disabledFocusable' | 'icon' | 'iconPosition'> &\n Pick<MenuButtonBaseProps, 'menuIcon'>;\n\n/**\n * SplitButton state without the `appearance`/`size`/`shape` styling props, for headless usage.\n */\nexport type SplitButtonBaseState = ComponentState<SplitButtonBaseSlots> &\n Required<Pick<SplitButtonBaseProps, 'disabled' | 'disabledFocusable' | 'iconPosition'>>;\n"],"names":[],"mappings":"AAqDA;;CAEC,GACD,WAC0F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/index.ts"],"sourcesContent":["export { SplitButton } from './SplitButton';\nexport type {\n SplitButtonBaseProps,\n SplitButtonBaseSlots,\n SplitButtonBaseState,\n SplitButtonProps,\n SplitButtonSlots,\n SplitButtonState,\n} from './SplitButton.types';\nexport { renderSplitButton_unstable } from './renderSplitButton';\nexport { useSplitButton_unstable, useSplitButtonBase_unstable } from './useSplitButton';\nexport { splitButtonClassNames, useSplitButtonStyles_unstable } from './useSplitButtonStyles.styles';\n"],"names":["SplitButton","renderSplitButton_unstable","useSplitButton_unstable","useSplitButtonBase_unstable","splitButtonClassNames","useSplitButtonStyles_unstable"],"mappings":"AAAA,SAASA,WAAW,QAAQ,mBAAgB;AAS5C,SAASC,0BAA0B,QAAQ,yBAAsB;AACjE,SAASC,uBAAuB,EAAEC,2BAA2B,QAAQ,sBAAmB;AACxF,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,mCAAgC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { assertSlots } from "@fluentui/react-utilities";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from "@fluentui/react-utilities";
|
|
3
3
|
/**
|
|
4
4
|
* Renders a SplitButton component by passing the state defined props to the appropriate slots.
|
|
5
5
|
*/ export const renderSplitButton_unstable = (state)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/renderSplitButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ComponentState, JSXElement } from '@fluentui/react-utilities';\n\nimport type { SplitButtonBaseSlots } from './SplitButton.types';\n\n/**\n * Renders a SplitButton component by passing the state defined props to the appropriate slots.\n */\nexport const renderSplitButton_unstable = (\n state: Pick<ComponentState<SplitButtonBaseSlots>, 'root' | 'menuButton' | 'primaryActionButton'>,\n): JSXElement => {\n assertSlots<SplitButtonBaseSlots>(state);\n\n return (\n <state.root>\n {state.primaryActionButton && <state.primaryActionButton />}\n {state.menuButton && <state.menuButton />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderSplitButton_unstable","state","root","primaryActionButton","menuButton"],"mappings":";AAAA,0BAA0B,GAC1B,iDAAiD,GAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CACxCC;IAEAF,YAAkCE;IAElC,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,mBAAmB,kBAAI,KAACF,MAAME,mBAAmB;YACvDF,MAAMG,UAAU,kBAAI,KAACH,MAAMG,UAAU;;;AAG5C,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/useSplitButton.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { useId, slot } from '@fluentui/react-utilities';\nimport { Button } from '../Button/Button';\nimport { MenuButton } from '../MenuButton/MenuButton';\nimport type {\n SplitButtonBaseProps,\n SplitButtonBaseState,\n SplitButtonProps,\n SplitButtonState,\n} 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 = (props: SplitButtonProps, ref: React.Ref<HTMLDivElement>): SplitButtonState => {\n const { appearance = 'secondary', icon, menuIcon, shape = 'rounded', size = 'medium', ...rest } = props;\n const baseState = useSplitButtonBase_unstable(rest, ref);\n\n const menuButtonShorthand = slot.optional(props.menuButton, {\n defaultProps: {\n ...baseState.menuButton,\n appearance,\n disabledFocusable: baseState.disabledFocusable,\n menuIcon,\n shape,\n size,\n },\n renderByDefault: true,\n elementType: MenuButton,\n });\n const primaryActionButtonShorthand = slot.optional(props.primaryActionButton, {\n defaultProps: {\n ...baseState.primaryActionButton,\n appearance,\n disabledFocusable: baseState.disabledFocusable,\n icon,\n iconPosition: baseState.iconPosition,\n shape,\n size,\n },\n renderByDefault: true,\n elementType: Button,\n });\n\n return {\n ...baseState,\n // Props passed at the top-level\n appearance,\n shape,\n size,\n // Slots definition\n components: { root: 'div', menuButton: MenuButton, primaryActionButton: Button },\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n\n/**\n * Base hook for SplitButton component, which manages design-agnostic state related to slots\n * structure and ARIA attributes, without design-specific props such as `appearance`, `shape`, or\n * `size`.\n *\n * Concrete wrappers recreate child slots from these base prop defaults before rendering.\n *\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 useSplitButtonBase_unstable = (\n props: SplitButtonBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): SplitButtonBaseState => {\n const {\n children,\n disabled = false,\n disabledFocusable = false,\n icon,\n iconPosition = 'before',\n menuButton,\n menuIcon,\n primaryActionButton,\n ...rest\n } = props;\n const baseId = useId('splitButton-');\n\n const menuButtonShorthand = slot.optional(menuButton, {\n defaultProps: {\n disabled,\n },\n renderByDefault: true,\n elementType: 'button',\n });\n\n const primaryActionButtonShorthand = slot.optional(primaryActionButton, {\n defaultProps: {\n children,\n disabled,\n id: baseId + '__primaryActionButton',\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 disabled,\n disabledFocusable,\n iconPosition,\n // Slots definition\n components: { root: 'div', menuButton: 'button', primaryActionButton: 'button' },\n root: slot.always({ ref, ...rest }, { elementType: 'div' }),\n menuButton: menuButtonShorthand,\n primaryActionButton: primaryActionButtonShorthand,\n };\n};\n"],"names":["useId","slot","Button","MenuButton","useSplitButton_unstable","props","ref","appearance","icon","menuIcon","shape","size","rest","baseState","useSplitButtonBase_unstable","menuButtonShorthand","optional","menuButton","defaultProps","disabledFocusable","renderByDefault","elementType","primaryActionButtonShorthand","primaryActionButton","iconPosition","components","root","children","disabled","baseId","id","always"],"mappings":"AAAA;AAGA,SAASA,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AACxD,SAASC,MAAM,QAAQ,sBAAmB;AAC1C,SAASC,UAAU,QAAQ,8BAA2B;AAQtD;;;;CAIC,GACD,OAAO,MAA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qBAAqB;QACtEL,cAAc;YACZS;YACAC;YACAE,IAAID,SAAS;QACf;QACAT,iBAAiB;QACjBC,aAAa;IACf;IAEA,oHAAoH;IACpH,QAAQ;IACR,IACEN,uBACAO,gCACA,CAACP,mBAAmB,CAAC,aAAa,IAClC,CAACA,mBAAmB,CAAC,kBAAkB,EACvC;QACAA,mBAAmB,CAAC,kBAAkB,GAAGO,6BAA6BQ,EAAE;IAC1E;IAEA,OAAO;QACLF;QACAT;QACAK;QACA,mBAAmB;QACnBC,YAAY;YAAEC,MAAM;YAAOT,YAAY;YAAUM,qBAAqB;QAAS;QAC/EG,MAAMzB,KAAK8B,MAAM,CAAC;YAAEzB;YAAK,GAAGM,IAAI;QAAC,GAAG;YAAES,aAAa;QAAM;QACzDJ,YAAYF;QACZQ,qBAAqBD;IACvB;AACF,EAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./SplitButton.module.css";
|
|
3
|
+
export const splitButtonClassNames = {
|
|
4
|
+
root: 'fui-SplitButton',
|
|
5
|
+
menuButton: 'fui-SplitButton__menuButton',
|
|
6
|
+
primaryActionButton: 'fui-SplitButton__primaryActionButton'
|
|
7
|
+
};
|
|
8
|
+
export const useSplitButtonStyles_unstable = (state)=>{
|
|
9
|
+
state.root.className = clsx(splitButtonClassNames.root, styles.root, styles[state.appearance], (state.disabled || state.disabledFocusable) && styles.disabled, state.root.className);
|
|
10
|
+
if (state.menuButton) {
|
|
11
|
+
state.menuButton.className = clsx(splitButtonClassNames.menuButton, styles.menuButton, state.menuButton.className);
|
|
12
|
+
}
|
|
13
|
+
if (state.primaryActionButton) {
|
|
14
|
+
state.primaryActionButton.className = clsx(splitButtonClassNames.primaryActionButton, styles.primaryActionButton, state.primaryActionButton.className);
|
|
15
|
+
}
|
|
16
|
+
return state;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/useSplitButtonStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\nimport styles from './SplitButton.module.css';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n state.root.className = clsx(\n splitButtonClassNames.root,\n styles.root,\n styles[state.appearance],\n (state.disabled || state.disabledFocusable) && styles.disabled,\n state.root.className,\n );\n if (state.menuButton) {\n state.menuButton.className = clsx(splitButtonClassNames.menuButton, styles.menuButton, state.menuButton.className);\n }\n if (state.primaryActionButton) {\n state.primaryActionButton.className = clsx(\n splitButtonClassNames.primaryActionButton,\n styles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n return state;\n};\n"],"names":["clsx","styles","splitButtonClassNames","root","menuButton","primaryActionButton","useSplitButtonStyles_unstable","state","className","appearance","disabled","disabledFocusable"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,2BAA2B;AAE9C,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,YAAY;IACZC,qBAAqB;AACvB,EAAE;AAEF,OAAO,MAAMC,gCAAgC,CAACC;IAC5CA,MAAMJ,IAAI,CAACK,SAAS,GAAGR,KACrBE,sBAAsBC,IAAI,EAC1BF,OAAOE,IAAI,EACXF,MAAM,CAACM,MAAME,UAAU,CAAC,EACxB,AAACF,CAAAA,MAAMG,QAAQ,IAAIH,MAAMI,iBAAiB,AAAD,KAAMV,OAAOS,QAAQ,EAC9DH,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMH,UAAU,EAAE;QACpBG,MAAMH,UAAU,CAACI,SAAS,GAAGR,KAAKE,sBAAsBE,UAAU,EAAEH,OAAOG,UAAU,EAAEG,MAAMH,UAAU,CAACI,SAAS;IACnH;IACA,IAAID,MAAMF,mBAAmB,EAAE;QAC7BE,MAAMF,mBAAmB,CAACG,SAAS,GAAGR,KACpCE,sBAAsBG,mBAAmB,EACzCJ,OAAOI,mBAAmB,EAC1BE,MAAMF,mBAAmB,CAACG,SAAS;IAEvC;IACA,OAAOD;AACT,EAAE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import styles from "./SplitButton.module.css";
|
|
3
|
+
export const splitButtonClassNames = {
|
|
4
|
+
root: 'fui-SplitButton',
|
|
5
|
+
menuButton: 'fui-SplitButton__menuButton',
|
|
6
|
+
primaryActionButton: 'fui-SplitButton__primaryActionButton'
|
|
7
|
+
};
|
|
8
|
+
export const useSplitButtonStyles_unstable = (state)=>{
|
|
9
|
+
state.root.className = clsx(splitButtonClassNames.root, styles.root, styles[state.appearance], (state.disabled || state.disabledFocusable) && styles.disabled, state.root.className);
|
|
10
|
+
if (state.menuButton) {
|
|
11
|
+
state.menuButton.className = clsx(splitButtonClassNames.menuButton, styles.menuButton, state.menuButton.className);
|
|
12
|
+
}
|
|
13
|
+
if (state.primaryActionButton) {
|
|
14
|
+
state.primaryActionButton.className = clsx(splitButtonClassNames.primaryActionButton, styles.primaryActionButton, state.primaryActionButton.className);
|
|
15
|
+
}
|
|
16
|
+
return state;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/useSplitButtonStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\nimport styles from './SplitButton.module.css';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n state.root.className = clsx(\n splitButtonClassNames.root,\n styles.root,\n styles[state.appearance],\n (state.disabled || state.disabledFocusable) && styles.disabled,\n state.root.className,\n );\n if (state.menuButton) {\n state.menuButton.className = clsx(splitButtonClassNames.menuButton, styles.menuButton, state.menuButton.className);\n }\n if (state.primaryActionButton) {\n state.primaryActionButton.className = clsx(\n splitButtonClassNames.primaryActionButton,\n styles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n return state;\n};\n"],"names":["clsx","styles","splitButtonClassNames","root","menuButton","primaryActionButton","useSplitButtonStyles_unstable","state","className","appearance","disabled","disabledFocusable"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,YAAY,2BAA2B;AAE9C,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,YAAY;IACZC,qBAAqB;AACvB,EAAE;AAEF,OAAO,MAAMC,gCAAgC,CAACC;IAC5CA,MAAMJ,IAAI,CAACK,SAAS,GAAGR,KACrBE,sBAAsBC,IAAI,EAC1BF,OAAOE,IAAI,EACXF,MAAM,CAACM,MAAME,UAAU,CAAC,EACxB,AAACF,CAAAA,MAAMG,QAAQ,IAAIH,MAAMI,iBAAiB,AAAD,KAAMV,OAAOS,QAAQ,EAC9DH,MAAMJ,IAAI,CAACK,SAAS;IAEtB,IAAID,MAAMH,UAAU,EAAE;QACpBG,MAAMH,UAAU,CAACI,SAAS,GAAGR,KAAKE,sBAAsBE,UAAU,EAAEH,OAAOG,UAAU,EAAEG,MAAMH,UAAU,CAACI,SAAS;IACnH;IACA,IAAID,MAAMF,mBAAmB,EAAE;QAC7BE,MAAMF,mBAAmB,CAACG,SAAS,GAAGR,KACpCE,sBAAsBG,mBAAmB,EACzCJ,OAAOI,mBAAmB,EAC1BE,MAAMF,mBAAmB,CAACG,SAAS;IAEvC;IACA,OAAOD;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/SplitButton/useSplitButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\n// WCAG minimum target size for pointer targets that are immediately adjacent to other targets:\n// https://w3c.github.io/wcag/guidelines/22/#target-size-minimum\nconst MIN_TARGET_SIZE = '24px';\n\nconst useFocusStyles = makeStyles({\n primaryActionButton: createCustomFocusIndicatorStyle({\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n }),\n\n menuButton: createCustomFocusIndicatorStyle({\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }),\n});\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n [`& .${splitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n minWidth: MIN_TARGET_SIZE,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'HighlightText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled styles\n disabled: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, disabled, disabledFocusable } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n state.root.className,\n );\n\n if (state.menuButton) {\n // eslint-disable-next-line react-hooks/immutability\n state.menuButton.className = mergeClasses(\n splitButtonClassNames.menuButton,\n focusStyles.menuButton,\n state.menuButton.className,\n );\n }\n\n if (state.primaryActionButton) {\n // eslint-disable-next-line react-hooks/immutability\n state.primaryActionButton.className = mergeClasses(\n splitButtonClassNames.primaryActionButton,\n focusStyles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","createCustomFocusIndicatorStyle","tokens","splitButtonClassNames","root","menuButton","primaryActionButton","MIN_TARGET_SIZE","useFocusStyles","borderTopRightRadius","borderBottomRightRadius","borderLeftWidth","borderTopLeftRadius","borderBottomLeftRadius","useRootStyles","base","display","justifyContent","position","verticalAlign","minWidth","outline","primary","borderRightColor","colorNeutralStrokeOnBrand","secondary","subtle","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","transparent","circular","rounded","square","disabled","colorNeutralStrokeDisabled","disabledHighContrast","useSplitButtonStyles_unstable","state","rootStyles","focusStyles","appearance","disabledFocusable","className"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAA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AAU,EAChCmC,YAAYnC,UAAU,EACtBiC,MAAMjC,UAAU,CAACsC,SAAS;IAE9B;IAEA,IAAIL,MAAMhC,mBAAmB,EAAE;QAC7B,oDAAoD;QACpDgC,MAAMhC,mBAAmB,CAACqC,SAAS,GAAG3C,aACpCG,sBAAsBG,mBAAmB,EACzCkC,YAAYlC,mBAAmB,EAC/BgC,MAAMhC,mBAAmB,CAACqC,SAAS;IAEvC;IAEA,OAAOL;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SplitButton/useSplitButtonStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { createCustomFocusIndicatorStyle } from '@fluentui/react-tabster';\nimport { tokens } from '@fluentui/react-theme';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { SplitButtonSlots, SplitButtonState } from './SplitButton.types';\n\nexport const splitButtonClassNames: SlotClassNames<SplitButtonSlots> = {\n root: 'fui-SplitButton',\n menuButton: 'fui-SplitButton__menuButton',\n primaryActionButton: 'fui-SplitButton__primaryActionButton',\n};\n\n// WCAG minimum target size for pointer targets that are immediately adjacent to other targets:\n// https://w3c.github.io/wcag/guidelines/22/#target-size-minimum\nconst MIN_TARGET_SIZE = '24px';\n\nconst useFocusStyles = makeStyles({\n primaryActionButton: createCustomFocusIndicatorStyle({\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n }),\n\n menuButton: createCustomFocusIndicatorStyle({\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n }),\n});\n\nconst useRootStyles = makeStyles({\n // Base styles\n base: {\n display: 'inline-flex',\n justifyContent: 'stretch',\n position: 'relative',\n verticalAlign: 'middle',\n\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderTopRightRadius: 0,\n borderBottomRightRadius: 0,\n },\n\n [`& .${splitButtonClassNames.menuButton}`]: {\n borderLeftWidth: 0,\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n minWidth: MIN_TARGET_SIZE,\n },\n },\n\n // Appearance variations\n outline: {\n /* No styles */\n },\n primary: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeOnBrand,\n },\n },\n\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'HighlightText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'Highlight',\n },\n },\n },\n },\n secondary: {\n /* The secondary styles are exactly the same as the base styles. */\n },\n subtle: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n transparent: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackground,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundHover,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorTransparentBackgroundPressed,\n },\n },\n },\n\n // Shape variations\n circular: {},\n rounded: {},\n square: {},\n\n // Disabled styles\n disabled: {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: tokens.colorNeutralStrokeDisabled,\n },\n },\n },\n\n // Disabled high contrast styles\n disabledHighContrast: {\n '@media (forced-colors: active)': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n\n ':hover': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n\n ':hover:active,:active:focus-visible': {\n [`& .${splitButtonClassNames.primaryActionButton}`]: {\n borderRightColor: 'GrayText',\n },\n },\n },\n },\n});\n\nexport const useSplitButtonStyles_unstable = (state: SplitButtonState): SplitButtonState => {\n const rootStyles = useRootStyles();\n const focusStyles = useFocusStyles();\n\n const { appearance, disabled, disabledFocusable } = state;\n\n // eslint-disable-next-line react-hooks/immutability\n state.root.className = mergeClasses(\n splitButtonClassNames.root,\n rootStyles.base,\n appearance && rootStyles[appearance],\n (disabled || disabledFocusable) && rootStyles.disabled,\n (disabled || disabledFocusable) && rootStyles.disabledHighContrast,\n state.root.className,\n );\n\n if (state.menuButton) {\n // eslint-disable-next-line react-hooks/immutability\n state.menuButton.className = mergeClasses(\n splitButtonClassNames.menuButton,\n focusStyles.menuButton,\n state.menuButton.className,\n );\n }\n\n if (state.primaryActionButton) {\n // eslint-disable-next-line react-hooks/immutability\n state.primaryActionButton.className = mergeClasses(\n splitButtonClassNames.primaryActionButton,\n focusStyles.primaryActionButton,\n state.primaryActionButton.className,\n );\n }\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","createCustomFocusIndicatorStyle","tokens","splitButtonClassNames","root","menuButton","primaryActionButton","MIN_TARGET_SIZE","useFocusStyles","borderTopRightRadius","borderBottomRightRadius","borderLeftWidth","borderTopLeftRadius","borderBottomLeftRadius","useRootStyles","base","display","justifyContent","position","verticalAlign","minWidth","outline","primary","borderRightColor","colorNeutralStrokeOnBrand","secondary","subtle","colorTransparentBackground","colorTransparentBackgroundHover","colorTransparentBackgroundPressed","transparent","circular","rounded","square","disabled","colorNeutralStrokeDisabled","disabledHighContrast","useSplitButtonStyles_unstable","state","rootStyles","focusStyles","appearance","disabledFocusable","className"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,+BAA+B,QAAQ,0BAA0B;AAC1E,SAASC,MAAM,QAAQ,wBAAwB;AAI/C,OAAO,MAAMC,wBAA0D;IACrEC,MAAM;IACNC,YAAY;IACZC,qBAAqB;AACvB,EAAE;AAEF,+FAA+F;AAC/F,gEAAgE;AAChE,MAAMC,kBAAkB;AAExB,MAAMC,iBAAiBT,WAAW;IAChCO,qBAAqBL,gCAAgC;QACnDQ,sBAAsB;QACtBC,yBAAyB;IAC3B;IAEAL,YAAYJ,gCAAgC;QAC1CU,iBAAiB;QACjBC,qBAAqB;QACrBC,wBAAwB;IAC1B;AACF;AAEA,MAAMC,gBAAgBf,WAAW;IAC/B,cAAc;IACdgB,MAAM;QACJC,SAAS;QACTC,gBAAgB;QAChBC,UAAU;QACVC,eAAe;QAEf,CAAC,CAAC,GAAG,EAAEhB,sBAAsBG,mBAAmB,EAAE,CAAC,EAAE;YACnDG,sBAAsB;YACtBC,yBAAyB;QAC3B;QAEA,CAAC,CAAC,GAAG,EAAEP,sBAAsBE,UAAU,EAAE,CAAC,EAAE;YAC1CM,iBAAiB;YACjBC,qBAAqB;YACrBC,wBAAwB;YACxBO,UAAUb;QACZ;IACF;IAEA,wBAAwB;IACxBc,SAAS;IAET;IACAC,SAAS;QACP,CAAC,CAAC,GAAG,EAAEnB,sBAAsBG,mBAAmB,EAAE,CAAC,EAAE;YACnDiB,kBAAkBrB,OAAOsB,yBAAyB;QACpD;QAEA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AC1BmC,WAAWxB,IAAI,EACf0B,cAAcF,UAAU,CAACE,WAAW,EACpC,AAACP,CAAAA,YAAYQ,iBAAgB,KAAMH,WAAWL,QAAQ,EACtD,AAACA,CAAAA,YAAYQ,iBAAgB,KAAMH,WAAWH,oBAAoB,EAClEE,MAAMlC,IAAI,CAACuC,SAAS;IAGtB,IAAIL,MAAMjC,UAAU,EAAE;QACpB,oDAAoD;QACpDiC,MAAMjC,UAAU,CAACsC,SAAS,GAAG3C,aAC3BG,sBAAsBE,UAAU,EAChCmC,YAAYnC,UAAU,EACtBiC,MAAMjC,UAAU,CAACsC,SAAS;IAE9B;IAEA,IAAIL,MAAMhC,mBAAmB,EAAE;QAC7B,oDAAoD;QACpDgC,MAAMhC,mBAAmB,CAACqC,SAAS,GAAG3C,aACpCG,sBAAsBG,mBAAmB,EACzCkC,YAAYlC,mBAAmB,EAC/BgC,MAAMhC,mBAAmB,CAACqC,SAAS;IAEvC;IAEA,OAAOL;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ToggleButton/ToggleButton.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { renderToggleButton_unstable } from './renderToggleButton';\nimport { useToggleButton_unstable } from './useToggleButton';\nimport { useToggleButtonStyles_unstable } from './useToggleButtonStyles.styles';\nimport type { ToggleButtonProps } from './ToggleButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * ToggleButtons are buttons that toggle between two defined states when triggered.\n */\nexport const ToggleButton: ForwardRefComponent<ToggleButtonProps> = React.forwardRef((props, ref) => {\n const state = useToggleButton_unstable(props, ref);\n\n useToggleButtonStyles_unstable(state);\n\n useCustomStyleHook_unstable('useToggleButtonStyles_unstable')(state);\n\n return renderToggleButton_unstable(state);\n // Casting is required due to lack of distributive union to support unions on @types/react\n}) as ForwardRefComponent<ToggleButtonProps>;\n\nToggleButton.displayName = 'ToggleButton';\n"],"names":["React","renderToggleButton_unstable","useToggleButton_unstable","useToggleButtonStyles_unstable","useCustomStyleHook_unstable","ToggleButton","forwardRef","props","ref","state","displayName"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,QAAQ,0BAAuB;AACnE,SAASC,wBAAwB,QAAQ,uBAAoB;AAC7D,SAASC,8BAA8B,QAAQ,oCAAiC;AAGhF,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,6BAAuDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC3F,MAAMC,QAAQP,yBAAyBK,OAAOC;IAE9CL,+BAA+BM;IAE/BL,4BAA4B,kCAAkCK;IAE9D,OAAOR,4BAA4BQ;AACnC,0FAA0F;AAC5F,GAA6C;AAE7CJ,aAAaK,WAAW,GAAG"}
|