@databricks/design-system 1.12.20 → 1.12.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codemods/camelize.ts +5 -5
- package/dist/Popover-CrX63HDP.js +3831 -0
- package/dist/Popover-CrX63HDP.js.map +1 -0
- package/dist/Popover-DQEbjNyV.js +3831 -0
- package/dist/Popover-DQEbjNyV.js.map +1 -0
- package/dist/WizardStepContentWrapper-Bv2MqnDd.js +2276 -0
- package/dist/WizardStepContentWrapper-Bv2MqnDd.js.map +1 -0
- package/dist/WizardStepContentWrapper-CzvxVy-w.js +2278 -0
- package/dist/WizardStepContentWrapper-CzvxVy-w.js.map +1 -0
- package/dist/development.js +3 -3
- package/dist/development.js.map +1 -1
- package/dist/index-BC9PpmGo.js +770 -0
- package/dist/index-BC9PpmGo.js.map +1 -0
- package/dist/index-DxyvNv4-.js +770 -0
- package/dist/index-DxyvNv4-.js.map +1 -0
- package/dist/index.js +162 -66
- package/dist/index.js.map +1 -1
- package/dist/patterns.js +2 -2
- package/package.json +4 -4
- package/scripts/theme_regeneration/common.ts +3 -3
- package/scripts/theme_regeneration/regenerate_color_validity_enums.ts +3 -3
- package/src/assets/icons/RowsIcon.svg +3 -0
- package/src/assets/icons/TokenIcon.svg +8 -0
- package/src/assets/icons/TrendingIcon.svg +1 -0
- package/src/design-system/Accordion/Accordion.tsx +2 -2
- package/src/design-system/Alert/Alert.tsx +1 -1
- package/src/design-system/ApplyGlobalStyles/ApplyGlobalStyles.tsx +1 -1
- package/src/design-system/Card/Card.test.tsx +52 -0
- package/src/design-system/Card/Card.tsx +21 -5
- package/src/design-system/DatePicker/DatePicker.tsx +6 -4
- package/src/design-system/DesignSystemEventProvider/DesignSystemEventProvider.test.tsx +5 -3
- package/src/design-system/DesignSystemProvider/DesignSystemProvider.test.tsx +1 -1
- package/src/design-system/DesignSystemProvider/DesignSystemProvider.tsx +8 -6
- package/src/design-system/Dropdown/Dropdown.tsx +1 -1
- package/src/design-system/Empty/Empty.tsx +1 -1
- package/src/design-system/Grid/Col.tsx +1 -1
- package/src/design-system/Grid/Row.tsx +1 -1
- package/src/design-system/Header/Header.tsx +1 -1
- package/src/design-system/Hooks/useDesignSystemTheme.tsx +3 -1
- package/src/design-system/HoverCard/HoverCard.tsx +11 -5
- package/src/design-system/Icon/Icon.tsx +4 -4
- package/src/design-system/Icon/__generated/icons/{InfoIcon.tsx → RowsIcon.tsx} +6 -7
- package/src/design-system/Icon/__generated/icons/TokenIcon.tsx +28 -0
- package/src/design-system/Icon/__generated/icons/TrendingIcon.tsx +23 -0
- package/src/design-system/Icon/__generated/icons/index.ts +3 -1
- package/src/design-system/Input/Password.tsx +25 -23
- package/src/design-system/LegacyForm/LegacyForm.tsx +5 -1
- package/src/design-system/LegacyPopover/LegacyPopover.tsx +5 -1
- package/src/design-system/LegacySelect/LegacySelect.tsx +2 -2
- package/src/design-system/LegacyTable/LegacyTable.tsx +1 -1
- package/src/design-system/LegacyTabs/index.tsx +4 -1
- package/src/design-system/LegacyTooltip/LegacyTooltip.tsx +1 -1
- package/src/design-system/LoadingState/LoadingState.tsx +1 -1
- package/src/design-system/Modal/Modal.tsx +19 -2
- package/src/design-system/PageWrapper/PageWrapper.tsx +1 -1
- package/src/design-system/Pagination/index.tsx +2 -2
- package/src/design-system/PreviewCard/PreviewCard.test.tsx +70 -0
- package/src/design-system/PreviewCard/PreviewCard.tsx +15 -5
- package/src/design-system/Radio/Radio.tsx +28 -28
- package/src/design-system/SegmentedControl/SegmentedControl.tsx +2 -2
- package/src/design-system/Select/SimpleSelect.tsx +4 -1
- package/src/design-system/Skeleton/TableSkeleton.tsx +4 -2
- package/src/design-system/Skeleton/TitleSkeleton.tsx +10 -2
- package/src/design-system/Space/Space.tsx +1 -1
- package/src/design-system/Spacer/Spacer.tsx +1 -1
- package/src/design-system/Spinner/Spinner.tsx +1 -1
- package/src/design-system/SplitButton/Dropdown/DropdownButton.tsx +1 -1
- package/src/design-system/SplitButton/SplitButton.tsx +3 -1
- package/src/design-system/Stepper/Stepper.tsx +1 -1
- package/src/design-system/Switch/Switch.tsx +1 -1
- package/src/design-system/TableUI/TableCell.tsx +10 -1
- package/src/design-system/Tooltip/Tooltip.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/CountBadge.tsx +5 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxControls.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.tsx +1 -1
- package/src/design-system/TypeaheadCombobox/tests/TypeaheadCombobox.test.tsx +3 -3
- package/src/design-system/TypeaheadCombobox/tests/testFixtures.tsx +3 -3
- package/src/design-system/utils/css-utils.tsx +6 -6
- package/src/design-system/utils/shadow-dom-storybook-wrapper.tsx +1 -1
- package/src/development/Banner/Banner.tsx +1 -1
- package/src/development/PillControl/PillControl.tsx +1 -0
- package/src/development/TreeGrid/TreeGrid.test.tsx +2 -2
- package/src/development/TreeGrid/TreeGrid.tsx +1 -1
- package/src/theme/convertToLessVars.ts +5 -5
- package/src/~patterns/Wizard/VerticalWizardContent.tsx +3 -1
- package/src/assets/icons/InfoIcon.svg +0 -5
|
@@ -8,27 +8,29 @@ import { useDesignSystemTheme } from '../Hooks/useDesignSystemTheme';
|
|
|
8
8
|
import { useDesignSystemSafexFlags } from '../utils';
|
|
9
9
|
import { addDebugOutlineIfEnabled } from '../utils/debug';
|
|
10
10
|
|
|
11
|
-
export const Password: React.FC<PasswordProps
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export const Password: React.FC<React.PropsWithChildren<PasswordProps>> = forwardRef<AntDInput, PasswordProps>(
|
|
12
|
+
function Password(
|
|
13
|
+
{ validationState, autoComplete = 'off', dangerouslySetAntdProps, dangerouslyAppendEmotionCSS, ...props },
|
|
14
|
+
ref,
|
|
15
|
+
) {
|
|
16
|
+
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
17
|
+
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
19
|
+
return (
|
|
20
|
+
<DesignSystemAntDConfigProvider>
|
|
21
|
+
<AntDInput.Password
|
|
22
|
+
{...addDebugOutlineIfEnabled()}
|
|
23
|
+
visibilityToggle={false}
|
|
24
|
+
ref={ref}
|
|
25
|
+
autoComplete={autoComplete}
|
|
26
|
+
css={[
|
|
27
|
+
getInputEmotionStyles(classNamePrefix, theme, { validationState, useNewShadows, useNewBorderRadii }),
|
|
28
|
+
dangerouslyAppendEmotionCSS,
|
|
29
|
+
]}
|
|
30
|
+
{...props}
|
|
31
|
+
{...dangerouslySetAntdProps}
|
|
32
|
+
/>
|
|
33
|
+
</DesignSystemAntDConfigProvider>
|
|
34
|
+
);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
@@ -145,7 +145,11 @@ export const LegacyFormDubois = forwardRef<LegacyFormInstance, LegacyFormProps>(
|
|
|
145
145
|
);
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
const FormItem: FC<LegacyFormItemProps
|
|
148
|
+
const FormItem: FC<React.PropsWithChildren<LegacyFormItemProps>> = ({
|
|
149
|
+
dangerouslySetAntdProps,
|
|
150
|
+
children,
|
|
151
|
+
...props
|
|
152
|
+
}) => {
|
|
149
153
|
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
150
154
|
return (
|
|
151
155
|
<DesignSystemAntDConfigProvider>
|
|
@@ -20,7 +20,11 @@ export interface LegacyPopoverProps
|
|
|
20
20
|
* `LegacyPopover` is deprecated in favor of the new `Popover` component.
|
|
21
21
|
* @deprecated
|
|
22
22
|
*/
|
|
23
|
-
export const LegacyPopover: React.FC<LegacyPopoverProps
|
|
23
|
+
export const LegacyPopover: React.FC<React.PropsWithChildren<LegacyPopoverProps>> = ({
|
|
24
|
+
content,
|
|
25
|
+
dangerouslySetAntdProps,
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
24
28
|
const { theme } = useDesignSystemTheme();
|
|
25
29
|
|
|
26
30
|
return (
|
|
@@ -3,7 +3,7 @@ import { ClassNames, css } from '@emotion/react';
|
|
|
3
3
|
import type { SelectProps as AntDSelectProps } from 'antd';
|
|
4
4
|
import { Select as AntDSelect } from 'antd';
|
|
5
5
|
import type { RefSelectProps as AntdRefSelectProps, SelectValue as AntdSelectValue } from 'antd/lib/select';
|
|
6
|
-
import
|
|
6
|
+
import { uniqueId as lodashUniqueId } from 'lodash';
|
|
7
7
|
import React, { forwardRef, useEffect, useState } from 'react';
|
|
8
8
|
|
|
9
9
|
import type { Theme } from '../../theme';
|
|
@@ -476,7 +476,7 @@ function DuboisSelect<T extends LegacySelectValue>(
|
|
|
476
476
|
const MAX_HEIGHT = maxHeight ?? theme.general.heightSm * 8.5;
|
|
477
477
|
|
|
478
478
|
useEffect(() => {
|
|
479
|
-
setUniqueId(id ||
|
|
479
|
+
setUniqueId(id || lodashUniqueId('dubois-select-'));
|
|
480
480
|
}, [id]);
|
|
481
481
|
|
|
482
482
|
useEffect(() => {
|
|
@@ -107,7 +107,7 @@ const DEFAULT_LOADING_SPIN_PROPS = { indicator: <Spinner /> };
|
|
|
107
107
|
* For more information please join #dubois-table-early-adopters in Slack.
|
|
108
108
|
* @deprecated
|
|
109
109
|
*/
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-restricted-types
|
|
111
111
|
export const LegacyTable = <T extends object>(props: LegacyTableProps<T>): JSX.Element => {
|
|
112
112
|
const { classNamePrefix, theme } = useDesignSystemTheme();
|
|
113
113
|
const { useNewShadows, useNewBorderColors } = useDesignSystemSafexFlags();
|
|
@@ -259,7 +259,10 @@ export interface LegacyTabsInterface extends React.FC<LegacyTabsProps> {
|
|
|
259
259
|
* `LegacyTabs` is deprecated in favor of the new `Tabs` component
|
|
260
260
|
* @deprecated
|
|
261
261
|
*/
|
|
262
|
-
export const LegacyTabPane: React.FC<LegacyTabPaneProps
|
|
262
|
+
export const LegacyTabPane: React.FC<React.PropsWithChildren<LegacyTabPaneProps>> = ({
|
|
263
|
+
children,
|
|
264
|
+
...props
|
|
265
|
+
}: LegacyTabPaneProps) => {
|
|
263
266
|
const { theme } = useDesignSystemTheme();
|
|
264
267
|
|
|
265
268
|
return (
|
|
@@ -54,7 +54,7 @@ export interface LegacyTooltipProps extends HTMLDataAttributes {
|
|
|
54
54
|
* `LegacyTooltip` is deprecated in favor of the new `Tooltip` component
|
|
55
55
|
* @deprecated
|
|
56
56
|
*/
|
|
57
|
-
export const LegacyTooltip: React.FC<LegacyTooltipProps
|
|
57
|
+
export const LegacyTooltip: React.FC<React.PropsWithChildren<LegacyTooltipProps>> = ({
|
|
58
58
|
children,
|
|
59
59
|
title,
|
|
60
60
|
placement = 'top',
|
|
@@ -48,7 +48,7 @@ type LoadingStateProps = {
|
|
|
48
48
|
* it will call the provided `startLoading()`/`endLoading()` hooks when the component
|
|
49
49
|
* is mounted/unmounted, which can be used to integrate existing latency instrumentation.
|
|
50
50
|
*/
|
|
51
|
-
export const LoadingState: React.FC<LoadingStateProps
|
|
51
|
+
export const LoadingState: React.FC<React.PropsWithChildren<LoadingStateProps>> = ({
|
|
52
52
|
description = 'Generic UI loading state',
|
|
53
53
|
}: LoadingStateProps) => {
|
|
54
54
|
const uid = useStableUid();
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import { DesignSystemAntDConfigProvider, getAnimationCss, RestoreAntDDefaultClsPrefix } from '../DesignSystemProvider';
|
|
21
21
|
import { useDesignSystemTheme } from '../Hooks';
|
|
22
22
|
import { CloseIcon, DangerIcon } from '../Icon';
|
|
23
|
-
import type { AnalyticsEventPropsWithStartInteraction,
|
|
23
|
+
import type { AnalyticsEventPropsWithStartInteraction, HTMLDataAttributes } from '../types';
|
|
24
24
|
import { getDarkModePortalStyles, getShadowScrollStyles, useDesignSystemSafexFlags } from '../utils';
|
|
25
25
|
import { addDebugOutlineIfEnabled, addDebugOutlineStylesIfEnabled } from '../utils/debug';
|
|
26
26
|
import { safex } from '../utils/safex';
|
|
@@ -28,8 +28,25 @@ import { useNotifyOnFirstView } from '../utils/useNotifyOnFirstView';
|
|
|
28
28
|
|
|
29
29
|
export interface ModalProps
|
|
30
30
|
extends HTMLDataAttributes,
|
|
31
|
-
DangerouslySetAntdProps<AntDModalProps>,
|
|
32
31
|
AnalyticsEventPropsWithStartInteraction<DesignSystemEventProviderAnalyticsEventTypes.OnView> {
|
|
32
|
+
// Reduce to current usages only, don't allow new props to be set
|
|
33
|
+
dangerouslySetAntdProps?: Partial<
|
|
34
|
+
Pick<
|
|
35
|
+
AntDModalProps,
|
|
36
|
+
| 'bodyStyle'
|
|
37
|
+
| 'width'
|
|
38
|
+
| 'wrapProps'
|
|
39
|
+
| 'closable'
|
|
40
|
+
| 'maskClosable'
|
|
41
|
+
| 'keyboard'
|
|
42
|
+
| 'centered'
|
|
43
|
+
| 'closeIcon'
|
|
44
|
+
| 'style'
|
|
45
|
+
| 'mask'
|
|
46
|
+
| 'modalRender'
|
|
47
|
+
| 'okType'
|
|
48
|
+
>
|
|
49
|
+
>;
|
|
33
50
|
/** Whether or not the modal is currently open. Use together with onOk and onCancel to control the modal state. */
|
|
34
51
|
visible?: AntDModalProps['visible'];
|
|
35
52
|
|
|
@@ -6,7 +6,7 @@ import { addDebugOutlineIfEnabled } from '../utils/debug';
|
|
|
6
6
|
|
|
7
7
|
export interface PageWrapperProps extends HTMLDataAttributes, React.HTMLAttributes<HTMLDivElement> {}
|
|
8
8
|
|
|
9
|
-
export const PageWrapper: React.FC<PageWrapperProps
|
|
9
|
+
export const PageWrapper: React.FC<React.PropsWithChildren<PageWrapperProps>> = ({ children, ...props }) => {
|
|
10
10
|
const { theme } = useDesignSystemTheme();
|
|
11
11
|
|
|
12
12
|
return (
|
|
@@ -199,7 +199,7 @@ export function getPaginationEmotionStyles(
|
|
|
199
199
|
return css(importantStyles);
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
export const Pagination: React.FC<PaginationProps
|
|
202
|
+
export const Pagination: React.FC<React.PropsWithChildren<PaginationProps>> = function Pagination({
|
|
203
203
|
currentPageIndex,
|
|
204
204
|
pageSize = 10,
|
|
205
205
|
numTotal,
|
|
@@ -315,7 +315,7 @@ export interface CursorPaginationProps
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export const CursorPagination: React.FC<CursorPaginationProps
|
|
318
|
+
export const CursorPagination: React.FC<React.PropsWithChildren<CursorPaginationProps>> = function CursorPagination({
|
|
319
319
|
onNextPage,
|
|
320
320
|
onPreviousPage,
|
|
321
321
|
hasNextPage,
|
|
@@ -93,6 +93,76 @@ describe('<PreviewCard/>', () => {
|
|
|
93
93
|
expect(eventCallback).not.toHaveBeenCalled();
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
+
describe('With href prop', () => {
|
|
97
|
+
it('renders as a link when href is provided', () => {
|
|
98
|
+
renderComponent({
|
|
99
|
+
href: 'https://example.com',
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const link = screen.getByRole('link');
|
|
103
|
+
expect(link).toBeInTheDocument();
|
|
104
|
+
expect(link).toHaveAttribute('href', 'https://example.com');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('does not render as button when href is provided even with onClick', () => {
|
|
108
|
+
renderComponent({
|
|
109
|
+
href: 'https://example.com',
|
|
110
|
+
onClick: jest.fn(),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
expect(screen.queryByRole('button')).not.toBeInTheDocument();
|
|
114
|
+
expect(screen.getByRole('link')).toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('emits an onClick event when clicked with href provided', async () => {
|
|
118
|
+
const testComponentId = 'test_component_id';
|
|
119
|
+
renderComponent({
|
|
120
|
+
href: 'https://example.com',
|
|
121
|
+
componentId: testComponentId,
|
|
122
|
+
analyticsEvents: [DesignSystemEventProviderAnalyticsEventTypes.OnClick],
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
expect(eventCallback).not.toHaveBeenCalled();
|
|
126
|
+
|
|
127
|
+
await userEvent.click(screen.getByRole('link'));
|
|
128
|
+
|
|
129
|
+
expect(eventCallback).toHaveBeenCalledTimes(1);
|
|
130
|
+
expect(eventCallback).toHaveBeenCalledWith({
|
|
131
|
+
eventType: 'onClick',
|
|
132
|
+
componentType: 'preview_card',
|
|
133
|
+
componentId: testComponentId,
|
|
134
|
+
value: undefined,
|
|
135
|
+
shouldStartInteraction: true,
|
|
136
|
+
event: expect.any(Object),
|
|
137
|
+
isInteractionSubject: undefined,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('emits an onClick event when interacted with via keyboard with href provided', async () => {
|
|
142
|
+
const onClickSpy = jest.fn();
|
|
143
|
+
renderComponent({
|
|
144
|
+
href: 'https://example.com',
|
|
145
|
+
onClick: onClickSpy,
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
await userEvent.tab();
|
|
149
|
+
await userEvent.keyboard('{Enter}');
|
|
150
|
+
await userEvent.keyboard(' ');
|
|
151
|
+
|
|
152
|
+
expect(onClickSpy).toHaveBeenCalledTimes(1);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('sets target attribute when provided with href', () => {
|
|
156
|
+
renderComponent({
|
|
157
|
+
href: 'https://example.com',
|
|
158
|
+
target: '_blank',
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const link = screen.getByRole('link');
|
|
162
|
+
expect(link).toHaveAttribute('target', '_blank');
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
96
166
|
it('emits an onView event on render', async () => {
|
|
97
167
|
// Disable IntersectionObserver for useNotifyOnFirstView hook to trigger
|
|
98
168
|
(window as any).IntersectionObserver = undefined;
|
|
@@ -26,7 +26,7 @@ export interface PreviewCardProps
|
|
|
26
26
|
image?: React.ReactNode;
|
|
27
27
|
fullBleedImage?: boolean;
|
|
28
28
|
size?: 'default' | 'large';
|
|
29
|
-
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
29
|
+
onClick?: React.MouseEventHandler<HTMLDivElement | HTMLAnchorElement>;
|
|
30
30
|
disabled?: boolean;
|
|
31
31
|
selected?: boolean;
|
|
32
32
|
href?: string;
|
|
@@ -54,7 +54,7 @@ export const PreviewCard = ({
|
|
|
54
54
|
target,
|
|
55
55
|
...props
|
|
56
56
|
}: PreviewCardProps) => {
|
|
57
|
-
const styles = usePreviewCardStyles({ onClick, size, disabled, fullBleedImage });
|
|
57
|
+
const styles = usePreviewCardStyles({ onClick, size, disabled, fullBleedImage, href });
|
|
58
58
|
const tabIndex = onClick && !href ? 0 : undefined;
|
|
59
59
|
const role = onClick && !href ? 'button' : undefined;
|
|
60
60
|
const showFooter = startActions || endActions;
|
|
@@ -76,6 +76,15 @@ export const PreviewCard = ({
|
|
|
76
76
|
},
|
|
77
77
|
[eventContext, onClick],
|
|
78
78
|
);
|
|
79
|
+
const onHrefClickWrapper = useCallback(
|
|
80
|
+
(e: React.MouseEvent<HTMLAnchorElement>) => {
|
|
81
|
+
eventContext.onClick(e);
|
|
82
|
+
if (onClick) {
|
|
83
|
+
onClick(e);
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
[eventContext, onClick],
|
|
87
|
+
);
|
|
79
88
|
const content = (
|
|
80
89
|
<div
|
|
81
90
|
{...addDebugOutlineIfEnabled()}
|
|
@@ -119,7 +128,7 @@ export const PreviewCard = ({
|
|
|
119
128
|
|
|
120
129
|
if (href) {
|
|
121
130
|
return (
|
|
122
|
-
<a href={href} target={target} style={{ textDecoration: 'none' }}>
|
|
131
|
+
<a href={href} target={target} style={{ textDecoration: 'none' }} onClick={onHrefClickWrapper}>
|
|
123
132
|
{content}
|
|
124
133
|
</a>
|
|
125
134
|
);
|
|
@@ -132,10 +141,11 @@ const usePreviewCardStyles = ({
|
|
|
132
141
|
size,
|
|
133
142
|
disabled,
|
|
134
143
|
fullBleedImage,
|
|
135
|
-
|
|
144
|
+
href,
|
|
145
|
+
}: Pick<PreviewCardProps, 'onClick' | 'size' | 'disabled' | 'fullBleedImage' | 'href'>): Record<string, CSSObject> => {
|
|
136
146
|
const { theme } = useDesignSystemTheme();
|
|
137
147
|
const { useNewShadows } = useDesignSystemSafexFlags();
|
|
138
|
-
const isInteractive = onClick !== undefined;
|
|
148
|
+
const isInteractive = href !== undefined || onClick !== undefined;
|
|
139
149
|
const paddingSize = size === 'large' ? theme.spacing.lg : theme.spacing.md;
|
|
140
150
|
return {
|
|
141
151
|
container: {
|
|
@@ -499,14 +499,39 @@ const StyledRadioGroup = forwardRef<HTMLDivElement, RadioGroupProps>(function St
|
|
|
499
499
|
);
|
|
500
500
|
});
|
|
501
501
|
|
|
502
|
-
const HorizontalGroup: React.FC<OrientedRadioGroupProps
|
|
503
|
-
|
|
502
|
+
const HorizontalGroup: React.FC<React.PropsWithChildren<OrientedRadioGroupProps>> = forwardRef<
|
|
503
|
+
HTMLDivElement,
|
|
504
|
+
OrientedRadioGroupProps
|
|
505
|
+
>(function HorizontalGroup({ dangerouslySetAntdProps, useEqualColumnWidths, ...props }, ref) {
|
|
506
|
+
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
507
|
+
const { useNewFormUISpacing } = useDesignSystemSafexFlags();
|
|
508
|
+
|
|
509
|
+
return (
|
|
510
|
+
<StyledRadioGroup
|
|
511
|
+
css={getHorizontalRadioGroupStyles({ theme, classNamePrefix, useEqualColumnWidths, useNewFormUISpacing })}
|
|
512
|
+
{...props}
|
|
513
|
+
ref={ref}
|
|
514
|
+
{...dangerouslySetAntdProps}
|
|
515
|
+
/>
|
|
516
|
+
);
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
const Group: React.FC<React.PropsWithChildren<RadioGroupProps>> = forwardRef<HTMLDivElement, RadioGroupProps>(
|
|
520
|
+
function HorizontalGroup({ dangerouslySetAntdProps, layout = 'vertical', useEqualColumnWidths, ...props }, ref) {
|
|
504
521
|
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
505
522
|
const { useNewFormUISpacing } = useDesignSystemSafexFlags();
|
|
506
523
|
|
|
507
524
|
return (
|
|
508
525
|
<StyledRadioGroup
|
|
509
|
-
css={
|
|
526
|
+
css={
|
|
527
|
+
layout === 'horizontal'
|
|
528
|
+
? getHorizontalRadioGroupStyles({ theme, classNamePrefix, useEqualColumnWidths, useNewFormUISpacing })
|
|
529
|
+
: getVerticalRadioGroupStyles({
|
|
530
|
+
theme,
|
|
531
|
+
classNamePrefix,
|
|
532
|
+
useNewFormUISpacing,
|
|
533
|
+
})
|
|
534
|
+
}
|
|
510
535
|
{...props}
|
|
511
536
|
ref={ref}
|
|
512
537
|
{...dangerouslySetAntdProps}
|
|
@@ -515,31 +540,6 @@ const HorizontalGroup: React.FC<OrientedRadioGroupProps> = forwardRef<HTMLDivEle
|
|
|
515
540
|
},
|
|
516
541
|
);
|
|
517
542
|
|
|
518
|
-
const Group: React.FC<RadioGroupProps> = forwardRef<HTMLDivElement, RadioGroupProps>(function HorizontalGroup(
|
|
519
|
-
{ dangerouslySetAntdProps, layout = 'vertical', useEqualColumnWidths, ...props },
|
|
520
|
-
ref,
|
|
521
|
-
) {
|
|
522
|
-
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
523
|
-
const { useNewFormUISpacing } = useDesignSystemSafexFlags();
|
|
524
|
-
|
|
525
|
-
return (
|
|
526
|
-
<StyledRadioGroup
|
|
527
|
-
css={
|
|
528
|
-
layout === 'horizontal'
|
|
529
|
-
? getHorizontalRadioGroupStyles({ theme, classNamePrefix, useEqualColumnWidths, useNewFormUISpacing })
|
|
530
|
-
: getVerticalRadioGroupStyles({
|
|
531
|
-
theme,
|
|
532
|
-
classNamePrefix,
|
|
533
|
-
useNewFormUISpacing,
|
|
534
|
-
})
|
|
535
|
-
}
|
|
536
|
-
{...props}
|
|
537
|
-
ref={ref}
|
|
538
|
-
{...dangerouslySetAntdProps}
|
|
539
|
-
/>
|
|
540
|
-
);
|
|
541
|
-
});
|
|
542
|
-
|
|
543
543
|
// Note: We are overriding ant's default "Group" with our own.
|
|
544
544
|
const RadioNamespace = /* #__PURE__ */ Object.assign(DuboisRadio, { Group, HorizontalGroup });
|
|
545
545
|
export const Radio: RadioInterface = RadioNamespace;
|
|
@@ -71,7 +71,7 @@ function getSegmentedControlGroupEmotionStyles(
|
|
|
71
71
|
}),
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const importantStyles = importantify(useSegmentedSliderStyle ? sliderStyles : styles);
|
|
74
|
+
const importantStyles = importantify(useSegmentedSliderStyle && !spaced ? sliderStyles : styles);
|
|
75
75
|
|
|
76
76
|
return css(importantStyles);
|
|
77
77
|
}
|
|
@@ -308,7 +308,7 @@ function getSegmentedControlButtonEmotionStyles(
|
|
|
308
308
|
...getAnimationCss(theme.options.enableAnimation),
|
|
309
309
|
};
|
|
310
310
|
|
|
311
|
-
const importantStyles = importantify(useSegmentedSliderStyle ? sliderStyles : styles);
|
|
311
|
+
const importantStyles = importantify(useSegmentedSliderStyle && !spaced ? sliderStyles : styles);
|
|
312
312
|
|
|
313
313
|
return css(importantStyles);
|
|
314
314
|
}
|
|
@@ -240,7 +240,10 @@ interface SimpleSelectContentWrapperProps {
|
|
|
240
240
|
// This component is used to propagate the open state of the DialogCombobox to the SimpleSelect.
|
|
241
241
|
// We don't directly pass through `onOpenChange` since it's tied into the actual state; `SimpleSelect` merely
|
|
242
242
|
// needs to communicate via the optional prop if the dropdown is open or not and doesn't need to control it.
|
|
243
|
-
const SimpleSelectContentWrapper: React.FC<SimpleSelectContentWrapperProps
|
|
243
|
+
const SimpleSelectContentWrapper: React.FC<React.PropsWithChildren<SimpleSelectContentWrapperProps>> = ({
|
|
244
|
+
children,
|
|
245
|
+
onOpenChange,
|
|
246
|
+
}) => {
|
|
244
247
|
const { isOpen } = useDialogComboboxContext();
|
|
245
248
|
|
|
246
249
|
useEffect(() => {
|
|
@@ -46,7 +46,7 @@ const TableSkeletonStyles = {
|
|
|
46
46
|
}),
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
export const TableSkeleton: React.FC<TableSkeletonProps
|
|
49
|
+
export const TableSkeleton: React.FC<React.PropsWithChildren<TableSkeletonProps>> = ({
|
|
50
50
|
lines = 1,
|
|
51
51
|
seed = '',
|
|
52
52
|
frameRate = 60,
|
|
@@ -91,6 +91,7 @@ interface TableSkeletonRowsProps<TData> extends WithLoadingState {
|
|
|
91
91
|
table: Table<TData>;
|
|
92
92
|
actionColumnIds?: string[];
|
|
93
93
|
numRows?: number;
|
|
94
|
+
label?: React.ReactNode;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
interface MinMetaType {
|
|
@@ -105,13 +106,14 @@ export const TableSkeletonRows = <TData, MetaType extends MinMetaType>({
|
|
|
105
106
|
numRows = 3,
|
|
106
107
|
loading = true,
|
|
107
108
|
loadingDescription = 'Table skeleton rows',
|
|
109
|
+
label,
|
|
108
110
|
}: TableSkeletonRowsProps<TData>): React.ReactElement => {
|
|
109
111
|
const { theme } = useDesignSystemTheme();
|
|
110
112
|
|
|
111
113
|
return (
|
|
112
114
|
<>
|
|
113
115
|
{loading && <LoadingState description={loadingDescription} />}
|
|
114
|
-
|
|
116
|
+
<span css={visuallyHidden}>{label}</span>
|
|
115
117
|
{[...Array(numRows).keys()].map((i) => (
|
|
116
118
|
<TableRow key={i}>
|
|
117
119
|
{table.getFlatHeaders().map((header) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
|
|
4
|
-
import { genSkeletonAnimatedColor } from './utils';
|
|
4
|
+
import { getOffsets, genSkeletonAnimatedColor } from './utils';
|
|
5
5
|
import { useDesignSystemTheme } from '../Hooks';
|
|
6
6
|
import { LoadingState } from '../LoadingState/LoadingState';
|
|
7
7
|
import type { WithLoadingState } from '../LoadingState/LoadingState';
|
|
@@ -11,6 +11,9 @@ import { addDebugOutlineIfEnabled } from '../utils/debug';
|
|
|
11
11
|
interface TitleSkeletonProps extends WithLoadingState {
|
|
12
12
|
/** Label for screen readers */
|
|
13
13
|
label?: React.ReactNode;
|
|
14
|
+
/** Seed that deterministically arranges the uneven lines, so that they look like ragged text.
|
|
15
|
+
* If you don't provide this (or give each skeleton the same seed) they will all look the same. */
|
|
16
|
+
seed?: string;
|
|
14
17
|
/** fps for animation. Default is 60 fps. A lower number will use less resources. */
|
|
15
18
|
frameRate?: number;
|
|
16
19
|
/** Style property */
|
|
@@ -36,6 +39,7 @@ const titleFillStyles = css({
|
|
|
36
39
|
|
|
37
40
|
export const TitleSkeleton = ({
|
|
38
41
|
label,
|
|
42
|
+
seed = '',
|
|
39
43
|
frameRate = 60,
|
|
40
44
|
style,
|
|
41
45
|
loading = true,
|
|
@@ -43,6 +47,7 @@ export const TitleSkeleton = ({
|
|
|
43
47
|
...restProps
|
|
44
48
|
}: TitleSkeletonProps) => {
|
|
45
49
|
const { theme } = useDesignSystemTheme();
|
|
50
|
+
const offsetWidth = getOffsets(seed)[0];
|
|
46
51
|
|
|
47
52
|
return (
|
|
48
53
|
<div
|
|
@@ -56,7 +61,10 @@ export const TitleSkeleton = ({
|
|
|
56
61
|
>
|
|
57
62
|
{loading && <LoadingState description={loadingDescription} />}
|
|
58
63
|
<span css={visuallyHidden}>{label}</span>
|
|
59
|
-
<div
|
|
64
|
+
<div
|
|
65
|
+
aria-hidden
|
|
66
|
+
css={[titleFillStyles, genSkeletonAnimatedColor(theme, frameRate), { width: `calc(100% - ${offsetWidth}px)` }]}
|
|
67
|
+
/>
|
|
60
68
|
</div>
|
|
61
69
|
);
|
|
62
70
|
};
|
|
@@ -6,7 +6,7 @@ import type { DangerouslySetAntdProps, HTMLDataAttributes } from '../types';
|
|
|
6
6
|
|
|
7
7
|
export interface SpaceProps extends AntDSpaceProps, DangerouslySetAntdProps<AntDSpaceProps>, HTMLDataAttributes {}
|
|
8
8
|
|
|
9
|
-
export const Space: React.FC<SpaceProps
|
|
9
|
+
export const Space: React.FC<React.PropsWithChildren<SpaceProps>> = ({ dangerouslySetAntdProps, ...props }) => {
|
|
10
10
|
return (
|
|
11
11
|
<DesignSystemAntDConfigProvider>
|
|
12
12
|
<AntDSpace {...props} {...dangerouslySetAntdProps} />
|
|
@@ -11,7 +11,7 @@ export interface SpacerProps extends HTMLDataAttributes {
|
|
|
11
11
|
shrinks?: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export const Spacer: React.FC<SpacerProps
|
|
14
|
+
export const Spacer: React.FC<React.PropsWithChildren<SpacerProps>> = ({ size = 'md', shrinks, ...props }) => {
|
|
15
15
|
const { theme } = useDesignSystemTheme();
|
|
16
16
|
|
|
17
17
|
const spacingValues: Record<validSpacerOptions, number> = {
|
|
@@ -48,7 +48,7 @@ export interface SpinnerProps extends HTMLDataAttributes, WithLoadingState {
|
|
|
48
48
|
inheritColor?: boolean;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export const Spinner: React.FC<SpinnerProps
|
|
51
|
+
export const Spinner: React.FC<React.PropsWithChildren<SpinnerProps>> = ({
|
|
52
52
|
frameRate,
|
|
53
53
|
size = 'default',
|
|
54
54
|
delay,
|
|
@@ -90,7 +90,7 @@ export interface DropdownButtonProps
|
|
|
90
90
|
|
|
91
91
|
const ButtonGroup = AntDButton.Group;
|
|
92
92
|
|
|
93
|
-
export const DropdownButton: React.FC<DropdownButtonProps
|
|
93
|
+
export const DropdownButton: React.FC<React.PropsWithChildren<DropdownButtonProps>> = (props) => {
|
|
94
94
|
const { getPopupContainer: getContextPopupContainer, getPrefixCls } = useDesignSystemContext();
|
|
95
95
|
const { useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
96
96
|
|
|
@@ -168,7 +168,9 @@ function getSplitButtonEmotionStyles(
|
|
|
168
168
|
const importantStyles = importantify(styles);
|
|
169
169
|
return css(importantStyles);
|
|
170
170
|
}
|
|
171
|
-
export const SplitButton: React.FC<SplitButtonProps
|
|
171
|
+
export const SplitButton: React.FC<React.PropsWithChildren<SplitButtonProps>> = (
|
|
172
|
+
props: SplitButtonProps,
|
|
173
|
+
): ReactElement => {
|
|
172
174
|
const { theme, classNamePrefix } = useDesignSystemTheme();
|
|
173
175
|
const { useNewShadows, useNewBorderRadii } = useDesignSystemSafexFlags();
|
|
174
176
|
const {
|
|
@@ -29,7 +29,7 @@ export interface Step {
|
|
|
29
29
|
/**
|
|
30
30
|
* Custom icon to display in the step. If provided, the `icon` prop will be used instead of the default icon.
|
|
31
31
|
*/
|
|
32
|
-
icon?: React.ComponentType<{ statusColor: string; status: Step['status'] }
|
|
32
|
+
icon?: React.ComponentType<React.PropsWithChildren<{ statusColor: string; status: Step['status'] }>>;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Additional content displayed beneath the step description a vertical stepper
|
|
@@ -270,7 +270,7 @@ const getSwitchWithLabelStyles = ({
|
|
|
270
270
|
return css(importantStyles);
|
|
271
271
|
};
|
|
272
272
|
|
|
273
|
-
export const Switch: React.FC<SwitchProps
|
|
273
|
+
export const Switch: React.FC<React.PropsWithChildren<SwitchProps>> = ({
|
|
274
274
|
dangerouslySetAntdProps,
|
|
275
275
|
label,
|
|
276
276
|
labelProps,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { css } from '@emotion/react';
|
|
1
2
|
import classnames from 'classnames';
|
|
2
3
|
import type { CSSProperties } from 'react';
|
|
3
4
|
import React, { forwardRef, useContext } from 'react';
|
|
4
5
|
|
|
5
6
|
import { TableContext } from './Table';
|
|
6
7
|
import { repeatingElementsStyles, tableClassNames } from './tableStyles';
|
|
8
|
+
import { useDesignSystemTheme } from '../Hooks';
|
|
7
9
|
import { Typography } from '../Typography';
|
|
8
10
|
import type { TypographyTextProps } from '../Typography';
|
|
9
11
|
import type { HTMLDataAttributes } from '../types';
|
|
@@ -31,6 +33,13 @@ export const TableCell = forwardRef<HTMLDivElement, TableCellProps>(function (
|
|
|
31
33
|
ref,
|
|
32
34
|
) {
|
|
33
35
|
const { size, grid } = useContext(TableContext);
|
|
36
|
+
const { classNamePrefix } = useDesignSystemTheme();
|
|
37
|
+
|
|
38
|
+
const linkWithEllipsisCss = css({
|
|
39
|
+
[`& > .${classNamePrefix}-typography > a.${classNamePrefix}-typography-ellipsis`]: {
|
|
40
|
+
display: 'block',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
34
43
|
|
|
35
44
|
let typographySize: TypographyTextProps['size'] = 'md';
|
|
36
45
|
|
|
@@ -60,7 +69,7 @@ export const TableCell = forwardRef<HTMLDivElement, TableCellProps>(function (
|
|
|
60
69
|
style={{ textAlign: align, ...style }}
|
|
61
70
|
ref={ref}
|
|
62
71
|
// PE-259 Use more performance className for grid but keep css= for compatibility.
|
|
63
|
-
css={!grid ? repeatingElementsStyles.cell : undefined}
|
|
72
|
+
css={[!grid ? repeatingElementsStyles.cell : undefined, linkWithEllipsisCss]}
|
|
64
73
|
className={classnames(grid && tableClassNames.cell, className)}
|
|
65
74
|
>
|
|
66
75
|
{content}
|
|
@@ -159,7 +159,7 @@ const useTooltipStyles = ({ maxWidth }: { maxWidth: CSSObject['maxWidth'] }): Re
|
|
|
159
159
|
*
|
|
160
160
|
* See go/dubois.
|
|
161
161
|
*/
|
|
162
|
-
export const Tooltip: React.FC<TooltipProps
|
|
162
|
+
export const Tooltip: React.FC<React.PropsWithChildren<TooltipProps>> & HTMLAttributes<HTMLDivElement> = ({
|
|
163
163
|
children,
|
|
164
164
|
content,
|
|
165
165
|
defaultOpen = false,
|