ngblock 0.0.5 → 0.0.7
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/README.md +70 -9
- package/fesm2022/ngblock.mjs +303 -11
- package/fesm2022/ngblock.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngblock.d.ts +59 -3
package/README.md
CHANGED
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
| Group | Component | Type | Selector |
|
|
6
6
|
| --- | --- | --- | --- |
|
|
7
7
|
| Control / Button | Button text | `control` | `ngb-button-text-control` |
|
|
8
|
+
| Control / Button | Button icon | `control` | `ngb-button-icon-control` |
|
|
9
|
+
| Misc | Icon | `misc` | `ngb-icon` |
|
|
8
10
|
|
|
9
|
-
The
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
The button components are in `src/lib/control/button/`; the icon component is
|
|
12
|
+
in `src/lib/misc/icon/`. Component files use the
|
|
13
|
+
`<component-name>.<type>.<extension>` naming convention, for example
|
|
14
|
+
`button-text.control.ts` and `button-icon.control.ts`.
|
|
12
15
|
|
|
13
16
|
## Use
|
|
14
17
|
|
|
@@ -16,18 +19,28 @@ the `<component-name>.<type>.<extension>` naming convention, for example
|
|
|
16
19
|
npm install ngblock
|
|
17
20
|
```
|
|
18
21
|
|
|
19
|
-
Import
|
|
22
|
+
Import the standalone components you use:
|
|
20
23
|
|
|
21
24
|
```ts
|
|
22
25
|
import { Component } from '@angular/core';
|
|
23
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
ButtonIconComponent,
|
|
28
|
+
ButtonTextComponent,
|
|
29
|
+
IconComponent,
|
|
30
|
+
} from 'ngblock';
|
|
24
31
|
|
|
25
32
|
@Component({
|
|
26
33
|
selector: 'app-example',
|
|
27
|
-
imports: [ButtonTextComponent],
|
|
34
|
+
imports: [ButtonTextComponent, ButtonIconComponent, IconComponent],
|
|
28
35
|
template: `
|
|
29
|
-
<ngb-button-text-control (
|
|
36
|
+
<ngb-button-text-control (clicked)="save($event)">Save</ngb-button-text-control>
|
|
30
37
|
<ngb-button-text-control type="submit" [disabled]="isSaving">Submit</ngb-button-text-control>
|
|
38
|
+
<ngb-button-icon-control
|
|
39
|
+
icon="favorite"
|
|
40
|
+
ariaLabel="Add to favorites"
|
|
41
|
+
(clicked)="addToFavorites($event)"
|
|
42
|
+
/>
|
|
43
|
+
<ngb-icon glyph="★" />
|
|
31
44
|
`,
|
|
32
45
|
})
|
|
33
46
|
export class ExampleComponent {
|
|
@@ -36,6 +49,10 @@ export class ExampleComponent {
|
|
|
36
49
|
save(event: MouseEvent): void {
|
|
37
50
|
// Perform an operation using the click event.
|
|
38
51
|
}
|
|
52
|
+
|
|
53
|
+
addToFavorites(event: MouseEvent): void {
|
|
54
|
+
// Perform an operation using the click event.
|
|
55
|
+
}
|
|
39
56
|
}
|
|
40
57
|
```
|
|
41
58
|
|
|
@@ -46,7 +63,51 @@ supports these inputs and output:
|
|
|
46
63
|
| --- | --- | --- | --- |
|
|
47
64
|
| `type` | Input | `'button' \| 'submit' \| 'reset'` | `'button'` |
|
|
48
65
|
| `disabled` | Input | `boolean` | `false` |
|
|
49
|
-
| `
|
|
66
|
+
| `clicked` | Output | `MouseEvent` | — |
|
|
50
67
|
|
|
51
|
-
`
|
|
68
|
+
`clicked` emits the native click event. The component intentionally uses
|
|
52
69
|
the browser's default button styling.
|
|
70
|
+
|
|
71
|
+
### Button icon
|
|
72
|
+
|
|
73
|
+
The icon button renders one of the supported icons selected through the `icon`
|
|
74
|
+
input. TypeScript exposes the `ButtonIcon` union for editor autocomplete:
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<ngb-button-icon-control
|
|
78
|
+
icon="favorite"
|
|
79
|
+
ariaLabel="Add to favorites"
|
|
80
|
+
(clicked)="addToFavorites($event)"
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Available values: `add`, `check`, `close`, `delete`, `edit`, `favorite`,
|
|
85
|
+
`home`, `menu`, `remove`, and `search`.
|
|
86
|
+
|
|
87
|
+
| Name | Kind | Type | Default |
|
|
88
|
+
| --- | --- | --- | --- |
|
|
89
|
+
| `icon` | Input | `ButtonIcon` | Required |
|
|
90
|
+
| `ariaLabel` | Input | `string` | Required |
|
|
91
|
+
| `type` | Input | `'button' \| 'submit' \| 'reset'` | `'button'` |
|
|
92
|
+
| `disabled` | Input | `boolean` | `false` |
|
|
93
|
+
| `clicked` | Output | `MouseEvent` | — |
|
|
94
|
+
|
|
95
|
+
`ButtonIcon` is exported from `ngblock` and is a union of the available icon
|
|
96
|
+
names, so editors can suggest valid values: `add`, `check`, `close`, `delete`,
|
|
97
|
+
`edit`, `favorite`, `home`, `menu`, `remove`, and `search`. The icon is hidden
|
|
98
|
+
from assistive technology; `ariaLabel` provides the button's accessible name.
|
|
99
|
+
The component uses the browser's default button styling.
|
|
100
|
+
|
|
101
|
+
### Icon
|
|
102
|
+
|
|
103
|
+
`IconComponent` is also exported from `ngblock` for displaying a glyph directly:
|
|
104
|
+
|
|
105
|
+
```html
|
|
106
|
+
<ngb-icon glyph="★" />
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
| Name | Kind | Type | Default |
|
|
110
|
+
| --- | --- | --- | --- |
|
|
111
|
+
| `glyph` | Input | `string` | Required |
|
|
112
|
+
|
|
113
|
+
The glyph is treated as decorative and hidden from assistive technology.
|
package/fesm2022/ngblock.mjs
CHANGED
|
@@ -1,12 +1,293 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { ChangeDetectionStrategy, Component, input, output } from "@angular/core";
|
|
3
|
-
var
|
|
2
|
+
import { ChangeDetectionStrategy, Component, computed, input, output } from "@angular/core";
|
|
3
|
+
var IconComponent = class IconComponent {
|
|
4
|
+
glyph = input.required(...ngDevMode ? [{ debugName: "glyph" }] : /* istanbul ignore next */ []);
|
|
5
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
6
|
+
minVersion: "12.0.0",
|
|
7
|
+
version: "22.2.4",
|
|
8
|
+
ngImport: i0,
|
|
9
|
+
type: IconComponent,
|
|
10
|
+
deps: [],
|
|
11
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
12
|
+
});
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
14
|
+
minVersion: "17.1.0",
|
|
15
|
+
version: "22.2.4",
|
|
16
|
+
type: IconComponent,
|
|
17
|
+
isStandalone: true,
|
|
18
|
+
selector: "ngb-icon",
|
|
19
|
+
inputs: { glyph: {
|
|
20
|
+
classPropertyName: "glyph",
|
|
21
|
+
publicName: "glyph",
|
|
22
|
+
isSignal: true,
|
|
23
|
+
isRequired: true,
|
|
24
|
+
transformFunction: null
|
|
25
|
+
} },
|
|
26
|
+
ngImport: i0,
|
|
27
|
+
template: "<span aria-hidden=\"true\">{{ glyph() }}</span>\r\n",
|
|
28
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
32
|
+
minVersion: "12.0.0",
|
|
33
|
+
version: "22.2.4",
|
|
34
|
+
ngImport: i0,
|
|
35
|
+
type: IconComponent,
|
|
36
|
+
decorators: [{
|
|
37
|
+
type: Component,
|
|
38
|
+
args: [{
|
|
39
|
+
selector: "ngb-icon",
|
|
40
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
41
|
+
template: "<span aria-hidden=\"true\">{{ glyph() }}</span>\r\n"
|
|
42
|
+
}]
|
|
43
|
+
}],
|
|
44
|
+
propDecorators: { glyph: [{
|
|
45
|
+
type: i0.Input,
|
|
46
|
+
args: [{
|
|
47
|
+
isSignal: true,
|
|
48
|
+
alias: "glyph",
|
|
49
|
+
required: true
|
|
50
|
+
}]
|
|
51
|
+
}] }
|
|
52
|
+
});
|
|
53
|
+
var ButtonBaseComponent = class ButtonBaseComponent {
|
|
4
54
|
type = input("button", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
5
55
|
disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
6
|
-
|
|
56
|
+
ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
57
|
+
clicked = output();
|
|
7
58
|
onClick(event) {
|
|
8
|
-
this.
|
|
59
|
+
this.clicked.emit(event);
|
|
9
60
|
}
|
|
61
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
62
|
+
minVersion: "12.0.0",
|
|
63
|
+
version: "22.2.4",
|
|
64
|
+
ngImport: i0,
|
|
65
|
+
type: ButtonBaseComponent,
|
|
66
|
+
deps: [],
|
|
67
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
68
|
+
});
|
|
69
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
70
|
+
minVersion: "17.1.0",
|
|
71
|
+
version: "22.2.4",
|
|
72
|
+
type: ButtonBaseComponent,
|
|
73
|
+
isStandalone: true,
|
|
74
|
+
selector: "ngb-button-base-control",
|
|
75
|
+
inputs: {
|
|
76
|
+
type: {
|
|
77
|
+
classPropertyName: "type",
|
|
78
|
+
publicName: "type",
|
|
79
|
+
isSignal: true,
|
|
80
|
+
isRequired: false,
|
|
81
|
+
transformFunction: null
|
|
82
|
+
},
|
|
83
|
+
disabled: {
|
|
84
|
+
classPropertyName: "disabled",
|
|
85
|
+
publicName: "disabled",
|
|
86
|
+
isSignal: true,
|
|
87
|
+
isRequired: false,
|
|
88
|
+
transformFunction: null
|
|
89
|
+
},
|
|
90
|
+
ariaLabel: {
|
|
91
|
+
classPropertyName: "ariaLabel",
|
|
92
|
+
publicName: "ariaLabel",
|
|
93
|
+
isSignal: true,
|
|
94
|
+
isRequired: false,
|
|
95
|
+
transformFunction: null
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
outputs: { clicked: "clicked" },
|
|
99
|
+
ngImport: i0,
|
|
100
|
+
template: "<button\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-label]=\"ariaLabel()\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <ng-content />\r\n</button>\r\n",
|
|
101
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
105
|
+
minVersion: "12.0.0",
|
|
106
|
+
version: "22.2.4",
|
|
107
|
+
ngImport: i0,
|
|
108
|
+
type: ButtonBaseComponent,
|
|
109
|
+
decorators: [{
|
|
110
|
+
type: Component,
|
|
111
|
+
args: [{
|
|
112
|
+
selector: "ngb-button-base-control",
|
|
113
|
+
imports: [],
|
|
114
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
115
|
+
template: "<button\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-label]=\"ariaLabel()\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <ng-content />\r\n</button>\r\n"
|
|
116
|
+
}]
|
|
117
|
+
}],
|
|
118
|
+
propDecorators: {
|
|
119
|
+
type: [{
|
|
120
|
+
type: i0.Input,
|
|
121
|
+
args: [{
|
|
122
|
+
isSignal: true,
|
|
123
|
+
alias: "type",
|
|
124
|
+
required: false
|
|
125
|
+
}]
|
|
126
|
+
}],
|
|
127
|
+
disabled: [{
|
|
128
|
+
type: i0.Input,
|
|
129
|
+
args: [{
|
|
130
|
+
isSignal: true,
|
|
131
|
+
alias: "disabled",
|
|
132
|
+
required: false
|
|
133
|
+
}]
|
|
134
|
+
}],
|
|
135
|
+
ariaLabel: [{
|
|
136
|
+
type: i0.Input,
|
|
137
|
+
args: [{
|
|
138
|
+
isSignal: true,
|
|
139
|
+
alias: "ariaLabel",
|
|
140
|
+
required: false
|
|
141
|
+
}]
|
|
142
|
+
}],
|
|
143
|
+
clicked: [{
|
|
144
|
+
type: i0.Output,
|
|
145
|
+
args: ["clicked"]
|
|
146
|
+
}]
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
const BUTTON_ICONS = {
|
|
150
|
+
add: "+",
|
|
151
|
+
check: "✓",
|
|
152
|
+
close: "×",
|
|
153
|
+
delete: "⌫",
|
|
154
|
+
edit: "✎",
|
|
155
|
+
favorite: "★",
|
|
156
|
+
home: "⌂",
|
|
157
|
+
menu: "☰",
|
|
158
|
+
remove: "−",
|
|
159
|
+
search: "⌕"
|
|
160
|
+
};
|
|
161
|
+
var ButtonIconComponent = class ButtonIconComponent {
|
|
162
|
+
type = input("button", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
163
|
+
disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
164
|
+
icon = input.required(...ngDevMode ? [{ debugName: "icon" }] : /* istanbul ignore next */ []);
|
|
165
|
+
iconGlyph = computed(() => BUTTON_ICONS[this.icon()], ...ngDevMode ? [{ debugName: "iconGlyph" }] : /* istanbul ignore next */ []);
|
|
166
|
+
ariaLabel = input.required(...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
167
|
+
clicked = output();
|
|
168
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
169
|
+
minVersion: "12.0.0",
|
|
170
|
+
version: "22.2.4",
|
|
171
|
+
ngImport: i0,
|
|
172
|
+
type: ButtonIconComponent,
|
|
173
|
+
deps: [],
|
|
174
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
175
|
+
});
|
|
176
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
177
|
+
minVersion: "17.1.0",
|
|
178
|
+
version: "22.2.4",
|
|
179
|
+
type: ButtonIconComponent,
|
|
180
|
+
isStandalone: true,
|
|
181
|
+
selector: "ngb-button-icon-control",
|
|
182
|
+
inputs: {
|
|
183
|
+
type: {
|
|
184
|
+
classPropertyName: "type",
|
|
185
|
+
publicName: "type",
|
|
186
|
+
isSignal: true,
|
|
187
|
+
isRequired: false,
|
|
188
|
+
transformFunction: null
|
|
189
|
+
},
|
|
190
|
+
disabled: {
|
|
191
|
+
classPropertyName: "disabled",
|
|
192
|
+
publicName: "disabled",
|
|
193
|
+
isSignal: true,
|
|
194
|
+
isRequired: false,
|
|
195
|
+
transformFunction: null
|
|
196
|
+
},
|
|
197
|
+
icon: {
|
|
198
|
+
classPropertyName: "icon",
|
|
199
|
+
publicName: "icon",
|
|
200
|
+
isSignal: true,
|
|
201
|
+
isRequired: true,
|
|
202
|
+
transformFunction: null
|
|
203
|
+
},
|
|
204
|
+
ariaLabel: {
|
|
205
|
+
classPropertyName: "ariaLabel",
|
|
206
|
+
publicName: "ariaLabel",
|
|
207
|
+
isSignal: true,
|
|
208
|
+
isRequired: true,
|
|
209
|
+
transformFunction: null
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
outputs: { clicked: "clicked" },
|
|
213
|
+
ngImport: i0,
|
|
214
|
+
template: "<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ngb-icon [glyph]=\"iconGlyph()\" />\r\n</ngb-button-base-control>\r\n",
|
|
215
|
+
dependencies: [{
|
|
216
|
+
kind: "component",
|
|
217
|
+
type: ButtonBaseComponent,
|
|
218
|
+
selector: "ngb-button-base-control",
|
|
219
|
+
inputs: [
|
|
220
|
+
"type",
|
|
221
|
+
"disabled",
|
|
222
|
+
"ariaLabel"
|
|
223
|
+
],
|
|
224
|
+
outputs: ["clicked"]
|
|
225
|
+
}, {
|
|
226
|
+
kind: "component",
|
|
227
|
+
type: IconComponent,
|
|
228
|
+
selector: "ngb-icon",
|
|
229
|
+
inputs: ["glyph"]
|
|
230
|
+
}],
|
|
231
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
235
|
+
minVersion: "12.0.0",
|
|
236
|
+
version: "22.2.4",
|
|
237
|
+
ngImport: i0,
|
|
238
|
+
type: ButtonIconComponent,
|
|
239
|
+
decorators: [{
|
|
240
|
+
type: Component,
|
|
241
|
+
args: [{
|
|
242
|
+
selector: "ngb-button-icon-control",
|
|
243
|
+
imports: [ButtonBaseComponent, IconComponent],
|
|
244
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
245
|
+
template: "<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ngb-icon [glyph]=\"iconGlyph()\" />\r\n</ngb-button-base-control>\r\n"
|
|
246
|
+
}]
|
|
247
|
+
}],
|
|
248
|
+
propDecorators: {
|
|
249
|
+
type: [{
|
|
250
|
+
type: i0.Input,
|
|
251
|
+
args: [{
|
|
252
|
+
isSignal: true,
|
|
253
|
+
alias: "type",
|
|
254
|
+
required: false
|
|
255
|
+
}]
|
|
256
|
+
}],
|
|
257
|
+
disabled: [{
|
|
258
|
+
type: i0.Input,
|
|
259
|
+
args: [{
|
|
260
|
+
isSignal: true,
|
|
261
|
+
alias: "disabled",
|
|
262
|
+
required: false
|
|
263
|
+
}]
|
|
264
|
+
}],
|
|
265
|
+
icon: [{
|
|
266
|
+
type: i0.Input,
|
|
267
|
+
args: [{
|
|
268
|
+
isSignal: true,
|
|
269
|
+
alias: "icon",
|
|
270
|
+
required: true
|
|
271
|
+
}]
|
|
272
|
+
}],
|
|
273
|
+
ariaLabel: [{
|
|
274
|
+
type: i0.Input,
|
|
275
|
+
args: [{
|
|
276
|
+
isSignal: true,
|
|
277
|
+
alias: "ariaLabel",
|
|
278
|
+
required: true
|
|
279
|
+
}]
|
|
280
|
+
}],
|
|
281
|
+
clicked: [{
|
|
282
|
+
type: i0.Output,
|
|
283
|
+
args: ["clicked"]
|
|
284
|
+
}]
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
var ButtonTextComponent = class ButtonTextComponent {
|
|
288
|
+
type = input("button", ...ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []);
|
|
289
|
+
disabled = input(false, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
|
|
290
|
+
clicked = output();
|
|
10
291
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
11
292
|
minVersion: "12.0.0",
|
|
12
293
|
version: "22.2.4",
|
|
@@ -37,9 +318,20 @@ var ButtonTextComponent = class ButtonTextComponent {
|
|
|
37
318
|
transformFunction: null
|
|
38
319
|
}
|
|
39
320
|
},
|
|
40
|
-
outputs: {
|
|
321
|
+
outputs: { clicked: "clicked" },
|
|
41
322
|
ngImport: i0,
|
|
42
|
-
template: "<button\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n (
|
|
323
|
+
template: "<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ng-content />\r\n</ngb-button-base-control>\r\n",
|
|
324
|
+
dependencies: [{
|
|
325
|
+
kind: "component",
|
|
326
|
+
type: ButtonBaseComponent,
|
|
327
|
+
selector: "ngb-button-base-control",
|
|
328
|
+
inputs: [
|
|
329
|
+
"type",
|
|
330
|
+
"disabled",
|
|
331
|
+
"ariaLabel"
|
|
332
|
+
],
|
|
333
|
+
outputs: ["clicked"]
|
|
334
|
+
}],
|
|
43
335
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
44
336
|
});
|
|
45
337
|
};
|
|
@@ -52,9 +344,9 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
52
344
|
type: Component,
|
|
53
345
|
args: [{
|
|
54
346
|
selector: "ngb-button-text-control",
|
|
55
|
-
imports: [],
|
|
347
|
+
imports: [ButtonBaseComponent],
|
|
56
348
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
57
|
-
template: "<button\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n (
|
|
349
|
+
template: "<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ng-content />\r\n</ngb-button-base-control>\r\n"
|
|
58
350
|
}]
|
|
59
351
|
}],
|
|
60
352
|
propDecorators: {
|
|
@@ -74,12 +366,12 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
74
366
|
required: false
|
|
75
367
|
}]
|
|
76
368
|
}],
|
|
77
|
-
|
|
369
|
+
clicked: [{
|
|
78
370
|
type: i0.Output,
|
|
79
|
-
args: ["
|
|
371
|
+
args: ["clicked"]
|
|
80
372
|
}]
|
|
81
373
|
}
|
|
82
374
|
});
|
|
83
|
-
export { ButtonTextComponent };
|
|
375
|
+
export { BUTTON_ICONS, ButtonIconComponent, ButtonTextComponent, IconComponent };
|
|
84
376
|
|
|
85
377
|
//# sourceMappingURL=ngblock.mjs.map
|
package/fesm2022/ngblock.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngblock.mjs","names":[],"sources":["../../../../packages/ngblock/src/lib/control/button/button-text/button-text.control.ts","../../../../packages/ngblock/src/lib/control/button/button-text/button-text.control.html"],"sourcesContent":["import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n input,\r\n output,\r\n} from '@angular/core';\r\n\r\n@Component({\r\n selector: 'ngb-button-
|
|
1
|
+
{"version":3,"file":"ngblock.mjs","names":[],"sources":["../../../../packages/ngblock/src/lib/misc/icon/icon.component.ts","../../../../packages/ngblock/src/lib/misc/icon/icon.component.html","../../../../packages/ngblock/src/lib/control/button/button-base/button-base.control.ts","../../../../packages/ngblock/src/lib/control/button/button-base/button-base.control.html","../../../../packages/ngblock/src/lib/control/button/button-icon/button-icon.control.ts","../../../../packages/ngblock/src/lib/control/button/button-icon/button-icon.control.html","../../../../packages/ngblock/src/lib/control/button/button-text/button-text.control.ts","../../../../packages/ngblock/src/lib/control/button/button-text/button-text.control.html"],"sourcesContent":["import { ChangeDetectionStrategy, Component, input } from '@angular/core';\r\n\r\n@Component({\r\n selector: 'ngb-icon',\r\n templateUrl: './icon.component.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class IconComponent {\r\n readonly glyph = input.required<string>();\r\n}\r\n","<span aria-hidden=\"true\">{{ glyph() }}</span>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n input,\r\n output,\r\n} from '@angular/core';\r\n\r\n@Component({\r\n selector: 'ngb-button-base-control',\r\n imports: [],\r\n templateUrl: './button-base.control.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class ButtonBaseComponent {\r\n readonly type = input<HTMLButtonElement['type']>('button');\r\n readonly disabled = input(false);\r\n readonly ariaLabel = input<string | null>(null);\r\n readonly clicked = output<MouseEvent>();\r\n\r\n onClick(event: MouseEvent): void {\r\n this.clicked.emit(event);\r\n }\r\n}\r\n","<button\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [attr.aria-label]=\"ariaLabel()\"\r\n (click)=\"onClick($event)\"\r\n>\r\n <ng-content />\r\n</button>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n computed,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { IconComponent } from '../../../misc/icon/icon.component';\r\nimport { ButtonBaseComponent } from '../button-base/button-base.control';\r\n\r\nexport const BUTTON_ICONS = {\r\n add: '+',\r\n check: '✓',\r\n close: '×',\r\n delete: '⌫',\r\n edit: '✎',\r\n favorite: '★',\r\n home: '⌂',\r\n menu: '☰',\r\n remove: '−',\r\n search: '⌕',\r\n} as const;\r\n\r\nexport type ButtonIcon = keyof typeof BUTTON_ICONS;\r\n\r\n@Component({\r\n selector: 'ngb-button-icon-control',\r\n imports: [ButtonBaseComponent, IconComponent],\r\n templateUrl: './button-icon.control.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class ButtonIconComponent {\r\n readonly type = input<HTMLButtonElement['type']>('button');\r\n readonly disabled = input(false);\r\n readonly icon = input.required<ButtonIcon>();\r\n readonly iconGlyph = computed(() => BUTTON_ICONS[this.icon()]);\r\n readonly ariaLabel = input.required<string>();\r\n readonly clicked = output<MouseEvent>();\r\n}\r\n","<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n [ariaLabel]=\"ariaLabel()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ngb-icon [glyph]=\"iconGlyph()\" />\r\n</ngb-button-base-control>\r\n","import {\r\n ChangeDetectionStrategy,\r\n Component,\r\n input,\r\n output,\r\n} from '@angular/core';\r\nimport { ButtonBaseComponent } from '../button-base/button-base.control';\r\n\r\n@Component({\r\n selector: 'ngb-button-text-control',\r\n imports: [ButtonBaseComponent],\r\n templateUrl: './button-text.control.html',\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class ButtonTextComponent {\r\n readonly type = input<HTMLButtonElement['type']>('button');\r\n readonly disabled = input(false);\r\n readonly clicked = output<MouseEvent>();\r\n}\r\n","<ngb-button-base-control\r\n [type]=\"type()\"\r\n [disabled]=\"disabled()\"\r\n (clicked)=\"clicked.emit($event)\"\r\n>\r\n <ng-content />\r\n</ngb-button-base-control>\r\n"],"mappings":";;AAOA,IAAa,gBAAb,MAAa,cAAa;CACf,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAD9B,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,QAAA,EAAA,OAAA;GAAA,mBAAA;GAAA,YAAA;GAAA,UAAA;GAAA,YAAA;GAAA,mBAAA;EAAA,EAAA;EAAA,UAA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AAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA,EAAA,SAAA,UAAA;EAAA,UAAA;EAAA,UCdhC;EAOA,cAAA,CAAA;GAAA,MAAA;GAAA,MDGY;GAAmB,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,SAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAIlB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAmB,YAAA,CAAA;EAN/B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAyB,SAC1B,CAAC,mBAAmB;GAAC,iBAEb,wBAAwB;GAAM,UAAA;EAAA,CAAA"}
|
package/package.json
CHANGED
package/types/ngblock.d.ts
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
+
export declare const BUTTON_ICONS: {
|
|
3
|
+
readonly add: "+";
|
|
4
|
+
readonly check: "✓";
|
|
5
|
+
readonly close: "×";
|
|
6
|
+
readonly delete: "⌫";
|
|
7
|
+
readonly edit: "✎";
|
|
8
|
+
readonly favorite: "★";
|
|
9
|
+
readonly home: "⌂";
|
|
10
|
+
readonly menu: "☰";
|
|
11
|
+
readonly remove: "−";
|
|
12
|
+
readonly search: "⌕";
|
|
13
|
+
};
|
|
14
|
+
export type ButtonIcon = keyof typeof BUTTON_ICONS;
|
|
15
|
+
export declare class ButtonIconComponent {
|
|
16
|
+
readonly type: import("@angular/core").InputSignal<"submit" | "reset" | "button">;
|
|
17
|
+
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
18
|
+
readonly icon: import("@angular/core").InputSignal<"add" | "check" | "close" | "delete" | "edit" | "favorite" | "home" | "menu" | "remove" | "search">;
|
|
19
|
+
readonly iconGlyph: import("@angular/core").Signal<"+" | "✓" | "×" | "⌫" | "✎" | "★" | "⌂" | "☰" | "−" | "⌕">;
|
|
20
|
+
readonly ariaLabel: import("@angular/core").InputSignal<string>;
|
|
21
|
+
readonly clicked: import("@angular/core").OutputEmitterRef<MouseEvent>;
|
|
22
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonIconComponent, never>;
|
|
23
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonIconComponent, "ngb-button-icon-control", never, {
|
|
24
|
+
"type": {
|
|
25
|
+
"alias": "type";
|
|
26
|
+
"required": false;
|
|
27
|
+
"isSignal": true;
|
|
28
|
+
};
|
|
29
|
+
"disabled": {
|
|
30
|
+
"alias": "disabled";
|
|
31
|
+
"required": false;
|
|
32
|
+
"isSignal": true;
|
|
33
|
+
};
|
|
34
|
+
"icon": {
|
|
35
|
+
"alias": "icon";
|
|
36
|
+
"required": true;
|
|
37
|
+
"isSignal": true;
|
|
38
|
+
};
|
|
39
|
+
"ariaLabel": {
|
|
40
|
+
"alias": "ariaLabel";
|
|
41
|
+
"required": true;
|
|
42
|
+
"isSignal": true;
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
"clicked": "clicked";
|
|
46
|
+
}, never, never, true, never>;
|
|
47
|
+
}
|
|
2
48
|
export declare class ButtonTextComponent {
|
|
3
49
|
readonly type: import("@angular/core").InputSignal<"submit" | "reset" | "button">;
|
|
4
50
|
readonly disabled: import("@angular/core").InputSignal<boolean>;
|
|
5
|
-
readonly
|
|
6
|
-
onClick(event: MouseEvent): void;
|
|
51
|
+
readonly clicked: import("@angular/core").OutputEmitterRef<MouseEvent>;
|
|
7
52
|
static ɵfac: i0.ɵɵFactoryDeclaration<ButtonTextComponent, never>;
|
|
8
53
|
static ɵcmp: i0.ɵɵComponentDeclaration<ButtonTextComponent, "ngb-button-text-control", never, {
|
|
9
54
|
"type": {
|
|
@@ -17,6 +62,17 @@ export declare class ButtonTextComponent {
|
|
|
17
62
|
"isSignal": true;
|
|
18
63
|
};
|
|
19
64
|
}, {
|
|
20
|
-
"
|
|
65
|
+
"clicked": "clicked";
|
|
21
66
|
}, never, ["*"], true, never>;
|
|
67
|
+
}
|
|
68
|
+
export declare class IconComponent {
|
|
69
|
+
readonly glyph: import("@angular/core").InputSignal<string>;
|
|
70
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<IconComponent, never>;
|
|
71
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<IconComponent, "ngb-icon", never, {
|
|
72
|
+
"glyph": {
|
|
73
|
+
"alias": "glyph";
|
|
74
|
+
"required": true;
|
|
75
|
+
"isSignal": true;
|
|
76
|
+
};
|
|
77
|
+
}, {}, never, never, true, never>;
|
|
22
78
|
}
|