@wistia/ui 1.0.0-beta.7e3f4bc4.ad9b5a1 → 1.0.0-beta.9784e305.cecb9b2

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v1.0.0-beta.7e3f4bc4.ad9b5a1
3
+ * @license @wistia/ui v1.0.0-beta.9784e305.cecb9b2
4
4
  *
5
5
  * Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -243,7 +243,7 @@ const AriaLiveProvider = ({ children, debug = false }) => {
243
243
  liveRegion.setAttribute("aria-live", "polite");
244
244
  liveRegion.setAttribute("aria-atomic", "true");
245
245
  Object.assign(liveRegion.style, debug ? debugStyle : visuallyHiddenStyle);
246
- document.body.appendChild(liveRegion);
246
+ document.body.append(liveRegion);
247
247
  liveRegionRef.current = liveRegion;
248
248
  return () => {
249
249
  if (liveRegionRef.current) document.body.removeChild(liveRegionRef.current);
@@ -727,14 +727,14 @@ const parseDateString = (str) => {
727
727
  if (lower === "today") return startOfToday();
728
728
  if (lower === "tomorrow") return startOfTomorrow();
729
729
  const monthIndex = MONTH_NAMES.findIndex((name) => name.toLowerCase().startsWith(lower));
730
- if (monthIndex > -1) {
730
+ if (monthIndex !== -1) {
731
731
  const today = startOfToday();
732
732
  let date = new Date(today.getFullYear(), monthIndex, 1);
733
733
  if (isPast(date)) date = new Date(today.getFullYear() + 1, monthIndex, 1);
734
734
  return startOfDay(date);
735
735
  }
736
736
  const referenceDate = /* @__PURE__ */ new Date();
737
- const parsedDate = DATE_FORMATS.map((fmt) => parse(trimmed, fmt, referenceDate)).find(isValid);
737
+ const parsedDate = DATE_FORMATS.map((fmt) => parse(trimmed, fmt, referenceDate)).find((date) => isValid(date));
738
738
  if (parsedDate !== void 0) return startOfDay(parsedDate);
739
739
  const native = new Date(trimmed);
740
740
  if (isValid(native)) return startOfDay(native);
@@ -775,9 +775,9 @@ const getLocalDateParts = (date) => {
775
775
  const dayPart = parts.find((part) => part.type === "day");
776
776
  if (isNil(yearPart) || isNil(monthPart) || isNil(dayPart)) throw new Error("Failed to parse date parts");
777
777
  return {
778
- year: parseInt(yearPart.value, 10),
779
- month: parseInt(monthPart.value, 10),
780
- day: parseInt(dayPart.value, 10)
778
+ year: Number.parseInt(yearPart.value, 10),
779
+ month: Number.parseInt(monthPart.value, 10),
780
+ day: Number.parseInt(dayPart.value, 10)
781
781
  };
782
782
  };
783
783
  //#endregion
@@ -1298,7 +1298,7 @@ const isTabbableElement = (element) => {
1298
1298
  const tabIndex = getElementTabIndex(element);
1299
1299
  return (isTabIndexNaN(element) || tabIndex >= 0) && isFocusableElement(element);
1300
1300
  };
1301
- const findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter(isTabbableElement);
1301
+ const findTabbableDescendants = (element) => Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((el) => isTabbableElement(el));
1302
1302
  const focusLaterElements = [];
1303
1303
  let focusElement = null;
1304
1304
  let needToFocus = false;
@@ -1338,7 +1338,7 @@ const teardownScopedFocus = () => {
1338
1338
  };
1339
1339
  const scopeTab = (node, event) => {
1340
1340
  const tabbable = findTabbableDescendants(node);
1341
- if (!tabbable.length) {
1341
+ if (!isNonEmptyArray(tabbable)) {
1342
1342
  event.preventDefault();
1343
1343
  return;
1344
1344
  }
@@ -1390,7 +1390,7 @@ const useFocusTrap = (active = true, options = {}) => {
1390
1390
  else focusElement = typeof options.focusSelector === "string" ? node2.querySelector(options.focusSelector) : options.focusSelector;
1391
1391
  if (!focusElement) {
1392
1392
  const children = Array.from(node2.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS));
1393
- focusElement = children.find(isTabbableElement) ?? children.find(isFocusableElement) ?? null;
1393
+ focusElement = children.find((element) => isTabbableElement(element)) ?? children.find((element) => isFocusableElement(element)) ?? null;
1394
1394
  if (!focusElement && isFocusableElement(node2)) focusElement = node2;
1395
1395
  }
1396
1396
  if (focusElement) focusElement.focus();
@@ -5806,7 +5806,7 @@ const containsEmojiCharacter = (char) => {
5806
5806
  };
5807
5807
  const formatNameForDisplay = (name) => {
5808
5808
  if (isNil(name) || !isString(name) || isEmptyString(name) || containsEmojiCharacter(name)) return "U";
5809
- return name.trim().substring(0, 1).toUpperCase();
5809
+ return name.trim().slice(0, 1).toUpperCase();
5810
5810
  };
5811
5811
  //#endregion
5812
5812
  //#region src/components/Image/Image.tsx
@@ -8850,7 +8850,7 @@ const isValidHexChar = (char) => {
8850
8850
  const normalizeHexInput = (input) => {
8851
8851
  let cleaned = input.trim();
8852
8852
  if (!cleaned.startsWith("#")) cleaned = `#${cleaned}`;
8853
- cleaned = `#${cleaned.slice(1).replace(/#/g, "")}`;
8853
+ cleaned = `#${cleaned.slice(1).replaceAll("#", "")}`;
8854
8854
  return cleaned.slice(0, SIX_DIGIT_HEX_CODE_LENGTH).toLocaleLowerCase();
8855
8855
  };
8856
8856
  /**
@@ -9752,7 +9752,7 @@ const Combobox = ({ placeholder, value, onChange, searchValue, onSearchValueChan
9752
9752
  style: { opacity: value.includes(match) ? 1 : 0 },
9753
9753
  type: "checkmark"
9754
9754
  })]
9755
- }, match)), !matches.length && /* @__PURE__ */ jsx(NoResults, { children: "No results found" })]
9755
+ }, match)), !isNonEmptyArray(matches) && /* @__PURE__ */ jsx(NoResults, { children: "No results found" })]
9756
9756
  })]
