@fluentui/react-popover 0.0.0-nightlyfe9829e48120211112.1 → 0.0.0-nightlyff78d1e27a20220217.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. package/CHANGELOG.json +332 -31
  2. package/CHANGELOG.md +78 -15
  3. package/dist/react-popover.d.ts +29 -20
  4. package/lib/Popover.js.map +1 -1
  5. package/lib/PopoverSurface.js.map +1 -1
  6. package/lib/PopoverTrigger.js.map +1 -1
  7. package/lib/components/Popover/Popover.js +4 -4
  8. package/lib/components/Popover/Popover.js.map +1 -1
  9. package/lib/components/Popover/Popover.types.d.ts +2 -1
  10. package/lib/components/Popover/Popover.types.js.map +1 -1
  11. package/lib/components/Popover/index.js.map +1 -1
  12. package/lib/components/Popover/renderPopover.d.ts +1 -1
  13. package/lib/components/Popover/renderPopover.js +1 -1
  14. package/lib/components/Popover/renderPopover.js.map +1 -1
  15. package/lib/components/Popover/usePopover.d.ts +2 -2
  16. package/lib/components/Popover/usePopover.js +4 -3
  17. package/lib/components/Popover/usePopover.js.map +1 -1
  18. package/lib/components/PopoverSurface/PopoverSurface.js +6 -6
  19. package/lib/components/PopoverSurface/PopoverSurface.js.map +1 -1
  20. package/lib/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  21. package/lib/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  22. package/lib/components/PopoverSurface/index.js.map +1 -1
  23. package/lib/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  24. package/lib/components/PopoverSurface/renderPopoverSurface.js +4 -4
  25. package/lib/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  26. package/lib/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  27. package/lib/components/PopoverSurface/usePopoverSurface.js +16 -16
  28. package/lib/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  29. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -1
  30. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js +29 -18
  31. package/lib/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  32. package/lib/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  33. package/lib/components/PopoverTrigger/PopoverTrigger.js +5 -4
  34. package/lib/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  35. package/lib/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  36. package/lib/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  37. package/lib/components/PopoverTrigger/index.js.map +1 -1
  38. package/lib/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  39. package/lib/components/PopoverTrigger/renderPopoverTrigger.js +1 -1
  40. package/lib/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  41. package/lib/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  42. package/lib/components/PopoverTrigger/usePopoverTrigger.js +33 -40
  43. package/lib/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  44. package/lib/index.js.map +1 -1
  45. package/lib/popoverContext.d.ts +1 -1
  46. package/lib/popoverContext.js +1 -1
  47. package/lib/popoverContext.js.map +1 -1
  48. package/lib-commonjs/Popover.js.map +1 -1
  49. package/lib-commonjs/PopoverSurface.js.map +1 -1
  50. package/lib-commonjs/PopoverTrigger.js.map +1 -1
  51. package/lib-commonjs/components/Popover/Popover.js +2 -2
  52. package/lib-commonjs/components/Popover/Popover.js.map +1 -1
  53. package/lib-commonjs/components/Popover/Popover.types.d.ts +2 -1
  54. package/lib-commonjs/components/Popover/Popover.types.js.map +1 -1
  55. package/lib-commonjs/components/Popover/index.js.map +1 -1
  56. package/lib-commonjs/components/Popover/renderPopover.d.ts +1 -1
  57. package/lib-commonjs/components/Popover/renderPopover.js +3 -3
  58. package/lib-commonjs/components/Popover/renderPopover.js.map +1 -1
  59. package/lib-commonjs/components/Popover/usePopover.d.ts +2 -2
  60. package/lib-commonjs/components/Popover/usePopover.js +6 -5
  61. package/lib-commonjs/components/Popover/usePopover.js.map +1 -1
  62. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js +3 -3
  63. package/lib-commonjs/components/PopoverSurface/PopoverSurface.js.map +1 -1
  64. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.d.ts +2 -2
  65. package/lib-commonjs/components/PopoverSurface/PopoverSurface.types.js.map +1 -1
  66. package/lib-commonjs/components/PopoverSurface/index.js.map +1 -1
  67. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.d.ts +1 -1
  68. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js +6 -7
  69. package/lib-commonjs/components/PopoverSurface/renderPopoverSurface.js.map +1 -1
  70. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.d.ts +4 -5
  71. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js +18 -18
  72. package/lib-commonjs/components/PopoverSurface/usePopoverSurface.js.map +1 -1
  73. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.d.ts +1 -1
  74. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js +36 -23
  75. package/lib-commonjs/components/PopoverSurface/usePopoverSurfaceStyles.js.map +1 -1
  76. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.d.ts +2 -1
  77. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js +3 -2
  78. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.js.map +1 -1
  79. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.d.ts +9 -2
  80. package/lib-commonjs/components/PopoverTrigger/PopoverTrigger.types.js.map +1 -1
  81. package/lib-commonjs/components/PopoverTrigger/index.js.map +1 -1
  82. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.d.ts +1 -1
  83. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js +3 -3
  84. package/lib-commonjs/components/PopoverTrigger/renderPopoverTrigger.js.map +1 -1
  85. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.d.ts +2 -2
  86. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js +33 -40
  87. package/lib-commonjs/components/PopoverTrigger/usePopoverTrigger.js.map +1 -1
  88. package/lib-commonjs/index.js.map +1 -1
  89. package/lib-commonjs/popoverContext.d.ts +1 -1
  90. package/lib-commonjs/popoverContext.js +3 -3
  91. package/lib-commonjs/popoverContext.js.map +1 -1
  92. package/package.json +13 -15
  93. package/lib/common/isConformant.d.ts +0 -4
  94. package/lib/common/isConformant.js +0 -13
  95. package/lib/common/isConformant.js.map +0 -1
  96. package/lib/common/mockUsePopoverContext.d.ts +0 -7
  97. package/lib/common/mockUsePopoverContext.js +0 -31
  98. package/lib/common/mockUsePopoverContext.js.map +0 -1
  99. package/lib-commonjs/common/isConformant.d.ts +0 -4
  100. package/lib-commonjs/common/isConformant.js +0 -24
  101. package/lib-commonjs/common/isConformant.js.map +0 -1
  102. package/lib-commonjs/common/mockUsePopoverContext.d.ts +0 -7
  103. package/lib-commonjs/common/mockUsePopoverContext.js +0 -41
  104. package/lib-commonjs/common/mockUsePopoverContext.js.map +0 -1
