@itwin/core-react 4.0.0-dev.2 → 4.0.0-dev.20

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 (448) hide show
  1. package/CHANGELOG.md +144 -7
  2. package/ContributeGuidelines.md +17 -14
  3. package/LICENSE.md +1 -1
  4. package/README.md +2 -2
  5. package/lib/cjs/core-react/UiCore.js +1 -1
  6. package/lib/cjs/core-react/UiCore.js.map +1 -1
  7. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts +2 -2
  8. package/lib/cjs/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  9. package/lib/cjs/core-react/autosuggest/AutoSuggest.js +1 -1
  10. package/lib/cjs/core-react/autosuggest/AutoSuggest.js.map +1 -1
  11. package/lib/cjs/core-react/autosuggest/AutoSuggest.scss +5 -8
  12. package/lib/cjs/core-react/badge/BetaBadge.d.ts +0 -1
  13. package/lib/cjs/core-react/badge/BetaBadge.d.ts.map +1 -1
  14. package/lib/cjs/core-react/badge/BetaBadge.js +0 -1
  15. package/lib/cjs/core-react/badge/BetaBadge.js.map +1 -1
  16. package/lib/cjs/core-react/badge/NewBadge.scss +1 -1
  17. package/lib/cjs/core-react/base/Gap.js +1 -1
  18. package/lib/cjs/core-react/base/Gap.js.map +1 -1
  19. package/lib/cjs/core-react/checklistbox/CheckListBox.scss +1 -2
  20. package/lib/cjs/core-react/classes.scss +0 -3
  21. package/lib/cjs/core-react/colorthemes.scss +5 -34
  22. package/lib/cjs/core-react/colorvariables.scss +53 -76
  23. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts +1 -1
  24. package/lib/cjs/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  25. package/lib/cjs/core-react/contextmenu/ContextMenu.js +2 -3
  26. package/lib/cjs/core-react/contextmenu/ContextMenu.js.map +1 -1
  27. package/lib/cjs/core-react/contextmenu/ContextMenu.scss +12 -13
  28. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js +1 -1
  29. package/lib/cjs/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  30. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
  31. package/lib/cjs/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  32. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js +5 -2
  33. package/lib/cjs/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  34. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  35. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js +6 -4
  36. package/lib/cjs/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  37. package/lib/cjs/core-react/contextmenu/TildeFinder.js +1 -1
  38. package/lib/cjs/core-react/contextmenu/TildeFinder.js.map +1 -1
  39. package/lib/cjs/core-react/dialog/Dialog.d.ts.map +1 -1
  40. package/lib/cjs/core-react/dialog/Dialog.js +18 -10
  41. package/lib/cjs/core-react/dialog/Dialog.js.map +1 -1
  42. package/lib/cjs/core-react/dialog/Dialog.scss +23 -22
  43. package/lib/cjs/core-react/dialog/GlobalDialog.js +1 -2
  44. package/lib/cjs/core-react/dialog/GlobalDialog.js.map +1 -1
  45. package/lib/cjs/core-react/elementseparator/ElementSeparator.js +2 -2
  46. package/lib/cjs/core-react/elementseparator/ElementSeparator.js.map +1 -1
  47. package/lib/cjs/core-react/elementseparator/ElementSeparator.scss +1 -1
  48. package/lib/cjs/core-react/expandable/ExpandableList.js +1 -1
  49. package/lib/cjs/core-react/expandable/ExpandableList.js.map +1 -1
  50. package/lib/cjs/core-react/expandable/list.scss +5 -5
  51. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
  52. package/lib/cjs/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  53. package/lib/cjs/core-react/hocs/withOnOutsideClick.js +1 -2
  54. package/lib/cjs/core-react/hocs/withOnOutsideClick.js.map +1 -1
  55. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts +27 -0
  56. package/lib/cjs/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
  57. package/lib/cjs/core-react/icons/ConditionalIconItem.js +65 -0
  58. package/lib/cjs/core-react/icons/ConditionalIconItem.js.map +1 -0
  59. package/lib/cjs/core-react/icons/IconComponent.d.ts +3 -2
  60. package/lib/cjs/core-react/icons/IconComponent.d.ts.map +1 -1
  61. package/lib/cjs/core-react/icons/IconComponent.js +1 -7
  62. package/lib/cjs/core-react/icons/IconComponent.js.map +1 -1
  63. package/lib/cjs/core-react/icons/SvgPath.d.ts +1 -1
  64. package/lib/cjs/core-react/icons/SvgPath.d.ts.map +1 -1
  65. package/lib/cjs/core-react/icons/SvgPath.js +2 -2
  66. package/lib/cjs/core-react/icons/SvgPath.js.map +1 -1
  67. package/lib/cjs/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
  68. package/lib/cjs/core-react/icons/WebFontIcon.d.ts +0 -1
  69. package/lib/cjs/core-react/icons/WebFontIcon.d.ts.map +1 -1
  70. package/lib/cjs/core-react/icons/WebFontIcon.js +0 -1
  71. package/lib/cjs/core-react/icons/WebFontIcon.js.map +1 -1
  72. package/lib/cjs/core-react/icons/variables.scss +0 -9
  73. package/lib/cjs/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
  74. package/lib/cjs/core-react/index.scss +0 -2
  75. package/lib/cjs/core-react/inputs/InputLabel.d.ts.map +1 -1
  76. package/lib/cjs/core-react/inputs/InputLabel.js +9 -1
  77. package/lib/cjs/core-react/inputs/InputLabel.js.map +1 -1
  78. package/lib/cjs/core-react/inputs/input-label.scss +2 -2
  79. package/lib/cjs/core-react/inputs/input.scss +7 -7
  80. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
  81. package/lib/cjs/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  82. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js +13 -8
  83. package/lib/cjs/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  84. package/lib/cjs/core-react/inputs/numberinput/NumberInput.scss +12 -13
  85. package/lib/cjs/core-react/inputs/variables.scss +4 -4
  86. package/lib/cjs/core-react/listbox/Listbox.d.ts +1 -1
  87. package/lib/cjs/core-react/listbox/Listbox.d.ts.map +1 -1
  88. package/lib/cjs/core-react/listbox/Listbox.js +2 -3
  89. package/lib/cjs/core-react/listbox/Listbox.js.map +1 -1
  90. package/lib/cjs/core-react/listbox/Listbox.scss +8 -8
  91. package/lib/cjs/core-react/loading/LoadingBar.js +1 -1
  92. package/lib/cjs/core-react/loading/LoadingBar.js.map +1 -1
  93. package/lib/cjs/core-react/loading/LoadingPrompt.js +1 -1
  94. package/lib/cjs/core-react/loading/LoadingPrompt.js.map +1 -1
  95. package/lib/cjs/core-react/loading/LoadingPrompt.scss +2 -2
  96. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts +1 -1
  97. package/lib/cjs/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  98. package/lib/cjs/core-react/loading/LoadingSpinner.js +1 -1
  99. package/lib/cjs/core-react/loading/LoadingSpinner.js.map +1 -1
  100. package/lib/cjs/core-react/loading/LoadingSpinner.scss +1 -1
  101. package/lib/cjs/core-react/loading/LoadingStatus.js +1 -1
  102. package/lib/cjs/core-react/loading/LoadingStatus.js.map +1 -1
  103. package/lib/cjs/core-react/messagebox/MessageBox.d.ts +13 -1
  104. package/lib/cjs/core-react/messagebox/MessageBox.d.ts.map +1 -1
  105. package/lib/cjs/core-react/messagebox/MessageBox.js +55 -11
  106. package/lib/cjs/core-react/messagebox/MessageBox.js.map +1 -1
  107. package/lib/cjs/core-react/messagebox/MessageBox.scss +24 -14
  108. package/lib/cjs/core-react/notification/MessageRenderer.js +1 -1
  109. package/lib/cjs/core-react/notification/MessageRenderer.js.map +1 -1
  110. package/lib/cjs/core-react/notification/MessageType.d.ts +1 -1
  111. package/lib/cjs/core-react/notification/MessageType.d.ts.map +1 -1
  112. package/lib/cjs/core-react/popup/Popup.d.ts.map +1 -1
  113. package/lib/cjs/core-react/popup/Popup.js +7 -8
  114. package/lib/cjs/core-react/popup/Popup.js.map +1 -1
  115. package/lib/cjs/core-react/popup/Popup.scss +5 -5
  116. package/lib/cjs/core-react/radialmenu/RadialMenu.js +1 -1
  117. package/lib/cjs/core-react/radialmenu/RadialMenu.js.map +1 -1
  118. package/lib/cjs/core-react/radialmenu/RadialMenu.scss +1 -1
  119. package/lib/cjs/core-react/searchbox/SearchBox.d.ts.map +1 -1
  120. package/lib/cjs/core-react/searchbox/SearchBox.js +8 -6
  121. package/lib/cjs/core-react/searchbox/SearchBox.js.map +1 -1
  122. package/lib/cjs/core-react/searchbox/SearchBox.scss +5 -9
  123. package/lib/cjs/core-react/settings/SettingsContainer.js +1 -1
  124. package/lib/cjs/core-react/settings/SettingsContainer.js.map +1 -1
  125. package/lib/cjs/core-react/settings/SettingsContainer.scss +3 -1
  126. package/lib/cjs/core-react/style/index.scss +0 -7
  127. package/lib/cjs/core-react/style/mixins.scss +2 -2
  128. package/lib/cjs/core-react/style/themecolors.scss +0 -6
  129. package/lib/cjs/core-react/tabs/tabs.scss +10 -20
  130. package/lib/cjs/core-react/tabs/vertical.scss +6 -13
  131. package/lib/cjs/core-react/text/BlockText.d.ts.map +1 -1
  132. package/lib/cjs/core-react/text/BlockText.js +1 -0
  133. package/lib/cjs/core-react/text/BlockText.js.map +1 -1
  134. package/lib/cjs/core-react/text/BodyText.d.ts +1 -0
  135. package/lib/cjs/core-react/text/BodyText.d.ts.map +1 -1
  136. package/lib/cjs/core-react/text/BodyText.js +2 -0
  137. package/lib/cjs/core-react/text/BodyText.js.map +1 -1
  138. package/lib/cjs/core-react/text/DisabledText.d.ts.map +1 -1
  139. package/lib/cjs/core-react/text/DisabledText.js +1 -0
  140. package/lib/cjs/core-react/text/DisabledText.js.map +1 -1
  141. package/lib/cjs/core-react/text/FilteredText.js +3 -3
  142. package/lib/cjs/core-react/text/FilteredText.js.map +1 -1
  143. package/lib/cjs/core-react/text/MutedText.d.ts +1 -0
  144. package/lib/cjs/core-react/text/MutedText.d.ts.map +1 -1
  145. package/lib/cjs/core-react/text/MutedText.js +2 -0
  146. package/lib/cjs/core-react/text/MutedText.js.map +1 -1
  147. package/lib/cjs/core-react/text/StyledText.d.ts +1 -0
  148. package/lib/cjs/core-react/text/StyledText.d.ts.map +1 -1
  149. package/lib/cjs/core-react/text/StyledText.js +1 -0
  150. package/lib/cjs/core-react/text/StyledText.js.map +1 -1
  151. package/lib/cjs/core-react/text/block.scss +9 -4
  152. package/lib/cjs/core-react/text/body.scss +7 -4
  153. package/lib/cjs/core-react/text/mixins.scss +3 -3
  154. package/lib/cjs/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  155. package/lib/cjs/core-react/tree/ExpansionToggle.js +3 -1
  156. package/lib/cjs/core-react/tree/ExpansionToggle.js.map +1 -1
  157. package/lib/cjs/core-react/tree/ExpansionToggle.scss +9 -5
  158. package/lib/cjs/core-react/tree/Node.d.ts +2 -2
  159. package/lib/cjs/core-react/tree/Node.d.ts.map +1 -1
  160. package/lib/cjs/core-react/tree/Node.js +2 -3
  161. package/lib/cjs/core-react/tree/Node.js.map +1 -1
  162. package/lib/cjs/core-react/tree/Node.scss +3 -19
  163. package/lib/cjs/core-react/tree/Placeholder.scss +1 -4
  164. package/lib/cjs/core-react/utils/IconWebComponent.js +1 -1
  165. package/lib/cjs/core-react/utils/IconWebComponent.js.map +1 -1
  166. package/lib/cjs/core-react/utils/Point.js +4 -4
  167. package/lib/cjs/core-react/utils/Point.js.map +1 -1
  168. package/lib/cjs/core-react/utils/Props.d.ts +1 -1
  169. package/lib/cjs/core-react/utils/Props.d.ts.map +1 -1
  170. package/lib/cjs/core-react/utils/Rectangle.js +7 -7
  171. package/lib/cjs/core-react/utils/Rectangle.js.map +1 -1
  172. package/lib/cjs/core-react/utils/Size.js +4 -4
  173. package/lib/cjs/core-react/utils/Size.js.map +1 -1
  174. package/lib/cjs/core-react/utils/Timer.d.ts +1 -1
  175. package/lib/cjs/core-react/utils/Timer.d.ts.map +1 -1
  176. package/lib/cjs/core-react/utils/getBestBWContrastColor.js +3 -3
  177. package/lib/cjs/core-react/utils/getBestBWContrastColor.js.map +1 -1
  178. package/lib/cjs/core-react/utils/getCssVariable.js +1 -1
  179. package/lib/cjs/core-react/utils/getCssVariable.js.map +1 -1
  180. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
  181. package/lib/cjs/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  182. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  183. package/lib/cjs/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  184. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
  185. package/lib/cjs/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  186. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  187. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js +2 -2
  188. package/lib/cjs/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  189. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts +1 -1
  190. package/lib/cjs/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  191. package/lib/cjs/core-react/utils/hooks/useRefs.js.map +1 -1
  192. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js +8 -13
  193. package/lib/cjs/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  194. package/lib/cjs/core-react/utils/typeUtils.d.ts +1 -1
  195. package/lib/cjs/core-react/utils/typeUtils.d.ts.map +1 -1
  196. package/lib/cjs/core-react.d.ts +1 -1
  197. package/lib/cjs/core-react.d.ts.map +1 -1
  198. package/lib/cjs/core-react.js +6 -2
  199. package/lib/cjs/core-react.js.map +1 -1
  200. package/lib/esm/core-react/UiCore.js +2 -1
  201. package/lib/esm/core-react/UiCore.js.map +1 -1
  202. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts +2 -2
  203. package/lib/esm/core-react/autosuggest/AutoSuggest.d.ts.map +1 -1
  204. package/lib/esm/core-react/autosuggest/AutoSuggest.js +1 -1
  205. package/lib/esm/core-react/autosuggest/AutoSuggest.js.map +1 -1
  206. package/lib/esm/core-react/autosuggest/AutoSuggest.scss +5 -8
  207. package/lib/esm/core-react/badge/BetaBadge.d.ts +0 -1
  208. package/lib/esm/core-react/badge/BetaBadge.d.ts.map +1 -1
  209. package/lib/esm/core-react/badge/BetaBadge.js +0 -1
  210. package/lib/esm/core-react/badge/BetaBadge.js.map +1 -1
  211. package/lib/esm/core-react/badge/NewBadge.scss +1 -1
  212. package/lib/esm/core-react/base/Gap.js +1 -1
  213. package/lib/esm/core-react/base/Gap.js.map +1 -1
  214. package/lib/esm/core-react/checklistbox/CheckListBox.scss +1 -2
  215. package/lib/esm/core-react/classes.scss +0 -3
  216. package/lib/esm/core-react/colorthemes.scss +5 -34
  217. package/lib/esm/core-react/colorvariables.scss +53 -76
  218. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts +1 -1
  219. package/lib/esm/core-react/contextmenu/ContextMenu.d.ts.map +1 -1
  220. package/lib/esm/core-react/contextmenu/ContextMenu.js +3 -3
  221. package/lib/esm/core-react/contextmenu/ContextMenu.js.map +1 -1
  222. package/lib/esm/core-react/contextmenu/ContextMenu.scss +12 -13
  223. package/lib/esm/core-react/contextmenu/ContextMenuItem.js +2 -1
  224. package/lib/esm/core-react/contextmenu/ContextMenuItem.js.map +1 -1
  225. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts +1 -1
  226. package/lib/esm/core-react/contextmenu/ContextSubMenu.d.ts.map +1 -1
  227. package/lib/esm/core-react/contextmenu/ContextSubMenu.js +6 -2
  228. package/lib/esm/core-react/contextmenu/ContextSubMenu.js.map +1 -1
  229. package/lib/esm/core-react/contextmenu/GlobalContextMenu.d.ts.map +1 -1
  230. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js +6 -4
  231. package/lib/esm/core-react/contextmenu/GlobalContextMenu.js.map +1 -1
  232. package/lib/esm/core-react/contextmenu/TildeFinder.js +2 -1
  233. package/lib/esm/core-react/contextmenu/TildeFinder.js.map +1 -1
  234. package/lib/esm/core-react/dialog/Dialog.d.ts.map +1 -1
  235. package/lib/esm/core-react/dialog/Dialog.js +19 -10
  236. package/lib/esm/core-react/dialog/Dialog.js.map +1 -1
  237. package/lib/esm/core-react/dialog/Dialog.scss +23 -22
  238. package/lib/esm/core-react/dialog/GlobalDialog.js +1 -2
  239. package/lib/esm/core-react/dialog/GlobalDialog.js.map +1 -1
  240. package/lib/esm/core-react/elementseparator/ElementSeparator.js +2 -2
  241. package/lib/esm/core-react/elementseparator/ElementSeparator.js.map +1 -1
  242. package/lib/esm/core-react/elementseparator/ElementSeparator.scss +1 -1
  243. package/lib/esm/core-react/expandable/ExpandableList.js +2 -1
  244. package/lib/esm/core-react/expandable/ExpandableList.js.map +1 -1
  245. package/lib/esm/core-react/expandable/list.scss +5 -5
  246. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts +1 -1
  247. package/lib/esm/core-react/focus/ItemKeyboardNavigator.d.ts.map +1 -1
  248. package/lib/esm/core-react/hocs/withOnOutsideClick.js +1 -2
  249. package/lib/esm/core-react/hocs/withOnOutsideClick.js.map +1 -1
  250. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts +27 -0
  251. package/lib/esm/core-react/icons/ConditionalIconItem.d.ts.map +1 -0
  252. package/lib/esm/core-react/icons/ConditionalIconItem.js +61 -0
  253. package/lib/esm/core-react/icons/ConditionalIconItem.js.map +1 -0
  254. package/lib/esm/core-react/icons/IconComponent.d.ts +3 -2
  255. package/lib/esm/core-react/icons/IconComponent.d.ts.map +1 -1
  256. package/lib/esm/core-react/icons/IconComponent.js +1 -7
  257. package/lib/esm/core-react/icons/IconComponent.js.map +1 -1
  258. package/lib/esm/core-react/icons/SvgPath.d.ts +1 -1
  259. package/lib/esm/core-react/icons/SvgPath.d.ts.map +1 -1
  260. package/lib/esm/core-react/icons/SvgPath.js +2 -2
  261. package/lib/esm/core-react/icons/SvgPath.js.map +1 -1
  262. package/lib/esm/core-react/icons/{SvgSprite.scss → SvgPath.scss} +1 -1
  263. package/lib/esm/core-react/icons/WebFontIcon.d.ts +0 -1
  264. package/lib/esm/core-react/icons/WebFontIcon.d.ts.map +1 -1
  265. package/lib/esm/core-react/icons/WebFontIcon.js +0 -1
  266. package/lib/esm/core-react/icons/WebFontIcon.js.map +1 -1
  267. package/lib/esm/core-react/icons/variables.scss +0 -9
  268. package/lib/esm/core-react/imagecheckbox/ImageCheckBox.scss +2 -2
  269. package/lib/esm/core-react/index.scss +0 -2
  270. package/lib/esm/core-react/inputs/InputLabel.d.ts.map +1 -1
  271. package/lib/esm/core-react/inputs/InputLabel.js +9 -1
  272. package/lib/esm/core-react/inputs/InputLabel.js.map +1 -1
  273. package/lib/esm/core-react/inputs/input-label.scss +2 -2
  274. package/lib/esm/core-react/inputs/input.scss +7 -7
  275. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts +6 -1
  276. package/lib/esm/core-react/inputs/numberinput/NumberInput.d.ts.map +1 -1
  277. package/lib/esm/core-react/inputs/numberinput/NumberInput.js +13 -8
  278. package/lib/esm/core-react/inputs/numberinput/NumberInput.js.map +1 -1
  279. package/lib/esm/core-react/inputs/numberinput/NumberInput.scss +12 -13
  280. package/lib/esm/core-react/inputs/variables.scss +4 -4
  281. package/lib/esm/core-react/listbox/Listbox.d.ts +1 -1
  282. package/lib/esm/core-react/listbox/Listbox.d.ts.map +1 -1
  283. package/lib/esm/core-react/listbox/Listbox.js +2 -3
  284. package/lib/esm/core-react/listbox/Listbox.js.map +1 -1
  285. package/lib/esm/core-react/listbox/Listbox.scss +8 -8
  286. package/lib/esm/core-react/loading/LoadingBar.js +2 -1
  287. package/lib/esm/core-react/loading/LoadingBar.js.map +1 -1
  288. package/lib/esm/core-react/loading/LoadingPrompt.js +2 -1
  289. package/lib/esm/core-react/loading/LoadingPrompt.js.map +1 -1
  290. package/lib/esm/core-react/loading/LoadingPrompt.scss +2 -2
  291. package/lib/esm/core-react/loading/LoadingSpinner.d.ts +1 -1
  292. package/lib/esm/core-react/loading/LoadingSpinner.d.ts.map +1 -1
  293. package/lib/esm/core-react/loading/LoadingSpinner.js +2 -1
  294. package/lib/esm/core-react/loading/LoadingSpinner.js.map +1 -1
  295. package/lib/esm/core-react/loading/LoadingSpinner.scss +1 -1
  296. package/lib/esm/core-react/loading/LoadingStatus.js +2 -1
  297. package/lib/esm/core-react/loading/LoadingStatus.js.map +1 -1
  298. package/lib/esm/core-react/messagebox/MessageBox.d.ts +13 -1
  299. package/lib/esm/core-react/messagebox/MessageBox.d.ts.map +1 -1
  300. package/lib/esm/core-react/messagebox/MessageBox.js +56 -11
  301. package/lib/esm/core-react/messagebox/MessageBox.js.map +1 -1
  302. package/lib/esm/core-react/messagebox/MessageBox.scss +24 -14
  303. package/lib/esm/core-react/notification/MessageRenderer.js +1 -1
  304. package/lib/esm/core-react/notification/MessageRenderer.js.map +1 -1
  305. package/lib/esm/core-react/notification/MessageType.d.ts +1 -1
  306. package/lib/esm/core-react/notification/MessageType.d.ts.map +1 -1
  307. package/lib/esm/core-react/popup/Popup.d.ts.map +1 -1
  308. package/lib/esm/core-react/popup/Popup.js +8 -8
  309. package/lib/esm/core-react/popup/Popup.js.map +1 -1
  310. package/lib/esm/core-react/popup/Popup.scss +5 -5
  311. package/lib/esm/core-react/radialmenu/RadialMenu.js +2 -1
  312. package/lib/esm/core-react/radialmenu/RadialMenu.js.map +1 -1
  313. package/lib/esm/core-react/radialmenu/RadialMenu.scss +1 -1
  314. package/lib/esm/core-react/searchbox/SearchBox.d.ts.map +1 -1
  315. package/lib/esm/core-react/searchbox/SearchBox.js +8 -6
  316. package/lib/esm/core-react/searchbox/SearchBox.js.map +1 -1
  317. package/lib/esm/core-react/searchbox/SearchBox.scss +5 -9
  318. package/lib/esm/core-react/settings/SettingsContainer.js +1 -1
  319. package/lib/esm/core-react/settings/SettingsContainer.js.map +1 -1
  320. package/lib/esm/core-react/settings/SettingsContainer.scss +3 -1
  321. package/lib/esm/core-react/style/index.scss +0 -7
  322. package/lib/esm/core-react/style/mixins.scss +2 -2
  323. package/lib/esm/core-react/style/themecolors.scss +0 -6
  324. package/lib/esm/core-react/tabs/tabs.scss +10 -20
  325. package/lib/esm/core-react/tabs/vertical.scss +6 -13
  326. package/lib/esm/core-react/text/BlockText.d.ts.map +1 -1
  327. package/lib/esm/core-react/text/BlockText.js +1 -0
  328. package/lib/esm/core-react/text/BlockText.js.map +1 -1
  329. package/lib/esm/core-react/text/BodyText.d.ts +1 -0
  330. package/lib/esm/core-react/text/BodyText.d.ts.map +1 -1
  331. package/lib/esm/core-react/text/BodyText.js +2 -0
  332. package/lib/esm/core-react/text/BodyText.js.map +1 -1
  333. package/lib/esm/core-react/text/DisabledText.d.ts.map +1 -1
  334. package/lib/esm/core-react/text/DisabledText.js +1 -0
  335. package/lib/esm/core-react/text/DisabledText.js.map +1 -1
  336. package/lib/esm/core-react/text/FilteredText.js +3 -3
  337. package/lib/esm/core-react/text/FilteredText.js.map +1 -1
  338. package/lib/esm/core-react/text/MutedText.d.ts +1 -0
  339. package/lib/esm/core-react/text/MutedText.d.ts.map +1 -1
  340. package/lib/esm/core-react/text/MutedText.js +2 -0
  341. package/lib/esm/core-react/text/MutedText.js.map +1 -1
  342. package/lib/esm/core-react/text/StyledText.d.ts +1 -0
  343. package/lib/esm/core-react/text/StyledText.d.ts.map +1 -1
  344. package/lib/esm/core-react/text/StyledText.js +1 -0
  345. package/lib/esm/core-react/text/StyledText.js.map +1 -1
  346. package/lib/esm/core-react/text/block.scss +9 -4
  347. package/lib/esm/core-react/text/body.scss +7 -4
  348. package/lib/esm/core-react/text/mixins.scss +3 -3
  349. package/lib/esm/core-react/tree/ExpansionToggle.d.ts.map +1 -1
  350. package/lib/esm/core-react/tree/ExpansionToggle.js +3 -1
  351. package/lib/esm/core-react/tree/ExpansionToggle.js.map +1 -1
  352. package/lib/esm/core-react/tree/ExpansionToggle.scss +9 -5
  353. package/lib/esm/core-react/tree/Node.d.ts +2 -2
  354. package/lib/esm/core-react/tree/Node.d.ts.map +1 -1
  355. package/lib/esm/core-react/tree/Node.js +2 -3
  356. package/lib/esm/core-react/tree/Node.js.map +1 -1
  357. package/lib/esm/core-react/tree/Node.scss +3 -19
  358. package/lib/esm/core-react/tree/Placeholder.scss +1 -4
  359. package/lib/esm/core-react/utils/IconWebComponent.js +1 -1
  360. package/lib/esm/core-react/utils/IconWebComponent.js.map +1 -1
  361. package/lib/esm/core-react/utils/Point.js +4 -4
  362. package/lib/esm/core-react/utils/Point.js.map +1 -1
  363. package/lib/esm/core-react/utils/Props.d.ts +1 -1
  364. package/lib/esm/core-react/utils/Props.d.ts.map +1 -1
  365. package/lib/esm/core-react/utils/Rectangle.js +7 -7
  366. package/lib/esm/core-react/utils/Rectangle.js.map +1 -1
  367. package/lib/esm/core-react/utils/Size.js +4 -4
  368. package/lib/esm/core-react/utils/Size.js.map +1 -1
  369. package/lib/esm/core-react/utils/Timer.d.ts +1 -1
  370. package/lib/esm/core-react/utils/Timer.d.ts.map +1 -1
  371. package/lib/esm/core-react/utils/getBestBWContrastColor.js +3 -3
  372. package/lib/esm/core-react/utils/getBestBWContrastColor.js.map +1 -1
  373. package/lib/esm/core-react/utils/getCssVariable.js +1 -1
  374. package/lib/esm/core-react/utils/getCssVariable.js.map +1 -1
  375. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts +1 -1
  376. package/lib/esm/core-react/utils/hooks/ResizeObserverPolyfill.d.ts.map +1 -1
  377. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js +1 -2
  378. package/lib/esm/core-react/utils/hooks/useCrossOriginPopup.js.map +1 -1
  379. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts +1 -1
  380. package/lib/esm/core-react/utils/hooks/useOnOutsideClick.d.ts.map +1 -1
  381. package/lib/esm/core-react/utils/hooks/useProximityToMouse.d.ts.map +1 -1
  382. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js +2 -2
  383. package/lib/esm/core-react/utils/hooks/useProximityToMouse.js.map +1 -1
  384. package/lib/esm/core-react/utils/hooks/useRefs.d.ts +1 -1
  385. package/lib/esm/core-react/utils/hooks/useRefs.d.ts.map +1 -1
  386. package/lib/esm/core-react/utils/hooks/useRefs.js.map +1 -1
  387. package/lib/esm/core-react/utils/hooks/useResizeObserver.js +8 -13
  388. package/lib/esm/core-react/utils/hooks/useResizeObserver.js.map +1 -1
  389. package/lib/esm/core-react/utils/typeUtils.d.ts +1 -1
  390. package/lib/esm/core-react/utils/typeUtils.d.ts.map +1 -1
  391. package/lib/esm/core-react.d.ts +1 -1
  392. package/lib/esm/core-react.d.ts.map +1 -1
  393. package/lib/esm/core-react.js +1 -1
  394. package/lib/esm/core-react.js.map +1 -1
  395. package/package.json +26 -26
  396. package/ThirdPartyNotices.md +0 -28
  397. package/lib/cjs/core-react/badge/BetaBadge.scss +0 -9
  398. package/lib/cjs/core-react/button/blue-large.scss +0 -12
  399. package/lib/cjs/core-react/button/blue.scss +0 -25
  400. package/lib/cjs/core-react/button/button.scss +0 -70
  401. package/lib/cjs/core-react/button/classes.scss +0 -14
  402. package/lib/cjs/core-react/button/disabled-large.scss +0 -12
  403. package/lib/cjs/core-react/button/disabled.scss +0 -17
  404. package/lib/cjs/core-react/button/hollow-large.scss +0 -13
  405. package/lib/cjs/core-react/button/hollow.scss +0 -30
  406. package/lib/cjs/core-react/button/index.scss +0 -14
  407. package/lib/cjs/core-react/button/primary-large.scss +0 -12
  408. package/lib/cjs/core-react/button/primary.scss +0 -25
  409. package/lib/cjs/core-react/button/variables.scss +0 -22
  410. package/lib/cjs/core-react/checkbox/checkbox.scss +0 -124
  411. package/lib/cjs/core-react/checkbox/classes.scss +0 -8
  412. package/lib/cjs/core-react/checkbox/index.scss +0 -8
  413. package/lib/cjs/core-react/icons/SvgSprite.d.ts +0 -21
  414. package/lib/cjs/core-react/icons/SvgSprite.d.ts.map +0 -1
  415. package/lib/cjs/core-react/icons/SvgSprite.js +0 -27
  416. package/lib/cjs/core-react/icons/SvgSprite.js.map +0 -1
  417. package/lib/cjs/core-react/style/data-viz.scss +0 -20
  418. package/lib/cjs/core-react/style/itwinui-overrides.scss +0 -24
  419. package/lib/cjs/core-react/style/space.scss +0 -13
  420. package/lib/cjs/core-react/style/speed.scss +0 -12
  421. package/lib/cjs/core-react/style/typography.scss +0 -44
  422. package/lib/cjs/core-react/style/variables.scss +0 -12
  423. package/lib/esm/core-react/badge/BetaBadge.scss +0 -9
  424. package/lib/esm/core-react/button/blue-large.scss +0 -12
  425. package/lib/esm/core-react/button/blue.scss +0 -25
  426. package/lib/esm/core-react/button/button.scss +0 -70
  427. package/lib/esm/core-react/button/classes.scss +0 -14
  428. package/lib/esm/core-react/button/disabled-large.scss +0 -12
  429. package/lib/esm/core-react/button/disabled.scss +0 -17
  430. package/lib/esm/core-react/button/hollow-large.scss +0 -13
  431. package/lib/esm/core-react/button/hollow.scss +0 -30
  432. package/lib/esm/core-react/button/index.scss +0 -14
  433. package/lib/esm/core-react/button/primary-large.scss +0 -12
  434. package/lib/esm/core-react/button/primary.scss +0 -25
  435. package/lib/esm/core-react/button/variables.scss +0 -22
  436. package/lib/esm/core-react/checkbox/checkbox.scss +0 -124
  437. package/lib/esm/core-react/checkbox/classes.scss +0 -8
  438. package/lib/esm/core-react/checkbox/index.scss +0 -8
  439. package/lib/esm/core-react/icons/SvgSprite.d.ts +0 -21
  440. package/lib/esm/core-react/icons/SvgSprite.d.ts.map +0 -1
  441. package/lib/esm/core-react/icons/SvgSprite.js +0 -23
  442. package/lib/esm/core-react/icons/SvgSprite.js.map +0 -1
  443. package/lib/esm/core-react/style/data-viz.scss +0 -20
  444. package/lib/esm/core-react/style/itwinui-overrides.scss +0 -24
  445. package/lib/esm/core-react/style/space.scss +0 -13
  446. package/lib/esm/core-react/style/speed.scss +0 -12
  447. package/lib/esm/core-react/style/typography.scss +0 -44
  448. package/lib/esm/core-react/style/variables.scss +0 -12
