@wistia/ui 0.6.17 → 0.6.18

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
@@ -582,11 +582,17 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
582
582
  */
583
583
  direction?: DirectionType;
584
584
  /**
585
- * Specifies whether the width and/or height should fill the container
585
+ * Specifies whether the width and/or height should fill the container.
586
+ * Cannot be used with height/width props when setting the corresponding dimension.
587
+ * For example, fill="vertical" or fill={true} cannot be used with the height prop,
588
+ * and fill="horizontal" or fill={true} cannot be used with the width prop.
586
589
  */
587
590
  fill?: FillType;
588
591
  /**
589
- * Specifies whether the width and/or height should fill the viewport
592
+ * Specifies whether the width and/or height should fill the viewport.
593
+ * Cannot be used with height/width props when setting the corresponding dimension.
594
+ * For example, fillViewport="vertical" or fillViewport={true} cannot be used with the height prop,
595
+ * and fillViewport="horizontal" or fillViewport={true} cannot be used with the width prop.
590
596
  */
591
597
  fillViewport?: FillType;
592
598
  /**
@@ -604,6 +610,11 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
604
610
  * Used internally to track if a Box is a child of another Box component
605
611
  */
606
612
  hasBoxParent?: boolean;
613
+ /**
614
+ * Specifies the height of the box.
615
+ * *Note: Cannot be used with fill="vertical" or fillViewport="vertical"*
616
+ */
617
+ height?: string;
607
618
  /**
608
619
  * Make Layout behave like an inline element but still lay out its content according to flexbox model
609
620
  */
@@ -633,6 +644,11 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
633
644
  * Specifies whether items are forced into a single line or can be wrapped onto multiple lines
634
645
  */
635
646
  wrapItems?: boolean;
647
+ /**
648
+ * Specifies the width of the box.
649
+ * *Note: Cannot be used with fill="horizontal" or fillViewport="horizontal"*
650
+ */
651
+ width?: string;
636
652
  };
637
653
  /**
638
654
  * Box is a layout container using [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox).
@@ -727,6 +743,14 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
727
743
  * Specifies the gaps (gutters) between rows and columns
728
744
  */
729
745
  gap?: BoxProps['gap'];
746
+ /**
747
+ * Specifies the height of the card.
748
+ */
749
+ height?: string;
750
+ /**
751
+ * Specifies the width of the card.
752
+ */
753
+ width?: string;
730
754
  /**
731
755
  * @ignore
732
756
  * */
