@wistia/ui 0.10.4-beta.1ec201d3.a525932 → 0.10.4-beta.36362cd1.2b96fcb

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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.10.4-beta.1ec201d3.a525932
3
+ * @license @wistia/ui v0.10.4-beta.36362cd1.2b96fcb
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -42,7 +42,6 @@ __export(index_exports, {
42
42
  ActionButton: () => ActionButton,
43
43
  Avatar: () => Avatar,
44
44
  Badge: () => Badge,
45
- Banner: () => Banner,
46
45
  Box: () => Box,
47
46
  Breadcrumb: () => Breadcrumb,
48
47
  Breadcrumbs: () => Breadcrumbs,
@@ -7829,6 +7828,7 @@ var StyledBadge = import_styled_components26.default.div`
7829
7828
  ${({ $colorScheme }) => getColorScheme($colorScheme)};
7830
7829
  align-items: center;
7831
7830
  background-color: var(--wui-color-bg-surface-secondary);
7831
+ box-shadow: ${({ $variant }) => $variant === "outline" ? "inset 0 0 0 1px var(--wui-color-border)" : "none"};
7832
7832
  border-radius: var(--wui-border-radius-rounded);
7833
7833
  color: var(--wui-color-text);
7834
7834
  display: inline-flex;
@@ -7836,17 +7836,21 @@ var StyledBadge = import_styled_components26.default.div`
7836
7836
  font-weight: var(--wui-typography-label-4-weight);
7837
7837
  gap: var(--wui-space-01);
7838
7838
  justify-content: center;
7839
+ line-height: var(--wui-typography-label-3-line-height);
7839
7840
  padding: var(--wui-space-01) var(--wui-space-02);
7840
7841
  width: fit-content;
7841
7842
 
7842
- /* Icon component size */
7843
- svg {
7844
- height: 12px;
7845
- width: 12px;
7843
+ /* Icon component size and color */
7844
+ && {
7845
+ svg {
7846
+ color: var(--wui-color-icon);
7847
+ height: 12px;
7848
+ width: 12px;
7849
+ }
7846
7850
  }
7847
7851
  `;
7848
7852
  var Badge = (0, import_react26.forwardRef)(
7849
- ({ colorScheme = "inherit", label, icon, ...props }, ref) => {
7853
+ ({ colorScheme = "inherit", label, icon, variant = "default", ...props }, ref) => {
7850
7854
  const hasIcon = (0, import_type_guards19.isNotNil)(icon);
7851
7855
  return /* @__PURE__ */ (0, import_jsx_runtime200.jsxs)(
7852
7856
  StyledBadge,
@@ -7855,6 +7859,7 @@ var Badge = (0, import_react26.forwardRef)(
7855
7859
  ...props,
7856
7860
  $colorScheme: colorScheme,
7857
7861
  $hasIcon: hasIcon,
7862
+ $variant: variant,
7858
7863
  children: [
7859
7864
  hasIcon ? icon : null,
7860
7865
  /* @__PURE__ */ (0, import_jsx_runtime200.jsx)("span", { children: label })
@@ -9905,7 +9910,6 @@ var StyledForm = import_styled_components51.default.form`
9905
9910
  --form-default-width: 690px;
9906
9911
 
9907
9912
  max-width: ${({ $fullWidth }) => $fullWidth ? "auto" : "var(--form-default-width)"};
9908
- align-items: ${({ $fullWidth }) => $fullWidth ? "stretch" : "flex-start"};
9909
9913
  `;
9910
9914
  var FormContext = (0, import_react41.createContext)({
9911
9915
  values: {},
@@ -9986,6 +9990,7 @@ var FormComponent = ({
9986
9990
  ...props,
9987
9991
  ref,
9988
9992
  $fullWidth: fullWidth,
9993
+ alignItems: fullWidth ? "stretch" : "flex-start",
9989
9994
  as: StyledForm,
9990
9995
  gap: "space-05",
9991
9996
  id,
@@ -13703,192 +13708,13 @@ var List = ({
13703
13708
  };
13704
13709
  List.displayName = "List";
13705
13710
 
13706
- // src/components/Banner/Banner.tsx
13707
- var import_react73 = require("react");
13708
- var import_styled_components96 = __toESM(require("styled-components"));
13709
- var import_type_guards61 = require("@wistia/type-guards");
13710
- var import_jsx_runtime279 = require("react/jsx-runtime");
13711
- var BREAKPOINT_WIDTH = 600;
13712
- var VERTICAL_BREAKPOINT_WIDTH = 360;
13713
- var MIN_IMAGE_WIDTH = 400;
13714
- var StyledBanner = import_styled_components96.default.div`
13715
- --wui-banner-padding: var(--wui-space-04);
13716
- --wui-banner-content-height: ${({ $contentHeight }) => $contentHeight}px;
13717
-
13718
- display: flex;
13719
- flex-direction: row;
13720
- background: var(--wui-color-bg-surface-secondary);
13721
- border-radius: var(--wui-border-radius-03);
13722
- position: relative;
13723
- overflow: hidden;
13724
- align-items: center;
13725
-
13726
- &[data-wui-banner-content-prominence='secondary'] {
13727
- --wui-banner-padding: var(--wui-space-05);
13728
-
13729
- box-shadow: inset 0 0 0 2px var(--wui-color-border);
13730
- }
13731
-
13732
- &:has([data-wui-banner-image]) {
13733
- --wui-banner-padding: var(--wui-space-05);
13734
- }
13735
-
13736
- &[data-wui-banner-content-prominence='small'] {
13737
- --wui-banner-padding: var(--wui-space-04);
13738
- }
13739
-
13740
- &[data-wui-banner-orientation='vertical'] {
13741
- flex-direction: column;
13742
- align-items: stretch;
13743
- }
13744
-
13745
- ${({ $colorScheme }) => getColorScheme($colorScheme)};
13746
- `;
13747
- var IconWrapper = (0, import_styled_components96.default)(Box)`
13748
- --wui-banner-icon-size: var(--font-size, 24px);
13749
-
13750
- ${({ $iconPosition }) => $iconPosition === "inline" && import_styled_components96.css`
13751
- display: inline-block;
13752
- vertical-align: text-bottom;
13753
- margin-right: calc(var(--wui-banner-icon-size) / 3);
13754
- `}
13755
-
13756
- svg {
13757
- color: var(--wui-color-icon);
13758
- width: var(--wui-banner-icon-size);
13759
- height: var(--wui-banner-icon-size);
13760
- }
13761
- `;
13762
- var Banner = ({
13763
- bodyText,
13764
- colorScheme = "inherit",
13765
- headingText,
13766
- icon,
13767
- image,
13768
- onClose,
13769
- orientation = "horizontal",
13770
- primaryAction,
13771
- prominence = "default",
13772
- secondaryAction,
13773
- ...props
13774
- }) => {
13775
- const [containerRef, { width }] = useElementObserver();
13776
- const [contentRef, { height: contentHeight }] = useElementObserver();
13777
- const [isSmallContainer, setIsSmallContainer] = (0, import_react73.useState)(false);
13778
- const [isVerticalLayout, setIsVerticalLayout] = (0, import_react73.useState)(orientation === "vertical");
13779
- (0, import_react73.useEffect)(() => {
13780
- const breakpoint = orientation === "vertical" ? VERTICAL_BREAKPOINT_WIDTH : BREAKPOINT_WIDTH;
13781
- setIsSmallContainer(width <= breakpoint);
13782
- if (orientation === "auto") {
13783
- setIsVerticalLayout(width <= BREAKPOINT_WIDTH);
13784
- }
13785
- }, [width, orientation]);
13786
- const hasImage = (0, import_type_guards61.isNotNil)(image);
13787
- const shouldShowImage = hasImage && (isVerticalLayout || width >= MIN_IMAGE_WIDTH);
13788
- const iconPosition = (0, import_react73.useMemo)(() => {
13789
- if ((0, import_type_guards61.isNil)(icon)) return "none";
13790
- if (isSmallContainer) return shouldShowImage ? "inline" : "above";
13791
- return prominence === "secondary" ? "inline" : "above";
13792
- }, [icon, isSmallContainer, shouldShowImage, prominence]);
13793
- const contentDirection = (0, import_react73.useMemo)(
13794
- () => !shouldShowImage && prominence === "default" && !isSmallContainer && !isVerticalLayout ? "row" : "column",
13795
- [shouldShowImage, prominence, isSmallContainer, isVerticalLayout]
13796
- );
13797
- const headingVariant = isSmallContainer || prominence === "default" ? "heading5" : "heading3";
13798
- const textVariant = prominence === "default" || isSmallContainer ? "body3" : "body2";
13799
- const buttonSize = isSmallContainer ? "sm" : "md";
13800
- const hasActions = (0, import_type_guards61.isNotNil)(primaryAction) || (0, import_type_guards61.isNotNil)(secondaryAction);
13801
- return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
13802
- StyledBanner,
13803
- {
13804
- ...props,
13805
- ref: containerRef,
13806
- $colorScheme: colorScheme,
13807
- $contentHeight: contentHeight,
13808
- $width: !isSmallContainer && !isVerticalLayout ? width : void 0,
13809
- "data-wui-banner-content-prominence": isSmallContainer ? "small" : prominence,
13810
- "data-wui-banner-orientation": isVerticalLayout ? "vertical" : "horizontal",
13811
- children: [
13812
- shouldShowImage ? image : null,
13813
- /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
13814
- Box,
13815
- {
13816
- ref: contentRef,
13817
- alignItems: "stretch",
13818
- direction: contentDirection,
13819
- flexMode: "grow",
13820
- gap: "space-04",
13821
- style: { padding: "var(--wui-banner-padding)" },
13822
- children: [
13823
- iconPosition === "above" && /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
13824
- IconWrapper,
13825
- {
13826
- $iconPosition: "above",
13827
- alignSelf: "stretch",
13828
- direction: "column",
13829
- justifyContent: "center",
13830
- children: icon
13831
- }
13832
- ),
13833
- /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
13834
- Box,
13835
- {
13836
- direction: "column",
13837
- flexMode: contentDirection === "row" ? "grow" : "initial",
13838
- gap: iconPosition === "inline" ? "space-01" : "space-00",
13839
- justifyContent: "center",
13840
- children: [
13841
- (0, import_type_guards61.isNotNil)(headingText) ? /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(Heading, { variant: headingVariant, children: [
13842
- iconPosition === "inline" && /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(IconWrapper, { $iconPosition: "inline", children: icon }),
13843
- headingText
13844
- ] }) : null,
13845
- /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(Text, { variant: textVariant, children: bodyText })
13846
- ]
13847
- }
13848
- ),
13849
- hasActions ? /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
13850
- ButtonGroup,
13851
- {
13852
- buttonSize,
13853
- collapseOnSmallScreens: false,
13854
- style: { paddingRight: "var(--wui-space-02)" },
13855
- children: [
13856
- (0, import_type_guards61.isNotNil)(primaryAction) && primaryAction,
13857
- (0, import_type_guards61.isNotNil)(secondaryAction) && secondaryAction
13858
- ]
13859
- }
13860
- ) : null
13861
- ]
13862
- }
13863
- ),
13864
- (0, import_type_guards61.isNotNil)(onClose) && /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
13865
- IconButton,
13866
- {
13867
- label: "Close",
13868
- onClick: onClose,
13869
- size: "sm",
13870
- style: {
13871
- position: "absolute",
13872
- top: "var(--wui-space-01)",
13873
- right: "var(--wui-space-01)"
13874
- },
13875
- variant: "soft",
13876
- children: /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(Icon, { type: "close" })
13877
- }
13878
- )
13879
- ]
13880
- }
13881
- );
13882
- };
13883
- Banner.displayName = "Banner";
13884
-
13885
13711
  // src/components/Combobox/Combobox.tsx
13886
13712
  var Ariakit = __toESM(require("@ariakit/react"));
13887
- var import_react74 = require("react");
13713
+ var import_react73 = require("react");
13888
13714
  var import_match_sorter = require("match-sorter");
13889
- var import_styled_components97 = __toESM(require("styled-components"));
13890
- var import_jsx_runtime280 = require("react/jsx-runtime");
13891
- var ComboboxWapper = import_styled_components97.default.div`
13715
+ var import_styled_components96 = __toESM(require("styled-components"));
13716
+ var import_jsx_runtime279 = require("react/jsx-runtime");
13717
+ var ComboboxWapper = import_styled_components96.default.div`
13892
13718
  ${inputCss};
13893
13719
  width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
13894
13720
  padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
@@ -13937,7 +13763,7 @@ var ComboboxWapper = import_styled_components97.default.div`
13937
13763
  }
13938
13764
  }
13939
13765
  `;
13940
- var ComboboxInput = (0, import_styled_components97.default)(Ariakit.Combobox)`
13766
+ var ComboboxInput = (0, import_styled_components96.default)(Ariakit.Combobox)`
13941
13767
  appearance: none;
13942
13768
  padding: 0;
13943
13769
  width: 100%;
@@ -13952,7 +13778,7 @@ var ComboboxInput = (0, import_styled_components97.default)(Ariakit.Combobox)`
13952
13778
  outline-width: 2px;
13953
13779
  }
