@joanroucoux/cairn-ui 0.8.1 → 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 (125) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +2 -0
  3. package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs +57 -53
  4. package/fesm2022/joanroucoux-cairn-ui-action-bar.mjs.map +1 -1
  5. package/fesm2022/joanroucoux-cairn-ui-alert.mjs +155 -47
  6. package/fesm2022/joanroucoux-cairn-ui-alert.mjs.map +1 -1
  7. package/fesm2022/joanroucoux-cairn-ui-amount.mjs +220 -110
  8. package/fesm2022/joanroucoux-cairn-ui-amount.mjs.map +1 -1
  9. package/fesm2022/joanroucoux-cairn-ui-async.mjs +392 -216
  10. package/fesm2022/joanroucoux-cairn-ui-async.mjs.map +1 -1
  11. package/fesm2022/joanroucoux-cairn-ui-avatar.mjs +145 -68
  12. package/fesm2022/joanroucoux-cairn-ui-avatar.mjs.map +1 -1
  13. package/fesm2022/joanroucoux-cairn-ui-back-link.mjs +87 -47
  14. package/fesm2022/joanroucoux-cairn-ui-back-link.mjs.map +1 -1
  15. package/fesm2022/joanroucoux-cairn-ui-badge.mjs +83 -43
  16. package/fesm2022/joanroucoux-cairn-ui-badge.mjs.map +1 -1
  17. package/fesm2022/joanroucoux-cairn-ui-button.mjs +184 -104
  18. package/fesm2022/joanroucoux-cairn-ui-button.mjs.map +1 -1
  19. package/fesm2022/joanroucoux-cairn-ui-card.mjs +232 -137
  20. package/fesm2022/joanroucoux-cairn-ui-card.mjs.map +1 -1
  21. package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs +298 -102
  22. package/fesm2022/joanroucoux-cairn-ui-choice-chips.mjs.map +1 -1
  23. package/fesm2022/joanroucoux-cairn-ui-control.mjs +4 -17
  24. package/fesm2022/joanroucoux-cairn-ui-control.mjs.map +1 -1
  25. package/fesm2022/joanroucoux-cairn-ui-delta.mjs +150 -83
  26. package/fesm2022/joanroucoux-cairn-ui-delta.mjs.map +1 -1
  27. package/fesm2022/joanroucoux-cairn-ui-dialog.mjs +508 -471
  28. package/fesm2022/joanroucoux-cairn-ui-dialog.mjs.map +1 -1
  29. package/fesm2022/joanroucoux-cairn-ui-donut.mjs +255 -157
  30. package/fesm2022/joanroucoux-cairn-ui-donut.mjs.map +1 -1
  31. package/fesm2022/joanroucoux-cairn-ui-drawer.mjs +303 -0
  32. package/fesm2022/joanroucoux-cairn-ui-drawer.mjs.map +1 -0
  33. package/fesm2022/joanroucoux-cairn-ui-empty.mjs +76 -35
  34. package/fesm2022/joanroucoux-cairn-ui-empty.mjs.map +1 -1
  35. package/fesm2022/joanroucoux-cairn-ui-external-link.mjs +40 -31
  36. package/fesm2022/joanroucoux-cairn-ui-external-link.mjs.map +1 -1
  37. package/fesm2022/joanroucoux-cairn-ui-fact.mjs +188 -79
  38. package/fesm2022/joanroucoux-cairn-ui-fact.mjs.map +1 -1
  39. package/fesm2022/joanroucoux-cairn-ui-field.mjs +309 -173
  40. package/fesm2022/joanroucoux-cairn-ui-field.mjs.map +1 -1
  41. package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs +165 -87
  42. package/fesm2022/joanroucoux-cairn-ui-filter-chips.mjs.map +1 -1
  43. package/fesm2022/joanroucoux-cairn-ui-group-header.mjs +269 -0
  44. package/fesm2022/joanroucoux-cairn-ui-group-header.mjs.map +1 -0
  45. package/fesm2022/joanroucoux-cairn-ui-input.mjs +205 -85
  46. package/fesm2022/joanroucoux-cairn-ui-input.mjs.map +1 -1
  47. package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs +838 -512
  48. package/fesm2022/joanroucoux-cairn-ui-line-chart.mjs.map +1 -1
  49. package/fesm2022/joanroucoux-cairn-ui-menu.mjs +401 -225
  50. package/fesm2022/joanroucoux-cairn-ui-menu.mjs.map +1 -1
  51. package/fesm2022/joanroucoux-cairn-ui-meter.mjs +143 -57
  52. package/fesm2022/joanroucoux-cairn-ui-meter.mjs.map +1 -1
  53. package/fesm2022/joanroucoux-cairn-ui-motion.mjs +367 -399
  54. package/fesm2022/joanroucoux-cairn-ui-motion.mjs.map +1 -1
  55. package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs +73 -44
  56. package/fesm2022/joanroucoux-cairn-ui-nav-item.mjs.map +1 -1
  57. package/fesm2022/joanroucoux-cairn-ui-result-group.mjs +191 -0
  58. package/fesm2022/joanroucoux-cairn-ui-result-group.mjs.map +1 -0
  59. package/fesm2022/joanroucoux-cairn-ui-row.mjs +376 -146
  60. package/fesm2022/joanroucoux-cairn-ui-row.mjs.map +1 -1
  61. package/fesm2022/joanroucoux-cairn-ui-segmented.mjs +183 -81
  62. package/fesm2022/joanroucoux-cairn-ui-segmented.mjs.map +1 -1
  63. package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs +233 -0
  64. package/fesm2022/joanroucoux-cairn-ui-select-pill.mjs.map +1 -0
  65. package/fesm2022/joanroucoux-cairn-ui-select.mjs +121 -67
  66. package/fesm2022/joanroucoux-cairn-ui-select.mjs.map +1 -1
  67. package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs +129 -51
  68. package/fesm2022/joanroucoux-cairn-ui-skeleton.mjs.map +1 -1
  69. package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs +80 -39
  70. package/fesm2022/joanroucoux-cairn-ui-stale-link.mjs.map +1 -1
  71. package/fesm2022/joanroucoux-cairn-ui-stat.mjs +85 -55
  72. package/fesm2022/joanroucoux-cairn-ui-stat.mjs.map +1 -1
  73. package/fesm2022/joanroucoux-cairn-ui-switch.mjs +48 -35
  74. package/fesm2022/joanroucoux-cairn-ui-switch.mjs.map +1 -1
  75. package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs +113 -69
  76. package/fesm2022/joanroucoux-cairn-ui-tab-bar.mjs.map +1 -1
  77. package/fesm2022/joanroucoux-cairn-ui-table.mjs +1036 -310
  78. package/fesm2022/joanroucoux-cairn-ui-table.mjs.map +1 -1
  79. package/fesm2022/joanroucoux-cairn-ui-toast.mjs +240 -127
  80. package/fesm2022/joanroucoux-cairn-ui-toast.mjs.map +1 -1
  81. package/fesm2022/joanroucoux-cairn-ui.mjs +0 -4
  82. package/package.json +17 -1
  83. package/styles/motion.css +1 -13
  84. package/styles/tokens.css +35 -64
  85. package/types/joanroucoux-cairn-ui-action-bar.d.ts +9 -14
  86. package/types/joanroucoux-cairn-ui-alert.d.ts +29 -15
  87. package/types/joanroucoux-cairn-ui-amount.d.ts +64 -32
  88. package/types/joanroucoux-cairn-ui-async.d.ts +85 -38
  89. package/types/joanroucoux-cairn-ui-avatar.d.ts +34 -22
  90. package/types/joanroucoux-cairn-ui-back-link.d.ts +20 -15
  91. package/types/joanroucoux-cairn-ui-badge.d.ts +22 -14
  92. package/types/joanroucoux-cairn-ui-button.d.ts +36 -18
  93. package/types/joanroucoux-cairn-ui-card.d.ts +48 -23
  94. package/types/joanroucoux-cairn-ui-choice-chips.d.ts +91 -35
  95. package/types/joanroucoux-cairn-ui-control.d.ts +9 -18
  96. package/types/joanroucoux-cairn-ui-delta.d.ts +46 -24
  97. package/types/joanroucoux-cairn-ui-dialog.d.ts +124 -57
  98. package/types/joanroucoux-cairn-ui-donut.d.ts +83 -46
  99. package/types/joanroucoux-cairn-ui-drawer.d.ts +73 -0
  100. package/types/joanroucoux-cairn-ui-empty.d.ts +20 -13
  101. package/types/joanroucoux-cairn-ui-external-link.d.ts +6 -10
  102. package/types/joanroucoux-cairn-ui-fact.d.ts +49 -25
  103. package/types/joanroucoux-cairn-ui-field.d.ts +72 -49
  104. package/types/joanroucoux-cairn-ui-filter-chips.d.ts +35 -20
  105. package/types/joanroucoux-cairn-ui-group-header.d.ts +58 -0
  106. package/types/joanroucoux-cairn-ui-input.d.ts +59 -37
  107. package/types/joanroucoux-cairn-ui-line-chart.d.ts +199 -89
  108. package/types/joanroucoux-cairn-ui-menu.d.ts +81 -44
  109. package/types/joanroucoux-cairn-ui-meter.d.ts +44 -22
  110. package/types/joanroucoux-cairn-ui-motion.d.ts +61 -75
  111. package/types/joanroucoux-cairn-ui-nav-item.d.ts +15 -13
  112. package/types/joanroucoux-cairn-ui-result-group.d.ts +52 -0
  113. package/types/joanroucoux-cairn-ui-row.d.ts +79 -37
  114. package/types/joanroucoux-cairn-ui-segmented.d.ts +51 -27
  115. package/types/joanroucoux-cairn-ui-select-pill.d.ts +52 -0
  116. package/types/joanroucoux-cairn-ui-select.d.ts +28 -18
  117. package/types/joanroucoux-cairn-ui-skeleton.d.ts +35 -18
  118. package/types/joanroucoux-cairn-ui-stale-link.d.ts +23 -16
  119. package/types/joanroucoux-cairn-ui-stat.d.ts +26 -21
  120. package/types/joanroucoux-cairn-ui-switch.d.ts +7 -11
  121. package/types/joanroucoux-cairn-ui-tab-bar.d.ts +20 -17
  122. package/types/joanroucoux-cairn-ui-table.d.ts +251 -89
  123. package/types/joanroucoux-cairn-ui-toast.d.ts +46 -36
  124. package/types/joanroucoux-cairn-ui.d.ts +1 -2
  125. package/fesm2022/joanroucoux-cairn-ui.mjs.map +0 -1
