@wistia/ui 0.5.2-beta.7129b857.bf33a3e → 0.5.2-beta.a848ca2c.7febb8d

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.7129b857.bf33a3e
3
+ * @license @wistia/ui v0.5.2-beta.a848ca2c.7febb8d
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -56,7 +56,6 @@ __export(index_exports, {
56
56
  DataCardTrend: () => DataCardTrend,
57
57
  DataCards: () => DataCards,
58
58
  Divider: () => Divider,
59
- EditableHeading: () => EditableHeading,
60
59
  Ellipsis: () => Ellipsis,
61
60
  Form: () => Form,
62
61
  FormErrorSummary: () => FormErrorSummary,
@@ -2081,9 +2080,9 @@ var import_react6 = require("react");
2081
2080
  // src/private/hooks/useEvent/useEvent.ts
2082
2081
  var import_react5 = require("react");
2083
2082
 
2084
- // src/private/helpers/isObjectRef/isObjectRef.ts
2083
+ // src/private/helpers/isValidRef/isValidRef.ts
2085
2084
  var import_type_guards6 = require("@wistia/type-guards");
2086
- var isObjectRef = (value) => {
2085
+ var isValidRef = (value) => {
2087
2086
  return (0, import_type_guards6.isNotNil)(value) && (0, import_type_guards6.isRecord)(value) && "current" in value;
2088
2087
  };
2089
2088
 
@@ -2103,7 +2102,7 @@ var useEvent = (eventName, eventHandler, eventTarget = window, eventOptions = {}
2103
2102
  savedEventOptions.current = eventOptions;
2104
2103
  }, [eventOptions]);
2105
2104
  (0, import_react5.useEffect)(() => {
2106
- const target = isObjectRef(eventTarget) ? eventTarget.current : eventTarget;
2105
+ const target = isValidRef(eventTarget) ? eventTarget.current : eventTarget;
2107
2106
  if (!eventName || !isEventTargetSupported(target)) {
2108
2107
  return;
2109
2108
  }
@@ -7905,7 +7904,7 @@ var StyledInputContainer = import_styled_components41.default.div`
7905
7904
  padding-right: 32px;
7906
7905
  }
7907
7906
  `;
7908
- var isValidRef = (ref) => {
7907
+ var isValidRef2 = (ref) => {
7909
7908
  return typeof ref === "object" && ref !== null && "current" in ref && (0, import_type_guards24.isNotNil)(ref.current);
7910
7909
  };
7911
7910
  var Input = (0, import_react30.forwardRef)(
@@ -7919,7 +7918,7 @@ var Input = (0, import_react30.forwardRef)(
7919
7918
  ...props
7920
7919
  }, externalRef) => {
7921
7920
  const internalRef = (0, import_react30.useRef)();
7922
- const ref = isValidRef(externalRef) ? externalRef : internalRef;
7921
+ const ref = isValidRef2(externalRef) ? externalRef : internalRef;
7923
7922
  let leftIconToDisplay = leftIcon;
7924
7923
  if ((0, import_type_guards24.isNil)(leftIcon) && type === "search") {
7925
7924
  leftIconToDisplay = /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Icon, { type: "search" });
@@ -9776,146 +9775,6 @@ var DataCardTrend = ({
9776
9775
  )
9777
9776
  ] });
9778
9777
  };
9779
-
9780
- // src/components/EditableHeading/EditableHeading.tsx
9781
- var import_styled_components65 = __toESM(require("styled-components"));
9782
- var import_react46 = require("react");
9783
- var import_jsx_runtime214 = require("react/jsx-runtime");
9784
- var StyledInput = (0, import_styled_components65.default)(Input)`
9785
- :not([rows]) {
9786
- min-height: unset;
9787
- }
9788
-
9789
- resize: vertical;
9790
- font-size: var(--wui-typography-heading-1-size);
9791
- font-weight: var(--wui-typography-heading-1-weight);
9792
- line-height: var(--wui-typography-heading-1-line-height);
9793
- font-family: var(--wui-typography-heading-1-family);
9794
- outline: 2px solid var(--wui-color-focus-ring);
9795
- outline-offset: -2px;
9796
-
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;
9812
- }
9813
- `;
9814
- var StyledHeading2 = (0, import_styled_components65.default)(Heading)`
9815
- width: 100%;
9816
- border-radius: var(--wui-border-radius-02);
9817
- padding: var(--wui-space-02);
9818
- overflow-wrap: anywhere;
9819
- transition: all var(--wui-motion-duration-01) var(--wui-motion-ease);
9820
- ${({ $editingDisabled }) => !$editingDisabled && editableStyles}
9821
- `;
9822
- var EditableHeading = ({
9823
- children,
9824
- onValueChange,
9825
- onEditingChange,
9826
- tooltipText = "Click to edit title",
9827
- ariaLabel = "Edit title",
9828
- forceEditing = false,
9829
- editingDisabled = false
9830
- }) => {
9831
- const [isEditing, setIsEditing] = (0, import_react46.useState)(false);
9832
- const [value, setValue] = (0, import_react46.useState)(children);
9833
- const [previousValue, setPreviousValue] = (0, import_react46.useState)(children);
9834
- const [headingHeight, setHeadingHeight] = (0, import_react46.useState)("60");
9835
- const headingRef = (0, import_react46.useRef)(null);
9836
- const handleSetEditing = (editing) => {
9837
- if (editingDisabled) return;
9838
- if (editing && headingRef.current) {
9839
- setHeadingHeight(`${headingRef.current.offsetHeight}`);
9840
- }
9841
- if (editing) {
9842
- setPreviousValue(value);
9843
- }
9844
- setIsEditing(editing);
9845
- onEditingChange?.(editing);
9846
- };
9847
- const handleFinishEditing = () => {
9848
- const trimmedValue = value.trim();
9849
- if (trimmedValue === "") {
9850
- setValue(previousValue);
9851
- } else if (trimmedValue !== previousValue && onValueChange) {
9852
- onValueChange(trimmedValue);
9853
- } else {
9854
- setValue(trimmedValue);
9855
- }
9856
- handleSetEditing(false);
9857
- };
9858
- const handleKeyDown = (event) => {
9859
- if (event.key === "Enter" && !event.shiftKey) {
9860
- event.preventDefault();
9861
- handleFinishEditing();
9862
- }
9863
- if (event.key === "Escape") {
9864
- setValue(previousValue);
9865
- handleSetEditing(false);
9866
- }
9867
- };
9868
- const HeadingComponent2 = /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9869
- StyledHeading2,
9870
- {
9871
- ref: headingRef,
9872
- $editingDisabled: editingDisabled,
9873
- onClick: () => handleSetEditing(true),
9874
- variant: "heading1",
9875
- children: value
9876
- }
9877
- );
9878
- if (editingDisabled) {
9879
- return HeadingComponent2;
9880
- }
9881
- if (isEditing || forceEditing) {
9882
- return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9883
- StyledInput,
9884
- {
9885
- $height: headingHeight,
9886
- autoFocus: true,
9887
- fullWidth: true,
9888
- onBlur: handleFinishEditing,
9889
- onChange: (event) => setValue(event.target.value),
9890
- onFocus: (event) => {
9891
- const { length } = event.currentTarget.value;
9892
- event.currentTarget.setSelectionRange(length, length);
9893
- },
9894
- onKeyDown: handleKeyDown,
9895
- type: "multiline",
9896
- value
9897
- }
9898
- );
9899
- }
9900
- return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_jsx_runtime214.Fragment, { children: [
9901
- /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9902
- Tooltip,
9903
- {
9904
- compact: true,
9905
- content: tooltipText,
9906
- children: HeadingComponent2
9907
- }
9908
- ),
9909
- /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(ScreenReaderOnly, { children: /* @__PURE__ */ (0, import_jsx_runtime214.jsx)(
9910
- "button",
9911
- {
9912
- "aria-label": ariaLabel,
9913
- onClick: () => handleSetEditing(true),
9914
- type: "button"
9915
- }
9916
- ) })
9917
- ] });
9918
- };
9919
9778
  // Annotate the CommonJS export names for ESM import in node:
9920
9779
  0 && (module.exports = {
9921
9780
  ActionButton,
@@ -9935,7 +9794,6 @@ var EditableHeading = ({
9935
9794
  DataCardTrend,
9936
9795
  DataCards,
9937
9796
  Divider,
9938
- EditableHeading,
9939
9797
  Ellipsis,
9940
9798
  Form,
9941
9799
  FormErrorSummary,