@syware/jlib 0.0.0-stage → 0.1.3
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/LICENSE +21 -0
- package/README.md +133 -2
- package/dist/all.d.ts +1 -0
- package/dist/all.js +75 -0
- package/dist/atoms/jl-avatar.css_raw.js +3 -0
- package/dist/atoms/jl-avatar.d.ts +52 -0
- package/dist/atoms/jl-avatar.js +167 -0
- package/dist/atoms/jl-badge.css_raw.js +3 -0
- package/dist/atoms/jl-badge.d.ts +32 -0
- package/dist/atoms/jl-badge.js +60 -0
- package/dist/atoms/jl-button.css_raw.js +3 -0
- package/dist/atoms/jl-button.d.ts +70 -0
- package/dist/atoms/jl-button.js +146 -0
- package/dist/atoms/jl-checkbox.css_raw.js +3 -0
- package/dist/atoms/jl-checkbox.d.ts +61 -0
- package/dist/atoms/jl-checkbox.js +149 -0
- package/dist/atoms/jl-chip.css_raw.js +3 -0
- package/dist/atoms/jl-chip.d.ts +59 -0
- package/dist/atoms/jl-chip.js +164 -0
- package/dist/atoms/jl-divider.css_raw.js +3 -0
- package/dist/atoms/jl-divider.d.ts +26 -0
- package/dist/atoms/jl-divider.js +59 -0
- package/dist/atoms/jl-icon.css_raw.js +3 -0
- package/dist/atoms/jl-icon.d.ts +25 -0
- package/dist/atoms/jl-icon.js +41 -0
- package/dist/atoms/jl-input.css_raw.js +3 -0
- package/dist/atoms/jl-input.d.ts +112 -0
- package/dist/atoms/jl-input.js +202 -0
- package/dist/atoms/jl-kbd.css_raw.js +3 -0
- package/dist/atoms/jl-kbd.d.ts +17 -0
- package/dist/atoms/jl-kbd.js +62 -0
- package/dist/atoms/jl-link.css_raw.js +3 -0
- package/dist/atoms/jl-link.d.ts +37 -0
- package/dist/atoms/jl-link.js +86 -0
- package/dist/atoms/jl-progress-ring.css_raw.js +3 -0
- package/dist/atoms/jl-progress-ring.d.ts +49 -0
- package/dist/atoms/jl-progress-ring.js +132 -0
- package/dist/atoms/jl-progress.css_raw.js +3 -0
- package/dist/atoms/jl-progress.d.ts +43 -0
- package/dist/atoms/jl-progress.js +109 -0
- package/dist/atoms/jl-rating.css_raw.js +3 -0
- package/dist/atoms/jl-rating.d.ts +73 -0
- package/dist/atoms/jl-rating.js +184 -0
- package/dist/atoms/jl-select.css_raw.js +3 -0
- package/dist/atoms/jl-select.d.ts +70 -0
- package/dist/atoms/jl-select.js +146 -0
- package/dist/atoms/jl-skeleton.css_raw.js +3 -0
- package/dist/atoms/jl-skeleton.d.ts +34 -0
- package/dist/atoms/jl-skeleton.js +63 -0
- package/dist/atoms/jl-slider.css_raw.js +3 -0
- package/dist/atoms/jl-slider.d.ts +65 -0
- package/dist/atoms/jl-slider.js +143 -0
- package/dist/atoms/jl-spinner.css_raw.js +3 -0
- package/dist/atoms/jl-spinner.d.ts +16 -0
- package/dist/atoms/jl-spinner.js +26 -0
- package/dist/atoms/jl-switch.css_raw.js +3 -0
- package/dist/atoms/jl-switch.d.ts +57 -0
- package/dist/atoms/jl-switch.js +125 -0
- package/dist/atoms/jl-textarea.css_raw.js +3 -0
- package/dist/atoms/jl-textarea.d.ts +81 -0
- package/dist/atoms/jl-textarea.js +148 -0
- package/dist/base/jl-element.d.ts +16 -0
- package/dist/base/jl-element.js +35 -0
- package/dist/base/jl-form-control.d.ts +29 -0
- package/dist/base/jl-form-control.js +44 -0
- package/dist/index.d.ts +119 -0
- package/dist/index.js +72 -0
- package/dist/lib/arrow.d.ts +6 -0
- package/dist/lib/arrow.js +15 -0
- package/dist/lib/attributes.d.ts +9 -0
- package/dist/lib/attributes.js +22 -0
- package/dist/lib/avatar.d.ts +11 -0
- package/dist/lib/avatar.js +37 -0
- package/dist/lib/calendar.d.ts +48 -0
- package/dist/lib/calendar.js +166 -0
- package/dist/lib/css-length.d.ts +2 -0
- package/dist/lib/css-length.js +8 -0
- package/dist/lib/define.d.ts +9 -0
- package/dist/lib/define.js +9 -0
- package/dist/lib/dom.d.ts +4 -0
- package/dist/lib/dom.js +16 -0
- package/dist/lib/files.d.ts +18 -0
- package/dist/lib/files.js +89 -0
- package/dist/lib/floating.d.ts +13 -0
- package/dist/lib/floating.js +127 -0
- package/dist/lib/fuzzy.d.ts +26 -0
- package/dist/lib/fuzzy.js +149 -0
- package/dist/lib/highlight.d.ts +5 -0
- package/dist/lib/highlight.js +267 -0
- package/dist/lib/hotkey.d.ts +9 -0
- package/dist/lib/hotkey.js +101 -0
- package/dist/lib/icon-set.d.ts +95 -0
- package/dist/lib/icon-set.js +97 -0
- package/dist/lib/icons.d.ts +12 -0
- package/dist/lib/icons.js +39 -0
- package/dist/lib/indicator.d.ts +6 -0
- package/dist/lib/indicator.js +18 -0
- package/dist/lib/keep-in-view.d.ts +5 -0
- package/dist/lib/keep-in-view.js +15 -0
- package/dist/lib/key-shortcut.d.ts +20 -0
- package/dist/lib/key-shortcut.js +100 -0
- package/dist/lib/keycaps.d.ts +8 -0
- package/dist/lib/keycaps.js +162 -0
- package/dist/lib/locale.d.ts +4 -0
- package/dist/lib/locale.js +13 -0
- package/dist/lib/nav-tree.d.ts +9 -0
- package/dist/lib/nav-tree.js +30 -0
- package/dist/lib/numeric.d.ts +20 -0
- package/dist/lib/numeric.js +50 -0
- package/dist/lib/option-filter.d.ts +29 -0
- package/dist/lib/option-filter.js +108 -0
- package/dist/lib/option-groups.d.ts +6 -0
- package/dist/lib/option-groups.js +26 -0
- package/dist/lib/options.d.ts +5 -0
- package/dist/lib/options.js +24 -0
- package/dist/lib/pagination.d.ts +9 -0
- package/dist/lib/pagination.js +52 -0
- package/dist/lib/palette.d.ts +8 -0
- package/dist/lib/palette.js +46 -0
- package/dist/lib/progress.d.ts +20 -0
- package/dist/lib/progress.js +33 -0
- package/dist/lib/rating.d.ts +7 -0
- package/dist/lib/rating.js +26 -0
- package/dist/lib/roving-index.d.ts +10 -0
- package/dist/lib/roving-index.js +32 -0
- package/dist/lib/roving.d.ts +11 -0
- package/dist/lib/roving.js +21 -0
- package/dist/lib/slots.d.ts +2 -0
- package/dist/lib/slots.js +6 -0
- package/dist/lib/sparkline.d.ts +11 -0
- package/dist/lib/sparkline.js +42 -0
- package/dist/lib/split.d.ts +12 -0
- package/dist/lib/split.js +37 -0
- package/dist/lib/surface.d.ts +7 -0
- package/dist/lib/surface.js +28 -0
- package/dist/lib/table.d.ts +30 -0
- package/dist/lib/table.js +110 -0
- package/dist/lib/tags.d.ts +14 -0
- package/dist/lib/tags.js +29 -0
- package/dist/lib/text.d.ts +5 -0
- package/dist/lib/text.js +13 -0
- package/dist/lib/tokens.d.ts +5 -0
- package/dist/lib/tokens.js +15 -0
- package/dist/lib/tree.d.ts +16 -0
- package/dist/lib/tree.js +89 -0
- package/dist/lib/trend.d.ts +3 -0
- package/dist/lib/trend.js +15 -0
- package/dist/lib/trigger.d.ts +11 -0
- package/dist/lib/trigger.js +34 -0
- package/dist/molecules/jl-accordion-item.css_raw.js +3 -0
- package/dist/molecules/jl-accordion-item.d.ts +34 -0
- package/dist/molecules/jl-accordion-item.js +82 -0
- package/dist/molecules/jl-accordion.css_raw.js +3 -0
- package/dist/molecules/jl-accordion.d.ts +27 -0
- package/dist/molecules/jl-accordion.js +61 -0
- package/dist/molecules/jl-alert.css_raw.js +3 -0
- package/dist/molecules/jl-alert.d.ts +38 -0
- package/dist/molecules/jl-alert.js +131 -0
- package/dist/molecules/jl-avatar-group.css_raw.js +3 -0
- package/dist/molecules/jl-avatar-group.d.ts +28 -0
- package/dist/molecules/jl-avatar-group.js +69 -0
- package/dist/molecules/jl-breadcrumb.css_raw.js +3 -0
- package/dist/molecules/jl-breadcrumb.d.ts +35 -0
- package/dist/molecules/jl-breadcrumb.js +126 -0
- package/dist/molecules/jl-calendar.css_raw.js +3 -0
- package/dist/molecules/jl-calendar.d.ts +101 -0
- package/dist/molecules/jl-calendar.js +314 -0
- package/dist/molecules/jl-card.css_raw.js +3 -0
- package/dist/molecules/jl-card.d.ts +46 -0
- package/dist/molecules/jl-card.js +172 -0
- package/dist/molecules/jl-code-block.css_raw.js +3 -0
- package/dist/molecules/jl-code-block.d.ts +44 -0
- package/dist/molecules/jl-code-block.js +106 -0
- package/dist/molecules/jl-combobox.css_raw.js +3 -0
- package/dist/molecules/jl-combobox.d.ts +120 -0
- package/dist/molecules/jl-combobox.js +450 -0
- package/dist/molecules/jl-copy-button.css_raw.js +3 -0
- package/dist/molecules/jl-copy-button.d.ts +31 -0
- package/dist/molecules/jl-copy-button.js +69 -0
- package/dist/molecules/jl-date-picker.css_raw.js +3 -0
- package/dist/molecules/jl-date-picker.d.ts +109 -0
- package/dist/molecules/jl-date-picker.js +322 -0
- package/dist/molecules/jl-empty.css_raw.js +3 -0
- package/dist/molecules/jl-empty.d.ts +32 -0
- package/dist/molecules/jl-empty.js +94 -0
- package/dist/molecules/jl-field.css_raw.js +3 -0
- package/dist/molecules/jl-field.d.ts +49 -0
- package/dist/molecules/jl-field.js +147 -0
- package/dist/molecules/jl-file-drop.css_raw.js +3 -0
- package/dist/molecules/jl-file-drop.d.ts +93 -0
- package/dist/molecules/jl-file-drop.js +366 -0
- package/dist/molecules/jl-list-item.css_raw.js +3 -0
- package/dist/molecules/jl-list-item.d.ts +56 -0
- package/dist/molecules/jl-list-item.js +176 -0
- package/dist/molecules/jl-menu.css_raw.js +3 -0
- package/dist/molecules/jl-menu.d.ts +62 -0
- package/dist/molecules/jl-menu.js +288 -0
- package/dist/molecules/jl-number-input.css_raw.js +3 -0
- package/dist/molecules/jl-number-input.d.ts +81 -0
- package/dist/molecules/jl-number-input.js +220 -0
- package/dist/molecules/jl-pagination.css_raw.js +3 -0
- package/dist/molecules/jl-pagination.d.ts +59 -0
- package/dist/molecules/jl-pagination.js +172 -0
- package/dist/molecules/jl-popover.css_raw.js +3 -0
- package/dist/molecules/jl-popover.d.ts +49 -0
- package/dist/molecules/jl-popover.js +152 -0
- package/dist/molecules/jl-radio-group.css_raw.js +3 -0
- package/dist/molecules/jl-radio-group.d.ts +71 -0
- package/dist/molecules/jl-radio-group.js +202 -0
- package/dist/molecules/jl-search.css_raw.js +3 -0
- package/dist/molecules/jl-search.d.ts +71 -0
- package/dist/molecules/jl-search.js +210 -0
- package/dist/molecules/jl-segmented.css_raw.js +3 -0
- package/dist/molecules/jl-segmented.d.ts +65 -0
- package/dist/molecules/jl-segmented.js +187 -0
- package/dist/molecules/jl-stat.css_raw.js +3 -0
- package/dist/molecules/jl-stat.d.ts +55 -0
- package/dist/molecules/jl-stat.js +169 -0
- package/dist/molecules/jl-steps.css_raw.js +3 -0
- package/dist/molecules/jl-steps.d.ts +44 -0
- package/dist/molecules/jl-steps.js +118 -0
- package/dist/molecules/jl-tab-panel.css_raw.js +3 -0
- package/dist/molecules/jl-tab-panel.d.ts +35 -0
- package/dist/molecules/jl-tab-panel.js +35 -0
- package/dist/molecules/jl-tabs.css_raw.js +3 -0
- package/dist/molecules/jl-tabs.d.ts +51 -0
- package/dist/molecules/jl-tabs.js +198 -0
- package/dist/molecules/jl-tag-input.css_raw.js +3 -0
- package/dist/molecules/jl-tag-input.d.ts +103 -0
- package/dist/molecules/jl-tag-input.js +429 -0
- package/dist/molecules/jl-timeline.css_raw.js +3 -0
- package/dist/molecules/jl-timeline.d.ts +28 -0
- package/dist/molecules/jl-timeline.js +81 -0
- package/dist/molecules/jl-toast.css_raw.js +3 -0
- package/dist/molecules/jl-toast.d.ts +75 -0
- package/dist/molecules/jl-toast.js +274 -0
- package/dist/molecules/jl-tooltip.css_raw.js +3 -0
- package/dist/molecules/jl-tooltip.d.ts +44 -0
- package/dist/molecules/jl-tooltip.js +160 -0
- package/dist/organisms/jl-command-palette.css_raw.js +3 -0
- package/dist/organisms/jl-command-palette.d.ts +60 -0
- package/dist/organisms/jl-command-palette.js +285 -0
- package/dist/organisms/jl-confirm.css_raw.js +3 -0
- package/dist/organisms/jl-confirm.d.ts +56 -0
- package/dist/organisms/jl-confirm.js +132 -0
- package/dist/organisms/jl-dialog.css_raw.js +3 -0
- package/dist/organisms/jl-dialog.d.ts +43 -0
- package/dist/organisms/jl-dialog.js +120 -0
- package/dist/organisms/jl-drawer.css_raw.js +3 -0
- package/dist/organisms/jl-drawer.d.ts +50 -0
- package/dist/organisms/jl-drawer.js +141 -0
- package/dist/organisms/jl-navbar.css_raw.js +3 -0
- package/dist/organisms/jl-navbar.d.ts +32 -0
- package/dist/organisms/jl-navbar.js +121 -0
- package/dist/organisms/jl-page-header.css_raw.js +3 -0
- package/dist/organisms/jl-page-header.d.ts +26 -0
- package/dist/organisms/jl-page-header.js +85 -0
- package/dist/organisms/jl-side-nav.css_raw.js +3 -0
- package/dist/organisms/jl-side-nav.d.ts +60 -0
- package/dist/organisms/jl-side-nav.js +269 -0
- package/dist/organisms/jl-table.css_raw.js +3 -0
- package/dist/organisms/jl-table.d.ts +109 -0
- package/dist/organisms/jl-table.js +318 -0
- package/dist/organisms/jl-toaster.css_raw.js +3 -0
- package/dist/organisms/jl-toaster.d.ts +48 -0
- package/dist/organisms/jl-toaster.js +142 -0
- package/dist/organisms/jl-tree.css_raw.js +3 -0
- package/dist/organisms/jl-tree.d.ts +59 -0
- package/dist/organisms/jl-tree.js +198 -0
- package/dist/styles/base.css_raw.js +3 -0
- package/dist/styles/control.css_raw.js +3 -0
- package/dist/styles/floating.css_raw.js +3 -0
- package/dist/styles/shared.d.ts +8 -0
- package/dist/styles/shared.js +14 -0
- package/dist/styles/tokens.css_raw.js +3 -0
- package/dist/templates/jl-app-shell.css_raw.js +3 -0
- package/dist/templates/jl-app-shell.d.ts +37 -0
- package/dist/templates/jl-app-shell.js +150 -0
- package/dist/templates/jl-split-view.css_raw.js +3 -0
- package/dist/templates/jl-split-view.d.ts +49 -0
- package/dist/templates/jl-split-view.js +149 -0
- package/dist/tokens.css +188 -0
- package/dist/types/calendar.types.d.ts +11 -0
- package/dist/types/files.types.d.ts +23 -0
- package/dist/types/floating.types.d.ts +13 -0
- package/dist/types/fuzzy.types.d.ts +10 -0
- package/dist/types/highlight.types.d.ts +6 -0
- package/dist/types/hotkey.types.d.ts +19 -0
- package/dist/types/jl-accordion.types.d.ts +2 -0
- package/dist/types/jl-avatar.types.d.ts +10 -0
- package/dist/types/jl-breadcrumb.types.d.ts +6 -0
- package/dist/types/jl-button.types.d.ts +3 -0
- package/dist/types/jl-card.types.d.ts +2 -0
- package/dist/types/jl-chip.types.d.ts +1 -0
- package/dist/types/jl-combobox.types.d.ts +8 -0
- package/dist/types/jl-command-palette.types.d.ts +22 -0
- package/dist/types/jl-confirm.types.d.ts +10 -0
- package/dist/types/jl-dialog.types.d.ts +1 -0
- package/dist/types/jl-divider.types.d.ts +2 -0
- package/dist/types/jl-drawer.types.d.ts +4 -0
- package/dist/types/jl-empty.types.d.ts +2 -0
- package/dist/types/jl-field.types.d.ts +2 -0
- package/dist/types/jl-input.types.d.ts +1 -0
- package/dist/types/jl-link.types.d.ts +2 -0
- package/dist/types/jl-menu.types.d.ts +22 -0
- package/dist/types/jl-navbar.types.d.ts +6 -0
- package/dist/types/jl-progress.types.d.ts +3 -0
- package/dist/types/jl-radio-group.types.d.ts +10 -0
- package/dist/types/jl-segmented.types.d.ts +7 -0
- package/dist/types/jl-select.types.d.ts +12 -0
- package/dist/types/jl-side-nav.types.d.ts +17 -0
- package/dist/types/jl-skeleton.types.d.ts +2 -0
- package/dist/types/jl-slider.types.d.ts +5 -0
- package/dist/types/jl-split-view.types.d.ts +2 -0
- package/dist/types/jl-stat.types.d.ts +2 -0
- package/dist/types/jl-steps.types.d.ts +8 -0
- package/dist/types/jl-switch.types.d.ts +1 -0
- package/dist/types/jl-table.types.d.ts +30 -0
- package/dist/types/jl-tabs.types.d.ts +2 -0
- package/dist/types/jl-timeline.types.d.ts +10 -0
- package/dist/types/jl-toast.types.d.ts +2 -0
- package/dist/types/jl-toaster.types.d.ts +23 -0
- package/dist/types/jl-tree.types.d.ts +26 -0
- package/dist/types/key-shortcut.types.d.ts +9 -0
- package/dist/types/keycaps.types.d.ts +7 -0
- package/dist/types/option-filter.types.d.ts +10 -0
- package/dist/types/options.types.d.ts +4 -0
- package/dist/types/pagination.types.d.ts +8 -0
- package/dist/types/roving-index.types.d.ts +2 -0
- package/dist/types/sparkline.types.d.ts +11 -0
- package/package.json +102 -4
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { BASE_STYLES } from "../styles/shared.js";
|
|
2
|
+
import { JlElement } from "../base/jl-element.js";
|
|
3
|
+
import { clampedNumber, oneOf } from "../lib/attributes.js";
|
|
4
|
+
import { clampMin, clampSplit, positionAfterKey, positionAt } from "../lib/split.js";
|
|
5
|
+
import jl_split_view_default from "./jl-split-view.css_raw.js";
|
|
6
|
+
import { css } from "@jadis/core";
|
|
7
|
+
import { jsx, jsxs } from "@jadis/core/jsx-runtime";
|
|
8
|
+
// src/templates/jl-split-view.tsx
|
|
9
|
+
var SPLIT_ORIENTATIONS = ["horizontal", "vertical"];
|
|
10
|
+
var DEFAULT_POSITION = 50;
|
|
11
|
+
var DEFAULT_MIN = 15;
|
|
12
|
+
var FULL = 100;
|
|
13
|
+
var MAX_MIN = 50;
|
|
14
|
+
var PRIMARY_BUTTON = 0;
|
|
15
|
+
var DEFAULT_LABEL = "Resize the panes";
|
|
16
|
+
var SEPARATOR_ORIENTATION = {
|
|
17
|
+
horizontal: "vertical",
|
|
18
|
+
vertical: "horizontal"
|
|
19
|
+
};
|
|
20
|
+
var parsePosition = clampedNumber(DEFAULT_POSITION, 0, FULL);
|
|
21
|
+
/**
|
|
22
|
+
* Two panes, `start` and `end`, side by side or one above the other, with a divider to drag between them. The
|
|
23
|
+
* divider also moves with the arrows (Shift for large steps), Home and End; a double click puts it back. `position`
|
|
24
|
+
* is the start pane's share, in percent; each pane keeps at least `min` percent.
|
|
25
|
+
*/
|
|
26
|
+
var JlSplitView = class extends JlElement {
|
|
27
|
+
static selector = "jl-split-view";
|
|
28
|
+
/** The new position, in percent, once a drag ends or a key moved the divider. */
|
|
29
|
+
events = this.useEvents();
|
|
30
|
+
orientation = this.useChange("horizontal", (value) => {
|
|
31
|
+
this.reflect("orientation", value);
|
|
32
|
+
this._refs.divider.setAttribute("aria-orientation", SEPARATOR_ORIENTATION[value]);
|
|
33
|
+
}, {
|
|
34
|
+
attribute: "orientation",
|
|
35
|
+
parse: oneOf(SPLIT_ORIENTATIONS, "horizontal")
|
|
36
|
+
});
|
|
37
|
+
/** The start pane's share of the room, in percent. */
|
|
38
|
+
position = this.useChange(DEFAULT_POSITION, () => this.renderPosition(), {
|
|
39
|
+
attribute: "position",
|
|
40
|
+
parse: parsePosition
|
|
41
|
+
});
|
|
42
|
+
/** The smallest share each pane keeps, in percent (0 to 50). */
|
|
43
|
+
min = this.useChange(DEFAULT_MIN, () => this.renderPosition(), {
|
|
44
|
+
attribute: "min",
|
|
45
|
+
parse: clampedNumber(DEFAULT_MIN, 0, MAX_MIN)
|
|
46
|
+
});
|
|
47
|
+
/** The divider's name for screen readers. */
|
|
48
|
+
label = this.useChange(DEFAULT_LABEL, (value) => {
|
|
49
|
+
this._refs.divider.setAttribute("aria-label", value === "" ? DEFAULT_LABEL : value);
|
|
50
|
+
}, { attribute: "label" });
|
|
51
|
+
_drag = { from: DEFAULT_POSITION };
|
|
52
|
+
_refs = this.useRefs((ref) => ({
|
|
53
|
+
divider: ref(".divider"),
|
|
54
|
+
split: ref(".split")
|
|
55
|
+
}));
|
|
56
|
+
/** Puts the divider back where the page first placed it. */
|
|
57
|
+
reset() {
|
|
58
|
+
this.whenRendered(() => this.commit(parsePosition(this.getAttribute("position"))));
|
|
59
|
+
}
|
|
60
|
+
templateHtml() {
|
|
61
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
62
|
+
class: "split",
|
|
63
|
+
attrs: { part: "base" },
|
|
64
|
+
children: [
|
|
65
|
+
/* @__PURE__ */ jsx("div", {
|
|
66
|
+
class: "pane start",
|
|
67
|
+
id: "start",
|
|
68
|
+
attrs: { part: "start" },
|
|
69
|
+
children: /* @__PURE__ */ jsx("slot", { name: "start" })
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ jsx("div", {
|
|
72
|
+
class: "divider",
|
|
73
|
+
role: "separator",
|
|
74
|
+
tabIndex: 0,
|
|
75
|
+
"aria-controls": "start",
|
|
76
|
+
"aria-valuenow": String(DEFAULT_POSITION),
|
|
77
|
+
"aria-valuemin": "0",
|
|
78
|
+
"aria-valuemax": "100",
|
|
79
|
+
attrs: { part: "divider" },
|
|
80
|
+
children: /* @__PURE__ */ jsx("span", { class: "grip" })
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsx("div", {
|
|
83
|
+
class: "pane end",
|
|
84
|
+
attrs: { part: "end" },
|
|
85
|
+
children: /* @__PURE__ */ jsx("slot", { name: "end" })
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
templateCss() {
|
|
91
|
+
return css`${BASE_STYLES}${jl_split_view_default}`;
|
|
92
|
+
}
|
|
93
|
+
onConnect() {
|
|
94
|
+
const divider = this._refs.divider;
|
|
95
|
+
this.on(divider, "pointerdown", (event) => this.startDrag(event));
|
|
96
|
+
this.on(divider, "pointermove", (event) => this.drag(event));
|
|
97
|
+
this.on(divider, "pointerup", (event) => this.endDrag(event));
|
|
98
|
+
this.on(divider, "pointercancel", (event) => this.endDrag(event));
|
|
99
|
+
this.on(divider, "keydown", (event) => this.onKey(event));
|
|
100
|
+
this.on(divider, "dblclick", () => this.reset());
|
|
101
|
+
}
|
|
102
|
+
current() {
|
|
103
|
+
return clampSplit(this.position.get(), this.min.get());
|
|
104
|
+
}
|
|
105
|
+
startDrag(event) {
|
|
106
|
+
if (event.button !== PRIMARY_BUTTON) return;
|
|
107
|
+
event.preventDefault();
|
|
108
|
+
this._refs.divider.setPointerCapture(event.pointerId);
|
|
109
|
+
this._drag.from = this.current();
|
|
110
|
+
this.reflect("dragging", true);
|
|
111
|
+
}
|
|
112
|
+
drag(event) {
|
|
113
|
+
if (!this._refs.divider.hasPointerCapture(event.pointerId)) return;
|
|
114
|
+
const rect = this._refs.split.getBoundingClientRect();
|
|
115
|
+
const position = this.orientation.get() === "horizontal" ? positionAt(event.clientX, rect.left, rect.width) : positionAt(event.clientY, rect.top, rect.height);
|
|
116
|
+
this.position.set(clampSplit(position, this.min.get()));
|
|
117
|
+
}
|
|
118
|
+
endDrag(event) {
|
|
119
|
+
const divider = this._refs.divider;
|
|
120
|
+
if (!divider.hasPointerCapture(event.pointerId)) return;
|
|
121
|
+
divider.releasePointerCapture(event.pointerId);
|
|
122
|
+
this.reflect("dragging", false);
|
|
123
|
+
if (this.current() !== this._drag.from) this.events.emit("change", this.current());
|
|
124
|
+
}
|
|
125
|
+
onKey(event) {
|
|
126
|
+
const next = positionAfterKey(this.current(), event.key, this.orientation.get(), this.min.get(), event.shiftKey);
|
|
127
|
+
if (next === null) return;
|
|
128
|
+
event.preventDefault();
|
|
129
|
+
this.commit(next);
|
|
130
|
+
}
|
|
131
|
+
/** Moves the divider as people asked, and says so when it moved. */
|
|
132
|
+
commit(position) {
|
|
133
|
+
const next = clampSplit(position, this.min.get());
|
|
134
|
+
const moved = next !== this.current();
|
|
135
|
+
this.position.set(next);
|
|
136
|
+
if (moved) this.events.emit("change", next);
|
|
137
|
+
}
|
|
138
|
+
renderPosition() {
|
|
139
|
+
const min = clampMin(this.min.get());
|
|
140
|
+
const position = this.current();
|
|
141
|
+
this._refs.split.style.setProperty("--position", `${position}%`);
|
|
142
|
+
const divider = this._refs.divider;
|
|
143
|
+
divider.setAttribute("aria-valuenow", String(Math.round(position)));
|
|
144
|
+
divider.setAttribute("aria-valuemin", String(min));
|
|
145
|
+
divider.setAttribute("aria-valuemax", String(FULL - min));
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
JlSplitView.register();
|
|
149
|
+
export { JlSplitView, SPLIT_ORIENTATIONS };
|
package/dist/tokens.css
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The design tokens, as swai and swcode have them: ink and white, flat surfaces separated by lines, and one blue
|
|
3
|
+
* that marks what is live, selected or waiting for a person. Custom properties cross shadow roots, so every
|
|
4
|
+
* component reads them. They sit in the `jlib` layer: any unlayered rule of the page overrides them.
|
|
5
|
+
*/
|
|
6
|
+
@layer jlib {
|
|
7
|
+
:root,
|
|
8
|
+
[data-theme="light"] {
|
|
9
|
+
color-scheme: light;
|
|
10
|
+
--jl-font-sans: "Manrope Variable", "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
11
|
+
--jl-font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
|
|
12
|
+
|
|
13
|
+
--jl-font-xs: 12px;
|
|
14
|
+
--jl-font-sm: 13px;
|
|
15
|
+
--jl-font-md: 14px;
|
|
16
|
+
--jl-font-lg: 16px;
|
|
17
|
+
--jl-font-xl: 20px;
|
|
18
|
+
--jl-font-2xl: 28px;
|
|
19
|
+
|
|
20
|
+
--jl-text: #0b0b0c;
|
|
21
|
+
--jl-text-2: #3a3f47;
|
|
22
|
+
/* Secondary text: 6.2:1 on white. */
|
|
23
|
+
--jl-muted: #5b616b;
|
|
24
|
+
/* Icons and decorations only: 3.2:1 on white is enough for them, not for text. */
|
|
25
|
+
--jl-faint: #8a9099;
|
|
26
|
+
|
|
27
|
+
--jl-bg: #ffffff;
|
|
28
|
+
--jl-surface: #ffffff;
|
|
29
|
+
--jl-surface-2: #f7f8f9;
|
|
30
|
+
--jl-surface-3: #eef0f2;
|
|
31
|
+
--jl-code-bg: #f0f2f4;
|
|
32
|
+
--jl-line: #e6e8eb;
|
|
33
|
+
--jl-line-soft: #eef0f2;
|
|
34
|
+
--jl-line-strong: #d5d9de;
|
|
35
|
+
|
|
36
|
+
/* The SyWare logo's blue: marks, focus rings, progress. 3.8:1 on white: enough for shapes, never for text. */
|
|
37
|
+
--jl-brand: #0e88d3;
|
|
38
|
+
/* The same hue, deep enough to carry text: buttons, links, the selection. 5.2:1 on white. */
|
|
39
|
+
--jl-accent: #0c72b0;
|
|
40
|
+
--jl-accent-strong: #095a8b;
|
|
41
|
+
--jl-accent-soft: #e9f4fb;
|
|
42
|
+
--jl-accent-line: #b7dbf2;
|
|
43
|
+
--jl-on-accent: #ffffff;
|
|
44
|
+
|
|
45
|
+
--jl-ok: #17784a;
|
|
46
|
+
--jl-ok-soft: #ecf6f0;
|
|
47
|
+
--jl-warn: #9a5b00;
|
|
48
|
+
--jl-warn-soft: #fcf4e6;
|
|
49
|
+
--jl-danger: #b42318;
|
|
50
|
+
--jl-danger-soft: #fdf0ef;
|
|
51
|
+
--jl-on-danger: #ffffff;
|
|
52
|
+
--jl-info: #0c72b0;
|
|
53
|
+
--jl-info-soft: #e9f4fb;
|
|
54
|
+
|
|
55
|
+
/* Code: the accent for keywords, quiet colours from the same family for the rest. */
|
|
56
|
+
--jl-code-keyword: #0c72b0;
|
|
57
|
+
--jl-code-tag: #095a8b;
|
|
58
|
+
--jl-code-attribute: #5b48c8;
|
|
59
|
+
--jl-code-string: #17784a;
|
|
60
|
+
--jl-code-number: #9a5b00;
|
|
61
|
+
--jl-code-function: #3d5a80;
|
|
62
|
+
--jl-code-property: #127a72;
|
|
63
|
+
--jl-code-comment: #8a9099;
|
|
64
|
+
|
|
65
|
+
--jl-radius-xs: 6px;
|
|
66
|
+
--jl-radius-sm: 8px;
|
|
67
|
+
--jl-radius: 10px;
|
|
68
|
+
--jl-radius-lg: 12px;
|
|
69
|
+
--jl-radius-xl: 20px;
|
|
70
|
+
--jl-radius-pill: 999px;
|
|
71
|
+
|
|
72
|
+
/* Spacing: a 4px grid, for the layouts pages build around the components. */
|
|
73
|
+
--jl-space-1: 4px;
|
|
74
|
+
--jl-space-2: 8px;
|
|
75
|
+
--jl-space-3: 12px;
|
|
76
|
+
--jl-space-4: 16px;
|
|
77
|
+
--jl-space-5: 20px;
|
|
78
|
+
--jl-space-6: 24px;
|
|
79
|
+
--jl-space-8: 32px;
|
|
80
|
+
--jl-space-10: 40px;
|
|
81
|
+
--jl-space-12: 48px;
|
|
82
|
+
--jl-space-16: 64px;
|
|
83
|
+
|
|
84
|
+
--jl-control-sm: 30px;
|
|
85
|
+
--jl-control-md: 36px;
|
|
86
|
+
--jl-control-lg: 44px;
|
|
87
|
+
|
|
88
|
+
/* Flat: lines separate; only what floats (menus, dialogs, toasts) casts a shadow. */
|
|
89
|
+
--jl-shadow-sm: 0 1px 2px rgb(11 11 12 / 0.05);
|
|
90
|
+
--jl-shadow: 0 6px 16px -6px rgb(11 11 12 / 0.12);
|
|
91
|
+
--jl-shadow-lg: 0 18px 44px -14px rgb(11 11 12 / 0.22);
|
|
92
|
+
--jl-focus-ring: 0 0 0 3px color-mix(in srgb, var(--jl-brand) 35%, transparent);
|
|
93
|
+
--jl-scrim: rgb(11 11 12 / 0.38);
|
|
94
|
+
|
|
95
|
+
--jl-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
|
|
96
|
+
--jl-fast: 120ms;
|
|
97
|
+
--jl-slow: 240ms;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@media (prefers-color-scheme: dark) {
|
|
101
|
+
:root:not([data-theme="light"]) {
|
|
102
|
+
color-scheme: dark;
|
|
103
|
+
--jl-text: #eceef1;
|
|
104
|
+
--jl-text-2: #c3c8cf;
|
|
105
|
+
--jl-muted: #959ca6;
|
|
106
|
+
--jl-faint: #6b727c;
|
|
107
|
+
--jl-bg: #0f1113;
|
|
108
|
+
--jl-surface: #0f1113;
|
|
109
|
+
--jl-surface-2: #16191c;
|
|
110
|
+
--jl-surface-3: #1d2125;
|
|
111
|
+
--jl-code-bg: #1d2125;
|
|
112
|
+
--jl-line: #262a2f;
|
|
113
|
+
--jl-line-soft: #1f2327;
|
|
114
|
+
--jl-line-strong: #343a41;
|
|
115
|
+
--jl-brand: #1a9be0;
|
|
116
|
+
--jl-accent: #3ea6e8;
|
|
117
|
+
--jl-accent-strong: #6cc0f2;
|
|
118
|
+
--jl-accent-soft: #0f2a3b;
|
|
119
|
+
--jl-accent-line: #1e4a66;
|
|
120
|
+
--jl-on-accent: #04131c;
|
|
121
|
+
--jl-ok: #4cc38a;
|
|
122
|
+
--jl-ok-soft: #10261c;
|
|
123
|
+
--jl-warn: #e5a54b;
|
|
124
|
+
--jl-warn-soft: #2a2012;
|
|
125
|
+
--jl-danger: #f0786c;
|
|
126
|
+
--jl-danger-soft: #3a1a17;
|
|
127
|
+
--jl-on-danger: #1c0604;
|
|
128
|
+
--jl-info: #3ea6e8;
|
|
129
|
+
--jl-info-soft: #0f2a3b;
|
|
130
|
+
--jl-code-keyword: #3ea6e8;
|
|
131
|
+
--jl-code-tag: #6cc0f2;
|
|
132
|
+
--jl-code-attribute: #a99bf0;
|
|
133
|
+
--jl-code-string: #4cc38a;
|
|
134
|
+
--jl-code-number: #e5a54b;
|
|
135
|
+
--jl-code-function: #8fb0d6;
|
|
136
|
+
--jl-code-property: #4fc1b5;
|
|
137
|
+
--jl-code-comment: #6b727c;
|
|
138
|
+
--jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
|
|
139
|
+
--jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
|
|
140
|
+
--jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
|
|
141
|
+
--jl-scrim: rgb(0 0 0 / 0.55);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/* Dark: the same blue, lifted to read on a dark ground, with dark text on the buttons. */
|
|
146
|
+
[data-theme="dark"] {
|
|
147
|
+
color-scheme: dark;
|
|
148
|
+
--jl-text: #eceef1;
|
|
149
|
+
--jl-text-2: #c3c8cf;
|
|
150
|
+
--jl-muted: #959ca6;
|
|
151
|
+
--jl-faint: #6b727c;
|
|
152
|
+
--jl-bg: #0f1113;
|
|
153
|
+
--jl-surface: #0f1113;
|
|
154
|
+
--jl-surface-2: #16191c;
|
|
155
|
+
--jl-surface-3: #1d2125;
|
|
156
|
+
--jl-code-bg: #1d2125;
|
|
157
|
+
--jl-line: #262a2f;
|
|
158
|
+
--jl-line-soft: #1f2327;
|
|
159
|
+
--jl-line-strong: #343a41;
|
|
160
|
+
--jl-brand: #1a9be0;
|
|
161
|
+
--jl-accent: #3ea6e8;
|
|
162
|
+
--jl-accent-strong: #6cc0f2;
|
|
163
|
+
--jl-accent-soft: #0f2a3b;
|
|
164
|
+
--jl-accent-line: #1e4a66;
|
|
165
|
+
--jl-on-accent: #04131c;
|
|
166
|
+
--jl-ok: #4cc38a;
|
|
167
|
+
--jl-ok-soft: #10261c;
|
|
168
|
+
--jl-warn: #e5a54b;
|
|
169
|
+
--jl-warn-soft: #2a2012;
|
|
170
|
+
--jl-danger: #f0786c;
|
|
171
|
+
--jl-danger-soft: #3a1a17;
|
|
172
|
+
--jl-on-danger: #1c0604;
|
|
173
|
+
--jl-info: #3ea6e8;
|
|
174
|
+
--jl-info-soft: #0f2a3b;
|
|
175
|
+
--jl-code-keyword: #3ea6e8;
|
|
176
|
+
--jl-code-tag: #6cc0f2;
|
|
177
|
+
--jl-code-attribute: #a99bf0;
|
|
178
|
+
--jl-code-string: #4cc38a;
|
|
179
|
+
--jl-code-number: #e5a54b;
|
|
180
|
+
--jl-code-function: #8fb0d6;
|
|
181
|
+
--jl-code-property: #4fc1b5;
|
|
182
|
+
--jl-code-comment: #6b727c;
|
|
183
|
+
--jl-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
|
|
184
|
+
--jl-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.6);
|
|
185
|
+
--jl-shadow-lg: 0 18px 44px -12px rgb(0 0 0 / 0.7);
|
|
186
|
+
--jl-scrim: rgb(0 0 0 / 0.55);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** A day on the calendar, without a time or a time zone: what an ISO date (`yyyy-mm-dd`) names. */
|
|
2
|
+
export type CalendarDate = {
|
|
3
|
+
year: number;
|
|
4
|
+
/** 1 for January to 12 for December. */
|
|
5
|
+
month: number;
|
|
6
|
+
day: number;
|
|
7
|
+
};
|
|
8
|
+
/** A day of the week, counted as `Date#getDay` does: 0 is Sunday, 1 is Monday. */
|
|
9
|
+
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
/** How long the name of a weekday is: `Monday`, `Mon` or `M`. */
|
|
11
|
+
export type WeekdayWidth = 'long' | 'short' | 'narrow';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** What the checks need of a file: a `File` fits, and so does a plain object in tests. */
|
|
2
|
+
export type FileLike = {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
size: number;
|
|
6
|
+
};
|
|
7
|
+
/** Why a file was refused: not of an accepted type, too large, or one too many for a single-file field. */
|
|
8
|
+
export type FileRefusal = 'type' | 'size' | 'count';
|
|
9
|
+
/** What a field takes: the `accept` list of an `<input type="file">`, a size limit in bytes (0: none), and how many. */
|
|
10
|
+
export type FileRules = {
|
|
11
|
+
accept: string;
|
|
12
|
+
maxSize: number;
|
|
13
|
+
multiple: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type RefusedFile<Item extends FileLike = FileLike> = {
|
|
16
|
+
file: Item;
|
|
17
|
+
reason: FileRefusal;
|
|
18
|
+
};
|
|
19
|
+
/** The files a field takes, and those it refuses with the reason. */
|
|
20
|
+
export type FileCheck<Item extends FileLike = FileLike> = {
|
|
21
|
+
accepted: Item[];
|
|
22
|
+
refused: RefusedFile<Item>[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Side = 'top' | 'bottom' | 'left' | 'right';
|
|
2
|
+
export type Align = 'start' | 'center' | 'end';
|
|
3
|
+
/** A side of the anchor, and where along that side: `bottom-start` is under the anchor, left edges aligned. */
|
|
4
|
+
export type Placement = Side | `${Side}-start` | `${Side}-end`;
|
|
5
|
+
export type Point = {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
};
|
|
9
|
+
export type Size = {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export type Rect = Point & Size;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** How well a search matches a text, and which characters of the text it matched. */
|
|
2
|
+
export type FuzzyMatch = {
|
|
3
|
+
score: number;
|
|
4
|
+
positions: number[];
|
|
5
|
+
};
|
|
6
|
+
/** A run of letters of a text, matched by the search or not. */
|
|
7
|
+
export type TextSegment = {
|
|
8
|
+
text: string;
|
|
9
|
+
marked: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type CodeLanguage = 'html' | 'css' | 'ts' | 'bash' | 'text';
|
|
2
|
+
export type TokenKind = 'plain' | 'comment' | 'string' | 'number' | 'keyword' | 'tag' | 'attribute' | 'property' | 'function' | 'punctuation';
|
|
3
|
+
export type Token = {
|
|
4
|
+
kind: TokenKind;
|
|
5
|
+
text: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** A key combination, as `parseHotkey('mod+shift+k')` reads it. */
|
|
2
|
+
export type Hotkey = {
|
|
3
|
+
/** The key itself, lower case: `k`, `enter`, `/`. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** ⌘ on Apple, Ctrl elsewhere. */
|
|
6
|
+
mod: boolean;
|
|
7
|
+
ctrl: boolean;
|
|
8
|
+
meta: boolean;
|
|
9
|
+
shift: boolean;
|
|
10
|
+
alt: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** The parts of a keyboard event a hotkey looks at. */
|
|
13
|
+
export type KeyPress = {
|
|
14
|
+
key: string;
|
|
15
|
+
ctrlKey: boolean;
|
|
16
|
+
metaKey: boolean;
|
|
17
|
+
shiftKey: boolean;
|
|
18
|
+
altKey: boolean;
|
|
19
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The four sizes of an avatar: 24, 32, 40 and 56 pixels. */
|
|
2
|
+
export type AvatarSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
export type AvatarShape = 'circle' | 'square';
|
|
4
|
+
/** A person's presence, shown as a dot at the avatar's corner. */
|
|
5
|
+
export type AvatarStatus = 'online' | 'busy' | 'away' | 'offline';
|
|
6
|
+
/** One person of an avatar group. */
|
|
7
|
+
export type AvatarItem = {
|
|
8
|
+
name: string;
|
|
9
|
+
src?: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type ChipSize = 'sm' | 'md';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type PaletteCommand = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
/** The heading the command is listed under. */
|
|
5
|
+
group?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
/** Keys shown beside it, joined by `+`: `mod+shift+p` (`mod` is ⌘ on Apple, Ctrl elsewhere). */
|
|
8
|
+
shortcut?: string;
|
|
9
|
+
/** Other words that find it: `["preferences", "options"]` for "Settings". */
|
|
10
|
+
keywords?: string[];
|
|
11
|
+
};
|
|
12
|
+
/** A command that matches the search, with the places of the matched letters in its label. */
|
|
13
|
+
export type PaletteMatch = {
|
|
14
|
+
command: PaletteCommand;
|
|
15
|
+
score: number;
|
|
16
|
+
positions: number[];
|
|
17
|
+
};
|
|
18
|
+
/** Commands under one heading, in the order they are listed. */
|
|
19
|
+
export type PaletteGroup = {
|
|
20
|
+
label: string;
|
|
21
|
+
matches: PaletteMatch[];
|
|
22
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** The colour of the confirm button: the accent for a normal decision, danger for what destroys data. */
|
|
2
|
+
export type ConfirmTone = 'accent' | 'danger';
|
|
3
|
+
/** What `confirmDialog()` asks. */
|
|
4
|
+
export type ConfirmOptions = {
|
|
5
|
+
heading: string;
|
|
6
|
+
text?: string;
|
|
7
|
+
confirmLabel?: string;
|
|
8
|
+
cancelLabel?: string;
|
|
9
|
+
tone?: ConfirmTone;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DialogSize = 'sm' | 'md' | 'lg' | 'full';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type InputType = 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'date' | 'time' | 'datetime-local' | 'month' | 'week';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** A choice of a menu: `select` fires with its value. */
|
|
2
|
+
export type MenuAction = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
/** The keys that do the same, shown at the end: "⌘D". */
|
|
7
|
+
shortcut?: string;
|
|
8
|
+
/** A second, quieter line under the label. */
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Destroys or removes something: drawn in the danger colour. */
|
|
11
|
+
danger?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** A line between groups of choices. */
|
|
15
|
+
export type MenuDivider = {
|
|
16
|
+
divider: true;
|
|
17
|
+
};
|
|
18
|
+
/** A title over the choices that follow it, up to the next title. */
|
|
19
|
+
export type MenuHeading = {
|
|
20
|
+
heading: string;
|
|
21
|
+
};
|
|
22
|
+
export type MenuItem = MenuAction | MenuDivider | MenuHeading;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** One choice of a radio group, with an optional line that explains it. */
|
|
2
|
+
export type RadioOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type RadioGroupOrientation = 'vertical' | 'horizontal';
|
|
9
|
+
/** `plain` draws a dot beside each label, `cards` a bordered card per option. */
|
|
10
|
+
export type RadioGroupVariant = 'plain' | 'cards';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** One choice of a select: `group` gathers it with the others of the same group under that heading. */
|
|
2
|
+
export type SelectOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
group?: string;
|
|
7
|
+
};
|
|
8
|
+
/** A run of options under one heading, or outside any group when `label` is null. */
|
|
9
|
+
export type SelectOptionGroup = {
|
|
10
|
+
label: string | null;
|
|
11
|
+
options: SelectOption[];
|
|
12
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** One entry of a side navigation; with `children`, it opens and closes to show them. */
|
|
2
|
+
export type SideNavItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** An icon name; the collapsed rail shows only the icons. */
|
|
6
|
+
icon?: string;
|
|
7
|
+
/** A link to follow; without it the item is a button that fires `select`. */
|
|
8
|
+
href?: string;
|
|
9
|
+
/** A count or a short word beside the label: `3`, `New`. */
|
|
10
|
+
badge?: string | number;
|
|
11
|
+
children?: SideNavItem[];
|
|
12
|
+
};
|
|
13
|
+
/** A group of items under an optional heading. */
|
|
14
|
+
export type SideNavSection = {
|
|
15
|
+
label?: string;
|
|
16
|
+
items: SideNavItem[];
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** One step of a process. */
|
|
2
|
+
export type StepItem = {
|
|
3
|
+
label: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
};
|
|
6
|
+
export type StepsOrientation = 'horizontal' | 'vertical';
|
|
7
|
+
/** Where a step stands against the current one. */
|
|
8
|
+
export type StepStatus = 'done' | 'current' | 'upcoming';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type SwitchSize = 'sm' | 'md';
|