@devschile/chucao 2.6.0 → 2.7.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 (209) hide show
  1. package/dist/chucao/chucao.esm.js +1 -1
  2. package/dist/chucao/{p-ffaf1a31.entry.js → p-01b6c7bf.entry.js} +2 -2
  3. package/dist/chucao/{p-2c1bc8bd.entry.js → p-0c7f6f8d.entry.js} +2 -2
  4. package/dist/chucao/p-10f6801e.entry.js +2 -0
  5. package/dist/chucao/p-10f6801e.entry.js.map +1 -0
  6. package/dist/chucao/{p-0409c063.entry.js → p-15d27bb7.entry.js} +2 -2
  7. package/dist/chucao/{p-e6f959f4.entry.js → p-1b70e3f1.entry.js} +2 -2
  8. package/dist/chucao/{p-66ae9e2c.entry.js → p-1e4cd3aa.entry.js} +2 -2
  9. package/dist/chucao/{p-c1b35f1b.entry.js → p-2e37c61b.entry.js} +2 -2
  10. package/dist/chucao/{p-f7305552.entry.js → p-42028c97.entry.js} +2 -2
  11. package/dist/chucao/{p-090d26f1.entry.js → p-472ec451.entry.js} +2 -2
  12. package/dist/chucao/{p-81b6622f.entry.js → p-5240f5ac.entry.js} +2 -2
  13. package/dist/chucao/p-60e1c1df.entry.js +2 -0
  14. package/dist/chucao/{p-b56f4a29.entry.js.map → p-60e1c1df.entry.js.map} +1 -1
  15. package/dist/chucao/{p-b9b47942.entry.js → p-7cdc71cc.entry.js} +2 -2
  16. package/dist/chucao/{p-50cbea7f.entry.js → p-8ae680a4.entry.js} +2 -2
  17. package/dist/chucao/{p-20ea1b18.entry.js → p-90284ebe.entry.js} +2 -2
  18. package/dist/chucao/p-9db118d9.entry.js +2 -0
  19. package/dist/chucao/p-9ebcc7be.entry.js +2 -0
  20. package/dist/chucao/p-9ebcc7be.entry.js.map +1 -0
  21. package/dist/chucao/{p-207648f9.entry.js → p-a7c674b7.entry.js} +2 -2
  22. package/dist/chucao/{p-79f20bfd.entry.js → p-c4b2bd1f.entry.js} +2 -2
  23. package/dist/chucao/{p-7d4336bd.entry.js → p-c90da3c0.entry.js} +2 -2
  24. package/dist/chucao/p-d8b71751.entry.js +2 -0
  25. package/dist/chucao/p-d8b71751.entry.js.map +1 -0
  26. package/dist/chucao/{p-925af6b8.entry.js → p-deb2571b.entry.js} +2 -2
  27. package/dist/chucao/{p-9794a3fa.entry.js → p-e77d35c3.entry.js} +2 -2
  28. package/dist/chucao/{p-21ca2235.entry.js → p-f6ab0a11.entry.js} +2 -2
  29. package/dist/chucao/p-f917d34f.entry.js +2 -0
  30. package/dist/chucao/{p-e2f725bd.entry.js.map → p-f917d34f.entry.js.map} +1 -1
  31. package/dist/chucao/{p-f0aea6ed.entry.js → p-ffecdf25.entry.js} +2 -2
  32. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  33. package/dist/cjs/ch-alert_8.cjs.entry.js +7 -7
  34. package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
  35. package/dist/cjs/ch-cluster.cjs.entry.js +2 -2
  36. package/dist/cjs/ch-description-list.cjs.entry.js +1 -1
  37. package/dist/cjs/ch-divider.cjs.entry.js +1 -1
  38. package/dist/cjs/ch-drawer.cjs.entry.js +1 -1
  39. package/dist/cjs/ch-emoji.cjs.entry.js +1 -1
  40. package/dist/cjs/ch-empty-state.cjs.entry.js +1 -1
  41. package/dist/cjs/ch-grid.cjs.entry.js +1 -1
  42. package/dist/cjs/ch-icon-button.cjs.entry.js +1 -1
  43. package/dist/cjs/ch-icon.cjs.entry.js +1 -1
  44. package/dist/cjs/ch-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/ch-number-input.cjs.entry.js +237 -0
  46. package/dist/cjs/ch-number-input.cjs.entry.js.map +1 -0
  47. package/dist/cjs/ch-page-header.cjs.entry.js +1 -1
  48. package/dist/cjs/ch-radio.cjs.entry.js +1 -1
  49. package/dist/cjs/ch-segmented-control.cjs.entry.js +1 -1
  50. package/dist/cjs/ch-skeleton.cjs.entry.js +1 -1
  51. package/dist/cjs/ch-stack.cjs.entry.js +1 -1
  52. package/dist/cjs/ch-stat.cjs.entry.js +2 -2
  53. package/dist/cjs/ch-table.cjs.entry.js +145 -0
  54. package/dist/cjs/ch-table.cjs.entry.js.map +1 -0
  55. package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
  56. package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
  57. package/dist/cjs/ch-timeline.cjs.entry.js +1 -1
  58. package/dist/cjs/ch-tooltip.cjs.entry.js +24 -7
  59. package/dist/cjs/ch-tooltip.cjs.entry.js.map +1 -1
  60. package/dist/cjs/chucao.cjs.js +1 -1
  61. package/dist/cjs/loader.cjs.js +1 -1
  62. package/dist/collection/collection-manifest.json +2 -0
  63. package/dist/collection/components/ch-accordion/ch-accordion.js +1 -1
  64. package/dist/collection/components/ch-alert/ch-alert.js +1 -1
  65. package/dist/collection/components/ch-badge/ch-badge.js +1 -1
  66. package/dist/collection/components/ch-card/ch-card.js +1 -1
  67. package/dist/collection/components/ch-checkbox/ch-checkbox.js +1 -1
  68. package/dist/collection/components/ch-cluster/ch-cluster.js +2 -2
  69. package/dist/collection/components/ch-description-list/ch-description-list.js +1 -1
  70. package/dist/collection/components/ch-divider/ch-divider.js +1 -1
  71. package/dist/collection/components/ch-drawer/ch-drawer.js +1 -1
  72. package/dist/collection/components/ch-emoji/ch-emoji.js +1 -1
  73. package/dist/collection/components/ch-empty-state/ch-empty-state.js +1 -1
  74. package/dist/collection/components/ch-grid/ch-grid.js +1 -1
  75. package/dist/collection/components/ch-icon/ch-icon.js +1 -1
  76. package/dist/collection/components/ch-icon-button/ch-icon-button.js +1 -1
  77. package/dist/collection/components/ch-input/ch-input.js +1 -1
  78. package/dist/collection/components/ch-modal/ch-modal.js +1 -1
  79. package/dist/collection/components/ch-number-input/ch-number-input.css +74 -0
  80. package/dist/collection/components/ch-number-input/ch-number-input.js +555 -0
  81. package/dist/collection/components/ch-number-input/ch-number-input.js.map +1 -0
  82. package/dist/collection/components/ch-page-header/ch-page-header.js +1 -1
  83. package/dist/collection/components/ch-radio/ch-radio.js +1 -1
  84. package/dist/collection/components/ch-segmented-control/ch-segmented-control.js +1 -1
  85. package/dist/collection/components/ch-select/ch-select.js +1 -1
  86. package/dist/collection/components/ch-skeleton/ch-skeleton.js +1 -1
  87. package/dist/collection/components/ch-spinner/ch-spinner.js +1 -1
  88. package/dist/collection/components/ch-stack/ch-stack.js +1 -1
  89. package/dist/collection/components/ch-stat/ch-stat.js +2 -2
  90. package/dist/collection/components/ch-switch/ch-switch.js +1 -1
  91. package/dist/collection/components/ch-table/ch-table.css +107 -0
  92. package/dist/collection/components/ch-table/ch-table.js +347 -0
  93. package/dist/collection/components/ch-table/ch-table.js.map +1 -0
  94. package/dist/collection/components/ch-tabs/ch-tabs.js +1 -1
  95. package/dist/collection/components/ch-textarea/ch-textarea.js +1 -1
  96. package/dist/collection/components/ch-timeline/ch-timeline.js +1 -1
  97. package/dist/collection/components/ch-tooltip/ch-tooltip.css +11 -0
  98. package/dist/collection/components/ch-tooltip/ch-tooltip.js +23 -6
  99. package/dist/collection/components/ch-tooltip/ch-tooltip.js.map +1 -1
  100. package/dist/collection/utils/overlay.js.map +1 -1
  101. package/dist/components/ch-accordion.js +1 -1
  102. package/dist/components/ch-alert.js +1 -1
  103. package/dist/components/ch-badge.js +1 -1
  104. package/dist/components/ch-button.js +1 -1
  105. package/dist/components/ch-card.js +1 -1
  106. package/dist/components/ch-card.js.map +1 -1
  107. package/dist/components/ch-checkbox.js +1 -1
  108. package/dist/components/ch-cluster.js +1 -1
  109. package/dist/components/ch-description-list.js +1 -1
  110. package/dist/components/ch-divider.js +1 -1
  111. package/dist/components/ch-drawer.js +1 -1
  112. package/dist/components/ch-emoji.js +1 -1
  113. package/dist/components/ch-empty-state.js +1 -1
  114. package/dist/components/ch-grid.js +1 -1
  115. package/dist/components/ch-icon-button.js +1 -1
  116. package/dist/components/ch-icon.js +1 -1
  117. package/dist/components/ch-input.js +1 -1
  118. package/dist/components/ch-modal.js +1 -1
  119. package/dist/components/ch-number-input.d.ts +11 -0
  120. package/dist/components/ch-number-input.js +2 -0
  121. package/dist/components/ch-number-input.js.map +1 -0
  122. package/dist/components/ch-page-header.js +1 -1
  123. package/dist/components/ch-radio.js +1 -1
  124. package/dist/components/ch-segmented-control.js +1 -1
  125. package/dist/components/ch-select.js +1 -1
  126. package/dist/components/ch-skeleton.js +1 -1
  127. package/dist/components/ch-spinner.js +1 -1
  128. package/dist/components/ch-stack.js +1 -1
  129. package/dist/components/ch-stat.js +1 -1
  130. package/dist/components/ch-switch.js +1 -1
  131. package/dist/components/ch-table.d.ts +11 -0
  132. package/dist/components/ch-table.js +2 -0
  133. package/dist/components/ch-table.js.map +1 -0
  134. package/dist/components/ch-tabs.js +1 -1
  135. package/dist/components/ch-textarea.js +1 -1
  136. package/dist/components/ch-timeline.js +1 -1
  137. package/dist/components/ch-tooltip.js +1 -1
  138. package/dist/components/ch-tooltip.js.map +1 -1
  139. package/dist/components/{p-Cw0b4OGc.js → p-DiUN1WGc.js} +2 -2
  140. package/dist/esm/ch-accordion.entry.js +1 -1
  141. package/dist/esm/ch-alert_8.entry.js +7 -7
  142. package/dist/esm/ch-checkbox.entry.js +1 -1
  143. package/dist/esm/ch-cluster.entry.js +2 -2
  144. package/dist/esm/ch-description-list.entry.js +1 -1
  145. package/dist/esm/ch-divider.entry.js +1 -1
  146. package/dist/esm/ch-drawer.entry.js +1 -1
  147. package/dist/esm/ch-emoji.entry.js +1 -1
  148. package/dist/esm/ch-empty-state.entry.js +1 -1
  149. package/dist/esm/ch-grid.entry.js +1 -1
  150. package/dist/esm/ch-icon-button.entry.js +1 -1
  151. package/dist/esm/ch-icon.entry.js +1 -1
  152. package/dist/esm/ch-modal.entry.js +1 -1
  153. package/dist/esm/ch-number-input.entry.js +235 -0
  154. package/dist/esm/ch-number-input.entry.js.map +1 -0
  155. package/dist/esm/ch-page-header.entry.js +1 -1
  156. package/dist/esm/ch-radio.entry.js +1 -1
  157. package/dist/esm/ch-segmented-control.entry.js +1 -1
  158. package/dist/esm/ch-skeleton.entry.js +1 -1
  159. package/dist/esm/ch-stack.entry.js +1 -1
  160. package/dist/esm/ch-stat.entry.js +2 -2
  161. package/dist/esm/ch-table.entry.js +143 -0
  162. package/dist/esm/ch-table.entry.js.map +1 -0
  163. package/dist/esm/ch-tabs.entry.js +1 -1
  164. package/dist/esm/ch-textarea.entry.js +1 -1
  165. package/dist/esm/ch-timeline.entry.js +1 -1
  166. package/dist/esm/ch-tooltip.entry.js +24 -7
  167. package/dist/esm/ch-tooltip.entry.js.map +1 -1
  168. package/dist/esm/chucao.js +1 -1
  169. package/dist/esm/loader.js +1 -1
  170. package/dist/types/components/ch-number-input/ch-number-input.d.ts +105 -0
  171. package/dist/types/components/ch-table/ch-table.d.ts +106 -0
  172. package/dist/types/components/ch-tooltip/ch-tooltip.d.ts +7 -0
  173. package/dist/types/components.d.ts +459 -0
  174. package/dist/types/utils/overlay.d.ts +1 -1
  175. package/dist-react/components.d.ts +15 -1
  176. package/dist-react/components.js +21 -0
  177. package/dist-react/components.ts +31 -1
  178. package/dist-vue/index.d.ts +2 -0
  179. package/dist-vue/index.js +33 -0
  180. package/dist-vue/index.ts +37 -0
  181. package/hydrate/index.js +519 -37
  182. package/hydrate/index.mjs +519 -37
  183. package/package.json +9 -1
  184. package/dist/chucao/p-370d9629.entry.js +0 -2
  185. package/dist/chucao/p-370d9629.entry.js.map +0 -1
  186. package/dist/chucao/p-95061461.entry.js +0 -2
  187. package/dist/chucao/p-b56f4a29.entry.js +0 -2
  188. package/dist/chucao/p-e2f725bd.entry.js +0 -2
  189. /package/dist/chucao/{p-ffaf1a31.entry.js.map → p-01b6c7bf.entry.js.map} +0 -0
  190. /package/dist/chucao/{p-2c1bc8bd.entry.js.map → p-0c7f6f8d.entry.js.map} +0 -0
  191. /package/dist/chucao/{p-0409c063.entry.js.map → p-15d27bb7.entry.js.map} +0 -0
  192. /package/dist/chucao/{p-e6f959f4.entry.js.map → p-1b70e3f1.entry.js.map} +0 -0
  193. /package/dist/chucao/{p-66ae9e2c.entry.js.map → p-1e4cd3aa.entry.js.map} +0 -0
  194. /package/dist/chucao/{p-c1b35f1b.entry.js.map → p-2e37c61b.entry.js.map} +0 -0
  195. /package/dist/chucao/{p-f7305552.entry.js.map → p-42028c97.entry.js.map} +0 -0
  196. /package/dist/chucao/{p-090d26f1.entry.js.map → p-472ec451.entry.js.map} +0 -0
  197. /package/dist/chucao/{p-81b6622f.entry.js.map → p-5240f5ac.entry.js.map} +0 -0
  198. /package/dist/chucao/{p-b9b47942.entry.js.map → p-7cdc71cc.entry.js.map} +0 -0
  199. /package/dist/chucao/{p-50cbea7f.entry.js.map → p-8ae680a4.entry.js.map} +0 -0
  200. /package/dist/chucao/{p-20ea1b18.entry.js.map → p-90284ebe.entry.js.map} +0 -0
  201. /package/dist/chucao/{p-95061461.entry.js.map → p-9db118d9.entry.js.map} +0 -0
  202. /package/dist/chucao/{p-207648f9.entry.js.map → p-a7c674b7.entry.js.map} +0 -0
  203. /package/dist/chucao/{p-79f20bfd.entry.js.map → p-c4b2bd1f.entry.js.map} +0 -0
  204. /package/dist/chucao/{p-7d4336bd.entry.js.map → p-c90da3c0.entry.js.map} +0 -0
  205. /package/dist/chucao/{p-925af6b8.entry.js.map → p-deb2571b.entry.js.map} +0 -0
  206. /package/dist/chucao/{p-9794a3fa.entry.js.map → p-e77d35c3.entry.js.map} +0 -0
  207. /package/dist/chucao/{p-21ca2235.entry.js.map → p-f6ab0a11.entry.js.map} +0 -0
  208. /package/dist/chucao/{p-f0aea6ed.entry.js.map → p-ffecdf25.entry.js.map} +0 -0
  209. /package/dist/components/{p-Cw0b4OGc.js.map → p-DiUN1WGc.js.map} +0 -0
