@neo4j-ndl/react 4.23.5 → 4.24.1

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 (94) hide show
  1. package/lib/cjs/announcement-banner/AnnouncementBanner.js +198 -0
  2. package/lib/cjs/announcement-banner/AnnouncementBanner.js.map +1 -0
  3. package/lib/cjs/announcement-banner/index.js +38 -0
  4. package/lib/cjs/announcement-banner/index.js.map +1 -0
  5. package/lib/cjs/announcement-banner/stories/announcement-banner-closeable.story.js +30 -0
  6. package/lib/cjs/announcement-banner/stories/announcement-banner-closeable.story.js.map +1 -0
  7. package/lib/cjs/announcement-banner/stories/announcement-banner-custom-icons.story.js +31 -0
  8. package/lib/cjs/announcement-banner/stories/announcement-banner-custom-icons.story.js.map +1 -0
  9. package/lib/cjs/announcement-banner/stories/announcement-banner-default.story.js +30 -0
  10. package/lib/cjs/announcement-banner/stories/announcement-banner-default.story.js.map +1 -0
  11. package/lib/cjs/announcement-banner/stories/announcement-banner-injected-non-urgent.story.js +32 -0
  12. package/lib/cjs/announcement-banner/stories/announcement-banner-injected-non-urgent.story.js.map +1 -0
  13. package/lib/cjs/announcement-banner/stories/announcement-banner-injected-urgent.story.js +32 -0
  14. package/lib/cjs/announcement-banner/stories/announcement-banner-injected-urgent.story.js.map +1 -0
  15. package/lib/cjs/announcement-banner/stories/announcement-banner-present-at-page-render.story.js +30 -0
  16. package/lib/cjs/announcement-banner/stories/announcement-banner-present-at-page-render.story.js.map +1 -0
  17. package/lib/cjs/announcement-banner/stories/announcement-banner-variants.story.js +30 -0
  18. package/lib/cjs/announcement-banner/stories/announcement-banner-variants.story.js.map +1 -0
  19. package/lib/cjs/announcement-banner/stories/announcement-banner-with-actions.story.js +30 -0
  20. package/lib/cjs/announcement-banner/stories/announcement-banner-with-actions.story.js.map +1 -0
  21. package/lib/cjs/announcement-banner/stories/announcement-banner-with-page-content.story.js +32 -0
  22. package/lib/cjs/announcement-banner/stories/announcement-banner-with-page-content.story.js.map +1 -0
  23. package/lib/cjs/announcement-banner/stories/index.js +64 -0
  24. package/lib/cjs/announcement-banner/stories/index.js.map +1 -0
  25. package/lib/cjs/index.js +4 -2
  26. package/lib/cjs/index.js.map +1 -1
  27. package/lib/cjs/popover/Popover.js +3 -2
  28. package/lib/cjs/popover/Popover.js.map +1 -1
  29. package/lib/cjs/popover/use-popover.js +3 -1
  30. package/lib/cjs/popover/use-popover.js.map +1 -1
  31. package/lib/esm/announcement-banner/AnnouncementBanner.js +159 -0
  32. package/lib/esm/announcement-banner/AnnouncementBanner.js.map +1 -0
  33. package/lib/esm/announcement-banner/index.js +22 -0
  34. package/lib/esm/announcement-banner/index.js.map +1 -0
  35. package/lib/esm/announcement-banner/stories/announcement-banner-closeable.story.js +28 -0
  36. package/lib/esm/announcement-banner/stories/announcement-banner-closeable.story.js.map +1 -0
  37. package/lib/esm/announcement-banner/stories/announcement-banner-custom-icons.story.js +29 -0
  38. package/lib/esm/announcement-banner/stories/announcement-banner-custom-icons.story.js.map +1 -0
  39. package/lib/esm/announcement-banner/stories/announcement-banner-default.story.js +28 -0
  40. package/lib/esm/announcement-banner/stories/announcement-banner-default.story.js.map +1 -0
  41. package/lib/esm/announcement-banner/stories/announcement-banner-injected-non-urgent.story.js +30 -0
  42. package/lib/esm/announcement-banner/stories/announcement-banner-injected-non-urgent.story.js.map +1 -0
  43. package/lib/esm/announcement-banner/stories/announcement-banner-injected-urgent.story.js +30 -0
  44. package/lib/esm/announcement-banner/stories/announcement-banner-injected-urgent.story.js.map +1 -0
  45. package/lib/esm/announcement-banner/stories/announcement-banner-present-at-page-render.story.js +28 -0
  46. package/lib/esm/announcement-banner/stories/announcement-banner-present-at-page-render.story.js.map +1 -0
  47. package/lib/esm/announcement-banner/stories/announcement-banner-variants.story.js +28 -0
  48. package/lib/esm/announcement-banner/stories/announcement-banner-variants.story.js.map +1 -0
  49. package/lib/esm/announcement-banner/stories/announcement-banner-with-actions.story.js +28 -0
  50. package/lib/esm/announcement-banner/stories/announcement-banner-with-actions.story.js.map +1 -0
  51. package/lib/esm/announcement-banner/stories/announcement-banner-with-page-content.story.js +30 -0
  52. package/lib/esm/announcement-banner/stories/announcement-banner-with-page-content.story.js.map +1 -0
  53. package/lib/esm/announcement-banner/stories/index.js +49 -0
  54. package/lib/esm/announcement-banner/stories/index.js.map +1 -0
  55. package/lib/esm/index.js +1 -0
  56. package/lib/esm/index.js.map +1 -1
  57. package/lib/esm/popover/Popover.js +3 -2
  58. package/lib/esm/popover/Popover.js.map +1 -1
  59. package/lib/esm/popover/use-popover.js +3 -1
  60. package/lib/esm/popover/use-popover.js.map +1 -1
  61. package/lib/types/announcement-banner/AnnouncementBanner.d.ts +75 -0
  62. package/lib/types/announcement-banner/AnnouncementBanner.d.ts.map +1 -0
  63. package/lib/types/announcement-banner/index.d.ts +22 -0
  64. package/lib/types/announcement-banner/index.d.ts.map +1 -0
  65. package/lib/types/announcement-banner/stories/announcement-banner-closeable.story.d.ts +24 -0
  66. package/lib/types/announcement-banner/stories/announcement-banner-closeable.story.d.ts.map +1 -0
  67. package/lib/types/announcement-banner/stories/announcement-banner-custom-icons.story.d.ts +24 -0
  68. package/lib/types/announcement-banner/stories/announcement-banner-custom-icons.story.d.ts.map +1 -0
  69. package/lib/types/announcement-banner/stories/announcement-banner-default.story.d.ts +24 -0
  70. package/lib/types/announcement-banner/stories/announcement-banner-default.story.d.ts.map +1 -0
  71. package/lib/types/announcement-banner/stories/announcement-banner-injected-non-urgent.story.d.ts +24 -0
  72. package/lib/types/announcement-banner/stories/announcement-banner-injected-non-urgent.story.d.ts.map +1 -0
  73. package/lib/types/announcement-banner/stories/announcement-banner-injected-urgent.story.d.ts +24 -0
  74. package/lib/types/announcement-banner/stories/announcement-banner-injected-urgent.story.d.ts.map +1 -0
  75. package/lib/types/announcement-banner/stories/announcement-banner-present-at-page-render.story.d.ts +24 -0
  76. package/lib/types/announcement-banner/stories/announcement-banner-present-at-page-render.story.d.ts.map +1 -0
  77. package/lib/types/announcement-banner/stories/announcement-banner-variants.story.d.ts +24 -0
  78. package/lib/types/announcement-banner/stories/announcement-banner-variants.story.d.ts.map +1 -0
  79. package/lib/types/announcement-banner/stories/announcement-banner-with-actions.story.d.ts +24 -0
  80. package/lib/types/announcement-banner/stories/announcement-banner-with-actions.story.d.ts.map +1 -0
  81. package/lib/types/announcement-banner/stories/announcement-banner-with-page-content.story.d.ts +24 -0
  82. package/lib/types/announcement-banner/stories/announcement-banner-with-page-content.story.d.ts.map +1 -0
  83. package/lib/types/announcement-banner/stories/index.d.ts +39 -0
  84. package/lib/types/announcement-banner/stories/index.d.ts.map +1 -0
  85. package/lib/types/index.d.ts +1 -0
  86. package/lib/types/index.d.ts.map +1 -1
  87. package/lib/types/popover/Popover.d.ts +7 -1
  88. package/lib/types/popover/Popover.d.ts.map +1 -1
  89. package/lib/types/popover/use-popover.d.ts +3 -1
  90. package/lib/types/popover/use-popover.d.ts.map +1 -1
  91. package/package.json +7 -2
  92. package/skills/ndl-react/SKILL.md +3 -2
  93. package/skills/ndl-react/components/announcement-banner.md +468 -0
  94. package/skills/ndl-react/components/popover.md +3 -0
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const react_2 = require("react");
27
+ const Component = () => {
28
+ const [isVisible, setIsVisible] = (0, react_2.useState)(true);
29
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-max-w-[768px] n-h-52", children: [isVisible && ((0, jsx_runtime_1.jsxs)(react_1.AnnouncementBanner, { variant: "warning", hasIcon: true, isCloseable: true, onClose: () => setIsVisible(false), children: [(0, jsx_runtime_1.jsx)(react_1.AnnouncementBanner.Header, { children: "Scheduled maintenance starts tonight at 22:00 UTC." }), (0, jsx_runtime_1.jsx)(react_1.AnnouncementBanner.Actions, { children: (0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { children: "Learn more" }) })] })), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16 n-p-token-24 n-bg-neutral-bg-default n-flex-1 n-min-h-0 n-overflow-y-auto", children: [!isVisible && ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(react_1.TextButton, { onClick: () => setIsVisible(true), children: "Show announcement again" }) })), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-2", children: "Page title" }), (0, jsx_runtime_1.jsx)(react_1.OutlinedButton, { children: "Can focus" }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque tempus, quam non molestie faucibus, orci nibh bibendum urna, ut lacinia orci dui a augue. Nullam at risus quam. Fusce pulvinar, metus vitae finibus dapibus, nisi ipsum venenatis sapien, at facilisis eros massa ac nunc. Aliquam sed odio orci. Vivamus condimentum sit amet ipsum bibendum sollicitudin. Etiam eget vehicula urna, et ullamcorper libero. Interdum et malesuada fames ac ante ipsum primis in faucibus. Proin sodales euismod sem, posuere maximus libero interdum semper. Nunc mollis posuere arcu non elementum. Vivamus sed laoreet mauris. Etiam fringilla arcu convallis erat vehicula iaculis. Pellentesque dictum aliquam cursus." }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "Integer vehicula turpis quis risus aliquet congue. Vivamus pellentesque nibh ac blandit varius. Fusce placerat lacus ut mauris porta, nec facilisis risus pulvinar. Nullam elementum nulla ut laoreet imperdiet. Maecenas eget erat erat. Phasellus in turpis placerat, imperdiet ante nec, tincidunt nisl. Donec a lacus neque. Nullam iaculis ante molestie ultrices semper. Sed non lorem ullamcorper ligula elementum convallis. Aenean egestas risus quis tortor cursus dapibus. Nulla hendrerit at orci ut scelerisque. Nullam vel bibendum tellus. Praesent efficitur ultrices lectus at posuere. Maecenas facilisis lacus ac turpis malesuada, sit amet imperdiet ipsum condimentum. Donec et nibh eget justo luctus ornare. Maecenas suscipit nulla at ullamcorper congue." }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "Vestibulum vehicula nibh mi, ultrices condimentum massa venenatis sit amet. Pellentesque accumsan mollis ex, id lobortis lacus venenatis id. Proin sem dui, mollis id gravida ac, vulputate et lacus. In pharetra nunc odio, in fermentum elit dignissim at. Nunc ut justo elit. Proin ligula orci, faucibus vitae vehicula nec, faucibus sit amet erat. Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque pharetra venenatis rutrum. Sed pharetra turpis id arcu maximus, interdum rhoncus eros mollis. Donec vitae sapien et odio interdum bibendum. Quisque eleifend, sem ut ornare mollis, orci nunc dapibus odio, aliquam fringilla augue nulla id magna. Phasellus consectetur, velit egestas sodales ultricies, odio nunc facilisis libero, vel vehicula nisi quam quis nisl. Proin vel massa libero." }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "Sed mollis lacinia tincidunt. Curabitur blandit pellentesque consequat. Maecenas mollis pharetra dolor in ornare. Cras vel nibh eu nisi venenatis convallis id vel nisl. Curabitur et viverra nisl. Phasellus et finibus turpis. Praesent scelerisque vel lectus at imperdiet. Curabitur porta egestas magna ullamcorper hendrerit." }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "body-medium", children: "Curabitur hendrerit egestas mi, ut venenatis turpis sagittis nec. Proin consectetur, nisi et vehicula placerat, tellus augue luctus odio, in commodo mauris urna nec libero. Maecenas eu placerat sapien, in aliquam tellus. Sed pharetra nunc id urna iaculis tincidunt. In hac habitasse platea dictumst. Donec tincidunt risus vitae congue congue. Fusce consequat ut justo ut tristique. Nunc ut urna quis neque consequat venenatis. Praesent nec feugiat orci. Vestibulum rutrum dui lacus, sit amet vulputate dolor finibus ut. Donec placerat urna eu fringilla convallis. Praesent sollicitudin felis at lacus semper, vel convallis magna scelerisque." })] })] }));
30
+ };
31
+ exports.default = Component;
32
+ //# sourceMappingURL=announcement-banner-with-page-content.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"announcement-banner-with-page-content.story.js","sourceRoot":"","sources":["../../../../src/announcement-banner/stories/announcement-banner-with-page-content.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAK0B;AAC1B,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IAEjD,OAAO,CACL,iCAAK,SAAS,EAAC,0CAA0C,aACtD,SAAS,IAAI,CACZ,wBAAC,0BAAkB,IACjB,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,IAAI,EACb,WAAW,EAAE,IAAI,EACjB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,aAElC,uBAAC,0BAAkB,CAAC,MAAM,qEAEE,EAC5B,uBAAC,0BAAkB,CAAC,OAAO,cACzB,uBAAC,sBAAc,6BAA4B,GAChB,IACV,CACtB,EACD,iCAAK,SAAS,EAAC,4GAA4G,aACxH,CAAC,SAAS,IAAI,CACb,0CACE,uBAAC,kBAAU,IAAC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,wCAEhC,GACT,CACP,EACD,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,2BAAwB,EACrD,uBAAC,sBAAc,4BAA2B,EAC1C,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,6sBAYpB,EACb,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,owBAapB,EACb,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,izBAapB,EACb,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,oVAMpB,EACb,uBAAC,kBAAU,IAAC,OAAO,EAAC,aAAa,kpBAWpB,IACT,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\n AnnouncementBanner,\n OutlinedButton,\n TextButton,\n Typography,\n} from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [isVisible, setIsVisible] = useState(true);\n\n return (\n <div className=\"n-flex n-flex-col n-max-w-[768px] n-h-52\">\n {isVisible && (\n <AnnouncementBanner\n variant=\"warning\"\n hasIcon={true}\n isCloseable={true}\n onClose={() => setIsVisible(false)}\n >\n <AnnouncementBanner.Header>\n Scheduled maintenance starts tonight at 22:00 UTC.\n </AnnouncementBanner.Header>\n <AnnouncementBanner.Actions>\n <OutlinedButton>Learn more</OutlinedButton>\n </AnnouncementBanner.Actions>\n </AnnouncementBanner>\n )}\n <div className=\"n-flex n-flex-col n-gap-token-16 n-p-token-24 n-bg-neutral-bg-default n-flex-1 n-min-h-0 n-overflow-y-auto\">\n {!isVisible && (\n <div>\n <TextButton onClick={() => setIsVisible(true)}>\n Show announcement again\n </TextButton>\n </div>\n )}\n <Typography variant=\"title-2\">Page title</Typography>\n <OutlinedButton>Can focus</OutlinedButton>\n <Typography variant=\"body-medium\">\n Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque\n tempus, quam non molestie faucibus, orci nibh bibendum urna, ut\n lacinia orci dui a augue. Nullam at risus quam. Fusce pulvinar, metus\n vitae finibus dapibus, nisi ipsum venenatis sapien, at facilisis eros\n massa ac nunc. Aliquam sed odio orci. Vivamus condimentum sit amet\n ipsum bibendum sollicitudin. Etiam eget vehicula urna, et ullamcorper\n libero. Interdum et malesuada fames ac ante ipsum primis in faucibus.\n Proin sodales euismod sem, posuere maximus libero interdum semper.\n Nunc mollis posuere arcu non elementum. Vivamus sed laoreet mauris.\n Etiam fringilla arcu convallis erat vehicula iaculis. Pellentesque\n dictum aliquam cursus.\n </Typography>\n <Typography variant=\"body-medium\">\n Integer vehicula turpis quis risus aliquet congue. Vivamus\n pellentesque nibh ac blandit varius. Fusce placerat lacus ut mauris\n porta, nec facilisis risus pulvinar. Nullam elementum nulla ut laoreet\n imperdiet. Maecenas eget erat erat. Phasellus in turpis placerat,\n imperdiet ante nec, tincidunt nisl. Donec a lacus neque. Nullam\n iaculis ante molestie ultrices semper. Sed non lorem ullamcorper\n ligula elementum convallis. Aenean egestas risus quis tortor cursus\n dapibus. Nulla hendrerit at orci ut scelerisque. Nullam vel bibendum\n tellus. Praesent efficitur ultrices lectus at posuere. Maecenas\n facilisis lacus ac turpis malesuada, sit amet imperdiet ipsum\n condimentum. Donec et nibh eget justo luctus ornare. Maecenas suscipit\n nulla at ullamcorper congue.\n </Typography>\n <Typography variant=\"body-medium\">\n Vestibulum vehicula nibh mi, ultrices condimentum massa venenatis sit\n amet. Pellentesque accumsan mollis ex, id lobortis lacus venenatis id.\n Proin sem dui, mollis id gravida ac, vulputate et lacus. In pharetra\n nunc odio, in fermentum elit dignissim at. Nunc ut justo elit. Proin\n ligula orci, faucibus vitae vehicula nec, faucibus sit amet erat.\n Interdum et malesuada fames ac ante ipsum primis in faucibus. Quisque\n pharetra venenatis rutrum. Sed pharetra turpis id arcu maximus,\n interdum rhoncus eros mollis. Donec vitae sapien et odio interdum\n bibendum. Quisque eleifend, sem ut ornare mollis, orci nunc dapibus\n odio, aliquam fringilla augue nulla id magna. Phasellus consectetur,\n velit egestas sodales ultricies, odio nunc facilisis libero, vel\n vehicula nisi quam quis nisl. Proin vel massa libero.\n </Typography>\n <Typography variant=\"body-medium\">\n Sed mollis lacinia tincidunt. Curabitur blandit pellentesque\n consequat. Maecenas mollis pharetra dolor in ornare. Cras vel nibh eu\n nisi venenatis convallis id vel nisl. Curabitur et viverra nisl.\n Phasellus et finibus turpis. Praesent scelerisque vel lectus at\n imperdiet. Curabitur porta egestas magna ullamcorper hendrerit.\n </Typography>\n <Typography variant=\"body-medium\">\n Curabitur hendrerit egestas mi, ut venenatis turpis sagittis nec.\n Proin consectetur, nisi et vehicula placerat, tellus augue luctus\n odio, in commodo mauris urna nec libero. Maecenas eu placerat sapien,\n in aliquam tellus. Sed pharetra nunc id urna iaculis tincidunt. In hac\n habitasse platea dictumst. Donec tincidunt risus vitae congue congue.\n Fusce consequat ut justo ut tristique. Nunc ut urna quis neque\n consequat venenatis. Praesent nec feugiat orci. Vestibulum rutrum dui\n lacus, sit amet vulputate dolor finibus ut. Donec placerat urna eu\n fringilla convallis. Praesent sollicitudin felis at lacus semper, vel\n convallis magna scelerisque.\n </Typography>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ /**
3
+ *
4
+ * Copyright (c) "Neo4j"
5
+ * Neo4j Sweden AB [http://neo4j.com]
6
+ *
7
+ * This file is part of Neo4j.
8
+ *
9
+ * Neo4j is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * This program is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
21
+ */
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.AnnouncementBannerInjectedUrgentSrc = exports.AnnouncementBannerInjectedNonUrgentSrc = exports.AnnouncementBannerPresentAtPageRenderSrc = exports.AnnouncementBannerWithPageContentSrc = exports.AnnouncementBannerWithActionsSrc = exports.AnnouncementBannerCloseableSrc = exports.AnnouncementBannerCustomIconsSrc = exports.AnnouncementBannerVariantsSrc = exports.AnnouncementBannerDefaultSrc = exports.AnnouncementBannerInjectedUrgent = exports.AnnouncementBannerInjectedNonUrgent = exports.AnnouncementBannerPresentAtPageRender = exports.AnnouncementBannerWithPageContent = exports.AnnouncementBannerWithActions = exports.AnnouncementBannerCloseable = exports.AnnouncementBannerCustomIcons = exports.AnnouncementBannerVariants = exports.AnnouncementBannerDefault = void 0;
27
+ var announcement_banner_default_story_1 = require("./announcement-banner-default.story");
28
+ Object.defineProperty(exports, "AnnouncementBannerDefault", { enumerable: true, get: function () { return __importDefault(announcement_banner_default_story_1).default; } });
29
+ var announcement_banner_variants_story_1 = require("./announcement-banner-variants.story");
30
+ Object.defineProperty(exports, "AnnouncementBannerVariants", { enumerable: true, get: function () { return __importDefault(announcement_banner_variants_story_1).default; } });
31
+ var announcement_banner_custom_icons_story_1 = require("./announcement-banner-custom-icons.story");
32
+ Object.defineProperty(exports, "AnnouncementBannerCustomIcons", { enumerable: true, get: function () { return __importDefault(announcement_banner_custom_icons_story_1).default; } });
33
+ var announcement_banner_closeable_story_1 = require("./announcement-banner-closeable.story");
34
+ Object.defineProperty(exports, "AnnouncementBannerCloseable", { enumerable: true, get: function () { return __importDefault(announcement_banner_closeable_story_1).default; } });
35
+ var announcement_banner_with_actions_story_1 = require("./announcement-banner-with-actions.story");
36
+ Object.defineProperty(exports, "AnnouncementBannerWithActions", { enumerable: true, get: function () { return __importDefault(announcement_banner_with_actions_story_1).default; } });
37
+ var announcement_banner_with_page_content_story_1 = require("./announcement-banner-with-page-content.story");
38
+ Object.defineProperty(exports, "AnnouncementBannerWithPageContent", { enumerable: true, get: function () { return __importDefault(announcement_banner_with_page_content_story_1).default; } });
39
+ var announcement_banner_present_at_page_render_story_1 = require("./announcement-banner-present-at-page-render.story");
40
+ Object.defineProperty(exports, "AnnouncementBannerPresentAtPageRender", { enumerable: true, get: function () { return __importDefault(announcement_banner_present_at_page_render_story_1).default; } });
41
+ var announcement_banner_injected_non_urgent_story_1 = require("./announcement-banner-injected-non-urgent.story");
42
+ Object.defineProperty(exports, "AnnouncementBannerInjectedNonUrgent", { enumerable: true, get: function () { return __importDefault(announcement_banner_injected_non_urgent_story_1).default; } });
43
+ var announcement_banner_injected_urgent_story_1 = require("./announcement-banner-injected-urgent.story");
44
+ Object.defineProperty(exports, "AnnouncementBannerInjectedUrgent", { enumerable: true, get: function () { return __importDefault(announcement_banner_injected_urgent_story_1).default; } });
45
+ const export_stories_utils_1 = require("../../_common/export-stories-utils");
46
+ const announcement_banner_closeable_story_raw_1 = __importDefault(require("./announcement-banner-closeable.story?raw"));
47
+ const announcement_banner_custom_icons_story_raw_1 = __importDefault(require("./announcement-banner-custom-icons.story?raw"));
48
+ const announcement_banner_default_story_raw_1 = __importDefault(require("./announcement-banner-default.story?raw"));
49
+ const announcement_banner_injected_non_urgent_story_raw_1 = __importDefault(require("./announcement-banner-injected-non-urgent.story?raw"));
50
+ const announcement_banner_injected_urgent_story_raw_1 = __importDefault(require("./announcement-banner-injected-urgent.story?raw"));
51
+ const announcement_banner_present_at_page_render_story_raw_1 = __importDefault(require("./announcement-banner-present-at-page-render.story?raw"));
52
+ const announcement_banner_variants_story_raw_1 = __importDefault(require("./announcement-banner-variants.story?raw"));
53
+ const announcement_banner_with_actions_story_raw_1 = __importDefault(require("./announcement-banner-with-actions.story?raw"));
54
+ const announcement_banner_with_page_content_story_raw_1 = __importDefault(require("./announcement-banner-with-page-content.story?raw"));
55
+ exports.AnnouncementBannerDefaultSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_default_story_raw_1.default);
56
+ exports.AnnouncementBannerVariantsSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_variants_story_raw_1.default);
57
+ exports.AnnouncementBannerCustomIconsSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_custom_icons_story_raw_1.default);
58
+ exports.AnnouncementBannerCloseableSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_closeable_story_raw_1.default);
59
+ exports.AnnouncementBannerWithActionsSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_with_actions_story_raw_1.default);
60
+ exports.AnnouncementBannerWithPageContentSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_with_page_content_story_raw_1.default);
61
+ exports.AnnouncementBannerPresentAtPageRenderSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_present_at_page_render_story_raw_1.default);
62
+ exports.AnnouncementBannerInjectedNonUrgentSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_injected_non_urgent_story_raw_1.default);
63
+ exports.AnnouncementBannerInjectedUrgentSrc = (0, export_stories_utils_1.removeLicenseHeader)(announcement_banner_injected_urgent_story_raw_1.default);
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index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CACvC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as AnnouncementBannerDefault } from './announcement-banner-default.story';\nexport { default as AnnouncementBannerVariants } from './announcement-banner-variants.story';\nexport { default as AnnouncementBannerCustomIcons } from './announcement-banner-custom-icons.story';\nexport { default as AnnouncementBannerCloseable } from './announcement-banner-closeable.story';\nexport { default as AnnouncementBannerWithActions } from './announcement-banner-with-actions.story';\nexport { default as AnnouncementBannerWithPageContent } from './announcement-banner-with-page-content.story';\nexport { default as AnnouncementBannerPresentAtPageRender } from './announcement-banner-present-at-page-render.story';\nexport { default as AnnouncementBannerInjectedNonUrgent } from './announcement-banner-injected-non-urgent.story';\nexport { default as AnnouncementBannerInjectedUrgent } from './announcement-banner-injected-urgent.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport AnnouncementBannerCloseableSrcRaw from './announcement-banner-closeable.story?raw';\nimport AnnouncementBannerCustomIconsSrcRaw from './announcement-banner-custom-icons.story?raw';\nimport AnnouncementBannerDefaultSrcRaw from './announcement-banner-default.story?raw';\nimport AnnouncementBannerInjectedNonUrgentSrcRaw from './announcement-banner-injected-non-urgent.story?raw';\nimport AnnouncementBannerInjectedUrgentSrcRaw from './announcement-banner-injected-urgent.story?raw';\nimport AnnouncementBannerPresentAtPageRenderSrcRaw from './announcement-banner-present-at-page-render.story?raw';\nimport AnnouncementBannerVariantsSrcRaw from './announcement-banner-variants.story?raw';\nimport AnnouncementBannerWithActionsSrcRaw from './announcement-banner-with-actions.story?raw';\nimport AnnouncementBannerWithPageContentSrcRaw from './announcement-banner-with-page-content.story?raw';\n\nexport const AnnouncementBannerDefaultSrc = removeLicenseHeader(\n AnnouncementBannerDefaultSrcRaw,\n);\n\nexport const AnnouncementBannerVariantsSrc = removeLicenseHeader(\n AnnouncementBannerVariantsSrcRaw,\n);\n\nexport const AnnouncementBannerCustomIconsSrc = removeLicenseHeader(\n AnnouncementBannerCustomIconsSrcRaw,\n);\n\nexport const AnnouncementBannerCloseableSrc = removeLicenseHeader(\n AnnouncementBannerCloseableSrcRaw,\n);\n\nexport const AnnouncementBannerWithActionsSrc = removeLicenseHeader(\n AnnouncementBannerWithActionsSrcRaw,\n);\n\nexport const AnnouncementBannerWithPageContentSrc = removeLicenseHeader(\n AnnouncementBannerWithPageContentSrcRaw,\n);\n\nexport const AnnouncementBannerPresentAtPageRenderSrc = removeLicenseHeader(\n AnnouncementBannerPresentAtPageRenderSrcRaw,\n);\n\nexport const AnnouncementBannerInjectedNonUrgentSrc = removeLicenseHeader(\n AnnouncementBannerInjectedNonUrgentSrcRaw,\n);\n\nexport const AnnouncementBannerInjectedUrgentSrc = removeLicenseHeader(\n AnnouncementBannerInjectedUrgentSrcRaw,\n);\n"]}
package/lib/cjs/index.js CHANGED
@@ -34,14 +34,16 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
34
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
35
35
  };
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.useSpotlightContext = exports.SpotlightTour = exports.SpotlightTarget = exports.SpotlightProvider = exports.Spotlight = exports.TimeZonePicker = exports.NeedleTime = exports.TimePicker = exports.Skeleton = exports.Tooltip = exports.toast = exports.Toaster = exports.ToasterControlled = exports.Divider = exports.DropdownButton = exports.InlineEdit = exports.Slider = exports.ClipboardButton = exports.Logo = exports.Avatar = exports.Flex = exports.Box = exports.Breadcrumbs = exports.Drawer = exports.Typography = exports.SideNavigation = exports.StatusIndicator = exports.CodeBlock = exports.GraphLabel = exports.Wizard = exports.Tag = exports.Select = exports.TextLink = exports.TextArea = exports.TextInput = exports.Dropzone = exports.ProgressBar = exports.Popover = exports.SegmentedControl = exports.Tabs = exports.LoadingSpinner = exports.Dialog = exports.DatePicker = exports.Menu = exports.Radio = exports.Switch = exports.Checkbox = exports.Banner = exports.StatusLabel = exports.Accordion = void 0;
38
- exports.SelectableTag = exports.DismissibleTag = exports.ReadOnlyTag = exports.SelectIconButton = exports.Kbd = exports.Code = exports.TextButton = exports.FilledButton = exports.OutlinedButton = exports.ColorPicker = exports.ConditionalWrap = exports.IconButtonArray = exports.CleanIconButton = exports.IconButton = exports.LoadingBar = void 0;
37
+ exports.SpotlightTour = exports.SpotlightTarget = exports.SpotlightProvider = exports.Spotlight = exports.TimeZonePicker = exports.NeedleTime = exports.TimePicker = exports.Skeleton = exports.Tooltip = exports.toast = exports.Toaster = exports.ToasterControlled = exports.Divider = exports.DropdownButton = exports.InlineEdit = exports.Slider = exports.ClipboardButton = exports.Logo = exports.Avatar = exports.Flex = exports.Box = exports.Breadcrumbs = exports.Drawer = exports.Typography = exports.SideNavigation = exports.StatusIndicator = exports.CodeBlock = exports.GraphLabel = exports.Wizard = exports.Tag = exports.Select = exports.TextLink = exports.TextArea = exports.TextInput = exports.Dropzone = exports.ProgressBar = exports.Popover = exports.SegmentedControl = exports.Tabs = exports.LoadingSpinner = exports.Dialog = exports.DatePicker = exports.Menu = exports.Radio = exports.Switch = exports.Checkbox = exports.AnnouncementBanner = exports.Banner = exports.StatusLabel = exports.Accordion = void 0;
38
+ exports.SelectableTag = exports.DismissibleTag = exports.ReadOnlyTag = exports.SelectIconButton = exports.Kbd = exports.Code = exports.TextButton = exports.FilledButton = exports.OutlinedButton = exports.ColorPicker = exports.ConditionalWrap = exports.IconButtonArray = exports.CleanIconButton = exports.IconButton = exports.LoadingBar = exports.useSpotlightContext = void 0;
39
39
  var accordion_1 = require("./accordion");
