@box-kite/react 0.0.1 → 2.0.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 (280) hide show
  1. package/.claude/rules/box-kite-rules.md +65 -0
  2. package/.claude/skills/box-kite/SKILL.md +138 -0
  3. package/.claude/skills/box-kite/references/components.md +235 -0
  4. package/.claude/skills/box-kite/references/extending.md +42 -0
  5. package/.claude/skills/box-kite/references/patterns.md +27 -0
  6. package/.claude/skills/box-kite/references/styling.md +222 -0
  7. package/.cursor/rules/box-kite.mdc +73 -0
  8. package/AGENTS.md +102 -0
  9. package/BOX_AI_CONTEXT.md +2804 -0
  10. package/BOX_KITE_AI_CONTEXT.md +2804 -0
  11. package/LICENSE +21 -0
  12. package/README.md +744 -7
  13. package/a11y.cjs +1 -0
  14. package/a11y.d.ts +15 -0
  15. package/a11y.mjs +4 -0
  16. package/anchor.cjs +1 -0
  17. package/anchor.d.ts +14 -0
  18. package/anchor.mjs +3 -0
  19. package/behavior.cjs +1 -0
  20. package/behavior.mjs +277 -0
  21. package/box.cjs +1 -0
  22. package/box.d.ts +46 -0
  23. package/box.mjs +23 -0
  24. package/client.cjs +1 -0
  25. package/client.mjs +164 -0
  26. package/components/accordion.cjs +1 -0
  27. package/components/accordion.d.ts +114 -0
  28. package/components/accordion.mjs +251 -0
  29. package/components/baseSvg.cjs +1 -0
  30. package/components/baseSvg.d.ts +5 -0
  31. package/components/baseSvg.mjs +21 -0
  32. package/components/button.cjs +1 -0
  33. package/components/button.d.ts +19 -0
  34. package/components/button.mjs +19 -0
  35. package/components/chart.cjs +1 -0
  36. package/components/chart.d.ts +83 -0
  37. package/components/chart.mjs +236 -0
  38. package/components/checkbox.cjs +1 -0
  39. package/components/checkbox.d.ts +36 -0
  40. package/components/checkbox.mjs +38 -0
  41. package/components/combobox/comboboxChips.d.ts +21 -0
  42. package/components/combobox/comboboxListbox.d.ts +47 -0
  43. package/components/combobox.cjs +1 -0
  44. package/components/combobox.d.ts +121 -0
  45. package/components/combobox.mjs +563 -0
  46. package/components/dataGrid/components/dataGridAggregateValue.d.ts +10 -0
  47. package/components/dataGrid/components/dataGridBody.d.ts +7 -0
  48. package/components/dataGrid/components/dataGridBottomBar.d.ts +6 -0
  49. package/components/dataGrid/components/dataGridCell.d.ts +16 -0
  50. package/components/dataGrid/components/dataGridCellEditor.d.ts +15 -0
  51. package/components/dataGrid/components/dataGridCellPlaceholder.d.ts +14 -0
  52. package/components/dataGrid/components/dataGridCellRowDetail.d.ts +6 -0
  53. package/components/dataGrid/components/dataGridCellRowSelection.d.ts +6 -0
  54. package/components/dataGrid/components/dataGridCellText.d.ts +6 -0
  55. package/components/dataGrid/components/dataGridCellTree.d.ts +16 -0
  56. package/components/dataGrid/components/dataGridColumnFilter.d.ts +9 -0
  57. package/components/dataGrid/components/dataGridColumnGroups.d.ts +7 -0
  58. package/components/dataGrid/components/dataGridContent.d.ts +6 -0
  59. package/components/dataGrid/components/dataGridDataSourceError.d.ts +12 -0
  60. package/components/dataGrid/components/dataGridDetailRow.d.ts +8 -0
  61. package/components/dataGrid/components/dataGridEmptyColumns.d.ts +6 -0
  62. package/components/dataGrid/components/dataGridExport.d.ts +10 -0
  63. package/components/dataGrid/components/dataGridFilterCell.d.ts +11 -0
  64. package/components/dataGrid/components/dataGridFilterRow.d.ts +6 -0
  65. package/components/dataGrid/components/dataGridFooter.d.ts +11 -0
  66. package/components/dataGrid/components/dataGridGlobalFilter.d.ts +6 -0
  67. package/components/dataGrid/components/dataGridGroupRow.d.ts +8 -0
  68. package/components/dataGrid/components/dataGridHeader.d.ts +6 -0
  69. package/components/dataGrid/components/dataGridHeaderCell.d.ts +9 -0
  70. package/components/dataGrid/components/dataGridHeaderCellContextMenu.d.ts +11 -0
  71. package/components/dataGrid/components/dataGridHeaderCellResizer.d.ts +14 -0
  72. package/components/dataGrid/components/dataGridLoader.d.ts +11 -0
  73. package/components/dataGrid/components/dataGridPagination.d.ts +6 -0
  74. package/components/dataGrid/components/dataGridRow.d.ts +8 -0
  75. package/components/dataGrid/components/dataGridTopBar.d.ts +6 -0
  76. package/components/dataGrid/components/dataGridTopBarContextMenu.d.ts +6 -0
  77. package/components/dataGrid/contracts/dataGridContract.d.ts +671 -0
  78. package/components/dataGrid/export/gridExport.d.ts +10 -0
  79. package/components/dataGrid/gridNavigationContext.d.ts +32 -0
  80. package/components/dataGrid/models/aggregateCellModel.d.ts +34 -0
  81. package/components/dataGrid/models/aggregationModel.d.ts +32 -0
  82. package/components/dataGrid/models/cellKeys.d.ts +11 -0
  83. package/components/dataGrid/models/cellModel.d.ts +44 -0
  84. package/components/dataGrid/models/columnModel.d.ts +160 -0
  85. package/components/dataGrid/models/columnVisibilityModel.d.ts +24 -0
  86. package/components/dataGrid/models/dataSourceModel.d.ts +177 -0
  87. package/components/dataGrid/models/detailRowModel.d.ts +22 -0
  88. package/components/dataGrid/models/editModel.d.ts +77 -0
  89. package/components/dataGrid/models/exportModel.d.ts +51 -0
  90. package/components/dataGrid/models/filterModel.d.ts +22 -0
  91. package/components/dataGrid/models/gridModel.d.ts +293 -0
  92. package/components/dataGrid/models/groupRowCellModel.d.ts +34 -0
  93. package/components/dataGrid/models/groupRowModel.d.ts +68 -0
  94. package/components/dataGrid/models/headerCellModel.d.ts +83 -0
  95. package/components/dataGrid/models/paginationModel.d.ts +32 -0
  96. package/components/dataGrid/models/rowModel.d.ts +46 -0
  97. package/components/dataGrid/models/sourceGroupRowModel.d.ts +45 -0
  98. package/components/dataGrid/models/sourceLevel.d.ts +71 -0
  99. package/components/dataGrid/models/sourceRowModel.d.ts +29 -0
  100. package/components/dataGrid/models/sourceTreeRowModel.d.ts +23 -0
  101. package/components/dataGrid/models/treeModel.d.ts +94 -0
  102. package/components/dataGrid/models/treeRow.d.ts +22 -0
  103. package/components/dataGrid/models/treeRowModel.d.ts +50 -0
  104. package/components/dataGrid/models/viewportModel.d.ts +44 -0
  105. package/components/dataGrid/useGrid.d.ts +8 -0
  106. package/components/dataGrid/useGridNavigation.d.ts +21 -0
  107. package/components/dataGrid.cjs +1 -0
  108. package/components/dataGrid.d.ts +4 -0
  109. package/components/dataGrid.mjs +4907 -0
  110. package/components/dialog.cjs +1 -0
  111. package/components/dialog.d.ts +151 -0
  112. package/components/dialog.mjs +223 -0
  113. package/components/dropdown/dropdownContext.d.ts +44 -0
  114. package/components/dropdown/dropdownItems.d.ts +22 -0
  115. package/components/dropdown/dropdownRowRenderer.d.ts +8 -0
  116. package/components/dropdown/dropdownSearch.d.ts +21 -0
  117. package/components/dropdown/utils.d.ts +1 -0
  118. package/components/dropdown.cjs +1 -0
  119. package/components/dropdown.d.ts +77 -0
  120. package/components/dropdown.mjs +491 -0
  121. package/components/flex.cjs +1 -0
  122. package/components/flex.d.ts +6 -0
  123. package/components/flex.mjs +16 -0
  124. package/components/form.cjs +1 -0
  125. package/components/form.d.ts +10 -0
  126. package/components/form.mjs +58 -0
  127. package/components/grid.cjs +1 -0
  128. package/components/grid.d.ts +6 -0
  129. package/components/grid.mjs +16 -0
  130. package/components/icon.cjs +1 -0
  131. package/components/icon.d.ts +37 -0
  132. package/components/icon.mjs +41 -0
  133. package/components/menu.cjs +1 -0
  134. package/components/menu.d.ts +234 -0
  135. package/components/menu.mjs +422 -0
  136. package/components/overlay.cjs +1 -0
  137. package/components/overlay.d.ts +47 -0
  138. package/components/overlay.mjs +52 -0
  139. package/components/popover.cjs +1 -0
  140. package/components/popover.d.ts +100 -0
  141. package/components/popover.mjs +69 -0
  142. package/components/presence.cjs +1 -0
  143. package/components/presence.d.ts +36 -0
  144. package/components/presence.mjs +11 -0
  145. package/components/progress.cjs +1 -0
  146. package/components/progress.d.ts +47 -0
  147. package/components/progress.mjs +28 -0
  148. package/components/radioButton.cjs +1 -0
  149. package/components/radioButton.d.ts +32 -0
  150. package/components/radioButton.mjs +32 -0
  151. package/components/radioGroup.cjs +1 -0
  152. package/components/radioGroup.d.ts +51 -0
  153. package/components/radioGroup.mjs +83 -0
  154. package/components/select.cjs +1 -0
  155. package/components/select.d.ts +51 -0
  156. package/components/select.mjs +36 -0
  157. package/components/semantics.cjs +1 -0
  158. package/components/semantics.d.ts +39 -0
  159. package/components/semantics.mjs +17 -0
  160. package/components/slider.cjs +1 -0
  161. package/components/slider.d.ts +98 -0
  162. package/components/slider.mjs +250 -0
  163. package/components/svg.cjs +1 -0
  164. package/components/svg.d.ts +65 -0
  165. package/components/svg.mjs +141 -0
  166. package/components/switch.cjs +1 -0
  167. package/components/switch.d.ts +29 -0
  168. package/components/switch.mjs +25 -0
  169. package/components/tabs.cjs +1 -0
  170. package/components/tabs.d.ts +87 -0
  171. package/components/tabs.mjs +324 -0
  172. package/components/textarea.cjs +1 -0
  173. package/components/textarea.d.ts +41 -0
  174. package/components/textarea.mjs +33 -0
  175. package/components/textbox.cjs +1 -0
  176. package/components/textbox.d.ts +38 -0
  177. package/components/textbox.mjs +33 -0
  178. package/components/toaster.cjs +1 -0
  179. package/components/toaster.d.ts +106 -0
  180. package/components/toaster.mjs +295 -0
  181. package/components/tooltip.cjs +1 -0
  182. package/components/tooltip.d.ts +98 -0
  183. package/components/tooltip.mjs +110 -0
  184. package/components/visuallyHidden.cjs +1 -0
  185. package/components/visuallyHidden.d.ts +6 -0
  186. package/components/visuallyHidden.mjs +23 -0
  187. package/docs/a11y.md +199 -0
  188. package/docs/anchor.md +139 -0
  189. package/docs/components.md +48 -0
  190. package/docs/index.md +11 -0
  191. package/docs/props.md +1777 -0
  192. package/effects.cjs +1 -0
  193. package/effects.mjs +6 -0
  194. package/forms.cjs +1 -0
  195. package/forms.mjs +21 -0
  196. package/gridExport.cjs +2 -0
  197. package/gridExport.mjs +244 -0
  198. package/icons/dotsIcon.d.ts +2 -0
  199. package/icons/expandIcon.d.ts +2 -0
  200. package/icons/groupingIcon.d.ts +2 -0
  201. package/icons/pinIcon.d.ts +2 -0
  202. package/icons/searchIcon.d.ts +2 -0
  203. package/icons/sortIcon.d.ts +2 -0
  204. package/identity.cjs +1 -0
  205. package/identity.mjs +12 -0
  206. package/keyboard.cjs +1 -0
  207. package/keyboard.mjs +30 -0
  208. package/layer.cjs +1 -0
  209. package/layer.mjs +127 -0
  210. package/motion.cjs +1 -0
  211. package/motion.mjs +66 -0
  212. package/package.json +327 -7
  213. package/placement.cjs +1 -0
  214. package/placement.mjs +180 -0
  215. package/platform.cjs +1 -0
  216. package/platform.mjs +45 -0
  217. package/react/a11y/callbacks.d.ts +12 -0
  218. package/react/a11y/useControllableState.d.ts +25 -0
  219. package/react/a11y/useDismiss.d.ts +25 -0
  220. package/react/a11y/useFocusReturn.d.ts +18 -0
  221. package/react/a11y/useRovingFocus.d.ts +84 -0
  222. package/react/anchor/useAnchorPosition.d.ts +79 -0
  223. package/react/animation/usePresence.d.ts +32 -0
  224. package/react/boxClassNames.d.ts +25 -0
  225. package/react/boxProps.d.ts +49 -0
  226. package/react/boxTagProps.d.ts +7 -0
  227. package/react/clientRuntime.d.ts +11 -0
  228. package/react/dialog/useScrollLock.d.ts +12 -0
  229. package/react/effects.d.ts +10 -0
  230. package/react/forms/labelledControl.d.ts +17 -0
  231. package/react/forms/placeholderProp.d.ts +13 -0
  232. package/react/hooks/usePortalContainer.d.ts +6 -0
  233. package/react/hooks/useVirtualization.d.ts +32 -0
  234. package/react/hooks/useVisibility.d.ts +9 -0
  235. package/react/identity/useIdentifier.d.ts +17 -0
  236. package/react/popover/usePopoverLayer.d.ts +87 -0
  237. package/react/reactTypes.d.ts +10 -0
  238. package/react/resolveStyles.d.ts +18 -0
  239. package/react/styleElements.d.ts +3 -0
  240. package/react/svg/attributesInProps.d.ts +4 -0
  241. package/react/svg/svgNaming.d.ts +15 -0
  242. package/react/theme/theme.d.ts +26 -0
  243. package/react/theme/themeContext.d.ts +7 -0
  244. package/react/useStyles.d.ts +22 -0
  245. package/react-shared.cjs +1 -0
  246. package/react-shared.mjs +122 -0
  247. package/rolldown-runtime.cjs +1 -0
  248. package/rsc.cjs +1 -0
  249. package/rsc.d.ts +27 -0
  250. package/rsc.mjs +18 -0
  251. package/ssg.cjs +1 -0
  252. package/ssg.d.ts +24 -0
  253. package/ssg.mjs +25 -0
  254. package/utils/accordion/accordionUtils.d.ts +48 -0
  255. package/utils/anchor/anchorUtils.d.ts +79 -0
  256. package/utils/animation/animationUtils.d.ts +29 -0
  257. package/utils/array/arrayUtils.d.ts +15 -0
  258. package/utils/array/lazyList.d.ts +10 -0
  259. package/utils/box/boxUtils.d.ts +5 -0
  260. package/utils/chart/chartPalette.d.ts +15 -0
  261. package/utils/chart/chartUtils.d.ts +92 -0
  262. package/utils/combobox/comboboxUtils.d.ts +89 -0
  263. package/utils/dom/domUtils.d.ts +32 -0
  264. package/utils/environment/environmentUtils.d.ts +28 -0
  265. package/utils/export/csvUtils.d.ts +23 -0
  266. package/utils/export/downloadUtils.d.ts +12 -0
  267. package/utils/export/xlsxUtils.d.ts +56 -0
  268. package/utils/export/zipUtils.d.ts +26 -0
  269. package/utils/fn/fnUtils.d.ts +4 -0
  270. package/utils/form/formUtils.d.ts +8 -0
  271. package/utils/keyboard/typeaheadUtils.d.ts +31 -0
  272. package/utils/memo.d.ts +10 -0
  273. package/utils/menu/menuUtils.d.ts +25 -0
  274. package/utils/object/objectUtils.d.ts +13 -0
  275. package/utils/slider/sliderUtils.d.ts +67 -0
  276. package/utils/string/fuzzySearch.d.ts +27 -0
  277. package/utils/string/stringUtils.d.ts +4 -0
  278. package/utils/tabs/tabsUtils.d.ts +75 -0
  279. package/utils/toast/toastStore.d.ts +73 -0
  280. package/utils/virtual/virtualUtils.d.ts +47 -0
