@muxima-ui/core 0.0.0-stage → 1.0.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.
- package/README.md +58 -2
- package/fesm2022/muxima-ui-core-accordion.mjs +73 -0
- package/fesm2022/muxima-ui-core-accordion.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-alert.mjs +63 -0
- package/fesm2022/muxima-ui-core-alert.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-avatar.mjs +85 -0
- package/fesm2022/muxima-ui-core-avatar.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-badge.mjs +41 -0
- package/fesm2022/muxima-ui-core-badge.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-breadcrumb.mjs +37 -0
- package/fesm2022/muxima-ui-core-breadcrumb.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-button.mjs +71 -0
- package/fesm2022/muxima-ui-core-button.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-card.mjs +95 -0
- package/fesm2022/muxima-ui-core-card.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-checkbox.mjs +45 -0
- package/fesm2022/muxima-ui-core-checkbox.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-combobox.mjs +354 -0
- package/fesm2022/muxima-ui-core-combobox.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-command.mjs +285 -0
- package/fesm2022/muxima-ui-core-command.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-date-picker.mjs +548 -0
- package/fesm2022/muxima-ui-core-date-picker.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-dialog.mjs +147 -0
- package/fesm2022/muxima-ui-core-dialog.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-drawer.mjs +63 -0
- package/fesm2022/muxima-ui-core-drawer.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-form-field.mjs +295 -0
- package/fesm2022/muxima-ui-core-form-field.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-menu.mjs +141 -0
- package/fesm2022/muxima-ui-core-menu.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-otp.mjs +160 -0
- package/fesm2022/muxima-ui-core-otp.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-pagination.mjs +271 -0
- package/fesm2022/muxima-ui-core-pagination.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-popover.mjs +168 -0
- package/fesm2022/muxima-ui-core-popover.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-progress.mjs +55 -0
- package/fesm2022/muxima-ui-core-progress.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-radio.mjs +41 -0
- package/fesm2022/muxima-ui-core-radio.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-select.mjs +427 -0
- package/fesm2022/muxima-ui-core-select.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-separator.mjs +39 -0
- package/fesm2022/muxima-ui-core-separator.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-skeleton.mjs +34 -0
- package/fesm2022/muxima-ui-core-skeleton.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-slider.mjs +60 -0
- package/fesm2022/muxima-ui-core-slider.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-stepper.mjs +75 -0
- package/fesm2022/muxima-ui-core-stepper.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-switch.mjs +39 -0
- package/fesm2022/muxima-ui-core-switch.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-table.mjs +149 -0
- package/fesm2022/muxima-ui-core-table.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-tabs.mjs +191 -0
- package/fesm2022/muxima-ui-core-tabs.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-toast.mjs +258 -0
- package/fesm2022/muxima-ui-core-toast.mjs.map +1 -0
- package/fesm2022/muxima-ui-core-tooltip.mjs +169 -0
- package/fesm2022/muxima-ui-core-tooltip.mjs.map +1 -0
- package/fesm2022/muxima-ui-core.mjs +13 -0
- package/fesm2022/muxima-ui-core.mjs.map +1 -0
- package/package.json +174 -3
- package/styles/base.css +112 -0
- package/styles/components/accordion.css +54 -0
- package/styles/components/alert.css +84 -0
- package/styles/components/avatar.css +61 -0
- package/styles/components/badge.css +68 -0
- package/styles/components/breadcrumb.css +41 -0
- package/styles/components/button.css +132 -0
- package/styles/components/card.css +117 -0
- package/styles/components/choice.css +230 -0
- package/styles/components/combobox.css +37 -0
- package/styles/components/command.css +92 -0
- package/styles/components/date-picker.css +144 -0
- package/styles/components/dialog.css +65 -0
- package/styles/components/drawer.css +60 -0
- package/styles/components/form-field.css +150 -0
- package/styles/components/menu.css +117 -0
- package/styles/components/otp.css +92 -0
- package/styles/components/pagination.css +136 -0
- package/styles/components/popover.css +18 -0
- package/styles/components/progress.css +68 -0
- package/styles/components/select.css +166 -0
- package/styles/components/separator.css +17 -0
- package/styles/components/skeleton.css +22 -0
- package/styles/components/slider.css +80 -0
- package/styles/components/stepper.css +103 -0
- package/styles/components/table.css +183 -0
- package/styles/components/tabs.css +64 -0
- package/styles/components/toast.css +176 -0
- package/styles/components/tooltip.css +19 -0
- package/styles/motion.css +15 -0
- package/styles/muxima.css +47 -0
- package/styles/tokens.css +124 -0
- package/types/muxima-ui-core-accordion.d.ts +40 -0
- package/types/muxima-ui-core-alert.d.ts +36 -0
- package/types/muxima-ui-core-avatar.d.ts +32 -0
- package/types/muxima-ui-core-badge.d.ts +24 -0
- package/types/muxima-ui-core-breadcrumb.d.ts +24 -0
- package/types/muxima-ui-core-button.d.ts +36 -0
- package/types/muxima-ui-core-card.d.ts +56 -0
- package/types/muxima-ui-core-checkbox.d.ts +22 -0
- package/types/muxima-ui-core-combobox.d.ts +76 -0
- package/types/muxima-ui-core-command.d.ts +94 -0
- package/types/muxima-ui-core-date-picker.d.ts +133 -0
- package/types/muxima-ui-core-dialog.d.ts +80 -0
- package/types/muxima-ui-core-drawer.d.ts +35 -0
- package/types/muxima-ui-core-form-field.d.ts +179 -0
- package/types/muxima-ui-core-menu.d.ts +55 -0
- package/types/muxima-ui-core-otp.d.ts +54 -0
- package/types/muxima-ui-core-pagination.d.ts +53 -0
- package/types/muxima-ui-core-popover.d.ts +54 -0
- package/types/muxima-ui-core-progress.d.ts +30 -0
- package/types/muxima-ui-core-radio.d.ts +23 -0
- package/types/muxima-ui-core-select.d.ts +106 -0
- package/types/muxima-ui-core-separator.d.ts +20 -0
- package/types/muxima-ui-core-skeleton.d.ts +21 -0
- package/types/muxima-ui-core-slider.d.ts +27 -0
- package/types/muxima-ui-core-stepper.d.ts +34 -0
- package/types/muxima-ui-core-switch.d.ts +20 -0
- package/types/muxima-ui-core-table.d.ts +58 -0
- package/types/muxima-ui-core-tabs.d.ts +45 -0
- package/types/muxima-ui-core-toast.d.ts +95 -0
- package/types/muxima-ui-core-tooltip.d.ts +54 -0
- package/types/muxima-ui-core.d.ts +3 -0
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @muxima-ui/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Componentes Angular acessíveis, com temas por variáveis CSS e modo escuro.
|
|
4
|
+
Requer Angular 21 ou superior e `@angular/cdk`.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @muxima-ui/core @angular/cdk
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Estilos (em `angular.json`):
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
"styles": ["@muxima-ui/core/styles.css"]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Fontes (opcional; sem elas usa as fontes do sistema):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @fontsource/instrument-sans @fontsource/ibm-plex-mono
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Cada componente tem o seu ponto de entrada, para só importares o que usas:
|
|
23
|
+
|
|
24
|
+
| Ponto de entrada | Exporta |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| `@muxima-ui/core/button` | `MxButton` |
|
|
27
|
+
| `@muxima-ui/core/form-field` | `MxFormField`, `MxLabel`, `MxHint`, `MxError`, `MxInput` (input e textarea), `MxChoice`, `MxFieldset` |
|
|
28
|
+
| `@muxima-ui/core/select` | `MxSelect` (simples e `multiple`), `MxOption` |
|
|
29
|
+
| `@muxima-ui/core/combobox` | `MxCombobox` |
|
|
30
|
+
| `@muxima-ui/core/checkbox` | `MxCheckbox` |
|
|
31
|
+
| `@muxima-ui/core/radio` | `MxRadio` |
|
|
32
|
+
| `@muxima-ui/core/switch` | `MxSwitch` |
|
|
33
|
+
| `@muxima-ui/core/slider` | `MxSlider` |
|
|
34
|
+
| `@muxima-ui/core/date-picker` | `MxDatePicker`, `MxCalendar`, `mxParseDate`, `mxFormatDate` |
|
|
35
|
+
| `@muxima-ui/core/otp` | `MxOtp` |
|
|
36
|
+
| `@muxima-ui/core/table` | `MX_TABLE`, `mxSortData` |
|
|
37
|
+
| `@muxima-ui/core/card` | `MX_CARD` |
|
|
38
|
+
| `@muxima-ui/core/badge` | `MxBadge` |
|
|
39
|
+
| `@muxima-ui/core/avatar` | `MxAvatar` |
|
|
40
|
+
| `@muxima-ui/core/separator` | `MxSeparator` |
|
|
41
|
+
| `@muxima-ui/core/tabs` | `MxTabs`, `MxTab` |
|
|
42
|
+
| `@muxima-ui/core/breadcrumb` | `MxBreadcrumb` |
|
|
43
|
+
| `@muxima-ui/core/pagination` | `MxPagination` |
|
|
44
|
+
| `@muxima-ui/core/accordion` | `MX_ACCORDION` |
|
|
45
|
+
| `@muxima-ui/core/stepper` | `MX_STEPPER` |
|
|
46
|
+
| `@muxima-ui/core/command` | `MX_COMMAND`, `MxCommandPalette` |
|
|
47
|
+
| `@muxima-ui/core/dialog` | `MxDialog`, `MX_DIALOG`, `MxDialogRef`, `MX_DIALOG_DATA` |
|
|
48
|
+
| `@muxima-ui/core/drawer` | `MxDrawer` |
|
|
49
|
+
| `@muxima-ui/core/menu` | `MX_MENU` |
|
|
50
|
+
| `@muxima-ui/core/popover` | `MX_POPOVER` |
|
|
51
|
+
| `@muxima-ui/core/tooltip` | `MxTooltip` |
|
|
52
|
+
| `@muxima-ui/core/alert` | `MX_ALERT` |
|
|
53
|
+
| `@muxima-ui/core/progress` | `MxProgress`, `MxSpinner` |
|
|
54
|
+
| `@muxima-ui/core/skeleton` | `MxSkeleton` |
|
|
55
|
+
| `@muxima-ui/core/toast` | `MxToast` |
|
|
56
|
+
|
|
57
|
+
Time picker usa `input[type=time][mxInput]`, sem componente próprio.
|
|
58
|
+
|
|
59
|
+
Licença MIT.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, Directive, inject } from '@angular/core';
|
|
3
|
+
import { mxUniqueId } from '@muxima-ui/core/form-field';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Acordeão sobre `<details>` e `<summary>` nativos: Enter e Espaço abrem e fecham,
|
|
7
|
+
* o estado é anunciado pelo leitor de ecrã e a pesquisa do navegador encontra
|
|
8
|
+
* texto dentro das secções fechadas.
|
|
9
|
+
*
|
|
10
|
+
* ```html
|
|
11
|
+
* <div mxAccordion>
|
|
12
|
+
* <details mxAccordionItem open>
|
|
13
|
+
* <summary mxAccordionTrigger>Como pago a factura?</summary>
|
|
14
|
+
* <div mxAccordionContent>Por referência, transferência ou Multicaixa Express.</div>
|
|
15
|
+
* </details>
|
|
16
|
+
* </div>
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Por omissão só uma secção fica aberta (atributo name nativo). Com `multiple`, várias.
|
|
20
|
+
*/
|
|
21
|
+
class MxAccordion {
|
|
22
|
+
multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
23
|
+
groupName = mxUniqueId('mx-accordion');
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordion, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
25
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxAccordion, isStandalone: true, selector: "[mxAccordion]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "mx-accordion" }, exportAs: ["mxAccordion"], ngImport: i0 });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordion, decorators: [{
|
|
28
|
+
type: Directive,
|
|
29
|
+
args: [{
|
|
30
|
+
selector: '[mxAccordion]',
|
|
31
|
+
exportAs: 'mxAccordion',
|
|
32
|
+
host: { class: 'mx-accordion' },
|
|
33
|
+
}]
|
|
34
|
+
}], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }] } });
|
|
35
|
+
class MxAccordionItem {
|
|
36
|
+
accordion = inject(MxAccordion, { optional: true });
|
|
37
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionItem, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
38
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxAccordionItem, isStandalone: true, selector: "details[mxAccordionItem]", host: { properties: { "attr.name": "accordion && !accordion.multiple() ? accordion.groupName : null" }, classAttribute: "mx-accordion-item" }, ngImport: i0 });
|
|
39
|
+
}
|
|
40
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionItem, decorators: [{
|
|
41
|
+
type: Directive,
|
|
42
|
+
args: [{
|
|
43
|
+
selector: 'details[mxAccordionItem]',
|
|
44
|
+
host: {
|
|
45
|
+
class: 'mx-accordion-item',
|
|
46
|
+
'[attr.name]': 'accordion && !accordion.multiple() ? accordion.groupName : null',
|
|
47
|
+
},
|
|
48
|
+
}]
|
|
49
|
+
}] });
|
|
50
|
+
class MxAccordionTrigger {
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionTrigger, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
52
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxAccordionTrigger, isStandalone: true, selector: "summary[mxAccordionTrigger]", host: { classAttribute: "mx-accordion-trigger" }, ngImport: i0 });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionTrigger, decorators: [{
|
|
55
|
+
type: Directive,
|
|
56
|
+
args: [{ selector: 'summary[mxAccordionTrigger]', host: { class: 'mx-accordion-trigger' } }]
|
|
57
|
+
}] });
|
|
58
|
+
class MxAccordionContent {
|
|
59
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
60
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxAccordionContent, isStandalone: true, selector: "[mxAccordionContent]", host: { classAttribute: "mx-accordion-content" }, ngImport: i0 });
|
|
61
|
+
}
|
|
62
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAccordionContent, decorators: [{
|
|
63
|
+
type: Directive,
|
|
64
|
+
args: [{ selector: '[mxAccordionContent]', host: { class: 'mx-accordion-content' } }]
|
|
65
|
+
}] });
|
|
66
|
+
const MX_ACCORDION = [MxAccordion, MxAccordionItem, MxAccordionTrigger, MxAccordionContent];
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Generated bundle index. Do not edit.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
export { MX_ACCORDION, MxAccordion, MxAccordionContent, MxAccordionItem, MxAccordionTrigger };
|
|
73
|
+
//# sourceMappingURL=muxima-ui-core-accordion.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-accordion.mjs","sources":["../../../projects/core/accordion/accordion.ts","../../../projects/core/accordion/muxima-ui-core-accordion.ts"],"sourcesContent":["import { Directive, booleanAttribute, inject, input } from '@angular/core';\nimport { mxUniqueId } from '@muxima-ui/core/form-field';\n\n/**\n * Acordeão sobre `<details>` e `<summary>` nativos: Enter e Espaço abrem e fecham,\n * o estado é anunciado pelo leitor de ecrã e a pesquisa do navegador encontra\n * texto dentro das secções fechadas.\n *\n * ```html\n * <div mxAccordion>\n * <details mxAccordionItem open>\n * <summary mxAccordionTrigger>Como pago a factura?</summary>\n * <div mxAccordionContent>Por referência, transferência ou Multicaixa Express.</div>\n * </details>\n * </div>\n * ```\n *\n * Por omissão só uma secção fica aberta (atributo name nativo). Com `multiple`, várias.\n */\n@Directive({\n selector: '[mxAccordion]',\n exportAs: 'mxAccordion',\n host: { class: 'mx-accordion' },\n})\nexport class MxAccordion {\n readonly multiple = input(false, { transform: booleanAttribute });\n readonly groupName = mxUniqueId('mx-accordion');\n}\n\n@Directive({\n selector: 'details[mxAccordionItem]',\n host: {\n class: 'mx-accordion-item',\n '[attr.name]': 'accordion && !accordion.multiple() ? accordion.groupName : null',\n },\n})\nexport class MxAccordionItem {\n protected readonly accordion = inject(MxAccordion, { optional: true });\n}\n\n@Directive({ selector: 'summary[mxAccordionTrigger]', host: { class: 'mx-accordion-trigger' } })\nexport class MxAccordionTrigger {}\n\n@Directive({ selector: '[mxAccordionContent]', host: { class: 'mx-accordion-content' } })\nexport class MxAccordionContent {}\n\nexport const MX_ACCORDION = [MxAccordion, MxAccordionItem, MxAccordionTrigger, MxAccordionContent] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAGA;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
|
2
|
+
import { input, booleanAttribute, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mensagem destacada dentro da página.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <div mxAlert variant="warning">
|
|
9
|
+
* <p mxAlertTitle>A sessão expira em 5 minutos</p>
|
|
10
|
+
* <p>Guarda o trabalho para não perderes alterações.</p>
|
|
11
|
+
* </div>
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Por omissão não interrompe o leitor de ecrã. Com `announce`, a mensagem é lida
|
|
15
|
+
* assim que aparece (role="alert"); usa-o só para mensagens que surgem após uma acção.
|
|
16
|
+
*/
|
|
17
|
+
class MxAlert {
|
|
18
|
+
variant = input('info', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
19
|
+
announce = input(false, { ...(ngDevMode ? { debugName: "announce" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlert, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxAlert, isStandalone: true, selector: "[mxAlert]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, announce: { classPropertyName: "announce", publicName: "announce", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-variant": "variant()", "attr.role": "announce() ? \"alert\" : null" }, classAttribute: "mx-alert" }, exportAs: ["mxAlert"], ngImport: i0 });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlert, decorators: [{
|
|
24
|
+
type: Directive,
|
|
25
|
+
args: [{
|
|
26
|
+
selector: '[mxAlert]',
|
|
27
|
+
exportAs: 'mxAlert',
|
|
28
|
+
host: {
|
|
29
|
+
class: 'mx-alert',
|
|
30
|
+
'[attr.data-variant]': 'variant()',
|
|
31
|
+
'[attr.role]': 'announce() ? "alert" : null',
|
|
32
|
+
},
|
|
33
|
+
}]
|
|
34
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], announce: [{ type: i0.Input, args: [{ isSignal: true, alias: "announce", required: false }] }] } });
|
|
35
|
+
class MxAlertTitle {
|
|
36
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlertTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
37
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxAlertTitle, isStandalone: true, selector: "[mxAlertTitle]", host: { classAttribute: "mx-alert-title" }, ngImport: i0 });
|
|
38
|
+
}
|
|
39
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlertTitle, decorators: [{
|
|
40
|
+
type: Directive,
|
|
41
|
+
args: [{ selector: '[mxAlertTitle]', host: { class: 'mx-alert-title' } }]
|
|
42
|
+
}] });
|
|
43
|
+
/** Botão de fechar do alerta. Esconder o alerta fica a cargo da aplicação (ex.: com @if). */
|
|
44
|
+
class MxAlertClose {
|
|
45
|
+
label = input('Fechar aviso', { ...(ngDevMode ? { debugName: "label" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
46
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlertClose, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
47
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxAlertClose, isStandalone: true, selector: "button[mxAlertClose]", inputs: { label: { classPropertyName: "label", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button" }, properties: { "attr.aria-label": "label()" }, classAttribute: "mx-alert-close" }, ngImport: i0 });
|
|
48
|
+
}
|
|
49
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAlertClose, decorators: [{
|
|
50
|
+
type: Directive,
|
|
51
|
+
args: [{
|
|
52
|
+
selector: 'button[mxAlertClose]',
|
|
53
|
+
host: { class: 'mx-alert-close', type: 'button', '[attr.aria-label]': 'label()' },
|
|
54
|
+
}]
|
|
55
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
56
|
+
const MX_ALERT = [MxAlert, MxAlertTitle, MxAlertClose];
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Generated bundle index. Do not edit.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
export { MX_ALERT, MxAlert, MxAlertClose, MxAlertTitle };
|
|
63
|
+
//# sourceMappingURL=muxima-ui-core-alert.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-alert.mjs","sources":["../../../projects/core/alert/alert.ts","../../../projects/core/alert/muxima-ui-core-alert.ts"],"sourcesContent":["import { Directive, booleanAttribute, input } from '@angular/core';\n\nexport type MxAlertVariant = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Mensagem destacada dentro da página.\n *\n * ```html\n * <div mxAlert variant=\"warning\">\n * <p mxAlertTitle>A sessão expira em 5 minutos</p>\n * <p>Guarda o trabalho para não perderes alterações.</p>\n * </div>\n * ```\n *\n * Por omissão não interrompe o leitor de ecrã. Com `announce`, a mensagem é lida\n * assim que aparece (role=\"alert\"); usa-o só para mensagens que surgem após uma acção.\n */\n@Directive({\n selector: '[mxAlert]',\n exportAs: 'mxAlert',\n host: {\n class: 'mx-alert',\n '[attr.data-variant]': 'variant()',\n '[attr.role]': 'announce() ? \"alert\" : null',\n },\n})\nexport class MxAlert {\n readonly variant = input<MxAlertVariant>('info');\n readonly announce = input(false, { transform: booleanAttribute });\n}\n\n@Directive({ selector: '[mxAlertTitle]', host: { class: 'mx-alert-title' } })\nexport class MxAlertTitle {}\n\n/** Botão de fechar do alerta. Esconder o alerta fica a cargo da aplicação (ex.: com @if). */\n@Directive({\n selector: 'button[mxAlertClose]',\n host: { class: 'mx-alert-close', type: 'button', '[attr.aria-label]': 'label()' },\n})\nexport class MxAlertClose {\n readonly label = input('Fechar aviso', { alias: 'aria-label' });\n}\n\nexport const MX_ALERT = [MxAlert, MxAlertTitle, MxAlertClose] as const;\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;;;;;AAYG;MAUU,OAAO,CAAA;AACT,IAAA,OAAO,GAAG,KAAK,CAAiB,MAAM,8EAAC;IACvC,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;wGAFtD,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,EAAA,iBAAA,EAAA,UAAA,EAAA,UAAA,EAAA,UAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,mBAAA,EAAA,WAAA,EAAA,WAAA,EAAA,+BAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,C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,MAAA,EAAA,QAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,EAAA,cAAA,EAAA,gBAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,sBAAsB;AAChC,oBAAA,IAAI,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,SAAS,EAAE;AAClF,iBAAA;;AAKM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY;;AC3C5D;;AAEG;;"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, computed, signal, effect, ViewEncapsulation, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Fotografia de uma pessoa ou organização, com as iniciais como alternativa
|
|
6
|
+
* quando não há imagem ou ela não carrega.
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <mx-avatar name="Ana Kiala" src="/fotos/ana.jpg" />
|
|
10
|
+
* <mx-avatar name="Banco Mutamba" size="lg" />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Com `decorative`, fica escondido dos leitores de ecrã (quando o nome já está escrito ao lado).
|
|
14
|
+
*/
|
|
15
|
+
class MxAvatar {
|
|
16
|
+
/** Nome da pessoa ou organização: nome acessível e fonte das iniciais. */
|
|
17
|
+
name = input.required(...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
18
|
+
src = input(undefined, ...(ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []));
|
|
19
|
+
/** sm 24 px, md 32 px, lg 40 px. */
|
|
20
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
21
|
+
decorative = input(false, { ...(ngDevMode ? { debugName: "decorative" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
22
|
+
/** Ponto de estado no canto. O estado é anunciado com o nome. */
|
|
23
|
+
status = input(null, ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
|
|
24
|
+
static STATUS_TEXT = { online: 'disponível', away: 'ausente', busy: 'ocupado', offline: 'desligado' };
|
|
25
|
+
label = computed(() => {
|
|
26
|
+
const s = this.status();
|
|
27
|
+
return s ? `${this.name()}, ${MxAvatar.STATUS_TEXT[s]}` : this.name();
|
|
28
|
+
}, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
29
|
+
failed = signal(false, ...(ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []));
|
|
30
|
+
initials = computed(() => {
|
|
31
|
+
const parts = this.name().trim().split(/\s+/).filter(Boolean);
|
|
32
|
+
const first = parts[0]?.[0] ?? '';
|
|
33
|
+
const last = parts.length > 1 ? parts[parts.length - 1][0] : '';
|
|
34
|
+
return (first + last).toUpperCase();
|
|
35
|
+
}, ...(ngDevMode ? [{ debugName: "initials" }] : /* istanbul ignore next */ []));
|
|
36
|
+
constructor() {
|
|
37
|
+
effect(() => {
|
|
38
|
+
this.src();
|
|
39
|
+
this.failed.set(false);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAvatar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
43
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: MxAvatar, isStandalone: true, selector: "mx-avatar", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: true, transformFunction: null }, src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, decorative: { classPropertyName: "decorative", publicName: "decorative", isSignal: true, isRequired: false, transformFunction: null }, status: { classPropertyName: "status", publicName: "status", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-size": "size() === \"md\" ? null : size()", "attr.role": "decorative() ? null : \"img\"", "attr.aria-label": "decorative() ? null : label()", "attr.aria-hidden": "decorative() ? \"true\" : null" }, classAttribute: "mx-avatar" }, ngImport: i0, template: `
|
|
44
|
+
@if (status()) {
|
|
45
|
+
<span class="mx-avatar-status" [attr.data-status]="status()" aria-hidden="true"></span>
|
|
46
|
+
}
|
|
47
|
+
@if (src() && !failed()) {
|
|
48
|
+
<img [src]="src()" alt="" (error)="failed.set(true)" />
|
|
49
|
+
} @else {
|
|
50
|
+
<span class="mx-avatar-initials" aria-hidden="true">{{ initials() }}</span>
|
|
51
|
+
}
|
|
52
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxAvatar, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: 'mx-avatar',
|
|
58
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
59
|
+
encapsulation: ViewEncapsulation.None,
|
|
60
|
+
host: {
|
|
61
|
+
class: 'mx-avatar',
|
|
62
|
+
'[attr.data-size]': 'size() === "md" ? null : size()',
|
|
63
|
+
'[attr.role]': 'decorative() ? null : "img"',
|
|
64
|
+
'[attr.aria-label]': 'decorative() ? null : label()',
|
|
65
|
+
'[attr.aria-hidden]': 'decorative() ? "true" : null',
|
|
66
|
+
},
|
|
67
|
+
template: `
|
|
68
|
+
@if (status()) {
|
|
69
|
+
<span class="mx-avatar-status" [attr.data-status]="status()" aria-hidden="true"></span>
|
|
70
|
+
}
|
|
71
|
+
@if (src() && !failed()) {
|
|
72
|
+
<img [src]="src()" alt="" (error)="failed.set(true)" />
|
|
73
|
+
} @else {
|
|
74
|
+
<span class="mx-avatar-initials" aria-hidden="true">{{ initials() }}</span>
|
|
75
|
+
}
|
|
76
|
+
`,
|
|
77
|
+
}]
|
|
78
|
+
}], ctorParameters: () => [], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: true }] }], src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], decorative: [{ type: i0.Input, args: [{ isSignal: true, alias: "decorative", required: false }] }], status: [{ type: i0.Input, args: [{ isSignal: true, alias: "status", required: false }] }] } });
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Generated bundle index. Do not edit.
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
export { MxAvatar };
|
|
85
|
+
//# sourceMappingURL=muxima-ui-core-avatar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-avatar.mjs","sources":["../../../projects/core/avatar/avatar.ts","../../../projects/core/avatar/muxima-ui-core-avatar.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, ViewEncapsulation, booleanAttribute, computed, effect, input, signal } from '@angular/core';\n\n/**\n * Fotografia de uma pessoa ou organização, com as iniciais como alternativa\n * quando não há imagem ou ela não carrega.\n *\n * ```html\n * <mx-avatar name=\"Ana Kiala\" src=\"/fotos/ana.jpg\" />\n * <mx-avatar name=\"Banco Mutamba\" size=\"lg\" />\n * ```\n *\n * Com `decorative`, fica escondido dos leitores de ecrã (quando o nome já está escrito ao lado).\n */\n@Component({\n selector: 'mx-avatar',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'mx-avatar',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '[attr.role]': 'decorative() ? null : \"img\"',\n '[attr.aria-label]': 'decorative() ? null : label()',\n '[attr.aria-hidden]': 'decorative() ? \"true\" : null',\n },\n template: `\n @if (status()) {\n <span class=\"mx-avatar-status\" [attr.data-status]=\"status()\" aria-hidden=\"true\"></span>\n }\n @if (src() && !failed()) {\n <img [src]=\"src()\" alt=\"\" (error)=\"failed.set(true)\" />\n } @else {\n <span class=\"mx-avatar-initials\" aria-hidden=\"true\">{{ initials() }}</span>\n }\n `,\n})\nexport class MxAvatar {\n /** Nome da pessoa ou organização: nome acessível e fonte das iniciais. */\n readonly name = input.required<string>();\n readonly src = input<string | null | undefined>(undefined);\n /** sm 24 px, md 32 px, lg 40 px. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n readonly decorative = input(false, { transform: booleanAttribute });\n /** Ponto de estado no canto. O estado é anunciado com o nome. */\n readonly status = input<'online' | 'away' | 'busy' | 'offline' | null>(null);\n\n private static readonly STATUS_TEXT = { online: 'disponível', away: 'ausente', busy: 'ocupado', offline: 'desligado' };\n protected readonly label = computed(() => {\n const s = this.status();\n return s ? `${this.name()}, ${MxAvatar.STATUS_TEXT[s]}` : this.name();\n });\n\n protected readonly failed = signal(false);\n protected readonly initials = computed(() => {\n const parts = this.name().trim().split(/\\s+/).filter(Boolean);\n const first = parts[0]?.[0] ?? '';\n const last = parts.length > 1 ? parts[parts.length - 1][0] : '';\n return (first + last).toUpperCase();\n });\n\n constructor() {\n effect(() => {\n this.src();\n this.failed.set(false);\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;AAUG;MAuBU,QAAQ,CAAA;;AAEV,IAAA,IAAI,GAAG,KAAK,CAAC,QAAQ,0EAAU;AAC/B,IAAA,GAAG,GAAG,KAAK,CAA4B,SAAS,0EAAC;;AAEjD,IAAA,IAAI,GAAG,KAAK,CAAqB,IAAI,2EAAC;IACtC,UAAU,GAAG,KAAK,CAAC,KAAK,kFAAI,SAAS,EAAE,gBAAgB,E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AAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;4FAEU,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAtBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;oBACrB,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,aAAa,EAAE,iBAAiB,CAAC,IAAI;AACrC,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,WAAW;AAClB,wBAAA,kBAAkB,EAAE,iCAAiC;AACrD,wBAAA,aAAa,EAAE,6BAA6B;AAC5C,wBAAA,mBAAmB,EAAE,+BAA+B;AACpD,wBAAA,oBAAoB,EAAE,8BAA8B;AACrD,qBAAA;AACD,oBAAA,QAAQ,EAAE;;;;;;;;;AAST,EAAA,CAAA;AACF,iBAAA;;;AClCD;;AAEG;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Etiqueta curta para estados e categorias.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <span mxBadge variant="success">Paga</span>
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Não dependas só da cor: o texto deve dizer o estado.
|
|
12
|
+
*/
|
|
13
|
+
class MxBadge {
|
|
14
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
15
|
+
/** sm 18 px, md 20 px, lg 24 px. */
|
|
16
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
17
|
+
/** Ponto de cor antes do texto, para listas com muitos estados. */
|
|
18
|
+
dot = input(false, { ...(ngDevMode ? { debugName: "dot" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxBadge, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
20
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxBadge, isStandalone: true, selector: "[mxBadge]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-variant": "variant()", "attr.data-size": "size() === \"md\" ? null : size()", "attr.data-dot": "dot() ? \"\" : null" }, classAttribute: "mx-badge" }, exportAs: ["mxBadge"], ngImport: i0 });
|
|
21
|
+
}
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxBadge, decorators: [{
|
|
23
|
+
type: Directive,
|
|
24
|
+
args: [{
|
|
25
|
+
selector: '[mxBadge]',
|
|
26
|
+
exportAs: 'mxBadge',
|
|
27
|
+
host: {
|
|
28
|
+
class: 'mx-badge',
|
|
29
|
+
'[attr.data-variant]': 'variant()',
|
|
30
|
+
'[attr.data-size]': 'size() === "md" ? null : size()',
|
|
31
|
+
'[attr.data-dot]': 'dot() ? "" : null',
|
|
32
|
+
},
|
|
33
|
+
}]
|
|
34
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }] } });
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Generated bundle index. Do not edit.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
export { MxBadge };
|
|
41
|
+
//# sourceMappingURL=muxima-ui-core-badge.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-badge.mjs","sources":["../../../projects/core/badge/badge.ts","../../../projects/core/badge/muxima-ui-core-badge.ts"],"sourcesContent":["import { Directive, booleanAttribute, input } from '@angular/core';\n\nexport type MxBadgeVariant = 'default' | 'secondary' | 'outline' | 'success' | 'warning' | 'danger';\n\n/**\n * Etiqueta curta para estados e categorias.\n *\n * ```html\n * <span mxBadge variant=\"success\">Paga</span>\n * ```\n *\n * Não dependas só da cor: o texto deve dizer o estado.\n */\n@Directive({\n selector: '[mxBadge]',\n exportAs: 'mxBadge',\n host: {\n class: 'mx-badge',\n '[attr.data-variant]': 'variant()',\n '[attr.data-size]': 'size() === \"md\" ? null : size()',\n '[attr.data-dot]': 'dot() ? \"\" : null',\n },\n})\nexport class MxBadge {\n readonly variant = input<MxBadgeVariant>('default');\n /** sm 18 px, md 20 px, lg 24 px. */\n readonly size = input<'sm' | 'md' | 'lg'>('md');\n /** Ponto de cor antes do texto, para listas com muitos estados. */\n readonly dot = input(false, { transform: booleanAttribute });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAIA;;;;;;;;AAQG;MAWU,OAAO,CAAA;AACT,IAAA,OAAO,GAAG,KAAK,CAAiB,SAAS,8EAAC;;AAE1C,IAAA,IAAI,GAAG,KAAK,CAAqB,IAAI,2EAAC;;IAEtC,GAAG,GAAG,KAAK,CAAC,KAAK,2EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;wGALjD,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,WAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,GAAA,EAAA,EAAA,iBAAA,EAAA,KAAA,EAAA,UAAA,EAAA,KAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,mBAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,mCAAA,EAAA,eAAA,EAAA,qBAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,CAAA,SAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAP,OAAO,EAAA,UAAA,EAAA,CAAA;kBAVnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,WAAW;AACrB,oBAAA,QAAQ,EAAE,SAAS;AACnB,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,UAAU;AACjB,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,kBAAkB,EAAE,iCAAiC;AACrD,wBAAA,iBAAiB,EAAE,mBAAmB;AACvC,qBAAA;AACF,iBAAA;;;ACtBD;;AAEG;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Migalhas: mostram onde a página está na hierarquia.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <nav mxBreadcrumb>
|
|
9
|
+
* <ol>
|
|
10
|
+
* <li><a routerLink="/clientes">Clientes</a></li>
|
|
11
|
+
* <li><a routerLink="/clientes/42">Kianda Logística</a></li>
|
|
12
|
+
* <li><span aria-current="page">Facturas</span></li>
|
|
13
|
+
* </ol>
|
|
14
|
+
* </nav>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Os separadores são desenhados em CSS, por isso o leitor de ecrã não os lê.
|
|
18
|
+
*/
|
|
19
|
+
class MxBreadcrumb {
|
|
20
|
+
ariaLabel = input('Localização', { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxBreadcrumb, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
22
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxBreadcrumb, isStandalone: true, selector: "nav[mxBreadcrumb]", inputs: { ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-label": "ariaLabel()" }, classAttribute: "mx-breadcrumb" }, ngImport: i0 });
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxBreadcrumb, decorators: [{
|
|
25
|
+
type: Directive,
|
|
26
|
+
args: [{
|
|
27
|
+
selector: 'nav[mxBreadcrumb]',
|
|
28
|
+
host: { class: 'mx-breadcrumb', '[attr.aria-label]': 'ariaLabel()' },
|
|
29
|
+
}]
|
|
30
|
+
}], propDecorators: { ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Generated bundle index. Do not edit.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
export { MxBreadcrumb };
|
|
37
|
+
//# sourceMappingURL=muxima-ui-core-breadcrumb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-breadcrumb.mjs","sources":["../../../projects/core/breadcrumb/breadcrumb.ts","../../../projects/core/breadcrumb/muxima-ui-core-breadcrumb.ts"],"sourcesContent":["import { Directive, input } from '@angular/core';\n\n/**\n * Migalhas: mostram onde a página está na hierarquia.\n *\n * ```html\n * <nav mxBreadcrumb>\n * <ol>\n * <li><a routerLink=\"/clientes\">Clientes</a></li>\n * <li><a routerLink=\"/clientes/42\">Kianda Logística</a></li>\n * <li><span aria-current=\"page\">Facturas</span></li>\n * </ol>\n * </nav>\n * ```\n *\n * Os separadores são desenhados em CSS, por isso o leitor de ecrã não os lê.\n */\n@Directive({\n selector: 'nav[mxBreadcrumb]',\n host: { class: 'mx-breadcrumb', '[attr.aria-label]': 'ariaLabel()' },\n})\nexport class MxBreadcrumb {\n readonly ariaLabel = input('Localização', { alias: 'aria-label' });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;AAcG;MAKU,YAAY,CAAA;IACd,SAAS,GAAG,KAAK,CAAC,aAAa,iFAAI,KAAK,EAAE,YAAY,EAAA,CAAG;wGADvD,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;4FAAZ,YAAY,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,EAAA,SAAA,EAAA,EAAA,iBAAA,EAAA,WAAA,EAAA,UAAA,EAAA,YAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,eAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;4FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBAJxB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,mBAAmB;oBAC7B,IAAI,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EAAE;AACrE,iBAAA;;;ACpBD;;AAEG;;"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, inject, ElementRef, computed, ChangeDetectionStrategy, ViewEncapsulation, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Botão da Muxima UI, aplicado sobre o elemento nativo.
|
|
6
|
+
*
|
|
7
|
+
* ```html
|
|
8
|
+
* <button mxButton type="button">Guardar</button>
|
|
9
|
+
* <button mxButton variant="outline" size="sm">Cancelar</button>
|
|
10
|
+
* <a mxButton variant="link" routerLink="/precos">Ver preços</a>
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Como o elemento é o próprio `<button>` ou `<a>`, atributos como `type`,
|
|
14
|
+
* `form`, `routerLink` e `aria-*` funcionam sem configuração extra.
|
|
15
|
+
*/
|
|
16
|
+
class MxButton {
|
|
17
|
+
/** Aparência do botão. */
|
|
18
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
19
|
+
/** Altura: sm 32 px, md 36 px, lg 40 px. */
|
|
20
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
21
|
+
/** Botão quadrado só com ícone. Exige `aria-label`. */
|
|
22
|
+
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
23
|
+
/** Mostra um indicador e bloqueia novos cliques enquanto uma acção decorre. */
|
|
24
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
25
|
+
/** Desactiva o botão. Em `<a>`, usa aria-disabled e retira-o da ordem de tabulação. */
|
|
26
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
27
|
+
isNativeButton = inject(ElementRef).nativeElement.tagName === 'BUTTON';
|
|
28
|
+
isDisabled = computed(() => this.disabled() || this.loading(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
29
|
+
onClick(event) {
|
|
30
|
+
if (this.isDisabled()) {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
event.stopImmediatePropagation();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
36
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.25", type: MxButton, isStandalone: true, selector: "button[mxButton], a[mxButton]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.data-variant": "variant()", "attr.data-size": "size()", "attr.data-icon": "icon() ? \"\" : null", "attr.aria-busy": "loading() ? \"true\" : null", "attr.disabled": "isNativeButton && isDisabled() ? \"\" : null", "attr.aria-disabled": "!isNativeButton && isDisabled() ? \"true\" : null", "attr.tabindex": "!isNativeButton && isDisabled() ? -1 : null" }, classAttribute: "mx-button" }, exportAs: ["mxButton"], ngImport: i0, template: `@if (loading()) {
|
|
37
|
+
<span class="mx-spinner" aria-hidden="true"></span>
|
|
38
|
+
}
|
|
39
|
+
<ng-content />`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
40
|
+
}
|
|
41
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxButton, decorators: [{
|
|
42
|
+
type: Component,
|
|
43
|
+
args: [{
|
|
44
|
+
selector: 'button[mxButton], a[mxButton]',
|
|
45
|
+
exportAs: 'mxButton',
|
|
46
|
+
template: `@if (loading()) {
|
|
47
|
+
<span class="mx-spinner" aria-hidden="true"></span>
|
|
48
|
+
}
|
|
49
|
+
<ng-content />`,
|
|
50
|
+
encapsulation: ViewEncapsulation.None,
|
|
51
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
+
host: {
|
|
53
|
+
class: 'mx-button',
|
|
54
|
+
'[attr.data-variant]': 'variant()',
|
|
55
|
+
'[attr.data-size]': 'size()',
|
|
56
|
+
'[attr.data-icon]': 'icon() ? "" : null',
|
|
57
|
+
'[attr.aria-busy]': 'loading() ? "true" : null',
|
|
58
|
+
'[attr.disabled]': 'isNativeButton && isDisabled() ? "" : null',
|
|
59
|
+
'[attr.aria-disabled]': '!isNativeButton && isDisabled() ? "true" : null',
|
|
60
|
+
'[attr.tabindex]': '!isNativeButton && isDisabled() ? -1 : null',
|
|
61
|
+
'(click)': 'onClick($event)',
|
|
62
|
+
},
|
|
63
|
+
}]
|
|
64
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Generated bundle index. Do not edit.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
export { MxButton };
|
|
71
|
+
//# sourceMappingURL=muxima-ui-core-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muxima-ui-core-button.mjs","sources":["../../../projects/core/button/button.ts","../../../projects/core/button/muxima-ui-core-button.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n} from '@angular/core';\n\nexport type MxButtonVariant = 'default' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'link';\nexport type MxButtonSize = 'sm' | 'md' | 'lg';\n\n/**\n * Botão da Muxima UI, aplicado sobre o elemento nativo.\n *\n * ```html\n * <button mxButton type=\"button\">Guardar</button>\n * <button mxButton variant=\"outline\" size=\"sm\">Cancelar</button>\n * <a mxButton variant=\"link\" routerLink=\"/precos\">Ver preços</a>\n * ```\n *\n * Como o elemento é o próprio `<button>` ou `<a>`, atributos como `type`,\n * `form`, `routerLink` e `aria-*` funcionam sem configuração extra.\n */\n@Component({\n selector: 'button[mxButton], a[mxButton]',\n exportAs: 'mxButton',\n template: `@if (loading()) {\n <span class=\"mx-spinner\" aria-hidden=\"true\"></span>\n }\n <ng-content />`,\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'mx-button',\n '[attr.data-variant]': 'variant()',\n '[attr.data-size]': 'size()',\n '[attr.data-icon]': 'icon() ? \"\" : null',\n '[attr.aria-busy]': 'loading() ? \"true\" : null',\n '[attr.disabled]': 'isNativeButton && isDisabled() ? \"\" : null',\n '[attr.aria-disabled]': '!isNativeButton && isDisabled() ? \"true\" : null',\n '[attr.tabindex]': '!isNativeButton && isDisabled() ? -1 : null',\n '(click)': 'onClick($event)',\n },\n})\nexport class MxButton {\n /** Aparência do botão. */\n readonly variant = input<MxButtonVariant>('default');\n /** Altura: sm 32 px, md 36 px, lg 40 px. */\n readonly size = input<MxButtonSize>('md');\n /** Botão quadrado só com ícone. Exige `aria-label`. */\n readonly icon = input(false, { transform: booleanAttribute });\n /** Mostra um indicador e bloqueia novos cliques enquanto uma acção decorre. */\n readonly loading = input(false, { transform: booleanAttribute });\n /** Desactiva o botão. Em `<a>`, usa aria-disabled e retira-o da ordem de tabulação. */\n readonly disabled = input(false, { transform: booleanAttribute });\n\n protected readonly isNativeButton =\n inject<ElementRef<HTMLElement>>(ElementRef).nativeElement.tagName === 'BUTTON';\n\n protected readonly isDisabled = computed(() => this.disabled() || this.loading());\n\n protected onClick(event: Event): void {\n if (this.isDisabled()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAcA;;;;;;;;;;;AAWG;MAsBU,QAAQ,CAAA;;AAEV,IAAA,OAAO,GAAG,KAAK,CAAkB,SAAS,8EAAC;;AAE3C,IAAA,IAAI,GAAG,KAAK,CAAe,IAAI,2EAAC;;IAEhC,IAAI,GAAG,KAAK,CAAC,KAAK,4EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEpD,OAAO,GAAG,KAAK,CAAC,KAAK,+EAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;;IAEvD,QAAQ,GAAG,KAAK,CAAC,KAAK,gFAAI,SAAS,EAAE,gBAAgB,EAAA,CAAG;IAE9C,cAAc,GAC/B,MAAM,CAA0B,UAAU,CAAC,CAAC,aAAa,CAAC,OAAO,KAAK,QAAQ;AAE7D,IAAA,UAAU,GAAG,QAAQ,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,iFAAC;AAEvE,IAAA,OAAO,CAAC,KAAY,EAAA;AAC5B,QAAA,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE;YACrB,KAAK,CAAC,cAAc,EAAE;YACtB,KAAK,CA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,gBAAA,EAAA,6BAAA,EAAA,eAAA,EAAA,8CAAA,EAAA,oBAAA,EAAA,mDAAA,EAAA,eAAA,EAAA,6CAAA,EAAA,EAAA,cAAA,EAAA,WAAA,EAAA,EAAA,QAAA,EAAA,CAAA,UAAA,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAlBT,CAAA;;;AAGO,kBAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,CAAA,iBAAA,CAAA,IAAA,EAAA,CAAA;;4FAeN,QAAQ,EAAA,UAAA,EAAA,CAAA;kBArBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,QAAQ,EAAE,CAAA;;;AAGO,kBAAA,CAAA;oBACjB,aAAa,EAAE,iBAAiB,CAAC,IAAI;oBACrC,eAAe,EAAE,uBAAuB,CAAC,MAAM;AAC/C,oBAAA,IAAI,EAAE;AACJ,wBAAA,KAAK,EAAE,WAAW;AAClB,wBAAA,qBAAqB,EAAE,WAAW;AAClC,wBAAA,kBAAkB,EAAE,QAAQ;AAC5B,wBAAA,kBAAkB,EAAE,oBAAoB;AACxC,wBAAA,kBAAkB,EAAE,2BAA2B;AAC/C,wBAAA,iBAAiB,EAAE,4CAA4C;AAC/D,wBAAA,sBAAsB,EAAE,iDAAiD;AACzE,wBAAA,iBAAiB,EAAE,6CAA6C;AAChE,wBAAA,SAAS,EAAE,iBAAiB;AAC7B,qBAAA;AACF,iBAAA;;;AC9CD;;AAEG;;"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, Directive } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Superfície para agrupar conteúdo relacionado. Aplica-se ao elemento que fizer
|
|
6
|
+
* sentido: `article`, `section`, `div` ou `a` (cartão clicável).
|
|
7
|
+
*
|
|
8
|
+
* ```html
|
|
9
|
+
* <article mxCard>
|
|
10
|
+
* <header mxCardHeader>
|
|
11
|
+
* <h3 mxCardTitle>Facturação</h3>
|
|
12
|
+
* <p mxCardDescription>Resumo do mês corrente.</p>
|
|
13
|
+
* </header>
|
|
14
|
+
* <div mxCardContent>...</div>
|
|
15
|
+
* <footer mxCardFooter><button mxButton>Ver detalhe</button></footer>
|
|
16
|
+
* </article>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class MxCard {
|
|
20
|
+
/** default: borda; subtle: fundo suave sem borda; elevated: sombra; accent: destaque com a cor de marca. */
|
|
21
|
+
variant = input('default', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
22
|
+
/** horizontal: imagem à esquerda e conteúdo à direita (volta a vertical em ecrãs estreitos). */
|
|
23
|
+
orientation = input('vertical', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
24
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCard, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
25
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.25", type: MxCard, isStandalone: true, selector: "[mxCard]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.data-variant": "variant() === \"default\" ? null : variant()", "attr.data-orientation": "orientation() === \"vertical\" ? null : orientation()" }, classAttribute: "mx-card" }, ngImport: i0 });
|
|
26
|
+
}
|
|
27
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCard, decorators: [{
|
|
28
|
+
type: Directive,
|
|
29
|
+
args: [{
|
|
30
|
+
selector: '[mxCard]',
|
|
31
|
+
host: {
|
|
32
|
+
class: 'mx-card',
|
|
33
|
+
'[attr.data-variant]': 'variant() === "default" ? null : variant()',
|
|
34
|
+
'[attr.data-orientation]': 'orientation() === "vertical" ? null : orientation()',
|
|
35
|
+
},
|
|
36
|
+
}]
|
|
37
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }] } });
|
|
38
|
+
/** Imagem ou área visual que encosta às margens do cartão. Usa-se em `img`, `picture` ou `div`. */
|
|
39
|
+
class MxCardMedia {
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardMedia, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
41
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardMedia, isStandalone: true, selector: "[mxCardMedia]", host: { classAttribute: "mx-card-media" }, ngImport: i0 });
|
|
42
|
+
}
|
|
43
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardMedia, decorators: [{
|
|
44
|
+
type: Directive,
|
|
45
|
+
args: [{ selector: '[mxCardMedia]', host: { class: 'mx-card-media' } }]
|
|
46
|
+
}] });
|
|
47
|
+
class MxCardHeader {
|
|
48
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardHeader, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
49
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardHeader, isStandalone: true, selector: "[mxCardHeader]", host: { classAttribute: "mx-card-header" }, ngImport: i0 });
|
|
50
|
+
}
|
|
51
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardHeader, decorators: [{
|
|
52
|
+
type: Directive,
|
|
53
|
+
args: [{ selector: '[mxCardHeader]', host: { class: 'mx-card-header' } }]
|
|
54
|
+
}] });
|
|
55
|
+
/** Título do cartão. Usa o nível de cabeçalho certo para a página (h2, h3...). */
|
|
56
|
+
class MxCardTitle {
|
|
57
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardTitle, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
58
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardTitle, isStandalone: true, selector: "[mxCardTitle]", host: { classAttribute: "mx-card-title" }, ngImport: i0 });
|
|
59
|
+
}
|
|
60
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardTitle, decorators: [{
|
|
61
|
+
type: Directive,
|
|
62
|
+
args: [{ selector: '[mxCardTitle]', host: { class: 'mx-card-title' } }]
|
|
63
|
+
}] });
|
|
64
|
+
class MxCardDescription {
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardDescription, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardDescription, isStandalone: true, selector: "[mxCardDescription]", host: { classAttribute: "mx-card-description" }, ngImport: i0 });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardDescription, decorators: [{
|
|
69
|
+
type: Directive,
|
|
70
|
+
args: [{ selector: '[mxCardDescription]', host: { class: 'mx-card-description' } }]
|
|
71
|
+
}] });
|
|
72
|
+
class MxCardContent {
|
|
73
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
74
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardContent, isStandalone: true, selector: "[mxCardContent]", host: { classAttribute: "mx-card-content" }, ngImport: i0 });
|
|
75
|
+
}
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardContent, decorators: [{
|
|
77
|
+
type: Directive,
|
|
78
|
+
args: [{ selector: '[mxCardContent]', host: { class: 'mx-card-content' } }]
|
|
79
|
+
}] });
|
|
80
|
+
class MxCardFooter {
|
|
81
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardFooter, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
82
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.25", type: MxCardFooter, isStandalone: true, selector: "[mxCardFooter]", host: { classAttribute: "mx-card-footer" }, ngImport: i0 });
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.25", ngImport: i0, type: MxCardFooter, decorators: [{
|
|
85
|
+
type: Directive,
|
|
86
|
+
args: [{ selector: '[mxCardFooter]', host: { class: 'mx-card-footer' } }]
|
|
87
|
+
}] });
|
|
88
|
+
const MX_CARD = [MxCard, MxCardMedia, MxCardHeader, MxCardTitle, MxCardDescription, MxCardContent, MxCardFooter];
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Generated bundle index. Do not edit.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
export { MX_CARD, MxCard, MxCardContent, MxCardDescription, MxCardFooter, MxCardHeader, MxCardMedia, MxCardTitle };
|
|
95
|
+
//# sourceMappingURL=muxima-ui-core-card.mjs.map
|