@wistia/ui 0.18.18 → 0.19.0-beta.d1967016.e87d448

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.18.18
3
+ * @license @wistia/ui v0.19.0-beta.d1967016.e87d448
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -14211,6 +14211,10 @@ var StyledLabel3 = (0, import_styled_components77.styled)(Heading)`
14211
14211
  &[data-wui-data-card-skeleton='true'] {
14212
14212
  width: 80px;
14213
14213
  }
14214
+
14215
+ button {
14216
+ text-align: left;
14217
+ }
14214
14218
  `;
14215
14219
  var StyledValue = (0, import_styled_components77.styled)(Heading)`
14216
14220
  grid-area: value;
@@ -14252,7 +14256,7 @@ var DataCardInner = ({
14252
14256
  StyledLabel3,
14253
14257
  {
14254
14258
  "data-wui-data-card-skeleton": isLoading,
14255
- renderAs: "dt",
14259
+ renderAs: "div",
14256
14260
  variant: "heading6",
14257
14261
  children: label
14258
14262
  }
@@ -14261,7 +14265,7 @@ var DataCardInner = ({
14261
14265
  StyledValue,
14262
14266
  {
14263
14267
  "data-wui-data-card-skeleton": isLoading,
14264
- renderAs: "dd",
14268
+ renderAs: "div",
14265
14269
  variant: "heading3",
14266
14270
  children: value
14267
14271
  }
@@ -14314,9 +14318,16 @@ var import_styled_components78 = require("styled-components");
14314
14318
  var import_jsx_runtime279 = require("react/jsx-runtime");
14315
14319
  var StyledDataCards = (0, import_styled_components78.styled)(Box)`
14316
14320
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
14321
+ --wui-data-cards-column-count: ${({ $columns }) => $columns === "auto" ? void 0 : $columns};
14322
+ --wui-data-cards-total-column-gap-width: calc(var(--wui-data-cards-column-count) - 1) *
14323
+ var(--wui-space-02);
14324
+ --wui-data-cards-column-width: calc(
14325
+ (100% - var(--wui-data-cards-total-column-gap-width)) / var(--wui-data-cards-column-count)
14326
+ );
14317
14327
 
14318
14328
  > * {
14319
14329
  min-width: 120px;
14330
+ flex-basis: var(--wui-data-cards-column-width, 0);
14320
14331
  max-width: ${({ $cardMaxWidth }) => $cardMaxWidth};
14321
14332
  }
14322
14333
  `;
@@ -14324,19 +14335,22 @@ var DataCards = ({
14324
14335
  children,
14325
14336
  cardMaxWidth = "none",
14326
14337
  colorScheme = "inherit",
14338
+ columns = "auto",
14327
14339
  ...props
14328
14340
  }) => {
14341
+ const responsiveCardMaxWidth = useResponsiveProp(cardMaxWidth);
14342
+ const responsiveColumns = useResponsiveProp(columns);
14329
14343
  return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
14330
14344
  StyledDataCards,
14331
14345
  {
14332
14346
  ...props,
14333
- $cardMaxWidth: cardMaxWidth,
14347
+ $cardMaxWidth: responsiveCardMaxWidth,
14334
14348
  $colorScheme: colorScheme,
14349
+ $columns: responsiveColumns,
14335
14350
  alignItems: "stretch",
14336
14351
  direction: "row",
14337
14352
  fill: "horizontal",
14338
14353
  gap: "space-02",
14339
- renderAs: "dl",
14340
14354
  wrapItems: true,
14341
14355
  children
14342
14356
  }
@@ -15230,8 +15244,20 @@ var import_react73 = require("react");
15230
15244
  var import_styled_components87 = require("styled-components");
15231
15245
  var import_type_guards49 = require("@wistia/type-guards");
15232
15246
  var import_jsx_runtime293 = require("react/jsx-runtime");
15247
+ var inlineErrorStyles = import_styled_components87.css`
15248
+ grid-template-rows: 1fr auto;
15249
+ grid-template-areas: 'label-description input' '. error';
15250
+ `;
15251
+ var inlineBaseGridAreaStyles = import_styled_components87.css`
15252
+ grid-template-rows: 1fr;
15253
+ grid-template-areas: 'label-description input';
15254
+ `;
15255
+ var blockGridErrorStyles = import_styled_components87.css`
15256
+ grid-template-rows: auto 1fr auto;
15257
+ grid-template-areas: 'label-description' 'input' 'error';
15258
+ `;
15233
15259
  var StyledFormField = import_styled_components87.styled.div`
15234
- --form-field-spacing: var(--wui-space-01);
15260
+ --form-field-spacing: var(--wui-space-02);
15235
15261
  --form-field-spacing-inline: var(--wui-space-02);
15236
15262
  --form-field-error-color: var(--wui-color-text-secondary-error);
15237
15263
 