package/package.json CHANGED
@@ -1,15 +1,335 @@
1
1
  {
2
2
  "name": "@box-kite/react",
3
- "version": "0.0.1",
4
- "description": "Reserved for the boxkite project's React bindings. Not yet usable.",
5
- "license": "MIT",
6
- "author": "Maxim Procopenco",
3
+ "version": "2.0.0",
4
+ "type": "module",
5
+ "sideEffects": [
6
+ "pages/**"
7
+ ],
8
+ "main": "./box.cjs",
9
+ "module": "./box.mjs",
10
+ "types": "./box.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "react-server": {
14
+ "types": "./rsc.d.ts",
15
+ "import": "./rsc.mjs",
16
+ "require": "./rsc.cjs"
17
+ },
18
+ "types": "./box.d.ts",
19
+ "import": "./box.mjs",
20
+ "require": "./box.cjs"
21
+ },
22
+ "./rsc": {
23
+ "types": "./rsc.d.ts",
24
+ "import": "./rsc.mjs",
25
+ "require": "./rsc.cjs"
26
+ },
27
+ "./a11y": {
28
+ "types": "./a11y.d.ts",
29
+ "import": "./a11y.mjs",
30
+ "require": "./a11y.cjs"
31
+ },
32
+ "./anchor": {
33
+ "types": "./anchor.d.ts",
34
+ "import": "./anchor.mjs",
35
+ "require": "./anchor.cjs"
36
+ },
37
+ "./ssg": {
38
+ "types": "./ssg.d.ts",
39
+ "import": "./ssg.mjs",
40
+ "require": "./ssg.cjs"
41
+ },
42
+ "./components/*": {
43
+ "types": "./components/*.d.ts",
44
+ "import": "./components/*.mjs",
45
+ "require": "./components/*.cjs"
46
+ }
47
+ },
48
+ "scripts": {
49
+ "dev": "vite ./pages --config ./pages.vite.config.ts --mode dev",
50
+ "dev:vanilla": "vite ./examples/vanilla --config ./examples/vanilla/vite.config.ts",
51
+ "build:vanilla": "vite build ./examples/vanilla --config ./examples/vanilla/vite.config.ts",
52
+ "pack:local": "node scripts/packLocal.mjs",
53
+ "install:next-app": "npm run pack:local && npm --prefix examples/next-app install --no-package-lock",
54
+ "dev:next-app": "npm run install:next-app && npm --prefix examples/next-app run dev",
55
+ "build:next-app": "npm run install:next-app && npm --prefix examples/next-app run build",
56
+ "smoke:next-app": "npm --prefix examples/next-app run smoke",
57
+ "build:pages": "vite build ./pages --config ./pages.vite.config.ts --outDir ../dist-pages --mode production && npm run prerender:pages",
58
+ "prerender:pages": "node scripts/prerender-pages.mjs",
59
+ "preview": "vite preview ./pages --config ./pages.vite.config.ts --outDir ../dist-pages",
60
+ "build": "npm run build:core && vite build",
61
+ "build:core": "vite build --config vite.core.config.ts && node scripts/postbuild-core.mjs",
62
+ "postbuild": "node scripts/postbuild.mjs",
63
+ "build:bridge": "node scripts/build-bridge.mjs",
64
+ "build:dev": "npm run build:core && vite build --mode dev",
65
+ "compile": "tsc --noEmit --skipLibCheck",
66
+ "test": "vitest run",
67
+ "test:coverage": "vitest run --coverage",
68
+ "test:watch": "vitest",
69
+ "test:a11y": "vitest run a11y",
70
+ "lint": "eslint .",
71
+ "check:boundaries": "node scripts/check-core-boundary.mjs && node scripts/check-rsc-boundary.mjs",
72
+ "check:brand": "node scripts/check-brand.mjs",
73
+ "check:docs": "node scripts/check-docs-snippets.mjs",
74
+ "check:props": "node scripts/check-props-api.mjs",
75
+ "docs:props": "node scripts/check-props-api.mjs --fix",
76
+ "check:components": "node scripts/check-components-api.mjs",
77
+ "docs:components": "node scripts/check-components-api.mjs --fix",
78
+ "check:conventions": "node scripts/check-component-conventions.mjs",
79
+ "check:agents": "node scripts/check-agent-files.mjs",
80
+ "docs:agents": "node scripts/check-agent-files.mjs --fix",
81
+ "check:package": "publint dist && attw --pack dist --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error && publint dist-core && attw --pack dist-core --ignore-rules false-esm cjs-resolves-to-esm internal-resolution-error",
82
+ "size": "size-limit",
83
+ "size:published": "node dev/published-size.mjs",
84
+ "release": "node scripts/release.mjs"
85
+ },
86
+ "size-limit": [
87
+ {
88
+ "name": "Box core (main entry)",
89
+ "path": "dist/box.mjs",
90
+ "ignore": [
91
+ "react",
92
+ "react-dom"
93
+ ],
94
+ "gzip": true,
95
+ "limit": "30.40 KB"
96
+ },
97
+ {
98
+ "name": "Box in a Server Component (react-server entry)",
99
+ "path": "dist/rsc.mjs",
100
+ "ignore": [
101
+ "react",
102
+ "react-dom"
103
+ ],
104
+ "gzip": true,
105
+ "limit": "28.90 KB"
106
+ },
107
+ {
108
+ "name": "Behavior primitives (a11y entry)",
109
+ "path": "dist/a11y.mjs",
110
+ "ignore": [
111
+ "react",
112
+ "react-dom"
113
+ ],
114
+ "gzip": true,
115
+ "limit": "3.2 KB"
116
+ },
117
+ {
118
+ "name": "Anchor positioning (anchor entry)",
119
+ "path": "dist/anchor.mjs",
120
+ "ignore": [
121
+ "react",
122
+ "react-dom"
123
+ ],
124
+ "gzip": true,
125
+ "limit": "2.25 KB"
126
+ },
127
+ {
128
+ "name": "Core engine (@box-kite/core, no React)",
129
+ "path": "dist-core/core.mjs",
130
+ "gzip": true,
131
+ "limit": "28.17 KB"
132
+ },
133
+ {
134
+ "name": "Dialog",
135
+ "path": "dist/components/dialog.mjs",
136
+ "ignore": [
137
+ "react",
138
+ "react-dom"
139
+ ],
140
+ "gzip": true,
141
+ "limit": "32.55 KB"
142
+ },
143
+ {
144
+ "name": "Popover",
145
+ "path": "dist/components/popover.mjs",
146
+ "ignore": [
147
+ "react",
148
+ "react-dom"
149
+ ],
150
+ "gzip": true,
151
+ "limit": "34.02 KB"
152
+ },
153
+ {
154
+ "name": "Menu",
155
+ "path": "dist/components/menu.mjs",
156
+ "ignore": [
157
+ "react",
158
+ "react-dom"
159
+ ],
160
+ "gzip": true,
161
+ "limit": "36.27 KB"
162
+ },
163
+ {
164
+ "name": "Accordion",
165
+ "path": "dist/components/accordion.mjs",
166
+ "ignore": [
167
+ "react",
168
+ "react-dom"
169
+ ],
170
+ "gzip": true,
171
+ "limit": "31.76 KB"
172
+ },
173
+ {
174
+ "name": "Tabs",
175
+ "path": "dist/components/tabs.mjs",
176
+ "ignore": [
177
+ "react",
178
+ "react-dom"
179
+ ],
180
+ "gzip": true,
181
+ "limit": "32.96 KB"
182
+ },
183
+ {
184
+ "name": "Slider",
185
+ "path": "dist/components/slider.mjs",
186
+ "ignore": [
187
+ "react",
188
+ "react-dom"
189
+ ],
190
+ "gzip": true,
191
+ "limit": "32.12 KB"
192
+ },
193
+ {
194
+ "name": "Progress",
195
+ "path": "dist/components/progress.mjs",
196
+ "ignore": [
197
+ "react",
198
+ "react-dom"
199
+ ],
200
+ "gzip": true,
201
+ "limit": "30.28 KB"
202
+ },
203
+ {
204
+ "name": "Toaster",
205
+ "path": "dist/components/toaster.mjs",
206
+ "ignore": [
207
+ "react",
208
+ "react-dom"
209
+ ],
210
+ "gzip": true,
211
+ "limit": "33.77 KB"
212
+ },
213
+ {
214
+ "name": "Combobox",
215
+ "path": "dist/components/combobox.mjs",
216
+ "ignore": [
217
+ "react",
218
+ "react-dom"
219
+ ],
220
+ "gzip": true,
221
+ "limit": "39.54 KB"
222
+ },
223
+ {
224
+ "name": "DataGrid",
225
+ "path": "dist/components/dataGrid.mjs",
226
+ "ignore": [
227
+ "react",
228
+ "react-dom"
229
+ ],
230
+ "gzip": true,
231
+ "limit": "74.86 KB"
232
+ },
233
+ {
234
+ "name": "DataGrid export, the chunk fetched on the first press",
235
+ "path": "dist/gridExport.mjs",
236
+ "ignore": [
237
+ "react",
238
+ "react-dom"
239
+ ],
240
+ "gzip": true,
241
+ "limit": "3.8 KB"
242
+ },
243
+ {
244
+ "name": "Full library (Box + ssg + every component)",
245
+ "path": "dev/size-full.mjs",
246
+ "ignore": [
247
+ "react",
248
+ "react-dom"
249
+ ],
250
+ "gzip": true,
251
+ "limit": "96.82 KB"
252
+ }
253
+ ],
7
254
  "repository": {
8
255
  "type": "git",
9
256
  "url": "git+https://github.com/box-kite/box-kite.git"
10
257
  },
