@wistia/ui 1.9.0 → 1.9.1-beta.2982e104.6aa7a58

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.9.0
3
+ * @license @wistia/ui v1.9.1-beta.2982e104.6aa7a58
4
4
  *
5
5
  * Copyright (c) 2024-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -72,8 +72,9 @@ 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/globalStyleAdjustmentsCss.tsx
76
- const globalStyleAdjustmentsCss = css`
75
+ //#region src/css/GlobalStyle.tsx
76
+ const GlobalStyle = createGlobalStyle`
77
+ ${css`
77
78
  /**
78
79
  * 1. Change from 'content-box' so that 'width' calculations are unaffected by 'padding' or 'border'
79
80
  See: https://css-tricks.com/inheriting-box-sizing-probably-slightly-better-best-practice/
@@ -106,6 +107,9 @@ const globalStyleAdjustmentsCss = css`
106
107
  so this becomes the default for all text. Guarded by '@supports' because
107
108
  'pretty' is not Baseline yet; browsers without it keep the initial
108
109
  'text-wrap: wrap' behavior, so no polyfill is needed.
110
+ 5. Prefer dvh where supported so the body tracks the dynamic viewport on
111
+ mobile Safari; the 100vh line stays as a legacy fallback (declared first
112
+ so newer browsers override it with dvh).
109
113
  */
110
114
  body {
111
115
  /* Ensure background and text colors are wui default, not system default */
@@ -116,6 +120,7 @@ const globalStyleAdjustmentsCss = css`
116
120
  line-height: 1.5; /* 2 */
117
121
  min-height: 100vh; /* 3 */
118
122
  min-height: -webkit-fill-available; /* 3 */
123
+ min-height: 100dvh; /* 5 */
119
124
 
120
125
  @supports (text-wrap: pretty) {
121
126
  text-wrap: pretty; /* 4 */
@@ -208,11 +213,7 @@ const globalStyleAdjustmentsCss = css`
208
213
  scroll-behavior: auto !important;
209
214
  }
210
215
  }
211
- `;
212
- //#endregion
213
- //#region src/css/GlobalStyle.tsx
214
- const GlobalStyle = createGlobalStyle`
215
- ${globalStyleAdjustmentsCss}
216
+ `}
216
217
  ${designTokens}
217
218
  ${clickRegionGlobalStyles}
218
219
  `;
@@ -269,9 +270,8 @@ const AriaLiveProvider = ({ children, debug = false }) => {
269
270
  setTimeout(() => setMessage(null), 1e3);
270
271
  }
271
272
  }, []);
272
- const value = useMemo(() => ({ announce }), [announce]);
273
273
  return /* @__PURE__ */ jsx(AriaLiveContext, {
274
- value,
274
+ value: useMemo(() => ({ announce }), [announce]),
275
275
  children
276
276
  });
277
277
  };
