@wistia/ui 0.5.2-beta.a93c5fb4.3a5bcbb → 0.5.2-beta.afcce0d8.98f1a2c

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.5.2-beta.a93c5fb4.3a5bcbb
3
+ * @license @wistia/ui v0.5.2-beta.afcce0d8.98f1a2c
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -2081,9 +2081,9 @@ var import_react6 = require("react");
2081
2081
  // src/private/hooks/useEvent/useEvent.ts
2082
2082
  var import_react5 = require("react");
2083
2083
 
2084
- // src/private/helpers/isObjectRef/isObjectRef.ts
2084
+ // src/private/helpers/isValidRef/isValidRef.ts
2085
2085
  var import_type_guards6 = require("@wistia/type-guards");
2086
- var isObjectRef = (value) => {
2086
+ var isValidRef = (value) => {
2087
2087
  return (0, import_type_guards6.isNotNil)(value) && (0, import_type_guards6.isRecord)(value) && "current" in value;
2088
2088
  };
2089
2089
 
@@ -2103,7 +2103,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
2103
2103
  savedEventOptions.current = eventOptions;
2104
2104
  }, [eventOptions]);
2105
2105
  (0, import_react5.useEffect)(() => {
2106
- const target = isObjectRef(eventTarget) ? eventTarget.current : eventTarget;
2106
+ const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
2107
2107
  if (!eventName || !isEventTargetSupported(target)) {
2108
2108
  return;
2109
2109
  }
@@ -7905,7 +7905,7 @@ var StyledInputContainer = import_styled_components41.default.div`
7905
7905
  padding-right: 32px;
7906
7906
  }
7907
7907
  `;
7908
- var isValidRef = (ref) => {
7908
+ var isValidRef2 = (ref) => {
7909
7909
  return typeof ref === "object" && ref !== null && "current" in ref && (0, import_type_guards24.isNotNil)(ref.current);
7910
7910
  };
7911
7911
  var Input = (0, import_react30.forwardRef)(
@@ -7919,7 +7919,7 @@ var Input = (0, import_react30.forwardRef)(
7919
7919
  ...props
7920
7920
  }, externalRef) => {
7921
7921
  const internalRef = (0, import_react30.useRef)();
7922
- const ref = isValidRef(externalRef) ? externalRef : internalRef;
7922
+ const ref = isValidRef2(externalRef) ? externalRef : internalRef;
7923
7923
  let leftIconToDisplay = leftIcon;
7924
7924
  if ((0, import_type_guards24.isNil)(leftIcon) && type === "search") {
7925
7925
  leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Icon, { type: "search" });
@@ -9781,48 +9781,43 @@ var DataCardTrend = ({
9781
9781
  var import_styled_components65 = __toESM(require("styled-components"));
9782
9782
  var import_react46 = require("react");
9783
9783
  var import_jsx_runtime214 = require("react/jsx-runtime");
9784
- var sharedInputStyles = import_styled_components65.css`
9785
- padding: var(--wui-space-02);
9786
- border-radius: var(--wui-border-radius-01);
9787
- overflow-wrap: anywhere;
9788
- width: 100%;
9789
- `;
9790
- var StyledEditableHeadingInput = import_styled_components65.default.textarea`
9784
+ var StyledInput = (0, import_styled_components65.default)(Input)`
9791
9785
  :not([rows]) {
9792
9786
  min-height: unset;
9793
9787
  }
9794
9788
 
9795
- ${sharedInputStyles}
9789
+ resize: vertical;
9796
9790
  font-size: var(--wui-typography-heading-1-size);
9797
9791
  font-weight: var(--wui-typography-heading-1-weight);
9798
9792
  line-height: var(--wui-typography-heading-1-line-height);
9799
9793
  font-family: var(--wui-typography-heading-1-family);
9800
- box-sizing: border-box;
9801
- margin: 0;
9802
- display: block;
9803
- overflow: hidden;
9804
- resize: vertical;
9805
- height: ${({ $headingHeight }) => `${$headingHeight}px`};
9806
- background: transparent;
9807
- border: none;
9808
9794
  outline: 2px solid var(--wui-color-focus-ring);
9809
9795
  outline-offset: -2px;
9810
9796
 
9811
- &:focus {
9812
- outline: 2px solid var(--wui-color-focus-ring);
9813
- outline-offset: -2px;
9797
+ && {
9798
+ width: 100%;
9799
+ padding: var(--wui-space-02);
9800
+ border: none;
9801
+ height: ${({ $height }) => `${$height}px`};
9802
+ }
9803
+ `;
9804
+ var editableStyles = import_styled_components65.css`
9805
+ &:has(+ :focus-within) {
9806
+ background: var(--wui-color-bg-surface-hover);
9807
+ }
9808
+
9809
+ &:hover {
9810
+ background: var(--wui-color-bg-surface-hover);
9811
+ cursor: pointer;
9814
9812
  }
9815
9813
  `;
9816
9814
  var StyledHeading2 = (0, import_styled_components65.default)(Heading)`
9817
- ${sharedInputStyles}
9815
+ width: 100%;
9816
+ border-radius: var(--wui-border-radius-02);
9817
+ padding: var(--wui-space-02);
9818
+ overflow-wrap: anywhere;
9818
9819
  transition: all var(--wui-motion-duration-01) var(--wui-motion-ease);
9819
- ${({ $editingDisabled }) => !$editingDisabled && import_styled_components65.css`
9820
- cursor: pointer;
9821
-
9822
- &:hover {
9823
- background: var(--wui-color-bg-surface-hover);
9824
- }
9825
- `}
9820
+ ${({ $editingDisabled }) => !$editingDisabled && editableStyles}
9826
9821
  `;
9827
9822
  var EditableHeading = ({
9828
9823
  children,
@@ -9831,10 +9826,7 @@ var EditableHeading = ({
9831
9826
  tooltipText = "Click to edit title",
9832
9827
  ariaLabel = "Edit title",
9833
9828
  forceEditing = false,
9834
- editingDisabled = false,
9835
- textareaProps,
9836
- headingProps,
9837
- dataTestId
9829
+ editingDisabled = false
9838
9830
  }) => {
9839
9831
  const [isEditing, setIsEditing] = (0, import_react46.useState)(false);
9840
9832
  const [value, setValue] = (0, import_react46.useState)(children);
@@ -9876,10 +9868,8 @@ var EditableHeading = ({
9876
9868
  const HeadingComponent2 = /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9877
9869
  StyledHeading2,
9878
9870
  {
9879
- ...headingProps,
9880
9871
  ref: headingRef,
9881
9872
  $editingDisabled: editingDisabled,
9882
- "data-testid": dataTestId,
9883
9873
  onClick: () => handleSetEditing(true),
9884
9874
  variant: "heading1",
9885
9875
  children: value
@@ -9890,13 +9880,11 @@ var EditableHeading = ({
9890
9880
  }
9891
9881
  if (isEditing || forceEditing) {
9892
9882
  return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9893
- StyledEditableHeadingInput,
9883
+ StyledInput,
9894
9884
  {
9895
- ...textareaProps,
9896
- $headingHeight: headingHeight,
9897
- "aria-label": ariaLabel,
9885
+ $height: headingHeight,
9898
9886
  autoFocus: true,
9899
- "data-testid": dataTestId,
9887
+ fullWidth: true,
9900
9888
  onBlur: handleFinishEditing,
9901
9889
  onChange: (event) => setValue(event.target.value),
9902
9890
  onFocus: (event) => {
@@ -9904,8 +9892,8 @@ var EditableHeading = ({
9904
9892
  event.currentTarget.setSelectionRange(length, length);
9905
9893
  },
9906
9894
  onKeyDown: handleKeyDown,
9907
- value,
9908
- children: value
9895
+ type: "multiline",
9896
+ value
9909
9897
  }
9910
9898
  );
9911
9899
  }