@@ -21,11 +21,11 @@
21
21
  }
22
22
 
23
23
  input[type="checkbox"]:checked + .image {
24
- color: $buic-foreground-primary;
24
+ color: var(--iui-color-text-accent);
25
25
  }
26
26
 
27
27
  input[type="checkbox"]:not(:checked) + .image {
28
- color: $buic-foreground-body;
28
+ color: var(--iui-color-text);
29
29
  }
30
30
 
31
31
  input[type="checkbox"] + .image {
@@ -13,8 +13,6 @@
13
13
  @import "./_typography";
14
14
 
15
15
  @import "./base/index";
16
- @import "./button/index";
17
- @import "./checkbox/index";
18
16
  @import "./expandable/index";
19
17
  @import "./icons/index";
20
18
  @import "./inputs/index";
@@ -1 +1 @@
1
- {"version":3,"file":"InputLabel.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,EAAE,sBAAsB,EAAE,WAAW;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAClD,MAAM,IAAI,GAAG,CAAC,OAAO;CA2BtC"}
1
+ {"version":3,"file":"InputLabel.d.ts","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,EAAE,sBAAsB,EAAE,WAAW;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAQD;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC;IAClD,MAAM,IAAI,GAAG,CAAC,OAAO;CA2BtC"}
@@ -5,8 +5,16 @@
5
5
  /** @packageDocumentation
6
6
  * @module Inputs
7
7
  */
8
+ import { SvgStatusError, SvgStatusSuccess, SvgStatusWarning } from "@itwin/itwinui-icons-react";
8
9
  import classnames from "classnames";
9
10
  import * as React from "react";
11
+ import { Icon } from "../icons/IconComponent";
12
+ import { InputStatus } from "./InputStatus";
13
+ const inputLabelIconSpec = {
14
+ [InputStatus.Error]: React.createElement(SvgStatusError, null),
15
+ [InputStatus.Success]: React.createElement(SvgStatusSuccess, null),
16
+ [InputStatus.Warning]: React.createElement(SvgStatusWarning, null),
17
+ };
10
18
  /** Text input wrapper that provides additional styling and labeling
11
19
  * @public
12
20
  */
@@ -22,7 +30,7 @@ export class InputLabel extends React.PureComponent {
22
30
  React.createElement("div", { className: classnames("input", { "with-icon": !!status }) },
23
31
  this.props.children,
24
32
  status &&
25
- React.createElement("i", { className: classnames("icon", `icon-status-${status}`) })),
33
+ React.createElement(Icon, { className: "icon", iconSpec: inputLabelIconSpec[`{status}`] })),
26
34
  message &&
27
35
  React.createElement("div", { className: classnames("uicore-message", messageClassName), style: messageStyle }, message)));
