@fluentui/react-infobutton 9.0.0-beta.6 → 9.0.0-beta.62

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.
Files changed (72) hide show
  1. package/CHANGELOG.json +1942 -4
  2. package/CHANGELOG.md +675 -5
  3. package/dist/index.d.ts +75 -5
  4. package/lib/InfoButton.js +0 -1
  5. package/lib/InfoButton.js.map +1 -1
  6. package/lib/InfoLabel.js +1 -0
  7. package/lib/InfoLabel.js.map +1 -0
  8. package/lib/components/InfoButton/DefaultInfoButtonIcons.js +3 -4
  9. package/lib/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
  10. package/lib/components/InfoButton/InfoButton.js +5 -7
  11. package/lib/components/InfoButton/InfoButton.js.map +1 -1
  12. package/lib/components/InfoButton/InfoButton.types.js +1 -2
  13. package/lib/components/InfoButton/InfoButton.types.js.map +1 -1
  14. package/lib/components/InfoButton/index.js +1 -2
  15. package/lib/components/InfoButton/index.js.map +1 -1
  16. package/lib/components/InfoButton/renderInfoButton.js +12 -16
  17. package/lib/components/InfoButton/renderInfoButton.js.map +1 -1
  18. package/lib/components/InfoButton/useInfoButton.js +66 -51
  19. package/lib/components/InfoButton/useInfoButton.js.map +1 -1
  20. package/lib/components/InfoButton/useInfoButtonStyles.styles.js +154 -0
  21. package/lib/components/InfoButton/useInfoButtonStyles.styles.js.map +1 -0
  22. package/lib/components/InfoLabel/InfoLabel.js +12 -0
  23. package/lib/components/InfoLabel/InfoLabel.js.map +1 -0
  24. package/lib/components/InfoLabel/InfoLabel.types.js +1 -0
  25. package/lib/components/InfoLabel/InfoLabel.types.js.map +1 -0
  26. package/lib/components/InfoLabel/index.js +5 -0
  27. package/lib/components/InfoLabel/index.js.map +1 -0
  28. package/lib/components/InfoLabel/renderInfoLabel.js +13 -0
  29. package/lib/components/InfoLabel/renderInfoLabel.js.map +1 -0
  30. package/lib/components/InfoLabel/useInfoLabel.js +79 -0
  31. package/lib/components/InfoLabel/useInfoLabel.js.map +1 -0
  32. package/lib/components/InfoLabel/useInfoLabelStyles.styles.js +43 -0
  33. package/lib/components/InfoLabel/useInfoLabelStyles.styles.js.map +1 -0
  34. package/lib/index.js +1 -1
  35. package/lib/index.js.map +1 -1
  36. package/lib-commonjs/InfoButton.js +3 -5
  37. package/lib-commonjs/InfoButton.js.map +1 -1
  38. package/lib-commonjs/InfoLabel.js +6 -0
  39. package/lib-commonjs/InfoLabel.js.map +1 -0
  40. package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js +22 -8
  41. package/lib-commonjs/components/InfoButton/DefaultInfoButtonIcons.js.map +1 -1
  42. package/lib-commonjs/components/InfoButton/InfoButton.js +17 -16
  43. package/lib-commonjs/components/InfoButton/InfoButton.js.map +1 -1
  44. package/lib-commonjs/components/InfoButton/InfoButton.types.js +1 -3
  45. package/lib-commonjs/components/InfoButton/InfoButton.types.js.map +1 -1
  46. package/lib-commonjs/components/InfoButton/index.js +7 -9
  47. package/lib-commonjs/components/InfoButton/index.js.map +1 -1
  48. package/lib-commonjs/components/InfoButton/renderInfoButton.js +20 -23
  49. package/lib-commonjs/components/InfoButton/renderInfoButton.js.map +1 -1
  50. package/lib-commonjs/components/InfoButton/useInfoButton.js +77 -66
  51. package/lib-commonjs/components/InfoButton/useInfoButton.js.map +1 -1
  52. package/lib-commonjs/components/InfoButton/useInfoButtonStyles.styles.js +346 -0
  53. package/lib-commonjs/components/InfoButton/useInfoButtonStyles.styles.js.map +1 -0
  54. package/lib-commonjs/components/InfoLabel/InfoLabel.js +21 -0
  55. package/lib-commonjs/components/InfoLabel/InfoLabel.js.map +1 -0
  56. package/lib-commonjs/components/InfoLabel/InfoLabel.types.js +4 -0
  57. package/lib-commonjs/components/InfoLabel/InfoLabel.types.js.map +1 -0
  58. package/lib-commonjs/components/InfoLabel/index.js +10 -0
  59. package/lib-commonjs/components/InfoLabel/index.js.map +1 -0
  60. package/lib-commonjs/components/InfoLabel/renderInfoLabel.js +21 -0
  61. package/lib-commonjs/components/InfoLabel/renderInfoLabel.js.map +1 -0
  62. package/lib-commonjs/components/InfoLabel/useInfoLabel.js +82 -0
  63. package/lib-commonjs/components/InfoLabel/useInfoLabel.js.map +1 -0
  64. package/lib-commonjs/components/InfoLabel/useInfoLabelStyles.styles.js +66 -0
  65. package/lib-commonjs/components/InfoLabel/useInfoLabelStyles.styles.js.map +1 -0
  66. package/lib-commonjs/index.js +40 -34
  67. package/lib-commonjs/index.js.map +1 -1
  68. package/package.json +25 -17
  69. package/lib/components/InfoButton/useInfoButtonStyles.js +0 -183
  70. package/lib/components/InfoButton/useInfoButtonStyles.js.map +0 -1
  71. package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js +0 -190
  72. package/lib-commonjs/components/InfoButton/useInfoButtonStyles.js.map +0 -1
