@fuse_ui/button 0.0.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/README.md +7 -0
- package/fesm2022/fuse_ui-button.mjs +51 -0
- package/fesm2022/fuse_ui-button.mjs.map +1 -0
- package/package.json +59 -0
- package/types/fuse_ui-button.d.ts +24 -0
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, output, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
class FuseButtonComponent {
|
|
5
|
+
/** Visual style of the button. */
|
|
6
|
+
variant = input('solid', ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
7
|
+
/** Colour theme mapped to --fuse-color-* tokens. */
|
|
8
|
+
color = input('primary', ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
9
|
+
/** Size variant. */
|
|
10
|
+
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
11
|
+
/** Renders the button in a disabled state. */
|
|
12
|
+
disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
13
|
+
/** Shows a spinner and suppresses click events. */
|
|
14
|
+
loading = input(false, ...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
15
|
+
/** Native button type attribute. */
|
|
16
|
+
type = input('button', ...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
17
|
+
/** Emits when the button is clicked (blocked when disabled or loading). */
|
|
18
|
+
clicked = output();
|
|
19
|
+
hostClasses = computed(() => [
|
|
20
|
+
'fuse-btn',
|
|
21
|
+
`fuse-btn--${this.variant()}`,
|
|
22
|
+
`fuse-btn--${this.color()}`,
|
|
23
|
+
`fuse-btn--${this.size()}`,
|
|
24
|
+
this.disabled() ? 'fuse-btn--disabled' : '',
|
|
25
|
+
this.loading() ? 'fuse-btn--loading' : '',
|
|
26
|
+
]
|
|
27
|
+
.filter(Boolean)
|
|
28
|
+
.join(' '), ...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
29
|
+
handleClick(event) {
|
|
30
|
+
if (!this.disabled() && !this.loading()) {
|
|
31
|
+
this.clicked.emit(event);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuseButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
35
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.6", type: FuseButtonComponent, isStandalone: true, selector: "fuse-button", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clicked: "clicked" }, host: { properties: { "class": "hostClasses()", "attr.data-variant": "variant()", "attr.data-color": "color()" } }, ngImport: i0, template: "<button\n [type]=\"type()\"\n [disabled]=\"disabled() || loading()\"\n (click)=\"handleClick($event)\">\n @if (loading()) {\n <span class=\"fuse-btn__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"fuse-btn__content\">\n <ng-content></ng-content>\n </span>\n</button>\n", styles: [":host{--fuse-btn-bg: var(--fuse-color-primary);--fuse-btn-color: var(--fuse-color-on-primary);--fuse-btn-radius: var(--fuse-radius-md);--fuse-btn-px: var(--fuse-spacing-4);--fuse-btn-py: var(--fuse-spacing-2);--fuse-btn-font-size: var(--fuse-font-size-md);--fuse-btn-font-weight: var(--fuse-font-weight-medium);--fuse-btn-border: transparent;--fuse-btn-shadow: none;display:inline-flex}:host(.fuse-btn--primary){--fuse-btn-bg: var(--fuse-color-primary);--fuse-btn-color: var(--fuse-color-on-primary)}:host(.fuse-btn--secondary){--fuse-btn-bg: var(--fuse-color-secondary);--fuse-btn-color: var(--fuse-color-on-secondary)}:host(.fuse-btn--success){--fuse-btn-bg: var(--fuse-color-success);--fuse-btn-color: var(--fuse-color-on-success)}:host(.fuse-btn--danger){--fuse-btn-bg: var(--fuse-color-danger);--fuse-btn-color: var(--fuse-color-on-danger)}:host(.fuse-btn--outline) button{background:transparent;border:1.5px solid var(--fuse-btn-bg);color:var(--fuse-btn-bg)}:host(.fuse-btn--ghost) button{background:transparent;color:var(--fuse-btn-bg);border:none}:host(.fuse-btn--link) button{background:transparent;color:var(--fuse-btn-bg);border:none;text-decoration:underline;padding:0}:host(.fuse-btn--sm){--fuse-btn-px: var(--fuse-spacing-3);--fuse-btn-py: var(--fuse-spacing-1);--fuse-btn-font-size: var(--fuse-font-size-sm)}:host(.fuse-btn--lg){--fuse-btn-px: var(--fuse-spacing-6);--fuse-btn-py: var(--fuse-spacing-3);--fuse-btn-font-size: var(--fuse-font-size-lg)}:host-context(.ios){--fuse-btn-radius: var(--fuse-radius-lg)}:host-context(.md){--fuse-btn-radius: var(--fuse-radius-sm)}button{background:var(--fuse-btn-bg);color:var(--fuse-btn-color);border-radius:var(--fuse-btn-radius);padding:var(--fuse-btn-py) var(--fuse-btn-px);font-size:var(--fuse-btn-font-size);font-weight:var(--fuse-btn-font-weight);box-shadow:var(--fuse-btn-shadow);border:none;cursor:pointer;display:inline-flex;align-items:center;gap:var(--fuse-spacing-2);transition:opacity .15s,transform .1s;width:100%;justify-content:center;font-family:inherit;line-height:1;white-space:nowrap}button:hover:not(:disabled){opacity:.88}button:active:not(:disabled){transform:scale(.98)}button:disabled{opacity:.5;cursor:not-allowed}button:focus-visible{outline:2px solid var(--fuse-btn-bg);outline-offset:2px}.fuse-btn__spinner{width:1em;height:1em;border:2px solid transparent;border-top-color:currentColor;border-radius:var(--fuse-radius-full);animation:fuse-spin .65s linear infinite;flex-shrink:0}@keyframes fuse-spin{to{transform:rotate(360deg)}}.fuse-btn__content{display:inline-flex;align-items:center;gap:var(--fuse-spacing-2)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
36
|
+
}
|
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.6", ngImport: i0, type: FuseButtonComponent, decorators: [{
|
|
38
|
+
type: Component,
|
|
39
|
+
args: [{ selector: 'fuse-button', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
40
|
+
'[class]': 'hostClasses()',
|
|
41
|
+
'[attr.data-variant]': 'variant()',
|
|
42
|
+
'[attr.data-color]': 'color()',
|
|
43
|
+
}, template: "<button\n [type]=\"type()\"\n [disabled]=\"disabled() || loading()\"\n (click)=\"handleClick($event)\">\n @if (loading()) {\n <span class=\"fuse-btn__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"fuse-btn__content\">\n <ng-content></ng-content>\n </span>\n</button>\n", styles: [":host{--fuse-btn-bg: var(--fuse-color-primary);--fuse-btn-color: var(--fuse-color-on-primary);--fuse-btn-radius: var(--fuse-radius-md);--fuse-btn-px: var(--fuse-spacing-4);--fuse-btn-py: var(--fuse-spacing-2);--fuse-btn-font-size: var(--fuse-font-size-md);--fuse-btn-font-weight: var(--fuse-font-weight-medium);--fuse-btn-border: transparent;--fuse-btn-shadow: none;display:inline-flex}:host(.fuse-btn--primary){--fuse-btn-bg: var(--fuse-color-primary);--fuse-btn-color: var(--fuse-color-on-primary)}:host(.fuse-btn--secondary){--fuse-btn-bg: var(--fuse-color-secondary);--fuse-btn-color: var(--fuse-color-on-secondary)}:host(.fuse-btn--success){--fuse-btn-bg: var(--fuse-color-success);--fuse-btn-color: var(--fuse-color-on-success)}:host(.fuse-btn--danger){--fuse-btn-bg: var(--fuse-color-danger);--fuse-btn-color: var(--fuse-color-on-danger)}:host(.fuse-btn--outline) button{background:transparent;border:1.5px solid var(--fuse-btn-bg);color:var(--fuse-btn-bg)}:host(.fuse-btn--ghost) button{background:transparent;color:var(--fuse-btn-bg);border:none}:host(.fuse-btn--link) button{background:transparent;color:var(--fuse-btn-bg);border:none;text-decoration:underline;padding:0}:host(.fuse-btn--sm){--fuse-btn-px: var(--fuse-spacing-3);--fuse-btn-py: var(--fuse-spacing-1);--fuse-btn-font-size: var(--fuse-font-size-sm)}:host(.fuse-btn--lg){--fuse-btn-px: var(--fuse-spacing-6);--fuse-btn-py: var(--fuse-spacing-3);--fuse-btn-font-size: var(--fuse-font-size-lg)}:host-context(.ios){--fuse-btn-radius: var(--fuse-radius-lg)}:host-context(.md){--fuse-btn-radius: var(--fuse-radius-sm)}button{background:var(--fuse-btn-bg);color:var(--fuse-btn-color);border-radius:var(--fuse-btn-radius);padding:var(--fuse-btn-py) var(--fuse-btn-px);font-size:var(--fuse-btn-font-size);font-weight:var(--fuse-btn-font-weight);box-shadow:var(--fuse-btn-shadow);border:none;cursor:pointer;display:inline-flex;align-items:center;gap:var(--fuse-spacing-2);transition:opacity .15s,transform .1s;width:100%;justify-content:center;font-family:inherit;line-height:1;white-space:nowrap}button:hover:not(:disabled){opacity:.88}button:active:not(:disabled){transform:scale(.98)}button:disabled{opacity:.5;cursor:not-allowed}button:focus-visible{outline:2px solid var(--fuse-btn-bg);outline-offset:2px}.fuse-btn__spinner{width:1em;height:1em;border:2px solid transparent;border-top-color:currentColor;border-radius:var(--fuse-radius-full);animation:fuse-spin .65s linear infinite;flex-shrink:0}@keyframes fuse-spin{to{transform:rotate(360deg)}}.fuse-btn__content{display:inline-flex;align-items:center;gap:var(--fuse-spacing-2)}\n"] }]
|
|
44
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], clicked: [{ type: i0.Output, args: ["clicked"] }] } });
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Generated bundle index. Do not edit.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export { FuseButtonComponent };
|
|
51
|
+
//# sourceMappingURL=fuse_ui-button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fuse_ui-button.mjs","sources":["../../../../packages/button/src/lib/button/fuse-button.component.ts","../../../../packages/button/src/lib/button/fuse-button.component.html","../../../../packages/button/src/fuse_ui-button.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n computed,\n input,\n output,\n} from '@angular/core';\n\n@Component({\n selector: 'fuse-button',\n standalone: true,\n imports: [],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[class]': 'hostClasses()',\n '[attr.data-variant]': 'variant()',\n '[attr.data-color]': 'color()',\n },\n templateUrl: './fuse-button.component.html',\n styleUrl: './fuse-button.component.scss',\n})\nexport class FuseButtonComponent {\n /** Visual style of the button. */\n variant = input<'solid' | 'outline' | 'ghost' | 'link'>('solid');\n\n /** Colour theme mapped to --fuse-color-* tokens. */\n color = input<'primary' | 'secondary' | 'success' | 'danger'>('primary');\n\n /** Size variant. */\n size = input<'sm' | 'md' | 'lg'>('md');\n\n /** Renders the button in a disabled state. */\n disabled = input(false);\n\n /** Shows a spinner and suppresses click events. */\n loading = input(false);\n\n /** Native button type attribute. */\n type = input<'button' | 'submit' | 'reset'>('button');\n\n /** Emits when the button is clicked (blocked when disabled or loading). */\n clicked = output<MouseEvent>();\n\n protected readonly hostClasses = computed(() =>\n [\n 'fuse-btn',\n `fuse-btn--${this.variant()}`,\n `fuse-btn--${this.color()}`,\n `fuse-btn--${this.size()}`,\n this.disabled() ? 'fuse-btn--disabled' : '',\n this.loading() ? 'fuse-btn--loading' : '',\n ]\n .filter(Boolean)\n .join(' ')\n );\n\n handleClick(event: MouseEvent): void {\n if (!this.disabled() && !this.loading()) {\n this.clicked.emit(event);\n }\n }\n}\n","<button\n [type]=\"type()\"\n [disabled]=\"disabled() || loading()\"\n (click)=\"handleClick($event)\">\n @if (loading()) {\n <span class=\"fuse-btn__spinner\" aria-hidden=\"true\"></span>\n }\n <span class=\"fuse-btn__content\">\n <ng-content></ng-content>\n </span>\n</button>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAqBa,mBAAmB,CAAA;;AAE9B,IAAA,OAAO,GAAG,KAAK,CAAyC,OAAO,8EAAC;;AAGhE,IAAA,KAAK,GAAG,KAAK,CAAiD,SAAS,4EAAC;;AAGxE,IAAA,IAAI,GAAG,KAAK,CAAqB,IAAI,2EAAC;;AAGtC,IAAA,QAAQ,GAAG,KAAK,CAAC,KAAK,+EAAC;;AAGvB,IAAA,OAAO,GAAG,KAAK,CAAC,KAAK,8EAAC;;AAGtB,IAAA,IAAI,GAAG,KAAK,CAAgC,QAAQ,2EAAC;;IAGrD,OAAO,GAAG,MAAM,EAAc;AAEX,IAAA,WAAW,GAAG,QAAQ,CAAC,MACxC;QACE,UAAU;AACV,QAAA,CAAA,UAAA,EAAa,IAAI,CAAC,OAAO,EAAE,CAAA,CAAE;AAC7B,QAAA,CAAA,UAAA,EAAa,IAAI,CAAC,KAAK,EAAE,CAAA,CAAE;AAC3B,QAAA,CAAA,UAAA,EAAa,IAAI,CAAC,IAAI,EAAE,CAAA,CAAE;QAC1B,IAAI,CAAC,QAAQ,EAAE,GAAG,oBAAoB,GAAG,EAAE;QAC3C,IAAI,CAAC,OAAO,EAAE,GAAG,mBAAmB,GAAG,EAAE;AAC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
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"keywords": [
|
|
9
|
+
"fuse-ui",
|
|
10
|
+
"angular",
|
|
11
|
+
"ionic",
|
|
12
|
+
"ionic8",
|
|
13
|
+
"angular18",
|
|
14
|
+
"angular19",
|
|
15
|
+
"angular20",
|
|
16
|
+
"angular21",
|
|
17
|
+
"ui-components",
|
|
18
|
+
"design-system",
|
|
19
|
+
"css-variables",
|
|
20
|
+
"signals",
|
|
21
|
+
"standalone",
|
|
22
|
+
"multi-theme",
|
|
23
|
+
"dark-mode",
|
|
24
|
+
"fluid-typography",
|
|
25
|
+
"animated"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@angular/core": ">=18.0.0",
|
|
29
|
+
"@angular/common": ">=18.0.0",
|
|
30
|
+
"rxjs": ">=7.4.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependenciesMeta": {
|
|
33
|
+
"@ionic/angular": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"sideEffects": [
|
|
38
|
+
"*.css",
|
|
39
|
+
"**/*.scss"
|
|
40
|
+
],
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=20.0.0"
|
|
43
|
+
},
|
|
44
|
+
"module": "fesm2022/fuse_ui-button.mjs",
|
|
45
|
+
"typings": "types/fuse_ui-button.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
"./package.json": {
|
|
48
|
+
"default": "./package.json"
|
|
49
|
+
},
|
|
50
|
+
".": {
|
|
51
|
+
"types": "./types/fuse_ui-button.d.ts",
|
|
52
|
+
"default": "./fesm2022/fuse_ui-button.mjs"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"type": "module",
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"tslib": "^2.3.0"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as _angular_core from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare class FuseButtonComponent {
|
|
4
|
+
/** Visual style of the button. */
|
|
5
|
+
variant: _angular_core.InputSignal<"solid" | "outline" | "ghost" | "link">;
|
|
6
|
+
/** Colour theme mapped to --fuse-color-* tokens. */
|
|
7
|
+
color: _angular_core.InputSignal<"primary" | "secondary" | "success" | "danger">;
|
|
8
|
+
/** Size variant. */
|
|
9
|
+
size: _angular_core.InputSignal<"sm" | "md" | "lg">;
|
|
10
|
+
/** Renders the button in a disabled state. */
|
|
11
|
+
disabled: _angular_core.InputSignal<boolean>;
|
|
12
|
+
/** Shows a spinner and suppresses click events. */
|
|
13
|
+
loading: _angular_core.InputSignal<boolean>;
|
|
14
|
+
/** Native button type attribute. */
|
|
15
|
+
type: _angular_core.InputSignal<"button" | "submit" | "reset">;
|
|
16
|
+
/** Emits when the button is clicked (blocked when disabled or loading). */
|
|
17
|
+
clicked: _angular_core.OutputEmitterRef<MouseEvent>;
|
|
18
|
+
protected readonly hostClasses: _angular_core.Signal<string>;
|
|
19
|
+
handleClick(event: MouseEvent): void;
|
|
20
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<FuseButtonComponent, never>;
|
|
21
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<FuseButtonComponent, "fuse-button", never, { "variant": { "alias": "variant"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; }, { "clicked": "clicked"; }, never, ["*"], true, never>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { FuseButtonComponent };
|