28
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InputLabel.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,aAA8B;IAClD,MAAM;QACpB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EACrC,cAAc,EAAE,UAAU,EAC1B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzD,OAAO,CACL,+BAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CACxC,6BAA6B,EAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,iBAAiB,EACxC,MAAM,EACN,SAAS,CACV;YACE,KAAK;gBACJ,6BAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU;;oBAAI,KAAK;wBAAQ;YAEhG,6BAAK,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;gBAC3D,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACnB,MAAM;oBACL,2BAAG,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,eAAe,MAAM,EAAE,CAAC,GAAI,CAE3D;YACL,OAAO;gBACN,6BAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,IAAG,OAAO,CAAO,CAEhG,CACT,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { CommonProps } from \"../utils/Props\";\nimport { LabeledComponentProps, MessagedComponentProps } from \"./LabeledComponentProps\";\n\n/** Properties for [[InputLabel]] components\n * @public\n */\nexport interface InputLabelProps extends LabeledComponentProps, MessagedComponentProps, CommonProps {\n disabled?: boolean;\n /** Labeled content */\n children?: React.ReactNode;\n}\n\n/** Text input wrapper that provides additional styling and labeling\n * @public\n */\nexport class InputLabel extends React.PureComponent<InputLabelProps> {\n public override render(): JSX.Element {\n const { label, status, className, style,\n labelClassName, labelStyle,\n message, messageClassName, messageStyle } = this.props;\n\n return (\n <label style={style} className={classnames(\n \"uicore-inputs-labeled-input\",\n this.props.disabled && \"uicore-disabled\",\n status,\n className,\n )}>\n {label &&\n <div className={classnames(\"uicore-label\", labelClassName)} style={labelStyle}> {label} </div>\n }\n <div className={classnames(\"input\", { \"with-icon\": !!status })}>\n {this.props.children}\n {status &&\n <i className={classnames(\"icon\", `icon-status-${status}`)} />\n }\n </div>\n {message &&\n <div className={classnames(\"uicore-message\", messageClassName)} style={messageStyle}>{message}</div>\n }\n </label>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"InputLabel.js","sourceRoot":"","sources":["../../../../src/core-react/inputs/InputLabel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAY5C,MAAM,kBAAkB,GAAgC;IACtD,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,oBAAC,cAAc,OAAG;IACvC,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,oBAAC,gBAAgB,OAAG;IAC3C,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,oBAAC,gBAAgB,OAAG;CAC5C,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK,CAAC,aAA8B;IAClD,MAAM;QACpB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EACrC,cAAc,EAAE,UAAU,EAC1B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzD,OAAO,CACL,+BAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,CACxC,6BAA6B,EAC7B,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,iBAAiB,EACxC,MAAM,EACN,SAAS,CACV;YACE,KAAK;gBACJ,6BAAK,SAAS,EAAE,UAAU,CAAC,cAAc,EAAE,cAAc,CAAC,EAAE,KAAK,EAAE,UAAU;;oBAAI,KAAK;wBAAQ;YAEhG,6BAAK,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;gBAC3D,IAAI,CAAC,KAAK,CAAC,QAAQ;gBACnB,MAAM;oBACL,oBAAC,IAAI,IAAC,SAAS,EAAC,MAAM,EAAC,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC,GAAI,CAEjE;YACL,OAAO;gBACN,6BAAK,SAAS,EAAE,UAAU,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,IAAG,OAAO,CAAO,CAEhG,CACT,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport { SvgStatusError, SvgStatusSuccess, SvgStatusWarning } from \"@itwin/itwinui-icons-react\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Icon, IconSpec } from \"../icons/IconComponent\";\nimport { CommonProps } from \"../utils/Props\";\nimport { InputStatus } from \"./InputStatus\";\nimport { LabeledComponentProps, MessagedComponentProps } from \"./LabeledComponentProps\";\n\n/** Properties for [[InputLabel]] components\n * @public\n */\nexport interface InputLabelProps extends LabeledComponentProps, MessagedComponentProps, CommonProps {\n disabled?: boolean;\n /** Labeled content */\n children?: React.ReactNode;\n}\n\nconst inputLabelIconSpec: { [key: string]: IconSpec } = {\n [InputStatus.Error]: <SvgStatusError />,\n [InputStatus.Success]: <SvgStatusSuccess />,\n [InputStatus.Warning]: <SvgStatusWarning />,\n};\n\n/** Text input wrapper that provides additional styling and labeling\n * @public\n */\nexport class InputLabel extends React.PureComponent<InputLabelProps> {\n public override render(): JSX.Element {\n const { label, status, className, style,\n labelClassName, labelStyle,\n message, messageClassName, messageStyle } = this.props;\n\n return (\n <label style={style} className={classnames(\n \"uicore-inputs-labeled-input\",\n this.props.disabled && \"uicore-disabled\",\n status,\n className,\n )}>\n {label &&\n <div className={classnames(\"uicore-label\", labelClassName)} style={labelStyle}> {label} </div>\n }\n <div className={classnames(\"input\", { \"with-icon\": !!status })}>\n {this.props.children}\n {status &&\n <Icon className=\"icon\" iconSpec={inputLabelIconSpec[`{status}`]} />\n }\n </div>\n {message &&\n <div className={classnames(\"uicore-message\", messageClassName)} style={messageStyle}>{message}</div>\n }\n </label>\n );\n }\n}\n"]}
@@ -22,7 +22,7 @@
22
22
  font-weight: var(--iui-font-weight-semibold);
