@wistia/ui 0.18.10-beta.6184f9f6.d0d0aad → 0.18.10-beta.a12abacc.dd82133

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.10-beta.6184f9f6.d0d0aad
3
+ * @license @wistia/ui v0.18.10-beta.a12abacc.dd82133
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -15146,8 +15146,20 @@ var import_react73 = require("react");
15146
15146
  var import_styled_components86 = require("styled-components");
15147
15147
  var import_type_guards49 = require("@wistia/type-guards");
15148
15148
  var import_jsx_runtime288 = require("react/jsx-runtime");
15149
+ var inlineErrorStyles = import_styled_components86.css`
15150
+ grid-template-rows: 1fr auto;
15151
+ grid-template-areas: 'label-description input' '. error';
15152
+ `;
15153
+ var inlineBaseGridAreaStyles = import_styled_components86.css`
15154
+ grid-template-rows: 1fr;
15155
+ grid-template-areas: 'label-description input';
15156
+ `;
15157
+ var blockGridErrorStyles = import_styled_components86.css`
15158
+ grid-template-rows: auto 1fr auto;
15159
+ grid-template-areas: 'label-description' 'input' 'error';
15160
+ `;
15149
15161
  var StyledFormField = import_styled_components86.styled.div`
15150
- --form-field-spacing: var(--wui-space-01);
15162
+ --form-field-spacing: var(--wui-space-02);
15151
15163
  --form-field-spacing-inline: var(--wui-space-02);
15152
15164
  --form-field-error-color: var(--wui-color-text-secondary-error);
15153
15165
 
@@ -15161,21 +15173,28 @@ var StyledFormField = import_styled_components86.styled.div`
15161
15173
  &[data-label-position='inline-compact'] {
15162
15174
  gap: var(--form-field-spacing-inline);
15163
15175
  grid-template-columns: auto 1fr;
15164
- grid-template-rows: 1fr auto;
15176
+ ${inlineBaseGridAreaStyles}
15177
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15165
15178
  }
15166
15179
 
15167
15180
  &[data-label-position='inline'] {
15168
15181
  gap: var(--form-field-spacing-inline);
15169
15182
  grid-template-columns: minmax(auto, 1fr) 1fr;
15170
- grid-template-rows: 1fr auto;
15183
+ ${inlineBaseGridAreaStyles}
15184
+ ${({ $hasError }) => $hasError && inlineErrorStyles}
15171
15185
  }
15172
15186
 
15173
15187
  &[data-label-position='block'] {
15174
15188
  gap: var(--form-field-spacing);
15175
15189
  grid-template-columns: 1fr;
15176
- grid-template-rows: 1fr;
15190
+ grid-template-rows: auto 1fr;
15191
+ grid-template-areas: 'label-description' 'input';
15192
+ ${({ $hasError }) => $hasError && blockGridErrorStyles}
15177
15193
  }
15178
15194
  `;
15195
+ var ErrorText = (0, import_styled_components86.styled)(Text)`
15196
+ grid-area: error;
15197
+ `;
15179
15198
  var StyledErrorList = import_styled_components86.styled.ul`
15180
15199
  margin: 0;
15181
15200
  padding: 0;
@@ -15183,17 +15202,19 @@ var StyledErrorList = import_styled_components86.styled.ul`
15183
15202
  display: flex;
15184
15203
  flex-direction: column;
15185
15204
  gap: var(--wui-space-01);
15205
+ grid-area: error;
15186
15206
  `;
