@wistia/vhs 6.0.1-beta.5a7fac1d.a9cc388 → 6.0.1-beta.64eebfb2.b2ca212

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/vhs v6.0.1-beta.5a7fac1d.a9cc388
3
+ * @license @wistia/vhs v6.0.1-beta.64eebfb2.b2ca212
4
4
  *
5
5
  * Copyright (c) 2021-2026, Wistia, Inc. and its affiliates.
6
6
  *
@@ -1967,7 +1967,7 @@ const toastWidth = {
1967
1967
  minWidth: "352px",
1968
1968
  width: "400px"
1969
1969
  };
1970
- const toastMobileWidth = { width: `calc(100% - ${toastPositionOffset * 2}px)` };
1970
+ const toastMobileWidth = { width: `calc(100% - 48px)` };
1971
1971
  const ToastAnimation = ({ children, in: inProp, renderInPlace }) => {
1972
1972
  const { isSmAndUp } = useMq();
1973
1973
  const { duration, zIndex } = useTheme();
@@ -2183,9 +2183,8 @@ const baseline = css`
2183
2183
  }
2184
2184
  `;
2185
2185
  //#endregion
2186
- //#region src/css/GlobalStyle.tsx
2187
- const GlobalStyle$1 = createGlobalStyle`
2188
- ${css`
2186
+ //#region src/css/normalize.tsx
2187
+ const normalize = css`
2189
2188
  /* normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */
2190
2189
 
2191
2190
  /* Document
@@ -2541,7 +2540,11 @@ const GlobalStyle$1 = createGlobalStyle`
2541
2540
  [hidden] {
2542
2541
  display: none;
2543
2542
  }
2544
- `}
2543
+ `;
2544
+ //#endregion
2545
+ //#region src/css/GlobalStyle.tsx
2546
+ const GlobalStyle$1 = createGlobalStyle`
2547
+ ${normalize}
2545
2548
  ${baseline}
2546
2549
  `;
2547
2550
  //#endregion
@@ -2623,8 +2626,9 @@ const theme = {
2623
2626
  //#endregion
2624
2627
  //#region src/providers/VHSThemeProvider.tsx
2625
2628
  const VHSThemeProvider = ({ children, theme: overrideTheme }) => {
2629
+ const theme$1 = merge(theme, overrideTheme);
2626
2630
  return /* @__PURE__ */ jsx(ThemeProvider, {
2627
- theme: merge(theme, overrideTheme),
2631
+ theme: theme$1,
2628
2632
  children
2629
2633
  });
2630
2634
  };
@@ -2743,7 +2747,7 @@ const tooltipBottomStyle = css`
2743
2747
  &::after {
2744
2748
  border-bottom-color: ${({ $backgroundColor }) => $backgroundColor};
2745
2749
  left: 50%;
2746
- top: -${ARROW_SIZE * 2}px;
2750
+ top: -${16}px;
2747
2751
  }
2748
2752
  }
2749
2753
  `;
@@ -3308,7 +3312,8 @@ const ModalBaseContent = ({ className, initialShownState = false, isDismissible
3308
3312
  ] });
3309
3313
  };
3310
3314
  const ModalBase = (props) => {
3311
- if (!isEqual(useModalProviderContext(), {})) return /* @__PURE__ */ jsx(ModalBaseContent, { ...props });
3315
+ const modalProviderContext = useModalProviderContext();
3316
+ if (!isEqual(modalProviderContext, {})) return /* @__PURE__ */ jsx(ModalBaseContent, { ...props });
3312
3317
  return /* @__PURE__ */ jsx(ModalProvider, { children: /* @__PURE__ */ jsx(ModalBaseContent, { ...props }) });
3313
3318
  };
3314
3319
  ModalBase.displayName = "ModalBase_VHS";