23
23
  line-height: var(--iui-size-l);
24
24
  text-align: left;
25
- color: $buic-text-color;
25
+ color: var(--iui-color-text);
26
26
  }
27
27
 
28
28
  > .input {
@@ -57,7 +57,7 @@
57
57
  display: block;
58
58
  font-size: var(--iui-font-size-0);
59
59
  line-height: var(--iui-size-l);
60
- color: $buic-text-color-muted;
60
+ color: var(--iui-color-text-muted);
61
61
  }
62
62
 
63
63
  /// Status colors ----------------------------------------------------------
@@ -13,10 +13,10 @@
13
13
  font-family: var(--iui-font-sans);
14
14
  font-size: var(--iui-font-size-1);
15
15
  line-height: normal;
16
- color: $buic-text-color;
16
+ color: var(--iui-color-text);
17
17
  background-color: $buic-background-control;
18
18
  background-image: none;
19
- border: 1px solid $buic-inputs-border;
19
+ border: 1px solid var(--iui-color-border-foreground);
20
20
  border-radius: var(--iui-border-radius-1);
21
21
  box-shadow: $buic-inputs-boxshadow 0px 1px 1px inset;
22
22
  box-sizing: border-box;
@@ -24,25 +24,25 @@
24
24
  box-shadow var(--iui-duration-1) ease-in-out;
25
25
 
26
26
  &:-ms-input-placeholder {
27
- color: $buic-foreground-disabled;
27
+ color: var(--iui-color-text-disabled);
28
28
  }
29
29
  &::-webkit-input-placeholder {
30
- color: $buic-foreground-disabled;
30
+ color: var(--iui-color-text-disabled);
31
31
  }
32
32
  &::placeholder {
33
- color: $buic-foreground-disabled;
33
+ color: var(--iui-color-text-disabled);
34
34
  }
35
35
 
36
36
  &[disabled] {
37
37
  background-color: $buic-background-control-disabled;
38
38
  border-color: $buic-foreground-disabled;
39
- color: $buic-foreground-disabled;
39
+ color: var(--iui-color-text-disabled);
40
40
  cursor: not-allowed;
41
41
  opacity: $uicore-opacity-disabled;
42
42
  }
43
43
 
44
44
  &[readonly] {
45
- color: $buic-foreground-muted;
45
+ color: var(--iui-color-text-muted);
46
46
  cursor: default;
47
47
  }
48
48
 
@@ -7,7 +7,7 @@ import { InputProps } from "@itwin/itwinui-react";
7
7
  /** Step function prototype for [[NumberInput]] component
8
8
  * @public
9
9
  */
10
- export declare type StepFunctionProp = number | ((direction: string) => number | undefined);
10
+ export type StepFunctionProp = number | ((direction: string) => number | undefined);
11
11
  /** Properties for the [[NumberInput]] component
12
12
  * @public
13
13
  */
@@ -38,6 +38,11 @@ export interface NumberInputProps extends Omit<InputProps, "min" | "max" | "step
38
38
  showTouchButtons?: boolean;
39
39
  /** Provides ability to return reference to HTMLInputElement */
40
40
  ref?: React.Ref<HTMLInputElement>;
41
+ /**
42
+ * Makes this component behave as controlled component.
43
+ * @internal
44
+ */
45
+ isControlled?: boolean;
41
46
  }
