@fluentui/react-tags 9.7.5 → 9.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -8
- package/dist/index.d.ts +6 -5
- package/lib/components/InteractionTag/renderInteractionTag.js.map +1 -1
- package/lib/components/InteractionTagPrimary/renderInteractionTagPrimary.js.map +1 -1
- package/lib/components/InteractionTagSecondary/renderInteractionTagSecondary.js.map +1 -1
- package/lib/components/Tag/renderTag.js.map +1 -1
- package/lib/components/Tag/useTag.js +3 -0
- package/lib/components/Tag/useTag.js.map +1 -1
- package/lib/components/TagGroup/renderTagGroup.js.map +1 -1
- package/lib/components/TagGroup/useTagGroup.js +1 -1
- package/lib/components/TagGroup/useTagGroup.js.map +1 -1
- package/lib/contexts/interactionTagContext.js.map +1 -1
- package/lib/contexts/tagGroupContext.js.map +1 -1
- package/lib-commonjs/components/InteractionTag/renderInteractionTag.js.map +1 -1
- package/lib-commonjs/components/InteractionTagPrimary/renderInteractionTagPrimary.js.map +1 -1
- package/lib-commonjs/components/InteractionTagSecondary/renderInteractionTagSecondary.js.map +1 -1
- package/lib-commonjs/components/Tag/renderTag.js.map +1 -1
- package/lib-commonjs/components/Tag/useTag.js +3 -0
- package/lib-commonjs/components/Tag/useTag.js.map +1 -1
- package/lib-commonjs/components/TagGroup/renderTagGroup.js.map +1 -1
- package/lib-commonjs/components/TagGroup/useTagGroup.js +1 -1
- package/lib-commonjs/components/TagGroup/useTagGroup.js.map +1 -1
- package/lib-commonjs/contexts/interactionTagContext.js.map +1 -1
- package/lib-commonjs/contexts/tagGroupContext.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tags
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Mon, 08 Sep 2025 12:41:24 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.7.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-tags_v9.7.6)
|
|
8
|
+
|
|
9
|
+
Mon, 08 Sep 2025 12:41:24 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tags_v9.7.5..@fluentui/react-tags_v9.7.6)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: react 19 type issues ([PR #34864](https://github.com/microsoft/fluentui/pull/34864) by dmytrokirpa@microsoft.com)
|
|
15
|
+
- chore: enforce explicit module boundary types ([PR #35080](https://github.com/microsoft/fluentui/pull/35080) by dmytrokirpa@microsoft.com)
|
|
16
|
+
- chore: extend peer dependencies versions to support React 19 ([PR #35145](https://github.com/microsoft/fluentui/pull/35145) by dmytrokirpa@microsoft.com)
|
|
17
|
+
- fix: set default button type for dismissible ([PR #35088](https://github.com/microsoft/fluentui/pull/35088) by vgenaev@gmail.com)
|
|
18
|
+
- Bump @fluentui/react-aria to v9.17.0 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
19
|
+
- Bump @fluentui/react-avatar to v9.9.6 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
20
|
+
- Bump @fluentui/react-jsx-runtime to v9.2.0 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
21
|
+
- Bump @fluentui/react-shared-contexts to v9.25.1 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
22
|
+
- Bump @fluentui/react-tabster to v9.26.5 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
23
|
+
- Bump @fluentui/react-utilities to v9.24.1 ([commit](https://github.com/microsoft/fluentui/commit/17af11b3c9f4cac2beeaf4342a81c1f08e95fd29) by beachball)
|
|
24
|
+
|
|
7
25
|
## [9.7.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-tags_v9.7.5)
|
|
8
26
|
|
|
9
|
-
Thu, 21 Aug 2025 12:
|
|
27
|
+
Thu, 21 Aug 2025 12:25:22 GMT
|
|
10
28
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tags_v9.7.4..@fluentui/react-tags_v9.7.5)
|
|
11
29
|
|
|
12
30
|
### Patches
|
|
13
31
|
|
|
14
32
|
- fix: borders issues with small-circular and HC ([PR #34986](https://github.com/microsoft/fluentui/pull/34986) by vgenaev@gmail.com)
|
|
15
|
-
- Bump @fluentui/react-aria to v9.16.4 ([
|
|
16
|
-
- Bump @fluentui/react-avatar to v9.9.5 ([
|
|
17
|
-
- Bump @fluentui/react-jsx-runtime to v9.1.6 ([
|
|
18
|
-
- Bump @fluentui/react-shared-contexts to v9.25.0 ([
|
|
19
|
-
- Bump @fluentui/react-tabster to v9.26.4 ([
|
|
20
|
-
- Bump @fluentui/react-utilities to v9.24.0 ([
|
|
33
|
+
- Bump @fluentui/react-aria to v9.16.4 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
34
|
+
- Bump @fluentui/react-avatar to v9.9.5 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
35
|
+
- Bump @fluentui/react-jsx-runtime to v9.1.6 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
36
|
+
- Bump @fluentui/react-shared-contexts to v9.25.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
37
|
+
- Bump @fluentui/react-tabster to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
38
|
+
- Bump @fluentui/react-utilities to v9.24.0 ([commit](https://github.com/microsoft/fluentui/commit/884c695de4f736774c224fa33b2e410bf42752b0) by beachball)
|
|
21
39
|
|
|
22
40
|
## [9.7.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-tags_v9.7.4)
|
|
23
41
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ComponentState } from '@fluentui/react-utilities';
|
|
|
5
5
|
import type { EventData } from '@fluentui/react-utilities';
|
|
6
6
|
import type { EventHandler } from '@fluentui/react-utilities';
|
|
7
7
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
8
|
+
import type { JSXElement } from '@fluentui/react-utilities';
|
|
8
9
|
import * as React_2 from 'react';
|
|
9
10
|
import { Slot } from '@fluentui/react-utilities';
|
|
10
11
|
import type { SlotClassNames } from '@fluentui/react-utilities';
|
|
@@ -171,27 +172,27 @@ export declare type InteractionTagState<Value = TagValue> = ComponentState<Inter
|
|
|
171
172
|
/**
|
|
172
173
|
* Render the final JSX of InteractionTag
|
|
173
174
|
*/
|
|
174
|
-
export declare const renderInteractionTag_unstable: (state: InteractionTagState, contextValues: InteractionTagContextValues) =>
|
|
175
|
+
export declare const renderInteractionTag_unstable: (state: InteractionTagState, contextValues: InteractionTagContextValues) => JSXElement;
|
|
175
176
|
|
|
176
177
|
/**
|
|
177
178
|
* Render the final JSX of InteractionTagPrimary
|
|
178
179
|
*/
|
|
179
|
-
export declare const renderInteractionTagPrimary_unstable: (state: InteractionTagPrimaryState, contextValues: InteractionTagPrimaryContextValues) =>
|
|
180
|
+
export declare const renderInteractionTagPrimary_unstable: (state: InteractionTagPrimaryState, contextValues: InteractionTagPrimaryContextValues) => JSXElement;
|
|
180
181
|
|
|
181
182
|
/**
|
|
182
183
|
* Render the final JSX of InteractionTagSecondary
|
|
183
184
|
*/
|
|
184
|
-
export declare const renderInteractionTagSecondary_unstable: (state: InteractionTagSecondaryState) =>
|
|
185
|
+
export declare const renderInteractionTagSecondary_unstable: (state: InteractionTagSecondaryState) => JSXElement;
|
|
185
186
|
|
|
186
187
|
/**
|
|
187
188
|
* Render the final JSX of Tag
|
|
188
189
|
*/
|
|
189
|
-
export declare const renderTag_unstable: (state: TagState, contextValues: TagContextValues) =>
|
|
190
|
+
export declare const renderTag_unstable: (state: TagState, contextValues: TagContextValues) => JSXElement;
|
|
190
191
|
|
|
191
192
|
/**
|
|
192
193
|
* Render the final JSX of TagGroup
|
|
193
194
|
*/
|
|
194
|
-
export declare const renderTagGroup_unstable: (state: TagGroupState, contextValue: TagGroupContextValues) =>
|
|
195
|
+
export declare const renderTagGroup_unstable: (state: TagGroupState, contextValue: TagGroupContextValues) => JSXElement;
|
|
195
196
|
|
|
196
197
|
/**
|
|
197
198
|
* Tag component - a visual representation of an attribute.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTag/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;
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTag/renderInteractionTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\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;AAGxD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTagPrimary/renderInteractionTagPrimary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type {\n InteractionTagPrimaryState,\n InteractionTagPrimarySlots,\n InteractionTagPrimaryContextValues,\n} from './InteractionTagPrimary.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of InteractionTagPrimary\n */\nexport const renderInteractionTagPrimary_unstable = (\n state: InteractionTagPrimaryState,\n contextValues: InteractionTagPrimaryContextValues,\n) => {\n assertSlots<InteractionTagPrimarySlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderInteractionTagPrimary_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTagPrimary/renderInteractionTagPrimary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {\n InteractionTagPrimaryState,\n InteractionTagPrimarySlots,\n InteractionTagPrimaryContextValues,\n} from './InteractionTagPrimary.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of InteractionTagPrimary\n */\nexport const renderInteractionTagPrimary_unstable = (\n state: InteractionTagPrimaryState,\n contextValues: InteractionTagPrimaryContextValues,\n): JSXElement => {\n assertSlots<InteractionTagPrimarySlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderInteractionTagPrimary_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAOxD,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,uCAAuC,CAClDC,OACAC;IAEAJ,YAAwCG;IAExC,qBACE,MAACA,MAAME,IAAI;;YACRF,MAAMG,KAAK,kBACV,KAACL;gBAAsBM,OAAOH,cAAcI,MAAM;0BAChD,cAAA,KAACL,MAAMG,KAAK;;YAGfH,MAAMM,IAAI,kBAAI,KAACN,MAAMM,IAAI;YACzBN,MAAMO,WAAW,kBAAI,KAACP,MAAMO,WAAW;YACvCP,MAAMQ,aAAa,kBAAI,KAACR,MAAMQ,aAAa;;;AAGlD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTagSecondary/renderInteractionTagSecondary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { InteractionTagSecondaryState, InteractionTagSecondarySlots } from './InteractionTagSecondary.types';\n\n/**\n * Render the final JSX of InteractionTagSecondary\n */\nexport const renderInteractionTagSecondary_unstable = (state: InteractionTagSecondaryState) => {\n assertSlots<InteractionTagSecondarySlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderInteractionTagSecondary_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTagSecondary/renderInteractionTagSecondary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { InteractionTagSecondaryState, InteractionTagSecondarySlots } from './InteractionTagSecondary.types';\n\n/**\n * Render the final JSX of InteractionTagSecondary\n */\nexport const renderInteractionTagSecondary_unstable = (state: InteractionTagSecondaryState): JSXElement => {\n assertSlots<InteractionTagSecondarySlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderInteractionTagSecondary_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,WAAW,QAAQ,4BAA4B;AAIxD;;CAEC,GACD,OAAO,MAAMC,yCAAyC,CAACC;IACrDF,YAA0CE;IAE1C,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tag/renderTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TagState, TagSlots, TagContextValues } from './Tag.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of Tag\n */\nexport const renderTag_unstable = (state: TagState, contextValues: TagContextValues) => {\n assertSlots<TagSlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.dismissIcon && state.dismissible && <state.dismissIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderTag_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText","dismissIcon","dismissible"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../src/components/Tag/renderTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TagState, TagSlots, TagContextValues } from './Tag.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of Tag\n */\nexport const renderTag_unstable = (state: TagState, contextValues: TagContextValues): JSXElement => {\n assertSlots<TagSlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.dismissIcon && state.dismissible && <state.dismissIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderTag_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText","dismissIcon","dismissible"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,qBAAqB,QAAQ,yBAAyB;AAE/D;;CAEC,GACD,OAAO,MAAMC,qBAAqB,CAACC,OAAiBC;IAClDJ,YAAsBG;IAEtB,qBACE,MAACA,MAAME,IAAI;;YACRF,MAAMG,KAAK,kBACV,KAACL;gBAAsBM,OAAOH,cAAcI,MAAM;0BAChD,cAAA,KAACL,MAAMG,KAAK;;YAIfH,MAAMM,IAAI,kBAAI,KAACN,MAAMM,IAAI;YACzBN,MAAMO,WAAW,kBAAI,KAACP,MAAMO,WAAW;YACvCP,MAAMQ,aAAa,kBAAI,KAACR,MAAMQ,aAAa;YAC3CR,MAAMS,WAAW,IAAIT,MAAMU,WAAW,kBAAI,KAACV,MAAMS,WAAW;;;AAGnE,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tag/useTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { DismissRegular } from '@fluentui/react-icons';\nimport type { TagProps, TagState } from './Tag.types';\nimport { Delete, Backspace } from '@fluentui/keyboard-keys';\nimport { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';\n\nconst tagAvatarSizeMap = {\n medium: 28,\n small: 20,\n 'extra-small': 16,\n} as const;\n\nconst tagAvatarShapeMap = {\n rounded: 'square',\n circular: 'circular',\n} as const;\n\n/**\n * Create the state required to render Tag.\n *\n * The returned state can be modified with hooks such as useTagStyles_unstable,\n * before being passed to renderTag_unstable.\n *\n * @param props - props from this instance of Tag\n * @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag\n */\nexport const useTag_unstable = (props: TagProps, ref: React.Ref<HTMLSpanElement | HTMLButtonElement>): TagState => {\n const {\n handleTagDismiss,\n size: contextSize,\n disabled: contextDisabled,\n appearance: contextAppearance,\n dismissible: contextDismissible,\n role: tagGroupRole,\n } = useTagGroupContext_unstable();\n\n const id = useId('fui-Tag', props.id);\n\n const {\n appearance = contextAppearance ?? 'filled',\n disabled = false,\n dismissible = contextDismissible ?? false,\n selected,\n shape = 'rounded',\n size = contextSize,\n value = id,\n } = props;\n\n const dismissOnClick = useEventCallback((ev: React.MouseEvent<HTMLButtonElement>) => {\n props.onClick?.(ev);\n if (!ev.defaultPrevented) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const dismissOnKeyDown = useEventCallback((ev: React.KeyboardEvent<HTMLButtonElement>) => {\n props?.onKeyDown?.(ev);\n if (!ev.defaultPrevented && (ev.key === Delete || ev.key === Backspace)) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const elementType = dismissible ? 'button' : 'span';\n const selectedProp = tagGroupRole === 'listbox' ? 'aria-selected' : 'aria-pressed';\n const selectable = typeof selected === 'boolean' || tagGroupRole === 'listbox';\n\n return {\n appearance,\n avatarShape: tagAvatarShapeMap[shape],\n avatarSize: tagAvatarSizeMap[size],\n disabled: contextDisabled ? true : disabled,\n dismissible,\n selected: !!selected,\n shape,\n size,\n\n components: {\n root: elementType,\n media: 'span',\n icon: 'span',\n primaryText: 'span',\n secondaryText: 'span',\n dismissIcon: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n role: tagGroupRole === 'listbox' ? 'option' : undefined,\n [selectedProp]: selectable ? selected : undefined,\n ...props,\n disabled: contextDisabled ? true : disabled,\n id,\n ...(dismissible && { onClick: dismissOnClick, onKeyDown: dismissOnKeyDown }),\n }),\n { elementType },\n ),\n\n media: slot.optional(props.media, { elementType: 'span' }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n primaryText: slot.optional(props.primaryText, {\n renderByDefault: true,\n defaultProps: {\n children: props.children,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, { elementType: 'span' }),\n dismissIcon: slot.optional(props.dismissIcon, {\n renderByDefault: dismissible,\n defaultProps: {\n children: <DismissRegular />,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useId","slot","DismissRegular","Delete","Backspace","useTagGroupContext_unstable","tagAvatarSizeMap","medium","small","tagAvatarShapeMap","rounded","circular","useTag_unstable","props","ref","handleTagDismiss","size","contextSize","disabled","contextDisabled","appearance","contextAppearance","dismissible","contextDismissible","role","tagGroupRole","id","selected","shape","value","dismissOnClick","ev","onClick","defaultPrevented","dismissOnKeyDown","onKeyDown","key","elementType","selectedProp","selectable","avatarShape","avatarSize","components","root","media","icon","primaryText","secondaryText","dismissIcon","always","undefined","
|
|
1
|
+
{"version":3,"sources":["../src/components/Tag/useTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { DismissRegular } from '@fluentui/react-icons';\nimport type { TagProps, TagState } from './Tag.types';\nimport { Delete, Backspace } from '@fluentui/keyboard-keys';\nimport { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';\n\nconst tagAvatarSizeMap = {\n medium: 28,\n small: 20,\n 'extra-small': 16,\n} as const;\n\nconst tagAvatarShapeMap = {\n rounded: 'square',\n circular: 'circular',\n} as const;\n\n/**\n * Create the state required to render Tag.\n *\n * The returned state can be modified with hooks such as useTagStyles_unstable,\n * before being passed to renderTag_unstable.\n *\n * @param props - props from this instance of Tag\n * @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag\n */\nexport const useTag_unstable = (props: TagProps, ref: React.Ref<HTMLSpanElement | HTMLButtonElement>): TagState => {\n const {\n handleTagDismiss,\n size: contextSize,\n disabled: contextDisabled,\n appearance: contextAppearance,\n dismissible: contextDismissible,\n role: tagGroupRole,\n } = useTagGroupContext_unstable();\n\n const id = useId('fui-Tag', props.id);\n\n const {\n appearance = contextAppearance ?? 'filled',\n disabled = false,\n dismissible = contextDismissible ?? false,\n selected,\n shape = 'rounded',\n size = contextSize,\n value = id,\n } = props;\n\n const dismissOnClick = useEventCallback((ev: React.MouseEvent<HTMLButtonElement>) => {\n props.onClick?.(ev);\n if (!ev.defaultPrevented) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const dismissOnKeyDown = useEventCallback((ev: React.KeyboardEvent<HTMLButtonElement>) => {\n props?.onKeyDown?.(ev);\n if (!ev.defaultPrevented && (ev.key === Delete || ev.key === Backspace)) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const elementType = dismissible ? 'button' : 'span';\n const selectedProp = tagGroupRole === 'listbox' ? 'aria-selected' : 'aria-pressed';\n const selectable = typeof selected === 'boolean' || tagGroupRole === 'listbox';\n\n return {\n appearance,\n avatarShape: tagAvatarShapeMap[shape],\n avatarSize: tagAvatarSizeMap[size],\n disabled: contextDisabled ? true : disabled,\n dismissible,\n selected: !!selected,\n shape,\n size,\n\n components: {\n root: elementType,\n media: 'span',\n icon: 'span',\n primaryText: 'span',\n secondaryText: 'span',\n dismissIcon: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n role: tagGroupRole === 'listbox' ? 'option' : undefined,\n [selectedProp]: selectable ? selected : undefined,\n ...props,\n disabled: contextDisabled ? true : disabled,\n id,\n ...(dismissible && { onClick: dismissOnClick, onKeyDown: dismissOnKeyDown }),\n }),\n {\n defaultProps: {\n type: elementType === 'button' ? 'button' : undefined,\n },\n elementType,\n },\n ),\n\n media: slot.optional(props.media, { elementType: 'span' }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n primaryText: slot.optional(props.primaryText, {\n renderByDefault: true,\n defaultProps: {\n children: props.children,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, { elementType: 'span' }),\n dismissIcon: slot.optional(props.dismissIcon, {\n renderByDefault: dismissible,\n defaultProps: {\n children: <DismissRegular />,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useId","slot","DismissRegular","Delete","Backspace","useTagGroupContext_unstable","tagAvatarSizeMap","medium","small","tagAvatarShapeMap","rounded","circular","useTag_unstable","props","ref","handleTagDismiss","size","contextSize","disabled","contextDisabled","appearance","contextAppearance","dismissible","contextDismissible","role","tagGroupRole","id","selected","shape","value","dismissOnClick","ev","onClick","defaultPrevented","dismissOnKeyDown","onKeyDown","key","elementType","selectedProp","selectable","avatarShape","avatarSize","components","root","media","icon","primaryText","secondaryText","dismissIcon","always","undefined","defaultProps","type","optional","renderByDefault","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AACpG,SAASC,cAAc,QAAQ,wBAAwB;AAEvD,SAASC,MAAM,EAAEC,SAAS,QAAQ,0BAA0B;AAC5D,SAASC,2BAA2B,QAAQ,iCAAiC;AAE7E,MAAMC,mBAAmB;IACvBC,QAAQ;IACRC,OAAO;IACP,eAAe;AACjB;AAEA,MAAMC,oBAAoB;IACxBC,SAAS;IACTC,UAAU;AACZ;AAEA;;;;;;;;CAQC,GACD,OAAO,MAAMC,kBAAkB,CAACC,OAAiBC;IAC/C,MAAM,EACJC,gBAAgB,EAChBC,MAAMC,WAAW,EACjBC,UAAUC,eAAe,EACzBC,YAAYC,iBAAiB,EAC7BC,aAAaC,kBAAkB,EAC/BC,MAAMC,YAAY,EACnB,GAAGpB;IAEJ,MAAMqB,KAAK1B,MAAM,WAAWa,MAAMa,EAAE;IAEpC,MAAM,EACJN,aAAaC,8BAAAA,+BAAAA,oBAAqB,QAAQ,EAC1CH,WAAW,KAAK,EAChBI,cAAcC,+BAAAA,gCAAAA,qBAAsB,KAAK,EACzCI,QAAQ,EACRC,QAAQ,SAAS,EACjBZ,OAAOC,WA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ACEiB,cAAc;gBACZC,MAAMf,gBAAgB,WAAW,WAAWa;YAC9C;YACAb;QACF;QAGFO,OAAO3C,KAAKoD,QAAQ,CAACxC,MAAM+B,KAAK,EAAE;YAAEP,aAAa;QAAO;QACxDQ,MAAM5C,KAAKoD,QAAQ,CAACxC,MAAMgC,IAAI,EAAE;YAAER,aAAa;QAAO;QACtDS,aAAa7C,KAAKoD,QAAQ,CAACxC,MAAMiC,WAAW,EAAE;YAC5CQ,iBAAiB;YACjBH,cAAc;gBACZI,UAAU1C,MAAM0C,QAAQ;YAC1B;YACAlB,aAAa;QACf;QACAU,eAAe9C,KAAKoD,QAAQ,CAACxC,MAAMkC,aAAa,EAAE;YAAEV,aAAa;QAAO;QACxEW,aAAa/C,KAAKoD,QAAQ,CAACxC,MAAMmC,WAAW,EAAE;YAC5CM,iBAAiBhC;YACjB6B,cAAc;gBACZI,wBAAU,oBAACrD;YACb;YACAmC,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagGroup/renderTagGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TagGroupState, TagGroupSlots, TagGroupContextValues } from './TagGroup.types';\nimport { TagGroupContextProvider } from '../../contexts/tagGroupContext';\n\n/**\n * Render the final JSX of TagGroup\n */\nexport const renderTagGroup_unstable = (state: TagGroupState, contextValue: TagGroupContextValues) => {\n assertSlots<TagGroupSlots>(state);\n\n return (\n <TagGroupContextProvider value={contextValue.tagGroup}>\n <state.root />\n </TagGroupContextProvider>\n );\n};\n"],"names":["assertSlots","TagGroupContextProvider","renderTagGroup_unstable","state","contextValue","value","tagGroup","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../src/components/TagGroup/renderTagGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TagGroupState, TagGroupSlots, TagGroupContextValues } from './TagGroup.types';\nimport { TagGroupContextProvider } from '../../contexts/tagGroupContext';\n\n/**\n * Render the final JSX of TagGroup\n */\nexport const renderTagGroup_unstable = (state: TagGroupState, contextValue: TagGroupContextValues): JSXElement => {\n assertSlots<TagGroupSlots>(state);\n\n return (\n <TagGroupContextProvider value={contextValue.tagGroup}>\n <state.root />\n </TagGroupContextProvider>\n );\n};\n"],"names":["assertSlots","TagGroupContextProvider","renderTagGroup_unstable","state","contextValue","value","tagGroup","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,uBAAuB,QAAQ,iCAAiC;AAEzE;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAsBC;IAC5DJ,YAA2BG;IAE3B,qBACE,KAACF;QAAwBI,OAAOD,aAAaE,QAAQ;kBACnD,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|
|
@@ -13,7 +13,7 @@ import { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/us
|
|
|
13
13
|
* @param ref - reference to root HTMLDivElement of TagGroup
|
|
14
14
|
*/ export const useTagGroup_unstable = (props, ref)=>{
|
|
15
15
|
const { onDismiss, disabled = false, defaultSelectedValues, size = 'medium', appearance = 'filled', dismissible = false, role = 'toolbar', onTagSelect, selectedValues, ...rest } = props;
|
|
16
|
-
const innerRef = React.useRef();
|
|
16
|
+
const innerRef = React.useRef(undefined);
|
|
17
17
|
const { targetDocument } = useFluent();
|
|
18
18
|
const { findNextFocusable, findPrevFocusable } = useFocusFinders();
|
|
19
19
|
const [items, setItems] = useControllableState({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagGroup/useTagGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useControllableState,\n useEventCallback,\n mergeCallbacks,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TagGroupProps, TagGroupState } from './TagGroup.types';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/useInteractionTagSecondaryStyles.styles';\nimport type { TagValue } from '../../utils/types';\n\n/**\n * Create the state required to render TagGroup.\n *\n * The returned state can be modified with hooks such as useTagGroupStyles_unstable,\n * before being passed to renderTagGroup_unstable.\n *\n * @param props - props from this instance of TagGroup\n * @param ref - reference to root HTMLDivElement of TagGroup\n */\nexport const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref<HTMLDivElement>): TagGroupState => {\n const {\n onDismiss,\n disabled = false,\n defaultSelectedValues,\n size = 'medium',\n appearance = 'filled',\n dismissible = false,\n role = 'toolbar',\n onTagSelect,\n selectedValues,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>();\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const [items, setItems] = useControllableState<Array<TagValue>>({\n defaultState: defaultSelectedValues,\n state: selectedValues,\n initialState: [],\n });\n\n const handleTagDismiss: TagGroupState['handleTagDismiss'] = useEventCallback((e, data) => {\n onDismiss?.(e, data);\n\n // set focus after tag dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next tag only if the active element is within the current tag group\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n if (next) {\n next.focus();\n return;\n }\n\n // if there is no next focusable, focus on the previous focusable\n if (activeElement?.className.includes(interactionTagSecondaryClassNames.root)) {\n const prev = findPrevFocusable(activeElement.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n } else {\n const prev = findPrevFocusable(activeElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n }\n });\n\n const handleTagSelect: TagGroupState['handleTagSelect'] = useEventCallback(\n mergeCallbacks(onTagSelect, (_, data) => {\n if (items.includes(data.value)) {\n setItems(items.filter(item => item !== data.value));\n } else {\n setItems([...items, data.value]);\n }\n }),\n );\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n return {\n handleTagDismiss,\n handleTagSelect: onTagSelect ? handleTagSelect : undefined,\n selectedValues: items,\n role,\n size,\n disabled,\n appearance,\n dismissible,\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role,\n 'aria-disabled': disabled,\n ...arrowNavigationProps,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useControllableState","useEventCallback","mergeCallbacks","useMergedRefs","slot","useArrowNavigationGroup","useFocusFinders","useFluent_unstable","useFluent","interactionTagSecondaryClassNames","useTagGroup_unstable","props","ref","onDismiss","disabled","defaultSelectedValues","size","appearance","dismissible","role","onTagSelect","selectedValues","rest","innerRef","useRef","targetDocument","findNextFocusable","findPrevFocusable","items","setItems","defaultState","state","initialState","handleTagDismiss","e","data","activeElement","current","contains","next","container","focus","className","includes","root","prev","parentElement","handleTagSelect","_","value","filter","item","arrowNavigationProps","circular","axis","memorizeCurrent","
|
|
1
|
+
{"version":3,"sources":["../src/components/TagGroup/useTagGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useControllableState,\n useEventCallback,\n mergeCallbacks,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TagGroupProps, TagGroupState } from './TagGroup.types';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/useInteractionTagSecondaryStyles.styles';\nimport type { TagValue } from '../../utils/types';\n\n/**\n * Create the state required to render TagGroup.\n *\n * The returned state can be modified with hooks such as useTagGroupStyles_unstable,\n * before being passed to renderTagGroup_unstable.\n *\n * @param props - props from this instance of TagGroup\n * @param ref - reference to root HTMLDivElement of TagGroup\n */\nexport const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref<HTMLDivElement>): TagGroupState => {\n const {\n onDismiss,\n disabled = false,\n defaultSelectedValues,\n size = 'medium',\n appearance = 'filled',\n dismissible = false,\n role = 'toolbar',\n onTagSelect,\n selectedValues,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>(undefined);\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const [items, setItems] = useControllableState<Array<TagValue>>({\n defaultState: defaultSelectedValues,\n state: selectedValues,\n initialState: [],\n });\n\n const handleTagDismiss: TagGroupState['handleTagDismiss'] = useEventCallback((e, data) => {\n onDismiss?.(e, data);\n\n // set focus after tag dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next tag only if the active element is within the current tag group\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n if (next) {\n next.focus();\n return;\n }\n\n // if there is no next focusable, focus on the previous focusable\n if (activeElement?.className.includes(interactionTagSecondaryClassNames.root)) {\n const prev = findPrevFocusable(activeElement.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n } else {\n const prev = findPrevFocusable(activeElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n }\n });\n\n const handleTagSelect: TagGroupState['handleTagSelect'] = useEventCallback(\n mergeCallbacks(onTagSelect, (_, data) => {\n if (items.includes(data.value)) {\n setItems(items.filter(item => item !== data.value));\n } else {\n setItems([...items, data.value]);\n }\n }),\n );\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n return {\n handleTagDismiss,\n handleTagSelect: onTagSelect ? handleTagSelect : undefined,\n selectedValues: items,\n role,\n size,\n disabled,\n appearance,\n dismissible,\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role,\n 'aria-disabled': disabled,\n ...arrowNavigationProps,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useControllableState","useEventCallback","mergeCallbacks","useMergedRefs","slot","useArrowNavigationGroup","useFocusFinders","useFluent_unstable","useFluent","interactionTagSecondaryClassNames","useTagGroup_unstable","props","ref","onDismiss","disabled","defaultSelectedValues","size","appearance","dismissible","role","onTagSelect","selectedValues","rest","innerRef","useRef","undefined","targetDocument","findNextFocusable","findPrevFocusable","items","setItems","defaultState","state","initialState","handleTagDismiss","e","data","activeElement","current","contains","next","container","focus","className","includes","root","prev","parentElement","handleTagSelect","_","value","filter","item","arrowNavigationProps","circular","axis","memorizeCurrent","components","always","elementType"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,wBAAwB,EACxBC,oBAAoB,EACpBC,gBAAgB,EAChBC,cAAc,EACdC,aAAa,EACbC,IAAI,QACC,4BAA4B;AAEnC,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,0BAA0B;AACnF,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,iCAAiC,QAAQ,qEAAqE;AAGvH;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAM,EACJC,SAAS,EACTC,WA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C9B,IAAIP,MAAMe,QAAQ,CAACR,KAAKc,KAAK,GAAG;YAC9BpB,SAASD,MAAMsB,MAAM,CAACC,CAAAA,OAAQA,SAAShB,KAAKc,KAAK;QACnD,OAAO;YACLpB,SAAS;mBAAID;gBAAOO,KAAKc,KAAK;aAAC;QACjC;IACF;IAGF,MAAMG,uBAAuBhD,wBAAwB;QACnDiD,UAAU;QACVC,MAAM;QACNC,iBAAiB;IACnB;IAEA,OAAO;QACLtB;QACAc,iBAAiB5B,cAAc4B,kBAAkBvB;QACjDJ,gBAAgBQ;QAChBV;QACAH;QACAF;QACAG;QACAC;QACAuC,YAAY;YACVZ,MAAM;QACR;QAEAA,MAAMzC,KAAKsD,MAAM,CACf3D,yBAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5Fa,KAAKT,cAAcS,KAAKW;YACxBJ;YACA,iBAAiBL;YACjB,GAAGuC,oBAAoB;YACvB,GAAG/B,IAAI;QACT,IACA;YAAEqC,aAAa;QAAM;IAEzB;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/interactionTagContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { InteractionTagState } from '../components/InteractionTag/index';\nimport type { TagDismissHandler, TagSelectHandler } from '../utils/types';\n\nexport const InteractionTagContext = React.createContext<InteractionTagContextValue | undefined>(undefined);\n\nconst interactionTagContextDefaultValue: InteractionTagContextValue = {\n appearance: 'filled',\n disabled: false,\n handleTagDismiss: () => ({}),\n handleTagSelect: () => ({}),\n interactionTagPrimaryId: '',\n selected: false,\n selectedValues: [],\n shape: 'rounded',\n size: 'medium',\n value: '',\n};\n\n/**\n * Context shared between InteractionTag and its children components\n */\nexport type InteractionTagContextValue<Value = string> = Required<\n Pick<InteractionTagState, 'appearance' | 'disabled' | 'selected' | 'selectedValues' | 'shape' | 'size'> & {\n handleTagDismiss: TagDismissHandler<Value>;\n interactionTagPrimaryId: string;\n value?: Value;\n }\n> & {\n handleTagSelect?: TagSelectHandler<Value>;\n};\n\nexport const InteractionTagContextProvider = InteractionTagContext.Provider;\n\nexport const useInteractionTagContext_unstable = () =>\n React.useContext(InteractionTagContext) ?? interactionTagContextDefaultValue;\n"],"names":["React","InteractionTagContext","createContext","undefined","interactionTagContextDefaultValue","appearance","disabled","handleTagDismiss","handleTagSelect","interactionTagPrimaryId","selected","selectedValues","shape","size","value","InteractionTagContextProvider","Provider","useInteractionTagContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,MAAMC,sCAAwBD,MAAME,aAAa,CAAyCC,WAAW;AAE5G,MAAMC,oCAAgE;IACpEC,YAAY;IACZC,UAAU;IACVC,kBAAkB,IAAO,CAAA,CAAC,CAAA;IAC1BC,iBAAiB,IAAO,CAAA,CAAC,CAAA;IACzBC,yBAAyB;IACzBC,UAAU;IACVC,gBAAgB,EAAE;IAClBC,OAAO;IACPC,MAAM;IACNC,OAAO;AACT;AAeA,OAAO,MAAMC,gCAAgCd,sBAAsBe,QAAQ,CAAC;AAE5E,OAAO,MAAMC,oCAAoC;QAC/CjB;WAAAA,CAAAA,oBAAAA,MAAMkB,UAAU,CAACjB,oCAAjBD,+BAAAA,oBAA2CI;EAAkC"}
|
|
1
|
+
{"version":3,"sources":["../src/contexts/interactionTagContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { InteractionTagState } from '../components/InteractionTag/index';\nimport type { TagDismissHandler, TagSelectHandler } from '../utils/types';\n\nexport const InteractionTagContext = React.createContext<InteractionTagContextValue | undefined>(undefined);\n\nconst interactionTagContextDefaultValue: InteractionTagContextValue = {\n appearance: 'filled',\n disabled: false,\n handleTagDismiss: () => ({}),\n handleTagSelect: () => ({}),\n interactionTagPrimaryId: '',\n selected: false,\n selectedValues: [],\n shape: 'rounded',\n size: 'medium',\n value: '',\n};\n\n/**\n * Context shared between InteractionTag and its children components\n */\nexport type InteractionTagContextValue<Value = string> = Required<\n Pick<InteractionTagState, 'appearance' | 'disabled' | 'selected' | 'selectedValues' | 'shape' | 'size'> & {\n handleTagDismiss: TagDismissHandler<Value>;\n interactionTagPrimaryId: string;\n value?: Value;\n }\n> & {\n handleTagSelect?: TagSelectHandler<Value>;\n};\n\nexport const InteractionTagContextProvider = InteractionTagContext.Provider;\n\nexport const useInteractionTagContext_unstable = (): InteractionTagContextValue =>\n React.useContext(InteractionTagContext) ?? interactionTagContextDefaultValue;\n"],"names":["React","InteractionTagContext","createContext","undefined","interactionTagContextDefaultValue","appearance","disabled","handleTagDismiss","handleTagSelect","interactionTagPrimaryId","selected","selectedValues","shape","size","value","InteractionTagContextProvider","Provider","useInteractionTagContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B,OAAO,MAAMC,sCAAwBD,MAAME,aAAa,CAAyCC,WAAW;AAE5G,MAAMC,oCAAgE;IACpEC,YAAY;IACZC,UAAU;IACVC,kBAAkB,IAAO,CAAA,CAAC,CAAA;IAC1BC,iBAAiB,IAAO,CAAA,CAAC,CAAA;IACzBC,yBAAyB;IACzBC,UAAU;IACVC,gBAAgB,EAAE;IAClBC,OAAO;IACPC,MAAM;IACNC,OAAO;AACT;AAeA,OAAO,MAAMC,gCAAgCd,sBAAsBe,QAAQ,CAAC;AAE5E,OAAO,MAAMC,oCAAoC;QAC/CjB;WAAAA,CAAAA,oBAAAA,MAAMkB,UAAU,CAACjB,oCAAjBD,+BAAAA,oBAA2CI;EAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/tagGroupContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TagGroupState } from '../components/TagGroup/index';\n\nexport const TagGroupContext = React.createContext<TagGroupContextValue | undefined>(undefined);\n\nconst tagGroupContextDefaultValue: TagGroupContextValue = {\n handleTagDismiss: () => ({}),\n size: 'medium',\n role: 'toolbar',\n handleTagSelect: undefined,\n};\n\n/**\n * Context shared between TagGroup and its children components\n */\nexport type TagGroupContextValue = Required<Pick<TagGroupState, 'handleTagDismiss' | 'size'>> &\n Partial<\n Pick<TagGroupState, 'disabled' | 'appearance' | 'dismissible' | 'handleTagSelect' | 'role' | 'selectedValues'>\n >;\n\nexport const TagGroupContextProvider = TagGroupContext.Provider;\n\nexport const useTagGroupContext_unstable = ()
|
|
1
|
+
{"version":3,"sources":["../src/contexts/tagGroupContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TagGroupState } from '../components/TagGroup/index';\n\nexport const TagGroupContext = React.createContext<TagGroupContextValue | undefined>(undefined);\n\nconst tagGroupContextDefaultValue: TagGroupContextValue = {\n handleTagDismiss: () => ({}),\n size: 'medium',\n role: 'toolbar',\n handleTagSelect: undefined,\n};\n\n/**\n * Context shared between TagGroup and its children components\n */\nexport type TagGroupContextValue = Required<Pick<TagGroupState, 'handleTagDismiss' | 'size'>> &\n Partial<\n Pick<TagGroupState, 'disabled' | 'appearance' | 'dismissible' | 'handleTagSelect' | 'role' | 'selectedValues'>\n >;\n\nexport const TagGroupContextProvider = TagGroupContext.Provider;\n\nexport const useTagGroupContext_unstable = (): TagGroupContextValue =>\n React.useContext(TagGroupContext) ?? tagGroupContextDefaultValue;\n"],"names":["React","TagGroupContext","createContext","undefined","tagGroupContextDefaultValue","handleTagDismiss","size","role","handleTagSelect","TagGroupContextProvider","Provider","useTagGroupContext_unstable","useContext"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAG/B,OAAO,MAAMC,gCAAkBD,MAAME,aAAa,CAAmCC,WAAW;AAEhG,MAAMC,8BAAoD;IACxDC,kBAAkB,IAAO,CAAA,CAAC,CAAA;IAC1BC,MAAM;IACNC,MAAM;IACNC,iBAAiBL;AACnB;AAUA,OAAO,MAAMM,0BAA0BR,gBAAgBS,QAAQ,CAAC;AAEhE,OAAO,MAAMC,8BAA8B;QACzCX;WAAAA,CAAAA,oBAAAA,MAAMY,UAAU,CAACX,8BAAjBD,+BAAAA,oBAAqCI;EAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTag/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":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTag/renderInteractionTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } 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): JSXElement => {\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":";;;;+BAWaE;;;;;;4BAVb,gDAAiD;gCAErB,4BAA4B;uCAGV,uCAAuC;AAK9E,sCAAsC,CAC3CC,OACAC;QAEAJ,2BAAAA,EAAiCG;IAEjC,OAAA,WAAA,OACE,eAAA,EAACF,oDAAAA,EAAAA;QAA8BI,OAAOD,cAAcE,cAAc;kBAChE,WAAA,OAAA,eAAA,EAACH,MAAMI,IAAI,EAAA,CAAA;;AAGjB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTagPrimary/renderInteractionTagPrimary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type {\n InteractionTagPrimaryState,\n InteractionTagPrimarySlots,\n InteractionTagPrimaryContextValues,\n} from './InteractionTagPrimary.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of InteractionTagPrimary\n */\nexport const renderInteractionTagPrimary_unstable = (\n state: InteractionTagPrimaryState,\n contextValues: InteractionTagPrimaryContextValues,\n) => {\n assertSlots<InteractionTagPrimarySlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderInteractionTagPrimary_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTagPrimary/renderInteractionTagPrimary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type {\n InteractionTagPrimaryState,\n InteractionTagPrimarySlots,\n InteractionTagPrimaryContextValues,\n} from './InteractionTagPrimary.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of InteractionTagPrimary\n */\nexport const renderInteractionTagPrimary_unstable = (\n state: InteractionTagPrimaryState,\n contextValues: InteractionTagPrimaryContextValues,\n): JSXElement => {\n assertSlots<InteractionTagPrimarySlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderInteractionTagPrimary_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText"],"mappings":";;;;+BAeaE;;;;;;4BAdb,iCAAiD;gCAErB,4BAA4B;6BAOlB,yBAAyB;AAKxD,6CAA6C,CAClDC,OACAC;QAEAJ,2BAAAA,EAAwCG;IAExC,OAAA,WAAA,OACE,gBAAA,EAACA,MAAME,IAAI,EAAA;;YACRF,MAAMG,KAAK,IAAA,WAAA,OACV,eAAA,EAACL,kCAAAA,EAAAA;gBAAsBM,OAAOH,cAAcI,MAAM;0BAChD,WAAA,OAAA,eAAA,EAACL,MAAMG,KAAK,EAAA,CAAA;;YAGfH,MAAMM,IAAI,IAAA,WAAA,OAAI,eAAA,EAACN,MAAMM,IAAI,EAAA,CAAA;YACzBN,MAAMO,WAAW,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,WAAW,EAAA,CAAA;YACvCP,MAAMQ,aAAa,IAAA,WAAA,OAAI,eAAA,EAACR,MAAMQ,aAAa,EAAA,CAAA;;;AAGlD,EAAE"}
|
package/lib-commonjs/components/InteractionTagSecondary/renderInteractionTagSecondary.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/InteractionTagSecondary/renderInteractionTagSecondary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { InteractionTagSecondaryState, InteractionTagSecondarySlots } from './InteractionTagSecondary.types';\n\n/**\n * Render the final JSX of InteractionTagSecondary\n */\nexport const renderInteractionTagSecondary_unstable = (state: InteractionTagSecondaryState) => {\n assertSlots<InteractionTagSecondarySlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderInteractionTagSecondary_unstable","state","root"],"mappings":";;;;;;;;;;4BACA,gDAAiD;gCACrB,4BAA4B;
|
|
1
|
+
{"version":3,"sources":["../src/components/InteractionTagSecondary/renderInteractionTagSecondary.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { InteractionTagSecondaryState, InteractionTagSecondarySlots } from './InteractionTagSecondary.types';\n\n/**\n * Render the final JSX of InteractionTagSecondary\n */\nexport const renderInteractionTagSecondary_unstable = (state: InteractionTagSecondaryState): JSXElement => {\n assertSlots<InteractionTagSecondarySlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderInteractionTagSecondary_unstable","state","root"],"mappings":";;;;;;;;;;4BACA,gDAAiD;gCACrB,4BAA4B;AAOjD,MAAMC,yCAAyC,CAACC;QACrDF,2BAAAA,EAA0CE;IAE1C,OAAA,WAAA,OAAO,eAAA,EAACA,MAAMC,IAAI,EAAA,CAAA;AACpB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tag/renderTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TagState, TagSlots, TagContextValues } from './Tag.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of Tag\n */\nexport const renderTag_unstable = (state: TagState, contextValues: TagContextValues) => {\n assertSlots<TagSlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.dismissIcon && state.dismissible && <state.dismissIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderTag_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText","dismissIcon","dismissible"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/components/Tag/renderTag.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TagState, TagSlots, TagContextValues } from './Tag.types';\nimport { AvatarContextProvider } from '@fluentui/react-avatar';\n\n/**\n * Render the final JSX of Tag\n */\nexport const renderTag_unstable = (state: TagState, contextValues: TagContextValues): JSXElement => {\n assertSlots<TagSlots>(state);\n\n return (\n <state.root>\n {state.media && (\n <AvatarContextProvider value={contextValues.avatar}>\n <state.media />\n </AvatarContextProvider>\n )}\n\n {state.icon && <state.icon />}\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.dismissIcon && state.dismissible && <state.dismissIcon />}\n </state.root>\n );\n};\n"],"names":["assertSlots","AvatarContextProvider","renderTag_unstable","state","contextValues","root","media","value","avatar","icon","primaryText","secondaryText","dismissIcon","dismissible"],"mappings":";;;;+BAWaE;;;;;;4BAVb,iCAAiD;gCAErB,4BAA4B;6BAGlB,yBAAyB;AAKxD,2BAA2B,CAACC,OAAiBC;QAClDJ,2BAAAA,EAAsBG;IAEtB,OAAA,WAAA,OACE,gBAAA,EAACA,MAAME,IAAI,EAAA;;YACRF,MAAMG,KAAK,IAAA,WAAA,OACV,eAAA,EAACL,kCAAAA,EAAAA;gBAAsBM,OAAOH,cAAcI,MAAM;0BAChD,WAAA,OAAA,eAAA,EAACL,MAAMG,KAAK,EAAA,CAAA;;YAIfH,MAAMM,IAAI,IAAA,WAAA,OAAI,eAAA,EAACN,MAAMM,IAAI,EAAA,CAAA;YACzBN,MAAMO,WAAW,IAAA,WAAA,OAAI,eAAA,EAACP,MAAMO,WAAW,EAAA,CAAA;YACvCP,MAAMQ,aAAa,IAAA,WAAA,OAAI,eAAA,EAACR,MAAMQ,aAAa,EAAA,CAAA;YAC3CR,MAAMS,WAAW,IAAIT,MAAMU,WAAW,IAAA,WAAA,OAAI,eAAA,EAACV,MAAMS,WAAW,EAAA,CAAA;;;AAGnE,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Tag/useTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { DismissRegular } from '@fluentui/react-icons';\nimport type { TagProps, TagState } from './Tag.types';\nimport { Delete, Backspace } from '@fluentui/keyboard-keys';\nimport { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';\n\nconst tagAvatarSizeMap = {\n medium: 28,\n small: 20,\n 'extra-small': 16,\n} as const;\n\nconst tagAvatarShapeMap = {\n rounded: 'square',\n circular: 'circular',\n} as const;\n\n/**\n * Create the state required to render Tag.\n *\n * The returned state can be modified with hooks such as useTagStyles_unstable,\n * before being passed to renderTag_unstable.\n *\n * @param props - props from this instance of Tag\n * @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag\n */\nexport const useTag_unstable = (props: TagProps, ref: React.Ref<HTMLSpanElement | HTMLButtonElement>): TagState => {\n const {\n handleTagDismiss,\n size: contextSize,\n disabled: contextDisabled,\n appearance: contextAppearance,\n dismissible: contextDismissible,\n role: tagGroupRole,\n } = useTagGroupContext_unstable();\n\n const id = useId('fui-Tag', props.id);\n\n const {\n appearance = contextAppearance ?? 'filled',\n disabled = false,\n dismissible = contextDismissible ?? false,\n selected,\n shape = 'rounded',\n size = contextSize,\n value = id,\n } = props;\n\n const dismissOnClick = useEventCallback((ev: React.MouseEvent<HTMLButtonElement>) => {\n props.onClick?.(ev);\n if (!ev.defaultPrevented) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const dismissOnKeyDown = useEventCallback((ev: React.KeyboardEvent<HTMLButtonElement>) => {\n props?.onKeyDown?.(ev);\n if (!ev.defaultPrevented && (ev.key === Delete || ev.key === Backspace)) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const elementType = dismissible ? 'button' : 'span';\n const selectedProp = tagGroupRole === 'listbox' ? 'aria-selected' : 'aria-pressed';\n const selectable = typeof selected === 'boolean' || tagGroupRole === 'listbox';\n\n return {\n appearance,\n avatarShape: tagAvatarShapeMap[shape],\n avatarSize: tagAvatarSizeMap[size],\n disabled: contextDisabled ? true : disabled,\n dismissible,\n selected: !!selected,\n shape,\n size,\n\n components: {\n root: elementType,\n media: 'span',\n icon: 'span',\n primaryText: 'span',\n secondaryText: 'span',\n dismissIcon: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n role: tagGroupRole === 'listbox' ? 'option' : undefined,\n [selectedProp]: selectable ? selected : undefined,\n ...props,\n disabled: contextDisabled ? true : disabled,\n id,\n ...(dismissible && { onClick: dismissOnClick, onKeyDown: dismissOnKeyDown }),\n }),\n { elementType },\n ),\n\n media: slot.optional(props.media, { elementType: 'span' }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n primaryText: slot.optional(props.primaryText, {\n renderByDefault: true,\n defaultProps: {\n children: props.children,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, { elementType: 'span' }),\n dismissIcon: slot.optional(props.dismissIcon, {\n renderByDefault: dismissible,\n defaultProps: {\n children: <DismissRegular />,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useId","slot","DismissRegular","Delete","Backspace","useTagGroupContext_unstable","tagAvatarSizeMap","medium","small","tagAvatarShapeMap","rounded","circular","useTag_unstable","props","ref","handleTagDismiss","size","contextSize","disabled","contextDisabled","appearance","contextAppearance","dismissible","contextDismissible","role","tagGroupRole","id","selected","shape","value","dismissOnClick","ev","onClick","defaultPrevented","dismissOnKeyDown","onKeyDown","key","elementType","selectedProp","selectable","avatarShape","avatarSize","components","root","media","icon","primaryText","secondaryText","dismissIcon","always","undefined","
|
|
1
|
+
{"version":3,"sources":["../src/components/Tag/useTag.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { DismissRegular } from '@fluentui/react-icons';\nimport type { TagProps, TagState } from './Tag.types';\nimport { Delete, Backspace } from '@fluentui/keyboard-keys';\nimport { useTagGroupContext_unstable } from '../../contexts/tagGroupContext';\n\nconst tagAvatarSizeMap = {\n medium: 28,\n small: 20,\n 'extra-small': 16,\n} as const;\n\nconst tagAvatarShapeMap = {\n rounded: 'square',\n circular: 'circular',\n} as const;\n\n/**\n * Create the state required to render Tag.\n *\n * The returned state can be modified with hooks such as useTagStyles_unstable,\n * before being passed to renderTag_unstable.\n *\n * @param props - props from this instance of Tag\n * @param ref - reference to root HTMLSpanElement or HTMLButtonElement of Tag\n */\nexport const useTag_unstable = (props: TagProps, ref: React.Ref<HTMLSpanElement | HTMLButtonElement>): TagState => {\n const {\n handleTagDismiss,\n size: contextSize,\n disabled: contextDisabled,\n appearance: contextAppearance,\n dismissible: contextDismissible,\n role: tagGroupRole,\n } = useTagGroupContext_unstable();\n\n const id = useId('fui-Tag', props.id);\n\n const {\n appearance = contextAppearance ?? 'filled',\n disabled = false,\n dismissible = contextDismissible ?? false,\n selected,\n shape = 'rounded',\n size = contextSize,\n value = id,\n } = props;\n\n const dismissOnClick = useEventCallback((ev: React.MouseEvent<HTMLButtonElement>) => {\n props.onClick?.(ev);\n if (!ev.defaultPrevented) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const dismissOnKeyDown = useEventCallback((ev: React.KeyboardEvent<HTMLButtonElement>) => {\n props?.onKeyDown?.(ev);\n if (!ev.defaultPrevented && (ev.key === Delete || ev.key === Backspace)) {\n handleTagDismiss?.(ev, { value });\n }\n });\n\n const elementType = dismissible ? 'button' : 'span';\n const selectedProp = tagGroupRole === 'listbox' ? 'aria-selected' : 'aria-pressed';\n const selectable = typeof selected === 'boolean' || tagGroupRole === 'listbox';\n\n return {\n appearance,\n avatarShape: tagAvatarShapeMap[shape],\n avatarSize: tagAvatarSizeMap[size],\n disabled: contextDisabled ? true : disabled,\n dismissible,\n selected: !!selected,\n shape,\n size,\n\n components: {\n root: elementType,\n media: 'span',\n icon: 'span',\n primaryText: 'span',\n secondaryText: 'span',\n dismissIcon: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n role: tagGroupRole === 'listbox' ? 'option' : undefined,\n [selectedProp]: selectable ? selected : undefined,\n ...props,\n disabled: contextDisabled ? true : disabled,\n id,\n ...(dismissible && { onClick: dismissOnClick, onKeyDown: dismissOnKeyDown }),\n }),\n {\n defaultProps: {\n type: elementType === 'button' ? 'button' : undefined,\n },\n elementType,\n },\n ),\n\n media: slot.optional(props.media, { elementType: 'span' }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n primaryText: slot.optional(props.primaryText, {\n renderByDefault: true,\n defaultProps: {\n children: props.children,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, { elementType: 'span' }),\n dismissIcon: slot.optional(props.dismissIcon, {\n renderByDefault: dismissible,\n defaultProps: {\n children: <DismissRegular />,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useEventCallback","useId","slot","DismissRegular","Delete","Backspace","useTagGroupContext_unstable","tagAvatarSizeMap","medium","small","tagAvatarShapeMap","rounded","circular","useTag_unstable","props","ref","handleTagDismiss","size","contextSize","disabled","contextDisabled","appearance","contextAppearance","dismissible","contextDismissible","role","tagGroupRole","id","selected","shape","value","dismissOnClick","ev","onClick","defaultPrevented","dismissOnKeyDown","onKeyDown","key","elementType","selectedProp","selectable","avatarShape","avatarSize","components","root","media","icon","primaryText","secondaryText","dismissIcon","always","undefined","defaultProps","type","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7C,oBAAAA,CAAKoD,QAAQ,CAACxC,MAAMiC,WAAW,EAAE;YAC5CQ,iBAAiB;YACjBH,cAAc;gBACZI,UAAU1C,MAAM0C,QAAQ;YAC1B;YACAlB,aAAa;QACf;QACAU,eAAe9C,oBAAAA,CAAKoD,QAAQ,CAACxC,MAAMkC,aAAa,EAAE;YAAEV,aAAa;QAAO;QACxEW,aAAa/C,oBAAAA,CAAKoD,QAAQ,CAACxC,MAAMmC,WAAW,EAAE;YAC5CM,iBAAiBhC;YACjB6B,cAAc;gBACZI,UAAAA,WAAAA,GAAU,OAAA,aAAA,CAACrD,0BAAAA,EAAAA;YACb;YACAmC,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagGroup/renderTagGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TagGroupState, TagGroupSlots, TagGroupContextValues } from './TagGroup.types';\nimport { TagGroupContextProvider } from '../../contexts/tagGroupContext';\n\n/**\n * Render the final JSX of TagGroup\n */\nexport const renderTagGroup_unstable = (state: TagGroupState, contextValue: TagGroupContextValues) => {\n assertSlots<TagGroupSlots>(state);\n\n return (\n <TagGroupContextProvider value={contextValue.tagGroup}>\n <state.root />\n </TagGroupContextProvider>\n );\n};\n"],"names":["assertSlots","TagGroupContextProvider","renderTagGroup_unstable","state","contextValue","value","tagGroup","root"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["../src/components/TagGroup/renderTagGroup.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport type { TagGroupState, TagGroupSlots, TagGroupContextValues } from './TagGroup.types';\nimport { TagGroupContextProvider } from '../../contexts/tagGroupContext';\n\n/**\n * Render the final JSX of TagGroup\n */\nexport const renderTagGroup_unstable = (state: TagGroupState, contextValue: TagGroupContextValues): JSXElement => {\n assertSlots<TagGroupSlots>(state);\n\n return (\n <TagGroupContextProvider value={contextValue.tagGroup}>\n <state.root />\n </TagGroupContextProvider>\n );\n};\n"],"names":["assertSlots","TagGroupContextProvider","renderTagGroup_unstable","state","contextValue","value","tagGroup","root"],"mappings":";;;;+BAWaE;;;;;;4BAVb,gDAAiD;gCAErB,4BAA4B;iCAGhB,iCAAiC;AAKlE,gCAAgC,CAACC,OAAsBC;QAC5DJ,2BAAAA,EAA2BG;IAE3B,OAAA,WAAA,OACE,eAAA,EAACF,wCAAAA,EAAAA;QAAwBI,OAAOD,aAAaE,QAAQ;kBACnD,WAAA,OAAA,eAAA,EAACH,MAAMI,IAAI,EAAA,CAAA;;AAGjB,EAAE"}
|
|
@@ -16,7 +16,7 @@ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
|
|
16
16
|
const _useInteractionTagSecondaryStylesstyles = require("../InteractionTagSecondary/useInteractionTagSecondaryStyles.styles");
|
|
17
17
|
const useTagGroup_unstable = (props, ref)=>{
|
|
18
18
|
const { onDismiss, disabled = false, defaultSelectedValues, size = 'medium', appearance = 'filled', dismissible = false, role = 'toolbar', onTagSelect, selectedValues, ...rest } = props;
|
|
19
|
-
const innerRef = _react.useRef();
|
|
19
|
+
const innerRef = _react.useRef(undefined);
|
|
20
20
|
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
|
21
21
|
const { findNextFocusable, findPrevFocusable } = (0, _reacttabster.useFocusFinders)();
|
|
22
22
|
const [items, setItems] = (0, _reactutilities.useControllableState)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/TagGroup/useTagGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useControllableState,\n useEventCallback,\n mergeCallbacks,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TagGroupProps, TagGroupState } from './TagGroup.types';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/useInteractionTagSecondaryStyles.styles';\nimport type { TagValue } from '../../utils/types';\n\n/**\n * Create the state required to render TagGroup.\n *\n * The returned state can be modified with hooks such as useTagGroupStyles_unstable,\n * before being passed to renderTagGroup_unstable.\n *\n * @param props - props from this instance of TagGroup\n * @param ref - reference to root HTMLDivElement of TagGroup\n */\nexport const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref<HTMLDivElement>): TagGroupState => {\n const {\n onDismiss,\n disabled = false,\n defaultSelectedValues,\n size = 'medium',\n appearance = 'filled',\n dismissible = false,\n role = 'toolbar',\n onTagSelect,\n selectedValues,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>();\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const [items, setItems] = useControllableState<Array<TagValue>>({\n defaultState: defaultSelectedValues,\n state: selectedValues,\n initialState: [],\n });\n\n const handleTagDismiss: TagGroupState['handleTagDismiss'] = useEventCallback((e, data) => {\n onDismiss?.(e, data);\n\n // set focus after tag dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next tag only if the active element is within the current tag group\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n if (next) {\n next.focus();\n return;\n }\n\n // if there is no next focusable, focus on the previous focusable\n if (activeElement?.className.includes(interactionTagSecondaryClassNames.root)) {\n const prev = findPrevFocusable(activeElement.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n } else {\n const prev = findPrevFocusable(activeElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n }\n });\n\n const handleTagSelect: TagGroupState['handleTagSelect'] = useEventCallback(\n mergeCallbacks(onTagSelect, (_, data) => {\n if (items.includes(data.value)) {\n setItems(items.filter(item => item !== data.value));\n } else {\n setItems([...items, data.value]);\n }\n }),\n );\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n return {\n handleTagDismiss,\n handleTagSelect: onTagSelect ? handleTagSelect : undefined,\n selectedValues: items,\n role,\n size,\n disabled,\n appearance,\n dismissible,\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role,\n 'aria-disabled': disabled,\n ...arrowNavigationProps,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useControllableState","useEventCallback","mergeCallbacks","useMergedRefs","slot","useArrowNavigationGroup","useFocusFinders","useFluent_unstable","useFluent","interactionTagSecondaryClassNames","useTagGroup_unstable","props","ref","onDismiss","disabled","defaultSelectedValues","size","appearance","dismissible","role","onTagSelect","selectedValues","rest","innerRef","useRef","targetDocument","findNextFocusable","findPrevFocusable","items","setItems","defaultState","state","initialState","handleTagDismiss","e","data","activeElement","current","contains","next","container","focus","className","includes","root","prev","parentElement","handleTagSelect","_","value","filter","item","arrowNavigationProps","circular","axis","memorizeCurrent","
|
|
1
|
+
{"version":3,"sources":["../src/components/TagGroup/useTagGroup.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n useControllableState,\n useEventCallback,\n mergeCallbacks,\n useMergedRefs,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TagGroupProps, TagGroupState } from './TagGroup.types';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { interactionTagSecondaryClassNames } from '../InteractionTagSecondary/useInteractionTagSecondaryStyles.styles';\nimport type { TagValue } from '../../utils/types';\n\n/**\n * Create the state required to render TagGroup.\n *\n * The returned state can be modified with hooks such as useTagGroupStyles_unstable,\n * before being passed to renderTagGroup_unstable.\n *\n * @param props - props from this instance of TagGroup\n * @param ref - reference to root HTMLDivElement of TagGroup\n */\nexport const useTagGroup_unstable = (props: TagGroupProps, ref: React.Ref<HTMLDivElement>): TagGroupState => {\n const {\n onDismiss,\n disabled = false,\n defaultSelectedValues,\n size = 'medium',\n appearance = 'filled',\n dismissible = false,\n role = 'toolbar',\n onTagSelect,\n selectedValues,\n ...rest\n } = props;\n\n const innerRef = React.useRef<HTMLElement>(undefined);\n const { targetDocument } = useFluent();\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const [items, setItems] = useControllableState<Array<TagValue>>({\n defaultState: defaultSelectedValues,\n state: selectedValues,\n initialState: [],\n });\n\n const handleTagDismiss: TagGroupState['handleTagDismiss'] = useEventCallback((e, data) => {\n onDismiss?.(e, data);\n\n // set focus after tag dismiss\n const activeElement = targetDocument?.activeElement;\n if (innerRef.current?.contains(activeElement as HTMLElement)) {\n // focus on next tag only if the active element is within the current tag group\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n if (next) {\n next.focus();\n return;\n }\n\n // if there is no next focusable, focus on the previous focusable\n if (activeElement?.className.includes(interactionTagSecondaryClassNames.root)) {\n const prev = findPrevFocusable(activeElement.parentElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n } else {\n const prev = findPrevFocusable(activeElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n }\n });\n\n const handleTagSelect: TagGroupState['handleTagSelect'] = useEventCallback(\n mergeCallbacks(onTagSelect, (_, data) => {\n if (items.includes(data.value)) {\n setItems(items.filter(item => item !== data.value));\n } else {\n setItems([...items, data.value]);\n }\n }),\n );\n\n const arrowNavigationProps = useArrowNavigationGroup({\n circular: true,\n axis: 'both',\n memorizeCurrent: true,\n });\n\n return {\n handleTagDismiss,\n handleTagSelect: onTagSelect ? handleTagSelect : undefined,\n selectedValues: items,\n role,\n size,\n disabled,\n appearance,\n dismissible,\n components: {\n root: 'div',\n },\n\n root: slot.always(\n getIntrinsicElementProps('div', {\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: useMergedRefs(ref, innerRef) as React.Ref<HTMLDivElement>,\n role,\n 'aria-disabled': disabled,\n ...arrowNavigationProps,\n ...rest,\n }),\n { elementType: 'div' },\n ),\n };\n};\n"],"names":["React","getIntrinsicElementProps","useControllableState","useEventCallback","mergeCallbacks","useMergedRefs","slot","useArrowNavigationGroup","useFocusFinders","useFluent_unstable","useFluent","interactionTagSecondaryClassNames","useTagGroup_unstable","props","ref","onDismiss","disabled","defaultSelectedValues","size","appearance","dismissible","role","onTagSelect","selectedValues","rest","innerRef","useRef","undefined","targetDocument","findNextFocusable","findPrevFocusable","items","setItems","defaultState","state","initialState","handleTagDismiss","e","data","activeElement","current","contains","next","container","focus","className","includes","root","prev","parentElement","handleTagSelect","_","value","filter","item","arrowNavigationProps","circular","axis","memorizeCurrent","components","always","elementType"],"mappings":";;;;+BAwBaY;;;;;;;iEAxBU,QAAQ;gCAQxB,4BAA4B;8BAEsB,0BAA0B;qCACnC,kCAAkC;wDAChC,qEAAqE;AAYhH,6BAA6B,CAACC,OAAsBC;IACzD,MAAM,EACJC,SAAS,EACTC,WAAW,KAAK,EAChBC,qBAAqB,EACrBC,OAAO,QAAQ,EACfC,aAAa,QAAQ,EACrBC,cAAc,KAAK,EACnBC,OAAO,SAAS,EAChBC,WAAW,EACXC,cAAc,EACd,GAAGC,MACJ,GAAGX;IAEJ,MAAMY,WAAWzB,OAAM0B,MAAM,CAAcC;IAC3C,MAAM,EAAEC,cAAc,EAAE,OAAGlB,uCAAAA;IAC3B,MAAM,EAAEmB,iBAAiB,EAAEC,iBAAiB,EAAE,OAAGtB,6BAAAA;IAEjD,MAAM,CAACuB,O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AASD,MAAMsB,MAAM,CAACC,CAAAA,OAAQA,SAAShB,KAAKc,KAAK;QACnD,OAAO;YACLpB,SAAS;mBAAID;gBAAOO,KAAKc,KAAK;aAAC;QACjC;IACF;IAGF,MAAMG,2BAAuBhD,qCAAAA,EAAwB;QACnDiD,UAAU;QACVC,MAAM;QACNC,iBAAiB;IACnB;IAEA,OAAO;QACLtB;QACAc,iBAAiB5B,cAAc4B,kBAAkBvB;QACjDJ,gBAAgBQ;QAChBV;QACAH;QACAF;QACAG;QACAC;QACAuC,YAAY;YACVZ,MAAM;QACR;QAEAA,MAAMzC,oBAAAA,CAAKsD,MAAM,KACf3D,wCAAAA,EAAyB,OAAO;YAC9B,SAAS;YACT,4EAA4E;YAC5E,4FAA4F;YAC5Fa,SAAKT,6BAAAA,EAAcS,KAAKW;YACxBJ;YACA,iBAAiBL;YACjB,GAAGuC,oBAAoB;YACvB,GAAG/B,IAAI;QACT,IACA;YAAEqC,aAAa;QAAM;IAEzB;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/interactionTagContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { InteractionTagState } from '../components/InteractionTag/index';\nimport type { TagDismissHandler, TagSelectHandler } from '../utils/types';\n\nexport const InteractionTagContext = React.createContext<InteractionTagContextValue | undefined>(undefined);\n\nconst interactionTagContextDefaultValue: InteractionTagContextValue = {\n appearance: 'filled',\n disabled: false,\n handleTagDismiss: () => ({}),\n handleTagSelect: () => ({}),\n interactionTagPrimaryId: '',\n selected: false,\n selectedValues: [],\n shape: 'rounded',\n size: 'medium',\n value: '',\n};\n\n/**\n * Context shared between InteractionTag and its children components\n */\nexport type InteractionTagContextValue<Value = string> = Required<\n Pick<InteractionTagState, 'appearance' | 'disabled' | 'selected' | 'selectedValues' | 'shape' | 'size'> & {\n handleTagDismiss: TagDismissHandler<Value>;\n interactionTagPrimaryId: string;\n value?: Value;\n }\n> & {\n handleTagSelect?: TagSelectHandler<Value>;\n};\n\nexport const InteractionTagContextProvider = InteractionTagContext.Provider;\n\nexport const useInteractionTagContext_unstable = () =>\n React.useContext(InteractionTagContext) ?? interactionTagContextDefaultValue;\n"],"names":["React","InteractionTagContext","createContext","undefined","interactionTagContextDefaultValue","appearance","disabled","handleTagDismiss","handleTagSelect","interactionTagPrimaryId","selected","selectedValues","shape","size","value","InteractionTagContextProvider","Provider","useInteractionTagContext_unstable","useContext"],"mappings":";;;;;;;;;;;yBAIaC;;;iCA4BAc;;;qCAEAE;;;;;iEAlCU,QAAQ;AAIxB,MAAMhB,wBAAAA,WAAAA,GAAwBD,OAAME,aAAa,CAAyCC,WAAW;AAE5G,MAAMC,oCAAgE;IACpEC,YAAY;IACZC,UAAU;IACVC,kBAAkB,IAAO,GAAC,CAAA;IAC1BC,iBAAiB,IAAO,CAAA,EAAC,CAAA;IACzBC,yBAAyB;IACzBC,UAAU;IACVC,gBAAgB,EAAE;IAClBC,OAAO;IACPC,MAAM;IACNC,OAAO;AACT;AAeO,MAAMC,gCAAgCd,sBAAsBe,QAAQ,CAAC;AAErE,MAAMC,oCAAoC;QAC/CjB;WAAAA,CAAAA,oBAAAA,OAAMkB,UAAU,CAACjB,sBAAAA,MAAAA,QAAjBD,sBAAAA,KAAAA,IAAAA,oBAA2CI;EAAkC"}
|
|
1
|
+
{"version":3,"sources":["../src/contexts/interactionTagContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { InteractionTagState } from '../components/InteractionTag/index';\nimport type { TagDismissHandler, TagSelectHandler } from '../utils/types';\n\nexport const InteractionTagContext = React.createContext<InteractionTagContextValue | undefined>(undefined);\n\nconst interactionTagContextDefaultValue: InteractionTagContextValue = {\n appearance: 'filled',\n disabled: false,\n handleTagDismiss: () => ({}),\n handleTagSelect: () => ({}),\n interactionTagPrimaryId: '',\n selected: false,\n selectedValues: [],\n shape: 'rounded',\n size: 'medium',\n value: '',\n};\n\n/**\n * Context shared between InteractionTag and its children components\n */\nexport type InteractionTagContextValue<Value = string> = Required<\n Pick<InteractionTagState, 'appearance' | 'disabled' | 'selected' | 'selectedValues' | 'shape' | 'size'> & {\n handleTagDismiss: TagDismissHandler<Value>;\n interactionTagPrimaryId: string;\n value?: Value;\n }\n> & {\n handleTagSelect?: TagSelectHandler<Value>;\n};\n\nexport const InteractionTagContextProvider = InteractionTagContext.Provider;\n\nexport const useInteractionTagContext_unstable = (): InteractionTagContextValue =>\n React.useContext(InteractionTagContext) ?? interactionTagContextDefaultValue;\n"],"names":["React","InteractionTagContext","createContext","undefined","interactionTagContextDefaultValue","appearance","disabled","handleTagDismiss","handleTagSelect","interactionTagPrimaryId","selected","selectedValues","shape","size","value","InteractionTagContextProvider","Provider","useInteractionTagContext_unstable","useContext"],"mappings":";;;;;;;;;;;yBAIaC;;;iCA4BAc;;;qCAEAE;;;;;iEAlCU,QAAQ;AAIxB,MAAMhB,wBAAAA,WAAAA,GAAwBD,OAAME,aAAa,CAAyCC,WAAW;AAE5G,MAAMC,oCAAgE;IACpEC,YAAY;IACZC,UAAU;IACVC,kBAAkB,IAAO,GAAC,CAAA;IAC1BC,iBAAiB,IAAO,CAAA,EAAC,CAAA;IACzBC,yBAAyB;IACzBC,UAAU;IACVC,gBAAgB,EAAE;IAClBC,OAAO;IACPC,MAAM;IACNC,OAAO;AACT;AAeO,MAAMC,gCAAgCd,sBAAsBe,QAAQ,CAAC;AAErE,MAAMC,oCAAoC;QAC/CjB;WAAAA,CAAAA,oBAAAA,OAAMkB,UAAU,CAACjB,sBAAAA,MAAAA,QAAjBD,sBAAAA,KAAAA,IAAAA,oBAA2CI;EAAkC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/contexts/tagGroupContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TagGroupState } from '../components/TagGroup/index';\n\nexport const TagGroupContext = React.createContext<TagGroupContextValue | undefined>(undefined);\n\nconst tagGroupContextDefaultValue: TagGroupContextValue = {\n handleTagDismiss: () => ({}),\n size: 'medium',\n role: 'toolbar',\n handleTagSelect: undefined,\n};\n\n/**\n * Context shared between TagGroup and its children components\n */\nexport type TagGroupContextValue = Required<Pick<TagGroupState, 'handleTagDismiss' | 'size'>> &\n Partial<\n Pick<TagGroupState, 'disabled' | 'appearance' | 'dismissible' | 'handleTagSelect' | 'role' | 'selectedValues'>\n >;\n\nexport const TagGroupContextProvider = TagGroupContext.Provider;\n\nexport const useTagGroupContext_unstable = ()
|
|
1
|
+
{"version":3,"sources":["../src/contexts/tagGroupContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { TagGroupState } from '../components/TagGroup/index';\n\nexport const TagGroupContext = React.createContext<TagGroupContextValue | undefined>(undefined);\n\nconst tagGroupContextDefaultValue: TagGroupContextValue = {\n handleTagDismiss: () => ({}),\n size: 'medium',\n role: 'toolbar',\n handleTagSelect: undefined,\n};\n\n/**\n * Context shared between TagGroup and its children components\n */\nexport type TagGroupContextValue = Required<Pick<TagGroupState, 'handleTagDismiss' | 'size'>> &\n Partial<\n Pick<TagGroupState, 'disabled' | 'appearance' | 'dismissible' | 'handleTagSelect' | 'role' | 'selectedValues'>\n >;\n\nexport const TagGroupContextProvider = TagGroupContext.Provider;\n\nexport const useTagGroupContext_unstable = (): TagGroupContextValue =>\n React.useContext(TagGroupContext) ?? tagGroupContextDefaultValue;\n"],"names":["React","TagGroupContext","createContext","undefined","tagGroupContextDefaultValue","handleTagDismiss","size","role","handleTagSelect","TagGroupContextProvider","Provider","useTagGroupContext_unstable","useContext"],"mappings":";;;;;;;;;;;IAGaC,eAAAA;;;2BAiBAQ;;;+BAEAE;;;;;iEAtBU,QAAQ;AAGxB,wBAAMV,WAAAA,GAAkBD,OAAME,aAAa,CAAmCC,WAAW;AAEhG,MAAMC,8BAAoD;IACxDC,kBAAkB,IAAO,CAAA,EAAC,CAAA;IAC1BC,MAAM;IACNC,MAAM;IACNC,iBAAiBL;AACnB;AAUO,MAAMM,0BAA0BR,gBAAgBS,QAAQ,CAAC;AAEzD,MAAMC,8BAA8B;QACzCX;WAAAA,CAAAA,oBAAAA,OAAMY,UAAU,CAACX,gBAAAA,MAAAA,QAAjBD,sBAAAA,KAAAA,IAAAA,oBAAqCI;EAA4B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tags",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.6",
|
|
4
4
|
"description": "Fluent UI Tag component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -21,22 +21,22 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@fluentui/keyboard-keys": "^9.0.8",
|
|
24
|
-
"@fluentui/react-aria": "^9.
|
|
25
|
-
"@fluentui/react-avatar": "^9.9.
|
|
24
|
+
"@fluentui/react-aria": "^9.17.0",
|
|
25
|
+
"@fluentui/react-avatar": "^9.9.6",
|
|
26
26
|
"@fluentui/react-icons": "^2.0.245",
|
|
27
|
-
"@fluentui/react-jsx-runtime": "^9.
|
|
28
|
-
"@fluentui/react-shared-contexts": "^9.25.
|
|
29
|
-
"@fluentui/react-tabster": "^9.26.
|
|
27
|
+
"@fluentui/react-jsx-runtime": "^9.2.0",
|
|
28
|
+
"@fluentui/react-shared-contexts": "^9.25.1",
|
|
29
|
+
"@fluentui/react-tabster": "^9.26.5",
|
|
30
30
|
"@fluentui/react-theme": "^9.2.0",
|
|
31
|
-
"@fluentui/react-utilities": "^9.24.
|
|
31
|
+
"@fluentui/react-utilities": "^9.24.1",
|
|
32
32
|
"@griffel/react": "^1.5.22",
|
|
33
33
|
"@swc/helpers": "^0.5.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@types/react": ">=16.14.0 <
|
|
37
|
-
"@types/react-dom": ">=16.9.0 <
|
|
38
|
-
"react": ">=16.14.0 <
|
|
39
|
-
"react-dom": ">=16.14.0 <
|
|
36
|
+
"@types/react": ">=16.14.0 <20.0.0",
|
|
37
|
+
"@types/react-dom": ">=16.9.0 <20.0.0",
|
|
38
|
+
"react": ">=16.14.0 <20.0.0",
|
|
39
|
+
"react-dom": ">=16.14.0 <20.0.0"
|
|
40
40
|
},
|
|
41
41
|
"beachball": {
|
|
42
42
|
"disallowedChangeTypes": [
|