@@ -0,0 +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":"AAAA,WAwC2F"}
@@ -0,0 +1,5 @@
1
+ export * from './InfoLabel';
2
+ export * from './InfoLabel.types';
3
+ export * from './renderInfoLabel';
4
+ export * from './useInfoLabel';
5
+ export * from './useInfoLabelStyles.styles';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './InfoLabel';\nexport * from './InfoLabel.types';\nexport * from './renderInfoLabel';\nexport * from './useInfoLabel';\nexport * from './useInfoLabelStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,cAAc;AAC5B,cAAc,oBAAoB;AAClC,cAAc,oBAAoB;AAClC,cAAc,iBAAiB;AAC/B,cAAc,8BAA8B"}
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
2
+ import { assertSlots } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of InfoLabel
5
+ */ export const renderInfoLabel_unstable = (state)=>{
6
+ assertSlots(state);
7
+ return /*#__PURE__*/ _jsxs(state.root, {
8
+ children: [
9
+ /*#__PURE__*/ _jsx(state.label, {}),
10
+ state.infoButton && /*#__PURE__*/ _jsx(state.infoButton, {})
11
+ ]
12
+ });
13
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["renderInfoLabel.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { InfoLabelSlots, InfoLabelState } from './InfoLabel.types';\n\n/**\n * Render the final JSX of InfoLabel\n */\nexport const renderInfoLabel_unstable = (state: InfoLabelState) => {\n assertSlots<InfoLabelSlots>(state);\n\n return (\n <state.root>\n <state.label />\n {state.infoButton && <state.infoButton />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderInfoLabel_unstable","state","root","label","infoButton"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,qBACE,MAACA,MAAMC,IAAI;;0BACT,KAACD,MAAME,KAAK;YACXF,MAAMG,UAAU,kBAAI,KAACH,MAAMG,UAAU;;;AAG5C,EAAE"}
@@ -0,0 +1,79 @@
1
+ import * as React from 'react';
2
+ import { Label } from '@fluentui/react-label';
3
+ import { mergeCallbacks, useEventCallback, useId, slot } from '@fluentui/react-utilities';
4
+ import { InfoButton } from '../InfoButton/InfoButton';
5
+ /**
6
+ * Create the state required to render InfoLabel.
7
+ *
8
+ * The returned state can be modified with hooks such as useInfoLabelStyles_unstable,
9
+ * before being passed to renderInfoLabel_unstable.
10
+ *
11
+ * @param props - props from this instance of InfoLabel
12
+ * @param ref - reference to label element of InfoLabel
13
+ */ export const useInfoLabel_unstable = (props, ref)=>{
14
+ var _infoButton;
15
+ const { root: rootShorthand, label: labelShorthand, infoButton: infoButtonShorthand, info, size, className, style, ...labelProps } = props;
16
+ const baseId = useId('infolabel-');
17
+ const [open, setOpen] = React.useState(false);
18
+ const root = slot.always(rootShorthand, {
19
+ defaultProps: {
20
+ className,
21
+ style
22
+ },
23
+ elementType: 'span'
24
+ });
25
+ const label = slot.always(labelShorthand, {
26
+ defaultProps: {
27
+ id: baseId + '__label',
28
+ ref,
29
+ size,
30
+ ...labelProps
31
+ },
32
+ elementType: Label
33
+ });
34
+ const infoButton = slot.optional(infoButtonShorthand, {
35
+ renderByDefault: !!info,
36
+ defaultProps: {
37
+ id: baseId + '__infoButton',
38
+ size,
39
+ info
40
+ },
41
+ elementType: InfoButton
42
+ });
43
+ const infoButtonPopover = slot.always((_infoButton = infoButton) === null || _infoButton === void 0 ? void 0 : _infoButton.popover, {
44
+ elementType: 'div'
45
+ });
46
+ infoButtonPopover.onOpenChange = useEventCallback(mergeCallbacks(infoButtonPopover.onOpenChange, (e, data)=>{
47
+ setOpen(data.open);
48
+ }));
49
+ if (infoButton) {
50
+ var _infoButton1;
51
+ var _infoButton2, _arialabelledby;
52
+ infoButton.popover = infoButtonPopover;
53
+ infoButton.info = slot.optional((_infoButton1 = infoButton) === null || _infoButton1 === void 0 ? void 0 : _infoButton1.info, {
54
+ defaultProps: {
55
+ id: baseId + '__info'
56
+ },
57
+ elementType: 'div'
58
+ });
59
+ var _;
60
+ (_ = (_infoButton2 = infoButton)[_arialabelledby = 'aria-labelledby']) !== null && _ !== void 0 ? _ : _infoButton2[_arialabelledby] = `${label.id} ${infoButton.id}`;
61
+ if (open) {
62
+ var _infoButton_info;
63
+ var _root, _ariaowns;
64
+ var _1;
65
+ (_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;
66
+ }
67
+ }
68
+ return {
69
+ size,
70
+ components: {
71
+ root: 'span',
72
+ label: Label,
73
+ infoButton: InfoButton
74
+ },
75
+ root,
76
+ label,
77
+ infoButton
78
+ };
79
+ };
@@ -0,0 +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: baseId + '__info',\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","infoButton","root","rootShorthand","label","labelShorthand","infoButtonShorthand","info","size","className","style","labelProps","baseId","open","setOpen","useState","always","defaultProps","elementType","id","optional","renderByDefault","infoButtonPopover","popover","onOpenChange","e","data","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;QA0CrBC;IAzCtC,MAAM,EACJC,MAAMC,aAAa,EACnBC,OAAOC,cAAc,EACrBJ,YAAYK,mBAAmB,EAC/BC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YAAY,mCAAjBA,KAAI,CAAC,UAAY,IAAKD,mBAAAA,WAAWM,IAAI,cAAfN,uCAAAA,iBAAiBkB,EAAE;QAC3C;IACF;IAEA,OAAO;QACLX;QACAmB,YAAY;YACVzB,MAAM;YACNE,OAAOZ;YACPS,YAAYJ;QACd;QACAK;QACAE;QACAH;IACF;AACF,EAAE"}
@@ -0,0 +1,43 @@
1
+ import { tokens } from '@fluentui/react-theme';
2
+ import { __styles, mergeClasses } from '@griffel/react';
3
+ export const infoLabelClassNames = {
4
+ root: 'fui-InfoLabel',
5
+ label: 'fui-InfoLabel__label',
6
+ infoButton: 'fui-InfoLabel__infoButton'
7
+ };
8
+ const useLabelStyles = /*#__PURE__*/__styles({
9
+ base: {
10
+ ha4doy: "f12kltsn",
11
+ Bceei9c: "fpo1scq",
12
+ sj55zd: "f1ym3bx4"
13
+ }
14
+ }, {
15
+ d: [".f12kltsn{vertical-align:top;}", ".fpo1scq{cursor:inherit;}", ".f1ym3bx4{color:inherit;}"]
16
+ });
17
+ const useInfoButtonStyles = /*#__PURE__*/__styles({
18
+ base: {
19
+ ha4doy: "f12kltsn",
20
+ B6of3ja: "f1bmzb36",
21
+ jrapky: "f1nyzk09"
22
+ },
23
+ large: {
24
+ B6of3ja: "fkrn0sh",
25
+ jrapky: "fmxx68s"
26
+ }
27
+ }, {
28
+ d: [".f12kltsn{vertical-align:top;}", ".f1bmzb36{margin-top:calc(0px - var(--spacingVerticalXXS));}", ".f1nyzk09{margin-bottom:calc(0px - var(--spacingVerticalXXS));}", ".fkrn0sh{margin-top:-1px;}", ".fmxx68s{margin-bottom:-1px;}"]
29
+ });
30
+ /**
31
+ * Apply styling to the InfoLabel slots based on the state
32
+ */
33
+ export const useInfoLabelStyles_unstable = state => {
34
+ state.root.className = mergeClasses(infoLabelClassNames.root, state.root.className);
35
+ const labelStyles = useLabelStyles();
36
+ state.label.className = mergeClasses(infoLabelClassNames.label, labelStyles.base, state.label.className);
37
+ const infoButtonStyles = useInfoButtonStyles();
38
+ if (state.infoButton) {
39
+ state.infoButton.className = mergeClasses(infoLabelClassNames.infoButton, infoButtonStyles.base, state.size === 'large' && infoButtonStyles.large, state.infoButton.className);
40
+ }
41
+ return state;
42
+ };
43
+ //# sourceMappingURL=useInfoLabelStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["tokens","__styles","mergeClasses","infoLabelClassNames","root","label","infoButton","useLabelStyles","base","ha4doy","Bceei9c","sj55zd","d","useInfoButtonStyles","B6of3ja","jrapky","large","useInfoLabelStyles_unstable","state","className","labelStyles","infoButtonStyles","size"],"sources":["useInfoLabelStyles.styles.js"],"sourcesContent":["import { tokens } from '@fluentui/react-theme';\nimport { makeStyles, mergeClasses } from '@griffel/react';\nexport const infoLabelClassNames = {\n root: 'fui-InfoLabel',\n label: 'fui-InfoLabel__label',\n infoButton: 'fui-InfoLabel__infoButton'\n};\nconst useLabelStyles = makeStyles({\n base: {\n verticalAlign: 'top',\n cursor: 'inherit',\n color: 'inherit'\n }\n});\nconst useInfoButtonStyles = makeStyles({\n base: {\n verticalAlign: 'top',\n // Negative margin to align with the text\n marginTop: `calc(0px - ${tokens.spacingVerticalXXS})`,\n marginBottom: `calc(0px - ${tokens.spacingVerticalXXS})`\n },\n large: {\n // Negative margin to align with the text\n marginTop: '-1px',\n marginBottom: '-1px'\n }\n});\n/**\n * Apply styling to the InfoLabel slots based on the state\n */ export const useInfoLabelStyles_unstable = (state)=>{\n state.root.className = mergeClasses(infoLabelClassNames.root, state.root.className);\n const labelStyles = useLabelStyles();\n state.label.className = mergeClasses(infoLabelClassNames.label, labelStyles.base, state.label.className);\n const infoButtonStyles = useInfoButtonStyles();\n if (state.infoButton) {\n state.infoButton.className = mergeClasses(infoLabelClassNames.infoButton, infoButtonStyles.base, state.size === 'large' && infoButtonStyles.large, state.infoButton.className);\n }\n return state;\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,uBAAuB;AAC9C,SAAAC,QAAA,EAAqBC,YAAY,QA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_unstable, useInfoButtonStyles_unstable, useInfoButton_unstable } from './InfoButton';
2
- //# sourceMappingURL=index.js.map
2
+ export { InfoLabel, infoLabelClassNames, renderInfoLabel_unstable, useInfoLabelStyles_unstable, useInfoLabel_unstable } from './InfoLabel';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"mappings":"AAAA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,cAAc","names":["InfoButton","infoButtonClassNames","renderInfoButton_unstable","useInfoButtonStyles_unstable","useInfoButton_unstable"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/index.ts"],"sourcesContent":["export {\n InfoButton,\n infoButtonClassNames,\n renderInfoButton_unstable,\n useInfoButtonStyles_unstable,\n useInfoButton_unstable,\n} from './InfoButton';\nexport type { InfoButtonProps, InfoButtonSlots, InfoButtonState } from './InfoButton';\n"]}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n InfoButton,\n infoButtonClassNames,\n renderInfoButton_unstable,\n useInfoButtonStyles_unstable,\n useInfoButton_unstable,\n} from './InfoButton';\nexport type { InfoButtonProps, InfoButtonSlots, InfoButtonState } from './InfoButton';\nexport {\n InfoLabel,\n infoLabelClassNames,\n renderInfoLabel_unstable,\n useInfoLabelStyles_unstable,\n useInfoLabel_unstable,\n} from './InfoLabel';\nexport type { InfoLabelProps, InfoLabelSlots, InfoLabelState } from './InfoLabel';\n"],"names":["InfoButton","infoButtonClassNames","renderInfoButton_unstable","useInfoButtonStyles_unstable","useInfoButton_unstable","InfoLabel","infoLabelClassNames","renderInfoLabel_unstable","useInfoLabelStyles_unstable","useInfoLabel_unstable"],"mappings":"AAAA,SACEA,UAAU,EACVC,oBAAoB,EACpBC,yBAAyB,EACzBC,4BAA4B,EAC5BC,sBAAsB,QACjB,eAAe;AAEtB,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,2BAA2B,EAC3BC,qBAAqB,QAChB,cAAc"}
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./components/InfoButton/index"), exports);
8
- //# sourceMappingURL=InfoButton.js.map
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/InfoButton/index"), exports);
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/InfoButton.ts"],"sourcesContent":["export * from './components/InfoButton/index';\n"]}
1
+ {"version":3,"sources":["InfoButton.js"],"sourcesContent":["export * from './components/InfoButton/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./components/InfoLabel/index"), exports);
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["InfoLabel.js"],"sourcesContent":["export * from './components/InfoLabel/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
@@ -1,11 +1,25 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.DefaultInfoButtonIcon20 = exports.DefaultInfoButtonIcon16 = exports.DefaultInfoButtonIcon12 = void 0;
7
- const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
8
- exports.DefaultInfoButtonIcon12 = /*#__PURE__*/react_icons_1.bundleIcon(react_icons_1.Info12Filled, react_icons_1.Info12Regular);
9
- exports.DefaultInfoButtonIcon16 = /*#__PURE__*/react_icons_1.bundleIcon(react_icons_1.Info16Filled, react_icons_1.Info16Regular);
10
- exports.DefaultInfoButtonIcon20 = /*#__PURE__*/react_icons_1.bundleIcon(react_icons_1.Info20Filled, react_icons_1.Info20Regular);
11
- //# sourceMappingURL=DefaultInfoButtonIcons.js.map
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ DefaultInfoButtonIcon12: function() {
13
+ return DefaultInfoButtonIcon12;
14
+ },
15
+ DefaultInfoButtonIcon16: function() {
16
+ return DefaultInfoButtonIcon16;
17
+ },
18
+ DefaultInfoButtonIcon20: function() {
19
+ return DefaultInfoButtonIcon20;
20
+ }
21
+ });
22
+ const _reacticons = require("@fluentui/react-icons");
23
+ const DefaultInfoButtonIcon12 = (0, _reacticons.bundleIcon)(_reacticons.Info12Filled, _reacticons.Info12Regular);
24
+ const DefaultInfoButtonIcon16 = (0, _reacticons.bundleIcon)(_reacticons.Info16Filled, _reacticons.Info16Regular);
25
+ const DefaultInfoButtonIcon20 = (0, _reacticons.bundleIcon)(_reacticons.Info20Filled, _reacticons.Info20Regular);
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AAUaA,+BAAuB,gBAAGC,wBAAU,CAACA,0BAAY,EAAEA,2BAAa,CAAC;AACjED,+BAAuB,gBAAGC,wBAAU,CAACA,0BAAY,EAAEA,2BAAa,CAAC;AACjED,+BAAuB,gBAAGC,wBAAU,CAACA,0BAAY,EAAEA,2BAAa,CAAC","names":["exports","react_icons_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/components/InfoButton/DefaultInfoButtonIcons.tsx"],"sourcesContent":["import {\n Info12Regular,\n Info12Filled,\n Info16Regular,\n Info16Filled,\n Info20Regular,\n Info20Filled,\n bundleIcon,\n} from '@fluentui/react-icons';\n\nexport const DefaultInfoButtonIcon12 = bundleIcon(Info12Filled, Info12Regular);\nexport const DefaultInfoButtonIcon16 = bundleIcon(Info16Filled, Info16Regular);\nexport const DefaultInfoButtonIcon20 = bundleIcon(Info20Filled, Info20Regular);\n"]}
1
+ {"version":3,"sources":["DefaultInfoButtonIcons.js"],"sourcesContent":["import { Info12Regular, Info12Filled, Info16Regular, Info16Filled, Info20Regular, Info20Filled, bundleIcon } from '@fluentui/react-icons';\nexport const DefaultInfoButtonIcon12 = bundleIcon(Info12Filled, Info12Regular);\nexport const DefaultInfoButtonIcon16 = bundleIcon(Info16Filled, Info16Regular);\nexport const DefaultInfoButtonIcon20 = bundleIcon(Info20Filled, Info20Regular);\n"],"names":["DefaultInfoButtonIcon12","DefaultInfoButtonIcon16","DefaultInfoButtonIcon20","bundleIcon","Info12Filled","Info12Regular","Info16Filled","Info16Regular","Info20Filled","Info20Regular"],"mappings":";;;;;;;;;;;IACaA,uBAAuB;eAAvBA;;IACAC,uBAAuB;eAAvBA;;IACAC,uBAAuB;eAAvBA;;;4BAHqG;AAC3G,MAAMF,0BAA0BG,IAAAA,sBAAU,EAACC,wBAAY,EAAEC,yBAAa;AACtE,MAAMJ,0BAA0BE,IAAAA,sBAAU,EAACG,wBAAY,EAAEC,yBAAa;AACtE,MAAML,0BAA0BC,IAAAA,sBAAU,EAACK,wBAAY,EAAEC,yBAAa"}
@@ -1,20 +1,21 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.InfoButton = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const renderInfoButton_1 = /*#__PURE__*/require("./renderInfoButton");
9
- const useInfoButton_1 = /*#__PURE__*/require("./useInfoButton");
10
- const useInfoButtonStyles_1 = /*#__PURE__*/require("./useInfoButtonStyles");
11
- /**
12
- * InfoButtons provide a way to display additional information about a form field or an area in the UI.
13
- */
14
- exports.InfoButton = /*#__PURE__*/React.forwardRef((props, ref) => {
15
- const state = useInfoButton_1.useInfoButton_unstable(props, ref);
16
- useInfoButtonStyles_1.useInfoButtonStyles_unstable(state);
17
- return renderInfoButton_1.renderInfoButton_unstable(state);
5
+ Object.defineProperty(exports, "InfoButton", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return InfoButton;
9
+ }
18
10
  });
19
- exports.InfoButton.displayName = 'InfoButton';
20
- //# sourceMappingURL=InfoButton.js.map
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _renderInfoButton = require("./renderInfoButton");
14
+ const _useInfoButton = require("./useInfoButton");
15
+ const _useInfoButtonStylesstyles = require("./useInfoButtonStyles.styles");
16
+ const InfoButton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
17
+ const state = (0, _useInfoButton.useInfoButton_unstable)(props, ref);
18
+ (0, _useInfoButtonStylesstyles.useInfoButtonStyles_unstable)(state);
19
+ return (0, _renderInfoButton.renderInfoButton_unstable)(state);
20
+ });
21
+ InfoButton.displayName = 'InfoButton';
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AAGA;;;AAGaA,kBAAU,gBAAyCC,KAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC9F,MAAMC,KAAK,GAAGC,sCAAsB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAEhDG,kDAA4B,CAACF,KAAK,CAAC;EACnC,OAAOG,4CAAyB,CAACH,KAAK,CAAC;AACzC,CAAC,CAAC;AAEFL,kBAAU,CAACS,WAAW,GAAG,YAAY","names":["exports","React","forwardRef","props","ref","state","useInfoButton_1","useInfoButtonStyles_1","renderInfoButton_1","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/components/InfoButton/InfoButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { renderInfoButton_unstable } from './renderInfoButton';\nimport { useInfoButton_unstable } from './useInfoButton';\nimport { useInfoButtonStyles_unstable } from './useInfoButtonStyles';\nimport type { InfoButtonProps } from './InfoButton.types';\n\n/**\n * InfoButtons provide a way to display additional information about a form field or an area in the UI.\n */\nexport const InfoButton: ForwardRefComponent<InfoButtonProps> = React.forwardRef((props, ref) => {\n const state = useInfoButton_unstable(props, ref);\n\n useInfoButtonStyles_unstable(state);\n return renderInfoButton_unstable(state);\n});\n\nInfoButton.displayName = 'InfoButton';\n"]}
1
+ {"version":3,"sources":["InfoButton.js"],"sourcesContent":["import * as React from 'react';\nimport { renderInfoButton_unstable } from './renderInfoButton';\nimport { useInfoButton_unstable } from './useInfoButton';\nimport { useInfoButtonStyles_unstable } from './useInfoButtonStyles.styles';\n/**\n * InfoButtons provide a way to display additional information about a form field or an area in the UI.\n */ export const InfoButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{\n const state = useInfoButton_unstable(props, ref);\n useInfoButtonStyles_unstable(state);\n return renderInfoButton_unstable(state);\n});\nInfoButton.displayName = 'InfoButton';\n"],"names":["InfoButton","React","forwardRef","props","ref","state","useInfoButton_unstable","useInfoButtonStyles_unstable","renderInfoButton_unstable","displayName"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;iEANM;kCACmB;+BACH;2CACM;AAGlC,MAAMA,aAAa,WAAW,GAAGC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACjE,MAAMC,QAAQC,IAAAA,qCAAsB,EAACH,OAAOC;IAC5CG,IAAAA,uDAA4B,EAACF;IAC7B,OAAOG,IAAAA,2CAAyB,EAACH;AACrC;AACAL,WAAWS,WAAW,GAAG"}
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- //# sourceMappingURL=InfoButton.types.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":"","names":[],"sourceRoot":"../src/","sources":[],"sourcesContent":[]}
1
+ {"version":3,"sources":[],"names":[],"mappings":""}
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./InfoButton"), exports);
8
- tslib_1.__exportStar(require("./InfoButton.types"), exports);
9
- tslib_1.__exportStar(require("./renderInfoButton"), exports);
10
- tslib_1.__exportStar(require("./useInfoButton"), exports);
11
- tslib_1.__exportStar(require("./useInfoButtonStyles"), exports);
12
- //# sourceMappingURL=index.js.map
5
+ const _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./InfoButton"), exports);
7
+ _export_star._(require("./InfoButton.types"), exports);
8
+ _export_star._(require("./renderInfoButton"), exports);
9
+ _export_star._(require("./useInfoButton"), exports);
10
+ _export_star._(require("./useInfoButtonStyles.styles"), exports);
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAAA;AACAA;AACAA;AACAA;AACAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/components/InfoButton/index.ts"],"sourcesContent":["export * from './InfoButton';\nexport * from './InfoButton.types';\nexport * from './renderInfoButton';\nexport * from './useInfoButton';\nexport * from './useInfoButtonStyles';\n"]}
1
+ {"version":3,"sources":["index.js"],"sourcesContent":["export * from './InfoButton';\nexport * from './InfoButton.types';\nexport * from './renderInfoButton';\nexport * from './useInfoButton';\nexport * from './useInfoButtonStyles.styles';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
@@ -1,27 +1,24 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.renderInfoButton_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
- const react_popover_1 = /*#__PURE__*/require("@fluentui/react-popover");
10
- /**
11
- * Render the final JSX of InfoButton
12
- */
13
- const renderInfoButton_unstable = state => {
14
- const {
15
- slots,
16
- slotProps
17
- } = react_utilities_1.getSlots(state);
18
- return React.createElement(slots.popover, {
19
- ...slotProps.popover
20
- }, React.createElement(react_popover_1.PopoverTrigger, null, React.createElement(slots.root, {
21
- ...slotProps.root
22
- })), React.createElement(slots.content, {
23
- ...slotProps.content
24
- }));
5
+ Object.defineProperty(exports, "renderInfoButton_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderInfoButton_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _reactpopover = require("@fluentui/react-popover");
14
+ const renderInfoButton_unstable = (state)=>{
15
+ (0, _reactutilities.assertSlots)(state);
16
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.popover, {
17
+ children: [
18
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpopover.PopoverTrigger, {
19
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
20
+ }),
21
+ /*#__PURE__*/ (0, _jsxruntime.jsx)(state.info, {})
22
+ ]
23
+ });
25
24
  };
26
- exports.renderInfoButton_unstable = renderInfoButton_unstable;
27
- //# sourceMappingURL=renderInfoButton.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AAIA;;;AAGO,MAAMA,yBAAyB,GAAIC,KAAsB,IAAI;EAClE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGC,0BAAQ,CAAkBH,KAAK,CAAC;EAE7D,OACEI,oBAACH,KAAK,CAACI,OAAO;IAAA,GAAMH,SAAS,CAACG;EAAwB,GACpDD,oBAACE,8BAAc,QACbF,oBAACH,KAAK,CAACM,IAAI;IAAA,GAAKL,SAAS,CAACK;EAAI,EAAI,CACnB,EACjBH,oBAACH,KAAK,CAACO,OAAO;IAAA,GAAKN,SAAS,CAACM;EAAO,EAAI,CAC1B;AAEpB,CAAC;AAXYC,iCAAyB","names":["renderInfoButton_unstable","state","slots","slotProps","react_utilities_1","React","popover","react_popover_1","root","content","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/components/InfoButton/renderInfoButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { PopoverTrigger } from '@fluentui/react-popover';\nimport type { PopoverProps } from '@fluentui/react-popover';\nimport type { InfoButtonState, InfoButtonSlots } from './InfoButton.types';\n\n/**\n * Render the final JSX of InfoButton\n */\nexport const renderInfoButton_unstable = (state: InfoButtonState) => {\n const { slots, slotProps } = getSlots<InfoButtonSlots>(state);\n\n return (\n <slots.popover {...(slotProps.popover as PopoverProps)}>\n <PopoverTrigger>\n <slots.root {...slotProps.root} />\n </PopoverTrigger>\n <slots.content {...slotProps.content} />\n </slots.popover>\n );\n};\n"]}
1
+ {"version":3,"sources":["renderInfoButton.js"],"sourcesContent":[" import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-utilities';\nimport { PopoverTrigger } from '@fluentui/react-popover';\n/**\n * Render the final JSX of InfoButton\n */ export const renderInfoButton_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ _jsxs(state.popover, {\n children: [\n /*#__PURE__*/ _jsx(PopoverTrigger, {\n children: /*#__PURE__*/ _jsx(state.root, {})\n }),\n /*#__PURE__*/ _jsx(state.info, {})\n ]\n });\n};\n"],"names":["renderInfoButton_unstable","state","assertSlots","_jsxs","popover","children","_jsx","PopoverTrigger","root","info"],"mappings":";;;;+BAKiBA;;;eAAAA;;;4BAL4B;gCACjB;8BACG;AAGpB,MAAMA,4BAA4B,CAACC;IAC1CC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,gBAAK,EAACF,MAAMG,OAAO,EAAE;QACtCC,UAAU;YACN,WAAW,GAAGC,IAAAA,eAAI,EAACC,4BAAc,EAAE;gBAC/BF,UAAU,WAAW,GAAGC,IAAAA,eAAI,EAACL,MAAMO,IAAI,EAAE,CAAC;YAC9C;YACA,WAAW,GAAGF,IAAAA,eAAI,EAACL,MAAMQ,IAAI,EAAE,CAAC;SACnC;IACL;AACJ"}
@@ -1,74 +1,85 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.useInfoButton_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const DefaultInfoButtonIcons_1 = /*#__PURE__*/require("./DefaultInfoButtonIcons");
9
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
10
- const react_popover_1 = /*#__PURE__*/require("@fluentui/react-popover");
11
- const react_utilities_2 = /*#__PURE__*/require("@fluentui/react-utilities");
5
+ Object.defineProperty(exports, "useInfoButton_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useInfoButton_unstable;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _DefaultInfoButtonIcons = require("./DefaultInfoButtonIcons");
14
+ const _reactutilities = require("@fluentui/react-utilities");
15
+ const _reactportal = require("@fluentui/react-portal");
16
+ const _reactpopover = require("@fluentui/react-popover");
12
17
  const infoButtonIconMap = {
13
- small: /*#__PURE__*/React.createElement(DefaultInfoButtonIcons_1.DefaultInfoButtonIcon12, null),
14
- medium: /*#__PURE__*/React.createElement(DefaultInfoButtonIcons_1.DefaultInfoButtonIcon16, null),
15
- large: /*#__PURE__*/React.createElement(DefaultInfoButtonIcons_1.DefaultInfoButtonIcon20, null)
18
+ small: /*#__PURE__*/ _react.createElement(_DefaultInfoButtonIcons.DefaultInfoButtonIcon12, null),
19
+ medium: /*#__PURE__*/ _react.createElement(_DefaultInfoButtonIcons.DefaultInfoButtonIcon16, null),
20
+ large: /*#__PURE__*/ _react.createElement(_DefaultInfoButtonIcons.DefaultInfoButtonIcon20, null)
16
21
  };
17
22
  const popoverSizeMap = {
18
- small: 'small',
19
- medium: 'small',
20
- large: 'medium'
23
+ small: 'small',
24
+ medium: 'small',
25
+ large: 'medium'
21
26
  };
22
- /**
23
- * Create the state required to render InfoButton.
24
- *
25
- * The returned state can be modified with hooks such as useInfoButtonStyles_unstable,
26
- * before being passed to renderInfoButton_unstable.
27
- *
28
- * @param props - props from this instance of InfoButton
29
- * @param ref - reference to root HTMLElement of InfoButton
30
- */
31
- const useInfoButton_unstable = (props, ref) => {
32
- const {
33
- size = 'medium'
34
- } = props;
35
- const state = {
36
- size,
37
- components: {
38
- root: 'button',
39
- popover: react_popover_1.Popover,
40
- content: react_popover_1.PopoverSurface
41
- },
42
- root: react_utilities_1.getNativeElementProps('button', {
43
- children: infoButtonIconMap[size],
44
- type: 'button',
45
- ...props,
46
- ref
47
- }),
48
- popover: react_utilities_1.resolveShorthand(props.popover, {
49
- required: true,
50
- defaultProps: {
51
- children: React.createElement(React.Fragment, null),
52
- positioning: 'above-start',
53
- size: popoverSizeMap[size],
54
- withArrow: true
55
- }
56
- }),
57
- content: react_utilities_1.resolveShorthand(props.content, {
58
- required: true,
59
- defaultProps: {
60
- role: 'dialog'
61
- }
62
- })
63
- };
64
- const [popoverOpen, setPopoverOpen] = react_utilities_2.useControllableState({
65
- state: state.popover.open,
66
- defaultState: state.popover.defaultOpen,
67
- initialState: false
68
- });
69
- state.popover.open = popoverOpen;
70
- state.popover.onOpenChange = react_utilities_1.mergeCallbacks(state.popover.onOpenChange, (e, data) => setPopoverOpen(data.open));
71
- return state;
27
+ const useInfoButton_unstable = (props, ref)=>{
28
+ const { size = 'medium', inline = true } = props;
29
+ const state = {
30
+ inline,
31
+ size,
32
+ components: {
33
+ root: 'button',
34
+ popover: _reactpopover.Popover,
35
+ info: _reactpopover.PopoverSurface
36
+ },
37
+ root: _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('button', {
38
+ children: infoButtonIconMap[size],
39
+ type: 'button',
40
+ 'aria-label': 'information',
41
+ ...props,
42
+ ref
43
+ }), {
44
+ elementType: 'button'
45
+ }),
46
+ popover: _reactutilities.slot.always(props.popover, {
47
+ defaultProps: {
48
+ inline,
49
+ positioning: 'above-start',
50
+ size: popoverSizeMap[size],
51
+ withArrow: true
52
+ },
53
+ elementType: _reactpopover.Popover
54
+ }),
55
+ info: _reactutilities.slot.always(props.info, {
56
+ defaultProps: {
57
+ role: 'note',
58
+ tabIndex: -1
59
+ },
60
+ elementType: _reactpopover.PopoverSurface
61
+ })
62
+ };
63
+ const [popoverOpen, setPopoverOpen] = (0, _reactutilities.useControllableState)({
64
+ state: state.popover.open,
65
+ defaultState: state.popover.defaultOpen,
66
+ initialState: false
67
+ });
68
+ state.popover.open = popoverOpen;
69
+ state.popover.onOpenChange = (0, _reactutilities.mergeCallbacks)(state.popover.onOpenChange, (e, data)=>setPopoverOpen(data.open));
70
+ const focusOutRef = _react.useCallback((el)=>{
71
+ if (!el) {
72
+ return;
73
+ }
74
+ el.addEventListener('focusout', (e)=>{
75
+ const nextFocused = e.relatedTarget;
76
+ if ((0, _reactutilities.isHTMLElement)(nextFocused) && !(0, _reactportal.elementContains)(el, nextFocused)) {
77
+ setPopoverOpen(false);
78
+ }
79
+ });
80
+ }, [
81
+ setPopoverOpen
82
+ ]);
83
+ state.info.ref = (0, _reactutilities.useMergedRefs)(state.info.ref, focusOutRef);
84
+ return state;
72
85
  };
73
- exports.useInfoButton_unstable = useInfoButton_unstable;
74
- //# sourceMappingURL=useInfoButton.js.map
@@ -1 +1 @@
1
- {"version":3,"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAGA,MAAMA,iBAAiB,GAAG;EACxBC,KAAK,eAAEC,oBAACC,gDAAuB,OAAG;EAClCC,MAAM,eAAEF,oBAACC,gDAAuB,OAAG;EACnCE,KAAK,eAAEH,oBAACC,gDAAuB;CACvB;AAEV,MAAMG,cAAc,GAAG;EACrBL,KAAK,EAAE,OAAO;EACdG,MAAM,EAAE,OAAO;EACfC,KAAK,EAAE;CACC;AAEV;;;;;;;;;AASO,MAAME,sBAAsB,GAAG,CAACC,KAAsB,EAAEC,GAA2B,KAAqB;EAC7G,MAAM;IAAEC,IA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InfoButton_unstable","props","ref","size","state","components","root","popover","react_popover_1","content","react_utilities_1","children","type","required","defaultProps","positioning","withArrow","role","popoverOpen","setPopoverOpen","react_utilities_2","open","defaultState","defaultOpen","initialState","onOpenChange","e","data","exports"],"sourceRoot":"../src/","sources":["packages/react-components/react-infobutton/src/components/InfoButton/useInfoButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport { getNativeElementProps, mergeCallbacks, resolveShorthand } from '@fluentui/react-utilities';\nimport { Popover, PopoverSurface } from '@fluentui/react-popover';\nimport { useControllableState } from '@fluentui/react-utilities';\nimport type { InfoButtonProps, InfoButtonState } from './InfoButton.types';\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 HTMLElement of InfoButton\n */\nexport const useInfoButton_unstable = (props: InfoButtonProps, ref: React.Ref<HTMLElement>): InfoButtonState => {\n const { size = 'medium' } = props;\n\n const state: InfoButtonState = {\n size,\n\n components: {\n root: 'button',\n popover: Popover,\n content: PopoverSurface,\n },\n\n root: getNativeElementProps('button', {\n children: infoButtonIconMap[size],\n type: 'button',\n ...props,\n ref,\n }),\n popover: resolveShorthand(props.popover, {\n required: true,\n defaultProps: {\n children: <></>,\n positioning: 'above-start',\n size: popoverSizeMap[size],\n withArrow: true,\n },\n }),\n content: resolveShorthand(props.content, {\n required: true,\n defaultProps: {\n role: 'dialog',\n },\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 return state;\n};\n"]}
1
+ {"version":3,"sources":["useInfoButton.js"],"sourcesContent":["import * as React from 'react';\nimport { DefaultInfoButtonIcon12, DefaultInfoButtonIcon16, DefaultInfoButtonIcon20 } from './DefaultInfoButtonIcons';\nimport { getNativeElementProps, mergeCallbacks, useControllableState, slot, useMergedRefs, isHTMLElement } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\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 HTMLElement of InfoButton\n */ export const useInfoButton_unstable = (props, ref)=>{\n const { size = 'medium', inline = true } = props;\n const state = {\n inline,\n size,\n components: {\n root: 'button',\n popover: Popover,\n info: PopoverSurface\n },\n root: slot.always(getNativeElementProps('button', {\n children: infoButtonIconMap[size],\n type: 'button',\n 'aria-label': 'information',\n ...props,\n ref\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 focusOutRef = React.useCallback((el)=>{\n if (!el) {\n return;\n }\n el.addEventListener('focusout', (e)=>{\n const nextFocused = e.relatedTarget;\n if (isHTMLElement(nextFocused) && !elementContains(el, nextFocused)) {\n setPopoverOpen(false);\n }\n });\n }, [\n setPopoverOpen\n ]);\n state.info.ref = useMergedRefs(state.info.ref, focusOutRef);\n return state;\n};\n"],"names":["useInfoButton_unstable","infoButtonIconMap","small","React","createElement","DefaultInfoButtonIcon12","medium","DefaultInfoButtonIcon16","large","DefaultInfoButtonIcon20","popoverSizeMap","props","ref","size","inline","state","components","root","popover","Popover","info","PopoverSurface","slot","always","getNativeElementProps","children","type","elementType","defaultProps","positioning","withArrow","role","tabIndex","popoverOpen","setPopoverOpen","useControllableState","open","defaultState","defaultOpen","initialState","onOpenChange","mergeCallbacks","e","data","focusOutRef","useCallback","el","addEventListener","nextFocused","relatedTarget","isHTMLElement","elementContains","useMergedRefs"],"mappings":";;;;+BAuBiBA;;;eAAAA;;;;iEAvBM;wCACmE;gCACsB;6BAChF;8BACQ;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,EAAEC,OAAO,QAAQ,EAAEC,SAAS,IAAI,EAAE,GAAGH;IAC3C,MAAMI,QAAQ;QACVD;QACAD;QACAG,YAAY;YACRC,MAAM;YACNC,SAASC,qBAAO;YAChBC,MAAMC,4BAAc;QACxB;QACAJ,MAAMK,oBA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