@@ -1,48 +1,88 @@
1
- import * as i0 from '@angular/core';
2
- import { input, computed, Component } from '@angular/core';
3
-
4
- /** Available badge variants. `BadgeVariant` is derived from this tuple. */
5
- const BADGE_VARIANTS = ['neutral', 'outline'];
6
- const BADGE_SIZES = ['md', 'sm'];
7
- const BASE_CLASSES = 'inline-flex items-center rounded-pill text-caption font-medium';
1
+ import * as i0 from "@angular/core";
2
+ import { Component, computed, input } from "@angular/core";
3
+ const BADGE_VARIANTS = ["neutral", "outline"];
4
+ const BADGE_SIZES = ["md", "sm"];
5
+ const BASE_CLASSES = "inline-flex items-center rounded-pill text-caption font-medium";
8
6
  const SIZE_CLASSES = {
9
- md: 'h-6 px-2.5',
10
- sm: 'h-[22px] px-2',
7
+ md: "h-6 px-2.5",
8
+ sm: "h-[22px] px-2"
11
9
  };
12
10
  const VARIANT_CLASSES = {
13
- neutral: 'bg-(--muted) text-(--foreground)',
14
- outline: 'shadow-[inset_0_0_0_1px_var(--border)] text-(--foreground)',
11
+ neutral: "bg-(--muted) text-(--foreground)",
12
+ outline: "shadow-[inset_0_0_0_1px_var(--border)] text-(--foreground)"
15
13
  };
