diff --git a/change/@fluentui-react-button-e9fa5c16-6940-43e0-a311-7775d9c137a0.json b/change/@fluentui-react-button-e9fa5c16-6940-43e0-a311-7775d9c137a0.json new file mode 100644 index 00000000000000..94780ff1fcac06 --- /dev/null +++ b/change/@fluentui-react-button-e9fa5c16-6940-43e0-a311-7775d9c137a0.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: Removing CompoundButtonAsToggleButton story since it was using non-exported functions.", + "packageName": "@fluentui/react-button", + "email": "makotom@microsoft.com", + "dependentChangeType": "none" +} diff --git a/packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts b/packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts index 4a6a8412dbc635..d0b2b77b39e78a 100644 --- a/packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts +++ b/packages/react-components/react-button/src/components/ToggleButton/useToggleButtonStyles.ts @@ -12,7 +12,7 @@ export const toggleButtonClassNames: SlotClassNames = { icon: 'fui-ToggleButton__icon', }; -export const useCheckedStyles = makeStyles({ +const useCheckedStyles = makeStyles({ // Base styles base: { backgroundColor: tokens.colorNeutralBackground1Selected, @@ -144,7 +144,7 @@ export const useCheckedStyles = makeStyles({ }, }); -export const useDisabledStyles = makeStyles({ +const useDisabledStyles = makeStyles({ // Base styles base: { backgroundColor: tokens.colorNeutralBackgroundDisabled, diff --git a/packages/react-components/react-button/src/stories/CompoundButton/CompoundButtonAsToggleButton.stories.tsx b/packages/react-components/react-button/src/stories/CompoundButton/CompoundButtonAsToggleButton.stories.tsx deleted file mode 100644 index bb59284747d2cb..00000000000000 --- a/packages/react-components/react-button/src/stories/CompoundButton/CompoundButtonAsToggleButton.stories.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import * as React from 'react'; -import { bundleIcon, CalendarMonthFilled, CalendarMonthRegular } from '@fluentui/react-icons'; -import { - mergeClasses, - renderCompoundButton_unstable, - useCompoundButton_unstable, - useCompoundButtonStyles_unstable, -} from '@fluentui/react-components'; -import { useToggleState } from '../../utils/useToggleState'; - -import { - useCheckedStyles as useToggleButtonCheckedStyles, - useDisabledStyles as useToggleButtonDisabledStyles, -} from '../../components/ToggleButton/useToggleButtonStyles'; -import type { - CompoundButtonProps, - CompoundButtonState, - ForwardRefComponent, - ToggleButtonProps, - ToggleButtonState, -} from '@fluentui/react-components'; - -type ToggleCompoundButtonProps = CompoundButtonProps & ToggleButtonProps; -type ToggleCompoundButtonState = CompoundButtonState & ToggleButtonState; - -const useToggleCompoundButton = ( - props: ToggleCompoundButtonProps, - ref: React.Ref, -): ToggleCompoundButtonState => { - const compoundButtonState = useCompoundButton_unstable(props, ref); - - return useToggleState(props, compoundButtonState); -}; - -const useToggleCompoundButtonStyles = (state: ToggleCompoundButtonState): ToggleCompoundButtonState => { - const checkedStyles = useToggleButtonCheckedStyles(); - const disabledStyles = useToggleButtonDisabledStyles(); - - const { appearance, checked, disabled, disabledFocusable } = state; - - state.root.className = mergeClasses( - // Checked styles - checked && checkedStyles.base, - appearance && checked && checkedStyles[appearance], - - // Disabled styles - (disabled || disabledFocusable) && disabledStyles.base, - appearance && (disabled || disabledFocusable) && disabledStyles[appearance], - - // User provided class name - state.root.className, - ); - - useCompoundButtonStyles_unstable(state); - - return state; -}; - -const ToggleCompoundButton: ForwardRefComponent = React.forwardRef((props, ref) => { - const state = useToggleCompoundButton(props, ref); - - useToggleCompoundButtonStyles(state); - - return renderCompoundButton_unstable(state); -}) as ForwardRefComponent; - -const CalendarMonth = bundleIcon(CalendarMonthFilled, CalendarMonthRegular); - -export const AsToggleButton = () => ( - } secondaryContent="Secondary content"> - Compound button that can be toggled - -); - -AsToggleButton.parameters = { - docs: { - description: { - story: 'A compound button can be recomposed via its hooks to be toggleable', - }, - }, -}; diff --git a/packages/react-components/react-button/src/stories/CompoundButton/index.stories.tsx b/packages/react-components/react-button/src/stories/CompoundButton/index.stories.tsx index 6b065f0cb67986..2ef08701574040 100644 --- a/packages/react-components/react-button/src/stories/CompoundButton/index.stories.tsx +++ b/packages/react-components/react-button/src/stories/CompoundButton/index.stories.tsx @@ -11,7 +11,6 @@ export { Icon } from './CompoundButtonIcon.stories'; export { Size } from './CompoundButtonSize.stories'; export { Disabled } from './CompoundButtonDisabled.stories'; export { WithLongText } from './CompoundButtonWithLongText.stories'; -export { AsToggleButton } from './CompoundButtonAsToggleButton.stories'; export default { title: 'Components/Button/CompoundButton',