@vespera-ui/angular 0.2.0 → 0.4.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.
|
@@ -1817,9 +1817,630 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1817
1817
|
type: Input
|
|
1818
1818
|
}] } });
|
|
1819
1819
|
|
|
1820
|
+
function smoothPath(pts) {
|
|
1821
|
+
if (pts.length < 2)
|
|
1822
|
+
return '';
|
|
1823
|
+
let d = `M ${pts[0][0]} ${pts[0][1]}`;
|
|
1824
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
1825
|
+
const [x0, y0] = pts[i];
|
|
1826
|
+
const [x1, y1] = pts[i + 1];
|
|
1827
|
+
const cx = (x0 + x1) / 2;
|
|
1828
|
+
d += ` C ${cx} ${y0} ${cx} ${y1} ${x1} ${y1}`;
|
|
1829
|
+
}
|
|
1830
|
+
return d;
|
|
1831
|
+
}
|
|
1832
|
+
let sparkUid = 0;
|
|
1833
|
+
class VspSparkline {
|
|
1834
|
+
data = [];
|
|
1835
|
+
color = 'var(--accent)';
|
|
1836
|
+
w = 110;
|
|
1837
|
+
h = 34;
|
|
1838
|
+
fill = true;
|
|
1839
|
+
gid = 'spk' + ++sparkUid;
|
|
1840
|
+
get pts() {
|
|
1841
|
+
const min = Math.min(...this.data);
|
|
1842
|
+
const max = Math.max(...this.data);
|
|
1843
|
+
const rng = max - min || 1;
|
|
1844
|
+
return this.data.map((v, i) => [
|
|
1845
|
+
(i / (this.data.length - 1)) * this.w,
|
|
1846
|
+
this.h - 3 - ((v - min) / rng) * (this.h - 6),
|
|
1847
|
+
]);
|
|
1848
|
+
}
|
|
1849
|
+
get d() {
|
|
1850
|
+
return smoothPath(this.pts);
|
|
1851
|
+
}
|
|
1852
|
+
get areaD() {
|
|
1853
|
+
return `${this.d} L ${this.w} ${this.h} L 0 ${this.h} Z`;
|
|
1854
|
+
}
|
|
1855
|
+
get last() {
|
|
1856
|
+
return this.pts[this.pts.length - 1] ?? [0, 0];
|
|
1857
|
+
}
|
|
1858
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspSparkline, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1859
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspSparkline, isStandalone: true, selector: "vsp-sparkline", inputs: { data: "data", color: "color", w: "w", h: "h", fill: "fill" }, ngImport: i0, template: `<svg
|
|
1860
|
+
[attr.width]="w"
|
|
1861
|
+
[attr.height]="h"
|
|
1862
|
+
[attr.viewBox]="'0 0 ' + w + ' ' + h"
|
|
1863
|
+
style="display: block; overflow: visible"
|
|
1864
|
+
>
|
|
1865
|
+
@if (fill) {
|
|
1866
|
+
<defs>
|
|
1867
|
+
<linearGradient [id]="gid" x1="0" x2="0" y1="0" y2="1">
|
|
1868
|
+
<stop offset="0" [attr.stop-color]="color" stop-opacity="0.28" />
|
|
1869
|
+
<stop offset="1" [attr.stop-color]="color" stop-opacity="0" />
|
|
1870
|
+
</linearGradient>
|
|
1871
|
+
</defs>
|
|
1872
|
+
<path [attr.d]="areaD" [attr.fill]="'url(#' + gid + ')'" />
|
|
1873
|
+
}
|
|
1874
|
+
<path [attr.d]="d" fill="none" [attr.stroke]="color" stroke-width="2" stroke-linecap="round" />
|
|
1875
|
+
<circle [attr.cx]="last[0]" [attr.cy]="last[1]" r="2.6" [attr.fill]="color" />
|
|
1876
|
+
</svg>`, isInline: true });
|
|
1877
|
+
}
|
|
1878
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspSparkline, decorators: [{
|
|
1879
|
+
type: Component,
|
|
1880
|
+
args: [{
|
|
1881
|
+
selector: 'vsp-sparkline',
|
|
1882
|
+
template: `<svg
|
|
1883
|
+
[attr.width]="w"
|
|
1884
|
+
[attr.height]="h"
|
|
1885
|
+
[attr.viewBox]="'0 0 ' + w + ' ' + h"
|
|
1886
|
+
style="display: block; overflow: visible"
|
|
1887
|
+
>
|
|
1888
|
+
@if (fill) {
|
|
1889
|
+
<defs>
|
|
1890
|
+
<linearGradient [id]="gid" x1="0" x2="0" y1="0" y2="1">
|
|
1891
|
+
<stop offset="0" [attr.stop-color]="color" stop-opacity="0.28" />
|
|
1892
|
+
<stop offset="1" [attr.stop-color]="color" stop-opacity="0" />
|
|
1893
|
+
</linearGradient>
|
|
1894
|
+
</defs>
|
|
1895
|
+
<path [attr.d]="areaD" [attr.fill]="'url(#' + gid + ')'" />
|
|
1896
|
+
}
|
|
1897
|
+
<path [attr.d]="d" fill="none" [attr.stroke]="color" stroke-width="2" stroke-linecap="round" />
|
|
1898
|
+
<circle [attr.cx]="last[0]" [attr.cy]="last[1]" r="2.6" [attr.fill]="color" />
|
|
1899
|
+
</svg>`,
|
|
1900
|
+
}]
|
|
1901
|
+
}], propDecorators: { data: [{
|
|
1902
|
+
type: Input
|
|
1903
|
+
}], color: [{
|
|
1904
|
+
type: Input
|
|
1905
|
+
}], w: [{
|
|
1906
|
+
type: Input
|
|
1907
|
+
}], h: [{
|
|
1908
|
+
type: Input
|
|
1909
|
+
}], fill: [{
|
|
1910
|
+
type: Input
|
|
1911
|
+
}] } });
|
|
1912
|
+
class VspDonut {
|
|
1913
|
+
data = [];
|
|
1914
|
+
size = 168;
|
|
1915
|
+
thickness = 22;
|
|
1916
|
+
get total() {
|
|
1917
|
+
return this.data.reduce((s, d) => s + d.value, 0) || 1;
|
|
1918
|
+
}
|
|
1919
|
+
get r() {
|
|
1920
|
+
return (this.size - this.thickness) / 2;
|
|
1921
|
+
}
|
|
1922
|
+
get c() {
|
|
1923
|
+
return this.size / 2;
|
|
1924
|
+
}
|
|
1925
|
+
get circ() {
|
|
1926
|
+
return 2 * Math.PI * this.r;
|
|
1927
|
+
}
|
|
1928
|
+
get segs() {
|
|
1929
|
+
let acc = 0;
|
|
1930
|
+
return this.data.map((d) => {
|
|
1931
|
+
const len = (d.value / this.total) * this.circ;
|
|
1932
|
+
const seg = { color: d.color, dash: `${len - 2.5} ${this.circ - len + 2.5}`, offset: -acc };
|
|
1933
|
+
acc += len;
|
|
1934
|
+
return seg;
|
|
1935
|
+
});
|
|
1936
|
+
}
|
|
1937
|
+
pct(v) {
|
|
1938
|
+
return Math.round((v / this.total) * 100);
|
|
1939
|
+
}
|
|
1940
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspDonut, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1941
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspDonut, isStandalone: true, selector: "vsp-donut", inputs: { data: "data", size: "size", thickness: "thickness" }, ngImport: i0, template: `<div style="display: flex; align-items: center; gap: 22px">
|
|
1942
|
+
<svg [attr.width]="size" [attr.height]="size" style="transform: rotate(-90deg); flex-shrink: 0">
|
|
1943
|
+
<circle
|
|
1944
|
+
[attr.cx]="c"
|
|
1945
|
+
[attr.cy]="c"
|
|
1946
|
+
[attr.r]="r"
|
|
1947
|
+
fill="none"
|
|
1948
|
+
stroke="var(--surface-3)"
|
|
1949
|
+
[attr.stroke-width]="thickness"
|
|
1950
|
+
/>
|
|
1951
|
+
@for (s of segs; track $index) {
|
|
1952
|
+
<circle
|
|
1953
|
+
[attr.cx]="c"
|
|
1954
|
+
[attr.cy]="c"
|
|
1955
|
+
[attr.r]="r"
|
|
1956
|
+
fill="none"
|
|
1957
|
+
[attr.stroke]="s.color"
|
|
1958
|
+
[attr.stroke-width]="thickness"
|
|
1959
|
+
[attr.stroke-dasharray]="s.dash"
|
|
1960
|
+
[attr.stroke-dashoffset]="s.offset"
|
|
1961
|
+
stroke-linecap="round"
|
|
1962
|
+
/>
|
|
1963
|
+
}
|
|
1964
|
+
</svg>
|
|
1965
|
+
<div style="display: flex; flex-direction: column; gap: 9px; flex: 1">
|
|
1966
|
+
@for (d of data; track $index) {
|
|
1967
|
+
<div style="display: flex; align-items: center; gap: 9px; font-size: 12.5px">
|
|
1968
|
+
<i
|
|
1969
|
+
[style.background]="d.color"
|
|
1970
|
+
style="width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0"
|
|
1971
|
+
></i>
|
|
1972
|
+
<span style="color: var(--text-dim); flex: 1">{{ d.label }}</span>
|
|
1973
|
+
<span class="mono tnum" style="font-weight: 600">{{ pct(d.value) }}%</span>
|
|
1974
|
+
</div>
|
|
1975
|
+
}
|
|
1976
|
+
</div>
|
|
1977
|
+
</div>`, isInline: true });
|
|
1978
|
+
}
|
|
1979
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspDonut, decorators: [{
|
|
1980
|
+
type: Component,
|
|
1981
|
+
args: [{
|
|
1982
|
+
selector: 'vsp-donut',
|
|
1983
|
+
template: `<div style="display: flex; align-items: center; gap: 22px">
|
|
1984
|
+
<svg [attr.width]="size" [attr.height]="size" style="transform: rotate(-90deg); flex-shrink: 0">
|
|
1985
|
+
<circle
|
|
1986
|
+
[attr.cx]="c"
|
|
1987
|
+
[attr.cy]="c"
|
|
1988
|
+
[attr.r]="r"
|
|
1989
|
+
fill="none"
|
|
1990
|
+
stroke="var(--surface-3)"
|
|
1991
|
+
[attr.stroke-width]="thickness"
|
|
1992
|
+
/>
|
|
1993
|
+
@for (s of segs; track $index) {
|
|
1994
|
+
<circle
|
|
1995
|
+
[attr.cx]="c"
|
|
1996
|
+
[attr.cy]="c"
|
|
1997
|
+
[attr.r]="r"
|
|
1998
|
+
fill="none"
|
|
1999
|
+
[attr.stroke]="s.color"
|
|
2000
|
+
[attr.stroke-width]="thickness"
|
|
2001
|
+
[attr.stroke-dasharray]="s.dash"
|
|
2002
|
+
[attr.stroke-dashoffset]="s.offset"
|
|
2003
|
+
stroke-linecap="round"
|
|
2004
|
+
/>
|
|
2005
|
+
}
|
|
2006
|
+
</svg>
|
|
2007
|
+
<div style="display: flex; flex-direction: column; gap: 9px; flex: 1">
|
|
2008
|
+
@for (d of data; track $index) {
|
|
2009
|
+
<div style="display: flex; align-items: center; gap: 9px; font-size: 12.5px">
|
|
2010
|
+
<i
|
|
2011
|
+
[style.background]="d.color"
|
|
2012
|
+
style="width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0"
|
|
2013
|
+
></i>
|
|
2014
|
+
<span style="color: var(--text-dim); flex: 1">{{ d.label }}</span>
|
|
2015
|
+
<span class="mono tnum" style="font-weight: 600">{{ pct(d.value) }}%</span>
|
|
2016
|
+
</div>
|
|
2017
|
+
}
|
|
2018
|
+
</div>
|
|
2019
|
+
</div>`,
|
|
2020
|
+
}]
|
|
2021
|
+
}], propDecorators: { data: [{
|
|
2022
|
+
type: Input
|
|
2023
|
+
}], size: [{
|
|
2024
|
+
type: Input
|
|
2025
|
+
}], thickness: [{
|
|
2026
|
+
type: Input
|
|
2027
|
+
}] } });
|
|
2028
|
+
class VspStatCard {
|
|
2029
|
+
label;
|
|
2030
|
+
value;
|
|
2031
|
+
delta;
|
|
2032
|
+
deltaDir = 'up';
|
|
2033
|
+
spark;
|
|
2034
|
+
sparkColor = 'var(--accent)';
|
|
2035
|
+
get deltaCls() {
|
|
2036
|
+
return 'badge ' + (this.deltaDir === 'up' ? 'badge-pos' : 'badge-neg');
|
|
2037
|
+
}
|
|
2038
|
+
get arrow() {
|
|
2039
|
+
return this.deltaDir === 'up' ? 'M12 19V5M5 12l7-7 7 7' : 'M12 5v14M5 12l7 7 7-7';
|
|
2040
|
+
}
|
|
2041
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspStatCard, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2042
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspStatCard, isStandalone: true, selector: "vsp-stat-card", inputs: { label: "label", value: "value", delta: "delta", deltaDir: "deltaDir", spark: "spark", sparkColor: "sparkColor" }, ngImport: i0, template: `<div
|
|
2043
|
+
class="card card-pad vsp-rise"
|
|
2044
|
+
style="display: flex; flex-direction: column; gap: 14px"
|
|
2045
|
+
>
|
|
2046
|
+
<div style="display: flex; align-items: center; justify-content: space-between">
|
|
2047
|
+
<div style="display: flex; align-items: center; gap: 10px">
|
|
2048
|
+
<span
|
|
2049
|
+
style="width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: color-mix(in oklab, var(--accent) 13%, transparent); color: var(--accent)"
|
|
2050
|
+
>
|
|
2051
|
+
<ng-content select="[slot=icon]" />
|
|
2052
|
+
</span>
|
|
2053
|
+
<span class="eyebrow">{{ label }}</span>
|
|
2054
|
+
</div>
|
|
2055
|
+
@if (delta != null) {
|
|
2056
|
+
<span [class]="deltaCls">
|
|
2057
|
+
<svg
|
|
2058
|
+
viewBox="0 0 24 24"
|
|
2059
|
+
width="11"
|
|
2060
|
+
height="11"
|
|
2061
|
+
fill="none"
|
|
2062
|
+
stroke="currentColor"
|
|
2063
|
+
stroke-width="2"
|
|
2064
|
+
stroke-linecap="round"
|
|
2065
|
+
stroke-linejoin="round"
|
|
2066
|
+
>
|
|
2067
|
+
<path [attr.d]="arrow" />
|
|
2068
|
+
</svg>
|
|
2069
|
+
{{ delta }}
|
|
2070
|
+
</span>
|
|
2071
|
+
}
|
|
2072
|
+
</div>
|
|
2073
|
+
<div style="display: flex; align-items: flex-end; justify-content: space-between; gap: 12px">
|
|
2074
|
+
<div
|
|
2075
|
+
class="tnum"
|
|
2076
|
+
style="font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1"
|
|
2077
|
+
>
|
|
2078
|
+
{{ value }}
|
|
2079
|
+
</div>
|
|
2080
|
+
@if (spark) {
|
|
2081
|
+
<vsp-sparkline [data]="spark" [color]="sparkColor" />
|
|
2082
|
+
}
|
|
2083
|
+
</div>
|
|
2084
|
+
</div>`, isInline: true, dependencies: [{ kind: "component", type: VspSparkline, selector: "vsp-sparkline", inputs: ["data", "color", "w", "h", "fill"] }] });
|
|
2085
|
+
}
|
|
2086
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspStatCard, decorators: [{
|
|
2087
|
+
type: Component,
|
|
2088
|
+
args: [{
|
|
2089
|
+
selector: 'vsp-stat-card',
|
|
2090
|
+
imports: [VspSparkline],
|
|
2091
|
+
template: `<div
|
|
2092
|
+
class="card card-pad vsp-rise"
|
|
2093
|
+
style="display: flex; flex-direction: column; gap: 14px"
|
|
2094
|
+
>
|
|
2095
|
+
<div style="display: flex; align-items: center; justify-content: space-between">
|
|
2096
|
+
<div style="display: flex; align-items: center; gap: 10px">
|
|
2097
|
+
<span
|
|
2098
|
+
style="width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: color-mix(in oklab, var(--accent) 13%, transparent); color: var(--accent)"
|
|
2099
|
+
>
|
|
2100
|
+
<ng-content select="[slot=icon]" />
|
|
2101
|
+
</span>
|
|
2102
|
+
<span class="eyebrow">{{ label }}</span>
|
|
2103
|
+
</div>
|
|
2104
|
+
@if (delta != null) {
|
|
2105
|
+
<span [class]="deltaCls">
|
|
2106
|
+
<svg
|
|
2107
|
+
viewBox="0 0 24 24"
|
|
2108
|
+
width="11"
|
|
2109
|
+
height="11"
|
|
2110
|
+
fill="none"
|
|
2111
|
+
stroke="currentColor"
|
|
2112
|
+
stroke-width="2"
|
|
2113
|
+
stroke-linecap="round"
|
|
2114
|
+
stroke-linejoin="round"
|
|
2115
|
+
>
|
|
2116
|
+
<path [attr.d]="arrow" />
|
|
2117
|
+
</svg>
|
|
2118
|
+
{{ delta }}
|
|
2119
|
+
</span>
|
|
2120
|
+
}
|
|
2121
|
+
</div>
|
|
2122
|
+
<div style="display: flex; align-items: flex-end; justify-content: space-between; gap: 12px">
|
|
2123
|
+
<div
|
|
2124
|
+
class="tnum"
|
|
2125
|
+
style="font-size: 30px; font-weight: 800; letter-spacing: -0.02em; line-height: 1"
|
|
2126
|
+
>
|
|
2127
|
+
{{ value }}
|
|
2128
|
+
</div>
|
|
2129
|
+
@if (spark) {
|
|
2130
|
+
<vsp-sparkline [data]="spark" [color]="sparkColor" />
|
|
2131
|
+
}
|
|
2132
|
+
</div>
|
|
2133
|
+
</div>`,
|
|
2134
|
+
}]
|
|
2135
|
+
}], propDecorators: { label: [{
|
|
2136
|
+
type: Input
|
|
2137
|
+
}], value: [{
|
|
2138
|
+
type: Input
|
|
2139
|
+
}], delta: [{
|
|
2140
|
+
type: Input
|
|
2141
|
+
}], deltaDir: [{
|
|
2142
|
+
type: Input
|
|
2143
|
+
}], spark: [{
|
|
2144
|
+
type: Input
|
|
2145
|
+
}], sparkColor: [{
|
|
2146
|
+
type: Input
|
|
2147
|
+
}] } });
|
|
2148
|
+
|
|
2149
|
+
class VspNumberStepper {
|
|
2150
|
+
value = 0;
|
|
2151
|
+
valueChange = new EventEmitter();
|
|
2152
|
+
min;
|
|
2153
|
+
max;
|
|
2154
|
+
step = 1;
|
|
2155
|
+
unit;
|
|
2156
|
+
set(v) {
|
|
2157
|
+
let n = v;
|
|
2158
|
+
if (this.min != null && n < this.min)
|
|
2159
|
+
n = this.min;
|
|
2160
|
+
if (this.max != null && n > this.max)
|
|
2161
|
+
n = this.max;
|
|
2162
|
+
this.value = n;
|
|
2163
|
+
this.valueChange.emit(n);
|
|
2164
|
+
}
|
|
2165
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspNumberStepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2166
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspNumberStepper, isStandalone: true, selector: "vsp-number-stepper", inputs: { value: "value", min: "min", max: "max", step: "step", unit: "unit" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: `<div class="ui-stepper">
|
|
2167
|
+
<button
|
|
2168
|
+
type="button"
|
|
2169
|
+
aria-label="Decrease"
|
|
2170
|
+
[disabled]="min != null && value <= min"
|
|
2171
|
+
(click)="set(value - step)"
|
|
2172
|
+
>
|
|
2173
|
+
−
|
|
2174
|
+
</button>
|
|
2175
|
+
<span class="val"
|
|
2176
|
+
>{{ value }}
|
|
2177
|
+
@if (unit) {
|
|
2178
|
+
<i>{{ unit }}</i>
|
|
2179
|
+
}
|
|
2180
|
+
</span>
|
|
2181
|
+
<button
|
|
2182
|
+
type="button"
|
|
2183
|
+
aria-label="Increase"
|
|
2184
|
+
[disabled]="max != null && value >= max"
|
|
2185
|
+
(click)="set(value + step)"
|
|
2186
|
+
>
|
|
2187
|
+
+
|
|
2188
|
+
</button>
|
|
2189
|
+
</div>`, isInline: true });
|
|
2190
|
+
}
|
|
2191
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspNumberStepper, decorators: [{
|
|
2192
|
+
type: Component,
|
|
2193
|
+
args: [{
|
|
2194
|
+
selector: 'vsp-number-stepper',
|
|
2195
|
+
template: `<div class="ui-stepper">
|
|
2196
|
+
<button
|
|
2197
|
+
type="button"
|
|
2198
|
+
aria-label="Decrease"
|
|
2199
|
+
[disabled]="min != null && value <= min"
|
|
2200
|
+
(click)="set(value - step)"
|
|
2201
|
+
>
|
|
2202
|
+
−
|
|
2203
|
+
</button>
|
|
2204
|
+
<span class="val"
|
|
2205
|
+
>{{ value }}
|
|
2206
|
+
@if (unit) {
|
|
2207
|
+
<i>{{ unit }}</i>
|
|
2208
|
+
}
|
|
2209
|
+
</span>
|
|
2210
|
+
<button
|
|
2211
|
+
type="button"
|
|
2212
|
+
aria-label="Increase"
|
|
2213
|
+
[disabled]="max != null && value >= max"
|
|
2214
|
+
(click)="set(value + step)"
|
|
2215
|
+
>
|
|
2216
|
+
+
|
|
2217
|
+
</button>
|
|
2218
|
+
</div>`,
|
|
2219
|
+
}]
|
|
2220
|
+
}], propDecorators: { value: [{
|
|
2221
|
+
type: Input
|
|
2222
|
+
}], valueChange: [{
|
|
2223
|
+
type: Output
|
|
2224
|
+
}], min: [{
|
|
2225
|
+
type: Input
|
|
2226
|
+
}], max: [{
|
|
2227
|
+
type: Input
|
|
2228
|
+
}], step: [{
|
|
2229
|
+
type: Input
|
|
2230
|
+
}], unit: [{
|
|
2231
|
+
type: Input
|
|
2232
|
+
}] } });
|
|
2233
|
+
class VspCopyButton {
|
|
2234
|
+
text = '';
|
|
2235
|
+
label = 'Copy';
|
|
2236
|
+
size = 'sm';
|
|
2237
|
+
done = false;
|
|
2238
|
+
get cls() {
|
|
2239
|
+
return 'btn btn-ghost' + (this.size === 'sm' ? ' btn-sm' : '');
|
|
2240
|
+
}
|
|
2241
|
+
async copy() {
|
|
2242
|
+
try {
|
|
2243
|
+
await navigator.clipboard?.writeText(this.text);
|
|
2244
|
+
}
|
|
2245
|
+
catch {
|
|
2246
|
+
/* clipboard unavailable */
|
|
2247
|
+
}
|
|
2248
|
+
this.done = true;
|
|
2249
|
+
setTimeout(() => (this.done = false), 1400);
|
|
2250
|
+
}
|
|
2251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspCopyButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2252
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspCopyButton, isStandalone: true, selector: "vsp-copy-button", inputs: { text: "text", label: "label", size: "size" }, ngImport: i0, template: `<button type="button" [class]="cls" (click)="copy()">
|
|
2253
|
+
@if (done) {
|
|
2254
|
+
<span style="color: var(--success); display: inline-flex">
|
|
2255
|
+
<svg
|
|
2256
|
+
viewBox="0 0 24 24"
|
|
2257
|
+
width="15"
|
|
2258
|
+
height="15"
|
|
2259
|
+
fill="none"
|
|
2260
|
+
stroke="currentColor"
|
|
2261
|
+
stroke-width="2"
|
|
2262
|
+
stroke-linecap="round"
|
|
2263
|
+
stroke-linejoin="round"
|
|
2264
|
+
>
|
|
2265
|
+
<path d="M20 6L9 17l-5-5" />
|
|
2266
|
+
</svg> </span
|
|
2267
|
+
>Copied
|
|
2268
|
+
} @else {
|
|
2269
|
+
<svg
|
|
2270
|
+
viewBox="0 0 24 24"
|
|
2271
|
+
width="15"
|
|
2272
|
+
height="15"
|
|
2273
|
+
fill="none"
|
|
2274
|
+
stroke="currentColor"
|
|
2275
|
+
stroke-width="2"
|
|
2276
|
+
stroke-linecap="round"
|
|
2277
|
+
stroke-linejoin="round"
|
|
2278
|
+
>
|
|
2279
|
+
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6" />
|
|
2280
|
+
</svg>
|
|
2281
|
+
{{ label }}
|
|
2282
|
+
}
|
|
2283
|
+
</button>`, isInline: true });
|
|
2284
|
+
}
|
|
2285
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspCopyButton, decorators: [{
|
|
2286
|
+
type: Component,
|
|
2287
|
+
args: [{
|
|
2288
|
+
selector: 'vsp-copy-button',
|
|
2289
|
+
template: `<button type="button" [class]="cls" (click)="copy()">
|
|
2290
|
+
@if (done) {
|
|
2291
|
+
<span style="color: var(--success); display: inline-flex">
|
|
2292
|
+
<svg
|
|
2293
|
+
viewBox="0 0 24 24"
|
|
2294
|
+
width="15"
|
|
2295
|
+
height="15"
|
|
2296
|
+
fill="none"
|
|
2297
|
+
stroke="currentColor"
|
|
2298
|
+
stroke-width="2"
|
|
2299
|
+
stroke-linecap="round"
|
|
2300
|
+
stroke-linejoin="round"
|
|
2301
|
+
>
|
|
2302
|
+
<path d="M20 6L9 17l-5-5" />
|
|
2303
|
+
</svg> </span
|
|
2304
|
+
>Copied
|
|
2305
|
+
} @else {
|
|
2306
|
+
<svg
|
|
2307
|
+
viewBox="0 0 24 24"
|
|
2308
|
+
width="15"
|
|
2309
|
+
height="15"
|
|
2310
|
+
fill="none"
|
|
2311
|
+
stroke="currentColor"
|
|
2312
|
+
stroke-width="2"
|
|
2313
|
+
stroke-linecap="round"
|
|
2314
|
+
stroke-linejoin="round"
|
|
2315
|
+
>
|
|
2316
|
+
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8zM14 2v6h6" />
|
|
2317
|
+
</svg>
|
|
2318
|
+
{{ label }}
|
|
2319
|
+
}
|
|
2320
|
+
</button>`,
|
|
2321
|
+
}]
|
|
2322
|
+
}], propDecorators: { text: [{
|
|
2323
|
+
type: Input
|
|
2324
|
+
}], label: [{
|
|
2325
|
+
type: Input
|
|
2326
|
+
}], size: [{
|
|
2327
|
+
type: Input
|
|
2328
|
+
}] } });
|
|
2329
|
+
class VspInlineEdit {
|
|
2330
|
+
value = '';
|
|
2331
|
+
placeholder = 'Empty';
|
|
2332
|
+
save = new EventEmitter();
|
|
2333
|
+
editing = false;
|
|
2334
|
+
draft = '';
|
|
2335
|
+
start() {
|
|
2336
|
+
this.draft = this.value;
|
|
2337
|
+
this.editing = true;
|
|
2338
|
+
}
|
|
2339
|
+
commit() {
|
|
2340
|
+
this.editing = false;
|
|
2341
|
+
if (this.draft !== this.value)
|
|
2342
|
+
this.save.emit(this.draft);
|
|
2343
|
+
}
|
|
2344
|
+
cancel() {
|
|
2345
|
+
this.draft = this.value;
|
|
2346
|
+
this.editing = false;
|
|
2347
|
+
}
|
|
2348
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspInlineEdit, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: VspInlineEdit, isStandalone: true, selector: "vsp-inline-edit", inputs: { value: "value", placeholder: "placeholder" }, outputs: { save: "save" }, ngImport: i0, template: `@if (editing) {
|
|
2350
|
+
<input
|
|
2351
|
+
#inp
|
|
2352
|
+
autofocus
|
|
2353
|
+
class="ui-input"
|
|
2354
|
+
[value]="draft"
|
|
2355
|
+
style="height: 32px; max-width: 240px"
|
|
2356
|
+
(input)="draft = inp.value"
|
|
2357
|
+
(blur)="commit()"
|
|
2358
|
+
(keydown.enter)="commit()"
|
|
2359
|
+
(keydown.escape)="cancel()"
|
|
2360
|
+
/>
|
|
2361
|
+
} @else {
|
|
2362
|
+
<span
|
|
2363
|
+
class="ui-inline"
|
|
2364
|
+
role="button"
|
|
2365
|
+
tabindex="0"
|
|
2366
|
+
(click)="start()"
|
|
2367
|
+
(keydown.enter)="start()"
|
|
2368
|
+
>
|
|
2369
|
+
<span [style.color]="value ? 'var(--text)' : 'var(--text-faint)'">{{
|
|
2370
|
+
value || placeholder
|
|
2371
|
+
}}</span>
|
|
2372
|
+
<span class="pen" style="display: inline-flex">
|
|
2373
|
+
<svg
|
|
2374
|
+
viewBox="0 0 24 24"
|
|
2375
|
+
width="14"
|
|
2376
|
+
height="14"
|
|
2377
|
+
fill="none"
|
|
2378
|
+
stroke="currentColor"
|
|
2379
|
+
stroke-width="2"
|
|
2380
|
+
stroke-linecap="round"
|
|
2381
|
+
stroke-linejoin="round"
|
|
2382
|
+
>
|
|
2383
|
+
<path d="M12 20h9M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4z" />
|
|
2384
|
+
</svg>
|
|
2385
|
+
</span>
|
|
2386
|
+
</span>
|
|
2387
|
+
}`, isInline: true });
|
|
2388
|
+
}
|
|
2389
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: VspInlineEdit, decorators: [{
|
|
2390
|
+
type: Component,
|
|
2391
|
+
args: [{
|
|
2392
|
+
selector: 'vsp-inline-edit',
|
|
2393
|
+
template: `@if (editing) {
|
|
2394
|
+
<input
|
|
2395
|
+
#inp
|
|
2396
|
+
autofocus
|
|
2397
|
+
class="ui-input"
|
|
2398
|
+
[value]="draft"
|
|
2399
|
+
style="height: 32px; max-width: 240px"
|
|
2400
|
+
(input)="draft = inp.value"
|
|
2401
|
+
(blur)="commit()"
|
|
2402
|
+
(keydown.enter)="commit()"
|
|
2403
|
+
(keydown.escape)="cancel()"
|
|
2404
|
+
/>
|
|
2405
|
+
} @else {
|
|
2406
|
+
<span
|
|
2407
|
+
class="ui-inline"
|
|
2408
|
+
role="button"
|
|
2409
|
+
tabindex="0"
|
|
2410
|
+
(click)="start()"
|
|
2411
|
+
(keydown.enter)="start()"
|
|
2412
|
+
>
|
|
2413
|
+
<span [style.color]="value ? 'var(--text)' : 'var(--text-faint)'">{{
|
|
2414
|
+
value || placeholder
|
|
2415
|
+
}}</span>
|
|
2416
|
+
<span class="pen" style="display: inline-flex">
|
|
2417
|
+
<svg
|
|
2418
|
+
viewBox="0 0 24 24"
|
|
2419
|
+
width="14"
|
|
2420
|
+
height="14"
|
|
2421
|
+
fill="none"
|
|
2422
|
+
stroke="currentColor"
|
|
2423
|
+
stroke-width="2"
|
|
2424
|
+
stroke-linecap="round"
|
|
2425
|
+
stroke-linejoin="round"
|
|
2426
|
+
>
|
|
2427
|
+
<path d="M12 20h9M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4z" />
|
|
2428
|
+
</svg>
|
|
2429
|
+
</span>
|
|
2430
|
+
</span>
|
|
2431
|
+
}`,
|
|
2432
|
+
}]
|
|
2433
|
+
}], propDecorators: { value: [{
|
|
2434
|
+
type: Input
|
|
2435
|
+
}], placeholder: [{
|
|
2436
|
+
type: Input
|
|
2437
|
+
}], save: [{
|
|
2438
|
+
type: Output
|
|
2439
|
+
}] } });
|
|
2440
|
+
|
|
1820
2441
|
/**
|
|
1821
2442
|
* Generated bundle index. Do not edit.
|
|
1822
2443
|
*/
|
|
1823
2444
|
|
|
1824
|
-
export { VspAccordion, VspAlert, VspAvatar, VspAvatarGroup, VspBadge, VspBanner, VspBreadcrumb, VspButton, VspCard, VspCardHead, VspCheckbox, VspCircularProgress, VspDescriptionList, VspDivider, VspEmptyState, VspField, VspIconButton, VspInput, VspKbd, VspNativeSelect, VspPagination, VspProgress, VspRadio, VspRadioGroup, VspSegmented, VspSkeleton, VspSlider, VspSpinner, VspStat, VspStepper, VspSwitch, VspTabs, VspTag, VspTextarea, VspTimeline };
|
|
2445
|
+
export { VspAccordion, VspAlert, VspAvatar, VspAvatarGroup, VspBadge, VspBanner, VspBreadcrumb, VspButton, VspCard, VspCardHead, VspCheckbox, VspCircularProgress, VspCopyButton, VspDescriptionList, VspDivider, VspDonut, VspEmptyState, VspField, VspIconButton, VspInlineEdit, VspInput, VspKbd, VspNativeSelect, VspNumberStepper, VspPagination, VspProgress, VspRadio, VspRadioGroup, VspSegmented, VspSkeleton, VspSlider, VspSparkline, VspSpinner, VspStat, VspStatCard, VspStepper, VspSwitch, VspTabs, VspTag, VspTextarea, VspTimeline };
|
|
1825
2446
|
//# sourceMappingURL=vespera-ui-angular.mjs.map
|