16
- /**
17
- * Small status descriptor for counts, states or labels, such as an instrument's asset class.
18
- *
19
- * @example
20
- * <ui-badge>ETF</ui-badge>
21
- */
22
- class UiBadge {
23
- variant = input('neutral', /* @ts-ignore */
24
- ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
25
- size = input('md', /* @ts-ignore */
26
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
27
- classes = computed(() => `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${VARIANT_CLASSES[this.variant()]}`, /* @ts-ignore */
28
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
29
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiBadge, deps: [], target: i0.ɵɵFactoryTarget.Component });
30
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.7", type: UiBadge, isStandalone: true, selector: "ui-badge", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '<ng-content />', isInline: true });
31
- }
32
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiBadge, decorators: [{
33
- type: Component,
34
- args: [{
35
- selector: 'ui-badge',
36
- template: '<ng-content />',
37
- host: {
38
- '[class]': 'classes()',
39
- },
40
- }]
41
- }], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
42
-
43
- /**
44
- * Generated bundle index. Do not edit.
45
- */
46
-
14
+ var UiBadge = class UiBadge {
15
+ variant = input("neutral", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
16
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
17
+ classes = computed(() => `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${VARIANT_CLASSES[this.variant()]}`, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
18
+ static ɵfac = i0.ɵɵngDeclareFactory({
19
+ minVersion: "12.0.0",
20
+ version: "22.2.0",
21
+ ngImport: i0,
22
+ type: UiBadge,
23
+ deps: [],
24
+ target: i0.ɵɵFactoryTarget.Component
25
+ });
26
+ static ɵcmp = i0.ɵɵngDeclareComponent({
27
+ minVersion: "17.1.0",
28
+ version: "22.2.0",
29
+ type: UiBadge,
30
+ isStandalone: true,
31
+ selector: "ui-badge",
32
+ inputs: {
33
+ variant: {
34
+ classPropertyName: "variant",
35
+ publicName: "variant",
36
+ isSignal: true,
37
+ isRequired: false,
38
+ transformFunction: null
39
+ },
40
+ size: {
41
+ classPropertyName: "size",
42
+ publicName: "size",
43
+ isSignal: true,
44
+ isRequired: false,
45
+ transformFunction: null
46
+ }
47
+ },
48
+ host: { properties: { "class": "classes()" } },
49
+ ngImport: i0,
50
+ template: "<ng-content />",
51
+ isInline: true
52
+ });
53
+ };
54
+ i0.ɵɵngDeclareClassMetadata({
55
+ minVersion: "12.0.0",
56
+ version: "22.2.0",
57
+ ngImport: i0,
58
+ type: UiBadge,
59
+ decorators: [{
60
+ type: Component,
61
+ args: [{
62
+ selector: "ui-badge",
63
+ template: "<ng-content />",
64
+ host: { "[class]": "classes()" }
65
+ }]
66
+ }],
67
+ propDecorators: {
68
+ variant: [{
69
+ type: i0.Input,
70
+ args: [{
71
+ isSignal: true,
72
+ alias: "variant",
73
+ required: false
74
+ }]
75
+ }],
76
+ size: [{
77
+ type: i0.Input,
78
+ args: [{
79
+ isSignal: true,
80
+ alias: "size",
81
+ required: false
82
+ }]
83
+ }]
84
+ }
85
+ });
47
86
  export { BADGE_SIZES, BADGE_VARIANTS, UiBadge };
48
- //# sourceMappingURL=joanroucoux-cairn-ui-badge.mjs.map
87
+
88
+ //# sourceMappingURL=joanroucoux-cairn-ui-badge.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"joanroucoux-cairn-ui-badge.mjs","sources":["../../../projects/ui/badge/badge.ts","../../../projects/ui/badge/joanroucoux-cairn-ui-badge.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\n\n/** Available badge variants. `BadgeVariant` is derived from this tuple. */\nexport const BADGE_VARIANTS = ['neutral', 'outline'] as const;\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n\nexport const BADGE_SIZES = ['md', 'sm'] as const;\nexport type BadgeSize = (typeof BADGE_SIZES)[number];\n\nconst BASE_CLASSES = 'inline-flex items-center rounded-pill text-caption font-medium';\n\nconst SIZE_CLASSES: Record<BadgeSize, string> = {\n md: 'h-6 px-2.5',\n sm: 'h-[22px] px-2',\n};\n\nconst VARIANT_CLASSES: Record<BadgeVariant, string> = {\n neutral: 'bg-(--muted) text-(--foreground)',\n outline: 'shadow-[inset_0_0_0_1px_var(--border)] text-(--foreground)',\n};\n\n/**\n * Small status descriptor for counts, states or labels, such as an instrument's asset class.\n *\n * @example\n * <ui-badge>ETF</ui-badge>\n */\n@Component({\n selector: 'ui-badge',\n template: '<ng-content />',\n host: {\n '[class]': 'classes()',\n },\n})\nexport class UiBadge {\n readonly variant = input<BadgeVariant>('neutral');\n readonly size = input<BadgeSize>('md');\n\n protected readonly classes = computed(\n () => `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${VARIANT_CLASSES[this.variant()]}`,\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;MACa,cAAc,GAAG,CAAC,SAAS,EAAE,SAAS;MAGtC,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI;AAGtC,MAAM,YAAY,GAAG,gEAAgE;AAErF,MAAM,YAAY,GAA8B;AAC9C,IAAA,EAAE,EAAE,YAAY;AAChB,IAAA,EAAE,EAAE,eAAe;CACpB;AAED,MAAM,eAAe,GAAiC;AACpD,IAAA,OAAO,EAAE,kCAAkC;AAC3C,IAAA,OAAO,EAAE,4DAA4D;CACtE;AAED;;;;;AAKG;MAQU,OAAO,CAAA;IACT,OAAO,GAAG,KAAK,CAAe,SAAS;gFAAC;IACxC,IAAI,GAAG,KAAK,CAAY,IAAI;6EAAC;IAEnB,OAAO,GAAG,QAAQ,CACnC,MAAM,CAAA,EAAG,YAAY,CAAA,CAAA,EAAI,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA,CAAA,EAAI,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA,CAAE;gFACxF;uGANU,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA;AAAP,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,oBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,OAAO,mXALR,gBAAgB,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAKf,OAAO,EAAA,UAAA,EAAA,CAAA;kBAPnB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,UAAU;AACpB,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACvB,qBAAA;AACF,iBAAA;;;ACjCD;;AAEG;;;;"}
1
+ {"version":3,"file":"joanroucoux-cairn-ui-badge.mjs","names":[],"sources":["../../../projects/ui/badge/badge.ts"],"sourcesContent":["import { Component, computed, input } from '@angular/core';\n\n/** Available badge variants. */\nexport const BADGE_VARIANTS = ['neutral', 'outline'] as const;\nexport type BadgeVariant = (typeof BADGE_VARIANTS)[number];\n\nexport const BADGE_SIZES = ['md', 'sm'] as const;\nexport type BadgeSize = (typeof BADGE_SIZES)[number];\n\nconst BASE_CLASSES = 'inline-flex items-center rounded-pill text-caption font-medium';\n\nconst SIZE_CLASSES: Record<BadgeSize, string> = {\n md: 'h-6 px-2.5',\n sm: 'h-[22px] px-2',\n};\n\nconst VARIANT_CLASSES: Record<BadgeVariant, string> = {\n neutral: 'bg-(--muted) text-(--foreground)',\n outline: 'shadow-[inset_0_0_0_1px_var(--border)] text-(--foreground)',\n};\n\n/**\n * Small status descriptor for counts, states or labels, such as an instrument's asset class.\n *\n * @example\n * <ui-badge>ETF</ui-badge>\n */\n@Component({\n selector: 'ui-badge',\n template: '<ng-content />',\n host: {\n '[class]': 'classes()',\n },\n})\nexport class UiBadge {\n readonly variant = input<BadgeVariant>('neutral');\n readonly size = input<BadgeSize>('md');\n\n protected readonly classes = computed(\n () => `${BASE_CLASSES} ${SIZE_CLASSES[this.size()]} ${VARIANT_CLASSES[this.variant()]}`,\n );\n}\n"],"mappings":";;AAGA,MAAa,iBAAiB,CAAC,WAAW,SAAS;AAGnD,MAAa,cAAc,CAAC,MAAM,IAAI;AAGtC,MAAM,eAAe;AAErB,MAAM,eAA0C;CAC9C,IAAI;CACJ,IAAI;AACL;AAED,MAAM,kBAAgD;CACpD,SAAS;CACT,SAAS;AACV;AAeD,IAAa,UAAb,MAAa,QAAO;CACT,UAAU,MAAoB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACxC,OAAO,MAAiB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAEnB,UAAU,eACrB,GAAG,aAAY,GAAI,aAAa,KAAK,KAAI,GAAG,GAAI,gBAAgB,KAAK,QAAO,MACnF,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CANU,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAO,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAP,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAO,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,MAAA,EAAA,YAAA,EAAA,SAAA,YAAA,EAAA;EAAA,UAAA;EAAA,UALR;EAAgB,UAAA;CAAA,CAAA;;AAKf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAO,YAAA,CAAA;EAPnB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,MAAM,EACJ,WAAW,YACZ;EACF,CAAA"}
@@ -1,95 +1,136 @@
1
- import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, computed, inject, ElementRef, DestroyRef, Component } from '@angular/core';
3
- import { holdTransitionsUntilRendered } from '@joanroucoux/cairn-ui/motion';
4
-
5
- /** Available button variants. `ButtonVariant` is derived from this tuple. */
1
+ import * as i0 from "@angular/core";
2
+ import { Component, DestroyRef, ElementRef, booleanAttribute, computed, inject, input } from "@angular/core";
3
+ import { holdTransitionsUntilRendered } from "@joanroucoux/cairn-ui/motion";
6
4
  const BUTTON_VARIANTS = [
7
- 'primary',
8
- 'outline',
9
- 'ghost',
10
- 'destructive',
11
- 'quiet',
12
- 'quiet-destructive',
13
- 'outline-destructive',
14
- 'quiet-glow',
15
- 'tonal',
5
+ "primary",
6
+ "outline",
7
+ "ghost",
8
+ "destructive",
9
+ "quiet",
10
+ "quiet-destructive",
11
+ "outline-destructive",
12
+ "quiet-glow",
13
+ "tonal"
16
14
  ];
17
- /** Available button sizes. */
18
15
  const BUTTON_SIZES = [
19
- 'compact',
20
- 'slim',
21
- 'xs',
22
- 'sm',
23
- 'md',
24
- 'lg',
25
- 'xl',
26
- 'xxl',
27
- 'tall',
28
- 'block',
29
- 'icon',
30
- 'icon-sm',
16
+ "compact",
17
+ "slim",
18
+ "xs",
19
+ "sm",
20
+ "md",
21
+ "lg",
22
+ "xl",
23
+ "xxl",
24
+ "tall",
25
+ "block",
26
+ "icon",
27
+ "icon-sm"
31
28
  ];
32
- const 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-(--ring) disabled:pointer-events-none disabled:opacity-40 aria-disabled:not-aria-busy:opacity-40';
33
- const RING_OUTSIDE = 'focus-visible:outline-offset-2';
34
- const RING_INSIDE = 'focus-visible:-outline-offset-2';
35
- const OUTLINE = 'bg-(--card) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow) active:bg-(--soft)';
29
+ const 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-(--ring) disabled:pointer-events-none disabled:opacity-40 aria-disabled:not-aria-busy:opacity-40";
30
+ const RING_OUTSIDE = "focus-visible:outline-offset-2";
31
+ const RING_INSIDE = "focus-visible:-outline-offset-2";
32
+ const OUTLINE = "bg-(--card) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow) active:bg-(--soft)";
36
33
  const VARIANT_CLASSES = {
37
- primary: `${RING_OUTSIDE} bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)`,
38
- outline: `${RING_OUTSIDE} ${OUTLINE} text-(--foreground)`,
39
- ghost: `${RING_OUTSIDE} bg-transparent text-(--foreground) hover:bg-(--glow) active:bg-(--soft)`,
40
- destructive: `${RING_OUTSIDE} bg-(--destructive) text-(--destructive-foreground)`,
41
- tonal: `${RING_OUTSIDE} bg-(--muted) text-(--foreground) lg:bg-transparent lg:hover:bg-(--glow)`,
42
- 'quiet-glow': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--foreground)`,
43
- quiet: `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--soft) hover:text-(--foreground) active:bg-(--soft)`,
44
- 'quiet-destructive': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--negative) active:bg-(--soft)`,
45
- 'outline-destructive': `${RING_OUTSIDE} ${OUTLINE} text-(--negative)`,
34
+ primary: `${RING_OUTSIDE} bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)`,
35
+ outline: `${RING_OUTSIDE} ${OUTLINE} text-(--foreground)`,
36
+ ghost: `${RING_OUTSIDE} bg-transparent text-(--foreground) hover:bg-(--glow) active:bg-(--soft)`,
37
+ destructive: `${RING_OUTSIDE} bg-(--destructive) text-(--destructive-foreground)`,
38
+ tonal: `${RING_OUTSIDE} bg-(--muted) text-(--foreground) lg:bg-transparent lg:hover:bg-(--glow)`,
39
+ "quiet-glow": `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--foreground)`,
40
+ quiet: `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--soft) hover:text-(--foreground) active:bg-(--soft)`,
41
+ "quiet-destructive": `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--negative) active:bg-(--soft)`,
42
+ "outline-destructive": `${RING_OUTSIDE} ${OUTLINE} text-(--negative)`
46
43
  };
