@syware/jlib 0.7.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 +3 -3
- 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-select.d.ts +8 -7
- package/dist/atoms/jl-select.js +11 -6
- 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 +3 -3
- package/dist/lib/attributes.d.ts +9 -0
- package/dist/lib/attributes.js +10 -1
- package/dist/lib/nav-tree.d.ts +2 -2
- package/dist/lib/palette.d.ts +2 -2
- package/dist/lib/table.d.ts +19 -6
- package/dist/lib/table.js +42 -7
- 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 -89
- package/dist/lib/texts.js +176 -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 +8 -6
- package/dist/molecules/jl-chip-group.js +10 -5
- 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-menu.d.ts +8 -4
- package/dist/molecules/jl-menu.js +8 -1
- 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 +9 -7
- package/dist/molecules/jl-radio-group.js +14 -7
- 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-segmented.d.ts +8 -7
- package/dist/molecules/jl-segmented.js +10 -5
- 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 +9 -5
- package/dist/organisms/jl-command-palette.js +15 -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 +12 -9
- package/dist/organisms/jl-side-nav.js +26 -15
- package/dist/organisms/jl-tab-bar.d.ts +9 -7
- package/dist/organisms/jl-tab-bar.js +15 -6
- package/dist/organisms/jl-table.css_raw.js +1 -1
- package/dist/organisms/jl-table.d.ts +56 -17
- package/dist/organisms/jl-table.js +227 -43
- 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/jl-chip-group.types.d.ts +3 -3
- package/dist/types/jl-command-palette.types.d.ts +10 -6
- package/dist/types/jl-menu.types.d.ts +4 -4
- package/dist/types/jl-radio-group.types.d.ts +6 -3
- package/dist/types/jl-segmented.types.d.ts +6 -3
- package/dist/types/jl-select.types.d.ts +6 -3
- package/dist/types/jl-side-nav.types.d.ts +9 -6
- package/dist/types/jl-tab-bar.types.d.ts +6 -3
- package/dist/types/jl-table.types.d.ts +34 -8
- package/dist/types/texts.types.d.ts +29 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -105,7 +105,8 @@ npm version patch
|
|
|
105
105
|
git push --follow-tags
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Then a maintainer starts **Publish to npm** in the Actions tab for the tag (`gh workflow run publish.yml -f
|
|
109
|
+
tag=vX.Y.Z`): it stages the version on npm and creates the GitHub release, and they approve it with
|
|
109
110
|
`npm stage approve`. Every step, pre-releases and what to do when something fails: [RELEASING.md](RELEASING.md).
|
|
110
111
|
What changed in each version: [CHANGELOG.md](CHANGELOG.md).
|
|
111
112
|
|
package/dist/all.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_TEXTS, JL_LANGUAGES, jlText, jlTexts } from "./lib/texts.js";
|
|
1
2
|
import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES, TOKEN_STYLES } from "./styles/shared.js";
|
|
2
3
|
import { adoptTokens } from "./lib/tokens.js";
|
|
3
4
|
import { JlElement } from "./base/jl-element.js";
|
|
@@ -10,7 +11,6 @@ import { hasIcon, iconElement, iconNames, registerIcons } from "./lib/icons.js";
|
|
|
10
11
|
import { CONTROL_SIZES, TONES, TONE_ICONS, TONE_ICON_FILLED } from "./lib/options.js";
|
|
11
12
|
import { cellOf } from "./lib/table.js";
|
|
12
13
|
import { formatDuration, formatRelativeTime } from "./lib/time.js";
|
|
13
|
-
import { DEFAULT_TEXTS, jlText, setTexts } from "./lib/texts.js";
|
|
14
14
|
import { JlIcon } from "./atoms/jl-icon.js";
|
|
15
15
|
import { JlAppIcon, setFavicon } from "./atoms/jl-app-icon.js";
|
|
16
16
|
import { AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, JlAvatar } from "./atoms/jl-avatar.js";
|
|
@@ -77,7 +77,7 @@ import { JlNavbar } from "./organisms/jl-navbar.js";
|
|
|
77
77
|
import { JlPageHeader } from "./organisms/jl-page-header.js";
|
|
78
78
|
import { JlSideNav } from "./organisms/jl-side-nav.js";
|
|
79
79
|
import { JlTabBar } from "./organisms/jl-tab-bar.js";
|
|
80
|
-
import { JlTable, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
|
|
80
|
+
import { JlTable, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
|
|
81
81
|
import { JlToaster, TOASTER_PLACEMENTS, download, downloadTexts, toast } from "./organisms/jl-toaster.js";
|
|
82
82
|
import { JlTree } from "./organisms/jl-tree.js";
|
|
83
83
|
import { JlAppShell } from "./templates/jl-app-shell.js";
|
|
@@ -87,4 +87,4 @@ import { JlSplitView, SPLIT_ORIENTATIONS, SPLIT_PANES } from "./templates/jl-spl
|
|
|
87
87
|
// src/all.ts
|
|
88
88
|
registerIcons(COMMON_ICONS);
|
|
89
89
|
define(JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStat, JlSteps, JlSwitch, JlTabBar, JlTable, JlTabPanel, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree);
|
|
90
|
-
export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jsonOf, oneOf, placeFloating, registerIcons, setFavicon,
|
|
90
|
+
export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
|
package/dist/atoms/jl-chip.d.ts
CHANGED
package/dist/atoms/jl-chip.js
CHANGED
|
@@ -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 { oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { registerIcons } from "../lib/icons.js";
|
|
5
|
-
import { jlText } from "../lib/texts.js";
|
|
6
6
|
import { JlIcon } from "./jl-icon.js";
|
|
7
7
|
import { isActivationKey } from "../lib/surface.js";
|
|
8
8
|
import jl_chip_default from "./jl-chip.css_raw.js";
|
|
@@ -92,7 +92,6 @@ var JlChip = class extends JlElement {
|
|
|
92
92
|
}), /* @__PURE__ */ jsx("button", {
|
|
93
93
|
class: "dismiss",
|
|
94
94
|
type: "button",
|
|
95
|
-
"aria-label": jlText("remove"),
|
|
96
95
|
hidden: true,
|
|
97
96
|
children: /* @__PURE__ */ jsx(JlIcon, { name: "x" })
|
|
98
97
|
})]
|
|
@@ -150,6 +149,9 @@ var JlChip = class extends JlElement {
|
|
|
150
149
|
this._refs.icon.name.set(name);
|
|
151
150
|
this._refs.icon.hidden = name === "";
|
|
152
151
|
}
|
|
152
|
+
drawTexts() {
|
|
153
|
+
this.renderLabel();
|
|
154
|
+
}
|
|
153
155
|
renderLabel() {
|
|
154
156
|
const label = this.label.get();
|
|
155
157
|
this._refs.label.textContent = label;
|
package/dist/atoms/jl-input.d.ts
CHANGED
|
@@ -106,7 +106,9 @@ export declare class JlInput extends JlFormControl {
|
|
|
106
106
|
/** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
|
|
107
107
|
protected setDisabledByForm(disabled: boolean): void;
|
|
108
108
|
private clearValue;
|
|
109
|
+
protected drawTexts(): void;
|
|
109
110
|
private toggleReveal;
|
|
111
|
+
private renderRevealLabel;
|
|
110
112
|
private renderValue;
|
|
111
113
|
private renderType;
|
|
112
114
|
private renderDisabled;
|
package/dist/atoms/jl-input.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { jlText } from "../lib/texts.js";
|
|
1
2
|
import { BASE_STYLES, CONTROL_STYLES } from "../styles/shared.js";
|
|
2
3
|
import { JlFormControl } from "../base/jl-form-control.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 { JlIcon } from "./jl-icon.js";
|
|
8
8
|
import { setOrRemove } from "../lib/dom.js";
|
|
9
9
|
import jl_input_default from "./jl-input.css_raw.js";
|
|
@@ -108,7 +108,6 @@ var JlInput = class extends JlFormControl {
|
|
|
108
108
|
/* @__PURE__ */ jsx("button", {
|
|
109
109
|
class: "action clear",
|
|
110
110
|
type: "button",
|
|
111
|
-
"aria-label": jlText("clear"),
|
|
112
111
|
tabIndex: -1,
|
|
113
112
|
hidden: true,
|
|
114
113
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
@@ -119,7 +118,6 @@ var JlInput = class extends JlFormControl {
|
|
|
119
118
|
/* @__PURE__ */ jsx("button", {
|
|
120
119
|
class: "action reveal",
|
|
121
120
|
type: "button",
|
|
122
|
-
"aria-label": jlText("showPassword"),
|
|
123
121
|
hidden: true,
|
|
124
122
|
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
125
123
|
name: "eye",
|
|
@@ -159,11 +157,19 @@ var JlInput = class extends JlFormControl {
|
|
|
159
157
|
this.events.emit("change", "");
|
|
160
158
|
this.focus();
|
|
161
159
|
}
|
|
160
|
+
drawTexts() {
|
|
161
|
+
this._refs.clear.setAttribute("aria-label", jlText("clear"));
|
|
162
|
+
this.renderRevealLabel();
|
|
163
|
+
}
|
|
162
164
|
toggleReveal() {
|
|
163
165
|
const native = this._refs.native;
|
|
164
166
|
const revealed = native.type === PASSWORD;
|
|
165
167
|
native.type = revealed ? REVEALED : PASSWORD;
|
|
166
168
|
this._refs.revealIcon.name.set(revealed ? "eye-off" : "eye");
|
|
169
|
+
this.renderRevealLabel();
|
|
170
|
+
}
|
|
171
|
+
renderRevealLabel() {
|
|
172
|
+
const revealed = this._refs.native.type === REVEALED;
|
|
167
173
|
this._refs.reveal.setAttribute("aria-label", revealed ? jlText("hidePassword") : jlText("showPassword"));
|
|
168
174
|
}
|
|
169
175
|
renderValue(value) {
|
|
@@ -66,6 +66,8 @@ export declare class JlRating extends JlFormControl {
|
|
|
66
66
|
/** The value as the scale shows it: never past its end. */
|
|
67
67
|
private current;
|
|
68
68
|
private commit;
|
|
69
|
+
protected drawTexts(): void;
|
|
70
|
+
private renderLabel;
|
|
69
71
|
private renderIcons;
|
|
70
72
|
private renderValue;
|
|
71
73
|
private renderValidity;
|
package/dist/atoms/jl-rating.js
CHANGED
|
@@ -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 { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
5
|
import { iconElement, registerIcons } from "../lib/icons.js";
|
|
5
6
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
|
-
import { jlText } from "../lib/texts.js";
|
|
7
7
|
import { ratingAfterChoice, ratingAfterKey } from "../lib/rating.js";
|
|
8
8
|
import jl_rating_default from "./jl-rating.css_raw.js";
|
|
9
9
|
import { css } from "@jadis/core";
|
|
@@ -49,9 +49,7 @@ var JlRating = class extends JlFormControl {
|
|
|
49
49
|
parse: oneOf(CONTROL_SIZES, "md")
|
|
50
50
|
});
|
|
51
51
|
/** The name screen readers give the scale. */
|
|
52
|
-
label = this.useChange(
|
|
53
|
-
this._refs.slider.setAttribute("aria-label", value === "" ? jlText("rating") : value);
|
|
54
|
-
}, { attribute: "label" });
|
|
52
|
+
label = this.useChange("", () => this.renderLabel(), { attribute: "label" });
|
|
55
53
|
required = this.useChange(false, (value) => {
|
|
56
54
|
this._refs.slider.toggleAttribute("aria-required", value);
|
|
57
55
|
this.renderValidity();
|
|
@@ -139,6 +137,13 @@ var JlRating = class extends JlFormControl {
|
|
|
139
137
|
this.value.set(value);
|
|
140
138
|
this.events.emit("change", value);
|
|
141
139
|
}
|
|
140
|
+
drawTexts() {
|
|
141
|
+
this.renderLabel();
|
|
142
|
+
this.renderValue();
|
|
143
|
+
}
|
|
144
|
+
renderLabel() {
|
|
145
|
+
this._refs.slider.setAttribute("aria-label", this.label.get() || jlText("rating"));
|
|
146
|
+
}
|
|
142
147
|
renderIcons() {
|
|
143
148
|
const name = this.icon.get() === "" ? "star" : this.icon.get();
|
|
144
149
|
const size = ICON_SIZES[this.size.get()];
|
|
@@ -160,7 +165,10 @@ var JlRating = class extends JlFormControl {
|
|
|
160
165
|
const slider = this._refs.slider;
|
|
161
166
|
slider.setAttribute("aria-valuenow", String(value));
|
|
162
167
|
slider.setAttribute("aria-valuemax", String(max));
|
|
163
|
-
slider.setAttribute("aria-valuetext", value === 0 ? "
|
|
168
|
+
slider.setAttribute("aria-valuetext", value === 0 ? jlText("noRating") : jlText("ratingOf", {
|
|
169
|
+
max,
|
|
170
|
+
value
|
|
171
|
+
}));
|
|
164
172
|
this.internals.setFormValue(String(value));
|
|
165
173
|
this.renderValidity();
|
|
166
174
|
}
|
|
@@ -4,22 +4,23 @@ import type { ControlSize } from '../types/options.types';
|
|
|
4
4
|
/**
|
|
5
5
|
* A choice among a list, on the browser's own `<select>`: its list opens the way the platform does it on a touch
|
|
6
6
|
* screen, and with a mouse looks like the combobox's where the browser lets the page draw it (customizable select).
|
|
7
|
-
* The choices come from `options` (JSON) or from `<option>` and `<optgroup>` elements written inside it.
|
|
7
|
+
* The choices come from `options` (JSON) or from `<option>` and `<optgroup>` elements written inside it. Typed by its
|
|
8
|
+
* values, `JlSelect<'eur' | 'chf'>` takes options of those values and gives `change` one of them.
|
|
8
9
|
*/
|
|
9
|
-
export declare class JlSelect extends JlFormControl {
|
|
10
|
+
export declare class JlSelect<Value extends string = string> extends JlFormControl {
|
|
10
11
|
static readonly selector = "jl-select";
|
|
11
12
|
readonly events: Readonly<import("@jadis/core").UseEventsHandler<{
|
|
12
|
-
change:
|
|
13
|
+
change: Value;
|
|
13
14
|
}>>;
|
|
14
15
|
/** The choices; an option with a `group` goes under that heading. Empty: the `<option>` children are used. */
|
|
15
16
|
readonly options: Readonly<Readonly<{
|
|
16
|
-
get(): SelectOption[];
|
|
17
|
-
set(setter: SelectOption[] | ((prevState: SelectOption[]) => SelectOption[])): void;
|
|
17
|
+
get(): SelectOption<Value>[];
|
|
18
|
+
set(setter: SelectOption<Value>[] | ((prevState: SelectOption<Value>[]) => SelectOption<Value>[])): void;
|
|
18
19
|
}>>;
|
|
19
20
|
/** The chosen value. One that no option has is kept, as an option of its own, rather than replaced. */
|
|
20
21
|
readonly value: Readonly<Readonly<{
|
|
21
|
-
get():
|
|
22
|
-
set(setter:
|
|
22
|
+
get(): "" | Value;
|
|
23
|
+
set(setter: "" | Value | ((prevState: "" | Value) => "" | Value)): void;
|
|
23
24
|
}>>;
|
|
24
25
|
/** Shown while nothing is chosen; it cannot be picked back from the list. */
|
|
25
26
|
readonly placeholder: Readonly<Readonly<{
|
package/dist/atoms/jl-select.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES } from "../styles/shared.js";
|
|
2
2
|
import { JlFormControl } from "../base/jl-form-control.js";
|
|
3
|
-
import { jsonOf, oneOf } from "../lib/attributes.js";
|
|
3
|
+
import { asValue, jsonOf, oneOf, textOf } from "../lib/attributes.js";
|
|
4
4
|
import { registerIcons } from "../lib/icons.js";
|
|
5
5
|
import { CONTROL_SIZES } from "../lib/options.js";
|
|
6
6
|
import { JlIcon } from "./jl-icon.js";
|
|
@@ -31,7 +31,8 @@ var groupNodes = (group) => {
|
|
|
31
31
|
/**
|
|
32
32
|
* A choice among a list, on the browser's own `<select>`: its list opens the way the platform does it on a touch
|
|
33
33
|
* screen, and with a mouse looks like the combobox's where the browser lets the page draw it (customizable select).
|
|
34
|
-
* The choices come from `options` (JSON) or from `<option>` and `<optgroup>` elements written inside it.
|
|
34
|
+
* The choices come from `options` (JSON) or from `<option>` and `<optgroup>` elements written inside it. Typed by its
|
|
35
|
+
* values, `JlSelect<'eur' | 'chf'>` takes options of those values and gives `change` one of them.
|
|
35
36
|
*/
|
|
36
37
|
var JlSelect = class extends JlFormControl {
|
|
37
38
|
static selector = "jl-select";
|
|
@@ -42,7 +43,10 @@ var JlSelect = class extends JlFormControl {
|
|
|
42
43
|
parse: jsonOf([])
|
|
43
44
|
});
|
|
44
45
|
/** The chosen value. One that no option has is kept, as an option of its own, rather than replaced. */
|
|
45
|
-
value = this.useChange(NO_VALUE, () => this.renderOptions(), {
|
|
46
|
+
value = this.useChange(NO_VALUE, () => this.renderOptions(), {
|
|
47
|
+
attribute: "value",
|
|
48
|
+
parse: textOf(NO_VALUE)
|
|
49
|
+
});
|
|
46
50
|
/** Shown while nothing is chosen; it cannot be picked back from the list. */
|
|
47
51
|
placeholder = this.useChange("", () => this.renderOptions(), { attribute: "placeholder" });
|
|
48
52
|
size = this.useChange("md", (value) => this.reflect("size", value), {
|
|
@@ -87,13 +91,14 @@ var JlSelect = class extends JlFormControl {
|
|
|
87
91
|
onConnect() {
|
|
88
92
|
const native = this._refs.native;
|
|
89
93
|
this.on(native, "change", () => {
|
|
90
|
-
|
|
91
|
-
this.
|
|
94
|
+
const value = asValue(native.value);
|
|
95
|
+
this.value.set(value);
|
|
96
|
+
this.events.emit("change", value);
|
|
92
97
|
});
|
|
93
98
|
this.renderOptions();
|
|
94
99
|
}
|
|
95
100
|
resetValue() {
|
|
96
|
-
this.value.set(this.getAttribute("value")
|
|
101
|
+
this.value.set(textOf(NO_VALUE)(this.getAttribute("value")));
|
|
97
102
|
}
|
|
98
103
|
/** The browser calls it for a disabled fieldset and for the element's own disabled attribute, even before render. */
|
|
99
104
|
setDisabledByForm(disabled) {
|
|
@@ -6,6 +6,7 @@ export declare class JlSpinner extends JlElement {
|
|
|
6
6
|
get(): number;
|
|
7
7
|
set(setter: number | ((prevState: number) => number)): void;
|
|
8
8
|
}>>;
|
|
9
|
+
/** What screen readers say; jlib's own text when empty. */
|
|
9
10
|
readonly label: Readonly<Readonly<{
|
|
10
11
|
get(): string;
|
|
11
12
|
set(setter: string | ((prevState: string) => string)): void;
|
|
@@ -13,4 +14,5 @@ export declare class JlSpinner extends JlElement {
|
|
|
13
14
|
private readonly _refs;
|
|
14
15
|
templateHtml(): Node;
|
|
15
16
|
templateCss(): string;
|
|
17
|
+
protected drawTexts(): void;
|
|
16
18
|
}
|
package/dist/atoms/jl-spinner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
-
import { jlText } from "../lib/texts.js";
|
|
4
4
|
import jl_spinner_default from "./jl-spinner.css_raw.js";
|
|
5
5
|
import { css } from "@jadis/core";
|
|
6
6
|
import { jsx } from "@jadis/core/jsx-runtime";
|
|
@@ -10,7 +10,8 @@ var DEFAULT_SIZE = 16;
|
|
|
10
10
|
var JlSpinner = class extends JlElement {
|
|
11
11
|
static selector = "jl-spinner";
|
|
12
12
|
size = this.useChange(DEFAULT_SIZE, (value) => this.style.setProperty("--size", `${value}px`), { attribute: "size" });
|
|
13
|
-
|
|
13
|
+
/** What screen readers say; jlib's own text when empty. */
|
|
14
|
+
label = this.useChange("", () => this.drawTexts(), { attribute: "label" });
|
|
14
15
|
_refs = this.useRefs((ref) => ({ ring: ref(".ring") }));
|
|
15
16
|
templateHtml() {
|
|
16
17
|
return /* @__PURE__ */ jsx("span", {
|
|
@@ -21,6 +22,9 @@ var JlSpinner = class extends JlElement {
|
|
|
21
22
|
templateCss() {
|
|
22
23
|
return css`${BASE_STYLES}${jl_spinner_default}`;
|
|
23
24
|
}
|
|
25
|
+
drawTexts() {
|
|
26
|
+
this._refs.ring.setAttribute("aria-label", this.label.get() || jlText("loading"));
|
|
27
|
+
}
|
|
24
28
|
};
|
|
25
29
|
JlSpinner.register();
|
|
26
30
|
export { JlSpinner };
|
|
@@ -4,6 +4,12 @@ import { Jadis } from '@jadis/core';
|
|
|
4
4
|
* JSON lists (`{ attribute: 'label' }`), so they work from HTML, from JSX and from code alike.
|
|
5
5
|
*/
|
|
6
6
|
export declare abstract class JlElement extends Jadis {
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Writes jlib's texts the component shows, with `jlText`. A component that has some defines it: it is called at
|
|
10
|
+
* every connection, once the template exists and before the browser paints, then at each change of jlib's language.
|
|
11
|
+
*/
|
|
12
|
+
protected drawTexts?(): void;
|
|
7
13
|
/** Defines the element, and gives the document the design tokens the first time. */
|
|
8
14
|
static register(): void;
|
|
9
15
|
/** Runs now when the template exists, otherwise as soon as the component connects. */
|
package/dist/base/jl-element.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jlTexts } from "../lib/texts.js";
|
|
1
2
|
import { adoptTokens } from "../lib/tokens.js";
|
|
2
3
|
import { Jadis } from "@jadis/core";
|
|
3
4
|
// src/base/jl-element.ts
|
|
@@ -6,6 +7,10 @@ import { Jadis } from "@jadis/core";
|
|
|
6
7
|
* JSON lists (`{ attribute: 'label' }`), so they work from HTML, from JSX and from code alike.
|
|
7
8
|
*/
|
|
8
9
|
var JlElement = class extends Jadis {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
if (this.drawTexts) this.useTranslation(jlTexts, () => this.drawTexts?.());
|
|
13
|
+
}
|
|
9
14
|
/** Defines the element, and gives the document the design tokens the first time. */
|
|
10
15
|
static register() {
|
|
11
16
|
adoptTokens();
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { hasIcon, iconElement, iconNames, registerIcons } from './lib/icons';
|
|
|
8
8
|
export { CONTROL_SIZES, TONE_ICON_FILLED, TONE_ICONS, TONES } from './lib/options';
|
|
9
9
|
export { cellOf } from './lib/table';
|
|
10
10
|
export { formatDuration, formatRelativeTime } from './lib/time';
|
|
11
|
-
export { DEFAULT_TEXTS, jlText,
|
|
11
|
+
export { DEFAULT_TEXTS, JL_LANGUAGES, jlText, jlTexts } from './lib/texts';
|
|
12
12
|
export { adoptTokens } from './lib/tokens';
|
|
13
13
|
export { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES, TOKEN_STYLES } from './styles/shared';
|
|
14
14
|
export type * from './types/calendar.types';
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DEFAULT_TEXTS, JL_LANGUAGES, jlText, jlTexts } from "./lib/texts.js";
|
|
1
2
|
import { BASE_STYLES, CONTROL_STYLES, FLOATING_STYLES, TOKEN_STYLES } from "./styles/shared.js";
|
|
2
3
|
import { adoptTokens } from "./lib/tokens.js";
|
|
3
4
|
import { JlElement } from "./base/jl-element.js";
|
|
@@ -10,7 +11,6 @@ import { hasIcon, iconElement, iconNames, registerIcons } from "./lib/icons.js";
|
|
|
10
11
|
import { CONTROL_SIZES, TONES, TONE_ICONS, TONE_ICON_FILLED } from "./lib/options.js";
|
|
11
12
|
import { cellOf } from "./lib/table.js";
|
|
12
13
|
import { formatDuration, formatRelativeTime } from "./lib/time.js";
|
|
13
|
-
import { DEFAULT_TEXTS, jlText, setTexts } from "./lib/texts.js";
|
|
14
14
|
import { JlIcon } from "./atoms/jl-icon.js";
|
|
15
15
|
import { JlAppIcon, setFavicon } from "./atoms/jl-app-icon.js";
|
|
16
16
|
import { AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, JlAvatar } from "./atoms/jl-avatar.js";
|
|
@@ -77,11 +77,11 @@ import { JlNavbar } from "./organisms/jl-navbar.js";
|
|
|
77
77
|
import { JlPageHeader } from "./organisms/jl-page-header.js";
|
|
78
78
|
import { JlSideNav } from "./organisms/jl-side-nav.js";
|
|
79
79
|
import { JlTabBar } from "./organisms/jl-tab-bar.js";
|
|
80
|
-
import { JlTable, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
|
|
80
|
+
import { JlTable, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS } from "./organisms/jl-table.js";
|
|
81
81
|
import { JlToaster, TOASTER_PLACEMENTS, download, downloadTexts, toast } from "./organisms/jl-toaster.js";
|
|
82
82
|
import { JlTree } from "./organisms/jl-tree.js";
|
|
83
83
|
import { JlAppShell } from "./templates/jl-app-shell.js";
|
|
84
84
|
import { JlAuthLayout } from "./templates/jl-auth-layout.js";
|
|
85
85
|
import { JlPage, PAGE_WIDTHS } from "./templates/jl-page.js";
|
|
86
86
|
import { JlSplitView, SPLIT_ORIENTATIONS, SPLIT_PANES } from "./templates/jl-split-view.js";
|
|
87
|
-
export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jsonOf, oneOf, placeFloating, registerIcons, setFavicon,
|
|
87
|
+
export { ACCORDION_VARIANTS, AVATAR_SHAPES, AVATAR_SIZES, AVATAR_STATUSES, BASE_STYLES, BUTTON_TYPES, BUTTON_VARIANTS, CARD_PADDINGS, CHIP_SIZES, CODE_LANGUAGES, COMMON_ICONS, CONFIRM_TONES, CONTROL_SIZES, CONTROL_STYLES, DEFAULT_TEXTS, DIALOG_SIZES, DIVIDER_ALIGNS, DRAWER_PLACEMENTS, DRAWER_SIZES, EMPTY_SIZES, FACTS_ORIENTATIONS, FIELD_ORIENTATIONS, FLOATING_STYLES, INPUT_TYPES, JL_LANGUAGES, JlAccordion, JlAccordionItem, JlAccountButton, JlAlert, JlAppIcon, JlAppShell, JlAuthLayout, JlAvatar, JlAvatarGroup, JlBadge, JlBreadcrumb, JlButton, JlCalendar, JlCard, JlCheckbox, JlChip, JlChipGroup, JlCodeBlock, JlCombobox, JlCommandPalette, JlConfirm, JlCopyButton, JlDatePicker, JlDialog, JlDivider, JlDrawer, JlElement, JlEmpty, JlFacts, JlField, JlFileDrop, JlFlow, JlFormControl, JlIcon, JlInput, JlInputList, JlKbd, JlLink, JlListItem, JlLoadMore, JlLoadState, JlMenu, JlNavbar, JlNumberInput, JlPage, JlPageHeader, JlPagination, JlPopover, JlProgress, JlProgressRing, JlRadioGroup, JlRating, JlSearch, JlSearchButton, JlSegmented, JlSelect, JlSideNav, JlSkeleton, JlSlider, JlSpinner, JlSplitView, JlStat, JlSteps, JlSwitch, JlTabBar, JlTabPanel, JlTable, JlTabs, JlTagInput, JlTextarea, JlTimeline, JlToast, JlToaster, JlTooltip, JlTree, LINK_VARIANTS, LOAD_SKELETONS, LOAD_STATES, PAGE_WIDTHS, PLACEMENTS, PROGRESS_SIZES, PROGRESS_TONES, RADIO_GROUP_ORIENTATIONS, RADIO_GROUP_VARIANTS, SKELETON_SHAPES, SPLIT_ORIENTATIONS, SPLIT_PANES, STAT_TRENDS, STEPS_ORIENTATIONS, SWITCH_SIZES, TABLE_EXPANSIONS, TABLE_SORT_DIRECTIONS, TAB_VARIANTS, TOASTER_PLACEMENTS, TOAST_TONES, TOKEN_STYLES, TONES, TONE_ICONS, TONE_ICON_FILLED, adoptTokens, cellOf, clampedNumber, computePosition, confirmDialog, define, download, downloadTexts, followAnchor, formatDuration, formatRelativeTime, guardLeave, hasIcon, iconElement, iconNames, jlText, jlTexts, jsonOf, oneOf, placeFloating, registerIcons, setFavicon, toast };
|
package/dist/lib/attributes.d.ts
CHANGED
|
@@ -12,3 +12,12 @@ export declare const clampedNumber: (fallback: number, min: number, max: number)
|
|
|
12
12
|
* (`open`) for the common case of a single one. Empty or unreadable gives an empty list.
|
|
13
13
|
*/
|
|
14
14
|
export declare const stringList: (value: string | null) => string[];
|
|
15
|
+
/**
|
|
16
|
+
* A text the page wrote, in an attribute or an `<option>`, taken as one of a type's values: a choice's value, a
|
|
17
|
+
* field of a table's rows. HTML is not checked against the type, as with `jsonOf`.
|
|
18
|
+
*/
|
|
19
|
+
export declare const asValue: <Value extends string>(text: string) => Value;
|
|
20
|
+
/** A text attribute naming one of a type's values (see `asValue`); a missing one gives the fallback. */
|
|
21
|
+
export declare const textOf: <Value extends string>(fallback: Value) => (value: string | null) => Value;
|
|
22
|
+
/** `stringList` for a list of a type's values (see `asValue`). */
|
|
23
|
+
export declare const textListOf: <Value extends string>(value: string | null) => Value[];
|
package/dist/lib/attributes.js
CHANGED
|
@@ -31,4 +31,13 @@ var stringList = (value) => {
|
|
|
31
31
|
const parsed = jsonOf([])(text);
|
|
32
32
|
return Array.isArray(parsed) ? parsed.map(String) : [];
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
/**
|
|
35
|
+
* A text the page wrote, in an attribute or an `<option>`, taken as one of a type's values: a choice's value, a
|
|
36
|
+
* field of a table's rows. HTML is not checked against the type, as with `jsonOf`.
|
|
37
|
+
*/
|
|
38
|
+
var asValue = (text) => text;
|
|
39
|
+
/** A text attribute naming one of a type's values (see `asValue`); a missing one gives the fallback. */
|
|
40
|
+
var textOf = (fallback) => (value) => value === null ? fallback : asValue(value);
|
|
41
|
+
/** `stringList` for a list of a type's values (see `asValue`). */
|
|
42
|
+
var textListOf = (value) => stringList(value).map((text) => asValue(text));
|
|
43
|
+
export { asValue, clampedNumber, jsonOf, oneOf, stringList, textListOf, textOf };
|
package/dist/lib/nav-tree.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export declare function pathTo(items: readonly SideNavItem[], id: string): strin
|
|
|
4
4
|
/** The path to an item, looked for in every section. */
|
|
5
5
|
export declare const pathInSections: (sections: readonly SideNavSection[], id: string) => string[];
|
|
6
6
|
/** The item itself when it has no children, otherwise its first leaf: where a parent leads in the icon rail. */
|
|
7
|
-
export declare function firstLeaf(item: SideNavItem): SideNavItem
|
|
7
|
+
export declare function firstLeaf<Id extends string>(item: SideNavItem<Id>): SideNavItem<Id>;
|
|
8
8
|
/** Finds an item by id anywhere in the sections. */
|
|
9
|
-
export declare function findItem(sections: readonly SideNavSection[], id: string): SideNavItem | null;
|
|
9
|
+
export declare function findItem<Id extends string>(sections: readonly SideNavSection<Id>[], id: string): SideNavItem<Id> | null;
|
package/dist/lib/palette.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ import type { PaletteCommand, PaletteGroup, PaletteMatch } from '../types/jl-com
|
|
|
3
3
|
* The commands that match the search, best first; an empty search keeps them all in their order. The label's
|
|
4
4
|
* matched letters come with each, for highlighting; a command found by a keyword only has none.
|
|
5
5
|
*/
|
|
6
|
-
export declare function matchCommands(commands: readonly PaletteCommand[], query: string): PaletteMatch[];
|
|
6
|
+
export declare function matchCommands<Id extends string>(commands: readonly PaletteCommand<Id>[], query: string): PaletteMatch<Id>[];
|
|
7
7
|
/** The matches under their group headings, groups in the order their first command comes. */
|
|
8
|
-
export declare function groupMatches(matches: readonly PaletteMatch[]): PaletteGroup[];
|
|
8
|
+
export declare function groupMatches<Id extends string>(matches: readonly PaletteMatch<Id>[]): PaletteGroup<Id>[];
|
package/dist/lib/table.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TableAlign, TableCellFormat, TableCellRenderer, TableColumn,
|
|
1
|
+
import type { TableAlign, TableCellFormat, TableCellRenderer, TableColumn, TableExpansion, TableRowKey, TableSelectionState, TableSortDirection, TableToggle } from '../types/jl-table.types';
|
|
2
2
|
export declare const nextSortDirection: (direction: TableSortDirection) => TableSortDirection;
|
|
3
3
|
/** A cell's value as a number, `NaN` when it is not one. */
|
|
4
4
|
export declare function toNumber(value: unknown): number;
|
|
@@ -9,27 +9,40 @@ export declare function toTime(value: unknown): number;
|
|
|
9
9
|
* unreadable values come after the others.
|
|
10
10
|
*/
|
|
11
11
|
export declare function compareCells(a: unknown, b: unknown, format: TableCellFormat, locale?: string): number;
|
|
12
|
+
/**
|
|
13
|
+
* A row's field by its name, whatever the page's type of row: a column names its field as text, and the HTML that
|
|
14
|
+
* writes the rows is not checked against a type.
|
|
15
|
+
*/
|
|
16
|
+
export declare const fieldOf: (row: object, key: string) => unknown;
|
|
12
17
|
/**
|
|
13
18
|
* The rows ordered by one column; `none` gives them back as they came. The sort is stable, and empty values stay
|
|
14
19
|
* at the end in both directions.
|
|
15
20
|
*/
|
|
16
|
-
export declare function sortRows(rows: readonly
|
|
21
|
+
export declare function sortRows<Row extends object>(rows: readonly Row[], key: string, direction: TableSortDirection, format?: TableCellFormat, locale?: string): Row[];
|
|
17
22
|
/** A cell's text in its column's format; empty for a missing value. */
|
|
18
23
|
export declare function formatCell(value: unknown, format?: TableCellFormat, locale?: string): string;
|
|
19
24
|
/** Where a column's cells align: as asked, otherwise numbers right and the rest left. */
|
|
20
|
-
export declare function columnAlign(column: TableColumn): TableAlign;
|
|
25
|
+
export declare function columnAlign(column: Pick<TableColumn, 'align' | 'format'>): TableAlign;
|
|
21
26
|
/** A CSS width from a column's `width`: numbers are pixels. */
|
|
22
27
|
export declare function columnWidth(width: string | number | undefined): string;
|
|
23
28
|
/** A row's identity, read from its key field; its position when the field is missing. */
|
|
24
|
-
export declare function rowKeyOf(row:
|
|
29
|
+
export declare function rowKeyOf(row: object, keyField: string, index: number): TableRowKey;
|
|
25
30
|
/** What the select-all box shows: empty, a dash for some rows, a tick for all of them. */
|
|
26
31
|
export declare function selectionState(keys: readonly TableRowKey[], selected: ReadonlySet<TableRowKey>): TableSelectionState;
|
|
27
32
|
/** The selection after the select-all box is pressed: every row when not all were selected, else none of them. */
|
|
28
33
|
export declare function toggleAll(keys: readonly TableRowKey[], selected: ReadonlySet<TableRowKey>): TableRowKey[];
|
|
29
34
|
/** The selection with one row added or taken out. */
|
|
30
35
|
export declare function toggleKey(selected: readonly TableRowKey[], key: TableRowKey, on: boolean): TableRowKey[];
|
|
36
|
+
/** The rows shown open: none when rows do not open, the last one opened when they open one at a time. */
|
|
37
|
+
export declare const openRows: (expanded: readonly TableRowKey[], expansion: TableExpansion) => TableRowKey[];
|
|
38
|
+
/** The open rows after one opens or closes: one at a time, opening a row closes the one that was open. */
|
|
39
|
+
export declare const withRowOpen: (expanded: readonly TableRowKey[], key: TableRowKey, open: boolean, expansion: TableExpansion) => TableRowKey[];
|
|
40
|
+
/** What changed between two sets of open rows, as the `toggle` events to emit: the rows closed, then those opened. */
|
|
41
|
+
export declare function rowToggles(before: readonly TableRowKey[], after: readonly TableRowKey[]): TableToggle[];
|
|
31
42
|
/**
|
|
32
|
-
* A renderer of `renderers` written for the page's own type of row
|
|
33
|
-
*
|
|
43
|
+
* A renderer of `renderers` written for the page's own type of row, for a table that does not say its type of row:
|
|
44
|
+
* the table hands each renderer back a row the page gave it, so
|
|
45
|
+
* `cellOf<Order>((order) => <JlLink href={order.href} label={order.name} />)` reads it typed. A table typed by its
|
|
46
|
+
* rows (`JlTable<Order>`) hands its renderers an order already.
|
|
34
47
|
*/
|
|
35
48
|
export declare const cellOf: <Row>(draw: (row: Row) => Node) => TableCellRenderer;
|
package/dist/lib/table.js
CHANGED
|
@@ -52,6 +52,11 @@ function isUnorderable(value, format) {
|
|
|
52
52
|
}[format]();
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
+
* A row's field by its name, whatever the page's type of row: a column names its field as text, and the HTML that
|
|
56
|
+
* writes the rows is not checked against a type.
|
|
57
|
+
*/
|
|
58
|
+
var fieldOf = (row, key) => Reflect.get(row, key);
|
|
59
|
+
/**
|
|
55
60
|
* The rows ordered by one column; `none` gives them back as they came. The sort is stable, and empty values stay
|
|
56
61
|
* at the end in both directions.
|
|
57
62
|
*/
|
|
@@ -59,10 +64,12 @@ function sortRows(rows, key, direction, format = "text", locale) {
|
|
|
59
64
|
const sign = DIRECTION_SIGN[direction];
|
|
60
65
|
if (sign === 0 || key === "") return [...rows];
|
|
61
66
|
return [...rows].sort((a, b) => {
|
|
62
|
-
const
|
|
63
|
-
const
|
|
67
|
+
const aValue = fieldOf(a, key);
|
|
68
|
+
const bValue = fieldOf(b, key);
|
|
69
|
+
const aMissing = isUnorderable(aValue, format);
|
|
70
|
+
const bMissing = isUnorderable(bValue, format);
|
|
64
71
|
if (aMissing || bMissing) return Number(aMissing) - Number(bMissing);
|
|
65
|
-
return sign * COMPARERS[format](
|
|
72
|
+
return sign * COMPARERS[format](aValue, bValue, locale);
|
|
66
73
|
});
|
|
67
74
|
}
|
|
68
75
|
var FORMATTERS = {
|
|
@@ -98,7 +105,7 @@ function columnWidth(width) {
|
|
|
98
105
|
}
|
|
99
106
|
/** A row's identity, read from its key field; its position when the field is missing. */
|
|
100
107
|
function rowKeyOf(row, keyField, index) {
|
|
101
|
-
const value = row
|
|
108
|
+
const value = fieldOf(row, keyField);
|
|
102
109
|
return typeof value === "string" || typeof value === "number" ? value : index;
|
|
103
110
|
}
|
|
104
111
|
/** What the select-all box shows: empty, a dash for some rows, a tick for all of them. */
|
|
@@ -117,9 +124,37 @@ function toggleKey(selected, key, on) {
|
|
|
117
124
|
const without = selected.filter((candidate) => candidate !== key);
|
|
118
125
|
return on ? [...without, key] : without;
|
|
119
126
|
}
|
|
127
|
+
var OPEN_ROWS = {
|
|
128
|
+
multiple: (expanded) => [...expanded],
|
|
129
|
+
none: () => [],
|
|
130
|
+
single: (expanded) => expanded.slice(-1)
|
|
131
|
+
};
|
|
132
|
+
/** The rows shown open: none when rows do not open, the last one opened when they open one at a time. */
|
|
133
|
+
var openRows = (expanded, expansion) => OPEN_ROWS[expansion](expanded);
|
|
134
|
+
var ROW_OPENERS = {
|
|
135
|
+
multiple: (expanded, key, open) => toggleKey(expanded, key, open),
|
|
136
|
+
none: (expanded) => [...expanded],
|
|
137
|
+
single: (expanded, key, open) => open ? [key] : openRows(expanded, "single").filter((candidate) => candidate !== key)
|
|
138
|
+
};
|
|
139
|
+
/** The open rows after one opens or closes: one at a time, opening a row closes the one that was open. */
|
|
140
|
+
var withRowOpen = (expanded, key, open, expansion) => ROW_OPENERS[expansion](expanded, key, open);
|
|
141
|
+
/** What changed between two sets of open rows, as the `toggle` events to emit: the rows closed, then those opened. */
|
|
142
|
+
function rowToggles(before, after) {
|
|
143
|
+
const closed = before.filter((key) => !after.includes(key)).map((key) => ({
|
|
144
|
+
key,
|
|
145
|
+
open: false
|
|
146
|
+
}));
|
|
147
|
+
const opened = after.filter((key) => !before.includes(key)).map((key) => ({
|
|
148
|
+
key,
|
|
149
|
+
open: true
|
|
150
|
+
}));
|
|
151
|
+
return [...closed, ...opened];
|
|
152
|
+
}
|
|
120
153
|
/**
|
|
121
|
-
* A renderer of `renderers` written for the page's own type of row
|
|
122
|
-
*
|
|
154
|
+
* A renderer of `renderers` written for the page's own type of row, for a table that does not say its type of row:
|
|
155
|
+
* the table hands each renderer back a row the page gave it, so
|
|
156
|
+
* `cellOf<Order>((order) => <JlLink href={order.href} label={order.name} />)` reads it typed. A table typed by its
|
|
157
|
+
* rows (`JlTable<Order>`) hands its renderers an order already.
|
|
123
158
|
*/
|
|
124
159
|
var cellOf = (draw) => (row) => draw(row);
|
|
125
|
-
export { cellOf, columnAlign, columnWidth, formatCell, nextSortDirection, rowKeyOf, selectionState, sortRows, toNumber, toTime, toggleAll, toggleKey };
|
|
160
|
+
export { cellOf, columnAlign, columnWidth, fieldOf, formatCell, nextSortDirection, openRows, rowKeyOf, rowToggles, selectionState, sortRows, toNumber, toTime, toggleAll, toggleKey, withRowOpen };
|