@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.
Files changed (124) hide show
  1. package/CHANGELOG.md +114 -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 +408 -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 +270 -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 +92 -37
  113. package/types/joanroucoux-cairn-ui-segmented.d.ts +51 -27
  114. package/types/joanroucoux-cairn-ui-select-pill.d.ts +59 -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,87 +1,117 @@
1
- import * as i0 from '@angular/core';
2
- import { input, computed, Component } from '@angular/core';
3
-
4
- /** Available delta emphases. `DeltaEmphasis` is derived from this tuple. */
5
- const DELTA_EMPHASES = ['text', 'pill'];
6
- /** Type sizes. `DeltaSize` is derived from this tuple. */
7
- const DELTA_SIZES = ['label', 'inherit'];
8
- /** Font weights. `DeltaWeight` is derived from this tuple. */
9
- const DELTA_WEIGHTS = ['medium', 'regular'];
10
- const BASE_CLASSES = 'inline-flex items-center gap-1 tabular-nums';
1
+ import * as i0 from "@angular/core";
2
+ import { Component, computed, input } from "@angular/core";
3
+ const DELTA_EMPHASES = ["text", "pill"];
4
+ const DELTA_SIZES = ["label", "inherit"];
5
+ const DELTA_WEIGHTS = ["medium", "regular"];
6
+ const BASE_CLASSES = "inline-flex items-center gap-1 tabular-nums";
11
7
  const SIZE_CLASSES = {
12
- label: 'text-label',
13
- inherit: '',
8
+ label: "text-label",
9
+ inherit: ""
14
10
  };
15
11
  const WEIGHT_CLASSES = {
16
- medium: 'font-medium',
17
- regular: 'font-normal',
12
+ medium: "font-medium",
13
+ regular: "font-normal"
18
14
  };
19
- const PILL_CLASSES = 'h-6 rounded-pill px-2';
15
+ const PILL_CLASSES = "h-6 rounded-pill px-2";
20
16
  const TEXT_CLASSES = {
21
- positive: 'text-(--positive)',
22
- negative: 'text-(--negative)',
23
- neutral: 'text-(--muted-foreground)',
24
- unknown: 'text-(--subtle-foreground)',
17
+ positive: "text-(--positive)",
18
+ negative: "text-(--negative)",
19
+ neutral: "text-(--muted-foreground)",
20
+ unknown: "text-(--subtle-foreground)"
25
21
  };
