@sanity/ui 0.36.11 → 0.36.13

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 (77) hide show
  1. package/lib/cjs/components/autocomplete/autocomplete.styles.d.ts +1 -1
  2. package/lib/cjs/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
  3. package/lib/cjs/components/dialog/dialog.d.ts +1 -0
  4. package/lib/cjs/components/dialog/dialog.d.ts.map +1 -1
  5. package/lib/cjs/components/dialog/dialog.js +11 -9
  6. package/lib/cjs/components/dialog/dialog.js.map +2 -2
  7. package/lib/cjs/components/menu/menuButton.d.ts +6 -6
  8. package/lib/cjs/components/menu/menuButton.js.map +1 -1
  9. package/lib/cjs/hooks/_internal/index.d.ts +2 -0
  10. package/lib/cjs/hooks/_internal/index.d.ts.map +1 -0
  11. package/lib/cjs/hooks/_internal/index.js +20 -0
  12. package/lib/cjs/hooks/_internal/index.js.map +7 -0
  13. package/lib/cjs/hooks/_internal/useUnique.d.ts +8 -0
  14. package/lib/cjs/hooks/_internal/useUnique.d.ts.map +1 -0
  15. package/lib/cjs/hooks/_internal/useUnique.js +35 -0
  16. package/lib/cjs/hooks/_internal/useUnique.js.map +7 -0
  17. package/lib/cjs/primitives/popover/popover.d.ts +1 -1
  18. package/lib/cjs/primitives/popover/popover.d.ts.map +1 -1
  19. package/lib/cjs/primitives/popover/popover.js +3 -1
  20. package/lib/cjs/primitives/popover/popover.js.map +2 -2
  21. package/lib/cjs/primitives/tooltip/tooltip.d.ts +1 -1
  22. package/lib/cjs/primitives/tooltip/tooltip.d.ts.map +1 -1
  23. package/lib/cjs/primitives/tooltip/tooltip.js +20 -1
  24. package/lib/cjs/primitives/tooltip/tooltip.js.map +2 -2
  25. package/lib/cjs/styles/font/responsiveFont.d.ts.map +1 -1
  26. package/lib/cjs/styles/font/responsiveFont.js +9 -0
  27. package/lib/cjs/styles/font/responsiveFont.js.map +2 -2
  28. package/lib/cjs/utils/portal/portal.d.ts +4 -0
  29. package/lib/cjs/utils/portal/portal.d.ts.map +1 -1
  30. package/lib/cjs/utils/portal/portal.js +5 -2
  31. package/lib/cjs/utils/portal/portal.js.map +2 -2
  32. package/lib/cjs/utils/portal/portalProvider.d.ts +5 -1
  33. package/lib/cjs/utils/portal/portalProvider.d.ts.map +1 -1
  34. package/lib/cjs/utils/portal/portalProvider.js +6 -3
  35. package/lib/cjs/utils/portal/portalProvider.js.map +2 -2
  36. package/lib/cjs/utils/portal/types.d.ts +1 -0
  37. package/lib/cjs/utils/portal/types.d.ts.map +1 -1
  38. package/lib/cjs/utils/portal/types.js.map +1 -1
  39. package/lib/esm/components/autocomplete/autocomplete.styles.d.ts +1 -1
  40. package/lib/esm/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
  41. package/lib/esm/components/dialog/dialog.d.ts +1 -0
  42. package/lib/esm/components/dialog/dialog.d.ts.map +1 -1
  43. package/lib/esm/components/dialog/dialog.js +12 -10
  44. package/lib/esm/components/dialog/dialog.js.map +2 -2
  45. package/lib/esm/components/menu/menuButton.d.ts +6 -6
  46. package/lib/esm/components/menu/menuButton.js.map +1 -1
  47. package/lib/esm/hooks/_internal/index.d.ts +2 -0
  48. package/lib/esm/hooks/_internal/index.d.ts.map +1 -0
  49. package/lib/esm/hooks/_internal/index.js +1 -0
  50. package/lib/esm/hooks/_internal/index.js.map +7 -0
  51. package/lib/esm/hooks/_internal/useUnique.d.ts +8 -0
  52. package/lib/esm/hooks/_internal/useUnique.d.ts.map +1 -0
  53. package/lib/esm/hooks/_internal/useUnique.js +12 -0
  54. package/lib/esm/hooks/_internal/useUnique.js.map +7 -0
  55. package/lib/esm/primitives/popover/popover.d.ts +1 -1
  56. package/lib/esm/primitives/popover/popover.d.ts.map +1 -1
  57. package/lib/esm/primitives/popover/popover.js +3 -1
  58. package/lib/esm/primitives/popover/popover.js.map +2 -2
  59. package/lib/esm/primitives/tooltip/tooltip.d.ts +1 -1
  60. package/lib/esm/primitives/tooltip/tooltip.d.ts.map +1 -1
  61. package/lib/esm/primitives/tooltip/tooltip.js +20 -1
  62. package/lib/esm/primitives/tooltip/tooltip.js.map +2 -2
  63. package/lib/esm/styles/font/responsiveFont.d.ts.map +1 -1
  64. package/lib/esm/styles/font/responsiveFont.js +9 -0
  65. package/lib/esm/styles/font/responsiveFont.js.map +2 -2
  66. package/lib/esm/utils/portal/portal.d.ts +4 -0
  67. package/lib/esm/utils/portal/portal.d.ts.map +1 -1
  68. package/lib/esm/utils/portal/portal.js +5 -2
  69. package/lib/esm/utils/portal/portal.js.map +2 -2
  70. package/lib/esm/utils/portal/portalProvider.d.ts +5 -1
  71. package/lib/esm/utils/portal/portalProvider.d.ts.map +1 -1
  72. package/lib/esm/utils/portal/portalProvider.js +6 -3
  73. package/lib/esm/utils/portal/portalProvider.js.map +2 -2
  74. package/lib/esm/utils/portal/types.d.ts +1 -0
  75. package/lib/esm/utils/portal/types.d.ts.map +1 -1
  76. package/lib/tsconfig.lib.tsbuildinfo +1 -1
  77. package/package.json +9 -8
