@wistia/ui 0.10.2-beta.6ea9f134.e1e41c3 → 0.10.2
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 +1 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -33
- package/dist/index.d.ts +1 -33
- package/dist/index.mjs +1 -249
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.10.2
|
|
3
|
+
* @license @wistia/ui v0.10.2
|
|
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,
|
|
@@ -13700,245 +13699,6 @@ var List = ({
|
|
|
13700
13699
|
return null;
|
|
13701
13700
|
};
|
|
13702
13701
|
List.displayName = "List";
|
|
13703
|
-
|
|
13704
|
-
// src/components/Combobox/Combobox.tsx
|
|
13705
|
-
var Ariakit = __toESM(require("@ariakit/react"));
|
|
13706
|
-
var import_react73 = require("react");
|
|
13707
|
-
var import_match_sorter = require("match-sorter");
|
|
13708
|
-
var import_styled_components96 = __toESM(require("styled-components"));
|
|
13709
|
-
var import_jsx_runtime279 = require("react/jsx-runtime");
|
|
13710
|
-
var ComboboxWapper = import_styled_components96.default.div`
|
|
13711
|
-
${inputCss};
|
|
13712
|
-
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
13713
|
-
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
13714
|
-
background-color: var(--wui-input-color-bg);
|
|
13715
|
-
border: none;
|
|
13716
|
-
outline: 1px solid var(--wui-input-color-border);
|
|
13717
|
-
outline-offset: -1px;
|
|
13718
|
-
border-radius: var(--wui-input-border-radius);
|
|
13719
|
-
font-size: var(--wui-input-font-size);
|
|
13720
|
-
line-height: var(--wui-input-line-height);
|
|
13721
|
-
font-weight: var(--wui-input-font-weight);
|
|
13722
|
-
color: var(--wui-input-color-text);
|
|
13723
|
-
display: inline-flex;
|
|
13724
|
-
flex-wrap: wrap;
|
|
13725
|
-
gap: var(--wui-space-01);
|
|
13726
|
-
|
|
13727
|
-
> * {
|
|
13728
|
-
width: min-content !important;
|
|
13729
|
-
}
|
|
13730
|
-
|
|
13731
|
-
&:focus-within {
|
|
13732
|
-
outline: 2px solid var(--wui-input-color-border-focus);
|
|
13733
|
-
outline-offset: -2px;
|
|
13734
|
-
}
|
|
13735
|
-
|
|
13736
|
-
input {
|
|
13737
|
-
outline: 0 none;
|
|
13738
|
-
border: 0 none;
|
|
13739
|
-
|
|
13740
|
-
&::placeholder {
|
|
13741
|
-
color: var(--wui-input-placeholder);
|
|
13742
|
-
opacity: 1;
|
|
13743
|
-
}
|
|
13744
|
-
|
|
13745
|
-
&:focus {
|
|
13746
|
-
outline: 0;
|
|
13747
|
-
}
|
|
13748
|
-
|
|
13749
|
-
&[aria-invalid='true'] {
|
|
13750
|
-
outline-color: var(--wui-input-color-border-error);
|
|
13751
|
-
}
|
|
13752
|
-
|
|
13753
|
-
&:disabled {
|
|
13754
|
-
outline-color: var(--wui-color-border-disabled);
|
|
13755
|
-
background-color: var(--wui-color-bg-surface-disabled);
|
|
13756
|
-
}
|
|
13757
|
-
}
|
|
13758
|
-
`;
|
|
13759
|
-
var ComboboxInput = (0, import_styled_components96.default)(Ariakit.Combobox)`
|
|
13760
|
-
appearance: none;
|
|
13761
|
-
padding: 0;
|
|
13762
|
-
width: 100%;
|
|
13763
|
-
border: 0 none;
|
|
13764
|
-
flex: 1;
|
|
13765
|
-
|
|
13766
|
-
&[data-focus-visible] {
|
|
13767
|
-
outline-style: solid;
|
|
13768
|
-
}
|
|
13769
|
-
|
|
13770
|
-
&[data-active-item] {
|
|
13771
|
-
outline-width: 2px;
|
|
13772
|
-
}
|
|
13773
|
-
`;
|
|
13774
|
-
var ComboboxPopover = (0, import_styled_components96.default)(Ariakit.Popover)`
|
|
13775
|
-
--wui-combobox-content-border: var(--wui-color-border);
|
|
13776
|
-
--wui-combobox-content-bg: var(--wui-color-bg-surface);
|
|
13777
|
-
--wui-combobox-content-border-radius: var(--wui-border-radius-02);
|
|
13778
|
-
--wui-combobox-option-padding: var(--wui-space-02);
|
|
13779
|
-
--wui-combobox-option-inner-gap: var(--wui-space-03);
|
|
13780
|
-
--wui-combobox-option-bg-hover: var(--wui-color-bg-surface-hover);
|
|
13781
|
-
|
|
13782
|
-
border-radius: var(--wui-border-radius-02);
|
|
13783
|
-
padding: var(--wui-space-04);
|
|
13784
|
-
max-height: var(--wui-popover-max-height, 300px);
|
|
13785
|
-
background-color: var(--wui-color-bg-surface);
|
|
13786
|
-
box-shadow: var(--wui-elevation-01);
|
|
13787
|
-
border: 1px solid var(--wui-color-border);
|
|
13788
|
-
position: relative;
|
|
13789
|
-
z-index: 50;
|
|
13790
|
-
display: flex;
|
|
13791
|
-
flex-direction: column;
|
|
13792
|
-
overflow: auto;
|
|
13793
|
-
overscroll-behavior: contain;
|
|
13794
|
-
|
|
13795
|
-
&[aria-busy='true'] {
|
|
13796
|
-
--item-opacity: 0.5;
|
|
13797
|
-
}
|
|
13798
|
-
`;
|
|
13799
|
-
var ComboboxItem2 = (0, import_styled_components96.default)(Ariakit.ComboboxItem)`
|
|
13800
|
-
${variantStyleMap2.body3};
|
|
13801
|
-
display: flex;
|
|
13802
|
-
padding: var(--wui-combobox-option-padding);
|
|
13803
|
-
gap: var(--wui-combobox-option-inner-gap);
|
|
13804
|
-
font-size: var(--font-size);
|
|
13805
|
-
font-weight: var(--font-weight);
|
|
13806
|
-
border-radius: var(--wui-border-radius-01);
|
|
13807
|
-
align-items: center;
|
|
13808
|
-
cursor: pointer;
|
|
13809
|
-
|
|
13810
|
-
&:hover,
|
|
13811
|
-
&:focus-visible {
|
|
13812
|
-
background-color: var(--wui-combobox-option-bg-hover);
|
|
13813
|
-
outline: none;
|
|
13814
|
-
}
|
|
13815
|
-
|
|
13816
|
-
&[aria-disabled='true'] {
|
|
13817
|
-
color: var(--wui-color-text-disabled);
|
|
13818
|
-
}
|
|
13819
|
-
|
|
13820
|
-
&[aria-disabled='true']:hover {
|
|
13821
|
-
background-color: transparent;
|
|
13822
|
-
}
|
|
13823
|
-
`;
|
|
13824
|
-
var NoResults = import_styled_components96.default.div`
|
|
13825
|
-
gap: var(--wui-space-02);
|
|
13826
|
-
`;
|
|
13827
|
-
var POPOVER_WIDTH_OFFSET = 20;
|
|
13828
|
-
var extractOptions = (children) => {
|
|
13829
|
-
const options = {};
|
|
13830
|
-
import_react73.Children.forEach(children, (child) => {
|
|
13831
|
-
if ((0, import_react73.isValidElement)(child) && "value" in child.props && "children" in child.props) {
|
|
13832
|
-
options[child.props.value] = child.props.children ?? child.props.value;
|
|
13833
|
-
}
|
|
13834
|
-
});
|
|
13835
|
-
return options;
|
|
13836
|
-
};
|
|
13837
|
-
var Combobox2 = ({
|
|
13838
|
-
placeholder,
|
|
13839
|
-
value = [],
|
|
13840
|
-
onChange,
|
|
13841
|
-
searchValue,
|
|
13842
|
-
onSearchValueChange,
|
|
13843
|
-
children,
|
|
13844
|
-
fullWidth = true
|
|
13845
|
-
}) => {
|
|
13846
|
-
const [isPending, startTransition] = (0, import_react73.useTransition)();
|
|
13847
|
-
const [wrapperWidth, setWrapperWidth] = (0, import_react73.useState)("auto");
|
|
13848
|
-
const comboboxWrapperRef = (0, import_react73.useRef)(null);
|
|
13849
|
-
const options = (0, import_react73.useMemo)(() => extractOptions(children), [children]);
|
|
13850
|
-
(0, import_react73.useEffect)(() => {
|
|
13851
|
-
const comboboxWrapper = comboboxWrapperRef.current;
|
|
13852
|
-
if (comboboxWrapper) {
|
|
13853
|
-
const updateWidthVariable = () => {
|
|
13854
|
-
const { width } = comboboxWrapper.getBoundingClientRect();
|
|
13855
|
-
setWrapperWidth(`${width - POPOVER_WIDTH_OFFSET}px`);
|
|
13856
|
-
};
|
|
13857
|
-
updateWidthVariable();
|
|
13858
|
-
window.addEventListener("resize", updateWidthVariable);
|
|
13859
|
-
return () => {
|
|
13860
|
-
window.removeEventListener("resize", updateWidthVariable);
|
|
13861
|
-
};
|
|
13862
|
-
}
|
|
13863
|
-
return () => null;
|
|
13864
|
-
}, []);
|
|
13865
|
-
const handleRemoveValue = (valueToRemove) => {
|
|
13866
|
-
onChange(value.filter((val) => val !== valueToRemove));
|
|
13867
|
-
};
|
|
13868
|
-
const matches = (0, import_react73.useMemo)(() => {
|
|
13869
|
-
return (0, import_match_sorter.matchSorter)(Object.keys(options), searchValue);
|
|
13870
|
-
}, [options, searchValue]);
|
|
13871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
|
|
13872
|
-
Ariakit.ComboboxProvider,
|
|
13873
|
-
{
|
|
13874
|
-
selectedValue: value,
|
|
13875
|
-
setSelectedValue: onChange,
|
|
13876
|
-
setValue: (nextValue) => {
|
|
13877
|
-
startTransition(() => {
|
|
13878
|
-
onSearchValueChange(nextValue);
|
|
13879
|
-
});
|
|
13880
|
-
},
|
|
13881
|
-
children: [
|
|
13882
|
-
/* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
|
|
13883
|
-
ComboboxWapper,
|
|
13884
|
-
{
|
|
13885
|
-
ref: comboboxWrapperRef,
|
|
13886
|
-
$fullWidth: fullWidth,
|
|
13887
|
-
children: [
|
|
13888
|
-
value.map((selectedValue) => /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
13889
|
-
Tag,
|
|
13890
|
-
{
|
|
13891
|
-
href: "https://example.com",
|
|
13892
|
-
label: selectedValue,
|
|
13893
|
-
onClickRemove: () => handleRemoveValue(selectedValue),
|
|
13894
|
-
onClickRemoveLabel: `Remove ${selectedValue}`
|
|
13895
|
-
},
|
|
13896
|
-
selectedValue
|
|
13897
|
-
)),
|
|
13898
|
-
/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(ComboboxInput, { placeholder })
|
|
13899
|
-
]
|
|
13900
|
-
}
|
|
13901
|
-
),
|
|
13902
|
-
/* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
|
|
13903
|
-
ComboboxPopover,
|
|
13904
|
-
{
|
|
13905
|
-
"aria-busy": isPending,
|
|
13906
|
-
gutter: 8,
|
|
13907
|
-
sameWidth: false,
|
|
13908
|
-
style: {
|
|
13909
|
-
width: wrapperWidth
|
|
13910
|
-
},
|
|
13911
|
-
children: [
|
|
13912
|
-
matches.map((match) => /* @__PURE__ */ (0, import_jsx_runtime279.jsxs)(
|
|
13913
|
-
ComboboxItem2,
|
|
13914
|
-
{
|
|
13915
|
-
className: "combobox-item",
|
|
13916
|
-
focusOnHover: true,
|
|
13917
|
-
value: match,
|
|
13918
|
-
children: [
|
|
13919
|
-
/* @__PURE__ */ (0, import_jsx_runtime279.jsx)(
|
|
13920
|
-
Icon,
|
|
13921
|
-
{
|
|
13922
|
-
size: "sm",
|
|
13923
|
-
style: {
|
|
13924
|
-
opacity: value.includes(match) ? 1 : 0
|
|
13925
|
-
},
|
|
13926
|
-
type: "checkmark"
|
|
13927
|
-
}
|
|
13928
|
-
),
|
|
13929
|
-
options[match]
|
|
13930
|
-
]
|
|
13931
|
-
},
|
|
13932
|
-
match
|
|
13933
|
-
)),
|
|
13934
|
-
!matches.length && /* @__PURE__ */ (0, import_jsx_runtime279.jsx)(NoResults, { children: "No results found" })
|
|
13935
|
-
]
|
|
13936
|
-
}
|
|
13937
|
-
)
|
|
13938
|
-
]
|
|
13939
|
-
}
|
|
13940
|
-
);
|
|
13941
|
-
};
|
|
13942
13702
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13943
13703
|
0 && (module.exports = {
|
|
13944
13704
|
ActionButton,
|
|
@@ -13959,7 +13719,6 @@ var Combobox2 = ({
|
|
|
13959
13719
|
CollapsibleContent,
|
|
13960
13720
|
CollapsibleTrigger,
|
|
13961
13721
|
ColorSchemeWrapper,
|
|
13962
|
-
Combobox,
|
|
13963
13722
|
DataCard,
|
|
13964
13723
|
DataCardTrend,
|
|
13965
13724
|
DataCards,
|