@wistia/vhs 6.0.2-beta.d28be0f4.1171db2 → 6.0.2-beta.e2e22d1f.cba4a37

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