@wistia/vhs 3.0.0 → 3.0.1-beta.5af3ebb3.c232538

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.d.mts CHANGED
@@ -512,7 +512,7 @@ declare const Link: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps
512
512
  * The visual type of Link to display
513
513
  */
514
514
  variant?: "dangerous" | "primary" | "secondary";
515
- } & react.RefAttributes<unknown>>;
515
+ } & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
516
516
 
517
517
  type WrapperProviderLinkType = ((props: DefaultLinkWrapperProps) => JSX.Element) | undefined;
518
518
 
@@ -1358,7 +1358,7 @@ type ButtonLinkProps = ComponentPropsWithRef<'a'> & {
1358
1358
  * A Promise to invoke before navigating to location.
1359
1359
  * _Caution: if used with `external` type prop a new window will **not** be opened_
1360
1360
  */
1361
- beforeAction?: () => unknown;
1361
+ beforeAction?: (() => Promise<void>) | (() => void);
1362
1362
  /**
1363
1363
  * The content that will be rendered inside the button
1364
1364
  */
@@ -1444,7 +1444,7 @@ type ButtonLinkProps = ComponentPropsWithRef<'a'> & {
1444
1444
  * **Note:** the props table below is incomplete; please
1445
1445
  * refer to [Link](?path=/docs/link--link-stories) for additional props.
1446
1446
  */
1447
- declare const ButtonLink: react.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & react.RefAttributes<unknown>>;
1447
+ declare const ButtonLink: react.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
1448
1448
 
1449
1449
  type CheckboxProps = Omit<ComponentPropsWithRef<'label'>, 'onChange'> & {
1450
1450
  /**
@@ -2389,7 +2389,7 @@ type MenuPropsWithLabel = DefaultMenuProps & {
2389
2389
  type MenuPropsWithCustomTrigger = DefaultMenuProps & {
2390
2390
  label?: never;
2391
2391
  /** Replace the default trigger */
2392
- trigger: ReactNode;
2392
+ trigger: JSX.Element;
2393
2393
  };
2394
2394
  type MenuProps = MenuPropsWithCustomTrigger | MenuPropsWithLabel;
2395
2395
  declare const Menu: {
package/dist/index.d.ts CHANGED
@@ -512,7 +512,7 @@ declare const Link: react.ForwardRefExoticComponent<Omit<react.DetailedHTMLProps
512
512
  * The visual type of Link to display
513
513
  */
514
514
  variant?: "dangerous" | "primary" | "secondary";
515
- } & react.RefAttributes<unknown>>;
515
+ } & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
516
516
 
517
517
  type WrapperProviderLinkType = ((props: DefaultLinkWrapperProps) => JSX.Element) | undefined;
518
518
 
@@ -1358,7 +1358,7 @@ type ButtonLinkProps = ComponentPropsWithRef<'a'> & {
1358
1358
  * A Promise to invoke before navigating to location.
1359
1359
  * _Caution: if used with `external` type prop a new window will **not** be opened_
1360
1360
  */
1361
- beforeAction?: () => unknown;
1361
+ beforeAction?: (() => Promise<void>) | (() => void);
1362
1362
  /**
1363
1363
  * The content that will be rendered inside the button
1364
1364
  */
@@ -1444,7 +1444,7 @@ type ButtonLinkProps = ComponentPropsWithRef<'a'> & {
1444
1444
  * **Note:** the props table below is incomplete; please
1445
1445
  * refer to [Link](?path=/docs/link--link-stories) for additional props.
1446
1446
  */
1447
- declare const ButtonLink: react.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & react.RefAttributes<unknown>>;
1447
+ declare const ButtonLink: react.ForwardRefExoticComponent<Omit<ButtonLinkProps, "ref"> & react.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
1448
1448
 
1449
1449
  type CheckboxProps = Omit<ComponentPropsWithRef<'label'>, 'onChange'> & {
1450
1450
  /**
@@ -2389,7 +2389,7 @@ type MenuPropsWithLabel = DefaultMenuProps & {
2389
2389
  type MenuPropsWithCustomTrigger = DefaultMenuProps & {
2390
2390
  label?: never;
2391
2391
  /** Replace the default trigger */
2392
- trigger: ReactNode;
2392
+ trigger: JSX.Element;
2393
2393
  };
2394
2394
  type MenuProps = MenuPropsWithCustomTrigger | MenuPropsWithLabel;
2395
2395
  declare const Menu: {
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/vhs v3.0.0
3
+ * @license @wistia/vhs v3.0.1-beta.5af3ebb3.c232538
4
4
  *
5
5
  * Copyright (c) 2021-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -6549,45 +6549,39 @@ var ButtonLink = forwardRef6(
6549
6549
  }
6550
6550
  return null;
6551
6551
  };
6552
- return (
6553
- // @ts-expect-error FIXME
6554
- /* @__PURE__ */ jsx140(
6555
- StyledButtonLink,
6556
- {
6557
- ref,
6558
- $buttonColor: buttonColor,
6559
- $forceState: forceState,
6560
- $fullWidth: fullWidth,
6561
- $icon: icon,
6562
- $iconPosition: iconPosition,
6563
- $isLoading: false,
6564
- $labelWrap: labelWrap,
6565
- $size: size,
6566
- $square: square,
6567
- $textAlign: textAlign,
6568
- $variant: variant,
6569
- beforeAction,
6570
- disabled,
6571
- href,
6572
- params,
6573
- type,
6574
- unstyled: true,
6575
- ...otherProps,
6576
- children: /* @__PURE__ */ jsx140(
6577
- ButtonContent,
6578
- {
6579
- icon,
6580
- iconName,
6581
- iconPosition,
6582
- isLoading: false,
6583
- size,
6584
- textAlign,
6585
- children: getContent()
6586
- }
6587
- )
6588
- }
6589
- )
6590
- );
6552
+ const styledProps = {
6553
+ ref,
6554
+ $buttonColor: buttonColor,
6555
+ $forceState: forceState,
6556
+ $fullWidth: fullWidth,
6557
+ $icon: icon,
6558
+ $iconPosition: iconPosition,
6559
+ $isLoading: false,
6560
+ $labelWrap: labelWrap,
6561
+ $size: size,
6562
+ $square: square,
6563
+ $textAlign: textAlign,
6564
+ $variant: variant,
6565
+ beforeAction,
6566
+ disabled,
6567
+ href,
6568
+ params,
6569
+ type,
6570
+ unstyled: true,
6571
+ ...otherProps
6572
+ };
6573
+ return /* @__PURE__ */ jsx140(StyledButtonLink, { ...styledProps, children: /* @__PURE__ */ jsx140(
6574
+ ButtonContent,
6575
+ {
6576
+ icon,
6577
+ iconName,
6578
+ iconPosition,
6579
+ isLoading: false,
6580
+ size,
6581
+ textAlign,
6582
+ children: getContent()
6583
+ }
6584
+ ) });
6591
6585
  }
6592
6586
  );
6593
6587
  ButtonLink.displayName = "ButtonLink_VHS";
@@ -10842,7 +10836,7 @@ import {
10842
10836
  DropdownMenuItemIndicator,
10843
10837
  DropdownMenuSubTrigger
10844
10838
  } from "@radix-ui/react-dropdown-menu";
10845
- import { isNonEmptyString as isNonEmptyString13, isNotNil as isNotNil31, isNotUndefined as isNotUndefined13, isUndefined as isUndefined3 } from "@wistia/type-guards";
10839
+ import { isNonEmptyString as isNonEmptyString13, isNotNil as isNotNil31, isNotUndefined as isNotUndefined13 } from "@wistia/type-guards";
10846
10840
  import styled51, { css as css24 } from "styled-components";
10847
10841
  import { darken as darken5 } from "polished";
10848
10842
  import { jsx as jsx194, jsxs as jsxs35 } from "react/jsx-runtime";
@@ -10953,10 +10947,7 @@ var MenuItem = ({
10953
10947
  variant = "primary",
10954
10948
  ...props
10955
10949
  }) => {
10956
- let as = renderAs;
10957
- if (isUndefined3(renderAs)) {
10958
- as = isNotUndefined13(href) ? "a" : "div";
10959
- }
10950
+ const as = renderAs ?? (isNotUndefined13(href) ? "a" : "div");
10960
10951
  const targetProp = as === "a" && isNonEmptyString13(target) ? { target } : {};
10961
10952
  return /* @__PURE__ */ jsx194(
10962
10953
  DropdownMenuItem,
@@ -12417,7 +12408,7 @@ RangeSelectorCalendar.displayName = "RangeSelectorCalendar";
12417
12408
  import { useCallback as useCallback14, useEffect as useEffect23, useRef as useRef15, useState as useState23 } from "react";
12418
12409
  import styled65 from "styled-components";
12419
12410
  import { endOfDay as endOfDay3 } from "date-fns";
12420
- import { isNotUndefined as isNotUndefined17, isUndefined as isUndefined5, isNotNil as isNotNil41 } from "@wistia/type-guards";
12411
+ import { isNotUndefined as isNotUndefined17, isUndefined as isUndefined4, isNotNil as isNotNil41 } from "@wistia/type-guards";
12421
12412
 
12422
12413
  // src/private/components/RangeSelectorInput/ErrorMessages.tsx
12423
12414
  import styled64 from "styled-components";
@@ -12626,7 +12617,7 @@ var orderRange = (range) => {
12626
12617
  };
12627
12618
 
12628
12619
  // src/private/components/RangeSelectorInput/selection.ts
12629
- import { isNotUndefined as isNotUndefined16, isUndefined as isUndefined4, isNotNil as isNotNil40 } from "@wistia/type-guards";
12620
+ import { isNotUndefined as isNotUndefined16, isUndefined as isUndefined3, isNotNil as isNotNil40 } from "@wistia/type-guards";
12630
12621
  var getCursorPosition = (ref) => {
12631
12622
  const startPos = ref.current?.selectionStart;
12632
12623
  const endPos = ref.current?.selectionEnd;
@@ -12653,7 +12644,7 @@ var getSelectionFromMove = (selection, move, positions) => {
12653
12644
  var getSelectionFromCursor = (ref, positions) => {
12654
12645
  const pos = getCursorPosition(ref);
12655
12646
  for (let i = 0; i < positions.length; i++) {
12656
- if (isUndefined4(positions[i])) {
12647
+ if (isUndefined3(positions[i])) {
12657
12648
  return [];
12658
12649
  }
12659
12650
  const { start, end, type } = positions[i];
@@ -12671,7 +12662,7 @@ var getFirstDefaultPosition = (value) => {
12671
12662
  const dvp = getValueParts(INITIAL_VALUE);
12672
12663
  const parts = ["month1", "day1", "year1", "month2", "day2", "year2"];
12673
12664
  for (let i = 0; i < parts.length; i++) {
12674
- if (isUndefined4(parts[i])) {
12665
+ if (isUndefined3(parts[i])) {
12675
12666
  return -1;
12676
12667
  }
12677
12668
  if (vp[parts[i]] === dvp[parts[i]]) {
@@ -12848,7 +12839,7 @@ var RangeSelectorInput = ({
12848
12839
  const [errorMessages, setErrorMessages] = useState23([]);
12849
12840
  const ref = useRef15(null);
12850
12841
  const [currentSelection, setCurrentSelection] = useState23([0, -1]);
12851
- const selectionLength = isUndefined5(currentSelection) || isUndefined5(currentSelection[1]) || isUndefined5(currentSelection[0]) ? 0 : currentSelection[1] - currentSelection[0];
12842
+ const selectionLength = isUndefined4(currentSelection) || isUndefined4(currentSelection[1]) || isUndefined4(currentSelection[0]) ? 0 : currentSelection[1] - currentSelection[0];
12852
12843
  const valueParts = getValueParts(value);
12853
12844
  const applyChange = useCallback14(
12854
12845
  (nextRange) => {
@@ -13391,32 +13382,26 @@ var Slider = ({
13391
13382
  );
13392
13383
  },
13393
13384
  renderThumb: (thumbProps, thumbState) => {
13394
- const { key, ...restProps } = thumbProps;
13395
- return (
13396
- // @ts-expect-error complains about styled-components `as` prop
13397
- /* @__PURE__ */ jsx209(
13398
- StyledThumb,
13399
- {
13400
- ...restProps,
13401
- "data-testid": `${dataTestId}-thumb-${thumbState.index}`
13402
- },
13403
- key
13404
- )
13385
+ const { key, as, ...restProps } = thumbProps;
13386
+ return /* @__PURE__ */ jsx209(
13387
+ StyledThumb,
13388
+ {
13389
+ ...restProps,
13390
+ "data-testid": `${dataTestId}-thumb-${thumbState.index}`
13391
+ },
13392
+ key
13405
13393
  );
13406
13394
  },
13407
13395
  renderTrack: (trackProps, trackState) => {
13408
- const { key, ...restProps } = trackProps;
13409
- return (
13410
- // @ts-expect-error complains about styled-components `as` prop
13411
- /* @__PURE__ */ jsx209(
13412
- StyledTrack,
13413
- {
13414
- ...restProps,
13415
- $isFilledTrack: checkIfFilledTrack(trackState),
13416
- "data-testid": `${dataTestId}-track-${trackState.index}`
13417
- },
13418
- key
13419
- )
13396
+ const { key, as, ...restProps } = trackProps;
13397
+ return /* @__PURE__ */ jsx209(
13398
+ StyledTrack,
13399
+ {
13400
+ ...restProps,
13401
+ $isFilledTrack: checkIfFilledTrack(trackState),
13402
+ "data-testid": `${dataTestId}-track-${trackState.index}`
13403
+ },
13404
+ key
13420
13405
  );
13421
13406
  },
13422
13407
  step,