@wistia/ui 0.15.13 → 0.15.14-beta.0ddf5142.0352c4f

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
@@ -1634,6 +1634,10 @@ declare const Combobox: ({ placeholder, value, onChange, searchValue, onSearchVa
1634
1634
  type ContextMenuProps = {
1635
1635
  children: ReactNode;
1636
1636
  onRequestClose?: () => void;
1637
+ /**
1638
+ * If the menu is compact
1639
+ */
1640
+ compact?: boolean;
1637
1641
  } & ({
1638
1642
  position: {
1639
1643
  x: number;
@@ -1652,7 +1656,7 @@ type ContextMenuProps = {
1652
1656
  * 1. By providing a `triggerRef`, which will render the menu when the referenced element is right-clicked.
1653
1657
  * 2. By providing a `position` prop, which will render the menu at the specified coordinates.
1654
1658
  */
1655
- declare const ContextMenu: ({ position, triggerRef, children, side, onRequestClose, }: ContextMenuProps) => react_jsx_runtime.JSX.Element | null;
1659
+ declare const ContextMenu: ({ position, triggerRef, children, side, onRequestClose, compact, }: ContextMenuProps) => react_jsx_runtime.JSX.Element | null;
1656
1660
 
1657
1661
  type DataCardProps = ComponentPropsWithoutRef<'div'> & Partial<Pick<ButtonAsLinkProps, 'beforeAction' | 'disabled' | 'href' | 'onClick' | 'type'>> & {
1658
1662
  /**
@@ -2369,6 +2373,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
2369
2373
  * The name attribute of the field. It will map to the form data passed into `useFormState`.
2370
2374
  */
2371
2375
  name: string;
2376
+ /**
2377
+ * Use if label describes a required form component
2378
+ */
2379
+ required?: boolean;
2372
2380
  /**
2373
2381
  * A value that overrides the basic value. This should pair with `onChange`.
2374
2382
  */
@@ -2382,7 +2390,7 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
2382
2390
  * FormField is a compound component that combines a label, form control, and optional description and error message.
2383
2391
  */
2384
2392
  declare const FormField: {
2385
- ({ children, description, error, id, label, labelPosition, name, value, ...props }: FormFieldProps): JSX$1.Element;
2393
+ ({ children, description, error, id, label, labelPosition, name, required, value, ...props }: FormFieldProps): JSX$1.Element;
2386
2394
  displayName: string;
2387
2395
  };
2388
2396
 
package/dist/index.d.ts CHANGED
@@ -1634,6 +1634,10 @@ declare const Combobox: ({ placeholder, value, onChange, searchValue, onSearchVa
1634
1634
  type ContextMenuProps = {
1635
1635
  children: ReactNode;
1636
1636
  onRequestClose?: () => void;
1637
+ /**
1638
+ * If the menu is compact
1639
+ */
1640
+ compact?: boolean;
1637
1641
  } & ({
1638
1642
  position: {
1639
1643
  x: number;
@@ -1652,7 +1656,7 @@ type ContextMenuProps = {
1652
1656
  * 1. By providing a `triggerRef`, which will render the menu when the referenced element is right-clicked.
1653
1657
  * 2. By providing a `position` prop, which will render the menu at the specified coordinates.
1654
1658
  */
1655
- declare const ContextMenu: ({ position, triggerRef, children, side, onRequestClose, }: ContextMenuProps) => react_jsx_runtime.JSX.Element | null;
1659
+ declare const ContextMenu: ({ position, triggerRef, children, side, onRequestClose, compact, }: ContextMenuProps) => react_jsx_runtime.JSX.Element | null;
1656
1660
 
1657
1661
  type DataCardProps = ComponentPropsWithoutRef<'div'> & Partial<Pick<ButtonAsLinkProps, 'beforeAction' | 'disabled' | 'href' | 'onClick' | 'type'>> & {
1658
1662
  /**
@@ -2369,6 +2373,10 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
2369
2373
  * The name attribute of the field. It will map to the form data passed into `useFormState`.
2370
2374
  */
2371
2375
  name: string;
2376
+ /**
2377
+ * Use if label describes a required form component
2378
+ */
2379
+ required?: boolean;
2372
2380
  /**
2373
2381
  * A value that overrides the basic value. This should pair with `onChange`.
2374
2382
  */
@@ -2382,7 +2390,7 @@ type FormFieldProps = ComponentPropsWithoutRef<'div'> & {
2382
2390
  * FormField is a compound component that combines a label, form control, and optional description and error message.
2383
2391
  */
2384
2392
  declare const FormField: {
2385
- ({ children, description, error, id, label, labelPosition, name, value, ...props }: FormFieldProps): JSX$1.Element;
2393
+ ({ children, description, error, id, label, labelPosition, name, required, value, ...props }: FormFieldProps): JSX$1.Element;
2386
2394
  displayName: string;
2387
2395
  };
2388
2396
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.15.13
3
+ * @license @wistia/ui v0.15.14-beta.0ddf5142.0352c4f
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -12877,6 +12877,7 @@ var Combobox2 = ({
12877
12877
  // src/components/ContextMenu/ContextMenu.tsx
12878
12878
  import { isNil as isNil16, isNotNil as isNotNil24 } from "@wistia/type-guards";
12879
12879
  import { useEffect as useEffect16, useState as useState17 } from "react";
12880
+ import { createPortal } from "react-dom";
12880
12881
 
12881
12882
  // src/components/Menu/Menu.tsx
12882
12883
  import {
@@ -13558,7 +13559,8 @@ var ContextMenu = ({
13558
13559
  triggerRef,
13559
13560
  children,
13560
13561
  side = "bottom",
13561
- onRequestClose = () => null
13562
+ onRequestClose = () => null,
13563
+ compact = false
13562
13564
  }) => {
13563
13565
  const [isRightClicked, setIsRightClicked] = useState17(false);
13564
13566
  const [menuPosition, setMenuPosition] = useState17(position ?? { x: 0, y: 0 });
@@ -13578,9 +13580,13 @@ var ContextMenu = ({
13578
13580
  return () => null;
13579
13581
  }, [position, triggerRef]);
13580
13582
  const isOpen = isNotNil24(position) || isRightClicked;
13581
- return isOpen ? /* @__PURE__ */ jsx267(
13583
+ if (!isOpen) {
13584
+ return null;
13585
+ }
13586
+ const menu = /* @__PURE__ */ jsx267(
13582
13587
  Menu,
13583
13588
  {
13589
+ compact,
13584
13590
  isOpen,
13585
13591
  onOpenChange: (next) => {
13586
13592
  setIsRightClicked(next);
@@ -13606,7 +13612,11 @@ var ContextMenu = ({
13606
13612
  ),
13607
13613
  children
13608
13614
  }
13609
- ) : null;
13615
+ );
13616
+ if (isNotNil24(triggerRef)) {
13617
+ return createPortal(menu, document.body);
13618
+ }
13619
+ return menu;
13610
13620
  };
13611
13621
 
13612
13622
  // src/components/DataCards/DataCard.tsx
@@ -14168,10 +14178,44 @@ import { createContext as createContext7, useMemo as useMemo13, useState as useS
14168
14178
  import { isNonEmptyString as isNonEmptyString6 } from "@wistia/type-guards";
14169
14179
  import styled63 from "styled-components";
14170
14180
  import { jsx as jsx277 } from "react/jsx-runtime";
14181
+ var LARGE_PADDING = "var(--wui-space-02)";
14182
+ var SMALL_PADDING = "var(--wui-space-01)";
14183
+ var getPaddingForVariant = (variant) => {
14184
+ const largePaddingVariants = [
14185
+ "hero",
14186
+ "heading1",
14187
+ "heading2",
14188
+ "heading3",
14189
+ "body1",
14190
+ "label1",
14191
+ "body1Mono"
14192
+ ];
14193
+ const smallPaddingVariants = [
14194
+ "heading4",
14195
+ "heading5",
14196
+ "heading6",
14197
+ "body2",
14198
+ "body3",
14199
+ "body4",
14200
+ "label2",
14201
+ "label3",
14202
+ "label4",
14203
+ "body2Mono",
14204
+ "body3Mono",
14205
+ "body4Mono"
14206
+ ];
14207
+ if (largePaddingVariants.includes(variant)) {
14208
+ return LARGE_PADDING;
14209
+ }
14210
+ if (smallPaddingVariants.includes(variant)) {
14211
+ return SMALL_PADDING;
14212
+ }
14213
+ return SMALL_PADDING;
14214
+ };
14171
14215
  var StyledEditableTextRoot = styled63.div`
14172
14216
  display: contents;
14173
14217
 
14174
- --wui-editable-text-padding: var(--wui-space-01);
14218
+ --wui-editable-text-padding: ${({ $typographicVariant }) => getPaddingForVariant($typographicVariant)};
14175
14219
  --wui-editable-text-border-radius: var(--wui-border-radius-01);
14176
14220
  `;
14177
14221
  var EditableTextContext = createContext7(null);
@@ -14269,6 +14313,7 @@ var EditableTextRoot = ({
14269
14313
  return /* @__PURE__ */ jsx277(
14270
14314
  StyledEditableTextRoot,
14271
14315
  {
14316
+ $typographicVariant: typographicVariant,
14272
14317
  "data-testid": "editable-text-root",
14273
14318
  "data-wui-editable-text-root": true,
14274
14319
  "data-wui-editable-text-state": getState(),
@@ -14777,6 +14822,7 @@ var FormField = ({
14777
14822
  label,
14778
14823
  labelPosition,
14779
14824
  name,
14825
+ required = false,
14780
14826
  value,
14781
14827
  ...props
14782
14828
  }) => {
@@ -14826,7 +14872,14 @@ var FormField = ({
14826
14872
  ...props,
14827
14873
  "data-label-position": labelPosition ?? formState.labelPosition,
14828
14874
  children: [
14829
- !isIntegratedLabel && /* @__PURE__ */ jsx283(Label, { htmlFor: computedId, children: label }),
14875
+ !isIntegratedLabel && /* @__PURE__ */ jsx283(
14876
+ Label,
14877
+ {
14878
+ htmlFor: computedId,
14879
+ required,
14880
+ children: label
14881
+ }
14882
+ ),
14830
14883
  isNotNil28(description) ? /* @__PURE__ */ jsx283(FormControlLabelDescription, { id: descriptionId, children: description }) : null,
14831
14884
  cloneElement8(children, childProps),
14832
14885
  isNotNil28(computedError) ? /* @__PURE__ */ jsxs46(Fragment9, { children: [