@adaptabletools/adaptable 21.2.2-canary.0 → 22.0.0-canary.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 (513) hide show
  1. package/icons/inspector.svg +1 -0
  2. package/index.css +6464 -5488
  3. package/index.css.map +1 -1
  4. package/package.json +5 -6
  5. package/src/AdaptableInterfaces/IAdaptable.d.ts +0 -1
  6. package/src/AdaptableState/ChartingState.d.ts +1 -1
  7. package/src/AdaptableState/Common/AdaptableAlert.d.ts +2 -2
  8. package/src/AdaptableState/Common/AdaptableIcon.d.ts +1 -1
  9. package/src/AdaptableState/Common/AdaptablePredicate.js +7 -3
  10. package/src/AdaptableState/Common/AggregationColumns.d.ts +3 -3
  11. package/src/AdaptableState/Common/DataUpdateConfig.d.ts +4 -4
  12. package/src/AdaptableState/TeamSharingState.d.ts +1 -1
  13. package/src/Api/CustomSortApi.d.ts +6 -1
  14. package/src/Api/Implementation/ColumnApiImpl.d.ts +3 -0
  15. package/src/Api/Implementation/ColumnApiImpl.js +12 -3
  16. package/src/Api/Implementation/CustomSortApiImpl.d.ts +2 -1
  17. package/src/Api/Implementation/CustomSortApiImpl.js +5 -1
  18. package/src/Api/Implementation/LayoutApiImpl.d.ts +1 -0
  19. package/src/Api/Implementation/LayoutApiImpl.js +85 -2
  20. package/src/Api/Implementation/LayoutHelpers.d.ts +2 -2
  21. package/src/Api/Implementation/ScheduleApiImpl.d.ts +1 -0
  22. package/src/Api/Implementation/ScheduleApiImpl.js +12 -0
  23. package/src/Api/Implementation/ShortcutApiImpl.d.ts +1 -0
  24. package/src/Api/Implementation/ShortcutApiImpl.js +4 -0
  25. package/src/Api/Implementation/StyledColumnApiImpl.d.ts +1 -0
  26. package/src/Api/Implementation/StyledColumnApiImpl.js +4 -0
  27. package/src/Api/Internal/AdaptableInternalApi.d.ts +0 -1
  28. package/src/Api/Internal/AdaptableInternalApi.js +3 -3
  29. package/src/Api/Internal/ColumnFilterInternalApi.js +1 -1
  30. package/src/Api/Internal/LayoutInternalApi.d.ts +5 -0
  31. package/src/Api/Internal/LayoutInternalApi.js +25 -0
  32. package/src/Api/LayoutApi.d.ts +7 -1
  33. package/src/Api/ScheduleApi.d.ts +5 -0
  34. package/src/Api/ShortcutApi.d.ts +5 -0
  35. package/src/Api/StyledColumnApi.d.ts +5 -0
  36. package/src/Redux/ActionsReducers/CommentsRedux.d.ts +1 -1
  37. package/src/Redux/ActionsReducers/DashboardRedux.d.ts +1 -1
  38. package/src/Redux/ActionsReducers/InternalRedux.d.ts +6 -6
  39. package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -9
  40. package/src/Redux/ActionsReducers/StyledColumnRedux.d.ts +6 -6
  41. package/src/Redux/ActionsReducers/StyledColumnRedux.js +16 -16
  42. package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +3 -0
  43. package/src/Strategy/FormatColumnModule.js +2 -2
  44. package/src/Strategy/Utilities/Alert/getAlertPreviewViewItems.js +1 -1
  45. package/src/Strategy/Utilities/FormatColumn/getFormatColumnSettingsViewItems.js +2 -1
  46. package/src/Strategy/Utilities/Layout/getLayoutFilterViewItems.js +4 -3
  47. package/src/Utilities/ExpressionFunctions/expressionFunctionUtils.d.ts +4 -4
  48. package/src/Utilities/Extensions/StringExtensions.d.ts +1 -1
  49. package/src/Utilities/Helpers/StyleHelper.d.ts +1 -1
  50. package/src/Utilities/Services/Interface/IAlertService.d.ts +2 -2
  51. package/src/Utilities/createAgStatusPanelComponent.d.ts +1 -1
  52. package/src/Utilities/getObjectTagsViewItems.js +1 -1
  53. package/src/Utilities/runIfNotResolvedIn.d.ts +1 -1
  54. package/src/View/AdaptableComputedCSSVarsContext.js +6 -1
  55. package/src/View/AdaptablePopover/index.d.ts +1 -1
  56. package/src/View/AdaptablePopover/index.js +3 -3
  57. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableOptionsForm.js +7 -8
  58. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +7 -6
  59. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.d.ts +4 -2
  60. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.js +3 -3
  61. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +9 -9
  62. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +3 -3
  63. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.js +4 -4
  64. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +4 -4
  65. package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +2 -2
  66. package/src/View/AdaptableWizardView/Wizard.js +1 -1
  67. package/src/View/AdaptableWizardView/index.js +1 -4
  68. package/src/View/Alert/ActiveAlertsPanelItemLabel.js +2 -2
  69. package/src/View/Alert/AlertStatusSubPanel.js +1 -1
  70. package/src/View/Alert/AlertViewPanel.js +2 -2
  71. package/src/View/Alert/Utilities/getDefaultAlertDefinition.d.ts +3 -20
  72. package/src/View/Alert/Wizard/AlertBehaviourWizardSection.js +15 -13
  73. package/src/View/Alert/Wizard/AlertButtonsEditor.js +25 -22
  74. package/src/View/Alert/Wizard/AlertMessageWizardSection.js +12 -16
  75. package/src/View/Alert/Wizard/AlertNotificationWizardSection.d.ts +3 -1
  76. package/src/View/Alert/Wizard/AlertNotificationWizardSection.js +7 -7
  77. package/src/View/Alert/Wizard/AlertRulesWizardSection.js +2 -2
  78. package/src/View/Alert/Wizard/AlertScopeWizardSection.js +2 -2
  79. package/src/View/Alert/Wizard/AlertTypeWizardSection.js +1 -1
  80. package/src/View/Alert/Wizard/AlertWizard.js +8 -8
  81. package/src/View/Alert/Wizard/BaseAlertScopeWizardSection.js +11 -8
  82. package/src/View/BulkUpdate/BulkUpdatePopup.js +11 -11
  83. package/src/View/BulkUpdate/BulkUpdateViewPanel.js +4 -4
  84. package/src/View/CalculatedColumn/CalculatedColumnSummary.d.ts +1 -1
  85. package/src/View/CalculatedColumn/Wizard/CalculatedColumnDefinitionWizardSection.js +8 -8
  86. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.d.ts +1 -1
  87. package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +4 -4
  88. package/src/View/CalculatedColumn/Wizard/CalculatedColumnSettingsWizardSection.js +4 -5
  89. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.d.ts +1 -1
  90. package/src/View/CalculatedColumn/Wizard/CalculatedColumnTypeSection.js +1 -1
  91. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.d.ts +0 -2
  92. package/src/View/CalculatedColumn/Wizard/CalculatedColumnWizard.js +8 -14
  93. package/src/View/CalculatedColumn/Wizard/calculatedColumnTypes.d.ts +2 -0
  94. package/src/View/CalculatedColumn/Wizard/calculatedColumnTypes.js +6 -0
  95. package/src/View/CellSummary/CellSummaryPopup.js +1 -1
  96. package/src/View/CellSummary/CellSummaryViewPanel.js +5 -5
  97. package/src/View/Charting/ChartingStatusBarPopover.js +4 -4
  98. package/src/View/Charting/ChartingViewPanel.js +7 -7
  99. package/src/View/Charting/ChartingWizard/AgChargingWizard/AgChargingWizard.js +4 -4
  100. package/src/View/Charting/ChartingWizard/ExternalChartingWizard/ExternalChartingWizard.js +3 -3
  101. package/src/View/Charting/useChartingElements.d.ts +1 -1
  102. package/src/View/Charting/useChartingElements.js +1 -1
  103. package/src/View/ColumnInfo/ColumnInfo.js +14 -19
  104. package/src/View/ColumnInfo/ColumnInfoPopup.js +2 -2
  105. package/src/View/Comments/CommentsEditor.js +14 -17
  106. package/src/View/Comments/CommentsPopup.js +6 -6
  107. package/src/View/Components/AdaptableDateInput/index.js +1 -1
  108. package/src/View/Components/AdaptableInput/index.js +3 -2
  109. package/src/View/Components/AdaptableObjectCollection/index.d.ts +2 -2
  110. package/src/View/Components/AdaptableObjectCollection/index.js +9 -5
  111. package/src/View/Components/AdaptableObjectList/AdaptableObjectCompactList.js +10 -10
  112. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.d.ts +2 -0
  113. package/src/View/Components/AdaptableObjectList/AdaptableObjectList.js +20 -18
  114. package/src/View/Components/AdaptableObjectRow/index.d.ts +1 -0
  115. package/src/View/Components/AdaptableObjectRow/index.js +4 -5
  116. package/src/View/Components/Buttons/ButtonBase/index.d.ts +1 -2
  117. package/src/View/Components/Buttons/ButtonBase/index.js +5 -4
  118. package/src/View/Components/Buttons/ButtonClear.js +2 -1
  119. package/src/View/Components/Buttons/ButtonFunction.js +2 -1
  120. package/src/View/Components/Buttons/ButtonNew.d.ts +11 -1
  121. package/src/View/Components/Buttons/ButtonNew.js +2 -1
  122. package/src/View/Components/Buttons/EntityListActionButtons.d.ts +1 -1
  123. package/src/View/Components/Buttons/EntityListActionButtons.js +14 -43
  124. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.d.ts +1 -0
  125. package/src/View/Components/Buttons/SuspendToggleButton/SuspendToggleButton.js +3 -2
  126. package/src/View/Components/CellPopup/index.d.ts +1 -1
  127. package/src/View/Components/ColumnFilter/AdaptableColumnFilter.d.ts +4 -3
  128. package/src/View/Components/ColumnFilter/ColumnFilter.d.ts +4 -2
  129. package/src/View/Components/ColumnFilter/ColumnFilter.js +26 -23
  130. package/src/View/Components/ColumnFilter/ColumnFilterWindow.js +6 -6
  131. package/src/View/Components/ColumnFilter/FloatingFilter.js +6 -6
  132. package/src/View/Components/ColumnFilter/components/ColumnFilterInput.d.ts +1 -1
  133. package/src/View/Components/ColumnFilter/components/ColumnFilterInput.js +2 -2
  134. package/src/View/Components/ColumnFilter/components/ColumnFilterInputList.js +1 -1
  135. package/src/View/Components/ColumnFilter/components/ColumnFilterMenu.js +6 -6
  136. package/src/View/Components/ColumnFilter/useAdaptableFilterWrapper.d.ts +1 -1
  137. package/src/View/Components/ColumnFilter/useAdaptableFilterWrapper.js +9 -1
  138. package/src/View/Components/ColumnSelector/index.js +1 -3
  139. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicateEditor.js +10 -10
  140. package/src/View/Components/EntityRulesEditor/EntityRulePredicatesEditor/EntityRulePredicatesEditor.js +11 -15
  141. package/src/View/Components/EntityRulesEditor/index.d.ts +5 -2
  142. package/src/View/Components/EntityRulesEditor/index.js +11 -10
  143. package/src/View/Components/ExpressionWizard.js +4 -4
  144. package/src/View/Components/FilterForm/Waiting.d.ts +4 -2
  145. package/src/View/Components/FilterForm/Waiting.js +3 -2
  146. package/src/View/Components/Forms/AdaptableFormControlTextClear.d.ts +1 -0
  147. package/src/View/Components/Forms/AdaptableFormControlTextClear.js +4 -8
  148. package/src/View/Components/ModuleValueSelector/index.js +2 -2
  149. package/src/View/Components/NewScopeComponent.js +20 -20
  150. package/src/View/Components/Panels/PanelFooter.js +5 -5
  151. package/src/View/Components/Panels/PanelToolPanel/index.d.ts +1 -1
  152. package/src/View/Components/Panels/PanelToolPanel/index.js +9 -11
  153. package/src/View/Components/Panels/PanelWithButton.d.ts +3 -5
  154. package/src/View/Components/Panels/PanelWithButton.js +7 -6
  155. package/src/View/Components/Panels/PanelWithImage.d.ts +2 -3
  156. package/src/View/Components/Panels/PanelWithImage.js +10 -12
  157. package/src/View/Components/Panels/PanelWithRow.d.ts +0 -1
  158. package/src/View/Components/Panels/PanelWithRow.js +3 -3
  159. package/src/View/Components/Panels/PanelWithTwoButtons.d.ts +1 -1
  160. package/src/View/Components/Panels/PanelWithTwoButtons.js +3 -3
  161. package/src/View/Components/Popups/AdaptableLoadingScreen.js +3 -5
  162. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopup.js +4 -3
  163. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupDialog.js +3 -2
  164. package/src/View/Components/Popups/AdaptablePopup/AdaptablePopupModuleView.js +4 -4
  165. package/src/View/Components/Popups/AdaptablePopup/Navigation.js +63 -31
  166. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.d.ts +2 -0
  167. package/src/View/Components/Popups/AdaptablePopup/PopupPanel.js +8 -9
  168. package/src/View/Components/Popups/AdaptablePopup/TopBar.js +5 -4
  169. package/src/View/Components/Popups/AdaptablePopup/useMenuItems.d.ts +1 -1
  170. package/src/View/Components/Popups/AdaptablePopupAlert.js +6 -11
  171. package/src/View/Components/Popups/AdaptablePopupConfirmation.js +6 -6
  172. package/src/View/Components/Popups/AdaptablePopupPrompt.js +7 -7
  173. package/src/View/Components/Popups/AdaptablePopupTeamSharing.js +9 -11
  174. package/src/View/Components/Popups/FormPopups/FormPopups.js +3 -3
  175. package/src/View/Components/Popups/GridCellPopup/GridCellPopup.js +1 -1
  176. package/src/View/Components/Popups/WindowPopups/WindowPopups.js +3 -3
  177. package/src/View/Components/Popups/WindowPopups/windowFactory.d.ts +0 -1
  178. package/src/View/Components/PredicateEditor/PredicateEditor.js +7 -7
  179. package/src/View/Components/PreviewResultsPanel.d.ts +1 -0
  180. package/src/View/Components/PreviewResultsPanel.js +6 -13
  181. package/src/View/Components/RangesComponent.js +19 -19
  182. package/src/View/Components/ReorderDraggable/index.d.ts +2 -0
  183. package/src/View/Components/ReorderDraggable/index.js +8 -7
  184. package/src/View/Components/Selectors/BulkUpdateValueSelector.js +4 -7
  185. package/src/View/Components/Selectors/ColumnSelector.js +1 -1
  186. package/src/View/Components/Selectors/ColumnSelectorOld.js +1 -1
  187. package/src/View/Components/StyleComponent.d.ts +2 -26
  188. package/src/View/Components/StyleComponent.js +186 -190
  189. package/src/View/Components/TagValueSelector/index.d.ts +1 -1
  190. package/src/View/Components/TagValueSelector/index.js +4 -3
  191. package/src/View/Components/ToolPanel/AdaptableToolPanel.d.ts +1 -1
  192. package/src/View/Components/ToolPanel/AdaptableToolPanel.js +13 -12
  193. package/src/View/Components/ToolPanel/ToolPanelPopup.d.ts +1 -1
  194. package/src/View/Components/ToolPanel/ToolPanelPopup.js +13 -10
  195. package/src/View/Components/ToolPanel/ToolPanelWrapper.js +2 -2
  196. package/src/View/Components/ValueSelector/index.d.ts +9 -33
  197. package/src/View/Components/ValueSelector/index.js +38 -61
  198. package/src/View/Components/WizardSummaryPage.js +1 -1
  199. package/src/View/CustomSort/Wizard/CustomSortColumnWizardSection.js +2 -2
  200. package/src/View/CustomSort/Wizard/CustomSortValuesWizardSection.js +4 -7
  201. package/src/View/CustomSort/Wizard/CustomSortWizard.js +5 -5
  202. package/src/View/Dashboard/Dashboard.js +3 -3
  203. package/src/View/Dashboard/DashboardPopup.js +27 -23
  204. package/src/View/Dashboard/DashboardViewPanel.js +4 -4
  205. package/src/View/Dashboard/PinnedDashboard.js +3 -3
  206. package/src/View/Dashboard/PinnedToolbarsSelector.js +3 -2
  207. package/src/View/DataChangeHistory/DataChangeHistoryPopup.js +10 -10
  208. package/src/View/DataChangeHistory/DataChangeHistoryViewPanel.js +7 -7
  209. package/src/View/DataImport/DataImportPopup.js +2 -2
  210. package/src/View/DataImport/DataImportWizard/DataImportWizard.js +2 -2
  211. package/src/View/DataImport/DataImportWizard/sections/ColumnsSection.js +6 -6
  212. package/src/View/DataImport/DataImportWizard/sections/ImportSection.js +4 -4
  213. package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadFileSection.js +1 -1
  214. package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadSection.js +4 -4
  215. package/src/View/DataImport/DataImportWizard/sections/UploadSection/UploadTextSection.js +1 -1
  216. package/src/View/DataImport/DataImportWizard/sections/ValidationSection.js +4 -4
  217. package/src/View/DataSet/DataSetViewPanel.d.ts +2 -2
  218. package/src/View/DataSet/DataSetViewPanel.js +2 -2
  219. package/src/View/Export/ExportDestinationPicker.js +2 -1
  220. package/src/View/Export/ExportViewPanel.js +4 -4
  221. package/src/View/Export/ReportFormatSelector.js +3 -3
  222. package/src/View/Export/ReportListItem.js +1 -1
  223. package/src/View/Export/ReportNameSelector.js +3 -3
  224. package/src/View/Export/Wizard/NewReportWizard.js +4 -4
  225. package/src/View/Export/Wizard/ReportColumnTypeWizard.js +8 -8
  226. package/src/View/Export/Wizard/ReportColumnsWizardSection.js +11 -11
  227. package/src/View/Export/Wizard/ReportNameWizardSection.js +4 -4
  228. package/src/View/Export/Wizard/ReportRowTypeWizard.js +8 -8
  229. package/src/View/Export/Wizard/ReportRowsWizardSection.js +9 -9
  230. package/src/View/Export/Wizard/ReportSettingsWizard.js +3 -3
  231. package/src/View/Filter/FilterSummary.d.ts +1 -1
  232. package/src/View/Filter/FilterSummary.js +1 -1
  233. package/src/View/Filter/FilterViewPanel.d.ts +2 -2
  234. package/src/View/Filter/FilterViewPanel.js +4 -4
  235. package/src/View/FlashingCell/FlashingCellStyle.d.ts +2 -2
  236. package/src/View/FlashingCell/FlashingCellStyle.js +4 -4
  237. package/src/View/FlashingCell/Wizard/FlashingCellScopeWizardSection.js +2 -2
  238. package/src/View/FlashingCell/Wizard/FlashingCellSettingsWizardSection.js +11 -11
  239. package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.d.ts +2 -2
  240. package/src/View/FlashingCell/Wizard/FlashingCellStyleWizardSection.js +4 -4
  241. package/src/View/FlashingCell/Wizard/FlashingCellWizard.js +5 -5
  242. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.d.ts +1 -1
  243. package/src/View/FormatColumn/Wizard/FormatColumnFormatWizardSection.js +59 -64
  244. package/src/View/FormatColumn/Wizard/FormatColumnRuleWizardSection.js +1 -1
  245. package/src/View/FormatColumn/Wizard/FormatColumnScopeWizardSection.js +0 -4
  246. package/src/View/FormatColumn/Wizard/FormatColumnSettingsWizardSection.js +28 -28
  247. package/src/View/FormatColumn/Wizard/FormatColumnStyleWizardSection.js +2 -2
  248. package/src/View/FormatColumn/Wizard/FormatColumnTargetWizardSection.js +2 -2
  249. package/src/View/FormatColumn/Wizard/FormatColumnWizard.js +8 -8
  250. package/src/View/FreeTextColumn/Wizard/FreeTextColumnSettingsWizardSection.js +11 -11
  251. package/src/View/FreeTextColumn/Wizard/FreeTextColumnWizard.js +4 -4
  252. package/src/View/GridFilter/GridFilterExpressionEditor.js +6 -6
  253. package/src/View/GridFilter/GridFilterPopup.js +31 -40
  254. package/src/View/GridFilter/GridFilterPopupUI/index.d.ts +68 -0
  255. package/src/View/GridFilter/GridFilterPopupUI/index.js +42 -0
  256. package/src/View/GridFilter/GridFilterViewPanel.js +14 -21
  257. package/src/View/GridFilter/NamedQuerySelector.js +7 -7
  258. package/src/View/GridFilter/useGridFilterExpressionEditor.d.ts +5 -1
  259. package/src/View/GridFilter/useGridFilterExpressionEditor.js +2 -1
  260. package/src/View/GridInfo/GridInfoPopup/AdaptableObjectsSummary.d.ts +3 -1
  261. package/src/View/GridInfo/GridInfoPopup/AdaptableObjectsSummary.js +4 -3
  262. package/src/View/GridInfo/GridInfoPopup/AdaptableOptionsComponent.js +5 -9
  263. package/src/View/GridInfo/GridInfoPopup/GridInfoPopup.js +7 -7
  264. package/src/View/KeyHint.d.ts +5 -2
  265. package/src/View/KeyHint.js +4 -2
  266. package/src/View/Layout/EditCurrentLayoutButton.js +1 -1
  267. package/src/View/Layout/LayoutStatusBarSubPanelPopover.js +1 -1
  268. package/src/View/Layout/LayoutViewPanel.d.ts +3 -3
  269. package/src/View/Layout/LayoutViewPanel.js +2 -2
  270. package/src/View/Layout/TransposedPopup.js +4 -4
  271. package/src/View/Layout/Wizard/LayoutWizard.js +18 -18
  272. package/src/View/Layout/Wizard/sections/AggregationsSection.js +6 -8
  273. package/src/View/Layout/Wizard/sections/ColumnsSection.js +213 -138
  274. package/src/View/Layout/Wizard/sections/FilterSection.js +6 -7
  275. package/src/View/Layout/Wizard/sections/GridFilterSection.js +2 -2
  276. package/src/View/Layout/Wizard/sections/PivotAggregationsSection.js +15 -18
  277. package/src/View/Layout/Wizard/sections/PivotColumnsSection.js +4 -6
  278. package/src/View/Layout/Wizard/sections/PivotRowGroupingSection.js +3 -5
  279. package/src/View/Layout/Wizard/sections/RowGroupingSection.js +8 -10
  280. package/src/View/Layout/Wizard/sections/RowSummarySection.js +15 -17
  281. package/src/View/Layout/Wizard/sections/SettingsSection.js +8 -8
  282. package/src/View/Layout/Wizard/sections/SortSection.js +5 -7
  283. package/src/View/License/LicenseWatermark.js +1 -1
  284. package/src/View/NamedQuery/Wizard/NamedQueryExpressionWizardSection.js +2 -2
  285. package/src/View/NamedQuery/Wizard/NamedQuerySettingsWizardSection.js +3 -3
  286. package/src/View/NamedQuery/Wizard/NamedQueryWizard.js +3 -3
  287. package/src/View/Note/NoteEditor.js +5 -1
  288. package/src/View/PlusMinus/Wizard/PlusMinusSettingsWizardSection.js +5 -5
  289. package/src/View/PlusMinus/Wizard/PlusMinusWizard.js +4 -4
  290. package/src/View/QuickSearch/FloatingQuickSearch/FloatingQuickSearch.js +2 -2
  291. package/src/View/QuickSearch/QuickSearchInput.d.ts +1 -0
  292. package/src/View/QuickSearch/QuickSearchInput.js +5 -5
  293. package/src/View/QuickSearch/QuickSearchPopup.js +17 -16
  294. package/src/View/QuickSearch/QuickSearchViewPanel.js +1 -1
  295. package/src/View/Schedule/Wizard/ScheduleScheduleWizard.js +4 -4
  296. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsIPushPull.js +5 -5
  297. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsOpenFin.js +2 -2
  298. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReminder.js +4 -4
  299. package/src/View/Schedule/Wizard/ScheduleSettingsWizard/ScheduleSettingsReport.js +5 -5
  300. package/src/View/Schedule/Wizard/ScheduleWizard.js +5 -5
  301. package/src/View/Shortcut/Wizard/ShortcutSettingsWizard.js +5 -8
  302. package/src/View/Shortcut/Wizard/ShortcutWizard.js +5 -5
  303. package/src/View/SmartEdit/SmartEditPopup.d.ts +1 -1
  304. package/src/View/SmartEdit/SmartEditPopup.js +8 -8
  305. package/src/View/SmartEdit/SmartEditViewPanel.js +1 -1
  306. package/src/View/SpecialColumnSettingsWizardStep.js +4 -4
  307. package/src/View/StateManagement/StateManagementPopup.js +12 -12
  308. package/src/View/StateManagement/StateManagementViewPanel.js +1 -1
  309. package/src/View/StateManagement/handleExportState.d.ts +1 -1
  310. package/src/View/StatusBar/AdaptableStatusBar.js +1 -1
  311. package/src/View/StatusBar/StatusBarPanel.d.ts +2 -2
  312. package/src/View/StatusBar/StatusBarPanel.js +5 -4
  313. package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +9 -9
  314. package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +51 -48
  315. package/src/View/StyledColumn/Wizard/StyledColumnWizard.js +8 -8
  316. package/src/View/StyledColumn/Wizard/StyledColumnWizardColumnSection.js +2 -2
  317. package/src/View/StyledColumn/Wizard/StyledColumnWizardSettingsSection.js +18 -18
  318. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarColumnComparisonPreview.js +3 -3
  319. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarRangesPreview.js +4 -5
  320. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/PercentBarStylePreview.js +5 -5
  321. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgePreview.js +2 -2
  322. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/Components/StyledColumnBadgeSettings.js +4 -6
  323. package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +14 -15
  324. package/src/View/StyledColumn/Wizard/StyledColumnWizardTypeSection.js +4 -4
  325. package/src/View/SystemStatus/SystemStatusEntityRow.js +3 -3
  326. package/src/View/SystemStatus/SystemStatusPopup.js +2 -2
  327. package/src/View/SystemStatus/SystemStatusStatusBarContent.js +2 -2
  328. package/src/View/SystemStatus/SystemStatusViewPanel.d.ts +2 -2
  329. package/src/View/SystemStatus/SystemStatusViewPanel.js +2 -2
  330. package/src/View/TeamSharing/SharedEntityDependencies.js +4 -4
  331. package/src/View/TeamSharing/SharedEntityObjectView.js +8 -8
  332. package/src/View/Theme/ThemeEditor.js +6 -31
  333. package/src/View/Theme/ThemeEditorWindow.js +2 -2
  334. package/src/View/Theme/ThemeField.js +1 -2
  335. package/src/View/Theme/ThemePopup.d.ts +1 -1
  336. package/src/View/Theme/ThemePopup.js +4 -4
  337. package/src/View/Theme/ThemeStatusbar.js +1 -1
  338. package/src/View/Theme/VariantSelector.js +1 -1
  339. package/src/View/UIHelper.d.ts +1 -1
  340. package/src/View/Wizard/Interface/IAdaptableWizard.d.ts +1 -1
  341. package/src/View/Wizard/ObjectTagsWizardSection.js +2 -4
  342. package/src/View/Wizard/OnePageAdaptableWizard.d.ts +10 -4
  343. package/src/View/Wizard/OnePageAdaptableWizard.js +14 -16
  344. package/src/View/Wizard/OnePageWizards.d.ts +10 -4
  345. package/src/View/Wizard/OnePageWizards.js +50 -64
  346. package/src/View/Wizard/TypeRadio.js +3 -3
  347. package/src/View/Wizard/WizardLegend.js +3 -4
  348. package/src/View/Wizard/useKeyboardNavigation.d.ts +1 -1
  349. package/src/View/Wizard/useKeyboardNavigation.js +7 -4
  350. package/src/View/renderWithAdaptableContext.js +2 -5
  351. package/src/agGrid/AdaptableAgGrid.d.ts +2 -3
  352. package/src/agGrid/AdaptableAgGrid.js +92 -14
  353. package/src/agGrid/AdaptableFilterHandler.d.ts +5 -7
  354. package/src/agGrid/AdaptableFilterHandler.js +12 -28
  355. package/src/agGrid/AgGridColumnAdapter.d.ts +6 -1
  356. package/src/agGrid/AgGridColumnAdapter.js +26 -5
  357. package/src/agGrid/AgGridFilterAdapter.js +1 -1
  358. package/src/agGrid/AgGridFloatingFilterAdapter.js +1 -21
  359. package/src/agGrid/editors/AdaptableNumberEditor/InternalAdaptableNumberEditor.js +1 -5
  360. package/src/agGrid/editors/AdaptablePercentageEditor/InternalAdaptablePercentageEditor.js +1 -5
  361. package/src/components/AdaptableFormComponent/AdaptableFormComponent.js +9 -8
  362. package/src/components/Card/index.d.ts +25 -0
  363. package/src/components/Card/index.js +45 -0
  364. package/src/components/CheckBox/index.d.ts +3 -4
  365. package/src/components/CheckBox/index.js +7 -9
  366. package/src/components/CodeBlock/index.d.ts +6 -2
  367. package/src/components/CodeBlock/index.js +3 -3
  368. package/src/components/ColorPicker/ColorPicker.d.ts +1 -1
  369. package/src/components/ColorPicker/ColorPicker.js +10 -9
  370. package/src/components/Dashboard/Dashboard.js +1 -1
  371. package/src/components/Dashboard/DashboardToolbar.js +5 -6
  372. package/src/components/Datepicker/index.d.ts +2 -2
  373. package/src/components/Datepicker/index.js +9 -8
  374. package/src/components/Dialog/index.d.ts +8 -2
  375. package/src/components/Dialog/index.js +7 -7
  376. package/src/components/DragAndDropContext/DragAndDropContext.d.ts +1 -1
  377. package/src/components/DragAndDropContext/ModuleManager.d.ts +1 -0
  378. package/src/components/DragAndDropContext/ModuleManager.js +9 -6
  379. package/src/components/DragAndDropContext/TabList.d.ts +2 -1
  380. package/src/components/DragAndDropContext/TabList.js +44 -24
  381. package/src/components/DragAndDropContext/UnusedPanel.js +7 -15
  382. package/src/components/Dropdown/index.d.ts +2 -2
  383. package/src/components/Dropdown/index.js +5 -6
  384. package/src/components/DropdownButton/index.d.ts +2 -22
  385. package/src/components/DropdownButton/index.js +7 -4
  386. package/src/components/EmptyContent/index.d.ts +2 -2
  387. package/src/components/EmptyContent/index.js +4 -4
  388. package/src/components/ErrorBox/index.d.ts +2 -2
  389. package/src/components/ErrorBox/index.js +3 -3
  390. package/src/components/ExpressionEditor/BaseEditorInput.js +65 -48
  391. package/src/components/ExpressionEditor/DataTableEditor.js +6 -10
  392. package/src/components/ExpressionEditor/EditorButton.js +0 -2
  393. package/src/components/ExpressionEditor/EditorContext.d.ts +0 -1
  394. package/src/components/ExpressionEditor/EditorInputWithWhereClause.js +5 -5
  395. package/src/components/ExpressionEditor/ExpressionFunctionDocumentation.js +9 -11
  396. package/src/components/ExpressionEditor/NamedQueryContext.d.ts +0 -1
  397. package/src/components/ExpressionEditor/NamedQueryEditor.js +6 -16
  398. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.d.ts +2 -10
  399. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilder.js +6 -6
  400. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.d.ts +1 -1
  401. package/src/components/ExpressionEditor/QueryBuilder/QueryBuilderInputs.js +7 -7
  402. package/src/components/ExpressionEditor/QueryBuilder/QueryPredicateBuilder.js +9 -14
  403. package/src/components/ExpressionEditor/index.d.ts +1 -0
  404. package/src/components/ExpressionEditor/index.js +29 -34
  405. package/src/components/FieldWrap/index.d.ts +9 -2
  406. package/src/components/FieldWrap/index.js +3 -8
  407. package/src/components/FileDroppable/FileDroppableState.d.ts +0 -1
  408. package/src/components/FileDroppable/index.d.ts +3 -2
  409. package/src/components/FileDroppable/index.js +3 -3
  410. package/src/components/Flex.d.ts +15 -1
  411. package/src/components/Flex.js +40 -1
  412. package/src/components/FlexWithFooter.d.ts +3 -2
  413. package/src/components/FlexWithFooter.js +4 -4
  414. package/src/components/FormLayout/index.d.ts +5 -1
  415. package/src/components/FormLayout/index.js +1 -1
  416. package/src/components/HelpBlock/index.d.ts +2 -2
  417. package/src/components/HelpBlock/index.js +4 -3
  418. package/src/components/IconSelector/IconSelector.js +8 -8
  419. package/src/components/Input/index.d.ts +1 -2
  420. package/src/components/Input/index.js +6 -3
  421. package/src/components/Modal/Backdrop.js +1 -1
  422. package/src/components/Modal/index.d.ts +3 -2
  423. package/src/components/Modal/index.js +3 -3
  424. package/src/components/OverlayTrigger/index.js +3 -0
  425. package/src/components/Panel/index.d.ts +22 -6
  426. package/src/components/Panel/index.js +54 -15
  427. package/src/components/PopupWithFooter.js +3 -4
  428. package/src/components/ProgressIndicator/ProgressIndicator.js +3 -3
  429. package/src/components/Radio/index.d.ts +25 -3
  430. package/src/components/Radio/index.js +18 -20
  431. package/src/components/Select/Select.js +33 -21
  432. package/src/components/SelectList.js +1 -1
  433. package/src/components/SelectableList/index.d.ts +1 -1
  434. package/src/components/SimpleButton/index.d.ts +4 -6
  435. package/src/components/SimpleButton/index.js +55 -23
  436. package/src/components/SizedContainer/index.d.ts +3 -1
  437. package/src/components/SizedContainer/index.js +1 -1
  438. package/src/components/StylePreview.d.ts +3 -1
  439. package/src/components/StylePreview.js +4 -3
  440. package/src/components/Tabs/index.d.ts +3 -3
  441. package/src/components/Tabs/index.js +26 -9
  442. package/src/components/Tag/Tag.d.ts +14 -2
  443. package/src/components/Tag/Tag.js +10 -3
  444. package/src/components/Tag/index.d.ts +1 -1
  445. package/src/components/Tag/index.js +1 -1
  446. package/src/components/Textarea/index.d.ts +5 -1
  447. package/src/components/Textarea/index.js +4 -3
  448. package/src/components/Toggle/Toggle.js +48 -3
  449. package/src/components/Toggle/ToggleGroup.d.ts +7 -0
  450. package/src/components/Toggle/ToggleGroup.js +57 -2
  451. package/src/components/ToggleButton/index.d.ts +2 -2
  452. package/src/components/ToggleButton/index.js +25 -7
  453. package/src/components/Tree/TreeDropdown/index.js +10 -15
  454. package/src/components/Tree/TreeList/index.js +5 -9
  455. package/src/components/WarningBox/index.d.ts +6 -2
  456. package/src/components/WarningBox/index.js +3 -3
  457. package/src/components/WizardPanel/index.d.ts +6 -1
  458. package/src/components/WizardPanel/index.js +2 -2
  459. package/src/components/icons/DefaultIcon.d.ts +1 -0
  460. package/src/components/icons/index.d.ts +1 -1
  461. package/src/components/icons/index.js +2 -0
  462. package/src/components/icons/inspector.d.ts +3 -0
  463. package/src/components/icons/inspector.js +5 -0
  464. package/src/components/twUtils.d.ts +7 -0
  465. package/src/components/twUtils.js +13 -0
  466. package/src/components/utils/useDraggable.d.ts +0 -1
  467. package/src/devTools/index.d.ts +23 -23
  468. package/src/env.js +2 -2
  469. package/src/layout-manager/src/LMEmitter.d.ts +1 -0
  470. package/src/layout-manager/src/LMEmitter.js +1 -0
  471. package/src/layout-manager/src/index.js +2 -2
  472. package/src/migration/VersionUpgrade20.js +6 -5
  473. package/src/twMerge.d.ts +1 -0
  474. package/src/twMerge.js +11 -0
  475. package/themes/dark.css +35 -9
  476. package/themes/light.css +0 -2
  477. package/tsconfig.esm.tsbuildinfo +1 -1
  478. package/base.css +0 -5602
  479. package/base.css.map +0 -1
  480. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.d.ts +0 -3
  481. package/src/Strategy/Utilities/FormatColumn/getFormatColumnStyleViewItems.js +0 -6
  482. package/src/View/Alert/AlertsPanel.d.ts +0 -14
  483. package/src/View/Alert/AlertsPanel.js +0 -38
  484. package/src/View/Alert/Wizard/AlertSelectQueryWizard.d.ts +0 -19
  485. package/src/View/Alert/Wizard/AlertSelectQueryWizard.js +0 -54
  486. package/src/View/Components/FilterForm/ListBoxMenu.d.ts +0 -14
  487. package/src/View/Components/FilterForm/ListBoxMenu.js +0 -28
  488. package/src/View/Components/ListBox/DualListBoxEditor.d.ts +0 -22
  489. package/src/View/Components/ListBox/DualListBoxEditor.js +0 -515
  490. package/src/View/Components/ListBox/ListBoxFilterSortComponent.d.ts +0 -13
  491. package/src/View/Components/ListBox/ListBoxFilterSortComponent.js +0 -26
  492. package/src/View/CustomSort/Wizard/CustomSortSummaryWizard.d.ts +0 -15
  493. package/src/View/CustomSort/Wizard/CustomSortSummaryWizard.js +0 -31
  494. package/src/View/Layout/Wizard/Components/ColumnLabels.d.ts +0 -9
  495. package/src/View/Layout/Wizard/Components/ColumnLabels.js +0 -52
  496. package/src/View/Wizard/AdaptableWizard.d.ts +0 -56
  497. package/src/View/Wizard/AdaptableWizard.js +0 -168
  498. package/src/components/ContainerProps.d.ts +0 -30
  499. package/src/components/ContainerProps.js +0 -1
  500. package/src/components/EllipsisContainer/index.d.ts +0 -13
  501. package/src/components/EllipsisContainer/index.js +0 -100
  502. package/src/components/List/GridList/index.d.ts +0 -10
  503. package/src/components/List/GridList/index.js +0 -23
  504. package/src/components/List/ListGroup/index.d.ts +0 -6
  505. package/src/components/List/ListGroup/index.js +0 -9
  506. package/src/components/List/ListGroupItem/index.d.ts +0 -11
  507. package/src/components/List/ListGroupItem/index.js +0 -16
  508. package/src/components/utils/useTheme.d.ts +0 -32
  509. package/src/components/utils/useTheme.js +0 -2
  510. package/src/theme.d.ts +0 -32
  511. package/src/theme.js +0 -49
  512. package/themes/dark.css.map +0 -1
  513. package/themes/light.css.map +0 -1
