123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- import { DOCUMENT, NgClass } from '@angular/common';
- import * as i0 from '@angular/core';
- import { Component, ChangeDetectionStrategy, Inject, Input } from '@angular/core';
- const icons = `
- <svg xmlns="http://www.w3.org/2000/svg" style="display:none">
- <symbol id="arrow-down" viewBox="0 0 24 24">
- <path stroke-linecap="round" stroke-linejoin="round" d="M19.5 13.5L12 21m0 0l-7.5-7.5M12 21V3" />
- </symbol>
- </svg>
- `;
- class IconComponent {
- constructor(renderer, document, el) {
- this.renderer = renderer;
- this.document = document;
- this.el = el;
- this.icon = '';
- this.iconClass = '';
- this.fill = 'currentColor';
- this.strokeWidth = 1.5;
- this.strokeColor = 'currentColor';
- this.size = 'base';
- this.iconPath = '';
- }
- ngOnInit() {
- this.injectSVG();
- this.strokeColor = this.getFormattedColor(this.strokeColor);
- this.fill = this.getFormattedColor(this.fill);
- }
- getFormattedColor(color) {
- if (color.startsWith('--')) {
- const rgbValue = getComputedStyle(document.documentElement).getPropertyValue(color).trim();
- return `rgb(${rgbValue})`;
- }
- return color;
- }
- getIconPath() {
- return `#${this.icon}`;
- }
- injectSVG() {
- const svgElement = this.renderer.createElement('div');
- this.renderer.setProperty(svgElement, 'innerHTML', icons);
- this.renderer.setStyle(svgElement, 'display', 'none');
- this.renderer.appendChild(this.document.body, svgElement);
- }
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: IconComponent, deps: [{ token: i0.Renderer2 }, { token: DOCUMENT }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.1", type: IconComponent, isStandalone: true, selector: "ct-icon", inputs: { icon: "icon", iconClass: "iconClass", fill: "fill", strokeWidth: "strokeWidth", strokeColor: "strokeColor", size: "size" }, ngImport: i0, template: "<svg\n [ngClass]=\"iconClass\"\n [attr.fill]=\"fill\"\n [attr.stroke-width]=\"strokeWidth\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex\"\n [class.size-3]=\"size === 'xs'\"\n [class.size-4]=\"size === 'sm'\"\n [class.size-5]=\"size === 'base'\"\n [class.size-6]=\"size === 'lg'\"\n [class.size-8]=\"size === 'xl'\">\n <use [attr.xlink:href]=\"getIconPath()\"></use>\n</svg>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
- }
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: IconComponent, decorators: [{
- type: Component,
- args: [{ selector: 'ct-icon', standalone: true, imports: [NgClass], changeDetection: ChangeDetectionStrategy.OnPush, template: "<svg\n [ngClass]=\"iconClass\"\n [attr.fill]=\"fill\"\n [attr.stroke-width]=\"strokeWidth\"\n [attr.stroke]=\"strokeColor\"\n class=\"flex\"\n [class.size-3]=\"size === 'xs'\"\n [class.size-4]=\"size === 'sm'\"\n [class.size-5]=\"size === 'base'\"\n [class.size-6]=\"size === 'lg'\"\n [class.size-8]=\"size === 'xl'\">\n <use [attr.xlink:href]=\"getIconPath()\"></use>\n</svg>\n" }]
- }], ctorParameters: () => [{ type: i0.Renderer2 }, { type: Document, decorators: [{
- type: Inject,
- args: [DOCUMENT]
- }] }, { type: i0.ElementRef }], propDecorators: { icon: [{
- type: Input
- }], iconClass: [{
- type: Input
- }], fill: [{
- type: Input
- }], strokeWidth: [{
- type: Input
- }], strokeColor: [{
- type: Input
- }], size: [{
- type: Input
- }] } });
- class ButtonComponent {
- constructor() {
- this.text = '';
- this.type = 'default';
- this.size = 'base';
- this.variant = 'default';
- this.icon = undefined;
- this.iconSize = undefined;
- }
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.1", type: ButtonComponent, isStandalone: true, selector: "ct-button", inputs: { text: "text", type: "type", size: "size", variant: "variant", icon: "icon", iconSize: "iconSize" }, ngImport: i0, template: "<button\n class=\"flex flex-row items-center gap-2 rounded-md px-4 py-2\"\n [class.bg-primary]=\"type === 'default' && variant === 'default'\"\n [class.bg-on-primary]=\"type === 'alternate' && variant === 'default'\"\n [class.bg-yellow-400]=\"type === 'warning' && variant === 'default'\"\n [class.bg-red-400]=\"type === 'error' && variant === 'default'\"\n [class.bg-lime-600]=\"type === 'success' && variant === 'default'\"\n [class.border]=\"variant === 'outline'\"\n [class.border-primary]=\"type === 'default' && variant === 'outline'\"\n [class.border-on-primary]=\"type === 'alternate' && variant === 'outline'\"\n [class.border-yellow-400]=\"type === 'warning' && variant === 'outline'\"\n [class.border-red-400]=\"type === 'error' && variant === 'outline'\"\n [class.border-lime-600]=\"type === 'success' && variant === 'outline'\">\n @if (icon) {\n <ct-icon class=\"flex\" [size]=\"iconSize || 'base'\" [icon]=\"icon\" />\n }\n {{ text }}\n</button>\n", dependencies: [{ kind: "component", type: IconComponent, selector: "ct-icon", inputs: ["icon", "iconClass", "fill", "strokeWidth", "strokeColor", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
- }
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.1", ngImport: i0, type: ButtonComponent, decorators: [{
- type: Component,
- args: [{ selector: 'ct-button', standalone: true, imports: [IconComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n class=\"flex flex-row items-center gap-2 rounded-md px-4 py-2\"\n [class.bg-primary]=\"type === 'default' && variant === 'default'\"\n [class.bg-on-primary]=\"type === 'alternate' && variant === 'default'\"\n [class.bg-yellow-400]=\"type === 'warning' && variant === 'default'\"\n [class.bg-red-400]=\"type === 'error' && variant === 'default'\"\n [class.bg-lime-600]=\"type === 'success' && variant === 'default'\"\n [class.border]=\"variant === 'outline'\"\n [class.border-primary]=\"type === 'default' && variant === 'outline'\"\n [class.border-on-primary]=\"type === 'alternate' && variant === 'outline'\"\n [class.border-yellow-400]=\"type === 'warning' && variant === 'outline'\"\n [class.border-red-400]=\"type === 'error' && variant === 'outline'\"\n [class.border-lime-600]=\"type === 'success' && variant === 'outline'\">\n @if (icon) {\n <ct-icon class=\"flex\" [size]=\"iconSize || 'base'\" [icon]=\"icon\" />\n }\n {{ text }}\n</button>\n" }]
- }], propDecorators: { text: [{
- type: Input,
- args: [{ required: true }]
- }], type: [{
- type: Input
- }], size: [{
- type: Input
- }], variant: [{
- type: Input
- }], icon: [{
- type: Input
- }], iconSize: [{
- type: Input
- }] } });
- /*
- * Public API Surface of circletone
- */
- /**
- * Generated bundle index. Do not edit.
- */
- export { ButtonComponent, IconComponent };
- //# sourceMappingURL=circletone.mjs.map
|