42
47
  /** Input component for numbers with up and down buttons to increment and decrement the value.
43
48
  * @public
@@ -1 +1 @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AG,SAAS,CAAC,CAAC;IACvD,sJAAsJ;IACtJ,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,cAAc,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5E,0HAA0H;IAC1H,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACpE,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AA6KD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,GAAG,CAAC,OAAO,GAAG,IAA4B,CAAC"}
@@ -10,9 +10,10 @@ import classnames from "classnames";
10
10
  import * as React from "react";
11
11
  import { Input } from "@itwin/itwinui-react";
12
12
  import { SpecialKey } from "@itwin/appui-abstract";
13
- import { WebFontIcon } from "../../icons/WebFontIcon";
13
+ import { Icon } from "../../icons/IconComponent";
14
+ import { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall } from "@itwin/itwinui-icons-react";
14
15
  const ForwardRefNumberInput = React.forwardRef(function ForwardRefNumberInput(props, ref) {
15
- const { containerClassName, value, min, max, precision, format, parse, onChange, onBlur, onKeyDown, step, snap, showTouchButtons, containerStyle, ...otherProps } = props;
16
+ const { containerClassName, value, min, max, precision, format, parse, onChange, onBlur, onKeyDown, step, snap, showTouchButtons, containerStyle, isControlled, ...otherProps } = props;
16
17
  const currentValueRef = React.useRef(value);
17
18
  /**
18
19
  * Used internally to parse the argument x to it's numeric representation.
@@ -58,8 +59,10 @@ const ForwardRefNumberInput = React.forwardRef(function ForwardRefNumberInput(pr
58
59
  setFormattedValue(currentFormattedValue);
59
60
  }, [formatInternal, value]);
60
61
  const handleChange = React.useCallback((event) => {
61
- setFormattedValue(event.currentTarget.value);
62
- }, []);
62
+ const newVal = event.currentTarget.value;
63
+ setFormattedValue(newVal);
64
+ isControlled && onChange && onChange(parseInternal(newVal), newVal);
65
+ }, [isControlled, onChange, parseInternal]);
63
66
  const updateValue = React.useCallback((newVal) => {
64
67
  const newFormattedVal = formatInternal(newVal);
65
68
  onChange && onChange(newVal, newFormattedVal);
@@ -131,13 +134,15 @@ const ForwardRefNumberInput = React.forwardRef(function ForwardRefNumberInput(pr
131
134
  }, []);
132
135
  const isDisabled = !!otherProps.disabled;
133
136
  const containerClasses = classnames("core-number-input-container", containerClassName, showTouchButtons && "core-number-buttons-for-touch", isDisabled && "core-number-input-disabled");
137
+ const caretUp = showTouchButtons ? React.createElement(SvgCaretUp, null) : React.createElement(SvgCaretUpSmall, null);
138
+ const caretDown = showTouchButtons ? React.createElement(SvgCaretDown, null) : React.createElement(SvgCaretDownSmall, null);
134
139
  return (React.createElement("div", { className: containerClasses, style: containerStyle },
135
140
  React.createElement(Input, { ref: ref, value: formattedValue, onChange: handleChange, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, size: "small", ...otherProps }),
136
141
  React.createElement("div", { className: classnames("core-number-input-buttons-container", showTouchButtons && "core-number-buttons-for-touch") },
137
- React.createElement("div", { className: "core-number-input-button core-number-input-button-up", tabIndex: -1, onClick: handleUpClick },
138
- React.createElement(WebFontIcon, { iconName: "icon-caret-up" })),
139
- React.createElement("div", { className: "core-number-input-button core-number-input-button-down", tabIndex: -1, onClick: handleDownClick },
140
- React.createElement(WebFontIcon, { iconName: "icon-caret-down" })))));
142
+ React.createElement("div", { className: "core-number-input-button core-number-input-button-up", tabIndex: -1, onClick: handleUpClick, role: "presentation" },
143
+ React.createElement(Icon, { iconSpec: caretUp })),
144
+ React.createElement("div", { className: "core-number-input-button core-number-input-button-down", tabIndex: -1, onClick: handleDownClick, role: "presentation" },
145
+ React.createElement(Icon, { iconSpec: caretDown })))));
141
146
  });
142
147
  /** Input component for numbers with up and down buttons to increment and decrement the value.
143
148
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/numberinput/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAc,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAuCtD,MAAM,qBAAqB,GAAG,KAAK,CAAC,UAAU,CAC5C,SAAS,qBAAqB,CAAC,KAAK,EAAE,GAAG;IACvC,MAAM,EAAE,kBAAkB,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EACnE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrG,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAE5C;;;;;;KAMC;IACD,MAAM,aAAa,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAS,EAAE,EAAE;QACpD,IAAI,CAA4B,CAAC;QAEjC,IAAI,KAAK;YACP,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACf,IAAI,SAAS,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,EAAE;YACjC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAClB,IAAI,KAAK,CAAC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AAO,EAAE,aAAa;gBACxG,oBAAC,WAAW,IAAC,QAAQ,EAAC,eAAe,GAAG,CACpC;YAEN,6BAAK,SAAS,EAAC,wDAAwD,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe;gBAC5G,oBAAC,WAAW,IAAC,QAAQ,EAAC,iBAAiB,GAAG,CACtC,CACF,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoD,qBAAqB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport \"./NumberInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Input, InputProps } from \"@itwin/itwinui-react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { WebFontIcon } from \"../../icons/WebFontIcon\";\n\n/** Step function prototype for [[NumberInput]] component\n * @public\n */\nexport type StepFunctionProp = number | ((direction: string) => number | undefined);\n\n/** Properties for the [[NumberInput]] component\n * @public\n */\nexport interface NumberInputProps extends Omit<InputProps, \"min\" | \"max\" | \"step\" | \"onChange\"> {\n /** Numeric value, set to `undefined` to show placeholder text */\n value?: number;\n /** CSS class name for the NumberInput component container div */\n containerClassName?: string;\n /** Style for component container div. */\n containerStyle?: React.CSSProperties;\n /** number or function\tNumber.MIN_SAFE_INTEGER */\n min?: number;\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\n max?: number;\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\n step?: StepFunctionProp;\n /** number of decimal places, defaults to 0 */\n precision?: number;\n /** function parseFloat */\n parse?: ((value: string) => number | null | undefined);\n /** function optional formatting function that takes the number value and the internal formatted value in case function just adds prefix or suffix. */\n format?: (num: number | null | undefined, formattedValue: string) => string;\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\n snap?: boolean;\n /** Function to call when value is changed. */\n onChange?: (value: number | undefined, stringValue: string) => void;\n /** if true up/down buttons are shown larger and side by side */\n showTouchButtons?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\nconst ForwardRefNumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(\n function ForwardRefNumberInput(props, ref) {\n const { containerClassName, value, min, max, precision, format, parse,\n onChange, onBlur, onKeyDown, step, snap, showTouchButtons, containerStyle, ...otherProps } = props;\n const currentValueRef = React.useRef(value);\n\n /**\n * Used internally to parse the argument x to it's numeric representation.\n * If the argument cannot be converted to finite number returns 0; If a\n * \"precision\" prop is specified uses it round the number with that\n * precision (no fixed precision here because the return value is float, not\n * string).\n */\n const parseInternal = React.useCallback((x: string) => {\n let n: number | undefined | null;\n\n if (parse)\n n = parse(x);\n if (undefined === n || null === n) {\n n = parseFloat(x);\n if (isNaN(n) || !isFinite(n)) {\n n = 0;\n }\n }\n\n const localPrecision = undefined === precision ? 10 : precision;\n const q = Math.pow(10, localPrecision);\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n n = Math.min(Math.max(n, localMin), localMax);\n n = Math.round(n * q) / q;\n\n return n;\n }, [parse, precision, min, max]);\n\n /**\n * This is used internally to format a number to its display representation.\n * It will invoke the format function if one is provided.\n */\n const formatInternal = React.useCallback((num: number | undefined | null) => {\n const localPrecision = undefined === precision || null === precision ? 0 : precision;\n const str = undefined === num || null === num ? \"\" : num.toFixed(localPrecision);\n\n if (format)\n return format(num, str);\n\n return str;\n }, [format, precision]);\n\n const [formattedValue, setFormattedValue] = React.useState(() => formatInternal(value));\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = value;\n const currentFormattedValue = formatInternal(currentValueRef.current);\n setFormattedValue(currentFormattedValue);\n }, [formatInternal, value]);\n\n const handleChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n }, []);\n\n const updateValue = React.useCallback((newVal: number) => {\n const newFormattedVal = formatInternal(newVal);\n onChange && onChange(newVal, newFormattedVal);\n setFormattedValue(newFormattedVal);\n }, [onChange, formatInternal]);\n\n const updateValueFromString = React.useCallback((strValue: string) => {\n const newVal = parseInternal(strValue);\n updateValue(newVal);\n }, [parseInternal, updateValue]);\n\n const handleBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n const newVal = parseInternal(event.target.value);\n onBlur && onBlur(event);\n updateValue(newVal);\n }, [parseInternal, updateValue, onBlur]);\n\n const getIncrementValue = React.useCallback((increment: boolean) => {\n if (typeof step === \"function\") {\n const stepVal = step(increment ? \"up\" : \"down\");\n return stepVal ? stepVal : 1;\n }\n\n return !step ? 1 : step;\n }, [step]);\n\n /**\n * The internal method that actually sets the new value on the input\n */\n const applyStep = React.useCallback((increment: boolean) => {\n const incrementValue = getIncrementValue(increment);\n\n let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);\n if (snap) {\n num = Math.round(num / incrementValue) * incrementValue;\n }\n\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n num = Math.min(Math.max(num, localMin), localMax);\n\n updateValue(num);\n }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === SpecialKey.Enter) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === SpecialKey.Escape) {\n setFormattedValue(formatInternal(currentValueRef.current));\n event.preventDefault();\n } else if (event.key === SpecialKey.ArrowDown) {\n applyStep(false);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === SpecialKey.ArrowUp) {\n applyStep(true);\n event.preventDefault();\n event.stopPropagation();\n }\n onKeyDown && onKeyDown(event);\n }, [applyStep, formatInternal, updateValueFromString, onKeyDown]);\n\n const handleDownClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(false);\n event.preventDefault();\n }, [applyStep]);\n\n const handleUpClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(true);\n event.preventDefault();\n }, [applyStep]);\n\n const handleFocus = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n }, []);\n\n const isDisabled = !!otherProps.disabled;\n const containerClasses = classnames(\"core-number-input-container\",\n containerClassName,\n showTouchButtons && \"core-number-buttons-for-touch\",\n isDisabled && \"core-number-input-disabled\",\n );\n\n return (\n <div className={containerClasses} style={containerStyle} >\n <Input ref={ref} value={formattedValue} onChange={handleChange} onKeyDown={handleKeyDown} onFocus={handleFocus} onBlur={handleBlur} size=\"small\" {...otherProps} />\n <div className={classnames(\"core-number-input-buttons-container\", showTouchButtons && \"core-number-buttons-for-touch\")}>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"core-number-input-button core-number-input-button-up\" tabIndex={-1} onClick={handleUpClick}>\n <WebFontIcon iconName=\"icon-caret-up\" />\n </div>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"core-number-input-button core-number-input-button-down\" tabIndex={-1} onClick={handleDownClick}>\n <WebFontIcon iconName=\"icon-caret-down\" />\n </div>\n </div>\n </div>\n );\n }\n);\n\n/** Input component for numbers with up and down buttons to increment and decrement the value.\n * @public\n */\nexport const NumberInput: (props: NumberInputProps) => JSX.Element | null = ForwardRefNumberInput;\n"]}
1
+ {"version":3,"file":"NumberInput.js","sourceRoot":"","sources":["../../../../../src/core-react/inputs/numberinput/NumberInput.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC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O,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI;QACnK,6BAAK,SAAS,EAAE,UAAU,CAAC,qCAAqC,EAAE,gBAAgB,IAAI,+BAA+B,CAAC;YAEpH,6BAAK,SAAS,EAAC,sDAAsD,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,IAAI,EAAC,cAAc;gBAC7H,oBAAC,IAAI,IAAC,QAAQ,EAAE,OAAO,GAAI,CACvB;YAEN,6BAAK,SAAS,EAAC,wDAAwD,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAC,cAAc;gBACjI,oBAAC,IAAI,IAAC,QAAQ,EAAE,SAAS,GAAI,CACzB,CACF,CACF,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAoD,qBAAqB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Inputs\n */\n\nimport \"./NumberInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Input, InputProps } from \"@itwin/itwinui-react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { Icon } from \"../../icons/IconComponent\";\nimport { SvgCaretDown, SvgCaretDownSmall, SvgCaretUp, SvgCaretUpSmall } from \"@itwin/itwinui-icons-react\";\n\n/** Step function prototype for [[NumberInput]] component\n * @public\n */\nexport type StepFunctionProp = number | ((direction: string) => number | undefined);\n\n/** Properties for the [[NumberInput]] component\n * @public\n */\nexport interface NumberInputProps extends Omit<InputProps, \"min\" | \"max\" | \"step\" | \"onChange\"> {\n /** Numeric value, set to `undefined` to show placeholder text */\n value?: number;\n /** CSS class name for the NumberInput component container div */\n containerClassName?: string;\n /** Style for component container div. */\n containerStyle?: React.CSSProperties;\n /** number or function\tNumber.MIN_SAFE_INTEGER */\n min?: number;\n /** number or function\tdefaults to Number.MAX_SAFE_INTEGER */\n max?: number;\n /** increment step value used while incrementing or decrementing (up/down buttons or arrow keys) defaults to 1. */\n step?: StepFunctionProp;\n /** number of decimal places, defaults to 0 */\n precision?: number;\n /** function parseFloat */\n parse?: ((value: string) => number | null | undefined);\n /** function optional formatting function that takes the number value and the internal formatted value in case function just adds prefix or suffix. */\n format?: (num: number | null | undefined, formattedValue: string) => string;\n /** Set to true to \"snap\" to the closest step value while incrementing or decrementing (up/down buttons or arrow keys). */\n snap?: boolean;\n /** Function to call when value is changed. */\n onChange?: (value: number | undefined, stringValue: string) => void;\n /** if true up/down buttons are shown larger and side by side */\n showTouchButtons?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n /**\n * Makes this component behave as controlled component.\n * @internal\n */\n isControlled?: boolean;\n}\n\nconst ForwardRefNumberInput = React.forwardRef<HTMLInputElement, NumberInputProps>(\n function ForwardRefNumberInput(props, ref) {\n const { containerClassName, value, min, max, precision, format, parse,\n onChange, onBlur, onKeyDown, step, snap, showTouchButtons, containerStyle, isControlled, ...otherProps } = props;\n const currentValueRef = React.useRef(value);\n\n /**\n * Used internally to parse the argument x to it's numeric representation.\n * If the argument cannot be converted to finite number returns 0; If a\n * \"precision\" prop is specified uses it round the number with that\n * precision (no fixed precision here because the return value is float, not\n * string).\n */\n const parseInternal = React.useCallback((x: string) => {\n let n: number | undefined | null;\n\n if (parse)\n n = parse(x);\n if (undefined === n || null === n) {\n n = parseFloat(x);\n if (isNaN(n) || !isFinite(n)) {\n n = 0;\n }\n }\n\n const localPrecision = undefined === precision ? 10 : precision;\n const q = Math.pow(10, localPrecision);\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n n = Math.min(Math.max(n, localMin), localMax);\n n = Math.round(n * q) / q;\n\n return n;\n }, [parse, precision, min, max]);\n\n /**\n * This is used internally to format a number to its display representation.\n * It will invoke the format function if one is provided.\n */\n const formatInternal = React.useCallback((num: number | undefined | null) => {\n const localPrecision = undefined === precision || null === precision ? 0 : precision;\n const str = undefined === num || null === num ? \"\" : num.toFixed(localPrecision);\n\n if (format)\n return format(num, str);\n\n return str;\n }, [format, precision]);\n\n const [formattedValue, setFormattedValue] = React.useState(() => formatInternal(value));\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = value;\n const currentFormattedValue = formatInternal(currentValueRef.current);\n setFormattedValue(currentFormattedValue);\n }, [formatInternal, value]);\n\n const handleChange = React.useCallback((event: React.ChangeEvent<HTMLInputElement>) => {\n const newVal = event.currentTarget.value;\n setFormattedValue(newVal);\n isControlled && onChange && onChange(parseInternal(newVal), newVal);\n }, [isControlled, onChange, parseInternal]);\n\n const updateValue = React.useCallback((newVal: number) => {\n const newFormattedVal = formatInternal(newVal);\n onChange && onChange(newVal, newFormattedVal);\n setFormattedValue(newFormattedVal);\n }, [onChange, formatInternal]);\n\n const updateValueFromString = React.useCallback((strValue: string) => {\n const newVal = parseInternal(strValue);\n updateValue(newVal);\n }, [parseInternal, updateValue]);\n\n const handleBlur = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n const newVal = parseInternal(event.target.value);\n onBlur && onBlur(event);\n updateValue(newVal);\n }, [parseInternal, updateValue, onBlur]);\n\n const getIncrementValue = React.useCallback((increment: boolean) => {\n if (typeof step === \"function\") {\n const stepVal = step(increment ? \"up\" : \"down\");\n return stepVal ? stepVal : 1;\n }\n\n return !step ? 1 : step;\n }, [step]);\n\n /**\n * The internal method that actually sets the new value on the input\n */\n const applyStep = React.useCallback((increment: boolean) => {\n const incrementValue = getIncrementValue(increment);\n\n let num = parseInternal(formattedValue) + (increment ? incrementValue : -incrementValue);\n if (snap) {\n num = Math.round(num / incrementValue) * incrementValue;\n }\n\n const localMin = undefined === min ? Number.MIN_SAFE_INTEGER : min;\n const localMax = undefined === max ? Number.MAX_SAFE_INTEGER : max;\n num = Math.min(Math.max(num, localMin), localMax);\n\n updateValue(num);\n }, [formattedValue, getIncrementValue, max, min, parseInternal, snap, updateValue]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === SpecialKey.Enter) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === SpecialKey.Escape) {\n setFormattedValue(formatInternal(currentValueRef.current));\n event.preventDefault();\n } else if (event.key === SpecialKey.ArrowDown) {\n applyStep(false);\n event.preventDefault();\n event.stopPropagation();\n } else if (event.key === SpecialKey.ArrowUp) {\n applyStep(true);\n event.preventDefault();\n event.stopPropagation();\n }\n onKeyDown && onKeyDown(event);\n }, [applyStep, formatInternal, updateValueFromString, onKeyDown]);\n\n const handleDownClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(false);\n event.preventDefault();\n }, [applyStep]);\n\n const handleUpClick = React.useCallback((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n applyStep(true);\n event.preventDefault();\n }, [applyStep]);\n\n const handleFocus = React.useCallback((event: React.FocusEvent<HTMLInputElement>) => {\n event.currentTarget.select();\n }, []);\n\n const isDisabled = !!otherProps.disabled;\n const containerClasses = classnames(\"core-number-input-container\",\n containerClassName,\n showTouchButtons && \"core-number-buttons-for-touch\",\n isDisabled && \"core-number-input-disabled\",\n );\n\n const caretUp = showTouchButtons ? <SvgCaretUp /> : <SvgCaretUpSmall />;\n const caretDown = showTouchButtons ? <SvgCaretDown /> : <SvgCaretDownSmall />;\n\n return (\n <div className={containerClasses} style={containerStyle} >\n <Input ref={ref} value={formattedValue} onChange={handleChange} onKeyDown={handleKeyDown} onFocus={handleFocus} onBlur={handleBlur} size=\"small\" {...otherProps} />\n <div className={classnames(\"core-number-input-buttons-container\", showTouchButtons && \"core-number-buttons-for-touch\")}>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"core-number-input-button core-number-input-button-up\" tabIndex={-1} onClick={handleUpClick} role=\"presentation\" >\n <Icon iconSpec={caretUp} />\n </div>\n { /* eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events */}\n <div className=\"core-number-input-button core-number-input-button-down\" tabIndex={-1} onClick={handleDownClick} role=\"presentation\" >\n <Icon iconSpec={caretDown} />\n </div>\n </div>\n </div>\n );\n }\n);\n\n/** Input component for numbers with up and down buttons to increment and decrement the value.\n * @public\n */\nexport const NumberInput: (props: NumberInputProps) => JSX.Element | null = ForwardRefNumberInput;\n"]}
@@ -7,12 +7,12 @@
7
7
 
