@wistia/ui 1.4.3-beta.3cc1e54c.8ccab4f → 1.4.3-beta.7c6e51ca.e365e2e

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.4.3-beta.3cc1e54c.8ccab4f
3
+ * @license @wistia/ui v1.4.3-beta.7c6e51ca.e365e2e
4
4
  *
5
5
  * Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -72,9 +72,8 @@ const designTokens = css`
72
72
  ${"/*\n * Legacy typography sub-property aliases\n *\n * Terrazzo's plugin-css emits typography composite sub-properties using DTCG\n * names verbatim (kebab-cased):\n * --wui-typography-<style>-font-family\n * --wui-typography-<style>-font-size\n * --wui-typography-<style>-font-weight\n *\n * Prior versions of @wistia/ui exposed shortened legacy names:\n * --wui-typography-<style>-family\n * --wui-typography-<style>-size\n * --wui-typography-<style>-weight\n *\n * These aliases preserve that surface so downstream apps (notably wistia/wistia)\n * keep working unchanged after the Terrazzo migration. Once all known consumers\n * have migrated to the DTCG names, delete this file and remove the import from\n * designTokens/index.tsx.\n *\n * Note: `line-height` and `paragraph-spacing` sub-properties are unchanged\n * between DTCG and the prior surface, so no aliases are required for those.\n *\n * --------------------------------------------------------------------------\n * Migrating consumers in wistia/wistia (run from the VMA repo root):\n *\n * # 1. List every legacy reference site:\n * grep -rnE --include='*.ts' --include='*.tsx' --include='*.css' \\\n * '--wui-typography-(heading-hero|heading-[0-9]|body-[0-9]|label-[0-9])-(family|size|weight)' \\\n * frontend\n *\n * # 2. Apply the rename in-place (BSD sed on macOS):\n * grep -rlE --include='*.ts' --include='*.tsx' --include='*.css' \\\n * '--wui-typography-(heading-hero|heading-[0-9]|body-[0-9]|label-[0-9])-(family|size|weight)' \\\n * frontend \\\n * | xargs sed -i '' -E \\\n * 's/(--wui-typography-(heading-hero|heading-[0-9]|body-[0-9]|label-[0-9]))-(family|size|weight)/\\1-font-\\3/g'\n *\n * # 3. (GNU sed / Linux variant — drop the empty '' after -i):\n * # ... | xargs sed -i -E '...'\n *\n * Special case: frontend/authentication/css/redesign/wistia-ui/design-tokens/\n * typography.css *defines* the legacy names itself (not consumed from\n * @wistia/ui). It will keep working post-rename, but should be migrated for\n * consistency.\n * --------------------------------------------------------------------------\n */\n:root,\n[data-wui-theme='true'] {\n --wui-typography-heading-hero-family: var(--wui-typography-heading-hero-font-family);\n --wui-typography-heading-hero-size: var(--wui-typography-heading-hero-font-size);\n --wui-typography-heading-hero-weight: var(--wui-typography-heading-hero-font-weight);\n --wui-typography-heading-1-family: var(--wui-typography-heading-1-font-family);\n --wui-typography-heading-1-size: var(--wui-typography-heading-1-font-size);\n --wui-typography-heading-1-weight: var(--wui-typography-heading-1-font-weight);\n --wui-typography-heading-2-family: var(--wui-typography-heading-2-font-family);\n --wui-typography-heading-2-size: var(--wui-typography-heading-2-font-size);\n --wui-typography-heading-2-weight: var(--wui-typography-heading-2-font-weight);\n --wui-typography-heading-3-family: var(--wui-typography-heading-3-font-family);\n --wui-typography-heading-3-size: var(--wui-typography-heading-3-font-size);\n --wui-typography-heading-3-weight: var(--wui-typography-heading-3-font-weight);\n --wui-typography-heading-4-family: var(--wui-typography-heading-4-font-family);\n --wui-typography-heading-4-size: var(--wui-typography-heading-4-font-size);\n --wui-typography-heading-4-weight: var(--wui-typography-heading-4-font-weight);\n --wui-typography-heading-5-family: var(--wui-typography-heading-5-font-family);\n --wui-typography-heading-5-size: var(--wui-typography-heading-5-font-size);\n --wui-typography-heading-5-weight: var(--wui-typography-heading-5-font-weight);\n --wui-typography-heading-6-family: var(--wui-typography-heading-6-font-family);\n --wui-typography-heading-6-size: var(--wui-typography-heading-6-font-size);\n --wui-typography-heading-6-weight: var(--wui-typography-heading-6-font-weight);\n --wui-typography-body-1-family: var(--wui-typography-body-1-font-family);\n --wui-typography-body-1-size: var(--wui-typography-body-1-font-size);\n --wui-typography-body-1-weight: var(--wui-typography-body-1-font-weight);\n --wui-typography-body-2-family: var(--wui-typography-body-2-font-family);\n --wui-typography-body-2-size: var(--wui-typography-body-2-font-size);\n --wui-typography-body-2-weight: var(--wui-typography-body-2-font-weight);\n --wui-typography-body-3-family: var(--wui-typography-body-3-font-family);\n --wui-typography-body-3-size: var(--wui-typography-body-3-font-size);\n --wui-typography-body-3-weight: var(--wui-typography-body-3-font-weight);\n --wui-typography-body-4-family: var(--wui-typography-body-4-font-family);\n --wui-typography-body-4-size: var(--wui-typography-body-4-font-size);\n --wui-typography-body-4-weight: var(--wui-typography-body-4-font-weight);\n --wui-typography-label-1-family: var(--wui-typography-label-1-font-family);\n --wui-typography-label-1-size: var(--wui-typography-label-1-font-size);\n --wui-typography-label-1-weight: var(--wui-typography-label-1-font-weight);\n --wui-typography-label-2-family: var(--wui-typography-label-2-font-family);\n --wui-typography-label-2-size: var(--wui-typography-label-2-font-size);\n --wui-typography-label-2-weight: var(--wui-typography-label-2-font-weight);\n --wui-typography-label-3-family: var(--wui-typography-label-3-font-family);\n --wui-typography-label-3-size: var(--wui-typography-label-3-font-size);\n --wui-typography-label-3-weight: var(--wui-typography-label-3-font-weight);\n --wui-typography-label-4-family: var(--wui-typography-label-4-font-family);\n --wui-typography-label-4-size: var(--wui-typography-label-4-font-size);\n --wui-typography-label-4-weight: var(--wui-typography-label-4-font-weight);\n}\n"}
73
73
  `;