40
40
  Object.defineProperty(exports, "Accordion", { enumerable: true, get: function () { return accordion_1.Accordion; } });
41
41
  var status_label_1 = require("./status-label");
42
42
  Object.defineProperty(exports, "StatusLabel", { enumerable: true, get: function () { return status_label_1.StatusLabel; } });
43
43
  var banner_1 = require("./banner");
44
44
  Object.defineProperty(exports, "Banner", { enumerable: true, get: function () { return banner_1.Banner; } });
45
+ var announcement_banner_1 = require("./announcement-banner");
46
+ Object.defineProperty(exports, "AnnouncementBanner", { enumerable: true, get: function () { return announcement_banner_1.AnnouncementBanner; } });
45
47
  var checkbox_1 = require("./checkbox");
46
48
  Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return checkbox_1.Checkbox; } });
47
49
  var switch_1 = require("./switch");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ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,cAAc,OAAA;AACvB,yCAMqB;AALnB,sGAAA,SAAS,OAAA;AACT,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AACf,0GAAA,aAAa,OAAA;AACb,gHAAA,mBAAmB,OAAA;AAErB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,yDAAsD;AAA7C,oHAAA,eAAe,OAAA;AACxB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,6CAA2B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { Checkbox } from './checkbox';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport { Popover } from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport * from './combobox';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;;;;;;;;;;;;;AAEH,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAC3B,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,8CAA4B;AAC5B,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,0CAAwB;AACxB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,2CAAyC;AAAhC,uGAAA,SAAS,OAAA;AAClB,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6C;AAApC,2GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,2DAAwD;AAA/C,sHAAA,gBAAgB,OAAA;AACzB,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,6CAA2B","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport { Popover } from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport * from './combobox';\n"]}
