@wistia/vhs 6.0.2-beta.b9791fdd.bf57768 → 6.0.2-beta.cd6ae361.53807dd

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.b9791fdd.bf57768
3
+ * @license @wistia/vhs v6.0.2-beta.cd6ae361.53807dd
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
  `;
@@ -3056,7 +3052,7 @@ const ModalCloseButton$1 = ({ onClick, closeIconColorOverride }) => /* @__PURE__
3056
3052
  zIndex: 1
3057
3053
  }
3058
3054
  });
3059
- ModalCloseButton$1.displayName = "ModalCloseButton";
3055
+ ModalCloseButton$1.displayName = "ModalCloseButton_VHS";
3060
3056
  //#endregion
3061
3057
  //#region src/private/helpers/mq/mq.ts
3062
3058
  const getMaxWidth = (breakpoint) => {
@@ -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";
@@ -4697,7 +4692,7 @@ const FormFieldWrapper = ({ disabled = false, error = null, label = null, labelD
4697
4692
  ]
4698
4693
  });
4699
4694
  };
4700
- FormFieldWrapper.displayName = "FormFieldWrapper";
4695
+ FormFieldWrapper.displayName = "FormFieldWrapper_VHS";
4701
4696
  //#endregion
4702
4697
  //#region src/components/CheckboxGroup/CheckboxGroup.tsx
4703
4698
  const StyledOptionContainer$1 = styled.div`
@@ -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,
@@ -5387,7 +5380,7 @@ const FormConnectorButton = ({ type = "submit", isSubmitting = false, children,
5387
5380
  children
5388
5381
  });
5389
5382
  };
5390
- FormConnectorButton.displayName = "FormConnectorButton";
5383
+ FormConnectorButton.displayName = "FormConnectorButton_VHS";
5391
5384
  //#endregion
5392
5385
  //#region src/components/FormButtons/FormButtons.tsx
5393
5386
  const handleMouseDown = (event) => event.preventDefault();
@@ -5441,7 +5434,7 @@ const FormConnectorCheckboxGroup = ({ direction = "column", disabled = false, fi
5441
5434
  value
5442
5435
  });
5443
5436
  };
5444
- FormConnectorCheckboxGroup.displayName = "FormConnectorCheckboxGroup";
5437
+ FormConnectorCheckboxGroup.displayName = "FormConnectorCheckboxGroup_VHS";
5445
5438
  //#endregion
5446
5439
  //#region src/private/components/FormConnectorCustomField/FormConnectorCustomField.tsx
5447
5440
  const DEFAULT_LABEL_PROPS$5 = {};
@@ -5461,7 +5454,7 @@ const FormConnectorCustomField = ({ customComponent: Element, field, form, label
5461
5454
  })
5462
5455
  });
5463
5456
  };
5464
- FormConnectorCustomField.displayName = "FormConnectorCustomField";
5457
+ FormConnectorCustomField.displayName = "FormConnectorCustomField_VHS";
5465
5458
  //#endregion
5466
5459
  //#region src/private/helpers/coerceToString/coerceToString.ts
5467
5460
  /**
@@ -5865,7 +5858,7 @@ const FormConnectorHidden = ({ field: { name, value, onChange }, form: { setFiel
5865
5858
  ...otherProps
5866
5859
  });
5867
5860
  };
5868
- FormConnectorHidden.displayName = "FormConnectorHidden";
5861
+ FormConnectorHidden.displayName = "FormConnectorHidden_VHS";
5869
5862
  //#endregion
5870
5863
  //#region src/private/components/FormConnectorInput/FormConnectorInput.tsx
5871
5864
  const TRIMMABLE_INPUTS = /* @__PURE__ */ new Set([
@@ -5905,7 +5898,7 @@ const FormConnectorInput = ({ disabled, field: { name, value, onChange, onBlur }
5905
5898
  })
5906
5899
  });
5907
5900
  };
5908
- FormConnectorInput.displayName = "FormConnectorInput";
5901
+ FormConnectorInput.displayName = "FormConnectorInput_VHS";
5909
5902
  //#endregion
5910
5903
  //#region src/components/Radio/Radio.tsx