@@ -3,15 +3,15 @@ import * as React from 'react';
3
3
  import ReactSelect, { components, } from 'react-select';
4
4
  import CreatableSelect from 'react-select/creatable';
5
5
  import { Icon } from '../icons';
6
- import { Box, Flex } from 'rebass';
7
6
  import { DataSource, InfiniteTable, } from '@infinite-table/infinite-react';
8
7
  import { useCallback, useMemo, useState } from 'react';
9
- import join from '../utils/join';
10
8
  import { Resizable } from 're-resizable';
11
9
  import Tooltip from '../Tooltip';
12
10
  import { ensurePortalElement } from '../OverlayTrigger';
13
11
  import { CheckBox } from '../CheckBox';
14
12
  import { useAdaptableComputedCSSVars } from '../../View/AdaptableComputedCSSVarsContext';
13
+ import { Box, Flex } from '../Flex';
14
+ import clsx from 'clsx';
15
15
  const resizableDirections = {
16
16
  right: true,
17
17
  bottom: true,
@@ -53,7 +53,7 @@ const INFINITE_COLUMNS_WITH_CHECKBOX = {
53
53
  renderSelectionCheckBox: (params) => {
54
54
  // disable reacting to onChange
55
55
  // as we handle selection change in the onCellClick
56
- return React.createElement(CheckBox, { mx: 1, checked: params.rowInfo?.rowSelected ?? false });
56
+ return React.createElement(CheckBox, { className: "twa:mx-1", checked: params.rowInfo?.rowSelected ?? false });
57
57
  },
58
58
  renderHeaderSelectionCheckBox: true,
59
59
  className: 'ab-Select-CheckboxColumn',
@@ -66,7 +66,7 @@ const INFINITE_COLUMNS_WITH_CHECKBOX = {
66
66
  : false;
67
67
  const { api } = headerParams;
68
68
  return (React.createElement(React.Fragment, null,
69
- React.createElement(CheckBox, { mx: 1, checked: selected, onChange: (selected) => {
69
+ React.createElement(CheckBox, { className: "twa:mx-1", checked: selected, onChange: (selected) => {
70
70
  if (selected) {
71
71
  api.rowSelectionApi.selectAll();
72
72
  }
@@ -231,7 +231,7 @@ export const Select = function (props) {
231
231
  placeholder: props.placeholder,
232
232
  });
233
233
  const title = typeof customRenderValue === 'string' ? customRenderValue : '';
234
- children = customRenderValue ? (React.createElement(Box, { display: 'flex', flexDirection: 'row', flex: 1, flexWrap: 'nowrap', alignItems: 'center', overflow: 'hidden', height: '100%' },
234
+ children = customRenderValue ? (React.createElement(Box, { className: "twa:flex twa:flex-row twa:flex-1 twa:flex-nowrap twa:items-center twa:overflow-hidden twa:h-full" },
235
235
  React.createElement("span", { title: title, "data-name": "multi-value-text", style: {
236
236
  flex: '0 1 auto',
237
237
  appearance: 'none',
@@ -473,7 +473,7 @@ export const Select = function (props) {
473
473
  data: filteredOptions, primaryKey: "value", selectionMode: isMulti ? 'multi-row' : 'single-row',
474
474
  // @ts-ignore
475
475
  onRowSelectionChange: isLoading ? null : isMulti ? onRowSelectionChange : onSingleRowSelectionChange, rowSelection: rowSelection, isRowDisabled: isRowDisabled },
476
- searchableInMenulist && (React.createElement(Flex, { p: 1, className: "ab-Select-MenulistSearchContainer" },
476
+ searchableInMenulist && (React.createElement(Flex, { className: "twa:p-1 ab-Select-MenulistSearchContainer" },
477
477
  React.createElement("input", { ref: menulistInputRef, "data-name": "menulist-search-input", style: {
478
478
  width: '100%',
479
479
  }, className: 'ab-Select-MenulistSearch ab-Input ab-Input--type-text', autoCorrect: "off", autoComplete: "off", spellCheck: "false", type: "text", value: inputValue, onChange: (e) => {
@@ -521,8 +521,32 @@ export const Select = function (props) {
521
521
  setInputValue(value);
522
522
  props.onInputChange?.(value);
523
523
  }, [props.onInputChange, isMulti]);
524
+ const SingleValue = React.useCallback((singleValueProps) => {
525
+ return (React.createElement(components.SingleValue, { ...singleValueProps }, props.renderSingleValue
526
+ ? props.renderSingleValue(selectedOption)
527
+ : singleValueProps.children));
528
+ }, [selectedOption]);
529
+ const selectComponents = useMemo(() => {
530
+ return {
531
+ SelectContainer,
532
+ ValueContainer,
533
+ Menu: MenuComponent,
534
+ SingleValue,
535
+ ClearIndicator,
536
+ DropdownIndicator,
537
+ MenuList,
538
+ };
539
+ }, [
540
+ SelectContainer,
541
+ ValueContainer,
542
+ MenuComponent,
543
+ SingleValue,
544
+ ClearIndicator,
545
+ DropdownIndicator,
546
+ MenuList,
547
+ ]);
524
548
  return (React.createElement(React.Fragment, null,
525
- React.createElement(SelectComponent, { ref: ref, openMenuOnClick: searchableInMenulist ? false : undefined, openMenuOnFocus: searchableInMenulist ? false : undefined, menuIsOpen: searchableInMenulist ? isSelectMenuOpen : undefined, isSearchable: searchableInline, "aria-label": props['aria-label'], onKeyDown: props.onKeyDown, inputValue: inputValue, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: join(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
549
+ React.createElement(SelectComponent, { ref: ref, openMenuOnClick: searchableInMenulist ? false : undefined, openMenuOnFocus: searchableInMenulist ? false : undefined, menuIsOpen: searchableInMenulist ? isSelectMenuOpen : undefined, isSearchable: searchableInline, "aria-label": props['aria-label'], onKeyDown: props.onKeyDown, inputValue: inputValue, onInputChange: onInputChange, onFocus: onFocus, onBlur: onBlur, onMenuOpen: props.onMenuOpen, isLoading: props.isLoading, options: props.options, className: clsx(props.className, 'ab-Select'), isDisabled: disabled, menuPlacement: props.menuPlacement ?? 'auto', hideSelectedOptions: false, isMulti: isMulti, value: selectedOption, blurInputOnSelect: false, menuPosition: props.menuPosition ?? 'absolute',
526
550
  // This needed so the menu is not clipped by overflow: hidden
527
551
  menuPortalTarget: ensurePortalElement(), isClearable: props.isClearable, closeMenuOnSelect: props.closeMenuOnSelect, onChange: (option) => {
528
552
  if (isMulti) {
@@ -541,19 +565,7 @@ export const Select = function (props) {
541
565
  }, placeholder: props.placeholder, createOptionPosition: 'first',
542
566
  // formatCreateLabel={(inputValue) => inputValue} // can we make this auto??
543
567
  // we use this: https://react-select.com/creatable
544
- components: {
545
- SelectContainer,
546
- ValueContainer,
547
- Menu: MenuComponent,
548
- SingleValue: React.useCallback((singleValueProps) => {
549
- return (React.createElement(components.SingleValue, { ...singleValueProps }, props.renderSingleValue
550
- ? props.renderSingleValue(selectedOption)
551
- : singleValueProps.children));
552
- }, [selectedOption]),
553
- ClearIndicator,
554
- DropdownIndicator,
555
- MenuList,
556
- },
568
+ components: selectComponents,
557
569
  /**
558
570
  * Using styles is the preferred way to style react-select.
559
571
  * https://react-select.com/styles#the-styles-prop
@@ -640,7 +652,7 @@ export const Select = function (props) {
640
652
  return {
641
653
  ...baseStyle,
642
654
  ...commonStyles(state), // height: 30,
643
- minHeight: props.size === 'small' ? 0 : '100%',
655
+ minHeight: props.size === 'small' ? 0 : 'var(--ab-input-height)',
644
656
  boxShadow: state.isFocused ? 'var(--ab-cmp-select-focused__box-shadow)' : 'none',
645
657
  outline: state.isFocused ? 'var(--ab-cmp-select-focused__outline)' : 'none',
646
658
  border: 'var(--ab-cmp-select__border)',
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import SimpleButton from './SimpleButton';
3
3
  export const SelectList = (props) => {
4
- return (React.createElement(React.Fragment, null, props.options.map((option) => (React.createElement(SimpleButton, { p: 2, width: '100%', variant: "text", onClick: () => props.onChange(option), key: option.label }, option.label)))));
4
+ return (React.createElement(React.Fragment, null, props.options.map((option) => (React.createElement(SimpleButton, { className: "twa:p-2 twa:w-full", variant: "text", onClick: () => props.onChange(option), key: option.label }, option.label)))));
5
5
  };
@@ -11,5 +11,5 @@ interface SelectableListProps {
11
11
  toggleOnSimpleClick?: boolean;
12
12
  getItemId: (index: number) => string | number;
13
13
  }
14
- declare const SelectableList: (props: HTMLProps<HTMLElement> & SelectableListProps) => React.JSX.Element;
14
+ declare const SelectableList: (props: HTMLProps<HTMLDivElement> & SelectableListProps) => React.JSX.Element;
15
15
  export default SelectableList;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { ButtonProps } from 'rebass';
3
- import { ReactNode } from 'react';
2
+ import { HTMLProps, ReactNode } from 'react';
4
3
  import { AccessLevel } from '../../AdaptableState/Common/Entitlement';
5
4
  import { AdaptableIcon } from '../../AdaptableState/Common/AdaptableIcon';
5
+ import { BoxProps } from '../Flex';
6
6
  export declare const baseClassName = "ab-SimpleButton";
7
- export interface SimpleButtonProps extends Omit<ButtonProps, 'ref'> {
7
+ export interface SimpleButtonProps extends Omit<BoxProps, 'ref'>, HTMLProps<HTMLButtonElement> {
8
8
  tooltip?: string;
9
9
  variant?: 'text' | 'outlined' | 'raised';
10
10
  tone?: 'success' | 'error' | 'neutral' | 'none' | 'warning' | 'info' | 'accent';
@@ -14,7 +14,5 @@ export interface SimpleButtonProps extends Omit<ButtonProps, 'ref'> {
14
14
  disabled?: boolean;
15
15
  accessLevel?: AccessLevel;
16
16
  }
17
- declare const SimpleButton: React.ForwardRefExoticComponent<SimpleButtonProps & {
18
- children?: React.ReactNode;
19
- } & React.RefAttributes<unknown>>;
17
+ declare const SimpleButton: React.ForwardRefExoticComponent<Omit<React.PropsWithChildren<SimpleButtonProps>, "ref"> & React.RefAttributes<unknown>>;
20
18
  export default SimpleButton;
@@ -1,21 +1,13 @@
1
1
  import * as React from 'react';
2
- import { Button } from 'rebass';
3
- import join from '../utils/join';
4
2
  import { allIcons } from '../icons';
5
3
  import Tooltip from '../Tooltip';
6
- import theme from '../../theme';
7
4
  import { IconComponent, isAdaptableElementIcon, isAdaptableCustomIcon, isAdaptableSystemIcon, } from '../Icon';
5
+ import { Box } from '../Flex';
6
+ import clsx from 'clsx';
7
+ import { targetOwn } from '../twUtils';
8
8
  export const baseClassName = 'ab-SimpleButton';
9
- const defaultProps = {
10
- px: null,
11
- py: null,
12
- fontWeight: 'normal',
13
- m: null,
14
- //@ts-ignore
15
- borderRadius: null,
16
- };
17
9
  const SimpleButton = React.forwardRef((givenProps, theRef) => {
18
- const props = { ...defaultProps, ...givenProps };
10
+ const props = { ...givenProps };
19
11
  let { children, disabled, variant = 'outlined', tone = 'neutral', iconPosition = 'start', iconSize, className, icon, tooltip, accessLevel: accessLevel, type, ...buttonProps } = props;
20
12
  let adaptableSystemIcon;
21
13
  if (isAdaptableSystemIcon(icon)) {
@@ -75,17 +67,57 @@ const SimpleButton = React.forwardRef((givenProps, theRef) => {
75
67
  if (accessLevel === 'ReadOnly') {
76
68
  disabled = true;
77
69
  }
78
- // for whatever reason, even if fontWeight is present in buttonProps
79
- // and sent to rebass, styled-components/rebass does not honour it
80
- // so we had to send it via css
81
- const fontWeight = buttonProps.fontWeight
82
- ? theme[buttonProps.fontWeight] ?? buttonProps.fontWeight ?? 'normal'
83
- : 'normal';
84
- const btn = (React.createElement(Button, { ...buttonProps, "aria-label": buttonProps['aria-label'] ||
85
- buttonProps.label ||
86
- tooltip ||
87
- buttonProps.title ||
88
- `${buttonProps.key}`, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : '', fontWeight ? `${baseClassName}--font-weight=${fontWeight}` : '', `${baseClassName}--variant-${variant}`, `${baseClassName}--tone-${tone}`), ref: theRef }, children));
70
+ const ariaLabel = buttonProps['aria-label'] ||
71
+ buttonProps.label ||
72
+ tooltip ||
73
+ buttonProps.title ||
74
+ `${buttonProps.key}`;
75
+ const extraButtonProps = {};
76
+ if (ariaLabel != null && ariaLabel !== '') {
77
+ extraButtonProps['aria-label'] = ariaLabel;
78
+ }
79
+ const btn = (React.createElement(Box, { ...buttonProps, ...extraButtonProps, as: buttonProps.as || 'button', disabled: disabled, className: clsx(baseClassName, 'twa:p-1', 'twa:rounded-standard', 'twa:inline-flex twa:flex-row twa:flex-none twa:items-center', 'twa:fill-current', 'twa:overflow-hidden twa:relative twa:align-middle',
80
+ // direct children should be above the before pseudo element
81
+ 'twa:*:z-1',
82
+ // all svgs inside should be aligned middle
83
+ 'twa:[&_svg]:align-middle',
84
+ // 'twa:text-text-on-primary',
85
+ // the text variant has the background applied on the before pseudo element
86
+ // so let's configure the before pseudo element for all buttons here
87
+ 'twa:before:content-[""] twa:before:absolute twa:before:inset-0 twa:before:block', 'twa:before:z-0 twa:before:pointer-events-none twa:before:rounded-[inherit]',
88
+ // focus shadow
89
+ targetOwn.focusOutline, disabled ? `${baseClassName}--disabled` : '', `${baseClassName}--variant-${variant}`, `${baseClassName}--tone-${tone}`, 'twa:transition-opacity twa:duration-200', {
90
+ 'twa:text-text-on-primary': tone == 'neutral',
91
+ 'twa:text-inherit': tone === 'none',
92
+ 'twa:text-success': tone === 'success',
93
+ 'twa:text-accent': tone === 'accent',
94
+ 'twa:text-error': tone === 'error',
95
+ 'twa:text-warn': tone === 'warning',
96
+ 'twa:text-info': tone === 'info',
97
+ }, variant === 'text' ? 'twa:bg-transparent' : '', variant === 'outlined'
98
+ ? 'twa:bg-defaultbackground twa:border-inputborder twa:border'
99
+ : '', variant === 'raised'
100
+ ? {
101
+ 'twa:text-text-on-primary twa:shadow-(--ab-cmp-simple-button__box-shadow) twa:hover:not-disabled:shadow-(--ab-cmp-simple-button__hover-box-shadow) twa:transition-(--ab-cmp-simple-button__transition) twa:duration-200 twa:focus:shadow-(--ab-focus__box-shadow)': true,
102
+ 'twa:bg-success twa:text-text-on-success': tone == 'success',
103
+ 'twa:bg-accent twa:text-accent-foreground': tone == 'accent',
104
+ 'twa:bg-transparent': tone == 'none',
105
+ 'twa:bg-primary twa:text-text-on-primary': tone == 'neutral',
106
+ 'twa:bg-error twa:text-text-on-error': tone == 'error',
107
+ 'twa:bg-warn twa:text-text-on-warn': tone == 'warning',
108
+ 'twa:bg-info twa:text-text-on-info': tone == 'info',
109
+ }
110
+ : '',
111
+ // opacity transitioning for the background applied on the before pseudo element
112
+ variant === 'outlined' || variant === 'text'
113
+ ? {
114
+ 'twa:before:opacity-0 twa:before:transition-opacity twa:before:duration-200': true,
115
+ 'twa:hover:before:opacity-15 twa:hover:before:bg-current': !disabled,
116
+ }
117
+ : null, {
118
+ 'twa:cursor-pointer': !disabled,
119
+ 'twa:opacity-50': disabled,
120
+ }, className), ref: theRef }, children));
89
121
  return tooltip ? React.createElement(Tooltip, { label: tooltip }, btn) : btn;
90
122
  });
91
123
  export default SimpleButton;
@@ -1,7 +1,9 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from 'rebass';
3
2
  import { ReactNode } from 'react';
3
+ import { BoxProps } from '../Flex';
4
4
  interface SizedContainerProps extends Omit<BoxProps, 'children' | 'onResize'> {
5
+ style?: React.CSSProperties;
6
+ className?: string;
5
7
  children: (size: {
6
8
  width: number;
7
9
  height: number;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { Box } from 'rebass';
3
2
  import NotifyResize from '../NotifyResize';
3
+ import { Box } from '../Flex';
4
4
  const SizedContainer = (props) => {
5
5
  const { onResize: onResizeFromProps, ...domProps } = props;
6
6
  const [size, onResize] = React.useState(null);
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from 'rebass';
3
2
  import { AdaptableStyle } from '../types';
3
+ import { BoxProps } from './Flex';
4
4
  interface StylePreviewProps extends BoxProps {
5
5
  styleObject: AdaptableStyle;
6
+ className?: string;
7
+ style?: React.CSSProperties;
6
8
  }
7
9
  export declare const StylePreview: React.FunctionComponent<React.PropsWithChildren<StylePreviewProps>>;
8
10
  export {};
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
- import { Box } from 'rebass';
3
2
  import { toStyle } from '../Utilities/Helpers/StyleHelper';
4
- import join from './utils/join';
5
- export const StylePreview = (props) => (React.createElement(Box, { ...props, className: join('ab-StylePreview', props.className), padding: props.padding ?? 2, mt: props.mt ?? 2, style: { ...toStyle(props.styleObject), ...props.style } }, props.children ?? 'Preview result'));
3
+ import { twMerge } from '../twMerge';
4
+ import { Box } from './Flex';
5
+ import clsx from 'clsx';
6
+ export const StylePreview = (props) => (React.createElement(Box, { ...props, className: clsx(twMerge('ab-StylePreview twa:p-2 twa:mt-2', props.className), props.styleObject.ClassName), style: { ...toStyle(props.styleObject), ...props.style } }, props.children ?? 'Preview result'));
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from 'rebass';
3
2
  import { HTMLProps } from 'react';
3
+ import { BoxProps } from '../Flex';
4
4
  export type TabsProps<VALUE_TYPE> = HTMLProps<HTMLElement> & {
5
5
  value?: VALUE_TYPE;
6
6
  defaultValue?: VALUE_TYPE;
@@ -10,7 +10,7 @@ export type TabsProps<VALUE_TYPE> = HTMLProps<HTMLElement> & {
10
10
  defaultSelectedIndex?: number;
11
11
  onSelectedIndexChange?: (index: number) => void;
12
12
  keyboardNavigation?: boolean;
13
- } & BoxProps;
13
+ } & BoxProps & React.HTMLProps<HTMLDivElement>;
14
14
  export declare const Tabs: {
15
15
  <VALUE_TYPE extends string | number>(props: TabsProps<VALUE_TYPE>): React.JSX.Element;
16
16
  Tab: (props: TabProps) => React.JSX.Element;
@@ -24,7 +24,7 @@ export declare const Tab: (props: TabProps) => React.JSX.Element;
24
24
  export declare const SupportedTabMenuComps: Set<unknown>;
25
25
  type ContentProps = {
26
26
  value?: string | number;
27
- } & BoxProps;
27
+ } & BoxProps & React.HTMLProps<HTMLDivElement>;
28
28
  export declare const Content: (props: ContentProps) => React.JSX.Element;
29
29
  export declare const SupportedTabContentComps: Set<unknown>;
30
30
  export {};
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
- import { Box, Flex } from 'rebass';
3
2
  import { useRef } from 'react';
4
3
  import join from '../utils/join';
5
4
  import useProperty from '../utils/useProperty';
5
+ import { Box, Flex } from '../Flex';
6
+ import { twMerge } from '../../twMerge';
7
+ import clsx from 'clsx';
6
8
  const TabContext = React.createContext({
7
9
  selectedIndex: 0,
8
10
  tabCount: 0,
@@ -15,7 +17,7 @@ const isTabContent = (c) => {
15
17
  return c.type === Content || SupportedTabContentComps.has(c.type);
16
18
  };
17
19
  export const Tabs = (props) => {
18
- const { autoFocus = true, children, onValueChange: _onValueChange, defaultValue: _defaultValue, value: _value, keyboardNavigation = true, selectedIndex: _selectedIndex, defaultSelectedIndex: _defaultSelectedIndex, onSelectedIndexChange: _onSelectedIndexChange, ...boxProps } = props;
20
+ const { autoFocus, children, onValueChange: _onValueChange, defaultValue: _defaultValue, value: _value, keyboardNavigation = true, selectedIndex: _selectedIndex, defaultSelectedIndex: _defaultSelectedIndex, onSelectedIndexChange: _onSelectedIndexChange, ...boxProps } = props;
19
21
  let [selectedIndex, doSetSelectedIndex] = useProperty(props, 'selectedIndex', 0);
20
22
  const [selectedValue, setSelectedValue] = useProperty(props, 'value', 0);
21
23
  const allChildren = React.Children.toArray(children);
@@ -58,17 +60,18 @@ export const Tabs = (props) => {
58
60
  };
59
61
  const currentContent = contents[selectedIndex];
60
62
  const { value, ...contentProps } = (currentContent?.props || {});
63
+ const fillerClassName = clsx('ab-Tabs__Filler', 'twa:bg-(--ab-cmp-tabs-strip__background)');
61
64
  return (React.createElement(TabContext.Provider, { value: {
62
65
  selectedIndex,
63
66
  tabCount: tabs.length,
64
67
  setSelectedIndex,
65
68
  } },
66
- React.createElement(Box, { ...boxProps, className: join(boxProps.className, 'ab-Tabs'), "data-selected-index": selectedIndex },
67
- React.createElement(Flex, { flexDirection: "row", className: "ab-Tabs__Strip" },
68
- React.createElement(Box, { className: "ab-Tabs__Filler" }),
69
+ React.createElement(Box, { ...boxProps, className: join(boxProps.className, 'ab-Tabs twa:flex twa:flex-col'), "data-selected-index": selectedIndex },
70
+ React.createElement(Flex, { flexDirection: "row", className: clsx('ab-Tabs__Strip', 'twa:bg-(--ab-cmp-tabs-strip__background)') },
71
+ React.createElement(Box, { className: fillerClassName }),
69
72
  tabs,
70
- React.createElement(Flex, { flex: 1, className: "ab-Tabs__Filler" })),
71
- React.createElement(Box, { padding: 2, ...contentProps, className: `${contentProps.className || ''} ab-Tabs__Body` }, currentContent))));
73
+ React.createElement(Flex, { className: clsx(fillerClassName, 'twa:flex-1') })),
74
+ React.createElement(Box, { ...contentProps, className: `ab-Tabs__Body twa:p-2 twa:flex-1 ${contentProps.className || ''} ` }, currentContent))));
72
75
  };
73
76
  export const Tab = (props) => {
74
77
  const { index, autoFocus, keyboardNavigation = true, className: propsClassName, ...boxProps } = props;
@@ -76,14 +79,28 @@ export const Tab = (props) => {
76
79
  const baseClassName = 'ab-Tabs__Tab';
77
80
  const active = context.selectedIndex === props.index;
78
81
  const beforeActive = context.selectedIndex === props.index + 1;
79
- const className = join(propsClassName, baseClassName, active ? `${baseClassName}--active` : '', beforeActive ? `${baseClassName}--before-active` : '');
82
+ const className = clsx(baseClassName, active ? `${baseClassName}--active` : '', beforeActive ? `${baseClassName}--before-active` : '', 'twa:cursor-pointer twa:p-2', propsClassName);
80
83
  const ref = useRef(null);
81
84
  React.useEffect(() => {
82
85
  if (active && autoFocus && keyboardNavigation) {
83
86
  ref.current?.focus();
84
87
  }
85
88
  }, [active, autoFocus]);
86
- return (React.createElement(Box, { ref: ref, padding: 2, tabIndex: active ? 0 : -1, ...boxProps, className: className, onClick: (event) => {
89
+ const mountedRef = React.useRef(false);
90
+ React.useEffect(() => {
91
+ // don't focus initially,
92
+ // so we don't steal focus, if autoFocus is false
93
+ if (!mountedRef.current) {
94
+ return;
95
+ }
96
+ if (active && keyboardNavigation) {
97
+ ref.current?.focus();
98
+ }
99
+ }, [active, keyboardNavigation]);
100
+ React.useEffect(() => {
101
+ mountedRef.current = true;
102
+ }, []);
103
+ return (React.createElement(Box, { ref: ref, tabIndex: active ? 0 : -1, ...boxProps, className: twMerge('twa:p-2', className), onClick: (event) => {
87
104
  context.setSelectedIndex(props.index);
88
105
  props.onClick?.(event);
89
106
  }, onKeyDown: (event) => {
@@ -1,3 +1,15 @@
1
1
  import * as React from 'react';
2
- import { FlexProps } from 'rebass';
3
- export declare const Tag: React.FunctionComponent<React.PropsWithChildren<FlexProps>>;
2
+ import { FlexProps } from '../Flex';
3
+ export declare const Tag: React.FunctionComponent<React.PropsWithChildren<FlexProps & {
4
+ className?: string;
5
+ style?: React.CSSProperties;
6
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
7
+ }> & React.RefAttributes<HTMLDivElement>>;
8
+ export declare const TagBox: (props: {
9
+ children: React.ReactNode;
10
+ className?: string;
11
+ }) => React.JSX.Element;
12
+ export declare const TagList: (props: {
13
+ tags: (React.ReactNode | string)[];
14
+ className?: string;
15
+ }) => React.JSX.Element;
@@ -1,4 +1,11 @@
1
1
  import * as React from 'react';
2
- import { Box } from 'rebass';
3
- import join from '../utils/join';
4
- export const Tag = React.forwardRef((props, ref) => (React.createElement(Box, { ...props, ref: ref, className: join('ab-Tag', props.className), backgroundColor: "primary", paddingTop: props.paddingTop ?? 1, paddingBottom: props.paddingBottom ?? 1, paddingLeft: props.paddingLeft ?? 2, paddingRight: props.paddingRight ?? 2, style: { borderRadius: 'var(--ab__border-radius)', ...props.style } })));
2
+ import { twMerge } from '../../twMerge';
3
+ import { Box, Flex } from '../Flex';
4
+ import clsx from 'clsx';
5
+ export const Tag = React.forwardRef((props, ref) => (React.createElement(Flex, { ...props, ref: ref, className: twMerge(`ab-Tag twa:bg-primary twa:text-2 twa:py-2 twa:px-2 twa:inline-flex twa:rounded-standard`, props.className), style: props.style })));
6
+ export const TagBox = (props) => {
7
+ return (React.createElement(Box, { className: clsx('twa:flex twa:flex-wrap twa:flex-row twa:gap-1', props.className) }, props.children));
8
+ };
9
+ export const TagList = (props) => {
10
+ return (React.createElement(TagBox, { className: props.className }, props.tags.map((tag, index) => (React.createElement(Tag, { key: index }, tag)))));
11
+ };
@@ -1 +1 @@
1
- export { Tag } from './Tag';
1
+ export { Tag, TagBox, TagList } from './Tag';
@@ -1 +1 @@
1
- export { Tag } from './Tag';
1
+ export { Tag, TagBox, TagList } from './Tag';
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import { BoxProps } from 'rebass';
3
2
  import { HTMLProps } from 'react';
3
+ import { BoxProps } from '../Flex';
4
4
  export declare const baseClassName = "ab-Textarea";
5
5
  /**
6
6
  * Autoheight strategy:
@@ -15,6 +15,8 @@ export type TextareaProps = Omit<HTMLProps<HTMLTextAreaElement>, 'ref'> & {
15
15
  disabled?: boolean;
16
16
  value?: string;
17
17
  autoResizeOnFocus?: boolean;
18
+ className?: string;
19
+ style?: React.CSSProperties;
18
20
  } & Omit<BoxProps, 'ref'>;
19
21
  declare const Textarea: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLTextAreaElement>, "ref"> & {
20
22
  placeholder?: string;
@@ -22,5 +24,7 @@ declare const Textarea: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTM
22
24
  disabled?: boolean;
23
25
  value?: string;
24
26
  autoResizeOnFocus?: boolean;
27
+ className?: string;
28
+ style?: React.CSSProperties;
25
29
  } & Omit<BoxProps, "ref"> & React.RefAttributes<HTMLDivElement | HTMLTextAreaElement | HTMLInputElement>>;
26
30
  export default Textarea;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import { Box } from 'rebass';
3
- import join from '../utils/join';
2
+ import { Box } from '../Flex';
3
+ import clsx from 'clsx';
4
+ import { twMerge } from '../../twMerge';
4
5
  export const baseClassName = 'ab-Textarea';
5
6
  const Textarea = React.forwardRef((props, ref) => {
6
7
  const internalRef = React.useRef(null);
@@ -57,6 +58,6 @@ const Textarea = React.forwardRef((props, ref) => {
57
58
  }, onChange: (e) => {
58
59
  expandToFitContent();
59
60
  props.onChange && props.onChange(e);
60
- }, as: "textarea", type: type, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : ''), spellCheck: false }));
61
+ }, as: "textarea", type: type, disabled: disabled, className: twMerge(clsx(baseClassName, disabled ? `${baseClassName}--disabled` : ''), className), spellCheck: false }));
61
62
  });
62
63
  export default Textarea;
@@ -1,9 +1,54 @@
1
1
  import * as React from 'react';
2
+ import clsx from 'clsx';
2
3
  import { IconComponent } from '../Icon';
3
- import join from '../utils/join';
4
+ import { twMerge } from '../../twMerge';
5
+ import { ToggleGroupContext } from './ToggleGroup';
6
+ const baseClassName = 'ab-Toggle';
4
7
  export const Toggle = ({ onPressedChange, pressed, icon, children, ...rest }) => {
5
- const baseClassName = 'ab-Toggle';
6
- return (React.createElement("button", { ...rest, className: join(baseClassName, pressed && `${baseClassName}--pressed`), onClick: () => onPressedChange(!pressed) },
8
+ const onPressedChangeRef = React.useRef(onPressedChange);
9
+ React.useLayoutEffect(() => {
10
+ onPressedChangeRef.current = onPressedChange;
11
+ }, [onPressedChange]);
12
+ const pressedRef = React.useRef(pressed);
13
+ React.useLayoutEffect(() => {
14
+ pressedRef.current = pressed;
15
+ }, [pressed]);
16
+ const toggle = React.useCallback(() => onPressedChangeRef.current(!pressedRef.current), []);
17
+ const toggleContext = React.useContext(ToggleGroupContext);
18
+ const [currentIndex, setCurrentIndex] = React.useState(-1);
19
+ const isActive = toggleContext.activeIndex === currentIndex;
20
+ const ref = React.useRef(null);
21
+ React.useEffect(() => {
22
+ if (!toggleContext || !toggleContext.toggleButtons) {
23
+ return;
24
+ }
25
+ const thisButton = {
26
+ node: ref.current,
27
+ toggle,
28
+ };
29
+ toggleContext.toggleButtons.push(thisButton);
30
+ setCurrentIndex(toggleContext.toggleButtons.length - 1);
31
+ return () => {
32
+ const index = toggleContext.toggleButtons.indexOf(thisButton);
33
+ if (index !== -1) {
34
+ toggleContext.toggleButtons.splice(index, 1);
35
+ }
36
+ };
37
+ }, [toggleContext]);
38
+ return (React.createElement("button", { ...rest, ref: ref, tabIndex: -1, className: twMerge(clsx('twa:border-0', 'twa:cursor-pointer twa:fill-current', 'twa:outline-0', 'twa:min-h-input twa:relative twa:py-1 twa:px-2', 'twa:not-first:after:content-[""] twa:not-first:after:border-l-2 twa:not-first:after:border-accent-foreground twa:not-first:after:h-[10px] twa:not-first:after:absolute twa:not-first:after:-left-px twa:not-first:after:top-1/2 twa:not-first:after:-translate-y-1/2',
39
+ // backgrounds
40
+ {
41
+ 'twa:text-inherit twa:bg-transparent': !pressed,
42
+ 'twa:hover:bg-primarylight twa:hover:text-text-on-primary': !pressed,
43
+ [`${baseClassName}--pressed`]: pressed,
44
+ 'twa:bg-accent twa:hover:bg-accent/90 twa:text-accent-foreground': pressed,
45
+ }, {
46
+ 'twa:before:rounded-standard twa:before:content-[""] twa:before:absolute twa:before:inset-1 twa:before:z-20 twa:before:pointer-events-none': true,
47
+ // let's display a shadow on the before pseudo element
48
+ // when the toggle is active
49
+ 'twa:before:shadow-(--ab-focus-light__box-shadow)': isActive && pressed,
50
+ 'twa:before:shadow-(--ab-focus__box-shadow)': isActive && !pressed,
51
+ }, baseClassName)), onClick: toggle },
7
52
  icon && React.createElement(IconComponent, { icon: { name: icon } }),
8
53
  children));
9
54
  };
@@ -1,2 +1,9 @@
1
1
  import * as React from 'react';
2
+ export declare const ToggleGroupContext: React.Context<{
3
+ toggleButtons: {
4
+ node: HTMLButtonElement;
5
+ toggle: VoidFunction;
6
+ }[];
7
+ activeIndex: number;
8
+ }>;
2
9
  export declare const ToggleGroup: React.FunctionComponent<React.PropsWithChildren<unknown>>;
@@ -1,5 +1,60 @@
1
1
  import * as React from 'react';
2
- import { Flex } from 'rebass';
2
+ import { Flex } from '../Flex';
3
+ import clsx from 'clsx';
4
+ import { useRef } from 'react';
5
+ import contains from '../utils/contains';
6
+ export const ToggleGroupContext = React.createContext({
7
+ toggleButtons: [],
8
+ activeIndex: -1,
9
+ });
3
10
  export const ToggleGroup = (props) => {
4
- return React.createElement(Flex, { className: "ab-Toggle-Group" }, props.children);
11
+ const ref = useRef(null);
12
+ const [context, setContext] = React.useState({
13
+ toggleButtons: [],
14
+ activeIndex: 0,
15
+ });
16
+ const setActiveIndex = React.useCallback((index) => {
17
+ setContext((prev) => ({
18
+ ...prev,
19
+ activeIndex: index,
20
+ }));
21
+ }, []);
22
+ return (React.createElement(ToggleGroupContext.Provider, { value: context },
23
+ React.createElement(Flex, { ref: ref, tabIndex: 0, className: clsx('ab-Toggle-Group twa:shadow-sm', 'twa:bg-primary twa:text-text-on-primary', 'twa:rounded-standard twa:overflow-hidden', 'twa:inline-flex twa:w-fit', 'twa:focus:outline-0',
24
+ // make the shadow of child Toggle buttons invisible when the group is not focused
25
+ 'twa:not-focus-within:[--ab-focus-light__box-shadow:none]', 'twa:not-focus-within:[--ab-focus__box-shadow:none]'), onMouseDown: (event) => {
26
+ const index = context.toggleButtons.findIndex((btn) => contains(btn.node, event.target));
27
+ if (index !== -1) {
28
+ setActiveIndex(index);
29
+ }
30
+ }, onKeyDown: (event) => {
31
+ const { toggleButtons, activeIndex } = context;
32
+ if (event.key === ' ') {
33
+ event.preventDefault();
34
+ event.stopPropagation();
35
+ const activeButton = toggleButtons[activeIndex];
36
+ if (!activeButton) {
37
+ return;
38
+ }
39
+ activeButton.toggle();
40
+ return;
41
+ }
42
+ if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
43
+ event.preventDefault();
44
+ event.stopPropagation();
45
+ const node = ref.current;
46
+ if (!node) {
47
+ return;
48
+ }
49
+ const dir = event.key === 'ArrowLeft' ? -1 : 1;
50
+ let nextIndex = activeIndex + dir;
51
+ if (nextIndex < 0) {
52
+ nextIndex = toggleButtons.length - 1;
53
+ }
54
+ else if (nextIndex > toggleButtons.length - 1) {
55
+ nextIndex = 0;
56
+ }
57
+ setActiveIndex(nextIndex);
58
+ }
59
+ } }, props.children)));
5
60
  };