@adaptabletools/adaptable 24.0.0-canary.0 → 24.0.0-canary.10
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.
- package/agGrid.d.ts +2 -3
- package/agGrid.js +2 -3
- package/aql.d.ts +132 -0
- package/aql.js +260 -0
- package/devtools.d.ts +237 -2
- package/index.css +323 -306
- package/index.d.ts +2 -3
- package/index.js +2 -3
- package/package.json +8 -7
- package/src/AdaptableInterfaces/IAdaptable.d.ts +4 -4
- package/src/AdaptableOptions/ActionColumnOptions.d.ts +24 -0
- package/src/AdaptableOptions/AdaptableOptions.d.ts +97 -69
- package/src/AdaptableOptions/AdaptablePlugin.d.ts +113 -1
- package/src/AdaptableOptions/AlertOptions.d.ts +0 -2
- package/src/AdaptableOptions/ChartingOptions.d.ts +11 -5
- package/src/AdaptableOptions/ColumnMenuOptions.d.ts +30 -0
- package/src/AdaptableOptions/ColumnOptions.d.ts +0 -2
- package/src/AdaptableOptions/CommentOptions.d.ts +12 -4
- package/src/AdaptableOptions/ContextMenuOptions.d.ts +31 -1
- package/src/AdaptableOptions/DashboardOptions.d.ts +0 -3
- package/src/AdaptableOptions/DataChangeHistoryOptions.d.ts +3 -2
- package/src/AdaptableOptions/DefaultAdaptableOptions.js +11 -5
- package/src/AdaptableOptions/EditOptions.d.ts +18 -2
- package/src/AdaptableOptions/ExportOptions.d.ts +23 -0
- package/src/AdaptableOptions/ExpressionOptions.d.ts +0 -3
- package/src/AdaptableOptions/Fdc3Options.d.ts +77 -3
- package/src/AdaptableOptions/FilterOptions.d.ts +13 -8
- package/src/AdaptableOptions/FlashingCellOptions.d.ts +3 -3
- package/src/AdaptableOptions/LayoutOptions.d.ts +16 -3
- package/src/AdaptableOptions/NotificationsOptions.d.ts +0 -1
- package/src/AdaptableOptions/QuickSearchOptions.d.ts +0 -2
- package/src/AdaptableOptions/RowFormOptions.d.ts +9 -0
- package/src/AdaptableOptions/SettingsPanelOptions.d.ts +16 -5
- package/src/AdaptableOptions/StateOptions.d.ts +37 -13
- package/src/AdaptableOptions/ToolPanelOptions.d.ts +0 -1
- package/src/AdaptableOptions/UserInterfaceOptions.d.ts +89 -6
- package/src/AdaptableState/AdaptableState.d.ts +99 -3
- package/src/AdaptableState/AlertState.d.ts +20 -21
- package/src/AdaptableState/ApplicationState.d.ts +5 -3
- package/src/AdaptableState/BaseState.d.ts +9 -2
- package/src/AdaptableState/CalculatedColumnState.d.ts +10 -8
- package/src/AdaptableState/ChartingState.d.ts +10 -5
- package/src/AdaptableState/CommentState.d.ts +10 -4
- package/src/AdaptableState/Common/AdaptableAlert.d.ts +21 -2
- package/src/AdaptableState/Common/AdaptableAlert.js +9 -0
- package/src/AdaptableState/Common/AdaptableButton.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableColumn.d.ts +38 -1
- package/src/AdaptableState/Common/AdaptableFilterState.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableFlashingCell.d.ts +3 -1
- package/src/AdaptableState/Common/AdaptableForm.d.ts +9 -0
- package/src/AdaptableState/Common/AdaptableFormat.d.ts +27 -1
- package/src/AdaptableState/Common/AdaptableIcon.d.ts +4 -2
- package/src/AdaptableState/Common/AdaptableObject.d.ts +9 -1
- package/src/AdaptableState/Common/AdaptableQuery.d.ts +9 -0
- package/src/AdaptableState/Common/AdaptableStyle.d.ts +6 -8
- package/src/AdaptableState/Common/AggregationColumns.d.ts +15 -6
- package/src/AdaptableState/Common/ButtonStyle.d.ts +3 -1
- package/src/AdaptableState/Common/CellDataChangedInfo.d.ts +6 -2
- package/src/AdaptableState/Common/CellHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/CellSummary.d.ts +33 -0
- package/src/AdaptableState/Common/ColumnFilter.d.ts +3 -1
- package/src/AdaptableState/Common/ColumnHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/ColumnScope.d.ts +32 -1
- package/src/AdaptableState/Common/ColumnSetupInfo.d.ts +17 -0
- package/src/AdaptableState/Common/ColumnSort.d.ts +3 -1
- package/src/AdaptableState/Common/CompactCalculatedColumnEditorInfo.d.ts +3 -0
- package/src/AdaptableState/Common/DataChangedScope.d.ts +3 -1
- package/src/AdaptableState/Common/DataUpdateConfig.d.ts +3 -1
- package/src/AdaptableState/Common/Entitlement.d.ts +4 -2
- package/src/AdaptableState/Common/Enums.d.ts +21 -0
- package/src/AdaptableState/Common/ExtendedLayout.d.ts +3 -1
- package/src/AdaptableState/Common/Fdc3Context.d.ts +9 -0
- package/src/AdaptableState/Common/Fdc3Intent.d.ts +6 -0
- package/src/AdaptableState/Common/GridFilter.d.ts +3 -1
- package/src/AdaptableState/Common/MenuItem.d.ts +9 -0
- package/src/AdaptableState/Common/RowHighlightInfo.d.ts +4 -2
- package/src/AdaptableState/Common/RowScope.d.ts +3 -1
- package/src/AdaptableState/Common/RowSummary.d.ts +14 -4
- package/src/AdaptableState/Common/RowsHighlightInfo.d.ts +5 -3
- package/src/AdaptableState/Common/Schedule.d.ts +10 -2
- package/src/AdaptableState/Common/SpecialColumnSettings.d.ts +3 -1
- package/src/AdaptableState/Common/SystemStatusMessageInfo.d.ts +4 -2
- package/src/AdaptableState/Common/TransposeConfig.d.ts +1 -1
- package/src/AdaptableState/Common/Types.d.ts +9 -0
- package/src/AdaptableState/CustomSortState.d.ts +8 -5
- package/src/AdaptableState/DashboardState.d.ts +14 -10
- package/src/AdaptableState/ExportState.d.ts +12 -4
- package/src/AdaptableState/FlashingCellState.d.ts +8 -5
- package/src/AdaptableState/FormatColumnState.d.ts +28 -8
- package/src/AdaptableState/FreeTextColumnState.d.ts +14 -8
- package/src/AdaptableState/IPushPullState.d.ts +39 -3
- package/src/AdaptableState/InitialState.d.ts +9 -9
- package/src/AdaptableState/InternalState.d.ts +183 -3
- package/src/AdaptableState/LayoutState.d.ts +64 -21
- package/src/AdaptableState/NamedQueryState.d.ts +16 -4
- package/src/AdaptableState/NoteState.d.ts +7 -3
- package/src/AdaptableState/OpenFinState.d.ts +12 -2
- package/src/AdaptableState/PlusMinusState.d.ts +8 -4
- package/src/AdaptableState/PopupState.d.ts +29 -1
- package/src/AdaptableState/QuickSearchState.d.ts +9 -3
- package/src/AdaptableState/Selection/GridCell.d.ts +5 -3
- package/src/AdaptableState/Selection/GridCellRange.d.ts +8 -7
- package/src/AdaptableState/Selection/SelectedCellInfo.d.ts +1 -1
- package/src/AdaptableState/ShortcutState.d.ts +7 -3
- package/src/AdaptableState/StatusBarState.d.ts +7 -6
- package/src/AdaptableState/StyledColumnState.d.ts +46 -14
- package/src/AdaptableState/StyledColumns/GradientStyle.d.ts +4 -0
- package/src/AdaptableState/TeamSharingState.d.ts +46 -2
- package/src/AdaptableState/ThemeState.d.ts +24 -2
- package/src/AdaptableState/ToolPanelState.d.ts +10 -5
- package/src/AdaptableState/UserInterfaceState.d.ts +2 -2
- package/src/AdaptableState/Uuid.d.ts +6 -0
- package/src/Api/ActionColumnApi.d.ts +3 -1
- package/src/Api/AdaptableApi.d.ts +54 -50
- package/src/Api/AlertApi.d.ts +20 -12
- package/src/Api/ApplicationApi.d.ts +6 -2
- package/src/Api/BulkUpdateApi.d.ts +2 -1
- package/src/Api/CalculatedColumnApi.d.ts +4 -1
- package/src/Api/CalendarApi.d.ts +10 -0
- package/src/Api/CellSummaryApi.d.ts +9 -3
- package/src/Api/ChartingApi.d.ts +22 -7
- package/src/Api/ColumnApi.d.ts +71 -4
- package/src/Api/ColumnFilterApi.d.ts +13 -3
- package/src/Api/ColumnMenuApi.d.ts +13 -2
- package/src/Api/ColumnScopeApi.d.ts +27 -1
- package/src/Api/CommentApi.d.ts +10 -7
- package/src/Api/ContextMenuApi.d.ts +11 -1
- package/src/Api/CustomSortApi.d.ts +6 -2
- package/src/Api/DashboardApi.d.ts +30 -9
- package/src/Api/DataChangeHistoryApi.d.ts +9 -3
- package/src/Api/DataImportApi.d.ts +1 -1
- package/src/Api/EntitlementApi.d.ts +6 -1
- package/src/Api/EventApi.d.ts +67 -19
- package/src/Api/Events/AdaptableReady.d.ts +6 -2
- package/src/Api/Events/AdaptableStateChanged.d.ts +9 -5
- package/src/Api/Events/AdaptableStateReloaded.d.ts +7 -3
- package/src/Api/Events/AlertFired.d.ts +8 -2
- package/src/Api/Events/BeforeAdaptableStateChange.d.ts +6 -2
- package/src/Api/Events/CalculatedColumnChanged.d.ts +7 -3
- package/src/Api/Events/CellChanged.d.ts +6 -2
- package/src/Api/Events/CellSelectionChanged.d.ts +6 -2
- package/src/Api/Events/ChartChanged.d.ts +16 -8
- package/src/Api/Events/CommentChanged.d.ts +8 -2
- package/src/Api/Events/CustomToolbarConfigured.d.ts +6 -2
- package/src/Api/Events/DashboardChanged.d.ts +27 -6
- package/src/Api/Events/DataImported.d.ts +8 -4
- package/src/Api/Events/DataSetSelected.d.ts +6 -2
- package/src/Api/Events/Fdc3MessageInfo.d.ts +14 -4
- package/src/Api/Events/FlashingCellDisplayed.d.ts +6 -2
- package/src/Api/Events/GridFilterApplied.d.ts +11 -3
- package/src/Api/Events/GridSorted.d.ts +6 -2
- package/src/Api/Events/LayoutChanged.d.ts +41 -8
- package/src/Api/Events/LiveDataChanged.d.ts +21 -5
- package/src/Api/Events/NoteChanged.d.ts +5 -1
- package/src/Api/Events/ReportScheduleRan.d.ts +7 -3
- package/src/Api/Events/RowChanged.d.ts +6 -2
- package/src/Api/Events/RowFormSubmitted.d.ts +28 -12
- package/src/Api/Events/RowSelectionChanged.d.ts +6 -2
- package/src/Api/Events/SystemStatusMessageDisplayed.d.ts +6 -2
- package/src/Api/Events/TeamSharingEntityChanged.d.ts +6 -2
- package/src/Api/Events/ThemeSelected.d.ts +6 -2
- package/src/Api/ExportApi.d.ts +59 -32
- package/src/Api/ExpressionApi.d.ts +27 -16
- package/src/Api/Fdc3Api.d.ts +16 -3
- package/src/Api/FlashingCellApi.d.ts +6 -1
- package/src/Api/FormatColumnApi.d.ts +18 -11
- package/src/Api/FreeTextColumnApi.d.ts +4 -2
- package/src/Api/GridApi.d.ts +92 -19
- package/src/Api/IPushPullApi.d.ts +19 -2
- package/src/Api/Implementation/AlertApiImpl.d.ts +5 -5
- package/src/Api/Implementation/AlertApiImpl.js +26 -19
- package/src/Api/Implementation/ColumnScopeApiImpl.js +3 -3
- package/src/Api/Implementation/ExpressionApiImpl.d.ts +1 -3
- package/src/Api/Implementation/ExpressionApiImpl.js +5 -6
- package/src/Api/Implementation/QuickSearchApiImpl.js +2 -2
- package/src/Api/Implementation/StateApiImpl.d.ts +1 -1
- package/src/Api/Implementation/StateApiImpl.js +4 -3
- package/src/Api/Implementation/UserInterfaceApiImpl.d.ts +0 -1
- package/src/Api/Implementation/UserInterfaceApiImpl.js +9 -15
- package/src/Api/Internal/AdaptableInternalApi.d.ts +2 -2
- package/src/Api/Internal/AdaptableInternalApi.js +11 -7
- package/src/Api/Internal/AlertInternalApi.js +12 -7
- package/src/Api/Internal/CalculatedColumnInternalApi.js +1 -1
- package/src/Api/Internal/EventInternalApi.d.ts +2 -1
- package/src/Api/Internal/EventInternalApi.js +7 -0
- package/src/Api/Internal/StateInternalApi.d.ts +1 -1
- package/src/Api/Internal/StateInternalApi.js +6 -5
- package/src/Api/InteropioPluginApi.d.ts +2 -1
- package/src/Api/LayoutApi.d.ts +29 -15
- package/src/Api/NamedQueryApi.d.ts +10 -6
- package/src/Api/NoteApi.d.ts +15 -11
- package/src/Api/OpenFinApi.d.ts +8 -2
- package/src/Api/OptionsApi.d.ts +43 -1
- package/src/Api/PluginsApi.d.ts +6 -1
- package/src/Api/PlusMinusApi.d.ts +2 -1
- package/src/Api/QuickSearchApi.d.ts +6 -1
- package/src/Api/RowFormApi.d.ts +8 -7
- package/src/Api/ShortcutApi.d.ts +3 -1
- package/src/Api/SmartEditApi.d.ts +4 -1
- package/src/Api/StateApi.d.ts +32 -4
- package/src/Api/StatusBarApi.d.ts +2 -0
- package/src/Api/StyledColumnApi.d.ts +23 -12
- package/src/Api/SystemStatusApi.d.ts +18 -6
- package/src/Api/TeamSharingApi.d.ts +8 -1
- package/src/Api/ThemeApi.d.ts +17 -8
- package/src/Api/ToolPanelApi.d.ts +12 -7
- package/src/Api/UserInterfaceApi.d.ts +10 -5
- package/src/Redux/ActionsReducers/LayoutRedux.d.ts +3 -3
- package/src/Redux/ActionsReducers/QuickSearchRedux.d.ts +9 -4
- package/src/Redux/ActionsReducers/QuickSearchRedux.js +12 -7
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.d.ts +8 -0
- package/src/Redux/Store/AdaptableReduxLocalStorageEngine.js +12 -12
- package/src/Redux/Store/AdaptableStore.d.ts +8 -5
- package/src/Redux/Store/AdaptableStore.js +75 -41
- package/src/Redux/Store/Interface/IAdaptableStore.d.ts +5 -5
- package/src/Redux/Store/Interface/IStorageEngine.d.ts +4 -4
- package/src/Redux/Store/StateOptionsGuards.d.ts +58 -0
- package/src/Redux/Store/StateOptionsGuards.js +112 -0
- package/src/Redux/Store/isTransientReduxAction.d.ts +5 -0
- package/src/Redux/Store/isTransientReduxAction.js +19 -0
- package/src/Strategy/AlertModule.js +2 -2
- package/src/Strategy/FormatColumnModule.js +2 -2
- package/src/Utilities/Constants/DocumentationLinkConstants.d.ts +1 -0
- package/src/Utilities/Constants/DocumentationLinkConstants.js +1 -0
- package/src/Utilities/Constants/ReduxConstants.d.ts +2 -2
- package/src/Utilities/Constants/ReduxConstants.js +5 -5
- package/src/Utilities/Helpers/AlertTypeHelper.d.ts +1 -1
- package/src/Utilities/Helpers/SettingsPanelHelper.d.ts +14 -0
- package/src/Utilities/Helpers/SettingsPanelHelper.js +37 -1
- package/src/Utilities/Helpers/UIHelper.d.ts +12 -14
- package/src/Utilities/Helpers/UIHelper.js +12 -35
- package/src/Utilities/ObjectFactory.js +3 -3
- package/src/Utilities/Services/QueryLanguageService.js +0 -2
- package/src/View/CalculatedColumn/Wizard/CalculatedColumnExpressionWizardSection.js +1 -1
- package/src/View/Components/Popups/AdaptablePopup/Navigation.js +9 -11
- package/src/View/Components/StyleComponent.js +2 -2
- package/src/View/Dashboard/Dashboard.d.ts +1 -1
- package/src/View/Dashboard/Dashboard.js +1 -1
- package/src/View/Dashboard/DashboardPopupSections.js +1 -1
- package/src/View/Filter/ColumnFilter/ColumnFilterNew.js +15 -11
- package/src/View/GridInfo/GridInfoPopup.js +62 -25
- package/src/View/QuickSearch/QuickSearchInput.js +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.d.ts +1 -1
- package/src/View/QuickSearch/QuickSearchPopup.js +1 -1
- package/src/View/QuickSearch/Utilities/useQuickSearchDebounced.d.ts +2 -2
- package/src/View/StyledColumn/RangesComponent.js +13 -16
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.d.ts +0 -2
- package/src/View/StyledColumn/Wizard/BadgePillStyleEditor.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnBadgeSection.js +2 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.d.ts +0 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSliceStyleEditors.js +3 -3
- package/src/View/StyledColumn/Wizard/StyledColumnSparklineSettingsSection.js +7 -11
- package/src/View/StyledColumn/Wizard/StyledColumnWizardBulletSection.js +6 -6
- package/src/View/StyledColumn/Wizard/StyledColumnWizardGradientSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardIconSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRangeBarSection.js +8 -8
- package/src/View/StyledColumn/Wizard/StyledColumnWizardRatingSection.js +4 -4
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardRangesSection.js +2 -2
- package/src/View/StyledColumn/Wizard/StyledColumnWizardStyleSection/StyledColumnWizardStyleSection.js +4 -4
- package/src/View/Wizard/CollapsibleWizardCard.d.ts +3 -1
- package/src/View/Wizard/CollapsibleWizardCard.js +17 -9
- package/src/agGrid/Adaptable.d.ts +0 -12
- package/src/agGrid/Adaptable.js +0 -52
- package/src/agGrid/AdaptableAgGrid.d.ts +4 -4
- package/src/agGrid/AdaptableAgGrid.js +2 -0
- package/src/agGrid/AdaptableFrameworkComponent.d.ts +12 -0
- package/src/agGrid/AdaptableLogger.d.ts +74 -1
- package/src/agGrid/AgGridColumnAdapter.d.ts +1 -1
- package/src/agGrid/AgGridColumnAdapter.js +7 -5
- package/src/agGrid/editors/AdaptableDateEditor/index.d.ts +3 -0
- package/src/agGrid/editors/AdaptableNumberEditor/index.d.ts +3 -0
- package/src/agGrid/index.d.ts +1 -6
- package/src/agGrid/index.js +1 -3
- package/src/aql/ExpressionEvaluation.d.ts +27 -0
- package/src/aql/types.d.ts +22 -0
- package/src/components/ColorField/index.d.ts +13 -0
- package/src/components/ColorField/index.js +26 -0
- package/src/components/aql/CompactEditor/CompactEditor.js +1 -1
- package/src/components/aql/ExpressionEditor/BaseEditorInput.js +1 -1
- package/src/components/aql/ExpressionEditor/CompactExpressionToolbar.d.ts +5 -0
- package/src/components/aql/ExpressionEditor/CompactExpressionToolbar.js +12 -5
- package/src/components/aql/ExpressionEditor/ExpressionPreview.js +1 -1
- package/src/components/aql/ExpressionEditor/index.d.ts +3 -2
- package/src/components/aql/QueryBuilder/GroupEditor.js +1 -1
- package/src/components/aql/QueryBuilder/QueryBuilder.d.ts +5 -0
- package/src/components/aql/QueryBuilder/QueryBuilder.js +1 -1
- package/src/components/aql/QueryBuilder/QueryBuilderInputs.js +12 -2
- package/src/components/aql/QueryBuilder/context.d.ts +7 -0
- package/src/components/aql/QueryBuilder/context.js +3 -1
- package/src/env.js +2 -2
- package/src/layout-manager/src/normalizeLayoutModel.d.ts +1 -1
- package/src/layout-manager/src/simplifyLayoutModel.d.ts +1 -1
- package/src/migration/AdaptableUpgradeHelper.d.ts +7 -2
- package/src/migration/VersionUpgrade17.js +13 -8
- package/src/migration/VersionUpgrade24.d.ts +9 -0
- package/src/migration/VersionUpgrade24.js +27 -0
- package/src/migration/legacyAdaptableQuery.d.ts +29 -4
- package/src/setupDevTools.js +827 -111
- package/src/types.d.ts +2 -4
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/upgrade.d.ts +1 -0
- package/upgrade.js +1 -0
- package/vendor/components/Button/index.d.ts +1 -1
- package/vendor/components/Button/index.d.ts.map +1 -1
- package/vendor/components/Button/index.js.map +1 -1
- package/vendor/components/CheckBox/index.d.ts +1 -1
- package/vendor/components/CheckBox/index.d.ts.map +1 -1
- package/vendor/components/CheckBox/index.js.map +1 -1
- package/vendor/components/ColorField/index.d.ts +53 -0
- package/vendor/components/ColorField/index.d.ts.map +1 -0
- package/vendor/components/ColorField/index.js +80 -0
- package/vendor/components/ColorField/index.js.map +1 -0
- package/vendor/components/ColorPicker/colorPickerTab.d.ts +4 -0
- package/vendor/components/ColorPicker/colorPickerTab.d.ts.map +1 -0
- package/vendor/components/ColorPicker/colorPickerTab.js +28 -0
- package/vendor/components/ColorPicker/colorPickerTab.js.map +1 -0
- package/vendor/components/ColorPicker/index.d.ts +98 -0
- package/vendor/components/ColorPicker/index.d.ts.map +1 -0
- package/vendor/components/ColorPicker/index.js +322 -0
- package/vendor/components/ColorPicker/index.js.map +1 -0
- package/vendor/components/ColorPicker/themeColors.d.ts +94 -0
- package/vendor/components/ColorPicker/themeColors.d.ts.map +1 -0
- package/vendor/components/ColorPicker/themeColors.js +240 -0
- package/vendor/components/ColorPicker/themeColors.js.map +1 -0
- package/vendor/components/Combobox/VirtualizedList.d.ts +1 -1
- package/vendor/components/Combobox/VirtualizedList.d.ts.map +1 -1
- package/vendor/components/Combobox/VirtualizedList.js.map +1 -1
- package/vendor/components/Combobox/comboboxUtils.d.ts +9 -0
- package/vendor/components/Combobox/comboboxUtils.d.ts.map +1 -1
- package/vendor/components/Combobox/comboboxUtils.js +41 -2
- package/vendor/components/Combobox/comboboxUtils.js.map +1 -1
- package/vendor/components/Combobox/index.d.ts +1 -1
- package/vendor/components/Combobox/index.d.ts.map +1 -1
- package/vendor/components/Combobox/index.js +14 -9
- package/vendor/components/Combobox/index.js.map +1 -1
- package/vendor/components/NumberInput/index.d.ts +51 -0
- package/vendor/components/NumberInput/index.d.ts.map +1 -0
- package/vendor/components/NumberInput/index.js +82 -0
- package/vendor/components/NumberInput/index.js.map +1 -0
- package/vendor/components/index.css +286 -24
- package/vendor/components/index.d.ts +6 -0
- package/vendor/components/index.d.ts.map +1 -1
- package/vendor/components/index.js +3 -0
- package/vendor/components/index.js.map +1 -1
- package/vendor/components/twMerge.d.ts +3 -2
- package/vendor/components/twMerge.d.ts.map +1 -1
- package/vendor/components/twMerge.js.map +1 -1
- package/vendor/components/ui/combobox.d.ts.map +1 -1
- package/vendor/components/ui/combobox.js +1 -1
- package/vendor/components/ui/combobox.js.map +1 -1
- package/vendor/components/ui/input-group.d.ts.map +1 -1
- package/vendor/components/ui/input-group.js +5 -4
- package/vendor/components/ui/input-group.js.map +1 -1
- package/src/AdaptableInterfaces/AdaptableNoCodeWizard.d.ts +0 -99
- package/src/AdaptableInterfaces/AdaptableNoCodeWizard.js +0 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableConfig.d.ts +0 -15
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/AdaptableConfig.js +0 -1
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.d.ts +0 -19
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ColumnsList.js +0 -337
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.d.ts +0 -5
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/Components/FormBox.js +0 -4
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.d.ts +0 -30
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizard.js +0 -162
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.d.ts +0 -18
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/ConfigurationWizardColumnsStep.js +0 -12
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.d.ts +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/EntitlementsForm.js +0 -131
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.d.ts +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/GridOptionsForm.js +0 -30
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.d.ts +0 -6
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsSidebarForm.js +0 -80
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.d.ts +0 -6
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UIOptionsStatusbarForm.js +0 -100
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.d.ts +0 -11
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/UIOptions/UiOptionsForm.js +0 -8
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.d.ts +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/index.js +0 -2
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.d.ts +0 -21
- package/src/View/AdaptableWizardView/AdaptableConfigurationDialog/useSelection.js +0 -63
- package/src/View/AdaptableWizardView/Utilities/Utils.d.ts +0 -1
- package/src/View/AdaptableWizardView/Utilities/Utils.js +0 -21
- package/src/View/AdaptableWizardView/Utilities/helper.d.ts +0 -19
- package/src/View/AdaptableWizardView/Utilities/helper.js +0 -81
- package/src/View/AdaptableWizardView/Wizard.d.ts +0 -57
- package/src/View/AdaptableWizardView/Wizard.js +0 -98
- package/src/View/AdaptableWizardView/index.d.ts +0 -4
- package/src/View/AdaptableWizardView/index.js +0 -4
- package/src/components/ColorPicker/ColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/ColorPicker.js +0 -48
- package/src/components/ColorPicker/OptionalColorPicker.d.ts +0 -12
- package/src/components/ColorPicker/OptionalColorPicker.js +0 -13
- package/src/components/ColorPicker/index.d.ts +0 -2
- package/src/components/ColorPicker/index.js +0 -2
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState, } from 'react';
|
|
3
|
+
import { Check, Grid2x2, Pipette, SlidersHorizontal } from 'lucide-react';
|
|
4
|
+
import { HexAlphaColorPicker, HexColorPicker } from 'react-colorful';
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { Tooltip } from '../Tooltip';
|
|
7
|
+
import { cn } from '../lib/utils';
|
|
8
|
+
import { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText } from '../ui/input-group';
|
|
9
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../ui/tabs';
|
|
10
|
+
import { useColorPickerTab } from './colorPickerTab';
|
|
11
|
+
import { coloursKeptFromSource, describeColor, normalizeColorPickerTabs, readAllowedColors, readAllPaletteColors, readPaletteColors, readTabs, THEME_COLOR_GROUP, sortColorsByHex, uniqueColorsByKey, } from './themeColors';
|
|
12
|
+
export { setColorPickerTab, useColorPickerTab } from './colorPickerTab';
|
|
13
|
+
export { ALLOWED_COLORS_VAR, coloursKeptFromSource, describeColor, normalizeColorPickerTabs, PALETTE_COUNT_VAR, parseTabs, readAllowedColors, readAllPaletteColors, readPaletteColors, readTabs, TABS_VAR, THEME_COLOR_GROUP, } from './themeColors';
|
|
14
|
+
/** `#rrggbb`, or `#rrggbbaa` when the colour has opacity. */
|
|
15
|
+
export const HEX_COLOR = /^#([0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
16
|
+
const HEX_DIGITS = /^([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
17
|
+
const OPAQUE_HEX_DIGITS = /^([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
18
|
+
/**
|
|
19
|
+
* Both tabs' content is this tall, so switching tabs never resizes the
|
|
20
|
+
* popover. `flex-none` undoes the panel's default `flex-1`, which in the
|
|
21
|
+
* column-flex root would size it to its content instead.
|
|
22
|
+
*/
|
|
23
|
+
const CONTENT_HEIGHT = 'twa:h-52 twa:flex-none twa:p-1';
|
|
24
|
+
const PICKER_START = '#808080';
|
|
25
|
+
/** Transparency checkerboard — the "no colour" preview. */
|
|
26
|
+
export const CHECKERBOARD = {
|
|
27
|
+
backgroundImage: 'conic-gradient(rgba(128,128,128,0.35) 25%, transparent 0 50%, rgba(128,128,128,0.35) 0 75%, transparent 0)',
|
|
28
|
+
backgroundSize: '8px 8px',
|
|
29
|
+
};
|
|
30
|
+
/** `#abc` → `#aabbcc`; anything else lower-cased with the `#` ensured. */
|
|
31
|
+
function normalizeHex(digits) {
|
|
32
|
+
const d = digits.toLowerCase();
|
|
33
|
+
return `#${d.length === 3 ? d.replace(/./g, (c) => c + c) : d}`;
|
|
34
|
+
}
|
|
35
|
+
const toHexByte = (n) => Math.round(n).toString(16).padStart(2, '0');
|
|
36
|
+
/** A computed `rgb(…)` / `rgba(…)` as hex, with an alpha byte only when translucent. */
|
|
37
|
+
function rgbToHex(rgb) {
|
|
38
|
+
const match = /^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/.exec(rgb);
|
|
39
|
+
if (!match) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const [r, g, b] = match.slice(1, 4).map(Number);
|
|
43
|
+
const alpha = match[4] === undefined ? 1 : Number(match[4]);
|
|
44
|
+
return `#${toHexByte(r)}${toHexByte(g)}${toHexByte(b)}${alpha < 1 ? toHexByte(alpha * 255) : ''}`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The hex behind the current value: the value itself when it is one, or what
|
|
48
|
+
* a theme token computes to on the preview element — so the precise picker
|
|
49
|
+
* and the hex field start from the colour the user is looking at.
|
|
50
|
+
*/
|
|
51
|
+
function useResolvedHex(value, previewRef) {
|
|
52
|
+
const [resolved, setResolved] = useState(undefined);
|
|
53
|
+
const isHex = !!value && HEX_COLOR.test(value);
|
|
54
|
+
useLayoutEffect(() => {
|
|
55
|
+
if (isHex || !value || !previewRef.current) {
|
|
56
|
+
setResolved(undefined);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setResolved(rgbToHex(getComputedStyle(previewRef.current).backgroundColor));
|
|
60
|
+
}, [value, isHex, previewRef]);
|
|
61
|
+
return isHex ? value.toLowerCase() : resolved;
|
|
62
|
+
}
|
|
63
|
+
const eyeDropperSupported = () => typeof window !== 'undefined' && typeof window.EyeDropper === 'function';
|
|
64
|
+
/**
|
|
65
|
+
* The swatches in effect where the picker renders, read from CSS once it is
|
|
66
|
+
* in the document. With `filterColours`, every palette colour is supplied to
|
|
67
|
+
* it; without, `--ab-cmp-color-picker__palette-count` caps the palette and
|
|
68
|
+
* `--ab-cmp-color-picker__allowed-colors: palette` drops the theme colours.
|
|
69
|
+
*/
|
|
70
|
+
function usePalette(elementRef, excludeColor, orderPaletteColours, removeDuplicates, showGroupLabels, filterColours) {
|
|
71
|
+
const filterRef = useRef(filterColours);
|
|
72
|
+
filterRef.current = filterColours;
|
|
73
|
+
const hasFilter = !!filterColours;
|
|
74
|
+
const [sections, setSections] = useState([]);
|
|
75
|
+
const [css, setCss] = useState({ tabs: ['precise', 'colors'], allowed: 'any' });
|
|
76
|
+
useLayoutEffect(() => {
|
|
77
|
+
const element = elementRef.current;
|
|
78
|
+
if (!element) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const allowed = readAllowedColors(element);
|
|
82
|
+
setCss({ tabs: readTabs(element), allowed });
|
|
83
|
+
const filter = filterRef.current;
|
|
84
|
+
const visible = (color) => color.value !== excludeColor;
|
|
85
|
+
const paletteColours = (filter ? readAllPaletteColors(element) : readPaletteColors(element)).filter(visible);
|
|
86
|
+
const themeColours = !filter && allowed === 'palette' ? [] : THEME_COLOR_GROUP.colors.filter(visible);
|
|
87
|
+
const supplied = filter
|
|
88
|
+
? withComputedHex(element, themeColours, paletteColours)
|
|
89
|
+
: { themeColours, paletteColours };
|
|
90
|
+
const filtered = applyColourFilter(supplied.themeColours, supplied.paletteColours, filter);
|
|
91
|
+
setSections(layoutSwatches(element, filtered, {
|
|
92
|
+
orderPaletteColours,
|
|
93
|
+
removeDuplicates,
|
|
94
|
+
showGroupLabels,
|
|
95
|
+
}));
|
|
96
|
+
}, [elementRef, excludeColor, orderPaletteColours, removeDuplicates, showGroupLabels, hasFilter]);
|
|
97
|
+
return { sections, css };
|
|
98
|
+
}
|
|
99
|
+
/** The same colours, each with the hex the active theme paints for it. */
|
|
100
|
+
function withComputedHex(host, themeColours, paletteColours) {
|
|
101
|
+
const hexOf = computedHexes(host, [...themeColours, ...paletteColours]);
|
|
102
|
+
const attach = (colors) => colors.map((color) => {
|
|
103
|
+
const hex = hexOf.get(color.value);
|
|
104
|
+
return hex ? { ...color, hex } : color;
|
|
105
|
+
});
|
|
106
|
+
return { themeColours: attach(themeColours), paletteColours: attach(paletteColours) };
|
|
107
|
+
}
|
|
108
|
+
/** Keeps only colours from the list they were returned in. No result shows every colour. */
|
|
109
|
+
function applyColourFilter(themeColours, paletteColours, filterColours) {
|
|
110
|
+
if (!filterColours) {
|
|
111
|
+
return { themeColours, paletteColours };
|
|
112
|
+
}
|
|
113
|
+
const result = filterColours({ themeColours, paletteColours });
|
|
114
|
+
if (!result) {
|
|
115
|
+
return { themeColours, paletteColours };
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
themeColours: coloursKeptFromSource(result.themeColours, themeColours),
|
|
119
|
+
paletteColours: coloursKeptFromSource(result.paletteColours, paletteColours),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* One grid, or a Theme section and a Palette section. Ordering and duplicate
|
|
124
|
+
* removal run after the filter: across the whole list when there is one grid,
|
|
125
|
+
* and inside each group when the headings are shown. A palette colour that
|
|
126
|
+
* paints the same hex as a theme colour is the one left out.
|
|
127
|
+
*/
|
|
128
|
+
function layoutSwatches(host, lists, options) {
|
|
129
|
+
const { themeColours, paletteColours } = lists;
|
|
130
|
+
if (!options.showGroupLabels) {
|
|
131
|
+
return [
|
|
132
|
+
{
|
|
133
|
+
id: 'all',
|
|
134
|
+
colors: arrangeSwatches(host, [...themeColours, ...paletteColours], options),
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
}
|
|
138
|
+
const arranged = arrangeGroups(host, themeColours, paletteColours, options);
|
|
139
|
+
const sections = [
|
|
140
|
+
{ id: 'theme', label: 'Theme', colors: arranged.themeColours },
|
|
141
|
+
{ id: 'palette', label: 'Palette', colors: arranged.paletteColours },
|
|
142
|
+
];
|
|
143
|
+
const filled = sections.filter((section) => section.colors.length > 0);
|
|
144
|
+
// a single remaining group has nothing to distinguish it from
|
|
145
|
+
return filled.length > 1 ? filled : [{ id: 'all', colors: filled[0]?.colors ?? [] }];
|
|
146
|
+
}
|
|
147
|
+
function arrangeGroups(host, themeColours, paletteColours, options) {
|
|
148
|
+
if (!options.orderPaletteColours && !options.removeDuplicates) {
|
|
149
|
+
return { themeColours, paletteColours };
|
|
150
|
+
}
|
|
151
|
+
const hexOf = computedHexes(host, [...themeColours, ...paletteColours]);
|
|
152
|
+
const themeValues = new Set(themeColours.map((color) => color.value));
|
|
153
|
+
const listed = options.removeDuplicates
|
|
154
|
+
? uniqueColorsByKey([...themeColours, ...paletteColours], (color) => hexOf.get(color.value))
|
|
155
|
+
: [...themeColours, ...paletteColours];
|
|
156
|
+
const theme = listed.filter((color) => themeValues.has(color.value));
|
|
157
|
+
const palette = listed.filter((color) => !themeValues.has(color.value));
|
|
158
|
+
if (!options.orderPaletteColours) {
|
|
159
|
+
return { themeColours: theme, paletteColours: palette };
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
themeColours: sortColorsByHex(theme, (color) => hexOf.get(color.value)),
|
|
163
|
+
paletteColours: sortColorsByHex(palette, (color) => hexOf.get(color.value)),
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* The hex a swatch paints, read from a probe in the picker's theme so
|
|
168
|
+
* `var(--ab-color-…)` resolves. With `removeDuplicates`, a later swatch that
|
|
169
|
+
* paints the same hex is dropped. With `orderPaletteColours`, the rest are
|
|
170
|
+
* ordered around the colour wheel. With neither, the given order is kept.
|
|
171
|
+
*/
|
|
172
|
+
function arrangeSwatches(host, colors, options) {
|
|
173
|
+
if (!options.orderPaletteColours && !options.removeDuplicates) {
|
|
174
|
+
return colors;
|
|
175
|
+
}
|
|
176
|
+
const hexOf = computedHexes(host, colors);
|
|
177
|
+
const listed = options.removeDuplicates
|
|
178
|
+
? uniqueColorsByKey(colors, (color) => hexOf.get(color.value))
|
|
179
|
+
: colors;
|
|
180
|
+
return options.orderPaletteColours
|
|
181
|
+
? sortColorsByHex(listed, (color) => hexOf.get(color.value))
|
|
182
|
+
: listed;
|
|
183
|
+
}
|
|
184
|
+
function computedHexes(host, colors) {
|
|
185
|
+
const probe = host.ownerDocument.createElement('span');
|
|
186
|
+
probe.style.cssText = 'position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;';
|
|
187
|
+
host.appendChild(probe);
|
|
188
|
+
const hexOf = new Map();
|
|
189
|
+
try {
|
|
190
|
+
for (const color of colors) {
|
|
191
|
+
probe.style.backgroundColor = '';
|
|
192
|
+
probe.style.backgroundColor = color.value;
|
|
193
|
+
const hex = rgbToHex(getComputedStyle(probe).backgroundColor);
|
|
194
|
+
if (hex) {
|
|
195
|
+
hexOf.set(color.value, hex);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
probe.remove();
|
|
201
|
+
}
|
|
202
|
+
return hexOf;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* The colour picker's popover body: a palette tab with the Adaptable theme
|
|
206
|
+
* colours and a Custom tab with a free picker, over a footer shared by both —
|
|
207
|
+
* the current colour, an eyedropper where the browser has one, and a hex
|
|
208
|
+
* field.
|
|
209
|
+
*
|
|
210
|
+
* `tabs` sets which tabs show and in what order. The picker shows `tab` when
|
|
211
|
+
* controlled; otherwise it opens on `defaultTab`, else on the tab the user
|
|
212
|
+
* last picked in any picker on the page (see `colorPickerTab.ts`), else on
|
|
213
|
+
* the first listed tab.
|
|
214
|
+
*
|
|
215
|
+
* Without `tabs`, the CSS variables decide: `--ab-cmp-color-picker__tabs`
|
|
216
|
+
* sets the tabs, and `--ab-cmp-color-picker__allowed-colors: predefined`
|
|
217
|
+
* drops the Custom tab, so no custom colour can be picked; `palette` also
|
|
218
|
+
* drops the theme colours (unless `filterColours` is given).
|
|
219
|
+
*/
|
|
220
|
+
export function ColorPicker(props) {
|
|
221
|
+
const { value, onInput, onCommit, excludeColor, defaultColor = PICKER_START, includeAlpha = true, preciseTabLabel = 'Custom', colorsTabLabel = 'Palette', tabs: tabsProp, orderPaletteColours = true, removeDuplicates = true, showGroupLabels = false, filterColours, defaultTab, onTabChange, } = props;
|
|
222
|
+
const dataName = props['data-name'];
|
|
223
|
+
const [lastPickedTab, setLastPickedTab] = useColorPickerTab();
|
|
224
|
+
// so a picker with `defaultTab` can still switch tabs while it is open
|
|
225
|
+
const [ownTab, setOwnTab] = useState(null);
|
|
226
|
+
const previewRef = useRef(null);
|
|
227
|
+
const resolvedHex = useResolvedHex(value, previewRef);
|
|
228
|
+
const hex = includeAlpha ? resolvedHex : resolvedHex?.slice(0, 7);
|
|
229
|
+
const { sections: swatchSections, css } = usePalette(previewRef, excludeColor, orderPaletteColours, removeDuplicates, showGroupLabels, filterColours);
|
|
230
|
+
const tabsFromCss = tabsProp === undefined;
|
|
231
|
+
const shownTabs = tabsFromCss ? css.tabs : normalizeColorPickerTabs(tabsProp);
|
|
232
|
+
const tab = [props.tab, ownTab, defaultTab, lastPickedTab].find((t) => t != null && shownTabs.includes(t)) ?? shownTabs[0];
|
|
233
|
+
const defaultRef = useRef(null);
|
|
234
|
+
const startHex = useResolvedHex(defaultColor, defaultRef) ?? PICKER_START;
|
|
235
|
+
// the hex field is free text until it parses; it snaps back to the colour on blur
|
|
236
|
+
const [hexDraft, setHexDraft] = useState(null);
|
|
237
|
+
useEffect(() => setHexDraft(null), [value]);
|
|
238
|
+
const hexText = hexDraft ?? (hex ? hex.slice(1) : '');
|
|
239
|
+
// six (or eight, with opacity) digits commit as they are typed; a three-digit
|
|
240
|
+
// shorthand only on Enter / blur, or it would expand under the user's cursor
|
|
241
|
+
// at the third digit
|
|
242
|
+
const commitHexDraft = (text, options) => {
|
|
243
|
+
const digits = text.trim().replace(/^#/, '');
|
|
244
|
+
const valid = includeAlpha ? HEX_DIGITS : OPAQUE_HEX_DIGITS;
|
|
245
|
+
if (valid.test(digits) && (options.allowShort || digits.length !== 3)) {
|
|
246
|
+
const next = normalizeHex(digits);
|
|
247
|
+
if (next !== hex) {
|
|
248
|
+
onCommit(next);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const [canPickFromScreen] = useState(eyeDropperSupported);
|
|
253
|
+
const pickFromScreen = async () => {
|
|
254
|
+
const EyeDropper = window.EyeDropper;
|
|
255
|
+
if (!EyeDropper) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
try {
|
|
259
|
+
const { sRGBHex } = await new EyeDropper().open();
|
|
260
|
+
onCommit(sRGBHex.toLowerCase());
|
|
261
|
+
}
|
|
262
|
+
catch {
|
|
263
|
+
// cancelled with Escape
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
const swatches = (_jsx("div", { className: "twa:flex twa:flex-col twa:gap-2.5", children: swatchSections.map((section) => (_jsxs("div", { className: "twa:flex twa:flex-col twa:gap-1", children: [section.label ? (_jsx("div", { "data-name": `${dataName}-group-${section.id}`, className: "twa:px-0.5 twa:text-xs twa:text-muted-foreground", children: section.label })) : null, _jsx(Swatches, { colors: section.colors, value: value, "data-name": dataName, onPick: (color) => {
|
|
267
|
+
onCommit(color);
|
|
268
|
+
props.onSwatchPicked?.();
|
|
269
|
+
} })] }, section.id))) }));
|
|
270
|
+
const described = value ? describeColor(value) : undefined;
|
|
271
|
+
// a raw hex is already shown in the hex field; a theme or palette colour has a name
|
|
272
|
+
const colorName = described && described !== value ? described : undefined;
|
|
273
|
+
const previewSwatch = (_jsx("span", { ref: previewRef, "data-name": `${dataName}-preview`, "data-value": value, style: value ? { backgroundColor: value } : CHECKERBOARD, className: "twa:block twa:size-9 twa:shrink-0 twa:rounded-full twa:border twa:border-foreground/10" }));
|
|
274
|
+
const preview = colorName ? (_jsx(Tooltip, { label: colorName, children: previewSwatch })) : (previewSwatch);
|
|
275
|
+
const name = colorName ? (_jsx("span", { "data-name": `${dataName}-name`, title: colorName, className: "twa:min-w-0 twa:max-w-28 twa:truncate twa:text-xs twa:text-muted-foreground", children: colorName })) : null;
|
|
276
|
+
if (tabsFromCss && css.allowed !== 'any') {
|
|
277
|
+
return (_jsxs("div", { "data-name": `${dataName}-picker`, className: "twa:flex twa:flex-col twa:gap-3", children: [_jsx("div", { className: cn(CONTENT_HEIGHT, SWATCHES_LAYOUT), children: swatches }), _jsxs("div", { className: FOOTER_LAYOUT, children: [preview, value ? (_jsx("span", { "data-name": `${dataName}-name`, className: "twa:min-w-0 twa:truncate twa:text-xs twa:text-muted-foreground", children: described })) : null] })] }));
|
|
278
|
+
}
|
|
279
|
+
const PrecisePicker = includeAlpha ? HexAlphaColorPicker : HexColorPicker;
|
|
280
|
+
const triggers = {
|
|
281
|
+
precise: (_jsxs(TabsTrigger, { value: "precise", "data-name": `${dataName}-tab-precise`, children: [_jsx(SlidersHorizontal, { "aria-hidden": true }), preciseTabLabel] }, "precise")),
|
|
282
|
+
colors: (_jsxs(TabsTrigger, { value: "colors", "data-name": `${dataName}-tab-colors`, children: [_jsx(Grid2x2, { "aria-hidden": true }), colorsTabLabel] }, "colors")),
|
|
283
|
+
};
|
|
284
|
+
const contents = {
|
|
285
|
+
precise: (_jsx(TabsContent, { value: "precise", className: CONTENT_HEIGHT, children: _jsx(PrecisePicker, { color: hex ?? startHex, onChange: onInput, "data-name": `${dataName}-precise`,
|
|
286
|
+
// react-colorful injects unlayered styles, which beat our layered
|
|
287
|
+
// utilities whatever the specificity — hence `!`. Its parts are
|
|
288
|
+
// addressed by position (saturation area, then the hue and alpha
|
|
289
|
+
// strips) and by the `…__pointer` class suffix, so the selectors
|
|
290
|
+
// survive minified class-name scanning.
|
|
291
|
+
className: cn('twa:w-full! twa:h-full!', 'twa:*:first:rounded-md! twa:*:first:border-0!', 'twa:*:not-first:mt-2.5! twa:*:not-first:h-3! twa:*:not-first:rounded-full!', 'twa:**:[[class$=pointer]]:size-4! twa:**:[[class$=pointer]]:border-2!') }) }, "precise")),
|
|
292
|
+
// scrolls inside the same height as the precise tab, so the popover keeps its size
|
|
293
|
+
colors: (_jsx(TabsContent, { value: "colors", className: cn(CONTENT_HEIGHT, SWATCHES_LAYOUT), children: swatches }, "colors")),
|
|
294
|
+
};
|
|
295
|
+
return (_jsxs(Tabs, { value: tab, onValueChange: (next) => {
|
|
296
|
+
setOwnTab(next);
|
|
297
|
+
setLastPickedTab(next);
|
|
298
|
+
onTabChange?.(next);
|
|
299
|
+
}, "data-name": `${dataName}-picker`, className: "twa:gap-3", children: [shownTabs.length > 1 ? (_jsx(TabsList, { className: "twa:grid twa:w-full twa:grid-cols-2", children: shownTabs.map((id) => triggers[id]) })) : null, shownTabs.map((id) => contents[id]), _jsxs("div", { className: FOOTER_LAYOUT, children: [preview, tab === 'colors' ? name : null, _jsx("span", { ref: defaultRef, hidden: true, style: { backgroundColor: defaultColor } }), tab === 'precise' && canPickFromScreen ? (_jsx(Button, { variant: "outline", size: "icon-sm", "data-name": `${dataName}-eyedropper`, tooltip: "Pick a colour from the screen", onClick: pickFromScreen, className: "twa:shrink-0 twa:rounded-full", children: _jsx(Pipette, { "aria-hidden": true }) })) : null, tab === 'precise' ? (_jsxs(InputGroup, { className: "twa:h-8 twa:min-h-8 twa:min-w-0 twa:flex-1", children: [_jsx(InputGroupAddon, { children: _jsx(InputGroupText, { className: "twa:font-mono", children: "#" }) }), _jsx(InputGroupInput, { "data-name": `${dataName}-hex`, "aria-label": "Hex colour", value: hexText, placeholder: hex ? undefined : '000000', spellCheck: false, autoComplete: "off", maxLength: includeAlpha ? 9 : 7, className: "twa:font-mono twa:text-xs", onChange: (event) => {
|
|
300
|
+
setHexDraft(event.target.value);
|
|
301
|
+
commitHexDraft(event.target.value, { allowShort: false });
|
|
302
|
+
}, onBlur: (event) => {
|
|
303
|
+
commitHexDraft(event.currentTarget.value, { allowShort: true });
|
|
304
|
+
setHexDraft(null);
|
|
305
|
+
}, onKeyDown: (event) => {
|
|
306
|
+
if (event.key === 'Enter') {
|
|
307
|
+
commitHexDraft(event.currentTarget.value, { allowShort: true });
|
|
308
|
+
setHexDraft(null);
|
|
309
|
+
}
|
|
310
|
+
} })] })) : (_jsx("span", { "data-name": `${dataName}-hex-text`, className: "twa:ml-auto twa:min-w-0 twa:truncate twa:font-mono twa:text-xs twa:text-muted-foreground", children: hex ? `#${hex}` : '' }))] })] }));
|
|
311
|
+
}
|
|
312
|
+
const SWATCHES_LAYOUT = 'twa:flex twa:flex-col twa:gap-2.5 twa:overflow-y-auto twa:overscroll-contain twa:pr-1';
|
|
313
|
+
const FOOTER_LAYOUT = 'twa:flex twa:items-center twa:gap-2 twa:border-t twa:border-foreground/10 twa:pt-3';
|
|
314
|
+
function Swatches(props) {
|
|
315
|
+
const { colors, value, onPick } = props;
|
|
316
|
+
const dataName = props['data-name'];
|
|
317
|
+
return (_jsx("div", { role: "listbox", "aria-label": "Colours", "data-name": `${dataName}-options`, className: "twa:grid twa:grid-cols-8 twa:gap-1", children: colors.map((color) => {
|
|
318
|
+
const selected = color.value === value;
|
|
319
|
+
return (_jsx(Tooltip, { label: color.label, className: "twa:min-w-0", children: _jsx("button", { type: "button", role: "option", "aria-selected": selected, "aria-label": color.label, "data-name": `${dataName}-option`, "data-value": color.value, onClick: () => onPick(color.value), style: { backgroundColor: color.value }, className: cn('twa:flex twa:h-7 twa:w-full twa:items-center twa:justify-center twa:rounded-md twa:border twa:border-foreground/10 twa:transition-[box-shadow,transform]', 'twa:hover:scale-105 twa:hover:ring-2 twa:hover:ring-ring/40 twa:focus-visible:outline-none twa:focus-visible:ring-2 twa:focus-visible:ring-ring/50', selected && 'twa:ring-2 twa:ring-accent twa:ring-offset-1 twa:ring-offset-popover'), children: selected ? (_jsx(Check, { "aria-hidden": true, className: "twa:size-3.5 twa:text-white twa:drop-shadow-[0_0_1px_rgba(0,0,0,0.9)]" })) : null }) }, color.value));
|
|
320
|
+
}) }));
|
|
321
|
+
}
|
|
322
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ColorPicker/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjG,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAuB,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAEL,qBAAqB,EACrB,aAAa,EACb,wBAAwB,EACxB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,QAAQ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,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAClC,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,EAAE,EACvC,SAAS,EAAE,EAAE,CACX,0JAA0J,EAC1J,oJAAoJ,EACpJ,QAAQ,IAAI,sEAAsE,CACnF,YAEA,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,KAAK,yBAEJ,SAAS,EAAC,uEAAuE,GACjF,CACH,CAAC,CAAC,CAAC,IAAI,GACD,IAtBG,KAAK,CAAC,KAAK,CAuBf,CACX,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The colours the colour picker offers besides a custom one: the Adaptable
|
|
3
|
+
* theme tokens from `@adaptabletools/tokens` (`vars.css`). They are stored as
|
|
4
|
+
* `var(--ab-color-…)` so a styled cell, alert or dashboard bar follows the
|
|
5
|
+
* light / dark theme and any host overrides of those variables.
|
|
6
|
+
*/
|
|
7
|
+
import type { ColorPickerTab } from './colorPickerTab';
|
|
8
|
+
export type ThemeColor = {
|
|
9
|
+
/** The CSS value that gets stored, e.g. `var(--ab-color-success)`. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** What the user sees for it. */
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* The colour as the active theme paints it, e.g. `#1c7ed6`. Set on the
|
|
15
|
+
* colours handed to `filterColours`. An alpha byte is included only when
|
|
16
|
+
* the colour is translucent.
|
|
17
|
+
*/
|
|
18
|
+
hex?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ThemeColorGroup = {
|
|
21
|
+
id: 'theme' | 'palette';
|
|
22
|
+
label: string;
|
|
23
|
+
colors: ThemeColor[];
|
|
24
|
+
};
|
|
25
|
+
export declare const THEME_COLOR_GROUP: ThemeColorGroup;
|
|
26
|
+
/**
|
|
27
|
+
* One swatch per resolved colour. `keyOf` is the computed hex (or `undefined`
|
|
28
|
+
* when it cannot be resolved, in which case the stored value is the key).
|
|
29
|
+
* The first colour wins, so theme colours stay ahead of a palette colour that
|
|
30
|
+
* paints the same.
|
|
31
|
+
*/
|
|
32
|
+
export declare function uniqueColorsByKey(colors: ThemeColor[], keyOf: (color: ThemeColor) => string | undefined): ThemeColor[];
|
|
33
|
+
/**
|
|
34
|
+
* Colour-wheel order. Hex order follows the red channel, so it splits blues
|
|
35
|
+
* and reds apart. Here each 30° of hue is a family (reds, then oranges,
|
|
36
|
+
* yellows, greens, cyans, blues, purples), light shades before dark ones.
|
|
37
|
+
* Greys, white and black come after the wheel, light to dark. An unresolvable
|
|
38
|
+
* colour stays at the end, in its original order.
|
|
39
|
+
*/
|
|
40
|
+
export declare function sortColorsByHex(colors: ThemeColor[], hexOf: (color: ThemeColor) => string | undefined): ThemeColor[];
|
|
41
|
+
export declare const PALETTE_COUNT_VAR = "--ab-cmp-color-picker__palette-count";
|
|
42
|
+
export declare const ALLOWED_COLORS_VAR = "--ab-cmp-color-picker__allowed-colors";
|
|
43
|
+
export declare const TABS_VAR = "--ab-cmp-color-picker__tabs";
|
|
44
|
+
/** The names a host passes for the Colour Picker tabs, in display order. */
|
|
45
|
+
export type ColorPickerTabName = 'Custom' | 'Palette';
|
|
46
|
+
/**
|
|
47
|
+
* - `any`: theme colours, palette and a custom colour (the Custom tab)
|
|
48
|
+
* - `predefined`: theme colours and palette only
|
|
49
|
+
* - `palette`: palette only
|
|
50
|
+
*/
|
|
51
|
+
export type AllowedColors = 'any' | 'predefined' | 'palette';
|
|
52
|
+
/**
|
|
53
|
+
* The palette colours in effect on `element`: `--ab-color-palette-1` upwards
|
|
54
|
+
* until one is not defined, capped by `--ab-cmp-color-picker__palette-count`
|
|
55
|
+
* when that is a positive integer.
|
|
56
|
+
*/
|
|
57
|
+
export declare function readPaletteColors(element: Element): ThemeColor[];
|
|
58
|
+
/**
|
|
59
|
+
* Every palette colour in effect on `element`, ignoring
|
|
60
|
+
* `--ab-cmp-color-picker__palette-count`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readAllPaletteColors(element: Element): ThemeColor[];
|
|
63
|
+
/** `--ab-cmp-color-picker__allowed-colors` on `element`; `any` when unset or unrecognised. */
|
|
64
|
+
export declare function readAllowedColors(element: Element): AllowedColors;
|
|
65
|
+
/**
|
|
66
|
+
* `--ab-cmp-color-picker__tabs` on `element`: the tabs to show, in order, the
|
|
67
|
+
* first being the default (e.g. `colors precise`; `colours` is also
|
|
68
|
+
* accepted). Unknown and repeated ids are dropped; `precise colors` when
|
|
69
|
+
* nothing valid is left.
|
|
70
|
+
*/
|
|
71
|
+
export declare function readTabs(element: Element): ColorPickerTab[];
|
|
72
|
+
/** A `--ab-cmp-color-picker__tabs` value as tab ids; see `readTabs`. */
|
|
73
|
+
export declare function parseTabs(value: string): ColorPickerTab[];
|
|
74
|
+
/**
|
|
75
|
+
* The tabs to show, in the order given. `Custom` is the free picker; `Palette`
|
|
76
|
+
* is the swatches. Unknown and repeated names are dropped. `Custom` then
|
|
77
|
+
* `Palette` when nothing valid is left, including when `tabs` is omitted.
|
|
78
|
+
*/
|
|
79
|
+
export declare function normalizeColorPickerTabs(tabs: readonly string[] | undefined): ColorPickerTab[];
|
|
80
|
+
/**
|
|
81
|
+
* The returned colours that belong to `source`, in the returned order.
|
|
82
|
+
* Anything whose `value` is not in `source` is dropped, and so is a repeat.
|
|
83
|
+
*/
|
|
84
|
+
export declare function coloursKeptFromSource(returned: readonly {
|
|
85
|
+
value: string;
|
|
86
|
+
}[] | undefined, source: ThemeColor[]): ThemeColor[];
|
|
87
|
+
/**
|
|
88
|
+
* The picker's name for a stored colour: the token label for a theme colour
|
|
89
|
+
* (`var(--ab-color-success)` → "Success", `var(--ab-color-palette-3)` →
|
|
90
|
+
* "Palette 3"), a name derived from any other `--ab-color-*` token
|
|
91
|
+
* (`var(--ab-color-badge-foreground)` → "Badge text"), the value itself otherwise.
|
|
92
|
+
*/
|
|
93
|
+
export declare function describeColor(value: string): string;
|
|
94
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