74
74
  //#endregion
75
- //#region src/css/GlobalStyle.tsx
76
- const GlobalStyle = createGlobalStyle`
77
- ${css`
75
+ //#region src/css/globalStyleAdjustmentsCss.tsx
76
+ const globalStyleAdjustmentsCss = css`
78
77
  /**
79
78
  * 1. Change from 'content-box' so that 'width' calculations are unaffected by 'padding' or 'border'
80
79
  See: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
@@ -206,7 +205,11 @@ const GlobalStyle = createGlobalStyle`
206
205
  scroll-behavior: auto !important;
207
206
  }
208
207
  }
209
- `}
208
+ `;
209
+ //#endregion
210
+ //#region src/css/GlobalStyle.tsx
211
+ const GlobalStyle = createGlobalStyle`
212
+ ${globalStyleAdjustmentsCss}
210
213
  ${designTokens}
211
214
  ${clickRegionGlobalStyles}
212
215
  `;
@@ -263,8 +266,9 @@ const AriaLiveProvider = ({ children, debug = false }) => {
263
266
  setTimeout(() => setMessage(null), 1e3);
264
267
  }
265
268
  }, []);
269
+ const value = useMemo(() => ({ announce }), [announce]);
266
270
  return /* @__PURE__ */ jsx(AriaLiveContext, {
267
- value: useMemo(() => ({ announce }), [announce]),
271
+ value,
268
272
  children
269
273
  });
270
274
  };
