@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.
Files changed (87) hide show
  1. package/codemods/camelize.ts +5 -5
  2. package/dist/Popover-CrX63HDP.js +3831 -0
  3. package/dist/Popover-CrX63HDP.js.map +1 -0
  4. package/dist/Popover-DQEbjNyV.js +3831 -0
  5. package/dist/Popover-DQEbjNyV.js.map +1 -0
  6. package/dist/WizardStepContentWrapper-Bv2MqnDd.js +2276 -0
  7. package/dist/WizardStepContentWrapper-Bv2MqnDd.js.map +1 -0
  8. package/dist/WizardStepContentWrapper-CzvxVy-w.js +2278 -0
  9. package/dist/WizardStepContentWrapper-CzvxVy-w.js.map +1 -0
  10. package/dist/development.js +3 -3
  11. package/dist/development.js.map +1 -1
  12. package/dist/index-BC9PpmGo.js +770 -0
  13. package/dist/index-BC9PpmGo.js.map +1 -0
  14. package/dist/index-DxyvNv4-.js +770 -0
  15. package/dist/index-DxyvNv4-.js.map +1 -0
  16. package/dist/index.js +162 -66
  17. package/dist/index.js.map +1 -1
  18. package/dist/patterns.js +2 -2
  19. package/package.json +4 -4
  20. package/scripts/theme_regeneration/common.ts +3 -3
  21. package/scripts/theme_regeneration/regenerate_color_validity_enums.ts +3 -3
  22. package/src/assets/icons/RowsIcon.svg +3 -0
  23. package/src/assets/icons/TokenIcon.svg +8 -0
  24. package/src/assets/icons/TrendingIcon.svg +1 -0
  25. package/src/design-system/Accordion/Accordion.tsx +2 -2
  26. package/src/design-system/Alert/Alert.tsx +1 -1
  27. package/src/design-system/ApplyGlobalStyles/ApplyGlobalStyles.tsx +1 -1
  28. package/src/design-system/Card/Card.test.tsx +52 -0
  29. package/src/design-system/Card/Card.tsx +21 -5
  30. package/src/design-system/DatePicker/DatePicker.tsx +6 -4
  31. package/src/design-system/DesignSystemEventProvider/DesignSystemEventProvider.test.tsx +5 -3
  32. package/src/design-system/DesignSystemProvider/DesignSystemProvider.test.tsx +1 -1
  33. package/src/design-system/DesignSystemProvider/DesignSystemProvider.tsx +8 -6
  34. package/src/design-system/Dropdown/Dropdown.tsx +1 -1
  35. package/src/design-system/Empty/Empty.tsx +1 -1
  36. package/src/design-system/Grid/Col.tsx +1 -1
  37. package/src/design-system/Grid/Row.tsx +1 -1
  38. package/src/design-system/Header/Header.tsx +1 -1
  39. package/src/design-system/Hooks/useDesignSystemTheme.tsx +3 -1
  40. package/src/design-system/HoverCard/HoverCard.tsx +11 -5
  41. package/src/design-system/Icon/Icon.tsx +4 -4
  42. package/src/design-system/Icon/__generated/icons/{InfoIcon.tsx → RowsIcon.tsx} +6 -7
  43. package/src/design-system/Icon/__generated/icons/TokenIcon.tsx +28 -0
  44. package/src/design-system/Icon/__generated/icons/TrendingIcon.tsx +23 -0
  45. package/src/design-system/Icon/__generated/icons/index.ts +3 -1
  46. package/src/design-system/Input/Password.tsx +25 -23
  47. package/src/design-system/LegacyForm/LegacyForm.tsx +5 -1
  48. package/src/design-system/LegacyPopover/LegacyPopover.tsx +5 -1
  49. package/src/design-system/LegacySelect/LegacySelect.tsx +2 -2
  50. package/src/design-system/LegacyTable/LegacyTable.tsx +1 -1
  51. package/src/design-system/LegacyTabs/index.tsx +4 -1
  52. package/src/design-system/LegacyTooltip/LegacyTooltip.tsx +1 -1
  53. package/src/design-system/LoadingState/LoadingState.tsx +1 -1
  54. package/src/design-system/Modal/Modal.tsx +19 -2
  55. package/src/design-system/PageWrapper/PageWrapper.tsx +1 -1
  56. package/src/design-system/Pagination/index.tsx +2 -2
  57. package/src/design-system/PreviewCard/PreviewCard.test.tsx +70 -0
  58. package/src/design-system/PreviewCard/PreviewCard.tsx +15 -5
  59. package/src/design-system/Radio/Radio.tsx +28 -28
  60. package/src/design-system/SegmentedControl/SegmentedControl.tsx +2 -2
  61. package/src/design-system/Select/SimpleSelect.tsx +4 -1
  62. package/src/design-system/Skeleton/TableSkeleton.tsx +4 -2
  63. package/src/design-system/Skeleton/TitleSkeleton.tsx +10 -2
  64. package/src/design-system/Space/Space.tsx +1 -1
  65. package/src/design-system/Spacer/Spacer.tsx +1 -1
  66. package/src/design-system/Spinner/Spinner.tsx +1 -1
  67. package/src/design-system/SplitButton/Dropdown/DropdownButton.tsx +1 -1
  68. package/src/design-system/SplitButton/SplitButton.tsx +3 -1
  69. package/src/design-system/Stepper/Stepper.tsx +1 -1
  70. package/src/design-system/Switch/Switch.tsx +1 -1
  71. package/src/design-system/TableUI/TableCell.tsx +10 -1
  72. package/src/design-system/Tooltip/Tooltip.tsx +1 -1
  73. package/src/design-system/TypeaheadCombobox/CountBadge.tsx +5 -1
  74. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxControls.tsx +1 -1
  75. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxRoot.tsx +1 -1
  76. package/src/design-system/TypeaheadCombobox/TypeaheadComboboxSelectedItem.tsx +1 -1
  77. package/src/design-system/TypeaheadCombobox/tests/TypeaheadCombobox.test.tsx +3 -3
  78. package/src/design-system/TypeaheadCombobox/tests/testFixtures.tsx +3 -3
  79. package/src/design-system/utils/css-utils.tsx +6 -6
  80. package/src/design-system/utils/shadow-dom-storybook-wrapper.tsx +1 -1
  81. package/src/development/Banner/Banner.tsx +1 -1
  82. package/src/development/PillControl/PillControl.tsx +1 -0
  83. package/src/development/TreeGrid/TreeGrid.test.tsx +2 -2
  84. package/src/development/TreeGrid/TreeGrid.tsx +1 -1
  85. package/src/theme/convertToLessVars.ts +5 -5
  86. package/src/~patterns/Wizard/VerticalWizardContent.tsx +3 -1
  87. package/src/assets/icons/InfoIcon.svg +0 -5
