@basis-ng/primitives 0.0.1-alpha.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.
Files changed (48) hide show
  1. package/core/components/alert/alert.component.d.ts +20 -0
  2. package/core/components/attached-box/attached-box.component.d.ts +125 -0
  3. package/core/components/attached-box/types/alignment.type.d.ts +1 -0
  4. package/core/components/attached-box/types/direction.type.d.ts +1 -0
  5. package/core/components/attached-box/types/position.type.d.ts +1 -0
  6. package/core/components/badge/badge.component.d.ts +9 -0
  7. package/core/components/bottom-sheet/bottom-sheet.component.d.ts +60 -0
  8. package/core/components/button/button.component.d.ts +17 -0
  9. package/core/components/button-group/button-group.component.d.ts +9 -0
  10. package/core/components/checkbox/checkbox.component.d.ts +26 -0
  11. package/core/components/color-picker/color-picker.component.d.ts +61 -0
  12. package/core/components/icon/icon.component.d.ts +29 -0
  13. package/core/components/input/input.component.d.ts +78 -0
  14. package/core/components/input-group/input-group.component.d.ts +13 -0
  15. package/core/components/menu/menu.component.d.ts +14 -0
  16. package/core/components/menu/shared/components/menu-item/menu-item.component.d.ts +9 -0
  17. package/core/components/menu/shared/components/menu-item-checkbox/menu-item-checkbox.component.d.ts +9 -0
  18. package/core/components/menu/shared/components/menu-item-radio/menu-item-radio.component.d.ts +9 -0
  19. package/core/components/menu/shared/components/menu-label/menu-label.component.d.ts +8 -0
  20. package/core/components/menu/shared/directives/menu-trigger.directive.d.ts +14 -0
  21. package/core/components/range/range.component.d.ts +26 -0
  22. package/core/components/search/search.component.d.ts +121 -0
  23. package/core/components/select/select.component.d.ts +48 -0
  24. package/core/components/side-sheet/side-sheet.component.d.ts +46 -0
  25. package/core/components/spinner/spinner.component.d.ts +9 -0
  26. package/core/components/switch/switch.component.d.ts +35 -0
  27. package/core/components/table/components/row/components/row-item/row-item.component.d.ts +12 -0
  28. package/core/components/table/components/row/row.component.d.ts +9 -0
  29. package/core/components/table/table.component.d.ts +5 -0
  30. package/core/components/tabs/components/tab/tab.component.d.ts +25 -0
  31. package/core/components/tabs/tabs.component.d.ts +60 -0
  32. package/core/components/textarea/textarea.component.d.ts +48 -0
  33. package/core/components/tooltip/tooltip.component.d.ts +36 -0
  34. package/core/components/tree/shared/components/tree-node/tree-node.component.d.ts +43 -0
  35. package/core/components/tree/tree.component.d.ts +56 -0
  36. package/core/directives/in-viewport.directive.d.ts +13 -0
  37. package/core/services/in-viewport.service.d.ts +23 -0
  38. package/core/services/responsive.service.d.ts +47 -0
  39. package/core/services/theme.service.d.ts +44 -0
  40. package/fesm2022/basis-ng-primitives.mjs +2415 -0
  41. package/fesm2022/basis-ng-primitives.mjs.map +1 -0
  42. package/index.d.ts +5 -0
  43. package/package.json +26 -0
  44. package/public-api.d.ts +40 -0
  45. package/shared/components/label/label.component.d.ts +34 -0
  46. package/shared/components/option/option.component.d.ts +10 -0
  47. package/shared/directives/lazy-content.directive.d.ts +7 -0
  48. package/shared/services/utils.service.d.ts +16 -0
