@wistia/ui 0.18.18 → 0.19.0-beta.c03a2908.692126d

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.c03a2908.692126d
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -15230,8 +15230,20 @@ var import_react73 = require("react");
15230
15230
  var import_styled_components87 = require("styled-components");
15231
15231
  var import_type_guards49 = require("@wistia/type-guards");
15232
15232
  var import_jsx_runtime293 = require("react/jsx-runtime");
15233
+ var inlineErrorStyles = import_styled_components87.css`
15234
+ grid-template-rows: 1fr auto;
15235
+ grid-template-areas: 'label-description input' '. error';
15236
+ `;
15237
+ var inlineBaseGridAreaStyles = import_styled_components87.css`
15238
+ grid-template-rows: 1fr;
15239
+ grid-template-areas: 'label-description input';
15240
+ `;
15241
+ var blockGridErrorStyles = import_styled_components87.css`
15242
+ grid-template-rows: auto 1fr auto;
15243
+ grid-template-areas: 'label-description' 'input' 'error';
15244
+ `;
15233
15245
  var StyledFormField = import_styled_components87.styled.div`
15234
- --form-field-spacing: var(--wui-space-01);
15246
+ --form-field-spacing: var(--wui-space-02);
15235
15247
  --form-field-spacing-inline: var(--wui-space-02);
15236
15248
  --form-field-error-color: var(--wui-color-text-secondary-error);
15237
15249
 
@@ -15245,21 +15257,28 @@ var StyledFormField = import_styled_components87.styled.div`
15245
15257
  &[data-label-position='inline-compact'] {
15246
15258
  gap: var(--form-field-spacing-inline);
15247
15259
  grid-template-columns: auto 1fr;
15248
- grid-template-rows: 1fr auto;
15260
+ ${inlineBaseGridAreaStyles}
15261
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15249
15262
  }
15250
15263
 
15251
15264
  &[data-label-position='inline'] {
15252
15265
  gap: var(--form-field-spacing-inline);
15253
15266
  grid-template-columns: minmax(auto, 1fr) 1fr;
15254
- grid-template-rows: 1fr auto;
15267
+ ${inlineBaseGridAreaStyles}
15268
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15255
15269
  }
15256
15270
 
15257
15271
  &[data-label-position='block'] {
15258
15272
  gap: var(--form-field-spacing);
15259
15273
  grid-template-columns: 1fr;
15260
- grid-template-rows: 1fr;
15274
+ grid-template-rows: auto 1fr;
15275
+ grid-template-areas: 'label-description' 'input';
15276
+ ${({ $hasError }) => $hasError && blockGridErrorStyles}
15261
15277
  }
15262
15278
  `;
15279
+ var ErrorText = (0, import_styled_components87.styled)(Text)`
15280
+ grid-area: error;
15281
+ `;
15263
15282
  var StyledErrorList = import_styled_components87.styled.ul`
15264
15283
  margin: 0;
15265
15284
  padding: 0;
@@ -15267,13 +15286,14 @@ var StyledErrorList = import_styled_components87.styled.ul`
15267
15286
  display: flex;
15268
15287
  flex-direction: column;
15269
15288
  gap: var(--wui-space-01);
15289
+ grid-area: error;
15270
15290
  `;