47
44
  const SIZE_CLASSES = {
48
- compact: 'h-8 lg:h-7 gap-1.5 px-2.5 lg:px-2 text-label before:absolute before:-inset-x-1 before:-inset-y-1.5 lg:before:hidden',
49
- slim: 'h-11 lg:h-8 gap-1.5 px-2.5 text-label',
50
- xs: 'h-8 gap-1.5 px-2.5 text-label',
51
- sm: 'h-9 gap-2 px-3 text-label',
52
- md: 'min-h-(--row-min) gap-2 px-4 text-label has-[>span>svg:first-child]:pl-3',
53
- lg: 'h-11 gap-2 px-[18px] text-label',
54
- xl: 'h-[50px] gap-2 px-6 text-body',
55
- xxl: 'h-[52px] lg:h-11 gap-2.5 px-6 lg:px-5 text-body lg:has-[>span>svg:first-child]:pl-4',
56
- tall: 'h-12 lg:h-10 gap-2 px-4 text-body',
57
- block: 'h-[50px] lg:h-11 gap-2 px-4 text-body',
58
- icon: 'size-(--row-min) gap-2 p-0',
59
- 'icon-sm': 'size-11 pointer-fine:size-9 gap-2 p-0',
45
+ compact: "h-8 lg:h-7 gap-1.5 px-2.5 lg:px-2 text-label before:absolute before:-inset-x-1 before:-inset-y-1.5 lg:before:hidden",
46
+ slim: "h-11 lg:h-8 gap-1.5 px-2.5 text-label",
47
+ xs: "h-8 gap-1.5 px-2.5 text-label",
48
+ sm: "h-9 gap-2 px-3 text-label",
49
+ md: "min-h-(--row-min) gap-2 px-4 text-label has-[>span>svg:first-child]:pl-3",
50
+ lg: "h-11 gap-2 px-[18px] text-label",
51
+ xl: "h-[50px] gap-2 px-6 text-body",
52
+ xxl: "h-[52px] lg:h-11 gap-2.5 px-6 lg:px-5 text-body lg:has-[>span>svg:first-child]:pl-4",
53
+ tall: "h-12 lg:h-10 gap-2 px-4 text-body",
54
+ block: "h-[50px] lg:h-11 gap-2 px-4 text-body",
55
+ icon: "size-(--row-min) gap-2 p-0",
56
+ "icon-sm": "size-11 pointer-fine:size-9 gap-2 p-0"
60
57
  };