11
- "homepage": "https://github.com/box-kite/box-kite#readme",
12
- "publishConfig": {
13
- "access": "public"
258
+ "keywords": [
259
+ "box-kite",
260
+ "boxkite",
261
+ "react",
262
+ "box",
263
+ "css-in-js",
264
+ "atomic-css",
265
+ "runtime-css",
266
+ "styling",
267
+ "design-system",
268
+ "react-server-components",
269
+ "rsc",
270
+ "accessibility",
271
+ "typescript"
272
+ ],
273
+ "author": "Maxim Procopenco",
274
+ "license": "MIT",
275
+ "bugs": {
276
+ "url": "https://github.com/box-kite/box-kite/issues"
277
+ },
278
+ "homepage": "https://www.box-kite.dev",
279
+ "description": "One React component with 221 typed CSS props that generates atomic CSS at runtime — no CSS files, no build step, renders in a Server Component.",
280
+ "peerDependencies": {
281
+ "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
282
+ "react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
283
+ },
284
+ "dependencies": {
285
+ "@box-kite/core": "2.0.0",
286
+ "csstype": "^3.2.3",
287
+ "use-sync-external-store": "^1.6.0"
288
+ },
289
+ "devDependencies": {
290
+ "@arethetypeswrong/cli": "^0.18.5",
291
+ "@eslint/js": "^10.0.1",
292
+ "@iconify-json/simple-icons": "^1.2.94",
293
+ "@iconify/react": "^6.0.2",
294
+ "@size-limit/preset-small-lib": "^13.0.3",
295
+ "@svgr/core": "^8.1.0",
296
+ "@svgr/plugin-jsx": "^8.1.0",
297
+ "@testing-library/dom": "^10.4.1",
298
+ "@testing-library/jest-dom": "^7.0.0",
299
+ "@testing-library/react": "^16.3.2",
300
+ "@testing-library/user-event": "^14.6.6",
301
+ "@types/node": "^26.1.2",
302
+ "@types/prismjs": "^1.26.6",
303
+ "@types/react": "^19.2.18",
304
+ "@types/react-dom": "^19.2.4",
305
+ "@types/use-sync-external-store": "^1.5.0",
306
+ "@vitejs/plugin-react": "^6.0.5",
307
+ "@vitest/coverage-v8": "^4.1.11",
308
+ "axe-core": "^4.13.0",
309
+ "eslint": "^10.8.0",
310
+ "eslint-config-prettier": "^10.1.8",
311
+ "eslint-plugin-import-x": "^4.17.1",
312
+ "eslint-plugin-prettier": "^5.5.6",
313
+ "eslint-plugin-react-hooks": "^7.1.1",
314
+ "eslint-plugin-react-refresh": "^0.5.3",
315
+ "exceljs": "^4.4.0",
316
+ "globals": "^17.9.0",
317
+ "happy-dom": "^20.11.1",
318
+ "lucide-react": "^1.28.0",
319
+ "marked": "^18.0.11",
320
+ "prettier": "^3.9.6",
321
+ "prismjs": "^1.30.0",
322
+ "publint": "^0.3.24",
323
+ "react": "^19.2.8",
324
+ "react-dom": "^19.2.8",
325
+ "react-router-dom": "^7.18.2",
326
+ "recharts": "^3.10.1",
327
+ "size-limit": "^13.0.3",
328
+ "typescript": "^6.0.3",
329
+ "typescript-eslint": "^8.66.0",
330
+ "unplugin-icons": "^23.0.1",
331
+ "vite": "^8.2.0",
332
+ "vite-plugin-dts": "^5.0.3",
333
+ "vitest": "^4.1.10"
14
334
  }
15
335
  }
