@wistia/ui 0.4.10 → 0.4.11-beta.189cb9cf.b62584a

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.4.10
3
+ * @license @wistia/ui v0.4.11-beta.189cb9cf.b62584a
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -52,6 +52,9 @@ __export(index_exports, {
52
52
  CheckboxGroup: () => CheckboxGroup,
53
53
  CheckboxMenuItem: () => CheckboxMenuItem,
54
54
  ColorSchemeWrapper: () => ColorSchemeWrapper,
55
+ DataCard: () => DataCard,
56
+ DataCardTrend: () => DataCardTrend,
57
+ DataCards: () => DataCards,
55
58
  Divider: () => Divider,
56
59
  Ellipsis: () => Ellipsis,
57
60
  Form: () => Form,
@@ -6074,6 +6077,13 @@ Badge.displayName = "Badge";
6074
6077
  var import_react16 = require("react");
6075
6078
  var import_styled_components23 = __toESM(require("styled-components"));
6076
6079
  var import_type_guards15 = require("@wistia/type-guards");
6080
+
6081
+ // src/private/helpers/makePolymorphic/makePolymorphic.tsx
6082
+ var makePolymorphic = (component) => {
6083
+ return component;
6084
+ };
6085
+
6086
+ // src/components/Box/Box.tsx
6077
6087
  var import_jsx_runtime167 = require("react/jsx-runtime");
6078
6088
  var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
6079
6089
  var getGapStyle = (gap) => {
@@ -6117,7 +6127,7 @@ var getFillViewportStyle = (fillViewport) => {
6117
6127
  }
6118
6128
  return void 0;
6119
6129
  };
6120
- var BoxComponent = import_styled_components23.default.div`
6130
+ var StyledBoxComponent = import_styled_components23.default.div`
6121
6131
  align-content: ${({ $alignContent }) => $alignContent};
6122
6132
  align-items: ${({ $alignItems }) => $alignItems};
6123
6133
  align-self: ${({ $alignSelf }) => $alignSelf ?? null};
@@ -6151,50 +6161,56 @@ var wrapChildren = (children) => {
6151
6161
  }
6152
6162
  return null;
6153
6163
  };
6154
- var Box = ({
6155
- alignContent = "stretch",
6156
- alignItems = "flex-start",
6157
- alignSelf,
6158
- basis,
6159
- children,
6160
- direction = "row",
6161
- fill = false,
6162
- fillViewport = false,
6163
- gap,
6164
- grow,
6165
- hasBoxParent = false,
6166
- // eslint-disable-line @typescript-eslint/no-unused-vars
6167
- inline = false,
6168
- justifyContent = "flex-start",
6169
- order,
6170
- shrink,
6171
- wrapItems = false,
6172
- ...otherProps
6173
- }) => {
6174
- return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
6175
- BoxComponent,
6176
- {
6177
- $alignContent: alignContent,
6178
- $alignItems: alignItems,
6179
- $alignSelf: alignSelf,
6180
- $basis: basis,
6181
- $fillBox: fill,
6182
- $fillViewport: fillViewport,
6183
- $flexDirection: direction,
6184
- $gap: gap,
6185
- $grow: grow,
6186
- $inline: inline,
6187
- $justifyContent: justifyContent,
6188
- $order: order,
6189
- $shrink: shrink,
6190
- $wrapItems: wrapItems,
6191
- as: "div",
6192
- ...otherProps,
6193
- children: wrapChildren(children)
6194
- }
6195
- );
6196
- };
6197
- Box.displayName = "Box";
6164
+ var DEFAULT_ELEMENT = "div";
6165
+ var BoxComponent = (0, import_react16.forwardRef)(
6166
+ ({
6167
+ alignContent = "stretch",
6168
+ alignItems = "flex-start",
6169
+ alignSelf,
6170
+ basis,
6171
+ children,
6172
+ direction = "row",
6173
+ fill = false,
6174
+ fillViewport = false,
6175
+ gap,
6176
+ grow,
6177
+ hasBoxParent = false,
6178
+ // eslint-disable-line @typescript-eslint/no-unused-vars
6179
+ inline = false,
6180
+ justifyContent = "flex-start",
6181
+ order,
6182
+ renderAs,
6183
+ shrink,
6184
+ wrapItems = false,
6185
+ ...otherProps
6186
+ }, ref) => {
6187
+ return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
6188
+ StyledBoxComponent,
6189
+ {
6190
+ ref,
6191
+ $alignContent: alignContent,
6192
+ $alignItems: alignItems,
6193
+ $alignSelf: alignSelf,
6194
+ $basis: basis,
6195
+ $fillBox: fill,
6196
+ $fillViewport: fillViewport,
6197
+ $flexDirection: direction,
6198
+ $gap: gap,
6199
+ $grow: grow,
6200
+ $inline: inline,
6201
+ $justifyContent: justifyContent,
6202
+ $order: order,
6203
+ $shrink: shrink,
6204
+ $wrapItems: wrapItems,
6205
+ as: renderAs ?? DEFAULT_ELEMENT,
6206
+ ...otherProps,
6207
+ children: wrapChildren(children)
6208
+ }
6209
+ );
6210
+ }
6211
+ );
6212
+ BoxComponent.displayName = "Box";
6213
+ var Box = makePolymorphic(BoxComponent);
6198
6214
 