@@ -1,4 +1,6 @@
1
- import { __styles, mergeClasses } from '@fluentui/react-make-styles';
1
+ import { shorthands, __styles, mergeClasses } from '@griffel/react';
2
+ import { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';
3
+ import { tokens } from '@fluentui/react-theme';
2
4
  export const popoverSurfaceClassName = 'fui-PopoverSurface';
3
5
  export const arrowHeights = {
4
6
  small: 6,
@@ -12,8 +14,11 @@ export const arrowHeights = {
12
14
  const useStyles = /*#__PURE__*/__styles({
13
15
  "root": {
14
16
  "De3pzq": "fxugw4r",
15
- "E5pizo": ["f1hg901r", "f136t921"],
16
- "Dimara": "ff3glw6",
17
+ "E5pizo": "f1hg901r",
18
+ "Bbmb7ep": ["fff7au0", "f1bjk9e1"],
19
+ "Beyfa6y": ["f1bjk9e1", "fff7au0"],
20
+ "B7oj6ja": ["fwsfkhu", "f8wkphi"],
21
+ "Btl43ni": ["f8wkphi", "fwsfkhu"],
17
22
  "B4j52fo": "f5ogflp",
18
23
  "Bekrc4i": ["f1hqa2wf", "finvdd3"],
19
24
  "Bn0qgzm": "f1f09k3d",
@@ -54,45 +59,51 @@ const useStyles = /*#__PURE__*/__styles({
54
59
  "uwmqm3": ["fekwl8i", "fat0sn4"]
55
60
  },
56
61
  "smallArrow": {
57
- "a9b677": "f1smug5u",
58
- "Bqenvij": "f11ci07v"
62
+ "a9b677": "f1ekdpwm",
63
+ "Bqenvij": "f83vc9z"
59
64
  },
60
65
  "mediumLargeArrow": {
61
- "a9b677": "ftmg478",
62
- "Bqenvij": "f7bsbfx"
66
+ "a9b677": "f1kmc0fn",
67
+ "Bqenvij": "fb6lvc5"
63
68
  },
64
69
  "arrow": {
65
70
  "qhf8xq": "f1euv43f",
66
- "ayd6f0": "f1uo6wrk",
71
+ "De3pzq": "f1u2r49w",
67
72
  "Bcdw1i0": "fd7fpy0",
68
73
  "Bj3rh1h": "f1bsuimh",
69
74
  "rurcny": "fuzzvh5",
70
- "zf3lio": "f1qudtws",
75
+ "Bex5imi": "fkk33zh",
71
76
  "xx9plb": "fxf9f1y",
77
+ "Bmqnesq": "f170vdtw",
72
78
  "Bdn98qo": "f103af6e",
73
79
  "Bbc2r3f": "f15umuo5",
74
- "B4zgs9e": "ffo048g",
75
- "Bex5imi": "fkk33zh",
80
+ "B1dvbpk": "f3wpjpt",
81
+ "D4ky5z": "f1k3tce7",
82
+ "cqycoz": "f1dkdgqi",
83
+ "I89eb": "f5ghsz",
84
+ "k1i1uq": "fyqop9u",
85
+ "Epwjcz": "f1m5ya7j",
86
+ "Bp1vogq": "f3sp63x",
76
87
  "px8gyy": ["f5bg3dr", "f1rfdd74"],
77
- "h6z6rw": ["fzd2j21", "f2549he"],
78
- "hl6cv3": "fotnskf",
88
+ "h6z6rw": "fzd2j21",
89
+ "hl6cv3": "f1773hnp",
79
90
  "Bh2vraf": "f1n8855c",
80
- "yayu3t": ["f1nq055x", "f13ohf3"],
91
+ "yayu3t": "f1v7783n",
81
92
  "wedwtw": "fsw6im5",
82
- "rhl9o9": "ftghsr9",
93
+ "rhl9o9": "fh2hsk5",
83
94
  "Bu8t5uz": "f159pzir",
84
- "B6q6orb": ["f1l8vbt4", "fsxzh25"],
95
+ "B6q6orb": "f11yvu4",
85
96
  "Bwwlvwl": "fm1ycve"
86
97
  }
87
98
  }, {
88
- "d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".f136t921{box-shadow:var(--shadow-16);}", ".ff3glw6{border-radius:4px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1smug5u{width:8.485281374238571px;}", ".f11ci07v{height:8.485281374238571px;}", ".ftmg478{width:11.313708498984761px;}", ".f7bsbfx{height:11.313708498984761px;}", ".f1euv43f{position:absolute;}", ".f1uo6wrk{background:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".f1qudtws:before{border-radius:4px;}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".ffo048g:before{background:inherit;}", ".fkk33zh:before{visibility:visible;}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", ".f2549he:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1nq055x{left:0;}", "[data-popper-placement^=\"right\"] .f13ohf3{right:0;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .ftghsr9{top:0;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f1l8vbt4{right:0;}", "[data-popper-placement^=\"left\"] .fsxzh25{left:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
99
+ "d": [".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f1hg901r{box-shadow:var(--shadow16);}", ".fff7au0{border-bottom-right-radius:4px;}", ".f1bjk9e1{border-bottom-left-radius:4px;}", ".fwsfkhu{border-top-right-radius:4px;}", ".f8wkphi{border-top-left-radius:4px;}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f1c73kur{background-color:var(--colorNeutralForeground1);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".ffp7eso{background-color:var(--colorBrandBackground);}", ".f1kcqot9{padding-top:12px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fpe6lb7{padding-bottom:12px;}", ".fqag9an{padding-top:16px;}", ".f1gbmcue{padding-right:16px;}", ".f1rh9g5y{padding-left:16px;}", ".fp67ikv{padding-bottom:16px;}", ".fc7z3ec{padding-top:20px;}", ".fat0sn4{padding-right:20px;}", ".fekwl8i{padding-left:20px;}", ".fe2my4m{padding-bottom:20px;}", ".f1ekdpwm{width:8.484px;}", ".f83vc9z{height:8.484px;}", ".f1kmc0fn{width:11.312px;}", ".fb6lvc5{height:11.312px;}", ".f1euv43f{position:absolute;}", ".f1u2r49w{background-color:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".fkk33zh:before{visibility:visible;}", ".fxf9f1y:before{position:absolute;}", ".f170vdtw:before{box-sizing:border-box;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".f3wpjpt:before{background-color:inherit;}", ".f1k3tce7:before{border-right-width:1px;}", ".f1dkdgqi:before{border-right-style:solid;}", ".f5ghsz:before{border-right-color:var(--colorTransparentStroke);}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f3sp63x:before{border-bottom-color:var(--colorTransparentStroke);}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", "[data-popper-placement^=\"top\"] .f1773hnp{bottom:-1px;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1v7783n{left:-1px;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .fh2hsk5{top:-1px;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f11yvu4{right:-1px;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
89
100
  });
90
101
  /**
91
102
  * Apply styling to the PopoverSurface slots based on the state
92
103
  */
93
104
 
94
105
 
95
- export const usePopoverSurfaceStyles = state => {
106
+ export const usePopoverSurfaceStyles_unstable = state => {
96
107
  const styles = useStyles();
97
108
  state.root.className = mergeClasses(popoverSurfaceClassName, styles.root, state.size === 'small' && styles.smallPadding, state.size === 'medium' && styles.mediumPadding, state.size === 'large' && styles.largePadding, state.appearance === 'inverted' && styles.inverted, state.appearance === 'brand' && styles.brand, state.root.className);
98
109
  state.arrowClassName = mergeClasses(styles.arrow, state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverSurface/usePopoverSurfaceStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAIA,OAAO,MAAM,uBAAuB,GAAG,oBAAhC;AAEP,OAAO,MAAM,YAAY,GAAgC;AACv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EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YAHA,EAIjC,KAAK,CAAC,IAAN,KAAe,QAAf,IAA2B,MAAM,CAAC,aAJD,EAKjC,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,MAAM,CAAC,YALA,EAMjC,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QANT,EAOjC,KAAK,CAAC,UAAN,KAAqB,OAArB,IAAgC,MAAM,CAAC,KAPN,EAQjC,KAAK,CAAC,IAAN,CAAW,SARsB,CAAnC;AAWA,EAAA,KAAK,CAAC,cAAN,GAAuB,YAAY,CACjC,MAAM,CAAC,KAD0B,EAEjC,KAAK,CAAC,IAAN,KAAe,OAAf,GAAyB,MAAM,CAAC,UAAhC,GAA6C,MAAM,CAAC,gBAFnB,CAAnC;AAKA,SAAO,KAAP;AACD,CAnBM","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowHeightStyles, createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport type { PopoverSize } from '../Popover/Popover.types';\nimport type { PopoverSurfaceState } from './PopoverSurface.types';\n\nexport const popoverSurfaceClassName = 'fui-PopoverSurface';\n\nexport const arrowHeights: Record<PopoverSize, number> = {\n small: 6,\n medium: 8,\n large: 8,\n};\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n backgroundColor: tokens.colorNeutralBackground1,\n boxShadow: tokens.shadow16,\n ...shorthands.borderRadius('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n\n inverted: {\n // TODO: neutral background inverted missing from superset and theme\n backgroundColor: tokens.colorNeutralForeground1,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n brand: {\n backgroundColor: tokens.colorBrandBackground,\n // TODO: clarify with designers what foreground color should be with brand background,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n smallPadding: {\n ...shorthands.padding('12px'),\n },\n\n mediumPadding: {\n ...shorthands.padding('16px'),\n },\n\n largePadding: {\n ...shorthands.padding('20px'),\n },\n\n smallArrow: createArrowHeightStyles(arrowHeights.small),\n mediumLargeArrow: createArrowHeightStyles(arrowHeights.medium),\n arrow: createArrowStyles({ arrowHeight: undefined }),\n});\n\n/**\n * Apply styling to the PopoverSurface slots based on the state\n */\nexport const usePopoverSurfaceStyles_unstable = (state: PopoverSurfaceState): PopoverSurfaceState => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n popoverSurfaceClassName,\n styles.root,\n state.size === 'small' && styles.smallPadding,\n state.size === 'medium' && styles.mediumPadding,\n state.size === 'large' && styles.largePadding,\n state.appearance === 'inverted' && styles.inverted,\n state.appearance === 'brand' && styles.brand,\n state.root.className,\n );\n\n state.arrowClassName = mergeClasses(\n styles.arrow,\n state.size === 'small' ? styles.smallArrow : styles.mediumLargeArrow,\n );\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
2
3
  import type { PopoverTriggerProps } from './PopoverTrigger.types';
3
4
  /**
4
5
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
5
6
  */
6
- export declare const PopoverTrigger: React.FC<PopoverTriggerProps>;
7
+ export declare const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent;
@@ -1,12 +1,13 @@
1
- import { usePopoverTrigger } from './usePopoverTrigger';
2
- import { renderPopoverTrigger } from './renderPopoverTrigger';
1
+ import { usePopoverTrigger_unstable } from './usePopoverTrigger';
2
+ import { renderPopoverTrigger_unstable } from './renderPopoverTrigger';
3
3
  /**
4
4
  * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.
5
5
  */
6
6
 
7
7
  export const PopoverTrigger = props => {
8
- const state = usePopoverTrigger(props);
9
- return renderPopoverTrigger(state);
8
+ const state = usePopoverTrigger_unstable(props);
9
+ return renderPopoverTrigger_unstable(state);
10
10
  };
11
11
  PopoverTrigger.displayName = 'PopoverTrigger';
12
+ PopoverTrigger.isFluentTriggerComponent = true;
12
13
  //# sourceMappingURL=PopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AAGA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAAkC,KAAK,IAAG;AACnE,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,CAA/B;AAEA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/PopoverTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,GAA2D,KAAK,IAAG;AAC5F,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,CAAxC;AAEA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CAJM;AAMP,cAAc,CAAC,WAAf,GAA6B,gBAA7B;AACA,cAAc,CAAC,wBAAf,GAA0C,IAA1C","sourcesContent":["import * as React from 'react';\nimport { usePopoverTrigger_unstable } from './usePopoverTrigger';\nimport { renderPopoverTrigger_unstable } from './renderPopoverTrigger';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\nimport type { PopoverTriggerProps } from './PopoverTrigger.types';\n\n/**\n * Wraps a trigger element as an only child and adds the necessary event handling to open a popover.\n */\nexport const PopoverTrigger: React.FC<PopoverTriggerProps> & FluentTriggerComponent = props => {\n const state = usePopoverTrigger_unstable(props);\n\n return renderPopoverTrigger_unstable(state);\n};\n\nPopoverTrigger.displayName = 'PopoverTrigger';\nPopoverTrigger.isFluentTriggerComponent = true;\n"],"sourceRoot":"../src/"}
@@ -3,9 +3,16 @@ import * as React from 'react';
3
3
  * PopoverTrigger Props
4
4
  */
5
5
  export declare type PopoverTriggerProps = {
6
- children: React.ReactElement;
6
+ children: (React.ReactElement & {
7
+ ref?: React.Ref<unknown>;
8
+ }) | ((props: PopoverTriggerChildProps) => React.ReactElement | null);
7
9
  };
8
10
  /**
9
11
  * PopoverTrigger State
10
12
  */
11
- export declare type PopoverTriggerState = PopoverTriggerProps;
13
+ export declare type PopoverTriggerState = {
14
+ children: React.ReactElement | null;
15
+ };
16
+ export declare type PopoverTriggerChildProps = {
17
+ ref?: React.Ref<never>;
18
+ } & Pick<React.HTMLAttributes<HTMLElement>, 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'>;
@@ -1 +1 @@
1
- {"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"","sources":["../../../src/components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"PopoverTrigger.types.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/PopoverTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\n/**\n * PopoverTrigger Props\n */\nexport type PopoverTriggerProps = {\n children:\n | (React.ReactElement & { ref?: React.Ref<unknown> })\n | ((props: PopoverTriggerChildProps) => React.ReactElement | null);\n};\n\n/**\n * PopoverTrigger State\n */\nexport type PopoverTriggerState = {\n children: React.ReactElement | null;\n};\n\nexport type PopoverTriggerChildProps = {\n ref?: React.Ref<never>;\n} & Pick<\n React.HTMLAttributes<HTMLElement>,\n 'aria-haspopup' | 'onClick' | 'onMouseEnter' | 'onKeyDown' | 'onMouseLeave' | 'onContextMenu'\n>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/PopoverTrigger/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/PopoverTrigger/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './PopoverTrigger';\nexport * from './PopoverTrigger.types';\nexport * from './renderPopoverTrigger';\nexport * from './usePopoverTrigger';\n"]}
@@ -2,4 +2,4 @@ import type { PopoverTriggerState } from './PopoverTrigger.types';
2
2
  /**
3
3
  * Render the final JSX of PopoverTrigger
4
4
  */
5
- export declare const renderPopoverTrigger: (state: PopoverTriggerState) => JSX.Element;
5
+ export declare const renderPopoverTrigger_unstable: (state: PopoverTriggerState) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Render the final JSX of PopoverTrigger
3
3
  */
4
- export const renderPopoverTrigger = state => {
4
+ export const renderPopoverTrigger_unstable = state => {
5
5
  return state.children;
6
6
  };
7
7
  //# sourceMappingURL=renderPopoverTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA4C;AAC9E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourceRoot":""}
1
+ {"version":3,"sources":["components/PopoverTrigger/renderPopoverTrigger.tsx"],"names":[],"mappings":"AAEA;;AAEG;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,SAAO,KAAK,CAAC,QAAb;AACD,CAFM","sourcesContent":["import type { PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Render the final JSX of PopoverTrigger\n */\nexport const renderPopoverTrigger_unstable = (state: PopoverTriggerState) => {\n return state.children;\n};\n"],"sourceRoot":"../src/"}
@@ -3,8 +3,8 @@ import type { PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.
3
3
  * Create the state required to render PopoverTrigger.
4
4
  *
5
5
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
6
- * before being passed to renderPopoverTrigger.
6
+ * before being passed to renderPopoverTrigger_unstable.
7
7
  *
8
8
  * @param props - props from this instance of PopoverTrigger
9
9
  */
10
- export declare const usePopoverTrigger: (props: PopoverTriggerProps) => PopoverTriggerState;
10
+ export declare const usePopoverTrigger_unstable: (props: PopoverTriggerProps) => PopoverTriggerState;
@@ -1,47 +1,48 @@
1
1
  import * as React from 'react';
2
- import { useMergedRefs, useEventCallback, shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';
2
+ import { applyTriggerPropsToChildren, getTriggerChild, shouldPreventDefaultOnKeyDown, useMergedRefs, useMergedEventCallbacks, useEventCallback } from '@fluentui/react-utilities';
3
3
  import { useModalAttributes } from '@fluentui/react-tabster';
4
- import { usePopoverContext } from '../../popoverContext';
4
+ import { usePopoverContext_unstable } from '../../popoverContext';
5
5
  /**
6
6
  * Create the state required to render PopoverTrigger.
7
7
  *
8
8
  * The returned state can be modified with hooks such as usePopoverTriggerStyles,
9
- * before being passed to renderPopoverTrigger.
9
+ * before being passed to renderPopoverTrigger_unstable.
10
10
  *
11
11
  * @param props - props from this instance of PopoverTrigger
12
12
  */
13
13
 
14
- export const usePopoverTrigger = props => {
15
- const setOpen = usePopoverContext(context => context.setOpen);
16
- const open = usePopoverContext(context => context.open);
17
- const triggerRef = usePopoverContext(context => context.triggerRef);
18
- const openOnHover = usePopoverContext(context => context.openOnHover);
19
- const openOnContext = usePopoverContext(context => context.openOnContext);
20
- const trapFocus = usePopoverContext(context => context.trapFocus);
14
+ export const usePopoverTrigger_unstable = props => {
15
+ var _a, _b, _c, _d, _e;
16
+
17
+ const {
18
+ children
19
+ } = props;
20
+ const child = /*#__PURE__*/React.isValidElement(children) ? getTriggerChild(children) : undefined;
21
+ const setOpen = usePopoverContext_unstable(context => context.setOpen);
22
+ const open = usePopoverContext_unstable(context => context.open);
23
+ const triggerRef = usePopoverContext_unstable(context => context.triggerRef);
24
+ const openOnHover = usePopoverContext_unstable(context => context.openOnHover);
25
+ const openOnContext = usePopoverContext_unstable(context => context.openOnContext);
26
+ const trapFocus = usePopoverContext_unstable(context => context.trapFocus);
21
27
  const {
22
28
  triggerAttributes
23
29
  } = useModalAttributes();
24
- const onContextMenu = useEventCallback(e => {
25
- var _a, _b;
26
30
 
31
+ const onContextMenu = e => {
27
32
  if (openOnContext) {
28
33
  e.preventDefault();
29
34
  setOpen(e, true);
30
35
  }
36
+ };
31
37
 
32
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onContextMenu) === null || _b === void 0 ? void 0 : _b.call(_a, e);
33
- });
34
- const onClick = useEventCallback(e => {
35
- var _a, _b;
36
-
38
+ const onClick = e => {
37
39
  if (!openOnContext) {
38
40
  setOpen(e, !open);
39
41
  }
42
+ };
40
43
 
41
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a, e);
42
- });
43
- const onKeyDown = useEventCallback(e => {
44
- var _a, _b, _c;
44
+ const onKeyDown = e => {
45
+ var _a;
45
46
 
46
47
  if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {
47
48
  e.preventDefault();
@@ -51,38 +52,30 @@ export const usePopoverTrigger = props => {
51
52
  if (e.key === 'Escape') {
52
53
  setOpen(e, false);
53
54
  }
55
+ };
54
56
 
55
- (_c = (_b = child.props) === null || _b === void 0 ? void 0 : _b.onKeyDown) === null || _c === void 0 ? void 0 : _c.call(_b, e);
56
- });
57
57
  const onMouseEnter = useEventCallback(e => {
58
- var _a, _b;
59
-
60
58
  if (openOnHover) {
61
59
  setOpen(e, true);
62
60
  }
63
-
64
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(_a, e);
65
61
  });
66
- const onMouseLeave = useEventCallback(e => {
67
- var _a, _b;
68
62
 
63
+ const onMouseLeave = e => {
69
64
  if (openOnHover) {
70
65
  setOpen(e, false);
71
66
  }
67
+ };
72
68
 
73
- (_b = (_a = child.props) === null || _a === void 0 ? void 0 : _a.onMouseLeave) === null || _b === void 0 ? void 0 : _b.call(_a, e);
74
- });
75
- const child = React.Children.only(props.children);
76
69
  return {
77
- children: /*#__PURE__*/React.cloneElement(child, { ...triggerAttributes,
70
+ children: applyTriggerPropsToChildren(props.children, { ...triggerAttributes,
78
71
  'aria-haspopup': trapFocus ? 'dialog' : 'true',
79
- ...child.props,
80
- onClick,
81
- onMouseEnter,
82
- onKeyDown,
83
- onMouseLeave,
84
- onContextMenu,
85
- ref: useMergedRefs(child.ref, triggerRef)
72
+ ...(child === null || child === void 0 ? void 0 : child.props),
73
+ onClick: useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
74
+ onMouseEnter: useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
75
+ onKeyDown: useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onKeyDown, onKeyDown),
76
+ onMouseLeave: useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onMouseLeave, onMouseLeave),
77
+ onContextMenu: useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
78
+ ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref)
86
79
  })
87
80
  };
88
81
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/PopoverTrigger/usePopoverTrigger.ts"],"names":[],"mappings":"AAAA,OA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AAP;AAaD,CA7DM","sourcesContent":["import * as React from 'react';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n shouldPreventDefaultOnKeyDown,\n useMergedRefs,\n useMergedEventCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useModalAttributes } from '@fluentui/react-tabster';\nimport { usePopoverContext_unstable } from '../../popoverContext';\nimport type { PopoverTriggerChildProps, PopoverTriggerProps, PopoverTriggerState } from './PopoverTrigger.types';\n\n/**\n * Create the state required to render PopoverTrigger.\n *\n * The returned state can be modified with hooks such as usePopoverTriggerStyles,\n * before being passed to renderPopoverTrigger_unstable.\n *\n * @param props - props from this instance of PopoverTrigger\n */\nexport const usePopoverTrigger_unstable = (props: PopoverTriggerProps): PopoverTriggerState => {\n const { children } = props;\n const child = React.isValidElement(children) ? getTriggerChild(children) : undefined;\n\n const setOpen = usePopoverContext_unstable(context => context.setOpen);\n const open = usePopoverContext_unstable(context => context.open);\n const triggerRef = usePopoverContext_unstable(context => context.triggerRef);\n const openOnHover = usePopoverContext_unstable(context => context.openOnHover);\n const openOnContext = usePopoverContext_unstable(context => context.openOnContext);\n const trapFocus = usePopoverContext_unstable(context => context.trapFocus);\n const { triggerAttributes } = useModalAttributes();\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, true);\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (!openOnContext) {\n setOpen(e, !open);\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (shouldPreventDefaultOnKeyDown(e) && (e.key === ' ' || e.key === 'Enter')) {\n e.preventDefault();\n (e.target as HTMLElement)?.click();\n }\n\n if (e.key === 'Escape') {\n setOpen(e, false);\n }\n };\n\n const onMouseEnter = useEventCallback((e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, true);\n }\n });\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(e, false);\n }\n };\n\n return {\n children: applyTriggerPropsToChildren<PopoverTriggerChildProps>(props.children, {\n ...triggerAttributes,\n 'aria-haspopup': trapFocus ? 'dialog' : 'true',\n ...child?.props,\n onClick: useMergedEventCallbacks(child?.props?.onClick, onClick),\n onMouseEnter: useMergedEventCallbacks(child?.props?.onMouseEnter, onMouseEnter),\n onKeyDown: useMergedEventCallbacks(child?.props?.onKeyDown, onKeyDown),\n onMouseLeave: useMergedEventCallbacks(child?.props?.onMouseLeave, onMouseLeave),\n onContextMenu: useMergedEventCallbacks(child?.props?.onContextMenu, onContextMenu),\n ref: useMergedRefs(triggerRef, child?.ref),\n }),\n };\n};\n"],"sourceRoot":"../src/"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './Popover';\nexport * from './PopoverSurface';\nexport * from './popoverContext';\nexport * from './PopoverTrigger';\n"]}
@@ -5,4 +5,4 @@ export declare const PopoverContext: Context<PopoverContextValue>;
5
5
  * Context shared between Popover and its children components
6
6
  */
7
7
  export declare type PopoverContextValue = Pick<PopoverState, 'open' | 'setOpen' | 'triggerRef' | 'contentRef' | 'openOnHover' | 'openOnContext' | 'mountNode' | 'noArrow' | 'arrowRef' | 'size' | 'appearance' | 'trapFocus'>;
8
- export declare const usePopoverContext: <T>(selector: ContextSelector<Pick<PopoverState, "mountNode" | "open" | "setOpen" | "triggerRef" | "contentRef" | "openOnHover" | "openOnContext" | "noArrow" | "arrowRef" | "size" | "appearance" | "trapFocus">, T>) => T;
8
+ export declare const usePopoverContext_unstable: <T>(selector: ContextSelector<PopoverContextValue, T>) => T;
@@ -16,5 +16,5 @@ export const PopoverContext = /*#__PURE__*/createContext({
16
16
  size: 'medium',
17
17
  trapFocus: false
18
18
  });
19
- export const usePopoverContext = selector => useContextSelector(PopoverContext, selector);
19
+ export const usePopoverContext_unstable = selector => useContextSelector(PopoverContext, selector);
20
20
  //# sourceMappingURL=popoverContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/popoverContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAIA,OAAO,MAAM,cAAc,gBAAiC,aAAa,CAAsB;AAC7F,EAAA,IAAI,EAAE,KADuF;AAE7F,EAAA,OAAO,EAAE,MAAM,IAF8E;AAG7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAHiF;AAI7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAJiF;AAK7F,EAAA,QAAQ,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GALmF;AAM7F,EAAA,aAAa,EAAE,KAN8E;AAO7F,EAAA,WAAW,EAAE,KAPgF;AAQ7F,EAAA,IAAI,EAAE,QARuF;AAS7F,EAAA,SAAS,EAAE;AATkF,CAAtB,CAAlE;AA+BP,OAAO,MAAM,iBAAiB,GAAO,QAAJ,IAC/B,kBAAkB,CAAC,cAAD,EAAiB,QAAjB,CADb","sourceRoot":""}
1
+ {"version":3,"sources":["popoverContext.ts"],"names":[],"mappings":"AAAA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAIA,OAAO,MAAM,cAAc,gBAAiC,aAAa,CAAsB;AAC7F,EAAA,IAAI,EAAE,KADuF;AAE7F,EAAA,OAAO,EAAE,MAAM,IAF8E;AAG7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAHiF;AAI7F,EAAA,UAAU,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GAJiF;AAK7F,EAAA,QAAQ,EAAE;AAAE,IAAA,OAAO,EAAE;AAAX,GALmF;AAM7F,EAAA,aAAa,EAAE,KAN8E;AAO7F,EAAA,WAAW,EAAE,KAPgF;AAQ7F,EAAA,IAAI,EAAE,QARuF;AAS7F,EAAA,SAAS,EAAE;AATkF,CAAtB,CAAlE;AA+BP,OAAO,MAAM,0BAA0B,GAAO,QAAJ,IACxC,kBAAkB,CAAC,cAAD,EAAiB,QAAjB,CADb","sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { PopoverState } from './components/Popover/index';\n\nexport const PopoverContext: Context<PopoverContextValue> = createContext<PopoverContextValue>({\n open: false,\n setOpen: () => null,\n triggerRef: { current: null },\n contentRef: { current: null },\n arrowRef: { current: null },\n openOnContext: false,\n openOnHover: false,\n size: 'medium',\n trapFocus: false,\n});\n\n/**\n * Context shared between Popover and its children components\n */\nexport type PopoverContextValue = Pick<\n PopoverState,\n | 'open'\n | 'setOpen'\n | 'triggerRef'\n | 'contentRef'\n | 'openOnHover'\n | 'openOnContext'\n | 'mountNode'\n | 'noArrow'\n | 'arrowRef'\n | 'size'\n | 'appearance'\n | 'trapFocus'\n>;\n\nexport const usePopoverContext_unstable = <T>(selector: ContextSelector<PopoverContextValue, T>): T =>\n useContextSelector(PopoverContext, selector);\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Popover.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["Popover.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Popover/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/PopoverSurface.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["PopoverSurface.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/PopoverSurface/index';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/PopoverTrigger.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["PopoverTrigger.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,mCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/PopoverTrigger/index';\n"],"sourceRoot":"../src/"}
@@ -14,8 +14,8 @@ const renderPopover_1 = /*#__PURE__*/require("./renderPopover");
14
14
 
15
15
 
16
16
  const Popover = props => {
17
- const state = usePopover_1.usePopover(props);
18
- return renderPopover_1.renderPopover(state);
17
+ const state = usePopover_1.usePopover_unstable(props);
18
+ return renderPopover_1.renderPopover_unstable(state);
19
19
  };
20
20
 
21
21
  exports.Popover = Popover;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/Popover.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,OAAO,GAA2B,KAAK,IAAG;AACrD,QAAM,KAAK,GAAG,YAAA,CAAA,UAAA,CAAW,KAAX,CAAd;AAEA,SAAO,eAAA,CAAA,aAAA,CAAc,KAAd,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,OAAA,GAAO,OAAP;AAMb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB","sourceRoot":""}
1
+ {"version":3,"sources":["components/Popover/Popover.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,OAAO,GAA2B,KAAK,IAAG;AACrD,QAAM,KAAK,GAAG,YAAA,CAAA,mBAAA,CAAoB,KAApB,CAAd;AAEA,SAAO,eAAA,CAAA,sBAAA,CAAuB,KAAvB,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,OAAA,GAAO,OAAP;AAMb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB","sourcesContent":["import * as React from 'react';\nimport { usePopover_unstable } from './usePopover';\nimport { renderPopover_unstable } from './renderPopover';\nimport type { PopoverProps } from './Popover.types';\n\n/**\n * Wrapper component that manages state for a PopoverTrigger and a PopoverSurface components.\n */\nexport const Popover: React.FC<PopoverProps> = props => {\n const state = usePopover_unstable(props);\n\n return renderPopover_unstable(state);\n};\n\nPopover.displayName = 'Popover';\n"],"sourceRoot":"../src/"}
@@ -5,7 +5,7 @@ import type { PortalProps } from '@fluentui/react-portal';
5
5
  * Determines popover padding and arrow size
6
6
  */
7
7
  export declare type PopoverSize = 'small' | 'medium' | 'large';
8
- export declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
8
+ declare type PopoverCommons = Pick<PortalProps, 'mountNode'> & {
9
9
  /**
10
10
  * Controls the opening of the Popover
11
11
  */
@@ -100,3 +100,4 @@ export declare type OnOpenChangeData = {
100
100
  * The supported events that will trigger open/close of the menu
101
101
  */
102
102
  export declare type OpenPopoverEvents = MouseEvent | TouchEvent | React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement> | React.FocusEvent<HTMLElement>;
103
+ export {};
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["components/Popover/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,cAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Popover';\nexport * from './Popover.types';\nexport * from './renderPopover';\nexport * from './usePopover';\n"],"sourceRoot":"../src/"}
@@ -2,4 +2,4 @@ import type { PopoverState } from './Popover.types';
2
2
  /**
3
3
  * Render the final JSX of Popover
4
4
  */
5
- export declare const renderPopover: (state: PopoverState) => JSX.Element;
5
+ export declare const renderPopover_unstable: (state: PopoverState) => JSX.Element;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderPopover = void 0;
6
+ exports.renderPopover_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -13,7 +13,7 @@ const popoverContext_1 = /*#__PURE__*/require("../../popoverContext");
13
13
  */
14
14
 
15
15
 
16
- const renderPopover = state => {
16
+ const renderPopover_unstable = state => {
17
17
  const {
18
18
  open,
19
19
  setOpen,
@@ -46,5 +46,5 @@ const renderPopover = state => {
46
46
  }, state.children);
47
47
  };
48
48
 
49
- exports.renderPopover = renderPopover;
49
+ exports.renderPopover_unstable = renderPopover_unstable;
50
50
  //# sourceMappingURL=renderPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/renderPopover.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,aAAa,GAAI,KAAD,IAAwB;AACnD,QAAM;AACJ,IAAA,IADI;AAEJ,IAAA,OAFI;AAGJ,IAAA,UAHI;AAIJ,IAAA,UAJI;AAKJ,IAAA,aALI;AAMJ,IAAA,WANI;AAOJ,IAAA,SAPI;AAQJ,IAAA,QARI;AASJ,IAAA,IATI;AAUJ,IAAA,OAVI;AAWJ,IAAA,UAXI;AAYJ,IAAA;AAZI,MAaF,KAbJ;AAeA,SACE,KAAA,CAAA,aAAA,CAAC,gBAAA,CAAA,cAAA,CAAe,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,IADK;AAEL,MAAA,OAFK;AAGL,MAAA,UAHK;AAIL,MAAA,UAJK;AAKL,MAAA,WALK;AAML,MAAA,aANK;AAOL,MAAA,SAPK;AAQL,MAAA,QARK;AASL,MAAA,IATK;AAUL,MAAA,OAVK;AAWL,MAAA,UAXK;AAYL,MAAA;AAZK;AADe,GAAxB,EAgBG,KAAK,CAAC,QAhBT,CADF;AAoBD,CApCM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourceRoot":""}
1
+ {"version":3,"sources":["components/Popover/renderPopover.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,sBAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AACJ,IAAA,IADI;AAEJ,IAAA,OAFI;AAGJ,IAAA,UAHI;AAIJ,IAAA,UAJI;AAKJ,IAAA,aALI;AAMJ,IAAA,WANI;AAOJ,IAAA,SAPI;AAQJ,IAAA,QARI;AASJ,IAAA,IATI;AAUJ,IAAA,OAVI;AAWJ,IAAA,UAXI;AAYJ,IAAA;AAZI,MAaF,KAbJ;AAeA,SACE,KAAA,CAAA,aAAA,CAAC,gBAAA,CAAA,cAAA,CAAe,QAAhB,EAAwB;AACtB,IAAA,KAAK,EAAE;AACL,MAAA,IADK;AAEL,MAAA,OAFK;AAGL,MAAA,UAHK;AAIL,MAAA,UAJK;AAKL,MAAA,WALK;AAML,MAAA,aANK;AAOL,MAAA,SAPK;AAQL,MAAA,QARK;AASL,MAAA,IATK;AAUL,MAAA,OAVK;AAWL,MAAA,UAXK;AAYL,MAAA;AAZK;AADe,GAAxB,EAgBG,KAAK,CAAC,QAhBT,CADF;AAoBD,CApCM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourcesContent":["import * as React from 'react';\nimport { PopoverContext } from '../../popoverContext';\nimport type { PopoverState } from './Popover.types';\n\n/**\n * Render the final JSX of Popover\n */\nexport const renderPopover_unstable = (state: PopoverState) => {\n const {\n open,\n setOpen,\n triggerRef,\n contentRef,\n openOnContext,\n openOnHover,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n } = state;\n\n return (\n <PopoverContext.Provider\n value={{\n open,\n setOpen,\n triggerRef,\n contentRef,\n openOnHover,\n openOnContext,\n mountNode,\n arrowRef,\n size,\n noArrow,\n appearance,\n trapFocus,\n }}\n >\n {state.children}\n </PopoverContext.Provider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -3,8 +3,8 @@ import type { PopoverProps, PopoverState } from './Popover.types';
3
3
  * Create the state required to render Popover.
4
4
  *
5
5
  * The returned state can be modified with hooks such as usePopoverStyles,
6
- * before being passed to renderPopover.
6
+ * before being passed to renderPopover_unstable.
7
7
  *
8
8
  * @param props - props from this instance of Popover
9
9
  */
10
- export declare const usePopover: (props: PopoverProps) => PopoverState;
10
+ export declare const usePopover_unstable: (props: PopoverProps) => PopoverState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.usePopover = void 0;
6
+ exports.usePopover_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -20,13 +20,13 @@ const index_1 = /*#__PURE__*/require("../PopoverSurface/index");
20
20
  * Create the state required to render Popover.
21
21
  *
22
22
  * The returned state can be modified with hooks such as usePopoverStyles,
23
- * before being passed to renderPopover.
23
+ * before being passed to renderPopover_unstable.
24
24
  *
25
25
  * @param props - props from this instance of Popover
26
26
  */
27
27
 
28
28
 
29
- const usePopover = props => {
29
+ const usePopover_unstable = props => {
30
30
  const [contextTarget, setContextTarget] = react_positioning_1.usePopperMouseTarget();
31
31
  const initialState = {
32
32
  size: 'medium',
@@ -51,7 +51,8 @@ const usePopover = props => {
51
51
  element: targetDocument,
52
52
  callback: ev => setOpen(ev, false),
53
53
  refs: [popperRefs.triggerRef, popperRefs.contentRef],
54
- disabled: !open || !initialState.openOnContext
54
+ disabled: !open || !initialState.openOnContext // only close on scroll for context
55
+
55
56
  });
56
57
  return { ...initialState,
57
58
  ...popperRefs,
@@ -62,7 +63,7 @@ const usePopover = props => {
62
63
  };
63
64
  };
64
65
 
65
- exports.usePopover = usePopover;
66
+ exports.usePopover_unstable = usePopover_unstable;
66
67
  /**
67
68
  * Creates and manages the Popover open state
68
69
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Popover/usePopover.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,K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AS,EAAE,UAAb;AAAyB,IAAA,YAAY,EAAE,UAAvC;AAAmD,IAAA;AAAnD,MAAgE,mBAAA,CAAA,SAAA,CAAU,aAAV,CAAtE;AAEA,SAAO;AACL,IAAA,UADK;AAEL,IAAA,UAFK;AAGL,IAAA;AAHK,GAAP;AAKD","sourcesContent":["import * as React from 'react';\nimport {\n useControllableState,\n useEventCallback,\n useOnClickOutside,\n useOnScrollOutside,\n} from '@fluentui/react-utilities';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport {\n usePopper,\n resolvePositioningShorthand,\n mergeArrowOffset,\n usePopperMouseTarget,\n} from '@fluentui/react-positioning';\nimport { elementContains } from '@fluentui/react-portal';\nimport { arrowHeights } from '../PopoverSurface/index';\nimport type { OpenPopoverEvents, PopoverProps, PopoverState } from './Popover.types';\n\n/**\n * Create the state required to render Popover.\n *\n * The returned state can be modified with hooks such as usePopoverStyles,\n * before being passed to renderPopover_unstable.\n *\n * @param props - props from this instance of Popover\n */\nexport const usePopover_unstable = (props: PopoverProps): PopoverState => {\n const [contextTarget, setContextTarget] = usePopperMouseTarget();\n const initialState = {\n size: 'medium',\n contextTarget,\n setContextTarget,\n ...props,\n } as const;\n\n const [open, setOpen] = useOpenState(initialState);\n const popperRefs = usePopoverRefs(initialState);\n\n const { targetDocument } = useFluent();\n useOnClickOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open,\n });\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: ev => setOpen(ev, false),\n refs: [popperRefs.triggerRef, popperRefs.contentRef],\n disabled: !open || !initialState.openOnContext, // only close on scroll for context\n });\n\n return {\n ...initialState,\n ...popperRefs,\n open,\n setOpen,\n setContextTarget,\n contextTarget,\n };\n};\n\n/**\n * Creates and manages the Popover open state\n */\nfunction useOpenState(\n state: Pick<PopoverState, 'setContextTarget' | 'onOpenChange'> & Pick<PopoverProps, 'open' | 'defaultOpen'>,\n) {\n const onOpenChange: PopoverState['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n state.open = open !== undefined ? open : state.open;\n const setContextTarget = state.setContextTarget;\n\n const setOpen = React.useCallback(\n (e: OpenPopoverEvents, shouldOpen: boolean) => {\n if (shouldOpen && e.type === 'contextmenu') {\n setContextTarget(e as React.MouseEvent);\n }\n\n if (!shouldOpen) {\n setContextTarget(undefined);\n }\n\n setOpenState(prevOpen => {\n // More than one event (mouse, focus, keyboard) can request the Popover to close\n // We assume the first event is the correct one\n if (prevOpen !== shouldOpen) {\n onOpenChange?.(e, { open: shouldOpen });\n }\n\n return shouldOpen;\n });\n },\n [setOpenState, onOpenChange, setContextTarget],\n );\n\n return [open, setOpen] as const;\n}\n\n/**\n * Creates and sets the necessary trigger, target and content refs used by Popover\n */\nfunction usePopoverRefs(\n state: Pick<PopoverState, 'size' | 'contextTarget'> & Pick<PopoverProps, 'positioning' | 'openOnContext' | 'noArrow'>,\n) {\n const popperOptions = {\n position: 'above' as const,\n align: 'center' as const,\n target: state.openOnContext ? state.contextTarget : undefined,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n // no reason to render arrow when covering the target\n if (popperOptions.coverTarget) {\n state.noArrow = true;\n }\n\n if (!state.noArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.offset, arrowHeights[state.size]);\n }\n\n const { targetRef: triggerRef, containerRef: contentRef, arrowRef } = usePopper(popperOptions);\n\n return {\n triggerRef,\n contentRef,\n arrowRef,\n } as const;\n}\n"],"sourceRoot":"../src/"}