@wistia/ui 0.18.17 → 0.18.18-beta.5671ee8e.fdf9f16

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/dist/index.d.mts CHANGED
@@ -1723,20 +1723,28 @@ type DataCardsProps = ComponentPropsWithoutRef<'div'> & {
1723
1723
  * Should be at least one `DataCard` component
1724
1724
  */
1725
1725
  children: ReactNode;
1726
+ /**
1727
+ * String to pass to the `min-width` property of its children. [View the syntax on MDN →](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width#syntax)
1728
+ */
1729
+ cardMinWidth?: ResponsiveObject<string> | string;
1726
1730
  /**
1727
1731
  * String to pass to the `max-width` property of its children. [View the syntax on MDN →](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width#syntax)
1728
1732
  */
1729
- cardMaxWidth?: string;
1733
+ cardMaxWidth?: ResponsiveObject<string> | string;
1730
1734
  /**
1731
1735
  * Sets the color scheme of the cards, can be overriden at the card level
1732
1736
  */
1733
1737
  colorScheme?: ColorSchemeTypes;
1738
+ /**
1739
+ * Desired number of columns to display.
1740
+ */
1741
+ columns?: ResponsiveObject<number | 'auto'> | number | 'auto';
1734
1742
  };
1735
1743
  /**
1736
1744
  * Displays a series of cards tailor made for displaying analytics data
1737
1745
  */
1738
1746
  declare const DataCards: {
1739
- ({ children, cardMaxWidth, colorScheme, ...props }: DataCardsProps): JSX.Element;
1747
+ ({ children, cardMinWidth, cardMaxWidth, colorScheme, columns, ...props }: DataCardsProps): JSX.Element;
1740
1748
  displayName: string;
1741
1749
  };
1742
1750
 
package/dist/index.d.ts CHANGED
@@ -1723,20 +1723,28 @@ type DataCardsProps = ComponentPropsWithoutRef<'div'> & {
1723
1723
  * Should be at least one `DataCard` component
1724
1724
  */
1725
1725
  children: ReactNode;
1726
+ /**
1727
+ * String to pass to the `min-width` property of its children. [View the syntax on MDN →](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width#syntax)
1728
+ */
1729
+ cardMinWidth?: ResponsiveObject<string> | string;
1726
1730
  /**
1727
1731
  * String to pass to the `max-width` property of its children. [View the syntax on MDN →](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width#syntax)
1728
1732
  */
1729
- cardMaxWidth?: string;
1733
+ cardMaxWidth?: ResponsiveObject<string> | string;
1730
1734
  /**
1731
1735
  * Sets the color scheme of the cards, can be overriden at the card level
1732
1736
  */
1733
1737
  colorScheme?: ColorSchemeTypes;
1738
+ /**
1739
+ * Desired number of columns to display.
1740
+ */
1741
+ columns?: ResponsiveObject<number | 'auto'> | number | 'auto';
1734
1742
  };
1735
1743
  /**
1736
1744
  * Displays a series of cards tailor made for displaying analytics data
1737
1745
  */
1738
1746
  declare const DataCards: {
1739
- ({ children, cardMaxWidth, colorScheme, ...props }: DataCardsProps): JSX.Element;
1747
+ ({ children, cardMinWidth, cardMaxWidth, colorScheme, columns, ...props }: DataCardsProps): JSX.Element;
1740
1748
  displayName: string;
1741
1749
  };
1742
1750
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.18.17
3
+ * @license @wistia/ui v0.18.18-beta.5671ee8e.fdf9f16
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -13958,12 +13958,22 @@ import { useRef as useRef15 } from "react";
13958
13958
  import { styled as styled58, keyframes as keyframes4 } from "styled-components";
13959
13959
  import { isNotNil as isNotNil25 } from "@wistia/type-guards";
13960
13960
  import { jsx as jsx278, jsxs as jsxs41 } from "react/jsx-runtime";
