@wistia/ui 0.8.26 → 0.8.27-beta.64fad0dc.0eabff0
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 +291 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +40 -8
- package/dist/index.d.ts +40 -8
- package/dist/index.mjs +347 -56
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.8.
|
|
3
|
+
* @license @wistia/ui v0.8.27-beta.64fad0dc.0eabff0
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -57,6 +57,7 @@ __export(index_exports, {
|
|
|
57
57
|
CollapsibleContent: () => CollapsibleContent,
|
|
58
58
|
CollapsibleTrigger: () => CollapsibleTrigger,
|
|
59
59
|
ColorSchemeWrapper: () => ColorSchemeWrapper,
|
|
60
|
+
Combobox: () => Combobox2,
|
|
60
61
|
DataCard: () => DataCard,
|
|
61
62
|
DataCardTrend: () => DataCardTrend,
|
|
62
63
|
DataCards: () => DataCards,
|
|
@@ -8500,6 +8501,11 @@ Checkbox.displayName = "Checkbox";
|
|
|
8500
8501
|
|
|
8501
8502
|
// src/components/ClickRegion/ClickRegion.tsx
|
|
8502
8503
|
var import_react30 = require("react");
|
|
8504
|
+
var isClickableElement = (element) => {
|
|
8505
|
+
if (!element) return false;
|
|
8506
|
+
const el = element;
|
|
8507
|
+
return el.closest("button") !== null || el.closest("a") !== null || el.closest("input") !== null || el.closest("select") !== null || el.closest("textarea") !== null || el.closest("label") !== null || el.closest("[data-wui-faux-input]") !== null;
|
|
8508
|
+
};
|
|
8503
8509
|
var ClickRegion = ({ children, targetRef }) => {
|
|
8504
8510
|
(0, import_react30.useEffect)(() => {
|
|
8505
8511
|
if (targetRef.current && targetRef.current.tagName === "A") {
|
|
@@ -8512,7 +8518,10 @@ var ClickRegion = ({ children, targetRef }) => {
|
|
|
8512
8518
|
const handleClick = (0, import_react30.useCallback)(
|
|
8513
8519
|
(event) => {
|
|
8514
8520
|
const node = targetRef.current;
|
|
8515
|
-
if (event.target
|
|
8521
|
+
if (event.target === node) {
|
|
8522
|
+
return;
|
|
8523
|
+
}
|
|
8524
|
+
if (isClickableElement(event.target) && event.target !== node) {
|
|
8516
8525
|
event.stopPropagation();
|
|
8517
8526
|
return;
|
|
8518
8527
|
}
|
|
@@ -10766,11 +10775,8 @@ MenuItem.displayName = "MenuItem";
|
|
|
10766
10775
|
// src/components/Menu/MenuRadioGroup.tsx
|
|
10767
10776
|
var import_react_dropdown_menu5 = require("@radix-ui/react-dropdown-menu");
|
|
10768
10777
|
var import_jsx_runtime238 = require("react/jsx-runtime");
|
|
10769
|
-
var MenuRadioGroup = ({ children,
|
|
10770
|
-
return /* @__PURE__ */ (0, import_jsx_runtime238.
|
|
10771
|
-
/* @__PURE__ */ (0, import_jsx_runtime238.jsx)(MenuLabel, { children: label }),
|
|
10772
|
-
children
|
|
10773
|
-
] });
|
|
10778
|
+
var MenuRadioGroup = ({ children, ...props }) => {
|
|
10779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(import_react_dropdown_menu5.DropdownMenuRadioGroup, { ...props, children });
|
|
10774
10780
|
};
|
|
10775
10781
|
MenuRadioGroup.displayName = "MenuRadioGroup";
|
|
10776
10782
|
|
|
@@ -13272,6 +13278,283 @@ var WistiaLogo = ({
|
|
|
13272
13278
|
return href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("a", { href, children: Logo }) : Logo;
|
|
13273
13279
|
};
|
|
13274
13280
|
WistiaLogo.displayName = "WistiaLogo";
|
|
13281
|
+
|
|
13282
|
+
// src/components/Combobox/Combobox.tsx
|
|
13283
|
+
var Ariakit = __toESM(require("@ariakit/react"));
|
|
13284
|
+
var import_react73 = require("react");
|
|
13285
|
+
var import_match_sorter = require("match-sorter");
|
|
13286
|
+
var import_styled_components95 = __toESM(require("styled-components"));
|
|
13287
|
+
var import_jsx_runtime275 = require("react/jsx-runtime");
|
|
13288
|
+
var ComboboxWapper = import_styled_components95.default.div`
|
|
13289
|
+
${inputCssVariables};
|
|
13290
|
+
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
13291
|
+
padding: var(--wui-input-vertical-padding) var(--wui-input-horizontal-padding);
|
|
13292
|
+
background-color: var(--wui-input-color-bg);
|
|
13293
|
+
border: none;
|
|
13294
|
+
outline: 1px solid var(--wui-input-color-border);
|
|
13295
|
+
outline-offset: -1px;
|
|
13296
|
+
border-radius: var(--wui-input-border-radius);
|
|
13297
|
+
font-size: var(--wui-input-font-size);
|
|
13298
|
+
line-height: var(--wui-input-line-height);
|
|
13299
|
+
font-weight: var(--wui-input-font-weight);
|
|
13300
|
+
color: var(--wui-input-color-text);
|
|
13301
|
+
display: inline-flex;
|
|
13302
|
+
flex-wrap: wrap;
|
|
13303
|
+
gap: var(--wui-space-01);
|
|
13304
|
+
|
|
13305
|
+
> * {
|
|
13306
|
+
width: min-content !important;
|
|
13307
|
+
}
|
|
13308
|
+
|
|
13309
|
+
&:focus-within {
|
|
13310
|
+
outline: 2px solid var(--wui-input-color-border-focus);
|
|
13311
|
+
outline-offset: -2px;
|
|
13312
|
+
}
|
|
13313
|
+
|
|
13314
|
+
input {
|
|
13315
|
+
outline: 0 none;
|
|
13316
|
+
border: 0 none;
|
|
13317
|
+
|
|
13318
|
+
&::placeholder {
|
|
13319
|
+
color: var(--wui-input-placeholder);
|
|
13320
|
+
opacity: 1;
|
|
13321
|
+
}
|
|
13322
|
+
|
|
13323
|
+
&:focus {
|
|
13324
|
+
outline: 0;
|
|
13325
|
+
}
|
|
13326
|
+
|
|
13327
|
+
&[aria-invalid='true'] {
|
|
13328
|
+
outline-color: var(--wui-input-color-border-error);
|
|
13329
|
+
}
|
|
13330
|
+
|
|
13331
|
+
&:disabled {
|
|
13332
|
+
outline-color: var(--wui-color-border-disabled);
|
|
13333
|
+
background-color: var(--wui-color-bg-surface-disabled);
|
|
13334
|
+
}
|
|
13335
|
+
}
|
|
13336
|
+
`;
|
|
13337
|
+
var ComboboxInput = (0, import_styled_components95.default)(Ariakit.Combobox)`
|
|
13338
|
+
appearance: none;
|
|
13339
|
+
padding: 0;
|
|
13340
|
+
width: 100%;
|
|
13341
|
+
border: 0 none;
|
|
13342
|
+
flex: 1;
|
|
13343
|
+
|
|
13344
|
+
&::placeholder {
|
|
13345
|
+
color: rgb(0 0 0 / 0.6);
|
|
13346
|
+
}
|
|
13347
|
+
|
|
13348
|
+
&:hover {
|
|
13349
|
+
background-color: hsl(204 20% 99%);
|
|
13350
|
+
}
|
|
13351
|
+
|
|
13352
|
+
&[data-focus-visible] {
|
|
13353
|
+
outline-style: solid;
|
|
13354
|
+
}
|
|
13355
|
+
|
|
13356
|
+
&[data-active-item] {
|
|
13357
|
+
outline-width: 2px;
|
|
13358
|
+
}
|
|
13359
|
+
|
|
13360
|
+
&:where(.dark, .dark *) {
|
|
13361
|
+
background-color: hsl(204 4% 8%);
|
|
13362
|
+
color: white;
|
|
13363
|
+
box-shadow:
|
|
13364
|
+
inset 0 0 0 1px rgba(255 255 255 / 0.15),
|
|
13365
|
+
inset 0 -1px 0 0 rgba(255 255 255 / 0.05),
|
|
13366
|
+
inset 0 2px 5px 0 rgba(0 0 0 / 0.15);
|
|
13367
|
+
}
|
|
13368
|
+
|
|
13369
|
+
&:where(.dark, .dark *)::placeholder {
|
|
13370
|
+
color: rgb(255 255 255 / 46%);
|
|
13371
|
+
}
|
|
13372
|
+
|
|
13373
|
+
&:hover:where(.dark, .dark *) {
|
|
13374
|
+
background-color: hsl(204 4% 6%);
|
|
13375
|
+
}
|
|
13376
|
+
`;
|
|
13377
|
+
var ComboboxPopover = (0, import_styled_components95.default)(Ariakit.Popover)`
|
|
13378
|
+
position: relative;
|
|
13379
|
+
z-index: 50;
|
|
13380
|
+
display: flex;
|
|
13381
|
+
max-height: min(var(--popover-available-height, 300px), 300px);
|
|
13382
|
+
flex-direction: column;
|
|
13383
|
+
overflow: auto;
|
|
13384
|
+
overscroll-behavior: contain;
|
|
13385
|
+
border-radius: 0.5rem;
|
|
13386
|
+
border-width: 1px;
|
|
13387
|
+
border-style: solid;
|
|
13388
|
+
border-color: hsl(204 20% 88%);
|
|
13389
|
+
background-color: white;
|
|
13390
|
+
padding: 0.5rem;
|
|
13391
|
+
color: black;
|
|
13392
|
+
outline: 2px solid transparent;
|
|
13393
|
+
outline-offset: 2px;
|
|
13394
|
+
box-shadow:
|
|
13395
|
+
0 10px 15px -3px rgb(0 0 0 / 0.1),
|
|
13396
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
13397
|
+
|
|
13398
|
+
&:where(.dark, .dark *) {
|
|
13399
|
+
border-color: hsl(204 4% 24%);
|
|
13400
|
+
background-color: hsl(204 4% 16%);
|
|
13401
|
+
color: white;
|
|
13402
|
+
box-shadow:
|
|
13403
|
+
0 10px 15px -3px rgb(0 0 0 / 0.25),
|
|
13404
|
+
0 4px 6px -4px rgb(0 0 0 / 0.1);
|
|
13405
|
+
}
|
|
13406
|
+
|
|
13407
|
+
&[aria-busy='true'] {
|
|
13408
|
+
--item-opacity: 0.5;
|
|
13409
|
+
}
|
|
13410
|
+
`;
|
|
13411
|
+
var ComboboxItem2 = (0, import_styled_components95.default)(Ariakit.ComboboxItem)`
|
|
13412
|
+
display: flex;
|
|
13413
|
+
cursor: default;
|
|
13414
|
+
scroll-margin: 0.5rem;
|
|
13415
|
+
align-items: center;
|
|
13416
|
+
gap: 0.5rem;
|
|
13417
|
+
border-radius: 0.25rem;
|
|
13418
|
+
padding: 0.5rem;
|
|
13419
|
+
outline: none !important;
|
|
13420
|
+
opacity: var(--item-opacity, 1);
|
|
13421
|
+
transition-property: opacity;
|
|
13422
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
13423
|
+
transition-duration: 150ms;
|
|
13424
|
+
|
|
13425
|
+
&:hover {
|
|
13426
|
+
background-color: hsl(204 100% 80% / 0.4);
|
|
13427
|
+
}
|
|
13428
|
+
|
|
13429
|
+
&[data-active-item] {
|
|
13430
|
+
background-color: hsl(204 100% 40%);
|
|
13431
|
+
color: white;
|
|
13432
|
+
}
|
|
13433
|
+
|
|
13434
|
+
&:active,
|
|
13435
|
+
&[data-active] {
|
|
13436
|
+
padding-top: 9px;
|
|
13437
|
+
padding-bottom: 7px;
|
|
13438
|
+
}
|
|
13439
|
+
|
|
13440
|
+
&:hover:where(.dark, .dark *) {
|
|
13441
|
+
background-color: hsl(204 100% 40% / 0.25);
|
|
13442
|
+
}
|
|
13443
|
+
|
|
13444
|
+
&:where(.dark, .dark *)[data-active-item] {
|
|
13445
|
+
background-color: hsl(204 100% 40%);
|
|
13446
|
+
}
|
|
13447
|
+
`;
|
|
13448
|
+
var NoResults = import_styled_components95.default.div`
|
|
13449
|
+
gap: 0.5rem;
|
|
13450
|
+
padding: 0.5rem;
|
|
13451
|
+
`;
|
|
13452
|
+
var POPOVER_WIDTH_OFFSET = 20;
|
|
13453
|
+
var extractOptions = (children) => {
|
|
13454
|
+
const options = {};
|
|
13455
|
+
import_react73.Children.forEach(children, (child) => {
|
|
13456
|
+
if ((0, import_react73.isValidElement)(child) && "value" in child.props && "children" in child.props) {
|
|
13457
|
+
options[child.props.value] = child.props.children ?? child.props.value;
|
|
13458
|
+
}
|
|
13459
|
+
});
|
|
13460
|
+
return options;
|
|
13461
|
+
};
|
|
13462
|
+
var Combobox2 = ({
|
|
13463
|
+
placeholder,
|
|
13464
|
+
value = [],
|
|
13465
|
+
onChange,
|
|
13466
|
+
searchValue,
|
|
13467
|
+
onSearchValueChange,
|
|
13468
|
+
children,
|
|
13469
|
+
fullWidth = true
|
|
13470
|
+
}) => {
|
|
13471
|
+
const [isPending, startTransition] = (0, import_react73.useTransition)();
|
|
13472
|
+
const [wrapperWidth, setWrapperWidth] = (0, import_react73.useState)("auto");
|
|
13473
|
+
const comboboxWrapperRef = (0, import_react73.useRef)(null);
|
|
13474
|
+
const options = (0, import_react73.useMemo)(() => extractOptions(children), [children]);
|
|
13475
|
+
(0, import_react73.useEffect)(() => {
|
|
13476
|
+
const comboboxWrapper = comboboxWrapperRef.current;
|
|
13477
|
+
if (comboboxWrapper) {
|
|
13478
|
+
const updateWidthVariable = () => {
|
|
13479
|
+
const { width } = comboboxWrapper.getBoundingClientRect();
|
|
13480
|
+
setWrapperWidth(`${width - POPOVER_WIDTH_OFFSET}px`);
|
|
13481
|
+
};
|
|
13482
|
+
updateWidthVariable();
|
|
13483
|
+
window.addEventListener("resize", updateWidthVariable);
|
|
13484
|
+
return () => {
|
|
13485
|
+
window.removeEventListener("resize", updateWidthVariable);
|
|
13486
|
+
};
|
|
13487
|
+
}
|
|
13488
|
+
return () => null;
|
|
13489
|
+
}, []);
|
|
13490
|
+
const handleRemoveValue = (valueToRemove) => {
|
|
13491
|
+
onChange(value.filter((val) => val !== valueToRemove));
|
|
13492
|
+
};
|
|
13493
|
+
const matches = (0, import_react73.useMemo)(() => {
|
|
13494
|
+
return (0, import_match_sorter.matchSorter)(Object.keys(options), searchValue);
|
|
13495
|
+
}, [options, searchValue]);
|
|
13496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
13497
|
+
Ariakit.ComboboxProvider,
|
|
13498
|
+
{
|
|
13499
|
+
selectedValue: value,
|
|
13500
|
+
setSelectedValue: onChange,
|
|
13501
|
+
setValue: (nextValue) => {
|
|
13502
|
+
startTransition(() => {
|
|
13503
|
+
onSearchValueChange(nextValue);
|
|
13504
|
+
});
|
|
13505
|
+
},
|
|
13506
|
+
children: [
|
|
13507
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
13508
|
+
ComboboxWapper,
|
|
13509
|
+
{
|
|
13510
|
+
ref: comboboxWrapperRef,
|
|
13511
|
+
$fullWidth: fullWidth,
|
|
13512
|
+
children: [
|
|
13513
|
+
value.map((selectedValue) => /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(
|
|
13514
|
+
Tag,
|
|
13515
|
+
{
|
|
13516
|
+
href: "https://example.com",
|
|
13517
|
+
label: selectedValue,
|
|
13518
|
+
onClickRemove: () => handleRemoveValue(selectedValue),
|
|
13519
|
+
onClickRemoveLabel: `Remove ${selectedValue}`
|
|
13520
|
+
},
|
|
13521
|
+
selectedValue
|
|
13522
|
+
)),
|
|
13523
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ComboboxInput, { placeholder })
|
|
13524
|
+
]
|
|
13525
|
+
}
|
|
13526
|
+
),
|
|
13527
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
13528
|
+
ComboboxPopover,
|
|
13529
|
+
{
|
|
13530
|
+
"aria-busy": isPending,
|
|
13531
|
+
gutter: 8,
|
|
13532
|
+
sameWidth: false,
|
|
13533
|
+
style: {
|
|
13534
|
+
width: wrapperWidth
|
|
13535
|
+
},
|
|
13536
|
+
children: [
|
|
13537
|
+
matches.map((match) => /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
|
|
13538
|
+
ComboboxItem2,
|
|
13539
|
+
{
|
|
13540
|
+
className: "combobox-item",
|
|
13541
|
+
focusOnHover: true,
|
|
13542
|
+
value: match,
|
|
13543
|
+
children: [
|
|
13544
|
+
/* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Ariakit.ComboboxItemCheck, {}),
|
|
13545
|
+
options[match]
|
|
13546
|
+
]
|
|
13547
|
+
},
|
|
13548
|
+
match
|
|
13549
|
+
)),
|
|
13550
|
+
!matches.length && /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(NoResults, { children: "No results found" })
|
|
13551
|
+
]
|
|
13552
|
+
}
|
|
13553
|
+
)
|
|
13554
|
+
]
|
|
13555
|
+
}
|
|
13556
|
+
);
|
|
13557
|
+
};
|
|
13275
13558
|
// Annotate the CommonJS export names for ESM import in node:
|
|
13276
13559
|
0 && (module.exports = {
|
|
13277
13560
|
ActionButton,
|
|
@@ -13292,6 +13575,7 @@ WistiaLogo.displayName = "WistiaLogo";
|
|
|
13292
13575
|
CollapsibleContent,
|
|
13293
13576
|
CollapsibleTrigger,
|
|
13294
13577
|
ColorSchemeWrapper,
|
|
13578
|
+
Combobox,
|
|
13295
13579
|
DataCard,
|
|
13296
13580
|
DataCardTrend,
|
|
13297
13581
|
DataCards,
|