michael-s-molina commented on code in PR #35308:
URL: https://github.com/apache/superset/pull/35308#discussion_r2382487484
##########
superset-frontend/packages/superset-ui-core/src/chart/components/Matrixify/MatrixifyGridCell.tsx:
##########
@@ -18,7 +18,7 @@
*/
import { memo, useMemo } from 'react';
-import { styled, useTheme } from '../../../theme';
+import { styled, useTheme } from
'@apache-superset/core/src/ui/themeet/core/src/ui/theme';
Review Comment:
Let's think about exposing these objects at the root level of the `ui`
folder. Something like:
```
import { styled, useTheme } from '@apache-superset/core/ui';
```
##########
superset-frontend/packages/superset-core/src/spec/index.tsx:
##########
@@ -0,0 +1,47 @@
+/**
+ * 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 userEvent from '@testing-library/user-event';
+import { ReactElement } from 'react';
+import { render, RenderOptions } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { themeObject } from '../ui/theme';
+
+// Define the wrapper component outside
+const AllTheProviders = ({ children }: { children: React.ReactNode }) => (
Review Comment:
I think we can rename this Providers.
##########
superset-frontend/packages/superset-core/src/spec/index.tsx:
##########
@@ -0,0 +1,47 @@
+/**
+ * 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 userEvent from '@testing-library/user-event';
+import { ReactElement } from 'react';
+import { render, RenderOptions } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { themeObject } from '../ui/theme';
Review Comment:
Given that this utility is used for testing UI-related components, I suggest
moving it inside the `ui` package and renaming it.
```
src/ui/testing.ts
```
##########
superset-frontend/packages/superset-core/src/ui/components/Alert/index.tsx:
##########
@@ -0,0 +1,82 @@
+/**
+ * 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 { Alert as AntdAlert } from 'antd';
+import type { PropsWithChildren } from 'react';
+import type { AlertProps as AntdAlertProps } from 'antd/es/alert';
+
+/**
+ * Props for the Alert component, extending Ant Design's AlertProps
+ * with support for children instead of the message prop.
+ */
+export type AlertProps = PropsWithChildren<Omit<AntdAlertProps, 'children'>>;
+
+/**
+ * Alert component for displaying important messages to users.
+ *
+ * Wraps Ant Design's Alert component with sensible defaults and improved
accessibility.
+ * Supports four severity levels: success, info, warning, and error.
+ *
+ * @param props - Alert configuration props
+ *
+ * @example
Review Comment:
Great example section!
##########
superset-frontend/packages/superset-core/src/ui/components/Alert/index.tsx:
##########
@@ -0,0 +1,82 @@
+/**
+ * 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 { Alert as AntdAlert } from 'antd';
+import type { PropsWithChildren } from 'react';
+import type { AlertProps as AntdAlertProps } from 'antd/es/alert';
+
+/**
+ * Props for the Alert component, extending Ant Design's AlertProps
+ * with support for children instead of the message prop.
+ */
+export type AlertProps = PropsWithChildren<Omit<AntdAlertProps, 'children'>>;
+
+/**
+ * Alert component for displaying important messages to users.
+ *
+ * Wraps Ant Design's Alert component with sensible defaults and improved
accessibility.
+ * Supports four severity levels: success, info, warning, and error.
+ *
+ * @param props - Alert configuration props
+ *
+ * @example
+ * // Basic usage with default info type
+ * <Alert>This is an informational message</Alert>
+ *
+ * @example
+ * // Error alert with description
+ * <Alert type="error" description="Please try again later">
+ * Operation failed
+ * </Alert>
+ *
+ * @example
+ * // Success alert without close button or icon
+ * <Alert type="success" closable={false} showIcon={false}>
+ * Settings saved successfully
+ * </Alert>
+ *
+ * @example
+ * // Warning alert with custom close handler
+ * <Alert type="warning" onClose={() => console.log('Alert closed')}>
+ * Your session will expire in 5 minutes
+ * </Alert>
+ *
+ * @returns Rendered Alert component with proper ARIA attributes
+ */
+export const Alert = (props: AlertProps) => {
+ const {
+ type = 'info',
+ description,
+ showIcon = true,
+ closable = true,
+ children,
+ ...rest
+ } = props;
+ return (
+ <AntdAlert
+ role="alert"
+ aria-live={type === 'error' ? 'assertive' : 'polite'}
+ type={type}
+ showIcon={showIcon}
+ closable={closable}
+ message={children || 'Default message'}
Review Comment:
We'll need the `t` function because probably the components are using it.
```suggestion
message={children || t('Default message')}
```
##########
superset-frontend/packages/superset-core/src/spec/index.tsx:
##########
@@ -0,0 +1,47 @@
+/**
+ * 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 userEvent from '@testing-library/user-event';
+import { ReactElement } from 'react';
+import { render, RenderOptions } from '@testing-library/react';
+import '@testing-library/jest-dom';
+import { themeObject } from '../ui/theme';
+
+// Define the wrapper component outside
+const AllTheProviders = ({ children }: { children: React.ReactNode }) => (
Review Comment:
I think we can rename this to Providers.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]