@fluentui/react-infolabel 9.0.23 → 9.0.25
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 +32 -2
- package/lib/components/InfoButton/InfoButton.types.js +3 -1
- package/lib/components/InfoButton/InfoButton.types.js.map +1 -1
- package/lib/components/InfoButton/useInfoButton.js +13 -15
- package/lib/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib/components/InfoLabel/InfoLabel.types.js +3 -1
- package/lib/components/InfoLabel/InfoLabel.types.js.map +1 -1
- package/lib/components/InfoLabel/useInfoLabel.js +3 -1
- package/lib/components/InfoLabel/useInfoLabel.js.map +1 -1
- package/lib-commonjs/components/InfoButton/InfoButton.types.js +3 -1
- package/lib-commonjs/components/InfoButton/InfoButton.types.js.map +1 -1
- package/lib-commonjs/components/InfoButton/useInfoButton.js +12 -14
- package/lib-commonjs/components/InfoButton/useInfoButton.js.map +1 -1
- package/lib-commonjs/components/InfoLabel/InfoLabel.types.js +3 -1
- package/lib-commonjs/components/InfoLabel/InfoLabel.types.js.map +1 -1
- package/lib-commonjs/components/InfoLabel/useInfoLabel.js +3 -1
- package/lib-commonjs/components/InfoLabel/useInfoLabel.js.map +1 -1
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,42 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-infolabel
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Fri, 15 Mar 2024 21:37:57 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.25](https://github.com/microsoft/fluentui/tree/@fluentui/react-infolabel_v9.0.25)
|
|
8
|
+
|
|
9
|
+
Fri, 15 Mar 2024 21:37:57 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-infolabel_v9.0.24..@fluentui/react-infolabel_v9.0.25)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: add aria-labelledby to infolabel note ([PR #30761](https://github.com/microsoft/fluentui/pull/30761) by sarah.higley@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-label to v9.1.65 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
16
|
+
- Bump @fluentui/react-popover to v9.9.1 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
17
|
+
- Bump @fluentui/react-tabster to v9.19.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
18
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.33 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
19
|
+
- Bump @fluentui/react-theme to v9.1.18 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
20
|
+
- Bump @fluentui/react-utilities to v9.18.4 ([PR #30740](https://github.com/microsoft/fluentui/pull/30740) by beachball)
|
|
21
|
+
|
|
22
|
+
## [9.0.24](https://github.com/microsoft/fluentui/tree/@fluentui/react-infolabel_v9.0.24)
|
|
23
|
+
|
|
24
|
+
Thu, 07 Mar 2024 19:33:22 GMT
|
|
25
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-infolabel_v9.0.23..@fluentui/react-infolabel_v9.0.24)
|
|
26
|
+
|
|
27
|
+
### Patches
|
|
28
|
+
|
|
29
|
+
- fix: InfoLabel popover dismisses if the InfoButton is clicked when it is already open ([PR #30731](https://github.com/microsoft/fluentui/pull/30731) by behowell@microsoft.com)
|
|
30
|
+
- Bump @fluentui/react-label to v9.1.64 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
31
|
+
- Bump @fluentui/react-popover to v9.9.0 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
32
|
+
- Bump @fluentui/react-tabster to v9.19.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
33
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.32 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
34
|
+
- Bump @fluentui/react-theme to v9.1.17 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
35
|
+
- Bump @fluentui/react-utilities to v9.18.3 ([PR #30687](https://github.com/microsoft/fluentui/pull/30687) by beachball)
|
|
36
|
+
|
|
7
37
|
## [9.0.23](https://github.com/microsoft/fluentui/tree/@fluentui/react-infolabel_v9.0.23)
|
|
8
38
|
|
|
9
|
-
Wed, 28 Feb 2024 02:
|
|
39
|
+
Wed, 28 Feb 2024 02:34:19 GMT
|
|
10
40
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-infolabel_v9.0.22..@fluentui/react-infolabel_v9.0.23)
|
|
11
41
|
|
|
12
42
|
### Patches
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["InfoButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';\n\nexport type InfoButtonSlots = {\n root: NonNullable<Slot<'button'>>;\n\n /**\n * The Popover element that wraps the info and root slots. Use this slot to pass props to the Popover.\n */\n popover: NonNullable<Slot<Partial<Omit<PopoverProps, 'openOnHover'>>>>;\n\n /**\n * The information to be displayed in the PopoverSurface when the button is pressed.\n */\n info: NonNullable<Slot<typeof PopoverSurface>>;\n};\n\n/**\n * InfoButton Props\n */\nexport type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'disabled'> & {\n /**\n * Size of the InfoButton.\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Whether the InfoButton should be rendered inline or on a Portal.\n *\n * @default true\n */\n inline?: boolean;\n};\n\n/**\n * State used in rendering InfoButton\n */\nexport type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["InfoButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';\n\nexport type InfoButtonSlots = {\n root: NonNullable<Slot<'button'>>;\n\n /**\n * The Popover element that wraps the info and root slots. Use this slot to pass props to the Popover.\n */\n popover: NonNullable<Slot<Partial<Omit<PopoverProps, 'openOnHover'>>>>;\n\n /**\n * The information to be displayed in the PopoverSurface when the button is pressed.\n */\n info: NonNullable<Slot<typeof PopoverSurface>>;\n};\n\n/**\n * InfoButton Props\n */\nexport type InfoButtonProps = Omit<ComponentProps<Partial<InfoButtonSlots>>, 'disabled'> & {\n /**\n * Size of the InfoButton.\n *\n * @default medium\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Whether the InfoButton should be rendered inline or on a Portal.\n *\n * @default true\n */\n inline?: boolean;\n};\n\n/**\n * State used in rendering InfoButton\n */\nexport type InfoButtonState = ComponentState<InfoButtonSlots> & Required<Pick<InfoButtonProps, 'inline' | 'size'>>;\n"],"names":[],"mappings":"AAoCA;;CAEC,GACD,WAAmH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';
|
|
3
|
-
import { getIntrinsicElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs,
|
|
3
|
+
import { getIntrinsicElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs, elementContains, useEventCallback } from '@fluentui/react-utilities';
|
|
4
4
|
import { Popover, PopoverSurface } from '@fluentui/react-popover';
|
|
5
5
|
const infoButtonIconMap = {
|
|
6
6
|
small: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon12, null),
|
|
@@ -22,6 +22,7 @@ const popoverSizeMap = {
|
|
|
22
22
|
* @param ref - reference to root HTMLButtonElement of InfoButton
|
|
23
23
|
*/ export const useInfoButton_unstable = (props, ref)=>{
|
|
24
24
|
const { size = 'medium', inline = true } = props;
|
|
25
|
+
const rootRef = useMergedRefs(ref);
|
|
25
26
|
const state = {
|
|
26
27
|
inline,
|
|
27
28
|
size,
|
|
@@ -35,7 +36,7 @@ const popoverSizeMap = {
|
|
|
35
36
|
type: 'button',
|
|
36
37
|
'aria-label': 'information',
|
|
37
38
|
...props,
|
|
38
|
-
ref
|
|
39
|
+
ref: rootRef
|
|
39
40
|
}), {
|
|
40
41
|
elementType: 'button'
|
|
41
42
|
}),
|
|
@@ -63,19 +64,16 @@ const popoverSizeMap = {
|
|
|
63
64
|
});
|
|
64
65
|
state.popover.open = popoverOpen;
|
|
65
66
|
state.popover.onOpenChange = mergeCallbacks(state.popover.onOpenChange, (e, data)=>setPopoverOpen(data.open));
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
const infoRef = useMergedRefs(state.info.ref);
|
|
68
|
+
state.info.ref = infoRef;
|
|
69
|
+
// Hide the popover when focus moves out of the button and popover
|
|
70
|
+
const onBlurButtonOrInfo = (e)=>{
|
|
71
|
+
const nextFocused = e.relatedTarget;
|
|
72
|
+
if (rootRef.current !== nextFocused && !elementContains(infoRef.current, nextFocused)) {
|
|
73
|
+
setPopoverOpen(false);
|
|
69
74
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
setPopoverOpen(false);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}, [
|
|
77
|
-
setPopoverOpen
|
|
78
|
-
]);
|
|
79
|
-
state.info.ref = useMergedRefs(state.info.ref, focusOutRef);
|
|
75
|
+
};
|
|
76
|
+
state.root.onBlur = useEventCallback(mergeCallbacks(state.root.onBlur, onBlurButtonOrInfo));
|
|
77
|
+
state.info.onBlurCapture = useEventCallback(mergeCallbacks(state.info.onBlurCapture, onBlurButtonOrInfo));
|
|
80
78
|
return state;
|
|
81
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useInfoButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n useControllableState,\n slot,\n useMergedRefs,\n
|
|
1
|
+
{"version":3,"sources":["useInfoButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n useControllableState,\n slot,\n useMergedRefs,\n elementContains,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nimport type { InfoButtonProps, InfoButtonState } from './InfoButton.types';\nimport type { PopoverProps } from '@fluentui/react-popover';\n\nconst infoButtonIconMap = {\n small: <DefaultInfoButtonIcon12 />,\n medium: <DefaultInfoButtonIcon16 />,\n large: <DefaultInfoButtonIcon20 />,\n} as const;\n\nconst popoverSizeMap = {\n small: 'small',\n medium: 'small',\n large: 'medium',\n} as const;\n\n/**\n * Create the state required to render InfoButton.\n *\n * The returned state can be modified with hooks such as useInfoButtonStyles_unstable,\n * before being passed to renderInfoButton_unstable.\n *\n * @param props - props from this instance of InfoButton\n * @param ref - reference to root HTMLButtonElement of InfoButton\n */\nexport const useInfoButton_unstable = (props: InfoButtonProps, ref: React.Ref<HTMLButtonElement>): InfoButtonState => {\n const { size = 'medium', inline = true } = props;\n\n const rootRef = useMergedRefs(ref);\n\n const state: InfoButtonState = {\n inline,\n size,\n\n components: {\n root: 'button',\n popover: Popover as React.FC<Partial<PopoverProps>>,\n info: PopoverSurface,\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n children: infoButtonIconMap[size],\n type: 'button',\n 'aria-label': 'information',\n ...props,\n ref: rootRef,\n }),\n { elementType: 'button' },\n ),\n popover: slot.always(props.popover, {\n defaultProps: {\n inline,\n positioning: 'above-start',\n size: popoverSizeMap[size],\n withArrow: true,\n },\n elementType: Popover as React.FC<Partial<Omit<PopoverProps, 'openOnHover'>>>,\n }),\n info: slot.always(props.info, {\n defaultProps: {\n role: 'note',\n tabIndex: -1,\n },\n elementType: PopoverSurface,\n }),\n };\n\n const [popoverOpen, setPopoverOpen] = useControllableState({\n state: state.popover.open,\n defaultState: state.popover.defaultOpen,\n initialState: false,\n });\n\n state.popover.open = popoverOpen;\n state.popover.onOpenChange = mergeCallbacks(state.popover.onOpenChange, (e, data) => setPopoverOpen(data.open));\n\n const infoRef = useMergedRefs(state.info.ref);\n state.info.ref = infoRef;\n\n // Hide the popover when focus moves out of the button and popover\n const onBlurButtonOrInfo = (e: React.FocusEvent) => {\n const nextFocused = e.relatedTarget;\n if (rootRef.current !== nextFocused && !elementContains(infoRef.current, nextFocused)) {\n setPopoverOpen(false);\n }\n };\n\n state.root.onBlur = useEventCallback(mergeCallbacks(state.root.onBlur, onBlurButtonOrInfo));\n state.info.onBlurCapture = useEventCallback(mergeCallbacks(state.info.onBlurCapture, onBlurButtonOrInfo));\n\n return state;\n};\n"],"names":["React","DefaultInfoButtonIcon12","DefaultInfoButtonIcon16","DefaultInfoButtonIcon20","getIntrinsicElementProps","mergeCallbacks","useControllableState","slot","useMergedRefs","elementContains","useEventCallback","Popover","PopoverSurface","infoButtonIconMap","small","medium","large","popoverSizeMap","useInfoButton_unstable","props","ref","size","inline","rootRef","state","components","root","popover","info","always","children","type","elementType","defaultProps","positioning","withArrow","role","tabIndex","popoverOpen","setPopoverOpen","open","defaultState","defaultOpen","initialState","onOpenChange","e","data","infoRef","onBlurButtonOrInfo","nextFocused","relatedTarget","current","onBlur","onBlurCapture"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,EAAEC,uBAAuB,EAAEC,uBAAuB,QAAQ,2BAA2B;AACrH,SACEC,wB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,CAACiB,YAAY,GAAGvC,eAAemB,MAAMG,OAAO,CAACiB,YAAY,EAAE,CAACC,GAAGC,OAASP,eAAeO,KAAKN,IAAI;IAE7G,MAAMO,UAAUvC,cAAcgB,MAAMI,IAAI,CAACR,GAAG;IAC5CI,MAAMI,IAAI,CAACR,GAAG,GAAG2B;IAEjB,kEAAkE;IAClE,MAAMC,qBAAqB,CAACH;QAC1B,MAAMI,cAAcJ,EAAEK,aAAa;QACnC,IAAI3B,QAAQ4B,OAAO,KAAKF,eAAe,CAACxC,gBAAgBsC,QAAQI,OAAO,EAAEF,cAAc;YACrFV,eAAe;QACjB;IACF;IAEAf,MAAME,IAAI,CAAC0B,MAAM,GAAG1C,iBAAiBL,eAAemB,MAAME,IAAI,CAAC0B,MAAM,EAAEJ;IACvExB,MAAMI,IAAI,CAACyB,aAAa,GAAG3C,iBAAiBL,eAAemB,MAAMI,IAAI,CAACyB,aAAa,EAAEL;IAErF,OAAOxB;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["InfoLabel.types.ts"],"sourcesContent":["import { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton';\nimport type { InfoButtonProps } from '../InfoButton';\n\nexport type InfoLabelSlots = {\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Label component.\n *\n * It is not typically necessary to use this prop. The label text is the child of the `<InfoLabel>`, and other props\n * such as `size` and `required` should be set directly on the `InfoLabel`.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<InfoLabel>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n label: NonNullable<Slot<typeof Label>>;\n\n /**\n * The InfoButton component.\n *\n * It is not typically necessary to use this prop. The content can be set using the `info` prop of the InfoLabel.\n */\n infoButton: Slot<typeof InfoButton>;\n};\n\n/**\n * InfoLabel Props\n */\nexport type InfoLabelProps = ComponentProps<Partial<InfoLabelSlots>, 'label'> & {\n /**\n * The content of the InfoButton's popover.\n */\n info?: InfoButtonProps['info'];\n};\n\n/**\n * State used in rendering InfoLabel\n */\nexport type InfoLabelState = ComponentState<InfoLabelSlots> & Pick<InfoLabelProps, 'size'>;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["InfoLabel.types.ts"],"sourcesContent":["import { Label } from '@fluentui/react-label';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton';\nimport type { InfoButtonProps } from '../InfoButton';\n\nexport type InfoLabelSlots = {\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The Label component.\n *\n * It is not typically necessary to use this prop. The label text is the child of the `<InfoLabel>`, and other props\n * such as `size` and `required` should be set directly on the `InfoLabel`.\n *\n * This is the PRIMARY slot: all native properties specified directly on `<InfoLabel>` will be applied to this slot,\n * except `className` and `style`, which remain on the root slot.\n */\n label: NonNullable<Slot<typeof Label>>;\n\n /**\n * The InfoButton component.\n *\n * It is not typically necessary to use this prop. The content can be set using the `info` prop of the InfoLabel.\n */\n infoButton: Slot<typeof InfoButton>;\n};\n\n/**\n * InfoLabel Props\n */\nexport type InfoLabelProps = ComponentProps<Partial<InfoLabelSlots>, 'label'> & {\n /**\n * The content of the InfoButton's popover.\n */\n info?: InfoButtonProps['info'];\n};\n\n/**\n * State used in rendering InfoLabel\n */\nexport type InfoLabelState = ComponentState<InfoLabelSlots> & Pick<InfoLabelProps, 'size'>;\n"],"names":[],"mappings":"AAqCA;;CAEC,GACD,WAA2F"}
|
|
@@ -48,9 +48,11 @@ import { InfoButton } from '../InfoButton/InfoButton';
|
|
|
48
48
|
if (infoButton) {
|
|
49
49
|
var _infoButton, _arialabelledby;
|
|
50
50
|
infoButton.popover = infoButtonPopover;
|
|
51
|
+
const infoPopupId = baseId + '__info'; // used as a self-referencing aria-labelledby to name the popup
|
|
51
52
|
infoButton.info = slot.optional(infoButton === null || infoButton === void 0 ? void 0 : infoButton.info, {
|
|
52
53
|
defaultProps: {
|
|
53
|
-
id:
|
|
54
|
+
id: infoPopupId,
|
|
55
|
+
'aria-labelledby': infoPopupId
|
|
54
56
|
},
|
|
55
57
|
elementType: 'div'
|
|
56
58
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useInfoLabel.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Label } from '@fluentui/react-label';\nimport { mergeCallbacks, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton/InfoButton';\nimport type { InfoLabelProps, InfoLabelState } from './InfoLabel.types';\n\n/**\n * Create the state required to render InfoLabel.\n *\n * The returned state can be modified with hooks such as useInfoLabelStyles_unstable,\n * before being passed to renderInfoLabel_unstable.\n *\n * @param props - props from this instance of InfoLabel\n * @param ref - reference to label element of InfoLabel\n */\nexport const useInfoLabel_unstable = (props: InfoLabelProps, ref: React.Ref<HTMLLabelElement>): InfoLabelState => {\n const {\n root: rootShorthand,\n label: labelShorthand,\n infoButton: infoButtonShorthand,\n info,\n size,\n className,\n style,\n ...labelProps\n } = props;\n const baseId = useId('infolabel-');\n const [open, setOpen] = React.useState(false);\n\n const root = slot.always(rootShorthand, {\n defaultProps: {\n className,\n style,\n },\n elementType: 'span',\n });\n\n const label = slot.always(labelShorthand, {\n defaultProps: {\n id: baseId + '__label',\n ref,\n size,\n ...labelProps,\n },\n elementType: Label,\n });\n\n const infoButton = slot.optional(infoButtonShorthand, {\n renderByDefault: !!info,\n defaultProps: {\n id: baseId + '__infoButton',\n size,\n info,\n },\n elementType: InfoButton,\n });\n\n const infoButtonPopover = slot.always(infoButton?.popover, {\n elementType: 'div',\n });\n infoButtonPopover.onOpenChange = useEventCallback(\n mergeCallbacks(infoButtonPopover.onOpenChange, (e, data) => {\n setOpen(data.open);\n }),\n );\n\n if (infoButton) {\n infoButton.popover = infoButtonPopover;\n infoButton.info = slot.optional(infoButton?.info, {\n defaultProps: {\n id:
|
|
1
|
+
{"version":3,"sources":["useInfoLabel.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Label } from '@fluentui/react-label';\nimport { mergeCallbacks, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton/InfoButton';\nimport type { InfoLabelProps, InfoLabelState } from './InfoLabel.types';\n\n/**\n * Create the state required to render InfoLabel.\n *\n * The returned state can be modified with hooks such as useInfoLabelStyles_unstable,\n * before being passed to renderInfoLabel_unstable.\n *\n * @param props - props from this instance of InfoLabel\n * @param ref - reference to label element of InfoLabel\n */\nexport const useInfoLabel_unstable = (props: InfoLabelProps, ref: React.Ref<HTMLLabelElement>): InfoLabelState => {\n const {\n root: rootShorthand,\n label: labelShorthand,\n infoButton: infoButtonShorthand,\n info,\n size,\n className,\n style,\n ...labelProps\n } = props;\n const baseId = useId('infolabel-');\n const [open, setOpen] = React.useState(false);\n\n const root = slot.always(rootShorthand, {\n defaultProps: {\n className,\n style,\n },\n elementType: 'span',\n });\n\n const label = slot.always(labelShorthand, {\n defaultProps: {\n id: baseId + '__label',\n ref,\n size,\n ...labelProps,\n },\n elementType: Label,\n });\n\n const infoButton = slot.optional(infoButtonShorthand, {\n renderByDefault: !!info,\n defaultProps: {\n id: baseId + '__infoButton',\n size,\n info,\n },\n elementType: InfoButton,\n });\n\n const infoButtonPopover = slot.always(infoButton?.popover, {\n elementType: 'div',\n });\n infoButtonPopover.onOpenChange = useEventCallback(\n mergeCallbacks(infoButtonPopover.onOpenChange, (e, data) => {\n setOpen(data.open);\n }),\n );\n\n if (infoButton) {\n infoButton.popover = infoButtonPopover;\n const infoPopupId = baseId + '__info'; // used as a self-referencing aria-labelledby to name the popup\n infoButton.info = slot.optional(infoButton?.info, {\n defaultProps: {\n id: infoPopupId,\n 'aria-labelledby': infoPopupId,\n },\n elementType: 'div',\n });\n\n infoButton['aria-labelledby'] ??= `${label.id} ${infoButton.id}`;\n\n if (open) {\n root['aria-owns'] ??= infoButton.info?.id;\n }\n }\n\n return {\n size,\n components: {\n root: 'span',\n label: Label,\n infoButton: InfoButton,\n },\n root,\n label,\n infoButton,\n };\n};\n"],"names":["React","Label","mergeCallbacks","useEventCallback","useId","slot","InfoButton","useInfoLabel_unstable","props","ref","root","rootShorthand","label","labelShorthand","infoButton","infoButtonShorthand","info","size","className","style","labelProps","baseId","open","setOpen","useState","always","defaultProps","elementType","id","optional","renderByDefault","infoButtonPopover","popover","onOpenChange","e","data","infoPopupId","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAC1F,SAASC,UAAU,QAAQ,2BAA2B;AAGtD;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CAACC,OAAuBC;IAC3D,MAAM,EACJC,MAAMC,aAAa,EACnBC,OAAOC,cAAc,EACrBC,YAAYC,mBAAmB,EAC/BC,IAAI,EACJC,IAAI,EACJC,SAAS,EACTC,KAAK,EACL,GAAGC,YACJ,GAAGZ;IACJ,MAAMa,SAASjB,MAAM;IACrB,MAAM,CAACkB,MAAMC,QAAQ,GAAGvB,MAAMwB,QAAQ,CAAC;IAEvC,MAAMd,OAAOL,KAAKoB,MAAM,CAACd,eAAe;QACtCe,cAAc;YACZR;YACAC;QACF;QACAQ,aAAa;IACf;IAEA,MAAMf,QAAQP,KAAKoB,MAAM,CAACZ,gBAAgB;QACxCa,cAAc;YACZE,IAAIP,SAAS;YACbZ;YACAQ;YACA,GAAGG,UAAU;QACf;QACAO,aAAa1B;IACf;IAEA,MAAMa,aAAaT,KAAKwB,QAAQ,CAACd,qBAAqB;QACpDe,iBAAiB,CAAC,CAACd;QACnBU,cAAc;YACZE,IAAIP,SAAS;YACbJ;YACAD;QACF;QACAW,aAAarB;IACf;IAEA,MAAMyB,oBAAoB1B,KAAKoB,MAAM,CAACX,uBAAAA,iCAAAA,WAAYkB,OAAO,EAAE;QACzDL,aAAa;IACf;IACAI,kBAAkBE,YAAY,GAAG9B,iBAC/BD,eAAe6B,kBAAkBE,YAAY,EAAE,CAACC,GAAGC;QACjDZ,QAAQY,KAAKb,IAAI;IACnB;IAGF,IAAIR,YAAY;YAWdA,aAAW;QAVXA,WAAWkB,OAAO,GAAGD;QACrB,MAAMK,cAAcf,SAAS,UAAU,+DAA+D;QACtGP,WAAWE,IAAI,GAAGX,KAAKwB,QAAQ,CAACf,uBAAAA,iCAAAA,WAAYE,IAAI,EAAE;YAChDU,cAAc;gBACZE,IAAIQ;gBACJ,mBAAmBA;YACrB;YACAT,aAAa;QACf;;QAEAb,MAAAA,cAAAA,WAAU,CAAC,kBAAA,kBAAkB,iCAA7BA,WAAU,CAAC,gBAAkB,GAAK,CAAC,EAAEF,MAAMgB,EAAE,CAAC,CAAC,EAAEd,WAAWc,EAAE,CAAC,CAAC;QAEhE,IAAIN,MAAM;gBACcR;gBAAtBJ,OAAK;;YAALA,OAAAA,QAAAA,KAAI,CAAC,YAAA,YAAY,mCAAjBA,KAAI,CAAC,UAAY,IAAKI,mBAAAA,WAAWE,IAAI,cAAfF,uCAAAA,iBAAiBc,EAAE;QAC3C;IACF;IAEA,OAAO;QACLX;QACAoB,YAAY;YACV3B,MAAM;YACNE,OAAOX;YACPa,YAAYR;QACd;QACAI;QACAE;QACAE;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["InfoButton.types.js"],"sourcesContent":["/**\n * State used in rendering InfoButton\n */ export { };\n"],"names":[],"mappings":"AAAA;;CAEC"}
|
|
@@ -25,6 +25,7 @@ const popoverSizeMap = {
|
|
|
25
25
|
};
|
|
26
26
|
const useInfoButton_unstable = (props, ref)=>{
|
|
27
27
|
const { size = 'medium', inline = true } = props;
|
|
28
|
+
const rootRef = (0, _reactutilities.useMergedRefs)(ref);
|
|
28
29
|
const state = {
|
|
29
30
|
inline,
|
|
30
31
|
size,
|
|
@@ -38,7 +39,7 @@ const useInfoButton_unstable = (props, ref)=>{
|
|
|
38
39
|
type: 'button',
|
|
39
40
|
'aria-label': 'information',
|
|
40
41
|
...props,
|
|
41
|
-
ref
|
|
42
|
+
ref: rootRef
|
|
42
43
|
}), {
|
|
43
44
|
elementType: 'button'
|
|
44
45
|
}),
|
|
@@ -66,19 +67,16 @@ const useInfoButton_unstable = (props, ref)=>{
|
|
|
66
67
|
});
|
|
67
68
|
state.popover.open = popoverOpen;
|
|
68
69
|
state.popover.onOpenChange = (0, _reactutilities.mergeCallbacks)(state.popover.onOpenChange, (e, data)=>setPopoverOpen(data.open));
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
const infoRef = (0, _reactutilities.useMergedRefs)(state.info.ref);
|
|
71
|
+
state.info.ref = infoRef;
|
|
72
|
+
// Hide the popover when focus moves out of the button and popover
|
|
73
|
+
const onBlurButtonOrInfo = (e)=>{
|
|
74
|
+
const nextFocused = e.relatedTarget;
|
|
75
|
+
if (rootRef.current !== nextFocused && !(0, _reactutilities.elementContains)(infoRef.current, nextFocused)) {
|
|
76
|
+
setPopoverOpen(false);
|
|
72
77
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
setPopoverOpen(false);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}, [
|
|
80
|
-
setPopoverOpen
|
|
81
|
-
]);
|
|
82
|
-
state.info.ref = (0, _reactutilities.useMergedRefs)(state.info.ref, focusOutRef);
|
|
78
|
+
};
|
|
79
|
+
state.root.onBlur = (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(state.root.onBlur, onBlurButtonOrInfo));
|
|
80
|
+
state.info.onBlurCapture = (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(state.info.onBlurCapture, onBlurButtonOrInfo));
|
|
83
81
|
return state;
|
|
84
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useInfoButton.js"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport { getIntrinsicElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs,
|
|
1
|
+
{"version":3,"sources":["useInfoButton.js"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport { getIntrinsicElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs, elementContains, useEventCallback } from '@fluentui/react-utilities';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nconst infoButtonIconMap = {\n small: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon12, null),\n medium: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon16, null),\n large: /*#__PURE__*/ React.createElement(DefaultInfoButtonIcon20, null)\n};\nconst popoverSizeMap = {\n small: 'small',\n medium: 'small',\n large: 'medium'\n};\n/**\n * Create the state required to render InfoButton.\n *\n * The returned state can be modified with hooks such as useInfoButtonStyles_unstable,\n * before being passed to renderInfoButton_unstable.\n *\n * @param props - props from this instance of InfoButton\n * @param ref - reference to root HTMLButtonElement of InfoButton\n */ export const useInfoButton_unstable = (props, ref)=>{\n const { size = 'medium', inline = true } = props;\n const rootRef = useMergedRefs(ref);\n const state = {\n inline,\n size,\n components: {\n root: 'button',\n popover: Popover,\n info: PopoverSurface\n },\n root: slot.always(getIntrinsicElementProps('button', {\n children: infoButtonIconMap[size],\n type: 'button',\n 'aria-label': 'information',\n ...props,\n ref: rootRef\n }), {\n elementType: 'button'\n }),\n popover: slot.always(props.popover, {\n defaultProps: {\n inline,\n positioning: 'above-start',\n size: popoverSizeMap[size],\n withArrow: true\n },\n elementType: Popover\n }),\n info: slot.always(props.info, {\n defaultProps: {\n role: 'note',\n tabIndex: -1\n },\n elementType: PopoverSurface\n })\n };\n const [popoverOpen, setPopoverOpen] = useControllableState({\n state: state.popover.open,\n defaultState: state.popover.defaultOpen,\n initialState: false\n });\n state.popover.open = popoverOpen;\n state.popover.onOpenChange = mergeCallbacks(state.popover.onOpenChange, (e, data)=>setPopoverOpen(data.open));\n const infoRef = useMergedRefs(state.info.ref);\n state.info.ref = infoRef;\n // Hide the popover when focus moves out of the button and popover\n const onBlurButtonOrInfo = (e)=>{\n const nextFocused = e.relatedTarget;\n if (rootRef.current !== nextFocused && !elementContains(infoRef.current, nextFocused)) {\n setPopoverOpen(false);\n }\n };\n state.root.onBlur = useEventCallback(mergeCallbacks(state.root.onBlur, onBlurButtonOrInfo));\n state.info.onBlurCapture = useEventCallback(mergeCallbacks(state.info.onBlurCapture, onBlurButtonOrInfo));\n return state;\n};\n"],"names":["useInfoButton_unstable","infoButtonIconMap","small","React","createElement","DefaultInfoButtonIcon12","medium","DefaultInfoButtonIcon16","large","DefaultInfoButtonIcon20","popoverSizeMap","props","ref","size","inline","rootRef","useMergedRefs","state","components","root","popover","Popover","info","PopoverSurface","slot","always","getIntrinsicElementProps","children","type","elementType","defaultProps","positioning","withArrow","role","tabIndex","popoverOpen","setPopoverOpen","useControllableState","open","defaultState","defaultOpen","initialState","onOpenChange","mergeCallbacks","e","data","infoRef","onBlurButtonOrInfo","nextFocused","relatedTarget","current","elementContains","onBlur","useEventCallback","onBlurCapture"],"mappings":";;;;+BAsBiBA;;;eAAAA;;;;iEAtBM;wCACmE;gCAC6C;8BAC/F;AACxC,MAAMC,oBAAoB;IACtBC,OAAO,WAAW,GAAGC,OAAMC,aAAa,CAACC,+CAAuB,EAAE;IAClEC,QAAQ,WAAW,GAAGH,OAAMC,aAAa,CAACG,+CAAuB,EAAE;IACnEC,OAAO,WAAW,GAAGL,OAAMC,aAAa,CAACK,+CAAuB,EAAE;AACtE;AACA,MAAMC,iBAAiB;IACnBR,OAAO;IACPI,QAAQ;IACRE,OAAO;AACX;AASW,MAAMR,yBAAyB,CAACW,OAAOC;IAC9C,MAAM,EAAE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nC,IAAIlC,QAAQmC,OAAO,KAAKF,eAAe,CAACG,IAAAA,+BAAe,EAACL,QAAQI,OAAO,EAAEF,cAAc;YACnFZ,eAAe;QACnB;IACJ;IACAnB,MAAME,IAAI,CAACiC,MAAM,GAAGC,IAAAA,gCAAgB,EAACV,IAAAA,8BAAc,EAAC1B,MAAME,IAAI,CAACiC,MAAM,EAAEL;IACvE9B,MAAMK,IAAI,CAACgC,aAAa,GAAGD,IAAAA,gCAAgB,EAACV,IAAAA,8BAAc,EAAC1B,MAAMK,IAAI,CAACgC,aAAa,EAAEP;IACrF,OAAO9B;AACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"sources":["InfoLabel.types.js"],"sourcesContent":["/**\n * State used in rendering InfoLabel\n */ export { };\n"],"names":[],"mappings":"AAAA;;CAEC"}
|
|
@@ -51,9 +51,11 @@ const useInfoLabel_unstable = (props, ref)=>{
|
|
|
51
51
|
if (infoButton) {
|
|
52
52
|
var _infoButton, _arialabelledby;
|
|
53
53
|
infoButton.popover = infoButtonPopover;
|
|
54
|
+
const infoPopupId = baseId + '__info'; // used as a self-referencing aria-labelledby to name the popup
|
|
54
55
|
infoButton.info = _reactutilities.slot.optional(infoButton === null || infoButton === void 0 ? void 0 : infoButton.info, {
|
|
55
56
|
defaultProps: {
|
|
56
|
-
id:
|
|
57
|
+
id: infoPopupId,
|
|
58
|
+
'aria-labelledby': infoPopupId
|
|
57
59
|
},
|
|
58
60
|
elementType: 'div'
|
|
59
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useInfoLabel.js"],"sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport { mergeCallbacks, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton/InfoButton';\n/**\n * Create the state required to render InfoLabel.\n *\n * The returned state can be modified with hooks such as useInfoLabelStyles_unstable,\n * before being passed to renderInfoLabel_unstable.\n *\n * @param props - props from this instance of InfoLabel\n * @param ref - reference to label element of InfoLabel\n */ export const useInfoLabel_unstable = (props, ref)=>{\n const { root: rootShorthand, label: labelShorthand, infoButton: infoButtonShorthand, info, size, className, style, ...labelProps } = props;\n const baseId = useId('infolabel-');\n const [open, setOpen] = React.useState(false);\n const root = slot.always(rootShorthand, {\n defaultProps: {\n className,\n style\n },\n elementType: 'span'\n });\n const label = slot.always(labelShorthand, {\n defaultProps: {\n id: baseId + '__label',\n ref,\n size,\n ...labelProps\n },\n elementType: Label\n });\n const infoButton = slot.optional(infoButtonShorthand, {\n renderByDefault: !!info,\n defaultProps: {\n id: baseId + '__infoButton',\n size,\n info\n },\n elementType: InfoButton\n });\n const infoButtonPopover = slot.always(infoButton === null || infoButton === void 0 ? void 0 : infoButton.popover, {\n elementType: 'div'\n });\n infoButtonPopover.onOpenChange = useEventCallback(mergeCallbacks(infoButtonPopover.onOpenChange, (e, data)=>{\n setOpen(data.open);\n }));\n if (infoButton) {\n var _infoButton, _arialabelledby;\n infoButton.popover = infoButtonPopover;\n infoButton.info = slot.optional(infoButton === null || infoButton === void 0 ? void 0 : infoButton.info, {\n defaultProps: {\n id:
|
|
1
|
+
{"version":3,"sources":["useInfoLabel.js"],"sourcesContent":["import * as React from 'react';\nimport { Label } from '@fluentui/react-label';\nimport { mergeCallbacks, useEventCallback, useId, slot } from '@fluentui/react-utilities';\nimport { InfoButton } from '../InfoButton/InfoButton';\n/**\n * Create the state required to render InfoLabel.\n *\n * The returned state can be modified with hooks such as useInfoLabelStyles_unstable,\n * before being passed to renderInfoLabel_unstable.\n *\n * @param props - props from this instance of InfoLabel\n * @param ref - reference to label element of InfoLabel\n */ export const useInfoLabel_unstable = (props, ref)=>{\n const { root: rootShorthand, label: labelShorthand, infoButton: infoButtonShorthand, info, size, className, style, ...labelProps } = props;\n const baseId = useId('infolabel-');\n const [open, setOpen] = React.useState(false);\n const root = slot.always(rootShorthand, {\n defaultProps: {\n className,\n style\n },\n elementType: 'span'\n });\n const label = slot.always(labelShorthand, {\n defaultProps: {\n id: baseId + '__label',\n ref,\n size,\n ...labelProps\n },\n elementType: Label\n });\n const infoButton = slot.optional(infoButtonShorthand, {\n renderByDefault: !!info,\n defaultProps: {\n id: baseId + '__infoButton',\n size,\n info\n },\n elementType: InfoButton\n });\n const infoButtonPopover = slot.always(infoButton === null || infoButton === void 0 ? void 0 : infoButton.popover, {\n elementType: 'div'\n });\n infoButtonPopover.onOpenChange = useEventCallback(mergeCallbacks(infoButtonPopover.onOpenChange, (e, data)=>{\n setOpen(data.open);\n }));\n if (infoButton) {\n var _infoButton, _arialabelledby;\n infoButton.popover = infoButtonPopover;\n const infoPopupId = baseId + '__info'; // used as a self-referencing aria-labelledby to name the popup\n infoButton.info = slot.optional(infoButton === null || infoButton === void 0 ? void 0 : infoButton.info, {\n defaultProps: {\n id: infoPopupId,\n 'aria-labelledby': infoPopupId\n },\n elementType: 'div'\n });\n var _;\n (_ = (_infoButton = infoButton)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _infoButton[_arialabelledby] = `${label.id} ${infoButton.id}`;\n if (open) {\n var _infoButton_info;\n var _root, _ariaowns;\n var _1;\n (_1 = (_root = root)[_ariaowns = 'aria-owns']) !== null && _1 !== void 0 ? _1 : _root[_ariaowns] = (_infoButton_info = infoButton.info) === null || _infoButton_info === void 0 ? void 0 : _infoButton_info.id;\n }\n }\n return {\n size,\n components: {\n root: 'span',\n label: Label,\n infoButton: InfoButton\n },\n root,\n label,\n infoButton\n };\n};\n"],"names":["useInfoLabel_unstable","props","ref","root","rootShorthand","label","labelShorthand","infoButton","infoButtonShorthand","info","size","className","style","labelProps","baseId","useId","open","setOpen","React","useState","slot","always","defaultProps","elementType","id","Label","optional","renderByDefault","InfoButton","infoButtonPopover","popover","onOpenChange","useEventCallback","mergeCallbacks","e","data","_infoButton","_arialabelledby","infoPopupId","_","_infoButton_info","_root","_ariaowns","_1","components"],"mappings":";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e,KAAK,IAAI,KAAK,IAAIA,WAAWE,IAAI,EAAE;YACrGa,cAAc;gBACVE,IAAIc;gBACJ,mBAAmBA;YACvB;YACAf,aAAa;QACjB;QACA,IAAIgB;QACHA,CAAAA,IAAI,AAACH,CAAAA,cAAc7B,UAAS,CAAE,CAAC8B,kBAAkB,kBAAkB,AAAD,MAAO,QAAQE,MAAM,KAAK,IAAIA,IAAIH,WAAW,CAACC,gBAAgB,GAAG,CAAC,EAAEhC,MAAMmB,EAAE,CAAC,CAAC,EAAEjB,WAAWiB,EAAE,CAAC,CAAC;QAClK,IAAIR,MAAM;YACN,IAAIwB;YACJ,IAAIC,OAAOC;YACX,IAAIC;YACHA,CAAAA,KAAK,AAACF,CAAAA,QAAQtC,IAAG,CAAE,CAACuC,YAAY,YAAY,AAAD,MAAO,QAAQC,OAAO,KAAK,IAAIA,KAAKF,KAAK,CAACC,UAAU,GAAG,AAACF,CAAAA,mBAAmBjC,WAAWE,IAAI,AAAD,MAAO,QAAQ+B,qBAAqB,KAAK,IAAI,KAAK,IAAIA,iBAAiBhB,EAAE;QAClN;IACJ;IACA,OAAO;QACHd;QACAkC,YAAY;YACRzC,MAAM;YACNE,OAAOoB,iBAAK;YACZlB,YAAYqB,sBAAU;QAC1B;QACAzB;QACAE;QACAE;IACJ;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-infolabel",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.25",
|
|
4
4
|
"description": "InfoLabel component for Fluent UI v9",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"build": "just-scripts build",
|
|
16
16
|
"clean": "just-scripts clean",
|
|
17
|
+
"e2e": "cypress run --component",
|
|
18
|
+
"e2e:local": "cypress open --component",
|
|
17
19
|
"generate-api": "just-scripts generate-api",
|
|
18
20
|
"lint": "just-scripts lint",
|
|
19
21
|
"start": "yarn storybook",
|
|
@@ -31,12 +33,12 @@
|
|
|
31
33
|
},
|
|
32
34
|
"dependencies": {
|
|
33
35
|
"@fluentui/react-icons": "^2.0.224",
|
|
34
|
-
"@fluentui/react-label": "^9.1.
|
|
35
|
-
"@fluentui/react-popover": "^9.
|
|
36
|
-
"@fluentui/react-tabster": "^9.19.
|
|
37
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
|
38
|
-
"@fluentui/react-theme": "^9.1.
|
|
39
|
-
"@fluentui/react-utilities": "^9.18.
|
|
36
|
+
"@fluentui/react-label": "^9.1.65",
|
|
37
|
+
"@fluentui/react-popover": "^9.9.1",
|
|
38
|
+
"@fluentui/react-tabster": "^9.19.4",
|
|
39
|
+
"@fluentui/react-jsx-runtime": "^9.0.33",
|
|
40
|
+
"@fluentui/react-theme": "^9.1.18",
|
|
41
|
+
"@fluentui/react-utilities": "^9.18.4",
|
|
40
42
|
"@griffel/react": "^1.5.14",
|
|
41
43
|
"@swc/helpers": "^0.5.1"
|
|
42
44
|
},
|