5911
5904
  const Radio = forwardRef(({ checked, direction = "column", disabled = false, forceState, hasError = false, id, label, labelDescription, name, onChange, value = "false", ...otherProps }, ref) => {
@@ -5995,7 +5988,7 @@ const FormConnectorRadioGroup = ({ direction = "column", disabled = false, field
5995
5988
  value: values[name]
5996
5989
  });
5997
5990
  };
5998
- FormConnectorRadioGroup.displayName = "FormConnectorRadioGroup";
5991
+ FormConnectorRadioGroup.displayName = "FormConnectorRadioGroup_VHS";
5999
5992
  //#endregion
6000
5993
  //#region src/private/components/Icon/iconMap.ts
6001
5994
  const iconMap = {
@@ -6155,7 +6148,7 @@ const Icon$1 = ({ color = "currentColor", size = "lg", style, type, ...otherProp
6155
6148
  ...otherProps
6156
6149
  });
6157
6150
  };
6158
- Icon$1.displayName = "Icon";
6151
+ Icon$1.displayName = "Icon_VHS";
6159
6152
  //#endregion
6160
6153
  //#region src/private/helpers/isUrl/isUrl.ts
6161
6154
  /**
@@ -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:
@@ -7019,7 +7010,7 @@ const FormConnectorRichTextEditor = ({ field: { name, value, onChange }, form: {
7019
7010
  })
7020
7011
  });
7021
7012
  };
7022
- FormConnectorRichTextEditor.displayName = "FormConnectorRichTextEditor";
7013
+ FormConnectorRichTextEditor.displayName = "FormConnectorRichTextEditor_VHS";
7023
7014
  //#endregion
7024
7015
  //#region src/components/Select/SelectStyledComponent.tsx
7025
7016
  const focusStyle = css`
@@ -7195,7 +7186,7 @@ const FormConnectorSelect = ({ disabled = false, field: { name, value, onChange,
7195
7186
  })
7196
7187
  });
7197
7188
  };
7198
- FormConnectorSelect.displayName = "FormConnectorSelect";
7189
+ FormConnectorSelect.displayName = "FormConnectorSelect_VHS";
7199
7190
  //#endregion
7200
7191
  //#region src/components/FormField/inputTypeMap.ts
7201
7192
  const inputTypeMap = {
@@ -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
 
@@ -8088,8 +8077,7 @@ const MenuItem$1 = styled.div`
8088
8077
  `;
8089
8078
  const Menu$1 = forwardRef(({ items, menuHeader, width = "fullWidth", onClick, onClickOutside, onPressEsc, onOpen, onClose, ...otherProps }, ref) => {
8090
8079
  const menuRef = useRef(void 0);
8091
- const onClickOutsideFn = isNotNil(onClickOutside) ? onClickOutside : () => {};
8092
- useOnClickOutside(menuRef, onClickOutsideFn);
8080
+ useOnClickOutside(menuRef, isNotNil(onClickOutside) ? onClickOutside : () => {});
8093
8081
  const menuRefs = useMergedRefs([menuRef, ref]);
8094
8082
  useEffect(() => {
8095
8083
  if (onOpen) onOpen();
@@ -8126,7 +8114,7 @@ const Menu$1 = forwardRef(({ items, menuHeader, width = "fullWidth", onClick, on
8126
8114
  children: [isNotNil(menuHeader) ? /* @__PURE__ */ jsxs(Fragment$1, { children: [menuHeader, /* @__PURE__ */ jsx(MenuItem$1, { children: /* @__PURE__ */ jsx(Divider, {}) })] }) : null, itemsToRender]
8127
8115
  });
8128
8116
  });
8129
- Menu$1.displayName = "Menu";
8117
+ Menu$1.displayName = "Menu_VHS";
8130
8118
  //#endregion
8131
8119
  //#region src/private/hooks/useBoolean/useBoolean.ts