61
- /**
62
- * Styled native button or anchor, applied as an attribute so the host keeps every native behavior.
63
- *
64
- * @example
65
- * <button ui-button variant="destructive">Delete</button>
66
- * <button ui-button size="icon" variant="ghost" aria-label="More actions">...</button>
67
- */
68
- class UiButton {
69
- variant = input('primary', /* @ts-ignore */
70
- ...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
71
- size = input('md', /* @ts-ignore */
72
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
73
- loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
74
- busy = input(false, { ...(ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
75
- inactive = computed(() => this.loading() || this.busy(), /* @ts-ignore */
76
- ...(ngDevMode ? [{ debugName: "inactive" }] : /* istanbul ignore next */ []));
77
- classes = computed(() => `${BASE_CLASSES} ${VARIANT_CLASSES[this.variant()]} ${SIZE_CLASSES[this.size()]}${this.inactive() ? ' pointer-events-none opacity-70' : ''}`, /* @ts-ignore */
78
- ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
79
- constructor() {
80
- holdTransitionsUntilRendered();
81
- const host = inject(ElementRef).nativeElement;
82
- const guard = (event) => {
83
- if (this.inactive()) {
84
- event.preventDefault();
85
- event.stopImmediatePropagation();
86
- }
87
- };
88
- host.addEventListener('click', guard, { capture: true });
89
- inject(DestroyRef).onDestroy(() => host.removeEventListener('click', guard, { capture: true }));
90
- }
91
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiButton, deps: [], target: i0.ɵɵFactoryTarget.Component });
92
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiButton, isStandalone: true, selector: "button[ui-button], a[ui-button]", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.aria-busy": "inactive() || null", "attr.aria-disabled": "inactive() || null" } }, ngImport: i0, template: `
58
+ var UiButton = class UiButton {
59
+ variant = input("primary", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
60
+ size = input("md", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
61
+ loading = input(false, {
62
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
63
+ transform: booleanAttribute
64
+ });
65
+ busy = input(false, {
66
+ ...ngDevMode ? { debugName: "busy" } : /* istanbul ignore next */ {},
67
+ transform: booleanAttribute
68
+ });
69
+ inactive = computed(() => this.loading() || this.busy(), ...ngDevMode ? [{ debugName: "inactive" }] : /* istanbul ignore next */ []);
70
+ classes = computed(() => `${BASE_CLASSES} ${VARIANT_CLASSES[this.variant()]} ${SIZE_CLASSES[this.size()]}${this.inactive() ? " pointer-events-none opacity-70" : ""}`, ...ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []);
71
+ constructor() {
72
+ holdTransitionsUntilRendered();
73
+ const host = inject(ElementRef).nativeElement;
74
+ const guard = (event) => {
75
+ if (this.inactive()) {
76
+ event.preventDefault();
77
+ event.stopImmediatePropagation();
78
+ }
79
+ };
80
+ host.addEventListener("click", guard, { capture: true });
81
+ inject(DestroyRef).onDestroy(() => host.removeEventListener("click", guard, { capture: true }));
82
+ }
83
+ static ɵfac = i0.ɵɵngDeclareFactory({
84
+ minVersion: "12.0.0",
85
+ version: "22.2.0",
86
+ ngImport: i0,
87
+ type: UiButton,
88
+ deps: [],
89
+ target: i0.ɵɵFactoryTarget.Component
90
+ });
91
+ static ɵcmp = i0.ɵɵngDeclareComponent({
92
+ minVersion: "17.0.0",
93
+ version: "22.2.0",
94
+ type: UiButton,
95
+ isStandalone: true,
96
+ selector: "button[ui-button], a[ui-button]",
97
+ inputs: {
98
+ variant: {
99
+ classPropertyName: "variant",
100
+ publicName: "variant",
101
+ isSignal: true,
102
+ isRequired: false,
103
+ transformFunction: null
104
+ },
105
+ size: {
106
+ classPropertyName: "size",
107
+ publicName: "size",
108
+ isSignal: true,
109
+ isRequired: false,
110
+ transformFunction: null
111
+ },
112
+ loading: {
113
+ classPropertyName: "loading",
114
+ publicName: "loading",
115
+ isSignal: true,
116
+ isRequired: false,
117
+ transformFunction: null
118
+ },
119
+ busy: {
120
+ classPropertyName: "busy",
121
+ publicName: "busy",
122
+ isSignal: true,
123
+ isRequired: false,
124
+ transformFunction: null
125
+ }
126
+ },
127
+ host: { properties: {
128
+ "class": "classes()",
129
+ "attr.aria-busy": "inactive() || null",
130
+ "attr.aria-disabled": "inactive() || null"
131
+ } },
132
+ ngImport: i0,
133
+ template: `
93
134
  @if (loading()) {
94
135
  <span
95
136
  aria-hidden="true"
@@ -97,13 +138,20 @@ class UiButton {
97
138
  ></span>
98
139
  }
99
140
  <span class="contents" [class.text-transparent]="loading()"><ng-content /></span>
100
- `, isInline: true });
101
- }
102
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiButton, decorators: [{
103
- type: Component,
104
- args: [{
105
- selector: 'button[ui-button], a[ui-button]',
106
- template: `
141
+ `,
142
+ isInline: true
143
+ });
144
+ };
145
+ i0.ɵɵngDeclareClassMetadata({
146
+ minVersion: "12.0.0",
147
+ version: "22.2.0",
148
+ ngImport: i0,
149
+ type: UiButton,
150
+ decorators: [{
151
+ type: Component,
152
+ args: [{
153
+ selector: "button[ui-button], a[ui-button]",
154
+ template: `
107
155
  @if (loading()) {
108
156
  <span
109
157
  aria-hidden="true"
@@ -112,17 +160,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImpor
112
160
  }
113
161
  <span class="contents" [class.text-transparent]="loading()"><ng-content /></span>
114
162
  `,
115
- host: {
116
- '[class]': 'classes()',
117
- '[attr.aria-busy]': 'inactive() || null',
118
- '[attr.aria-disabled]': 'inactive() || null',
119
- },
120
- }]
121
- }], ctorParameters: () => [], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }] } });
122
-
123
- /**
124
- * Generated bundle index. Do not edit.
125
- */
126
-
163
+ host: {
164
+ "[class]": "classes()",
165
+ "[attr.aria-busy]": "inactive() || null",
166
+ "[attr.aria-disabled]": "inactive() || null"
167
+ }
168
+ }]
169
+ }],
170
+ ctorParameters: () => [],
171
+ propDecorators: {
172
+ variant: [{
173
+ type: i0.Input,
174
+ args: [{
175
+ isSignal: true,
176
+ alias: "variant",
177
+ required: false
178
+ }]
179
+ }],
180
+ size: [{
181
+ type: i0.Input,
182
+ args: [{
183
+ isSignal: true,
184
+ alias: "size",
185
+ required: false
186
+ }]
187
+ }],
188
+ loading: [{
189
+ type: i0.Input,
190
+ args: [{
191
+ isSignal: true,
192
+ alias: "loading",
193
+ required: false
194
+ }]
195
+ }],
196
+ busy: [{
197
+ type: i0.Input,
198
+ args: [{
199
+ isSignal: true,
200
+ alias: "busy",
201
+ required: false
202
+ }]
203
+ }]
204
+ }
205
+ });
127
206
  export { BUTTON_SIZES, BUTTON_VARIANTS, UiButton };
