@syware/jlib 0.13.0 → 0.15.0
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 +12 -8
- package/dist/atoms/jl-avatar.d.ts +2 -0
- package/dist/atoms/jl-avatar.js +11 -6
- package/dist/atoms/jl-button.d.ts +6 -0
- package/dist/atoms/jl-button.js +22 -8
- package/dist/atoms/jl-chip.js +2 -1
- package/dist/atoms/jl-input.js +3 -3
- package/dist/atoms/jl-link.d.ts +1 -0
- package/dist/atoms/jl-link.js +5 -2
- package/dist/atoms/jl-progress-ring.d.ts +2 -0
- package/dist/atoms/jl-progress-ring.js +9 -4
- package/dist/atoms/jl-progress.d.ts +1 -0
- package/dist/atoms/jl-progress.js +8 -4
- package/dist/atoms/jl-rating.d.ts +2 -0
- package/dist/atoms/jl-rating.js +11 -6
- package/dist/atoms/jl-select.css.js +1 -1
- package/dist/atoms/jl-select.d.ts +4 -0
- package/dist/atoms/jl-select.js +18 -2
- package/dist/atoms/jl-switch.css.js +1 -1
- package/dist/atoms/jl-textarea.js +2 -2
- package/dist/base/jl-form-control.d.ts +3 -2
- package/dist/base/jl-form-control.js +14 -4
- package/dist/index.d.ts +2 -1
- package/dist/lib/dom.d.ts +5 -0
- package/dist/lib/dom.js +9 -1
- package/dist/lib/download.js +10 -2
- package/dist/lib/floating.d.ts +5 -0
- package/dist/lib/floating.js +21 -2
- package/dist/lib/fuzzy.d.ts +3 -2
- package/dist/lib/fuzzy.js +15 -4
- package/dist/lib/hotkey.d.ts +13 -0
- package/dist/lib/hotkey.js +2 -1
- package/dist/lib/key-shortcut.js +11 -29
- package/dist/lib/modal.d.ts +24 -0
- package/dist/lib/modal.js +52 -0
- package/dist/lib/numeric.d.ts +5 -0
- package/dist/lib/numeric.js +11 -1
- package/dist/lib/option-filter.d.ts +2 -0
- package/dist/lib/option-filter.js +1 -1
- package/dist/lib/press.d.ts +11 -0
- package/dist/lib/press.js +31 -0
- package/dist/lib/progress.d.ts +0 -5
- package/dist/lib/progress.js +1 -9
- package/dist/lib/roving.d.ts +6 -0
- package/dist/lib/roving.js +14 -1
- package/dist/lib/table.js +12 -4
- package/dist/lib/texts-de.d.ts +12 -0
- package/dist/lib/texts-de.js +12 -0
- package/dist/lib/texts-fr.d.ts +12 -0
- package/dist/lib/texts-fr.js +12 -0
- package/dist/lib/texts.d.ts +12 -0
- package/dist/lib/texts.js +12 -0
- package/dist/molecules/jl-accordion-item.js +2 -1
- package/dist/molecules/jl-calendar.d.ts +4 -0
- package/dist/molecules/jl-calendar.js +16 -5
- package/dist/molecules/jl-chip-group.css.js +1 -1
- package/dist/molecules/jl-chip-group.js +4 -4
- package/dist/molecules/jl-code-block.css.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +4 -0
- package/dist/molecules/jl-combobox.js +23 -11
- package/dist/molecules/jl-copy-button.css.js +1 -1
- package/dist/molecules/jl-copy-button.d.ts +11 -4
- package/dist/molecules/jl-copy-button.js +48 -22
- package/dist/molecules/jl-date-picker.d.ts +4 -0
- package/dist/molecules/jl-date-picker.js +18 -12
- package/dist/molecules/jl-field.d.ts +5 -1
- package/dist/molecules/jl-field.js +24 -5
- package/dist/molecules/jl-file-drop.css.js +1 -1
- package/dist/molecules/jl-file-drop.d.ts +4 -0
- package/dist/molecules/jl-file-drop.js +16 -8
- package/dist/molecules/jl-input-list.js +13 -6
- package/dist/molecules/jl-load-state.d.ts +8 -0
- package/dist/molecules/jl-load-state.js +33 -7
- package/dist/molecules/jl-menu.d.ts +21 -1
- package/dist/molecules/jl-menu.js +58 -6
- package/dist/molecules/jl-number-input.d.ts +2 -0
- package/dist/molecules/jl-number-input.js +12 -8
- package/dist/molecules/jl-radio-group.js +4 -3
- package/dist/molecules/jl-search.js +2 -2
- package/dist/molecules/jl-segmented.js +2 -2
- package/dist/molecules/jl-tabs.js +2 -2
- package/dist/molecules/jl-tag-input.css.js +1 -1
- package/dist/molecules/jl-tag-input.d.ts +4 -0
- package/dist/molecules/jl-tag-input.js +17 -9
- package/dist/molecules/jl-toast.js +10 -6
- package/dist/molecules/jl-tooltip.js +8 -2
- package/dist/organisms/jl-command-palette.css.js +1 -1
- package/dist/organisms/jl-command-palette.d.ts +2 -0
- package/dist/organisms/jl-command-palette.js +10 -4
- package/dist/organisms/jl-dialog.d.ts +3 -0
- package/dist/organisms/jl-dialog.js +13 -3
- package/dist/organisms/jl-drawer.d.ts +3 -0
- package/dist/organisms/jl-drawer.js +13 -3
- package/dist/organisms/jl-flow.d.ts +2 -0
- package/dist/organisms/jl-flow.js +29 -9
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +15 -4
- package/dist/organisms/jl-table.js +40 -17
- package/dist/organisms/jl-toaster.d.ts +13 -2
- package/dist/organisms/jl-toaster.js +47 -4
- package/dist/organisms/jl-tree.css.js +1 -1
- package/dist/organisms/jl-tree.d.ts +23 -4
- package/dist/organisms/jl-tree.js +74 -18
- package/dist/styles/base.css.js +1 -1
- package/dist/styles/control.css.js +1 -1
- package/dist/styles/tokens.css.js +1 -1
- package/dist/tokens.css +4 -3
- package/dist/types/jl-load-state.types.d.ts +7 -0
- package/dist/types/jl-table.types.d.ts +12 -0
- package/dist/types/jl-tree.types.d.ts +17 -0
- package/dist/types/press.types.d.ts +6 -0
- package/package.json +7 -3
- package/dist/lib/roving-index.d.ts +0 -10
- package/dist/lib/roving-index.js +0 -32
- /package/dist/types/{roving-index.types.d.ts → roving.types.d.ts} +0 -0
|
@@ -7,7 +7,7 @@ import { followAnchor } from "../lib/floating.js";
|
|
|
7
7
|
import { registerIcons } from "../lib/icons.js";
|
|
8
8
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
9
9
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
10
|
-
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
10
|
+
import { setAriaFlag, setOrRemove, uniqueId } from "../lib/dom.js";
|
|
11
11
|
import { NUMERIC_DATE, compareDates, dateOrder, datePattern, formatDate, isDateText, parseIsoDate, parseTypedDate, toIsoDate } from "../lib/calendar.js";
|
|
12
12
|
import { JlCalendar } from "./jl-calendar.js";
|
|
13
13
|
import jl_date_picker_default from "./jl-date-picker.css.js";
|
|
@@ -59,7 +59,7 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
59
59
|
/** Shows a button that empties the field while it holds a date. */
|
|
60
60
|
clearable = this.useChange(false, () => this.renderClear(), { attribute: "clearable" });
|
|
61
61
|
required = this.useChange(false, (value) => {
|
|
62
|
-
this._refs.native
|
|
62
|
+
setAriaFlag(this._refs.native, "aria-required", value);
|
|
63
63
|
this.reflect("required", value);
|
|
64
64
|
this.renderValidity();
|
|
65
65
|
}, { attribute: "required" });
|
|
@@ -67,7 +67,7 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
67
67
|
/** Draws the field in the danger colour, for an error the page found itself. */
|
|
68
68
|
invalid = this.useChange(false, (value) => {
|
|
69
69
|
this.reflect("invalid", value);
|
|
70
|
-
this._refs.native
|
|
70
|
+
setAriaFlag(this._refs.native, "aria-invalid", value);
|
|
71
71
|
}, { attribute: "invalid" });
|
|
72
72
|
size = this.useChange("md", (value) => this.reflect("size", value), {
|
|
73
73
|
attribute: "size",
|
|
@@ -75,6 +75,7 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
75
75
|
});
|
|
76
76
|
_popupId = uniqueId("jl-date-picker-popup");
|
|
77
77
|
_state = {
|
|
78
|
+
disabledByForm: false,
|
|
78
79
|
opening: new AbortController(),
|
|
79
80
|
/** Whether a press on the button should open: read before the press closes the calendar by light dismiss. */
|
|
80
81
|
openOnPress: null
|
|
@@ -181,11 +182,12 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
181
182
|
this.value.set(this.getAttribute("value") ?? "");
|
|
182
183
|
}
|
|
183
184
|
setDisabledByForm(disabled) {
|
|
184
|
-
|
|
185
|
-
this.whenRendered(() =>
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
this._state.disabledByForm = disabled;
|
|
186
|
+
this.whenRendered(() => this.drawDisabled());
|
|
187
|
+
}
|
|
188
|
+
/** Disabled by its own input, or by a `<fieldset disabled>` around it. */
|
|
189
|
+
isOff() {
|
|
190
|
+
return this.disabled.get() || this._state.disabledByForm;
|
|
189
191
|
}
|
|
190
192
|
isOpen() {
|
|
191
193
|
return this._refs.popup.matches(":popover-open");
|
|
@@ -253,7 +255,7 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
253
255
|
return this._refs.popup.querySelector(JlCalendar.selector);
|
|
254
256
|
}
|
|
255
257
|
openPopup() {
|
|
256
|
-
if (this.isOpen() || this.
|
|
258
|
+
if (this.isOpen() || this.isOff()) return;
|
|
257
259
|
this.commitText();
|
|
258
260
|
const calendar = this.calendar();
|
|
259
261
|
calendar.value.set(this.validIso());
|
|
@@ -348,13 +350,17 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
348
350
|
this.internals.setValidity({});
|
|
349
351
|
}
|
|
350
352
|
renderClear() {
|
|
351
|
-
const editable = !this.
|
|
353
|
+
const editable = !this.isOff();
|
|
352
354
|
this._refs.clear.hidden = !(this.clearable.get() && editable && this._refs.native.value !== "");
|
|
353
355
|
}
|
|
354
356
|
renderDisabled(disabled) {
|
|
355
|
-
this._refs.native.disabled = disabled;
|
|
356
|
-
this._refs.open.disabled = disabled;
|
|
357
357
|
this.reflect("disabled", disabled);
|
|
358
|
+
this.drawDisabled();
|
|
359
|
+
}
|
|
360
|
+
/** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
|
|
361
|
+
drawDisabled() {
|
|
362
|
+
this._refs.native.disabled = this.isOff();
|
|
363
|
+
this._refs.open.disabled = this.isOff();
|
|
358
364
|
this.closePopup();
|
|
359
365
|
this.renderClear();
|
|
360
366
|
}
|
|
@@ -46,8 +46,12 @@ export declare class JlField extends JlElement {
|
|
|
46
46
|
private syncControl;
|
|
47
47
|
/** Runs `sync` on the control in the slot, when there is one. */
|
|
48
48
|
private withControl;
|
|
49
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Names the control for screen readers with the field's label, unless it has a label of its own: one written as
|
|
51
|
+
* an attribute, or given in code (a JSX prop writes no attribute), which is any label this field did not give.
|
|
52
|
+
*/
|
|
50
53
|
private syncLabel;
|
|
54
|
+
private hasOwnLabel;
|
|
51
55
|
/** Marks the control invalid, remembering it unless the page had marked it already. */
|
|
52
56
|
private invalidate;
|
|
53
57
|
/** Marks the control invalid while there is an error, and clears only what the field itself marked. */
|
|
@@ -43,7 +43,14 @@ var JlField = class extends JlElement {
|
|
|
43
43
|
attribute: "orientation",
|
|
44
44
|
parse: oneOf(FIELD_ORIENTATIONS, "vertical")
|
|
45
45
|
});
|
|
46
|
-
_state = {
|
|
46
|
+
_state = {
|
|
47
|
+
invalidated: null,
|
|
48
|
+
/** The control this field named, and with which label: a label of the control's own is told from it. */
|
|
49
|
+
named: {
|
|
50
|
+
control: null,
|
|
51
|
+
label: ""
|
|
52
|
+
}
|
|
53
|
+
};
|
|
47
54
|
_refs = this.useRefs((ref) => ({
|
|
48
55
|
asterisk: ref(".asterisk"),
|
|
49
56
|
errorRegion: ref(".error-region"),
|
|
@@ -128,12 +135,24 @@ var JlField = class extends JlElement {
|
|
|
128
135
|
const control = this.control();
|
|
129
136
|
if (control !== null) sync(control);
|
|
130
137
|
}
|
|
131
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* Names the control for screen readers with the field's label, unless it has a label of its own: one written as
|
|
140
|
+
* an attribute, or given in code (a JSX prop writes no attribute), which is any label this field did not give.
|
|
141
|
+
*/
|
|
132
142
|
syncLabel(control) {
|
|
133
143
|
const input = inputOf(control, "label");
|
|
134
|
-
const
|
|
135
|
-
if (input === null ||
|
|
136
|
-
|
|
144
|
+
const shown = control.hasAttribute("label") || VISIBLE_LABEL_TAGS.includes(control.localName);
|
|
145
|
+
if (input === null || shown || this.hasOwnLabel(control, input.get())) return;
|
|
146
|
+
const label = this.label.get();
|
|
147
|
+
this._state.named = {
|
|
148
|
+
control,
|
|
149
|
+
label
|
|
150
|
+
};
|
|
151
|
+
if (input.get() !== label) input.set(label);
|
|
152
|
+
}
|
|
153
|
+
hasOwnLabel(control, label) {
|
|
154
|
+
const { named } = this._state;
|
|
155
|
+
return label !== "" && !(named.control === control && named.label === label);
|
|
137
156
|
}
|
|
138
157
|
/** Marks the control invalid, remembering it unless the page had marked it already. */
|
|
139
158
|
invalidate(control, input) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/molecules/jl-file-drop.css?inline
|
|
2
|
-
var jl_file_drop_default = ":host{--pad:24px;--badge:44px;min-width:0;display:block}:host([size=sm]){--pad:14px;--badge:34px}:host([size=lg]){--pad:36px;--badge:52px}.zone{padding:var(--pad);border:1.5px dashed var(--jl-line-strong);border-radius:var(--jl-radius);background:var(--jl-surface);color:var(--jl-text);text-align:center;cursor:pointer;transition:border-color var(--jl-fast) var(--jl-ease), background var(--jl-fast) var(--jl-ease);flex-direction:column;align-items:center;gap:4px;display:flex}.zone:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%);background:var(--jl-surface-2)}:host([dragging]) .zone{border-color:var(--jl-accent);background:var(--jl-accent-soft)}:host([invalid]) .zone{border-color:var(--jl-danger)}:host(
|
|
2
|
+
var jl_file_drop_default = ":host{--pad:24px;--badge:44px;min-width:0;display:block}:host([size=sm]){--pad:14px;--badge:34px}:host([size=lg]){--pad:36px;--badge:52px}.zone{padding:var(--pad);border:1.5px dashed var(--jl-line-strong);border-radius:var(--jl-radius);background:var(--jl-surface);color:var(--jl-text);text-align:center;cursor:pointer;transition:border-color var(--jl-fast) var(--jl-ease), background var(--jl-fast) var(--jl-ease);flex-direction:column;align-items:center;gap:4px;display:flex}.zone:hover{border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%);background:var(--jl-surface-2)}:host([dragging]) .zone{border-color:var(--jl-accent);background:var(--jl-accent-soft)}:host([invalid]) .zone{border-color:var(--jl-danger)}:host(:disabled) .zone{border-color:var(--jl-line-strong);background:var(--jl-surface-2);color:var(--jl-muted);cursor:not-allowed}.zone-icon{width:var(--badge);height:var(--badge);border-radius:var(--jl-radius-pill);background:var(--jl-surface-3);color:var(--jl-muted);transition:background var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);justify-content:center;align-items:center;margin-bottom:6px}:host([dragging]) .zone-icon{background:var(--jl-surface);color:var(--jl-accent)}.text{font-size:var(--jl-font-md);font-weight:600;line-height:1.4}:host([size=sm]) .text{font-size:var(--jl-font-sm)}.hint{color:var(--jl-muted);font-size:var(--jl-font-xs);line-height:1.4}.hint:empty{display:none}.browse{height:var(--jl-control-sm);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-sm);background:var(--jl-surface);font-size:var(--jl-font-xs);cursor:pointer;transition:background var(--jl-fast) var(--jl-ease);align-items:center;margin-top:8px;padding:0 12px;font-weight:600;display:inline-flex}.browse:hover{background:var(--jl-surface-3)}.browse:disabled{cursor:not-allowed;opacity:.5}.refused,.files{margin:8px 0 0;padding:0;list-style:none}.refused{color:var(--jl-danger);font-size:var(--jl-font-sm);gap:4px;line-height:1.45;display:grid}.refusal{align-items:flex-start;gap:6px;display:flex}.refusal jl-icon{margin-top:3px}.refused-name{overflow-wrap:anywhere;font-weight:600}.files{border:1px solid var(--jl-line);border-radius:var(--jl-radius)}.file{align-items:center;gap:10px;min-height:40px;padding:6px 8px 6px 12px;display:flex}.file+.file{border-top:1px solid var(--jl-line)}.file-icon{color:var(--jl-faint)}.file-name{min-width:0;font-size:var(--jl-font-sm);text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.file-size{color:var(--jl-muted);font-family:var(--jl-font-mono);font-size:var(--jl-font-xs);white-space:nowrap}.file-remove{border-radius:var(--jl-radius-xs);width:26px;height:26px;color:var(--jl-faint);cursor:pointer;background:0 0;border:none;flex:none;justify-content:center;align-items:center;padding:0;display:inline-flex}.file-remove:hover{background:var(--jl-surface-3);color:var(--jl-text)}.hint:first-letter{text-transform:uppercase}";
|
|
3
3
|
export { jl_file_drop_default as default };
|
|
@@ -74,6 +74,8 @@ export declare class JlFileDrop extends JlFormControl {
|
|
|
74
74
|
onDisconnect(): void;
|
|
75
75
|
protected resetValue(): void;
|
|
76
76
|
protected setDisabledByForm(disabled: boolean): void;
|
|
77
|
+
/** Disabled by its own input, or by a `<fieldset disabled>` around it. */
|
|
78
|
+
private isOff;
|
|
77
79
|
private canDrop;
|
|
78
80
|
private onDragEnter;
|
|
79
81
|
private onDragOver;
|
|
@@ -96,4 +98,6 @@ export declare class JlFileDrop extends JlFormControl {
|
|
|
96
98
|
private renderFormValue;
|
|
97
99
|
private renderValidity;
|
|
98
100
|
private renderDisabled;
|
|
101
|
+
/** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
|
|
102
|
+
private drawDisabled;
|
|
99
103
|
}
|
|
@@ -84,6 +84,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
84
84
|
};
|
|
85
85
|
_state = {
|
|
86
86
|
depth: 0,
|
|
87
|
+
disabledByForm: false,
|
|
87
88
|
files: [],
|
|
88
89
|
refused: []
|
|
89
90
|
};
|
|
@@ -108,7 +109,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
108
109
|
/** Opens the file chooser. */
|
|
109
110
|
browse() {
|
|
110
111
|
this.whenRendered(() => {
|
|
111
|
-
if (!this.
|
|
112
|
+
if (!this.isOff()) this._refs.picker.click();
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
/**
|
|
@@ -198,12 +199,15 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
198
199
|
this.setFiles([]);
|
|
199
200
|
}
|
|
200
201
|
setDisabledByForm(disabled) {
|
|
201
|
-
this.
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
this._state.disabledByForm = disabled;
|
|
203
|
+
this.whenRendered(() => this.drawDisabled());
|
|
204
|
+
}
|
|
205
|
+
/** Disabled by its own input, or by a `<fieldset disabled>` around it. */
|
|
206
|
+
isOff() {
|
|
207
|
+
return this.disabled.get() || this._state.disabledByForm;
|
|
204
208
|
}
|
|
205
209
|
canDrop(event) {
|
|
206
|
-
return hasFiles(event) && !this.
|
|
210
|
+
return hasFiles(event) && !this.isOff();
|
|
207
211
|
}
|
|
208
212
|
onDragEnter(event) {
|
|
209
213
|
if (!this.canDrop(event)) return;
|
|
@@ -224,7 +228,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
224
228
|
event.preventDefault();
|
|
225
229
|
this._state.depth = 0;
|
|
226
230
|
this.reflect("dragging", false);
|
|
227
|
-
if (this.
|
|
231
|
+
if (this.isOff()) return;
|
|
228
232
|
this.take([...event.dataTransfer?.files ?? []]);
|
|
229
233
|
}
|
|
230
234
|
onPicked() {
|
|
@@ -276,7 +280,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
276
280
|
}
|
|
277
281
|
renderFiles() {
|
|
278
282
|
const files = this._state.files;
|
|
279
|
-
const editable = !this.
|
|
283
|
+
const editable = !this.isOff();
|
|
280
284
|
const locale = pageLocale();
|
|
281
285
|
this._refs.files.hidden = files.length === 0;
|
|
282
286
|
this._refs.files.replaceChildren(...files.map((file, index) => /* @__PURE__ */ jsxs("li", {
|
|
@@ -368,8 +372,12 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
368
372
|
this.internals.setValidity({});
|
|
369
373
|
}
|
|
370
374
|
renderDisabled(disabled) {
|
|
371
|
-
this._refs.browse.disabled = disabled;
|
|
372
375
|
this.reflect("disabled", disabled);
|
|
376
|
+
this.drawDisabled();
|
|
377
|
+
}
|
|
378
|
+
/** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
|
|
379
|
+
drawDisabled() {
|
|
380
|
+
this._refs.browse.disabled = this.isOff();
|
|
373
381
|
this.renderFiles();
|
|
374
382
|
}
|
|
375
383
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jlText } from "../lib/texts.js";
|
|
2
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
3
3
|
import { JlElement } from "../base/jl-element.js";
|
|
4
|
-
import { clampedNumber, jsonOf, oneOf } from "../lib/attributes.js";
|
|
4
|
+
import { clampedNumber, jsonOf, oneOf, stringList } from "../lib/attributes.js";
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
7
|
import { INPUT_TYPES, JlInput } from "../atoms/jl-input.js";
|
|
@@ -20,6 +20,13 @@ registerIcons({
|
|
|
20
20
|
var NO_LIMIT = 0;
|
|
21
21
|
var MAX_LIMIT = 1e3;
|
|
22
22
|
/**
|
|
23
|
+
* Hears a row's control or button for as long as the row lives. `events.register` stops at the element's
|
|
24
|
+
* disconnection, and a list taken out of the page and put back keeps its rows: they heard nothing any more.
|
|
25
|
+
*/
|
|
26
|
+
function hear(element, name, heard) {
|
|
27
|
+
element.addEventListener(name, (event) => heard(event.detail));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
23
30
|
* A field with several values, each in its own row: typed in an input (or a text area when `multiline`), or picked
|
|
24
31
|
* from `options`. People add a row and remove one; `max` caps how many. `values` holds those filled in, in their
|
|
25
32
|
* order, and `change` fires with them. Put it in a `jl-field` for its label, hint and error.
|
|
@@ -30,7 +37,7 @@ var JlInputList = class extends JlElement {
|
|
|
30
37
|
/** The values filled in, in their order; rows left empty are not among them. */
|
|
31
38
|
values = this.useChange([], (values) => this.follow(values), {
|
|
32
39
|
attribute: "values",
|
|
33
|
-
parse:
|
|
40
|
+
parse: stringList
|
|
34
41
|
});
|
|
35
42
|
/** The input of each row: text, a number, a date, a link… */
|
|
36
43
|
type = this.useChange("text", () => this.drawRows(), {
|
|
@@ -133,7 +140,7 @@ var JlInputList = class extends JlElement {
|
|
|
133
140
|
size: "sm",
|
|
134
141
|
icon: "x"
|
|
135
142
|
});
|
|
136
|
-
remove
|
|
143
|
+
hear(remove, "press", () => this.removeRow(index));
|
|
137
144
|
const row = {
|
|
138
145
|
control,
|
|
139
146
|
remove
|
|
@@ -165,13 +172,13 @@ var JlInputList = class extends JlElement {
|
|
|
165
172
|
type: this.type.get(),
|
|
166
173
|
value
|
|
167
174
|
});
|
|
168
|
-
input
|
|
175
|
+
hear(input, "input", onInput);
|
|
169
176
|
return input;
|
|
170
177
|
},
|
|
171
178
|
select: () => {
|
|
172
179
|
const select = /* @__PURE__ */ jsx(JlSelect, { options: this.options.get() });
|
|
173
180
|
select.value.set(value);
|
|
174
|
-
select
|
|
181
|
+
hear(select, "change", onInput);
|
|
175
182
|
return select;
|
|
176
183
|
},
|
|
177
184
|
textarea: () => {
|
|
@@ -179,7 +186,7 @@ var JlInputList = class extends JlElement {
|
|
|
179
186
|
value,
|
|
180
187
|
autosize: true
|
|
181
188
|
});
|
|
182
|
-
area
|
|
189
|
+
hear(area, "input", onInput);
|
|
183
190
|
return area;
|
|
184
191
|
}
|
|
185
192
|
}[this.rowKind()]();
|
|
@@ -61,8 +61,16 @@ export declare class JlLoadState extends JlElement {
|
|
|
61
61
|
* (a refresh), what is shown stays until the new data is there, and stays too if it fails. Resolves to whether it
|
|
62
62
|
* worked: a refresh that fails says so only here, for the page to tell people. A load overtaken by a later one
|
|
63
63
|
* (a search typed on, a poll during a reload) draws nothing and resolves true: the later one decides.
|
|
64
|
+
* @throws What `draw` or `isEmpty` throws: a mistake in the page, not a load that failed.
|
|
64
65
|
*/
|
|
65
66
|
load<Value>(task: LoadTask<Value>): Promise<boolean>;
|
|
67
|
+
/** A first load that failed shows the error; a refresh that failed leaves what is shown. */
|
|
68
|
+
private showFailure;
|
|
69
|
+
/**
|
|
70
|
+
* Draws what was fetched. A `draw` that throws is a mistake in the page: people see the error state, and the
|
|
71
|
+
* exception goes on to the page and its console, where a load that failed would have hidden it.
|
|
72
|
+
*/
|
|
73
|
+
private drawFetched;
|
|
66
74
|
/** Tells the page the state changed: `state`, with the new one. */
|
|
67
75
|
private announceState;
|
|
68
76
|
/** Whether data is shown (the content or the empty state), which a refresh keeps. */
|
|
@@ -91,6 +91,17 @@ function leftLoading(state, signal) {
|
|
|
91
91
|
}
|
|
92
92
|
/** Waits for the components connected meanwhile to run their `onConnect`, a task after connecting. */
|
|
93
93
|
var nextTask = () => new Promise((resolve) => setTimeout(resolve));
|
|
94
|
+
/** Runs a load's fetch. Only its failure is a load that failed: what `draw` throws afterwards is not caught here. */
|
|
95
|
+
async function fetchOf(task) {
|
|
96
|
+
try {
|
|
97
|
+
return {
|
|
98
|
+
failed: false,
|
|
99
|
+
value: await task.fetch()
|
|
100
|
+
};
|
|
101
|
+
} catch {
|
|
102
|
+
return { failed: true };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
94
105
|
/**
|
|
95
106
|
* What a list or a page shows while its data comes: nothing for a moment, then a skeleton shaped like it; then the
|
|
96
107
|
* data (the default slot), what to say when there is none (slot `empty`, a `jl-empty`), or, when it failed, what
|
|
@@ -152,22 +163,37 @@ var JlLoadState = class JlLoadState extends JlElement {
|
|
|
152
163
|
* (a refresh), what is shown stays until the new data is there, and stays too if it fails. Resolves to whether it
|
|
153
164
|
* worked: a refresh that fails says so only here, for the page to tell people. A load overtaken by a later one
|
|
154
165
|
* (a search typed on, a poll during a reload) draws nothing and resolves true: the later one decides.
|
|
166
|
+
* @throws What `draw` or `isEmpty` throws: a mistake in the page, not a load that failed.
|
|
155
167
|
*/
|
|
156
168
|
async load(task) {
|
|
157
169
|
this._work.latest += 1;
|
|
158
170
|
const ticket = this._work.latest;
|
|
159
171
|
this._work.retry = () => this.load(task);
|
|
160
172
|
if (!this.isShowing()) this.state.set("loading");
|
|
173
|
+
const fetched = await fetchOf(task);
|
|
174
|
+
if (ticket !== this._work.latest) return true;
|
|
175
|
+
if (fetched.failed) {
|
|
176
|
+
this.showFailure();
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
this.drawFetched(task, fetched.value);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
/** A first load that failed shows the error; a refresh that failed leaves what is shown. */
|
|
183
|
+
showFailure() {
|
|
184
|
+
if (!this.isShowing()) this.state.set("error");
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Draws what was fetched. A `draw` that throws is a mistake in the page: people see the error state, and the
|
|
188
|
+
* exception goes on to the page and its console, where a load that failed would have hidden it.
|
|
189
|
+
*/
|
|
190
|
+
drawFetched(task, value) {
|
|
161
191
|
try {
|
|
162
|
-
const value = await task.fetch();
|
|
163
|
-
if (ticket !== this._work.latest) return true;
|
|
164
192
|
task.draw(value);
|
|
165
193
|
this.state.set(task.isEmpty?.(value) === true ? "empty" : "ready");
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (!this.isShowing()) this.state.set("error");
|
|
170
|
-
return false;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
this.state.set("error");
|
|
196
|
+
throw error;
|
|
171
197
|
}
|
|
172
198
|
}
|
|
173
199
|
/** Tells the page the state changed: `state`, with the new one. */
|
|
@@ -4,6 +4,8 @@ import type { MenuItem } from '../types/jl-menu.types';
|
|
|
4
4
|
/**
|
|
5
5
|
* A list of actions that opens from its trigger (`slot="trigger"`, any button): on a press or with ArrowDown. Arrows,
|
|
6
6
|
* Home, End and the first letter move through it; Enter chooses, Escape closes. `select` fires with the value.
|
|
7
|
+
* `showAt(x, y)` opens it at a point of the window instead, with no trigger: the menu of a row, where a right click
|
|
8
|
+
* asked for it.
|
|
7
9
|
* Typed by its values, `JlMenu<'edit' | 'delete'>` takes actions of those values and gives `select` one of them:
|
|
8
10
|
* a page handles them with a `Record<'edit' | 'delete', () => void>`, which misses none.
|
|
9
11
|
*/
|
|
@@ -33,6 +35,12 @@ export declare class JlMenu<Value extends string = string> extends JlElement {
|
|
|
33
35
|
private readonly _refs;
|
|
34
36
|
/** Opens the menu and focuses its first item. */
|
|
35
37
|
show(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Opens the menu at a point of the window, such as where the pointer is (`event.clientX`, `event.clientY`), and
|
|
40
|
+
* focuses its first item. It needs no trigger; give it a `label`. The focus goes back to what had it when the menu
|
|
41
|
+
* closes.
|
|
42
|
+
*/
|
|
43
|
+
showAt(x: number, y: number): void;
|
|
36
44
|
hide(): void;
|
|
37
45
|
templateHtml(): Node;
|
|
38
46
|
templateCss(): string;
|
|
@@ -57,11 +65,23 @@ export declare class JlMenu<Value extends string = string> extends JlElement {
|
|
|
57
65
|
private actionOf;
|
|
58
66
|
private onToggle;
|
|
59
67
|
private focusIsInMenu;
|
|
60
|
-
/**
|
|
68
|
+
/**
|
|
69
|
+
* The focus goes back to the trigger, or, for a menu opened at a point, to what had it then. The browser does that
|
|
70
|
+
* for a popover that closes, but not for one in a shadow root.
|
|
71
|
+
*/
|
|
72
|
+
private returnFocus;
|
|
73
|
+
/** Keeps the menu by the trigger while it is open, or puts it at the point it was opened at. */
|
|
61
74
|
private follow;
|
|
62
75
|
private renderTrigger;
|
|
63
76
|
private renderName;
|
|
64
77
|
private renderItems;
|
|
78
|
+
/** The value of the item that holds the focus, when one does. */
|
|
79
|
+
private focusedValue;
|
|
80
|
+
/**
|
|
81
|
+
* Keeps the focus in a list drawn again while it is open: the item that held it is gone, and a focus fallen out of
|
|
82
|
+
* the menu closes it. The item of the same value takes it, else the first one to choose, else the menu.
|
|
83
|
+
*/
|
|
84
|
+
private focusItemOf;
|
|
65
85
|
private section;
|
|
66
86
|
private entry;
|
|
67
87
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BASE_STYLES, FLOATING_STYLES } from "../styles/shared.js";
|
|
2
2
|
import { JlElement } from "../base/jl-element.js";
|
|
3
3
|
import { jsonOf, oneOf } from "../lib/attributes.js";
|
|
4
|
-
import { PLACEMENTS, followAnchor } from "../lib/floating.js";
|
|
4
|
+
import { PLACEMENTS, followAnchor, placeAtPoint } from "../lib/floating.js";
|
|
5
5
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
6
6
|
import { uniqueId } from "../lib/dom.js";
|
|
7
7
|
import { firstIndex, lastIndex, letterIndex, stepIndex } from "../lib/roving.js";
|
|
8
|
-
import { setTriggerAria } from "../lib/trigger.js";
|
|
8
|
+
import { deepActiveElement, setTriggerAria } from "../lib/trigger.js";
|
|
9
9
|
import jl_menu_default from "./jl-menu.css.js";
|
|
10
10
|
import { css } from "@jadis/core";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -44,6 +44,8 @@ var isTypeahead = (event) => event.key.length === 1 && event.key !== " " && !eve
|
|
|
44
44
|
/**
|
|
45
45
|
* A list of actions that opens from its trigger (`slot="trigger"`, any button): on a press or with ArrowDown. Arrows,
|
|
46
46
|
* Home, End and the first letter move through it; Enter chooses, Escape closes. `select` fires with the value.
|
|
47
|
+
* `showAt(x, y)` opens it at a point of the window instead, with no trigger: the menu of a row, where a right click
|
|
48
|
+
* asked for it.
|
|
47
49
|
* Typed by its values, `JlMenu<'edit' | 'delete'>` takes actions of those values and gives `select` one of them:
|
|
48
50
|
* a page handles them with a `Record<'edit' | 'delete', () => void>`, which misses none.
|
|
49
51
|
*/
|
|
@@ -64,6 +66,10 @@ var JlMenu = class extends JlElement {
|
|
|
64
66
|
/** The menu's name for screen readers; the trigger names it otherwise. */
|
|
65
67
|
label = this.useChange("", () => this.renderName(), { attribute: "label" });
|
|
66
68
|
_state = {
|
|
69
|
+
/** The point of the window the menu was opened at, when it was not opened by its trigger. */
|
|
70
|
+
at: void 0,
|
|
71
|
+
/** What had the focus when the menu opened at a point: the focus goes back to it. */
|
|
72
|
+
focusedBefore: null,
|
|
67
73
|
following: new AbortController(),
|
|
68
74
|
openAtPointerDown: false
|
|
69
75
|
};
|
|
@@ -76,6 +82,22 @@ var JlMenu = class extends JlElement {
|
|
|
76
82
|
show() {
|
|
77
83
|
this.whenRendered(() => this.open(firstIndex));
|
|
78
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Opens the menu at a point of the window, such as where the pointer is (`event.clientX`, `event.clientY`), and
|
|
87
|
+
* focuses its first item. It needs no trigger; give it a `label`. The focus goes back to what had it when the menu
|
|
88
|
+
* closes.
|
|
89
|
+
*/
|
|
90
|
+
showAt(x, y) {
|
|
91
|
+
this.whenRendered(() => {
|
|
92
|
+
const focused = deepActiveElement(document);
|
|
93
|
+
this.close();
|
|
94
|
+
this._state.focusedBefore = focused;
|
|
95
|
+
this.open(firstIndex, {
|
|
96
|
+
left: x,
|
|
97
|
+
top: y
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
79
101
|
hide() {
|
|
80
102
|
this.whenRendered(() => this.close());
|
|
81
103
|
}
|
|
@@ -167,7 +189,7 @@ var JlMenu = class extends JlElement {
|
|
|
167
189
|
if (event.key === "Escape") {
|
|
168
190
|
event.preventDefault();
|
|
169
191
|
this.close();
|
|
170
|
-
this.
|
|
192
|
+
this.returnFocus();
|
|
171
193
|
return;
|
|
172
194
|
}
|
|
173
195
|
if (isTypeahead(event)) {
|
|
@@ -175,9 +197,10 @@ var JlMenu = class extends JlElement {
|
|
|
175
197
|
this.focusItem(letterIndex(labels, this.enabledFlags(), from, event.key));
|
|
176
198
|
}
|
|
177
199
|
}
|
|
178
|
-
open(focusFirst) {
|
|
200
|
+
open(focusFirst, at) {
|
|
179
201
|
const menu = this._refs.menu;
|
|
180
202
|
if (!this.isOpen()) {
|
|
203
|
+
this._state.at = at;
|
|
181
204
|
this.renderItems();
|
|
182
205
|
menu.showPopover();
|
|
183
206
|
this.follow();
|
|
@@ -200,7 +223,7 @@ var JlMenu = class extends JlElement {
|
|
|
200
223
|
if (!(item instanceof HTMLElement) || item.hasAttribute("aria-disabled")) return;
|
|
201
224
|
const action = this.actionOf(item);
|
|
202
225
|
this.close();
|
|
203
|
-
this.
|
|
226
|
+
this.returnFocus();
|
|
204
227
|
if (action !== void 0) this.events.emit("select", action.value);
|
|
205
228
|
}
|
|
206
229
|
/** The action an item of the list draws. */
|
|
@@ -216,9 +239,23 @@ var JlMenu = class extends JlElement {
|
|
|
216
239
|
const active = this.shadowRoot?.activeElement ?? null;
|
|
217
240
|
return active !== null && this._refs.menu.contains(active);
|
|
218
241
|
}
|
|
219
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* The focus goes back to the trigger, or, for a menu opened at a point, to what had it then. The browser does that
|
|
244
|
+
* for a popover that closes, but not for one in a shadow root.
|
|
245
|
+
*/
|
|
246
|
+
returnFocus() {
|
|
247
|
+
const { at, focusedBefore } = this._state;
|
|
248
|
+
const back = at === void 0 ? this.triggerElement() : focusedBefore;
|
|
249
|
+
if (back instanceof HTMLElement) back.focus();
|
|
250
|
+
}
|
|
251
|
+
/** Keeps the menu by the trigger while it is open, or puts it at the point it was opened at. */
|
|
220
252
|
follow() {
|
|
221
253
|
this._state.following.abort();
|
|
254
|
+
const { at } = this._state;
|
|
255
|
+
if (this.isOpen() && at !== void 0) {
|
|
256
|
+
placeAtPoint(at, this._refs.menu);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
222
259
|
const trigger = this.triggerElement();
|
|
223
260
|
if (!this.isOpen() || trigger === null) return;
|
|
224
261
|
this._state.following = new AbortController();
|
|
@@ -247,7 +284,22 @@ var JlMenu = class extends JlElement {
|
|
|
247
284
|
const items = this.items.get();
|
|
248
285
|
if (items === this._drawn.items) return;
|
|
249
286
|
this._drawn.items = items;
|
|
287
|
+
const focused = this.focusedValue();
|
|
250
288
|
this._refs.menu.replaceChildren(...sectionsOf(items).map((section) => this.section(section)));
|
|
289
|
+
if (focused !== void 0) this.focusItemOf(focused);
|
|
290
|
+
}
|
|
291
|
+
/** The value of the item that holds the focus, when one does. */
|
|
292
|
+
focusedValue() {
|
|
293
|
+
const active = this.shadowRoot?.activeElement;
|
|
294
|
+
return active instanceof HTMLElement && active.matches(ITEM_SELECTOR) ? active.dataset.value : void 0;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Keeps the focus in a list drawn again while it is open: the item that held it is gone, and a focus fallen out of
|
|
298
|
+
* the menu closes it. The item of the same value takes it, else the first one to choose, else the menu.
|
|
299
|
+
*/
|
|
300
|
+
focusItemOf(value) {
|
|
301
|
+
const items = this.menuItems();
|
|
302
|
+
(items.find((item) => item.dataset.value === value) ?? items[0] ?? this._refs.menu).focus();
|
|
251
303
|
}
|
|
252
304
|
section(section) {
|
|
253
305
|
const entries = section.entries.map((entry) => this.entry(entry));
|
|
@@ -75,6 +75,8 @@ export declare class JlNumberInput extends JlFormControl {
|
|
|
75
75
|
private renderValue;
|
|
76
76
|
private renderBounds;
|
|
77
77
|
private renderDisabled;
|
|
78
|
+
/** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
|
|
79
|
+
private drawDisabled;
|
|
78
80
|
/** A button that cannot move the value further is disabled. */
|
|
79
81
|
private renderButtons;
|
|
80
82
|
protected drawTexts(): void;
|
|
@@ -5,8 +5,8 @@ import { oneOf } from "../lib/attributes.js";
|
|
|
5
5
|
import { registerIcons } from "../lib/icons.js";
|
|
6
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
|
-
import { setOrRemove } from "../lib/dom.js";
|
|
9
|
-
import { clamp, parseNumber, stepValue } from "../lib/numeric.js";
|
|
8
|
+
import { setAriaFlag, setOrRemove } from "../lib/dom.js";
|
|
9
|
+
import { clamp, parseNumber, parseTypedNumber, stepValue } from "../lib/numeric.js";
|
|
10
10
|
import jl_number_input_default from "./jl-number-input.css.js";
|
|
11
11
|
import { css } from "@jadis/core";
|
|
12
12
|
import { Minus, Plus } from "lucide";
|
|
@@ -55,7 +55,7 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
55
55
|
parse: oneOf(CONTROL_SIZES, "md")
|
|
56
56
|
});
|
|
57
57
|
required = this.useChange(false, (value) => {
|
|
58
|
-
this._refs.native
|
|
58
|
+
setAriaFlag(this._refs.native, "aria-required", value);
|
|
59
59
|
this.reflect("required", value);
|
|
60
60
|
this.renderValidity();
|
|
61
61
|
}, { attribute: "required" });
|
|
@@ -63,7 +63,7 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
63
63
|
/** Draws the field in the danger colour, for an error the page found itself. */
|
|
64
64
|
invalid = this.useChange(false, (value) => {
|
|
65
65
|
this.reflect("invalid", value);
|
|
66
|
-
this._refs.native
|
|
66
|
+
setAriaFlag(this._refs.native, "aria-invalid", value);
|
|
67
67
|
}, { attribute: "invalid" });
|
|
68
68
|
_state = { disabledByForm: false };
|
|
69
69
|
_refs = this.useRefs((ref) => ({
|
|
@@ -132,7 +132,7 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
132
132
|
/** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
|
|
133
133
|
setDisabledByForm(disabled) {
|
|
134
134
|
this._state.disabledByForm = disabled;
|
|
135
|
-
this.whenRendered(() => this.
|
|
135
|
+
this.whenRendered(() => this.drawDisabled());
|
|
136
136
|
}
|
|
137
137
|
onKey(event) {
|
|
138
138
|
const action = (/* @__PURE__ */ new Map([
|
|
@@ -159,7 +159,7 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
159
159
|
/** The number typed so far, or the value when the text cannot be read. */
|
|
160
160
|
typedNumber() {
|
|
161
161
|
const text = this._refs.native.value;
|
|
162
|
-
return text.trim() === "" ? null :
|
|
162
|
+
return text.trim() === "" ? null : parseTypedNumber(text) ?? this.value.get();
|
|
163
163
|
}
|
|
164
164
|
/** Reads what was typed: empty gives null, unreadable text goes back to the value, a number is kept in bounds. */
|
|
165
165
|
commitText() {
|
|
@@ -168,7 +168,7 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
168
168
|
this.commit(null);
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
|
-
const typed =
|
|
171
|
+
const typed = parseTypedNumber(text);
|
|
172
172
|
if (typed === null) {
|
|
173
173
|
this.renderValue(this.value.get());
|
|
174
174
|
return;
|
|
@@ -197,8 +197,12 @@ var JlNumberInput = class extends JlFormControl {
|
|
|
197
197
|
this.renderButtons();
|
|
198
198
|
}
|
|
199
199
|
renderDisabled(disabled) {
|
|
200
|
-
this._refs.native.disabled = disabled || this._state.disabledByForm;
|
|
201
200
|
this.reflect("disabled", disabled);
|
|
201
|
+
this.drawDisabled();
|
|
202
|
+
}
|
|
203
|
+
/** Without the attribute: the form says its state before the `disabled` input has taken the attribute's change. */
|
|
204
|
+
drawDisabled() {
|
|
205
|
+
this._refs.native.disabled = this.disabled.get() || this._state.disabledByForm;
|
|
202
206
|
this.renderButtons();
|
|
203
207
|
}
|
|
204
208
|
/** A button that cannot move the value further is disabled. */
|