@wistia/ui 0.18.18-beta.fba14250.ac46dfb → 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-beta.fba14250.ac46dfb
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: "span",
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: "span",
14268
+ renderAs: "div",
14265
14269
  variant: "heading3",
14266
14270
  children: value
14267
14271
  }
@@ -14322,20 +14326,18 @@ var StyledDataCards = (0, import_styled_components78.styled)(Box)`
14322
14326
  );
14323
14327
 
14324
14328
  > * {
14325
- min-width: ${({ $cardMinWidth }) => $cardMinWidth};
14329
+ min-width: 120px;
14326
14330
  flex-basis: var(--wui-data-cards-column-width, 0);
14327
14331
  max-width: ${({ $cardMaxWidth }) => $cardMaxWidth};
14328
14332
  }
14329
14333
  `;
14330
14334
  var DataCards = ({
14331
14335
  children,
14332
- cardMinWidth = "120px",
14333
14336
  cardMaxWidth = "none",
14334
14337
  colorScheme = "inherit",
14335
14338
  columns = "auto",
14336
14339
  ...props
14337
14340
  }) => {
14338
- const responsiveCardMinWidth = useResponsiveProp(cardMinWidth);
14339
14341
  const responsiveCardMaxWidth = useResponsiveProp(cardMaxWidth);
14340
14342
  const responsiveColumns = useResponsiveProp(columns);
14341
14343
  return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
@@ -14343,7 +14345,6 @@ var DataCards = ({
14343
14345
  {
14344
14346
  ...props,
14345
14347
  $cardMaxWidth: responsiveCardMaxWidth,
14346
- $cardMinWidth: responsiveCardMinWidth,
14347
14348
  $colorScheme: colorScheme,
14348
14349
  $columns: responsiveColumns,
14349
14350
  alignItems: "stretch",
@@ -15243,8 +15244,20 @@ var import_react73 = require("react");
15243
15244
  var import_styled_components87 = require("styled-components");
15244
15245
  var import_type_guards49 = require("@wistia/type-guards");
15245
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
+ `;
15246
15259
  var StyledFormField = import_styled_components87.styled.div`
15247
- --form-field-spacing: var(--wui-space-01);
15260
+ --form-field-spacing: var(--wui-space-02);
15248
15261
  --form-field-spacing-inline: var(--wui-space-02);
15249
15262
  --form-field-error-color: var(--wui-color-text-secondary-error);
15250
15263
 
@@ -15258,21 +15271,28 @@ var StyledFormField = import_styled_components87.styled.div`
15258
15271
  &[data-label-position='inline-compact'] {
15259
15272
  gap: var(--form-field-spacing-inline);
15260
15273
  grid-template-columns: auto 1fr;
15261
- grid-template-rows: 1fr auto;
15274
+ ${inlineBaseGridAreaStyles}
15275
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15262
15276
  }
15263
15277
 
15264
15278
  &[data-label-position='inline'] {
15265
15279
  gap: var(--form-field-spacing-inline);
15266
15280
  grid-template-columns: minmax(auto, 1fr) 1fr;
15267
- grid-template-rows: 1fr auto;
15281
+ ${inlineBaseGridAreaStyles}
15282
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15268
15283
  }
15269
15284
 
15270
15285
  &[data-label-position='block'] {
15271
15286
  gap: var(--form-field-spacing);
15272
15287
  grid-template-columns: 1fr;
15273
- grid-template-rows: 1fr;
15288
+ grid-template-rows: auto 1fr;
15289
+ grid-template-areas: 'label-description' 'input';
15290
+ ${({ $hasError }) => $hasError && blockGridErrorStyles}
15274
15291
  }
15275
15292
  `;
15293
+ var ErrorText = (0, import_styled_components87.styled)(Text)`
15294
+ grid-area: error;
15295
+ `;
15276
15296
  var StyledErrorList = import_styled_components87.styled.ul`
15277
15297
  margin: 0;
15278
15298
  padding: 0;
@@ -15280,13 +15300,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
15280
15300
  display: flex;
15281
15301
  flex-direction: column;
15282
15302
  gap: var(--wui-space-01);
15303
+ grid-area: error;
15283
15304
  `;
15284
15305
  var ErrorMessages = ({ errors, id }) => {
15285
15306
  const isErrorArray = (0, import_type_guards49.isArray)(errors);
15286
15307
  const isMultipleErrors = isErrorArray && errors.length > 1;
15287
15308
  if (!isErrorArray) {
15288
15309
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15289
- Text,
15310
+ ErrorText,
15290
15311
  {
15291
15312
  colorScheme: "error",
15292
15313
  id,
@@ -15299,7 +15320,7 @@ var ErrorMessages = ({ errors, id }) => {
15299
15320
  }
15300
15321
  if (!isMultipleErrors) {
15301
15322
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15302
- Text,
15323
+ ErrorText,
15303
15324
  {
15304
15325
  colorScheme: "error",
15305
15326
  id,
@@ -15344,12 +15365,16 @@ var FormField = ({
15344
15365
  const descriptionId = `${computedId}-description`;
15345
15366
  const errorId = `${computedId}-error`;
15346
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;
15347
15371
  let childProps = {
15348
15372
  name,
15349
15373
  id: computedId,
15350
15374
  label: isIntegratedLabel ? label : void 0,
15351
15375
  "aria-describedby": ariaDescribedby,
15352
- "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
15376
+ "aria-invalid": hasError,
15377
+ style: { gridArea: "input" },
15353
15378
  ...props
15354
15379
  };
15355
15380
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15379,28 +15404,38 @@ var FormField = ({
15379
15404
  StyledFormField,
15380
15405
  {
15381
15406
  ...props,
15407
+ $hasError: hasError,
15382
15408
  "data-label-position": labelPosition ?? formState.labelPosition,
15383
15409
  children: [
15384
- !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15385
- Label,
15410
+ shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
15411
+ Stack,
15386
15412
  {
15387
- htmlFor: computedId,
15388
- required,
15389
- 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
+ ]
15390
15429
  }
15391
- ),
15392
- (0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
15430
+ ) : null,
15393
15431
  (0, import_react73.cloneElement)(children, childProps),
15394
- (0, import_type_guards49.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(import_jsx_runtime293.Fragment, { children: [
15395
- /* @__PURE__ */ (0, import_jsx_runtime293.jsx)("div", {}),
15396
- /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15397
- ErrorMessages,
15398
- {
15399
- errors: computedError,
15400
- id: errorId
15401
- }
15402
- )
15403
- ] }) : null
15432
+ hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15433
+ ErrorMessages,
15434
+ {
15435
+ errors: computedError,
15436
+ id: errorId
15437
+ }
15438
+ ) : null
15404
15439
  ]
15405
15440
  }
15406
15441
  );