@sap-ux/ui-components 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +20 -0
  3. package/dist/components/Icons.d.ts +105 -0
  4. package/dist/components/Icons.d.ts.map +1 -0
  5. package/dist/components/Icons.js +401 -0
  6. package/dist/components/Icons.js.map +1 -0
  7. package/dist/components/UIBreadcrumb/UIBreadcrumb.d.ts +23 -0
  8. package/dist/components/UIBreadcrumb/UIBreadcrumb.d.ts.map +1 -0
  9. package/dist/components/UIBreadcrumb/UIBreadcrumb.js +38 -0
  10. package/dist/components/UIBreadcrumb/UIBreadcrumb.js.map +1 -0
  11. package/dist/components/UIBreadcrumb/index.d.ts +2 -0
  12. package/dist/components/UIBreadcrumb/index.d.ts.map +1 -0
  13. package/dist/components/UIBreadcrumb/index.js +14 -0
  14. package/dist/components/UIBreadcrumb/index.js.map +1 -0
  15. package/dist/components/UIButton/UIActionButton.d.ts +23 -0
  16. package/dist/components/UIButton/UIActionButton.d.ts.map +1 -0
  17. package/dist/components/UIButton/UIActionButton.js +97 -0
  18. package/dist/components/UIButton/UIActionButton.js.map +1 -0
  19. package/dist/components/UIButton/UIDefaultButton.d.ts +23 -0
  20. package/dist/components/UIButton/UIDefaultButton.d.ts.map +1 -0
  21. package/dist/components/UIButton/UIDefaultButton.js +227 -0
  22. package/dist/components/UIButton/UIDefaultButton.js.map +1 -0
  23. package/dist/components/UIButton/UIIconButton.d.ts +37 -0
  24. package/dist/components/UIButton/UIIconButton.d.ts.map +1 -0
  25. package/dist/components/UIButton/UIIconButton.js +106 -0
  26. package/dist/components/UIButton/UIIconButton.js.map +1 -0
  27. package/dist/components/UIButton/UISplitButton.d.ts +36 -0
  28. package/dist/components/UIButton/UISplitButton.d.ts.map +1 -0
  29. package/dist/components/UIButton/UISplitButton.js +67 -0
  30. package/dist/components/UIButton/UISplitButton.js.map +1 -0
  31. package/dist/components/UIButton/index.d.ts +7 -0
  32. package/dist/components/UIButton/index.d.ts.map +1 -0
  33. package/dist/components/UIButton/index.js +17 -0
  34. package/dist/components/UIButton/index.js.map +1 -0
  35. package/dist/components/UICallout/UICallout.d.ts +37 -0
  36. package/dist/components/UICallout/UICallout.d.ts.map +1 -0
  37. package/dist/components/UICallout/UICallout.js +90 -0
  38. package/dist/components/UICallout/UICallout.js.map +1 -0
  39. package/dist/components/UICallout/index.d.ts +2 -0
  40. package/dist/components/UICallout/index.d.ts.map +1 -0
  41. package/dist/components/UICallout/index.js +14 -0
  42. package/dist/components/UICallout/index.js.map +1 -0
  43. package/dist/components/UICheckbox/UICheckbox.d.ts +34 -0
  44. package/dist/components/UICheckbox/UICheckbox.d.ts.map +1 -0
  45. package/dist/components/UICheckbox/UICheckbox.js +135 -0
  46. package/dist/components/UICheckbox/UICheckbox.js.map +1 -0
  47. package/dist/components/UICheckbox/index.d.ts +2 -0
  48. package/dist/components/UICheckbox/index.d.ts.map +1 -0
  49. package/dist/components/UICheckbox/index.js +14 -0
  50. package/dist/components/UICheckbox/index.js.map +1 -0
  51. package/dist/components/UIChoiceGroup/UIChoiceGroup.d.ts +28 -0
  52. package/dist/components/UIChoiceGroup/UIChoiceGroup.d.ts.map +1 -0
  53. package/dist/components/UIChoiceGroup/UIChoiceGroup.js +182 -0
  54. package/dist/components/UIChoiceGroup/UIChoiceGroup.js.map +1 -0
  55. package/dist/components/UIChoiceGroup/index.d.ts +2 -0
  56. package/dist/components/UIChoiceGroup/index.d.ts.map +1 -0
  57. package/dist/components/UIChoiceGroup/index.js +14 -0
  58. package/dist/components/UIChoiceGroup/index.js.map +1 -0
  59. package/dist/components/UIComboBox/Callout.scss +7 -0
  60. package/dist/components/UIComboBox/UIComboBox.d.ts +190 -0
  61. package/dist/components/UIComboBox/UIComboBox.d.ts.map +1 -0
  62. package/dist/components/UIComboBox/UIComboBox.js +468 -0
  63. package/dist/components/UIComboBox/UIComboBox.js.map +1 -0
  64. package/dist/components/UIComboBox/UIComboBox.scss +245 -0
  65. package/dist/components/UIComboBox/_mixins.scss +24 -0
  66. package/dist/components/UIComboBox/index.d.ts +2 -0
  67. package/dist/components/UIComboBox/index.d.ts.map +1 -0
  68. package/dist/components/UIComboBox/index.js +14 -0
  69. package/dist/components/UIComboBox/index.js.map +1 -0
  70. package/dist/components/UIContextualMenu/UIContextualMenu.d.ts +32 -0
  71. package/dist/components/UIContextualMenu/UIContextualMenu.d.ts.map +1 -0
  72. package/dist/components/UIContextualMenu/UIContextualMenu.js +124 -0
  73. package/dist/components/UIContextualMenu/UIContextualMenu.js.map +1 -0
  74. package/dist/components/UIContextualMenu/UIContextualMenu.scss +211 -0
  75. package/dist/components/UIContextualMenu/UIHighlightMenuOption.d.ts +20 -0
  76. package/dist/components/UIContextualMenu/UIHighlightMenuOption.d.ts.map +1 -0
  77. package/dist/components/UIContextualMenu/UIHighlightMenuOption.js +51 -0
  78. package/dist/components/UIContextualMenu/UIHighlightMenuOption.js.map +1 -0
  79. package/dist/components/UIContextualMenu/UIHighlightMenuOption.scss +23 -0
  80. package/dist/components/UIContextualMenu/_variables.scss +30 -0
  81. package/dist/components/UIContextualMenu/index.d.ts +3 -0
  82. package/dist/components/UIContextualMenu/index.d.ts.map +1 -0
  83. package/dist/components/UIContextualMenu/index.js +15 -0
  84. package/dist/components/UIContextualMenu/index.js.map +1 -0
  85. package/dist/components/UIDatePicker/UIDatePicker.d.ts +49 -0
  86. package/dist/components/UIDatePicker/UIDatePicker.d.ts.map +1 -0
  87. package/dist/components/UIDatePicker/UIDatePicker.js +72 -0
  88. package/dist/components/UIDatePicker/UIDatePicker.js.map +1 -0
  89. package/dist/components/UIDatePicker/UIDatePicker.scss +38 -0
  90. package/dist/components/UIDatePicker/index.d.ts +2 -0
  91. package/dist/components/UIDatePicker/index.d.ts.map +1 -0
  92. package/dist/components/UIDatePicker/index.js +14 -0
  93. package/dist/components/UIDatePicker/index.js.map +1 -0
  94. package/dist/components/UIDialog/UIDialog.d.ts +102 -0
  95. package/dist/components/UIDialog/UIDialog.d.ts.map +1 -0
  96. package/dist/components/UIDialog/UIDialog.js +250 -0
  97. package/dist/components/UIDialog/UIDialog.js.map +1 -0
  98. package/dist/components/UIDialog/index.d.ts +2 -0
  99. package/dist/components/UIDialog/index.d.ts.map +1 -0
  100. package/dist/components/UIDialog/index.js +14 -0
  101. package/dist/components/UIDialog/index.js.map +1 -0
  102. package/dist/components/UIDropdown/UIDropdown.d.ts +76 -0
  103. package/dist/components/UIDropdown/UIDropdown.d.ts.map +1 -0
  104. package/dist/components/UIDropdown/UIDropdown.js +166 -0
  105. package/dist/components/UIDropdown/UIDropdown.js.map +1 -0
  106. package/dist/components/UIDropdown/UIDropdown.scss +80 -0
  107. package/dist/components/UIDropdown/index.d.ts +2 -0
  108. package/dist/components/UIDropdown/index.d.ts.map +1 -0
  109. package/dist/components/UIDropdown/index.js +14 -0
  110. package/dist/components/UIDropdown/index.js.map +1 -0
  111. package/dist/components/UIFlexibleTable/RowActions.d.ts +17 -0
  112. package/dist/components/UIFlexibleTable/RowActions.d.ts.map +1 -0
  113. package/dist/components/UIFlexibleTable/RowActions.js +68 -0
  114. package/dist/components/UIFlexibleTable/RowActions.js.map +1 -0
  115. package/dist/components/UIFlexibleTable/RowData.d.ts +16 -0
  116. package/dist/components/UIFlexibleTable/RowData.d.ts.map +1 -0
  117. package/dist/components/UIFlexibleTable/RowData.js +109 -0
  118. package/dist/components/UIFlexibleTable/RowData.js.map +1 -0
  119. package/dist/components/UIFlexibleTable/UIFlexibleTable.d.ts +12 -0
  120. package/dist/components/UIFlexibleTable/UIFlexibleTable.d.ts.map +1 -0
  121. package/dist/components/UIFlexibleTable/UIFlexibleTable.js +256 -0
  122. package/dist/components/UIFlexibleTable/UIFlexibleTable.js.map +1 -0
  123. package/dist/components/UIFlexibleTable/UIFlexibleTable.scss +408 -0
  124. package/dist/components/UIFlexibleTable/UIFlexibleTableActionButton.d.ts +20 -0
  125. package/dist/components/UIFlexibleTable/UIFlexibleTableActionButton.d.ts.map +1 -0
  126. package/dist/components/UIFlexibleTable/UIFlexibleTableActionButton.js +20 -0
  127. package/dist/components/UIFlexibleTable/UIFlexibleTableActionButton.js.map +1 -0
  128. package/dist/components/UIFlexibleTable/UIFlexibleTableRow.d.ts +28 -0
  129. package/dist/components/UIFlexibleTable/UIFlexibleTableRow.d.ts.map +1 -0
  130. package/dist/components/UIFlexibleTable/UIFlexibleTableRow.js +165 -0
  131. package/dist/components/UIFlexibleTable/UIFlexibleTableRow.js.map +1 -0
  132. package/dist/components/UIFlexibleTable/UIFlexibleTableRowActionButton.d.ts +21 -0
  133. package/dist/components/UIFlexibleTable/UIFlexibleTableRowActionButton.d.ts.map +1 -0
  134. package/dist/components/UIFlexibleTable/UIFlexibleTableRowActionButton.js +20 -0
  135. package/dist/components/UIFlexibleTable/UIFlexibleTableRowActionButton.js.map +1 -0
  136. package/dist/components/UIFlexibleTable/index.d.ts +6 -0
  137. package/dist/components/UIFlexibleTable/index.d.ts.map +1 -0
  138. package/dist/components/UIFlexibleTable/index.js +18 -0
  139. package/dist/components/UIFlexibleTable/index.js.map +1 -0
  140. package/dist/components/UIFlexibleTable/types.d.ts +103 -0
  141. package/dist/components/UIFlexibleTable/types.d.ts.map +1 -0
  142. package/dist/components/UIFlexibleTable/types.js +9 -0
  143. package/dist/components/UIFlexibleTable/types.js.map +1 -0
  144. package/dist/components/UIFlexibleTable/utils.d.ts +29 -0
  145. package/dist/components/UIFlexibleTable/utils.d.ts.map +1 -0
  146. package/dist/components/UIFlexibleTable/utils.js +53 -0
  147. package/dist/components/UIFlexibleTable/utils.js.map +1 -0
  148. package/dist/components/UIFocusZone/UIFocusTrapZone.d.ts +22 -0
  149. package/dist/components/UIFocusZone/UIFocusTrapZone.d.ts.map +1 -0
  150. package/dist/components/UIFocusZone/UIFocusTrapZone.js +33 -0
  151. package/dist/components/UIFocusZone/UIFocusTrapZone.js.map +1 -0
  152. package/dist/components/UIFocusZone/UIFocusZone.d.ts +23 -0
  153. package/dist/components/UIFocusZone/UIFocusZone.d.ts.map +1 -0
  154. package/dist/components/UIFocusZone/UIFocusZone.js +35 -0
  155. package/dist/components/UIFocusZone/UIFocusZone.js.map +1 -0
  156. package/dist/components/UIFocusZone/index.d.ts +3 -0
  157. package/dist/components/UIFocusZone/index.d.ts.map +1 -0
  158. package/dist/components/UIFocusZone/index.js +15 -0
  159. package/dist/components/UIFocusZone/index.js.map +1 -0
  160. package/dist/components/UIIcon/UIIcon.d.ts +24 -0
  161. package/dist/components/UIIcon/UIIcon.d.ts.map +1 -0
  162. package/dist/components/UIIcon/UIIcon.js +37 -0
  163. package/dist/components/UIIcon/UIIcon.js.map +1 -0
  164. package/dist/components/UIIcon/UIIcon.scss +3 -0
  165. package/dist/components/UIIcon/index.d.ts +2 -0
  166. package/dist/components/UIIcon/index.d.ts.map +1 -0
  167. package/dist/components/UIIcon/index.js +14 -0
  168. package/dist/components/UIIcon/index.js.map +1 -0
  169. package/dist/components/UIInput/UITextInput.d.ts +25 -0
  170. package/dist/components/UIInput/UITextInput.d.ts.map +1 -0
  171. package/dist/components/UIInput/UITextInput.js +180 -0
  172. package/dist/components/UIInput/UITextInput.js.map +1 -0
  173. package/dist/components/UIInput/index.d.ts +2 -0
  174. package/dist/components/UIInput/index.d.ts.map +1 -0
  175. package/dist/components/UIInput/index.js +14 -0
  176. package/dist/components/UIInput/index.js.map +1 -0
  177. package/dist/components/UILabel/UILabel.d.ts +30 -0
  178. package/dist/components/UILabel/UILabel.d.ts.map +1 -0
  179. package/dist/components/UILabel/UILabel.js +64 -0
  180. package/dist/components/UILabel/UILabel.js.map +1 -0
  181. package/dist/components/UILabel/index.d.ts +2 -0
  182. package/dist/components/UILabel/index.d.ts.map +1 -0
  183. package/dist/components/UILabel/index.js +14 -0
  184. package/dist/components/UILabel/index.js.map +1 -0
  185. package/dist/components/UILink/UILink.d.ts +22 -0
  186. package/dist/components/UILink/UILink.d.ts.map +1 -0
  187. package/dist/components/UILink/UILink.js +58 -0
  188. package/dist/components/UILink/UILink.js.map +1 -0
  189. package/dist/components/UILink/index.d.ts +2 -0
  190. package/dist/components/UILink/index.d.ts.map +1 -0
  191. package/dist/components/UILink/index.js +14 -0
  192. package/dist/components/UILink/index.js.map +1 -0
  193. package/dist/components/UIList/UIList.d.ts +31 -0
  194. package/dist/components/UIList/UIList.d.ts.map +1 -0
  195. package/dist/components/UIList/UIList.js +120 -0
  196. package/dist/components/UIList/UIList.js.map +1 -0
  197. package/dist/components/UIList/UIList.scss +16 -0
  198. package/dist/components/UIList/index.d.ts +2 -0
  199. package/dist/components/UIList/index.d.ts.map +1 -0
  200. package/dist/components/UIList/index.js +14 -0
  201. package/dist/components/UIList/index.js.map +1 -0
  202. package/dist/components/UILoader/UILoader.d.ts +27 -0
  203. package/dist/components/UILoader/UILoader.d.ts.map +1 -0
  204. package/dist/components/UILoader/UILoader.js +78 -0
  205. package/dist/components/UILoader/UILoader.js.map +1 -0
  206. package/dist/components/UILoader/UILoader.scss +32 -0
  207. package/dist/components/UILoader/index.d.ts +2 -0
  208. package/dist/components/UILoader/index.d.ts.map +1 -0
  209. package/dist/components/UILoader/index.js +14 -0
  210. package/dist/components/UILoader/index.js.map +1 -0
  211. package/dist/components/UIMessageBar/UIMessageBar.d.ts +25 -0
  212. package/dist/components/UIMessageBar/UIMessageBar.d.ts.map +1 -0
  213. package/dist/components/UIMessageBar/UIMessageBar.js +59 -0
  214. package/dist/components/UIMessageBar/UIMessageBar.js.map +1 -0
  215. package/dist/components/UIMessageBar/index.d.ts +2 -0
  216. package/dist/components/UIMessageBar/index.d.ts.map +1 -0
  217. package/dist/components/UIMessageBar/index.js +14 -0
  218. package/dist/components/UIMessageBar/index.js.map +1 -0
  219. package/dist/components/UIModal/UIModal.d.ts +23 -0
  220. package/dist/components/UIModal/UIModal.d.ts.map +1 -0
  221. package/dist/components/UIModal/UIModal.js +43 -0
  222. package/dist/components/UIModal/UIModal.js.map +1 -0
  223. package/dist/components/UIModal/index.d.ts +2 -0
  224. package/dist/components/UIModal/index.d.ts.map +1 -0
  225. package/dist/components/UIModal/index.js +14 -0
  226. package/dist/components/UIModal/index.js.map +1 -0
  227. package/dist/components/UIOverlay/UIOverlay.d.ts +22 -0
  228. package/dist/components/UIOverlay/UIOverlay.d.ts.map +1 -0
  229. package/dist/components/UIOverlay/UIOverlay.js +38 -0
  230. package/dist/components/UIOverlay/UIOverlay.js.map +1 -0
  231. package/dist/components/UIOverlay/index.d.ts +2 -0
  232. package/dist/components/UIOverlay/index.d.ts.map +1 -0
  233. package/dist/components/UIOverlay/index.js +14 -0
  234. package/dist/components/UIOverlay/index.js.map +1 -0
  235. package/dist/components/UISearchBox/UISearchBox.d.ts +22 -0
  236. package/dist/components/UISearchBox/UISearchBox.d.ts.map +1 -0
  237. package/dist/components/UISearchBox/UISearchBox.js +155 -0
  238. package/dist/components/UISearchBox/UISearchBox.js.map +1 -0
  239. package/dist/components/UISearchBox/index.d.ts +4 -0
  240. package/dist/components/UISearchBox/index.d.ts.map +1 -0
  241. package/dist/components/UISearchBox/index.js +14 -0
  242. package/dist/components/UISearchBox/index.js.map +1 -0
  243. package/dist/components/UISection/UISection.d.ts +33 -0
  244. package/dist/components/UISection/UISection.d.ts.map +1 -0
  245. package/dist/components/UISection/UISection.js +47 -0
  246. package/dist/components/UISection/UISection.js.map +1 -0
  247. package/dist/components/UISection/UISection.scss +76 -0
  248. package/dist/components/UISection/UISections.d.ts +251 -0
  249. package/dist/components/UISection/UISections.d.ts.map +1 -0
  250. package/dist/components/UISection/UISections.js +709 -0
  251. package/dist/components/UISection/UISections.js.map +1 -0
  252. package/dist/components/UISection/UISections.scss +62 -0
  253. package/dist/components/UISection/UISplitter.d.ts +97 -0
  254. package/dist/components/UISection/UISplitter.d.ts.map +1 -0
  255. package/dist/components/UISection/UISplitter.js +221 -0
  256. package/dist/components/UISection/UISplitter.js.map +1 -0
  257. package/dist/components/UISection/UISplitter.scss +212 -0
  258. package/dist/components/UISection/_mixins.scss +14 -0
  259. package/dist/components/UISection/_variables.scss +1 -0
  260. package/dist/components/UISection/index.d.ts +4 -0
  261. package/dist/components/UISection/index.d.ts.map +1 -0
  262. package/dist/components/UISection/index.js +16 -0
  263. package/dist/components/UISection/index.js.map +1 -0
  264. package/dist/components/UITable/UITable-helper.d.ts +85 -0
  265. package/dist/components/UITable/UITable-helper.d.ts.map +1 -0
  266. package/dist/components/UITable/UITable-helper.js +267 -0
  267. package/dist/components/UITable/UITable-helper.js.map +1 -0
  268. package/dist/components/UITable/UITable.d.ts +212 -0
  269. package/dist/components/UITable/UITable.d.ts.map +1 -0
  270. package/dist/components/UITable/UITable.js +762 -0
  271. package/dist/components/UITable/UITable.js.map +1 -0
  272. package/dist/components/UITable/UITable.scss +194 -0
  273. package/dist/components/UITable/index.d.ts +3 -0
  274. package/dist/components/UITable/index.d.ts.map +1 -0
  275. package/dist/components/UITable/index.js +15 -0
  276. package/dist/components/UITable/index.js.map +1 -0
  277. package/dist/components/UITable/types.d.ts +76 -0
  278. package/dist/components/UITable/types.d.ts.map +1 -0
  279. package/dist/components/UITable/types.js +27 -0
  280. package/dist/components/UITable/types.js.map +1 -0
  281. package/dist/components/UITabs/UITabs.d.ts +28 -0
  282. package/dist/components/UITabs/UITabs.d.ts.map +1 -0
  283. package/dist/components/UITabs/UITabs.js +70 -0
  284. package/dist/components/UITabs/UITabs.js.map +1 -0
  285. package/dist/components/UITabs/index.d.ts +2 -0
  286. package/dist/components/UITabs/index.d.ts.map +1 -0
  287. package/dist/components/UITabs/index.js +14 -0
  288. package/dist/components/UITabs/index.js.map +1 -0
  289. package/dist/components/UIToggle/UIToggle.d.ts +39 -0
  290. package/dist/components/UIToggle/UIToggle.d.ts.map +1 -0
  291. package/dist/components/UIToggle/UIToggle.js +181 -0
  292. package/dist/components/UIToggle/UIToggle.js.map +1 -0
  293. package/dist/components/UIToggle/index.d.ts +2 -0
  294. package/dist/components/UIToggle/index.d.ts.map +1 -0
  295. package/dist/components/UIToggle/index.js +14 -0
  296. package/dist/components/UIToggle/index.js.map +1 -0
  297. package/dist/components/UIToggleGroup/UIToggleGroup.d.ts +31 -0
  298. package/dist/components/UIToggleGroup/UIToggleGroup.d.ts.map +1 -0
  299. package/dist/components/UIToggleGroup/UIToggleGroup.js +132 -0
  300. package/dist/components/UIToggleGroup/UIToggleGroup.js.map +1 -0
  301. package/dist/components/UIToggleGroup/UIToggleGroup.scss +13 -0
  302. package/dist/components/UIToggleGroup/UIToggleGroup.types.d.ts +23 -0
  303. package/dist/components/UIToggleGroup/UIToggleGroup.types.d.ts.map +1 -0
  304. package/dist/components/UIToggleGroup/UIToggleGroup.types.js +3 -0
  305. package/dist/components/UIToggleGroup/UIToggleGroup.types.js.map +1 -0
  306. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.d.ts +26 -0
  307. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.d.ts.map +1 -0
  308. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.js +74 -0
  309. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.js.map +1 -0
  310. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.scss +74 -0
  311. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.types.d.ts +11 -0
  312. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.types.d.ts.map +1 -0
  313. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.types.js +3 -0
  314. package/dist/components/UIToggleGroup/UIToggleGroupOption/UIToggleGroupOption.types.js.map +1 -0
  315. package/dist/components/UIToggleGroup/UIToggleGroupOption/index.d.ts +3 -0
  316. package/dist/components/UIToggleGroup/UIToggleGroupOption/index.d.ts.map +1 -0
  317. package/dist/components/UIToggleGroup/UIToggleGroupOption/index.js +15 -0
  318. package/dist/components/UIToggleGroup/UIToggleGroupOption/index.js.map +1 -0
  319. package/dist/components/UIToggleGroup/index.d.ts +3 -0
  320. package/dist/components/UIToggleGroup/index.d.ts.map +1 -0
  321. package/dist/components/UIToggleGroup/index.js +15 -0
  322. package/dist/components/UIToggleGroup/index.js.map +1 -0
  323. package/dist/components/UIToolbar/UIToolbar.d.ts +37 -0
  324. package/dist/components/UIToolbar/UIToolbar.d.ts.map +1 -0
  325. package/dist/components/UIToolbar/UIToolbar.js +101 -0
  326. package/dist/components/UIToolbar/UIToolbar.js.map +1 -0
  327. package/dist/components/UIToolbar/UIToolbar.scss +48 -0
  328. package/dist/components/UIToolbar/UIToolbarColumn.d.ts +8 -0
  329. package/dist/components/UIToolbar/UIToolbarColumn.d.ts.map +1 -0
  330. package/dist/components/UIToolbar/UIToolbarColumn.js +30 -0
  331. package/dist/components/UIToolbar/UIToolbarColumn.js.map +1 -0
  332. package/dist/components/UIToolbar/UIToolbarDivider.d.ts +26 -0
  333. package/dist/components/UIToolbar/UIToolbarDivider.d.ts.map +1 -0
  334. package/dist/components/UIToolbar/UIToolbarDivider.js +51 -0
  335. package/dist/components/UIToolbar/UIToolbarDivider.js.map +1 -0
  336. package/dist/components/UIToolbar/index.d.ts +4 -0
  337. package/dist/components/UIToolbar/index.d.ts.map +1 -0
  338. package/dist/components/UIToolbar/index.js +16 -0
  339. package/dist/components/UIToolbar/index.js.map +1 -0
  340. package/dist/components/UITooltip/UITooltip.d.ts +29 -0
  341. package/dist/components/UITooltip/UITooltip.d.ts.map +1 -0
  342. package/dist/components/UITooltip/UITooltip.js +79 -0
  343. package/dist/components/UITooltip/UITooltip.js.map +1 -0
  344. package/dist/components/UITooltip/UITooltipUtils.d.ts +17 -0
  345. package/dist/components/UITooltip/UITooltipUtils.d.ts.map +1 -0
  346. package/dist/components/UITooltip/UITooltipUtils.js +47 -0
  347. package/dist/components/UITooltip/UITooltipUtils.js.map +1 -0
  348. package/dist/components/UITooltip/index.d.ts +3 -0
  349. package/dist/components/UITooltip/index.d.ts.map +1 -0
  350. package/dist/components/UITooltip/index.js +15 -0
  351. package/dist/components/UITooltip/index.js.map +1 -0
  352. package/dist/components/UITreeDropdown/UITreeDropdown.d.ts +255 -0
  353. package/dist/components/UITreeDropdown/UITreeDropdown.d.ts.map +1 -0
  354. package/dist/components/UITreeDropdown/UITreeDropdown.js +638 -0
  355. package/dist/components/UITreeDropdown/UITreeDropdown.js.map +1 -0
  356. package/dist/components/UITreeDropdown/UITreeDropdown.scss +82 -0
  357. package/dist/components/UITreeDropdown/index.d.ts +2 -0
  358. package/dist/components/UITreeDropdown/index.d.ts.map +1 -0
  359. package/dist/components/UITreeDropdown/index.js +14 -0
  360. package/dist/components/UITreeDropdown/index.js.map +1 -0
  361. package/dist/components/UIVerticalDivider/UIVerticalDivider.d.ts +24 -0
  362. package/dist/components/UIVerticalDivider/UIVerticalDivider.d.ts.map +1 -0
  363. package/dist/components/UIVerticalDivider/UIVerticalDivider.js +42 -0
  364. package/dist/components/UIVerticalDivider/UIVerticalDivider.js.map +1 -0
  365. package/dist/components/UIVerticalDivider/index.d.ts +2 -0
  366. package/dist/components/UIVerticalDivider/index.d.ts.map +1 -0
  367. package/dist/components/UIVerticalDivider/index.js +14 -0
  368. package/dist/components/UIVerticalDivider/index.js.map +1 -0
  369. package/dist/components/UIVirtualList/UIAutoSizer.d.ts +22 -0
  370. package/dist/components/UIVirtualList/UIAutoSizer.d.ts.map +1 -0
  371. package/dist/components/UIVirtualList/UIAutoSizer.js +33 -0
  372. package/dist/components/UIVirtualList/UIAutoSizer.js.map +1 -0
  373. package/dist/components/UIVirtualList/UICellMeasurer.d.ts +23 -0
  374. package/dist/components/UIVirtualList/UICellMeasurer.d.ts.map +1 -0
  375. package/dist/components/UIVirtualList/UICellMeasurer.js +33 -0
  376. package/dist/components/UIVirtualList/UICellMeasurer.js.map +1 -0
  377. package/dist/components/UIVirtualList/UIVirtualList.d.ts +43 -0
  378. package/dist/components/UIVirtualList/UIVirtualList.d.ts.map +1 -0
  379. package/dist/components/UIVirtualList/UIVirtualList.js +70 -0
  380. package/dist/components/UIVirtualList/UIVirtualList.js.map +1 -0
  381. package/dist/components/UIVirtualList/index.d.ts +4 -0
  382. package/dist/components/UIVirtualList/index.d.ts.map +1 -0
  383. package/dist/components/UIVirtualList/index.js +16 -0
  384. package/dist/components/UIVirtualList/index.js.map +1 -0
  385. package/dist/components/index.d.ts +34 -0
  386. package/dist/components/index.d.ts.map +1 -0
  387. package/dist/components/index.js +46 -0
  388. package/dist/components/index.js.map +1 -0
  389. package/dist/helper/ValidationMessage/MessageWrapper.d.ts +18 -0
  390. package/dist/helper/ValidationMessage/MessageWrapper.d.ts.map +1 -0
  391. package/dist/helper/ValidationMessage/MessageWrapper.js +35 -0
  392. package/dist/helper/ValidationMessage/MessageWrapper.js.map +1 -0
  393. package/dist/helper/ValidationMessage/MessageWrapper.scss +44 -0
  394. package/dist/helper/ValidationMessage/index.d.ts +3 -0
  395. package/dist/helper/ValidationMessage/index.d.ts.map +1 -0
  396. package/dist/helper/ValidationMessage/index.js +15 -0
  397. package/dist/helper/ValidationMessage/index.js.map +1 -0
  398. package/dist/helper/ValidationMessage/utils.d.ts +32 -0
  399. package/dist/helper/ValidationMessage/utils.d.ts.map +1 -0
  400. package/dist/helper/ValidationMessage/utils.js +124 -0
  401. package/dist/helper/ValidationMessage/utils.js.map +1 -0
  402. package/dist/index.d.ts +3 -0
  403. package/dist/index.d.ts.map +1 -0
  404. package/dist/index.js +15 -0
  405. package/dist/index.js.map +1 -0
  406. package/dist/styles/_color.scss +435 -0
  407. package/dist/styles/_mixins.scss +15 -0
  408. package/dist/styles/_theia_materialcolors.scss +279 -0
  409. package/dist/styles/_typography.scss +72 -0
  410. package/dist/styles/_variables.scss +24 -0
  411. package/dist/styles/ui-components.scss +5 -0
  412. package/dist/utilities/DeepMerge.d.ts +10 -0
  413. package/dist/utilities/DeepMerge.d.ts.map +1 -0
  414. package/dist/utilities/DeepMerge.js +43 -0
  415. package/dist/utilities/DeepMerge.js.map +1 -0
  416. package/dist/utilities/Focus.d.ts +5 -0
  417. package/dist/utilities/Focus.d.ts.map +1 -0
  418. package/dist/utilities/Focus.js +8 -0
  419. package/dist/utilities/Focus.js.map +1 -0
  420. package/dist/utilities/Id.d.ts +3 -0
  421. package/dist/utilities/Id.d.ts.map +1 -0
  422. package/dist/utilities/Id.js +6 -0
  423. package/dist/utilities/Id.js.map +1 -0
  424. package/dist/utilities/Keys.d.ts +3 -0
  425. package/dist/utilities/Keys.d.ts.map +1 -0
  426. package/dist/utilities/Keys.js +6 -0
  427. package/dist/utilities/Keys.js.map +1 -0
  428. package/dist/utilities/index.d.ts +4 -0
  429. package/dist/utilities/index.d.ts.map +1 -0
  430. package/dist/utilities/index.js +16 -0
  431. package/dist/utilities/index.js.map +1 -0
  432. package/package.json +78 -0
  433. package/storybook/509.1060f8f464e74d7e89e3.manager.bundle.js +17 -0
  434. package/storybook/685.6d7c03ae84f4f4910fd8.manager.bundle.js +10 -0
  435. package/storybook/720.3f79f56f8617ba9b098b.manager.bundle.js +1 -0
  436. package/storybook/730.e07ff5529508942d85d4.manager.bundle.js +15 -0
  437. package/storybook/759.8ae5af3b1b3b446a9919.manager.bundle.js +296 -0
  438. package/storybook/906.cf93a831.iframe.bundle.js +1 -0
  439. package/storybook/93.4e7a890e.iframe.bundle.js +301 -0
  440. package/storybook/975.15c711f75c0452ae9e9f.manager.bundle.js +2 -0
  441. package/storybook/978.a517622963996a3b8256.manager.bundle.js +894 -0
  442. package/storybook/983.515d3eedbfaed61e9ae7.manager.bundle.js +1 -0
  443. package/storybook/favicon.ico +0 -0
  444. package/storybook/iframe.html +380 -0
  445. package/storybook/index.html +177 -0
  446. package/storybook/main.e843f431b2692c06059a.manager.bundle.js +1 -0
  447. package/storybook/main.fd2077c6.iframe.bundle.js +98 -0
  448. package/storybook/project.json +1 -0
  449. package/storybook/runtime~main.1118f177d5097a42d314.manager.bundle.js +2 -0
  450. package/storybook/runtime~main.e0688c57.iframe.bundle.js +2 -0
