@wistia/ui 0.14.30 → 0.14.31-beta.5db6980a.e3aeec3
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 +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.mjs +24 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.14.
|
|
3
|
+
* @license @wistia/ui v0.14.31-beta.5db6980a.e3aeec3
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -13627,6 +13627,7 @@ var StyledInput = (0, import_styled_components79.default)(Input)`
|
|
|
13627
13627
|
border: none;
|
|
13628
13628
|
height: ${({ $height }) => `${$height}px`};
|
|
13629
13629
|
min-height: ${({ $height }) => `${$height}px`};
|
|
13630
|
+
resize: none;
|
|
13630
13631
|
}
|
|
13631
13632
|
`;
|
|
13632
13633
|
var editableStyles = import_styled_components79.css`
|
|
@@ -13768,6 +13769,7 @@ var EditableTextRoot = ({
|
|
|
13768
13769
|
typographicVariant = "body2",
|
|
13769
13770
|
submitMode = "both",
|
|
13770
13771
|
readOnly = false,
|
|
13772
|
+
disabled = false,
|
|
13771
13773
|
id,
|
|
13772
13774
|
label,
|
|
13773
13775
|
placeholder = "Click to edit this text",
|
|
@@ -13785,13 +13787,14 @@ var EditableTextRoot = ({
|
|
|
13785
13787
|
const computedId = (0, import_type_guards43.isNonEmptyString)(id) ? id : `wistia-ui-editable-text-${generatedId}`;
|
|
13786
13788
|
const handleSetIsEditing = (0, import_react64.useCallback)(
|
|
13787
13789
|
(editing) => {
|
|
13790
|
+
if (disabled) return;
|
|
13788
13791
|
if (editing && !isEditing) {
|
|
13789
13792
|
setOriginalValue(value);
|
|
13790
13793
|
}
|
|
13791
13794
|
setIsEditing(editing);
|
|
13792
13795
|
onEditingChange?.(editing);
|
|
13793
13796
|
},
|
|
13794
|
-
[isEditing, value, onEditingChange]
|
|
13797
|
+
[disabled, isEditing, value, onEditingChange]
|
|
13795
13798
|
);
|
|
13796
13799
|
const setValue = (0, import_react64.useCallback)(
|
|
13797
13800
|
(newValue) => {
|
|
@@ -13814,6 +13817,7 @@ var EditableTextRoot = ({
|
|
|
13814
13817
|
typographicVariant,
|
|
13815
13818
|
submitMode,
|
|
13816
13819
|
readOnly,
|
|
13820
|
+
disabled,
|
|
13817
13821
|
id: computedId,
|
|
13818
13822
|
label,
|
|
13819
13823
|
placeholder,
|
|
@@ -13832,6 +13836,7 @@ var EditableTextRoot = ({
|
|
|
13832
13836
|
typographicVariant,
|
|
13833
13837
|
submitMode,
|
|
13834
13838
|
readOnly,
|
|
13839
|
+
disabled,
|
|
13835
13840
|
computedId,
|
|
13836
13841
|
label,
|
|
13837
13842
|
placeholder,
|
|
@@ -13843,6 +13848,9 @@ var EditableTextRoot = ({
|
|
|
13843
13848
|
if (readOnly) {
|
|
13844
13849
|
return "read-only";
|
|
13845
13850
|
}
|
|
13851
|
+
if (disabled) {
|
|
13852
|
+
return "disabled";
|
|
13853
|
+
}
|
|
13846
13854
|
if (isEditing) {
|
|
13847
13855
|
return "editing";
|
|
13848
13856
|
}
|
|
@@ -13919,7 +13927,16 @@ var EditableTextDisplayComponent = (0, import_react65.forwardRef)(
|
|
|
13919
13927
|
if (!context) {
|
|
13920
13928
|
throw new Error("EditableTextDisplay must be used within an EditableTextRoot context");
|
|
13921
13929
|
}
|
|
13922
|
-
const {
|
|
13930
|
+
const {
|
|
13931
|
+
value,
|
|
13932
|
+
typographicVariant,
|
|
13933
|
+
setIsEditing,
|
|
13934
|
+
placeholder,
|
|
13935
|
+
maxLines,
|
|
13936
|
+
isEditing,
|
|
13937
|
+
minLines,
|
|
13938
|
+
disabled
|
|
13939
|
+
} = context;
|
|
13923
13940
|
const triggerButtonRef = (0, import_react65.useRef)(null);
|
|
13924
13941
|
const handleTriggerClick = () => {
|
|
13925
13942
|
setIsEditing(true);
|
|
@@ -13930,7 +13947,7 @@ var EditableTextDisplayComponent = (0, import_react65.forwardRef)(
|
|
|
13930
13947
|
if (isEditing) {
|
|
13931
13948
|
return null;
|
|
13932
13949
|
}
|
|
13933
|
-
if (asTrigger && !context.readOnly) {
|
|
13950
|
+
if (asTrigger && !context.readOnly && !disabled) {
|
|
13934
13951
|
return /* @__PURE__ */ (0, import_jsx_runtime276.jsx)(ClickRegion, { targetRef: triggerButtonRef, children: /* @__PURE__ */ (0, import_jsx_runtime276.jsxs)(
|
|
13935
13952
|
StyledEditableTextDisplay,
|
|
13936
13953
|
{
|
|
@@ -13988,9 +14005,10 @@ var StyledInput2 = (0, import_styled_components83.default)(Input)`
|
|
|
13988
14005
|
${({ $minLines }) => (0, import_type_guards45.isNotNil)($minLines) && `min-height: calc(${$minLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
13989
14006
|
${({ $maxLines }) => (0, import_type_guards45.isNotNil)($maxLines) && `max-height: calc(${$maxLines}lh + calc(var(--wui-editable-text-padding) * 2));`}
|
|
13990
14007
|
${({ $typographicVariant }) => getTypographicStyles($typographicVariant)}
|
|
13991
|
-
padding: var(--wui-editable-text-padding);
|
|
13992
|
-
border-radius: var(--wui-editable-text-border-radius);
|
|
13993
14008
|
background-color: var(--wui-color-bg-surface);
|
|
14009
|
+
border-radius: var(--wui-editable-text-border-radius);
|
|
14010
|
+
padding: var(--wui-editable-text-padding);
|
|
14011
|
+
resize: none;
|
|
13994
14012
|
}
|
|
13995
14013
|
`;
|
|
13996
14014
|
var EditableTextInput = (props) => {
|