package/dist/patterns.js CHANGED
@@ -1,8 +1,8 @@
1
- export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-DrM6lQ15.js';
1
+ export { D as DocumentationSidebar, F as FIXED_VERTICAL_STEPPER_WIDTH, M as MAX_VERTICAL_WIZARD_CONTENT_WIDTH, W as Wizard, a as WizardControlled, b as WizardModal, c as WizardStepContentWrapper, u as useWizardCurrentStep } from './WizardStepContentWrapper-CzvxVy-w.js';
2
2
  import '@emotion/react/jsx-runtime';
3
3
  import 'lodash';
4
4
  import 'react';
5
- import './Popover-BQ2j1MM7.js';
5
+ import './Popover-DQEbjNyV.js';
6
6
  import '@emotion/react';
7
7
  import 'antd';
8
8
  import '@floating-ui/react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databricks/design-system",
3
- "version": "1.12.20",
3
+ "version": "1.12.21",
4
4
  "description": "DuBois Design System",
5
5
  "keywords": [],
6
6
  "license": "ISC",
@@ -97,8 +97,8 @@
97
97
  "indexes-check": "swc-node ./scripts/index_regeneration/check.ts",
98
98
  "theme-regenerate": "swc-node ./scripts/theme_regeneration/regenerate_all.ts && databricks-prettier ./src/theme/_generated --write",
99
99
  "theme-check": "swc-node ./scripts/theme_regeneration/check.ts",
100
- "prettier:fix": "databricks-prettier . --write",
101
- "prettier:check": "databricks-prettier . --check",
100
+ "prettier:fix": "databricks-prettier --write",
101
+ "prettier:check": "databricks-prettier --check",
102
102
  "lint": "databricks-eslint",
103
103
  "lint:fix": "yarn lint --fix",
104
104
  "test": "databricks-jest",
@@ -170,7 +170,7 @@
170
170
  "resize-observer-polyfill": "^1.5.1",
171
171
  "style-loader": "^3.3.1",
172
172
  "tsconfig-paths": "^3.9.0",
173
- "typescript": "^5.8.3",
173
+ "typescript": "^5.9.2",
174
174
  "usehooks-ts": "^2.9.1",
175
175
  "webpack": "^5.75.0",
176
176
  "webpack-merge": "^5.8.0"
@@ -1,4 +1,4 @@
1
- import _ from 'lodash';
1
+ import { camelCase } from 'lodash';
2
2
 
