@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
@@ -9,7 +9,11 @@ export interface CountBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
9
9
  disabled?: boolean;
10
10
  }
11
11
 
12
- export const CountBadge: React.FC<CountBadgeProps> = ({ countStartAt, totalCount, disabled }: CountBadgeProps) => {
12
+ export const CountBadge: React.FC<React.PropsWithChildren<CountBadgeProps>> = ({
13
+ countStartAt,
14
+ totalCount,
15
+ disabled,
16
+ }: CountBadgeProps) => {
13
17
  const { theme } = useDesignSystemTheme();
14
18
  return (
15
19
  <div
@@ -11,7 +11,7 @@ export interface TypeaheadComboboxControlsProps {
11
11
  disabled?: boolean;
12
12
  }
13
13
 
14
- export const TypeaheadComboboxControls: React.FC<any> = ({
14
+ export const TypeaheadComboboxControls: React.FC<React.PropsWithChildren<any>> = ({
15
15
  getDownshiftToggleButtonProps,
16
16
  showClearSelectionButton,
17
17
  showComboboxToggleButton = true,
@@ -15,7 +15,7 @@ export interface TypeaheadComboboxRootProps<T> extends React.HTMLAttributes<HTML
15
15
  children: React.ReactNode;
16
16
  }
17
17
 
18
- export const TypeaheadComboboxRoot: React.FC<TypeaheadComboboxRootProps<any>> = forwardRef<
18
+ export const TypeaheadComboboxRoot: React.FC<React.PropsWithChildren<TypeaheadComboboxRootProps<any>>> = forwardRef<
19
19
  HTMLDivElement,
20
20
  TypeaheadComboboxRootProps<any>
21
21
  >(({ comboboxState, multiSelect = false, children, ...props }, ref) => {
@@ -65,7 +65,7 @@ const getXIconStyles = (theme: Theme): SerializedStyles => {
65
65
  });
66
66
  };
67
67
 
68
- export const TypeaheadComboboxSelectedItem: React.FC<any> = forwardRef<
68
+ export const TypeaheadComboboxSelectedItem: React.FC<React.PropsWithChildren<any>> = forwardRef<
69
69
  HTMLSpanElement,
70
70
  TypeaheadComboboxSelectedItemProps<unknown>
71
71
  >(({ label, item, getSelectedItemProps, removeSelectedItem, disabled, ...restProps }, ref) => {
@@ -29,7 +29,7 @@ import { useComboboxState, useMultipleSelectionState } from '../hooks';
29
29
 
30
30
  describe('Typeahead Combobox', () => {
31
31
  test('TypeaheadComboboxMenu throws error if not inside TypeaheadComboboxRoot', () => {
32
- const TypeaheadComboboxMenuExample: React.FC = () => {
32
+ const TypeaheadComboboxMenuExample: React.FC<React.PropsWithChildren<unknown>> = () => {
33
33
  const [items, setItems] = React.useState<Book[]>(books);
34
34
 
35
35
  const comboboxState = useComboboxState<Book>({
@@ -63,7 +63,7 @@ describe('Typeahead Combobox', () => {
63
63
  });
64
64
 
65
65
  test('TypeaheadComboboxInput throws error if not inside TypeaheadComboboxRoot', () => {
66
- const TypeaheadComboboxInputExample: React.FC = () => {
66
+ const TypeaheadComboboxInputExample: React.FC<React.PropsWithChildren<unknown>> = () => {
67
67
  const [items, setItems] = React.useState<Book[]>(books);
68
68
 
69
69
  const comboboxState = useComboboxState<Book>({
@@ -84,7 +84,7 @@ describe('Typeahead Combobox', () => {
84
84
  });
85
85
 
86
86
  test('TypeaheadComboboxMultiSelectInput throws error if not inside TypeaheadComboboxRoot', () => {
87
- const TypeaheadComboboxMultiSelectInputExample: React.FC = () => {
87
+ const TypeaheadComboboxMultiSelectInputExample: React.FC<React.PropsWithChildren<unknown>> = () => {
88
88
  const [inputValue, setInputValue] = React.useState('');
89
89
  const [selectedItems, setSelectedItems] = React.useState<Book[]>([books[0], books[1]]);
90
90
  const items = React.useMemo(() => getFilteredBooks(inputValue), [inputValue]);
@@ -79,7 +79,7 @@ export const renderSingleSelectTypeahead = ({
79
79
  initialInputValue,
80
80
  selectInputProps = {},
81
81
  }: renderSingleSelectTypeaheadProps = {}) => {
82
- const SingleSelectTypeahead: React.FC = () => {
82
+ const SingleSelectTypeahead: React.FC<React.PropsWithChildren<unknown>> = () => {
83
83
  const [items, setItems] = React.useState<Book[]>(books);
84
84
 
85
85
  const comboboxState = useComboboxState<Book>({
@@ -121,7 +121,7 @@ export const renderMultiSelectTypeahead = ({
121
121
  preSelectedItems = [],
122
122
  multiSelectInputProps = {},
123
123
  }: renderMultiSelectTypeaheadProps = {}) => {
124
- const MultiSelectTypeahead: React.FC = () => {
124
+ const MultiSelectTypeahead: React.FC<React.PropsWithChildren<unknown>> = () => {
125
125
  const [inputValue, setInputValue] = React.useState('');
126
126
  const [selectedItems, setSelectedItems] = React.useState<Book[]>(preSelectedItems);
127
127
  const items = React.useMemo(() => getFilteredBooks(inputValue), [inputValue]);
@@ -178,7 +178,7 @@ export const renderSingleSelectTypeaheadWithLabel = ({
178
178
  initialInputValue,
179
179
  selectInputProps = {},
180
180
  }: renderSingleSelectTypeaheadProps = {}) => {
181
- const SingleSelectTypeahead: React.FC = () => {
181
+ const SingleSelectTypeahead: React.FC<React.PropsWithChildren<unknown>> = () => {
182
182
  const [items, setItems] = React.useState<Book[]>(books);
183
183
 
184
184
  const comboboxState = useComboboxState<Book>({
@@ -1,6 +1,6 @@
1
1
  import type { CSSObject } from '@emotion/react';
2
2
  import unitless from '@emotion/unitless';
3
- import _, { memoize } from 'lodash';
3
+ import { memoize, endsWith, isBoolean, isNil, isNumber, isString, mapValues } from 'lodash';
4
4
  import type { CSSProperties } from 'react';
5
5
  import type { VirtualItem } from 'react-virtual';
6
6
 
@@ -15,14 +15,14 @@ import type { TypographyColor, ValidationState } from '../types';
15
15
  * Used to ensure that we always override Ant styles, without worrying about selector precedence.
16
16
  */
17
17
  export function importantify(obj: CSSObject): CSSObject {
18
- return _.mapValues(obj, (value, key) => {
19
- if (_.isString(value) || _.isNumber(value) || _.isBoolean(value)) {
18
+ return mapValues(obj, (value, key) => {
19
+ if (isString(value) || isNumber(value) || isBoolean(value)) {
20
20
  // Make sure we don't double-append important
21
- if (_.isString(value) && _.endsWith(value, '!important')) {
21
+ if (isString(value) && endsWith(value, '!important')) {
22
22
  return value;
23
23
  }
24
24
 
25
- if (_.isNumber(value)) {
25
+ if (isNumber(value)) {
26
26
  if (unitless[key]) {
27
27
  return `${value}!important`;
28
28
  }
@@ -32,7 +32,7 @@ export function importantify(obj: CSSObject): CSSObject {
32
32
  return `${value}!important`;
33
33
  }
34
34
 
35
- if (_.isNil(value)) {
35
+ if (isNil(value)) {
36
36
  return value;
37
37
  }
38
38
 
@@ -8,7 +8,7 @@ import ReactShadowRoot from 'react-shadow-root';
8
8
  import { ApplyDesignSystemFlags, DesignSystemProvider } from '../DesignSystemProvider';
9
9
  import { useDesignSystemFlags } from '../Hooks';
10
10
 
11
- export const ShadowDomWrapper: React.FC = ({ children }) => {
11
+ export const ShadowDomWrapper: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => {
12
12
  const popupContainer = useRef<HTMLDivElement>(null);
13
13
  const stylesContainer = useRef<HTMLDivElement>(null);
14
14
  const [loaded, setLoaded] = useState(false);
@@ -280,7 +280,7 @@ const levelToIconMap: { [key in BannerLevel]: ReactNode } = {
280
280
  error: <DangerIcon data-testid="level-error-icon" />,
281
281
  };
282
282
 
283
- export const Banner: React.FC<BannerProps> = (props) => {
283
+ export const Banner: React.FC<React.PropsWithChildren<BannerProps>> = (props) => {
284
284
  const {
285
285
  level,
286
286
  message,
@@ -79,6 +79,7 @@ export const Root = React.forwardRef<HTMLDivElement, RootProps>(
79
79
  );
80
80
  interface ItemProps extends Pick<RadioGroupItemProps, 'children' | 'value' | 'disabled' | 'required'> {
81
81
  icon?: React.ReactNode;
82
+ className?: string;
82
83
  }
83
84
  export const Item = React.forwardRef<HTMLButtonElement, ItemProps>(({ children, icon, ...props }, forwardedRef) => {
84
85
  const size = React.useContext(RadioGroupContext);
@@ -117,7 +117,7 @@ function useRenderExampleCell() {
117
117
  return { renderCell };
118
118
  }
119
119
 
120
- const DefaultTreeGridExample: React.FC<Partial<TreeGridProps>> = (props) => {
120
+ const DefaultTreeGridExample: React.FC<React.PropsWithChildren<Partial<TreeGridProps>>> = (props) => {
121
121
  const { renderCell } = useRenderExampleCell();
122
122
 
123
123
  return (
@@ -127,7 +127,7 @@ const DefaultTreeGridExample: React.FC<Partial<TreeGridProps>> = (props) => {
127
127
  );
128
128
  };
129
129
 
130
- const CustomTreeGridStateExample: React.FC<Partial<TreeGridProps>> = (props) => {
130
+ const CustomTreeGridStateExample: React.FC<React.PropsWithChildren<Partial<TreeGridProps>>> = (props) => {
131
131
  const { renderCell } = useRenderExampleCell();
132
132
  const [activeRowId, setActiveRowId] = useState<TreeGridRowId | null>(null);
133
133
  const [expandedRows, setExpandedRows] = useState<Record<TreeGridRowId, boolean>>({});
@@ -93,7 +93,7 @@ const findNextFocusableCellIndexInRow = (
93
93
  return -1;
94
94
  };
95
95
 
96
- export const TreeGrid: React.FC<TreeGridProps> = ({
96
+ export const TreeGrid: React.FC<React.PropsWithChildren<TreeGridProps>> = ({
97
97
  data,
98
98
  columns,
99
99
  renderCell,
@@ -1,6 +1,6 @@
1
1
  // @ts-expect-error antd/dist/theme isn't typed
2
2
  import { getThemeVariables } from 'antd/dist/theme';
3
- import _ from 'lodash';
3
+ import { kebabCase, mapKeys } from 'lodash';
4
4
 
5
5
  import { getAntdColors } from './colors';
6
6
  import generalVariables from './generalVariables';
@@ -16,10 +16,10 @@ export function getLessVariables(isDarkMode: boolean): Record<string, any> {
16
16
  ...(isDarkMode ? getThemeVariables({ dark: true }) : {}),
17
17
  // We store our tokens as objects with camelCase keys for JS compatibility. Here we convert them to kebab-case for
18
18
  // LESS compatibility.
19
- ..._.mapKeys(getAntdColors(isDarkMode), (_value, key) => _.kebabCase(key)),
20
- ..._.mapKeys(antdSpacing, (_value, key) => _.kebabCase(key)),
21
- ..._.mapKeys(typography, (_value, key) => _.kebabCase(key)),
22
- ..._.mapKeys(generalVariables, (_value, key) => _.kebabCase(key)),
19
+ ...mapKeys(getAntdColors(isDarkMode), (_value, key) => kebabCase(key)),
20
+ ...mapKeys(antdSpacing, (_value, key) => kebabCase(key)),
21
+ ...mapKeys(typography, (_value, key) => kebabCase(key)),
22
+ ...mapKeys(generalVariables, (_value, key) => kebabCase(key)),
23
23
  };
24
24
  }
25
25
 
@@ -51,7 +51,9 @@ export function VerticalWizardContent({
51
51
  });
52
52
 
53
53
  return (
54
- <Wrapper initialContentId={verticalDocumentationSidebarConfig?.initialContentId}>
54
+ <Wrapper
55
+ {...(displayDocumentationSideBar && { initialContentId: verticalDocumentationSidebarConfig?.initialContentId })}
56
+ >
55
57
  <div
56
58
  css={{
57
59
  width,
@@ -1,5 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M7.25 10.5V7.5H8.75V10.5H7.25Z" fill="#5F7281"/>
3
- <path d="M8 5C8.41421 5 8.75 5.33579 8.75 5.75C8.75 6.16421 8.41421 6.5 8 6.5C7.58579 6.5 7.25 6.16421 7.25 5.75C7.25 5.33579 7.58579 5 8 5Z" fill="#5F7281"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M8 14C11.3137 14 14 11.3137 14 8C14 4.68629 11.3137 2 8 2C4.68629 2 2 4.68629 2 8C2 11.3137 4.68629 14 8 14ZM8 12.5C10.4853 12.5 12.5 10.4853 12.5 8C12.5 5.51472 10.4853 3.5 8 3.5C5.51472 3.5 3.5 5.51472 3.5 8C3.5 10.4853 5.51472 12.5 8 12.5Z" fill="#5F7281"/>
5
- </svg>