@joanroucoux/cairn-ui 0.8.2 → 0.9.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/CHANGELOG.md +114 -0
- package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs +57 -53
- package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-alert.mjs +155 -47
- package/fesm2022/joanroucoux-cairn-ui-alert.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-amount.mjs +220 -110
- package/fesm2022/joanroucoux-cairn-ui-amount.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-async.mjs +392 -216
- package/fesm2022/joanroucoux-cairn-ui-async.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-avatar.mjs +145 -68
- package/fesm2022/joanroucoux-cairn-ui-avatar.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-back-link.mjs +87 -47
- package/fesm2022/joanroucoux-cairn-ui-back-link.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-badge.mjs +83 -43
- package/fesm2022/joanroucoux-cairn-ui-badge.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-button.mjs +184 -104
- package/fesm2022/joanroucoux-cairn-ui-button.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-card.mjs +232 -137
- package/fesm2022/joanroucoux-cairn-ui-card.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs +298 -102
- package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-control.mjs +4 -17
- package/fesm2022/joanroucoux-cairn-ui-control.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-delta.mjs +150 -83
- package/fesm2022/joanroucoux-cairn-ui-delta.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-dialog.mjs +508 -471
- package/fesm2022/joanroucoux-cairn-ui-dialog.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-donut.mjs +255 -157
- package/fesm2022/joanroucoux-cairn-ui-donut.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-drawer.mjs +303 -0
- package/fesm2022/joanroucoux-cairn-ui-drawer.mjs.map +1 -0
- package/fesm2022/joanroucoux-cairn-ui-empty.mjs +76 -35
- package/fesm2022/joanroucoux-cairn-ui-empty.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-external-link.mjs +40 -31
- package/fesm2022/joanroucoux-cairn-ui-external-link.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-fact.mjs +188 -79
- package/fesm2022/joanroucoux-cairn-ui-fact.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-field.mjs +309 -173
- package/fesm2022/joanroucoux-cairn-ui-field.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs +165 -87
- package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-group-header.mjs +269 -0
- package/fesm2022/joanroucoux-cairn-ui-group-header.mjs.map +1 -0
- package/fesm2022/joanroucoux-cairn-ui-input.mjs +205 -85
- package/fesm2022/joanroucoux-cairn-ui-input.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs +838 -512
- package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-menu.mjs +401 -225
- package/fesm2022/joanroucoux-cairn-ui-menu.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-meter.mjs +143 -57
- package/fesm2022/joanroucoux-cairn-ui-meter.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-motion.mjs +367 -399
- package/fesm2022/joanroucoux-cairn-ui-motion.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs +73 -44
- package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-result-group.mjs +191 -0
- package/fesm2022/joanroucoux-cairn-ui-result-group.mjs.map +1 -0
- package/fesm2022/joanroucoux-cairn-ui-row.mjs +408 -146
- package/fesm2022/joanroucoux-cairn-ui-row.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-segmented.mjs +183 -81
- package/fesm2022/joanroucoux-cairn-ui-segmented.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs +270 -0
- package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs.map +1 -0
- package/fesm2022/joanroucoux-cairn-ui-select.mjs +121 -67
- package/fesm2022/joanroucoux-cairn-ui-select.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs +129 -51
- package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs +80 -39
- package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-stat.mjs +85 -55
- package/fesm2022/joanroucoux-cairn-ui-stat.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-switch.mjs +48 -35
- package/fesm2022/joanroucoux-cairn-ui-switch.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs +113 -69
- package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-table.mjs +1036 -310
- package/fesm2022/joanroucoux-cairn-ui-table.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui-toast.mjs +240 -127
- package/fesm2022/joanroucoux-cairn-ui-toast.mjs.map +1 -1
- package/fesm2022/joanroucoux-cairn-ui.mjs +0 -4
- package/package.json +17 -1
- package/styles/motion.css +1 -13
- package/styles/tokens.css +35 -64
- package/types/joanroucoux-cairn-ui-action-bar.d.ts +9 -14
- package/types/joanroucoux-cairn-ui-alert.d.ts +29 -15
- package/types/joanroucoux-cairn-ui-amount.d.ts +64 -32
- package/types/joanroucoux-cairn-ui-async.d.ts +85 -38
- package/types/joanroucoux-cairn-ui-avatar.d.ts +34 -22
- package/types/joanroucoux-cairn-ui-back-link.d.ts +20 -15
- package/types/joanroucoux-cairn-ui-badge.d.ts +22 -14
- package/types/joanroucoux-cairn-ui-button.d.ts +36 -18
- package/types/joanroucoux-cairn-ui-card.d.ts +48 -23
- package/types/joanroucoux-cairn-ui-choice-chips.d.ts +91 -35
- package/types/joanroucoux-cairn-ui-control.d.ts +9 -18
- package/types/joanroucoux-cairn-ui-delta.d.ts +46 -24
- package/types/joanroucoux-cairn-ui-dialog.d.ts +124 -57
- package/types/joanroucoux-cairn-ui-donut.d.ts +83 -46
- package/types/joanroucoux-cairn-ui-drawer.d.ts +73 -0
- package/types/joanroucoux-cairn-ui-empty.d.ts +20 -13
- package/types/joanroucoux-cairn-ui-external-link.d.ts +6 -10
- package/types/joanroucoux-cairn-ui-fact.d.ts +49 -25
- package/types/joanroucoux-cairn-ui-field.d.ts +72 -49
- package/types/joanroucoux-cairn-ui-filter-chips.d.ts +35 -20
- package/types/joanroucoux-cairn-ui-group-header.d.ts +58 -0
- package/types/joanroucoux-cairn-ui-input.d.ts +59 -37
- package/types/joanroucoux-cairn-ui-line-chart.d.ts +199 -89
- package/types/joanroucoux-cairn-ui-menu.d.ts +81 -44
- package/types/joanroucoux-cairn-ui-meter.d.ts +44 -22
- package/types/joanroucoux-cairn-ui-motion.d.ts +61 -75
- package/types/joanroucoux-cairn-ui-nav-item.d.ts +15 -13
- package/types/joanroucoux-cairn-ui-result-group.d.ts +52 -0
- package/types/joanroucoux-cairn-ui-row.d.ts +92 -37
- package/types/joanroucoux-cairn-ui-segmented.d.ts +51 -27
- package/types/joanroucoux-cairn-ui-select-pill.d.ts +59 -0
- package/types/joanroucoux-cairn-ui-select.d.ts +28 -18
- package/types/joanroucoux-cairn-ui-skeleton.d.ts +35 -18
- package/types/joanroucoux-cairn-ui-stale-link.d.ts +23 -16
- package/types/joanroucoux-cairn-ui-stat.d.ts +26 -21
- package/types/joanroucoux-cairn-ui-switch.d.ts +7 -11
- package/types/joanroucoux-cairn-ui-tab-bar.d.ts +20 -17
- package/types/joanroucoux-cairn-ui-table.d.ts +251 -89
- package/types/joanroucoux-cairn-ui-toast.d.ts +46 -36
- package/types/joanroucoux-cairn-ui.d.ts +1 -2
- package/fesm2022/joanroucoux-cairn-ui.mjs.map +0 -1
|
@@ -1,179 +1,268 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import { holdTransitionsUntilRendered } from
|
|
4
|
-
|
|
5
|
-
const SKELETON_DELAY_MS = 150;
|
|
6
|
-
const SKELETON_MIN_MS = 400;
|
|
7
|
-
/**
|
|
8
|
-
* Turns the live state of a call into the state to draw: `loading` only appears once the call has
|
|
9
|
-
* lasted 150 ms and, once shown, stays at least 400 ms, so a fast call never flashes a skeleton and a
|
|
10
|
-
* slow one never blinks. Until then the previous state stays on screen (a reload keeps its content);
|
|
11
|
-
* `null` means nothing to draw yet, for a first load still under 150 ms. Call it in an injection context.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* protected readonly shown = delayedState(this.state);
|
|
15
|
-
*/
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Component, DestroyRef, booleanAttribute, computed, effect, inject, input, output, signal, untracked } from "@angular/core";
|
|
3
|
+
import { holdTransitionsUntilRendered } from "@joanroucoux/cairn-ui/motion";
|
|
16
4
|
function delayedState(source) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
displayed.set(untracked(source));
|
|
48
|
-
}, remaining);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
displayed.set(state);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
return displayed.asReadonly();
|
|
5
|
+
const displayed = signal(null, ...ngDevMode ? [{ debugName: "displayed" }] : /* istanbul ignore next */ []);
|
|
6
|
+
let timer;
|
|
7
|
+
let shownAt = 0;
|
|
8
|
+
const clear = () => {
|
|
9
|
+
clearTimeout(timer);
|
|
10
|
+
timer = void 0;
|
|
11
|
+
};
|
|
12
|
+
inject(DestroyRef).onDestroy(clear);
|
|
13
|
+
effect(() => {
|
|
14
|
+
const state = source();
|
|
15
|
+
untracked(() => {
|
|
16
|
+
if (state === "loading") {
|
|
17
|
+
if (displayed() === "loading") clear();
|
|
18
|
+
else timer = setTimeout(() => {
|
|
19
|
+
timer = void 0;
|
|
20
|
+
shownAt = Date.now();
|
|
21
|
+
displayed.set("loading");
|
|
22
|
+
}, 150);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
clear();
|
|
26
|
+
const remaining = shownAt + 400 - Date.now();
|
|
27
|
+
if (displayed() === "loading" && remaining > 0) timer = setTimeout(() => {
|
|
28
|
+
timer = void 0;
|
|
29
|
+
displayed.set(untracked(source));
|
|
30
|
+
}, remaining);
|
|
31
|
+
else displayed.set(state);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
return displayed.asReadonly();
|
|
56
35
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
36
|
+
const ASYNC_STATES = [
|
|
37
|
+
"loading",
|
|
38
|
+
"error",
|
|
39
|
+
"empty",
|
|
40
|
+
"ready"
|
|
41
|
+
];
|
|
42
|
+
const ASYNC_VARIANTS = [
|
|
43
|
+
"elevated",
|
|
44
|
+
"plain",
|
|
45
|
+
"emphasis",
|
|
46
|
+
"inline"
|
|
47
|
+
];
|
|
48
|
+
const ASYNC_ALIGNS = [
|
|
49
|
+
"start",
|
|
50
|
+
"center",
|
|
51
|
+
"auto"
|
|
52
|
+
];
|
|
53
|
+
const RETRY_BASE_CLASSES = "relative inline-flex items-center justify-center rounded-control font-medium whitespace-nowrap cursor-pointer select-none touch-manipulation transition-[scale,background-color] [transition-duration:var(--duration-press),var(--duration-fast)] ease-out active:scale-(--press-scale) focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--ring) text-label";
|
|
54
|
+
const RETRY_OUTLINE_CLASSES = "bg-(--card) text-(--foreground) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow)";
|
|
55
|
+
const RETRY_PRIMARY_CLASSES = "bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)";
|
|
56
|
+
const RETRY_BLOCK_CLASSES = "min-h-(--row-min) gap-2 pl-3 pr-4";
|
|
57
|
+
const RETRY_INLINE_CLASSES = "h-11 pointer-fine:h-8 flex-none";
|
|
58
|
+
const RETRY_INLINE_ICON_CLASSES = "gap-1.5 pl-2.5 pr-3";
|
|
59
|
+
const RETRY_INLINE_TEXT_CLASSES = "px-3";
|
|
60
|
+
const ELEVATED_SURFACE_CLASSES = "rounded-control bg-(--elevated)";
|
|
61
|
+
const CARD_SURFACE_CLASSES = "rounded-container bg-(--card) shadow-[inset_0_0_0_1px_var(--border)]";
|
|
71
62
|
const BLOCK_SPECS = {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
63
|
+
elevated: {
|
|
64
|
+
surface: ELEVATED_SURFACE_CLASSES,
|
|
65
|
+
gap: "gap-1",
|
|
66
|
+
padding: {
|
|
67
|
+
start: "p-4",
|
|
68
|
+
center: "px-4 py-10",
|
|
69
|
+
auto: "p-4 lg:py-10"
|
|
70
|
+
},
|
|
71
|
+
title: "text-body font-medium",
|
|
72
|
+
message: {
|
|
73
|
+
start: "text-label",
|
|
74
|
+
center: "text-label",
|
|
75
|
+
auto: "text-label"
|
|
76
|
+
},
|
|
77
|
+
retryMargin: {
|
|
78
|
+
start: "mt-2",
|
|
79
|
+
center: "mt-2",
|
|
80
|
+
auto: "mt-2"
|
|
81
|
+
},
|
|
82
|
+
retry: RETRY_OUTLINE_CLASSES
|
|
83
|
+
},
|
|
84
|
+
plain: {
|
|
85
|
+
surface: "",
|
|
86
|
+
gap: "gap-1",
|
|
87
|
+
padding: {
|
|
88
|
+
start: "px-4 py-5",
|
|
89
|
+
center: "px-4 py-12",
|
|
90
|
+
auto: "px-4 py-5 lg:py-12"
|
|
91
|
+
},
|
|
92
|
+
title: "text-body leading-[normal] font-medium",
|
|
93
|
+
message: {
|
|
94
|
+
start: "text-label leading-[normal]",
|
|
95
|
+
center: "text-label leading-[normal]",
|
|
96
|
+
auto: "text-label leading-[normal]"
|
|
97
|
+
},
|
|
98
|
+
retryMargin: {
|
|
99
|
+
start: "mt-2",
|
|
100
|
+
center: "mt-2",
|
|
101
|
+
auto: "mt-2"
|
|
102
|
+
},
|
|
103
|
+
retry: RETRY_OUTLINE_CLASSES
|
|
104
|
+
},
|
|
105
|
+
emphasis: {
|
|
106
|
+
surface: "",
|
|
107
|
+
gap: "gap-3",
|
|
108
|
+
padding: {
|
|
109
|
+
start: "px-4 py-6",
|
|
110
|
+
center: "px-4 py-14",
|
|
111
|
+
auto: "px-4 py-6 lg:py-14"
|
|
112
|
+
},
|
|
113
|
+
title: "text-title font-semibold",
|
|
114
|
+
message: {
|
|
115
|
+
start: "text-label",
|
|
116
|
+
center: "text-body leading-[normal]",
|
|
117
|
+
auto: "text-label lg:text-body lg:leading-[normal]"
|
|
118
|
+
},
|
|
119
|
+
retryMargin: {
|
|
120
|
+
start: "mt-1",
|
|
121
|
+
center: "mt-2",
|
|
122
|
+
auto: "mt-1 lg:mt-2"
|
|
123
|
+
},
|
|
124
|
+
retry: RETRY_PRIMARY_CLASSES
|
|
125
|
+
}
|
|
107
126
|
};
|
|
108
127
|
const ALIGN_CLASSES = {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
128
|
+
start: "items-start",
|
|
129
|
+
center: "items-center text-center",
|
|
130
|
+
auto: "items-start lg:items-center lg:text-center"
|
|
112
131
|
};
|
|
113
|
-
const INLINE_BOX_CLASSES =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
132
|
+
const INLINE_BOX_CLASSES = "flex-row items-center justify-between gap-3 pt-1.5 pr-1.5 pb-2 pl-2.5";
|
|
133
|
+
var UiAsync = class UiAsync {
|
|
134
|
+
state = input.required(...ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []);
|
|
135
|
+
errorTitle = input(...ngDevMode ? [void 0, { debugName: "errorTitle" }] : /* istanbul ignore next */ []);
|
|
136
|
+
errorMessage = input(...ngDevMode ? [void 0, { debugName: "errorMessage" }] : /* istanbul ignore next */ []);
|
|
137
|
+
retryLabel = input(...ngDevMode ? [void 0, { debugName: "retryLabel" }] : /* istanbul ignore next */ []);
|
|
138
|
+
retryIcon = input(true, {
|
|
139
|
+
...ngDevMode ? { debugName: "retryIcon" } : /* istanbul ignore next */ {},
|
|
140
|
+
transform: booleanAttribute
|
|
141
|
+
});
|
|
142
|
+
variant = input("elevated", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
143
|
+
align = input("start", ...ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []);
|
|
144
|
+
card = input(false, {
|
|
145
|
+
...ngDevMode ? { debugName: "card" } : /* istanbul ignore next */ {},
|
|
146
|
+
transform: booleanAttribute
|
|
147
|
+
});
|
|
148
|
+
fill = input(false, {
|
|
149
|
+
...ngDevMode ? { debugName: "fill" } : /* istanbul ignore next */ {},
|
|
150
|
+
transform: booleanAttribute
|
|
151
|
+
});
|
|
152
|
+
retry = output();
|
|
153
|
+
shown = delayedState(this.state);
|
|
154
|
+
filling = computed(() => this.fill() && this.shown() === "error", ...ngDevMode ? [{ debugName: "filling" }] : /* istanbul ignore next */ []);
|
|
155
|
+
iconSize = computed(() => this.variant() === "inline" ? 16 : 18, ...ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []);
|
|
156
|
+
#spec = computed(() => {
|
|
157
|
+
const variant = this.variant();
|
|
158
|
+
return variant === "inline" ? null : BLOCK_SPECS[variant];
|
|
159
|
+
}, ...ngDevMode ? [{ debugName: "#spec" }] : /* istanbul ignore next */ []);
|
|
160
|
+
boxClasses = computed(() => {
|
|
161
|
+
const spec = this.#spec();
|
|
162
|
+
const fill = this.fill() ? " flex-1 justify-center" : "";
|
|
163
|
+
if (spec === null) return `flex ${INLINE_BOX_CLASSES}${this.card() ? ` ${CARD_SURFACE_CLASSES}` : ""}${this.fill() ? " flex-1" : ""}`;
|
|
164
|
+
return `flex flex-col ${this.card() ? CARD_SURFACE_CLASSES : spec.surface} ${spec.gap} ${ALIGN_CLASSES[this.align()]} ${spec.padding[this.align()]}${fill}`;
|
|
165
|
+
}, ...ngDevMode ? [{ debugName: "boxClasses" }] : /* istanbul ignore next */ []);
|
|
166
|
+
titleClasses = computed(() => this.#spec().title, ...ngDevMode ? [{ debugName: "titleClasses" }] : /* istanbul ignore next */ []);
|
|
167
|
+
messageClasses = computed(() => this.#spec().message[this.align()], ...ngDevMode ? [{ debugName: "messageClasses" }] : /* istanbul ignore next */ []);
|
|
168
|
+
retryButtonClasses = computed(() => {
|
|
169
|
+
const spec = this.#spec();
|
|
170
|
+
if (spec === null) {
|
|
171
|
+
const spacing = this.retryIcon() ? RETRY_INLINE_ICON_CLASSES : RETRY_INLINE_TEXT_CLASSES;
|
|
172
|
+
return `${RETRY_BASE_CLASSES} ${RETRY_OUTLINE_CLASSES} ${RETRY_INLINE_CLASSES} ${spacing}`;
|
|
173
|
+
}
|
|
174
|
+
return `${RETRY_BASE_CLASSES} ${spec.retry} ${RETRY_BLOCK_CLASSES} ${spec.retryMargin[this.align()]}`;
|
|
175
|
+
}, ...ngDevMode ? [{ debugName: "retryButtonClasses" }] : /* istanbul ignore next */ []);
|
|
176
|
+
constructor() {
|
|
177
|
+
holdTransitionsUntilRendered();
|
|
178
|
+
}
|
|
179
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
180
|
+
minVersion: "12.0.0",
|
|
181
|
+
version: "22.2.0",
|
|
182
|
+
ngImport: i0,
|
|
183
|
+
type: UiAsync,
|
|
184
|
+
deps: [],
|
|
185
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
186
|
+
});
|
|
187
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
188
|
+
minVersion: "17.0.0",
|
|
189
|
+
version: "22.2.0",
|
|
190
|
+
type: UiAsync,
|
|
191
|
+
isStandalone: true,
|
|
192
|
+
selector: "ui-async",
|
|
193
|
+
inputs: {
|
|
194
|
+
state: {
|
|
195
|
+
classPropertyName: "state",
|
|
196
|
+
publicName: "state",
|
|
197
|
+
isSignal: true,
|
|
198
|
+
isRequired: true,
|
|
199
|
+
transformFunction: null
|
|
200
|
+
},
|
|
201
|
+
errorTitle: {
|
|
202
|
+
classPropertyName: "errorTitle",
|
|
203
|
+
publicName: "errorTitle",
|
|
204
|
+
isSignal: true,
|
|
205
|
+
isRequired: false,
|
|
206
|
+
transformFunction: null
|
|
207
|
+
},
|
|
208
|
+
errorMessage: {
|
|
209
|
+
classPropertyName: "errorMessage",
|
|
210
|
+
publicName: "errorMessage",
|
|
211
|
+
isSignal: true,
|
|
212
|
+
isRequired: false,
|
|
213
|
+
transformFunction: null
|
|
214
|
+
},
|
|
215
|
+
retryLabel: {
|
|
216
|
+
classPropertyName: "retryLabel",
|
|
217
|
+
publicName: "retryLabel",
|
|
218
|
+
isSignal: true,
|
|
219
|
+
isRequired: false,
|
|
220
|
+
transformFunction: null
|
|
221
|
+
},
|
|
222
|
+
retryIcon: {
|
|
223
|
+
classPropertyName: "retryIcon",
|
|
224
|
+
publicName: "retryIcon",
|
|
225
|
+
isSignal: true,
|
|
226
|
+
isRequired: false,
|
|
227
|
+
transformFunction: null
|
|
228
|
+
},
|
|
229
|
+
variant: {
|
|
230
|
+
classPropertyName: "variant",
|
|
231
|
+
publicName: "variant",
|
|
232
|
+
isSignal: true,
|
|
233
|
+
isRequired: false,
|
|
234
|
+
transformFunction: null
|
|
235
|
+
},
|
|
236
|
+
align: {
|
|
237
|
+
classPropertyName: "align",
|
|
238
|
+
publicName: "align",
|
|
239
|
+
isSignal: true,
|
|
240
|
+
isRequired: false,
|
|
241
|
+
transformFunction: null
|
|
242
|
+
},
|
|
243
|
+
card: {
|
|
244
|
+
classPropertyName: "card",
|
|
245
|
+
publicName: "card",
|
|
246
|
+
isSignal: true,
|
|
247
|
+
isRequired: false,
|
|
248
|
+
transformFunction: null
|
|
249
|
+
},
|
|
250
|
+
fill: {
|
|
251
|
+
classPropertyName: "fill",
|
|
252
|
+
publicName: "fill",
|
|
253
|
+
isSignal: true,
|
|
254
|
+
isRequired: false,
|
|
255
|
+
transformFunction: null
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
outputs: { retry: "retry" },
|
|
259
|
+
host: { properties: {
|
|
260
|
+
"attr.aria-busy": "state() === 'loading' || null",
|
|
261
|
+
"class.flex": "filling()",
|
|
262
|
+
"class.flex-col": "filling()"
|
|
263
|
+
} },
|
|
264
|
+
ngImport: i0,
|
|
265
|
+
template: `
|
|
177
266
|
@switch (shown()) {
|
|
178
267
|
@case (null) {}
|
|
179
268
|
@case ('loading') {
|
|
@@ -192,19 +281,21 @@ class UiAsync {
|
|
|
192
281
|
<span class="text-(--muted-foreground)" [class]="messageClasses()">{{ errorMessage() }}</span>
|
|
193
282
|
}
|
|
194
283
|
<button type="button" [class]="retryButtonClasses()" (click)="retry.emit()">
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
284
|
+
@if (retryIcon() || variant() !== 'inline') {
|
|
285
|
+
<svg
|
|
286
|
+
aria-hidden="true"
|
|
287
|
+
class="block flex-none fill-none stroke-current"
|
|
288
|
+
stroke-linecap="round"
|
|
289
|
+
stroke-linejoin="round"
|
|
290
|
+
stroke-width="1.75"
|
|
291
|
+
viewBox="0 0 24 24"
|
|
292
|
+
[attr.height]="iconSize()"
|
|
293
|
+
[attr.width]="iconSize()"
|
|
294
|
+
>
|
|
295
|
+
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
|
|
296
|
+
<path d="M21 3v5h-5" />
|
|
297
|
+
</svg>
|
|
298
|
+
}
|
|
208
299
|
{{ retryLabel() }}
|
|
209
300
|
</button>
|
|
210
301
|
</div>
|
|
@@ -216,13 +307,20 @@ class UiAsync {
|
|
|
216
307
|
<ng-content />
|
|
217
308
|
}
|
|
218
309
|
}
|
|
219
|
-
`,
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
310
|
+
`,
|
|
311
|
+
isInline: true
|
|
312
|
+
});
|
|
313
|
+
};
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
315
|
+
minVersion: "12.0.0",
|
|
316
|
+
version: "22.2.0",
|
|
317
|
+
ngImport: i0,
|
|
318
|
+
type: UiAsync,
|
|
319
|
+
decorators: [{
|
|
320
|
+
type: Component,
|
|
321
|
+
args: [{
|
|
322
|
+
selector: "ui-async",
|
|
323
|
+
template: `
|
|
226
324
|
@switch (shown()) {
|
|
227
325
|
@case (null) {}
|
|
228
326
|
@case ('loading') {
|
|
@@ -241,19 +339,21 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
241
339
|
<span class="text-(--muted-foreground)" [class]="messageClasses()">{{ errorMessage() }}</span>
|
|
242
340
|
}
|
|
243
341
|
<button type="button" [class]="retryButtonClasses()" (click)="retry.emit()">
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
342
|
+
@if (retryIcon() || variant() !== 'inline') {
|
|
343
|
+
<svg
|
|
344
|
+
aria-hidden="true"
|
|
345
|
+
class="block flex-none fill-none stroke-current"
|
|
346
|
+
stroke-linecap="round"
|
|
347
|
+
stroke-linejoin="round"
|
|
348
|
+
stroke-width="1.75"
|
|
349
|
+
viewBox="0 0 24 24"
|
|
350
|
+
[attr.height]="iconSize()"
|
|
351
|
+
[attr.width]="iconSize()"
|
|
352
|
+
>
|
|
353
|
+
<path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
|
|
354
|
+
<path d="M21 3v5h-5" />
|
|
355
|
+
</svg>
|
|
356
|
+
}
|
|
257
357
|
{{ retryLabel() }}
|
|
258
358
|
</button>
|
|
259
359
|
</div>
|
|
@@ -266,17 +366,93 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
|
|
|
266
366
|
}
|
|
267
367
|
}
|
|
268
368
|
`,
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
369
|
+
host: {
|
|
370
|
+
"[attr.aria-busy]": "state() === 'loading' || null",
|
|
371
|
+
"[class.flex]": "filling()",
|
|
372
|
+
"[class.flex-col]": "filling()"
|
|
373
|
+
}
|
|
374
|
+
}]
|
|
375
|
+
}],
|
|
376
|
+
ctorParameters: () => [],
|
|
377
|
+
propDecorators: {
|
|
378
|
+
state: [{
|
|
379
|
+
type: i0.Input,
|
|
380
|
+
args: [{
|
|
381
|
+
isSignal: true,
|
|
382
|
+
alias: "state",
|
|
383
|
+
required: true
|
|
384
|
+
}]
|
|
385
|
+
}],
|
|
386
|
+
errorTitle: [{
|
|
387
|
+
type: i0.Input,
|
|
388
|
+
args: [{
|
|
389
|
+
isSignal: true,
|
|
390
|
+
alias: "errorTitle",
|
|
391
|
+
required: false
|
|
392
|
+
}]
|
|
393
|
+
}],
|
|
394
|
+
errorMessage: [{
|
|
395
|
+
type: i0.Input,
|
|
396
|
+
args: [{
|
|
397
|
+
isSignal: true,
|
|
398
|
+
alias: "errorMessage",
|
|
399
|
+
required: false
|
|
400
|
+
}]
|
|
401
|
+
}],
|
|
402
|
+
retryLabel: [{
|
|
403
|
+
type: i0.Input,
|
|
404
|
+
args: [{
|
|
405
|
+
isSignal: true,
|
|
406
|
+
alias: "retryLabel",
|
|
407
|
+
required: false
|
|
408
|
+
}]
|
|
409
|
+
}],
|
|
410
|
+
retryIcon: [{
|
|
411
|
+
type: i0.Input,
|
|
412
|
+
args: [{
|
|
413
|
+
isSignal: true,
|
|
414
|
+
alias: "retryIcon",
|
|
415
|
+
required: false
|
|
416
|
+
}]
|
|
417
|
+
}],
|
|
418
|
+
variant: [{
|
|
419
|
+
type: i0.Input,
|
|
420
|
+
args: [{
|
|
421
|
+
isSignal: true,
|
|
422
|
+
alias: "variant",
|
|
423
|
+
required: false
|
|
424
|
+
}]
|
|
425
|
+
}],
|
|
426
|
+
align: [{
|
|
427
|
+
type: i0.Input,
|
|
428
|
+
args: [{
|
|
429
|
+
isSignal: true,
|
|
430
|
+
alias: "align",
|
|
431
|
+
required: false
|
|
432
|
+
}]
|
|
433
|
+
}],
|
|
434
|
+
card: [{
|
|
435
|
+
type: i0.Input,
|
|
436
|
+
args: [{
|
|
437
|
+
isSignal: true,
|
|
438
|
+
alias: "card",
|
|
439
|
+
required: false
|
|
440
|
+
}]
|
|
441
|
+
}],
|
|
442
|
+
fill: [{
|
|
443
|
+
type: i0.Input,
|
|
444
|
+
args: [{
|
|
445
|
+
isSignal: true,
|
|
446
|
+
alias: "fill",
|
|
447
|
+
required: false
|
|
448
|
+
}]
|
|
449
|
+
}],
|
|
450
|
+
retry: [{
|
|
451
|
+
type: i0.Output,
|
|
452
|
+
args: ["retry"]
|
|
453
|
+
}]
|
|
454
|
+
}
|
|
455
|
+
});
|
|
281
456
|
export { ASYNC_ALIGNS, ASYNC_STATES, ASYNC_VARIANTS, UiAsync, delayedState };
|
|
282
|
-
|
|
457
|
+
|
|
458
|
+
//# sourceMappingURL=joanroucoux-cairn-ui-async.mjs.map
|