6199
6215
  // src/components/Breadcrumbs/Breadcrumbs.tsx
6200
6216
  var import_styled_components24 = __toESM(require("styled-components"));
@@ -6364,13 +6380,6 @@ var import_styled_components28 = __toESM(require("styled-components"));
6364
6380
  // src/components/Heading/Heading.tsx
6365
6381
  var import_react17 = require("react");
6366
6382
  var import_styled_components27 = __toESM(require("styled-components"));
6367
-
6368
- // src/private/helpers/makePolymorphic/makePolymorphic.tsx
6369
- var makePolymorphic = (component) => {
6370
- return component;
6371
- };
6372
-
6373
- // src/components/Heading/Heading.tsx
6374
6383
  var import_jsx_runtime172 = require("react/jsx-runtime");
6375
6384
  var heroStyle = import_styled_components27.css`
6376
6385
  --font-family: var(--wui-typography-heading-hero-family);
@@ -6423,7 +6432,7 @@ var variantStyleMap = {
6423
6432
  heading5: heading5TextStyle,
6424
6433
  heading6: heading6TextStyle
6425
6434
  };
6426
- var DEFAULT_ELEMENT = "h1";
6435
+ var DEFAULT_ELEMENT2 = "h1";
6427
6436
  var StyledHeading = import_styled_components27.default.div`
6428
6437
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
6429
6438
  font-family: var(--font-family);
@@ -6448,8 +6457,8 @@ var StyledHeading = import_styled_components27.default.div`
6448
6457
  margin: 0;
6449
6458
  `;
