@syware/jlib 0.8.0 → 0.9.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 +2 -1
- package/dist/all.js +2 -2
- package/dist/atoms/jl-chip.d.ts +1 -0
- package/dist/atoms/jl-chip.js +4 -2
- package/dist/atoms/jl-input.d.ts +2 -0
- package/dist/atoms/jl-input.js +9 -3
- package/dist/atoms/jl-rating.d.ts +2 -0
- package/dist/atoms/jl-rating.js +13 -5
- package/dist/atoms/jl-spinner.d.ts +2 -0
- package/dist/atoms/jl-spinner.js +6 -2
- package/dist/base/jl-element.d.ts +6 -0
- package/dist/base/jl-element.js +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/lib/texts-de.d.ts +108 -0
- package/dist/lib/texts-de.js +111 -0
- package/dist/lib/texts-fr.d.ts +108 -0
- package/dist/lib/texts-fr.js +111 -0
- package/dist/lib/texts.d.ts +177 -91
- package/dist/lib/texts.js +174 -9
- package/dist/molecules/jl-alert.d.ts +1 -0
- package/dist/molecules/jl-alert.js +4 -2
- package/dist/molecules/jl-breadcrumb.d.ts +2 -0
- package/dist/molecules/jl-breadcrumb.js +12 -6
- package/dist/molecules/jl-calendar.d.ts +1 -0
- package/dist/molecules/jl-calendar.js +7 -4
- package/dist/molecules/jl-chip-group.d.ts +1 -0
- package/dist/molecules/jl-chip-group.js +4 -1
- package/dist/molecules/jl-code-block.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +3 -1
- package/dist/molecules/jl-combobox.js +12 -7
- package/dist/molecules/jl-copy-button.d.ts +1 -0
- package/dist/molecules/jl-copy-button.js +7 -5
- package/dist/molecules/jl-date-picker.d.ts +1 -0
- package/dist/molecules/jl-date-picker.js +10 -7
- package/dist/molecules/jl-file-drop.d.ts +1 -0
- package/dist/molecules/jl-file-drop.js +15 -6
- package/dist/molecules/jl-input-list.d.ts +3 -2
- package/dist/molecules/jl-input-list.js +10 -7
- package/dist/molecules/jl-load-more.d.ts +4 -2
- package/dist/molecules/jl-load-more.js +15 -8
- package/dist/molecules/jl-load-state.d.ts +4 -0
- package/dist/molecules/jl-load-state.js +13 -9
- package/dist/molecules/jl-number-input.d.ts +1 -0
- package/dist/molecules/jl-number-input.js +6 -3
- package/dist/molecules/jl-pagination.d.ts +2 -0
- package/dist/molecules/jl-pagination.js +17 -9
- package/dist/molecules/jl-radio-group.d.ts +1 -0
- package/dist/molecules/jl-radio-group.js +4 -1
- package/dist/molecules/jl-search-button.d.ts +2 -1
- package/dist/molecules/jl-search-button.js +6 -4
- package/dist/molecules/jl-search.d.ts +2 -0
- package/dist/molecules/jl-search.js +9 -3
- package/dist/molecules/jl-steps.d.ts +2 -0
- package/dist/molecules/jl-steps.js +9 -4
- package/dist/molecules/jl-tag-input.d.ts +1 -0
- package/dist/molecules/jl-tag-input.js +8 -4
- package/dist/molecules/jl-toast.d.ts +1 -0
- package/dist/molecules/jl-toast.js +4 -2
- package/dist/organisms/jl-command-palette.d.ts +3 -1
- package/dist/organisms/jl-command-palette.js +13 -11
- package/dist/organisms/jl-confirm.d.ts +3 -0
- package/dist/organisms/jl-confirm.js +12 -11
- package/dist/organisms/jl-dialog.d.ts +1 -0
- package/dist/organisms/jl-dialog.js +4 -2
- package/dist/organisms/jl-drawer.d.ts +1 -0
- package/dist/organisms/jl-drawer.js +4 -2
- package/dist/organisms/jl-flow.d.ts +2 -0
- package/dist/organisms/jl-flow.js +25 -16
- package/dist/organisms/jl-navbar.d.ts +3 -0
- package/dist/organisms/jl-navbar.js +16 -7
- package/dist/organisms/jl-side-nav.d.ts +4 -2
- package/dist/organisms/jl-side-nav.js +17 -11
- package/dist/organisms/jl-tab-bar.d.ts +1 -0
- package/dist/organisms/jl-tab-bar.js +5 -2
- package/dist/organisms/jl-table.d.ts +2 -1
- package/dist/organisms/jl-table.js +9 -6
- package/dist/organisms/jl-toaster.d.ts +2 -1
- package/dist/organisms/jl-toaster.js +12 -9
- package/dist/organisms/jl-tree.d.ts +6 -4
- package/dist/organisms/jl-tree.js +21 -15
- package/dist/templates/jl-app-shell.d.ts +1 -0
- package/dist/templates/jl-app-shell.js +4 -2
- package/dist/templates/jl-auth-layout.d.ts +4 -3
- package/dist/templates/jl-auth-layout.js +13 -11
- package/dist/templates/jl-page.d.ts +1 -0
- package/dist/templates/jl-page.js +4 -1
- package/dist/templates/jl-split-view.d.ts +1 -0
- package/dist/templates/jl-split-view.js +5 -4
- package/dist/types/texts.types.d.ts +29 -4
- package/package.json +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { TONES, TONE_ICONS, TONE_ICON_FILLED } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
8
|
import { hasSlotted } from "../lib/slots.js";
|
|
9
9
|
import { JlButton } from "../atoms/jl-button.js";
|
|
@@ -116,7 +116,6 @@ var JlAlert = class extends JlElement {
|
|
|
116
116
|
class: "close",
|
|
117
117
|
variant: "ghost",
|
|
118
118
|
icon: "x",
|
|
119
|
-
hint: jlText("dismiss"),
|
|
120
119
|
size: "sm",
|
|
121
120
|
hidden: true
|
|
122
121
|
})
|
|
@@ -126,6 +125,9 @@ var JlAlert = class extends JlElement {
|
|
|
126
125
|
templateCss() {
|
|
127
126
|
return css`${BASE_STYLES}${jl_alert_default}`;
|
|
128
127
|
}
|
|
128
|
+
drawTexts() {
|
|
129
|
+
this._refs.close.hint.set(jlText("dismiss"));
|
|
130
|
+
}
|
|
129
131
|
onConnect() {
|
|
130
132
|
this._refs.close.events.register("press", () => this.dismiss());
|
|
131
133
|
this.renderSlots();
|
|
@@ -25,6 +25,8 @@ export declare class JlBreadcrumb extends JlElement {
|
|
|
25
25
|
templateHtml(): Node;
|
|
26
26
|
templateCss(): string;
|
|
27
27
|
onConnect(): void;
|
|
28
|
+
protected drawTexts(): void;
|
|
29
|
+
private renderLabel;
|
|
28
30
|
/** A new trail starts folded. */
|
|
29
31
|
private renderTrail;
|
|
30
32
|
private render;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { jsonOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
7
7
|
import jl_breadcrumb_default from "./jl-breadcrumb.css_raw.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
@@ -43,9 +43,7 @@ var JlBreadcrumb = class extends JlElement {
|
|
|
43
43
|
/** The most items shown before the middle folds; 0 never folds. */
|
|
44
44
|
max = this.useChange(0, () => this.render(), { attribute: "max" });
|
|
45
45
|
/** The trail's name for screen readers. */
|
|
46
|
-
label = this.useChange(
|
|
47
|
-
this._refs.nav.setAttribute("aria-label", value || jlText("breadcrumb"));
|
|
48
|
-
}, { attribute: "label" });
|
|
46
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
49
47
|
_state = { expanded: false };
|
|
50
48
|
_refs = this.useRefs((ref) => ({
|
|
51
49
|
list: ref("ol"),
|
|
@@ -65,6 +63,13 @@ var JlBreadcrumb = class extends JlElement {
|
|
|
65
63
|
if (event.target.closest(".more") !== null) this.expand();
|
|
66
64
|
});
|
|
67
65
|
}
|
|
66
|
+
drawTexts() {
|
|
67
|
+
this.renderLabel();
|
|
68
|
+
this.render();
|
|
69
|
+
}
|
|
70
|
+
renderLabel() {
|
|
71
|
+
this._refs.nav.setAttribute("aria-label", this.label.get() || jlText("breadcrumb"));
|
|
72
|
+
}
|
|
68
73
|
/** A new trail starts folded. */
|
|
69
74
|
renderTrail() {
|
|
70
75
|
this._state.expanded = false;
|
|
@@ -104,11 +109,12 @@ var JlBreadcrumb = class extends JlElement {
|
|
|
104
109
|
});
|
|
105
110
|
}
|
|
106
111
|
moreButton(hidden) {
|
|
112
|
+
const label = jlText("showMoreCount", { count: hidden });
|
|
107
113
|
return /* @__PURE__ */ jsx("button", {
|
|
108
114
|
type: "button",
|
|
109
115
|
class: "more",
|
|
110
|
-
"aria-label":
|
|
111
|
-
title:
|
|
116
|
+
"aria-label": label,
|
|
117
|
+
title: label,
|
|
112
118
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
113
119
|
name: "ellipsis",
|
|
114
120
|
size: ICON_SIZE
|
|
@@ -70,6 +70,7 @@ export declare class JlCalendar extends JlFormControl {
|
|
|
70
70
|
showMonth(iso: string): void;
|
|
71
71
|
templateHtml(): Node;
|
|
72
72
|
templateCss(): string;
|
|
73
|
+
protected drawTexts(): void;
|
|
73
74
|
onConnect(): void;
|
|
74
75
|
protected resetValue(): void;
|
|
75
76
|
protected setDisabledByForm(disabled: boolean): void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { jlText } from "../lib/texts.js";
|
|
1
3
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
4
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
5
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
6
|
import { registerIcons } from "../lib/icons.js";
|
|
5
7
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
8
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
9
|
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
9
10
|
import { addMonths, calendarDateOf, clampDate, dateAfterKey, dateFormatter, formatMonthTitle, isSameDate, isSameMonth, isWithin, monthGrid, monthHasDaysWithin, parseIsoDate, toIsoDate, weekdayNames } from "../lib/calendar.js";
|
|
10
|
-
import { pageLocale } from "../lib/locale.js";
|
|
11
11
|
import jl_calendar_default from "./jl-calendar.css_raw.js";
|
|
12
12
|
import { css } from "@jadis/core";
|
|
13
13
|
import { ChevronLeft, ChevronRight } from "lucide";
|
|
@@ -95,7 +95,6 @@ var JlCalendar = class extends JlFormControl {
|
|
|
95
95
|
/* @__PURE__ */ jsx("button", {
|
|
96
96
|
class: "nav previous",
|
|
97
97
|
type: "button",
|
|
98
|
-
"aria-label": jlText("previousMonth"),
|
|
99
98
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
100
99
|
name: "chevron-left",
|
|
101
100
|
size: NAV_ICON_SIZE
|
|
@@ -109,7 +108,6 @@ var JlCalendar = class extends JlFormControl {
|
|
|
109
108
|
/* @__PURE__ */ jsx("button", {
|
|
110
109
|
class: "nav next",
|
|
111
110
|
type: "button",
|
|
112
|
-
"aria-label": jlText("nextMonth"),
|
|
113
111
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
114
112
|
name: "chevron-right",
|
|
115
113
|
size: NAV_ICON_SIZE
|
|
@@ -125,6 +123,11 @@ var JlCalendar = class extends JlFormControl {
|
|
|
125
123
|
templateCss() {
|
|
126
124
|
return css`${BASE_STYLES}${jl_calendar_default}`;
|
|
127
125
|
}
|
|
126
|
+
drawTexts() {
|
|
127
|
+
this._refs.previous.setAttribute("aria-label", jlText("previousMonth"));
|
|
128
|
+
this._refs.next.setAttribute("aria-label", jlText("nextMonth"));
|
|
129
|
+
this.renderValidity();
|
|
130
|
+
}
|
|
128
131
|
onConnect() {
|
|
129
132
|
this.on(this._refs.previous, "click", () => this.turnPage(-1));
|
|
130
133
|
this.on(this._refs.next, "click", () => this.turnPage(1));
|
|
@@ -78,5 +78,6 @@ export declare class JlChipGroup<Value extends string = string> extends JlFormCo
|
|
|
78
78
|
private renderTabStop;
|
|
79
79
|
/** One choice gives one entry; several give one entry each under the field's name, as checkboxes would. */
|
|
80
80
|
private renderFormValue;
|
|
81
|
+
protected drawTexts(): void;
|
|
81
82
|
private renderValidity;
|
|
82
83
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
4
|
import { jsonOf, oneOf, textListOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
8
|
import { setOrRemove } from "../lib/dom.js";
|
|
9
9
|
import { rovingIndex } from "../lib/roving-index.js";
|
|
@@ -249,6 +249,9 @@ var JlChipGroup = class extends JlFormControl {
|
|
|
249
249
|
for (const value of chosen) data.append(name, value);
|
|
250
250
|
this.internals.setFormValue(data);
|
|
251
251
|
}
|
|
252
|
+
drawTexts() {
|
|
253
|
+
this.renderValidity();
|
|
254
|
+
}
|
|
252
255
|
renderValidity() {
|
|
253
256
|
if (!(this.required.get() && this.chosen().length === 0)) {
|
|
254
257
|
this.internals.setValidity({});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { dedent } from "../lib/text.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { oneOf } from "../lib/attributes.js";
|
|
4
|
-
import { dedent } from "../lib/text.js";
|
|
5
5
|
import { cssLength } from "../lib/css-length.js";
|
|
6
6
|
import { highlightedNodes } from "../lib/highlight.js";
|
|
7
7
|
import jl_code_block_default from "./jl-code-block.css_raw.js";
|
|
@@ -40,7 +40,7 @@ export declare class JlCombobox extends JlFormControl {
|
|
|
40
40
|
get(): boolean;
|
|
41
41
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
42
42
|
}>>;
|
|
43
|
-
/** What the list says when no option matches. */
|
|
43
|
+
/** What the list says when no option matches; jlib's own when empty. */
|
|
44
44
|
readonly emptyText: Readonly<Readonly<{
|
|
45
45
|
get(): string;
|
|
46
46
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -72,6 +72,8 @@ export declare class JlCombobox extends JlFormControl {
|
|
|
72
72
|
onDisconnect(): void;
|
|
73
73
|
protected resetValue(): void;
|
|
74
74
|
protected setDisabledByForm(disabled: boolean): void;
|
|
75
|
+
protected drawTexts(): void;
|
|
76
|
+
private renderEmptyText;
|
|
75
77
|
private isOpen;
|
|
76
78
|
private onType;
|
|
77
79
|
private onKey;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
4
|
import { jsonOf, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { followAnchor } from "../lib/floating.js";
|
|
5
6
|
import { registerIcons } from "../lib/icons.js";
|
|
6
7
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
7
|
-
import { jlText } from "../lib/texts.js";
|
|
8
8
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
9
9
|
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
10
10
|
import { keepInView } from "../lib/keep-in-view.js";
|
|
@@ -55,10 +55,8 @@ var JlCombobox = class extends JlFormControl {
|
|
|
55
55
|
allowCustom = this.useChange(false, () => this.renderValue(), { attribute: "allow-custom" });
|
|
56
56
|
/** Shows a button that empties the field while it holds text. */
|
|
57
57
|
clearable = this.useChange(false, () => this.renderClear(), { attribute: "clearable" });
|
|
58
|
-
/** What the list says when no option matches. */
|
|
59
|
-
emptyText = this.useChange(
|
|
60
|
-
this._refs.empty.textContent = value;
|
|
61
|
-
}, { attribute: "empty-text" });
|
|
58
|
+
/** What the list says when no option matches; jlib's own when empty. */
|
|
59
|
+
emptyText = this.useChange("", () => this.renderEmptyText(), { attribute: "empty-text" });
|
|
62
60
|
required = this.useChange(false, (value) => {
|
|
63
61
|
this._refs.native.toggleAttribute("aria-required", value);
|
|
64
62
|
this.reflect("required", value);
|
|
@@ -111,7 +109,6 @@ var JlCombobox = class extends JlFormControl {
|
|
|
111
109
|
/* @__PURE__ */ jsx("button", {
|
|
112
110
|
class: "action clear",
|
|
113
111
|
type: "button",
|
|
114
|
-
"aria-label": jlText("clear"),
|
|
115
112
|
tabIndex: -1,
|
|
116
113
|
hidden: true,
|
|
117
114
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
@@ -122,7 +119,6 @@ var JlCombobox = class extends JlFormControl {
|
|
|
122
119
|
/* @__PURE__ */ jsx("button", {
|
|
123
120
|
class: "action toggle",
|
|
124
121
|
type: "button",
|
|
125
|
-
"aria-label": jlText("showOptions"),
|
|
126
122
|
tabIndex: -1,
|
|
127
123
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
128
124
|
name: "chevron-down",
|
|
@@ -178,6 +174,15 @@ var JlCombobox = class extends JlFormControl {
|
|
|
178
174
|
this._refs.native.disabled = disabled || this.disabled.get();
|
|
179
175
|
});
|
|
180
176
|
}
|
|
177
|
+
drawTexts() {
|
|
178
|
+
this._refs.clear.setAttribute("aria-label", jlText("clear"));
|
|
179
|
+
this._refs.toggle.setAttribute("aria-label", jlText("showOptions"));
|
|
180
|
+
this.renderEmptyText();
|
|
181
|
+
this.renderValidity();
|
|
182
|
+
}
|
|
183
|
+
renderEmptyText() {
|
|
184
|
+
this._refs.empty.textContent = this.emptyText.get() || jlText("noResults");
|
|
185
|
+
}
|
|
181
186
|
isOpen() {
|
|
182
187
|
return this._refs.popup.matches(":popover-open");
|
|
183
188
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { JlButton } from "../atoms/jl-button.js";
|
|
8
8
|
import jl_copy_button_default from "./jl-copy-button.css_raw.js";
|
|
9
9
|
import { css } from "@jadis/core";
|
|
@@ -33,8 +33,7 @@ var JlCopyButton = class extends JlElement {
|
|
|
33
33
|
templateHtml() {
|
|
34
34
|
return /* @__PURE__ */ jsx(JlButton, {
|
|
35
35
|
variant: "ghost",
|
|
36
|
-
icon: COPY_ICON
|
|
37
|
-
hint: jlText("copy")
|
|
36
|
+
icon: COPY_ICON
|
|
38
37
|
});
|
|
39
38
|
}
|
|
40
39
|
templateCss() {
|
|
@@ -53,16 +52,19 @@ var JlCopyButton = class extends JlElement {
|
|
|
53
52
|
this.events.emit("copy", text);
|
|
54
53
|
this.confirm();
|
|
55
54
|
}
|
|
55
|
+
drawTexts() {
|
|
56
|
+
this._refs.button.hint.set(jlText(this.hasAttribute("copied") ? "copied" : "copy"));
|
|
57
|
+
}
|
|
56
58
|
confirm() {
|
|
57
59
|
const button = this._refs.button;
|
|
58
60
|
button.icon.set(DONE_ICON);
|
|
59
|
-
button.hint.set(jlText("copied"));
|
|
60
61
|
this.reflect("copied", true);
|
|
62
|
+
this.drawTexts();
|
|
61
63
|
window.clearTimeout(this._timer.id);
|
|
62
64
|
this._timer.id = window.setTimeout(() => {
|
|
63
65
|
button.icon.set(COPY_ICON);
|
|
64
|
-
button.hint.set(jlText("copy"));
|
|
65
66
|
this.reflect("copied", false);
|
|
67
|
+
this.drawTexts();
|
|
66
68
|
}, CONFIRM_MS);
|
|
67
69
|
}
|
|
68
70
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { jlText } from "../lib/texts.js";
|
|
1
3
|
import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES } from "../styles/shared.js";
|
|
2
4
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
5
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
6
|
import { followAnchor } from "../lib/floating.js";
|
|
5
7
|
import { registerIcons } from "../lib/icons.js";
|
|
6
8
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
7
|
-
import { jlText } from "../lib/texts.js";
|
|
8
9
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
9
10
|
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
10
11
|
import { NUMERIC_DATE, compareDates, dateOrder, datePattern, formatDate, isDateText, parseIsoDate, parseTypedDate, toIsoDate } from "../lib/calendar.js";
|
|
11
|
-
import { pageLocale } from "../lib/locale.js";
|
|
12
12
|
import { JlCalendar } from "./jl-calendar.js";
|
|
13
13
|
import jl_date_picker_default from "./jl-date-picker.css_raw.js";
|
|
14
14
|
import { css } from "@jadis/core";
|
|
@@ -116,7 +116,6 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
116
116
|
/* @__PURE__ */ jsx("button", {
|
|
117
117
|
class: "action clear",
|
|
118
118
|
type: "button",
|
|
119
|
-
"aria-label": jlText("clear"),
|
|
120
119
|
tabIndex: -1,
|
|
121
120
|
hidden: true,
|
|
122
121
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
@@ -127,7 +126,6 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
127
126
|
/* @__PURE__ */ jsx("button", {
|
|
128
127
|
class: "action open",
|
|
129
128
|
type: "button",
|
|
130
|
-
"aria-label": jlText("chooseDate"),
|
|
131
129
|
"aria-haspopup": "dialog",
|
|
132
130
|
"aria-expanded": "false",
|
|
133
131
|
"aria-controls": this._popupId,
|
|
@@ -142,7 +140,6 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
142
140
|
id: this._popupId,
|
|
143
141
|
popover: "auto",
|
|
144
142
|
role: "dialog",
|
|
145
|
-
"aria-label": jlText("chooseDate"),
|
|
146
143
|
attrs: { part: "popup" },
|
|
147
144
|
children: /* @__PURE__ */ jsx(JlCalendar, { class: "calendar" })
|
|
148
145
|
})] });
|
|
@@ -150,6 +147,12 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
150
147
|
templateCss() {
|
|
151
148
|
return css`${BASE_STYLES}${CONTROL_STYLES}${FLOATING_STYLES}${jl_date_picker_default}`;
|
|
152
149
|
}
|
|
150
|
+
drawTexts() {
|
|
151
|
+
this._refs.clear.setAttribute("aria-label", jlText("clear"));
|
|
152
|
+
this._refs.open.setAttribute("aria-label", jlText("chooseDate"));
|
|
153
|
+
this._refs.popup.setAttribute("aria-label", jlText("chooseDate"));
|
|
154
|
+
this.renderValidity();
|
|
155
|
+
}
|
|
153
156
|
onConnect() {
|
|
154
157
|
const native = this._refs.native;
|
|
155
158
|
const open = this._refs.open;
|
|
@@ -302,11 +305,11 @@ var JlDatePicker = class extends JlFormControl {
|
|
|
302
305
|
const max = parseIsoDate(this.max.get());
|
|
303
306
|
const locale = pageLocale(this.locale.get());
|
|
304
307
|
if (min !== null && compareDates(date, min) < 0) {
|
|
305
|
-
this.internals.setValidity({ rangeUnderflow: true },
|
|
308
|
+
this.internals.setValidity({ rangeUnderflow: true }, jlText("chooseDateFrom", { date: formatDate(min, locale) }), anchor);
|
|
306
309
|
return;
|
|
307
310
|
}
|
|
308
311
|
if (max !== null && compareDates(date, max) > 0) {
|
|
309
|
-
this.internals.setValidity({ rangeOverflow: true },
|
|
312
|
+
this.internals.setValidity({ rangeOverflow: true }, jlText("chooseDateUntil", { date: formatDate(max, locale) }), anchor);
|
|
310
313
|
return;
|
|
311
314
|
}
|
|
312
315
|
this.internals.setValidity({});
|
|
@@ -88,6 +88,7 @@ export declare class JlFileDrop extends JlFormControl {
|
|
|
88
88
|
private setFiles;
|
|
89
89
|
private renderFiles;
|
|
90
90
|
private renderRefused;
|
|
91
|
+
protected drawTexts(): void;
|
|
91
92
|
private renderText;
|
|
92
93
|
/** What it takes, under the text: `PNG, JPG · up to 5 MB`. */
|
|
93
94
|
private renderHint;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { jlText } from "../lib/texts.js";
|
|
1
3
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
4
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
5
|
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
6
|
import { registerIcons } from "../lib/icons.js";
|
|
5
7
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
8
|
import { JlIcon } from "../atoms/jl-icon.js";
|
|
8
9
|
import { setOrRemove, uniqueId } from "../lib/dom.js";
|
|
9
|
-
import { pageLocale } from "../lib/locale.js";
|
|
10
10
|
import { checkFiles, describeAccept, formatFileSize, isSameFile } from "../lib/files.js";
|
|
11
11
|
import jl_file_drop_default from "./jl-file-drop.css_raw.js";
|
|
12
12
|
import { css } from "@jadis/core";
|
|
@@ -84,7 +84,8 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
84
84
|
};
|
|
85
85
|
_state = {
|
|
86
86
|
depth: 0,
|
|
87
|
-
files: []
|
|
87
|
+
files: [],
|
|
88
|
+
refused: []
|
|
88
89
|
};
|
|
89
90
|
_nameWatch = new MutationObserver(() => this.renderFormValue());
|
|
90
91
|
_refs = this.useRefs((ref) => ({
|
|
@@ -150,8 +151,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
150
151
|
/* @__PURE__ */ jsx("button", {
|
|
151
152
|
class: "browse",
|
|
152
153
|
type: "button",
|
|
153
|
-
"aria-describedby": this._ids.hint
|
|
154
|
-
children: jlText("browse")
|
|
154
|
+
"aria-describedby": this._ids.hint
|
|
155
155
|
})
|
|
156
156
|
]
|
|
157
157
|
}),
|
|
@@ -168,7 +168,6 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
168
168
|
}),
|
|
169
169
|
/* @__PURE__ */ jsx("ul", {
|
|
170
170
|
class: "files",
|
|
171
|
-
"aria-label": jlText("chosenFiles"),
|
|
172
171
|
hidden: true
|
|
173
172
|
})
|
|
174
173
|
] });
|
|
@@ -311,6 +310,7 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
311
310
|
})));
|
|
312
311
|
}
|
|
313
312
|
renderRefused(refused) {
|
|
313
|
+
this._state.refused = refused;
|
|
314
314
|
const rules = this.rules();
|
|
315
315
|
this._refs.refused.hidden = refused.length === 0;
|
|
316
316
|
this._refs.refused.replaceChildren(...refused.map(({ file, reason }) => /* @__PURE__ */ jsxs("li", {
|
|
@@ -328,6 +328,15 @@ var JlFileDrop = class extends JlFormControl {
|
|
|
328
328
|
] })]
|
|
329
329
|
})));
|
|
330
330
|
}
|
|
331
|
+
drawTexts() {
|
|
332
|
+
this._refs.browse.textContent = jlText("browse");
|
|
333
|
+
this._refs.files.setAttribute("aria-label", jlText("chosenFiles"));
|
|
334
|
+
this.renderText();
|
|
335
|
+
this.renderHint();
|
|
336
|
+
this.renderFiles();
|
|
337
|
+
this.renderRefused(this._state.refused);
|
|
338
|
+
this.renderValidity();
|
|
339
|
+
}
|
|
331
340
|
renderText() {
|
|
332
341
|
const text = this.text.get();
|
|
333
342
|
const fallback = jlText(this.multiple.get() ? "dropFiles" : "dropFile");
|
|
@@ -49,12 +49,12 @@ export declare class JlInputList extends JlElement {
|
|
|
49
49
|
get(): boolean;
|
|
50
50
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
51
51
|
}>>;
|
|
52
|
-
/** The add button's text. */
|
|
52
|
+
/** The add button's text; jlib's own when empty. */
|
|
53
53
|
readonly addLabel: Readonly<Readonly<{
|
|
54
54
|
get(): string;
|
|
55
55
|
set(setter: string | ((prevState: string) => string)): void;
|
|
56
56
|
}>>;
|
|
57
|
-
/** The text a screen reader says for each row's remove button. */
|
|
57
|
+
/** The text a screen reader says for each row's remove button; jlib's own when empty. */
|
|
58
58
|
readonly removeLabel: Readonly<Readonly<{
|
|
59
59
|
get(): string;
|
|
60
60
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -66,6 +66,7 @@ export declare class JlInputList extends JlElement {
|
|
|
66
66
|
onConnect(): void;
|
|
67
67
|
/** Values set from outside start the rows again; those the rows themselves gave change nothing. */
|
|
68
68
|
private follow;
|
|
69
|
+
protected drawTexts(): void;
|
|
69
70
|
private renderRows;
|
|
70
71
|
private renderAdd;
|
|
71
72
|
private renderDisabled;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlElement } from "../base/jl-element.js";
|
|
3
4
|
import { clampedNumber, jsonOf, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
7
7
|
import { INPUT_TYPES, JlInput } from "../atoms/jl-input.js";
|
|
8
8
|
import { JlSelect } from "../atoms/jl-select.js";
|
|
@@ -53,10 +53,10 @@ var JlInputList = class extends JlElement {
|
|
|
53
53
|
/** The name of each row for screen readers: the field's label. */
|
|
54
54
|
label = this.useChange("", () => this.renderRows(), { attribute: "label" });
|
|
55
55
|
disabled = this.useChange(false, (value) => this.renderDisabled(value), { attribute: "disabled" });
|
|
56
|
-
/** The add button's text. */
|
|
57
|
-
addLabel = this.useChange(
|
|
58
|
-
/** The text a screen reader says for each row's remove button. */
|
|
59
|
-
removeLabel = this.useChange(
|
|
56
|
+
/** The add button's text; jlib's own when empty. */
|
|
57
|
+
addLabel = this.useChange("", () => this.renderAdd(), { attribute: "add-label" });
|
|
58
|
+
/** The text a screen reader says for each row's remove button; jlib's own when empty. */
|
|
59
|
+
removeLabel = this.useChange("", () => this.renderRows(), { attribute: "remove-label" });
|
|
60
60
|
_state = { rows: [""] };
|
|
61
61
|
_refs = this.useRefs((ref) => ({
|
|
62
62
|
add: ref(".add"),
|
|
@@ -86,13 +86,16 @@ var JlInputList = class extends JlElement {
|
|
|
86
86
|
this._state.rows = rowsOf(values);
|
|
87
87
|
this.renderRows();
|
|
88
88
|
}
|
|
89
|
+
drawTexts() {
|
|
90
|
+
this.renderRows();
|
|
91
|
+
}
|
|
89
92
|
renderRows() {
|
|
90
93
|
this._refs.rows.replaceChildren(...this._state.rows.map((value, index) => this.row(value, index)));
|
|
91
94
|
this.renderAdd();
|
|
92
95
|
}
|
|
93
96
|
renderAdd() {
|
|
94
97
|
const add = this._refs.add;
|
|
95
|
-
add.label.set(this.addLabel.get());
|
|
98
|
+
add.label.set(this.addLabel.get() || jlText("addValue"));
|
|
96
99
|
add.hidden = this.disabled.get() || !canAddRow(this._state.rows.length, this.max.get());
|
|
97
100
|
}
|
|
98
101
|
renderDisabled(disabled) {
|
|
@@ -106,7 +109,7 @@ var JlInputList = class extends JlElement {
|
|
|
106
109
|
variant: "ghost",
|
|
107
110
|
size: "sm",
|
|
108
111
|
icon: "x",
|
|
109
|
-
hint: this.removeLabel.get()
|
|
112
|
+
hint: this.removeLabel.get() || jlText("removeValue")
|
|
110
113
|
});
|
|
111
114
|
remove.events.register("press", () => this.removeRow(index));
|
|
112
115
|
remove.hidden = this.disabled.get() || this._state.rows.length === 1;
|
|
@@ -23,12 +23,12 @@ export declare class JlLoadMore extends JlElement {
|
|
|
23
23
|
get(): boolean;
|
|
24
24
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
25
25
|
}>>;
|
|
26
|
-
/** The button's text. */
|
|
26
|
+
/** The button's text; jlib's own when empty. */
|
|
27
27
|
readonly label: Readonly<Readonly<{
|
|
28
28
|
get(): string;
|
|
29
29
|
set(setter: string | ((prevState: string) => string)): void;
|
|
30
30
|
}>>;
|
|
31
|
-
/** What shows beside it
|
|
31
|
+
/** What shows beside it, `{shown}` and `{total}` filled; jlib's own when empty. */
|
|
32
32
|
readonly countText: Readonly<Readonly<{
|
|
33
33
|
get(): string;
|
|
34
34
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -37,5 +37,7 @@ export declare class JlLoadMore extends JlElement {
|
|
|
37
37
|
templateHtml(): Node;
|
|
38
38
|
templateCss(): string;
|
|
39
39
|
onConnect(): void;
|
|
40
|
+
protected drawTexts(): void;
|
|
41
|
+
private renderLabel;
|
|
40
42
|
private render;
|
|
41
43
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { pageLocale } from "../lib/locale.js";
|
|
2
|
+
import { fillText } from "../lib/text.js";
|
|
3
|
+
import { jlTemplate, jlText } from "../lib/texts.js";
|
|
1
4
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
5
|
import { JlElement } from "../base/jl-element.js";
|
|
3
|
-
import { fillText } from "../lib/text.js";
|
|
4
|
-
import { jlText } from "../lib/texts.js";
|
|
5
6
|
import { JlButton } from "../atoms/jl-button.js";
|
|
6
|
-
import { pageLocale } from "../lib/locale.js";
|
|
7
7
|
import jl_load_more_default from "./jl-load-more.css_raw.js";
|
|
8
8
|
import { css } from "@jadis/core";
|
|
9
9
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -21,10 +21,10 @@ var JlLoadMore = class extends JlElement {
|
|
|
21
21
|
total = this.useChange(0, () => this.render(), { attribute: "total" });
|
|
22
22
|
/** The next page is on its way: the button shows a spinner and ignores presses. */
|
|
23
23
|
loading = this.useChange(false, (value) => this._refs.button.loading.set(value), { attribute: "loading" });
|
|
24
|
-
/** The button's text. */
|
|
25
|
-
label = this.useChange(
|
|
26
|
-
/** What shows beside it
|
|
27
|
-
countText = this.useChange(
|
|
24
|
+
/** The button's text; jlib's own when empty. */
|
|
25
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
26
|
+
/** What shows beside it, `{shown}` and `{total}` filled; jlib's own when empty. */
|
|
27
|
+
countText = this.useChange("", () => this.render(), { attribute: "count-text" });
|
|
28
28
|
_refs = this.useRefs((ref) => ({
|
|
29
29
|
button: ref(JlButton),
|
|
30
30
|
count: ref(".count")
|
|
@@ -47,11 +47,18 @@ var JlLoadMore = class extends JlElement {
|
|
|
47
47
|
if (!this.loading.get()) this.events.emit("more");
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
+
drawTexts() {
|
|
51
|
+
this.renderLabel();
|
|
52
|
+
this.render();
|
|
53
|
+
}
|
|
54
|
+
renderLabel() {
|
|
55
|
+
this._refs.button.label.set(this.label.get() || jlText("showMore"));
|
|
56
|
+
}
|
|
50
57
|
render() {
|
|
51
58
|
const locale = pageLocale();
|
|
52
59
|
const shown = this.shown.get();
|
|
53
60
|
const total = this.total.get();
|
|
54
|
-
this._refs.count.textContent = fillText(this.countText.get(), {
|
|
61
|
+
this._refs.count.textContent = fillText(this.countText.get() || jlTemplate("shownOfTotal"), {
|
|
55
62
|
shown: shown.toLocaleString(locale),
|
|
56
63
|
total: total.toLocaleString(locale)
|
|
57
64
|
});
|
|
@@ -32,14 +32,17 @@ export declare class JlLoadState extends JlElement {
|
|
|
32
32
|
get(): number;
|
|
33
33
|
set(setter: number | ((prevState: number) => number)): void;
|
|
34
34
|
}>>;
|
|
35
|
+
/** The heading of a failed load; jlib's own when empty. */
|
|
35
36
|
readonly errorHeading: Readonly<Readonly<{
|
|
36
37
|
get(): string;
|
|
37
38
|
set(setter: string | ((prevState: string) => string)): void;
|
|
38
39
|
}>>;
|
|
40
|
+
/** What a failed load says under its heading; jlib's own when empty. */
|
|
39
41
|
readonly errorText: Readonly<Readonly<{
|
|
40
42
|
get(): string;
|
|
41
43
|
set(setter: string | ((prevState: string) => string)): void;
|
|
42
44
|
}>>;
|
|
45
|
+
/** The button that runs the load again; jlib's own text when empty. */
|
|
43
46
|
readonly retryLabel: Readonly<Readonly<{
|
|
44
47
|
get(): string;
|
|
45
48
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -57,6 +60,7 @@ export declare class JlLoadState extends JlElement {
|
|
|
57
60
|
private isShowing;
|
|
58
61
|
templateHtml(): Node;
|
|
59
62
|
templateCss(): string;
|
|
63
|
+
protected drawTexts(): void;
|
|
60
64
|
onConnect(): void;
|
|
61
65
|
onDisconnect(): void;
|
|
62
66
|
private renderState;
|