26
- const PILL_BACKGROUND_CLASS = 'bg-(--soft)';
27
- /**
28
- * Signed amount whose sign carries meaning: a gain, a loss, or an unknown.
29
- *
30
- * A null value is not a zero: a holding with no cost basis exists, and showing 0 would falsely
31
- * claim a known gain of zero. Color never carries the sign on its own: the projected text must
32
- * already contain a + or a minus sign.
33
- *
34
- * @example
35
- * <ui-delta [value]="holding.dayChangeEur" unknownLabel="Not available">
36
- * {{ holding.dayChangeEur | signedMoney }}
37
- * </ui-delta>
38
- */
39
- class UiDelta {
40
- value = input.required(/* @ts-ignore */
41
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
42
- unknownLabel = input.required(/* @ts-ignore */
43
- ...(ngDevMode ? [{ debugName: "unknownLabel" }] : /* istanbul ignore next */ []));
44
- emphasis = input('text', /* @ts-ignore */
45
- ...(ngDevMode ? [{ debugName: "emphasis" }] : /* istanbul ignore next */ []));
46
- size = input('label', /* @ts-ignore */
47
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
48
- weight = input('medium', /* @ts-ignore */
49
- ...(ngDevMode ? [{ debugName: "weight" }] : /* istanbul ignore next */ []));
50
- sign = computed(() => {
51
- const value = this.value();
52
- if (value === null || value === undefined) {
53
- return 'unknown';
54
- }
55
- if (value > 0) {
56
- return 'positive';
57
- }
58
- if (value < 0) {
59
- return 'negative';
60
- }
61
- return 'neutral';
62
- }, /* @ts-ignore */
63
- ...(ngDevMode ? [{ debugName: "sign" }] : /* istanbul ignore next */ []));
64
- classes = computed(() => {
65
- const sign = this.sign();
66
- const background = this.emphasis() === 'pill' ? `${PILL_CLASSES} ${PILL_BACKGROUND_CLASS}` : 'bg-transparent';
67
- return `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${WEIGHT_CLASSES[this.weight()]} ${TEXT_CLASSES[sign]} ${background}`;
68
- }, /* @ts-ignore */
69
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
70
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiDelta, deps: [], target: i0.ɵɵFactoryTarget.Component });
71
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiDelta, isStandalone: true, selector: "ui-delta", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, unknownLabel: { classPropertyName: "unknownLabel", publicName: "unknownLabel", isSignal: true, isRequired: true, transformFunction: null }, emphasis: { classPropertyName: "emphasis", publicName: "emphasis", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, weight: { classPropertyName: "weight", publicName: "weight", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `
22
+ const PILL_BACKGROUND_CLASS = "bg-(--soft)";
23
+ var UiDelta = class UiDelta {
24
+ value = input.required(...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
25
+ unknownLabel = input.required(...ngDevMode ? [{ debugName: "unknownLabel" }] : /* istanbul ignore next */ []);
26
+ emphasis = input("text", ...ngDevMode ? [{ debugName: "emphasis" }] : /* istanbul ignore next */ []);
27
+ size = input("label", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
28
+ weight = input("medium", ...ngDevMode ? [{ debugName: "weight" }] : /* istanbul ignore next */ []);
29
+ sign = computed(() => {
30
+ const value = this.value();
31
+ if (value === null || value === void 0) return "unknown";
32
+ if (value > 0) return "positive";
33
+ if (value < 0) return "negative";
34
+ return "neutral";
35
+ }, ...ngDevMode ? [{ debugName: "sign" }] : /* istanbul ignore next */ []);
36
+ classes = computed(() => {
37
+ const sign = this.sign();
38
+ const background = this.emphasis() === "pill" ? `${PILL_CLASSES} ${PILL_BACKGROUND_CLASS}` : "bg-transparent";
39
+ return `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${WEIGHT_CLASSES[this.weight()]} ${TEXT_CLASSES[sign]} ${background}`;
40
+ }, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
41
+ static ɵfac = i0.ɵɵngDeclareFactory({
42
+ minVersion: "12.0.0",
43
+ version: "22.2.0",
44
+ ngImport: i0,
45
+ type: UiDelta,
46
+ deps: [],
47
+ target: i0.ɵɵFactoryTarget.Component
48
+ });
49
+ static ɵcmp = i0.ɵɵngDeclareComponent({
50
+ minVersion: "17.0.0",
51
+ version: "22.2.0",
52
+ type: UiDelta,
53
+ isStandalone: true,
54
+ selector: "ui-delta",
55
+ inputs: {
56
+ value: {
57
+ classPropertyName: "value",
58
+ publicName: "value",
59
+ isSignal: true,
60
+ isRequired: true,
61
+ transformFunction: null
62
+ },
63
+ unknownLabel: {
64
+ classPropertyName: "unknownLabel",
65
+ publicName: "unknownLabel",
66
+ isSignal: true,
67
+ isRequired: true,
68
+ transformFunction: null
69
+ },
70
+ emphasis: {
71
+ classPropertyName: "emphasis",
72
+ publicName: "emphasis",
73
+ isSignal: true,
74
+ isRequired: false,
75
+ transformFunction: null
76
+ },
77
+ size: {
78
+ classPropertyName: "size",
79
+ publicName: "size",
80
+ isSignal: true,
81
+ isRequired: false,
82
+ transformFunction: null
83
+ },
84
+ weight: {
85
+ classPropertyName: "weight",
86
+ publicName: "weight",
87
+ isSignal: true,
88
+ isRequired: false,
89
+ transformFunction: null
90
+ }
91
+ },
92
+ host: { properties: { "class": "classes()" } },
93
+ ngImport: i0,
94
+ template: `
72
95
  @if (sign() === 'unknown') {
73
96
  <span aria-hidden="true">&mdash;</span>
74
97
  <span class="sr-only">{{ unknownLabel() }}</span>
75
98
  } @else {
76
99
  <ng-content />
77
100
  }
78
- `, isInline: true });
79
- }
80
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiDelta, decorators: [{
81
- type: Component,
82
- args: [{
83
- selector: 'ui-delta',
84
- template: `
101
+ `,
102
+ isInline: true
103
+ });
104
+ };
105
+ i0.ɵɵngDeclareClassMetadata({
106
+ minVersion: "12.0.0",
107
+ version: "22.2.0",
108
+ ngImport: i0,
109
+ type: UiDelta,
110
+ decorators: [{
111
+ type: Component,
112
+ args: [{
113
+ selector: "ui-delta",
114
+ template: `
85
115
  @if (sign() === 'unknown') {
86
116
  <span aria-hidden="true">&mdash;</span>
87
117
  <span class="sr-only">{{ unknownLabel() }}</span>
@@ -89,15 +119,52 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
89
119
  <ng-content />
90
120
  }
91
121
  `,
92
- host: {
93
- '[class]': 'classes()',
94
- },
95
- }]
96
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], unknownLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "unknownLabel", required: true }] }], emphasis: [{ type: i0.Input, args: [{ isSignal: true, alias: "emphasis", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], weight: [{ type: i0.Input, args: [{ isSignal: true, alias: "weight", required: false }] }] } });
97
-
98
- /**
99
- * Generated bundle index. Do not edit.
100
- */
101
-
122
+ host: { "[class]": "classes()" }
123
+ }]
124
+ }],
125
+ propDecorators: {
126
+ value: [{
127
+ type: i0.Input,
128
+ args: [{
129
+ isSignal: true,
130
+ alias: "value",
131
+ required: true
132
+ }]
133
+ }],
134
+ unknownLabel: [{
135
+ type: i0.Input,
136
+ args: [{
137
+ isSignal: true,
138
+ alias: "unknownLabel",
139
+ required: true
140
+ }]
141
+ }],
142
+ emphasis: [{
143
+ type: i0.Input,
144
+ args: [{
145
+ isSignal: true,
146
+ alias: "emphasis",
147
+ required: false
148
+ }]
149
+ }],
150
+ size: [{
151
+ type: i0.Input,
152
+ args: [{
153
+ isSignal: true,
154
+ alias: "size",
155
+ required: false
156
+ }]
157
+ }],
158
+ weight: [{
159
+ type: i0.Input,
160
+ args: [{
161
+ isSignal: true,
162
+ alias: "weight",
163
+ required: false
164
+ }]
165
+ }]
166
+ }
167
+ });
102
168
  export { DELTA_EMPHASES, DELTA_SIZES, DELTA_WEIGHTS, UiDelta };
103
- //# sourceMappingURL=joanroucoux-cairn-ui-delta.mjs.map
169
+
170
+ //# sourceMappingURL=joanroucoux-cairn-ui-delta.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"joanroucoux-cairn-ui-delta.mjs","sources":["../../../projects/ui/delta/delta.ts","../../../projects/ui/delta/joanroucoux-cairn-ui-delta.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\n\n/** Available delta emphases. `DeltaEmphasis` is derived from this tuple. */\nexport const DELTA_EMPHASES = ['text', 'pill'] as const;\nexport type DeltaEmphasis = (typeof DELTA_EMPHASES)[number];\n\n/** Type sizes. `DeltaSize` is derived from this tuple. */\nexport const DELTA_SIZES = ['label', 'inherit'] as const;\nexport type DeltaSize = (typeof DELTA_SIZES)[number];\n\n/** Font weights. `DeltaWeight` is derived from this tuple. */\nexport const DELTA_WEIGHTS = ['medium', 'regular'] as const;\nexport type DeltaWeight = (typeof DELTA_WEIGHTS)[number];\n\nconst BASE_CLASSES = 'inline-flex items-center gap-1 tabular-nums';\n\nconst SIZE_CLASSES: Record<DeltaSize, string> = {\n label: 'text-label',\n inherit: '',\n};\n\nconst WEIGHT_CLASSES: Record<DeltaWeight, string> = {\n medium: 'font-medium',\n regular: 'font-normal',\n};\n\nconst PILL_CLASSES = 'h-6 rounded-pill px-2';\n\ntype Sign = 'positive' | 'negative' | 'neutral' | 'unknown';\n\nconst TEXT_CLASSES: Record<Sign, string> = {\n positive: 'text-(--positive)',\n negative: 'text-(--negative)',\n neutral: 'text-(--muted-foreground)',\n unknown: 'text-(--subtle-foreground)',\n};\n\nconst PILL_BACKGROUND_CLASS = 'bg-(--soft)';\n\n/**\n * Signed amount whose sign carries meaning: a gain, a loss, or an unknown.\n *\n * A null value is not a zero: a holding with no cost basis exists, and showing 0 would falsely\n * claim a known gain of zero. Color never carries the sign on its own: the projected text must\n * already contain a + or a minus sign.\n *\n * @example\n * <ui-delta [value]=\"holding.dayChangeEur\" unknownLabel=\"Not available\">\n * {{ holding.dayChangeEur | signedMoney }}\n * </ui-delta>\n */\n@Component({\n selector: 'ui-delta',\n template: `\n @if (sign() === 'unknown') {\n <span aria-hidden=\"true\">&mdash;</span>\n <span class=\"sr-only\">{{ unknownLabel() }}</span>\n } @else {\n <ng-content />\n }\n `,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class UiDelta {\n readonly value = input.required<number | null | undefined>();\n readonly unknownLabel = input.required<string>();\n readonly emphasis = input<DeltaEmphasis>('text');\n readonly size = input<DeltaSize>('label');\n readonly weight = input<DeltaWeight>('medium');\n\n protected readonly sign = computed<Sign>(() => {\n const value = this.value();\n\n if (value === null || value === undefined) {\n return 'unknown';\n }\n if (value > 0) {\n return 'positive';\n }\n if (value < 0) {\n return 'negative';\n }\n return 'neutral';\n });\n\n protected readonly classes = computed(() => {\n const sign = this.sign();\n const background = this.emphasis() === 'pill' ? `${PILL_CLASSES} ${PILL_BACKGROUND_CLASS}` : 'bg-transparent';\n\n return `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${WEIGHT_CLASSES[this.weight()]} ${TEXT_CLASSES[sign]} ${background}`;\n });\n}\n","/**\n * Generated bundle index. Do not edit.\n */\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EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,MAAA,EAAA,EAAA,iBAAA,EAAA,QAAA,EAAA,UAAA,EAAA,QAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAZR;;;;;;;AAOT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAKU,OAAO,EAAA,UAAA,EAAA,CAAA;kBAdnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,QAAQ,EAAE;;;;;;;AAOT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACvB,qBAAA;AACF,iBAAA;;;AChED;;AAEG;;;;"}
1
+ {"version":3,"file":"joanroucoux-cairn-ui-delta.mjs","names":[],"sources":["../../../projects/ui/delta/delta.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\n\n/** Available delta emphases. */\nexport const DELTA_EMPHASES = ['text', 'pill'] as const;\nexport type DeltaEmphasis = (typeof DELTA_EMPHASES)[number];\n\n/** Type sizes. */\nexport const DELTA_SIZES = ['label', 'inherit'] as const;\nexport type DeltaSize = (typeof DELTA_SIZES)[number];\n\n/** Font weights. */\nexport const DELTA_WEIGHTS = ['medium', 'regular'] as const;\nexport type DeltaWeight = (typeof DELTA_WEIGHTS)[number];\n\nconst BASE_CLASSES = 'inline-flex items-center gap-1 tabular-nums';\n\nconst SIZE_CLASSES: Record<DeltaSize, string> = {\n label: 'text-label',\n inherit: '',\n};\n\nconst WEIGHT_CLASSES: Record<DeltaWeight, string> = {\n medium: 'font-medium',\n regular: 'font-normal',\n};\n\nconst PILL_CLASSES = 'h-6 rounded-pill px-2';\n\ntype Sign = 'positive' | 'negative' | 'neutral' | 'unknown';\n\nconst TEXT_CLASSES: Record<Sign, string> = {\n positive: 'text-(--positive)',\n negative: 'text-(--negative)',\n neutral: 'text-(--muted-foreground)',\n unknown: 'text-(--subtle-foreground)',\n};\n\nconst PILL_BACKGROUND_CLASS = 'bg-(--soft)';\n\n/**\n * Signed amount whose sign carries meaning: a gain, a loss, or an unknown.\n *\n * A null value is not a zero: it renders the unknown state, not a gain of zero. Color never\n * carries the sign on its own: the projected text must already contain a + or a minus sign.\n *\n * @example\n * <ui-delta [value]=\"holding.dayChangeEur\" unknownLabel=\"Not available\">\n * {{ holding.dayChangeEur | signedMoney }}\n * </ui-delta>\n */\n@Component({\n selector: 'ui-delta',\n template: `\n @if (sign() === 'unknown') {\n <span aria-hidden=\"true\">&mdash;</span>\n <span class=\"sr-only\">{{ unknownLabel() }}</span>\n } @else {\n <ng-content />\n }\n `,\n host: {\n '[class]': 'classes()',\n },\n})\nexport class UiDelta {\n readonly value = input.required<number | null | undefined>();\n readonly unknownLabel = input.required<string>();\n readonly emphasis = input<DeltaEmphasis>('text');\n readonly size = input<DeltaSize>('label');\n readonly weight = input<DeltaWeight>('medium');\n\n protected readonly sign = computed<Sign>(() => {\n const value = this.value();\n\n if (value === null || value === undefined) {\n return 'unknown';\n }\n if (value > 0) {\n return 'positive';\n }\n if (value < 0) {\n return 'negative';\n }\n return 'neutral';\n });\n\n protected readonly classes = computed(() => {\n const sign = this.sign();\n const background = this.emphasis() === 'pill' ? `${PILL_CLASSES} ${PILL_BACKGROUND_CLASS}` : 'bg-transparent';\n\n return `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${WEIGHT_CLASSES[this.weight()]} ${TEXT_CLASSES[sign]} ${background}`;\n });\n}\n"],"mappings":";;AAGA,MAA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