@@ -67,7 +67,7 @@ const usePopoverContext = () => {
67
67
  return context;
68
68
  };
69
69
  exports.usePopoverContext = usePopoverContext;
70
- const PopoverComponent = ({ children, anchorElement, placement, isOpen, offset, anchorPosition, hasAnchorPortal: hasAnchorPortalProp, shouldCaptureFocus = false, initialFocus, onOpenChange, role, closeOnClickOutside = true, isPortaled: isPortaledProp, strategy: strategyProp, shouldConstrainSize, }) => {
70
+ const PopoverComponent = ({ children, anchorElement, placement, isOpen, offset, anchorPosition, hasAnchorPortal: hasAnchorPortalProp, shouldCaptureFocus = false, initialFocus, onOpenChange, role, closeOnClickOutside = true, shouldCloseOnFocusOut, isPortaled: isPortaledProp, strategy: strategyProp, shouldConstrainSize, }) => {
71
71
  const isInsideDialog = (0, dialog_context_1.useIsInsideDialog)();
72
72
  const strategy = isInsideDialog ? 'fixed' : 'absolute';
73
73
  const hasAnchorPortal = isInsideDialog;
@@ -85,6 +85,7 @@ const PopoverComponent = ({ children, anchorElement, placement, isOpen, offset,
85
85
  placement: placement ? exports.placementTranslation[placement] : undefined,
86
86
  role,
87
87
  shouldCaptureFocus,
88
+ shouldCloseOnFocusOut: shouldCloseOnFocusOut !== null && shouldCloseOnFocusOut !== void 0 ? shouldCloseOnFocusOut : closeOnClickOutside,
88
89
  shouldConstrainSize,
89
90
  strategy: strategyProp !== null && strategyProp !== void 0 ? strategyProp : strategy,
90
91
  });
@@ -144,7 +145,7 @@ const PopoverContent = (_a) => {
144
145
  return ((0, jsx_runtime_1.jsx)(react_1.FloatingPortal, { root: ((_a = context.anchorElementAsPortalAnchor) !== null && _a !== void 0 ? _a : false)
145
146
  ? context.refs.reference.current
146
147
  : undefined, children: wrapChildren }));
147
- }, children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: floatingContext, modal: context.shouldCaptureFocus, initialFocus: context.initialFocus, children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ className: classes, "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId, style: Object.assign(Object.assign(Object.assign({}, context.floatingStyles), context.transitionStyles), style), ref: refs }, context.getFloatingProps(Object.assign({}, htmlAttributes)), restProps, { children: children })) }) }));
148
+ }, children: (0, jsx_runtime_1.jsx)(react_1.FloatingFocusManager, { context: floatingContext, modal: context.shouldCaptureFocus, initialFocus: context.initialFocus, closeOnFocusOut: context.shouldCloseOnFocusOut, children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ className: classes, "aria-labelledby": context.labelId, "aria-describedby": context.descriptionId, style: Object.assign(Object.assign(Object.assign({}, context.floatingStyles), context.transitionStyles), style), ref: refs }, context.getFloatingProps(Object.assign({}, htmlAttributes)), restProps, { children: children })) }) }));
148
149
  };
