@gridui/inline-editor 1.0.0 → 1.0.2
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/README.md +3 -3
- package/docs/inline-editor.md +48 -0
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -5,11 +5,11 @@ Core family. Public API: `InlineEditor`, `InlineEditorProps`.
|
|
|
5
5
|
Import components from `@gridui/inline-editor` and load `@gridui/inline-editor/styles.css` after Theme.
|
|
6
6
|
Load styles for any composed dependency used by this family. Applications own routes, labels, state persistence, and branding.
|
|
7
7
|
|
|
8
|
-
See [component ownership](
|
|
8
|
+
See [component ownership](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/docs/component-ownership.md) and [release history](https://github.com/sudo-ui/GridUI-React-Monorepo/tree/main/packages-core/inline-editor/.changeset/history).
|
|
9
9
|
|
|
10
10
|
## Controlled inline editing
|
|
11
11
|
|
|
12
12
|
See [InlineEditor](docs/inline-editor.md) for editing state and submission ownership,
|
|
13
|
-
and [Textarea](
|
|
13
|
+
and [Textarea](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/input/docs/textarea.md#optional-automatic-height) for optional automatic height.
|
|
14
14
|
|
|
15
|
-
See [common inputs](
|
|
15
|
+
See [common inputs](https://github.com/sudo-ui/GridUI-React-Monorepo/blob/main/packages-core/input/docs/common-inputs.md) for multiple selection, numeric values, sliders, and editable tags.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# InlineEditor
|
|
2
|
+
|
|
3
|
+
Import `InlineEditor` and `InlineEditorProps` from `@gridui/inline-editor`, and
|
|
4
|
+
load its stylesheet after Theme and its rendered dependencies.
|
|
5
|
+
|
|
6
|
+
This is a controlled single-line editing composition. The caller supplies
|
|
7
|
+
`editing` / `onEditingChange`, draft `value` / `onValueChange`, `display`, field
|
|
8
|
+
`label`, and `editLabel`, `saveLabel`, `cancelLabel`. View mode mounts only display
|
|
9
|
+
content and the edit button; the draft field is not mounted.
|
|
10
|
+
Passing `display={null}` omits the display region without reserving empty space.
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
<InlineEditor editing={editing} onEditingChange={setEditing}
|
|
14
|
+
value={draft} onValueChange={setDraft} display={savedTitle}
|
|
15
|
+
label="Title" editLabel="Edit" saveLabel="Save" cancelLabel="Cancel"
|
|
16
|
+
busy={saving} onSubmit={saveDraft} onCancel={restoreSavedTitle}
|
|
17
|
+
feedback={feedback} />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Entering edit mode focuses the input; leaving returns focus to the edit button.
|
|
21
|
+
Enter requests `onSubmit(value)` without changing editing state. Escape (outside
|
|
22
|
+
IME composition) and Cancel call `onCancel`, then request `onEditingChange(false)`.
|
|
23
|
+
Blur never submits or discards a draft. IME confirmation does not trigger submit.
|
|
24
|
+
If editing ends during a busy save, focus returns when the edit trigger becomes
|
|
25
|
+
enabled again.
|
|
26
|
+
|
|
27
|
+
`busy` disables input, save, edit and cancel controls. `disabled` disables editing
|
|
28
|
+
and submitting, but an existing edit can still be cancelled with its Cancel
|
|
29
|
+
button. The caller owns async execution, duplicate-request protection, error
|
|
30
|
+
handling and draft clearing. Close only after successful save by setting
|
|
31
|
+
`editing=false`; on failure retain the value, clear busy, and provide safe
|
|
32
|
+
`feedback`. No promise is awaited and no errors or input values are logged.
|
|
33
|
+
|
|
34
|
+
`submitDisabled` disables only Save and blocks Enter submission while keeping the
|
|
35
|
+
input and Cancel usable. Both submission paths call the input's native
|
|
36
|
+
`reportValidity()` before requesting submission, including required and pattern
|
|
37
|
+
constraints. Inherited fieldset disabledness also blocks submission. Application
|
|
38
|
+
validation and authorization still run inside `onSubmit`.
|
|
39
|
+
|
|
40
|
+
`editButtonProps` forwards appearance, accessible naming and a ref to the edit
|
|
41
|
+
trigger. InlineEditor retains its click, type, loading and disabled behavior.
|
|
42
|
+
|
|
43
|
+
`inputProps` forwards native constraints, input type, autocomplete, ref, styling
|
|
44
|
+
and accessible descriptions to the shared Input. Value, disabled state and the
|
|
45
|
+
Enter/Escape policy are owned by InlineEditor. Native div props and the outer ref
|
|
46
|
+
are forwarded to the root. The component creates no nested form and its buttons
|
|
47
|
+
are explicitly non-submit buttons, so it can be composed inside a larger form.
|
|
48
|
+
Applications own validation and authorization before accepting a submit request.
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gridui/inline-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "GridUI React inline editor",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
|
+
"docs",
|
|
9
10
|
"README.md"
|
|
10
11
|
],
|
|
11
12
|
"sideEffects": [
|
|
@@ -26,16 +27,17 @@
|
|
|
26
27
|
"react-dom": "^19.2.0"
|
|
27
28
|
},
|
|
28
29
|
"dependencies": {
|
|
29
|
-
"@gridui/button": "^2.
|
|
30
|
-
"@gridui/input": "^1.
|
|
31
|
-
"@gridui/style-utils": "^2.1.
|
|
32
|
-
"@gridui/theme": "^2.
|
|
30
|
+
"@gridui/button": "^2.2.0",
|
|
31
|
+
"@gridui/input": "^1.1.2",
|
|
32
|
+
"@gridui/style-utils": "^2.1.4",
|
|
33
|
+
"@gridui/theme": "^2.3.2"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
|
-
"@gridui-internal/configuration": "0.0.0",
|
|
36
|
+
"@gridui-internal/configuration": "0.0.0-internal",
|
|
36
37
|
"@jest/globals": "30.5.2",
|
|
38
|
+
"@storybook/react-vite": "10.6.5",
|
|
37
39
|
"@types/jest": "30.0.0",
|
|
38
|
-
"@types/node": "26.6.
|
|
40
|
+
"@types/node": "26.6.6",
|
|
39
41
|
"@types/react": "19.3.0",
|
|
40
42
|
"@types/react-dom": "19.3.0",
|
|
41
43
|
"jest": "30.5.2",
|