@wistia/ui 0.9.1-beta.b8332614.8cc3bc7 → 0.9.1

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.9.1-beta.b8332614.8cc3bc7
3
+ * @license @wistia/ui v0.9.1
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -57,7 +57,6 @@ __export(index_exports, {
57
57
  CollapsibleContent: () => CollapsibleContent,
58
58
  CollapsibleTrigger: () => CollapsibleTrigger,
59
59
  ColorSchemeWrapper: () => ColorSchemeWrapper,
60
- Combobox: () => Combobox2,
61
60
  DataCard: () => DataCard,
62
61
  DataCardTrend: () => DataCardTrend,
63
62
  DataCards: () => DataCards,
@@ -13614,245 +13613,6 @@ var List = ({
13614
13613
  return null;
13615
13614
  };
13616
13615
  List.displayName = "List";
13617
-
13618
- // src/components/Combobox/Combobox.tsx
13619
- var Ariakit = __toESM(require("@ariakit/react"));
13620
- var import_react73 = require("react");
13621
- var import_match_sorter = require("match-sorter");
13622
- var import_styled_components97 = __toESM(require("styled-components"));
13623
- var import_jsx_runtime278 = require("react/jsx-runtime");
13624
- var ComboboxWapper = import_styled_components97.default.div`
13625
- ${inputCssVariables};
13626
- width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
13627
- padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
13628
- background-color: var(--wui-input-color-bg);
13629
- border: none;
13630
- outline: 1px solid var(--wui-input-color-border);
13631
- outline-offset: -1px;
13632
- border-radius: var(--wui-input-border-radius);
13633
- font-size: var(--wui-input-font-size);
13634
- line-height: var(--wui-input-line-height);
13635
- font-weight: var(--wui-input-font-weight);
13636
- color: var(--wui-input-color-text);
13637
- display: inline-flex;
13638
- flex-wrap: wrap;
13639
- gap: var(--wui-space-01);
13640
-
13641
- > * {
13642
- width: min-content !important;
13643
- }
13644
-
13645
- &:focus-within {
13646
- outline: 2px solid var(--wui-input-color-border-focus);
13647
- outline-offset: -2px;
13648
- }
13649
-
13650
- input {
13651
- outline: 0 none;
13652
- border: 0 none;
13653
-
13654
- &::placeholder {
13655
- color: var(--wui-input-placeholder);
13656
- opacity: 1;
13657
- }
13658
-
13659
- &:focus {
13660
- outline: 0;
13661
- }
13662
-
13663
- &[aria-invalid='true'] {
13664
- outline-color: var(--wui-input-color-border-error);
13665
- }
13666
-
13667
- &:disabled {
13668
- outline-color: var(--wui-color-border-disabled);
13669
- background-color: var(--wui-color-bg-surface-disabled);
13670
- }
13671
- }
13672
- `;
13673
- var ComboboxInput = (0, import_styled_components97.default)(Ariakit.Combobox)`
13674
- appearance: none;
13675
- padding: 0;
13676
- width: 100%;
13677
- border: 0 none;
13678
- flex: 1;
13679
-
13680
- &[data-focus-visible] {
13681
- outline-style: solid;
13682
- }
13683
-
13684
- &[data-active-item] {
13685
- outline-width: 2px;
13686
- }
13687
- `;
13688
- var ComboboxPopover = (0, import_styled_components97.default)(Ariakit.Popover)`
13689
- --wui-combobox-content-border: var(--wui-color-border);
13690
- --wui-combobox-content-bg: var(--wui-color-bg-surface);
13691
- --wui-combobox-content-border-radius: var(--wui-border-radius-02);
13692
- --wui-combobox-option-padding: var(--wui-space-02);
13693
- --wui-combobox-option-inner-gap: var(--wui-space-03);
13694
- --wui-combobox-option-bg-hover: var(--wui-color-bg-surface-hover);
13695
-
13696
- border-radius: var(--wui-border-radius-02);
13697
- padding: var(--wui-space-04);
13698
- max-height: var(--wui-popover-max-height, 300px);
13699
- background-color: var(--wui-color-bg-surface);
13700
- box-shadow: var(--wui-elevation-01);
13701
- border: 1px solid var(--wui-color-border);
13702
- position: relative;
13703
- z-index: 50;
13704
- display: flex;
13705
- flex-direction: column;
13706
- overflow: auto;
13707
- overscroll-behavior: contain;
13708
-
13709
- &[aria-busy='true'] {
13710
- --item-opacity: 0.5;
13711
- }
13712
- `;
13713
- var ComboboxItem2 = (0, import_styled_components97.default)(Ariakit.ComboboxItem)`
13714
- ${variantStyleMap2.body3};
13715
- display: flex;
13716
- padding: var(--wui-combobox-option-padding);
13717
- gap: var(--wui-combobox-option-inner-gap);
13718
- font-size: var(--font-size);
13719
- font-weight: var(--font-weight);
13720
- border-radius: var(--wui-border-radius-01);
13721
- align-items: center;
13722
- cursor: pointer;
13723
-
13724
- &:hover,
13725
- &:focus-visible {
13726
- background-color: var(--wui-combobox-option-bg-hover);
13727
- outline: none;
13728
- }
13729
-
13730
- &[aria-disabled='true'] {
13731
- color: var(--wui-color-text-disabled);
13732
- }
13733
-
13734
- &[aria-disabled='true']:hover {
13735
- background-color: transparent;
13736
- }
13737
- `;
13738
- var NoResults = import_styled_components97.default.div`
13739
- gap: var(--wui-space-02);
13740
- `;
13741
- var POPOVER_WIDTH_OFFSET = 20;
13742
- var extractOptions = (children) => {
13743
- const options = {};
13744
- import_react73.Children.forEach(children, (child) => {
13745
- if ((0, import_react73.isValidElement)(child) && "value" in child.props && "children" in child.props) {
13746
- options[child.props.value] = child.props.children ?? child.props.value;
13747
- }
13748
- });
13749
- return options;
13750
- };
13751
- var Combobox2 = ({
13752
- placeholder,
13753
- value = [],
13754
- onChange,
13755
- searchValue,
13756
- onSearchValueChange,
13757
- children,
13758
- fullWidth = true
13759
- }) => {
13760
- const [isPending, startTransition] = (0, import_react73.useTransition)();
13761
- const [wrapperWidth, setWrapperWidth] = (0, import_react73.useState)("auto");
13762
- const comboboxWrapperRef = (0, import_react73.useRef)(null);
13763
- const options = (0, import_react73.useMemo)(() => extractOptions(children), [children]);
13764
- (0, import_react73.useEffect)(() => {
13765
- const comboboxWrapper = comboboxWrapperRef.current;
13766
- if (comboboxWrapper) {
13767
- const updateWidthVariable = () => {
13768
- const { width } = comboboxWrapper.getBoundingClientRect();
13769
- setWrapperWidth(`${width - POPOVER_WIDTH_OFFSET}px`);
13770
- };
13771
- updateWidthVariable();
13772
- window.addEventListener("resize", updateWidthVariable);
13773
- return () => {
13774
- window.removeEventListener("resize", updateWidthVariable);
13775
- };
13776
- }
13777
- return () => null;
13778
- }, []);
13779
- const handleRemoveValue = (valueToRemove) => {
13780
- onChange(value.filter((val) => val !== valueToRemove));
13781
- };
13782
- const matches = (0, import_react73.useMemo)(() => {
13783
- return (0, import_match_sorter.matchSorter)(Object.keys(options), searchValue);
13784
- }, [options, searchValue]);
13785
- return /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
13786
- Ariakit.ComboboxProvider,
13787
- {
13788
- selectedValue: value,
13789
- setSelectedValue: onChange,
13790
- setValue: (nextValue) => {
13791
- startTransition(() => {
13792
- onSearchValueChange(nextValue);
13793
- });
13794
- },
13795
- children: [
13796
- /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
13797
- ComboboxWapper,
13798
- {
13799
- ref: comboboxWrapperRef,
13800
- $fullWidth: fullWidth,
13801
- children: [
13802
- value.map((selectedValue) => /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
13803
- Tag,
13804
- {
13805
- href: "https://example.com",
13806
- label: selectedValue,
13807
- onClickRemove: () => handleRemoveValue(selectedValue),
13808
- onClickRemoveLabel: `Remove ${selectedValue}`
13809
- },
13810
- selectedValue
13811
- )),
13812
- /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(ComboboxInput, { placeholder })
13813
- ]
13814
- }
13815
- ),
13816
- /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
13817
- ComboboxPopover,
13818
- {
13819
- "aria-busy": isPending,
13820
- gutter: 8,
13821
- sameWidth: false,
13822
- style: {
13823
- width: wrapperWidth
13824
- },
13825
- children: [
13826
- matches.map((match) => /* @__PURE__ */ (0, import_jsx_runtime278.jsxs)(
13827
- ComboboxItem2,
13828
- {
13829
- className: "combobox-item",
13830
- focusOnHover: true,
13831
- value: match,
13832
- children: [
13833
- /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(
13834
- Icon,
13835
- {
13836
- size: "sm",
13837
- style: {
13838
- opacity: value.includes(match) ? 1 : 0
13839
- },
13840
- type: "checkmark"
13841
- }
13842
- ),
13843
- options[match]
13844
- ]
13845
- },
13846
- match
13847
- )),
13848
- !matches.length && /* @__PURE__ */ (0, import_jsx_runtime278.jsx)(NoResults, { children: "No results found" })
13849
- ]
13850
- }
13851
- )
13852
- ]
13853
- }
13854
- );
13855
- };
13856
13616
  // Annotate the CommonJS export names for ESM import in node:
13857
13617
  0 && (module.exports = {
13858
13618
  ActionButton,
@@ -13873,7 +13633,6 @@ var Combobox2 = ({
13873
13633
  CollapsibleContent,
13874
13634
  CollapsibleTrigger,
13875
13635
  ColorSchemeWrapper,
13876
- Combobox,
13877
13636
  DataCard,
13878
13637
  DataCardTrend,
13879
13638
  DataCards,