149
150
  const Popover = Object.assign(PopoverComponent, {
150
151
  Anchor: PopoverAnchor,
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAM4B;AAC5B,4DAAoC;AACpC,kDAA0B;AAM1B,0DAAsD;AACtD,6DAA6D;AAC7D,0DAAwD;AACxD,+CAA2C;AAC3C,+EAA4E;AAgB/D,QAAA,oBAAoB,GAAwC;IACvE,yBAAyB,EAAE,WAAW;IACtC,oBAAoB,EAAE,YAAY;IAClC,0BAA0B,EAAE,QAAQ;IACpC,yBAAyB,EAAE,UAAU;IACrC,wBAAwB,EAAE,cAAc;IACxC,yBAAyB,EAAE,OAAO;IAClC,yBAAyB,EAAE,MAAM;IACjC,oBAAoB,EAAE,SAAS;IAC/B,mBAAmB,EAAE,aAAa;IAClC,0BAA0B,EAAE,KAAK;IACjC,wBAAwB,EAAE,WAAW;IACrC,mBAAmB,EAAE,YAAY;CAClC,CAAC;AA6DF,MAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAAc,IAAI,CAAC,CAAC;AAEvD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAEjD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B;AAEF,MAAM,gBAAgB,GAAG,CAAC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I,EAAE,CAAC,YAAY,EAAE,EAAE;;YAAC,OAAA,CACtB,uBAAC,sBAAc,IACb,IAAI,EACF,CAAC,MAAA,OAAO,CAAC,2BAA2B,mCAAI,KAAK,CAAC;oBAC5C,CAAC,CAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAA8B;oBACxD,CAAC,CAAC,SAAS,YAGd,YAAY,GACE,CAClB,CAAA;SAAA,YAED,uBAAC,4BAAoB,IACnB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,CAAC,kBAAkB,EACjC,YAAY,EAAE,OAAO,CAAC,YAAY,YAElC,uBAAC,SAAS,kBACR,SAAS,EAAE,OAAO,qBACD,OAAO,CAAC,OAAO,sBACd,OAAO,CAAC,aAAa,EACvC,KAAK,gDACA,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,gBAAgB,GACxB,KAAK,GAEV,GAAG,EAAE,IAAI,IACL,OAAO,CAAC,gBAAgB,mBAAM,cAAc,EAAG,EAC/C,SAAS,cAEZ,QAAQ,IACC,GACS,GACP,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC9C,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEM,0BAAO","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n FloatingFocusManager,\n FloatingPortal,\n type OffsetOptions,\n type Placement,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme/ThemeProvider';\nimport { usePopover } from './use-popover';\nimport { usePatchFloatingFocusGuards } from './usePatchFloatingFocusGuards';\n\ntype PlacementOptions =\n | 'bottom-end-top-end'\n | 'bottom-start-top-start'\n | 'bottom-middle-top-middle'\n | 'top-end-bottom-end'\n | 'top-start-bottom-start'\n | 'top-middle-bottom-middle'\n | 'bottom-start-bottom-end'\n | 'top-start-top-end'\n | 'middle-start-middle-end'\n | 'bottom-end-bottom-start'\n | 'top-end-top-start'\n | 'middle-end-middle-start';\n\nexport const placementTranslation: Record<PlacementOptions, Placement> = {\n 'bottom-end-bottom-start': 'right-end',\n 'bottom-end-top-end': 'bottom-end',\n 'bottom-middle-top-middle': 'bottom',\n 'bottom-start-bottom-end': 'left-end',\n 'bottom-start-top-start': 'bottom-start',\n 'middle-end-middle-start': 'right',\n 'middle-start-middle-end': 'left',\n 'top-end-bottom-end': 'top-end',\n 'top-end-top-start': 'right-start',\n 'top-middle-bottom-middle': 'top',\n 'top-start-bottom-start': 'top-start',\n 'top-start-top-end': 'left-start',\n};\ntype PopoverProps = {\n /** if the popover is open */\n isOpen?: boolean;\n /** The content of the popover */\n children?: React.ReactNode;\n /**\n * Can be used if the anchor should be separated from the trigger.\n * Note: to visually separate the anchor from the trigger, use the Popover.Anchor component instead.\n */\n anchorElement?: Element | null;\n /** If the anchorPosition is provided the anchorElement will be ignored */\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n /** The placement of the floating element is determined by two sets of words. The first set of words specifies the point on the anchor element where the floating element will be attached. The second set of coordinates specifies the point on the floating element that will attach to the anchor element. */\n placement?: PlacementOptions;\n /** can take either a number, an object or a function. Full documentation here: https://floating-ui.com/docs/offset */\n offset?: OffsetOptions;\n /** Called when an internal state change is triggered, when the floating element either opens or closes. It is not called when `isOpen` is updated by the consumer. */\n onOpenChange?: (isOpen: boolean, event?: Event) => void;\n /** Use anchorEl for portal's container. Should be used if the popover is portaled and is inside a Dialog for example. */\n hasAnchorPortal?: boolean;\n /** If the popover should constrain the focus inside the popover while open */\n shouldCaptureFocus?: boolean;\n /** Which element to initially focus. */\n initialFocus?: number | React.RefObject<HTMLElement | null>;\n // TODO v5: remove this prop\n /** The role of the popover.\n * @deprecated - This prop will be removed in v5.\n */\n role?:\n | 'tooltip'\n | 'dialog'\n | 'alertdialog'\n | 'menu'\n | 'listbox'\n | 'grid'\n | 'tree';\n /** If the popover should close when the user clicks outside of it */\n // TODO v5: change naming (if component isn't deprecated)\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnClickOutside?: boolean;\n /** The strategy of the popover. Fixed should be used when the popover is inside a Dialog. */\n strategy?: 'fixed' | 'absolute';\n /** Whether the content is rendered in a portal */\n isPortaled?: boolean;\n /**\n * When true, limits the popover's max-height and max-width to the available viewport space.\n * The consumer is responsible for adding overflow handling (e.g. overflow-y: auto) to the content.\n * */\n shouldConstrainSize?: boolean;\n};\n\ntype ContextType = ReturnType<typeof usePopover> | null;\n\nconst PopoverContext = React.createContext<ContextType>(null);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === null) {\n throw new Error('Popover components must be wrapped in <Popover />');\n }\n\n return context;\n};\n\nconst PopoverComponent = ({\n children,\n anchorElement,\n placement,\n isOpen,\n offset,\n anchorPosition,\n hasAnchorPortal: hasAnchorPortalProp,\n shouldCaptureFocus = false,\n initialFocus,\n onOpenChange,\n role,\n closeOnClickOutside = true,\n isPortaled: isPortaledProp,\n strategy: strategyProp,\n shouldConstrainSize,\n}: PopoverProps) => {\n const isInsideDialog = useIsInsideDialog();\n\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const hasAnchorPortal = isInsideDialog;\n const isPortaled = !isInsideDialog;\n\n const popover = usePopover({\n anchorElement,\n anchorElementAsPortalAnchor: hasAnchorPortalProp ?? hasAnchorPortal,\n anchorPosition,\n closeOnClickOutside,\n initialFocus,\n isOpen: isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n offsetOption: offset,\n onOpenChange: onOpenChange,\n placement: placement ? placementTranslation[placement] : undefined,\n role,\n shouldCaptureFocus,\n shouldConstrainSize,\n strategy: strategyProp ?? strategy,\n });\n\n return (\n <PopoverContext.Provider value={popover}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\ntype PopoverTriggerProps = {\n /** The content of the trigger */\n children: React.ReactNode;\n /** Whether the trigger should render a button element, or pass its props to the child element */\n hasButtonWrapper?: boolean;\n};\n\nconst PopoverTrigger = ({\n children,\n hasButtonWrapper = false,\n ref,\n ...props\n}: CommonProps<'button', PopoverTriggerProps>) => {\n const context = usePopoverContext();\n // Example from floating UI\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n // `hasButtonWrapper` allows the user to pass any element as the anchor\n if (hasButtonWrapper && React.isValidElement(children)) {\n return React.cloneElement(\n children,\n context.getReferenceProps({\n ...props,\n ...childrenProps,\n 'data-state': context.isOpen ? 'open' : 'closed',\n ref: mergedRefs,\n }),\n );\n }\n return (\n <button\n ref={context.refs.setReference}\n type=\"button\"\n data-state={context.isOpen ? 'open' : 'closed'}\n {...context.getReferenceProps(props)}\n >\n {children}\n </button>\n );\n};\n\ntype PopoverAnchorProps = {\n children?: React.ReactNode;\n};\n\n/**\n * Use this to separate the anchor visually from the trigger.\n */\nconst PopoverAnchor = ({\n children,\n ref,\n ...props\n}: CommonProps<'div', PopoverAnchorProps>) => {\n const context = usePopoverContext();\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any)?.props;\n const mergedRefs = useMergeRefs([\n context.refs.setPositionReference,\n ref,\n childrenProps?.ref,\n ]);\n\n if (React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...props,\n ...childrenProps,\n ref: mergedRefs,\n });\n }\n\n return (\n <div ref={mergedRefs} {...props}>\n {children}\n </div>\n );\n};\n\ntype PopoverContentProps = {\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nconst PopoverContent = <T extends React.ElementType = 'div'>({\n as,\n className,\n style,\n children,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, PopoverContentProps>) => {\n const { context: floatingContext, ...context } = usePopoverContext();\n\n const refs = useMergeRefs([context.refs.setFloating, ref]);\n\n const { themeClassName } = useNeedleTheme();\n\n const classes = classNames('ndl-popover', themeClassName, className);\n const Component: React.ElementType = as ?? 'div';\n\n // Patch to not get axe errors for the focus guards\n // To be noted is that axe gives us a false positive error here since the focus guards directly pass focus to other elements\n // https://github.com/floating-ui/floating-ui/issues/2462\n usePatchFloatingFocusGuards();\n\n if (!floatingContext.open) {\n return null;\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal\n root={\n (context.anchorElementAsPortalAnchor ?? false)\n ? (context.refs.reference.current as HTMLElement | null)\n : undefined\n }\n >\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={floatingContext}\n modal={context.shouldCaptureFocus}\n initialFocus={context.initialFocus}\n >\n <Component\n className={classes}\n aria-labelledby={context.labelId}\n aria-describedby={context.descriptionId}\n style={{\n ...context.floatingStyles,\n ...context.transitionStyles,\n ...style,\n }}\n ref={refs}\n {...context.getFloatingProps({ ...htmlAttributes })}\n {...restProps}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\nconst Popover = Object.assign(PopoverComponent, {\n Anchor: PopoverAnchor,\n Content: PopoverContent,\n Trigger: PopoverTrigger,\n});\n\nexport { Popover };\n"]}
1
+ {"version":3,"file":"Popover.js","sourceRoot":"","sources":["../../../src/popover/Popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAM4B;AAC5B,4DAAoC;AACpC,kDAA0B;AAM1B,0DAAsD;AACtD,6DAA6D;AAC7D,0DAAwD;AACxD,+CAA2C;AAC3C,+EAA4E;AAgB/D,QAAA,oBAAoB,GAAwC;IACvE,yBAAyB,EAAE,WAAW;IACtC,oBAAoB,EAAE,YAAY;IAClC,0BAA0B,EAAE,QAAQ;IACpC,yBAAyB,EAAE,UAAU;IACrC,wBAAwB,EAAE,cAAc;IACxC,yBAAyB,EAAE,OAAO;IAClC,yBAAyB,EAAE,MAAM;IACjC,oBAAoB,EAAE,SAAS;IAC/B,mBAAmB,EAAE,aAAa;IAClC,0BAA0B,EAAE,KAAK;IACjC,wBAAwB,EAAE,WAAW;IACrC,mBAAmB,EAAE,YAAY;CAClC,CAAC;AAmEF,MAAM,cAAc,GAAG,eAAK,CAAC,aAAa,CAAc,IAAI,CAAC,CAAC;AAEvD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,MAAM,OAAO,GAAG,eAAK,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;IAEjD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AARW,QAAA,iBAAiB,qBAQ5B;AAEF,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,aAAa,EACb,SAAS,EACT,MAAM,EACN,MAAM,EACN,cAAc,EACd,eAAe,EAAE,mBAAmB,EACpC,kBAAkB,GAAG,KAAK,EAC1B,YAAY,EACZ,YAAY,EACZ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Ac,IACb,IAAI,EACF,CAAC,MAAA,OAAO,CAAC,2BAA2B,mCAAI,KAAK,CAAC;oBAC5C,CAAC,CAAE,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,OAA8B;oBACxD,CAAC,CAAC,SAAS,YAGd,YAAY,GACE,CAClB,CAAA;SAAA,YAED,uBAAC,4BAAoB,IACnB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,OAAO,CAAC,kBAAkB,EACjC,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,eAAe,EAAE,OAAO,CAAC,qBAAqB,YAE9C,uBAAC,SAAS,kBACR,SAAS,EAAE,OAAO,qBACD,OAAO,CAAC,OAAO,sBACd,OAAO,CAAC,aAAa,EACvC,KAAK,gDACA,OAAO,CAAC,cAAc,GACtB,OAAO,CAAC,gBAAgB,GACxB,KAAK,GAEV,GAAG,EAAE,IAAI,IACL,OAAO,CAAC,gBAAgB,mBAAM,cAAc,EAAG,EAC/C,SAAS,cAEZ,QAAQ,IACC,GACS,GACP,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE;IAC9C,MAAM,EAAE,aAAa;IACrB,OAAO,EAAE,cAAc;IACvB,OAAO,EAAE,cAAc;CACxB,CAAC,CAAC;AAEM,0BAAO","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n FloatingFocusManager,\n FloatingPortal,\n type OffsetOptions,\n type Placement,\n useMergeRefs,\n} from '@floating-ui/react';\nimport classNames from 'classnames';\nimport React from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { useIsInsideDialog } from '../dialog/dialog-context';\nimport { useNeedleTheme } from '../theme/ThemeProvider';\nimport { usePopover } from './use-popover';\nimport { usePatchFloatingFocusGuards } from './usePatchFloatingFocusGuards';\n\ntype PlacementOptions =\n | 'bottom-end-top-end'\n | 'bottom-start-top-start'\n | 'bottom-middle-top-middle'\n | 'top-end-bottom-end'\n | 'top-start-bottom-start'\n | 'top-middle-bottom-middle'\n | 'bottom-start-bottom-end'\n | 'top-start-top-end'\n | 'middle-start-middle-end'\n | 'bottom-end-bottom-start'\n | 'top-end-top-start'\n | 'middle-end-middle-start';\n\nexport const placementTranslation: Record<PlacementOptions, Placement> = {\n 'bottom-end-bottom-start': 'right-end',\n 'bottom-end-top-end': 'bottom-end',\n 'bottom-middle-top-middle': 'bottom',\n 'bottom-start-bottom-end': 'left-end',\n 'bottom-start-top-start': 'bottom-start',\n 'middle-end-middle-start': 'right',\n 'middle-start-middle-end': 'left',\n 'top-end-bottom-end': 'top-end',\n 'top-end-top-start': 'right-start',\n 'top-middle-bottom-middle': 'top',\n 'top-start-bottom-start': 'top-start',\n 'top-start-top-end': 'left-start',\n};\ntype PopoverProps = {\n /** if the popover is open */\n isOpen?: boolean;\n /** The content of the popover */\n children?: React.ReactNode;\n /**\n * Can be used if the anchor should be separated from the trigger.\n * Note: to visually separate the anchor from the trigger, use the Popover.Anchor component instead.\n */\n anchorElement?: Element | null;\n /** If the anchorPosition is provided the anchorElement will be ignored */\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n /** The placement of the floating element is determined by two sets of words. The first set of words specifies the point on the anchor element where the floating element will be attached. The second set of coordinates specifies the point on the floating element that will attach to the anchor element. */\n placement?: PlacementOptions;\n /** can take either a number, an object or a function. Full documentation here: https://floating-ui.com/docs/offset */\n offset?: OffsetOptions;\n /** Called when an internal state change is triggered, when the floating element either opens or closes. It is not called when `isOpen` is updated by the consumer. */\n onOpenChange?: (isOpen: boolean, event?: Event) => void;\n /** Use anchorEl for portal's container. Should be used if the popover is portaled and is inside a Dialog for example. */\n hasAnchorPortal?: boolean;\n /** If the popover should constrain the focus inside the popover while open */\n shouldCaptureFocus?: boolean;\n /** Which element to initially focus. */\n initialFocus?: number | React.RefObject<HTMLElement | null>;\n // TODO v5: remove this prop\n /** The role of the popover.\n * @deprecated - This prop will be removed in v5.\n */\n role?:\n | 'tooltip'\n | 'dialog'\n | 'alertdialog'\n | 'menu'\n | 'listbox'\n | 'grid'\n | 'tree';\n /** If the popover should close when the user clicks outside of it */\n // TODO v5: change naming (if component isn't deprecated)\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnClickOutside?: boolean;\n /**\n * If the popover should close when focus moves outside of it, for example when tabbing away or focusing another element.\n * Defaults to the value of `closeOnClickOutside`.\n * Has no effect when `shouldCaptureFocus` is true, since focus cannot leave the popover.\n */\n shouldCloseOnFocusOut?: boolean;\n /** The strategy of the popover. Fixed should be used when the popover is inside a Dialog. */\n strategy?: 'fixed' | 'absolute';\n /** Whether the content is rendered in a portal */\n isPortaled?: boolean;\n /**\n * When true, limits the popover's max-height and max-width to the available viewport space.\n * The consumer is responsible for adding overflow handling (e.g. overflow-y: auto) to the content.\n * */\n shouldConstrainSize?: boolean;\n};\n\ntype ContextType = ReturnType<typeof usePopover> | null;\n\nconst PopoverContext = React.createContext<ContextType>(null);\n\nexport const usePopoverContext = () => {\n const context = React.useContext(PopoverContext);\n\n if (context === null) {\n throw new Error('Popover components must be wrapped in <Popover />');\n }\n\n return context;\n};\n\nconst PopoverComponent = ({\n children,\n anchorElement,\n placement,\n isOpen,\n offset,\n anchorPosition,\n hasAnchorPortal: hasAnchorPortalProp,\n shouldCaptureFocus = false,\n initialFocus,\n onOpenChange,\n role,\n closeOnClickOutside = true,\n shouldCloseOnFocusOut,\n isPortaled: isPortaledProp,\n strategy: strategyProp,\n shouldConstrainSize,\n}: PopoverProps) => {\n const isInsideDialog = useIsInsideDialog();\n\n const strategy = isInsideDialog ? 'fixed' : 'absolute';\n const hasAnchorPortal = isInsideDialog;\n const isPortaled = !isInsideDialog;\n\n const popover = usePopover({\n anchorElement,\n anchorElementAsPortalAnchor: hasAnchorPortalProp ?? hasAnchorPortal,\n anchorPosition,\n closeOnClickOutside,\n initialFocus,\n isOpen: isOpen,\n isPortaled: isPortaledProp ?? isPortaled,\n offsetOption: offset,\n onOpenChange: onOpenChange,\n placement: placement ? placementTranslation[placement] : undefined,\n role,\n shouldCaptureFocus,\n shouldCloseOnFocusOut: shouldCloseOnFocusOut ?? closeOnClickOutside,\n shouldConstrainSize,\n strategy: strategyProp ?? strategy,\n });\n\n return (\n <PopoverContext.Provider value={popover}>\n {children}\n </PopoverContext.Provider>\n );\n};\n\ntype PopoverTriggerProps = {\n /** The content of the trigger */\n children: React.ReactNode;\n /** Whether the trigger should render a button element, or pass its props to the child element */\n hasButtonWrapper?: boolean;\n};\n\nconst PopoverTrigger = ({\n children,\n hasButtonWrapper = false,\n ref,\n ...props\n}: CommonProps<'button', PopoverTriggerProps>) => {\n const context = usePopoverContext();\n // Example from floating UI\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any).props;\n const mergedRefs = useMergeRefs([\n context.refs.setReference,\n ref,\n childrenProps?.ref,\n ]);\n\n // `hasButtonWrapper` allows the user to pass any element as the anchor\n if (hasButtonWrapper && React.isValidElement(children)) {\n return React.cloneElement(\n children,\n context.getReferenceProps({\n ...props,\n ...childrenProps,\n 'data-state': context.isOpen ? 'open' : 'closed',\n ref: mergedRefs,\n }),\n );\n }\n return (\n <button\n ref={context.refs.setReference}\n type=\"button\"\n data-state={context.isOpen ? 'open' : 'closed'}\n {...context.getReferenceProps(props)}\n >\n {children}\n </button>\n );\n};\n\ntype PopoverAnchorProps = {\n children?: React.ReactNode;\n};\n\n/**\n * Use this to separate the anchor visually from the trigger.\n */\nconst PopoverAnchor = ({\n children,\n ref,\n ...props\n}: CommonProps<'div', PopoverAnchorProps>) => {\n const context = usePopoverContext();\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const childrenProps = (children as any)?.props;\n const mergedRefs = useMergeRefs([\n context.refs.setPositionReference,\n ref,\n childrenProps?.ref,\n ]);\n\n if (React.isValidElement(children)) {\n return React.cloneElement(children, {\n ...props,\n ...childrenProps,\n ref: mergedRefs,\n });\n }\n\n return (\n <div ref={mergedRefs} {...props}>\n {children}\n </div>\n );\n};\n\ntype PopoverContentProps = {\n children: React.ReactNode;\n className?: string;\n style?: React.CSSProperties;\n};\n\nconst PopoverContent = <T extends React.ElementType = 'div'>({\n as,\n className,\n style,\n children,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, PopoverContentProps>) => {\n const { context: floatingContext, ...context } = usePopoverContext();\n\n const refs = useMergeRefs([context.refs.setFloating, ref]);\n\n const { themeClassName } = useNeedleTheme();\n\n const classes = classNames('ndl-popover', themeClassName, className);\n const Component: React.ElementType = as ?? 'div';\n\n // Patch to not get axe errors for the focus guards\n // To be noted is that axe gives us a false positive error here since the focus guards directly pass focus to other elements\n // https://github.com/floating-ui/floating-ui/issues/2462\n usePatchFloatingFocusGuards();\n\n if (!floatingContext.open) {\n return null;\n }\n\n return (\n <ConditionalWrap\n shouldWrap={context.isPortaled}\n wrap={(wrapChildren) => (\n <FloatingPortal\n root={\n (context.anchorElementAsPortalAnchor ?? false)\n ? (context.refs.reference.current as HTMLElement | null)\n : undefined\n }\n >\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <FloatingFocusManager\n context={floatingContext}\n modal={context.shouldCaptureFocus}\n initialFocus={context.initialFocus}\n closeOnFocusOut={context.shouldCloseOnFocusOut}\n >\n <Component\n className={classes}\n aria-labelledby={context.labelId}\n aria-describedby={context.descriptionId}\n style={{\n ...context.floatingStyles,\n ...context.transitionStyles,\n ...style,\n }}\n ref={refs}\n {...context.getFloatingProps({ ...htmlAttributes })}\n {...restProps}\n >\n {children}\n </Component>\n </FloatingFocusManager>\n </ConditionalWrap>\n );\n};\n\nconst Popover = Object.assign(PopoverComponent, {\n Anchor: PopoverAnchor,\n Content: PopoverContent,\n Trigger: PopoverTrigger,\n});\n\nexport { Popover };\n"]}
@@ -24,7 +24,7 @@ exports.usePopover = usePopover;
24
24
  const react_1 = require("@floating-ui/react");
25
25
  const base_1 = require("@neo4j-ndl/base");
26
26
  const react_2 = require("react");
27
- function usePopover({ isInitialOpen = false, placement = 'bottom', isOpen: controlledOpen, onOpenChange: setControlledOpen, offsetOption = 10, anchorElement, anchorPosition, anchorElementAsPortalAnchor, shouldCaptureFocus, initialFocus, role: roleProp, closeOnClickOutside, closeOnReferencePress, returnFocus, strategy = 'absolute', isPortaled = true, shouldConstrainSize = false, } = {}) {
27
+ function usePopover({ isInitialOpen = false, placement = 'bottom', isOpen: controlledOpen, onOpenChange: setControlledOpen, offsetOption = 10, anchorElement, anchorPosition, anchorElementAsPortalAnchor, shouldCaptureFocus, initialFocus, role: roleProp, closeOnClickOutside, closeOnReferencePress, shouldCloseOnFocusOut, returnFocus, strategy = 'absolute', isPortaled = true, shouldConstrainSize = false, } = {}) {
28
28
  var _a;
29
29
  // Internal state for uncontrolled mode (no `isOpen` prop provided).
30
30
  const [isOpenUncontrolled, setIsOpenUncontrolled] = (0, react_2.useState)(isInitialOpen);
@@ -105,6 +105,7 @@ function usePopover({ isInitialOpen = false, placement = 'bottom', isOpen: contr
105
105
  setDescriptionId,
106
106
  setLabelId,
107
107
  shouldCaptureFocus,
108
+ shouldCloseOnFocusOut,
108
109
  transitionStyles })), [
109
110
  isOpen,
110
111
  interactions,
@@ -114,6 +115,7 @@ function usePopover({ isInitialOpen = false, placement = 'bottom', isOpen: contr
114
115
  descriptionId,
115
116
  anchorElementAsPortalAnchor,
116
117
  shouldCaptureFocus,
118
+ shouldCloseOnFocusOut,
117
119
  initialFocus,
118
120
  isPortaled,
119
121
  returnFocus,
@@ -1 +1 @@
1
- {"version":3,"file":"use-popover.js","sourceRoot":"","sources":["../../../src/popover/use-popover.tsx"],"names":[],"mappings":";;AAkGA,gCA8HC;AAhOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAiB4B;AAC5B,0CAAyC;AACzC,iCAA0C;AA2D1C,SAAgB,UAAU,CAAC,EACzB,aAAa,GAAG,KAAK,EACrB,SAAS,GAAG,QAAQ,EACpB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,iBAAiB,EAC/B,YAAY,GAAG,EAAE,EACjB,aAAa,EACb,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,mBAAmB,EACnB,qBAAqB,EACrB,WAAW,EACX,QAAQ,GAAG,UAAU,EACrB,UAAU,GAAG,IAAI,EACjB,mBAAmB,GAAG,KAAK,MACT,EAAE;;IACpB,oEAAoE;IACpE,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,IAAA,gBAAQ,EAAC,aAAa,CAAC,CAAC;IAC5E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IAC7D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,GAAsB,CAAC;IAEzE,0EAA0E;IAC1E,oDAAoD;IACpD,MAAM,MAAM,GAAG,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,kBAAkB,CAAC;IAEpD,MAAM,IAAI,GAAG,IAAA,mBAAW,EAAC;QACvB,QAAQ,EAAE;YACR,SAAS,EAAE,aAAa;SACzB;QACD,UAAU,EAAE;YACV,IAAA,cAAM,EAAC,YAAY,CAAC;YACpB,IAAA,YAAI,EAAC;gBACH,SAA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AI,EAAE,QAAQ;KACf,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE;QAC1C,OAAO,EAAE,cAAc,KAAK,SAAS;QACrC,qCAAqC;QACrC,CAAC,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,CAAC;QACpB,qCAAqC;QACrC,CAAC,EAAE,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,CAAC;KACrB,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,IAAA,uBAAe,EAAC,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC;IAE1E,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,IAAA,2BAAmB,EAAC,OAAO,EAAE;QAChE,QAAQ,EAAE,MAAA,MAAM,CAAC,QAAQ,CAAC,aAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,mCAAI,CAAC;KAC7D,CAAC,CAAC;IAEH,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,+CACD,IAAI,GACJ,YAAY,KACf,2BAA2B;QAC3B,aAAa;QACb,YAAY;QACZ,MAAM;QACN,UAAU;QACV,OAAO;QACP,WAAW;QACX,gBAAgB;QAChB,UAAU;QACV,kBAAkB;QAClB,gBAAgB,IAChB,EACF;QACE,MAAM;QACN,YAAY;QACZ,IAAI;QACJ,gBAAgB;QAChB,OAAO;QACP,aAAa;QACb,2BAA2B;QAC3B,kBAAkB;QAClB,YAAY;QACZ,UAAU;QACV,WAAW;KACZ,CACF,CAAC;AACJ,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n type FloatingFocusManagerProps,\n offset,\n type OffsetOptions,\n type Placement,\n shift,\n size,\n useClick,\n useClientPoint,\n useDismiss,\n useFloating,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport { useMemo, useState } from 'react';\n\nexport interface PopoverOptions {\n isInitialOpen?: boolean;\n placement?: Placement;\n isOpen?: boolean;\n onOpenChange?: (open: boolean, event?: Event) => void;\n offsetOption?: OffsetOptions;\n anchorElement?: Element | null;\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n anchorElementAsPortalAnchor?: boolean;\n shouldCaptureFocus?: boolean;\n initialFocus?: number | React.RefObject<HTMLElement | null>;\n role?:\n | 'tooltip'\n | 'dialog'\n | 'alertdialog'\n | 'menu'\n | 'listbox'\n | 'grid'\n | 'tree';\n // TODO v5: decide if this naming is okay, or change it\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnClickOutside?: boolean;\n // TODO v5: decide if this naming is okay, or change it\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnReferencePress?: boolean;\n returnFocus?: FloatingFocusManagerProps['returnFocus'];\n strategy?: 'fixed' | 'absolute';\n isPortaled?: boolean;\n shouldConstrainSize?: boolean;\n}\n\nexport interface UsePopoverReturn\n extends UseInteractionsReturn, ReturnType<typeof useFloating> {\n isOpen: boolean;\n labelId: string | undefined;\n descriptionId: string | undefined;\n transitionStyles: React.CSSProperties;\n setLabelId: (labelId: string | undefined) => void;\n setDescriptionId: (descriptionId: string | undefined) => void;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n anchorElementAsPortalAnchor: boolean | undefined;\n shouldCaptureFocus: boolean | undefined;\n initialFocus: number | React.RefObject<HTMLElement | null> | undefined;\n isPortaled: boolean;\n returnFocus: FloatingFocusManagerProps['returnFocus'];\n}\n\nexport function usePopover({\n isInitialOpen = false,\n placement = 'bottom',\n isOpen: controlledOpen,\n onOpenChange: setControlledOpen,\n offsetOption = 10,\n anchorElement,\n anchorPosition,\n anchorElementAsPortalAnchor,\n shouldCaptureFocus,\n initialFocus,\n role: roleProp,\n closeOnClickOutside,\n closeOnReferencePress,\n returnFocus,\n strategy = 'absolute',\n isPortaled = true,\n shouldConstrainSize = false,\n}: PopoverOptions = {}): UsePopoverReturn {\n // Internal state for uncontrolled mode (no `isOpen` prop provided).\n const [isOpenUncontrolled, setIsOpenUncontrolled] = useState(isInitialOpen);\n const [labelId, setLabelId] = useState<string | undefined>();\n const [descriptionId, setDescriptionId] = useState<string | undefined>();\n\n // Controlled/uncontrolled pattern: prefer the consumer-provided `isOpen`,\n // falling back to internal state when not provided.\n const isOpen = controlledOpen ?? isOpenUncontrolled;\n\n const data = useFloating({\n elements: {\n reference: anchorElement,\n },\n middleware: [\n offset(offsetOption),\n flip({\n crossAxis: placement.includes('-'),\n fallbackAxisSideDirection: 'end',\n padding: 5,\n }),\n shift(),\n ...(shouldConstrainSize\n ? [\n size({\n apply({ availableHeight, availableWidth, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${availableHeight}px`,\n maxWidth: `${availableWidth}px`,\n });\n },\n padding: 5,\n }),\n ]\n : []),\n ],\n // Floating UI calls this when interactions (useClick, useDismiss, etc.)\n // trigger an open/close. We always sync internal state so uncontrolled\n // mode works, and notify the consumer callback exactly once if provided.\n onOpenChange: (open, event) => {\n setIsOpenUncontrolled(open);\n setControlledOpen?.(open, event);\n },\n open: isOpen,\n placement: placement,\n strategy,\n whileElementsMounted: autoUpdate,\n });\n const context = data.context;\n\n // Only enable built-in click-to-toggle in uncontrolled mode. In controlled\n // mode the consumer owns the open state and wires up their own trigger.\n const click = useClick(context, {\n enabled: controlledOpen === undefined,\n });\n\n const dismiss = useDismiss(context, {\n outsidePress: closeOnClickOutside,\n referencePress: closeOnReferencePress,\n });\n const role = useRole(context, {\n role: roleProp,\n });\n\n const clientPoint = useClientPoint(context, {\n enabled: anchorPosition !== undefined,\n // oxlint-disable-next-line id-length\n x: anchorPosition?.x,\n // oxlint-disable-next-line id-length\n y: anchorPosition?.y,\n });\n\n const interactions = useInteractions([click, dismiss, role, clientPoint]);\n\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n return useMemo(\n () => ({\n ...data,\n ...interactions,\n anchorElementAsPortalAnchor,\n descriptionId,\n initialFocus,\n isOpen,\n isPortaled,\n labelId,\n returnFocus,\n setDescriptionId,\n setLabelId,\n shouldCaptureFocus,\n transitionStyles,\n }),\n [\n isOpen,\n interactions,\n data,\n transitionStyles,\n labelId,\n descriptionId,\n anchorElementAsPortalAnchor,\n shouldCaptureFocus,\n initialFocus,\n isPortaled,\n returnFocus,\n ],\n );\n}\n"]}
1
+ {"version":3,"file":"use-popover.js","sourceRoot":"","sources":["../../../src/popover/use-popover.tsx"],"names":[],"mappings":";;AAoGA,gCAiIC;AArOD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8CAiB4B;AAC5B,0CAAyC;AACzC,iCAA0C;AA6D1C,SAAgB,UAAU,CAAC,EACzB,aAAa,GAAG,KAAK,EACrB,SAAS,GAAG,QAAQ,EACpB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,iBAAiB,EAC/B,YAAY,GAAG,EAAE,EACjB,aAAa,EACb,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EAClB,YAAY,EACZ,IAAI,EAAE,QAAQ,EACd,mBAAmB,EACnB,qB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AQ,CAAC,KAAK,CAAC,mCAAI,CAAC;KAC7D,CAAC,CAAC;IAEH,OAAO,IAAA,eAAO,EACZ,GAAG,EAAE,CAAC,+CACD,IAAI,GACJ,YAAY,KACf,2BAA2B;QAC3B,aAAa;QACb,YAAY;QACZ,MAAM;QACN,UAAU;QACV,OAAO;QACP,WAAW;QACX,gBAAgB;QAChB,UAAU;QACV,kBAAkB;QAClB,qBAAqB;QACrB,gBAAgB,IAChB,EACF;QACE,MAAM;QACN,YAAY;QACZ,IAAI;QACJ,gBAAgB;QAChB,OAAO;QACP,aAAa;QACb,2BAA2B;QAC3B,kBAAkB;QAClB,qBAAqB;QACrB,YAAY;QACZ,UAAU;QACV,WAAW;KACZ,CACF,CAAC;AACJ,CAAC","sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport {\n autoUpdate,\n flip,\n type FloatingFocusManagerProps,\n offset,\n type OffsetOptions,\n type Placement,\n shift,\n size,\n useClick,\n useClientPoint,\n useDismiss,\n useFloating,\n useInteractions,\n type UseInteractionsReturn,\n useRole,\n useTransitionStyles,\n} from '@floating-ui/react';\nimport { tokens } from '@neo4j-ndl/base';\nimport { useMemo, useState } from 'react';\n\nexport interface PopoverOptions {\n isInitialOpen?: boolean;\n placement?: Placement;\n isOpen?: boolean;\n onOpenChange?: (open: boolean, event?: Event) => void;\n offsetOption?: OffsetOptions;\n anchorElement?: Element | null;\n anchorPosition?: {\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: create componentProps type for this\n // oxlint-disable-next-line id-length\n y: number;\n };\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n anchorElementAsPortalAnchor?: boolean;\n shouldCaptureFocus?: boolean;\n initialFocus?: number | React.RefObject<HTMLElement | null>;\n role?:\n | 'tooltip'\n | 'dialog'\n | 'alertdialog'\n | 'menu'\n | 'listbox'\n | 'grid'\n | 'tree';\n // TODO v5: decide if this naming is okay, or change it\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnClickOutside?: boolean;\n // TODO v5: decide if this naming is okay, or change it\n // eslint-disable-next-line @typescript-eslint/naming-convention\n closeOnReferencePress?: boolean;\n shouldCloseOnFocusOut?: boolean;\n returnFocus?: FloatingFocusManagerProps['returnFocus'];\n strategy?: 'fixed' | 'absolute';\n isPortaled?: boolean;\n shouldConstrainSize?: boolean;\n}\n\nexport interface UsePopoverReturn\n extends UseInteractionsReturn, ReturnType<typeof useFloating> {\n isOpen: boolean;\n labelId: string | undefined;\n descriptionId: string | undefined;\n transitionStyles: React.CSSProperties;\n setLabelId: (labelId: string | undefined) => void;\n setDescriptionId: (descriptionId: string | undefined) => void;\n // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n anchorElementAsPortalAnchor: boolean | undefined;\n shouldCaptureFocus: boolean | undefined;\n shouldCloseOnFocusOut: boolean | undefined;\n initialFocus: number | React.RefObject<HTMLElement | null> | undefined;\n isPortaled: boolean;\n returnFocus: FloatingFocusManagerProps['returnFocus'];\n}\n\nexport function usePopover({\n isInitialOpen = false,\n placement = 'bottom',\n isOpen: controlledOpen,\n onOpenChange: setControlledOpen,\n offsetOption = 10,\n anchorElement,\n anchorPosition,\n anchorElementAsPortalAnchor,\n shouldCaptureFocus,\n initialFocus,\n role: roleProp,\n closeOnClickOutside,\n closeOnReferencePress,\n shouldCloseOnFocusOut,\n returnFocus,\n strategy = 'absolute',\n isPortaled = true,\n shouldConstrainSize = false,\n}: PopoverOptions = {}): UsePopoverReturn {\n // Internal state for uncontrolled mode (no `isOpen` prop provided).\n const [isOpenUncontrolled, setIsOpenUncontrolled] = useState(isInitialOpen);\n const [labelId, setLabelId] = useState<string | undefined>();\n const [descriptionId, setDescriptionId] = useState<string | undefined>();\n\n // Controlled/uncontrolled pattern: prefer the consumer-provided `isOpen`,\n // falling back to internal state when not provided.\n const isOpen = controlledOpen ?? isOpenUncontrolled;\n\n const data = useFloating({\n elements: {\n reference: anchorElement,\n },\n middleware: [\n offset(offsetOption),\n flip({\n crossAxis: placement.includes('-'),\n fallbackAxisSideDirection: 'end',\n padding: 5,\n }),\n shift(),\n ...(shouldConstrainSize\n ? [\n size({\n apply({ availableHeight, availableWidth, elements }) {\n Object.assign(elements.floating.style, {\n maxHeight: `${availableHeight}px`,\n maxWidth: `${availableWidth}px`,\n });\n },\n padding: 5,\n }),\n ]\n : []),\n ],\n // Floating UI calls this when interactions (useClick, useDismiss, etc.)\n // trigger an open/close. We always sync internal state so uncontrolled\n // mode works, and notify the consumer callback exactly once if provided.\n onOpenChange: (open, event) => {\n setIsOpenUncontrolled(open);\n setControlledOpen?.(open, event);\n },\n open: isOpen,\n placement: placement,\n strategy,\n whileElementsMounted: autoUpdate,\n });\n const context = data.context;\n\n // Only enable built-in click-to-toggle in uncontrolled mode. In controlled\n // mode the consumer owns the open state and wires up their own trigger.\n const click = useClick(context, {\n enabled: controlledOpen === undefined,\n });\n\n const dismiss = useDismiss(context, {\n outsidePress: closeOnClickOutside,\n referencePress: closeOnReferencePress,\n });\n const role = useRole(context, {\n role: roleProp,\n });\n\n const clientPoint = useClientPoint(context, {\n enabled: anchorPosition !== undefined,\n // oxlint-disable-next-line id-length\n x: anchorPosition?.x,\n // oxlint-disable-next-line id-length\n y: anchorPosition?.y,\n });\n\n const interactions = useInteractions([click, dismiss, role, clientPoint]);\n\n const { styles: transitionStyles } = useTransitionStyles(context, {\n duration: Number.parseInt(tokens.motion.duration.quick) ?? 0,\n });\n\n return useMemo(\n () => ({\n ...data,\n ...interactions,\n anchorElementAsPortalAnchor,\n descriptionId,\n initialFocus,\n isOpen,\n isPortaled,\n labelId,\n returnFocus,\n setDescriptionId,\n setLabelId,\n shouldCaptureFocus,\n shouldCloseOnFocusOut,\n transitionStyles,\n }),\n [\n isOpen,\n interactions,\n data,\n transitionStyles,\n labelId,\n descriptionId,\n anchorElementAsPortalAnchor,\n shouldCaptureFocus,\n shouldCloseOnFocusOut,\n initialFocus,\n isPortaled,\n returnFocus,\n ],\n );\n}\n"]}
@@ -0,0 +1,159 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ /**
14
+ *
15
+ * Copyright (c) "Neo4j"
16
+ * Neo4j Sweden AB [http://neo4j.com]
17
+ *
18
+ * This file is part of Neo4j.
19
+ *
20
+ * Neo4j is free software: you can redistribute it and/or modify
21
+ * it under the terms of the GNU General Public License as published by
22
+ * the Free Software Foundation, either version 3 of the License, or
23
+ * (at your option) any later version.
24
+ *
25
+ * This program is distributed in the hope that it will be useful,
26
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28
+ * GNU General Public License for more details.
29
+ *
30
+ * You should have received a copy of the GNU General Public License
31
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32
+ */
33
+ import classNames from 'classnames';
34
+ import React, { useContext, useEffect, useRef, useState } from 'react';
35
+ import { CleanIconButton } from '../clean-icon-button';
36
+ import { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';
37
+ import { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';
38
+ import { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';
39
+ import { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';
40
+ import { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';
41
+ import { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';
42
+ import { Typography } from '../typography';
43
+ const LIVE_REGION_REGISTRATION_DELAY = 100;
44
+ const StatusIcon = ({ icon, variant, }) => {
45
+ const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';
46
+ const iconComponent = (() => {
47
+ if (canUseCustomIcon && icon) {
48
+ return icon;
49
+ }
50
+ switch (variant) {
51
+ case 'warning':
52
+ return _jsx(ExclamationTriangleIconSolid, {});
53
+ case 'danger':
54
+ return _jsx(ExclamationCircleIconSolid, {});
55
+ case 'discovery':
56
+ return _jsx(SparklesIconSolid, {});
57
+ case 'info':
58
+ return _jsx(InformationCircleIconSolid, {});
59
+ case 'neutral':
60
+ return _jsx(BoltIconOutline, {});
61
+ default:
62
+ return null;
63
+ }
64
+ })();
65
+ return (_jsx("span", { className: "ndl-announcement-banner-status-icon", "aria-hidden": "true", children: iconComponent }));
66
+ };
67
+ const AnnouncementBannerContext = React.createContext({
68
+ hasIcon: false,
69
+ variant: 'info',
70
+ });
71
+ /**
72
+ * Short title or message for the announcement.
73
+ */
74
+ const AnnouncementBannerHeader = (_a) => {
75
+ var { children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "ref"]);
76
+ const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);
77
+ const classes = classNames('ndl-announcement-banner-header', className);
78
+ return (_jsxs(Typography, Object.assign({ as: "span", variant: "body-medium", className: classes, style: style, ref: ref, htmlAttributes: htmlAttributes }, restProps, { children: [hasIcon && _jsx(StatusIcon, { icon: icon, variant: variant }), children] })));
79
+ };
80
+ /**
81
+ * Optional actions shown next to the announcement message.
82
+ */
83
+ const AnnouncementBannerActions = (_a) => {
84
+ var { children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "ref"]);
85
+ const classes = classNames('ndl-announcement-banner-actions', className);
86
+ return (_jsx("div", Object.assign({ className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: children })));
87
+ };
88
+ /**
89
+ * Full-width announcement bar intended to sit at the top of its parent.
90
+ * It stays in normal document flow so sibling content is shifted down.
91
+ *
92
+ * @remarks
93
+ * Place `AnnouncementBanner` as the first child of a full-width parent (for
94
+ * example the page shell).
95
+ */
96
+ const AnnouncementBannerComponent = (_a) => {
97
+ var _b;
98
+ var { as, variant = 'info', hasIcon = false, icon, onClose, className, children, isCloseable = false, htmlAttributes, liveRegion, ref } = _a, restProps = __rest(_a, ["as", "variant", "hasIcon", "icon", "onClose", "className", "children", "isCloseable", "htmlAttributes", "liveRegion", "ref"]);
99
+ const Element = as !== null && as !== void 0 ? as : 'section';
100
+ const contentRef = useRef(null);
101
+ const [pendingAnnouncement, setPendingAnnouncement] = useState(null);
102
+ const classes = classNames('ndl-announcement-banner', className, {
103
+ 'ndl-announcement-banner-closeable': isCloseable,
104
+ 'ndl-danger': variant === 'danger',
105
+ 'ndl-discovery': variant === 'discovery',
106
+ 'ndl-info': variant === 'info',
107
+ 'ndl-neutral': variant === 'neutral',
108
+ 'ndl-warning': variant === 'warning',
109
+ });
110
+ const handleClose = (error) => {
111
+ if (onClose && typeof onClose === 'function') {
112
+ onClose(error);
113
+ }
114
+ };
115
+ useEffect(() => {
116
+ if (!liveRegion || !contentRef.current) {
117
+ setPendingAnnouncement(null);
118
+ return;
119
+ }
120
+ const header = contentRef.current.querySelector('.ndl-announcement-banner-header');
121
+ if (!header) {
122
+ setPendingAnnouncement(null);
123
+ return;
124
+ }
125
+ let timeoutId;
126
+ const announceHeader = () => {
127
+ var _a;
128
+ window.clearTimeout(timeoutId);
129
+ setPendingAnnouncement(null);
130
+ const message = (_a = header.textContent) === null || _a === void 0 ? void 0 : _a.trim();
131
+ if (message) {
132
+ timeoutId = window.setTimeout(() => {
133
+ setPendingAnnouncement({ message, role: liveRegion });
134
+ }, LIVE_REGION_REGISTRATION_DELAY);
135
+ }
136
+ };
137
+ const observer = new MutationObserver(announceHeader);
138
+ observer.observe(header, {
139
+ characterData: true,
140
+ childList: true,
141
+ subtree: true,
142
+ });
143
+ announceHeader();
144
+ return () => {
145
+ observer.disconnect();
146
+ window.clearTimeout(timeoutId);
147
+ };
148
+ }, [liveRegion]);
149
+ const announcement = (pendingAnnouncement === null || pendingAnnouncement === void 0 ? void 0 : pendingAnnouncement.role) === liveRegion
150
+ ? ((_b = pendingAnnouncement === null || pendingAnnouncement === void 0 ? void 0 : pendingAnnouncement.message) !== null && _b !== void 0 ? _b : '')
151
+ : '';
152
+ return (_jsxs(Element, Object.assign({ className: classes, ref: ref }, restProps, htmlAttributes, { children: [liveRegion && (_jsx("span", { className: "ndl-announcement-banner-live-region", role: liveRegion, "aria-atomic": "true", children: announcement })), _jsx("div", { className: "ndl-announcement-banner-container", ref: contentRef, children: _jsx(AnnouncementBannerContext.Provider, { value: { hasIcon, icon, variant }, children: children }) }), isCloseable && (_jsx("div", { className: "ndl-announcement-banner-close", children: _jsx(CleanIconButton, { size: "small", onClick: handleClose, description: null, htmlAttributes: { 'aria-label': 'Close' }, children: _jsx(XMarkIconOutline, {}) }) }))] })));
153
+ };
154
+ const AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {
155
+ Actions: AnnouncementBannerActions,
156
+ Header: AnnouncementBannerHeader,
157
+ });
158
+ export { AnnouncementBanner };
159
+ //# sourceMappingURL=AnnouncementBanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnnouncementBanner.js","sour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,CAAE,OAAO,mCAAI,EAAE,CAAC;QACtC,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,CACL,MAAC,OAAO,kBAAC,SAAS,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAM,SAAS,EAAM,cAAc,eACrE,UAAU,IAAI,CACb,eACE,SAAS,EAAC,qCAAqC,EAC/C,IAAI,EAAE,UAAU,iBACJ,MAAM,YAEjB,YAAY,GACR,CACR,EACD,cAAK,SAAS,EAAC,mCAAmC,EAAC,GAAG,EAAE,UAAU,YAChE,KAAC,yBAAyB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,YAClE,QAAQ,GAC0B,GACjC,EACL,WAAW,IAAI,CACd,cAAK,SAAS,EAAC,+BAA+B,YAC5C,KAAC,eAAe,IACd,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,IAAI,EACjB,cAAc,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,YAEzC,KAAC,gBAAgB,KAAG,GACJ,GACd,CACP,KACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,2BAA2B,EAAE;IACpE,OAAO,EAAE,yBAAyB;IAClC,MAAM,EAAE,wBAAwB;CACjC,CAAC,CAAC;AAEH,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport React, { useContext, useEffect, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { SparklesIconSolid } from '../icons/generated/heroIcons/SparklesIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype AnnouncementBannerVariant =\n | 'info'\n | 'warning'\n | 'danger'\n | 'discovery'\n | 'neutral';\n\ntype AnnouncementBannerLiveRegion = 'status' | 'alert';\n\ntype PendingAnnouncement = {\n message: string;\n role: AnnouncementBannerLiveRegion;\n};\n\ntype AnnouncementBannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /**\n * Decorative icon shown when `hasIcon` is true. Only used for `discovery`\n * and `neutral`; those variants fall back to Sparkles and Bolt. `info`,\n * `warning`, and `danger` always use their status icons.\n */\n icon?: React.ReactNode;\n\n /** Content to be shown in the announcement banner. */\n children?: React.ReactNode;\n\n /**\n * Announces the header when the banner appears or its header changes.\n * `status` announces politely, while `alert` interrupts the user. Leave this\n * unset for banners that are present during the page's initial render.\n * This is independent of the visual `variant`.\n */\n liveRegion?: AnnouncementBannerLiveRegion;\n\n /** The variant of the announcement banner */\n variant?: AnnouncementBannerVariant;\n};\n\ntype CloseableAnnouncementBannerProps = {\n /** If the banner is closeable. Renders an icon button on the right */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n error?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableAnnouncementBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype AnnouncementBannerCloseProps =\n | CloseableAnnouncementBannerProps\n | NonCloseableAnnouncementBannerProps;\n\ntype AnnouncementBannerProps = AnnouncementBannerCommonProps &\n AnnouncementBannerCloseProps;\n\nconst LIVE_REGION_REGISTRATION_DELAY = 100;\n\nconst StatusIcon = ({\n icon,\n variant,\n}: {\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}) => {\n const canUseCustomIcon = variant === 'discovery' || variant === 'neutral';\n const iconComponent = (() => {\n if (canUseCustomIcon && icon) {\n return icon;\n }\n\n switch (variant) {\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'discovery':\n return <SparklesIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return (\n <span className=\"ndl-announcement-banner-status-icon\" aria-hidden=\"true\">\n {iconComponent}\n </span>\n );\n};\n\nconst AnnouncementBannerContext = React.createContext<{\n hasIcon: boolean;\n icon?: React.ReactNode;\n variant: AnnouncementBannerVariant;\n}>({\n hasIcon: false,\n variant: 'info',\n});\n\n/**\n * Short title or message for the announcement.\n */\nconst AnnouncementBannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const { hasIcon, icon, variant } = useContext(AnnouncementBannerContext);\n const classes = classNames('ndl-announcement-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {hasIcon && <StatusIcon icon={icon} variant={variant} />}\n {children}\n </Typography>\n );\n};\n\n/**\n * Optional actions shown next to the announcement message.\n */\nconst AnnouncementBannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-announcement-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\n/**\n * Full-width announcement bar intended to sit at the top of its parent.\n * It stays in normal document flow so sibling content is shifted down.\n *\n * @remarks\n * Place `AnnouncementBanner` as the first child of a full-width parent (for\n * example the page shell).\n */\nconst AnnouncementBannerComponent = <\n TElement extends React.ElementType = 'section',\n>({\n as,\n variant = 'info',\n hasIcon = false,\n icon,\n onClose,\n className,\n children,\n isCloseable = false,\n htmlAttributes,\n liveRegion,\n ref,\n ...restProps\n}: PolymorphicCommonProps<TElement, AnnouncementBannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n const contentRef = useRef<HTMLDivElement>(null);\n const [pendingAnnouncement, setPendingAnnouncement] =\n useState<PendingAnnouncement | null>(null);\n\n const classes = classNames('ndl-announcement-banner', className, {\n 'ndl-announcement-banner-closeable': isCloseable,\n 'ndl-danger': variant === 'danger',\n 'ndl-discovery': variant === 'discovery',\n 'ndl-info': variant === 'info',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n error:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(error);\n }\n };\n\n useEffect(() => {\n if (!liveRegion || !contentRef.current) {\n setPendingAnnouncement(null);\n return;\n }\n\n const header = contentRef.current.querySelector(\n '.ndl-announcement-banner-header',\n );\n\n if (!header) {\n setPendingAnnouncement(null);\n return;\n }\n\n let timeoutId: number | undefined;\n\n const announceHeader = () => {\n window.clearTimeout(timeoutId);\n setPendingAnnouncement(null);\n\n const message = header.textContent?.trim();\n\n if (message) {\n timeoutId = window.setTimeout(() => {\n setPendingAnnouncement({ message, role: liveRegion });\n }, LIVE_REGION_REGISTRATION_DELAY);\n }\n };\n\n const observer = new MutationObserver(announceHeader);\n observer.observe(header, {\n characterData: true,\n childList: true,\n subtree: true,\n });\n announceHeader();\n\n return () => {\n observer.disconnect();\n window.clearTimeout(timeoutId);\n };\n }, [liveRegion]);\n\n const announcement =\n pendingAnnouncement?.role === liveRegion\n ? (pendingAnnouncement?.message ?? '')\n : '';\n\n return (\n <Element className={classes} ref={ref} {...restProps} {...htmlAttributes}>\n {liveRegion && (\n <span\n className=\"ndl-announcement-banner-live-region\"\n role={liveRegion}\n aria-atomic=\"true\"\n >\n {announcement}\n </span>\n )}\n <div className=\"ndl-announcement-banner-container\" ref={contentRef}>\n <AnnouncementBannerContext.Provider value={{ hasIcon, icon, variant }}>\n {children}\n </AnnouncementBannerContext.Provider>\n </div>\n {isCloseable && (\n <div className=\"ndl-announcement-banner-close\">\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </div>\n )}\n </Element>\n );\n};\n\nconst AnnouncementBanner = Object.assign(AnnouncementBannerComponent, {\n Actions: AnnouncementBannerActions,\n Header: AnnouncementBannerHeader,\n});\n\nexport { AnnouncementBanner };\n"]}