@raqm/ui 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/LICENSE +21 -0
- package/NOTICE.md +28 -0
- package/README.md +126 -3
- package/combobox/README.md +17 -0
- package/fesm2022/raqm-ui-accordion.mjs +414 -0
- package/fesm2022/raqm-ui-accordion.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs +457 -0
- package/fesm2022/raqm-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-alert.mjs +195 -0
- package/fesm2022/raqm-ui-alert.mjs.map +1 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs +66 -0
- package/fesm2022/raqm-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/raqm-ui-attachment.mjs +435 -0
- package/fesm2022/raqm-ui-attachment.mjs.map +1 -0
- package/fesm2022/raqm-ui-avatar.mjs +337 -0
- package/fesm2022/raqm-ui-avatar.mjs.map +1 -0
- package/fesm2022/raqm-ui-badge.mjs +68 -0
- package/fesm2022/raqm-ui-badge.mjs.map +1 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs +309 -0
- package/fesm2022/raqm-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/raqm-ui-button-group.mjs +138 -0
- package/fesm2022/raqm-ui-button-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-button.mjs +295 -0
- package/fesm2022/raqm-ui-button.mjs.map +1 -0
- package/fesm2022/raqm-ui-calendar.mjs +1394 -0
- package/fesm2022/raqm-ui-calendar.mjs.map +1 -0
- package/fesm2022/raqm-ui-card.mjs +331 -0
- package/fesm2022/raqm-ui-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-carousel.mjs +410 -0
- package/fesm2022/raqm-ui-carousel.mjs.map +1 -0
- package/fesm2022/raqm-ui-checkbox.mjs +86 -0
- package/fesm2022/raqm-ui-checkbox.mjs.map +1 -0
- package/fesm2022/raqm-ui-collapsible.mjs +266 -0
- package/fesm2022/raqm-ui-collapsible.mjs.map +1 -0
- package/fesm2022/raqm-ui-combobox.mjs +1584 -0
- package/fesm2022/raqm-ui-combobox.mjs.map +1 -0
- package/fesm2022/raqm-ui-command.mjs +1210 -0
- package/fesm2022/raqm-ui-command.mjs.map +1 -0
- package/fesm2022/raqm-ui-context-menu.mjs +723 -0
- package/fesm2022/raqm-ui-context-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-dialog.mjs +1214 -0
- package/fesm2022/raqm-ui-dialog.mjs.map +1 -0
- package/fesm2022/raqm-ui-drawer.mjs +687 -0
- package/fesm2022/raqm-ui-drawer.mjs.map +1 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs +1168 -0
- package/fesm2022/raqm-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-empty.mjs +272 -0
- package/fesm2022/raqm-ui-empty.mjs.map +1 -0
- package/fesm2022/raqm-ui-field.mjs +517 -0
- package/fesm2022/raqm-ui-field.mjs.map +1 -0
- package/fesm2022/raqm-ui-hover-card.mjs +828 -0
- package/fesm2022/raqm-ui-hover-card.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-group.mjs +270 -0
- package/fesm2022/raqm-ui-input-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-input-otp.mjs +788 -0
- package/fesm2022/raqm-ui-input-otp.mjs.map +1 -0
- package/fesm2022/raqm-ui-input.mjs +73 -0
- package/fesm2022/raqm-ui-input.mjs.map +1 -0
- package/fesm2022/raqm-ui-item.mjs +495 -0
- package/fesm2022/raqm-ui-item.mjs.map +1 -0
- package/fesm2022/raqm-ui-kbd.mjs +80 -0
- package/fesm2022/raqm-ui-kbd.mjs.map +1 -0
- package/fesm2022/raqm-ui-label.mjs +44 -0
- package/fesm2022/raqm-ui-label.mjs.map +1 -0
- package/fesm2022/raqm-ui-menubar.mjs +536 -0
- package/fesm2022/raqm-ui-menubar.mjs.map +1 -0
- package/fesm2022/raqm-ui-native-select.mjs +131 -0
- package/fesm2022/raqm-ui-native-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs +1399 -0
- package/fesm2022/raqm-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs +185 -0
- package/fesm2022/raqm-ui-overlay-internal.mjs.map +1 -0
- package/fesm2022/raqm-ui-pagination.mjs +440 -0
- package/fesm2022/raqm-ui-pagination.mjs.map +1 -0
- package/fesm2022/raqm-ui-popover.mjs +1495 -0
- package/fesm2022/raqm-ui-popover.mjs.map +1 -0
- package/fesm2022/raqm-ui-progress.mjs +369 -0
- package/fesm2022/raqm-ui-progress.mjs.map +1 -0
- package/fesm2022/raqm-ui-questionnaire.mjs +1005 -0
- package/fesm2022/raqm-ui-questionnaire.mjs.map +1 -0
- package/fesm2022/raqm-ui-radio-group.mjs +151 -0
- package/fesm2022/raqm-ui-radio-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-resizable.mjs +439 -0
- package/fesm2022/raqm-ui-resizable.mjs.map +1 -0
- package/fesm2022/raqm-ui-scroll-area.mjs +510 -0
- package/fesm2022/raqm-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/raqm-ui-select.mjs +1073 -0
- package/fesm2022/raqm-ui-select.mjs.map +1 -0
- package/fesm2022/raqm-ui-separator.mjs +103 -0
- package/fesm2022/raqm-ui-separator.mjs.map +1 -0
- package/fesm2022/raqm-ui-sheet.mjs +411 -0
- package/fesm2022/raqm-ui-sheet.mjs.map +1 -0
- package/fesm2022/raqm-ui-sidebar.mjs +1784 -0
- package/fesm2022/raqm-ui-sidebar.mjs.map +1 -0
- package/fesm2022/raqm-ui-skeleton.mjs +50 -0
- package/fesm2022/raqm-ui-skeleton.mjs.map +1 -0
- package/fesm2022/raqm-ui-slider.mjs +609 -0
- package/fesm2022/raqm-ui-slider.mjs.map +1 -0
- package/fesm2022/raqm-ui-spinner.mjs +137 -0
- package/fesm2022/raqm-ui-spinner.mjs.map +1 -0
- package/fesm2022/raqm-ui-switch.mjs +109 -0
- package/fesm2022/raqm-ui-switch.mjs.map +1 -0
- package/fesm2022/raqm-ui-table.mjs +271 -0
- package/fesm2022/raqm-ui-table.mjs.map +1 -0
- package/fesm2022/raqm-ui-tabs.mjs +536 -0
- package/fesm2022/raqm-ui-tabs.mjs.map +1 -0
- package/fesm2022/raqm-ui-textarea.mjs +37 -0
- package/fesm2022/raqm-ui-textarea.mjs.map +1 -0
- package/fesm2022/raqm-ui-toast.mjs +918 -0
- package/fesm2022/raqm-ui-toast.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle-group.mjs +462 -0
- package/fesm2022/raqm-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/raqm-ui-toggle.mjs +158 -0
- package/fesm2022/raqm-ui-toggle.mjs.map +1 -0
- package/fesm2022/raqm-ui-tooltip.mjs +1226 -0
- package/fesm2022/raqm-ui-tooltip.mjs.map +1 -0
- package/fesm2022/raqm-ui.mjs +50 -0
- package/input-otp/README.md +12 -0
- package/package.json +275 -3
- package/styles/theme.css +4324 -0
- package/types/raqm-ui-accordion.d.ts +124 -0
- package/types/raqm-ui-alert-dialog.d.ts +81 -0
- package/types/raqm-ui-alert.d.ts +29 -0
- package/types/raqm-ui-aspect-ratio.d.ts +13 -0
- package/types/raqm-ui-attachment.d.ts +72 -0
- package/types/raqm-ui-avatar.d.ts +67 -0
- package/types/raqm-ui-badge.d.ts +20 -0
- package/types/raqm-ui-breadcrumb.d.ts +35 -0
- package/types/raqm-ui-button-group.d.ts +27 -0
- package/types/raqm-ui-button.d.ts +80 -0
- package/types/raqm-ui-calendar.d.ts +359 -0
- package/types/raqm-ui-card.d.ts +34 -0
- package/types/raqm-ui-carousel.d.ts +81 -0
- package/types/raqm-ui-checkbox.d.ts +24 -0
- package/types/raqm-ui-collapsible.d.ts +72 -0
- package/types/raqm-ui-combobox.d.ts +405 -0
- package/types/raqm-ui-command.d.ts +256 -0
- package/types/raqm-ui-context-menu.d.ts +196 -0
- package/types/raqm-ui-dialog.d.ts +232 -0
- package/types/raqm-ui-drawer.d.ts +121 -0
- package/types/raqm-ui-dropdown-menu.d.ts +319 -0
- package/types/raqm-ui-empty.d.ts +35 -0
- package/types/raqm-ui-field.d.ts +88 -0
- package/types/raqm-ui-hover-card.d.ts +139 -0
- package/types/raqm-ui-input-group.d.ts +45 -0
- package/types/raqm-ui-input-otp.d.ts +197 -0
- package/types/raqm-ui-input.d.ts +16 -0
- package/types/raqm-ui-item.d.ts +71 -0
- package/types/raqm-ui-kbd.d.ts +12 -0
- package/types/raqm-ui-label.d.ts +6 -0
- package/types/raqm-ui-menubar.d.ts +159 -0
- package/types/raqm-ui-native-select.d.ts +23 -0
- package/types/raqm-ui-navigation-menu.d.ts +230 -0
- package/types/raqm-ui-overlay-internal.d.ts +5 -0
- package/types/raqm-ui-pagination.d.ts +84 -0
- package/types/raqm-ui-popover.d.ts +235 -0
- package/types/raqm-ui-progress.d.ts +79 -0
- package/types/raqm-ui-questionnaire.d.ts +217 -0
- package/types/raqm-ui-radio-group.d.ts +48 -0
- package/types/raqm-ui-resizable.d.ts +98 -0
- package/types/raqm-ui-scroll-area.d.ts +132 -0
- package/types/raqm-ui-select.d.ts +205 -0
- package/types/raqm-ui-separator.d.ts +21 -0
- package/types/raqm-ui-sheet.d.ts +79 -0
- package/types/raqm-ui-sidebar.d.ts +285 -0
- package/types/raqm-ui-skeleton.d.ts +6 -0
- package/types/raqm-ui-slider.d.ts +129 -0
- package/types/raqm-ui-spinner.d.ts +32 -0
- package/types/raqm-ui-switch.d.ts +32 -0
- package/types/raqm-ui-table.d.ts +36 -0
- package/types/raqm-ui-tabs.d.ts +154 -0
- package/types/raqm-ui-textarea.d.ts +6 -0
- package/types/raqm-ui-toast.d.ts +190 -0
- package/types/raqm-ui-toggle-group.d.ts +167 -0
- package/types/raqm-ui-toggle.d.ts +42 -0
- package/types/raqm-ui-tooltip.d.ts +207 -0
- package/types/raqm-ui.d.ts +50 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, DestroyRef, ElementRef, booleanAttribute, computed, inject, input } from "@angular/core";
|
|
3
|
+
var RaqmButton = class RaqmButton {
|
|
4
|
+
host = inject(ElementRef);
|
|
5
|
+
isAnchor = this.host.nativeElement.tagName === "A";
|
|
6
|
+
inInputGroup = this.host.nativeElement.hasAttribute("raqm-input-group-button");
|
|
7
|
+
appearance = input("", {
|
|
8
|
+
...ngDevMode ? { debugName: "appearance" } : /* istanbul ignore next */ {},
|
|
9
|
+
alias: "raqm-button"
|
|
10
|
+
});
|
|
11
|
+
extraSmall = input(false, {
|
|
12
|
+
...ngDevMode ? { debugName: "extraSmall" } : /* istanbul ignore next */ {},
|
|
13
|
+
alias: "extra-small",
|
|
14
|
+
transform: booleanAttribute
|
|
15
|
+
});
|
|
16
|
+
small = input(false, {
|
|
17
|
+
...ngDevMode ? { debugName: "small" } : /* istanbul ignore next */ {},
|
|
18
|
+
transform: booleanAttribute
|
|
19
|
+
});
|
|
20
|
+
large = input(false, {
|
|
21
|
+
...ngDevMode ? { debugName: "large" } : /* istanbul ignore next */ {},
|
|
22
|
+
transform: booleanAttribute
|
|
23
|
+
});
|
|
24
|
+
icon = input(false, {
|
|
25
|
+
...ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {},
|
|
26
|
+
transform: booleanAttribute
|
|
27
|
+
});
|
|
28
|
+
iconExtraSmall = input(false, {
|
|
29
|
+
...ngDevMode ? { debugName: "iconExtraSmall" } : /* istanbul ignore next */ {},
|
|
30
|
+
alias: "icon-extra-small",
|
|
31
|
+
transform: booleanAttribute
|
|
32
|
+
});
|
|
33
|
+
iconSmall = input(false, {
|
|
34
|
+
...ngDevMode ? { debugName: "iconSmall" } : /* istanbul ignore next */ {},
|
|
35
|
+
alias: "icon-small",
|
|
36
|
+
transform: booleanAttribute
|
|
37
|
+
});
|
|
38
|
+
iconLarge = input(false, {
|
|
39
|
+
...ngDevMode ? { debugName: "iconLarge" } : /* istanbul ignore next */ {},
|
|
40
|
+
alias: "icon-large",
|
|
41
|
+
transform: booleanAttribute
|
|
42
|
+
});
|
|
43
|
+
disabled = input(false, {
|
|
44
|
+
...ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {},
|
|
45
|
+
transform: booleanAttribute
|
|
46
|
+
});
|
|
47
|
+
tabIndex = input(null, {
|
|
48
|
+
...ngDevMode ? { debugName: "tabIndex" } : /* istanbul ignore next */ {},
|
|
49
|
+
alias: "tabindex"
|
|
50
|
+
});
|
|
51
|
+
activeVariant = computed(() => this.appearance() || (this.inInputGroup ? "ghost" : "default"), ...ngDevMode ? [{ debugName: "activeVariant" }] : /* istanbul ignore next */ []);
|
|
52
|
+
activeSize = computed(() => {
|
|
53
|
+
const sizes = [
|
|
54
|
+
[this.extraSmall(), "xs"],
|
|
55
|
+
[this.small(), "sm"],
|
|
56
|
+
[this.large(), "lg"],
|
|
57
|
+
[this.icon(), "icon"],
|
|
58
|
+
[this.iconExtraSmall(), "icon-xs"],
|
|
59
|
+
[this.iconSmall(), "icon-sm"],
|
|
60
|
+
[this.iconLarge(), "icon-lg"]
|
|
61
|
+
].filter(([enabled]) => enabled);
|
|
62
|
+
if (sizes.length > 1) throw new Error("RaqmButton: use only one size attribute per button.");
|
|
63
|
+
return sizes[0]?.[1] ?? (this.inInputGroup ? "xs" : "default");
|
|
64
|
+
}, ...ngDevMode ? [{ debugName: "activeSize" }] : /* istanbul ignore next */ []);
|
|
65
|
+
constructor() {
|
|
66
|
+
const element = this.host.nativeElement;
|
|
67
|
+
if (!this.isAnchor && !element.hasAttribute("type")) element.setAttribute("type", "button");
|
|
68
|
+
if (this.isAnchor) {
|
|
69
|
+
const blockDisabled = (event) => {
|
|
70
|
+
if (this.disabled()) {
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
event.stopImmediatePropagation();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const events = [
|
|
76
|
+
"click",
|
|
77
|
+
"auxclick",
|
|
78
|
+
"contextmenu"
|
|
79
|
+
];
|
|
80
|
+
for (const name of events) element.addEventListener(name, blockDisabled, true);
|
|
81
|
+
inject(DestroyRef).onDestroy(() => {
|
|
82
|
+
for (const name of events) element.removeEventListener(name, blockDisabled, true);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
87
|
+
minVersion: "12.0.0",
|
|
88
|
+
version: "22.2.2",
|
|
89
|
+
ngImport: i0,
|
|
90
|
+
type: RaqmButton,
|
|
91
|
+
deps: [],
|
|
92
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
93
|
+
});
|
|
94
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
95
|
+
minVersion: "17.1.0",
|
|
96
|
+
version: "22.2.2",
|
|
97
|
+
type: RaqmButton,
|
|
98
|
+
isStandalone: true,
|
|
99
|
+
selector: "button[raqm-button], a[raqm-button]",
|
|
100
|
+
inputs: {
|
|
101
|
+
appearance: {
|
|
102
|
+
classPropertyName: "appearance",
|
|
103
|
+
publicName: "raqm-button",
|
|
104
|
+
isSignal: true,
|
|
105
|
+
isRequired: false,
|
|
106
|
+
transformFunction: null
|
|
107
|
+
},
|
|
108
|
+
extraSmall: {
|
|
109
|
+
classPropertyName: "extraSmall",
|
|
110
|
+
publicName: "extra-small",
|
|
111
|
+
isSignal: true,
|
|
112
|
+
isRequired: false,
|
|
113
|
+
transformFunction: null
|
|
114
|
+
},
|
|
115
|
+
small: {
|
|
116
|
+
classPropertyName: "small",
|
|
117
|
+
publicName: "small",
|
|
118
|
+
isSignal: true,
|
|
119
|
+
isRequired: false,
|
|
120
|
+
transformFunction: null
|
|
121
|
+
},
|
|
122
|
+
large: {
|
|
123
|
+
classPropertyName: "large",
|
|
124
|
+
publicName: "large",
|
|
125
|
+
isSignal: true,
|
|
126
|
+
isRequired: false,
|
|
127
|
+
transformFunction: null
|
|
128
|
+
},
|
|
129
|
+
icon: {
|
|
130
|
+
classPropertyName: "icon",
|
|
131
|
+
publicName: "icon",
|
|
132
|
+
isSignal: true,
|
|
133
|
+
isRequired: false,
|
|
134
|
+
transformFunction: null
|
|
135
|
+
},
|
|
136
|
+
iconExtraSmall: {
|
|
137
|
+
classPropertyName: "iconExtraSmall",
|
|
138
|
+
publicName: "icon-extra-small",
|
|
139
|
+
isSignal: true,
|
|
140
|
+
isRequired: false,
|
|
141
|
+
transformFunction: null
|
|
142
|
+
},
|
|
143
|
+
iconSmall: {
|
|
144
|
+
classPropertyName: "iconSmall",
|
|
145
|
+
publicName: "icon-small",
|
|
146
|
+
isSignal: true,
|
|
147
|
+
isRequired: false,
|
|
148
|
+
transformFunction: null
|
|
149
|
+
},
|
|
150
|
+
iconLarge: {
|
|
151
|
+
classPropertyName: "iconLarge",
|
|
152
|
+
publicName: "icon-large",
|
|
153
|
+
isSignal: true,
|
|
154
|
+
isRequired: false,
|
|
155
|
+
transformFunction: null
|
|
156
|
+
},
|
|
157
|
+
disabled: {
|
|
158
|
+
classPropertyName: "disabled",
|
|
159
|
+
publicName: "disabled",
|
|
160
|
+
isSignal: true,
|
|
161
|
+
isRequired: false,
|
|
162
|
+
transformFunction: null
|
|
163
|
+
},
|
|
164
|
+
tabIndex: {
|
|
165
|
+
classPropertyName: "tabIndex",
|
|
166
|
+
publicName: "tabindex",
|
|
167
|
+
isSignal: true,
|
|
168
|
+
isRequired: false,
|
|
169
|
+
transformFunction: null
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
host: {
|
|
173
|
+
properties: {
|
|
174
|
+
"attr.data-raqm-variant": "activeVariant()",
|
|
175
|
+
"attr.data-raqm-size": "activeSize()",
|
|
176
|
+
"attr.disabled": "!isAnchor && disabled() ? \"\" : null",
|
|
177
|
+
"attr.aria-disabled": "isAnchor && disabled() ? \"true\" : null",
|
|
178
|
+
"attr.tabindex": "isAnchor && disabled() ? -1 : tabIndex()"
|
|
179
|
+
},
|
|
180
|
+
classAttribute: "raqm-button"
|
|
181
|
+
},
|
|
182
|
+
ngImport: i0,
|
|
183
|
+
template: "<ng-content />",
|
|
184
|
+
isInline: true,
|
|
185
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
189
|
+
minVersion: "12.0.0",
|
|
190
|
+
version: "22.2.2",
|
|
191
|
+
ngImport: i0,
|
|
192
|
+
type: RaqmButton,
|
|
193
|
+
decorators: [{
|
|
194
|
+
type: Component,
|
|
195
|
+
args: [{
|
|
196
|
+
selector: "button[raqm-button], a[raqm-button]",
|
|
197
|
+
template: "<ng-content />",
|
|
198
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
199
|
+
host: {
|
|
200
|
+
class: "raqm-button",
|
|
201
|
+
"[attr.data-raqm-variant]": "activeVariant()",
|
|
202
|
+
"[attr.data-raqm-size]": "activeSize()",
|
|
203
|
+
"[attr.disabled]": "!isAnchor && disabled() ? \"\" : null",
|
|
204
|
+
"[attr.aria-disabled]": "isAnchor && disabled() ? \"true\" : null",
|
|
205
|
+
"[attr.tabindex]": "isAnchor && disabled() ? -1 : tabIndex()"
|
|
206
|
+
}
|
|
207
|
+
}]
|
|
208
|
+
}],
|
|
209
|
+
ctorParameters: () => [],
|
|
210
|
+
propDecorators: {
|
|
211
|
+
appearance: [{
|
|
212
|
+
type: i0.Input,
|
|
213
|
+
args: [{
|
|
214
|
+
isSignal: true,
|
|
215
|
+
alias: "raqm-button",
|
|
216
|
+
required: false
|
|
217
|
+
}]
|
|
218
|
+
}],
|
|
219
|
+
extraSmall: [{
|
|
220
|
+
type: i0.Input,
|
|
221
|
+
args: [{
|
|
222
|
+
isSignal: true,
|
|
223
|
+
alias: "extra-small",
|
|
224
|
+
required: false
|
|
225
|
+
}]
|
|
226
|
+
}],
|
|
227
|
+
small: [{
|
|
228
|
+
type: i0.Input,
|
|
229
|
+
args: [{
|
|
230
|
+
isSignal: true,
|
|
231
|
+
alias: "small",
|
|
232
|
+
required: false
|
|
233
|
+
}]
|
|
234
|
+
}],
|
|
235
|
+
large: [{
|
|
236
|
+
type: i0.Input,
|
|
237
|
+
args: [{
|
|
238
|
+
isSignal: true,
|
|
239
|
+
alias: "large",
|
|
240
|
+
required: false
|
|
241
|
+
}]
|
|
242
|
+
}],
|
|
243
|
+
icon: [{
|
|
244
|
+
type: i0.Input,
|
|
245
|
+
args: [{
|
|
246
|
+
isSignal: true,
|
|
247
|
+
alias: "icon",
|
|
248
|
+
required: false
|
|
249
|
+
}]
|
|
250
|
+
}],
|
|
251
|
+
iconExtraSmall: [{
|
|
252
|
+
type: i0.Input,
|
|
253
|
+
args: [{
|
|
254
|
+
isSignal: true,
|
|
255
|
+
alias: "icon-extra-small",
|
|
256
|
+
required: false
|
|
257
|
+
}]
|
|
258
|
+
}],
|
|
259
|
+
iconSmall: [{
|
|
260
|
+
type: i0.Input,
|
|
261
|
+
args: [{
|
|
262
|
+
isSignal: true,
|
|
263
|
+
alias: "icon-small",
|
|
264
|
+
required: false
|
|
265
|
+
}]
|
|
266
|
+
}],
|
|
267
|
+
iconLarge: [{
|
|
268
|
+
type: i0.Input,
|
|
269
|
+
args: [{
|
|
270
|
+
isSignal: true,
|
|
271
|
+
alias: "icon-large",
|
|
272
|
+
required: false
|
|
273
|
+
}]
|
|
274
|
+
}],
|
|
275
|
+
disabled: [{
|
|
276
|
+
type: i0.Input,
|
|
277
|
+
args: [{
|
|
278
|
+
isSignal: true,
|
|
279
|
+
alias: "disabled",
|
|
280
|
+
required: false
|
|
281
|
+
}]
|
|
282
|
+
}],
|
|
283
|
+
tabIndex: [{
|
|
284
|
+
type: i0.Input,
|
|
285
|
+
args: [{
|
|
286
|
+
isSignal: true,
|
|
287
|
+
alias: "tabindex",
|
|
288
|
+
required: false
|
|
289
|
+
}]
|
|
290
|
+
}]
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
export { RaqmButton };
|
|
294
|
+
|
|
295
|
+
//# sourceMappingURL=raqm-ui-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raqm-ui-button.mjs","names":[],"sources":["../../../projects/ui/button/button.ts"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n DestroyRef,\r\n ElementRef,\r\n booleanAttribute,\r\n computed,\r\n inject,\r\n input,\r\n} from '@angular/core';\r\n\r\ntype ButtonVariant = 'default' | 'outline' | 'secondary' | 'ghost' | 'destructive' | 'link';\r\ntype ButtonSize = 'xs' | 'sm' | 'default' | 'lg' | 'icon-xs' | 'icon-sm' | 'icon' | 'icon-lg';\r\n\r\n/** Native button/anchor styling, with application-owned content and accessible names. */\r\n@Component({\r\n selector: 'button[raqm-button], a[raqm-button]',\r\n template: '<ng-content />',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n host: {\r\n class: 'raqm-button',\r\n '[attr.data-raqm-variant]': 'activeVariant()',\r\n '[attr.data-raqm-size]': 'activeSize()',\r\n '[attr.disabled]': '!isAnchor && disabled() ? \"\" : null',\r\n '[attr.aria-disabled]': 'isAnchor && disabled() ? \"true\" : null',\r\n '[attr.tabindex]': 'isAnchor && disabled() ? -1 : tabIndex()',\r\n },\r\n})\r\nexport class RaqmButton {\r\n private readonly host = inject<ElementRef<HTMLButtonElement | HTMLAnchorElement>>(ElementRef);\r\n protected readonly isAnchor = this.host.nativeElement.tagName === 'A';\r\n private readonly inInputGroup = this.host.nativeElement.hasAttribute('raqm-input-group-button');\r\n\r\n /** Bare marker uses the default appearance (ghost inside an input group). */\r\n readonly appearance = input<ButtonVariant | ''>('', { alias: 'raqm-button' });\r\n readonly extraSmall = input(false, { alias: 'extra-small', transform: booleanAttribute });\r\n readonly small = input(false, { transform: booleanAttribute });\r\n readonly large = input(false, { transform: booleanAttribute });\r\n readonly icon = input(false, { transform: booleanAttribute });\r\n readonly iconExtraSmall = input(false, {\r\n alias: 'icon-extra-small',\r\n transform: booleanAttribute,\r\n });\r\n readonly iconSmall = input(false, { alias: 'icon-small', transform: booleanAttribute });\r\n readonly iconLarge = input(false, { alias: 'icon-large', transform: booleanAttribute });\r\n\r\n /** Native disabled semantics for buttons; equivalent activation blocking for anchors. */\r\n readonly disabled = input(false, { transform: booleanAttribute });\r\n /** Restored when an anchor is re-enabled; accepts static and bound tabindex. */\r\n readonly tabIndex = input<string | number | null>(null, { alias: 'tabindex' });\r\n\r\n protected readonly activeVariant = computed(\r\n () => this.appearance() || (this.inInputGroup ? 'ghost' : 'default'),\r\n );\r\n\r\n /** Size exposed to the shipped styles; input-group members default to xs. */\r\n protected readonly activeSize = computed<ButtonSize>(() => {\r\n const selected = [\r\n [this.extraSmall(), 'xs'],\r\n [this.small(), 'sm'],\r\n [this.large(), 'lg'],\r\n [this.icon(), 'icon'],\r\n [this.iconExtraSmall(), 'icon-xs'],\r\n [this.iconSmall(), 'icon-sm'],\r\n [this.iconLarge(), 'icon-lg'],\r\n ] as const;\r\n const sizes = selected.filter(([enabled]) => enabled);\r\n if (sizes.length > 1) {\r\n throw new Error('RaqmButton: use only one size attribute per button.');\r\n }\r\n\r\n return sizes[0]?.[1] ?? (this.inInputGroup ? 'xs' : 'default');\r\n });\r\n\r\n constructor() {\r\n const element = this.host.nativeElement;\r\n if (!this.isAnchor && !element.hasAttribute('type')) {\r\n element.setAttribute('type', 'button');\r\n }\r\n\r\n if (this.isAnchor) {\r\n // Capture-phase block runs before RouterLink and app listeners; contextmenu is included so a disabled href cannot open.\r\n const blockDisabled = (event: Event): void => {\r\n if (this.disabled()) {\r\n event.preventDefault();\r\n event.stopImmediatePropagation();\r\n }\r\n };\r\n const events = ['click', 'auxclick', 'contextmenu'];\r\n for (const name of events) element.addEventListener(name, blockDisabled, true);\r\n inject(DestroyRef).onDestroy(() => {\r\n for (const name of events) element.removeEventListener(name, blockDisabled, true);\r\n });\r\n }\r\n }\r\n}\r\n"],"mappings":";;AA4BA,IAAa,aAAb,MAAa,WAA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