@joanroucoux/cairn-ui 0.8.2 → 0.9.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs +57 -53
  3. package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs.map +1 -1
  4. package/fesm2022/joanroucoux-cairn-ui-alert.mjs +155 -47
  5. package/fesm2022/joanroucoux-cairn-ui-alert.mjs.map +1 -1
  6. package/fesm2022/joanroucoux-cairn-ui-amount.mjs +220 -110
  7. package/fesm2022/joanroucoux-cairn-ui-amount.mjs.map +1 -1
  8. package/fesm2022/joanroucoux-cairn-ui-async.mjs +392 -216
  9. package/fesm2022/joanroucoux-cairn-ui-async.mjs.map +1 -1
  10. package/fesm2022/joanroucoux-cairn-ui-avatar.mjs +145 -68
  11. package/fesm2022/joanroucoux-cairn-ui-avatar.mjs.map +1 -1
  12. package/fesm2022/joanroucoux-cairn-ui-back-link.mjs +87 -47
  13. package/fesm2022/joanroucoux-cairn-ui-back-link.mjs.map +1 -1
  14. package/fesm2022/joanroucoux-cairn-ui-badge.mjs +83 -43
  15. package/fesm2022/joanroucoux-cairn-ui-badge.mjs.map +1 -1
  16. package/fesm2022/joanroucoux-cairn-ui-button.mjs +184 -104
  17. package/fesm2022/joanroucoux-cairn-ui-button.mjs.map +1 -1
  18. package/fesm2022/joanroucoux-cairn-ui-card.mjs +232 -137
  19. package/fesm2022/joanroucoux-cairn-ui-card.mjs.map +1 -1
  20. package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs +298 -102
  21. package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs.map +1 -1
  22. package/fesm2022/joanroucoux-cairn-ui-control.mjs +4 -17
  23. package/fesm2022/joanroucoux-cairn-ui-control.mjs.map +1 -1
  24. package/fesm2022/joanroucoux-cairn-ui-delta.mjs +150 -83
  25. package/fesm2022/joanroucoux-cairn-ui-delta.mjs.map +1 -1
  26. package/fesm2022/joanroucoux-cairn-ui-dialog.mjs +508 -471
  27. package/fesm2022/joanroucoux-cairn-ui-dialog.mjs.map +1 -1
  28. package/fesm2022/joanroucoux-cairn-ui-donut.mjs +255 -157
  29. package/fesm2022/joanroucoux-cairn-ui-donut.mjs.map +1 -1
  30. package/fesm2022/joanroucoux-cairn-ui-drawer.mjs +303 -0
  31. package/fesm2022/joanroucoux-cairn-ui-drawer.mjs.map +1 -0
  32. package/fesm2022/joanroucoux-cairn-ui-empty.mjs +76 -35
  33. package/fesm2022/joanroucoux-cairn-ui-empty.mjs.map +1 -1
  34. package/fesm2022/joanroucoux-cairn-ui-external-link.mjs +40 -31
  35. package/fesm2022/joanroucoux-cairn-ui-external-link.mjs.map +1 -1
  36. package/fesm2022/joanroucoux-cairn-ui-fact.mjs +188 -79
  37. package/fesm2022/joanroucoux-cairn-ui-fact.mjs.map +1 -1
  38. package/fesm2022/joanroucoux-cairn-ui-field.mjs +309 -173
  39. package/fesm2022/joanroucoux-cairn-ui-field.mjs.map +1 -1
  40. package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs +165 -87
  41. package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs.map +1 -1
  42. package/fesm2022/joanroucoux-cairn-ui-group-header.mjs +269 -0
  43. package/fesm2022/joanroucoux-cairn-ui-group-header.mjs.map +1 -0
  44. package/fesm2022/joanroucoux-cairn-ui-input.mjs +205 -85
  45. package/fesm2022/joanroucoux-cairn-ui-input.mjs.map +1 -1
  46. package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs +838 -512
  47. package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs.map +1 -1
  48. package/fesm2022/joanroucoux-cairn-ui-menu.mjs +401 -225
  49. package/fesm2022/joanroucoux-cairn-ui-menu.mjs.map +1 -1
  50. package/fesm2022/joanroucoux-cairn-ui-meter.mjs +143 -57
  51. package/fesm2022/joanroucoux-cairn-ui-meter.mjs.map +1 -1
  52. package/fesm2022/joanroucoux-cairn-ui-motion.mjs +367 -399
  53. package/fesm2022/joanroucoux-cairn-ui-motion.mjs.map +1 -1
  54. package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs +73 -44
  55. package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs.map +1 -1
  56. package/fesm2022/joanroucoux-cairn-ui-result-group.mjs +191 -0
  57. package/fesm2022/joanroucoux-cairn-ui-result-group.mjs.map +1 -0
  58. package/fesm2022/joanroucoux-cairn-ui-row.mjs +376 -146
  59. package/fesm2022/joanroucoux-cairn-ui-row.mjs.map +1 -1
  60. package/fesm2022/joanroucoux-cairn-ui-segmented.mjs +183 -81
  61. package/fesm2022/joanroucoux-cairn-ui-segmented.mjs.map +1 -1
  62. package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs +233 -0
  63. package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs.map +1 -0
  64. package/fesm2022/joanroucoux-cairn-ui-select.mjs +121 -67
  65. package/fesm2022/joanroucoux-cairn-ui-select.mjs.map +1 -1
  66. package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs +129 -51
  67. package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs.map +1 -1
  68. package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs +80 -39
  69. package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs.map +1 -1
  70. package/fesm2022/joanroucoux-cairn-ui-stat.mjs +85 -55
  71. package/fesm2022/joanroucoux-cairn-ui-stat.mjs.map +1 -1
  72. package/fesm2022/joanroucoux-cairn-ui-switch.mjs +48 -35
  73. package/fesm2022/joanroucoux-cairn-ui-switch.mjs.map +1 -1
  74. package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs +113 -69
  75. package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs.map +1 -1
  76. package/fesm2022/joanroucoux-cairn-ui-table.mjs +1036 -310
  77. package/fesm2022/joanroucoux-cairn-ui-table.mjs.map +1 -1
  78. package/fesm2022/joanroucoux-cairn-ui-toast.mjs +240 -127
  79. package/fesm2022/joanroucoux-cairn-ui-toast.mjs.map +1 -1
  80. package/fesm2022/joanroucoux-cairn-ui.mjs +0 -4
  81. package/package.json +17 -1
  82. package/styles/motion.css +1 -13
  83. package/styles/tokens.css +35 -64
  84. package/types/joanroucoux-cairn-ui-action-bar.d.ts +9 -14
  85. package/types/joanroucoux-cairn-ui-alert.d.ts +29 -15
  86. package/types/joanroucoux-cairn-ui-amount.d.ts +64 -32
  87. package/types/joanroucoux-cairn-ui-async.d.ts +85 -38
  88. package/types/joanroucoux-cairn-ui-avatar.d.ts +34 -22
  89. package/types/joanroucoux-cairn-ui-back-link.d.ts +20 -15
  90. package/types/joanroucoux-cairn-ui-badge.d.ts +22 -14
  91. package/types/joanroucoux-cairn-ui-button.d.ts +36 -18
  92. package/types/joanroucoux-cairn-ui-card.d.ts +48 -23
  93. package/types/joanroucoux-cairn-ui-choice-chips.d.ts +91 -35
  94. package/types/joanroucoux-cairn-ui-control.d.ts +9 -18
  95. package/types/joanroucoux-cairn-ui-delta.d.ts +46 -24
  96. package/types/joanroucoux-cairn-ui-dialog.d.ts +124 -57
  97. package/types/joanroucoux-cairn-ui-donut.d.ts +83 -46
  98. package/types/joanroucoux-cairn-ui-drawer.d.ts +73 -0
  99. package/types/joanroucoux-cairn-ui-empty.d.ts +20 -13
  100. package/types/joanroucoux-cairn-ui-external-link.d.ts +6 -10
  101. package/types/joanroucoux-cairn-ui-fact.d.ts +49 -25
  102. package/types/joanroucoux-cairn-ui-field.d.ts +72 -49
  103. package/types/joanroucoux-cairn-ui-filter-chips.d.ts +35 -20
  104. package/types/joanroucoux-cairn-ui-group-header.d.ts +58 -0
  105. package/types/joanroucoux-cairn-ui-input.d.ts +59 -37
  106. package/types/joanroucoux-cairn-ui-line-chart.d.ts +199 -89
  107. package/types/joanroucoux-cairn-ui-menu.d.ts +81 -44
  108. package/types/joanroucoux-cairn-ui-meter.d.ts +44 -22
  109. package/types/joanroucoux-cairn-ui-motion.d.ts +61 -75
  110. package/types/joanroucoux-cairn-ui-nav-item.d.ts +15 -13
  111. package/types/joanroucoux-cairn-ui-result-group.d.ts +52 -0
  112. package/types/joanroucoux-cairn-ui-row.d.ts +79 -37
  113. package/types/joanroucoux-cairn-ui-segmented.d.ts +51 -27
  114. package/types/joanroucoux-cairn-ui-select-pill.d.ts +52 -0
  115. package/types/joanroucoux-cairn-ui-select.d.ts +28 -18
  116. package/types/joanroucoux-cairn-ui-skeleton.d.ts +35 -18
  117. package/types/joanroucoux-cairn-ui-stale-link.d.ts +23 -16
  118. package/types/joanroucoux-cairn-ui-stat.d.ts +26 -21
  119. package/types/joanroucoux-cairn-ui-switch.d.ts +7 -11
  120. package/types/joanroucoux-cairn-ui-tab-bar.d.ts +20 -17
  121. package/types/joanroucoux-cairn-ui-table.d.ts +251 -89
  122. package/types/joanroucoux-cairn-ui-toast.d.ts +46 -36
  123. package/types/joanroucoux-cairn-ui.d.ts +1 -2
  124. package/fesm2022/joanroucoux-cairn-ui.mjs.map +0 -1
