@czi-sds/components 24.0.0 → 24.2.0

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # `@czi-sds/components`
2
2
 
3
- React component library for the [Science Design System (SDS)](https://sds.czi.design/). Built on **Material UI v9**.
3
+ React component library for the [Science Design System (SDS)](https://chanzuckerberg.github.io/sci-components/). Built on **Material UI v9**.
4
4
 
5
5
  Full documentation (usage, theming, scripts, contributing) lives in the [repository README](https://github.com/chanzuckerberg/sci-components#readme).
6
6
 
@@ -36,7 +36,7 @@ SDS `24.0.0` is a **breaking release** that moves the Material UI peer dependenc
36
36
 
37
37
  ## Links
38
38
 
39
- - [Design docs (Zeroheight)](https://sds.czi.design/)
39
+ - [Design system documentation](https://chanzuckerberg.github.io/sci-components/)
40
40
  - [Full repo docs](https://github.com/chanzuckerberg/sci-components#readme)
41
41
  - [npm package](https://www.npmjs.com/package/@czi-sds/components)
42
42
  - [Material UI API docs](https://mui.com/)
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AccordionDetailsProps, AccordionProps as AccordionProps$1, AccordionSummaryProps, AlertProps, AppBarProps, AutocompleteChangeDetails, AutocompleteChangeReason, AutocompleteCloseReason, AutocompleteInputChangeReason, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, AutocompleteValue, ButtonGroupProps as ButtonGroupProps$1, ButtonProps as ButtonProps$1, CardMedia, CardMediaProps, CardProps, CheckboxProps as CheckboxProps$1, ChipProps as ChipProps$1, ClickAwayListenerProps, DialogActionsProps as DialogActionsProps$1, DialogContentProps as DialogContentProps$1, DialogProps as DialogProps$1, DialogTitleProps as DialogTitleProps$1, DrawerProps, IconButtonProps as IconButtonProps$1, LinkProps as LinkProps$1, ListItemProps as ListItemProps$1, ListProps as ListProps$1, ListSubheaderProps as ListSubheaderProps$1, MenuItemProps as MenuItemProps$1, MenuProps as MenuProps$1, PaletteMode, PaperProps, PopoverProps as PopoverProps$1, PopperProps, RadioProps as RadioProps$1, SliderProps, SwitchProps, TabProps as TabProps$1, TabsProps as TabsProps$1, TextFieldProps, ToggleButtonGroupProps, TooltipProps as TooltipProps$1 } from "@mui/material";
2
+ import { AccordionDetailsProps, AccordionProps as AccordionProps$1, AccordionSummaryProps, AlertProps, AppBarProps, AutocompleteChangeDetails, AutocompleteChangeReason, AutocompleteCloseReason, AutocompleteInputChangeReason, AutocompleteProps as AutocompleteProps$1, AutocompleteRenderInputParams, AutocompleteValue, ButtonGroupProps as ButtonGroupProps$1, ButtonProps as ButtonProps$1, CardMedia, CardMediaProps, CardProps, CheckboxProps as CheckboxProps$1, ChipProps as ChipProps$1, ClickAwayListenerProps, DialogActionsProps as DialogActionsProps$1, DialogContentProps as DialogContentProps$1, DialogProps as DialogProps$1, DialogTitleProps as DialogTitleProps$1, DrawerProps, IconButtonProps as IconButtonProps$1, LinkProps as LinkProps$1, ListItemProps as ListItemProps$1, ListProps as ListProps$1, ListSubheaderProps as ListSubheaderProps$1, MenuItemProps as MenuItemProps$1, MenuProps as MenuProps$1, PaletteMode, PaperProps, PopoverProps as PopoverProps$1, PopperProps, RadioProps as RadioProps$1, SlideProps, SliderProps, SwitchProps, TabProps as TabProps$1, TabsProps as TabsProps$1, TextFieldProps, ToggleButtonGroupProps, TooltipProps as TooltipProps$1 } from "@mui/material";
3
3
  import React$1, { CSSProperties, ComponentType, ElementType, HTMLAttributeAnchorTarget, HTMLAttributes, ReactElement, ReactNode, SyntheticEvent } from "react";
4
4
  import { Breakpoints, PaletteOptions, Theme as Theme$1, ThemeOptions, TypographyStyle } from "@mui/material/styles";
5
5
  import { SerializedStyles } from "@emotion/react";
@@ -66,6 +66,7 @@ interface BaseColor {
66
66
  surfaceSecondary: string;
67
67
  surfacePrimaryDark: string;
68
68
  surfaceInverse: string;
69
+ surfaceTertiary: string;
69
70
  textPrimary: string;
70
71
  textPrimaryOnDark: string;
71
72
  textPrimaryInverse: string;
@@ -112,6 +113,7 @@ interface BaseColor {
112
113
  borderPrimaryDisabledOnDark: string;
113
114
  borderPrimaryDisabledInverse: string;
114
115
  borderSecondaryOnDark: string;
116
+ borderHighlight: string;
115
117
  ornamentDisabled: string;
116
118
  ornamentDisabledOnDark: string;
117
119
  ornamentDisabledInverse: string;
@@ -121,6 +123,7 @@ interface BaseColor {
121
123
  ornamentPrimaryInverse: string;
122
124
  ornamentSecondary: string;
123
125
  ornamentSecondaryOnDark: string;
126
+ ornamentTertiary: string;
124
127
  ornamentSecondaryInverse: string;
125
128
  ornamentSecondaryInteraction: string;
126
129
  ornamentSecondaryInteractionOnDark: string;
@@ -922,6 +925,19 @@ interface SdsIconWithColor {
922
925
  type IconProps<IconName extends keyof IconNameToSizes> = IconExtraProps<IconName> & SdsIconWithColor;
923
926
  /**
924
927
  * @see https://mui.com/material-ui/icons/#icons
928
+ *
929
+ * @deprecated
930
+ * This component is deprecated and will be removed in a future major version.
931
+ * SDS icons come from Phosphor now: import the icon you need from
932
+ * `@phosphor-icons/react`, or from `@czi-sds/icons` for the icons SDS draws
933
+ * itself. Both take the same props, so the only difference is the import.
934
+ *
935
+ * ```tsx
936
+ * // Before
937
+ * <Icon sdsIcon="InfoCircle" sdsSize="l" />
938
+ * // After
939
+ * <InfoIcon size={24} />
940
+ * ```
925
941
  */
926
942
  declare const Icon: import("react").ForwardRefExoticComponent<IconExtraProps<keyof IconNameToSizes> & SdsIconWithColor & import("react").RefAttributes<HTMLDivElement | null>>;
927
943
  //#endregion
@@ -1136,23 +1152,25 @@ declare const ButtonDropdown: React$1.ForwardRefExoticComponent<Omit<ButtonDropd
1136
1152
  //#region src/core/ButtonGroup/ButtonGroup.types.d.ts
1137
1153
  interface ButtonGroupProps extends Omit<ButtonGroupProps$1, "variant" | "size"> {
1138
1154
  /**
1139
- * The background appearance of the button group.
1155
+ * Tells the group which surface it sits on so it can pick colors with enough
1156
+ * contrast.
1140
1157
  * @default "matchBackground"
1141
1158
  */
1142
1159
  backgroundAppearance?: "dark" | "matchBackground";
1143
1160
  /**
1144
- * The style of the button group.
1161
+ * Style of the button group. Outline is the only value.
1145
1162
  * @default "outline"
1146
1163
  */
1147
1164
  sdsStyle?: "outline";
1148
1165
  /**
1149
- * The type of the button group that determines the color scheme.
1166
+ * Color scheme applied to every button in the group.
1150
1167
  * @default "primary"
1151
1168
  */
1152
1169
  sdsType?: "primary" | "secondary";
1153
1170
  /**
1154
- * The size of the button group.
1155
- * @default "medium"
1171
+ * Size of the group. It is injected into each Button and ButtonToggle child,
1172
+ * so setting size on an individual button has no effect.
1173
+ * @default "large"
1156
1174
  */
1157
1175
  size?: "small" | "medium" | "large";
1158
1176
  }
@@ -1205,6 +1223,10 @@ declare const ButtonIcon: import("react").ForwardRefExoticComponent<Omit<ButtonI
1205
1223
  //#endregion
1206
1224
  //#region src/core/ButtonToggle/ButtonToggle.types.d.ts
1207
1225
  interface ButtonToggleProps extends ButtonProps {
1226
+ /**
1227
+ * Required. The icon displayed within the component. Pass the SDS Icon
1228
+ * component, for example `<Icon sdsIcon="Search" sdsSize="s" />`.
1229
+ */
1208
1230
  startIcon: keyof IconNameToSizes | React.ReactElement<CustomSVGProps>;
1209
1231
  sdsStage?: "on" | "off";
1210
1232
  }
@@ -1318,6 +1340,10 @@ interface CalloutProps {
1318
1340
  hideTitle?: boolean;
1319
1341
  body?: React$1.ReactNode;
1320
1342
  hideBody?: boolean;
1343
+ /**
1344
+ * The same slot as `children`, for callers that would rather pass it as a
1345
+ * prop. Both render when both are given, `children` first.
1346
+ */
1321
1347
  extraContent?: React$1.ReactNode;
1322
1348
  sdsStyle?: CalloutSdsStyleType;
1323
1349
  }
@@ -1339,8 +1365,20 @@ declare const CalloutTitle: {
1339
1365
  interface TooltipExtraProps extends CommonThemeProps {
1340
1366
  arrowOffset?: number;
1341
1367
  followCursor?: boolean;
1368
+ /**
1369
+ * @deprecated Tooltips follow the theme mode and no longer have an inverted
1370
+ * style. This prop is ignored and will be removed in a future release.
1371
+ */
1342
1372
  inverted?: boolean;
1373
+ /**
1374
+ * @deprecated Tooltips follow the theme mode and no longer have an inverted
1375
+ * style. This prop is ignored and will be removed in a future release.
1376
+ */
1343
1377
  sdsStyle?: "dark" | "light";
1378
+ /**
1379
+ * @deprecated Tooltips follow the theme mode and no longer have an inverted
1380
+ * style. This prop is ignored and will be removed in a future release.
1381
+ */
1344
1382
  hasInvertedStyle?: boolean;
1345
1383
  title?: React.ReactNode;
1346
1384
  subtitle?: React.ReactNode;
@@ -1348,6 +1386,9 @@ interface TooltipExtraProps extends CommonThemeProps {
1348
1386
  textAlign?: "left" | "center" | "right";
1349
1387
  componentSlot?: React.ReactNode;
1350
1388
  /**
1389
+ * The popper the tooltip renders into, carrying the arrow's shape and
1390
+ * placement.
1391
+ *
1351
1392
  * (v9): MUI removed the Tooltip `PopperComponent` prop in favor of
1352
1393
  * `slots.popper`. We keep `PopperComponent` as an SDS prop for backward
1353
1394
  * compatibility and map it to `slots.popper` internally.
@@ -1565,7 +1606,19 @@ type InputDropdownProps$1 = InputDropdownProps$2 & {
1565
1606
  /**
1566
1607
  * @see https://mui.com/material-ui/react-button/
1567
1608
  */
1568
- declare const InputDropdown: (props: InputDropdownProps$1) => JSX.Element;
1609
+ declare const InputDropdown: import("react").ForwardRefExoticComponent<InputDropdownProps$2 & {
1610
+ classes?: {
1611
+ root?: string | undefined;
1612
+ label?: string | undefined;
1613
+ labelDetailsWrapper?: string | undefined;
1614
+ contentWrapper?: string | undefined;
1615
+ details?: string | undefined;
1616
+ counter?: string | undefined;
1617
+ iconWrapper?: string | undefined;
1618
+ chevronIcon?: string | undefined;
1619
+ minimalDetails?: string | undefined;
1620
+ } | undefined;
1621
+ } & import("react").RefAttributes<HTMLButtonElement>>;
1569
1622
  //#endregion
1570
1623
  //#region src/core/Dropdown/index.d.ts
1571
1624
  interface ExtraDropdownProps<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined> {
@@ -1618,6 +1671,10 @@ interface BaseContentCardProps extends CardProps {
1618
1671
  metadataText?: ReactNode;
1619
1672
  boundingBox?: boolean;
1620
1673
  decorativeBorder?: boolean;
1674
+ /**
1675
+ * The content to be displayed inside the card body, including custom
1676
+ * components and ContentCardActions.
1677
+ */
1621
1678
  children?: ReactNode;
1622
1679
  clickableCard?: boolean;
1623
1680
  clickableCardProps?: Partial<ButtonProps & {
@@ -1741,6 +1798,7 @@ declare const Dialog: React$1.ForwardRefExoticComponent<Omit<DialogProps, "ref">
1741
1798
  interface DialogActionsProps extends DialogActionsProps$1 {
1742
1799
  sdsSize?: DialogExtraProps["sdsSize"];
1743
1800
  buttonPosition?: "left" | "right";
1801
+ /** Class name for the actions row. */
1744
1802
  classes?: {
1745
1803
  root?: string;
1746
1804
  };
@@ -1784,6 +1842,7 @@ interface DialogTitleProps extends DialogTitleExtraProps, DialogTitleProps$1 {
1784
1842
  subtitle?: string;
1785
1843
  overline?: string;
1786
1844
  onClose?: () => void;
1845
+ /** Class names for the individual parts of the title block. */
1787
1846
  classes?: {
1788
1847
  root?: string;
1789
1848
  title?: string;
@@ -1844,6 +1903,11 @@ interface CheckboxContentProps extends Omit<CheckboxProps$1, "color" | "defaultC
1844
1903
  intent?: "default" | "negative" | "notice" | "positive";
1845
1904
  label?: React.ReactNode;
1846
1905
  stage?: "checked" | "unchecked" | "indeterminate";
1906
+ /**
1907
+ * Class names for the internal elements: root, labelCaptionContainer, label,
1908
+ * caption, checkbox, checkboxCheckedIcon, checkboxDefaultIcon, and
1909
+ * checkboxIndeterminateIcon.
1910
+ */
1847
1911
  classes?: {
1848
1912
  root?: string;
1849
1913
  labelCaptionContainer?: string;
@@ -1874,7 +1938,17 @@ interface RadioContentProps extends Omit<RadioProps$1, "color" | "defaultChecked
1874
1938
  label?: React$1.ReactNode;
1875
1939
  radioProps?: Partial<RadioProps$1>;
1876
1940
  stage?: "checked" | "unchecked";
1941
+ /**
1942
+ * The value a RadioGroup compares against to decide whether this radio is
1943
+ * selected. It also backs the label and caption element ids, so give every
1944
+ * radio a unique one.
1945
+ */
1877
1946
  value?: string;
1947
+ /**
1948
+ * Class names for the internal elements: root, labelCaptionContainer, label,
1949
+ * caption, radioButton, radioCheckedIcon, radioCheckedIconDot, and
1950
+ * radioDefaultIcon.
1951
+ */
1878
1952
  classes?: {
1879
1953
  root?: string;
1880
1954
  labelCaptionContainer?: string;
@@ -1931,6 +2005,11 @@ declare const InputText: import("react").ForwardRefExoticComponent<(Omit<import(
1931
2005
  //#region src/core/InputToggle/style.d.ts
1932
2006
  interface InputToggleExtraProps extends SwitchProps, CommonThemeProps {
1933
2007
  offLabel?: string;
2008
+ /**
2009
+ * Called whenever the user toggles the component, in either direction. It is
2010
+ * given the event alone: unlike MUI's, it is not passed the new checked
2011
+ * state, which is read from the event's target instead.
2012
+ */
1934
2013
  onChange?(e: React.ChangeEvent): void;
1935
2014
  onLabel?: string;
1936
2015
  width?: number;
@@ -1963,63 +2042,72 @@ declare const IntentMessage: (props: IntentMessageProps) => JSX.Element;
1963
2042
  //#region src/core/Legend/Legend.types.d.ts
1964
2043
  interface LegendItemData {
1965
2044
  /**
1966
- * Name/label for the legend item
2045
+ * The item's label, and the start of its accessible name. Names need not be
2046
+ * unique, since items are addressed by index.
1967
2047
  */
1968
2048
  name: string;
1969
2049
  /**
1970
- * Value to display (optional)
2050
+ * Shown after the name when `showValues` is on. Numbers are grouped by
2051
+ * locale; a string is printed as given, for a unit or a percentage.
1971
2052
  */
1972
2053
  value?: number | string;
1973
2054
  /**
1974
- * Color for the legend icon
1975
- * Can be overridden by the colors prop in LegendProps
1976
- * Falls back to gray if not provided
2055
+ * The swatch color. The `colors` palette takes priority over it, and without
2056
+ * either the swatch is the theme's grey.
1977
2057
  */
1978
2058
  color?: string;
1979
2059
  /**
1980
- * Disable the legend item (prevents all events)
2060
+ * Dims the item and stops it responding to hover or clicks.
1981
2061
  * @default false
1982
2062
  */
1983
2063
  disabled?: boolean;
1984
2064
  }
1985
2065
  interface LegendProps extends HTMLAttributes<HTMLDivElement> {
1986
2066
  /**
1987
- * Array of legend items to display
2067
+ * The items, drawn in order. Their indices are what selection, hover, and the
2068
+ * callbacks refer to.
1988
2069
  */
1989
2070
  items: LegendItemData[];
1990
2071
  /**
1991
- * Optional array of colors to assign to items. If not provided or if the array
1992
- * is shorter than items, will use the color from the item or fall back to gray.
2072
+ * A palette applied by index, taking priority over the color on an item.
2073
+ * Entries past the end of the array fall back to the item's color, then to
2074
+ * grey.
1993
2075
  */
1994
2076
  colors?: string[];
1995
2077
  /**
1996
- * Callback when mouse enters a legend item
2078
+ * Called when the pointer enters an item. The legend already dims its own
2079
+ * swatches, so this is for driving something outside it, such as a highlight
2080
+ * on the chart.
1997
2081
  */
1998
2082
  onItemMouseEnter?: (item: LegendItemData, index: number) => void;
1999
2083
  /**
2000
- * Callback when mouse leaves a legend item
2084
+ * Called when the pointer leaves an item.
2001
2085
  */
2002
2086
  onItemMouseLeave?: (item: LegendItemData, index: number) => void;
2003
2087
  /**
2004
- * Callback when a legend item is clicked
2088
+ * Fires on a click, alongside any selection change rather than instead of it.
2005
2089
  */
2006
2090
  onItemClick?: (item: LegendItemData, index: number) => void;
2007
2091
  /**
2008
- * Whether to show values in the legend
2092
+ * Draws each item's value beside its name. Items without a value are
2093
+ * unaffected.
2009
2094
  * @default false
2010
2095
  */
2011
2096
  showValues?: boolean;
2012
2097
  /**
2013
- * Array of selected item indices (controlled component)
2098
+ * Indices of the selected items. The legend is controlled: it draws this and
2099
+ * never changes it.
2014
2100
  */
2015
2101
  selectedIndices?: number[];
2016
2102
  /**
2017
- * Callback when selection changes
2018
- * @param selectedIndices Array of selected indices
2103
+ * Called with the next selection when an item is clicked, with that index
2104
+ * toggled. Without it, clicking selects nothing.
2019
2105
  */
2020
2106
  onSelectionChange?: (selectedIndices: number[]) => void;
2021
2107
  /**
2022
- * External control for hovered index (for bidirectional hover with charts)
2108
+ * Highlights an item from outside, for syncing with a chart. It adds to the
2109
+ * legend's own hover rather than replacing it, and `null` reads as no
2110
+ * external highlight.
2023
2111
  */
2024
2112
  hoveredIndex?: number | null;
2025
2113
  }
@@ -2145,6 +2233,10 @@ type ExtraTagProps = ExtraSmallTagProps | ExtraLargeTagProps;
2145
2233
  //#endregion
2146
2234
  //#region src/core/Tag/index.d.ts
2147
2235
  interface SdsTagProps extends Omit<ChipProps$1, "color"> {
2236
+ /**
2237
+ * The tag's text, and its accessible name. It is cut off with an ellipsis
2238
+ * rather than wrapped, so keep it to a word or two.
2239
+ */
2148
2240
  label: string;
2149
2241
  color?: SdsTagColorType;
2150
2242
  }
@@ -2430,6 +2522,21 @@ interface PanelHeaderCloseProps {
2430
2522
  }
2431
2523
  //#endregion
2432
2524
  //#region src/core/Panel/Panel.types.d.ts
2525
+ /**
2526
+ * An overlay Panel slides in on MUI's `Slide`, which takes a `container` to
2527
+ * measure that slide against. MUI types the transition slot against the generic
2528
+ * transition interface, which knows nothing of it, and leaves this interface
2529
+ * open for the component that does — so the prop is declared here.
2530
+ *
2531
+ * A Panel rendered into a box rather than the page needs it. Without one the
2532
+ * slide is measured against the window and the panel spends most of its
2533
+ * animation outside the frame it was given.
2534
+ */
2535
+ declare module "@mui/material/Drawer" {
2536
+ interface DrawerTransitionSlotPropsOverrides {
2537
+ container?: SlideProps["container"];
2538
+ }
2539
+ }
2433
2540
  interface BasicPanelProps extends Omit<DrawerProps, "variant"> {
2434
2541
  sdsType: "basic";
2435
2542
  position?: "left" | "right";
@@ -2582,7 +2689,13 @@ declare const Tab: React$1.ForwardRefExoticComponent<Omit<TabProps, "ref"> & Rea
2582
2689
  //#endregion
2583
2690
  //#region src/core/TagFilter/index.d.ts
2584
2691
  interface SdsTagFilterProps extends Omit<ChipProps$1, "color" | "variant"> {
2692
+ /** The filter's text. Cut off with an ellipsis when there is not room for it. */
2585
2693
  label: string;
2694
+ /**
2695
+ * Runs when the X is clicked or activated, and when Backspace or Delete is
2696
+ * pressed on the tag. Drop the filter from your state here; the component
2697
+ * does not remove itself.
2698
+ */
2586
2699
  onDelete: React$1.EventHandler<any>;
2587
2700
  }
2588
2701
  type TagFilterProps = SdsTagFilterProps;