@wistia/ui 0.14.36 → 0.14.37-beta.82ee8b9b.f3a4bf4

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.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.14.36
3
+ * @license @wistia/ui v0.14.37-beta.82ee8b9b.f3a4bf4
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -7382,6 +7382,7 @@ var Button = forwardRef2(
7382
7382
  type: "button",
7383
7383
  ...props,
7384
7384
  ...commonProps,
7385
+ "data-wui-button": true,
7385
7386
  children: unstyled ? children : /* @__PURE__ */ jsx198(
7386
7387
  ButtonContent,
7387
7388
  {
@@ -11016,7 +11017,7 @@ import { useCallback as useCallback13, useEffect as useEffect11, useRef as useRe
11016
11017
  import { parseHex as parseHex2 } from "culori/fn";
11017
11018
 
11018
11019
  // src/components/Input/Input.tsx
11019
- import { forwardRef as forwardRef15, cloneElement as cloneElement4, useRef as useRef9 } from "react";
11020
+ import { isValidElement as isValidElement2, forwardRef as forwardRef15, cloneElement as cloneElement4, useRef as useRef9 } from "react";
11020
11021
  import styled44, { css as css29 } from "styled-components";
11021
11022
  import { isNil as isNil13, isNotNil as isNotNil18, isRecord as isRecord4 } from "@wistia/type-guards";
11022
11023
 
@@ -11172,14 +11173,14 @@ var Input = forwardRef15(
11172
11173
  if (isNil13(leftIcon) && type === "search") {
11173
11174
  leftIconToDisplay = /* @__PURE__ */ jsx247(Icon, { type: "search" });
11174
11175
  }
11175
- if (isNotNil18(leftIconToDisplay)) {
11176
+ if (isNotNil18(leftIconToDisplay) && isValidElement2(leftIconToDisplay)) {
11176
11177
  leftIconToDisplay = cloneElement4(leftIconToDisplay, {
11177
11178
  size: "md",
11178
11179
  className: "wui-input-left-icon"
11179
11180
  });
11180
11181
  }
11181
11182
  let rightIconToDisplay = rightIcon;
11182
- if (isNotNil18(rightIconToDisplay)) {
11183
+ if (isNotNil18(rightIconToDisplay) && isValidElement2(rightIconToDisplay)) {
11183
11184
  rightIconToDisplay = cloneElement4(rightIconToDisplay, {
11184
11185
  size: "md",
11185
11186
  className: "wui-input-right-icon"
@@ -11913,10 +11914,11 @@ import {
11913
11914
  useTransition,
11914
11915
  useEffect as useEffect15,
11915
11916
  Children as Children5,
11916
- isValidElement as isValidElement2
11917
+ isValidElement as isValidElement3
11917
11918
  } from "react";
11918
11919
  import { matchSorter } from "match-sorter";
11919
11920
  import styled50 from "styled-components";
11921
+ import { isString as isString2 } from "@wistia/type-guards";
11920
11922
 
11921
11923
  // src/components/Tag/Tag.tsx
11922
11924
  import { forwardRef as forwardRef16 } from "react";
@@ -12229,14 +12231,15 @@ var ComboboxOption = ({ value, children }) => {
12229
12231
  var extractOptions = (children) => {
12230
12232
  const options = {};
12231
12233
  Children5.forEach(children, (child) => {
12232
- if (isValidElement2(child) && "value" in child.props && "children" in child.props) {
12234
+ if (isValidElement3(child) && "value" in child.props && "children" in child.props) {
12233
12235
  options[child.props.value] = child.props.children ?? child.props.value;
12234
12236
  }
12235
12237
  });
12236
12238
  return options;
12237
12239
  };
12238
12240
  var defaultDisplayValues = (values, onRemove) => {
12239
- return values.map((selectedValue) => /* @__PURE__ */ jsx254(
12241
+ const valueArray = Array.isArray(values) ? values : [values];
12242
+ return valueArray.map((selectedValue) => /* @__PURE__ */ jsx254(
12240
12243
  Tag,
12241
12244
  {
12242
12245
  href: "https://example.com",
@@ -12277,7 +12280,11 @@ var Combobox2 = ({
12277
12280
  return () => null;
12278
12281
  }, []);
12279
12282
  const handleRemoveValue = (valueToRemove) => {
12280
- onChange(value.filter((val) => val !== valueToRemove));
12283
+ if (isString2(value)) {
12284
+ onChange("");
12285
+ return;
12286
+ }
12287
+ onChange(typeof value === "string" ? "" : value.filter((val) => val !== valueToRemove));
12281
12288
  };
12282
12289
  const matches = useMemo11(() => {
12283
12290
  return matchSorter(Object.keys(options), searchValue);
@@ -12676,10 +12683,10 @@ var MenuItemButton = forwardRef18(({ children, appearance, command, icon, ...pro
12676
12683
  fullWidth: true,
12677
12684
  unstyled: true,
12678
12685
  children: [
12679
- props.leftIcon ? /* @__PURE__ */ jsx257(StyledLeftIconContainer, { children: props.leftIcon }) : null,
12686
+ isNotNil21(props.leftIcon) ? /* @__PURE__ */ jsx257(StyledLeftIconContainer, { children: props.leftIcon }) : null,
12680
12687
  /* @__PURE__ */ jsx257(StyledLabelAndDescriptionContainer, { children }),
12681
12688
  isNotNil21(badge) || isNotNil21(command) ? /* @__PURE__ */ jsx257(StyledBadgeContainer, { children: badge ?? command }) : null,
12682
- props.rightIcon ? /* @__PURE__ */ jsx257(StyledRightIconContainer, { children: props.rightIcon }) : null
12689
+ isNotNil21(props.rightIcon) ? /* @__PURE__ */ jsx257(StyledRightIconContainer, { children: props.rightIcon }) : null
12683
12690
  ]
12684
12691
  }
12685
12692
  );
@@ -16929,7 +16936,7 @@ ThumbnailBadge.displayName = "ThumbnailBadge_UI";
16929
16936
  // src/components/Thumbnail/Thumbnail.tsx
16930
16937
  import { forwardRef as forwardRef37, useState as useState26, useRef as useRef24, useCallback as useCallback20, useMemo as useMemo17 } from "react";
16931
16938
  import styled106 from "styled-components";
16932
- import { isNil as isNil18, isNotNil as isNotNil43, isUndefined as isUndefined7, isEmptyString as isEmptyString2, isString as isString2 } from "@wistia/type-guards";
16939
+ import { isNil as isNil18, isNotNil as isNotNil43, isUndefined as isUndefined7, isEmptyString as isEmptyString2, isString as isString3 } from "@wistia/type-guards";
16933
16940
 
16934
16941
  // src/private/helpers/getBackgroundGradient/getBackgroundGradient.ts
16935
16942
  import { isNotNil as isNotNil41 } from "@wistia/type-guards";
@@ -17322,7 +17329,7 @@ var Thumbnail = forwardRef37(
17322
17329
  frameCount,
17323
17330
  aspectRatio
17324
17331
  } = storyboard;
17325
- const targetWidth = isString2(width) ? parseInt(width, 10) : Number(width);
17332
+ const targetWidth = isString3(width) ? parseInt(width, 10) : Number(width);
17326
17333
  const effectiveCursorPosition = isStoryboardReady ? cursorPosition : null;
17327
17334
  return /* @__PURE__ */ jsx322(
17328
17335
  ThumbnailStoryboardViewer,
@@ -17608,6 +17615,76 @@ var WistiaLogo = ({
17608
17615
  return href !== void 0 ? /* @__PURE__ */ jsx324("a", { href, children: Logo }) : Logo;
17609
17616
  };
17610
17617
  WistiaLogo.displayName = "WistiaLogo_UI";
17618
+
17619
+ // src/components/SplitButton/SplitButton.tsx
17620
+ import styled109 from "styled-components";
17621
+ import { isNotNil as isNotNil45 } from "@wistia/type-guards";
17622
+ import { jsx as jsx325, jsxs as jsxs70 } from "react/jsx-runtime";
17623
+ var StyledSplitButton = styled109.span`
17624
+ white-space: nowrap;
17625
+
17626
+ > [data-wui-button='true']:first-child {
17627
+ border-top-right-radius: 0;
17628
+ border-bottom-right-radius: 0;
17629
+ }
17630
+
17631
+ > [data-wui-button='true']:last-child {
17632
+ border-top-left-radius: 0;
17633
+ border-bottom-left-radius: 0;
17634
+ display: inline-flex;
17635
+ }
17636
+ `;
17637
+ var SplitButton = ({
17638
+ children,
17639
+ menuLabel = "Select an option",
17640
+ menuIcon = /* @__PURE__ */ jsx325(Icon, { type: "caret-down" }),
17641
+ menuItems,
17642
+ disabled = false,
17643
+ colorScheme = "default",
17644
+ variant = "solid",
17645
+ secondaryAction,
17646
+ size = "md",
17647
+ unstyled = false,
17648
+ menuProps = {},
17649
+ ...props
17650
+ }) => {
17651
+ return /* @__PURE__ */ jsxs70(StyledSplitButton, { children: [
17652
+ /* @__PURE__ */ jsx325(
17653
+ Button,
17654
+ {
17655
+ colorScheme,
17656
+ disabled,
17657
+ size,
17658
+ unstyled,
17659
+ variant,
17660
+ ...props,
17661
+ children
17662
+ }
17663
+ ),
17664
+ isNotNil45(menuItems) && /* @__PURE__ */ jsx325(
17665
+ Menu,
17666
+ {
17667
+ ...menuProps,
17668
+ disabled,
17669
+ trigger: /* @__PURE__ */ jsx325(
17670
+ IconButton,
17671
+ {
17672
+ colorScheme,
17673
+ disabled,
17674
+ label: menuLabel,
17675
+ size,
17676
+ unstyled,
17677
+ variant,
17678
+ children: menuIcon
17679
+ }
17680
+ ),
17681
+ children: menuItems
17682
+ }
17683
+ ),
17684
+ isNotNil45(secondaryAction) && secondaryAction
17685
+ ] });
17686
+ };
17687
+ SplitButton.displayName = "SplitButton_UI";
17611
17688
  export {
17612
17689
  ActionButton,
17613
17690
  Avatar,
@@ -17712,6 +17789,7 @@ export {
17712
17789
  SelectOption,
17713
17790
  SelectOptionGroup,
17714
17791
  Slider,
17792
+ SplitButton,
17715
17793
  Stack,
17716
17794
  SubMenu,
17717
17795
  Switch,