@tectra-ng/ui 0.4.4 → 0.4.5

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 (180) hide show
  1. package/amount/README.md +19 -1
  2. package/analog-clock/README.md +1 -1
  3. package/autocomplete/README.md +1 -1
  4. package/avatar/README.md +24 -4
  5. package/cascade-select/README.md +1 -1
  6. package/chips-input/README.md +10 -5
  7. package/color-picker/README.md +5 -0
  8. package/countdown/README.md +7 -1
  9. package/country/README.md +14 -1
  10. package/country-select/README.md +2 -1
  11. package/export/README.md +27 -2
  12. package/export-font/README.md +1 -1
  13. package/fesm2022/tectra-ng-ui-amount.mjs +96 -14
  14. package/fesm2022/tectra-ng-ui-amount.mjs.map +1 -1
  15. package/fesm2022/tectra-ng-ui-analog-clock.mjs +6 -19
  16. package/fesm2022/tectra-ng-ui-analog-clock.mjs.map +1 -1
  17. package/fesm2022/tectra-ng-ui-autocomplete.mjs +5 -4
  18. package/fesm2022/tectra-ng-ui-autocomplete.mjs.map +1 -1
  19. package/fesm2022/tectra-ng-ui-avatar.mjs +59 -17
  20. package/fesm2022/tectra-ng-ui-avatar.mjs.map +1 -1
  21. package/fesm2022/tectra-ng-ui-button.mjs +2 -2
  22. package/fesm2022/tectra-ng-ui-button.mjs.map +1 -1
  23. package/fesm2022/tectra-ng-ui-card.mjs +2 -2
  24. package/fesm2022/tectra-ng-ui-card.mjs.map +1 -1
  25. package/fesm2022/tectra-ng-ui-cascade-select.mjs +7 -4
  26. package/fesm2022/tectra-ng-ui-cascade-select.mjs.map +1 -1
  27. package/fesm2022/tectra-ng-ui-chips-input.mjs +114 -15
  28. package/fesm2022/tectra-ng-ui-chips-input.mjs.map +1 -1
  29. package/fesm2022/tectra-ng-ui-color-picker.mjs +93 -6
  30. package/fesm2022/tectra-ng-ui-color-picker.mjs.map +1 -1
  31. package/fesm2022/tectra-ng-ui-countdown.mjs +39 -10
  32. package/fesm2022/tectra-ng-ui-countdown.mjs.map +1 -1
  33. package/fesm2022/tectra-ng-ui-country-select.mjs +28 -5
  34. package/fesm2022/tectra-ng-ui-country-select.mjs.map +1 -1
  35. package/fesm2022/tectra-ng-ui-country.mjs +15 -6
  36. package/fesm2022/tectra-ng-ui-country.mjs.map +1 -1
  37. package/fesm2022/tectra-ng-ui-datepicker.mjs +10 -8
  38. package/fesm2022/tectra-ng-ui-datepicker.mjs.map +1 -1
  39. package/fesm2022/tectra-ng-ui-dialog.mjs +6 -6
  40. package/fesm2022/tectra-ng-ui-dialog.mjs.map +1 -1
  41. package/fesm2022/tectra-ng-ui-export.mjs +1237 -84
  42. package/fesm2022/tectra-ng-ui-export.mjs.map +1 -1
  43. package/fesm2022/tectra-ng-ui-field.mjs +1 -0
  44. package/fesm2022/tectra-ng-ui-field.mjs.map +1 -1
  45. package/fesm2022/tectra-ng-ui-fieldset.mjs +2 -2
  46. package/fesm2022/tectra-ng-ui-fieldset.mjs.map +1 -1
  47. package/fesm2022/tectra-ng-ui-icon-field.mjs +51 -23
  48. package/fesm2022/tectra-ng-ui-icon-field.mjs.map +1 -1
  49. package/fesm2022/tectra-ng-ui-input-number.mjs +2 -2
  50. package/fesm2022/tectra-ng-ui-input-number.mjs.map +1 -1
  51. package/fesm2022/tectra-ng-ui-input.mjs +5 -4
  52. package/fesm2022/tectra-ng-ui-input.mjs.map +1 -1
  53. package/fesm2022/tectra-ng-ui-key-filter.mjs +84 -19
  54. package/fesm2022/tectra-ng-ui-key-filter.mjs.map +1 -1
  55. package/fesm2022/tectra-ng-ui-knob.mjs +24 -2
  56. package/fesm2022/tectra-ng-ui-knob.mjs.map +1 -1
  57. package/fesm2022/tectra-ng-ui-label.mjs +68 -9
  58. package/fesm2022/tectra-ng-ui-label.mjs.map +1 -1
  59. package/fesm2022/tectra-ng-ui-link.mjs +38 -14
  60. package/fesm2022/tectra-ng-ui-link.mjs.map +1 -1
  61. package/fesm2022/tectra-ng-ui-mention-textarea.mjs +16 -5
  62. package/fesm2022/tectra-ng-ui-mention-textarea.mjs.map +1 -1
  63. package/fesm2022/tectra-ng-ui-message.mjs +5 -1
  64. package/fesm2022/tectra-ng-ui-message.mjs.map +1 -1
  65. package/fesm2022/tectra-ng-ui-month-calendar.mjs +26 -9
  66. package/fesm2022/tectra-ng-ui-month-calendar.mjs.map +1 -1
  67. package/fesm2022/tectra-ng-ui-multiselect.mjs +3 -2
  68. package/fesm2022/tectra-ng-ui-multiselect.mjs.map +1 -1
  69. package/fesm2022/tectra-ng-ui-panel-menu.mjs +45 -14
  70. package/fesm2022/tectra-ng-ui-panel-menu.mjs.map +1 -1
  71. package/fesm2022/tectra-ng-ui-panel.mjs +4 -2
  72. package/fesm2022/tectra-ng-ui-panel.mjs.map +1 -1
  73. package/fesm2022/tectra-ng-ui-password-generator.mjs +18 -1
  74. package/fesm2022/tectra-ng-ui-password-generator.mjs.map +1 -1
  75. package/fesm2022/tectra-ng-ui-password.mjs +2 -2
  76. package/fesm2022/tectra-ng-ui-password.mjs.map +1 -1
  77. package/fesm2022/tectra-ng-ui-pill.mjs +36 -16
  78. package/fesm2022/tectra-ng-ui-pill.mjs.map +1 -1
  79. package/fesm2022/tectra-ng-ui-rating.mjs +2 -2
  80. package/fesm2022/tectra-ng-ui-rating.mjs.map +1 -1
  81. package/fesm2022/tectra-ng-ui-select.mjs +30 -7
  82. package/fesm2022/tectra-ng-ui-select.mjs.map +1 -1
  83. package/fesm2022/tectra-ng-ui-stat-tiles.mjs +93 -8
  84. package/fesm2022/tectra-ng-ui-stat-tiles.mjs.map +1 -1
  85. package/fesm2022/tectra-ng-ui-status-icon.mjs +40 -3
  86. package/fesm2022/tectra-ng-ui-status-icon.mjs.map +1 -1
  87. package/fesm2022/tectra-ng-ui-table.mjs +20 -6
  88. package/fesm2022/tectra-ng-ui-table.mjs.map +1 -1
  89. package/fesm2022/tectra-ng-ui-tag.mjs +2 -2
  90. package/fesm2022/tectra-ng-ui-tag.mjs.map +1 -1
  91. package/fesm2022/tectra-ng-ui-toast.mjs +2 -2
  92. package/fesm2022/tectra-ng-ui-toast.mjs.map +1 -1
  93. package/fesm2022/tectra-ng-ui-tree-select.mjs +10 -8
  94. package/fesm2022/tectra-ng-ui-tree-select.mjs.map +1 -1
  95. package/fesm2022/tectra-ng-ui-tree-table.mjs +4 -4
  96. package/fesm2022/tectra-ng-ui-tree-table.mjs.map +1 -1
  97. package/fesm2022/tectra-ng-ui-truncate-text.mjs +33 -9
  98. package/fesm2022/tectra-ng-ui-truncate-text.mjs.map +1 -1
  99. package/fesm2022/tectra-ng-ui.mjs +1 -1
  100. package/icon-field/README.md +2 -1
  101. package/key-filter/README.md +3 -2
  102. package/knob/README.md +3 -1
  103. package/label/README.md +4 -1
  104. package/link/README.md +4 -1
  105. package/message/README.md +2 -2
  106. package/month-calendar/README.md +2 -1
  107. package/multiselect/README.md +1 -1
  108. package/package.json +4 -4
  109. package/panel/README.md +3 -1
  110. package/panel-menu/README.md +3 -2
  111. package/password-generator/README.md +2 -0
  112. package/pill/README.md +4 -4
  113. package/select/README.md +1 -1
  114. package/stat-tiles/README.md +17 -1
  115. package/status-icon/README.md +3 -1
  116. package/table/README.md +1 -1
  117. package/tag/README.md +2 -0
  118. package/tree-select/README.md +1 -1
  119. package/truncate-text/README.md +2 -1
  120. package/types/tectra-ng-ui-amount.d.ts +41 -1
  121. package/types/tectra-ng-ui-amount.d.ts.map +1 -1
  122. package/types/tectra-ng-ui-analog-clock.d.ts +1 -4
  123. package/types/tectra-ng-ui-analog-clock.d.ts.map +1 -1
  124. package/types/tectra-ng-ui-autocomplete.d.ts +1 -1
  125. package/types/tectra-ng-ui-avatar.d.ts +45 -12
  126. package/types/tectra-ng-ui-avatar.d.ts.map +1 -1
  127. package/types/tectra-ng-ui-cascade-select.d.ts +3 -2
  128. package/types/tectra-ng-ui-cascade-select.d.ts.map +1 -1
  129. package/types/tectra-ng-ui-chips-input.d.ts +54 -6
  130. package/types/tectra-ng-ui-chips-input.d.ts.map +1 -1
  131. package/types/tectra-ng-ui-color-picker.d.ts +38 -1
  132. package/types/tectra-ng-ui-color-picker.d.ts.map +1 -1
  133. package/types/tectra-ng-ui-countdown.d.ts +12 -1
  134. package/types/tectra-ng-ui-countdown.d.ts.map +1 -1
  135. package/types/tectra-ng-ui-country-select.d.ts +17 -4
  136. package/types/tectra-ng-ui-country-select.d.ts.map +1 -1
  137. package/types/tectra-ng-ui-country.d.ts +7 -1
  138. package/types/tectra-ng-ui-country.d.ts.map +1 -1
  139. package/types/tectra-ng-ui-datepicker.d.ts +2 -2
  140. package/types/tectra-ng-ui-datepicker.d.ts.map +1 -1
  141. package/types/tectra-ng-ui-export.d.ts +68 -8
  142. package/types/tectra-ng-ui-export.d.ts.map +1 -1
  143. package/types/tectra-ng-ui-icon-field.d.ts +9 -2
  144. package/types/tectra-ng-ui-icon-field.d.ts.map +1 -1
  145. package/types/tectra-ng-ui-key-filter.d.ts +19 -4
  146. package/types/tectra-ng-ui-key-filter.d.ts.map +1 -1
  147. package/types/tectra-ng-ui-knob.d.ts +10 -2
  148. package/types/tectra-ng-ui-knob.d.ts.map +1 -1
  149. package/types/tectra-ng-ui-label.d.ts +8 -1
  150. package/types/tectra-ng-ui-label.d.ts.map +1 -1
  151. package/types/tectra-ng-ui-link.d.ts +8 -2
  152. package/types/tectra-ng-ui-link.d.ts.map +1 -1
  153. package/types/tectra-ng-ui-mention-textarea.d.ts +5 -0
  154. package/types/tectra-ng-ui-mention-textarea.d.ts.map +1 -1
  155. package/types/tectra-ng-ui-message.d.ts +1 -1
  156. package/types/tectra-ng-ui-message.d.ts.map +1 -1
  157. package/types/tectra-ng-ui-month-calendar.d.ts +14 -4
  158. package/types/tectra-ng-ui-month-calendar.d.ts.map +1 -1
  159. package/types/tectra-ng-ui-multiselect.d.ts +1 -1
  160. package/types/tectra-ng-ui-panel-menu.d.ts +34 -6
  161. package/types/tectra-ng-ui-panel-menu.d.ts.map +1 -1
  162. package/types/tectra-ng-ui-panel.d.ts +1 -1
  163. package/types/tectra-ng-ui-panel.d.ts.map +1 -1
  164. package/types/tectra-ng-ui-password-generator.d.ts +10 -3
  165. package/types/tectra-ng-ui-password-generator.d.ts.map +1 -1
  166. package/types/tectra-ng-ui-pill.d.ts +9 -5
  167. package/types/tectra-ng-ui-pill.d.ts.map +1 -1
  168. package/types/tectra-ng-ui-select.d.ts +5 -2
  169. package/types/tectra-ng-ui-select.d.ts.map +1 -1
  170. package/types/tectra-ng-ui-stat-tiles.d.ts +49 -5
  171. package/types/tectra-ng-ui-stat-tiles.d.ts.map +1 -1
  172. package/types/tectra-ng-ui-status-icon.d.ts +20 -2
  173. package/types/tectra-ng-ui-status-icon.d.ts.map +1 -1
  174. package/types/tectra-ng-ui-table.d.ts +2 -1
  175. package/types/tectra-ng-ui-table.d.ts.map +1 -1
  176. package/types/tectra-ng-ui-tree-select.d.ts +3 -3
  177. package/types/tectra-ng-ui-tree-select.d.ts.map +1 -1
  178. package/types/tectra-ng-ui-truncate-text.d.ts +7 -2
  179. package/types/tectra-ng-ui-truncate-text.d.ts.map +1 -1
  180. package/types/tectra-ng-ui.d.ts +1 -1
