@neo4j-ndl/react 4.18.13 → 4.19.0

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 (234) hide show
  1. package/lib/LICENSES.txt +54 -0
  2. package/lib/NOTICE.txt +8 -0
  3. package/lib/cjs/_common/use-semi-controlled-state.js +6 -1
  4. package/lib/cjs/_common/use-semi-controlled-state.js.map +1 -1
  5. package/lib/cjs/combobox/Combobox.js +1031 -0
  6. package/lib/cjs/combobox/Combobox.js.map +1 -0
  7. package/lib/cjs/combobox/combobox-types.js +23 -0
  8. package/lib/cjs/combobox/combobox-types.js.map +1 -0
  9. package/lib/cjs/combobox/combobox-utils.js +129 -0
  10. package/lib/cjs/combobox/combobox-utils.js.map +1 -0
  11. package/lib/cjs/combobox/index.js +26 -0
  12. package/lib/cjs/combobox/index.js.map +1 -0
  13. package/lib/cjs/combobox/stories/combobox-action-on-select.story.js +82 -0
  14. package/lib/cjs/combobox/stories/combobox-action-on-select.story.js.map +1 -0
  15. package/lib/cjs/combobox/stories/combobox-actions.story.js +78 -0
  16. package/lib/cjs/combobox/stories/combobox-actions.story.js.map +1 -0
  17. package/lib/cjs/combobox/stories/combobox-async.story.js +75 -0
  18. package/lib/cjs/combobox/stories/combobox-async.story.js.map +1 -0
  19. package/lib/cjs/combobox/stories/combobox-clean.story.js +38 -0
  20. package/lib/cjs/combobox/stories/combobox-clean.story.js.map +1 -0
  21. package/lib/cjs/combobox/stories/combobox-creatable.story.js +41 -0
  22. package/lib/cjs/combobox/stories/combobox-creatable.story.js.map +1 -0
  23. package/lib/cjs/combobox/stories/combobox-custom-multi.story.js +45 -0
  24. package/lib/cjs/combobox/stories/combobox-custom-multi.story.js.map +1 -0
  25. package/lib/cjs/combobox/stories/combobox-custom-single.story.js +44 -0
  26. package/lib/cjs/combobox/stories/combobox-custom-single.story.js.map +1 -0
  27. package/lib/cjs/combobox/stories/combobox-custom-trigger.story.js +60 -0
  28. package/lib/cjs/combobox/stories/combobox-custom-trigger.story.js.map +1 -0
  29. package/lib/cjs/combobox/stories/combobox-default.story.js +42 -0
  30. package/lib/cjs/combobox/stories/combobox-default.story.js.map +1 -0
  31. package/lib/cjs/combobox/stories/combobox-descriptions.story.js +45 -0
  32. package/lib/cjs/combobox/stories/combobox-descriptions.story.js.map +1 -0
  33. package/lib/cjs/combobox/stories/combobox-disabled.story.js +34 -0
  34. package/lib/cjs/combobox/stories/combobox-disabled.story.js.map +1 -0
  35. package/lib/cjs/combobox/stories/combobox-fluid.story.js +34 -0
  36. package/lib/cjs/combobox/stories/combobox-fluid.story.js.map +1 -0
  37. package/lib/cjs/combobox/stories/combobox-groups.story.js +49 -0
  38. package/lib/cjs/combobox/stories/combobox-groups.story.js.map +1 -0
  39. package/lib/cjs/combobox/stories/combobox-hidden-label.story.js +33 -0
  40. package/lib/cjs/combobox/stories/combobox-hidden-label.story.js.map +1 -0
  41. package/lib/cjs/combobox/stories/combobox-icons.story.js +46 -0
  42. package/lib/cjs/combobox/stories/combobox-icons.story.js.map +1 -0
  43. package/lib/cjs/combobox/stories/combobox-in-dialog.story.js +40 -0
  44. package/lib/cjs/combobox/stories/combobox-in-dialog.story.js.map +1 -0
  45. package/lib/cjs/combobox/stories/combobox-in-popover-dialog.story.js +40 -0
  46. package/lib/cjs/combobox/stories/combobox-in-popover-dialog.story.js.map +1 -0
  47. package/lib/cjs/combobox/stories/combobox-in-popover.story.js +36 -0
  48. package/lib/cjs/combobox/stories/combobox-in-popover.story.js.map +1 -0
  49. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js +36 -0
  50. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js.map +1 -0
  51. package/lib/cjs/combobox/stories/combobox-max-rows.story.js +42 -0
  52. package/lib/cjs/combobox/stories/combobox-max-rows.story.js.map +1 -0
  53. package/lib/cjs/combobox/stories/combobox-multi.story.js +45 -0
  54. package/lib/cjs/combobox/stories/combobox-multi.story.js.map +1 -0
  55. package/lib/cjs/combobox/stories/combobox-native-form.story.js +49 -0
  56. package/lib/cjs/combobox/stories/combobox-native-form.story.js.map +1 -0
  57. package/lib/cjs/combobox/stories/combobox-select-only.story.js +38 -0
  58. package/lib/cjs/combobox/stories/combobox-select-only.story.js.map +1 -0
  59. package/lib/cjs/combobox/stories/combobox-sizes.story.js +33 -0
  60. package/lib/cjs/combobox/stories/combobox-sizes.story.js.map +1 -0
  61. package/lib/cjs/combobox/stories/combobox-unlimited-rows.story.js +42 -0
  62. package/lib/cjs/combobox/stories/combobox-unlimited-rows.story.js.map +1 -0
  63. package/lib/cjs/combobox/stories/combobox-validation.story.js +33 -0
  64. package/lib/cjs/combobox/stories/combobox-validation.story.js.map +1 -0
  65. package/lib/cjs/combobox/stories/index.js +133 -0
  66. package/lib/cjs/combobox/stories/index.js.map +1 -0
  67. package/lib/cjs/combobox/use-combobox-multi-value-overflow.js +173 -0
  68. package/lib/cjs/combobox/use-combobox-multi-value-overflow.js.map +1 -0
  69. package/lib/cjs/combobox/use-combobox-popover.js +80 -0
  70. package/lib/cjs/combobox/use-combobox-popover.js.map +1 -0
  71. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  72. package/lib/cjs/dismissible-tag/DismissibleTag.js +1 -1
  73. package/lib/cjs/dismissible-tag/DismissibleTag.js.map +1 -1
  74. package/lib/cjs/index.js +1 -0
  75. package/lib/cjs/index.js.map +1 -1
  76. package/lib/cjs/select/Select.js +3 -0
  77. package/lib/cjs/select/Select.js.map +1 -1
  78. package/lib/cjs/text-area/TextArea.js.map +1 -1
  79. package/lib/cjs/text-input/TextInput.js.map +1 -1
  80. package/lib/esm/_common/use-semi-controlled-state.js +6 -1
  81. package/lib/esm/_common/use-semi-controlled-state.js.map +1 -1
  82. package/lib/esm/combobox/Combobox.js +1024 -0
  83. package/lib/esm/combobox/Combobox.js.map +1 -0
  84. package/lib/esm/combobox/combobox-types.js +22 -0
  85. package/lib/esm/combobox/combobox-types.js.map +1 -0
  86. package/lib/esm/combobox/combobox-utils.js +112 -0
  87. package/lib/esm/combobox/combobox-utils.js.map +1 -0
  88. package/lib/esm/combobox/index.js +22 -0
  89. package/lib/esm/combobox/index.js.map +1 -0
  90. package/lib/esm/combobox/stories/combobox-action-on-select.story.js +80 -0
  91. package/lib/esm/combobox/stories/combobox-action-on-select.story.js.map +1 -0
  92. package/lib/esm/combobox/stories/combobox-actions.story.js +76 -0
  93. package/lib/esm/combobox/stories/combobox-actions.story.js.map +1 -0
  94. package/lib/esm/combobox/stories/combobox-async.story.js +73 -0
  95. package/lib/esm/combobox/stories/combobox-async.story.js.map +1 -0
  96. package/lib/esm/combobox/stories/combobox-clean.story.js +36 -0
  97. package/lib/esm/combobox/stories/combobox-clean.story.js.map +1 -0
  98. package/lib/esm/combobox/stories/combobox-creatable.story.js +39 -0
  99. package/lib/esm/combobox/stories/combobox-creatable.story.js.map +1 -0
  100. package/lib/esm/combobox/stories/combobox-custom-multi.story.js +43 -0
  101. package/lib/esm/combobox/stories/combobox-custom-multi.story.js.map +1 -0
  102. package/lib/esm/combobox/stories/combobox-custom-single.story.js +42 -0
  103. package/lib/esm/combobox/stories/combobox-custom-single.story.js.map +1 -0
  104. package/lib/esm/combobox/stories/combobox-custom-trigger.story.js +58 -0
  105. package/lib/esm/combobox/stories/combobox-custom-trigger.story.js.map +1 -0
  106. package/lib/esm/combobox/stories/combobox-default.story.js +40 -0
  107. package/lib/esm/combobox/stories/combobox-default.story.js.map +1 -0
  108. package/lib/esm/combobox/stories/combobox-descriptions.story.js +43 -0
  109. package/lib/esm/combobox/stories/combobox-descriptions.story.js.map +1 -0
  110. package/lib/esm/combobox/stories/combobox-disabled.story.js +32 -0
  111. package/lib/esm/combobox/stories/combobox-disabled.story.js.map +1 -0
  112. package/lib/esm/combobox/stories/combobox-fluid.story.js +32 -0
  113. package/lib/esm/combobox/stories/combobox-fluid.story.js.map +1 -0
  114. package/lib/esm/combobox/stories/combobox-groups.story.js +47 -0
  115. package/lib/esm/combobox/stories/combobox-groups.story.js.map +1 -0
  116. package/lib/esm/combobox/stories/combobox-hidden-label.story.js +31 -0
  117. package/lib/esm/combobox/stories/combobox-hidden-label.story.js.map +1 -0
  118. package/lib/esm/combobox/stories/combobox-icons.story.js +44 -0
  119. package/lib/esm/combobox/stories/combobox-icons.story.js.map +1 -0
  120. package/lib/esm/combobox/stories/combobox-in-dialog.story.js +38 -0
  121. package/lib/esm/combobox/stories/combobox-in-dialog.story.js.map +1 -0
  122. package/lib/esm/combobox/stories/combobox-in-popover-dialog.story.js +38 -0
  123. package/lib/esm/combobox/stories/combobox-in-popover-dialog.story.js.map +1 -0
  124. package/lib/esm/combobox/stories/combobox-in-popover.story.js +34 -0
  125. package/lib/esm/combobox/stories/combobox-in-popover.story.js.map +1 -0
  126. package/lib/esm/combobox/stories/combobox-large-data-set.story.js +34 -0
  127. package/lib/esm/combobox/stories/combobox-large-data-set.story.js.map +1 -0
  128. package/lib/esm/combobox/stories/combobox-max-rows.story.js +40 -0
  129. package/lib/esm/combobox/stories/combobox-max-rows.story.js.map +1 -0
  130. package/lib/esm/combobox/stories/combobox-multi.story.js +43 -0
  131. package/lib/esm/combobox/stories/combobox-multi.story.js.map +1 -0
  132. package/lib/esm/combobox/stories/combobox-native-form.story.js +47 -0
  133. package/lib/esm/combobox/stories/combobox-native-form.story.js.map +1 -0
  134. package/lib/esm/combobox/stories/combobox-select-only.story.js +36 -0
  135. package/lib/esm/combobox/stories/combobox-select-only.story.js.map +1 -0
  136. package/lib/esm/combobox/stories/combobox-sizes.story.js +31 -0
  137. package/lib/esm/combobox/stories/combobox-sizes.story.js.map +1 -0
  138. package/lib/esm/combobox/stories/combobox-unlimited-rows.story.js +40 -0
  139. package/lib/esm/combobox/stories/combobox-unlimited-rows.story.js.map +1 -0
  140. package/lib/esm/combobox/stories/combobox-validation.story.js +31 -0
  141. package/lib/esm/combobox/stories/combobox-validation.story.js.map +1 -0
  142. package/lib/esm/combobox/stories/index.js +100 -0
  143. package/lib/esm/combobox/stories/index.js.map +1 -0
  144. package/lib/esm/combobox/use-combobox-multi-value-overflow.js +166 -0
  145. package/lib/esm/combobox/use-combobox-multi-value-overflow.js.map +1 -0
  146. package/lib/esm/combobox/use-combobox-popover.js +77 -0
  147. package/lib/esm/combobox/use-combobox-popover.js.map +1 -0
  148. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  149. package/lib/esm/dismissible-tag/DismissibleTag.js +1 -1
  150. package/lib/esm/dismissible-tag/DismissibleTag.js.map +1 -1
  151. package/lib/esm/index.js +1 -0
  152. package/lib/esm/index.js.map +1 -1
  153. package/lib/esm/select/Select.js +3 -0
  154. package/lib/esm/select/Select.js.map +1 -1
  155. package/lib/esm/text-area/TextArea.js.map +1 -1
  156. package/lib/esm/text-input/TextInput.js.map +1 -1
  157. package/lib/types/_common/use-semi-controlled-state.d.ts +5 -1
  158. package/lib/types/_common/use-semi-controlled-state.d.ts.map +1 -1
  159. package/lib/types/combobox/Combobox.d.ts +24 -0
  160. package/lib/types/combobox/Combobox.d.ts.map +1 -0
  161. package/lib/types/combobox/combobox-types.d.ts +419 -0
  162. package/lib/types/combobox/combobox-types.d.ts.map +1 -0
  163. package/lib/types/combobox/combobox-utils.d.ts +81 -0
  164. package/lib/types/combobox/combobox-utils.d.ts.map +1 -0
  165. package/lib/types/combobox/index.d.ts +23 -0
  166. package/lib/types/combobox/index.d.ts.map +1 -0
  167. package/lib/types/combobox/stories/combobox-action-on-select.story.d.ts +24 -0
  168. package/lib/types/combobox/stories/combobox-action-on-select.story.d.ts.map +1 -0
  169. package/lib/types/combobox/stories/combobox-actions.story.d.ts +24 -0
  170. package/lib/types/combobox/stories/combobox-actions.story.d.ts.map +1 -0
  171. package/lib/types/combobox/stories/combobox-async.story.d.ts +24 -0
  172. package/lib/types/combobox/stories/combobox-async.story.d.ts.map +1 -0
  173. package/lib/types/combobox/stories/combobox-clean.story.d.ts +24 -0
  174. package/lib/types/combobox/stories/combobox-clean.story.d.ts.map +1 -0
  175. package/lib/types/combobox/stories/combobox-creatable.story.d.ts +24 -0
  176. package/lib/types/combobox/stories/combobox-creatable.story.d.ts.map +1 -0
  177. package/lib/types/combobox/stories/combobox-custom-multi.story.d.ts +24 -0
  178. package/lib/types/combobox/stories/combobox-custom-multi.story.d.ts.map +1 -0
  179. package/lib/types/combobox/stories/combobox-custom-single.story.d.ts +24 -0
  180. package/lib/types/combobox/stories/combobox-custom-single.story.d.ts.map +1 -0
  181. package/lib/types/combobox/stories/combobox-custom-trigger.story.d.ts +24 -0
  182. package/lib/types/combobox/stories/combobox-custom-trigger.story.d.ts.map +1 -0
  183. package/lib/types/combobox/stories/combobox-default.story.d.ts +24 -0
  184. package/lib/types/combobox/stories/combobox-default.story.d.ts.map +1 -0
  185. package/lib/types/combobox/stories/combobox-descriptions.story.d.ts +24 -0
  186. package/lib/types/combobox/stories/combobox-descriptions.story.d.ts.map +1 -0
  187. package/lib/types/combobox/stories/combobox-disabled.story.d.ts +24 -0
  188. package/lib/types/combobox/stories/combobox-disabled.story.d.ts.map +1 -0
  189. package/lib/types/combobox/stories/combobox-fluid.story.d.ts +24 -0
  190. package/lib/types/combobox/stories/combobox-fluid.story.d.ts.map +1 -0
  191. package/lib/types/combobox/stories/combobox-groups.story.d.ts +24 -0
  192. package/lib/types/combobox/stories/combobox-groups.story.d.ts.map +1 -0
  193. package/lib/types/combobox/stories/combobox-hidden-label.story.d.ts +24 -0
  194. package/lib/types/combobox/stories/combobox-hidden-label.story.d.ts.map +1 -0
  195. package/lib/types/combobox/stories/combobox-icons.story.d.ts +24 -0
  196. package/lib/types/combobox/stories/combobox-icons.story.d.ts.map +1 -0
  197. package/lib/types/combobox/stories/combobox-in-dialog.story.d.ts +24 -0
  198. package/lib/types/combobox/stories/combobox-in-dialog.story.d.ts.map +1 -0
  199. package/lib/types/combobox/stories/combobox-in-popover-dialog.story.d.ts +24 -0
  200. package/lib/types/combobox/stories/combobox-in-popover-dialog.story.d.ts.map +1 -0
  201. package/lib/types/combobox/stories/combobox-in-popover.story.d.ts +24 -0
  202. package/lib/types/combobox/stories/combobox-in-popover.story.d.ts.map +1 -0
  203. package/lib/types/combobox/stories/combobox-large-data-set.story.d.ts +24 -0
  204. package/lib/types/combobox/stories/combobox-large-data-set.story.d.ts.map +1 -0
  205. package/lib/types/combobox/stories/combobox-max-rows.story.d.ts +24 -0
  206. package/lib/types/combobox/stories/combobox-max-rows.story.d.ts.map +1 -0
  207. package/lib/types/combobox/stories/combobox-multi.story.d.ts +24 -0
  208. package/lib/types/combobox/stories/combobox-multi.story.d.ts.map +1 -0
  209. package/lib/types/combobox/stories/combobox-native-form.story.d.ts +24 -0
  210. package/lib/types/combobox/stories/combobox-native-form.story.d.ts.map +1 -0
  211. package/lib/types/combobox/stories/combobox-select-only.story.d.ts +24 -0
  212. package/lib/types/combobox/stories/combobox-select-only.story.d.ts.map +1 -0
  213. package/lib/types/combobox/stories/combobox-sizes.story.d.ts +24 -0
  214. package/lib/types/combobox/stories/combobox-sizes.story.d.ts.map +1 -0
  215. package/lib/types/combobox/stories/combobox-unlimited-rows.story.d.ts +24 -0
  216. package/lib/types/combobox/stories/combobox-unlimited-rows.story.d.ts.map +1 -0
  217. package/lib/types/combobox/stories/combobox-validation.story.d.ts +24 -0
  218. package/lib/types/combobox/stories/combobox-validation.story.d.ts.map +1 -0
  219. package/lib/types/combobox/stories/index.d.ts +73 -0
  220. package/lib/types/combobox/stories/index.d.ts.map +1 -0
  221. package/lib/types/combobox/use-combobox-multi-value-overflow.d.ts +76 -0
  222. package/lib/types/combobox/use-combobox-multi-value-overflow.d.ts.map +1 -0
  223. package/lib/types/combobox/use-combobox-popover.d.ts +66 -0
  224. package/lib/types/combobox/use-combobox-popover.d.ts.map +1 -0
  225. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  226. package/lib/types/dismissible-tag/DismissibleTag.d.ts.map +1 -1
  227. package/lib/types/index.d.ts +1 -0
  228. package/lib/types/index.d.ts.map +1 -1
  229. package/lib/types/select/Select.d.ts +3 -0
  230. package/lib/types/select/Select.d.ts.map +1 -1
  231. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  232. package/package.json +10 -4
  233. package/skills/ndl-react/SKILL.md +20 -0
  234. package/skills/ndl-react/components/combobox.md +1487 -0
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Combobox } from '@neo4j-ndl/react';
24
+ const options = [
25
+ { label: 'Neo4j', value: 'neo4j' },
26
+ { label: 'Aura', value: 'aura' },
27
+ { label: 'Bloom', value: 'bloom' },
28
+ ];
29
+ const Component = () => (_jsx("div", { className: "n-flex n-flex-col n-gap-token-16", children: ['small', 'medium', 'large'].map((size) => (_jsxs("div", { className: "n-flex n-flex-col n-gap-token-4", children: [_jsx("p", { className: "n-capitalize", children: size }), _jsxs("div", { className: "n-flex n-flex-wrap n-items-start n-gap-token-16", children: [_jsx(Combobox, { label: `${size} single-select`, defaultValue: options[0], options: options, size: size }), _jsx(Combobox, { label: `${size} multi-select`, defaultValue: options.slice(0, 2), isMulti: true, options: options, size: size })] })] }, size))) }));
30
+ export default Component;
31
+ //# sourceMappingURL=combobox-sizes.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combobox-sizes.story.js","sourceRoot":"","sources":["../../../../src/combobox/stories/combobox-sizes.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,OAAO,GAAG;IACd,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAClC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;CACnC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CACtB,cAAK,SAAS,EAAC,kCAAkC,YAC7C,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACrD,eAAK,SAAS,EAAC,iCAAiC,aAC9C,YAAG,SAAS,EAAC,cAAc,YAAE,IAAI,GAAK,EACtC,eAAK,SAAS,EAAC,iDAAiD,aAC9D,KAAC,QAAQ,IACP,KAAK,EAAE,GAAG,IAAI,gBAAgB,EAC9B,YAAY,EAAE,OAAO,CAAC,CAAC,CAAC,EACxB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACV,EACF,KAAC,QAAQ,IACP,KAAK,EAAE,GAAG,IAAI,eAAe,EAC7B,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EACjC,OAAO,QACP,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,GACV,IACE,KAhB8C,IAAI,CAiBpD,CACP,CAAC,GACE,CACP,CAAC;AAEF,eAAe,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 { Combobox } from '@neo4j-ndl/react';\n\nconst options = [\n { label: 'Neo4j', value: 'neo4j' },\n { label: 'Aura', value: 'aura' },\n { label: 'Bloom', value: 'bloom' },\n];\n\nconst Component = () => (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n {(['small', 'medium', 'large'] as const).map((size) => (\n <div className=\"n-flex n-flex-col n-gap-token-4\" key={size}>\n <p className=\"n-capitalize\">{size}</p>\n <div className=\"n-flex n-flex-wrap n-items-start n-gap-token-16\">\n <Combobox\n label={`${size} single-select`}\n defaultValue={options[0]}\n options={options}\n size={size}\n />\n <Combobox\n label={`${size} multi-select`}\n defaultValue={options.slice(0, 2)}\n isMulti\n options={options}\n size={size}\n />\n </div>\n </div>\n ))}\n </div>\n);\n\nexport default Component;\n"]}
@@ -0,0 +1,40 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Combobox } from '@neo4j-ndl/react';
24
+ import { useState } from 'react';
25
+ const Component = () => {
26
+ const options = [
27
+ { label: 'Neo4j', value: 'neo4j' },
28
+ { label: 'Aura', value: 'aura' },
29
+ { label: 'Bloom', value: 'bloom' },
30
+ { label: 'Data Importer', value: 'data-importer' },
31
+ { label: 'GraphQL Library', value: 'graphql-library' },
32
+ { label: 'Cypher', value: 'cypher' },
33
+ { label: 'Operations Manager', value: 'operations-manager' },
34
+ { label: 'Graph Data Science', value: 'graph-data-science' },
35
+ ];
36
+ const [value, setValue] = useState(options);
37
+ return (_jsx(Combobox, { label: "Products", isClearable: true, isMulti: true, maxRows: null, options: options, value: value, onChange: (nextValue) => setValue(nextValue), helpText: "Set maxRows to null to let the control grow with the selection." }));
38
+ };
39
+ export default Component;
40
+ //# sourceMappingURL=combobox-unlimited-rows.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combobox-unlimited-rows.story.js","sourceRoot":"","sources":["../../../../src/combobox/stories/combobox-unlimited-rows.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAOjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,OAAO,GAAa;QACxB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAClC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;QAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAClC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;QAClD,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;QACtD,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACpC,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,EAAE;QAC5D,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oBAAoB,EAAE;KAC7D,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE5C,OAAO,CACL,KAAC,QAAQ,IACP,KAAK,EAAC,UAAU,EAChB,WAAW,QACX,OAAO,QACP,OAAO,EAAE,IAAI,EACb,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,EAC5C,QAAQ,EAAC,iEAAiE,GAC1E,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { Combobox } from '@neo4j-ndl/react';\nimport { useState } from 'react';\n\ntype Option = {\n label: string;\n value: string;\n};\n\nconst Component = () => {\n const options: Option[] = [\n { label: 'Neo4j', value: 'neo4j' },\n { label: 'Aura', value: 'aura' },\n { label: 'Bloom', value: 'bloom' },\n { label: 'Data Importer', value: 'data-importer' },\n { label: 'GraphQL Library', value: 'graphql-library' },\n { label: 'Cypher', value: 'cypher' },\n { label: 'Operations Manager', value: 'operations-manager' },\n { label: 'Graph Data Science', value: 'graph-data-science' },\n ];\n const [value, setValue] = useState(options);\n\n return (\n <Combobox\n label=\"Products\"\n isClearable\n isMulti\n maxRows={null}\n options={options}\n value={value}\n onChange={(nextValue) => setValue(nextValue)}\n helpText=\"Set maxRows to null to let the control grow with the selection.\"\n />\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Combobox } from '@neo4j-ndl/react';
24
+ const options = [
25
+ { label: 'Neo4j', value: 'neo4j' },
26
+ { label: 'Aura', value: 'aura' },
27
+ { label: 'Bloom', value: 'bloom' },
28
+ ];
29
+ const Component = () => (_jsxs("div", { className: "n-flex n-flex-col n-gap-token-16", children: [_jsx(Combobox, { label: "Product", helpText: "Pick the product the ticket is about.", isRequired: true, hasRequiredIndicator: true, options: options }), _jsx(Combobox, { label: "Product", errorText: "Select a product to continue.", isRequired: true, hasRequiredIndicator: true, options: options }), _jsx(Combobox, { label: "Environment", helpText: "Leave empty to include every environment.", hasRequiredIndicator: true, options: options })] }));
30
+ export default Component;
31
+ //# sourceMappingURL=combobox-validation.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combobox-validation.story.js","sourceRoot":"","sources":["../../../../src/combobox/stories/combobox-validation.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,OAAO,GAAG;IACd,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAClC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;CACnC,CAAC;AAEF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,CACtB,eAAK,SAAS,EAAC,kCAAkC,aAC/C,KAAC,QAAQ,IACP,KAAK,EAAC,SAAS,EACf,QAAQ,EAAC,uCAAuC,EAChD,UAAU,QACV,oBAAoB,QACpB,OAAO,EAAE,OAAO,GAChB,EACF,KAAC,QAAQ,IACP,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,+BAA+B,EACzC,UAAU,QACV,oBAAoB,QACpB,OAAO,EAAE,OAAO,GAChB,EACF,KAAC,QAAQ,IACP,KAAK,EAAC,aAAa,EACnB,QAAQ,EAAC,2CAA2C,EACpD,oBAAoB,QACpB,OAAO,EAAE,OAAO,GAChB,IACE,CACP,CAAC;AAEF,eAAe,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 { Combobox } from '@neo4j-ndl/react';\n\nconst options = [\n { label: 'Neo4j', value: 'neo4j' },\n { label: 'Aura', value: 'aura' },\n { label: 'Bloom', value: 'bloom' },\n];\n\nconst Component = () => (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <Combobox\n label=\"Product\"\n helpText=\"Pick the product the ticket is about.\"\n isRequired\n hasRequiredIndicator\n options={options}\n />\n <Combobox\n label=\"Product\"\n errorText=\"Select a product to continue.\"\n isRequired\n hasRequiredIndicator\n options={options}\n />\n <Combobox\n label=\"Environment\"\n helpText=\"Leave empty to include every environment.\"\n hasRequiredIndicator\n options={options}\n />\n </div>\n);\n\nexport default Component;\n"]}
@@ -0,0 +1,100 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export { default as ComboboxActions } from './combobox-actions.story';
22
+ export { default as ComboboxAsync } from './combobox-async.story';
23
+ export { default as ComboboxClean } from './combobox-clean.story';
24
+ export { default as ComboboxActionOnSelect } from './combobox-action-on-select.story';
25
+ export { default as ComboboxCreatable } from './combobox-creatable.story';
26
+ export { default as ComboboxCustomMulti } from './combobox-custom-multi.story';
27
+ export { default as ComboboxCustomSingle } from './combobox-custom-single.story';
28
+ export { default as ComboboxCustomTrigger } from './combobox-custom-trigger.story';
29
+ export { default as ComboboxDefault } from './combobox-default.story';
30
+ export { default as ComboboxDescriptions } from './combobox-descriptions.story';
31
+ export { default as ComboboxDisabled } from './combobox-disabled.story';
32
+ export { default as ComboboxFluid } from './combobox-fluid.story';
33
+ export { default as ComboboxGroups } from './combobox-groups.story';
34
+ export { default as ComboboxHiddenLabel } from './combobox-hidden-label.story';
35
+ export { default as ComboboxIcons } from './combobox-icons.story';
36
+ export { default as ComboboxInDialog } from './combobox-in-dialog.story';
37
+ export { default as ComboboxInPopover } from './combobox-in-popover.story';
38
+ export { default as ComboboxInPopoverDialog } from './combobox-in-popover-dialog.story';
39
+ export { default as ComboboxLargeDataSet } from './combobox-large-data-set.story';
40
+ export { default as ComboboxMaxRows } from './combobox-max-rows.story';
41
+ export { default as ComboboxMulti } from './combobox-multi.story';
42
+ export { default as ComboboxNativeForm } from './combobox-native-form.story';
43
+ export { default as ComboboxSelectOnly } from './combobox-select-only.story';
44
+ export { default as ComboboxSizes } from './combobox-sizes.story';
45
+ export { default as ComboboxUnlimitedRows } from './combobox-unlimited-rows.story';
46
+ export { default as ComboboxValidation } from './combobox-validation.story';
47
+ import { removeLicenseHeader } from '../../_common/export-stories-utils';
48
+ import ComboboxActionOnSelectSourceRaw from './combobox-action-on-select.story.tsx?raw';
49
+ import ComboboxActionsSourceRaw from './combobox-actions.story.tsx?raw';
50
+ import ComboboxAsyncSourceRaw from './combobox-async.story.tsx?raw';
51
+ import ComboboxCleanSourceRaw from './combobox-clean.story.tsx?raw';
52
+ import ComboboxCreatableSourceRaw from './combobox-creatable.story.tsx?raw';
53
+ import ComboboxCustomMultiSourceRaw from './combobox-custom-multi.story.tsx?raw';
54
+ import ComboboxCustomSingleSourceRaw from './combobox-custom-single.story.tsx?raw';
55
+ import ComboboxCustomTriggerSourceRaw from './combobox-custom-trigger.story.tsx?raw';
56
+ import ComboboxDefaultSourceRaw from './combobox-default.story.tsx?raw';
57
+ import ComboboxDescriptionsSourceRaw from './combobox-descriptions.story.tsx?raw';
58
+ import ComboboxDisabledSourceRaw from './combobox-disabled.story.tsx?raw';
59
+ import ComboboxFluidSourceRaw from './combobox-fluid.story.tsx?raw';
60
+ import ComboboxGroupsSourceRaw from './combobox-groups.story.tsx?raw';
61
+ import ComboboxHiddenLabelSourceRaw from './combobox-hidden-label.story.tsx?raw';
62
+ import ComboboxIconsSourceRaw from './combobox-icons.story.tsx?raw';
63
+ import ComboboxInDialogSourceRaw from './combobox-in-dialog.story.tsx?raw';
64
+ import ComboboxInPopoverSourceRaw from './combobox-in-popover.story.tsx?raw';
65
+ import ComboboxInPopoverDialogSourceRaw from './combobox-in-popover-dialog.story.tsx?raw';
66
+ import ComboboxLargeDataSetSourceRaw from './combobox-large-data-set.story.tsx?raw';
67
+ import ComboboxMaxRowsSourceRaw from './combobox-max-rows.story.tsx?raw';
68
+ import ComboboxMultiSourceRaw from './combobox-multi.story.tsx?raw';
69
+ import ComboboxNativeFormSourceRaw from './combobox-native-form.story.tsx?raw';
70
+ import ComboboxSelectOnlySourceRaw from './combobox-select-only.story.tsx?raw';
71
+ import ComboboxSizesSourceRaw from './combobox-sizes.story.tsx?raw';
72
+ import ComboboxUnlimitedRowsSourceRaw from './combobox-unlimited-rows.story.tsx?raw';
73
+ import ComboboxValidationSourceRaw from './combobox-validation.story.tsx?raw';
74
+ export const ComboboxActionsSource = removeLicenseHeader(ComboboxActionsSourceRaw);
75
+ export const ComboboxAsyncSource = removeLicenseHeader(ComboboxAsyncSourceRaw);
76
+ export const ComboboxCleanSource = removeLicenseHeader(ComboboxCleanSourceRaw);
77
+ export const ComboboxActionOnSelectSource = removeLicenseHeader(ComboboxActionOnSelectSourceRaw);
78
+ export const ComboboxCreatableSource = removeLicenseHeader(ComboboxCreatableSourceRaw);
79
+ export const ComboboxDefaultSource = removeLicenseHeader(ComboboxDefaultSourceRaw);
80
+ export const ComboboxDescriptionsSource = removeLicenseHeader(ComboboxDescriptionsSourceRaw);
81
+ export const ComboboxDisabledSource = removeLicenseHeader(ComboboxDisabledSourceRaw);
82
+ export const ComboboxFluidSource = removeLicenseHeader(ComboboxFluidSourceRaw);
83
+ export const ComboboxGroupsSource = removeLicenseHeader(ComboboxGroupsSourceRaw);
84
+ export const ComboboxHiddenLabelSource = removeLicenseHeader(ComboboxHiddenLabelSourceRaw);
85
+ export const ComboboxIconsSource = removeLicenseHeader(ComboboxIconsSourceRaw);
86
+ export const ComboboxInDialogSource = removeLicenseHeader(ComboboxInDialogSourceRaw);
87
+ export const ComboboxInPopoverSource = removeLicenseHeader(ComboboxInPopoverSourceRaw);
88
+ export const ComboboxInPopoverDialogSource = removeLicenseHeader(ComboboxInPopoverDialogSourceRaw);
89
+ export const ComboboxLargeDataSetSource = removeLicenseHeader(ComboboxLargeDataSetSourceRaw);
90
+ export const ComboboxMaxRowsSource = removeLicenseHeader(ComboboxMaxRowsSourceRaw);
91
+ export const ComboboxMultiSource = removeLicenseHeader(ComboboxMultiSourceRaw);
92
+ export const ComboboxNativeFormSource = removeLicenseHeader(ComboboxNativeFormSourceRaw);
93
+ export const ComboboxSelectOnlySource = removeLicenseHeader(ComboboxSelectOnlySourceRaw);
94
+ export const ComboboxSizesSource = removeLicenseHeader(ComboboxSizesSourceRaw);
95
+ export const ComboboxUnlimitedRowsSource = removeLicenseHeader(ComboboxUnlimitedRowsSourceRaw);
96
+ export const ComboboxCustomTriggerSource = removeLicenseHeader(ComboboxCustomTriggerSourceRaw);
97
+ export const ComboboxCustomMultiSource = removeLicenseHeader(ComboboxCustomMultiSourceRaw);
98
+ export const ComboboxCustomSingleSource = removeLicenseHeader(ComboboxCustomSingleSourceRaw);
99
+ export const ComboboxValidationSource = removeLicenseHeader(ComboboxValidationSourceRaw);
100
+ //# sourceMappingURL=index.js.map
@@ -0,0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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 ComboboxActions } from './combobox-actions.story';\nexport { default as ComboboxAsync } from './combobox-async.story';\nexport { default as ComboboxClean } from './combobox-clean.story';\nexport { default as ComboboxActionOnSelect } from './combobox-action-on-select.story';\nexport { default as ComboboxCreatable } from './combobox-creatable.story';\nexport { default as ComboboxCustomMulti } from './combobox-custom-multi.story';\nexport { default as ComboboxCustomSingle } from './combobox-custom-single.story';\nexport { default as ComboboxCustomTrigger } from './combobox-custom-trigger.story';\nexport { default as ComboboxDefault } from './combobox-default.story';\nexport { default as ComboboxDescriptions } from './combobox-descriptions.story';\nexport { default as ComboboxDisabled } from './combobox-disabled.story';\nexport { default as ComboboxFluid } from './combobox-fluid.story';\nexport { default as ComboboxGroups } from './combobox-groups.story';\nexport { default as ComboboxHiddenLabel } from './combobox-hidden-label.story';\nexport { default as ComboboxIcons } from './combobox-icons.story';\nexport { default as ComboboxInDialog } from './combobox-in-dialog.story';\nexport { default as ComboboxInPopover } from './combobox-in-popover.story';\nexport { default as ComboboxInPopoverDialog } from './combobox-in-popover-dialog.story';\nexport { default as ComboboxLargeDataSet } from './combobox-large-data-set.story';\nexport { default as ComboboxMaxRows } from './combobox-max-rows.story';\nexport { default as ComboboxMulti } from './combobox-multi.story';\nexport { default as ComboboxNativeForm } from './combobox-native-form.story';\nexport { default as ComboboxSelectOnly } from './combobox-select-only.story';\nexport { default as ComboboxSizes } from './combobox-sizes.story';\nexport { default as ComboboxUnlimitedRows } from './combobox-unlimited-rows.story';\nexport { default as ComboboxValidation } from './combobox-validation.story';\n\nimport { removeLicenseHeader } from '../../_common/export-stories-utils';\nimport ComboboxActionOnSelectSourceRaw from './combobox-action-on-select.story.tsx?raw';\nimport ComboboxActionsSourceRaw from './combobox-actions.story.tsx?raw';\nimport ComboboxAsyncSourceRaw from './combobox-async.story.tsx?raw';\nimport ComboboxCleanSourceRaw from './combobox-clean.story.tsx?raw';\nimport ComboboxCreatableSourceRaw from './combobox-creatable.story.tsx?raw';\nimport ComboboxCustomMultiSourceRaw from './combobox-custom-multi.story.tsx?raw';\nimport ComboboxCustomSingleSourceRaw from './combobox-custom-single.story.tsx?raw';\nimport ComboboxCustomTriggerSourceRaw from './combobox-custom-trigger.story.tsx?raw';\nimport ComboboxDefaultSourceRaw from './combobox-default.story.tsx?raw';\nimport ComboboxDescriptionsSourceRaw from './combobox-descriptions.story.tsx?raw';\nimport ComboboxDisabledSourceRaw from './combobox-disabled.story.tsx?raw';\nimport ComboboxFluidSourceRaw from './combobox-fluid.story.tsx?raw';\nimport ComboboxGroupsSourceRaw from './combobox-groups.story.tsx?raw';\nimport ComboboxHiddenLabelSourceRaw from './combobox-hidden-label.story.tsx?raw';\nimport ComboboxIconsSourceRaw from './combobox-icons.story.tsx?raw';\nimport ComboboxInDialogSourceRaw from './combobox-in-dialog.story.tsx?raw';\nimport ComboboxInPopoverSourceRaw from './combobox-in-popover.story.tsx?raw';\nimport ComboboxInPopoverDialogSourceRaw from './combobox-in-popover-dialog.story.tsx?raw';\nimport ComboboxLargeDataSetSourceRaw from './combobox-large-data-set.story.tsx?raw';\nimport ComboboxMaxRowsSourceRaw from './combobox-max-rows.story.tsx?raw';\nimport ComboboxMultiSourceRaw from './combobox-multi.story.tsx?raw';\nimport ComboboxNativeFormSourceRaw from './combobox-native-form.story.tsx?raw';\nimport ComboboxSelectOnlySourceRaw from './combobox-select-only.story.tsx?raw';\nimport ComboboxSizesSourceRaw from './combobox-sizes.story.tsx?raw';\nimport ComboboxUnlimitedRowsSourceRaw from './combobox-unlimited-rows.story.tsx?raw';\nimport ComboboxValidationSourceRaw from './combobox-validation.story.tsx?raw';\n\nexport const ComboboxActionsSource = removeLicenseHeader(\n ComboboxActionsSourceRaw,\n);\n\nexport const ComboboxAsyncSource = removeLicenseHeader(ComboboxAsyncSourceRaw);\n\nexport const ComboboxCleanSource = removeLicenseHeader(ComboboxCleanSourceRaw);\n\nexport const ComboboxActionOnSelectSource = removeLicenseHeader(\n ComboboxActionOnSelectSourceRaw,\n);\n\nexport const ComboboxCreatableSource = removeLicenseHeader(\n ComboboxCreatableSourceRaw,\n);\n\nexport const ComboboxDefaultSource = removeLicenseHeader(\n ComboboxDefaultSourceRaw,\n);\n\nexport const ComboboxDescriptionsSource = removeLicenseHeader(\n ComboboxDescriptionsSourceRaw,\n);\n\nexport const ComboboxDisabledSource = removeLicenseHeader(\n ComboboxDisabledSourceRaw,\n);\n\nexport const ComboboxFluidSource = removeLicenseHeader(ComboboxFluidSourceRaw);\n\nexport const ComboboxGroupsSource = removeLicenseHeader(\n ComboboxGroupsSourceRaw,\n);\n\nexport const ComboboxHiddenLabelSource = removeLicenseHeader(\n ComboboxHiddenLabelSourceRaw,\n);\n\nexport const ComboboxIconsSource = removeLicenseHeader(ComboboxIconsSourceRaw);\n\nexport const ComboboxInDialogSource = removeLicenseHeader(\n ComboboxInDialogSourceRaw,\n);\n\nexport const ComboboxInPopoverSource = removeLicenseHeader(\n ComboboxInPopoverSourceRaw,\n);\n\nexport const ComboboxInPopoverDialogSource = removeLicenseHeader(\n ComboboxInPopoverDialogSourceRaw,\n);\n\nexport const ComboboxLargeDataSetSource = removeLicenseHeader(\n ComboboxLargeDataSetSourceRaw,\n);\n\nexport const ComboboxMaxRowsSource = removeLicenseHeader(\n ComboboxMaxRowsSourceRaw,\n);\n\nexport const ComboboxMultiSource = removeLicenseHeader(ComboboxMultiSourceRaw);\n\nexport const ComboboxNativeFormSource = removeLicenseHeader(\n ComboboxNativeFormSourceRaw,\n);\n\nexport const ComboboxSelectOnlySource = removeLicenseHeader(\n ComboboxSelectOnlySourceRaw,\n);\n\nexport const ComboboxSizesSource = removeLicenseHeader(ComboboxSizesSourceRaw);\n\nexport const ComboboxUnlimitedRowsSource = removeLicenseHeader(\n ComboboxUnlimitedRowsSourceRaw,\n);\n\nexport const ComboboxCustomTriggerSource = removeLicenseHeader(\n ComboboxCustomTriggerSourceRaw,\n);\n\nexport const ComboboxCustomMultiSource = removeLicenseHeader(\n ComboboxCustomMultiSourceRaw,\n);\n\nexport const ComboboxCustomSingleSource = removeLicenseHeader(\n ComboboxCustomSingleSourceRaw,\n);\n\nexport const ComboboxValidationSource = removeLicenseHeader(\n ComboboxValidationSourceRaw,\n);\n"]}
@@ -0,0 +1,166 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { useLayoutEffect, useRef, useState } from 'react';
22
+ /**
23
+ * The text of the overflow counter tag. Whole thousands round to a `K` suffix
24
+ * - `1500` becomes `2K` - so the counter keeps a bounded width no matter how
25
+ * large the selection grows.
26
+ */
27
+ export const formatOverflowCount = (count) => count < 1000 ? `${count}` : `${Math.round(count / 1000)}K`;
28
+ /**
29
+ * Every text the counter could show at its widest for a selection of `total`
30
+ * options. K formatting makes the width non-monotonic - "+999" is wider than
31
+ * "+1K" - so the reserve has to measure both the widest sub-thousand text and
32
+ * the full count rather than the full count alone.
33
+ */
34
+ export const getOverflowCounterMeasureTexts = (total) => Array.from(new Set([
35
+ formatOverflowCount(Math.min(total, 999)),
36
+ formatOverflowCount(total),
37
+ ]));
38
+ /**
39
+ * How many tags fit within `maxRows` rows of the value container, mirroring
40
+ * the greedy line breaking of `flex-wrap`. When they all fit, the count is the
41
+ * number of tags and no counter is needed; otherwise the result leaves room
42
+ * for the counter tag on the last permitted row.
43
+ */
44
+ export const computeVisibleTagCount = ({ tagWidths, counterWidth, containerWidth, gap, maxRows, }) => {
45
+ // An unmeasurable container - hidden, or not laid out yet - must not
46
+ // collapse the whole selection into a counter.
47
+ if (containerWidth <= 0) {
48
+ return tagWidths.length;
49
+ }
50
+ const rowLimit = Math.max(1, Math.floor(maxRows));
51
+ const boundedCounterWidth = Math.min(counterWidth, containerWidth);
52
+ // With more than one tag a counter may be needed, so the stylesheet caps
53
+ // every tag at the container width minus room for the counter, and the
54
+ // simulation must clamp with the same cap to match the rendered widths.
55
+ // Extremely narrow containers where the cap would leave no room for a tag
56
+ // fall back to capping at the container width alone.
57
+ const counterReservedCap = containerWidth - gap - boundedCounterWidth;
58
+ const tagCap = tagWidths.length > 1 && counterReservedCap > 0
59
+ ? counterReservedCap
60
+ : containerWidth;
61
+ const widths = tagWidths.map((width) => Math.min(width, tagCap));
62
+ // Row and remaining row width after each prefix of tags, so every candidate
63
+ // cutoff can be checked without resimulating.
64
+ const placements = [];
65
+ let row = 1;
66
+ let rowWidth = 0;
67
+ widths.forEach((width, index) => {
68
+ if (index === 0) {
69
+ rowWidth = width;
70
+ }
71
+ else if (rowWidth + gap + width <= containerWidth) {
72
+ rowWidth += gap + width;
73
+ }
74
+ else {
75
+ row += 1;
76
+ rowWidth = width;
77
+ }
78
+ placements.push({ row, rowWidth });
79
+ });
80
+ if (row <= rowLimit) {
81
+ return widths.length;
82
+ }
83
+ for (let count = widths.length - 1; count >= 1; count -= 1) {
84
+ const placement = placements[count - 1];
85
+ const counterRow = placement.rowWidth + gap + boundedCounterWidth <= containerWidth
86
+ ? placement.row
87
+ : placement.row + 1;
88
+ if (counterRow <= rowLimit) {
89
+ return count;
90
+ }
91
+ }
92
+ // Not even one tag leaves room for the counter, so the counter stands alone.
93
+ return 0;
94
+ };
95
+ /**
96
+ * Caps the rows of selected tags in a multi select control. All tags stay
97
+ * rendered; the ones past `visibleCount` are taken out of the layout by the
98
+ * stylesheet but stay measurable, so the computation is stable across passes.
99
+ * Width comes from a `ResizeObserver` on the value container, and everything
100
+ * else from `measureKey`.
101
+ */
102
+ export const useComboboxMultiValueOverflow = ({ maxRows, tagCount, measureKey, }) => {
103
+ const containerRef = useRef(null);
104
+ // null shows every tag, which is also the server-rendered state.
105
+ const [visibleCount, setVisibleCount] = useState(null);
106
+ const isLimited = maxRows !== undefined && tagCount > 0;
107
+ const measure = () => {
108
+ const container = containerRef.current;
109
+ if (maxRows === undefined || container === null) {
110
+ setVisibleCount(null);
111
+ return;
112
+ }
113
+ const tags = Array.from(container.querySelectorAll(':scope > .ndl-combobox-multi-value'));
114
+ // With K formatting the widest counter is not always the one for the full
115
+ // count - "+999" is wider than "+1K" - so every candidate is rendered as a
116
+ // measure tag and the widest one sets the reserve.
117
+ const counters = Array.from(container.querySelectorAll(':scope > .ndl-combobox-multi-value-measure'));
118
+ if (tags.length === 0 || counters.length === 0) {
119
+ setVisibleCount(null);
120
+ return;
121
+ }
122
+ const counterWidth = Math.max(...counters.map((counter) => counter.getBoundingClientRect().width));
123
+ const gap = Number.parseFloat(window.getComputedStyle(container).columnGap) || 0;
124
+ // The stylesheet caps every tag at the container width minus this reserve,
125
+ // so a tag too wide to sit next to the counter shrinks instead of
126
+ // collapsing. Set before the tag rects are read, so the forced layout
127
+ // below applies it and the widths reflect the cap. Rounded up plus one
128
+ // pixel of slack, so subpixel layout quantization can never make a capped
129
+ // tag plus the counter overflow the row.
130
+ container.style.setProperty('--ndl-combobox-counter-reserve', `${Math.ceil(gap + counterWidth) + 1}px`);
131
+ // Fractional widths, so rounding never claims room the browser would wrap.
132
+ const nextVisibleCount = computeVisibleTagCount({
133
+ containerWidth: container.getBoundingClientRect().width,
134
+ counterWidth,
135
+ gap,
136
+ maxRows,
137
+ tagWidths: tags.map((tag) => tag.getBoundingClientRect().width),
138
+ });
139
+ setVisibleCount(nextVisibleCount >= tags.length ? null : nextVisibleCount);
140
+ };
141
+ const measureRef = useRef(measure);
142
+ useLayoutEffect(() => {
143
+ measureRef.current = measure;
144
+ measure();
145
+ // measure() reads the DOM, so it depends on everything the key encodes
146
+ // rather than on reactive values of its own.
147
+ // eslint-disable-next-line react-hooks/exhaustive-deps
148
+ }, [isLimited, maxRows, tagCount, measureKey]);
149
+ useLayoutEffect(() => {
150
+ const container = containerRef.current;
151
+ if (!isLimited || container === null) {
152
+ return;
153
+ }
154
+ // Hiding tags only changes the container height, and the recomputation is
155
+ // idempotent, so the observer settles after a single extra pass.
156
+ const observer = new ResizeObserver(() => {
157
+ measureRef.current();
158
+ });
159
+ observer.observe(container);
160
+ return () => {
161
+ observer.disconnect();
162
+ };
163
+ }, [isLimited]);
164
+ return { containerRef, visibleCount };
165
+ };
166
+ //# sourceMappingURL=use-combobox-multi-value-overflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-combobox-multi-value-overflow.js","sourceRoot":"","sources":["../../../src/combobox/use-combobox-multi-value-overflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE,CAC3D,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,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YAAY,EAAE,YAAY,EAAE,CAAC;AACxC,CAAC,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 { useLayoutEffect, useRef, useState } from 'react';\n\n/**\n * The text of the overflow counter tag. Whole thousands round to a `K` suffix\n * - `1500` becomes `2K` - so the counter keeps a bounded width no matter how\n * large the selection grows.\n */\nexport const formatOverflowCount = (count: number): string =>\n count < 1000 ? `${count}` : `${Math.round(count / 1000)}K`;\n\n/**\n * Every text the counter could show at its widest for a selection of `total`\n * options. K formatting makes the width non-monotonic - \"+999\" is wider than\n * \"+1K\" - so the reserve has to measure both the widest sub-thousand text and\n * the full count rather than the full count alone.\n */\nexport const getOverflowCounterMeasureTexts = (total: number): string[] =>\n Array.from(\n new Set([\n formatOverflowCount(Math.min(total, 999)),\n formatOverflowCount(total),\n ]),\n );\n\ntype ComboboxOverflowMeasurements = {\n /** Widths of every selected tag, in selection order. */\n tagWidths: number[];\n /** Width of the widest counter tag the current selection could need. */\n counterWidth: number;\n /** Content width of the wrapping value container. */\n containerWidth: number;\n /** Column gap between tags. */\n gap: number;\n /** Maximum number of rows the tags may wrap into. */\n maxRows: number;\n};\n\n/**\n * How many tags fit within `maxRows` rows of the value container, mirroring\n * the greedy line breaking of `flex-wrap`. When they all fit, the count is the\n * number of tags and no counter is needed; otherwise the result leaves room\n * for the counter tag on the last permitted row.\n */\nexport const computeVisibleTagCount = ({\n tagWidths,\n counterWidth,\n containerWidth,\n gap,\n maxRows,\n}: ComboboxOverflowMeasurements): number => {\n // An unmeasurable container - hidden, or not laid out yet - must not\n // collapse the whole selection into a counter.\n if (containerWidth <= 0) {\n return tagWidths.length;\n }\n\n const rowLimit = Math.max(1, Math.floor(maxRows));\n const boundedCounterWidth = Math.min(counterWidth, containerWidth);\n // With more than one tag a counter may be needed, so the stylesheet caps\n // every tag at the container width minus room for the counter, and the\n // simulation must clamp with the same cap to match the rendered widths.\n // Extremely narrow containers where the cap would leave no room for a tag\n // fall back to capping at the container width alone.\n const counterReservedCap = containerWidth - gap - boundedCounterWidth;\n const tagCap =\n tagWidths.length > 1 && counterReservedCap > 0\n ? counterReservedCap\n : containerWidth;\n const widths = tagWidths.map((width) => Math.min(width, tagCap));\n // Row and remaining row width after each prefix of tags, so every candidate\n // cutoff can be checked without resimulating.\n const placements: { row: number; rowWidth: number }[] = [];\n let row = 1;\n let rowWidth = 0;\n\n widths.forEach((width, index) => {\n if (index === 0) {\n rowWidth = width;\n } else if (rowWidth + gap + width <= containerWidth) {\n rowWidth += gap + width;\n } else {\n row += 1;\n rowWidth = width;\n }\n\n placements.push({ row, rowWidth });\n });\n\n if (row <= rowLimit) {\n return widths.length;\n }\n\n for (let count = widths.length - 1; count >= 1; count -= 1) {\n const placement = placements[count - 1];\n const counterRow =\n placement.rowWidth + gap + boundedCounterWidth <= containerWidth\n ? placement.row\n : placement.row + 1;\n\n if (counterRow <= rowLimit) {\n return count;\n }\n }\n\n // Not even one tag leaves room for the counter, so the counter stands alone.\n return 0;\n};\n\ntype UseComboboxMultiValueOverflowOptions = {\n /** Undefined leaves the selection unbounded and skips all measuring. */\n maxRows: number | undefined;\n /** Number of selected options rendered as tags. */\n tagCount: number;\n /**\n * Anything that changes tag widths without changing the container size, such\n * as the selection itself or the control size, so those changes re-measure.\n */\n measureKey: string;\n};\n\n/**\n * Caps the rows of selected tags in a multi select control. All tags stay\n * rendered; the ones past `visibleCount` are taken out of the layout by the\n * stylesheet but stay measurable, so the computation is stable across passes.\n * Width comes from a `ResizeObserver` on the value container, and everything\n * else from `measureKey`.\n */\nexport const useComboboxMultiValueOverflow = ({\n maxRows,\n tagCount,\n measureKey,\n}: UseComboboxMultiValueOverflowOptions) => {\n const containerRef = useRef<HTMLDivElement | null>(null);\n // null shows every tag, which is also the server-rendered state.\n const [visibleCount, setVisibleCount] = useState<number | null>(null);\n const isLimited = maxRows !== undefined && tagCount > 0;\n\n const measure = () => {\n const container = containerRef.current;\n\n if (maxRows === undefined || container === null) {\n setVisibleCount(null);\n return;\n }\n\n const tags = Array.from(\n container.querySelectorAll<HTMLElement>(\n ':scope > .ndl-combobox-multi-value',\n ),\n );\n // With K formatting the widest counter is not always the one for the full\n // count - \"+999\" is wider than \"+1K\" - so every candidate is rendered as a\n // measure tag and the widest one sets the reserve.\n const counters = Array.from(\n container.querySelectorAll<HTMLElement>(\n ':scope > .ndl-combobox-multi-value-measure',\n ),\n );\n\n if (tags.length === 0 || counters.length === 0) {\n setVisibleCount(null);\n return;\n }\n\n const counterWidth = Math.max(\n ...counters.map((counter) => counter.getBoundingClientRect().width),\n );\n const gap =\n Number.parseFloat(window.getComputedStyle(container).columnGap) || 0;\n\n // The stylesheet caps every tag at the container width minus this reserve,\n // so a tag too wide to sit next to the counter shrinks instead of\n // collapsing. Set before the tag rects are read, so the forced layout\n // below applies it and the widths reflect the cap. Rounded up plus one\n // pixel of slack, so subpixel layout quantization can never make a capped\n // tag plus the counter overflow the row.\n container.style.setProperty(\n '--ndl-combobox-counter-reserve',\n `${Math.ceil(gap + counterWidth) + 1}px`,\n );\n\n // Fractional widths, so rounding never claims room the browser would wrap.\n const nextVisibleCount = computeVisibleTagCount({\n containerWidth: container.getBoundingClientRect().width,\n counterWidth,\n gap,\n maxRows,\n tagWidths: tags.map((tag) => tag.getBoundingClientRect().width),\n });\n\n setVisibleCount(nextVisibleCount >= tags.length ? null : nextVisibleCount);\n };\n\n const measureRef = useRef(measure);\n\n useLayoutEffect(() => {\n measureRef.current = measure;\n measure();\n // measure() reads the DOM, so it depends on everything the key encodes\n // rather than on reactive values of its own.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isLimited, maxRows, tagCount, measureKey]);\n\n useLayoutEffect(() => {\n const container = containerRef.current;\n\n if (!isLimited || container === null) {\n return;\n }\n\n // Hiding tags only changes the container height, and the recomputation is\n // idempotent, so the observer settles after a single extra pass.\n const observer = new ResizeObserver(() => {\n measureRef.current();\n });\n\n observer.observe(container);\n return () => {\n observer.disconnect();\n };\n }, [isLimited]);\n\n return { containerRef, visibleCount };\n};\n"]}
@@ -0,0 +1,77 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import { autoUpdate, flip, offset, shift, size as sizeMiddleware, useClick, useDismiss, useFloating, useInteractions, } from '@floating-ui/react';
22
+ import { useIsInsideDialog } from '../dialog/dialog-context';
23
+ /**
24
+ * Anchors the combobox panel to the control. Deliberately does not use
25
+ * `useRole`, since the ARIA lives on the trigger button rather than on the
26
+ * reference element, and the composition differs between the searchable and
27
+ * select-only patterns.
28
+ */
29
+ export function useComboboxPopover({ isOpen, onOpenChange, isDisabled, isPortaled: isPortaledProp, floatingStrategy, }) {
30
+ const isInsideDialog = useIsInsideDialog();
31
+ const isPortaled = isPortaledProp !== null && isPortaledProp !== void 0 ? isPortaledProp : !isInsideDialog;
32
+ // Inside a Dialog the panel is fixed and not portaled. A transformed
33
+ // ancestor can make Floating UI under-measure available space, so use the
34
+ // viewport as the boundary instead.
35
+ const floatingBoundary = isInsideDialog ? [] : 'clippingAncestors';
36
+ const { refs, floatingStyles, context } = useFloating({
37
+ middleware: [
38
+ offset(4),
39
+ flip({ fallbackPlacements: ['top-start'], padding: 5 }),
40
+ shift({ boundary: floatingBoundary, padding: 5 }),
41
+ sizeMiddleware({
42
+ apply({ availableHeight, elements, rects }) {
43
+ // The reference width is a floor the stylesheet combines with its own,
44
+ // so a narrow trigger still gets a readable panel.
45
+ elements.floating.style.setProperty('--ndl-combobox-reference-width', `${rects.reference.width}px`);
46
+ Object.assign(elements.floating.style, {
47
+ maxHeight: `${availableHeight}px`,
48
+ });
49
+ },
50
+ boundary: floatingBoundary,
51
+ padding: 5,
52
+ }),
53
+ ],
54
+ onOpenChange: (open) => {
55
+ onOpenChange(open);
56
+ },
57
+ open: !isDisabled && isOpen,
58
+ placement: 'bottom-start',
59
+ strategy: floatingStrategy !== null && floatingStrategy !== void 0 ? floatingStrategy : (isInsideDialog ? 'fixed' : 'absolute'),
60
+ whileElementsMounted: autoUpdate,
61
+ });
62
+ const click = useClick(context, { enabled: !isDisabled });
63
+ const dismiss = useDismiss(context);
64
+ const { getReferenceProps, getFloatingProps } = useInteractions([
65
+ click,
66
+ dismiss,
67
+ ]);
68
+ return {
69
+ context,
70
+ floatingStyles,
71
+ getFloatingProps,
72
+ getReferenceProps,
73
+ isPortaled,
74
+ refs,
75
+ };
76
+ }
77
+ //# sourceMappingURL=use-combobox-popover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-combobox-popover.js","sourceRoot":"","sources":["../../../src/combobox/use-combobox-popover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,UAAU,EAEV,IAAI,EACJ,MAAM,EACN,KAAK,EACL,IAAI,IAAI,cAAc,EACtB,QAAQ,EACR,UAA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D,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;YACrB,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;QACD,IAAI,EAAE,CAAC,UAAU,IAAI,MAAM;QAC3B,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;QACrE,oBAAoB,EAAE,UAAU;KACjC,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,eAAe,CAAC;QAC9D,KAAK;QACL,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,OAAO;QACP,cAAc;QACd,gBAAgB;QAChB,iBAAiB;QACjB,UAAU;QACV,IAAI;KACL,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 type Boundary,\n flip,\n offset,\n shift,\n size as sizeMiddleware,\n useClick,\n useDismiss,\n useFloating,\n useInteractions,\n} from '@floating-ui/react';\n\nimport { useIsInsideDialog } from '../dialog/dialog-context';\n\ntype UseComboboxPopoverOptions = {\n isOpen: boolean;\n onOpenChange: (isOpen: boolean) => void;\n isDisabled: boolean;\n isPortaled?: boolean;\n floatingStrategy?: 'absolute' | 'fixed';\n};\n\n/**\n * Anchors the combobox panel to the control. Deliberately does not use\n * `useRole`, since the ARIA lives on the trigger button rather than on the\n * reference element, and the composition differs between the searchable and\n * select-only patterns.\n */\nexport function useComboboxPopover({\n isOpen,\n onOpenChange,\n isDisabled,\n isPortaled: isPortaledProp,\n floatingStrategy,\n}: UseComboboxPopoverOptions) {\n const isInsideDialog = useIsInsideDialog();\n const isPortaled = isPortaledProp ?? !isInsideDialog;\n // Inside a Dialog the panel is fixed and not portaled. A transformed\n // ancestor can make Floating UI under-measure available space, so use the\n // viewport as the boundary instead.\n const floatingBoundary: Boundary = isInsideDialog ? [] : 'clippingAncestors';\n\n const { refs, floatingStyles, context } = useFloating({\n middleware: [\n offset(4),\n flip({ fallbackPlacements: ['top-start'], padding: 5 }),\n shift({ boundary: floatingBoundary, padding: 5 }),\n sizeMiddleware({\n apply({ availableHeight, elements, rects }) {\n // The reference width is a floor the stylesheet combines with its own,\n // so a narrow trigger still gets a readable panel.\n elements.floating.style.setProperty(\n '--ndl-combobox-reference-width',\n `${rects.reference.width}px`,\n );\n Object.assign(elements.floating.style, {\n maxHeight: `${availableHeight}px`,\n });\n },\n boundary: floatingBoundary,\n padding: 5,\n }),\n ],\n onOpenChange: (open) => {\n onOpenChange(open);\n },\n open: !isDisabled && isOpen,\n placement: 'bottom-start',\n strategy: floatingStrategy ?? (isInsideDialog ? 'fixed' : 'absolute'),\n whileElementsMounted: autoUpdate,\n });\n\n const click = useClick(context, { enabled: !isDisabled });\n const dismiss = useDismiss(context);\n const { getReferenceProps, getFloatingProps } = useInteractions([\n click,\n dismiss,\n ]);\n\n return {\n context,\n floatingStyles,\n getFloatingProps,\n getReferenceProps,\n isPortaled,\n refs,\n };\n}\n"]}