@itwin/core-react 4.0.0-dev.12 → 4.0.0-dev.14

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 (616) hide show
  1. package/CHANGELOG.md +116 -1
  2. package/ContributeGuidelines.md +17 -14
  3. package/README.md +2 -2
  4. package/lib/cjs/core-react/UiCore.d.ts +40 -40
  5. package/lib/cjs/core-react/UiCore.js +85 -85
  6. package/lib/cjs/core-react/UiCore.js.map +1 -1
  7. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +96 -96
  8. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  9. package/lib/cjs/core-react/autosuggest/AutoSuggest.js +174 -174
  10. package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +1 -2
  11. package/lib/cjs/core-react/badge/Badge.d.ts +18 -18
  12. package/lib/cjs/core-react/badge/Badge.js +26 -26
  13. package/lib/cjs/core-react/badge/BadgeUtilities.d.ts +12 -12
  14. package/lib/cjs/core-react/badge/BadgeUtilities.js +38 -38
  15. package/lib/cjs/core-react/badge/BetaBadge.d.ts +9 -9
  16. package/lib/cjs/core-react/badge/BetaBadge.js +22 -22
  17. package/lib/cjs/core-react/badge/NewBadge.d.ts +10 -10
  18. package/lib/cjs/core-react/badge/NewBadge.js +23 -23
  19. package/lib/cjs/core-react/base/Centered.d.ts +10 -10
  20. package/lib/cjs/core-react/base/Centered.js +20 -20
  21. package/lib/cjs/core-react/base/Div.d.ts +16 -16
  22. package/lib/cjs/core-react/base/Div.js +20 -20
  23. package/lib/cjs/core-react/base/DivWithOutsideClick.d.ts +79 -79
  24. package/lib/cjs/core-react/base/DivWithOutsideClick.js +16 -16
  25. package/lib/cjs/core-react/base/FillCentered.d.ts +10 -10
  26. package/lib/cjs/core-react/base/FillCentered.js +20 -20
  27. package/lib/cjs/core-react/base/FlexWrapContainer.d.ts +11 -11
  28. package/lib/cjs/core-react/base/FlexWrapContainer.js +21 -21
  29. package/lib/cjs/core-react/base/Gap.d.ts +15 -15
  30. package/lib/cjs/core-react/base/Gap.js +20 -20
  31. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  32. package/lib/cjs/core-react/base/PointerEvents.d.ts +7 -7
  33. package/lib/cjs/core-react/base/PointerEvents.js +17 -17
  34. package/lib/cjs/core-react/base/ScrollView.d.ts +11 -11
  35. package/lib/cjs/core-react/base/ScrollView.js +21 -21
  36. package/lib/cjs/core-react/button/UnderlinedButton.d.ts +24 -24
  37. package/lib/cjs/core-react/button/UnderlinedButton.js +35 -35
  38. package/lib/cjs/core-react/checklistbox/CheckListBox.d.ts +40 -40
  39. package/lib/cjs/core-react/checklistbox/CheckListBox.js +42 -42
  40. package/lib/cjs/core-react/checklistbox/CheckListBox.scss +0 -1
  41. package/lib/cjs/core-react/classes.scss +0 -2
  42. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +93 -93
  43. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  44. package/lib/cjs/core-react/contextmenu/ContextMenu.js +363 -364
  45. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  46. package/lib/cjs/core-react/contextmenu/ContextMenuDirection.d.ts +18 -18
  47. package/lib/cjs/core-react/contextmenu/ContextMenuDirection.js +26 -26
  48. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.d.ts +12 -12
  49. package/lib/cjs/core-react/contextmenu/ContextMenuDivider.js +23 -23
  50. package/lib/cjs/core-react/contextmenu/ContextMenuItem.d.ts +61 -61
  51. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +108 -108
  52. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  53. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +51 -51
  54. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  55. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +162 -162
  56. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  57. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts +34 -34
  58. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +61 -63
  59. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  60. package/lib/cjs/core-react/contextmenu/PopupContextMenu.d.ts +53 -53
  61. package/lib/cjs/core-react/contextmenu/PopupContextMenu.js +55 -55
  62. package/lib/cjs/core-react/contextmenu/TildeFinder.d.ts +18 -18
  63. package/lib/cjs/core-react/contextmenu/TildeFinder.js +70 -70
  64. package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
  65. package/lib/cjs/core-react/dialog/Dialog.d.ts +132 -132
  66. package/lib/cjs/core-react/dialog/Dialog.js +374 -375
  67. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  68. package/lib/cjs/core-react/dialog/GlobalDialog.d.ts +28 -28
  69. package/lib/cjs/core-react/dialog/GlobalDialog.js +52 -53
  70. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  71. package/lib/cjs/core-react/elementseparator/ElementSeparator.d.ts +41 -41
  72. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +163 -163
  73. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  74. package/lib/cjs/core-react/enums/Alignment.d.ts +22 -22
  75. package/lib/cjs/core-react/enums/Alignment.js +31 -31
  76. package/lib/cjs/core-react/enums/CheckBoxState.d.ts +20 -20
  77. package/lib/cjs/core-react/enums/CheckBoxState.js +19 -19
  78. package/lib/cjs/core-react/enums/Orientation.d.ts +11 -11
  79. package/lib/cjs/core-react/enums/Orientation.js +19 -19
  80. package/lib/cjs/core-react/enums/SortDirection.d.ts +12 -12
  81. package/lib/cjs/core-react/enums/SortDirection.js +20 -20
  82. package/lib/cjs/core-react/enums/TimeFormat.d.ts +14 -14
  83. package/lib/cjs/core-react/enums/TimeFormat.js +22 -22
  84. package/lib/cjs/core-react/expandable/ExpandableList.d.ts +37 -37
  85. package/lib/cjs/core-react/expandable/ExpandableList.js +57 -57
  86. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  87. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts +53 -53
  88. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  89. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.js +150 -150
  90. package/lib/cjs/core-react/focustrap/FocusTrap.d.ts +28 -28
  91. package/lib/cjs/core-react/focustrap/FocusTrap.js +196 -196
  92. package/lib/cjs/core-react/hocs/withIsPressed.d.ts +77 -77
  93. package/lib/cjs/core-react/hocs/withIsPressed.js +46 -46
  94. package/lib/cjs/core-react/hocs/withOnOutsideClick.d.ts +103 -103
  95. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +114 -115
  96. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  97. package/lib/cjs/core-react/hocs/withTimeout.d.ts +74 -74
  98. package/lib/cjs/core-react/hocs/withTimeout.js +46 -46
  99. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +26 -26
  100. package/lib/cjs/core-react/icons/ConditionalIconItem.js +64 -64
  101. package/lib/cjs/core-react/icons/IconComponent.d.ts +25 -25
  102. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  103. package/lib/cjs/core-react/icons/IconComponent.js +48 -48
  104. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  105. package/lib/cjs/core-react/icons/SvgPath.d.ts +23 -23
  106. package/lib/cjs/core-react/icons/SvgPath.js +27 -27
  107. package/lib/cjs/core-react/icons/WebFontIcon.d.ts +25 -25
  108. package/lib/cjs/core-react/icons/WebFontIcon.js +21 -21
  109. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.d.ts +42 -42
  110. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.js +56 -56
  111. package/lib/cjs/core-react/index.scss +0 -2
  112. package/lib/cjs/core-react/inputs/Input.d.ts +20 -20
  113. package/lib/cjs/core-react/inputs/Input.js +45 -45
  114. package/lib/cjs/core-react/inputs/InputLabel.d.ts +20 -20
  115. package/lib/cjs/core-react/inputs/InputLabel.js +41 -41
  116. package/lib/cjs/core-react/inputs/InputStatus.d.ts +11 -11
  117. package/lib/cjs/core-react/inputs/InputStatus.js +19 -19
  118. package/lib/cjs/core-react/inputs/LabeledComponentProps.d.ts +33 -33
  119. package/lib/cjs/core-react/inputs/LabeledComponentProps.js +9 -9
  120. package/lib/cjs/core-react/inputs/iconinput/IconInput.d.ts +23 -23
  121. package/lib/cjs/core-react/inputs/iconinput/IconInput.js +29 -29
  122. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +50 -50
  123. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  124. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +153 -153
  125. package/lib/cjs/core-react/listbox/Listbox.d.ts +55 -55
  126. package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
  127. package/lib/cjs/core-react/listbox/Listbox.js +221 -222
  128. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  129. package/lib/cjs/core-react/loading/LoadingBar.d.ts +29 -29
  130. package/lib/cjs/core-react/loading/LoadingBar.js +40 -40
  131. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  132. package/lib/cjs/core-react/loading/LoadingPrompt.d.ts +39 -39
  133. package/lib/cjs/core-react/loading/LoadingPrompt.js +44 -44
  134. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  135. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +32 -32
  136. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  137. package/lib/cjs/core-react/loading/LoadingSpinner.js +30 -30
  138. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  139. package/lib/cjs/core-react/loading/LoadingStatus.d.ts +24 -24
  140. package/lib/cjs/core-react/loading/LoadingStatus.js +37 -37
  141. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  142. package/lib/cjs/core-react/messagebox/MessageBox.d.ts +80 -80
  143. package/lib/cjs/core-react/messagebox/MessageBox.js +114 -114
  144. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  145. package/lib/cjs/core-react/notification/MessageRenderer.d.ts +19 -19
  146. package/lib/cjs/core-react/notification/MessageRenderer.js +81 -81
  147. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  148. package/lib/cjs/core-react/notification/MessageType.d.ts +22 -22
  149. package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
  150. package/lib/cjs/core-react/notification/MessageType.js +24 -24
  151. package/lib/cjs/core-react/popup/Popup.d.ts +111 -111
  152. package/lib/cjs/core-react/popup/Popup.js +418 -422
  153. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  154. package/lib/cjs/core-react/radialmenu/Annulus.d.ts +54 -54
  155. package/lib/cjs/core-react/radialmenu/Annulus.js +82 -82
  156. package/lib/cjs/core-react/radialmenu/RadialMenu.d.ts +97 -97
  157. package/lib/cjs/core-react/radialmenu/RadialMenu.js +179 -179
  158. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  159. package/lib/cjs/core-react/searchbox/SearchBox.d.ts +52 -52
  160. package/lib/cjs/core-react/searchbox/SearchBox.js +111 -111
  161. package/lib/cjs/core-react/searchbox/SearchBox.scss +2 -3
  162. package/lib/cjs/core-react/settings/SettingsContainer.d.ts +30 -30
  163. package/lib/cjs/core-react/settings/SettingsContainer.js +121 -121
  164. package/lib/cjs/core-react/settings/SettingsManager.d.ts +132 -132
  165. package/lib/cjs/core-react/settings/SettingsManager.js +122 -122
  166. package/lib/cjs/core-react/style/index.scss +0 -7
  167. package/lib/cjs/core-react/tabs/Tabs.d.ts +71 -71
  168. package/lib/cjs/core-react/tabs/Tabs.js +125 -125
  169. package/lib/cjs/core-react/tabs/VerticalTabs.d.ts +9 -9
  170. package/lib/cjs/core-react/tabs/VerticalTabs.js +20 -20
  171. package/lib/cjs/core-react/text/BlockText.d.ts +9 -9
  172. package/lib/cjs/core-react/text/BlockText.js +20 -20
  173. package/lib/cjs/core-react/text/BodyText.d.ts +10 -10
  174. package/lib/cjs/core-react/text/BodyText.js +21 -21
  175. package/lib/cjs/core-react/text/BodyText.js.map +1 -1
  176. package/lib/cjs/core-react/text/DisabledText.d.ts +6 -6
  177. package/lib/cjs/core-react/text/DisabledText.js +20 -20
  178. package/lib/cjs/core-react/text/FilteredText.d.ts +24 -24
  179. package/lib/cjs/core-react/text/FilteredText.js +40 -40
  180. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  181. package/lib/cjs/core-react/text/MutedText.d.ts +10 -10
  182. package/lib/cjs/core-react/text/MutedText.js +21 -21
  183. package/lib/cjs/core-react/text/MutedText.js.map +1 -1
  184. package/lib/cjs/core-react/text/StyledText.d.ts +17 -17
  185. package/lib/cjs/core-react/text/StyledText.js +21 -21
  186. package/lib/cjs/core-react/text/StyledText.js.map +1 -1
  187. package/lib/cjs/core-react/text/TextProps.d.ts +10 -10
  188. package/lib/cjs/core-react/text/TextProps.js +9 -9
  189. package/lib/cjs/core-react/tree/Branch.d.ts +19 -19
  190. package/lib/cjs/core-react/tree/Branch.js +23 -23
  191. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts +20 -20
  192. package/lib/cjs/core-react/tree/ExpansionToggle.js +30 -30
  193. package/lib/cjs/core-react/tree/Node.d.ts +79 -79
  194. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  195. package/lib/cjs/core-react/tree/Node.js +87 -88
  196. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  197. package/lib/cjs/core-react/tree/Node.scss +0 -15
  198. package/lib/cjs/core-react/tree/Placeholder.d.ts +22 -22
  199. package/lib/cjs/core-react/tree/Placeholder.js +31 -31
  200. package/lib/cjs/core-react/tree/Tree.d.ts +28 -28
  201. package/lib/cjs/core-react/tree/Tree.js +100 -100
  202. package/lib/cjs/core-react/uistate/LocalStateStorage.d.ts +16 -16
  203. package/lib/cjs/core-react/uistate/LocalStateStorage.js +49 -49
  204. package/lib/cjs/core-react/uistate/UiStateEntry.d.ts +30 -30
  205. package/lib/cjs/core-react/uistate/UiStateEntry.js +59 -59
  206. package/lib/cjs/core-react/uistate/UiStateStorage.d.ts +28 -28
  207. package/lib/cjs/core-react/uistate/UiStateStorage.js +21 -21
  208. package/lib/cjs/core-react/utils/IconHelper.d.ts +23 -23
  209. package/lib/cjs/core-react/utils/IconHelper.js +62 -62
  210. package/lib/cjs/core-react/utils/IconWebComponent.d.ts +10 -10
  211. package/lib/cjs/core-react/utils/IconWebComponent.js +72 -72
  212. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  213. package/lib/cjs/core-react/utils/Point.d.ts +37 -37
  214. package/lib/cjs/core-react/utils/Point.js +73 -73
  215. package/lib/cjs/core-react/utils/Point.js.map +1 -1
  216. package/lib/cjs/core-react/utils/Props.d.ts +38 -38
  217. package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
  218. package/lib/cjs/core-react/utils/Props.js +9 -9
  219. package/lib/cjs/core-react/utils/Rectangle.d.ts +144 -144
  220. package/lib/cjs/core-react/utils/Rectangle.js +270 -270
  221. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  222. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.d.ts +23 -23
  223. package/lib/cjs/core-react/utils/ScrollPositionMaintainer.js +36 -36
  224. package/lib/cjs/core-react/utils/Size.d.ts +23 -23
  225. package/lib/cjs/core-react/utils/Size.js +32 -32
  226. package/lib/cjs/core-react/utils/Size.js.map +1 -1
  227. package/lib/cjs/core-react/utils/Timer.d.ts +35 -35
  228. package/lib/cjs/core-react/utils/Timer.d.ts.map +1 -1
  229. package/lib/cjs/core-react/utils/Timer.js +64 -64
  230. package/lib/cjs/core-react/utils/UiGeometry.d.ts +20 -20
  231. package/lib/cjs/core-react/utils/UiGeometry.js +28 -28
  232. package/lib/cjs/core-react/utils/flattenChildren.d.ts +8 -8
  233. package/lib/cjs/core-react/utils/flattenChildren.js +27 -27
  234. package/lib/cjs/core-react/utils/getBestBWContrastColor.d.ts +7 -7
  235. package/lib/cjs/core-react/utils/getBestBWContrastColor.js +22 -22
  236. package/lib/cjs/core-react/utils/getBestBWContrastColor.js.map +1 -1
  237. package/lib/cjs/core-react/utils/getCssVariable.d.ts +11 -11
  238. package/lib/cjs/core-react/utils/getCssVariable.js +31 -31
  239. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  240. package/lib/cjs/core-react/utils/getDisplayName.d.ts +8 -8
  241. package/lib/cjs/core-react/utils/getDisplayName.js +21 -21
  242. package/lib/cjs/core-react/utils/getUserColor.d.ts +7 -7
  243. package/lib/cjs/core-react/utils/getUserColor.js +38 -38
  244. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +4 -4
  245. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  246. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.js +19 -19
  247. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.d.ts +7 -7
  248. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +88 -89
  249. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  250. package/lib/cjs/core-react/utils/hooks/useDisposable.d.ts +17 -17
  251. package/lib/cjs/core-react/utils/hooks/useDisposable.js +38 -38
  252. package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.d.ts +8 -8
  253. package/lib/cjs/core-react/utils/hooks/useEffectSkipFirst.js +26 -26
  254. package/lib/cjs/core-react/utils/hooks/useEventListener.d.ts +11 -11
  255. package/lib/cjs/core-react/utils/hooks/useEventListener.js +43 -43
  256. package/lib/cjs/core-react/utils/hooks/useInterval.d.ts +5 -5
  257. package/lib/cjs/core-react/utils/hooks/useInterval.js +36 -36
  258. package/lib/cjs/core-react/utils/hooks/useLifecycleLogging.d.ts +5 -5
  259. package/lib/cjs/core-react/utils/hooks/useLifecycleLogging.js +64 -64
  260. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts +12 -12
  261. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  262. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.js +92 -92
  263. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.d.ts +55 -55
  264. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js +114 -114
  265. package/lib/cjs/core-react/utils/hooks/useRefEffect.d.ts +7 -7
  266. package/lib/cjs/core-react/utils/hooks/useRefEffect.js +23 -23
  267. package/lib/cjs/core-react/utils/hooks/useRefState.d.ts +21 -21
  268. package/lib/cjs/core-react/utils/hooks/useRefState.js +35 -35
  269. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts +12 -12
  270. package/lib/cjs/core-react/utils/hooks/useRefs.js +53 -53
  271. package/lib/cjs/core-react/utils/hooks/useResizeObserver.d.ts +39 -39
  272. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +203 -208
  273. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  274. package/lib/cjs/core-react/utils/hooks/useTargeted.d.ts +8 -8
  275. package/lib/cjs/core-react/utils/hooks/useTargeted.js +28 -28
  276. package/lib/cjs/core-react/utils/hooks/useThrottledFn.d.ts +15 -15
  277. package/lib/cjs/core-react/utils/hooks/useThrottledFn.js +25 -25
  278. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.d.ts +20 -20
  279. package/lib/cjs/core-react/utils/hooks/useWidgetOpacityContext.js +27 -27
  280. package/lib/cjs/core-react/utils/isPromiseLike.d.ts +7 -7
  281. package/lib/cjs/core-react/utils/isPromiseLike.js +17 -17
  282. package/lib/cjs/core-react/utils/shallowDiffers.d.ts +11 -11
  283. package/lib/cjs/core-react/utils/shallowDiffers.js +29 -29
  284. package/lib/cjs/core-react/utils/typeUtils.d.ts +7 -7
  285. package/lib/cjs/core-react/utils/typeUtils.d.ts.map +1 -1
  286. package/lib/cjs/core-react/utils/typeUtils.js +9 -9
  287. package/lib/cjs/core-react.d.ts +236 -236
  288. package/lib/cjs/core-react.js +263 -259
  289. package/lib/cjs/core-react.js.map +1 -1
  290. package/lib/esm/core-react/UiCore.d.ts +40 -40
  291. package/lib/esm/core-react/UiCore.js +82 -81
  292. package/lib/esm/core-react/UiCore.js.map +1 -1
  293. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +96 -96
  294. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  295. package/lib/esm/core-react/autosuggest/AutoSuggest.js +170 -170
  296. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +1 -2
  297. package/lib/esm/core-react/badge/Badge.d.ts +18 -18
  298. package/lib/esm/core-react/badge/Badge.js +22 -22
  299. package/lib/esm/core-react/badge/BadgeUtilities.d.ts +12 -12
  300. package/lib/esm/core-react/badge/BadgeUtilities.js +34 -34
  301. package/lib/esm/core-react/badge/BetaBadge.d.ts +9 -9
  302. package/lib/esm/core-react/badge/BetaBadge.js +18 -18
  303. package/lib/esm/core-react/badge/NewBadge.d.ts +10 -10
  304. package/lib/esm/core-react/badge/NewBadge.js +19 -19
  305. package/lib/esm/core-react/base/Centered.d.ts +10 -10
  306. package/lib/esm/core-react/base/Centered.js +16 -16
  307. package/lib/esm/core-react/base/Div.d.ts +16 -16
  308. package/lib/esm/core-react/base/Div.js +16 -16
  309. package/lib/esm/core-react/base/DivWithOutsideClick.d.ts +79 -79
  310. package/lib/esm/core-react/base/DivWithOutsideClick.js +13 -13
  311. package/lib/esm/core-react/base/FillCentered.d.ts +10 -10
  312. package/lib/esm/core-react/base/FillCentered.js +16 -16
  313. package/lib/esm/core-react/base/FlexWrapContainer.d.ts +11 -11
  314. package/lib/esm/core-react/base/FlexWrapContainer.js +17 -17
  315. package/lib/esm/core-react/base/Gap.d.ts +15 -15
  316. package/lib/esm/core-react/base/Gap.js +16 -16
  317. package/lib/esm/core-react/base/Gap.js.map +1 -1
  318. package/lib/esm/core-react/base/PointerEvents.d.ts +7 -7
  319. package/lib/esm/core-react/base/PointerEvents.js +13 -13
  320. package/lib/esm/core-react/base/ScrollView.d.ts +11 -11
  321. package/lib/esm/core-react/base/ScrollView.js +17 -17
  322. package/lib/esm/core-react/button/UnderlinedButton.d.ts +24 -24
  323. package/lib/esm/core-react/button/UnderlinedButton.js +31 -31
  324. package/lib/esm/core-react/checklistbox/CheckListBox.d.ts +40 -40
  325. package/lib/esm/core-react/checklistbox/CheckListBox.js +36 -36
  326. package/lib/esm/core-react/checklistbox/CheckListBox.scss +0 -1
  327. package/lib/esm/core-react/classes.scss +0 -2
  328. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +93 -93
  329. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  330. package/lib/esm/core-react/contextmenu/ContextMenu.js +360 -360
  331. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  332. package/lib/esm/core-react/contextmenu/ContextMenuDirection.d.ts +18 -18
  333. package/lib/esm/core-react/contextmenu/ContextMenuDirection.js +23 -23
  334. package/lib/esm/core-react/contextmenu/ContextMenuDivider.d.ts +12 -12
  335. package/lib/esm/core-react/contextmenu/ContextMenuDivider.js +19 -19
  336. package/lib/esm/core-react/contextmenu/ContextMenuItem.d.ts +61 -61
  337. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +105 -104
  338. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  339. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +51 -51
  340. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  341. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +159 -158
  342. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  343. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts +34 -34
  344. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +57 -59
  345. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  346. package/lib/esm/core-react/contextmenu/PopupContextMenu.d.ts +53 -53
  347. package/lib/esm/core-react/contextmenu/PopupContextMenu.js +51 -51
  348. package/lib/esm/core-react/contextmenu/TildeFinder.d.ts +18 -18
  349. package/lib/esm/core-react/contextmenu/TildeFinder.js +67 -66
  350. package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
  351. package/lib/esm/core-react/dialog/Dialog.d.ts +132 -132
  352. package/lib/esm/core-react/dialog/Dialog.js +371 -371
  353. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  354. package/lib/esm/core-react/dialog/GlobalDialog.d.ts +28 -28
  355. package/lib/esm/core-react/dialog/GlobalDialog.js +48 -49
  356. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  357. package/lib/esm/core-react/elementseparator/ElementSeparator.d.ts +41 -41
  358. package/lib/esm/core-react/elementseparator/ElementSeparator.js +159 -159
  359. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  360. package/lib/esm/core-react/enums/Alignment.d.ts +22 -22
  361. package/lib/esm/core-react/enums/Alignment.js +28 -28
  362. package/lib/esm/core-react/enums/CheckBoxState.d.ts +20 -20
  363. package/lib/esm/core-react/enums/CheckBoxState.js +16 -16
  364. package/lib/esm/core-react/enums/Orientation.d.ts +11 -11
  365. package/lib/esm/core-react/enums/Orientation.js +16 -16
  366. package/lib/esm/core-react/enums/SortDirection.d.ts +12 -12
  367. package/lib/esm/core-react/enums/SortDirection.js +17 -17
  368. package/lib/esm/core-react/enums/TimeFormat.d.ts +14 -14
  369. package/lib/esm/core-react/enums/TimeFormat.js +19 -19
  370. package/lib/esm/core-react/expandable/ExpandableList.d.ts +37 -37
  371. package/lib/esm/core-react/expandable/ExpandableList.js +54 -53
  372. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  373. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts +53 -53
  374. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  375. package/lib/esm/core-react/focus/ItemKeyboardNavigator.js +145 -145
  376. package/lib/esm/core-react/focustrap/FocusTrap.d.ts +28 -28
  377. package/lib/esm/core-react/focustrap/FocusTrap.js +191 -191
  378. package/lib/esm/core-react/hocs/withIsPressed.d.ts +77 -77
  379. package/lib/esm/core-react/hocs/withIsPressed.js +42 -42
  380. package/lib/esm/core-react/hocs/withOnOutsideClick.d.ts +103 -103
  381. package/lib/esm/core-react/hocs/withOnOutsideClick.js +110 -111
  382. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  383. package/lib/esm/core-react/hocs/withTimeout.d.ts +74 -74
  384. package/lib/esm/core-react/hocs/withTimeout.js +42 -42
  385. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +26 -26
  386. package/lib/esm/core-react/icons/ConditionalIconItem.js +60 -60
  387. package/lib/esm/core-react/icons/IconComponent.d.ts +25 -25
  388. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  389. package/lib/esm/core-react/icons/IconComponent.js +44 -44
  390. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  391. package/lib/esm/core-react/icons/SvgPath.d.ts +23 -23
  392. package/lib/esm/core-react/icons/SvgPath.js +23 -23
  393. package/lib/esm/core-react/icons/WebFontIcon.d.ts +25 -25
  394. package/lib/esm/core-react/icons/WebFontIcon.js +17 -17
  395. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.d.ts +42 -42
  396. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.js +52 -52
  397. package/lib/esm/core-react/index.scss +0 -2
  398. package/lib/esm/core-react/inputs/Input.d.ts +20 -20
  399. package/lib/esm/core-react/inputs/Input.js +42 -42
  400. package/lib/esm/core-react/inputs/InputLabel.d.ts +20 -20
  401. package/lib/esm/core-react/inputs/InputLabel.js +37 -37
  402. package/lib/esm/core-react/inputs/InputStatus.d.ts +11 -11
  403. package/lib/esm/core-react/inputs/InputStatus.js +16 -16
  404. package/lib/esm/core-react/inputs/LabeledComponentProps.d.ts +33 -33
  405. package/lib/esm/core-react/inputs/LabeledComponentProps.js +8 -8
  406. package/lib/esm/core-react/inputs/iconinput/IconInput.d.ts +23 -23
  407. package/lib/esm/core-react/inputs/iconinput/IconInput.js +26 -26
  408. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +50 -50
  409. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  410. package/lib/esm/core-react/inputs/numberinput/NumberInput.js +150 -150
  411. package/lib/esm/core-react/listbox/Listbox.d.ts +55 -55
  412. package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
  413. package/lib/esm/core-react/listbox/Listbox.js +216 -217
  414. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  415. package/lib/esm/core-react/loading/LoadingBar.d.ts +29 -29
  416. package/lib/esm/core-react/loading/LoadingBar.js +36 -35
  417. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  418. package/lib/esm/core-react/loading/LoadingPrompt.d.ts +39 -39
  419. package/lib/esm/core-react/loading/LoadingPrompt.js +41 -40
  420. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  421. package/lib/esm/core-react/loading/LoadingSpinner.d.ts +32 -32
  422. package/lib/esm/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  423. package/lib/esm/core-react/loading/LoadingSpinner.js +27 -26
  424. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  425. package/lib/esm/core-react/loading/LoadingStatus.d.ts +24 -24
  426. package/lib/esm/core-react/loading/LoadingStatus.js +34 -33
  427. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  428. package/lib/esm/core-react/messagebox/MessageBox.d.ts +80 -80
  429. package/lib/esm/core-react/messagebox/MessageBox.js +110 -109
  430. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  431. package/lib/esm/core-react/notification/MessageRenderer.d.ts +19 -19
  432. package/lib/esm/core-react/notification/MessageRenderer.js +77 -77
  433. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  434. package/lib/esm/core-react/notification/MessageType.d.ts +22 -22
  435. package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
  436. package/lib/esm/core-react/notification/MessageType.js +19 -19
  437. package/lib/esm/core-react/popup/Popup.d.ts +111 -111
  438. package/lib/esm/core-react/popup/Popup.js +415 -418
  439. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  440. package/lib/esm/core-react/radialmenu/Annulus.d.ts +54 -54
  441. package/lib/esm/core-react/radialmenu/Annulus.js +75 -75
  442. package/lib/esm/core-react/radialmenu/RadialMenu.d.ts +97 -97
  443. package/lib/esm/core-react/radialmenu/RadialMenu.js +175 -174
  444. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  445. package/lib/esm/core-react/searchbox/SearchBox.d.ts +52 -52
  446. package/lib/esm/core-react/searchbox/SearchBox.js +107 -107
  447. package/lib/esm/core-react/searchbox/SearchBox.scss +2 -3
  448. package/lib/esm/core-react/settings/SettingsContainer.d.ts +30 -30
  449. package/lib/esm/core-react/settings/SettingsContainer.js +115 -115
  450. package/lib/esm/core-react/settings/SettingsManager.d.ts +132 -132
  451. package/lib/esm/core-react/settings/SettingsManager.js +113 -113
  452. package/lib/esm/core-react/style/index.scss +0 -7
  453. package/lib/esm/core-react/tabs/Tabs.d.ts +71 -71
  454. package/lib/esm/core-react/tabs/Tabs.js +121 -121
  455. package/lib/esm/core-react/tabs/VerticalTabs.d.ts +9 -9
  456. package/lib/esm/core-react/tabs/VerticalTabs.js +16 -16
  457. package/lib/esm/core-react/text/BlockText.d.ts +9 -9
  458. package/lib/esm/core-react/text/BlockText.js +16 -16
  459. package/lib/esm/core-react/text/BodyText.d.ts +10 -10
  460. package/lib/esm/core-react/text/BodyText.js +17 -17
  461. package/lib/esm/core-react/text/BodyText.js.map +1 -1
  462. package/lib/esm/core-react/text/DisabledText.d.ts +6 -6
  463. package/lib/esm/core-react/text/DisabledText.js +16 -16
  464. package/lib/esm/core-react/text/FilteredText.d.ts +24 -24
  465. package/lib/esm/core-react/text/FilteredText.js +36 -36
  466. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  467. package/lib/esm/core-react/text/MutedText.d.ts +10 -10
  468. package/lib/esm/core-react/text/MutedText.js +17 -17
  469. package/lib/esm/core-react/text/MutedText.js.map +1 -1
  470. package/lib/esm/core-react/text/StyledText.d.ts +17 -17
  471. package/lib/esm/core-react/text/StyledText.js +17 -17
  472. package/lib/esm/core-react/text/StyledText.js.map +1 -1
  473. package/lib/esm/core-react/text/TextProps.d.ts +10 -10
  474. package/lib/esm/core-react/text/TextProps.js +8 -8
  475. package/lib/esm/core-react/tree/Branch.d.ts +19 -19
  476. package/lib/esm/core-react/tree/Branch.js +19 -19
  477. package/lib/esm/core-react/tree/ExpansionToggle.d.ts +20 -20
  478. package/lib/esm/core-react/tree/ExpansionToggle.js +26 -26
  479. package/lib/esm/core-react/tree/Node.d.ts +79 -79
  480. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  481. package/lib/esm/core-react/tree/Node.js +83 -84
  482. package/lib/esm/core-react/tree/Node.js.map +1 -1
  483. package/lib/esm/core-react/tree/Node.scss +0 -15
  484. package/lib/esm/core-react/tree/Placeholder.d.ts +22 -22
  485. package/lib/esm/core-react/tree/Placeholder.js +27 -27
  486. package/lib/esm/core-react/tree/Tree.d.ts +28 -28
  487. package/lib/esm/core-react/tree/Tree.js +96 -96
  488. package/lib/esm/core-react/uistate/LocalStateStorage.d.ts +16 -16
  489. package/lib/esm/core-react/uistate/LocalStateStorage.js +45 -45
  490. package/lib/esm/core-react/uistate/UiStateEntry.d.ts +30 -30
  491. package/lib/esm/core-react/uistate/UiStateEntry.js +55 -55
  492. package/lib/esm/core-react/uistate/UiStateStorage.d.ts +28 -28
  493. package/lib/esm/core-react/uistate/UiStateStorage.js +18 -18
  494. package/lib/esm/core-react/utils/IconHelper.d.ts +23 -23
  495. package/lib/esm/core-react/utils/IconHelper.js +58 -58
  496. package/lib/esm/core-react/utils/IconWebComponent.d.ts +10 -10
  497. package/lib/esm/core-react/utils/IconWebComponent.js +68 -68
  498. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  499. package/lib/esm/core-react/utils/Point.d.ts +37 -37
  500. package/lib/esm/core-react/utils/Point.js +69 -69
  501. package/lib/esm/core-react/utils/Point.js.map +1 -1
  502. package/lib/esm/core-react/utils/Props.d.ts +38 -38
  503. package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
  504. package/lib/esm/core-react/utils/Props.js +8 -8
  505. package/lib/esm/core-react/utils/Rectangle.d.ts +144 -144
  506. package/lib/esm/core-react/utils/Rectangle.js +266 -266
  507. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  508. package/lib/esm/core-react/utils/ScrollPositionMaintainer.d.ts +23 -23
  509. package/lib/esm/core-react/utils/ScrollPositionMaintainer.js +32 -32
  510. package/lib/esm/core-react/utils/Size.d.ts +23 -23
  511. package/lib/esm/core-react/utils/Size.js +28 -28
  512. package/lib/esm/core-react/utils/Size.js.map +1 -1
  513. package/lib/esm/core-react/utils/Timer.d.ts +35 -35
  514. package/lib/esm/core-react/utils/Timer.d.ts.map +1 -1
  515. package/lib/esm/core-react/utils/Timer.js +60 -60
  516. package/lib/esm/core-react/utils/UiGeometry.d.ts +20 -20
  517. package/lib/esm/core-react/utils/UiGeometry.js +24 -24
  518. package/lib/esm/core-react/utils/flattenChildren.d.ts +8 -8
  519. package/lib/esm/core-react/utils/flattenChildren.js +23 -23
  520. package/lib/esm/core-react/utils/getBestBWContrastColor.d.ts +7 -7
  521. package/lib/esm/core-react/utils/getBestBWContrastColor.js +18 -18
  522. package/lib/esm/core-react/utils/getBestBWContrastColor.js.map +1 -1
  523. package/lib/esm/core-react/utils/getCssVariable.d.ts +11 -11
  524. package/lib/esm/core-react/utils/getCssVariable.js +26 -26
  525. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  526. package/lib/esm/core-react/utils/getDisplayName.d.ts +8 -8
  527. package/lib/esm/core-react/utils/getDisplayName.js +17 -17
  528. package/lib/esm/core-react/utils/getUserColor.d.ts +7 -7
  529. package/lib/esm/core-react/utils/getUserColor.js +34 -34
  530. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +4 -4
  531. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  532. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.js +16 -16
  533. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.d.ts +7 -7
  534. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +84 -85
  535. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  536. package/lib/esm/core-react/utils/hooks/useDisposable.d.ts +17 -17
  537. package/lib/esm/core-react/utils/hooks/useDisposable.js +33 -33
  538. package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.d.ts +8 -8
  539. package/lib/esm/core-react/utils/hooks/useEffectSkipFirst.js +22 -22
  540. package/lib/esm/core-react/utils/hooks/useEventListener.d.ts +11 -11
  541. package/lib/esm/core-react/utils/hooks/useEventListener.js +39 -39
  542. package/lib/esm/core-react/utils/hooks/useInterval.d.ts +5 -5
  543. package/lib/esm/core-react/utils/hooks/useInterval.js +32 -32
  544. package/lib/esm/core-react/utils/hooks/useLifecycleLogging.d.ts +5 -5
  545. package/lib/esm/core-react/utils/hooks/useLifecycleLogging.js +60 -60
  546. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts +12 -12
  547. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  548. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.js +88 -88
  549. package/lib/esm/core-react/utils/hooks/useProximityToMouse.d.ts +55 -55
  550. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js +102 -102
  551. package/lib/esm/core-react/utils/hooks/useRefEffect.d.ts +7 -7
  552. package/lib/esm/core-react/utils/hooks/useRefEffect.js +19 -19
  553. package/lib/esm/core-react/utils/hooks/useRefState.d.ts +21 -21
  554. package/lib/esm/core-react/utils/hooks/useRefState.js +31 -31
  555. package/lib/esm/core-react/utils/hooks/useRefs.d.ts +12 -12
  556. package/lib/esm/core-react/utils/hooks/useRefs.js +48 -48
  557. package/lib/esm/core-react/utils/hooks/useResizeObserver.d.ts +39 -39
  558. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +196 -201
  559. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  560. package/lib/esm/core-react/utils/hooks/useTargeted.d.ts +8 -8
  561. package/lib/esm/core-react/utils/hooks/useTargeted.js +24 -24
  562. package/lib/esm/core-react/utils/hooks/useThrottledFn.d.ts +15 -15
  563. package/lib/esm/core-react/utils/hooks/useThrottledFn.js +21 -21
  564. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.d.ts +20 -20
  565. package/lib/esm/core-react/utils/hooks/useWidgetOpacityContext.js +23 -23
  566. package/lib/esm/core-react/utils/isPromiseLike.d.ts +7 -7
  567. package/lib/esm/core-react/utils/isPromiseLike.js +13 -13
  568. package/lib/esm/core-react/utils/shallowDiffers.d.ts +11 -11
  569. package/lib/esm/core-react/utils/shallowDiffers.js +25 -25
  570. package/lib/esm/core-react/utils/typeUtils.d.ts +7 -7
  571. package/lib/esm/core-react/utils/typeUtils.d.ts.map +1 -1
  572. package/lib/esm/core-react/utils/typeUtils.js +8 -8
  573. package/lib/esm/core-react.d.ts +236 -236
  574. package/lib/esm/core-react.js +241 -241
  575. package/package.json +15 -13
  576. package/ThirdPartyNotices.md +0 -28
  577. package/lib/cjs/core-react/button/blue-large.scss +0 -12
  578. package/lib/cjs/core-react/button/blue.scss +0 -17
  579. package/lib/cjs/core-react/button/button.scss +0 -70
  580. package/lib/cjs/core-react/button/classes.scss +0 -14
  581. package/lib/cjs/core-react/button/disabled-large.scss +0 -12
  582. package/lib/cjs/core-react/button/disabled.scss +0 -17
  583. package/lib/cjs/core-react/button/hollow-large.scss +0 -13
  584. package/lib/cjs/core-react/button/hollow.scss +0 -30
  585. package/lib/cjs/core-react/button/index.scss +0 -14
  586. package/lib/cjs/core-react/button/primary-large.scss +0 -12
  587. package/lib/cjs/core-react/button/primary.scss +0 -17
  588. package/lib/cjs/core-react/button/variables.scss +0 -22
  589. package/lib/cjs/core-react/checkbox/checkbox.scss +0 -124
  590. package/lib/cjs/core-react/checkbox/classes.scss +0 -8
  591. package/lib/cjs/core-react/checkbox/index.scss +0 -8
  592. package/lib/cjs/core-react/style/data-viz.scss +0 -20
  593. package/lib/cjs/core-react/style/space.scss +0 -13
  594. package/lib/cjs/core-react/style/speed.scss +0 -9
  595. package/lib/cjs/core-react/style/typography.scss +0 -39
  596. package/lib/cjs/core-react/style/variables.scss +0 -9
  597. package/lib/esm/core-react/button/blue-large.scss +0 -12
  598. package/lib/esm/core-react/button/blue.scss +0 -17
  599. package/lib/esm/core-react/button/button.scss +0 -70
  600. package/lib/esm/core-react/button/classes.scss +0 -14
  601. package/lib/esm/core-react/button/disabled-large.scss +0 -12
  602. package/lib/esm/core-react/button/disabled.scss +0 -17
  603. package/lib/esm/core-react/button/hollow-large.scss +0 -13
  604. package/lib/esm/core-react/button/hollow.scss +0 -30
  605. package/lib/esm/core-react/button/index.scss +0 -14
  606. package/lib/esm/core-react/button/primary-large.scss +0 -12
  607. package/lib/esm/core-react/button/primary.scss +0 -17
  608. package/lib/esm/core-react/button/variables.scss +0 -22
  609. package/lib/esm/core-react/checkbox/checkbox.scss +0 -124
  610. package/lib/esm/core-react/checkbox/classes.scss +0 -8
  611. package/lib/esm/core-react/checkbox/index.scss +0 -8
  612. package/lib/esm/core-react/style/data-viz.scss +0 -20
  613. package/lib/esm/core-react/style/space.scss +0 -13
  614. package/lib/esm/core-react/style/speed.scss +0 -9
  615. package/lib/esm/core-react/style/typography.scss +0 -39
  616. package/lib/esm/core-react/style/variables.scss +0 -9
