@wistia/ui 0.18.0-beta.6b0e0e1f.6fda0f8 → 0.18.0-beta.6d32b1a6.7a80f3d
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 +20 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -2078,6 +2078,11 @@ type EditableTextRootProps = Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue
|
|
|
2078
2078
|
* Whether the editable text is read only. If true, the editable text will not be editable and the trigger will not be shown.
|
|
2079
2079
|
*/
|
|
2080
2080
|
readOnly?: boolean;
|
|
2081
|
+
/**
|
|
2082
|
+
* When true, prevents the text from entering edit mode
|
|
2083
|
+
* @default false
|
|
2084
|
+
*/
|
|
2085
|
+
disabled?: boolean;
|
|
2081
2086
|
/**
|
|
2082
2087
|
* The id of the editable text.
|
|
2083
2088
|
*/
|
|
@@ -2114,6 +2119,7 @@ type EditableTextContextValues = {
|
|
|
2114
2119
|
typographicVariant: TypographicVariant;
|
|
2115
2120
|
submitMode: 'blur' | 'both' | 'enter' | 'none';
|
|
2116
2121
|
readOnly: boolean;
|
|
2122
|
+
disabled: boolean;
|
|
2117
2123
|
id: string;
|
|
2118
2124
|
label: string;
|
|
2119
2125
|
placeholder: string;
|
|
@@ -2122,7 +2128,7 @@ type EditableTextContextValues = {
|
|
|
2122
2128
|
finalFocusEl: (() => HTMLElement | null) | undefined;
|
|
2123
2129
|
};
|
|
2124
2130
|
declare const EditableTextContext: react.Context<EditableTextContextValues | null>;
|
|
2125
|
-
declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
|
|
2131
|
+
declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, disabled, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
|
|
2126
2132
|
|
|
2127
2133
|
type EditableTextProps = Omit<EditableTextRootProps, 'children'> & {
|
|
2128
2134
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2078,6 +2078,11 @@ type EditableTextRootProps = Omit<ComponentPropsWithoutRef<'div'>, 'defaultValue
|
|
|
2078
2078
|
* Whether the editable text is read only. If true, the editable text will not be editable and the trigger will not be shown.
|
|
2079
2079
|
*/
|
|
2080
2080
|
readOnly?: boolean;
|
|
2081
|
+
/**
|
|
2082
|
+
* When true, prevents the text from entering edit mode
|
|
2083
|
+
* @default false
|
|
2084
|
+
*/
|
|
2085
|
+
disabled?: boolean;
|
|
2081
2086
|
/**
|
|
2082
2087
|
* The id of the editable text.
|
|
2083
2088
|
*/
|
|
@@ -2114,6 +2119,7 @@ type EditableTextContextValues = {
|
|
|
2114
2119
|
typographicVariant: TypographicVariant;
|
|
2115
2120
|
submitMode: 'blur' | 'both' | 'enter' | 'none';
|
|
2116
2121
|
readOnly: boolean;
|
|
2122
|
+
disabled: boolean;
|
|
2117
2123
|
id: string;
|
|
2118
2124
|
label: string;
|
|
2119
2125
|
placeholder: string;
|
|
@@ -2122,7 +2128,7 @@ type EditableTextContextValues = {
|
|
|
2122
2128
|
finalFocusEl: (() => HTMLElement | null) | undefined;
|
|
2123
2129
|
};
|
|
2124
2130
|
declare const EditableTextContext: react.Context<EditableTextContextValues | null>;
|
|
2125
|
-
declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
|
|
2131
|
+
declare const EditableTextRoot: ({ children, defaultValue, value: controlledValue, onValueChange, onValueCommit, onValueRevert, onEditingChange, typographicVariant, submitMode, readOnly, disabled, id, label, placeholder, minLines, maxLines, finalFocusEl, ...props }: EditableTextRootProps) => JSX$1.Element;
|
|
2126
2132
|
|
|
2127
2133
|
type EditableTextProps = Omit<EditableTextRootProps, 'children'> & {
|
|
2128
2134
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/*
|
|
3
|
-
* @license @wistia/ui v0.18.0-beta.
|
|
3
|
+
* @license @wistia/ui v0.18.0-beta.6d32b1a6.7a80f3d
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
|
|
6
6
|
*
|
|
@@ -14230,6 +14230,7 @@ var EditableTextRoot = ({
|
|
|
14230
14230
|
typographicVariant = "body2",
|
|
14231
14231
|
submitMode = "both",
|
|
14232
14232
|
readOnly = false,
|
|
14233
|
+
disabled = false,
|
|
14233
14234
|
id,
|
|
14234
14235
|
label,
|
|
14235
14236
|
placeholder = "Click to edit this text",
|
|
@@ -14247,13 +14248,14 @@ var EditableTextRoot = ({
|
|
|
14247
14248
|
const computedId = isNonEmptyString6(id) ? id : `wistia-ui-editable-text-${generatedId}`;
|
|
14248
14249
|
const handleSetIsEditing = useCallback16(
|
|
14249
14250
|
(editing) => {
|
|
14251
|
+
if (disabled) return;
|
|
14250
14252
|
if (editing && !isEditing) {
|
|
14251
14253
|
setOriginalValue(value);
|
|
14252
14254
|
}
|
|
14253
14255
|
setIsEditing(editing);
|
|
14254
14256
|
onEditingChange?.(editing);
|
|
14255
14257
|
},
|
|
14256
|
-
[isEditing, value, onEditingChange]
|
|
14258
|
+
[disabled, isEditing, value, onEditingChange]
|
|
14257
14259
|
);
|
|
14258
14260
|
const setValue = useCallback16(
|
|
14259
14261
|
(newValue) => {
|
|
@@ -14276,6 +14278,7 @@ var EditableTextRoot = ({
|
|
|
14276
14278
|
typographicVariant,
|
|
14277
14279
|
submitMode,
|
|
14278
14280
|
readOnly,
|
|
14281
|
+
disabled,
|
|
14279
14282
|
id: computedId,
|
|
14280
14283
|
label,
|
|
14281
14284
|
placeholder,
|
|
@@ -14294,6 +14297,7 @@ var EditableTextRoot = ({
|
|
|
14294
14297
|
typographicVariant,
|
|
14295
14298
|
submitMode,
|
|
14296
14299
|
readOnly,
|
|
14300
|
+
disabled,
|
|
14297
14301
|
computedId,
|
|
14298
14302
|
label,
|
|
14299
14303
|
placeholder,
|
|
@@ -14305,6 +14309,9 @@ var EditableTextRoot = ({
|
|
|
14305
14309
|
if (readOnly) {
|
|
14306
14310
|
return "read-only";
|
|
14307
14311
|
}
|
|
14312
|
+
if (disabled) {
|
|
14313
|
+
return "disabled";
|
|
14314
|
+
}
|
|
14308
14315
|
if (isEditing) {
|
|
14309
14316
|
return "editing";
|
|
14310
14317
|
}
|
|
@@ -14365,7 +14372,16 @@ var EditableTextDisplayComponent = forwardRef21(
|
|
|
14365
14372
|
if (!context) {
|
|
14366
14373
|
throw new Error("EditableTextDisplay must be used within an EditableTextRoot context");
|
|
14367
14374
|
}
|
|
14368
|
-
const {
|
|
14375
|
+
const {
|
|
14376
|
+
value,
|
|
14377
|
+
typographicVariant,
|
|
14378
|
+
setIsEditing,
|
|
14379
|
+
placeholder,
|
|
14380
|
+
maxLines,
|
|
14381
|
+
isEditing,
|
|
14382
|
+
minLines,
|
|
14383
|
+
disabled
|
|
14384
|
+
} = context;
|
|
14369
14385
|
const triggerButtonRef = useRef17(null);
|
|
14370
14386
|
const handleTriggerClick = () => {
|
|
14371
14387
|
setIsEditing(true);
|
|
@@ -14376,7 +14392,7 @@ var EditableTextDisplayComponent = forwardRef21(
|
|
|
14376
14392
|
if (isEditing) {
|
|
14377
14393
|
return null;
|
|
14378
14394
|
}
|
|
14379
|
-
if (asTrigger && !context.readOnly) {
|
|
14395
|
+
if (asTrigger && !context.readOnly && !disabled) {
|
|
14380
14396
|
return /* @__PURE__ */ jsx278(ClickRegion, { targetRef: triggerButtonRef, children: /* @__PURE__ */ jsxs43(
|
|
14381
14397
|
StyledEditableTextDisplay,
|
|
14382
14398
|
{
|