package/placement.cjs ADDED
@@ -0,0 +1 @@
1
+ const e=require("./platform.cjs"),t=require("./effects.cjs"),n=require("./identity.cjs");let r=require("react");var i={top:`bottom`,bottom:`top`,start:`end`,end:`start`};function a(e){return e===`top`||e===`bottom`}function o(e,t){let n=a(e),r=n?e===`top`?`block-start`:`block-end`:e===`start`?`inline-start`:`inline-end`,i=t===`center`?`span-all`:`span-${n?`inline`:`block`}-${t===`start`?`end`:`start`}`;return n?`${r} ${i}`:`${i} ${r}`}function s(e){let[t,n]=e.trim().split(` `);return n===void 0?t===`block-start`?`top`:t===`block-end`?`bottom`:t===`inline-start`?`start`:t===`inline-end`?`end`:null:t===`start`?`top`:t===`end`?`bottom`:n===`start`?`start`:n===`end`?`end`:null}function c(e){return a(e)?`flip-block, flip-inline, flip-block flip-inline`:`flip-inline, flip-block, flip-inline flip-block`}function l(e,t,n,r){let i=u(t,r);return i===`top`?e.top-n.top:i===`bottom`?n.top+n.height-(e.top+e.height):i===`left`?e.left-n.left:n.left+n.width-(e.left+e.width)}function u(e,t){return e===`top`||e===`bottom`?e:e===`start`===t?`right`:`left`}function d(e,t,n,r){return Math.max(n,Math.min(e,n+r-t))}function f(e,t,n,r){let{align:o,offset:s,flip:c,rtl:f}=r,p=(a(r.side)?t.height:t.width)+s,m=c&&l(e,r.side,n,f)<p&&l(e,i[r.side],n,f)>=p?i[r.side]:r.side,h=u(m,f),g={top:e.top-t.height-s,bottom:e.top+e.height+s,left:e.left-t.width-s,right:e.left+e.width+s}[h],_=a(m),v=_?e.left:e.top,y=_?e.width:e.height,b=_?t.width:t.height,x=o===`center`?v+y/2-b/2:o===`start`===(_&&f)?v+y-b:v,S=_?d(x,t.width,n.left,n.width):d(x,t.height,n.top,n.height);return _?{top:g,left:S,side:m}:{top:S,left:g,side:m}}var p=4,m=16,h={top:`mb`,bottom:`mt`,start:`me`,end:`ms`};function g(){return typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`anchor-name: --a`)}function _(){let e=typeof document>`u`?null:document.documentElement,t=e?parseFloat(getComputedStyle(e).fontSize):NaN;return Number.isFinite(t)&&t>0?t:m}function v(e){let{top:t,left:n,width:r,height:i}=e.getBoundingClientRect();return{top:t,left:n,width:r,height:i}}function y(e,t){return e!==null&&e.top===t.top&&e.left===t.left&&e.side===t.side&&e.anchorWidth===t.anchorWidth}function b(i={}){let{side:a=`bottom`,align:l=`center`,offset:u=0,flip:d=!0,matchWidth:m=!1,name:b,anchor:x,trackSide:S=!1}=i,C=n.t(`anchor`),w=`--${(b??C).replace(/^--/,``)}`,[T,E]=(0,r.useState)(!0),[D,O]=(0,r.useState)(null),[k,A]=(0,r.useState)(null),[j,M]=(0,r.useState)(null),[N,P]=(0,r.useState)(null);t.n(()=>{g()||E(!1)},[]),t.n(()=>{let t=e.c(x);if(t)return t.style.setProperty(`anchor-name`,w),()=>{t.style.removeProperty(`anchor-name`)}},[x,w]),t.n(()=>{!T||!S||!k||P(s(getComputedStyle(k).getPropertyValue(`position-area`)))},[T,S,k,a,l,d]),t.n(()=>{let t=e.c(x)??D;if(T||!t||!k)return;let n=()=>{let n=v(t),r=v(k),i={top:0,left:0,width:window.innerWidth,height:window.innerHeight},o=m?Math.max(r.width,n.width):r.width,s={...f(n,{...r,width:o},i,{side:a,align:l,offset:u/p*_(),flip:d,rtl:e.u(t)}),anchorWidth:n.width};M(e=>y(e,s)?e:s)};n();let r=new AbortController;return document.addEventListener(`scroll`,n,{signal:r.signal,capture:!0,passive:!0}),window.addEventListener(`resize`,n,{signal:r.signal,passive:!0}),()=>r.abort()},[T,x,D,k,a,l,u,d,m]);let F=(0,r.useCallback)(e=>O(e),[]),I=(0,r.useCallback)(e=>A(e),[]),L={ref:T?void 0:F,style:{anchorName:w}};return T?{css:T,side:N??a,anchorProps:L,layerProps:{...S?{ref:I}:{},position:`fixed`,positionArea:o(a,l),...d?{positionTryFallbacks:c(a)}:{},...m?{minWidth:`anchor-size(width)`}:{},...u?{[h[a]]:u}:{},style:{positionAnchor:w}}}:{css:T,side:j?.side??a,anchorProps:L,layerProps:{ref:I,position:`fixed`,style:j?{top:`${j.top}px`,left:`${j.left}px`,...m?{minWidth:`${j.anchorWidth}px`}:{}}:{top:0,left:0,visibility:`hidden`}}}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}});
package/placement.mjs ADDED
@@ -0,0 +1,180 @@
1
+ import { c as e, u as t } from "./platform.mjs";
2
+ import { n } from "./effects.mjs";
3
+ import { t as r } from "./identity.mjs";
4
+ import { useCallback as i, useState as a } from "react";
5
+ //#region src/utils/anchor/anchorUtils.ts
6
+ var o = {
7
+ top: "bottom",
8
+ bottom: "top",
9
+ start: "end",
10
+ end: "start"
11
+ };
12
+ function s(e) {
13
+ return e === "top" || e === "bottom";
14
+ }
15
+ function c(e, t) {
16
+ let n = s(e), r = n ? e === "top" ? "block-start" : "block-end" : e === "start" ? "inline-start" : "inline-end", i = t === "center" ? "span-all" : `span-${n ? "inline" : "block"}-${t === "start" ? "end" : "start"}`;
17
+ return n ? `${r} ${i}` : `${i} ${r}`;
18
+ }
19
+ function l(e) {
20
+ let [t, n] = e.trim().split(" ");
21
+ return n === void 0 ? t === "block-start" ? "top" : t === "block-end" ? "bottom" : t === "inline-start" ? "start" : t === "inline-end" ? "end" : null : t === "start" ? "top" : t === "end" ? "bottom" : n === "start" ? "start" : n === "end" ? "end" : null;
22
+ }
23
+ function u(e) {
24
+ return s(e) ? "flip-block, flip-inline, flip-block flip-inline" : "flip-inline, flip-block, flip-inline flip-block";
25
+ }
26
+ function d(e, t, n, r) {
27
+ let i = f(t, r);
28
+ return i === "top" ? e.top - n.top : i === "bottom" ? n.top + n.height - (e.top + e.height) : i === "left" ? e.left - n.left : n.left + n.width - (e.left + e.width);
29
+ }
30
+ function f(e, t) {
31
+ return e === "top" || e === "bottom" ? e : e === "start" === t ? "right" : "left";
32
+ }
33
+ function p(e, t, n, r) {
34
+ return Math.max(n, Math.min(e, n + r - t));
35
+ }
36
+ function m(e, t, n, r) {
37
+ let { align: i, offset: a, flip: c, rtl: l } = r, u = (s(r.side) ? t.height : t.width) + a, m = c && d(e, r.side, n, l) < u && d(e, o[r.side], n, l) >= u ? o[r.side] : r.side, h = f(m, l), g = {
38
+ top: e.top - t.height - a,
39
+ bottom: e.top + e.height + a,
40
+ left: e.left - t.width - a,
41
+ right: e.left + e.width + a
42
+ }[h], _ = s(m), v = _ ? e.left : e.top, y = _ ? e.width : e.height, b = _ ? t.width : t.height, x = i === "center" ? v + y / 2 - b / 2 : i === "start" === (_ && l) ? v + y - b : v, S = _ ? p(x, t.width, n.left, n.width) : p(x, t.height, n.top, n.height);
43
+ return _ ? {
44
+ top: g,
45
+ left: S,
46
+ side: m
47
+ } : {
48
+ top: S,
49
+ left: g,
50
+ side: m
51
+ };
52
+ }
53
+ //#endregion
54
+ //#region src/react/anchor/useAnchorPosition.ts
55
+ var h = 4, g = 16, _ = {
56
+ top: "mb",
57
+ bottom: "mt",
58
+ start: "me",
59
+ end: "ms"
60
+ };
61
+ function v() {
62
+ return typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --a");
63
+ }
64
+ function y() {
65
+ let e = typeof document > "u" ? null : document.documentElement, t = e ? parseFloat(getComputedStyle(e).fontSize) : NaN;
66
+ return Number.isFinite(t) && t > 0 ? t : g;
67
+ }
68
+ function b(e) {
69
+ let { top: t, left: n, width: r, height: i } = e.getBoundingClientRect();
70
+ return {
71
+ top: t,
72
+ left: n,
73
+ width: r,
74
+ height: i
75
+ };
76
+ }
77
+ function x(e, t) {
78
+ return e !== null && e.top === t.top && e.left === t.left && e.side === t.side && e.anchorWidth === t.anchorWidth;
79
+ }
80
+ function S(o = {}) {
81
+ let { side: s = "bottom", align: d = "center", offset: f = 0, flip: p = !0, matchWidth: g = !1, name: S, anchor: C, trackSide: w = !1 } = o, T = r("anchor"), E = `--${(S ?? T).replace(/^--/, "")}`, [D, O] = a(!0), [k, A] = a(null), [j, M] = a(null), [N, P] = a(null), [F, I] = a(null);
82
+ n(() => {
83
+ v() || O(!1);
84
+ }, []), n(() => {
85
+ let t = e(C);
86
+ if (t) return t.style.setProperty("anchor-name", E), () => {
87
+ t.style.removeProperty("anchor-name");
88
+ };
89
+ }, [C, E]), n(() => {
90
+ !D || !w || !j || I(l(getComputedStyle(j).getPropertyValue("position-area")));
91
+ }, [
92
+ D,
93
+ w,
94
+ j,
95
+ s,
96
+ d,
97
+ p
98
+ ]), n(() => {
99
+ let n = e(C) ?? k;
100
+ if (D || !n || !j) return;
101
+ let r = () => {
102
+ let e = b(n), r = b(j), i = {
103
+ top: 0,
104
+ left: 0,
105
+ width: window.innerWidth,
106
+ height: window.innerHeight
107
+ }, a = g ? Math.max(r.width, e.width) : r.width, o = {
108
+ ...m(e, {
109
+ ...r,
110
+ width: a
111
+ }, i, {
112
+ side: s,
113
+ align: d,
114
+ offset: f / h * y(),
115
+ flip: p,
116
+ rtl: t(n)
117
+ }),
118
+ anchorWidth: e.width
119
+ };
120
+ P((e) => x(e, o) ? e : o);
121
+ };
122
+ r();
123
+ let i = new AbortController();
124
+ return document.addEventListener("scroll", r, {
125
+ signal: i.signal,
126
+ capture: !0,
127
+ passive: !0
128
+ }), window.addEventListener("resize", r, {
129
+ signal: i.signal,
130
+ passive: !0
131
+ }), () => i.abort();
132
+ }, [
133
+ D,
134
+ C,
135
+ k,
136
+ j,
137
+ s,
138
+ d,
139
+ f,
140
+ p,
141
+ g
142
+ ]);
143
+ let L = i((e) => A(e), []), R = i((e) => M(e), []), z = {
144
+ ref: D ? void 0 : L,
145
+ style: { anchorName: E }
146
+ };
147
+ return D ? {
148
+ css: D,
149
+ side: F ?? s,
150
+ anchorProps: z,
151
+ layerProps: {
152
+ ...w ? { ref: R } : {},
153
+ position: "fixed",
154
+ positionArea: c(s, d),
155
+ ...p ? { positionTryFallbacks: u(s) } : {},
156
+ ...g ? { minWidth: "anchor-size(width)" } : {},
157
+ ...f ? { [_[s]]: f } : {},
158
+ style: { positionAnchor: E }
159
+ }
160
+ } : {
161
+ css: D,
162
+ side: N?.side ?? s,
163
+ anchorProps: z,
164
+ layerProps: {
165
+ ref: R,
166
+ position: "fixed",
167
+ style: N ? {
168
+ top: `${N.top}px`,
169
+ left: `${N.left}px`,
170
+ ...g ? { minWidth: `${N.anchorWidth}px` } : {}
171
+ } : {
172
+ top: 0,
173
+ left: 0,
174
+ visibility: "hidden"
175
+ }
176
+ }
177
+ };
178
+ }
179
+ //#endregion
180
+ export { S as t };
package/platform.cjs ADDED
@@ -0,0 +1 @@
1
+ function e(e){return e?`current`in e?e.current:e:null}function t(t){let n=e(t);return n instanceof HTMLElement?n:null}function n(t,n){let r=typeof t.composedPath==`function`?t.composedPath():[];return n.some(n=>{let i=e(n);return i?r.includes(i)||t.target instanceof Node&&i.contains(t.target):!1})}function r(t){let n=e(t),r=n?.ownerDocument?.defaultView;return!!n&&!!r&&r.getComputedStyle(n).direction===`rtl`}function i(t){let n=e(t)?.ownerDocument?.defaultView?.getSelection();n&&!n.isCollapsed&&n.removeAllRanges()}function a(){return typeof window<`u`&&window.document!==void 0}function o(){return typeof document<`u`}function s(){return o()?document:null}function c(){return s()?.documentElement??null}function l(){return typeof HTMLElement<`u`&&typeof HTMLElement.prototype.showPopover==`function`}function u(){return typeof HTMLDialogElement<`u`&&`closedBy`in HTMLDialogElement.prototype}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return r}});
package/platform.mjs ADDED
@@ -0,0 +1,45 @@
1
+ //#region src/utils/dom/domUtils.ts
2
+ function e(e) {
3
+ return e ? "current" in e ? e.current : e : null;
4
+ }
5
+ function t(t) {
6
+ let n = e(t);
7
+ return n instanceof HTMLElement ? n : null;
8
+ }
9
+ function n(t, n) {
10
+ let r = typeof t.composedPath == "function" ? t.composedPath() : [];
11
+ return n.some((n) => {
12
+ let i = e(n);
13
+ return i ? r.includes(i) || t.target instanceof Node && i.contains(t.target) : !1;
14
+ });
15
+ }
16
+ function r(t) {
17
+ let n = e(t), r = n?.ownerDocument?.defaultView;
18
+ return !!n && !!r && r.getComputedStyle(n).direction === "rtl";
19
+ }
20
+ function i(t) {
21
+ let n = e(t)?.ownerDocument?.defaultView?.getSelection();
22
+ n && !n.isCollapsed && n.removeAllRanges();
23
+ }
24
+ //#endregion
25
+ //#region src/utils/environment/environmentUtils.ts
26
+ function a() {
27
+ return typeof window < "u" && window.document !== void 0;
28
+ }
29
+ function o() {
30
+ return typeof document < "u";
31
+ }
32
+ function s() {
33
+ return o() ? document : null;
34
+ }
35
+ function c() {
36
+ return s()?.documentElement ?? null;
37
+ }
38
+ function l() {
39
+ return typeof HTMLElement < "u" && typeof HTMLElement.prototype.showPopover == "function";
40
+ }
41
+ function u() {
42
+ return typeof HTMLDialogElement < "u" && "closedBy" in HTMLDialogElement.prototype;
43
+ }
44
+ //#endregion
45
+ export { l as a, t as c, u as i, n as l, c as n, i as o, a as r, e as s, s as t, r as u };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Handler identity, which every hook here has the same problem with: a document listener must not
3
+ * be torn down and re-registered on every render, but it must still call the consumer's *current*
4
+ * handler — and consumers write handlers inline, so a new one arrives with every render.
5
+ */
6
+ /**
7
+ * The latest value, readable from an event handler that must not be re-registered when it changes. Written
8
+ * from an effect rather than during render, which costs nothing here: it is only read from an event.
9
+ */
10
+ export declare function useLatest<T>(value: T): React.RefObject<T>;
11
+ /** A callback with a stable identity that always calls the *latest* function it was given. */
12
+ export declare function useEventCallback<TArgs extends unknown[], TResult>(fn: ((...args: TArgs) => TResult) | undefined): (...args: TArgs) => TResult | undefined;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Why a change happened, and the event that caused it — the reason being the point. A component that only
3
+ * says `onOpenChange(false)` makes its consumer guess whether the popup closed because the user picked
4
+ * something, pressed Escape or clicked away, and each of those wants different behaviour from the app.
5
+ */
6
+ export interface ChangeDetails<TReason extends string = string> {
7
+ reason: TReason;
8
+ /** The DOM or React event behind the change, when there was one. */
9
+ event?: Event | React.SyntheticEvent;
10
+ }
11
+ export type ChangeHandler<T, TReason extends string = string> = (value: T, details: ChangeDetails<TReason>) => void;
12
+ export interface ControllableStateOptions<T, TReason extends string = string> {
13
+ /** Present (not `undefined`) means the consumer owns the value: state here is ignored. */
14
+ value?: T;
15
+ /** The starting value when the consumer does not own it. A function is called once, lazily. */
16
+ defaultValue: T | (() => T);
17
+ onChange?: ChangeHandler<T, TReason>;
18
+ }
19
+ export type SetControllableState<T, TReason extends string = string> = (next: T | ((current: T) => T), details: ChangeDetails<TReason>) => void;
20
+ /**
21
+ * One state value that works the same whether the consumer controls it or not. The setter is stable, and
22
+ * every call names a reason, which is what reaches `onChange`. A call resolving to the value already held
23
+ * is dropped: two dismissal layers closing the same popup is the normal case, not an error.
24
+ */
25
+ export default function useControllableState<T, TReason extends string = string>(options: ControllableStateOptions<T, TReason>): [T, SetControllableState<T, TReason>];
@@ -0,0 +1,25 @@
1
+ import { ElementLike } from '../../utils/dom/domUtils';
2
+ export type DismissReason = 'escape' | 'outside-pointer';
3
+ export type { ElementLike };
4
+ export interface DismissOptions {
5
+ /** Usually the open state: listeners exist only while this is true. */
6
+ enabled?: boolean;
7
+ onDismiss: (reason: DismissReason, event: Event) => void;
8
+ /**
9
+ * What counts as *inside*: the popup, and the trigger too — a press on the trigger of an open popup must
10
+ * reach its own toggle rather than being dismissed and reopened in one gesture.
11
+ */
12
+ inside?: ReadonlyArray<ElementLike>;
13
+ /** Default true. */
14
+ escapeKey?: boolean;
15
+ /** Default true. */
16
+ outsidePointer?: boolean;
17
+ }
18
+ /**
19
+ * Close on Escape and on a pointer press outside — the two halves of light dismiss, composable across
20
+ * nested layers: Escape reaches the innermost only, while an outside press is judged per layer, so a
21
+ * press in the page closes a menu and its submenu and a press in the menu closes just the submenu.
22
+ * `pointerdown` rather than `click`, because a press that starts inside and ends outside (a drag across a
23
+ * scrollbar, a text selection) is not a dismissal.
24
+ */
25
+ export default function useDismiss(options: DismissOptions): void;
@@ -0,0 +1,18 @@
1
+ import { ElementLike } from '../../utils/dom/domUtils';
2
+ export interface FocusReturnOptions {
3
+ /** Usually the open state. The invoker is remembered the moment this becomes true. */
4
+ enabled?: boolean;
5
+ /** Where focus should land instead of whatever had it when the layer opened. */
6
+ returnTo?: ElementLike;
7
+ /** Passed to `focus()` — keeps a long page from jumping when the invoker is off screen. */
8
+ preventScroll?: boolean;
9
+ }
10
+ /**
11
+ * Put focus back where it came from when a layer closes. Losing it to `<body>` is the commonest keyboard
12
+ * bug in a popup: the next Tab starts again at the top of the page. Skipped when something else already
13
+ * holds focus — a dialog the layer opened, or a user who tabbed away — since taking it back is the same
14
+ * bug pointing the other way.
15
+ */
16
+ export default function useFocusReturn(options?: FocusReturnOptions): {
17
+ returnFocus: () => void;
18
+ };