15271
15291
  var ErrorMessages = ({ errors, id }) => {
15272
15292
  const isErrorArray = (0, import_type_guards49.isArray)(errors);
15273
15293
  const isMultipleErrors = isErrorArray && errors.length > 1;
15274
15294
  if (!isErrorArray) {
15275
15295
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15276
- Text,
15296
+ ErrorText,
15277
15297
  {
15278
15298
  colorScheme: "error",
15279
15299
  id,
@@ -15286,7 +15306,7 @@ var ErrorMessages = ({ errors, id }) => {
15286
15306
  }
15287
15307
  if (!isMultipleErrors) {
15288
15308
  return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15289
- Text,
15309
+ ErrorText,
15290
15310
  {
15291
15311
  colorScheme: "error",
15292
15312
  id,
@@ -15331,12 +15351,16 @@ var FormField = ({
15331
15351
  const descriptionId = `${computedId}-description`;
15332
15352
  const errorId = `${computedId}-error`;
15333
15353
  const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
15354
+ const hasDescription = (0, import_type_guards49.isNotNil)(description);
15355
+ const hasError = (0, import_type_guards49.isNotNil)(computedError);
15356
+ const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
15334
15357
  let childProps = {
15335
15358
  name,
15336
15359
  id: computedId,
15337
15360
  label: isIntegratedLabel ? label : void 0,
15338
15361
  "aria-describedby": ariaDescribedby,
15339
- "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
15362
+ "aria-invalid": hasError,
15363
+ style: { gridArea: "input" },
15340
15364
  ...props
15341
15365
  };
15342
15366
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15366,28 +15390,38 @@ var FormField = ({
15366
15390
  StyledFormField,
15367
15391
  {
15368
15392
  ...props,
15393
+ $hasError: hasError,
15369
15394
  "data-label-position": labelPosition ?? formState.labelPosition,
15370
15395
  children: [
15371
- !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15372
- Label,
15396
+ shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
15397
+ Stack,
15373
15398
  {
15374
- htmlFor: computedId,
15375
- required,
15376
- children: label
15399
+ direction: "vertical",
15400
+ gap: "space-01",
15401
+ style: {
15402
+ gridArea: "label-description"
15403
+ },
15404
+ children: [
15405
+ !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15406
+ Label,
15407
+ {
15408
+ htmlFor: computedId,
15409
+ required,
15410
+ children: label
15411
+ }
15412
+ ),
15413
+ hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
15414
+ ]
15377
15415
  }
15378
- ),
15379
- (0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
15416
+ ) : null,
15380
15417
  (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
15418
+ hasError ? /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(
15419
+ ErrorMessages,
15420
+ {
15421
+ errors: computedError,
15422
+ id: errorId
15423
+ }
15424
+ ) : null
15391
15425
  ]
15392
15426
  }
15393
15427
  );
@@ -18396,6 +18430,8 @@ var StyledThumbnail = import_styled_components128.styled.div`
18396
18430
  &,
18397
18431
  img {
18398
18432
  border-radius: clamp(var(--wui-border-radius-01), 8cqh, var(--wui-border-radius-05));
18433
+ outline: 1px solid rgba(0, 0, 0, 0.025);
18434
+ outline-offset: -1px;
18399
18435
  }
18400
18436
 
18401
18437
  @container (min-width: 200px) {
@@ -18553,7 +18589,7 @@ var Thumbnail = (0, import_react97.forwardRef)(
18553
18589
  Thumbnail.displayName = "Thumbnail_UI";
18554
18590
 
18555
18591
  // src/components/ThumbnailCollage/ThumbnailCollage.tsx
18556
- var import_react98 = require("react");
18592
+ var import_react98 = __toESM(require("react"));
18557
18593
  var import_styled_components129 = require("styled-components");
18558
18594
  var import_type_guards75 = require("@wistia/type-guards");
18559
18595
  var import_jsx_runtime338 = (
@@ -18567,12 +18603,19 @@ var ThumbnailCollageContainer = import_styled_components129.styled.div`
18567
18603
  display: flex;
18568
18604
  `;
18569
18605
  var StyledThumbnailCollage = import_styled_components129.styled.div`
18606
+ --wui-thumbnail-collage-spacing: var(--wui-space-01);
18607
+ border-radius: clamp(var(--wui-border-radius-01), 8cqh, var(--wui-border-radius-05));
18570
18608
  display: grid;
18571
- gap: var(--wui-space-01);
18609
+ gap: var(--wui-thumbnail-collage-spacing);
18572
18610
  width: 100%;
18573
18611
  grid-template-columns: 3fr 2fr;
18574
18612
  grid-template-rows: 1fr 1fr;
18575
18613
 
18614
+ ${({ $hasBackground }) => $hasBackground && import_styled_components129.css`
18615
+ background-color: var(--wui-color-bg-surface-tertiary);
18616
+ padding: var(--wui-thumbnail-collage-spacing);
18617
+ `}
18618
+
18576
18619
  &:has(:nth-child(1)) {
18577
18620
  grid-template-areas:
18578
18621
  'a a'
@@ -18609,16 +18652,21 @@ var StyledThumbnailCollage = import_styled_components129.styled.div`
18609
18652
  height: 100%;
18610
18653
  width: 100%;
18611
18654
  }
18655
+
18656
+ @container (min-width: 200px) {
18657
+ --wui-thumbnail-collage-spacing: var(--wui-space-02);
18658
+ }
18612
18659
  `;
18613
18660
  var ThumbnailCollage = ({
18614
18661
  children = [],
18615
18662
  gradientBackground = "defaultMidOne",
18663
+ hasBackground = false,
18616
18664
  ...props
18617
18665
  }) => {
18618
- const thumbnailArray = import_react98.Children.toArray(children);
18666
+ const thumbnailArray = import_react98.default.Children.toArray(children);
18619
18667
  const truncatedThumbnails = thumbnailArray.slice(0, 3);
18620
18668
  const thumbnails = (0, import_type_guards75.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
18621
- return (0, import_react98.cloneElement)(child, {
18669
+ return import_react98.default.cloneElement(child, {
18622
18670
  ...child.props,
18623
18671
  children: void 0
18624
18672
  });
@@ -18636,6 +18684,7 @@ var ThumbnailCollage = ({
18636
18684
  StyledThumbnailCollage,
18637
18685
  {
18638
18686
  $gradientBackground: gradientBackground,
18687
+ $hasBackground: hasBackground,
18639
18688
  "data-wui-thumbnail-collage": true,
18640
18689
  ...props,
18641
18690
  children: thumbnails