9757
9757
  });
9758
9758
  };
@@ -12561,7 +12561,7 @@ const isValidSecond = (number) => Number.isFinite(number) && number >= 0 && numb
12561
12561
  const durationValueToSeconds = (formattedTimeString) => {
12562
12562
  const segments = formattedTimeString.split(":");
12563
12563
  if (segments.length <= 3) {
12564
- const [seconds = 0, minutes = 0, hours = 0] = segments.reverse().map(Number);
12564
+ const [seconds = 0, minutes = 0, hours = 0] = segments.toReversed().map(Number);
12565
12565
  if (isValidSecond(seconds) && isValidMinute(minutes) && isValidHour(hours)) return hours * SECONDS_PER_HOUR + minutes * SECONDS_PER_MINUTE + seconds;
12566
12566
  }
12567
12567
  throw new SyntaxError(`Invalid time (${formattedTimeString})`);
@@ -13504,11 +13504,11 @@ const renderListFromArray = (listItems, variant, otherProps) => {
13504
13504
  const List = ({ children, items, variant, ...otherProps }) => {
13505
13505
  const listVariant = variant ?? "bullets";
13506
13506
  if (isNotNil(children)) {
13507
- if (Array.isArray(children) && !children.length) return null;
13507
+ if (Array.isArray(children) && !isNonEmptyArray(children)) return null;
13508
13508
  return renderListComponent(children, listVariant, otherProps);
13509
13509
  }
13510
13510
  if (isNotNil(items)) {
13511
- if (!items.length) return null;
13511
+ if (!isNonEmptyArray(items)) return null;
13512
13512
  return renderListFromArray(items, listVariant, otherProps);
13513
13513
  }
13514
13514
  return null;
@@ -14116,7 +14116,7 @@ const nodeToString = (node) => {
14116
14116
  if (typeof node === "string") return node;
14117
14117
  if (typeof node === "number") return String(node);
14118
14118
  if (node == null || typeof node === "boolean") return "";
14119
- if (Array.isArray(node)) return node.map(nodeToString).join("");
14119
+ if (Array.isArray(node)) return node.map((child) => nodeToString(child)).join("");
14120
14120
  if (typeof node === "object" && "props" in node) {
14121
14121
  const element = node;
14122
14122
  if (element.props?.children != null) return nodeToString(element.props.children);
@@ -15632,7 +15632,7 @@ const StyledSidebarGroupList = styled.ul`
15632
15632
  const isLabelChild = (child) => isValidElement(child) && child.type === SidebarGroupLabel;
15633
15633
  const SidebarGroup = ({ children }) => {
15634
15634
  const childArray = Children.toArray(children);
15635
- const labels = childArray.filter(isLabelChild);
15635
+ const labels = childArray.filter((child) => isLabelChild(child));
15636
15636
  const items = childArray.filter((child) => isValidElement(child) && !isLabelChild(child));
15637
15637
  return /* @__PURE__ */ jsxs(StyledSidebarGroup, {
15638
15638
  "data-wui-sidebar-group": true,
@@ -16269,7 +16269,7 @@ const StyledThumbnail = styled.div`
16269
16269
  `;
16270
16270
  const StoryboardRenderer = ({ storyboard, width, percent, cursorPosition, isStoryboardReady, aspectRatio }) => {
16271
16271
  const { url, width: sbWidth, height: sbHeight, frameHeight, frameWidth, frameCount } = storyboard;
16272
- const targetWidth = isString(width) ? parseInt(width, 10) : Number(width);
16272
+ const targetWidth = isString(width) ? Number.parseInt(width, 10) : Number(width);
16273
16273
  return /* @__PURE__ */ jsx(ThumbnailStoryboardViewer, {
16274
16274
  cursorPosition: isStoryboardReady ? cursorPosition : null,
16275
16275
  frameCount,