@@ -353,7 +353,7 @@ const copyToClipboard = async (textToCopy) => {
353
353
  const defaultLocales = ["en-US"];
354
354
  const defaultTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
355
355
  const milisecondsInSecond = 1e3;
356
- const millisecondsInDay = 86400 * milisecondsInSecond;
356
+ const millisecondsInDay = 1440 * 60 * milisecondsInSecond;
357
357
  //#endregion
358
358
  //#region src/helpers/dateTime/buildTimeDuration.ts
359
359
  /**
@@ -1164,8 +1164,7 @@ const DEFAULT_GRADIENT = "defaultMidOne";
1164
1164
  const getSemiRandomBackgroundGradient = (id) => {
1165
1165
  if (!(typeof id === "string" && id)) return gradientMap[0] ?? DEFAULT_GRADIENT;
1166
1166
  const hashCode = [...id].reduce((num, char) => Math.imul(MULTIPLIER, num) + (char.codePointAt(0) ?? 0) || 0, 0);
1167
- const index = Math.abs(hashCode) % gradientMap.length;
1168
- return gradientMap[index] ?? DEFAULT_GRADIENT;
1167
+ return gradientMap[Math.abs(hashCode) % gradientMap.length] ?? DEFAULT_GRADIENT;
1169
1168
  };
1170
1169
  //#endregion
1171
1170
  //#region src/helpers/mergeRefs/mergeRefs.ts
@@ -1390,11 +1389,10 @@ const useElementObserver = () => {
1390
1389
  * @param config Optional configuration for the file picker
1391
1390
  */
1392
1391
  const useFilePicker = (config = {}) => {
1393
- const finalConfig = {
1392
+ return useFilePicker$1({
1394
1393
  readFilesContent: false,
1395
1394
  ...config
1396
- };
1397
- return useFilePicker$1(finalConfig);
1395
+ });
1398
1396
  };
1399
1397
  /**
1400
1398
  * Hook that wraps `useImperativeFilePicker` from the use-file-picker library
@@ -1402,11 +1400,10 @@ const useFilePicker = (config = {}) => {
1402
1400
  * @param config Optional configuration for the imperative file picker
1403
1401
  */
1404
1402
  const useImperativeFilePicker = (config = {}) => {
1405
- const finalConfig = {
1403
+ return useImperativeFilePicker$1({
1406
1404
  readFilesContent: false,
1407
1405
  ...config
1408
- };
1409
- return useImperativeFilePicker$1(finalConfig);
1406
+ });
1410
1407
  };
1411
1408
  //#endregion
1412
1409
  //#region src/hooks/useFocusTrap/helpers.ts
@@ -1642,7 +1639,7 @@ const useEvent = (eventName, eventHandler, eventTarget = typeof document !== "un
1642
1639
  //#endregion
1643
1640
  //#region src/hooks/useKey/useKey.ts
1644
1641
  const useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOptions } = {}) => {
1645
- const memoizedEventHandler = useCallback((handlerEvent) => {
1642
+ useEvent(eventName, useCallback((handlerEvent) => {
1646
1643
  if ([
1647
1644
  "INPUT",
1648
1645
  "TEXTAREA",
@@ -1654,8 +1651,7 @@ const useKey = (key, eventHandler, { eventName = "keydown", eventTarget, eventOp
1654
1651
  else if (key) matchesKey = true;
1655
1652
  else matchesKey = false;
1656
1653
  if (matchesKey) eventHandler(handlerEvent);
1657
- }, [key, eventHandler]);
1658
- useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
1654
+ }, [key, eventHandler]), eventTarget, eventOptions);
1659
1655
  };
1660
1656
  //#endregion
1661
1657
  //#region src/private/hooks/useUpdateEffect/useUpdateEffect.ts
@@ -6323,8 +6319,7 @@ const chooseColorScheme = (name) => {
6323
6319
  for (let i = 0; i < str.length; i += 1) sum = Math.trunc(Math.imul(multiplier, sum) + (str.codePointAt(i) ?? 0));
6324
6320
  return sum;
6325
6321
  };
6326
- const index = Math.abs(hashCode(name)) % brandColorSchemeOptions.length;
6327
- return brandColorSchemeOptions[index] ?? "blue";
6322
+ return brandColorSchemeOptions[Math.abs(hashCode(name)) % brandColorSchemeOptions.length] ?? "blue";
6328
6323
  };
6329
6324
  /**
6330
6325
  * An avatar uses a photo or initials to represent an identity.
@@ -6632,8 +6627,7 @@ const applyMaxCharsToChildren = (children, maxChars) => {
6632
6627
  if (isNil(maxChars)) return children;
6633
6628
  if (isString(children)) return truncateString(children, maxChars);
6634
6629
  if (isNumber(children)) return truncateString(String(children), maxChars);
6635
- const textContent = typeof children === "object" ? JSON.stringify(children) : String(children);
6636
- return truncateString(textContent, maxChars);
6630
+ return truncateString(typeof children === "object" ? JSON.stringify(children) : String(children), maxChars);
6637
6631
  };
6638
6632
  const variantStyleMap$1 = {
6639
6633
  hero: css`
@@ -7075,7 +7069,6 @@ const Breadcrumbs = ({ children, ...props }) => {
7075
7069
  const { isXsAndDown } = useMq();
7076
7070
  let crumbs = Children.toArray(children);
7077
7071
  if (isXsAndDown) crumbs = crumbs.slice(-1);
7078
- const crumbMaxWidth = Math.floor(100 / crumbs.length) - BUFFER_WIDTH;
7079
7072
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", {
7080
7073
  type: "text/css",
7081
7074
  children: `
@@ -7086,7 +7079,7 @@ const Breadcrumbs = ({ children, ...props }) => {
7086
7079
 
7087
7080
  @container breadcrumbs (width < 100vw) {
7088
7081
  [data-wui-breadcrumb] {
7089
- max-width: ${crumbMaxWidth}cqw;
7082
+ max-width: ${Math.floor(100 / crumbs.length) - BUFFER_WIDTH}cqw;
7090
7083
  }
7091
7084
  }
7092
7085
  `
@@ -7855,11 +7848,10 @@ const compositeOverWhite = (color, alpha = 1) => {
7855
7848
  const calculateContrast = ({ backgroundColor, foregroundColor = DEFAULT_COLOR_FOR_COMPARISON, backgroundOpacity = 1 }) => {
7856
7849
  const backgroundColorAsRgb = convertToRgb(backgroundColor);
7857
7850
  const foregroundColorAsRgb = convertToRgb(foregroundColor);
7858
- const compositeBackground = compositeOverWhite(backgroundColorAsRgb, backgroundOpacity);
7859
- return wcagContrast(compositeBackground, foregroundColorAsRgb);
7851
+ return wcagContrast(compositeOverWhite(backgroundColorAsRgb, backgroundOpacity), foregroundColorAsRgb);
7860
7852
  };
7861
7853
  const snapValueToEdges = (value) => {
7862
- if (value > .9995) return 1;
7854
+ if (value > 1 - VALUE_CHANNEL_SNAP_EPSILON) return 1;
7863
7855
  if (value < VALUE_CHANNEL_SNAP_EPSILON) return 0;
7864
7856
  return value;
7865
7857
  };
@@ -9563,10 +9555,9 @@ const drawGradientBackground = (ctx, width, height, hue) => {
9563
9555
  for (let y = 0; y < height; y++) {
9564
9556
  const v = 1 - y / (height - 1);
9565
9557
  for (let x = 0; x < width; x++) {
9566
- const s = x / (width - 1);
9567
9558
  const rgb = convertToRgb({
9568
9559
  h: hue,
9569
- s,
9560
+ s: x / (width - 1),
9570
9561
  v,
9571
9562
  mode: "hsv"
9572
9563
  });
@@ -10131,16 +10122,16 @@ const Combobox = ({ placeholder, value, onChange, searchValue, onSearchValueChan
10131
10122
  return matchSorter(Object.keys(options), searchValue);
10132
10123
  }, [options, searchValue]);
10133
10124
  return /* @__PURE__ */ jsxs(Ariakit.ComboboxProvider, {
10125
+ inputValue: !isOpen && !isMultiSelect ? value : searchValue,
10134
10126
  open: isOpen,
10135
10127
  selectedValue: value,
10136
- setOpen: setIsOpen,
10137
- setSelectedValue: onChange,
10138
- setValue: (nextValue) => {
10128
+ setInputValue: (nextValue) => {
10139
10129
  startTransition(() => {
10140
10130
  onSearchValueChange(nextValue);
10141
10131
  });
10142
10132
  },
10143
- value: !isOpen && !isMultiSelect ? value : searchValue,
10133
+ setOpen: setIsOpen,
10134
+ setSelectedValue: onChange,
10144
10135
  children: [/* @__PURE__ */ jsxs(ComboboxWrapper, {
10145
10136
  ref: comboboxWrapperRef,
10146
10137
  $fullWidth: fullWidth,
@@ -10936,11 +10927,10 @@ const useCreatePopoverAnchorRef = () => useRef(null);
10936
10927
  */
10937
10928
  const PopoverAnchor = ({ children }) => {
10938
10929
  const sharedRef = usePopoverAnchor();
10939
- const callbackRef = useCallback((node) => {
10940
- if (sharedRef) sharedRef.current = node;
10941
- }, [sharedRef]);
10942
10930
  return /* @__PURE__ */ jsx("div", {
10943
- ref: callbackRef,
10931
+ ref: useCallback((node) => {
10932
+ if (sharedRef) sharedRef.current = node;
10933
+ }, [sharedRef]),
10944
10934
  children
10945
10935
  });
10946
10936
  };
@@ -12989,11 +12979,13 @@ const InputClickToCopy = ({ value, onCopy, disabled = false, ref, ...props }) =>
12989
12979
  //#endregion
12990
12980
  //#region src/components/InputDuration/constants.ts
12991
12981
  const SECONDS_PER_MINUTE = 60;
12992
- const MAX_MINUTES_UNIT_VALUE = 59;
12993
- const SECONDS_PER_TEN_MINUTES = 600;
12994
- const SECONDS_PER_HOUR = 3600;
12982
+ const MINUTES_PER_HOUR = 60;
12983
+ const MAX_MINUTES_UNIT_VALUE = SECONDS_PER_MINUTE - 1;
12984
+ const SECONDS_PER_TEN_MINUTES = SECONDS_PER_MINUTE * 10;
12985
+ const SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
12986
+ const TEN_HOURS = SECONDS_PER_HOUR * 10;
12995
12987
  const ONE_HUNDREDTH_OF_A_SECOND = .01;
12996
- const MAX_TIME = 35999.99;
12988
+ const MAX_TIME = TEN_HOURS - ONE_HUNDREDTH_OF_A_SECOND;
12997
12989
  const NUMBER_STRING_SET = /* @__PURE__ */ new Set([
12998
12990
  "0",
12999
12991
  "1",
@@ -14315,8 +14307,7 @@ const StyledSubTrigger = styled(Menu$1.SubmenuTrigger)`
14315
14307
  const SUBMENU_CLOSE_DELAY = 200;
14316
14308
  const SubMenuTrigger = ({ icon, ...props }) => {
14317
14309
  const { isSmAndUp } = useMq();
14318
- const Trigger = isSmAndUp ? StyledSubTrigger : Menu$1.Item;
14319
- return /* @__PURE__ */ jsx(Trigger, {
14310
+ return /* @__PURE__ */ jsx(isSmAndUp ? StyledSubTrigger : Menu$1.Item, {
14320
14311
  nativeButton: true,
14321
14312
  ...isSmAndUp ? { closeDelay: SUBMENU_CLOSE_DELAY } : { closeOnClick: false },
14322
14313
  render: /* @__PURE__ */ jsx(MenuItemButton, {
@@ -14698,7 +14689,8 @@ const modalExit = keyframes`
14698
14689
  transform: translateX(-50%) translateY(calc(var(--wui-modal-translate-y) + 24px));
14699
14690
  }
14700
14691
  `;
14701
- const centeredModalStyles = css`
14692
+ const positionStyleMap = {
14693
+ centered: css`
14702
14694
  --wui-modal-screen-offset: var(--wui-space-05);
14703
14695
  --wui-modal-translate-y: -50%;
14704
14696
 
@@ -14713,8 +14705,8 @@ const centeredModalStyles = css`
14713
14705
  &[data-closed] {
14714
14706
  animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
14715
14707
  }
14716
- `;
14717
- const fixedTopModalStyles = css`
14708
+ `,
14709
+ "fixed-top": css`
14718
14710
  --wui-modal-screen-offset-top: 15vh;
14719
14711
  --wui-modal-screen-offset-bottom: 5vh;
14720
14712
  --wui-modal-translate-y: 0%;
@@ -14732,8 +14724,14 @@ const fixedTopModalStyles = css`
14732
14724
  &[data-closed] {
14733
14725
  animation: ${modalExit} var(--wui-motion-duration-03) var(--wui-motion-ease-out) forwards;
14734
14726
  }
14735
- `;
14736
- const slideInRight = keyframes`
14727
+ `,
14728
+ "right-side-panel": css`
14729
+ --wui-modal-screen-offset: var(--wui-space-05);
14730
+
14731
+ height: calc(100vh - var(--wui-modal-screen-offset) * 2);
14732
+ top: var(--wui-modal-screen-offset);
14733
+ right: var(--wui-modal-screen-offset);
14734
+ animation: ${keyframes`
14737
14735
  from {
14738
14736
  opacity: 0;
14739
14737
  transform: translateX(100%);
@@ -14743,8 +14741,11 @@ const slideInRight = keyframes`
14743
14741
  opacity: 1;
14744
14742
  transform: translateX(0);
14745
14743
  }
14746
- `;
14747
- const slideOutRight = keyframes`
14744
+ `} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
14745
+ transform-origin: right center;
14746
+
14747
+ &[data-closed] {
14748
+ animation: ${keyframes`
14748
14749
  from {
14749
14750
  opacity: 1;
14750
14751
  transform: translateX(0);
@@ -14754,21 +14755,7 @@ const slideOutRight = keyframes`
14754
14755
  opacity: 0;
14755
14756
  transform: translateX(100%);
14756
14757
  }
14757
- `;
14758
- const positionStyleMap = {
14759
- centered: centeredModalStyles,
14760
- "fixed-top": fixedTopModalStyles,
14761
- "right-side-panel": css`
14762
- --wui-modal-screen-offset: var(--wui-space-05);
14763
-
14764
- height: calc(100vh - var(--wui-modal-screen-offset) * 2);
14765
- top: var(--wui-modal-screen-offset);
14766
- right: var(--wui-modal-screen-offset);
14767
- animation: ${slideInRight} var(--wui-motion-duration-05) var(--wui-motion-ease-out);
14768
- transform-origin: right center;
14769
-
14770
- &[data-closed] {
14771
- animation: ${slideOutRight} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
14758
+ `} var(--wui-motion-duration-03) var(--wui-motion-ease-in) forwards;
14772
14759
  }
14773
14760
  `
14774
14761
  };