@@ -0,0 +1,2415 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, inject, RendererFactory2, Injectable, input, Component, TemplateRef, Directive, computed, model, output, contentChildren, viewChild, Renderer2, effect, HostListener, ElementRef, afterNextRender, afterRenderEffect, linkedSignal, contentChild } from '@angular/core';
3
+ import { NgStyle, NgClass, CommonModule } from '@angular/common';
4
+ import { DomSanitizer } from '@angular/platform-browser';
5
+ import { icons, createElement } from 'lucide';
6
+ import { NgModel, ControlContainer } from '@angular/forms';
7
+ import * as i1 from '@angular/cdk/drag-drop';
8
+ import { CdkDrag, CdkDragHandle, CdkDropList, CdkDropListGroup } from '@angular/cdk/drag-drop';
9
+ import * as i1$1 from '@angular/cdk/menu';
10
+ import { CdkMenu, CdkMenuItem, CdkMenuItemCheckbox, CdkMenuItemRadio, CdkMenuTrigger } from '@angular/cdk/menu';
11
+
12
+ class ThemeService {
13
+ /**
14
+ * Signal representing the current theme.
15
+ *
16
+ * Possible values:
17
+ * - `'light'`: Light theme.
18
+ * - `'dark'`: Dark theme.
19
+ * - `'auto'`: Automatically determine the theme.
20
+ */
21
+ theme = signal('auto');
22
+ /**
23
+ * Renderer2 instance for manipulating the DOM.
24
+ * Used to set the `data-theme` attribute on the document root (`<html>`).
25
+ */
26
+ renderer;
27
+ /**
28
+ * RendererFactory2 instance for creating Renderer2 instances.
29
+ * Injected to create the renderer.
30
+ */
31
+ rendererFactory = inject(RendererFactory2);
32
+ constructor() {
33
+ this.renderer = this.rendererFactory.createRenderer(null, null);
34
+ }
35
+ /**
36
+ * Applies the specified theme to the document root (`<html>`).
37
+ *
38
+ * @param theme - The theme to apply. Possible values:
39
+ * - `'light'`: Apply the light theme.
40
+ * - `'dark'`: Apply the dark theme.
41
+ * - `'auto'`: Remove the theme attribute and let the system decide.
42
+ */
43
+ applyTheme(theme) {
44
+ this.theme.set(theme);
45
+ if (theme === 'auto') {
46
+ this.removeTheme();
47
+ return;
48
+ }
49
+ this.renderer.setAttribute(document.documentElement, 'data-theme', theme);
50
+ }
51
+ /**
52
+ * Toggles the theme between `'light'` and `'dark'`.
53
+ * If the current theme is `'light'`, it switches to `'dark'`, and vice versa.
54
+ */
55
+ toggleTheme() {
56
+ this.applyTheme(this.theme() === 'light' ? 'dark' : 'light');
57
+ }
58
+ /**
59
+ * Removes the `data-theme` attribute from the document body.
60
+ * This is used when the theme is set to `'auto'`.
61
+ */
62
+ removeTheme() {
63
+ this.renderer.removeAttribute(document.documentElement, 'data-theme');
64
+ }
65
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
66
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ThemeService, providedIn: 'root' });
67
+ }
68
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ThemeService, decorators: [{
69
+ type: Injectable,
70
+ args: [{
71
+ providedIn: 'root',
72
+ }]
73
+ }], ctorParameters: () => [] });
74
+
75
+ class Spinner {
76
+ active = input(true);
77
+ color = input('var(--foreground)');
78
+ backgroundColor = input('transparent');
79
+ size = input(20);
80
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Spinner, deps: [], target: i0.ɵɵFactoryTarget.Component });
81
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: Spinner, isStandalone: true, selector: "r-spinner", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, backgroundColor: { classPropertyName: "backgroundColor", publicName: "backgroundColor", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "@if (active()) {\r\n <section [ngStyle]=\"{ background: backgroundColor() }\" class=\"background\">\r\n <svg\r\n [attr.height]=\"size()\"\r\n [attr.width]=\"size()\"\r\n preserveAspectRatio=\"xMidYMid\"\r\n style=\"\r\n shape-rendering: auto;\r\n display: block;\r\n background: rgba(122, 122, 122, 0);\r\n \"\r\n viewBox=\"0 0 100 100\"\r\n xmlns=\"http://www.w3.org/2000/svg\">\r\n <g>\r\n <g transform=\"rotate(0 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.9166666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(30 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.8333333333333334s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(60 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.75s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(90 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.6666666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(120 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.5833333333333334s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(150 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.5s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(180 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.4166666666666667s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(210 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.3333333333333333s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(240 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.25s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(270 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.16666666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(300 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.08333333333333333s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(330 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"0s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g />\r\n </g>\r\n </svg>\r\n </section>\r\n}\r\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
82
+ }
83
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Spinner, decorators: [{
84
+ type: Component,
85
+ args: [{ selector: 'r-spinner', imports: [NgStyle], template: "@if (active()) {\r\n <section [ngStyle]=\"{ background: backgroundColor() }\" class=\"background\">\r\n <svg\r\n [attr.height]=\"size()\"\r\n [attr.width]=\"size()\"\r\n preserveAspectRatio=\"xMidYMid\"\r\n style=\"\r\n shape-rendering: auto;\r\n display: block;\r\n background: rgba(122, 122, 122, 0);\r\n \"\r\n viewBox=\"0 0 100 100\"\r\n xmlns=\"http://www.w3.org/2000/svg\">\r\n <g>\r\n <g transform=\"rotate(0 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.9166666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(30 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.8333333333333334s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(60 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.75s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(90 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.6666666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(120 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.5833333333333334s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(150 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.5s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(180 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.4166666666666667s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(210 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.3333333333333333s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(240 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.25s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(270 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.16666666666666666s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(300 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"-0.08333333333333333s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g transform=\"rotate(330 50 50)\">\r\n <rect\r\n [attr.fill]=\"color()\"\r\n height=\"20\"\r\n rx=\"3\"\r\n ry=\"3.2800000000000002\"\r\n width=\"6\"\r\n x=\"47\"\r\n y=\"10\">\r\n <animate\r\n attributeName=\"opacity\"\r\n begin=\"0s\"\r\n dur=\"1s\"\r\n keyTimes=\"0;1\"\r\n repeatCount=\"indefinite\"\r\n values=\"1;0\" />\r\n </rect>\r\n </g>\r\n <g />\r\n </g>\r\n </svg>\r\n </section>\r\n}\r\n" }]
86
+ }] });
87
+
88
+ class Button {
89
+ /** The variant of the button. */
90
+ variant = input('primary');
91
+ /** The size of the button. */
92
+ size = input('default');
93
+ /** Whether is loading. */
94
+ loading = input(false);
95
+ /** Whether the padding should be equal vertically and horizontally. */
96
+ equalPadding = input(false);
97
+ /** Whether the button is toggleable. */
98
+ toggle = input(false);
99
+ /** The value of the button when it is toggled. */
100
+ isToggled = input(false);
101
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
102
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: Button, isStandalone: true, selector: "button[r-button]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, equalPadding: { classPropertyName: "equalPadding", publicName: "equalPadding", isSignal: true, isRequired: false, transformFunction: null }, toggle: { classPropertyName: "toggle", publicName: "toggle", isSignal: true, isRequired: false, transformFunction: null }, isToggled: { classPropertyName: "isToggled", publicName: "isToggled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "variant() + \" size-\" + size()", "class.equal-padding": "equalPadding()", "class.loading": "loading()", "class.toggled": "isToggled()" } }, ngImport: i0, template: "@if (loading()) {\r\n <r-spinner\r\n [active]=\"loading()\"\r\n [size]=\"18\"\r\n [color]=\"\r\n variant() === 'primary'\r\n ? 'var(--primary-foreground)'\r\n : 'var(--secondary-foreground)'\r\n \" />\r\n}\r\n<ng-content />\r\n", dependencies: [{ kind: "component", type: Spinner, selector: "r-spinner", inputs: ["active", "color", "backgroundColor", "size"] }] });
103
+ }
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Button, decorators: [{
105
+ type: Component,
106
+ args: [{ selector: 'button[r-button]', imports: [Spinner], host: {
107
+ '[class]': 'variant() + " size-" + size()',
108
+ '[class.equal-padding]': 'equalPadding()',
109
+ '[class.loading]': 'loading()',
110
+ '[class.toggled]': 'isToggled()',
111
+ }, template: "@if (loading()) {\r\n <r-spinner\r\n [active]=\"loading()\"\r\n [size]=\"18\"\r\n [color]=\"\r\n variant() === 'primary'\r\n ? 'var(--primary-foreground)'\r\n : 'var(--secondary-foreground)'\r\n \" />\r\n}\r\n<ng-content />\r\n" }]
112
+ }] });
113
+
114
+ class ButtonGroup {
115
+ /**
116
+ * Whether the buttons should be spaced.
117
+ */
118
+ spaced = input(false);
119
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ButtonGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
120
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: ButtonGroup, isStandalone: true, selector: "r-button-group", inputs: { spaced: { classPropertyName: "spaced", publicName: "spaced", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.spaced": "spaced()" }, classAttribute: "button-group" }, ngImport: i0, template: `<ng-content />`, isInline: true });
121
+ }
122
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ButtonGroup, decorators: [{
123
+ type: Component,
124
+ args: [{
125
+ selector: 'r-button-group',
126
+ template: `<ng-content />`,
127
+ host: {
128
+ class: 'button-group',
129
+ '[class.spaced]': 'spaced()',
130
+ },
131
+ }]
132
+ }] });
133
+
134
+ class LazyContentDirective {
135
+ tpl = inject(TemplateRef);
136
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: LazyContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
137
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.7", type: LazyContentDirective, isStandalone: true, selector: "[r-lazy]", ngImport: i0 });
138
+ }
139
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: LazyContentDirective, decorators: [{
140
+ type: Directive,
141
+ args: [{
142
+ selector: '[r-lazy]',
143
+ standalone: true,
144
+ }]
145
+ }] });
146
+
147
+ class Icon {
148
+ /**
149
+ * The sanitizer service.
150
+ */
151
+ sanitizer = inject(DomSanitizer);
152
+ /**
153
+ * The icon of the text field.
154
+ */
155
+ icon = input.required();
156
+ /**
157
+ * The size of the icon.
158
+ */
159
+ size = input(24);
160
+ /**
161
+ * The stroke of the icon.
162
+ */
163
+ strokeWidth = input(1.8);
164
+ /**
165
+ * The color of the icon.
166
+ */
167
+ color = input('var(--foreground, #798194)');
168
+ /**
169
+ * The svg of the icon.
170
+ */
171
+ iconSvg = computed(() => {
172
+ if (!icons[this.icon()]) {
173
+ console.error(`Icon '${this.icon()}' not found in Lucide icons.`);
174
+ return this.sanitizer.bypassSecurityTrustHtml('');
175
+ }
176
+ const iconSvg = createElement(icons[this.icon()], {
177
+ width: this.size(),
178
+ height: this.size(),
179
+ stroke: this.color(),
180
+ 'stroke-width': this.strokeWidth(),
181
+ });
182
+ return this.sanitizer.bypassSecurityTrustHtml(iconSvg.outerHTML);
183
+ });
184
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, deps: [], target: i0.ɵɵFactoryTarget.Component });
185
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Icon, isStandalone: true, selector: "i[r-icon]", inputs: { icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: true, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "innerHTML": "iconSvg()" } }, ngImport: i0, template: ``, isInline: true });
186
+ }
187
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Icon, decorators: [{
188
+ type: Component,
189
+ args: [{
190
+ selector: 'i[r-icon]',
191
+ imports: [],
192
+ template: ``,
193
+ host: {
194
+ '[innerHTML]': 'iconSvg()',
195
+ },
196
+ }]
197
+ }] });
198
+
199
+ class UtilsService {
200
+ debounceTimer;
201
+ /**
202
+ * Debounce with optional delay
203
+ * @param {any} func - The function to debounce
204
+ * @param {any} delay - The delay in milliseconds
205
+ */
206
+ debounce(func, delay) {
207
+ clearTimeout(this.debounceTimer);
208
+ this.debounceTimer = setTimeout(func, delay);
209
+ }
210
+ /**
211
+ * Stop debounce
212
+ */
213
+ stopDebounce() {
214
+ clearTimeout(this.debounceTimer);
215
+ }
216
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
217
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, providedIn: 'root' });
218
+ }
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: UtilsService, decorators: [{
220
+ type: Injectable,
221
+ args: [{
222
+ providedIn: 'root',
223
+ }]
224
+ }] });
225
+
226
+ class Search {
227
+ /**
228
+ * The label associated with the search component.
229
+ */
230
+ label = input();
231
+ /**
232
+ * The maximum width of the search component.
233
+ */
234
+ maxWidth = input('');
235
+ /**
236
+ * The placeholder of the text field.
237
+ */
238
+ placeholder = input('');
239
+ /**
240
+ * Indicates whether the search component is searching.
241
+ */
242
+ searching = model(false);
243
+ /**
244
+ * Indicates whether the search component is in an invalid state.
245
+ */
246
+ invalid = model(false);
247
+ /**
248
+ * Indicates whether the search component is disabled.
249
+ */
250
+ disabled = model(false);
251
+ /**
252
+ * The value of the selected option.
253
+ */
254
+ selectedValue = model(null);
255
+ /**
256
+ * The search value.
257
+ */
258
+ searchValue = model('');
259
+ /**
260
+ * Emits the value of the search component when the value changes.
261
+ */
262
+ searchChange = output();
263
+ /**
264
+ * Emits when the search component is focused.
265
+ */
266
+ focused = signal(false);
267
+ /**
268
+ * Indicates whether the options dropdown is open.
269
+ */
270
+ isOpen = signal(false);
271
+ /**
272
+ * The options available for selection.
273
+ */
274
+ options = contentChildren(Option);
275
+ /**
276
+ * Indicates whether the search component has no options.
277
+ */
278
+ noOptions = computed(() => !this.options() || this.options().length === 0);
279
+ /**
280
+ * Reference to the select element within the component
281
+ * @private
282
+ */
283
+ select = viewChild('select');
284
+ /**
285
+ * Reference to the renderer
286
+ * @private
287
+ */
288
+ renderer = inject(Renderer2);
289
+ /**
290
+ * The icon name to display.
291
+ */
292
+ selectIconName = computed(() => {
293
+ return this.searching()
294
+ ? 'LoaderCircle'
295
+ : this.selectedValue()
296
+ ? 'X'
297
+ : 'ChevronDown';
298
+ });
299
+ /**
300
+ * The icon size to display.
301
+ */
302
+ selectIconSize = computed(() => {
303
+ return this.searching() ? 17 : this.selectedValue() ? 18 : 20;
304
+ });
305
+ /**
306
+ * The debounce time for the search input.
307
+ */
308
+ debounceTime = input(300);
309
+ /**
310
+ * Reference to the UtilsService
311
+ * @private
312
+ */
313
+ utilsService = inject(UtilsService);
314
+ /**
315
+ * Initializes the search component.
316
+ */
317
+ constructor() {
318
+ effect(() => this.renderOptions());
319
+ }
320
+ /**
321
+ * Renders the options within the select element.
322
+ * @private
323
+ */
324
+ renderOptions() {
325
+ const select = this.select()?.nativeElement;
326
+ const options = this.options();
327
+ if (!select || !options || options.length === 0) {
328
+ return;
329
+ }
330
+ // Clear the existing options
331
+ select.innerHTML = '';
332
+ // Append the options to the select
333
+ options.forEach(option => {
334
+ this.renderer.appendChild(select, option.el.nativeElement);
335
+ });
336
+ }
337
+ /**
338
+ * Handles the change event of the input text.
339
+ */
340
+ onInputValueChange(event) {
341
+ this.searching.set(true);
342
+ const value = event.target.value;
343
+ this.searchValue.set(value);
344
+ // Use the debounce method from UtilsService
345
+ this.utilsService.debounce(() => {
346
+ this.searchChange.emit(value);
347
+ }, this.debounceTime());
348
+ }
349
+ /**
350
+ * Resets the search component.
351
+ */
352
+ reset() {
353
+ this.selectedValue.set(null);
354
+ this.searchValue.set('');
355
+ }
356
+ /**
357
+ * Handles the selection change event from the native select element.
358
+ * @param event The selection change event.
359
+ */
360
+ onSelectValueChange(event) {
361
+ const select = event.target;
362
+ const value = select.value === 'null' ? null : select.value;
363
+ this.selectedValue.set(value);
364
+ this.isOpen.set(false);
365
+ }
366
+ /**
367
+ * Handles click events outside the select component to close the options dropdown.
368
+ * @param event The mouse click event.
369
+ */
370
+ onOutsideClick(event) {
371
+ if (!this.select().nativeElement.contains(event.target)) {
372
+ this.isOpen.set(false);
373
+ }
374
+ }
375
+ /**
376
+ * Handles keyboard events to open or close the options dropdown.
377
+ * @param event The keyboard event.
378
+ */
379
+ onKeyDown(event) {
380
+ if (event.key === 'Escape') {
381
+ this.isOpen.set(false);
382
+ }
383
+ }
384
+ /**
385
+ * Handles the icon click event.
386
+ */
387
+ handleIconClick() {
388
+ if (this.selectedValue()) {
389
+ this.reset();
390
+ }
391
+ }
392
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Search, deps: [], target: i0.ɵɵFactoryTarget.Component });
393
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: Search, isStandalone: true, selector: "r-search", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searching: { classPropertyName: "searching", publicName: "searching", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null }, searchValue: { classPropertyName: "searchValue", publicName: "searchValue", isSignal: true, isRequired: false, transformFunction: null }, debounceTime: { classPropertyName: "debounceTime", publicName: "debounceTime", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { searching: "searchingChange", invalid: "invalidChange", disabled: "disabledChange", selectedValue: "selectedValueChange", searchValue: "searchValueChange", searchChange: "searchChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "document:click": "onOutsideClick($event)" }, properties: { "style.max-width": "maxWidth()", "class.invalid": "invalid()", "class.disabled": "disabled()", "class.label-up": "(searchValue() || selectedValue() || placeholder() || focused()) && label()" } }, queries: [{ propertyName: "options", predicate: Option, isSignal: true }], viewQueries: [{ propertyName: "select", first: true, predicate: ["select"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- Label -->\r\n@if (label()) {\r\n <label>\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n@if (!selectedValue()) {\r\n <section [class.large]=\"noOptions() && !searching()\">\r\n <!-- Input -->\r\n <input\r\n #input\r\n [value]=\"searchValue()\"\r\n [placeholder]=\"placeholder() || ''\"\r\n [disabled]=\"disabled()\"\r\n (focus)=\"focused.set(true)\"\r\n (blur)=\"focused.set(false)\"\r\n (input)=\"onInputValueChange($event)\" />\r\n\r\n <!-- Clear Button -->\r\n @if (searchValue() || selectedValue()) {\r\n <i\r\n r-icon\r\n icon=\"X\"\r\n [size]=\"18\"\r\n tabindex=\"0\"\r\n (click)=\"searchValue.set('')\"\r\n (keydown.enter)=\"searchValue.set('')\"\r\n (keydown.space)=\"searchValue.set('')\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n }\r\n </section>\r\n}\r\n\r\n<!-- Select -->\r\n<select\r\n #select\r\n [value]=\"selectedValue()\"\r\n (change)=\"onSelectValueChange($event)\"\r\n [class.no-options]=\"noOptions()\"\r\n (mousedown)=\"isOpen.set(true)\"\r\n [disabled]=\"disabled()\"></select>\r\n\r\nnooptions: {{ noOptions() }} searching: {{ searching() }}\r\n\r\n@if (!noOptions() || searching()) {\r\n <!-- Icon -->\r\n <div class=\"icon-wrapper\">\r\n <i\r\n r-icon\r\n [icon]=\"selectIconName()\"\r\n [class.open]=\"isOpen()\"\r\n [class.select-has-value]=\"selectedValue()\"\r\n (click)=\"handleIconClick()\"\r\n (keydown.enter)=\"handleIconClick()\"\r\n (keydown.space)=\"handleIconClick()\"\r\n tabindex=\"0\"\r\n [class.searching]=\"searching()\"\r\n [size]=\"selectIconSize()\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n </div>\r\n}\r\n\r\n<!-- Projected Options -->\r\n<ng-content />\r\n", dependencies: [{ kind: "component", type: Icon, selector: "i[r-icon]", inputs: ["icon", "size", "strokeWidth", "color"] }] });
394
+ }
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Search, decorators: [{
396
+ type: Component,
397
+ args: [{ selector: 'r-search', imports: [Icon], host: {
398
+ '[style.max-width]': 'maxWidth()',
399
+ '[class.invalid]': 'invalid()',
400
+ '[class.disabled]': 'disabled()',
401
+ '[class.label-up]': '(searchValue() || selectedValue() || placeholder() || focused()) && label()',
402
+ '(keydown)': 'onKeyDown($event)',
403
+ }, template: "<!-- Label -->\r\n@if (label()) {\r\n <label>\r\n {{ label() }}\r\n </label>\r\n}\r\n\r\n@if (!selectedValue()) {\r\n <section [class.large]=\"noOptions() && !searching()\">\r\n <!-- Input -->\r\n <input\r\n #input\r\n [value]=\"searchValue()\"\r\n [placeholder]=\"placeholder() || ''\"\r\n [disabled]=\"disabled()\"\r\n (focus)=\"focused.set(true)\"\r\n (blur)=\"focused.set(false)\"\r\n (input)=\"onInputValueChange($event)\" />\r\n\r\n <!-- Clear Button -->\r\n @if (searchValue() || selectedValue()) {\r\n <i\r\n r-icon\r\n icon=\"X\"\r\n [size]=\"18\"\r\n tabindex=\"0\"\r\n (click)=\"searchValue.set('')\"\r\n (keydown.enter)=\"searchValue.set('')\"\r\n (keydown.space)=\"searchValue.set('')\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n }\r\n </section>\r\n}\r\n\r\n<!-- Select -->\r\n<select\r\n #select\r\n [value]=\"selectedValue()\"\r\n (change)=\"onSelectValueChange($event)\"\r\n [class.no-options]=\"noOptions()\"\r\n (mousedown)=\"isOpen.set(true)\"\r\n [disabled]=\"disabled()\"></select>\r\n\r\nnooptions: {{ noOptions() }} searching: {{ searching() }}\r\n\r\n@if (!noOptions() || searching()) {\r\n <!-- Icon -->\r\n <div class=\"icon-wrapper\">\r\n <i\r\n r-icon\r\n [icon]=\"selectIconName()\"\r\n [class.open]=\"isOpen()\"\r\n [class.select-has-value]=\"selectedValue()\"\r\n (click)=\"handleIconClick()\"\r\n (keydown.enter)=\"handleIconClick()\"\r\n (keydown.space)=\"handleIconClick()\"\r\n tabindex=\"0\"\r\n [class.searching]=\"searching()\"\r\n [size]=\"selectIconSize()\"\r\n [color]=\"\r\n invalid()\r\n ? 'var(--error-foreground, #c40000ab)'\r\n : ' var(--input-foreground, #798194)'\r\n \"></i>\r\n </div>\r\n}\r\n\r\n<!-- Projected Options -->\r\n<ng-content />\r\n" }]
404
+ }], ctorParameters: () => [], propDecorators: { onOutsideClick: [{
405
+ type: HostListener,
406
+ args: ['document:click', ['$event']]
407
+ }] } });
408
+
409
+ class Input {
410
+ /**
411
+ * The type of the input.
412
+ */
413
+ type = input('text');
414
+ /**
415
+ * The placeholder text for the input.
416
+ */
417
+ placeholder = input('');
418
+ /**
419
+ * The value of the input.
420
+ */
421
+ value = signal(null);
422
+ /**
423
+ * Whether the input is invalid.
424
+ */
425
+ invalid = model(false);
426
+ /**
427
+ * Whether the input is disabled.
428
+ */
429
+ disabled = model(false);
430
+ /**
431
+ * The maximum width of the input.
432
+ */
433
+ maxWidth = input('');
434
+ /**
435
+ * The number of decimal places for number input.
436
+ */
437
+ decimals = input(2);
438
+ /**
439
+ * The type of number input (integer or decimal).
440
+ */
441
+ numberType = input('integer');
442
+ /**
443
+ * Whether the input type is number.
444
+ */
445
+ isNumberType = computed(() => this.type() === 'number');
446
+ /**
447
+ * Whether the input is focused.
448
+ */
449
+ focused = signal(false);
450
+ /**
451
+ * Event emitted when the value changes.
452
+ */
453
+ valueChange = output();
454
+ /**
455
+ * Reference to the input element.
456
+ */
457
+ el = inject(ElementRef);
458
+ /**
459
+ * Reference to the ngModel directive.
460
+ */
461
+ ngModel = inject(NgModel, { optional: true });
462
+ /**
463
+ * After the view has been initialized, set the value of the select.
464
+ */
465
+ ngAfterViewInit() {
466
+ const value = this.el.nativeElement.value || this.ngModel?.model;
467
+ this.value.set(this.isNumberType() ? this.formatNumber(value) : value);
468
+ }
469
+ /**
470
+ * Handles the input event.
471
+ * @param event The input event.
472
+ */
473
+ onInput(event) {
474
+ const target = event.target;
475
+ // If the input is not of number type, update the value and emit the value change event.
476
+ if (!this.isNumberType()) {
477
+ this.value.set(target.value);
478
+ this.valueChange.emit(target.value);
479
+ }
480
+ }
481
+ /**
482
+ * The blur event handler.
483
+ * @param event - The blur event.
484
+ */
485
+ onBlur(event) {
486
+ this.focused.set(false);
487
+ // If the input is of number type, format the value and emit the value change event.
488
+ if (this.isNumberType()) {
489
+ const formattedValue = this.formatNumber(event.target.value);
490
+ this.el.nativeElement.value = formattedValue || '';
491
+ this.value.set(formattedValue);
492
+ this.valueChange.emit(formattedValue);
493
+ }
494
+ }
495
+ /**
496
+ * Formats the number value.
497
+ * @param value - The value to format.
498
+ * @returns The formatted value.
499
+ */
500
+ formatNumber(value) {
501
+ if (value) {
502
+ const numericValue = Number(value);
503
+ return this.numberType() === 'integer'
504
+ ? Math.round(numericValue).toString()
505
+ : numericValue.toFixed(this.decimals());
506
+ }
507
+ else {
508
+ return null;
509
+ }
510
+ }
511
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Input, deps: [], target: i0.ɵɵFactoryTarget.Component });
512
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Input, isStandalone: true, selector: "input[r-input]", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, decimals: { classPropertyName: "decimals", publicName: "decimals", isSignal: true, isRequired: false, transformFunction: null }, numberType: { classPropertyName: "numberType", publicName: "numberType", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { invalid: "invalidChange", disabled: "disabledChange", valueChange: "valueChange" }, host: { listeners: { "input": "onInput($event)", "focus": "focused.set(true)", "blur": "onBlur($event)" }, properties: { "type": "type()", "placeholder": "placeholder() || \"\"", "class.ng-invalid": "invalid()", "class.disabled": "disabled()", "style.max-width": "maxWidth()" } }, ngImport: i0, template: ``, isInline: true });
513
+ }
514
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Input, decorators: [{
515
+ type: Component,
516
+ args: [{
517
+ selector: 'input[r-input]',
518
+ template: ``,
519
+ host: {
520
+ '[type]': 'type()',
521
+ '[placeholder]': 'placeholder() || ""',
522
+ '[class.ng-invalid]': 'invalid()',
523
+ '[class.disabled]': 'disabled()',
524
+ '[style.max-width]': 'maxWidth()',
525
+ '(input)': 'onInput($event)',
526
+ '(focus)': 'focused.set(true)',
527
+ '(blur)': 'onBlur($event)',
528
+ },
529
+ }]
530
+ }] });
531
+
532
+ class Select {
533
+ /**
534
+ * The value of the input.
535
+ */
536
+ value = signal(null);
537
+ /**
538
+ * Whether the input is invalid.
539
+ */
540
+ invalid = model(false);
541
+ /**
542
+ * Whether the input is disabled.
543
+ */
544
+ disabled = model(false);
545
+ /**
546
+ * The maximum width of the input.
547
+ */
548
+ maxWidth = input('');
549
+ /**
550
+ * Event emitted when the value changes.
551
+ */
552
+ valueChange = output();
553
+ /**
554
+ * Reference to the input element.
555
+ */
556
+ el = inject(ElementRef);
557
+ /**
558
+ * Indicates whether the options dropdown is open.
559
+ */
560
+ isOpen = signal(false);
561
+ /**
562
+ * Reference to the renderer
563
+ * @private
564
+ */
565
+ renderer = inject(Renderer2);
566
+ /**
567
+ * After the view has been initialized, set the value of the select.
568
+ */
569
+ ngAfterViewInit() {
570
+ this.value.set(this.el.nativeElement.value);
571
+ }
572
+ /**
573
+ * Handles the select change event.
574
+ * @param value - The value of the select.
575
+ */
576
+ change(value) {
577
+ this.valueChange.emit(value);
578
+ this.value.set(value);
579
+ }
580
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Select, deps: [], target: i0.ɵɵFactoryTarget.Component });
581
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Select, isStandalone: true, selector: "select[r-select]", inputs: { invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { invalid: "invalidChange", disabled: "disabledChange", valueChange: "valueChange" }, host: { listeners: { "change": "change($event.target.value)" }, properties: { "class.ng-invalid": "invalid()", "class.disabled": "disabled()", "style.max-width": "maxWidth()" } }, ngImport: i0, template: ` <ng-content />`, isInline: true });
582
+ }
583
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Select, decorators: [{
584
+ type: Component,
585
+ args: [{
586
+ selector: 'select[r-select]',
587
+ template: ` <ng-content />`,
588
+ host: {
589
+ '[class.ng-invalid]': 'invalid()',
590
+ '[class.disabled]': 'disabled()',
591
+ '[style.max-width]': 'maxWidth()',
592
+ '(change)': 'change($event.target.value)',
593
+ },
594
+ }]
595
+ }] });
596
+
597
+ class Option {
598
+ /**
599
+ * Reference to the host element.
600
+ */
601
+ el = inject(ElementRef);
602
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Option, deps: [], target: i0.ɵɵFactoryTarget.Component });
603
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: Option, isStandalone: true, selector: "option[r-option]", ngImport: i0, template: `<ng-content />`, isInline: true });
604
+ }
605
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Option, decorators: [{
606
+ type: Component,
607
+ args: [{
608
+ selector: 'option[r-option]',
609
+ template: `<ng-content />`,
610
+ }]
611
+ }] });
612
+
613
+ class Switch {
614
+ /**
615
+ * Value of the switch.
616
+ */
617
+ value = model(false);
618
+ /**
619
+ * The size of the switch.
620
+ */
621
+ size = input('default');
622
+ /**
623
+ * Reference to the switch element.
624
+ */
625
+ el = inject(ElementRef);
626
+ /**
627
+ * Event emitted when the value changes.
628
+ */
629
+ valueChange = output();
630
+ /**
631
+ * Initializes the switch value after the view is initialized.
632
+ */
633
+ ngAfterViewInit() {
634
+ this.value.set(this.el.nativeElement.checked);
635
+ }
636
+ /**
637
+ * Toggles the value of the switch.
638
+ */
639
+ toggleValue() {
640
+ const newValue = !this.value();
641
+ this.value.set(newValue);
642
+ this.valueChange.emit(newValue);
643
+ }
644
+ /**
645
+ * Sets the value of the switch.
646
+ * @param newValue - The new value to set.
647
+ */
648
+ setValue(newValue) {
649
+ this.value.set(newValue);
650
+ this.valueChange.emit(newValue);
651
+ }
652
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Switch, deps: [], target: i0.ɵɵFactoryTarget.Component });
653
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Switch, isStandalone: true, selector: "input[r-switch]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, host: { listeners: { "click": "toggleValue()", "keydown.enter": "toggleValue()", "keydown.arrowleft": "setValue(false)", "keydown.arrowright": "setValue(true)" }, properties: { "attr.role": "switch", "attr.checked": "value()", "attr.aria-checked": "value()", "class": "size()" } }, ngImport: i0, template: ``, isInline: true });
654
+ }
655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Switch, decorators: [{
656
+ type: Component,
657
+ args: [{
658
+ selector: 'input[r-switch]',
659
+ template: ``,
660
+ host: {
661
+ '[attr.role]': 'switch',
662
+ '[attr.checked]': 'value()',
663
+ '[attr.aria-checked]': 'value()',
664
+ '(click)': 'toggleValue()',
665
+ '[class]': 'size()',
666
+ '(keydown.enter)': 'toggleValue()',
667
+ '(keydown.arrowleft)': 'setValue(false)',
668
+ '(keydown.arrowright)': 'setValue(true)',
669
+ },
670
+ }]
671
+ }] });
672
+
673
+ class Table {
674
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
675
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: Table, isStandalone: true, selector: "r-table", ngImport: i0, template: "<ng-content select=\"[r-row-header]\" />\r\n<ng-content select=\"[r-row-subheader]\" />\r\n<div class=\"scroll-section\">\r\n <ng-content />\r\n</div>\r\n" });
676
+ }
677
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Table, decorators: [{
678
+ type: Component,
679
+ args: [{ selector: 'r-table', template: "<ng-content select=\"[r-row-header]\" />\r\n<ng-content select=\"[r-row-subheader]\" />\r\n<div class=\"scroll-section\">\r\n <ng-content />\r\n</div>\r\n" }]
680
+ }] });
681
+
682
+ class Row {
683
+ header = input(false);
684
+ subheader = input(false);
685
+ clickable = input(false);
686
+ highlighted = input(false);
687
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Row, deps: [], target: i0.ɵɵFactoryTarget.Component });
688
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Row, isStandalone: true, selector: "r-row", inputs: { header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, subheader: { classPropertyName: "subheader", publicName: "subheader", isSignal: true, isRequired: false, transformFunction: null }, clickable: { classPropertyName: "clickable", publicName: "clickable", isSignal: true, isRequired: false, transformFunction: null }, highlighted: { classPropertyName: "highlighted", publicName: "highlighted", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div\r\n class=\"row-container\"\r\n [ngClass]=\"{\r\n clickable: clickable(),\r\n header: header(),\r\n subheader: subheader(),\r\n highlighted: highlighted(),\r\n }\">\r\n <ng-content />\r\n</div>\r\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
689
+ }
690
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Row, decorators: [{
691
+ type: Component,
692
+ args: [{ selector: 'r-row', imports: [NgClass], template: "<div\r\n class=\"row-container\"\r\n [ngClass]=\"{\r\n clickable: clickable(),\r\n header: header(),\r\n subheader: subheader(),\r\n highlighted: highlighted(),\r\n }\">\r\n <ng-content />\r\n</div>\r\n" }]
693
+ }] });
694
+
695
+ class RowItem {
696
+ widthPx = input();
697
+ alignedLeft = input(false);
698
+ isHeader = input(false);
699
+ style = computed(() => {
700
+ return {
701
+ width: `${this.widthPx()}px`,
702
+ justifyContent: this.alignedLeft() ? 'flex-start' : 'center',
703
+ };
704
+ });
705
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: RowItem, deps: [], target: i0.ɵɵFactoryTarget.Component });
706
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: RowItem, isStandalone: true, selector: "r-row-item", inputs: { widthPx: { classPropertyName: "widthPx", publicName: "widthPx", isSignal: true, isRequired: false, transformFunction: null }, alignedLeft: { classPropertyName: "alignedLeft", publicName: "alignedLeft", isSignal: true, isRequired: false, transformFunction: null }, isHeader: { classPropertyName: "isHeader", publicName: "isHeader", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<div [ngStyle]=\"style()\" class=\"row-item-container\">\r\n <ng-content />\r\n</div>\r\n", dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
707
+ }
708
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: RowItem, decorators: [{
709
+ type: Component,
710
+ args: [{ selector: 'r-row-item', imports: [NgStyle], template: "<div [ngStyle]=\"style()\" class=\"row-item-container\">\r\n <ng-content />\r\n</div>\r\n" }]
711
+ }] });
712
+
713
+ class Tab {
714
+ el;
715
+ value = input.required();
716
+ disabled = input(false);
717
+ selected = signal(false);
718
+ highlighted = signal(false);
719
+ selectEmitter = output();
720
+ constructor(el) {
721
+ this.el = el;
722
+ }
723
+ /**
724
+ * Emit the select event when the tab is selected.
725
+ */
726
+ onSelect() {
727
+ this.selectEmitter.emit(this);
728
+ }
729
+ /**
730
+ * Highlight the tab on mouse enter if it is not disabled and not in keyboard-active mode.
731
+ */
732
+ onMouseEnter() {
733
+ if (!this.disabled() &&
734
+ !this.el.nativeElement.parentElement.parentElement.classList.contains('keyboard-active')) {
735
+ this.highlighted.set(true);
736
+ }
737
+ }
738
+ /**
739
+ * Remove the highlight from the tab on mouse leave if it is not disabled and not in keyboard-active mode.
740
+ */
741
+ onMouseLeave() {
742
+ if (!this.disabled() &&
743
+ !this.el.nativeElement.parentElement.parentElement.classList.contains('keyboard-active')) {
744
+ this.highlighted.set(false);
745
+ }
746
+ }
747
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tab, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
748
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Tab, isStandalone: true, selector: "r-tab", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectEmitter: "selectEmitter" }, ngImport: i0, template: "<span\r\n tabindex=\"0\"\r\n (click)=\"onSelect()\"\r\n (keydown.enter)=\"onSelect()\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n [ngClass]=\"{ selected: selected(), highlighted: highlighted() }\">\r\n <ng-content\r\n/></span>\r\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] });
749
+ }
750
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tab, decorators: [{
751
+ type: Component,
752
+ args: [{ selector: 'r-tab', imports: [NgClass], template: "<span\r\n tabindex=\"0\"\r\n (click)=\"onSelect()\"\r\n (keydown.enter)=\"onSelect()\"\r\n (mouseenter)=\"onMouseEnter()\"\r\n (mouseleave)=\"onMouseLeave()\"\r\n [ngClass]=\"{ selected: selected(), highlighted: highlighted() }\">\r\n <ng-content\r\n/></span>\r\n" }]
753
+ }], ctorParameters: () => [{ type: i0.ElementRef }] });
754
+
755
+ class Tabs {
756
+ tabs = contentChildren(Tab);
757
+ selectedIndex = signal(-1);
758
+ selectedValue = model(null);
759
+ highlightedIndex = signal(-1);
760
+ changesEmitter = output();
761
+ lastSelectedValue = null;
762
+ constructor() {
763
+ effect(() => {
764
+ this.handleTabSelection();
765
+ this.handleExternalSelectedValue();
766
+ this.handleScrollToSelectedTab();
767
+ });
768
+ }
769
+ /**
770
+ * Handle the selection of a tab.
771
+ */
772
+ handleTabSelection() {
773
+ this.tabs().forEach((tab, index) => {
774
+ tab.selectEmitter.subscribe(tabEmitted => {
775
+ this.selectTab(tabEmitted, index);
776
+ this.highlightTab(index);
777
+ this.handleTabStates();
778
+ this.changesEmitter.emit(tab.value());
779
+ });
780
+ });
781
+ }
782
+ /**
783
+ * Select a tab.
784
+ * @param {Tab} tab - The tab to select.
785
+ * @param {number} index - The index of the tab.
786
+ */
787
+ selectTab(tab, index) {
788
+ this.selectedValue.set(tab.value());
789
+ this.lastSelectedValue = tab.value();
790
+ this.selectedIndex.set(index);
791
+ }
792
+ /**
793
+ * Highlight a tab.
794
+ * @param {number} index - The index of the tab to highlight.
795
+ */
796
+ highlightTab(index) {
797
+ this.highlightedIndex.set(index);
798
+ }
799
+ /**
800
+ * Handle the states of the tabs.
801
+ */
802
+ handleTabStates() {
803
+ this.tabs().forEach((tab, index) => {
804
+ tab.selected.set(index === this.selectedIndex());
805
+ tab.highlighted.set(index === this.highlightedIndex());
806
+ });
807
+ }
808
+ /**
809
+ * Handle the external selected value.
810
+ */
811
+ handleExternalSelectedValue() {
812
+ if (this.lastSelectedValue !== this.selectedValue()) {
813
+ const selectedOptionIndex = this.tabs().findIndex(tab => tab.value() === this.selectedValue());
814
+ if (selectedOptionIndex !== -1) {
815
+ this.selectTab(this.tabs()[selectedOptionIndex], selectedOptionIndex);
816
+ this.highlightTab(selectedOptionIndex);
817
+ this.handleTabStates();
818
+ }
819
+ }
820
+ }
821
+ /**
822
+ * Scroll to the selected tab.
823
+ */
824
+ handleScrollToSelectedTab() {
825
+ if (this.selectedIndex() !== -1) {
826
+ this.scrollToTab(this.selectedIndex(), 'smooth');
827
+ }
828
+ }
829
+ /**
830
+ * Handle keyboard events for navigation and selection.
831
+ * @param {KeyboardEvent} event - The keyboard event.
832
+ */
833
+ handleKeyboard(event) {
834
+ switch (event.key) {
835
+ case 'ArrowRight':
836
+ event.preventDefault();
837
+ this.focusOption('next');
838
+ break;
839
+ case 'ArrowLeft':
840
+ event.preventDefault();
841
+ this.focusOption('previous');
842
+ break;
843
+ case 'Enter':
844
+ event.preventDefault();
845
+ this.selectFocusedTab();
846
+ break;
847
+ }
848
+ }
849
+ /**
850
+ * Focus on the next or previous tab.
851
+ * @param {'next' | 'previous'} direction - The direction to move the focus.
852
+ */
853
+ focusOption(direction) {
854
+ let index = this.highlightedIndex();
855
+ const increment = direction === 'next' ? 1 : -1;
856
+ index += increment;
857
+ while (index >= 0 &&
858
+ index < this.tabs().length &&
859
+ this.tabs()[index].disabled()) {
860
+ index += increment;
861
+ }
862
+ if (index >= 0 && index < this.tabs().length) {
863
+ this.highlightTab(index);
864
+ this.handleTabStates();
865
+ this.scrollToTab(this.highlightedIndex(), 'smooth');
866
+ }
867
+ }
868
+ /**
869
+ * Select the currently focused tab.
870
+ */
871
+ selectFocusedTab() {
872
+ this.selectTab(this.tabs()[this.highlightedIndex()], this.highlightedIndex());
873
+ this.handleTabStates();
874
+ }
875
+ /**
876
+ * Scroll to a specific tab.
877
+ * @param {number} index - The index of the tab to scroll to.
878
+ * @param {string} behavior - The scroll behavior ('instant' or 'smooth').
879
+ */
880
+ scrollToTab(index, behavior) {
881
+ const tabsElements = this.tabs();
882
+ if (tabsElements[index].el.nativeElement) {
883
+ tabsElements[index].el.nativeElement.scrollIntoView({
884
+ block: 'nearest',
885
+ behavior: behavior,
886
+ });
887
+ }
888
+ }
889
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
890
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: Tabs, isStandalone: true, selector: "r-tabs", inputs: { selectedValue: { classPropertyName: "selectedValue", publicName: "selectedValue", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedValue: "selectedValueChange", changesEmitter: "changesEmitter" }, host: { listeners: { "keydown": "handleKeyboard($event)" } }, queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], ngImport: i0, template: "<div class=\"tabs\" [tabIndex]=\"0\">\r\n <ng-content />\r\n</div>\r\n" });
891
+ }
892
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tabs, decorators: [{
893
+ type: Component,
894
+ args: [{ selector: 'r-tabs', template: "<div class=\"tabs\" [tabIndex]=\"0\">\r\n <ng-content />\r\n</div>\r\n" }]
895
+ }], ctorParameters: () => [], propDecorators: { handleKeyboard: [{
896
+ type: HostListener,
897
+ args: ['keydown', ['$event']]
898
+ }] } });
899
+
900
+ class InViewportService {
901
+ elements = signal({});
902
+ observer;
903
+ /**
904
+ * Register an element to be tracked by the service.
905
+ * @param {string} id - The id of the element to register.
906
+ */
907
+ registerElement(id, nativeElement, initialVisibility) {
908
+ if (!(id in this.elements())) {
909
+ this.elements.set({ ...this.elements(), [id]: initialVisibility });
910
+ // Create an IntersectionObserver to track the element's visibility.
911
+ this.observer = new IntersectionObserver(entries => {
912
+ entries.forEach(entry => {
913
+ const isVisible = entry.isIntersecting;
914
+ this.updateElementVisibility(id, isVisible);
915
+ });
916
+ });
917
+ // Start observing the element.
918
+ this.observer.observe(nativeElement);
919
+ }
920
+ }
921
+ /**
922
+ * Unregister an element from being tracked by the service.
923
+ * @param {string} id - The id of the element to unregister.
924
+ */
925
+ unregisterElement(id) {
926
+ if (id in this.elements()) {
927
+ delete this.elements()[id];
928
+ this.observer.disconnect();
929
+ }
930
+ }
931
+ /**
932
+ * Update the visibility of an element.
933
+ * @param {string} id - The id of the element to update.
934
+ * @param {boolean} isVisible - The new visibility state of the element.
935
+ */
936
+ updateElementVisibility(id, isVisible) {
937
+ this.elements.set({ ...this.elements(), [id]: isVisible });
938
+ }
939
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InViewportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
940
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InViewportService, providedIn: 'root' });
941
+ }
942
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InViewportService, decorators: [{
943
+ type: Injectable,
944
+ args: [{
945
+ providedIn: 'root',
946
+ }]
947
+ }] });
948
+
949
+ class InViewportDirective {
950
+ inViewportId = input.required();
951
+ inViewportInitialVisibility = input(false);
952
+ el = inject(ElementRef);
953
+ inViewportService = inject(InViewportService);
954
+ constructor() {
955
+ afterNextRender({
956
+ write: () => {
957
+ this.inViewportService.registerElement(this.inViewportId(), this.el.nativeElement, this.inViewportInitialVisibility());
958
+ },
959
+ });
960
+ }
961
+ ngOnDestroy() {
962
+ this.inViewportService.unregisterElement(this.inViewportId());
963
+ }
964
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InViewportDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
965
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.7", type: InViewportDirective, isStandalone: true, selector: "[r-in-viewport]", inputs: { inViewportId: { classPropertyName: "inViewportId", publicName: "inViewportId", isSignal: true, isRequired: true, transformFunction: null }, inViewportInitialVisibility: { classPropertyName: "inViewportInitialVisibility", publicName: "inViewportInitialVisibility", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
966
+ }
967
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InViewportDirective, decorators: [{
968
+ type: Directive,
969
+ args: [{
970
+ selector: '[r-in-viewport]',
971
+ }]
972
+ }], ctorParameters: () => [] });
973
+
974
+ /**
975
+ * A sliding sheet component that can be positioned on either side of the screen.
976
+ * The sheet slides in from the left or right edge and includes an overlay backdrop.
977
+ *
978
+ * @selector r-side-sheet
979
+ */
980
+ class SideSheet {
981
+ /**
982
+ * Indicates whether the side sheet is open.
983
+ */
984
+ isOpen = model(false);
985
+ /**
986
+ * Specifies the side of the screen where the sheet is positioned.
987
+ * Can be either 'left' or 'right'.
988
+ */
989
+ side = input('right');
990
+ /**
991
+ * Specifies the width of the side sheet.
992
+ */
993
+ width = input('300px');
994
+ /**
995
+ * Computes whether the side sheet is positioned on the left side.
996
+ */
997
+ isLeft = computed(() => this.side() === 'left');
998
+ /**
999
+ * Computes whether the side sheet is positioned on the right side.
1000
+ */
1001
+ isRight = computed(() => this.side() === 'right');
1002
+ /**
1003
+ * Event emitted when the side sheet is closed.
1004
+ */
1005
+ closeSheet = output();
1006
+ /**
1007
+ * Reference to the host element of the side sheet.
1008
+ */
1009
+ el = inject(ElementRef);
1010
+ /**
1011
+ * Closes the side sheet when clicking outside of it.
1012
+ *
1013
+ * @param event - The click event.
1014
+ */
1015
+ closeOnOutsideClick(event) {
1016
+ if (this.isOpen() && !this.el.nativeElement.contains(event.target)) {
1017
+ this.isOpen.set(false);
1018
+ }
1019
+ }
1020
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SideSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
1021
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: SideSheet, isStandalone: true, selector: "r-side-sheet", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closeSheet: "closeSheet" }, host: { listeners: { "document:click": "closeOnOutsideClick($event)" }, properties: { "class.left": "isLeft()", "class.right": "!isLeft()", "class.open": "isOpen()", "style.width": "width()" } }, ngImport: i0, template: "<button class=\"close-button\" (click)=\"isOpen.set(false)\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"19\"\r\n height=\"19\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"0.094rem\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-x\">\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n</button>\r\n<ng-content />\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
1022
+ }
1023
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: SideSheet, decorators: [{
1024
+ type: Component,
1025
+ args: [{ selector: 'r-side-sheet', standalone: true, imports: [CommonModule], host: {
1026
+ '[class.left]': 'isLeft()',
1027
+ '[class.right]': '!isLeft()',
1028
+ '[class.open]': 'isOpen()',
1029
+ '[style.width]': 'width()',
1030
+ }, template: "<button class=\"close-button\" (click)=\"isOpen.set(false)\">\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"19\"\r\n height=\"19\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"0.094rem\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\"\r\n class=\"lucide lucide-x\">\r\n <path d=\"M18 6 6 18\" />\r\n <path d=\"m6 6 12 12\" />\r\n </svg>\r\n</button>\r\n<ng-content />\r\n" }]
1031
+ }], propDecorators: { closeOnOutsideClick: [{
1032
+ type: HostListener,
1033
+ args: ['document:click', ['$event']]
1034
+ }] } });
1035
+
1036
+ class BottomSheet {
1037
+ /**
1038
+ * Indicates whether the bottom sheet is open.
1039
+ */
1040
+ isOpen = model(false);
1041
+ /**
1042
+ * The height of the bottom sheet.
1043
+ */
1044
+ height = input('30dvh');
1045
+ /**
1046
+ * Event emitted when the bottom sheet is closed.
1047
+ */
1048
+ closeSheet = output();
1049
+ /**
1050
+ * Indicates whether a drag event is in progress.
1051
+ */
1052
+ isDragging = signal(false);
1053
+ /**
1054
+ * The starting Y position of the drag event.
1055
+ */
1056
+ startY = signal(0);
1057
+ /**
1058
+ * The current Y translation of the bottom sheet in percentage.
1059
+ */
1060
+ translateY = signal(100);
1061
+ /**
1062
+ * The threshold for closing the bottom sheet, in percentage.
1063
+ */
1064
+ closeThreshold = input(30);
1065
+ /**
1066
+ * The computed transform property for the bottom sheet.
1067
+ */
1068
+ transform = computed(() => this.isDragging()
1069
+ ? `translateY(${this.translateY()}%)`
1070
+ : this.isOpen()
1071
+ ? 'translateY(0%)'
1072
+ : 'translateY(100%)');
1073
+ /**
1074
+ * The reference to the Bottom Sheet DOM element.
1075
+ */
1076
+ el = inject(ElementRef);
1077
+ /**
1078
+ * Closes the bottom sheet when clicking outside of it.
1079
+ * @param event The click event.
1080
+ */
1081
+ closeOnOutsideClick(event) {
1082
+ if (this.isOpen() && !this.el.nativeElement.contains(event.target)) {
1083
+ this.isOpen.set(false);
1084
+ this.closeSheet.emit();
1085
+ }
1086
+ }
1087
+ /**
1088
+ * Starts the drag event for the bottom sheet.
1089
+ * @param event The pointer event that starts the drag.
1090
+ */
1091
+ startDrag(event) {
1092
+ this.isDragging.set(true);
1093
+ this.startY.set(event.clientY);
1094
+ // Initialize translateY based on the current state:
1095
+ this.translateY.set(this.isOpen() ? 0 : 100);
1096
+ // Disable text selection for better UX
1097
+ document.body.style.userSelect = 'none';
1098
+ const move = (e) => this.updateDrag(e.clientY);
1099
+ const end = () => {
1100
+ this.isDragging.set(false);
1101
+ this.snapToOpenOrClose();
1102
+ // Restore text selection
1103
+ document.body.style.userSelect = '';
1104
+ window.removeEventListener('pointermove', move);
1105
+ window.removeEventListener('pointerup', end);
1106
+ };
1107
+ window.addEventListener('pointermove', move, { passive: false });
1108
+ window.addEventListener('pointerup', end);
1109
+ }
1110
+ /**
1111
+ * Updates the drag position of the bottom sheet.
1112
+ * @param clientY The current Y position of the pointer.
1113
+ */
1114
+ updateDrag(clientY) {
1115
+ const deltaPx = clientY - this.startY();
1116
+ const sheetHeight = this.el.nativeElement.offsetHeight;
1117
+ // Convert the pixel delta to a percentage relative to the sheet height
1118
+ const deltaPercent = (deltaPx / sheetHeight) * 100;
1119
+ // If open, the initial position is 0%; if closed, it is 100%
1120
+ const newPos = Math.min(100, Math.max(0, this.isOpen() ? 0 + deltaPercent : 100 + deltaPercent));
1121
+ this.translateY.set(newPos);
1122
+ }
1123
+ /**
1124
+ * Snaps the bottom sheet to either open or closed state based on the drag position.
1125
+ */
1126
+ snapToOpenOrClose() {
1127
+ if (this.translateY() > this.closeThreshold()) {
1128
+ this.isOpen.set(false);
1129
+ }
1130
+ else {
1131
+ this.isOpen.set(true);
1132
+ }
1133
+ }
1134
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BottomSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
1135
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: BottomSheet, isStandalone: true, selector: "r-bottom-sheet", inputs: { isOpen: { classPropertyName: "isOpen", publicName: "isOpen", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, closeThreshold: { classPropertyName: "closeThreshold", publicName: "closeThreshold", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isOpen: "isOpenChange", closeSheet: "closeSheet" }, host: { listeners: { "document:click": "closeOnOutsideClick($event)" }, properties: { "style.height": "height()", "class.dragging": "isDragging()", "style.transform": "transform()", "class.open": "isOpen()" } }, ngImport: i0, template: "<div class=\"drag-section\" (pointerdown)=\"startDrag($event)\">\r\n <div class=\"drag-indicator\"></div>\r\n</div>\r\n<ng-content />\r\n", dependencies: [{ kind: "ngmodule", type: CommonModule }] });
1136
+ }
1137
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: BottomSheet, decorators: [{
1138
+ type: Component,
1139
+ args: [{ selector: 'r-bottom-sheet', standalone: true, imports: [CommonModule], host: {
1140
+ '[style.height]': 'height()',
1141
+ '[class.dragging]': 'isDragging()',
1142
+ '[style.transform]': 'transform()',
1143
+ '[class.open]': 'isOpen()',
1144
+ }, template: "<div class=\"drag-section\" (pointerdown)=\"startDrag($event)\">\r\n <div class=\"drag-indicator\"></div>\r\n</div>\r\n<ng-content />\r\n" }]
1145
+ }], propDecorators: { closeOnOutsideClick: [{
1146
+ type: HostListener,
1147
+ args: ['document:click', ['$event']]
1148
+ }] } });
1149
+
1150
+ /**
1151
+ * Service that handles responsive design functionality
1152
+ * Detects current device type based on window width and configurable breakpoints
1153
+ */
1154
+ class ResponsiveService {
1155
+ /** Signal that holds the breakpoint configuration */
1156
+ breakpoints = signal({
1157
+ mobile: 576,
1158
+ tablet: 992,
1159
+ desktop: 1200,
1160
+ });
1161
+ /** Signal that holds the current window width */
1162
+ windowWidth = signal(0);
1163
+ /**
1164
+ * Computed signal that returns the current device type based on window width
1165
+ * @returns The current device type ('mobile', 'tablet', or 'desktop')
1166
+ */
1167
+ currentDevice = computed(() => {
1168
+ const width = this.windowWidth();
1169
+ const breaks = this.breakpoints();
1170
+ if (width < breaks.mobile) {
1171
+ return 'mobile';
1172
+ }
1173
+ if (width < breaks.tablet) {
1174
+ return 'tablet';
1175
+ }
1176
+ return 'desktop';
1177
+ });
1178
+ constructor() {
1179
+ afterRenderEffect(() => {
1180
+ this.initializeWindowWidth();
1181
+ this.setupResizeListener();
1182
+ });
1183
+ }
1184
+ /**
1185
+ * Initializes the window width signal with the current window inner width
1186
+ * Only called in browser environment
1187
+ */
1188
+ initializeWindowWidth() {
1189
+ this.windowWidth.set(window.innerWidth);
1190
+ }
1191
+ /**
1192
+ * Sets up the resize event listener to update window width
1193
+ * Only called in browser environment
1194
+ */
1195
+ setupResizeListener() {
1196
+ window.addEventListener('resize', () => {
1197
+ this.windowWidth.set(window.innerWidth);
1198
+ });
1199
+ }
1200
+ /**
1201
+ * Updates the breakpoint configuration
1202
+ * @param newBreakpoints - Partial breakpoint configuration to update
1203
+ */
1204
+ updateBreakpoints(newBreakpoints) {
1205
+ this.breakpoints.update(current => ({
1206
+ ...current,
1207
+ ...newBreakpoints,
1208
+ }));
1209
+ }
1210
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ResponsiveService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1211
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ResponsiveService, providedIn: 'root' });
1212
+ }
1213
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ResponsiveService, decorators: [{
1214
+ type: Injectable,
1215
+ args: [{
1216
+ providedIn: 'root',
1217
+ }]
1218
+ }], ctorParameters: () => [] });
1219
+
1220
+ class AttachedBox {
1221
+ /**
1222
+ * Input signal to define the interaction type: 'click' or 'hover'.
1223
+ * Default is 'click'.
1224
+ */
1225
+ type = input('click');
1226
+ /**
1227
+ * The trigger element that will be used to open the content.
1228
+ */
1229
+ trigger = inject(ElementRef);
1230
+ /**
1231
+ * The content that will be displayed when the trigger is activated.
1232
+ */
1233
+ content = viewChild('content');
1234
+ /**
1235
+ * The position of the content relative to the trigger.
1236
+ * Example values: 'top-left', 'bottom-center', etc.
1237
+ */
1238
+ position = model('right-top');
1239
+ /**
1240
+ * Signal indicating whether the content is visible or not.
1241
+ */
1242
+ isContentVisible = signal(false);
1243
+ /**
1244
+ * The gap (spacing) between the trigger and the content.
1245
+ */
1246
+ gap = model(10);
1247
+ /**
1248
+ * Signal that dynamically calculates and provides the adjusted position of the content.
1249
+ * This position is adjusted to prevent overflow and ensure optimal visibility.
1250
+ */
1251
+ adjustedPosition = linkedSignal(() => this.calculateAdjustedPosition());
1252
+ /**
1253
+ * Signal that provides the animation parameters based on the adjusted
1254
+ * position of the content. These parameters are used to animate the content.
1255
+ */
1256
+ animationParams = computed(() => {
1257
+ const position = this.adjustedPosition();
1258
+ const direction = position.split('-')[0];
1259
+ const isCenter = position.includes('center');
1260
+ const defaultParams = {
1261
+ duration: '0.15s',
1262
+ enterDelay: '0s',
1263
+ leaveDelay: '0.1s',
1264
+ scaleFrom: 0.99,
1265
+ scaleTo: 1,
1266
+ translateFrom: '',
1267
+ translateTo: '',
1268
+ };
1269
+ switch (direction) {
1270
+ case 'top':
1271
+ return {
1272
+ ...defaultParams,
1273
+ translateFrom: isCenter
1274
+ ? 'translate(-50%, 10px)'
1275
+ : 'translateY(10px)',
1276
+ translateTo: isCenter ? 'translate(-50%, 0)' : 'translateY(0)',
1277
+ };
1278
+ case 'bottom':
1279
+ return {
1280
+ ...defaultParams,
1281
+ translateFrom: isCenter
1282
+ ? 'translate(-50%, -10px)'
1283
+ : 'translateY(-10px)',
1284
+ translateTo: isCenter ? 'translate(-50%, 0)' : 'translateY(0)',
1285
+ };
1286
+ case 'left':
1287
+ return {
1288
+ ...defaultParams,
1289
+ translateFrom: isCenter
1290
+ ? 'translate(10px, -50%)'
1291
+ : 'translateX(10px)',
1292
+ translateTo: isCenter ? 'translate(0, -50%)' : 'translateX(0)',
1293
+ };
1294
+ case 'right':
1295
+ return {
1296
+ ...defaultParams,
1297
+ translateFrom: isCenter
1298
+ ? 'translate(-10px, -50%)'
1299
+ : 'translateX(-10px)',
1300
+ translateTo: isCenter ? 'translate(0, -50%)' : 'translateX(0)',
1301
+ };
1302
+ default:
1303
+ return defaultParams;
1304
+ }
1305
+ });
1306
+ /**
1307
+ * Recalculates and updates the content's adjusted position when the window is scrolled.
1308
+ * This ensures the content remains correctly positioned relative to the trigger even when scrolling.
1309
+ */
1310
+ onWindowEvent() {
1311
+ this.adjustedPosition.set(this.calculateAdjustedPosition());
1312
+ }
1313
+ /**
1314
+ * Closes the content when a click event occurs outside both the trigger and content elements.
1315
+ * @param event The mouse event representing the click.
1316
+ */
1317
+ onClickOutside(event) {
1318
+ if (this.isContentVisible() &&
1319
+ this.isClickedOutsideContent(event) &&
1320
+ this.isClickedOutsideTrigger(event)) {
1321
+ this.isContentVisible.set(false);
1322
+ }
1323
+ }
1324
+ /**
1325
+ * Determines if a click event occurred outside the trigger and content elements.
1326
+ * @param event The mouse event representing the click.
1327
+ * @returns True if the click was outside both the trigger and content elements, false otherwise.
1328
+ */
1329
+ isClickedOutsideContent(event) {
1330
+ const contentElement = this.content()?.nativeElement;
1331
+ if (!contentElement) {
1332
+ return false;
1333
+ }
1334
+ return !contentElement.contains(event.target);
1335
+ }
1336
+ /**
1337
+ * Determines if a click event occurred outside the trigger element.
1338
+ * @param event The mouse event representing the click.
1339
+ * @returns True if the click was outside the trigger element, false otherwise.
1340
+ */
1341
+ isClickedOutsideTrigger(event) {
1342
+ const triggerElement = this.trigger?.nativeElement;
1343
+ if (!triggerElement) {
1344
+ return false;
1345
+ }
1346
+ return !triggerElement.contains(event.target);
1347
+ }
1348
+ /**
1349
+ * Handles keyboard events for the component.
1350
+ * @param event The keyboard event to handle.
1351
+ */
1352
+ handleKeyboardEvent(event) {
1353
+ if (event.key === 'Escape' || event.key === 'Enter') {
1354
+ this.toggleContentVisibility();
1355
+ }
1356
+ }
1357
+ /**
1358
+ * Handles mouse events for the component.
1359
+ * @param event The mouse event to handle.
1360
+ */
1361
+ handleMouseEvent(event) {
1362
+ if (this.isClickedOutsideContent(event) &&
1363
+ !this.isClickedOutsideTrigger(event)) {
1364
+ this.toggleContentVisibility();
1365
+ }
1366
+ }
1367
+ /**
1368
+ * Toggles the visibility of the content, switching between visible and hidden states.
1369
+ * This method is typically called in response to user interaction with the trigger element.
1370
+ */
1371
+ toggleContentVisibility() {
1372
+ this.isContentVisible.set(!this.isContentVisible());
1373
+ }
1374
+ /**
1375
+ * Shows the content (used for hover interaction).
1376
+ */
1377
+ showContent() {
1378
+ this.isContentVisible.set(true);
1379
+ }
1380
+ /**
1381
+ * Hides the content (used for hover interaction).
1382
+ */
1383
+ hideContent() {
1384
+ this.isContentVisible.set(false);
1385
+ }
1386
+ /**
1387
+ * Calculates the optimal adjusted position for the content relative to the trigger.
1388
+ * This method considers available space in the viewport to prevent content overflow
1389
+ * and ensures the content is fully visible to the user.
1390
+ * @returns The adjusted position as a Position type string (e.g., 'bottom-left').
1391
+ */
1392
+ calculateAdjustedPosition() {
1393
+ if (!this.trigger?.nativeElement || !this.content()?.nativeElement) {
1394
+ return this.position();
1395
+ }
1396
+ const triggerElement = this.trigger.nativeElement;
1397
+ const contentElement = this.content().nativeElement;
1398
+ const triggerRect = triggerElement.getBoundingClientRect();
1399
+ const contentRect = contentElement.getBoundingClientRect();
1400
+ const extraMargin = this.gap();
1401
+ const [primary, secondary] = this.position().split('-');
1402
+ const adjustedPrimary = this.adjustPrimaryDirection(primary, triggerRect, contentRect, extraMargin);
1403
+ const adjustedSecondary = this.adjustSecondaryAlignment(secondary, adjustedPrimary, triggerRect, contentRect);
1404
+ return `${adjustedPrimary}-${adjustedSecondary}`;
1405
+ }
1406
+ /**
1407
+ * Adjusts the primary direction (top, bottom, left, right) of the content's position
1408
+ * based on available viewport space. This ensures the content does not overflow the screen
1409
+ * in the primary direction.
1410
+ * @param primary The initially desired primary direction.
1411
+ * @param triggerRect The bounding rectangle of the trigger element.
1412
+ * @param contentRect The bounding rectangle of the content element.
1413
+ * @param margin Extra margin to consider for spacing around the content.
1414
+ * @returns The adjusted primary direction.
1415
+ */
1416
+ adjustPrimaryDirection(primary, triggerRect, contentRect, margin) {
1417
+ if (['top', 'bottom'].includes(primary)) {
1418
+ const neededSpace = contentRect.height + margin;
1419
+ const spaceBelow = window.innerHeight - triggerRect.bottom;
1420
+ const spaceAbove = triggerRect.top;
1421
+ if (primary === 'bottom' &&
1422
+ spaceBelow < neededSpace &&
1423
+ spaceAbove > spaceBelow) {
1424
+ return 'top';
1425
+ }
1426
+ if (primary === 'top' &&
1427
+ spaceAbove < neededSpace &&
1428
+ spaceBelow > spaceAbove) {
1429
+ return 'bottom';
1430
+ }
1431
+ }
1432
+ else {
1433
+ const neededSpace = contentRect.width + margin;
1434
+ const spaceRight = window.innerWidth - triggerRect.right;
1435
+ const spaceLeft = triggerRect.left;
1436
+ if (primary === 'right' &&
1437
+ spaceRight < neededSpace &&
1438
+ spaceLeft > spaceRight) {
1439
+ return 'left';
1440
+ }
1441
+ if (primary === 'left' &&
1442
+ spaceLeft < neededSpace &&
1443
+ spaceRight > spaceLeft) {
1444
+ return 'right';
1445
+ }
1446
+ }
1447
+ return primary;
1448
+ }
1449
+ /**
1450
+ * Adjusts the secondary alignment (left, right, center for top/bottom primary, top, bottom, center for left/right primary)
1451
+ * of the content's position to prevent horizontal or vertical overflow. This method ensures that
1452
+ * the content is fully visible within the viewport in the secondary dimension.
1453
+ * @param secondary The initially desired secondary alignment.
1454
+ * @param primary The already adjusted primary direction.
1455
+ * @param triggerRect The bounding rectangle of the trigger element.
1456
+ * @param contentRect The bounding rectangle of the content element.
1457
+ * @returns The adjusted secondary alignment.
1458
+ */
1459
+ adjustSecondaryAlignment(secondary, primary, triggerRect, contentRect) {
1460
+ if (['top', 'bottom'].includes(primary)) {
1461
+ if (secondary === 'left') {
1462
+ const contentRightPos = triggerRect.left + contentRect.width;
1463
+ if (contentRightPos > window.innerWidth) {
1464
+ return 'right';
1465
+ }
1466
+ }
1467
+ else if (secondary === 'right') {
1468
+ const contentLeftPos = triggerRect.right - contentRect.width;
1469
+ if (contentLeftPos < 0) {
1470
+ return 'left';
1471
+ }
1472
+ }
1473
+ else if (secondary === 'center') {
1474
+ const triggerCenter = triggerRect.left + triggerRect.width / 2;
1475
+ const contentLeftPos = triggerCenter - contentRect.width / 2;
1476
+ const contentRightPos = contentLeftPos + contentRect.width;
1477
+ if (contentLeftPos < 0) {
1478
+ return 'left';
1479
+ }
1480
+ else if (contentRightPos > window.innerWidth) {
1481
+ return 'right';
1482
+ }
1483
+ }
1484
+ }
1485
+ else if (['left', 'right'].includes(primary)) {
1486
+ if (secondary === 'top') {
1487
+ const contentBottomPos = triggerRect.top + contentRect.height;
1488
+ if (contentBottomPos > window.innerHeight) {
1489
+ return 'bottom';
1490
+ }
1491
+ }
1492
+ else if (secondary === 'bottom') {
1493
+ const contentTopPos = triggerRect.bottom - contentRect.height;
1494
+ if (contentTopPos < 0) {
1495
+ return 'top';
1496
+ }
1497
+ }
1498
+ else if (secondary === 'center') {
1499
+ const triggerCenter = triggerRect.top + triggerRect.height / 2;
1500
+ const contentTopPos = triggerCenter - contentRect.height / 2;
1501
+ const contentBottomPos = contentTopPos + contentRect.height;
1502
+ if (contentTopPos < 0) {
1503
+ return 'top';
1504
+ }
1505
+ else if (contentBottomPos > window.innerHeight) {
1506
+ return 'bottom';
1507
+ }
1508
+ }
1509
+ }
1510
+ return secondary;
1511
+ }
1512
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AttachedBox, deps: [], target: i0.ɵɵFactoryTarget.Component });
1513
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: AttachedBox, isStandalone: true, selector: "r-attached-box", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { position: "positionChange", gap: "gapChange" }, host: { listeners: { "click": "type() === \"click\" ? handleMouseEvent($event) : null", "keydown": "handleKeyboardEvent($event)", "mouseenter": "type() === \"hover\" ? showContent() : null", "mouseleave": "type() === \"hover\" ? hideContent() : null", "window:scroll": "onWindowEvent()", "window:resize": "onWindowEvent()", "document:click": "onClickOutside($event)" }, properties: { "attr.tabindex": "0" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content select=\"[r-attached-box-trigger]\" />\r\n<div\r\n #content\r\n class=\"r-attached-box-content\"\r\n [class]=\"adjustedPosition()\"\r\n [class.visible]=\"isContentVisible()\"\r\n [style.--gap.px]=\"gap()\"\r\n [style.--duration]=\"animationParams().duration\"\r\n [style.--enter-delay]=\"animationParams().enterDelay\"\r\n [style.--leave-delay]=\"animationParams().leaveDelay\"\r\n [style.--scale-from]=\"animationParams().scaleFrom\"\r\n [style.--scale-to]=\"animationParams().scaleTo\"\r\n [style.--translate-from]=\"animationParams().translateFrom\"\r\n [style.--translate-to]=\"animationParams().translateTo\">\r\n <ng-content select=\"[r-attached-box-content]\" />\r\n</div>\r\n" });
1514
+ }
1515
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: AttachedBox, decorators: [{
1516
+ type: Component,
1517
+ args: [{ selector: 'r-attached-box', host: {
1518
+ '[attr.tabindex]': '0',
1519
+ '(click)': 'type() === "click" ? handleMouseEvent($event) : null',
1520
+ '(keydown)': 'handleKeyboardEvent($event)',
1521
+ '(mouseenter)': 'type() === "hover" ? showContent() : null',
1522
+ '(mouseleave)': 'type() === "hover" ? hideContent() : null',
1523
+ }, template: "<ng-content select=\"[r-attached-box-trigger]\" />\r\n<div\r\n #content\r\n class=\"r-attached-box-content\"\r\n [class]=\"adjustedPosition()\"\r\n [class.visible]=\"isContentVisible()\"\r\n [style.--gap.px]=\"gap()\"\r\n [style.--duration]=\"animationParams().duration\"\r\n [style.--enter-delay]=\"animationParams().enterDelay\"\r\n [style.--leave-delay]=\"animationParams().leaveDelay\"\r\n [style.--scale-from]=\"animationParams().scaleFrom\"\r\n [style.--scale-to]=\"animationParams().scaleTo\"\r\n [style.--translate-from]=\"animationParams().translateFrom\"\r\n [style.--translate-to]=\"animationParams().translateTo\">\r\n <ng-content select=\"[r-attached-box-content]\" />\r\n</div>\r\n" }]
1524
+ }], propDecorators: { onWindowEvent: [{
1525
+ type: HostListener,
1526
+ args: ['window:scroll']
1527
+ }, {
1528
+ type: HostListener,
1529
+ args: ['window:resize']
1530
+ }], onClickOutside: [{
1531
+ type: HostListener,
1532
+ args: ['document:click', ['$event']]
1533
+ }] } });
1534
+
1535
+ class Label {
1536
+ /**
1537
+ * The input element.
1538
+ */
1539
+ input = contentChild(Input);
1540
+ /**
1541
+ * The select element.
1542
+ */
1543
+ select = contentChild(Select);
1544
+ /**
1545
+ * The switch element.
1546
+ */
1547
+ switch = contentChild(Switch);
1548
+ /**
1549
+ * The checkbox element.
1550
+ */
1551
+ checkbox = contentChild(Checkbox);
1552
+ /**
1553
+ * The textarea element.
1554
+ */
1555
+ textarea = contentChild(Textarea);
1556
+ /**
1557
+ * Whether the label should be up.
1558
+ */
1559
+ labelUp = computed(() => {
1560
+ const input = this.input();
1561
+ const select = this.select();
1562
+ const textarea = this.textarea();
1563
+ return (input?.focused() ||
1564
+ input?.value() ||
1565
+ input?.placeholder() ||
1566
+ select?.value() ||
1567
+ textarea?.focused() ||
1568
+ textarea?.value() ||
1569
+ textarea?.placeholder());
1570
+ });
1571
+ /**
1572
+ * The label width.
1573
+ */
1574
+ maxWidth = computed(() => {
1575
+ const input = this.input();
1576
+ const textarea = this.textarea();
1577
+ return input?.maxWidth() || this.select()?.maxWidth() || textarea?.cols();
1578
+ });
1579
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Label, deps: [], target: i0.ɵɵFactoryTarget.Component });
1580
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: Label, isStandalone: true, selector: "r-label", host: { properties: { "class.up": "labelUp()", "style.max-width": "maxWidth()", "class.is-switch": "switch()", "class.is-checkbox": "checkbox()", "class.is-textarea": "textarea()" } }, queries: [{ propertyName: "input", first: true, predicate: Input, descendants: true, isSignal: true }, { propertyName: "select", first: true, predicate: Select, descendants: true, isSignal: true }, { propertyName: "switch", first: true, predicate: Switch, descendants: true, isSignal: true }, { propertyName: "checkbox", first: true, predicate: Checkbox, descendants: true, isSignal: true }, { propertyName: "textarea", first: true, predicate: Textarea, descendants: true, isSignal: true }], ngImport: i0, template: `<ng-content />`, isInline: true });
1581
+ }
1582
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Label, decorators: [{
1583
+ type: Component,
1584
+ args: [{
1585
+ selector: 'r-label',
1586
+ imports: [],
1587
+ template: `<ng-content />`,
1588
+ host: {
1589
+ '[class.up]': 'labelUp()',
1590
+ '[style.max-width]': 'maxWidth()',
1591
+ '[class.is-switch]': 'switch()',
1592
+ '[class.is-checkbox]': 'checkbox()',
1593
+ '[class.is-textarea]': 'textarea()',
1594
+ },
1595
+ }]
1596
+ }] });
1597
+
1598
+ class Badge {
1599
+ /** The variant of the badge. */
1600
+ variant = input('primary');
1601
+ /** The size of the badge. */
1602
+ size = input('default');
1603
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
1604
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Badge, isStandalone: true, selector: "span[r-badge]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "variant() + \" size-\" + size()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
1605
+ }
1606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Badge, decorators: [{
1607
+ type: Component,
1608
+ args: [{
1609
+ selector: 'span[r-badge]',
1610
+ template: `<ng-content />`,
1611
+ host: {
1612
+ '[class]': 'variant() + " size-" + size()',
1613
+ },
1614
+ }]
1615
+ }] });
1616
+
1617
+ class Checkbox {
1618
+ /**
1619
+ * Value of the checkbox.
1620
+ */
1621
+ value = model(false);
1622
+ /**
1623
+ * Reference to the checkbox element.
1624
+ */
1625
+ el = inject(ElementRef);
1626
+ /**
1627
+ * Event emitted when the value changes.
1628
+ */
1629
+ valueChange = output();
1630
+ /**
1631
+ * Initializes the checkbox value after the view is initialized.
1632
+ */
1633
+ ngAfterViewInit() {
1634
+ this.value.set(this.el.nativeElement.checked);
1635
+ }
1636
+ /**
1637
+ * Toggles the value of the checkbox.
1638
+ */
1639
+ toggleValue() {
1640
+ const newValue = !this.value();
1641
+ this.value.set(newValue);
1642
+ this.valueChange.emit(newValue);
1643
+ }
1644
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Checkbox, deps: [], target: i0.ɵɵFactoryTarget.Component });
1645
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Checkbox, isStandalone: true, selector: "input[r-checkbox]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", valueChange: "valueChange" }, host: { listeners: { "click": "toggleValue()", "keydown.enter": "toggleValue()", "keydown.space": "toggleValue()" }, properties: { "attr.role": "checkbox", "attr.checked": "value()", "attr.aria-checked": "value()" } }, ngImport: i0, template: ``, isInline: true });
1646
+ }
1647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Checkbox, decorators: [{
1648
+ type: Component,
1649
+ args: [{
1650
+ selector: 'input[r-checkbox]',
1651
+ template: ``,
1652
+ host: {
1653
+ '[attr.role]': 'checkbox',
1654
+ '[attr.checked]': 'value()',
1655
+ '[attr.aria-checked]': 'value()',
1656
+ '(click)': 'toggleValue()',
1657
+ '(keydown.enter)': 'toggleValue()',
1658
+ '(keydown.space)': 'toggleValue()',
1659
+ },
1660
+ }]
1661
+ }] });
1662
+
1663
+ class Textarea {
1664
+ /**
1665
+ * The placeholder text for the textarea.
1666
+ */
1667
+ placeholder = input('');
1668
+ /**
1669
+ * The value of the textarea.
1670
+ */
1671
+ value = signal(null);
1672
+ /**
1673
+ * The number of rows for the textarea.
1674
+ */
1675
+ rows = input(3);
1676
+ /**
1677
+ * The number of columns for the textarea.
1678
+ */
1679
+ cols = input(30);
1680
+ /**
1681
+ * Whether the textarea is invalid.
1682
+ */
1683
+ invalid = model(false);
1684
+ /**
1685
+ * Whether the textarea is disabled.
1686
+ */
1687
+ disabled = model(false);
1688
+ /**
1689
+ * Whether the textarea is focused.
1690
+ * This will be used by the Label component.
1691
+ */
1692
+ focused = signal(false);
1693
+ /**
1694
+ * Event emitted when the value changes.
1695
+ */
1696
+ valueChange = output();
1697
+ /**
1698
+ * Reference to the textarea element.
1699
+ */
1700
+ el = inject(ElementRef);
1701
+ /**
1702
+ * Handles the input event.
1703
+ * @param event The input event.
1704
+ */
1705
+ onInput(event) {
1706
+ const target = event.target;
1707
+ this.value.set(target.value);
1708
+ this.valueChange.emit(target.value);
1709
+ }
1710
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Textarea, deps: [], target: i0.ɵɵFactoryTarget.Component });
1711
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Textarea, isStandalone: true, selector: "textarea[r-textarea]", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, cols: { classPropertyName: "cols", publicName: "cols", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { invalid: "invalidChange", disabled: "disabledChange", valueChange: "valueChange" }, host: { listeners: { "input": "onInput($event)", "focus": "focused.set(true)", "blur": "focused.set(false)" }, properties: { "placeholder": "placeholder() || \"\"", "rows": "rows()", "cols": "cols()", "class.ng-invalid": "invalid()", "class.disabled": "disabled()" } }, ngImport: i0, template: ``, isInline: true });
1712
+ }
1713
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Textarea, decorators: [{
1714
+ type: Component,
1715
+ args: [{
1716
+ selector: 'textarea[r-textarea]',
1717
+ template: ``,
1718
+ host: {
1719
+ '[placeholder]': 'placeholder() || ""',
1720
+ '[rows]': 'rows()',
1721
+ '[cols]': 'cols()',
1722
+ '[class.ng-invalid]': 'invalid()',
1723
+ '[class.disabled]': 'disabled()',
1724
+ '(input)': 'onInput($event)',
1725
+ '(focus)': 'focused.set(true)',
1726
+ '(blur)': 'focused.set(false)',
1727
+ },
1728
+ }]
1729
+ }] });
1730
+
1731
+ class InputGroup {
1732
+ /**
1733
+ * Whether the input group elements are separated by a border.
1734
+ */
1735
+ bordered = input(true);
1736
+ /**
1737
+ * The maximum width of the input.
1738
+ */
1739
+ maxWidth = input('');
1740
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
1741
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: InputGroup, isStandalone: true, selector: "r-input-group", inputs: { bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.bordered": "bordered()", "style.max-width": "maxWidth()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
1742
+ }
1743
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: InputGroup, decorators: [{
1744
+ type: Component,
1745
+ args: [{
1746
+ selector: 'r-input-group',
1747
+ template: `<ng-content />`,
1748
+ host: {
1749
+ '[class.bordered]': 'bordered()',
1750
+ '[style.max-width]': 'maxWidth()',
1751
+ },
1752
+ }]
1753
+ }] });
1754
+
1755
+ class Range {
1756
+ /**
1757
+ * Current value of the range.
1758
+ */
1759
+ value = model('0');
1760
+ /**
1761
+ * Maximum width of the range slider.
1762
+ */
1763
+ maxWidth = input('100%');
1764
+ /**
1765
+ * Reference to the range element.
1766
+ */
1767
+ el = inject(ElementRef);
1768
+ /**
1769
+ * Initializes the range value after the view is initialized.
1770
+ */
1771
+ ngAfterViewInit() {
1772
+ this.value.set(this.el.nativeElement.value);
1773
+ }
1774
+ /**
1775
+ * Handles the input event to update the value.
1776
+ */
1777
+ onInput(event) {
1778
+ this.value.set(event.target.value);
1779
+ }
1780
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Range, deps: [], target: i0.ɵɵFactoryTarget.Component });
1781
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Range, isStandalone: true, selector: "input[r-range]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { listeners: { "input": "onInput($event)" }, properties: { "attr.value": "value()", "style.max-width": "maxWidth()" } }, ngImport: i0, template: ``, isInline: true });
1782
+ }
1783
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Range, decorators: [{
1784
+ type: Component,
1785
+ args: [{
1786
+ selector: 'input[r-range]',
1787
+ template: ``,
1788
+ host: {
1789
+ '[attr.value]': 'value()',
1790
+ '[style.max-width]': 'maxWidth()',
1791
+ '(input)': 'onInput($event)',
1792
+ },
1793
+ }]
1794
+ }] });
1795
+
1796
+ /**
1797
+ * TooltipComponent is a reusable UI component that displays a tooltip
1798
+ * with customizable position, gap, variant, and size.
1799
+ */
1800
+ class TooltipComponent {
1801
+ /**
1802
+ * The position of the tooltip relative to its trigger element.
1803
+ * Defaults to 'top-center'.
1804
+ */
1805
+ position = input('top-center');
1806
+ /**
1807
+ * The gap (in pixels) between the tooltip and its trigger element.
1808
+ * Defaults to 8.
1809
+ */
1810
+ gap = input(8);
1811
+ /**
1812
+ * The visual variant of the tooltip. Options include:
1813
+ * - 'primary'
1814
+ * - 'secondary'
1815
+ * - 'ghost'
1816
+ * - 'outlined'
1817
+ * Defaults to 'primary'.
1818
+ */
1819
+ variant = input('primary');
1820
+ /**
1821
+ * The size of the tooltip. Options include:
1822
+ * - 'small'
1823
+ * - 'default'
1824
+ * Defaults to 'default'.
1825
+ */
1826
+ size = input('default');
1827
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TooltipComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1828
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: TooltipComponent, isStandalone: true, selector: "r-tooltip", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: `
1829
+ <r-attached-box [type]="'hover'" [position]="position()" [gap]="gap()">
1830
+ <ng-content r-attached-box-trigger />
1831
+ <div
1832
+ r-attached-box-content
1833
+ class="r-tooltip-content"
1834
+ [class]="variant() + ' size-' + size()">
1835
+ <ng-content select="[r-tooltip-content]" />
1836
+ </div>
1837
+ </r-attached-box>
1838
+ `, isInline: true, dependencies: [{ kind: "component", type: AttachedBox, selector: "r-attached-box", inputs: ["type", "position", "gap"], outputs: ["positionChange", "gapChange"] }] });
1839
+ }
1840
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TooltipComponent, decorators: [{
1841
+ type: Component,
1842
+ args: [{
1843
+ selector: 'r-tooltip',
1844
+ template: `
1845
+ <r-attached-box [type]="'hover'" [position]="position()" [gap]="gap()">
1846
+ <ng-content r-attached-box-trigger />
1847
+ <div
1848
+ r-attached-box-content
1849
+ class="r-tooltip-content"
1850
+ [class]="variant() + ' size-' + size()">
1851
+ <ng-content select="[r-tooltip-content]" />
1852
+ </div>
1853
+ </r-attached-box>
1854
+ `,
1855
+ standalone: true,
1856
+ imports: [AttachedBox],
1857
+ }]
1858
+ }] });
1859
+
1860
+ class ColorPicker {
1861
+ /**
1862
+ * Specifies the maximum width of the input.
1863
+ */
1864
+ maxWidth = input('');
1865
+ /**
1866
+ * Represents the value of the input.
1867
+ */
1868
+ value = signal('#ffffff');
1869
+ /**
1870
+ * Computed signal for the text color with single quotes.
1871
+ */
1872
+ valueWithSingleQuotes = computed(() => {
1873
+ return `'${this.value()}'`;
1874
+ });
1875
+ /**
1876
+ * A computed signal that dynamically calculates the text color based on the resolved value.
1877
+ */
1878
+ textColor = computed(() => {
1879
+ const backgroundColor = this.resolveColor(this.value());
1880
+ const hex = backgroundColor.replace('#', '');
1881
+ const r = parseInt(hex.substring(0, 2), 16);
1882
+ const g = parseInt(hex.substring(2, 4), 16);
1883
+ const b = parseInt(hex.substring(4, 6), 16);
1884
+ const luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;
1885
+ return luminance > 128 ? '#000000' : '#FFFFFF';
1886
+ });
1887
+ /**
1888
+ * Indicates whether the input is focused.
1889
+ */
1890
+ focused = signal(false);
1891
+ /**
1892
+ * A reference to the `NgModel` directive.
1893
+ */
1894
+ ngModel = contentChild(NgModel);
1895
+ /**
1896
+ * Indicates whether to show the color value.
1897
+ */
1898
+ showColor = input(true);
1899
+ /**
1900
+ * A reference to the native element.
1901
+ */
1902
+ el = inject(ElementRef);
1903
+ /**
1904
+ * A reference to the control container.
1905
+ */
1906
+ controlContainer = inject(ControlContainer, { optional: true });
1907
+ /**
1908
+ * Lifecycle hook that is called after the view has been initialized.
1909
+ * Sets the initial value of the picker and attaches event listeners.
1910
+ */
1911
+ ngAfterViewInit() {
1912
+ const formControl = this.controlContainer?.control?.get(this.el.nativeElement.getAttribute('formControlName'));
1913
+ // Inicializa el valor del signal
1914
+ this.value.set(this.el?.nativeElement.value || this.ngModel()?.value || '#000000');
1915
+ // Suscríbete a los cambios del FormControl
1916
+ formControl?.valueChanges.subscribe((newValue) => {
1917
+ this.value.set(newValue || '#000000');
1918
+ });
1919
+ }
1920
+ /**
1921
+ * Resolves a color value, handling cases like `transparent` or `color-mix`.
1922
+ * @param value The input color value.
1923
+ * @returns A valid hexadecimal color.
1924
+ */
1925
+ resolveColor(value) {
1926
+ // Handle `color-mix` values
1927
+ const colorMixMatch = value.match(/color-mix\(in srgb, (#[0-9a-fA-F]{6}), (#[0-9a-fA-F]{6}) (\d+)%\)/);
1928
+ if (colorMixMatch) {
1929
+ const [, color1, color2, percentage] = colorMixMatch;
1930
+ return this.calculateColorMix(color1, color2, parseInt(percentage, 10) / 100);
1931
+ }
1932
+ // Handle `transparent` values
1933
+ if (value === 'transparent') {
1934
+ return '#ffffff'; // Default to white for transparency
1935
+ }
1936
+ return value; // Return the original value if no special cases
1937
+ }
1938
+ /**
1939
+ * Calculates the result of a `color-mix` operation.
1940
+ * @param color1 The first color in hexadecimal format.
1941
+ * @param color2 The second color in hexadecimal format.
1942
+ * @param percentage The mix percentage for the second color.
1943
+ * @returns The resulting mixed color in hexadecimal format.
1944
+ */
1945
+ calculateColorMix(color1, color2, percentage) {
1946
+ const hexToRgb = (hex) => {
1947
+ const bigint = parseInt(hex.replace('#', ''), 16);
1948
+ return {
1949
+ r: (bigint >> 16) & 255,
1950
+ g: (bigint >> 8) & 255,
1951
+ b: bigint & 255,
1952
+ };
1953
+ };
1954
+ const rgbToHex = (r, g, b) => `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
1955
+ const rgb1 = hexToRgb(color1);
1956
+ const rgb2 = hexToRgb(color2);
1957
+ const r = Math.round(rgb1.r * (1 - percentage) + rgb2.r * percentage);
1958
+ const g = Math.round(rgb1.g * (1 - percentage) + rgb2.g * percentage);
1959
+ const b = Math.round(rgb1.b * (1 - percentage) + rgb2.b * percentage);
1960
+ return rgbToHex(r, g, b);
1961
+ }
1962
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1963
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: ColorPicker, isStandalone: true, selector: "input[r-color-picker]", inputs: { maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, showColor: { classPropertyName: "showColor", publicName: "showColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "focus": "focused.set(true)", "blur": "focused.set(false)", "input": "value.set($event.target.value)" }, properties: { "class.focused": "focused()", "style.max-width": "maxWidth()", "style.--value": "valueWithSingleQuotes()", "style.--text-color": "textColor()", "class.show-color": "showColor()" } }, queries: [{ propertyName: "ngModel", first: true, predicate: NgModel, descendants: true, isSignal: true }], ngImport: i0, template: ``, isInline: true });
1964
+ }
1965
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: ColorPicker, decorators: [{
1966
+ type: Component,
1967
+ args: [{
1968
+ selector: 'input[r-color-picker]',
1969
+ imports: [],
1970
+ template: ``,
1971
+ host: {
1972
+ '[class.focused]': 'focused()',
1973
+ '[style.max-width]': 'maxWidth()',
1974
+ '[style.--value]': 'valueWithSingleQuotes()',
1975
+ '[style.--text-color]': 'textColor()',
1976
+ '[class.show-color]': 'showColor()',
1977
+ '(focus)': 'focused.set(true)',
1978
+ '(blur)': 'focused.set(false)',
1979
+ '(input)': 'value.set($event.target.value)',
1980
+ },
1981
+ }]
1982
+ }] });
1983
+
1984
+ /**
1985
+ * Represents a tree node component that can be extended, collapsed,
1986
+ * and optionally supports drag-and-drop functionality.
1987
+ */
1988
+ class TreeNode {
1989
+ /**
1990
+ * Indicates whether the node is extended (expanded).
1991
+ */
1992
+ extended = model(false);
1993
+ /**
1994
+ * Reference to the `CdkDrag` directive for drag-and-drop functionality.
1995
+ */
1996
+ node = inject(CdkDrag);
1997
+ /**
1998
+ * Reference to a nested `Tree` component, if present.
1999
+ */
2000
+ nestedTree = contentChild(Tree);
2001
+ /**
2002
+ * Emits an event when the node is closed.
2003
+ */
2004
+ closeEmitter = output();
2005
+ /**
2006
+ * Lifecycle hook that is called after the component is initialized.
2007
+ */
2008
+ ngOnInit() {
2009
+ this.node.lockAxis = 'y';
2010
+ }
2011
+ /**
2012
+ * Updates the disabled state of the node.
2013
+ * @param disabled - Whether the node should be disabled.
2014
+ */
2015
+ handleNodeDisability(disabled) {
2016
+ this.node.disabled = disabled;
2017
+ }
2018
+ /**
2019
+ * Toggles the extended (expanded) state of the node.
2020
+ * Emits a close event if the node is collapsed and contains a nested tree.
2021
+ */
2022
+ handleExtension() {
2023
+ const isExtended = this.extended();
2024
+ this.extended.set(!isExtended);
2025
+ if (isExtended && this.nestedTree()) {
2026
+ this.closeEmitter.emit();
2027
+ }
2028
+ }
2029
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TreeNode, deps: [], target: i0.ɵɵFactoryTarget.Component });
2030
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: TreeNode, isStandalone: true, selector: "r-tree-node", inputs: { extended: { classPropertyName: "extended", publicName: "extended", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { extended: "extendedChange", closeEmitter: "closeEmitter" }, queries: [{ propertyName: "nestedTree", first: true, predicate: Tree, descendants: true, isSignal: true }], hostDirectives: [{ directive: i1.CdkDrag, inputs: ["cdkDragDisabled", "disabled"] }], ngImport: i0, template: "<section>\r\n @if (!node.disabled) {\r\n <i r-icon icon=\"GripVertical\" [size]=\"15\" cdkDragHandle></i>\r\n }\r\n <div\r\n class=\"projected-content\"\r\n (click)=\"nestedTree() && handleExtension()\"\r\n (keydown.enter)=\"nestedTree() && handleExtension()\"\r\n (keydown.space)=\"nestedTree() && handleExtension()\"\r\n role=\"button\"\r\n tabindex=\"0\">\r\n <ng-content />\r\n </div>\r\n @if (nestedTree()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"20\"\r\n height=\"20\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\">\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n }\r\n</section>\r\n@if (nestedTree() && extended()) {\r\n <div class=\"nested\">\r\n <ng-content select=\"r-tree\" />\r\n </div>\r\n}\r\n", dependencies: [{ kind: "component", type: Icon, selector: "i[r-icon]", inputs: ["icon", "size", "strokeWidth", "color"] }, { kind: "directive", type: CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }] });
2031
+ }
2032
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: TreeNode, decorators: [{
2033
+ type: Component,
2034
+ args: [{ selector: 'r-tree-node', imports: [Icon, CdkDragHandle], hostDirectives: [
2035
+ {
2036
+ directive: CdkDrag,
2037
+ inputs: ['cdkDragDisabled: disabled'],
2038
+ },
2039
+ ], template: "<section>\r\n @if (!node.disabled) {\r\n <i r-icon icon=\"GripVertical\" [size]=\"15\" cdkDragHandle></i>\r\n }\r\n <div\r\n class=\"projected-content\"\r\n (click)=\"nestedTree() && handleExtension()\"\r\n (keydown.enter)=\"nestedTree() && handleExtension()\"\r\n (keydown.space)=\"nestedTree() && handleExtension()\"\r\n role=\"button\"\r\n tabindex=\"0\">\r\n <ng-content />\r\n </div>\r\n @if (nestedTree()) {\r\n <svg\r\n xmlns=\"http://www.w3.org/2000/svg\"\r\n width=\"20\"\r\n height=\"20\"\r\n viewBox=\"0 0 24 24\"\r\n fill=\"none\"\r\n stroke=\"currentColor\"\r\n stroke-width=\"2\"\r\n stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\">\r\n <path d=\"m6 9 6 6 6-6\" />\r\n </svg>\r\n }\r\n</section>\r\n@if (nestedTree() && extended()) {\r\n <div class=\"nested\">\r\n <ng-content select=\"r-tree\" />\r\n </div>\r\n}\r\n" }]
2040
+ }] });
2041
+
2042
+ /**
2043
+ * Represents a tree component that supports drag-and-drop functionality
2044
+ * and manages nested tree nodes.
2045
+ */
2046
+ class Tree {
2047
+ /**
2048
+ * The ID of the tree component.
2049
+ */
2050
+ maxWidth = input('100%');
2051
+ /**
2052
+ * Determines whether the tree is draggable.
2053
+ */
2054
+ draggable = input(false);
2055
+ /**
2056
+ * Reference to the `CdkDropList` directive used for drag-and-drop.
2057
+ */
2058
+ tree = inject(CdkDropList);
2059
+ /**
2060
+ * Collection of nested `TreeNode` components.
2061
+ */
2062
+ nestedNodes = contentChildren(TreeNode);
2063
+ /**
2064
+ * Determines whether to close nodes recursively.
2065
+ */
2066
+ closeRecursively = input(false);
2067
+ /**
2068
+ * Emits an event when a drop occurs in the tree.
2069
+ */
2070
+ dropEmitter = output();
2071
+ /**
2072
+ * Initializes the `Tree` component and sets up reactive effects.
2073
+ */
2074
+ constructor() {
2075
+ effect(() => {
2076
+ this.handleTreeDisability();
2077
+ });
2078
+ }
2079
+ /**
2080
+ * Lifecycle hook that is called after the component is initialized.
2081
+ */
2082
+ ngOnInit() {
2083
+ if (this.closeRecursively())
2084
+ this.handleCloseRecursively();
2085
+ }
2086
+ /**
2087
+ * Updates the disabled state of the tree and its nested nodes.
2088
+ */
2089
+ handleTreeDisability() {
2090
+ const isDisabled = !this.draggable();
2091
+ this.tree.disabled = isDisabled;
2092
+ this.nestedNodes().forEach(node => {
2093
+ node.handleNodeDisability(isDisabled);
2094
+ });
2095
+ }
2096
+ /**
2097
+ * Sets up recursive closing behavior for nested nodes.
2098
+ */
2099
+ handleCloseRecursively() {
2100
+ this.nestedNodes().forEach(node => {
2101
+ node.closeEmitter.subscribe(() => {
2102
+ this.closeNestedNodes();
2103
+ });
2104
+ });
2105
+ }
2106
+ /**
2107
+ * Closes all nested nodes recursively.
2108
+ */
2109
+ closeNestedNodes() {
2110
+ this.nestedNodes().forEach(node => {
2111
+ node.extended.set(false);
2112
+ node.nestedTree()?.closeNestedNodes();
2113
+ });
2114
+ }
2115
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tree, deps: [], target: i0.ɵɵFactoryTarget.Component });
2116
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.7", type: Tree, isStandalone: true, selector: "r-tree", inputs: { maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null }, draggable: { classPropertyName: "draggable", publicName: "draggable", isSignal: true, isRequired: false, transformFunction: null }, closeRecursively: { classPropertyName: "closeRecursively", publicName: "closeRecursively", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dropEmitter: "dropEmitter" }, host: { listeners: { "cdkDropListDropped": "dropEmitter.emit($event)" }, properties: { "style.max-width": "maxWidth()" } }, queries: [{ propertyName: "nestedNodes", predicate: TreeNode, isSignal: true }], hostDirectives: [{ directive: i1.CdkDropList, inputs: ["id", "id", "cdkDropListConnectedTo", "connectedTo"], outputs: ["cdkDropListDropped", "cdkDropListDropped"] }, { directive: i1.CdkDropListGroup }], ngImport: i0, template: `<ng-content />`, isInline: true });
2117
+ }
2118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Tree, decorators: [{
2119
+ type: Component,
2120
+ args: [{
2121
+ selector: 'r-tree',
2122
+ template: `<ng-content />`,
2123
+ host: {
2124
+ '(cdkDropListDropped)': 'dropEmitter.emit($event)',
2125
+ '[style.max-width]': 'maxWidth()',
2126
+ },
2127
+ hostDirectives: [
2128
+ {
2129
+ directive: CdkDropList,
2130
+ inputs: ['id', 'cdkDropListConnectedTo: connectedTo'],
2131
+ outputs: ['cdkDropListDropped'],
2132
+ },
2133
+ CdkDropListGroup,
2134
+ ],
2135
+ }]
2136
+ }], ctorParameters: () => [] });
2137
+
2138
+ /**
2139
+ * Represents a menu component that can optionally float.
2140
+ */
2141
+ class Menu {
2142
+ /**
2143
+ * Determines whether the menu is floating.
2144
+ * @default false
2145
+ */
2146
+ floating = input(false);
2147
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Menu, deps: [], target: i0.ɵɵFactoryTarget.Component });
2148
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.7", type: Menu, isStandalone: true, selector: "r-menu", inputs: { floating: { classPropertyName: "floating", publicName: "floating", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.floating": "floating()" } }, hostDirectives: [{ directive: i1$1.CdkMenu }], ngImport: i0, template: `<ng-content />`, isInline: true });
2149
+ }
2150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Menu, decorators: [{
2151
+ type: Component,
2152
+ args: [{
2153
+ selector: 'r-menu',
2154
+ imports: [],
2155
+ template: `<ng-content />`,
2156
+ host: {
2157
+ '[class.floating]': 'floating()',
2158
+ },
2159
+ hostDirectives: [CdkMenu],
2160
+ }]
2161
+ }] });
2162
+
2163
+ /**
2164
+ * Represents a label for a menu.
2165
+ */
2166
+ class MenuLabel {
2167
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuLabel, deps: [], target: i0.ɵɵFactoryTarget.Component });
2168
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: MenuLabel, isStandalone: true, selector: "r-menu-label", ngImport: i0, template: `<ng-content />`, isInline: true });
2169
+ }
2170
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuLabel, decorators: [{
2171
+ type: Component,
2172
+ args: [{
2173
+ selector: 'r-menu-label',
2174
+ imports: [],
2175
+ template: `<ng-content />`,
2176
+ }]
2177
+ }] });
2178
+
2179
+ /**
2180
+ * Represents a menu item with support for typeahead and disabled states.
2181
+ */
2182
+ class MenuItemComponent {
2183
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2184
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: MenuItemComponent, isStandalone: true, selector: "r-menu-item", hostDirectives: [{ directive: i1$1.CdkMenuItem, inputs: ["cdkMenuItemDisabled", "disabled", "cdkMenuitemTypeaheadLabel", "typeaheadLabel"], outputs: ["cdkMenuItemTriggered", "triggered"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
2185
+ }
2186
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemComponent, decorators: [{
2187
+ type: Component,
2188
+ args: [{
2189
+ selector: 'r-menu-item',
2190
+ imports: [],
2191
+ template: `<ng-content />`,
2192
+ hostDirectives: [
2193
+ {
2194
+ directive: CdkMenuItem,
2195
+ inputs: [
2196
+ 'cdkMenuItemDisabled: disabled',
2197
+ 'cdkMenuitemTypeaheadLabel: typeaheadLabel',
2198
+ ],
2199
+ outputs: ['cdkMenuItemTriggered: triggered'],
2200
+ },
2201
+ ],
2202
+ }]
2203
+ }] });
2204
+
2205
+ /**
2206
+ * Represents a checkbox menu item.
2207
+ */
2208
+ class MenuItemCheckboxComponent {
2209
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemCheckboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2210
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: MenuItemCheckboxComponent, isStandalone: true, selector: "r-menu-item-checkbox", hostDirectives: [{ directive: i1$1.CdkMenuItemCheckbox, inputs: ["cdkMenuItemDisabled", "disabled", "cdkMenuitemTypeaheadLabel", "typeaheadLabel", "cdkMenuItemChecked", "active"], outputs: ["cdkMenuItemTriggered", "triggered"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
2211
+ }
2212
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemCheckboxComponent, decorators: [{
2213
+ type: Component,
2214
+ args: [{
2215
+ selector: 'r-menu-item-checkbox',
2216
+ imports: [],
2217
+ template: `<ng-content />`,
2218
+ hostDirectives: [
2219
+ {
2220
+ directive: CdkMenuItemCheckbox,
2221
+ inputs: [
2222
+ 'cdkMenuItemDisabled: disabled',
2223
+ 'cdkMenuitemTypeaheadLabel: typeaheadLabel',
2224
+ 'cdkMenuItemChecked: active',
2225
+ ],
2226
+ outputs: ['cdkMenuItemTriggered: triggered'],
2227
+ },
2228
+ ],
2229
+ }]
2230
+ }] });
2231
+
2232
+ /**
2233
+ * Represents a radio menu item.
2234
+ */
2235
+ class MenuItemRadioComponent {
2236
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemRadioComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2237
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.7", type: MenuItemRadioComponent, isStandalone: true, selector: "r-menu-item-radio", hostDirectives: [{ directive: i1$1.CdkMenuItemRadio, inputs: ["cdkMenuItemDisabled", "disabled", "cdkMenuitemTypeaheadLabel", "typeaheadLabel", "cdkMenuItemChecked", "active"], outputs: ["cdkMenuItemTriggered", "triggered"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
2238
+ }
2239
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuItemRadioComponent, decorators: [{
2240
+ type: Component,
2241
+ args: [{
2242
+ selector: 'r-menu-item-radio',
2243
+ imports: [],
2244
+ template: `<ng-content />`,
2245
+ hostDirectives: [
2246
+ {
2247
+ directive: CdkMenuItemRadio,
2248
+ inputs: [
2249
+ 'cdkMenuItemDisabled: disabled',
2250
+ 'cdkMenuitemTypeaheadLabel: typeaheadLabel',
2251
+ 'cdkMenuItemChecked: active',
2252
+ ],
2253
+ outputs: ['cdkMenuItemTriggered: triggered'],
2254
+ },
2255
+ ],
2256
+ }]
2257
+ }] });
2258
+
2259
+ class MenuTrigger {
2260
+ trigger = inject(CdkMenuTrigger);
2261
+ menuTriggerPosition = input('right-top');
2262
+ submenu = input(false);
2263
+ ngOnInit() {
2264
+ this.setPosition();
2265
+ }
2266
+ setPosition() {
2267
+ const positionMap = {
2268
+ 'top-left': {
2269
+ originX: 'start',
2270
+ originY: 'top',
2271
+ overlayX: 'start',
2272
+ overlayY: 'bottom',
2273
+ offsetY: !this.submenu() ? -5 : undefined,
2274
+ },
2275
+ 'top-center': {
2276
+ originX: 'center',
2277
+ originY: 'top',
2278
+ overlayX: 'center',
2279
+ overlayY: 'bottom',
2280
+ offsetY: !this.submenu() ? -5 : undefined,
2281
+ },
2282
+ 'top-right': {
2283
+ originX: 'end',
2284
+ originY: 'top',
2285
+ overlayX: 'end',
2286
+ overlayY: 'bottom',
2287
+ offsetY: !this.submenu() ? -5 : undefined,
2288
+ },
2289
+ 'bottom-left': {
2290
+ originX: 'start',
2291
+ originY: 'bottom',
2292
+ overlayX: 'start',
2293
+ overlayY: 'top',
2294
+ offsetY: !this.submenu() ? 5 : undefined,
2295
+ },
2296
+ 'bottom-center': {
2297
+ originX: 'center',
2298
+ originY: 'bottom',
2299
+ overlayX: 'center',
2300
+ overlayY: 'top',
2301
+ offsetY: !this.submenu() ? 5 : undefined,
2302
+ },
2303
+ 'bottom-right': {
2304
+ originX: 'end',
2305
+ originY: 'bottom',
2306
+ overlayX: 'end',
2307
+ overlayY: 'top',
2308
+ offsetY: !this.submenu() ? 5 : undefined,
2309
+ },
2310
+ 'left-top': {
2311
+ originX: 'start',
2312
+ originY: 'top',
2313
+ overlayX: 'end',
2314
+ overlayY: 'top',
2315
+ offsetX: !this.submenu() ? -5 : undefined,
2316
+ },
2317
+ 'left-center': {
2318
+ originX: 'start',
2319
+ originY: 'center',
2320
+ overlayX: 'end',
2321
+ overlayY: 'center',
2322
+ offsetX: !this.submenu() ? -5 : undefined,
2323
+ },
2324
+ 'left-bottom': {
2325
+ originX: 'start',
2326
+ originY: 'bottom',
2327
+ overlayX: 'end',
2328
+ overlayY: 'bottom',
2329
+ offsetX: !this.submenu() ? -5 : undefined,
2330
+ },
2331
+ 'right-top': {
2332
+ originX: 'end',
2333
+ originY: 'top',
2334
+ overlayX: 'start',
2335
+ overlayY: 'top',
2336
+ offsetX: !this.submenu() ? 5 : undefined,
2337
+ },
2338
+ 'right-center': {
2339
+ originX: 'end',
2340
+ originY: 'center',
2341
+ overlayX: 'start',
2342
+ overlayY: 'center',
2343
+ offsetX: !this.submenu() ? 5 : undefined,
2344
+ },
2345
+ 'right-bottom': {
2346
+ originX: 'end',
2347
+ originY: 'bottom',
2348
+ overlayX: 'start',
2349
+ overlayY: 'bottom',
2350
+ offsetX: !this.submenu() ? 5 : undefined,
2351
+ },
2352
+ };
2353
+ const connectedPosition = positionMap[this.menuTriggerPosition()];
2354
+ this.trigger.menuPosition = [connectedPosition];
2355
+ }
2356
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2357
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.7", type: MenuTrigger, isStandalone: true, selector: "[menuTriggerFor]", inputs: { menuTriggerPosition: { classPropertyName: "menuTriggerPosition", publicName: "menuTriggerPosition", isSignal: true, isRequired: false, transformFunction: null }, submenu: { classPropertyName: "submenu", publicName: "submenu", isSignal: true, isRequired: false, transformFunction: null } }, hostDirectives: [{ directive: i1$1.CdkMenuTrigger, inputs: ["cdkMenuTriggerFor", "menuTriggerFor"] }], ngImport: i0 });
2358
+ }
2359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: MenuTrigger, decorators: [{
2360
+ type: Directive,
2361
+ args: [{
2362
+ selector: '[menuTriggerFor]',
2363
+ hostDirectives: [
2364
+ {
2365
+ directive: CdkMenuTrigger,
2366
+ inputs: ['cdkMenuTriggerFor: menuTriggerFor'],
2367
+ },
2368
+ ],
2369
+ }]
2370
+ }] });
2371
+
2372
+ class Alert {
2373
+ /** The type of the alert. */
2374
+ type = input('info');
2375
+ /** The title of the alert. */
2376
+ title = input(null);
2377
+ /** The icon of the alert. */
2378
+ icon = input(null);
2379
+ /** Whether the alert is dismissible. */
2380
+ dismissible = input(false);
2381
+ /** Event emitted when the alert is dismissed. */
2382
+ dismissed = output();
2383
+ /** The maximum width of the alert. */
2384
+ maxWidth = input(null);
2385
+ /** The color foreground of the alert. */
2386
+ colorForeground = computed(() => {
2387
+ return this.type() === 'info'
2388
+ ? 'var(--secondary-foreground)'
2389
+ : `var(--${this.type()}-foreground)`;
2390
+ });
2391
+ dismiss() {
2392
+ this.dismissed.emit();
2393
+ }
2394
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Alert, deps: [], target: i0.ɵɵFactoryTarget.Component });
2395
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.7", type: Alert, isStandalone: true, selector: "r-alert", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null }, maxWidth: { classPropertyName: "maxWidth", publicName: "maxWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dismissed: "dismissed" }, host: { properties: { "class": "type()", "style.max-width": "maxWidth()" } }, ngImport: i0, template: "@if (icon()) {\r\n <div class=\"icon\">\r\n <i r-icon [icon]=\"icon()!\" [size]=\"20\" [color]=\"colorForeground()\"></i>\r\n </div>\r\n}\r\n<div class=\"content\">\r\n @if (title()) {\r\n <div class=\"title\">\r\n {{ title() }}\r\n </div>\r\n }\r\n\r\n <div class=\"body\">\r\n <ng-content />\r\n </div>\r\n</div>\r\n@if (dismissible()) {\r\n <button class=\"close-btn\" (click)=\"dismiss()\">\r\n <i r-icon icon=\"X\" [size]=\"20\" [color]=\"colorForeground()\"></i>\r\n </button>\r\n}\r\n", dependencies: [{ kind: "component", type: Icon, selector: "i[r-icon]", inputs: ["icon", "size", "strokeWidth", "color"] }] });
2396
+ }
2397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.7", ngImport: i0, type: Alert, decorators: [{
2398
+ type: Component,
2399
+ args: [{ selector: 'r-alert', imports: [Icon], host: {
2400
+ '[class]': 'type()',
2401
+ '[style.max-width]': 'maxWidth()',
2402
+ }, template: "@if (icon()) {\r\n <div class=\"icon\">\r\n <i r-icon [icon]=\"icon()!\" [size]=\"20\" [color]=\"colorForeground()\"></i>\r\n </div>\r\n}\r\n<div class=\"content\">\r\n @if (title()) {\r\n <div class=\"title\">\r\n {{ title() }}\r\n </div>\r\n }\r\n\r\n <div class=\"body\">\r\n <ng-content />\r\n </div>\r\n</div>\r\n@if (dismissible()) {\r\n <button class=\"close-btn\" (click)=\"dismiss()\">\r\n <i r-icon icon=\"X\" [size]=\"20\" [color]=\"colorForeground()\"></i>\r\n </button>\r\n}\r\n" }]
2403
+ }] });
2404
+
2405
+ /*
2406
+ * Public API Surface of basis-ng
2407
+ */
2408
+ /* Theme Service */
2409
+
2410
+ /**
2411
+ * Generated bundle index. Do not edit.
2412
+ */
2413
+
2414
+ export { Alert, AttachedBox, Badge, BottomSheet, Button, ButtonGroup, Checkbox, ColorPicker, Icon, InViewportDirective, InViewportService, Input, InputGroup, Label, LazyContentDirective, Menu, MenuItemCheckboxComponent, MenuItemComponent, MenuItemRadioComponent, MenuLabel, MenuTrigger, Option, Range, ResponsiveService, Row, RowItem, Search, Select, SideSheet, Spinner, Switch, Tab, Table, Tabs, Textarea, ThemeService, TooltipComponent, Tree, TreeNode };
2415
+ //# sourceMappingURL=basis-ng-primitives.mjs.map