stimeo-ui 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +163 -0
- data/dist/controllers/accordion_controller.js +10 -0
- data/dist/controllers/alert_dialog_controller.js +318 -0
- data/dist/controllers/breadcrumb_controller.js +225 -13
- data/dist/controllers/calendar_controller.js +89 -22
- data/dist/controllers/carousel_controller.js +313 -0
- data/dist/controllers/clipboard_controller.js +144 -0
- data/dist/controllers/collapsible_controller.js +327 -0
- data/dist/controllers/color_picker_controller.js +252 -0
- data/dist/controllers/combobox_controller.js +162 -23
- data/dist/controllers/command_palette_controller.js +194 -17
- data/dist/controllers/context_menu_controller.js +32 -10
- data/dist/controllers/count_up_controller.js +8 -1
- data/dist/controllers/currency_input_controller.js +147 -0
- data/dist/controllers/data_grid_controller.js +246 -0
- data/dist/controllers/date_range_picker_controller.js +441 -0
- data/dist/controllers/dismissible_controller.js +117 -0
- data/dist/controllers/drawer_controller.js +630 -0
- data/dist/controllers/editable_controller.js +169 -0
- data/dist/controllers/file_dropzone_controller.js +165 -0
- data/dist/controllers/filter_controller.js +86 -0
- data/dist/controllers/flash_controller.js +36 -5
- data/dist/controllers/form_validation_controller.js +1 -1
- data/dist/controllers/highlight_controller.js +6 -4
- data/dist/controllers/intersection_controller.js +67 -19
- data/dist/controllers/lazy_frame_controller.js +54 -11
- data/dist/controllers/listbox_controller.js +257 -53
- data/dist/controllers/local_time_controller.js +2 -2
- data/dist/controllers/masonry_controller.js +142 -0
- data/dist/controllers/menu_controller.js +104 -17
- data/dist/controllers/menubar_controller.js +785 -0
- data/dist/controllers/multi_select_controller.js +755 -0
- data/dist/controllers/navigation_menu_controller.js +511 -0
- data/dist/controllers/number_input_controller.js +7 -0
- data/dist/controllers/otp_controller.js +18 -1
- data/dist/controllers/overflow_indicator_controller.js +246 -27
- data/dist/controllers/overflow_menu_controller.js +381 -57
- data/dist/controllers/pagination_controller.js +163 -32
- data/dist/controllers/password_reveal_controller.js +117 -0
- data/dist/controllers/persist_controller.js +6 -6
- data/dist/controllers/pointer_drag_controller.js +9 -1
- data/dist/controllers/popover_controller.js +2 -2
- data/dist/controllers/radio_group_controller.js +22 -3
- data/dist/controllers/range_slider_controller.js +192 -0
- data/dist/controllers/rating_controller.js +16 -2
- data/dist/controllers/read_more_controller.js +238 -0
- data/dist/controllers/resizable_controller.js +65 -1
- data/dist/controllers/roving_controller.js +17 -2
- data/dist/controllers/scroll_area_controller.js +101 -14
- data/dist/controllers/scroll_restore_controller.js +93 -0
- data/dist/controllers/scroll_visibility_controller.js +40 -6
- data/dist/controllers/scrollspy_controller.js +369 -74
- data/dist/controllers/separator_controller.js +96 -0
- data/dist/controllers/sidebar_controller.js +761 -0
- data/dist/controllers/skeleton_controller.js +1 -1
- data/dist/controllers/slider_controller.js +32 -6
- data/dist/controllers/sortable_controller.js +34 -3
- data/dist/controllers/spinner_controller.js +1 -1
- data/dist/controllers/stepper_controller.js +28 -12
- data/dist/controllers/stick_to_bottom_controller.js +9 -4
- data/dist/controllers/sticky_observer_controller.js +109 -20
- data/dist/controllers/switch_controller.js +1 -0
- data/dist/controllers/tabs_controller.js +26 -3
- data/dist/controllers/tags_input_controller.js +295 -0
- data/dist/controllers/theme_controller.js +42 -13
- data/dist/controllers/time_picker_controller.js +231 -0
- data/dist/controllers/toast_controller.js +40 -14
- data/dist/controllers/toggle_group_controller.js +23 -2
- data/dist/controllers/toolbar_controller.js +230 -31
- data/dist/controllers/transition_controller.js +153 -38
- data/dist/controllers/tree_view_controller.js +691 -0
- data/dist/index.js +4256 -915
- data/lib/stimeo/ui/version.rb +2 -3
- metadata +28 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Controller } from '@hotwired/stimulus';
|
|
2
|
+
|
|
3
|
+
// src/controllers/separator_controller.ts
|
|
4
|
+
|
|
5
|
+
// src/utils/arrow_step.ts
|
|
6
|
+
function isReservedArrowChord(event, allow = []) {
|
|
7
|
+
if (!event.key.startsWith("Arrow")) return false;
|
|
8
|
+
return event.altKey && !allow.includes("alt") || event.ctrlKey && !allow.includes("ctrl") || event.metaKey && !allow.includes("meta") || event.shiftKey && !allow.includes("shift");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/controllers/separator_controller.ts
|
|
12
|
+
var SeparatorController = class extends Controller {
|
|
13
|
+
static values = {
|
|
14
|
+
orientation: { type: String, default: "horizontal" },
|
|
15
|
+
focusable: { type: Boolean, default: false },
|
|
16
|
+
step: { type: Number, default: 1 }
|
|
17
|
+
};
|
|
18
|
+
static actions = ["onKeydown"];
|
|
19
|
+
static events = ["change"];
|
|
20
|
+
connect() {
|
|
21
|
+
if (!this.element.hasAttribute("role")) {
|
|
22
|
+
this.element.setAttribute("role", "separator");
|
|
23
|
+
}
|
|
24
|
+
if (!this.element.hasAttribute("aria-orientation")) {
|
|
25
|
+
this.element.setAttribute("aria-orientation", this.orientationValue);
|
|
26
|
+
}
|
|
27
|
+
if (this.focusableValue) {
|
|
28
|
+
if (!this.element.hasAttribute("tabindex")) {
|
|
29
|
+
this.element.setAttribute("tabindex", "0");
|
|
30
|
+
}
|
|
31
|
+
this.#setDefault("aria-valuemin", "0");
|
|
32
|
+
this.#setDefault("aria-valuemax", "100");
|
|
33
|
+
this.#setDefault("aria-valuenow", String(this.#clamp(this.#value)));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** Adjusts the value on arrow / Home / End keys (focusable variant only). */
|
|
37
|
+
onKeydown(event) {
|
|
38
|
+
if (isReservedArrowChord(event)) return;
|
|
39
|
+
if (!this.focusableValue) return;
|
|
40
|
+
const horizontal = this.element.getAttribute("aria-orientation") !== "vertical";
|
|
41
|
+
let next = null;
|
|
42
|
+
switch (event.key) {
|
|
43
|
+
case "ArrowUp":
|
|
44
|
+
if (horizontal) next = this.#value + this.stepValue;
|
|
45
|
+
break;
|
|
46
|
+
case "ArrowDown":
|
|
47
|
+
if (horizontal) next = this.#value - this.stepValue;
|
|
48
|
+
break;
|
|
49
|
+
case "ArrowRight":
|
|
50
|
+
if (!horizontal) next = this.#value + this.stepValue;
|
|
51
|
+
break;
|
|
52
|
+
case "ArrowLeft":
|
|
53
|
+
if (!horizontal) next = this.#value - this.stepValue;
|
|
54
|
+
break;
|
|
55
|
+
case "Home":
|
|
56
|
+
next = this.#min;
|
|
57
|
+
break;
|
|
58
|
+
case "End":
|
|
59
|
+
next = this.#max;
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (next === null) return;
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
const clamped = this.#clamp(next);
|
|
67
|
+
if (clamped === this.#value) return;
|
|
68
|
+
this.element.setAttribute("aria-valuenow", String(clamped));
|
|
69
|
+
this.dispatch("change", { detail: { value: clamped } });
|
|
70
|
+
}
|
|
71
|
+
get #value() {
|
|
72
|
+
return this.#numericAttr("aria-valuenow", 0);
|
|
73
|
+
}
|
|
74
|
+
get #min() {
|
|
75
|
+
return this.#numericAttr("aria-valuemin", 0);
|
|
76
|
+
}
|
|
77
|
+
get #max() {
|
|
78
|
+
return this.#numericAttr("aria-valuemax", 100);
|
|
79
|
+
}
|
|
80
|
+
#clamp(value) {
|
|
81
|
+
return Math.min(this.#max, Math.max(this.#min, value));
|
|
82
|
+
}
|
|
83
|
+
#numericAttr(name, fallback) {
|
|
84
|
+
const parsed = Number.parseFloat(this.element.getAttribute(name) ?? "");
|
|
85
|
+
return Number.isNaN(parsed) ? fallback : parsed;
|
|
86
|
+
}
|
|
87
|
+
#setDefault(name, value) {
|
|
88
|
+
if (!this.element.hasAttribute(name)) {
|
|
89
|
+
this.element.setAttribute(name, value);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export { SeparatorController };
|
|
95
|
+
//# sourceMappingURL=separator_controller.js.map
|
|
96
|
+
//# sourceMappingURL=separator_controller.js.map
|