Skip to content

Commit 9815fa7

Browse files
mainframevCopilot
andcommitted
feat(react-tag-picker): export useTagPickerContextValues_unstable and TagPickerControlInternalSlots
Expose the context-values hook and the control's internal slots type so the headless TagPicker (and other consumers) can reuse them instead of duplicating the logic/type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6bc2c66 commit 9815fa7

7 files changed

Lines changed: 28 additions & 4 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "feat: export useTagPickerContextValues_unstable and TagPickerControlInternalSlots for headless composition",
4+
"packageName": "@fluentui/react-tag-picker",
5+
"email": "vgenaev@gmail.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/react-tag-picker/library/etc/react-tag-picker.api.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ export type TagPickerControlBaseState = DistributiveOmit<TagPickerControlState,
129129
// @public (undocumented)
130130
export const tagPickerControlClassNames: SlotClassNames<TagPickerControlSlots & TagPickerControlInternalSlots>;
131131

132+
// @public (undocumented)
133+
export type TagPickerControlInternalSlots = {
134+
aside?: NonNullable<Slot<'span'>>;
135+
};
136+
132137
// @public
133138
export type TagPickerControlProps = ComponentProps<Partial<TagPickerControlSlots>>;
134139

@@ -299,6 +304,9 @@ export const useTagPickerButtonStyles_unstable: (state: TagPickerButtonState) =>
299304
// @public (undocumented)
300305
export const useTagPickerContext_unstable: <T>(selector: ContextSelector<TagPickerContextValue, T>) => T;
301306

307+
// @public (undocumented)
308+
export function useTagPickerContextValues_unstable(state: TagPickerState): TagPickerContextValues;
309+
302310
// @public
303311
export const useTagPickerControl_unstable: (props: TagPickerControlProps, ref: React_2.Ref<HTMLDivElement>) => TagPickerControlState;
304312

packages/react-components/react-tag-picker/library/src/TagPicker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ export {
1313
renderTagPicker_unstable,
1414
useTagPicker_unstable,
1515
useTagPickerBase_unstable,
16+
useTagPickerContextValues_unstable,
1617
} from './components/TagPicker/index';

packages/react-components/react-tag-picker/library/src/components/TagPicker/TagPicker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import * as React from 'react';
44
import { useTagPicker_unstable } from './useTagPicker';
55
import { renderTagPicker_unstable } from './renderTagPicker';
66
import type { TagPickerProps } from './TagPicker.types';
7-
import { useTagPickerContextValues } from './useTagPickerContextValues';
7+
import { useTagPickerContextValues_unstable } from './useTagPickerContextValues';
88

99
/**
1010
* TagPicker component -
1111
* A TagPicker is a composite component that allows users to pick tags from a list of options.
1212
*/
1313
export const TagPicker: React.FC<TagPickerProps> = React.memo(props => {
1414
const state = useTagPicker_unstable(props);
15-
const contextValues = useTagPickerContextValues(state);
15+
const contextValues = useTagPickerContextValues_unstable(state);
1616
return renderTagPicker_unstable(state, contextValues);
1717
});
1818

packages/react-components/react-tag-picker/library/src/components/TagPicker/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ export type {
1111
} from './TagPicker.types';
1212
export { renderTagPicker_unstable } from './renderTagPicker';
1313
export { useTagPicker_unstable, useTagPickerBase_unstable } from './useTagPicker';
14+
export { useTagPickerContextValues_unstable } from './useTagPickerContextValues';

packages/react-components/react-tag-picker/library/src/components/TagPicker/useTagPickerContextValues.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import * as React from 'react';
44
import type { TagPickerContextValues, TagPickerState } from './TagPicker.types';
55

6-
export function useTagPickerContextValues(state: TagPickerState): TagPickerContextValues {
6+
export function useTagPickerContextValues_unstable(state: TagPickerState): TagPickerContextValues {
77
const {
88
onOptionClick,
99
registerOption,

packages/react-components/react-tag-picker/library/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
export { TagPicker, renderTagPicker_unstable, useTagPicker_unstable, useTagPickerBase_unstable } from './TagPicker';
1+
export {
2+
TagPicker,
3+
renderTagPicker_unstable,
4+
useTagPicker_unstable,
5+
useTagPickerBase_unstable,
6+
useTagPickerContextValues_unstable,
7+
} from './TagPicker';
28
export type {
39
TagPickerBaseProps,
410
TagPickerContextValues,
@@ -57,6 +63,7 @@ export {
5763
} from './TagPickerControl';
5864
export type {
5965
TagPickerControlBaseState,
66+
TagPickerControlInternalSlots,
6067
TagPickerControlProps,
6168
TagPickerControlSlots,
6269
TagPickerControlState,

0 commit comments

Comments
 (0)