@@ -1,179 +1,268 @@
1
- import * as i0 from '@angular/core';
2
- import { signal, inject, DestroyRef, effect, untracked, input, booleanAttribute, output, computed, Component } from '@angular/core';
3
- import { holdTransitionsUntilRendered } from '@joanroucoux/cairn-ui/motion';
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
- const displayed = signal(null, /* @ts-ignore */
18
- ...(ngDevMode ? [{ debugName: "displayed" }] : /* istanbul ignore next */ []));
19
- let timer;
20
- let shownAt = 0;
21
- const clear = () => {
22
- clearTimeout(timer);
23
- timer = undefined;
24
- };
25
- inject(DestroyRef).onDestroy(clear);
26
- effect(() => {
27
- const state = source();
28
- untracked(() => {
29
- if (state === 'loading') {
30
- if (displayed() === 'loading') {
31
- clear();
32
- }
33
- else {
34
- timer = setTimeout(() => {
35
- timer = undefined;
36
- shownAt = Date.now();
37
- displayed.set('loading');
38
- }, SKELETON_DELAY_MS);
39
- }
40
- return;
41
- }
42
- clear();
43
- const remaining = shownAt + SKELETON_MIN_MS - Date.now();
44
- if (displayed() === 'loading' && remaining > 0) {
45
- timer = setTimeout(() => {
46
- timer = undefined;
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
- /** Available async block states. `AsyncState` is derived from this tuple. */
59
- const ASYNC_STATES = ['loading', 'error', 'empty', 'ready'];
60
- /** Looks of the error block. `AsyncVariant` is derived from this tuple. */
61
- const ASYNC_VARIANTS = ['elevated', 'plain', 'emphasis', 'inline'];
62
- /** Alignments of the error block; `auto` is centred from 64rem. `AsyncAlign` is derived from this tuple. */
63
- const ASYNC_ALIGNS = ['start', 'center', 'auto'];
64
- 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';
65
- const RETRY_OUTLINE_CLASSES = 'bg-(--card) text-(--foreground) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow)';
66
- const RETRY_PRIMARY_CLASSES = 'bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)';
67
- const RETRY_BLOCK_CLASSES = 'min-h-(--row-min) gap-2 pl-3 pr-4';
68
- const RETRY_INLINE_CLASSES = 'h-11 pointer-fine:h-8 flex-none gap-1.5 pl-2.5 pr-3';
69
- const ELEVATED_SURFACE_CLASSES = 'rounded-control bg-(--elevated)';
70
- const CARD_SURFACE_CLASSES = 'rounded-container bg-(--card) shadow-[inset_0_0_0_1px_var(--border)]';
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
- elevated: {
73
- surface: ELEVATED_SURFACE_CLASSES,
74
- gap: 'gap-1',
75
- padding: { start: 'p-4', center: 'px-4 py-10', auto: 'p-4 lg:py-10' },
76
- title: 'text-body font-medium',
77
- message: { start: 'text-label', center: 'text-label', auto: 'text-label' },
78
- retryMargin: { start: 'mt-2', center: 'mt-2', auto: 'mt-2' },
79
- retry: RETRY_OUTLINE_CLASSES,
80
- },
81
- plain: {
82
- surface: '',
83
- gap: 'gap-1',
84
- padding: { start: 'px-4 py-5', center: 'px-4 py-12', auto: 'px-4 py-5 lg:py-12' },
85
- title: 'text-body leading-[normal] font-medium',
86
- message: {
87
- start: 'text-label leading-[normal]',
88
- center: 'text-label leading-[normal]',
89
- auto: 'text-label leading-[normal]',
90
- },
91
- retryMargin: { start: 'mt-2', center: 'mt-2', auto: 'mt-2' },
92
- retry: RETRY_OUTLINE_CLASSES,
93
- },
94
- emphasis: {
95
- surface: '',
96
- gap: 'gap-3',
97
- padding: { start: 'px-4 py-6', center: 'px-4 py-14', auto: 'px-4 py-6 lg:py-14' },
98
- title: 'text-title font-semibold',
99
- message: {
100
- start: 'text-label',
101
- center: 'text-body leading-[normal]',
102
- auto: 'text-label lg:text-body lg:leading-[normal]',
103
- },
104
- retryMargin: { start: 'mt-1', center: 'mt-2', auto: 'mt-1 lg:mt-2' },
105
- retry: RETRY_PRIMARY_CLASSES,
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
- start: 'items-start',
110
- center: 'items-center text-center',
111
- auto: 'items-start lg:items-center lg:text-center',
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 = 'flex-row items-center justify-between gap-3 pt-1.5 pr-1.5 pb-2 pl-2.5';
114
- /**
115
- * The three states of a block that depends on a service call, next to the ready content.
116
- *
117
- * @example
118
- * <ui-async [state]="totalState()" errorTitle="Total could not be loaded" errorMessage="The server did not answer." retryLabel="Retry" (retry)="reload()">
119
- * <span asyncLoading><ui-skeleton shape="figure" /></span>
120
- * <span asyncEmpty>Add a holding to see your total.</span>
121
- * <span>{{ total() }}</span>
122
- * </ui-async>
123
- */
124
- class UiAsync {
125
- state = input.required(/* @ts-ignore */
126
- ...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
127
- errorTitle = input(/* @ts-ignore */
128
- ...(ngDevMode ? [undefined, { debugName: "errorTitle" }] : /* istanbul ignore next */ []));
129
- errorMessage = input(/* @ts-ignore */
130
- ...(ngDevMode ? [undefined, { debugName: "errorMessage" }] : /* istanbul ignore next */ []));
131
- retryLabel = input(/* @ts-ignore */
132
- ...(ngDevMode ? [undefined, { debugName: "retryLabel" }] : /* istanbul ignore next */ []));
133
- variant = input('elevated', /* @ts-ignore */
134
- ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
135
- align = input('start', /* @ts-ignore */
136
- ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
137
- card = input(false, { ...(ngDevMode ? { debugName: "card" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
138
- fill = input(false, { ...(ngDevMode ? { debugName: "fill" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
139
- retry = output();
140
- shown = delayedState(this.state);
141
- filling = computed(() => this.fill() && this.shown() === 'error', /* @ts-ignore */
142
- ...(ngDevMode ? [{ debugName: "filling" }] : /* istanbul ignore next */ []));
143
- iconSize = computed(() => (this.variant() === 'inline' ? 16 : 18), /* @ts-ignore */
144
- ...(ngDevMode ? [{ debugName: "iconSize" }] : /* istanbul ignore next */ []));
145
- #spec = computed(() => {
146
- const variant = this.variant();
147
- return variant === 'inline' ? null : BLOCK_SPECS[variant];
148
- }, /* @ts-ignore */
149
- ...(ngDevMode ? [{ debugName: "#spec" }] : /* istanbul ignore next */ []));
150
- boxClasses = computed(() => {
151
- const spec = this.#spec();
152
- const fill = this.fill() ? ' flex-1 justify-center' : '';
153
- if (spec === null) {
154
- return `flex ${INLINE_BOX_CLASSES}${this.card() ? ` ${CARD_SURFACE_CLASSES}` : ''}${this.fill() ? ' flex-1' : ''}`;
155
- }
156
- const surface = this.card() ? CARD_SURFACE_CLASSES : spec.surface;
157
- return `flex flex-col ${surface} ${spec.gap} ${ALIGN_CLASSES[this.align()]} ${spec.padding[this.align()]}${fill}`;
158
- }, /* @ts-ignore */
159
- ...(ngDevMode ? [{ debugName: "boxClasses" }] : /* istanbul ignore next */ []));
160
- titleClasses = computed(() => this.#spec().title, /* @ts-ignore */
161
- ...(ngDevMode ? [{ debugName: "titleClasses" }] : /* istanbul ignore next */ []));
162
- messageClasses = computed(() => this.#spec().message[this.align()], /* @ts-ignore */
163
- ...(ngDevMode ? [{ debugName: "messageClasses" }] : /* istanbul ignore next */ []));
164
- retryButtonClasses = computed(() => {
165
- const spec = this.#spec();
166
- if (spec === null) {
167
- return `${RETRY_BASE_CLASSES} ${RETRY_OUTLINE_CLASSES} ${RETRY_INLINE_CLASSES}`;
168
- }
169
- return `${RETRY_BASE_CLASSES} ${spec.retry} ${RETRY_BLOCK_CLASSES} ${spec.retryMargin[this.align()]}`;
170
- }, /* @ts-ignore */
171
- ...(ngDevMode ? [{ debugName: "retryButtonClasses" }] : /* istanbul ignore next */ []));
172
- constructor() {
173
- holdTransitionsUntilRendered();
174
- }
175
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiAsync, deps: [], target: i0.ɵɵFactoryTarget.Component });
176
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiAsync, isStandalone: true, selector: "ui-async", inputs: { state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, errorTitle: { classPropertyName: "errorTitle", publicName: "errorTitle", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, retryLabel: { classPropertyName: "retryLabel", publicName: "retryLabel", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, card: { classPropertyName: "card", publicName: "card", isSignal: true, isRequired: false, transformFunction: null }, fill: { classPropertyName: "fill", publicName: "fill", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retry: "retry" }, host: { properties: { "attr.aria-busy": "state() === 'loading' || null", "class.flex": "filling()", "class.flex-col": "filling()" } }, ngImport: i0, template: `
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
- <svg
196
- aria-hidden="true"
197
- class="block flex-none fill-none stroke-current"
198
- stroke-linecap="round"
199
- stroke-linejoin="round"
200
- stroke-width="1.75"
201
- viewBox="0 0 24 24"
202
- [attr.height]="iconSize()"
203
- [attr.width]="iconSize()"
204
- >
205
- <path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
206
- <path d="M21 3v5h-5" />
207
- </svg>
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
- `, isInline: true });
220
- }
221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiAsync, decorators: [{
222
- type: Component,
223
- args: [{
224
- selector: 'ui-async',
225
- template: `
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
- <svg
245
- aria-hidden="true"
246
- class="block flex-none fill-none stroke-current"
247
- stroke-linecap="round"
248
- stroke-linejoin="round"
249
- stroke-width="1.75"
250
- viewBox="0 0 24 24"
251
- [attr.height]="iconSize()"
252
- [attr.width]="iconSize()"
253
- >
254
- <path d="M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" />
255
- <path d="M21 3v5h-5" />
256
- </svg>
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
- host: {
270
- '[attr.aria-busy]': "state() === 'loading' || null",
271
- '[class.flex]': 'filling()',
272
- '[class.flex-col]': 'filling()',
273
- },
274
- }]
275
- }], ctorParameters: () => [], propDecorators: { state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], errorTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorTitle", required: false }] }], errorMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorMessage", required: false }] }], retryLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "retryLabel", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }], card: [{ type: i0.Input, args: [{ isSignal: true, alias: "card", required: false }] }], fill: [{ type: i0.Input, args: [{ isSignal: true, alias: "fill", required: false }] }], retry: [{ type: i0.Output, args: ["retry"] }] } });
276
-
277
- /**
278
- * Generated bundle index. Do not edit.
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
- //# sourceMappingURL=joanroucoux-cairn-ui-async.mjs.map
457
+
458
+ //# sourceMappingURL=joanroucoux-cairn-ui-async.mjs.map