8132
8120
  const useBoolean = (initialValue = false) => {
@@ -8464,7 +8452,7 @@ const createKeyPredicate = (keyFilter) => {
8464
8452
  };
8465
8453
  const useKey = (key, eventHandler, options = {}, dependencies = [key]) => {
8466
8454
  const { eventName = "keydown", eventTarget, eventOptions } = options;
8467
- const memoizedEventHandler = useMemo(() => {
8455
+ useEvent(eventName, useMemo(() => {
8468
8456
  const predicate = createKeyPredicate(key);
8469
8457
  return (handlerEvent) => {
8470
8458
  if ([
@@ -8474,8 +8462,7 @@ const useKey = (key, eventHandler, options = {}, dependencies = [key]) => {
8474
8462
  ].includes(document.activeElement?.nodeName ?? "") || document.activeElement?.isContentEditable) return;
8475
8463
  if (predicate(handlerEvent)) return eventHandler(handlerEvent);
8476
8464
  };
8477
- }, dependencies);
8478
- useEvent(eventName, memoizedEventHandler, eventTarget, eventOptions);
8465
+ }, dependencies), eventTarget, eventOptions);
8479
8466
  };
8480
8467
  //#endregion
8481
8468
  //#region src/private/hooks/useKeyPress/useKeyPress.ts
@@ -8774,11 +8761,10 @@ const daysOfWeek = [
8774
8761
  const daysInAWeek = 7;
8775
8762
  const hasDates = (week) => week[0] instanceof Date || week[6] instanceof Date;
8776
8763
  const daysOfMonth = (dateInMonth) => {
8777
- const interval = {
8764
+ return eachDayOfInterval({
8778
8765
  start: startOfMonth(startOfDay(dateInMonth)),
8779
8766
  end: endOfMonth(startOfDay(dateInMonth))
8780
- };
8781
- return eachDayOfInterval(interval);
8767
+ });
8782
8768
  };
8783
8769
  const makeEmptyWeek = () => Array.from({ length: daysInAWeek }, () => []);
8784
8770
  const monthLayout = (days) => {
@@ -8799,7 +8785,7 @@ const monthLayout = (days) => {
8799
8785
  const Month = styled.div`
8800
8786
  cursor: not-allowed;
8801
8787
  padding-top: ${({ theme }) => theme.spacing.space04};
8802
- width: ${315}px;
8788
+ width: ${dayDimension * daysInAWeek}px;
8803
8789
  `;
8804
8790
  const MonthHeader = styled.div`
8805
8791
  display: flex;
@@ -8975,7 +8961,7 @@ const Calendar = ({ displayDate, earliestDate, latestDate, onDisplayDateChange,
8975
8961
  })]
8976
8962
  });
8977
8963
  };
8978
- Calendar.displayName = "Calendar";
8964
+ Calendar.displayName = "Calendar_VHS";
8979
8965
  //#endregion
8980
8966
  //#region src/private/components/RangeSelectorCalendar/RangeSelectorCalendar.tsx
8981
8967
  const EnhancedDay = styled(Day)`
@@ -9087,8 +9073,7 @@ const DEFAULT_RANGE$1 = {
9087
9073
  const NOOP = () => {};
9088
9074
  const RangeSelectorCalendar = ({ range = DEFAULT_RANGE$1, rangePartToShow = "", onChange, onIsValidChange = NOOP, earliestDate, latestDate, shouldPreventFuture = false }) => {
9089
9075
  const thisMonth = useMemo(() => startOfMonth(/* @__PURE__ */ new Date()), []);
9090
- const initialDisplayDate = isNotNil(range.end) ? range.end : thisMonth;
9091
- const [displayDate, setDisplayDate] = useState(initialDisplayDate);
9076
+ const [displayDate, setDisplayDate] = useState(isNotNil(range.end) ? range.end : thisMonth);
9092
9077
  const [{ firstDate, secondDate }, setDates] = useState({});
9093
9078
  const [hoveredDate, setHoveredDate] = useState();
9094
9079
  const internalRange = useRange(firstDate, secondDate);
@@ -9189,7 +9174,7 @@ const RangeSelectorCalendar = ({ range = DEFAULT_RANGE$1, rangePartToShow = "",
9189
9174
  shouldPreventFuture
9190
9175
  });
9191
9176
  };
9192
- RangeSelectorCalendar.displayName = "RangeSelectorCalendar";
9177
+ RangeSelectorCalendar.displayName = "RangeSelectorCalendar_VHS";
9193
9178
  //#endregion
9194
9179
  //#region src/private/components/RangeSelectorInput/constants.ts
9195
9180
  const DIVIDER_STRING = " - ";
@@ -9297,9 +9282,7 @@ const rangeToString = ({ start, end }) => {
9297
9282
  day: "2-digit",
9298
9283
  year: "numeric"
9299
9284
  };
9300
- const startString = start.toLocaleDateString("en-US", opts);
9301
- const endString = end.toLocaleDateString("en-US", opts);
9302
- return `${startString}${DIVIDER_STRING}${endString}`;
9285
+ return `${start.toLocaleDateString("en-US", opts)}${DIVIDER_STRING}${end.toLocaleDateString("en-US", opts)}`;
9303
9286
  };
9304
9287
  //#endregion
9305
9288
  //#region src/private/components/RangeSelectorInput/ErrorMessages.tsx
@@ -9512,8 +9495,7 @@ const getNextValue = ({ event, currentSelection, keyCount, valueParts, selection
9512
9495
  if (isANum(event)) {
9513
9496
  event.preventDefault();
9514
9497
  const nextPotentialParts = applyNumKey(valueParts, id, type, event.key, keyCount);
9515
- const validatedParts = validateDays(nextPotentialParts);
9516
- nextValue = datePartsToString(validatedParts);
9498
+ nextValue = datePartsToString(validateDays(nextPotentialParts));
9517
9499
  nextKeyCount += 1;
9518
9500
  shouldApply = selectionLength === nextKeyCount;
9519
9501
  }
@@ -9521,8 +9503,7 @@ const getNextValue = ({ event, currentSelection, keyCount, valueParts, selection
9521
9503
  event.preventDefault();
9522
9504
  const diff = event.key === "ArrowUp" ? 1 : -1;
9523
9505
  const nextPotentialParts = applyUpDownArrow(valueParts, id, diff);
9524
- const validatedParts = validateDays(nextPotentialParts);
9525
- nextValue = datePartsToString(validatedParts);
9506
+ nextValue = datePartsToString(validateDays(nextPotentialParts));
9526
9507
  nextKeyCount = 0;
9527
9508
  shouldApply = true;
9528
9509
  }
@@ -9688,7 +9669,7 @@ const RangeSelectorInput = ({ onChange, onSelectedRangePartChange, range, earlie
9688
9669
  value
9689
9670
  })] });
9690
9671
  };
9691
- RangeSelectorInput.displayName = "RangeSelectorInput";
9672
+ RangeSelectorInput.displayName = "RangeSelectorInput_VHS";
9692
9673
  //#endregion
9693
9674
  //#region src/components/RangeSelector/RangeSelector.tsx
9694
9675
  const TooltipWrapper = styled.div`