@@ -4714,8 +4719,9 @@ const CheckboxGroup = ({ direction = "column", disabled = false, error, label, l
4714
4719
  children: /* @__PURE__ */ jsx(StyledOptionContainer$1, {
4715
4720
  direction,
4716
4721
  children: options.map((option) => {
4722
+ const isChecked = Array.isArray(value) ? value.includes(option.name) : value;
4717
4723
  return /* @__PURE__ */ jsx(Checkbox, {
4718
- checked: Array.isArray(value) ? value.includes(option.name) : value,
4724
+ checked: isChecked,
4719
4725
  direction,
4720
4726
  disabled,
4721
4727
  onChange: (event) => isNotNil(onChange) ? onChange(event, option.name) : void 0,
@@ -5121,7 +5127,7 @@ const Divider = ({ colorOverride, height = 1, variant = "dashed", ...otherProps
5121
5127
  Divider.displayName = "Divider_VHS";
5122
5128
  //#endregion
5123
5129
  //#region src/components/FileSelect/FileSelect.tsx
5124
- const defaultMaximumFileSize = 26 * 1024;
5130
+ const defaultMaximumFileSize = 26624;
5125
5131
  const FileSelectComponent = styled.label`
5126
5132
  display: inline-block;
5127
5133
  overflow: hidden;
@@ -5264,7 +5270,8 @@ const FormGlobalError = forwardRef((_, ref) => {
5264
5270
  const { status, errors } = useFormikContext$1();
5265
5271
  let errorsCount = Object.keys(errors).length;
5266
5272
  if (isNotNil(status) && status["length"] > 0) errorsCount += 1;
5267
- if (coerceToBoolean(isNotNil(status) && !status["success"] || errorsCount)) return /* @__PURE__ */ jsxs(GlobalErrorsContainer, {
5273
+ const showErrorContainer = isNotNil(status) && !status["success"] || errorsCount;
5274
+ if (coerceToBoolean(showErrorContainer)) return /* @__PURE__ */ jsxs(GlobalErrorsContainer, {
5268
5275
  ref,
5269
5276
  children: [/* @__PURE__ */ jsx(ErrorsText, { children: errorsTitle(errorsCount) }), /* @__PURE__ */ jsx(FieldErrorsList, {
5270
5277
  errors,
@@ -6796,7 +6803,8 @@ const htmlChildIsEmptyText = (child) => isNotNil(child) && !isString(child) && c
6796
6803
  const createEditorBlockElements = (children, el) => {
6797
6804
  const { nodeName } = el;
6798
6805
  if (nodeName !== "IMG" && children.length === 1 && !isString(children[0]) && isNotNil(children[0].text) && children[0].text?.trim() === "") return jsx$1("element", ELEMENT_TAGS.P(), emptyTextNode);
6799
- return jsx$1("element", ELEMENT_TAGS[nodeName](el), children);
6806
+ const attrs = ELEMENT_TAGS[nodeName](el);
6807
+ return jsx$1("element", attrs, children);
6800
6808
  };
6801
6809
  const createEditorTextElements = (children, el) => {
6802
6810
  const { nodeName } = el;
@@ -6880,7 +6888,8 @@ const RichTextEditor = ({ enabledFormats = Object.values(rteFormatTypes), value
6880
6888
  const renderElement = useCallback((props) => /* @__PURE__ */ jsx(Element$1, { ...props }), []);
6881
6889
  const renderLeaf = useCallback((props) => /* @__PURE__ */ jsx(Leaf, { ...props }), []);
6882
6890
  const editor = useMemo(() => {
6883
- return withImages(withLinks(withHistory(withReact(createEditor()))));
6891
+ const baseEditor = withReact(createEditor());
6892
+ return withImages(withLinks(withHistory(baseEditor)));
6884
6893
  }, []);
6885
6894
  /**
6886
6895
  * This is directly from the Slate.js docs on how to update slate outside of onChange:
@@ -7067,7 +7076,7 @@ const SelectStyledComponent = styled.select`
7067
7076
 
7068
7077
  ${({ disabled }) => disabled && disabledStyle}
7069
7078
  ${({ $hasError }) => $hasError && errorStyle}
7070
- ${({ $forceState }) => $forceState === "focus" && focusStyle};
7079
+ ${({ $forceState }) => $forceState === "focus" && focusStyle};
7071
7080
  `;
7072
7081
  //#endregion
7073
7082
  //#region src/components/Select/Select.tsx
@@ -7621,8 +7630,7 @@ List.displayName = "List_VHS";
7621
7630
  //#endregion
7622
7631
  //#region src/components/Menu/menuContentCss.ts
7623
7632
  const gutterWidth = "8px";
7624
- const menuContentCss = css`
7625
- animation: ${keyframes`
7633
+ const open = keyframes`
7626
7634
  from {
7627
7635
  opacity: 0;
7628
7636
  transform: scale(.97) translateY(-8px);
@@ -7631,7 +7639,19 @@ const menuContentCss = css`
7631
7639
  opacity: 1;
7632
7640
  transform: scale(1);
7633
7641
  }
7634
- `} ${({ theme }) => theme.duration.productive.moderate}
7642
+ `;
7643
+ const close = keyframes`
7644
+ from {
7645
+ opacity: 1;
7646
+ transform: scale(1);
7647
+ }
7648
+ to {
7649
+ opacity: 0;
7650
+ transform: scale(.97) translateY(-8px);
7651
+ }
7652
+ `;
7653
+ const menuContentCss = css`
7654
+ animation: ${open} ${({ theme }) => theme.duration.productive.moderate}
7635
7655
  ${({ theme }) => theme.easing.entrance.productive};
7636
7656
  background: white;
7637
7657
  border-radius: 4px;
@@ -7644,16 +7664,7 @@ const menuContentCss = css`
7644
7664
  z-index: ${({ theme }) => theme.zIndex.MenuComponent};
7645
7665
 
7646
7666
  &[data-state='closed'] {
7647
- animation: ${keyframes`
7648
- from {
7649
- opacity: 1;
7650
- transform: scale(1);
7651
- }
7652
- to {
7653
- opacity: 0;
7654
- transform: scale(.97) translateY(-8px);
7655
- }
7656
- `} ${({ theme }) => theme.duration.productive.moderate}
7667
+ animation: ${close} ${({ theme }) => theme.duration.productive.moderate}
7657
7668
  ${({ theme }) => theme.easing.exit.productive};
7658
7669
  }
7659
7670
 
@@ -8076,7 +8087,8 @@ const MenuItem$1 = styled.div`
8076
8087
  `;
8077
8088
  const Menu$1 = forwardRef(({ items, menuHeader, width = "fullWidth", onClick, onClickOutside, onPressEsc, onOpen, onClose, ...otherProps }, ref) => {
8078
8089
  const menuRef = useRef(void 0);
8079
- useOnClickOutside(menuRef, isNotNil(onClickOutside) ? onClickOutside : () => {});
8090
+ const onClickOutsideFn = isNotNil(onClickOutside) ? onClickOutside : () => {};
8091
+ useOnClickOutside(menuRef, onClickOutsideFn);
8080
8092
  const menuRefs = useMergedRefs([menuRef, ref]);
8081
8093
  useEffect(() => {
8082
8094
  if (onOpen) onOpen();
@@ -8451,7 +8463,7 @@ const createKeyPredicate = (keyFilter) => {
8451
8463
  };
8452
8464
  const useKey = (key, eventHandler, options = {}, dependencies = [key]) => {
8453
8465
  const { eventName = "keydown", eventTarget, eventOptions } = options;
8454
- useEvent(eventName, useMemo(() => {
8466
+ const memoizedEventHandler = useMemo(() => {
8455
8467
  const predicate = createKeyPredicate(key);
8456
8468
  return (handlerEvent) => {
8457
8469
  if ([
@@ -8461,7 +8473,8 @@ const useKey = (key, eventHandler, options = {}, dependencies = [key]) => {
8461
8473
  ].includes(document.activeElement?.nodeName ?? "") || document.activeElement?.isContentEditable) return;
8462
8474
  if (predicate(handlerEvent)) return eventHandler(handlerEvent);
8463
8475
  };
8464
- }, dependencies), eventTarget, eventOptions);
8476
+ }, dependencies);
8477
+ useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
8465
8478
  };
8466
8479
  //#endregion
8467
8480
  //#region src/private/hooks/useKeyPress/useKeyPress.ts
@@ -8760,10 +8773,11 @@ const daysOfWeek = [
8760
8773
  const daysInAWeek = 7;
8761
8774
  const hasDates = (week) => week[0] instanceof Date || week[6] instanceof Date;
8762
8775
  const daysOfMonth = (dateInMonth) => {
8763
- return eachDayOfInterval({
8776
+ const interval = {
8764
8777
  start: startOfMonth(startOfDay(dateInMonth)),
8765
8778
  end: endOfMonth(startOfDay(dateInMonth))
8766
- });
8779
+ };
8780
+ return eachDayOfInterval(interval);
8767
8781
  };
8768
8782
  const makeEmptyWeek = () => Array.from({ length: daysInAWeek }, () => []);
8769
8783
  const monthLayout = (days) => {
@@ -8784,7 +8798,7 @@ const monthLayout = (days) => {
8784
8798
  const Month = styled.div`
8785
8799
  cursor: not-allowed;
8786
8800
  padding-top: ${({ theme }) => theme.spacing.space04};
8787
- width: ${dayDimension * daysInAWeek}px;
8801
+ width: ${315}px;
8788
8802
  `;
8789
8803
  const MonthHeader = styled.div`
8790
8804
  display: flex;
@@ -9072,7 +9086,8 @@ const DEFAULT_RANGE$1 = {
9072
9086
  const NOOP = () => {};
9073
9087
  const RangeSelectorCalendar = ({ range = DEFAULT_RANGE$1, rangePartToShow = "", onChange, onIsValidChange = NOOP, earliestDate, latestDate, shouldPreventFuture = false }) => {
9074
9088
  const thisMonth = useMemo(() => startOfMonth(/* @__PURE__ */ new Date()), []);
9075
- const [displayDate, setDisplayDate] = useState(isNotNil(range.end) ? range.end : thisMonth);
9089
+ const initialDisplayDate = isNotNil(range.end) ? range.end : thisMonth;
9090
+ const [displayDate, setDisplayDate] = useState(initialDisplayDate);
9076
9091
  const [{ firstDate, secondDate }, setDates] = useState({});
9077
9092
  const [hoveredDate, setHoveredDate] = useState();
9078
9093
  const internalRange = useRange(firstDate, secondDate);
@@ -9281,7 +9296,9 @@ const rangeToString = ({ start, end }) => {
9281
9296
  day: "2-digit",
9282
9297
  year: "numeric"
9283
9298
  };
9284
- return `${start.toLocaleDateString("en-US", opts)}${DIVIDER_STRING}${end.toLocaleDateString("en-US", opts)}`;
9299
+ const startString = start.toLocaleDateString("en-US", opts);
9300
+ const endString = end.toLocaleDateString("en-US", opts);
9301
+ return `${startString}${DIVIDER_STRING}${endString}`;
9285
9302
  };
9286
9303
  //#endregion
9287
9304
  //#region src/private/components/RangeSelectorInput/ErrorMessages.tsx
@@ -9494,7 +9511,8 @@ const getNextValue = ({ event, currentSelection, keyCount, valueParts, selection
9494
9511
  if (isANum(event)) {
9495
9512
  event.preventDefault();
9496
9513
  const nextPotentialParts = applyNumKey(valueParts, id, type, event.key, keyCount);
9497
- nextValue = datePartsToString(validateDays(nextPotentialParts));
9514
+ const validatedParts = validateDays(nextPotentialParts);
9515
+ nextValue = datePartsToString(validatedParts);
9498
9516
  nextKeyCount += 1;
9499
9517
  shouldApply = selectionLength === nextKeyCount;
9500
9518
  }
@@ -9502,7 +9520,8 @@ const getNextValue = ({ event, currentSelection, keyCount, valueParts, selection
9502
9520
  event.preventDefault();
9503
9521
  const diff = event.key === "ArrowUp" ? 1 : -1;
9504
9522
  const nextPotentialParts = applyUpDownArrow(valueParts, id, diff);
9505
- nextValue = datePartsToString(validateDays(nextPotentialParts));
9523
+ const validatedParts = validateDays(nextPotentialParts);
9524
+ nextValue = datePartsToString(validatedParts);
9506
9525
  nextKeyCount = 0;
9507
9526
  shouldApply = true;
9508
9527
  }