3
3
  export type token = {
4
4
  $type: string;
@@ -18,7 +18,7 @@ function formatColorToken(token: string): string {
18
18
  // Splices primitive path into token name; we only care about the first and last parts today. I.e. Primitives.Blue.Blue100 -> primitives.blue100
19
19
  if (token.startsWith('{') && token.endsWith('}')) {
20
20
  const parts = token.replace(/[{}]/g, '').split('/');
21
- return `${_.camelCase(parts[0])}.${_.camelCase(parts[parts.length - 1])}`;
21
+ return `${camelCase(parts[0])}.${camelCase(parts[parts.length - 1])}`;
22
22
  }
23
23
  return token;
24
24
  }
@@ -27,7 +27,7 @@ export const flattenTokens = (tokens: tokenJson): { [key: string]: string } => {
27
27
  return Object.keys(tokens).reduce((acc, key) => {
28
28
  const token = tokens[key];
29
29
 
30
- const newKey = _.camelCase(key);
30
+ const newKey = camelCase(key);
31
31
 
32
32
  // Skipping numbers for now.
33
33
  if (token.$type === 'number') {
@@ -1,7 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import path from 'path';
3
3
 
4
- import _ from 'lodash';
4
+ import { camelCase, upperFirst } from 'lodash';
5
5
 
6
6
  import { primitiveColors } from '../../src/theme/_generated/PrimitiveColors';
7
7
  import { lightColorList } from '../../src/theme/_generated/SemanticColors-Light';
@@ -16,7 +16,7 @@ export enum ValidSemanticColors {
16
16
  ${Object.keys(lightColorList)
17
17
  .sort()
18
18
  // PascalCase enum key -> camelCase enum value
19
- .map((key) => `${_.upperFirst(_.camelCase(key))} = '${_.camelCase(key)}'`)
19
+ .map((key) => `${upperFirst(camelCase(key))} = '${camelCase(key)}'`)
20
20
  .join(',\n ')}
21
21
  }
22
22
  `;
@@ -35,7 +35,7 @@ export enum ValidPrimitiveColors {
35
35
  ${Object.keys(primitiveColors)
36
36
  .sort()
37
37
  // PascalCase enum key -> camelCase enum value
38
- .map((key) => `${_.upperFirst(_.camelCase(key))} = '${_.camelCase(key)}'`)
38
+ .map((key) => `${upperFirst(camelCase(key))} = '${camelCase(key)}'`)
39
39
  .join(',\n ')}
40
40
  }
41
41
  `;
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.25 1C14.6642 1 15 1.33579 15 1.75L15 14.25C15 14.6642 14.6642 15 14.25 15L1.75 15C1.33579 15 1 14.6642 1 14.25L1 1.75C1 1.33579 1.33579 1 1.75 1L14.25 1ZM2.5 2.5L13.5 2.5L13.5 5L2.5 5L2.5 2.5ZM2.5 6.5L2.5 9.5L13.5 9.5V6.5L2.5 6.5ZM13.5 11L2.5 11L2.5 13.5L13.5 13.5V11Z" fill="#5F7281"/>
3
+ </svg>
@@ -0,0 +1,8 @@
1
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <mask id="path-1-inside-1_4657_145730" fill="white">
3
+ <path d="M5.5961 10.7989C6.33799 11.0159 7.12009 11.058 7.88097 10.9218C8.64186 10.7856 9.3608 10.4748 9.98134 10.0139C10.6019 9.55303 11.1071 8.95453 11.4573 8.26545C11.8076 7.57636 11.9932 6.81546 11.9998 6.04251C12.0064 5.26956 11.8337 4.50562 11.4952 3.81068C11.1567 3.11574 10.6618 2.50874 10.0492 2.03735C9.43656 1.56596 8.723 1.24303 7.96454 1.09392C7.20608 0.944802 6.42338 0.97357 5.67791 1.17796L5.93565 2.11802C6.53579 1.95348 7.16591 1.93032 7.7765 2.05036C8.3871 2.17041 8.96155 2.43038 9.45473 2.80987C9.94791 3.18936 10.3464 3.67803 10.6189 4.23749C10.8913 4.79695 11.0304 5.41196 11.0251 6.03423C11.0198 6.65649 10.8703 7.26905 10.5884 7.8238C10.3064 8.37854 9.89968 8.86036 9.40012 9.23141C8.90056 9.60246 8.32177 9.85263 7.70922 9.96227C7.09668 10.0719 6.46705 10.038 5.8698 9.86332L5.5961 10.7989Z"/>
4
+ </mask>
5
+ <path d="M5.5961 10.7989C6.33799 11.0159 7.12009 11.058 7.88097 10.9218C8.64186 10.7856 9.3608 10.4748 9.98134 10.0139C10.6019 9.55303 11.1071 8.95453 11.4573 8.26545C11.8076 7.57636 11.9932 6.81546 11.9998 6.04251C12.0064 5.26956 11.8337 4.50562 11.4952 3.81068C11.1567 3.11574 10.6618 2.50874 10.0492 2.03735C9.43656 1.56596 8.723 1.24303 7.96454 1.09392C7.20608 0.944802 6.42338 0.97357 5.67791 1.17796L5.93565 2.11802C6.53579 1.95348 7.16591 1.93032 7.7765 2.05036C8.3871 2.17041 8.96155 2.43038 9.45473 2.80987C9.94791 3.18936 10.3464 3.67803 10.6189 4.23749C10.8913 4.79695 11.0304 5.41196 11.0251 6.03423C11.0198 6.65649 10.8703 7.26905 10.5884 7.8238C10.3064 8.37854 9.89968 8.86036 9.40012 9.23141C8.90056 9.60246 8.32177 9.85263 7.70922 9.96227C7.09668 10.0719 6.46705 10.038 5.8698 9.86332L5.5961 10.7989Z" stroke="#5F7281" stroke-width="2" mask="url(#path-1-inside-1_4657_145730)"/>
6
+ <circle cx="5" cy="6" r="4.5" stroke="#5F7281"/>
7
+ <circle cx="5" cy="6" r="1.5" stroke="#5F7281"/>
8
+ </svg>
@@ -0,0 +1 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" clipRule="evenodd" d="M6.332.14a.99.99 0 0 1 .98-.018c4.417 2.052 6.918 6.313 6.764 9.876-.066 1.497-.602 2.883-1.64 3.895-1.04 1.012-2.531 1.604-4.42 1.607a5.745 5.745 0 0 1-6.097-5.504v-.008a4.85 4.85 0 0 1 2.495-4.366.554.554 0 0 1 .776.261c.27.613.648 1.17 1.115 1.646.547-.714.8-1.637.792-2.652-.009-1.208-.388-2.502-1.024-3.605A.84.84 0 0 1 6.333.14" fill="#11171C"/></svg>
@@ -62,7 +62,7 @@ export interface AccordionPanelProps extends HTMLDataAttributes {
62
62
  }
63
63
 
64
64
  interface AccordionInterface extends React.FC<AccordionProps> {
65
- Panel: React.FC<AccordionPanelProps>;
65
+ Panel: React.FC<React.PropsWithChildren<AccordionPanelProps>>;
66
66
  }
67
67
 
68
68
  function getAccordionEmotionStyles({
@@ -158,7 +158,7 @@ function getAccordionEmotionStyles({
158
158
  return css(styles);
159
159
  }
160
160
 
161
- export const AccordionPanel: React.FC<AccordionPanelProps> = ({
161
+ export const AccordionPanel: React.FC<React.PropsWithChildren<AccordionPanelProps>> = ({
162
162
  dangerouslySetAntdProps,
163
163
  dangerouslyAppendEmotionCSS,
164
164
  children,
@@ -54,7 +54,7 @@ export interface AlertProps
54
54
  size?: 'small' | 'large';
55
55
  }
56
56
 
57
- export const Alert: React.FC<AlertProps> = ({
57
+ export const Alert: React.FC<React.PropsWithChildren<AlertProps>> = ({
58
58
  componentId,
59
59
  analyticsEvents = [DesignSystemEventProviderAnalyticsEventTypes.OnView],
60
60
  dangerouslySetAntdProps,
@@ -14,7 +14,7 @@ export const getGlobalStyles = (theme: Theme): SerializedStyles => {
14
14
  });
15
15
  };
16
16
 
17
- export const ApplyGlobalStyles: React.FC = () => {
17
+ export const ApplyGlobalStyles: React.FC<React.PropsWithChildren<unknown>> = () => {
18
18
  const { theme } = useDesignSystemTheme();
19
19
  return <Global styles={getGlobalStyles(theme)} />;
20
20
  };
@@ -96,4 +96,56 @@ describe('<Card/>', () => {
96
96
  value: undefined,
97
97
  });
98
98
  });
99
+
100
+ describe('Card with input element', () => {
101
+ it('should not trigger Card onClick when input element is focused and Enter is pressed', async () => {
102
+ const mockOnClick = jest.fn();
103
+ const user = userEvent.setup();
104
+
105
+ render(
106
+ <Card componentId={cardComponentId} onClick={mockOnClick}>
107
+ <input placeholder="Type here" />
108
+ <div>Card content</div>
109
+ </Card>,
110
+ );
111
+
112
+ const input = screen.getByRole('textbox');
113
+ await user.click(input);
114
+ expect(mockOnClick).toHaveBeenCalledTimes(1);
115
+ await user.keyboard('{Enter}');
116
+ expect(mockOnClick).not.toHaveBeenCalledTimes(2);
117
+ });
118
+
119
+ it('should trigger Card onClick when Card itself is focused and Enter is pressed', async () => {
120
+ const mockOnClick = jest.fn();
121
+ const user = userEvent.setup();
122
+
123
+ render(
124
+ <Card componentId={cardComponentId} onClick={mockOnClick} role="button">
125
+ <input placeholder="Type here" />
126
+ <div>Card content</div>
127
+ </Card>,
128
+ );
129
+
130
+ const card = screen.getByRole('button');
131
+ await user.click(card);
132
+ await user.keyboard('{Enter}');
133
+ expect(mockOnClick).toHaveBeenCalled();
134
+ });
135
+
136
+ it('should allow textarea to function normally when focused', async () => {
137
+ const mockOnClick = jest.fn();
138
+ const user = userEvent.setup();
139
+
140
+ render(
141
+ <Card componentId={cardComponentId} onClick={mockOnClick} role="button">
142
+ <textarea placeholder="Type here" />
143
+ <div>Card content</div>
144
+ </Card>,
145
+ );
146
+ const input = screen.getByRole('textbox');
147
+ await user.type(input, 'Hello World\nNew Line');
148
+ expect(input).toHaveValue('Hello World\nNew Line');
149
+ });
150
+ });
99
151
  });
@@ -41,6 +41,13 @@ export interface CardProps
41
41
  */
42
42
  loading?: boolean;
43
43
 
44
+ /**
45
+ * Custom loading description
46
+ *
47
+ * @default undefined
48
+ */
49
+ loadingDescription?: string;
50
+
44
51
  /**
45
52
  * Custom loading content using Dubois Skeleton components
46
53
  *
@@ -155,6 +162,7 @@ export const Card = ({
155
162
  customLoadingContent,
156
163
  dangerouslyAppendEmotionCSS,
157
164
  loading,
165
+ loadingDescription,
158
166
  width,
159
167
  bottomBarContent,
160
168
  topBarContent,
@@ -251,8 +259,8 @@ export const Card = ({
251
259
  onKeyDown={async (e) => {
252
260
  const isEnter = e.key === 'Enter';
253
261
  const isSpace = e.key === ' ';
254
- const isFocusableElement = e.target === e.currentTarget; // ensures the element itself is focused
255
- if (isEnter || (isSpace && isFocusableElement)) {
262
+ const isCardFocused = e.target === e.currentTarget; // ensures the element itself is focused
263
+ if ((isEnter || isSpace) && isCardFocused) {
256
264
  await handleSelection(e);
257
265
  }
258
266
  dataAndAttributes.onKeyDown?.(e);
@@ -260,7 +268,11 @@ export const Card = ({
260
268
  {...eventContext.dataComponentProps}
261
269
  >
262
270
  {loading ? (
263
- <DefaultCardLoadingContent width={width} customLoadingContent={customLoadingContent} />
271
+ <DefaultCardLoadingContent
272
+ width={width}
273
+ customLoadingContent={customLoadingContent}
274
+ loadingDescription={loadingDescription}
275
+ />
264
276
  ) : (
265
277
  <>
266
278
  {topBar}
@@ -280,13 +292,17 @@ export const Card = ({
280
292
  );
281
293
  };
282
294
 
283
- function DefaultCardLoadingContent({ customLoadingContent, width }: Pick<CardProps, 'customLoadingContent' | 'width'>) {
295
+ function DefaultCardLoadingContent({
296
+ customLoadingContent,
297
+ width,
298
+ loadingDescription,
299
+ }: Pick<CardProps, 'customLoadingContent' | 'width' | 'loadingDescription'>) {
284
300
  if (customLoadingContent) {
285
301
  return <>{customLoadingContent}</>;
286
302
  }
287
303
  return (
288
304
  <div css={{ width: width ?? LOADING_STATE_DEFAULT_WIDTH }}>
289
- <TitleSkeleton label="Loading..." style={{ width: '50%' }} />
305
+ <TitleSkeleton label="Loading..." style={{ width: '50%' }} loadingDescription={loadingDescription} />
290
306
  {[...Array(3).keys()].map((i) => (
291
307
  <ParagraphSkeleton label="Loading..." key={i} />
292
308
  ))}
@@ -85,10 +85,12 @@ function useDatePickerStyles(): SerializedStyles {
85
85
  return getEmotionStyles(clsPrefix, theme);
86
86
  }
87
87
 
88
- const AccessibilityWrapper: React.FC<{
89
- children: React.ReactNode;
90
- ariaLive?: 'assertive' | 'polite';
91
- }> = ({ children, ariaLive = 'assertive', ...restProps }) => {
88
+ const AccessibilityWrapper: React.FC<
89
+ React.PropsWithChildren<{
90
+ children: React.ReactNode;
91
+ ariaLive?: 'assertive' | 'polite';
92
+ }>
93
+ > = ({ children, ariaLive = 'assertive', ...restProps }) => {
92
94
  const { theme } = useDesignSystemTheme();
93
95
  const ref = useRef<HTMLDivElement>(null);
94
96
 
@@ -10,9 +10,11 @@ import {
10
10
  useDesignSystemEventComponentCallbacks,
11
11
  } from './DesignSystemEventProvider';
12
12
 
13
- const MockChildComponent: React.FC<{
14
- analyticsEvents?: ReadonlyArray<DesignSystemEventProviderAnalyticsEventTypes>;
15
- }> = (props) => {
13
+ const MockChildComponent: React.FC<
14
+ React.PropsWithChildren<{
15
+ analyticsEvents?: ReadonlyArray<DesignSystemEventProviderAnalyticsEventTypes>;
16
+ }>
17
+ > = (props) => {
16
18
  const button1Context = useDesignSystemEventComponentCallbacks({
17
19
  componentType: DesignSystemEventProviderComponentTypes.Button,
18
20
  componentId: 'button1',
@@ -204,7 +204,7 @@ describe('AntDConfigProvider', () => {
204
204
  });
205
205
 
206
206
  it('resets antd class when using RestoreAntDDefaultClsPrefix', () => {
207
- const DSWrapperComponent: React.FC = ({ children }) => {
207
+ const DSWrapperComponent: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
208
208
  return (
209
209
  <DesignSystemAntDConfigProvider>
210
210
  <Button
@@ -95,14 +95,14 @@ type AntDConfigProviderPropsProps = Pick<AntDConfigProviderProps, 'prefixCls' |
95
95
  const AntDConfigProviderPropsContext = React.createContext<AntDConfigProviderPropsProps | null>(null);
96
96
 
97
97
  /** Only to be accessed by SupportsDuBoisThemes, except for special exceptions like tests and storybook. Ask in #dubois first if you need to use it. */
98
- export const DesignSystemThemeProvider: React.FC<DesignSystemThemeProviderProps> = ({
98
+ export const DesignSystemThemeProvider: React.FC<React.PropsWithChildren<DesignSystemThemeProviderProps>> = ({
99
99
  isDarkMode = false,
100
100
  children,
101
101
  }) => {
102
102
  return <DesignSystemThemeContext.Provider value={{ isDarkMode }}>{children}</DesignSystemThemeContext.Provider>;
103
103
  };
104
104
 
105
- export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
105
+ export const DesignSystemProvider: React.FC<React.PropsWithChildren<DesignSystemProviderProps>> = ({
106
106
  children,
107
107
  enableAnimation = false,
108
108
  zIndexBase = 1000,
@@ -172,7 +172,7 @@ export const DesignSystemProvider: React.FC<DesignSystemProviderProps> = ({
172
172
  );
173
173
  };
174
174
 
175
- export const ApplyDesignSystemContextOverrides: React.FC<DesignSystemProviderProps> = ({
175
+ export const ApplyDesignSystemContextOverrides: React.FC<React.PropsWithChildren<DesignSystemProviderProps>> = ({
176
176
  enableAnimation,
177
177
  zIndexBase,
178
178
  getPopupContainer,
@@ -204,9 +204,11 @@ export const ApplyDesignSystemContextOverrides: React.FC<DesignSystemProviderPro
204
204
  };
205
205
 
206
206
  // This is a more-specific version of `ApplyDesignSystemContextOverrides` that only allows overriding the flags.
207
- export const ApplyDesignSystemFlags: React.FC<{
208
- flags: DesignSystemFlags;
209
- }> = ({ flags, children }) => {
207
+ export const ApplyDesignSystemFlags: React.FC<
208
+ React.PropsWithChildren<{
209
+ flags: DesignSystemFlags;
210
+ }>
211
+ > = ({ flags, children }) => {
210
212
  const parentDesignSystemProviderProps = useContext(DesignSystemProviderPropsContext);
211
213
  if (parentDesignSystemProviderProps === null) {
212
214
  throw new Error(
@@ -14,7 +14,7 @@ export interface DropdownProps
14
14
  /**
15
15
  * @deprecated Use `DropdownMenu` instead.
16
16
  */
17
- export const Dropdown: React.FC<DropdownProps> = ({ dangerouslySetAntdProps, ...props }) => {
17
+ export const Dropdown: React.FC<React.PropsWithChildren<DropdownProps>> = ({ dangerouslySetAntdProps, ...props }) => {
18
18
  const { theme } = useDesignSystemTheme();
19
19
  return (
20
20
  <DesignSystemAntDConfigProvider>
@@ -63,7 +63,7 @@ function getEmptyDescriptionStyles(theme: Theme, clsPrefix: string): SerializedS
63
63
  return css(styles);
64
64
  }
65
65
 
66
- export const Empty: React.FC<EmptyProps> = (props: EmptyProps): ReactElement => {
66
+ export const Empty: React.FC<React.PropsWithChildren<EmptyProps>> = (props: EmptyProps): ReactElement => {
67
67
  const { theme, classNamePrefix } = useDesignSystemTheme();
68
68
  const { title, description, image = <ListIcon />, button, dangerouslyAppendEmotionCSS, ...dataProps } = props;
69
69
 
@@ -6,7 +6,7 @@ import type { DangerouslySetAntdProps, HTMLDataAttributes } from '../types';
6
6
 
7
7
  export interface ColProps extends AntDColProps, DangerouslySetAntdProps<AntDColProps>, HTMLDataAttributes {}
8
8
 
9
- export const Col: React.FC<ColProps> = ({ dangerouslySetAntdProps, ...props }: ColProps) => (
9
+ export const Col: React.FC<React.PropsWithChildren<ColProps>> = ({ dangerouslySetAntdProps, ...props }: ColProps) => (
10
10
  <DesignSystemAntDConfigProvider>
11
11
  <AntDCol {...props} {...dangerouslySetAntdProps} />
12
12
  </DesignSystemAntDConfigProvider>
@@ -8,7 +8,7 @@ export interface RowProps extends AntDRowProps, DangerouslySetAntdProps<AntDRowP
8
8
 
9
9
  export const ROW_GUTTER_SIZE = 8;
10
10
 
11
- export const Row: React.FC<RowProps> = ({ gutter = ROW_GUTTER_SIZE, ...props }) => {
11
+ export const Row: React.FC<React.PropsWithChildren<RowProps>> = ({ gutter = ROW_GUTTER_SIZE, ...props }) => {
12
12
  return (
13
13
  <DesignSystemAntDConfigProvider>
14
14
  <AntDRow gutter={gutter} {...props} />
@@ -36,7 +36,7 @@ const getHeaderStyles = (clsPrefix: string, theme: Theme): SerializedStyles => {
36
36
  return css(importantify(styles));
37
37
  };
38
38
 
39
- export const Header: React.FC<HeaderProps> = ({
39
+ export const Header: React.FC<React.PropsWithChildren<HeaderProps>> = ({
40
40
  breadcrumbs,
41
41
  title,
42
42
  titleAddOns,
@@ -49,7 +49,9 @@ export function useDesignSystemTheme(): DesignSystemThemeInterface {
49
49
  export type DesignSystemHocProps = { designSystemThemeApi: DesignSystemThemeInterface };
50
50
 
51
51
  // This is a simple typed HOC wrapper around the useDesignSystemTheme hook, for use in older react components.
52
- export function WithDesignSystemThemeHoc<P>(Component: React.ComponentType<P & DesignSystemHocProps>) {
52
+ export function WithDesignSystemThemeHoc<P>(
53
+ Component: React.ComponentType<React.PropsWithChildren<P & DesignSystemHocProps>>,
54
+ ) {
53
55
  return function WrappedWithDesignSystemTheme(props: P): ReactElement {
54
56
  const themeValues = useDesignSystemTheme();
55
57
 
@@ -25,13 +25,15 @@ export interface HoverCardProps
25
25
  content: React.ReactNode;
26
26
  minWidth?: CSSObject['minWidth'];
27
27
  maxWidth?: CSSObject['maxWidth'];
28
+ backgroundColor?: CSSObject['backgroundColor'];
29
+ withArrow?: boolean;
28
30
  }
29
31
  /**
30
32
  * The HoverCard component combines Radix's HoverCard primitives into a single, easy-to-use component.
31
33
  * It handles the setup of the trigger, content, and arrow elements, as well as applying custom styles
32
34
  * using Emotion CSS
33
35
  */
34
- export const HoverCard: React.FC<HoverCardProps> = ({
36
+ export const HoverCard: React.FC<React.PropsWithChildren<HoverCardProps>> = ({
35
37
  trigger,
36
38
  content,
37
39
  side = 'top',
@@ -39,18 +41,20 @@ export const HoverCard: React.FC<HoverCardProps> = ({
39
41
  align = 'center',
40
42
  minWidth = 220,
41
43
  maxWidth,
44
+ backgroundColor,
45
+ withArrow = true,
42
46
  ...props
43
47
  }) => {
44
48
  const { getPopupContainer } = useDesignSystemContext();
45
49
  const { useNewBorderColors } = useDesignSystemSafexFlags();
46
- const hoverCardStyles = useHoverCardStyles({ minWidth, maxWidth, useNewBorderColors });
50
+ const hoverCardStyles = useHoverCardStyles({ minWidth, maxWidth, useNewBorderColors, backgroundColor });
47
51
  return (
48
52
  <RadixHoverCard.Root {...props}>
49
53
  <RadixHoverCard.Trigger asChild>{trigger}</RadixHoverCard.Trigger>
50
54
  <RadixHoverCard.Portal container={getPopupContainer && getPopupContainer()}>
51
55
  <RadixHoverCard.Content side={side} sideOffset={sideOffset} align={align} css={hoverCardStyles['content']}>
52
56
  {content}
53
- <RadixHoverCard.Arrow css={hoverCardStyles['arrow']} />
57
+ {withArrow && <RadixHoverCard.Arrow css={hoverCardStyles['arrow']} />}
54
58
  </RadixHoverCard.Content>
55
59
  </RadixHoverCard.Portal>
56
60
  </RadixHoverCard.Root>
@@ -81,17 +85,19 @@ const useHoverCardStyles = ({
81
85
  minWidth,
82
86
  maxWidth,
83
87
  useNewBorderColors,
88
+ backgroundColor,
84
89
  }: {
85
90
  minWidth?: CSSObject['minWidth'];
86
91
  maxWidth?: CSSObject['maxWidth'];
87
92
  useNewBorderColors: boolean;
93
+ backgroundColor?: CSSObject['backgroundColor'];
88
94
  }): Record<string, CSSObject> => {
89
95
  const { theme } = useDesignSystemTheme();
90
96
  const { useNewShadows } = useDesignSystemSafexFlags();
91
97
 
92
98
  return {
93
99
  content: {
94
- backgroundColor: theme.colors.backgroundPrimary,
100
+ backgroundColor: backgroundColor ?? theme.colors.backgroundPrimary,
95
101
  color: theme.colors.textPrimary,
96
102
  lineHeight: theme.typography.lineHeightBase,
97
103
  border: `1px solid ${useNewBorderColors ? theme.colors.border : theme.colors.borderDecorative}`,
@@ -118,7 +124,7 @@ const useHoverCardStyles = ({
118
124
  },
119
125
  },
120
126
  arrow: {
121
- fill: theme.colors.backgroundPrimary,
127
+ fill: backgroundColor ?? theme.colors.backgroundPrimary,
122
128
  height: CONSTANTS.arrowHeight,
123
129
  stroke: theme.colors.borderDecorative,
124
130
  strokeDashoffset: -CONSTANTS.arrowBottomLength(),
@@ -25,11 +25,11 @@ export interface IconProps
25
25
  const getIconVariantStyles = (theme: Theme, color?: IconColors) => {
26
26
  switch (color) {
27
27
  case 'success':
28
- return { color: theme.colors.textValidationSuccess };
28
+ return { color: `${theme.colors.textValidationSuccess} !important` };
29
29
  case 'warning':
30
- return { color: theme.colors.textValidationWarning };
30
+ return { color: `${theme.colors.textValidationWarning} !important` };
31
31
  case 'danger':
32
- return { color: theme.colors.textValidationDanger };
32
+ return { color: `${theme.colors.textValidationDanger} !important` };
33
33
  case 'ai':
34
34
  return {
35
35
  'svg *': {
@@ -37,7 +37,7 @@ const getIconVariantStyles = (theme: Theme, color?: IconColors) => {
37
37
  },
38
38
  };
39
39
  default:
40
- return { color: color };
40
+ return color ? { color: `${color} !important` } : {};
41
41
  }
42
42
  };
43
43
 
@@ -4,21 +4,20 @@ import type { Ref } from 'react';
4
4
 
5
5
  import type { IconProps } from '../../Icon';
6
6
  import { Icon } from '../../Icon';
7
- function SvgInfoIcon(props: React.SVGProps<SVGSVGElement>) {
7
+ function SvgRowsIcon(props: React.SVGProps<SVGSVGElement>) {
8
8
  return (
9
9
  <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 16 16" {...props}>
10
- <path fill="currentColor" d="M7.25 10.5v-3h1.5v3zM8 5a.75.75 0 1 1 0 1.5A.75.75 0 0 1 8 5" />
11
10
  <path
12
11
  fill="currentColor"
13
12
  fillRule="evenodd"
14
- d="M8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12m0-1.5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9"
13
+ d="M14.25 1a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75H1.75a.75.75 0 0 1-.75-.75V1.75A.75.75 0 0 1 1.75 1zM2.5 2.5h11V5h-11zm0 4v3h11v-3zm11 4.5h-11v2.5h11z"
15
14
  clipRule="evenodd"
16
15
  />
17
16
  </svg>
18
17
  );
19
18
  }
20
- const InfoIcon = forwardRef((props: IconProps, forwardedRef?: Ref<HTMLSpanElement>) => {
21
- return <Icon ref={forwardedRef} {...props} component={SvgInfoIcon} />;
19
+ const RowsIcon = forwardRef((props: IconProps, forwardedRef?: Ref<HTMLSpanElement>) => {
20
+ return <Icon ref={forwardedRef} {...props} component={SvgRowsIcon} />;
22
21
  });
23
- InfoIcon.displayName = 'InfoIcon';
24
- export default InfoIcon;
22
+ RowsIcon.displayName = 'RowsIcon';
23
+ export default RowsIcon;
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import { forwardRef } from 'react';
3
+ import type { Ref } from 'react';
4
+
5
+ import type { IconProps } from '../../Icon';
6
+ import { Icon } from '../../Icon';
7
+ function SvgTokenIcon(props: React.SVGProps<SVGSVGElement>) {
8
+ return (
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 12 12" {...props}>
10
+ <mask id="TokenIcon_svg__a" fill="#fff">
11
+ <path d="M5.596 10.799a5 5 0 1 0 .082-9.621l.258.94a4.025 4.025 0 1 1-.066 7.745z" />
12
+ </mask>
13
+ <path
14
+ stroke="currentColor"
15
+ strokeWidth={2}
16
+ d="M5.596 10.799a5 5 0 1 0 .082-9.621l.258.94a4.025 4.025 0 1 1-.066 7.745z"
17
+ mask="url(#TokenIcon_svg__a)"
18
+ />
19
+ <circle cx={5} cy={6} r={4.5} stroke="currentColor" />
20
+ <circle cx={5} cy={6} r={1.5} stroke="currentColor" />
21
+ </svg>
22
+ );
23
+ }
24
+ const TokenIcon = forwardRef((props: IconProps, forwardedRef?: Ref<HTMLSpanElement>) => {
25
+ return <Icon ref={forwardedRef} {...props} component={SvgTokenIcon} />;
26
+ });
27
+ TokenIcon.displayName = 'TokenIcon';
28
+ export default TokenIcon;
@@ -0,0 +1,23 @@
1
+ import * as React from 'react';
2
+ import { forwardRef } from 'react';
3
+ import type { Ref } from 'react';
4
+
5
+ import type { IconProps } from '../../Icon';
6
+ import { Icon } from '../../Icon';
7
+ function SvgTrendingIcon(props: React.SVGProps<SVGSVGElement>) {
8
+ return (
9
+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" fill="none" viewBox="0 0 16 16" {...props}>
10
+ <path
11
+ fill="currentColor"
12
+ fillRule="evenodd"
13
+ d="M6.332.14a.99.99 0 0 1 .98-.018c4.417 2.052 6.918 6.313 6.764 9.876-.066 1.497-.602 2.883-1.64 3.895-1.04 1.012-2.531 1.604-4.42 1.607a5.745 5.745 0 0 1-6.097-5.504v-.008a4.85 4.85 0 0 1 2.495-4.366.554.554 0 0 1 .776.261c.27.613.648 1.17 1.115 1.646.547-.714.8-1.637.792-2.652-.009-1.208-.388-2.502-1.024-3.605A.84.84 0 0 1 6.333.14"
14
+ clipRule="evenodd"
15
+ />
16
+ </svg>
17
+ );
18
+ }
19
+ const TrendingIcon = forwardRef((props: IconProps, forwardedRef?: Ref<HTMLSpanElement>) => {
20
+ return <Icon ref={forwardedRef} {...props} component={SvgTrendingIcon} />;
21
+ });
22
+ TrendingIcon.displayName = 'TrendingIcon';
23
+ export default TrendingIcon;
@@ -186,7 +186,6 @@ export { default as IndentIncreaseIcon } from './IndentIncreaseIcon';
186
186
  export { default as InfinityIcon } from './InfinityIcon';
187
187
  export { default as InfoBookIcon } from './InfoBookIcon';
188
188
  export { default as InfoFillIcon } from './InfoFillIcon';
189
- export { default as InfoIcon } from './InfoIcon';
190
189
  export { default as InfoSmallIcon } from './InfoSmallIcon';
191
190
  export { default as IngestionIcon } from './IngestionIcon';
192
191
  export { default as ItalicIcon } from './ItalicIcon';
@@ -276,6 +275,7 @@ export { default as ResizeIcon } from './ResizeIcon';
276
275
  export { default as RichTextIcon } from './RichTextIcon';
277
276
  export { default as RobotIcon } from './RobotIcon';
278
277
  export { default as RocketIcon } from './RocketIcon';
278
+ export { default as RowsIcon } from './RowsIcon';
279
279
  export { default as RunningIcon } from './RunningIcon';
280
280
  export { default as SaveClockIcon } from './SaveClockIcon';
281
281
  export { default as SaveIcon } from './SaveIcon';
@@ -338,8 +338,10 @@ export { default as TextIcon } from './TextIcon';
338
338
  export { default as TextUnderlineIcon } from './TextUnderlineIcon';
339
339
  export { default as ThumbsDownIcon } from './ThumbsDownIcon';
340
340
  export { default as ThumbsUpIcon } from './ThumbsUpIcon';
341
+ export { default as TokenIcon } from './TokenIcon';
341
342
  export { default as TrashIcon } from './TrashIcon';
342
343
  export { default as TreeIcon } from './TreeIcon';
344
+ export { default as TrendingIcon } from './TrendingIcon';
343
345
  export { default as TriangleIcon } from './TriangleIcon';
344
346
  export { default as UnderlineIcon } from './UnderlineIcon';
345
347
  export { default as UndoIcon } from './UndoIcon';