@@ -116,6 +116,10 @@ var TxCountdown = class TxCountdown {
116
116
  ...ngDevMode ? { debugName: "paused" } : /* istanbul ignore next */ {},
117
117
  transform: booleanAttribute
118
118
  });
119
+ restartOnChange = input(true, {
120
+ ...ngDevMode ? { debugName: "restartOnChange" } : /* istanbul ignore next */ {},
121
+ transform: booleanAttribute
122
+ });
119
123
  ariaLive = input("off", ...ngDevMode ? [{ debugName: "ariaLive" }] : /* istanbul ignore next */ []);
120
124
  dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
121
125
  pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
@@ -138,6 +142,7 @@ var TxCountdown = class TxCountdown {
138
142
  frozen = signal(null, ...ngDevMode ? [{ debugName: "frozen" }] : /* istanbul ignore next */ []);
139
143
  timer = null;
140
144
  done = false;
145
+ countsValue = false;
141
146
  resolvedFormat = computed(() => this.format() ?? (this.target() !== void 0 && this.value() === void 0 ? "clock" : "number"), ...ngDevMode ? [{ debugName: "resolvedFormat" }] : /* istanbul ignore next */ []);
142
147
  remainingMs = computed(() => {
143
148
  const frozen = this.frozen();
@@ -162,18 +167,27 @@ var TxCountdown = class TxCountdown {
162
167
  const unit = this.unit();
163
168
  const target = targetTime(this.target());
164
169
  untracked(() => {
165
- this.done = false;
166
- this.now.set(Date.now());
167
- const deadline = value !== void 0 ? Date.now() + value * TX_COUNTDOWN_UNIT_MS[unit] : target;
168
- if (this.paused()) {
169
- this.deadline.set(deadline);
170
- this.frozen.set(deadline === null ? null : Math.max(0, deadline - Date.now()));
171
- } else {
172
- this.frozen.set(null);
173
- this.deadline.set(deadline);
174
- }
170
+ const running = this.deadline() !== null && !this.isExpired();
171
+ if (!this.restartOnChange() && running && this.countsValue && value !== void 0) return;
172
+ this.begin(value, unit, target);
175
173
  });
176
174
  }, ...ngDevMode ? [{ debugName: "start" }] : /* istanbul ignore next */ []);
175
+ restart() {
176
+ this.begin(this.value(), this.unit(), targetTime(this.target()));
177
+ }
178
+ begin(value, unit, target) {
179
+ this.done = false;
180
+ this.countsValue = value !== void 0;
181
+ this.now.set(Date.now());
182
+ const deadline = value !== void 0 ? Date.now() + value * TX_COUNTDOWN_UNIT_MS[unit] : target;
183
+ if (this.paused()) {
184
+ this.deadline.set(deadline);
185
+ this.frozen.set(deadline === null ? null : Math.max(0, deadline - Date.now()));
186
+ } else {
187
+ this.frozen.set(null);
188
+ this.deadline.set(deadline);
189
+ }
190
+ }
177
191
  pause = effect(() => {
178
192
  const paused = this.paused();
179
193
  untracked(() => {
@@ -282,6 +296,13 @@ var TxCountdown = class TxCountdown {
282
296
  isRequired: false,
283
297
  transformFunction: null
284
298
  },
299
+ restartOnChange: {
300
+ classPropertyName: "restartOnChange",
301
+ publicName: "restartOnChange",
302
+ isSignal: true,
303
+ isRequired: false,
304
+ transformFunction: null
305
+ },
285
306
  ariaLive: {
286
307
  classPropertyName: "ariaLive",
287
308
  publicName: "ariaLive",
@@ -460,6 +481,14 @@ i0.ɵɵngDeclareClassMetadata({
460
481
  required: false
461
482
  }]
462
483
  }],
484
+ restartOnChange: [{
485
+ type: i0.Input,
486
+ args: [{
487
+ isSignal: true,
488
+ alias: "restartOnChange",
489
+ required: false
490
+ }]
491
+ }],
463
492
  ariaLive: [{
464
493
  type: i0.Input,
465
494
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"tectra-ng-ui-countdown.mjs","names":[],"sources":["../../../../packages/ui/countdown/src/countdown.utils.ts","../../../../packages/ui/countdown/src/countdown.templates.ts","../../../../packages/ui/countdown/src/remaining-time.pipe.ts","../../../../packages/ui/countdown/src/countdown.icons.ts","../../../../packages/ui/countdown/src/countdown.theme.ts","../../../../packages/ui/countdown/src/countdown.component.ts"],"sourcesContent":["import { TxCountdownTarget, TxCountdownUnit } from './countdown.types';\n\n/** Length of each countdown unit in milliseconds. */\nexport const TX_COUNTDOWN_UNIT_MS: Record<TxCountdownUnit, number> = {\n seconds: 1000,\n minutes: 60000,\n hours: 3600000,\n days: 86400000,\n};\n\n/**\n * Formats remaining milliseconds as `mm:ss`, or `h:mm:ss` from one hour on; negative or empty values give `00:00`.\n */\nexport function formatRemaining(ms: number | null | undefined): string {\n const total = Math.max(0, Math.floor((ms ?? 0) / 1000));\n const hours = Math.floor(total / 3600);\n const minutes = Math.floor((total % 3600) / 60);\n const seconds = total % 60;\n const pad = (value: number) => String(value).padStart(2, '0');\n return hours ? `${hours}:${pad(minutes)}:${pad(seconds)}` : `${pad(minutes)}:${pad(seconds)}`;\n}\n\n/** Splits remaining milliseconds into days, hours, minutes and seconds, rounding partial seconds up. */\nexport function splitRemaining(ms: number): { days: number; hours: number; minutes: number; seconds: number } {\n const total = Math.max(0, Math.ceil(ms / 1000));\n return {\n days: Math.floor(total / 86400),\n hours: Math.floor((total % 86400) / 3600),\n minutes: Math.floor((total % 3600) / 60),\n seconds: total % 60,\n };\n}\n\n/** Reads a target as milliseconds since the epoch; `null` when it is empty or not a valid date. */\nexport function targetTime(value: TxCountdownTarget): number | null {\n if (value === null || value === undefined || value === '') return null;\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport { TxCountdownContext } from './countdown.types';\n\n@Directive({ selector: 'ng-template[txCountdownValue]' })\nexport class TxCountdownValue {\n readonly templateRef = inject<TemplateRef<TxCountdownContext>>(TemplateRef);\n\n static ngTemplateContextGuard(_directive: TxCountdownValue, context: unknown): context is TxCountdownContext {\n return !!context;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { formatRemaining } from './countdown.utils';\n\n/** Formats remaining milliseconds as `mm:ss` or `h:mm:ss`, like `tx-countdown` with the `clock` format. */\n@Pipe({ name: 'txRemainingTime' })\nexport class TxRemainingTimePipe implements PipeTransform {\n transform(ms: number | null | undefined): string {\n return formatRemaining(ms);\n }\n}\n","import { TxIconSet, txIconClock } from '@tectra-ng/icons';\n\nexport const COUNTDOWN_ICON_DEFAULTS: TxIconSet = {\n clock: txIconClock,\n};\n","import { countdownTokens } from '@tectra-ng/themes';\n\nexport const COUNTDOWN_THEME = {\n countdown: countdownTokens,\n};\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, booleanAttribute, computed, contentChild, effect, inject, input, numberAttribute, output, signal, untracked } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { optionalBoolean, optionalNumber } from '@tectra-ng/core/utils';\nimport { TectraCountdownTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { TxCountdownValue } from './countdown.templates';\nimport { TxCountdownContext, TxCountdownFormat, TxCountdownPart, TxCountdownTarget, TxCountdownUnit } from './countdown.types';\nimport { TX_COUNTDOWN_UNIT_MS, formatRemaining, splitRemaining, targetTime } from './countdown.utils';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { COUNTDOWN_ICON_DEFAULTS } from './countdown.icons';\nimport { COUNTDOWN_THEME } from './countdown.theme';\n\n@Component({\n selector: 'tx-countdown',\n imports: [NgTemplateOutlet],\n template: `\n @if (valueTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.templateRef\" [ngTemplateOutletContext]=\"context()\" />\n } @else {\n {{ text() }}\n }\n `,\n styleUrl: './countdown.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-countdown',\n role: 'timer',\n 'aria-atomic': 'true',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.aria-live]': 'ariaLive()',\n '[class.tx-countdown--ending]': 'isEnding()',\n '[class.tx-countdown--expired]': 'isExpired()',\n '[class.tx-countdown--paused]': 'paused()',\n },\n viewProviders: [provideTxIconDefaults(COUNTDOWN_ICON_DEFAULTS)],\n})\nexport class TxCountdown {\n private readonly countdownTheme = injectTokens(COUNTDOWN_THEME);\n\n readonly value = input<number | undefined, unknown>(undefined, { transform: optionalNumber });\n readonly unit = input<TxCountdownUnit>('seconds');\n readonly target = input<TxCountdownTarget>(undefined);\n readonly suffix = input<string>('');\n readonly format = input<TxCountdownFormat | undefined>(undefined);\n readonly endingSoon = input<number, unknown>(0, { transform: numberAttribute });\n readonly paused = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly ariaLive = input<'off' | 'polite' | 'assertive'>('off');\n readonly dt = input<TectraDeepPartial<TectraCountdownTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxCountdownPart, TxCountdown> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly completed = output<void>();\n readonly tick = output<number>();\n\n protected readonly valueTemplate = contentChild(TxCountdownValue);\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('countdown', this, this.pt, this.ptOptions);\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-countdown'), ...this.passThrough().root?.style }));\n\n private readonly now = signal(Date.now());\n private readonly deadline = signal<number | null>(null);\n private readonly frozen = signal<number | null>(null);\n private timer: ReturnType<typeof setTimeout> | null = null;\n private done = false;\n\n readonly resolvedFormat = computed<TxCountdownFormat>(() => this.format() ?? (this.target() !== undefined && this.value() === undefined ? 'clock' : 'number'));\n readonly remainingMs = computed(() => {\n const frozen = this.frozen();\n if (frozen !== null) return frozen;\n const deadline = this.deadline();\n return deadline === null ? 0 : Math.max(0, deadline - this.now());\n });\n readonly isExpired = computed(() => this.deadline() !== null && this.remainingMs() === 0);\n readonly isEnding = computed(() => this.remainingMs() > 0 && this.remainingMs() <= this.endingSoon());\n readonly text = computed(() => {\n const remaining = this.remainingMs();\n const display = this.resolvedFormat() === 'clock' ? formatRemaining(Math.ceil(remaining / 1000) * 1000) : String(Math.ceil(remaining / TX_COUNTDOWN_UNIT_MS[this.unit()]));\n return this.suffix() ? `${display} ${this.suffix()}` : display;\n });\n readonly context = computed<TxCountdownContext>(() => ({ $implicit: this.remainingMs(), ...splitRemaining(this.remainingMs()), expired: this.isExpired() }));\n\n private readonly start = effect(() => {\n const value = this.value();\n const unit = this.unit();\n const target = targetTime(this.target());\n untracked(() => {\n this.done = false;\n this.now.set(Date.now());\n const deadline = value !== undefined ? Date.now() + value * TX_COUNTDOWN_UNIT_MS[unit] : target;\n if (this.paused()) {\n this.deadline.set(deadline);\n this.frozen.set(deadline === null ? null : Math.max(0, deadline - Date.now()));\n } else {\n this.frozen.set(null);\n this.deadline.set(deadline);\n }\n });\n });\n\n private readonly pause = effect(() => {\n const paused = this.paused();\n untracked(() => {\n if (paused && this.frozen() === null && this.deadline() !== null) this.frozen.set(this.remainingMs());\n if (!paused && this.frozen() !== null) {\n this.deadline.set(Date.now() + (this.frozen() as number));\n this.now.set(Date.now());\n this.frozen.set(null);\n }\n });\n });\n\n private readonly refresh = effect(() => {\n this.resolvedFormat();\n this.endingSoon();\n untracked(() => this.now.set(Date.now()));\n });\n\n private readonly schedule = effect((onCleanup) => {\n const deadline = this.deadline();\n const frozen = this.frozen();\n this.now();\n if (deadline === null || frozen !== null) return;\n const remaining = deadline - Date.now();\n if (remaining <= 0) return;\n const step = this.resolvedFormat() === 'clock' || this.endingSoon() ? 1000 : TX_COUNTDOWN_UNIT_MS[this.unit()];\n const delay = remaining % step || step;\n this.timer = setTimeout(() => this.now.set(Date.now()), delay + 5);\n onCleanup(() => {\n if (this.timer) clearTimeout(this.timer);\n });\n });\n\n private readonly finish = effect(() => {\n const remaining = this.remainingMs();\n const expired = this.isExpired();\n untracked(() => {\n this.tick.emit(remaining);\n if (expired && !this.done) {\n this.done = true;\n this.completed.emit();\n }\n });\n });\n\n private readonly cleanup = inject(DestroyRef).onDestroy(() => {\n if (this.timer) clearTimeout(this.timer);\n });\n}\n"],"mappings":";;;;;;;AAGA,MAAa,uBAAwD;CACnE,SAAS;CACT,SAAS;CACT,OAAO;CACP,MAAM;AACP;AAKD,SAAgB,gBAAgB,IAA6B;CAC3D,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,OAAO,MAAM,KAAK,GAAI,CAAC;CACtD,MAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI;CACrC,MAAM,UAAU,KAAK,MAAO,QAAQ,OAAQ,EAAE;CAC9C,MAAM,UAAU,QAAQ;CACxB,MAAM,OAAO,UAAkB,OAAO,KAAK,CAAC,CAAC,SAAS,GAAG,GAAG;CAC5D,OAAO,QAAQ,GAAG,MAAK,GAAI,IAAI,OAAO,EAAC,GAAI,IAAI,OAAO,MAAM,GAAG,IAAI,OAAO,EAAC,GAAI,IAAI,OAAO;AAC5F;AAGA,SAAgB,eAAe,IAAU;CACvC,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,KAAK,KAAK,GAAI,CAAC;CAC9C,OAAO;EACL,MAAM,KAA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AA,CAAA;EAAA,CAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,gBAAgB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"tectra-ng-ui-countdown.mjs","names":[],"sources":["../../../../packages/ui/countdown/src/countdown.utils.ts","../../../../packages/ui/countdown/src/countdown.templates.ts","../../../../packages/ui/countdown/src/remaining-time.pipe.ts","../../../../packages/ui/countdown/src/countdown.icons.ts","../../../../packages/ui/countdown/src/countdown.theme.ts","../../../../packages/ui/countdown/src/countdown.component.ts"],"sourcesContent":["import { TxCountdownTarget, TxCountdownUnit } from './countdown.types';\n\n/** Length of each countdown unit in milliseconds. */\nexport const TX_COUNTDOWN_UNIT_MS: Record<TxCountdownUnit, number> = {\n seconds: 1000,\n minutes: 60000,\n hours: 3600000,\n days: 86400000,\n};\n\n/**\n * Formats remaining milliseconds as `mm:ss`, or `h:mm:ss` from one hour on; negative or empty values give `00:00`.\n */\nexport function formatRemaining(ms: number | null | undefined): string {\n const total = Math.max(0, Math.floor((ms ?? 0) / 1000));\n const hours = Math.floor(total / 3600);\n const minutes = Math.floor((total % 3600) / 60);\n const seconds = total % 60;\n const pad = (value: number) => String(value).padStart(2, '0');\n return hours ? `${hours}:${pad(minutes)}:${pad(seconds)}` : `${pad(minutes)}:${pad(seconds)}`;\n}\n\n/** Splits remaining milliseconds into days, hours, minutes and seconds, rounding partial seconds up. */\nexport function splitRemaining(ms: number): { days: number; hours: number; minutes: number; seconds: number } {\n const total = Math.max(0, Math.ceil(ms / 1000));\n return {\n days: Math.floor(total / 86400),\n hours: Math.floor((total % 86400) / 3600),\n minutes: Math.floor((total % 3600) / 60),\n seconds: total % 60,\n };\n}\n\n/** Reads a target as milliseconds since the epoch; `null` when it is empty or not a valid date. */\nexport function targetTime(value: TxCountdownTarget): number | null {\n if (value === null || value === undefined || value === '') return null;\n const time = new Date(value).getTime();\n return Number.isNaN(time) ? null : time;\n}\n","import { Directive, TemplateRef, inject } from '@angular/core';\nimport { TxCountdownContext } from './countdown.types';\n\n@Directive({ selector: 'ng-template[txCountdownValue]' })\nexport class TxCountdownValue {\n readonly templateRef = inject<TemplateRef<TxCountdownContext>>(TemplateRef);\n\n static ngTemplateContextGuard(_directive: TxCountdownValue, context: unknown): context is TxCountdownContext {\n return !!context;\n }\n}\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { formatRemaining } from './countdown.utils';\n\n/** Formats remaining milliseconds as `mm:ss` or `h:mm:ss`, like `tx-countdown` with the `clock` format. */\n@Pipe({ name: 'txRemainingTime' })\nexport class TxRemainingTimePipe implements PipeTransform {\n transform(ms: number | null | undefined): string {\n return formatRemaining(ms);\n }\n}\n","import { TxIconSet, txIconClock } from '@tectra-ng/icons';\n\nexport const COUNTDOWN_ICON_DEFAULTS: TxIconSet = {\n clock: txIconClock,\n};\n","import { countdownTokens } from '@tectra-ng/themes';\n\nexport const COUNTDOWN_THEME = {\n countdown: countdownTokens,\n};\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, DestroyRef, booleanAttribute, computed, contentChild, effect, inject, input, numberAttribute, output, signal, untracked } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { optionalBoolean, optionalNumber } from '@tectra-ng/core/utils';\nimport { TectraCountdownTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { TxCountdownValue } from './countdown.templates';\nimport { TxCountdownContext, TxCountdownFormat, TxCountdownPart, TxCountdownTarget, TxCountdownUnit } from './countdown.types';\nimport { TX_COUNTDOWN_UNIT_MS, formatRemaining, splitRemaining, targetTime } from './countdown.utils';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { COUNTDOWN_ICON_DEFAULTS } from './countdown.icons';\nimport { COUNTDOWN_THEME } from './countdown.theme';\n\n@Component({\n selector: 'tx-countdown',\n imports: [NgTemplateOutlet],\n template: `\n @if (valueTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template.templateRef\" [ngTemplateOutletContext]=\"context()\" />\n } @else {\n {{ text() }}\n }\n `,\n styleUrl: './countdown.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-countdown',\n role: 'timer',\n 'aria-atomic': 'true',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.aria-live]': 'ariaLive()',\n '[class.tx-countdown--ending]': 'isEnding()',\n '[class.tx-countdown--expired]': 'isExpired()',\n '[class.tx-countdown--paused]': 'paused()',\n },\n viewProviders: [provideTxIconDefaults(COUNTDOWN_ICON_DEFAULTS)],\n})\nexport class TxCountdown {\n private readonly countdownTheme = injectTokens(COUNTDOWN_THEME);\n\n readonly value = input<number | undefined, unknown>(undefined, { transform: optionalNumber });\n readonly unit = input<TxCountdownUnit>('seconds');\n readonly target = input<TxCountdownTarget>(undefined);\n readonly suffix = input<string>('');\n readonly format = input<TxCountdownFormat | undefined>(undefined);\n readonly endingSoon = input<number, unknown>(0, { transform: numberAttribute });\n readonly paused = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly restartOnChange = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly ariaLive = input<'off' | 'polite' | 'assertive'>('off');\n readonly dt = input<TectraDeepPartial<TectraCountdownTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxCountdownPart, TxCountdown> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly completed = output<void>();\n readonly tick = output<number>();\n\n protected readonly valueTemplate = contentChild(TxCountdownValue);\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('countdown', this, this.pt, this.ptOptions);\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-countdown'), ...this.passThrough().root?.style }));\n\n private readonly now = signal(Date.now());\n private readonly deadline = signal<number | null>(null);\n private readonly frozen = signal<number | null>(null);\n private timer: ReturnType<typeof setTimeout> | null = null;\n private done = false;\n private countsValue = false;\n\n readonly resolvedFormat = computed<TxCountdownFormat>(() => this.format() ?? (this.target() !== undefined && this.value() === undefined ? 'clock' : 'number'));\n readonly remainingMs = computed(() => {\n const frozen = this.frozen();\n if (frozen !== null) return frozen;\n const deadline = this.deadline();\n return deadline === null ? 0 : Math.max(0, deadline - this.now());\n });\n readonly isExpired = computed(() => this.deadline() !== null && this.remainingMs() === 0);\n readonly isEnding = computed(() => this.remainingMs() > 0 && this.remainingMs() <= this.endingSoon());\n readonly text = computed(() => {\n const remaining = this.remainingMs();\n const display = this.resolvedFormat() === 'clock' ? formatRemaining(Math.ceil(remaining / 1000) * 1000) : String(Math.ceil(remaining / TX_COUNTDOWN_UNIT_MS[this.unit()]));\n return this.suffix() ? `${display} ${this.suffix()}` : display;\n });\n readonly context = computed<TxCountdownContext>(() => ({ $implicit: this.remainingMs(), ...splitRemaining(this.remainingMs()), expired: this.isExpired() }));\n\n private readonly start = effect(() => {\n const value = this.value();\n const unit = this.unit();\n const target = targetTime(this.target());\n untracked(() => {\n const running = this.deadline() !== null && !this.isExpired();\n if (!this.restartOnChange() && running && this.countsValue && value !== undefined) return;\n this.begin(value, unit, target);\n });\n });\n\n restart(): void {\n this.begin(this.value(), this.unit(), targetTime(this.target()));\n }\n\n private begin(value: number | undefined, unit: TxCountdownUnit, target: number | null): void {\n this.done = false;\n this.countsValue = value !== undefined;\n this.now.set(Date.now());\n const deadline = value !== undefined ? Date.now() + value * TX_COUNTDOWN_UNIT_MS[unit] : target;\n if (this.paused()) {\n this.deadline.set(deadline);\n this.frozen.set(deadline === null ? null : Math.max(0, deadline - Date.now()));\n } else {\n this.frozen.set(null);\n this.deadline.set(deadline);\n }\n }\n\n private readonly pause = effect(() => {\n const paused = this.paused();\n untracked(() => {\n if (paused && this.frozen() === null && this.deadline() !== null) this.frozen.set(this.remainingMs());\n if (!paused && this.frozen() !== null) {\n this.deadline.set(Date.now() + (this.frozen() as number));\n this.now.set(Date.now());\n this.frozen.set(null);\n }\n });\n });\n\n private readonly refresh = effect(() => {\n this.resolvedFormat();\n this.endingSoon();\n untracked(() => this.now.set(Date.now()));\n });\n\n private readonly schedule = effect((onCleanup) => {\n const deadline = this.deadline();\n const frozen = this.frozen();\n this.now();\n if (deadline === null || frozen !== null) return;\n const remaining = deadline - Date.now();\n if (remaining <= 0) return;\n const step = this.resolvedFormat() === 'clock' || this.endingSoon() ? 1000 : TX_COUNTDOWN_UNIT_MS[this.unit()];\n const delay = remaining % step || step;\n this.timer = setTimeout(() => this.now.set(Date.now()), delay + 5);\n onCleanup(() => {\n if (this.timer) clearTimeout(this.timer);\n });\n });\n\n private readonly finish = effect(() => {\n const remaining = this.remainingMs();\n const expired = this.isExpired();\n untracked(() => {\n this.tick.emit(remaining);\n if (expired && !this.done) {\n this.done = true;\n this.completed.emit();\n }\n });\n });\n\n private readonly cleanup = inject(DestroyRef).onDestroy(() => {\n if (this.timer) clearTimeout(this.timer);\n });\n}\n"],"mappings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IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,IAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,WAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,MAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,gBAAgB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -3,15 +3,16 @@ import * as i0 from "@angular/core";
3
3
  import { ChangeDetectionStrategy, Component, booleanAttribute, computed, forwardRef, inject, input, output } from "@angular/core";
4
4
  import * as i1 from "@angular/forms";
5
5
  import { FormsModule, NG_VALUE_ACCESSOR } from "@angular/forms";
6
- import { TxFormControlBase } from "@tectra-ng/core/forms";
6
+ import { TxFormControlBase, injectFieldInvalid } from "@tectra-ng/core/forms";
7
7
  import { TxLocaleService } from "@tectra-ng/core/i18n";
8
8
  import { optionalBoolean } from "@tectra-ng/core/utils";
9
- import { TX_COUNTRY_CODES, TxCountry, countryName } from "@tectra-ng/ui/country";
9
+ import { TX_COUNTRY_CODES, TX_REGION_CODES, TxCountry, countryName, isCountryCode } from "@tectra-ng/ui/country";
10
10
  import { TxMultiselect } from "@tectra-ng/ui/multiselect";
11
11
  import { TxSelect, TxSelectOptionTemplate, TxSelectValueTemplate } from "@tectra-ng/ui/select";
12
12
  import { injectTokens } from "@tectra-ng/core/config";
13
13
  import { countryTokens } from "@tectra-ng/themes";
14
14
  const COUNTRY_SELECT_THEME = { country: countryTokens };
15
+ const FLAG_CODES = /* @__PURE__ */ new Set([...TX_COUNTRY_CODES, ...TX_REGION_CODES]);
15
16
  var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
16
17
  countrySelectTheme = injectTokens(COUNTRY_SELECT_THEME);
17
18
  locale = inject(TxLocaleService);
@@ -27,6 +28,7 @@ var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
27
28
  sort = input("name", ...ngDevMode ? [{ debugName: "sort" }] : /* istanbul ignore next */ []);
28
29
  shape = input("rectangle", ...ngDevMode ? [{ debugName: "shape" }] : /* istanbul ignore next */ []);
29
30
  maxFlags = input(3, ...ngDevMode ? [{ debugName: "maxFlags" }] : /* istanbul ignore next */ []);
31
+ maxNamed = input(1, ...ngDevMode ? [{ debugName: "maxNamed" }] : /* istanbul ignore next */ []);
30
32
  virtualScrollThreshold = input(50, ...ngDevMode ? [{ debugName: "virtualScrollThreshold" }] : /* istanbul ignore next */ []);
31
33
  placeholder = input("", ...ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []);
32
34
  showClear = input(false, {
@@ -56,15 +58,18 @@ var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
56
58
  transform: optionalBoolean
57
59
  });
58
60
  changed = output();
61
+ isInvalid = injectFieldInvalid(this.invalid);
59
62
  items = computed(() => {
60
63
  const locale = this.locale.locale().intl;
61
64
  const items = (this.options() ?? TX_COUNTRY_CODES).map((option) => {
62
65
  const entry = typeof option === "string" ? { code: option } : option;
63
- const code = entry.code.trim().toUpperCase();
66
+ const trimmed = entry.code.trim();
67
+ const code = isCountryCode(trimmed) ? trimmed.toUpperCase() : trimmed;
64
68
  return {
65
69
  code,
66
70
  value: entry.value ?? code,
67
71
  label: entry.label ?? countryName(code, locale),
72
+ flag: entry.flag ?? FLAG_CODES.has(code),
68
73
  count: entry.count ?? null,
69
74
  hint: entry.hint ?? "",
70
75
  disabled: !!entry.disabled
@@ -83,6 +88,9 @@ var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
83
88
  firstFlags(items) {
84
89
  return items.slice(0, this.maxFlags()).map((item) => item.option);
85
90
  }
91
+ showsNames(items) {
92
+ return items.length <= this.maxNamed();
93
+ }
86
94
  onModelChange(value) {
87
95
  this.updateValue(value);
88
96
  this.changed.emit(value);
@@ -147,6 +155,13 @@ var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
147
155
  isRequired: false,
148
156
  transformFunction: null
149
157
  },
158
+ maxNamed: {
159
+ classPropertyName: "maxNamed",
160
+ publicName: "maxNamed",
161
+ isSignal: true,
162
+ isRequired: false,
163
+ transformFunction: null
164
+ },
150
165
  virtualScrollThreshold: {
151
166
  classPropertyName: "virtualScrollThreshold",
152
167
  publicName: "virtualScrollThreshold",
@@ -251,7 +266,7 @@ var TxCountrySelect = class TxCountrySelect extends TxFormControlBase {
251
266
  }],
252
267
  usesInheritance: true,
253
268
  ngImport: i0,
254
- template: "@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [showName]=\"selected.length === 1\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n",
269
+ template: "@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [showName]=\"!item.flag || showsNames(selected)\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n",
255
270
  styles: [":host{display:block;width:100%}.tx-country-select__option{display:flex;align-items:center;min-width:0}.tx-country-select__country{flex:0 1 auto}.tx-country-select__flags{display:inline-flex;align-items:center;vertical-align:middle}.tx-country-select__option--styled,.tx-country-select__flags--styled{gap:var(--tx-country-gap)}.tx-country-select__option--styled .tx-country-select__hint{overflow:hidden;color:var(--tx-country-hint-color);font-size:var(--tx-country-count-font-size);text-overflow:ellipsis;white-space:nowrap}.tx-country-select__option--styled .tx-country-select__count{margin-inline-start:auto;color:var(--tx-country-count-color);font-size:var(--tx-country-count-font-size);font-variant-numeric:tabular-nums}.tx-country-select__flags--styled .tx-country-select__more{color:var(--tx-country-hint-color);font-size:var(--tx-country-count-font-size)}\n"],
256
271
  dependencies: [
257
272
  {
@@ -383,7 +398,7 @@ i0.ɵɵngDeclareClassMetadata({
383
398
  class: "tx-country-select",
384
399
  "[attr.data-styled]": "unstyled() ? null : true"
385
400
  },
386
- template: "@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [showName]=\"selected.length === 1\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n",
401
+ template: "@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [showName]=\"!item.flag || showsNames(selected)\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n",
387
402
  styles: [":host{display:block;width:100%}.tx-country-select__option{display:flex;align-items:center;min-width:0}.tx-country-select__country{flex:0 1 auto}.tx-country-select__flags{display:inline-flex;align-items:center;vertical-align:middle}.tx-country-select__option--styled,.tx-country-select__flags--styled{gap:var(--tx-country-gap)}.tx-country-select__option--styled .tx-country-select__hint{overflow:hidden;color:var(--tx-country-hint-color);font-size:var(--tx-country-count-font-size);text-overflow:ellipsis;white-space:nowrap}.tx-country-select__option--styled .tx-country-select__count{margin-inline-start:auto;color:var(--tx-country-count-color);font-size:var(--tx-country-count-font-size);font-variant-numeric:tabular-nums}.tx-country-select__flags--styled .tx-country-select__more{color:var(--tx-country-hint-color);font-size:var(--tx-country-count-font-size)}\n"]
388
403
  }]
389
404
  }],
@@ -436,6 +451,14 @@ i0.ɵɵngDeclareClassMetadata({
436
451
  required: false
437
452
  }]
438
453
  }],
454
+ maxNamed: [{
455
+ type: i0.Input,
456
+ args: [{
457
+ isSignal: true,
458
+ alias: "maxNamed",
459
+ required: false
460
+ }]
461
+ }],
439
462
  virtualScrollThreshold: [{
440
463
  type: i0.Input,
441
464
  args: [{
@@ -1 +1 @@
1
- {"version":3,"file":"tectra-ng-ui-country-select.mjs","names":[],"sources":["../../../../packages/ui/country-select/src/country-select.theme.ts","../../../../packages/ui/country-select/src/country-select.component.ts","../../../../packages/ui/country-select/src/country-select.component.html"],"sourcesContent":["import { countryTokens } from '@tectra-ng/themes';\n\nexport const COUNTRY_SELECT_THEME = {\n country: countryTokens,\n};\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, computed, forwardRef, inject, input, output } from '@angular/core';\nimport { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TxFormControlBase } from '@tectra-ng/core/forms';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraDeepPartial, TectraSelectTokens } from '@tectra-ng/themes';\nimport { TX_COUNTRY_CODES, TxCountry, TxFlagShape, countryName } from '@tectra-ng/ui/country';\nimport { TxMultiselect } from '@tectra-ng/ui/multiselect';\nimport { TxFieldVariant, TxSelect, TxSelectItem, TxSelectOptionTemplate, TxSelectSize, TxSelectValueTemplate } from '@tectra-ng/ui/select';\nimport { TxCountryItem, TxCountryOption, TxCountrySort } from './country-select.types';\nimport { injectTokens } from '@tectra-ng/core/config';\nimport { COUNTRY_SELECT_THEME } from './country-select.theme';\n\n@Component({\n selector: 'tx-country-select',\n imports: [FormsModule, NgTemplateOutlet, TxSelect, TxMultiselect, TxSelectOptionTemplate, TxSelectValueTemplate, TxCountry],\n templateUrl: './country-select.component.html',\n styleUrl: './country-select.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TxCountrySelect), multi: true }],\n host: {\n class: 'tx-country-select',\n '[attr.data-styled]': 'unstyled() ? null : true',\n },\n})\nexport class TxCountrySelect extends TxFormControlBase<string | string[]> {\n private readonly countrySelectTheme = injectTokens(COUNTRY_SELECT_THEME);\n\n private locale = inject(TxLocaleService);\n\n readonly options = input<readonly (string | TxCountryOption)[] | undefined>(undefined);\n readonly multiple = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly filter = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly sort = input<TxCountrySort>('name');\n readonly shape = input<TxFlagShape>('rectangle');\n readonly maxFlags = input<number>(3);\n readonly virtualScrollThreshold = input<number>(50);\n readonly placeholder = input<string>('');\n readonly showClear = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly loading = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly inputId = input<string | undefined>(undefined);\n readonly ariaLabel = input<string | undefined>(undefined);\n readonly ariaLabelledBy = input<string | undefined>(undefined);\n readonly size = input<TxSelectSize>('medium');\n readonly variant = input<TxFieldVariant>('outlined');\n readonly invalid = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n readonly readonly = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly dt = input<TectraDeepPartial<TectraSelectTokens> | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly changed = output<string | string[] | null>();\n\n readonly items = computed<TxCountryItem[]>(() => {\n const locale = this.locale.locale().intl;\n const items = (this.options() ?? TX_COUNTRY_CODES).map((option) => {\n const entry: TxCountryOption = typeof option === 'string' ? { code: option } : option;\n const code = entry.code.trim().toUpperCase();\n return {\n code,\n value: entry.value ?? code,\n label: entry.label ?? countryName(code, locale),\n count: entry.count ?? null,\n hint: entry.hint ?? '',\n disabled: !!entry.disabled,\n };\n });\n if (this.sort() === 'name') {\n const collator = new Intl.Collator(locale);\n items.sort((a, b) => collator.compare(a.label, b.label));\n }\n return items;\n });\n readonly virtual = computed(() => this.items().length > this.virtualScrollThreshold());\n\n extraCount(items: TxSelectItem[]): number {\n return Math.max(0, items.length - this.maxFlags());\n }\n\n firstFlags(items: TxSelectItem[]): TxCountryItem[] {\n return items.slice(0, this.maxFlags()).map((item) => item.option as TxCountryItem);\n }\n\n onModelChange(value: string | string[] | null): void {\n this.updateValue(value);\n this.changed.emit(value);\n }\n\n onClosed(): void {\n this.markTouched();\n }\n}\n","@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [showName]=\"selected.length === 1\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"invalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.code\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;AAEA,MAAa,uBAAuB,EAClC,SAAS,cACV;ACsBD,IAAa,kBAAb,MAAa,wBAAwB,kBAAoC;CACtD,qBAAqB,aAAa,oBAAoB;CAE/D,SAAS,OAAO,eAAe;CAE9B,UAAU,MAAyD,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC7E,WAAW,MAAwB,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACvE,SAAS,MAAwB,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACpE,OAAO,MAAqB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,QAAQ,MAAmB,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,WAAW,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC3B,yBAAyB,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,yBAAA,CAAA,+BAAA,CAAA,CAAA;CAC1C,cAAc,MAAc,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;C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qB,UAAA;IAAA,QAAA,CAAA,iBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAS,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAU/G,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAZ3B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAmB,SACpB;IAAC;IAAa;IAAkB;IAAU;IAAe;IAAwB;IAAuB;GAAS;GAAC,iBAG1G,wBAAwB;GAAM,WACpC,CAAC;IAAE,SAAS;IAAmB,aAAa,iBAAgB,eAAgB;IAAG,OAAO;GAAI,CAAE;GAAC,MAClG;IACJ,OAAO;IACP,sBAAsB;GACvB;GAAA,UAAA;GAAA,QAAA,CAAA,i2BAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"tectra-ng-ui-country-select.mjs","names":[],"sources":["../../../../packages/ui/country-select/src/country-select.theme.ts","../../../../packages/ui/country-select/src/country-select.component.ts","../../../../packages/ui/country-select/src/country-select.component.html"],"sourcesContent":["import { countryTokens } from '@tectra-ng/themes';\n\nexport const COUNTRY_SELECT_THEME = {\n country: countryTokens,\n};\n","import { NgTemplateOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, booleanAttribute, computed, forwardRef, inject, input, output } from '@angular/core';\nimport { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';\nimport { TxFormControlBase, injectFieldInvalid } from '@tectra-ng/core/forms';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraDeepPartial, TectraSelectTokens } from '@tectra-ng/themes';\nimport { TX_COUNTRY_CODES, TX_REGION_CODES, TxCountry, TxFlagShape, countryName, isCountryCode } from '@tectra-ng/ui/country';\nimport { TxMultiselect } from '@tectra-ng/ui/multiselect';\nimport { TxFieldVariant, TxSelect, TxSelectItem, TxSelectOptionTemplate, TxSelectSize, TxSelectValueTemplate } from '@tectra-ng/ui/select';\nimport { TxCountryItem, TxCountryOption, TxCountrySort } from './country-select.types';\nimport { injectTokens } from '@tectra-ng/core/config';\nimport { COUNTRY_SELECT_THEME } from './country-select.theme';\n\nconst FLAG_CODES = new Set([...TX_COUNTRY_CODES, ...TX_REGION_CODES]);\n\n@Component({\n selector: 'tx-country-select',\n imports: [FormsModule, NgTemplateOutlet, TxSelect, TxMultiselect, TxSelectOptionTemplate, TxSelectValueTemplate, TxCountry],\n templateUrl: './country-select.component.html',\n styleUrl: './country-select.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => TxCountrySelect), multi: true }],\n host: {\n class: 'tx-country-select',\n '[attr.data-styled]': 'unstyled() ? null : true',\n },\n})\nexport class TxCountrySelect extends TxFormControlBase<string | string[]> {\n private readonly countrySelectTheme = injectTokens(COUNTRY_SELECT_THEME);\n\n private locale = inject(TxLocaleService);\n\n readonly options = input<readonly (string | TxCountryOption)[] | undefined>(undefined);\n readonly multiple = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly filter = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly sort = input<TxCountrySort>('name');\n readonly shape = input<TxFlagShape>('rectangle');\n readonly maxFlags = input<number>(3);\n readonly maxNamed = input<number>(1);\n readonly virtualScrollThreshold = input<number>(50);\n readonly placeholder = input<string>('');\n readonly showClear = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly loading = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly inputId = input<string | undefined>(undefined);\n readonly ariaLabel = input<string | undefined>(undefined);\n readonly ariaLabelledBy = input<string | undefined>(undefined);\n readonly size = input<TxSelectSize>('medium');\n readonly variant = input<TxFieldVariant>('outlined');\n readonly invalid = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n readonly readonly = input<boolean, unknown>(false, { transform: booleanAttribute });\n readonly dt = input<TectraDeepPartial<TectraSelectTokens> | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly changed = output<string | string[] | null>();\n\n readonly isInvalid = injectFieldInvalid(this.invalid);\n\n readonly items = computed<TxCountryItem[]>(() => {\n const locale = this.locale.locale().intl;\n const items = (this.options() ?? TX_COUNTRY_CODES).map((option) => {\n const entry: TxCountryOption = typeof option === 'string' ? { code: option } : option;\n const trimmed = entry.code.trim();\n const code = isCountryCode(trimmed) ? trimmed.toUpperCase() : trimmed;\n return {\n code,\n value: entry.value ?? code,\n label: entry.label ?? countryName(code, locale),\n flag: entry.flag ?? FLAG_CODES.has(code),\n count: entry.count ?? null,\n hint: entry.hint ?? '',\n disabled: !!entry.disabled,\n };\n });\n if (this.sort() === 'name') {\n const collator = new Intl.Collator(locale);\n items.sort((a, b) => collator.compare(a.label, b.label));\n }\n return items;\n });\n readonly virtual = computed(() => this.items().length > this.virtualScrollThreshold());\n\n extraCount(items: TxSelectItem[]): number {\n return Math.max(0, items.length - this.maxFlags());\n }\n\n firstFlags(items: TxSelectItem[]): TxCountryItem[] {\n return items.slice(0, this.maxFlags()).map((item) => item.option as TxCountryItem);\n }\n\n showsNames(items: TxSelectItem[]): boolean {\n return items.length <= this.maxNamed();\n }\n\n onModelChange(value: string | string[] | null): void {\n this.updateValue(value);\n this.changed.emit(value);\n }\n\n onClosed(): void {\n this.markTouched();\n }\n}\n","@if (multiple()) {\n <tx-multiselect\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-selected>\n <span class=\"tx-country-select__flags\" [class.tx-country-select__flags--styled]=\"!unstyled()\">\n @for (item of firstFlags(selected); track item.value) {\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [showName]=\"!item.flag || showsNames(selected)\" [shape]=\"shape()\" />\n }\n @if (extraCount(selected); as extra) {\n <span class=\"tx-country-select__more\">+{{ extra }}</span>\n }\n </span>\n </ng-template>\n </tx-multiselect>\n} @else {\n <tx-select\n [options]=\"items()\"\n [optionLabel]=\"'label'\"\n [optionValue]=\"'value'\"\n [optionDisabled]=\"'disabled'\"\n [filter]=\"filter()\"\n [filterBy]=\"'label,code'\"\n [virtualScroll]=\"virtual()\"\n [placeholder]=\"placeholder()\"\n [showClear]=\"showClear()\"\n [loading]=\"loading()\"\n [inputId]=\"inputId()\"\n [ariaLabel]=\"ariaLabel()\"\n [ariaLabelledBy]=\"ariaLabelledBy()\"\n [size]=\"size()\"\n [variant]=\"variant()\"\n [invalid]=\"isInvalid()\"\n [readonly]=\"readonly()\"\n [dt]=\"dt()\"\n [unstyled]=\"unstyled()\"\n [ngModel]=\"value()\"\n [ngModelOptions]=\"{ standalone: true }\"\n [disabled]=\"disabled()\"\n (ngModelChange)=\"onModelChange($event)\"\n (closed)=\"onClosed()\"\n >\n <ng-template txSelectOption let-item>\n <ng-container [ngTemplateOutlet]=\"option\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n </ng-template>\n <ng-template txSelectValue let-item>\n <tx-country [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n </ng-template>\n </tx-select>\n}\n\n<ng-template #option let-item>\n <span class=\"tx-country-select__option\" [class.tx-country-select__option--styled]=\"!unstyled()\">\n <tx-country class=\"tx-country-select__country\" [country]=\"item.flag ? item.code : null\" [name]=\"item.label\" [shape]=\"shape()\" />\n @if (item.hint) {\n <span class=\"tx-country-select__hint\">{{ item.hint }}</span>\n }\n @if (item.count !== null) {\n <span class=\"tx-country-select__count\">{{ item.count }}</span>\n }\n </span>\n</ng-template>\n"],"mappings":";;;;;;;;;;;;;AAEA,MAAa,uBAAuB,EAClC,SAAS,cACV;ACUD,MAAM,6BAAa,IAAI,IAAI,CAAC,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAcpE,IAAa,kBAAb,MAAa,wBAAwB,kBAAoC;CACtD,qBAAqB,aAAa,oBAAoB;CAE/D,SAAS,OAAO,eAAe;CAE9B,UAAU,MAAyD,QAAU,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,+BAAA,CAAA,CAAA;CAC7E,WAAW,MAAwB,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACvE,SAAS,MAAwB,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,SAAA,+BAAA,CAAA;EAAI,WAAW;CAAgB,CAAA;CACpE,OAAO,MAAqB,QAAO,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CACnC,QAAQ,MAAmB,aAAY,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CACvC,WAAW,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAC3B,WAAW,MAAc,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,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AA;KAAA;KAAA;IAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAQ,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAa,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,SAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAsB,UAAA;IAAA,QAAA,CAAA,kBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAqB,UAAA;IAAA,QAAA,CAAA,iBAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAS,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;KAAA;IAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAU/G,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAZ3B,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAmB,SACpB;IAAC;IAAa;IAAkB;IAAU;IAAe;IAAwB;IAAuB;GAAS;GAAC,iBAG1G,wBAAwB;GAAM,WACpC,CAAC;IAAE,SAAS;IAAmB,aAAa,iBAAgB,eAAgB;IAAG,OAAO;GAAI,CAAE;GAAC,MAClG;IACJ,OAAO;IACP,sBAAsB;GACvB;GAAA,UAAA;GAAA,QAAA,CAAA,i2BAAA;EAAA,CAAA"}
@@ -6,6 +6,8 @@ import { optionalBoolean } from "@tectra-ng/core/utils";
6
6
  import { countryTokens, toStyleObject } from "@tectra-ng/themes";
7
7
  import { provideTxIconDefaults, txIconCircle, txIconCode, txIconFlag } from "@tectra-ng/icons";
8
8
  const TX_COUNTRY_CODES = "AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" ");
9
+ const TX_REGION_CODES = ["EU", "UN"];
10
+ const FALLBACK_LOCALE = "en-US";
9
11
  const COUNTRY_CODE = /^[A-Z]{2}$/;
10
12
  const nameCache = /* @__PURE__ */ new Map();
11
13
  function isCountryCode(code) {
@@ -14,15 +16,22 @@ function isCountryCode(code) {
14
16
  function countryName(code, locale) {
15
17
  const upper = code.trim().toUpperCase();
16
18
  if (!isCountryCode(upper)) return code;
19
+ return regionNames(locale).of(upper) ?? upper;
20
+ }
21
+ function regionNames(locale) {
17
22
  let names = nameCache.get(locale);
18
23
  if (!names) {
19
- names = new Intl.DisplayNames([locale], {
20
- type: "region",
21
- fallback: "code"
22
- });
24
+ try {
25
+ names = new Intl.DisplayNames([locale], {
26
+ type: "region",
27
+ fallback: "code"
28
+ });
29
+ } catch {
30
+ names = regionNames(FALLBACK_LOCALE);
31
+ }
23
32
  nameCache.set(locale, names);
24
33
  }
25
- return names.of(upper) ?? upper;
34
+ return names;
26
35
  }
27
36
  function countryEmoji(code) {
28
37
  const upper = code.trim().toUpperCase();
@@ -362,6 +371,6 @@ i0.ɵɵngDeclareClassMetadata({
362
371
  function isPromise(value) {
363
372
  return typeof value?.then === "function";
364
373
  }
365
- export { TX_COUNTRY_CODES, TX_FLAG_RESOLVER, TxCountry, countryEmoji, countryName, isCountryCode, provideTxFlags, txFlagIcons, txFlagImages };
374
+ export { TX_COUNTRY_CODES, TX_FLAG_RESOLVER, TX_REGION_CODES, TxCountry, countryEmoji, countryName, isCountryCode, provideTxFlags, txFlagIcons, txFlagImages };
366
375
 
367
376
  //# sourceMappingURL=tectra-ng-ui-country.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"tectra-ng-ui-country.mjs","names":[],"sources":["../../../../packages/ui/country/src/countries.ts","../../../../packages/ui/country/src/flags.ts","../../../../packages/ui/country/src/country.icons.ts","../../../../packages/ui/country/src/country.theme.ts","../../../../packages/ui/country/src/country.component.ts"],"sourcesContent":["/** ISO 3166-1 alpha-2 codes of the countries the kit knows, plus `XK` for Kosovo. */\nexport const TX_COUNTRY_CODES: readonly string[] = (\n 'AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL ' +\n 'CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT ' +\n 'GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY ' +\n 'MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN ' +\n 'PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT ' +\n 'TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW'\n).split(' ');\n\nconst COUNTRY_CODE = /^[A-Z]{2}$/;\nconst nameCache = new Map<string, Intl.DisplayNames>();\n\n/**\n * Tells whether the text is two letters, in any case, as a country code looks; it does not check that the country exists.\n */\nexport function isCountryCode(code: string | null | undefined): boolean {\n return !!code && COUNTRY_CODE.test(code.trim().toUpperCase());\n}\n\n/**\n * Name of the country in the given locale, such as `Poland` for `PL`; text that is not a country code comes back unchanged.\n */\nexport function countryName(code: string, locale: string): string {\n const upper = code.trim().toUpperCase();\n if (!isCountryCode(upper)) {\n return code;\n }\n let names = nameCache.get(locale);\n if (!names) {\n names = new Intl.DisplayNames([locale], { type: 'region', fallback: 'code' });\n nameCache.set(locale, names);\n }\n return names.of(upper) ?? upper;\n}\n\n/** Emoji flag of the country code; an empty string when the code is not valid. */\nexport function countryEmoji(code: string): string {\n const upper = code.trim().toUpperCase();\n return isCountryCode(upper) ? String.fromCodePoint(...[...upper].map((letter) => 0x1f1e6 + letter.charCodeAt(0) - 65)) : '';\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { TxFlagResolver, TxFlagShape } from './country.types';\n\n/** Injection token of the flag resolver that `tx-country` uses; set it with `provideTxFlags`. */\nexport const TX_FLAG_RESOLVER = new InjectionToken<TxFlagResolver>('TX_FLAG_RESOLVER');\n\n/** Draws flags as images or CSS classes through the resolver instead of emoji; provide it once in the app. */\nexport function provideTxFlags(resolver: TxFlagResolver): Provider {\n return { provide: TX_FLAG_RESOLVER, useValue: resolver };\n}\n\n/**\n * Flag resolver for a flag stylesheet that is already on the page, using the classes `fi fi-ua` (and `fis` for circles).\n */\nexport const txFlagIcons: TxFlagResolver = (code, shape) => ({\n class: `fi fi-${code.toLowerCase()}${shape === 'circle' ? ' fis' : ''}`,\n});\n\n/**\n * Builds a flag resolver from a function that returns an image address for a lower-case code and a shape, now or as a promise.\n */\nexport function txFlagImages(url: (code: string, shape: TxFlagShape) => string | Promise<string | null>): TxFlagResolver {\n return (code, shape) => {\n const src = url(code.toLowerCase(), shape);\n return typeof src === 'string' ? { src } : src.then((value) => (value ? { src: value } : null));\n };\n}\n","import { TxIconSet, txIconCircle, txIconCode, txIconFlag } from '@tectra-ng/icons';\n\nexport const COUNTRY_ICON_DEFAULTS: TxIconSet = {\n circle: txIconCircle,\n code: txIconCode,\n flag: txIconFlag,\n};\n","import { countryTokens } from '@tectra-ng/themes';\n\nexport const COUNTRY_THEME = {\n country: countryTokens,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, effect, inject, input, signal } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraCountryTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { countryEmoji, countryName, isCountryCode } from './countries';\nimport { TxCountryPart, TxCountrySize, TxFlag, TxFlagShape } from './country.types';\nimport { TX_FLAG_RESOLVER } from './flags';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { COUNTRY_ICON_DEFAULTS } from './country.icons';\nimport { COUNTRY_THEME } from './country.theme';\n\n@Component({\n selector: 'tx-country',\n template: `\n @if (code(); as iso) {\n @if (flag(); as image) {\n @if (image.src) {\n <img class=\"tx-country__flag tx-country__flag--image\" alt=\"\" [src]=\"image.src\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\" />\n } @else {\n <span class=\"tx-country__flag\" aria-hidden=\"true\" [class]=\"flagClass(image.class)\" [style]=\"passThrough().flag?.style\"></span>\n }\n } @else if (isLoading()) {\n <span class=\"tx-country__flag tx-country__flag--loading\" aria-hidden=\"true\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\"></span>\n } @else {\n <span class=\"tx-country__flag tx-country__flag--emoji\" aria-hidden=\"true\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\">{{\n emoji()\n }}</span>\n }\n }\n @if (showName()) {\n <span class=\"tx-country__name\" [class]=\"passThrough().name?.class\" [style]=\"passThrough().name?.style\">{{ label() }}</span>\n }\n `,\n styleUrl: './country.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-country',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-size]': 'size()',\n '[attr.data-shape]': 'shape()',\n '[attr.role]': 'showName() || !code() ? null : \"img\"',\n '[attr.aria-label]': 'showName() || !code() ? null : label()',\n '[attr.title]': 'showName() ? null : label()',\n },\n viewProviders: [provideTxIconDefaults(COUNTRY_ICON_DEFAULTS)],\n})\nexport class TxCountry {\n private readonly countryTheme = injectTokens(COUNTRY_THEME);\n\n private locale = inject(TxLocaleService);\n private resolver = inject(TX_FLAG_RESOLVER, { optional: true });\n\n readonly country = input<string | null | undefined>(undefined);\n readonly name = input<string | undefined>(undefined);\n readonly showName = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly size = input<TxCountrySize>('small');\n readonly shape = input<TxFlagShape>('rectangle');\n readonly dt = input<TectraDeepPartial<TectraCountryTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxCountryPart, TxCountry> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('country', this, this.pt, this.ptOptions);\n readonly code = computed(() => {\n const value = (this.country() ?? '').trim().toUpperCase();\n return isCountryCode(value) ? value : null;\n });\n readonly label = computed(() => {\n const code = this.code();\n return this.name() ?? (code ? countryName(code, this.locale.locale().intl) : (this.country() ?? '').trim());\n });\n private readonly loaded = signal<{ key: string; flag: TxFlag | null } | null>(null);\n private readonly resolution = computed(() => {\n const code = this.code();\n return code && this.resolver ? { key: `${this.shape()}:${code}`, value: this.resolver(code, this.shape()) } : null;\n });\n readonly isLoading = computed(() => {\n const resolution = this.resolution();\n return !!resolution && isPromise(resolution.value) && this.loaded()?.key !== resolution.key;\n });\n readonly flag = computed(() => {\n const resolution = this.resolution();\n if (!resolution) {\n return null;\n }\n if (!isPromise(resolution.value)) {\n return resolution.value;\n }\n const loaded = this.loaded();\n return loaded?.key === resolution.key ? loaded.flag : null;\n });\n readonly emoji = computed(() => countryEmoji(this.code() ?? ''));\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-country'), ...this.passThrough().root?.style }));\n\n constructor() {\n effect(() => {\n const resolution = this.resolution();\n if (resolution && isPromise(resolution.value)) {\n const { key, value } = resolution;\n value.then(\n (flag) => this.loaded.set({ key, flag }),\n () => this.loaded.set({ key, flag: null }),\n );\n }\n });\n }\n\n flagClass(own: string | undefined): string {\n return [own, this.passThrough().flag?.class].filter(Boolean).join(' ');\n }\n}\n\nfunction isPromise<T>(value: T | Promise<T>): value is Promise<T> {\n return typeof (value as Promise<T> | null)?.then === 'function';\n}\n"],"mappings":";;;;;;;AACA,MAAa,mBACX,gvBAMA,MAAM,GAAG;AAEX,MAAM,eAAe;AACrB,MAAM,4BAAY,IAAI,IAAG;AAKzB,SAAgB,cAAc,MAA+B;CAC3D,OAAO,CAAC,CAAC,QAAQ,aAAa,KAAK,KAAK,KAAI,CAAE,CAAC,YAAW,CAAE;AAC9D;AAKA,SAAgB,YAAY,MAAc,QAAc;CACtD,MAAM,QAAQ,KAAK,KAAI,CAAE,CAAC,YAAW;CACrC,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;CAET,IAAI,QAAQ,UAAU,IAAI,MAAM;CAChC,IAAI,CAAC,OAAO;EACV,QAAQ,IAAI,KAAK,aAAa,CAAC,MAAM,GAAG;GAAE,MAAM;GAAU,UAA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BAAA;IAAA,aAAA;IAAA,mBAAA;IAAA,cAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,UAAA;EAAA,UAnCV;;;;;;;;;;;;;;;;;;;;EAmBT,UAAA;EAAA,QAAA,CAAA,moCAAA;EAAA,eAcc,CAAC,sBAAsB,qBAAqB,CAAC;EAAC,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAElD,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EArCrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAY,UACZ;;;;;;;;;;;;;;;;;;;;GAmBT,iBAEgB,wBAAwB;GAAM,MACzC;IACJ,OAAO;IACP,WAAW;IACX,WAAW;IACX,sBAAsB;IACtB,oBAAoB;IACpB,qBAAqB;IACrB,eAAe;IACf,qBAAqB;IACrB,gBAAgB;GACjB;GAAA,eACc,CAAC,sBAAsB,qBAAqB,CAAC;GAAC,QAAA,CAAA,moCAAA;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqE/D,SAAS,UAAa,OAAqB;CACzC,OAAO,OAAQ,OAA6B,SAAS;AACvD"}
1
+ {"version":3,"file":"tectra-ng-ui-country.mjs","names":[],"sources":["../../../../packages/ui/country/src/countries.ts","../../../../packages/ui/country/src/flags.ts","../../../../packages/ui/country/src/country.icons.ts","../../../../packages/ui/country/src/country.theme.ts","../../../../packages/ui/country/src/country.component.ts"],"sourcesContent":["/** ISO 3166-1 alpha-2 codes of the countries the kit knows, plus `XK` for Kosovo. */\nexport const TX_COUNTRY_CODES: readonly string[] = (\n 'AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL ' +\n 'CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT ' +\n 'GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY ' +\n 'MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN ' +\n 'PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT ' +\n 'TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW'\n).split(' ');\n\n/**\n * Two-letter codes that are not countries but have a localized name and a flag: `EU` (European Union) and `UN`\n * (United Nations). Add them to the country list where they fit: `[...TX_COUNTRY_CODES, ...TX_REGION_CODES]`.\n */\nexport const TX_REGION_CODES: readonly string[] = ['EU', 'UN'];\n\nconst FALLBACK_LOCALE = 'en-US';\nconst COUNTRY_CODE = /^[A-Z]{2}$/;\nconst nameCache = new Map<string, Intl.DisplayNames>();\n\n/**\n * Tells whether the text is two letters, in any case, as a country code looks; it does not check that the country exists.\n */\nexport function isCountryCode(code: string | null | undefined): boolean {\n return !!code && COUNTRY_CODE.test(code.trim().toUpperCase());\n}\n\n/**\n * Name of the country in the given locale, such as `Poland` for `PL`; text that is not a country code comes back unchanged.\n * A locale that `Intl` does not accept falls back to `en-US`.\n */\nexport function countryName(code: string, locale: string): string {\n const upper = code.trim().toUpperCase();\n if (!isCountryCode(upper)) {\n return code;\n }\n return regionNames(locale).of(upper) ?? upper;\n}\n\nfunction regionNames(locale: string): Intl.DisplayNames {\n let names = nameCache.get(locale);\n if (!names) {\n try {\n names = new Intl.DisplayNames([locale], { type: 'region', fallback: 'code' });\n } catch {\n names = regionNames(FALLBACK_LOCALE);\n }\n nameCache.set(locale, names);\n }\n return names;\n}\n\n/** Emoji flag of the country code; an empty string when the code is not valid. */\nexport function countryEmoji(code: string): string {\n const upper = code.trim().toUpperCase();\n return isCountryCode(upper) ? String.fromCodePoint(...[...upper].map((letter) => 0x1f1e6 + letter.charCodeAt(0) - 65)) : '';\n}\n","import { InjectionToken, Provider } from '@angular/core';\nimport { TxFlagResolver, TxFlagShape } from './country.types';\n\n/** Injection token of the flag resolver that `tx-country` uses; set it with `provideTxFlags`. */\nexport const TX_FLAG_RESOLVER = new InjectionToken<TxFlagResolver>('TX_FLAG_RESOLVER');\n\n/** Draws flags as images or CSS classes through the resolver instead of emoji; provide it once in the app. */\nexport function provideTxFlags(resolver: TxFlagResolver): Provider {\n return { provide: TX_FLAG_RESOLVER, useValue: resolver };\n}\n\n/**\n * Flag resolver for a flag stylesheet that is already on the page, using the classes `fi fi-ua` (and `fis` for circles).\n */\nexport const txFlagIcons: TxFlagResolver = (code, shape) => ({\n class: `fi fi-${code.toLowerCase()}${shape === 'circle' ? ' fis' : ''}`,\n});\n\n/**\n * Builds a flag resolver from a function that returns an image address for a lower-case code and a shape, now or as a promise.\n */\nexport function txFlagImages(url: (code: string, shape: TxFlagShape) => string | Promise<string | null>): TxFlagResolver {\n return (code, shape) => {\n const src = url(code.toLowerCase(), shape);\n return typeof src === 'string' ? { src } : src.then((value) => (value ? { src: value } : null));\n };\n}\n","import { TxIconSet, txIconCircle, txIconCode, txIconFlag } from '@tectra-ng/icons';\n\nexport const COUNTRY_ICON_DEFAULTS: TxIconSet = {\n circle: txIconCircle,\n code: txIconCode,\n flag: txIconFlag,\n};\n","import { countryTokens } from '@tectra-ng/themes';\n\nexport const COUNTRY_THEME = {\n country: countryTokens,\n};\n","import { ChangeDetectionStrategy, Component, booleanAttribute, computed, effect, inject, input, signal } from '@angular/core';\nimport { injectPassThrough, injectTokens, injectUnstyled, TxPassThrough, TxPassThroughOptions } from '@tectra-ng/core/config';\nimport { TxLocaleService } from '@tectra-ng/core/i18n';\nimport { optionalBoolean } from '@tectra-ng/core/utils';\nimport { TectraCountryTokens, TectraDeepPartial, toStyleObject } from '@tectra-ng/themes';\nimport { countryEmoji, countryName, isCountryCode } from './countries';\nimport { TxCountryPart, TxCountrySize, TxFlag, TxFlagShape } from './country.types';\nimport { TX_FLAG_RESOLVER } from './flags';\nimport { provideTxIconDefaults } from '@tectra-ng/icons';\nimport { COUNTRY_ICON_DEFAULTS } from './country.icons';\nimport { COUNTRY_THEME } from './country.theme';\n\n@Component({\n selector: 'tx-country',\n template: `\n @if (code(); as iso) {\n @if (flag(); as image) {\n @if (image.src) {\n <img class=\"tx-country__flag tx-country__flag--image\" alt=\"\" [src]=\"image.src\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\" />\n } @else {\n <span class=\"tx-country__flag\" aria-hidden=\"true\" [class]=\"flagClass(image.class)\" [style]=\"passThrough().flag?.style\"></span>\n }\n } @else if (isLoading()) {\n <span class=\"tx-country__flag tx-country__flag--loading\" aria-hidden=\"true\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\"></span>\n } @else {\n <span class=\"tx-country__flag tx-country__flag--emoji\" aria-hidden=\"true\" [class]=\"passThrough().flag?.class\" [style]=\"passThrough().flag?.style\">{{\n emoji()\n }}</span>\n }\n }\n @if (showName()) {\n <span class=\"tx-country__name\" [class]=\"passThrough().name?.class\" [style]=\"passThrough().name?.style\">{{ label() }}</span>\n }\n `,\n styleUrl: './country.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'tx-country',\n '[class]': 'passThrough().root?.class',\n '[style]': 'hostStyle()',\n '[attr.data-styled]': '!isUnstyled() || null',\n '[attr.data-size]': 'size()',\n '[attr.data-shape]': 'shape()',\n '[attr.role]': 'showName() || !code() ? null : \"img\"',\n '[attr.aria-label]': 'showName() || !code() ? null : label()',\n '[attr.title]': 'showName() ? null : label()',\n },\n viewProviders: [provideTxIconDefaults(COUNTRY_ICON_DEFAULTS)],\n})\nexport class TxCountry {\n private readonly countryTheme = injectTokens(COUNTRY_THEME);\n\n private locale = inject(TxLocaleService);\n private resolver = inject(TX_FLAG_RESOLVER, { optional: true });\n\n readonly country = input<string | null | undefined>(undefined);\n readonly name = input<string | undefined>(undefined);\n readonly showName = input<boolean, unknown>(true, { transform: booleanAttribute });\n readonly size = input<TxCountrySize>('small');\n readonly shape = input<TxFlagShape>('rectangle');\n readonly dt = input<TectraDeepPartial<TectraCountryTokens> | undefined>(undefined);\n readonly pt = input<TxPassThrough<TxCountryPart, TxCountry> | undefined>(undefined);\n readonly ptOptions = input<TxPassThroughOptions | undefined>(undefined);\n readonly unstyled = input<boolean | undefined, unknown>(undefined, { transform: optionalBoolean });\n\n readonly isUnstyled = injectUnstyled(this.unstyled);\n readonly passThrough = injectPassThrough('country', this, this.pt, this.ptOptions);\n readonly code = computed(() => {\n const value = (this.country() ?? '').trim().toUpperCase();\n return isCountryCode(value) ? value : null;\n });\n readonly label = computed(() => {\n const code = this.code();\n return this.name() ?? (code ? countryName(code, this.locale.locale().intl) : (this.country() ?? '').trim());\n });\n private readonly loaded = signal<{ key: string; flag: TxFlag | null } | null>(null);\n private readonly resolution = computed(() => {\n const code = this.code();\n return code && this.resolver ? { key: `${this.shape()}:${code}`, value: this.resolver(code, this.shape()) } : null;\n });\n readonly isLoading = computed(() => {\n const resolution = this.resolution();\n return !!resolution && isPromise(resolution.value) && this.loaded()?.key !== resolution.key;\n });\n readonly flag = computed(() => {\n const resolution = this.resolution();\n if (!resolution) {\n return null;\n }\n if (!isPromise(resolution.value)) {\n return resolution.value;\n }\n const loaded = this.loaded();\n return loaded?.key === resolution.key ? loaded.flag : null;\n });\n readonly emoji = computed(() => countryEmoji(this.code() ?? ''));\n readonly hostStyle = computed(() => ({ ...toStyleObject(this.dt(), '--tx-country'), ...this.passThrough().root?.style }));\n\n constructor() {\n effect(() => {\n const resolution = this.resolution();\n if (resolution && isPromise(resolution.value)) {\n const { key, value } = resolution;\n value.then(\n (flag) => this.loaded.set({ key, flag }),\n () => this.loaded.set({ key, flag: null }),\n );\n }\n });\n }\n\n flagClass(own: string | undefined): string {\n return [own, this.passThrough().flag?.class].filter(Boolean).join(' ');\n }\n}\n\nfunction isPromise<T>(value: T | Promise<T>): value is Promise<T> {\n return typeof (value as Promise<T> | null)?.then === 'function';\n}\n"],"mappings":";;;;;;;AACA,MAAa,mBACX,gvBAMA,MAAM,GAAG;AAMX,MAAa,kBAAqC,CAAC,MAAM,IAAI;AAE7D,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,4BAAY,IAAI,IAAG;AAKzB,SAAgB,cAAc,MAA+B;CAC3D,OAAO,CAAC,CAAC,QAAQ,aAAa,KAAK,KAAK,KAAI,CAAE,CAAC,YAAW,CAAE;AAC9D;AAMA,SAAgB,YAAY,MAAc,QAAc;CACtD,MAAM,QAAQ,KAAK,KAAI,CAAE,CAAC,YAAW;CACrC,IAAI,CAAC,cAAc,KAAK,GACtB,OAAO;CAET,OAAO,YAAY,MAAM,CAAC,CAAC,GAAG,KAAK,KAAK;AAC1C;AAEA,SAAS,YAAY,QAAc;CACjC,IAAI,QAAQ,UAAU,IAAI,MAAM;CAChC,IAAI,CAAC,OAAO;EACV,IAAI;GACF,QAAQ,IAAI,KAAK,aAAa,CAAC,MAAM,GAAG;IAAE,MAAM;IAAU,UAAU;GAAM,CAAE;EAC9E,QAAQ;GACN,QAAQ,YAAY,eAAe;EACrC;EACA,UAAU,IAAI,QAAQ,KAAK;CAC7B;CACA,OAAO;AACT;AAGA,SAAgB,aAAa,MAAY;CACvC,MAAM,QAAQ,KAAK,KAAI,CAAE,CAAC,YAAW;CACrC,OAAO,cAAc,KAAK,IAAI,OAAO,cAAc,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,KAAK,WAAW,SAAU,OAAO,WAAW,CAAC,IAAI,EAAE,CAAC,IAAI;AAC3H;ACpDA,MAAa,mBAAmB,IAAI,eAA+B,kBAAkB;A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