@@ -781,7 +805,7 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
781
805
  * Cards can be used to visually distinguish content sections. Extends the [Box component.](https://wistia.github.io/vhs/storybook-ui/?path=/docs/components-box--docs)
782
806
  */
783
807
  declare const Card: {
784
- ({ children, paddingSize, gap, direction, colorScheme, prominence, border, ...props }: CardProps): JSX.Element;
808
+ ({ children, paddingSize, gap, direction, colorScheme, prominence, border, height, width, ...props }: CardProps): JSX.Element;
785
809
  displayName: string;
786
810
  };
787
811
 
package/dist/index.d.ts CHANGED
@@ -582,11 +582,17 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
582
582
  */
583
583
  direction?: DirectionType;
584
584
  /**
585
- * Specifies whether the width and/or height should fill the container
585
+ * Specifies whether the width and/or height should fill the container.
586
+ * Cannot be used with height/width props when setting the corresponding dimension.
587
+ * For example, fill="vertical" or fill={true} cannot be used with the height prop,
588
+ * and fill="horizontal" or fill={true} cannot be used with the width prop.
586
589
  */
587
590
  fill?: FillType;
588
591
  /**
589
- * Specifies whether the width and/or height should fill the viewport
592
+ * Specifies whether the width and/or height should fill the viewport.
593
+ * Cannot be used with height/width props when setting the corresponding dimension.
594
+ * For example, fillViewport="vertical" or fillViewport={true} cannot be used with the height prop,
595
+ * and fillViewport="horizontal" or fillViewport={true} cannot be used with the width prop.
590
596
  */
591
597
  fillViewport?: FillType;
592
598
  /**
@@ -604,6 +610,11 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
604
610
  * Used internally to track if a Box is a child of another Box component
605
611
  */
606
612
  hasBoxParent?: boolean;
613
+ /**
614
+ * Specifies the height of the box.
615
+ * *Note: Cannot be used with fill="vertical" or fillViewport="vertical"*
616
+ */
617
+ height?: string;
607
618
  /**
608
619
  * Make Layout behave like an inline element but still lay out its content according to flexbox model
609
620
  */
@@ -633,6 +644,11 @@ type BoxProps = ComponentPropsWithoutRef<typeof DEFAULT_ELEMENT$1> & {
633
644
  * Specifies whether items are forced into a single line or can be wrapped onto multiple lines
634
645
  */
635
646
  wrapItems?: boolean;
647
+ /**
648
+ * Specifies the width of the box.
649
+ * *Note: Cannot be used with fill="horizontal" or fillViewport="horizontal"*
650
+ */
651
+ width?: string;
636
652
  };
637
653
  /**
638
654
  * Box is a layout container using [CSS Flexbox](https://developer.mozilla.org/en-US/docs/Learn/CSS/CSS_layout/Flexbox).
@@ -727,6 +743,14 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
727
743
  * Specifies the gaps (gutters) between rows and columns
728
744
  */
729
745
  gap?: BoxProps['gap'];
746
+ /**
747
+ * Specifies the height of the card.
748
+ */
749
+ height?: string;
750
+ /**
751
+ * Specifies the width of the card.
752
+ */
753
+ width?: string;
730
754
  /**
731
755
  * @ignore
732
756
  * */
@@ -781,7 +805,7 @@ type CardProps = BoxProps & ComponentPropsWithoutRef<'div'> & {
781
805
  * Cards can be used to visually distinguish content sections. Extends the [Box component.](https://wistia.github.io/vhs/storybook-ui/?path=/docs/components-box--docs)
782
806
  */
783
807
  declare const Card: {
784
- ({ children, paddingSize, gap, direction, colorScheme, prominence, border, ...props }: CardProps): JSX.Element;
808
+ ({ children, paddingSize, gap, direction, colorScheme, prominence, border, height, width, ...props }: CardProps): JSX.Element;
785
809
  displayName: string;
786
810
  };
787
811
 
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.6.17
3
+ * @license @wistia/ui v0.6.18
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -7047,7 +7047,7 @@ Badge.displayName = "Badge";
7047
7047
  // src/components/Box/Box.tsx
7048
7048
  import { Children, cloneElement as cloneElement2, forwardRef as forwardRef5 } from "react";
7049
7049
  import styled10 from "styled-components";
7050
- import { isNotNil as isNotNil7, isNil as isNil9, isRecord as isRecord3 } from "@wistia/type-guards";
7050
+ import { isNotNil as isNotNil7, isNil as isNil9, isRecord as isRecord3, isNotUndefined as isNotUndefined4, isTruthy } from "@wistia/type-guards";
7051
7051
 
7052
7052
  // src/private/helpers/makePolymorphic/makePolymorphic.tsx
7053
7053
  var makePolymorphic = (component) => {
@@ -7107,6 +7107,8 @@ var StyledBoxComponent = styled10.div`
7107
7107
  flex-direction: ${({ $flexDirection }) => $flexDirection};
7108
7108
  ${({ $fillBox: fill }) => getFillStyle(fill)};
7109
7109
  ${({ $fillViewport }) => getFillViewportStyle($fillViewport)};
7110
+ height: ${({ $height }) => $height ?? null};
7111
+ width: ${({ $width }) => $width ?? null};
7110
7112
 
7111
7113
  /* Box children styles */
7112
7114
  flex-grow: ${({ $grow }) => isNotNil7($grow) ? $grow : null};
@@ -7147,14 +7149,36 @@ var BoxComponent = forwardRef5(
7147
7149
  grow,
7148
7150
  hasBoxParent = false,
7149
7151
  // eslint-disable-line @typescript-eslint/no-unused-vars
7152
+ height,
7150
7153
  inline = false,
7151
7154
  justifyContent = "flex-start",
7152
7155
  order,
7153
7156
  renderAs,
7154
7157
  shrink,
7158
+ width,
7155
7159
  wrapItems = false,
7156
7160
  ...otherProps
7157
7161
  }, ref) => {
7162
+ if (isNotUndefined4(height)) {
7163
+ if (isTruthy(fill) || fill === "vertical") {
7164
+ throw new Error('Cannot use height prop with fill="vertical" or fill={true}');
7165
+ }
7166
+ if (isTruthy(fillViewport) || fillViewport === "vertical") {
7167
+ throw new Error(
7168
+ 'Cannot use height prop with fillViewport="vertical" or fillViewport={true}'
7169
+ );
7170
+ }
7171
+ }
7172
+ if (isNotUndefined4(width)) {
7173
+ if (isTruthy(fill) || fill === "horizontal") {
7174
+ throw new Error('Cannot use width prop with fill="horizontal" or fill={true}');
7175
+ }
7176
+ if (isTruthy(fillViewport) || fillViewport === "horizontal") {
7177
+ throw new Error(
7178
+ 'Cannot use width prop with fillViewport="horizontal" or fillViewport={true}'
7179
+ );
7180
+ }
7181
+ }
7158
7182
  return /* @__PURE__ */ jsx194(
7159
7183
  StyledBoxComponent,
7160
7184
  {
@@ -7168,10 +7192,12 @@ var BoxComponent = forwardRef5(
7168
7192
  $flexDirection: direction,
7169
7193
  $gap: gap,
7170
7194
  $grow: grow,
7195
+ $height: height,
7171
7196
  $inline: inline,
7172
7197
  $justifyContent: justifyContent,
7173
7198
  $order: order,
7174
7199
  $shrink: shrink,
7200
+ $width: width,
7175
7201
  $wrapItems: wrapItems,
7176
7202
  as: renderAs ?? DEFAULT_ELEMENT,
7177
7203
  ...otherProps,
@@ -7341,6 +7367,8 @@ var StyledCard = styled14(Box)`
7341
7367
  outline-offset: -2px;
7342
7368
  border-radius: var(--wui-border-radius-02);
7343
7369
  display: flex;
7370
+ height: ${({ $height }) => $height};
7371
+ width: ${({ $width }) => $width};
7344
7372
  `;
7345
7373
  var prominenceMap = {
7346
7374
  default: {
@@ -7364,6 +7392,8 @@ var Card = ({
7364
7392
  colorScheme = "inherit",
7365
7393
  prominence = "secondary",
7366
7394
  border = false,
7395
+ height,
7396
+ width,
7367
7397
  ...props
7368
7398
  }) => /* @__PURE__ */ jsx198(
7369
7399
  StyledCard,
@@ -7371,7 +7401,9 @@ var Card = ({
7371
7401
  $backgroundColor: prominenceMap[prominence].backgroundColor,
7372
7402
  $borderColor: border ? prominenceMap[prominence].borderColor : "transparent",
7373
7403
  $colorScheme: colorScheme,
7404
+ $height: height,
7374
7405
  $paddingSize: paddingSize,
7406
+ $width: width,
7375
7407
  direction,
7376
7408
  gap,
7377
7409
  ...props,
@@ -7792,13 +7824,13 @@ var CollapsibleTrigger = ({ children }) => {
7792
7824
  // src/components/Collapsible/CollapsibleContent.tsx
7793
7825
  import styled20 from "styled-components";
7794
7826
  import { Content } from "@radix-ui/react-collapsible";
7795
- import { isNotUndefined as isNotUndefined4 } from "@wistia/type-guards";
7827
+ import { isNotUndefined as isNotUndefined5 } from "@wistia/type-guards";
7796
7828
  import { Fragment as Fragment4, jsx as jsx205, jsxs as jsxs13 } from "react/jsx-runtime";
7797
7829
  var ClampedContent = styled20.div.attrs({ "data-wui-collapsible-content": true })`
7798
7830
  --wui-collapsible-content-clamp-lines: ${({ $clamp }) => $clamp};
7799
7831
  `;
7800
7832
  var CollapsibleContent = ({ clamp, children }) => {
7801
- if (isNotUndefined4(clamp)) {
7833
+ if (isNotUndefined5(clamp)) {
7802
7834
  return /* @__PURE__ */ jsx205(ClampedContent, { $clamp: clamp, children });
7803
7835
  }
7804
7836
  return /* @__PURE__ */ jsx205(Content, { asChild: true, children: /* @__PURE__ */ jsxs13(Fragment4, { children: [
@@ -8665,7 +8697,7 @@ var EditableHeading = ({
8665
8697
  // src/components/Form/Form.tsx
8666
8698
  import { forwardRef as forwardRef11, useRef as useRef5, useMemo as useMemo4, createContext as createContext2, useState as useState6, useId as useId2 } from "react";
8667
8699
  import styled31 from "styled-components";
8668
- import { isNotUndefined as isNotUndefined5, isUndefined as isUndefined3 } from "@wistia/type-guards";
8700
+ import { isNotUndefined as isNotUndefined6, isUndefined as isUndefined3 } from "@wistia/type-guards";
8669
8701
 
8670
8702
  // src/components/Stack/Stack.tsx
8671
8703
  import { forwardRef as forwardRef10 } from "react";
@@ -8738,7 +8770,7 @@ var FormComponent = ({
8738
8770
  props.onBlur(event);
8739
8771
  }
8740
8772
  const formData = new FormData(event.currentTarget);
8741
- if (isNotUndefined5(validate)) {
8773
+ if (isNotUndefined6(validate)) {
8742
8774
  handleValidate(formData);
8743
8775
  }
8744
8776
  };
@@ -8835,7 +8867,7 @@ var useFormState = (action, initialData = {}) => {
8835
8867
 
8836
8868
  // src/components/Form/FormErrorSummary.tsx
8837
8869
  import { useContext as useContext2, useRef as useRef6 } from "react";
8838
- import { isArray, isNotUndefined as isNotUndefined6 } from "@wistia/type-guards";
8870
+ import { isArray, isNotUndefined as isNotUndefined7 } from "@wistia/type-guards";
8839
8871
  import { jsx as jsx217, jsxs as jsxs19 } from "react/jsx-runtime";
8840
8872
  var ErrorItem = ({ name, error, formId }) => {
8841
8873
  return /* @__PURE__ */ jsx217("li", { children: /* @__PURE__ */ jsx217(Link, { href: `#${formId}-${name}`, children: error }) }, name);
@@ -8849,7 +8881,7 @@ var FormErrorSummary = ({ description }) => {
8849
8881
  }
8850
8882
  return /* @__PURE__ */ jsxs19("div", { ref, children: [
8851
8883
  /* @__PURE__ */ jsx217("p", { children: description }),
8852
- /* @__PURE__ */ jsx217("ul", { children: Object.entries(errors).filter(([, error]) => isNotUndefined6(error)).map(
8884
+ /* @__PURE__ */ jsx217("ul", { children: Object.entries(errors).filter(([, error]) => isNotUndefined7(error)).map(
8853
8885
  ([name, error]) => isArray(error) ? error.map((err) => /* @__PURE__ */ jsx217(
8854
8886
  ErrorItem,
8855
8887
  {
@@ -8874,7 +8906,7 @@ var FormErrorSummary = ({ description }) => {
8874
8906
  // src/components/FormField/FormField.tsx
8875
8907
  import { Children as Children5, cloneElement as cloneElement5, useContext as useContext3 } from "react";
8876
8908
  import styled33 from "styled-components";
8877
- import { isArray as isArray2, isNotNil as isNotNil11, isNotUndefined as isNotUndefined7, isUndefined as isUndefined4 } from "@wistia/type-guards";
8909
+ import { isArray as isArray2, isNotNil as isNotNil11, isNotUndefined as isNotUndefined8, isUndefined as isUndefined4 } from "@wistia/type-guards";
8878
8910
 
8879
8911
  // src/components/FormGroup/CheckboxGroup.tsx
8880
8912
  import { createContext as createContext3, useMemo as useMemo5 } from "react";
@@ -9013,7 +9045,7 @@ var FormField = ({
9013
9045
  label: isIntegratedLabel ? label : void 0,
9014
9046
  ...props
9015
9047
  };
9016
- if (isUndefined4(value) && isNotUndefined7(defaultValue)) {
9048
+ if (isUndefined4(value) && isNotUndefined8(defaultValue)) {
9017
9049
  childProps = {
9018
9050
  ...childProps,
9019
9051
  defaultValue
@@ -9022,10 +9054,10 @@ var FormField = ({
9022
9054
  if (isNotNil11(checkboxGroup)) {
9023
9055
  const computedName = isNotNil11(checkboxGroup.name) ? `${checkboxGroup.name}[${name}]` : name;
9024
9056
  const handleChange = (event) => {
9025
- if (isNotUndefined7(props.onChange)) {
9057
+ if (isNotUndefined8(props.onChange)) {
9026
9058
  props.onChange(event);
9027
9059
  }
9028
- if (isNotUndefined7(checkboxGroup.onChange)) {
9060
+ if (isNotUndefined8(checkboxGroup.onChange)) {
9029
9061
  checkboxGroup.onChange(event);
9030
9062
  }
9031
9063
  };
@@ -9178,7 +9210,7 @@ import {
9178
9210
  DropdownMenuPortal,
9179
9211
  DropdownMenuContent
9180
9212
  } from "@radix-ui/react-dropdown-menu";
9181
- import { isNotNil as isNotNil13, isNotUndefined as isNotUndefined8 } from "@wistia/type-guards";
9213
+ import { isNotNil as isNotNil13, isNotUndefined as isNotUndefined9 } from "@wistia/type-guards";
9182
9214
  import { useMemo as useMemo7 } from "react";
9183
9215
 
9184
9216
  // src/components/Menu/MenuContext.tsx
@@ -9304,7 +9336,7 @@ var Menu = ({
9304
9336
  modal: false,
9305
9337
  ...controlProps,
9306
9338
  children: [
9307
- /* @__PURE__ */ jsx224(DropdownMenuTrigger, { asChild: true, children: isNotUndefined8(trigger) ? trigger : /* @__PURE__ */ jsx224(
9339
+ /* @__PURE__ */ jsx224(DropdownMenuTrigger, { asChild: true, children: isNotUndefined9(trigger) ? trigger : /* @__PURE__ */ jsx224(
9308
9340
  Button,
9309
9341
  {
9310
9342
  "aria-expanded": isOpen,
@@ -9377,7 +9409,7 @@ import { isNotNil as isNotNil15 } from "@wistia/type-guards";
9377
9409
  // src/components/Menu/MenuItemButton.tsx
9378
9410
  import { forwardRef as forwardRef13 } from "react";
9379
9411
  import styled38 from "styled-components";
9380
- import { isNotNil as isNotNil14, isNotUndefined as isNotUndefined9 } from "@wistia/type-guards";
9412
+ import { isNotNil as isNotNil14, isNotUndefined as isNotUndefined10 } from "@wistia/type-guards";
9381
9413
  import { jsx as jsx226, jsxs as jsxs23 } from "react/jsx-runtime";
9382
9414
  var StyledButton3 = styled38(Button)`
9383
9415
  ${({ colorScheme }) => getColorScheme(colorScheme)};
@@ -9455,7 +9487,7 @@ var StyledBadgeContainer = styled38.div`
9455
9487
  var MenuItemButton = forwardRef13(({ children, appearance, command, icon, ...props }, ref) => {
9456
9488
  let { colorScheme, badge } = props;
9457
9489
  if (appearance === "dangerous") {
9458
- if (isNotUndefined9(colorScheme)) {
9490
+ if (isNotUndefined10(colorScheme)) {
9459
9491
  console.warn("colorScheme prop is ignored when appearance is dangerous");
9460
9492
  }
9461
9493
  colorScheme = "error";