13954
13780
  `;
13955
- var ComboboxPopover = (0, import_styled_components97.default)(Ariakit.Popover)`
13781
+ var ComboboxPopover = (0, import_styled_components96.default)(Ariakit.Popover)`
13956
13782
  --wui-combobox-content-border: var(--wui-color-border);
13957
13783
  --wui-combobox-content-bg: var(--wui-color-bg-surface);
13958
13784
  --wui-combobox-content-border-radius: var(--wui-border-radius-02);
@@ -13977,7 +13803,7 @@ var ComboboxPopover = (0, import_styled_components97.default)(Ariakit.Popover)`
13977
13803
  --item-opacity: 0.5;
13978
13804
  }
13979
13805
  `;
13980
- var ComboboxItem2 = (0, import_styled_components97.default)(Ariakit.ComboboxItem)`
13806
+ var ComboboxItem2 = (0, import_styled_components96.default)(Ariakit.ComboboxItem)`
13981
13807
  ${variantStyleMap2.body3};
13982
13808
  display: flex;
13983
13809
  padding: var(--wui-combobox-option-padding);
@@ -14002,12 +13828,12 @@ var ComboboxItem2 = (0, import_styled_components97.default)(Ariakit.ComboboxItem
14002
13828
  background-color: transparent;
14003
13829
  }
14004
13830
  `;