@@ -1,223 +1,222 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ListboxItem = exports.Listbox = exports.ListboxContext = void 0;
4
- /*---------------------------------------------------------------------------------------------
5
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
- * See LICENSE.md in the project root for license terms and full copyright notice.
7
- *--------------------------------------------------------------------------------------------*/
8
- const React = require("react");
9
- const classnames_1 = require("classnames");
10
- require("./Listbox.scss");
11
- const core_bentley_1 = require("@itwin/core-bentley");
12
- const appui_abstract_1 = require("@itwin/appui-abstract");
13
- /**
14
- * Context set up by listbox for use by `ListboxItems` .
15
- * @alpha
16
- */
17
- // istanbul ignore next
18
- exports.ListboxContext = React.createContext({ onListboxValueChange: (_newValue) => { } }); // eslint-disable-line @typescript-eslint/naming-convention
19
- function makeId(...args) {
20
- return args.filter((val) => val != null).join("--");
21
- }
22
- function getOptionValueArray(childNodes) {
23
- return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => optionNode.props);
24
- }
25
- function processKeyboardNavigation(optionValues, itemIndex, key) {
26
- let keyProcessed = false;
27
- let newIndex = itemIndex >= 0 ? itemIndex : 0;
28
- // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js
29
- if (key === appui_abstract_1.SpecialKey.ArrowDown || key === appui_abstract_1.SpecialKey.PageDown) {
30
- for (let i = itemIndex + 1; i < optionValues.length; i++) {
31
- if (!optionValues[i].disabled) {
32
- newIndex = i;
33
- break;
34
- }
35
- }
36
- keyProcessed = true;
37
- }
38
- else if (key === appui_abstract_1.SpecialKey.ArrowUp || key === appui_abstract_1.SpecialKey.PageUp) {
39
- for (let i = itemIndex - 1; i >= 0; i--) {
40
- if (!optionValues[i].disabled) {
41
- newIndex = i;
42
- break;
43
- }
44
- }
45
- keyProcessed = true;
46
- }
47
- else if (key === appui_abstract_1.SpecialKey.Home) {
48
- for (let i = 0; i < optionValues.length; i++) {
49
- if (!optionValues[i].disabled) {
50
- newIndex = i;
51
- break;
52
- }
53
- }
54
- keyProcessed = true;
55
- }
56
- else if (key === appui_abstract_1.SpecialKey.End) {
57
- for (let i = optionValues.length - 1; i >= 0; i--) {
58
- if (!optionValues[i].disabled) {
59
- newIndex = i;
60
- break;
61
- }
62
- }
63
- keyProcessed = true;
64
- }
65
- return [newIndex, keyProcessed];
66
- }
67
- /**
68
- * Single select `Listbox` component
69
- * @alpha
70
- */
71
- function Listbox(props) {
72
- const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;
73
- const listRef = React.useRef(null);
74
- const [listId] = React.useState(() => { return id !== null && id !== void 0 ? id : core_bentley_1.Guid.createValue(); });
75
- const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);
76
- const classes = React.useMemo(() => (0, classnames_1.default)("core-listbox", className), [className]);
77
- const [currentValue, setCurrentValue] = React.useState(selectedValue);
78
- const [focusValue, setFocusValue] = React.useState(currentValue);
79
- React.useEffect(() => {
80
- setCurrentValue(selectedValue);
81
- setFocusValue(selectedValue);
82
- }, [selectedValue]);
83
- const scrollTopRef = React.useRef(0);
84
- const handleValueChange = React.useCallback((newValue, isControlOrCommandPressed) => {
85
- // istanbul ignore else
86
- if (newValue !== currentValue) {
87
- setCurrentValue(newValue);
88
- setFocusValue(newValue);
89
- if (onListboxValueChange)
90
- onListboxValueChange(newValue, isControlOrCommandPressed);
91
- }
92
- }, [setCurrentValue, currentValue, onListboxValueChange]);
93
- const focusOption = React.useCallback((itemIndex) => {
94
- // istanbul ignore else
95
- if (itemIndex >= 0 && itemIndex < optionValues.length) {
96
- const newSelection = optionValues[itemIndex];
97
- const listElement = listRef.current;
98
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
99
- const optionToFocus = listElement.querySelector(`li[data-value="${newSelection.value}"]`);
100
- // istanbul ignore else
101
- if (optionToFocus && listElement) {
102
- let newScrollTop = listElement.scrollTop;
103
- // istanbul ignore next
104
- if (listElement.scrollHeight > listElement.clientHeight) {
105
- const scrollBottom = listElement.clientHeight + listElement.scrollTop;
106
- const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;
107
- if (elementBottom > scrollBottom) {
108
- newScrollTop = elementBottom - listElement.clientHeight;
109
- }
110
- else if (optionToFocus.offsetTop < listElement.scrollTop) {
111
- newScrollTop = optionToFocus.offsetTop;
112
- }
113
- scrollTopRef.current = newScrollTop;
114
- }
115
- setFocusValue(newSelection.value);
116
- }
117
- }
118
- }, [optionValues]);
119
- const handleKeyDown = React.useCallback((event) => {
120
- if (optionValues.length < 1)
121
- return;
122
- const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));
123
- if (event.key === appui_abstract_1.SpecialKey.Space) {
124
- event.preventDefault();
125
- // istanbul ignore else
126
- if (focusValue)
127
- handleValueChange(focusValue, event.getModifierState("Control") || event.getModifierState("Meta")); // Control or Command
128
- return;
129
- }
130
- else {
131
- const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);
132
- // istanbul ignore else
133
- if (keyProcessed) {
134
- event.preventDefault();
135
- focusOption(newItemIndex);
136
- return;
137
- }
138
- }
139
- // istanbul ignore else
140
- if (onKeyDown)
141
- onKeyDown(event);
142
- }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);
143
- const isInitialMount = React.useRef(true);
144
- React.useEffect(() => {
145
- const list = listRef.current;
146
- if (isInitialMount.current) {
147
- isInitialMount.current = false;
148
- if (undefined !== focusValue) {
149
- const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));
150
- focusOption(itemIndex);
151
- }
152
- }
153
- else {
154
- list.scrollTop = scrollTopRef.current;
155
- }
156
- }, [focusValue, focusOption, optionValues]);
157
- // istanbul ignore next
158
- const handleOnScroll = React.useCallback((_event) => {
159
- if (listRef.current)
160
- scrollTopRef.current = listRef.current.scrollTop;
161
- }, []);
162
- // istanbul ignore next
163
- const handleOnFocus = React.useCallback((_event) => {
164
- if (!focusValue || 0 === focusValue.length) {
165
- if (currentValue) {
166
- setFocusValue(currentValue);
167
- }
168
- else {
169
- if (optionValues.length > 0)
170
- setFocusValue(optionValues[0].value);
171
- }
172
- }
173
- }, [currentValue, focusValue, optionValues]);
174
- return React.createElement("ul", { className: classes, "aria-labelledby": ariaLabel ? undefined : ariaLabelledBy, "aria-label": ariaLabel,
175
- // An element that contains or owns all the listbox options has role
176
- // listbox.
177
- // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox
178
- role: "listbox",
179
- // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html
180
- tabIndex: 0, "aria-activedescendant": makeId(currentValue, listId), ...otherProps, ref: listRef, id: listId, onKeyDown: handleKeyDown, onScroll: handleOnScroll, "data-value": currentValue, "data-focusvalue": focusValue, onFocus: handleOnFocus },
181
- React.createElement(exports.ListboxContext.Provider, { value: {
182
- listboxValue: currentValue,
183
- focusValue,
184
- listboxId: listId,
185
- onListboxValueChange: handleValueChange,
186
- listboxRef: listRef,
187
- } }, children));
188
- }
189
- exports.Listbox = Listbox;
190
- /**
191
- * `ListboxItem` component.
192
- * @alpha
193
- */
194
- function ListboxItem(props) {
195
- const { children, value, className, disabled, ...otherProps } = props;
196
- const { listboxValue, focusValue, listboxId, onListboxValueChange, } = React.useContext(exports.ListboxContext);
197
- const hasFocus = focusValue === value;
198
- const classes = React.useMemo(() => (0, classnames_1.default)("core-listbox-item", hasFocus && "focused", className), [className, hasFocus]);
199
- const itemRef = React.useRef(null);
200
- const isSelected = listboxValue === value;
201
- const handleClick = React.useCallback((event) => {
202
- var _a, _b;
203
- event.preventDefault();
204
- // istanbul ignore next
205
- const selectedValue = (_b = (_a = event.currentTarget) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.value;
206
- // istanbul ignore else
207
- if (undefined !== selectedValue) {
208
- onListboxValueChange(selectedValue, event.ctrlKey);
209
- }
210
- }, [onListboxValueChange]);
211
- const getItemId = React.useCallback(() => {
212
- return makeId(value, listboxId);
213
- }, [listboxId, value]);
214
- return (
215
- // eslint-disable-next-line jsx-a11y/click-events-have-key-events
216
- React.createElement("li", { "aria-selected": isSelected, "aria-disabled": disabled || undefined,
217
- // Each option in the listbox has role `option` and is a DOM descendant
218
- // of the element with role `listbox`.
219
- // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox
220
- role: "option", className: classes, ...otherProps, ref: itemRef, id: getItemId(), "data-value": value, onClick: handleClick }, children));
221
- }
222
- exports.ListboxItem = ListboxItem;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListboxItem = exports.Listbox = exports.ListboxContext = void 0;
4
+ /*---------------------------------------------------------------------------------------------
5
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
+ * See LICENSE.md in the project root for license terms and full copyright notice.
7
+ *--------------------------------------------------------------------------------------------*/
8
+ const React = require("react");
9
+ const classnames_1 = require("classnames");
10
+ require("./Listbox.scss");
11
+ const core_bentley_1 = require("@itwin/core-bentley");
12
+ const appui_abstract_1 = require("@itwin/appui-abstract");
13
+ /**
14
+ * Context set up by listbox for use by `ListboxItems` .
15
+ * @alpha
16
+ */
17
+ // istanbul ignore next
18
+ exports.ListboxContext = React.createContext({ onListboxValueChange: (_newValue) => { } }); // eslint-disable-line @typescript-eslint/naming-convention
19
+ function makeId(...args) {
20
+ return args.filter((val) => val != null).join("--");
21
+ }
22
+ function getOptionValueArray(childNodes) {
23
+ return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => optionNode.props);
24
+ }
25
+ function processKeyboardNavigation(optionValues, itemIndex, key) {
26
+ let keyProcessed = false;
27
+ let newIndex = itemIndex >= 0 ? itemIndex : 0;
28
+ // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js
29
+ if (key === appui_abstract_1.SpecialKey.ArrowDown || key === appui_abstract_1.SpecialKey.PageDown) {
30
+ for (let i = itemIndex + 1; i < optionValues.length; i++) {
31
+ if (!optionValues[i].disabled) {
32
+ newIndex = i;
33
+ break;
34
+ }
35
+ }
36
+ keyProcessed = true;
37
+ }
38
+ else if (key === appui_abstract_1.SpecialKey.ArrowUp || key === appui_abstract_1.SpecialKey.PageUp) {
39
+ for (let i = itemIndex - 1; i >= 0; i--) {
40
+ if (!optionValues[i].disabled) {
41
+ newIndex = i;
42
+ break;
43
+ }
44
+ }
45
+ keyProcessed = true;
46
+ }
47
+ else if (key === appui_abstract_1.SpecialKey.Home) {
48
+ for (let i = 0; i < optionValues.length; i++) {
49
+ if (!optionValues[i].disabled) {
50
+ newIndex = i;
51
+ break;
52
+ }
53
+ }
54
+ keyProcessed = true;
55
+ }
56
+ else if (key === appui_abstract_1.SpecialKey.End) {
57
+ for (let i = optionValues.length - 1; i >= 0; i--) {
58
+ if (!optionValues[i].disabled) {
59
+ newIndex = i;
60
+ break;
61
+ }
62
+ }
63
+ keyProcessed = true;
64
+ }
65
+ return [newIndex, keyProcessed];
66
+ }
67
+ /**
68
+ * Single select `Listbox` component
69
+ * @alpha
70
+ */
71
+ function Listbox(props) {
72
+ const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;
73
+ const listRef = React.useRef(null);
74
+ const [listId] = React.useState(() => { return id ?? core_bentley_1.Guid.createValue(); });
75
+ const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);
76
+ const classes = React.useMemo(() => (0, classnames_1.default)("core-listbox", className), [className]);
77
+ const [currentValue, setCurrentValue] = React.useState(selectedValue);
78
+ const [focusValue, setFocusValue] = React.useState(currentValue);
79
+ React.useEffect(() => {
80
+ setCurrentValue(selectedValue);
81
+ setFocusValue(selectedValue);
82
+ }, [selectedValue]);
83
+ const scrollTopRef = React.useRef(0);
84
+ const handleValueChange = React.useCallback((newValue, isControlOrCommandPressed) => {
85
+ // istanbul ignore else
86
+ if (newValue !== currentValue) {
87
+ setCurrentValue(newValue);
88
+ setFocusValue(newValue);
89
+ if (onListboxValueChange)
90
+ onListboxValueChange(newValue, isControlOrCommandPressed);
91
+ }
92
+ }, [setCurrentValue, currentValue, onListboxValueChange]);
93
+ const focusOption = React.useCallback((itemIndex) => {
94
+ // istanbul ignore else
95
+ if (itemIndex >= 0 && itemIndex < optionValues.length) {
96
+ const newSelection = optionValues[itemIndex];
97
+ const listElement = listRef.current;
98
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
99
+ const optionToFocus = listElement.querySelector(`li[data-value="${newSelection.value}"]`);
100
+ // istanbul ignore else
101
+ if (optionToFocus && listElement) {
102
+ let newScrollTop = listElement.scrollTop;
103
+ // istanbul ignore next
104
+ if (listElement.scrollHeight > listElement.clientHeight) {
105
+ const scrollBottom = listElement.clientHeight + listElement.scrollTop;
106
+ const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;
107
+ if (elementBottom > scrollBottom) {
108
+ newScrollTop = elementBottom - listElement.clientHeight;
109
+ }
110
+ else if (optionToFocus.offsetTop < listElement.scrollTop) {
111
+ newScrollTop = optionToFocus.offsetTop;
112
+ }
113
+ scrollTopRef.current = newScrollTop;
114
+ }
115
+ setFocusValue(newSelection.value);
116
+ }
117
+ }
118
+ }, [optionValues]);
119
+ const handleKeyDown = React.useCallback((event) => {
120
+ if (optionValues.length < 1)
121
+ return;
122
+ const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));
123
+ if (event.key === appui_abstract_1.SpecialKey.Space) {
124
+ event.preventDefault();
125
+ // istanbul ignore else
126
+ if (focusValue)
127
+ handleValueChange(focusValue, event.getModifierState("Control") || event.getModifierState("Meta")); // Control or Command
128
+ return;
129
+ }
130
+ else {
131
+ const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);
132
+ // istanbul ignore else
133
+ if (keyProcessed) {
134
+ event.preventDefault();
135
+ focusOption(newItemIndex);
136
+ return;
137
+ }
138
+ }
139
+ // istanbul ignore else
140
+ if (onKeyDown)
141
+ onKeyDown(event);
142
+ }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);
143
+ const isInitialMount = React.useRef(true);
144
+ React.useEffect(() => {
145
+ const list = listRef.current;
146
+ if (isInitialMount.current) {
147
+ isInitialMount.current = false;
148
+ if (undefined !== focusValue) {
149
+ const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));
150
+ focusOption(itemIndex);
151
+ }
152
+ }
153
+ else {
154
+ list.scrollTop = scrollTopRef.current;
155
+ }
156
+ }, [focusValue, focusOption, optionValues]);
157
+ // istanbul ignore next
158
+ const handleOnScroll = React.useCallback((_event) => {
159
+ if (listRef.current)
160
+ scrollTopRef.current = listRef.current.scrollTop;
161
+ }, []);
162
+ // istanbul ignore next
163
+ const handleOnFocus = React.useCallback((_event) => {
164
+ if (!focusValue || 0 === focusValue.length) {
165
+ if (currentValue) {
166
+ setFocusValue(currentValue);
167
+ }
168
+ else {
169
+ if (optionValues.length > 0)
170
+ setFocusValue(optionValues[0].value);
171
+ }
172
+ }
173
+ }, [currentValue, focusValue, optionValues]);
174
+ return React.createElement("ul", { className: classes, "aria-labelledby": ariaLabel ? undefined : ariaLabelledBy, "aria-label": ariaLabel,
175
+ // An element that contains or owns all the listbox options has role
176
+ // listbox.
177
+ // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox
178
+ role: "listbox",
179
+ // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html
180
+ tabIndex: 0, "aria-activedescendant": makeId(currentValue, listId), ...otherProps, ref: listRef, id: listId, onKeyDown: handleKeyDown, onScroll: handleOnScroll, "data-value": currentValue, "data-focusvalue": focusValue, onFocus: handleOnFocus },
181
+ React.createElement(exports.ListboxContext.Provider, { value: {
182
+ listboxValue: currentValue,
183
+ focusValue,
184
+ listboxId: listId,
185
+ onListboxValueChange: handleValueChange,
186
+ listboxRef: listRef,
187
+ } }, children));
188
+ }
189
+ exports.Listbox = Listbox;
190
+ /**
191
+ * `ListboxItem` component.
192
+ * @alpha
193
+ */
194
+ function ListboxItem(props) {
195
+ const { children, value, className, disabled, ...otherProps } = props;
196
+ const { listboxValue, focusValue, listboxId, onListboxValueChange, } = React.useContext(exports.ListboxContext);
197
+ const hasFocus = focusValue === value;
198
+ const classes = React.useMemo(() => (0, classnames_1.default)("core-listbox-item", hasFocus && "focused", className), [className, hasFocus]);
199
+ const itemRef = React.useRef(null);
200
+ const isSelected = listboxValue === value;
201
+ const handleClick = React.useCallback((event) => {
202
+ event.preventDefault();
203
+ // istanbul ignore next
204
+ const selectedValue = event.currentTarget?.dataset?.value;
205
+ // istanbul ignore else
206
+ if (undefined !== selectedValue) {
207
+ onListboxValueChange(selectedValue, event.ctrlKey);
208
+ }
209
+ }, [onListboxValueChange]);
210
+ const getItemId = React.useCallback(() => {
211
+ return makeId(value, listboxId);
212
+ }, [listboxId, value]);
213
+ return (
214
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
215
+ React.createElement("li", { "aria-selected": isSelected, "aria-disabled": disabled || undefined,
216
+ // Each option in the listbox has role `option` and is a DOM descendant
217
+ // of the element with role `listbox`.
218
+ // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox
219
+ role: "option", className: classes, ...otherProps, ref: itemRef, id: getItemId(), "data-value": value, onClick: handleClick }, children));
220
+ }
221
+ exports.ListboxItem = ListboxItem;
223
222
  //# sourceMappingURL=Listbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Listbox.js","sourceRoot":"","sources":["../../../../src/core-react/listbox/Listbox.tsx"],"names":[],"mappings":";;;AAAA;;;+FAG+F;AAC/F,+BAA+B;AAC/B,2CAAoC;AAEpC,0BAAwB;AACxB,sDAA2C;AAC3C,0DAAmD;AA6CnD;;;GAGG;AACH,uBAAuB;AACV,QAAA,cAAc,GAAG,KAAK,CAAC,aAAa,CAAsB,EAAE,oBAAoB,EAAE,CAAC,SAAmC,EAAE,EAAE,GAAG,CAAC,EAAE,C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,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,OAAO,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO;IACL,iEAAiE;IACjE,6CAIiB,UAAU,mBAIV,QAAQ,IAAI,SAAS;QACpC,uEAAuE;QACvE,sCAAsC;QACtC,wDAAwD;QACxD,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACd,UAAU,EACd,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,SAAS,EAAE,gBAEH,KAAK,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACN,CACN,CAAC;AACJ,CAAC;AA9DD,kCA8DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\n\r\nimport \"./Listbox.scss\";\r\nimport { Guid } from \"@itwin/core-bentley\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\n\r\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\r\n\r\n/**\r\n * `Listbox` value.\r\n * @alpha\r\n */\r\nexport type ListboxValue = string;\r\n\r\n/**\r\n * `Listbox` Props.\r\n * @alpha\r\n */\r\nexport interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {\r\n id?: string;\r\n selectedValue?: ListboxValue;\r\n ariaLabel?: any;\r\n ariaLabelledBy?: any;\r\n onListboxValueChange?: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\r\n}\r\n\r\n/**\r\n * `ListboxItem` Props.\r\n * @alpha\r\n */\r\nexport interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {\r\n /** The unique item's value. */\r\n value: ListboxValue;\r\n /** set if item is disabled. */\r\n disabled?: boolean;\r\n}\r\n\r\n/**\r\n * `Listbox` Context.\r\n * @alpha\r\n */\r\nexport interface ListboxContextProps {\r\n listboxId?: string;\r\n listboxValue?: ListboxValue;\r\n focusValue?: ListboxValue;\r\n onListboxValueChange: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\r\n listboxRef?: React.RefObject<HTMLUListElement>;\r\n}\r\n\r\n/**\r\n * Context set up by listbox for use by `ListboxItems` .\r\n * @alpha\r\n */\r\n// istanbul ignore next\r\nexport const ListboxContext = React.createContext<ListboxContextProps>({ onListboxValueChange: (_newValue: ListboxValue | undefined) => { } }); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\nfunction makeId(...args: Array<string | number | null | undefined>) {\r\n return args.filter((val) => val != null).join(\"--\");\r\n}\r\n\r\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\r\n return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => ((optionNode as React.ReactElement).props as ListboxItemProps));\r\n}\r\n\r\nfunction processKeyboardNavigation(optionValues: ListboxItemProps[], itemIndex: number, key: string): [number, boolean] {\r\n let keyProcessed = false;\r\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\r\n\r\n // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js\r\n if (key === SpecialKey.ArrowDown || key === SpecialKey.PageDown) {\r\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.ArrowUp || key === SpecialKey.PageUp) {\r\n for (let i = itemIndex - 1; i >= 0; i--) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.Home) {\r\n for (let i = 0; i < optionValues.length; i++) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.End) {\r\n for (let i = optionValues.length - 1; i >= 0; i--) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n }\r\n return [newIndex, keyProcessed];\r\n}\r\n\r\n/**\r\n * Single select `Listbox` component\r\n * @alpha\r\n */\r\nexport function Listbox(props: ListboxProps) {\r\n const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;\r\n const listRef = React.useRef<HTMLUListElement>(null);\r\n const [listId] = React.useState(() => { return id ?? Guid.createValue(); });\r\n const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);\r\n const classes = React.useMemo(() => classnames(\"core-listbox\", className), [className]);\r\n const [currentValue, setCurrentValue] = React.useState<ListboxValue | undefined>(selectedValue);\r\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(currentValue);\r\n\r\n React.useEffect(() => {\r\n setCurrentValue(selectedValue);\r\n setFocusValue(selectedValue);\r\n }, [selectedValue]);\r\n\r\n const scrollTopRef = React.useRef(0);\r\n const handleValueChange = React.useCallback((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\r\n // istanbul ignore else\r\n if (newValue !== currentValue) {\r\n setCurrentValue(newValue);\r\n setFocusValue(newValue);\r\n if (onListboxValueChange)\r\n onListboxValueChange(newValue, isControlOrCommandPressed);\r\n }\r\n }, [setCurrentValue, currentValue, onListboxValueChange]);\r\n\r\n const focusOption = React.useCallback((itemIndex: number) => {\r\n // istanbul ignore else\r\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\r\n const newSelection = optionValues[itemIndex];\r\n const listElement = listRef.current as HTMLUListElement;\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n const optionToFocus = listElement.querySelector(`li[data-value=\"${newSelection.value}\"]`) as HTMLLIElement | null;\r\n // istanbul ignore else\r\n if (optionToFocus && listElement) {\r\n let newScrollTop = listElement.scrollTop;\r\n\r\n // istanbul ignore next\r\n if (listElement.scrollHeight > listElement.clientHeight) {\r\n const scrollBottom = listElement.clientHeight + listElement.scrollTop;\r\n const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;\r\n if (elementBottom > scrollBottom) {\r\n newScrollTop = elementBottom - listElement.clientHeight;\r\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\r\n newScrollTop = optionToFocus.offsetTop;\r\n }\r\n scrollTopRef.current = newScrollTop;\r\n }\r\n setFocusValue(newSelection.value);\r\n }\r\n }\r\n }, [optionValues]);\r\n\r\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n if (optionValues.length < 1)\r\n return;\r\n\r\n const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));\r\n\r\n if (event.key === SpecialKey.Space) {\r\n event.preventDefault();\r\n // istanbul ignore else\r\n if (focusValue)\r\n handleValueChange(focusValue, event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")); // Control or Command\r\n return;\r\n } else {\r\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);\r\n // istanbul ignore else\r\n if (keyProcessed) {\r\n event.preventDefault();\r\n focusOption(newItemIndex);\r\n return;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (onKeyDown)\r\n onKeyDown(event);\r\n }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);\r\n\r\n const isInitialMount = React.useRef(true);\r\n\r\n React.useEffect(() => {\r\n const list = listRef.current as HTMLUListElement;\r\n\r\n if (isInitialMount.current) {\r\n isInitialMount.current = false;\r\n\r\n if (undefined !== focusValue) {\r\n const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));\r\n focusOption(itemIndex);\r\n }\r\n } else {\r\n list.scrollTop = scrollTopRef.current;\r\n }\r\n }, [focusValue, focusOption, optionValues]);\r\n\r\n // istanbul ignore next\r\n const handleOnScroll = React.useCallback((_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\r\n if (listRef.current)\r\n scrollTopRef.current = listRef.current.scrollTop;\r\n }, []);\r\n\r\n // istanbul ignore next\r\n const handleOnFocus = React.useCallback((_event: React.FocusEvent<HTMLUListElement>) => {\r\n if (!focusValue || 0 === focusValue.length) {\r\n if (currentValue) {\r\n setFocusValue(currentValue);\r\n } else {\r\n if (optionValues.length > 0)\r\n setFocusValue(optionValues[0].value);\r\n }\r\n }\r\n }, [currentValue, focusValue, optionValues]);\r\n\r\n return <ul\r\n className={classes}\r\n // If the listbox is not part of another widget, then it has a visible\r\n // label referenced by `aria-labelledby` on the element with role\r\n // `listbox`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\r\n // avoid confusion.\r\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\r\n aria-label={ariaLabel}\r\n // An element that contains or owns all the listbox options has role\r\n // listbox.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n role=\"listbox\"\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\r\n tabIndex={0}\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\r\n aria-activedescendant={makeId(currentValue, listId)}\r\n {...otherProps}\r\n ref={listRef}\r\n id={listId}\r\n onKeyDown={handleKeyDown}\r\n onScroll={handleOnScroll}\r\n data-value={currentValue}\r\n data-focusvalue={focusValue}\r\n onFocus={handleOnFocus}\r\n >\r\n <ListboxContext.Provider\r\n value={{\r\n listboxValue: currentValue,\r\n focusValue,\r\n listboxId: listId,\r\n onListboxValueChange: handleValueChange,\r\n listboxRef: listRef,\r\n }}\r\n >\r\n {children}\r\n </ListboxContext.Provider>\r\n </ul>;\r\n}\r\n\r\n/**\r\n * `ListboxItem` component.\r\n * @alpha\r\n */\r\nexport function ListboxItem(props: ListboxItemProps) {\r\n const {\r\n children,\r\n value,\r\n className,\r\n disabled,\r\n ...otherProps\r\n } = props;\r\n\r\n const {\r\n listboxValue,\r\n focusValue,\r\n listboxId,\r\n onListboxValueChange,\r\n } = React.useContext(ListboxContext);\r\n\r\n const hasFocus = focusValue === value;\r\n\r\n const classes = React.useMemo(() => classnames(\"core-listbox-item\", hasFocus && \"focused\", className), [className, hasFocus]);\r\n const itemRef = React.useRef<HTMLLIElement>(null);\r\n const isSelected = listboxValue === value;\r\n\r\n const handleClick = React.useCallback((event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\r\n event.preventDefault();\r\n // istanbul ignore next\r\n const selectedValue = event.currentTarget?.dataset?.value;\r\n // istanbul ignore else\r\n if (undefined !== selectedValue) {\r\n onListboxValueChange(selectedValue, event.ctrlKey);\r\n }\r\n }, [onListboxValueChange]);\r\n\r\n const getItemId = React.useCallback(() => {\r\n return makeId(value, listboxId);\r\n }, [listboxId, value]);\r\n\r\n return (\r\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\r\n <li\r\n // In a single-select listbox, the selected option has `aria-selected`\r\n // set to `true`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n aria-selected={isSelected}\r\n // Applicable to all host language elements regardless of whether a\r\n // `role` is applied.\r\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\r\n aria-disabled={disabled || undefined}\r\n // Each option in the listbox has role `option` and is a DOM descendant\r\n // of the element with role `listbox`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n role=\"option\"\r\n className={classes}\r\n {...otherProps}\r\n ref={itemRef}\r\n id={getItemId()}\r\n // used for css styling\r\n data-value={value}\r\n onClick={handleClick}\r\n >\r\n {children}\r\n </li>\r\n );\r\n}\r\n"]}