15187
15207
  var ErrorMessages = ({ errors, id }) => {
15188
15208
  const isErrorArray = (0, import_type_guards49.isArray)(errors);
15189
15209
  const isMultipleErrors = isErrorArray && errors.length > 1;
15190
15210
  if (!isErrorArray) {
15191
15211
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15192
- Text,
15212
+ ErrorText,
15193
15213
  {
15194
15214
  colorScheme: "error",
15195
15215
  id,
15196
15216
  prominence: "secondary",
15217
+ style: { gridArea: "error" },
15197
15218
  variant: "label4",
15198
15219
  children: errors
15199
15220
  },
@@ -15202,11 +15223,12 @@ var ErrorMessages = ({ errors, id }) => {
15202
15223
  }
15203
15224
  if (!isMultipleErrors) {
15204
15225
  return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15205
- Text,
15226
+ ErrorText,
15206
15227
  {
15207
15228
  colorScheme: "error",
15208
15229
  id,
15209
15230
  prominence: "secondary",
15231
+ style: { gridArea: "error" },
15210
15232
  variant: "label4",
15211
15233
  children: errors[0]
15212
15234
  },
@@ -15247,12 +15269,16 @@ var FormField = ({
15247
15269
  const descriptionId = `${computedId}-description`;
15248
15270
  const errorId = `${computedId}-error`;
15249
15271
  const ariaDescribedby = [descriptionId, errorId].filter(Boolean).join(" ") || void 0;
15272
+ const hasDescription = (0, import_type_guards49.isNotNil)(description);
15273
+ const hasError = (0, import_type_guards49.isNotNil)(computedError);
15274
+ const shouldRenderLabelDescriptionWrapper = !isIntegratedLabel || hasDescription;
15250
15275
  let childProps = {
15251
15276
  name,
15252
15277
  id: computedId,
15253
15278
  label: isIntegratedLabel ? label : void 0,
15254
15279
  "aria-describedby": ariaDescribedby,
15255
- "aria-invalid": (0, import_type_guards49.isNotNil)(computedError),
15280
+ "aria-invalid": hasError,
15281
+ style: { gridArea: "input" },
15256
15282
  ...props
15257
15283
  };
15258
15284
  if ((0, import_type_guards49.isUndefined)(value) && (0, import_type_guards49.isNotUndefined)(defaultValue)) {
@@ -15282,28 +15308,38 @@ var FormField = ({
15282
15308
  StyledFormField,
15283
15309
  {
15284
15310
  ...props,
15311
+ $hasError: hasError,
15285
15312
  "data-label-position": labelPosition ?? formState.labelPosition,
15286
15313
  children: [
15287
- !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15288
- Label,
15314
+ shouldRenderLabelDescriptionWrapper ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(
15315
+ Stack,
15289
15316
  {
15290
- htmlFor: computedId,
15291
- required,
15292
- children: label
15317
+ direction: "vertical",
15318
+ gap: "space-01",
15319
+ style: {
15320
+ gridArea: "label-description"
15321
+ },
15322
+ children: [
15323
+ !isIntegratedLabel && /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15324
+ Label,
15325
+ {
15326
+ htmlFor: computedId,
15327
+ required,
15328
+ children: label
15329
+ }
15330
+ ),
15331
+ hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null
15332
+ ]
15293
15333
  }
15294
- ),
15295
- (0, import_type_guards49.isNotNil)(description) ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
15334
+ ) : null,
15296
15335
  (0, import_react73.cloneElement)(children, childProps),
15297
- (0, import_type_guards49.isNotNil)(computedError) ? /* @__PURE__ */ (0, import_jsx_runtime288.jsxs)(import_jsx_runtime288.Fragment, { children: [
15298
- /* @__PURE__ */ (0, import_jsx_runtime288.jsx)("div", {}),
15299
- /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15300
- ErrorMessages,
15301
- {
15302
- errors: computedError,
15303
- id: errorId
15304
- }
15305
- )
15306
- ] }) : null
15336
+ hasError ? /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
15337
+ ErrorMessages,
15338
+ {
15339
+ errors: computedError,
15340
+ id: errorId
15341
+ }
15342
+ ) : null
15307
15343
  ]
15308
15344
  }
15309
15345
  );
@@ -17686,7 +17722,6 @@ var Table = ({
17686
17722
  };
17687
17723
 
17688
17724
  // src/components/Table/TableBody.tsx
17689
- var import_react93 = require("react");
17690
17725
  var import_styled_components116 = require("styled-components");
17691
17726
 
17692
17727
  // src/components/Table/TableSectionContext.ts
@@ -17701,7 +17736,7 @@ var TableBody = ({ children, ...props }) => {
17701
17736
  };
17702
17737
 
17703
17738
  // src/components/Table/TableCell.tsx
17704
- var import_react94 = require("react");
17739
+ var import_react93 = require("react");
17705
17740
  var import_styled_components117 = require("styled-components");
17706
17741
  var import_jsx_runtime321 = require("react/jsx-runtime");
17707
17742
  var sharedStyles = import_styled_components117.css`
@@ -17722,7 +17757,7 @@ var StyledTd = import_styled_components117.styled.td`
17722
17757
  line-height: var(--wui-typography-body-2-line-height);
17723
17758
  `;
17724
17759
  var TableCell = ({ children, ...props }) => {
17725
- const section = (0, import_react94.useContext)(TableSectionContext);
17760
+ const section = (0, import_react93.useContext)(TableSectionContext);
17726
17761
  if (section === "head") {
17727
17762
  return /* @__PURE__ */ (0, import_jsx_runtime321.jsx)(StyledTh, { ...props, children });
17728
17763
  }
@@ -17730,7 +17765,6 @@ var TableCell = ({ children, ...props }) => {
17730
17765
  };
17731
17766
 
17732
17767
  // src/components/Table/TableFoot.tsx
17733
- var import_react95 = require("react");
17734
17768
  var import_styled_components118 = require("styled-components");
17735
17769
  var import_jsx_runtime322 = require("react/jsx-runtime");
17736
17770
  var StyledTableFoot = import_styled_components118.styled.tfoot``;
@@ -17739,7 +17773,6 @@ var TableFoot = ({ children, ...props }) => {
17739
17773
  };
17740
17774
 
17741
17775
  // src/components/Table/TableHead.tsx
17742
- var import_react96 = require("react");
17743
17776
  var import_styled_components119 = require("styled-components");
17744
17777
  var import_jsx_runtime323 = require("react/jsx-runtime");
17745
17778
  var StyledThead = import_styled_components119.styled.thead``;
@@ -17757,15 +17790,15 @@ var TableRow = ({ children, ...props }) => {
17757
17790
 
17758
17791
  // src/components/Tabs/Tabs.tsx
17759
17792
  var import_react_tabs = require("@radix-ui/react-tabs");
17760
- var import_react98 = require("react");
17793
+ var import_react95 = require("react");
17761
17794
  var import_type_guards68 = require("@wistia/type-guards");
17762
17795
 
17763
17796
  // src/components/Tabs/useTabsValue.tsx
17764
- var import_react97 = require("react");
17765
- var TabsValueContext = (0, import_react97.createContext)(null);
17797
+ var import_react94 = require("react");
17798
+ var TabsValueContext = (0, import_react94.createContext)(null);
17766
17799
  var TabsValueProvider = TabsValueContext.Provider;
17767
17800
  var useTabsValue = () => {
17768
- const context = (0, import_react97.useContext)(TabsValueContext);
17801
+ const context = (0, import_react94.useContext)(TabsValueContext);
17769
17802
  if (context === null) {
17770
17803
  throw new Error("useTabsValue must be used within a TabsValueProvider");
17771
17804
  }
@@ -17781,8 +17814,8 @@ var Tabs = ({
17781
17814
  defaultValue,
17782
17815
  ...props
17783
17816
  }) => {
17784
- const [value, setValue] = (0, import_react98.useState)(valueProp ?? defaultValue);
17785
- const onValueChange = (0, import_react98.useCallback)(
17817
+ const [value, setValue] = (0, import_react95.useState)(valueProp ?? defaultValue);
17818
+ const onValueChange = (0, import_react95.useCallback)(
17786
17819
  (newValue) => {
17787
17820
  setValue(newValue);
17788
17821
  if (onValueChangeProp) {
@@ -17866,7 +17899,7 @@ var TabsList = ({ children, fullWidth = true, ...props }) => {
17866
17899
  TabsList.displayName = "TabsList_UI";
17867
17900
 
17868
17901
  // src/components/Tabs/TabsTrigger.tsx
17869
- var import_react99 = require("react");
17902
+ var import_react96 = require("react");
17870
17903
  var import_type_guards70 = require("@wistia/type-guards");
17871
17904
 
17872
17905
  // src/components/Tabs/StyledRadixTabsTrigger.tsx
@@ -17882,13 +17915,13 @@ var StyledRadixTabsTrigger = (0, import_styled_components123.styled)(import_reac
17882
17915
 
17883
17916
  // src/components/Tabs/TabsTrigger.tsx
17884
17917
  var import_jsx_runtime329 = require("react/jsx-runtime");
17885
- var TabsTrigger = (0, import_react99.forwardRef)(
17918
+ var TabsTrigger = (0, import_react96.forwardRef)(
17886
17919
  ({ disabled = false, icon, label, "aria-label": ariaLabel, value, ...otherProps }, forwardedRef) => {
17887
17920
  const selectedValue = useTabsValue();
17888
17921
  const { setSelectedItemMeasurements } = useSelectedItemStyle();
17889
- const buttonRef = (0, import_react99.useRef)(null);
17922
+ const buttonRef = (0, import_react96.useRef)(null);
17890
17923
  const combinedRef = mergeRefs([buttonRef, forwardedRef]);
17891
- (0, import_react99.useEffect)(() => {
17924
+ (0, import_react96.useEffect)(() => {
17892
17925
  const buttonElem = buttonRef.current;
17893
17926
  if (!buttonElem) {
17894
17927
  return void 0;
@@ -17970,7 +18003,7 @@ var ThumbnailBadge = ({ icon, label, ...props }) => {
17970
18003
  ThumbnailBadge.displayName = "ThumbnailBadge_UI";
17971
18004
 
17972
18005
  // src/components/Thumbnail/Thumbnail.tsx
17973
- var import_react100 = require("react");
18006
+ var import_react97 = require("react");
17974
18007
  var import_styled_components127 = require("styled-components");
17975
18008
  var import_type_guards74 = require("@wistia/type-guards");
17976
18009
 
@@ -18352,7 +18385,7 @@ var getRelativeMousePosition = (elem, mouseEvent) => {
18352
18385
  var hasValidThumbnailUrl = (thumbnailUrl) => {
18353
18386
  return (0, import_type_guards74.isNotNil)(thumbnailUrl) && (0, import_type_guards74.isNonEmptyString)(thumbnailUrl);
18354
18387
  };
18355
- var Thumbnail = (0, import_react100.forwardRef)(
18388
+ var Thumbnail = (0, import_react97.forwardRef)(
18356
18389
  ({
18357
18390
  gradientBackground = "defaultMidOne",
18358
18391
  thumbnailImageType = "wide",
@@ -18364,17 +18397,17 @@ var Thumbnail = (0, import_react100.forwardRef)(
18364
18397
  aspectRatio = "wide",
18365
18398
  ...props
18366
18399
  }, ref) => {
18367
- const [percent, setPercent] = (0, import_react100.useState)(0);
18368
- const [isMouseOver, setIsMouseOver] = (0, import_react100.useState)(false);
18369
- const [isStoryboardReady, setIsStoryboardReady] = (0, import_react100.useState)(false);
18370
- const storyboardElementRef = (0, import_react100.useRef)(null);
18371
- const [cursorPosition, setCursorPosition] = (0, import_react100.useState)(null);
18372
- const backgroundUrl = (0, import_react100.useMemo)(
18400
+ const [percent, setPercent] = (0, import_react97.useState)(0);
18401
+ const [isMouseOver, setIsMouseOver] = (0, import_react97.useState)(false);
18402
+ const [isStoryboardReady, setIsStoryboardReady] = (0, import_react97.useState)(false);
18403
+ const storyboardElementRef = (0, import_react97.useRef)(null);
18404
+ const [cursorPosition, setCursorPosition] = (0, import_react97.useState)(null);
18405
+ const backgroundUrl = (0, import_react97.useMemo)(
18373
18406
  () => thumbnailImageType === "square" && hasValidThumbnailUrl(thumbnailUrl) ? thumbnailUrl : void 0,
18374
18407
  [thumbnailImageType, thumbnailUrl]
18375
18408
  );
18376
18409
  const isScrubbable = (0, import_type_guards74.isNotNil)(storyboard);
18377
- const trackStoryboardLoadStatus = (0, import_react100.useCallback)(() => {
18410
+ const trackStoryboardLoadStatus = (0, import_react97.useCallback)(() => {
18378
18411
  if (storyboardElementRef.current || !storyboard) {
18379
18412
  return storyboardElementRef.current;
18380
18413
  }
@@ -18384,7 +18417,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
18384
18417
  storyboardElementRef.current = asset;
18385
18418
  return storyboardElementRef.current;
18386
18419
  }, [storyboard]);
18387
- const handleMouseMove = (0, import_react100.useCallback)(
18420
+ const handleMouseMove = (0, import_react97.useCallback)(
18388
18421
  (mouseEvent) => {
18389
18422
  if (!isScrubbable) return;
18390
18423
  const elem = mouseEvent.currentTarget;
@@ -18397,12 +18430,12 @@ var Thumbnail = (0, import_react100.forwardRef)(
18397
18430
  },
18398
18431
  [isScrubbable, trackStoryboardLoadStatus]
18399
18432
  );
18400
- const handleMouseOut = (0, import_react100.useCallback)(() => {
18433
+ const handleMouseOut = (0, import_react97.useCallback)(() => {
18401
18434
  if (!isScrubbable) return;
18402
18435
  setIsMouseOver(false);
18403
18436
  setCursorPosition(null);
18404
18437
  }, [isScrubbable]);
18405
- const shouldRenderStoryboard = (0, import_react100.useMemo)(() => {
18438
+ const shouldRenderStoryboard = (0, import_react97.useMemo)(() => {
18406
18439
  if ((0, import_type_guards74.isNil)(storyboard) || (0, import_type_guards74.isUndefined)(height) || (0, import_type_guards74.isEmptyString)(height)) {
18407
18440
  return false;
18408
18441
  }
@@ -18464,7 +18497,7 @@ var Thumbnail = (0, import_react100.forwardRef)(
18464
18497
  Thumbnail.displayName = "Thumbnail_UI";
18465
18498
 
18466
18499
  // src/components/ThumbnailCollage/ThumbnailCollage.tsx
18467
- var import_react101 = __toESM(require("react"));
18500
+ var import_react98 = require("react");
18468
18501
  var import_styled_components128 = require("styled-components");
18469
18502
  var import_type_guards75 = require("@wistia/type-guards");
18470
18503
  var import_jsx_runtime333 = (
@@ -18526,10 +18559,10 @@ var ThumbnailCollage = ({
18526
18559
  gradientBackground = "defaultMidOne",
18527
18560
  ...props
18528
18561
  }) => {
18529
- const thumbnailArray = import_react101.default.Children.toArray(children);
18562
+ const thumbnailArray = import_react98.Children.toArray(children);
18530
18563
  const truncatedThumbnails = thumbnailArray.slice(0, 3);
18531
18564
  const thumbnails = (0, import_type_guards75.isNonEmptyArray)(thumbnailArray) ? truncatedThumbnails.map((child) => {
18532
- return import_react101.default.cloneElement(child, {
18565
+ return (0, import_react98.cloneElement)(child, {
18533
18566
  ...child.props,
18534
18567
  children: void 0
18535
18568
  });
@@ -18682,7 +18715,7 @@ WistiaLogo.displayName = "WistiaLogo_UI";
18682
18715
  // src/components/SplitButton/SplitButton.tsx
18683
18716
  var import_styled_components130 = require("styled-components");
18684
18717
  var import_type_guards77 = require("@wistia/type-guards");
18685
- var import_react102 = require("react");
18718
+ var import_react99 = require("react");
18686
18719
  var import_jsx_runtime335 = require("react/jsx-runtime");
18687
18720
  var StyledSplitButton = import_styled_components130.styled.span`
18688
18721
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
@@ -18747,7 +18780,7 @@ var SplitButton = ({
18747
18780
  children: menuItems
18748
18781
  }
18749
18782
  ),
18750
- (0, import_type_guards77.isNotNil)(secondaryAction) && (0, import_react102.cloneElement)(secondaryAction, { disabled, size, unstyled, variant, colorScheme })
18783
+ (0, import_type_guards77.isNotNil)(secondaryAction) && (0, import_react99.cloneElement)(secondaryAction, { disabled, size, unstyled, variant, colorScheme })
18751
18784
  ] });
18752
18785
  };
18753
18786
  SplitButton.displayName = "SplitButton_UI";