@@ -346,7 +350,7 @@ const copyToClipboard = async (textToCopy) => {
346
350
  const defaultLocales = ["en-US"];
347
351
  const defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
348
352
  const milisecondsInSecond = 1e3;
349
- const millisecondsInDay = 1440 * 60 * milisecondsInSecond;
353
+ const millisecondsInDay = 86400 * milisecondsInSecond;
350
354
  //#endregion
351
355
  //#region src/helpers/dateTime/buildTimeDuration.ts
352
356
  /**
@@ -1157,7 +1161,8 @@ const DEFAULT_GRADIENT = "defaultMidOne";
1157
1161
  const getSemiRandomBackgroundGradient = (id) => {
1158
1162
  if (!(typeof id === "string" && id)) return gradientMap[0] ?? DEFAULT_GRADIENT;
1159
1163
  const hashCode = [...id].reduce((num, char) => Math.imul(MULTIPLIER, num) + (char.codePointAt(0) ?? 0) || 0, 0);
1160
- return gradientMap[Math.abs(hashCode) % gradientMap.length] ?? DEFAULT_GRADIENT;
1164
+ const index = Math.abs(hashCode) % gradientMap.length;
1165
+ return gradientMap[index] ?? DEFAULT_GRADIENT;
1161
1166
  };
1162
1167
  //#endregion
1163
1168
  //#region src/helpers/mergeRefs/mergeRefs.ts
@@ -1320,10 +1325,11 @@ const useElementObserver = () => {
1320
1325
  * @param config Optional configuration for the file picker
1321
1326
  */
1322
1327
  const useFilePicker = (config = {}) => {
1323
- return useFilePicker$1({
1328
+ const finalConfig = {
1324
1329
  readFilesContent: false,
1325
1330
  ...config
1326
- });
1331
+ };
1332
+ return useFilePicker$1(finalConfig);
1327
1333
  };
1328
1334
  /**
1329
1335
  * Hook that wraps `useImperativeFilePicker` from the use-file-picker library
@@ -1331,10 +1337,11 @@ const useFilePicker = (config = {}) => {
1331
1337
  * @param config Optional configuration for the imperative file picker
1332
1338
  */
1333
1339
  const useImperativeFilePicker = (config = {}) => {
1334
- return useImperativeFilePicker$1({
1340
+ const finalConfig = {
1335
1341
  readFilesContent: false,
1336
1342
  ...config
1337
- });
1343
+ };
1344
+ return useImperativeFilePicker$1(finalConfig);
1338
1345
  };
1339
1346
  //#endregion
1340
1347
  //#region src/hooks/useFocusTrap/helpers.ts
@@ -1570,7 +1577,7 @@ const useEvent = (eventName, eventHandler, eventTarget = typeof document !== "un
1570
1577
  //#endregion
1571
1578
  //#region src/hooks/useKey/useKey.ts
1572
1579
  const useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOptions } = {}) => {
1573
- useEvent(eventName, useCallback((handlerEvent) => {
1580
+ const memoizedEventHandler = useCallback((handlerEvent) => {
1574
1581
  if ([
1575
1582
  "INPUT",
1576
1583
  "TEXTAREA",
@@ -1582,7 +1589,8 @@ const useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOp
1582
1589
  else if (key) matchesKey = true;
1583
1590
  else matchesKey = false;
1584
1591
  if (matchesKey) eventHandler(handlerEvent);
1585
- }, [key, eventHandler]), eventTarget, eventOptions);
1592
+ }, [key, eventHandler]);
1593
+ useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
1586
1594
  };
1587
1595
  //#endregion
1588
1596
  //#region src/private/hooks/useUpdateEffect/useUpdateEffect.ts
@@ -6097,7 +6105,8 @@ const chooseColorScheme = (name) => {
6097
6105
  for (let i = 0; i < str.length; i += 1) sum = Math.trunc(Math.imul(multiplier, sum) + (str.codePointAt(i) ?? 0));
6098
6106
  return sum;
6099
6107
  };
6100
- return brandColorSchemeOptions[Math.abs(hashCode(name)) % brandColorSchemeOptions.length] ?? "blue";
6108
+ const index = Math.abs(hashCode(name)) % brandColorSchemeOptions.length;
6109
+ return brandColorSchemeOptions[index] ?? "blue";
6101
6110
  };
6102
6111
  /**
6103
6112
  * An avatar uses a photo or initials to represent an identity.
@@ -6405,7 +6414,8 @@ const applyMaxCharsToChildren = (children, maxChars) => {
6405
6414
  if (isNil(maxChars)) return children;
6406
6415
  if (isString(children)) return truncateString(children, maxChars);
6407
6416
  if (isNumber(children)) return truncateString(String(children), maxChars);
6408
- return truncateString(typeof children === "object" ? JSON.stringify(children) : String(children), maxChars);
6417
+ const textContent = typeof children === "object" ? JSON.stringify(children) : String(children);
6418
+ return truncateString(textContent, maxChars);
6409
6419
  };
6410
6420
  const variantStyleMap$1 = {
6411
6421
  hero: css`
@@ -6847,6 +6857,7 @@ const Breadcrumbs = ({ children, ...props }) => {
6847
6857
  const { isXsAndDown } = useMq();
6848
6858
  let crumbs = Children.toArray(children);
6849
6859
  if (isXsAndDown) crumbs = crumbs.slice(-1);
6860
+ const crumbMaxWidth = Math.floor(100 / crumbs.length) - BUFFER_WIDTH;
6850
6861
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", {
6851
6862
  type: "text/css",
6852
6863
  children: `
@@ -6857,7 +6868,7 @@ const Breadcrumbs = ({ children, ...props }) => {
6857
6868
 
6858
6869
  @container breadcrumbs (width < 100vw) {
6859
6870
  [data-wui-breadcrumb] {
6860
- max-width: ${Math.floor(100 / crumbs.length) - BUFFER_WIDTH}cqw;
6871
+ max-width: ${crumbMaxWidth}cqw;
6861
6872
  }
6862
6873
  }
6863
6874
  `
@@ -7626,10 +7637,11 @@ const compositeOverWhite = (color, alpha = 1) => {
7626
7637
  const calculateContrast = ({ backgroundColor, foregroundColor = DEFAULT_COLOR_FOR_COMPARISON, backgroundOpacity = 1 }) => {
7627
7638
  const backgroundColorAsRgb = convertToRgb(backgroundColor);
7628
7639
  const foregroundColorAsRgb = convertToRgb(foregroundColor);
7629
- return wcagContrast(compositeOverWhite(backgroundColorAsRgb, backgroundOpacity), foregroundColorAsRgb);
7640
+ const compositeBackground = compositeOverWhite(backgroundColorAsRgb, backgroundOpacity);
7641
+ return wcagContrast(compositeBackground, foregroundColorAsRgb);
7630
7642
  };
7631
7643
  const snapValueToEdges = (value) => {
7632
- if (value > 1 - VALUE_CHANNEL_SNAP_EPSILON) return 1;
7644
+ if (value > .9995) return 1;
7633
7645
  if (value < VALUE_CHANNEL_SNAP_EPSILON) return 0;
7634
7646
  return value;
7635
7647
  };
@@ -9333,9 +9345,10 @@ const drawGradientBackground = (ctx, width, height, hue) => {
9333
9345
  for (let y = 0; y < height; y++) {
9334
9346
  const v = 1 - y / (height - 1);
9335
9347
  for (let x = 0; x < width; x++) {
9348
+ const s = x / (width - 1);
9336
9349
  const rgb = convertToRgb({
9337
9350
  h: hue,
9338
- s: x / (width - 1),
9351
+ s,
9339
9352
  v,
9340
9353
  mode: "hsv"
9341
9354
  });
@@ -10703,10 +10716,11 @@ const useCreatePopoverAnchorRef = () => useRef(null);
10703
10716
  */
10704
10717
  const PopoverAnchor = ({ children }) => {
10705
10718
  const sharedRef = usePopoverAnchor();
10719
+ const callbackRef = useCallback((node) => {
10720
+ if (sharedRef) sharedRef.current = node;
10721
+ }, [sharedRef]);
10706
10722
  return /* @__PURE__ */ jsx("div", {
10707
- ref: useCallback((node) => {
10708
- if (sharedRef) sharedRef.current = node;
10709
- }, [sharedRef]),
10723
+ ref: callbackRef,
10710
10724
  children
10711
10725
  });
10712
10726
  };
@@ -12755,13 +12769,11 @@ const InputClickToCopy = ({ value, onCopy, disabled = false, ref, ...props }) =>
12755
12769
  //#endregion
12756
12770
  //#region src/components/InputDuration/constants.ts
12757
12771
  const SECONDS_PER_MINUTE = 60;
12758
- const MINUTES_PER_HOUR = 60;
12759
- const MAX_MINUTES_UNIT_VALUE = SECONDS_PER_MINUTE - 1;
12760
- const SECONDS_PER_TEN_MINUTES = SECONDS_PER_MINUTE * 10;
12761
- const SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
12762
- const TEN_HOURS = SECONDS_PER_HOUR * 10;
12772
+ const MAX_MINUTES_UNIT_VALUE = 59;
12773
+ const SECONDS_PER_TEN_MINUTES = 600;
12774
+ const SECONDS_PER_HOUR = 3600;
12763
12775
  const ONE_HUNDREDTH_OF_A_SECOND = .01;
12764
- const MAX_TIME = TEN_HOURS - ONE_HUNDREDTH_OF_A_SECOND;
12776
+ const MAX_TIME = 35999.99;
12765
12777
  const NUMBER_STRING_SET = /* @__PURE__ */ new Set([
12766
12778
  "0",
12767
12779
  "1",
@@ -14083,7 +14095,8 @@ const StyledSubTrigger = styled(Menu$1.SubmenuTrigger)`
14083
14095
  const SUBMENU_CLOSE_DELAY = 200;
14084
14096
  const SubMenuTrigger = ({ icon, ...props }) => {
14085
14097
  const { isSmAndUp } = useMq();
14086
- return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger : Menu$1.Item, {
14098
+ const Trigger = isSmAndUp ? StyledSubTrigger : Menu$1.Item;
14099
+ return /* @__PURE__ */ jsx(Trigger, {
14087
14100
  nativeButton: true,
14088
14101
  ...isSmAndUp && { closeDelay: SUBMENU_CLOSE_DELAY },
14089
14102
  render: /* @__PURE__ */ jsx(MenuItemButton, {
@@ -14465,8 +14478,7 @@ const modalExit = keyframes`
14465
14478
  transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
14466
14479
  }
14467
14480
  `;
14468
- const positionStyleMap = {
14469
- centered: css`
14481
+ const centeredModalStyles = css`
14470
14482
  --wui-modal-screen-offset: var(--wui-space-05);
14471
14483
  --wui-modal-translate-y: -50%;
14472
14484
 
@@ -14481,8 +14493,8 @@ const positionStyleMap = {
14481
14493
  &[data-closed] {
14482
14494
  animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
14483
14495
  }
14484
- `,
14485
- "fixed-top": css`
14496
+ `;
14497
+ const fixedTopModalStyles = css`
14486
14498
  --wui-modal-screen-offset-top: 15vh;
14487
14499
  --wui-modal-screen-offset-bottom: 5vh;
14488
14500
  --wui-modal-translate-y: 0%;
@@ -14500,14 +14512,8 @@ const positionStyleMap = {
14500
14512
  &[data-closed] {
14501
14513
  animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
14502
14514
  }
14503
- `,
14504
- "right-side-panel": css`
14505
- --wui-modal-screen-offset: var(--wui-space-05);
14506
-
14507
- height: calc(100vh - var(--wui-modal-screen-offset) * 2);
14508
- top: var(--wui-modal-screen-offset);
14509
- right: var(--wui-modal-screen-offset);
14510
- animation: ${keyframes`
14515
+ `;
14516
+ const slideInRight = keyframes`
14511
14517
  from {
14512
14518
  opacity: 0;
14513
14519
  transform: translateX(100%);
@@ -14517,11 +14523,8 @@ const positionStyleMap = {
14517
14523
  opacity: 1;
14518
14524
  transform: translateX(0);
14519
14525
  }
14520
- `} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
14521
- transform-origin: right center;
14522
-
14523
- &[data-closed] {
14524
- animation: ${keyframes`
14526
+ `;
14527
+ const slideOutRight = keyframes`
14525
14528
  from {
14526
14529
  opacity: 1;
14527
14530
  transform: translateX(0);
@@ -14531,7 +14534,21 @@ const positionStyleMap = {
14531
14534
  opacity: 0;
14532
14535
  transform: translateX(100%);
14533
14536
  }
14534
- `} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
14537
+ `;
14538
+ const positionStyleMap = {
14539
+ centered: centeredModalStyles,
14540
+ "fixed-top": fixedTopModalStyles,
14541
+ "right-side-panel": css`
14542
+ --wui-modal-screen-offset: var(--wui-space-05);
14543
+
14544
+ height: calc(100vh - var(--wui-modal-screen-offset) * 2);
14545
+ top: var(--wui-modal-screen-offset);
14546
+ right: var(--wui-modal-screen-offset);
14547
+ animation: ${slideInRight} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
14548
+ transform-origin: right center;
14549
+
14550
+ &[data-closed] {
14551
+ animation: ${slideOutRight} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
14535
14552
  }
14536
14553
  `
14537
14554
  };