@@ -15245,21 +15271,28 @@ var StyledFormField = import_styled_components87.styled.div`
15245
15271
  &[data-label-position='inline-compact'] {
15246
15272
  gap: var(--form-field-spacing-inline);
15247
15273
  grid-template-columns: auto 1fr;
15248
- grid-template-rows: 1fr auto;
15274
+ ${inlineBaseGridAreaStyles}
15275
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15249
15276
  }
15250
15277
 
15251
15278
  &[data-label-position='inline'] {
15252
15279
  gap: var(--form-field-spacing-inline);
15253
15280
  grid-template-columns: minmax(auto, 1fr) 1fr;
15254
- grid-template-rows: 1fr auto;
15281
+ ${inlineBaseGridAreaStyles}
15282
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15255
15283
  }
15256
15284
 
15257
15285
  &[data-label-position='block'] {
15258
15286
  gap: var(--form-field-spacing);
15259
15287
  grid-template-columns: 1fr;
15260
- grid-template-rows: 1fr;
15288
+ grid-template-rows: auto 1fr;
15289
+ grid-template-areas: 'label-description' 'input';
15290
+ ${({ $hasError }) => $hasError && blockGridErrorStyles}
15261
15291
  }
15262
15292
  `;
15293
+ var ErrorText = (0, import_styled_components87.styled)(Text)`
15294
+ grid-area: error;
15295
+ `;
15263
15296
  var StyledErrorList = import_styled_components87.styled.ul`
15264
15297
  margin: 0;
15265
15298
  padding: 0;
@@ -15267,13 +15300,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
15267
15300
  display: flex;
15268
15301
  flex-direction: column;
15269
15302
  gap: var(--wui-space-01);
15303
+ grid-area: error;
15270
15304
  `;
15271
15305
  var ErrorMessages = ({ errors, id }) => {
15272
15306
  const isErrorArray = (0, import_type_guards49.isArray)(errors);
15273
15307
  const isMultipleErrors = isErrorArray && errors.length > 1;
15274
15308
  if (!isErrorArray) {
15275
15309
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15276
- Text,
15310
+ ErrorText,
15277
15311
  {
15278
15312
  colorScheme: "error",
15279
15313
  id,
@@ -15286,7 +15320,7 @@ var ErrorMessages = ({ errors, id }) => {
15286
15320
  }
15287
15321
  if (!isMultipleErrors) {
15288
15322
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15289
- Text,
15323
+ ErrorText,
15290
15324
  {
15291
15325
  colorScheme: "error",
15292
15326
  id,
@@ -15331,12 +15365,16 @@ var FormField = ({
15331
15365
  const descriptionId = `${computedId}-description`;
15332
15366
  const errorId = `${computedId}-error`;
15333
15367
  const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
15368
+ const hasDescription = (0, import_type_guards49.isNotNil)(description);
15369
+ const hasError = (0, import_type_guards49.isNotNil)(computedError);
15370
+ const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
15334
15371
  let childProps = {
15335
15372
  name,
15336
15373
  id: computedId,
15337
15374
  label: isIntegratedLabel ? label : void 0,
15338
15375
  "aria-describedby": ariaDescribedby,
15339
- "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
15376
+ "aria-invalid": hasError,
15377
+ style: { gridArea: "input" },
15340
15378
  ...props
15341
15379
  };
15342
15380
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15366,28 +15404,38 @@ var FormField = ({
15366
15404
  StyledFormField,
15367
15405
  {
15368
15406
  ...props,
15407
+ $hasError: hasError,
15369
15408
  "data-label-position": labelPosition ?? formState.labelPosition,
15370
15409
  children: [
15371
- !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15372
- Label,
15410
+ shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
15411
+ Stack,
15373
15412
  {
15374
- htmlFor: computedId,
15375
- required,
15376
- children: label
15413
+ direction: "vertical",
15414
+ gap: "space-01",
15415
+ style: {
15416
+ gridArea: "label-description"
15417
+ },
15418
+ children: [
15419
+ !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15420
+ Label,
15421
+ {
15422
+ htmlFor: computedId,
15423
+ required,
15424
+ children: label
15425
+ }
15426
+ ),
15427
+ hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
15428
+ ]
15377
15429
  }
15378
- ),
15379
- (0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
15430
+ ) : null,
15380
15431
  (0, import_react73.cloneElement)(children, childProps),
15381
- (0, import_type_guards49.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [
15382
- /* @__PURE__ */ (0, import_jsx_runtime293.jsx)("div", {}),
15383
- /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15384
- ErrorMessages,
15385
- {
15386
- errors: computedError,
15387
- id: errorId
15388
- }
15389
- )
15390
- ] }) : null
15432
+ hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15433
+ ErrorMessages,
15434
+ {
15435
+ errors: computedError,
15436
+ id: errorId
15437
+ }
15438
+ ) : null
15391
15439
  ]
15392
15440
  }
15393
15441
  );