128
- //# sourceMappingURL=joanroucoux-cairn-ui-button.mjs.map
207
+
208
+ //# sourceMappingURL=joanroucoux-cairn-ui-button.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"joanroucoux-cairn-ui-button.mjs","sources":["../../../projects/ui/button/button.ts","../../../projects/ui/button/joanroucoux-cairn-ui-button.ts"],"sourcesContent":["import { Component, DestroyRef, ElementRef, booleanAttribute, computed, inject, input } from '@angular/core';\n\nimport { holdTransitionsUntilRendered } from '@joanroucoux/cairn-ui/motion';\n\n/** Available button variants. `ButtonVariant` is derived from this tuple. */\nexport const BUTTON_VARIANTS = [\n 'primary',\n 'outline',\n 'ghost',\n 'destructive',\n 'quiet',\n 'quiet-destructive',\n 'outline-destructive',\n 'quiet-glow',\n 'tonal',\n] as const;\nexport type ButtonVariant = (typeof BUTTON_VARIANTS)[number];\n\n/** Available button sizes. */\nexport const BUTTON_SIZES = [\n 'compact',\n 'slim',\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'xxl',\n 'tall',\n 'block',\n 'icon',\n 'icon-sm',\n] as const;\nexport type ButtonSize = (typeof BUTTON_SIZES)[number];\n\nconst BASE_CLASSES =\n '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-(--ring) disabled:pointer-events-none disabled:opacity-40 aria-disabled:not-aria-busy:opacity-40';\n\nconst RING_OUTSIDE = 'focus-visible:outline-offset-2';\nconst RING_INSIDE = 'focus-visible:-outline-offset-2';\nconst OUTLINE = 'bg-(--card) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow) active:bg-(--soft)';\n\nconst VARIANT_CLASSES: Record<ButtonVariant, string> = {\n primary: `${RING_OUTSIDE} bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)`,\n outline: `${RING_OUTSIDE} ${OUTLINE} text-(--foreground)`,\n ghost: `${RING_OUTSIDE} bg-transparent text-(--foreground) hover:bg-(--glow) active:bg-(--soft)`,\n destructive: `${RING_OUTSIDE} bg-(--destructive) text-(--destructive-foreground)`,\n tonal: `${RING_OUTSIDE} bg-(--muted) text-(--foreground) lg:bg-transparent lg:hover:bg-(--glow)`,\n 'quiet-glow': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--foreground)`,\n quiet: `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--soft) hover:text-(--foreground) active:bg-(--soft)`,\n 'quiet-destructive': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--negative) active:bg-(--soft)`,\n 'outline-destructive': `${RING_OUTSIDE} ${OUTLINE} text-(--negative)`,\n};\n\nconst SIZE_CLASSES: Record<ButtonSize, string> = {\n compact:\n 'h-8 lg:h-7 gap-1.5 px-2.5 lg:px-2 text-label before:absolute before:-inset-x-1 before:-inset-y-1.5 lg:before:hidden',\n slim: 'h-11 lg:h-8 gap-1.5 px-2.5 text-label',\n xs: 'h-8 gap-1.5 px-2.5 text-label',\n sm: 'h-9 gap-2 px-3 text-label',\n md: 'min-h-(--row-min) gap-2 px-4 text-label has-[>span>svg:first-child]:pl-3',\n lg: 'h-11 gap-2 px-[18px] text-label',\n xl: 'h-[50px] gap-2 px-6 text-body',\n xxl: 'h-[52px] lg:h-11 gap-2.5 px-6 lg:px-5 text-body lg:has-[>span>svg:first-child]:pl-4',\n tall: 'h-12 lg:h-10 gap-2 px-4 text-body',\n block: 'h-[50px] lg:h-11 gap-2 px-4 text-body',\n icon: 'size-(--row-min) gap-2 p-0',\n 'icon-sm': 'size-11 pointer-fine:size-9 gap-2 p-0',\n};\n\n/**\n * Styled native button or anchor, applied as an attribute so the host keeps every native behavior.\n *\n * @example\n * <button ui-button variant=\"destructive\">Delete</button>\n * <button ui-button size=\"icon\" variant=\"ghost\" aria-label=\"More actions\">...</button>\n */\n@Component({\n selector: 'button[ui-button], a[ui-button]',\n template: `\n @if (loading()) {\n <span\n aria-hidden=\"true\"\n class=\"rounded-pill animate-cairn-spin absolute inset-0 m-auto size-4 border-2 border-current border-r-transparent\"\n ></span>\n }\n <span class=\"contents\" [class.text-transparent]=\"loading()\"><ng-content /></span>\n `,\n host: {\n '[class]': 'classes()',\n '[attr.aria-busy]': 'inactive() || null',\n '[attr.aria-disabled]': 'inactive() || null',\n },\n})\nexport class UiButton {\n readonly variant = input<ButtonVariant>('primary');\n readonly size = input<ButtonSize>('md');\n readonly loading = input(false, { transform: booleanAttribute });\n readonly busy = input(false, { transform: booleanAttribute });\n\n protected readonly inactive = computed(() => this.loading() || this.busy());\n\n protected readonly classes = computed(\n () =>\n `${BASE_CLASSES} ${VARIANT_CLASSES[this.variant()]} ${SIZE_CLASSES[this.size()]}${this.inactive() ? ' pointer-events-none opacity-70' : ''}`,\n );\n\n constructor() {\n holdTransitionsUntilRendered();\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const guard = (event: Event): void => {\n if (this.inactive()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n host.addEventListener('click', guard, { capture: true });\n inject(DestroyRef).onDestroy(() => host.removeEventListener('click', guard, { capture: true }));\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAIA;AACO,MAAM,eAAe,GAAG;IAC7B,SAAS;IACT,SAAS;IACT,OAAO;IACP,aAAa;IACb,OAAO;IACP,mBAAmB;IACnB,qBAAqB;IACrB,YAAY;IACZ,OAAO;;AAIT;AACO,MAAM,YAAY,GAAG;IAC1B,SAAS;IACT,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;IACN,OAAO;IACP,MAAM;IACN,SAAS;;AAIX,MAAM,YAAY,GAChB,waAAwa;AAE1a,MAAM,YAAY,GAAG,gCAAgC;AACrD,MAAM,WAAW,GAAG,iCAAiC;AACrD,MAAM,OAAO,GAAG,yFAAyF;AAEzG,MAAM,eAAe,GAAkC;IACrD,OAAO,EAAE,CAAA,EAAG,YAAY,CAAA,mEAAA,CAAqE;AAC7F,IAAA,OAAO,EAAE,CAAA,EAAG,YAAY,CAAA,CAAA,EAAI,OAAO,CAAA,oBAAA,CAAsB;IACzD,KAAK,EAAE,CAAA,EAAG,YAAY,CAAA,wEAAA,CAA0E;IAChG,WAAW,EAAE,CAAA,EAAG,YAAY,CAAA,mDAAA,CAAqD;IACjF,KAAK,EAAE,CAAA,EAAG,YAAY,CAAA,wEAAA,CAA0E;IACh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IAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,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,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,WAAA,EAAA,gBAAA,EAAA,oBAAA,EAAA,oBAAA,EAAA,oBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,EAfT;;;;;;;;AAQT,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA;;2FAOU,QAAQ,EAAA,UAAA,EAAA,CAAA;kBAjBpB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,iCAAiC;AAC3C,oBAAA,QAAQ,EAAE;;;;;;;;AAQT,EAAA,CAAA;AACD,oBAAA,IAAI,EAAE;AACJ,wBAAA,SAAS,EAAE,WAAW;AACtB,wBAAA,kBAAkB,EAAE,oBAAoB;AACxC,wBAAA,sBAAsB,EAAE,oBAAoB;AAC7C,qBAAA;AACF,iBAAA;;;AC7FD;;AAEG;;;;"}
1
+ {"version":3,"file":"joanroucoux-cairn-ui-button.mjs","names":[],"sources":["../../../projects/ui/button/button.ts"],"sourcesContent":["import { Component, DestroyRef, ElementRef, booleanAttribute, computed, inject, input } from '@angular/core';\n\nimport { holdTransitionsUntilRendered } from '@joanroucoux/cairn-ui/motion';\n\n/** Available button variants. */\nexport const BUTTON_VARIANTS = [\n 'primary',\n 'outline',\n 'ghost',\n 'destructive',\n 'quiet',\n 'quiet-destructive',\n 'outline-destructive',\n 'quiet-glow',\n 'tonal',\n] as const;\nexport type ButtonVariant = (typeof BUTTON_VARIANTS)[number];\n\n/** Available button sizes. */\nexport const BUTTON_SIZES = [\n 'compact',\n 'slim',\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'xxl',\n 'tall',\n 'block',\n 'icon',\n 'icon-sm',\n] as const;\nexport type ButtonSize = (typeof BUTTON_SIZES)[number];\n\nconst BASE_CLASSES =\n '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-(--ring) disabled:pointer-events-none disabled:opacity-40 aria-disabled:not-aria-busy:opacity-40';\n\nconst RING_OUTSIDE = 'focus-visible:outline-offset-2';\nconst RING_INSIDE = 'focus-visible:-outline-offset-2';\nconst OUTLINE = 'bg-(--card) shadow-[inset_0_0_0_1px_var(--border)] hover:bg-(--glow) active:bg-(--soft)';\n\nconst VARIANT_CLASSES: Record<ButtonVariant, string> = {\n primary: `${RING_OUTSIDE} bg-(--primary) text-(--primary-foreground) hover:bg-(--primary-to)`,\n outline: `${RING_OUTSIDE} ${OUTLINE} text-(--foreground)`,\n ghost: `${RING_OUTSIDE} bg-transparent text-(--foreground) hover:bg-(--glow) active:bg-(--soft)`,\n destructive: `${RING_OUTSIDE} bg-(--destructive) text-(--destructive-foreground)`,\n tonal: `${RING_OUTSIDE} bg-(--muted) text-(--foreground) lg:bg-transparent lg:hover:bg-(--glow)`,\n 'quiet-glow': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--foreground)`,\n quiet: `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--soft) hover:text-(--foreground) active:bg-(--soft)`,\n 'quiet-destructive': `${RING_INSIDE} bg-transparent text-(--muted-foreground) hover:bg-(--glow) hover:text-(--negative) active:bg-(--soft)`,\n 'outline-destructive': `${RING_OUTSIDE} ${OUTLINE} text-(--negative)`,\n};\n\nconst SIZE_CLASSES: Record<ButtonSize, string> = {\n compact:\n 'h-8 lg:h-7 gap-1.5 px-2.5 lg:px-2 text-label before:absolute before:-inset-x-1 before:-inset-y-1.5 lg:before:hidden',\n slim: 'h-11 lg:h-8 gap-1.5 px-2.5 text-label',\n xs: 'h-8 gap-1.5 px-2.5 text-label',\n sm: 'h-9 gap-2 px-3 text-label',\n md: 'min-h-(--row-min) gap-2 px-4 text-label has-[>span>svg:first-child]:pl-3',\n lg: 'h-11 gap-2 px-[18px] text-label',\n xl: 'h-[50px] gap-2 px-6 text-body',\n xxl: 'h-[52px] lg:h-11 gap-2.5 px-6 lg:px-5 text-body lg:has-[>span>svg:first-child]:pl-4',\n tall: 'h-12 lg:h-10 gap-2 px-4 text-body',\n block: 'h-[50px] lg:h-11 gap-2 px-4 text-body',\n icon: 'size-(--row-min) gap-2 p-0',\n 'icon-sm': 'size-11 pointer-fine:size-9 gap-2 p-0',\n};\n\n/**\n * Styled native button or anchor, applied as an attribute so the host keeps every native behavior.\n *\n * @example\n * <button ui-button variant=\"destructive\">Delete</button>\n * <button ui-button size=\"icon\" variant=\"ghost\" aria-label=\"More actions\">...</button>\n */\n@Component({\n selector: 'button[ui-button], a[ui-button]',\n template: `\n @if (loading()) {\n <span\n aria-hidden=\"true\"\n class=\"rounded-pill animate-cairn-spin absolute inset-0 m-auto size-4 border-2 border-current border-r-transparent\"\n ></span>\n }\n <span class=\"contents\" [class.text-transparent]=\"loading()\"><ng-content /></span>\n `,\n host: {\n '[class]': 'classes()',\n '[attr.aria-busy]': 'inactive() || null',\n '[attr.aria-disabled]': 'inactive() || null',\n },\n})\nexport class UiButton {\n readonly variant = input<ButtonVariant>('primary');\n readonly size = input<ButtonSize>('md');\n readonly loading = input(false, { transform: booleanAttribute });\n readonly busy = input(false, { transform: booleanAttribute });\n\n protected readonly inactive = computed(() => this.loading() || this.busy());\n\n protected readonly classes = computed(\n () =>\n `${BASE_CLASSES} ${VARIANT_CLASSES[this.variant()]} ${SIZE_CLASSES[this.size()]}${this.inactive() ? ' pointer-events-none opacity-70' : ''}`,\n );\n\n constructor() {\n holdTransitionsUntilRendered();\n const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n const guard = (event: Event): void => {\n if (this.inactive()) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n host.addEventListener('click', guard, { capture: true });\n inject(DestroyRef).onDestroy(() => host.removeEventListener('click', guard, { capture: true }));\n }\n}\n"],"mappings":";;;AAKA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAIV,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACQ;AAGV,MAAM,eACJ;AAEF,MAAM,eAAe;AACrB,MAAM,cAAc;AACpB,MAAM,UAAU;AAEhB,MAAM,kBAAiD;CACrD,SAAS,GAAG,aAAY;CACxB,SAAS,GAAG,aAAY,GAAI,QAAO;CACnC,OAAO,GAAG,aAAY;CACtB,aAAa,GAAG,aAAY;CAC5B,OAAO,GAAG,aAAY;CACtB,cAAc,GAAG,YAAW;CAC5B,OAAO,GAAG,YAAW;CACrB,qBAAqB,GAAG,YAAW;CACnC,uBAAuB,GAAG,aAAY,GAAI,QAAO;AAClD;AAED,MAAM,eAA2C;CAC/C,SACE;CACF,MAAM;CACN,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,MAAM;CACN,OAAO;CACP,MAAM;CACN,WAAW;AACZ;AA0BD,IAAa,WAAb,MAAa,SAAQ;CACV,UAAU,MAAqB,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CACzC,OAAO,MAAkB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAC9B,UAAU,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA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