@fluentui/react-tags 0.0.0-nightly-20231004-0414.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +958 -0
- package/CHANGELOG.md +302 -0
- package/LICENSE +15 -0
- package/README.md +72 -0
- package/dist/index.d.ts +405 -0
- package/lib/InteractionTag.js +1 -0
- package/lib/InteractionTag.js.map +1 -0
- package/lib/InteractionTagPrimary.js +1 -0
- package/lib/InteractionTagPrimary.js.map +1 -0
- package/lib/InteractionTagSecondary.js +1 -0
- package/lib/InteractionTagSecondary.js.map +1 -0
- package/lib/Tag.js +1 -0
- package/lib/Tag.js.map +1 -0
- package/lib/TagGroup.js +1 -0
- package/lib/TagGroup.js.map +1 -0
- package/lib/components/InteractionTag/InteractionTag.js +16 -0
- package/lib/components/InteractionTag/InteractionTag.js.map +1 -0
- package/lib/components/InteractionTag/InteractionTag.types.js +1 -0
- package/lib/components/InteractionTag/InteractionTag.types.js.map +1 -0
- package/lib/components/InteractionTag/index.js +6 -0
- package/lib/components/InteractionTag/index.js.map +1 -0
- package/lib/components/InteractionTag/renderInteractionTag.js +12 -0
- package/lib/components/InteractionTag/renderInteractionTag.js.map +1 -0
- package/lib/components/InteractionTag/useInteractionTag.js +36 -0
- package/lib/components/InteractionTag/useInteractionTag.js.map +1 -0
- package/lib/components/InteractionTag/useInteractionTagContextValues.js +23 -0
- package/lib/components/InteractionTag/useInteractionTagContextValues.js.map +1 -0
- package/lib/components/InteractionTag/useInteractionTagStyles.styles.js +45 -0
- package/lib/components/InteractionTag/useInteractionTagStyles.styles.js.map +1 -0
- package/lib/components/InteractionTagPrimary/InteractionTagPrimary.js +16 -0
- package/lib/components/InteractionTagPrimary/InteractionTagPrimary.js.map +1 -0
- package/lib/components/InteractionTagPrimary/InteractionTagPrimary.types.js +1 -0
- package/lib/components/InteractionTagPrimary/InteractionTagPrimary.types.js.map +1 -0
- package/lib/components/InteractionTagPrimary/index.js +5 -0
- package/lib/components/InteractionTagPrimary/index.js.map +1 -0
- package/lib/components/InteractionTagPrimary/renderInteractionTagPrimary.js +19 -0
- package/lib/components/InteractionTagPrimary/renderInteractionTagPrimary.js.map +1 -0
- package/lib/components/InteractionTagPrimary/useInteractionTagPrimary.js +64 -0
- package/lib/components/InteractionTagPrimary/useInteractionTagPrimary.js.map +1 -0
- package/lib/components/InteractionTagPrimary/useInteractionTagPrimaryStyles.styles.js +232 -0
- package/lib/components/InteractionTagPrimary/useInteractionTagPrimaryStyles.styles.js.map +1 -0
- package/lib/components/InteractionTagSecondary/InteractionTagSecondary.js +14 -0
- package/lib/components/InteractionTagSecondary/InteractionTagSecondary.js.map +1 -0
- package/lib/components/InteractionTagSecondary/InteractionTagSecondary.types.js +1 -0
- package/lib/components/InteractionTagSecondary/InteractionTagSecondary.types.js.map +1 -0
- package/lib/components/InteractionTagSecondary/index.js +5 -0
- package/lib/components/InteractionTagSecondary/index.js.map +1 -0
- package/lib/components/InteractionTagSecondary/renderInteractionTagSecondary.js +8 -0
- package/lib/components/InteractionTagSecondary/renderInteractionTagSecondary.js.map +1 -0
- package/lib/components/InteractionTagSecondary/useInteractionTagSecondary.js +57 -0
- package/lib/components/InteractionTagSecondary/useInteractionTagSecondary.js.map +1 -0
- package/lib/components/InteractionTagSecondary/useInteractionTagSecondaryStyles.styles.js +126 -0
- package/lib/components/InteractionTagSecondary/useInteractionTagSecondaryStyles.styles.js.map +1 -0
- package/lib/components/Tag/Tag.js +16 -0
- package/lib/components/Tag/Tag.js.map +1 -0
- package/lib/components/Tag/Tag.types.js +1 -0
- package/lib/components/Tag/Tag.types.js.map +1 -0
- package/lib/components/Tag/index.js +5 -0
- package/lib/components/Tag/index.js.map +1 -0
- package/lib/components/Tag/renderTag.js +20 -0
- package/lib/components/Tag/renderTag.js.map +1 -0
- package/lib/components/Tag/useTag.js +98 -0
- package/lib/components/Tag/useTag.js.map +1 -0
- package/lib/components/Tag/useTagStyles.styles.js +320 -0
- package/lib/components/Tag/useTagStyles.styles.js.map +1 -0
- package/lib/components/TagGroup/TagGroup.js +16 -0
- package/lib/components/TagGroup/TagGroup.js.map +1 -0
- package/lib/components/TagGroup/TagGroup.types.js +1 -0
- package/lib/components/TagGroup/TagGroup.types.js.map +1 -0
- package/lib/components/TagGroup/index.js +6 -0
- package/lib/components/TagGroup/index.js.map +1 -0
- package/lib/components/TagGroup/renderTagGroup.js +12 -0
- package/lib/components/TagGroup/renderTagGroup.js.map +1 -0
- package/lib/components/TagGroup/useTagGroup.js +67 -0
- package/lib/components/TagGroup/useTagGroup.js.map +1 -0
- package/lib/components/TagGroup/useTagGroupContextValues.js +13 -0
- package/lib/components/TagGroup/useTagGroupContextValues.js.map +1 -0
- package/lib/components/TagGroup/useTagGroupStyles.styles.js +36 -0
- package/lib/components/TagGroup/useTagGroupStyles.styles.js.map +1 -0
- package/lib/contexts/interactionTagContext.js +16 -0
- package/lib/contexts/interactionTagContext.js.map +1 -0
- package/lib/contexts/tagGroupContext.js +11 -0
- package/lib/contexts/tagGroupContext.js.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/types.js.map +1 -0
- package/lib/utils/useTagAvatarContextValues.js +14 -0
- package/lib/utils/useTagAvatarContextValues.js.map +1 -0
- package/lib-commonjs/InteractionTag.js +6 -0
- package/lib-commonjs/InteractionTag.js.map +1 -0
- package/lib-commonjs/InteractionTagPrimary.js +6 -0
- package/lib-commonjs/InteractionTagPrimary.js.map +1 -0
- package/lib-commonjs/InteractionTagSecondary.js +6 -0
- package/lib-commonjs/InteractionTagSecondary.js.map +1 -0
- package/lib-commonjs/Tag.js +6 -0
- package/lib-commonjs/Tag.js.map +1 -0
- package/lib-commonjs/TagGroup.js +6 -0
- package/lib-commonjs/TagGroup.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/InteractionTag.js +24 -0
- package/lib-commonjs/components/InteractionTag/InteractionTag.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/InteractionTag.types.js +4 -0
- package/lib-commonjs/components/InteractionTag/InteractionTag.types.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/index.js +11 -0
- package/lib-commonjs/components/InteractionTag/index.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/renderInteractionTag.js +20 -0
- package/lib-commonjs/components/InteractionTag/renderInteractionTag.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTag.js +39 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTag.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTagContextValues.js +34 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTagContextValues.js.map +1 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTagStyles.styles.js +93 -0
- package/lib-commonjs/components/InteractionTag/useInteractionTagStyles.styles.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/InteractionTagPrimary.js +24 -0
- package/lib-commonjs/components/InteractionTagPrimary/InteractionTagPrimary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/InteractionTagPrimary.types.js +4 -0
- package/lib-commonjs/components/InteractionTagPrimary/InteractionTagPrimary.types.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/index.js +10 -0
- package/lib-commonjs/components/InteractionTagPrimary/index.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/renderInteractionTagPrimary.js +27 -0
- package/lib-commonjs/components/InteractionTagPrimary/renderInteractionTagPrimary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/useInteractionTagPrimary.js +67 -0
- package/lib-commonjs/components/InteractionTagPrimary/useInteractionTagPrimary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagPrimary/useInteractionTagPrimaryStyles.styles.js +431 -0
- package/lib-commonjs/components/InteractionTagPrimary/useInteractionTagPrimaryStyles.styles.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/InteractionTagSecondary.js +23 -0
- package/lib-commonjs/components/InteractionTagSecondary/InteractionTagSecondary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/InteractionTagSecondary.types.js +4 -0
- package/lib-commonjs/components/InteractionTagSecondary/InteractionTagSecondary.types.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/index.js +10 -0
- package/lib-commonjs/components/InteractionTagSecondary/index.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/renderInteractionTagSecondary.js +16 -0
- package/lib-commonjs/components/InteractionTagSecondary/renderInteractionTagSecondary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/useInteractionTagSecondary.js +60 -0
- package/lib-commonjs/components/InteractionTagSecondary/useInteractionTagSecondary.js.map +1 -0
- package/lib-commonjs/components/InteractionTagSecondary/useInteractionTagSecondaryStyles.styles.js +261 -0
- package/lib-commonjs/components/InteractionTagSecondary/useInteractionTagSecondaryStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Tag/Tag.js +24 -0
- package/lib-commonjs/components/Tag/Tag.js.map +1 -0
- package/lib-commonjs/components/Tag/Tag.types.js +4 -0
- package/lib-commonjs/components/Tag/Tag.types.js.map +1 -0
- package/lib-commonjs/components/Tag/index.js +10 -0
- package/lib-commonjs/components/Tag/index.js.map +1 -0
- package/lib-commonjs/components/Tag/renderTag.js +28 -0
- package/lib-commonjs/components/Tag/renderTag.js.map +1 -0
- package/lib-commonjs/components/Tag/useTag.js +101 -0
- package/lib-commonjs/components/Tag/useTag.js.map +1 -0
- package/lib-commonjs/components/Tag/useTagStyles.styles.js +569 -0
- package/lib-commonjs/components/Tag/useTagStyles.styles.js.map +1 -0
- package/lib-commonjs/components/TagGroup/TagGroup.js +24 -0
- package/lib-commonjs/components/TagGroup/TagGroup.js.map +1 -0
- package/lib-commonjs/components/TagGroup/TagGroup.types.js +4 -0
- package/lib-commonjs/components/TagGroup/TagGroup.types.js.map +1 -0
- package/lib-commonjs/components/TagGroup/index.js +11 -0
- package/lib-commonjs/components/TagGroup/index.js.map +1 -0
- package/lib-commonjs/components/TagGroup/renderTagGroup.js +20 -0
- package/lib-commonjs/components/TagGroup/renderTagGroup.js.map +1 -0
- package/lib-commonjs/components/TagGroup/useTagGroup.js +70 -0
- package/lib-commonjs/components/TagGroup/useTagGroup.js.map +1 -0
- package/lib-commonjs/components/TagGroup/useTagGroupContextValues.js +24 -0
- package/lib-commonjs/components/TagGroup/useTagGroupContextValues.js.map +1 -0
- package/lib-commonjs/components/TagGroup/useTagGroupStyles.styles.js +51 -0
- package/lib-commonjs/components/TagGroup/useTagGroupStyles.styles.js.map +1 -0
- package/lib-commonjs/contexts/interactionTagContext.js +38 -0
- package/lib-commonjs/contexts/interactionTagContext.js.map +1 -0
- package/lib-commonjs/contexts/tagGroupContext.js +33 -0
- package/lib-commonjs/contexts/tagGroupContext.js.map +1 -0
- package/lib-commonjs/index.js +102 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/utils/index.js +7 -0
- package/lib-commonjs/utils/index.js.map +1 -0
- package/lib-commonjs/utils/types.js +6 -0
- package/lib-commonjs/utils/types.js.map +1 -0
- package/lib-commonjs/utils/useTagAvatarContextValues.js +25 -0
- package/lib-commonjs/utils/useTagAvatarContextValues.js.map +1 -0
- package/package.json +67 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
import { AvatarShape } from '@fluentui/react-avatar';
|
|
4
|
+
import { AvatarSize } from '@fluentui/react-avatar';
|
|
5
|
+
import { ComponentProps } from '@fluentui/react-utilities';
|
|
6
|
+
import { ComponentState } from '@fluentui/react-utilities';
|
|
7
|
+
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
8
|
+
import * as React_2 from 'react';
|
|
9
|
+
import { Slot } from '@fluentui/react-utilities';
|
|
10
|
+
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* InteractionTag component - a visual representation of an attribute with primary and secondary actions.
|
|
14
|
+
* Can have `InteractionTagPrimary` and `InteractionTagSecondary` components as its children.
|
|
15
|
+
*/
|
|
16
|
+
export declare const InteractionTag: ForwardRefComponent<InteractionTagProps>;
|
|
17
|
+
|
|
18
|
+
export declare const interactionTagClassNames: SlotClassNames<InteractionTagSlots>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Context shared between InteractionTag and its children components
|
|
22
|
+
*/
|
|
23
|
+
declare type InteractionTagContextValue<Value = string> = Required<Pick<InteractionTagState, 'appearance' | 'disabled' | 'shape' | 'size'> & {
|
|
24
|
+
handleTagDismiss: TagDismissHandler<Value>;
|
|
25
|
+
interactionTagPrimaryId: string;
|
|
26
|
+
value?: Value;
|
|
27
|
+
}>;
|
|
28
|
+
|
|
29
|
+
declare type InteractionTagContextValues = {
|
|
30
|
+
interactionTag: InteractionTagContextValue;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* InteractionTagPrimary component - used as the first child of the `InteractionTag` component.
|
|
35
|
+
* Provides visual attributes such as media, icon, primary and secondary text, as well as the ability to attach a primary action.
|
|
36
|
+
*/
|
|
37
|
+
export declare const InteractionTagPrimary: ForwardRefComponent<InteractionTagPrimaryProps>;
|
|
38
|
+
|
|
39
|
+
export declare const interactionTagPrimaryClassNames: SlotClassNames<InteractionTagPrimarySlots>;
|
|
40
|
+
|
|
41
|
+
export declare type InteractionTagPrimaryContextValues = TagAvatarContextValues;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* InteractionTagPrimary Props
|
|
45
|
+
*/
|
|
46
|
+
export declare type InteractionTagPrimaryProps = ComponentProps<Partial<InteractionTagPrimarySlots>> & {
|
|
47
|
+
/**
|
|
48
|
+
* Whether the `InteractionTag` component has a `Secondary` component that provides an secondary action.
|
|
49
|
+
* If `true`, the `InteractionTagPrimary` component will adjust its styles to accommodate the `Secondary` component.
|
|
50
|
+
*
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
hasSecondaryAction?: boolean;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export declare type InteractionTagPrimarySlots = {
|
|
57
|
+
root: NonNullable<Slot<'button'>>;
|
|
58
|
+
/**
|
|
59
|
+
* Slot for a visual element, usually an avatar
|
|
60
|
+
*/
|
|
61
|
+
media?: Slot<'span'>;
|
|
62
|
+
/**
|
|
63
|
+
* Slot for an icon
|
|
64
|
+
*/
|
|
65
|
+
icon?: Slot<'span'>;
|
|
66
|
+
/**
|
|
67
|
+
* Main text for the InteractionTagPrimary button. Children of the root slot are automatically rendered here
|
|
68
|
+
*/
|
|
69
|
+
primaryText: Slot<'span'>;
|
|
70
|
+
/**
|
|
71
|
+
* Secondary text that describes or complements the main text
|
|
72
|
+
*/
|
|
73
|
+
secondaryText?: Slot<'span'>;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* State used in rendering InteractionTagPrimary
|
|
78
|
+
*/
|
|
79
|
+
export declare type InteractionTagPrimaryState = ComponentState<InteractionTagPrimarySlots> & Required<Pick<InteractionTagContextValue, 'appearance' | 'disabled' | 'shape' | 'size'> & Pick<InteractionTagPrimaryProps, 'hasSecondaryAction'>> & UseTagAvatarContextValuesOptions;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* InteractionTag Props
|
|
83
|
+
*/
|
|
84
|
+
export declare type InteractionTagProps<Value = TagValue> = ComponentProps<Partial<InteractionTagSlots>> & {
|
|
85
|
+
/**
|
|
86
|
+
* An InteractionTag can have filled, outlined or brand experience.
|
|
87
|
+
*
|
|
88
|
+
* @default 'filled'
|
|
89
|
+
*/
|
|
90
|
+
appearance?: TagAppearance;
|
|
91
|
+
/**
|
|
92
|
+
* An InteractionTag can show that it cannot be interacted with.
|
|
93
|
+
*
|
|
94
|
+
* @default false
|
|
95
|
+
*/
|
|
96
|
+
disabled?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* An InteractionTag can have rounded or circular shape.
|
|
99
|
+
*
|
|
100
|
+
* @default 'round'
|
|
101
|
+
*/
|
|
102
|
+
shape?: TagShape;
|
|
103
|
+
/**
|
|
104
|
+
* An InteractionTag has three sizes.
|
|
105
|
+
*
|
|
106
|
+
* @default 'medium'
|
|
107
|
+
*/
|
|
108
|
+
size?: TagSize;
|
|
109
|
+
/**
|
|
110
|
+
* Unique value identifying the tag within a TagGroup
|
|
111
|
+
*/
|
|
112
|
+
value?: Value;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* InteractionTagSecondary component - used as the second child of the `InteractionTag` component and provides the secondary action, which is dismiss by default.
|
|
117
|
+
*/
|
|
118
|
+
export declare const InteractionTagSecondary: ForwardRefComponent<InteractionTagSecondaryProps>;
|
|
119
|
+
|
|
120
|
+
export declare const interactionTagSecondaryClassNames: SlotClassNames<InteractionTagSecondarySlots>;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* InteractionTagSecondary Props
|
|
124
|
+
*/
|
|
125
|
+
export declare type InteractionTagSecondaryProps = ComponentProps<InteractionTagSecondarySlots>;
|
|
126
|
+
|
|
127
|
+
export declare type InteractionTagSecondarySlots = {
|
|
128
|
+
root: NonNullable<Slot<'button'>>;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* State used in rendering InteractionTagSecondary
|
|
133
|
+
*/
|
|
134
|
+
export declare type InteractionTagSecondaryState = ComponentState<InteractionTagSecondarySlots> & Required<Pick<InteractionTagContextValue, 'appearance' | 'disabled' | 'shape' | 'size'>>;
|
|
135
|
+
|
|
136
|
+
export declare type InteractionTagSlots = {
|
|
137
|
+
root: NonNullable<Slot<'div'>>;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* State used in rendering InteractionTag
|
|
142
|
+
*/
|
|
143
|
+
export declare type InteractionTagState<Value = TagValue> = ComponentState<InteractionTagSlots> & Required<Pick<InteractionTagProps, 'appearance' | 'disabled' | 'shape' | 'size' | 'value'>> & {
|
|
144
|
+
/**
|
|
145
|
+
* Event handler from TagGroup context that allows TagGroup to dismiss the tag
|
|
146
|
+
*/
|
|
147
|
+
handleTagDismiss: TagDismissHandler<Value>;
|
|
148
|
+
/**
|
|
149
|
+
* id to assign to InteractionTagPrimary
|
|
150
|
+
*/
|
|
151
|
+
interactionTagPrimaryId: string;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Render the final JSX of InteractionTag
|
|
156
|
+
*/
|
|
157
|
+
export declare const renderInteractionTag_unstable: (state: InteractionTagState, contextValues: InteractionTagContextValues) => JSX.Element;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Render the final JSX of InteractionTagPrimary
|
|
161
|
+
*/
|
|
162
|
+
export declare const renderInteractionTagPrimary_unstable: (state: InteractionTagPrimaryState, contextValues: InteractionTagPrimaryContextValues) => JSX.Element;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Render the final JSX of InteractionTagSecondary
|
|
166
|
+
*/
|
|
167
|
+
export declare const renderInteractionTagSecondary_unstable: (state: InteractionTagSecondaryState) => JSX.Element;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Render the final JSX of Tag
|
|
171
|
+
*/
|
|
172
|
+
export declare const renderTag_unstable: (state: TagState, contextValues: TagContextValues) => JSX.Element;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Render the final JSX of TagGroup
|
|
176
|
+
*/
|
|
177
|
+
export declare const renderTagGroup_unstable: (state: TagGroupState, contextValue: TagGroupContextValues) => JSX.Element;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Tag component - a visual representation of an attribute.
|
|
181
|
+
* Provides visual attributes such as media, icon, primary and secondary text, as well as the ability to attach an action (by default it is dismiss)
|
|
182
|
+
*/
|
|
183
|
+
export declare const Tag: ForwardRefComponent<TagProps>;
|
|
184
|
+
|
|
185
|
+
export declare type TagAppearance = 'filled' | 'outline' | 'brand';
|
|
186
|
+
|
|
187
|
+
declare type TagAvatarContextValues = {
|
|
188
|
+
avatar: {
|
|
189
|
+
size?: AvatarSize;
|
|
190
|
+
shape?: AvatarShape;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export declare const tagClassNames: SlotClassNames<TagSlots>;
|
|
195
|
+
|
|
196
|
+
declare type TagContextValues = TagAvatarContextValues;
|
|
197
|
+
|
|
198
|
+
export declare type TagDismissData<Value = TagValue> = {
|
|
199
|
+
value: Value;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export declare type TagDismissEvent = React_2.MouseEvent | React_2.KeyboardEvent;
|
|
203
|
+
|
|
204
|
+
export declare type TagDismissHandler<Value = TagValue> = (e: TagDismissEvent, data: TagDismissData<Value>) => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* TagGroup component - a container for multiple tags.
|
|
208
|
+
* Provides context to size or dismiss children tags.
|
|
209
|
+
*/
|
|
210
|
+
export declare const TagGroup: ForwardRefComponent<TagGroupProps>;
|
|
211
|
+
|
|
212
|
+
export declare const tagGroupClassNames: SlotClassNames<TagGroupSlots>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Context shared between TagGroup and its children components
|
|
216
|
+
*/
|
|
217
|
+
declare type TagGroupContextValue = Required<Pick<TagGroupState, 'handleTagDismiss' | 'size'>>;
|
|
218
|
+
|
|
219
|
+
declare type TagGroupContextValues = {
|
|
220
|
+
tagGroup: TagGroupContextValue;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* TagGroup Props
|
|
225
|
+
*/
|
|
226
|
+
export declare type TagGroupProps<Value = TagValue> = ComponentProps<TagGroupSlots> & {
|
|
227
|
+
/**
|
|
228
|
+
* Callback for when a tag is dismissed
|
|
229
|
+
*/
|
|
230
|
+
onDismiss?: TagDismissHandler<Value>;
|
|
231
|
+
size?: TagSize;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
export declare type TagGroupSlots = {
|
|
235
|
+
root: Slot<'div'>;
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* State used in rendering TagGroup
|
|
240
|
+
*/
|
|
241
|
+
export declare type TagGroupState<Value = TagValue> = ComponentState<TagGroupSlots> & Required<Pick<TagGroupProps, 'size'>> & {
|
|
242
|
+
handleTagDismiss: TagDismissHandler<Value>;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Tag Props
|
|
247
|
+
*/
|
|
248
|
+
export declare type TagProps<Value = string> = ComponentProps<Partial<TagSlots>> & {
|
|
249
|
+
/**
|
|
250
|
+
* A Tag can have filled, outlined or brand experience.
|
|
251
|
+
*
|
|
252
|
+
* @default 'filled'
|
|
253
|
+
*/
|
|
254
|
+
appearance?: TagAppearance;
|
|
255
|
+
/**
|
|
256
|
+
* A Tag can show that it cannot be interacted with.
|
|
257
|
+
*
|
|
258
|
+
* @default false
|
|
259
|
+
*/
|
|
260
|
+
disabled?: boolean;
|
|
261
|
+
/**
|
|
262
|
+
* A Tag can be dismissible
|
|
263
|
+
*
|
|
264
|
+
* @default false
|
|
265
|
+
*/
|
|
266
|
+
dismissible?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* A Tag can have rounded or circular shape.
|
|
269
|
+
*
|
|
270
|
+
* @default 'round'
|
|
271
|
+
*/
|
|
272
|
+
shape?: TagShape;
|
|
273
|
+
/**
|
|
274
|
+
* A Tag has three sizes.
|
|
275
|
+
*
|
|
276
|
+
* @default 'medium'
|
|
277
|
+
*/
|
|
278
|
+
size?: TagSize;
|
|
279
|
+
/**
|
|
280
|
+
* Unique value identifying the tag within a TagGroup
|
|
281
|
+
*/
|
|
282
|
+
value?: Value;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
export declare type TagShape = 'rounded' | 'circular';
|
|
286
|
+
|
|
287
|
+
export declare type TagSize = 'extra-small' | 'small' | 'medium';
|
|
288
|
+
|
|
289
|
+
export declare type TagSlots = {
|
|
290
|
+
root: NonNullable<Slot<'button', 'span'>>;
|
|
291
|
+
/**
|
|
292
|
+
* Slot for a visual element, usually an avatar
|
|
293
|
+
*/
|
|
294
|
+
media?: Slot<'span'>;
|
|
295
|
+
/**
|
|
296
|
+
* Slot for an icon
|
|
297
|
+
*/
|
|
298
|
+
icon?: Slot<'span'>;
|
|
299
|
+
/**
|
|
300
|
+
* Main text for the Tag. Children of the root slot are automatically rendered here
|
|
301
|
+
*/
|
|
302
|
+
primaryText: Slot<'span'>;
|
|
303
|
+
/**
|
|
304
|
+
* Secondary text that describes or complements the main text
|
|
305
|
+
*/
|
|
306
|
+
secondaryText?: Slot<'span'>;
|
|
307
|
+
/**
|
|
308
|
+
* Slot for the dismiss icon
|
|
309
|
+
*/
|
|
310
|
+
dismissIcon?: Slot<'span'>;
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* State used in rendering Tag
|
|
315
|
+
*/
|
|
316
|
+
export declare type TagState = ComponentState<TagSlots> & Required<Pick<TagProps, 'appearance' | 'disabled' | 'dismissible' | 'shape' | 'size'>> & UseTagAvatarContextValuesOptions;
|
|
317
|
+
|
|
318
|
+
export declare type TagValue = string;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Create the state required to render InteractionTag.
|
|
322
|
+
*
|
|
323
|
+
* The returned state can be modified with hooks such as useInteractionTagStyles_unstable,
|
|
324
|
+
* before being passed to renderInteractionTag_unstable.
|
|
325
|
+
*
|
|
326
|
+
* @param props - props from this instance of InteractionTag
|
|
327
|
+
* @param ref - reference to root HTMLDivElement of InteractionTag
|
|
328
|
+
*/
|
|
329
|
+
export declare const useInteractionTag_unstable: (props: InteractionTagProps, ref: React_2.Ref<HTMLDivElement>) => InteractionTagState;
|
|
330
|
+
|
|
331
|
+
export declare function useInteractionTagContextValues_unstable(state: InteractionTagState): InteractionTagContextValues;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Create the state required to render InteractionTagPrimary.
|
|
335
|
+
*
|
|
336
|
+
* The returned state can be modified with hooks such as useInteractionTagPrimaryStyles_unstable,
|
|
337
|
+
* before being passed to renderInteractionTagPrimary_unstable.
|
|
338
|
+
*
|
|
339
|
+
* @param props - props from this instance of InteractionTagPrimary
|
|
340
|
+
* @param ref - reference to root HTMLButtonElement of InteractionTagPrimary
|
|
341
|
+
*/
|
|
342
|
+
export declare const useInteractionTagPrimary_unstable: (props: InteractionTagPrimaryProps, ref: React_2.Ref<HTMLButtonElement>) => InteractionTagPrimaryState;
|
|
343
|
+
|
|
344
|
+
export declare const useInteractionTagPrimaryStyles_unstable: (state: InteractionTagPrimaryState) => InteractionTagPrimaryState;
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Create the state required to render InteractionTagSecondary.
|
|
348
|
+
*
|
|
349
|
+
* The returned state can be modified with hooks such as useInteractionTagSecondaryStyles_unstable,
|
|
350
|
+
* before being passed to renderInteractionTagSecondary_unstable.
|
|
351
|
+
*
|
|
352
|
+
* @param props - props from this instance of InteractionTagSecondary
|
|
353
|
+
* @param ref - reference to root HTMLButtonElement of InteractionTagSecondary
|
|
354
|
+
*/
|
|
355
|
+
export declare const useInteractionTagSecondary_unstable: (props: InteractionTagSecondaryProps, ref: React_2.Ref<HTMLButtonElement>) => InteractionTagSecondaryState;
|
|
356
|
+
|
|
357
|
+
export declare const useInteractionTagSecondaryStyles_unstable: (state: InteractionTagSecondaryState) => InteractionTagSecondaryState;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Apply styling to the InteractionTag slots based on the state
|
|
361
|
+
*/
|
|
362
|
+
export declare const useInteractionTagStyles_unstable: (state: InteractionTagState) => InteractionTagState;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Create the state required to render Tag.
|
|
366
|
+
*
|
|
367
|
+
* The returned state can be modified with hooks such as useTagStyles_unstable,
|
|
368
|
+
* before being passed to renderTag_unstable.
|
|
369
|
+
*
|
|
370
|
+
* @param props - props from this instance of Tag
|
|
371
|
+
* @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag
|
|
372
|
+
*/
|
|
373
|
+
export declare const useTag_unstable: (props: TagProps, ref: React_2.Ref<HTMLSpanElement | HTMLButtonElement>) => TagState;
|
|
374
|
+
|
|
375
|
+
export declare function useTagAvatarContextValues_unstable(state: UseTagAvatarContextValuesOptions): TagAvatarContextValues;
|
|
376
|
+
|
|
377
|
+
declare type UseTagAvatarContextValuesOptions = {
|
|
378
|
+
avatarSize: AvatarSize;
|
|
379
|
+
avatarShape: AvatarShape;
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Create the state required to render TagGroup.
|
|
384
|
+
*
|
|
385
|
+
* The returned state can be modified with hooks such as useTagGroupStyles_unstable,
|
|
386
|
+
* before being passed to renderTagGroup_unstable.
|
|
387
|
+
*
|
|
388
|
+
* @param props - props from this instance of TagGroup
|
|
389
|
+
* @param ref - reference to root HTMLDivElement of TagGroup
|
|
390
|
+
*/
|
|
391
|
+
export declare const useTagGroup_unstable: (props: TagGroupProps, ref: React_2.Ref<HTMLDivElement>) => TagGroupState;
|
|
392
|
+
|
|
393
|
+
export declare function useTagGroupContextValues_unstable(state: TagGroupState): TagGroupContextValues;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Apply styling to the TagGroup slots based on the state
|
|
397
|
+
*/
|
|
398
|
+
export declare const useTagGroupStyles_unstable: (state: TagGroupState) => TagGroupState;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Apply styling to the Tag slots based on the state
|
|
402
|
+
*/
|
|
403
|
+
export declare const useTagStyles_unstable: (state: TagState) => TagState;
|
|
404
|
+
|
|
405
|
+
export { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/InteractionTag/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTag.ts"],"sourcesContent":["export * from './components/InteractionTag/index';\n"],"names":[],"mappings":"AAAA,cAAc,oCAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/InteractionTagPrimary/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTagPrimary.ts"],"sourcesContent":["export * from './components/InteractionTagPrimary/index';\n"],"names":[],"mappings":"AAAA,cAAc,2CAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/InteractionTagSecondary/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTagSecondary.ts"],"sourcesContent":["export * from './components/InteractionTagSecondary/index';\n"],"names":[],"mappings":"AAAA,cAAc,6CAA6C"}
|
package/lib/Tag.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/Tag/index';
|
package/lib/Tag.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Tag.ts"],"sourcesContent":["export * from './components/Tag/index';\n"],"names":[],"mappings":"AAAA,cAAc,yBAAyB"}
|
package/lib/TagGroup.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/TagGroup/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["TagGroup.ts"],"sourcesContent":["export * from './components/TagGroup/index';\n"],"names":[],"mappings":"AAAA,cAAc,8BAA8B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useInteractionTag_unstable } from './useInteractionTag';
|
|
3
|
+
import { renderInteractionTag_unstable } from './renderInteractionTag';
|
|
4
|
+
import { useInteractionTagStyles_unstable } from './useInteractionTagStyles.styles';
|
|
5
|
+
import { useInteractionTagContextValues_unstable } from './useInteractionTagContextValues';
|
|
6
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
7
|
+
/**
|
|
8
|
+
* InteractionTag component - a visual representation of an attribute with primary and secondary actions.
|
|
9
|
+
* Can have `InteractionTagPrimary` and `InteractionTagSecondary` components as its children.
|
|
10
|
+
*/ export const InteractionTag = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
11
|
+
const state = useInteractionTag_unstable(props, ref);
|
|
12
|
+
useInteractionTagStyles_unstable(state);
|
|
13
|
+
useCustomStyleHook_unstable('useInteractionTagStyles_unstable')(state);
|
|
14
|
+
return renderInteractionTag_unstable(state, useInteractionTagContextValues_unstable(state));
|
|
15
|
+
});
|
|
16
|
+
InteractionTag.displayName = 'InteractionTag';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useInteractionTag_unstable } from './useInteractionTag';\nimport { renderInteractionTag_unstable } from './renderInteractionTag';\nimport { useInteractionTagStyles_unstable } from './useInteractionTagStyles.styles';\nimport { useInteractionTagContextValues_unstable } from './useInteractionTagContextValues';\nimport type { InteractionTagProps } from './InteractionTag.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * InteractionTag component - a visual representation of an attribute with primary and secondary actions.\n * Can have `InteractionTagPrimary` and `InteractionTagSecondary` components as its children.\n */\nexport const InteractionTag: ForwardRefComponent<InteractionTagProps> = React.forwardRef((props, ref) => {\n const state = useInteractionTag_unstable(props, ref);\n\n useInteractionTagStyles_unstable(state);\n\n useCustomStyleHook_unstable('useInteractionTagStyles_unstable')(state);\n\n return renderInteractionTag_unstable(state, useInteractionTagContextValues_unstable(state));\n});\n\nInteractionTag.displayName = 'InteractionTag';\n"],"names":["React","useInteractionTag_unstable","renderInteractionTag_unstable","useInteractionTagStyles_unstable","useInteractionTagContextValues_unstable","useCustomStyleHook_unstable","InteractionTag","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AACpF,SAASC,uCAAuC,QAAQ,mCAAmC;AAG3F,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,+BAA2DN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQT,2BAA2BO,OAAOC;IAEhDN,iCAAiCO;IAEjCL,4BAA4B,oCAAoCK;IAEhE,OAAOR,8BAA8BQ,OAAON,wCAAwCM;AACtF,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTag.types.ts"],"sourcesContent":["import { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { InteractionTagContextValue } from '../../contexts/interactionTagContext';\nimport { TagAppearance, TagShape, TagSize, TagValue, TagDismissHandler } from '../../utils/types';\n\nexport type InteractionTagContextValues = {\n interactionTag: InteractionTagContextValue;\n};\n\nexport type InteractionTagSlots = {\n root: NonNullable<Slot<'div'>>;\n};\n\n/**\n * InteractionTag Props\n */\nexport type InteractionTagProps<Value = TagValue> = ComponentProps<Partial<InteractionTagSlots>> & {\n /**\n * An InteractionTag can have filled, outlined or brand experience.\n *\n * @default 'filled'\n */\n appearance?: TagAppearance;\n\n /**\n * An InteractionTag can show that it cannot be interacted with.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * An InteractionTag can have rounded or circular shape.\n *\n * @default 'round'\n */\n shape?: TagShape;\n\n /**\n * An InteractionTag has three sizes.\n *\n * @default 'medium'\n */\n size?: TagSize;\n\n /**\n * Unique value identifying the tag within a TagGroup\n */\n value?: Value;\n};\n\n/**\n * State used in rendering InteractionTag\n */\nexport type InteractionTagState<Value = TagValue> = ComponentState<InteractionTagSlots> &\n Required<Pick<InteractionTagProps, 'appearance' | 'disabled' | 'shape' | 'size' | 'value'>> & {\n /**\n * Event handler from TagGroup context that allows TagGroup to dismiss the tag\n */\n handleTagDismiss: TagDismissHandler<Value>;\n\n /**\n * id to assign to InteractionTagPrimary\n */\n interactionTagPrimaryId: string;\n };\n"],"names":[],"mappings":"AAAA,WAgEI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './InteractionTag';\nexport * from './InteractionTag.types';\nexport * from './renderInteractionTag';\nexport * from './useInteractionTag';\nexport * from './useInteractionTagStyles.styles';\nexport * from './useInteractionTagContextValues';\n"],"names":[],"mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC;AACjD,cAAc,mCAAmC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
3
|
+
import { InteractionTagContextProvider } from '../../contexts/interactionTagContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of InteractionTag
|
|
6
|
+
*/ export const renderInteractionTag_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
return /*#__PURE__*/ _jsx(InteractionTagContextProvider, {
|
|
9
|
+
value: contextValues.interactionTag,
|
|
10
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
11
|
+
});
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderInteractionTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { InteractionTagState, InteractionTagSlots, InteractionTagContextValues } from './InteractionTag.types';\nimport { InteractionTagContextProvider } from '../../contexts/interactionTagContext';\n\n/**\n * Render the final JSX of InteractionTag\n */\nexport const renderInteractionTag_unstable = (\n state: InteractionTagState,\n contextValues: InteractionTagContextValues,\n) => {\n assertSlots<InteractionTagSlots>(state);\n\n return (\n <InteractionTagContextProvider value={contextValues.interactionTag}>\n <state.root />\n </InteractionTagContextProvider>\n );\n};\n"],"names":["assertSlots","InteractionTagContextProvider","renderInteractionTag_unstable","state","contextValues","value","interactionTag","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAExD,SAASC,6BAA6B,QAAQ,uCAAuC;AAErF;;CAEC,GACD,OAAO,MAAMC,gCAAgC,CAC3CC,OACAC;IAEAJ,YAAiCG;IAEjC,qBACE,KAACF;QAA8BI,OAAOD,cAAcE,cAAc;kBAChE,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';
|
|
3
|
+
import { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';
|
|
4
|
+
/**
|
|
5
|
+
* Create the state required to render InteractionTag.
|
|
6
|
+
*
|
|
7
|
+
* The returned state can be modified with hooks such as useInteractionTagStyles_unstable,
|
|
8
|
+
* before being passed to renderInteractionTag_unstable.
|
|
9
|
+
*
|
|
10
|
+
* @param props - props from this instance of InteractionTag
|
|
11
|
+
* @param ref - reference to root HTMLDivElement of InteractionTag
|
|
12
|
+
*/ export const useInteractionTag_unstable = (props, ref)=>{
|
|
13
|
+
const { handleTagDismiss, size: contextSize } = useTagGroupContext_unstable();
|
|
14
|
+
const id = useId('fui-InteractionTag-', props.id);
|
|
15
|
+
const interactionTagPrimaryId = useId('fui-InteractionTagPrimary-');
|
|
16
|
+
const { appearance = 'filled', disabled = false, shape = 'rounded', size = contextSize, value = id } = props;
|
|
17
|
+
return {
|
|
18
|
+
appearance,
|
|
19
|
+
disabled,
|
|
20
|
+
handleTagDismiss,
|
|
21
|
+
interactionTagPrimaryId,
|
|
22
|
+
shape,
|
|
23
|
+
size,
|
|
24
|
+
value,
|
|
25
|
+
components: {
|
|
26
|
+
root: 'div'
|
|
27
|
+
},
|
|
28
|
+
root: slot.always(getNativeElementProps('div', {
|
|
29
|
+
ref,
|
|
30
|
+
...props,
|
|
31
|
+
id
|
|
32
|
+
}), {
|
|
33
|
+
elementType: 'div'
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useInteractionTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, useId, slot } from '@fluentui/react-utilities';\nimport type { InteractionTagProps, InteractionTagState } from './InteractionTag.types';\nimport { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';\n\n/**\n * Create the state required to render InteractionTag.\n *\n * The returned state can be modified with hooks such as useInteractionTagStyles_unstable,\n * before being passed to renderInteractionTag_unstable.\n *\n * @param props - props from this instance of InteractionTag\n * @param ref - reference to root HTMLDivElement of InteractionTag\n */\nexport const useInteractionTag_unstable = (\n props: InteractionTagProps,\n ref: React.Ref<HTMLDivElement>,\n): InteractionTagState => {\n const { handleTagDismiss, size: contextSize } = useTagGroupContext_unstable();\n\n const id = useId('fui-InteractionTag-', props.id);\n\n const interactionTagPrimaryId = useId('fui-InteractionTagPrimary-');\n\n const { appearance = 'filled', disabled = false, shape = 'rounded', size = contextSize, value = id } = props;\n\n return {\n appearance,\n disabled,\n handleTagDismiss,\n interactionTagPrimaryId,\n shape,\n size,\n value,\n\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n ...props,\n id,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getNativeElementProps","useId","slot","useTagGroupContext_unstable","useInteractionTag_unstable","props","ref","handleTagDismiss","size","contextSize","id","interactionTagPrimaryId","appearance","disabled","shape","value","components","root","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAE/E,SAASC,2BAA2B,QAAQ,iCAAiC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAM,EAAEC,gBAAgB,EAAEC,MAAMC,WAAW,EAAE,GAAGN;IAEhD,MAAMO,KAAKT,MAAM,uBAAuBI,MAAMK,EAAE;IAEhD,MAAMC,0BAA0BV,MAAM;IAEtC,MAAM,EAAEW,aAAa,QAAQ,EAAEC,WAAW,KAAK,EAAEC,QAAQ,SAAS,EAAEN,OAAOC,WAAW,EAAEM,QAAQL,EAAE,EAAE,GAAGL;IAEvG,OAAO;QACLO;QACAC;QACAN;QACAI;QACAG;QACAN;QACAO;QAEAC,YAAY;YACVC,MAAM;QACR;QAEAA,MAAMf,KAAKgB,MAAM,CACflB,sBAAsB,OAAO;YAC3BM;YACA,GAAGD,KAAK;YACRK;QACF,IACA;YAAES,aAAa;QAAM;IAEzB;AACF,EAAE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export function useInteractionTagContextValues_unstable(state) {
|
|
3
|
+
const { appearance, disabled, handleTagDismiss, interactionTagPrimaryId, shape, size, value } = state;
|
|
4
|
+
return {
|
|
5
|
+
interactionTag: React.useMemo(()=>({
|
|
6
|
+
appearance,
|
|
7
|
+
disabled,
|
|
8
|
+
handleTagDismiss,
|
|
9
|
+
interactionTagPrimaryId,
|
|
10
|
+
shape,
|
|
11
|
+
size,
|
|
12
|
+
value
|
|
13
|
+
}), [
|
|
14
|
+
appearance,
|
|
15
|
+
disabled,
|
|
16
|
+
handleTagDismiss,
|
|
17
|
+
interactionTagPrimaryId,
|
|
18
|
+
shape,
|
|
19
|
+
size,
|
|
20
|
+
value
|
|
21
|
+
])
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useInteractionTagContextValues.ts"],"sourcesContent":["import * as React from 'react';\nimport { InteractionTagState, InteractionTagContextValues } from './InteractionTag.types';\n\nexport function useInteractionTagContextValues_unstable(state: InteractionTagState): InteractionTagContextValues {\n const { appearance, disabled, handleTagDismiss, interactionTagPrimaryId, shape, size, value } = state;\n\n return {\n interactionTag: React.useMemo(\n () => ({ appearance, disabled, handleTagDismiss, interactionTagPrimaryId, shape, size, value }),\n [appearance, disabled, handleTagDismiss, interactionTagPrimaryId, shape, size, value],\n ),\n };\n}\n"],"names":["React","useInteractionTagContextValues_unstable","state","appearance","disabled","handleTagDismiss","interactionTagPrimaryId","shape","size","value","interactionTag","useMemo"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,OAAO,SAASC,wCAAwCC,KAA0B;IAChF,MAAM,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,gBAAgB,EAAEC,uBAAuB,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGP;IAEhG,OAAO;QACLQ,gBAAgBV,MAAMW,OAAO,CAC3B,IAAO,CAAA;gBAAER;gBAAYC;gBAAUC;gBAAkBC;gBAAyBC;gBAAOC;gBAAMC;YAAM,CAAA,GAC7F;YAACN;YAAYC;YAAUC;YAAkBC;YAAyBC;YAAOC;YAAMC;SAAM;IAEzF;AACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
|
+
import { tokens } from '@fluentui/react-theme';
|
|
3
|
+
export const interactionTagClassNames = {
|
|
4
|
+
root: 'fui-InteractionTag'
|
|
5
|
+
};
|
|
6
|
+
const useRootBaseClassName = /*#__PURE__*/__resetStyles("r1y684pp", null, [".r1y684pp{display:inline-flex;align-items:center;box-sizing:border-box;width:fit-content;}"]);
|
|
7
|
+
const useRootStyles = /*#__PURE__*/__styles({
|
|
8
|
+
rounded: {
|
|
9
|
+
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
|
10
|
+
Beyfa6y: ["f16jpd5f", "f1aa9q02"],
|
|
11
|
+
B7oj6ja: ["f1jar5jt", "fyu767a"],
|
|
12
|
+
Btl43ni: ["fyu767a", "f1jar5jt"]
|
|
13
|
+
},
|
|
14
|
+
circular: {
|
|
15
|
+
Bbmb7ep: ["f8fbkgy", "f1nfllo7"],
|
|
16
|
+
Beyfa6y: ["f1nfllo7", "f8fbkgy"],
|
|
17
|
+
B7oj6ja: ["f1djnp8u", "f1s8kh49"],
|
|
18
|
+
Btl43ni: ["f1s8kh49", "f1djnp8u"]
|
|
19
|
+
},
|
|
20
|
+
medium: {
|
|
21
|
+
Bqenvij: "f1d2rq10"
|
|
22
|
+
},
|
|
23
|
+
small: {
|
|
24
|
+
Bqenvij: "frvgh55"
|
|
25
|
+
},
|
|
26
|
+
"extra-small": {
|
|
27
|
+
Bqenvij: "fjamq6b"
|
|
28
|
+
}
|
|
29
|
+
}, {
|
|
30
|
+
d: [".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".f1d2rq10{height:32px;}", ".frvgh55{height:24px;}", ".fjamq6b{height:20px;}"]
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Apply styling to the InteractionTag slots based on the state
|
|
34
|
+
*/
|
|
35
|
+
export const useInteractionTagStyles_unstable = state => {
|
|
36
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
37
|
+
const rootStyles = useRootStyles();
|
|
38
|
+
const {
|
|
39
|
+
shape,
|
|
40
|
+
size
|
|
41
|
+
} = state;
|
|
42
|
+
state.root.className = mergeClasses(interactionTagClassNames.root, rootBaseClassName, rootStyles[shape], rootStyles[size], state.root.className);
|
|
43
|
+
return state;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=useInteractionTagStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__resetStyles","__styles","mergeClasses","shorthands","tokens","interactionTagClassNames","root","useRootBaseClassName","useRootStyles","rounded","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","circular","medium","Bqenvij","small","d","useInteractionTagStyles_unstable","state","rootBaseClassName","rootStyles","shape","size","className"],"sources":["useInteractionTagStyles.styles.js"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nexport const interactionTagClassNames = {\n root: 'fui-InteractionTag'\n};\nconst useRootBaseClassName = makeResetStyles({\n display: 'inline-flex',\n alignItems: 'center',\n boxSizing: 'border-box',\n width: 'fit-content'\n});\nconst useRootStyles = makeStyles({\n rounded: shorthands.borderRadius(tokens.borderRadiusMedium),\n circular: shorthands.borderRadius(tokens.borderRadiusCircular),\n medium: {\n height: '32px'\n },\n small: {\n height: '24px'\n },\n 'extra-small': {\n height: '20px'\n }\n});\n/**\n * Apply styling to the InteractionTag slots based on the state\n */ export const useInteractionTagStyles_unstable = (state)=>{\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const { shape, size } = state;\n state.root.className = mergeClasses(interactionTagClassNames.root, rootBaseClassName, rootStyles[shape], rootStyles[size], state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAAAA,aAAA,EAAAC,QAAA,EAAsCC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACtF,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,OAAO,MAAMC,wBAAwB,GAAG;EACpCC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,oBAAoB,gBAAGP,aAAA,iHAK5B,CAAC;AACF,MAAMQ,aAAa,gBAAGP,QAAA;EAAAQ,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAC,QAAA;IAAAJ,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAAE,MAAA;IAAAC,OAAA;EAAA;EAAAC,KAAA;IAAAD,OAAA;EAAA;EAAA;IAAAA,OAAA;EAAA;AAAA;EAAAE,CAAA;AAAA,CAYrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,gCAAgC,GAAIC,KAAK,IAAG;EACzD,MAAMC,iBAAiB,GAAGd,oBAAoB,CAAC,CAAC;EAChD,MAAMe,UAAU,GAAGd,aAAa,CAAC,CAAC;EAClC,MAAM;IAAEe,KAAK;IAAEC;EAAK,CAAC,GAAGJ,KAAK;EAC7BA,KAAK,CAACd,IAAI,CAACmB,SAAS,GAAGvB,YAAY,CAACG,wBAAwB,CAACC,IAAI,EAAEe,iBAAiB,EAAEC,UAAU,CAACC,KAAK,CAAC,EAAED,UAAU,CAACE,IAAI,CAAC,EAAEJ,KAAK,CAACd,IAAI,CAACmB,SAAS,CAAC;EAChJ,OAAOL,KAAK;AAChB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useInteractionTagPrimary_unstable } from './useInteractionTagPrimary';
|
|
3
|
+
import { renderInteractionTagPrimary_unstable } from './renderInteractionTagPrimary';
|
|
4
|
+
import { useInteractionTagPrimaryStyles_unstable } from './useInteractionTagPrimaryStyles.styles';
|
|
5
|
+
import { useTagAvatarContextValues_unstable } from '../../utils';
|
|
6
|
+
import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
|
|
7
|
+
/**
|
|
8
|
+
* InteractionTagPrimary component - used as the first child of the `InteractionTag` component.
|
|
9
|
+
* Provides visual attributes such as media, icon, primary and secondary text, as well as the ability to attach a primary action.
|
|
10
|
+
*/ export const InteractionTagPrimary = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
11
|
+
const state = useInteractionTagPrimary_unstable(props, ref);
|
|
12
|
+
useInteractionTagPrimaryStyles_unstable(state);
|
|
13
|
+
useCustomStyleHook_unstable('useInteractionTagPrimaryStyles_unstable')(state);
|
|
14
|
+
return renderInteractionTagPrimary_unstable(state, useTagAvatarContextValues_unstable(state));
|
|
15
|
+
});
|
|
16
|
+
InteractionTagPrimary.displayName = 'InteractionTagPrimary';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["InteractionTagPrimary.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useInteractionTagPrimary_unstable } from './useInteractionTagPrimary';\nimport { renderInteractionTagPrimary_unstable } from './renderInteractionTagPrimary';\nimport { useInteractionTagPrimaryStyles_unstable } from './useInteractionTagPrimaryStyles.styles';\nimport type { InteractionTagPrimaryProps } from './InteractionTagPrimary.types';\nimport { useTagAvatarContextValues_unstable } from '../../utils';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * InteractionTagPrimary component - used as the first child of the `InteractionTag` component.\n * Provides visual attributes such as media, icon, primary and secondary text, as well as the ability to attach a primary action.\n */\nexport const InteractionTagPrimary: ForwardRefComponent<InteractionTagPrimaryProps> = React.forwardRef((props, ref) => {\n const state = useInteractionTagPrimary_unstable(props, ref);\n\n useInteractionTagPrimaryStyles_unstable(state);\n\n useCustomStyleHook_unstable('useInteractionTagPrimaryStyles_unstable')(state);\n\n return renderInteractionTagPrimary_unstable(state, useTagAvatarContextValues_unstable(state));\n});\n\nInteractionTagPrimary.displayName = 'InteractionTagPrimary';\n"],"names":["React","useInteractionTagPrimary_unstable","renderInteractionTagPrimary_unstable","useInteractionTagPrimaryStyles_unstable","useTagAvatarContextValues_unstable","useCustomStyleHook_unstable","InteractionTagPrimary","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,iCAAiC,QAAQ,6BAA6B;AAC/E,SAASC,oCAAoC,QAAQ,gCAAgC;AACrF,SAASC,uCAAuC,QAAQ,0CAA0C;AAElG,SAASC,kCAAkC,QAAQ,cAAc;AACjE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;;CAGC,GACD,OAAO,MAAMC,sCAAyEN,MAAMO,UAAU,CAAC,CAACC,OAAOC;IAC7G,MAAMC,QAAQT,kCAAkCO,OAAOC;IAEvDN,wCAAwCO;IAExCL,4BAA4B,2CAA2CK;IAEvE,OAAOR,qCAAqCQ,OAAON,mCAAmCM;AACxF,GAAG;AAEHJ,sBAAsBK,WAAW,GAAG"}
|