From 5651a18bc470d9ecd7cce1ed529999e35637134d Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Fri, 23 Sep 2022 10:56:28 +0000 Subject: [PATCH 1/5] chore: move trigger methods to its own package react-trigger --- ...r-878d2c89-74e6-475d-bd81-c43652fb8f57.json | 7 +++++++ ...s-45241420-e135-4d20-b21b-77d5d4d25847.json | 7 +++++++ .../react-trigger/etc/react-trigger.api.md | 18 ++++++++++++++++++ .../react-trigger/package.json | 1 - .../src}/applyTriggerPropsToChildren.test.tsx | 0 .../src}/applyTriggerPropsToChildren.ts | 0 .../src}/getTriggerChild.test.tsx | 0 .../src}/getTriggerChild.ts | 0 .../react-trigger/src/index.ts | 6 ++++-- .../src}/isFluentTrigger.ts | 0 .../src/trigger => react-trigger/src}/types.ts | 1 - .../react-utilities/etc/react-utilities.api.md | 13 ------------- .../react-utilities/src/index.ts | 4 ---- .../react-utilities/src/trigger/index.ts | 4 ---- 14 files changed, 36 insertions(+), 25 deletions(-) create mode 100644 change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json create mode 100644 change/@fluentui-react-utilities-45241420-e135-4d20-b21b-77d5d4d25847.json rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/applyTriggerPropsToChildren.test.tsx (100%) rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/applyTriggerPropsToChildren.ts (100%) rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/getTriggerChild.test.tsx (100%) rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/getTriggerChild.ts (100%) rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/isFluentTrigger.ts (100%) rename packages/react-components/{react-utilities/src/trigger => react-trigger/src}/types.ts (97%) delete mode 100644 packages/react-components/react-utilities/src/trigger/index.ts diff --git a/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json b/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json new file mode 100644 index 00000000000000..e3110278cba25d --- /dev/null +++ b/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "feat: move trigger methods from react-utilities", + "packageName": "@fluentui/react-trigger", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "patch" +} diff --git a/change/@fluentui-react-utilities-45241420-e135-4d20-b21b-77d5d4d25847.json b/change/@fluentui-react-utilities-45241420-e135-4d20-b21b-77d5d4d25847.json new file mode 100644 index 00000000000000..6dbca30e8e8854 --- /dev/null +++ b/change/@fluentui-react-utilities-45241420-e135-4d20-b21b-77d5d4d25847.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: delete trigger methods", + "packageName": "@fluentui/react-utilities", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/packages/react-components/react-trigger/etc/react-trigger.api.md b/packages/react-components/react-trigger/etc/react-trigger.api.md index cd09b9491f2a5b..22b2bae1ee74af 100644 --- a/packages/react-components/react-trigger/etc/react-trigger.api.md +++ b/packages/react-components/react-trigger/etc/react-trigger.api.md @@ -4,6 +4,24 @@ ```ts +import * as React_2 from 'react'; + +// @internal +export const applyTriggerPropsToChildren: (children: React_2.ReactElement> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null; + +// @public +export type FluentTriggerComponent = { + isFluentTriggerComponent?: boolean; +}; + +// @internal +export const getTriggerChild:

(children: React_2.ReactNode) => React_2.ReactElement> & { + ref?: React_2.Ref | undefined; +}; + +// @public +export const isFluentTrigger: (element: React_2.ReactElement) => boolean | undefined; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/react-components/react-trigger/package.json b/packages/react-components/react-trigger/package.json index 509836205e8d39..37c1db4624bcbc 100644 --- a/packages/react-components/react-trigger/package.json +++ b/packages/react-components/react-trigger/package.json @@ -1,7 +1,6 @@ { "name": "@fluentui/react-trigger", "version": "9.0.0-alpha.0", - "private": true, "description": "A set of trigger specific utilities", "main": "lib-commonjs/index.js", "module": "lib/index.js", diff --git a/packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.test.tsx b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.test.tsx similarity index 100% rename from packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.test.tsx rename to packages/react-components/react-trigger/src/applyTriggerPropsToChildren.test.tsx diff --git a/packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.ts b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts similarity index 100% rename from packages/react-components/react-utilities/src/trigger/applyTriggerPropsToChildren.ts rename to packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts diff --git a/packages/react-components/react-utilities/src/trigger/getTriggerChild.test.tsx b/packages/react-components/react-trigger/src/getTriggerChild.test.tsx similarity index 100% rename from packages/react-components/react-utilities/src/trigger/getTriggerChild.test.tsx rename to packages/react-components/react-trigger/src/getTriggerChild.test.tsx diff --git a/packages/react-components/react-utilities/src/trigger/getTriggerChild.ts b/packages/react-components/react-trigger/src/getTriggerChild.ts similarity index 100% rename from packages/react-components/react-utilities/src/trigger/getTriggerChild.ts rename to packages/react-components/react-trigger/src/getTriggerChild.ts diff --git a/packages/react-components/react-trigger/src/index.ts b/packages/react-components/react-trigger/src/index.ts index aacbad0068e241..616afb295d025b 100644 --- a/packages/react-components/react-trigger/src/index.ts +++ b/packages/react-components/react-trigger/src/index.ts @@ -1,2 +1,4 @@ -// TODO: replace with real exports -export {}; +export { applyTriggerPropsToChildren } from './applyTriggerPropsToChildren'; +export { getTriggerChild } from './getTriggerChild'; +export { isFluentTrigger } from './isFluentTrigger'; +export type { FluentTriggerComponent } from './types'; diff --git a/packages/react-components/react-utilities/src/trigger/isFluentTrigger.ts b/packages/react-components/react-trigger/src/isFluentTrigger.ts similarity index 100% rename from packages/react-components/react-utilities/src/trigger/isFluentTrigger.ts rename to packages/react-components/react-trigger/src/isFluentTrigger.ts diff --git a/packages/react-components/react-utilities/src/trigger/types.ts b/packages/react-components/react-trigger/src/types.ts similarity index 97% rename from packages/react-components/react-utilities/src/trigger/types.ts rename to packages/react-components/react-trigger/src/types.ts index 734644e788379d..0b2754de88332b 100644 --- a/packages/react-components/react-utilities/src/trigger/types.ts +++ b/packages/react-components/react-trigger/src/types.ts @@ -1,5 +1,4 @@ /** - * @internal * Allows a component to be tagged as a FluentUI trigger component. * * Triggers are special-case components: they attach event listeners and other props on their child, diff --git a/packages/react-components/react-utilities/etc/react-utilities.api.md b/packages/react-components/react-utilities/etc/react-utilities.api.md index 1564c6be1abc60..c2110303d44d98 100644 --- a/packages/react-components/react-utilities/etc/react-utilities.api.md +++ b/packages/react-components/react-utilities/etc/react-utilities.api.md @@ -7,9 +7,6 @@ import { DispatchWithoutAction } from 'react'; import * as React_2 from 'react'; -// @internal -export const applyTriggerPropsToChildren: (children: React_2.ReactElement> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null; - // @public export function canUseDOM(): boolean; @@ -31,11 +28,6 @@ export type ComponentState = { // @public export type ExtractSlotProps = Exclude; -// @internal -export type FluentTriggerComponent = { - isFluentTriggerComponent?: boolean; -}; - // @public export type ForwardRefComponent = ObscureEventName extends keyof Props ? Required[ObscureEventName] extends React_2.PointerEventHandler ? React_2.ForwardRefExoticComponent> : never : never; @@ -64,11 +56,6 @@ export function getSlots(state: ComponentState): { slotProps: ObjectSlotProps; }; -// @internal -export const getTriggerChild:

(children: React_2.ReactNode) => React_2.ReactElement> & { - ref?: React_2.Ref | undefined; -}; - // @public export function isResolvedShorthand>(shorthand?: Shorthand): shorthand is ExtractSlotProps; diff --git a/packages/react-components/react-utilities/src/index.ts b/packages/react-components/react-utilities/src/index.ts index 1dc2058a6e6f84..1476ecf3cec63a 100644 --- a/packages/react-components/react-utilities/src/index.ts +++ b/packages/react-components/react-utilities/src/index.ts @@ -40,7 +40,3 @@ export { mergeCallbacks, shouldPreventDefaultOnKeyDown, } from './utils/index'; - -export { applyTriggerPropsToChildren, getTriggerChild } from './trigger/index'; - -export type { FluentTriggerComponent } from './trigger/index'; diff --git a/packages/react-components/react-utilities/src/trigger/index.ts b/packages/react-components/react-utilities/src/trigger/index.ts deleted file mode 100644 index ba6d1b40fe3046..00000000000000 --- a/packages/react-components/react-utilities/src/trigger/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './applyTriggerPropsToChildren'; -export * from './getTriggerChild'; -export * from './isFluentTrigger'; -export * from './types'; From 7289bb90606b0794bac59efeb53985b28f3f11a3 Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Fri, 23 Sep 2022 11:29:02 +0000 Subject: [PATCH 2/5] chore: updates dependencies from react-utilities to react-trigger --- ...eact-dialog-722963da-2d75-4320-af16-29ccbf9aec83.json | 7 +++++++ ...-react-menu-1b214075-8b38-435a-82e9-906e6d1910a0.json | 7 +++++++ ...ct-overflow-a9aab4af-7393-459d-a52a-5158bb8c1f7e.json | 7 +++++++ ...act-popover-3ea22487-b825-4fef-a0db-39ff5dc2ce36.json | 7 +++++++ ...act-tooltip-74189f64-3cbd-4d6b-8d83-0f693116db8d.json | 7 +++++++ .../react-dialog/etc/react-dialog.api.md | 2 +- packages/react-components/react-dialog/package.json | 1 + .../src/components/DialogTrigger/DialogTrigger.tsx | 2 +- .../src/components/DialogTrigger/useDialogTrigger.ts | 3 ++- .../react-components/react-menu/etc/react-menu.api.md | 2 +- packages/react-components/react-menu/package.json | 1 + .../src/components/MenuTrigger/MenuTrigger.tsx | 2 +- .../src/components/MenuTrigger/useMenuTrigger.ts | 9 ++------- packages/react-components/react-overflow/package.json | 1 + .../react-overflow/src/components/Overflow.tsx | 3 ++- .../src/components/OverflowItem/OverflowItem.tsx | 3 ++- .../react-popover/etc/react-popover.api.md | 2 +- packages/react-components/react-popover/package.json | 1 + .../src/components/PopoverTrigger/PopoverTrigger.tsx | 2 +- .../src/components/PopoverTrigger/usePopoverTrigger.ts | 9 ++------- .../react-tooltip/etc/react-tooltip.api.md | 2 +- packages/react-components/react-tooltip/package.json | 1 + .../react-tooltip/src/components/Tooltip/Tooltip.tsx | 2 +- .../react-tooltip/src/components/Tooltip/useTooltip.tsx | 3 +-- .../react-trigger/src/applyTriggerPropsToChildren.ts | 1 - .../react-trigger/src/getTriggerChild.ts | 1 - 26 files changed, 59 insertions(+), 29 deletions(-) create mode 100644 change/@fluentui-react-dialog-722963da-2d75-4320-af16-29ccbf9aec83.json create mode 100644 change/@fluentui-react-menu-1b214075-8b38-435a-82e9-906e6d1910a0.json create mode 100644 change/@fluentui-react-overflow-a9aab4af-7393-459d-a52a-5158bb8c1f7e.json create mode 100644 change/@fluentui-react-popover-3ea22487-b825-4fef-a0db-39ff5dc2ce36.json create mode 100644 change/@fluentui-react-tooltip-74189f64-3cbd-4d6b-8d83-0f693116db8d.json diff --git a/change/@fluentui-react-dialog-722963da-2d75-4320-af16-29ccbf9aec83.json b/change/@fluentui-react-dialog-722963da-2d75-4320-af16-29ccbf9aec83.json new file mode 100644 index 00000000000000..7a66a412536824 --- /dev/null +++ b/change/@fluentui-react-dialog-722963da-2d75-4320-af16-29ccbf9aec83.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: updates dependencies from react-utilities to react-trigger", + "packageName": "@fluentui/react-dialog", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-menu-1b214075-8b38-435a-82e9-906e6d1910a0.json b/change/@fluentui-react-menu-1b214075-8b38-435a-82e9-906e6d1910a0.json new file mode 100644 index 00000000000000..53907c6c12ec34 --- /dev/null +++ b/change/@fluentui-react-menu-1b214075-8b38-435a-82e9-906e6d1910a0.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: updates dependencies from react-utilities to react-trigger", + "packageName": "@fluentui/react-menu", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-overflow-a9aab4af-7393-459d-a52a-5158bb8c1f7e.json b/change/@fluentui-react-overflow-a9aab4af-7393-459d-a52a-5158bb8c1f7e.json new file mode 100644 index 00000000000000..a49a9f9e5fc88a --- /dev/null +++ b/change/@fluentui-react-overflow-a9aab4af-7393-459d-a52a-5158bb8c1f7e.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: updates dependencies from react-utilities to react-trigger", + "packageName": "@fluentui/react-overflow", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-popover-3ea22487-b825-4fef-a0db-39ff5dc2ce36.json b/change/@fluentui-react-popover-3ea22487-b825-4fef-a0db-39ff5dc2ce36.json new file mode 100644 index 00000000000000..0e35d6166d11f4 --- /dev/null +++ b/change/@fluentui-react-popover-3ea22487-b825-4fef-a0db-39ff5dc2ce36.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: updates dependencies from react-utilities to react-trigger", + "packageName": "@fluentui/react-popover", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/change/@fluentui-react-tooltip-74189f64-3cbd-4d6b-8d83-0f693116db8d.json b/change/@fluentui-react-tooltip-74189f64-3cbd-4d6b-8d83-0f693116db8d.json new file mode 100644 index 00000000000000..4a27d605434dbd --- /dev/null +++ b/change/@fluentui-react-tooltip-74189f64-3cbd-4d6b-8d83-0f693116db8d.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: updates dependencies from react-utilities to react-trigger", + "packageName": "@fluentui/react-tooltip", + "email": "bernardo.sunderhus@gmail.com", + "dependentChangeType": "none" +} diff --git a/packages/react-components/react-dialog/etc/react-dialog.api.md b/packages/react-components/react-dialog/etc/react-dialog.api.md index 23305f289c0e59..11f37828d1d774 100644 --- a/packages/react-components/react-dialog/etc/react-dialog.api.md +++ b/packages/react-components/react-dialog/etc/react-dialog.api.md @@ -10,7 +10,7 @@ import { ARIAButtonResultProps } from '@fluentui/react-aria'; import { ARIAButtonType } from '@fluentui/react-aria'; import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; import { JSXElementConstructor } from 'react'; import * as React_2 from 'react'; diff --git a/packages/react-components/react-dialog/package.json b/packages/react-components/react-dialog/package.json index f002dcf896c5ba..a8641a24753c62 100644 --- a/packages/react-components/react-dialog/package.json +++ b/packages/react-components/react-dialog/package.json @@ -35,6 +35,7 @@ "dependencies": { "@griffel/react": "^1.3.0", "@fluentui/react-utilities": "^9.1.0", + "@fluentui/react-trigger": "^9.0.0-alpha.0", "@fluentui/keyboard-keys": "^9.0.0", "@fluentui/react-context-selector": "^9.0.3", "@fluentui/react-shared-contexts": "^9.0.1", diff --git a/packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.tsx b/packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.tsx index 84b2a6b4863395..8c14eb264baeae 100644 --- a/packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.tsx +++ b/packages/react-components/react-dialog/src/components/DialogTrigger/DialogTrigger.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useDialogTrigger_unstable } from './useDialogTrigger'; import { renderDialogTrigger_unstable } from './renderDialogTrigger'; import type { DialogTriggerProps } from './DialogTrigger.types'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; /** * A non-visual component that wraps its child diff --git a/packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts b/packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts index f4a2927678b70c..e0bb54b467aca6 100644 --- a/packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts +++ b/packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts @@ -1,6 +1,7 @@ import * as React from 'react'; import { useModalAttributes } from '@fluentui/react-tabster'; -import { applyTriggerPropsToChildren, getTriggerChild, useEventCallback } from '@fluentui/react-utilities'; +import { useEventCallback } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-trigger'; import { DialogTriggerChildProps, DialogTriggerProps, DialogTriggerState } from './DialogTrigger.types'; import { useDialogContext_unstable, useDialogSurfaceContext_unstable } from '../../contexts'; import { useARIAButtonProps } from '@fluentui/react-aria'; diff --git a/packages/react-components/react-menu/etc/react-menu.api.md b/packages/react-components/react-menu/etc/react-menu.api.md index a52f4defae9d09..dde4ef5a33a1a5 100644 --- a/packages/react-components/react-menu/etc/react-menu.api.md +++ b/packages/react-components/react-menu/etc/react-menu.api.md @@ -13,7 +13,7 @@ import { ARIAButtonType } from '@fluentui/react-aria'; import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; import type { ContextSelector } from '@fluentui/react-context-selector'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; import type { PositioningShorthand } from '@fluentui/react-positioning'; import * as React_2 from 'react'; diff --git a/packages/react-components/react-menu/package.json b/packages/react-components/react-menu/package.json index 129067e4709c6e..610596637a3a5f 100644 --- a/packages/react-components/react-menu/package.json +++ b/packages/react-components/react-menu/package.json @@ -43,6 +43,7 @@ "@fluentui/react-tabster": "^9.1.1", "@fluentui/react-theme": "^9.1.0", "@fluentui/react-utilities": "^9.1.0", + "@fluentui/react-trigger": "^9.0.0-alpha.0", "@griffel/react": "^1.3.0", "tslib": "^2.1.0" }, diff --git a/packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.tsx b/packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.tsx index f25c8c579ef50f..6e2639d2da2c72 100644 --- a/packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.tsx +++ b/packages/react-components/react-menu/src/components/MenuTrigger/MenuTrigger.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { useMenuTrigger_unstable } from './useMenuTrigger'; import { renderMenuTrigger_unstable } from './renderMenuTrigger'; import type { MenuTriggerProps } from './MenuTrigger.types'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; /** * Wraps a trigger element as an only child diff --git a/packages/react-components/react-menu/src/components/MenuTrigger/useMenuTrigger.ts b/packages/react-components/react-menu/src/components/MenuTrigger/useMenuTrigger.ts index dede1aecbf2fa9..79d3417688c841 100644 --- a/packages/react-components/react-menu/src/components/MenuTrigger/useMenuTrigger.ts +++ b/packages/react-components/react-menu/src/components/MenuTrigger/useMenuTrigger.ts @@ -5,13 +5,8 @@ import { useIsSubmenu } from '../../utils/useIsSubmenu'; import { useFocusFinders } from '@fluentui/react-tabster'; import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts'; import { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys'; -import { - applyTriggerPropsToChildren, - getTriggerChild, - mergeCallbacks, - useEventCallback, - useMergedRefs, -} from '@fluentui/react-utilities'; +import { mergeCallbacks, useEventCallback, useMergedRefs } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-trigger'; import { useARIAButtonProps } from '@fluentui/react-aria'; /** diff --git a/packages/react-components/react-overflow/package.json b/packages/react-components/react-overflow/package.json index 6a123f622ac13c..e11531d087189f 100644 --- a/packages/react-components/react-overflow/package.json +++ b/packages/react-components/react-overflow/package.json @@ -33,6 +33,7 @@ "@fluentui/react-context-selector": "^9.0.3", "@fluentui/react-theme": "^9.1.0", "@fluentui/react-utilities": "^9.1.0", + "@fluentui/react-trigger": "^9.0.0-alpha.0", "@griffel/react": "^1.3.0", "tslib": "^2.1.0" }, diff --git a/packages/react-components/react-overflow/src/components/Overflow.tsx b/packages/react-components/react-overflow/src/components/Overflow.tsx index 2afd461950d926..79bb2d555e5406 100644 --- a/packages/react-components/react-overflow/src/components/Overflow.tsx +++ b/packages/react-components/react-overflow/src/components/Overflow.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; import { makeStyles, mergeClasses } from '@griffel/react'; import type { OnUpdateOverflow, OverflowGroupState, ObserveOptions } from '@fluentui/priority-overflow'; -import { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities'; +import { useMergedRefs } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren } from '@fluentui/react-trigger'; import { OverflowContext } from '../overflowContext'; import { updateVisibilityAttribute, useOverflowContainer } from '../useOverflowContainer'; diff --git a/packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx b/packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx index 77d4389e8f1c5b..4b3470952137ea 100644 --- a/packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx +++ b/packages/react-components/react-overflow/src/components/OverflowItem/OverflowItem.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; -import { applyTriggerPropsToChildren, useMergedRefs } from '@fluentui/react-utilities'; +import { useMergedRefs } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren } from '@fluentui/react-trigger'; import { useOverflowItem } from '../../useOverflowItem'; import { OverflowItemProps } from './OverflowItem.types'; diff --git a/packages/react-components/react-popover/etc/react-popover.api.md b/packages/react-components/react-popover/etc/react-popover.api.md index bc36a0d5a1f4ad..6b711aa307ab56 100644 --- a/packages/react-components/react-popover/etc/react-popover.api.md +++ b/packages/react-components/react-popover/etc/react-popover.api.md @@ -10,7 +10,7 @@ import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; import type { ContextSelector } from '@fluentui/react-context-selector'; import { FC } from 'react'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; import type { ForwardRefComponent } from '@fluentui/react-utilities'; import { JSXElementConstructor } from 'react'; import type { PortalProps } from '@fluentui/react-portal'; diff --git a/packages/react-components/react-popover/package.json b/packages/react-components/react-popover/package.json index 8db402cec9ac59..d7240364ef5ee8 100644 --- a/packages/react-components/react-popover/package.json +++ b/packages/react-components/react-popover/package.json @@ -42,6 +42,7 @@ "@fluentui/react-tabster": "^9.1.1", "@fluentui/react-theme": "^9.1.0", "@fluentui/react-utilities": "^9.1.0", + "@fluentui/react-trigger": "^9.0.0-alpha.0", "@griffel/react": "^1.3.0", "tslib": "^2.1.0" }, diff --git a/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx b/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx index 4963f7c7540e3a..884baa411cbf49 100644 --- a/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx +++ b/packages/react-components/react-popover/src/components/PopoverTrigger/PopoverTrigger.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { usePopoverTrigger_unstable } from './usePopoverTrigger'; import { renderPopoverTrigger_unstable } from './renderPopoverTrigger'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; import type { PopoverTriggerProps } from './PopoverTrigger.types'; /** diff --git a/packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts b/packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts index 4bc59f163bbddc..a6e7b062661d82 100644 --- a/packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts +++ b/packages/react-components/react-popover/src/components/PopoverTrigger/usePopoverTrigger.ts @@ -1,11 +1,6 @@ import * as React from 'react'; -import { - applyTriggerPropsToChildren, - getTriggerChild, - mergeCallbacks, - useMergedRefs, - useEventCallback, -} from '@fluentui/react-utilities'; +import { mergeCallbacks, useMergedRefs, useEventCallback } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-trigger'; import { useModalAttributes } from '@fluentui/react-tabster'; import { usePopoverContext_unstable } from '../../popoverContext'; import type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types'; diff --git a/packages/react-components/react-tooltip/etc/react-tooltip.api.md b/packages/react-components/react-tooltip/etc/react-tooltip.api.md index 63c725a8e9a0a5..14f62647d895e4 100644 --- a/packages/react-components/react-tooltip/etc/react-tooltip.api.md +++ b/packages/react-components/react-tooltip/etc/react-tooltip.api.md @@ -6,7 +6,7 @@ import type { ComponentProps } from '@fluentui/react-utilities'; import type { ComponentState } from '@fluentui/react-utilities'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; import type { PortalProps } from '@fluentui/react-portal'; import type { PositioningShorthand } from '@fluentui/react-positioning'; import * as React_2 from 'react'; diff --git a/packages/react-components/react-tooltip/package.json b/packages/react-components/react-tooltip/package.json index 50638a6c7cdebc..004d28532ee0c7 100644 --- a/packages/react-components/react-tooltip/package.json +++ b/packages/react-components/react-tooltip/package.json @@ -37,6 +37,7 @@ "@fluentui/react-shared-contexts": "^9.0.1", "@fluentui/react-theme": "^9.1.0", "@fluentui/react-utilities": "^9.1.0", + "@fluentui/react-trigger": "^9.0.0-alpha.0", "@griffel/react": "^1.3.0", "tslib": "^2.1.0" }, diff --git a/packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.tsx b/packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.tsx index d7e4925233bd61..fcf3a91310cab2 100644 --- a/packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.tsx +++ b/packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.tsx @@ -3,7 +3,7 @@ import { useTooltip_unstable } from './useTooltip'; import { renderTooltip_unstable } from './renderTooltip'; import { useTooltipStyles_unstable } from './useTooltipStyles'; import type { TooltipProps } from './Tooltip.types'; -import type { FluentTriggerComponent } from '@fluentui/react-utilities'; +import type { FluentTriggerComponent } from '@fluentui/react-trigger'; /** * A tooltip provides light weight contextual information on top of its target element. diff --git a/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx b/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx index 9c6246c926e7b1..5690138340f8dd 100644 --- a/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx +++ b/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx @@ -5,7 +5,6 @@ import { useFluent_unstable as useFluent, } from '@fluentui/react-shared-contexts'; import { - applyTriggerPropsToChildren, resolveShorthand, useControllableState, useId, @@ -13,10 +12,10 @@ import { useIsSSR, useMergedRefs, useTimeout, - getTriggerChild, mergeCallbacks, useEventCallback, } from '@fluentui/react-utilities'; +import { applyTriggerPropsToChildren, getTriggerChild } from '@fluentui/react-trigger'; import type { TooltipProps, TooltipState, TooltipTriggerProps } from './Tooltip.types'; import { arrowHeight, tooltipBorderRadius } from './private/constants'; import { Escape } from '@fluentui/keyboard-keys'; diff --git a/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts index 977860994be084..cb63665cba84cb 100644 --- a/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts +++ b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts @@ -2,7 +2,6 @@ import * as React from 'react'; import { isFluentTrigger } from './isFluentTrigger'; /** - * @internal * Apply the trigger props to the children, either by calling the render function, or cloning with the new props. */ export const applyTriggerPropsToChildren = ( diff --git a/packages/react-components/react-trigger/src/getTriggerChild.ts b/packages/react-components/react-trigger/src/getTriggerChild.ts index 0778ad4f7ab998..3d0dbe78cb5ce1 100644 --- a/packages/react-components/react-trigger/src/getTriggerChild.ts +++ b/packages/react-components/react-trigger/src/getTriggerChild.ts @@ -2,7 +2,6 @@ import * as React from 'react'; import { isFluentTrigger } from './isFluentTrigger'; /** - * @internal * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger). * * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment, From 294f85697969ecdf2e337bb4f3803b7b839f98f8 Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Fri, 23 Sep 2022 11:39:25 +0000 Subject: [PATCH 3/5] chore: Updates API --- .../react-components/react-trigger/etc/react-trigger.api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-trigger/etc/react-trigger.api.md b/packages/react-components/react-trigger/etc/react-trigger.api.md index 22b2bae1ee74af..9b98b1e5749d02 100644 --- a/packages/react-components/react-trigger/etc/react-trigger.api.md +++ b/packages/react-components/react-trigger/etc/react-trigger.api.md @@ -6,7 +6,7 @@ import * as React_2 from 'react'; -// @internal +// @public export const applyTriggerPropsToChildren: (children: React_2.ReactElement> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null; // @public @@ -14,7 +14,7 @@ export type FluentTriggerComponent = { isFluentTriggerComponent?: boolean; }; -// @internal +// @public export const getTriggerChild:

(children: React_2.ReactNode) => React_2.ReactElement> & { ref?: React_2.Ref | undefined; }; From f2c698655d6d6d86835a8392032a778e35a38059 Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Fri, 23 Sep 2022 12:05:36 +0000 Subject: [PATCH 4/5] chore(react-trigger): mark methods as @internal --- .../react-components/react-trigger/etc/react-trigger.api.md | 4 ++-- .../react-trigger/src/applyTriggerPropsToChildren.ts | 1 + .../react-components/react-trigger/src/getTriggerChild.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-trigger/etc/react-trigger.api.md b/packages/react-components/react-trigger/etc/react-trigger.api.md index 9b98b1e5749d02..22b2bae1ee74af 100644 --- a/packages/react-components/react-trigger/etc/react-trigger.api.md +++ b/packages/react-components/react-trigger/etc/react-trigger.api.md @@ -6,7 +6,7 @@ import * as React_2 from 'react'; -// @public +// @internal export const applyTriggerPropsToChildren: (children: React_2.ReactElement> | ((props: TTriggerProps) => React_2.ReactElement | null) | null | undefined, triggerProps: TTriggerProps) => React_2.ReactElement | null; // @public @@ -14,7 +14,7 @@ export type FluentTriggerComponent = { isFluentTriggerComponent?: boolean; }; -// @public +// @internal export const getTriggerChild:

(children: React_2.ReactNode) => React_2.ReactElement> & { ref?: React_2.Ref | undefined; }; diff --git a/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts index cb63665cba84cb..977860994be084 100644 --- a/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts +++ b/packages/react-components/react-trigger/src/applyTriggerPropsToChildren.ts @@ -2,6 +2,7 @@ import * as React from 'react'; import { isFluentTrigger } from './isFluentTrigger'; /** + * @internal * Apply the trigger props to the children, either by calling the render function, or cloning with the new props. */ export const applyTriggerPropsToChildren = ( diff --git a/packages/react-components/react-trigger/src/getTriggerChild.ts b/packages/react-components/react-trigger/src/getTriggerChild.ts index 3d0dbe78cb5ce1..0778ad4f7ab998 100644 --- a/packages/react-components/react-trigger/src/getTriggerChild.ts +++ b/packages/react-components/react-trigger/src/getTriggerChild.ts @@ -2,6 +2,7 @@ import * as React from 'react'; import { isFluentTrigger } from './isFluentTrigger'; /** + * @internal * Gets the trigger element of a FluentTriggerComponent (such as Tooltip or MenuTrigger). * * In the case where the immediate child is itself a FluentTriggerComponent and/or React Fragment, From 60ee2238dbab4ae8041b73470b28255b56b6c722 Mon Sep 17 00:00:00 2001 From: Bernardo Sunderhus Date: Tue, 27 Sep 2022 07:29:28 +0000 Subject: [PATCH 5/5] chore: updates changefile to make a patch --- ...tui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json | 2 +- packages/react-components/react-trigger/package.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json b/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json index e3110278cba25d..d772a9d68bdd29 100644 --- a/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json +++ b/change/@fluentui-react-trigger-878d2c89-74e6-475d-bd81-c43652fb8f57.json @@ -1,5 +1,5 @@ { - "type": "prerelease", + "type": "patch", "comment": "feat: move trigger methods from react-utilities", "packageName": "@fluentui/react-trigger", "email": "bernardo.sunderhus@gmail.com", diff --git a/packages/react-components/react-trigger/package.json b/packages/react-components/react-trigger/package.json index 37c1db4624bcbc..328646c90cc2eb 100644 --- a/packages/react-components/react-trigger/package.json +++ b/packages/react-components/react-trigger/package.json @@ -42,8 +42,7 @@ "beachball": { "disallowedChangeTypes": [ "major", - "minor", - "patch" + "prerelease" ] } }