@vectoriox/iox-ui 5.185.0 → 5.187.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5202,8 +5202,28 @@ const SUBMIT_CHECK_SVG = `<svg class="${SubmitLabelClass.Check}" width="16" heig
5202
5202
  * translation service — the document's `lang` picks, like the date picker's words). */
5203
5203
  const SENT_WORDS = Object.freeze({ en: 'Sent', he: 'נשלח' });
5204
5204
  function sentWord(lang) {
5205
+ return SENT_WORDS[languageOf(lang)] ?? SENT_WORDS['en'];
5206
+ }
5207
+ /** A `lang` attribute's language: `he-IL` → `he` (and the old `iw`). */
5208
+ function languageOf(lang) {
5205
5209
  const language = String(lang ?? '').toLowerCase().split(/[-_]/)[0];
5206
- return SENT_WORDS[language === 'iw' ? 'he' : language] ?? SENT_WORDS['en'];
5210
+ return language === 'iw' ? 'he' : language;
5211
+ }
5212
+ /** "While sending" in the site's language (iox-ui#158). The English one is the SubmitButton's baseline
5213
+ * (`loadingLabel`), which every stamped node carries until its author writes their own. */
5214
+ const BUSY_WORDS = Object.freeze({ en: 'Sending…', he: 'שולחים…' });
5215
+ /** The SubmitButton's baseline "While sending" words — what a node holds that nobody wrote. */
5216
+ const DEFAULT_BUSY_WORDS = BUSY_WORDS['en'];
5217
+ function busyWord(lang) {
5218
+ return BUSY_WORDS[languageOf(lang)] ?? DEFAULT_BUSY_WORDS;
5219
+ }
5220
+ /**
5221
+ * What a submit button says while its form sends, in BOTH renderers (iox-ui#158): the author's words; the untouched
5222
+ * English baseline (or none set at all) in the page's language — a Hebrew site built before its composer wrote Hebrew
5223
+ * here says "שולחים…" without a rebuild. An empty string stays empty: the button keeps its idle words while sending.
5224
+ */
5225
+ function submitBusyWords(loadingLabel, lang) {
5226
+ return loadingLabel == null || loadingLabel === DEFAULT_BUSY_WORDS ? busyWord(lang) : loadingLabel;
5207
5227
  }
5208
5228
  /**
5209
5229
  * A submit button's words, as markup: its three labels stacked in one grid cell (the button keeps the longest one's
@@ -7801,11 +7821,16 @@ class IoxSubmitButtonComponent {
7801
7821
  this.host = host;
7802
7822
  this.nodeId = '';
7803
7823
  this.label = 'Submit';
7804
- this.loadingLabel = 'Sending…';
7824
+ this.loadingLabel = DEFAULT_BUSY_WORDS;
7805
7825
  /** What it says once its form has sent (N2). Empty: the catalog's "Sent", in the host's language. */
7806
7826
  this.sentLabel = '';
7807
7827
  this.disableWhileSubmitting = true;
7808
7828
  }
7829
+ /** The author's While sending words; the untouched English baseline in the page's language (iox-ui#158) — forms-core
7830
+ * `submitBusyWords`, the ONE decision the string renderer makes too. Empty: the idle words stay while sending. */
7831
+ get busyWords() {
7832
+ return submitBusyWords(this.loadingLabel, this.pageLang());
7833
+ }
7809
7834
  /** The author's Sent words; else the host's translation of the catalog's; else "Sent" in the page's language. */
7810
7835
  get sentWords() {
7811
7836
  if (this.sentLabel)
@@ -7814,15 +7839,19 @@ class IoxSubmitButtonComponent {
7814
7839
  const translated = (this.resolveMessage ?? defaultMessageResolver)(key);
7815
7840
  if (translated && translated !== key && translated !== DEFAULT_EN_MESSAGES[key])
7816
7841
  return translated;
7842
+ return sentWord(this.pageLang());
7843
+ }
7844
+ /** The page's language: the nearest `lang` (the canvas's site scope, the engine's `<html>`). */
7845
+ pageLang() {
7817
7846
  const element = this.host?.nativeElement;
7818
- return sentWord(element?.closest?.('[lang]')?.getAttribute('lang') ?? element?.ownerDocument?.documentElement?.lang);
7847
+ return element?.closest?.('[lang]')?.getAttribute('lang') ?? element?.ownerDocument?.documentElement?.lang;
7819
7848
  }
7820
7849
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: IoxSubmitButtonComponent, deps: [{ token: IOX_FORM_MESSAGES, optional: true }, { token: i0.ElementRef, optional: true }], target: i0.ɵɵFactoryTarget.Component }); }
7821
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.31", type: IoxSubmitButtonComponent, isStandalone: false, selector: "button[iox-submit]", inputs: { nodeId: "nodeId", label: "label", loadingLabel: "loadingLabel", sentLabel: "sentLabel", disableWhileSubmitting: "disableWhileSubmitting" }, host: { properties: { "class": "'iox-submit iox-node-' + nodeId", "attr.type": "'submit'", "attr.data-iox-keep-enabled": "disableWhileSubmitting === false ? \"\" : null" } }, ngImport: i0, template: `<span class="iox-submit__labels"><span class="iox-submit__idle">{{ label }}</span><span class="iox-submit__busy">{{ loadingLabel || label }}</span><span class="iox-submit__sent"><svg class="iox-submit__check" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5" pathLength="100" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg><span>{{ sentWords }}</span></span></span>`, isInline: true, styles: [":host{box-sizing:border-box;cursor:pointer}\n"] }); }
7850
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.31", type: IoxSubmitButtonComponent, isStandalone: false, selector: "button[iox-submit]", inputs: { nodeId: "nodeId", label: "label", loadingLabel: "loadingLabel", sentLabel: "sentLabel", disableWhileSubmitting: "disableWhileSubmitting" }, host: { properties: { "class": "'iox-submit iox-node-' + nodeId", "attr.type": "'submit'", "attr.data-iox-keep-enabled": "disableWhileSubmitting === false ? \"\" : null" } }, ngImport: i0, template: `<span class="iox-submit__labels"><span class="iox-submit__idle">{{ label }}</span><span class="iox-submit__busy">{{ busyWords || label }}</span><span class="iox-submit__sent"><svg class="iox-submit__check" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5" pathLength="100" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg><span>{{ sentWords }}</span></span></span>`, isInline: true, styles: [":host{box-sizing:border-box;cursor:pointer}\n"] }); }
7822
7851
  }
7823
7852
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: IoxSubmitButtonComponent, decorators: [{
7824
7853
  type: Component,
7825
- args: [{ selector: 'button[iox-submit]', template: `<span class="iox-submit__labels"><span class="iox-submit__idle">{{ label }}</span><span class="iox-submit__busy">{{ loadingLabel || label }}</span><span class="iox-submit__sent"><svg class="iox-submit__check" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5" pathLength="100" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg><span>{{ sentWords }}</span></span></span>`, host: {
7854
+ args: [{ selector: 'button[iox-submit]', template: `<span class="iox-submit__labels"><span class="iox-submit__idle">{{ label }}</span><span class="iox-submit__busy">{{ busyWords || label }}</span><span class="iox-submit__sent"><svg class="iox-submit__check" width="16" height="16" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 12.5l4.5 4.5L19 7.5" pathLength="100" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg><span>{{ sentWords }}</span></span></span>`, host: {
7826
7855
  '[class]': "'iox-submit iox-node-' + nodeId",
7827
7856
  '[attr.type]': "'submit'",
7828
7857
  // forms-core SUBMIT_KEEP_ENABLED_ATTRIBUTE — read by `syncSubmitButtons`.