@@ -0,0 +1,709 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.UISections = exports.ANIMATION_TIME = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const UISection_1 = require("./UISection");
9
+ const UISplitter_1 = require("./UISplitter");
10
+ require("./UISections.scss");
11
+ exports.ANIMATION_TIME = 300;
12
+ const SECTIONS_ANIMATION_CLASS = 'sections--animated';
13
+ /**
14
+ * UISections component.
15
+ * @exports
16
+ * @class {UISections}
17
+ * @extends {React.Component<UISectionsProps, UISectionsState>}
18
+ */
19
+ class UISections extends react_1.default.Component {
20
+ /**
21
+ * Initializes component properties.
22
+ *
23
+ * @param {UISectionsProps} props
24
+ */
25
+ constructor(props) {
26
+ super(props);
27
+ this.resizeSections = [];
28
+ this.isFullScreen = false;
29
+ this.rootSize = 0;
30
+ this.ignoreAnimation = false;
31
+ this.state = {
32
+ sizes: undefined
33
+ };
34
+ this.onWindowResize = this.onWindowResize.bind(this);
35
+ this.rootRef = react_1.default.createRef();
36
+ this.sizeProperty = props.vertical ? 'height' : 'width';
37
+ this.domSizeProperty = props.vertical ? 'clientHeight' : 'clientWidth';
38
+ this.startPositionProperty = props.vertical ? 'top' : 'left';
39
+ this.endPositionProperty = props.vertical ? 'bottom' : 'right';
40
+ this.sizeProperty = props.vertical ? 'height' : 'width';
41
+ window.addEventListener('resize', this.onWindowResize);
42
+ }
43
+ /**
44
+ * Updates state sizes.
45
+ *
46
+ * @param {number} layoutSize
47
+ * @param {Array<number | UISectionSize | undefine>} sizes
48
+ * @returns {UISectionSize[]}
49
+ */
50
+ updateStateSizes(layoutSize, sizes) {
51
+ let uiSizes = sizes;
52
+ const dynamicSectionIndex = this.getDynamicSectionIndex();
53
+ // Calculate size for dynamic section
54
+ let availableSize = 0;
55
+ sizes.forEach((section, index) => {
56
+ if (typeof section === 'object' && section.size === undefined) {
57
+ const position = this.getSectionPosition(section);
58
+ section.size = Math.abs(this.rootSize - position.end - position.start);
59
+ }
60
+ if (index !== dynamicSectionIndex) {
61
+ availableSize += (typeof section === 'object' ? section.size : section) || 0;
62
+ }
63
+ });
64
+ availableSize = layoutSize - availableSize;
65
+ // Check if number array is passed as sizes. Convert array of number to array of UISectionSize
66
+ if (typeof sizes[0] !== 'object') {
67
+ uiSizes = [];
68
+ let start = 0;
69
+ sizes.forEach((size, index) => {
70
+ size = dynamicSectionIndex !== index ? size : availableSize;
71
+ uiSizes.push({
72
+ percentage: false,
73
+ size,
74
+ start
75
+ });
76
+ start += size || 0;
77
+ });
78
+ }
79
+ // Apply size for dynamic section
80
+ const dynamicSection = uiSizes[dynamicSectionIndex];
81
+ if (dynamicSection) {
82
+ dynamicSection.size = availableSize;
83
+ }
84
+ // Recalculate start and end positions
85
+ this.recalculatePositions(uiSizes);
86
+ // Validate min sizes
87
+ this.validateStateMinSizes(uiSizes);
88
+ return uiSizes;
89
+ }
90
+ componentDidMount() {
91
+ const { sizesAsPercents, sizes } = this.props;
92
+ this.rootSize = this.getRootSize();
93
+ if (!sizesAsPercents && sizes) {
94
+ // Calculate state
95
+ this.setState({
96
+ sizes: this.updateStateSizes(this.rootSize, sizes)
97
+ });
98
+ }
99
+ }
100
+ componentDidUpdate() {
101
+ this.ignoreAnimation = false;
102
+ }
103
+ /**
104
+ * Gets derived state from properties.
105
+ *
106
+ * @param {UISectionProps} nextProps
107
+ * @param {UISectionsState} prevState
108
+ *
109
+ * @returns {UISectionsState | null}
110
+ */
111
+ static getDerivedStateFromProps(nextProps, prevState) {
112
+ // Handle property "animation" as array
113
+ let animate = prevState.animate;
114
+ let visibleSections;
115
+ let dynamicSection = 0;
116
+ if (Array.isArray(nextProps.animation)) {
117
+ visibleSections = UISections.getVisibleSections(nextProps.children);
118
+ // Check if there is transition for section with enabled animation
119
+ let transitionAnimation;
120
+ for (let i = 0; i < nextProps.animation.length; i++) {
121
+ if (visibleSections?.includes(i) !== prevState.visibleSections?.includes(i)) {
122
+ transitionAnimation = transitionAnimation || nextProps.animation[i];
123
+ }
124
+ }
125
+ if (transitionAnimation !== undefined) {
126
+ // Visibility of sections changed - apply animation for transition section
127
+ animate = transitionAnimation;
128
+ }
129
+ }
130
+ else {
131
+ animate = nextProps.animation;
132
+ }
133
+ // Find dynamic section index
134
+ nextProps.sizes?.forEach((size, index) => {
135
+ if (size === undefined) {
136
+ dynamicSection = index;
137
+ }
138
+ });
139
+ return {
140
+ animate,
141
+ visibleSections,
142
+ dynamicSection
143
+ };
144
+ }
145
+ /**
146
+ * Validates state min sizes.
147
+ *
148
+ * @param {UISectionSize[]} sizes
149
+ */
150
+ validateStateMinSizes(sizes) {
151
+ // Prerequisite. Get size infos
152
+ let minSizesSum = 0;
153
+ let recalculateSizes = false;
154
+ const sizesInfo = [];
155
+ for (let i = 0; i < this.props.children.length; i++) {
156
+ //const size = this.getSectionCurrentSize(i);
157
+ const size = sizes[i].size || 0;
158
+ const minSize = this.getMinSectionSize(i);
159
+ if (minSize > size) {
160
+ recalculateSizes = true;
161
+ }
162
+ minSizesSum += minSize;
163
+ // Sizes data
164
+ sizesInfo.push({
165
+ size,
166
+ minSize,
167
+ spareSize: size - minSize
168
+ });
169
+ }
170
+ // First Part. Check if full screen required
171
+ const layoutSize = this.getRootSize();
172
+ // Second Part. Calculate sections which less than min size.
173
+ if (recalculateSizes && layoutSize >= minSizesSum) {
174
+ const recalculatedSizes = this.calculateSectionSizes(sizesInfo);
175
+ for (let i = 0; i < sizes.length; i++) {
176
+ sizes[i] = recalculatedSizes[i];
177
+ }
178
+ }
179
+ // Check full screen toggle
180
+ const isFullScreen = layoutSize < minSizesSum;
181
+ if (isFullScreen !== this.isFullScreen) {
182
+ this.isFullScreen = isFullScreen;
183
+ this.props.onToggleFullscreen?.(isFullScreen);
184
+ }
185
+ }
186
+ onWindowResize() {
187
+ let { sizes } = this.state;
188
+ // Dynamic section index
189
+ const layoutSize = this.getRootSize();
190
+ if (sizes) {
191
+ // Update sizes after resize
192
+ sizes = this.updateStateSizes(layoutSize, sizes);
193
+ // Apply state
194
+ this.ignoreAnimation = true;
195
+ this.setState({
196
+ sizes: sizes
197
+ });
198
+ }
199
+ this.rootSize = layoutSize;
200
+ }
201
+ /**
202
+ * Method returns indices of visible sections.
203
+ *
204
+ * @param {React.ReactNodeArray} sections Section elements.
205
+ * @returns {number[]} Indices of visible sections.
206
+ */
207
+ static getVisibleSections(sections) {
208
+ const visibleSections = [];
209
+ sections.forEach((child, i) => {
210
+ if (!UISections.isSectionVisible(child)) {
211
+ visibleSections.push(i);
212
+ }
213
+ });
214
+ return visibleSections;
215
+ }
216
+ /**
217
+ * Method checks is passed child section visible or not.
218
+ *
219
+ * @param {React.ReactElement | undefined} node React child node.
220
+ * @returns {boolean} True if section visible.
221
+ */
222
+ static isSectionVisible(node) {
223
+ if (node && node.type === UISection_1.UISection) {
224
+ return !node.props.hidden;
225
+ }
226
+ return false;
227
+ }
228
+ /**
229
+ * Method called when resizing of section started.
230
+ */
231
+ onSplitterResizeStart() {
232
+ const rootDom = this.rootRef.current;
233
+ const resizeSections = [];
234
+ if (rootDom && rootDom.childNodes) {
235
+ rootDom.classList.remove(SECTIONS_ANIMATION_CLASS);
236
+ for (let i = 0; i < rootDom.childNodes.length; i++) {
237
+ const minSectionSize = this.getMinSectionSize(i);
238
+ const siblingMinSectionSize = this.getMinSectionSize(i === 0 ? 1 : 0);
239
+ const sectionDom = rootDom.children[i];
240
+ const maxSize = Math.max(minSectionSize, rootDom[this.domSizeProperty] - siblingMinSectionSize);
241
+ resizeSections.push({
242
+ size: sectionDom[this.domSizeProperty],
243
+ dom: sectionDom,
244
+ maxSize,
245
+ section: this.resizeSections[i]
246
+ ? this.resizeSections[i].section
247
+ : {
248
+ percentage: false
249
+ }
250
+ });
251
+ }
252
+ }
253
+ this.resizeSections = resizeSections;
254
+ }
255
+ /**
256
+ * Method called when resizing of section is happening.
257
+ *
258
+ * @param {number} position Delta position in pixels.
259
+ * @returns {boolean} If resizing was happened - it can return false when splitter meets resizing limitation.
260
+ */
261
+ onSplitterResize(position) {
262
+ const resizeSections = position !== 0 ? this.resizeSections : [];
263
+ let left = 0;
264
+ for (let i = 0; i < resizeSections.length; i++) {
265
+ const minSectionSize = this.getMinSectionSize(i);
266
+ const resizeSection = resizeSections[i];
267
+ let newSize = resizeSection.size + (i === 0 ? position : -position);
268
+ if (minSectionSize === resizeSection.maxSize) {
269
+ // Ignore resize - section is not resizable
270
+ continue;
271
+ }
272
+ // Do not allow size exceed min and max boundaries
273
+ if (newSize < minSectionSize) {
274
+ position = this.correctBoundaryPosition(position, minSectionSize, newSize, i === 0);
275
+ newSize = minSectionSize;
276
+ }
277
+ else if (newSize > resizeSection.maxSize) {
278
+ position = this.correctBoundaryPosition(position, resizeSection.maxSize, newSize, i === 0);
279
+ newSize = resizeSection.maxSize;
280
+ }
281
+ const sectionSize = {
282
+ percentage: false
283
+ };
284
+ const nextSession = resizeSections[i + 1];
285
+ const right = nextSession ? nextSession.size - position : 0;
286
+ if (i > 0) {
287
+ sectionSize.size = newSize;
288
+ sectionSize.start = left;
289
+ resizeSection.dom.style[this.startPositionProperty] = left + 'px';
290
+ }
291
+ else {
292
+ sectionSize.start = 0;
293
+ resizeSection.dom.style[this.startPositionProperty] = '0px';
294
+ }
295
+ sectionSize.end = right;
296
+ resizeSection.dom.style[this.endPositionProperty] = right + 'px';
297
+ resizeSection.section = sectionSize;
298
+ left += newSize;
299
+ }
300
+ return false;
301
+ }
302
+ /**
303
+ * Method returns corrected position based on boundary and size.
304
+ *
305
+ * @param {number} position Delta position in pixels.
306
+ * @param {number} boundary Boundary position.
307
+ * @param {number} size Section size.
308
+ * @param {boolean} positive Direction.
309
+ * @returns {number} Position after correction based on boundary.
310
+ */
311
+ correctBoundaryPosition(position, boundary, size, positive) {
312
+ const diff = boundary - size;
313
+ return position + (positive ? diff : -diff);
314
+ }
315
+ /**
316
+ * Method called when resizing session ended.
317
+ */
318
+ onSplitterResizeEnd() {
319
+ const rootDom = this.rootRef.current;
320
+ if (rootDom && this.isAnimationEnabled()) {
321
+ rootDom.classList.add(SECTIONS_ANIMATION_CLASS);
322
+ }
323
+ const sizes = this.resizeSections.map((resizeSection) => resizeSection.section);
324
+ if (sizes.some((size) => size.end !== undefined || size.start !== undefined || size.size !== undefined)) {
325
+ this.setState({
326
+ sizes
327
+ });
328
+ }
329
+ this.props.onResize?.(sizes);
330
+ }
331
+ /**
332
+ * Method called when splitter with type 'Toggle' was toggled.
333
+ */
334
+ onSplitterToggle() {
335
+ if (this.props.onClose) {
336
+ this.props.onClose();
337
+ }
338
+ }
339
+ /**
340
+ * Method returns visible children sections count.
341
+ *
342
+ * @returns {number} Count of visible children sections.
343
+ */
344
+ getVisibleChildrenCount() {
345
+ return this.props.children.filter((child) => child && UISections.isSectionVisible(child))
346
+ .length;
347
+ }
348
+ /**
349
+ * Method returns size of section in percents.
350
+ *
351
+ * @param {number} index Target section index.
352
+ * @param {number} childrenCount Count of children.
353
+ * @param {boolean} [reverse=false] Reverse calculation(width vs right).
354
+ * @returns {number} Size of section in percents. For example 50% => 0.5.
355
+ */
356
+ getSizePercents(index, childrenCount, reverse = false) {
357
+ const { sizes = [], sizesAsPercents } = this.props;
358
+ let propSize = sizes[index];
359
+ if (propSize === undefined && index === this.state.dynamicSection) {
360
+ // Find available size
361
+ let newSize = 100;
362
+ sizes.every((size) => {
363
+ if (size) {
364
+ newSize -= size;
365
+ }
366
+ });
367
+ propSize = newSize;
368
+ }
369
+ if (propSize && sizesAsPercents) {
370
+ return reverse ? 100 - propSize : propSize;
371
+ }
372
+ return childrenCount > 0 ? 100 / childrenCount : 0;
373
+ }
374
+ /**
375
+ * Method gets section size when section size is not percent based and 'sizes' prop is passed from outside.
376
+ *
377
+ * @param {number} index Section index to look up.
378
+ * @param {number} childrenCount Count of visible children.
379
+ * @returns {React.CSSProperties | undefined} CSS Style object or undefined if no style from 'sizes' prop.
380
+ */
381
+ getSectionSize(index, childrenCount) {
382
+ if (this.props.sizesAsPercents ||
383
+ !this.props.sizes ||
384
+ childrenCount < 2 ||
385
+ (index >= this.props.sizes.length && index >= childrenCount)) {
386
+ return undefined;
387
+ }
388
+ const sectionStyle = {
389
+ [this.sizeProperty]: this.props.sizes[index] ? this.props.sizes[index] + 'px' : this.props.sizes[index]
390
+ };
391
+ if (index === 0) {
392
+ sectionStyle[this.startPositionProperty] = 0;
393
+ }
394
+ if (index === this.props.sizes.length - 1) {
395
+ sectionStyle[this.endPositionProperty] = 0;
396
+ }
397
+ else if (this.props.sizes[index + 1]) {
398
+ sectionStyle[this.endPositionProperty] = this.props.sizes[index + 1] + 'px';
399
+ }
400
+ return sectionStyle;
401
+ }
402
+ /**
403
+ * Gets position style value.
404
+ *
405
+ * @param {number} childrenCount
406
+ * @param {string} value
407
+ *
408
+ * @returns {string}
409
+ */
410
+ getPositionStyleValue(childrenCount, value) {
411
+ return childrenCount === 1 ? '0%' : value;
412
+ }
413
+ /**
414
+ * Method returns style object for passed visible section.
415
+ * Method calculates size of section depending on several points.
416
+ * 1. Section - resized or not.
417
+ * 2. Animation - off or on.
418
+ *
419
+ * @param {number} index Index of section.
420
+ * @returns {SectionStyleCalculation} Object which contains visibility state and styles to apply.
421
+ */
422
+ getVisibleSectionStyle(index) {
423
+ const sectionStyle = {
424
+ visible: true,
425
+ style: {}
426
+ };
427
+ // Use values from state or calculate initial percents
428
+ const childrenCount = this.getVisibleChildrenCount();
429
+ const stateSize = this.state.sizes && this.state.sizes[index];
430
+ if (childrenCount === this.props.children.length && stateSize) {
431
+ sectionStyle.style = {
432
+ ...(stateSize.start !== undefined && { [this.startPositionProperty]: stateSize.start + 'px' }),
433
+ ...(stateSize.end !== undefined && { [this.endPositionProperty]: stateSize.end + 'px' })
434
+ };
435
+ if (stateSize.size !== undefined && (stateSize.start === undefined || stateSize.end === undefined)) {
436
+ // No need to provide size if start and end defined
437
+ sectionStyle.style[this.sizeProperty] = stateSize.size + 'px';
438
+ }
439
+ }
440
+ else {
441
+ const toggleSectionSize = this.getSectionSize(index, childrenCount);
442
+ if (toggleSectionSize) {
443
+ sectionStyle.style = { ...sectionStyle.style, ...toggleSectionSize };
444
+ }
445
+ else {
446
+ const size = this.getSizePercents(index, childrenCount, true);
447
+ sectionStyle.style = {
448
+ [this.startPositionProperty]: this.getPositionStyleValue(childrenCount, `${index * size}%`),
449
+ [this.endPositionProperty]: this.getPositionStyleValue(childrenCount, `${(childrenCount - (index + 1)) * size}%`)
450
+ };
451
+ }
452
+ }
453
+ return sectionStyle;
454
+ }
455
+ /**
456
+ * Method returns style object for passed hidden section.
457
+ * Method calculates size of section depending on several points.
458
+ * 1. Section - resized or not.
459
+ * 2. Animation - off or on.
460
+ *
461
+ * @param {number} index Index of section.
462
+ * @returns {SectionStyleCalculation} Object which contains visibility state and styles to apply.
463
+ */
464
+ getHiddenSectionStyle(index) {
465
+ const sectionStyle = {
466
+ visible: false
467
+ };
468
+ // Hidden section when animation is ON
469
+ let stateSize = this.state.sizes && this.state.sizes[index];
470
+ if (!stateSize &&
471
+ this.props.splitterType === UISplitter_1.UISplitterType.Toggle &&
472
+ this.props.sizes &&
473
+ this.props.sizes[index]) {
474
+ stateSize = {
475
+ size: this.props.sizes[index],
476
+ percentage: false
477
+ };
478
+ }
479
+ let unit;
480
+ let size = 0;
481
+ if (stateSize) {
482
+ unit = 'px';
483
+ if (stateSize.size) {
484
+ size = stateSize.size;
485
+ }
486
+ else if (stateSize?.start !== undefined && stateSize?.end !== undefined) {
487
+ size = this.getRootSize() - stateSize.end - stateSize.start;
488
+ }
489
+ }
490
+ else {
491
+ const childrenCount = this.props.children.length;
492
+ const sectionSize = this.getSectionSize(index, childrenCount);
493
+ if (sectionSize && sectionSize.width) {
494
+ size = parseFloat(sectionSize.width.toString());
495
+ unit = 'px';
496
+ }
497
+ else {
498
+ size = this.getSizePercents(index, childrenCount);
499
+ unit = '%';
500
+ }
501
+ }
502
+ const hiddenPosition = -size + unit;
503
+ sectionStyle.style = {
504
+ [this.endPositionProperty]: index === 0 ? '100%' : hiddenPosition,
505
+ [this.startPositionProperty]: index === 0 ? hiddenPosition : '100%'
506
+ };
507
+ return sectionStyle;
508
+ }
509
+ /**
510
+ * Method returns minimal size for passed section.
511
+ *
512
+ * @param {number} index Index of section.
513
+ * @returns {number} Minimal size of section.
514
+ */
515
+ getMinSectionSize(index) {
516
+ const minSectionSize = this.props.minSectionSize;
517
+ let minSize = 0;
518
+ if (minSectionSize) {
519
+ minSize = Array.isArray(minSectionSize) ? minSectionSize[index] : minSectionSize;
520
+ }
521
+ return minSize;
522
+ }
523
+ /**
524
+ * Method returns class names string depending on props and component state.
525
+ *
526
+ * @param {boolean} fullSizeMode Is full size mode - only ine sction visible.
527
+ * @returns {number} Minimal size of section.
528
+ */
529
+ getClassNames(fullSizeMode) {
530
+ let classNames = ` ${this.props.vertical ? 'sections--vertical' : 'sections--horizontal'}`;
531
+ // Animation
532
+ const sectionsAnimationClass = ` ${SECTIONS_ANIMATION_CLASS}`;
533
+ classNames += `${this.isAnimationEnabled() ? sectionsAnimationClass : ''}`;
534
+ // Full 'screen' mode - only one section visible
535
+ classNames += `${fullSizeMode ? ' sections--full' : ''}`;
536
+ return classNames;
537
+ }
538
+ /**
539
+ * Method returns section's react element based on passed section index.
540
+ *
541
+ * @param {number} index Section index.
542
+ * @param {boolean} isSectionHidden Is section hidden.
543
+ * @returns {React.ReactElement | undefined} Section's react element.
544
+ */
545
+ getSection(index, isSectionHidden) {
546
+ const childNode = this.props.children[index];
547
+ const sectionStyle = UISections.isSectionVisible(childNode)
548
+ ? this.getVisibleSectionStyle(index)
549
+ : this.getHiddenSectionStyle(index);
550
+ if (!sectionStyle) {
551
+ return;
552
+ }
553
+ const splitterType = this.props.splitterType || UISplitter_1.UISplitterType.Resize;
554
+ const splitterLayoutType = this.props.splitterLayoutType || UISplitter_1.UISplitterLayoutType.Standard;
555
+ let isSplitterVisible = this.props.splitter && index > 0;
556
+ const isSingleSection = this.getVisibleChildrenCount() === 1;
557
+ if (isSingleSection && !this.isAnimationEnabled()) {
558
+ isSplitterVisible = false;
559
+ }
560
+ return (react_1.default.createElement("div", { key: index, className: `sections__item${isSplitterVisible ? ' sections__item--' + splitterType : ''}${!sectionStyle.visible ? ' sections__item--hidden' : ''}`, style: sectionStyle.style },
561
+ isSplitterVisible && childNode && (react_1.default.createElement(UISplitter_1.UISplitter, { vertical: this.props.vertical, onResize: this.onSplitterResize.bind(this), onResizeStart: this.onSplitterResizeStart.bind(this), onResizeEnd: this.onSplitterResizeEnd.bind(this), onToggle: this.onSplitterToggle.bind(this), hidden: isSectionHidden || isSingleSection, type: splitterType, title: this.props.splitterTitle, splitterLayoutType: splitterLayoutType })),
562
+ childNode));
563
+ }
564
+ /**
565
+ * Method checks if animation enabled with current state.
566
+ *
567
+ * @returns {boolean} True if animation is enabled.
568
+ */
569
+ isAnimationEnabled() {
570
+ return !this.ignoreAnimation && (this.props.animation === true || this.state.animate);
571
+ }
572
+ /**
573
+ * Method returns index of dynamicly sized section.
574
+ *
575
+ * @returns {number} Index of dynamicly sized section.
576
+ */
577
+ getDynamicSectionIndex() {
578
+ return this.state.dynamicSection !== undefined ? this.state.dynamicSection : 0;
579
+ }
580
+ /**
581
+ * Method converts passed positions to section position object.
582
+ *
583
+ * @param {UISectionSize} section Section size.
584
+ * @returns Position object.
585
+ */
586
+ getSectionPosition(section) {
587
+ return { start: section.start || 0, end: section.end || 0 };
588
+ }
589
+ /**
590
+ * Method calculates spare size for passed section.
591
+ *
592
+ * @param {SizeCalculationInfo} origin Section size.
593
+ * @param {SizeCalculationInfo[]} sizes All section sizes.
594
+ * @returns {number} Spare size.
595
+ */
596
+ getSpareSize(origin, sizes) {
597
+ let increaseSize = 0;
598
+ let target = origin.minSize - origin.size;
599
+ for (const info of sizes) {
600
+ if (info === origin) {
601
+ continue;
602
+ }
603
+ if (info.spareSize > 0) {
604
+ const useSize = Math.min(info.spareSize, target);
605
+ // Update targets
606
+ increaseSize += useSize;
607
+ info.spareSize -= useSize;
608
+ info.size -= useSize;
609
+ target -= useSize;
610
+ }
611
+ if (target <= 0) {
612
+ // Desireable target meet requirement
613
+ break;
614
+ }
615
+ }
616
+ return increaseSize;
617
+ }
618
+ /**
619
+ * Method converts SizeCalculationInfo into UISectionSize before applying sizes to state.
620
+ *
621
+ * @param {SizeCalculationInfo[]} sizes Section sizes.
622
+ * @returns {UISectionSize[]} Section sizes applyable for state.
623
+ */
624
+ calculateSectionSizes(sizes) {
625
+ // Calculate sizes
626
+ for (const section of sizes) {
627
+ if (section.size < section.minSize) {
628
+ const diff = this.getSpareSize(section, sizes);
629
+ if (diff) {
630
+ section.size += diff;
631
+ }
632
+ }
633
+ }
634
+ // Apply sizes to state
635
+ const stateSizes = [];
636
+ for (let i = 0; i < sizes.length; i++) {
637
+ const sectionSize = {
638
+ percentage: false
639
+ };
640
+ const current = sizes[i];
641
+ const next = sizes[i + 1];
642
+ const right = next ? next.size : 0;
643
+ if (i > 0) {
644
+ sectionSize.size = current.size;
645
+ sectionSize.start = undefined;
646
+ }
647
+ else {
648
+ sectionSize.start = 0;
649
+ }
650
+ sectionSize.end = right;
651
+ stateSizes.push(sectionSize);
652
+ }
653
+ return stateSizes;
654
+ }
655
+ /**
656
+ * Method recalculates "start" and "end" position based on size property.
657
+ *
658
+ * @param {UISectionSize[]} sizes Section sizes.
659
+ */
660
+ recalculatePositions(sizes) {
661
+ // Recalculate positions - START
662
+ let start = 0;
663
+ sizes.forEach((section) => {
664
+ section.start = start;
665
+ // Next start
666
+ start += section.size || 0;
667
+ });
668
+ // Recalculate positions - END
669
+ let end = 0;
670
+ for (let i = sizes.length - 1; i >= 0; i--) {
671
+ sizes[i].end = end;
672
+ // Next start
673
+ end += sizes[i].size || 0;
674
+ }
675
+ }
676
+ /**
677
+ * Method returns size of sections container.
678
+ *
679
+ * @returns {UISectionSize[]} Size of sections container.
680
+ */
681
+ getRootSize() {
682
+ const rootDom = this.rootRef.current;
683
+ return rootDom?.getBoundingClientRect()[this.sizeProperty] || 0;
684
+ }
685
+ /**
686
+ * @returns {React.ReactElement}
687
+ */
688
+ render() {
689
+ const sections = [];
690
+ let visibleSections = 0;
691
+ for (let i = 0; i < this.props.children.length; i++) {
692
+ const childNode = this.props.children[i];
693
+ const isSectionHidden = !UISections.isSectionVisible(childNode);
694
+ if (!isSectionHidden) {
695
+ visibleSections++;
696
+ }
697
+ const section = this.getSection(i, isSectionHidden);
698
+ if (section) {
699
+ sections.push(section);
700
+ }
701
+ }
702
+ return (react_1.default.createElement("div", { ref: this.rootRef, className: `sections ${this.getClassNames(visibleSections === 1)}`, style: {
703
+ ...(this.props.height && { height: this.props.height })
704
+ } }, sections));
705
+ }
706
+ }
707
+ exports.UISections = UISections;
708
+ UISections.Section = UISection_1.UISection;
709
+ //# sourceMappingURL=UISections.js.map