1
+ {"version":3,"file":"Listbox.js","sourceRoot":"","sources":["../../../../src/core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a,GAAG,KAAK,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC;QAC1D,uBAAuB;QACvB,IAAI,SAAS,KAAK,aAAa,EAAE;YAC/B,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;SACpD;IACH,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QACvC,OAAO,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO;IACL,iEAAiE;IACjE,6CAIiB,UAAU,mBAIV,QAAQ,IAAI,SAAS;QACpC,uEAAuE;QACvE,sCAAsC;QACtC,wDAAwD;QACxD,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,OAAO,KACd,UAAU,EACd,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,SAAS,EAAE,gBAEH,KAAK,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACN,CACN,CAAC;AACJ,CAAC;AA9DD,kCA8DC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nimport * as React from \"react\";\r\nimport classnames from \"classnames\";\r\n\r\nimport \"./Listbox.scss\";\r\nimport { Guid } from \"@itwin/core-bentley\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\n\r\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\r\n\r\n/**\r\n * `Listbox` value.\r\n * @alpha\r\n */\r\nexport type ListboxValue = string;\r\n\r\n/**\r\n * `Listbox` Props.\r\n * @alpha\r\n */\r\nexport interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {\r\n id?: string;\r\n selectedValue?: ListboxValue;\r\n ariaLabel?: any;\r\n ariaLabelledBy?: any;\r\n onListboxValueChange?: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\r\n}\r\n\r\n/**\r\n * `ListboxItem` Props.\r\n * @alpha\r\n */\r\nexport interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {\r\n /** The unique item's value. */\r\n value: ListboxValue;\r\n /** set if item is disabled. */\r\n disabled?: boolean;\r\n}\r\n\r\n/**\r\n * `Listbox` Context.\r\n * @alpha\r\n */\r\nexport interface ListboxContextProps {\r\n listboxId?: string;\r\n listboxValue?: ListboxValue;\r\n focusValue?: ListboxValue;\r\n onListboxValueChange: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\r\n listboxRef?: React.RefObject<HTMLUListElement>;\r\n}\r\n\r\n/**\r\n * Context set up by listbox for use by `ListboxItems` .\r\n * @alpha\r\n */\r\n// istanbul ignore next\r\nexport const ListboxContext = React.createContext<ListboxContextProps>({ onListboxValueChange: (_newValue: ListboxValue | undefined) => { } }); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\nfunction makeId(...args: Array<string | number | null | undefined>) {\r\n return args.filter((val) => val != null).join(\"--\");\r\n}\r\n\r\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\r\n return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => ((optionNode as React.ReactElement).props as ListboxItemProps));\r\n}\r\n\r\nfunction processKeyboardNavigation(optionValues: ListboxItemProps[], itemIndex: number, key: string): [number, boolean] {\r\n let keyProcessed = false;\r\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\r\n\r\n // Note: In aria example Page Up/Down just moves up or down by one item. See https://www.w3.org/TR/wai-aria-practices-1.1/examples/listbox/js/listbox.js\r\n if (key === SpecialKey.ArrowDown || key === SpecialKey.PageDown) {\r\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.ArrowUp || key === SpecialKey.PageUp) {\r\n for (let i = itemIndex - 1; i >= 0; i--) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.Home) {\r\n for (let i = 0; i < optionValues.length; i++) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n } else if (key === SpecialKey.End) {\r\n for (let i = optionValues.length - 1; i >= 0; i--) {\r\n if (!optionValues[i].disabled) {\r\n newIndex = i;\r\n break;\r\n }\r\n }\r\n keyProcessed = true;\r\n }\r\n return [newIndex, keyProcessed];\r\n}\r\n\r\n/**\r\n * Single select `Listbox` component\r\n * @alpha\r\n */\r\nexport function Listbox(props: ListboxProps) {\r\n const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;\r\n const listRef = React.useRef<HTMLUListElement>(null);\r\n const [listId] = React.useState(() => { return id ?? Guid.createValue(); });\r\n const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);\r\n const classes = React.useMemo(() => classnames(\"core-listbox\", className), [className]);\r\n const [currentValue, setCurrentValue] = React.useState<ListboxValue | undefined>(selectedValue);\r\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(currentValue);\r\n\r\n React.useEffect(() => {\r\n setCurrentValue(selectedValue);\r\n setFocusValue(selectedValue);\r\n }, [selectedValue]);\r\n\r\n const scrollTopRef = React.useRef(0);\r\n const handleValueChange = React.useCallback((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\r\n // istanbul ignore else\r\n if (newValue !== currentValue) {\r\n setCurrentValue(newValue);\r\n setFocusValue(newValue);\r\n if (onListboxValueChange)\r\n onListboxValueChange(newValue, isControlOrCommandPressed);\r\n }\r\n }, [setCurrentValue, currentValue, onListboxValueChange]);\r\n\r\n const focusOption = React.useCallback((itemIndex: number) => {\r\n // istanbul ignore else\r\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\r\n const newSelection = optionValues[itemIndex];\r\n const listElement = listRef.current as HTMLUListElement;\r\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\r\n const optionToFocus = listElement.querySelector(`li[data-value=\"${newSelection.value}\"]`) as HTMLLIElement | null;\r\n // istanbul ignore else\r\n if (optionToFocus && listElement) {\r\n let newScrollTop = listElement.scrollTop;\r\n\r\n // istanbul ignore next\r\n if (listElement.scrollHeight > listElement.clientHeight) {\r\n const scrollBottom = listElement.clientHeight + listElement.scrollTop;\r\n const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;\r\n if (elementBottom > scrollBottom) {\r\n newScrollTop = elementBottom - listElement.clientHeight;\r\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\r\n newScrollTop = optionToFocus.offsetTop;\r\n }\r\n scrollTopRef.current = newScrollTop;\r\n }\r\n setFocusValue(newSelection.value);\r\n }\r\n }\r\n }, [optionValues]);\r\n\r\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\r\n if (optionValues.length < 1)\r\n return;\r\n\r\n const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));\r\n\r\n if (event.key === SpecialKey.Space) {\r\n event.preventDefault();\r\n // istanbul ignore else\r\n if (focusValue)\r\n handleValueChange(focusValue, event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")); // Control or Command\r\n return;\r\n } else {\r\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);\r\n // istanbul ignore else\r\n if (keyProcessed) {\r\n event.preventDefault();\r\n focusOption(newItemIndex);\r\n return;\r\n }\r\n }\r\n\r\n // istanbul ignore else\r\n if (onKeyDown)\r\n onKeyDown(event);\r\n }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);\r\n\r\n const isInitialMount = React.useRef(true);\r\n\r\n React.useEffect(() => {\r\n const list = listRef.current as HTMLUListElement;\r\n\r\n if (isInitialMount.current) {\r\n isInitialMount.current = false;\r\n\r\n if (undefined !== focusValue) {\r\n const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));\r\n focusOption(itemIndex);\r\n }\r\n } else {\r\n list.scrollTop = scrollTopRef.current;\r\n }\r\n }, [focusValue, focusOption, optionValues]);\r\n\r\n // istanbul ignore next\r\n const handleOnScroll = React.useCallback((_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\r\n if (listRef.current)\r\n scrollTopRef.current = listRef.current.scrollTop;\r\n }, []);\r\n\r\n // istanbul ignore next\r\n const handleOnFocus = React.useCallback((_event: React.FocusEvent<HTMLUListElement>) => {\r\n if (!focusValue || 0 === focusValue.length) {\r\n if (currentValue) {\r\n setFocusValue(currentValue);\r\n } else {\r\n if (optionValues.length > 0)\r\n setFocusValue(optionValues[0].value);\r\n }\r\n }\r\n }, [currentValue, focusValue, optionValues]);\r\n\r\n return <ul\r\n className={classes}\r\n // If the listbox is not part of another widget, then it has a visible\r\n // label referenced by `aria-labelledby` on the element with role\r\n // `listbox`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\r\n // avoid confusion.\r\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\r\n aria-label={ariaLabel}\r\n // An element that contains or owns all the listbox options has role\r\n // listbox.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n role=\"listbox\"\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\r\n tabIndex={0}\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\r\n aria-activedescendant={makeId(currentValue, listId)}\r\n {...otherProps}\r\n ref={listRef}\r\n id={listId}\r\n onKeyDown={handleKeyDown}\r\n onScroll={handleOnScroll}\r\n data-value={currentValue}\r\n data-focusvalue={focusValue}\r\n onFocus={handleOnFocus}\r\n >\r\n <ListboxContext.Provider\r\n value={{\r\n listboxValue: currentValue,\r\n focusValue,\r\n listboxId: listId,\r\n onListboxValueChange: handleValueChange,\r\n listboxRef: listRef,\r\n }}\r\n >\r\n {children}\r\n </ListboxContext.Provider>\r\n </ul>;\r\n}\r\n\r\n/**\r\n * `ListboxItem` component.\r\n * @alpha\r\n */\r\nexport function ListboxItem(props: ListboxItemProps) {\r\n const {\r\n children,\r\n value,\r\n className,\r\n disabled,\r\n ...otherProps\r\n } = props;\r\n\r\n const {\r\n listboxValue,\r\n focusValue,\r\n listboxId,\r\n onListboxValueChange,\r\n } = React.useContext(ListboxContext);\r\n\r\n const hasFocus = focusValue === value;\r\n\r\n const classes = React.useMemo(() => classnames(\"core-listbox-item\", hasFocus && \"focused\", className), [className, hasFocus]);\r\n const itemRef = React.useRef<HTMLLIElement>(null);\r\n const isSelected = listboxValue === value;\r\n\r\n const handleClick = React.useCallback((event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\r\n event.preventDefault();\r\n // istanbul ignore next\r\n const selectedValue = event.currentTarget?.dataset?.value;\r\n // istanbul ignore else\r\n if (undefined !== selectedValue) {\r\n onListboxValueChange(selectedValue, event.ctrlKey);\r\n }\r\n }, [onListboxValueChange]);\r\n\r\n const getItemId = React.useCallback(() => {\r\n return makeId(value, listboxId);\r\n }, [listboxId, value]);\r\n\r\n return (\r\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\r\n <li\r\n // In a single-select listbox, the selected option has `aria-selected`\r\n // set to `true`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n aria-selected={isSelected}\r\n // Applicable to all host language elements regardless of whether a\r\n // `role` is applied.\r\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\r\n aria-disabled={disabled || undefined}\r\n // Each option in the listbox has role `option` and is a DOM descendant\r\n // of the element with role `listbox`.\r\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\r\n role=\"option\"\r\n className={classes}\r\n {...otherProps}\r\n ref={itemRef}\r\n id={getItemId()}\r\n // used for css styling\r\n data-value={value}\r\n onClick={handleClick}\r\n >\r\n {children}\r\n </li>\r\n );\r\n}\r\n"]}
@@ -1,30 +1,30 @@
1
- /** @packageDocumentation
2
- * @module Loading
3
- */
4
- import "./LoadingBar.scss";
5
- import * as React from "react";
6
- import { CommonProps } from "../utils/Props";
7
- /** Properties for [[LoadingBar]] component
8
- * @public
9
- */
10
- export interface LoadingBarProps extends CommonProps {
11
- /** Percent */
12
- percent: number;
13
- /** Show percentage (optional) */
14
- showPercentage?: boolean;
15
- /** Height (in pixels) of the loading bar */
16
- barHeight: number;
17
- }
18
- /**
19
- * A loading bar with optional percentage text.
20
- * @public
21
- */
22
- export declare class LoadingBar extends React.PureComponent<LoadingBarProps> {
23
- static defaultProps: Partial<LoadingBarProps>;
24
- render(): JSX.Element;
25
- }
26
- /** Sanity check to keep percentage between 0 & 100
27
- * @internal
28
- */
29
- export declare function percentInRange(percent: number): number;
1
+ /** @packageDocumentation
2
+ * @module Loading
3
+ */
4
+ import "./LoadingBar.scss";
5
+ import * as React from "react";
6
+ import { CommonProps } from "../utils/Props";
7
+ /** Properties for [[LoadingBar]] component
8
+ * @public
9
+ */
10
+ export interface LoadingBarProps extends CommonProps {
11
+ /** Percent */
12
+ percent: number;
13
+ /** Show percentage (optional) */
14
+ showPercentage?: boolean;
15
+ /** Height (in pixels) of the loading bar */
16
+ barHeight: number;
17
+ }
18
+ /**
19
+ * A loading bar with optional percentage text.
20
+ * @public
21
+ */
22
+ export declare class LoadingBar extends React.PureComponent<LoadingBarProps> {
23
+ static defaultProps: Partial<LoadingBarProps>;
24
+ render(): JSX.Element;
25
+ }
26
+ /** Sanity check to keep percentage between 0 & 100
27
+ * @internal
28
+ */
29
+ export declare function percentInRange(percent: number): number;
30
30
  //# sourceMappingURL=LoadingBar.d.ts.map