@@ -63,6 +63,8 @@ function fontSize(size, horizontalOffset) {
63
63
  const negHeight = ascenderHeight + descenderHeight;
64
64
  const capHeight = lineHeight - negHeight;
65
65
  const iconOffset = (capHeight - iconSize) / 2;
66
+ const customIconSize = Math.floor(fontSize2 * 1.125 / 2) * 2 + 1;
67
+ const customIconOffset = (capHeight - customIconSize) / 2;
66
68
  return {
67
69
  fontSize: (0, import_helpers.rem)(fontSize2),
68
70
  lineHeight: `calc(${lineHeight} / ${fontSize2})`,
@@ -77,6 +79,13 @@ function fontSize(size, horizontalOffset) {
77
79
  "& > code, & > span": {
78
80
  margin: horizontalOffset ? `0 calc(${(0, import_helpers.rem)(0 - horizontalOffset * fontSize2)} - 1px)` : "0 -1px"
79
81
  },
82
+ "& svg:not([data-sanity-icon])": {
83
+ fontSize: `calc(${customIconSize} / 16 * 1rem)`,
84
+ margin: [
85
+ (0, import_helpers.rem)(customIconOffset),
86
+ horizontalOffset ? `calc(${(0, import_helpers.rem)(customIconOffset)} + ${(0, import_helpers.rem)(horizontalOffset * fontSize2)})` : (0, import_helpers.rem)(customIconOffset)
87
+ ].join(" ")
88
+ },
80
89
  "& [data-sanity-icon]": {
81
90
  fontSize: `calc(${iconSize} / 16 * 1rem)`,
82
91
  margin: [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/styles/font/responsiveFont.ts"],
4
- "sourcesContent": ["import {CSSObject} from 'styled-components'\nimport {ThemeFontSize, ThemeFontKey} from '../../theme'\nimport {getResponsiveProp, rem, responsive} from '../helpers'\nimport {ThemeProps} from '../types'\nimport {ResponsiveFontStyleProps} from './types'\n\n/**\n * A utility function getting responsive font styles.\n * @internal\n */\nexport function responsiveFont(\n fontKey: ThemeFontKey,\n props: ResponsiveFontStyleProps & ThemeProps\n): CSSObject[] {\n const {$size, $weight, theme} = props\n const {fonts, media} = theme.sanity\n const {family, sizes, weights, horizontalOffset} = fonts[fontKey]\n const fontWeight = ($weight && weights[$weight]) || weights.regular\n\n // @todo: make this configurable\n const defaultSize = sizes[2]\n\n const base: CSSObject = {\n position: 'relative',\n fontFamily: family,\n fontWeight,\n padding: '1px',\n margin: 0,\n\n '&:before': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '&:after': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '& > code, & > span': {\n display: 'block',\n },\n\n '&:not([hidden])': {\n display: 'block',\n },\n }\n\n const resp = responsive(media, getResponsiveProp($size), (sizeIndex) =>\n fontSize(sizes[sizeIndex] || defaultSize, horizontalOffset)\n )\n\n return [base, ...resp]\n}\n\nexport function fontSize(size: ThemeFontSize, horizontalOffset?: number): CSSObject {\n const {ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight} = size\n const negHeight = ascenderHeight + descenderHeight\n const capHeight = lineHeight - negHeight\n const iconOffset = (capHeight - iconSize) / 2\n\n return {\n fontSize: rem(fontSize),\n lineHeight: `calc(${lineHeight} / ${fontSize})`,\n letterSpacing: rem(letterSpacing),\n transform: `translateY(${rem(descenderHeight)})`,\n\n '&:before': {\n marginTop: `calc(${rem(0 - negHeight)} - 1px)`,\n },\n\n '&:after': {\n marginBottom: '-1px',\n },\n\n '& > code, & > span': {\n margin: horizontalOffset ? `0 calc(${rem(0 - horizontalOffset * fontSize)} - 1px)` : '0 -1px',\n },\n\n '& [data-sanity-icon]': {\n fontSize: `calc(${iconSize} / 16 * 1rem)`,\n margin: [\n // top & bottom\n rem(iconOffset),\n // left & right\n horizontalOffset\n ? `calc(${rem(iconOffset)} + ${rem(horizontalOffset * fontSize)})`\n : rem(iconOffset),\n ].join(' '),\n },\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAiD;AAQ1C,wBACL,SACA,OACa;AACb,QAAM,EAAC,OAAO,SAAS,UAAS;AAChC,QAAM,EAAC,OAAO,UAAS,MAAM;AAC7B,QAAM,EAAC,QAAQ,OAAO,SAAS,qBAAoB,MAAM;AACzD,QAAM,aAAc,WAAW,QAAQ,YAAa,QAAQ;AAG5D,QAAM,cAAc,MAAM;AAE1B,QAAM,OAAkB;AAAA,IACtB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ;AAAA,IACA,SAAS;AAAA,IACT,QAAQ;AAAA,IAER,YAAY;AAAA,MACV,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA;AAAA,IAGV,WAAW;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,QAAQ;AAAA;AAAA,IAGV,sBAAsB;AAAA,MACpB,SAAS;AAAA;AAAA,IAGX,mBAAmB;AAAA,MACjB,SAAS;AAAA;AAAA;AAIb,QAAM,OAAO,+BAAW,OAAO,sCAAkB,QAAQ,CAAC,cACxD,SAAS,MAAM,cAAc,aAAa;AAG5C,SAAO,CAAC,MAAM,GAAG;AAAA;AAGZ,kBAAkB,MAAqB,kBAAsC;AAClF,QAAM,EAAC,gBAAgB,iBAAiB,qBAAU,UAAU,eAAe,eAAc;AACzF,QAAM,YAAY,iBAAiB;AACnC,QAAM,YAAY,aAAa;AAC/B,QAAM,aAAc,aAAY,YAAY;AAE5C,SAAO;AAAA,IACL,UAAU,wBAAI;AAAA,IACd,YAAY,QAAQ,gBAAgB;AAAA,IACpC,eAAe,wBAAI;AAAA,IACnB,WAAW,cAAc,wBAAI;AAAA,IAE7B,YAAY;AAAA,MACV,WAAW,QAAQ,wBAAI,IAAI;AAAA;AAAA,IAG7B,WAAW;AAAA,MACT,cAAc;AAAA;AAAA,IAGhB,sBAAsB;AAAA,MACpB,QAAQ,mBAAmB,UAAU,wBAAI,IAAI,mBAAmB,sBAAqB;AAAA;AAAA,IAGvF,wBAAwB;AAAA,MACtB,UAAU,QAAQ;AAAA,MAClB,QAAQ;AAAA,QAEN,wBAAI;AAAA,QAEJ,mBACI,QAAQ,wBAAI,iBAAiB,wBAAI,mBAAmB,gBACpD,wBAAI;AAAA,QACR,KAAK;AAAA;AAAA;AAAA;",
4
+ "sourcesContent": ["import {CSSObject} from 'styled-components'\nimport {ThemeFontSize, ThemeFontKey} from '../../theme'\nimport {getResponsiveProp, rem, responsive} from '../helpers'\nimport {ThemeProps} from '../types'\nimport {ResponsiveFontStyleProps} from './types'\n\n/**\n * A utility function getting responsive font styles.\n * @internal\n */\nexport function responsiveFont(\n fontKey: ThemeFontKey,\n props: ResponsiveFontStyleProps & ThemeProps\n): CSSObject[] {\n const {$size, $weight, theme} = props\n const {fonts, media} = theme.sanity\n const {family, sizes, weights, horizontalOffset} = fonts[fontKey]\n const fontWeight = ($weight && weights[$weight]) || weights.regular\n\n // @todo: make this configurable\n const defaultSize = sizes[2]\n\n const base: CSSObject = {\n position: 'relative',\n fontFamily: family,\n fontWeight,\n padding: '1px',\n margin: 0,\n\n '&:before': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '&:after': {\n content: '\"\"',\n display: 'block',\n height: 0,\n },\n\n '& > code, & > span': {\n display: 'block',\n },\n\n '&:not([hidden])': {\n display: 'block',\n },\n }\n\n const resp = responsive(media, getResponsiveProp($size), (sizeIndex) =>\n fontSize(sizes[sizeIndex] || defaultSize, horizontalOffset)\n )\n\n return [base, ...resp]\n}\n\nexport function fontSize(size: ThemeFontSize, horizontalOffset?: number): CSSObject {\n const {ascenderHeight, descenderHeight, fontSize, iconSize, letterSpacing, lineHeight} = size\n const negHeight = ascenderHeight + descenderHeight\n const capHeight = lineHeight - negHeight\n const iconOffset = (capHeight - iconSize) / 2\n const customIconSize = Math.floor((fontSize * 1.125) / 2) * 2 + 1\n const customIconOffset = (capHeight - customIconSize) / 2\n\n return {\n fontSize: rem(fontSize),\n lineHeight: `calc(${lineHeight} / ${fontSize})`,\n letterSpacing: rem(letterSpacing),\n transform: `translateY(${rem(descenderHeight)})`,\n\n '&:before': {\n marginTop: `calc(${rem(0 - negHeight)} - 1px)`,\n },\n\n '&:after': {\n marginBottom: '-1px',\n },\n\n '& > code, & > span': {\n margin: horizontalOffset ? `0 calc(${rem(0 - horizontalOffset * fontSize)} - 1px)` : '0 -1px',\n },\n\n '& svg:not([data-sanity-icon])': {\n fontSize: `calc(${customIconSize} / 16 * 1rem)`,\n margin: [\n // top & bottom\n rem(customIconOffset),\n // left & right\n horizontalOffset\n ? `calc(${rem(customIconOffset)} + ${rem(horizontalOffset * fontSize)})`\n : rem(customIconOffset),\n ].join(' '),\n },\n\n '& [data-sanity-icon]': {\n fontSize: `calc(${iconSize} / 16 * 1rem)`,\n margin: [\n // top & bottom\n rem(iconOffset),\n // left & right\n horizontalOffset\n ? `calc(${rem(iconOffset)} + ${rem(horizontalOffset * fontSize)})`\n : rem(iconOffset),\n ].join(' '),\n },\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAiD;AAQ1C,wBACL,SACA,OACa;AACb,QAAM,EAAC,OAAO,SAAS,UAAS;AAChC,QAAM,E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/B,UAAU,QAAQ;AAAA,MAClB,QAAQ;AAAA,QAEN,wBAAI;AAAA,QAEJ,mBACI,QAAQ,wBAAI,uBAAuB,wBAAI,mBAAmB,gBAC1D,wBAAI;AAAA,QACR,KAAK;AAAA;AAAA,IAGT,wBAAwB;AAAA,MACtB,UAAU,QAAQ;AAAA,MAClB,QAAQ;AAAA,QAEN,wBAAI;AAAA,QAEJ,mBACI,QAAQ,wBAAI,iBAAiB,wBAAI,mBAAmB,gBACpD,wBAAI;AAAA,QACR,KAAK;AAAA;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -4,6 +4,10 @@ import React from 'react';
4
4
  */
5
5
  export interface PortalProps {
6
6
  children: React.ReactNode;
7
+ /**
8
+ * @beta This API might change. DO NOT USE IN PRODUCTION.
9
+ */
10
+ __unstable_name?: string;
7
11
  }
8
12
  /**
9
13
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAQnE"}
1
+ {"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/portal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAWnE"}
@@ -27,9 +27,12 @@ __export(exports, {
27
27
  var import_react_dom = __toModule(require("react-dom"));
28
28
  var import_usePortal = __toModule(require("./usePortal"));
29
29
  function Portal(props) {
30
+ var _a;
31
+ const { children, __unstable_name: name } = props;
30
32
  const portal = (0, import_usePortal.usePortal)();
31
- if (!portal.element) {
33
+ const portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || ((_a = portal.elements) == null ? void 0 : _a.default);
34
+ if (!portalElement) {
32
35
  return null;
33
36
  }
34
- return import_react_dom.default.createPortal(props.children, portal.element);
37
+ return import_react_dom.default.createPortal(children, portalElement);
35
38
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/utils/portal/portal.ts"],
4
- "sourcesContent": ["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport {usePortal} from './usePortal'\n\n/**\n * @public\n */\nexport interface PortalProps {\n children: React.ReactNode\n}\n\n/**\n * @public\n */\nexport function Portal(props: PortalProps): React.ReactPortal | null {\n const portal = usePortal()\n\n if (!portal.element) {\n return null\n }\n\n return ReactDOM.createPortal(props.children, portal.element)\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AACA,uBAAqB;AACrB,uBAAwB;AAYjB,gBAAgB,OAA8C;AACnE,QAAM,SAAS;AAEf,MAAI,CAAC,OAAO,SAAS;AACnB,WAAO;AAAA;AAGT,SAAO,yBAAS,aAAa,MAAM,UAAU,OAAO;AAAA;",
4
+ "sourcesContent": ["import React from 'react'\nimport ReactDOM from 'react-dom'\nimport {usePortal} from './usePortal'\n\n/**\n * @public\n */\nexport interface PortalProps {\n children: React.ReactNode\n /**\n * @beta This API might change. DO NOT USE IN PRODUCTION.\n */\n __unstable_name?: string\n}\n\n/**\n * @public\n */\nexport function Portal(props: PortalProps): React.ReactPortal | null {\n const {children, __unstable_name: name} = props\n const portal = usePortal()\n const portalElement =\n (name ? portal.elements && portal.elements[name] : portal.element) || portal.elements?.default\n\n if (!portalElement) {\n return null\n }\n\n return ReactDOM.createPortal(children, portalElement)\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AACA,uBAAqB;AACrB,uBAAwB;AAgBjB,gBAAgB,OAA8C;AAlBrE;AAmBE,QAAM,EAAC,UAAU,iBAAiB,SAAQ;AAC1C,QAAM,SAAS;AACf,QAAM,gBACH,QAAO,OAAO,YAAY,OAAO,SAAS,QAAQ,OAAO,YAAY,cAAO,aAAP,mBAAiB;AAEzF,MAAI,CAAC,eAAe;AAClB,WAAO;AAAA;AAGT,SAAO,yBAAS,aAAa,UAAU;AAAA;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,11 @@ export interface PortalProviderProps {
8
8
  */
9
9
  boundaryElement?: HTMLElement | null;
10
10
  children: React.ReactNode;
11
- element: HTMLElement | null;
11
+ element?: HTMLElement | null;
12
+ /**
13
+ * @beta
14
+ */
15
+ __unstable_elements?: Record<string, HTMLElement | null | undefined>;
12
16
  }
13
17
  /**
14
18
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"portalProvider.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/portalProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAA;AAIpC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;CAC5B;AAID;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAY7E"}
1
+ {"version":3,"file":"portalProvider.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/portalProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAA;AAKpC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IAC5B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;CACrE;AAID;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAc7E"}
@@ -25,17 +25,20 @@ __export(exports, {
25
25
  PortalProvider: () => PortalProvider
26
26
  });
27
27
  var import_react = __toModule(require("react"));
28
+ var import_internal = __toModule(require("../../hooks/_internal"));
28
29
  var import_portalContext = __toModule(require("./portalContext"));
29
30
  const __BROWSER__ = typeof window !== "undefined";
30
31
  function PortalProvider(props) {
31
- const { boundaryElement, children, element } = props;
32
+ const { boundaryElement, children, element, __unstable_elements: elementsProp } = props;
33
+ const elements = (0, import_internal.useUnique)(elementsProp);
32
34
  const value = (0, import_react.useMemo)(() => {
33
35
  return {
34
36
  version: 0,
35
37
  boundaryElement: boundaryElement || null,
36
- element: element || __BROWSER__ && document.body || null
38
+ element: element || __BROWSER__ && document.body || null,
39
+ elements
37
40
  };
38
- }, [boundaryElement, element]);
41
+ }, [boundaryElement, element, elements]);
39
42
  return /* @__PURE__ */ import_react.default.createElement(import_portalContext.PortalContext.Provider, {
40
43
  value
41
44
  }, children);
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/utils/portal/portalProvider.tsx"],
4
- "sourcesContent": ["import React, {useMemo} from 'react'\nimport {PortalContext} from './portalContext'\nimport {PortalContextValue} from './types'\n\n/**\n * @public\n */\nexport interface PortalProviderProps {\n /**\n * @deprecated Use `<BoundaryElementProvider element={...} />` instead\n */\n boundaryElement?: HTMLElement | null\n children: React.ReactNode\n element: HTMLElement | null\n}\n\nconst __BROWSER__ = typeof window !== 'undefined'\n\n/**\n * @public\n */\nexport function PortalProvider(props: PortalProviderProps): React.ReactElement {\n const {boundaryElement, children, element} = props\n\n const value: PortalContextValue = useMemo(() => {\n return {\n version: 0.0,\n boundaryElement: boundaryElement || null,\n element: element || (__BROWSER__ && document.body) || null,\n }\n }, [boundaryElement, element])\n\n return <PortalContext.Provider value={value}>{children}</PortalContext.Provider>\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,2BAA4B;AAe5B,MAAM,cAAc,OAAO,WAAW;AAK/B,wBAAwB,OAAgD;AAC7E,QAAM,EAAC,iBAAiB,UAAU,YAAW;AAE7C,QAAM,QAA4B,0BAAQ,MAAM;AAC9C,WAAO;AAAA,MACL,SAAS;AAAA,MACT,iBAAiB,mBAAmB;AAAA,MACpC,SAAS,WAAY,eAAe,SAAS,QAAS;AAAA;AAAA,KAEvD,CAAC,iBAAiB;AAErB,SAAO,mDAAC,mCAAc,UAAf;AAAA,IAAwB;AAAA,KAAe;AAAA;",
4
+ "sourcesContent": ["import React, {useMemo} from 'react'\nimport {useUnique} from '../../hooks/_internal'\nimport {PortalContext} from './portalContext'\nimport {PortalContextValue} from './types'\n\n/**\n * @public\n */\nexport interface PortalProviderProps {\n /**\n * @deprecated Use `<BoundaryElementProvider element={...} />` instead\n */\n boundaryElement?: HTMLElement | null\n children: React.ReactNode\n element?: HTMLElement | null\n /**\n * @beta\n */\n __unstable_elements?: Record<string, HTMLElement | null | undefined>\n}\n\nconst __BROWSER__ = typeof window !== 'undefined'\n\n/**\n * @public\n */\nexport function PortalProvider(props: PortalProviderProps): React.ReactElement {\n const {boundaryElement, children, element, __unstable_elements: elementsProp} = props\n const elements = useUnique(elementsProp)\n\n const value: PortalContextValue = useMemo(() => {\n return {\n version: 0.0,\n boundaryElement: boundaryElement || null,\n element: element || (__BROWSER__ && document.body) || null,\n elements,\n }\n }, [boundaryElement, element, elements])\n\n return <PortalContext.Provider value={value}>{children}</PortalContext.Provider>\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAC7B,sBAAwB;AACxB,2BAA4B;AAmB5B,MAAM,cAAc,OAAO,WAAW;AAK/B,wBAAwB,OAAgD;AAC7E,QAAM,EAAC,iBAAiB,UAAU,SAAS,qBAAqB,iBAAgB;AAChF,QAAM,WAAW,+BAAU;AAE3B,QAAM,QAA4B,0BAAQ,MAAM;AAC9C,WAAO;AAAA,MACL,SAAS;AAAA,MACT,iBAAiB,mBAAmB;AAAA,MACpC,SAAS,WAAY,eAAe,SAAS,QAAS;AAAA,MACtD;AAAA;AAAA,KAED,CAAC,iBAAiB,SAAS;AAE9B,SAAO,mDAAC,mCAAc,UAAf;AAAA,IAAwB;AAAA,KAAe;AAAA;",
6
6
  "names": []
7
7
  }
@@ -5,5 +5,6 @@ export interface PortalContextValue {
5
5
  version: 0.0;
6
6
  boundaryElement: HTMLElement | null;
7
7
  element: HTMLElement | null;
8
+ elements?: Record<string, HTMLElement | null | undefined>;
8
9
  }
9
10
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,GAAG,CAAA;IACZ,eAAe,EAAE,WAAW,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;CAC5B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/utils/portal/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,GAAG,CAAA;IACZ,eAAe,EAAE,WAAW,GAAG,IAAI,CAAA;IACnC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;CAC1D"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/utils/portal/types.ts"],
4
- "sourcesContent": ["/**\n * @public\n */\nexport interface PortalContextValue {\n version: 0.0\n boundaryElement: HTMLElement | null\n element: HTMLElement | null\n}\n"],
4
+ "sourcesContent": ["/**\n * @public\n */\nexport interface PortalContextValue {\n version: 0.0\n boundaryElement: HTMLElement | null\n element: HTMLElement | null\n elements?: Record<string, HTMLElement | null | undefined>\n}\n"],
5
5
  "mappings": ";;AAAA;",
6
6
  "names": []
7
7
  }
@@ -14,5 +14,5 @@ export declare const ResultsPopover: import("styled-components").StyledComponent
14
14
  /**
15
15
  * @internal
16
16
  */
17
- export declare const AnimatedSpinnerIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").SVGProps<SVGSVGElement>, "string" | "x" | "y" | "r" | "name" | "mode" | "key" | "color" | "media" | "radius" | "from" | "children" | "version" | "style" | "clipPath" | "filter" | "mask" | "path" | "end" | "local" | "clip" | "fill" | "stroke" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "min" | "max" | "display" | "height" | "fontFamily" | "fontWeight" | "fontSize" | "letterSpacing" | "transform" | "overflow" | "type" | "width" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "crossOrigin" | "href" | "method" | "target" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "fillOpacity" | "fillRule" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "format" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "lightingColor" | "limitingConeAngle" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & import("react").RefAttributes<SVGSVGElement>>, import("styled-components").DefaultTheme, {}, never>;
17
+ export declare const AnimatedSpinnerIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").SVGProps<SVGSVGElement>, "string" | "x" | "y" | "r" | "name" | "mode" | "key" | "color" | "media" | "radius" | "from" | "children" | "version" | "style" | "clipPath" | "filter" | "mask" | "path" | "end" | "local" | "clip" | "fill" | "stroke" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "min" | "max" | "fr" | "display" | "height" | "fontFamily" | "fontWeight" | "fontSize" | "letterSpacing" | "transform" | "overflow" | "type" | "width" | "className" | "id" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "crossOrigin" | "href" | "method" | "target" | "accentHeight" | "accumulate" | "additive" | "alignmentBaseline" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "azimuth" | "baseFrequency" | "baselineShift" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "clipRule" | "colorInterpolation" | "colorInterpolationFilters" | "colorProfile" | "colorRendering" | "contentScriptType" | "contentStyleType" | "cursor" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "direction" | "divisor" | "dominantBaseline" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "fillOpacity" | "fillRule" | "filterRes" | "filterUnits" | "floodColor" | "floodOpacity" | "focusable" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "format" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphOrientationVertical" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "imageRendering" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "lightingColor" | "limitingConeAngle" | "markerEnd" | "markerHeight" | "markerMid" | "markerStart" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "offset" | "opacity" | "operator" | "order" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "paintOrder" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "pointerEvents" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rotate" | "rx" | "ry" | "scale" | "seed" | "shapeRendering" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "stopColor" | "stopOpacity" | "strikethroughPosition" | "strikethroughThickness" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textAnchor" | "textDecoration" | "textLength" | "textRendering" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeBidi" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "values" | "vectorEffect" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "visibility" | "vMathematical" | "widths" | "wordSpacing" | "writingMode" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan"> & import("react").RefAttributes<SVGSVGElement>>, import("styled-components").DefaultTheme, {}, never>;
18
18
  //# sourceMappingURL=autocomplete.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete/autocomplete.styles.tsx"],"names":[],"mappings":";AAIA;;GAEG;AACH,eAAO,MAAM,IAAI,yGAEhB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,miMAMnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,qhMAS1B,CAAA;AAYD;;GAEG;AACH,eAAO,MAAM,mBAAmB,ssPAE/B,CAAA"}
1
+ {"version":3,"file":"autocomplete.styles.d.ts","sourceRoot":"","sources":["../../../../src/components/autocomplete/autocomplete.styles.tsx"],"names":[],"mappings":";AAIA;;GAEG;AACH,eAAO,MAAM,IAAI,yGAEhB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,miMAMnB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,qhMAS1B,CAAA;AAYD;;GAEG;AACH,eAAO,MAAM,mBAAmB,6sPAE/B,CAAA"}
@@ -22,6 +22,7 @@ export interface DialogProps extends ResponsivePaddingProps, ResponsiveWidthProp
22
22
  id: string;
23
23
  onClickOutside?: () => void;
24
24
  onClose?: () => void;
25
+ portal?: string;
25
26
  position?: DialogPosition | DialogPosition[];
26
27
  scheme?: ThemeColorSchemeKey;
27
28
  zOffset?: number | number[];
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAKjF,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EAAC,mBAAmB,EAAW,MAAM,aAAa,CAAA;AACzD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAS1C;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,sBAAsB,EAAE,oBAAoB;IAC/E;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IAC/C,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAA;IAC5C,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC5B;AAwMD;;GAEG;AACH,eAAO,MAAM,MAAM,m3LAyFjB,CAAA"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/dialog/dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAA6D,MAAM,OAAO,CAAA;AAKjF,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAA;AAEnF,OAAO,EAAC,mBAAmB,EAAW,MAAM,aAAa,CAAA;AACzD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAS1C;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,sBAAsB,EAAE,oBAAoB;IAC/E;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAA;IACpC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC9B,UAAU,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IAC/C,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,cAAc,GAAG,cAAc,EAAE,CAAA;IAC5C,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAC5B;AA2MD;;GAEG;AACH,eAAO,MAAM,MAAM,m3LA0FjB,CAAA"}
@@ -33,7 +33,7 @@ import { CloseIcon } from "@sanity/icons";
33
33
  import React, { forwardRef, useCallback, useEffect, useRef, useState } from "react";
34
34
  import styled from "styled-components";
35
35
  import { focusFirstDescendant, focusLastDescendant } from "../../helpers";
36
- import { useClickOutside, useGlobalKeyDown } from "../../hooks";
36
+ import { useClickOutside, useForwardedRef, useGlobalKeyDown } from "../../hooks";
37
37
  import { Box, Button, Card, Container, Flex, Text } from "../../primitives";
38
38
  import { responsivePaddingStyle } from "../../styles/internal";
39
39
  import { useTheme } from "../../theme";
@@ -109,6 +109,7 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
109
109
  shadow,
110
110
  width
111
111
  } = props;
112
+ const forwardedRef = useForwardedRef(ref);
112
113
  const [rootElement, setRootElement] = useState(null);
113
114
  const localContentRef = useRef(null);
114
115
  const layer = useLayer();
@@ -119,10 +120,10 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
119
120
  useEffect(() => {
120
121
  if (!autoFocus)
121
122
  return;
122
- if (localContentRef.current) {
123
- focusFirstDescendant(localContentRef.current);
123
+ if (forwardedRef.current) {
124
+ focusFirstDescendant(forwardedRef.current);
124
125
  }
125
- }, [autoFocus]);
126
+ }, [autoFocus, forwardedRef]);
126
127
  useGlobalKeyDown(useCallback((event) => {
127
128
  if (!isTopLayer || !onClose)
128
129
  return;
@@ -139,11 +140,8 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
139
140
  }, [isTopLayer, onClickOutside]), [rootElement]);
140
141
  const setRef = useCallback((el) => {
141
142
  setRootElement(el);
142
- if (typeof ref === "function")
143
- ref(el);
144
- else if (ref)
145
- ref.current = el;
146
- }, [ref]);
143
+ forwardedRef.current = el;
144
+ }, [forwardedRef]);
147
145
  const setContentRef = useCallback((el) => {
148
146
  localContentRef.current = el;
149
147
  if (typeof contentRef === "function")
@@ -199,6 +197,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
199
197
  onClickOutside,
200
198
  onClose,
201
199
  padding = 4,
200
+ portal,
202
201
  position = dialog.position || "fixed",
203
202
  scheme,
204
203
  width = 0,
@@ -216,6 +215,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
216
215
  "onClickOutside",
217
216
  "onClose",
218
217
  "padding",
218
+ "portal",
219
219
  "position",
220
220
  "scheme",
221
221
  "width",
@@ -240,7 +240,9 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
240
240
  }
241
241
  }, []);
242
242
  const labelId = `${id}_label`;
243
- return /* @__PURE__ */ React.createElement(Portal, null, /* @__PURE__ */ React.createElement(Root, __spreadProps(__spreadValues({}, restProps), {
243
+ return /* @__PURE__ */ React.createElement(Portal, {
244
+ __unstable_name: portal
245
+ }, /* @__PURE__ */ React.createElement(Root, __spreadProps(__spreadValues({}, restProps), {
244
246
  $padding: padding,
245
247
  $position: position,
246
248
  "aria-labelledby": labelId,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/dialog/dialog.tsx"],
4
- "sourcesContent": ["import {CloseIcon} from '@sanity/icons'\nimport React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'\nimport styled from 'styled-components'\nimport {focusFirstDescendant, focusLastDescendant} from '../../helpers'\nimport {useClickOutside, useGlobalKeyDown} from '../../hooks'\nimport {Box, Button, Card, Container, Flex, Text} from '../../primitives'\nimport {ResponsivePaddingProps, ResponsiveWidthProps} from '../../primitives/types'\nimport {responsivePaddingStyle, ResponsivePaddingStyleProps} from '../../styles/internal'\nimport {ThemeColorSchemeKey, useTheme} from '../../theme'\nimport {DialogPosition} from '../../types'\nimport {Layer, Portal, useLayer} from '../../utils'\nimport {\n dialogStyle,\n responsiveDialogPositionStyle,\n ResponsiveDialogPositionStyleProps,\n} from './styles'\nimport {useDialog} from './useDialog'\n\n/**\n * @public\n */\nexport interface DialogProps extends ResponsivePaddingProps, ResponsiveWidthProps {\n /**\n * @beta\n */\n __unstable_autoFocus?: boolean\n /**\n * @beta\n */\n __unstable_hideCloseButton?: boolean\n cardRadius?: number | number[]\n cardShadow?: number | number[]\n contentRef?: React.ForwardedRef<HTMLDivElement>\n footer?: React.ReactNode\n header?: React.ReactNode\n id: string\n onClickOutside?: () => void\n onClose?: () => void\n position?: DialogPosition | DialogPosition[]\n scheme?: ThemeColorSchemeKey\n zOffset?: number | number[]\n}\n\ninterface DialogCardProps extends ResponsiveWidthProps {\n /**\n * @beta\n */\n __unstable_autoFocus: boolean\n /**\n * @beta\n */\n __unstable_hideCloseButton: boolean\n children: React.ReactNode\n contentRef?: React.ForwardedRef<HTMLDivElement>\n footer: React.ReactNode\n header: React.ReactNode\n id: string\n onClickOutside?: () => void\n onClose?: () => void\n radius: number | number[]\n scheme?: ThemeColorSchemeKey\n shadow: number | number[]\n}\n\nconst Root = styled(Layer)<ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps>(\n responsivePaddingStyle,\n dialogStyle,\n responsiveDialogPositionStyle\n)\n\nconst DialogContainer = styled(Container)`\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`\n\nconst DialogCardRoot = styled(Card)`\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n`\n\nconst DialogLayout = styled(Flex)`\n flex: 1;\n min-height: 0;\n width: 100%;\n`\n\nconst DialogHeader = styled(Card)`\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n`\n\nconst DialogContent = styled(Box)`\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n`\n\nconst DialogFooter = styled(Box)`\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n`\n\nconst DialogCard = forwardRef(function DialogCard(props: DialogCardProps, ref) {\n const {\n __unstable_autoFocus: autoFocus,\n __unstable_hideCloseButton: hideCloseButton,\n children,\n contentRef,\n footer,\n header,\n id,\n onClickOutside,\n onClose,\n radius,\n scheme,\n shadow,\n width,\n } = props\n const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)\n const localContentRef = useRef<HTMLDivElement | null>(null)\n const layer = useLayer()\n const {isTopLayer} = layer\n const labelId = `${id}_label`\n const showCloseButton = Boolean(onClose) && hideCloseButton === false\n const showHeader = Boolean(header) || showCloseButton\n\n useEffect(() => {\n if (!autoFocus) return\n\n // On mount: focus the first interactive element in the contents\n if (localContentRef.current) {\n focusFirstDescendant(localContentRef.current)\n }\n }, [autoFocus])\n\n useGlobalKeyDown(\n useCallback(\n (event: KeyboardEvent) => {\n if (!isTopLayer || !onClose) return\n\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n onClose()\n }\n },\n [isTopLayer, onClose]\n )\n )\n\n useClickOutside(\n useCallback(() => {\n if (!isTopLayer || !onClickOutside) return\n\n onClickOutside()\n }, [isTopLayer, onClickOutside]),\n [rootElement]\n )\n\n const setRef = useCallback(\n (el: HTMLDivElement | null) => {\n setRootElement(el)\n if (typeof ref === 'function') ref(el)\n else if (ref) ref.current = el\n },\n [ref]\n )\n\n const setContentRef = useCallback(\n (el: HTMLDivElement | null) => {\n localContentRef.current = el\n if (typeof contentRef === 'function') contentRef(el)\n else if (contentRef) contentRef.current = el\n },\n [contentRef]\n )\n\n return (\n <DialogContainer data-ui=\"DialogCard\" width={width}>\n <DialogCardRoot radius={radius} ref={setRef} scheme={scheme} shadow={shadow}>\n <DialogLayout direction=\"column\">\n {showHeader && (\n <DialogHeader>\n <Flex>\n <Box flex={1} padding={4}>\n {header && (\n <Text id={labelId} weight=\"semibold\">\n {header}\n </Text>\n )}\n </Box>\n {showCloseButton && (\n <Box padding={2}>\n <Button\n aria-label=\"Close dialog\"\n disabled={!onClose}\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={onClose}\n padding={3}\n />\n </Box>\n )}\n </Flex>\n </DialogHeader>\n )}\n\n <DialogContent flex={1} ref={setContentRef} tabIndex={-1}>\n {children}\n </DialogContent>\n\n {footer && <DialogFooter>{footer}</DialogFooter>}\n </DialogLayout>\n </DialogCardRoot>\n </DialogContainer>\n )\n})\n\n/**\n * @public\n */\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'id' | 'width'>,\n ref: React.Ref<HTMLDivElement>\n) {\n const dialog = useDialog()\n const theme = useTheme()\n const {\n __unstable_autoFocus: autoFocus = true,\n __unstable_hideCloseButton: hideCloseButton = false,\n cardRadius = 3,\n cardShadow = 4,\n children,\n contentRef,\n footer,\n header,\n id,\n onClickOutside,\n onClose,\n padding = 4,\n position = dialog.position || 'fixed',\n scheme,\n width = 0,\n zOffset = dialog.zOffset || theme.sanity.layer?.dialog.zOffset,\n ...restProps\n } = props\n const preDivRef = useRef<HTMLDivElement | null>(null)\n const postDivRef = useRef<HTMLDivElement | null>(null)\n const cardRef = useRef<HTMLDivElement | null>(null)\n\n const handleFocus = useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n const target = event.target\n const cardElement = cardRef.current\n\n if (!cardElement) {\n return\n }\n\n if (target === preDivRef.current) {\n focusLastDescendant(cardElement)\n\n return\n }\n\n if (target === postDivRef.current) {\n focusFirstDescendant(cardElement)\n\n return\n }\n }, [])\n\n const labelId = `${id}_label`\n\n return (\n <Portal>\n <Root\n {...restProps}\n $padding={padding}\n $position={position}\n aria-labelledby={labelId}\n aria-modal\n data-ui=\"Dialog\"\n id={id}\n onFocus={handleFocus}\n ref={ref}\n role=\"dialog\"\n zOffset={zOffset}\n >\n <div ref={preDivRef} tabIndex={0} />\n <DialogCard\n __unstable_autoFocus={autoFocus}\n __unstable_hideCloseButton={hideCloseButton}\n contentRef={contentRef}\n footer={footer}\n header={header}\n id={id}\n onClickOutside={onClickOutside}\n onClose={onClose}\n radius={cardRadius}\n ref={cardRef}\n scheme={scheme}\n shadow={cardShadow}\n width={width}\n >\n {children}\n </DialogCard>\n <div ref={postDivRef} tabIndex={0} />\n </Root>\n </Portal>\n )\n})\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAKA;AAgDA,MAAM,OAAO,OAAO,OAClB,wBACA,aACA;AAGF,MAAM,kBAAkB,OA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AAA;AAAA;",
4
+ "sourcesContent": ["import {CloseIcon} from '@sanity/icons'\nimport React, {forwardRef, useCallback, useEffect, useRef, useState} from 'react'\nimport styled from 'styled-components'\nimport {focusFirstDescendant, focusLastDescendant} from '../../helpers'\nimport {useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'\nimport {Box, Button, Card, Container, Flex, Text} from '../../primitives'\nimport {ResponsivePaddingProps, ResponsiveWidthProps} from '../../primitives/types'\nimport {responsivePaddingStyle, ResponsivePaddingStyleProps} from '../../styles/internal'\nimport {ThemeColorSchemeKey, useTheme} from '../../theme'\nimport {DialogPosition} from '../../types'\nimport {Layer, Portal, useLayer} from '../../utils'\nimport {\n dialogStyle,\n responsiveDialogPositionStyle,\n ResponsiveDialogPositionStyleProps,\n} from './styles'\nimport {useDialog} from './useDialog'\n\n/**\n * @public\n */\nexport interface DialogProps extends ResponsivePaddingProps, ResponsiveWidthProps {\n /**\n * @beta\n */\n __unstable_autoFocus?: boolean\n /**\n * @beta\n */\n __unstable_hideCloseButton?: boolean\n cardRadius?: number | number[]\n cardShadow?: number | number[]\n contentRef?: React.ForwardedRef<HTMLDivElement>\n footer?: React.ReactNode\n header?: React.ReactNode\n id: string\n onClickOutside?: () => void\n onClose?: () => void\n portal?: string\n position?: DialogPosition | DialogPosition[]\n scheme?: ThemeColorSchemeKey\n zOffset?: number | number[]\n}\n\ninterface DialogCardProps extends ResponsiveWidthProps {\n /**\n * @beta\n */\n __unstable_autoFocus: boolean\n /**\n * @beta\n */\n __unstable_hideCloseButton: boolean\n children: React.ReactNode\n contentRef?: React.ForwardedRef<HTMLDivElement>\n footer: React.ReactNode\n header: React.ReactNode\n id: string\n onClickOutside?: () => void\n onClose?: () => void\n radius: number | number[]\n scheme?: ThemeColorSchemeKey\n shadow: number | number[]\n}\n\nconst Root = styled(Layer)<ResponsiveDialogPositionStyleProps & ResponsivePaddingStyleProps>(\n responsivePaddingStyle,\n dialogStyle,\n responsiveDialogPositionStyle\n)\n\nconst DialogContainer = styled(Container)`\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n`\n\nconst DialogCardRoot = styled(Card)`\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n`\n\nconst DialogLayout = styled(Flex)`\n flex: 1;\n min-height: 0;\n width: 100%;\n`\n\nconst DialogHeader = styled(Card)`\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n`\n\nconst DialogContent = styled(Box)`\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n`\n\nconst DialogFooter = styled(Box)`\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n`\n\nconst DialogCard = forwardRef(function DialogCard(\n props: DialogCardProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) {\n const {\n __unstable_autoFocus: autoFocus,\n __unstable_hideCloseButton: hideCloseButton,\n children,\n contentRef,\n footer,\n header,\n id,\n onClickOutside,\n onClose,\n radius,\n scheme,\n shadow,\n width,\n } = props\n const forwardedRef = useForwardedRef(ref)\n const [rootElement, setRootElement] = useState<HTMLDivElement | null>(null)\n const localContentRef = useRef<HTMLDivElement | null>(null)\n const layer = useLayer()\n const {isTopLayer} = layer\n const labelId = `${id}_label`\n const showCloseButton = Boolean(onClose) && hideCloseButton === false\n const showHeader = Boolean(header) || showCloseButton\n\n useEffect(() => {\n if (!autoFocus) return\n\n // On mount: focus the first interactive element in the contents\n if (forwardedRef.current) {\n focusFirstDescendant(forwardedRef.current)\n }\n }, [autoFocus, forwardedRef])\n\n useGlobalKeyDown(\n useCallback(\n (event: KeyboardEvent) => {\n if (!isTopLayer || !onClose) return\n\n if (event.key === 'Escape') {\n event.preventDefault()\n event.stopPropagation()\n onClose()\n }\n },\n [isTopLayer, onClose]\n )\n )\n\n useClickOutside(\n useCallback(() => {\n if (!isTopLayer || !onClickOutside) return\n\n onClickOutside()\n }, [isTopLayer, onClickOutside]),\n [rootElement]\n )\n\n const setRef = useCallback(\n (el: HTMLDivElement | null) => {\n setRootElement(el)\n forwardedRef.current = el\n },\n [forwardedRef]\n )\n\n const setContentRef = useCallback(\n (el: HTMLDivElement | null) => {\n localContentRef.current = el\n if (typeof contentRef === 'function') contentRef(el)\n else if (contentRef) contentRef.current = el\n },\n [contentRef]\n )\n\n return (\n <DialogContainer data-ui=\"DialogCard\" width={width}>\n <DialogCardRoot radius={radius} ref={setRef} scheme={scheme} shadow={shadow}>\n <DialogLayout direction=\"column\">\n {showHeader && (\n <DialogHeader>\n <Flex>\n <Box flex={1} padding={4}>\n {header && (\n <Text id={labelId} weight=\"semibold\">\n {header}\n </Text>\n )}\n </Box>\n {showCloseButton && (\n <Box padding={2}>\n <Button\n aria-label=\"Close dialog\"\n disabled={!onClose}\n icon={CloseIcon}\n mode=\"bleed\"\n onClick={onClose}\n padding={3}\n />\n </Box>\n )}\n </Flex>\n </DialogHeader>\n )}\n\n <DialogContent flex={1} ref={setContentRef} tabIndex={-1}>\n {children}\n </DialogContent>\n\n {footer && <DialogFooter>{footer}</DialogFooter>}\n </DialogLayout>\n </DialogCardRoot>\n </DialogContainer>\n )\n})\n\n/**\n * @public\n */\nexport const Dialog = forwardRef(function Dialog(\n props: DialogProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'id' | 'width'>,\n ref: React.Ref<HTMLDivElement>\n) {\n const dialog = useDialog()\n const theme = useTheme()\n const {\n __unstable_autoFocus: autoFocus = true,\n __unstable_hideCloseButton: hideCloseButton = false,\n cardRadius = 3,\n cardShadow = 4,\n children,\n contentRef,\n footer,\n header,\n id,\n onClickOutside,\n onClose,\n padding = 4,\n portal,\n position = dialog.position || 'fixed',\n scheme,\n width = 0,\n zOffset = dialog.zOffset || theme.sanity.layer?.dialog.zOffset,\n ...restProps\n } = props\n const preDivRef = useRef<HTMLDivElement | null>(null)\n const postDivRef = useRef<HTMLDivElement | null>(null)\n const cardRef = useRef<HTMLDivElement | null>(null)\n\n const handleFocus = useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n const target = event.target\n const cardElement = cardRef.current\n\n if (!cardElement) {\n return\n }\n\n if (target === preDivRef.current) {\n focusLastDescendant(cardElement)\n\n return\n }\n\n if (target === postDivRef.current) {\n focusFirstDescendant(cardElement)\n\n return\n }\n }, [])\n\n const labelId = `${id}_label`\n\n return (\n <Portal __unstable_name={portal}>\n <Root\n {...restProps}\n $padding={padding}\n $position={position}\n aria-labelledby={labelId}\n aria-modal\n data-ui=\"Dialog\"\n id={id}\n onFocus={handleFocus}\n ref={ref}\n role=\"dialog\"\n zOffset={zOffset}\n >\n <div ref={preDivRef} tabIndex={0} />\n <DialogCard\n __unstable_autoFocus={autoFocus}\n __unstable_hideCloseButton={hideCloseButton}\n contentRef={contentRef}\n footer={footer}\n header={header}\n id={id}\n onClickOutside={onClickOutside}\n onClose={onClose}\n radius={cardRadius}\n ref={cardRef}\n scheme={scheme}\n shadow={cardShadow}\n width={width}\n >\n {children}\n </DialogCard>\n <div ref={postDivRef} tabIndex={0} />\n </Root>\n </Portal>\n )\n})\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAAA;AAAA;AAAA;AAKA;AAiDA,MAAM,OAAO,OAAO,OAClB,wBACA,aACA;AAGF,MAAM,kBAAkB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAW/B,MAAM,iBAAiB,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAU9B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5B,MAAM,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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ACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,QAAM,YAAY,OAA8B;AAChD,QAAM,aAAa,OAA8B;AACjD,QAAM,UAAU,OAA8B;AAE9C,QAAM,cAAc,YAAY,CAAC,UAA4C;AAC3E,UAAM,SAAS,MAAM;AACrB,UAAM,cAAc,QAAQ;AAE5B,QAAI,CAAC,aAAa;AAChB;AAAA;AAGF,QAAI,WAAW,UAAU,SAAS;AAChC,0BAAoB;AAEpB;AAAA;AAGF,QAAI,WAAW,WAAW,SAAS;AACjC,2BAAqB;AAErB;AAAA;AAAA,KAED;AAEH,QAAM,UAAU,GAAG;AAEnB,SACE,oCAAC,QAAD;AAAA,IAAQ,iBAAiB;AAAA,KACvB,oCAAC,MAAD,iCACM,YADN;AAAA,IAEE,UAAU;AAAA,IACV,WAAW;AAAA,IACX,mBAAiB;AAAA,IACjB,cAAU;AAAA,IACV,WAAQ;AAAA,IACR;AAAA,IACA,SAAS;AAAA,IACT;AAAA,IACA,MAAK;AAAA,IACL;AAAA,MAEA,oCAAC,OAAD;AAAA,IAAK,KAAK;AAAA,IAAW,UAAU;AAAA,MAC/B,oCAAC,YAAD;AAAA,IACE,sBAAsB;AAAA,IACtB,4BAA4B;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,KAEC,WAEH,oCAAC,OAAD;AAAA,IAAK,KAAK;AAAA,IAAY,UAAU;AAAA;AAAA;",
6
6
  "names": []
7
7
  }
@@ -7,34 +7,34 @@ import { Placement } from '../../types';
7
7
  */
8
8
  export interface MenuButtonProps {
9
9
  /**
10
- * @deprecated Use `popover={{boundaryElement: ...}}` instead.
10
+ * @deprecated Use `popover={{boundaryElement: element}}` instead.
11
11
  */
12
12
  boundaryElement?: HTMLElement;
13
13
  button: React.ReactElement;
14
14
  id: string;
15
15
  menu?: React.ReactElement;
16
16
  /**
17
- * @deprecated Use `popover={{placement: ...}}` instead.
17
+ * @deprecated Use `popover={{placement: 'top'}}` instead.
18
18
  */
19
19
  placement?: Placement;
20
20
  popover?: Omit<PopoverProps, 'content' | 'open'>;
21
21
  /**
22
- * @deprecated Use `popover={{scheme: ...}}` instead.
22
+ * @deprecated Use `popover={{scheme: 'dark'}}` instead.
23
23
  */
24
24
  popoverScheme?: ThemeColorSchemeKey;
25
25
  /**
26
- * @deprecated Use `popover={{radius: ...}}` instead.
26
+ * @deprecated Use `popover={{radius: 2}}` instead.
27
27
  */
28
28
  popoverRadius?: number | number[];
29
29
  /**
30
30
  * Do not use in production.
31
31
  * @beta
32
32
  *
33
- * @deprecated Use `popover={{portal: ...}}` instead.
33
+ * @deprecated Use `popover={{portal: true}}` instead.
34
34
  */
35
35
  portal?: boolean;
36
36
  /**
37
- * @deprecated Use `popover={{preventOverflow: ...}}` instead.
37
+ * @deprecated Use `popover={{preventOverflow: true}}` instead.
38
38
  */
39
39
  preventOverflow?: boolean;
40
40
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/menu/menuButton.tsx"],
4
- "sourcesContent": ["import React, {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'\nimport {isElement} from 'react-is'\nimport {Popover, PopoverProps} from '../../primitives'\nimport {ThemeColorSchemeKey} from '../../theme'\nimport {Placement} from '../../types'\nimport {MenuProps} from './menu'\n\n/**\n * @public\n */\nexport interface MenuButtonProps {\n /**\n * @deprecated Use `popover={{boundaryElement: ...}}` instead.\n */\n boundaryElement?: HTMLElement\n button: React.ReactElement\n id: string\n menu?: React.ReactElement\n /**\n * @deprecated Use `popover={{placement: ...}}` instead.\n */\n placement?: Placement\n popover?: Omit<PopoverProps, 'content' | 'open'>\n /**\n * @deprecated Use `popover={{scheme: ...}}` instead.\n */\n popoverScheme?: ThemeColorSchemeKey\n /**\n * @deprecated Use `popover={{radius: ...}}` instead.\n */\n popoverRadius?: number | number[]\n /**\n * Do not use in production.\n * @beta\n *\n * @deprecated Use `popover={{portal: ...}}` instead.\n */\n portal?: boolean\n /**\n * @deprecated Use `popover={{preventOverflow: ...}}` instead.\n */\n preventOverflow?: boolean\n}\n\n/**\n * @public\n */\nexport const MenuButton = forwardRef(function MenuButton(\n props: MenuButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | null>\n) {\n const {\n boundaryElement,\n button: buttonProp,\n id,\n menu: menuProp,\n placement,\n popoverScheme,\n portal,\n popover,\n popoverRadius,\n preventOverflow,\n } = props\n const [open, setOpen] = useState(false)\n const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)\n const [buttonElement, setButtonElement] = useState<HTMLButtonElement | null>(null)\n const [menuElements, setChildMenuElements] = useState<HTMLElement[]>([])\n\n const handleButtonClick = useCallback(() => {\n setOpen((v) => !v)\n setShouldFocus(null)\n }, [])\n\n const handleButtonKeyDown = useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\n // On `ArrowDown`, `Enter` and `Space`\n // - Opens menu and moves focus to first menuitem\n if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('first')\n\n return\n }\n\n // On `ArrowUp`\n // - \tOpens menu and moves focus to last menuitem\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('last')\n\n return\n }\n }, [])\n\n const handleMenuClickOutside = useCallback(\n (event: MouseEvent) => {\n const target = event.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n if (buttonElement && (target === buttonElement || buttonElement.contains(target))) {\n return\n }\n\n for (const el of menuElements) {\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [buttonElement, menuElements]\n )\n\n const handleMenuEscape = useCallback(() => {\n setOpen(false)\n if (buttonElement) buttonElement.focus()\n }, [buttonElement])\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLButtonElement>) => {\n const target = event.relatedTarget\n\n if (!(target instanceof Node)) {\n return\n }\n\n for (const el of menuElements) {\n if (el === target || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [menuElements]\n )\n\n const handleItemClick = useCallback(() => {\n setOpen(false)\n if (buttonElement) buttonElement.focus()\n }, [buttonElement])\n\n const registerElement = useCallback((el: HTMLElement) => {\n setChildMenuElements((els) => els.concat([el]))\n\n return () => {\n setChildMenuElements((els) => {\n return els.filter((_el) => _el !== el)\n })\n }\n }, [])\n\n const menuProps: MenuProps = useMemo(\n () => ({\n 'aria-labelledby': id,\n onBlurCapture: handleBlur,\n onClickOutside: handleMenuClickOutside,\n onEscape: handleMenuEscape,\n onItemClick: handleItemClick,\n originElement: buttonElement,\n registerElement,\n shouldFocus,\n }),\n [\n buttonElement,\n handleMenuClickOutside,\n handleMenuEscape,\n handleItemClick,\n id,\n handleBlur,\n registerElement,\n shouldFocus,\n ]\n )\n\n const menu = isElement(menuProp) ? cloneElement(menuProp, menuProps) : null\n\n const setButtonRef = useCallback(\n (el: HTMLButtonElement | null) => {\n if (typeof ref === 'function') {\n ref(el)\n } else if (ref) {\n ref.current = el\n }\n\n setButtonElement(el)\n },\n [ref]\n )\n\n const button = useMemo(\n () =>\n isElement(buttonProp)\n ? cloneElement(buttonProp, {\n 'data-ui': 'MenuButton',\n id,\n onClick: handleButtonClick,\n onKeyDown: handleButtonKeyDown,\n 'aria-haspopup': true,\n 'aria-expanded': open,\n ref: setButtonRef,\n selected: open,\n })\n : null,\n [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]\n )\n\n const popoverProps: PopoverProps = useMemo(() => {\n return {\n boundaryElement,\n placement,\n portal,\n radius: popoverRadius,\n overflow: preventOverflow,\n scheme: popoverScheme,\n ...(popover || {}),\n }\n }, [boundaryElement, placement, popover, popoverRadius, portal, preventOverflow, popoverScheme])\n\n return (\n <Popover {...popoverProps} content={menu} data-ui=\"MenuButton__popover\" open={open}>\n {button || <></>}\n </Popover>\n )\n})\n"],
4
+ "sourcesContent": ["import React, {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'\nimport {isElement} from 'react-is'\nimport {Popover, PopoverProps} from '../../primitives'\nimport {ThemeColorSchemeKey} from '../../theme'\nimport {Placement} from '../../types'\nimport {MenuProps} from './menu'\n\n/**\n * @public\n */\nexport interface MenuButtonProps {\n /**\n * @deprecated Use `popover={{boundaryElement: element}}` instead.\n */\n boundaryElement?: HTMLElement\n button: React.ReactElement\n id: string\n menu?: React.ReactElement\n /**\n * @deprecated Use `popover={{placement: 'top'}}` instead.\n */\n placement?: Placement\n popover?: Omit<PopoverProps, 'content' | 'open'>\n /**\n * @deprecated Use `popover={{scheme: 'dark'}}` instead.\n */\n popoverScheme?: ThemeColorSchemeKey\n /**\n * @deprecated Use `popover={{radius: 2}}` instead.\n */\n popoverRadius?: number | number[]\n /**\n * Do not use in production.\n * @beta\n *\n * @deprecated Use `popover={{portal: true}}` instead.\n */\n portal?: boolean\n /**\n * @deprecated Use `popover={{preventOverflow: true}}` instead.\n */\n preventOverflow?: boolean\n}\n\n/**\n * @public\n */\nexport const MenuButton = forwardRef(function MenuButton(\n props: MenuButtonProps,\n ref: React.ForwardedRef<HTMLButtonElement | null>\n) {\n const {\n boundaryElement,\n button: buttonProp,\n id,\n menu: menuProp,\n placement,\n popoverScheme,\n portal,\n popover,\n popoverRadius,\n preventOverflow,\n } = props\n const [open, setOpen] = useState(false)\n const [shouldFocus, setShouldFocus] = useState<'first' | 'last' | null>(null)\n const [buttonElement, setButtonElement] = useState<HTMLButtonElement | null>(null)\n const [menuElements, setChildMenuElements] = useState<HTMLElement[]>([])\n\n const handleButtonClick = useCallback(() => {\n setOpen((v) => !v)\n setShouldFocus(null)\n }, [])\n\n const handleButtonKeyDown = useCallback((event: React.KeyboardEvent<HTMLButtonElement>) => {\n // On `ArrowDown`, `Enter` and `Space`\n // - Opens menu and moves focus to first menuitem\n if (event.key === 'ArrowDown' || event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('first')\n\n return\n }\n\n // On `ArrowUp`\n // - \tOpens menu and moves focus to last menuitem\n if (event.key === 'ArrowUp') {\n event.preventDefault()\n setOpen(true)\n setShouldFocus('last')\n\n return\n }\n }, [])\n\n const handleMenuClickOutside = useCallback(\n (event: MouseEvent) => {\n const target = event.target\n\n if (!(target instanceof Node)) {\n return\n }\n\n if (buttonElement && (target === buttonElement || buttonElement.contains(target))) {\n return\n }\n\n for (const el of menuElements) {\n if (target === el || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [buttonElement, menuElements]\n )\n\n const handleMenuEscape = useCallback(() => {\n setOpen(false)\n if (buttonElement) buttonElement.focus()\n }, [buttonElement])\n\n const handleBlur = useCallback(\n (event: React.FocusEvent<HTMLButtonElement>) => {\n const target = event.relatedTarget\n\n if (!(target instanceof Node)) {\n return\n }\n\n for (const el of menuElements) {\n if (el === target || el.contains(target)) {\n return\n }\n }\n\n setOpen(false)\n },\n [menuElements]\n )\n\n const handleItemClick = useCallback(() => {\n setOpen(false)\n if (buttonElement) buttonElement.focus()\n }, [buttonElement])\n\n const registerElement = useCallback((el: HTMLElement) => {\n setChildMenuElements((els) => els.concat([el]))\n\n return () => {\n setChildMenuElements((els) => {\n return els.filter((_el) => _el !== el)\n })\n }\n }, [])\n\n const menuProps: MenuProps = useMemo(\n () => ({\n 'aria-labelledby': id,\n onBlurCapture: handleBlur,\n onClickOutside: handleMenuClickOutside,\n onEscape: handleMenuEscape,\n onItemClick: handleItemClick,\n originElement: buttonElement,\n registerElement,\n shouldFocus,\n }),\n [\n buttonElement,\n handleMenuClickOutside,\n handleMenuEscape,\n handleItemClick,\n id,\n handleBlur,\n registerElement,\n shouldFocus,\n ]\n )\n\n const menu = isElement(menuProp) ? cloneElement(menuProp, menuProps) : null\n\n const setButtonRef = useCallback(\n (el: HTMLButtonElement | null) => {\n if (typeof ref === 'function') {\n ref(el)\n } else if (ref) {\n ref.current = el\n }\n\n setButtonElement(el)\n },\n [ref]\n )\n\n const button = useMemo(\n () =>\n isElement(buttonProp)\n ? cloneElement(buttonProp, {\n 'data-ui': 'MenuButton',\n id,\n onClick: handleButtonClick,\n onKeyDown: handleButtonKeyDown,\n 'aria-haspopup': true,\n 'aria-expanded': open,\n ref: setButtonRef,\n selected: open,\n })\n : null,\n [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]\n )\n\n const popoverProps: PopoverProps = useMemo(() => {\n return {\n boundaryElement,\n placement,\n portal,\n radius: popoverRadius,\n overflow: preventOverflow,\n scheme: popoverScheme,\n ...(popover || {}),\n }\n }, [boundaryElement, placement, popover, popoverRadius, portal, preventOverflow, popoverScheme])\n\n return (\n <Popover {...popoverProps} content={menu} data-ui=\"MenuButton__popover\" open={open}>\n {button || <></>}\n </Popover>\n )\n})\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AA6CO,MAAM,aAAa,WAAW,qBACnC,OACA,KACA;AACA,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE;AACJ,QAAM,CAAC,MAAM,WAAW,SAAS;AACjC,QAAM,CAAC,aAAa,kBAAkB,SAAkC;AACxE,QAAM,CAAC,eAAe,oBAAoB,SAAmC;AAC7E,QAAM,CAAC,cAAc,wBAAwB,SAAwB;AAErE,QAAM,oBAAoB,YAAY,MAAM;AAC1C,YAAQ,CAAC,MAAM,CAAC;AAChB,mBAAe;AAAA,KACd;AAEH,QAAM,sBAAsB,YAAY,CAAC,UAAkD;AAGzF,QAAI,MAAM,QAAQ,eAAe,MAAM,QAAQ,WAAW,MAAM,QAAQ,KAAK;AAC3E,YAAM;AACN,cAAQ;AACR,qBAAe;AAEf;AAAA;AAKF,QAAI,MAAM,QAAQ,WAAW;AAC3B,YAAM;AACN,cAAQ;AAC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YAAY,aAAa,UAAU,aAAa;AAEvE,QAAM,eAAe,YACnB,CAAC,OAAiC;AAChC,QAAI,OAAO,QAAQ,YAAY;AAC7B,UAAI;AAAA,eACK,KAAK;AACd,UAAI,UAAU;AAAA;AAGhB,qBAAiB;AAAA,KAEnB,CAAC;AAGH,QAAM,SAAS,QACb,MACE,UAAU,cACN,aAAa,YAAY;AAAA,IACvB,WAAW;AAAA,IACX;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,KAAK;AAAA,IACL,UAAU;AAAA,OAEZ,MACN,CAAC,YAAY,mBAAmB,qBAAqB,IAAI,MAAM;AAGjE,QAAM,eAA6B,QAAQ,MAAM;AAC/C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,QAAQ;AAAA,OACJ,WAAW;AAAA,KAEhB,CAAC,iBAAiB,WAAW,SAAS,eAAe,QAAQ,iBAAiB;AAEjF,SACE,oCAAC,SAAD,iCAAa,eAAb;AAAA,IAA2B,SAAS;AAAA,IAAM,WAAQ;AAAA,IAAsB;AAAA,MACrE,UAAU;AAAA;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,2 @@
1
+ export * from './useUnique';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/_internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
@@ -0,0 +1 @@
1
+ export * from "./useUnique";
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/hooks/_internal/index.ts"],
4
+ "sourcesContent": ["export * from './useUnique'\n"],
5
+ "mappings": "AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This is React hook – an and escape hatch – to make sure that a value is the same
3
+ * on every render. SHOULD NOT BE USED IN MOST CASES.
4
+ *
5
+ * @internal
6
+ */
7
+ export declare function useUnique<ValueType>(value: ValueType): ValueType;
8
+ //# sourceMappingURL=useUnique.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUnique.d.ts","sourceRoot":"","sources":["../../../../src/hooks/_internal/useUnique.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,CAQhE"}
@@ -0,0 +1,12 @@
1
+ import { isEqual } from "lodash";
2
+ import { useRef } from "react";
3
+ function useUnique(value) {
4
+ const valueRef = useRef(value);
5
+ if (!isEqual(valueRef.current, value)) {
6
+ valueRef.current = value;
7
+ }
8
+ return valueRef.current;
9
+ }
10
+ export {
11
+ useUnique
12
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/hooks/_internal/useUnique.ts"],
4
+ "sourcesContent": ["import {isEqual} from 'lodash'\nimport {useRef} from 'react'\n\n/**\n * This is React hook \u2013 an and escape hatch \u2013 to make sure that a value is the same\n * on every render. SHOULD NOT BE USED IN MOST CASES.\n *\n * @internal\n */\nexport function useUnique<ValueType>(value: ValueType): ValueType {\n const valueRef = useRef<ValueType>(value)\n\n if (!isEqual(valueRef.current, value)) {\n valueRef.current = value\n }\n\n return valueRef.current\n}\n"],
5
+ "mappings": "AAAA;AACA;AAQO,mBAA8B,OAA6B;AAChE,QAAM,WAAW,OAAkB;AAEnC,MAAI,CAAC,QAAQ,SAAS,SAAS,QAAQ;AACrC,aAAS,UAAU;AAAA;AAGrB,SAAO,SAAS;AAAA;",
6
+ "names": []
7
+ }
@@ -22,7 +22,7 @@ export interface PopoverProps extends Omit<LayerProps, 'as'>, ResponsiveRadiusPr
22
22
  open?: boolean;
23
23
  padding?: number | number[];
24
24
  placement?: Placement;
25
- portal?: boolean;
25
+ portal?: boolean | string;
26
26
  preventOverflow?: boolean;
27
27
  referenceElement?: HTMLElement | null;
28
28
  matchReferenceWidth?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../../../src/primitives/popover/popover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4E,MAAM,OAAO,CAAA;AAKhG,OAAO,EAAC,mBAAmB,EAAW,MAAM,aAAa,CAAA;AACzD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAC,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAQ,UAAU,EAAwC,MAAM,aAAa,CAAA;AAIpF,OAAO,EAAC,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,UAAU,CAAA;AAI3F;;GAEG;AACH,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB;IACtB;;OAEG;IACH,kBAAkB,CAAC,EAAE,cAAc,CAAA;IACnC,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAA;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,eAAe,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACpC,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kBAAkB,CAAC,EAAE,SAAS,EAAE,CAAA;IAChC,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gBAAgB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAA;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MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACzB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gBAAgB,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;IACrC,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,MAAM,CAAC,EAAE,mBAAmB,CAAA;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,CAAC,CAAA;IACpD,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB;AAgDD;;GAEG;AACH,eAAO,MAAM,OAAO,+1LAoJlB,CAAA"}
@@ -203,7 +203,9 @@ const Popover = forwardRef(function Popover2(props, ref) {
203
203
  ref: setArrowElement,
204
204
  style: styles.arrow
205
205
  }), content));
206
- return /* @__PURE__ */ React.createElement(React.Fragment, null, child && !referenceElementProp ? cloneElement(child, { ref: setRef }) : child || /* @__PURE__ */ React.createElement(React.Fragment, null), open && /* @__PURE__ */ React.createElement(React.Fragment, null, portalProp && /* @__PURE__ */ React.createElement(Portal, null, node), !portalProp && node));
206
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, child && !referenceElementProp ? cloneElement(child, { ref: setRef }) : child || /* @__PURE__ */ React.createElement(React.Fragment, null), open && /* @__PURE__ */ React.createElement(React.Fragment, null, portalProp && /* @__PURE__ */ React.createElement(Portal, {
207
+ __unstable_name: typeof portalProp === "string" ? portalProp : void 0
208
+ }, node), !portalProp && node));
207
209
  });
208
210
  export {
209
211
  Popover