8
8
  .core-number-input-container {
9
9
  position: relative;
10
- padding: 0;
11
- margin: 0;
10
+ padding: 0;
11
+ margin: 0;
12
12
  box-sizing: border-box;
13
13
 
14
14
  input {
15
- margin: 0;
15
+ margin: 0;
16
16
  padding-right: 1.5em;
17
17
 
18
18
  &.iui-input {
@@ -28,11 +28,10 @@
28
28
 
29
29
  .core-number-input-buttons-container {
30
30
  position: absolute;
31
- top: 0;
32
- right: 0;
33
- width: 20px;
34
- height: 100%;
35
- padding-top: 1.5px;
31
+ top: 0;
32
+ right: 0;
33
+ width: 20px;
34
+ height: 100%;
36
35
  @include uicore-centered;
37
36
  flex-direction: column;
38
37
 
@@ -43,7 +42,7 @@
43
42
  width: 100%;
44
43
  @include uicore-centered;
45
44
  &:hover {
46
- color: $buic-foreground-primary-tone;
45
+ color: var(--iui-color-text-accent-hover);
47
46
  transition-duration: 150ms;
48
47
  }
49
48
  &.core-number-input-button-up {
@@ -55,11 +54,12 @@
55
54
  }
56
55
 
57
56
  &.core-number-buttons-for-touch {
58
- width: 3.5em;
57
+ width: 3.5em;
59
58
  flex-direction: row-reverse;
60
59
 
61
60
  .core-number-input-button {
62
61
  font-size: 1em;
62
+
63
63
  &:hover {
64
64
  color: unset;
65
65
  transition-duration: unset;
@@ -77,13 +77,12 @@
77
77
  &.core-number-input-disabled {
78
78
  .core-number-input-button-up {
79
79
  pointer-events: none;
80
- color: $buic-foreground-disabled;
80
+ color: var(--iui-color-text-disabled);
81
81
  }
82
82
 
83
83
  .core-number-input-button-down {
84
84
  pointer-events: none;
85
- color: $buic-foreground-disabled;
85
+ color: var(--iui-color-text-disabled);
86
86
  }
87
87
  }
88
-
89
88
  }
@@ -15,10 +15,10 @@ $uicore-unbordered-padding: calc(#{$uicore-unbordered-padding} * 0.5);
15
15
 
16
16
  $uicore-inputs-padding: calc(
17
17
  (#{$uicore-inputs-height} - #{$uicore-line-height}) * 0.5
18
- ); // TODO: What should we do here?
18
+ );
19
19
  $uicore-inputs-padding-large: calc(
20
- (#{$uicore-inputs-height-large} - #{uicore-line-height}) * 0.5
21
- ); // TODO: What should we do here?
20
+ (#{$uicore-inputs-height-large} - #{$uicore-line-height}) * 0.5
21
+ );
22
22
  $uicore-inputs-padding-bordered: calc(#{$uicore-inputs-padding} - 2px);
23
23
  $uicore-inputs-padding-bordered-large: calc(
24
24
  #{$uicore-inputs-padding-large} - 2px
@@ -29,7 +29,7 @@ $uicore-inputs-margin: calc(
29
29
  );
30
30
  $uicore-inputs-margin-large: calc(
31
31
  (#{$uicore-line-height} * 3 - #{$uicore-inputs-height-large}) * 0.5
32
- ); // TODO: What should we do here?
32
+ );
33
33
 
34
34
  $uicore-inputs-border-color: $buic-inputs-border;
35
35
 
@@ -5,7 +5,7 @@ import "./Listbox.scss";
5
5
  * `Listbox` value.
6
6
  * @alpha
7
7
  */
8
- export declare type ListboxValue = string;
8
+ export type ListboxValue = string;
9
9
  /**
10
10
  * `Listbox` Props.
11
11
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"Listbox.d.ts","sourceRoot":"","sources":["../../../../src/core-react/listbox/Listbox.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;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,MAAM,cAAc,oCAAmH,CAAC;AAmD/I;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,eAyJ1C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,eA8DlD"}
@@ -68,7 +68,7 @@ function processKeyboardNavigation(optionValues, itemIndex, key) {
68
68
  export function Listbox(props) {
69
69
  const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;
70
70
  const listRef = React.useRef(null);
71
- const [listId] = React.useState(() => { return id !== null && id !== void 0 ? id : Guid.createValue(); });
71
+ const [listId] = React.useState(() => { return id ?? Guid.createValue(); });
72
72
  const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);
73
73
  const classes = React.useMemo(() => classnames("core-listbox", className), [className]);
74
74
  const [currentValue, setCurrentValue] = React.useState(selectedValue);
@@ -195,10 +195,9 @@ export function ListboxItem(props) {
195
195
  const itemRef = React.useRef(null);
196
196
  const isSelected = listboxValue === value;
197
197
  const handleClick = React.useCallback((event) => {
198
- var _a, _b;
199
198
  event.preventDefault();
200
199
  // istanbul ignore next
201
- const selectedValue = (_b = (_a = event.currentTarget) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.value;
200
+ const selectedValue = event.currentTarget?.dataset?.value;
202
201
  // istanbul ignore else
203
202
  if (undefined !== selectedValue) {
204
203
  onListboxValueChange(selectedValue, event.ctrlKey);
@@ -1 +1 @@
1
- {"version":3,"file":"Listbox.js","sourceRoot":"","sources":["../../../../src/core-react/listbox/Listbox.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB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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","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport classnames from \"classnames\";\n\nimport \"./Listbox.scss\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\n\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\n\n/**\n * `Listbox` value.\n * @alpha\n */\nexport type ListboxValue = string;\n\n/**\n * `Listbox` Props.\n * @alpha\n */\nexport interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {\n id?: string;\n selectedValue?: ListboxValue;\n ariaLabel?: any;\n ariaLabelledBy?: any;\n onListboxValueChange?: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\n}\n\n/**\n * `ListboxItem` Props.\n * @alpha\n */\nexport interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {\n /** The unique item's value. */\n value: ListboxValue;\n /** set if item is disabled. */\n disabled?: boolean;\n}\n\n/**\n * `Listbox` Context.\n * @alpha\n */\nexport interface ListboxContextProps {\n listboxId?: string;\n listboxValue?: ListboxValue;\n focusValue?: ListboxValue;\n onListboxValueChange: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\n listboxRef?: React.RefObject<HTMLUListElement>;\n}\n\n/**\n * Context set up by listbox for use by `ListboxItems` .\n * @alpha\n */\n// istanbul ignore next\nexport const ListboxContext = React.createContext<ListboxContextProps>({ onListboxValueChange: (_newValue: ListboxValue | undefined) => { } }); // eslint-disable-line @typescript-eslint/naming-convention\n\nfunction makeId(...args: Array<string | number | null | undefined>) {\n return args.filter((val) => val != null).join(\"--\");\n}\n\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\n return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => ((optionNode as React.ReactElement).props as ListboxItemProps));\n}\n\nfunction processKeyboardNavigation(optionValues: ListboxItemProps[], itemIndex: number, key: string): [number, boolean] {\n let keyProcessed = false;\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\n\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\n if (key === SpecialKey.ArrowDown || key === SpecialKey.PageDown) {\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.ArrowUp || key === SpecialKey.PageUp) {\n for (let i = itemIndex - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.Home) {\n for (let i = 0; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.End) {\n for (let i = optionValues.length - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n }\n return [newIndex, keyProcessed];\n}\n\n/**\n * Single select `Listbox` component\n * @alpha\n */\nexport function Listbox(props: ListboxProps) {\n const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;\n const listRef = React.useRef<HTMLUListElement>(null);\n const [listId] = React.useState(() => { return id ?? Guid.createValue(); });\n const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);\n const classes = React.useMemo(() => classnames(\"core-listbox\", className), [className]);\n const [currentValue, setCurrentValue] = React.useState<ListboxValue | undefined>(selectedValue);\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(currentValue);\n\n React.useEffect(() => {\n setCurrentValue(selectedValue);\n setFocusValue(selectedValue);\n }, [selectedValue]);\n\n const scrollTopRef = React.useRef(0);\n const handleValueChange = React.useCallback((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\n // istanbul ignore else\n if (newValue !== currentValue) {\n setCurrentValue(newValue);\n setFocusValue(newValue);\n if (onListboxValueChange)\n onListboxValueChange(newValue, isControlOrCommandPressed);\n }\n }, [setCurrentValue, currentValue, onListboxValueChange]);\n\n const focusOption = React.useCallback((itemIndex: number) => {\n // istanbul ignore else\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\n const newSelection = optionValues[itemIndex];\n const listElement = listRef.current as HTMLUListElement;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const optionToFocus = listElement.querySelector(`li[data-value=\"${newSelection.value}\"]`) as HTMLLIElement | null;\n // istanbul ignore else\n if (optionToFocus && listElement) {\n let newScrollTop = listElement.scrollTop;\n\n // istanbul ignore next\n if (listElement.scrollHeight > listElement.clientHeight) {\n const scrollBottom = listElement.clientHeight + listElement.scrollTop;\n const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;\n if (elementBottom > scrollBottom) {\n newScrollTop = elementBottom - listElement.clientHeight;\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\n newScrollTop = optionToFocus.offsetTop;\n }\n scrollTopRef.current = newScrollTop;\n }\n setFocusValue(newSelection.value);\n }\n }\n }, [optionValues]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\n if (optionValues.length < 1)\n return;\n\n const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));\n\n if (event.key === SpecialKey.Space) {\n event.preventDefault();\n // istanbul ignore else\n if (focusValue)\n handleValueChange(focusValue, event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")); // Control or Command\n return;\n } else {\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);\n // istanbul ignore else\n if (keyProcessed) {\n event.preventDefault();\n focusOption(newItemIndex);\n return;\n }\n }\n\n // istanbul ignore else\n if (onKeyDown)\n onKeyDown(event);\n }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);\n\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n const list = listRef.current as HTMLUListElement;\n\n if (isInitialMount.current) {\n isInitialMount.current = false;\n\n if (undefined !== focusValue) {\n const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));\n focusOption(itemIndex);\n }\n } else {\n list.scrollTop = scrollTopRef.current;\n }\n }, [focusValue, focusOption, optionValues]);\n\n // istanbul ignore next\n const handleOnScroll = React.useCallback((_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\n if (listRef.current)\n scrollTopRef.current = listRef.current.scrollTop;\n }, []);\n\n // istanbul ignore next\n const handleOnFocus = React.useCallback((_event: React.FocusEvent<HTMLUListElement>) => {\n if (!focusValue || 0 === focusValue.length) {\n if (currentValue) {\n setFocusValue(currentValue);\n } else {\n if (optionValues.length > 0)\n setFocusValue(optionValues[0].value);\n }\n }\n }, [currentValue, focusValue, optionValues]);\n\n return <ul\n className={classes}\n // If the listbox is not part of another widget, then it has a visible\n // label referenced by `aria-labelledby` on the element with role\n // `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\n // avoid confusion.\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n aria-label={ariaLabel}\n // An element that contains or owns all the listbox options has role\n // listbox.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"listbox\"\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\n tabIndex={0}\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\n aria-activedescendant={makeId(currentValue, listId)}\n {...otherProps}\n ref={listRef}\n id={listId}\n onKeyDown={handleKeyDown}\n onScroll={handleOnScroll}\n data-value={currentValue}\n data-focusvalue={focusValue}\n onFocus={handleOnFocus}\n >\n <ListboxContext.Provider\n value={{\n listboxValue: currentValue,\n focusValue,\n listboxId: listId,\n onListboxValueChange: handleValueChange,\n listboxRef: listRef,\n }}\n >\n {children}\n </ListboxContext.Provider>\n </ul>;\n}\n\n/**\n * `ListboxItem` component.\n * @alpha\n */\nexport function ListboxItem(props: ListboxItemProps) {\n const {\n children,\n value,\n className,\n disabled,\n ...otherProps\n } = props;\n\n const {\n listboxValue,\n focusValue,\n listboxId,\n onListboxValueChange,\n } = React.useContext(ListboxContext);\n\n const hasFocus = focusValue === value;\n\n const classes = React.useMemo(() => classnames(\"core-listbox-item\", hasFocus && \"focused\", className), [className, hasFocus]);\n const itemRef = React.useRef<HTMLLIElement>(null);\n const isSelected = listboxValue === value;\n\n const handleClick = React.useCallback((event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\n event.preventDefault();\n // istanbul ignore next\n const selectedValue = event.currentTarget?.dataset?.value;\n // istanbul ignore else\n if (undefined !== selectedValue) {\n onListboxValueChange(selectedValue, event.ctrlKey);\n }\n }, [onListboxValueChange]);\n\n const getItemId = React.useCallback(() => {\n return makeId(value, listboxId);\n }, [listboxId, value]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n // In a single-select listbox, the selected option has `aria-selected`\n // set to `true`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n aria-selected={isSelected}\n // Applicable to all host language elements regardless of whether a\n // `role` is applied.\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\n aria-disabled={disabled || undefined}\n // Each option in the listbox has role `option` and is a DOM descendant\n // of the element with role `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"option\"\n className={classes}\n {...otherProps}\n ref={itemRef}\n id={getItemId()}\n // used for css styling\n data-value={value}\n onClick={handleClick}\n >\n {children}\n </li>\n );\n}\n"]}
1
+ {"version":3,"file":"Listbox.js","sourceRoot":"","sources":["../../../../src/core-react/listbox/Listbox.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,gBAAgB,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA6CnD;;;GAGG;AACH,uBAAuB;AACvB,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAC,aAAa,CAAsB,EAAE,oBAAoB,EAAE,CAAC,SAAmC,EAAE,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,2DAA2D;AAE3M,SAAS,MAAM,CAAC,GAAG,IAA+C;IAChE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,mBAAmB,CAAC,UAA2B;IACtD,OAAO,KAAK,CAAC,QAAQ,CAAC,OAA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d,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,SAAS,EAAE,gBAEH,KAAK,EACjB,OAAO,EAAE,WAAW,IAEnB,QAAQ,CACN,CACN,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\nimport * as React from \"react\";\nimport classnames from \"classnames\";\n\nimport \"./Listbox.scss\";\nimport { Guid } from \"@itwin/core-bentley\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\n\n/** Ideas borrowed from https://reacttraining.com/reach-ui/listbox */\n\n/**\n * `Listbox` value.\n * @alpha\n */\nexport type ListboxValue = string;\n\n/**\n * `Listbox` Props.\n * @alpha\n */\nexport interface ListboxProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement> {\n id?: string;\n selectedValue?: ListboxValue;\n ariaLabel?: any;\n ariaLabelledBy?: any;\n onListboxValueChange?: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\n}\n\n/**\n * `ListboxItem` Props.\n * @alpha\n */\nexport interface ListboxItemProps extends React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement> {\n /** The unique item's value. */\n value: ListboxValue;\n /** set if item is disabled. */\n disabled?: boolean;\n}\n\n/**\n * `Listbox` Context.\n * @alpha\n */\nexport interface ListboxContextProps {\n listboxId?: string;\n listboxValue?: ListboxValue;\n focusValue?: ListboxValue;\n onListboxValueChange: ((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => void);\n listboxRef?: React.RefObject<HTMLUListElement>;\n}\n\n/**\n * Context set up by listbox for use by `ListboxItems` .\n * @alpha\n */\n// istanbul ignore next\nexport const ListboxContext = React.createContext<ListboxContextProps>({ onListboxValueChange: (_newValue: ListboxValue | undefined) => { } }); // eslint-disable-line @typescript-eslint/naming-convention\n\nfunction makeId(...args: Array<string | number | null | undefined>) {\n return args.filter((val) => val != null).join(\"--\");\n}\n\nfunction getOptionValueArray(childNodes: React.ReactNode): ListboxItemProps[] {\n return React.Children.toArray(childNodes).filter((node) => React.isValidElement(node) && node.props.value).map((optionNode) => ((optionNode as React.ReactElement).props as ListboxItemProps));\n}\n\nfunction processKeyboardNavigation(optionValues: ListboxItemProps[], itemIndex: number, key: string): [number, boolean] {\n let keyProcessed = false;\n let newIndex = itemIndex >= 0 ? itemIndex : 0;\n\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\n if (key === SpecialKey.ArrowDown || key === SpecialKey.PageDown) {\n for (let i = itemIndex + 1; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.ArrowUp || key === SpecialKey.PageUp) {\n for (let i = itemIndex - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.Home) {\n for (let i = 0; i < optionValues.length; i++) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n } else if (key === SpecialKey.End) {\n for (let i = optionValues.length - 1; i >= 0; i--) {\n if (!optionValues[i].disabled) {\n newIndex = i;\n break;\n }\n }\n keyProcessed = true;\n }\n return [newIndex, keyProcessed];\n}\n\n/**\n * Single select `Listbox` component\n * @alpha\n */\nexport function Listbox(props: ListboxProps) {\n const { ariaLabel, ariaLabelledBy, id, children, selectedValue, className, onListboxValueChange, onKeyDown, ...otherProps } = props;\n const listRef = React.useRef<HTMLUListElement>(null);\n const [listId] = React.useState(() => { return id ?? Guid.createValue(); });\n const optionValues = React.useMemo(() => getOptionValueArray(children), [children]);\n const classes = React.useMemo(() => classnames(\"core-listbox\", className), [className]);\n const [currentValue, setCurrentValue] = React.useState<ListboxValue | undefined>(selectedValue);\n const [focusValue, setFocusValue] = React.useState<ListboxValue | undefined>(currentValue);\n\n React.useEffect(() => {\n setCurrentValue(selectedValue);\n setFocusValue(selectedValue);\n }, [selectedValue]);\n\n const scrollTopRef = React.useRef(0);\n const handleValueChange = React.useCallback((newValue: ListboxValue, isControlOrCommandPressed?: boolean) => {\n // istanbul ignore else\n if (newValue !== currentValue) {\n setCurrentValue(newValue);\n setFocusValue(newValue);\n if (onListboxValueChange)\n onListboxValueChange(newValue, isControlOrCommandPressed);\n }\n }, [setCurrentValue, currentValue, onListboxValueChange]);\n\n const focusOption = React.useCallback((itemIndex: number) => {\n // istanbul ignore else\n if (itemIndex >= 0 && itemIndex < optionValues.length) {\n const newSelection = optionValues[itemIndex];\n const listElement = listRef.current as HTMLUListElement;\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const optionToFocus = listElement.querySelector(`li[data-value=\"${newSelection.value}\"]`) as HTMLLIElement | null;\n // istanbul ignore else\n if (optionToFocus && listElement) {\n let newScrollTop = listElement.scrollTop;\n\n // istanbul ignore next\n if (listElement.scrollHeight > listElement.clientHeight) {\n const scrollBottom = listElement.clientHeight + listElement.scrollTop;\n const elementBottom = optionToFocus.offsetTop + optionToFocus.offsetHeight;\n if (elementBottom > scrollBottom) {\n newScrollTop = elementBottom - listElement.clientHeight;\n } else if (optionToFocus.offsetTop < listElement.scrollTop) {\n newScrollTop = optionToFocus.offsetTop;\n }\n scrollTopRef.current = newScrollTop;\n }\n setFocusValue(newSelection.value);\n }\n }\n }, [optionValues]);\n\n const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLUListElement>) => {\n if (optionValues.length < 1)\n return;\n\n const itemIndex = (undefined === focusValue) ? -1 : optionValues.findIndex((optionValue) => ((optionValue.value === focusValue)));\n\n if (event.key === SpecialKey.Space) {\n event.preventDefault();\n // istanbul ignore else\n if (focusValue)\n handleValueChange(focusValue, event.getModifierState(\"Control\") || event.getModifierState(\"Meta\")); // Control or Command\n return;\n } else {\n const [newItemIndex, keyProcessed] = processKeyboardNavigation(optionValues, itemIndex, event.key);\n // istanbul ignore else\n if (keyProcessed) {\n event.preventDefault();\n focusOption(newItemIndex);\n return;\n }\n }\n\n // istanbul ignore else\n if (onKeyDown)\n onKeyDown(event);\n }, [focusValue, optionValues, focusOption, onKeyDown, handleValueChange]);\n\n const isInitialMount = React.useRef(true);\n\n React.useEffect(() => {\n const list = listRef.current as HTMLUListElement;\n\n if (isInitialMount.current) {\n isInitialMount.current = false;\n\n if (undefined !== focusValue) {\n const itemIndex = optionValues.findIndex((optionValue) => (optionValue.value === focusValue));\n focusOption(itemIndex);\n }\n } else {\n list.scrollTop = scrollTopRef.current;\n }\n }, [focusValue, focusOption, optionValues]);\n\n // istanbul ignore next\n const handleOnScroll = React.useCallback((_event: React.UIEvent<HTMLUListElement, UIEvent>) => {\n if (listRef.current)\n scrollTopRef.current = listRef.current.scrollTop;\n }, []);\n\n // istanbul ignore next\n const handleOnFocus = React.useCallback((_event: React.FocusEvent<HTMLUListElement>) => {\n if (!focusValue || 0 === focusValue.length) {\n if (currentValue) {\n setFocusValue(currentValue);\n } else {\n if (optionValues.length > 0)\n setFocusValue(optionValues[0].value);\n }\n }\n }, [currentValue, focusValue, optionValues]);\n\n return <ul\n className={classes}\n // If the listbox is not part of another widget, then it has a visible\n // label referenced by `aria-labelledby` on the element with role\n // `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n // If an `aria-label` is passed, we should skip `aria-labelledby` to\n // avoid confusion.\n aria-labelledby={ariaLabel ? undefined : ariaLabelledBy}\n aria-label={ariaLabel}\n // An element that contains or owns all the listbox options has role\n // listbox.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"listbox\"\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-collapsible.html\n tabIndex={0}\n // https://www.w3.org/TR/wai-aria-practices-1.2/examples/listbox/listbox-scrollable.html\n aria-activedescendant={makeId(currentValue, listId)}\n {...otherProps}\n ref={listRef}\n id={listId}\n onKeyDown={handleKeyDown}\n onScroll={handleOnScroll}\n data-value={currentValue}\n data-focusvalue={focusValue}\n onFocus={handleOnFocus}\n >\n <ListboxContext.Provider\n value={{\n listboxValue: currentValue,\n focusValue,\n listboxId: listId,\n onListboxValueChange: handleValueChange,\n listboxRef: listRef,\n }}\n >\n {children}\n </ListboxContext.Provider>\n </ul>;\n}\n\n/**\n * `ListboxItem` component.\n * @alpha\n */\nexport function ListboxItem(props: ListboxItemProps) {\n const {\n children,\n value,\n className,\n disabled,\n ...otherProps\n } = props;\n\n const {\n listboxValue,\n focusValue,\n listboxId,\n onListboxValueChange,\n } = React.useContext(ListboxContext);\n\n const hasFocus = focusValue === value;\n\n const classes = React.useMemo(() => classnames(\"core-listbox-item\", hasFocus && \"focused\", className), [className, hasFocus]);\n const itemRef = React.useRef<HTMLLIElement>(null);\n const isSelected = listboxValue === value;\n\n const handleClick = React.useCallback((event: React.MouseEvent<HTMLLIElement, MouseEvent>) => {\n event.preventDefault();\n // istanbul ignore next\n const selectedValue = event.currentTarget?.dataset?.value;\n // istanbul ignore else\n if (undefined !== selectedValue) {\n onListboxValueChange(selectedValue, event.ctrlKey);\n }\n }, [onListboxValueChange]);\n\n const getItemId = React.useCallback(() => {\n return makeId(value, listboxId);\n }, [listboxId, value]);\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <li\n // In a single-select listbox, the selected option has `aria-selected`\n // set to `true`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n aria-selected={isSelected}\n // Applicable to all host language elements regardless of whether a\n // `role` is applied.\n // https://www.w3.org/WAI/PF/aria/states_and_properties#global_states_header\n aria-disabled={disabled || undefined}\n // Each option in the listbox has role `option` and is a DOM descendant\n // of the element with role `listbox`.\n // https://www.w3.org/TR/wai-aria-practices-1.2/#Listbox\n role=\"option\"\n className={classes}\n {...otherProps}\n ref={itemRef}\n id={getItemId()}\n // used for css styling\n data-value={value}\n onClick={handleClick}\n >\n {children}\n </li>\n );\n}\n"]}
@@ -17,19 +17,19 @@ ul.core-listbox {
17
17
  display: flex;
18
18
  flex-direction: column;
19
19
  overflow: auto;
20
- color: $buic-foreground-body;
21
- border: 1px solid $buic-foreground-disabled; // default border: disabled or muted foreground
20
+ color: var(--iui-color-text);
21
+ border: 1px solid var(--iui-color-border);
22
22
  position: relative; // required to properly set scrollTop position
23
23
 
24
24
  @include uicore-touch-scrolling;
25
25
  @include uicore-scrollbar();
26
26
 
27
27
  &:focus {
28
- border-color: $buic-foreground-focus;
28
+ border-color: var(--iui-color-border-accent);
29
29
 
30
30
  li.core-listbox-item.focused {
31
- background-color: $buic-row-hover;
32
- border: 1px solid $buic-foreground-primary;
31
+ background-color: var(--iui-color-background-accent-muted);
32
+ border: 1px solid var(--iui-color-border-accent);
33
33
  }
34
34
  }
35
35
 
@@ -39,16 +39,16 @@ ul.core-listbox {
39
39
  padding-left: 4px;
40
40
 
41
41
  &[aria-selected="true"] {
42
- background-color: $buic-row-selection;
42
+ background-color: var(--iui-color-background-accent-muted);
43
43
  }
44
44
 
45
45
  &[aria-disabled="true"] {
46
46
  pointer-events: none;
47
- color: $buic-foreground-disabled;
47
+ color: var(--iui-color-text-disabled);
48
48
  }
49
49
 
50
50
  &:hover {
51
- background-color: $buic-row-hover;
51
+ background-color: var(--iui-color-background-hover);
52
52
  }
53
53
  }
54
54
  }
@@ -12,7 +12,7 @@ import * as React from "react";
12
12
  * A loading bar with optional percentage text.
13
13
  * @public
14
14
  */
15
- export class LoadingBar extends React.PureComponent {
15
+ class LoadingBar extends React.PureComponent {
16
16
  render() {
17
17
  const percent = `${percentInRange(this.props.percent)}%`;
18
18
  const containerClass = classnames(this.props.className, "core-lb");
@@ -25,6 +25,7 @@ export class LoadingBar extends React.PureComponent {
25
25
  LoadingBar.defaultProps = {
26
26
  barHeight: 4,
27
27
  };
28
+ export { LoadingBar };
28
29
  /** Sanity check to keep percentage between 0 & 100
29
30
  * @internal
30
31
  */