13961
+ var pulse = keyframes4`
13962
+ 0%,
13963
+ 100% {
13964
+ opacity: 1;
13965
+ }
13966
+ 50% {
13967
+ opacity: 0.5;
13968
+ }
13969
+ `;
13961
13970
  var StyledDataCard = styled58.div`
13962
13971
  --wui-data-card-text: var(--wui-color-text-button);
13963
13972
  --wui-color-text: var(--wui-data-card-text);
13964
13973
  --wui-data-card-background: var(--wui-color-bg-surface-secondary);
13965
13974
  --wui-data-card-background-hover: var(--wui-color-bg-surface-secondary-hover);
13966
13975
  --wui-data-card-background-active: var(--wui-color-bg-surface-secondary-active);
13976
+ --wui-data-card-skeleton-color: var(--wui-color-bg-surface-tertiary);
13967
13977
 
13968
13978
  display: grid;
13969
13979
  grid-template-areas: 'label slot' 'value value';
@@ -13991,6 +14001,16 @@ var StyledDataCard = styled58.div`
13991
14001
  grid-template-rows: auto auto auto;
13992
14002
  }
13993
14003
 
14004
+ [data-wui-data-card-skeleton='true'] {
14005
+ pointer-events: none;
14006
+ background-color: var(--wui-data-card-skeleton-color);
14007
+ animation: ${pulse} 1.5s var(--wui-motion-ease-in-out) 0.5s infinite;
14008
+ color: transparent;
14009
+ user-select: none;
14010
+ border-radius: var(--wui-border-radius-01);
14011
+ width: fit-content;
14012
+ }
14013
+
13994
14014
  &[data-click-region] {
13995
14015
  &:not([disabled]) {
13996
14016
  cursor: pointer;
@@ -14022,6 +14042,7 @@ var StyledDataCard = styled58.div`
14022
14042
  --wui-data-card-background-hover: var(--wui-color-bg-surface-selected-hover);
14023
14043
  --wui-data-card-background-active: var(--wui-color-bg-surface-selected-active);
14024
14044
  --wui-data-card-focus-ring: var(--wui-color-border-selected);
14045
+ --wui-data-card-skeleton-color: var(--wui-color-bg-surface-selected-active);
14025
14046
  }
14026
14047
  }
14027
14048
 
@@ -14032,38 +14053,19 @@ var StyledDataCard = styled58.div`
14032
14053
  ${({ $colorScheme }) => getColorScheme($colorScheme)}
14033
14054
  }
14034
14055
  `;
14035
- var shimmer = keyframes4`
14036
- 0% {
14037
- background-position: 200% 0;
14038
- }
14039
- 100% {
14040
- background-position: -200% 0;
14041
- }
14042
- `;
14043
- var LoadingBackground = styled58.div`
14044
- background: linear-gradient(
14045
- 90deg,
14046
- var(--wui-color-bg-surface-tertiary) 25%,
14047
- var(--wui-color-bg-surface-secondary) 37%,
14048
- var(--wui-color-bg-surface-tertiary) 63%
14049
- );
14050
- background-size: 200% 100%;
14051
- animation: ${shimmer} 1.5s infinite;
14052
- border-radius: var(--wui-border-radius-01);
14053
- `;
14054
- var StyledLoadingLabel = styled58(LoadingBackground)`
14055
- width: 80px;
14056
- height: var(--wui-typography-heading-6-line-height);
14057
- `;
14058
- var StyledLoadingValue = styled58(LoadingBackground)`
14059
- width: 90%;
14060
- height: var(--wui-typography-heading-3-line-height);
14061
- `;
14062
14056
  var StyledLabel3 = styled58(Heading)`
14063
14057
  grid-area: label;
14058
+
14059
+ &[data-wui-data-card-skeleton='true'] {
14060
+ width: 80px;
14061
+ }
14064
14062
  `;
14065
14063
  var StyledValue = styled58(Heading)`
14066
14064
  grid-area: value;
14065
+
14066
+ &[data-wui-data-card-skeleton='true'] {
14067
+ width: min(90%, 156px);
14068
+ }
14067
14069
  `;
14068
14070
  var StyledSlot = styled58.div`
14069
14071
  display: flex;
@@ -14097,17 +14099,19 @@ var DataCardInner = ({
14097
14099
  /* @__PURE__ */ jsx278(
14098
14100
  StyledLabel3,
14099
14101
  {
14100
- renderAs: "dt",
14102
+ "data-wui-data-card-skeleton": isLoading,
14103
+ renderAs: "span",
14101
14104
  variant: "heading6",
14102
- children: isLoading ? /* @__PURE__ */ jsx278(StyledLoadingLabel, {}) : label
14105
+ children: label
14103
14106
  }
14104
14107
  ),
14105
14108
  /* @__PURE__ */ jsx278(
14106
14109
  StyledValue,
14107
14110
  {
14108
- renderAs: "dd",
14111
+ "data-wui-data-card-skeleton": isLoading,
14112
+ renderAs: "span",
14109
14113
  variant: "heading3",
14110
- children: isLoading ? /* @__PURE__ */ jsx278(StyledLoadingValue, {}) : value
14114
+ children: value
14111
14115
  }
14112
14116
  ),
14113
14117
  isNotNil25(upperRightSlot) && !isLoading && /* @__PURE__ */ jsx278(StyledSlot, { children: upperRightSlot }),
@@ -14158,29 +14162,42 @@ import { styled as styled59 } from "styled-components";
14158
14162
  import { jsx as jsx279 } from "react/jsx-runtime";
14159
14163
  var StyledDataCards = styled59(Box)`
14160
14164
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
14165
+ --wui-data-cards-column-count: ${({ $columns }) => $columns === "auto" ? void 0 : $columns};
14166
+ --wui-data-cards-total-column-gap-width: calc(var(--wui-data-cards-column-count) - 1) *
14167
+ var(--wui-space-02);
14168
+ --wui-data-cards-column-width: calc(
14169
+ (100% - var(--wui-data-cards-total-column-gap-width)) / var(--wui-data-cards-column-count)
14170
+ );
14161
14171
 
14162
14172
  > * {
14163
- min-width: 120px;
14173
+ min-width: ${({ $cardMinWidth }) => $cardMinWidth};
14174
+ flex-basis: var(--wui-data-cards-column-width, 0);
14164
14175
  max-width: ${({ $cardMaxWidth }) => $cardMaxWidth};
14165
14176
  }
14166
14177
  `;
14167
14178
  var DataCards = ({
14168
14179
  children,
14180
+ cardMinWidth = "120px",
14169
14181
  cardMaxWidth = "none",
14170
14182
  colorScheme = "inherit",
14183
+ columns = "auto",
14171
14184
  ...props
14172
14185
  }) => {
14186
+ const responsiveCardMinWidth = useResponsiveProp(cardMinWidth);
14187
+ const responsiveCardMaxWidth = useResponsiveProp(cardMaxWidth);
14188
+ const responsiveColumns = useResponsiveProp(columns);
14173
14189
  return /* @__PURE__ */ jsx279(
14174
14190
  StyledDataCards,
14175
14191
  {
14176
14192
  ...props,
14177
- $cardMaxWidth: cardMaxWidth,
14193
+ $cardMaxWidth: responsiveCardMaxWidth,
14194
+ $cardMinWidth: responsiveCardMinWidth,
14178
14195
  $colorScheme: colorScheme,
14196
+ $columns: responsiveColumns,
14179
14197
  alignItems: "stretch",
14180
14198
  direction: "row",
14181
14199
  fill: "horizontal",
14182
14200
  gap: "space-02",
14183
- renderAs: "dl",
14184
14201
  wrapItems: true,
14185
14202
  children
14186
14203
  }