14005
- var NoResults = import_styled_components97.default.div`
13831
+ var NoResults = import_styled_components96.default.div`
14006
13832
  gap: var(--wui-space-02);
14007
13833
  `;
14008
13834
  var POPOVER_WIDTH_OFFSET = 20;
14009
13835
  var ComboboxOption = ({ value, children }) => {
14010
- return /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
13836
+ return /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
14011
13837
  ComboboxItem2,
14012
13838
  {
14013
13839
  className: "combobox-item",
@@ -14019,8 +13845,8 @@ var ComboboxOption = ({ value, children }) => {
14019
13845
  };
14020
13846
  var extractOptions = (children) => {
14021
13847
  const options = {};
14022
- import_react74.Children.forEach(children, (child) => {
14023
- if ((0, import_react74.isValidElement)(child) && "value" in child.props && "children" in child.props) {
13848
+ import_react73.Children.forEach(children, (child) => {
13849
+ if ((0, import_react73.isValidElement)(child) && "value" in child.props && "children" in child.props) {
14024
13850
  options[child.props.value] = child.props.children ?? child.props.value;
14025
13851
  }
14026
13852
  });
@@ -14035,11 +13861,11 @@ var Combobox2 = ({
14035
13861
  children,
14036
13862
  fullWidth = true
14037
13863
  }) => {
14038
- const [isPending, startTransition] = (0, import_react74.useTransition)();
14039
- const [wrapperWidth, setWrapperWidth] = (0, import_react74.useState)("auto");
14040
- const comboboxWrapperRef = (0, import_react74.useRef)(null);
14041
- const options = (0, import_react74.useMemo)(() => extractOptions(children), [children]);
14042
- (0, import_react74.useEffect)(() => {
13864
+ const [isPending, startTransition] = (0, import_react73.useTransition)();
13865
+ const [wrapperWidth, setWrapperWidth] = (0, import_react73.useState)("auto");
13866
+ const comboboxWrapperRef = (0, import_react73.useRef)(null);
13867
+ const options = (0, import_react73.useMemo)(() => extractOptions(children), [children]);
13868
+ (0, import_react73.useEffect)(() => {
14043
13869
  const comboboxWrapper = comboboxWrapperRef.current;
14044
13870
  if (comboboxWrapper) {
14045
13871
  const updateWidthVariable = () => {
@@ -14057,10 +13883,10 @@ var Combobox2 = ({
14057
13883
  const handleRemoveValue = (valueToRemove) => {
14058
13884
  onChange(value.filter((val) => val !== valueToRemove));
14059
13885
  };
14060
- const matches = (0, import_react74.useMemo)(() => {
13886
+ const matches = (0, import_react73.useMemo)(() => {
14061
13887
  return (0, import_match_sorter.matchSorter)(Object.keys(options), searchValue);
14062
13888
  }, [options, searchValue]);
14063
- return /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
13889
+ return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
14064
13890
  Ariakit.ComboboxProvider,
14065
13891
  {
14066
13892
  selectedValue: value,
@@ -14071,13 +13897,13 @@ var Combobox2 = ({
14071
13897
  });
14072
13898
  },
14073
13899
  children: [
14074
- /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
13900
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
14075
13901
  ComboboxWapper,
14076
13902
  {
14077
13903
  ref: comboboxWrapperRef,
14078
13904
  $fullWidth: fullWidth,
14079
13905
  children: [
14080
- value.map((selectedValue) => /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
13906
+ value.map((selectedValue) => /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
14081
13907
  Tag,
14082
13908
  {
14083
13909
  href: "https://example.com",
@@ -14087,11 +13913,11 @@ var Combobox2 = ({
14087
13913
  },
14088
13914
  selectedValue
14089
13915
  )),
14090
- /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(ComboboxInput, { placeholder })
13916
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(ComboboxInput, { placeholder })
14091
13917
  ]
14092
13918
  }
14093
13919
  ),
14094
- /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
13920
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
14095
13921
  ComboboxPopover,
14096
13922
  {
14097
13923
  "aria-busy": isPending,
@@ -14101,14 +13927,14 @@ var Combobox2 = ({
14101
13927
  width: wrapperWidth
14102
13928
  },
14103
13929
  children: [
14104
- matches.map((match) => /* @__PURE__ */ (0, import_jsx_runtime280.jsxs)(
13930
+ matches.map((match) => /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
14105
13931
  ComboboxItem2,
14106
13932
  {
14107
13933
  className: "combobox-item",
14108
13934
  focusOnHover: true,
14109
13935
  value: match,
14110
13936
  children: [
14111
- /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(
13937
+ /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
14112
13938
  Icon,
14113
13939
  {
14114
13940
  size: "sm",
@@ -14123,7 +13949,7 @@ var Combobox2 = ({
14123
13949
  },
14124
13950
  match
14125
13951
  )),
14126
- !matches.length && /* @__PURE__ */ (0, import_jsx_runtime280.jsx)(NoResults, { children: "No results found" })
13952
+ !matches.length && /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(NoResults, { children: "No results found" })
14127
13953
  ]
14128
13954
  }
14129
13955
  )
@@ -14136,7 +13962,6 @@ var Combobox2 = ({
14136
13962
  ActionButton,
14137
13963
  Avatar,
14138
13964
  Badge,
14139
- Banner,
14140
13965
  Box,
14141
13966
  Breadcrumb,
14142
13967
  Breadcrumbs,