@@ -0,0 +1,237 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-ByZY6aTj.js');
4
+ var validationMessage = require('./validation-message-bbtJ2sa_.js');
5
+
6
+ const chNumberInputCss = () => `:host{display:inline-block;width:100%}.label{display:block;margin-bottom:var(--spacing-sm);font-size:var(--typography-size-sm);font-weight:var(--typography-weight-semibold);color:var(--text)}.input{box-sizing:border-box;width:100%;padding:var(--spacing-xl) var(--spacing-3xl);border-radius:var(--radius);border:var(--border-width) solid var(--border);background:var(--surface);color:var(--text);backdrop-filter:blur(var(--effect-blur));font-family:inherit;font-size:inherit;transition:border-color var(--duration-normal) var(--easing-default), box-shadow var(--duration-normal) var(--easing-default)}.input::placeholder{color:var(--text-muted)}.input:focus{border-color:var(--accent);box-shadow:var(--shadow-focus-ring);outline:none}.input--invalid{border-color:var(--color-status-warning)}.input--invalid:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}:host([data-touched]:invalid) .input,:host(:user-invalid) .input{border-color:var(--color-status-warning)}:host([data-touched]:invalid) .input:focus,:host(:user-invalid) .input:focus{border-color:var(--color-status-warning);box-shadow:0 0 0 3px var(--color-status-warning-background)}.input:disabled{opacity:var(--opacity-disabled);cursor:not-allowed}.hint,.error{margin:var(--spacing-sm) 0 0;font-size:var(--typography-size-sm);color:var(--text-muted)}.error{color:var(--color-status-warning)}`;
7
+
8
+ let numberInputIds = 0;
9
+ const ChNumberInput = class {
10
+ constructor(hostRef) {
11
+ index.registerInstance(this, hostRef);
12
+ this.chInput = index.createEvent(this, "chInput");
13
+ this.chChange = index.createEvent(this, "chChange");
14
+ if (hostRef.$hostElement$["s-ei"]) {
15
+ this.internals = hostRef.$hostElement$["s-ei"];
16
+ }
17
+ else {
18
+ this.internals = hostRef.$hostElement$.attachInternals();
19
+ hostRef.$hostElement$["s-ei"] = this.internals;
20
+ }
21
+ }
22
+ inputId = `ch-number-input-${++numberInputIds}`;
23
+ hintId = `${this.inputId}-hint`;
24
+ errorId = `${this.inputId}-error`;
25
+ initialValue = '';
26
+ internals;
27
+ formDisabled = false;
28
+ get host() { return index.getElement(this); }
29
+ /** Visible label, associated with the input via `for`/`id`. */
30
+ label;
31
+ /**
32
+ * Canonical value: digits only for `clp`, a plain decimal string for `plain`.
33
+ * Never formatted — formatting lives in the rendered text.
34
+ */
35
+ value = '';
36
+ /** How the number is displayed while typing. */
37
+ format = 'plain';
38
+ /** Placeholder shown when the field is empty. */
39
+ placeholder;
40
+ /** Name submitted with the form. */
41
+ name;
42
+ /** Whether the field is disabled. */
43
+ disabled = false;
44
+ /** Whether a value is required; an empty field is then invalid. */
45
+ required = false;
46
+ /** Minimum accepted value. */
47
+ min;
48
+ /** Maximum accepted value. */
49
+ max;
50
+ /** Stepping increment. `'any'` disables stepping validation. */
51
+ step = 'any';
52
+ /** Helper text, replaced by `errorMessage` when invalid. */
53
+ hint;
54
+ /** Custom error message; wins over the built-in range messages. */
55
+ errorMessage;
56
+ /** Whether the field is marked invalid by the consumer. */
57
+ invalid = false;
58
+ /** Emitted on every keystroke with the canonical value. */
59
+ chInput;
60
+ /** Emitted on commit (native `change`) with the canonical value. */
61
+ chChange;
62
+ /**
63
+ * The text in the input, which may be a partial number like `-` or `1.`.
64
+ * This is the only thing rendered, so it is also what a reset must restore.
65
+ */
66
+ draft = '';
67
+ /**
68
+ * Whether the user has typed since the last commit. While false the input
69
+ * renders `value` directly, which is what makes `formResetCallback` and a
70
+ * consumer assigning `.value` repaint without extra bookkeeping.
71
+ */
72
+ typing = false;
73
+ componentWillLoad() {
74
+ this.draft = this.formatDisplay(this.value);
75
+ }
76
+ get decimals() {
77
+ return this.format !== 'clp';
78
+ }
79
+ /** Formats a canonical value for display. */
80
+ formatDisplay(value) {
81
+ if (value === '') {
82
+ return '';
83
+ }
84
+ if (this.format === 'clp') {
85
+ const digits = value.replace(/\D/gu, '');
86
+ return digits === '' ? '' : Number(digits).toLocaleString('es-CL');
87
+ }
88
+ return value;
89
+ }
90
+ /**
91
+ * Strips display formatting back to the canonical string: digits only for
92
+ * CLP; a leading sign, digits and one decimal separator for `plain`.
93
+ */
94
+ toCanonical(text) {
95
+ if (this.format === 'clp') {
96
+ return text.replace(/\D/gu, '');
97
+ }
98
+ const normalised = text.replace(/\s/gu, '').replace(',', '.');
99
+ const match = /^-?\d*(?:\.\d*)?/u.exec(normalised);
100
+ return match ? match[0] : '';
101
+ }
102
+ /**
103
+ * Whether the field holds a real number. A draft that is only a sign or a
104
+ * separator (`-`, `.`) is still being typed and submits as empty.
105
+ */
106
+ get isEmpty() {
107
+ return !/^-?\d/u.test(this.toCanonical(this.draft));
108
+ }
109
+ /** What the form receives and `value` exposes. */
110
+ get canonical() {
111
+ return this.isEmpty ? '' : this.toCanonical(this.draft);
112
+ }
113
+ get numericValue() {
114
+ return Number(this.canonical);
115
+ }
116
+ /** The message for a value outside `min`/`max`, if there is one. */
117
+ outOfRange(parsed) {
118
+ const { min, max } = this;
119
+ if (min !== undefined && parsed < min) {
120
+ return `Enter a value of at least ${min}.`;
121
+ }
122
+ if (max !== undefined && parsed > max) {
123
+ return `Enter a value of at most ${max}.`;
124
+ }
125
+ return undefined;
126
+ }
127
+ rangeError() {
128
+ if (this.errorMessage || this.isEmpty || this.invalid) {
129
+ return undefined;
130
+ }
131
+ const parsed = this.numericValue;
132
+ return Number.isNaN(parsed) ? 'Enter a valid number.' : this.outOfRange(parsed);
133
+ }
134
+ syncForm() {
135
+ const { internals, required, invalid, errorMessage, canonical } = this;
136
+ if (typeof internals?.setFormValue !== 'function') {
137
+ return;
138
+ }
139
+ internals.setFormValue(canonical);
140
+ const base = validationMessage.resolveValidity({ required, empty: canonical === '', invalid, errorMessage });
141
+ const rangeMessage = this.rangeError();
142
+ if (rangeMessage) {
143
+ internals.setValidity({ ...base.flags, badInput: true }, rangeMessage);
144
+ return;
145
+ }
146
+ internals.setValidity(base.flags, base.message);
147
+ }
148
+ componentDidLoad() {
149
+ this.initialValue = this.value;
150
+ this.syncForm();
151
+ this.host.addEventListener('change', this.markTouched);
152
+ this.host.addEventListener('focusout', this.markTouched);
153
+ this.host.addEventListener('invalid', this.markTouched);
154
+ }
155
+ markTouched = () => {
156
+ this.host.setAttribute('data-touched', '');
157
+ };
158
+ formResetCallback() {
159
+ this.value = this.initialValue;
160
+ this.draft = this.formatDisplay(this.initialValue);
161
+ this.typing = false;
162
+ this.syncForm();
163
+ // The vdom does not push a re-rendered `value` onto a live `<input>`: the
164
+ // property is set by the browser's own typing and the diff sees no change.
165
+ // A reset restores the text directly.
166
+ const input = this.host.shadowRoot?.querySelector('input');
167
+ if (input) {
168
+ input.value = this.formatDisplay(this.initialValue);
169
+ }
170
+ }
171
+ formDisabledCallback(isDisabled) {
172
+ this.formDisabled = isDisabled;
173
+ }
174
+ commit(text) {
175
+ this.typing = true;
176
+ this.draft = text;
177
+ this.value = this.canonical;
178
+ this.chInput.emit(this.value);
179
+ this.syncForm();
180
+ }
181
+ handleInput = (ev) => {
182
+ this.commit(ev.target.value);
183
+ };
184
+ handleChange = (ev) => {
185
+ this.commit(ev.target.value);
186
+ this.chChange.emit(this.value);
187
+ };
188
+ /** Reformats grouped CLP digits once the field loses focus. */
189
+ handleBlur = () => {
190
+ if (this.format === 'clp') {
191
+ this.draft = this.formatDisplay(this.canonical);
192
+ }
193
+ };
194
+ get isInvalid() {
195
+ return this.invalid || this.rangeError() !== undefined;
196
+ }
197
+ get describedBy() {
198
+ if (this.isInvalid && this.errorMessage) {
199
+ return this.errorId;
200
+ }
201
+ if (this.hint) {
202
+ return this.hintId;
203
+ }
204
+ return undefined;
205
+ }
206
+ render() {
207
+ const showError = this.isInvalid && this.errorMessage;
208
+ return (index.h(index.Host, { key: '1c424d9d76ec39e6cc6018d6ba483f95bd203d32' }, this.label && (index.h("label", { key: '4fc03334128c33cc425da773df063cd99fee215c', class: "label", htmlFor: this.inputId }, this.label)), index.h("input", { key: 'ece15737f83c181d615e906aba5cce80c0bcb8ba', id: this.label ? this.inputId : undefined, class: { 'input': true, 'input--invalid': this.isInvalid },
209
+ // `text` with `inputmode`, not `type="number"`: a number input drops
210
+ // partial values and cannot show grouped digits.
211
+ type: "text", inputMode: this.decimals ? 'decimal' : 'numeric', name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.typing ? this.draft : this.formatDisplay(this.value), "aria-invalid": this.isInvalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange, onBlur: this.handleBlur }), this.hint && !showError && (index.h("p", { key: '7a2e3031b8bfebf26857dd60eb18340f21a01f3d', class: "hint", id: this.hintId }, this.hint)), showError && (index.h("p", { key: 'f90492532d27088f18b258f885d5d471f31d27cb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
212
+ }
213
+ static get formAssociated() { return true; }
214
+ static get watchers() { return {
215
+ "required": [{
216
+ "syncForm": 0
217
+ }],
218
+ "invalid": [{
219
+ "syncForm": 0
220
+ }],
221
+ "errorMessage": [{
222
+ "syncForm": 0
223
+ }],
224
+ "min": [{
225
+ "syncForm": 0
226
+ }],
227
+ "max": [{
228
+ "syncForm": 0
229
+ }]
230
+ }; }
231
+ };
232
+ ChNumberInput.style = chNumberInputCss();
233
+
234
+ exports.ch_number_input = ChNumberInput;
235
+ //# sourceMappingURL=ch-number-input.entry.cjs.js.map
236
+
237
+ //# sourceMappingURL=ch-number-input.cjs.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"ch-number-input.cjs.entry.js","mappings":";;;;;AAAA,MAAM,gBAAgB,GAAG,MAAM,CAAC,m4CAAm4C,CAAC;;ACQp6C,IAAI,cAAc,GAAG,CAAC;MAwBT,aAAa,GAAA,MAAA;;;;;;;;;;;;;AACP,IAAA,OAAO,GAAG,CAAA,gBAAA,EAAmB,EAAE,cAAc,EAAE;AAC/C,IAAA,MAAM,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,OAAO;AAC/B,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,OAAO,QAAQ;IAC1C,YAAY,GAAG,EAAE;AAEN,IAAA,SAAS;IACnB,YAAY,GAAG,KAAK;;;AAIrB,IAAA,KAAK;AAEb;;;AAGG;IACsB,KAAK,GAAG,EAAE;;IAG3B,MAAM,GAAwB,OAAO;;AAGrC,IAAA,WAAW;;AA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AC,IAAI,IAAI,CAAC,SAAS,KACtBA,OAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,MAAM,EAAC,EAAE,EAAE,IAAI,CAAC,MAAM,IAC5B,IAAI,CAAC,IAAI,CACR,CACL,EACA,SAAS,KACRA,OAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,EAAC,OAAO,EAAA,EAC5C,IAAI,CAAC,YAAY,CAChB,CACL,CACI;;;;;;;;;;;;;;;;;;;;;;;;;","names":["resolveValidity","h","Host"],"sources":["src/components/ch-number-input/ch-number-input.css?tag=ch-number-input&encapsulation=shadow","src/components/ch-number-input/ch-number-input.tsx"],"sourcesContent":[":host {\n display: inline-block;\n width: 100%;\n}\n\n.label {\n display: block;\n margin-bottom: var(--spacing-sm);\n font-size: var(--typography-size-sm);\n font-weight: var(--typography-weight-semibold);\n color: var(--text);\n}\n\n.input {\n box-sizing: border-box;\n width: 100%;\n padding: var(--spacing-xl) var(--spacing-3xl);\n border-radius: var(--radius);\n border: var(--border-width) solid var(--border);\n background: var(--surface);\n color: var(--text);\n backdrop-filter: blur(var(--effect-blur));\n font-family: inherit;\n font-size: inherit;\n transition:\n border-color var(--duration-normal) var(--easing-default),\n box-shadow var(--duration-normal) var(--easing-default);\n}\n\n.input::placeholder {\n color: var(--text-muted);\n}\n\n.input:focus {\n border-color: var(--accent);\n box-shadow: var(--shadow-focus-ring);\n outline: none;\n}\n\n.input--invalid {\n border-color: var(--color-status-warning);\n}\n\n.input--invalid:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n:host([data-touched]:invalid) .input,\n:host(:user-invalid) .input {\n border-color: var(--color-status-warning);\n}\n\n:host([data-touched]:invalid) .input:focus,\n:host(:user-invalid) .input:focus {\n border-color: var(--color-status-warning);\n box-shadow: 0 0 0 3px var(--color-status-warning-background);\n}\n\n.input:disabled {\n opacity: var(--opacity-disabled);\n cursor: not-allowed;\n}\n\n.hint,\n.error {\n margin: var(--spacing-sm) 0 0;\n font-size: var(--typography-size-sm);\n color: var(--text-muted);\n}\n\n.error {\n color: var(--color-status-warning);\n}\n","import { AttachInternals, Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nimport { resolveValidity } from '../../utils/validation-message';\n\nexport type ChNumberInputFormat = 'plain' | 'clp';\n\nexport type ChNumberInputStep = number | 'any';\n\nlet numberInputIds = 0;\n\n/**\n * Numeric input that keeps what the user is typing separate from the value the\n * form submits.\n *\n * The display is formatted (`1.234.567` for CLP) while `value` and `FormData`\n * carry a canonical machine-readable string: digits only for CLP, the plain\n * decimal for `plain`. Parsing on every keystroke cannot represent the\n * intermediate states people actually type — `-`, `1.`, `0,` — so those stay as\n * text and are validated at the end.\n *\n * Empty is not zero. A cleared field submits `''` and reports `valueMissing`\n * when required; it never becomes `0`.\n *\n * There is no separate currency component: `format=\"clp\"` is the currency\n * boundary for Chilean pesos, the only case with a real consumer.\n */\n@Component({\n tag: 'ch-number-input',\n styleUrl: 'ch-number-input.css',\n shadow: true,\n formAssociated: true,\n})\nexport class ChNumberInput {\n private readonly inputId = `ch-number-input-${++numberInputIds}`;\n private readonly hintId = `${this.inputId}-hint`;\n private readonly errorId = `${this.inputId}-error`;\n private initialValue = '';\n\n @AttachInternals() internals!: ElementInternals;\n @State() formDisabled = false;\n @Element() private host!: HTMLElement;\n\n /** Visible label, associated with the input via `for`/`id`. */\n @Prop() label?: string;\n\n /**\n * Canonical value: digits only for `clp`, a plain decimal string for `plain`.\n * Never formatted — formatting lives in the rendered text.\n */\n @Prop({ mutable: true }) value = '';\n\n /** How the number is displayed while typing. */\n @Prop() format: ChNumberInputFormat = 'plain';\n\n /** Placeholder shown when the field is empty. */\n @Prop() placeholder?: string;\n\n /** Name submitted with the form. */\n @Prop({ reflect: true }) name?: string;\n\n /** Whether the field is disabled. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Whether a value is required; an empty field is then invalid. */\n @Prop({ reflect: true }) required = false;\n\n /** Minimum accepted value. */\n @Prop() min?: number;\n\n /** Maximum accepted value. */\n @Prop() max?: number;\n\n /** Stepping increment. `'any'` disables stepping validation. */\n @Prop() step: ChNumberInputStep = 'any';\n\n /** Helper text, replaced by `errorMessage` when invalid. */\n @Prop() hint?: string;\n\n /** Custom error message; wins over the built-in range messages. */\n @Prop() errorMessage?: string;\n\n /** Whether the field is marked invalid by the consumer. */\n @Prop() invalid = false;\n\n /** Emitted on every keystroke with the canonical value. */\n @Event() chInput: EventEmitter<string>;\n\n /** Emitted on commit (native `change`) with the canonical value. */\n @Event() chChange: EventEmitter<string>;\n\n /**\n * The text in the input, which may be a partial number like `-` or `1.`.\n * This is the only thing rendered, so it is also what a reset must restore.\n */\n @State() private draft = '';\n\n /**\n * Whether the user has typed since the last commit. While false the input\n * renders `value` directly, which is what makes `formResetCallback` and a\n * consumer assigning `.value` repaint without extra bookkeeping.\n */\n @State() private typing = false;\n\n componentWillLoad() {\n this.draft = this.formatDisplay(this.value);\n }\n\n private get decimals(): boolean {\n return this.format !== 'clp';\n }\n\n /** Formats a canonical value for display. */\n private formatDisplay(value: string): string {\n if (value === '') {\n return '';\n }\n if (this.format === 'clp') {\n const digits = value.replace(/\\D/gu, '');\n return digits === '' ? '' : Number(digits).toLocaleString('es-CL');\n }\n return value;\n }\n\n /**\n * Strips display formatting back to the canonical string: digits only for\n * CLP; a leading sign, digits and one decimal separator for `plain`.\n */\n private toCanonical(text: string): string {\n if (this.format === 'clp') {\n return text.replace(/\\D/gu, '');\n }\n const normalised = text.replace(/\\s/gu, '').replace(',', '.');\n const match = /^-?\\d*(?:\\.\\d*)?/u.exec(normalised);\n return match ? match[0] : '';\n }\n\n /**\n * Whether the field holds a real number. A draft that is only a sign or a\n * separator (`-`, `.`) is still being typed and submits as empty.\n */\n private get isEmpty(): boolean {\n return !/^-?\\d/u.test(this.toCanonical(this.draft));\n }\n\n /** What the form receives and `value` exposes. */\n private get canonical(): string {\n return this.isEmpty ? '' : this.toCanonical(this.draft);\n }\n\n private get numericValue(): number {\n return Number(this.canonical);\n }\n\n /** The message for a value outside `min`/`max`, if there is one. */\n private outOfRange(parsed: number): string | undefined {\n const { min, max } = this;\n if (min !== undefined && parsed < min) {\n return `Enter a value of at least ${min}.`;\n }\n if (max !== undefined && parsed > max) {\n return `Enter a value of at most ${max}.`;\n }\n return undefined;\n }\n\n private rangeError(): string | undefined {\n if (this.errorMessage || this.isEmpty || this.invalid) {\n return undefined;\n }\n const parsed = this.numericValue;\n return Number.isNaN(parsed) ? 'Enter a valid number.' : this.outOfRange(parsed);\n }\n\n @Watch('required')\n @Watch('invalid')\n @Watch('errorMessage')\n @Watch('min')\n @Watch('max')\n protected syncForm(): void {\n const { internals, required, invalid, errorMessage, canonical } = this;\n if (typeof internals?.setFormValue !== 'function') {\n return;\n }\n internals.setFormValue(canonical);\n\n const base = resolveValidity({ required, empty: canonical === '', invalid, errorMessage });\n const rangeMessage = this.rangeError();\n if (rangeMessage) {\n internals.setValidity({ ...base.flags, badInput: true }, rangeMessage);\n return;\n }\n internals.setValidity(base.flags, base.message);\n }\n\n componentDidLoad() {\n this.initialValue = this.value;\n this.syncForm();\n this.host.addEventListener('change', this.markTouched);\n this.host.addEventListener('focusout', this.markTouched);\n this.host.addEventListener('invalid', this.markTouched);\n }\n\n private markTouched = (): void => {\n this.host.setAttribute('data-touched', '');\n };\n\n formResetCallback(): void {\n this.value = this.initialValue;\n this.draft = this.formatDisplay(this.initialValue);\n this.typing = false;\n this.syncForm();\n // The vdom does not push a re-rendered `value` onto a live `<input>`: the\n // property is set by the browser's own typing and the diff sees no change.\n // A reset restores the text directly.\n const input = this.host.shadowRoot?.querySelector('input');\n if (input) {\n input.value = this.formatDisplay(this.initialValue);\n }\n }\n\n formDisabledCallback(isDisabled: boolean): void {\n this.formDisabled = isDisabled;\n }\n\n private commit(text: string): void {\n this.typing = true;\n this.draft = text;\n this.value = this.canonical;\n this.chInput.emit(this.value);\n this.syncForm();\n }\n\n private handleInput = (ev: InputEvent) => {\n this.commit((ev.target as HTMLInputElement).value);\n };\n\n private handleChange = (ev: Event) => {\n this.commit((ev.target as HTMLInputElement).value);\n this.chChange.emit(this.value);\n };\n\n /** Reformats grouped CLP digits once the field loses focus. */\n private handleBlur = () => {\n if (this.format === 'clp') {\n this.draft = this.formatDisplay(this.canonical);\n }\n };\n\n private get isInvalid(): boolean {\n return this.invalid || this.rangeError() !== undefined;\n }\n\n private get describedBy(): string | undefined {\n if (this.isInvalid && this.errorMessage) {\n return this.errorId;\n }\n if (this.hint) {\n return this.hintId;\n }\n return undefined;\n }\n\n render() {\n const showError = this.isInvalid && this.errorMessage;\n return (\n <Host>\n {this.label && (\n <label class=\"label\" htmlFor={this.inputId}>\n {this.label}\n </label>\n )}\n <input\n id={this.label ? this.inputId : undefined}\n class={{ 'input': true, 'input--invalid': this.isInvalid }}\n // `text` with `inputmode`, not `type=\"number\"`: a number input drops\n // partial values and cannot show grouped digits.\n type=\"text\"\n inputMode={this.decimals ? 'decimal' : 'numeric'}\n name={this.name}\n placeholder={this.placeholder}\n disabled={this.disabled || this.formDisabled}\n required={this.required}\n value={this.typing ? this.draft : this.formatDisplay(this.value)}\n aria-invalid={this.isInvalid ? 'true' : undefined}\n aria-describedby={this.describedBy}\n onInput={this.handleInput}\n onChange={this.handleChange}\n onBlur={this.handleBlur}\n />\n {this.hint && !showError && (\n <p class=\"hint\" id={this.hintId}>\n {this.hint}\n </p>\n )}\n {showError && (\n <p class=\"error\" id={this.errorId} role=\"alert\">\n {this.errorMessage}\n </p>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -34,7 +34,7 @@ const ChPageHeader = class {
34
34
  actionsStacked = false;
35
35
  render() {
36
36
  const Heading = this.headingLevel;
37
- return (index.h(index.Host, { key: '0e2bc8c10790e1f6f36a4c679579ac775f6ec3a4' }, index.h("div", { key: '8ef9876c61f0ff325fedfb899d2e09c02b8e5e53', class: { 'header': true, 'header--stacked': this.actionsStacked } }, index.h("div", { key: '3bef4d66f8d69397c4117e9d4a0637e978abbe2e', class: "header-text" }, this.eyebrow && index.h("p", { key: '1ae504669807c48d95d12ce5b7d488f85e5dc864', class: "header-eyebrow" }, this.eyebrow), index.h(Heading, { key: '9b6374d6b1d18124e49acf67af08443175f4bbaa', class: "header-title" }, this.title), this.description && index.h("p", { key: '9c3d2d58f1c2dde2c70fc5f86eb2d580a13f8594', class: "header-description" }, this.description)), index.h("div", { key: '3b48c89c2a8c4c5d3e42f6b78db80b3e9c2e0c50', class: "header-actions" }, index.h("slot", { key: '77b2010fec0113af7c8ee7c7bcd884dd11b05138', name: "actions" })))));
37
+ return (index.h(index.Host, { key: '3d8de76e3df7fba8be55d0708861c7d136b05722' }, index.h("div", { key: '057d2b4359b9faff34b9fbf6886b04d5d89dc9ac', class: { 'header': true, 'header--stacked': this.actionsStacked } }, index.h("div", { key: '1ff40b1cd100d41a72d80ab35e619f93b4a43633', class: "header-text" }, this.eyebrow && index.h("p", { key: '6c2538bf1d450a6dca25fd2815968a9622f7fcbf', class: "header-eyebrow" }, this.eyebrow), index.h(Heading, { key: '54cdf8e62468e11cf9fe084023e4fe624f958452', class: "header-title" }, this.title), this.description && index.h("p", { key: 'fe9c6cc78354b38b8833871ddc53d412007abe29', class: "header-description" }, this.description)), index.h("div", { key: 'e91a66715e2c23478c375ce9ddcf29c04f85b3eb', class: "header-actions" }, index.h("slot", { key: '06654c2a28d004791ed5b9c213cd66ef80bbcc85', name: "actions" })))));
38
38
  }
39
39
  };
40
40
  ChPageHeader.style = chPageHeaderCss();
@@ -114,7 +114,7 @@ const ChRadio = class {
114
114
  }
115
115
  render() {
116
116
  const groupName = this.name || `${this.groupId}-group`;
117
- return (index.h(index.Host, { key: 'f55466f6bcbe3283d294161c02498419066ca958' }, this.label && (index.h("span", { key: '789131e7d8812ee930db5e0a0c6dc7f7e353249f', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: 'fc0a7adbde7feaaca99d156d45aacb6d18d5588e', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), index.h("span", { class: "mark" }), index.h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: '53f3e9d368cfefa9a4d85010b65f002a3b92e0f4', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '517b7204ebf91042d293be294d7e936954eb80fb', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
117
+ return (index.h(index.Host, { key: 'a027da2d803a6e8a2a35afa1920dd3b0f8e06b01' }, this.label && (index.h("span", { key: '28e11cd1148a89a4f3e85d331f00e39f1d7751ce', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: '43d8a53c9bec1dc129b6588c0118ebe2109b4b7e', class: "radio-group", role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: { 'input': true, 'input--invalid': this.invalid }, type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onChange: this.handleChange }), index.h("span", { class: "mark" }), index.h("span", { class: "label-text" }, option.label))))), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: '27335cc50f8b280f93857eea370aa37e2290b46b', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '83f93bdc0739961136062acb784a3d6e666de349', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
118
118
  }
119
119
  static get formAssociated() { return true; }
120
120
  static get watchers() { return {
@@ -93,7 +93,7 @@ const ChSegmentedControl = class {
93
93
  }
94
94
  render() {
95
95
  const groupName = this.name || `${this.groupId}-group`;
96
- return (index.h(index.Host, { key: 'a8782886fd0c20fa96a5a54c9997fe9d91d3e670' }, this.label && (index.h("span", { key: '99a2727035a62f71d01f07e0cf222becb118d3b2', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: '31b293c379a996e06650c1a6c9fe9c46c32097a2', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), index.h("span", { class: "label-text" }, option.label)))))));
96
+ return (index.h(index.Host, { key: '59e0782a5c120cd243bbd67eb727ba1a7755d45f' }, this.label && (index.h("span", { key: 'f1faf9b240224e4c2b10059ed7bf667e24e5997d', class: "group-label", id: this.labelId }, this.label)), index.h("div", { key: 'b9e59c0fbd4af04ad4d079415497440ec0a60801', class: { segmented: true, [`segmented--${this.size}`]: true }, role: "radiogroup", "aria-labelledby": this.label ? this.labelId : undefined }, this.options.map(option => (index.h("label", { class: { 'control': true, 'control--disabled': this.disabled || this.formDisabled || option.disabled } }, index.h("input", { class: "input", type: "radio", name: groupName, value: option.value, checked: option.value === this.value, disabled: this.disabled || this.formDisabled || option.disabled, onChange: this.handleChange }), index.h("span", { class: "label-text" }, option.label)))))));
97
97
  }
98
98
  static get formAssociated() { return true; }
99
99
  static get watchers() { return {
@@ -47,7 +47,7 @@ const ChSkeleton = class {
47
47
  return { width: this.width, height: this.height };
48
48
  }
49
49
  render() {
50
- return (index.h(index.Host, { key: '705e4cd6dac9c8c8578cb8133a700c3297d9fffe', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index$1) => (index.h("span", { class: "skeleton__item", style: this.sizeStyle, key: index$1, "data-index": String(value) })))));
50
+ return (index.h(index.Host, { key: 'b28cd1be6da1721ff6b93ed1e4bab119ea066ad4', "aria-hidden": "true", class: { 'skeleton': true, [`skeleton--${this.shape}`]: true, 'skeleton--animated': this.animated } }, Array.from({ length: this.items }).map((value, index$1) => (index.h("span", { class: "skeleton__item", style: this.sizeStyle, key: index$1, "data-index": String(value) })))));
51
51
  }
52
52
  };
53
53
  ChSkeleton.style = chSkeletonCss();
@@ -26,7 +26,7 @@ const ChStack = class {
26
26
  return GAPS.has(this.gap) ? this.gap : 'md';
27
27
  }
28
28
  render() {
29
- return (index.h(index.Host, { key: 'd4ee90331cd1ff0d65eb9c80aa684d3b2f5e2876', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, index.h("slot", { key: 'bdfe358adc457ed6ba79ca80b9e96f17597fbcb5' })));
29
+ return (index.h(index.Host, { key: '1c70344ce291ba78a533f99ac6c4c135296251e1', class: { stack: true, [`stack--gap-${this.gapStep}`]: true, [`stack--align-${this.align}`]: true, [`stack--justify-${this.justify}`]: true } }, index.h("slot", { key: 'f4167e47a2fdee42f97611fba5907d79f8d0448d' })));
30
30
  }
31
31
  };
32
32
  ChStack.style = chStackCss();
@@ -32,10 +32,10 @@ const ChStat = class {
32
32
  }
33
33
  render() {
34
34
  const cue = this.toneClass === 'positive' ? '+' : this.toneClass === 'negative' ? '−' : null;
35
- return (index.h(index.Host, { key: '5a43c713faab1513866d8f06899bb3fd3184cf09', class: "stat" }, index.h("div", { key: '9c24e9774cfe0a70b8ba37c06ce7f264b34a9d8c', class: "stat__inner" }, index.h("span", { key: '1a9330c2b31ec6de29f1b8c77761d7eb16160aae', class: "stat__label" }, this.label), index.h("span", { key: '3f6c5e76f5c062effcb9793206a949942bcdfb9a', class: {
35
+ return (index.h(index.Host, { key: '76d71c964efeb4e5a07aabff0b895f1ded21b345', class: "stat" }, index.h("div", { key: '103db766f21c91c8406e8d3368049f4e4a018007', class: "stat__inner" }, index.h("span", { key: '74e45654072a92ba4f894aee5366852561f8f352', class: "stat__label" }, this.label), index.h("span", { key: 'deb8d0d20c70d7fbab392641fd9d0e617ab8daf5', class: {
36
36
  stat__value: true,
37
37
  [`stat__value--${this.toneClass}`]: this.toneClass !== 'default',
38
- } }, cue && (index.h("span", { key: 'b5f79899ec52e7e2b3ec3c00295f755f770a8bca', class: "stat__cue", "aria-hidden": "true" }, cue)), index.h("slot", { key: 'b64083aa5738b4088cf9029650286b2564649ec9', name: "value" }, this.value)), this.hint && index.h("span", { key: '9f560c1f1fd23f08ea63eccc9076066a7fd1a0f9', class: "stat__hint" }, this.hint), index.h("div", { key: '77f3fe1f87e3abc2cce829e06b21f6b2c5f9aa15', class: "stat__footer" }, index.h("slot", { key: 'd75204702eab0ab1f55df92e9c13c899235f6840', name: "footer" })))));
38
+ } }, cue && (index.h("span", { key: '82b83cb7182f10ceca5172fc790aad01882645cc', class: "stat__cue", "aria-hidden": "true" }, cue)), index.h("slot", { key: 'e9c3095eca4ed3907fc0e95395f3cc62bfd4158a', name: "value" }, this.value)), this.hint && index.h("span", { key: '4b892b35299def40a62c386e6af7c5f19aebe44b', class: "stat__hint" }, this.hint), index.h("div", { key: '0535d9fb62ddf5ed1ee2b5993689cb080f753ff9', class: "stat__footer" }, index.h("slot", { key: '1d8e09fa8db2d4a6e188f8deaa93631df9cc2a36', name: "footer" })))));
39
39
  }
40
40
  };
41
41
  ChStat.style = chStatCss();
@@ -0,0 +1,145 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-ByZY6aTj.js');
4
+
5
+ const chTableCss = () => `:host{display:block;font-family:var(--typography-body);color:var(--color-text-primary)}:host([hidden]){display:none}.table__scroll{overflow-x:auto;min-width:0;border:var(--border-width) solid var(--color-border-default);border-radius:var(--radius-md);background:var(--color-surface-default)}.table__scroll:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.table{width:100%;border-collapse:collapse;font-size:var(--typography-size-sm)}.cell{min-width:8rem}.caption{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.cell{padding:var(--spacing-md) var(--spacing-lg);text-align:left;vertical-align:top;border-bottom:var(--border-width) solid var(--color-border-default)}.cell--header{font-weight:var(--typography-weight-semibold);color:var(--color-text-secondary);white-space:nowrap;background:var(--color-surface-hover)}tbody tr:last-child td{border-bottom:0}.sort{all:unset;display:inline-flex;align-items:center;gap:var(--spacing-xs);cursor:pointer;border-radius:var(--radius-sm)}.sort:focus-visible{outline:2px solid var(--color-accent-default);outline-offset:2px}.sort__cue{font-size:var(--typography-size-xs);color:var(--color-text-secondary)}.table__empty{padding:var(--spacing-2xl) var(--spacing-lg);text-align:center}.table__empty-message{margin:0;font-size:var(--typography-size-sm);color:var(--color-text-secondary)}`;
6
+
7
+ let tableIds = 0;
8
+ const ChTable = class {
9
+ constructor(hostRef) {
10
+ index.registerInstance(this, hostRef);
11
+ this.chSort = index.createEvent(this, "chSort");
12
+ }
13
+ captionId = `ch-table-${++tableIds}-caption`;
14
+ emptyId = `${this.captionId}-empty`;
15
+ get host() { return index.getElement(this); }
16
+ /** Columns, in display order. Rendered as the header row. */
17
+ columns = [];
18
+ /** Whether the header offers sorting. Individual columns can opt out. */
19
+ sortable = false;
20
+ /** Key of the column currently used for sorting. Controlled by the consumer. */
21
+ sortKey;
22
+ /** Direction of the current sort. Defaults to `ascending`. */
23
+ sortDirection = 'ascending';
24
+ /**
25
+ * Accessible name for the table. Always rendered as a caption, visually
26
+ * hidden, because a data table without a name is announced as a bare grid.
27
+ */
28
+ label;
29
+ /**
30
+ * Shown in place of the rows when the body is empty. `filtered` distinguishes
31
+ * "nothing matched your filters" from "there is nothing yet", which are
32
+ * different messages and different next actions.
33
+ */
34
+ empty = 'unmeasured';
35
+ /**
36
+ * Marks the body as empty *because of filtering* rather than because there is
37
+ * no data at all. Both look like zero rows, and they need different messages
38
+ * and different next actions.
39
+ */
40
+ filtered = false;
41
+ /** Emitted when a sortable header is activated. The consumer applies the sort. */
42
+ chSort;
43
+ onFiltered() {
44
+ this.measure();
45
+ }
46
+ rerenderHeaders() {
47
+ // Header attributes are derived from controlled props, so a prop change
48
+ // has to repaint them; `columns` and the slot repaint on their own.
49
+ this.rerender = !this.rerender;
50
+ }
51
+ rerender = false;
52
+ observer;
53
+ componentDidLoad() {
54
+ this.measure();
55
+ // `slotchange` does not fire for native `<tr>` children, and it only fires
56
+ // at all once the element is upgraded, so a row added later would leave the
57
+ // table stuck on its first measurement. Observing the host covers both
58
+ // orders plus a consumer that swaps rows on refresh. `MutationObserver` is
59
+ // absent in the mock-doc test environment, where the slot behaviour is
60
+ // exercised through an explicit `slotchange` instead.
61
+ if (typeof MutationObserver === 'function') {
62
+ this.observer = new MutationObserver(this.measure);
63
+ this.observer.observe(this.host, { childList: true });
64
+ }
65
+ }
66
+ disconnectedCallback() {
67
+ this.observer?.disconnect();
68
+ this.observer = undefined;
69
+ }
70
+ measure = () => {
71
+ const rows = Array.from(this.host.children).filter(child => child.tagName === 'TR');
72
+ this.empty = rows.length === 0 ? 'true' : 'none';
73
+ };
74
+ /**
75
+ * A filtered-empty body and a truly empty one both have zero rows; only the
76
+ * consumer knows which, since `filtered` is a prop it controls.
77
+ */
78
+ get emptyState() {
79
+ if (this.filtered) {
80
+ return 'filtered';
81
+ }
82
+ return this.empty;
83
+ }
84
+ /** Direction glyph. Not colour: the arrow is the cue in greyscale. */
85
+ sortCue(active) {
86
+ if (!active) {
87
+ return '⇅';
88
+ }
89
+ return this.sortDirection === 'ascending' ? '▲' : '▼';
90
+ }
91
+ emptyMessage(state) {
92
+ return state === 'filtered' ? 'No results for these filters.' : 'Nothing here yet.';
93
+ }
94
+ nextDirection(key) {
95
+ if (this.sortKey !== key) {
96
+ return 'ascending';
97
+ }
98
+ return this.sortDirection === 'ascending' ? 'descending' : 'ascending';
99
+ }
100
+ handleSort = (key) => {
101
+ this.chSort.emit({ key, direction: this.nextDirection(key) });
102
+ };
103
+ handleHeaderKeydown = (ev, key) => {
104
+ if (ev.key !== 'Enter' && ev.key !== ' ') {
105
+ return;
106
+ }
107
+ ev.preventDefault();
108
+ this.handleSort(key);
109
+ };
110
+ renderHeaderCell(column) {
111
+ const sortable = this.sortable && column.sortable !== false;
112
+ if (!sortable) {
113
+ return (index.h("th", { scope: "col", class: "cell cell--header" }, column.label));
114
+ }
115
+ const active = this.sortKey === column.key;
116
+ const direction = active ? this.sortDirection : 'none';
117
+ return (index.h("th", { scope: "col", class: "cell cell--header", "aria-sort": direction }, index.h("button", { type: "button", class: "sort", onClick: () => this.handleSort(column.key), onKeyDown: ev => this.handleHeaderKeydown(ev, column.key) }, index.h("span", null, column.label), index.h("span", { class: "sort__cue", "aria-hidden": "true" }, this.sortCue(active)))));
118
+ }
119
+ render() {
120
+ const empty = this.emptyState;
121
+ // Before the first measurement the table is rendered as non-empty, so a
122
+ // consumer never sees the empty message flash over real rows.
123
+ return (index.h(index.Host, { key: 'f4511d753b9140b08eee0e50041ba4e7408930ec', class: { 'table': true, 'table--empty': empty === 'true' || empty === 'filtered' } }, index.h("div", { key: '8cc987803f5d000d7efbbc6b605561d2c6ca1c46', class: "table__scroll", tabIndex: 0, role: "group", "aria-labelledby": this.captionId }, index.h("table", { key: '9eff6abfe0fecfd3559bfe397db3957fa60e288a' }, index.h("caption", { key: '35d88e56267aff1ae9753326ffc807cf6e04bfba', id: this.captionId, class: "caption" }, this.label), index.h("thead", { key: '0b01e865f3c0f40e9e86634f701b77886713e2e3' }, index.h("tr", { key: '92ded28a12867b8a2a372a9b04e8fd251870a5c7' }, this.columns.map(column => this.renderHeaderCell(column)))), index.h("tbody", { key: '68d7a49aa51cf1e958f1af7ebc36cdb5f6acfdd0' }, index.h("slot", { key: '79e296699379971e93b8a91b7823987be835ce8e' })))), (empty === 'true' || empty === 'filtered') && (index.h("div", { key: 'b7b2734f3d83ced393377fbe6f2911d2466ce714', class: "table__empty", id: this.emptyId }, index.h("slot", { key: '926191c01eef1f1898ad7fc800824021a697da35', name: "empty" }, index.h("p", { key: '6302a52795029b3d31200ae3c1c4ff53af3ab81c', class: "table__empty-message" }, this.emptyMessage(empty)))))));
124
+ }
125
+ static get watchers() { return {
126
+ "filtered": [{
127
+ "onFiltered": 0
128
+ }],
129
+ "sortKey": [{
130
+ "rerenderHeaders": 0
131
+ }],
132
+ "sortDirection": [{
133
+ "rerenderHeaders": 0
134
+ }],
135
+ "sortable": [{
136
+ "rerenderHeaders": 0
137
+ }]
138
+ }; }
139
+ };
140
+ ChTable.style = chTableCss();
141
+
142
+ exports.ch_table = ChTable;
143
+ //# sourceMappingURL=ch-table.entry.cjs.js.map
144
+
145
+ //# sourceMappingURL=ch-table.cjs.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"ch-table.cjs.entry.js","mappings":";;;;AAAA,MAAM,UAAU,GAAG,MAAM,CAAC,s5CAAs5C,CAAC;;ACcj7C,IAAI,QAAQ,GAAG,CAAC;MA+CH,OAAO,GAAA,MAAA;;;;;AACD,IAAA,SAAS,GAAG,CAAA,SAAA,EAAY,EAAE,QAAQ,UAAU;AAC5C,IAAA,OAAO,GAAG,CAAA,EAAG,IAAI,CAAC,SAAS,QAAQ;;;IAK5C,OAAO,GAAwB,EAAE;;IAGhB,QAAQ,GAAG,KAAK;;AAGjC,IAAA,OAAO;;IAGP,aAAa,GAAyB,WAAW;AAEzD;;;AAGG;AACK,IAAA,KAAK;AAEb;;;;AAIG;IACM,KAAK,GAAmC,YAAY;AAE7D;;;;AAIG;IACsB,QAAQ,GAAG,KAAK;;AAGhC,IAAA,MAAM;IAGL,UAAU,GAAA;QAClB,IAAI,CAAC,OAAO,EAAE;;IAMN,eAAe,GAAA;;;A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CAAA,OAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EACEA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAa,CACP,CACF,CACJ,EACL,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,UAAU,MACxCA,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAC,cAAc,EAAC,EAAE,EAAE,IAAI,CAAC,OAAO,EAAA,EACxCA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAM,IAAI,EAAC,OAAO,EAAA,EAChBA,OAAA,CAAA,GAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAG,KAAK,EAAC,sBAAsB,EAAA,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAK,CACzD,CACH,CACP,CACI;;;;;;;;;;;;;;;;;;;;;","names":["h","Host"],"sources":["src/components/ch-table/ch-table.css?tag=ch-table&encapsulation=shadow","src/components/ch-table/ch-table.tsx"],"sourcesContent":[":host {\n display: block;\n font-family: var(--typography-body);\n color: var(--color-text-primary);\n}\n\n:host([hidden]) {\n display: none;\n}\n\n/*\n * The scroll box owns the horizontal overflow so a wide table never widens the\n * page. It is focusable so a keyboard user can scroll it without a mouse.\n */\n.table__scroll {\n overflow-x: auto;\n /* Without this the table shrinks to the box and never overflows. */\n min-width: 0;\n border: var(--border-width) solid var(--color-border-default);\n border-radius: var(--radius-md);\n background: var(--color-surface-default);\n}\n\n.table__scroll:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 2px;\n}\n\n.table {\n /*\n * `width: max-content` with a `min-width: 100%` floor: on a wide viewport the\n * table fills the box, on a narrow one it keeps the width its cells need and\n * the scroll box absorbs the overflow. `width: 100%` would instead squeeze the\n * columns until the text wrapped, which is not scrolling.\n */\n width: 100%;\n border-collapse: collapse;\n font-size: var(--typography-size-sm);\n}\n\n/* A cell never collapses below a readable width, which is what makes the table\n * wider than a narrow scroll box and produces the horizontal scroll. */\n.cell {\n min-width: 8rem;\n}\n\n.caption {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n}\n\n.cell {\n padding: var(--spacing-md) var(--spacing-lg);\n text-align: left;\n vertical-align: top;\n border-bottom: var(--border-width) solid var(--color-border-default);\n}\n\n.cell--header {\n font-weight: var(--typography-weight-semibold);\n color: var(--color-text-secondary);\n white-space: nowrap;\n background: var(--color-surface-hover);\n}\n\n/* The last body row loses its rule; the scroll box border closes the table. */\ntbody tr:last-child td {\n border-bottom: 0;\n}\n\n.sort {\n all: unset;\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-xs);\n cursor: pointer;\n border-radius: var(--radius-sm);\n}\n\n.sort:focus-visible {\n outline: 2px solid var(--color-accent-default);\n outline-offset: 2px;\n}\n\n/* Direction is carried by the glyph, not by colour alone. */\n.sort__cue {\n font-size: var(--typography-size-xs);\n color: var(--color-text-secondary);\n}\n\n.table__empty {\n padding: var(--spacing-2xl) var(--spacing-lg);\n text-align: center;\n}\n\n.table__empty-message {\n margin: 0;\n font-size: var(--typography-size-sm);\n color: var(--color-text-secondary);\n}\n","import { Component, Element, Event, type EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\nexport type ChTableSortDirection = 'ascending' | 'descending';\n\n/** A column the table can sort by, in display order. */\nexport interface ChTableSortColumn {\n /** Identifies the column in `chSort` events. */\n key: string;\n /** Visible header text. */\n label: string;\n /** Whether the header offers sorting. Defaults to `true` when the table is sortable. */\n sortable?: boolean;\n}\n\nlet tableIds = 0;\n\n/**\n * Presentation-only data grid over a native `<table>`.\n *\n * The component renders the table skeleton and the header row; the consumer\n * slots the body as **native** `<tr>` elements. It does not hold the rows, sort\n * them, paginate them or fetch anything — it reports intent and the consumer\n * decides. Sorting is controlled: the table reflects the `sortKey` and\n * `sortDirection` it is given, so a consumer that ignores `chSort` leaves the\n * `aria-sort` that matches its own data.\n *\n * ```html\n * <ch-table sortable sort-key=\"name\" sort-direction=\"ascending\">\n * <tr><td>Aurora SpA</td><td>En despacho</td></tr>\n * <tr><td>Bosque Ltda</td><td>Pendiente</td></tr>\n * </ch-table>\n * ```\n *\n * ```js\n * table.columns = [\n * { key: 'name', label: 'Cliente' },\n * { key: 'status', label: 'Estado' },\n * ];\n * ```\n *\n * Columns come from the `columns` prop, like `ch-select`'s `options` — there is\n * no `ch-table-column` element, and an unknown element inside a component is\n * never rendered.\n *\n * Rows must be real `<tr>` elements created as DOM nodes, not written as\n * HTML inside the tag: the parser rejects a `<tr>` outside a `<table>`, so\n * `<ch-table><tr>…</tr></ch-table>` in an HTML string parses to a text node\n * and the table correctly reports itself empty. Framework templates and\n * `createElement` are unaffected.\n *\n * The shape is the one approved on #77: `table`/`thead`/`tbody` live in the\n * shadow DOM and the consumer slots native rows. Custom row and cell elements\n * are not possible — the HTML parser foster-parents them out of a native\n * table, which the spike in `tests/browser/semantic-shapes.browser.spec.ts`\n * measured in real Chromium.\n */\n@Component({\n tag: 'ch-table',\n styleUrl: 'ch-table.css',\n shadow: true,\n})\nexport class ChTable {\n private readonly captionId = `ch-table-${++tableIds}-caption`;\n private readonly emptyId = `${this.captionId}-empty`;\n\n @Element() private host!: HTMLElement;\n\n /** Columns, in display order. Rendered as the header row. */\n @Prop() columns: ChTableSortColumn[] = [];\n\n /** Whether the header offers sorting. Individual columns can opt out. */\n @Prop({ reflect: true }) sortable = false;\n\n /** Key of the column currently used for sorting. Controlled by the consumer. */\n @Prop() sortKey?: string;\n\n /** Direction of the current sort. Defaults to `ascending`. */\n @Prop() sortDirection: ChTableSortDirection = 'ascending';\n\n /**\n * Accessible name for the table. Always rendered as a caption, visually\n * hidden, because a data table without a name is announced as a bare grid.\n */\n @Prop() label!: string;\n\n /**\n * Shown in place of the rows when the body is empty. `filtered` distinguishes\n * \"nothing matched your filters\" from \"there is nothing yet\", which are\n * different messages and different next actions.\n */\n @State() empty: 'unmeasured' | 'none' | 'true' = 'unmeasured';\n\n /**\n * Marks the body as empty *because of filtering* rather than because there is\n * no data at all. Both look like zero rows, and they need different messages\n * and different next actions.\n */\n @Prop({ reflect: true }) filtered = false;\n\n /** Emitted when a sortable header is activated. The consumer applies the sort. */\n @Event() chSort: EventEmitter<{ key: string; direction: ChTableSortDirection }>;\n\n @Watch('filtered')\n protected onFiltered(): void {\n this.measure();\n }\n\n @Watch('sortKey')\n @Watch('sortDirection')\n @Watch('sortable')\n protected rerenderHeaders(): void {\n // Header attributes are derived from controlled props, so a prop change\n // has to repaint them; `columns` and the slot repaint on their own.\n this.rerender = !this.rerender;\n }\n\n @State() private rerender = false;\n\n private observer?: MutationObserver;\n\n componentDidLoad() {\n this.measure();\n // `slotchange` does not fire for native `<tr>` children, and it only fires\n // at all once the element is upgraded, so a row added later would leave the\n // table stuck on its first measurement. Observing the host covers both\n // orders plus a consumer that swaps rows on refresh. `MutationObserver` is\n // absent in the mock-doc test environment, where the slot behaviour is\n // exercised through an explicit `slotchange` instead.\n if (typeof MutationObserver === 'function') {\n this.observer = new MutationObserver(this.measure);\n this.observer.observe(this.host, { childList: true });\n }\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n this.observer = undefined;\n }\n\n private measure = (): void => {\n const rows = Array.from(this.host.children).filter(child => child.tagName === 'TR');\n this.empty = rows.length === 0 ? 'true' : 'none';\n };\n\n /**\n * A filtered-empty body and a truly empty one both have zero rows; only the\n * consumer knows which, since `filtered` is a prop it controls.\n */\n private get emptyState(): 'none' | 'true' | 'filtered' | 'unmeasured' {\n if (this.filtered) {\n return 'filtered';\n }\n return this.empty;\n }\n\n /** Direction glyph. Not colour: the arrow is the cue in greyscale. */\n private sortCue(active: boolean): string {\n if (!active) {\n return '⇅';\n }\n return this.sortDirection === 'ascending' ? '▲' : '▼';\n }\n\n private emptyMessage(state: 'none' | 'true' | 'filtered' | 'unmeasured'): string {\n return state === 'filtered' ? 'No results for these filters.' : 'Nothing here yet.';\n }\n\n private nextDirection(key: string): ChTableSortDirection {\n if (this.sortKey !== key) {\n return 'ascending';\n }\n return this.sortDirection === 'ascending' ? 'descending' : 'ascending';\n }\n\n private handleSort = (key: string) => {\n this.chSort.emit({ key, direction: this.nextDirection(key) });\n };\n\n private handleHeaderKeydown = (ev: KeyboardEvent, key: string) => {\n if (ev.key !== 'Enter' && ev.key !== ' ') {\n return;\n }\n ev.preventDefault();\n this.handleSort(key);\n };\n\n private renderHeaderCell(column: ChTableSortColumn) {\n const sortable = this.sortable && column.sortable !== false;\n if (!sortable) {\n return (\n <th scope=\"col\" class=\"cell cell--header\">\n {column.label}\n </th>\n );\n }\n\n const active = this.sortKey === column.key;\n const direction = active ? this.sortDirection : 'none';\n return (\n <th scope=\"col\" class=\"cell cell--header\" aria-sort={direction}>\n <button type=\"button\" class=\"sort\" onClick={() => this.handleSort(column.key)} onKeyDown={ev => this.handleHeaderKeydown(ev, column.key)}>\n <span>{column.label}</span>\n <span class=\"sort__cue\" aria-hidden=\"true\">\n {this.sortCue(active)}\n </span>\n </button>\n </th>\n );\n }\n\n render() {\n const empty = this.emptyState;\n // Before the first measurement the table is rendered as non-empty, so a\n // consumer never sees the empty message flash over real rows.\n return (\n <Host class={{ 'table': true, 'table--empty': empty === 'true' || empty === 'filtered' }}>\n <div class=\"table__scroll\" tabIndex={0} role=\"group\" aria-labelledby={this.captionId}>\n <table>\n <caption id={this.captionId} class=\"caption\">\n {this.label}\n </caption>\n <thead>\n <tr>{this.columns.map(column => this.renderHeaderCell(column))}</tr>\n </thead>\n <tbody>\n <slot></slot>\n </tbody>\n </table>\n </div>\n {(empty === 'true' || empty === 'filtered') && (\n <div class=\"table__empty\" id={this.emptyId}>\n <slot name=\"empty\">\n <p class=\"table__empty-message\">{this.emptyMessage(empty)}</p>\n </slot>\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -86,7 +86,7 @@ const ChTabs = class {
86
86
  }
87
87
  render() {
88
88
  const active = this.activeValue;
89
- return (index.h(index.Host, { key: 'de167280c159345631f84f5eb7a3dc165396f361' }, index.h("div", { key: '62c008bcf9eafd1c5f5121540b2841e2a6ada541', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
89
+ return (index.h(index.Host, { key: '5fd5208bb1b9b75f13b9d3830d042f623aaca651' }, index.h("div", { key: '8d602a604a8315db01f3e4d28a39e866efabdb48', class: "tablist", role: "tablist", "aria-label": this.label, onKeyDown: this.handleKeyDown, ref: el => (this.tablistEl = el) }, this.tabs.map(tab => {
90
90
  const selected = tab.value === active;
91
91
  return (index.h("button", { key: tab.value, type: "button", class: { 'tab': true, 'tab--active': selected, 'tab--disabled': Boolean(tab.disabled) }, role: "tab", id: this.tabId(tab.value), "data-value": tab.value, "aria-selected": selected ? 'true' : 'false', "aria-controls": this.panelId(tab.value), tabIndex: selected ? FIRST_TAB_INDEX : LAST_TAB_INDEX, disabled: tab.disabled, onClick: () => this.select(tab.value) }, tab.label));
92
92
  })), this.tabs.map(tab => (index.h("div", { key: `${tab.value}-panel`, class: "tabpanel", id: this.panelId(tab.value), role: "tabpanel", "aria-labelledby": this.tabId(tab.value), tabIndex: FIRST_TAB_INDEX, hidden: tab.value !== active }, index.h("slot", { name: `panel-${tab.value}` }))))));
@@ -125,7 +125,7 @@ const ChTextarea = class {
125
125
  return undefined;
126
126
  }
127
127
  render() {
128
- return (index.h(index.Host, { key: 'c4334a23f6ad2394d410498726f3f422a654ffe3' }, this.label && (index.h("label", { key: 'd935613b40c6c52be41e258aad2a3c17a290a506', class: "label", htmlFor: this.textareaId }, this.label)), index.h("textarea", { key: 'ab27ae9a6be7d2bcc17638c209ef23eb3757c102', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: 'eb488704ac6ff76534308aefd0938d848d14608f', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '04c084b29d102f06bf15efc4c416b6ba0967ba8d', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
128
+ return (index.h(index.Host, { key: '0f2b76444b3bff5d37d069bf1fe307781c5e59d1' }, this.label && (index.h("label", { key: '08b83be70f33dc2c9b93a6d748564aad4eb63d76', class: "label", htmlFor: this.textareaId }, this.label)), index.h("textarea", { key: '749876530342e5ff9d70ab7039dded1a4f0faa5a', id: this.label ? this.textareaId : undefined, class: { 'textarea': true, 'textarea--invalid': this.invalid }, rows: this.rows, name: this.name, placeholder: this.placeholder, disabled: this.disabled || this.formDisabled, required: this.required, value: this.value, "aria-invalid": this.invalid ? 'true' : undefined, "aria-describedby": this.describedBy, onInput: this.handleInput, onChange: this.handleChange }), this.hint && !(this.invalid && this.errorMessage) && (index.h("p", { key: '36e41249852346df559bd278256cc89a79371a88', class: "hint", id: this.hintId }, this.hint)), this.invalid && this.errorMessage && (index.h("p", { key: '90bda1f377da78e07eae82ee13069813c7ed1e8b', class: "error", id: this.errorId, role: "alert" }, this.errorMessage))));
129
129
  }
130
130
  static get formAssociated() { return true; }
131
131
  static get watchers() { return {
@@ -9,7 +9,7 @@ const ChTimeline = class {
9
9
  index.registerInstance(this, hostRef);
10
10
  }
11
11
  render() {
12
- return (index.h(index.Host, { key: 'da3288af540acb92113ba83d08fc5e1693e83b3e', class: "timeline" }, index.h("ol", { key: '1aaee846703dd0a67d6df04945eb4a62e2bbf711', class: "list" }, index.h("slot", { key: '394cfd03640a2cf78bd620338de9ed9ef7b9d9f5' }))));
12
+ return (index.h(index.Host, { key: '50b3a225915e4223fa3eaf560cb1e15898026ec0', class: "timeline" }, index.h("ol", { key: '5b5e218a419f63990deca2d1a7e0f8f36f63cc09', class: "list" }, index.h("slot", { key: '69ff4592e898cdecb078437b6633e5e24c626e61' }))));
13
13
  }
14
14
  };
15
15
  ChTimeline.style = chTimelineCss();