@syware/jlib 0.12.1 → 0.14.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/dist/atoms/jl-avatar.css.js +1 -1
- package/dist/atoms/jl-avatar.js +1 -8
- package/dist/atoms/jl-button.css.js +1 -1
- package/dist/atoms/jl-button.js +4 -6
- package/dist/atoms/jl-checkbox.css.js +1 -1
- package/dist/atoms/jl-checkbox.js +8 -10
- package/dist/atoms/jl-chip.css.js +1 -1
- package/dist/atoms/jl-chip.js +3 -11
- package/dist/atoms/jl-divider.css.js +1 -1
- package/dist/atoms/jl-divider.js +1 -5
- package/dist/atoms/jl-icon.css.js +1 -1
- package/dist/atoms/jl-icon.d.ts +2 -0
- package/dist/atoms/jl-icon.js +5 -1
- package/dist/atoms/jl-input.d.ts +7 -2
- package/dist/atoms/jl-input.js +36 -31
- package/dist/atoms/jl-link.css.js +1 -1
- package/dist/atoms/jl-link.js +3 -6
- package/dist/atoms/jl-progress-ring.js +3 -2
- package/dist/atoms/jl-progress.js +3 -2
- package/dist/atoms/jl-rating.css.js +1 -1
- package/dist/atoms/jl-rating.d.ts +2 -2
- package/dist/atoms/jl-rating.js +17 -35
- package/dist/atoms/jl-select.d.ts +8 -3
- package/dist/atoms/jl-select.js +26 -13
- package/dist/atoms/jl-skeleton.d.ts +1 -0
- package/dist/atoms/jl-skeleton.js +4 -1
- package/dist/atoms/jl-slider.d.ts +4 -0
- package/dist/atoms/jl-slider.js +29 -15
- package/dist/atoms/jl-switch.css.js +1 -1
- package/dist/atoms/jl-switch.js +2 -8
- package/dist/atoms/jl-textarea.css.js +1 -1
- package/dist/atoms/jl-textarea.d.ts +4 -5
- package/dist/atoms/jl-textarea.js +15 -30
- package/dist/index.d.ts +1 -1
- package/dist/lib/calendar.js +3 -2
- package/dist/lib/floating.d.ts +10 -0
- package/dist/lib/floating.js +27 -8
- package/dist/lib/flow.d.ts +7 -3
- package/dist/lib/flow.js +19 -8
- package/dist/lib/hotkey.d.ts +13 -0
- package/dist/lib/hotkey.js +2 -1
- package/dist/lib/indicator.d.ts +16 -0
- package/dist/lib/indicator.js +32 -6
- package/dist/lib/intl.d.ts +6 -0
- package/dist/lib/intl.js +19 -0
- package/dist/lib/key-shortcut.js +11 -29
- package/dist/lib/palette.js +1 -6
- 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.d.ts +14 -2
- package/dist/lib/table.js +50 -39
- package/dist/molecules/jl-accordion-item.css.js +1 -1
- package/dist/molecules/jl-accordion-item.js +1 -5
- package/dist/molecules/jl-account-button.css.js +1 -1
- package/dist/molecules/jl-account-button.js +1 -5
- package/dist/molecules/jl-alert.css.js +1 -1
- package/dist/molecules/jl-alert.d.ts +5 -5
- package/dist/molecules/jl-alert.js +4 -13
- package/dist/molecules/jl-avatar-group.d.ts +7 -5
- package/dist/molecules/jl-avatar-group.js +15 -5
- package/dist/molecules/jl-breadcrumb.d.ts +7 -4
- package/dist/molecules/jl-breadcrumb.js +32 -8
- package/dist/molecules/jl-calendar.d.ts +12 -3
- package/dist/molecules/jl-calendar.js +79 -48
- package/dist/molecules/jl-card.css.js +1 -1
- package/dist/molecules/jl-card.js +2 -8
- package/dist/molecules/jl-chip-group.css.js +1 -1
- package/dist/molecules/jl-chip-group.d.ts +6 -2
- package/dist/molecules/jl-chip-group.js +14 -19
- package/dist/molecules/jl-code-block.css.js +1 -1
- package/dist/molecules/jl-code-block.d.ts +7 -5
- package/dist/molecules/jl-code-block.js +19 -22
- package/dist/molecules/jl-combobox.css.js +1 -1
- package/dist/molecules/jl-combobox.d.ts +4 -0
- package/dist/molecules/jl-combobox.js +33 -19
- package/dist/molecules/jl-date-picker.d.ts +6 -0
- package/dist/molecules/jl-date-picker.js +29 -9
- package/dist/molecules/jl-empty.css.js +1 -1
- package/dist/molecules/jl-empty.js +4 -19
- package/dist/molecules/jl-field.css.js +1 -1
- package/dist/molecules/jl-field.d.ts +7 -1
- package/dist/molecules/jl-field.js +35 -23
- package/dist/molecules/jl-file-drop.css.js +1 -1
- package/dist/molecules/jl-file-drop.js +1 -3
- package/dist/molecules/jl-input-list.css.js +1 -1
- package/dist/molecules/jl-input-list.d.ts +12 -1
- package/dist/molecules/jl-input-list.js +81 -51
- package/dist/molecules/jl-list-item.css.js +1 -1
- package/dist/molecules/jl-list-item.d.ts +3 -1
- package/dist/molecules/jl-list-item.js +26 -27
- package/dist/molecules/jl-load-state.css.js +1 -1
- package/dist/molecules/jl-load-state.d.ts +6 -1
- package/dist/molecules/jl-load-state.js +15 -18
- package/dist/molecules/jl-menu.d.ts +1 -0
- package/dist/molecules/jl-menu.js +9 -2
- package/dist/molecules/jl-pagination.css.js +1 -1
- package/dist/molecules/jl-pagination.d.ts +7 -1
- package/dist/molecules/jl-pagination.js +43 -35
- package/dist/molecules/jl-radio-group.js +1 -1
- package/dist/molecules/jl-search.css.js +1 -1
- package/dist/molecules/jl-search.js +4 -12
- package/dist/molecules/jl-segmented.css.js +1 -1
- package/dist/molecules/jl-segmented.d.ts +4 -2
- package/dist/molecules/jl-segmented.js +19 -26
- package/dist/molecules/jl-stat.css.js +1 -1
- package/dist/molecules/jl-stat.js +2 -8
- package/dist/molecules/jl-steps.d.ts +10 -3
- package/dist/molecules/jl-steps.js +82 -49
- package/dist/molecules/jl-tabs.d.ts +5 -2
- package/dist/molecules/jl-tabs.js +31 -25
- package/dist/molecules/jl-tag-input.css.js +1 -1
- package/dist/molecules/jl-tag-input.d.ts +13 -1
- package/dist/molecules/jl-tag-input.js +57 -30
- package/dist/molecules/jl-timeline.css.js +1 -1
- package/dist/molecules/jl-timeline.d.ts +3 -1
- package/dist/molecules/jl-timeline.js +9 -14
- package/dist/molecules/jl-toast.css.js +1 -1
- package/dist/molecules/jl-toast.js +4 -12
- package/dist/molecules/jl-tooltip.d.ts +2 -1
- package/dist/molecules/jl-tooltip.js +11 -15
- package/dist/organisms/jl-command-palette.css.js +1 -1
- package/dist/organisms/jl-command-palette.d.ts +8 -1
- package/dist/organisms/jl-command-palette.js +74 -43
- package/dist/organisms/jl-confirm.css.js +1 -1
- package/dist/organisms/jl-confirm.js +1 -5
- package/dist/organisms/jl-dialog.css.js +1 -1
- package/dist/organisms/jl-dialog.js +1 -5
- package/dist/organisms/jl-drawer.css.js +1 -1
- package/dist/organisms/jl-drawer.js +1 -3
- package/dist/organisms/jl-flow.d.ts +18 -2
- package/dist/organisms/jl-flow.js +128 -44
- package/dist/organisms/jl-navbar.css.js +1 -1
- package/dist/organisms/jl-navbar.d.ts +1 -1
- package/dist/organisms/jl-navbar.js +3 -5
- package/dist/organisms/jl-page-header.css.js +1 -1
- package/dist/organisms/jl-page-header.js +1 -5
- package/dist/organisms/jl-page-outlet.d.ts +4 -3
- package/dist/organisms/jl-page-outlet.js +7 -8
- package/dist/organisms/jl-side-nav.css.js +1 -1
- package/dist/organisms/jl-side-nav.d.ts +9 -2
- package/dist/organisms/jl-side-nav.js +44 -16
- package/dist/organisms/jl-tab-bar.css.js +1 -1
- package/dist/organisms/jl-tab-bar.js +0 -2
- package/dist/organisms/jl-table.css.js +1 -1
- package/dist/organisms/jl-table.d.ts +19 -7
- package/dist/organisms/jl-table.js +97 -59
- package/dist/organisms/jl-tree.css.js +1 -1
- package/dist/organisms/jl-tree.d.ts +16 -13
- package/dist/organisms/jl-tree.js +72 -70
- package/package.json +4 -2
- 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
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-avatar.css?inline
|
|
2
|
-
var jl_avatar_default = ":host{vertical-align:middle;--size:32px;--ring:0px;--ring-color:var(--jl-surface);--fg:var(--jl-text-2);--bg:var(--jl-surface-3);flex:none;display:inline-flex}:host([size=sm]){--size:24px}:host([size=lg]){--size:40px}:host([size=xl]){--size:56px}:host([tone=accent]){--fg:var(--jl-accent);--bg:var(--jl-accent-soft)}:host([tone=ok]){--fg:var(--jl-ok);--bg:var(--jl-ok-soft)}:host([tone=warn]){--fg:var(--jl-warn);--bg:var(--jl-warn-soft)}:host([tone=danger]){--fg:var(--jl-danger);--bg:var(--jl-danger-soft)}.avatar{width:var(--size);height:var(--size);display:inline-flex;position:relative}.face{background:var(--bg);width:100%;height:100%;color:var(--fg);font-size:calc(var(--size) * .38);letter-spacing:.01em;white-space:nowrap;box-shadow:0 0 0 var(--ring) var(--ring-color);-webkit-user-select:none;user-select:none;border-radius:50%;justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex;overflow:hidden}:host([shape=square]) .face{border-radius:calc(var(--size) * .25)}:host([has-image]) .face{background:var(--jl-surface-3)}img{object-fit:cover;width:100%;height:100%}.status{width:max(7px, calc(var(--size) * .26));height:max(7px, calc(var(--size) * .26));background:var(--jl-faint);box-shadow:0 0 0 2px var(--ring-color);border-radius:50%;position:absolute;bottom:0;right:0}:host([shape=square]) .status{bottom:-2px;right:-2px}:host([status=online]) .status{background:var(--jl-ok)}:host([status=busy]) .status{background:var(--jl-danger)}:host([status=away]) .status{background:var(--jl-warn)}";
|
|
2
|
+
var jl_avatar_default = ":host{vertical-align:middle;--size:32px;--ring:0px;--ring-color:var(--jl-surface);--fg:var(--jl-text-2);--bg:var(--jl-surface-3);flex:none;display:inline-flex}:host([size=sm]){--size:24px}:host([size=lg]){--size:40px}:host([size=xl]){--size:56px}:host([tone=accent]){--fg:var(--jl-accent);--bg:var(--jl-accent-soft)}:host([tone=ok]){--fg:var(--jl-ok);--bg:var(--jl-ok-soft)}:host([tone=warn]){--fg:var(--jl-warn);--bg:var(--jl-warn-soft)}:host([tone=danger]){--fg:var(--jl-danger);--bg:var(--jl-danger-soft)}.avatar{width:var(--size);height:var(--size);display:inline-flex;position:relative}.face{background:var(--bg);width:100%;height:100%;color:var(--fg);font-size:calc(var(--size) * .38);letter-spacing:.01em;white-space:nowrap;box-shadow:0 0 0 var(--ring) var(--ring-color);-webkit-user-select:none;user-select:none;border-radius:50%;justify-content:center;align-items:center;font-weight:700;line-height:1;display:inline-flex;overflow:hidden}:host([shape=square]) .face{border-radius:calc(var(--size) * .25)}:host([has-image]) .face{background:var(--jl-surface-3)}img{object-fit:cover;width:100%;height:100%}.status{width:max(7px, calc(var(--size) * .26));height:max(7px, calc(var(--size) * .26));background:var(--jl-faint);box-shadow:0 0 0 2px var(--ring-color);border-radius:50%;position:absolute;bottom:0;right:0}:host([shape=square]) .status{bottom:-2px;right:-2px}:host([status=online]) .status{background:var(--jl-ok)}:host([status=busy]) .status{background:var(--jl-danger)}:host([status=away]) .status{background:var(--jl-warn)}.fallback{--icon-size:16px}:host([size=sm]) .fallback{--icon-size:13px}:host([size=lg]) .fallback{--icon-size:20px}:host([size=xl]) .fallback{--icon-size:28px}";
|
|
3
3
|
export { jl_avatar_default as default };
|
package/dist/atoms/jl-avatar.js
CHANGED
|
@@ -40,12 +40,6 @@ var STATUS_LABELS = {
|
|
|
40
40
|
offline: "offline",
|
|
41
41
|
online: "online"
|
|
42
42
|
};
|
|
43
|
-
var ICON_SIZES = {
|
|
44
|
-
lg: 20,
|
|
45
|
-
md: 16,
|
|
46
|
-
sm: 13,
|
|
47
|
-
xl: 28
|
|
48
|
-
};
|
|
49
43
|
var FALLBACK_ICON = "user";
|
|
50
44
|
/**
|
|
51
45
|
* A person or a team: their picture, or their initials on a colour the name always picks. A `status` dot tells
|
|
@@ -100,7 +94,6 @@ var JlAvatar = class extends JlElement {
|
|
|
100
94
|
}),
|
|
101
95
|
/* @__PURE__ */ jsx(JlIcon, {
|
|
102
96
|
class: "fallback",
|
|
103
|
-
name: FALLBACK_ICON,
|
|
104
97
|
hidden: true
|
|
105
98
|
}),
|
|
106
99
|
/* @__PURE__ */ jsx("slot", {})
|
|
@@ -143,11 +136,11 @@ var JlAvatar = class extends JlElement {
|
|
|
143
136
|
this._refs.slot.hidden = image;
|
|
144
137
|
this._refs.initials.hidden = image || custom || !hasInitials;
|
|
145
138
|
this._refs.icon.hidden = image || custom || hasInitials;
|
|
139
|
+
if (!this._refs.icon.hidden) this._refs.icon.name.set(FALLBACK_ICON);
|
|
146
140
|
this.reflect("has-image", image);
|
|
147
141
|
}
|
|
148
142
|
renderSize(size) {
|
|
149
143
|
this.reflect("size", size);
|
|
150
|
-
this._refs.icon.size.set(ICON_SIZES[size]);
|
|
151
144
|
}
|
|
152
145
|
renderStatus(status) {
|
|
153
146
|
this._refs.status.hidden = status === "";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-button.css?inline
|
|
2
|
-
var jl_button_default = ":host{vertical-align:middle;--height:var(--jl-control-md);--pad:14px;--font-size:var(--jl-font-md);--radius:var(--jl-radius-sm);display:inline-flex}:host([size=sm]){--height:var(--jl-control-sm);--pad:11px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:var(--jl-control-lg);--pad:18px;--font-size:15px;--radius:var(--jl-radius)}:host([block]){display:flex}.content{display:contents}.base{height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--radius);background:var(--jl-surface);color:var(--jl-text);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:1;justify-content:center;align-items:center;gap:8px;font-weight:600;line-height:1;text-decoration:none;display:inline-flex}:host([icon-only]) .base{width:var(--height);padding:0}.base:hover{background:var(--jl-surface-2)}.base:active{background:var(--jl-surface-3)}:host([variant=primary]) .base{background:var(--jl-accent);color:var(--jl-on-accent);border-color:#0000}:host([variant=primary]) .base:hover{background:var(--jl-accent-strong)}:host([variant=ghost]) .base{color:var(--jl-accent);background:0 0;border-color:#0000}:host([variant=ghost]) .base:hover{background:var(--jl-accent-soft)}:host([variant=danger]) .base{background:var(--jl-danger);color:var(--jl-on-danger);border-color:#0000}:host([variant=danger]) .base:hover{background:color-mix(in srgb, var(--jl-danger) 86%, var(--jl-text))}:host([loading]) .base{cursor:progress}.base:disabled,.base[aria-disabled=true]{cursor:not-allowed;opacity:.5}";
|
|
2
|
+
var jl_button_default = ":host{vertical-align:middle;--height:var(--jl-control-md);--pad:14px;--font-size:var(--jl-font-md);--radius:var(--jl-radius-sm);display:inline-flex}:host([size=sm]){--height:var(--jl-control-sm);--pad:11px;--font-size:var(--jl-font-xs)}:host([size=lg]){--height:var(--jl-control-lg);--pad:18px;--font-size:15px;--radius:var(--jl-radius)}:host([block]){display:flex}.content{display:contents}.base{height:var(--height);padding:0 var(--pad);border:1px solid var(--jl-line-strong);border-radius:var(--radius);background:var(--jl-surface);color:var(--jl-text);font-size:var(--font-size);white-space:nowrap;cursor:pointer;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);flex:1;justify-content:center;align-items:center;gap:8px;font-weight:600;line-height:1;text-decoration:none;display:inline-flex}.text:empty{display:none}:host([icon-only]) .base{width:var(--height);padding:0}.base:hover{background:var(--jl-surface-2)}.base:active{background:var(--jl-surface-3)}:host([variant=primary]) .base{background:var(--jl-accent);color:var(--jl-on-accent);border-color:#0000}:host([variant=primary]) .base:hover{background:var(--jl-accent-strong)}:host([variant=ghost]) .base{color:var(--jl-accent);background:0 0;border-color:#0000}:host([variant=ghost]) .base:hover{background:var(--jl-accent-soft)}:host([variant=danger]) .base{background:var(--jl-danger);color:var(--jl-on-danger);border-color:#0000}:host([variant=danger]) .base:hover{background:color-mix(in srgb, var(--jl-danger) 86%, var(--jl-text))}:host([loading]) .base{cursor:progress}.base:disabled,.base[aria-disabled=true]{cursor:not-allowed;opacity:.5}jl-icon{--icon-size:16px}:host([size=sm]) jl-icon{--icon-size:14px}:host([size=lg]) jl-icon{--icon-size:18px}";
|
|
3
3
|
export { jl_button_default as default };
|
package/dist/atoms/jl-button.js
CHANGED
|
@@ -21,7 +21,7 @@ var BUTTON_TYPES = [
|
|
|
21
21
|
"submit",
|
|
22
22
|
"reset"
|
|
23
23
|
];
|
|
24
|
-
var
|
|
24
|
+
var SPINNER_SIZES = {
|
|
25
25
|
lg: 18,
|
|
26
26
|
md: 16,
|
|
27
27
|
sm: 14
|
|
@@ -152,7 +152,8 @@ var JlButton = class extends JlElement {
|
|
|
152
152
|
const isLink = href !== "";
|
|
153
153
|
const target = this.target.get();
|
|
154
154
|
const off = isLink && this.disabled.get();
|
|
155
|
-
this.control()
|
|
155
|
+
const control = this.control();
|
|
156
|
+
if (content.parentNode !== control) control.append(content);
|
|
156
157
|
button.hidden = isLink;
|
|
157
158
|
link.hidden = !isLink;
|
|
158
159
|
setOrRemove(link, "href", isLink && !off ? href : "");
|
|
@@ -178,9 +179,7 @@ var JlButton = class extends JlElement {
|
|
|
178
179
|
}
|
|
179
180
|
renderSize(size) {
|
|
180
181
|
this.reflect("size", size);
|
|
181
|
-
this._refs.
|
|
182
|
-
this._refs.end.size.set(ICON_SIZES[size]);
|
|
183
|
-
this._refs.spinner.size.set(ICON_SIZES[size]);
|
|
182
|
+
this._refs.spinner.size.set(SPINNER_SIZES[size]);
|
|
184
183
|
}
|
|
185
184
|
hasSlottedContent() {
|
|
186
185
|
return this._refs.slot.assignedNodes().some((node) => node.textContent?.trim() !== "" || node instanceof Element);
|
|
@@ -190,7 +189,6 @@ var JlButton = class extends JlElement {
|
|
|
190
189
|
const hint = this.hint.get();
|
|
191
190
|
const iconOnly = label === "" && !this.hasSlottedContent();
|
|
192
191
|
this._refs.label.textContent = label;
|
|
193
|
-
this._refs.label.hidden = label === "";
|
|
194
192
|
this.reflect("icon-only", iconOnly);
|
|
195
193
|
for (const control of [this._refs.button, this._refs.link]) {
|
|
196
194
|
setOrRemove(control, "title", hint);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-checkbox.css?inline
|
|
2
|
-
var jl_checkbox_default = ":host{vertical-align:middle;--box:18px;display:inline-flex}.wrap{color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;align-items:flex-start;gap:10px;line-height:20px;display:inline-flex}.box{width:var(--box);height:var(--box);flex:none;margin-top:1px;display:inline-flex;position:relative}.native{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-xs);background:var(--jl-surface);width:100%;height:100%;cursor:inherit;appearance:none;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);margin:0;position:absolute;inset:0}.wrap:hover .native:not(:disabled){border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.native:checked,.native:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.wrap:hover .native:checked:not(:disabled),.wrap:hover .native:indeterminate:not(:disabled){border-color:var(--jl-accent-strong);background:var(--jl-accent-strong)}.mark{color:var(--jl-on-accent);pointer-events:none;justify-content:center;align-items:center;display:none;position:absolute;inset:0}.native:checked:not(:indeterminate)~.check,.native:indeterminate~.dash{display:flex}.text{align-self:baseline;gap:2px;display:grid}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:18px}:host([disabled]) .wrap,:host(:disabled) .wrap{cursor:not-allowed;opacity:.5}:host([disabled]) .native:not(:checked,:indeterminate),:host(:disabled) .native:not(:checked,:indeterminate){background:var(--jl-surface-2)}";
|
|
2
|
+
var jl_checkbox_default = ":host{vertical-align:middle;--box:18px;display:inline-flex}.wrap{color:var(--jl-text);font-size:var(--jl-font-md);cursor:pointer;align-items:flex-start;gap:10px;line-height:20px;display:inline-flex}.box{width:var(--box);height:var(--box);flex:none;margin-top:1px;display:inline-flex;position:relative}.native{border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-xs);background:var(--jl-surface);width:100%;height:100%;cursor:inherit;appearance:none;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), box-shadow var(--jl-fast) var(--jl-ease);margin:0;position:absolute;inset:0}.wrap:hover .native:not(:disabled){border-color:color-mix(in srgb, var(--jl-line-strong) 60%, var(--jl-text) 18%)}.native:checked,.native:indeterminate{border-color:var(--jl-accent);background:var(--jl-accent)}.wrap:hover .native:checked:not(:disabled),.wrap:hover .native:indeterminate:not(:disabled){border-color:var(--jl-accent-strong);background:var(--jl-accent-strong)}.mark{color:var(--jl-on-accent);pointer-events:none;justify-content:center;align-items:center;display:none;position:absolute;inset:0}.native:checked:not(:indeterminate)~.check,.native:indeterminate~.dash{display:flex}.text{align-self:baseline;gap:2px;display:grid}.label:empty,.description:empty{display:none}.description{color:var(--jl-muted);font-size:var(--jl-font-sm);line-height:18px}:host([disabled]) .wrap,:host(:disabled) .wrap{cursor:not-allowed;opacity:.5}:host([disabled]) .native:not(:checked,:indeterminate),:host(:disabled) .native:not(:checked,:indeterminate){background:var(--jl-surface-2)}";
|
|
3
3
|
export { jl_checkbox_default as default };
|
|
@@ -12,6 +12,8 @@ registerIcons({
|
|
|
12
12
|
minus: Minus
|
|
13
13
|
});
|
|
14
14
|
var ICON_SIZE = 12;
|
|
15
|
+
var CHECK_ICON = "check";
|
|
16
|
+
var DASH_ICON = "minus";
|
|
15
17
|
var DEFAULT_VALUE = "on";
|
|
16
18
|
/**
|
|
17
19
|
* A box to tick, with its label beside it: clicking the label toggles it too. `checked` is the state; the form
|
|
@@ -26,13 +28,11 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
26
28
|
/** The text beside the box; the default slot takes a richer label. */
|
|
27
29
|
label = this.useChange("", (value) => {
|
|
28
30
|
this._refs.label.textContent = value;
|
|
29
|
-
this._refs.label.hidden = value === "";
|
|
30
31
|
this.renderText();
|
|
31
32
|
}, { attribute: "label" });
|
|
32
33
|
/** A smaller line under the label. */
|
|
33
34
|
description = this.useChange("", (value) => {
|
|
34
35
|
this._refs.description.textContent = value;
|
|
35
|
-
this._refs.description.hidden = value === "";
|
|
36
36
|
this.renderText();
|
|
37
37
|
}, { attribute: "description" });
|
|
38
38
|
/** What the form gets while the box is checked. */
|
|
@@ -48,6 +48,8 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
48
48
|
}, { attribute: "disabled" });
|
|
49
49
|
_form = { disabled: false };
|
|
50
50
|
_refs = this.useRefs((ref) => ({
|
|
51
|
+
check: ref(".check"),
|
|
52
|
+
dash: ref(".dash"),
|
|
51
53
|
description: ref(".description"),
|
|
52
54
|
label: ref(".label"),
|
|
53
55
|
native: ref("input"),
|
|
@@ -76,12 +78,10 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
76
78
|
}),
|
|
77
79
|
/* @__PURE__ */ jsx(JlIcon, {
|
|
78
80
|
class: "mark check",
|
|
79
|
-
name: "check",
|
|
80
81
|
size: ICON_SIZE
|
|
81
82
|
}),
|
|
82
83
|
/* @__PURE__ */ jsx(JlIcon, {
|
|
83
84
|
class: "mark dash",
|
|
84
|
-
name: "minus",
|
|
85
85
|
size: ICON_SIZE
|
|
86
86
|
})
|
|
87
87
|
]
|
|
@@ -90,14 +90,10 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
90
90
|
hidden: true,
|
|
91
91
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
92
92
|
class: "title",
|
|
93
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
94
|
-
class: "label",
|
|
95
|
-
hidden: true
|
|
96
|
-
}), /* @__PURE__ */ jsx("slot", {})]
|
|
93
|
+
children: [/* @__PURE__ */ jsx("span", { class: "label" }), /* @__PURE__ */ jsx("slot", {})]
|
|
97
94
|
}), /* @__PURE__ */ jsx("span", {
|
|
98
95
|
id: "description",
|
|
99
|
-
class: "description"
|
|
100
|
-
hidden: true
|
|
96
|
+
class: "description"
|
|
101
97
|
})]
|
|
102
98
|
})]
|
|
103
99
|
});
|
|
@@ -131,6 +127,7 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
131
127
|
renderChecked(checked) {
|
|
132
128
|
const native = this._refs.native;
|
|
133
129
|
if (native.checked !== checked) native.checked = checked;
|
|
130
|
+
if (checked) this._refs.check.name.set(CHECK_ICON);
|
|
134
131
|
this.renderFormValue();
|
|
135
132
|
}
|
|
136
133
|
/** Hides the text column when there is nothing to show, so a lone box has no gap beside it. */
|
|
@@ -140,6 +137,7 @@ var JlCheckbox = class extends JlFormControl {
|
|
|
140
137
|
}
|
|
141
138
|
renderIndeterminate(indeterminate) {
|
|
142
139
|
this._refs.native.indeterminate = indeterminate;
|
|
140
|
+
if (indeterminate) this._refs.dash.name.set(DASH_ICON);
|
|
143
141
|
}
|
|
144
142
|
renderFormValue() {
|
|
145
143
|
this.internals.setFormValue(this.checked.get() ? this.value.get() : null);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-chip.css?inline
|
|
2
|
-
var jl_chip_default = ":host{vertical-align:middle;--height:28px;--pad:10px;--font-size:var(--jl-font-sm);--dismiss:20px;max-width:100%;display:inline-flex}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs);--dismiss:18px}.chip{min-width:0;height:var(--height);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);align-items:center;font-weight:600;line-height:1;display:inline-flex}.main{min-width:0;height:100%;padding:0 var(--pad);border-radius:inherit;align-items:center;gap:6px;display:inline-flex}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.label:empty{display:none}:host([removable]) .main{padding-right:4px}:host([selectable]) .main{cursor:pointer}:host([selectable]:not([disabled])) .chip:hover{background:var(--jl-surface-2)}:host([selected]) .chip,:host([selected][selectable]:not([disabled])) .chip:hover{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.main:focus-visible{box-shadow:none}.chip:has(.main:focus-visible){box-shadow:var(--jl-focus-ring)}.dismiss{width:var(--dismiss);height:var(--dismiss);color:var(--jl-muted);cursor:pointer;background:0 0;border:0;border-radius:50%;flex:none;justify-content:center;align-items:center;margin-right:3px;padding:0;display:inline-flex}.dismiss:hover{background:var(--jl-surface-3);color:var(--jl-text)}:host([selected]) .dismiss{color:var(--jl-accent)}:host([selected]) .dismiss:hover{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent-strong)}:host([disabled]) .chip{opacity:.5}:host([disabled]) .main,:host([disabled]) .dismiss{cursor:not-allowed}:host([disabled]) .dismiss:hover{background:0 0}";
|
|
2
|
+
var jl_chip_default = ":host{vertical-align:middle;--height:28px;--pad:10px;--font-size:var(--jl-font-sm);--dismiss:20px;max-width:100%;display:inline-flex}:host([size=sm]){--height:24px;--pad:8px;--font-size:var(--jl-font-xs);--dismiss:18px}.chip{min-width:0;height:var(--height);border:1px solid var(--jl-line-strong);border-radius:var(--jl-radius-pill);background:var(--jl-surface);color:var(--jl-text-2);font-size:var(--font-size);white-space:nowrap;transition:background var(--jl-fast) var(--jl-ease), border-color var(--jl-fast) var(--jl-ease), color var(--jl-fast) var(--jl-ease);align-items:center;font-weight:600;line-height:1;display:inline-flex}.main{min-width:0;height:100%;padding:0 var(--pad);border-radius:inherit;align-items:center;gap:6px;display:inline-flex}.label{text-overflow:ellipsis;line-height:1.4;overflow:hidden}.label:empty{display:none}:host([removable]) .main{padding-right:4px}:host([selectable]) .main{cursor:pointer}:host([selectable]:not([disabled])) .chip:hover{background:var(--jl-surface-2)}:host([selected]) .chip,:host([selected][selectable]:not([disabled])) .chip:hover{border-color:var(--jl-accent-line);background:var(--jl-accent-soft);color:var(--jl-accent)}.main:focus-visible{box-shadow:none}.chip:has(.main:focus-visible){box-shadow:var(--jl-focus-ring)}.dismiss{width:var(--dismiss);height:var(--dismiss);color:var(--jl-muted);cursor:pointer;background:0 0;border:0;border-radius:50%;flex:none;justify-content:center;align-items:center;margin-right:3px;padding:0;display:inline-flex}.dismiss:hover{background:var(--jl-surface-3);color:var(--jl-text)}:host([selected]) .dismiss{color:var(--jl-accent)}:host([selected]) .dismiss:hover{background:color-mix(in srgb, var(--jl-accent) 14%, transparent);color:var(--jl-accent-strong)}:host([disabled]) .chip{opacity:.5}:host([disabled]) .main,:host([disabled]) .dismiss{cursor:not-allowed}:host([disabled]) .dismiss:hover{background:0 0}.icon{--icon-size:14px}.dismiss jl-icon{--icon-size:13px}:host([size=sm]) jl-icon{--icon-size:12px}";
|
|
3
3
|
export { jl_chip_default as default };
|
package/dist/atoms/jl-chip.js
CHANGED
|
@@ -15,16 +15,9 @@ registerIcons({
|
|
|
15
15
|
x: X
|
|
16
16
|
});
|
|
17
17
|
var CHIP_SIZES = ["md", "sm"];
|
|
18
|
-
var ICON_SIZES = {
|
|
19
|
-
md: 14,
|
|
20
|
-
sm: 12
|
|
21
|
-
};
|
|
22
|
-
var DISMISS_ICON_SIZES = {
|
|
23
|
-
md: 13,
|
|
24
|
-
sm: 12
|
|
25
|
-
};
|
|
26
18
|
var DISMISS_KEYS = ["Backspace", "Delete"];
|
|
27
19
|
var SELECTED_ICON = "check";
|
|
20
|
+
var DISMISS_ICON = "x";
|
|
28
21
|
/**
|
|
29
22
|
* A compact token: a filter people turn on and off (`selectable`), a tag they can take away (`removable`), or a
|
|
30
23
|
* plain label. Fires `change` with the new state when pressed, and `dismiss` when its × is.
|
|
@@ -48,6 +41,7 @@ var JlChip = class extends JlElement {
|
|
|
48
41
|
/** Shows an × that fires `dismiss`; the page takes the chip away. */
|
|
49
42
|
removable = this.useChange(false, (value) => {
|
|
50
43
|
this._refs.dismiss.hidden = !value;
|
|
44
|
+
if (value) this._refs.dismissIcon.name.set(DISMISS_ICON);
|
|
51
45
|
this.reflect("removable", value);
|
|
52
46
|
}, { attribute: "removable" });
|
|
53
47
|
disabled = this.useChange(false, (value) => {
|
|
@@ -93,7 +87,7 @@ var JlChip = class extends JlElement {
|
|
|
93
87
|
class: "dismiss",
|
|
94
88
|
type: "button",
|
|
95
89
|
hidden: true,
|
|
96
|
-
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
90
|
+
children: /* @__PURE__ */ jsx(JlIcon, {})
|
|
97
91
|
})]
|
|
98
92
|
});
|
|
99
93
|
}
|
|
@@ -159,8 +153,6 @@ var JlChip = class extends JlElement {
|
|
|
159
153
|
}
|
|
160
154
|
renderSize(size) {
|
|
161
155
|
this.reflect("size", size);
|
|
162
|
-
this._refs.icon.size.set(ICON_SIZES[size]);
|
|
163
|
-
this._refs.dismissIcon.size.set(DISMISS_ICON_SIZES[size]);
|
|
164
156
|
}
|
|
165
157
|
};
|
|
166
158
|
JlChip.register();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-divider.css?inline
|
|
2
|
-
var jl_divider_default = ":host{--color:var(--jl-line);--thickness:1px;--gap:12px;display:block}:host([vertical]){vertical-align:middle;align-self:stretch;min-height:1em;display:inline-flex}.divider{align-items:center;gap:var(--gap);width:100%;display:flex}:host([vertical]) .divider{flex-direction:column;width:auto;height:auto}.line{height:var(--thickness);background:var(--color);flex:1}:host([vertical]) .line{width:var(--thickness);height:auto;min-height:4px}:host(:not([labelled])) .after,:host([labelled][align=start]) .before,:host([labelled][align=end]) .after{display:none}.label{max-width:80%;color:var(--jl-muted);font-size:var(--jl-font-xs);text-align:center;flex:none;font-weight:600;line-height:1.4}:host([vertical]) .label{writing-mode:horizontal-tb;max-width:none}";
|
|
2
|
+
var jl_divider_default = ":host{--color:var(--jl-line);--thickness:1px;--gap:12px;display:block}:host([vertical]){vertical-align:middle;align-self:stretch;min-height:1em;display:inline-flex}.divider{align-items:center;gap:var(--gap);width:100%;display:flex}:host([vertical]) .divider{flex-direction:column;width:auto;height:auto}.line{height:var(--thickness);background:var(--color);flex:1}:host([vertical]) .line{width:var(--thickness);height:auto;min-height:4px}:host(:not([labelled])) .after,:host([labelled][align=start]) .before,:host([labelled][align=end]) .after,.label:empty{display:none}.label{max-width:80%;color:var(--jl-muted);font-size:var(--jl-font-xs);text-align:center;flex:none;font-weight:600;line-height:1.4}:host([vertical]) .label{writing-mode:horizontal-tb;max-width:none}";
|
|
3
3
|
export { jl_divider_default as default };
|
package/dist/atoms/jl-divider.js
CHANGED
|
@@ -19,7 +19,6 @@ var JlDivider = class extends JlElement {
|
|
|
19
19
|
static selector = "jl-divider";
|
|
20
20
|
label = this.useChange("", (value) => {
|
|
21
21
|
this._refs.label.textContent = value;
|
|
22
|
-
this._refs.label.hidden = value === "";
|
|
23
22
|
this.reflect("labelled", value !== "");
|
|
24
23
|
setOrRemove(this._refs.divider, "aria-label", value);
|
|
25
24
|
}, { attribute: "label" });
|
|
@@ -43,10 +42,7 @@ var JlDivider = class extends JlElement {
|
|
|
43
42
|
attrs: { part: "base" },
|
|
44
43
|
children: [
|
|
45
44
|
/* @__PURE__ */ jsx("span", { class: "line before" }),
|
|
46
|
-
/* @__PURE__ */ jsx("span", {
|
|
47
|
-
class: "label",
|
|
48
|
-
hidden: true
|
|
49
|
-
}),
|
|
45
|
+
/* @__PURE__ */ jsx("span", { class: "label" }),
|
|
50
46
|
/* @__PURE__ */ jsx("span", { class: "line after" })
|
|
51
47
|
]
|
|
52
48
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-icon.css?inline
|
|
2
|
-
var jl_icon_default = ":host{--cutout:var(--jl-surface);vertical-align:middle;flex:none;line-height:0;display:inline-flex}.icon{display:inline-flex}:host([filled]) svg>:first-child{fill:currentColor}:host([filled]) svg>:not(:first-child){stroke:var(--cutout)}";
|
|
2
|
+
var jl_icon_default = ":host{--cutout:var(--jl-surface);vertical-align:middle;flex:none;line-height:0;display:inline-flex}.icon{display:inline-flex}.icon>svg{width:var(--icon-size,var(--size));height:var(--icon-size,var(--size))}:host([filled]) svg>:first-child{fill:currentColor}:host([filled]) svg>:not(:first-child){stroke:var(--cutout)}";
|
|
3
3
|
export { jl_icon_default as default };
|
package/dist/atoms/jl-icon.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class JlIcon extends JlElement {
|
|
|
10
10
|
get(): string;
|
|
11
11
|
set(setter: string | ((prevState: string) => string)): void;
|
|
12
12
|
}>>;
|
|
13
|
+
/** Its width and height in pixels, which the CSS gives the SVG: a new size draws nothing again. */
|
|
13
14
|
readonly size: Readonly<Readonly<{
|
|
14
15
|
get(): number;
|
|
15
16
|
set(setter: number | ((prevState: number) => number)): void;
|
|
@@ -23,6 +24,7 @@ export declare class JlIcon extends JlElement {
|
|
|
23
24
|
get(): boolean;
|
|
24
25
|
set(setter: boolean | ((prevState: boolean) => boolean)): void;
|
|
25
26
|
}>>;
|
|
27
|
+
private readonly _drawn;
|
|
26
28
|
private readonly _refs;
|
|
27
29
|
templateHtml(): Node;
|
|
28
30
|
templateCss(): string;
|
package/dist/atoms/jl-icon.js
CHANGED
|
@@ -14,10 +14,12 @@ var DEFAULT_SIZE = 16;
|
|
|
14
14
|
var JlIcon = class extends JlElement {
|
|
15
15
|
static selector = "jl-icon";
|
|
16
16
|
name = this.useChange("", () => this.draw(), { attribute: "name" });
|
|
17
|
-
|
|
17
|
+
/** Its width and height in pixels, which the CSS gives the SVG: a new size draws nothing again. */
|
|
18
|
+
size = this.useChange(DEFAULT_SIZE, (value) => this._refs.icon.style.setProperty("--size", `${value}px`), { attribute: "size" });
|
|
18
19
|
label = this.useChange("", (value) => this.setAccessibleName(value), { attribute: "label" });
|
|
19
20
|
/** The icon's first shape (the circle or triangle around a sign) in solid colour, the sign cut out of it. */
|
|
20
21
|
filled = this.useChange(false, (value) => this.reflect("filled", value), { attribute: "filled" });
|
|
22
|
+
_drawn = { name: "" };
|
|
21
23
|
_refs = this.useRefs((ref) => ({ icon: ref(".icon") }));
|
|
22
24
|
templateHtml() {
|
|
23
25
|
return /* @__PURE__ */ jsx("span", { class: "icon" });
|
|
@@ -27,6 +29,7 @@ var JlIcon = class extends JlElement {
|
|
|
27
29
|
}
|
|
28
30
|
draw() {
|
|
29
31
|
const name = this.name.get();
|
|
32
|
+
if (name === this._drawn.name) return;
|
|
30
33
|
if (name !== "" && !hasIcon(name)) {
|
|
31
34
|
this._refs.icon.replaceChildren();
|
|
32
35
|
queueMicrotask(() => this.drawNow());
|
|
@@ -37,6 +40,7 @@ var JlIcon = class extends JlElement {
|
|
|
37
40
|
drawNow() {
|
|
38
41
|
const name = this.name.get();
|
|
39
42
|
this._refs.icon.replaceChildren(...name === "" ? [] : [iconElement(name, this.size.get())]);
|
|
43
|
+
this._drawn.name = name === "" || hasIcon(name) ? name : "";
|
|
40
44
|
}
|
|
41
45
|
setAccessibleName(label) {
|
|
42
46
|
const icon = this._refs.icon;
|
package/dist/atoms/jl-input.d.ts
CHANGED
|
@@ -110,13 +110,18 @@ export declare class JlInput extends JlFormControl {
|
|
|
110
110
|
private clearValue;
|
|
111
111
|
protected drawTexts(): void;
|
|
112
112
|
private toggleReveal;
|
|
113
|
-
private renderRevealLabel;
|
|
114
113
|
private renderValue;
|
|
115
114
|
private renderType;
|
|
116
115
|
private renderDisabled;
|
|
117
116
|
/** The native field is disabled by the element's own flag or by a disabled fieldset around it. */
|
|
118
117
|
private syncNativeDisabled;
|
|
119
|
-
|
|
118
|
+
/** The × shows while an editable field holds text; its SVG is drawn the first time it does. */
|
|
119
|
+
private renderClear;
|
|
120
|
+
/** The eye shows for a password only, drawn then, and says what pressing it does to the text. */
|
|
121
|
+
private renderReveal;
|
|
122
|
+
/** An attribute that does not change what the field accepts (a placeholder, a name, a keyboard hint). */
|
|
120
123
|
private setNative;
|
|
124
|
+
/** A constraint on what the field accepts: its validity changes with it. */
|
|
125
|
+
private setConstraint;
|
|
121
126
|
private setFlag;
|
|
122
127
|
}
|
package/dist/atoms/jl-input.js
CHANGED
|
@@ -53,12 +53,12 @@ var JlInput = class extends JlFormControl {
|
|
|
53
53
|
autocomplete = this.useChange("", (value) => this.setNative("autocomplete", value), { attribute: "autocomplete" });
|
|
54
54
|
/** The keyboard a phone shows for the field (`numeric`, `decimal`, `tel`…), as a native input's `inputmode`. */
|
|
55
55
|
inputmode = this.useChange("", (value) => this.setNative("inputmode", value), { attribute: "inputmode" });
|
|
56
|
-
min = this.useChange("", (value) => this.
|
|
57
|
-
max = this.useChange("", (value) => this.
|
|
58
|
-
step = this.useChange("", (value) => this.
|
|
59
|
-
minlength = this.useChange("", (value) => this.
|
|
60
|
-
maxlength = this.useChange("", (value) => this.
|
|
61
|
-
pattern = this.useChange("", (value) => this.
|
|
56
|
+
min = this.useChange("", (value) => this.setConstraint("min", value), { attribute: "min" });
|
|
57
|
+
max = this.useChange("", (value) => this.setConstraint("max", value), { attribute: "max" });
|
|
58
|
+
step = this.useChange("", (value) => this.setConstraint("step", value), { attribute: "step" });
|
|
59
|
+
minlength = this.useChange("", (value) => this.setConstraint("minlength", value), { attribute: "minlength" });
|
|
60
|
+
maxlength = this.useChange("", (value) => this.setConstraint("maxlength", value), { attribute: "maxlength" });
|
|
61
|
+
pattern = this.useChange("", (value) => this.setConstraint("pattern", value), { attribute: "pattern" });
|
|
62
62
|
required = this.useChange(false, (value) => this.setFlag("required", value), { attribute: "required" });
|
|
63
63
|
readonly = this.useChange(false, (value) => this.setFlag("readonly", value), { attribute: "readonly" });
|
|
64
64
|
disabled = this.useChange(false, (value) => this.renderDisabled(value), { attribute: "disabled" });
|
|
@@ -77,10 +77,11 @@ var JlInput = class extends JlFormControl {
|
|
|
77
77
|
this._refs.icon.hidden = name === "";
|
|
78
78
|
}, { attribute: "icon" });
|
|
79
79
|
/** Shows a button that empties the field while it holds text. */
|
|
80
|
-
clearable = this.useChange(false, () => this.
|
|
80
|
+
clearable = this.useChange(false, () => this.renderClear(), { attribute: "clearable" });
|
|
81
81
|
_form = { disabled: false };
|
|
82
82
|
_refs = this.useRefs((ref) => ({
|
|
83
83
|
clear: ref(".clear"),
|
|
84
|
+
clearIcon: ref(".clear jl-icon"),
|
|
84
85
|
icon: ref(".icon"),
|
|
85
86
|
native: ref("input"),
|
|
86
87
|
reveal: ref(".reveal"),
|
|
@@ -113,19 +114,13 @@ var JlInput = class extends JlFormControl {
|
|
|
113
114
|
type: "button",
|
|
114
115
|
tabIndex: -1,
|
|
115
116
|
hidden: true,
|
|
116
|
-
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
117
|
-
name: "x",
|
|
118
|
-
size: ACTION_ICON_SIZE
|
|
119
|
-
})
|
|
117
|
+
children: /* @__PURE__ */ jsx(JlIcon, { size: ACTION_ICON_SIZE })
|
|
120
118
|
}),
|
|
121
119
|
/* @__PURE__ */ jsx("button", {
|
|
122
120
|
class: "action reveal",
|
|
123
121
|
type: "button",
|
|
124
122
|
hidden: true,
|
|
125
|
-
children: /* @__PURE__ */ jsx(JlIcon, {
|
|
126
|
-
name: "eye",
|
|
127
|
-
size: ICON_SIZE
|
|
128
|
-
})
|
|
123
|
+
children: /* @__PURE__ */ jsx(JlIcon, { size: ICON_SIZE })
|
|
129
124
|
}),
|
|
130
125
|
/* @__PURE__ */ jsx("slot", { name: "end" })
|
|
131
126
|
]
|
|
@@ -168,29 +163,23 @@ var JlInput = class extends JlFormControl {
|
|
|
168
163
|
}
|
|
169
164
|
drawTexts() {
|
|
170
165
|
this._refs.clear.setAttribute("aria-label", jlText("clear"));
|
|
171
|
-
this.
|
|
166
|
+
this.renderReveal();
|
|
172
167
|
}
|
|
173
168
|
toggleReveal() {
|
|
174
169
|
const native = this._refs.native;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
this._refs.revealIcon.name.set(revealed ? "eye-off" : "eye");
|
|
178
|
-
this.renderRevealLabel();
|
|
179
|
-
}
|
|
180
|
-
renderRevealLabel() {
|
|
181
|
-
const revealed = this._refs.native.type === REVEALED;
|
|
182
|
-
this._refs.reveal.setAttribute("aria-label", revealed ? jlText("hidePassword") : jlText("showPassword"));
|
|
170
|
+
native.type = native.type === PASSWORD ? REVEALED : PASSWORD;
|
|
171
|
+
this.renderReveal();
|
|
183
172
|
}
|
|
184
173
|
renderValue(value) {
|
|
185
174
|
const native = this._refs.native;
|
|
186
175
|
if (native.value !== value) native.value = value;
|
|
187
176
|
this.internals.setFormValue(value);
|
|
188
177
|
this.mirrorValidity(native);
|
|
189
|
-
this.
|
|
178
|
+
this.renderClear();
|
|
190
179
|
}
|
|
191
180
|
renderType(type) {
|
|
192
181
|
this._refs.native.type = type;
|
|
193
|
-
this.
|
|
182
|
+
this.renderReveal();
|
|
194
183
|
this.mirrorValidity(this._refs.native);
|
|
195
184
|
}
|
|
196
185
|
renderDisabled(disabled) {
|
|
@@ -200,21 +189,37 @@ var JlInput = class extends JlFormControl {
|
|
|
200
189
|
/** The native field is disabled by the element's own flag or by a disabled fieldset around it. */
|
|
201
190
|
syncNativeDisabled() {
|
|
202
191
|
this._refs.native.disabled = this.disabled.get() || this._form.disabled;
|
|
203
|
-
this.
|
|
192
|
+
this.renderClear();
|
|
204
193
|
}
|
|
205
|
-
|
|
194
|
+
/** The × shows while an editable field holds text; its SVG is drawn the first time it does. */
|
|
195
|
+
renderClear() {
|
|
206
196
|
const editable = !this.disabled.get() && !this.readonly.get();
|
|
207
|
-
|
|
208
|
-
|
|
197
|
+
const clear = this._refs.clear;
|
|
198
|
+
clear.hidden = !(this.clearable.get() && editable && this.value.get() !== "");
|
|
199
|
+
if (!clear.hidden) this._refs.clearIcon.name.set("x");
|
|
200
|
+
}
|
|
201
|
+
/** The eye shows for a password only, drawn then, and says what pressing it does to the text. */
|
|
202
|
+
renderReveal() {
|
|
203
|
+
const reveal = this._refs.reveal;
|
|
204
|
+
reveal.hidden = this.type.get() !== PASSWORD;
|
|
205
|
+
if (reveal.hidden) return;
|
|
206
|
+
const revealed = this._refs.native.type === REVEALED;
|
|
207
|
+
this._refs.revealIcon.name.set(revealed ? "eye-off" : "eye");
|
|
208
|
+
reveal.setAttribute("aria-label", jlText(revealed ? "hidePassword" : "showPassword"));
|
|
209
209
|
}
|
|
210
|
+
/** An attribute that does not change what the field accepts (a placeholder, a name, a keyboard hint). */
|
|
210
211
|
setNative(name, value) {
|
|
211
212
|
setOrRemove(this._refs.native, name, value);
|
|
213
|
+
}
|
|
214
|
+
/** A constraint on what the field accepts: its validity changes with it. */
|
|
215
|
+
setConstraint(name, value) {
|
|
216
|
+
this.setNative(name, value);
|
|
212
217
|
this.mirrorValidity(this._refs.native);
|
|
213
218
|
}
|
|
214
219
|
setFlag(name, value) {
|
|
215
220
|
this._refs.native.toggleAttribute(name, value);
|
|
216
221
|
this.reflect(name, value);
|
|
217
|
-
this.
|
|
222
|
+
this.renderClear();
|
|
218
223
|
this.mirrorValidity(this._refs.native);
|
|
219
224
|
}
|
|
220
225
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-link.css?inline
|
|
2
|
-
var jl_link_default = ":host{--color:var(--jl-accent);--hover:var(--jl-accent-strong);--underline:color-mix(in srgb, var(--jl-accent) 40%, transparent);display:inline}:host([variant=muted]){--color:var(--jl-muted);--hover:var(--jl-text);--underline:transparent}:host([variant=quiet]){--underline:transparent}a{color:var(--color);text-decoration:underline;-webkit-text-decoration-color:var(--underline);text-decoration-color:var(--underline);text-underline-offset:.2em;cursor:pointer;transition:color var(--jl-fast) var(--jl-ease), text-decoration-color var(--jl-fast) var(--jl-ease);border-radius:3px;font-weight:600;text-decoration-thickness:1px}a:hover{color:var(--hover);text-decoration-color:currentColor}a:not([href]){cursor:default}:host([interactive]) a:not([href]){cursor:pointer}jl-icon{vertical-align:-.1em;margin-left:.2em}";
|
|
2
|
+
var jl_link_default = ":host{--color:var(--jl-accent);--hover:var(--jl-accent-strong);--underline:color-mix(in srgb, var(--jl-accent) 40%, transparent);display:inline}:host([variant=muted]){--color:var(--jl-muted);--hover:var(--jl-text);--underline:transparent}:host([variant=quiet]){--underline:transparent}a{color:var(--color);text-decoration:underline;-webkit-text-decoration-color:var(--underline);text-decoration-color:var(--underline);text-underline-offset:.2em;cursor:pointer;transition:color var(--jl-fast) var(--jl-ease), text-decoration-color var(--jl-fast) var(--jl-ease);border-radius:3px;font-weight:600;text-decoration-thickness:1px}a:hover{color:var(--hover);text-decoration-color:currentColor}a:not([href]){cursor:default}:host([interactive]) a:not([href]){cursor:pointer}.label:empty{display:none}jl-icon{vertical-align:-.1em;margin-left:.2em}";
|
|
3
3
|
export { jl_link_default as default };
|
package/dist/atoms/jl-link.js
CHANGED
|
@@ -18,6 +18,7 @@ var LINK_VARIANTS = [
|
|
|
18
18
|
var NEW_TAB = "_blank";
|
|
19
19
|
var SAFE_REL = "noopener noreferrer";
|
|
20
20
|
var ICON_SIZE = 13;
|
|
21
|
+
var EXTERNAL_ICON = "external-link";
|
|
21
22
|
var ENTER = "Enter";
|
|
22
23
|
/**
|
|
23
24
|
* A link in text or in a list: the browser's own `<a>`, styled. `external` opens it in a new tab, safely, with an
|
|
@@ -30,7 +31,6 @@ var JlLink = class extends JlElement {
|
|
|
30
31
|
href = this.useChange("", () => this.renderInteraction(), { attribute: "href" });
|
|
31
32
|
label = this.useChange("", (value) => {
|
|
32
33
|
this._refs.label.textContent = value;
|
|
33
|
-
this._refs.label.hidden = value === "";
|
|
34
34
|
}, { attribute: "label" });
|
|
35
35
|
/** Where it opens, as an `<a>`'s `target`: `_blank` for a new tab. */
|
|
36
36
|
target = this.useChange("", () => this.renderTarget(), { attribute: "target" });
|
|
@@ -58,13 +58,9 @@ var JlLink = class extends JlElement {
|
|
|
58
58
|
return /* @__PURE__ */ jsxs("a", {
|
|
59
59
|
attrs: { part: "base" },
|
|
60
60
|
children: [
|
|
61
|
-
/* @__PURE__ */ jsx("span", {
|
|
62
|
-
class: "label",
|
|
63
|
-
hidden: true
|
|
64
|
-
}),
|
|
61
|
+
/* @__PURE__ */ jsx("span", { class: "label" }),
|
|
65
62
|
/* @__PURE__ */ jsx("slot", {}),
|
|
66
63
|
/* @__PURE__ */ jsx(JlIcon, {
|
|
67
|
-
name: "external-link",
|
|
68
64
|
size: ICON_SIZE,
|
|
69
65
|
hidden: true
|
|
70
66
|
}),
|
|
@@ -111,6 +107,7 @@ var JlLink = class extends JlElement {
|
|
|
111
107
|
setOrRemove(anchor, "target", target);
|
|
112
108
|
setOrRemove(anchor, "rel", external || newTab ? SAFE_REL : "");
|
|
113
109
|
this._refs.icon.hidden = !external;
|
|
110
|
+
if (external) this._refs.icon.name.set(EXTERNAL_ICON);
|
|
114
111
|
this._refs.newTab.hidden = !newTab;
|
|
115
112
|
}
|
|
116
113
|
};
|
|
@@ -2,7 +2,8 @@ import { BASE_STYLES } from "../styles/shared.js";
|
|
|
2
2
|
import { JlElement } from "../base/jl-element.js";
|
|
3
3
|
import { oneOf } from "../lib/attributes.js";
|
|
4
4
|
import { svgElement } from "../lib/dom.js";
|
|
5
|
-
import {
|
|
5
|
+
import { parseNumber } from "../lib/numeric.js";
|
|
6
|
+
import { percentLabel, percentOf, progressRatio, ringGeometry } from "../lib/progress.js";
|
|
6
7
|
import { PROGRESS_TONES } from "./jl-progress.js";
|
|
7
8
|
import jl_progress_ring_default from "./jl-progress-ring.css.js";
|
|
8
9
|
import { css } from "@jadis/core";
|
|
@@ -22,7 +23,7 @@ var JlProgressRing = class extends JlElement {
|
|
|
22
23
|
/** How much is done, out of `max`; `null` (no attribute) for work of unknown length. */
|
|
23
24
|
value = this.useChange(null, () => this.renderValue(), {
|
|
24
25
|
attribute: "value",
|
|
25
|
-
parse:
|
|
26
|
+
parse: parseNumber
|
|
26
27
|
});
|
|
27
28
|
max = this.useChange(DEFAULT_MAX, () => this.renderValue(), { attribute: "max" });
|
|
28
29
|
/** The ring's width and height, in pixels. */
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
2
|
import { JlElement } from "../base/jl-element.js";
|
|
3
3
|
import { oneOf } from "../lib/attributes.js";
|
|
4
|
-
import {
|
|
4
|
+
import { parseNumber } from "../lib/numeric.js";
|
|
5
|
+
import { percentLabel, percentOf, progressRatio } from "../lib/progress.js";
|
|
5
6
|
import jl_progress_default from "./jl-progress.css.js";
|
|
6
7
|
import { css } from "@jadis/core";
|
|
7
8
|
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
@@ -24,7 +25,7 @@ var JlProgress = class extends JlElement {
|
|
|
24
25
|
/** How much is done, out of `max`; `null` (no attribute) for work of unknown length. */
|
|
25
26
|
value = this.useChange(null, () => this.render(), {
|
|
26
27
|
attribute: "value",
|
|
27
|
-
parse:
|
|
28
|
+
parse: parseNumber
|
|
28
29
|
});
|
|
29
30
|
max = this.useChange(DEFAULT_MAX, () => this.render(), { attribute: "max" });
|
|
30
31
|
tone = this.useChange("accent", (value) => this.reflect("tone", value), {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// src/atoms/jl-rating.css?inline
|
|
2
|
-
var jl_rating_default = ":host{vertical-align:middle;--color:var(--jl-accent);--empty:var(--jl-faint);display:inline-flex}.rating{border-radius:var(--jl-radius-xs);cursor:pointer;padding:2px;display:inline-flex}.icons{gap:2px;display:inline-flex}.icon{color:var(--empty);transition:color var(--jl-fast) var(--jl-ease), transform var(--jl-fast) var(--jl-ease);display:inline-flex}.icon svg{fill:#0000;transition:fill var(--jl-fast) var(--jl-ease)}.icon.on{color:var(--color)}.icon.on svg{fill:currentColor}:host([
|
|
2
|
+
var jl_rating_default = ":host{vertical-align:middle;--color:var(--jl-accent);--empty:var(--jl-faint);--icon-size:20px;display:inline-flex}:host([size=sm]){--icon-size:16px}:host([size=lg]){--icon-size:26px}.rating{border-radius:var(--jl-radius-xs);cursor:pointer;padding:2px;display:inline-flex}.icons{gap:2px;display:inline-flex}.icon{color:var(--empty);transition:color var(--jl-fast) var(--jl-ease), transform var(--jl-fast) var(--jl-ease);display:inline-flex}.icon svg{width:var(--icon-size);height:var(--icon-size);fill:#0000;transition:fill var(--jl-fast) var(--jl-ease)}.icon.on{color:var(--color)}.icon.on svg{fill:currentColor}:host(:not([readonly]):not([disabled])) .icon:hover{transform:scale(1.12)}:host([invalid]) .icon:not(.on){color:var(--jl-danger)}@media (hover:hover){:host(:not([readonly],[disabled],:disabled)) .icon:is(:hover,:has(~.icon:hover)){color:color-mix(in srgb, var(--color) 55%, transparent)}:host(:not([readonly],[disabled],:disabled)) .icon:is(:hover,:has(~.icon:hover)) svg{fill:currentColor}:host(:not([readonly],[disabled],:disabled)) .icon:hover~.icon{color:var(--empty)}:host(:not([readonly],[disabled],:disabled)[invalid]) .icon:hover~.icon{color:var(--jl-danger)}:host(:not([readonly],[disabled],:disabled)) .icon:hover~.icon svg{fill:#0000}}:host([readonly]) .rating{cursor:default}:host([disabled]) .rating{cursor:not-allowed;opacity:.5}";
|
|
3
3
|
export { jl_rating_default as default };
|
|
@@ -60,15 +60,15 @@ export declare class JlRating extends JlFormControl {
|
|
|
60
60
|
private canChange;
|
|
61
61
|
private onKey;
|
|
62
62
|
private onChoose;
|
|
63
|
-
private onHover;
|
|
64
63
|
private iconValueAt;
|
|
65
|
-
private setPreview;
|
|
66
64
|
/** The value as the scale shows it: never past its end. */
|
|
67
65
|
private current;
|
|
68
66
|
private commit;
|
|
69
67
|
protected drawTexts(): void;
|
|
70
68
|
private renderLabel;
|
|
69
|
+
/** Draws the row of icons again only for another icon or another count. */
|
|
71
70
|
private renderIcons;
|
|
71
|
+
/** The score, in the icons and for screen readers; the score a pointer would give is the CSS's. */
|
|
72
72
|
private renderValue;
|
|
73
73
|
private renderValidity;
|
|
74
74
|
private renderDisabled;
|