6450
6459
  var variantElementMap = {
6451
- hero: DEFAULT_ELEMENT,
6452
- heading1: DEFAULT_ELEMENT,
6460
+ hero: DEFAULT_ELEMENT2,
6461
+ heading1: DEFAULT_ELEMENT2,
6453
6462
  heading2: "h2",
6454
6463
  heading3: "h3",
6455
6464
  heading4: "h4",
@@ -6751,7 +6760,7 @@ var import_type_guards19 = require("@wistia/type-guards");
6751
6760
  var import_react19 = require("react");
6752
6761
  var import_styled_components32 = __toESM(require("styled-components"));
6753
6762
  var import_jsx_runtime177 = require("react/jsx-runtime");
6754
- var DEFAULT_ELEMENT2 = "div";
6763
+ var DEFAULT_ELEMENT3 = "div";
6755
6764
  var StyledStack = import_styled_components32.default.div`
6756
6765
  display: flex;
6757
6766
  flex-direction: ${({ $direction }) => $direction === "horizontal" ? "row" : "column"};
@@ -6767,7 +6776,7 @@ var StackComponent = (0, import_react19.forwardRef)(
6767
6776
  ref,
6768
6777
  $direction: responsiveDirection,
6769
6778
  $gap: responsiveGap,
6770
- as: renderAs ?? DEFAULT_ELEMENT2,
6779
+ as: renderAs ?? DEFAULT_ELEMENT3,
6771
6780
  ...props
6772
6781
  }
6773
6782
  );
@@ -7088,7 +7097,7 @@ var StyledText = import_styled_components34.default.div`
7088
7097
  display: block;
7089
7098
  `}
7090
7099
  `;
7091
- var DEFAULT_ELEMENT3 = "div";
7100
+ var DEFAULT_ELEMENT4 = "div";
7092
7101
  var TextComponent = (0, import_react23.forwardRef)(
7093
7102
  ({
7094
7103
  align = "left",
@@ -7114,7 +7123,7 @@ var TextComponent = (0, import_react23.forwardRef)(
7114
7123
  $preventUserSelect: preventUserSelect,
7115
7124
  $prominence: prominence,
7116
7125
  $variant: variant,
7117
- as: renderAs ?? DEFAULT_ELEMENT3,
7126
+ as: renderAs ?? DEFAULT_ELEMENT4,
7118
7127
  ...otherProps
7119
7128
  }
7120
7129
  );
@@ -8201,6 +8210,7 @@ var ModalContent = (0, import_react36.forwardRef)(
8201
8210
  ref,
8202
8211
  $fullHeight: fullHeight,
8203
8212
  $width: width,
8213
+ "aria-describedby": void 0,
8204
8214
  ...otherProps,
8205
8215
  children
8206
8216
  }
@@ -8296,7 +8306,6 @@ var Modal = (0, import_react38.forwardRef)(
8296
8306
  ModalContent,
8297
8307
  {
8298
8308
  ref,
8299
- "aria-describedby": void 0,
8300
8309
  fullHeight,
8301
8310
  onOpenAutoFocus: (event) => {
8302
8311
  if ((0, import_type_guards28.isNotNil)(initialFocusRef) && initialFocusRef.current) {
@@ -9123,6 +9132,176 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
9123
9132
  children
9124
9133
  ] });
9125
9134
  };
9135
+
9136
+ // src/components/DataCards/DataCard.tsx
9137
+ var import_styled_components59 = __toESM(require("styled-components"));
9138
+ var import_type_guards34 = require("@wistia/type-guards");
9139
+ var import_jsx_runtime211 = require("react/jsx-runtime");
9140
+ var StyledDataCard = import_styled_components59.default.div`
9141
+ ${({ $colorScheme }) => getColorScheme($colorScheme)}
9142
+ display: grid;
9143
+ grid-template-areas: 'label slot' 'value value';
9144
+ grid-template-rows: auto auto;
9145
+ grid-template-columns: auto auto;
9146
+ gap: var(--wui-space-01);
9147
+ padding: var(--wui-space-03);
9148
+ background: var(--wui-color-bg-surface-secondary);
9149
+ flex: 1;
9150
+ border-radius: var(--wui-border-radius-02);
9151
+ position: relative;
9152
+ `;
9153
+ var shimmer = import_styled_components59.keyframes`
9154
+ 0% {
9155
+ background-position: 200% 0;
9156
+ }
9157
+ 100% {
9158
+ background-position: -200% 0;
9159
+ }
9160
+ `;
9161
+ var LoadingBackground = import_styled_components59.default.div`
9162
+ background: linear-gradient(
9163
+ 90deg,
9164
+ var(--wui-color-bg-surface-tertiary) 25%,
9165
+ var(--wui-color-bg-surface-secondary) 37%,
9166
+ var(--wui-color-bg-surface-tertiary) 63%
9167
+ );
9168
+ background-size: 200% 100%;
9169
+ animation: ${shimmer} 1.5s infinite;
9170
+ border-radius: var(--wui-border-radius-01);
9171
+ `;
9172
+ var StyledLoadingLabel = (0, import_styled_components59.default)(LoadingBackground)`
9173
+ width: 80px;
9174
+ height: var(--wui-typography-heading-6-line-height);
9175
+ `;
9176
+ var StyledLoadingValue = (0, import_styled_components59.default)(LoadingBackground)`
9177
+ width: 90%;
9178
+ height: var(--wui-typography-heading-3-line-height);
9179
+ `;
9180
+ var StyledLabel4 = (0, import_styled_components59.default)(Heading)`
9181
+ grid-area: label;
9182
+ `;
9183
+ var StyledValue = (0, import_styled_components59.default)(Heading)`
9184
+ grid-area: value;
9185
+ `;
9186
+ var StyledSlot = import_styled_components59.default.div`
9187
+ display: flex;
9188
+ justify-content: flex-end;
9189
+ grid-area: slot;
9190
+ align-self: center;
9191
+ `;
9192
+ var StyledDataCardTrendContainer = import_styled_components59.default.div`
9193
+ position: absolute;
9194
+ bottom: var(--wui-space-01);
9195
+ right: var(--wui-space-01);
9196
+ `;
9197
+ var DataCard = ({
9198
+ label,
9199
+ value,
9200
+ upperRightSlot,
9201
+ colorScheme = "inherit",
9202
+ isLoading = false,
9203
+ trend,
9204
+ ...props
9205
+ }) => /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(
9206
+ StyledDataCard,
9207
+ {
9208
+ $colorScheme: colorScheme,
9209
+ ...props,
9210
+ children: [
9211
+ /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(
9212
+ StyledLabel4,
9213
+ {
9214
+ renderAs: "dt",
9215
+ variant: "heading6",
9216
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledLoadingLabel, {}) : label
9217
+ }
9218
+ ),
9219
+ /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(
9220
+ StyledValue,
9221
+ {
9222
+ renderAs: "dd",
9223
+ variant: "heading3",
9224
+ children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledLoadingValue, {}) : value
9225
+ }
9226
+ ),
9227
+ (0, import_type_guards34.isNotNull)(upperRightSlot) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledSlot, { children: upperRightSlot }),
9228
+ (0, import_type_guards34.isNotNull)(trend) && !isLoading && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(StyledDataCardTrendContainer, { children: trend })
9229
+ ]
9230
+ }
9231
+ );
9232
+ DataCard.displayName = "DataCard";
9233
+
9234
+ // src/components/DataCards/DataCards.tsx
9235
+ var import_styled_components60 = __toESM(require("styled-components"));
9236
+ var import_type_guards35 = require("@wistia/type-guards");
9237
+ var import_jsx_runtime212 = require("react/jsx-runtime");
9238
+ var StyledDataCards = (0, import_styled_components60.default)(Box)`
9239
+ ${({ $colorScheme }) => getColorScheme($colorScheme)};
9240
+ > * {
9241
+ min-width: 120px;
9242
+ max-width: ${({ $cardMaxWidth }) => (0, import_type_guards35.isNotUndefined)($cardMaxWidth) ? `${$cardMaxWidth}px` : "none"};
9243
+ }
9244
+ `;
9245
+ var DataCards = ({
9246
+ children,
9247
+ cardMaxWidth,
9248
+ colorScheme = "inherit",
9249
+ ...props
9250
+ }) => {
9251
+ return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
9252
+ StyledDataCards,
9253
+ {
9254
+ ...props,
9255
+ $cardMaxWidth: cardMaxWidth,
9256
+ $colorScheme: colorScheme,
9257
+ direction: "row",
9258
+ fill: "horizontal",
9259
+ gap: "space-02",
9260
+ renderAs: "dl",
9261
+ wrapItems: true,
9262
+ children
9263
+ }
9264
+ );
9265
+ };
9266
+ DataCards.displayName = "DataCards";
9267
+
9268
+ // src/components/DataCards/DataCardTrend.tsx
9269
+ var import_styled_components61 = __toESM(require("styled-components"));
9270
+ var import_jsx_runtime213 = require("react/jsx-runtime");
9271
+ var StyledDataCardTrend = import_styled_components61.default.div`
9272
+ ${({ $outlook }) => getColorScheme($outlook === "positive" ? "success" : "error")};
9273
+ background: var(--wui-color-bg-app);
9274
+ border-radius: var(--wui-border-radius-rounded);
9275
+ padding: var(--wui-space-01);
9276
+ display: flex;
9277
+ align-items: center;
9278
+ gap: 2px;
9279
+ `;
9280
+ var DataCardTrend = ({
9281
+ direction = "up",
9282
+ outlook = "positive",
9283
+ children,
9284
+ ...props
9285
+ }) => {
9286
+ return /* @__PURE__ */ (0, import_jsx_runtime213.jsxs)(StyledDataCardTrend, { $outlook: outlook, children: [
9287
+ /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
9288
+ Icon,
9289
+ {
9290
+ size: "md",
9291
+ type: direction === "up" ? "arrow-up" : "arrow-down",
9292
+ ...props
9293
+ }
9294
+ ),
9295
+ /* @__PURE__ */ (0, import_jsx_runtime213.jsx)(
9296
+ Text,
9297
+ {
9298
+ prominence: "secondary",
9299
+ variant: "label4",
9300
+ children
9301
+ }
9302
+ )
9303
+ ] });
9304
+ };
9126
9305
  // Annotate the CommonJS export names for ESM import in node:
9127
9306
  0 && (module.exports = {
9128
9307
  ActionButton,
@@ -9138,6 +9317,9 @@ var SelectOptionGroup = ({ children, label, ...props }) => {
9138
9317
  CheckboxGroup,
9139
9318
  CheckboxMenuItem,
9140
9319
  ColorSchemeWrapper,
9320
+ DataCard,
9321
+ DataCardTrend,
9322
+ DataCards,
9141
9323
  Divider,
9142
9324
  Ellipsis,
9143
9325
  Form,