diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceEditorWrapper.test.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceEditorWrapper.test.tsx index 82a79103fe2..c2f2ac083a8 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceEditorWrapper.test.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/AceEditorWrapper.test.tsx @@ -22,10 +22,7 @@ import { QueryEditor } from 'src/SqlLab/types'; import { Store } from 'redux'; import { initialState, defaultQueryEditor } from 'src/SqlLab/fixtures'; import AceEditorWrapper from 'src/SqlLab/components/AceEditorWrapper'; -import { - AsyncAceEditorProps, - FullSQLEditor, -} from 'src/components/AsyncAceEditor'; +import { FullSQLEditor, type AsyncAceEditorProps } from 'src/components'; import { queryEditorSetCursorPosition, queryEditorSetDb, diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx index 64fb5162657..799e42a94f5 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/index.tsx @@ -24,7 +24,7 @@ import { Global } from '@emotion/react'; import { SQL_EDITOR_LEFTBAR_WIDTH } from 'src/SqlLab/constants'; import { queryEditorSetSelectedText } from 'src/SqlLab/actions/sqlLab'; -import { FullSQLEditor as AceEditor } from 'src/components/AsyncAceEditor'; +import { FullSQLEditor as AceEditor } from 'src/components'; import type { KeyboardShortcut } from 'src/SqlLab/components/KeyboardShortcutButton'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; import { SqlLabRootState, type CursorPosition } from 'src/SqlLab/types'; diff --git a/superset-frontend/src/SqlLab/components/AceEditorWrapper/useKeywords.ts b/superset-frontend/src/SqlLab/components/AceEditorWrapper/useKeywords.ts index e02145f963a..d17884dd7da 100644 --- a/superset-frontend/src/SqlLab/components/AceEditorWrapper/useKeywords.ts +++ b/superset-frontend/src/SqlLab/components/AceEditorWrapper/useKeywords.ts @@ -20,7 +20,7 @@ import { useEffect, useMemo, useRef } from 'react'; import { useSelector, useDispatch, shallowEqual, useStore } from 'react-redux'; import { getExtensionsRegistry, t } from '@superset-ui/core'; -import { Editor } from 'src/components/AsyncAceEditor'; +import type { Editor } from 'src/components'; import sqlKeywords from 'src/SqlLab/utils/sqlKeywords'; import { addTable, addDangerToast } from 'src/SqlLab/actions/sqlLab'; import { diff --git a/superset-frontend/src/SqlLab/components/ColumnElement/index.tsx b/superset-frontend/src/SqlLab/components/ColumnElement/index.tsx index d918af42812..dfa000ba1dd 100644 --- a/superset-frontend/src/SqlLab/components/ColumnElement/index.tsx +++ b/superset-frontend/src/SqlLab/components/ColumnElement/index.tsx @@ -19,8 +19,7 @@ import { ReactNode } from 'react'; import { ClassNames } from '@emotion/react'; import { styled, useTheme, t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import { Flex } from 'src/components/Flex'; +import { Flex, Tooltip } from 'src/components'; const StyledTooltip = (props: any) => { const theme = useTheme(); diff --git a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx index 6dda01d51a9..6dd2fd2374c 100644 --- a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx @@ -20,10 +20,8 @@ import { useMemo } from 'react'; import { useSelector } from 'react-redux'; import { css, styled, t } from '@superset-ui/core'; -import Alert from 'src/components/Alert'; +import { Alert, Button, Loading } from 'src/components'; import TableView from 'src/components/TableView'; -import Button from 'src/components/Button'; -import Loading from 'src/components/Loading'; import ModalTrigger from 'src/components/ModalTrigger'; import { EmptyWrapperType } from 'src/components/TableView/TableView'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; diff --git a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx index df19befadb7..98fb012e5d2 100644 --- a/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/ExploreCtasResultsButton/index.tsx @@ -24,7 +24,7 @@ import { addDangerToast, } from 'src/SqlLab/actions/sqlLab'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { exploreChart } from 'src/explore/exploreUtils'; import { SqlLabRootState } from 'src/SqlLab/types'; diff --git a/superset-frontend/src/SqlLab/components/ExploreResultsButton/ExploreResultsButton.test.tsx b/superset-frontend/src/SqlLab/components/ExploreResultsButton/ExploreResultsButton.test.tsx index a8eaaf5da74..1e5d1c2e741 100644 --- a/superset-frontend/src/SqlLab/components/ExploreResultsButton/ExploreResultsButton.test.tsx +++ b/superset-frontend/src/SqlLab/components/ExploreResultsButton/ExploreResultsButton.test.tsx @@ -21,7 +21,7 @@ import { render, screen } from 'spec/helpers/testing-library'; import ExploreResultsButton, { ExploreResultsButtonProps, } from 'src/SqlLab/components/ExploreResultsButton'; -import { OnClickHandler } from 'src/components/Button'; +import type { OnClickHandler } from 'src/components'; const setup = ( onClickFn: OnClickHandler, diff --git a/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx b/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx index ee62071b59c..2af51a1175c 100644 --- a/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/ExploreResultsButton/index.tsx @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import Button, { OnClickHandler } from 'src/components/Button'; +import { Button, type OnClickHandler } from 'src/components'; export interface ExploreResultsButtonProps { database?: { diff --git a/superset-frontend/src/SqlLab/components/QueryHistory/index.tsx b/superset-frontend/src/SqlLab/components/QueryHistory/index.tsx index d03077d00b4..870ea87e0b8 100644 --- a/superset-frontend/src/SqlLab/components/QueryHistory/index.tsx +++ b/superset-frontend/src/SqlLab/components/QueryHistory/index.tsx @@ -20,7 +20,7 @@ import { useEffect, useMemo, useState } from 'react'; import { shallowEqual, useSelector } from 'react-redux'; import { useInView } from 'react-intersection-observer'; import { omit } from 'lodash'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState } from 'src/components'; import { t, styled, diff --git a/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx b/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx index 6098f5f92bb..665141f8392 100644 --- a/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx +++ b/superset-frontend/src/SqlLab/components/QueryLimitSelect/index.tsx @@ -18,12 +18,11 @@ */ import { useDispatch } from 'react-redux'; import { t } from '@superset-ui/core'; -import { Dropdown } from 'src/components/Dropdown'; +import { Dropdown, Button } from 'src/components'; import { Menu } from 'src/components/Menu'; import { Icons } from 'src/components/Icons'; import { queryEditorSetQueryLimit } from 'src/SqlLab/actions/sqlLab'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; -import Button from 'src/components/Button'; export interface QueryLimitSelectProps { queryEditorId: string; diff --git a/superset-frontend/src/SqlLab/components/QueryStateLabel/QueryStateLabel.test.tsx b/superset-frontend/src/SqlLab/components/QueryStateLabel/QueryStateLabel.test.tsx index 91ac09dfcc2..55ddd71c478 100644 --- a/superset-frontend/src/SqlLab/components/QueryStateLabel/QueryStateLabel.test.tsx +++ b/superset-frontend/src/SqlLab/components/QueryStateLabel/QueryStateLabel.test.tsx @@ -21,7 +21,10 @@ import type { QueryState } from '@superset-ui/core'; import { render } from 'spec/helpers/testing-library'; import QueryStateLabel from '.'; -jest.mock('src/components/Label', () => () =>
); +jest.mock('src/components/Label', () => ({ + __esModule: true, + Label: () =>
, +})); const mockedProps = { query: { diff --git a/superset-frontend/src/SqlLab/components/QueryStateLabel/index.tsx b/superset-frontend/src/SqlLab/components/QueryStateLabel/index.tsx index 1e78e8cc441..2b234c341f8 100644 --- a/superset-frontend/src/SqlLab/components/QueryStateLabel/index.tsx +++ b/superset-frontend/src/SqlLab/components/QueryStateLabel/index.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import Label from 'src/components/Label'; +import { Label } from 'src/components'; import { STATE_TYPE_MAP, STATE_TYPE_MAP_LOCALIZED } from 'src/SqlLab/constants'; import { styled, Query } from '@superset-ui/core'; diff --git a/superset-frontend/src/SqlLab/components/QueryTable/index.tsx b/superset-frontend/src/SqlLab/components/QueryTable/index.tsx index bbccb83162b..3b675664660 100644 --- a/superset-frontend/src/SqlLab/components/QueryTable/index.tsx +++ b/superset-frontend/src/SqlLab/components/QueryTable/index.tsx @@ -17,7 +17,7 @@ * under the License. */ import { useMemo, ReactNode } from 'react'; -import Card from 'src/components/Card'; +import { Card, Button, Tooltip, Label } from 'src/components'; import ProgressBar from 'src/components/ProgressBar'; import { t, useTheme, QueryResponse } from '@superset-ui/core'; import { useDispatch, useSelector } from 'react-redux'; @@ -30,11 +30,8 @@ import { removeQuery, } from 'src/SqlLab/actions/sqlLab'; import TableView from 'src/components/TableView'; -import Button from 'src/components/Button'; import { fDuration, extendedDayjs } from 'src/utils/dates'; import { Icons } from 'src/components/Icons'; -import Label from 'src/components/Label'; -import { Tooltip } from 'src/components/Tooltip'; import { SqlLabRootState } from 'src/SqlLab/types'; import ModalTrigger from 'src/components/ModalTrigger'; import { UserWithPermissionsAndRoles as User } from 'src/types/bootstrapTypes'; diff --git a/superset-frontend/src/SqlLab/components/QueryTable/styles.ts b/superset-frontend/src/SqlLab/components/QueryTable/styles.ts index a1eb740964e..838911994e1 100644 --- a/superset-frontend/src/SqlLab/components/QueryTable/styles.ts +++ b/superset-frontend/src/SqlLab/components/QueryTable/styles.ts @@ -17,7 +17,7 @@ * under the License. */ import { styled, css } from '@superset-ui/core'; -import { IconTooltip } from '../../../components/IconTooltip'; +import { IconTooltip } from 'src/components'; export const StaticPosition = css` position: static; diff --git a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx index bab53e66a22..3c36850b7a9 100644 --- a/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx +++ b/superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx @@ -41,10 +41,9 @@ import { failedQueryWithFrontendTimeoutErrors, } from 'src/SqlLab/fixtures'; -jest.mock( - 'src/components/ErrorMessage/ErrorMessageWithStackTrace', - () => () =>
Error
, -); +jest.mock('src/components/ErrorMessage', () => ({ + ErrorMessageWithStackTrace: () =>
Error
, +})); const mockedProps = { cache: true, diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx index 10ae9e02a31..3605eb0967d 100644 --- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx +++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx @@ -28,9 +28,20 @@ import { import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { useHistory } from 'react-router-dom'; import { pick } from 'lodash'; -import ButtonGroup from 'src/components/ButtonGroup'; -import Alert from 'src/components/Alert'; -import Button from 'src/components/Button'; +import { + Alert, + Button, + ButtonGroup, + Tooltip, + Card, + CopyToClipboard, + ErrorMessageWithStackTrace, + Modal, + FilterableTable, + Input, + Label, + Loading, +} from 'src/components'; import { nanoid } from 'nanoid'; import { QueryState, @@ -44,7 +55,6 @@ import { getExtensionsRegistry, ErrorTypeEnum, } from '@superset-ui/core'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; import { ISaveableDatasource, ISimpleColumn, @@ -54,17 +64,9 @@ import { EXPLORE_CHART_DEFAULT, SqlLabRootState } from 'src/SqlLab/types'; import { mountExploreUrl } from 'src/explore/exploreUtils'; import { postFormData } from 'src/explore/exploreUtils/formData'; import ProgressBar from 'src/components/ProgressBar'; -import Loading from 'src/components/Loading'; -import Card from 'src/components/Card'; -import Label from 'src/components/Label'; -import { Input } from 'src/components/Input'; -import { Tooltip } from 'src/components/Tooltip'; -import FilterableTable from 'src/components/FilterableTable'; -import CopyToClipboard from 'src/components/CopyToClipboard'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import { prepareCopyToClipboardTabularData } from 'src/utils/common'; import { getItem, LocalStorageKeys } from 'src/utils/localStorageHelpers'; -import Modal from 'src/components/Modal'; import { addQueryEditor, clearQueryResults, diff --git a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx index 95a4c3bea99..052ffed4001 100644 --- a/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/RunQueryActionButton/index.tsx @@ -20,9 +20,8 @@ import { useMemo, FC, ReactElement } from 'react'; import { t, styled, useTheme, SupersetTheme } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button, DropdownButton } from 'src/components'; import { Icons } from 'src/components/Icons'; -import { DropdownButton } from 'src/components/DropdownButton'; import { detectOS } from 'src/utils/common'; import { QueryButtonProps } from 'src/SqlLab/types'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx index 990299ccb16..4c9464a04c6 100644 --- a/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/SaveDatasetActionButton/index.tsx @@ -18,8 +18,7 @@ */ import { t, useTheme } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import { DropdownButton } from 'src/components/DropdownButton'; -import Button from 'src/components/Button'; +import { Button, DropdownButton } from 'src/components'; interface SaveDatasetActionButtonProps { setShowSave: (arg0: boolean) => void; diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx index 0075ed44444..f6dff994e8f 100644 --- a/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx +++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal/index.tsx @@ -20,10 +20,13 @@ import { useCallback, useState, FormEvent } from 'react'; import { Radio, RadioChangeEvent } from 'src/components/Radio'; -import { AsyncSelect } from 'src/components'; -import { Input } from 'src/components/Input'; -import StyledModal from 'src/components/Modal'; -import Button from 'src/components/Button'; +import { + AsyncSelect, + Button, + Modal, + Input, + type SelectValue, +} from 'src/components'; import { styled, t, @@ -49,7 +52,6 @@ import { import { mountExploreUrl } from 'src/explore/exploreUtils'; import { postFormData } from 'src/explore/exploreUtils/formData'; import { URL_PARAMS } from 'src/constants'; -import { SelectValue } from 'src/components/Select'; import { isEmpty } from 'lodash'; interface QueryDatabase { @@ -356,7 +358,7 @@ export const SaveDatasetModal = ({ ) => option.value.toLowerCase().includes(inputValue.toLowerCase()); return ( - )} - + ); }; diff --git a/superset-frontend/src/SqlLab/components/SaveQuery/index.tsx b/superset-frontend/src/SqlLab/components/SaveQuery/index.tsx index 20dfab9d3c6..474ca963186 100644 --- a/superset-frontend/src/SqlLab/components/SaveQuery/index.tsx +++ b/superset-frontend/src/SqlLab/components/SaveQuery/index.tsx @@ -19,13 +19,9 @@ import { useState, useEffect, useMemo, ChangeEvent } from 'react'; import type { DatabaseObject } from 'src/features/databases/types'; -import { Row, Col } from 'src/components/Grid'; -import { Input } from 'src/components/Input'; import { t, styled } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Input, Button, Form, FormItem, Modal, Row, Col } from 'src/components'; import { Menu } from 'src/components/Menu'; -import { Form, FormItem } from 'src/components/Form'; -import Modal from 'src/components/Modal'; import SaveDatasetActionButton from 'src/SqlLab/components/SaveDatasetActionButton'; import { SaveDatasetModal, diff --git a/superset-frontend/src/SqlLab/components/ScheduleQueryButton/index.tsx b/superset-frontend/src/SqlLab/components/ScheduleQueryButton/index.tsx index d7bbf75755d..af42121ce0d 100644 --- a/superset-frontend/src/SqlLab/components/ScheduleQueryButton/index.tsx +++ b/superset-frontend/src/SqlLab/components/ScheduleQueryButton/index.tsx @@ -21,13 +21,10 @@ import { FunctionComponent, useState, useRef, ChangeEvent } from 'react'; import SchemaForm, { FormProps } from '@rjsf/core'; import { FormValidation } from '@rjsf/utils'; import validator from '@rjsf/validator-ajv8'; -import { Row, Col } from 'src/components/Grid'; -import { Input } from 'src/components/Input'; import { t, styled } from '@superset-ui/core'; import { parseDate } from 'chrono-node'; import ModalTrigger, { ModalTriggerRef } from 'src/components/ModalTrigger'; -import { Form, FormItem } from 'src/components/Form'; -import Button from 'src/components/Button'; +import { Input, Button, Form, FormItem, Row, Col } from 'src/components'; import getBootstrapData from 'src/utils/getBootstrapData'; const bootstrapData = getBootstrapData(); diff --git a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx index a6e26bc48d9..f57d8d338ff 100644 --- a/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx +++ b/superset-frontend/src/SqlLab/components/ShareSqlLabQuery/index.tsx @@ -22,10 +22,9 @@ import { SupersetClient, css, } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button, CopyToClipboard } from 'src/components'; import { Icons } from 'src/components/Icons'; import withToasts from 'src/components/MessageToasts/withToasts'; -import CopyToClipboard from 'src/components/CopyToClipboard'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; import { LOG_ACTIONS_SQLLAB_COPY_LINK } from 'src/logger/LogUtils'; import useLogAction from 'src/logger/useLogAction'; diff --git a/superset-frontend/src/SqlLab/components/SouthPane/Results.tsx b/superset-frontend/src/SqlLab/components/SouthPane/Results.tsx index 6a2a60831bf..83966349858 100644 --- a/superset-frontend/src/SqlLab/components/SouthPane/Results.tsx +++ b/superset-frontend/src/SqlLab/components/SouthPane/Results.tsx @@ -18,8 +18,7 @@ */ import { FC } from 'react'; import { shallowEqual, useSelector } from 'react-redux'; -import Alert from 'src/components/Alert'; -import { EmptyState } from 'src/components/EmptyState'; +import { Alert, EmptyState } from 'src/components'; import { FeatureFlag, styled, t, isFeatureEnabled } from '@superset-ui/core'; import { SqlLabRootState } from 'src/SqlLab/types'; diff --git a/superset-frontend/src/SqlLab/components/SouthPane/index.tsx b/superset-frontend/src/SqlLab/components/SouthPane/index.tsx index fb79b03e3b9..2a16997f0b1 100644 --- a/superset-frontend/src/SqlLab/components/SouthPane/index.tsx +++ b/superset-frontend/src/SqlLab/components/SouthPane/index.tsx @@ -24,7 +24,7 @@ import { css, styled, t, useTheme } from '@superset-ui/core'; import { removeTables, setActiveSouthPaneTab } from 'src/SqlLab/actions/sqlLab'; -import Label from 'src/components/Label'; +import { Label } from 'src/components'; import { Icons } from 'src/components/Icons'; import { SqlLabRootState } from 'src/SqlLab/types'; import QueryHistory from '../QueryHistory'; diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx index d285b5b28c0..893fd627b18 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx +++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.tsx @@ -51,15 +51,19 @@ import type { } from 'src/SqlLab/types'; import type { DatabaseObject } from 'src/features/databases/types'; import { debounce, throttle, isEmpty } from 'lodash'; -import Modal from 'src/components/Modal'; import Mousetrap from 'mousetrap'; -import Button from 'src/components/Button'; +import { + Input, + Button, + Alert, + Dropdown, + EmptyState, + Modal, +} from 'src/components'; import Timer from 'src/components/Timer'; import ResizableSidebar from 'src/components/ResizableSidebar'; -import { Dropdown } from 'src/components/Dropdown'; import Skeleton from 'src/components/Skeleton'; import { Switch } from 'src/components/Switch'; -import { Input } from 'src/components/Input'; import { Menu } from 'src/components/Menu'; import { Icons } from 'src/components/Icons'; import { detectOS } from 'src/utils/common'; @@ -101,8 +105,6 @@ import { LocalStorageKeys, setItem, } from 'src/utils/localStorageHelpers'; -import { EmptyState } from 'src/components/EmptyState'; -import Alert from 'src/components/Alert'; import getBootstrapData from 'src/utils/getBootstrapData'; import useLogAction from 'src/logger/useLogAction'; import { diff --git a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx index 897e5de4290..cf99746f204 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx +++ b/superset-frontend/src/SqlLab/components/SqlEditorLeftBar/index.tsx @@ -33,12 +33,10 @@ import { addDangerToast, resetState, } from 'src/SqlLab/actions/sqlLab'; -import Button from 'src/components/Button'; +import { Button, EmptyState, type DatabaseObject } from 'src/components'; import { t, styled, css } from '@superset-ui/core'; import { TableSelectorMultiple } from 'src/components/TableSelector'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; -import type { DatabaseObject } from 'src/components/DatabaseSelector'; -import { EmptyState } from 'src/components/EmptyState'; import { getItem, LocalStorageKeys, diff --git a/superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx b/superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx index e9311e7b4a2..e6aa9291c0a 100644 --- a/superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx +++ b/superset-frontend/src/SqlLab/components/SqlEditorTabHeader/index.tsx @@ -20,7 +20,7 @@ import { useMemo, FC } from 'react'; import { bindActionCreators } from 'redux'; import { useSelector, useDispatch, shallowEqual } from 'react-redux'; -import { MenuDotsDropdown } from 'src/components/Dropdown'; +import { MenuDotsDropdown } from 'src/components'; import { Menu } from 'src/components/Menu'; import { styled, @@ -38,7 +38,8 @@ import { toggleLeftBar, } from 'src/SqlLab/actions/sqlLab'; import { QueryEditor, SqlLabRootState } from 'src/SqlLab/types'; -import { Icons, IconType } from 'src/components/Icons'; +import { Icons } from 'src/components/Icons'; +import type { IconType } from 'src/components/Icons/types'; const TabTitleWrapper = styled.div` display: flex; diff --git a/superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx b/superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx index be59e3003df..4105fc68f27 100644 --- a/superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx +++ b/superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.tsx @@ -30,10 +30,9 @@ import { css, } from '@superset-ui/core'; import { Logger } from 'src/logger/LogUtils'; -import { Tooltip } from 'src/components/Tooltip'; +import { EmptyState, Tooltip } from 'src/components'; import { detectOS } from 'src/utils/common'; import * as Actions from 'src/SqlLab/actions/sqlLab'; -import { EmptyState } from 'src/components/EmptyState'; import getBootstrapData from 'src/utils/getBootstrapData'; import { locationContext } from 'src/pages/SqlLab/LocationContext'; import { Icons } from 'src/components/Icons'; diff --git a/superset-frontend/src/SqlLab/components/TableElement/TableElement.test.tsx b/superset-frontend/src/SqlLab/components/TableElement/TableElement.test.tsx index 94fedeae9b6..1e34738cf67 100644 --- a/superset-frontend/src/SqlLab/components/TableElement/TableElement.test.tsx +++ b/superset-frontend/src/SqlLab/components/TableElement/TableElement.test.tsx @@ -30,9 +30,9 @@ jest.mock('@superset-ui/core', () => ({ const mockedIsFeatureEnabled = isFeatureEnabled as jest.Mock; -jest.mock('src/components/Loading', () => () => ( -
-)); +jest.mock('src/components/Loading', () => ({ + Loading: () =>
, +})); jest.mock('src/components/IconTooltip', () => ({ IconTooltip: ({ onClick, diff --git a/superset-frontend/src/SqlLab/components/TableElement/index.tsx b/superset-frontend/src/SqlLab/components/TableElement/index.tsx index b9a80a8bbd4..78637bb3639 100644 --- a/superset-frontend/src/SqlLab/components/TableElement/index.tsx +++ b/superset-frontend/src/SqlLab/components/TableElement/index.tsx @@ -21,9 +21,17 @@ import { useState, useRef, useEffect } from 'react'; import { useDispatch } from 'react-redux'; import type { Table } from 'src/SqlLab/types'; -import Collapse, { CollapseProps } from 'src/components/Collapse'; -import Card from 'src/components/Card'; -import ButtonGroup from 'src/components/ButtonGroup'; +import { + ButtonGroup, + Card, + Collapse, + Tooltip, + CopyToClipboard, + Flex, + IconTooltip, + Loading, + type CollapseProps, +} from 'src/components'; import { t, styled, useTheme } from '@superset-ui/core'; import { debounce } from 'lodash'; @@ -38,15 +46,10 @@ import { useTableExtendedMetadataQuery, useTableMetadataQuery, } from 'src/hooks/apiResources'; -import { Tooltip } from 'src/components/Tooltip'; -import CopyToClipboard from 'src/components/CopyToClipboard'; -import { IconTooltip } from 'src/components/IconTooltip'; import ModalTrigger from 'src/components/ModalTrigger'; -import Loading from 'src/components/Loading'; import useEffectEvent from 'src/hooks/useEffectEvent'; import { ActionType } from 'src/types/Action'; import { Icons } from 'src/components/Icons'; -import { Flex } from 'src/components/Flex'; import { Space } from 'src/components/Space'; import ColumnElement, { ColumnKeyTypeType } from '../ColumnElement'; import ShowSQL from '../ShowSQL'; diff --git a/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx b/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx index b4962c89e60..5c92308d36f 100644 --- a/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx +++ b/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx @@ -27,19 +27,18 @@ import { } from 'spec/helpers/testing-library'; import TablePreview from '.'; -jest.mock( - 'src/components/FilterableTable', - () => - ({ data }: { data: Record[] }) => ( -
- {data.map((record, i) => ( -
- {JSON.stringify(record)} -
- ))} -
- ), -); +jest.mock('src/components/FilterableTable', () => ({ + __esModule: true, + FilterableTable: ({ data }: { data: Record[] }) => ( +
+ {data.map((record, i) => ( +
+ {JSON.stringify(record)} +
+ ))} +
+ ), +})); jest.mock( 'react-virtualized-auto-sizer', () => diff --git a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx index fc616ca818e..eae105f3ca8 100644 --- a/superset-frontend/src/SqlLab/components/TablePreview/index.tsx +++ b/superset-frontend/src/SqlLab/components/TablePreview/index.tsx @@ -32,11 +32,16 @@ import { import AutoSizer from 'react-virtualized-auto-sizer'; import { Icons } from 'src/components/Icons'; import type { SqlLabRootState } from 'src/SqlLab/types'; -import { Breadcrumb } from 'src/components/Breadcrumb'; -import Button from 'src/components/Button'; +import { + Alert, + Breadcrumb, + Button, + Card, + CopyToClipboard, + Dropdown, + FilterableTable, +} from 'src/components'; import Skeleton from 'src/components/Skeleton'; -import { Dropdown } from 'src/components/Dropdown'; -import FilterableTable from 'src/components/FilterableTable'; import Tabs from 'src/components/Tabs'; import { tableApiUtil, @@ -45,10 +50,7 @@ import { useTableMetadataQuery, } from 'src/hooks/apiResources'; import { runTablePreviewQuery } from 'src/SqlLab/actions/sqlLab'; -import Alert from 'src/components/Alert'; import { Menu } from 'src/components/Menu'; -import Card from 'src/components/Card'; -import CopyToClipboard from 'src/components/CopyToClipboard'; import ResultSet from '../ResultSet'; import ShowSQL from '../ShowSQL'; diff --git a/superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx b/superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx index 87d1f07a201..8079c8e417d 100644 --- a/superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx +++ b/superset-frontend/src/SqlLab/components/TemplateParamsEditor/index.tsx @@ -21,11 +21,9 @@ import { t, styled } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { debounce } from 'lodash'; -import Badge from 'src/components/Badge'; +import { Badge, ConfigEditor, Tooltip } from 'src/components'; import ModalTrigger from 'src/components/ModalTrigger'; -import { ConfigEditor } from 'src/components/AsyncAceEditor'; import { FAST_DEBOUNCE } from 'src/constants'; -import { Tooltip } from 'src/components/Tooltip'; import useQueryEditor from 'src/SqlLab/hooks/useQueryEditor'; const StyledConfigEditor = styled(ConfigEditor)` diff --git a/superset-frontend/src/SqlLab/constants.ts b/superset-frontend/src/SqlLab/constants.ts index 0b6118f1127..07d9dbaae88 100644 --- a/superset-frontend/src/SqlLab/constants.ts +++ b/superset-frontend/src/SqlLab/constants.ts @@ -17,9 +17,9 @@ * under the License. */ import { t } from '@superset-ui/core'; -import type { Type } from 'src/components/Label'; +import type { LabelType } from 'src/components'; -export const STATE_TYPE_MAP: Record = { +export const STATE_TYPE_MAP: Record = { offline: 'error', failed: 'error', pending: 'info', diff --git a/superset-frontend/src/SqlLab/types.ts b/superset-frontend/src/SqlLab/types.ts index 3cff1d7eb28..6438db4e562 100644 --- a/superset-frontend/src/SqlLab/types.ts +++ b/superset-frontend/src/SqlLab/types.ts @@ -22,8 +22,7 @@ import { UserWithPermissionsAndRoles, } from 'src/types/bootstrapTypes'; import { ToastType } from 'src/components/MessageToasts/types'; -import { DropdownButtonProps } from 'src/components/DropdownButton'; -import { ButtonProps } from 'src/components/Button'; +import type { ButtonProps, DropdownButtonProps } from 'src/components'; import type { TableMetaData } from 'src/hooks/apiResources'; export type QueryButtonProps = DropdownButtonProps | ButtonProps; diff --git a/superset-frontend/src/components/Alert/Alert.stories.tsx b/superset-frontend/src/components/Alert/Alert.stories.tsx index a57b12ab228..97241e10580 100644 --- a/superset-frontend/src/components/Alert/Alert.stories.tsx +++ b/superset-frontend/src/components/Alert/Alert.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import Alert, { AlertProps } from './index'; +import { Alert } from '.'; +import type { AlertProps } from './types'; type AlertType = Required>; type AlertTypeValue = AlertType['type']; diff --git a/superset-frontend/src/components/Alert/index.tsx b/superset-frontend/src/components/Alert/index.tsx index bcea9467e7f..c3eb4dd343b 100644 --- a/superset-frontend/src/components/Alert/index.tsx +++ b/superset-frontend/src/components/Alert/index.tsx @@ -16,15 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import { PropsWithChildren } from 'react'; import { Alert as AntdAlert } from 'antd-v5'; -import { AlertProps as AntdAlertProps } from 'antd-v5/es/alert'; +import type { AlertProps } from './types'; -export type AlertProps = PropsWithChildren< - Omit & { roomBelow?: boolean } ->; - -export default function Alert(props: AlertProps) { +export const Alert = (props: AlertProps) => { const { type = 'info', description, @@ -46,4 +41,6 @@ export default function Alert(props: AlertProps) { {...rest} /> ); -} +}; + +export type { AlertProps }; diff --git a/superset-frontend/src/components/Checkbox/Checkbox.tsx b/superset-frontend/src/components/Alert/types.ts similarity index 72% rename from superset-frontend/src/components/Checkbox/Checkbox.tsx rename to superset-frontend/src/components/Alert/types.ts index 7d3e49ded15..dcae40eb874 100644 --- a/superset-frontend/src/components/Checkbox/Checkbox.tsx +++ b/superset-frontend/src/components/Alert/types.ts @@ -16,12 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { Checkbox as AntCheckbox } from 'antd-v5'; -import type { - CheckboxProps as AntCheckboxProps, - CheckboxChangeEvent as AntCheckboxChangeEvent, -} from 'antd-v5/es/checkbox'; +import type { PropsWithChildren } from 'react'; +import type { AlertProps as AntdAlertProps } from 'antd-v5/es/alert'; -export type CheckboxProps = AntCheckboxProps; -export type CheckboxChangeEvent = AntCheckboxChangeEvent; -export default AntCheckbox; +export type AlertProps = PropsWithChildren< + Omit & { roomBelow?: boolean } +>; diff --git a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.stories.tsx b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.stories.tsx index 3a27a0b7510..71a64885096 100644 --- a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.stories.tsx +++ b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.stories.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import AlteredSliceTag from '.'; +import { AlteredSliceTag } from '.'; import { defaultProps } from './AlteredSliceTagMocks'; export default { diff --git a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx index bd35db103b3..267b50291ca 100644 --- a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx +++ b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTag.test.jsx @@ -17,11 +17,12 @@ * under the License. */ import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import AlteredSliceTag, { +import { + AlteredSliceTag, alterForComparison, formatValueHandler, isEqualish, -} from 'src/components/AlteredSliceTag'; +} from '.'; import { defaultProps } from './AlteredSliceTagMocks'; const controlsMap = { diff --git a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts index 6428b503b85..c307eace575 100644 --- a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts +++ b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts @@ -18,7 +18,7 @@ */ import { QueryFormData } from '@superset-ui/core'; import { ControlPanelConfig } from '@superset-ui/chart-controls'; -import { DiffType, RowType } from './index'; +import type { DiffType, RowType } from './types'; export const defaultProps: Record> = { origFormData: { diff --git a/superset-frontend/src/components/AlteredSliceTag/index.tsx b/superset-frontend/src/components/AlteredSliceTag/index.tsx index fafaddc5c07..be63b84eddb 100644 --- a/superset-frontend/src/components/AlteredSliceTag/index.tsx +++ b/superset-frontend/src/components/AlteredSliceTag/index.tsx @@ -19,56 +19,23 @@ import { useCallback, useEffect, useMemo, useState, FC } from 'react'; import { isEqual, isEmpty } from 'lodash'; -import { QueryFormData, t } from '@superset-ui/core'; +import { t } from '@superset-ui/core'; import { sanitizeFormData } from 'src/explore/exploreUtils/formData'; import getControlsForVizType from 'src/utils/getControlsForVizType'; -import Label from 'src/components/Label'; -import { Icons } from 'src/components/Icons'; import { safeStringify } from 'src/utils/safeStringify'; -import { Tooltip } from 'src/components/Tooltip'; +import { Icons } from 'src/components/Icons'; +import { Label } from '../Label'; +import { Tooltip } from '../Tooltip'; import ModalTrigger from '../ModalTrigger'; import TableView from '../TableView'; - -interface AlteredSliceTagProps { - origFormData: QueryFormData; - currentFormData: QueryFormData; -} - -export interface ControlMap { - [key: string]: { - label?: string; - type?: string; - }; -} - -type FilterItemType = { - comparator?: string | string[]; - subject: string; - operator: string; - label?: string; -}; - -export type DiffItemType< - T = FilterItemType | number | string | Record, -> = - | T[] - | boolean - | number - | string - | Record - | null - | undefined; - -export type DiffType = { - before: DiffItemType; - after: DiffItemType; -}; - -export type RowType = { - before: string | number; - after: string | number; - control: string; -}; +import type { + AlteredSliceTagProps, + ControlMap, + DiffItemType, + DiffType, + FilterItemType, + RowType, +} from './types'; export const alterForComparison = ( value?: string | null | [], @@ -151,7 +118,7 @@ export const getRowsFromDiffs = ( export const isEqualish = (val1: string, val2: string): boolean => isEqual(alterForComparison(val1), alterForComparison(val2)); -const AlteredSliceTag: FC = props => { +export const AlteredSliceTag: FC = props => { const [rows, setRows] = useState([]); const [hasDiffs, setHasDiffs] = useState(false); @@ -248,4 +215,4 @@ const AlteredSliceTag: FC = props => { ); }; -export default AlteredSliceTag; +export type { AlteredSliceTagProps }; diff --git a/superset-frontend/src/components/FormRow/FormRow.stories.tsx b/superset-frontend/src/components/AlteredSliceTag/types.ts similarity index 51% rename from superset-frontend/src/components/FormRow/FormRow.stories.tsx rename to superset-frontend/src/components/AlteredSliceTag/types.ts index babe6aee119..e1f61086088 100644 --- a/superset-frontend/src/components/FormRow/FormRow.stories.tsx +++ b/superset-frontend/src/components/AlteredSliceTag/types.ts @@ -16,39 +16,45 @@ * specific language governing permissions and limitations * under the License. */ -import TextControl from 'src/explore/components/controls/TextControl'; -import CheckboxControl from 'src/explore/components/controls/CheckboxControl'; -import FormRow from '.'; +import type { QueryFormData } from '@superset-ui/core'; -export default { - title: 'Components/FormRow', +export interface AlteredSliceTagProps { + origFormData: QueryFormData; + currentFormData: QueryFormData; +} + +export interface ControlMap { + [key: string]: { + label?: string; + type?: string; + }; +} + +export type FilterItemType = { + comparator?: string | string[]; + subject: string; + operator: string; + label?: string; }; -export const InteractiveFormRow = ({ isCheckbox, ...rest }: any) => { - const control = isCheckbox ? ( - - ) : ( - - ); - return ( -
- -
- ); +export type DiffItemType< + T = FilterItemType | number | string | Record, +> = + | T[] + | boolean + | number + | string + | Record + | null + | undefined; + +export type DiffType = { + before: DiffItemType; + after: DiffItemType; }; -InteractiveFormRow.args = { - label: 'Label', - tooltip: 'Tooltip', - control: , - isCheckbox: false, -}; - -InteractiveFormRow.argTypes = { - control: { - defaultValue: , - table: { - disable: true, - }, - }, +export type RowType = { + before: string | number; + after: string | number; + control: string; }; diff --git a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.stories.tsx b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.stories.tsx index dbeac65054d..5f6b7679f11 100644 --- a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.stories.tsx +++ b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.stories.tsx @@ -24,9 +24,10 @@ import { CssEditor, JsonEditor, ConfigEditor, - AsyncAceEditorOptions, } from '.'; +import type { AsyncAceEditorOptions } from './types'; + type EditorType = | 'sql' | 'full-sql' diff --git a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx index 6e377f889fd..b0170a36e7c 100644 --- a/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx +++ b/superset-frontend/src/components/AsyncAceEditor/AsyncAceEditor.test.tsx @@ -17,7 +17,8 @@ * under the License. */ import { render, screen, waitFor } from 'spec/helpers/testing-library'; -import AsyncAceEditor, { +import { + AsyncAceEditor, SQLEditor, FullSQLEditor, MarkdownEditor, @@ -25,9 +26,9 @@ import AsyncAceEditor, { CssEditor, JsonEditor, ConfigEditor, - AceModule, - AsyncAceEditorOptions, -} from 'src/components/AsyncAceEditor'; +} from '.'; + +import type { AceModule, AsyncAceEditorOptions } from './types'; const selector = '[id="ace-editor"]'; diff --git a/superset-frontend/src/components/AsyncAceEditor/Tooltip.tsx b/superset-frontend/src/components/AsyncAceEditor/Tooltip.tsx index 13d48390fbb..e6f9d0dc8db 100644 --- a/superset-frontend/src/components/AsyncAceEditor/Tooltip.tsx +++ b/superset-frontend/src/components/AsyncAceEditor/Tooltip.tsx @@ -17,7 +17,7 @@ * under the License. */ import { renderToStaticMarkup } from 'react-dom/server'; -import { Tag } from 'src/components/Tag'; +import { Tag } from '../Tag'; type Props = { title: string; diff --git a/superset-frontend/src/components/AsyncAceEditor/index.tsx b/superset-frontend/src/components/AsyncAceEditor/index.tsx index e40aa0d0077..6a86b1f94a4 100644 --- a/superset-frontend/src/components/AsyncAceEditor/index.tsx +++ b/superset-frontend/src/components/AsyncAceEditor/index.tsx @@ -16,58 +16,49 @@ * specific language governing permissions and limitations * under the License. */ -import { forwardRef, useEffect, ComponentType } from 'react'; +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { forwardRef, useEffect } from 'react'; -import type { - Editor as OrigEditor, - IEditSession, - Position, - TextMode as OrigTextMode, -} from 'brace'; +import type { IEditSession, Position } from 'brace'; import type AceEditor from 'react-ace'; -import type { IAceEditorProps } from 'react-ace'; -import AsyncEsmComponent, { - PlaceholderProps, -} from 'src/components/AsyncEsmComponent'; import useEffectEvent from 'src/hooks/useEffectEvent'; import { useTheme, css } from '@superset-ui/core'; import { Global } from '@emotion/react'; +import { AsyncEsmComponent } from '../AsyncEsmComponent'; +import type { + AceCompleterKeyword, + AceModule, + AsyncAceEditorOptions, + AsyncAceEditorProps, + TextMode, + Editor, +} from './types'; export { getTooltipHTML } from './Tooltip'; -export interface AceCompleterKeywordData { - name: string; - value: string; - score: number; - meta: string; - docText?: string; - docHTML?: string; -} - -export type TextMode = OrigTextMode & { $id: string }; - -export interface AceCompleter { - insertMatch: ( - data?: Editor | { value: string } | string, - options?: AceCompleterKeywordData, - ) => void; -} - -export type Editor = OrigEditor & { - completer: AceCompleter; - completers: AceCompleter[]; -}; - -export interface AceCompleterKeyword extends AceCompleterKeywordData { - completer?: AceCompleter; -} - /** * Async loaders to import brace modules. Must manually create call `import(...)` * promises because webpack can only analyze async imports statically. */ -const aceModuleLoaders = { +export const aceModuleLoaders = { 'mode/sql': () => import('brace/mode/sql'), 'mode/markdown': () => import('brace/mode/markdown'), 'mode/css': () => import('brace/mode/css'), @@ -81,28 +72,10 @@ const aceModuleLoaders = { 'ext/searchbox': () => import('brace/ext/searchbox'), }; -export type AceModule = keyof typeof aceModuleLoaders; - -export type AsyncAceEditorProps = IAceEditorProps & { - keywords?: AceCompleterKeyword[]; -}; - -export type AceEditorMode = 'sql'; -export type AceEditorTheme = 'textmate' | 'github'; -export type AsyncAceEditorOptions = { - defaultMode?: AceEditorMode; - defaultTheme?: AceEditorTheme; - defaultTabSize?: number; - fontFamily?: string; - placeholder?: ComponentType< - PlaceholderProps & Partial - > | null; -}; - /** * Get an async AceEditor with automatical loading of specified ace modules. */ -export default function AsyncAceEditor( +export function AsyncAceEditor( aceModules: AceModule[], { defaultMode, @@ -408,3 +381,5 @@ export const ConfigEditor = AsyncAceEditor([ 'mode/yaml', 'theme/github', ]); + +export type { AsyncAceEditorProps, Editor }; diff --git a/superset-frontend/src/components/AsyncAceEditor/types.ts b/superset-frontend/src/components/AsyncAceEditor/types.ts new file mode 100644 index 00000000000..17a4210b2ba --- /dev/null +++ b/superset-frontend/src/components/AsyncAceEditor/types.ts @@ -0,0 +1,68 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { Editor as OrigEditor, TextMode as OrigTextMode } from 'brace'; +import type { ComponentType } from 'react'; +import type { IAceEditorProps } from 'react-ace'; +import type { PlaceholderProps } from '../AsyncEsmComponent/types'; +import { aceModuleLoaders } from '.'; + +export interface AceCompleterKeywordData { + name: string; + value: string; + score: number; + meta: string; + docText?: string; + docHTML?: string; +} + +export type TextMode = OrigTextMode & { $id: string }; + +export interface AceCompleter { + insertMatch: ( + data?: Editor | { value: string } | string, + options?: AceCompleterKeywordData, + ) => void; +} + +export type Editor = OrigEditor & { + completer: AceCompleter; + completers: AceCompleter[]; +}; + +export interface AceCompleterKeyword extends AceCompleterKeywordData { + completer?: AceCompleter; +} + +export type AceModule = keyof typeof aceModuleLoaders; + +export type AsyncAceEditorProps = IAceEditorProps & { + keywords?: AceCompleterKeyword[]; +}; + +export type AceEditorMode = 'sql'; +export type AceEditorTheme = 'textmate' | 'github'; +export type AsyncAceEditorOptions = { + defaultMode?: AceEditorMode; + defaultTheme?: AceEditorTheme; + defaultTabSize?: number; + fontFamily?: string; + placeholder?: ComponentType< + PlaceholderProps & Partial + > | null; +}; diff --git a/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.stories.tsx b/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.stories.tsx index de0df2d408e..0c786141e06 100644 --- a/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.stories.tsx +++ b/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import AsyncEsmComponent, { PlaceholderProps } from '.'; +import { AsyncEsmComponent } from '.'; +import type { PlaceholderProps } from './types'; export default { title: 'Components/AsyncEsmComponent', diff --git a/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.test.tsx b/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.test.tsx index 9e23acf5d64..8c16c800ecc 100644 --- a/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.test.tsx +++ b/superset-frontend/src/components/AsyncEsmComponent/AsyncEsmComponent.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, screen } from 'spec/helpers/testing-library'; -import AsyncEsmComponent from 'src/components/AsyncEsmComponent'; +import { AsyncEsmComponent } from '.'; const Placeholder = () => Loading...; diff --git a/superset-frontend/src/components/AsyncEsmComponent/index.tsx b/superset-frontend/src/components/AsyncEsmComponent/index.tsx index 220c513f4de..dd643a8e1a6 100644 --- a/superset-frontend/src/components/AsyncEsmComponent/index.tsx +++ b/superset-frontend/src/components/AsyncEsmComponent/index.tsx @@ -17,7 +17,6 @@ * under the License. */ import { - CSSProperties, useEffect, useState, RefObject, @@ -28,16 +27,8 @@ import { RefAttributes, } from 'react'; -import Loading from '../Loading'; - -export type PlaceholderProps = { - showLoadingForImport?: boolean; - width?: string | number; - height?: string | number; - placeholderStyle?: CSSProperties; -} & { - [key: string]: any; -}; +import { Loading } from '../Loading'; +import type { PlaceholderProps } from './types'; function DefaultPlaceholder({ width, @@ -62,7 +53,7 @@ function DefaultPlaceholder({ * Asynchronously import an ES module as a React component, render a placeholder * first (if provided) and re-render once import is complete. */ -export default function AsyncEsmComponent< +export function AsyncEsmComponent< P = PlaceholderProps, M = ComponentType

| { default: ComponentType

}, >( @@ -139,3 +130,5 @@ export default function AsyncEsmComponent< preload: typeof waitForPromise; }; } + +export type { PlaceholderProps }; diff --git a/superset-frontend/src/components/AsyncEsmComponent/types.ts b/superset-frontend/src/components/AsyncEsmComponent/types.ts new file mode 100644 index 00000000000..d00bdaa7c5e --- /dev/null +++ b/superset-frontend/src/components/AsyncEsmComponent/types.ts @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { CSSProperties } from 'react'; + +export type PlaceholderProps = { + showLoadingForImport?: boolean; + width?: string | number; + height?: string | number; + placeholderStyle?: CSSProperties; +} & { + [key: string]: any; +}; diff --git a/superset-frontend/src/components/AuditInfo/index.tsx b/superset-frontend/src/components/AuditInfo/index.tsx index ae594fa7d8c..75aaa5d3936 100644 --- a/superset-frontend/src/components/AuditInfo/index.tsx +++ b/superset-frontend/src/components/AuditInfo/index.tsx @@ -16,15 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import Owner from 'src/types/Owner'; -import { Tooltip } from 'src/components/Tooltip'; import getOwnerName from 'src/utils/getOwnerName'; import { t } from '@superset-ui/core'; - -export type ModifiedInfoProps = { - user?: Owner; - date: string; -}; +import { Tooltip } from '../Tooltip'; +import type { ModifiedInfoProps } from './types'; export const ModifiedInfo = ({ user, date }: ModifiedInfoProps) => { const dateSpan = ( @@ -44,3 +39,5 @@ export const ModifiedInfo = ({ user, date }: ModifiedInfoProps) => { } return dateSpan; }; + +export type { ModifiedInfoProps }; diff --git a/superset-frontend/src/components/AuditInfo/types.ts b/superset-frontend/src/components/AuditInfo/types.ts new file mode 100644 index 00000000000..06166b78375 --- /dev/null +++ b/superset-frontend/src/components/AuditInfo/types.ts @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type Owner from 'src/types/Owner'; + +export type ModifiedInfoProps = { + user?: Owner; + date: string; +}; diff --git a/superset-frontend/src/components/AutoComplete/AutoComplete.stories.tsx b/superset-frontend/src/components/AutoComplete/AutoComplete.stories.tsx index c105515e887..84c125645f4 100644 --- a/superset-frontend/src/components/AutoComplete/AutoComplete.stories.tsx +++ b/superset-frontend/src/components/AutoComplete/AutoComplete.stories.tsx @@ -17,10 +17,9 @@ * under the License. */ import { useState } from 'react'; -import { Meta, StoryObj } from '@storybook/react'; -import AutoComplete, { - AntAutoCompleteProps, -} from 'src/components/AutoComplete'; +import type { Meta, StoryObj } from '@storybook/react'; +import { AutoComplete } from '.'; +import type { AutoCompleteProps } from './types'; export default { title: 'Components/AutoComplete', @@ -244,8 +243,8 @@ const searchResult = (query: string) => }; }); -const AutoCompleteWithOptions = (args: AntAutoCompleteProps) => { - const [options, setOptions] = useState([]); +const AutoCompleteWithOptions = (args: AutoCompleteProps) => { + const [options, setOptions] = useState([]); const handleSearch = (value: string) => { setOptions(value ? searchResult(value) : []); @@ -260,7 +259,7 @@ export const AutoCompleteStory: Story = { style: { width: 300 }, placeholder: 'Type to search...', }, - render: (args: AntAutoCompleteProps) => ( + render: (args: AutoCompleteProps) => (

diff --git a/superset-frontend/src/components/AutoComplete/AutoComplete.test.tsx b/superset-frontend/src/components/AutoComplete/AutoComplete.test.tsx index d869fd08885..93bdb3c6285 100644 --- a/superset-frontend/src/components/AutoComplete/AutoComplete.test.tsx +++ b/superset-frontend/src/components/AutoComplete/AutoComplete.test.tsx @@ -23,7 +23,8 @@ import { userEvent, waitFor, } from 'spec/helpers/testing-library'; -import { AutoComplete, Input } from 'antd'; +import { Input } from '../Input'; +import { AutoComplete } from '.'; const searchResult = (query: string): Array<{ value: string; label: string }> => Array.from({ length: 3 }).map((_, idx) => ({ diff --git a/superset-frontend/src/components/AutoComplete/index.tsx b/superset-frontend/src/components/AutoComplete/index.tsx index 67c121b5c4f..0e34ab861d0 100644 --- a/superset-frontend/src/components/AutoComplete/index.tsx +++ b/superset-frontend/src/components/AutoComplete/index.tsx @@ -16,10 +16,5 @@ * specific language governing permissions and limitations * under the License. */ - -import { AutoComplete } from 'antd-v5'; -import { AutoCompleteProps as AntAutoCompleteProps } from 'antd-v5/es/auto-complete'; - -export type { AntAutoCompleteProps }; - -export default AutoComplete; +export { AutoComplete } from 'antd-v5'; +export type { AutoCompleteProps } from './types'; diff --git a/superset-frontend/src/components/AutoComplete/types.ts b/superset-frontend/src/components/AutoComplete/types.ts new file mode 100644 index 00000000000..e282cdcdb3e --- /dev/null +++ b/superset-frontend/src/components/AutoComplete/types.ts @@ -0,0 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type { AutoCompleteProps } from 'antd-v5/es/auto-complete'; diff --git a/superset-frontend/src/components/Avatar/Avatar.stories.tsx b/superset-frontend/src/components/Avatar/Avatar.stories.tsx index f2ba4a5c241..5122cd8b51a 100644 --- a/superset-frontend/src/components/Avatar/Avatar.stories.tsx +++ b/superset-frontend/src/components/Avatar/Avatar.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { Avatar, AvatarProps } from '.'; +import { Avatar } from '.'; +import type { AvatarProps } from './types'; export default { title: 'Components/Avatar', diff --git a/superset-frontend/src/components/Avatar/Avatar.test.tsx b/superset-frontend/src/components/Avatar/Avatar.test.tsx index 91cf1ef5e79..91fbe60d947 100644 --- a/superset-frontend/src/components/Avatar/Avatar.test.tsx +++ b/superset-frontend/src/components/Avatar/Avatar.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render } from 'spec/helpers/testing-library'; -import { Avatar } from 'src/components/Avatar'; +import { Avatar } from '.'; test('renders with default props', async () => { const { container } = render(); diff --git a/superset-frontend/src/components/Avatar/index.tsx b/superset-frontend/src/components/Avatar/index.tsx index 94eb01404ae..d499c9ae2f5 100644 --- a/superset-frontend/src/components/Avatar/index.tsx +++ b/superset-frontend/src/components/Avatar/index.tsx @@ -18,14 +18,14 @@ */ import { Avatar as AntdAvatar } from 'antd-v5'; -import { AvatarProps, GroupProps } from 'antd-v5/es/avatar'; +import type { AvatarProps, GroupProps as AvatarGroupProps } from './types'; export function Avatar(props: AvatarProps) { return ; } -export function AvatarGroup(props: GroupProps) { +export function AvatarGroup(props: AvatarGroupProps) { return ; } -export type { AvatarProps, GroupProps }; +export type { AvatarProps, AvatarGroupProps }; diff --git a/superset-frontend/src/components/Avatar/types.ts b/superset-frontend/src/components/Avatar/types.ts new file mode 100644 index 00000000000..d208e704438 --- /dev/null +++ b/superset-frontend/src/components/Avatar/types.ts @@ -0,0 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { AvatarProps, GroupProps } from 'antd-v5/es/avatar'; + +export type { AvatarProps, GroupProps }; diff --git a/superset-frontend/src/components/Badge/Badge.stories.tsx b/superset-frontend/src/components/Badge/Badge.stories.tsx index 48f25829600..9a5ff53d737 100644 --- a/superset-frontend/src/components/Badge/Badge.stories.tsx +++ b/superset-frontend/src/components/Badge/Badge.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import Badge, { BadgeProps } from '.'; +import { Badge } from '.'; +import type { BadgeProps } from './types'; export default { title: 'Components/Badge', diff --git a/superset-frontend/src/components/Badge/Badge.test.tsx b/superset-frontend/src/components/Badge/Badge.test.tsx index cbf9bcf80eb..8f666349c7c 100644 --- a/superset-frontend/src/components/Badge/Badge.test.tsx +++ b/superset-frontend/src/components/Badge/Badge.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, screen } from 'spec/helpers/testing-library'; -import Badge from '.'; +import { Badge } from '.'; const mockedProps = { count: 9, diff --git a/superset-frontend/src/components/Badge/index.tsx b/superset-frontend/src/components/Badge/index.tsx index 0930e3631d9..693412747ee 100644 --- a/superset-frontend/src/components/Badge/index.tsx +++ b/superset-frontend/src/components/Badge/index.tsx @@ -18,11 +18,9 @@ */ import { styled } from '@superset-ui/core'; import { Badge as AntdBadge } from 'antd-v5'; -import { BadgeProps as AntdBadgeProps } from 'antd-v5/es/badge'; +import type { BadgeProps } from './types'; -export type { AntdBadgeProps as BadgeProps }; - -const Badge = styled((props: AntdBadgeProps) => )` +export const Badge = styled((props: BadgeProps) => )` ${({ theme, color, count }) => ` & > sup, & > sup.antd5-badge-count { @@ -33,4 +31,4 @@ const Badge = styled((props: AntdBadgeProps) => )` `} `; -export default Badge; +export type { BadgeProps }; diff --git a/superset-frontend/src/components/Badge/types.ts b/superset-frontend/src/components/Badge/types.ts new file mode 100644 index 00000000000..bf4c0228d42 --- /dev/null +++ b/superset-frontend/src/components/Badge/types.ts @@ -0,0 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { BadgeProps } from 'antd-v5/es/badge'; + +export type { BadgeProps }; diff --git a/superset-frontend/src/components/Breadcrumb/index.tsx b/superset-frontend/src/components/Breadcrumb/index.tsx index 8f761f6330e..1b5dd15df9a 100644 --- a/superset-frontend/src/components/Breadcrumb/index.tsx +++ b/superset-frontend/src/components/Breadcrumb/index.tsx @@ -16,6 +16,5 @@ * specific language governing permissions and limitations * under the License. */ -import { Breadcrumb as AntdBreadcrumb } from 'antd-v5'; - -export const Breadcrumb = AntdBreadcrumb; +export { Breadcrumb } from 'antd-v5'; +export type { BreadcrumbProps } from './types'; diff --git a/superset-frontend/src/components/CronPicker/index.ts b/superset-frontend/src/components/Breadcrumb/types.ts similarity index 92% rename from superset-frontend/src/components/CronPicker/index.ts rename to superset-frontend/src/components/Breadcrumb/types.ts index 17838fbb2d6..fe8bd1e3baa 100644 --- a/superset-frontend/src/components/CronPicker/index.ts +++ b/superset-frontend/src/components/Breadcrumb/types.ts @@ -16,5 +16,4 @@ * specific language governing permissions and limitations * under the License. */ - -export * from './CronPicker'; +export type { BreadcrumbProps } from 'antd-v5/es/breadcrumb'; diff --git a/superset-frontend/src/components/Button/Button.stories.tsx b/superset-frontend/src/components/Button/Button.stories.tsx index 84d10ad8ab5..4f3b7275cca 100644 --- a/superset-frontend/src/components/Button/Button.stories.tsx +++ b/superset-frontend/src/components/Button/Button.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import Button, { ButtonProps } from './index'; +import { Button } from '.'; +import type { ButtonProps } from './types'; type ButtonStyle = Pick; type ButtonStyleValue = ButtonStyle[keyof ButtonStyle]; diff --git a/superset-frontend/src/components/Button/Button.test.tsx b/superset-frontend/src/components/Button/Button.test.tsx index bbb72e5d454..25c41faf2d8 100644 --- a/superset-frontend/src/components/Button/Button.test.tsx +++ b/superset-frontend/src/components/Button/Button.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { fireEvent, render } from 'spec/helpers/testing-library'; -import Button from '.'; +import { Button } from '.'; import { ButtonGallery, SIZES as buttonSizes, diff --git a/superset-frontend/src/components/Button/index.tsx b/superset-frontend/src/components/Button/index.tsx index 1ee748fcb3e..4d0a0f96ab0 100644 --- a/superset-frontend/src/components/Button/index.tsx +++ b/superset-frontend/src/components/Button/index.tsx @@ -16,48 +16,22 @@ * specific language governing permissions and limitations * under the License. */ -import { - Children, - ReactElement, - ReactNode, - Fragment, - MouseEventHandler, -} from 'react'; +import { Children, ReactElement, Fragment } from 'react'; import cx from 'classnames'; import { Button as AntdButton } from 'antd-v5'; import { useTheme } from '@superset-ui/core'; -import { Tooltip, TooltipProps } from 'src/components/Tooltip'; -import { - ButtonProps as AntdButtonProps, +import { Tooltip } from '../Tooltip'; +import type { + ButtonColorType, + ButtonProps, + ButtonStyle, ButtonType, ButtonVariantType, - ButtonColorType, -} from 'antd-v5/es/button'; + OnClickHandler, +} from './types'; -export type OnClickHandler = MouseEventHandler; - -export type ButtonStyle = - | 'primary' - | 'secondary' - | 'tertiary' - | 'danger' - | 'link' - | 'dashed'; - -export type ButtonSize = 'default' | 'small' | 'xsmall'; - -export type ButtonProps = Omit & - Pick & { - tooltip?: ReactNode; - className?: string; - buttonSize?: ButtonSize; - buttonStyle?: ButtonStyle; - cta?: boolean; - showMarginRight?: boolean; - }; - -export default function Button(props: ButtonProps) { +export function Button(props: ButtonProps) { const { tooltip, placement, @@ -189,3 +163,5 @@ export default function Button(props: ButtonProps) { return button; } + +export type { ButtonProps, OnClickHandler }; diff --git a/superset-frontend/src/components/Button/types.ts b/superset-frontend/src/components/Button/types.ts new file mode 100644 index 00000000000..232ba31fe9d --- /dev/null +++ b/superset-frontend/src/components/Button/types.ts @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import type { MouseEventHandler, ReactNode } from 'react'; +import type { + ButtonProps as AntdButtonProps, + ButtonType, + ButtonVariantType, + ButtonColorType, +} from 'antd-v5/es/button'; +import type { TooltipPlacement } from '../Tooltip/types'; + +export type { AntdButtonProps, ButtonType, ButtonVariantType, ButtonColorType }; + +export type OnClickHandler = MouseEventHandler; + +export type ButtonStyle = + | 'primary' + | 'secondary' + | 'tertiary' + | 'danger' + | 'link' + | 'dashed'; + +export type ButtonSize = 'default' | 'small' | 'xsmall'; + +export type ButtonProps = Omit & { + placement?: TooltipPlacement; + tooltip?: ReactNode; + className?: string; + buttonSize?: ButtonSize; + buttonStyle?: ButtonStyle; + cta?: boolean; + showMarginRight?: boolean; +}; diff --git a/superset-frontend/src/components/ButtonGroup/ButtonGroup.stories.tsx b/superset-frontend/src/components/ButtonGroup/ButtonGroup.stories.tsx index 3706eb99bd0..bdd3f07b6b3 100644 --- a/superset-frontend/src/components/ButtonGroup/ButtonGroup.stories.tsx +++ b/superset-frontend/src/components/ButtonGroup/ButtonGroup.stories.tsx @@ -16,9 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import Button, { ButtonProps } from 'src/components/Button'; -import { STYLES, SIZES } from 'src/components/Button/Button.stories'; -import ButtonGroup from './index'; +import { Button } from '../Button'; +import type { ButtonProps } from '../Button/types'; +import { STYLES, SIZES } from '../Button/Button.stories'; +import { ButtonGroup } from '.'; export default { title: 'Components/ButtonGroup', diff --git a/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx b/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx index b99b9907a78..62362eb970d 100644 --- a/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx +++ b/superset-frontend/src/components/ButtonGroup/ButtonGroup.test.tsx @@ -18,8 +18,8 @@ */ import { render, screen } from 'spec/helpers/testing-library'; -import Button from 'src/components/Button'; -import ButtonGroup from '.'; +import { Button } from '../Button'; +import { ButtonGroup } from '.'; test('renders 1 button', () => { render( diff --git a/superset-frontend/src/components/ButtonGroup/index.tsx b/superset-frontend/src/components/ButtonGroup/index.tsx index a4db7f34c18..89c373c1e2b 100644 --- a/superset-frontend/src/components/ButtonGroup/index.tsx +++ b/superset-frontend/src/components/ButtonGroup/index.tsx @@ -16,15 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { ReactNode } from 'react'; +import type { ButtonGroupProps } from './types'; -export interface ButtonGroupProps { - className?: string; - children: ReactNode; - expand?: boolean; -} - -export default function ButtonGroup(props: ButtonGroupProps) { +export function ButtonGroup(props: ButtonGroupProps) { const { className, children } = props; return (
); } + +export type { ButtonGroupProps }; diff --git a/superset-frontend/src/components/ButtonGroup/types.ts b/superset-frontend/src/components/ButtonGroup/types.ts new file mode 100644 index 00000000000..e5fe9e64204 --- /dev/null +++ b/superset-frontend/src/components/ButtonGroup/types.ts @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import type { ReactNode } from 'react'; + +export interface ButtonGroupProps { + className?: string; + children: ReactNode; + expand?: boolean; +} diff --git a/superset-frontend/src/components/CachedLabel/CachedLabel.test.tsx b/superset-frontend/src/components/CachedLabel/CachedLabel.test.tsx index d42bb0257f3..2e25ed99823 100644 --- a/superset-frontend/src/components/CachedLabel/CachedLabel.test.tsx +++ b/superset-frontend/src/components/CachedLabel/CachedLabel.test.tsx @@ -19,7 +19,8 @@ import { isValidElement } from 'react'; import { render, screen } from 'spec/helpers/testing-library'; -import CachedLabel, { CacheLabelProps } from '.'; +import { CachedLabel } from '.'; +import type { CacheLabelProps } from './types'; const defaultProps = { onClick: () => {}, diff --git a/superset-frontend/src/components/CachedLabel/index.tsx b/superset-frontend/src/components/CachedLabel/index.tsx index 8cd5b51f47c..b0f805ab7c0 100644 --- a/superset-frontend/src/components/CachedLabel/index.tsx +++ b/superset-frontend/src/components/CachedLabel/index.tsx @@ -16,21 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import { useState, MouseEventHandler, FC } from 'react'; +import { useState, FC } from 'react'; import { t } from '@superset-ui/core'; -import Label from 'src/components/Label'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; +import { Label } from '../Label'; +import { Tooltip } from '../Tooltip'; import { TooltipContent } from './TooltipContent'; +import type { CacheLabelProps } from './types'; -export interface CacheLabelProps { - onClick?: MouseEventHandler; - cachedTimestamp?: string; - className?: string; -} - -const CacheLabel: FC = ({ +export const CachedLabel: FC = ({ className, onClick, cachedTimestamp, @@ -51,12 +46,10 @@ const CacheLabel: FC = ({ onMouseOut={() => setHovered(false)} icon={} > - {/* TODO: Remove fa-icon */} - {/* eslint-disable-next-line icons/no-fa-icons-usage */} {t('Cached')} ); }; -export default CacheLabel; +export type { CacheLabelProps }; diff --git a/superset-frontend/src/components/CachedLabel/types.ts b/superset-frontend/src/components/CachedLabel/types.ts new file mode 100644 index 00000000000..5a8b3567405 --- /dev/null +++ b/superset-frontend/src/components/CachedLabel/types.ts @@ -0,0 +1,26 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import type { MouseEventHandler } from 'react'; + +export interface CacheLabelProps { + onClick?: MouseEventHandler; + cachedTimestamp?: string; + className?: string; +} diff --git a/superset-frontend/src/components/Card/Card.stories.tsx b/superset-frontend/src/components/Card/Card.stories.tsx index af3b1644c11..3009da49b92 100644 --- a/superset-frontend/src/components/Card/Card.stories.tsx +++ b/superset-frontend/src/components/Card/Card.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import Card, { CardProps } from '.'; +import { Card } from '.'; +import type { CardProps } from './types'; export default { title: 'Components/Card', diff --git a/superset-frontend/src/components/Card/Card.test.tsx b/superset-frontend/src/components/Card/Card.test.tsx index 2c353d0924c..2254b4d3c17 100644 --- a/superset-frontend/src/components/Card/Card.test.tsx +++ b/superset-frontend/src/components/Card/Card.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, waitFor } from 'spec/helpers/testing-library'; -import Card from '.'; +import { Card } from '.'; afterEach(async () => { // Wait for any pending effects to complete diff --git a/superset-frontend/src/components/Card/index.tsx b/superset-frontend/src/components/Card/index.tsx index 2afdf04a230..2c872ca342d 100644 --- a/superset-frontend/src/components/Card/index.tsx +++ b/superset-frontend/src/components/Card/index.tsx @@ -18,13 +18,9 @@ */ import { SupersetTheme } from '@superset-ui/core'; import { Card as AntdCard } from 'antd-v5'; -import { CardProps as AntdCardProps } from 'antd-v5/es/card'; +import type { CardProps } from './types'; -export interface CardProps extends AntdCardProps { - padded?: boolean; -} - -const Card = ({ padded, ...props }: CardProps) => ( +const CustomCard = ({ padded, ...props }: CardProps) => ( ({ @@ -35,6 +31,6 @@ const Card = ({ padded, ...props }: CardProps) => ( /> ); -export default Object.assign(Card, { +export const Card = Object.assign(CustomCard, { Meta: AntdCard.Meta, }); diff --git a/superset-frontend/src/components/Card/types.ts b/superset-frontend/src/components/Card/types.ts new file mode 100644 index 00000000000..8e7f0512469 --- /dev/null +++ b/superset-frontend/src/components/Card/types.ts @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { CardProps as AntdCardProps } from 'antd-v5/es/card'; + +export interface CardProps extends AntdCardProps { + padded?: boolean; +} diff --git a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx index 01883e3c33b..92df41a4690 100644 --- a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx +++ b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.stories.tsx @@ -17,7 +17,8 @@ * under the License. */ import { configure as configureTranslation } from '@superset-ui/core'; -import CertifiedBadge, { CertifiedBadgeProps } from '.'; +import { CertifiedBadge } from '.'; +import type { CertifiedBadgeProps } from './types'; configureTranslation(); diff --git a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx index 39612e66760..b67c0eca446 100644 --- a/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx +++ b/superset-frontend/src/components/CertifiedBadge/CertifiedBadge.test.tsx @@ -22,9 +22,8 @@ import { userEvent, waitFor, } from 'spec/helpers/testing-library'; -import CertifiedBadge, { - CertifiedBadgeProps, -} from 'src/components/CertifiedBadge'; +import { CertifiedBadge } from '.'; +import type { CertifiedBadgeProps } from './types'; const asyncRender = (props?: CertifiedBadgeProps) => waitFor(() => render()); diff --git a/superset-frontend/src/components/CertifiedBadge/index.tsx b/superset-frontend/src/components/CertifiedBadge/index.tsx index 8eb14f26469..144f924bd78 100644 --- a/superset-frontend/src/components/CertifiedBadge/index.tsx +++ b/superset-frontend/src/components/CertifiedBadge/index.tsx @@ -17,16 +17,11 @@ * under the License. */ import { t, useTheme } from '@superset-ui/core'; -import { Icons, IconType } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; +import { Icons } from 'src/components/Icons'; +import { Tooltip } from '../Tooltip'; +import type { CertifiedBadgeProps } from './types'; -export interface CertifiedBadgeProps { - certifiedBy?: string; - details?: string; - size?: IconType['iconSize']; -} - -function CertifiedBadge({ +export function CertifiedBadge({ certifiedBy, details, size = 'l', @@ -51,5 +46,3 @@ function CertifiedBadge({ ); } - -export default CertifiedBadge; diff --git a/superset-frontend/src/components/CertifiedBadge/types.ts b/superset-frontend/src/components/CertifiedBadge/types.ts new file mode 100644 index 00000000000..947ec0082f9 --- /dev/null +++ b/superset-frontend/src/components/CertifiedBadge/types.ts @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { IconType } from 'src/components/Icons/types'; + +export interface CertifiedBadgeProps { + certifiedBy?: string; + details?: string; + size?: IconType['iconSize']; +} diff --git a/superset-frontend/src/components/Chart/Chart.tsx b/superset-frontend/src/components/Chart/Chart.tsx index dd618304784..c7264a449f5 100644 --- a/superset-frontend/src/components/Chart/Chart.tsx +++ b/superset-frontend/src/components/Chart/Chart.tsx @@ -30,9 +30,7 @@ import { ChartDataResponse, } from '@superset-ui/core'; import { PLACEHOLDER_DATASOURCE } from 'src/dashboard/constants'; -import Loading from 'src/components/Loading'; -import { EmptyState } from 'src/components/EmptyState'; -import ErrorBoundary from 'src/components/ErrorBoundary'; +import { EmptyState, ErrorBoundary, Loading } from 'src/components'; import { Logger, LOG_ACTIONS_RENDER_CHART } from 'src/logger/LogUtils'; import { URL_PARAMS } from 'src/constants'; import { getUrlParam } from 'src/utils/urlUtils'; diff --git a/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.tsx b/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.tsx index efea8cc23f8..a1e08b3af17 100644 --- a/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.tsx +++ b/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.tsx @@ -43,7 +43,7 @@ import { import { RootState } from 'src/dashboard/types'; import { Menu } from 'src/components/Menu'; import { usePermissions } from 'src/hooks/usePermissions'; -import { Dropdown } from 'src/components/Dropdown'; +import { Dropdown } from 'src/components'; import { updateDataMask } from 'src/dataMask/actions'; import DrillByModal from 'src/components/Chart/DrillBy/DrillByModal'; import { useVerboseMap } from 'src/hooks/apiResources/datasets'; diff --git a/superset-frontend/src/components/Chart/ChartErrorMessage.test.tsx b/superset-frontend/src/components/Chart/ChartErrorMessage.test.tsx index 6d05a7b9df1..98c099d3266 100644 --- a/superset-frontend/src/components/Chart/ChartErrorMessage.test.tsx +++ b/superset-frontend/src/components/Chart/ChartErrorMessage.test.tsx @@ -22,9 +22,9 @@ import { ChartSource } from 'src/types/ChartSource'; import { useChartOwnerNames } from 'src/hooks/apiResources'; import { ResourceStatus } from 'src/hooks/apiResources/apiResources'; import { ErrorType } from '@superset-ui/core'; +import type { ErrorMessageComponentProps } from 'src/components/ErrorMessage/types'; +import { getErrorMessageComponentRegistry } from 'src/components'; import { ChartErrorMessage } from './ChartErrorMessage'; -import { ErrorMessageComponentProps } from '../ErrorMessage/types'; -import getErrorMessageComponentRegistry from '../ErrorMessage/getErrorMessageComponentRegistry'; // Mock the useChartOwnerNames hook jest.mock('src/hooks/apiResources', () => ({ diff --git a/superset-frontend/src/components/Chart/ChartErrorMessage.tsx b/superset-frontend/src/components/Chart/ChartErrorMessage.tsx index b6d3a851063..3a5d31d3766 100644 --- a/superset-frontend/src/components/Chart/ChartErrorMessage.tsx +++ b/superset-frontend/src/components/Chart/ChartErrorMessage.tsx @@ -20,7 +20,7 @@ import { ClientErrorObject, SupersetError } from '@superset-ui/core'; import { FC } from 'react'; import { useChartOwnerNames } from 'src/hooks/apiResources'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; +import { ErrorMessageWithStackTrace } from 'src/components'; import { ChartSource } from 'src/types/ChartSource'; export type Props = { diff --git a/superset-frontend/src/components/Chart/ChartRenderer.jsx b/superset-frontend/src/components/Chart/ChartRenderer.jsx index 302f98bd455..8589deb851f 100644 --- a/superset-frontend/src/components/Chart/ChartRenderer.jsx +++ b/superset-frontend/src/components/Chart/ChartRenderer.jsx @@ -30,7 +30,7 @@ import { FeatureFlag, } from '@superset-ui/core'; import { Logger, LOG_ACTIONS_RENDER_CHART } from 'src/logger/LogUtils'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState } from 'src/components'; import { ChartSource } from 'src/types/ChartSource'; import ChartContextMenu from './ChartContextMenu/ChartContextMenu'; diff --git a/superset-frontend/src/components/Chart/DisabledMenuItemTooltip.tsx b/superset-frontend/src/components/Chart/DisabledMenuItemTooltip.tsx index 93fac5cb6f0..fdaa296f4df 100644 --- a/superset-frontend/src/components/Chart/DisabledMenuItemTooltip.tsx +++ b/superset-frontend/src/components/Chart/DisabledMenuItemTooltip.tsx @@ -20,7 +20,7 @@ import { ReactNode } from 'react'; import { css, SupersetTheme } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; export const MenuItemTooltip = ({ title, diff --git a/superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx b/superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx index 4a65f7f281c..099e7d329c8 100644 --- a/superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx +++ b/superset-frontend/src/components/Chart/DrillBy/DrillByMenuItems.tsx @@ -46,9 +46,8 @@ import rison from 'rison'; import { debounce } from 'lodash'; import { FixedSizeList as List } from 'react-window'; import { Icons } from 'src/components/Icons'; -import { Input } from 'src/components/Input'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import Loading from 'src/components/Loading'; +import { Input, Loading } from 'src/components'; import { cachedSupersetGet, supersetGetCache, diff --git a/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx b/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx index bf7c6ae9ba6..67c3690dbb7 100644 --- a/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx +++ b/superset-frontend/src/components/Chart/DrillBy/DrillByModal.tsx @@ -33,16 +33,20 @@ import { } from '@superset-ui/core'; import { useDispatch, useSelector } from 'react-redux'; import { Link } from 'react-router-dom'; -import Modal from 'src/components/Modal'; -import Loading from 'src/components/Loading'; -import Button from 'src/components/Button'; +import { + Button, + Alert, + Modal, + Loading, + Breadcrumb, + Flex, +} from 'src/components'; import { RootState } from 'src/dashboard/types'; import { DashboardPageIdContext } from 'src/dashboard/containers/DashboardPage'; import { postFormData } from 'src/explore/exploreUtils/formData'; import { simpleFilterToAdhoc } from 'src/utils/simpleFilterToAdhoc'; import { useDatasetMetadataBar } from 'src/features/datasets/metadataBar/useDatasetMetadataBar'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import Alert from 'src/components/Alert'; import { logEvent } from 'src/logger/actions'; import { LOG_ACTIONS_DRILL_BY_BREADCRUMB_CLICKED, @@ -52,8 +56,6 @@ import { } from 'src/logger/LogUtils'; import { findPermission } from 'src/utils/findPermission'; import { getQuerySettings } from 'src/explore/exploreUtils'; -import { Breadcrumb } from 'src/components/Breadcrumb'; -import { Flex } from 'src/components/Flex'; import { Dataset, DrillByType } from '../types'; import DrillByChart from './DrillByChart'; import { ContextMenuItem } from '../ChartContextMenu/ChartContextMenu'; diff --git a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx index f9b474d4316..9e720d6cc85 100644 --- a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx +++ b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailMenuItems.test.tsx @@ -144,12 +144,13 @@ const setupMenu = (filters: BinaryQueryObjectFilterClause[]) => { * Drill to Detail modal should appear with correct initial filters */ const expectDrillToDetailModal = async ( - buttonName: string, + buttonName: string | null, filters: BinaryQueryObjectFilterClause[] = [], ) => { - const button = screen.getByRole('menuitem', { name: buttonName }); - - userEvent.click(button); + if (buttonName) { + const button = screen.getByRole('menuitem', { name: buttonName }); + userEvent.click(button); + } const modal = await screen.findByRole('dialog', { name: `Drill to detail: ${chartName}`, }); @@ -282,15 +283,14 @@ const expectDrillToDetailByAll = async ( 'drill-to-detail-by-submenu', ); - const menuItemName = 'Drill to detail by all'; const drillToDetailBySubmenuItem = await within( drillToDetailBySubMenus[1], - ).findByRole('menuitem', { - name: /Drill to detail by\s*all/i, - }); + ).findByText(/all/i); await expectMenuItemEnabled(drillToDetailBySubmenuItem); - await expectDrillToDetailModal(menuItemName, filters); + + userEvent.click(drillToDetailBySubmenuItem); + await expectDrillToDetailModal(null, filters); }; beforeAll(() => { @@ -398,7 +398,7 @@ test('context menu for supported chart, dimensions, filter B', async () => { await expectDrillToDetailByDimension(filterB); }); -test.skip('context menu for supported chart, dimensions, all filters', async () => { +test('context menu for supported chart, dimensions, all filters', async () => { const filters = [filterA, filterB]; setupMenu(filters); await expectDrillToDetailByAll(filters); diff --git a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx index 240acdc45c6..5535a9551b3 100644 --- a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx +++ b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailModal.tsx @@ -26,8 +26,7 @@ import { t, useTheme, } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; -import Button from 'src/components/Button'; +import { Button, Modal } from 'src/components'; import { useSelector } from 'react-redux'; import { DashboardPageIdContext } from 'src/dashboard/containers/DashboardPage'; import { Slice } from 'src/types/Chart'; diff --git a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx index c26edd1a332..191423f805f 100644 --- a/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx +++ b/superset-frontend/src/components/Chart/DrillDetail/DrillDetailPane.tsx @@ -37,11 +37,10 @@ import { useTheme, } from '@superset-ui/core'; import { useResizeDetector } from 'react-resize-detector'; -import Loading from 'src/components/Loading'; import BooleanCell from 'src/components/Table/cell-renderers/BooleanCell'; import NullCell from 'src/components/Table/cell-renderers/NullCell'; import TimeCell from 'src/components/Table/cell-renderers/TimeCell'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, Loading } from 'src/components'; import { getDatasourceSamples } from 'src/components/Chart/chartAction'; import Table, { ColumnsType, TableSize } from 'src/components/Table'; import HeaderWithRadioGroup from 'src/components/Table/header-renderers/HeaderWithRadioGroup'; diff --git a/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx b/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx index cf77427cc77..d9fda901474 100644 --- a/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx +++ b/superset-frontend/src/components/Chart/MenuItemWithTruncation.tsx @@ -20,7 +20,7 @@ import { ReactNode, CSSProperties } from 'react'; import { css, truncationCSS, useCSSTextTruncation } from '@superset-ui/core'; import { Menu } from 'src/components/Menu'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { MenuItemProps } from 'antd-v5'; export type MenuItemWithTruncationProps = { diff --git a/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx b/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx index b222fab6368..afa3c211555 100644 --- a/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx +++ b/superset-frontend/src/components/Checkbox/Checkbox.stories.tsx @@ -18,8 +18,8 @@ */ import { useArgs } from '@storybook/preview-api'; import { useState } from 'react'; -import type { CheckboxChangeEvent } from 'antd/es/checkbox'; -import Checkbox, { CheckboxProps } from '.'; +import { Checkbox } from '.'; +import type { CheckboxProps, CheckboxChangeEvent } from './types'; export default { title: 'Components/Checkbox', diff --git a/superset-frontend/src/components/Checkbox/Checkbox.test.tsx b/superset-frontend/src/components/Checkbox/Checkbox.test.tsx index 56301e51eb1..b53e6da30a6 100644 --- a/superset-frontend/src/components/Checkbox/Checkbox.test.tsx +++ b/superset-frontend/src/components/Checkbox/Checkbox.test.tsx @@ -22,7 +22,8 @@ import { userEvent, waitFor, } from 'spec/helpers/testing-library'; -import Checkbox, { CheckboxProps } from '.'; +import { Checkbox } from '.'; +import type { CheckboxProps } from './types'; const mockedProps: CheckboxProps = { checked: false, diff --git a/superset-frontend/src/components/Checkbox/index.tsx b/superset-frontend/src/components/Checkbox/index.tsx index 9245065eda5..3be0ba89701 100644 --- a/superset-frontend/src/components/Checkbox/index.tsx +++ b/superset-frontend/src/components/Checkbox/index.tsx @@ -16,9 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -export { default } from 'src/components/Checkbox/Checkbox'; -export type { - CheckboxProps, - CheckboxChangeEvent, -} from 'src/components/Checkbox/Checkbox'; -export * from 'src/components/Checkbox/CheckboxIcons'; +import { Checkbox } from 'antd-v5'; + +export { Checkbox }; +export type { CheckboxProps, CheckboxChangeEvent } from './types'; diff --git a/superset-frontend/src/components/Checkbox/types.ts b/superset-frontend/src/components/Checkbox/types.ts new file mode 100644 index 00000000000..1bf479e151e --- /dev/null +++ b/superset-frontend/src/components/Checkbox/types.ts @@ -0,0 +1,19 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type { CheckboxProps, CheckboxChangeEvent } from 'antd-v5/es/checkbox'; diff --git a/superset-frontend/src/components/Collapse/Collapse.stories.tsx b/superset-frontend/src/components/Collapse/Collapse.stories.tsx index 10186da8e4f..c3ae01a5a31 100644 --- a/superset-frontend/src/components/Collapse/Collapse.stories.tsx +++ b/superset-frontend/src/components/Collapse/Collapse.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import Collapse, { CollapseProps } from '.'; +import { Collapse } from '.'; +import type { CollapseProps } from './types'; export default { title: 'Components/Collapse', diff --git a/superset-frontend/src/components/Collapse/Collapse.test.tsx b/superset-frontend/src/components/Collapse/Collapse.test.tsx index 80f0687ae44..4e9f74fe0cd 100644 --- a/superset-frontend/src/components/Collapse/Collapse.test.tsx +++ b/superset-frontend/src/components/Collapse/Collapse.test.tsx @@ -18,7 +18,8 @@ */ import { render, screen } from 'spec/helpers/testing-library'; import userEvent from '@testing-library/user-event'; -import Collapse, { CollapseProps } from '.'; +import { Collapse } from '.'; +import type { CollapseProps } from './types'; function renderCollapse(props?: CollapseProps) { return render( diff --git a/superset-frontend/src/components/Collapse/index.tsx b/superset-frontend/src/components/Collapse/index.tsx index c8e2b16b0e6..faf1eda5ecc 100644 --- a/superset-frontend/src/components/Collapse/index.tsx +++ b/superset-frontend/src/components/Collapse/index.tsx @@ -17,16 +17,12 @@ * under the License. */ import { styled } from '@superset-ui/core'; -import { - Collapse as AntdCollapse, - CollapseProps as AntdCollapseProps, -} from 'antd-v5'; +import { Collapse as AntdCollapse } from 'antd-v5'; +import type { CollapseProps } from './types'; -export interface CollapseProps extends AntdCollapseProps { - animateArrows?: boolean; -} - -const Collapse = styled((props: CollapseProps) => )` +export const Collapse = styled((props: CollapseProps) => ( + +))` .antd5-collapse-item { .antd5-collapse-header { .antd5-collapse-arrow svg { @@ -80,4 +76,4 @@ const Collapse = styled((props: CollapseProps) => )` } `; -export default Collapse; +export type { CollapseProps }; diff --git a/superset-frontend/src/components/Collapse/types.ts b/superset-frontend/src/components/Collapse/types.ts new file mode 100644 index 00000000000..54731170f55 --- /dev/null +++ b/superset-frontend/src/components/Collapse/types.ts @@ -0,0 +1,23 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { CollapseProps as AntdCollapseProps } from 'antd-v5'; + +export interface CollapseProps extends AntdCollapseProps { + animateArrows?: boolean; +} diff --git a/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.stories.tsx b/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.stories.tsx index fbe3ecf87a0..132cea64c88 100644 --- a/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.stories.tsx +++ b/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.stories.tsx @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import Button from 'src/components/Button'; -import ConfirmStatusChange, { ConfirmStatusChangeProps, Callback } from '.'; +import { Button } from 'src/components'; +import { ConfirmStatusChange } from '.'; +import type { ConfirmStatusChangeProps, Callback } from './types'; export default { title: 'Components/ConfirmStatusChange', diff --git a/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx b/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx index bb8da13af16..2138a61d84f 100644 --- a/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx +++ b/superset-frontend/src/components/ConfirmStatusChange/ConfirmStatusChange.test.jsx @@ -17,8 +17,8 @@ * under the License. */ import { fireEvent, render, waitFor } from 'spec/helpers/testing-library'; -import Button from 'src/components/Button'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { Button } from '../Button'; +import { ConfirmStatusChange } from '.'; const mockedProps = { title: 'please confirm', diff --git a/superset-frontend/src/components/ConfirmStatusChange/index.tsx b/superset-frontend/src/components/ConfirmStatusChange/index.tsx index fe795065c70..ff2ba0cf63d 100644 --- a/superset-frontend/src/components/ConfirmStatusChange/index.tsx +++ b/superset-frontend/src/components/ConfirmStatusChange/index.tsx @@ -16,20 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -import { useState, ReactNode } from 'react'; +import { useState } from 'react'; -import DeleteModal from 'src/components/DeleteModal'; +import { DeleteModal } from '../DeleteModal'; +import type { ConfirmStatusChangeProps } from './types'; -export type Callback = (...args: any[]) => void; - -export interface ConfirmStatusChangeProps { - title: ReactNode; - description: ReactNode; - onConfirm: Callback; - children: (showConfirm: Callback) => ReactNode; -} - -export default function ConfirmStatusChange({ +export function ConfirmStatusChange({ title, description, onConfirm, @@ -81,3 +73,5 @@ export default function ConfirmStatusChange({ ); } + +export type { ConfirmStatusChangeProps }; diff --git a/superset-frontend/src/components/ConfirmStatusChange/types.ts b/superset-frontend/src/components/ConfirmStatusChange/types.ts new file mode 100644 index 00000000000..cd80743220d --- /dev/null +++ b/superset-frontend/src/components/ConfirmStatusChange/types.ts @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode } from 'react'; + +export type Callback = (...args: any[]) => void; + +export interface ConfirmStatusChangeProps { + title: ReactNode; + description: ReactNode; + onConfirm: Callback; + children: (showConfirm: Callback) => ReactNode; +} diff --git a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx index 268427ad5d4..c725ce032df 100644 --- a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx +++ b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.stories.tsx @@ -16,10 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import Button from 'src/components/Button'; import { Icons } from 'src/components/Icons'; import ToastContainer from 'src/components/MessageToasts/ToastContainer'; -import CopyToClipboard from '.'; +import { Button } from '../Button'; +import { CopyToClipboard } from '.'; export default { title: 'Components/CopyToClipboard', diff --git a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.test.tsx b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.test.tsx index 7d1542d669b..4164cb45459 100644 --- a/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.test.tsx +++ b/superset-frontend/src/components/CopyToClipboard/CopyToClipboard.test.tsx @@ -22,7 +22,7 @@ import { userEvent, waitFor, } from 'spec/helpers/testing-library'; -import CopyToClipboard from '.'; +import { CopyToClipboard } from '.'; test('renders with default props', () => { const text = 'Text'; diff --git a/superset-frontend/src/components/CopyToClipboard/index.tsx b/superset-frontend/src/components/CopyToClipboard/index.tsx index 10f2f750049..06a0d934a45 100644 --- a/superset-frontend/src/components/CopyToClipboard/index.tsx +++ b/superset-frontend/src/components/CopyToClipboard/index.tsx @@ -16,24 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -import { Component, cloneElement, ReactNode, ReactElement } from 'react'; +import { Component, cloneElement, ReactElement } from 'react'; import { t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import withToasts from 'src/components/MessageToasts/withToasts'; import copyTextToClipboard from 'src/utils/copy'; - -export interface CopyToClipboardProps { - copyNode?: ReactNode; - getText?: (callback: (data: string) => void) => void; - onCopyEnd?: () => void; - shouldShowText?: boolean; - text?: string; - wrapped?: boolean; - tooltipText?: string; - addDangerToast: (msg: string) => void; - addSuccessToast: (msg: string) => void; - hideTooltip?: boolean; -} +import withToasts from '../MessageToasts/withToasts'; +import { Tooltip } from '../Tooltip'; +import type { CopyToClipboardProps } from './types'; const defaultProps: Partial = { copyNode: {t('Copy')}, @@ -44,7 +32,7 @@ const defaultProps: Partial = { hideTooltip: false, }; -class CopyToClipboard extends Component { +class CopyToClip extends Component { static defaultProps = defaultProps; constructor(props: CopyToClipboardProps) { @@ -134,4 +122,5 @@ class CopyToClipboard extends Component { } } -export default withToasts(CopyToClipboard); +export const CopyToClipboard = withToasts(CopyToClip); +export type { CopyToClipboardProps }; diff --git a/superset-frontend/src/components/CopyToClipboard/types.ts b/superset-frontend/src/components/CopyToClipboard/types.ts new file mode 100644 index 00000000000..10d87e8decf --- /dev/null +++ b/superset-frontend/src/components/CopyToClipboard/types.ts @@ -0,0 +1,32 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode } from 'react'; + +export interface CopyToClipboardProps { + copyNode?: ReactNode; + getText?: (callback: (data: string) => void) => void; + onCopyEnd?: () => void; + shouldShowText?: boolean; + text?: string; + wrapped?: boolean; + tooltipText?: string; + addDangerToast: (msg: string) => void; + addSuccessToast: (msg: string) => void; + hideTooltip?: boolean; +} diff --git a/superset-frontend/src/components/CronPicker/CronPicker.stories.tsx b/superset-frontend/src/components/CronPicker/CronPicker.stories.tsx index de5373e52ca..1bc2748f939 100644 --- a/superset-frontend/src/components/CronPicker/CronPicker.stories.tsx +++ b/superset-frontend/src/components/CronPicker/CronPicker.stories.tsx @@ -17,9 +17,10 @@ * under the License. */ import { useState, useRef, useCallback } from 'react'; -import { Divider } from 'src/components/Divider'; -import { Input } from 'src/components/Input'; -import { CronPicker, CronError, CronProps } from '.'; +import { Divider } from '../Divider'; +import { Input } from '../Input'; +import { CronPicker } from '.'; +import type { CronError, CronProps } from './types'; export default { title: 'Components/CronPicker', diff --git a/superset-frontend/src/components/CronPicker/CronPicker.test.tsx b/superset-frontend/src/components/CronPicker/CronPicker.test.tsx index 48203a2dc88..cbe8ae37dd1 100644 --- a/superset-frontend/src/components/CronPicker/CronPicker.test.tsx +++ b/superset-frontend/src/components/CronPicker/CronPicker.test.tsx @@ -19,7 +19,7 @@ import { render } from 'spec/helpers/testing-library'; import * as ReactCronPicker from 'react-js-cron'; -import { CronPicker } from './CronPicker'; +import { CronPicker } from '.'; const spy = jest.spyOn(ReactCronPicker, 'default'); diff --git a/superset-frontend/src/components/CronPicker/CronPicker.tsx b/superset-frontend/src/components/CronPicker/index.tsx similarity index 97% rename from superset-frontend/src/components/CronPicker/CronPicker.tsx rename to superset-frontend/src/components/CronPicker/index.tsx index 927f31661d7..abbddaf9b3d 100644 --- a/superset-frontend/src/components/CronPicker/CronPicker.tsx +++ b/superset-frontend/src/components/CronPicker/index.tsx @@ -17,9 +17,8 @@ * under the License. */ import { styled, t } from '@superset-ui/core'; -import ReactCronPicker, { Locale, CronProps } from 'react-js-cron'; - -export * from 'react-js-cron'; +import ReactCronPicker from 'react-js-cron'; +import type { Locale, CronProps } from './types'; export const LOCALE: Locale = { everyText: t('every'), @@ -200,3 +199,5 @@ export const CronPicker = styled((props: CronProps) => ( } `} `; + +export type { CronError } from './types'; diff --git a/superset-frontend/src/components/CronPicker/types.ts b/superset-frontend/src/components/CronPicker/types.ts new file mode 100644 index 00000000000..ca2dba02624 --- /dev/null +++ b/superset-frontend/src/components/CronPicker/types.ts @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export type { Locale, CronError, CronProps } from 'react-js-cron'; diff --git a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx index 6aa7a766188..aff12b547b3 100644 --- a/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx +++ b/superset-frontend/src/components/DatabaseSelector/DatabaseSelector.test.tsx @@ -27,8 +27,9 @@ import { waitFor, } from 'spec/helpers/testing-library'; import { api } from 'src/hooks/apiResources/queryApi'; -import DatabaseSelector, { DatabaseSelectorProps } from '.'; import { EmptyState } from '../EmptyState'; +import { DatabaseSelector } from '.'; +import type { DatabaseSelectorProps } from './types'; const createProps = (): DatabaseSelectorProps => ({ db: { diff --git a/superset-frontend/src/components/DatabaseSelector/index.tsx b/superset-frontend/src/components/DatabaseSelector/index.tsx index 628587fc23a..1399b8e91a1 100644 --- a/superset-frontend/src/components/DatabaseSelector/index.tsx +++ b/superset-frontend/src/components/DatabaseSelector/index.tsx @@ -25,12 +25,7 @@ import { useCallback, } from 'react'; import { styled, SupersetClient, SupersetError, t } from '@superset-ui/core'; -import type { LabeledValue as AntdLabeledValue } from 'src/components/Select'; import rison from 'rison'; -import { Select, AsyncSelect } from 'src/components'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; -import Label from 'src/components/Label'; -import { FormLabel } from 'src/components/Form'; import RefreshLabel from 'src/components/RefreshLabel'; import { useToasts } from 'src/components/MessageToasts/withToasts'; import { @@ -39,6 +34,17 @@ import { useSchemas, SchemaOption, } from 'src/hooks/apiResources'; +import { Label } from '../Label'; +import { Select, AsyncSelect } from '../Select'; +import { FormLabel } from '../Form'; +import { ErrorMessageWithStackTrace } from '../ErrorMessage'; + +import type { LabeledValue as AntdLabeledValue } from '../Select'; +import type { + DatabaseSelectorProps, + DatabaseValue, + DatabaseObject, +} from './types'; const DatabaseSelectorWrapper = styled.div` ${({ theme }) => ` @@ -83,38 +89,6 @@ const LabelStyle = styled.div` } `; -type DatabaseValue = { - label: ReactNode; - value: number; - id: number; - database_name: string; - backend?: string; -}; - -export type DatabaseObject = { - id: number; - database_name: string; - backend?: string; - allow_multi_catalog?: boolean; -}; - -export interface DatabaseSelectorProps { - db?: DatabaseObject | null; - emptyState?: ReactNode; - formMode?: boolean; - getDbList?: (arg0: any) => void; - handleError: (msg: string) => void; - isDatabaseSelectEnabled?: boolean; - onDbChange?: (db: DatabaseObject) => void; - onEmptyResults?: (searchText?: string) => void; - onCatalogChange?: (catalog?: string) => void; - catalog?: string | null; - onSchemaChange?: (schema?: string) => void; - schema?: string; - readOnly?: boolean; - sqlLabMode?: boolean; -} - const SelectLabel = ({ backend, databaseName, @@ -137,7 +111,7 @@ interface AntdLabeledValueWithOrder extends AntdLabeledValue { order: number; } -export default function DatabaseSelector({ +export function DatabaseSelector({ db, formMode = false, emptyState, @@ -454,3 +428,5 @@ export default function DatabaseSelector({ ); } + +export type { DatabaseObject }; diff --git a/superset-frontend/src/components/DatabaseSelector/types.ts b/superset-frontend/src/components/DatabaseSelector/types.ts new file mode 100644 index 00000000000..7130a8da1d6 --- /dev/null +++ b/superset-frontend/src/components/DatabaseSelector/types.ts @@ -0,0 +1,51 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode } from 'react'; + +export type DatabaseValue = { + label: ReactNode; + value: number; + id: number; + database_name: string; + backend?: string; +}; + +export type DatabaseObject = { + id: number; + database_name: string; + backend?: string; + allow_multi_catalog?: boolean; +}; + +export interface DatabaseSelectorProps { + db?: DatabaseObject | null; + emptyState?: ReactNode; + formMode?: boolean; + getDbList?: (arg0: any) => void; + handleError: (msg: string) => void; + isDatabaseSelectEnabled?: boolean; + onDbChange?: (db: DatabaseObject) => void; + onEmptyResults?: (searchText?: string) => void; + onCatalogChange?: (catalog?: string) => void; + catalog?: string | null; + onSchemaChange?: (schema?: string) => void; + schema?: string; + readOnly?: boolean; + sqlLabMode?: boolean; +} diff --git a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.test.jsx b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.test.jsx index 64a9716ef42..060f6149a12 100644 --- a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.test.jsx +++ b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.test.jsx @@ -21,8 +21,8 @@ import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; import thunk from 'redux-thunk'; import sinon from 'sinon'; -import { ChangeDatasourceModal } from 'src/components/Datasource'; import mockDatasource from 'spec/fixtures/mockDatasource'; +import { ChangeDatasourceModal } from '.'; const mockStore = configureStore([thunk]); const store = mockStore({}); diff --git a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx index 48524167321..8c0bbe1ae23 100644 --- a/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx +++ b/superset-frontend/src/components/Datasource/ChangeDatasourceModal.tsx @@ -25,7 +25,6 @@ import { ChangeEvent, } from 'react'; -import Alert from 'src/components/Alert'; import { SupersetClient, t, @@ -34,21 +33,23 @@ import { } from '@superset-ui/core'; import TableView, { EmptyWrapperType } from 'src/components/TableView'; import { ServerPagination, SortByType } from 'src/components/TableView/types'; -import StyledModal from 'src/components/Modal'; -import Button from 'src/components/Button'; import { useListViewResource } from 'src/views/CRUD/hooks'; import Dataset from 'src/types/Dataset'; import { useDebouncedEffect } from 'src/explore/exploreUtils'; import { SLOW_DEBOUNCE } from 'src/constants'; -import Loading from 'src/components/Loading'; -import { Input } from 'src/components/Input'; import { PAGE_SIZE as DATASET_PAGE_SIZE, SORT_BY as DATASET_SORT_BY, } from 'src/features/datasets/constants'; import withToasts from 'src/components/MessageToasts/withToasts'; import { InputRef } from 'antd-v5'; -import FacePile from '../FacePile'; +import { Loading } from '../Loading'; +import { Input } from '../Input'; +import { FacePile } from '../FacePile'; +import { Button } from '../Button'; +import { Alert } from '../Alert'; +import { Modal } from '../Modal'; +import type { Datasource, ChangeDatasourceModalProps } from './types'; const CONFIRM_WARNING_MESSAGE = t( 'Warning! Changing the dataset may break the chart if the metadata does not exist.', @@ -59,22 +60,7 @@ const CHANGE_WARNING_MSG = t( 'on columns or metadata that does not exist in the target dataset', ); -interface Datasource { - type: string; - id: number; - uid: string; -} - -interface ChangeDatasourceModalProps { - addDangerToast: (msg: string) => void; - addSuccessToast: (msg: string) => void; - onChange: (uid: string) => void; - onDatasourceSave: (datasource: object, errors?: Array) => {}; - onHide: () => void; - show: boolean; -} - -const CustomStyledModal = styled(StyledModal)` +const CustomStyledModal = styled(Modal)` .antd5-modal-body { display: flex; flex-direction: column; diff --git a/superset-frontend/src/components/Datasource/CollectionTable.tsx b/superset-frontend/src/components/Datasource/CollectionTable.tsx index 6c105fa425f..075be69a902 100644 --- a/superset-frontend/src/components/Datasource/CollectionTable.tsx +++ b/superset-frontend/src/components/Datasource/CollectionTable.tsx @@ -16,68 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -import { - ReactNode, - DetailedHTMLProps, - TdHTMLAttributes, - PureComponent, -} from 'react'; +import { PureComponent } from 'react'; import { nanoid } from 'nanoid'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { t, styled } from '@superset-ui/core'; -import Button from 'src/components/Button'; import { Icons } from 'src/components/Icons'; +import { Button } from '../Button'; import Fieldset from './Fieldset'; import { recurseReactClone } from './utils'; - -interface CRUDCollectionProps { - allowAddItem?: boolean; - allowDeletes?: boolean; - collection: Record[]; - columnLabels?: Record; - columnLabelTooltips?: Record; - emptyMessage?: ReactNode; - expandFieldset?: ReactNode; - extraButtons?: ReactNode; - itemGenerator?: () => any; - itemCellProps?: (( - val: unknown, - label: string, - record: any, - ) => DetailedHTMLProps< - TdHTMLAttributes, - HTMLTableCellElement - >)[]; - itemRenderers?: (( - val: unknown, - onChange: () => void, - label: string, - record: any, - ) => ReactNode)[]; - onChange?: (arg0: any) => void; - tableColumns: any[]; - sortColumns: string[]; - stickyHeader?: boolean; -} - -type Sort = number | string | boolean | any; - -enum SortOrder { - Asc = 1, - Desc = 2, - Unsorted = 0, -} - -interface CRUDCollectionState { - collection: Record; - collectionArray: Record[]; - expandedColumns: Record; - sortColumn: string; - sort: SortOrder; -} +import { + SortOrder, + type CRUDCollectionProps, + type CRUDCollectionState, + type Sort, +} from './types'; function createCollectionArray(collection: Record) { return Object.keys(collection).map(k => collection[k]); diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx index e5c3d7d13d9..601162c50bc 100644 --- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx @@ -20,9 +20,6 @@ import rison from 'rison'; import { PureComponent, useCallback } from 'react'; import PropTypes from 'prop-types'; import { Radio } from 'src/components/Radio'; -import Card from 'src/components/Card'; -import Alert from 'src/components/Alert'; -import Badge from 'src/components/Badge'; import { css, isFeatureEnabled, @@ -35,25 +32,28 @@ import { withTheme, getClientErrorObject, } from '@superset-ui/core'; -import { Row, Col } from 'src/components/Grid'; -import { Select, AsyncSelect } from 'src/components'; -import { FormLabel } from 'src/components/Form'; -import Button from 'src/components/Button'; import Tabs from 'src/components/Tabs'; -import CertifiedBadge from 'src/components/CertifiedBadge'; import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip'; -import DatabaseSelector from 'src/components/DatabaseSelector'; -import Label from 'src/components/Label'; -import Loading from 'src/components/Loading'; import TableSelector from 'src/components/TableSelector'; -import EditableTitle from 'src/components/EditableTitle'; import CheckboxControl from 'src/explore/components/controls/CheckboxControl'; import TextControl from 'src/explore/components/controls/TextControl'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; import SpatialControl from 'src/explore/components/controls/SpatialControl'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Icons } from 'src/components/Icons'; import CurrencyControl from 'src/explore/components/controls/CurrencyControl'; +import { Loading } from '../Loading'; +import { Alert } from '../Alert'; +import { Badge } from '../Badge'; +import { Card } from '../Card'; +import { Select, AsyncSelect } from '../Select'; +import { Button } from '../Button'; +import { CertifiedBadge } from '../CertifiedBadge'; +import { DatabaseSelector } from '../DatabaseSelector'; +import { EditableTitle } from '../EditableTitle'; +import { FormLabel } from '../Form'; +import { Row, Col } from '../Grid'; +import { Icons } from '../Icons'; +import { Label } from '../Label'; import CollectionTable from './CollectionTable'; import Fieldset from './Fieldset'; import Field from './Field'; diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx index af20f8f4ae2..23f2cb2e0c5 100644 --- a/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx +++ b/superset-frontend/src/components/Datasource/DatasourceModal.test.jsx @@ -28,8 +28,8 @@ import { import fetchMock from 'fetch-mock'; import sinon from 'sinon'; import { SupersetClient } from '@superset-ui/core'; -import { DatasourceModal } from 'src/components/Datasource'; import mockDatasource from 'spec/fixtures/mockDatasource'; +import { DatasourceModal } from '.'; // Define your constants here const SAVE_ENDPOINT = 'glob:*/api/v1/dataset/7'; diff --git a/superset-frontend/src/components/Datasource/DatasourceModal.tsx b/superset-frontend/src/components/Datasource/DatasourceModal.tsx index 7629434195a..d0367ffc2c4 100644 --- a/superset-frontend/src/components/Datasource/DatasourceModal.tsx +++ b/superset-frontend/src/components/Datasource/DatasourceModal.tsx @@ -18,8 +18,6 @@ */ import { FunctionComponent, useState, useRef } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import Alert from 'src/components/Alert'; -import Button from 'src/components/Button'; import { isDefined, styled, @@ -32,9 +30,6 @@ import { } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import Modal from 'src/components/Modal'; -import AsyncEsmComponent from 'src/components/AsyncEsmComponent'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; import withToasts from 'src/components/MessageToasts/withToasts'; import { startMetaDataLoading, @@ -45,7 +40,13 @@ import { fetchSyncedColumns, updateColumns, } from 'src/components/Datasource/utils'; -import { DatasetObject } from '../../features/datasets/types'; +import type { DatasetObject } from 'src/features/datasets/types'; +import { ErrorMessageWithStackTrace } from '../ErrorMessage'; +import { AsyncEsmComponent } from '../AsyncEsmComponent'; +import { Button } from '../Button'; +import { Alert } from '../Alert'; +import { Modal } from '../Modal'; +import type { DatasourceModalProps } from './types'; const DatasourceEditor = AsyncEsmComponent(() => import('./DatasourceEditor')); @@ -74,16 +75,6 @@ const StyledDatasourceModal = styled(Modal)` } `; -interface DatasourceModalProps { - addSuccessToast: (msg: string) => void; - addDangerToast: (msg: string) => void; - datasource: DatasetObject; - onChange: () => {}; - onDatasourceSave: (datasource: object, errors?: Array) => {}; - onHide: () => {}; - show: boolean; -} - function buildExtraJsonObject( item: DatasetObject['metrics'][0] | DatasetObject['columns'][0], ) { diff --git a/superset-frontend/src/components/Datasource/Field.test.tsx b/superset-frontend/src/components/Datasource/Field.test.tsx index 5a5b171d8bc..6e4a8083718 100644 --- a/superset-frontend/src/components/Datasource/Field.test.tsx +++ b/superset-frontend/src/components/Datasource/Field.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { fireEvent, render, screen } from 'spec/helpers/testing-library'; -import { Input } from 'src/components/Input'; +import { Input } from '../Input'; import Field from './Field'; diff --git a/superset-frontend/src/components/Datasource/Field.tsx b/superset-frontend/src/components/Datasource/Field.tsx index eeebe612732..071cb5a2da9 100644 --- a/superset-frontend/src/components/Datasource/Field.tsx +++ b/superset-frontend/src/components/Datasource/Field.tsx @@ -19,8 +19,8 @@ import { useCallback, ReactNode, ReactElement, cloneElement } from 'react'; import { css, SupersetTheme } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import { FormItem, FormLabel } from 'src/components/Form'; +import { FormItem, FormLabel } from '../Form'; +import { Tooltip } from '../Tooltip'; const formItemInlineCss = css` .antd5-form-item-control-input-content { diff --git a/superset-frontend/src/components/Datasource/Fieldset.tsx b/superset-frontend/src/components/Datasource/Fieldset.tsx index 3d93f37ba5c..066f1dd855f 100644 --- a/superset-frontend/src/components/Datasource/Fieldset.tsx +++ b/superset-frontend/src/components/Datasource/Fieldset.tsx @@ -17,7 +17,7 @@ * under the License. */ import { ReactNode, PureComponent } from 'react'; -import { Form } from 'src/components/Form'; +import { Form } from '../Form'; import { recurseReactClone } from './utils'; import Field from './Field'; diff --git a/superset-frontend/src/components/Datasource/index.tsx b/superset-frontend/src/components/Datasource/index.tsx index de28b24c4cb..59cc0dc8023 100644 --- a/superset-frontend/src/components/Datasource/index.tsx +++ b/superset-frontend/src/components/Datasource/index.tsx @@ -20,3 +20,4 @@ import ChangeDatasourceModal from './ChangeDatasourceModal'; import DatasourceModal from './DatasourceModal'; export { ChangeDatasourceModal, DatasourceModal }; +export type { DatasourceModalProps, ChangeDatasourceModalProps } from './types'; diff --git a/superset-frontend/src/components/Datasource/types.ts b/superset-frontend/src/components/Datasource/types.ts new file mode 100644 index 00000000000..b5acefe880d --- /dev/null +++ b/superset-frontend/src/components/Datasource/types.ts @@ -0,0 +1,91 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode, DetailedHTMLProps, TdHTMLAttributes } from 'react'; +import type { DatasetObject } from 'src/features/datasets/types'; + +export interface Datasource { + type: string; + id: number; + uid: string; +} + +export interface DatasourceModalProps { + addSuccessToast: (msg: string) => void; + addDangerToast: (msg: string) => void; + datasource: DatasetObject; + onChange: () => {}; + onDatasourceSave: (datasource: object, errors?: Array) => {}; + onHide: () => {}; + show: boolean; +} + +export interface ChangeDatasourceModalProps { + addDangerToast: (msg: string) => void; + addSuccessToast: (msg: string) => void; + onChange: (uid: string) => void; + onDatasourceSave: (datasource: object, errors?: Array) => {}; + onHide: () => void; + show: boolean; +} + +export interface CRUDCollectionProps { + allowAddItem?: boolean; + allowDeletes?: boolean; + collection: Record[]; + columnLabels?: Record; + columnLabelTooltips?: Record; + emptyMessage?: ReactNode; + expandFieldset?: ReactNode; + extraButtons?: ReactNode; + itemGenerator?: () => any; + itemCellProps?: (( + val: unknown, + label: string, + record: any, + ) => DetailedHTMLProps< + TdHTMLAttributes, + HTMLTableCellElement + >)[]; + itemRenderers?: (( + val: unknown, + onChange: () => void, + label: string, + record: any, + ) => ReactNode)[]; + onChange?: (arg0: any) => void; + tableColumns: any[]; + sortColumns: string[]; + stickyHeader?: boolean; +} + +export type Sort = number | string | boolean | any; + +export enum SortOrder { + Asc = 1, + Desc = 2, + Unsorted = 0, +} + +export interface CRUDCollectionState { + collection: Record; + collectionArray: Record[]; + expandedColumns: Record; + sortColumn: string; + sort: SortOrder; +} diff --git a/superset-frontend/src/components/DatePicker/DatePicker.stories.tsx b/superset-frontend/src/components/DatePicker/DatePicker.stories.tsx index 8b39be7cb10..6043effffb5 100644 --- a/superset-frontend/src/components/DatePicker/DatePicker.stories.tsx +++ b/superset-frontend/src/components/DatePicker/DatePicker.stories.tsx @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { DatePickerProps } from 'antd-v5'; -import { RangePickerProps } from 'antd-v5/es/date-picker'; +import type { DatePickerProps, RangePickerProps } from './types'; import { DatePicker, RangePicker } from '.'; export default { diff --git a/superset-frontend/src/components/DatePicker/index.tsx b/superset-frontend/src/components/DatePicker/index.tsx index a9b1f465f43..dc4e09506c4 100644 --- a/superset-frontend/src/components/DatePicker/index.tsx +++ b/superset-frontend/src/components/DatePicker/index.tsx @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { DatePicker as AntdDatePicker, DatePickerProps } from 'antd-v5'; +import { DatePicker as AntdDatePicker } from 'antd-v5'; import { css } from '@superset-ui/core'; +import type { DatePickerProps, RangePickerProps } from './types'; export const DatePicker = (props: DatePickerProps) => ( ( // eslint-disable-next-line prefer-destructuring export const RangePicker: typeof AntdDatePicker.RangePicker = AntdDatePicker.RangePicker; + +export type { DatePickerProps, RangePickerProps }; diff --git a/superset-frontend/src/components/DatePicker/types.ts b/superset-frontend/src/components/DatePicker/types.ts new file mode 100644 index 00000000000..92761866654 --- /dev/null +++ b/superset-frontend/src/components/DatePicker/types.ts @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type { RangePickerProps } from 'antd-v5/es/date-picker'; +export type { DatePickerProps } from 'antd-v5'; diff --git a/superset-frontend/src/components/DeleteModal/DeleteModal.test.tsx b/superset-frontend/src/components/DeleteModal/DeleteModal.test.tsx index 86e9ff21e8a..2f579e2e721 100644 --- a/superset-frontend/src/components/DeleteModal/DeleteModal.test.tsx +++ b/superset-frontend/src/components/DeleteModal/DeleteModal.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import DeleteModal from '.'; +import { DeleteModal } from '.'; test('Must display title and content', () => { const props = { diff --git a/superset-frontend/src/components/DeleteModal/index.tsx b/superset-frontend/src/components/DeleteModal/index.tsx index 4fb9dbaaa34..d90ddbdf919 100644 --- a/superset-frontend/src/components/DeleteModal/index.tsx +++ b/superset-frontend/src/components/DeleteModal/index.tsx @@ -17,10 +17,11 @@ * under the License. */ import { t, styled } from '@superset-ui/core'; -import { useState, ReactNode, ChangeEvent } from 'react'; -import { Input } from 'src/components/Input'; -import Modal from 'src/components/Modal'; -import { FormLabel } from 'src/components/Form'; +import { useState, ChangeEvent } from 'react'; +import { FormLabel } from '../Form'; +import { Input } from '../Input'; +import { Modal } from '../Modal'; +import type { DeleteModalProps } from './types'; const StyledDiv = styled.div` padding-top: 8px; @@ -35,15 +36,7 @@ const DescriptionContainer = styled.div` padding-top: 16px; `; -interface DeleteModalProps { - description: ReactNode; - onConfirm: () => void; - onHide: () => void; - open: boolean; - title: ReactNode; -} - -export default function DeleteModal({ +export function DeleteModal({ description, onConfirm, onHide, @@ -104,3 +97,5 @@ export default function DeleteModal({ ); } + +export type { DeleteModalProps }; diff --git a/superset-frontend/src/components/DeleteModal/types.ts b/superset-frontend/src/components/DeleteModal/types.ts new file mode 100644 index 00000000000..f0ba7ff188b --- /dev/null +++ b/superset-frontend/src/components/DeleteModal/types.ts @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import type { ReactNode } from 'react'; + +export interface DeleteModalProps { + description: ReactNode; + onConfirm: () => void; + onHide: () => void; + open: boolean; + title: ReactNode; +} diff --git a/superset-frontend/src/components/Divider/Divider.stories.tsx b/superset-frontend/src/components/Divider/Divider.stories.tsx index 5b5c2f6183c..903fa3b238b 100644 --- a/superset-frontend/src/components/Divider/Divider.stories.tsx +++ b/superset-frontend/src/components/Divider/Divider.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { Divider, DividerProps } from 'src/components/Divider'; +import { Divider } from '.'; +import type { DividerProps } from './types'; export default { title: 'Components/Divider', diff --git a/superset-frontend/src/components/Divider/index.tsx b/superset-frontend/src/components/Divider/index.tsx index 1e0110c8233..7e648c7445a 100644 --- a/superset-frontend/src/components/Divider/index.tsx +++ b/superset-frontend/src/components/Divider/index.tsx @@ -18,10 +18,10 @@ */ import { Divider as AntdDivider } from 'antd-v5'; -import type { DividerProps } from 'antd-v5/es/divider'; +import type { DividerProps } from './types'; export function Divider(props: DividerProps) { return ; } -export { DividerProps }; +export type { DividerProps }; diff --git a/superset-frontend/src/components/Divider/types.ts b/superset-frontend/src/components/Divider/types.ts new file mode 100644 index 00000000000..ba4a29c621d --- /dev/null +++ b/superset-frontend/src/components/Divider/types.ts @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import type { DividerProps } from 'antd-v5/es/divider'; + +export { DividerProps }; diff --git a/superset-frontend/src/components/Dropdown/Dropdown.stories.tsx b/superset-frontend/src/components/Dropdown/Dropdown.stories.tsx index ad4bada55e4..5f0f9717caf 100644 --- a/superset-frontend/src/components/Dropdown/Dropdown.stories.tsx +++ b/superset-frontend/src/components/Dropdown/Dropdown.stories.tsx @@ -17,7 +17,8 @@ * under the License. */ import { Menu } from 'src/components/Menu'; -import { MenuDotsDropdown, MenuDotsDropdownProps } from '.'; +import { MenuDotsDropdown } from '.'; +import type { MenuDotsDropdownProps } from './types'; export default { title: 'Components/Dropdown', diff --git a/superset-frontend/src/components/Dropdown/Dropdown.test.tsx b/superset-frontend/src/components/Dropdown/Dropdown.test.tsx index 192a2fdea94..65ae7208c60 100644 --- a/superset-frontend/src/components/Dropdown/Dropdown.test.tsx +++ b/superset-frontend/src/components/Dropdown/Dropdown.test.tsx @@ -18,7 +18,7 @@ */ import { render, fireEvent, screen } from 'spec/helpers/testing-library'; -import { NoAnimationDropdown } from './index'; // adjust the import path as needed +import { NoAnimationDropdown } from '.'; const props = { overlay:
Test Overlay
, diff --git a/superset-frontend/src/components/Dropdown/index.tsx b/superset-frontend/src/components/Dropdown/index.tsx index 95a60eab459..b634b15b169 100644 --- a/superset-frontend/src/components/Dropdown/index.tsx +++ b/superset-frontend/src/components/Dropdown/index.tsx @@ -16,20 +16,16 @@ * specific language governing permissions and limitations * under the License. */ -import { - ReactElement, - ReactNode, - FocusEvent, - KeyboardEvent, - cloneElement, -} from 'react'; +import { ReactElement, cloneElement } from 'react'; -import { - Dropdown as AntdDropdown, - DropdownProps as AntdDropdownProps, -} from 'antd-v5'; +import { Dropdown as AntdDropdown, DropdownProps } from 'antd-v5'; import { styled } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; +import { + IconOrientation, + type NoAnimationDropdownProps, + type MenuDotsDropdownProps, +} from './types'; const MenuDots = styled.div` width: ${({ theme }) => theme.sizeUnit * 0.75}px; @@ -76,16 +72,6 @@ const MenuDotsWrapper = styled.div` padding-left: ${({ theme }) => theme.sizeUnit}px; `; -export enum IconOrientation { - Vertical = 'vertical', - Horizontal = 'horizontal', -} - -export interface MenuDotsDropdownProps extends AntdDropdownProps { - overlay?: ReactElement; - iconOrientation?: IconOrientation; -} - const RenderIcon = ( iconOrientation: IconOrientation = IconOrientation.Vertical, ) => { @@ -110,12 +96,6 @@ export const MenuDotsDropdown = ({ ); -export interface NoAnimationDropdownProps extends AntdDropdownProps { - children: ReactNode; - onBlur?: (e: FocusEvent) => void; - onKeyDown?: (e: KeyboardEvent) => void; -} - export const NoAnimationDropdown = (props: NoAnimationDropdownProps) => { const { children, onBlur, onKeyDown, ...rest } = props; const childrenWithProps = cloneElement(children as ReactElement, { @@ -130,7 +110,8 @@ export const NoAnimationDropdown = (props: NoAnimationDropdownProps) => { ); }; -export type DropdownProps = AntdDropdownProps; export const Dropdown = (props: DropdownProps) => ( ); + +export type { DropdownProps, NoAnimationDropdownProps, MenuDotsDropdownProps }; diff --git a/superset-frontend/src/components/Dropdown/types.ts b/superset-frontend/src/components/Dropdown/types.ts new file mode 100644 index 00000000000..9a2476d5c14 --- /dev/null +++ b/superset-frontend/src/components/Dropdown/types.ts @@ -0,0 +1,38 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { DropdownProps as AntdDropdownProps } from 'antd-v5'; +import type { ReactElement, ReactNode, FocusEvent, KeyboardEvent } from 'react'; + +export enum IconOrientation { + Vertical = 'vertical', + Horizontal = 'horizontal', +} + +export interface MenuDotsDropdownProps extends AntdDropdownProps { + overlay?: ReactElement; + iconOrientation?: IconOrientation; +} + +export interface NoAnimationDropdownProps extends AntdDropdownProps { + children: ReactNode; + onBlur?: (e: FocusEvent) => void; + onKeyDown?: (e: KeyboardEvent) => void; +} + +export type DropdownProps = AntdDropdownProps; diff --git a/superset-frontend/src/components/DropdownButton/DropdownButton.stories.tsx b/superset-frontend/src/components/DropdownButton/DropdownButton.stories.tsx index 9f661a72804..851d0abcc46 100644 --- a/superset-frontend/src/components/DropdownButton/DropdownButton.stories.tsx +++ b/superset-frontend/src/components/DropdownButton/DropdownButton.stories.tsx @@ -17,7 +17,8 @@ * under the License. */ import { Menu } from 'src/components/Menu'; -import { DropdownButton, DropdownButtonProps } from '.'; +import { DropdownButton } from '.'; +import type { DropdownButtonProps } from './types'; export default { title: 'Components/DropdownButton', diff --git a/superset-frontend/src/components/DropdownButton/index.tsx b/superset-frontend/src/components/DropdownButton/index.tsx index 1eb2f5adfad..d9d39b88186 100644 --- a/superset-frontend/src/components/DropdownButton/index.tsx +++ b/superset-frontend/src/components/DropdownButton/index.tsx @@ -16,17 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { type ComponentProps } from 'react'; - import { Dropdown } from 'antd-v5'; -import { Tooltip, TooltipPlacement } from 'src/components/Tooltip'; import { kebabCase } from 'lodash'; import { css, useTheme } from '@superset-ui/core'; - -export type DropdownButtonProps = ComponentProps & { - tooltip?: string; - tooltipPlacement?: TooltipPlacement; -}; +import { Tooltip } from '../Tooltip'; +import type { DropdownButtonProps } from './types'; export const DropdownButton = ({ dropdownRender, @@ -87,3 +81,5 @@ export const DropdownButton = ({ } return button; }; + +export type { DropdownButtonProps }; diff --git a/superset-frontend/src/components/DropdownButton/types.ts b/superset-frontend/src/components/DropdownButton/types.ts new file mode 100644 index 00000000000..50b15006ffd --- /dev/null +++ b/superset-frontend/src/components/DropdownButton/types.ts @@ -0,0 +1,27 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { type ComponentProps } from 'react'; + +import { Dropdown } from 'antd-v5'; +import type { TooltipPlacement } from '../Tooltip/types'; + +export type DropdownButtonProps = ComponentProps & { + tooltip?: string; + tooltipPlacement?: TooltipPlacement; +}; diff --git a/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx b/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx index a6766e620da..ad99b6b00f7 100644 --- a/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx +++ b/superset-frontend/src/components/DropdownContainer/DropdownContainer.stories.tsx @@ -19,9 +19,10 @@ import { useRef, useCallback, useState } from 'react'; import { isEqual } from 'lodash'; import { css } from '@superset-ui/core'; -import { Select } from 'src/components'; -import Button from '../Button'; -import DropdownContainer, { DropdownContainerProps, Ref } from '.'; +import { Button } from '../Button'; +import { Select } from '../Select'; +import type { DropdownContainerProps, DropdownRef } from './types'; +import { DropdownContainer } from '.'; export default { title: 'Design System/Components/DropdownContainer', @@ -62,7 +63,7 @@ const generateItems = (overflowingState?: OverflowingState) => export const Component = (props: DropdownContainerProps) => { const [items, setItems] = useState([]); const [overflowingState, setOverflowingState] = useState(); - const containerRef = useRef(null); + const containerRef = useRef(null); const onOverflowingStateChange = useCallback( value => { if (!isEqual(overflowingState, value)) { diff --git a/superset-frontend/src/components/DropdownContainer/DropdownContainer.test.tsx b/superset-frontend/src/components/DropdownContainer/DropdownContainer.test.tsx index 7833a1313be..69dcba0f340 100644 --- a/superset-frontend/src/components/DropdownContainer/DropdownContainer.test.tsx +++ b/superset-frontend/src/components/DropdownContainer/DropdownContainer.test.tsx @@ -17,9 +17,9 @@ * under the License. */ import { screen, render, userEvent } from 'spec/helpers/testing-library'; -import Button from '../Button'; -import { Icons } from '../Icons'; -import DropdownContainer from '.'; +import { Icons } from 'src/components/Icons'; +import { Button } from '../Button'; +import { DropdownContainer } from '.'; const generateItems = (n: number) => Array.from({ length: n }).map((_, i) => ({ diff --git a/superset-frontend/src/components/DropdownContainer/index.tsx b/superset-frontend/src/components/DropdownContainer/index.tsx index f8a0db2a8a0..dec6c1b4852 100644 --- a/superset-frontend/src/components/DropdownContainer/index.tsx +++ b/superset-frontend/src/components/DropdownContainer/index.tsx @@ -17,10 +17,8 @@ * under the License. */ import { - CSSProperties, cloneElement, forwardRef, - ReactElement, RefObject, useEffect, useImperativeHandle, @@ -28,93 +26,25 @@ import { useMemo, useState, useRef, - ReactNode, } from 'react'; import { Global } from '@emotion/react'; import { css, t, useTheme, usePrevious } from '@superset-ui/core'; import { useResizeDetector } from 'react-resize-detector'; -import Badge from '../Badge'; -import { Icons } from '../Icons'; -import Button from '../Button'; -import Popover from '../Popover'; +import { Icons } from 'src/components/Icons'; +import { Badge } from '../Badge'; +import { Button } from '../Button'; import { Tooltip } from '../Tooltip'; +import Popover from '../Popover'; +import type { + DropdownContainerProps, + DropdownItem, + DropdownRef, +} from './types'; const MAX_HEIGHT = 500; -/** - * Container item. - */ -export interface Item { - /** - * String that uniquely identifies the item. - */ - id: string; - /** - * The element to be rendered. - */ - element: ReactElement; -} - -/** - * Horizontal container that displays overflowed items in a dropdown. - * It shows an indicator of how many items are currently overflowing. - */ -export interface DropdownContainerProps { - /** - * Array of items. The id property is used to uniquely identify - * the elements when rendering or dealing with event handlers. - */ - items: Item[]; - /** - * Event handler called every time an element moves between - * main container and dropdown. - */ - onOverflowingStateChange?: (overflowingState: { - notOverflowed: string[]; - overflowed: string[]; - }) => void; - /** - * Option to customize the content of the dropdown. - */ - dropdownContent?: (overflowedItems: Item[]) => ReactElement; - /** - * Dropdown ref. - */ - dropdownRef?: RefObject; - /** - * Dropdown additional style properties. - */ - dropdownStyle?: CSSProperties; - /** - * Displayed count in the dropdown trigger. - */ - dropdownTriggerCount?: number; - /** - * Icon of the dropdown trigger. - */ - dropdownTriggerIcon?: ReactElement; - /** - * Text of the dropdown trigger. - */ - dropdownTriggerText?: string; - /** - * Text of the dropdown trigger tooltip - */ - dropdownTriggerTooltip?: ReactNode | null; - /** - * Main container additional style properties. - */ - style?: CSSProperties; - /** - * Force render popover content before it's first opened - */ - forceRender?: boolean; -} - -export type Ref = HTMLDivElement & { open: () => void }; - -const DropdownContainer = forwardRef( +export const DropdownContainer = forwardRef( ( { items, @@ -129,7 +59,7 @@ const DropdownContainer = forwardRef( forceRender, style, }: DropdownContainerProps, - outerRef: RefObject, + outerRef: RefObject, ) => { const theme = useTheme(); const { ref, width = 0 } = useResizeDetector(); @@ -147,7 +77,7 @@ const DropdownContainer = forwardRef( const [showOverflow, setShowOverflow] = useState(false); - const reduceItems = (items: Item[]): [Item[], string[]] => + const reduceItems = (items: DropdownItem[]): [DropdownItem[], string[]] => items.reduce( ([items, ids], item) => { items.push({ @@ -157,7 +87,7 @@ const DropdownContainer = forwardRef( ids.push(item.id); return [items, ids]; }, - [[], []] as [Item[], string[]], + [[], []] as [DropdownItem[], string[]], ); const [notOverflowedItems, notOverflowedIds] = useMemo( @@ -415,4 +345,4 @@ const DropdownContainer = forwardRef( }, ); -export default DropdownContainer; +export type { DropdownItem, DropdownRef }; diff --git a/superset-frontend/src/components/DropdownContainer/types.ts b/superset-frontend/src/components/DropdownContainer/types.ts new file mode 100644 index 00000000000..ea2c33050ea --- /dev/null +++ b/superset-frontend/src/components/DropdownContainer/types.ts @@ -0,0 +1,91 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { CSSProperties, ReactElement, RefObject, ReactNode } from 'react'; + +/** + * Container item. + */ +export interface DropdownItem { + /** + * String that uniquely identifies the item. + */ + id: string; + /** + * The element to be rendered. + */ + element: ReactElement; +} + +/** + * Horizontal container that displays overflowed items in a dropdown. + * It shows an indicator of how many items are currently overflowing. + */ +export interface DropdownContainerProps { + /** + * Array of items. The id property is used to uniquely identify + * the elements when rendering or dealing with event handlers. + */ + items: DropdownItem[]; + /** + * Event handler called every time an element moves between + * main container and dropdown. + */ + onOverflowingStateChange?: (overflowingState: { + notOverflowed: string[]; + overflowed: string[]; + }) => void; + /** + * Option to customize the content of the dropdown. + */ + dropdownContent?: (overflowedItems: DropdownItem[]) => ReactElement; + /** + * Dropdown ref. + */ + dropdownRef?: RefObject; + /** + * Dropdown additional style properties. + */ + dropdownStyle?: CSSProperties; + /** + * Displayed count in the dropdown trigger. + */ + dropdownTriggerCount?: number; + /** + * Icon of the dropdown trigger. + */ + dropdownTriggerIcon?: ReactElement; + /** + * Text of the dropdown trigger. + */ + dropdownTriggerText?: string; + /** + * Text of the dropdown trigger tooltip + */ + dropdownTriggerTooltip?: ReactNode | null; + /** + * Main container additional style properties. + */ + style?: CSSProperties; + /** + * Force render popover content before it's first opened + */ + forceRender?: boolean; +} + +export type DropdownRef = HTMLDivElement & { open: () => void }; diff --git a/superset-frontend/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx b/superset-frontend/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx index 40b04be1cd9..f70859cfb06 100644 --- a/superset-frontend/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx +++ b/superset-frontend/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import DynamicEditableTitle from '.'; +import { DynamicEditableTitle } from '.'; const createProps = (overrides: Record = {}) => ({ title: 'Chart title', diff --git a/superset-frontend/src/components/DynamicEditableTitle/index.tsx b/superset-frontend/src/components/DynamicEditableTitle/index.tsx index 695a4071ab1..a68547fe698 100644 --- a/superset-frontend/src/components/DynamicEditableTitle/index.tsx +++ b/superset-frontend/src/components/DynamicEditableTitle/index.tsx @@ -28,16 +28,9 @@ import { useState, } from 'react'; import { css, SupersetTheme, t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; import { useResizeDetector } from 'react-resize-detector'; - -export type DynamicEditableTitleProps = { - title: string; - placeholder: string; - onSave: (title: string) => void; - canEdit: boolean; - label: string | undefined; -}; +import { Tooltip } from '../Tooltip'; +import type { DynamicEditableTitleProps } from './types'; const titleStyles = (theme: SupersetTheme) => css` display: flex; @@ -79,7 +72,7 @@ const titleStyles = (theme: SupersetTheme) => css` } `; -const DynamicEditableTitle = memo( +export const DynamicEditableTitle = memo( ({ title, placeholder, @@ -226,4 +219,5 @@ const DynamicEditableTitle = memo( ); }, ); -export default DynamicEditableTitle; + +export type { DynamicEditableTitleProps } from './types'; diff --git a/superset-frontend/src/components/DynamicEditableTitle/types.ts b/superset-frontend/src/components/DynamicEditableTitle/types.ts new file mode 100644 index 00000000000..c52801388ae --- /dev/null +++ b/superset-frontend/src/components/DynamicEditableTitle/types.ts @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type DynamicEditableTitleProps = { + title: string; + placeholder: string; + onSave: (title: string) => void; + canEdit: boolean; + label: string | undefined; +}; diff --git a/superset-frontend/src/components/DynamicPlugins/index.tsx b/superset-frontend/src/components/DynamicPlugins/index.tsx index 7650e062596..28538a53ea3 100644 --- a/superset-frontend/src/components/DynamicPlugins/index.tsx +++ b/superset-frontend/src/components/DynamicPlugins/index.tsx @@ -28,25 +28,10 @@ import { makeApi, } from '@superset-ui/core'; import { omitBy } from 'lodash'; +import type { Plugin, PluginAction, PluginContextType } from './types'; const metadataRegistry = getChartMetadataRegistry(); -export type PluginContextType = { - loading: boolean; - /** These are actually only the dynamic plugins */ - dynamicPlugins: { - [key: string]: { - key: string; - mounting: boolean; - error: null | Error; - }; - }; - keys: string[]; - /** Mounted means the plugin's js bundle has been imported */ - mountedPluginMetadata: Record; - fetchAll: () => void; -}; - const dummyPluginContext: PluginContextType = { loading: true, dynamicPlugins: {}, @@ -71,33 +56,6 @@ export const PluginContext = createContext(dummyPluginContext); */ export const usePluginContext = () => useContext(PluginContext); -// the plugin returned from the API -type Plugin = { - name: string; - key: string; - bundle_url: string; - id: number; -}; - -// when a plugin completes loading -type CompleteAction = { - type: 'complete'; - key: string; - error: null | Error; -}; - -// when plugins start loading -type BeginAction = { - type: 'begin'; - keys: string[]; -}; - -type ChangedKeysAction = { - type: 'changed keys'; -}; - -type PluginAction = BeginAction | CompleteAction | ChangedKeysAction; - function getRegistryData() { return { keys: metadataRegistry.keys(), @@ -229,3 +187,5 @@ export const DynamicPluginProvider: FC = ({ children }) => { ); }; + +export type { PluginContextType }; diff --git a/superset-frontend/src/components/DynamicPlugins/types.ts b/superset-frontend/src/components/DynamicPlugins/types.ts new file mode 100644 index 00000000000..24a6bfdfac1 --- /dev/null +++ b/superset-frontend/src/components/DynamicPlugins/types.ts @@ -0,0 +1,62 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ChartMetadata } from '@superset-ui/core'; + +export type PluginContextType = { + loading: boolean; + /** These are actually only the dynamic plugins */ + dynamicPlugins: { + [key: string]: { + key: string; + mounting: boolean; + error: null | Error; + }; + }; + keys: string[]; + /** Mounted means the plugin's js bundle has been imported */ + mountedPluginMetadata: Record; + fetchAll: () => void; +}; + +// the plugin returned from the API +export type Plugin = { + name: string; + key: string; + bundle_url: string; + id: number; +}; + +// when a plugin completes loading +export type CompleteAction = { + type: 'complete'; + key: string; + error: null | Error; +}; + +// when plugins start loading +export type BeginAction = { + type: 'begin'; + keys: string[]; +}; + +export type ChangedKeysAction = { + type: 'changed keys'; +}; + +export type PluginAction = BeginAction | CompleteAction | ChangedKeysAction; diff --git a/superset-frontend/src/components/EditableTitle/EditableTitle.stories.tsx b/superset-frontend/src/components/EditableTitle/EditableTitle.stories.tsx index 5ec902054f3..a0bca59a026 100644 --- a/superset-frontend/src/components/EditableTitle/EditableTitle.stories.tsx +++ b/superset-frontend/src/components/EditableTitle/EditableTitle.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import EditableTitle, { EditableTitleProps } from '.'; +import { EditableTitle } from '.'; +import type { EditableTitleProps } from './types'; export default { title: 'Components/EditableTitle', diff --git a/superset-frontend/src/components/EditableTitle/EditableTitle.test.tsx b/superset-frontend/src/components/EditableTitle/EditableTitle.test.tsx index 12ecfacf780..77c036e1e94 100644 --- a/superset-frontend/src/components/EditableTitle/EditableTitle.test.tsx +++ b/superset-frontend/src/components/EditableTitle/EditableTitle.test.tsx @@ -17,8 +17,7 @@ * under the License. */ import { fireEvent, getByRole, render } from 'spec/helpers/testing-library'; - -import EditableTable from 'src/components/EditableTitle'; +import { EditableTitle as EditableTable } from '.'; const mockEvent = { target: { diff --git a/superset-frontend/src/components/EditableTitle/index.tsx b/superset-frontend/src/components/EditableTitle/index.tsx index 73047e2b84e..fa11623187e 100644 --- a/superset-frontend/src/components/EditableTitle/index.tsx +++ b/superset-frontend/src/components/EditableTitle/index.tsx @@ -20,32 +20,15 @@ import { useEffect, useState, useRef } from 'react'; import { Link } from 'react-router-dom'; import cx from 'classnames'; import { css, styled, SupersetTheme, t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import CertifiedBadge from '../CertifiedBadge'; - -export interface EditableTitleProps { - canEdit?: boolean; - editing?: boolean; - emptyText?: string; - extraClasses?: Array | string; - multiLine?: boolean; - noPermitTooltip?: string; - onSaveTitle: (arg0: string) => void; - showTooltip?: boolean; - style?: object; - title?: string; - defaultTitle?: string; - placeholder?: string; - certifiedBy?: string; - certificationDetails?: string; - url?: string; -} +import { CertifiedBadge } from '../CertifiedBadge'; +import { Tooltip } from '../Tooltip'; +import type { EditableTitleProps } from './types'; const StyledCertifiedBadge = styled(CertifiedBadge)` vertical-align: middle; `; -export default function EditableTitle({ +export function EditableTitle({ canEdit = false, editing = false, extraClasses, @@ -263,3 +246,5 @@ export default function EditableTitle({ ); } + +export type { EditableTitleProps }; diff --git a/superset-frontend/src/components/EditableTitle/types.ts b/superset-frontend/src/components/EditableTitle/types.ts new file mode 100644 index 00000000000..d21799c752b --- /dev/null +++ b/superset-frontend/src/components/EditableTitle/types.ts @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export interface EditableTitleProps { + canEdit?: boolean; + editing?: boolean; + emptyText?: string; + extraClasses?: Array | string; + multiLine?: boolean; + noPermitTooltip?: string; + onSaveTitle: (arg0: string) => void; + showTooltip?: boolean; + style?: object; + title?: string; + defaultTitle?: string; + placeholder?: string; + certifiedBy?: string; + certificationDetails?: string; + url?: string; +} diff --git a/superset-frontend/src/components/EmptyState/Empty.tsx b/superset-frontend/src/components/EmptyState/Empty.tsx index b507027c64d..2384cc142e6 100644 --- a/superset-frontend/src/components/EmptyState/Empty.tsx +++ b/superset-frontend/src/components/EmptyState/Empty.tsx @@ -27,3 +27,5 @@ export const Empty = Object.assign( PRESENTED_IMAGE_DEFAULT: AntdEmpty.PRESENTED_IMAGE_DEFAULT, }, ); + +export type { EmptyProps }; diff --git a/superset-frontend/src/components/EmptyState/EmptyState.stories.tsx b/superset-frontend/src/components/EmptyState/EmptyState.stories.tsx index 2849c648da8..03c7f23cc99 100644 --- a/superset-frontend/src/components/EmptyState/EmptyState.stories.tsx +++ b/superset-frontend/src/components/EmptyState/EmptyState.stories.tsx @@ -18,7 +18,7 @@ * under the License. */ import { Meta, StoryFn } from '@storybook/react'; -import { Row, Col } from 'antd'; +import { Row, Col } from 'antd'; // TODO: Remove antd import { EmptyState, imageMap } from '.'; const emptyStates = [ diff --git a/superset-frontend/src/components/EmptyState/index.tsx b/superset-frontend/src/components/EmptyState/index.tsx index c063dfef251..63aa682f40a 100644 --- a/superset-frontend/src/components/EmptyState/index.tsx +++ b/superset-frontend/src/components/EmptyState/index.tsx @@ -18,7 +18,6 @@ */ import { ReactNode, SyntheticEvent } from 'react'; import { styled, css, SupersetTheme, t } from '@superset-ui/core'; -import Button from 'src/components/Button'; // Importing svg images import FilterResultsImage from 'src/assets/images/filter-results.svg'; @@ -36,7 +35,9 @@ import EmptySqlChartImage from 'src/assets/images/empty_sql_chart.svg'; import EmptyQueryImage from 'src/assets/images/empty-query.svg'; import EmptyTableImage from 'src/assets/images/empty-table.svg'; import EmptyImage from 'src/assets/images/empty.svg'; +import { Button } from '../Button'; import { Empty } from './Empty'; +import type { EmptyStateProps, EmptyStateSize } from './types'; export const imageMap = { 'chart.svg': , @@ -56,18 +57,6 @@ export const imageMap = { 'vector.svg': , }; -type EmptyStateSize = 'small' | 'medium' | 'large'; - -export type EmptyStateProps = { - title?: ReactNode; - description?: ReactNode; - image?: ReactNode | string; - buttonText?: ReactNode; - buttonAction?: (event: SyntheticEvent) => void; - size?: EmptyStateSize; - children?: ReactNode; -}; - const EmptyStateContainer = styled.div` ${({ theme }) => css` display: flex; @@ -112,13 +101,6 @@ const Description = styled.p<{ size: EmptyStateSize }>` `} `; -const ActionButton = styled(Button)` - ${({ theme }) => css` - margin-top: ${theme.sizeUnit * 4}px; - z-index: 1; - `} -`; - const getImageHeight = (size: EmptyStateSize) => { switch (size) { case 'small': @@ -185,15 +167,21 @@ export const EmptyState: React.FC = ({ )} {buttonText && buttonAction && ( - css` + margin-top: ${theme.sizeUnit * 4}px; + z-index: 1; + `} > {buttonText} - + )} {children}
); + +export type { EmptyStateProps }; diff --git a/superset-frontend/src/components/EmptyState/types.ts b/superset-frontend/src/components/EmptyState/types.ts new file mode 100644 index 00000000000..76147a6ba68 --- /dev/null +++ b/superset-frontend/src/components/EmptyState/types.ts @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ReactNode, SyntheticEvent } from 'react'; + +export type EmptyStateSize = 'small' | 'medium' | 'large'; + +export type EmptyStateProps = { + title?: ReactNode; + description?: ReactNode; + image?: ReactNode | string; + buttonText?: ReactNode; + buttonAction?: (event: SyntheticEvent) => void; + size?: EmptyStateSize; + children?: ReactNode; +}; diff --git a/superset-frontend/src/components/ErrorBoundary/ErrorBoundary.test.tsx b/superset-frontend/src/components/ErrorBoundary/ErrorBoundary.test.tsx index 3d04008293b..1b167667a94 100644 --- a/superset-frontend/src/components/ErrorBoundary/ErrorBoundary.test.tsx +++ b/superset-frontend/src/components/ErrorBoundary/ErrorBoundary.test.tsx @@ -18,7 +18,8 @@ */ import { ReactElement } from 'react'; import { render, screen } from 'spec/helpers/testing-library'; -import ErrorBoundary, { ErrorBoundaryProps } from '.'; +import type { ErrorBoundaryProps } from './types'; +import { ErrorBoundary } from '.'; const mockedProps: Partial = { children: Error children, diff --git a/superset-frontend/src/components/ErrorBoundary/index.tsx b/superset-frontend/src/components/ErrorBoundary/index.tsx index c7e60d577f8..1550f5e4f0c 100644 --- a/superset-frontend/src/components/ErrorBoundary/index.tsx +++ b/superset-frontend/src/components/ErrorBoundary/index.tsx @@ -16,23 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -import { Component, ErrorInfo, ReactNode } from 'react'; +import { Component, ErrorInfo } from 'react'; import { t } from '@superset-ui/core'; -import ErrorAlert from 'src/components/ErrorMessage/ErrorAlert'; +import { ErrorAlert } from '../ErrorMessage'; +import type { ErrorBoundaryProps, ErrorBoundaryState } from './types'; -export interface ErrorBoundaryProps { - children: ReactNode; - onError?: (error: Error, info: ErrorInfo) => void; - showMessage?: boolean; - className?: string; -} - -interface ErrorBoundaryState { - error: Error | null; - info: ErrorInfo | null; -} - -export default class ErrorBoundary extends Component< +export class ErrorBoundary extends Component< ErrorBoundaryProps, ErrorBoundaryState > { @@ -70,3 +59,5 @@ export default class ErrorBoundary extends Component< return this.props.children; } } + +export type { ErrorBoundaryProps }; diff --git a/superset-frontend/src/components/ErrorBoundary/types.ts b/superset-frontend/src/components/ErrorBoundary/types.ts new file mode 100644 index 00000000000..48b32124999 --- /dev/null +++ b/superset-frontend/src/components/ErrorBoundary/types.ts @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type { ErrorInfo, ReactNode } from 'react'; + +export interface ErrorBoundaryProps { + children: ReactNode; + onError?: (error: Error, info: ErrorInfo) => void; + showMessage?: boolean; + className?: string; +} + +export interface ErrorBoundaryState { + error: Error | null; + info: ErrorInfo | null; +} diff --git a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx index ad0a97b0116..3b9f1a70490 100644 --- a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.test.tsx @@ -19,7 +19,7 @@ import { render, screen } from 'spec/helpers/testing-library'; import { ErrorLevel, supersetTheme } from '@superset-ui/core'; -import BasicErrorAlert from './BasicErrorAlert'; +import { BasicErrorAlert } from './BasicErrorAlert'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx index 6f915442b06..27a90054b61 100644 --- a/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx +++ b/superset-frontend/src/components/ErrorMessage/BasicErrorAlert.tsx @@ -36,7 +36,7 @@ interface BasicErrorAlertProps { level?: ErrorLevel; } -export default function BasicErrorAlert({ +export function BasicErrorAlert({ body, level = 'error', title, diff --git a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx index b9a98b7ced3..fd8ddee9e0c 100644 --- a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import DatabaseErrorMessage from './DatabaseErrorMessage'; +import { DatabaseErrorMessage } from './DatabaseErrorMessage'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx index 7e9e69ea7ec..aec41e8f5f5 100644 --- a/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatabaseErrorMessage.tsx @@ -19,9 +19,9 @@ import { ReactNode } from 'react'; import { t, tn } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import IssueCode from './IssueCode'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { IssueCode } from './IssueCode'; +import { ErrorAlert } from './ErrorAlert'; interface DatabaseErrorExtra { owners?: string[]; @@ -32,7 +32,7 @@ interface DatabaseErrorExtra { engine_name: string | null; } -function DatabaseErrorMessage({ +export function DatabaseErrorMessage({ error, source, subtitle, @@ -89,5 +89,3 @@ function DatabaseErrorMessage({ /> ); } - -export default DatabaseErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx index f54e29272cc..76d5eefa416 100644 --- a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; import { render, screen } from 'spec/helpers/testing-library'; -import DatasetNotFoundErrorMessage from './DatasetNotFoundErrorMessage'; +import { DatasetNotFoundErrorMessage } from './DatasetNotFoundErrorMessage'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx index 238b345c348..0da2973796a 100644 --- a/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/DatasetNotFoundErrorMessage.tsx @@ -18,10 +18,10 @@ */ import { t } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { ErrorAlert } from './ErrorAlert'; -function DatasetNotFoundErrorMessage({ +export function DatasetNotFoundErrorMessage({ error, subtitle, }: ErrorMessageComponentProps) { @@ -35,5 +35,3 @@ function DatasetNotFoundErrorMessage({ /> ); } - -export default DatasetNotFoundErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.stories.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.stories.tsx index 89b38314eb3..e746afd747b 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.stories.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.stories.tsx @@ -17,10 +17,10 @@ * under the License. */ import { Meta, StoryFn } from '@storybook/react'; -import Layout from 'src/components/Layout'; -import { Row, Col } from 'src/components/Grid'; -import Card from 'src/components/Card'; -import ErrorAlert from './ErrorAlert'; +import { Layout } from '../Layout'; +import { Card } from '../Card'; +import { Row, Col } from '../Grid'; +import { ErrorAlert } from './ErrorAlert'; const { Content } = Layout; diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx index 706d59f1219..b6f819f409d 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx @@ -19,7 +19,7 @@ import { screen, fireEvent } from '@testing-library/react'; import { render } from 'spec/helpers/testing-library'; -import ErrorAlert from './ErrorAlert'; +import { ErrorAlert } from './ErrorAlert'; describe('ErrorAlert', () => { it('renders the error message correctly', () => { diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx index f1d31ba928a..0e4c332592a 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.tsx @@ -17,28 +17,14 @@ * under the License. */ import { useState } from 'react'; -import { Tooltip } from 'src/components/Tooltip'; -import Modal from 'src/components/Modal'; import { Icons } from 'src/components/Icons'; -import Alert from 'src/components/Alert'; import { t, useTheme } from '@superset-ui/core'; +import { Tooltip } from '../Tooltip'; +import { Alert } from '../Alert'; +import { Modal } from '../Modal'; +import type { ErrorAlertProps } from './types'; -export interface ErrorAlertProps { - errorType?: string; // Strong text on the first line - message: React.ReactNode | string; // Text shown on the first line - type?: 'warning' | 'error' | 'info'; // Allows only 'warning' or 'error' - description?: React.ReactNode; // Text shown under the first line, not collapsible - descriptionDetails?: React.ReactNode | string; // Text shown under the first line, collapsible - descriptionDetailsCollapsed?: boolean; // Hides the collapsible section unless "Show more" is clicked, default true - descriptionPre?: boolean; // Uses pre-style to break lines, default true - compact?: boolean; // Shows the error icon with tooltip and modal, default false - children?: React.ReactNode; // Additional content to show in the modal - closable?: boolean; // Show close button, default true - showIcon?: boolean; // Show icon, default true - className?: string; -} - -const ErrorAlert: React.FC = ({ +export const ErrorAlert: React.FC = ({ errorType = t('Error'), message, type = 'error', @@ -112,7 +98,7 @@ const ErrorAlert: React.FC = ({ message={errorType} description={renderDescription()} type={type} - showIcon + showIcon={showIcon} closable={closable} className={className} /> @@ -141,5 +127,3 @@ const ErrorAlert: React.FC = ({ return renderAlert(closable); }; - -export default ErrorAlert; diff --git a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx index f9a3415ace2..b9003b5bfec 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.test.tsx @@ -19,8 +19,8 @@ import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import ErrorMessageWithStackTrace from './ErrorMessageWithStackTrace'; -import BasicErrorAlert from './BasicErrorAlert'; +import { ErrorMessageWithStackTrace } from './ErrorMessageWithStackTrace'; +import { BasicErrorAlert } from './BasicErrorAlert'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx index b993927a7cd..86f36bcd723 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorMessageWithStackTrace.tsx @@ -18,8 +18,8 @@ */ import { ReactNode } from 'react'; import { ErrorSource, t, SupersetError } from '@superset-ui/core'; -import getErrorMessageComponentRegistry from './getErrorMessageComponentRegistry'; -import ErrorAlert from './ErrorAlert'; +import { getErrorMessageComponentRegistry } from './getErrorMessageComponentRegistry'; +import { ErrorAlert } from './ErrorAlert'; const DEFAULT_TITLE = t('Unexpected error'); @@ -38,7 +38,7 @@ type Props = { compact?: boolean; }; -export default function ErrorMessageWithStackTrace({ +export function ErrorMessageWithStackTrace({ title = DEFAULT_TITLE, error, subtitle, diff --git a/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.test.tsx index c364501c67d..32026052eed 100644 --- a/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import FrontendNetworkErrorMessage from './FrontendNetworkErrorMessage'; +import { FrontendNetworkErrorMessage } from './FrontendNetworkErrorMessage'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.tsx index 303735ca49d..11a32a9682c 100644 --- a/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/FrontendNetworkErrorMessage.tsx @@ -18,10 +18,10 @@ */ import { t } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { ErrorAlert } from './ErrorAlert'; -function FrontendNetworkErrorMessage({ +export function FrontendNetworkErrorMessage({ error, subtitle, compact, @@ -36,4 +36,3 @@ function FrontendNetworkErrorMessage({ /> ); } -export default FrontendNetworkErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.test.tsx index 423566aa3a9..b19fa219b28 100644 --- a/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.test.tsx @@ -18,7 +18,7 @@ import { render, cleanup } from 'spec/helpers/testing-library'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; -import InvalidSQLErrorMessage from './InvalidSQLErrorMessage'; +import { InvalidSQLErrorMessage } from './InvalidSQLErrorMessage'; const defaultProps = { error: { diff --git a/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.tsx index 21236e92a02..e25fa3aea9c 100644 --- a/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/InvalidSQLErrorMessage.tsx @@ -18,8 +18,8 @@ */ import { t } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { ErrorAlert } from './ErrorAlert'; interface SupersetParseErrorExtra { sql: string; @@ -31,7 +31,7 @@ interface SupersetParseErrorExtra { /* * Component for showing syntax errors in SQL Lab. */ -function InvalidSQLErrorMessage({ +export function InvalidSQLErrorMessage({ error, source, subtitle, @@ -60,5 +60,3 @@ function InvalidSQLErrorMessage({ /> ); } - -export default InvalidSQLErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx b/superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx index 7e75ae9067b..7c711397419 100644 --- a/superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/IssueCode.test.tsx @@ -18,7 +18,7 @@ */ import { render, screen } from 'spec/helpers/testing-library'; -import IssueCode from './IssueCode'; +import { IssueCode } from './IssueCode'; const mockedProps = { code: 1, diff --git a/superset-frontend/src/components/ErrorMessage/IssueCode.tsx b/superset-frontend/src/components/ErrorMessage/IssueCode.tsx index af8ab9c7910..e0aacdbaab0 100644 --- a/superset-frontend/src/components/ErrorMessage/IssueCode.tsx +++ b/superset-frontend/src/components/ErrorMessage/IssueCode.tsx @@ -24,7 +24,7 @@ interface IssueCodeProps { message: string; } -export default function IssueCode({ code, message }: IssueCodeProps) { +export function IssueCode({ code, message }: IssueCodeProps) { const theme = useTheme(); return ( <> diff --git a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx index bde3ee0667b..c2f0a938ba7 100644 --- a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { render, screen, fireEvent } from 'spec/helpers/testing-library'; import { ErrorLevel, ErrorTypeEnum } from '@superset-ui/core'; -import MarshmallowErrorMessage from './MarshmallowErrorMessage'; +import { MarshmallowErrorMessage } from './MarshmallowErrorMessage'; describe('MarshmallowErrorMessage', () => { const mockError = { diff --git a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx index 0251de7882d..19f11fbef35 100644 --- a/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/MarshmallowErrorMessage.tsx @@ -20,8 +20,8 @@ import { JSONTree } from 'react-json-tree'; import { styled, t } from '@superset-ui/core'; import { useJsonTreeTheme } from 'src/hooks/useJsonTreeTheme'; -import Collapse from 'src/components/Collapse'; -import { ErrorMessageComponentProps } from './types'; +import { Collapse } from '../Collapse'; +import type { ErrorMessageComponentProps } from './types'; interface MarshmallowErrorExtra { messages: object; @@ -64,7 +64,7 @@ const extractInvalidValues = (messages: object, payload: object): string[] => { return invalidValues; }; -export default function MarshmallowErrorMessage({ +export function MarshmallowErrorMessage({ error, // eslint-disable-next-line @typescript-eslint/no-unused-vars source = 'crud', diff --git a/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx index 3edc1b7d6a6..99ecf894dc9 100644 --- a/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx @@ -22,10 +22,10 @@ import { Provider } from 'react-redux'; import { createStore } from 'redux'; import { render, fireEvent, waitFor } from 'spec/helpers/testing-library'; import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; -import OAuth2RedirectMessage from 'src/components/ErrorMessage/OAuth2RedirectMessage'; import { reRunQuery } from 'src/SqlLab/actions/sqlLab'; import { triggerQuery } from 'src/components/Chart/chartAction'; import { onRefresh } from 'src/dashboard/actions/dashboardState'; +import { OAuth2RedirectMessage } from '.'; // Mock the Redux store const mockStore = createStore(() => ({ diff --git a/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx b/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx index 0e2bad17d1c..0c5073dd57d 100644 --- a/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx @@ -27,8 +27,8 @@ import { triggerQuery } from 'src/components/Chart/chartAction'; import { onRefresh } from 'src/dashboard/actions/dashboardState'; import { QueryResponse, t } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { ErrorAlert } from './ErrorAlert'; interface OAuth2RedirectExtra { url: string; @@ -59,7 +59,7 @@ interface OAuth2RedirectExtra { * by the backend and sent from the opened tab to the original tab. For extra security, * we also check that the source of the message is the opened tab via a ref. */ -function OAuth2RedirectMessage({ +export function OAuth2RedirectMessage({ error, source, }: ErrorMessageComponentProps) { @@ -175,5 +175,3 @@ function OAuth2RedirectMessage({ /> ); } - -export default OAuth2RedirectMessage; diff --git a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx index e2fc8b92e80..1ad69a21d0a 100644 --- a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { ErrorLevel, ErrorSource, ErrorTypeEnum } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import ParameterErrorMessage from './ParameterErrorMessage'; +import { ParameterErrorMessage } from './ParameterErrorMessage'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx index 5fbf31d1ffd..5a333fc3c17 100644 --- a/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/ParameterErrorMessage.tsx @@ -21,8 +21,8 @@ import { t, tn } from '@superset-ui/core'; import levenshtein from 'js-levenshtein'; import { ErrorMessageComponentProps } from './types'; -import IssueCode from './IssueCode'; -import ErrorAlert from './ErrorAlert'; +import { IssueCode } from './IssueCode'; +import { ErrorAlert } from './ErrorAlert'; interface ParameterErrorExtra { undefined_parameters?: string[]; @@ -51,7 +51,7 @@ const findMatches = (undefinedParameters: string[], templateKeys: string[]) => { return matches; }; -function ParameterErrorMessage({ +export function ParameterErrorMessage({ error, source = 'sqllab', subtitle, @@ -117,5 +117,3 @@ function ParameterErrorMessage({ /> ); } - -export default ParameterErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx index 8fb2e3d041d..fa10f0a474c 100644 --- a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.test.tsx @@ -19,7 +19,7 @@ import { ErrorSource, ErrorTypeEnum, ErrorLevel } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import TimeoutErrorMessage from './TimeoutErrorMessage'; +import { TimeoutErrorMessage } from './TimeoutErrorMessage'; jest.mock( 'src/components/Icons/AsyncIcon', diff --git a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.tsx b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.tsx index f0df59e1474..64d3e48ff75 100644 --- a/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.tsx +++ b/superset-frontend/src/components/ErrorMessage/TimeoutErrorMessage.tsx @@ -19,9 +19,9 @@ import { ReactNode } from 'react'; import { t, tn } from '@superset-ui/core'; -import { ErrorMessageComponentProps } from './types'; -import IssueCode from './IssueCode'; -import ErrorAlert from './ErrorAlert'; +import type { ErrorMessageComponentProps } from './types'; +import { IssueCode } from './IssueCode'; +import { ErrorAlert } from './ErrorAlert'; interface TimeoutErrorExtra { issue_codes: { @@ -32,7 +32,7 @@ interface TimeoutErrorExtra { timeout: number; } -function TimeoutErrorMessage({ +export function TimeoutErrorMessage({ error, source, }: ErrorMessageComponentProps) { @@ -97,5 +97,3 @@ function TimeoutErrorMessage({ /> ); } - -export default TimeoutErrorMessage; diff --git a/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.test.tsx b/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.test.tsx index 03c7c4be705..0d54b546571 100644 --- a/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.test.tsx @@ -16,8 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import getErrorMessageComponentRegistry from 'src/components/ErrorMessage/getErrorMessageComponentRegistry'; -import { ErrorMessageComponentProps } from 'src/components/ErrorMessage/types'; +import type { ErrorMessageComponentProps } from './types'; +import { getErrorMessageComponentRegistry } from './getErrorMessageComponentRegistry'; // eslint-disable-next-line @typescript-eslint/no-unused-vars const ERROR_MESSAGE_COMPONENT = (_: ErrorMessageComponentProps) => ( diff --git a/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.ts b/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.ts index 9f69f9ab2d8..3e6f057edc8 100644 --- a/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.ts +++ b/superset-frontend/src/components/ErrorMessage/getErrorMessageComponentRegistry.ts @@ -17,7 +17,7 @@ * under the License. */ import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core'; -import { ErrorMessageComponent } from './types'; +import type { ErrorMessageComponent } from './types'; class ErrorMessageComponentRegistry extends Registry< ErrorMessageComponent, @@ -31,8 +31,6 @@ class ErrorMessageComponentRegistry extends Registry< } } -const getErrorMessageComponentRegistry = makeSingleton( +export const getErrorMessageComponentRegistry = makeSingleton( ErrorMessageComponentRegistry, ); - -export default getErrorMessageComponentRegistry; diff --git a/superset-frontend/src/components/ErrorMessage/index.tsx b/superset-frontend/src/components/ErrorMessage/index.tsx new file mode 100644 index 00000000000..c8898acfc31 --- /dev/null +++ b/superset-frontend/src/components/ErrorMessage/index.tsx @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export { BasicErrorAlert } from './BasicErrorAlert'; +export { DatabaseErrorMessage } from './DatabaseErrorMessage'; +export { DatasetNotFoundErrorMessage } from './DatasetNotFoundErrorMessage'; +export { ErrorAlert } from './ErrorAlert'; +export { ErrorMessageWithStackTrace } from './ErrorMessageWithStackTrace'; +export { getErrorMessageComponentRegistry } from './getErrorMessageComponentRegistry'; +export { FrontendNetworkErrorMessage } from './FrontendNetworkErrorMessage'; +export { InvalidSQLErrorMessage } from './InvalidSQLErrorMessage'; +export { IssueCode } from './IssueCode'; +export { MarshmallowErrorMessage } from './MarshmallowErrorMessage'; +export { OAuth2RedirectMessage } from './OAuth2RedirectMessage'; +export { ParameterErrorMessage } from './ParameterErrorMessage'; +export { TimeoutErrorMessage } from './TimeoutErrorMessage'; + +export type { ErrorAlertProps, ErrorMessageComponentProps } from './types'; diff --git a/superset-frontend/src/components/ErrorMessage/types.ts b/superset-frontend/src/components/ErrorMessage/types.ts index bb3d39c255f..de38332fa6b 100644 --- a/superset-frontend/src/components/ErrorMessage/types.ts +++ b/superset-frontend/src/components/ErrorMessage/types.ts @@ -17,8 +17,8 @@ * under the License. */ -import { ReactNode, ComponentType } from 'react'; -import { ErrorSource, SupersetError } from '@superset-ui/core'; +import type { ReactNode, ComponentType } from 'react'; +import type { ErrorSource, SupersetError } from '@superset-ui/core'; export type ErrorMessageComponentProps | null> = { @@ -29,3 +29,18 @@ export type ErrorMessageComponentProps | null> = }; export type ErrorMessageComponent = ComponentType; + +export interface ErrorAlertProps { + errorType?: string; // Strong text on the first line + message: React.ReactNode | string; // Text shown on the first line + type?: 'warning' | 'error' | 'info'; // Allows only 'warning' or 'error' + description?: React.ReactNode; // Text shown under the first line, not collapsible + descriptionDetails?: React.ReactNode | string; // Text shown under the first line, collapsible + descriptionDetailsCollapsed?: boolean; // Hides the collapsible section unless "Show more" is clicked, default true + descriptionPre?: boolean; // Uses pre-style to break lines, default true + compact?: boolean; // Shows the error icon with tooltip and modal, default false + children?: React.ReactNode; // Additional content to show in the modal + closable?: boolean; // Show close button, default true + showIcon?: boolean; // Show icon, default true + className?: string; +} diff --git a/superset-frontend/src/components/FacePile/FacePile.stories.tsx b/superset-frontend/src/components/FacePile/FacePile.stories.tsx index d9db309a6db..b3e122c056a 100644 --- a/superset-frontend/src/components/FacePile/FacePile.stories.tsx +++ b/superset-frontend/src/components/FacePile/FacePile.stories.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import FacePile from '.'; +import { FacePile } from '.'; export default { title: 'Components/FacePile', diff --git a/superset-frontend/src/components/FacePile/FacePile.test.tsx b/superset-frontend/src/components/FacePile/FacePile.test.tsx index f947ad4c8e2..80fade7d8ce 100644 --- a/superset-frontend/src/components/FacePile/FacePile.test.tsx +++ b/superset-frontend/src/components/FacePile/FacePile.test.tsx @@ -18,7 +18,7 @@ */ import { act, fireEvent, render, screen } from 'spec/helpers/testing-library'; import { store } from 'src/views/store'; -import FacePile from '.'; +import { FacePile } from '.'; import { getRandomColor } from './utils'; const users = [...new Array(10)].map((_, i) => ({ diff --git a/superset-frontend/src/components/FacePile/index.tsx b/superset-frontend/src/components/FacePile/index.tsx index b4c12c48f47..f060e41ed28 100644 --- a/superset-frontend/src/components/FacePile/index.tsx +++ b/superset-frontend/src/components/FacePile/index.tsx @@ -16,25 +16,21 @@ * specific language governing permissions and limitations * under the License. */ -import type Owner from 'src/types/Owner'; + import { getCategoricalSchemeRegistry, isFeatureEnabled, FeatureFlag, } from '@superset-ui/core'; import getOwnerName from 'src/utils/getOwnerName'; -import { Tooltip } from 'src/components/Tooltip'; -import { Avatar, AvatarGroup } from 'src/components/Avatar'; +import { Tooltip } from '../Tooltip'; +import { Avatar, AvatarGroup } from '../Avatar'; import { getRandomColor } from './utils'; - -interface FacePileProps { - users: Owner[]; - maxCount?: number; -} +import type { FacePileProps } from './types'; const colorList = getCategoricalSchemeRegistry().get()?.colors ?? []; -export default function FacePile({ users, maxCount = 4 }: FacePileProps) { +export function FacePile({ users, maxCount = 4 }: FacePileProps) { return ( {users.map(user => { @@ -64,3 +60,5 @@ export default function FacePile({ users, maxCount = 4 }: FacePileProps) { ); } + +export type { FacePileProps }; diff --git a/superset-frontend/src/components/FacePile/types.ts b/superset-frontend/src/components/FacePile/types.ts new file mode 100644 index 00000000000..2fffa11b0e5 --- /dev/null +++ b/superset-frontend/src/components/FacePile/types.ts @@ -0,0 +1,24 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import type Owner from 'src/types/Owner'; + +export interface FacePileProps { + users: Owner[]; + maxCount?: number; +} diff --git a/superset-frontend/src/components/FaveStar/FaveStar.stories.tsx b/superset-frontend/src/components/FaveStar/FaveStar.stories.tsx index 7c993d6fac2..6834c4495c2 100644 --- a/superset-frontend/src/components/FaveStar/FaveStar.stories.tsx +++ b/superset-frontend/src/components/FaveStar/FaveStar.stories.tsx @@ -17,7 +17,7 @@ * under the License. */ import type { Meta, StoryObj } from '@storybook/react'; -import FaveStar from 'src/components/FaveStar'; +import { FaveStar } from '.'; export default { title: 'Components/FaveStar', diff --git a/superset-frontend/src/components/FaveStar/FaveStar.test.tsx b/superset-frontend/src/components/FaveStar/FaveStar.test.tsx index f8c63500f6a..89a51085768 100644 --- a/superset-frontend/src/components/FaveStar/FaveStar.test.tsx +++ b/superset-frontend/src/components/FaveStar/FaveStar.test.tsx @@ -18,7 +18,7 @@ */ import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import FaveStar from '.'; +import { FaveStar } from '.'; jest.mock('src/components/Tooltip', () => ({ Tooltip: (props: any) =>
, diff --git a/superset-frontend/src/components/FaveStar/index.tsx b/superset-frontend/src/components/FaveStar/index.tsx index d349640ba97..c150fc3a839 100644 --- a/superset-frontend/src/components/FaveStar/index.tsx +++ b/superset-frontend/src/components/FaveStar/index.tsx @@ -20,16 +20,9 @@ import { useCallback, useEffect, MouseEvent } from 'react'; import { css, t, styled, useTheme } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; - -export interface FaveStarProps { - itemId: number; - isStarred?: boolean; - showTooltip?: boolean; - saveFaveStar(id: number, isStarred: boolean): any; - fetchFaveStar?: (id: number) => void; -} +import { Tooltip } from '../Tooltip'; +import type { FaveStarProps } from './types'; const StyledLink = styled.a` ${({ theme }) => css` @@ -39,7 +32,7 @@ const StyledLink = styled.a` `}; `; -const FaveStar = ({ +export const FaveStar = ({ itemId, isStarred, showTooltip, @@ -96,4 +89,5 @@ const FaveStar = ({ return content; }; -export default FaveStar; + +export type { FaveStarProps }; diff --git a/superset-frontend/src/components/FaveStar/types.ts b/superset-frontend/src/components/FaveStar/types.ts new file mode 100644 index 00000000000..cc69a957167 --- /dev/null +++ b/superset-frontend/src/components/FaveStar/types.ts @@ -0,0 +1,25 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export interface FaveStarProps { + itemId: number; + isStarred?: boolean; + showTooltip?: boolean; + saveFaveStar(id: number, isStarred: boolean): any; + fetchFaveStar?: (id: number) => void; +} diff --git a/superset-frontend/src/components/FilterableTable/FilterableTable.stories.tsx b/superset-frontend/src/components/FilterableTable/FilterableTable.stories.tsx index f4525f304e5..d77e270d079 100644 --- a/superset-frontend/src/components/FilterableTable/FilterableTable.stories.tsx +++ b/superset-frontend/src/components/FilterableTable/FilterableTable.stories.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import FilterableTable, { FilterableTableProps } from '.'; +import type { FilterableTableProps } from './types'; +import { FilterableTable } from '.'; export default { title: 'Components/FilterableTable', diff --git a/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx b/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx index 8e07d0e97f4..b5a5ceaeec5 100644 --- a/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx +++ b/superset-frontend/src/components/FilterableTable/FilterableTable.test.tsx @@ -17,7 +17,6 @@ * under the License. */ import { isValidElement } from 'react'; -import FilterableTable from 'src/components/FilterableTable'; import { render, screen, @@ -25,6 +24,7 @@ import { within, } from 'spec/helpers/testing-library'; import { setupAGGridModules } from 'src/setup/setupAGGridModules'; +import { FilterableTable } from '.'; describe('FilterableTable', () => { beforeAll(() => { diff --git a/superset-frontend/src/components/FilterableTable/index.tsx b/superset-frontend/src/components/FilterableTable/index.tsx index 920e7d68cd6..989aad50315 100644 --- a/superset-frontend/src/components/FilterableTable/index.tsx +++ b/superset-frontend/src/components/FilterableTable/index.tsx @@ -18,9 +18,13 @@ */ import { useMemo, useRef, useCallback } from 'react'; import { styled } from '@superset-ui/core'; +import type { ColDef } from '../GridTable/types'; +import { GridSize } from '../GridTable/constants'; +import { GridTable } from '../GridTable'; import { useCellContentParser } from './useCellContentParser'; import { renderResultCell } from './utils'; -import GridTable, { GridSize, ColDef } from '../GridTable'; + +import type { FilterableTableProps, Datum, CellDataType } from './types'; // This regex handles all possible number formats in javascript, including ints, floats, // exponential notation, NaN, and Infinity. @@ -32,23 +36,6 @@ const StyledFilterableTable = styled.div` overflow: hidden; `; -type CellDataType = string | number | null; -type Datum = Record; - -export interface FilterableTableProps { - orderedColumnKeys: string[]; - data: Record[]; - height: number; - filterText?: string; - headerHeight?: number; - overscanColumnCount?: number; - overscanRowCount?: number; - rowHeight?: number; - striped?: boolean; - expandedColumns?: string[]; - allowHTML?: boolean; -} - const parseNumberFromString = (value: string | number | null) => { if (typeof value === 'string' && ONLY_NUMBER_REGEX.test(value)) { return parseFloat(value); @@ -76,7 +63,7 @@ const sortResults = (valueA: string | number, valueB: string | number) => { return aValue < bValue ? -1 : 1; }; -const FilterableTable = ({ +export const FilterableTable = ({ orderedColumnKeys, data, height, @@ -159,4 +146,4 @@ const FilterableTable = ({ ); }; -export default FilterableTable; +export type { FilterableTableProps }; diff --git a/superset-frontend/src/components/FilterableTable/types.ts b/superset-frontend/src/components/FilterableTable/types.ts new file mode 100644 index 00000000000..97292aedd45 --- /dev/null +++ b/superset-frontend/src/components/FilterableTable/types.ts @@ -0,0 +1,34 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type CellDataType = string | number | null; +export type Datum = Record; + +export interface FilterableTableProps { + orderedColumnKeys: string[]; + data: Record[]; + height: number; + filterText?: string; + headerHeight?: number; + overscanColumnCount?: number; + overscanRowCount?: number; + rowHeight?: number; + striped?: boolean; + expandedColumns?: string[]; + allowHTML?: boolean; +} diff --git a/superset-frontend/src/components/FilterableTable/utils.tsx b/superset-frontend/src/components/FilterableTable/utils.tsx index a4e4a4c8445..c0c8b576657 100644 --- a/superset-frontend/src/components/FilterableTable/utils.tsx +++ b/superset-frontend/src/components/FilterableTable/utils.tsx @@ -16,8 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -import { JsonModal, safeJsonObjectParse } from 'src/components/JsonModal'; import { t, safeHtmlSpan } from '@superset-ui/core'; +import { JsonModal } from '../JsonModal'; +import { safeJsonObjectParse } from '../JsonModal/utils'; import { NULL_STRING, CellDataType } from './useCellContentParser'; type CellParams = { diff --git a/superset-frontend/src/components/FlashProvider/FlashProvider.test.tsx b/superset-frontend/src/components/FlashProvider/FlashProvider.test.tsx index f7e41d9a766..6b93e4009d7 100644 --- a/superset-frontend/src/components/FlashProvider/FlashProvider.test.tsx +++ b/superset-frontend/src/components/FlashProvider/FlashProvider.test.tsx @@ -20,7 +20,8 @@ import { render, screen } from 'spec/helpers/testing-library'; import { Provider } from 'react-redux'; import { store } from 'src/views/store'; -import FlashProvider, { FlashMessage } from './index'; +import type { FlashMessage } from './types'; +import { FlashProvider } from '.'; test('Rerendering correctly with default props', () => { const messages: FlashMessage[] = []; diff --git a/superset-frontend/src/components/FlashProvider/index.tsx b/superset-frontend/src/components/FlashProvider/index.tsx index b9e8e4a8e21..d6c07d4652b 100644 --- a/superset-frontend/src/components/FlashProvider/index.tsx +++ b/superset-frontend/src/components/FlashProvider/index.tsx @@ -18,9 +18,7 @@ */ import { useToasts } from 'src/components/MessageToasts/withToasts'; import { useComponentDidMount } from '@superset-ui/core'; - -type FlashMessageType = 'info' | 'alert' | 'danger' | 'warning' | 'success'; -export type FlashMessage = [FlashMessageType, string]; +import type { FlashMessage } from './types'; interface Props { children: JSX.Element; @@ -35,7 +33,7 @@ const flashObj = { success: 'addSuccessToast', }; -export default function FlashProvider({ children, messages }: Props) { +export function FlashProvider({ children, messages }: Props) { const toasts = useToasts(); useComponentDidMount(() => { messages.forEach(message => { @@ -49,3 +47,5 @@ export default function FlashProvider({ children, messages }: Props) { }); return children; } + +export type { FlashMessage }; diff --git a/superset-frontend/src/components/FlashProvider/types.ts b/superset-frontend/src/components/FlashProvider/types.ts new file mode 100644 index 00000000000..8716eb985bb --- /dev/null +++ b/superset-frontend/src/components/FlashProvider/types.ts @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +type FlashMessageType = 'info' | 'alert' | 'danger' | 'warning' | 'success'; +export type FlashMessage = [FlashMessageType, string]; diff --git a/superset-frontend/src/components/Flex/Flex.stories.tsx b/superset-frontend/src/components/Flex/Flex.stories.tsx index 7e7b1c5b194..d666ee920d0 100644 --- a/superset-frontend/src/components/Flex/Flex.stories.tsx +++ b/superset-frontend/src/components/Flex/Flex.stories.tsx @@ -17,8 +17,9 @@ * under the License. */ -import { Flex, FlexProps } from 'src/components/Flex'; import { css } from '@superset-ui/core'; +import { Flex } from '.'; +import type { FlexProps } from './types'; export default { title: 'Design System/Components/Flex', diff --git a/superset-frontend/src/components/Flex/Flex.test.tsx b/superset-frontend/src/components/Flex/Flex.test.tsx index 863c3a012ca..dbbca7983e0 100644 --- a/superset-frontend/src/components/Flex/Flex.test.tsx +++ b/superset-frontend/src/components/Flex/Flex.test.tsx @@ -18,7 +18,7 @@ */ import { render } from 'spec/helpers/testing-library'; -import { Flex } from 'src/components/Flex'; +import { Flex } from '.'; test('should render', () => { const { container } = render( diff --git a/superset-frontend/src/components/Flex/index.tsx b/superset-frontend/src/components/Flex/index.tsx index bed64a5949d..5f04bd6327b 100644 --- a/superset-frontend/src/components/Flex/index.tsx +++ b/superset-frontend/src/components/Flex/index.tsx @@ -18,10 +18,10 @@ */ import { Flex as AntdFlex } from 'antd-v5'; -import { ComponentProps } from 'react'; - -export type FlexProps = ComponentProps; +import type { FlexProps } from './types'; export function Flex(props: FlexProps) { return ; } + +export type { FlexProps }; diff --git a/superset-frontend/src/components/Flex/types.ts b/superset-frontend/src/components/Flex/types.ts new file mode 100644 index 00000000000..dda4ea762f2 --- /dev/null +++ b/superset-frontend/src/components/Flex/types.ts @@ -0,0 +1,22 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { Flex as AntdFlex } from 'antd-v5'; +import { ComponentProps } from 'react'; + +export type FlexProps = ComponentProps; diff --git a/superset-frontend/src/components/Form/Form.tsx b/superset-frontend/src/components/Form/Form.tsx index dcbcc173a34..113d36953ab 100644 --- a/superset-frontend/src/components/Form/Form.tsx +++ b/superset-frontend/src/components/Form/Form.tsx @@ -17,18 +17,16 @@ * under the License. */ import { Form as AntdForm } from 'antd-v5'; -import { FormProps, FormInstance, FormItemProps } from 'antd-v5/es/form'; +import { FormProps } from './types'; -function Form(props: FormProps) { +function CustomForm(props: FormProps) { return ; } -export default Object.assign(Form, { +export const Form = Object.assign(CustomForm, { useForm: AntdForm.useForm, Item: AntdForm.Item, List: AntdForm.List, ErrorList: AntdForm.ErrorList, Provider: AntdForm.Provider, }); - -export type { FormProps, FormInstance, FormItemProps }; diff --git a/superset-frontend/src/components/Form/FormItem.tsx b/superset-frontend/src/components/Form/FormItem.tsx index 84bd2b180d6..e77296213b0 100644 --- a/superset-frontend/src/components/Form/FormItem.tsx +++ b/superset-frontend/src/components/Form/FormItem.tsx @@ -19,7 +19,7 @@ import { Form } from 'antd-v5'; import { styled } from '@superset-ui/core'; -const StyledItem = styled(Form.Item)` +export const FormItem = styled(Form.Item)` ${({ theme }) => ` margin-bottom: 0; .antd5-form-item-label { @@ -40,5 +40,3 @@ const StyledItem = styled(Form.Item)` } `} `; - -export default StyledItem; diff --git a/superset-frontend/src/components/Form/FormLabel.tsx b/superset-frontend/src/components/Form/FormLabel.tsx index 6e33fb98a6e..f6b3fcbdfd3 100644 --- a/superset-frontend/src/components/Form/FormLabel.tsx +++ b/superset-frontend/src/components/Form/FormLabel.tsx @@ -40,7 +40,7 @@ const Label = styled.label<{ required?: boolean }>` `} `; -export default function FormLabel({ +export function FormLabel({ children, htmlFor, required = false, diff --git a/superset-frontend/src/components/Form/LabeledErrorBoundInput.stories.tsx b/superset-frontend/src/components/Form/LabeledErrorBoundInput.stories.tsx index dbe922200d2..28b2b5f1add 100644 --- a/superset-frontend/src/components/Form/LabeledErrorBoundInput.stories.tsx +++ b/superset-frontend/src/components/Form/LabeledErrorBoundInput.stories.tsx @@ -17,9 +17,8 @@ * under the License. */ import { useState } from 'react'; -import LabeledErrorBoundInput, { - LabeledErrorBoundInputProps, -} from './LabeledErrorBoundInput'; +import type { LabeledErrorBoundInputProps } from './types'; +import { LabeledErrorBoundInput } from './LabeledErrorBoundInput'; export default { title: 'Components/Form/LabeledErrorBoundInput', diff --git a/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx b/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx index c5ed00830d2..03cfdf15ea5 100644 --- a/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx +++ b/superset-frontend/src/components/Form/LabeledErrorBoundInput.test.jsx @@ -17,7 +17,7 @@ * under the License. */ import { render, fireEvent, screen } from 'spec/helpers/testing-library'; -import LabeledErrorBoundInput from 'src/components/Form/LabeledErrorBoundInput'; +import { LabeledErrorBoundInput } from './LabeledErrorBoundInput'; const defaultProps = { id: 1, diff --git a/superset-frontend/src/components/Form/LabeledErrorBoundInput.tsx b/superset-frontend/src/components/Form/LabeledErrorBoundInput.tsx index a4f37676b61..1e0be2ae195 100644 --- a/superset-frontend/src/components/Form/LabeledErrorBoundInput.tsx +++ b/superset-frontend/src/components/Form/LabeledErrorBoundInput.tsx @@ -17,30 +17,15 @@ * under the License. */ import { styled, css, SupersetTheme, t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import { Input } from 'src/components/Input'; -import InfoTooltip from 'src/components/InfoTooltip'; import { Icons } from 'src/components/Icons'; -import Button from 'src/components/Button'; import errorIcon from 'src/assets/images/icons/error.svg'; -import FormItem from './FormItem'; -import FormLabel from './FormLabel'; - -export interface LabeledErrorBoundInputProps { - label?: string; - validationMethods: - | { onBlur: (value: any) => void } - | { onChange: (value: any) => void }; - errorMessage?: string | null; - helpText?: string; - required?: boolean; - hasTooltip?: boolean; - tooltipText?: string | null; - id?: string; - classname?: string; - visibilityToggle?: boolean; - [x: string]: any; -} +import { Button } from '../Button'; +import { InfoTooltip } from '../InfoTooltip'; +import { Input } from '../Input'; +import { Tooltip } from '../Tooltip'; +import { FormItem } from './FormItem'; +import { FormLabel } from './FormLabel'; +import type { LabeledErrorBoundInputProps } from './types'; const StyledInput = styled(Input)` margin: ${({ theme }) => `${theme.sizeUnit}px 0 ${theme.sizeUnit * 2}px`}; @@ -99,7 +84,7 @@ const iconReset = css` } `; -const LabeledErrorBoundInput = ({ +export const LabeledErrorBoundInput = ({ label, validationMethods, errorMessage, @@ -169,5 +154,3 @@ const LabeledErrorBoundInput = ({ ); - -export default LabeledErrorBoundInput; diff --git a/superset-frontend/src/components/Form/index.tsx b/superset-frontend/src/components/Form/index.tsx index 7af2de01738..ba225fb56dc 100644 --- a/superset-frontend/src/components/Form/index.tsx +++ b/superset-frontend/src/components/Form/index.tsx @@ -16,10 +16,10 @@ * specific language governing permissions and limitations * under the License. */ -import Form, { FormProps, FormItemProps, FormInstance } from './Form'; -import FormItem from './FormItem'; -import FormLabel from './FormLabel'; -import LabeledErrorBoundInput from './LabeledErrorBoundInput'; +import { Form } from './Form'; +import { FormItem } from './FormItem'; +import { FormLabel } from './FormLabel'; +import { LabeledErrorBoundInput } from './LabeledErrorBoundInput'; export { Form, FormItem, FormLabel, LabeledErrorBoundInput }; -export type { FormProps, FormItemProps, FormInstance }; +export type { FormInstance, FormProps, FormItemProps } from './types'; diff --git a/superset-frontend/src/components/Form/types.ts b/superset-frontend/src/components/Form/types.ts new file mode 100644 index 00000000000..50d82c16d06 --- /dev/null +++ b/superset-frontend/src/components/Form/types.ts @@ -0,0 +1,35 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type { FormProps, FormInstance, FormItemProps } from 'antd-v5/es/form'; + +export interface LabeledErrorBoundInputProps { + label?: string; + validationMethods: + | { onBlur: (value: any) => void } + | { onChange: (value: any) => void }; + errorMessage?: string | null; + helpText?: string; + required?: boolean; + hasTooltip?: boolean; + tooltipText?: string | null; + id?: string; + classname?: string; + visibilityToggle?: boolean; + [x: string]: any; +} diff --git a/superset-frontend/src/components/FormRow/FormRow.test.jsx b/superset-frontend/src/components/FormRow/FormRow.test.jsx deleted file mode 100644 index 66bf5977b18..00000000000 --- a/superset-frontend/src/components/FormRow/FormRow.test.jsx +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import { render } from 'spec/helpers/testing-library'; - -import TextControl from 'src/explore/components/controls/TextControl'; -import FormRow from 'src/components/FormRow'; - -jest.mock('@superset-ui/chart-controls', () => ({ - ...jest.requireActual('@superset-ui/chart-controls'), - InfoTooltipWithTrigger: () =>
, -})); -jest.mock('src/components/Grid', () => ({ - ...jest.requireActual('src/components'), - Row: ({ children }) =>
{children}
, - Col: ({ children }) =>
{children}
, -})); - -const defaultProps = { - label: 'Hello', - tooltip: 'A tooltip', - control: , -}; - -const setup = (overrideProps = {}) => { - const props = { - ...defaultProps, - ...overrideProps, - }; - return render(); -}; - -test('renders an InfoTooltipWithTrigger only if needed', () => { - const { getByTestId, queryByTestId, rerender } = setup(); - expect(getByTestId('mock-info-tooltip')).toBeInTheDocument(); - rerender(); - expect(queryByTestId('mock-info-tooltip')).not.toBeInTheDocument(); -}); - -test('renders a Row and 2 Cols', () => { - const { getByTestId, getAllByTestId } = setup(); - expect(getByTestId('mock-row')).toBeInTheDocument(); - expect(getAllByTestId('mock-col')).toHaveLength(2); -}); diff --git a/superset-frontend/src/components/FormRow/index.jsx b/superset-frontend/src/components/FormRow/index.jsx deleted file mode 100644 index 5cbf1763eb9..00000000000 --- a/superset-frontend/src/components/FormRow/index.jsx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -import PropTypes from 'prop-types'; -import { Row, Col } from 'src/components/Grid'; - -import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; - -const STYLE_ROW = { marginTop: '5px', minHeight: '30px' }; -const STYLE_RALIGN = { textAlign: 'right' }; - -const propTypes = { - label: PropTypes.string.isRequired, - tooltip: PropTypes.string, - control: PropTypes.node.isRequired, - isCheckbox: PropTypes.bool, -}; - -const defaultProps = { - tooltip: null, - isCheckbox: false, -}; - -export default function FormRow({ label, tooltip, control, isCheckbox }) { - const labelAndTooltip = ( - - {label}{' '} - {tooltip && ( - - )} - - ); - if (isCheckbox) { - return ( - - - {control} - - - {labelAndTooltip} - - - ); - } - return ( - - - {labelAndTooltip} - - - {control} - - - ); -} -FormRow.propTypes = propTypes; -FormRow.defaultProps = defaultProps; diff --git a/superset-frontend/src/components/GenericLink/GenericLink.test.tsx b/superset-frontend/src/components/GenericLink/GenericLink.test.tsx index 33681823ea3..7d30215e2e1 100644 --- a/superset-frontend/src/components/GenericLink/GenericLink.test.tsx +++ b/superset-frontend/src/components/GenericLink/GenericLink.test.tsx @@ -18,7 +18,7 @@ */ import { render, screen } from 'spec/helpers/testing-library'; -import { GenericLink } from './GenericLink'; +import { GenericLink } from '.'; test('renders', () => { render(Link to Explore, { diff --git a/superset-frontend/src/components/GenericLink/GenericLink.tsx b/superset-frontend/src/components/GenericLink/index.tsx similarity index 100% rename from superset-frontend/src/components/GenericLink/GenericLink.tsx rename to superset-frontend/src/components/GenericLink/index.tsx diff --git a/superset-frontend/src/components/Grid/Grid.stories.tsx b/superset-frontend/src/components/Grid/Grid.stories.tsx index aabe727f456..30137208660 100644 --- a/superset-frontend/src/components/Grid/Grid.stories.tsx +++ b/superset-frontend/src/components/Grid/Grid.stories.tsx @@ -19,7 +19,8 @@ import { Meta, StoryObj } from '@storybook/react'; import Slider from 'src/components/Slider/index'; import { useState } from 'react'; -import { Row, Col, ColProps, RowProps } from './index'; +import { Row, Col } from '.'; +import type { ColProps, RowProps } from './types'; export default { title: 'Design System/Components/Grid', diff --git a/superset-frontend/src/components/Grid/Grid.test.tsx b/superset-frontend/src/components/Grid/Grid.test.tsx index 45d46881d83..36174906e09 100644 --- a/superset-frontend/src/components/Grid/Grid.test.tsx +++ b/superset-frontend/src/components/Grid/Grid.test.tsx @@ -18,7 +18,7 @@ */ import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; -import { Col, Row } from './index'; +import { Col, Row } from '.'; describe('Grid Component', () => { it('should render the grid with rows and columns', async () => { diff --git a/superset-frontend/src/components/Grid/index.tsx b/superset-frontend/src/components/Grid/index.tsx index 016de2c24b5..0b65a4db16a 100644 --- a/superset-frontend/src/components/Grid/index.tsx +++ b/superset-frontend/src/components/Grid/index.tsx @@ -16,11 +16,5 @@ * specific language governing permissions and limitations * under the License. */ -import { Row, Col, Grid as AntdGrid } from 'antd-v5'; -import type { ColProps, ColSize } from 'antd-v5/es/col'; -import type { RowProps } from 'antd-v5/es/row'; - -export type { ColProps, ColSize, RowProps }; - -export { Row, Col }; -export default AntdGrid; +export { Row, Col, Grid } from 'antd-v5'; +export type { RowProps, ColProps } from './types'; diff --git a/superset-frontend/src/components/Grid/types.ts b/superset-frontend/src/components/Grid/types.ts new file mode 100644 index 00000000000..d0595b3ff73 --- /dev/null +++ b/superset-frontend/src/components/Grid/types.ts @@ -0,0 +1,20 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +export type { ColProps, ColSize } from 'antd-v5/es/col'; +export type { RowProps } from 'antd-v5/es/row'; diff --git a/superset-frontend/src/components/GridTable/GridTable.test.tsx b/superset-frontend/src/components/GridTable/GridTable.test.tsx index 849831af6a2..09b7b0e699f 100644 --- a/superset-frontend/src/components/GridTable/GridTable.test.tsx +++ b/superset-frontend/src/components/GridTable/GridTable.test.tsx @@ -18,12 +18,7 @@ */ import { render } from 'spec/helpers/testing-library'; import { setupAGGridModules } from 'src/setup/setupAGGridModules'; -import GridTable from '.'; - -jest.mock('src/components/ErrorBoundary', () => ({ - __esModule: true, - default: ({ children }: { children: React.ReactNode }) => <>{children}, -})); +import { GridTable } from '.'; const mockedProps = { queryId: 'abc', diff --git a/superset-frontend/src/components/GridTable/Header.test.tsx b/superset-frontend/src/components/GridTable/Header.test.tsx index 47b16115ff4..cbd3a677126 100644 --- a/superset-frontend/src/components/GridTable/Header.test.tsx +++ b/superset-frontend/src/components/GridTable/Header.test.tsx @@ -18,20 +18,25 @@ */ import type { Column, GridApi } from 'ag-grid-community'; import { act, fireEvent, render } from 'spec/helpers/testing-library'; -import Header from './Header'; +import { Header } from './Header'; import { PIVOT_COL_ID } from './constants'; jest.mock('src/components/Dropdown', () => ({ Dropdown: () =>
, })); -jest.mock('src/components/Icons', () => ({ - Icons: { - Sort: jest.fn(() =>
), - SortAsc: jest.fn(() =>
), - SortDesc: jest.fn(() =>
), - }, -})); +jest.mock('src/components/Icons', () => { + const actualIcons = jest.requireActual('src/components/Icons'); + return { + __esModule: true, + Icons: { + ...actualIcons.Icons, // retain the real `Icons` export + Sort: jest.fn(() =>
), + SortAsc: jest.fn(() =>
), + SortDesc: jest.fn(() =>
), + }, + }; +}); class MockApi extends EventTarget { getAllDisplayedColumns() { diff --git a/superset-frontend/src/components/GridTable/Header.tsx b/superset-frontend/src/components/GridTable/Header.tsx index 3de3eac5071..402112a731c 100644 --- a/superset-frontend/src/components/GridTable/Header.tsx +++ b/superset-frontend/src/components/GridTable/Header.tsx @@ -22,7 +22,7 @@ import type { Column, GridApi } from 'ag-grid-community'; import { Icons } from 'src/components/Icons'; import { PIVOT_COL_ID } from './constants'; -import HeaderMenu from './HeaderMenu'; +import { HeaderMenu } from './HeaderMenu'; interface Params { enableFilterButton?: boolean; @@ -80,7 +80,7 @@ const IconPlaceholder = styled.div` top: 0; `; -const Header: React.FC = ({ +export const Header: React.FC = ({ enableFilterButton, enableSorting, displayName, @@ -195,5 +195,3 @@ const Header: React.FC = ({ ); }; - -export default Header; diff --git a/superset-frontend/src/components/GridTable/HeaderMenu.test.tsx b/superset-frontend/src/components/GridTable/HeaderMenu.test.tsx index 2b8dbc11abb..525383425ee 100644 --- a/superset-frontend/src/components/GridTable/HeaderMenu.test.tsx +++ b/superset-frontend/src/components/GridTable/HeaderMenu.test.tsx @@ -23,7 +23,7 @@ import { waitFor, screen, } from 'spec/helpers/testing-library'; -import HeaderMenu from './HeaderMenu'; +import { HeaderMenu } from './HeaderMenu'; jest.mock('src/components/Menu', () => { const Menu = ({ children }: { children: React.ReactChild }) => ( diff --git a/superset-frontend/src/components/GridTable/HeaderMenu.tsx b/superset-frontend/src/components/GridTable/HeaderMenu.tsx index c9e14c4b1a8..0a6d7eb5516 100644 --- a/superset-frontend/src/components/GridTable/HeaderMenu.tsx +++ b/superset-frontend/src/components/GridTable/HeaderMenu.tsx @@ -21,9 +21,10 @@ import { styled, t } from '@superset-ui/core'; import type { Column, ColumnPinnedType, GridApi } from 'ag-grid-community'; import { Icons } from 'src/components/Icons'; -import { MenuDotsDropdown, DropdownProps } from 'src/components/Dropdown'; import { Menu } from 'src/components/Menu'; import copyTextToClipboard from 'src/utils/copy'; +import { MenuDotsDropdown } from '../Dropdown'; +import type { DropdownProps } from '../Dropdown/types'; import { PIVOT_COL_ID } from './constants'; const IconEmpty = styled.span` @@ -41,7 +42,7 @@ type Params = { onVisibleChange: DropdownProps['onOpenChange']; }; -const HeaderMenu: React.FC = ({ +export const HeaderMenu: React.FC = ({ colId, api, pinnedLeft, @@ -242,5 +243,3 @@ const HeaderMenu: React.FC = ({ /> ); }; - -export default HeaderMenu; diff --git a/superset-frontend/src/components/GridTable/index.tsx b/superset-frontend/src/components/GridTable/index.tsx index bdf313dd4c7..795536dce00 100644 --- a/superset-frontend/src/components/GridTable/index.tsx +++ b/superset-frontend/src/components/GridTable/index.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { ReactNode, useCallback, useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; import { Global } from '@emotion/react'; import { css, useTheme } from '@superset-ui/core'; @@ -27,61 +27,20 @@ import 'ag-grid-community/styles/ag-grid.css'; import 'ag-grid-community/styles/ag-theme-quartz.css'; import copyTextToClipboard from 'src/utils/copy'; -import ErrorBoundary from 'src/components/ErrorBoundary'; +import { ErrorBoundary } from '../ErrorBoundary'; import { PIVOT_COL_ID, GridSize } from './constants'; -import Header from './Header'; +import { Header } from './Header'; +import type { TableProps } from './types'; const gridComponents = { agColumnHeader: Header, }; -export { GridSize }; - -export type ColDef = { - type: string; - field: string; -}; - -export interface TableProps { - /** - * Data that will populate the each row and map to the column key. - */ - data: RecordType[]; - /** - * Table column definitions. - */ - columns: { - label: string; - headerName?: string; - width?: number; - comparator?: (valueA: string | number, valueB: string | number) => number; - render?: (value: any) => ReactNode; - }[]; - - size?: GridSize; - - externalFilter?: AgGridReactProps['doesExternalFilterPass']; - - height: number; - - columnReorderable?: boolean; - - sortable?: boolean; - - enableActions?: boolean; - - showRowNumber?: boolean; - - usePagination?: boolean; - - striped?: boolean; -} - const onSortChanged: AgGridReactProps['onSortChanged'] = ({ api }) => api.refreshCells(); -function GridTable({ +export function GridTable({ data, columns, sortable = true, @@ -261,4 +220,4 @@ function GridTable({ ); } -export default GridTable; +export type { TableProps }; diff --git a/superset-frontend/src/components/GridTable/types.ts b/superset-frontend/src/components/GridTable/types.ts new file mode 100644 index 00000000000..8dda781f6cf --- /dev/null +++ b/superset-frontend/src/components/GridTable/types.ts @@ -0,0 +1,62 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +import { ReactNode } from 'react'; + +import type { AgGridReactProps } from 'ag-grid-react'; +import { GridSize } from './constants'; + +export type ColDef = { + type: string; + field: string; +}; + +export interface TableProps { + /** + * Data that will populate the each row and map to the column key. + */ + data: RecordType[]; + /** + * Table column definitions. + */ + columns: { + label: string; + headerName?: string; + width?: number; + comparator?: (valueA: string | number, valueB: string | number) => number; + render?: (value: any) => ReactNode; + }[]; + + size?: GridSize; + + externalFilter?: AgGridReactProps['doesExternalFilterPass']; + + height: number; + + columnReorderable?: boolean; + + sortable?: boolean; + + enableActions?: boolean; + + showRowNumber?: boolean; + + usePagination?: boolean; + + striped?: boolean; +} diff --git a/superset-frontend/src/components/IconButton/IconButton.stories.tsx b/superset-frontend/src/components/IconButton/IconButton.stories.tsx index d537ad472d8..acf1085b3e3 100644 --- a/superset-frontend/src/components/IconButton/IconButton.stories.tsx +++ b/superset-frontend/src/components/IconButton/IconButton.stories.tsx @@ -17,7 +17,7 @@ * under the License. */ import { Meta, StoryObj } from '@storybook/react'; -import { IconButton } from 'src/components/IconButton'; +import { IconButton } from '.'; export default { title: 'Components/IconButton', diff --git a/superset-frontend/src/components/IconButton/IconButton.test.tsx b/superset-frontend/src/components/IconButton/IconButton.test.tsx index dc45fe003ec..4ee67d030f1 100644 --- a/superset-frontend/src/components/IconButton/IconButton.test.tsx +++ b/superset-frontend/src/components/IconButton/IconButton.test.tsx @@ -17,7 +17,7 @@ * under the License. */ import { render, screen, fireEvent } from 'spec/helpers/testing-library'; -import { IconButton } from 'src/components/IconButton'; +import { IconButton } from '.'; const defaultProps = { buttonText: 'This is the IconButton text', diff --git a/superset-frontend/src/components/IconButton/index.tsx b/superset-frontend/src/components/IconButton/index.tsx index 51345943583..2d45312a598 100644 --- a/superset-frontend/src/components/IconButton/index.tsx +++ b/superset-frontend/src/components/IconButton/index.tsx @@ -19,12 +19,13 @@ // eslint-disable-next-line import Typography from 'src/components/Typography'; -import { Tooltip } from 'src/components/Tooltip'; -import Card, { CardProps } from 'src/components/Card'; import { Icons } from 'src/components/Icons'; import { SupersetTheme, css } from '@superset-ui/core'; +import { Card } from '../Card'; +import { Tooltip } from '../Tooltip'; +import { CardProps } from '../Card/types'; -export interface IconButtonProps extends CardProps { +interface IconButtonProps extends CardProps { buttonText: string; icon: string; altText?: string; @@ -51,7 +52,7 @@ const IconButton: React.FC = ({ const renderIcon = () => { const iconContent = icon ? ( {altText = ({ }; export { IconButton }; +export type { IconButtonProps }; diff --git a/superset-frontend/src/components/IconTooltip/IconTooltip.stories.tsx b/superset-frontend/src/components/IconTooltip/IconTooltip.stories.tsx index e17cc66ebe2..b9ecf894f2c 100644 --- a/superset-frontend/src/components/IconTooltip/IconTooltip.stories.tsx +++ b/superset-frontend/src/components/IconTooltip/IconTooltip.stories.tsx @@ -18,7 +18,8 @@ */ import { Icons } from 'src/components/Icons'; import { css, useTheme } from '@superset-ui/core'; -import { IconTooltip, Props } from '.'; +import { IconTooltip } from '.'; +import type { IconTooltipProps } from './types'; export default { title: 'Components/IconTooltip', @@ -41,7 +42,7 @@ const PLACEMENTS = [ const theme = useTheme(); -export const InteractiveIconTooltip = (args: Props) => ( +export const InteractiveIconTooltip = (args: IconTooltipProps) => (
({ Tooltip: () =>
, diff --git a/superset-frontend/src/components/IconTooltip/index.tsx b/superset-frontend/src/components/IconTooltip/index.tsx index 3e5cea7b3d7..a5d9321b30e 100644 --- a/superset-frontend/src/components/IconTooltip/index.tsx +++ b/superset-frontend/src/components/IconTooltip/index.tsx @@ -16,38 +16,17 @@ * specific language governing permissions and limitations * under the License. */ -import { ReactNode } from 'react'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from '../Tooltip'; +import type { IconTooltipProps } from './types'; -export interface Props { - children?: ReactNode; - className?: string; - onClick?: () => void; - placement?: - | 'bottom' - | 'left' - | 'right' - | 'top' - | 'topLeft' - | 'topRight' - | 'bottomLeft' - | 'bottomRight' - | 'leftTop' - | 'leftBottom' - | 'rightTop' - | 'rightBottom'; - style?: object; - tooltip?: string | null; -} - -const IconTooltip = ({ +export const IconTooltip = ({ children = null, className = '', onClick = () => undefined, placement = 'top', style = {}, tooltip = null, -}: Props) => { +}: IconTooltipProps) => { const iconTooltip = ( )), -); +})); + jest.mock('src/dashboard/components/dnd/DragDroppable', () => ({ ...jest.requireActual('src/dashboard/components/dnd/DragDroppable'), Droppable: jest.fn(props => { diff --git a/superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx b/superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx index 62c86dd8f1a..c09e98f848d 100644 --- a/superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx +++ b/superset-frontend/src/dashboard/components/gridComponents/Tabs.jsx @@ -23,7 +23,7 @@ import { useSelector } from 'react-redux'; import { LineEditableTabs } from 'src/components/Tabs'; import { Icons } from 'src/components/Icons'; import { LOG_ACTIONS_SELECT_DASHBOARD_TAB } from 'src/logger/LogUtils'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import { DROP_LEFT, DROP_RIGHT } from 'src/dashboard/util/getDropPosition'; import { Draggable } from '../dnd/DragDroppable'; import DragHandle from '../dnd/DragHandle'; diff --git a/superset-frontend/src/dashboard/components/gridComponents/Tabs.test.jsx b/superset-frontend/src/dashboard/components/gridComponents/Tabs.test.jsx index c8bef9d7358..819776ebb99 100644 --- a/superset-frontend/src/dashboard/components/gridComponents/Tabs.test.jsx +++ b/superset-frontend/src/dashboard/components/gridComponents/Tabs.test.jsx @@ -17,7 +17,7 @@ * under the License. */ import { fireEvent, render } from 'spec/helpers/testing-library'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import fetchMock from 'fetch-mock'; import Tabs from 'src/dashboard/components/gridComponents/Tabs'; import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/ActionButtons/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/ActionButtons/index.tsx index 3baeb80575b..faff8975ec6 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/ActionButtons/index.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/ActionButtons/index.tsx @@ -26,7 +26,7 @@ import { SupersetTheme, styled, } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { OPEN_FILTER_BAR_WIDTH } from 'src/dashboard/constants'; import { rgba } from 'emotion-rgba'; import { FilterBarOrientation } from 'src/dashboard/types'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTag.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTag.tsx index e5d077777d7..bfe8a2d667f 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTag.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTag.tsx @@ -26,7 +26,7 @@ import { } from '@superset-ui/core'; import { CrossFilterIndicator } from 'src/dashboard/components/nativeFilters/selectors'; import { Tag } from 'src/components/Tag'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { FilterBarOrientation } from 'src/dashboard/types'; import { ellipsisCss } from './styles'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTitle.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTitle.tsx index dfd5b4533a5..735da7a006d 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTitle.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/CrossFilterTitle.tsx @@ -24,7 +24,7 @@ import { useTheme, useCSSTextTruncation, } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { FilterBarOrientation } from 'src/dashboard/types'; import { Icons } from 'src/components/Icons'; import { ellipsisCss } from './styles'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ChartsScopingListPanel.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ChartsScopingListPanel.tsx index 526820a767a..478ab56a23b 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ChartsScopingListPanel.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ChartsScopingListPanel.tsx @@ -28,7 +28,7 @@ import { import { useSelector } from 'react-redux'; import { CHART_TYPE } from 'src/dashboard/util/componentTypes'; import { Icons } from 'src/components/Icons'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { FilterTitle } from 'src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer'; import { NEW_CHART_SCOPING_ID } from './constants'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingModal.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingModal.tsx index 40e9d6d395f..00f87a75a70 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingModal.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingModal.tsx @@ -19,7 +19,7 @@ import { useCallback, useMemo, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { isDefined, NativeFilterScope, t } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import { ChartConfiguration, RootState, diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingTreePanel.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingTreePanel.tsx index 2e43866fc95..acc9dad9e55 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingTreePanel.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/ScopingModal/ScopingTreePanel.tsx @@ -26,7 +26,7 @@ import { t, useTheme, } from '@superset-ui/core'; -import { Select } from 'src/components'; +import { Select, Tooltip, Alert } from 'src/components'; import { noOp } from 'src/utils/common'; import ScopingTree from 'src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/ScopingTree'; import { @@ -36,10 +36,8 @@ import { RootState, } from 'src/dashboard/types'; import { CHART_TYPE } from 'src/dashboard/util/componentTypes'; -import { SelectOptionsType } from 'src/components/Select/types'; +import type { SelectOptionsType } from 'src/components'; import { Icons } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; -import Alert from 'src/components/Alert'; import { NEW_CHART_SCOPING_ID } from './constants'; interface ScopingTreePanelProps { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/VerticalCollapse.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/VerticalCollapse.tsx index 1b3361dcd4a..185ab68494f 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/VerticalCollapse.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/CrossFilters/VerticalCollapse.tsx @@ -18,10 +18,9 @@ */ import { useMemo } from 'react'; -import Collapse from 'src/components/Collapse'; +import { Collapse, Divider } from 'src/components'; import { t } from '@superset-ui/core'; import { FilterBarOrientation } from 'src/dashboard/types'; -import { Divider } from 'src/components/Divider'; import CrossFilter from './CrossFilter'; import { CrossFilterIndicator } from '../../selectors'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx index 96fd72e768b..be73ac207d6 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterBarSettings/index.tsx @@ -27,9 +27,7 @@ import { saveCrossFiltersSetting, } from 'src/dashboard/actions/dashboardInfo'; import { Icons } from 'src/components/Icons'; -import Checkbox from 'src/components/Checkbox'; -import { Dropdown } from 'src/components/Dropdown'; -import Button from 'src/components/Button'; +import { Button, Checkbox, Dropdown } from 'src/components'; import { Space } from 'src/components/Space'; import { clearDataMaskState } from 'src/dataMask/actions'; import { useFilters } from 'src/dashboard/components/nativeFilters/FilterBar/state'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx index 554f1df4689..096b7fde4b1 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControl.tsx @@ -23,8 +23,7 @@ import { OutPortal, } from 'react-reverse-portal'; import { styled, SupersetTheme, truncationCSS } from '@superset-ui/core'; -import { FormItem as StyledFormItem, Form } from 'src/components/Form'; -import { Tooltip } from 'src/components/Tooltip'; +import { FormItem as StyledFormItem, Form, Tooltip } from 'src/components'; import { FilterBarOrientation } from 'src/dashboard/types'; import { checkIsMissingRequiredValue } from '../utils'; import FilterValue from './FilterValue'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx index d9e44a4d9b1..3a87ede0a15 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterControls.tsx @@ -47,9 +47,10 @@ import { useSelectFiltersInScope, } from 'src/dashboard/components/nativeFilters/state'; import { FilterBarOrientation, RootState } from 'src/dashboard/types'; -import DropdownContainer, { - Ref as DropdownContainerRef, -} from 'src/components/DropdownContainer'; +import { + DropdownContainer, + type DropdownRef as DropdownContainerRef, +} from 'src/components'; import { Icons } from 'src/components/Icons'; import { useChartIds } from 'src/dashboard/util/charts/useChartIds'; import { useChartLayoutItems } from 'src/dashboard/util/useChartLayoutItems'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterDivider.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterDivider.tsx index 4625db8d176..f58c6245332 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterDivider.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterDivider.tsx @@ -24,7 +24,7 @@ import { truncationCSS, } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { FilterBarOrientation } from 'src/dashboard/types'; import { FilterDividerProps } from './types'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx index 31722a63ead..f7cc26d42b4 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FilterControls/FilterValue.tsx @@ -44,8 +44,11 @@ import { import { useDispatch, useSelector } from 'react-redux'; import { isEqual, isEqualWith } from 'lodash'; import { getChartDataRequest } from 'src/components/Chart/chartAction'; -import Loading from 'src/components/Loading'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; +import { + ErrorAlert, + ErrorMessageWithStackTrace, + Loading, +} from 'src/components'; import { waitForAsyncData } from 'src/middleware/asyncEvent'; import { FilterBarOrientation, RootState } from 'src/dashboard/types'; import { @@ -54,7 +57,6 @@ import { } from 'src/dashboard/actions/dashboardState'; import { RESPONSIVE_WIDTH } from 'src/filters/components/common'; import { FAST_DEBOUNCE } from 'src/constants'; -import ErrorAlert from 'src/components/ErrorMessage/ErrorAlert'; import { dispatchHoverAction, dispatchFocusAction } from './utils'; import { FilterControlProps } from './types'; import { getFormData } from '../../utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FiltersOutOfScopeCollapsible/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FiltersOutOfScopeCollapsible/index.tsx index 59f934592d3..7869f787efc 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FiltersOutOfScopeCollapsible/index.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/FiltersOutOfScopeCollapsible/index.tsx @@ -18,7 +18,7 @@ */ import { ReactNode } from 'react'; import { css, Divider, Filter, SupersetTheme, t } from '@superset-ui/core'; -import Collapse from 'src/components/Collapse'; +import { Collapse } from 'src/components'; export interface FiltersOutOfScopeCollapsibleProps { filtersOutOfScope: (Filter | Divider)[]; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx index fc7f056c512..42771de60a1 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Header/index.tsx @@ -20,7 +20,7 @@ import { css, styled, t } from '@superset-ui/core'; import { memo, FC } from 'react'; import { Icons } from 'src/components/Icons'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { getFilterBarTestId } from '../utils'; import FilterBarSettings from '../FilterBarSettings'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Horizontal.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Horizontal.tsx index b4eb572a7a6..4cdd9789fb5 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Horizontal.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Horizontal.tsx @@ -19,7 +19,7 @@ import { FC, memo, useMemo } from 'react'; import { DataMaskStateWithId, styled, t } from '@superset-ui/core'; -import Loading from 'src/components/Loading'; +import { Loading } from 'src/components'; import { RootState } from 'src/dashboard/types'; import { useChartLayoutItems } from 'src/dashboard/util/useChartLayoutItems'; import { useChartIds } from 'src/dashboard/util/charts/useChartIds'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Vertical.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Vertical.tsx index 63f1655bbd8..be7835aba40 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Vertical.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/Vertical.tsx @@ -32,8 +32,7 @@ import { import cx from 'classnames'; import { styled, t, useTheme } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import Loading from 'src/components/Loading'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, Loading } from 'src/components'; import { getFilterBarTestId } from './utils'; import { VerticalBarProps } from './types'; import Header from './Header'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FilterCard/TooltipWithTruncation.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FilterCard/TooltipWithTruncation.tsx index 4e3d887cd1d..bae1d030445 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FilterCard/TooltipWithTruncation.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FilterCard/TooltipWithTruncation.tsx @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -import { Tooltip, TooltipProps } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; +import { TooltipProps } from 'src/components/Tooltip/types'; import { TooltipTrigger } from './Styles'; export const TooltipWithTruncation = ({ diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DividerConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DividerConfigForm.tsx index 92e6bae993c..278401bcb62 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DividerConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DividerConfigForm.tsx @@ -17,8 +17,7 @@ * under the License. */ import { FC } from 'react'; -import { FormItem } from 'src/components/Form'; -import { Input } from 'src/components/Input'; +import { FormItem, Input } from 'src/components'; import { NativeFilterType, styled, t } from '@superset-ui/core'; interface Props { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx index 65659bd5aa7..5f5f9410d9f 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/DraggableFilter.tsx @@ -25,7 +25,8 @@ import { useDrop, XYCoord, } from 'react-dnd'; -import { Icons, IconType } from 'src/components/Icons'; +import { Icons } from 'src/components/Icons'; +import type { IconType } from 'src/components/Icons/types'; interface TitleContainerProps { readonly isDragging: boolean; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx index 6d515eca899..04a8b2b16f1 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitlePane.tsx @@ -19,7 +19,7 @@ import { useRef, FC } from 'react'; import { NativeFilterType, styled, t, useTheme } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { Icons } from 'src/components/Icons'; import FilterTitleContainer from './FilterTitleContainer'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/CollapsibleControl.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/CollapsibleControl.tsx index ef5f82f8cb4..f049dd8a77e 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/CollapsibleControl.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/CollapsibleControl.tsx @@ -18,7 +18,7 @@ */ import { ReactNode, useEffect, useState } from 'react'; import { styled } from '@superset-ui/core'; -import Checkbox from 'src/components/Checkbox'; +import { Checkbox } from 'src/components'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; interface CollapsibleControlProps { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx index a7494960545..adaeab54595 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/ColumnSelect.tsx @@ -25,8 +25,7 @@ import { useChangeEffect, getClientErrorObject, } from '@superset-ui/core'; -import { Select } from 'src/components'; -import { FormInstance } from 'src/components/Form'; +import { type FormInstance, Select } from 'src/components'; import { useToasts } from 'src/components/MessageToasts/withToasts'; import { cachedSupersetGet } from 'src/utils/cachedSupersetGet'; import { NativeFiltersForm, NativeFiltersFormItem } from '../types'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.tsx index b20d315c169..b46436287e4 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/DefaultValue.tsx @@ -24,8 +24,7 @@ import { AppSection, t, } from '@superset-ui/core'; -import { FormInstance } from 'src/components/Form'; -import Loading from 'src/components/Loading'; +import { Loading, type FormInstance } from 'src/components'; import { NativeFiltersForm } from '../types'; import { getFormData } from '../../utils'; import { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/FilterScope.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/FilterScope.tsx index a19f6c977bc..676894697a8 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/FilterScope.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/FilterScope.tsx @@ -19,7 +19,7 @@ import { FC, useCallback, useEffect, useMemo, useState } from 'react'; import { NativeFilterScope, styled } from '@superset-ui/core'; -import { FormItem } from 'src/components/Form'; +import { FormItem } from 'src/components'; import ScopingTree from './ScopingTree'; import { getDefaultScopeValue } from './utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/ScopingTree.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/ScopingTree.tsx index ded45daabc8..11e16c89c6e 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/ScopingTree.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/ScopingTree.tsx @@ -21,7 +21,7 @@ import { FC, useMemo, useState, memo } from 'react'; import { NativeFilterScope } from '@superset-ui/core'; import Tree from 'src/components/Tree'; import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; import { useFilterScopeTree } from './state'; import { findFilterScope, getTreeCheckedItems } from './utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeInitialization.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeInitialization.test.tsx index f18c71ce958..6e3be5c61f2 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeInitialization.test.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeInitialization.test.tsx @@ -23,7 +23,7 @@ import { waitFor, cleanup, } from 'spec/helpers/testing-library'; -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import { createMockModal } from './utils'; describe('FilterScope TreeInitialization', () => { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeSelection.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeSelection.test.tsx index 148e478dc71..098ff04e974 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeSelection.test.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/TreeSelection.test.tsx @@ -23,7 +23,7 @@ import { waitFor, cleanup, } from 'spec/helpers/testing-library'; -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import { createMockModal, getTreeSwitcher } from './utils'; describe('FilterScope TreeSelection', () => { diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/utils.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/utils.tsx index 81427417bfb..e28f61e2b25 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/utils.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FilterScope/__tests__/utils.tsx @@ -22,7 +22,7 @@ import FiltersConfigForm, { FilterPanels, } from 'src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm'; import { mockStoreWithChartsInTabsAndRoot } from 'spec/fixtures/mockStore'; -import { Form, FormInstance } from 'src/components/Form'; +import { Form, type FormInstance } from 'src/components'; export const createMockedProps = () => ({ expanded: false, diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx index e5ca95b75a6..d380ac71e40 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/FiltersConfigForm.tsx @@ -58,18 +58,22 @@ import rison from 'rison'; import { PluginFilterSelectCustomizeProps } from 'src/filters/components/Select/types'; import { useSelector } from 'react-redux'; import { getChartDataRequest } from 'src/components/Chart/chartAction'; -import { Input } from 'src/components/Input'; -import { Select } from 'src/components'; -import Collapse from 'src/components/Collapse'; -import BasicErrorAlert from 'src/components/ErrorMessage/BasicErrorAlert'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; -import { FormItem, FormInstance } from 'src/components/Form'; +import { + BasicErrorAlert, + ErrorMessageWithStackTrace, + FormItem, + type FormInstance, + Collapse, + Select, + Tooltip, + Flex, + Input, + Loading, +} from 'src/components'; import { Icons } from 'src/components/Icons'; -import Loading from 'src/components/Loading'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import { Radio } from 'src/components/Radio'; import Tabs from 'src/components/Tabs'; -import { Tooltip } from 'src/components/Tooltip'; import { cachedSupersetGet } from 'src/utils/cachedSupersetGet'; import { Chart, @@ -86,7 +90,6 @@ import { mergeExtraFormData, } from 'src/dashboard/components/nativeFilters/utils'; import { DatasetSelectLabel } from 'src/features/datasets/DatasetSelectLabel'; -import { Flex } from 'src/components/Flex'; import { ALLOW_DEPENDENCIES as TYPES_SUPPORT_DEPENDENCIES, getFiltersConfigModalTestId, diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/RemovedFilter.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/RemovedFilter.tsx index 0cd39cfb4bc..95372256e72 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/RemovedFilter.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/RemovedFilter.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import Button, { OnClickHandler } from 'src/components/Button'; +import { Button, type OnClickHandler } from 'src/components'; import { FC } from 'react'; import { styled, t } from '@superset-ui/core'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.test.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.test.tsx index b9703f4b967..938cb52c098 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.test.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.test.tsx @@ -18,7 +18,7 @@ */ import { Filter, NativeFilterType } from '@superset-ui/core'; import { render, screen, userEvent } from 'spec/helpers/testing-library'; -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import getControlItemsMap, { ControlItemsProps } from './getControlItemsMap'; import { getControlItems, setNativeFilterFieldValues } from './utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx index 05b3526e141..03b353c96f9 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/getControlItemsMap.tsx @@ -21,15 +21,13 @@ import { InfoTooltipWithTrigger, } from '@superset-ui/chart-controls'; import { ReactNode } from 'react'; -import Checkbox from 'src/components/Checkbox'; +import { Checkbox, Tooltip, FormItem, type FormInstance } from 'src/components'; import { Filter, getChartControlPanelRegistry, styled, t, } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import { FormItem, FormInstance } from 'src/components/Form'; import { doesColumnMatchFilterType, getControlItems, diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/state.ts b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/state.ts index 4070a142c5e..162daa2a72d 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/state.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/state.ts @@ -17,7 +17,7 @@ * under the License. */ import { useEffect, useState } from 'react'; -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import { Filter, t } from '@superset-ui/core'; import { NativeFiltersForm, NativeFiltersFormItem } from '../types'; import { setNativeFilterFieldValues, useForceUpdate } from './utils'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts index be51b40a954..e31e9a29d38 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigForm/utils.ts @@ -17,7 +17,7 @@ * under the License. */ import { flatMapDeep } from 'lodash'; -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import { useState, useCallback } from 'react'; import { CustomControlItem, Dataset } from '@superset-ui/chart-controls'; import { Column, ensureIsArray, GenericDataType } from '@superset-ui/core'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx index 56715f936d0..78cede0f747 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FiltersConfigModal.tsx @@ -29,10 +29,8 @@ import { useTheme, } from '@superset-ui/core'; import { useDispatch } from 'react-redux'; -import { Form } from 'src/components/Form'; import { Icons } from 'src/components/Icons'; -import ErrorBoundary from 'src/components/ErrorBoundary'; -import { StyledModal } from 'src/components/Modal'; +import { ErrorBoundary, Form, StyledModal } from 'src/components'; import { testWithId } from 'src/utils/testUtils'; import { updateCascadeParentIds } from 'src/dashboard/actions/nativeFilters'; import useEffectEvent from 'src/hooks/useEffectEvent'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/CancelConfirmationAlert.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/CancelConfirmationAlert.tsx index 813322ccdfa..ceeb5c37551 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/CancelConfirmationAlert.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/CancelConfirmationAlert.tsx @@ -18,8 +18,7 @@ */ import { ReactNode } from 'react'; import { t } from '@superset-ui/core'; -import Alert from 'src/components/Alert'; -import Button, { OnClickHandler } from 'src/components/Button'; +import { Alert, Button, type OnClickHandler } from 'src/components'; export interface ConfirmationAlertProps { title: string; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx index 76b2fcb6a11..1ee38c752d4 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/Footer/Footer.tsx @@ -17,7 +17,7 @@ * under the License. */ import { FC } from 'react'; -import Button, { OnClickHandler } from 'src/components/Button'; +import { Button, type OnClickHandler } from 'src/components'; import { t } from '@superset-ui/core'; import { CancelConfirmationAlert } from './CancelConfirmationAlert'; diff --git a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts index fb702e8852b..3bb77a5dbef 100644 --- a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts +++ b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/utils.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { FormInstance } from 'src/components/Form'; +import type { FormInstance } from 'src/components'; import { nanoid } from 'nanoid'; import { getInitialDataMask } from 'src/dataMask/reducer'; import { diff --git a/superset-frontend/src/dashboard/containers/DashboardPage.tsx b/superset-frontend/src/dashboard/containers/DashboardPage.tsx index fb8bb6c05d8..0d05305c03d 100644 --- a/superset-frontend/src/dashboard/containers/DashboardPage.tsx +++ b/superset-frontend/src/dashboard/containers/DashboardPage.tsx @@ -23,7 +23,7 @@ import { t, useTheme } from '@superset-ui/core'; import { useDispatch, useSelector } from 'react-redux'; import { createSelector } from '@reduxjs/toolkit'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import Loading from 'src/components/Loading'; +import { Loading } from 'src/components'; import { useDashboard, useDashboardCharts, diff --git a/superset-frontend/src/embedded/index.tsx b/superset-frontend/src/embedded/index.tsx index 4263de96092..ef00670038e 100644 --- a/superset-frontend/src/embedded/index.tsx +++ b/superset-frontend/src/embedded/index.tsx @@ -27,8 +27,7 @@ import setupPlugins from 'src/setup/setupPlugins'; import { useUiConfig } from 'src/components/UiConfigContext'; import { RootContextProviders } from 'src/views/RootContextProviders'; import { store, USER_LOADED } from 'src/views/store'; -import ErrorBoundary from 'src/components/ErrorBoundary'; -import Loading from 'src/components/Loading'; +import { ErrorBoundary, Loading } from 'src/components'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import ToastContainer from 'src/components/MessageToasts/ToastContainer'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; diff --git a/superset-frontend/src/explore/components/ChartPills.tsx b/superset-frontend/src/explore/components/ChartPills.tsx index 7ba4696698d..e5997280ed2 100644 --- a/superset-frontend/src/explore/components/ChartPills.tsx +++ b/superset-frontend/src/explore/components/ChartPills.tsx @@ -19,14 +19,13 @@ import { forwardRef, RefObject } from 'react'; import { css, QueryData, SupersetTheme } from '@superset-ui/core'; import RowCountLabel from 'src/explore/components/RowCountLabel'; -import CachedLabel from 'src/components/CachedLabel'; +import { CachedLabel, type LabelType } from 'src/components'; import Timer from 'src/components/Timer'; -import { Type } from 'src/components/Label'; const CHART_STATUS_MAP = { - failed: 'danger' as Type, - loading: 'warning' as Type, - success: 'success' as Type, + failed: 'danger' as LabelType, + loading: 'warning' as LabelType, + success: 'success' as LabelType, }; export type ChartPillsProps = { diff --git a/superset-frontend/src/explore/components/Control.tsx b/superset-frontend/src/explore/components/Control.tsx index 69ab90c4342..08947d52e9c 100644 --- a/superset-frontend/src/explore/components/Control.tsx +++ b/superset-frontend/src/explore/components/Control.tsx @@ -28,7 +28,7 @@ import { QueryFormData, usePrevious, } from '@superset-ui/core'; -import ErrorBoundary from 'src/components/ErrorBoundary'; +import { ErrorBoundary } from 'src/components'; import { ExploreActions } from 'src/explore/actions/exploreActions'; import controlMap from './controls'; diff --git a/superset-frontend/src/explore/components/ControlHeader.tsx b/superset-frontend/src/explore/components/ControlHeader.tsx index fcd59a1808c..8eeeaafcafe 100644 --- a/superset-frontend/src/explore/components/ControlHeader.tsx +++ b/superset-frontend/src/explore/components/ControlHeader.tsx @@ -19,8 +19,7 @@ import { FC, ReactNode, useMemo, useRef } from 'react'; import { t, css, useTheme, SupersetTheme } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import { Tooltip } from 'src/components/Tooltip'; -import { FormLabel } from 'src/components/Form'; +import { FormLabel, Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; type ValidationError = string; diff --git a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx index a0e70038876..eec1995fa51 100644 --- a/superset-frontend/src/explore/components/ControlPanelsContainer.tsx +++ b/superset-frontend/src/explore/components/ControlPanelsContainer.tsx @@ -56,16 +56,18 @@ import { useSelector } from 'react-redux'; import { rgba } from 'emotion-rgba'; import { kebabCase, isEqual } from 'lodash'; -import Collapse from 'src/components/Collapse'; +import { + Collapse, + Modal, + Loading, + Tooltip, + PluginContext, +} from 'src/components'; import Tabs from 'src/components/Tabs'; -import { PluginContext } from 'src/components/DynamicPlugins'; -import Loading from 'src/components/Loading'; -import Modal from 'src/components/Modal'; import { getSectionsToRender } from 'src/explore/controlUtils'; import { ExploreActions } from 'src/explore/actions/exploreActions'; import { ChartState, ExplorePageState } from 'src/explore/types'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; import ControlRow from './ControlRow'; import Control from './Control'; diff --git a/superset-frontend/src/explore/components/DataTableControl/index.tsx b/superset-frontend/src/explore/components/DataTableControl/index.tsx index 93d9439d74d..df66a333c56 100644 --- a/superset-frontend/src/explore/components/DataTableControl/index.tsx +++ b/superset-frontend/src/explore/components/DataTableControl/index.tsx @@ -29,7 +29,6 @@ import { } from '@superset-ui/core'; import { Column } from 'react-table'; import { debounce } from 'lodash'; -import { Input } from 'src/components/Input'; import { BOOL_FALSE_DISPLAY, BOOL_TRUE_DISPLAY, @@ -38,10 +37,9 @@ import { } from 'src/constants'; import { Radio } from 'src/components/Radio'; import { Icons } from 'src/components/Icons'; -import Button from 'src/components/Button'; +import { Input, Button, CopyToClipboard } from 'src/components'; import Popover from 'src/components/Popover'; import { prepareCopyToClipboardTabularData } from 'src/utils/common'; -import CopyToClipboard from 'src/components/CopyToClipboard'; import { getTimeColumns, setTimeColumns } from './utils'; export const CellNull = styled('span')` diff --git a/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx b/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx index 9aeb82c0bd2..b0a7a8209b8 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx +++ b/superset-frontend/src/explore/components/DataTablesPane/components/SamplesPane.tsx @@ -18,8 +18,7 @@ */ import { useState, useEffect, useMemo } from 'react'; import { ensureIsArray, GenericDataType, styled, t } from '@superset-ui/core'; -import Loading from 'src/components/Loading'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, Loading } from 'src/components'; import TableView, { EmptyWrapperType } from 'src/components/TableView'; import { useFilteredTableData, diff --git a/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx b/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx index 29f201895b6..9e4b061d263 100644 --- a/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx +++ b/superset-frontend/src/explore/components/DataTablesPane/components/useResultsPane.tsx @@ -25,8 +25,7 @@ import { getChartMetadataRegistry, getClientErrorObject, } from '@superset-ui/core'; -import Loading from 'src/components/Loading'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, Loading } from 'src/components'; import { getChartDataRequest } from 'src/components/Chart/chartAction'; import { ResultsPaneProps, QueryResultInterface } from '../types'; import { SingleQueryResultPane } from './SingleQueryResultPane'; diff --git a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx index da98bf5e832..1bc805eaad1 100644 --- a/superset-frontend/src/explore/components/DatasourcePanel/index.tsx +++ b/superset-frontend/src/explore/components/DatasourcePanel/index.tsx @@ -32,10 +32,9 @@ import AutoSizer from 'react-virtualized-auto-sizer'; import { FixedSizeList as List } from 'react-window'; import { matchSorter, rankings } from 'match-sorter'; -import Alert from 'src/components/Alert'; +import { Alert, Input } from 'src/components'; import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal'; import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils'; -import { Input } from 'src/components/Input'; import { FAST_DEBOUNCE } from 'src/constants'; import { ExploreActions } from 'src/explore/actions/exploreActions'; import Control from 'src/explore/components/Control'; diff --git a/superset-frontend/src/explore/components/EmbedCodeContent.jsx b/superset-frontend/src/explore/components/EmbedCodeContent.jsx index 8842b4577e0..0969ca72639 100644 --- a/superset-frontend/src/explore/components/EmbedCodeContent.jsx +++ b/superset-frontend/src/explore/components/EmbedCodeContent.jsx @@ -18,8 +18,7 @@ */ import { useCallback, useEffect, useMemo, useState } from 'react'; import { css, styled, t } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; -import CopyToClipboard from 'src/components/CopyToClipboard'; +import { Input, CopyToClipboard } from 'src/components'; import { URL_PARAMS } from 'src/constants'; import { getChartPermalink } from 'src/utils/urlUtils'; import { CopyButton } from './DataTableControl'; diff --git a/superset-frontend/src/explore/components/ExploreAlert.tsx b/superset-frontend/src/explore/components/ExploreAlert.tsx index ae61cb80608..80289a2b4ef 100644 --- a/superset-frontend/src/explore/components/ExploreAlert.tsx +++ b/superset-frontend/src/explore/components/ExploreAlert.tsx @@ -18,8 +18,7 @@ */ import { forwardRef, RefObject, MouseEvent } from 'react'; -import ErrorAlert from 'src/components/ErrorMessage/ErrorAlert'; -import Button from 'src/components/Button'; +import { Button, ErrorAlert } from 'src/components'; interface ControlPanelAlertProps { title: string; diff --git a/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx b/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx index 6f953c80f31..e3bcc49a418 100644 --- a/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx +++ b/superset-frontend/src/explore/components/ExploreChartHeader/index.jsx @@ -20,11 +20,9 @@ import { useCallback, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { useDispatch } from 'react-redux'; import PropTypes from 'prop-types'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip, AlteredSliceTag, Button, DeleteModal } from 'src/components'; import { css, logging, SupersetClient, t, useTheme } from '@superset-ui/core'; import { chartPropShape } from 'src/dashboard/util/propShapes'; -import AlteredSliceTag from 'src/components/AlteredSliceTag'; -import Button from 'src/components/Button'; import { Icons } from 'src/components/Icons'; import PropertiesModal from 'src/explore/components/PropertiesModal'; import { sliceUpdated } from 'src/explore/actions/exploreActions'; @@ -32,7 +30,6 @@ import { PageHeaderWithActions } from 'src/components/PageHeaderWithActions'; import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions'; import { applyColors, resetColors } from 'src/utils/colorScheme'; import ReportModal from 'src/features/reports/ReportModal'; -import DeleteModal from 'src/components/DeleteModal'; import { deleteActiveReport } from 'src/features/reports/ReportModal/actions'; import { useExploreAdditionalActionsMenu } from '../useExploreAdditionalActionsMenu'; import { useExploreMetadataBar } from './useExploreMetadataBar'; diff --git a/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx b/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx index 3db1dd934be..53ddcd31628 100644 --- a/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx +++ b/superset-frontend/src/explore/components/ExploreChartPanel/index.jsx @@ -38,7 +38,7 @@ import { setItem, LocalStorageKeys, } from 'src/utils/localStorageHelpers'; -import Alert from 'src/components/Alert'; +import { Alert } from 'src/components'; import { SaveDatasetModal } from 'src/SqlLab/components/SaveDatasetModal'; import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils'; import { buildV1ChartDataPayload } from 'src/explore/exploreUtils'; diff --git a/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx b/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx index b69dda66759..5c44887af46 100644 --- a/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx +++ b/superset-frontend/src/explore/components/ExploreViewContainer/index.jsx @@ -33,9 +33,8 @@ import { } from '@superset-ui/core'; import { debounce, isEqual, isObjectLike, omit, pick } from 'lodash'; import { Resizable } from 're-resizable'; -import { usePluginContext } from 'src/components/DynamicPlugins'; +import { usePluginContext, Tooltip } from 'src/components'; import { Global } from '@emotion/react'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; import { getItem, diff --git a/superset-frontend/src/explore/components/ExportToCSVDropdown/index.tsx b/superset-frontend/src/explore/components/ExportToCSVDropdown/index.tsx index ad28f29c40f..bce8b93f261 100644 --- a/superset-frontend/src/explore/components/ExportToCSVDropdown/index.tsx +++ b/superset-frontend/src/explore/components/ExportToCSVDropdown/index.tsx @@ -20,7 +20,7 @@ import { ReactChild, useCallback, Key } from 'react'; import { t, styled } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import { Dropdown } from 'src/components/Dropdown'; +import { Dropdown } from 'src/components'; import { Menu } from 'src/components/Menu'; enum MenuKeys { diff --git a/superset-frontend/src/explore/components/PropertiesModal/index.tsx b/superset-frontend/src/explore/components/PropertiesModal/index.tsx index f02632c3972..d41f7a07153 100644 --- a/superset-frontend/src/explore/components/PropertiesModal/index.tsx +++ b/superset-frontend/src/explore/components/PropertiesModal/index.tsx @@ -18,12 +18,16 @@ */ import { ChangeEvent, useMemo, useState, useCallback, useEffect } from 'react'; -import Modal from 'src/components/Modal'; -import { Input } from 'src/components/Input'; -import Button from 'src/components/Button'; -import { AsyncSelect } from 'src/components'; -import { SelectValue } from 'src/components/Select'; -import { Row, Col } from 'src/components/Grid'; +import { + Input, + Modal, + AsyncSelect, + Button, + Form, + Row, + Col, + type SelectValue, +} from 'src/components'; import rison from 'rison'; import { t, @@ -42,7 +46,6 @@ import withToasts from 'src/components/MessageToasts/withToasts'; import { loadTags } from 'src/components/Tag/utils'; import { fetchTags, OBJECT_TYPES } from 'src/features/tags/tags'; import TagType from 'src/types/TagType'; -import { Form } from 'src/components/Form'; export type PropertiesModalProps = { slice: Slice; diff --git a/superset-frontend/src/explore/components/RowCountLabel/index.tsx b/superset-frontend/src/explore/components/RowCountLabel/index.tsx index 370b3da46c4..61063d52017 100644 --- a/superset-frontend/src/explore/components/RowCountLabel/index.tsx +++ b/superset-frontend/src/explore/components/RowCountLabel/index.tsx @@ -18,8 +18,7 @@ */ import { getNumberFormatter, t, tn } from '@superset-ui/core'; -import Label from 'src/components/Label'; -import { Tooltip } from 'src/components/Tooltip'; +import { Label, Tooltip } from 'src/components'; type RowCountLabelProps = { rowcount?: number; diff --git a/superset-frontend/src/explore/components/RunQueryButton/index.tsx b/superset-frontend/src/explore/components/RunQueryButton/index.tsx index ce6ecc65e28..e9735a76eee 100644 --- a/superset-frontend/src/explore/components/RunQueryButton/index.tsx +++ b/superset-frontend/src/explore/components/RunQueryButton/index.tsx @@ -19,7 +19,7 @@ import { ReactNode } from 'react'; import { t, useTheme } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { Icons } from 'src/components/Icons'; export type RunQueryButtonProps = { diff --git a/superset-frontend/src/explore/components/SaveModal.tsx b/superset-frontend/src/explore/components/SaveModal.tsx index 3357bffd655..ed03b0c4683 100644 --- a/superset-frontend/src/explore/components/SaveModal.tsx +++ b/superset-frontend/src/explore/components/SaveModal.tsx @@ -32,14 +32,17 @@ import { SupersetClient, t, } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; -import { Form, FormItem } from 'src/components/Form'; -import Alert from 'src/components/Alert'; -import Modal from 'src/components/Modal'; +import { + Alert, + Button, + AsyncSelect, + Form, + FormItem, + Modal, + Input, + Loading, +} from 'src/components'; import { Radio } from 'src/components/Radio'; -import Button from 'src/components/Button'; -import { AsyncSelect } from 'src/components'; -import Loading from 'src/components/Loading'; import { canUserEditDashboard } from 'src/dashboard/util/permissionUtils'; import { setSaveChartModalVisibility } from 'src/explore/actions/saveModalActions'; import { SaveActionType } from 'src/explore/types'; diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx index 1451fe7f478..93044cbcaf6 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/AnnotationLayer.jsx @@ -20,7 +20,7 @@ import { PureComponent } from 'react'; import rison from 'rison'; import PropTypes from 'prop-types'; import { CompactPicker } from 'react-color'; -import Button from 'src/components/Button'; +import { Button, AsyncSelect, EmptyState } from 'src/components'; import { t, SupersetClient, @@ -33,12 +33,10 @@ import { withTheme, } from '@superset-ui/core'; import SelectControl from 'src/explore/components/controls/SelectControl'; -import { AsyncSelect } from 'src/components'; import TextControl from 'src/explore/components/controls/TextControl'; import CheckboxControl from 'src/explore/components/controls/CheckboxControl'; import PopoverSection from 'src/components/PopoverSection'; import ControlHeader from 'src/explore/components/ControlHeader'; -import { EmptyState } from 'src/components/EmptyState'; import { ANNOTATION_SOURCE_TYPES, ANNOTATION_TYPES, diff --git a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/index.tsx b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/index.tsx index 32dbf4d1217..93f9120d688 100644 --- a/superset-frontend/src/explore/components/controls/AnnotationLayerControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/AnnotationLayerControl/index.tsx @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -import { List } from 'src/components/List'; import { connect } from 'react-redux'; import { PureComponent } from 'react'; import { @@ -30,7 +29,7 @@ import { css, } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import AsyncEsmComponent from 'src/components/AsyncEsmComponent'; +import { AsyncEsmComponent, List } from 'src/components'; import { getChartKey } from 'src/explore/exploreUtils'; import { runAnnotationQuery } from 'src/components/Chart/chartAction'; import CustomListItem from 'src/explore/components/controls/CustomListItem'; diff --git a/superset-frontend/src/explore/components/controls/BoundsControl.tsx b/superset-frontend/src/explore/components/controls/BoundsControl.tsx index 0b311cb359b..e7f2ae07f34 100644 --- a/superset-frontend/src/explore/components/controls/BoundsControl.tsx +++ b/superset-frontend/src/explore/components/controls/BoundsControl.tsx @@ -17,7 +17,7 @@ * under the License. */ import { useEffect, useRef, useState } from 'react'; -import { InputNumber } from 'src/components/Input'; +import { InputNumber } from 'src/components'; import { t, styled } from '@superset-ui/core'; import { debounce } from 'lodash'; import ControlHeader from 'src/explore/components/ControlHeader'; diff --git a/superset-frontend/src/explore/components/controls/CheckboxControl.jsx b/superset-frontend/src/explore/components/controls/CheckboxControl.jsx index 485195afeff..586a16baa4a 100644 --- a/superset-frontend/src/explore/components/controls/CheckboxControl.jsx +++ b/superset-frontend/src/explore/components/controls/CheckboxControl.jsx @@ -19,8 +19,8 @@ import { Component } from 'react'; import PropTypes from 'prop-types'; import { styled, css } from '@superset-ui/core'; +import { Checkbox } from 'src/components'; import ControlHeader from '../ControlHeader'; -import Checkbox from '../../../components/Checkbox'; const propTypes = { value: PropTypes.bool, diff --git a/superset-frontend/src/explore/components/controls/CollectionControl/index.jsx b/superset-frontend/src/explore/components/controls/CollectionControl/index.jsx index 9228f56eae9..c3ab0a6e70f 100644 --- a/superset-frontend/src/explore/components/controls/CollectionControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/CollectionControl/index.jsx @@ -18,7 +18,7 @@ */ import { Component } from 'react'; import PropTypes from 'prop-types'; -import { List } from 'src/components/List'; +import { List } from 'src/components'; import { nanoid } from 'nanoid'; import { t, withTheme } from '@superset-ui/core'; import { diff --git a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx index addbf0d652e..31861038224 100644 --- a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx +++ b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx @@ -19,7 +19,7 @@ import { css, SupersetTheme } from '@superset-ui/core'; import { useRef, useState } from 'react'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; type ColorSchemeLabelProps = { colors: string[]; diff --git a/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx b/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx index 17780288734..99a38b35af2 100644 --- a/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/ColorSchemeControl/index.tsx @@ -30,10 +30,8 @@ import { } from '@superset-ui/core'; import { sortBy } from 'lodash'; import ControlHeader from 'src/explore/components/ControlHeader'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip, Select, type SelectOptionsType } from 'src/components'; import { Icons } from 'src/components/Icons'; -import { SelectOptionsType } from 'src/components/Select/types'; -import Select from 'src/components/Select/Select'; import { handleFilterOptionHelper } from 'src/components/Select/utils'; import { getColorNamespace } from 'src/utils/colorScheme'; import ColorSchemeLabel from './ColorSchemeLabel'; diff --git a/superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/controls.ts b/superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/controls.ts index beded787bd7..064275e43c1 100644 --- a/superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/controls.ts +++ b/superset-frontend/src/explore/components/controls/ColumnConfigControl/ControlForm/controls.ts @@ -17,8 +17,7 @@ * under the License. */ import { sharedControlComponents } from '@superset-ui/chart-controls'; -import { Select } from 'src/components'; -import { Input, InputNumber } from 'src/components/Input'; +import { Input, InputNumber, Select } from 'src/components'; import Slider from 'src/components/Slider'; import CurrencyControl from '../../CurrencyControl'; import CheckboxControl from '../../CheckboxControl'; diff --git a/superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx b/superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx index a2150bb77ce..dc21c9079d3 100644 --- a/superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx +++ b/superset-frontend/src/explore/components/controls/ConditionalFormattingControl/FormattingPopoverContent.tsx @@ -23,11 +23,16 @@ import { Comparator, MultipleValueComparators, } from '@superset-ui/chart-controls'; -import { Form, FormItem, FormProps } from 'src/components/Form'; -import { Select } from 'src/components'; -import { Col, Row } from 'src/components/Grid'; -import { InputNumber } from 'src/components/Input'; -import Button from 'src/components/Button'; +import { + Select, + Button, + Form, + FormItem, + InputNumber, + Col, + Row, + type FormProps, +} from 'src/components'; import { ConditionalFormattingConfig } from './types'; const FullWidthInputNumber = styled(InputNumber)` diff --git a/superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx b/superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx index 3cb5c250942..912b2b5ad5b 100644 --- a/superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx +++ b/superset-frontend/src/explore/components/controls/ContourControl/ContourPopoverControl.tsx @@ -17,8 +17,7 @@ * under the License. */ import { useState, useEffect } from 'react'; -import { Row, Col } from 'src/components/Grid'; -import Button from 'src/components/Button'; +import { Button, Row, Col } from 'src/components'; import Tabs from 'src/components/Tabs'; import { legacyValidateInteger, styled, t } from '@superset-ui/core'; import ControlHeader from '../../ControlHeader'; diff --git a/superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx b/superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx index b7be6cc5916..d63d2c676ea 100644 --- a/superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx +++ b/superset-frontend/src/explore/components/controls/ControlPopover/ControlPopover.tsx @@ -23,7 +23,7 @@ import Popover, { PopoverProps as BasePopoverProps, } from 'src/components/Popover'; -import { TooltipPlacement } from 'src/components/Tooltip'; +import { TooltipPlacement } from 'src/components/Tooltip/types'; const sectionContainerId = 'controlSections'; export const getSectionContainerElement = () => diff --git a/superset-frontend/src/explore/components/controls/CurrencyControl/CurrencyControl.tsx b/superset-frontend/src/explore/components/controls/CurrencyControl/CurrencyControl.tsx index 5517141261e..0e90f29239c 100644 --- a/superset-frontend/src/explore/components/controls/CurrencyControl/CurrencyControl.tsx +++ b/superset-frontend/src/explore/components/controls/CurrencyControl/CurrencyControl.tsx @@ -27,9 +27,8 @@ import { t, } from '@superset-ui/core'; import { CSSObject } from '@emotion/react'; -import { Select } from 'src/components'; +import { Select, type SelectProps } from 'src/components'; import { ViewState } from 'src/views/types'; -import { SelectProps } from 'src/components/Select/types'; import ControlHeader from '../../ControlHeader'; export interface CurrencyControlProps { diff --git a/superset-frontend/src/explore/components/controls/CustomListItem/index.tsx b/superset-frontend/src/explore/components/controls/CustomListItem/index.tsx index 097df12eb47..06a170c9a0c 100644 --- a/superset-frontend/src/explore/components/controls/CustomListItem/index.tsx +++ b/superset-frontend/src/explore/components/controls/CustomListItem/index.tsx @@ -17,7 +17,7 @@ * under the License. */ import { useTheme } from '@superset-ui/core'; -import { ListItemProps, List } from 'src/components/List'; +import { List, type ListItemProps } from 'src/components'; export interface CustomListItemProps extends ListItemProps { selectable: boolean; diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx index 4c8647b33b3..916c38303ec 100644 --- a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx @@ -30,16 +30,16 @@ import { } from '@superset-ui/core'; import { getTemporalColumns } from '@superset-ui/chart-controls'; import { getUrlParam } from 'src/utils/urlUtils'; -import { Dropdown } from 'src/components/Dropdown'; -import { Menu } from 'src/components/Menu'; -import { Tooltip } from 'src/components/Tooltip'; -import { Icons } from 'src/components/Icons'; import { + Dropdown, + Tooltip, + Button, ChangeDatasourceModal, DatasourceModal, -} from 'src/components/Datasource'; -import Button from 'src/components/Button'; -import ErrorAlert from 'src/components/ErrorMessage/ErrorAlert'; + ErrorAlert, +} from 'src/components'; +import { Menu } from 'src/components/Menu'; +import { Icons } from 'src/components/Icons'; import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip'; import { URL_PARAMS } from 'src/constants'; import { getDatasourceAsSaveableDataset } from 'src/utils/datasourceUtils'; diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx index 2765c1f9a02..e6e4cda6a21 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/DateFilterLabel.tsx @@ -27,13 +27,9 @@ import { useCSSTextTruncation, fetchTimeRange, } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button, Divider, Modal, Tooltip, Select } from 'src/components'; import ControlHeader from 'src/explore/components/ControlHeader'; -import Modal from 'src/components/Modal'; -import { Divider } from 'src/components/Divider'; -import { Select } from 'src/components'; import { Icons } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; import { useDebouncedEffect } from 'src/explore/exploreUtils'; import { SLOW_DEBOUNCE } from 'src/constants'; import { noOp } from 'src/utils/common'; diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/components/AdvancedFrame.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/components/AdvancedFrame.tsx index 5e9b034dd3f..256ade79b4c 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/components/AdvancedFrame.tsx +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/components/AdvancedFrame.tsx @@ -17,7 +17,7 @@ * under the License. */ import { SEPARATOR, t } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; +import { Input } from 'src/components'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import { FrameComponentProps } from 'src/explore/components/controls/DateFilterControl/types'; import DateFunctionTooltip from './DateFunctionTooltip'; diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx index 6f6f732a230..762ac133be2 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/components/CustomFrame.tsx @@ -18,11 +18,16 @@ */ import { t, customTimeRangeDecode } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import { Col, Row } from 'src/components/Grid'; -import { InputNumber } from 'src/components/Input'; -import { DatePicker } from 'src/components/DatePicker'; import { Radio } from 'src/components/Radio'; -import { Select } from 'src/components'; +import { + DatePicker, + Select, + AntdThemeProvider, + Col, + Row, + InputNumber, + Loading, +} from 'src/components'; import { SINCE_GRAIN_OPTIONS, SINCE_MODE_OPTIONS, @@ -37,9 +42,7 @@ import { CustomRangeKey, FrameComponentProps, } from 'src/explore/components/controls/DateFilterControl/types'; -import Loading from 'src/components/Loading'; import { Dayjs } from 'dayjs'; -import { AntdThemeProvider } from 'src/components/AntdThemeProvider'; import { useLocale } from 'src/hooks/useLocale'; export function CustomFrame(props: FrameComponentProps) { diff --git a/superset-frontend/src/explore/components/controls/DateFilterControl/components/DateFunctionTooltip.tsx b/superset-frontend/src/explore/components/controls/DateFilterControl/components/DateFunctionTooltip.tsx index 2c4ed570371..e0eda4b2584 100644 --- a/superset-frontend/src/explore/components/controls/DateFilterControl/components/DateFunctionTooltip.tsx +++ b/superset-frontend/src/explore/components/controls/DateFilterControl/components/DateFunctionTooltip.tsx @@ -18,7 +18,7 @@ */ import { useTheme, t } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { ClassNames } from '@emotion/react'; const TIME_PICKER_HELPER = ( diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx index ddc2ede4858..e67c2f9bcbf 100644 --- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx +++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/ColumnSelectPopover.tsx @@ -37,13 +37,16 @@ import { } from '@superset-ui/core'; import { ColumnMeta, isSavedExpression } from '@superset-ui/chart-controls'; import Tabs from 'src/components/Tabs'; -import Button from 'src/components/Button'; -import { Select } from 'src/components'; +import { + Button, + Form, + FormItem, + Select, + SQLEditor, + EmptyState, +} from 'src/components'; -import { Form, FormItem } from 'src/components/Form'; import sqlKeywords from 'src/SqlLab/utils/sqlKeywords'; -import { SQLEditor } from 'src/components/AsyncAceEditor'; -import { EmptyState } from 'src/components/EmptyState'; import { getColumnKeywords } from 'src/explore/controlUtils/getColumnKeywords'; import { StyledColumnOption } from 'src/explore/components/optionRenderers'; import { diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelectPopoverTitle.jsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelectPopoverTitle.jsx index 59c44e20257..cb961e7bcfb 100644 --- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelectPopoverTitle.jsx +++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndColumnSelectPopoverTitle.jsx @@ -18,8 +18,7 @@ */ import { useCallback, useState } from 'react'; import { t, styled, useTheme } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; -import { Tooltip } from 'src/components/Tooltip'; +import { Input, Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; const StyledInput = styled(Input)` diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx index 80c60ca859d..f7868e84b6e 100644 --- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx +++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.test.tsx @@ -33,7 +33,7 @@ import { screen, within, } from 'spec/helpers/testing-library'; -import type { AsyncAceEditorProps } from 'src/components/AsyncAceEditor'; +import type { AsyncAceEditorProps } from 'src/components'; import AdhocMetric from 'src/explore/components/controls/MetricControl/AdhocMetric'; import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter'; import { Operators } from 'src/explore/constants'; diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.tsx index d15289db8c4..5cf2d285650 100644 --- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.tsx +++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/DndFilterSelect.tsx @@ -30,7 +30,7 @@ import { isColumnMeta, isTemporalColumn, } from '@superset-ui/chart-controls'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import { OPERATOR_ENUM_TO_OPERATOR_TYPE, Operators, diff --git a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx index 77efc52e1a8..9d7cebb8af9 100644 --- a/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx +++ b/superset-frontend/src/explore/components/controls/DndColumnSelectControl/OptionWrapper.tsx @@ -28,7 +28,7 @@ import { OptionProps, OptionItemInterface, } from 'src/explore/components/controls/DndColumnSelectControl/types'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { StyledColumnOption } from 'src/explore/components/optionRenderers'; import { styled, isAdhocColumn } from '@superset-ui/core'; import { ColumnMeta } from '@superset-ui/chart-controls'; diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx index f12403b0d66..f666e0a6a42 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx @@ -43,7 +43,7 @@ import { LabelsContainer, } from 'src/explore/components/controls/OptionControls'; import { Icons } from 'src/components/Icons'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import AdhocFilterPopoverTrigger from 'src/explore/components/controls/FilterControl/AdhocFilterPopoverTrigger'; import AdhocFilterOption from 'src/explore/components/controls/FilterControl/AdhocFilterOption'; import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter'; diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx index 15dec640e9e..137d31fa770 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopover/index.jsx @@ -18,10 +18,9 @@ */ import { createRef, Component } from 'react'; import PropTypes from 'prop-types'; -import Button from 'src/components/Button'; +import { Button, ErrorBoundary } from 'src/components'; import { styled, t } from '@superset-ui/core'; -import ErrorBoundary from 'src/components/ErrorBoundary'; import Tabs from 'src/components/Tabs'; import adhocMetricType from 'src/explore/components/controls/MetricControl/adhocMetricType'; import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter'; diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx index dca1cd38a8f..cd73a3b8a96 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSimpleTabContent/index.tsx @@ -18,7 +18,7 @@ */ import { FC, ChangeEvent, useEffect, useState } from 'react'; -import { Select } from 'src/components'; +import { Input, Select, Tooltip } from 'src/components'; import { isFeatureEnabled, FeatureFlag, @@ -40,8 +40,6 @@ import { } from 'src/explore/constants'; import FilterDefinitionOption from 'src/explore/components/controls/MetricControl/FilterDefinitionOption'; import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter'; -import { Tooltip } from 'src/components/Tooltip'; -import { Input } from 'src/components/Input'; import { optionLabel } from 'src/utils/common'; import { ColumnMeta, diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSqlTabContent/index.tsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSqlTabContent/index.tsx index 72efb3c5212..9d8437d8e59 100644 --- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSqlTabContent/index.tsx +++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterEditPopoverSqlTabContent/index.tsx @@ -17,9 +17,8 @@ * under the License. */ import { useEffect, useRef, useMemo } from 'react'; -import { Select } from 'src/components'; +import { Select, SQLEditor } from 'src/components'; import { css, styled, t, useTheme } from '@superset-ui/core'; -import { SQLEditor } from 'src/components/AsyncAceEditor'; import sqlKeywords from 'src/SqlLab/utils/sqlKeywords'; import { getColumnKeywords } from 'src/explore/controlUtils/getColumnKeywords'; import AdhocFilter from 'src/explore/components/controls/FilterControl/AdhocFilter'; diff --git a/superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx b/superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx index 187ad7e4b9b..cb295a040bf 100644 --- a/superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/FixedOrMetricControl/index.jsx @@ -19,8 +19,7 @@ import { Component } from 'react'; import PropTypes from 'prop-types'; import { t } from '@superset-ui/core'; -import Label from 'src/components/Label'; -import Collapse from 'src/components/Collapse'; +import { Collapse, Label } from 'src/components'; import TextControl from 'src/explore/components/controls/TextControl'; import MetricsControl from 'src/explore/components/controls/MetricControl/MetricsControl'; import ControlHeader from 'src/explore/components/ControlHeader'; diff --git a/superset-frontend/src/explore/components/controls/HiddenControl.tsx b/superset-frontend/src/explore/components/controls/HiddenControl.tsx index 02a42fc80ab..8c5f86619f6 100644 --- a/superset-frontend/src/explore/components/controls/HiddenControl.tsx +++ b/superset-frontend/src/explore/components/controls/HiddenControl.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Input } from 'src/components/Input'; +import { Input } from 'src/components'; interface HiddenControlsProps { onChange: () => void; diff --git a/superset-frontend/src/explore/components/controls/MapViewControl/MapViewControl.tsx b/superset-frontend/src/explore/components/controls/MapViewControl/MapViewControl.tsx index 32f730b14f8..42e6d6e9ed9 100644 --- a/superset-frontend/src/explore/components/controls/MapViewControl/MapViewControl.tsx +++ b/superset-frontend/src/explore/components/controls/MapViewControl/MapViewControl.tsx @@ -18,7 +18,7 @@ */ import { ControlHeader } from '@superset-ui/chart-controls'; import { css, styled, t } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import Popover from 'src/components/Popover'; import { FC, useState } from 'react'; import { mix } from 'polished'; diff --git a/superset-frontend/src/explore/components/controls/MapViewControl/MapViewPopoverContent.tsx b/superset-frontend/src/explore/components/controls/MapViewControl/MapViewPopoverContent.tsx index 0ca27d7341a..20d81c27089 100644 --- a/superset-frontend/src/explore/components/controls/MapViewControl/MapViewPopoverContent.tsx +++ b/superset-frontend/src/explore/components/controls/MapViewControl/MapViewPopoverContent.tsx @@ -17,8 +17,7 @@ * under the License. */ import { css, styled, t } from '@superset-ui/core'; -import { Form } from 'src/components/Form'; -import Button from 'src/components/Button'; +import { Button, Form } from 'src/components'; import { FC, useEffect, useState } from 'react'; import { mix } from 'polished'; import { MapViewConfigs, MapViewPopoverContentProps } from './types'; diff --git a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx index 2ca2e8ef81c..a1ff9854ed1 100644 --- a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx +++ b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopover/index.jsx @@ -27,12 +27,15 @@ import { DatasourceType, } from '@superset-ui/core'; import Tabs from 'src/components/Tabs'; -import Button from 'src/components/Button'; -import { Select } from 'src/components'; -import { Tooltip } from 'src/components/Tooltip'; -import { EmptyState } from 'src/components/EmptyState'; -import { Form, FormItem } from 'src/components/Form'; -import { SQLEditor } from 'src/components/AsyncAceEditor'; +import { + Button, + EmptyState, + Form, + FormItem, + Select, + Tooltip, + SQLEditor, +} from 'src/components'; import sqlKeywords from 'src/SqlLab/utils/sqlKeywords'; import { noOp } from 'src/utils/common'; import { diff --git a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopoverTitle.tsx b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopoverTitle.tsx index 0777072641e..6504c034c4c 100644 --- a/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopoverTitle.tsx +++ b/superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricEditPopoverTitle.tsx @@ -26,8 +26,7 @@ import { } from 'react'; import { t, styled, useTheme } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; -import { Tooltip } from 'src/components/Tooltip'; +import { Input, Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; const TitleLabel = styled.span` diff --git a/superset-frontend/src/explore/components/controls/OptionControls/index.tsx b/superset-frontend/src/explore/components/controls/OptionControls/index.tsx index da4df26f582..8a44c5a06a6 100644 --- a/superset-frontend/src/explore/components/controls/OptionControls/index.tsx +++ b/superset-frontend/src/explore/components/controls/OptionControls/index.tsx @@ -21,7 +21,7 @@ import { useRef, ReactNode } from 'react'; import { useDrag, useDrop, DropTargetMonitor } from 'react-dnd'; import { styled, t, useTheme, keyframes, css } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; import { savedMetricType } from 'src/explore/components/controls/MetricControl/types'; import AdhocMetric from 'src/explore/components/controls/MetricControl/AdhocMetric'; diff --git a/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx b/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx index c156402bff1..be7b160f8c9 100644 --- a/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/SelectAsyncControl/index.tsx @@ -19,13 +19,13 @@ import { useEffect, useState } from 'react'; import { t, SupersetClient, getClientErrorObject } from '@superset-ui/core'; import ControlHeader from 'src/explore/components/ControlHeader'; -import { Select } from 'src/components'; import { - SelectValue, - LabeledValue, - SelectOptionsType, - SelectProps, -} from 'src/components/Select'; + Select, + type SelectValue, + type LabeledValue, + type SelectOptionsType, + type SelectProps, +} from 'src/components'; import withToasts from 'src/components/MessageToasts/withToasts'; type SelectAsyncProps = Omit; diff --git a/superset-frontend/src/explore/components/controls/SpatialControl.jsx b/superset-frontend/src/explore/components/controls/SpatialControl.jsx index ac21138454e..342cc03c9c6 100644 --- a/superset-frontend/src/explore/components/controls/SpatialControl.jsx +++ b/superset-frontend/src/explore/components/controls/SpatialControl.jsx @@ -18,13 +18,11 @@ */ import { Component } from 'react'; import PropTypes from 'prop-types'; -import { Row, Col } from 'src/components/Grid'; +import { Row, Col, Checkbox, Label } from 'src/components'; import { t } from '@superset-ui/core'; -import Label from 'src/components/Label'; import Popover from 'src/components/Popover'; import PopoverSection from 'src/components/PopoverSection'; -import Checkbox from 'src/components/Checkbox'; import ControlHeader from '../ControlHeader'; import SelectControl from './SelectControl'; diff --git a/superset-frontend/src/explore/components/controls/TextAreaControl.jsx b/superset-frontend/src/explore/components/controls/TextAreaControl.jsx index 940726eb044..ecb614f8bda 100644 --- a/superset-frontend/src/explore/components/controls/TextAreaControl.jsx +++ b/superset-frontend/src/explore/components/controls/TextAreaControl.jsx @@ -18,15 +18,9 @@ */ import { Component } from 'react'; import PropTypes from 'prop-types'; -import { Input } from 'src/components/Input'; -import { - Tooltip, - TooltipProps as TooltipOptions, -} from 'src/components/Tooltip'; +import { Input, Tooltip, Button, TextAreaEditor } from 'src/components'; import { t, withTheme } from '@superset-ui/core'; -import Button from 'src/components/Button'; -import { TextAreaEditor } from 'src/components/AsyncAceEditor'; import ModalTrigger from 'src/components/ModalTrigger'; import ControlHeader from 'src/explore/components/ControlHeader'; @@ -59,7 +53,7 @@ const propTypes = { 'vertical', ]), textAreaStyles: PropTypes.object, - tooltipOptions: PropTypes.oneOf([null, TooltipOptions]), + tooltipOptions: PropTypes.oneOf([null, PropTypes.object]), }; const defaultProps = { diff --git a/superset-frontend/src/explore/components/controls/TextControl/index.tsx b/superset-frontend/src/explore/components/controls/TextControl/index.tsx index 2ec8fe0468b..da9b849d65d 100644 --- a/superset-frontend/src/explore/components/controls/TextControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/TextControl/index.tsx @@ -21,7 +21,7 @@ import { legacyValidateNumber, legacyValidateInteger } from '@superset-ui/core'; import { debounce } from 'lodash'; import { FAST_DEBOUNCE } from 'src/constants'; import ControlHeader from 'src/explore/components/ControlHeader'; -import { Input } from 'src/components/Input'; +import { Input } from 'src/components'; type InputValueType = string | number; diff --git a/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx b/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx index 655d5565fd4..100e86d9a7e 100644 --- a/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx +++ b/superset-frontend/src/explore/components/controls/TimeOffsetControl.tsx @@ -27,8 +27,7 @@ import { computeCustomDateTime, fetchTimeRange, } from '@superset-ui/core'; -import { DatePicker } from 'src/components/DatePicker'; -import { RangePickerProps } from 'antd-v5/es/date-picker'; +import { DatePicker, type RangePickerProps } from 'src/components'; import { useSelector } from 'react-redux'; import ControlHeader from 'src/explore/components/ControlHeader'; diff --git a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx index 9bf5da50a1c..9459db109e0 100644 --- a/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx +++ b/superset-frontend/src/explore/components/controls/TimeSeriesColumnControl/index.jsx @@ -18,10 +18,7 @@ */ import { Component } from 'react'; import PropTypes from 'prop-types'; -import { Input } from 'src/components/Input'; -import Button from 'src/components/Button'; -import { Select } from 'src/components'; -import { Row, Col } from 'src/components/Grid'; +import { Button, Input, Select, Row, Col } from 'src/components'; import { t, styled } from '@superset-ui/core'; import { InfoTooltipWithTrigger } from '@superset-ui/chart-controls'; import BoundsControl from '../BoundsControl'; diff --git a/superset-frontend/src/explore/components/controls/ViewQuery.tsx b/superset-frontend/src/explore/components/controls/ViewQuery.tsx index 943ad72f66e..07aefbf8779 100644 --- a/superset-frontend/src/explore/components/controls/ViewQuery.tsx +++ b/superset-frontend/src/explore/components/controls/ViewQuery.tsx @@ -22,7 +22,7 @@ import { FC } from 'react'; import { styled } from '@superset-ui/core'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; -import CopyToClipboard from 'src/components/CopyToClipboard'; +import { CopyToClipboard } from 'src/components'; import { CopyButton } from 'src/explore/components/DataTableControl'; import markdownSyntax from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown'; import htmlSyntax from 'react-syntax-highlighter/dist/cjs/languages/hljs/htmlbars'; diff --git a/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx b/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx index ab4093d4bba..ac3f0ce320f 100644 --- a/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx +++ b/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx @@ -24,7 +24,7 @@ import { t, getClientErrorObject, } from '@superset-ui/core'; -import Loading from 'src/components/Loading'; +import { Loading } from 'src/components'; import { getChartDataRequest } from 'src/components/Chart/chartAction'; import ViewQuery from 'src/explore/components/controls/ViewQuery'; diff --git a/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx b/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx index 2e179326e44..3bc355213cc 100644 --- a/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx +++ b/superset-frontend/src/explore/components/controls/ViewQueryModalFooter.tsx @@ -19,7 +19,7 @@ import { FC } from 'react'; import { isObject } from 'lodash'; import { t, SupersetClient } from '@superset-ui/core'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { useHistory } from 'react-router-dom'; interface SimpleDataSource { diff --git a/superset-frontend/src/explore/components/controls/ViewportControl.jsx b/superset-frontend/src/explore/components/controls/ViewportControl.jsx index 05cfabd7481..15761d63843 100644 --- a/superset-frontend/src/explore/components/controls/ViewportControl.jsx +++ b/superset-frontend/src/explore/components/controls/ViewportControl.jsx @@ -22,8 +22,7 @@ import PropTypes from 'prop-types'; import Popover from 'src/components/Popover'; import { decimal2sexagesimal } from 'geolib'; -import Label from 'src/components/Label'; -import { FormLabel } from 'src/components/Form'; +import { FormLabel, Label } from 'src/components'; import TextControl from './TextControl'; import ControlHeader from '../ControlHeader'; diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTile.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTile.tsx index f3b1a0fc262..e6b198b374e 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTile.tsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTile.tsx @@ -18,8 +18,7 @@ */ import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { css, t, useTheme } from '@superset-ui/core'; -import { usePluginContext } from 'src/components/DynamicPlugins'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip, usePluginContext } from 'src/components'; import { VizTileProps } from './types'; export const VizTile = ({ diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx index c9457210013..1451ef9b549 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx @@ -26,7 +26,7 @@ import { userEvent, } from 'spec/helpers/testing-library'; import VizTypeControl from 'src/explore/components/controls/VizTypeControl'; -import { DynamicPluginProvider } from 'src/components/DynamicPlugins'; +import { DynamicPluginProvider } from 'src/components'; const defaultProps = { name: 'viz_type', diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx index 9f02cc28f26..d6a9c98516f 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx @@ -26,7 +26,7 @@ import { waitFor, } from 'spec/helpers/testing-library'; import { stateWithoutNativeFilters } from 'spec/fixtures/mockStore'; -import { DynamicPluginProvider } from 'src/components/DynamicPlugins'; +import { DynamicPluginProvider } from 'src/components'; import { testWithId } from 'src/utils/testUtils'; import { BigNumberTotalChartPlugin, diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx index 1f0d9a9099e..a58e2804d57 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeGallery.tsx @@ -39,14 +39,16 @@ import { chartLabelWeight, chartLabelExplanations, } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; -import { Input } from 'src/components/Input'; -import Label from 'src/components/Label'; -import { usePluginContext } from 'src/components/DynamicPlugins'; +import { + Input, + Collapse, + Tooltip, + usePluginContext, + Label, +} from 'src/components'; import { Icons } from 'src/components/Icons'; import { nativeFilterGate } from 'src/dashboard/components/nativeFilters/utils'; import scrollIntoView from 'scroll-into-view-if-needed'; -import Collapse from 'src/components/Collapse'; interface VizTypeGalleryProps { onChange: (vizType: string | null) => void; diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx index 0bbbdadc697..2ba6b423705 100644 --- a/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx +++ b/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx @@ -24,8 +24,7 @@ import { styled, SupersetTheme, } from '@superset-ui/core'; -import { usePluginContext } from 'src/components/DynamicPlugins'; -import Modal from 'src/components/Modal'; +import { Modal, usePluginContext } from 'src/components'; import { noOp } from 'src/utils/common'; import getBootstrapData from 'src/utils/getBootstrapData'; import { FilterPlugins } from 'src/constants'; diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/DashboardsSubMenu.tsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/DashboardsSubMenu.tsx index b6ab5e5b7f1..e9ddc4f30f8 100644 --- a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/DashboardsSubMenu.tsx +++ b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/DashboardsSubMenu.tsx @@ -18,7 +18,7 @@ */ import { useState } from 'react'; import { css, t, useTheme } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; +import { Input } from 'src/components'; import { Icons } from 'src/components/Icons'; import { Menu } from 'src/components/Menu'; import { Link } from 'react-router-dom'; diff --git a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx index 43a45693af1..d981e8770c7 100644 --- a/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx +++ b/superset-frontend/src/explore/components/useExploreAdditionalActionsMenu/index.jsx @@ -30,7 +30,7 @@ import { import { Icons } from 'src/components/Icons'; import { Menu } from 'src/components/Menu'; import ModalTrigger from 'src/components/ModalTrigger'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { useToasts } from 'src/components/MessageToasts/withToasts'; import { exportChart, getChartKey } from 'src/explore/exploreUtils'; import downloadAsImage from 'src/utils/downloadAsImage'; diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index c81a5482622..4aa803d237a 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -39,16 +39,20 @@ import { import rison from 'rison'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; -import { InputNumber } from 'src/components/Input'; import { Switch } from 'src/components/Switch'; -import Modal from 'src/components/Modal'; -import Collapse from 'src/components/Collapse'; +import { + InputNumber, + Collapse, + Checkbox, + Select, + AsyncSelect, + Modal, +} from 'src/components'; import TimezoneSelector from 'src/components/TimezoneSelector'; import { propertyComparator } from 'src/components/Select/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import Owner from 'src/types/Owner'; -import { Select, AsyncSelect } from 'src/components'; -import Checkbox, { CheckboxChangeEvent } from 'src/components/Checkbox'; +import { CheckboxChangeEvent } from 'src/components/Checkbox/types'; import TreeSelect from 'src/components/TreeSelect'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; import { useCommonConf } from 'src/features/databases/state'; diff --git a/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx b/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx index 27b4c625df1..5e1b3894fd9 100644 --- a/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx +++ b/superset-frontend/src/features/alerts/components/AlertReportCronScheduler.tsx @@ -20,9 +20,7 @@ import { useState, useCallback, FocusEvent, FC } from 'react'; import { t, useTheme } from '@superset-ui/core'; -import { Select } from 'src/components'; -import { Input } from 'src/components/Input'; -import { CronPicker, CronError } from 'src/components/CronPicker'; +import { Input, CronPicker, Select, type CronError } from 'src/components'; import { StyledInputContainer } from '../AlertReportModal'; export interface AlertReportCronSchedulerProps { diff --git a/superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx b/superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx index 969c8374b62..d756ad2491c 100644 --- a/superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx +++ b/superset-frontend/src/features/alerts/components/AlertStatusIcon.tsx @@ -17,7 +17,7 @@ * under the License. */ import { t, SupersetTheme, useTheme } from '@superset-ui/core'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; import { AlertState } from '../types'; diff --git a/superset-frontend/src/features/alerts/components/NotificationMethod.tsx b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx index f7306cd4ea2..ccd217fe88a 100644 --- a/superset-frontend/src/features/alerts/components/NotificationMethod.tsx +++ b/superset-frontend/src/features/alerts/components/NotificationMethod.tsx @@ -34,9 +34,8 @@ import { t, useTheme, } from '@superset-ui/core'; -import { Input } from 'src/components/Input'; import { Icons } from 'src/components/Icons'; -import { Select } from 'src/components'; +import { Input, Select } from 'src/components'; import RefreshLabel from 'src/components/RefreshLabel'; import { NotificationMethodOption, diff --git a/superset-frontend/src/features/alerts/components/NumberInput.tsx b/superset-frontend/src/features/alerts/components/NumberInput.tsx index 8b37a65dcd5..5b1aa59d4da 100644 --- a/superset-frontend/src/features/alerts/components/NumberInput.tsx +++ b/superset-frontend/src/features/alerts/components/NumberInput.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Input } from 'src/components/Input'; +import { Input } from 'src/components'; import { useState, ChangeEvent } from 'react'; interface NumberInputProps { diff --git a/superset-frontend/src/features/alerts/components/RecipientIcon.tsx b/superset-frontend/src/features/alerts/components/RecipientIcon.tsx index 7d3e8ad07d9..0b3a9dc102d 100644 --- a/superset-frontend/src/features/alerts/components/RecipientIcon.tsx +++ b/superset-frontend/src/features/alerts/components/RecipientIcon.tsx @@ -18,7 +18,7 @@ */ import { SupersetTheme, css } from '@superset-ui/core'; import { ReactElement } from 'react'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; import { NotificationMethodOption } from '../types'; diff --git a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx index db2c36397f3..51ee51aefdf 100644 --- a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx +++ b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx @@ -20,9 +20,8 @@ import { extendedDayjs } from 'src/utils/dates'; import { t, styled } from '@superset-ui/core'; import TableView, { EmptyWrapperType } from 'src/components/TableView'; import TagsList from 'src/components/TagsList'; -import FacePile from 'src/components/FacePile'; import Tag from 'src/types/TagType'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, FacePile } from 'src/components'; import { NumberParam, useQueryParam } from 'use-query-params'; import { TaggedObject, TaggedObjects } from 'src/types/TaggedObject'; diff --git a/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx index f1ccfdacc29..580f2cd0919 100644 --- a/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx +++ b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.test.jsx @@ -20,7 +20,7 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; -import Modal from 'src/components/Modal'; +import { Modal } from 'src/components'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { styledMount as mount } from 'spec/helpers/theming'; import AnnotationLayerModal from './AnnotationLayerModal'; diff --git a/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx index 984aa3b48fa..cf98f44e293 100644 --- a/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx +++ b/superset-frontend/src/features/annotationLayers/AnnotationLayerModal.tsx @@ -21,9 +21,8 @@ import { FunctionComponent, useState, useEffect, ChangeEvent } from 'react'; import { css, styled, t, useTheme } from '@superset-ui/core'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; -import { Input } from 'src/components/Input'; import { Icons } from 'src/components/Icons'; -import Modal from 'src/components/Modal'; +import { Input, Modal } from 'src/components'; import withToasts from 'src/components/MessageToasts/withToasts'; import { OnlyKeyWithType } from 'src/utils/types'; diff --git a/superset-frontend/src/features/annotations/AnnotationModal.test.jsx b/superset-frontend/src/features/annotations/AnnotationModal.test.jsx index 53da727d60c..0cd766ae9b4 100644 --- a/superset-frontend/src/features/annotations/AnnotationModal.test.jsx +++ b/superset-frontend/src/features/annotations/AnnotationModal.test.jsx @@ -20,9 +20,8 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-redux'; import fetchMock from 'fetch-mock'; -import Modal from 'src/components/Modal'; +import { Modal, JsonEditor } from 'src/components'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; -import { JsonEditor } from 'src/components/AsyncAceEditor'; import { styledMount as mount } from 'spec/helpers/theming'; import AnnotationModal from './AnnotationModal'; diff --git a/superset-frontend/src/features/annotations/AnnotationModal.tsx b/superset-frontend/src/features/annotations/AnnotationModal.tsx index 884caea1d21..c4273866a45 100644 --- a/superset-frontend/src/features/annotations/AnnotationModal.tsx +++ b/superset-frontend/src/features/annotations/AnnotationModal.tsx @@ -20,13 +20,10 @@ import { FunctionComponent, useState, useEffect, ChangeEvent } from 'react'; import { css, styled, t, useTheme } from '@superset-ui/core'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; -import { RangePicker } from 'src/components/DatePicker'; import { extendedDayjs } from 'src/utils/dates'; import { Icons } from 'src/components/Icons'; -import { Input } from 'src/components/Input'; -import Modal from 'src/components/Modal'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { JsonEditor } from 'src/components/AsyncAceEditor'; +import { Input, JsonEditor, Modal, RangePicker } from 'src/components'; import { OnlyKeyWithType } from 'src/utils/types'; import { AnnotationObject } from './types'; diff --git a/superset-frontend/src/features/charts/ChartCard.tsx b/superset-frontend/src/features/charts/ChartCard.tsx index aad15415d32..15121ba6035 100644 --- a/superset-frontend/src/features/charts/ChartCard.tsx +++ b/superset-frontend/src/features/charts/ChartCard.tsx @@ -18,18 +18,20 @@ */ import { isFeatureEnabled, FeatureFlag, t, css } from '@superset-ui/core'; import { Link, useHistory } from 'react-router-dom'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + Button, + Dropdown, + FacePile, + FaveStar, + Label, + ListViewCard, +} from 'src/components'; import { Icons } from 'src/components/Icons'; import Chart from 'src/types/Chart'; -import ListViewCard from 'src/components/ListViewCard'; -import Label from 'src/components/Label'; -import { Dropdown } from 'src/components/Dropdown'; import { Menu } from 'src/components/Menu'; -import FaveStar from 'src/components/FaveStar'; -import FacePile from 'src/components/FacePile'; import { handleChartDelete, CardStyles } from 'src/views/CRUD/utils'; -import Button from 'src/components/Button'; interface ChartCardProps { chart: Chart; diff --git a/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx index d636835d006..d29e0c1b803 100644 --- a/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx +++ b/superset-frontend/src/features/cssTemplates/CssTemplateModal.test.jsx @@ -20,9 +20,8 @@ import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; -import Modal from 'src/components/Modal'; +import { Modal, CssEditor } from 'src/components'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; -import { CssEditor } from 'src/components/AsyncAceEditor'; import { styledMount as mount } from 'spec/helpers/theming'; import CssTemplateModal from './CssTemplateModal'; diff --git a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx index db8a0861b89..da37b58a559 100644 --- a/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx +++ b/superset-frontend/src/features/cssTemplates/CssTemplateModal.tsx @@ -22,10 +22,8 @@ import { css, styled, t, useTheme } from '@superset-ui/core'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { Icons } from 'src/components/Icons'; -import Modal from 'src/components/Modal'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Input } from 'src/components/Input'; -import { CssEditor } from 'src/components/AsyncAceEditor'; +import { Input, CssEditor, Modal } from 'src/components'; import { OnlyKeyWithType } from 'src/utils/types'; import { TemplateObject } from './types'; diff --git a/superset-frontend/src/features/dashboards/DashboardCard.tsx b/superset-frontend/src/features/dashboards/DashboardCard.tsx index c26c2ddd6da..38869ccf1c5 100644 --- a/superset-frontend/src/features/dashboards/DashboardCard.tsx +++ b/superset-frontend/src/features/dashboards/DashboardCard.tsx @@ -25,15 +25,17 @@ import { SupersetClient, } from '@superset-ui/core'; import { CardStyles } from 'src/views/CRUD/utils'; -import { Dropdown } from 'src/components/Dropdown'; +import { + Dropdown, + Button, + FacePile, + FaveStar, + PublishedLabel, + ListViewCard, +} from 'src/components'; import { Menu } from 'src/components/Menu'; -import ListViewCard from 'src/components/ListViewCard'; import { Icons } from 'src/components/Icons'; -import { PublishedLabel } from 'src/components/Label'; -import FacePile from 'src/components/FacePile'; -import FaveStar from 'src/components/FaveStar'; import { Dashboard } from 'src/views/CRUD/types'; -import Button from 'src/components/Button'; interface DashboardCardProps { isChart?: boolean; diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx index 696f52baa0a..11ae07fd54a 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/CommonParameters.tsx @@ -18,8 +18,10 @@ */ import { SupersetTheme, t } from '@superset-ui/core'; import { Switch } from 'src/components/Switch'; -import InfoTooltip from 'src/components/InfoTooltip'; -import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput'; +import { + InfoTooltip, + LabeledErrorBoundInput as ValidatedInput, +} from 'src/components'; import { FieldPropTypes } from '../../types'; import { toggleStyle, infoTooltip } from '../styles'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx index 0dda4b0a103..f5784977798 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/EncryptedField.tsx @@ -18,10 +18,7 @@ */ import { useRef, useState } from 'react'; import { SupersetTheme, css, t } from '@superset-ui/core'; -import { Select } from 'src/components'; -import Button from 'src/components/Button'; -import { Input } from 'src/components/Input'; -import { FormLabel } from 'src/components/Form'; +import { Input, Button, FormLabel, Select } from 'src/components'; import { Icons } from 'src/components/Icons'; import { DatabaseParameters, FieldPropTypes } from '../../types'; import { infoTooltip, CredentialInfoForm } from '../styles'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/OAuth2ClientField.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/OAuth2ClientField.tsx index 7b78a54e974..6133d76c7e1 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/OAuth2ClientField.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/OAuth2ClientField.tsx @@ -18,9 +18,7 @@ */ import { useState } from 'react'; -import Collapse from 'src/components/Collapse'; -import { Input } from 'src/components/Input'; -import { FormItem } from 'src/components/Form'; +import { Input, Collapse, FormItem } from 'src/components'; import { CustomParametersChangeType, FieldPropTypes } from '../../types'; const LABELS = { diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx index fca72603e3f..de2d9245c64 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/TableCatalog.tsx @@ -17,8 +17,10 @@ * under the License. */ import { css, SupersetTheme, t } from '@superset-ui/core'; -import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput'; -import { FormLabel } from 'src/components/Form'; +import { + FormLabel, + LabeledErrorBoundInput as ValidatedInput, +} from 'src/components'; import { Icons } from 'src/components/Icons'; import { StyledFooterButton, StyledCatalogTable } from '../styles'; import { CatalogObject, FieldPropTypes } from '../../types'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx index 1b6d206ed18..6eee479ef45 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/ValidatedInputField.tsx @@ -17,7 +17,7 @@ * under the License. */ import { t } from '@superset-ui/core'; -import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput'; +import { LabeledErrorBoundInput as ValidatedInput } from 'src/components'; import { DatabaseParameters, FieldPropTypes } from '../../types'; const FIELD_TEXT_MAP = { diff --git a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx index 0f375f3fe6e..7ed34fdc042 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/DatabaseConnectionForm/index.tsx @@ -17,7 +17,7 @@ * under the License. */ import { SupersetTheme } from '@superset-ui/core'; -import { Form } from 'src/components/Form'; +import { Form } from 'src/components'; import { FormFieldOrder, FORM_FIELD_MAP } from './constants'; import { formScrollableStyles, validatedFormStyles } from '../styles'; import { DatabaseConnectionFormProps } from '../../types'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx index a6d9e20b7cc..96020eba95d 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/ExtraOptions.tsx @@ -26,10 +26,13 @@ import { useTheme, FeatureFlag, } from '@superset-ui/core'; -import InfoTooltip from 'src/components/InfoTooltip'; -import Checkbox, { CheckboxChangeEvent } from 'src/components/Checkbox'; -import Collapse from 'src/components/Collapse'; -import { Input } from 'src/components/Input'; +import { + Input, + Checkbox, + Collapse, + InfoTooltip, + type CheckboxChangeEvent, +} from 'src/components'; import { StyledInputContainer, StyledJsonEditor, diff --git a/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx index 9ee86a54088..6f618592741 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelForm.tsx @@ -18,12 +18,10 @@ */ import { useState } from 'react'; import { t, styled } from '@superset-ui/core'; -import { Col, Row } from 'src/components/Grid'; -import { Form, FormLabel } from 'src/components/Form'; +import { Input, Form, FormLabel, Col, Row } from 'src/components'; import { Radio } from 'src/components/Radio'; // eslint-disable-next-line no-restricted-imports import { Tooltip } from 'antd'; // TODO: Remove antd -import { Input } from 'src/components/Input'; import { Icons } from 'src/components/Icons'; import { DatabaseObject, FieldPropTypes } from '../types'; import { AuthType } from '.'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx index 623091f397c..4df781283cc 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SSHTunnelSwitch.tsx @@ -24,7 +24,7 @@ import { FeatureFlag, } from '@superset-ui/core'; import { Switch } from 'src/components/Switch'; -import InfoTooltip from 'src/components/InfoTooltip'; +import { InfoTooltip } from 'src/components'; import { isEmpty } from 'lodash'; import { infoTooltip, toggleStyle } from './styles'; import { SwitchProps } from '../types'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx index 3e173fb5b62..493602bad7d 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/SqlAlchemyForm.tsx @@ -19,8 +19,7 @@ import { EventHandler, ChangeEvent, MouseEvent, ReactNode } from 'react'; import { t, SupersetTheme } from '@superset-ui/core'; import SupersetText from 'src/utils/textUtils'; -import Button from 'src/components/Button'; -import { Input } from 'src/components/Input'; +import { Input, Button } from 'src/components'; import { StyledInputContainer, wideButton } from './styles'; import { DatabaseObject } from '../types'; diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.tsx index ba69509e546..9da280090ba 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/index.tsx +++ b/superset-frontend/src/features/databases/DatabaseModal/index.tsx @@ -35,22 +35,25 @@ import { useCallback, ChangeEvent, } from 'react'; -import { CheckboxChangeEvent } from 'src/components/Checkbox'; +import { CheckboxChangeEvent } from 'src/components/Checkbox/types'; import { useHistory } from 'react-router-dom'; import { setItem, LocalStorageKeys } from 'src/utils/localStorageHelpers'; import Tabs from 'src/components/Tabs'; -import { Select } from 'src/components'; +import { + Alert, + Button, + ErrorMessageWithStackTrace, + LabeledErrorBoundInput as ValidatedInput, + Modal, + Select, + IconButton, + InfoTooltip, + Loading, +} from 'src/components'; import Upload, { UploadChangeParam, UploadFile } from 'src/components/Upload'; -import Alert from 'src/components/Alert'; -import Modal from 'src/components/Modal'; -import Button from 'src/components/Button'; -import { IconButton } from 'src/components/IconButton'; -import InfoTooltip from 'src/components/InfoTooltip'; import withToasts from 'src/components/MessageToasts/withToasts'; -import ValidatedInput from 'src/components/Form/LabeledErrorBoundInput'; -import ErrorMessageWithStackTrace from 'src/components/ErrorMessage/ErrorMessageWithStackTrace'; -import ErrorAlert from 'src/components/ImportModal/ErrorAlert'; +import { ErrorAlert } from 'src/components/ImportModal/ErrorAlert'; import { Icons } from 'src/components/Icons'; import { testDatabaseConnection, @@ -62,7 +65,6 @@ import { useImportResource, } from 'src/views/CRUD/hooks'; import { useCommonConf } from 'src/features/databases/state'; -import Loading from 'src/components/Loading'; import { isEmpty, pick } from 'lodash'; import { OnlyKeyWithType } from 'src/utils/types'; import { diff --git a/superset-frontend/src/features/databases/DatabaseModal/styles.ts b/superset-frontend/src/features/databases/DatabaseModal/styles.ts index ee7b3a93882..7ab9f999d49 100644 --- a/superset-frontend/src/features/databases/DatabaseModal/styles.ts +++ b/superset-frontend/src/features/databases/DatabaseModal/styles.ts @@ -18,8 +18,7 @@ */ import { css, styled, SupersetTheme } from '@superset-ui/core'; -import { JsonEditor } from 'src/components/AsyncAceEditor'; -import Button from 'src/components/Button'; +import { Button, JsonEditor } from 'src/components'; const CTAS_CVAS_SCHEMA_FORM_HEIGHT = 108; const EXPOSE_IN_SQLLAB_FORM_HEIGHT = CTAS_CVAS_SCHEMA_FORM_HEIGHT + 153; diff --git a/superset-frontend/src/features/databases/UploadDataModel/StyledFormItemWithTip.tsx b/superset-frontend/src/features/databases/UploadDataModel/StyledFormItemWithTip.tsx index a9d89c01c18..f6b8fb39b36 100644 --- a/superset-frontend/src/features/databases/UploadDataModel/StyledFormItemWithTip.tsx +++ b/superset-frontend/src/features/databases/UploadDataModel/StyledFormItemWithTip.tsx @@ -18,7 +18,7 @@ */ import { FC, ReactNode } from 'react'; -import InfoTooltip from 'src/components/InfoTooltip'; +import { InfoTooltip } from 'src/components'; import { StyledFormItem } from './styles'; interface StyledFormItemWithTipProps { diff --git a/superset-frontend/src/features/databases/UploadDataModel/index.tsx b/superset-frontend/src/features/databases/UploadDataModel/index.tsx index 21e24d44fa3..2a7cdbd4206 100644 --- a/superset-frontend/src/features/databases/UploadDataModel/index.tsx +++ b/superset-frontend/src/features/databases/UploadDataModel/index.tsx @@ -31,18 +31,23 @@ import { SupersetTheme, t, } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; -import Button from 'src/components/Button'; +import { + Button, + Collapse, + Form, + Select, + AsyncSelect, + Modal, + Row, + Col, + Input, + InputNumber, +} from 'src/components'; import { Switch, SwitchProps } from 'src/components/Switch'; -import Collapse from 'src/components/Collapse'; -import { Select, AsyncSelect } from 'src/components'; import Upload, { UploadChangeParam, UploadFile } from 'src/components/Upload'; -import { Row, Col } from 'src/components/Grid'; import { Icons } from 'src/components/Icons'; -import { Input, InputNumber } from 'src/components/Input'; import rison from 'rison'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Form } from 'src/components/Form'; import { antDModalNoPaddingStyles, antDModalStyles, diff --git a/superset-frontend/src/features/databases/UploadDataModel/styles.ts b/superset-frontend/src/features/databases/UploadDataModel/styles.ts index 744a8892e9e..2af396dee84 100644 --- a/superset-frontend/src/features/databases/UploadDataModel/styles.ts +++ b/superset-frontend/src/features/databases/UploadDataModel/styles.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { FormItem } from 'src/components/Form'; +import { FormItem } from 'src/components'; import { css, styled, SupersetTheme } from '@superset-ui/core'; const MODAL_BODY_HEIGHT = 180.5; diff --git a/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx index 2a0429e80f4..1315f15c188 100644 --- a/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/DatasetPanel.tsx @@ -18,7 +18,7 @@ */ import { t, styled } from '@superset-ui/core'; import { Icons } from 'src/components/Icons'; -import Alert from 'src/components/Alert'; +import { Alert } from 'src/components'; import Table, { ColumnsType, TableSize } from 'src/components/Table'; // @ts-ignore import LOADING_GIF from 'src/assets/images/loading.gif'; diff --git a/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx index 069c9501216..1a6e8f9f0bd 100644 --- a/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/DatasetPanel/MessageContent.tsx @@ -18,7 +18,7 @@ */ import { t, styled } from '@superset-ui/core'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState } from 'src/components'; import { Link } from 'react-router-dom'; const StyledContainer = styled.div` diff --git a/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx index 80a56e0e690..dfe8ca310ca 100644 --- a/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/EditDataset/UsageTab/index.tsx @@ -32,12 +32,14 @@ import Table, { TableSize, OnChangeFunction, } from 'src/components/Table'; -import { EmptyState } from 'src/components/EmptyState'; +import { + EmptyState, + ListViewFilterOperator as FilterOperator, +} from 'src/components'; import ChartImage from 'src/assets/images/chart.svg'; import { Icons } from 'src/components/Icons'; import { useToasts } from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; -import { FilterOperator } from 'src/components/ListView'; import { extendedDayjs } from 'src/utils/dates'; import TruncatedList from 'src/components/TruncatedList'; diff --git a/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx b/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx index 808610ee0f9..95b6d909656 100644 --- a/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/EditDataset/index.tsx @@ -18,7 +18,7 @@ */ import { styled, t } from '@superset-ui/core'; import useGetDatasetRelatedCounts from 'src/features/datasets/hooks/useGetDatasetRelatedCounts'; -import Badge from 'src/components/Badge'; +import { Badge } from 'src/components'; import Tabs from 'src/components/Tabs'; import UsageTab from './UsageTab'; diff --git a/superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx b/superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx index e72bc54f24a..53e58463215 100644 --- a/superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/Footer/index.tsx @@ -17,7 +17,7 @@ * under the License. */ import { useHistory } from 'react-router-dom'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; import { t } from '@superset-ui/core'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { logEvent } from 'src/logger/actions'; diff --git a/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx b/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx index 60fc8a22a6c..28b9b658a46 100644 --- a/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/Header/index.tsx @@ -19,10 +19,10 @@ import { Dispatch } from 'react'; import { t } from '@superset-ui/core'; import { PageHeaderWithActions } from 'src/components/PageHeaderWithActions'; -import Button from 'src/components/Button'; +import { Button } from 'src/components'; +import { TooltipPlacement } from 'src/components/Tooltip/types'; import { Icons } from 'src/components/Icons'; import { Menu } from 'src/components/Menu'; -import { TooltipPlacement } from 'src/components/Tooltip'; import { DatasetActionType, DSReducerActionType, diff --git a/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx index 9f6f852c0a0..6c1f4c7dba0 100644 --- a/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/LeftPanel/index.tsx @@ -19,8 +19,7 @@ import { useEffect, SetStateAction, Dispatch, useCallback } from 'react'; import { styled, t } from '@superset-ui/core'; import TableSelector, { TableOption } from 'src/components/TableSelector'; -import { DatabaseObject } from 'src/components/DatabaseSelector'; -import { EmptyState } from 'src/components/EmptyState'; +import { EmptyState, type DatabaseObject } from 'src/components'; import { useToasts } from 'src/components/MessageToasts/withToasts'; import { LocalStorageKeys, getItem } from 'src/utils/localStorageHelpers'; import { diff --git a/superset-frontend/src/features/datasets/AddDataset/types.tsx b/superset-frontend/src/features/datasets/AddDataset/types.tsx index 1c4b16436d3..561d000fed8 100644 --- a/superset-frontend/src/features/datasets/AddDataset/types.tsx +++ b/superset-frontend/src/features/datasets/AddDataset/types.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { DatabaseObject } from 'src/components/DatabaseSelector'; +import type { DatabaseObject } from 'src/components'; export enum DatasetActionType { SelectDatabase, diff --git a/superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx b/superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx index 93b95c282b4..d247ac10e55 100644 --- a/superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx +++ b/superset-frontend/src/features/datasets/DatasetSelectLabel/index.tsx @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip } from 'src/components'; import { styled, t } from '@superset-ui/core'; type Database = { diff --git a/superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx b/superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx index 91440aaf3e2..c3486027ea9 100644 --- a/superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx +++ b/superset-frontend/src/features/datasets/DuplicateDatasetModal.tsx @@ -18,9 +18,7 @@ */ import { t } from '@superset-ui/core'; import { FunctionComponent, useEffect, useState, ChangeEvent } from 'react'; -import { FormLabel } from 'src/components/Form'; -import { Input } from 'src/components/Input'; -import Modal from 'src/components/Modal'; +import { Input, FormLabel, Modal } from 'src/components'; import Dataset from 'src/types/Dataset'; interface DuplicateDatasetModalProps { diff --git a/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts b/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts index 373d98946f8..8be422ee129 100644 --- a/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts +++ b/superset-frontend/src/features/datasets/hooks/useDatasetLists.ts @@ -21,7 +21,7 @@ import { SupersetClient, logging, t } from '@superset-ui/core'; import rison from 'rison'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import { DatasetObject } from 'src/features/datasets/AddDataset/types'; -import { DatabaseObject } from 'src/components/DatabaseSelector'; +import type { DatabaseObject } from 'src/components'; /** * Retrieves all pages of dataset results diff --git a/superset-frontend/src/features/datasets/metadataBar/useDatasetMetadataBar.tsx b/superset-frontend/src/features/datasets/metadataBar/useDatasetMetadataBar.tsx index d72e4d183cf..3695bed5770 100644 --- a/superset-frontend/src/features/datasets/metadataBar/useDatasetMetadataBar.tsx +++ b/superset-frontend/src/features/datasets/metadataBar/useDatasetMetadataBar.tsx @@ -18,7 +18,7 @@ */ import { useEffect, useMemo, useState } from 'react'; import { css, t, useTheme } from '@superset-ui/core'; -import Alert from 'src/components/Alert'; +import { Alert } from 'src/components'; import { Dataset } from 'src/components/Chart/types'; import MetadataBar from 'src/components/MetadataBar'; import { diff --git a/superset-frontend/src/features/home/ActivityTable.tsx b/superset-frontend/src/features/home/ActivityTable.tsx index 76e2f89f75c..3a00857a174 100644 --- a/superset-frontend/src/features/home/ActivityTable.tsx +++ b/superset-frontend/src/features/home/ActivityTable.tsx @@ -21,7 +21,7 @@ import { extendedDayjs } from 'src/utils/dates'; import { styled, t } from '@superset-ui/core'; import { setItem, LocalStorageKeys } from 'src/utils/localStorageHelpers'; import { Link } from 'react-router-dom'; -import ListViewCard from 'src/components/ListViewCard'; +import { ListViewCard } from 'src/components'; import { Dashboard, SavedQueryObject, TableTab } from 'src/views/CRUD/types'; import { ActivityData, LoadingCards } from 'src/pages/Home'; import { diff --git a/superset-frontend/src/features/home/ChartTable.tsx b/superset-frontend/src/features/home/ChartTable.tsx index a228ec05b40..f38cc856c9d 100644 --- a/superset-frontend/src/features/home/ChartTable.tsx +++ b/superset-frontend/src/features/home/ChartTable.tsx @@ -42,8 +42,7 @@ import { LoadingCards } from 'src/pages/Home'; import ChartCard from 'src/features/charts/ChartCard'; import Chart from 'src/types/Chart'; import handleResourceExport from 'src/utils/export'; -import Loading from 'src/components/Loading'; -import ErrorBoundary from 'src/components/ErrorBoundary'; +import { ErrorBoundary, Loading } from 'src/components'; import { Icons } from 'src/components/Icons'; import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; diff --git a/superset-frontend/src/features/home/DashboardTable.tsx b/superset-frontend/src/features/home/DashboardTable.tsx index 0086b9e692c..6ebf4daa51e 100644 --- a/superset-frontend/src/features/home/DashboardTable.tsx +++ b/superset-frontend/src/features/home/DashboardTable.tsx @@ -36,8 +36,7 @@ import { handleDashboardDelete, } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; -import Loading from 'src/components/Loading'; -import DeleteModal from 'src/components/DeleteModal'; +import { DeleteModal, Loading } from 'src/components'; import PropertiesModal from 'src/dashboard/components/PropertiesModal'; import DashboardCard from 'src/features/dashboards/DashboardCard'; import { Icons } from 'src/components/Icons'; diff --git a/superset-frontend/src/features/home/EmptyState.tsx b/superset-frontend/src/features/home/EmptyState.tsx index acde8a6dbb2..c4f23782568 100644 --- a/superset-frontend/src/features/home/EmptyState.tsx +++ b/superset-frontend/src/features/home/EmptyState.tsx @@ -16,8 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import Button from 'src/components/Button'; -import { EmptyState as EmptyStateComponent } from 'src/components/EmptyState'; +import { Button, EmptyState as EmptyStateComponent } from 'src/components'; import { TableTab } from 'src/views/CRUD/types'; import { styled, t } from '@superset-ui/core'; import { WelcomeTable } from './types'; diff --git a/superset-frontend/src/features/home/Menu.tsx b/superset-frontend/src/features/home/Menu.tsx index 85b359a5085..881656c962a 100644 --- a/superset-frontend/src/features/home/Menu.tsx +++ b/superset-frontend/src/features/home/Menu.tsx @@ -20,11 +20,9 @@ import { useState, useEffect } from 'react'; import { styled, css, useTheme } from '@superset-ui/core'; import { debounce } from 'lodash'; import { getUrlParam } from 'src/utils/urlUtils'; -import Grid, { Row, Col } from 'src/components/Grid'; import { MainNav, MenuMode } from 'src/components/Menu'; -import { Tooltip } from 'src/components/Tooltip'; +import { GenericLink, Tooltip, Grid, Row, Col } from 'src/components'; import { NavLink, useLocation } from 'react-router-dom'; -import { GenericLink } from 'src/components/GenericLink/GenericLink'; import { Icons } from 'src/components/Icons'; import { useUiConfig } from 'src/components/UiConfigContext'; import { URL_PARAMS } from 'src/constants'; diff --git a/superset-frontend/src/features/home/RightMenu.tsx b/superset-frontend/src/features/home/RightMenu.tsx index 16d66207361..85aa85710ad 100644 --- a/superset-frontend/src/features/home/RightMenu.tsx +++ b/superset-frontend/src/features/home/RightMenu.tsx @@ -39,9 +39,8 @@ import { FeatureFlag, } from '@superset-ui/core'; import { Menu } from 'src/components/Menu'; -import { Tooltip } from 'src/components/Tooltip'; +import { Label, Tooltip } from 'src/components'; import { Icons } from 'src/components/Icons'; -import Label from 'src/components/Label'; import { findPermission } from 'src/utils/findPermission'; import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; import { diff --git a/superset-frontend/src/features/home/SavedQueries.tsx b/superset-frontend/src/features/home/SavedQueries.tsx index f2550b97b5a..226f8909521 100644 --- a/superset-frontend/src/features/home/SavedQueries.tsx +++ b/superset-frontend/src/features/home/SavedQueries.tsx @@ -25,11 +25,9 @@ import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; import { LoadingCards } from 'src/pages/Home'; import { TableTab } from 'src/views/CRUD/types'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Dropdown } from 'src/components/Dropdown'; +import { Dropdown, DeleteModal, Button, ListViewCard } from 'src/components'; import { Menu } from 'src/components/Menu'; import { copyQueryLink, useListViewResource } from 'src/views/CRUD/hooks'; -import ListViewCard from 'src/components/ListViewCard'; -import DeleteModal from 'src/components/DeleteModal'; import { Icons } from 'src/components/Icons'; import { User } from 'src/types/bootstrapTypes'; import { @@ -39,7 +37,6 @@ import { PAGE_SIZE, shortenSQL, } from 'src/views/CRUD/utils'; -import Button from 'src/components/Button'; import SubMenu from './SubMenu'; import EmptyState from './EmptyState'; import { WelcomeTable } from './types'; diff --git a/superset-frontend/src/features/home/SubMenu.tsx b/superset-frontend/src/features/home/SubMenu.tsx index 81c7a476cd1..39863d03bfa 100644 --- a/superset-frontend/src/features/home/SubMenu.tsx +++ b/superset-frontend/src/features/home/SubMenu.tsx @@ -21,11 +21,9 @@ import { ReactNode, useState, useEffect, FunctionComponent } from 'react'; import { Link, useHistory } from 'react-router-dom'; import { styled, SupersetTheme, css, t, useTheme } from '@superset-ui/core'; import cx from 'classnames'; -import { Tooltip } from 'src/components/Tooltip'; import { debounce } from 'lodash'; -import { Row } from 'src/components/Grid'; import { Menu, MenuMode, MainNav } from 'src/components/Menu'; -import Button, { OnClickHandler } from 'src/components/Button'; +import { Button, Tooltip, Row, type OnClickHandler } from 'src/components'; import { Icons } from 'src/components/Icons'; import { MenuObjectProps } from 'src/types/bootstrapTypes'; diff --git a/superset-frontend/src/features/queries/QueryPreviewModal.tsx b/superset-frontend/src/features/queries/QueryPreviewModal.tsx index 54800d57bd9..12fdecf651e 100644 --- a/superset-frontend/src/features/queries/QueryPreviewModal.tsx +++ b/superset-frontend/src/features/queries/QueryPreviewModal.tsx @@ -18,9 +18,8 @@ */ import { useState } from 'react'; import { styled, t } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; import cx from 'classnames'; -import Button from 'src/components/Button'; +import { Button, Modal } from 'src/components'; import withToasts, { ToastProps, } from 'src/components/MessageToasts/withToasts'; diff --git a/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx b/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx index 3adac7f9f81..f6eff2194de 100644 --- a/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx +++ b/superset-frontend/src/features/queries/SavedQueryPreviewModal.test.jsx @@ -20,8 +20,7 @@ import thunk from 'redux-thunk'; import configureStore from 'redux-mock-store'; import fetchMock from 'fetch-mock'; import { styledMount as mount } from 'spec/helpers/theming'; -import Button from 'src/components/Button'; -import Modal from 'src/components/Modal'; +import { Button, Modal } from 'src/components'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { act } from 'spec/helpers/testing-library'; import SavedQueryPreviewModal from './SavedQueryPreviewModal'; diff --git a/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx b/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx index 99705b5a1b4..72bc98c24ca 100644 --- a/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx +++ b/superset-frontend/src/features/queries/SavedQueryPreviewModal.tsx @@ -18,8 +18,7 @@ */ import { FunctionComponent } from 'react'; import { styled, t } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; -import Button from 'src/components/Button'; +import { Button, Modal } from 'src/components'; import SyntaxHighlighterCopy from 'src/features/queries/SyntaxHighlighterCopy'; import withToasts, { ToastProps, diff --git a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx index 2bf46ca4cc6..8136aa802ab 100644 --- a/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/HeaderReportDropdown/index.tsx @@ -33,7 +33,7 @@ import { Icons } from 'src/components/Icons'; import { Switch } from 'src/components/Switch'; import { AlertObject } from 'src/features/alerts/types'; import { Menu } from 'src/components/Menu'; -import Checkbox from 'src/components/Checkbox'; +import { Checkbox } from 'src/components'; import { noOp } from 'src/utils/common'; import { ChartState } from 'src/explore/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; diff --git a/superset-frontend/src/features/reports/ReportModal/index.tsx b/superset-frontend/src/features/reports/ReportModal/index.tsx index 2d7e6c85fd9..e181f5abceb 100644 --- a/superset-frontend/src/features/reports/ReportModal/index.tsx +++ b/superset-frontend/src/features/reports/ReportModal/index.tsx @@ -36,13 +36,15 @@ import { addReport, editReport, } from 'src/features/reports/ReportModal/actions'; -import Alert from 'src/components/Alert'; +import { + Alert, + Input, + LabeledErrorBoundInput, + type CronError, +} from 'src/components'; import TimezoneSelector from 'src/components/TimezoneSelector'; -import LabeledErrorBoundInput from 'src/components/Form/LabeledErrorBoundInput'; import { Icons } from 'src/components/Icons'; -import { CronError } from 'src/components/CronPicker'; import { Radio, RadioChangeEvent } from 'src/components/Radio'; -import { Input } from 'src/components/Input'; import withToasts from 'src/components/MessageToasts/withToasts'; import { ChartState } from 'src/explore/types'; import { diff --git a/superset-frontend/src/features/reports/ReportModal/styles.tsx b/superset-frontend/src/features/reports/ReportModal/styles.tsx index 7cef1989a04..561d6b86650 100644 --- a/superset-frontend/src/features/reports/ReportModal/styles.tsx +++ b/superset-frontend/src/features/reports/ReportModal/styles.tsx @@ -18,10 +18,8 @@ */ import { styled, css, SupersetTheme } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; -import Button from 'src/components/Button'; +import { Button, CronPicker, Modal } from 'src/components'; import { Radio } from 'src/components/Radio'; -import { CronPicker } from 'src/components/CronPicker'; export const StyledModal = styled(Modal)` .antd5-modal-body { diff --git a/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx b/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx index fd179d09af9..b745990712e 100644 --- a/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx +++ b/superset-frontend/src/features/rls/RowLevelSecurityModal.tsx @@ -18,14 +18,17 @@ */ import { css, styled, SupersetClient, useTheme, t } from '@superset-ui/core'; -import Modal from 'src/components/Modal'; import { useCallback, useEffect, useMemo, useState } from 'react'; import { Icons } from 'src/components/Icons'; -import { Select, AsyncSelect } from 'src/components'; -import { Input } from 'src/components/Input'; +import { + Modal, + Select, + AsyncSelect, + InfoTooltip, + LabeledErrorBoundInput, + Input, +} from 'src/components'; import rison from 'rison'; -import { LabeledErrorBoundInput } from 'src/components/Form'; -import InfoTooltip from 'src/components/InfoTooltip'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; import { FILTER_OPTIONS } from './constants'; import { FilterType, RLSObject, RoleObject, TableObject } from './types'; diff --git a/superset-frontend/src/features/roles/RoleFormItems.tsx b/superset-frontend/src/features/roles/RoleFormItems.tsx index 56c4ad76f4b..46805826868 100644 --- a/superset-frontend/src/features/roles/RoleFormItems.tsx +++ b/superset-frontend/src/features/roles/RoleFormItems.tsx @@ -16,9 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { FormItem } from 'src/components/Form'; -import Select from 'src/components/Select/Select'; -import { Input } from 'src/components/Input'; +import { FormItem, Input, Select } from 'src/components'; import { t } from '@superset-ui/core'; import { FC } from 'react'; import { FormattedPermission, UserObject } from './types'; diff --git a/superset-frontend/src/features/roles/RoleListAddModal.test.tsx b/superset-frontend/src/features/roles/RoleListAddModal.test.tsx index 69d7eb66365..0c288bc0938 100644 --- a/superset-frontend/src/features/roles/RoleListAddModal.test.tsx +++ b/superset-frontend/src/features/roles/RoleListAddModal.test.tsx @@ -35,6 +35,8 @@ jest.mock('./utils'); const mockCreateRole = jest.mocked(createRole); jest.mock('src/components/MessageToasts/withToasts', () => ({ + __esModule: true, + default: (Component: any) => Component, useToasts: () => mockToasts, })); diff --git a/superset-frontend/src/features/roles/RoleListAddModal.tsx b/superset-frontend/src/features/roles/RoleListAddModal.tsx index c80def6724a..a5c0e054125 100644 --- a/superset-frontend/src/features/roles/RoleListAddModal.tsx +++ b/superset-frontend/src/features/roles/RoleListAddModal.tsx @@ -18,7 +18,7 @@ */ import { t } from '@superset-ui/core'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import FormModal from 'src/components/Modal/FormModal'; +import { FormModal } from 'src/components'; import { createRole, updateRolePermissions } from './utils'; import { PermissionsField, RoleNameField } from './RoleFormItems'; import { BaseModalProps, FormattedPermission, RoleForm } from './types'; diff --git a/superset-frontend/src/features/roles/RoleListDuplicateModal.test.tsx b/superset-frontend/src/features/roles/RoleListDuplicateModal.test.tsx index 21c56b9b309..dc8410b8dd5 100644 --- a/superset-frontend/src/features/roles/RoleListDuplicateModal.test.tsx +++ b/superset-frontend/src/features/roles/RoleListDuplicateModal.test.tsx @@ -36,9 +36,10 @@ const mockCreateRole = jest.mocked(createRole); const mockUpdateRolePermissions = jest.mocked(updateRolePermissions); jest.mock('src/components/MessageToasts/withToasts', () => ({ + __esModule: true, + default: (Component: any) => Component, useToasts: () => mockToasts, })); - describe('RoleListDuplicateModal', () => { const mockRole = { id: 1, diff --git a/superset-frontend/src/features/roles/RoleListDuplicateModal.tsx b/superset-frontend/src/features/roles/RoleListDuplicateModal.tsx index f7d6b7a19d0..2359d61abbc 100644 --- a/superset-frontend/src/features/roles/RoleListDuplicateModal.tsx +++ b/superset-frontend/src/features/roles/RoleListDuplicateModal.tsx @@ -20,7 +20,7 @@ import { t } from '@superset-ui/core'; import { RoleObject } from 'src/pages/RolesList'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import FormModal from 'src/components/Modal/FormModal'; +import { FormModal } from 'src/components'; import { RoleNameField } from './RoleFormItems'; import { BaseModalProps, RoleForm } from './types'; import { createRole, updateRolePermissions } from './utils'; diff --git a/superset-frontend/src/features/roles/RoleListEditModal.test.tsx b/superset-frontend/src/features/roles/RoleListEditModal.test.tsx index 8e8c17dc0a0..4b6c82cf7fa 100644 --- a/superset-frontend/src/features/roles/RoleListEditModal.test.tsx +++ b/superset-frontend/src/features/roles/RoleListEditModal.test.tsx @@ -41,6 +41,8 @@ const mockUpdateRolePermissions = jest.mocked(updateRolePermissions); const mockUpdateRoleUsers = jest.mocked(updateRoleUsers); jest.mock('src/components/MessageToasts/withToasts', () => ({ + __esModule: true, + default: (Component: any) => Component, useToasts: () => mockToasts, })); diff --git a/superset-frontend/src/features/roles/RoleListEditModal.tsx b/superset-frontend/src/features/roles/RoleListEditModal.tsx index 6040c0f4a71..b0b7b199628 100644 --- a/superset-frontend/src/features/roles/RoleListEditModal.tsx +++ b/superset-frontend/src/features/roles/RoleListEditModal.tsx @@ -28,7 +28,7 @@ import { UserObject, } from 'src/features/roles/types'; import { useToasts } from 'src/components/MessageToasts/withToasts'; -import FormModal from 'src/components/Modal/FormModal'; +import { FormModal } from 'src/components'; import { PermissionsField, RoleNameField, UsersField } from './RoleFormItems'; import { updateRoleName, diff --git a/superset-frontend/src/features/tags/BulkTagModal.tsx b/superset-frontend/src/features/tags/BulkTagModal.tsx index 19544cbc25e..d687d670570 100644 --- a/superset-frontend/src/features/tags/BulkTagModal.tsx +++ b/superset-frontend/src/features/tags/BulkTagModal.tsx @@ -19,10 +19,7 @@ import { useState, useEffect, FC } from 'react'; import { t, styled, SupersetClient } from '@superset-ui/core'; -import { FormLabel } from 'src/components/Form'; -import Modal from 'src/components/Modal'; -import { AsyncSelect } from 'src/components'; -import Button from 'src/components/Button'; +import { FormLabel, AsyncSelect, Button, Modal } from 'src/components'; import { loadTags } from 'src/components/Tag/utils'; import { TaggableResourceOption } from 'src/features/tags/TagModal'; diff --git a/superset-frontend/src/features/tags/TagCard.tsx b/superset-frontend/src/features/tags/TagCard.tsx index 81fcd921a3f..d7fc42fe6c4 100644 --- a/superset-frontend/src/features/tags/TagCard.tsx +++ b/superset-frontend/src/features/tags/TagCard.tsx @@ -19,14 +19,16 @@ import { Link } from 'react-router-dom'; import { isFeatureEnabled, FeatureFlag, t } from '@superset-ui/core'; import { CardStyles } from 'src/views/CRUD/utils'; -import { Dropdown } from 'src/components/Dropdown'; +import { + Dropdown, + ConfirmStatusChange, + Button, + ListViewCard, +} from 'src/components'; import { Menu } from 'src/components/Menu'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import ListViewCard from 'src/components/ListViewCard'; import { Icons } from 'src/components/Icons'; import { Tag } from 'src/views/CRUD/types'; import { deleteTags } from 'src/features/tags/tags'; -import Button from 'src/components/Button'; interface TagCardProps { tag: Tag; diff --git a/superset-frontend/src/features/tags/TagModal.tsx b/superset-frontend/src/features/tags/TagModal.tsx index 42163ea6d75..d0ca1efd765 100644 --- a/superset-frontend/src/features/tags/TagModal.tsx +++ b/superset-frontend/src/features/tags/TagModal.tsx @@ -19,14 +19,10 @@ import { ChangeEvent, useState, useEffect, FC } from 'react'; import rison from 'rison'; -import Modal from 'src/components/Modal'; -import { AsyncSelect } from 'src/components'; -import { FormLabel } from 'src/components/Form'; +import { AsyncSelect, Button, Divider, FormLabel, Modal } from 'src/components'; import { t, styled, SupersetClient } from '@superset-ui/core'; // eslint-disable-next-line no-restricted-imports import { Input } from 'antd'; // TODO: Remove antd -import { Divider } from 'src/components/Divider'; -import Button from 'src/components/Button'; import { Tag } from 'src/views/CRUD/types'; import { fetchObjectsByTagIds } from 'src/features/tags/tags'; diff --git a/superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx b/superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx index 6a7dda0f100..12f7f8b27bd 100644 --- a/superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx +++ b/superset-frontend/src/filters/components/Range/RangeFilterPlugin.tsx @@ -26,11 +26,10 @@ import { t, } from '@superset-ui/core'; import { useCallback, useEffect, useMemo, useState } from 'react'; -import { InputNumber } from 'src/components/Input'; import { FilterBarOrientation } from 'src/dashboard/types'; import Metadata from 'src/components/Metadata'; import { isNumber } from 'lodash'; -import { FormItem } from 'src/components/Form'; +import { FormItem, InputNumber } from 'src/components'; import { PluginFilterRangeProps } from './types'; import { StatusMessage, FilterPluginStyle } from '../common'; import { getRangeExtraFormData } from '../../utils'; diff --git a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx index 8e9489fa2e4..1e40e8b76b9 100644 --- a/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx +++ b/superset-frontend/src/filters/components/Select/SelectFilterPlugin.tsx @@ -30,14 +30,12 @@ import { t, tn, } from '@superset-ui/core'; -import { LabeledValue as AntdLabeledValue } from 'src/components/Select'; import { debounce } from 'lodash'; import { useImmerReducer } from 'use-immer'; -import { Select } from 'src/components'; +import { Select, FormItem, type LabeledValue } from 'src/components'; import { SLOW_DEBOUNCE } from 'src/constants'; import { hasOption, propertyComparator } from 'src/components/Select/utils'; import { FilterBarOrientation } from 'src/dashboard/types'; -import { FormItem } from 'src/components/Form'; import { PluginFilterSelectProps, SelectValue } from './types'; import { FilterPluginStyle, StatusMessage } from '../common'; import { getDataRecordFormatter, getSelectExtraFormData } from '../../utils'; @@ -243,7 +241,7 @@ export default function PluginFilterSelect(props: PluginFilterSelectProps) { }, [multiSelect, search, uniqueOptions]); const sortComparator = useCallback( - (a: AntdLabeledValue, b: AntdLabeledValue) => { + (a: LabeledValue, b: LabeledValue) => { const labelComparator = propertyComparator('label'); if (formData.sortAscending) { return labelComparator(a, b); diff --git a/superset-frontend/src/filters/components/TimeColumn/TimeColumnFilterPlugin.tsx b/superset-frontend/src/filters/components/TimeColumn/TimeColumnFilterPlugin.tsx index 9f50e2103c9..ad2d7932680 100644 --- a/superset-frontend/src/filters/components/TimeColumn/TimeColumnFilterPlugin.tsx +++ b/superset-frontend/src/filters/components/TimeColumn/TimeColumnFilterPlugin.tsx @@ -24,8 +24,7 @@ import { tn, } from '@superset-ui/core'; import { useEffect, useState } from 'react'; -import { Select } from 'src/components'; -import { FormItem, FormItemProps } from 'src/components/Form'; +import { FormItem, type FormItemProps, Select } from 'src/components'; import { FilterPluginStyle, StatusMessage } from '../common'; import { PluginFilterTimeColumnProps } from './types'; diff --git a/superset-frontend/src/filters/components/TimeColumn/types.ts b/superset-frontend/src/filters/components/TimeColumn/types.ts index 3d7d3d972e5..6767ecccb91 100644 --- a/superset-frontend/src/filters/components/TimeColumn/types.ts +++ b/superset-frontend/src/filters/components/TimeColumn/types.ts @@ -23,7 +23,7 @@ import { QueryFormData, } from '@superset-ui/core'; import { RefObject } from 'react'; -import { RefSelectProps } from 'src/components/Select/types'; +import type { RefSelectProps } from 'src/components'; import { PluginFilterHooks, PluginFilterStylesProps } from '../types'; interface PluginFilterTimeColumnCustomizeProps { diff --git a/superset-frontend/src/filters/components/TimeGrain/TimeGrainFilterPlugin.tsx b/superset-frontend/src/filters/components/TimeGrain/TimeGrainFilterPlugin.tsx index 230823c7d76..4b7319be170 100644 --- a/superset-frontend/src/filters/components/TimeGrain/TimeGrainFilterPlugin.tsx +++ b/superset-frontend/src/filters/components/TimeGrain/TimeGrainFilterPlugin.tsx @@ -24,8 +24,7 @@ import { tn, } from '@superset-ui/core'; import { useEffect, useMemo, useState } from 'react'; -import { Select } from 'src/components'; -import { FormItem, FormItemProps } from 'src/components/Form'; +import { FormItem, type FormItemProps, Select } from 'src/components'; import { FilterPluginStyle, StatusMessage } from '../common'; import { PluginFilterTimeGrainProps } from './types'; diff --git a/superset-frontend/src/filters/components/TimeGrain/types.ts b/superset-frontend/src/filters/components/TimeGrain/types.ts index 7e3e62a249e..a1406cbba43 100644 --- a/superset-frontend/src/filters/components/TimeGrain/types.ts +++ b/superset-frontend/src/filters/components/TimeGrain/types.ts @@ -18,7 +18,7 @@ */ import { FilterState, QueryFormData, DataRecord } from '@superset-ui/core'; import { RefObject } from 'react'; -import { RefSelectProps } from 'src/components/Select/types'; +import type { RefSelectProps } from 'src/components'; import { PluginFilterHooks, PluginFilterStylesProps } from '../types'; interface PluginFilterTimeGrainCustomizeProps { diff --git a/superset-frontend/src/pages/AlertReportList/index.tsx b/superset-frontend/src/pages/AlertReportList/index.tsx index 419aed64252..005ec1b13a9 100644 --- a/superset-frontend/src/pages/AlertReportList/index.tsx +++ b/superset-frontend/src/pages/AlertReportList/index.tsx @@ -29,23 +29,26 @@ import { getExtensionsRegistry, } from '@superset-ui/core'; import { extendedDayjs } from 'src/utils/dates'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; -import FacePile from 'src/components/FacePile'; -import { Tooltip } from 'src/components/Tooltip'; -import ListView, { - FilterOperator, - Filters, - ListViewProps, -} from 'src/components/ListView'; +import { + FacePile, + Tooltip, + ModifiedInfo, + ConfirmStatusChange, + DeleteModal, + LastUpdated, + ListView, + ListViewFilterOperator as FilterOperator, + ListViewActionsBar, + type ListViewActionProps, + type ListViewProps, + type ListViewFilters, +} from 'src/components'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import { Switch } from 'src/components/Switch'; import { DATETIME_WITH_TIME_ZONE } from 'src/constants'; import withToasts from 'src/components/MessageToasts/withToasts'; import AlertStatusIcon from 'src/features/alerts/components/AlertStatusIcon'; import RecipientIcon from 'src/features/alerts/components/RecipientIcon'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import DeleteModal from 'src/components/DeleteModal'; -import LastUpdated from 'src/components/LastUpdated'; import { useListViewResource, useSingleViewResource, @@ -55,7 +58,6 @@ import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; import Owner from 'src/types/Owner'; import AlertReportModal from 'src/features/alerts/AlertReportModal'; import { AlertObject, AlertState } from 'src/features/alerts/types'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; import { Icons } from 'src/components/Icons'; @@ -405,7 +407,9 @@ function AlertList({ : null, ].filter(item => item !== null); - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', @@ -474,7 +478,7 @@ function AlertList({ ) : null, }; - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/AllEntities/index.tsx b/superset-frontend/src/pages/AllEntities/index.tsx index ed7593e7eb6..62446f87cf5 100644 --- a/superset-frontend/src/pages/AllEntities/index.tsx +++ b/superset-frontend/src/pages/AllEntities/index.tsx @@ -20,7 +20,7 @@ import { useEffect, useState } from 'react'; import { styled, t, css, SupersetTheme } from '@superset-ui/core'; import { NumberParam, useQueryParam } from 'use-query-params'; import AllEntitiesTable from 'src/features/allEntities/AllEntitiesTable'; -import Button from 'src/components/Button'; +import { Button, Loading } from 'src/components'; import MetadataBar, { MetadataType, Description, @@ -32,7 +32,6 @@ import { Tag } from 'src/views/CRUD/types'; import TagModal from 'src/features/tags/TagModal'; import withToasts, { useToasts } from 'src/components/MessageToasts/withToasts'; import { fetchObjectsByTagIds, fetchSingleTag } from 'src/features/tags/tags'; -import Loading from 'src/components/Loading'; import getOwnerName from 'src/utils/getOwnerName'; import { TaggedObject, TaggedObjects } from 'src/types/TaggedObject'; diff --git a/superset-frontend/src/pages/AnnotationLayerList/index.tsx b/superset-frontend/src/pages/AnnotationLayerList/index.tsx index 8e9e5c30804..5b921b1a6cd 100644 --- a/superset-frontend/src/pages/AnnotationLayerList/index.tsx +++ b/superset-frontend/src/pages/AnnotationLayerList/index.tsx @@ -25,17 +25,20 @@ import { useListViewResource } from 'src/views/CRUD/hooks'; import { createFetchRelated, createErrorHandler } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; -import ListView, { - ListViewProps, - Filters, - FilterOperator, -} from 'src/components/ListView'; -import DeleteModal from 'src/components/DeleteModal'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; + +import { + DeleteModal, + ConfirmStatusChange, + ModifiedInfo, + ListView, + ListViewFilterOperator as FilterOperator, + ListViewActionsBar, + type ListViewActionProps, + type ListViewProps, + type ListViewFilters, +} from 'src/components'; import AnnotationLayerModal from 'src/features/annotationLayers/AnnotationLayerModal'; import { AnnotationLayerObject } from 'src/features/annotationLayers/types'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; import { Icons } from 'src/components/Icons'; @@ -197,7 +200,9 @@ function AnnotationLayersList({ : null, ].filter(item => !!item); - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', @@ -245,7 +250,7 @@ function AnnotationLayersList({ }); } - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx b/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx index fbd9d59e512..b7ca98b7680 100644 --- a/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx +++ b/superset-frontend/src/pages/AnnotationList/AnnotationList.test.jsx @@ -23,8 +23,7 @@ import { Provider } from 'react-redux'; import { styledMount as mount } from 'spec/helpers/theming'; import AnnotationList from 'src/pages/AnnotationList'; -import DeleteModal from 'src/components/DeleteModal'; -import ListView from 'src/components/ListView'; +import { DeleteModal, ListView } from 'src/components'; import SubMenu from 'src/features/home/SubMenu'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; diff --git a/superset-frontend/src/pages/AnnotationList/index.tsx b/superset-frontend/src/pages/AnnotationList/index.tsx index 75b16a49164..b85f83da73b 100644 --- a/superset-frontend/src/pages/AnnotationList/index.tsx +++ b/superset-frontend/src/pages/AnnotationList/index.tsx @@ -30,10 +30,14 @@ import { import dayjs from 'dayjs'; import rison from 'rison'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import DeleteModal from 'src/components/DeleteModal'; -import ListView, { ListViewProps } from 'src/components/ListView'; +import { + ConfirmStatusChange, + DeleteModal, + ListView, + ListViewActionsBar, + type ListViewProps, + type ListViewActionProps, +} from 'src/components'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; @@ -218,7 +222,9 @@ function AnnotationList({ onClick: handleDelete, }, ]; - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', diff --git a/superset-frontend/src/pages/Chart/index.tsx b/superset-frontend/src/pages/Chart/index.tsx index 5bbeb5fa86c..bae7425f0a4 100644 --- a/superset-frontend/src/pages/Chart/index.tsx +++ b/superset-frontend/src/pages/Chart/index.tsx @@ -28,7 +28,7 @@ import { t, getClientErrorObject, } from '@superset-ui/core'; -import Loading from 'src/components/Loading'; +import { Loading } from 'src/components'; import { addDangerToast } from 'src/components/MessageToasts/actions'; import { getUrlParam } from 'src/utils/urlUtils'; import { URL_PARAMS } from 'src/constants'; diff --git a/superset-frontend/src/pages/ChartCreation/index.tsx b/superset-frontend/src/pages/ChartCreation/index.tsx index 4046cdc1914..13cb990902e 100644 --- a/superset-frontend/src/pages/ChartCreation/index.tsx +++ b/superset-frontend/src/pages/ChartCreation/index.tsx @@ -30,8 +30,7 @@ import { withTheme, Theme } from '@emotion/react'; import { getUrlParam } from 'src/utils/urlUtils'; import { FilterPlugins, URL_PARAMS } from 'src/constants'; import { Link, withRouter, RouteComponentProps } from 'react-router-dom'; -import Button from 'src/components/Button'; -import { AsyncSelect } from 'src/components'; +import { AsyncSelect, Button } from 'src/components'; import { Steps } from 'src/components/Steps'; import withToasts from 'src/components/MessageToasts/withToasts'; diff --git a/superset-frontend/src/pages/ChartList/index.tsx b/superset-frontend/src/pages/ChartList/index.tsx index 89b5e221716..79097598509 100644 --- a/superset-frontend/src/pages/ChartList/index.tsx +++ b/superset-frontend/src/pages/ChartList/index.tsx @@ -42,38 +42,39 @@ import { useListViewResource, } from 'src/views/CRUD/hooks'; import handleResourceExport from 'src/utils/export'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + CertifiedBadge, + Tooltip, + ModifiedInfo, + FaveStar, + FacePile, + GenericLink, + ImportModal as ImportModelsModal, + InfoTooltip, + ListView, + ListViewFilterOperator as FilterOperator, + DashboardCrossLinks, + Loading, + type ListViewProps, + type ListViewFilters, + type ListViewFilter, + type LabeledValue, +} from 'src/components'; import TagsList from 'src/components/TagsList'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import FaveStar from 'src/components/FaveStar'; import { Link, useHistory } from 'react-router-dom'; -import ListView, { - Filter, - FilterOperator, - Filters, - ListViewProps, - SelectOption, -} from 'src/components/ListView'; -import Loading from 'src/components/Loading'; import { dangerouslyGetItemDoNotUse } from 'src/utils/localStorageHelpers'; import withToasts from 'src/components/MessageToasts/withToasts'; import PropertiesModal from 'src/explore/components/PropertiesModal'; -import ImportModelsModal from 'src/components/ImportModal/index'; import Chart from 'src/types/Chart'; import Tag from 'src/types/TagType'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; import { nativeFilterGate } from 'src/dashboard/components/nativeFilters/utils'; -import InfoTooltip from 'src/components/InfoTooltip'; -import CertifiedBadge from 'src/components/CertifiedBadge'; -import { GenericLink } from 'src/components/GenericLink/GenericLink'; import { loadTags } from 'src/components/Tag/utils'; -import FacePile from 'src/components/FacePile'; import ChartCard from 'src/features/charts/ChartCard'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import { findPermission } from 'src/utils/findPermission'; -import { DashboardCrossLinks } from 'src/components/ListView/DashboardCrossLinks'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; const FlexRowContainer = styled.div` @@ -139,7 +140,7 @@ const createFetchDatasets = async ( ); return { - data: uniqBy(datasets, 'value'), + data: uniqBy(datasets, 'value'), totalCount: json?.count, }; }; @@ -307,7 +308,7 @@ function ChartList(props: ChartListProps) { }), ); return { - data: uniqBy(dashboards, 'value'), + data: uniqBy(dashboards, 'value'), totalCount: response?.json?.count, }; }; @@ -559,7 +560,7 @@ function ChartList(props: ChartListProps) { ], ); - const favoritesFilter: Filter = useMemo( + const favoritesFilter: ListViewFilter = useMemo( () => ({ Header: t('Favorite'), key: 'favorite', @@ -576,7 +577,7 @@ function ChartList(props: ChartListProps) { [], ); - const filters: Filters = useMemo(() => { + const filters: ListViewFilters = useMemo(() => { const filters_list = [ { Header: t('Name'), @@ -700,7 +701,7 @@ function ChartList(props: ChartListProps) { ), paginate: true, }, - ] as Filters; + ] as ListViewFilters; return filters_list; }, [addDangerToast, favoritesFilter, props.user]); diff --git a/superset-frontend/src/pages/CssTemplateList/index.tsx b/superset-frontend/src/pages/CssTemplateList/index.tsx index 54c74fcdf4f..e0ae41bb64f 100644 --- a/superset-frontend/src/pages/CssTemplateList/index.tsx +++ b/superset-frontend/src/pages/CssTemplateList/index.tsx @@ -25,17 +25,20 @@ import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler, createFetchRelated } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import DeleteModal from 'src/components/DeleteModal'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; -import ListView, { - ListViewProps, - Filters, - FilterOperator, -} from 'src/components/ListView'; +import { + DeleteModal, + ConfirmStatusChange, + ModifiedInfo, + ListView, + ListViewActionsBar, + ListViewFilterOperator as FilterOperator, + type ListViewProps, + type ListViewActionProps, + type ListViewFilters, +} from 'src/components'; + import CssTemplateModal from 'src/features/cssTemplates/CssTemplateModal'; import { TemplateObject } from 'src/features/cssTemplates/types'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; import { Icons } from 'src/components/Icons'; @@ -174,7 +177,9 @@ function CssTemplatesList({ : null, ].filter(item => !!item); - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', @@ -230,7 +235,7 @@ function CssTemplatesList({ menuData.buttons = subMenuButtons; - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/DashboardList/index.tsx b/superset-frontend/src/pages/DashboardList/index.tsx index abae0b11f44..387be0609bd 100644 --- a/superset-frontend/src/pages/DashboardList/index.tsx +++ b/superset-frontend/src/pages/DashboardList/index.tsx @@ -35,42 +35,43 @@ import { handleDashboardDelete, } from 'src/views/CRUD/utils'; import { useListViewResource, useFavoriteStatus } from 'src/views/CRUD/hooks'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import { PublishedLabel } from 'src/components/Label'; +import { + ConfirmStatusChange, + Tooltip, + ModifiedInfo, + CertifiedBadge, + DeleteModal, + FacePile, + FaveStar, + ImportModal as ImportModelsModal, + PublishedLabel, + ListView, + ListViewFilterOperator as FilterOperator, + Loading, + type ListViewProps, + type ListViewFilter, + type ListViewFilters, +} from 'src/components'; import TagsList from 'src/components/TagsList'; import handleResourceExport from 'src/utils/export'; -import Loading from 'src/components/Loading'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import ListView, { - ListViewProps, - Filter, - Filters, - FilterOperator, -} from 'src/components/ListView'; import { dangerouslyGetItemDoNotUse } from 'src/utils/localStorageHelpers'; import Owner from 'src/types/Owner'; import Tag from 'src/types/TagType'; import withToasts from 'src/components/MessageToasts/withToasts'; -import FacePile from 'src/components/FacePile'; import { Icons } from 'src/components/Icons'; -import DeleteModal from 'src/components/DeleteModal'; -import FaveStar from 'src/components/FaveStar'; import PropertiesModal from 'src/dashboard/components/PropertiesModal'; -import { Tooltip } from 'src/components/Tooltip'; -import ImportModelsModal from 'src/components/ImportModal/index'; import Dashboard from 'src/dashboard/containers/Dashboard'; import { Dashboard as CRUDDashboard, QueryObjectColumns, } from 'src/views/CRUD/types'; -import CertifiedBadge from 'src/components/CertifiedBadge'; import { loadTags } from 'src/components/Tag/utils'; import DashboardCard from 'src/features/dashboards/DashboardCard'; import { DashboardStatus } from 'src/features/dashboards/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; import { findPermission } from 'src/utils/findPermission'; -import { ModifiedInfo } from 'src/components/AuditInfo'; const PAGE_SIZE = 25; const PASSWORDS_NEEDED_MESSAGE = t( @@ -515,7 +516,7 @@ function DashboardList(props: DashboardListProps) { ], ); - const favoritesFilter: Filter = useMemo( + const favoritesFilter: ListViewFilter = useMemo( () => ({ Header: t('Favorite'), key: 'favorite', @@ -532,7 +533,7 @@ function DashboardList(props: DashboardListProps) { [], ); - const filters: Filters = useMemo(() => { + const filters: ListViewFilters = useMemo(() => { const filters_list = [ { Header: t('Name'), @@ -622,7 +623,7 @@ function DashboardList(props: DashboardListProps) { ), paginate: true, }, - ] as Filters; + ] as ListViewFilters; return filters_list; }, [addDangerToast, favoritesFilter, props.user]); diff --git a/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx b/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx index e81020e3986..961d6186d09 100644 --- a/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx +++ b/superset-frontend/src/pages/DatabaseList/DatabaseList.test.jsx @@ -25,10 +25,8 @@ import { styledMount as mount } from 'spec/helpers/theming'; import DatabaseList from 'src/pages/DatabaseList'; import DatabaseModal from 'src/features/databases/DatabaseModal'; -import DeleteModal from 'src/components/DeleteModal'; +import { DeleteModal, ListView, ListViewUIFilters } from 'src/components'; import SubMenu from 'src/features/home/SubMenu'; -import ListView from 'src/components/ListView'; -import Filters from 'src/components/ListView/Filters'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import { act } from 'spec/helpers/testing-library'; @@ -191,7 +189,7 @@ describe('Admin DatabaseList', () => { }); test('filters', async () => { - const filtersWrapper = wrapper.find(Filters); + const filtersWrapper = wrapper.find(ListViewUIFilters); act(() => { filtersWrapper .find('[name="expose_in_sqllab"]') diff --git a/superset-frontend/src/pages/DatabaseList/index.tsx b/superset-frontend/src/pages/DatabaseList/index.tsx index eb64deada4c..0403b847cba 100644 --- a/superset-frontend/src/pages/DatabaseList/index.tsx +++ b/superset-frontend/src/pages/DatabaseList/index.tsx @@ -29,7 +29,6 @@ import rison from 'rison'; import { useSelector } from 'react-redux'; import { useQueryParams, BooleanParam } from 'use-query-params'; import { LocalStorageKeys, setItem } from 'src/utils/localStorageHelpers'; -import Loading from 'src/components/Loading'; import { useListViewResource } from 'src/views/CRUD/hooks'; import { createErrorHandler, @@ -38,13 +37,19 @@ import { } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import DeleteModal from 'src/components/DeleteModal'; +import { + DeleteModal, + Tooltip, + ModifiedInfo, + ListView, + ListViewFilterOperator as FilterOperator, + ListViewFilters, + Loading, +} from 'src/components'; import { getUrlParam } from 'src/utils/urlUtils'; import { URL_PARAMS } from 'src/constants'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; -import ListView, { FilterOperator, Filters } from 'src/components/ListView'; import handleResourceExport from 'src/utils/export'; import { ExtensionConfigs } from 'src/features/home/types'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; @@ -52,7 +57,6 @@ import type { MenuObjectProps } from 'src/types/bootstrapTypes'; import DatabaseModal from 'src/features/databases/DatabaseModal'; import UploadDataModal from 'src/features/databases/UploadDataModel'; import { DatabaseObject } from 'src/features/databases/types'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; const extensionsRegistry = getExtensionsRegistry(); @@ -573,7 +577,7 @@ function DatabaseList({ [canDelete, canEdit, canExport], ); - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx b/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx index 7d88e1d2394..8d1bb2b0b39 100644 --- a/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx +++ b/superset-frontend/src/pages/DatasetList/DatasetList.test.tsx @@ -32,8 +32,7 @@ import { isFeatureEnabled } from '@superset-ui/core'; import { QueryParamProvider } from 'use-query-params'; import DatasetList from 'src/pages/DatasetList'; -import ListView from 'src/components/ListView'; -import Button from 'src/components/Button'; +import { Button, ListView } from 'src/components'; import waitForComponentToPaint from 'spec/helpers/waitForComponentToPaint'; import SubMenu from 'src/features/home/SubMenu'; import * as reactRedux from 'react-redux'; diff --git a/superset-frontend/src/pages/DatasetList/index.tsx b/superset-frontend/src/pages/DatasetList/index.tsx index 12dd7bb0598..183d5813e1e 100644 --- a/superset-frontend/src/pages/DatasetList/index.tsx +++ b/superset-frontend/src/pages/DatasetList/index.tsx @@ -34,29 +34,31 @@ import { } from 'src/views/CRUD/utils'; import { ColumnObject } from 'src/features/datasets/types'; import { useListViewResource } from 'src/views/CRUD/hooks'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; -import { DatasourceModal } from 'src/components/Datasource'; -import DeleteModal from 'src/components/DeleteModal'; +import { + ConfirmStatusChange, + CertifiedBadge, + DatasourceModal, + DeleteModal, + Tooltip, + ModifiedInfo, + FacePile, + GenericLink, + ImportModal as ImportModelsModal, + InfoTooltip, + DatasetTypeLabel, + Loading, + ListView, + ListViewFilterOperator as FilterOperator, + type ListViewProps, + type ListViewFilters, +} from 'src/components'; import handleResourceExport from 'src/utils/export'; -import ListView, { - ListViewProps, - Filters, - FilterOperator, -} from 'src/components/ListView'; -import { DatasetTypeLabel } from 'src/components/Label'; -import Loading from 'src/components/Loading'; import SubMenu, { SubMenuProps, ButtonProps } from 'src/features/home/SubMenu'; import Owner from 'src/types/Owner'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Tooltip } from 'src/components/Tooltip'; import { Icons } from 'src/components/Icons'; -import FacePile from 'src/components/FacePile'; -import CertifiedBadge from 'src/components/CertifiedBadge'; -import InfoTooltip from 'src/components/InfoTooltip'; -import ImportModelsModal from 'src/components/ImportModal/index'; import WarningIconWithTooltip from 'src/components/WarningIconWithTooltip'; import { isUserAdmin } from 'src/dashboard/util/permissionUtils'; -import { GenericLink } from 'src/components/GenericLink/GenericLink'; import { PAGE_SIZE, @@ -66,7 +68,6 @@ import { } from 'src/features/datasets/constants'; import DuplicateDatasetModal from 'src/features/datasets/DuplicateDatasetModal'; import { useSelector } from 'react-redux'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; const extensionsRegistry = getExtensionsRegistry(); @@ -508,7 +509,7 @@ const DatasetList: FunctionComponent = ({ [canEdit, canDelete, canExport, openDatasetEditModal, canDuplicate, user], ); - const filterTypes: Filters = useMemo( + const filterTypes: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/ExecutionLogList/index.tsx b/superset-frontend/src/pages/ExecutionLogList/index.tsx index ca22309629c..8c7dbe73836 100644 --- a/superset-frontend/src/pages/ExecutionLogList/index.tsx +++ b/superset-frontend/src/pages/ExecutionLogList/index.tsx @@ -21,8 +21,7 @@ import { css, styled, t } from '@superset-ui/core'; import dayjs from 'dayjs'; import { useEffect, useMemo } from 'react'; import { Link, useParams } from 'react-router-dom'; -import ListView from 'src/components/ListView'; -import { Tooltip } from 'src/components/Tooltip'; +import { Tooltip, ListView } from 'src/components'; import SubMenu from 'src/features/home/SubMenu'; import withToasts from 'src/components/MessageToasts/withToasts'; import { fDuration } from 'src/utils/dates'; diff --git a/superset-frontend/src/pages/Home/index.tsx b/superset-frontend/src/pages/Home/index.tsx index e41471533ab..86b81bbc88d 100644 --- a/superset-frontend/src/pages/Home/index.tsx +++ b/superset-frontend/src/pages/Home/index.tsx @@ -26,7 +26,7 @@ import { t, } from '@superset-ui/core'; import rison from 'rison'; -import Collapse from 'src/components/Collapse'; +import { Collapse, ListViewCard } from 'src/components'; import { User } from 'src/types/bootstrapTypes'; import { reject } from 'lodash'; import { @@ -36,7 +36,6 @@ import { LocalStorageKeys, setItem, } from 'src/utils/localStorageHelpers'; -import ListViewCard from 'src/components/ListViewCard'; import withToasts from 'src/components/MessageToasts/withToasts'; import { CardContainer, diff --git a/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx b/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx index 0afe5ad1ced..1512bd91446 100644 --- a/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx +++ b/superset-frontend/src/pages/QueryHistoryList/QueryHistoryList.test.tsx @@ -29,8 +29,7 @@ import { styledMount as mount } from 'spec/helpers/theming'; import QueryList from 'src/pages/QueryHistoryList'; import QueryPreviewModal from 'src/features/queries/QueryPreviewModal'; import { QueryObject } from 'src/views/CRUD/types'; -import ListView from 'src/components/ListView'; -import Filters from 'src/components/ListView/Filters'; +import { ListView, ListViewUIFilters } from 'src/components'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import SubMenu from 'src/features/home/SubMenu'; import { QueryState } from '@superset-ui/core'; @@ -138,7 +137,7 @@ describe('QueryList', () => { }); it('searches', async () => { - const filtersWrapper = wrapper.find(Filters); + const filtersWrapper = wrapper.find(ListViewUIFilters); act(() => { const props = filtersWrapper.find('[name="sql"]').first().props(); // @ts-ignore diff --git a/superset-frontend/src/pages/QueryHistoryList/index.tsx b/superset-frontend/src/pages/QueryHistoryList/index.tsx index ca5011551f2..f058079b3df 100644 --- a/superset-frontend/src/pages/QueryHistoryList/index.tsx +++ b/superset-frontend/src/pages/QueryHistoryList/index.tsx @@ -34,16 +34,17 @@ import { } from 'src/views/CRUD/utils'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; -import Label from 'src/components/Label'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import Popover from 'src/components/Popover'; import { commonMenuData } from 'src/features/home/commonMenuData'; -import ListView, { - Filters, - FilterOperator, - ListViewProps, -} from 'src/components/ListView'; -import { Tooltip } from 'src/components/Tooltip'; +import { + Label, + Tooltip, + ListView, + ListViewFilterOperator as FilterOperator, + type ListViewProps, + type ListViewFilters, +} from 'src/components'; import SyntaxHighlighter from 'react-syntax-highlighter/dist/cjs/light'; import sql from 'react-syntax-highlighter/dist/cjs/languages/hljs/sql'; import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github'; @@ -379,7 +380,7 @@ function QueryList({ addDangerToast }: QueryListProps) { [], ); - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Database'), diff --git a/superset-frontend/src/pages/RolesList/index.tsx b/superset-frontend/src/pages/RolesList/index.tsx index ad6f8cd4b17..dc107c3cd3b 100644 --- a/superset-frontend/src/pages/RolesList/index.tsx +++ b/superset-frontend/src/pages/RolesList/index.tsx @@ -25,14 +25,16 @@ import RoleListEditModal from 'src/features/roles/RoleListEditModal'; import RoleListDuplicateModal from 'src/features/roles/RoleListDuplicateModal'; import withToasts from 'src/components/MessageToasts/withToasts'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; -import ListView, { - ListViewProps, - Filters, - FilterOperator, -} from 'src/components/ListView'; -import DeleteModal from 'src/components/DeleteModal'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + DeleteModal, + ListView, + ListViewFilterOperator as FilterOperator, + ListViewActionsBar, + type ListViewProps, + type ListViewActionProps, + type ListViewFilters, +} from 'src/components'; import { FormattedPermission, PermissionResource, @@ -307,7 +309,9 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) { ] : []; - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', @@ -352,7 +356,7 @@ function RolesList({ addDangerToast, addSuccessToast, user }: RolesListProps) { ); } - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/RowLevelSecurityList/index.tsx b/superset-frontend/src/pages/RowLevelSecurityList/index.tsx index cd112f00824..5981d444455 100644 --- a/superset-frontend/src/pages/RowLevelSecurityList/index.tsx +++ b/superset-frontend/src/pages/RowLevelSecurityList/index.tsx @@ -18,23 +18,24 @@ */ import { t, styled, SupersetClient, useTheme, css } from '@superset-ui/core'; import { useMemo, useState } from 'react'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + Tooltip, + ModifiedInfo, + ListView, + ListViewFilterOperator as FilterOperator, + type ListViewProps, + type ListViewFilters, + type ListViewFetchDataConfig as FetchDataConfig, +} from 'src/components'; import { Icons } from 'src/components/Icons'; -import ListView, { - FetchDataConfig, - FilterOperator, - ListViewProps, - Filters, -} from 'src/components/ListView'; import withToasts from 'src/components/MessageToasts/withToasts'; -import { Tooltip } from 'src/components/Tooltip'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; import rison from 'rison'; import { useListViewResource } from 'src/views/CRUD/hooks'; import RowLevelSecurityModal from 'src/features/rls/RowLevelSecurityModal'; import { RLSObject } from 'src/features/rls/types'; import { createErrorHandler, createFetchRelated } from 'src/views/CRUD/utils'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { QueryObjectColumns } from 'src/views/CRUD/types'; const Actions = styled.div` @@ -270,7 +271,7 @@ function RowLevelSecurityList(props: RLSProps) { ) : null, }; - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Name'), diff --git a/superset-frontend/src/pages/SavedQueryList/index.tsx b/superset-frontend/src/pages/SavedQueryList/index.tsx index 3825d59d038..1044236ab6f 100644 --- a/superset-frontend/src/pages/SavedQueryList/index.tsx +++ b/superset-frontend/src/pages/SavedQueryList/index.tsx @@ -38,24 +38,26 @@ import { useSelector } from 'react-redux'; import Popover from 'src/components/Popover'; import withToasts from 'src/components/MessageToasts/withToasts'; import { useListViewResource } from 'src/views/CRUD/hooks'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + Tooltip, + ModifiedInfo, + DeleteModal, + ImportModal as ImportModelsModal, + Loading, + ListView, + ListViewActionsBar, + ListViewFilterOperator as FilterOperator, + type ListViewProps, + type ListViewActionProps, + type ListViewFilters, +} from 'src/components'; import handleResourceExport from 'src/utils/export'; import SubMenu, { ButtonProps, SubMenuProps } from 'src/features/home/SubMenu'; -import ListView, { - FilterOperator, - Filters, - ListViewProps, -} from 'src/components/ListView'; -import Loading from 'src/components/Loading'; -import DeleteModal from 'src/components/DeleteModal'; -import ActionsBar, { ActionProps } from 'src/components/ListView/ActionsBar'; import TagsList from 'src/components/TagsList'; -import { Tooltip } from 'src/components/Tooltip'; import { commonMenuData } from 'src/features/home/commonMenuData'; import { QueryObjectColumns, SavedQueryObject } from 'src/views/CRUD/types'; import Tag from 'src/types/TagType'; -import ImportModelsModal from 'src/components/ImportModal/index'; -import { ModifiedInfo } from 'src/components/AuditInfo'; import { loadTags } from 'src/components/Tag/utils'; import { Icons } from 'src/components/Icons'; import { UserWithPermissionsAndRoles } from 'src/types/bootstrapTypes'; @@ -476,7 +478,9 @@ function SavedQueryList({ }, ].filter(item => !!item); - return ; + return ( + + ); }, Header: t('Actions'), id: 'actions', @@ -491,7 +495,7 @@ function SavedQueryList({ [canDelete, canEdit, canExport, copyQueryLink, handleSavedQueryPreview], ); - const filters: Filters = useMemo( + const filters: ListViewFilters = useMemo( () => [ { Header: t('Search'), @@ -552,7 +556,7 @@ function SavedQueryList({ fetchSelects: loadTags, }, ] - : []) as Filters), + : []) as ListViewFilters), { Header: t('Modified by'), key: 'changed_by', diff --git a/superset-frontend/src/pages/SqlLab/index.tsx b/superset-frontend/src/pages/SqlLab/index.tsx index 93bf8e26cfb..cb4d3471a66 100644 --- a/superset-frontend/src/pages/SqlLab/index.tsx +++ b/superset-frontend/src/pages/SqlLab/index.tsx @@ -26,7 +26,7 @@ import { addDangerToast } from 'src/components/MessageToasts/actions'; import type { SqlLabRootState } from 'src/SqlLab/types'; import { SqlLabGlobalStyles } from 'src/SqlLab//SqlLabGlobalStyles'; import App from 'src/SqlLab/components/App'; -import Loading from 'src/components/Loading'; +import { Loading } from 'src/components'; import EditorAutoSync from 'src/SqlLab/components/EditorAutoSync'; import useEffectEvent from 'src/hooks/useEffectEvent'; import { LocationProvider } from './LocationContext'; diff --git a/superset-frontend/src/pages/Tags/index.tsx b/superset-frontend/src/pages/Tags/index.tsx index 919568d2051..aa7d7bd7d62 100644 --- a/superset-frontend/src/pages/Tags/index.tsx +++ b/superset-frontend/src/pages/Tags/index.tsx @@ -30,25 +30,26 @@ import { createFetchRelated, } from 'src/views/CRUD/utils'; import { useListViewResource, useFavoriteStatus } from 'src/views/CRUD/hooks'; -import ConfirmStatusChange from 'src/components/ConfirmStatusChange'; +import { + ConfirmStatusChange, + Tooltip, + ModifiedInfo, + FaveStar, + ListView, + ListViewFilterOperator as FilterOperator, + type ListViewFilters, + type ListViewProps, +} from 'src/components'; import SubMenu, { SubMenuProps } from 'src/features/home/SubMenu'; -import ListView, { - ListViewProps, - Filters, - FilterOperator, -} from 'src/components/ListView'; import { dangerouslyGetItemDoNotUse } from 'src/utils/localStorageHelpers'; import withToasts from 'src/components/MessageToasts/withToasts'; import { Icons } from 'src/components/Icons'; -import { Tooltip } from 'src/components/Tooltip'; import { Link } from 'react-router-dom'; import { deleteTags } from 'src/features/tags/tags'; // eslint-disable-next-line no-restricted-imports import { Tag as AntdTag } from 'antd'; // TODO: Remove antd import { QueryObjectColumns, Tag } from 'src/views/CRUD/types'; import TagModal from 'src/features/tags/TagModal'; -import FaveStar from 'src/components/FaveStar'; -import { ModifiedInfo } from 'src/components/AuditInfo'; const PAGE_SIZE = 25; @@ -275,7 +276,7 @@ function TagList(props: TagListProps) { [userId, canDelete, refreshData, addSuccessToast, addDangerToast], ); - const filters: Filters = useMemo(() => { + const filters: ListViewFilters = useMemo(() => { const filters_list = [ { Header: t('Name'), @@ -303,7 +304,7 @@ function TagList(props: TagListProps) { ), paginate: true, }, - ] as Filters; + ] as ListViewFilters; return filters_list; }, [addDangerToast, props.user]); diff --git a/superset-frontend/src/setup/setupErrorMessages.ts b/superset-frontend/src/setup/setupErrorMessages.ts index 6f8183ba1cf..8fb867f2b5a 100644 --- a/superset-frontend/src/setup/setupErrorMessages.ts +++ b/superset-frontend/src/setup/setupErrorMessages.ts @@ -17,15 +17,17 @@ * under the License. */ import { ErrorTypeEnum } from '@superset-ui/core'; -import getErrorMessageComponentRegistry from 'src/components/ErrorMessage/getErrorMessageComponentRegistry'; -import TimeoutErrorMessage from 'src/components/ErrorMessage/TimeoutErrorMessage'; -import DatabaseErrorMessage from 'src/components/ErrorMessage/DatabaseErrorMessage'; -import MarshmallowErrorMessage from 'src/components/ErrorMessage/MarshmallowErrorMessage'; -import ParameterErrorMessage from 'src/components/ErrorMessage/ParameterErrorMessage'; -import DatasetNotFoundErrorMessage from 'src/components/ErrorMessage/DatasetNotFoundErrorMessage'; -import InvalidSQLErrorMessage from 'src/components/ErrorMessage/InvalidSQLErrorMessage'; -import OAuth2RedirectMessage from 'src/components/ErrorMessage/OAuth2RedirectMessage'; -import FrontendNetworkErrorMessage from 'src/components/ErrorMessage/FrontendNetworkErrorMessage'; +import { + getErrorMessageComponentRegistry, + TimeoutErrorMessage, + DatabaseErrorMessage, + MarshmallowErrorMessage, + ParameterErrorMessage, + DatasetNotFoundErrorMessage, + InvalidSQLErrorMessage, + OAuth2RedirectMessage, + FrontendNetworkErrorMessage, +} from 'src/components'; import setupErrorMessagesExtra from './setupErrorMessagesExtra'; diff --git a/superset-frontend/src/types/bootstrapTypes.ts b/superset-frontend/src/types/bootstrapTypes.ts index d983f2378a0..8c510f56b82 100644 --- a/superset-frontend/src/types/bootstrapTypes.ts +++ b/superset-frontend/src/types/bootstrapTypes.ts @@ -10,7 +10,7 @@ import { FormatLocaleDefinition } from 'd3-format'; import { TimeLocaleDefinition } from 'd3-time-format'; import { isPlainObject } from 'lodash'; import { Languages } from 'src/features/home/LanguagePicker'; -import { FlashMessage } from '../components/FlashProvider'; +import type { FlashMessage } from 'src/components'; /** * Licensed to the Apache Software Foundation (ASF) under one diff --git a/superset-frontend/src/views/App.tsx b/superset-frontend/src/views/App.tsx index 9ee4e947559..dbe6ff9f40a 100644 --- a/superset-frontend/src/views/App.tsx +++ b/superset-frontend/src/views/App.tsx @@ -26,9 +26,7 @@ import { } from 'react-router-dom'; import { bindActionCreators } from 'redux'; import { css } from '@superset-ui/core'; -import ErrorBoundary from 'src/components/ErrorBoundary'; -import Layout from 'src/components/Layout'; -import Loading from 'src/components/Loading'; +import { ErrorBoundary, Layout, Loading } from 'src/components'; import Menu from 'src/features/home/Menu'; import getBootstrapData from 'src/utils/getBootstrapData'; import ToastContainer from 'src/components/MessageToasts/ToastContainer'; diff --git a/superset-frontend/src/views/CRUD/hooks.ts b/superset-frontend/src/views/CRUD/hooks.ts index a082bd971a7..37a31ee12ef 100644 --- a/superset-frontend/src/views/CRUD/hooks.ts +++ b/superset-frontend/src/views/CRUD/hooks.ts @@ -35,8 +35,10 @@ import { getSSHPrivateKeysNeeded, getSSHPrivateKeyPasswordsNeeded, } from 'src/views/CRUD/utils'; -import { FetchDataConfig } from 'src/components/ListView'; -import { FilterValue } from 'src/components/ListView/types'; +import type { + ListViewFetchDataConfig as FetchDataConfig, + ListViewFilterValue as FilterValue, +} from 'src/components'; import Chart, { Slice } from 'src/types/Chart'; import copyTextToClipboard from 'src/utils/copy'; import SupersetText from 'src/utils/textUtils'; diff --git a/superset-frontend/src/views/CRUD/utils.tsx b/superset-frontend/src/views/CRUD/utils.tsx index 8404cbd5d8c..4e21f5245d4 100644 --- a/superset-frontend/src/views/CRUD/utils.tsx +++ b/superset-frontend/src/views/CRUD/utils.tsx @@ -29,7 +29,10 @@ import { import Chart from 'src/types/Chart'; import { intersection } from 'lodash'; import rison from 'rison'; -import { FetchDataConfig, FilterValue } from 'src/components/ListView'; +import type { + ListViewFetchDataConfig as FetchDataConfig, + ListViewFilterValue as FilterValue, +} from 'src/components'; import SupersetText from 'src/utils/textUtils'; import { findPermission } from 'src/utils/findPermission'; import { User } from 'src/types/bootstrapTypes'; diff --git a/superset-frontend/src/views/RootContextProviders.tsx b/superset-frontend/src/views/RootContextProviders.tsx index cefcfcb534b..3b68ff7d0d2 100644 --- a/superset-frontend/src/views/RootContextProviders.tsx +++ b/superset-frontend/src/views/RootContextProviders.tsx @@ -24,11 +24,10 @@ import { QueryParamProvider } from 'use-query-params'; import { DndProvider } from 'react-dnd'; import { HTML5Backend } from 'react-dnd-html5-backend'; import getBootstrapData from 'src/utils/getBootstrapData'; +import { DynamicPluginProvider, FlashProvider } from 'src/components'; import { store } from './store'; -import FlashProvider from '../components/FlashProvider'; import '../preamble'; import { EmbeddedUiConfigProvider } from '../components/UiConfigContext'; -import { DynamicPluginProvider } from '../components/DynamicPlugins'; const { common } = getBootstrapData();