@wistia/ui 0.8.26 → 0.8.27-beta.415fcaaf.2aacc73

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.8.26
3
+ * @license @wistia/ui v0.8.27-beta.415fcaaf.2aacc73
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -80,6 +80,7 @@ __export(index_exports, {
80
80
  KeyboardShortcut: () => KeyboardShortcut,
81
81
  Label: () => Label,
82
82
  Link: () => Link,
83
+ List: () => List,
83
84
  Menu: () => Menu,
84
85
  MenuItem: () => MenuItem,
85
86
  MenuItemDescription: () => MenuItemDescription,
@@ -7790,7 +7791,6 @@ var makePolymorphic = (component) => {
7790
7791
 
7791
7792
  // src/components/Box/Box.tsx
7792
7793
  var import_jsx_runtime199 = require("react/jsx-runtime");
7793
- var isDev = process.env["NODE_ENV"] === "development" || process.env["NODE_ENV"] === "test";
7794
7794
  var getGapStyle = (gap) => {
7795
7795
  if ((0, import_type_guards20.isNotNil)(gap)) {
7796
7796
  if ((0, import_type_guards20.isRecord)(gap)) {
@@ -7885,22 +7885,6 @@ var StyledBoxComponent = import_styled_components27.default.div`
7885
7885
  justify-content: ${({ $justifyContent }) => $justifyContent};
7886
7886
  order: ${({ $order }) => (0, import_type_guards20.isNotNil)($order) ? $order : null};
7887
7887
  `;
7888
- var wrapChildren = (children) => {
7889
- if ((0, import_type_guards20.isNotNil)(children)) {
7890
- if (typeof children === "object" && isDev) {
7891
- return import_react26.Children.map(children, (child) => {
7892
- if ((0, import_type_guards20.isNil)(child)) return null;
7893
- const elementParams = {};
7894
- if (child.type?.displayName === "Box" || child.type?.displayName === "Box_UI") {
7895
- elementParams.hasBoxParent = true;
7896
- }
7897
- return (0, import_react26.cloneElement)(child, elementParams);
7898
- });
7899
- }
7900
- return children;
7901
- }
7902
- return null;
7903
- };
7904
7888
  var DEFAULT_ELEMENT = "div";
7905
7889
  var BoxComponent = (0, import_react26.forwardRef)(
7906
7890
  ({
@@ -7914,8 +7898,6 @@ var BoxComponent = (0, import_react26.forwardRef)(
7914
7898
  fillViewport = false,
7915
7899
  gap,
7916
7900
  grow,
7917
- hasBoxParent = false,
7918
- // eslint-disable-line @typescript-eslint/no-unused-vars
7919
7901
  height,
7920
7902
  inline = false,
7921
7903
  justifyContent = "flex-start",
@@ -7976,7 +7958,7 @@ var BoxComponent = (0, import_react26.forwardRef)(
7976
7958
  $wrapItems: wrapItems,
7977
7959
  as: renderAs ?? DEFAULT_ELEMENT,
7978
7960
  ...props,
7979
- children: wrapChildren(children)
7961
+ children
7980
7962
  }
7981
7963
  );
7982
7964
  }
@@ -8500,6 +8482,11 @@ Checkbox.displayName = "Checkbox";
8500
8482
 
8501
8483
  // src/components/ClickRegion/ClickRegion.tsx
8502
8484
  var import_react30 = require("react");
8485
+ var isClickableElement = (element) => {
8486
+ if (!element) return false;
8487
+ const el = element;
8488
+ 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;
8489
+ };
8503
8490
  var ClickRegion = ({ children, targetRef }) => {
8504
8491
  (0, import_react30.useEffect)(() => {
8505
8492
  if (targetRef.current && targetRef.current.tagName === "A") {
@@ -8512,7 +8499,10 @@ var ClickRegion = ({ children, targetRef }) => {
8512
8499
  const handleClick = (0, import_react30.useCallback)(
8513
8500
  (event) => {
8514
8501
  const node = targetRef.current;
8515
- if (event.target instanceof HTMLAnchorElement && !event.target.hasAttribute("data-click-region-target-link") || event.target instanceof HTMLButtonElement && !event.target.hasAttribute("data-click-region-target-button")) {
8502
+ if (event.target === node) {
8503
+ return;
8504
+ }
8505
+ if (isClickableElement(event.target) && event.target !== node) {
8516
8506
  event.stopPropagation();
8517
8507
  return;
8518
8508
  }
@@ -10766,11 +10756,8 @@ MenuItem.displayName = "MenuItem";
10766
10756
  // src/components/Menu/MenuRadioGroup.tsx
10767
10757
  var import_react_dropdown_menu5 = require("@radix-ui/react-dropdown-menu");
10768
10758
  var import_jsx_runtime238 = require("react/jsx-runtime");
10769
- var MenuRadioGroup = ({ children, label, ...props }) => {
10770
- return /* @__PURE__ */ (0, import_jsx_runtime238.jsxs)(import_react_dropdown_menu5.DropdownMenuRadioGroup, { ...props, children: [
10771
- /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(MenuLabel, { children: label }),
10772
- children
10773
- ] });
10759
+ var MenuRadioGroup = ({ children, ...props }) => {
10760
+ return /* @__PURE__ */ (0, import_jsx_runtime238.jsx)(import_react_dropdown_menu5.DropdownMenuRadioGroup, { ...props, children });
10774
10761
  };
10775
10762
  MenuRadioGroup.displayName = "MenuRadioGroup";
10776
10763
 
@@ -13272,6 +13259,164 @@ var WistiaLogo = ({
13272
13259
  return href !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime274.jsx)("a", { href, children: Logo }) : Logo;
13273
13260
  };
13274
13261
  WistiaLogo.displayName = "WistiaLogo";
13262
+
13263
+ // src/components/List/List.tsx
13264
+ var import_type_guards59 = require("@wistia/type-guards");
13265
+ var import_styled_components96 = __toESM(require("styled-components"));
13266
+
13267
+ // src/components/List/ListItem.tsx
13268
+ var import_styled_components95 = __toESM(require("styled-components"));
13269
+ var import_type_guards58 = require("@wistia/type-guards");
13270
+ var import_jsx_runtime275 = require("react/jsx-runtime");
13271
+ var ListItemComponent = import_styled_components95.default.li`
13272
+ margin-bottom: var(--wui-space-02);
13273
+ `;
13274
+ var ListItem = ({ children }) => {
13275
+ if ((0, import_type_guards58.isNil)(children)) {
13276
+ return null;
13277
+ }
13278
+ return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ListItemComponent, { children });
13279
+ };
13280
+ ListItem.displayName = "ListItem";
13281
+
13282
+ // src/components/List/List.tsx
13283
+ var import_jsx_runtime276 = require("react/jsx-runtime");
13284
+ var spacesStyle = import_styled_components96.css`
13285
+ overflow: hidden;
13286
+ padding-left: 0;
13287
+ vertical-align: bottom;
13288
+
13289
+ li {
13290
+ display: block;
13291
+ float: left;
13292
+
13293
+ &::after {
13294
+ content: ' ';
13295
+ padding-right: var(--wui-space-03);
13296
+ }
13297
+
13298
+ &:last-child {
13299
+ &::after {
13300
+ content: '' !important;
13301
+ padding-right: 0;
13302
+ }
13303
+ }
13304
+ }
13305
+ `;
13306
+ var commasStyle = import_styled_components96.css`
13307
+ ${spacesStyle};
13308
+
13309
+ li {
13310
+ &::after {
13311
+ content: ',' !important;
13312
+ padding-right: var(--wui-space-01);
13313
+ }
13314
+ }
13315
+ `;
13316
+ var slashesStyle = import_styled_components96.css`
13317
+ ${spacesStyle};
13318
+
13319
+ li {
13320
+ &::after {
13321
+ content: '/' !important;
13322
+ padding-left: var(--wui-space-01);
13323
+ padding-right: var(--wui-space-01);
13324
+ }
13325
+ }
13326
+ `;
13327
+ var breadcrumbsStyle = import_styled_components96.css`
13328
+ ${spacesStyle};
13329
+
13330
+ li {
13331
+ &::after {
13332
+ content: '>' !important;
13333
+ padding-left: var(--wui-space-01);
13334
+ padding-right: var(--wui-space-01);
13335
+ }
13336
+ }
13337
+ `;
13338
+ var unbulletedStyle = import_styled_components96.css`
13339
+ list-style: none;
13340
+ padding-left: 0;
13341
+ `;
13342
+ var ListComponent = import_styled_components96.default.ul`
13343
+ list-style-position: outside;
13344
+ margin: 0 0 var(--wui-space-01);
13345
+ padding: 0 0 0 var(--wui-space-04);
13346
+ ${({ variant }) => variant === "unbulleted" && unbulletedStyle};
13347
+ ${({ variant }) => variant === "spaces" && spacesStyle};
13348
+ ${({ variant }) => variant === "commas" && commasStyle};
13349
+ ${({ variant }) => variant === "slashes" && slashesStyle};
13350
+ ${({ variant }) => variant === "breadcrumbs" && breadcrumbsStyle};
13351
+
13352
+ > li:last-child {
13353
+ margin-bottom: 0;
13354
+ }
13355
+
13356
+ ul,
13357
+ ol {
13358
+ margin-top: var(--wui-space-01);
13359
+ }
13360
+
13361
+ /* nested lists should not have bottom margins because their container <li> will have one */
13362
+ li ul,
13363
+ li ol {
13364
+ margin-bottom: 0;
13365
+ }
13366
+ `;
13367
+ var renderListComponent = (listItems, variant, { ...otherProps }) => {
13368
+ const elementType = variant === "ordered" ? "ol" : "ul";
13369
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(
13370
+ ListComponent,
13371
+ {
13372
+ as: elementType,
13373
+ variant,
13374
+ ...otherProps,
13375
+ children: listItems
13376
+ }
13377
+ );
13378
+ };
13379
+ var renderListFromArray = (listItems, variant, otherProps) => {
13380
+ let itemCount = 0;
13381
+ const items = listItems.map((listItem, i) => {
13382
+ const item = listItem;
13383
+ const nextItem = listItems[i + 1];
13384
+ const key = `item-${itemCount += 1}`;
13385
+ if (Array.isArray(nextItem)) {
13386
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(ListItem, { children: [
13387
+ item,
13388
+ renderListFromArray(nextItem, variant, otherProps)
13389
+ ] }, key);
13390
+ }
13391
+ if (Array.isArray(item)) {
13392
+ return null;
13393
+ }
13394
+ return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ListItem, { children: item }, key);
13395
+ });
13396
+ return renderListComponent(items, variant, otherProps);
13397
+ };
13398
+ var List = ({
13399
+ children,
13400
+ items,
13401
+ variant,
13402
+ ...otherProps
13403
+ }) => {
13404
+ const listVariant = variant ?? "bullets";
13405
+ if ((0, import_type_guards59.isNotNil)(children)) {
13406
+ if (Array.isArray(children) && !children.length) {
13407
+ return null;
13408
+ }
13409
+ return renderListComponent(children, listVariant, otherProps);
13410
+ }
13411
+ if ((0, import_type_guards59.isNotNil)(items)) {
13412
+ if (!items.length) {
13413
+ return null;
13414
+ }
13415
+ return renderListFromArray(items, listVariant, otherProps);
13416
+ }
13417
+ return null;
13418
+ };
13419
+ List.displayName = "List";
13275
13420
  // Annotate the CommonJS export names for ESM import in node:
13276
13421
  0 && (module.exports = {
13277
13422
  ActionButton,
@@ -13315,6 +13460,7 @@ WistiaLogo.displayName = "WistiaLogo";
13315
13460
  KeyboardShortcut,
13316
13461
  Label,
13317
13462
  Link,
13463
+ List,
13318
13464
  Menu,
13319
13465
  MenuItem,
13320
13466
  MenuItemDescription,